I am wondering, in code, what's the most reliable way to probe a file to see if ffmpeg will open it. I can open a context and see the return value. However, this returns true for image formats like jpeg, png, and others and I find those handled better with other libraries. Is there a way to have ffmpeg test to open only video codecs with no image codecs.
Currently the hack I have is:

bool aviImage::test_filename( const char* buf )
{
   AVFormatContext* ctx = NULL;
   int error = avformat_open_input( &ctx, buf, NULL, NULL );
   if ( ctx )
      avformat_close_input( &ctx );

   if ( error <= 0 ) return false;

   return true;
}

The error <= 0 line is intentional instead of just error < 0. This hack seems to avoid jpeg and others detection.

_______________________________________________
Libav-user mailing list
[email protected]
http://ffmpeg.org/mailman/listinfo/libav-user

Reply via email to