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 75DC647254 for ; Sat, 2 Sep 2023 15:20:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5A70F68C7F0; Sat, 2 Sep 2023 18:19:50 +0300 (EEST) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6E71A68C7BB for ; Sat, 2 Sep 2023 18:19:46 +0300 (EEST) Received: by mail-wr1-f46.google.com with SMTP id ffacd0b85a97d-31ae6bf91a9so2511488f8f.2 for ; Sat, 02 Sep 2023 08:19:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693667985; x=1694272785; 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=DODfSd3CyBS4rxIoUggJVmRhc5p6zBdTqGXyhJmoXo0=; b=MmsmbzZ4pUjpVtCYQxPN0qp3RGcM7CmWgatu1MI22NQFekvpaunZ9qgxIJFtkIQYqv w8p1qKyRPw44XYVZyfgPq4QofLusV9a7AhnnKf3e5V8pBVzh3aiiFgqW1IaJgHUxHdHG UtCUIFdTLSmnUrT1ros+uZ70XP8rWsGov60v0gCW/fjaO+o0ES8GaIEThLxNUdlEldjw 3GaoLUDCdqEL6Ruwp04G2szJO7V93rJi1Gu3vDffzWuD2YBhzKwRfpMH9lZs/iWM+ScM BryB3KXJ2i2nyUKC7vjQK49sap7b35kV1ygAXl3n96k5JCBnNGiBzIFEprv127W6IKyq e3oQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693667985; x=1694272785; 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=DODfSd3CyBS4rxIoUggJVmRhc5p6zBdTqGXyhJmoXo0=; b=YatRgSROSM/KZN18MA8Eu0cpL88WLsXlCPYboKSJkso7gerFyWAifxJOpciu6t7HK4 R337DzsUOPC4FLx4gJDquM+SqnYhJWKA/4e2BK9ilavtsNwQqaYgn4/C4CAgyDGHGtGT QWRKCUtWsv3K3xJS4tDZ+OImWocA8JOYFQX0Y4em9ydABncrTT0SELBPHyAn2aMNX1Pz 2JMAqr5AjtN9r4wznJWlwsd05rdnEkgX0I0UaY9VJoDU911GxpwWzFtJb7PmAwjZJa0L UQjggKTGcn9VTA8fV42kGsXOOkbUfbUlpGr7pmvLvOAWsm0/CHwVs/sihuwLXC130tV0 MHhA== X-Gm-Message-State: AOJu0Yw1meukNG6ZiAiiF//u1UEe7MtdZEIHOonAd6Xa2piItbT57EDr jmujyyyGl/gvFocSqZB44fW0uDj4DwM= X-Google-Smtp-Source: AGHT+IFECoVzrdhZHSngGWObkY9S+Assiii6b+J/wrqV+fGD7EBybHpAGckdbKfjbzOgI5pV/R0PAw== X-Received: by 2002:adf:f512:0:b0:31a:c6ef:5edc with SMTP id q18-20020adff512000000b0031ac6ef5edcmr3847425wro.12.1693667984925; Sat, 02 Sep 2023 08:19:44 -0700 (PDT) Received: from mariano ([82.84.194.139]) by smtp.gmail.com with ESMTPSA id x9-20020adfdd89000000b003196b1bb528sm8876044wrl.64.2023.09.02.08.19.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Sep 2023 08:19:37 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id 60669BFCEE; 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:20 +0200 Message-Id: <20230902151921.1712373-11-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 10/11] doc/examples/transcode: simplify selection of pix_fmt 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: Use ternary operator. --- doc/examples/transcode.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 524bb47f50..1d22a4b09e 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -178,11 +178,10 @@ static int open_output_file(const char *filename) enc_ctx->height = dec_ctx->height; enc_ctx->width = dec_ctx->width; enc_ctx->sample_aspect_ratio = dec_ctx->sample_aspect_ratio; - /* take first format from list of supported formats */ - if (encoder->pix_fmts) - enc_ctx->pix_fmt = encoder->pix_fmts[0]; - else - enc_ctx->pix_fmt = dec_ctx->pix_fmt; + + /* take first format from list of supported formats or use decoder one */ + enc_ctx->pix_fmt = encoder->pix_fmts ? encoder->pix_fmts[0] : dec_ctx->pix_fmt; + /* video time_base can be set to whatever is handy and supported by encoder */ enc_ctx->time_base = av_inv_q(dec_ctx->framerate); } else { -- 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".