I built a class with the use of the FFmpeg API to decode several audio files (mp3, ogg, G.729, etc) and load them into a data structure as raw audio data. Now for example when I run the following code:
codec = avcodec_find_decoder(AV_CODEC_ID_G729);
if (codec == NULL){
printf("Codec not found");
exit(1);
}
The program will indeed output the error message, but if I load mp3 or ogg codecs there's no issue.
So to double check I executed in the terminal ffmpeg -decoders
to see if the decoder is supported (which I also checked online) and outputs:
A....D g729 G.729
The FFmpeg version installed is 2.7.1 on a Debian system
API use example: https://www.ffmpeg.org/doxygen/2.7/decoding_encoding_8c-example.html
OK, so given the original comment sequence, I tried the most simple example I could come up with:
#include "libavcodec/avcodec.h"
int main() {
avcodec_register_all();
AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_G729);
if (!codec) {
fprintf(stderr, "Codec not found\n");
exit(1);
}
fprintf(stderr, "Codec found\n");
return 0;
}
and compiled this against my local ffmpeg tree, and that works fine:
$ /tmp/x
Codec found
So, something strange must be going on in your specific case. Can you give more information on for example how you compiled your self-compiled ffmpeg tree (in particular, your configure parameters, and also do "grep 729 config.h", your complete example code of how you're trying to run your piece of code (which wouldn't run by itself since it's missing avcodec_register_all(), but since you referred to api_example I'm assuming that your complete code does not have this problem, otherwise mp3/ogg wouldn't work), and compiler line used to compile/link it against your ffmpeg version.