From patchwork Mon Jul 29 19:56:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 14132 Return-Path: X-Original-To: patchwork@ffaux-bg.ffmpeg.org Delivered-To: patchwork@ffaux-bg.ffmpeg.org Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by ffaux.localdomain (Postfix) with ESMTP id D50B4448FA9 for ; Mon, 29 Jul 2019 23:09:29 +0300 (EEST) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id B5F0F68A7C9; Mon, 29 Jul 2019 23:09:29 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f67.google.com (mail-wr1-f67.google.com [209.85.221.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E917168A6C5 for ; Mon, 29 Jul 2019 23:09:23 +0300 (EEST) Received: by mail-wr1-f67.google.com with SMTP id p17so63188557wrf.11 for ; Mon, 29 Jul 2019 13:09:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lu9rMwSKcBUTOGPSS+egyR4of3KH9kp1lafeXW1HE3w=; b=ICAq+0sjGZao/SLlKisF0G0EQ/AU8ilF1uabdKE3ZMGfv652wWon0VthB1H3EPWDmn X4XNn+PnhQnByfH5xiQRZl/5RPu5Z6kgR4H25OxRJQDEA0i3WAv7qpk1HfBipyZkDZ6T T7e/kSZMwMOByY5vxxAfTvtFZuuo1yIfpEHhbTItgVJY2ftXMLSoyU5sFglRNPRhf0WG VP1F3xzT7SY6R3KWCCfUXrwF/r4OuOXc/XmuQaOmiTt6M7Ixs2KAlWyCZ4gWUohPF1yb BQ7V5Ub3Pc73LU3eTlpDpaTlAsRiX/TQN5hzo/g5iFd/oBeFSxQEIHqYistitwEmS0ET tI7w== 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=Lu9rMwSKcBUTOGPSS+egyR4of3KH9kp1lafeXW1HE3w=; b=Ge5wKSfykLnrA2ybViZrg5PmBKo2Zm7loPZaXp1IrME0iNiujM45r4o5m4fFke0qHL dxvvEyhZE1yS7iWH5fsG1iYi9nPm2HZOpYIU0dxb0ZQ581iNAUqdLiQLEW5V6ATsfQjR Bvywvw8T1qPMJbzun2h42H98C5GInxc6wn6eGJ3wUE/Bbd9gxP95eoTsjmud8dMAyJpa 69SYg2QcMOyJczjWxdZ0d2tPfWqpuHbycALyuc+K3bftG4u64eeNAZb2mL2NnWXNbYDO 8klPOSU4T+rMTUDdG6n5HshGxP3jK+pNvdz7bLGrAUElyn9EAJ04aOBOWHlDXvCBtkLQ rUBw== X-Gm-Message-State: APjAAAWIuxtJqQ5DohHaSa8GuUOZMgo3Ac4FOpWOatTPAO1B0+vuvTiN F8uOvM8JHIYzXLFegbVS2JKjC5le X-Google-Smtp-Source: APXvYqzxyjHQDIYUZ9K61YDnXY2fiwPZkdsdqRc/xB9svC/62z6QbFO3EZyVa9WhhD46VcqJVIRMQQ== X-Received: by 2002:adf:e790:: with SMTP id n16mr104623665wrm.120.1564430616467; Mon, 29 Jul 2019 13:03:36 -0700 (PDT) Received: from localhost.localdomain (ipbcc08b8f.dynamic.kabel-deutschland.de. [188.192.139.143]) by smtp.gmail.com with ESMTPSA id t24sm56602211wmj.14.2019.07.29.13.03.35 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 29 Jul 2019 13:03:35 -0700 (PDT) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Mon, 29 Jul 2019 21:56:54 +0200 Message-Id: <20190729195658.56078-3-andreas.rheinhardt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190729195658.56078-1-andreas.rheinhardt@gmail.com> References: <20190729195658.56078-1-andreas.rheinhardt@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/7] cbs_mpeg2: Decompose Sequence End 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 Cc: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Sequence End units (or actually, sequence_end_codes) have up until now not been decomposed; in fact due to a bug in cbs_mpeg2_split_fragment they have mostly been treated as part of the preceding unit. So implement decomposing them as preparation for fixing said bug. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_mpeg2.c | 3 +++ libavcodec/cbs_mpeg2.h | 4 ++++ libavcodec/cbs_mpeg2_syntax_template.c | 12 ++++++++++++ 3 files changed, 19 insertions(+) diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 3e6797bd42..9a584246c9 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -269,6 +269,8 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx, extension_data, NULL); START(MPEG2_START_GROUP, MPEG2RawGroupOfPicturesHeader, group_of_pictures_header, NULL); + START(MPEG2_START_SEQUENCE_END, MPEG2RawSequenceEnd, + sequence_end, NULL); #undef START default: return AVERROR(ENOSYS); @@ -295,6 +297,7 @@ static int cbs_mpeg2_write_header(CodedBitstreamContext *ctx, START(MPEG2_START_EXTENSION, MPEG2RawExtensionData, extension_data); START(MPEG2_START_GROUP, MPEG2RawGroupOfPicturesHeader, group_of_pictures_header); + START(MPEG2_START_SEQUENCE_END, MPEG2RawSequenceEnd, sequence_end); #undef START default: av_log(ctx->log_ctx, AV_LOG_ERROR, "Write unimplemented for start " diff --git a/libavcodec/cbs_mpeg2.h b/libavcodec/cbs_mpeg2.h index 2befaab275..118e63d804 100644 --- a/libavcodec/cbs_mpeg2.h +++ b/libavcodec/cbs_mpeg2.h @@ -212,6 +212,10 @@ typedef struct MPEG2RawSlice { AVBufferRef *data_ref; } MPEG2RawSlice; +typedef struct MPEG2RawSequenceEnd { + uint8_t sequence_end_code; +} MPEG2RawSequenceEnd; + typedef struct CodedBitstreamMPEG2Context { // Elements stored in headers which are required for other decoding. diff --git a/libavcodec/cbs_mpeg2_syntax_template.c b/libavcodec/cbs_mpeg2_syntax_template.c index e7332abe6e..5165a14cd5 100644 --- a/libavcodec/cbs_mpeg2_syntax_template.c +++ b/libavcodec/cbs_mpeg2_syntax_template.c @@ -411,3 +411,15 @@ static int FUNC(slice_header)(CodedBitstreamContext *ctx, RWContext *rw, return 0; } + +static int FUNC(sequence_end)(CodedBitstreamContext *ctx, RWContext *rw, + MPEG2RawSequenceEnd *current) +{ + int err; + + HEADER("Sequence End"); + + ui(8, sequence_end_code); + + return 0; +}