Hi,
I am trying to count the number of packets in an mpeg2 elementary stream.
Doing it in two different ways, I get different results.

*Method 1:*
I use "packet_buffer" data member of my AVForamtContext media handle(let's
name if "pFormatCtx"), and simly count the number of the nodes in the linked
list like this:

AVPacketList *packetBuffer;
> int packet_count;
> packetBuffer = pFormatCtx -> packet_buffer;
> while(packetBuffer->next != NULL){
>     packet_count++;
>     packetBuffer = packetBuffer->next;
> }
>

*Method 2:*
I increment a counter whenever I read a packet using "av_read_frame()":

int packet_count;
>  while(av_read_frame(pFormatCtx, &packet)>=0) {
>     packet_count++;
> /*some code*/
> }
>

The first method results in "packet_count = 76", the second results in
"packet_count=375", while I know that "av_read_frame" in my case is simply
reading the "pkt" of the linked list "packet_buffer"(which is in
AVFormatContext object)
So, why is the result for the two case so different?
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to