From 4d693b023c885f6821e2347137943d751469bd0b Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 5 Apr 2012 17:00:53 -0400 Subject: [PATCH 1/9] avutil: add av_get_packed_sample_fmt() and av_get_planar_sample_fmt() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Based on a patch by Clément Bœsch --- doc/APIchanges | 3 +++ libavutil/avutil.h | 2 +- libavutil/samplefmt.c | 39 +++++++++++++++++++++++++++++---------- libavutil/samplefmt.h | 22 ++++++++++++++++++++++ 4 files changed, 55 insertions(+), 11 deletions(-) diff --git a/doc/APIchanges b/doc/APIchanges index 80bea4fd51..889156e0bc 100644 --- a/doc/APIchanges +++ b/doc/APIchanges @@ -12,6 +12,9 @@ libavutil: 2011-04-18 API changes, most recent first: +2012-xx-xx - xxxxxxx - lavu 51.27.0 - samplefmt.h + Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt() + 2012-xx-xx - xxxxxxx - lavu 51.26.0 - audioconvert.h Add av_get_default_channel_layout() diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 6ab4840ede..df7d678c98 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -152,7 +152,7 @@ */ #define LIBAVUTIL_VERSION_MAJOR 51 -#define LIBAVUTIL_VERSION_MINOR 26 +#define LIBAVUTIL_VERSION_MINOR 27 #define LIBAVUTIL_VERSION_MICRO 0 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index f38d05e426..960168d852 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -26,20 +26,21 @@ typedef struct SampleFmtInfo { const char *name; int bits; int planar; + enum AVSampleFormat altform; ///< planar<->packed alternative form } SampleFmtInfo; /** this table gives more information about formats */ static const SampleFmtInfo sample_fmt_info[AV_SAMPLE_FMT_NB] = { - [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0 }, - [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0 }, - [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0 }, - [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0 }, - [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0 }, - [AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1 }, - [AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1 }, - [AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1 }, - [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1 }, - [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1 }, + [AV_SAMPLE_FMT_U8] = { .name = "u8", .bits = 8, .planar = 0, .altform = AV_SAMPLE_FMT_U8P }, + [AV_SAMPLE_FMT_S16] = { .name = "s16", .bits = 16, .planar = 0, .altform = AV_SAMPLE_FMT_S16P }, + [AV_SAMPLE_FMT_S32] = { .name = "s32", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_S32P }, + [AV_SAMPLE_FMT_FLT] = { .name = "flt", .bits = 32, .planar = 0, .altform = AV_SAMPLE_FMT_FLTP }, + [AV_SAMPLE_FMT_DBL] = { .name = "dbl", .bits = 64, .planar = 0, .altform = AV_SAMPLE_FMT_DBLP }, + [AV_SAMPLE_FMT_U8P] = { .name = "u8p", .bits = 8, .planar = 1, .altform = AV_SAMPLE_FMT_U8 }, + [AV_SAMPLE_FMT_S16P] = { .name = "s16p", .bits = 16, .planar = 1, .altform = AV_SAMPLE_FMT_S16 }, + [AV_SAMPLE_FMT_S32P] = { .name = "s32p", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_S32 }, + [AV_SAMPLE_FMT_FLTP] = { .name = "fltp", .bits = 32, .planar = 1, .altform = AV_SAMPLE_FMT_FLT }, + [AV_SAMPLE_FMT_DBLP] = { .name = "dblp", .bits = 64, .planar = 1, .altform = AV_SAMPLE_FMT_DBL }, }; const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt) @@ -59,6 +60,24 @@ enum AVSampleFormat av_get_sample_fmt(const char *name) return AV_SAMPLE_FMT_NONE; } +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt) +{ + if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) + return AV_SAMPLE_FMT_NONE; + if (sample_fmt_info[sample_fmt].planar) + return sample_fmt_info[sample_fmt].altform; + return sample_fmt; +} + +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt) +{ + if (sample_fmt < 0 || sample_fmt >= AV_SAMPLE_FMT_NB) + return AV_SAMPLE_FMT_NONE; + if (sample_fmt_info[sample_fmt].planar) + return sample_fmt; + return sample_fmt_info[sample_fmt].altform; +} + char *av_get_sample_fmt_string (char *buf, int buf_size, enum AVSampleFormat sample_fmt) { /* print header */ diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index b6715561d4..4bd5da4471 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -53,6 +53,28 @@ const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); */ enum AVSampleFormat av_get_sample_fmt(const char *name); +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + /** * Generate a string corresponding to the sample format with * sample_fmt, or a header if sample_fmt is negative. From b2db35995f056720cc4e932d507ea09c0106bce9 Mon Sep 17 00:00:00 2001 From: Nicolas George Date: Tue, 8 Nov 2011 16:32:50 +0100 Subject: [PATCH 2/9] audioconvert: make av_get_channel_layout accept composite names. Signed-off-by: Nicolas George Signed-off-by: Michael Niedermayer Signed-off-by: Justin Ruggles --- libavutil/audioconvert.c | 48 +++++++++++++++++++++++++++++++--------- libavutil/audioconvert.h | 16 +++++++++++++- libavutil/avutil.h | 2 +- 3 files changed, 54 insertions(+), 12 deletions(-) diff --git a/libavutil/audioconvert.c b/libavutil/audioconvert.c index 85c20e2868..2560127aac 100644 --- a/libavutil/audioconvert.c +++ b/libavutil/audioconvert.c @@ -81,34 +81,62 @@ static const struct { { "5.0", 5, AV_CH_LAYOUT_5POINT0_BACK }, { "5.1", 6, AV_CH_LAYOUT_5POINT1 }, { "5.1", 6, AV_CH_LAYOUT_5POINT1_BACK }, - { "5.1+downmix", 8, AV_CH_LAYOUT_5POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, }, { "6.0", 6, AV_CH_LAYOUT_6POINT0 }, { "6.0(front)", 6, AV_CH_LAYOUT_6POINT0_FRONT }, { "hexagonal", 6, AV_CH_LAYOUT_HEXAGONAL }, { "6.1", 7, AV_CH_LAYOUT_6POINT1 }, { "6.1", 7, AV_CH_LAYOUT_6POINT1_BACK }, { "6.1(front)", 7, AV_CH_LAYOUT_6POINT1_FRONT }, - { "6.1+downmix", 9, AV_CH_LAYOUT_6POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, }, { "7.0", 7, AV_CH_LAYOUT_7POINT0 }, { "7.0(front)", 7, AV_CH_LAYOUT_7POINT0_FRONT }, { "7.1", 8, AV_CH_LAYOUT_7POINT1 }, { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE }, { "7.1(wide)", 8, AV_CH_LAYOUT_7POINT1_WIDE_BACK }, - { "7.1+downmix", 10, AV_CH_LAYOUT_7POINT1|AV_CH_LAYOUT_STEREO_DOWNMIX, }, { "octagonal", 8, AV_CH_LAYOUT_OCTAGONAL }, + { "downmix", 2, AV_CH_LAYOUT_STEREO_DOWNMIX, }, { 0 } }; +static uint64_t get_channel_layout_single(const char *name, int name_len) +{ + int i; + char *end; + int64_t layout; + + for (i = 0; i < FF_ARRAY_ELEMS(channel_layout_map) - 1; i++) { + if (strlen(channel_layout_map[i].name) == name_len && + !memcmp(channel_layout_map[i].name, name, name_len)) + return channel_layout_map[i].layout; + } + for (i = 0; i < FF_ARRAY_ELEMS(channel_names); i++) + if (channel_names[i] && + strlen(channel_names[i]) == name_len && + !memcmp(channel_names[i], name, name_len)) + return (int64_t)1 << i; + i = strtol(name, &end, 10); + if (end - name == name_len || + (end + 1 - name == name_len && *end == 'c')) + return av_get_default_channel_layout(i); + layout = strtoll(name, &end, 0); + if (end - name == name_len) + return FFMAX(layout, 0); + return 0; +} + uint64_t av_get_channel_layout(const char *name) { - int i = 0; - do { - if (!strcmp(channel_layout_map[i].name, name)) - return channel_layout_map[i].layout; - i++; - } while (channel_layout_map[i].name); + const char *n, *e; + const char *name_end = name + strlen(name); + int64_t layout = 0, layout_single; - return 0; + for (n = name; n < name_end; n = e + 1) { + for (e = n; e < name_end && *e != '+' && *e != '|'; e++); + layout_single = get_channel_layout_single(n, e - n); + if (!layout_single) + return 0; + layout |= layout_single; + } + return layout; } void av_get_channel_layout_string(char *buf, int buf_size, diff --git a/libavutil/audioconvert.h b/libavutil/audioconvert.h index 2b0c9cdea9..35a1a087f6 100644 --- a/libavutil/audioconvert.h +++ b/libavutil/audioconvert.h @@ -106,7 +106,21 @@ */ /** - * Return a channel layout id that matches name, 0 if no match. + * Return a channel layout id that matches name, or 0 if no match is found. + * + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, optionally followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + * + * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" */ uint64_t av_get_channel_layout(const char *name); diff --git a/libavutil/avutil.h b/libavutil/avutil.h index df7d678c98..8a144a4668 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -153,7 +153,7 @@ #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 27 -#define LIBAVUTIL_VERSION_MICRO 0 +#define LIBAVUTIL_VERSION_MICRO 1 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ From 1337de0c4bea8bbf8e142e8401edd0b25dd059b5 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 4 Apr 2012 10:47:45 -0400 Subject: [PATCH 3/9] avcodec: validate the channel layout vs. channel count for decoders Set avctx->channel_layout to 0 if the channel count does not match avctx->channels. --- libavcodec/utils.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index aa0f5b6d86..4037bfd327 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -810,6 +810,15 @@ int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVD goto free_and_end; } } + + if (av_codec_is_decoder(avctx->codec)) { + /* validate channel layout from the decoder */ + if (avctx->channel_layout && + av_get_channel_layout_nb_channels(avctx->channel_layout) != avctx->channels) { + av_log(avctx, AV_LOG_WARNING, "channel layout does not match number of channels\n"); + avctx->channel_layout = 0; + } + } end: entangled_thread_counter--; From 695ec04e6a142a12bf4c3acd8fd74c59a17e3934 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 22 Mar 2012 09:37:33 +0100 Subject: [PATCH 4/9] avconv: only set SAR once on the decoded frame. No point in repeating the assignment for each output stream. --- avconv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/avconv.c b/avconv.c index 95dc8d8547..7fefec4c00 100644 --- a/avconv.c +++ b/avconv.c @@ -1913,6 +1913,9 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int rate_emu_sleep(ist); + if (ist->st->sample_aspect_ratio.num) + decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; + for (i = 0; i < nb_output_streams; i++) { OutputStream *ost = &output_streams[i]; int frame_size, resample_changed; @@ -1941,8 +1944,6 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int ost->resample_pix_fmt = decoded_frame->format; } - if (ist->st->sample_aspect_ratio.num) - decoded_frame->sample_aspect_ratio = ist->st->sample_aspect_ratio; if (ist->st->codec->codec->capabilities & CODEC_CAP_DR1) { FrameBuffer *buf = decoded_frame->opaque; AVFilterBufferRef *fb = avfilter_get_video_buffer_ref_from_arrays( From b6c4518a87fa7c91d00cf4e1acf9230f308b8f14 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Thu, 29 Mar 2012 09:02:01 +0200 Subject: [PATCH 5/9] avconv: remove OutputStream.picref. It's only used inside transcode_video() and there's no point in preserving it between subsequent calls. So use a local variable instead. --- avconv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/avconv.c b/avconv.c index 7fefec4c00..cfd0d78955 100644 --- a/avconv.c +++ b/avconv.c @@ -243,7 +243,6 @@ typedef struct OutputStream { AVFilterContext *output_video_filter; AVFilterContext *input_video_filter; - AVFilterBufferRef *picref; char *avfilter; AVFilterGraph *graph; @@ -1971,21 +1970,22 @@ static int transcode_video(InputStream *ist, AVPacket *pkt, int *got_output, int frame_available = avfilter_poll_frame(ost->output_video_filter->inputs[0]); while (frame_available) { + AVFilterBufferRef *picref; AVRational ist_pts_tb; if ((ret = get_filtered_video_frame(ost->output_video_filter, - filtered_frame, &ost->picref, + filtered_frame, &picref, &ist_pts_tb)) < 0) goto fail; - filtered_frame->pts = av_rescale_q(ost->picref->pts, ist_pts_tb, AV_TIME_BASE_Q); + filtered_frame->pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q); if (!ost->frame_aspect_ratio) - ost->st->codec->sample_aspect_ratio = ost->picref->video->pixel_aspect; + ost->st->codec->sample_aspect_ratio = picref->video->pixel_aspect; do_video_out(output_files[ost->file_index].ctx, ost, filtered_frame, &frame_size, same_quant ? quality : ost->st->codec->global_quality); if (vstats_filename && frame_size) do_video_stats(output_files[ost->file_index].ctx, ost, frame_size); frame_available = ost->output_video_filter && avfilter_poll_frame(ost->output_video_filter->inputs[0]); - avfilter_unref_buffer(ost->picref); + avfilter_unref_buffer(picref); } } From 18ed3788b0ebdfde916eac969d7f9ecd5e884f39 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 27 Mar 2012 21:34:47 -0400 Subject: [PATCH 6/9] avutil: allow NULL linesize in av_samples_fill_arrays() and av_samples_alloc() --- libavutil/samplefmt.c | 9 ++++++--- libavutil/samplefmt.h | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 960168d852..761009f2e2 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -140,17 +140,20 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, int nb_channels, int nb_samples, enum AVSampleFormat sample_fmt, int align) { - int ch, planar, buf_size; + int ch, planar, buf_size, line_size; planar = av_sample_fmt_is_planar(sample_fmt); - buf_size = av_samples_get_buffer_size(linesize, nb_channels, nb_samples, + buf_size = av_samples_get_buffer_size(&line_size, nb_channels, nb_samples, sample_fmt, align); if (buf_size < 0) return buf_size; audio_data[0] = buf; for (ch = 1; planar && ch < nb_channels; ch++) - audio_data[ch] = audio_data[ch-1] + *linesize; + audio_data[ch] = audio_data[ch-1] + line_size; + + if (linesize) + *linesize = line_size; return 0; } diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index 4bd5da4471..0d6bde2732 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -139,7 +139,7 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * for packed layout. * * @param[out] audio_data array to be filled with the pointer for each channel - * @param[out] linesize calculated linesize + * @param[out] linesize calculated linesize, may be NULL * @param buf the pointer to a buffer containing the samples * @param nb_channels the number of channels * @param nb_samples the number of samples in a single channel @@ -157,7 +157,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) * * @param[out] audio_data array to be filled with the pointer for each channel - * @param[out] linesize aligned size for audio buffer(s) + * @param[out] linesize aligned size for audio buffer(s), may be NULL * @param nb_channels number of audio channels * @param nb_samples number of samples per channel * @param align buffer size alignment (1 = no alignment required) From 0109a09dc3850eb5dbff84a7bb50eb252a5a8f22 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Tue, 27 Mar 2012 21:31:14 -0400 Subject: [PATCH 7/9] avutil: use align == 0 for default alignment in audio sample buffer functions --- libavutil/avutil.h | 2 +- libavutil/samplefmt.c | 4 ++++ libavutil/samplefmt.h | 5 +++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/libavutil/avutil.h b/libavutil/avutil.h index 8a144a4668..7319c22bfa 100644 --- a/libavutil/avutil.h +++ b/libavutil/avutil.h @@ -153,7 +153,7 @@ #define LIBAVUTIL_VERSION_MAJOR 51 #define LIBAVUTIL_VERSION_MINOR 27 -#define LIBAVUTIL_VERSION_MICRO 1 +#define LIBAVUTIL_VERSION_MICRO 2 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 761009f2e2..2e0aa98f58 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -123,6 +123,10 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, if (!sample_size || nb_samples <= 0 || nb_channels <= 0) return AVERROR(EINVAL); + /* auto-select alignment if not specified */ + if (!align) + align = 32; + /* check for integer overflow */ if (nb_channels > INT_MAX / align || (int64_t)nb_channels * nb_samples > (INT_MAX - (align * nb_channels)) / sample_size) diff --git a/libavutil/samplefmt.h b/libavutil/samplefmt.h index 0d6bde2732..29a26f0b41 100644 --- a/libavutil/samplefmt.h +++ b/libavutil/samplefmt.h @@ -121,6 +121,7 @@ int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); * @param nb_channels the number of channels * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) * @return required buffer size, or negative error code on failure */ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, @@ -144,7 +145,7 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, * @param nb_channels the number of channels * @param nb_samples the number of samples in a single channel * @param sample_fmt the sample format - * @param align buffer size alignment (1 = no alignment required) + * @param align buffer size alignment (0 = default, 1 = no alignment) * @return 0 on success or a negative error code on failure */ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, @@ -160,7 +161,7 @@ int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, uint8_t *buf, * @param[out] linesize aligned size for audio buffer(s), may be NULL * @param nb_channels number of audio channels * @param nb_samples number of samples per channel - * @param align buffer size alignment (1 = no alignment required) + * @param align buffer size alignment (0 = default, 1 = no alignment) * @return 0 on success or a negative error code on failure * @see av_samples_fill_arrays() */ From c58846f3a8b64def1368f0d1bf42e15c75d09a85 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 5 Apr 2012 19:01:21 -0400 Subject: [PATCH 8/9] avcodec: use align == 0 for default alignment in avcodec_fill_audio_frame() Use default alignment in audio_get_buffer() --- libavcodec/avcodec.h | 2 +- libavcodec/utils.c | 4 ++-- libavcodec/version.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 3af4df1010..ef43962c2d 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -3828,7 +3828,7 @@ int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, * @param sample_fmt sample format * @param buf buffer to use for frame data * @param buf_size size of buffer - * @param align plane size sample alignment + * @param align plane size sample alignment (0 = default) * @return 0 on success, negative error code on failure */ int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4037bfd327..58b7865fa4 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -292,7 +292,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) buf_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples, avctx->sample_fmt, - 32); + 0); if (buf_size < 0) return AVERROR(EINVAL); @@ -334,7 +334,7 @@ static int audio_get_buffer(AVCodecContext *avctx, AVFrame *frame) } if ((ret = avcodec_fill_audio_frame(frame, avctx->channels, avctx->sample_fmt, buf->data[0], - buf->audio_data_size, 32))) + buf->audio_data_size, 0))) return ret; if (frame->extended_data == frame->data) diff --git a/libavcodec/version.h b/libavcodec/version.h index 9e42a27ebb..5719e7f564 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -22,7 +22,7 @@ #define LIBAVCODEC_VERSION_MAJOR 54 #define LIBAVCODEC_VERSION_MINOR 11 -#define LIBAVCODEC_VERSION_MICRO 0 +#define LIBAVCODEC_VERSION_MICRO 1 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ From 679a973e9701576b1c3c6d71838c45c10ac20564 Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Thu, 5 Apr 2012 19:09:51 -0400 Subject: [PATCH 9/9] avconv: use default alignment for audio buffer --- avconv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avconv.c b/avconv.c index cfd0d78955..2dce66f7f7 100644 --- a/avconv.c +++ b/avconv.c @@ -1014,7 +1014,7 @@ static int alloc_audio_output_buf(AVCodecContext *dec, AVCodecContext *enc, audio_buf_size = av_samples_get_buffer_size(NULL, enc->channels, audio_buf_samples, - enc->sample_fmt, 32); + enc->sample_fmt, 0); if (audio_buf_size < 0) return audio_buf_size;