[libav-api] Packet Stream Index for UDP Stream

Luca Barbato lu_zero at gentoo.org
Tue Apr 8 02:15:00 CEST 2014


On 08/04/14 00:24, Michael Rice wrote:
> Yes, this test is mpegts over UDP. Yes, the new stream comes with a new
> PID, so I didn't see a way to check if the PIDs match when I get the
> packet, since the AVPacket only has the stream index.

Nominally you cannot, since the ts demuxer correctly maps a new pid to a
new stream. I'm not sure why vlc does that though.

> The kludge I put in was to initialize the streamIndex to the last video
> stream in the list (I was initializing it to the first video stream). When
> the AVPacket.stream_index doesn't match, then recheck the stream list in
> the AVFormatContext to see if a new stream has been added, update my stored
> index to the new last video stream's index, and then compare against the
> received packet.

would be much simpler to check nb_streams

> However, I'd really like to know when a new stream is added, or at least
> get an error indicator (e.g., an EOF).

Let me think if there is a mean to deliver the information that is
better than just checking the nb_streams value.

lu




More information about the libav-api mailing list