annotate libmpdemux/stheader.h @ 29698:069c927d20d2

Avoid void * arithmetic.
author reimar
date Wed, 30 Sep 2009 07:54:04 +0000
parents d643e4643313
children f72ea7a67421
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25962
diff changeset
19 #ifndef MPLAYER_STHEADER_H
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25962
diff changeset
20 #define MPLAYER_STHEADER_H
4933
429994672d8c 're-include' possibility
nick
parents: 4875
diff changeset
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
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
25
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
26 // Stream headers:
4196
b75f3bb25261 image field added. 10*10l....
arpi
parents: 3642
diff changeset
27
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
28 typedef struct {
19540
70a5e89ea4cd Get rid of demux_aid_vid_mismatch mess.
reimar
parents: 18917
diff changeset
29 int aid;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
30 demux_stream_t *ds;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
31 struct codecs_st *codec;
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
32 unsigned int format;
25962
afa125da85cf typo fix: inited --> initialized
diego
parents: 25652
diff changeset
33 int initialized;
17643
cea08919336b dwStart support for mplayer.
corey
parents: 14819
diff changeset
34 float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
35 // output format:
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
36 int sample_format;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
37 int samplerate;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
38 int samplesize;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
39 int channels;
746
cd1f0d4de0b8 new audio playback and A-V sync code
arpi_esp
parents: 587
diff changeset
40 int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec)
cd1f0d4de0b8 new audio playback and A-V sync code
arpi_esp
parents: 587
diff changeset
41 int i_bps; // == bitrate (compressed bytes/sec)
296
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
42 // in buffers:
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
43 int audio_in_minsize; // max. compressed packet size (== min. in buffer size)
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
44 char* a_in_buffer;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
45 int a_in_buffer_len;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
46 int a_in_buffer_size;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
47 // decoder buffers:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
48 int audio_out_minsize; // max. uncompressed packet size (==min. out buffsize)
296
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
49 char* a_buffer;
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
50 int a_buffer_len;
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
51 int a_buffer_size;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
52 // output buffers:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
53 char* a_out_buffer;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
54 int a_out_buffer_len;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
55 int a_out_buffer_size;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
56 // void* audio_out; // the audio_out handle, used for this audio stream
24891
fefb019faa90 Clean up some fields in stheader.h structs
uau
parents: 24299
diff changeset
57 struct af_stream_s *afilter; // the audio filter stream
14819
601e2c8a2922 Remove file-global mpadec, add ad_driver member to sh_audio_t instead.
hzoli
parents: 12341
diff changeset
58 struct ad_functions_s* ad_driver;
27397
d47744b95b78 Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents: 27341
diff changeset
59 #ifdef CONFIG_DYNAMIC_PLUGINS
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
60 void *dec_handle;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
61 #endif
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
62 // win32-compatible codec parameters:
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
63 AVIStreamHeader audio;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
64 WAVEFORMATEX* wf;
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
65 // codec-specific:
3642
2cef9d562af0 void* context added - it should keep the codec-specific stuff (struct ptr or HANDLE)
arpi
parents: 2567
diff changeset
66 void* context; // codec-specific stuff (usually HANDLE or struct pointer)
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
67 unsigned char* codecdata; // extra header data passed from demuxer to codec
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents: 5084
diff changeset
68 int codecdata_len;
18242
caac2ca98168 4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents: 17643
diff changeset
69 double pts; // last known pts value in output from decoder
caac2ca98168 4 - Implement a better way to calculate current audio pts and use it for
rtognimp
parents: 17643
diff changeset
70 int pts_bytes; // bytes output by decoder after last known pts
26082
026b1ac69d47 Add language info to sh_sub_t and sh_audio_t.
eugeni
parents: 26029
diff changeset
71 char* lang; // track language
26269
65ad20416dd7 Support 'default' attribute for audio and subtitle tracks.
eugeni
parents: 26143
diff changeset
72 int default_track;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
73 } sh_audio_t;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
74
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
75 typedef struct {
19540
70a5e89ea4cd Get rid of demux_aid_vid_mismatch mess.
reimar
parents: 18917
diff changeset
76 int vid;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
77 demux_stream_t *ds;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
78 struct codecs_st *codec;
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
79 unsigned int format;
25962
afa125da85cf typo fix: inited --> initialized
diego
parents: 25652
diff changeset
80 int initialized;
8057
10698ce4b2a4 fixed comment - noticed by Alex
arpi
parents: 8056
diff changeset
81 float timer; // absolute time in video stream, since last start/seek
17643
cea08919336b dwStart support for mplayer.
corey
parents: 14819
diff changeset
82 float stream_delay; // number of seconds stream should be delayed (according to dwStart or similar)
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
83 // frame counters:
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
84 float num_frames; // number of frames played
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
85 int num_frames_decoded; // number of frames decoded
8965
14fa6a121a47 fixed the well-known DVD/DVB audio delay bug :)
arpi
parents: 8158
diff changeset
86 // timing (mostly for mpeg):
18309
87161f96fa66 Change common pts variables from floats to doubles. Individual demuxers
uau
parents: 18242
diff changeset
87 double pts; // predicted/interpolated PTS of the current frame
87161f96fa66 Change common pts variables from floats to doubles. Individual demuxers
uau
parents: 18242
diff changeset
88 double i_pts; // PTS for the _next_ I/P frame
21077
7f3cccd16b26 Reorganize code to move more things out of main().
uau
parents: 20876
diff changeset
89 float next_frame_time;
7f3cccd16b26 Reorganize code to move more things out of main().
uau
parents: 20876
diff changeset
90 double last_pts;
18917
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18708
diff changeset
91 double buffered_pts[20];
d9a75b26da6c Add a new video pts tracking mode, enabled by option -correct-pts.
uau
parents: 18708
diff changeset
92 int num_buffered_pts;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
93 // output format: (set by demuxer)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
94 float fps; // frames per second (set only if constant fps)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
95 float frametime; // 1/fps
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
96 float aspect; // aspect ratio stored in the file (for prescaling)
24299
725638f690bb added .stream_aspect to st_video_t: if non-zero and if not specified otherwise
nicodvb
parents: 23689
diff changeset
97 float stream_aspect; // aspect ratio stored in the media headers (e.g. in DVD IFO files)
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
98 int i_bps; // == bitrate (compressed bytes/sec)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
99 int disp_w,disp_h; // display size (filled by fileformat parser)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
100 // output driver/filters: (set by libmpcodecs core)
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
101 unsigned int outfmtidx;
24891
fefb019faa90 Clean up some fields in stheader.h structs
uau
parents: 24299
diff changeset
102 struct vf_instance_s *vfilter; // the video filter chain, used for this video stream
25962
afa125da85cf typo fix: inited --> initialized
diego
parents: 25652
diff changeset
103 int vf_initialized;
27397
d47744b95b78 Give a CONFIG_ prefix to preprocessor directives that lacked one and
diego
parents: 27341
diff changeset
104 #ifdef CONFIG_DYNAMIC_PLUGINS
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
105 void *dec_handle;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
106 #endif
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
107 // win32-compatible codec parameters:
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
108 AVIStreamHeader video;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
109 BITMAPINFOHEADER* bih;
8158
bffdd162d034 export imagedescription for qt video codecs
arpi
parents: 8152
diff changeset
110 void* ImageDesc; // for quicktime codecs
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
111 // codec-specific:
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
112 void* context; // codec-specific stuff (usually HANDLE or struct pointer)
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
113 } sh_video_t;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
114
20876
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
115 typedef struct {
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
116 int sid;
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
117 char type; // t = text, v = VobSub, a = SSA/ASS
25652
6e25dda14b62 Add extradata to sh_sub_t.
eugeni
parents: 25535
diff changeset
118 unsigned char* extradata; // extra header data passed from demuxer
6e25dda14b62 Add extradata to sh_sub_t.
eugeni
parents: 25535
diff changeset
119 int extradata_len;
27341
e7c989f7a7c9 Start unifying names of internal preprocessor directives.
diego
parents: 26269
diff changeset
120 #ifdef CONFIG_ASS
20876
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
121 ass_track_t* ass_track; // for SSA/ASS streams (type == 'a')
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
122 #endif
26082
026b1ac69d47 Add language info to sh_sub_t and sh_audio_t.
eugeni
parents: 26029
diff changeset
123 char* lang; // track language
26269
65ad20416dd7 Support 'default' attribute for audio and subtitle tracks.
eugeni
parents: 26143
diff changeset
124 int default_track;
20876
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
125 } sh_sub_t;
0587328d9392 Move sh_sub_t to stheader.h, where all the other sh structs are defined
reimar
parents: 20873
diff changeset
126
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
127 // demuxer.c:
19540
70a5e89ea4cd Get rid of demux_aid_vid_mismatch mess.
reimar
parents: 18917
diff changeset
128 #define new_sh_audio(d, i) new_sh_audio_aid(d, i, i)
70a5e89ea4cd Get rid of demux_aid_vid_mismatch mess.
reimar
parents: 18917
diff changeset
129 sh_audio_t* new_sh_audio_aid(demuxer_t *demuxer,int id,int aid);
70a5e89ea4cd Get rid of demux_aid_vid_mismatch mess.
reimar
parents: 18917
diff changeset
130 #define new_sh_video(d, i) new_sh_video_vid(d, i, i)
70a5e89ea4cd Get rid of demux_aid_vid_mismatch mess.
reimar
parents: 18917
diff changeset
131 sh_video_t* new_sh_video_vid(demuxer_t *demuxer,int id,int vid);
20873
8f0c616d7425 Add forgotten new_sh_sub
reimar
parents: 19540
diff changeset
132 #define new_sh_sub(d, i) new_sh_sub_sid(d, i, i)
8f0c616d7425 Add forgotten new_sh_sub
reimar
parents: 19540
diff changeset
133 sh_sub_t *new_sh_sub_sid(demuxer_t *demuxer, int id, int sid);
18708
9e2b300db17b Change free_sh_audio() to take demuxer and stream id as parameters
uau
parents: 18309
diff changeset
134 void free_sh_audio(demuxer_t *demuxer, int id);
5084
2fd327bf64fc added get_sh_video/audio and realmedia seeking
alex
parents: 4973
diff changeset
135 void free_sh_video(sh_video_t *sh);
426
26e513f392b2 new stream selection code
arpi_esp
parents: 399
diff changeset
136
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
137 // video.c:
2567
ea6158be8103 video frame reading cleanup
arpi
parents: 2341
diff changeset
138 int video_read_properties(sh_video_t *sh_video);
ea6158be8103 video frame reading cleanup
arpi
parents: 2341
diff changeset
139 int video_read_frame(sh_video_t* sh_video,float* frame_time_ptr,unsigned char** start,int force_fps);
4933
429994672d8c 're-include' possibility
nick
parents: 4875
diff changeset
140
26029
4129c8cfa742 Add MPLAYER_ prefix to multiple inclusion guards.
diego
parents: 25962
diff changeset
141 #endif /* MPLAYER_STHEADER_H */