On 5/5/2010 4:56 AM, Amol Gandigude wrote:
On Tue, May 4, 2010 at 9:53 PM, Michael Georgoulopoulos<
[email protected]> wrote:
Hello
Can anyone please tell me what is the AVInputFormat parameter to the
av_open_input_stream() function? Previewsly I used av_open_input_file() and
set that parameter to NULL, but with av_open_input_stream() this parameter
is required.
Thank you
Michael
__________________
char* inputFormat ="mpegts" ; // you have to give your file format name
AVFormatContext *pFormatCtx;
pFormatCtx->iformat = av_find_input_format(inputFormat);
printf(stderr,"\nVideo Format:%s",pFormatCtx->iformat->name);
av_open_input_stream(&pFormatCtx,pb,file path,pFormatCtx->iformat,&ap);
Best regards
Amol
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Thanks, a quick note though. The above code, if used as-is will
definitely cause problems. If you wrote it as an example feel free to
ignore the following.
If the pFormatCtx pointer is used without being initialized:
pFormatCtx->iformat = av_find_input_format(inputFormat);
that would cause an access violation, unless you are extremely "lucky"
and the pointer happens to be a valid one, in which case you are going
to corrupt your memory somewhere.
On the other hand, if the pointer was initialized before,
av_open_input_stream will overwrite it anyway, which will result in a
memory leak.
Again apologies if I'm saying obvious things :)
Michael
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user