From patchwork Sat Jan 6 13:20:54 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 7159 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.2.78.2 with SMTP id r2csp549255jaa; Sat, 6 Jan 2018 05:21:03 -0800 (PST) X-Google-Smtp-Source: ACJfBot5FOn/ql34uIYbslOH3HeCPajq+GxQS0Xe85T+GSuO+s6FfRdXvCkQYkBSKRBRXokRPUve X-Received: by 10.28.14.133 with SMTP id 127mr4210205wmo.152.1515244862924; Sat, 06 Jan 2018 05:21:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515244862; cv=none; d=google.com; s=arc-20160816; b=IEg7fnNGkVGET9fBIH4sDQbv2gTiNw8fxPmppBBDrLCWy79EA8zlRfHSDgvhWvRIRQ tqVV+Py9xf60ICcGkutze9zlhS8vOf0XlBBo/8AjuAEwbfGh8zZe4AEmBXoOPQ3VYU/O QRmBBgT7CwLmP7B9ddHZeLgBWs9TIXUh5i1e1l3Rjh3SlKs/7dTwyC9Wfzts/ww9N4od jGPiO11y6qJH1Y1ykzoNGP8Cv5JUYVvI8UXgMK9Ji7U/BtkXeu9jVGgSXcWUZBet591z E8Hj8E3I+xGZrF83aBgZF304fwcb804IfSp7mShXK27vVdTcvfKwTi8ikTBtf89TMTvL lXxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence:subject:user-agent :in-reply-to:mime-version:references:message-id:to:from:date :delivered-to:arc-authentication-results; bh=WLu0XhA1/TzDT7OyVnc9VX5tpQS7nwR30hR5A0jsz0s=; b=xBuqwgAAeQMwqArio/67GP16Lrqj9dsBh3plADFX13eRJkc3k8tcbJWolSXwiI/JvL mvznkaXqtKu3xqpBjs7ZFbt8LuC3Vcc6v5zfR/Ic5Wqcoe00L/htncKvWulHm7vZarSH NgdQtNqgnnsnwugTj6matg3qRC4dWsIT6+RmyNDFZVaiEn/xUZHTKCDKSlpDcmTe5fKH /BxMHxyOhVrLBfvn2ioGI0y5Ogj6H+WgFZajdnMpBzDT+UTobKBwI6w/FKlh+DnZDcrt junshVzhvYuQG/H5se2ccviQQn4wi82btSyWxCoJmDZA/3Fjy5D1BuMNUxybchV3DOSl /mGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b4si4988399wmh.110.2018.01.06.05.21.02; Sat, 06 Jan 2018 05:21:02 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id C62DA689CF3; Sat, 6 Jan 2018 15:21:00 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef2.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9390E689CCD for ; Sat, 6 Jan 2018 15:20:54 +0200 (EET) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef2.ens.fr (8.13.6/1.01.28121999) with ESMTP id w06DKsrl065863 for ; Sat, 6 Jan 2018 14:20:54 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 3F817EB5B6; Sat, 6 Jan 2018 14:20:54 +0100 (CET) Date: Sat, 6 Jan 2018 14:20:54 +0100 From: Nicolas George To: FFmpeg development discussions and patches Message-ID: <20180106132054.GA3277148@phare.normalesup.org> References: <20180105205055.4120-1-jamrial@gmail.com> <20180105205055.4120-2-jamrial@gmail.com> MIME-Version: 1.0 In-Reply-To: <20180105205055.4120-2-jamrial@gmail.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Sat, 06 Jan 2018 14:20:54 +0100 (CET) Subject: Re: [FFmpeg-devel] [PATCH 2/2] tools/uncoded_frame: remove usage of avfilter_link_get_channels() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" James Almer (2018-01-05): > Signed-off-by: James Almer > --- > tools/uncoded_frame.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c > index 3ca2ba4bbe..c044741701 100644 > --- a/tools/uncoded_frame.c > +++ b/tools/uncoded_frame.c > @@ -178,7 +178,7 @@ int main(int argc, char **argv) > break; > case AVMEDIA_TYPE_AUDIO: > st->stream->codec->channel_layout = st->link->channel_layout; > - st->stream->codec->channels = avfilter_link_get_channels(st->link); > + st->stream->codec->channels = st->link->channels; > st->stream->codec->sample_rate = st->link->sample_rate; > st->stream->codec->sample_fmt = st->link->format; > st->stream->codec->codec_id = Counter-proposal attached. With the evolution of lavfi, AVFilterLink should have been made private entirely, but it never happened. Still, the API to do without it exists. Regards, From 6abecbd60f63a3a235e64d2c9a29d8d2e191a399 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Sat, 6 Jan 2018 14:14:04 +0100 Subject: [PATCH] tools/uncoded_frame: use buffersink accessors. No longer access buffersink's link structure directly. Signed-off-by: Nicolas George --- tools/uncoded_frame.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/uncoded_frame.c b/tools/uncoded_frame.c index 3ca2ba4bbe..f346b21916 100644 --- a/tools/uncoded_frame.c +++ b/tools/uncoded_frame.c @@ -11,7 +11,6 @@ typedef struct { AVFormatContext *mux; AVStream *stream; AVFilterContext *sink; - AVFilterLink *link; } Stream; static int create_sink(Stream *st, AVFilterGraph *graph, @@ -36,7 +35,6 @@ static int create_sink(Stream *st, AVFilterGraph *graph, ret = avfilter_link(f, idx, st->sink, 0); if (ret < 0) return ret; - st->link = st->sink->inputs[0]; return 0; } @@ -163,24 +161,24 @@ int main(int argc, char **argv) av_log(NULL, AV_LOG_ERROR, "Failed to create output stream\n"); goto fail; } - st->stream->codec->codec_type = st->link->type; + st->stream->codec->codec_type = av_buffersink_get_type(st->sink); st->stream->time_base = st->stream->codec->time_base = - st->link->time_base; - switch (st->link->type) { + av_buffersink_get_time_base(st->sink); + switch (av_buffersink_get_type(st->sink)) { case AVMEDIA_TYPE_VIDEO: st->stream->codec->codec_id = AV_CODEC_ID_RAWVIDEO; st->stream->avg_frame_rate = st->stream-> r_frame_rate = av_buffersink_get_frame_rate(st->sink); - st->stream->codec->width = st->link->w; - st->stream->codec->height = st->link->h; - st->stream->codec->sample_aspect_ratio = st->link->sample_aspect_ratio; - st->stream->codec->pix_fmt = st->link->format; + st->stream->codec->width = av_buffersink_get_w(st->sink); + st->stream->codec->height = av_buffersink_get_h(st->sink); + st->stream->codec->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(st->sink); + st->stream->codec->pix_fmt = av_buffersink_get_format(st->sink); break; case AVMEDIA_TYPE_AUDIO: - st->stream->codec->channel_layout = st->link->channel_layout; - st->stream->codec->channels = avfilter_link_get_channels(st->link); - st->stream->codec->sample_rate = st->link->sample_rate; - st->stream->codec->sample_fmt = st->link->format; + st->stream->codec->channel_layout = av_buffersink_get_channel_layout(st->sink); + st->stream->codec->channels = av_buffersink_get_channels(st->sink); + st->stream->codec->sample_rate = av_buffersink_get_sample_rate(st->sink); + st->stream->codec->sample_fmt = av_buffersink_get_format(st->sink); st->stream->codec->codec_id = av_get_pcm_codec(st->stream->codec->sample_fmt, -1); break; @@ -240,7 +238,7 @@ int main(int argc, char **argv) } if (frame->pts != AV_NOPTS_VALUE) frame->pts = av_rescale_q(frame->pts, - st->link ->time_base, + av_buffersink_get_time_base(st->sink), st->stream->time_base); ret = av_interleaved_write_uncoded_frame(st->mux, st->stream->index, -- 2.15.1