Ticket #3028: passthrough_toggle-patch.diff
File passthrough_toggle-patch.diff, 10.3 KB (added by , 17 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
274 274 m_DeintSetting = gContext->GetNumSetting("Deinterlace", 0); 275 275 decode_extra_audio=gContext->GetNumSetting("DecodeExtraAudio", 0); 276 276 itvEnabled = gContext->GetNumSetting("EnableMHEG", 0); 277 passthru_enabled = gContext->GetNumSetting("InitPassThrough", 1); 277 278 278 279 lastIgnoredManualSkip = QDateTime::currentDateTime().addSecs(-10); 279 280 … … 3779 3780 paused = actuallypaused = true; 3780 3781 } 3781 3782 3783 3784 bool NuppelVideoPlayer::ToggleAudioPassThrough(void) 3785 { 3786 passthru_enabled = !passthru_enabled; 3787 if (decoder) { 3788 bool disabled = DoSetDisableAudioPassThrough(); 3789 3790 VERBOSE(VB_IMPORTANT, QString("PassThrough: %1").arg(disabled ? "Disabled" : "Enabled")); 3791 } 3792 return passthru_enabled; 3793 } 3794 3795 3796 bool NuppelVideoPlayer::AudioPassThroughAvailable(void) 3797 { 3798 return (play_speed == 1.00f) && decoder && decoder->CouldPassThrough(); 3799 } 3800 3801 3802 bool NuppelVideoPlayer::DoSetDisableAudioPassThrough() 3803 { 3804 bool disabled = !passthru_enabled; 3805 3806 if (!disabled) { 3807 disabled = !AudioPassThroughAvailable(); 3808 } 3809 if (decoder) { 3810 decoder->SetDisablePassThrough(disabled); 3811 } 3812 return disabled; 3813 } 3814 3815 3782 3816 void NuppelVideoPlayer::DoPlay(void) 3783 3817 { 3784 3818 bool skip_changed; … … 3874 3908 audio_stretchfactor = play_speed; 3875 3909 if (decoder) 3876 3910 { 3877 bool disable = (play_speed < 0.99f) || (play_speed > 1.01f); 3911 bool disable = DoSetDisableAudioPassThrough(); 3912 3878 3913 VERBOSE(VB_PLAYBACK, LOC + 3879 3914 QString("Stretch Factor %1, %2 passthru ") 3880 3915 .arg(audio_stretchfactor) 3881 3916 .arg((disable) ? "disable" : "allow")); 3882 decoder->SetDisablePassThrough(disable);3883 3917 } 3884 3918 if (audioOutput) 3885 3919 { … … 6450 6484 decoder = dec; 6451 6485 delete d; 6452 6486 } 6487 DoSetDisableAudioPassThrough(); 6453 6488 } 6454 6489 6455 6490 /** \fn NuppelVideoPlayer::LoadExternalSubtitles(const QString&) -
libs/libmythtv/decoderbase.h
68 68 void SetLowBuffers(bool low) { lowbuffers = low; } 69 69 /// Disables AC3/DTS pass through 70 70 virtual void SetDisablePassThrough(bool disable) { (void)disable; } 71 // Checks if could potentially passthrough (ignoring disable flag) 72 virtual bool CouldPassThrough(void) { return false; } 71 73 72 74 virtual void setWatchingRecording(bool mode); 73 75 virtual bool GetFrame(int onlyvideo) = 0; -
libs/libmythtv/avformatdecoder.cpp
3397 3397 } 3398 3398 } 3399 3399 3400 3401 bool AvFormatDecoder::CouldPassThrough(void) 3402 { 3403 bool could_passthru = false; 3404 AVStream *curstream = NULL; 3405 3406 if ((currentTrack[kTrackTypeAudio] >= 0) && 3407 (selectedTrack[kTrackTypeAudio].av_stream_index <= ic->nb_streams) && 3408 (curstream = ic->streams[selectedTrack[kTrackTypeAudio] 3409 .av_stream_index])) 3410 { 3411 could_passthru = DoCheckPassThrough(curstream->codec); 3412 } 3413 return could_passthru; 3414 } 3415 3416 3417 bool AvFormatDecoder::DoCheckPassThrough(AVCodecContext *codec_ctx) 3418 { 3419 bool could_passthru = false; 3420 3421 if (codec_ctx && !transcoding) 3422 { 3423 could_passthru = (allow_ac3_passthru && 3424 (codec_ctx->codec_id == CODEC_ID_AC3)); 3425 could_passthru |= (allow_dts_passthru && 3426 (codec_ctx->codec_id == CODEC_ID_DTS)); 3427 } 3428 return could_passthru; 3429 } 3430 3431 3400 3432 /** \fn AvFormatDecoder::SetupAudioStream(void) 3401 3433 * \brief Reinitializes audio if it needs to be reinitialized. 3402 3434 * … … 3420 3452 assert(curstream); 3421 3453 assert(curstream->codec); 3422 3454 codec_ctx = curstream->codec; 3423 bool do_ac3_passthru = (allow_ac3_passthru && !transcoding &&3424 !disable_passthru &&3425 (codec_ctx->codec_id == CODEC_ID_AC3));3426 bool do_dts_passthru = (allow_dts_passthru && !transcoding &&3427 !disable_passthru &&3428 (codec_ctx->codec_id == CODEC_ID_DTS));3429 3455 info = AudioInfo(codec_ctx->codec_id, 3430 3456 codec_ctx->sample_rate, codec_ctx->channels, 3431 do_ac3_passthru || do_dts_passthru);3457 !disable_passthru && DoCheckPassThrough(codec_ctx)); 3432 3458 } 3433 3459 3434 3460 if (info == audioIn) -
libs/libmythtv/tv_play.h
235 235 void ToggleMute(void); 236 236 void ToggleLetterbox(int letterboxMode = -1); 237 237 238 void ToggleAudioPassThrough(); 239 238 240 bool FillMenuTracks(OSDGenericTree*, uint type); 239 241 void ChangeTrack(uint type, int dir); 240 242 void SetTrack(uint type, int trackNo); -
libs/libmythtv/NuppelVideoPlayer.h
390 390 hidedvdbutton = hide; 391 391 } 392 392 393 bool ToggleAudioPassThrough(void); 394 bool AudioPassThroughAvailable(void); 395 393 396 protected: 394 397 void DisplayPauseFrame(void); 395 398 void DisplayNormalFrame(void); … … 502 505 long long GetDVDBookmark(void) const; 503 506 void SetDVDBookmark(long long frames); 504 507 508 bool DoSetDisableAudioPassThrough(void); 509 505 510 private: 506 511 VideoOutputType forceVideoOutput; 507 512 … … 776 781 777 782 // Debugging variables 778 783 Jitterometer *output_jmeter; 784 785 bool passthru_enabled; 779 786 }; 780 787 781 788 #endif -
libs/libmythtv/tv_play.cpp
326 326 REG_KEY("TV Playback", "JUMPTODVDROOTMENU", "Jump to the DVD Root Menu", ""); 327 327 REG_KEY("TV Playback", "EXITSHOWNOPROMPTS","Exit Show without any prompts", ""); 328 328 329 REG_KEY("TV Playback", "TOGGLEPASSTHRU", "Toggle Audio PassThrough",""); 330 329 331 /* Editing keys */ 330 332 REG_KEY("TV Editing", "CLEARMAP", "Clear editing cut points", "C,Q,Home"); 331 333 REG_KEY("TV Editing", "INVERTMAP", "Invert Begin/End cut points", "I"); … … 2237 2239 ToggleRecord(); 2238 2240 else if (action == "VOLUMEDOWN" || action == "VOLUMEUP" || 2239 2241 action == "STRETCHINC" || action == "STRETCHDEC" || 2240 action == "MUTE" || action == "TOGGLEASPECT") 2242 action == "MUTE" || action == "TOGGLEASPECT" || 2243 action == "TOGGLEPASSTHRU") 2241 2244 { 2242 2245 passThru = 1; 2243 2246 handled = false; … … 2288 2291 else if (action == "VOLUMEDOWN" || action == "VOLUMEUP" || 2289 2292 action == "STRETCHINC" || action == "STRETCHDEC" || 2290 2293 action == "MUTE" || action == "PAUSE" || 2291 action == "CLEAROSD" )2294 action == "CLEAROSD" || action == "TOGGLEPASSTHRU") 2292 2295 { 2293 2296 passThru = 1; 2294 2297 handled = false; … … 2811 2814 ChangeVolume(true); 2812 2815 else if (action == "MUTE") 2813 2816 ToggleMute(); 2817 else if (action == "TOGGLEPASSTHRU") 2818 ToggleAudioPassThrough(); 2814 2819 else if (action == "STRETCHINC") 2815 2820 ChangeTimeStretch(1); 2816 2821 else if (action == "STRETCHDEC") … … 4891 4896 tHrsMin.sprintf("%d:%02d", hours, min); 4892 4897 } 4893 4898 4894 4895 4899 void TV::ShowLCDDVDInfo(void) 4896 4900 { 4897 4901 class LCD * lcd = LCD::Get(); … … 5386 5390 GetOSD()->SetSettingsText(text, 5); 5387 5391 } 5388 5392 5393 5394 void TV::ToggleAudioPassThrough(void) 5395 { 5396 QString text; 5397 if (nvp->AudioPassThroughAvailable()) { 5398 bool passThr = nvp->ToggleAudioPassThrough(); 5399 5400 text = tr("PassThrough: %1").arg(passThr ? tr("Enabled") : 5401 tr("Disabled")); 5402 5403 if (GetOSD() && !browsemode) 5404 GetOSD()->SetSettingsText(text, 5); 5405 } 5406 } 5407 5408 5409 5389 5410 void TV::ToggleSleepTimer(void) 5390 5411 { 5391 5412 QString text; … … 6540 6561 DoQueueTranscode("Medium Quality"); 6541 6562 else if (action == "QUEUETRANSCODE_LOW") 6542 6563 DoQueueTranscode("Low Quality"); 6564 else if (action == "TOGGLEPASSTHRU") 6565 ToggleAudioPassThrough(); 6543 6566 else if (action.left(8) == "JUMPPROG") 6544 6567 { 6545 6568 SetJumpToProgram(action.section(" ",1,-2), … … 6701 6724 FillMenuTracks(treeMenu, kTrackTypeSubtitle); 6702 6725 FillMenuTracks(treeMenu, kTrackTypeCC708); 6703 6726 6727 if (nvp->AudioPassThroughAvailable()) 6728 item = new OSDGenericTree(treeMenu, tr("Toggle Audio PassThrough"), 6729 "TOGGLEPASSTHRU"); 6730 6704 6731 if (VBIMode::NTSC_CC == vbimode) 6705 6732 FillMenuTracks(treeMenu, kTrackTypeCC608); 6706 6733 else if (VBIMode::PAL_TT == vbimode) -
libs/libmythtv/avformatdecoder.h
123 123 MythCodecID GetVideoCodecID() const { return video_codec_id; } 124 124 125 125 virtual void SetDisablePassThrough(bool disable); 126 virtual bool CouldPassThrough(void); 126 127 void AddTextData(unsigned char *buf, int len, long long timecode, char type); 127 128 128 129 virtual QString GetTrackDesc(uint type, uint trackNo) const; … … 186 187 int width, int height); 187 188 188 189 void SeekReset(long long, uint skipFrames, bool doFlush, bool discardFrames); 190 bool DoCheckPassThrough(AVCodecContext *codec_ctx); 189 191 190 192 bool SetupAudioStream(void); 191 193 void SetupAudioStreamSubIndexes(int streamIndex); … … 259 261 bool dvd_xvmc_enabled; 260 262 bool dvd_video_codec_changed; 261 263 264 262 265 }; 263 266 264 267 #endif