Mercurial > mplayer.hg
annotate libmpdemux/stheader.h @ 36807:072f64f1eec3
corevideo: include OpenGL/gl.h, this is required from 10.9
Including gl_common would be nicer, but would make vo_corevideo
depend on vo_gl, which seems a bit overkill.
Patch by Jiang Jiang [gzjjgod gmail].
author | reimar |
---|---|
date | Sun, 23 Feb 2014 13:06:57 +0000 |
parents | 4eb54147c488 |
children |
rev | line source |
---|---|
29238
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
1 /* |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
2 * This file is part of MPlayer. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
3 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
7 * (at your option) any later version. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
8 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
12 * GNU General Public License for more details. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
13 * |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
17 */ |
d643e4643313
Add standard license header to all files in libmpdemux.
diego
parents:
27807
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_STHEADER_H |
20 #define MPLAYER_STHEADER_H | |
4933 | 21 |
26143
268ecf0e1ba4
Add missing header #includes to fix 'make checkheaders'.
diego
parents:
26082
diff
changeset
|
22 #include "demuxer.h" |
12341
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
8965
diff
changeset
|
23 #include "aviheader.h" |
0db4a3a5b01d
removed loader/ dependancy, imported some files from g2, also used patches from Dominik Mierzejewski
alex
parents:
8965
diff
changeset
|
24 #include "ms_hdr.h" |
7471 | 25 |
26 // Stream headers: | |
4196 | 27 |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
28 #define SH_COMMON \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
29 demux_stream_t *ds; \ |
30710
c6524b71a9da
cosmetics: Rename "codecs_st" struct to just plain "codecs".
diego
parents:
30643
diff
changeset
|
30 struct codecs *codec; \ |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
31 unsigned int format; \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
32 int initialized; \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
33 float stream_delay; /* number of seconds stream should be delayed (according to dwStart or similar) */ \ |
30088
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
30087
diff
changeset
|
34 /* things needed for parsing */ \ |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
30087
diff
changeset
|
35 int needs_parsing; \ |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
30087
diff
changeset
|
36 struct AVCodecContext *avctx; \ |
4977e04f3a18
Add support for parsing audio streams (though should be easy to extend to video)
reimar
parents:
30087
diff
changeset
|
37 struct AVCodecParserContext *parser; \ |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
38 /* audio: last known pts value in output from decoder \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
39 * video: predicted/interpolated PTS of the current frame */ \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
40 double pts; \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
41 /* codec-specific: */ \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
42 void* context; /* codec-specific stuff (usually HANDLE or struct pointer) */ \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
43 char* lang; /* track language */ \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
44 int default_track; \ |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
45 |
30643
81099607ec11
Add names to anonymous structs sh_common, sh_audio, sh_video, sh_sub.
diego
parents:
30642
diff
changeset
|
46 typedef struct sh_common { |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
47 SH_COMMON |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
48 } sh_common_t; |
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
49 |
30643
81099607ec11
Add names to anonymous structs sh_common, sh_audio, sh_video, sh_sub.
diego
parents:
30642
diff
changeset
|
50 typedef struct sh_audio { |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
51 SH_COMMON |
19540 | 52 int aid; |
291 | 53 // output format: |
7467 | 54 int sample_format; |
291 | 55 int samplerate; |
56 int samplesize; | |
57 int channels; | |
36469
4eb54147c488
Set audio channel_layout from container when using FFmpeg decoder.
cehoyos
parents:
36295
diff
changeset
|
58 int channel_layout; |
746 | 59 int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec) |
60 int i_bps; // == bitrate (compressed bytes/sec) | |
296 | 61 // in buffers: |
7604
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
62 int audio_in_minsize; // max. compressed packet size (== min. in buffer size) |
291 | 63 char* a_in_buffer; |
64 int a_in_buffer_len; | |
65 int a_in_buffer_size; | |
7604
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
66 // decoder buffers: |
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
67 int audio_out_minsize; // max. uncompressed packet size (==min. out buffsize) |
296 | 68 char* a_buffer; |
69 int a_buffer_len; | |
70 int a_buffer_size; | |
7604
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
71 // output buffers: |
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
72 char* a_out_buffer; |
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
73 int a_out_buffer_len; |
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
74 int a_out_buffer_size; |
32efb806436e
aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents:
7471
diff
changeset
|
75 // void* audio_out; // the audio_out handle, used for this audio stream |
31180 | 76 struct af_stream *afilter; // the audio filter stream |
31540
7f1c8212e3cf
Add some const, the ad_functions structs are in rodata.
reimar
parents:
31180
diff
changeset
|
77 const struct ad_functions *ad_driver; |
27397
d47744b95b78
Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents:
27341
diff
changeset
|
78 #ifdef CONFIG_DYNAMIC_PLUGINS |
8152 | 79 void *dec_handle; |
80 #endif | |
7467 | 81 // win32-compatible codec parameters: |
291 | 82 AVIStreamHeader audio; |
7467 | 83 WAVEFORMATEX* wf; |
84 // codec-specific: | |
85 unsigned char* codecdata; // extra header data passed from demuxer to codec | |
5301 | 86 int codecdata_len; |
18242
caac2ca98168
4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents:
17643
diff
changeset
|
87 int pts_bytes; // bytes output by decoder after last known pts |
291 | 88 } sh_audio_t; |
89 | |
30643
81099607ec11
Add names to anonymous structs sh_common, sh_audio, sh_video, sh_sub.
diego
parents:
30642
diff
changeset
|
90 typedef struct sh_video { |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
91 SH_COMMON |
19540 | 92 int vid; |
8057 | 93 float timer; // absolute time in video stream, since last start/seek |
7467 | 94 // frame counters: |
95 float num_frames; // number of frames played | |
96 int num_frames_decoded; // number of frames decoded | |
8965 | 97 // timing (mostly for mpeg): |
18309
87161f96fa66
Change common pts variables from floats to doubles. Individual demuxers
uau
parents:
18242
diff
changeset
|
98 double i_pts; // PTS for the _next_ I/P frame |
21077 | 99 float next_frame_time; |
100 double last_pts; | |
33008 | 101 double buffered_pts[32]; |
18917
d9a75b26da6c
Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents:
18708
diff
changeset
|
102 int num_buffered_pts; |
7467 | 103 // output format: (set by demuxer) |
104 float fps; // frames per second (set only if constant fps) | |
105 float frametime; // 1/fps | |
36295
0bd0297b073a
Handle special argument -1 to switch_ratio as intended.
ib
parents:
34313
diff
changeset
|
106 float aspect; // current aspect ratio (for prescaling) |
0bd0297b073a
Handle special argument -1 to switch_ratio as intended.
ib
parents:
34313
diff
changeset
|
107 float original_aspect; // original aspect ratio stored in the file |
24299
725638f690bb
added .stream_aspect to st_video_t: if non-zero and if not specified otherwise
nicodvb
parents:
23689
diff
changeset
|
108 float stream_aspect; // aspect ratio stored in the media headers (e.g. in DVD IFO files) |
7467 | 109 int i_bps; // == bitrate (compressed bytes/sec) |
110 int disp_w,disp_h; // display size (filled by fileformat parser) | |
111 // output driver/filters: (set by libmpcodecs core) | |
303 | 112 unsigned int outfmtidx; |
30642
a972c1a4a012
cosmetics: Rename struct vf_instance_s --> vf_instance.
diego
parents:
30088
diff
changeset
|
113 struct vf_instance *vfilter; // the video filter chain, used for this video stream |
25962 | 114 int vf_initialized; |
27397
d47744b95b78
Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents:
27341
diff
changeset
|
115 #ifdef CONFIG_DYNAMIC_PLUGINS |
8152 | 116 void *dec_handle; |
117 #endif | |
7467 | 118 // win32-compatible codec parameters: |
291 | 119 AVIStreamHeader video; |
7467 | 120 BITMAPINFOHEADER* bih; |
34313
8f2167abd6e0
Try harder to extract a sensible palette from extradata.
reimar
parents:
33008
diff
changeset
|
121 int bih_size; |
8158 | 122 void* ImageDesc; // for quicktime codecs |
291 | 123 } sh_video_t; |
124 | |
30643
81099607ec11
Add names to anonymous structs sh_common, sh_audio, sh_video, sh_sub.
diego
parents:
30642
diff
changeset
|
125 typedef struct sh_sub { |
30086
f72ea7a67421
Introduce a sh_common struct that contains the parts in common by the audio, video
reimar
parents:
29238
diff
changeset
|
126 SH_COMMON |
20876
0587328d9392
Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents:
20873
diff
changeset
|
127 int sid; |
0587328d9392
Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents:
20873
diff
changeset
|
128 char type; // t = text, v = VobSub, a = SSA/ASS |
25652 | 129 unsigned char* extradata; // extra header data passed from demuxer |
130 int extradata_len; | |
27341
e7c989f7a7c9
Start unifying names of internal preprocessor directives.
diego
parents:
26269
diff
changeset
|
131 #ifdef CONFIG_ASS |
31792
55dacfca4a43
Rename libass types to match upstream libass >= 0.9.7
greg
parents:
31609
diff
changeset
|
132 ASS_Track* ass_track; // for SSA/ASS streams (type == 'a') |
20876
0587328d9392
Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents:
20873
diff
changeset
|
133 #endif |
0587328d9392
Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents:
20873
diff
changeset
|
134 } sh_sub_t; |
0587328d9392
Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents:
20873
diff
changeset
|
135 |
7467 | 136 // demuxer.c: |
31609
cd81fce1f010
Make the stream language an argument to the stream creation function
reimar
parents:
31540
diff
changeset
|
137 #define new_sh_audio(d, i, l) new_sh_audio_aid(d, i, i, l) |
cd81fce1f010
Make the stream language an argument to the stream creation function
reimar
parents:
31540
diff
changeset
|
138 sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid, const char *lang); |
19540 | 139 #define new_sh_video(d, i) new_sh_video_vid(d, i, i) |
140 sh_video_t* new_sh_video_vid(demuxer_t *demuxer,int id,int vid); | |
31609
cd81fce1f010
Make the stream language an argument to the stream creation function
reimar
parents:
31540
diff
changeset
|
141 #define new_sh_sub(d, i, l) new_sh_sub_sid(d, i, i, l) |
cd81fce1f010
Make the stream language an argument to the stream creation function
reimar
parents:
31540
diff
changeset
|
142 sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid, const char *lang); |
18708
9e2b300db17b
Change free_sh_audio() to take demuxer and stream id as parameters
uau
parents:
18309
diff
changeset
|
143 void free_sh_audio(demuxer_t *demuxer, int id); |
5084 | 144 void free_sh_video(sh_video_t *sh); |
426 | 145 |
31925
616375aefdda
Print subtitle type also for internally-supported types with a libavcodec decoder.
reimar
parents:
31792
diff
changeset
|
146 const char *sh_sub_type2str(int type); |
616375aefdda
Print subtitle type also for internally-supported types with a libavcodec decoder.
reimar
parents:
31792
diff
changeset
|
147 |
7467 | 148 // video.c: |
2567 | 149 int video_read_properties(sh_video_t *sh_video); |
150 int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps); | |
4933 | 151 |
26029 | 152 #endif /* MPLAYER_STHEADER_H */ |