Ticket #2460: libavcodec-log-2.patch

File libavcodec-log-2.patch, 2.0 KB (added by paulx@…, 18 years ago)

Update to use VERBOSE to print message.

  • libs/libmyth/mythcontext.cpp

    old new QString safe_eno_to_string(int errnum) 
    153153    return QString("%1 (%2)").arg(strerror(errnum)).arg(errnum);
    154154}
    155155
     156extern "C"
     157{
     158#include "../libavutil/avutil.h"
     159}
     160
     161void myth_av_log(void *ptr, int level, const char* fmt, va_list vl)
     162{
     163    static QString full_line("");
     164
     165    if (level >= AV_LOG_DEBUG)
     166        return;
     167
     168    if ((print_verbose_messages & VB_LIBAV) != VB_LIBAV)
     169        return;
     170
     171    if (full_line.isEmpty() && ptr) {
     172        AVClass* avc = *(AVClass**)ptr;
     173        full_line.sprintf("[%s @ %p]", avc->item_name(ptr), avc);
     174    }
     175
     176    char str[256];
     177    vsprintf(str, fmt, vl);
     178
     179    full_line += QString(str);
     180    if (full_line.endsWith("\n"))
     181    {
     182        full_line.truncate(full_line.length() - 1);
     183        VERBOSE(VB_LIBAV, full_line);
     184        full_line.truncate(0);
     185    }
     186}
     187
    156188
    157189class MythContextPrivate
    158190{
    bool MythContextPrivate::Init(bool gui) 
    442474        StoreGUIsettings();
    443475    }
    444476
     477    av_log_set_callback(myth_av_log);
     478
    445479    return true;
    446480}
    447481
  • programs/mythuitest/mythuitest.pro

    old new  
    11INCLUDEPATH += ../../libs/libmythui ../../libs/libmyth
    22
    33LIBS += -L../../libs/libmyth -L../../libs/libmythui
     4LIBS += -L../../libs/libavutil
    45
    56include ( ../../config.mak )
    67include ( ../../settings.pro )
    TARGET = mythuitest 
    1011CONFIG += thread opengl
    1112
    1213LIBS += -lmythui-$$LIBVERSION -lmyth-$$LIBVERSION $$EXTRA_LIBS
     14LIBS += -lmythavutil-$$LIBVERSION
    1315
    1416isEmpty(QMAKE_EXTENSION_SHLIB) {
    1517  QMAKE_EXTENSION_SHLIB=so