On Wed, Nov 02, 2011 at 04:27:40PM +0100, Nicolas George wrote:
Le septidi 7 brumaire, an CCXX, Michael Niedermayer a écrit :
+ CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), + CODEC_ID_8SVX_RAW = MKBETAG('8','S','V','X'), + CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'), + CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'), + CODEC_ID_XBIN = MKBETAG('X','B','I','N'), + CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'),
Using tags like that is a good idea; unfortunately, it will make avcodec_get_type fail, because it does not obey the rule it states: - video codecs from 1 to 0xffff, - audio codecs from 0x10000 to 0x16fff, - subtitles codecs from 0x17000 to 0x17fff.
the only use of avcodec_get_type() is mkv_query_codec() which is buggy per design because unknown codecs most likely come with fourcc in codec_tag and have no codec_id entry at all in the enum. Thus theres nothing to use as argument in the query. for the limited set where this API can work, maybe the patch below is enough ? but we could also reserve the first letter to specify the type what do you think ? --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -1436,6 +1436,12 @@ int avcodec_thread_init(AVCodecContext *s, int thread_count) enum AVMediaType avcodec_get_type(enum CodecID codec_id) { + AVCodec *c= avcodec_find_decoder(codec_id); + if(!c) + avcodec_find_encoder(codec_id); + if(c) + return c->type; + if (codec_id <= CODEC_ID_NONE) return AVMEDIA_TYPE_UNKNOWN; else if (codec_id < CODEC_ID_FIRST_AUDIO) [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 1 "Used only once" - "Some unspecified defect prevented a second use" "In good condition" - "Can be repaird by experienced expert" "As is" - "You wouldnt want it even if you were payed for it, if you knew ..."