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 3E4EE46A4F for ; Fri, 1 Sep 2023 23:15:10 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id DB24D68C775; Sat, 2 Sep 2023 02:14:58 +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 7D02C68C59E for ; Sat, 2 Sep 2023 02:14:51 +0300 (EEST) Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-400a087b0bfso24662505e9.2 for ; Fri, 01 Sep 2023 16:14:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1693610090; x=1694214890; 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=MVyjAquE8UNzjCxsb1LKex7FACMxT53shr3AmEKDww8=; b=lYABvVd5oaRc117l/XcQu/2dk9V/4LZM8ZaeUGpJGWI5dL1CYX/rqmmUqai3XhSNRf +wnAS6FLkRTIZvuDA+LF7O4OUUx9kQ4e2yW7onbsslmM2JEgjgOY3tSdsEJBWX/uKTBW 3LSvxI0BgTefhbe1ZnUtkKKsbal4TvXa60TnDERsfz81WLfPXSch/jBT81S538fxo7D6 VVUmbiJk/yUQRrX+lfTIDYTU03Oj+O6OZeWmY1DXibQvyX8XBlDp+e6b/gDVUkFbY7co aiVV1QZ0LHsfERrPyvA3Orc0V96amomRnqDIFoZ72rbvlR+F7s/9SOJvaypRhu5XGIEN wYDw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1693610090; x=1694214890; 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=MVyjAquE8UNzjCxsb1LKex7FACMxT53shr3AmEKDww8=; b=ME1oqJ/CeQ40YUVQ8RMg7ZwdHTm1HuSu/nYLaZW6SOZ11KVtdiTnuF0RabsfQ9dicC 9TqzbQKvru7Qql1hTJU0yZK2pKBGZ+nnfGhh+pdseDWHSfPGOBsqjDvyDmIuv9FHaUIw doS25/iptBqioH6+m1MNBucCzzIVNcbYoEe5BZFHZIaBq3zJpZJy3XxBETaXLzT/NUGm +n+IRXsHcyO3NO5iLb4nyhA9/p6Cu1OBp9lOe2UmrM3PO1LiFVfCwpS8HehNN8o7bhcT c7msHcHdpFntd9JBOnC20UuyKNZDbLeBdRbLFbI4p/3kx7wPZYzU0qC+3TbSdLt85JsL YDcA== X-Gm-Message-State: AOJu0Yx9T4FJtanZSGMudIWD5CD2MFGVOyXqhIu5CfNwtHjKf26Y912H 0WqVP0bYl+y0szak3FPLh4JoNxGvBFU= X-Google-Smtp-Source: AGHT+IG6RNxikbWVn2J5BFhjGQRnrUC9UpKWVMGGNYAkTqbAXgMvvKePQKt0w336m7uicJyEl45ULQ== X-Received: by 2002:a7b:cb9a:0:b0:401:b53e:6c58 with SMTP id m26-20020a7bcb9a000000b00401b53e6c58mr2641473wmi.26.1693610089649; Fri, 01 Sep 2023 16:14:49 -0700 (PDT) Received: from mariano ([82.84.194.139]) by smtp.gmail.com with ESMTPSA id 17-20020a05600c021100b003fefca26c72sm6180053wmi.23.2023.09.01.16.14.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 01 Sep 2023 16:14:48 -0700 (PDT) Received: by mariano (Postfix, from userid 1000) id 6DEA0BFCDE; Sat, 2 Sep 2023 01:14:47 +0200 (CEST) From: Stefano Sabatini To: FFmpeg development discussions and patches Date: Sat, 2 Sep 2023 01:14:44 +0200 Message-Id: <20230901231447.1486347-3-stefasab@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230901231447.1486347-1-stefasab@gmail.com> References: <20230901231447.1486347-1-stefasab@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/6] doc/examples/transcode: factorize codec_type definition 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: --- doc/examples/transcode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/doc/examples/transcode.c b/doc/examples/transcode.c index 9af5674953..1ec4a3c230 100644 --- a/doc/examples/transcode.c +++ b/doc/examples/transcode.c @@ -82,6 +82,7 @@ static int open_input_file(const char *filename) AVStream *stream = ifmt_ctx->streams[i]; const AVCodec *dec = avcodec_find_decoder(stream->codecpar->codec_id); AVCodecContext *codec_ctx; + enum AVMediaType codec_type; if (!dec) { av_log(NULL, AV_LOG_ERROR, "Failed to find decoder for stream #%u\n", i); @@ -105,11 +106,13 @@ static int open_input_file(const char *filename) /* Inform the decoder about the timebase for the packet timestamps. * This is highly recommended, but not mandatory. */ codec_ctx->pkt_timebase = stream->time_base; + codec_type = codec_ctx->codec_type; /* Reencode video & audio and remux subtitles etc. */ - if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO || codec_ctx->codec_type == AVMEDIA_TYPE_AUDIO) { - if (codec_ctx->codec_type == AVMEDIA_TYPE_VIDEO) + if (codec_type == AVMEDIA_TYPE_VIDEO || codec_type == AVMEDIA_TYPE_AUDIO) { + if (codec_type == AVMEDIA_TYPE_VIDEO) codec_ctx->framerate = av_guess_frame_rate(ifmt_ctx, stream, NULL); + /* Open decoder */ ret = avcodec_open2(codec_ctx, dec, NULL); if (ret < 0) { -- 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".