From patchwork Sat Dec 1 07:52:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 11239 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 0247D44CFB1 for ; Sat, 1 Dec 2018 09:53:27 +0200 (EET) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8189D68A0A6; Sat, 1 Dec 2018 09:53:27 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wr1-f66.google.com (mail-wr1-f66.google.com [209.85.221.66]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id BA0EF68A0A6 for ; Sat, 1 Dec 2018 09:53:20 +0200 (EET) Received: by mail-wr1-f66.google.com with SMTP id z5so7311641wrt.11 for ; Fri, 30 Nov 2018 23:53:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=d++YfUrdvZ/z/Dy3UUqE/SCSpYpGD+ICodBS2vX78Ow=; b=JrOCVE8swOImN/sNz3uAZRaV5x7WAUmhVge6GMydwLkJ7kOiv7xeoKYKIAIS7lxJ3Z UiiLL5RSeKKs1QHonMJb5S0kvkDZUODXI9NZuC28QZX8bEgsogi38OXY8zXOZuPRZMY9 HpOGxlKk4MJXEOWLKwZ79g7dm3dgqmR5npOvvSDiIbsl+uShatbfXvwU3epEoeczs7YF aj+bEQVY358GDnOeCGoAKg8GP+Cj7r4ubyL9FDyzT+Wz99CxoJ+JFocBVntCk/Pn+8k4 mGoYoccINpkuTqtEQhgsaSthIz5aRLKGxdduI14KQk5nHYkhcK8UmSU5IPCJjs39JPEm MKiA== 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:mime-version :content-transfer-encoding; bh=d++YfUrdvZ/z/Dy3UUqE/SCSpYpGD+ICodBS2vX78Ow=; b=OsSJe6Bfntekee9GcWDth5qH+wSqn55nLfpO063R02e62iw8JoUh1XJlnkYN49uVUP N1dKArS2bmpfLddHJRyhJHdkpx5qcGmgDIde2gRyDRzOoW0ttEomGpQjqlQeerLOHwY9 UpDgOUKXnGH1BcsjaMO2VQi5dIFqTNO8nUFL4hW6oGFnTCkyj7r/0xiPb2/wFTG0oLZv Vz4rKyYPXZj+cwIIkvaUo1ntJK+N/RZ5sxnsZj3dY7m+X9XnpoeS/F7Icpus8AO7zX8X t2dp78m/iTcot9oSGaXHSUhpuniBgsWGkuGLl0+BhDEqAX/jjT9fMQVWFqbPvzXIqSkv HUbA== X-Gm-Message-State: AA+aEWbZUkNAvYzZbjsO/qlwD4zcoWO1gTCwq0nJCFw31iKSysWyfVwX Aio9KyFvO+wyXzNC4SHCsRR0YlOJ X-Google-Smtp-Source: AFSGD/WAXlxoCdZXwX3DO/nn/suXUyA9G/LzSIXdufxaPwEpXQvdmXjzy69xnA/ixk1tetgFRNBc1g== X-Received: by 2002:a5d:6889:: with SMTP id h9mr7370931wru.222.1543650806574; Fri, 30 Nov 2018 23:53:26 -0800 (PST) Received: from localhost.localdomain (ipbcc08c44.dynamic.kabel-deutschland.de. [188.192.140.68]) by smtp.googlemail.com with ESMTPSA id j199sm4542704wmf.13.2018.11.30.23.53.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 30 Nov 2018 23:53:25 -0800 (PST) From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Sat, 1 Dec 2018 08:52:54 +0100 Message-Id: <20181201075255.2608-1-andreas.rheinhardt@googlemail.com> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 1/2] cbs_h265: Fix Time Code SEI syntax 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" Signed-off-by: Andreas Rheinhardt --- https://trac.ffmpeg.org/ticket/4141#comment:9 contains a sample containing Time Code SEI messages. Parsing it currently fails because counting_type is detected as out of range. Of course, it is not. libavcodec/cbs_h265_syntax_template.c | 56 ++++++++++++++------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c index 0a430df23a..f1e1bb0e7e 100644 --- a/libavcodec/cbs_h265_syntax_template.c +++ b/libavcodec/cbs_h265_syntax_template.c @@ -1955,36 +1955,40 @@ static int FUNC(sei_time_code)(CodedBitstreamContext *ctx, RWContext *rw, u(2, num_clock_ts, 1, 3); for (i = 0; i < current->num_clock_ts; i++) { - flags(units_field_based_flag[i], 1, i); - us(5, counting_type[i], 0, 6, 1, i); - flags(full_timestamp_flag[i], 1, i); - flags(discontinuity_flag[i], 1, i); - flags(cnt_dropped_flag[i], 1, i); - - us(9, n_frames[i], 0, MAX_UINT_BITS(9), 1, i); - - if (current->full_timestamp_flag[i]) { - us(6, seconds_value[i], 0, 59, 1, i); - us(6, minutes_value[i], 0, 59, 1, i); - us(5, hours_value[i], 0, 23, 1, i); - } else { - flags(seconds_flag[i], 1, i); - if (current->seconds_flag[i]) { + flags(clock_timestamp_flag[i], 1, i); + + if (current->clock_timestamp_flag[i]) { + flags(units_field_based_flag[i], 1, i); + us(5, counting_type[i], 0, 6, 1, i); + flags(full_timestamp_flag[i], 1, i); + flags(discontinuity_flag[i], 1, i); + flags(cnt_dropped_flag[i], 1, i); + + us(9, n_frames[i], 0, MAX_UINT_BITS(9), 1, i); + + if (current->full_timestamp_flag[i]) { us(6, seconds_value[i], 0, 59, 1, i); - flags(minutes_flag[i], 1, i); - if (current->minutes_flag[i]) { - us(6, minutes_value[i], 0, 59, 1, i); - flags(hours_flag[i], 1, i); - if (current->hours_flag[i]) - us(5, hours_value[i], 0, 23, 1, i); + us(6, minutes_value[i], 0, 59, 1, i); + us(5, hours_value[i], 0, 23, 1, i); + } else { + flags(seconds_flag[i], 1, i); + if (current->seconds_flag[i]) { + us(6, seconds_value[i], 0, 59, 1, i); + flags(minutes_flag[i], 1, i); + if (current->minutes_flag[i]) { + us(6, minutes_value[i], 0, 59, 1, i); + flags(hours_flag[i], 1, i); + if (current->hours_flag[i]) + us(5, hours_value[i], 0, 23, 1, i); + } } } - } - us(5, time_offset_length[i], 0, 31, 1, i); - if (current->time_offset_length[i] > 0) - us(current->time_offset_length[i], time_offset_value[i], - 0, MAX_UINT_BITS(current->time_offset_length[i]), 1, i); + us(5, time_offset_length[i], 0, 31, 1, i); + if (current->time_offset_length[i] > 0) + us(current->time_offset_length[i], time_offset_value[i], + 0, MAX_UINT_BITS(current->time_offset_length[i]), 1, i); + } } return 0;