Mercurial > libavformat.hg
comparison utils.c @ 3565:b3e976d080cd libavformat
Move set_codec_from_probe_data() up to where the other probe functions are.
| author | michael |
|---|---|
| date | Sat, 12 Jul 2008 13:25:26 +0000 |
| parents | b016a776ce4b |
| children | 77a07b9dbe98 |
comparison
equal
deleted
inserted
replaced
| 3564:b016a776ce4b | 3565:b3e976d080cd |
|---|---|
| 291 AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened){ | 291 AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened){ |
| 292 int score=0; | 292 int score=0; |
| 293 return av_probe_input_format2(pd, is_opened, &score); | 293 return av_probe_input_format2(pd, is_opened, &score); |
| 294 } | 294 } |
| 295 | 295 |
| 296 static int set_codec_from_probe_data(AVStream *st, AVProbeData *pd, int score) | |
| 297 { | |
| 298 AVInputFormat *fmt; | |
| 299 fmt = av_probe_input_format2(pd, 1, &score); | |
| 300 | |
| 301 if (fmt) { | |
| 302 if (strncmp(fmt->name, "mp3", 3) == 0) | |
| 303 st->codec->codec_id = CODEC_ID_MP3; | |
| 304 else if (strncmp(fmt->name, "ac3", 3) == 0) | |
| 305 st->codec->codec_id = CODEC_ID_AC3; | |
| 306 } | |
| 307 return !!fmt; | |
| 308 } | |
| 309 | |
| 296 /************************************************************/ | 310 /************************************************************/ |
| 297 /* input media file */ | 311 /* input media file */ |
| 298 | 312 |
| 299 /** | 313 /** |
| 300 * Open a media file from an IO stream. 'fmt' must be specified. | 314 * Open a media file from an IO stream. 'fmt' must be specified. |
| 1781 break; | 1795 break; |
| 1782 } | 1796 } |
| 1783 } | 1797 } |
| 1784 fail: | 1798 fail: |
| 1785 return ret; | 1799 return ret; |
| 1786 } | |
| 1787 | |
| 1788 static int set_codec_from_probe_data(AVStream *st, AVProbeData *pd, int score) | |
| 1789 { | |
| 1790 AVInputFormat *fmt; | |
| 1791 fmt = av_probe_input_format2(pd, 1, &score); | |
| 1792 | |
| 1793 if (fmt) { | |
| 1794 if (strncmp(fmt->name, "mp3", 3) == 0) | |
| 1795 st->codec->codec_id = CODEC_ID_MP3; | |
| 1796 else if (strncmp(fmt->name, "ac3", 3) == 0) | |
| 1797 st->codec->codec_id = CODEC_ID_AC3; | |
| 1798 } | |
| 1799 return !!fmt; | |
| 1800 } | 1800 } |
| 1801 | 1801 |
| 1802 unsigned int codec_get_tag(const AVCodecTag *tags, int id) | 1802 unsigned int codec_get_tag(const AVCodecTag *tags, int id) |
| 1803 { | 1803 { |
| 1804 while (tags->id != CODEC_ID_NONE) { | 1804 while (tags->id != CODEC_ID_NONE) { |
