Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

mpeg3demux.h

Go to the documentation of this file.
00001 /**********************************************************************
00002 ** Copyright (C) 2000 Trolltech AS.  All rights reserved.
00003 **
00004 ** This file is part of Qtopia Environment.
00005 **
00006 ** This file may be distributed and/or modified under the terms of the
00007 ** GNU General Public License version 2 as published by the Free Software
00008 ** Foundation and appearing in the file LICENSE.GPL included in the
00009 ** packaging of this file.
00010 **
00011 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00012 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00013 **
00014 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00015 **
00016 ** Contact info@trolltech.com if any conditions of this licensing are
00017 ** not clear to you.
00018 **
00019 **********************************************************************/
00020 #ifndef MPEG3DEMUX_H
00021 #define MPEG3DEMUX_H
00022 
00023 #include "mpeg3title.h"
00024 #include <stdio.h>
00025 
00026 typedef struct
00027 {
00028         struct mpeg3_rec* file;
00029 /* Data consisting of the multiplexed packet */
00030         unsigned char *raw_data;
00031         long raw_offset;
00032         int raw_size;
00033         long packet_size;
00034 /* Only one is on depending on which track owns the demultiplexer. */
00035         int do_audio;
00036         int do_video;
00037 /* Data consisting of the elementary stream */
00038         unsigned char *data_buffer;
00039         long data_size;
00040         long data_position;
00041         long data_allocated;
00042 /* Remember when the file descriptor is at the beginning of the packet just read. */
00043         int reverse;
00044 /* Set to 1 when eof or attempt to read before beginning */
00045         int error_flag;
00046 /* Temp variables for returning */
00047         unsigned char next_char;
00048 /* Correction factor for time discontinuity */
00049         double time_offset;
00050         int generating_timecode;
00051 
00052 /* Titles */
00053         mpeg3_title_t *titles[MPEG3_MAX_STREAMS];
00054         int total_titles;
00055         int current_title;
00056 
00057 /* Tables of every stream ID encountered */
00058         int astream_table[MPEG3_MAX_STREAMS];  /* macro of audio format if audio  */
00059         int vstream_table[MPEG3_MAX_STREAMS];  /* 1 if video */
00060 
00061 /* Programs */
00062         int total_programs;
00063         int current_program;
00064 
00065 /* Timecode in the current title */
00066         int current_timecode;
00067 
00068 /* Byte position in the current title */
00069         long current_byte;
00070 
00071         int transport_error_indicator;
00072         int payload_unit_start_indicator;
00073         int pid;
00074         int transport_scrambling_control;
00075         int adaptation_field_control;
00076         int continuity_counter;
00077         int is_padding;
00078         int pid_table[MPEG3_PIDMAX];
00079         int continuity_counters[MPEG3_PIDMAX];
00080         int total_pids;
00081         int adaptation_fields;
00082         double time;           /* Time in seconds */
00083         int audio_pid;
00084         int video_pid;
00085         int astream;     /* Video stream ID being decoded.  -1 = select first ID in stream */
00086         int vstream;     /* Audio stream ID being decoded.  -1 = select first ID in stream */
00087         int aformat;      /* format of the audio derived from multiplexing codes */
00088         long program_association_tables;
00089         int table_id;
00090         int section_length;
00091         int transport_stream_id;
00092         long pes_packets;
00093         double pes_audio_time;  /* Presentation Time stamps */
00094         double pes_video_time;  /* Presentation Time stamps */
00095 } mpeg3_demuxer_t;
00096 
00097 /* ========================================================================= */
00098 /*                             Entry points */
00099 /* ========================================================================= */
00100 
00101 #define mpeg3demux_error(demuxer) (((mpeg3_demuxer_t *)(demuxer))->error_flag)
00102 
00103 #define mpeg3demux_time_offset(demuxer) (((mpeg3_demuxer_t *)(demuxer))->time_offset)
00104 
00105 #define mpeg3demux_current_time(demuxer) (((mpeg3_demuxer_t *)(demuxer))->time + ((mpeg3_demuxer_t *)(demuxer))->time_offset)
00106 
00107 #define mpeg3demux_read_char(demuxer) \
00108     ((((mpeg3_demuxer_t *)(demuxer))->data_position < ((mpeg3_demuxer_t *)(demuxer))->data_size) ? \
00109     ((mpeg3_demuxer_t *)(demuxer))->data_buffer[((mpeg3_demuxer_t *)(demuxer))->data_position++] : \
00110     mpeg3demux_read_char_packet(demuxer))
00111 
00112 #define mpeg3demux_read_prev_char(demuxer) \
00113     ((((mpeg3_demuxer_t *)(demuxer))->data_position != 0) ? \
00114     ((mpeg3_demuxer_t *)(demuxer))->data_buffer[((mpeg3_demuxer_t *)(demuxer))->data_position--] : \
00115     mpeg3demux_read_prev_char_packet(demuxer))
00116 
00117 
00118 #endif

Generated on Sat Nov 5 16:15:37 2005 for OPIE by  doxygen 1.4.2