www.pudn.com > MPEG2systemsrc.rar > Directory.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.
*/

/* Directory, etc. classes */

#ifndef directory_h
#define directory_h

enum StreamType {MPEGG1VIDEO = 1, MPEG2VIDEO,
		 MPEG1AUDIO, MPEG2AUDIO, MPEGPRIVATE};

enum ProgramState {ACTIVE, NOTACTIVE};

const int UNASSIGNED = -1;

class EStream;
class EStreamRecord;
class Program;
class ProgramRecord;
class Directory;

class Directory
{
public:
  Directory ();
  void add_program (Program*);
  void remove_program (Program*);
  void remove_program (int);        // remove by program_number
  Program* get_program (int);       // find by program_number
  int get_num_programs ();
  ProgramRecord* head_prec;
  void print ();
private:
};

class Program
{
public:
  Program ();
  Program (int);
  Program (int, int);    
  int program_number;
  int pid;
  EStream* pcr_estream;
  int active;
  void activate ();
  void deactivate ();
  void set_pcr_estream (EStream*);
  void add_estream (EStream*);
  void remove_estream (EStream*);
  void remove_estream (int);  
  EStream* get_estream (int);       // find by pid
  int get_num_streams ();
  EStreamRecord* head_erec;
  void print ();
private:
};

class ProgramRecord
{
public:
  ProgramRecord (Program*);
  Program* program;
  ProgramRecord* next_prec;
};

class EStream
{
public:
  EStream(StreamType, int, int);        // type, pid, bandwidth
  StreamType stream_type;
  int bandwidth;
  int pid;
  void print ();
};

class EStreamRecord
{
public:
  EStreamRecord (EStream*);
  EStream* estream;
  EStreamRecord* next_erec;
};

/* 
 DOCUMENTATION

 Directory, Program and EStream are used together to manage a list of
 Programs where each Program contains a list of elementary streams
 (EStreams).

 These classes are used by the Encoder and Decoder class as a database
 of program content information.  Encoding applications build a
 Directory and install it in the Encoder.  The Encoder then uses the
 directory to assemble the multiplex.  Decoding applications build a
 Directory which the Decoder will manipulate to reflect the stream
 contents.  The Directory can then be examined by the application.

 Directories manage a list of Programs and allow retrieval, insertion
 and deletion.

 Programs manage a list of EStreams and allow retrieval, insertion,
 and deletion.  Programs also have program_numbers, pids (for the
 MapSection), and pcr_estreams.  They can be active or inactive.  The
 meaning of active or inactive depends on the user of the Directory.

 EStreams have a StreamType, a bandwidth and a pid.
*/

#endif