diff mbox

[FFmpeg-devel,3/4] avformat/mpegenc - accept PCM_DVD streams

Message ID 8c020b48-4ced-6f63-8752-948cf288e5fd@gmail.com
State Superseded
Headers show

Commit Message

Gyan Jan. 29, 2018, 7:12 a.m. UTC
From 099ddfec0e6b1b9f2cd9b399294c8ad8123583c1 Mon Sep 17 00:00:00 2001
From: Gyan Doshi <gyandoshi@gmail.com>
Date: Mon, 29 Jan 2018 12:17:46 +0530
Subject: [PATCH 3/4] avformat/mpegenc - accept PCM_DVD streams

PCM_S16BE streams in MPEG-PS are recognized as PCM_DVD by the demuxer
which prevents their proper remuxing in MPEG-1/2 PS.
---
 libavformat/mpegenc.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Carl Eugen Hoyos Jan. 29, 2018, 10:17 a.m. UTC | #1
2018-01-29 8:12 GMT+01:00 Gyan Doshi <gyandoshi@gmail.com>:

How did you test this patch?

Carl Eugen
Gyan Jan. 29, 2018, 1:23 p.m. UTC | #2
On 1/29/2018 3:47 PM, Carl Eugen Hoyos wrote:

> How did you test this patch?

By remuxing with patched ffmpeg and then checking with ffprobe, but not 
ffplay!

On playback, I see the output is garbled, because the PCM_DVD header 
carries over from the source packet and also breaks LPCM block 
alignment. Sorry, I'll rework and submit.

This shouldn't affect the other patches.

Regards,
Gyan
Michael Niedermayer Feb. 13, 2018, 10:29 p.m. UTC | #3
On Mon, Jan 29, 2018 at 06:53:06PM +0530, Gyan Doshi wrote:
> 
> On 1/29/2018 3:47 PM, Carl Eugen Hoyos wrote:
> 
> >How did you test this patch?
> 
> By remuxing with patched ffmpeg and then checking with ffprobe, but not
> ffplay!

muxer side changes should be tested against something else than ffmpeg in
general, if possible.
Is there no other software available that supports this ?

That said, i dont see anything wrong with the patch, its more that i dont
feel fully confident about all the PCM variants in mpeg to not miss something ...

also if someone else feels this patch is ok and wants to apply this without
further tests iam 100% ok with that.


[...]
Gyan Feb. 14, 2018, 5:04 a.m. UTC | #4
On 2/14/2018 3:59 AM, Michael Niedermayer wrote:
> On Mon, Jan 29, 2018 at 06:53:06PM +0530, Gyan Doshi wrote:
>>
>> On 1/29/2018 3:47 PM, Carl Eugen Hoyos wrote:
>>
>>> How did you test this patch?
>>
>> By remuxing with patched ffmpeg and then checking with ffprobe, but not
>> ffplay!
> 
> muxer side changes should be tested against something else than ffmpeg in
> general, if possible.
> Is there no other software available that supports this ?

Remuxed file plays well with other players like Windows Media Player and 
Potplayer. VLC too, though I'm not sure if it uses lavf demuxer.


Regards,
Gyan
diff mbox

Patch

diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c
index 1be0cd56a3..7a79b614ec 100644
--- a/libavformat/mpegenc.c
+++ b/libavformat/mpegenc.c
@@ -353,7 +353,8 @@  static av_cold int mpeg_mux_init(AVFormatContext *ctx)
             if (!s->is_mpeg2 &&
                 (st->codecpar->codec_id == AV_CODEC_ID_AC3 ||
                  st->codecpar->codec_id == AV_CODEC_ID_DTS ||
-                 st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE))
+                 st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE ||
+                 st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD))
                  av_log(ctx, AV_LOG_WARNING,
                         "%s in MPEG-1 system streams is not widely supported, "
                         "consider using the vob or the dvd muxer "
@@ -363,7 +364,8 @@  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) {
+            } else if (st->codecpar->codec_id == AV_CODEC_ID_PCM_S16BE ||
+                       st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) {
                 stream->id = lpcm_id++;
                 for (j = 0; j < 4; j++) {
                     if (lpcm_freq_tab[j] == st->codecpar->sample_rate)