Ticket #1693: head_patch.diff

File head_patch.diff, 11.9 KB (added by perveilerj@…, 20 years ago)

patch against r9716

  • libs/libmythtv/nuppeldecoder.cpp

     
    3636      audio_bits_per_sample(0),
    3737#endif
    3838      ffmpeg_extradatasize(0), ffmpeg_extradata(0), usingextradata(false),
    39       disablevideo(false), totalLength(0), totalFrames(0), effdsp(0),
     39      disablevideo(false), totalFrames(0), effdsp(0),
    4040      directframe(NULL),            decoded_video_frame(NULL),
    4141      mpa_codec(0), mpa_ctx(0), directrendering(false),
    4242      lastct('1'), strm(0), buf(0), buf2(0),
     
    352352                    m_positionMap.push_back(e);
    353353                }
    354354                hasFullPositionMap = true;
    355                 totalLength = (int)((ste.keyframe_number * keyframedist * 1.0) /
    356                                      video_frame_rate);
    357355                totalFrames = (long long)ste.keyframe_number * keyframedist;
    358                 GetNVP()->SetFileLength(totalLength, totalFrames);
     356                GetNVP()->SetFrameCount(totalFrames);
    359357
    360358                delete [] seekbuf;
    361359            }
     
    417415                }
    418416                hasKeyFrameAdjustTable = true;
    419417
    420                 totalLength -= (int)(adjust / video_frame_rate);
    421418                totalFrames -= adjust;
    422                 GetNVP()->SetFileLength(totalLength, totalFrames);
     419                GetNVP()->SetFrameCount(totalFrames);
    423420
    424421                adjust = 0;
    425422                for (unsigned int i=0; i < m_positionMap.size(); i++)
  • libs/libmythtv/NuppelVideoPlayer.cpp

     
    151151      seekamount(30),               exactseeks(false),
    152152      // Playback misc.
    153153      videobuf_retries(0),          framesPlayed(0),
    154       totalFrames(0),               totalLength(0),
     154      totalFrames(0),
    155155      rewindtime(0),                m_recusage(inUseID),
    156156      // Input Video Attributes
    157157      video_width(0), video_height(0), video_size(0),
     
    837837    m_scan_tracker = (m_scan == kScan_Interlaced) ? 2 : 0;
    838838}
    839839
    840 void NuppelVideoPlayer::SetFileLength(int total, int frames)
    841 {
    842     totalLength = total;
    843     totalFrames = frames;
    844 }
    845 
    846840int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries,
    847841                                bool allow_libmpeg2)
    848842{
     
    51015095        return;
    51025096    }
    51035097
    5104     int playbackLen = totalLength;
     5098    int playbackLen = (int)((float)totalFrames / video_frame_rate);
    51055099   
    51065100    if (livetv && livetvchain)
    51075101    {
     
    51165110    float secsplayed;
    51175111    if (ringBuffer->isDVD())
    51185112    {
     5113        playbackLen = ringBuffer->DVD()->GetTotalTimeOfTitle();
    51195114        if (!ringBuffer->DVD()->IsInMenu())
    51205115            secsplayed = ringBuffer->DVD()->GetCurrentTime();
    51215116    }
  • libs/libmythtv/avformatdecoder.cpp

     
    844844
    845845        if (dur > 0)
    846846        {
    847             GetNVP()->SetFileLength((int)(dur), (int)(dur * fps));
     847            GetNVP()->SetFrameCount((long long)(dur * fps));
    848848        }
    849849        else
    850850        {
    851851            // the pvr-250 seems to overreport the bitrate by * 2
    852852            float bytespersec = (float)bitrate / 8 / 2;
    853853            float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec;
    854             GetNVP()->SetFileLength((int)(secs), (int)(secs * fps));
     854            GetNVP()->SetFrameCount((long long)(secs * fps));
    855855        }
    856856
    857857        // we will not see a position map from db or remote encoder,
     
    17231723            {
    17241724                long long index       = m_positionMap.back().index;
    17251725                long long totframes   = index * keyframedist;
    1726                 uint length = (uint)((totframes * 1.0f) / fps);
    1727                 GetNVP()->SetFileLength(length, totframes);
     1726                GetNVP()->SetFrameCount(totframes);
    17281727            }
    17291728#endif
    17301729        }
     
    17661765            bitrate = (int)((pkt->pos * 8 * fps) / (framesRead - 1));
    17671766            float bytespersec = (float)bitrate / 8;
    17681767            float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec;
    1769             GetNVP()->SetFileLength((int)(secs), (int)(secs * fps));
     1768            GetNVP()->SetFrameCount((long long)(secs * fps));
    17701769        }
    17711770#endif
    17721771    }
  • libs/libmythtv/nuppeldecoder.h

     
    9797
    9898    bool disablevideo;
    9999
    100     int totalLength;
    101100    long long totalFrames;
    102101
    103102    int effdsp;
  • libs/libmythtv/NuppelVideoPlayer.h

     
    128128    void SetLiveTVChain(LiveTVChain *tvchain) { livetvchain = tvchain; }
    129129    void SetAudioSampleRate(int rate)         { audio_samplerate = rate; }
    130130    void SetAudioStretchFactor(float factor)  { audio_stretchfactor = factor; }
    131     void SetLength(int len)                   { totalLength = len; }
     131    void SetFrameCount(long long len)         { totalFrames = len; }
    132132    void SetAudioOutput (AudioOutput *ao)     { audioOutput = ao; }
    133133    void SetVideoFilters(QString &filters)    { videoFilterList = filters; }
    134134    void SetFramesPlayed(long long played)    { framesPlayed = played; }
     
    146146                        float a = 1.33333, FrameScanType scan = kScan_Ignore);
    147147    void SetAudioParams(int bits, int channels, int samplerate, bool passthru);
    148148    void SetEffDsp(int dsprate);
    149     void SetFileLength(int total, int frames);
    150149    void Zoom(int direction);
    151150    void ClearBookmark(void);
    152151    void SetForcedAspectRatio(int mpeg2_aspect_value, int letterbox_permission);
     
    174173    int     GetFFRewSkip(void) const          { return ffrew_skip; }
    175174    float   GetAudioStretchFactor(void) const { return audio_stretchfactor; }
    176175    float   GetNextPlaySpeed(void) const      { return next_play_speed; }
    177     int     GetLength(void) const             { return totalLength; }
     176    int     GetLength(void) const             { return (int)((float)totalFrames / video_frame_rate); }
    178177    long long GetTotalFrameCount(void) const  { return totalFrames; }
    179178    long long GetFramesPlayed(void) const     { return framesPlayed; }
    180179    long long GetBookmark(void) const;
     
    549548    int       videobuf_retries;
    550549    long long framesPlayed;
    551550    long long totalFrames;
    552     long long totalLength;
    553551    long long rewindtime;
    554552    QString m_recusage;
    555553
  • libs/libmythtv/tv_play.cpp

     
    12721272    nvp->SetRecorder(recorder);
    12731273    nvp->SetAudioSampleRate(gContext->GetNumSetting("AudioSampleRate", 44100));
    12741274    nvp->SetAudioDevice(gContext->GetSetting("AudioOutputDevice"));
    1275     nvp->SetLength(playbackLen);
    12761275    nvp->SetExactSeeks(gContext->GetNumSetting("ExactSeeking", 0));
    12771276    nvp->SetAutoCommercialSkip(autoCommercialSkip);
    12781277    nvp->SetLiveTVChain(tvchain);
     
    13451344    pipnvp->SetAudioDevice(gContext->GetSetting("AudioOutputDevice"));
    13461345    pipnvp->SetExactSeeks(gContext->GetNumSetting("ExactSeeking", 0));
    13471346    pipnvp->SetLiveTVChain(piptvchain);
    1348 
    1349     pipnvp->SetLength(playbackLen);
    13501347}
    13511348
    13521349void TV::TeardownPlayer(void)
     
    51725169                message = message.simplifyWhiteSpace();
    51735170                QStringList tokens = QStringList::split(" ", message);
    51745171                int cardnum = tokens[1].toInt();
    5175                 int filelen = tokens[2].toInt();
     5172                long long filelen = tokens[2].toLongLong();
    51765173
    51775174                if (recorder && cardnum == recorder->GetRecorderNumber())
    51785175                {
    51795176                    nvp->SetWatchingRecording(false);
    5180                     nvp->SetLength(filelen);
     5177                    nvp->SetFrameCount(filelen);
    51815178                    ChangeState(kState_WatchingPreRecorded);
    51825179                }
    51835180            }
     
    51865183                message = message.simplifyWhiteSpace();
    51875184                QStringList tokens = QStringList::split(" ", message);
    51885185                int cardnum = tokens[1].toInt();
    5189                 int filelen = tokens[2].toInt();
     5186                long long filelen = tokens[2].toLongLong();
    51905187
    51915188                if (recorder && cardnum == recorder->GetRecorderNumber() &&
    51925189                    tvchain && tvchain->HasNext())
    51935190                {
    51945191                    nvp->SetWatchingRecording(false);
    5195                     nvp->SetLength(filelen);
     5192                    nvp->SetFrameCount(filelen);
    51965193                }
    51975194            }
    51985195        }
  • libs/libmythtv/decoderbase.cpp

     
    328328        if (ringBuffer->isDVD())
    329329        {
    330330            totframes = m_positionMap[m_positionMap.size() - 1].index;
    331             length = ringBuffer->DVD()->GetTotalTimeOfTitle();
    332331        }
    333332        else
    334333        {
    335334            totframes =
    336335                     m_positionMap[m_positionMap.size()-1].index * keyframedist;
    337             length = (int)((totframes * 1.0) / fps);
    338336        }
    339337
    340         GetNVP()->SetFileLength(length, totframes);
     338        GetNVP()->SetFrameCount(totframes);
    341339        GetNVP()->SetKeyframeDistance(keyframedist);
    342340        posmapStarted = true;
    343341
    344342        VERBOSE(VB_PLAYBACK,
    345                 QString("SyncPositionMap, new totframes: %1, new length: %2, "
    346                         "posMap size: %3")
    347                         .arg((long)totframes).arg(length)
     343                QString("SyncPositionMap, new totframes: %1, "
     344                        "posMap size: %2")
     345                        .arg((long)totframes)
    348346                        .arg(m_positionMap.size()));
    349347    }
    350348    recordingHasPositionMap |= !m_positionMap.empty();
  • libs/libmythtv/ivtvdecoder.cpp

     
    295295        float bytespersec = (float)bitrate / 8 / 2;
    296296        float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec;
    297297
    298         GetNVP()->SetFileLength((int)(secs), (int)(secs * fps));
     298        GetNVP()->SetFrameCount((long long)(secs * fps));
    299299    }
    300300
    301301    if (hasFullPositionMap)
     
    397397                            float bytespersec = (float)bitrate / 8;
    398398                            float secs = ringBuffer->GetRealFileSize() * 1.0 /
    399399                                             bytespersec;
    400                             GetNVP()->SetFileLength((int)(secs),
    401                                                     (int)(secs * fps));
     400                            GetNVP()->SetFrameCount((long long)(secs * fps));
    402401                        }
    403402
    404403                    }
  • libs/libmythtv/tv_rec.cpp

     
    926926
    927927    if (recorder && HasFlags(kFlagRecorderRunning))
    928928    {
    929         // This is a bad way to calculate this, the framerate
    930         // may not be constant if using a DTV based recorder.
    931         filelen = (int)((float)GetFramesWritten() / GetFramerate());
    932 
    933929        QString message = QString("DONE_RECORDING %1 %2")
    934             .arg(cardid).arg(filelen);
     930            .arg(cardid).arg(GetFramesWritten());
    935931        MythEvent me(message);
    936932        gContext->dispatch(me);
    937933