ich versuche, diesen Code Dauer einer Mediendatei zu erhalten:AVFormat lib avformat_free_context
AVFormatContext* pFormatCtx = NULL;
avformat_open_input(&pFormatCtx, filename.c_str(), NULL, NULL);
if (pFormatCtx != 0) {
avformat_find_stream_info(pFormatCtx, NULL);
int64_t media_duration = pFormatCtx->duration;
duration = media_duration/AV_TIME_BASE;
avformat_close_input(&pFormatCtx);
avformat_free_context(pFormatCtx);
}
Das Problem ist, wenn ich rufe avformat_free_context() die App sterben, wenn ich das Programm die Zeile aus kommentieren funktioniert, aber ich lieber Speicherleck vermeiden.
PS: ich rufe av_register_all() beim Programmstart auf.