Hello,
Thank you Stephan for your reply.
> It depends. When you iterate over the streams in your AVFormatContext, you
> can set any stream to be ignored, like so:
>
> // Discard all other streams
> for (unsigned i = 0; i < YourAVFormatContext->nb_streams; i++) {
> if (i != TheStreamIndexYouAreInterestedIn)
> YourAVFormatContext->streams[i]->discard =
> AVDISCARD_ALL;
> }
>
> And that does make sure that you never get any packages for the other
> streams from av_read_frame().
Oh OK.
> This is wrong, you need to open the stream like this, by passing your IO
> context to av_open_input_stream():
>
> ByteIOContext ByteIOCtx;
> init_put_byte(&ByteIOCtx, pDataBuffer, lSize, 0, this, &my_read, NULL,
> NULL); ...
>
> av_open_input_stream(&YourAVFormatContext, &ByteIOCtx, "",
> TheAVInputFormat, TheAVFormatParametersOrNULL);
Ok too. Then I have further questions:
1) pDataBuffer and lSize are variables that you declare yourself? And how big
should pDataBuffer be?
2) What is my influence to av_read_frame if I use such a callback function
my_read? Is it right that I can make av_read_frame to deliver a complete
frame consists of several NAL-Packets?
3) My Callbackfunction my_read looks like:
int my_read(void* opaq, uint8_t* buf, int size)
{
...
return size;
}
Depends the content of an AVPacket readed by av_read_frame by the size I
return in my_read?
My goal is to cut an transportstream consisting of h.264-content and
audiocontent. The only obstacle is that av_read_frame give me corrupted h.264
frames. MPEG2 is much easier. :-( Therefore I need a correct working
av_read_frame in connection with h.264-bitstream.
regards,
Sven
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user