From ce1a99d870c05b639512920cd3a1dee3e41d323f Mon Sep 17 00:00:00 2001 From: Vittorio Giovara Date: Thu, 20 Jul 2017 14:43:53 +0200 Subject: [PATCH 1/4] hevc: Make sure to update the current frame transfer characteristic Otherwise the first decoded frame will still be tagged with the original transfer instead of the alternative one. Signed-off-by: Vittorio Giovara --- libavcodec/hevcdec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c index ac0b1a3c1d..f6bbb7051e 100644 --- a/libavcodec/hevcdec.c +++ b/libavcodec/hevcdec.c @@ -2410,7 +2410,7 @@ static int set_side_data(HEVCContext *s) if (s->sei.alternative_transfer.present && av_color_transfer_name(s->sei.alternative_transfer.preferred_transfer_characteristics) && s->sei.alternative_transfer.preferred_transfer_characteristics != AVCOL_TRC_UNSPECIFIED) { - s->avctx->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics; + s->avctx->color_trc = out->color_trc = s->sei.alternative_transfer.preferred_transfer_characteristics; } return 0; From 48a5c35346aeded1c65b8709bbb085fa4e705c91 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Sat, 1 Jul 2017 10:49:58 +0200 Subject: [PATCH 2/4] caf: add an Opus tag CC: libav-stable@libav.org --- libavformat/caf.c | 1 + libavformat/cafdec.c | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/libavformat/caf.c b/libavformat/caf.c index cf128d5624..c299cad01b 100644 --- a/libavformat/caf.c +++ b/libavformat/caf.c @@ -49,6 +49,7 @@ const AVCodecTag ff_codec_caf_tags[] = { { AV_CODEC_ID_QCELP, MKBETAG('Q','c','l','p') }, { AV_CODEC_ID_QDM2, MKBETAG('Q','D','M','2') }, { AV_CODEC_ID_QDM2, MKBETAG('Q','D','M','C') }, + { AV_CODEC_ID_OPUS, MKBETAG('o','p','u','s') }, /* currently unsupported codecs */ /*{ AC-3 over S/PDIF MKBETAG('c','a','c','3') },*/ /*{ MPEG4CELP MKBETAG('c','e','l','p') },*/ diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index efc8c49c4a..d6b6007a1d 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -156,6 +156,14 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) avio_skip(pb, size - ALAC_NEW_KUKI); } st->codecpar->extradata_size = ALAC_HEADER; + } else if (st->codecpar->codec_id == AV_CODEC_ID_OPUS) { + // The data layout for Opus is currently unknown, so we do not export + // extradata at all. Multichannel streams are not supported. + if (st->codecpar->channels > 2) { + avpriv_request_sample(s, "multichannel Opus in CAF"); + return AVERROR_PATCHWELCOME; + } + avio_skip(pb, size); } else { st->codecpar->extradata = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE); if (!st->codecpar->extradata) From 9b9285bbf18e3bca87ec4969f661a4b321756cd5 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 10 Jul 2017 15:59:38 +0200 Subject: [PATCH 3/4] dxva: DXVA2_ModeHEVC_VLD_Main10 does not support Main This mode apparently does not support decoding of HEVC Main (8 bit). With D3D11 and Intel drivers on Windows 10 I get green corruption, while using DXVA2_ModeHEVC_VLD_Main works. Signed-off-by: Anton Khirnov --- libavcodec/dxva2.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c index a60604a84f..9ceb6236d4 100644 --- a/libavcodec/dxva2.c +++ b/libavcodec/dxva2.c @@ -63,8 +63,7 @@ static const int prof_h264_high[] = {FF_PROFILE_H264_CONSTRAINED_BASELINE, FF_PROFILE_UNKNOWN}; static const int prof_hevc_main[] = {FF_PROFILE_HEVC_MAIN, FF_PROFILE_UNKNOWN}; -static const int prof_hevc_main10[] = {FF_PROFILE_HEVC_MAIN, - FF_PROFILE_HEVC_MAIN_10, +static const int prof_hevc_main10[] = {FF_PROFILE_HEVC_MAIN_10, FF_PROFILE_UNKNOWN}; static const dxva_mode dxva_modes[] = { From 2b1324bd167553f49736e4eaa94f96da9982925e Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 16 Jul 2017 12:43:09 +0200 Subject: [PATCH 4/4] lavf: allow avformat_close_input() with NULL This is consistent with how other destructors behave. Signed-off-by: Anton Khirnov --- libavformat/utils.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index eaba473914..bbdc2cdb8a 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -2733,7 +2733,12 @@ void avformat_free_context(AVFormatContext *s) void avformat_close_input(AVFormatContext **ps) { AVFormatContext *s = *ps; - AVIOContext *pb = s->pb; + AVIOContext *pb; + + if (!*ps) + return; + + pb = s->pb; if ((s->iformat && s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO))