Message ID | 34f7902b-177b-8394-9df9-2c237be2826b@gmail.com |
---|---|
State | New |
Headers | show |
2018-01-29 8:12 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>: > Forgot to attach patch. > > Changes to MPEG-PS muxer factored as requested in > http://www.ffmpeg.org/pipermail/ffmpeg-devel/2018-January/224642.html. Looks like you should be using "goto fail" instead of returning an error directly. Carl Eugen
On 1/29/2018 3:46 PM, Carl Eugen Hoyos wrote: > Looks like you should be using "goto fail" instead of returning > an error directly. I preserved the existing behaviour, but I'll change it to fail: Regards, Gyan
diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 695de3f081..1be0cd56a3 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -369,10 +369,19 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) if (lpcm_freq_tab[j] == st->codecpar->sample_rate) break; } - if (j == 4) + if (j == 4) { + int sr; + av_log(ctx, AV_LOG_ERROR, "Invalid sampling rate for PCM stream.\n"); + av_log(ctx, AV_LOG_INFO, "Allowed sampling rates:"); + for (sr = 0; sr < 4; sr++) + av_log(ctx, AV_LOG_INFO, " %d", lpcm_freq_tab[sr]); + av_log(ctx, AV_LOG_INFO, "\n"); goto fail; - if (st->codecpar->channels > 8) - return -1; + } + if (st->codecpar->channels > 8) { + av_log(ctx, AV_LOG_ERROR, "At most 8 channels allowed for LPCM streams.\n"); + return AVERROR(EINVAL); + } stream->lpcm_header[0] = 0x0c; stream->lpcm_header[1] = (st->codecpar->channels - 1) | (j << 4); stream->lpcm_header[2] = 0x80;
Forgot to attach patch. Changes to MPEG-PS muxer factored as requested in http://www.ffmpeg.org/pipermail/ffmpeg-devel/2018-January/224642.html. From 344bd0981693a345aebb907d825cb3eb5f93b402 Mon Sep 17 00:00:00 2001 From: Gyan Doshi <gyandoshi@gmail.com> Date: Mon, 29 Jan 2018 12:11:41 +0530 Subject: [PATCH 2/4] avformat/mpegenc - log error messages for unsupported LPCM streams The MPEG-PS muxer only accepts PCM S16BE streams having up to 8 channels and one of the following sampling rates: 32 kHz 44.1kHz 48 kHz 96 kHz. --- libavformat/mpegenc.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)