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
24 #include "aviheader.h"
32 struct MPOpts *opts; \
33 struct demux_stream *ds; \
34 struct codecs *codec; \
35 unsigned int format; \
37 float stream_delay; /* number of seconds stream should be delayed (according to dwStart or similar) */ \
38 /* things needed for parsing */ \
40 struct AVCodecContext *avctx; \
41 struct AVCodecParserContext *parser; \
42 /* audio: last known pts value in output from decoder \
43 * video: predicted/interpolated PTS of the current frame */ \
45 /* codec-specific: */ \
46 void* context; /* codec-specific stuff (usually HANDLE or struct pointer) */ \
47 char* lang; /* track language */ \
50 typedef struct sh_common {
54 typedef struct sh_audio
{
60 int container_out_samplerate
;
63 int o_bps
; // == samplerate*samplesize*channels (uncompr. bytes/sec)
64 int i_bps
; // == bitrate (compressed bytes/sec)
66 int audio_in_minsize
; // max. compressed packet size (== min. in buffer size)
71 int audio_out_minsize
; // max. uncompressed packet size (==min. out buffsize)
78 int a_out_buffer_size
;
79 // void* audio_out; // the audio_out handle, used for this audio stream
80 struct af_stream
*afilter
; // the audio filter stream
81 const struct ad_functions
*ad_driver
;
82 #ifdef CONFIG_DYNAMIC_PLUGINS
85 // win32-compatible codec parameters:
86 AVIStreamHeader audio
;
89 unsigned char* codecdata
; // extra header data passed from demuxer to codec
91 int pts_bytes
; // bytes output by decoder after last known pts
94 typedef struct sh_video
{
97 float timer
; // absolute time in video stream, since last start/seek
99 float num_frames
; // number of frames played
100 int num_frames_decoded
; // number of frames decoded
101 // timing (mostly for mpeg):
102 double i_pts
; // PTS for the _next_ I/P frame
103 float next_frame_time
;
105 double buffered_pts
[20];
106 int num_buffered_pts
;
107 double codec_reordered_pts
;
108 double prev_codec_reordered_pts
;
109 int num_reordered_pts_problems
;
111 double prev_sorted_pts
;
112 int num_sorted_pts_problems
;
114 // output format: (set by demuxer)
115 float fps
; // frames per second (set only if constant fps)
116 float frametime
; // 1/fps
117 float aspect
; // aspect ratio stored in the file (for prescaling)
118 float stream_aspect
; // aspect ratio stored in the media headers (e.g. in DVD IFO files)
119 int i_bps
; // == bitrate (compressed bytes/sec)
120 int disp_w
,disp_h
; // display size (filled by fileformat parser)
121 // output driver/filters: (set by libmpcodecs core)
122 unsigned int outfmtidx
;
123 struct vf_instance
*vfilter
; // the video filter chain, used for this video stream
124 int output_flags
; // query_format() results for output filters+vo
125 const struct vd_functions
*vd_driver
;
127 #ifdef CONFIG_DYNAMIC_PLUGINS
130 // win32-compatible codec parameters:
131 AVIStreamHeader video
;
132 BITMAPINFOHEADER
* bih
;
133 void* ImageDesc
; // for quicktime codecs
136 typedef struct sh_sub
{
139 char type
; // t = text, v = VobSub, a = SSA/ASS
140 bool active
; // after track switch decoder may stay initialized, not active
141 unsigned char* extradata
; // extra header data passed from demuxer
143 const struct sd_functions
*sd_driver
;
147 #define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
148 sh_audio_t
* new_sh_audio_aid(struct demuxer
*demuxer
,int id
,int aid
);
149 #define new_sh_video(d, i) new_sh_video_vid(d, i, i)
150 sh_video_t
* new_sh_video_vid(struct demuxer
*demuxer
,int id
,int vid
);
151 #define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
152 sh_sub_t
*new_sh_sub_sid(struct demuxer
*demuxer
, int id
, int sid
);
153 struct sh_sub
*new_sh_sub_sid_lang(struct demuxer
*demuxer
, int id
, int sid
,
155 void free_sh_audio(struct demuxer
*demuxer
, int id
);
156 void free_sh_video(sh_video_t
*sh
);
158 const char *sh_sub_type2str(int type
);
161 int video_read_properties(sh_video_t
*sh_video
);
162 int video_read_frame(sh_video_t
* sh_video
,float* frame_time_ptr
,unsigned char** start
,int force_fps
);
164 #endif /* MPLAYER_STHEADER_H */