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 DA4A343EB1 for ; Tue, 18 Oct 2022 12:40:08 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7A16268BDA5; Tue, 18 Oct 2022 15:38:34 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 21AF568BD23 for ; Tue, 18 Oct 2022 15:38:21 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id 0FBB32406CF for ; Tue, 18 Oct 2022 14:38:20 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id cWmmY577YSan for ; Tue, 18 Oct 2022 14:38:19 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id DE119240706 for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id E6DE43A0922 for ; Tue, 18 Oct 2022 14:38:13 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Tue, 18 Oct 2022 14:37:00 +0200 Message-Id: <20221018123701.25002-19-anton@khirnov.net> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20221018123701.25002-1-anton@khirnov.net> References: <20221018123701.25002-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 19/20] fftools/ffmpeg_demux: stop modifying OptionsContext 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 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: It should be input-only to this code. --- fftools/ffmpeg_demux.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/fftools/ffmpeg_demux.c b/fftools/ffmpeg_demux.c index 29cff4b471..4ce92862cb 100644 --- a/fftools/ffmpeg_demux.c +++ b/fftools/ffmpeg_demux.c @@ -772,18 +772,23 @@ int ifile_open(OptionsContext *o, const char *filename) char * data_codec_name = NULL; int scan_all_pmts_set = 0; - if (o->stop_time != INT64_MAX && o->recording_time != INT64_MAX) { - o->stop_time = INT64_MAX; + int64_t start_time = o->start_time; + int64_t start_time_eof = o->start_time_eof; + int64_t stop_time = o->stop_time; + int64_t recording_time = o->recording_time; + + if (stop_time != INT64_MAX && recording_time != INT64_MAX) { + stop_time = INT64_MAX; av_log(NULL, AV_LOG_WARNING, "-t and -to cannot be used together; using -t.\n"); } - if (o->stop_time != INT64_MAX && o->recording_time == INT64_MAX) { - int64_t start_time = o->start_time == AV_NOPTS_VALUE ? 0 : o->start_time; - if (o->stop_time <= start_time) { + if (stop_time != INT64_MAX && recording_time == INT64_MAX) { + int64_t start = start_time == AV_NOPTS_VALUE ? 0 : start_time; + if (stop_time <= start) { av_log(NULL, AV_LOG_ERROR, "-to value smaller than -ss; aborting.\n"); exit_program(1); } else { - o->recording_time = o->stop_time - start_time; + recording_time = stop_time - start; } } @@ -908,32 +913,32 @@ int ifile_open(OptionsContext *o, const char *filename) } } - if (o->start_time != AV_NOPTS_VALUE && o->start_time_eof != AV_NOPTS_VALUE) { + if (start_time != AV_NOPTS_VALUE && start_time_eof != AV_NOPTS_VALUE) { av_log(NULL, AV_LOG_WARNING, "Cannot use -ss and -sseof both, using -ss for %s\n", filename); - o->start_time_eof = AV_NOPTS_VALUE; + start_time_eof = AV_NOPTS_VALUE; } - if (o->start_time_eof != AV_NOPTS_VALUE) { - if (o->start_time_eof >= 0) { + if (start_time_eof != AV_NOPTS_VALUE) { + if (start_time_eof >= 0) { av_log(NULL, AV_LOG_ERROR, "-sseof value must be negative; aborting\n"); exit_program(1); } if (ic->duration > 0) { - o->start_time = o->start_time_eof + ic->duration; - if (o->start_time < 0) { + start_time = start_time_eof + ic->duration; + if (start_time < 0) { av_log(NULL, AV_LOG_WARNING, "-sseof value seeks to before start of file %s; ignored\n", filename); - o->start_time = AV_NOPTS_VALUE; + start_time = AV_NOPTS_VALUE; } } else av_log(NULL, AV_LOG_WARNING, "Cannot use -sseof, duration of %s not known\n", filename); } - timestamp = (o->start_time == AV_NOPTS_VALUE) ? 0 : o->start_time; + timestamp = (start_time == AV_NOPTS_VALUE) ? 0 : start_time; /* add the stream start time */ if (!o->seek_timestamp && ic->start_time != AV_NOPTS_VALUE) timestamp += ic->start_time; /* if seeking requested, we execute it */ - if (o->start_time != AV_NOPTS_VALUE) { + if (start_time != AV_NOPTS_VALUE) { int64_t seek_timestamp = timestamp; if (!(ic->iformat->flags & AVFMT_SEEK_TO_PTS)) { @@ -968,8 +973,8 @@ int ifile_open(OptionsContext *o, const char *filename) f->ctx = ic; f->index = nb_input_files - 1; f->ist_index = nb_input_streams - ic->nb_streams; - f->start_time = o->start_time; - f->recording_time = o->recording_time; + f->start_time = start_time; + f->recording_time = recording_time; f->input_sync_ref = o->input_sync_ref; f->input_ts_offset = o->input_ts_offset; f->ts_offset = o->input_ts_offset - (copy_ts ? (start_at_zero && ic->start_time != AV_NOPTS_VALUE ? ic->start_time : 0) : timestamp); -- 2.35.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".