From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id F09F64559D for ; Tue, 2 Jul 2024 03:05:39 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0110B68D8AA; Tue, 2 Jul 2024 06:05:37 +0300 (EEST) Received: from mail-qk1-f227.google.com (mail-qk1-f227.google.com [209.85.222.227]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E4FB68CF1F for ; Tue, 2 Jul 2024 06:05:30 +0300 (EEST) Received: by mail-qk1-f227.google.com with SMTP id af79cd13be357-79c06a06a8eso238584985a.0 for ; Mon, 01 Jul 2024 20:05:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=proxyid.net; s=google; t=1719889529; x=1720494329; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=W3LPU4jg22B20r3wG+W8eGFSklKkPorh9rJDaTeLGhE=; b=gxMHKaABGBYOhesjasA1vVVYLdPEQmNE+0GoNsbpMDgPFzeIHW0vPNyK+5G5LNgu6a ImGo4wnQZf6EQLIX6dvFYr4hFWEvrjvIfqVFWGIjASpCgWeLMBJduIo4XO0ul8vM52/r wMkDDbpNV1sk2TVnjYNuIcdE09F5mOG/8LUMUJig/j/UP6vizDoVWaeVpORk87f/QZTK NcCVIraxOzetQ9Z3StFjjgnVIIQ2vPvNbz8hdMwz4Qw062VW0CdCpBFKZOg7eIxg3DM6 3u90LtSHF+6A6IjpIHrHW5RQQoOXN1NE1QlOn5CWDg1Ft9ARaa0PcqnI5CvNdDl7MmZv akIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719889529; x=1720494329; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=W3LPU4jg22B20r3wG+W8eGFSklKkPorh9rJDaTeLGhE=; b=QdpS0kvM9s4XEx4285RzPfMaX878vkvJ5Yly+NZptORn9mgoFZwVCecxawEE0YfyZi yakzZLS+wfm1k/2er0oRriNmu5hgTrCA9JHNrAmhisrwOeDnkM8CG6N47xHyxmV9dPfW VOBuOn+P5RspoXjyupESVJjFvcUjT8pEK9WKS8B0GSNqXXebsjOSoWA/dtBT9iBwGDVH 0mPaGLuCbMuJ24xL5rDUpIDV4Posnu5mbQMn3WuAj4nC/sQpan+eIxz7d36YUbd3vEQa awOpEnUQ5Puk5xXn7qYPDJjMsLxYewsKEEr7g9WTwSbYGBrTkWydNryvOXWcGOWtWhch bDbQ== X-Gm-Message-State: AOJu0YxOteBZDWATsBrAHcwpAH///tAsGwH384BPsFLtdf2120xKBaob CuM+MFsuKlWqQGfEV3niWW5LgJycfX/xvqMVn7kOme+Z4CfKZjvlKwzWqiQYg2Yaz69+zCqwkPV WfOiibbpdcRrRoOv6NKiCBgt/Y7lWggsXZm1armlt X-Google-Smtp-Source: AGHT+IFPD9Sso7WcgyIY/Iwz5U7I54v/4brKRuumj5lv27Ucc96opX164iNcnO98LniFKMfGYF5pC/wNCst+ X-Received: by 2002:a05:6214:238a:b0:6b4:f888:ebb5 with SMTP id 6a1803df08f44-6b5b7055f61mr78986626d6.9.1719889528997; Mon, 01 Jul 2024 20:05:28 -0700 (PDT) Received: from wsx-cc1-001.. (c-76-136-218-80.hsd1.il.comcast.net. [76.136.218.80]) by smtp-relay.gmail.com with ESMTPS id 6a1803df08f44-6b59e5d9cb7sm4271786d6.59.2024.07.01.20.05.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Jul 2024 20:05:28 -0700 (PDT) X-Relaying-Domain: proxyid.net From: Marth64 To: ffmpeg-devel@ffmpeg.org Date: Mon, 1 Jul 2024 22:05:26 -0500 Message-Id: <20240702030526.1288022-1-marth64@proxyid.net> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH v3] avformat/dvdvideodec: Fix incorrect padding cell trim logic 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: Marth64 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: When -trim option is used (by default), padding cells at the beginning of the title are supposed to be ignored. The current implementation does the ignoring after we have locked on to the PGC navigation event stream, but does not set the PGC/PG state properly. This causes false positives and errors on some discs due to a search for a program stream cell that never succeeds. User would have to know to disable the -trim option to work around the issue. Simplify the logic and move it to the NAV packet event handling, in turn implementing the behaviour correctly and fixing the trim function for impacted discs. Signed-off-by: Marth64 --- libavformat/dvdvideodec.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/libavformat/dvdvideodec.c b/libavformat/dvdvideodec.c index e7132725b7..f5b7dd33e5 100644 --- a/libavformat/dvdvideodec.c +++ b/libavformat/dvdvideodec.c @@ -624,7 +624,6 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState dvdnav_vts_change_event_t *e_vts; dvdnav_cell_change_event_t *e_cell; int cur_title, cur_pgcn, cur_pgn, cur_angle, cur_title_unused, cur_ptt, cur_nb_angles; - int is_cell_promising = 0; pci_t *e_pci; dsi_t *e_dsi; @@ -706,23 +705,17 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState continue; e_cell = (dvdnav_cell_change_event_t *) nav_buf; - is_cell_promising = !c->opt_trim || dvdvideo_is_cell_promising(s, state->pgc, e_cell->cellN); - av_log(s, AV_LOG_DEBUG, "new cell: prev=%d new=%d promising=%d\n", - state->celln, e_cell->cellN, is_cell_promising); + av_log(s, AV_LOG_DEBUG, "new cell: prev=%d new=%d\n", state->celln, e_cell->cellN); if (!state->in_ps && !state->in_pgc) { if (cur_title == c->opt_title && (c->opt_pgc || cur_ptt == c->opt_chapter_start) && cur_pgcn == state->pgcn && - cur_pgn == state->entry_pgn && - is_cell_promising) { + cur_pgn == state->entry_pgn) { state->in_pgc = 1; } - - if (c->opt_trim && !is_cell_promising) - av_log(s, AV_LOG_INFO, "Skipping padding cell #%d\n", e_cell->cellN); } else if (state->celln >= e_cell->cellN || state->pgn > cur_pgn) { return AVERROR_EOF; } @@ -766,6 +759,13 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState e_pci->pci_gi.nv_pck_lbn, state->vobu_duration, state->nav_pts); if (!state->in_ps) { + if (c->opt_trim && !dvdvideo_is_cell_promising(s, state->pgc, state->celln)) { + av_log(s, AV_LOG_INFO, "Skipping padding cell #%d\n", state->celln); + + i = 0; + continue; + } + av_log(s, AV_LOG_DEBUG, "navigation: locked to program stream\n"); state->in_ps = 1; @@ -784,11 +784,8 @@ static int dvdvideo_play_next_ps_block(AVFormatContext *s, DVDVideoPlaybackState return nav_len; case DVDNAV_BLOCK_OK: - if (!state->in_ps) { - if (state->in_pgc) - i = 0; /* necessary in case we are skipping junk cells at the beginning */ + if (!state->in_ps) continue; - } if (nav_len != DVDVIDEO_BLOCK_SIZE) { av_log(s, AV_LOG_ERROR, "Invalid MPEG block size (expected=%d actual=%d)\n", -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".