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 E4378493B6 for ; Fri, 9 Feb 2024 11:04:54 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id F342F68D0F2; Fri, 9 Feb 2024 13:04:50 +0200 (EET) Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2882D68C7C2 for ; Fri, 9 Feb 2024 13:04:45 +0200 (EET) Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2d0d799b55cso12031011fa.0 for ; Fri, 09 Feb 2024 03:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=martin-st.20230601.gappssmtp.com; s=20230601; t=1707476684; x=1708081484; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=CNCAYBCkGcvsL+6gCyPfAuMYVKq3UgdsWa4Ud2QYajw=; b=hJK5Ab3KeogqFOAjcgLvItlH2VLQehuwPtQLgoHrJChLRcZJpDeY4helAa7xFOwiA+ AWfkcIcDaKD7zux74UXyFbjBe68+OFwIj/5qkVf4SIhBJeLc7Vt1aK+pNbvLQ9dLh74/ bTkN/vRYr1/2thOeMSeU3GBf13dCwbXEG5ZboNlQyuHhFQKCY+Qz4b8FlvQskzzN5byP viEuTlF+Grv7fihxLiOTuOZmiX+OjwfgS5/RvnbgfY41MCJ05PbFONOPdfaEcyonSmSi kwM6eLGF9kzRv31Fa6tMXJxjyZfKo5Ld9c+kn64Dje1iM8EsZzrxowUOVlNfzBAL3trU neMA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707476684; x=1708081484; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CNCAYBCkGcvsL+6gCyPfAuMYVKq3UgdsWa4Ud2QYajw=; b=hCrxd9oHV1sUB+qJRP+LwxoVnILeTcAcv+szsb6jVaZAQjURFTbq1jj+zmih+794zc dRxGrRLpZefyfPZ9C0HftYsTI451GLfr6ddhoLBZuG6UPXwccLAGIiaccdwNa8ytiNIK s++OlQdtWK8IRodVxBLoP+BaOqaZwZJ5snhDZw3GAm50RtlKZjtLHOnZieKkRLpASlnj EnpepI9AIm9Fv0Uyrb74LOuu50o9Ispg1Gz6RV5b/I+J8huw91+h9ELdIVBeCS3hGMk2 hJo+JflTvVh+GE4+2K1XtmrpyAvvo1j1E+RK3GMr2l2dtsHKZJYkxXPeHUU5BB+iid2V 90ZQ== X-Gm-Message-State: AOJu0YwROeMrYOEc/s/7WV2TE2V5NDlvVherlmUfItGBl0fssi4F8QWL kXTgjpZuiM1RkiJMap9h767hG6b9puQo2UPATkRSfUTvRxFPh/0kmh4M+axBFvRpb56Vnx6wmQ4 /1A== X-Google-Smtp-Source: AGHT+IFxgDoL2sU13Uxc7xht6IymF1T+u2kOO5vt7fcWoUzCSw8AtFKY7SbRnkUQB59epvrrGavkKQ== X-Received: by 2002:ac2:4141:0:b0:511:7abf:45f with SMTP id c1-20020ac24141000000b005117abf045fmr517432lfi.63.1707476684092; Fri, 09 Feb 2024 03:04:44 -0800 (PST) Received: from localhost (dsl-tkubng21-58c01c-243.dhcp.inet.fi. [88.192.28.243]) by smtp.gmail.com with ESMTPSA id s6-20020a056512202600b0051157349af8sm256610lfs.198.2024.02.09.03.04.43 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 09 Feb 2024 03:04:43 -0800 (PST) From: =?UTF-8?q?Martin=20Storsj=C3=B6?= To: ffmpeg-devel@ffmpeg.org Date: Fri, 9 Feb 2024 13:04:43 +0200 Message-Id: <20240209110443.60688-1-martin@martin.st> X-Mailer: git-send-email 2.39.3 (Apple Git-145) MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH] flvdec: Honor the "flv_metadata" option for the "datastream" metadata field 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: By default the option "flv_metadata" (internally using the field name "trust_metadata") is set to 0, meaning that we don't allocate streams based on information in the metadata, only based on actual streams we encounter. However the "datastream" metadata field still would allocate a subtitle stream. When muxing, the "datastream" field is added if either a data stream or subtitle stream is present - but the same metadata field is used to preemtively create a subtitle stream only. Thus, if the field was added due to a data stream, not a subtitle stream, the demuxer would create a stream which won't get any actual packets. If there was such an extra, empty subtitle stream, running avformat_find_stream_info still used to terminate within reasonable time before 3749eede66c3774799766b1f246afae8a6ffc9bb. After that commit, it no longer would terminate until it reaches the max analyze duration, which is 90 seconds for flv streams (see e6a084641aada7a2e4672172f2ee26642800a361, 24fdf7334d2bb9aab0abdbc878b8ae51eb57c86b and f58e011a1f30332ba824c155078ca701e29aef63). Before that commit (which removed the deprecated AVStream.codec), the "st->codecpar->codec_id = AV_CODEC_ID_TEXT", set within the demuxer, would get propagated into st->codec->codec_id by numerous avcodec_parameters_to_context(st->codec, st->codecpar), then further into st->internal->avctx->codec_id by update_stream_avctx within read_frame_internal in libavformat/utils.c (demux.c these days). --- libavformat/flvdec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libavformat/flvdec.c b/libavformat/flvdec.c index e25b5bd163..d898341871 100644 --- a/libavformat/flvdec.c +++ b/libavformat/flvdec.c @@ -627,12 +627,7 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, else if (!strcmp(key, "audiodatarate") && 0 <= (int)(num_val * 1024.0)) flv->audio_bit_rate = num_val * 1024.0; - else if (!strcmp(key, "datastream")) { - AVStream *st = create_stream(s, AVMEDIA_TYPE_SUBTITLE); - if (!st) - return AVERROR(ENOMEM); - st->codecpar->codec_id = AV_CODEC_ID_TEXT; - } else if (!strcmp(key, "framerate")) { + else if (!strcmp(key, "framerate")) { flv->framerate = av_d2q(num_val, 1000); if (vstream) vstream->avg_frame_rate = flv->framerate; @@ -654,6 +649,11 @@ static int amf_parse_object(AVFormatContext *s, AVStream *astream, vpar->width = num_val; } else if (!strcmp(key, "height") && vpar) { vpar->height = num_val; + } else if (!strcmp(key, "datastream")) { + AVStream *st = create_stream(s, AVMEDIA_TYPE_SUBTITLE); + if (!st) + return AVERROR(ENOMEM); + st->codecpar->codec_id = AV_CODEC_ID_TEXT; } } } -- 2.39.3 (Apple Git-145) _______________________________________________ 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".