Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegenc: extend muxing PCM-DVD to other depths
On 11/29/18, Paul B Mahol wrote: > On 11/29/18, Gyan Doshi wrote: >> On 29-11-2018 05:09 PM, Paul B Mahol wrote: >>> Fixes #6783. >>> >>> Signed-off-by: Paul B Mahol >>> --- >>> libavformat/mpegenc.c | 27 +-- >>> 1 file changed, 21 insertions(+), 6 deletions(-) >>> >>> diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c >>> index 4c6fa67fb8..1389288b7f 100644 >>> --- a/libavformat/mpegenc.c >>> +++ b/libavformat/mpegenc.c >> >>> + >>> +switch (st->codecpar->sample_rate) { >>> +case 48000: freq = 0; break; >>> +case 96000: freq = 1; break; >>> +case 44100: freq = 2; break; >>> +case 32000: freq = 3; break; >>> +default: >>> +av_log(ctx, AV_LOG_ERROR, "Unsupported sample >>> rate.\n"); >>> +return AVERROR(EINVAL); >>> +} >> It will be helpful to the users to mention the supported rates. > > Already mentioned in encoder. > Will apply soon. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegenc: extend muxing PCM-DVD to other depths
On 11/29/18, Gyan Doshi wrote: > On 29-11-2018 05:09 PM, Paul B Mahol wrote: >> Fixes #6783. >> >> Signed-off-by: Paul B Mahol >> --- >> libavformat/mpegenc.c | 27 +-- >> 1 file changed, 21 insertions(+), 6 deletions(-) >> >> diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c >> index 4c6fa67fb8..1389288b7f 100644 >> --- a/libavformat/mpegenc.c >> +++ b/libavformat/mpegenc.c > >> + >> +switch (st->codecpar->sample_rate) { >> +case 48000: freq = 0; break; >> +case 96000: freq = 1; break; >> +case 44100: freq = 2; break; >> +case 32000: freq = 3; break; >> +default: >> +av_log(ctx, AV_LOG_ERROR, "Unsupported sample >> rate.\n"); >> +return AVERROR(EINVAL); >> +} > It will be helpful to the users to mention the supported rates. Already mentioned in encoder. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegenc: extend muxing PCM-DVD to other depths
On 29-11-2018 05:09 PM, Paul B Mahol wrote: Fixes #6783. Signed-off-by: Paul B Mahol --- libavformat/mpegenc.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 4c6fa67fb8..1389288b7f 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c + +switch (st->codecpar->sample_rate) { +case 48000: freq = 0; break; +case 96000: freq = 1; break; +case 44100: freq = 2; break; +case 32000: freq = 3; break; +default: +av_log(ctx, AV_LOG_ERROR, "Unsupported sample rate.\n"); +return AVERROR(EINVAL); +} It will be helpful to the users to mention the supported rates. Gyan ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avformat/mpegenc: extend muxing PCM-DVD to other depths
Fixes #6783. Signed-off-by: Paul B Mahol --- libavformat/mpegenc.c | 27 +-- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 4c6fa67fb8..1389288b7f 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -364,12 +364,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) stream->id = ac3_id++; } else if (st->codecpar->codec_id == AV_CODEC_ID_DTS) { stream->id = dts_id++; -} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE || - st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) { -if (st->codecpar->bits_per_coded_sample != 16) { -av_log(ctx, AV_LOG_ERROR, "Only 16 bit LPCM streams can be muxed.\n"); -goto fail; -} +} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) { stream->id = lpcm_id++; for (j = 0; j < 4; j++) { if (lpcm_freq_tab[j] == st->codecpar->sample_rate) @@ -392,6 +387,26 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) stream->lpcm_header[1] = (st->codecpar->channels - 1) | (j << 4); stream->lpcm_header[2] = 0x80; stream->lpcm_align = st->codecpar->channels * 2; +} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) { +int freq; + +switch (st->codecpar->sample_rate) { +case 48000: freq = 0; break; +case 96000: freq = 1; break; +case 44100: freq = 2; break; +case 32000: freq = 3; break; +default: +av_log(ctx, AV_LOG_ERROR, "Unsupported sample rate.\n"); +return AVERROR(EINVAL); +} + +stream->lpcm_header[0] = 0x0c; +stream->lpcm_header[1] = (freq << 4) | + (((st->codecpar->bits_per_coded_sample - 16) / 4) << 6) | + st->codecpar->channels - 1; +stream->lpcm_header[2] = 0x80; +stream->id = lpcm_id++; +stream->lpcm_align = st->codecpar->channels * st->codecpar->bits_per_coded_sample / 8; } else { stream->id = mpa_id++; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 2/2] avformat/mpegenc: extend muxing PCM-DVD to other depths
On Tue, Nov 27, 2018 at 12:29:26PM +0100, Paul B Mahol wrote: > Fixes #6783. > > Signed-off-by: Paul B Mahol > --- > libavformat/mpegenc.c | 15 +-- > 1 file changed, 9 insertions(+), 6 deletions(-) breaks: make fate-mpegps-remuxed-pcm-demux TESTmpegps-remuxed-pcm-demux --- ./tests/ref/fate/mpegps-remuxed-pcm-demux 2018-11-25 15:28:06.126532228 +0100 +++ tests/data/fate/mpegps-remuxed-pcm-demux2018-11-28 18:42:49.004238988 +0100 @@ -1,50 +0,0 @@ -#tb 0: 1/9 -#media_type 0: audio -#codec_id 0: pcm_dvd -#sample_rate 0: 44100 -#channel_layout 0: 4 -#channel_layout_name 0: mono -0, 0, 0, 2040, 2005, 0x8e98e563 -0, 2090, 2090, 2069, 2033, 0xd6f2f455 -0, 4180, 4180, 2057, 2021, 0x77a6e6c9 -0, 6269, 6269, 2057, 2021, 0x8dbcf6be -0, 8359, 8359, 2057, 2021, 0xc629eaa0 -0, 10449, 10449, 2057, 2021, 0xa951ebe5 -0, 12539, 12539, 2057, 2021, 0x1324f29b -0, 14629, 14629, 2057, 2021, 0x55f1e968 -0, 16718, 16718, 2057, 2021, 0x98a7f994 -0, 18808, 18808, 2057, 2021, 0xba42f42f -0, 20898, 20898, 2057, 2021, 0xcf5cefe6 -0, 22988, 22988, 2057, 2021, 0xeef8f2b5 -0, 25078, 25078, 2057, 2021, 0x71faf42f -0, 27167, 27167, 2057, 2021, 0x0346f019 -0, 29257, 29257, 2057, 2021, 0xbca0f4a3 -0, 31347, 31347, 2057, 2021, 0x3b6ced4f -0, 33437, 33437, 2057, 2021, 0xc8b9ea0a -0, 35527, 35527, 2057, 2021, 0x18e5f385 -0, 37616, 37616, 2057, 2021, 0x74f6e9d6 -0, 39706, 39706, 2057, 2021, 0x35d8f2b5 -0, 41796, 41796, 2057, 2021, 0x9d2aec53 -0, 43886, 43886, 2057, 2021, 0xf0acf1a0 -0, 45976, 45976, 2057, 2021, 0xa724ebe9 -0, 48065, 48065, 2057, 2021, 0xd4f8f534 -0, 50155, 50155, 2057, 2021, 0xdf62efc6 -0, 52245, 52245, 2057, 2021, 0x9865f504 -0, 54335, 54335, 2057, 2021, 0x8670efb7 -0, 56424, 56424, 2057, 2021, 0xe51af219 -0, 58514, 58514, 2057, 2021, 0x0210f27f -0, 60604, 60604, 2057, 2021, 0x4b08f406 -0, 62694, 62694, 2057, 2021, 0x2b02eed4 -0, 64784, 64784, 2057, 2021, 0x0445ed00 -0, 66873, 66873, 2057, 2021, 0xfae9f21f -0, 68963, 68963, 2057, 2021, 0x3d6beabc -0, 71053, 71053, 2057, 2021, 0xc50af39c -0, 73143, 73143, 2057, 2021, 0xf9eceb82 -0, 75233, 75233, 2057, 2021, 0x7b89eb9b -0, 77322, 77322, 2057, 2021, 0x7c07ef4b -0, 79412, 79412, 2057, 2021, 0xbfacf1eb -0, 81502, 81502, 2057, 2021, 0xccb2f27b -0, 83592, 83592, 2057, 2021, 0xc035f557 -0, 85682, 85682, 2057, 2021, 0xbdf1edea -0, 87771, 87771, 2057, 2021, 0x3644f424 -0, 89861, 89861, 1457, 1433, 0xdd17d51f Test mpegps-remuxed-pcm-demux failed. Look at tests/data/fate/mpegps-remuxed-pcm-demux.err for details. make: *** [fate-mpegps-remuxed-pcm-demux] Error 1 [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Take away the freedom of one citizen and you will be jailed, take away the freedom of all citizens and you will be congratulated by your peers in Parliament. signature.asc Description: PGP signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] avformat/mpegenc: extend muxing PCM-DVD to other depths
Fixes #6783. Signed-off-by: Paul B Mahol --- libavformat/mpegenc.c | 15 +-- 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index 4c6fa67fb8..f2d6a898f2 100644 --- a/libavformat/mpegenc.c +++ b/libavformat/mpegenc.c @@ -364,12 +364,7 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) stream->id = ac3_id++; } else if (st->codecpar->codec_id == AV_CODEC_ID_DTS) { stream->id = dts_id++; -} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE || - st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) { -if (st->codecpar->bits_per_coded_sample != 16) { -av_log(ctx, AV_LOG_ERROR, "Only 16 bit LPCM streams can be muxed.\n"); -goto fail; -} +} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE) { stream->id = lpcm_id++; for (j = 0; j < 4; j++) { if (lpcm_freq_tab[j] == st->codecpar->sample_rate) @@ -392,6 +387,14 @@ static av_cold int mpeg_mux_init(AVFormatContext *ctx) stream->lpcm_header[1] = (st->codecpar->channels - 1) | (j << 4); stream->lpcm_header[2] = 0x80; stream->lpcm_align = st->codecpar->channels * 2; +} else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) { +stream->lpcm_header[0] = 0x0c; +stream->lpcm_header[1] = (((st->codecpar->sample_rate / 48000) - 1) << 4) | + (((st->codecpar->bits_per_coded_sample - 16) / 4) << 6) | + st->codecpar->channels - 1; +stream->lpcm_header[2] = 0x80; +stream->id = lpcm_id++; +stream->lpcm_align = st->codecpar->channels * st->codecpar->bits_per_coded_sample / 8; } else { stream->id = mpa_id++; } -- 2.17.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel