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 852F7463D9 for ; Tue, 16 May 2023 18:03:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id E14DA68BFFE; Tue, 16 May 2023 21:03:18 +0300 (EEST) Received: from mail-oa1-f45.google.com (mail-oa1-f45.google.com [209.85.160.45]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 2D83D68BEB9 for ; Tue, 16 May 2023 21:03:12 +0300 (EEST) Received: by mail-oa1-f45.google.com with SMTP id 586e51a60fabf-192814aa343so11450130fac.1 for ; Tue, 16 May 2023 11:03:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684260190; x=1686852190; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=PjWUWILWSoWkEQi8X+0ANyvxVRPlJaKmjmV8cTSMFR0=; b=f8Ya4lydOGUwEth57YyFQDgvaXmoBX1q2hAdV5h7q5w88HupHI1N8UtyOqngv082vG xoz7awNVeCij54xIOZa9RDlt29BuFpv6zls/wU7sTnbQj/UrbYme6vxsIUwEHZwltvp2 RGDy/MwbBoywlpal6UcIkj8JXLNRodJkrt3G6i49DaDc9ZNPAnWKMhrenLSKd9p9A8DM 62a4mZ5ivLjT8e3ELloVx1ndipes1ejl7MLJ4aoGAHIjm2BnWQCCMwerhkUPCRhji8e9 s+8ItIaUoyRzjylQB3TPmGiZlygeK66hdKd7zCvlZM9MD9ErOJz6cS4oUuqZicI1lYsR n87A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684260190; x=1686852190; h=content-transfer-encoding:in-reply-to:from:references:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PjWUWILWSoWkEQi8X+0ANyvxVRPlJaKmjmV8cTSMFR0=; b=XxJ4vI3hvi6+66b8RNdKaa+gaqYMMoifcDzCHDHuYV11DszgwCS6gK2oFf6NSYtZlZ F3HR7f7AT1dKH7QpG0UzbH8q542JNkYlQa0AUhhMXz6Zd8Uo08IyayoOCM5jxWTK2MyR lRzUvRGrC4EwIYLsXohd1LnKqHHO8I9mADLd3m+MnKwjzcKCg0FZaTq+OfvvcuFmfPPB tPlIfYlv9gXBSIrPdokOg3y1vxxsBJENrypioAzt+7EDFWLbJ5ir8/j3idpLv7J//A3w 4mLeYLAQiEta4XxUtoQyb2KNf9kTiBHAZVT6ZBekPDB6TMDjMXuXpZpNBid1wHPj3O89 KapA== X-Gm-Message-State: AC+VfDx+eADBEJNLQLt/5/MgzR1O4PLYMiPbbyHO3XjmwO0NTyvcpj9o rU9OaCD/I9l1HVvuPXCdFblApIlByrA= X-Google-Smtp-Source: ACHHUZ45in9n1W5fy+QyJKSKuuBXODxhM1LVMVqrJeSWPAM9cjeylaNi091Gmar6408PGJx2KoNKMA== X-Received: by 2002:a05:6870:172c:b0:196:12ec:110a with SMTP id h44-20020a056870172c00b0019612ec110amr16358785oae.48.1684260190191; Tue, 16 May 2023 11:03:10 -0700 (PDT) Received: from [192.168.0.12] (host197.190-225-105.telecom.net.ar. [190.225.105.197]) by smtp.gmail.com with ESMTPSA id n3-20020a056870034300b00176d49bb898sm13125456oaf.44.2023.05.16.11.03.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 16 May 2023 11:03:09 -0700 (PDT) Message-ID: Date: Tue, 16 May 2023 15:03:17 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.10.1 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: From: James Almer In-Reply-To: Subject: Re: [FFmpeg-devel] [PATCH] avfilter/src_movie: dr support 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: > From e1dc1a00ac327d450c33586269cb19230f433405 Mon Sep 17 00:00:00 2001 > From: Paul B Mahol > Date: Mon, 15 May 2023 21:54:25 +0200 > Subject: [PATCH 2/3] avfilter/src_movie: dr support > > Signed-off-by: Paul B Mahol > --- > libavfilter/src_movie.c | 40 ++++++++++++++++++++++++++++++++++++++-- > 1 file changed, 38 insertions(+), 2 deletions(-) > > diff --git a/libavfilter/src_movie.c b/libavfilter/src_movie.c > index a7d7c188e6..bc0b8b7ac6 100644 > --- a/libavfilter/src_movie.c > +++ b/libavfilter/src_movie.c > @@ -23,7 +23,6 @@ > * @file > * movie video source > * > - * @todo use direct rendering (no allocation of a new frame) > * @todo support a PTS correction mechanism > */ > > @@ -158,6 +157,39 @@ static AVStream *find_stream(void *log, AVFormatContext *avf, const char *spec) > return found; > } > > +static int get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) > +{ > + int linesize_align[AV_NUM_DATA_POINTERS]; > + AVFilterLink *outlink = frame->opaque; > + int h = frame->height; > + int w = frame->width; > + AVFrame *new; > + > + if (!(avctx->codec->capabilities & AV_CODEC_CAP_DR1)) > + return avcodec_default_get_buffer2(avctx, frame, flags); > + > + switch (avctx->codec_type) { > + case AVMEDIA_TYPE_VIDEO: > + avcodec_align_dimensions2(avctx, &w, &h, linesize_align); > + new = ff_default_get_video_buffer(outlink, frame->width, frame->height); You're not using the values from w and h at all. You need to allocate the frame buffers with them, since the point of this is padding the buffers based on the needs of each decoder. The AVFrame however must retain the non altered values. > + break; > + case AVMEDIA_TYPE_AUDIO: > + new = ff_default_get_audio_buffer(outlink, frame->nb_samples); > + break; > + default: > + return -1; > + } > + > + av_frame_copy_props(new, frame); > + av_frame_unref(frame); > + av_frame_move_ref(frame, new); > + av_frame_free(&new); > + > + frame->opaque = outlink; > + > + return 0; > +} > + > static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads) > { > const AVCodec *codec; > @@ -173,6 +205,8 @@ static int open_stream(AVFilterContext *ctx, MovieStream *st, int dec_threads) > if (!st->codec_ctx) > return AVERROR(ENOMEM); > > + st->codec_ctx->flags |= AV_CODEC_FLAG_COPY_OPAQUE; > + st->codec_ctx->get_buffer2 = get_buffer; > ret = avcodec_parameters_to_context(st->codec_ctx, st->st->codecpar); > if (ret < 0) > return ret; > @@ -480,8 +514,10 @@ static int movie_decode_packet(AVFilterContext *ctx) > /* send the packet to its decoder, if any */ > pkt_out_id = pkt.stream_index > movie->max_stream_index ? -1 : > movie->out_index[pkt.stream_index]; > - if (pkt_out_id >= 0) > + if (pkt_out_id >= 0) { > + pkt.opaque = ctx->outputs[pkt_out_id]; > ret = avcodec_send_packet(movie->st[pkt_out_id].codec_ctx, &pkt); > + } > av_packet_unref(&pkt); > > return ret; > -- > 2.39.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".