[FFmpeg-devel] [PATCH 1/2] Add request_sample_fmt field to AVCodecContext to allow user to request a specific sample format from the audio decoder.

Justin Ruggles justin.ruggles
Thu Mar 10 18:05:14 CET 2011


On 03/10/2011 11:45 AM, M?ns Rullg?rd wrote:

> M?ns Rullg?rd <mans at mansr.com> writes:
> 
>> Justin Ruggles <justin.ruggles at gmail.com> writes:
>>
>>> ---
>>>  libavcodec/avcodec.h |   12 ++++++++++--
>>>  libavcodec/options.c |    1 +
>>>  2 files changed, 11 insertions(+), 2 deletions(-)
>>>
>>>
>>> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
>>> index 3eedcf9..b36c35d 100644
>>> --- a/libavcodec/avcodec.h
>>> +++ b/libavcodec/avcodec.h
>>> @@ -32,8 +32,8 @@
>>>  #include "libavutil/cpu.h"
>>>
>>>  #define LIBAVCODEC_VERSION_MAJOR 52
>>> -#define LIBAVCODEC_VERSION_MINOR 113
>>> -#define LIBAVCODEC_VERSION_MICRO  2
>>> +#define LIBAVCODEC_VERSION_MINOR 114
>>> +#define LIBAVCODEC_VERSION_MICRO 0
>>>
>>>  #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
>>>                                                 LIBAVCODEC_VERSION_MINOR, \
>>> @@ -2900,6 +2900,14 @@ typedef struct AVCodecContext {
>>>       * - decoding: unused.
>>>       */
>>>      uint64_t vbv_delay;
>>> +
>>> +    /**
>>> +     * Request decoder to use this sample format if it can (AV_SAMPLE_FMT_NONE
>>> +     * for default).
>>> +     * - encoding: unused.
>>> +     * - decoding: Set by user.
>>> +     */
>>> +    enum AVSampleFormat request_sample_fmt;
>>>  } AVCodecContext;
>>>
>>>  /**
>>> diff --git a/libavcodec/options.c b/libavcodec/options.c
>>> index e4bc8a6..e0a4428 100644
>>> --- a/libavcodec/options.c
>>> +++ b/libavcodec/options.c
>>> @@ -436,6 +436,7 @@ static const AVOption options[]={
>>>  {"slice", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_SLICE, INT_MIN, INT_MAX, V|E|D, "thread_type"},
>>>  {"frame", NULL, 0, FF_OPT_TYPE_CONST, FF_THREAD_FRAME, INT_MIN, INT_MAX, V|E|D, "thread_type"},
>>>  {"vbv_delay", "initial buffer fill time in periods of 27Mhz clock", 0, FF_OPT_TYPE_INT64, 0, 0, INT64_MAX},
>>> +{"request_sample_fmt", NULL, OFFSET(request_sample_fmt), FF_OPT_TYPE_INT, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NONE, AV_SAMPLE_FMT_NB-1, A|D},
>>>  {NULL},
>>>  };
>>
>> Can this be used from the ffmpeg command line somehow?

yes.  ffmpeg -request_sample_fmt float -i input_file ...

> Or at least have ffmpeg.c request whatever input format the encoder
> wants?


maybe possible. I'll look into it.

-Justin



More information about the ffmpeg-devel mailing list