equal
deleted
inserted
replaced
286 { |
286 { |
287 AVFormatContext* pContext = NULL; |
287 AVFormatContext* pContext = NULL; |
288 QByteArray utf8path = filepath.toUtf8(); |
288 QByteArray utf8path = filepath.toUtf8(); |
289 if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0) |
289 if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0) |
290 return ""; |
290 return ""; |
|
291 #if LIBAFORMAT_VERSION_MAJOR < 54 |
|
292 if (av_find_stream_info(pContext) < 0) |
|
293 #else |
291 if (avformat_find_stream_info(pContext, NULL) < 0) |
294 if (avformat_find_stream_info(pContext, NULL) < 0) |
|
295 #endif |
292 return ""; |
296 return ""; |
293 |
297 |
294 int s = float(pContext->duration)/AV_TIME_BASE; |
298 int s = float(pContext->duration)/AV_TIME_BASE; |
295 QString desc = QString(tr("Duration: %1m %2s\n")).arg(s/60).arg(s%60); |
299 QString desc = QString(tr("Duration: %1m %2s\n")).arg(s/60).arg(s%60); |
296 for (int i = 0; i < pContext->nb_streams; i++) |
300 for (int i = 0; i < pContext->nb_streams; i++) |
320 desc += "\n"; |
324 desc += "\n"; |
321 } |
325 } |
322 AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0); |
326 AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0); |
323 if (pComment) |
327 if (pComment) |
324 desc += QString("\n") + pComment->value; |
328 desc += QString("\n") + pComment->value; |
325 #if LIBAVCODEC_VERSION_MAJOR < 54 |
329 #if LIBAFORMAT_VERSION_MAJOR < 54 |
326 av_close_input_file(pContext); |
330 av_close_input_file(pContext); |
327 #else |
331 #else |
328 avformat_close_input(&pContext); |
332 avformat_close_input(&pContext); |
329 #endif |
333 #endif |
330 return desc; |
334 return desc; |