mp_msg: Remove uses of MSGT_MENCODER
[mplayer/glamo.git] / libmpdemux / stheader.h
blob4bb2da3ac7e1367496a4cab1fc67eeb163dec637
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 container_out_samplerate;
59 int samplesize;
60 int channels;
61 int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec)
62 int i_bps; // == bitrate (compressed bytes/sec)
63 // in buffers:
64 int audio_in_minsize; // max. compressed packet size (== min. in buffer size)
65 char* a_in_buffer;
66 int a_in_buffer_len;
67 int a_in_buffer_size;
68 // decoder buffers:
69 int audio_out_minsize; // max. uncompressed packet size (==min. out buffsize)
70 char* a_buffer;
71 int a_buffer_len;
72 int a_buffer_size;
73 // output buffers:
74 char* a_out_buffer;
75 int a_out_buffer_len;
76 int a_out_buffer_size;
77 // void* audio_out; // the audio_out handle, used for this audio stream
78 struct af_stream *afilter; // the audio filter stream
79 const struct ad_functions *ad_driver;
80 #ifdef CONFIG_DYNAMIC_PLUGINS
81 void *dec_handle;
82 #endif
83 // win32-compatible codec parameters:
84 AVIStreamHeader audio;
85 WAVEFORMATEX* wf;
86 // codec-specific:
87 unsigned char* codecdata; // extra header data passed from demuxer to codec
88 int codecdata_len;
89 int pts_bytes; // bytes output by decoder after last known pts
90 } sh_audio_t;
92 typedef struct sh_video {
93 SH_COMMON
94 int vid;
95 float timer; // absolute time in video stream, since last start/seek
96 // frame counters:
97 float num_frames; // number of frames played
98 int num_frames_decoded; // number of frames decoded
99 // timing (mostly for mpeg):
100 double i_pts; // PTS for the _next_ I/P frame
101 float next_frame_time;
102 double last_pts;
103 double buffered_pts[20];
104 int num_buffered_pts;
105 double codec_reordered_pts;
106 double prev_codec_reordered_pts;
107 int num_reordered_pts_problems;
108 double sorted_pts;
109 double prev_sorted_pts;
110 int num_sorted_pts_problems;
111 int pts_assoc_mode;
112 // output format: (set by demuxer)
113 float fps; // frames per second (set only if constant fps)
114 float frametime; // 1/fps
115 float aspect; // aspect ratio stored in the file (for prescaling)
116 float stream_aspect; // aspect ratio stored in the media headers (e.g. in DVD IFO files)
117 int i_bps; // == bitrate (compressed bytes/sec)
118 int disp_w,disp_h; // display size (filled by fileformat parser)
119 // output driver/filters: (set by libmpcodecs core)
120 unsigned int outfmtidx;
121 struct vf_instance *vfilter; // the video filter chain, used for this video stream
122 int output_flags; // query_format() results for output filters+vo
123 const struct vd_functions *vd_driver;
124 int vf_initialized;
125 #ifdef CONFIG_DYNAMIC_PLUGINS
126 void *dec_handle;
127 #endif
128 // win32-compatible codec parameters:
129 AVIStreamHeader video;
130 BITMAPINFOHEADER* bih;
131 void* ImageDesc; // for quicktime codecs
132 } sh_video_t;
134 typedef struct sh_sub {
135 SH_COMMON
136 int sid;
137 char type; // t = text, v = VobSub, a = SSA/ASS
138 unsigned char* extradata; // extra header data passed from demuxer
139 int extradata_len;
140 struct ass_track *ass_track; // for SSA/ASS streams (type == 'a')
141 } sh_sub_t;
143 // demuxer.c:
144 #define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
145 sh_audio_t* new_sh_audio_aid(struct demuxer *demuxer,int id,int aid);
146 #define new_sh_video(d, i) new_sh_video_vid(d, i, i)
147 sh_video_t* new_sh_video_vid(struct demuxer *demuxer,int id,int vid);
148 #define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
149 sh_sub_t *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
150 struct sh_sub *new_sh_sub_sid_lang(struct demuxer *demuxer, int id, int sid,
151 const char *lang);
152 void free_sh_audio(struct demuxer *demuxer, int id);
153 void free_sh_video(sh_video_t *sh);
155 const char *sh_sub_type2str(int type);
157 // video.c:
158 int video_read_properties(sh_video_t *sh_video);
159 int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps);
161 #endif /* MPLAYER_STHEADER_H */