From patchwork Wed Feb 22 22:46:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marton Balint X-Patchwork-Id: 2649 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.65.149 with SMTP id x21csp1098595vsf; Wed, 22 Feb 2017 14:47:08 -0800 (PST) X-Received: by 10.223.162.205 with SMTP id t13mr28955818wra.155.1487803627980; Wed, 22 Feb 2017 14:47:07 -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 1si2184874wrg.115.2017.02.22.14.47.07; Wed, 22 Feb 2017 14:47:07 -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 723566882F4; Thu, 23 Feb 2017 00:46:56 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 5C83668827D for ; Thu, 23 Feb 2017 00:46:50 +0200 (EET) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 6FB08102D5C; Wed, 22 Feb 2017 23:46:58 +0100 (CET) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id S4N020pENYis; Wed, 22 Feb 2017 23:46:56 +0100 (CET) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 4D2C9100B26; Wed, 22 Feb 2017 23:46:56 +0100 (CET) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 22 Feb 2017 23:46:49 +0100 Message-Id: <20170222224652.4505-1-cus@passwd.hu> X-Mailer: git-send-email 2.10.2 Subject: [FFmpeg-devel] [PATCH 1/4] avdevice/decklink_enc: convert to codecpar 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 Cc: Marton Balint MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Signed-off-by: Marton Balint --- libavdevice/decklink_enc.cpp | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/libavdevice/decklink_enc.cpp b/libavdevice/decklink_enc.cpp index ad00224..944e9d3 100644 --- a/libavdevice/decklink_enc.cpp +++ b/libavdevice/decklink_enc.cpp @@ -92,20 +92,20 @@ static int decklink_setup_video(AVFormatContext *avctx, AVStream *st) { struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; - AVCodecContext *c = st->codec; + AVCodecParameters *c = st->codecpar; if (ctx->video) { av_log(avctx, AV_LOG_ERROR, "Only one video stream is supported!\n"); return -1; } - if (c->pix_fmt != AV_PIX_FMT_UYVY422) { + if (c->format != AV_PIX_FMT_UYVY422) { av_log(avctx, AV_LOG_ERROR, "Unsupported pixel format!" " Only AV_PIX_FMT_UYVY422 is supported.\n"); return -1; } if (ff_decklink_set_format(avctx, c->width, c->height, - c->time_base.num, c->time_base.den)) { + st->time_base.num, st->time_base.den)) { av_log(avctx, AV_LOG_ERROR, "Unsupported video size or framerate!" " Check available formats with -list_formats 1.\n"); return -1; @@ -121,8 +121,8 @@ static int decklink_setup_video(AVFormatContext *avctx, AVStream *st) ctx->dlo->SetScheduledFrameCompletionCallback(ctx->output_callback); /* Start video semaphore. */ - ctx->frames_preroll = c->time_base.den * ctx->preroll; - if (c->time_base.den > 1000) + ctx->frames_preroll = st->time_base.den * ctx->preroll; + if (st->time_base.den > 1000) ctx->frames_preroll /= 1000; /* Buffer twice as many frames as the preroll. */ @@ -131,7 +131,7 @@ static int decklink_setup_video(AVFormatContext *avctx, AVStream *st) sem_init(&ctx->semaphore, 0, ctx->frames_buffer); /* The device expects the framerate to be fixed. */ - avpriv_set_pts_info(st, 64, c->time_base.num, c->time_base.den); + avpriv_set_pts_info(st, 64, st->time_base.num, st->time_base.den); ctx->video = 1; @@ -142,7 +142,7 @@ static int decklink_setup_audio(AVFormatContext *avctx, AVStream *st) { struct decklink_cctx *cctx = (struct decklink_cctx *)avctx->priv_data; struct decklink_ctx *ctx = (struct decklink_ctx *)cctx->ctx; - AVCodecContext *c = st->codec; + AVCodecParameters *c = st->codecpar; if (ctx->audio) { av_log(avctx, AV_LOG_ERROR, "Only one audio stream is supported!\n"); @@ -352,7 +352,7 @@ av_cold int ff_decklink_write_header(AVFormatContext *avctx) ret = AVERROR(EIO); for (n = 0; n < avctx->nb_streams; n++) { AVStream *st = avctx->streams[n]; - AVCodecContext *c = st->codec; + AVCodecParameters *c = st->codecpar; if (c->codec_type == AVMEDIA_TYPE_AUDIO) { if (decklink_setup_audio(avctx, st)) goto error; @@ -380,9 +380,9 @@ int ff_decklink_write_packet(AVFormatContext *avctx, AVPacket *pkt) ctx->last_pts = FFMAX(ctx->last_pts, pkt->pts); - if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) + if (st->codecpar->codec_type == AVMEDIA_TYPE_VIDEO) return decklink_write_video_packet(avctx, pkt); - else if (st->codec->codec_type == AVMEDIA_TYPE_AUDIO) + else if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO) return decklink_write_audio_packet(avctx, pkt); return AVERROR(EIO);