[FFmpeg-devel] [PATCH] Make libavcodec/apiexample.c compile
Robert Swain
robert.swain
Tue Mar 24 03:24:55 CET 2009
On 24/3/09 00:13, Michael Niedermayer wrote:
> On Mon, Mar 23, 2009 at 07:10:41PM +0000, Robert Swain wrote:
>> On 23/3/09 05:43, Michael Niedermayer wrote:
>>> On Mon, Mar 23, 2009 at 12:35:29AM +0000, Robert Swain wrote:
>>>> On 20/3/09 15:56, Michael Niedermayer wrote:
>>>>> On Fri, Mar 20, 2009 at 03:33:33PM +0000, Robert Swain wrote:
>>>>>> Is anything more than the attached needed to bring
>>>>>> libavcodec/apiexample.c
>>>>> setting out_size
>>>> So the attached should do it? I thought it would be a good idea to set it
>>>> close to where it is allocated in case it is changed in future.
>>> [...]
>>>> @@ -138,6 +138,7 @@
>>>> }
>>>>
>>>> outbuf = malloc(AVCODEC_MAX_AUDIO_FRAME_SIZE);
>>>> + out_size = AVCODEC_MAX_AUDIO_FRAME_SIZE;
>>>>
>>>> f = fopen(filename, "rb");
>>>> if (!f) {
>>>> @@ -159,7 +160,7 @@
>>>>
>>>> inbuf_ptr = inbuf;
>>>> while (size> 0) {
>>>> - len = avcodec_decode_audio(c, (short *)outbuf,&out_size,
>>>> + len = avcodec_decode_audio2(c, (short *)outbuf,&out_size,
>>>> inbuf_ptr, size);
>>>> if (len< 0) {
>>>> fprintf(stderr, "Error while decoding\n");
>>> i just wanted to say ok, then i saw the while()
>>> is te out_size value correct if this is executed more than once?
>> Hmm, indeed. I think out_size needs to be reset before each call to
>> avcodec_decode_audio2(). See attached.
>
> ok
Applied.
Regards,
Rob
More information about the ffmpeg-devel
mailing list