From 7f1b3c2ca6942580513392fce33cf54cef859b8f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 27 Jun 2013 11:09:02 +0200 Subject: [PATCH 1/3] Fix muxing QDM2 mono into caf. --- libavformat/cafenc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/cafenc.c b/libavformat/cafenc.c index 11bb055965..cd3a0be907 100644 --- a/libavformat/cafenc.c +++ b/libavformat/cafenc.c @@ -86,8 +86,9 @@ static uint32_t samples_per_packet(enum AVCodecID codec_id, int channels) { return 1152; case AV_CODEC_ID_AC3: return 1536; - case AV_CODEC_ID_ALAC: case AV_CODEC_ID_QDM2: + return 2048 * channels; + case AV_CODEC_ID_ALAC: return 4096; case AV_CODEC_ID_ADPCM_IMA_WAV: return (1024 - 4 * channels) * 8 / (4 * channels) + 1; From f91833210e740f6447e94b58067889a710ce9eca Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 27 Jun 2013 13:58:30 +0200 Subject: [PATCH 2/3] Set block_align when reading QDM2 in mov. Fixes ticket #2718. --- libavformat/mov.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index 5c61f6c718..36b17c1710 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -1551,6 +1551,7 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries) case AV_CODEC_ID_ILBC: case AV_CODEC_ID_MACE3: case AV_CODEC_ID_MACE6: + case AV_CODEC_ID_QDM2: st->codec->block_align = sc->bytes_per_frame; break; case AV_CODEC_ID_ALAC: From 41f3c60fbb7420f41295c8e0cf80acf9e71f72d0 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Thu, 27 Jun 2013 14:03:16 +0200 Subject: [PATCH 3/3] Avoid a null pointer dereference in avcodec_decode_video2(). This could happen if oom occured while probing a file. Reported in ticket #1900. --- libavcodec/utils.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 9fe3a16db7..e0819f4515 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1920,6 +1920,8 @@ int attribute_align_arg avcodec_decode_video2(AVCodecContext *avctx, AVFrame *pi // copy to ensure we do not change avpkt AVPacket tmp = *avpkt; + if (!avctx->codec) + return AVERROR(EINVAL); if (avctx->codec->type != AVMEDIA_TYPE_VIDEO) { av_log(avctx, AV_LOG_ERROR, "Invalid media type for video\n"); return AVERROR(EINVAL);