From patchwork Mon Aug 15 20:13:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jon Toohill X-Patchwork-Id: 181 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.67 with SMTP id o64csp1742679vsd; Mon, 15 Aug 2016 13:14:02 -0700 (PDT) X-Received: by 10.194.95.105 with SMTP id dj9mr33000041wjb.20.1471292042101; Mon, 15 Aug 2016 13:14:02 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id m5si16890532wmi.65.2016.08.15.13.14.01; Mon, 15 Aug 2016 13:14:02 -0700 (PDT) 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; dkim=neutral (body hash did not verify) header.i=@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 659CF689AD0; Mon, 15 Aug 2016 23:13:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-pf0-f178.google.com (mail-pf0-f178.google.com [209.85.192.178]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id DD17D689AA1 for ; Mon, 15 Aug 2016 23:13:51 +0300 (EEST) Received: by mail-pf0-f178.google.com with SMTP id x72so19761682pfd.2 for ; Mon, 15 Aug 2016 13:13:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=20TY4RYbterHckB3hN77tGafYiYP4KwT/hwcpDBEHIw=; b=aakpeokeWRAuBl70YbqC7HZivMP7qTeSAa5zeHwbdOyaZug4IJ34bUwKhp3VLCuZ7Z X4fSG38/8luArrJh/I66GFXbkr7Wgan5dSSK8yEd51ol8wcj/bjmm+AIsgZrxVhyTOVO 2DPcekb1ScJo+fdeX+btT0V83SqMZBW4P4Tubqe7HhoqQUEgQgfVCmIGr1wQ5PwOUpsO u+Hh6+P5jVUdyU9d2fGiBApZJhL4tyay15gsn4cy3VCjx8lNnr8P8ElYpN/WxZ797sP9 +3EF1wjwY4+9qgQjujBDq+7VAbKuLvfdc6WA0+SMp8L6Oic//CQHfsb+r+yMX6QqGP8+ TsSA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=20TY4RYbterHckB3hN77tGafYiYP4KwT/hwcpDBEHIw=; b=VD/6AYfAQlRDcMTUJtlFq18V90kEY+bHHqPne0nHX3gw3BGYZm33F9C/WXrg0ZzXh4 a1nTCT33KZnD8Pfs9FFuUzOrzy2W07Lhw3lXTDKdLqlxGryIC2t58swHjZ/Ei245cFxP HtJ5fbeViygC4akTpS8g5ykPhRosdSsZClejxnurMJgGMxu6JNjNLVoX2nqlSLvQm42L 1R5dkWxXUQxKsAf8d8Ut3EENA4Dpm9em87mVtjWmc/7Vy9b3lkzc3++bHVHkKvalvWJ0 rXdzsBkW5qrm+qwqYlxsefNdMYTsGHPh4yT8fGr5a/mJXqc6r5o1nuEnobaST1R82lly HJ7g== X-Gm-Message-State: AEkooutPAYrb1ReO29KAsgpDFEG9BVHmhcpcUq1oAahM7wEW/ueLYhz8t87U9Svh/K45XXiY X-Received: by 10.98.59.205 with SMTP id w74mr6150548pfj.156.1471292032237; Mon, 15 Aug 2016 13:13:52 -0700 (PDT) Received: from mungolini.mtv.corp.google.com ([172.22.156.76]) by smtp.gmail.com with ESMTPSA id b68sm33377268pfg.85.2016.08.15.13.13.51 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 15 Aug 2016 13:13:51 -0700 (PDT) From: Jon Toohill To: ffmpeg-devel@ffmpeg.org Date: Mon, 15 Aug 2016 13:13:06 -0700 Message-Id: <1471291987-2220-2-git-send-email-jtoohill@google.com> X-Mailer: git-send-email 2.8.0.rc3.226.g39d4020 In-Reply-To: <1471291987-2220-1-git-send-email-jtoohill@google.com> References: <1471291987-2220-1-git-send-email-jtoohill@google.com> Subject: [FFmpeg-devel] [PATCH 1/2] lavc: add trailing_padding to AVCodecContext to match AVCodecParameters. 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: Jon Toohill MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Shows encoder delay/padding in the stream summary if they are set. --- doc/APIchanges | 4 ++++ libavcodec/avcodec.h | 11 +++++++++++ libavcodec/utils.c | 40 +++++++++++++++++++++++----------------- libavcodec/version.h | 2 +- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 209ab41..74145b2 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2015-08-28 API changes, most recent first: +2016-08-15 - xxxxxxx - lavc 57.53.100 - avcodec.h + Add trailing_padding to AVCodecContext to match the corresponding + field in AVCodecParameters. + 2016-08-04 - xxxxxxx - lavf 57.46.100 - avformat.h Add av_get_frame_filename2() diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 06c2b89..b43ee5a 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3524,6 +3524,17 @@ typedef struct AVCodecContext { #define FF_SUB_TEXT_FMT_ASS_WITH_TIMINGS 1 #endif + /** + * Audio only. The amount of padding (in samples) appended by the encoder to + * the end of the audio. I.e. this number of decoded samples must be + * discarded by the caller from the end of the stream to get the original + * audio without any trailing padding. + * + * - decoding: unused + * - encoding: unused + */ + int trailing_padding; + } AVCodecContext; AVRational av_codec_get_pkt_timebase (const AVCodecContext *avctx); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 783f62c..6f4d553 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3258,6 +3258,10 @@ void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode) && enc->bits_per_raw_sample != av_get_bytes_per_sample(enc->sample_fmt) * 8) snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%d bit)", enc->bits_per_raw_sample); + if (enc->initial_padding || enc->trailing_padding) { + snprintf(buf + strlen(buf), buf_size - strlen(buf), + ", delay %d, padding %d", enc->initial_padding, enc->trailing_padding); + } break; case AVMEDIA_TYPE_DATA: if (av_log_get_level() >= AV_LOG_DEBUG) { @@ -4103,14 +4107,15 @@ int avcodec_parameters_from_context(AVCodecParameters *par, par->video_delay = codec->has_b_frames; break; case AVMEDIA_TYPE_AUDIO: - par->format = codec->sample_fmt; - par->channel_layout = codec->channel_layout; - par->channels = codec->channels; - par->sample_rate = codec->sample_rate; - par->block_align = codec->block_align; - par->frame_size = codec->frame_size; - par->initial_padding = codec->initial_padding; - par->seek_preroll = codec->seek_preroll; + par->format = codec->sample_fmt; + par->channel_layout = codec->channel_layout; + par->channels = codec->channels; + par->sample_rate = codec->sample_rate; + par->block_align = codec->block_align; + par->frame_size = codec->frame_size; + par->initial_padding = codec->initial_padding; + par->trailing_padding = codec->trailing_padding; + par->seek_preroll = codec->seek_preroll; break; case AVMEDIA_TYPE_SUBTITLE: par->width = codec->width; @@ -4157,15 +4162,16 @@ int avcodec_parameters_to_context(AVCodecContext *codec, codec->has_b_frames = par->video_delay; break; case AVMEDIA_TYPE_AUDIO: - codec->sample_fmt = par->format; - codec->channel_layout = par->channel_layout; - codec->channels = par->channels; - codec->sample_rate = par->sample_rate; - codec->block_align = par->block_align; - codec->frame_size = par->frame_size; - codec->delay = - codec->initial_padding = par->initial_padding; - codec->seek_preroll = par->seek_preroll; + codec->sample_fmt = par->format; + codec->channel_layout = par->channel_layout; + codec->channels = par->channels; + codec->sample_rate = par->sample_rate; + codec->block_align = par->block_align; + codec->frame_size = par->frame_size; + codec->delay = + codec->initial_padding = par->initial_padding; + codec->trailing_padding = par->trailing_padding; + codec->seek_preroll = par->seek_preroll; break; case AVMEDIA_TYPE_SUBTITLE: codec->width = par->width; diff --git a/libavcodec/version.h b/libavcodec/version.h index a697261..cdfc4f9 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 57 -#define LIBAVCODEC_VERSION_MINOR 52 +#define LIBAVCODEC_VERSION_MINOR 53 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \