Fix vf_tcdump's compilation
[mplayer/kovensky.git] / libmpdemux / stheader.h
blobb11b886ce1ae23f9f56ae44f29b69dadcae8bd68
1 /*
2 * This file is part of MPlayer.
4 * MPlayer is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * MPlayer is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License along
15 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 #ifndef MPLAYER_STHEADER_H
20 #define MPLAYER_STHEADER_H
22 #include "aviheader.h"
23 #include "ms_hdr.h"
24 struct MPOpts;
25 struct demuxer;
27 // Stream headers:
29 #define SH_COMMON \
30 struct MPOpts *opts; \
31 struct demux_stream *ds; \
32 struct codecs *codec; \
33 unsigned int format; \
34 int initialized; \
35 float stream_delay; /* number of seconds stream should be delayed (according to dwStart or similar) */ \
36 /* things needed for parsing */ \
37 int needs_parsing; \
38 struct AVCodecContext *avctx; \
39 struct AVCodecParserContext *parser; \
40 /* audio: last known pts value in output from decoder \
41 * video: predicted/interpolated PTS of the current frame */ \
42 double pts; \
43 /* codec-specific: */ \
44 void* context; /* codec-specific stuff (usually HANDLE or struct pointer) */ \
45 char* lang; /* track language */ \
46 int default_track; \
48 typedef struct sh_common {
49 SH_COMMON
50 } sh_common_t;
52 typedef struct sh_audio {
53 SH_COMMON
54 int aid;
55 // output format:
56 int sample_format;
57 int samplerate;
58 int samplesize;
59 int channels;
60 int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec)
61 int i_bps; // == bitrate (compressed bytes/sec)
62 // in buffers:
63 int audio_in_minsize; // max. compressed packet size (== min. in buffer size)
64 char* a_in_buffer;
65 int a_in_buffer_len;
66 int a_in_buffer_size;
67 // decoder buffers:
68 int audio_out_minsize; // max. uncompressed packet size (==min. out buffsize)
69 char* a_buffer;
70 int a_buffer_len;
71 int a_buffer_size;
72 // output buffers:
73 char* a_out_buffer;
74 int a_out_buffer_len;
75 int a_out_buffer_size;
76 // void* audio_out; // the audio_out handle, used for this audio stream
77 struct af_stream *afilter; // the audio filter stream
78 struct ad_functions *ad_driver;
79 #ifdef CONFIG_DYNAMIC_PLUGINS
80 void *dec_handle;
81 #endif
82 // win32-compatible codec parameters:
83 AVIStreamHeader audio;
84 WAVEFORMATEX* wf;
85 // codec-specific:
86 unsigned char* codecdata; // extra header data passed from demuxer to codec
87 int codecdata_len;
88 int pts_bytes; // bytes output by decoder after last known pts
89 } sh_audio_t;
91 typedef struct sh_video {
92 SH_COMMON
93 int vid;
94 float timer; // absolute time in video stream, since last start/seek
95 // frame counters:
96 float num_frames; // number of frames played
97 int num_frames_decoded; // number of frames decoded
98 // timing (mostly for mpeg):
99 double i_pts; // PTS for the _next_ I/P frame
100 float next_frame_time;
101 double last_pts;
102 double buffered_pts[20];
103 int num_buffered_pts;
104 double codec_reordered_pts;
105 double prev_codec_reordered_pts;
106 int num_reordered_pts_problems;
107 double sorted_pts;
108 double prev_sorted_pts;
109 int num_sorted_pts_problems;
110 int pts_assoc_mode;
111 // output format: (set by demuxer)
112 float fps; // frames per second (set only if constant fps)
113 float frametime; // 1/fps
114 float aspect; // aspect ratio stored in the file (for prescaling)
115 float stream_aspect; // aspect ratio stored in the media headers (e.g. in DVD IFO files)
116 int i_bps; // == bitrate (compressed bytes/sec)
117 int disp_w,disp_h; // display size (filled by fileformat parser)
118 // output driver/filters: (set by libmpcodecs core)
119 unsigned int outfmtidx;
120 struct vf_instance *vfilter; // the video filter chain, used for this video stream
121 int output_flags; // query_format() results for output filters+vo
122 const struct vd_functions *vd_driver;
123 int vf_initialized;
124 #ifdef CONFIG_DYNAMIC_PLUGINS
125 void *dec_handle;
126 #endif
127 // win32-compatible codec parameters:
128 AVIStreamHeader video;
129 BITMAPINFOHEADER* bih;
130 void* ImageDesc; // for quicktime codecs
131 } sh_video_t;
133 typedef struct sh_sub {
134 SH_COMMON
135 int sid;
136 char type; // t = text, v = VobSub, a = SSA/ASS
137 unsigned char* extradata; // extra header data passed from demuxer
138 int extradata_len;
139 struct ass_track *ass_track; // for SSA/ASS streams (type == 'a')
140 } sh_sub_t;
142 // demuxer.c:
143 #define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
144 sh_audio_t* new_sh_audio_aid(struct demuxer *demuxer,int id,int aid);
145 #define new_sh_video(d, i) new_sh_video_vid(d, i, i)
146 sh_video_t* new_sh_video_vid(struct demuxer *demuxer,int id,int vid);
147 #define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
148 sh_sub_t *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
149 void free_sh_audio(struct demuxer *demuxer, int id);
150 void free_sh_video(sh_video_t *sh);
152 // video.c:
153 int video_read_properties(sh_video_t *sh_video);
154 int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps);
156 #endif /* MPLAYER_STHEADER_H */