Hi everyone,

is there a generic way to find out whether a file opened with 
avformat_open_input() is actually an image file? I need to display an error if 
the user tries to open an image instead of a video. The current code loops 
through the codec_ids:

bool isImageCodec(AVCodecContext* context) {
    int imageCodecIDs[] = {CODEC_ID_PNG,... , -1};

    int i=0;
    while (imageCodecIDs[i] != -1) {
        if (imageCodecIDs[i] == context->codec_id) {
            return true;
        }
    }
    return false;
}

But that is obviously not very maintainable. It also fails for jpegs - these 
have CODEC_ID_MJPEG and thus are indistinguishable from mjpeg files.

Is there a better way to do this?

Thanks,

  Uli

--
Any technology distinguishable from magic is insufficiently advanced.

Ulrich von Zadow | +49-172-7872715
Jabber: [email protected]
Skype: uzadow



_______________________________________________
libav-api mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-api

Reply via email to