Hi all,

my AVCHD video camera produces these "mts" files. FFmpeg supports them, I 
can play them with ffplay on FFMpeg 0.5 release compiled on Ubuntu.

Currently, I am working on a libavformat based demuxer plug-in for the 
Haiku operating system and also on improving the previously existing 
libavcodec based decoder plug-in.

For various reasons, these two things are separated, probably for similar 
reasons as to why libavformat and libavcodec are separated. For some 
codecs, it works fine to use the libavcodec based decoder with Haiku's 
non-libavformat based demuxer plug-ins and vice versa.

However, I am having trouble extracting H264 properly from mpegts content. 
I noticed I have to implement using AVProgram based AVInputFormats 
correctly, and as far as I can tell, I am extracting the packets from the 
correct stream. If I understand correctly, the AVProgram groups streams 
together and I have to use the 
avFormatContext->stream[avFormatContext->programs[programIWant]->stream_inde
x[streamIWant]].

In my demuxer implementation, I am using one AVFormatContext instance per 
stream that I want to demux. The reason is simply that I need to be able to 
seek streams individually and also read packets from different threads. 
This has made my packets extraction code much simpler compared to for 
example how it's done in ffplay, since I do not need to queue packets. I 
simply discard packets from streams which I don't need (actually, I found 
in the ffplay code how to discard unwanted streams, so I don't even have to 
do as much) and when I have got a packet for my stream, I return the buffer 
and packet size to the upper layers.

This packet buffer is then arriving at the decoder, which as I said is 
something completely independent from the libavformat based demuxer. A note 
on "extradata" perhaps. Both the avformat demuxer and later the avcodec 
decoder have to use an AVCodecContext instance. These are two separate 
instances, but I do pass the extradata from the libavformat instance on to 
the libavcodec decoder instance via some mechanism provided by the Haiku 
media API. For the H264 stream in question, I am not getting any extra 
data, though.

Sorry this got a bit longish... anyways, I would greatly appreciate any 
comments with regards to this setup, if it "should" work, or if it cannot 
work, since there is some hidden demuxer/decoder respectively 
libavformat/libavcodec dependencies when trying to decode "mpegts" streams. 
Thanks very much!

Best regards,
-Stephan
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to