On 01/09/2012 12:23 AM, Ronald S. Bultje wrote:

> Hi,
> 
> On Fri, Jan 6, 2012 at 2:51 PM, Justin Ruggles <[email protected]> 
> wrote:
>> +static int packet_is_empty(AVPacket *pkt)
>> +{
>> +    return !(pkt->size > 0 || pkt->pts >= 0 || pkt->duration > 0 ||
>> +             pkt->side_data_elems > 0);
>> +}
> 
> pkt->pts != AV_NOPTS_VALUE?
> 
>> +    if (avcodec_encode_audio2(enc, &pkt, frame) < 0) {
>> +        av_log(NULL, AV_LOG_FATAL, "Audio encoding failed\n");
>> +        exit_program(1);
>> +    }
>> +
>> +    if (!packet_is_empty(&pkt)) {
> 
> I have to hmmmmm really loudly here. First of all, why isn't
> pkt.size!=0 not enough? If it's to update timestamps or side-data,
> isn't adding an extra argument to encode_audio2() (have_output_ptr)
> better, likt got_picture_ptr in avcodec_decode_videoX()?


Yes, my first thought was side-data or an empty packet with valid
timestamps having some potential meaning in some theoretical
codec/container. I wouldn't be opposed to adding a got_packet parameter
though.

-Justin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to