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