MCPcopy Create free account
hub / github.com/audeering/opensmile / configureWriter

Method configureWriter

src/ffmpeg/ffmpegSource.cpp:142–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

140}
141
142int cFFmpegSource::configureWriter(sDmLevelConfig &c)
143{
144 // instead of using the default log callback, we define a custom one which uses cSmileLogger
145 av_log_set_level(AV_LOG_VERBOSE);
146 av_log_set_callback(avLogCallback);
147
148 // av_register_all has been deprecated starting liibavformat 58.9.100 and needs not to be called anymore
149#if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(58, 9, 100)
150 av_register_all();
151#endif
152
153 int ret;
154
155 if ((ret = avformat_open_input(&avFormatContext, filename, NULL, NULL)) < 0) {
156 COMP_ERR("FFmpeg failed to open the file '%s'! %s",filename,avGetErrorString(ret));
157 }
158
159 if ((ret = avformat_find_stream_info(avFormatContext, NULL)) < 0) {
160 COMP_ERR("could not find stream information of file '%s'! %s",filename,avGetErrorString(ret));
161 }
162
163 openAVCodecContext(&audioStreamIndex, &avCodecContext, avFormatContext);
164
165 // log debug info about audio format
166 av_dump_format(avFormatContext, 0, filename, 0);
167
168 avFrame = av_frame_alloc();
169 if (!avFrame) {
170 COMP_ERR("could not allocate frame! Out of memory?");
171 }
172
173 // set config parameters
174 c.T = 1.0/avCodecContext->sample_rate;
175 c.N = avCodecContext->channels;
176 c.noTimeMeta = true;
177
178 return 1;
179}
180
181int cFFmpegSource::setupNewNames(long nEl)
182{

Callers

nothing calls this directly

Calls 1

avGetErrorStringFunction · 0.85

Tested by

no test coverage detected