[FFmpeg-devel] Google Summer of Code participation

Thilo Borgmann thilo.borgmann
Tue Apr 7 23:05:13 CEST 2009



Michael Niedermayer schrieb:
>
>   
>> diff --git a/ffmpeg.c b/ffmpeg.c
>> index cb15120..a35f282 100644
>> --- a/ffmpeg.c
>> +++ b/ffmpeg.c
>> @@ -1224,8 +1224,8 @@ static int output_packet(AVInputStream *ist, int ist_index,
>>                  data_size= samples_size;
>>                      /* XXX: could avoid copy if PCM 16 bits with same
>>                         endianness as CPU */
>> -                ret = avcodec_decode_audio2(ist->st->codec, samples, &data_size,
>> -                                           ptr, len);
>> +                ret = avcodec_decode_audio3(ist->st->codec, samples, &data_size,
>> +                                           pkt);
>>                  if (ret < 0)
>>                      goto fail_decode;
>>                  ptr += ret;
>>     
>
> this looks wrong
>
>   
Ok I think I got this. As ptr & len are changed later on, all operation 
on ptr & len have to be made inside the struct, which results in 
replacing ptr & len completely by avpkt->data & avpkt->size.
(The same have I done for api-example.c)

The *avpkt is a parameter to the function. Better to use a local 
AVPacket for the scope of the function so that the pointer and int in 
the original AVPacket are preserved?

TB



More information about the ffmpeg-devel mailing list