Ticket #4967: nowplaying_16344.2.diff
File nowplaying_16344.2.diff, 18.8 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/NuppelVideoPlayer.cpp
198 198 interactiveTV(NULL), 199 199 itvEnabled(false), 200 200 201 // Now Playing visible in OSD 202 has_now_playing(false), 203 now_playing_changed(false), 204 201 205 // OSD stuff 202 206 osd(NULL), timedisplay(NULL), 203 207 dialogname(""), dialogtype(0), … … 272 276 commnotifyamount = gContext->GetNumSetting("CommNotifyAmount",0); 273 277 decode_extra_audio=gContext->GetNumSetting("DecodeExtraAudio", 0); 274 278 itvEnabled = gContext->GetNumSetting("EnableMHEG", 0); 279 nowPlayEnabled = gContext->GetNumSetting("EnableNowPlaying", 0); 275 280 db_prefer708 = gContext->GetNumSetting("Prefer708Captions", 1); 276 281 282 osd_now_play_timeout = gContext->GetNumSetting("OSDNowPlayingTimeout", 10); 283 277 284 lastIgnoredManualSkip = QDateTime::currentDateTime().addSecs(-10); 278 285 279 286 bzero(&txtbuffers, sizeof(txtbuffers)); … … 2710 2717 ExpireSubtitles(); 2711 2718 } 2712 2719 2720 if (has_now_playing && nowPlayEnabled) 2721 DisplayNowPlaying(); 2722 2713 2723 // handle scan type changes 2714 2724 AutoDeint(frame); 2715 2725 … … 3150 3160 ringBuffer->Pause(); 3151 3161 ringBuffer->WaitForPause(); 3152 3162 3163 SetHasNowPlaying(false); 3164 3165 if (osd) 3166 osd->ResetNowPlaying(); 3167 3153 3168 ClearSubtitles(); 3154 3169 3155 3170 livetvchain->SetProgram(pginfo); … … 6821 6836 osd->ClearTextSubtitles(); 6822 6837 } 6823 6838 6839 /** \fn NuppelVideoPlayer::SetHasNowPlaying(void) 6840 * \brief Enables displaying of Now Playing content 6841 */ 6842 void NuppelVideoPlayer::SetHasNowPlaying(bool has) 6843 { 6844 if (nowPlayEnabled) 6845 { 6846 has_now_playing = has; 6847 6848 if (has_now_playing != has) 6849 { 6850 QString which = has ? "Enabling" : "Disabling"; 6851 VERBOSE(VB_PLAYBACK, LOC + QString("%1 Now Playing processing") 6852 .arg(which)); 6853 } 6854 } 6855 } 6856 6857 /** \fn NuppelVideoPlayer::HasNowPlaying(void) 6858 * \brief Returns bool stream has Now Playing 6859 */ 6860 bool NuppelVideoPlayer::HasNowPlaying(void) 6861 { 6862 return has_now_playing; 6863 } 6864 6865 /** \fn NuppelVideoPlayer::DisplayNowPlaying(void) 6866 * \brief Displays Now Playing text 6867 */ 6868 void NuppelVideoPlayer::DisplayNowPlaying() 6869 { 6870 QMutexLocker locker(&nowPlayingLock); 6871 6872 if (!nowPlayEnabled || 6873 !has_now_playing || 6874 !now_playing_changed) 6875 return; 6876 6877 QString text = "Now Playing:\n\n"; 6878 6879 // Skip if the first section is empty 6880 QString t = now_playing[0].simplifyWhiteSpace(); 6881 if (t.isEmpty()) 6882 return; 6883 6884 int i = 0; 6885 6886 for (QStringList::Iterator it = now_playing.begin(); 6887 it != now_playing.end(); ++it ) 6888 text.append(*it + "\n"); 6889 6890 osd->SetNowPlaying(text, osd_now_play_timeout); 6891 6892 now_playing_changed = false; 6893 } 6894 6824 6895 /** \fn NuppelVideoPlayer::ExpireSubtitles(void) 6825 6896 * \brief Discard non-displayed subtitles. 6826 6897 */ … … 6910 6981 subtitleLock.unlock(); 6911 6982 } 6912 6983 6984 /** \fn void NuppelVideoPlayer::SetNowPlaying(const QStringList playing&) 6985 * \brief Set the Now Playing text in the OSD. 6986 */ 6987 void NuppelVideoPlayer::SetNowPlaying(const QStringList &playing) 6988 { 6989 nowPlayingLock.lock(); 6990 now_playing = QDeepCopy<QStringList>(playing); 6991 nowPlayingLock.unlock(); 6992 6993 now_playing_changed = true; 6994 } 6995 6913 6996 /** \fn NuppelVideoPlayer::SetDecoder(DecoderBase*) 6914 6997 * \brief Sets the stream decoder, deleting any existing recorder. 6915 6998 */ -
libs/libmythtv/avformatdecoder.cpp
437 437 allow_dts_passthru = gContext->GetNumSetting("DTSPassThru", false); 438 438 max_channels = (uint) gContext->GetNumSetting("MaxChannels", 2); 439 439 440 nowPlayEnabled = gContext->GetNumSetting("EnableNowPlaying", 0); 441 440 442 audioIn.sample_size = -32; // force SetupAudioStream to run once 441 443 itv = GetNVP()->GetInteractiveTV(); 442 444 … … 1430 1432 tracks[kTrackTypeTeletextCaptions].clear(); 1431 1433 selectedVideoIndex = -1; 1432 1434 1435 GetNVP()->SetHasNowPlaying(false); 1436 1433 1437 map<int,uint> lang_sub_cnt; 1434 1438 map<int,uint> lang_aud_cnt; 1435 1439 … … 1655 1659 } 1656 1660 case CODEC_TYPE_DATA: 1657 1661 { 1658 ScanTeletextCaptions(i); 1659 bitrate += enc->bit_rate; 1662 switch(enc->codec_id) 1663 { 1664 case CODEC_ID_DSMCC_B: 1665 bitrate += enc->bit_rate; 1666 break; 1667 case CODEC_ID_DVB_VBI: 1668 ScanTeletextCaptions(i); 1669 bitrate += enc->bit_rate; 1670 break; 1671 case CODEC_ID_DVB_PRIVSEC: 1672 if (enc->bit_rate == 0) 1673 enc->bit_rate = 175; // 1 TS packet - 13 byte header 1674 break; 1675 } 1676 1660 1677 VERBOSE(VB_PLAYBACK, LOC + QString("data codec (%1)") 1661 1678 .arg(codec_type_string(enc->codec_type))); 1662 1679 break; … … 2423 2440 } 2424 2441 } 2425 2442 2443 void AvFormatDecoder::ProcessPrivSecDataPacket(const AVPacket *pkt) 2444 { 2445 if (!GetNVP()) 2446 return; 2447 2448 if (nowPlayEnabled) 2449 { 2450 QStringList sections; 2451 bool changed = false; 2452 uint non_ascii = 0; 2453 uint end = 0; 2454 2455 uint8_t *buf = pkt->data; 2456 uint len = pkt->size; 2457 2458 if (!len || len > 188) 2459 return; 2460 2461 // Sanity checks 2462 for (uint x = 0; x < len; x++) 2463 if (buf[x] == 0x00) 2464 len = end = x; 2465 else if (buf[x] > 0x7f) 2466 non_ascii++; 2467 2468 if ((non_ascii / len) > .4) 2469 return; 2470 2471 if (!end) 2472 return; 2473 2474 QString text = (const char*)buf; 2475 2476 if (text.contains(0x0a) > 10) 2477 return; 2478 2479 GetNVP()->SetHasNowPlaying(true); 2480 2481 for (int i = 0; i < text.contains(0x0a); i++) { 2482 QString section = text.section(0x0a, i, i); 2483 if (section == "") section = " "; 2484 2485 if ((i > now_playing.size()) || 2486 now_playing[i].compare(section)) 2487 { 2488 sections << section; 2489 changed = true; 2490 } 2491 } 2492 2493 if (changed) 2494 { 2495 now_playing = sections; 2496 GetNVP()->SetNowPlaying(sections); 2497 } 2498 } 2499 } 2500 2426 2501 /** \fn AvFormatDecoder::ProcessVBIDataPacket(const AVStream*, const AVPacket*) 2427 2502 * \brief Process ivtv proprietary embedded vertical blanking 2428 2503 * interval captions. … … 3314 3389 continue; 3315 3390 } 3316 3391 3392 if (len > 0 && 3393 curstream->codec->codec_type == CODEC_TYPE_DATA && 3394 curstream->codec->codec_id == CODEC_ID_DVB_PRIVSEC) 3395 { 3396 ProcessPrivSecDataPacket(pkt); 3397 3398 av_free_packet(pkt); 3399 continue; 3400 } 3401 3317 3402 // we don't care about other data streams 3318 3403 if (curstream->codec->codec_type == CODEC_TYPE_DATA) 3319 3404 { -
libs/libmythtv/tv_play.h
444 444 bool arrowAccel; 445 445 int osd_general_timeout; 446 446 int osd_prog_info_timeout; 447 int osd_now_play_timeout; 447 448 448 449 enum commSkipMode autoCommercialSkip; 449 450 bool tryUnflaggedSkip; … … 683 684 // Network Control stuff 684 685 QValueList<QString> networkControlCommands; 685 686 QMutex ncLock; 687 688 // Now Playing 689 bool nowPlayEnabled; 686 690 }; 687 691 688 692 #endif -
libs/libmythtv/NuppelVideoPlayer.h
299 299 long long timecode, char type); 300 300 void AddAVSubtitle(const AVSubtitle& subtitle); 301 301 302 // Now Playing data 303 void SetHasNowPlaying(bool has); 304 void SetNowPlaying(const QStringList &playing); 305 void DisplayNowPlaying(); 306 bool HasNowPlaying(void); 307 302 308 // Closed caption and teletext stuff 303 309 uint GetCaptionMode(void) const { return textDisplayMode; } 304 310 void ResetCaptions(uint mode_override = 0); … … 640 646 641 647 // Support for captions, teletext, etc. decoded by libav 642 648 QMutex subtitleLock; 649 QMutex nowPlayingLock; 643 650 /// This allows us to enable captions/subtitles later if the streams 644 651 /// are not immediately available when the video starts playing. 645 652 bool textDesired; … … 671 678 bool itvEnabled; 672 679 QMutex itvLock; 673 680 681 // Support for Now Playing 682 bool nowPlayEnabled; 683 QStringList now_playing; 684 bool has_now_playing; 685 bool now_playing_changed; 686 674 687 // OSD stuff 675 688 OSD *osd; 676 689 OSDSet *timedisplay; … … 727 740 long long lastCommSkipStart; 728 741 time_t lastSkipTime; 729 742 743 int osd_now_play_timeout; 744 730 745 long long deleteframe; 731 746 bool hasdeletetable; 732 747 bool hasblanktable; -
libs/libmythtv/osd.h
80 80 const QString &callsign, const QString &iconpath, 81 81 int length); 82 82 void SetChannumText(const QString &text, int length); 83 void SetNowPlaying(const QString &playing, int length); 84 void ResetNowPlaying(void); 83 85 84 86 // CC-608 and DVB text captions (not DVB/DVD subtitles). 85 87 void AddCCText(const QString &text, int x, int y, int color, -
libs/libmythtv/tv_play.cpp
508 508 jumptime(0), smartChannelChange(false), 509 509 MuteIndividualChannels(false), arrowAccel(false), 510 510 osd_general_timeout(2), osd_prog_info_timeout(3), 511 osd_now_play_timeout(10), 511 512 autoCommercialSkip(CommSkipOff), tryUnflaggedSkip(false), 512 513 smartForward(false), stickykeys(0), 513 514 ff_rew_repos(1.0f), ff_rew_reverse(false), … … 635 636 persistentbrowsemode = gContext->GetNumSetting("PersistentBrowseMode", 0); 636 637 osd_general_timeout = gContext->GetNumSetting("OSDGeneralTimeout", 2); 637 638 osd_prog_info_timeout= gContext->GetNumSetting("OSDProgramInfoTimeout", 3); 639 osd_now_play_timeout = gContext->GetNumSetting("OSDNowPlayingTimeout", 10); 638 640 autoCommercialSkip = (enum commSkipMode)gContext->GetNumSetting( 639 641 "AutoCommercialSkip", CommSkipOff); 640 642 tryUnflaggedSkip = gContext->GetNumSetting("TryUnflaggedSkip", 0); … … 642 644 stickykeys = gContext->GetNumSetting("StickyKeys"); 643 645 ff_rew_repos = gContext->GetNumSetting("FFRewReposTime", 100)/100.0; 644 646 ff_rew_reverse = gContext->GetNumSetting("FFRewReverse", 1); 647 nowPlayEnabled = gContext->GetNumSetting("EnableNowPlaying", 0); 645 648 int def[8] = { 3, 5, 10, 20, 30, 60, 120, 180 }; 646 649 for (uint i = 0; i < sizeof(def)/sizeof(def[0]); i++) 647 650 ff_rew_speeds.push_back( … … 5263 5266 osd->ClearAllText(whichInfo); 5264 5267 osd->HideAll(); 5265 5268 osd->SetText(whichInfo, infoMap, osd_prog_info_timeout); 5269 5270 if (nowPlayEnabled && nvp->HasNowPlaying()) 5271 osd->SetNowPlaying("", osd_now_play_timeout); 5266 5272 } 5267 5273 5268 5274 void TV::UpdateOSDSeekMessage(const QString &mesg, int disptime) -
libs/libmythtv/avformatdecoder.h
187 187 void MpegPreProcessPkt(AVStream *stream, AVPacket *pkt); 188 188 void H264PreProcessPkt(AVStream *stream, AVPacket *pkt); 189 189 190 void ProcessPrivSecDataPacket(const AVPacket *pkt); 190 191 void ProcessVBIDataPacket(const AVStream *stream, const AVPacket *pkt); 191 192 void ProcessDVBDataPacket(const AVStream *stream, const AVPacket *pkt); 192 193 void ProcessDSMCCPacket(const AVStream *stream, const AVPacket *pkt); … … 278 279 bool mpeg_seq_end_seen; 279 280 /// \brief contains last dvd still frame decoded 280 281 AVPacket *lastDVDStillFrame; 282 283 // Now Playing 284 QStringList now_playing; 285 bool nowPlayEnabled; 281 286 }; 282 287 283 288 #endif -
libs/libmythtv/osd.cpp
1939 1939 osdlock.unlock(); 1940 1940 } 1941 1941 1942 void OSD::ResetNowPlaying(void) 1943 { 1944 osdlock.lock(); 1945 1946 QString my_name = "now_playing"; 1947 1948 OSDSet *container = GetSet(my_name); 1949 if (container) 1950 { 1951 container->Hide(); 1952 1953 OSDTypeText *text = (OSDTypeText *)container->GetType("playing"); 1954 text->SetText(""); 1955 1956 m_setsvisible = false; 1957 changed = true; 1958 } 1959 1960 osdlock.unlock(); 1961 } 1962 1963 void OSD::SetNowPlaying(const QString &playing, int length) 1964 { 1965 osdlock.lock(); 1966 1967 QString my_name = "now_playing"; 1968 1969 OSDSet *container = GetSet(my_name); 1970 if (!container) 1971 { 1972 OSDSet *set = GetSet("now_playing"); 1973 if (!set) 1974 { 1975 VERBOSE(VB_IMPORTANT, "couldn't find now_playing dialog"); 1976 osdlock.unlock(); 1977 return; 1978 } 1979 1980 container = new OSDSet(*set); 1981 container->SetName(my_name); 1982 container->SetCache(true); 1983 container->SetPriority(0); 1984 container->SetAllowFade(true); 1985 AddSet(container, my_name, false); 1986 } 1987 1988 if (container) 1989 { 1990 OSDTypeText *text = (OSDTypeText *)container->GetType("playing"); 1991 1992 if (!playing.isNull() && !playing.isEmpty()) 1993 if (text) 1994 text->SetText(playing); 1995 1996 if (length > 0) 1997 container->DisplayFor(length * 1000000); 1998 else 1999 container->Display(); 2000 2001 m_setsvisible = true; 2002 changed = true; 2003 2004 //VERBOSE(VB_PLAYBACK, QString("NOW PLAYING: '%1'").arg(text->GetText())); 2005 } 2006 2007 osdlock.unlock(); 2008 } 2009 1942 2010 void OSD::SetChannumText(const QString &text, int length) 1943 2011 { 1944 2012 osdlock.lock(); -
libs/libavcodec/myth_utils.c
203 203 204 204 case CODEC_ID_DSMCC_B: return "DSMCC_B"; 205 205 206 /* private data codecs */ 207 case CODEC_ID_DVB_PRIVSEC: return "DVB_PRIVSEC"; 208 206 209 case CODEC_ID_MPEG2TS: return "MPEG2TS"; 207 210 } 208 211 return "Unknown Codec ID"; -
libs/libavcodec/avcodec.h
289 289 /* DSMCC codec */ 290 290 CODEC_ID_DSMCC_B, 291 291 292 /* Private Data */ 293 CODEC_ID_DVB_PRIVSEC= 0x19000, 294 292 295 CODEC_ID_MPEG2TS= 0x20000, /* _FAKE_ codec to indicate a raw MPEG-2 TS 293 296 * stream (only used by libavformat) */ 294 297 }; -
libs/libavformat/mpegts.c
866 866 case STREAM_TYPE_AUDIO_AAC: 867 867 case STREAM_TYPE_AUDIO_AC3: 868 868 case STREAM_TYPE_AUDIO_DTS: 869 case STREAM_TYPE_PRIVATE_SECTION: 869 870 case STREAM_TYPE_PRIVATE_DATA: 870 871 case STREAM_TYPE_VBI_DVB: 871 872 case STREAM_TYPE_SUBTITLE_DVB: … … 1454 1455 codec_type = CODEC_TYPE_DATA; 1455 1456 codec_id = CODEC_ID_DSMCC_B; 1456 1457 break; 1458 case STREAM_TYPE_PRIVATE_SECTION: 1459 codec_type = CODEC_TYPE_DATA; 1460 codec_id = CODEC_ID_DVB_PRIVSEC; 1461 break; 1457 1462 case STREAM_TYPE_PRIVATE_DATA: 1458 1463 default: 1459 1464 if (code >= 0x1c0 && code <= 0x1df) { … … 1553 1558 if (pes->total_size) 1554 1559 pes->total_size += 6; 1555 1560 pes->pes_header_size = pes->header[8] + 9; 1561 } else if (pes->header[0] == 0x00 && pes->header[1] == 0xd3 && 1562 pes->header[2] == 0xb0) { 1563 /* private sections */ 1564 if (!pes->st) { 1565 /* allocate stream */ 1566 new_pes_av_stream(pes, code); 1567 } 1568 if (pes->header[7] != 0x00 && pes->header[7] != 0x01) 1569 pes->state = MPEGTS_PESHEADER_FILL; 1570 else 1571 pes->state = MPEGTS_PAYLOAD; /* No PTS/DTS info */ 1556 1572 } else { 1557 1573 /* otherwise, it should be a table */ 1558 1574 /* skip packet */ -
programs/mythfrontend/globalsettings.cpp
1571 1571 return gs; 1572 1572 } 1573 1573 1574 static HostSpinBox *OSDNowPlayingTimeout() 1575 { 1576 HostSpinBox *gs = new HostSpinBox("OSDNowPlayingTimeout", 1, 60, 1); 1577 gs->setLabel(QObject::tr("Now Playing OSD time-out")); 1578 gs->setValue(10); 1579 gs->setHelpText(QObject::tr("If available, length of time the on-screen " 1580 "display will display Now Playing information.")); 1581 return gs; 1582 } 1583 1574 1584 static HostSpinBox *ThemeCacheSize() 1575 1585 { 1576 1586 HostSpinBox *gs = new HostSpinBox("ThemeCacheSize", 1, 1000, 1, true); … … 1898 1908 return gc; 1899 1909 } 1900 1910 1911 static HostCheckBox *EnableNowPlaying() 1912 { 1913 HostCheckBox *gc = new HostCheckBox("EnableNowPlaying"); 1914 gc->setLabel(QObject::tr("Enable Now Playing Information")); 1915 gc->setValue(false); 1916 gc->setHelpText(QObject::tr( 1917 "If enabled and available, Now Playing " 1918 "information will be activated. This is used for " 1919 "some DVB radio channels.")); 1920 return gc; 1921 } 1922 1901 1923 static HostCheckBox *PersistentBrowseMode() 1902 1924 { 1903 1925 HostCheckBox *gc = new HostCheckBox("PersistentBrowseMode"); … … 4694 4716 osd->addChild(new ThemeSelector("OSDTheme")); 4695 4717 osd->addChild(OSDGeneralTimeout()); 4696 4718 osd->addChild(OSDProgramInfoTimeout()); 4719 osd->addChild(OSDNowPlayingTimeout()); 4697 4720 osd->addChild(OSDFont()); 4698 4721 osd->addChild(OSDThemeFontSizeType()); 4699 4722 osd->addChild(EnableMHEG()); 4723 osd->addChild(EnableNowPlaying()); 4700 4724 osd->addChild(PersistentBrowseMode()); 4701 4725 addChild(osd); 4702 4726