demux_mkv: Make seeks more precise in some cases
[mplayer/glamo.git] / libmpdemux / stheader.h
blobf80cd2cf6a6c1469eacb59a4f43434683e5cab6f
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 typedef struct sh_audio {
30 struct MPOpts *opts;
31 int aid;
32 struct demux_stream *ds;
33 struct codecs *codec;
34 unsigned int format;
35 int initialized;
36 float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
37 // output format:
38 int sample_format;
39 int samplerate;
40 int samplesize;
41 int channels;
42 int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec)
43 int i_bps; // == bitrate (compressed bytes/sec)
44 // in buffers:
45 int audio_in_minsize; // max. compressed packet size (== min. in buffer size)
46 char* a_in_buffer;
47 int a_in_buffer_len;
48 int a_in_buffer_size;
49 // decoder buffers:
50 int audio_out_minsize; // max. uncompressed packet size (==min. out buffsize)
51 char* a_buffer;
52 int a_buffer_len;
53 int a_buffer_size;
54 // output buffers:
55 char* a_out_buffer;
56 int a_out_buffer_len;
57 int a_out_buffer_size;
58 // void* audio_out; // the audio_out handle, used for this audio stream
59 struct af_stream *afilter; // the audio filter stream
60 struct ad_functions *ad_driver;
61 #ifdef CONFIG_DYNAMIC_PLUGINS
62 void *dec_handle;
63 #endif
64 // win32-compatible codec parameters:
65 AVIStreamHeader audio;
66 WAVEFORMATEX* wf;
67 // codec-specific:
68 void* context; // codec-specific stuff (usually HANDLE or struct pointer)
69 unsigned char* codecdata; // extra header data passed from demuxer to codec
70 int codecdata_len;
71 double pts; // last known pts value in output from decoder
72 int pts_bytes; // bytes output by decoder after last known pts
73 char* lang; // track language
74 int default_track;
75 } sh_audio_t;
77 typedef struct sh_video {
78 struct MPOpts *opts;
79 int vid;
80 struct demux_stream *ds;
81 struct codecs *codec;
82 unsigned int format;
83 int initialized;
84 float timer; // absolute time in video stream, since last start/seek
85 float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
86 // frame counters:
87 float num_frames; // number of frames played
88 int num_frames_decoded; // number of frames decoded
89 // timing (mostly for mpeg):
90 double pts; // predicted/interpolated PTS of the current frame
91 double i_pts; // PTS for the _next_ I/P frame
92 float next_frame_time;
93 double last_pts;
94 double buffered_pts[20];
95 int num_buffered_pts;
96 // output format: (set by demuxer)
97 float fps; // frames per second (set only if constant fps)
98 float frametime; // 1/fps
99 float aspect; // aspect ratio stored in the file (for prescaling)
100 float stream_aspect; // aspect ratio stored in the media headers (e.g. in DVD IFO files)
101 int i_bps; // == bitrate (compressed bytes/sec)
102 int disp_w,disp_h; // display size (filled by fileformat parser)
103 // output driver/filters: (set by libmpcodecs core)
104 unsigned int outfmtidx;
105 struct vf_instance *vfilter; // the video filter chain, used for this video stream
106 int output_flags; // query_format() results for output filters+vo
107 const struct vd_functions *vd_driver;
108 int vf_initialized;
109 #ifdef CONFIG_DYNAMIC_PLUGINS
110 void *dec_handle;
111 #endif
112 // win32-compatible codec parameters:
113 AVIStreamHeader video;
114 BITMAPINFOHEADER* bih;
115 void* ImageDesc; // for quicktime codecs
116 // codec-specific:
117 void* context; // codec-specific stuff (usually HANDLE or struct pointer)
118 } sh_video_t;
120 typedef struct sh_sub {
121 struct MPOpts *opts;
122 int sid;
123 char type; // t = text, v = VobSub, a = SSA/ASS
124 unsigned char* extradata; // extra header data passed from demuxer
125 int extradata_len;
126 struct ass_track_s *ass_track; // for SSA/ASS streams (type == 'a')
127 char* lang; // track language
128 int default_track;
129 } sh_sub_t;
131 // demuxer.c:
132 #define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
133 sh_audio_t* new_sh_audio_aid(struct demuxer *demuxer,int id,int aid);
134 #define new_sh_video(d, i) new_sh_video_vid(d, i, i)
135 sh_video_t* new_sh_video_vid(struct demuxer *demuxer,int id,int vid);
136 #define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
137 sh_sub_t *new_sh_sub_sid(struct demuxer *demuxer, int id, int sid);
138 void free_sh_audio(struct demuxer *demuxer, int id);
139 void free_sh_video(sh_video_t *sh);
141 // video.c:
142 int video_read_properties(sh_video_t *sh_video);
143 int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps);
145 #endif /* MPLAYER_STHEADER_H */