From patchwork Tue Dec 27 18:02:05 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 1946 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.89.21 with SMTP id n21csp1594489vsb; Tue, 27 Dec 2016 10:02:55 -0800 (PST) X-Received: by 10.28.140.148 with SMTP id o142mr21942932wmd.48.1482861775394; Tue, 27 Dec 2016 10:02:55 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id qp9si50719713wjc.142.2016.12.27.10.02.54; Tue, 27 Dec 2016 10:02:55 -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 C972E689D79; Tue, 27 Dec 2016 20:02:22 +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 EBB5E689CF4 for ; Tue, 27 Dec 2016 20:02:15 +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 uBRI2Ip3003078 for ; Tue, 27 Dec 2016 19:02:18 +0100 (CET) Received: by phare.normalesup.org (Postfix, from userid 1001) id 2935CE00F9; Tue, 27 Dec 2016 19:02:18 +0100 (CET) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Tue, 27 Dec 2016 19:02:05 +0100 Message-Id: <20161227180210.23100-4-george@nsup.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20161227180210.23100-1-george@nsup.org> References: <20161227180210.23100-1-george@nsup.org> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef2.ens.fr [129.199.96.32]); Tue, 27 Dec 2016 19:02:18 +0100 (CET) Subject: [FFmpeg-devel] [PATCH 4/9] lavd/lavfi: use buffersink accessors. 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 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Nicolas George --- libavdevice/lavfi.c | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) Unchanged. diff --git a/libavdevice/lavfi.c b/libavdevice/lavfi.c index f9b2694650..eca3f15934 100644 --- a/libavdevice/lavfi.c +++ b/libavdevice/lavfi.c @@ -312,31 +312,32 @@ av_cold static int lavfi_read_header(AVFormatContext *avctx) /* fill each stream with the information in the corresponding sink */ for (i = 0; i < lavfi->nb_sinks; i++) { - AVFilterLink *link = lavfi->sinks[lavfi->stream_sink_map[i]]->inputs[0]; + AVFilterContext *sink = lavfi->sinks[lavfi->stream_sink_map[i]]; + AVRational time_base = av_buffersink_get_time_base(sink); AVStream *st = avctx->streams[i]; - st->codecpar->codec_type = link->type; - avpriv_set_pts_info(st, 64, link->time_base.num, link->time_base.den); - if (link->type == AVMEDIA_TYPE_VIDEO) { + st->codecpar->codec_type = av_buffersink_get_type(sink); + avpriv_set_pts_info(st, 64, time_base.num, time_base.den); + if (av_buffersink_get_type(sink) == AVMEDIA_TYPE_VIDEO) { st->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO; - st->codecpar->format = link->format; - st->codecpar->width = link->w; - st->codecpar->height = link->h; + st->codecpar->format = av_buffersink_get_format(sink); + st->codecpar->width = av_buffersink_get_w(sink); + st->codecpar->height = av_buffersink_get_h(sink); st ->sample_aspect_ratio = - st->codecpar->sample_aspect_ratio = link->sample_aspect_ratio; + st->codecpar->sample_aspect_ratio = av_buffersink_get_sample_aspect_ratio(sink); avctx->probesize = FFMAX(avctx->probesize, - link->w * link->h * - av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(link->format)) * + av_buffersink_get_w(sink) * av_buffersink_get_h(sink) * + av_get_padded_bits_per_pixel(av_pix_fmt_desc_get(av_buffersink_get_format(sink))) * 30); - } else if (link->type == AVMEDIA_TYPE_AUDIO) { - st->codecpar->codec_id = av_get_pcm_codec(link->format, -1); - st->codecpar->channels = avfilter_link_get_channels(link); - st->codecpar->format = link->format; - st->codecpar->sample_rate = link->sample_rate; - st->codecpar->channel_layout = link->channel_layout; + } else if (av_buffersink_get_type(sink) == AVMEDIA_TYPE_AUDIO) { + st->codecpar->codec_id = av_get_pcm_codec(av_buffersink_get_format(sink), -1); + st->codecpar->channels = av_buffersink_get_channels(sink); + st->codecpar->format = av_buffersink_get_format(sink); + st->codecpar->sample_rate = av_buffersink_get_sample_rate(sink); + st->codecpar->channel_layout = av_buffersink_get_channel_layout(sink); if (st->codecpar->codec_id == AV_CODEC_ID_NONE) av_log(avctx, AV_LOG_ERROR, "Could not find PCM codec for sample format %s.\n", - av_get_sample_fmt_name(link->format)); + av_get_sample_fmt_name(av_buffersink_get_format(sink))); } } @@ -400,7 +401,7 @@ static int lavfi_read_packet(AVFormatContext *avctx, AVPacket *pkt) /* iterate through all the graph sinks. Select the sink with the * minimum PTS */ for (i = 0; i < lavfi->nb_sinks; i++) { - AVRational tb = lavfi->sinks[i]->inputs[0]->time_base; + AVRational tb = av_buffersink_get_time_base(lavfi->sinks[i]); double d; int ret;