From patchwork Thu Apr 22 12:03:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: zheng qian X-Patchwork-Id: 27210 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:5014:0:0:0:0:0 with SMTP id e20csp517498iob; Thu, 22 Apr 2021 05:11:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNFRluaAqerhhozTGwp+hiqbrXC4AsRdcRq035BCrTPPLQhetqPJQYQ0wfCZBtxDnF6ADR X-Received: by 2002:a17:906:4d10:: with SMTP id r16mr2965816eju.169.1619093490578; Thu, 22 Apr 2021 05:11:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619093490; cv=none; d=google.com; s=arc-20160816; b=E+xc7aNYbSl6VuA8ZT4gk6gXt2r/ye4MEuvgFICORJGpyXI0GtZmsiK4A8mB6l2m/F x+KRaI/p6jZGUUc5fooB43889FXQyVkfwhhe0IqoP+AWYT2zHmqQlr8RfQXBchX34GeY IB2vscUK2/ViBdDzlJn9Zc2YI6pIW1c6gJ1P0zkInff63ZkzCE1v4RERQTtmpwmFBzn2 cToIBhD+pbuACF2WBzTHdWMerek6TouiUF2kDbg2zMKAOKpJ0Y6BPqle2d/SVWe3BQoI y1WWhvIZ7SF5geZNWLiId2+s9wLM2P2qmoU7BGYjfi7zof2/fZC8gPL5nmiRktcu3i8T s+6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:reply-to :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:subject:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:delivered-to; bh=uOz82raP7nVF195ERq8lBrVg8kAWogLoJgz/t4kd/4Q=; b=rKjSXK6uiz7dmZpzvoGMGiGaSLKbkeIlLSyqx1F84obshDk5YrMtyjhYyPOn3bc8Un TVatai8rWfqG77QqobtvbQrcd0C1cfucTitHr1RItaOAuenNn1Cn0KkQtepLeoSjSEJy 1O37Gyn4p1fpxIyt8igZ480lVQB54srw5nDzULpE6Go/cROQ1KfOicz8XJcg9h2o2lAt iKpylKYRw0eU9UuFRz0zLZEnQ+7Ci8tWzjGZTl5YiiimRD91Z23zP8Rdo/mXkEWgyqYF YwW5qWVD//t54VaUpV9ySmBos0LMEQPwYh7bJWlGxrfMPm/UQEM4bIA9uS/tpJHAZGjQ tw/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@xqq-im.20150623.gappssmtp.com header.s=20150623 header.b="JM/WCp5l"; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id r15si2038671ejx.748.2021.04.22.05.11.30; Thu, 22 Apr 2021 05:11:30 -0700 (PDT) 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=@xqq-im.20150623.gappssmtp.com header.s=20150623 header.b="JM/WCp5l"; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 59571689F3A; Thu, 22 Apr 2021 15:11:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pg1-f182.google.com (mail-pg1-f182.google.com [209.85.215.182]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D5CC8689753 for ; Thu, 22 Apr 2021 15:11:19 +0300 (EEST) Received: by mail-pg1-f182.google.com with SMTP id j7so23268569pgi.3 for ; Thu, 22 Apr 2021 05:11:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xqq-im.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=mRvmthHs4g3dzqFxPne283qls9W1qHL2KDrVEZ1IRqw=; b=JM/WCp5l43brHlshQFWHLIc5F0rL5qsTUH11goDuz8PBgyuHj3igYf3A0nPZwfU1G+ bJmLEhKpADZkqUVNPY6NVumZijtKU4YfWCk98hei0QaRyFXLpTz1lczq687+AxD6u2KW WMwbrrmVYcRzEt2wx/9DMwvUobxIrqLZVYA/hJR6FsxsaYlPcWLpP4QRNTug8TMlqjO7 HPV0/dgxQ+W75O1+NotP3qoB8C6XmEpnZoOwHh64Pn+STkvU6GE6peNe7/aLghkLkHih rRpk8tbV4yrPesHCbTi918SQkgN5KG8MzfnNujVzYtQa10f6doUvnzik7XN54VyQ0DyG KFxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=mRvmthHs4g3dzqFxPne283qls9W1qHL2KDrVEZ1IRqw=; b=Vcx0xPouukb1zO8AY7iNL2CXaLWkT4qOhZH1AgtrL/GfUpnWaYq1mbdL7Lwg1rLLAF qG9wPN+WneSoc8bUJSiTP1fueigpSX1rUUux22DH/pu3n8PNifsz9CMZChM2mNtiUo7X qqxPSV51k6+M66FFf5uGOsiuSNeOe6fhFo6ii++fkDfvPFIjSiP9FLc1DBj/Q7a5QQyu ZWn1hMY/Ugt03NjRQNsJhKI1EVmYzfYJoRwPuZgFnmirfgyI/6rkY4E/v3ueWtsvQTBU Fh0sp/DuUV5d/Tatk6wtU6fQkOlPBEOv3P06MYVper/qeGNRoQ226cy1GhoxBusnK+yJ 5S/Q== X-Gm-Message-State: AOAM5303LNFflHWr6zl1yh1fzOMqq9uU1XxNuGRpuWFe4QnweH1NebHP N3VOYwpYtOutmLaTiKCBYWJ5AIfS57lCYmZv X-Received: by 2002:a63:dc56:: with SMTP id f22mr3237070pgj.287.1619093017214; Thu, 22 Apr 2021 05:03:37 -0700 (PDT) Received: from zhengqian-xps.lan (ngn-nat1.v4.open.ad.jp. [202.222.12.138]) by smtp.gmail.com with ESMTPSA id l3sm4787667pju.44.2021.04.22.05.03.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Apr 2021 05:03:35 -0700 (PDT) From: zheng qian To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Apr 2021 21:03:10 +0900 Message-Id: <20210422120311.10294-2-xqq@xqq.im> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210422120311.10294-1-xqq@xqq.im> References: <1245c8f2-93d4-6153-68d8-2351fab30cd4@gmail.com> <20210422120311.10294-1-xqq@xqq.im> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3 2/3] avformat/mpegtsenc: Fix indentation inside if-clause in mpegts_write_pes() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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 Cc: zheng qian Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: qFYhhXcsrwp1 Fix indentation caused by the added stream_id judgement Signed-off-by: zheng qian --- libavformat/mpegtsenc.c | 180 ++++++++++++++++++++-------------------- 1 file changed, 90 insertions(+), 90 deletions(-) diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c index b59dab5174..967f98931d 100644 --- a/libavformat/mpegtsenc.c +++ b/libavformat/mpegtsenc.c @@ -1486,99 +1486,99 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st, stream_id != 0xF2 && // DSMCC_stream stream_id != 0xF8) { // ITU-T Rec. H.222.1 type E stream - flags = 0; - if (pts != AV_NOPTS_VALUE) { - header_len += 5; - flags |= 0x80; - } - if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { - header_len += 5; - flags |= 0x40; - } - if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && - st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { - /* set PES_extension_flag */ - pes_extension = 1; - flags |= 0x01; - - /* One byte for PES2 extension flag + - * one byte for extension length + - * one byte for extension id */ - header_len += 3; - } - /* for Blu-ray AC3 Audio the PES Extension flag should be as follow - * otherwise it will not play sound on blu-ray - */ - if (ts->m2ts_mode && - st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && - st->codecpar->codec_id == AV_CODEC_ID_AC3) { - /* set PES_extension_flag */ - pes_extension = 1; - flags |= 0x01; - header_len += 3; - } - if (is_dvb_teletext) { - pes_header_stuffing_bytes = 0x24 - header_len; - header_len = 0x24; - } - len = payload_size + header_len + 3; - /* 3 extra bytes should be added to DVB subtitle payload: 0x20 0x00 at the beginning and trailing 0xff */ - if (is_dvb_subtitle) { - len += 3; - payload_size++; - } - if (len > 0xffff) - len = 0; - if (ts->omit_video_pes_length && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { - len = 0; - } - *q++ = len >> 8; - *q++ = len; - val = 0x80; - /* data alignment indicator is required for subtitle and data streams */ - if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) - val |= 0x04; - *q++ = val; - *q++ = flags; - *q++ = header_len; - if (pts != AV_NOPTS_VALUE) { - write_pts(q, flags >> 6, pts); - q += 5; - } - if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { - write_pts(q, 1, dts); - q += 5; - } - if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { - flags = 0x01; /* set PES_extension_flag_2 */ - *q++ = flags; - *q++ = 0x80 | 0x01; /* marker bit + extension length */ - /* Set the stream ID extension flag bit to 0 and - * write the extended stream ID. */ - *q++ = 0x00 | 0x60; - } - /* For Blu-ray AC3 Audio Setting extended flags */ - if (ts->m2ts_mode && - pes_extension && - st->codecpar->codec_id == AV_CODEC_ID_AC3) { - flags = 0x01; /* set PES_extension_flag_2 */ + flags = 0; + if (pts != AV_NOPTS_VALUE) { + header_len += 5; + flags |= 0x80; + } + if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { + header_len += 5; + flags |= 0x40; + } + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO && + st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { + /* set PES_extension_flag */ + pes_extension = 1; + flags |= 0x01; + + /* One byte for PES2 extension flag + + * one byte for extension length + + * one byte for extension id */ + header_len += 3; + } + /* for Blu-ray AC3 Audio the PES Extension flag should be as follow + * otherwise it will not play sound on blu-ray + */ + if (ts->m2ts_mode && + st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO && + st->codecpar->codec_id == AV_CODEC_ID_AC3) { + /* set PES_extension_flag */ + pes_extension = 1; + flags |= 0x01; + header_len += 3; + } + if (is_dvb_teletext) { + pes_header_stuffing_bytes = 0x24 - header_len; + header_len = 0x24; + } + len = payload_size + header_len + 3; + /* 3 extra bytes should be added to DVB subtitle payload: 0x20 0x00 at the beginning and trailing 0xff */ + if (is_dvb_subtitle) { + len += 3; + payload_size++; + } + if (len > 0xffff) + len = 0; + if (ts->omit_video_pes_length && st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) { + len = 0; + } + *q++ = len >> 8; + *q++ = len; + val = 0x80; + /* data alignment indicator is required for subtitle and data streams */ + if (st->codecpar->codec_type == AVMEDIA_TYPE_SUBTITLE || st->codecpar->codec_type == AVMEDIA_TYPE_DATA) + val |= 0x04; + *q++ = val; *q++ = flags; - *q++ = 0x80 | 0x01; /* marker bit + extension length */ - *q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on blue-rays) */ - } + *q++ = header_len; + if (pts != AV_NOPTS_VALUE) { + write_pts(q, flags >> 6, pts); + q += 5; + } + if (dts != AV_NOPTS_VALUE && pts != AV_NOPTS_VALUE && dts != pts) { + write_pts(q, 1, dts); + q += 5; + } + if (pes_extension && st->codecpar->codec_id == AV_CODEC_ID_DIRAC) { + flags = 0x01; /* set PES_extension_flag_2 */ + *q++ = flags; + *q++ = 0x80 | 0x01; /* marker bit + extension length */ + /* Set the stream ID extension flag bit to 0 and + * write the extended stream ID. */ + *q++ = 0x00 | 0x60; + } + /* For Blu-ray AC3 Audio Setting extended flags */ + if (ts->m2ts_mode && + pes_extension && + st->codecpar->codec_id == AV_CODEC_ID_AC3) { + flags = 0x01; /* set PES_extension_flag_2 */ + *q++ = flags; + *q++ = 0x80 | 0x01; /* marker bit + extension length */ + *q++ = 0x00 | 0x71; /* for AC3 Audio (specifically on blue-rays) */ + } - if (is_dvb_subtitle) { - /* First two fields of DVB subtitles PES data: - * data_identifier: for DVB subtitle streams shall be coded with the value 0x20 - * subtitle_stream_id: for DVB subtitle stream shall be identified by the value 0x00 */ - *q++ = 0x20; - *q++ = 0x00; - } - if (is_dvb_teletext) { - memset(q, 0xff, pes_header_stuffing_bytes); - q += pes_header_stuffing_bytes; - } + if (is_dvb_subtitle) { + /* First two fields of DVB subtitles PES data: + * data_identifier: for DVB subtitle streams shall be coded with the value 0x20 + * subtitle_stream_id: for DVB subtitle stream shall be identified by the value 0x00 */ + *q++ = 0x20; + *q++ = 0x00; + } + if (is_dvb_teletext) { + memset(q, 0xff, pes_header_stuffing_bytes); + q += pes_header_stuffing_bytes; + } } else { len = payload_size; *q++ = len >> 8;