QTfrontend/util/libav_iteraction.cpp
changeset 7813 7ac83d79b897
parent 7794 ab7b94c03bc9
equal deleted inserted replaced
7812:00696c1450da 7813:7ac83d79b897
    17  */
    17  */
    18 
    18 
    19 #include "libav_iteraction.h"
    19 #include "libav_iteraction.h"
    20 
    20 
    21 #if VIDEOREC
    21 #if VIDEOREC
    22 #define __STDC_CONSTANT_MACROS
       
    23 extern "C"
    22 extern "C"
    24 {
    23 {
    25 #include "libavformat/avformat.h"
    24 #include "libavformat/avformat.h"
    26 }
    25 }
    27 
    26 
   269 {
   268 {
   270     AVFormatContext* pContext = NULL;
   269     AVFormatContext* pContext = NULL;
   271     QByteArray utf8path = filepath.toUtf8();
   270     QByteArray utf8path = filepath.toUtf8();
   272     if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0)
   271     if (avformat_open_input(&pContext, utf8path.data(), NULL, NULL) < 0)
   273         return "";
   272         return "";
   274 #if LIBAFORMAT_VERSION_MAJOR < 54
   273 #if LIBAVFORMAT_VERSION_MAJOR < 54
   275     if (av_find_stream_info(pContext) < 0)
   274     if (av_find_stream_info(pContext) < 0)
   276 #else
   275 #else
   277     if (avformat_find_stream_info(pContext, NULL) < 0)
   276     if (avformat_find_stream_info(pContext, NULL) < 0)
   278 #endif
   277 #endif
   279         return "";
   278         return "";
   307         desc += "\n";
   306         desc += "\n";
   308     }
   307     }
   309     AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0);
   308     AVDictionaryEntry* pComment = av_dict_get(pContext->metadata, "comment", NULL, 0);
   310     if (pComment)
   309     if (pComment)
   311         desc += QString("\n") + pComment->value;
   310         desc += QString("\n") + pComment->value;
   312 #if LIBAFORMAT_VERSION_MAJOR < 54
   311 #if LIBAVFORMAT_VERSION_MAJOR < 54
   313     av_close_input_file(pContext);
   312     av_close_input_file(pContext);
   314 #else
   313 #else
   315     avformat_close_input(&pContext);
   314     avformat_close_input(&pContext);
   316 #endif
   315 #endif
   317     return desc;
   316     return desc;