MCPcopy Create free account
hub / github.com/codestation/qcma / loadCodec

Method loadCodec

common/avdecoder.cpp:60–90  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58}
59
60bool AVDecoder::loadCodec(codec_type codec)
61{
62 if(codec_loaded) {
63 return true;
64 }
65
66 AVDictionary *opts = NULL;
67
68 if((stream_index = av_find_best_stream(pFormatCtx, (AVMediaType)codec, -1, -1, &av_codec, 0)) < 0) {
69 return false;
70 }
71
72 av_stream = pFormatCtx->streams[stream_index];
73 pCodecCtx = avcodec_alloc_context3(av_codec);
74 if (!pCodecCtx) {
75 return false;
76 }
77 if (avcodec_parameters_to_context(pCodecCtx, av_stream->codecpar) < 0) {
78 avcodec_free_context(&pCodecCtx);
79 return false;
80 }
81
82 if(avcodec_open2(pCodecCtx, av_codec, &opts) < 0) {
83 avcodec_free_context(&pCodecCtx);
84 codec_loaded = false;
85 return false;
86 }
87
88 codec_loaded = true;
89 return true;
90}
91
92const char *AVDecoder::getMetadataEntry(const char *key, const char *default_value)
93{

Callers 2

insertMusicEntryMethod · 0.80
insertVideoEntryMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected