From patchwork Thu Feb 1 14:22:55 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gyan X-Patchwork-Id: 7472 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.156.27 with SMTP id q27csp3130956jak; Thu, 1 Feb 2018 06:23:15 -0800 (PST) X-Google-Smtp-Source: AH8x225h5M78IiKLcKqh3Q4+r51uEjgb0xV1xoUkRTeO1RSWkP7Z342t7Gs5+IEv6HfuMDbWADmX X-Received: by 10.223.151.151 with SMTP id s23mr13746659wrb.241.1517494995324; Thu, 01 Feb 2018 06:23:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517494995; cv=none; d=google.com; s=arc-20160816; b=0YZeI3tn1E6pu9AC1hNHHl5ObFHfjRzjBb0bjZDNTCF/I6WUL+BenQsh5Dj4mEBCQL MMaXaZ/J2xTKldYs06KrIvQigf/GM05ULnT4k6QpLu8r90sP1nf4XxZtEF/MAmZjsviR 9sK3yEugOzirxsAh0sOWs1ETC6tcV4YBTD0o6OhP/yaDKrQIZZ202XQLqagYOpupe9ne Mrk0ujoqQKpvgEnvXx2aHWa1MTqdfJCRORGbAiIpwVvFUqFv/7mYGFvQdlyb1NOhmVsf EiPkCT8a1ON2SND6RFeO4IVahZbLJYQrnrT6j6/+BHE/fIJkb5EcfTO/pKvlz5YjG8dn ascQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:to:from:dkim-signature:delivered-to :arc-authentication-results; bh=+101MU+eyFvEeglKwaVsMFP+bjQcqgT1TkP8SDgD+Vw=; b=EWZ/sL6wi5Mzmt4ECVXKRPWGdgmKn3BcLS+q915FMIuXtBN70SQDDoiYyXPLgRxQN2 4OJtPTRiTy6e3i7sMJ3MQSo/8m37gVwjEfcz5m+NdLbb+o/YNgB0R2wUKAqEU6fjdwki yHdW9wdyJe++ssaBs+tif56G2TQVAL2IapbsF52cDm6OpoD8oEquz+Rcq8IaeFQQL+Sc 6/7YAfs2VOE0zLjnoXW5hBQjgYSlMFJrmRNQ2mDqVj4eZU+4+EVeb0CdN2N63n6MNMv1 a3J0cme98cRXGiyghvJ5eMPazq9ob5xC7xncUjUblQZyxEy1xQ4okaJNnImja5E7+dM+ MdAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=o2HWhQwz; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id f35si14819494wra.391.2018.02.01.06.23.14; Thu, 01 Feb 2018 06:23:15 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=o2HWhQwz; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 2DC1F689BBB; Thu, 1 Feb 2018 16:23:07 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f177.google.com (mail-pf0-f177.google.com [209.85.192.177]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6628D689AED for ; Thu, 1 Feb 2018 16:23:00 +0200 (EET) Received: by mail-pf0-f177.google.com with SMTP id 17so14068972pfw.11 for ; Thu, 01 Feb 2018 06:23:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:references:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=KEXAtKX4JVeWcT2HKzW9uo1jm3qaZ8GL/2r+5t3F1Cc=; b=o2HWhQwzMP8Uo2+hBvhuPyJ9/9YCkvsPNjqeqca5cik6hmrDLtetJuEfuLLHNAFBow oa3fxCOCdAJ81X1SqeC//xj1uWo1r4dBanI2UhUHD/NtXtyVJIPMXrMETVqhrvgEQ65H VqB6IxCKrbFdvs2Qv0oceJcnoy7zEnv2ew35rfFVSmyIQh76fWYn/mnQjtjBh8hj1mFO s1zgEWj7zkdKsDBZGu2gCNad+UDXg5bxXFJvZDYGgcvFV8uyQ/MJ3F9M8qKa5+U9+U0d lQJEry/7x7JizZ5gEPAnillVcK6ZYX5SOAnWHedY0/y+DMR1ziNXpSa3yrK5eujc1fZG CsaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=KEXAtKX4JVeWcT2HKzW9uo1jm3qaZ8GL/2r+5t3F1Cc=; b=SW496ewXcNRC3R92cE/VQWo9r57ysMqcA5eHCBl1loyWSEZlRppCKKbNC2GGGNHjNq JFz1OXtGOgFsr46NGzcg7T8KIGMn31uEFEp8KEoSiUkaKrdomJn/FQT1S5qcp4h/ByWf hYxZzUBmulSCmqS4NG0f8Ijx95on32s3/lfWLlQeztm7hYRptcGylmGcYPXoDBWRgbSF ertsObH9IF7pbdOlWt8xkhwCtxkuDosSn5erGMxcv6JdyQBtErvHLBp0wmIjoOXMEuw1 MRFI4gLWjknLrngzcLausI4QxJo9KFJqnJcP0/z8++mg9vGyuVVoHNrY4/bJb4bbPTvh 0ahQ== X-Gm-Message-State: AKwxytd9GjmJXkediSKOaeiA7F5MvSBAhhfGkvjFhtr4bqBX58CNtbwZ lrl3HxsJgZLtjji5sr4TEyQBaCOS X-Received: by 10.98.252.82 with SMTP id e79mr37138218pfh.159.1517494984187; Thu, 01 Feb 2018 06:23:04 -0800 (PST) Received: from [192.168.1.15] ([45.126.171.255]) by smtp.gmail.com with ESMTPSA id p10sm44939708pfd.106.2018.02.01.06.23.01 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 01 Feb 2018 06:23:02 -0800 (PST) From: Gyan Doshi To: ffmpeg-devel@ffmpeg.org References: <294338e6-be38-88aa-7add-1b2f7ce84eab@gmail.com> <8c020b48-4ced-6f63-8752-948cf288e5fd@gmail.com> <0981c42c-946c-8796-4880-f752c2cc83dc@gmail.com> Message-ID: Date: Thu, 1 Feb 2018 19:52:55 +0530 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <0981c42c-946c-8796-4880-f752c2cc83dc@gmail.com> Content-Language: en-US Subject: Re: [FFmpeg-devel] [PATCH 3/4] avformat/mpegenc - accept PCM_DVD streams X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" On 1/29/2018 6:53 PM, 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! ... > Sorry, I'll rework and submit. Revised and tested patch attached. From 78757309bbfbc9d9e48aabd6babc9529f83d5950 Mon Sep 17 00:00:00 2001 From: Gyan Doshi Date: Thu, 1 Feb 2018 19:12:03 +0530 Subject: [PATCH v2] avformat/mpegenc - accept PCM_DVD streams PCM_S16BE stream packets in MPEG-PS have a 3-byte header and recognized as PCM_DVD by the demuxer which prevents their proper remuxing in MPEG-1/2 PS. --- libavformat/mpegenc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/libavformat/mpegenc.c b/libavformat/mpegenc.c index c77c3dfe41..598df662f4 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,10 @@ 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) { + if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) + av_log(ctx, AV_LOG_WARNING, "Only 16-bit LPCM streams are supported.\n"); stream->id = lpcm_id++; for (j = 0; j < 4; j++) { if (lpcm_freq_tab[j] == st->codecpar->sample_rate) @@ -1150,8 +1154,17 @@ static int mpeg_mux_write_packet(AVFormatContext *ctx, AVPacket *pkt) return AVERROR(ENOMEM); pkt_desc->pts = pts; pkt_desc->dts = dts; + + if (st->codecpar->codec_id == AV_CODEC_ID_PCM_DVD) { + /* Skip first 3 bytes of packet data, which comprise PCM header + and will be written fresh by this muxer. */ + buf += 3; + size -= 3; + } + pkt_desc->unwritten_size = pkt_desc->size = size; + if (!stream->predecode_packet) stream->predecode_packet = pkt_desc; stream->next_packet = &pkt_desc->next;