annotate libmpdemux/stheader.h @ 10053:8e84e8deb529

Changed the order of two conditionals in an "if" statement, to make the code (very slightly) more efficient in the common case.
author rsf
date Sat, 03 May 2003 06:09:36 +0000
parents 14fa6a121a47
children 0db4a3a5b01d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
4933
429994672d8c 're-include' possibility
nick
parents: 4875
diff changeset
1 #ifndef __ST_HEADER_H
429994672d8c 're-include' possibility
nick
parents: 4875
diff changeset
2 #define __ST_HEADER_H 1
429994672d8c 're-include' possibility
nick
parents: 4875
diff changeset
3
7471
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
4 // for AVIStreamHeader:
2338
4f3e8c8ea32f includes cleanup
arpi
parents: 2310
diff changeset
5 #include "wine/avifmt.h"
7471
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
6
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
7 #ifndef _WAVEFORMATEX_
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
8 #define _WAVEFORMATEX_
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
9 typedef struct __attribute__((__packed__)) _WAVEFORMATEX {
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
10 WORD wFormatTag;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
11 WORD nChannels;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
12 DWORD nSamplesPerSec;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
13 DWORD nAvgBytesPerSec;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
14 WORD nBlockAlign;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
15 WORD wBitsPerSample;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
16 WORD cbSize;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
17 } WAVEFORMATEX, *PWAVEFORMATEX, *NPWAVEFORMATEX, *LPWAVEFORMATEX;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
18 #endif /* _WAVEFORMATEX_ */
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
19
7471
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
20 #ifndef _BITMAPINFOHEADER_
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
21 #define _BITMAPINFOHEADER_
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
22 typedef struct __attribute__((__packed__))
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
23 {
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
24 int biSize;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
25 int biWidth;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
26 int biHeight;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
27 short biPlanes;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
28 short biBitCount;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
29 int biCompression;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
30 int biSizeImage;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
31 int biXPelsPerMeter;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
32 int biYPelsPerMeter;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
33 int biClrUsed;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
34 int biClrImportant;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
35 } BITMAPINFOHEADER, *PBITMAPINFOHEADER, *LPBITMAPINFOHEADER;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
36 typedef struct {
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
37 BITMAPINFOHEADER bmiHeader;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
38 int bmiColors[1];
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
39 } BITMAPINFO, *LPBITMAPINFO;
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
40 #endif
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
41
5e56ce70b551 wine headers cleanup
arpi
parents: 7467
diff changeset
42 // Stream headers:
4196
b75f3bb25261 image field added. 10*10l....
arpi
parents: 3642
diff changeset
43
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
44 typedef struct {
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
45 demux_stream_t *ds;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
46 struct codecs_st *codec;
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
47 unsigned int format;
1656
cd77b8e28f82 new field: inited
arpi
parents: 1546
diff changeset
48 int inited;
8057
10698ce4b2a4 fixed comment - noticed by Alex
arpi
parents: 8056
diff changeset
49 float delay; // relative (to sh_video->timer) time in audio stream
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
50 // output format:
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
51 int sample_format;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
52 int samplerate;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
53 int samplesize;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
54 int channels;
746
cd1f0d4de0b8 new audio playback and A-V sync code
arpi_esp
parents: 587
diff changeset
55 int o_bps; // == samplerate*samplesize*channels (uncompr. bytes/sec)
cd1f0d4de0b8 new audio playback and A-V sync code
arpi_esp
parents: 587
diff changeset
56 int i_bps; // == bitrate (compressed bytes/sec)
296
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
57 // in buffers:
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
58 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
59 char* a_in_buffer;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
60 int a_in_buffer_len;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
61 int a_in_buffer_size;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
62 // decoder buffers:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
63 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
64 char* a_buffer;
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
65 int a_buffer_len;
c3d7a28a0d1a audio init moved to dec_audio.c
arpi_esp
parents: 291
diff changeset
66 int a_buffer_size;
7604
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
67 // output buffers:
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
68 char* a_out_buffer;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
69 int a_out_buffer_len;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
70 int a_out_buffer_size;
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
71 // void* audio_out; // the audio_out handle, used for this audio stream
32efb806436e aufio filter layer (libaf) integration to libmpcodecs, mplayer and mencoder
arpi
parents: 7471
diff changeset
72 void* afilter; // the audio filter stream
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
73 #ifdef DYNAMIC_PLUGINS
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
74 void *dec_handle;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
75 #endif
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
76 // win32-compatible codec parameters:
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
77 AVIStreamHeader audio;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
78 WAVEFORMATEX* wf;
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
79 // codec-specific:
3642
2cef9d562af0 void* context added - it should keep the codec-specific stuff (struct ptr or HANDLE)
arpi
parents: 2567
diff changeset
80 void* context; // codec-specific stuff (usually HANDLE or struct pointer)
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
81 unsigned char* codecdata; // extra header data passed from demuxer to codec
5301
d72c3169a343 Improved MP4 parsing (finally)
atmos4
parents: 5084
diff changeset
82 int codecdata_len;
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
83 } sh_audio_t;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
84
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
85 typedef struct {
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
86 demux_stream_t *ds;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
87 struct codecs_st *codec;
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
88 unsigned int format;
1656
cd77b8e28f82 new field: inited
arpi
parents: 1546
diff changeset
89 int inited;
8057
10698ce4b2a4 fixed comment - noticed by Alex
arpi
parents: 8056
diff changeset
90 float timer; // absolute time in video stream, since last start/seek
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
91 // frame counters:
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
92 float num_frames; // number of frames played
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
93 int num_frames_decoded; // number of frames decoded
8965
14fa6a121a47 fixed the well-known DVD/DVB audio delay bug :)
arpi
parents: 8158
diff changeset
94 // timing (mostly for mpeg):
14fa6a121a47 fixed the well-known DVD/DVB audio delay bug :)
arpi
parents: 8158
diff changeset
95 float pts; // predicted/interpolated PTS of the current frame
14fa6a121a47 fixed the well-known DVD/DVB audio delay bug :)
arpi
parents: 8158
diff changeset
96 float i_pts; // PTS for the _next_ I/P frame
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
97 // output format: (set by demuxer)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
98 float fps; // frames per second (set only if constant fps)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
99 float frametime; // 1/fps
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
100 float aspect; // aspect ratio stored in the file (for prescaling)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
101 int i_bps; // == bitrate (compressed bytes/sec)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
102 int disp_w,disp_h; // display size (filled by fileformat parser)
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
103 // output driver/filters: (set by libmpcodecs core)
303
828ec81e0d64 codecs.conf support
arpi_esp
parents: 296
diff changeset
104 unsigned int outfmtidx;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
105 void* video_out; // the video_out handle, used for this video stream
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
106 void* vfilter; // the video filter chain, used for this video stream
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
107 int vf_inited;
8152
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
108 #ifdef DYNAMIC_PLUGINS
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
109 void *dec_handle;
4b02f73cb4b9 dlopen() support for ad and vd
alex
parents: 8057
diff changeset
110 #endif
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
111 // win32-compatible codec parameters:
291
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
112 AVIStreamHeader video;
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
113 BITMAPINFOHEADER* bih;
8158
bffdd162d034 export imagedescription for qt video codecs
arpi
parents: 8152
diff changeset
114 void* ImageDesc; // for quicktime codecs
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
115 // codec-specific:
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
116 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
117 } sh_video_t;
da98e96499bb sh_audio/sh_video added, general codec cleanup
arpi_esp
parents:
diff changeset
118
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
119 // demuxer.c:
1289
3f490fad9bdf some code clanup (first step to libdemuxer)
arpi
parents: 758
diff changeset
120 sh_audio_t* new_sh_audio(demuxer_t *demuxer,int id);
3f490fad9bdf some code clanup (first step to libdemuxer)
arpi
parents: 758
diff changeset
121 sh_video_t* new_sh_video(demuxer_t *demuxer,int id);
5084
2fd327bf64fc added get_sh_video/audio and realmedia seeking
alex
parents: 4973
diff changeset
122 void free_sh_audio(sh_audio_t *sh);
2fd327bf64fc added get_sh_video/audio and realmedia seeking
alex
parents: 4973
diff changeset
123 void free_sh_video(sh_video_t *sh);
426
26e513f392b2 new stream selection code
arpi_esp
parents: 399
diff changeset
124
7467
3a22c16fea46 - cosmetics, reorder
arpi
parents: 7232
diff changeset
125 // video.c:
2567
ea6158be8103 video frame reading cleanup
arpi
parents: 2341
diff changeset
126 int video_read_properties(sh_video_t *sh_video);
ea6158be8103 video frame reading cleanup
arpi
parents: 2341
diff changeset
127 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
128
429994672d8c 're-include' possibility
nick
parents: 4875
diff changeset
129 #endif