avcodec: Change values of codec ids at the end of lists that dont exist outside ffmpeg yet so
ffmpeg | branch: master | Michael Niedermayer <michaelni@gmx.at> | Mon Oct 24 21:40:23 2011 +0200| [4f587d163740d61b2571d8a0ed7ca1348078c989] | committer: Michael Niedermayer avcodec: Change values of codec ids at the end of lists that dont exist outside ffmpeg yet so they wont conflict when they get added to the fork with randomly changed order and values. Also add duplicate codec_ids to allow maintaining compatibility. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4f587d163740d61b25...
libavcodec/avcodec.h | 19 +++++++++++-------- 1 files changed, 11 insertions(+), 8 deletions(-) diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h index 401ce32..ad3dd01 100644 --- a/libavcodec/avcodec.h +++ b/libavcodec/avcodec.h @@ -212,12 +212,14 @@ enum CodecID { CODEC_ID_WMV3IMAGE, CODEC_ID_VC1IMAGE, #if LIBAVCODEC_VERSION_MAJOR == 53 - CODEC_ID_8SVX_RAW, - CODEC_ID_G2M, + CODEC_ID_G723_1_DEPRECATED, + CODEC_ID_G729_DEPRECATED, #endif CODEC_ID_UTVIDEO_DEPRECATED, CODEC_ID_UTVIDEO = 0x800, + CODEC_ID_G2M = MKBETAG( 0 ,'G','2','M'), + /* various PCM "codecs" */ CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs CODEC_ID_PCM_S16LE= 0x10000, @@ -350,11 +352,12 @@ enum CodecID { CODEC_ID_QDMC, CODEC_ID_CELT, #if LIBAVCODEC_VERSION_MAJOR > 53 - CODEC_ID_G723_1, - CODEC_ID_G729, + CODEC_ID_G723_1_DEPRECATED, + CODEC_ID_G729_DEPRECATED, #endif CODEC_ID_G729 = 0x15800, CODEC_ID_G723_1= 0x15801, + CODEC_ID_8SVX_RAW = MKBETAG('8','S','V','X'), /* subtitle codecs */ CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -367,14 +370,14 @@ enum CodecID { CODEC_ID_HDMV_PGS_SUBTITLE, CODEC_ID_DVB_TELETEXT, CODEC_ID_SRT, - CODEC_ID_MICRODVD, + CODEC_ID_MICRODVD = MKBETAG('m','D','V','D'), /* other specific kind of codecs (generally used for attachments) */ CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. CODEC_ID_TTF= 0x18000, - CODEC_ID_BINTEXT, - CODEC_ID_XBIN, - CODEC_ID_IDF, + CODEC_ID_BINTEXT = MKBETAG('B','T','X','T'), + CODEC_ID_XBIN = MKBETAG('X','B','I','N'), + CODEC_ID_IDF = MKBETAG( 0 ,'I','D','F'), CODEC_ID_PROBE= 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it
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. Regards, -- Nicolas George
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 ..."
On Wed, Nov 02, 2011 at 05:23:03PM +0100, Michael Niedermayer wrote:
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.
And to continue this argument further the correct API would have been to pass a AVCodecContext into query_codec(), this way query not only has the type for cases where no codec_id exists it also knows details like width, height and the profile which can be a factor in whenever its supported [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The educated differ from the uneducated as much as the living from the dead. -- Aristotle
On Wed, Nov 02, 2011 at 05:23:03PM +0100, Michael Niedermayer wrote:
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 ?
ill commit my patch in a moment (with the typo fixed) as it fixes a bug and a different solution can always be substituted its better not to leave it buggy [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB While the State exists there can be no freedom; when there is freedom there will be no State. -- Vladimir Lenin
Le duodi 12 brumaire, an CCXX, Michael Niedermayer a écrit :
ill commit my patch in a moment (with the typo fixed) as it fixes a bug and a different solution can always be substituted its better not to leave it buggy
No objection from me: I just reported the problem as I noticed it while doing something else. Thanks for the fix. Regards, -- Nicolas George
participants (3)
-
git@videolan.org -
Michael Niedermayer -
Nicolas George