Ticket #373: avcodecthreadsnew.diff

File avcodecthreadsnew.diff, 4.4 KB (added by anonymous, 19 years ago)
  • configure

    diff -urN mythtv-cvs/configure mythtv/configure
    old new  
    187187amr_wb="no"
    188188amr_nb_fixed="no"
    189189sunmlib="no"
    190 pthreads="no"
     190pthreads="yes"
    191191gpl="yes"
    192192memalignhack="no"
    193193
     
    12511251     extralibs="$extralibs -lpthread"
    12521252  fi
    12531253fi
     1254if test "$pthreads" = "yes" ; then
     1255  echo "HAVE_PTHREADS=yes" >> config.mak
     1256  echo "#define HAVE_PTHREADS 1" >> $TMPH
     1257  if test $targetos != FreeBSD; then
     1258     extralibs="$extralibs -lpthread"
     1259  fi
     1260fi
    12541261if test "$sdl" = "yes" ; then
    12551262  echo "CONFIG_SDL=yes" >> config.mak
    12561263  echo "SDL_LIBS=`sdl-config --libs`" >> config.mak
  • libs/libavcodec/libavcodec.pro

    diff -urN mythtv-cvs/libs/libavcodec/libavcodec.pro mythtv/libs/libavcodec/libavcodec.pro
    old new  
    4444
    4545LIBS += $$LOCAL_LIBDIR_X11
    4646
     47contains( HAVE_PTHREADS, yes) {
     48    SOURCES += pthread.c
     49}
     50
    4751contains( CONFIG_AC3, yes ) {
    4852    SOURCES += a52dec.c
    4953    !contains( CONFIG_A52BIN, yes ) {
  • libs/libmythtv/NuppelVideoRecorder.cpp

    diff -urN mythtv-cvs/libs/libmythtv/NuppelVideoRecorder.cpp mythtv/libs/libmythtv/NuppelVideoRecorder.cpp
    old new  
    130130    qualdiff = 3;
    131131    mp4opts = 0;
    132132    mb_decision = FF_MB_DECISION_SIMPLE;
     133    thread_count = 1;
    133134
    134135    oldtc = 0;
    135136    startnum = 0;
     
    238239        minquality = value;
    239240    else if (opt == "mpeg4qualdiff")
    240241        qualdiff = value;
     242    else if (opt == "mpeg4threadcount")
     243        thread_count = value;
    241244    else if (opt == "mpeg4optionvhq")
    242245    {
    243246        if (value)
     
    314317        SetIntOption(profile, "mpeg4maxquality");
    315318        SetIntOption(profile, "mpeg4minquality");
    316319        SetIntOption(profile, "mpeg4qualdiff");
     320        SetIntOption(profile, "mpeg4threadcount");
    317321        SetIntOption(profile, "mpeg4optionvhq");
    318322        SetIntOption(profile, "mpeg4option4mv");
    319323    }
     
    512516    if (codec.lower() == "huffyuv" || codec.lower() == "mjpeg")
    513517        mpa_ctx->strict_std_compliance = -1;
    514518
     519    if(thread_count > 1)
     520        if(avcodec_thread_init(mpa_ctx, thread_count))
     521          VERBOSE(VB_IMPORTANT, QString("AVCodec thread init failed"));
     522
    515523    pthread_mutex_lock(&avcodeclock);
    516524    if (avcodec_open(mpa_ctx, mpa_codec) < 0)
    517525    {
     
    15841592    pthread_join(audio_tid, NULL);
    15851593    if (vbimode)
    15861594        pthread_join(vbi_tid, NULL);
     1595
     1596    if(useavcodec && thread_count > 1)
     1597        avcodec_thread_free(mpa_ctx);
    15871598}
    15881599
    15891600void NuppelVideoRecorder::BufferIt(unsigned char *buf, int len)
  • libs/libmythtv/NuppelVideoRecorder.h

    diff -urN mythtv-cvs/libs/libmythtv/NuppelVideoRecorder.h mythtv/libs/libmythtv/NuppelVideoRecorder.h
    old new  
    245245    int qualdiff;
    246246    int mp4opts;
    247247    int mb_decision;
     248    int thread_count;
    248249
    249250    QString videoFilterList;
    250251    FilterChain *videoFilters;
  • libs/libmythtv/recordingprofile.cpp

    diff -urN mythtv-cvs/libs/libmythtv/recordingprofile.cpp mythtv/libs/libmythtv/recordingprofile.cpp
    old new  
    411411    };
    412412};
    413413
     414class MPEG4ThreadCount: public CodecParam, public SliderSetting {
     415public:
     416    MPEG4ThreadCount(const RecordingProfile& parent):
     417        CodecParam(parent, "mpeg4threadcount"),
     418        SliderSetting(1,8,1) {
     419
     420        setLabel(QObject::tr("Threads"));
     421        setValue(1);
     422        setHelpText(QObject::tr("Threads to use for encoding, set greater "
     423                    "than 1 for faster encoding with SMP or "
     424                    "HyperThreading."));
     425    };
     426};
     427
    414428class MPEG2bitrate: public CodecParam, public SliderSetting {
    415429public:
    416430    MPEG2bitrate(const RecordingProfile& parent):
     
    541555        params->addChild(new MPEG4MaxQuality(parent));
    542556        params->addChild(new MPEG4MinQuality(parent));
    543557        params->addChild(new MPEG4QualDiff(parent));
     558        params->addChild(new MPEG4ThreadCount(parent));
    544559        params->addChild(new MPEG4ScaleBitrate(parent));
    545560
    546561        HorizontalConfigurationGroup *hq;