Ticket #4070: 4070-v1.patch

File 4070-v1.patch, 9.2 KB (added by danielk, 18 years ago)

fix for video filters..

  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    215215      yuv_scaler(NULL),             yuv_frame_scaled(NULL),
    216216      yuv_scaler_in_size(0,0),      yuv_scaler_out_size(0,0),
    217217      // Filters
    218       videoFilterList(""),
     218      videoFiltersForProgram(""),   videoFiltersOverride(""),
    219219      postfilt_width(0),            postfilt_height(0),
    220220      videoFilters(NULL),           FiltMan(new FilterManager()),
    221221      // Commercial filtering
     
    264264    vbimode = VBIMode::Parse(gContext->GetSetting("VbiFormat"));
    265265
    266266    if (info)
    267     {
    268         m_playbackinfo = new ProgramInfo(*info);
    269         m_playbackinfo->MarkAsInUse(true, m_recusage);
    270     }
     267        SetPlaybackInfo(new ProgramInfo(*info));
    271268
    272269    commrewindamount = gContext->GetNumSetting("CommRewindAmount",0);
    273270    commnotifyamount = gContext->GetNumSetting("CommNotifyAmount",0);
     
    296293    if (audioOutput)
    297294        delete audioOutput;
    298295
    299     if (m_playbackinfo)
    300     {
    301         m_playbackinfo->MarkAsInUse(false);
    302         delete m_playbackinfo;
    303     }
     296    SetPlaybackInfo(NULL);
    304297
    305298    if (weMadeBuffer)
    306299        delete ringBuffer;
     
    506499    return video_actually_paused;
    507500}
    508501
     502void NuppelVideoPlayer::SetPlaybackInfo(ProgramInfo *pginfo)
     503{
     504    if (m_playbackinfo)
     505    {
     506        m_playbackinfo->MarkAsInUse(false);
     507        delete m_playbackinfo;
     508        videoFiltersForProgram = QString::null;
     509    }
     510
     511    m_playbackinfo = pginfo;
     512
     513    if (m_playbackinfo)
     514    {
     515        m_playbackinfo->MarkAsInUse(true, m_recusage);
     516        videoFiltersForProgram =
     517            QDeepCopy<QString>(m_playbackinfo->chanOutputFilters);
     518    }
     519}
     520
    509521void NuppelVideoPlayer::SetPrebuffering(bool prebuffer)
    510522{
    511523    prebuffering_lock.lock();
     
    529541
    530542bool NuppelVideoPlayer::InitVideo(void)
    531543{
    532     InitFilters();
    533544    if (using_null_videoout)
    534545    {
    535546        videoOutput = new VideoOutputNull();
     
    610621
    611622    SetCaptionsEnabled(gContext->GetNumSetting("DefaultCCMode"), false);
    612623
     624    InitFilters();
     625
    613626    return true;
    614627}
    615628
     
    633646
    634647void NuppelVideoPlayer::ReinitVideo(void)
    635648{
    636     InitFilters();
    637 
    638649    vidExitLock.lock();
    639650    videofiltersLock.lock();
    640651
     
    676687        DisableCaptions(textDisplayMode, false);
    677688        SetCaptionsEnabled(true, false);
    678689    }
     690
     691    InitFilters();
    679692}
    680693
    681694QString NuppelVideoPlayer::ReinitAudio(void)
     
    11181131    VideoFrameType otmp = FMT_YV12;
    11191132    int btmp;
    11201133
     1134    QString filters = "";
     1135    if (videoOutput)
     1136        filters = videoOutput->GetFilters();
     1137
     1138    if (!videoFiltersForProgram.isEmpty())
     1139    {
     1140        if (videoFiltersForProgram[0] != '+')
     1141        {
     1142            filters = QDeepCopy<QString>(videoFiltersForProgram);
     1143        }
     1144        else
     1145        {
     1146            if ((filters.length() > 1) && (filters.right(1) != ","))
     1147                filters += ",";
     1148            filters += QDeepCopy<QString>(videoFiltersForProgram.mid(1));
     1149        }
     1150    }
     1151
     1152    if (!videoFiltersOverride.isEmpty())
     1153        filters = QDeepCopy<QString>(videoFiltersOverride);
     1154
    11211155    videofiltersLock.lock();
    11221156
    11231157    if (videoFilters)
     
    11251159
    11261160    postfilt_width = video_width;
    11271161    postfilt_height = video_height;
    1128     videoFilters = FiltMan->LoadFilters(videoFilterList, itmp, otmp,
     1162    videoFilters = FiltMan->LoadFilters(filters, itmp, otmp,
    11291163                                        postfilt_width, postfilt_height, btmp);
    11301164
     1165    VERBOSE(VB_PLAYBACK, LOC + QString("LoadFilters('%1'..) -> ")
     1166            .arg(filters)<<videoFilters);
     1167
    11311168    videofiltersLock.unlock();
    11321169}
    11331170
     
    28772914
    28782915    bool newIsDummy = livetvchain->GetCardType(newid) == "DUMMY";
    28792916
    2880     if (m_playbackinfo)
    2881     {
    2882         m_playbackinfo->MarkAsInUse(false);
    2883         delete m_playbackinfo;
    2884     }
     2917    SetPlaybackInfo(pginfo);
    28852918
    2886     m_playbackinfo = pginfo;
    2887     m_playbackinfo->MarkAsInUse(true, m_recusage);
    2888 
    28892919    ringBuffer->Pause();
    28902920    ringBuffer->WaitForPause();
    28912921
     
    29963026    long long nextpos = livetvchain->GetJumpPos();
    29973027    bool newIsDummy = livetvchain->GetCardType(newid) == "DUMMY";
    29983028   
    2999     if (m_playbackinfo)
    3000     {
    3001         m_playbackinfo->MarkAsInUse(false);
    3002         delete m_playbackinfo;
    3003     }
     3029    SetPlaybackInfo(pginfo);
    30043030
    3005     m_playbackinfo = pginfo;
    3006     m_playbackinfo->MarkAsInUse(true, m_recusage);
    3007 
    30083031    ringBuffer->Pause();
    30093032    ringBuffer->WaitForPause();
    30103033
  • libs/libmythtv/tv_play.h

     
    229229    void StartOSD(void);
    230230    void StopStuff(bool stopRingbuffers, bool stopPlayers, bool stopRecorders);
    231231   
    232     QString GetFiltersForChannel(void);
    233 
    234232    void ToggleChannelFavorite(void);
    235233    void ChangeChannel(int direction);
    236234    void ChangeChannel(uint chanid, const QString &channum);
  • libs/libmythtv/NuppelVideoPlayer.h

     
    139139    void SetRingBuffer(RingBuffer *rbuf)      { ringBuffer = rbuf; }
    140140    void SetLiveTVChain(LiveTVChain *tvchain) { livetvchain = tvchain; }
    141141    void SetLength(int len)                   { totalLength = len; }
    142     void SetVideoFilters(QString &filters)    { videoFilterList = filters; }
     142    void SetVideoFilters(const QString &override)
     143        { videoFiltersOverride = QDeepCopy<QString>(override); }
    143144    void SetFramesPlayed(long long played)    { framesPlayed = played; }
    144145    void SetEof(void)                         { eof = true; }
    145146    void SetPipPlayer(NuppelVideoPlayer *pip)
     
    414415    void AutoDeint(VideoFrame*);
    415416
    416417    // Private Sets
     418    void SetPlaybackInfo(ProgramInfo *pginfo);
    417419    void SetPrebuffering(bool prebuffer);
    418420
    419421    // Private Gets
     
    702704
    703705    // Filters
    704706    QMutex   videofiltersLock;
    705     QString  videoFilterList;
     707    QString  videoFiltersForProgram;
     708    QString  videoFiltersOverride;
    706709    int      postfilt_width;  ///< Post-Filter (output) width
    707710    int      postfilt_height; ///< Post-Filter (output) height
    708711    FilterChain   *videoFilters;
  • libs/libmythtv/tv_play.cpp

     
    15141514        return;
    15151515    }
    15161516
    1517     QString filters = "";
    1518    
    1519    
    15201517    nvp = new NuppelVideoPlayer("player", playbackinfo);
    15211518    nvp->SetParentWidget(myWindow);
    15221519    nvp->SetParentPlayer(this);
     
    15331530
    15341531    nvp->SetAudioStretchFactor(normal_speed);
    15351532
    1536     filters = GetFiltersForChannel();
    1537     nvp->SetVideoFilters(filters);
    1538 
    15391533    if (embedWinID > 0)
    15401534        nvp->EmbedInWidget(embedWinID, embedBounds.x(), embedBounds.y(),
    15411535                           embedBounds.width(), embedBounds.height());
     
    15501544        udpnotify = NULL;
    15511545}
    15521546
    1553 
    1554 QString TV::GetFiltersForChannel()
    1555 {
    1556     QString filters;
    1557     QString chanFilters;
    1558    
    1559     QString chan_name;
    1560 
    1561     pbinfoLock.lock();   
    1562     if (playbackinfo) // Recordings have this info already.
    1563         chanFilters = playbackinfo->chanOutputFilters;
    1564     pbinfoLock.unlock();   
    1565 
    1566     if ((chanFilters.length() > 1) && (chanFilters[0] != '+'))
    1567     {
    1568         filters = chanFilters;
    1569     }
    1570     else
    1571     {
    1572         filters = baseFilters;
    1573 
    1574         if ((filters.length() > 1) && (filters.right(1) != ","))
    1575             filters += ",";
    1576 
    1577         filters += chanFilters.mid(1);
    1578     }
    1579    
    1580     VERBOSE(VB_CHANNEL, LOC +
    1581             QString("Output filters for this channel are: '%1'").arg(filters));
    1582     return filters;
    1583 }
    1584 
    15851547void TV::SetupPipPlayer(void)
    15861548{
    15871549    if (pipnvp)
     
    73757337
    73767338        chain->JumpTo(-1, 1);
    73777339
    7378         QString filters = GetFiltersForChannel();
    7379         activenvp->SetVideoFilters(filters);
    73807340        activenvp->Play(normal_speed, true, false);
    73817341        activerbuffer->IgnoreLiveEOF(false);
    73827342    }
  • libs/libmythtv/videooutbase.cpp

     
    367367        osd->DisableFade();
    368368}
    369369
     370QString VideoOutput::GetFilters(void) const
     371{
     372    return db_vdisp_profile->GetFilters();
     373}
     374
    370375void VideoOutput::SetVideoFrameRate(float playback_fps)
    371376{
    372377    db_vdisp_profile->SetOutput(playback_fps);
  • libs/libmythtv/videooutbase.h

     
    207207
    208208    /// \brief returns QRect of PIP based on PIPLocation
    209209    virtual QRect GetPIPRect(int location, NuppelVideoPlayer *pipplayer = NULL);
     210
     211    QString GetFilters(void) const;
     212
    210213  protected:
    211214    void InitBuffers(int numdecode, bool extra_for_pause, int need_free,
    212215                     int needprebuffer_normal, int needprebuffer_small,