Mercurial > mplayer.hg
comparison libmpdemux/demux_lavf.c @ 20733:404fb439acba
Add our own CODEC_ID -> fourcc translation tables so we do not need
to put them into ffmpeg.
Also adds support for S24BE and S8 audio formats, which fixes e.g.
http://samples.mplayerhq.hu/A-codecs/MACE/Bach1-1.aiff and
http://samples.mplayerhq.hu/MXF/ebu_small.mxf .
author | reimar |
---|---|
date | Tue, 07 Nov 2006 17:37:23 +0000 |
parents | b4d4142f7ae8 |
children | 0ae2c8b1c44b |
comparison
equal
deleted
inserted
replaced
20732:411880b516d4 | 20733:404fb439acba |
---|---|
31 #include "m_option.h" | 31 #include "m_option.h" |
32 | 32 |
33 #ifdef USE_LIBAVFORMAT_SO | 33 #ifdef USE_LIBAVFORMAT_SO |
34 #include <ffmpeg/avformat.h> | 34 #include <ffmpeg/avformat.h> |
35 #include <ffmpeg/opt.h> | 35 #include <ffmpeg/opt.h> |
36 typedef struct CodecTag { | |
37 int id; | |
38 unsigned int tag; | |
39 unsigned int invalid_asf : 1; | |
40 } CodecTag; | |
36 #else | 41 #else |
37 #include "avformat.h" | 42 #include "avformat.h" |
43 #include "riff.h" | |
38 #include "avi.h" | 44 #include "avi.h" |
39 #include "opt.h" | 45 #include "opt.h" |
40 #endif | 46 #endif |
41 | 47 |
42 #define PROBE_BUF_SIZE 2048 | 48 #define PROBE_BUF_SIZE 2048 |
62 | 68 |
63 extern void print_wave_header(WAVEFORMATEX *h, int verbose_level); | 69 extern void print_wave_header(WAVEFORMATEX *h, int verbose_level); |
64 extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level); | 70 extern void print_video_header(BITMAPINFOHEADER *h, int verbose_level); |
65 | 71 |
66 int64_t ff_gcd(int64_t a, int64_t b); | 72 int64_t ff_gcd(int64_t a, int64_t b); |
73 | |
74 const CodecTag mp_wav_tags[] = { | |
75 { CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')}, | |
76 { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, | |
77 { CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, | |
78 { 0, 0 }, | |
79 }; | |
80 | |
81 const CodecTag mp_bmp_tags[] = { | |
82 { CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')}, | |
83 { 0, 0 }, | |
84 }; | |
67 | 85 |
68 static int mp_open(URLContext *h, const char *filename, int flags){ | 86 static int mp_open(URLContext *h, const char *filename, int flags){ |
69 return 0; | 87 return 0; |
70 } | 88 } |
71 | 89 |
211 break; | 229 break; |
212 priv->astreams[priv->audio_streams] = i; | 230 priv->astreams[priv->audio_streams] = i; |
213 priv->audio_streams++; | 231 priv->audio_streams++; |
214 if(!codec->codec_tag) | 232 if(!codec->codec_tag) |
215 codec->codec_tag= codec_get_wav_tag(codec->codec_id); | 233 codec->codec_tag= codec_get_wav_tag(codec->codec_id); |
234 if(!codec->codec_tag) | |
235 codec->codec_tag= codec_get_tag(mp_wav_tags, codec->codec_id); | |
216 wf->wFormatTag= codec->codec_tag; | 236 wf->wFormatTag= codec->codec_tag; |
217 wf->nChannels= codec->channels; | 237 wf->nChannels= codec->channels; |
218 wf->nSamplesPerSec= codec->sample_rate; | 238 wf->nSamplesPerSec= codec->sample_rate; |
219 wf->nAvgBytesPerSec= codec->bit_rate/8; | 239 wf->nAvgBytesPerSec= codec->bit_rate/8; |
220 wf->nBlockAlign= codec->block_align; | 240 wf->nBlockAlign= codec->block_align; |
277 sh_video_t* sh_video=new_sh_video(demuxer, i); | 297 sh_video_t* sh_video=new_sh_video(demuxer, i); |
278 | 298 |
279 priv->video_streams++; | 299 priv->video_streams++; |
280 if(!codec->codec_tag) | 300 if(!codec->codec_tag) |
281 codec->codec_tag= codec_get_bmp_tag(codec->codec_id); | 301 codec->codec_tag= codec_get_bmp_tag(codec->codec_id); |
302 if(!codec->codec_tag) | |
303 codec->codec_tag= codec_get_tag(mp_bmp_tags, codec->codec_id); | |
282 bih->biSize= sizeof(BITMAPINFOHEADER) + codec->extradata_size; | 304 bih->biSize= sizeof(BITMAPINFOHEADER) + codec->extradata_size; |
283 bih->biWidth= codec->width; | 305 bih->biWidth= codec->width; |
284 bih->biHeight= codec->height; | 306 bih->biHeight= codec->height; |
285 bih->biBitCount= codec->bits_per_sample; | 307 bih->biBitCount= codec->bits_per_sample; |
286 bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount/8; | 308 bih->biSizeImage = bih->biWidth * bih->biHeight * bih->biBitCount/8; |