www.pudn.com > MPEG2systemsrc.rar > Producer.H
/* Copyright (C) 1995, Tektronix Inc. All Rights Reserved.
*
* Usage Restrictions
*
* License is granted to copy, to use, and to make and to use derivative
* works for research and evaluation purposes only.
*
* Disclaimer of Warranty
*
* These software programs are available to the user without any license
* fee or royalty on an "as is" basis. Tektronix Inc. disclaims any and
* all warranties, whether express, implied, or statuary, including any
* implied warranties or merchantability or of fitness for a particular
* purpose. In no event shall the copyright-holder be liable for any
* incidental, punitive, or consequential damages of any kind whatsoever
* arising from the use of these programs.
*
* This disclaimer of warranty extends to the user of these programs and
* user's customers, employees, agents, transferees, successors, and
* assigns.
*
* The Tektronix Inc. does not represent or warrant that the programs
* furnished hereunder are free of infringement of any third-party
* patents.
*/
/* Producer class */
#ifndef producer_h
#define producer_h
class OutputPort;
class Encoder;
class Producer
{
public:
Producer (Encoder*);
void connect (OutputPort*);
virtual int fill_buffer ();
virtual int get_nready ();
int send_partial (int);
protected:
Encoder* encoder;
OutputPort* oport;
char* buf;
int buf_index;
int length_stored;
};
/*
DOCUMENTATION
Producers write things to OutputPorts. Typical subclasses are
TSProducer, PESProducer, PATProducer, MapProducer, etc. Although
some of these classes define methods for writing directly on the
OutputPort (e.g. TSProducer), Producers can also be set up to first
fill an internal buffer (via the fill_buffer method). Subsequent
calls to send_partial will send bytes from the buffer to the OutputPort.
Public members are:
Producer (Encoder*);
The only constructor. All Producers have an Encoder object
available for such things are reading a encoder clock for the
generation of timestamps.
void connect (OutputPort*);
To connect to an OutputPort.
virtual int fill_buffer ();
Defined in subclasses to fill the buffer, buf.
virtual int get_nready ();
Returns the number of bytes ready for output (e.g. what's left in
the buffer).
int send_partial (int);
Will send a specified number of bytes to the OutputPort. If the
number requested exceeds the number available in the buffer, then
the output is padded with 0xff bytes.
*/
#endif