[FFmpeg-devel] [PATCH 2/2] lavc: show gapless info in stream summary
Also adds trailing_padding to AVCodecContext to match AVCodecParameters so that it doesn't get lost when mapping between them. --- doc/APIchanges | 4 libavcodec/avcodec.h | 11 +++ libavcodec/utils.c | 38 ++ libavcodec/version.h | 2 +- 4 files changed, 38 insertions(+), 17 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index d777dc0..4720b70 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -15,6 +15,10 @@ libavutil: 2015-08-28 API changes, most recent first: +2016-05-25 - xxx - lavc 57.43.100 - avcodec.h + Add trailing_padding to AVCodecContext to match the corresponding + field in AVCodecParameters. + 2016-04-27 - xxx - lavu 55.23.100 - log.h Add a new function av_log_format_line2() which returns number of bytes written to the target buffer. diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 9ec9adf..554e1ee 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3497,6 +3497,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 e5a832b..51f50b0 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3251,6 +3251,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) { @@ -4094,14 +4098,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; @@ -4148,14 +4153,15 @@ 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->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->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 0916f81..ee3006c 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 42
Re: [FFmpeg-devel] [PATCH 2/2] lavc: show gapless info in stream summary
On Tue, May 24, 2016 at 03:52:49PM -0700, Jon Toohill wrote: > From: Jon Toohill> > Also adds trailing_padding to AVCodecContext to match > AVCodecParameters so that it doesn't get lost when mapping > between them. > --- > libavcodec/avcodec.h | 11 +++ > libavcodec/utils.c | 38 ++ > 2 files changed, 33 insertions(+), 16 deletions(-) > > diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h > index 9ec9adf..408efe1 100644 > --- a/libavcodec/avcodec.h > +++ b/libavcodec/avcodec.h > @@ -3321,6 +3321,17 @@ typedef struct AVCodecContext { > int initial_padding; > > /** > + * 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; > + > +/** new fields must be added at the end to avoid breaking ABI also minor version has to be bumped and an entry should be added to doc/APIchanges [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Into a blind darkness they enter who follow after the Ignorance, they as if into a greater darkness enter who devote themselves to the Knowledge alone. -- Isha Upanishad signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 2/2] lavc: show gapless info in stream summary
From: Jon ToohillAlso adds trailing_padding to AVCodecContext to match AVCodecParameters so that it doesn't get lost when mapping between them. --- libavcodec/avcodec.h | 11 +++ libavcodec/utils.c | 38 ++ 2 files changed, 33 insertions(+), 16 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 9ec9adf..408efe1 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3321,6 +3321,17 @@ typedef struct AVCodecContext { int initial_padding; /** + * 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; + +/** * - decoding: For codecs that store a framerate value in the compressed * bitstream, the decoder may export it here. { 0, 1} when * unknown. diff --git a/libavcodec/utils.c b/libavcodec/utils.c index e5a832b..51f50b0 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -3251,6 +3251,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) { @@ -4094,14 +4098,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; @@ -4148,14 +4153,15 @@ 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->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->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; -- 2.8.0.rc3.226.g39d4020 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel