/*
 * Emunation Plugin for MD-API 
 *
 * This code is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This code is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 * Or, point your browser to http://www.gnu.org/copyleft/gpl.html
 */
 
#ifndef __DVBSECTIONDATA_H
#define __DVBSECTIONDATA_H
#include "tools.h"
//PAT DATA List Definitions
#define u_int unsigned

class cPAT_PMTList;
class cMPEGCADescriptor;

class cPAT:public cList<cPAT_PMTList>
{
public:
    cPAT();
    //DVB Data Fields
    u_int table_id;
    u_int section_syntax_indicator;		
    u_int reserved_1;
    u_int section_length;
    u_int transport_stream_id;
    u_int reserved_2;
    u_int version_number;
    u_int current_next_indicator;
    u_int section_number;
    u_int last_section_number;
    
};

class cPAT_PMTList:public cListObject
{
public:
    cPAT_PMTList();
    cPAT_PMTList(int program_number,int reserved,int network_pmt_PID);
    //DVB data fields;
    u_int program_number;
    u_int reserved;
    u_int network_pmt_PID;
};

class cPMT:public cList<cMPEGCADescriptor>
{
public:
    cPMT();
    u_int      table_id;
    u_int      section_syntax_indicator;		
    u_int      b_null;		
    u_int      reserved_1;
    int        section_length;
    u_int      program_number;
    u_int      reserved_2;
    u_int      version_number;
    u_int      current_next_indicator;
    u_int      section_number;
    u_int      last_section_number;
    u_int      reserved_3;
    u_int      pcr_pid;
    u_int      reserved_4;
    int        program_info_length;
};

class cPMT_ProgramInfoList
{
public:
    cPMT_ProgramInfoList(){}
    u_int      stream_type;
    u_int      reserved_1; 
    u_int      elementary_PID;
    u_int      reserved_2;
    int        ES_info_length;
};

class cDVBVideoStreamDescriptor
{
public:
    cDVBVideoStreamDescriptor(){}
    u_int      descriptor_tag;
    u_int      descriptor_length;		
    u_int      multiple_frame_rate_flag;
    u_int      frame_rate_code;
    u_int      MPEG_1_only_flag;
    u_int      constrained_parameter_flag;
    u_int      still_picture_flag;
    // if MPEG_1_only_flag == 1
    u_int	profile_and_level_indication;
    u_int	chroma_format;
    u_int	frame_rate_extension_flag;
    u_int	reserved_1;
};
class cDVBAudioStreamDescriptor
{
public:
    cDVBAudioStreamDescriptor(){}
    u_int      descriptor_tag;
    u_int      descriptor_length;		
    u_int      free_format_flag;
    u_int      ID;
    u_int      layer;
    u_int      variable_rate_audio_indicator;
    u_int      reserved_1;

};

class cMPEGCADescriptor:public cListObject
{
public:
    cMPEGCADescriptor(){}
    cMPEGCADescriptor(int CA_system_ID,int CA_PID,int prov_id);
    int Compare(const cListObject &ListObject) const ;
    u_int      descriptor_tag;
    u_int      descriptor_length;		
    u_int      CA_system_ID;
    u_int      reserved;
    u_int      CA_PID;
    u_int prov_id;
};


typedef struct _STR_TABLE
{
    int from;
    int to;
    char str[20];    
}STR_TABLE;



#endif
