[MPlayer-cvslog] r34724 - in trunk: configure libmpdemux/mp_taglists.c
reimar
subversion at mplayerhq.hu
Tue Feb 14 20:22:22 CET 2012
Author: reimar
Date: Tue Feb 14 20:22:22 2012
New Revision: 34724
Log:
Simplify codec id <-> tag mapping using avformat_get_riff_*_tags.
This also ensures that again only audio mappings will be used for
audio and video mappings for video.
This fixes bug #2038.
Based on patch by Andrew Wason [rectalogic rectalogic com].
Modified:
trunk/configure
trunk/libmpdemux/mp_taglists.c
Modified: trunk/configure
==============================================================================
--- trunk/configure Tue Feb 14 18:06:09 2012 (r34723)
+++ trunk/configure Tue Feb 14 20:22:22 2012 (r34724)
@@ -7068,8 +7068,6 @@ echocheck "mencoder"
if test "$_mencoder" = no ; then
# mpeg1video for vf_lavc, snow for vf_uspp / vf_mcdeint,
libavencoders="$mplayer_encoders MPEG1VIDEO_ENCODER SNOW_ENCODER"
- # needed for codec id -> tag conversion
- libavmuxers="AVI_MUXER"
fi
echores "$_mencoder"
Modified: trunk/libmpdemux/mp_taglists.c
==============================================================================
--- trunk/libmpdemux/mp_taglists.c Tue Feb 14 18:06:09 2012 (r34723)
+++ trunk/libmpdemux/mp_taglists.c Tue Feb 14 20:22:22 2012 (r34724)
@@ -72,8 +72,6 @@ static const struct AVCodecTag mp_wav_ta
{ 0, 0 },
};
-static const struct AVCodecTag * const mp_wav_taglists[] = {mp_wav_tags, 0};
-
static const struct AVCodecTag mp_codecid_override_tags[] = {
{ CODEC_ID_8SVX_EXP, MKTAG('8', 'e', 'x', 'p')},
{ CODEC_ID_8SVX_FIB, MKTAG('8', 'f', 'i', 'b')},
@@ -157,25 +155,23 @@ static const struct AVCodecTag mp_bmp_ta
{ 0, 0 },
};
-static const struct AVCodecTag * const mp_bmp_taglists[] = {mp_bmp_tags, 0};
+static void get_taglists(const struct AVCodecTag *dst[3], int audio)
+{
+ dst[0] = audio ? mp_wav_tags : mp_bmp_tags;
+ dst[1] = audio ? avformat_get_riff_audio_tags() : avformat_get_riff_video_tags();
+ dst[2] = NULL;
+}
enum CodecID mp_tag2codec_id(uint32_t tag, int audio)
{
- AVOutputFormat *avi_format;
- enum CodecID id = av_codec_get_id(audio ? mp_wav_taglists : mp_bmp_taglists, tag);
- if (id != CODEC_ID_NONE)
- return id;
- avi_format = av_guess_format("avi", NULL, NULL);
- if (!avi_format) {
- mp_msg(MSGT_DEMUXER, MSGL_FATAL, "MPlayer cannot work properly without AVI muxer in libavformat!\n");
- return 0;
- }
- return av_codec_get_id(avi_format->codec_tag, tag);
+ const struct AVCodecTag *taglists[3];
+ get_taglists(taglists, audio);
+ return av_codec_get_id(taglists, tag);
}
uint32_t mp_codec_id2tag(enum CodecID codec_id, uint32_t old_tag, int audio)
{
- AVOutputFormat *avi_format;
+ const struct AVCodecTag *taglists[3];
// For some formats (like PCM) always trust CODEC_ID_* more than codec_tag
uint32_t tag = av_codec_get_tag(mp_codecid_override_taglists, codec_id);
if (tag)
@@ -189,14 +185,6 @@ uint32_t mp_codec_id2tag(enum CodecID co
if (tag)
return tag;
- tag = av_codec_get_tag(audio ? mp_wav_taglists : mp_bmp_taglists, codec_id);
- if (tag)
- return tag;
-
- avi_format = av_guess_format("avi", NULL, NULL);
- if (!avi_format) {
- mp_msg(MSGT_DEMUXER, MSGL_FATAL, "MPlayer cannot work properly without AVI muxer in libavformat!\n");
- return 0;
- }
- return av_codec_get_tag(avi_format->codec_tag, codec_id);
+ get_taglists(taglists, audio);
+ return av_codec_get_tag(taglists, codec_id);
}
More information about the MPlayer-cvslog
mailing list