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 16AEE47252 for ; Sat, 2 Sep 2023 15:21:15 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7FAC568C810; Sat, 2 Sep 2023 18:19:53 +0300 (EEST) Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id A21FE68C7DF for ; Sat, 2 Sep 2023 18:19:48 +0300 (EEST) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-401b0d97850so485535e9.2 for ; Sat, 02 Sep 2023 08:19:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693667987; x=1694272787; darn=ffmpeg.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TiuioRK69WMnvph+BIXBPdqlB7K7prjD/Hcq0NcIt1U=; b=CFP4TxHaRV1ZGsJlB6xSTZMUTp/PDJGSUuY4gY/1LFb2qTnezTtwSP9rhsrX179cpl I9ZDBSZA2cnNQEPgHbNJGT/vk2zU70AvpOLZDd74G2rK70azTBBu6nsbu7a/NOAhMWl4 ITnp0RBL9DLLLSuCZOMSIXRqF8sqC88RebWJgQlGWfAE6bmkW5/FiVrV6XqwsmgH0/8X sU/71KFA/Loy8NftHOlpX1RZCfm1otduN3N0Scu0oKitXKA/LlvhFazN1M1vxMeUK4c/ poiXcRag4qTqawITNr4etmBy7BG2mDOLWc/QV8m35n6kSCHkGEdmLL4OK2ZfpBHaOuoP aRYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693667987; x=1694272787; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TiuioRK69WMnvph+BIXBPdqlB7K7prjD/Hcq0NcIt1U=; b=KJHSBhFTphpUkOiQd9dQk6wdKrCpUzXyiKkVcxAKyyiUYvVryToGp30HD7fHGvR3RC cFAhlMwvTpjHLFkNoip9aLJhLxxqYPYf5webUE7Ddkg0u2PlWnhzLD3ZsP2PbA8F37Zf pz0grriJ42cZrifrL/v7B+GJVlXAKgO5f75jLXJvLLc1NsufHIEWBVTa840WmEOwzT4k 8VeQJvHIC+aQKBhdYHoq11jYruGKncC40roc0bd7145QHViB+b+HDad7p8gWlU56QE0m WpN9B8C3Q1Knet9gn21CtxWtvZLWqw8tyc78s9f99Eda/lIZYA9HpX/W76/c8HjavHh7 WfSw== X-Gm-Message-State: AOJu0YxUQBWfI6PER8p21gouTbW6Tl5J1X0tfDvTJ9WwYQTn+h6lL0DL i/yYe1qxSiBYweWnq5m9NCTYjikUvuU= X-Google-Smtp-Source: AGHT+IG8dT7+Uq6ZOaJguPRilc+8K6cSFiYOInF2x+7MoM2AauSI0UWKqA2t1kzPnvXsx/X1fK4I9A== X-Received: by 2002:a05:600c:446:b0:3fd:2e1d:eca1 with SMTP id s6-20020a05600c044600b003fd2e1deca1mr4191841wmb.4.1693667986705; Sat, 02 Sep 2023 08:19:46 -0700 (PDT) Received: from mariano ([82.84.194.139]) by smtp.gmail.com with ESMTPSA id y11-20020a1c4b0b000000b003fe2b081661sm11295277wma.30.2023.09.02.08.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 08:19:41 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id 640B4BFCF0; Sat, 2 Sep 2023 17:19:31 +0200 (CEST) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sat, 2 Sep 2023 17:19:21 +0200 Message-Id: <20230902151921.1712373-12-stefasab@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230902151921.1712373-1-stefasab@gmail.com> References: <20230902151921.1712373-1-stefasab@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 11/11] doc/examples/transcode: fix selection of sample format if not set in encoder 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: Stefano Sabatini 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: Fix crash occurring when the list of sample formats is not defined in the encoder, use the decoder one in that case. Possibly fix issue: http://trac.ffmpeg.org/ticket/5849 --- doc/examples/transcode.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 1d22a4b09e..3c72b9377e 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -189,8 +189,10 @@ static int open_output_file(const char *filename) ret = av_channel_layout_copy(&enc_ctx->ch_layout, &dec_ctx->ch_layout); if (ret < 0) return ret; - /* take first format from list of supported formats */ - enc_ctx->sample_fmt = encoder->sample_fmts[0]; + + /* take first format from list of supported formats or use decoder one */ + enc_ctx->sample_fmt = encoder->sample_fmts ? encoder->sample_fmts[0] : dec_ctx->sample_fmt; + enc_ctx->time_base = (AVRational){1, enc_ctx->sample_rate}; } -- 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".