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 4BF9842EDA for ; Sat, 8 Jul 2023 19:01:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 299F868C536; Sat, 8 Jul 2023 22:01:05 +0300 (EEST) Received: from mail-ot1-f47.google.com (mail-ot1-f47.google.com [209.85.210.47]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 33DDA68C50B for ; Sat, 8 Jul 2023 22:00:57 +0300 (EEST) Received: by mail-ot1-f47.google.com with SMTP id 46e09a7af769-6b723aedd3dso2173101a34.3 for ; Sat, 08 Jul 2023 12:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1688842855; x=1691434855; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=7A45TDqM8pzgmY6T+ahTSivfxdoJPqQBU+bvqWJlA1s=; b=INEF++mpfbbYTmpWOhKpWkFBhNymQ7igbxLNfDGFMtcsp8MsStIMl6NtsCktgleZJ6 hFLFzYMinfYgkol3PbkUFqRVGL983Q2Oci5w6/Gll7JZExK+iEZIlXqL/ZlBwgxnXUAR JQNEF454mA7S+O3RqfvRxsw/a/iBj/sWuKSI6IUrtHEG3i+UNvJo+By6E70rNpnM9moG GWQJ7XuoDWtOwtw5r3D0pd6iGDq/l1tOVSQ+ydMioLHLLW4qRMHHv5GRWZkR9l5fr6QT MwNVk3T7lJCutEw9N5fY7wkg21jBCyvyet4bUa6m9ly2gCEXDRkULrLhQIi9MjUq6yFJ ErsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688842855; x=1691434855; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7A45TDqM8pzgmY6T+ahTSivfxdoJPqQBU+bvqWJlA1s=; b=SBBxtXCAIKeiYSdD0N2cEl3oUCsE2Znkbs1ld0cgTMfwQTWbwVDE6q/yoVsk0Llupt 4ZpFvSRY5nw47fw8Wo2iWITiUnFr1tHoA/GQzCohsjatdiRJbTU9jC02WOAJqPnPeI6L icQY3reHqRejTNLCTKfzVJSHjjvQIIOsfDB7V7HaYF9I+nGepi+Edq5P4RepVgu9UW7B yNn81E3W0EMy1oJSbtplwnHuRT0RI02iDJLHQu8gRUGV+gBhGquxlWopqlo+9S8QEKPd 5+jh9kxV5OBofF35eYZ6fOK3OZokrNqzhHY/+KI49Ke3eMDCxMAfUPGB4xrCn2PwGv4H +CiQ== X-Gm-Message-State: ABy/qLYw9f6OB/7viiEPnab/MNeRszf1J29nMXHp1t6Vl5zRvwuxLi6n VuEckmeXpVKvLF9RrhEoZ737oKQgWdo= X-Google-Smtp-Source: APBJJlF7hpz9apJI/I9FfLYBoTD4vflpII2CHeiRDxr0N2bcHJTCx25jxks2TxkvGHE1NqoNN2yUcw== X-Received: by 2002:a9d:7c87:0:b0:6b2:93f0:63a0 with SMTP id q7-20020a9d7c87000000b006b293f063a0mr7384225otn.19.1688842855348; Sat, 08 Jul 2023 12:00:55 -0700 (PDT) Received: from localhost.localdomain (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id p23-20020a0568301d5700b006b92c078d05sm988738oth.31.2023.07.08.12.00.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jul 2023 12:00:55 -0700 (PDT) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Sat, 8 Jul 2023 16:00:38 -0300 Message-ID: <20230708190038.24324-3-jamrial@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230708190038.24324-1-jamrial@gmail.com> References: <20230708190038.24324-1-jamrial@gmail.com> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/decode: fill missing frame fields for all decoders 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: And not just those with the old decode() API. Signed-off-by: James Almer --- libavcodec/decode.c | 52 +++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 25 deletions(-) diff --git a/libavcodec/decode.c b/libavcodec/decode.c index 49c8b7e0f4..fe07e906c2 100644 --- a/libavcodec/decode.c +++ b/libavcodec/decode.c @@ -304,22 +304,6 @@ static int discard_samples(AVCodecContext *avctx, AVFrame *frame, int64_t *disca uint8_t skip_reason = 0; uint8_t discard_reason = 0; - if (frame->format == AV_SAMPLE_FMT_NONE) - frame->format = avctx->sample_fmt; - if (!frame->ch_layout.nb_channels) - ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout); -#if FF_API_OLD_CHANNEL_LAYOUT -FF_DISABLE_DEPRECATION_WARNINGS - if (!frame->channel_layout) - frame->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? - avctx->ch_layout.u.mask : 0; - if (!frame->channels) - frame->channels = avctx->ch_layout.nb_channels; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (!frame->sample_rate) - frame->sample_rate = avctx->sample_rate; - side= av_packet_get_side_data(avci->last_pkt_props, AV_PKT_DATA_SKIP_SAMPLES, &side_size); if(side && side_size>=10) { avci->skip_samples = AV_RL32(side); @@ -452,14 +436,6 @@ FF_DISABLE_DEPRECATION_WARNINGS frame->pkt_pos = pkt->pos; FF_ENABLE_DEPRECATION_WARNINGS #endif - //FIXME these should be under if(!avctx->has_b_frames) - /* get_buffer is supposed to set frame parameters */ - if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) { - if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio; - if (!frame->width) frame->width = avctx->width; - if (!frame->height) frame->height = avctx->height; - if (frame->format == AV_PIX_FMT_NONE) frame->format = avctx->pix_fmt; - } } } emms_c(); @@ -613,8 +589,34 @@ static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) } if (!ret) { - if (avctx->codec_type != AVMEDIA_TYPE_VIDEO) + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { + /* get_buffer is supposed to set frame parameters */ + if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) { + if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio; + if (!frame->width) frame->width = avctx->width; + if (!frame->height) frame->height = avctx->height; + if (frame->format == AV_PIX_FMT_NONE) frame->format = avctx->pix_fmt; + } + } else { + if (frame->format == AV_SAMPLE_FMT_NONE) + frame->format = avctx->sample_fmt; + if (!frame->ch_layout.nb_channels) + ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout); +#if FF_API_OLD_CHANNEL_LAYOUT +FF_DISABLE_DEPRECATION_WARNINGS + if (!frame->channel_layout) + frame->channel_layout = avctx->ch_layout.order == AV_CHANNEL_ORDER_NATIVE ? + avctx->ch_layout.u.mask : 0; + if (!frame->channels) + frame->channels = avctx->ch_layout.nb_channels; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + if (!frame->sample_rate) + frame->sample_rate = avctx->sample_rate; + frame->flags |= AV_FRAME_FLAG_KEY; + } + #if FF_API_FRAME_KEY FF_DISABLE_DEPRECATION_WARNINGS frame->key_frame = !!(frame->flags & AV_FRAME_FLAG_KEY); -- 2.41.0 _______________________________________________ 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".