Ticket #1693: head_patch.diff
| File head_patch.diff, 11.9 KB (added by , 20 years ago) |
|---|
-
libs/libmythtv/nuppeldecoder.cpp
36 36 audio_bits_per_sample(0), 37 37 #endif 38 38 ffmpeg_extradatasize(0), ffmpeg_extradata(0), usingextradata(false), 39 disablevideo(false), total Length(0), totalFrames(0), effdsp(0),39 disablevideo(false), totalFrames(0), effdsp(0), 40 40 directframe(NULL), decoded_video_frame(NULL), 41 41 mpa_codec(0), mpa_ctx(0), directrendering(false), 42 42 lastct('1'), strm(0), buf(0), buf2(0), … … 352 352 m_positionMap.push_back(e); 353 353 } 354 354 hasFullPositionMap = true; 355 totalLength = (int)((ste.keyframe_number * keyframedist * 1.0) /356 video_frame_rate);357 355 totalFrames = (long long)ste.keyframe_number * keyframedist; 358 GetNVP()->SetF ileLength(totalLength,totalFrames);356 GetNVP()->SetFrameCount(totalFrames); 359 357 360 358 delete [] seekbuf; 361 359 } … … 417 415 } 418 416 hasKeyFrameAdjustTable = true; 419 417 420 totalLength -= (int)(adjust / video_frame_rate);421 418 totalFrames -= adjust; 422 GetNVP()->SetF ileLength(totalLength,totalFrames);419 GetNVP()->SetFrameCount(totalFrames); 423 420 424 421 adjust = 0; 425 422 for (unsigned int i=0; i < m_positionMap.size(); i++) -
libs/libmythtv/NuppelVideoPlayer.cpp
151 151 seekamount(30), exactseeks(false), 152 152 // Playback misc. 153 153 videobuf_retries(0), framesPlayed(0), 154 totalFrames(0), totalLength(0),154 totalFrames(0), 155 155 rewindtime(0), m_recusage(inUseID), 156 156 // Input Video Attributes 157 157 video_width(0), video_height(0), video_size(0), … … 837 837 m_scan_tracker = (m_scan == kScan_Interlaced) ? 2 : 0; 838 838 } 839 839 840 void NuppelVideoPlayer::SetFileLength(int total, int frames)841 {842 totalLength = total;843 totalFrames = frames;844 }845 846 840 int NuppelVideoPlayer::OpenFile(bool skipDsp, uint retries, 847 841 bool allow_libmpeg2) 848 842 { … … 5101 5095 return; 5102 5096 } 5103 5097 5104 int playbackLen = totalLength;5098 int playbackLen = (int)((float)totalFrames / video_frame_rate); 5105 5099 5106 5100 if (livetv && livetvchain) 5107 5101 { … … 5116 5110 float secsplayed; 5117 5111 if (ringBuffer->isDVD()) 5118 5112 { 5113 playbackLen = ringBuffer->DVD()->GetTotalTimeOfTitle(); 5119 5114 if (!ringBuffer->DVD()->IsInMenu()) 5120 5115 secsplayed = ringBuffer->DVD()->GetCurrentTime(); 5121 5116 } -
libs/libmythtv/avformatdecoder.cpp
844 844 845 845 if (dur > 0) 846 846 { 847 GetNVP()->SetF ileLength((int)(dur), (int)(dur * fps));847 GetNVP()->SetFrameCount((long long)(dur * fps)); 848 848 } 849 849 else 850 850 { 851 851 // the pvr-250 seems to overreport the bitrate by * 2 852 852 float bytespersec = (float)bitrate / 8 / 2; 853 853 float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec; 854 GetNVP()->SetF ileLength((int)(secs), (int)(secs * fps));854 GetNVP()->SetFrameCount((long long)(secs * fps)); 855 855 } 856 856 857 857 // we will not see a position map from db or remote encoder, … … 1723 1723 { 1724 1724 long long index = m_positionMap.back().index; 1725 1725 long long totframes = index * keyframedist; 1726 uint length = (uint)((totframes * 1.0f) / fps); 1727 GetNVP()->SetFileLength(length, totframes); 1726 GetNVP()->SetFrameCount(totframes); 1728 1727 } 1729 1728 #endif 1730 1729 } … … 1766 1765 bitrate = (int)((pkt->pos * 8 * fps) / (framesRead - 1)); 1767 1766 float bytespersec = (float)bitrate / 8; 1768 1767 float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec; 1769 GetNVP()->SetF ileLength((int)(secs), (int)(secs * fps));1768 GetNVP()->SetFrameCount((long long)(secs * fps)); 1770 1769 } 1771 1770 #endif 1772 1771 } -
libs/libmythtv/nuppeldecoder.h
97 97 98 98 bool disablevideo; 99 99 100 int totalLength;101 100 long long totalFrames; 102 101 103 102 int effdsp; -
libs/libmythtv/NuppelVideoPlayer.h
128 128 void SetLiveTVChain(LiveTVChain *tvchain) { livetvchain = tvchain; } 129 129 void SetAudioSampleRate(int rate) { audio_samplerate = rate; } 130 130 void SetAudioStretchFactor(float factor) { audio_stretchfactor = factor; } 131 void Set Length(int len) { totalLength= len; }131 void SetFrameCount(long long len) { totalFrames = len; } 132 132 void SetAudioOutput (AudioOutput *ao) { audioOutput = ao; } 133 133 void SetVideoFilters(QString &filters) { videoFilterList = filters; } 134 134 void SetFramesPlayed(long long played) { framesPlayed = played; } … … 146 146 float a = 1.33333, FrameScanType scan = kScan_Ignore); 147 147 void SetAudioParams(int bits, int channels, int samplerate, bool passthru); 148 148 void SetEffDsp(int dsprate); 149 void SetFileLength(int total, int frames);150 149 void Zoom(int direction); 151 150 void ClearBookmark(void); 152 151 void SetForcedAspectRatio(int mpeg2_aspect_value, int letterbox_permission); … … 174 173 int GetFFRewSkip(void) const { return ffrew_skip; } 175 174 float GetAudioStretchFactor(void) const { return audio_stretchfactor; } 176 175 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); } 178 177 long long GetTotalFrameCount(void) const { return totalFrames; } 179 178 long long GetFramesPlayed(void) const { return framesPlayed; } 180 179 long long GetBookmark(void) const; … … 549 548 int videobuf_retries; 550 549 long long framesPlayed; 551 550 long long totalFrames; 552 long long totalLength;553 551 long long rewindtime; 554 552 QString m_recusage; 555 553 -
libs/libmythtv/tv_play.cpp
1272 1272 nvp->SetRecorder(recorder); 1273 1273 nvp->SetAudioSampleRate(gContext->GetNumSetting("AudioSampleRate", 44100)); 1274 1274 nvp->SetAudioDevice(gContext->GetSetting("AudioOutputDevice")); 1275 nvp->SetLength(playbackLen);1276 1275 nvp->SetExactSeeks(gContext->GetNumSetting("ExactSeeking", 0)); 1277 1276 nvp->SetAutoCommercialSkip(autoCommercialSkip); 1278 1277 nvp->SetLiveTVChain(tvchain); … … 1345 1344 pipnvp->SetAudioDevice(gContext->GetSetting("AudioOutputDevice")); 1346 1345 pipnvp->SetExactSeeks(gContext->GetNumSetting("ExactSeeking", 0)); 1347 1346 pipnvp->SetLiveTVChain(piptvchain); 1348 1349 pipnvp->SetLength(playbackLen);1350 1347 } 1351 1348 1352 1349 void TV::TeardownPlayer(void) … … 5172 5169 message = message.simplifyWhiteSpace(); 5173 5170 QStringList tokens = QStringList::split(" ", message); 5174 5171 int cardnum = tokens[1].toInt(); 5175 int filelen = tokens[2].toInt();5172 long long filelen = tokens[2].toLongLong(); 5176 5173 5177 5174 if (recorder && cardnum == recorder->GetRecorderNumber()) 5178 5175 { 5179 5176 nvp->SetWatchingRecording(false); 5180 nvp->Set Length(filelen);5177 nvp->SetFrameCount(filelen); 5181 5178 ChangeState(kState_WatchingPreRecorded); 5182 5179 } 5183 5180 } … … 5186 5183 message = message.simplifyWhiteSpace(); 5187 5184 QStringList tokens = QStringList::split(" ", message); 5188 5185 int cardnum = tokens[1].toInt(); 5189 int filelen = tokens[2].toInt();5186 long long filelen = tokens[2].toLongLong(); 5190 5187 5191 5188 if (recorder && cardnum == recorder->GetRecorderNumber() && 5192 5189 tvchain && tvchain->HasNext()) 5193 5190 { 5194 5191 nvp->SetWatchingRecording(false); 5195 nvp->Set Length(filelen);5192 nvp->SetFrameCount(filelen); 5196 5193 } 5197 5194 } 5198 5195 } -
libs/libmythtv/decoderbase.cpp
328 328 if (ringBuffer->isDVD()) 329 329 { 330 330 totframes = m_positionMap[m_positionMap.size() - 1].index; 331 length = ringBuffer->DVD()->GetTotalTimeOfTitle();332 331 } 333 332 else 334 333 { 335 334 totframes = 336 335 m_positionMap[m_positionMap.size()-1].index * keyframedist; 337 length = (int)((totframes * 1.0) / fps);338 336 } 339 337 340 GetNVP()->SetF ileLength(length,totframes);338 GetNVP()->SetFrameCount(totframes); 341 339 GetNVP()->SetKeyframeDistance(keyframedist); 342 340 posmapStarted = true; 343 341 344 342 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) 348 346 .arg(m_positionMap.size())); 349 347 } 350 348 recordingHasPositionMap |= !m_positionMap.empty(); -
libs/libmythtv/ivtvdecoder.cpp
295 295 float bytespersec = (float)bitrate / 8 / 2; 296 296 float secs = ringBuffer->GetRealFileSize() * 1.0 / bytespersec; 297 297 298 GetNVP()->SetF ileLength((int)(secs), (int)(secs * fps));298 GetNVP()->SetFrameCount((long long)(secs * fps)); 299 299 } 300 300 301 301 if (hasFullPositionMap) … … 397 397 float bytespersec = (float)bitrate / 8; 398 398 float secs = ringBuffer->GetRealFileSize() * 1.0 / 399 399 bytespersec; 400 GetNVP()->SetFileLength((int)(secs), 401 (int)(secs * fps)); 400 GetNVP()->SetFrameCount((long long)(secs * fps)); 402 401 } 403 402 404 403 } -
libs/libmythtv/tv_rec.cpp
926 926 927 927 if (recorder && HasFlags(kFlagRecorderRunning)) 928 928 { 929 // This is a bad way to calculate this, the framerate930 // may not be constant if using a DTV based recorder.931 filelen = (int)((float)GetFramesWritten() / GetFramerate());932 933 929 QString message = QString("DONE_RECORDING %1 %2") 934 .arg(cardid).arg( filelen);930 .arg(cardid).arg(GetFramesWritten()); 935 931 MythEvent me(message); 936 932 gContext->dispatch(me); 937 933
