From patchwork Wed Sep 22 17:29:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 30458 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp753022iob; Wed, 22 Sep 2021 10:29:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyI2is5HIVK73PQqpFO6h3tEGaxBpW3KXuIMRbtla8gyBb4iLQoAg6sueDFB2kCow4M+fhQ X-Received: by 2002:a17:906:cc0e:: with SMTP id ml14mr309900ejb.395.1632331772725; Wed, 22 Sep 2021 10:29:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632331772; cv=none; d=google.com; s=arc-20160816; b=ysHp/E/yGDHVcd5pVb3oR2eAKLOkVG/FWP7lBrYVhoxz++eoc1/phg4+JkLvg2NOJl 3+IoSZaHVkIgmfYXxLKX5sHUiTnZHMRCqWLsfWlgXtB7fOiwzqA5VbHa7broKB6jZkJv hKqLf9Hxg8N5nJJuYkfVp8oaoOwgCzIkwVa+TnPQmvGzQi2vVfILNwPIydSVJkB62pZ5 K5xoZyKIxcfy8Qgq06DdCEVwoZBtKP3ZfxjMqLtbfzre7sbypoy5l6gJHws/jTa2VSFH 8i2Ii6zXBjmPrju9eBb4N+ZUjjtCyffW7PvKMjDiIPqFwBW/jMs0qPC4FbPeoCGRBwFF Xn5g== 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:message-id:date:to:from :delivered-to; bh=D5buqOjgRKxxUMEAWLNZ+q0VPE9/NZimGepRFIOwA4g=; b=xSAGqkPbxQhnrtP0+A60n8ZrGygUDfF8qpEB83wBJaPA9Z6miMK/2pTL++PGiLjEtX ttq0OhDfAsBfocsTL7eRSgzYaxc2EsbJoiKaCnswL3P4PGoxAqAbStdSMAIzZwrKxY0L uHrQ2RyHGHcpDa1Fi+WklqS0AInUFIdTXe/t3kKW66gW3Pr51vbwEdIR8aXtoBkjKkNr XgYEA7a+EQLUKOI2lFPwVMvfYJvhtOl1ULU1CbC5f1wFsETjreO+7t+5702DX6ZJ8OVf sUplw8Mjn0sL5wv4den43P4O59BdcRypQ/JBa/0NUxAcEL6m+u0dreLJiNhpR2eZdlOA 3jKw== ARC-Authentication-Results: i=1; mx.google.com; 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 w3si3205572edi.35.2021.09.22.10.29.31; Wed, 22 Sep 2021 10:29:32 -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; 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 6EDC168A7DE; Wed, 22 Sep 2021 20:29:27 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E03CF68A7DE for ; Wed, 22 Sep 2021 20:29:19 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 67EF9E5E81; Wed, 22 Sep 2021 19:29:19 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id emb2IvTpVTBW; Wed, 22 Sep 2021 19:29:18 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 05030E5CFC; Wed, 22 Sep 2021 19:29:18 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Sep 2021 19:29:11 +0200 Message-Id: <20210922172914.17914-1-cus@passwd.hu> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/4] avformat/mpegts: use named constants for stream_id types 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: Marton Balint Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: yMGocxA23bdX Signed-off-by: Marton Balint --- libavformat/mpegts.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index da8eee2414..fcb32ecd28 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -1126,7 +1126,7 @@ static int mpegts_push_data(MpegTSFilter *filter, PESContext *pes = filter->u.pes_filter.opaque; MpegTSContext *ts = pes->ts; const uint8_t *p; - int ret, len, code; + int ret, len; if (!ts->pkt) return 0; @@ -1160,15 +1160,13 @@ static int mpegts_push_data(MpegTSFilter *filter, if (pes->header[0] == 0x00 && pes->header[1] == 0x00 && pes->header[2] == 0x01) { /* it must be an MPEG-2 PES stream */ - code = pes->header[3] | 0x100; - av_log(pes->stream, AV_LOG_TRACE, "pid=%x pes_code=%#x\n", pes->pid, - code); pes->stream_id = pes->header[3]; + av_log(pes->stream, AV_LOG_TRACE, "pid=%x stream_id=%#x\n", pes->pid, pes->stream_id); if ((pes->st && pes->st->discard == AVDISCARD_ALL && (!pes->sub_st || pes->sub_st->discard == AVDISCARD_ALL)) || - code == 0x1be) /* padding_stream */ + pes->stream_id == STREAM_ID_PADDING_STREAM) goto skip; /* stream not present in PMT */ @@ -1196,10 +1194,13 @@ static int mpegts_push_data(MpegTSFilter *filter, if (!pes->buffer) return AVERROR(ENOMEM); - if (code != 0x1bc && code != 0x1bf && /* program_stream_map, private_stream_2 */ - code != 0x1f0 && code != 0x1f1 && /* ECM, EMM */ - code != 0x1ff && code != 0x1f2 && /* program_stream_directory, DSMCC_stream */ - code != 0x1f8) { /* ITU-T Rec. H.222.1 type E stream */ + if (pes->stream_id != STREAM_ID_PROGRAM_STREAM_MAP && + pes->stream_id != STREAM_ID_PRIVATE_STREAM_2 && + pes->stream_id != STREAM_ID_ECM_STREAM && + pes->stream_id != STREAM_ID_EMM_STREAM && + pes->stream_id != STREAM_ID_PROGRAM_STREAM_DIRECTORY && + pes->stream_id != STREAM_ID_DSMCC_STREAM && + pes->stream_id != STREAM_ID_TYPE_E_STREAM) { FFStream *const pes_sti = ffstream(pes->st); pes->state = MPEGTS_PESHEADER; if (pes->st->codecpar->codec_id == AV_CODEC_ID_NONE && !pes_sti->request_probe) {