From 9d6b188fca185968af5c62438b44dcbd2eefc47a Mon Sep 17 00:00:00 2001 From: Uoti Urpala Date: Sat, 9 Mar 2013 13:22:53 +0200 Subject: [PATCH] libav: switch from CODEC_ID to AV_CODEC_ID Libav has dropped support for old CODEC_ID_* definitions. Switch to the new AV_CODEC_ID_* variants. Increase minimum required libavcodec version to the one adding the AV_ variants. --- configure | 4 +- libmpcodecs/ad_ffmpeg.c | 2 +- libmpcodecs/vd_ffmpeg.c | 8 +- libmpdemux/demux_lavf.c | 28 ++--- libmpdemux/demuxer.c | 27 ++-- libmpdemux/mp_taglists.c | 316 +++++++++++++++++++++++------------------------ libmpdemux/mp_taglists.h | 6 +- libvo/vo_png.c | 2 +- screenshot.c | 2 +- sub/sd_lavc.c | 10 +- 10 files changed, 202 insertions(+), 203 deletions(-) rewrite libmpdemux/mp_taglists.c (76%) diff --git a/configure b/configure index 1e39b0c7e9..95a5ae8f7b 100755 --- a/configure +++ b/configure @@ -4733,9 +4733,7 @@ fi echores "$_lcms2" -# Test with > against Libav 0.8 versions which will NOT work rather than -# specify minimum version, to allow (future) point releases to possibly work. -all_libav_libs="libavutil > 51.21.0:libavcodec > 53.34.0:libavformat > 53.20.0:libswscale >= 2.0.0" +all_libav_libs="libavutil > 51.21.0:libavcodec >= 54.25.0:libavformat > 53.20.0:libswscale >= 2.0.0" echocheck "Libav ($all_libav_libs)" if test "$ffmpeg" = auto ; then IFS=":" # shell should not be used for programming diff --git a/libmpcodecs/ad_ffmpeg.c b/libmpcodecs/ad_ffmpeg.c index 19c2f871df..2b85b6dc3e 100644 --- a/libmpcodecs/ad_ffmpeg.c +++ b/libmpcodecs/ad_ffmpeg.c @@ -175,7 +175,7 @@ static int setup_format(sh_audio_t *sh_audio) int container_samplerate = sh_audio->container_out_samplerate; if (!container_samplerate && sh_audio->wf) container_samplerate = sh_audio->wf->nSamplesPerSec; - if (codec->codec_id == CODEC_ID_AAC + if (codec->codec_id == AV_CODEC_ID_AAC && samplerate == 2 * container_samplerate) broken_srate = true; else if (container_samplerate) diff --git a/libmpcodecs/vd_ffmpeg.c b/libmpcodecs/vd_ffmpeg.c index 2ba2b4e154..e8f5d9c78c 100644 --- a/libmpcodecs/vd_ffmpeg.c +++ b/libmpcodecs/vd_ffmpeg.c @@ -162,10 +162,10 @@ static int init(sh_video_t *sh) ctx->do_slices = 1; if (lavc_codec->capabilities & CODEC_CAP_DR1 && !do_vis_debug - && lavc_codec->id != CODEC_ID_H264 - && lavc_codec->id != CODEC_ID_INTERPLAY_VIDEO - && lavc_codec->id != CODEC_ID_ROQ && lavc_codec->id != CODEC_ID_VP8 - && lavc_codec->id != CODEC_ID_LAGARITH) + && lavc_codec->id != AV_CODEC_ID_H264 + && lavc_codec->id != AV_CODEC_ID_INTERPLAY_VIDEO + && lavc_codec->id != AV_CODEC_ID_ROQ && lavc_codec->id != AV_CODEC_ID_VP8 + && lavc_codec->id != AV_CODEC_ID_LAGARITH) ctx->do_dr1 = 1; ctx->ip_count = ctx->b_count = 0; diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 301b789276..5f13b3b4d2 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -295,7 +295,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) matches_avinputformat_name(priv, "mpegts")) codec->codec_tag = 0; int override_tag = mp_taglist_override(codec->codec_id); - // For some formats (like PCM) always trust CODEC_ID_* more than codec_tag + // For some formats (like PCM) always trust codec_id more than codec_tag if (override_tag) codec->codec_tag = override_tag; @@ -345,10 +345,10 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) sh_audio->samplerate = codec->sample_rate; sh_audio->i_bps = codec->bit_rate / 8; switch (codec->codec_id) { - case CODEC_ID_PCM_ALAW: + case AV_CODEC_ID_PCM_ALAW: sh_audio->format = 0x6; break; - case CODEC_ID_PCM_MULAW: + case AV_CODEC_ID_PCM_MULAW: sh_audio->format = 0x7; break; } @@ -381,7 +381,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) sh_video->libav_codec_id = codec->codec_id; bih = calloc(sizeof(*bih) + codec->extradata_size, 1); - if (codec->codec_id == CODEC_ID_RAWVIDEO) { + if (codec->codec_id == AV_CODEC_ID_RAWVIDEO) { switch (codec->pix_fmt) { case PIX_FMT_RGB24: codec->codec_tag = MKTAG(24, 'B', 'G', 'R'); @@ -464,21 +464,21 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) sh_sub_t *sh_sub; char type; /* only support text subtitles for now */ - if (codec->codec_id == CODEC_ID_TEXT) + if (codec->codec_id == AV_CODEC_ID_TEXT) type = 't'; - else if (codec->codec_id == CODEC_ID_MOV_TEXT) + else if (codec->codec_id == AV_CODEC_ID_MOV_TEXT) type = 'm'; - else if (codec->codec_id == CODEC_ID_SSA) + else if (codec->codec_id == AV_CODEC_ID_SSA) type = 'a'; - else if (codec->codec_id == CODEC_ID_DVD_SUBTITLE) + else if (codec->codec_id == AV_CODEC_ID_DVD_SUBTITLE) type = 'v'; - else if (codec->codec_id == CODEC_ID_XSUB) + else if (codec->codec_id == AV_CODEC_ID_XSUB) type = 'x'; - else if (codec->codec_id == CODEC_ID_DVB_SUBTITLE) + else if (codec->codec_id == AV_CODEC_ID_DVB_SUBTITLE) type = 'b'; - else if (codec->codec_id == CODEC_ID_DVB_TELETEXT) + else if (codec->codec_id == AV_CODEC_ID_DVB_TELETEXT) type = 'd'; - else if (codec->codec_id == CODEC_ID_HDMV_PGS_SUBTITLE) + else if (codec->codec_id == AV_CODEC_ID_HDMV_PGS_SUBTITLE) type = 'p'; else break; @@ -513,7 +513,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) AVDictionaryEntry *ftag = av_dict_get(st->metadata, "filename", NULL, 0); char *filename = ftag ? ftag->value : NULL; - if (st->codec->codec_id == CODEC_ID_TTF) + if (st->codec->codec_id == AV_CODEC_ID_TTF) demuxer_add_attachment(demuxer, bstr(filename), bstr("application/x-truetype-font"), (struct bstr){codec->extradata, @@ -966,7 +966,7 @@ redo: prog->aid = program->stream_index[i]; break; case AVMEDIA_TYPE_SUBTITLE: - if (prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == CODEC_ID_TEXT) + if (prog->sid == -2 && priv->avfc->streams[program->stream_index[i]]->codec->codec_id == AV_CODEC_ID_TEXT) prog->sid = program->stream_index[i]; break; } diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index e2df5caab0..f6d769d8c8 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -488,37 +488,38 @@ void ds_add_packet(demux_stream_t *ds, demux_packet_t *dp) ds->demuxer->video->packs); } -static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parser, unsigned format) +static void allocate_parser(AVCodecContext **avctx, + AVCodecParserContext **parser, unsigned format) { - enum CodecID codec_id = CODEC_ID_NONE; + enum AVCodecID codec_id = AV_CODEC_ID_NONE; switch (format) { case MKTAG('M', 'P', '4', 'L'): - codec_id = CODEC_ID_AAC_LATM; + codec_id = AV_CODEC_ID_AAC_LATM; break; case 0x2000: case 0x332D6361: case 0x332D4341: case 0x20736D: case MKTAG('s', 'a', 'c', '3'): - codec_id = CODEC_ID_AC3; + codec_id = AV_CODEC_ID_AC3; break; case MKTAG('d', 'n', 'e', 't'): // DNET/byte-swapped AC-3 - there is no parser for that yet - //codec_id = CODEC_ID_DNET; + //codec_id = AV_CODEC_ID_DNET; break; case MKTAG('E', 'A', 'C', '3'): - codec_id = CODEC_ID_EAC3; + codec_id = AV_CODEC_ID_EAC3; break; case 0x2001: case 0x86: - codec_id = CODEC_ID_DTS; + codec_id = AV_CODEC_ID_DTS; break; case MKTAG('f', 'L', 'a', 'C'): - codec_id = CODEC_ID_FLAC; + codec_id = AV_CODEC_ID_FLAC; break; case MKTAG('M', 'L', 'P', ' '): - codec_id = CODEC_ID_MLP; + codec_id = AV_CODEC_ID_MLP; break; case 0x55: case 0x5500736d: @@ -526,19 +527,19 @@ static void allocate_parser(AVCodecContext **avctx, AVCodecParserContext **parse case MKTAG('.', 'm', 'p', '3'): case MKTAG('M', 'P', '3', ' '): case MKTAG('L', 'A', 'M', 'E'): - codec_id = CODEC_ID_MP3; + codec_id = AV_CODEC_ID_MP3; break; case 0x50: case 0x5000736d: case MKTAG('.', 'm', 'p', '2'): case MKTAG('.', 'm', 'p', '1'): - codec_id = CODEC_ID_MP2; + codec_id = AV_CODEC_ID_MP2; break; case MKTAG('T', 'R', 'H', 'D'): - codec_id = CODEC_ID_TRUEHD; + codec_id = AV_CODEC_ID_TRUEHD; break; } - if (codec_id != CODEC_ID_NONE) { + if (codec_id != AV_CODEC_ID_NONE) { *avctx = avcodec_alloc_context3(NULL); if (!*avctx) return; diff --git a/libmpdemux/mp_taglists.c b/libmpdemux/mp_taglists.c dissimilarity index 76% index afd1b971ce..3c5534328f 100644 --- a/libmpdemux/mp_taglists.c +++ b/libmpdemux/mp_taglists.c @@ -1,158 +1,158 @@ -/* - * This file is part of MPlayer. - * - * MPlayer is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * MPlayer is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with MPlayer; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -#include - -#include "config.h" -#include "mp_taglists.h" - -struct tag { - enum CodecID id; - unsigned int tag; -}; - -static const struct tag mp_wav_tags[] = { - { CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')}, - { CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x')}, - { CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, - { CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')}, - { CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, - { CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, - { CODEC_ID_ADPCM_XA, MKTAG('P', 'S', 'X', 'A')}, - { CODEC_ID_AMR_NB, MKTAG('n', 'b', 0, 0)}, - { CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k')}, - { CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, - { CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, - { CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, - { CODEC_ID_MLP, MKTAG('M', 'L', 'P', ' ')}, - { CODEC_ID_MP1, 0x50}, - { CODEC_ID_MP4ALS, MKTAG('A', 'L', 'S', ' ')}, - { CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, - { CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, - { CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, - { CODEC_ID_PCM_LXF, MKTAG('P', 'L', 'X', 'F')}, - { CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p')}, - { CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')}, - { CODEC_ID_RA_144, MKTAG('1', '4', '_', '4')}, - { CODEC_ID_RA_288, MKTAG('2', '8', '_', '8')}, - { CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, - { CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, - { CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')}, - { CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, - { CODEC_ID_TWINVQ, MKTAG('T', 'W', 'I', '2')}, - { CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, - { CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, - { CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, - { 0, 0 }, -}; - -static const struct tag mp_codecid_override_tags[] = { - { CODEC_ID_AAC, MKTAG('M', 'P', '4', 'A')}, - { CODEC_ID_AAC_LATM, MKTAG('M', 'P', '4', 'L')}, - { CODEC_ID_AC3, 0x2000}, - { CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A')}, - { CODEC_ID_BINKAUDIO_DCT, MKTAG('B', 'A', 'U', '1')}, - { CODEC_ID_BINKAUDIO_RDFT, MKTAG('B', 'A', 'U', '2')}, - { CODEC_ID_DTS, 0x2001}, - { CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd')}, - { CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, - { CODEC_ID_H264, MKTAG('H', '2', '6', '4')}, - { CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'V')}, - { CODEC_ID_PCM_BLURAY, MKTAG('B', 'P', 'C', 'M')}, - { CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, - { CODEC_ID_PCM_U8, 1}, - { CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')}, - { CODEC_ID_PCM_S16LE, 1}, - { CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, - { CODEC_ID_PCM_S24LE, 1}, - { CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2')}, - { CODEC_ID_PCM_S32LE, 1}, - { CODEC_ID_MP2, 0x50}, - { CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'G', '2')}, - { CODEC_ID_TRUEHD, MKTAG('T', 'R', 'H', 'D')}, - { 0, 0 }, -}; - -static const struct tag mp_bmp_tags[] = { - { CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')}, - { CODEC_ID_ANM, MKTAG('A', 'N', 'M', ' ')}, - { CODEC_ID_AVS, MKTAG('A', 'V', 'S', ' ')}, - { CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, - { CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')}, - { CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, - { CODEC_ID_CDGRAPHICS, MKTAG('C', 'D', 'G', 'R')}, - { CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n')}, - { CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')}, - { CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')}, - { CODEC_ID_FLIC, MKTAG('F', 'L', 'I', 'C')}, - { CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I')}, - { CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V')}, - { CODEC_ID_JV, MKTAG('F', 'F', 'J', 'V')}, - { CODEC_ID_MDEC, MKTAG('M', 'D', 'E', 'C')}, - { CODEC_ID_MOTIONPIXELS, MKTAG('M', 'V', 'I', '1')}, - { CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1')}, - { CODEC_ID_RL2, MKTAG('R', 'L', '2', 'V')}, - { CODEC_ID_ROQ, MKTAG('R', 'o', 'Q', 'V')}, - { CODEC_ID_RV10, MKTAG('R', 'V', '1', '0')}, - { CODEC_ID_RV20, MKTAG('R', 'V', '2', '0')}, - { CODEC_ID_RV30, MKTAG('R', 'V', '3', '0')}, - { CODEC_ID_RV40, MKTAG('R', 'V', '4', '0')}, - { CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3')}, - { CODEC_ID_TGV, MKTAG('f', 'V', 'G', 'T')}, - { CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V')}, - { CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q')}, - { CODEC_ID_TXD, MKTAG('T', 'X', 'D', 'V')}, - { CODEC_ID_VP6A, MKTAG('V', 'P', '6', 'A')}, - { CODEC_ID_VMDVIDEO, MKTAG('V', 'M', 'D', 'V')}, - { CODEC_ID_WS_VQA, MKTAG('V', 'Q', 'A', 'V')}, - { CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')}, - { 0, 0 }, -}; - -static unsigned int codec_get_tag(const struct tag *tags, enum CodecID id) -{ - while (tags->id != CODEC_ID_NONE) { - if (tags->id == id) - return tags->tag; - tags++; - } - return 0; -} - -unsigned int mp_taglist_override(enum CodecID id) -{ - return codec_get_tag(mp_codecid_override_tags, id); -} - -unsigned int mp_taglist_video(enum CodecID id) -{ - const struct AVCodecTag *tags[] = {avformat_get_riff_video_tags(), NULL }; - unsigned int tag = av_codec_get_tag(tags, id); - if (tag) - return tag; - return codec_get_tag(mp_bmp_tags, id); -} - -unsigned int mp_taglist_audio(enum CodecID id) -{ - const struct AVCodecTag *tags[] = {avformat_get_riff_audio_tags(), NULL }; - unsigned int tag = av_codec_get_tag(tags, id); - if (tag) - return tag; - return codec_get_tag(mp_wav_tags, id); -} +/* + * This file is part of MPlayer. + * + * MPlayer is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * MPlayer is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#include + +#include "config.h" +#include "mp_taglists.h" + +struct tag { + enum AVCodecID id; + unsigned int tag; +}; + +static const struct tag mp_wav_tags[] = { + { AV_CODEC_ID_ADPCM_4XM, MKTAG('4', 'X', 'M', 'A')}, + { AV_CODEC_ID_ADPCM_ADX, MKTAG('S', 'a', 'd', 'x')}, + { AV_CODEC_ID_ADPCM_EA, MKTAG('A', 'D', 'E', 'A')}, + { AV_CODEC_ID_ADPCM_EA_MAXIS_XA, MKTAG('A', 'D', 'X', 'A')}, + { AV_CODEC_ID_ADPCM_IMA_WS, MKTAG('A', 'I', 'W', 'S')}, + { AV_CODEC_ID_ADPCM_THP, MKTAG('T', 'H', 'P', 'A')}, + { AV_CODEC_ID_ADPCM_XA, MKTAG('P', 'S', 'X', 'A')}, + { AV_CODEC_ID_AMR_NB, MKTAG('n', 'b', 0, 0)}, + { AV_CODEC_ID_COOK, MKTAG('c', 'o', 'o', 'k')}, + { AV_CODEC_ID_DSICINAUDIO, MKTAG('D', 'C', 'I', 'A')}, + { AV_CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, + { AV_CODEC_ID_INTERPLAY_DPCM, MKTAG('I', 'N', 'P', 'A')}, + { AV_CODEC_ID_MLP, MKTAG('M', 'L', 'P', ' ')}, + { AV_CODEC_ID_MP1, 0x50}, + { AV_CODEC_ID_MP4ALS, MKTAG('A', 'L', 'S', ' ')}, + { AV_CODEC_ID_MUSEPACK7, MKTAG('M', 'P', 'C', ' ')}, + { AV_CODEC_ID_MUSEPACK8, MKTAG('M', 'P', 'C', '8')}, + { AV_CODEC_ID_NELLYMOSER, MKTAG('N', 'E', 'L', 'L')}, + { AV_CODEC_ID_PCM_LXF, MKTAG('P', 'L', 'X', 'F')}, + { AV_CODEC_ID_QCELP, MKTAG('Q', 'c', 'l', 'p')}, + { AV_CODEC_ID_QDM2, MKTAG('Q', 'D', 'M', '2')}, + { AV_CODEC_ID_RA_144, MKTAG('1', '4', '_', '4')}, + { AV_CODEC_ID_RA_288, MKTAG('2', '8', '_', '8')}, + { AV_CODEC_ID_ROQ_DPCM, MKTAG('R', 'o', 'Q', 'A')}, + { AV_CODEC_ID_SHORTEN, MKTAG('s', 'h', 'r', 'n')}, + { AV_CODEC_ID_SPEEX, MKTAG('s', 'p', 'x', ' ')}, + { AV_CODEC_ID_TTA, MKTAG('T', 'T', 'A', '1')}, + { AV_CODEC_ID_TWINVQ, MKTAG('T', 'W', 'I', '2')}, + { AV_CODEC_ID_WAVPACK, MKTAG('W', 'V', 'P', 'K')}, + { AV_CODEC_ID_WESTWOOD_SND1, MKTAG('S', 'N', 'D', '1')}, + { AV_CODEC_ID_XAN_DPCM, MKTAG('A', 'x', 'a', 'n')}, + { 0, 0 }, +}; + +static const struct tag mp_codecid_override_tags[] = { + { AV_CODEC_ID_AAC, MKTAG('M', 'P', '4', 'A')}, + { AV_CODEC_ID_AAC_LATM, MKTAG('M', 'P', '4', 'L')}, + { AV_CODEC_ID_AC3, 0x2000}, + { AV_CODEC_ID_ADPCM_IMA_AMV, MKTAG('A', 'M', 'V', 'A')}, + { AV_CODEC_ID_BINKAUDIO_DCT, MKTAG('B', 'A', 'U', '1')}, + { AV_CODEC_ID_BINKAUDIO_RDFT, MKTAG('B', 'A', 'U', '2')}, + { AV_CODEC_ID_DTS, 0x2001}, + { AV_CODEC_ID_DVVIDEO, MKTAG('d', 'v', 's', 'd')}, + { AV_CODEC_ID_EAC3, MKTAG('E', 'A', 'C', '3')}, + { AV_CODEC_ID_H264, MKTAG('H', '2', '6', '4')}, + { AV_CODEC_ID_MPEG4, MKTAG('M', 'P', '4', 'V')}, + { AV_CODEC_ID_PCM_BLURAY, MKTAG('B', 'P', 'C', 'M')}, + { AV_CODEC_ID_PCM_S8, MKTAG('t', 'w', 'o', 's')}, + { AV_CODEC_ID_PCM_U8, 1}, + { AV_CODEC_ID_PCM_S16BE, MKTAG('t', 'w', 'o', 's')}, + { AV_CODEC_ID_PCM_S16LE, 1}, + { AV_CODEC_ID_PCM_S24BE, MKTAG('i', 'n', '2', '4')}, + { AV_CODEC_ID_PCM_S24LE, 1}, + { AV_CODEC_ID_PCM_S32BE, MKTAG('i', 'n', '3', '2')}, + { AV_CODEC_ID_PCM_S32LE, 1}, + { AV_CODEC_ID_MP2, 0x50}, + { AV_CODEC_ID_MPEG2VIDEO, MKTAG('M', 'P', 'G', '2')}, + { AV_CODEC_ID_TRUEHD, MKTAG('T', 'R', 'H', 'D')}, + { 0, 0 }, +}; + +static const struct tag mp_bmp_tags[] = { + { AV_CODEC_ID_AMV, MKTAG('A', 'M', 'V', 'V')}, + { AV_CODEC_ID_ANM, MKTAG('A', 'N', 'M', ' ')}, + { AV_CODEC_ID_AVS, MKTAG('A', 'V', 'S', ' ')}, + { AV_CODEC_ID_BETHSOFTVID, MKTAG('B', 'E', 'T', 'H')}, + { AV_CODEC_ID_BFI, MKTAG('B', 'F', 'I', 'V')}, + { AV_CODEC_ID_C93, MKTAG('C', '9', '3', 'V')}, + { AV_CODEC_ID_CDGRAPHICS, MKTAG('C', 'D', 'G', 'R')}, + { AV_CODEC_ID_DNXHD, MKTAG('A', 'V', 'd', 'n')}, + { AV_CODEC_ID_DSICINVIDEO, MKTAG('D', 'C', 'I', 'V')}, + { AV_CODEC_ID_DXA, MKTAG('D', 'X', 'A', '1')}, + { AV_CODEC_ID_FLIC, MKTAG('F', 'L', 'I', 'C')}, + { AV_CODEC_ID_IDCIN, MKTAG('I', 'D', 'C', 'I')}, + { AV_CODEC_ID_INTERPLAY_VIDEO, MKTAG('I', 'N', 'P', 'V')}, + { AV_CODEC_ID_JV, MKTAG('F', 'F', 'J', 'V')}, + { AV_CODEC_ID_MDEC, MKTAG('M', 'D', 'E', 'C')}, + { AV_CODEC_ID_MOTIONPIXELS, MKTAG('M', 'V', 'I', '1')}, + { AV_CODEC_ID_NUV, MKTAG('N', 'U', 'V', '1')}, + { AV_CODEC_ID_RL2, MKTAG('R', 'L', '2', 'V')}, + { AV_CODEC_ID_ROQ, MKTAG('R', 'o', 'Q', 'V')}, + { AV_CODEC_ID_RV10, MKTAG('R', 'V', '1', '0')}, + { AV_CODEC_ID_RV20, MKTAG('R', 'V', '2', '0')}, + { AV_CODEC_ID_RV30, MKTAG('R', 'V', '3', '0')}, + { AV_CODEC_ID_RV40, MKTAG('R', 'V', '4', '0')}, + { AV_CODEC_ID_SVQ3, MKTAG('S', 'V', 'Q', '3')}, + { AV_CODEC_ID_TGV, MKTAG('f', 'V', 'G', 'T')}, + { AV_CODEC_ID_THP, MKTAG('T', 'H', 'P', 'V')}, + { AV_CODEC_ID_TIERTEXSEQVIDEO, MKTAG('T', 'S', 'E', 'Q')}, + { AV_CODEC_ID_TXD, MKTAG('T', 'X', 'D', 'V')}, + { AV_CODEC_ID_VP6A, MKTAG('V', 'P', '6', 'A')}, + { AV_CODEC_ID_VMDVIDEO, MKTAG('V', 'M', 'D', 'V')}, + { AV_CODEC_ID_WS_VQA, MKTAG('V', 'Q', 'A', 'V')}, + { AV_CODEC_ID_XAN_WC3, MKTAG('W', 'C', '3', 'V')}, + { 0, 0 }, +}; + +static unsigned int codec_get_tag(const struct tag *tags, enum AVCodecID id) +{ + while (tags->id != AV_CODEC_ID_NONE) { + if (tags->id == id) + return tags->tag; + tags++; + } + return 0; +} + +unsigned int mp_taglist_override(enum AVCodecID id) +{ + return codec_get_tag(mp_codecid_override_tags, id); +} + +unsigned int mp_taglist_video(enum AVCodecID id) +{ + const struct AVCodecTag *tags[] = {avformat_get_riff_video_tags(), NULL }; + unsigned int tag = av_codec_get_tag(tags, id); + if (tag) + return tag; + return codec_get_tag(mp_bmp_tags, id); +} + +unsigned int mp_taglist_audio(enum AVCodecID id) +{ + const struct AVCodecTag *tags[] = {avformat_get_riff_audio_tags(), NULL }; + unsigned int tag = av_codec_get_tag(tags, id); + if (tag) + return tag; + return codec_get_tag(mp_wav_tags, id); +} diff --git a/libmpdemux/mp_taglists.h b/libmpdemux/mp_taglists.h index d23a982a93..251bf2dd70 100644 --- a/libmpdemux/mp_taglists.h +++ b/libmpdemux/mp_taglists.h @@ -21,8 +21,8 @@ #include -unsigned int mp_taglist_override(enum CodecID id); -unsigned int mp_taglist_video(enum CodecID id); -unsigned int mp_taglist_audio(enum CodecID id); +unsigned int mp_taglist_override(enum AVCodecID id); +unsigned int mp_taglist_video(enum AVCodecID id); +unsigned int mp_taglist_audio(enum AVCodecID id); #endif /* MPLAYER_MP_TAGLISTS_H */ diff --git a/libvo/vo_png.c b/libvo/vo_png.c index ea2b763079..50dffb7d0f 100644 --- a/libvo/vo_png.c +++ b/libvo/vo_png.c @@ -66,7 +66,7 @@ config(uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uin mp_msg(MSGT_VO,MSGL_DBG2, "PNG Compression level %i\n", z_compression); uninit(); - struct AVCodec *png_codec = avcodec_find_encoder(CODEC_ID_PNG); + struct AVCodec *png_codec = avcodec_find_encoder(AV_CODEC_ID_PNG); if (!png_codec) goto error; avctx = avcodec_alloc_context3(png_codec); diff --git a/screenshot.c b/screenshot.c index 38043da12e..81ae2d08d7 100644 --- a/screenshot.c +++ b/screenshot.c @@ -83,7 +83,7 @@ static int write_png(screenshot_ctx *ctx, struct mp_image *image) void *outbuffer = NULL; int success = 0; - struct AVCodec *png_codec = avcodec_find_encoder(CODEC_ID_PNG); + struct AVCodec *png_codec = avcodec_find_encoder(AV_CODEC_ID_PNG); AVCodecContext *avctx = NULL; if (!png_codec) goto print_open_fail; diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c index deedc0b1d6..f9b3cc1a06 100644 --- a/sub/sd_lavc.c +++ b/sub/sd_lavc.c @@ -40,16 +40,16 @@ static int init(struct sh_sub *sh, struct osd_state *osd) if (sh->initialized) return 0; struct sd_lavc_priv *priv = talloc_zero(NULL, struct sd_lavc_priv); - enum CodecID cid = CODEC_ID_NONE; + enum AVCodecID cid = AV_CODEC_ID_NONE; switch (sh->type) { case 'b': - cid = CODEC_ID_DVB_SUBTITLE; break; + cid = AV_CODEC_ID_DVB_SUBTITLE; break; case 'p': - cid = CODEC_ID_HDMV_PGS_SUBTITLE; break; + cid = AV_CODEC_ID_HDMV_PGS_SUBTITLE; break; case 'x': - cid = CODEC_ID_XSUB; break; + cid = AV_CODEC_ID_XSUB; break; case 'v': - cid = CODEC_ID_DVD_SUBTITLE; break; + cid = AV_CODEC_ID_DVD_SUBTITLE; break; } AVCodecContext *ctx = NULL; AVCodec *sub_codec = avcodec_find_decoder(cid); -- 2.11.4.GIT