Search code examples
javaffmpegjitsi

How to add a new ffmpeg codec id to libjitsi


I need to add support for AAC in my Java project that uses libjitsi and I'm getting lost trying to figure out how the org.jitsi.impl.neomedia.codec.FFmpeg.class determines the codec id's that it has internally. For instance CODEC_ID_MP3 exists with the value of 86017; how is that int determined? I am not a C / C++ guy, so even though I looked through the ffmpeg avcodec.h file, I don't understand why the majority of enums don't have values associated; even the CODEC_ID_MP3 is blank there. So in summary how would I add CODEC_ID_AAC and CODEC_ID_AAC_LATM to my extension of the FFmpeg class?


Solution

  • Thanks to Boris from Jitsi, I created this snippit from this header file:

    import org.jitsi.impl.neomedia.codec.FFmpeg;
    
    public class MyFFmpeg extends FFmpeg {
        // 1 enums past mp3
        public static final int CODEC_ID_AAC = FFmpeg.CODEC_ID_MP3 + 1;
        // 48 enums past mp3
        public static final int CODEC_ID_AAC_LATM = FFmpeg.CODEC_ID_MP3 + 48;
    
        public static void main(String[] args) {
            // expect 86018 and 86065
            System.out.println("AAC: " + CODEC_ID_AAC + ' ' + CODEC_ID_AAC_LATM);
        }
    }