[FFmpeg-devel] [PATCH] Make libavcodec/apiexample.c compile

Michael Niedermayer michaelni
Tue Mar 24 01:13:48 CET 2009


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

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Thouse who are best at talking, realize last or never when they are wrong.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090324/4da06c5f/attachment.pgp>



More information about the ffmpeg-devel mailing list