diff options
62 files changed, 26 insertions, 6344 deletions
diff --git a/.gitignore b/.gitignore index 0ed6086e85..f13941f566 100644 --- a/.gitignore +++ b/.gitignore @@ -551,9 +551,6 @@ lib/cpluff/stamp-h1 /xbmc/messaging/Makefile /xbmc/messaging/helpers/Makefile -# /xbmc/music/ -/xbmc/music/karaoke/Makefile - # /xbmc/network/ /xbmc/network/Makefile /xbmc/network/httprequesthandler/python/Makefile diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index 3708f74363..01c2e44f31 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -583,7 +583,6 @@ 7CCDACCB19275D790074CF51 /* NptAppleLogConfig.mm in Sources */ = {isa = PBXBuildFile; fileRef = 7CCDACC019275D790074CF51 /* NptAppleLogConfig.mm */; }; 7CCF7FC9106A0DF500992676 /* TimeUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CCF7FC7106A0DF500992676 /* TimeUtils.cpp */; }; 7CDAE9050FFCA3520040B25F /* DVDTSCorrection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */; }; - 7CDAEA7D1001CD6E0040B25F /* karaokelyricstextustar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */; }; 7CEBD8A80F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */; }; 7CEE2E5B13D6B71E000ABF2A /* TimeSmoother.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEE2E5913D6B71E000ABF2A /* TimeSmoother.cpp */; }; 7CEE587D1B5A3FFB007C2B5A /* AudioDSPSettings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CEE587C1B5A3FFB007C2B5A /* AudioDSPSettings.cpp */; }; @@ -681,7 +680,6 @@ DF02BA621A910623006DCA16 /* VideoSyncIos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF02BA601A910623006DCA16 /* VideoSyncIos.cpp */; }; DF02BA661A91065F006DCA16 /* VideoSyncOsx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF02BA641A91065F006DCA16 /* VideoSyncOsx.cpp */; }; DF033D381946612400BFC82E /* AEDeviceEnumerationOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF033D361946612400BFC82E /* AEDeviceEnumerationOSX.cpp */; }; - DF07252E168734D7008DCAAD /* karaokevideobackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF07252C168734D7008DCAAD /* karaokevideobackground.cpp */; }; DF072534168734ED008DCAAD /* FFmpegVideoDecoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF072532168734ED008DCAAD /* FFmpegVideoDecoder.cpp */; }; DF0ABB73183A94A30018445D /* Utf8Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0ABB71183A94A30018445D /* Utf8Utils.cpp */; }; DF0ABB74183A94A30018445D /* Utf8Utils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF0ABB71183A94A30018445D /* Utf8Utils.cpp */; }; @@ -1727,18 +1725,6 @@ E4991379174E5F0E00741B6D /* MusicArtistInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E36C29E80DA72486001F0C9D /* MusicArtistInfo.cpp */; }; E499137A174E5F0E00741B6D /* MusicInfoScanner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E1D930D25F9FD00618676 /* MusicInfoScanner.cpp */; }; E499137B174E5F0E00741B6D /* MusicInfoScraper.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E1E670D25F9FD00618676 /* MusicInfoScraper.cpp */; }; - E499137C174E5F0E00741B6D /* GUIDialogKaraokeSongSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D00F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp */; }; - E499137D174E5F0E00741B6D /* GUIWindowKaraokeLyrics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AD1EA70F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp */; }; - E499137E174E5F0E00741B6D /* karaokelyrics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D60F1E785700D46E3C /* karaokelyrics.cpp */; }; - E499137F174E5F0E00741B6D /* karaokelyricscdg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D40F1E784800D46E3C /* karaokelyricscdg.cpp */; }; - E4991380174E5F0E00741B6D /* karaokelyricsfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E20F1E787700D46E3C /* karaokelyricsfactory.cpp */; }; - E4991381174E5F0E00741B6D /* karaokelyricsmanager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E10F1E787700D46E3C /* karaokelyricsmanager.cpp */; }; - E4991382174E5F0E00741B6D /* karaokelyricstext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E40F1E787700D46E3C /* karaokelyricstext.cpp */; }; - E4991383174E5F0E00741B6D /* karaokelyricstextkar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51DE0F1E787700D46E3C /* karaokelyricstextkar.cpp */; }; - E4991384174E5F0E00741B6D /* karaokelyricstextlrc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E30F1E787700D46E3C /* karaokelyricstextlrc.cpp */; }; - E4991385174E5F0E00741B6D /* karaokelyricstextustar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */; }; - E4991386174E5F0E00741B6D /* karaokevideobackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF07252C168734D7008DCAAD /* karaokevideobackground.cpp */; }; - E4991387174E5F0E00741B6D /* karaokewindowbackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */; }; E4991388174E5F0E00741B6D /* MusicInfoTag.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C85E129423A7009E7A26 /* MusicInfoTag.cpp */; }; E499138A174E5F0E00741B6D /* MusicInfoTagLoaderCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C866129423A7009E7A26 /* MusicInfoTagLoaderCDDA.cpp */; }; E499138B174E5F0E00741B6D /* MusicInfoTagLoaderDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 18B7C868129423A7009E7A26 /* MusicInfoTagLoaderDatabase.cpp */; }; @@ -2101,14 +2087,6 @@ F548786D0FE060FF00E506FD /* DVDSubtitleParserMPL2.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F548786C0FE060FF00E506FD /* DVDSubtitleParserMPL2.cpp */; }; F5487B4C0FE6F02700E506FD /* StreamDetails.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5487B4B0FE6F02700E506FD /* StreamDetails.cpp */; }; F54BCC5F1439345300F86B0F /* HotKeyController.m in Sources */ = {isa = PBXBuildFile; fileRef = F54BCC5E1439345300F86B0F /* HotKeyController.m */; }; - F54C51D20F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D00F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp */; }; - F54C51D50F1E784800D46E3C /* karaokelyricscdg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D40F1E784800D46E3C /* karaokelyricscdg.cpp */; }; - F54C51D80F1E785700D46E3C /* karaokelyrics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51D60F1E785700D46E3C /* karaokelyrics.cpp */; }; - F54C51E50F1E787700D46E3C /* karaokelyricstextkar.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51DE0F1E787700D46E3C /* karaokelyricstextkar.cpp */; }; - F54C51E60F1E787700D46E3C /* karaokelyricsmanager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E10F1E787700D46E3C /* karaokelyricsmanager.cpp */; }; - F54C51E70F1E787700D46E3C /* karaokelyricsfactory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E20F1E787700D46E3C /* karaokelyricsfactory.cpp */; }; - F54C51E80F1E787700D46E3C /* karaokelyricstextlrc.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E30F1E787700D46E3C /* karaokelyricstextlrc.cpp */; }; - F54C51E90F1E787700D46E3C /* karaokelyricstext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F54C51E40F1E787700D46E3C /* karaokelyricstext.cpp */; }; F558F25613ABCF7800631E12 /* WinEventsOSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = F558F25513ABCF7800631E12 /* WinEventsOSX.mm */; }; F558F27B13ABD56600631E12 /* DirtyRegionSolvers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F27913ABD56600631E12 /* DirtyRegionSolvers.cpp */; }; F558F27F13ABD57400631E12 /* DirtyRegionTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F558F27D13ABD57400631E12 /* DirtyRegionTracker.cpp */; }; @@ -2124,7 +2102,6 @@ F56352C816E5436900D21BAD /* AppParamParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56352C616E5436900D21BAD /* AppParamParser.cpp */; }; F56353BF16E9BB3500D21BAD /* BitstreamConverter.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56353BD16E9BB3500D21BAD /* BitstreamConverter.cpp */; }; F56579AF13060D1E0085ED7F /* RenderCapture.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56579AD13060D1E0085ED7F /* RenderCapture.cpp */; }; - F56A084B0F4A18FB003F9F87 /* karaokewindowbackground.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */; }; F57A1D1E1329B15300498CC7 /* AutoPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = F57A1D1D1329B15300498CC7 /* AutoPool.mm */; }; F57B6F801071B8B500079ACB /* JobManager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F57B6F7E1071B8B500079ACB /* JobManager.cpp */; }; F584E12E0F257C5100DB26A5 /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */; }; @@ -2147,7 +2124,6 @@ F5A9D3091097C9370050490F /* AliasShortcutUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5A9D3081097C9370050490F /* AliasShortcutUtils.cpp */; }; F5AACA680FB3DE2D00DBB77C /* GUIDialogSelect.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AACA670FB3DE2D00DBB77C /* GUIDialogSelect.cpp */; }; F5AACA970FB3E2B800DBB77C /* GUIDialogSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AACA950FB3E2B800DBB77C /* GUIDialogSlider.cpp */; }; - F5AD1EA80F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AD1EA70F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp */; }; F5AE409C13415D9E0004BD79 /* AudioLibrary.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AE408013415D9E0004BD79 /* AudioLibrary.cpp */; }; F5AE409F13415D9E0004BD79 /* FileItemHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AE408613415D9E0004BD79 /* FileItemHandler.cpp */; }; F5AE40A013415D9E0004BD79 /* FileOperations.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F5AE408813415D9E0004BD79 /* FileOperations.cpp */; }; @@ -3223,8 +3199,6 @@ 7CCF7FC8106A0DF500992676 /* TimeUtils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TimeUtils.h; sourceTree = "<group>"; }; 7CDAE9030FFCA3520040B25F /* DVDTSCorrection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DVDTSCorrection.cpp; sourceTree = "<group>"; }; 7CDAE9040FFCA3520040B25F /* DVDTSCorrection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DVDTSCorrection.h; sourceTree = "<group>"; }; - 7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricstextustar.cpp; sourceTree = "<group>"; }; - 7CDAEA7C1001CD6E0040B25F /* karaokelyricstextustar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricstextustar.h; sourceTree = "<group>"; }; 7CEBD8A60F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpecialProtocolDirectory.cpp; sourceTree = "<group>"; }; 7CEBD8A70F33A0D800CAF6AD /* SpecialProtocolDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpecialProtocolDirectory.h; sourceTree = "<group>"; }; 7CEE2E5913D6B71E000ABF2A /* TimeSmoother.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TimeSmoother.cpp; sourceTree = "<group>"; }; @@ -3403,8 +3377,6 @@ DF02BA651A91065F006DCA16 /* VideoSyncOsx.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = VideoSyncOsx.h; path = videosync/VideoSyncOsx.h; sourceTree = "<group>"; }; DF033D361946612400BFC82E /* AEDeviceEnumerationOSX.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AEDeviceEnumerationOSX.cpp; path = Sinks/osx/AEDeviceEnumerationOSX.cpp; sourceTree = "<group>"; }; DF033D371946612400BFC82E /* AEDeviceEnumerationOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AEDeviceEnumerationOSX.h; path = Sinks/osx/AEDeviceEnumerationOSX.h; sourceTree = "<group>"; }; - DF07252C168734D7008DCAAD /* karaokevideobackground.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokevideobackground.cpp; sourceTree = "<group>"; }; - DF07252D168734D7008DCAAD /* karaokevideobackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokevideobackground.h; sourceTree = "<group>"; }; DF072532168734ED008DCAAD /* FFmpegVideoDecoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FFmpegVideoDecoder.cpp; sourceTree = "<group>"; }; DF072533168734ED008DCAAD /* FFmpegVideoDecoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FFmpegVideoDecoder.h; sourceTree = "<group>"; }; DF0ABB71183A94A30018445D /* Utf8Utils.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Utf8Utils.cpp; sourceTree = "<group>"; }; @@ -4629,22 +4601,6 @@ F5487B4B0FE6F02700E506FD /* StreamDetails.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StreamDetails.cpp; sourceTree = "<group>"; }; F54BCC5D1439345300F86B0F /* HotKeyController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HotKeyController.h; sourceTree = "<group>"; }; F54BCC5E1439345300F86B0F /* HotKeyController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HotKeyController.m; sourceTree = "<group>"; }; - F54C51D00F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogKaraokeSongSelector.cpp; sourceTree = "<group>"; }; - F54C51D10F1E783200D46E3C /* GUIDialogKaraokeSongSelector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogKaraokeSongSelector.h; sourceTree = "<group>"; }; - F54C51D30F1E784800D46E3C /* karaokelyricscdg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricscdg.h; sourceTree = "<group>"; }; - F54C51D40F1E784800D46E3C /* karaokelyricscdg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricscdg.cpp; sourceTree = "<group>"; }; - F54C51D60F1E785700D46E3C /* karaokelyrics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyrics.cpp; sourceTree = "<group>"; }; - F54C51D70F1E785700D46E3C /* karaokelyrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyrics.h; sourceTree = "<group>"; }; - F54C51DB0F1E787700D46E3C /* karaokelyricsmanager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricsmanager.h; sourceTree = "<group>"; }; - F54C51DC0F1E787700D46E3C /* karaokelyricsfactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricsfactory.h; sourceTree = "<group>"; }; - F54C51DD0F1E787700D46E3C /* karaokelyricstext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricstext.h; sourceTree = "<group>"; }; - F54C51DE0F1E787700D46E3C /* karaokelyricstextkar.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricstextkar.cpp; sourceTree = "<group>"; }; - F54C51DF0F1E787700D46E3C /* karaokelyricstextkar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricstextkar.h; sourceTree = "<group>"; }; - F54C51E00F1E787700D46E3C /* karaokelyricstextlrc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokelyricstextlrc.h; sourceTree = "<group>"; }; - F54C51E10F1E787700D46E3C /* karaokelyricsmanager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricsmanager.cpp; sourceTree = "<group>"; }; - F54C51E20F1E787700D46E3C /* karaokelyricsfactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricsfactory.cpp; sourceTree = "<group>"; }; - F54C51E30F1E787700D46E3C /* karaokelyricstextlrc.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricstextlrc.cpp; sourceTree = "<group>"; }; - F54C51E40F1E787700D46E3C /* karaokelyricstext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokelyricstext.cpp; sourceTree = "<group>"; }; F558F25413ABCF7800631E12 /* WinEventsOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WinEventsOSX.h; sourceTree = "<group>"; }; F558F25513ABCF7800631E12 /* WinEventsOSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WinEventsOSX.mm; sourceTree = "<group>"; }; F558F27813ABD56600631E12 /* DirtyRegion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirtyRegion.h; sourceTree = "<group>"; }; @@ -4674,8 +4630,6 @@ F56353BE16E9BB3500D21BAD /* BitstreamConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BitstreamConverter.h; sourceTree = "<group>"; }; F56579AD13060D1E0085ED7F /* RenderCapture.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderCapture.cpp; sourceTree = "<group>"; }; F56579AE13060D1E0085ED7F /* RenderCapture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderCapture.h; sourceTree = "<group>"; }; - F56A08490F4A18FB003F9F87 /* karaokewindowbackground.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = karaokewindowbackground.h; sourceTree = "<group>"; }; - F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = karaokewindowbackground.cpp; sourceTree = "<group>"; }; F57A1D1C1329B15300498CC7 /* AutoPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AutoPool.h; sourceTree = "<group>"; }; F57A1D1D1329B15300498CC7 /* AutoPool.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AutoPool.mm; sourceTree = "<group>"; }; F57B6F7E1071B8B500079ACB /* JobManager.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JobManager.cpp; sourceTree = "<group>"; }; @@ -4714,8 +4668,6 @@ F5AACA670FB3DE2D00DBB77C /* GUIDialogSelect.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSelect.cpp; sourceTree = "<group>"; }; F5AACA950FB3E2B800DBB77C /* GUIDialogSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIDialogSlider.cpp; sourceTree = "<group>"; }; F5AACA960FB3E2B800DBB77C /* GUIDialogSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIDialogSlider.h; sourceTree = "<group>"; }; - F5AD1EA60F488A1A0065EB5D /* GUIWindowKaraokeLyrics.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GUIWindowKaraokeLyrics.h; sourceTree = "<group>"; }; - F5AD1EA70F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GUIWindowKaraokeLyrics.cpp; sourceTree = "<group>"; }; F5AE408013415D9E0004BD79 /* AudioLibrary.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = AudioLibrary.cpp; sourceTree = "<group>"; }; F5AE408113415D9E0004BD79 /* AudioLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioLibrary.h; sourceTree = "<group>"; }; F5AE408613415D9E0004BD79 /* FileItemHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FileItemHandler.cpp; sourceTree = "<group>"; }; @@ -5197,7 +5149,6 @@ children = ( 431376A812D640B500680C15 /* dialogs */, 431376CC12D6421A00680C15 /* infoscanner */, - 431376D412D6427900680C15 /* karaoke */, 18B7C854129423A7009E7A26 /* tags */, 431376DC12D6430600680C15 /* windows */, E36C29DC0DA72429001F0C9D /* Album.cpp */, @@ -5517,37 +5468,6 @@ path = infoscanner; sourceTree = "<group>"; }; - 431376D412D6427900680C15 /* karaoke */ = { - isa = PBXGroup; - children = ( - F54C51D00F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp */, - F54C51D10F1E783200D46E3C /* GUIDialogKaraokeSongSelector.h */, - F5AD1EA70F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp */, - F5AD1EA60F488A1A0065EB5D /* GUIWindowKaraokeLyrics.h */, - F54C51D60F1E785700D46E3C /* karaokelyrics.cpp */, - F54C51D70F1E785700D46E3C /* karaokelyrics.h */, - F54C51D40F1E784800D46E3C /* karaokelyricscdg.cpp */, - F54C51D30F1E784800D46E3C /* karaokelyricscdg.h */, - F54C51E20F1E787700D46E3C /* karaokelyricsfactory.cpp */, - F54C51DC0F1E787700D46E3C /* karaokelyricsfactory.h */, - F54C51E10F1E787700D46E3C /* karaokelyricsmanager.cpp */, - F54C51DB0F1E787700D46E3C /* karaokelyricsmanager.h */, - F54C51E40F1E787700D46E3C /* karaokelyricstext.cpp */, - F54C51DD0F1E787700D46E3C /* karaokelyricstext.h */, - F54C51DE0F1E787700D46E3C /* karaokelyricstextkar.cpp */, - F54C51DF0F1E787700D46E3C /* karaokelyricstextkar.h */, - F54C51E30F1E787700D46E3C /* karaokelyricstextlrc.cpp */, - F54C51E00F1E787700D46E3C /* karaokelyricstextlrc.h */, - 7CDAEA7B1001CD6E0040B25F /* karaokelyricstextustar.cpp */, - 7CDAEA7C1001CD6E0040B25F /* karaokelyricstextustar.h */, - DF07252C168734D7008DCAAD /* karaokevideobackground.cpp */, - DF07252D168734D7008DCAAD /* karaokevideobackground.h */, - F56A084A0F4A18FB003F9F87 /* karaokewindowbackground.cpp */, - F56A08490F4A18FB003F9F87 /* karaokewindowbackground.h */, - ); - path = karaoke; - sourceTree = "<group>"; - }; 431376DC12D6430600680C15 /* windows */ = { isa = PBXGroup; children = ( @@ -9520,20 +9440,10 @@ F584E12E0F257C5100DB26A5 /* HTTPDirectory.cpp in Sources */, 397877D51AAAF87700F98A45 /* Speed.cpp in Sources */, 7C8E02341BA35D0B0072E8B2 /* OpticalBuiltins.cpp in Sources */, - F54C51D20F1E783200D46E3C /* GUIDialogKaraokeSongSelector.cpp in Sources */, DF29BCF71B5D911800904347 /* MediaLibraryEvent.cpp in Sources */, 2F4564D51970129A00396109 /* GUIFontCache.cpp in Sources */, - F54C51D50F1E784800D46E3C /* karaokelyricscdg.cpp in Sources */, - F54C51D80F1E785700D46E3C /* karaokelyrics.cpp in Sources */, - F54C51E50F1E787700D46E3C /* karaokelyricstextkar.cpp in Sources */, - F54C51E60F1E787700D46E3C /* karaokelyricsmanager.cpp in Sources */, - F54C51E70F1E787700D46E3C /* karaokelyricsfactory.cpp in Sources */, - F54C51E80F1E787700D46E3C /* karaokelyricstextlrc.cpp in Sources */, - F54C51E90F1E787700D46E3C /* karaokelyricstext.cpp in Sources */, 7CEBD8A80F33A0D800CAF6AD /* SpecialProtocolDirectory.cpp in Sources */, 7C2D6AE40F35453E00DD2E85 /* SpecialProtocol.cpp in Sources */, - F5AD1EA80F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp in Sources */, - F56A084B0F4A18FB003F9F87 /* karaokewindowbackground.cpp in Sources */, F51CEEEF0F5C5D20004F4602 /* OSXGNUReplacements.c in Sources */, F5EA02260F6DA990005C2EC5 /* CocoaPowerSyscall.cpp in Sources */, F5EA02270F6DA9A5005C2EC5 /* PowerManager.cpp in Sources */, @@ -9551,7 +9461,6 @@ 7CDAE9050FFCA3520040B25F /* DVDTSCorrection.cpp in Sources */, E4DC97540FFE5BA8008E0C07 /* SAPDirectory.cpp in Sources */, E4DC97550FFE5BA8008E0C07 /* SAPFile.cpp in Sources */, - 7CDAEA7D1001CD6E0040B25F /* karaokelyricstextustar.cpp in Sources */, F5D8D732102BB3B1004A11AB /* OverlayRendererGL.cpp in Sources */, F5D8D733102BB3B1004A11AB /* OverlayRenderer.cpp in Sources */, E49ACD8C100745C400A86ECD /* ZeroconfDirectory.cpp in Sources */, @@ -9993,7 +9902,6 @@ F5EDC48C1651A6F900B852D8 /* GroupUtils.cpp in Sources */, 7C7CEAF1165629530059C9EB /* AELimiter.cpp in Sources */, DFB02DEA16629DBA00F37752 /* PyContext.cpp in Sources */, - DF07252E168734D7008DCAAD /* karaokevideobackground.cpp in Sources */, DF072534168734ED008DCAAD /* FFmpegVideoDecoder.cpp in Sources */, 7C8E02221BA35D0B0072E8B2 /* Builtins.cpp in Sources */, 395F6DE21A81FACF0088CC74 /* HTTPImageTransformationHandler.cpp in Sources */, @@ -10756,20 +10664,8 @@ E4991379174E5F0E00741B6D /* MusicArtistInfo.cpp in Sources */, E499137A174E5F0E00741B6D /* MusicInfoScanner.cpp in Sources */, E499137B174E5F0E00741B6D /* MusicInfoScraper.cpp in Sources */, - E499137C174E5F0E00741B6D /* GUIDialogKaraokeSongSelector.cpp in Sources */, - E499137D174E5F0E00741B6D /* GUIWindowKaraokeLyrics.cpp in Sources */, - E499137E174E5F0E00741B6D /* karaokelyrics.cpp in Sources */, 7C8E022C1BA35D0B0072E8B2 /* GUIContainerBuiltins.cpp in Sources */, DF54F8041B6580C8000FCBA4 /* ContextMenuAddon.cpp in Sources */, - E499137F174E5F0E00741B6D /* karaokelyricscdg.cpp in Sources */, - E4991380174E5F0E00741B6D /* karaokelyricsfactory.cpp in Sources */, - E4991381174E5F0E00741B6D /* karaokelyricsmanager.cpp in Sources */, - E4991382174E5F0E00741B6D /* karaokelyricstext.cpp in Sources */, - E4991383174E5F0E00741B6D /* karaokelyricstextkar.cpp in Sources */, - E4991384174E5F0E00741B6D /* karaokelyricstextlrc.cpp in Sources */, - E4991385174E5F0E00741B6D /* karaokelyricstextustar.cpp in Sources */, - E4991386174E5F0E00741B6D /* karaokevideobackground.cpp in Sources */, - E4991387174E5F0E00741B6D /* karaokewindowbackground.cpp in Sources */, E4991388174E5F0E00741B6D /* MusicInfoTag.cpp in Sources */, E499138A174E5F0E00741B6D /* MusicInfoTagLoaderCDDA.cpp in Sources */, E499138B174E5F0E00741B6D /* MusicInfoTagLoaderDatabase.cpp in Sources */, diff --git a/Makefile.in b/Makefile.in index 8ead761782..c85825260d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -64,7 +64,6 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \ xbmc/messaging/helpers/messagingHelpers.a \ xbmc/music/dialogs/musicdialogs.a \ xbmc/music/infoscanner/musicscanner.a \ - xbmc/music/karaoke/karaoke.a \ xbmc/music/music.a \ xbmc/music/tags/musictags.a \ xbmc/music/windows/musicwindows.a \ diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 7369139633..c40308c076 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -756,7 +756,6 @@ msgid "%s has been successfully started." msgstr "" #: xbmc/media/MediaTypes.cpp -#: xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp msgctxt "#179" msgid "Song" msgstr "" @@ -5808,7 +5807,6 @@ msgid "Last loaded profile:" msgstr "" #: xbmc/addons/GUIDialogAddonInfo.cpp -#: xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp #: xbmc/peripherals/devices/Peripheral.cpp #: xbmc/peripherals/bus/PeripheralBus.cpp msgctxt "#13205" @@ -6073,10 +6071,7 @@ msgctxt "#13322" msgid "Right only" msgstr "" -#: system/settings/settings.xml -msgctxt "#13323" -msgid "Enable karaoke support" -msgstr "" +#empty string with id 13323 msgctxt "#13324" msgid "Background transparency" @@ -6090,10 +6085,7 @@ msgctxt "#13326" msgid "A/V delay" msgstr "" -#: system/settings/settings.xml -msgctxt "#13327" -msgid "Karaoke" -msgstr "" +#empty string with id 13327 msgctxt "#13328" msgid "%s not found" @@ -13055,7 +13047,6 @@ msgid "Direct3D version:" msgstr "" #empty strings from id 22025 to 22029 -#strings 22030 thru 22060 reserved for karaoke #: system/settings/settings.xml msgctxt "#22030" @@ -13077,51 +13068,7 @@ msgctxt "#22033" msgid "Charset" msgstr "" -msgctxt "#22034" -msgid "Export karaoke titles as HTML" -msgstr "" - -msgctxt "#22035" -msgid "Export karaoke titles as CSV" -msgstr "" - -#: system/settings/settings.xml -msgctxt "#22036" -msgid "Import karaoke titles..." -msgstr "" - -#: system/settings/settings.xml -msgctxt "#22037" -msgid "Show song selector automatically" -msgstr "" - -#: system/settings/settings.xml -msgctxt "#22038" -msgid "Export karaoke titles..." -msgstr "" - -msgctxt "#22039" -msgid "Enter song number" -msgstr "" - -#: system/settings/settings.xml -msgctxt "#22040" -msgid "white / green" -msgstr "" - -msgctxt "#22041" -msgid "white / red" -msgstr "" - -msgctxt "#22042" -msgid "white / blue" -msgstr "" - -msgctxt "#22043" -msgid "black / white" -msgstr "" - -#empty strings from id 22044 to 22078 +#empty strings from id 22034 to 22078 #: system/settings/settings.xml msgctxt "#22079" @@ -16599,59 +16546,7 @@ msgctxt "#36291" msgid "Auto eject disc after rip is complete." msgstr "" -#. Description of settings category "Music -> Karaoke" with label #13327 -#: system/settings/settings.xml -msgctxt "#36292" -msgid "This category contains the settings for how karaoke is handled." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Enable karaoke support" with label #13323 -#: system/settings/settings.xml -msgctxt "#36293" -msgid "When playing any music file, look for a matching .cdg file and display its graphics." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Show song selector automatically" with label #22037 -#: system/settings/settings.xml -msgctxt "#36294" -msgid "Show song selection dialogue once the last song in the queue has been played." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Font" with label #22030 -#: system/settings/settings.xml -msgctxt "#36295" -msgid "Select the font type used during karaoke." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Size" with label #22031 -#: system/settings/settings.xml -msgctxt "#36296" -msgid "Select the size of the font used during karaoke." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Colours" with label #22032 -#: system/settings/settings.xml -msgctxt "#36297" -msgid "Select the font colour used during karaoke." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Charset" with label #22033 -#: system/settings/settings.xml -msgctxt "#36298" -msgid "Select the character set used during karaoke." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Export karaoke titles..." with label #22038 -#: system/settings/settings.xml -msgctxt "#36299" -msgid "Export the karaoke numbered songs to HTML or CSV files." -msgstr "" - -#. Description of setting "Music -> Karaoke -> Import karaoke titles..." with label #22036 -#: system/settings/settings.xml -msgctxt "#36300" -msgid "Import the karaoke numbered songs from HTML or CSV files." -msgstr "" +#empty strings from id 36292 to 36300 #: system/settings/settings.xml msgctxt "#36301" diff --git a/addons/skin.confluence/720p/DialogKaraokeSongSelector.xml b/addons/skin.confluence/720p/DialogKaraokeSongSelector.xml deleted file mode 100644 index 4eb9954e2f..0000000000 --- a/addons/skin.confluence/720p/DialogKaraokeSongSelector.xml +++ /dev/null @@ -1,41 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<window type="dialog"> - <animation effect="slide" start="0,-40" end="0,0" time="75">WindowOpen</animation> - <animation effect="slide" start="0,0" end="0,-40" delay="300" time="75">WindowClose</animation> - <controls> - <control type="group"> - <depth>DepthDialog-</depth> - <left>100</left> - <top>0</top> - <control type="image"> - <left>0</left> - <top>-10</top> - <width>370</width> - <height>70</height> - <texture flipy="true" border="20,20,20,2">InfoMessagePanel.png</texture> - </control> - <control type="label" id="401"> - <description>Song Number Label</description> - <left>15</left> - <top>2</top> - <width>340</width> - <height>25</height> - <font>font13_title</font> - <textcolor>selected</textcolor> - <align>left</align> - <aligny>center</aligny> - </control> - <control type="label" id="402"> - <description>Song Name Label</description> - <left>15</left> - <top>27</top> - <width>340</width> - <height>20</height> - <font>font13</font> - <textcolor>blue</textcolor> - <align>left</align> - <aligny>center</aligny> - </control> - </control> - </controls> -</window> diff --git a/addons/skin.confluence/720p/DialogKaraokeSongSelectorLarge.xml b/addons/skin.confluence/720p/DialogKaraokeSongSelectorLarge.xml deleted file mode 100644 index 6f5d8f83f9..0000000000 --- a/addons/skin.confluence/720p/DialogKaraokeSongSelectorLarge.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<window type="dialog"> - <include>dialogeffect</include> - <coordinates> - <left>415</left> - <top>275</top> - </coordinates> - <controls> - <control type="group"> - <include name="DialogBackgroundCommons"> - <param name="DialogBackgroundWidth" value="450" /> - <param name="DialogBackgroundHeight" value="170" /> - <param name="DialogHeaderWidth" value="370" /> - <param name="DialogHeaderLabel" value="$LOCALIZE[31321]" /> - <param name="DialogHeaderId" value="1" /> - <param name="CloseButtonLeft" value="360" /> - <param name="CloseButtonNav" value="10" /> - </include> - <control type="label" id="401"> - <description>Song Number Label</description> - <left>30</left> - <top>70</top> - <width>390</width> - <height>30</height> - <font>font28_title</font> - <textcolor>white</textcolor> - <align>center</align> - <aligny>center</aligny> - </control> - <control type="label" id="402"> - <description>Song Name Label</description> - <left>30</left> - <top>120</top> - <width>390</width> - <height>20</height> - <font>font13</font> - <align>center</align> - <aligny>center</aligny> - <textcolor>blue</textcolor> - <scroll>true</scroll> - </control> - </control> - </controls> -</window> diff --git a/addons/skin.confluence/720p/MusicKaraokeLyrics.xml b/addons/skin.confluence/720p/MusicKaraokeLyrics.xml deleted file mode 100644 index 0a63ce81c7..0000000000 --- a/addons/skin.confluence/720p/MusicKaraokeLyrics.xml +++ /dev/null @@ -1,46 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<window> - <controls> - <control type="karvisualisation" id="1"> - <description>visualisation</description> - <left>0</left> - <top>0</top> - <width>1280</width> - <height>720</height> - <visible>false</visible> - </control> - <control type="image" id="2"> - <description>fullscreen image</description> - <left>0</left> - <top>0</top> - <width>1280</width> - <height>720</height> - <visible>false</visible> - </control> - <control type="group"> - <visible>MusicPlayer.Offset(number).Exists + !IntegerGreaterThan(Player.TimeRemaining,20)</visible> - <animation effect="slide" start="0,-40" end="0,0" time="75">Visible</animation> - <left>420</left> - <top>0</top> - <control type="image"> - <left>0</left> - <top>-10</top> - <width>470</width> - <height>55</height> - <texture flipy="true" border="20,20,20,2">InfoMessagePanel.png</texture> - </control> - <control type="label" id="402"> - <description>Next Song Name</description> - <left>5</left> - <top>5</top> - <width>470</width> - <height>25</height> - <font>font13_title</font> - <textcolor>blue</textcolor> - <label>[COLOR=blue]$LOCALIZE[19031] :[/COLOR] [COLOR=selected]$INFO[MusicPlayer.offset(1).Title][/COLOR]</label> - <align>center</align> - <aligny>center</aligny> - </control> - </control> - </controls> -</window> diff --git a/addons/skin.confluence/language/resource.language.en_gb/strings.po b/addons/skin.confluence/language/resource.language.en_gb/strings.po index ee8bd48b23..ce08fec6e2 100644 --- a/addons/skin.confluence/language/resource.language.en_gb/strings.po +++ b/addons/skin.confluence/language/resource.language.en_gb/strings.po @@ -418,9 +418,7 @@ msgctxt "#31320" msgid "Last logged in" msgstr "" -msgctxt "#31321" -msgid "Karaoke song selector" -msgstr "" +#empty string with id 31321" msgctxt "#31322" msgid "Aired" @@ -524,7 +522,7 @@ msgid "[B]CONFIGURE VIDEO SETTINGS[/B][CR][CR]Manage your video library · Set v msgstr "" msgctxt "#31402" -msgid "[B]CONFIGURE MUSIC SETTINGS[/B][CR][CR]Manage your music library · Set music playback options · Change music listing options[CR]Setup song submission · Set karaoke options" +msgid "[B]CONFIGURE MUSIC SETTINGS[/B][CR][CR]Manage your music library · Set music playback options · Change music listing options[CR]Setup song submission" msgstr "" msgctxt "#31403" diff --git a/configure.ac b/configure.ac index a86ddd94b7..a830bd889b 100644 --- a/configure.ac +++ b/configure.ac @@ -2375,7 +2375,6 @@ OUTPUT_FILES="Makefile \ xbmc/cores/playercorefactory/Makefile \ xbmc/messaging/Makefile \ xbmc/messaging/helpers/Makefile \ - xbmc/music/karaoke/Makefile \ xbmc/osx/Makefile \ xbmc/guilib/Makefile \ xbmc/input/linux/Makefile \ diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 29ae0dfbc5..c11906f88e 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -658,18 +658,6 @@ <ClCompile Include="..\..\xbmc\music\infoscanner\MusicArtistInfo.cpp" /> <ClCompile Include="..\..\xbmc\music\infoscanner\MusicInfoScanner.cpp" /> <ClCompile Include="..\..\xbmc\music\infoscanner\MusicInfoScraper.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\GUIDialogKaraokeSongSelector.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\GUIWindowKaraokeLyrics.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyrics.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricscdg.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricsfactory.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricsmanager.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstext.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextkar.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextlrc.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextustar.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokewindowbackground.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokevideobackground.cpp" /> <ClCompile Include="..\..\xbmc\music\MusicDatabase.cpp" /> <ClCompile Include="..\..\xbmc\music\MusicDbUrl.cpp" /> <ClCompile Include="..\..\xbmc\music\MusicInfoLoader.cpp" /> @@ -1094,7 +1082,6 @@ <ClInclude Include="..\..\xbmc\messaging\ThreadMessage.h" /> <ClInclude Include="..\..\xbmc\music\CueInfoLoader.h" /> <ClInclude Include="..\..\xbmc\music\EmbeddedArt.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokevideobackground.h" /> <ClInclude Include="..\..\xbmc\music\tags\MusicInfoTagLoaderFFmpeg.h" /> <ClInclude Include="..\..\xbmc\music\tags\ReplayGain.h" /> <ClInclude Include="..\..\xbmc\network\dacp\dacp.h" /> @@ -2005,18 +1992,6 @@ <ClInclude Include="..\..\xbmc\music\infoscanner\MusicArtistInfo.h" /> <ClInclude Include="..\..\xbmc\music\infoscanner\MusicInfoScanner.h" /> <ClInclude Include="..\..\xbmc\music\infoscanner\MusicInfoScraper.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\cdgdata.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\GUIDialogKaraokeSongSelector.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\GUIWindowKaraokeLyrics.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyrics.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricscdg.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricsfactory.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricsmanager.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstext.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextkar.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextlrc.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextustar.h" /> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokewindowbackground.h" /> <ClInclude Include="..\..\xbmc\music\MusicDatabase.h" /> <ClInclude Include="..\..\xbmc\music\MusicInfoLoader.h" /> <ClInclude Include="..\..\xbmc\music\Song.h" /> @@ -3015,4 +2990,4 @@ </VisualStudio> </ProjectExtensions> <Import Project="$(SolutionDir)\$(ProjectFileName).targets.user" Condition="Exists('$(SolutionDir)\$(ProjectFileName).targets.user')" /> -</Project>
\ No newline at end of file +</Project> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index eb1a3330e7..eaecbbf7af 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -112,9 +112,6 @@ <Filter Include="windowing"> <UniqueIdentifier>{dbf79aa0-53a6-4bec-855b-e8d2cbb73689}</UniqueIdentifier> </Filter> - <Filter Include="music\karaoke"> - <UniqueIdentifier>{9d2be696-b6dd-4be1-aa8c-260816b48c12}</UniqueIdentifier> - </Filter> <Filter Include="cdrip"> <UniqueIdentifier>{d0d6c121-8cef-4bf9-aba5-bff57ae46e26}</UniqueIdentifier> </Filter> @@ -804,39 +801,6 @@ <ClCompile Include="..\..\xbmc\MediaSource.cpp" /> <ClCompile Include="..\..\xbmc\MediaSource.cpp" /> <ClCompile Include="..\..\xbmc\MediaSource.cpp" /> - <ClCompile Include="..\..\xbmc\music\karaoke\GUIDialogKaraokeSongSelector.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\GUIWindowKaraokeLyrics.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyrics.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricscdg.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricsfactory.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricsmanager.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstext.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextkar.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextlrc.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokelyricstextustar.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokewindowbackground.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\music\Album.cpp"> <Filter>music</Filter> </ClCompile> @@ -2301,9 +2265,6 @@ <ClCompile Include="..\..\xbmc\utils\DatabaseUtils.cpp"> <Filter>utils</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\music\karaoke\karaokevideobackground.cpp"> - <Filter>music\karaoke</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\utils\EndianSwap.cpp"> <Filter>utils</Filter> </ClCompile> @@ -3791,42 +3752,6 @@ <ClInclude Include="..\..\xbmc\guilib\GUIDialog.h"> <Filter>guilib</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\cdgdata.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\GUIDialogKaraokeSongSelector.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\GUIWindowKaraokeLyrics.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyrics.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricscdg.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricsfactory.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricsmanager.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstext.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextkar.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextlrc.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokelyricstextustar.h"> - <Filter>music\karaoke</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokewindowbackground.h"> - <Filter>music\karaoke</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\music\Album.h"> <Filter>music</Filter> </ClInclude> @@ -5650,9 +5575,6 @@ <ClInclude Include="..\..\xbmc\guilib\cximage.h"> <Filter>guilib</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\music\karaoke\karaokevideobackground.h"> - <Filter>music\karaoke</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\video\FFmpegVideoDecoder.h"> <Filter>video</Filter> </ClInclude> @@ -6426,4 +6348,4 @@ <Filter>shaders</Filter> </FxCompile> </ItemGroup> -</Project>
\ No newline at end of file +</Project> diff --git a/system/settings/settings.xml b/system/settings/settings.xml index a2bd4efc6f..af504a8ab4 100644 --- a/system/settings/settings.xml +++ b/system/settings/settings.xml @@ -1944,94 +1944,6 @@ </setting> </group> </category> - <category id="karaoke" label="13327" help="36292"> - <requirement>HAS_KARAOKE</requirement> - <group id="1"> - <setting id="karaoke.enabled" type="boolean" label="13323" help="36293"> - <level>2</level> - <default>false</default> - <control type="toggle" /> - </setting> - <setting id="karaoke.autopopupselector" type="boolean" label="22037" help="36294"> - <level>2</level> - <default>false</default> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - </dependencies> - <control type="toggle" /> - </setting> - </group> - <group id="2"> - <setting id="karaoke.font" type="string" label="22030" help="36295"> - <level>2</level> - <default>arial.ttf</default> - <constraints> - <options>fonts</options> - </constraints> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - </dependencies> - <control type="list" format="string" /> - </setting> - <setting id="karaoke.fontheight" type="integer" parent="karaoke.font" label="22031" help="36296"> - <level>2</level> - <default>36</default> - <constraints> - <minimum>16</minimum> - <step>2</step> - <maximum>74</maximum> - </constraints> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - <dependency type="update" setting="karaoke.font" /> - </dependencies> - <control type="spinner" format="string" /> - </setting> - <setting id="karaoke.fontcolors" type="integer" parent="karaoke.font" label="22032" help="36297"> - <level>2</level> - <default>0</default> <!-- white/green --> - <constraints> - <options> - <option label="22040">0</option> <!-- white/green --> - <option label="22041">1</option> <!-- white/red --> - <option label="22042">2</option> <!-- white/blue --> - <option label="22043">3</option> <!-- black/white --> - </options> - </constraints> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - </dependencies> - <control type="list" format="string" /> - </setting> - <setting id="karaoke.charset" type="string" parent="karaoke.font" label="22033" help="36298"> - <level>2</level> - <default>DEFAULT</default> - <constraints> - <options>charsets</options> - </constraints> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - </dependencies> - <control type="list" format="string" /> - </setting> - </group> - <group id="3"> - <setting id="karaoke.export" type="action" label="22038" help="36299"> - <level>2</level> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - </dependencies> - <control type="button" format="action" /> - </setting> - <setting id="karaoke.importcsv" type="action" label="22036" help="36300"> - <level>2</level> - <dependencies> - <dependency type="enable" setting="karaoke.enabled">true</dependency> - </dependencies> - <control type="button" format="action" /> - </setting> - </group> - </category> <category id="mymusic" label="0" help="0"> <group id="1"> <setting id="mymusic.startwindow" type="integer" label="0" help="36301"> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index a2475c6c16..191071d570 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -120,9 +120,6 @@ #ifdef HAS_VIDEO_PLAYBACK #include "cores/VideoRenderers/RenderManager.h" #endif -#ifdef HAS_KARAOKE -#include "music/karaoke/karaokelyricsmanager.h" -#endif #include "network/ZeroconfBrowser.h" #ifndef TARGET_POSIX #include "threads/platform/win/Win32Exception.h" @@ -292,9 +289,6 @@ CApplication::CApplication(void) /* for now always keep this around */ -#ifdef HAS_KARAOKE - m_pKaraokeMgr = new CKaraokeLyricsManager(); -#endif m_currentStack = new CFileItemList; m_bPresentFrame = false; @@ -329,10 +323,6 @@ CApplication::~CApplication(void) #endif delete m_currentStack; -#ifdef HAS_KARAOKE - delete m_pKaraokeMgr; -#endif - delete m_dpms; delete m_pInertialScrollingHandler; delete m_pPlayer; @@ -2333,9 +2323,6 @@ bool CApplication::OnAction(const CAction &action) if (!m_pPlayer->IsPaused() && m_pPlayer->GetPlaySpeed() != 1) m_pPlayer->SetPlaySpeed(1, g_application.m_muted); - #ifdef HAS_KARAOKE - m_pKaraokeMgr->SetPaused( m_pPlayer->IsPaused() ); -#endif g_audioManager.Enable(m_pPlayer->IsPaused()); return true; } @@ -3483,14 +3470,6 @@ PlayBackRet CApplication::PlayFile(const CFileItem& item, bool bRestart) // reset VideoStartWindowed as it's a temp setting CMediaSettings::GetInstance().SetVideoStartWindowed(false); -#ifdef HAS_KARAOKE - //We have to stop parsing a cdg before mplayer is deallocated - // WHY do we have to do this???? - if (m_pKaraokeMgr) - m_pKaraokeMgr->Stop(); -#endif - - { CSingleLock lock(m_playStateMutex); // tell system we are starting a file @@ -3928,10 +3907,6 @@ void CApplication::StopPlaying() int iWin = g_windowManager.GetActiveWindow(); if ( m_pPlayer->IsPlaying() ) { -#ifdef HAS_KARAOKE - if( m_pKaraokeMgr ) - m_pKaraokeMgr->Stop(); -#endif m_pPlayer->CloseFile(); // turn off visualisation window when stopping @@ -4283,30 +4258,6 @@ bool CApplication::OnMessage(CGUIMessage& message) param["player"]["speed"] = 1; param["player"]["playerid"] = g_playlistPlayer.GetCurrentPlaylist(); CAnnouncementManager::GetInstance().Announce(Player, "xbmc", "OnPlay", m_itemCurrentFile, param); - - if (m_pPlayer->IsPlayingAudio()) - { - // Start our cdg parser as appropriate -#ifdef HAS_KARAOKE - if (m_pKaraokeMgr && CSettings::GetInstance().GetBool(CSettings::SETTING_KARAOKE_ENABLED) && !m_itemCurrentFile->IsInternetStream()) - { - m_pKaraokeMgr->Stop(); - if (m_itemCurrentFile->IsMusicDb()) - { - if (!m_itemCurrentFile->HasMusicInfoTag() || !m_itemCurrentFile->GetMusicInfoTag()->Loaded()) - { - IMusicInfoTagLoader* tagloader = CMusicInfoTagLoaderFactory::CreateLoader(*m_itemCurrentFile); - tagloader->Load(m_itemCurrentFile->GetPath(),*m_itemCurrentFile->GetMusicInfoTag()); - delete tagloader; - } - m_pKaraokeMgr->Start(m_itemCurrentFile->GetMusicInfoTag()->GetURL()); - } - else - m_pKaraokeMgr->Start(m_itemCurrentFile->GetPath()); - } -#endif - } - return true; } break; @@ -4367,10 +4318,6 @@ bool CApplication::OnMessage(CGUIMessage& message) case GUI_MSG_PLAYBACK_ENDED: case GUI_MSG_PLAYLISTPLAYER_STOPPED: { -#ifdef HAS_KARAOKE - if (m_pKaraokeMgr ) - m_pKaraokeMgr->Stop(); -#endif #ifdef TARGET_DARWIN_IOS CDarwinUtils::SetScheduling(message.GetMessage()); #endif @@ -4644,11 +4591,6 @@ void CApplication::ProcessSlow() // check for any idle curl connections g_curlInterface.CheckIdle(); -#ifdef HAS_KARAOKE - if ( m_pKaraokeMgr ) - m_pKaraokeMgr->ProcessSlow(); -#endif - if (!m_pPlayer->IsPlayingVideo()) g_largeTextureManager.CleanupUnusedImages(); diff --git a/xbmc/Application.h b/xbmc/Application.h index c9ba273b6c..616bfd51b5 100644 --- a/xbmc/Application.h +++ b/xbmc/Application.h @@ -73,7 +73,6 @@ namespace MEDIA_DETECT #include "interfaces/IActionListener.h" class CSeekHandler; -class CKaraokeLyricsManager; class CInertialScrollingHandler; class DPMSSupport; class CSplash; @@ -319,8 +318,6 @@ public: PlayState m_ePlayState; CCriticalSection m_playStateMutex; - CKaraokeLyricsManager* m_pKaraokeMgr; - PLAYERCOREID m_eForcedNextPlayer; std::string m_strPlayListFile; diff --git a/xbmc/FileItem.cpp b/xbmc/FileItem.cpp index af2b414f64..b115e6c7a2 100644 --- a/xbmc/FileItem.cpp +++ b/xbmc/FileItem.cpp @@ -57,7 +57,6 @@ #include "utils/RegExp.h" #include "utils/log.h" #include "utils/Variant.h" -#include "music/karaoke/karaokelyricsfactory.h" #include "utils/Mime.h" #include <assert.h> @@ -801,14 +800,6 @@ bool CFileItem::IsAudio() const return URIUtils::HasExtension(m_strPath, g_advancedSettings.GetMusicExtensions()); } -bool CFileItem::IsKaraoke() const -{ - if (!IsAudio()) - return false; - - return CKaraokeLyricsFactory::HasLyrics( m_strPath ); -} - bool CFileItem::IsPicture() const { if(StringUtils::StartsWithNoCase(m_mimetype, "image/")) diff --git a/xbmc/FileItem.h b/xbmc/FileItem.h index a51d9a3b01..159fd677e2 100644 --- a/xbmc/FileItem.h +++ b/xbmc/FileItem.h @@ -175,7 +175,6 @@ public: */ bool IsAudio() const; - bool IsKaraoke() const; bool IsCUESheet() const; bool IsInternetStream(const bool bStrictCheck = false) const; bool IsPlayList() const; diff --git a/xbmc/guilib/GUIControlFactory.cpp b/xbmc/guilib/GUIControlFactory.cpp index 01b077325e..28e9fc58e4 100644 --- a/xbmc/guilib/GUIControlFactory.cpp +++ b/xbmc/guilib/GUIControlFactory.cpp @@ -100,7 +100,6 @@ static const ControlMapping controls[] = {"resize", CGUIControl::GUICONTROL_RESIZE}, {"edit", CGUIControl::GUICONTROL_EDIT}, {"visualisation", CGUIControl::GUICONTROL_VISUALISATION}, - {"karvisualisation", CGUIControl::GUICONTROL_VISUALISATION}, {"renderaddon", CGUIControl::GUICONTROL_RENDERADDON}, {"multiimage", CGUIControl::GUICONTROL_MULTI_IMAGE}, {"grouplist", CGUIControl::GUICONTROL_GROUPLIST}, diff --git a/xbmc/guilib/GUIWindowManager.cpp b/xbmc/guilib/GUIWindowManager.cpp index b420084900..75e3886d33 100644 --- a/xbmc/guilib/GUIWindowManager.cpp +++ b/xbmc/guilib/GUIWindowManager.cpp @@ -139,11 +139,6 @@ #include "settings/dialogs/GUIDialogAudioDSPManager.h" #include "settings/dialogs/GUIDialogAudioDSPSettings.h" -#ifdef HAS_KARAOKE -#include "music/karaoke/GUIDialogKaraokeSongSelector.h" -#include "music/karaoke/GUIWindowKaraokeLyrics.h" -#endif - #include "peripherals/dialogs/GUIDialogPeripheralSettings.h" #include "addons/AddonCallbacksGUI.h" @@ -212,10 +207,6 @@ void CGUIWindowManager::CreateWindows() Add(new CGUIDialogButtonMenu); Add(new CGUIDialogMuteBug); Add(new CGUIDialogPlayerControls); -#ifdef HAS_KARAOKE - Add(new CGUIDialogKaraokeSongSelectorSmall); - Add(new CGUIDialogKaraokeSongSelectorLarge); -#endif Add(new CGUIDialogSlider); Add(new CGUIDialogMusicOSD); Add(new CGUIDialogVisualisationPresetList); @@ -286,9 +277,6 @@ void CGUIWindowManager::CreateWindows() Add(new CGUIWindowFullScreen); Add(new CGUIWindowVisualisation); Add(new CGUIWindowSlideShow); -#ifdef HAS_KARAOKE - Add(new CGUIWindowKaraokeLyrics); -#endif Add(new CGUIDialogVideoOSD); Add(new CGUIWindowScreensaver); @@ -322,8 +310,6 @@ bool CGUIWindowManager::DestroyWindows() Delete(WINDOW_DIALOG_BUTTON_MENU); Delete(WINDOW_DIALOG_CONTEXT_MENU); Delete(WINDOW_DIALOG_PLAYER_CONTROLS); - Delete(WINDOW_DIALOG_KARAOKE_SONGSELECT); - Delete(WINDOW_DIALOG_KARAOKE_SELECTOR); Delete(WINDOW_DIALOG_MUSIC_OSD); Delete(WINDOW_DIALOG_VIS_PRESET_LIST); Delete(WINDOW_DIALOG_SELECT); @@ -383,7 +369,6 @@ bool CGUIWindowManager::DestroyWindows() Delete(WINDOW_STARTUP_ANIM); Delete(WINDOW_LOGIN_SCREEN); Delete(WINDOW_VISUALISATION); - Delete(WINDOW_KARAOKELYRICS); Delete(WINDOW_SETTINGS_MENU); Delete(WINDOW_SETTINGS_PROFILES); Delete(WINDOW_SETTINGS_MYPICTURES); // all the settings categories diff --git a/xbmc/guilib/WindowIDs.h b/xbmc/guilib/WindowIDs.h index 60f9c88b48..074e8f3de0 100644 --- a/xbmc/guilib/WindowIDs.h +++ b/xbmc/guilib/WindowIDs.h @@ -95,8 +95,6 @@ #define WINDOW_DIALOG_ADDON_SETTINGS 10140 #define WINDOW_DIALOG_ACCESS_POINTS 10141 #define WINDOW_DIALOG_FULLSCREEN_INFO 10142 -#define WINDOW_DIALOG_KARAOKE_SONGSELECT 10143 -#define WINDOW_DIALOG_KARAOKE_SELECTOR 10144 #define WINDOW_DIALOG_SLIDER 10145 #define WINDOW_DIALOG_ADDON_INFO 10146 #define WINDOW_DIALOG_TEXT_VIEWER 10147 @@ -150,7 +148,6 @@ #define WINDOW_FULLSCREEN_VIDEO 12005 #define WINDOW_VISUALISATION 12006 #define WINDOW_SLIDESHOW 12007 -#define WINDOW_KARAOKELYRICS 12009 #define WINDOW_WEATHER 12600 #define WINDOW_SCREENSAVER 12900 #define WINDOW_DIALOG_VIDEO_OSD 12901 diff --git a/xbmc/input/ButtonTranslator.cpp b/xbmc/input/ButtonTranslator.cpp index 6477606f96..62c07106d0 100644 --- a/xbmc/input/ButtonTranslator.cpp +++ b/xbmc/input/ButtonTranslator.cpp @@ -364,8 +364,6 @@ static const ActionMapping windows[] = { "pictureinfo" , WINDOW_DIALOG_PICTURE_INFO }, { "accesspoints" , WINDOW_DIALOG_ACCESS_POINTS }, { "fullscreeninfo" , WINDOW_DIALOG_FULLSCREEN_INFO }, - { "karaokeselector" , WINDOW_DIALOG_KARAOKE_SONGSELECT }, - { "karaokelargeselector" , WINDOW_DIALOG_KARAOKE_SELECTOR }, { "sliderdialog" , WINDOW_DIALOG_SLIDER }, { "addoninformation" , WINDOW_DIALOG_ADDON_INFO }, { "subtitlesearch" , WINDOW_DIALOG_SUBTITLES }, @@ -384,7 +382,6 @@ static const ActionMapping windows[] = { "fullscreenradio" , WINDOW_FULLSCREEN_RADIO }, // virtual window for fullscreen radio, uses WINDOW_VISUALISATION as fallback { "visualisation" , WINDOW_VISUALISATION }, { "slideshow" , WINDOW_SLIDESHOW }, - { "karaoke" , WINDOW_KARAOKELYRICS }, { "weather" , WINDOW_WEATHER }, { "screensaver" , WINDOW_SCREENSAVER }, { "videoosd" , WINDOW_DIALOG_VIDEO_OSD }, diff --git a/xbmc/music/MusicDatabase.cpp b/xbmc/music/MusicDatabase.cpp index c10fedaf84..d2281ebe35 100644 --- a/xbmc/music/MusicDatabase.cpp +++ b/xbmc/music/MusicDatabase.cpp @@ -67,10 +67,6 @@ #include "dbwrappers/dataset.h" #include "utils/XMLUtils.h" -#ifdef HAS_KARAOKE -#include "karaoke/karaokelyricsfactory.h" -#endif - using namespace XFILE; using namespace MUSICDATABASEDIRECTORY; using namespace KODI::MESSAGING; @@ -175,10 +171,6 @@ void CMusicDatabase::CreateTables() CLog::Log(LOGINFO, "create discography table"); m_pDS->exec("CREATE TABLE discography (idArtist integer, strAlbum text, strYear text)"); - CLog::Log(LOGINFO, "create karaokedata table"); - m_pDS->exec("CREATE TABLE karaokedata (iKaraNumber integer, idSong integer, iKaraDelay integer, strKaraEncoding text, " - "strKaralyrics text, strKaraLyrFileCRC text)"); - CLog::Log(LOGINFO, "create art table"); m_pDS->exec("CREATE TABLE art(art_id INTEGER PRIMARY KEY, media_id INTEGER, media_type TEXT, type TEXT, url TEXT)"); @@ -223,9 +215,6 @@ void CMusicDatabase::CreateAnalytics() m_pDS->exec("CREATE INDEX idxAlbumInfoSong_1 ON albuminfosong ( idAlbumInfo )"); - m_pDS->exec("CREATE INDEX idxKaraNumber on karaokedata(iKaraNumber)"); - m_pDS->exec("CREATE INDEX idxKarSong on karaokedata(idSong)"); - m_pDS->exec("CREATE INDEX idxDiscography_1 ON discography ( idArtist )"); m_pDS->exec("CREATE INDEX ix_art ON art(media_id, media_type(20), type(20))"); @@ -249,7 +238,6 @@ void CMusicDatabase::CreateAnalytics() m_pDS->exec("CREATE TRIGGER tgrDeleteSong AFTER delete ON song FOR EACH ROW BEGIN" " DELETE FROM song_artist WHERE song_artist.idSong = old.idSong;" " DELETE FROM song_genre WHERE song_genre.idSong = old.idSong;" - " DELETE FROM karaokedata WHERE karaokedata.idSong = old.idSong;" " DELETE FROM art WHERE media_id=old.idSong AND media_type='song';" " END"); m_pDS->exec("CREATE TRIGGER tgrDeletePath AFTER delete ON path FOR EACH ROW BEGIN" @@ -277,7 +265,6 @@ void CMusicDatabase::CreateViews() " song.idAlbum AS idAlbum, " " strAlbum, " " strPath, " - " iKaraNumber, iKaraDelay, strKaraEncoding," " album.bCompilation AS bCompilation," " album.strArtists AS strAlbumArtists," " album.strReleaseType AS strAlbumReleaseType," @@ -287,9 +274,7 @@ void CMusicDatabase::CreateViews() " JOIN album ON" " song.idAlbum=album.idAlbum" " JOIN path ON" - " song.idPath=path.idPath" - " LEFT OUTER JOIN karaokedata ON" - " song.idSong=karaokedata.idSong"); + " song.idPath=path.idPath"); CLog::Log(LOGINFO, "create album view"); m_pDS->exec("CREATE VIEW albumview AS SELECT " @@ -509,8 +494,7 @@ bool CMusicDatabase::AddAlbum(CAlbum& album) song->iTimesPlayed, song->iStartOffset, song->iEndOffset, song->lastPlayed, - song->rating, - song->iKaraokeNumber); + song->rating); for (VECARTISTCREDITS::iterator artistCredit = song->artistCredits.begin(); artistCredit != song->artistCredits.end(); ++artistCredit) @@ -586,8 +570,7 @@ bool CMusicDatabase::UpdateAlbum(CAlbum& album) song->iStartOffset, song->iEndOffset, song->lastPlayed, - song->rating, - song->iKaraokeNumber); + song->rating); DeleteSongArtistsBySong(song->idSong); for (VECARTISTCREDITS::iterator artistCredit = song->artistCredits.begin(); artistCredit != song->artistCredits.end(); ++artistCredit) { @@ -620,7 +603,7 @@ int CMusicDatabase::AddSong(const int idAlbum, const std::string &artistString, const std::vector<std::string>& genres, int iTrack, int iDuration, int iYear, const int iTimesPlayed, int iStartOffset, int iEndOffset, - const CDateTime& dtLastPlayed, char rating, int iKaraokeNumber) + const CDateTime& dtLastPlayed, char rating) { int idSong = -1; std::string strSQL; @@ -637,11 +620,6 @@ int CMusicDatabase::AddSong(const int idAlbum, URIUtils::Split(strPathAndFileName, strPath, strFileName); int idPath = AddPath(strPath); - bool bHasKaraoke = false; -#ifdef HAS_KARAOKE - bHasKaraoke = CKaraokeLyricsFactory::HasLyrics(strPathAndFileName); -#endif - if (!strMusicBrainzTrackID.empty()) strSQL = PrepareSQL("SELECT * FROM song WHERE idAlbum = %i AND strMusicBrainzTrackID = '%s'", idAlbum, @@ -686,20 +664,13 @@ int CMusicDatabase::AddSong(const int idAlbum, { idSong = m_pDS->fv("idSong").get_asInt(); m_pDS->close(); - UpdateSong(idSong, strTitle, strMusicBrainzTrackID, strPathAndFileName, strComment, strMood, strThumb, artistString, genres, iTrack, iDuration, iYear, iTimesPlayed, iStartOffset, iEndOffset, dtLastPlayed, rating, iKaraokeNumber); + UpdateSong(idSong, strTitle, strMusicBrainzTrackID, strPathAndFileName, strComment, strMood, strThumb, artistString, genres, iTrack, iDuration, iYear, iTimesPlayed, iStartOffset, iEndOffset, dtLastPlayed, rating); } if (!strThumb.empty()) SetArtForItem(idSong, MediaTypeSong, "thumb", strThumb); unsigned int index = 0; - // If this is karaoke song, change the genre to 'Karaoke' (and add it if it's not there) - if ( bHasKaraoke && g_advancedSettings.m_karaokeChangeGenreForKaraokeSongs ) - { - int idGenre = AddGenre("Karaoke"); - AddSongGenre(idGenre, idSong, index); - AddAlbumGenre(idGenre, idAlbum, index++); - } for (std::vector<std::string>::const_iterator i = genres.begin(); i != genres.end(); ++i) { // index will be wrong for albums, but ordering is not all that relevant @@ -709,10 +680,6 @@ int CMusicDatabase::AddSong(const int idAlbum, AddAlbumGenre(idGenre, idAlbum, index++); } - // Add karaoke information (if any) - if (bHasKaraoke) - AddKaraokeData(idSong, iKaraokeNumber); - UpdateFileDateAdded(idSong, strPathAndFileName); AnnounceUpdate(MediaTypeSong, idSong); @@ -791,8 +758,7 @@ int CMusicDatabase::UpdateSong(int idSong, const CSong &song) song.iStartOffset, song.iEndOffset, song.lastPlayed, - song.rating, - song.iKaraokeNumber); + song.rating); } int CMusicDatabase::UpdateSong(int idSong, @@ -802,7 +768,7 @@ int CMusicDatabase::UpdateSong(int idSong, const std::string& artistString, const std::vector<std::string>& genres, int iTrack, int iDuration, int iYear, int iTimesPlayed, int iStartOffset, int iEndOffset, - const CDateTime& dtLastPlayed, char rating, int iKaraokeNumber) + const CDateTime& dtLastPlayed, char rating) { if (idSong < 0) return -1; @@ -1692,9 +1658,6 @@ CSong CMusicDatabase::GetSongFromDataset(const dbiplus::sql_record* const record song.rating = record->at(offset + song_userrating).get_asChar(); song.strComment = record->at(offset + song_comment).get_asString(); song.strMood = record->at(offset + song_mood).get_asString(); - song.iKaraokeNumber = record->at(offset + song_iKarNumber).get_asInt(); - song.strKaraokeLyrEncoding = record->at(offset + song_strKarEncoding).get_asString(); - song.iKaraokeDelay = record->at(offset + song_iKarDelay).get_asInt(); song.bCompilation = record->at(offset + song_bCompilation).get_asInt() == 1; // Get filename with full path @@ -3845,7 +3808,6 @@ void CMusicDatabase::UpdateTables(int version) if (version < 48) { // null out columns that are no longer used m_pDS->exec("UPDATE song SET dwFileNameCRC=NULL, idThumb=NULL"); - m_pDS->exec("UPDATE karaokedata SET strKaraLyrFileCRC=NULL"); m_pDS->exec("UPDATE album SET idThumb=NULL"); } if (version < 49) @@ -3934,11 +3896,15 @@ void CMusicDatabase::UpdateTables(int version) m_pDS->exec("DROP TABLE album"); m_pDS->exec("ALTER TABLE album_new RENAME TO album"); } + if (version < 55) + { + m_pDS->exec("DROP TABLE karaokedata"); + } } int CMusicDatabase::GetSchemaVersion() const { - return 55; + return 56; } unsigned int CMusicDatabase::GetSongIDs(const Filter &filter, std::vector<std::pair<int,int> > &songIDs) @@ -5001,358 +4967,6 @@ void CMusicDatabase::ImportFromXML(const std::string &xmlFile) progress->Close(); } -void CMusicDatabase::AddKaraokeData(int idSong, int iKaraokeNumber) -{ - try - { - std::string strSQL; - - // If song.iKaraokeNumber is non-zero, we already have it in the database. Just replace the song ID. - if (iKaraokeNumber > 0) - { - std::string strSQL = PrepareSQL("UPDATE karaokedata SET idSong=%i WHERE iKaraNumber=%i", idSong, iKaraokeNumber); - m_pDS->exec(strSQL); - return; - } - - // Get the maximum number allocated - strSQL=PrepareSQL( "SELECT MAX(iKaraNumber) FROM karaokedata" ); - if (!m_pDS->query(strSQL)) return; - - int iKaraokeNumber = g_advancedSettings.m_karaokeStartIndex; - - if ( m_pDS->num_rows() == 1 ) - iKaraokeNumber = m_pDS->fv("MAX(iKaraNumber)").get_asInt() + 1; - - // Add the data - strSQL=PrepareSQL( "INSERT INTO karaokedata (iKaraNumber, idSong, iKaraDelay, strKaraEncoding, strKaralyrics) " - "VALUES( %i, %i, 0, NULL, NULL)", iKaraokeNumber, idSong ); - - m_pDS->exec(strSQL); - } - catch (...) - { - CLog::Log(LOGERROR, "%s -(%i, %i) failed", __FUNCTION__, idSong, iKaraokeNumber); - } -} - -bool CMusicDatabase::GetSongByKaraokeNumber(int number, CSong & song) -{ - try - { - // Get info from karaoke db - if (NULL == m_pDB.get()) return false; - if (NULL == m_pDS.get()) return false; - - std::string strSQL=PrepareSQL("SELECT * FROM karaokedata where iKaraNumber=%ld", number); - - if (!m_pDS->query(strSQL)) return false; - if (m_pDS->num_rows() == 0) - { - m_pDS->close(); - return false; - } - - int idSong = m_pDS->fv("karaokedata.idSong").get_asInt(); - m_pDS->close(); - - return GetSong( idSong, song ); - } - catch (...) - { - CLog::Log(LOGERROR, "%s(%i) failed", __FUNCTION__, number); - } - - return false; -} - -void CMusicDatabase::ExportKaraokeInfo(const std::string & outFile, bool asHTML) -{ - try - { - if (NULL == m_pDB.get()) return; - if (NULL == m_pDS.get()) return; - - // find all karaoke songs - std::string sql = "SELECT * FROM songview WHERE iKaraNumber > 0 ORDER BY strFileName"; - - m_pDS->query(sql); - - int total = m_pDS->num_rows(); - int current = 0; - - if ( total == 0 ) - { - m_pDS->close(); - return; - } - - // Write the document - XFILE::CFile file; - - if ( !file.OpenForWrite( outFile, true ) ) - return; - - CGUIDialogProgress *progress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); - if (progress) - { - progress->SetHeading(CVariant{asHTML ? 22034 : 22035}); - progress->SetLine(0, CVariant{650}); - progress->SetLine(1, CVariant{""}); - progress->SetLine(2, CVariant{""}); - progress->SetPercentage(0); - progress->Open(); - progress->ShowProgressBar(true); - } - - std::string outdoc; - if ( asHTML ) - { - outdoc = "<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"></meta></head>\n" - "<body>\n<table>\n"; - - if (file.Write(outdoc.c_str(), outdoc.size()) != static_cast<ssize_t>(outdoc.size())) - return; // error - } - - while (!m_pDS->eof()) - { - CSong song = GetSongFromDataset(); - std::string songnum = StringUtils::Format("%06ld", song.iKaraokeNumber); - - if ( asHTML ) - outdoc = "<tr><td>" + songnum + "</td><td>" + song.GetArtistString() + "</td><td>" + song.strTitle + "</td></tr>\r\n"; - else - outdoc = songnum + '\t' + song.GetArtistString() + '\t' + song.strTitle + '\t' + song.strFileName + "\r\n"; - - if (file.Write(outdoc.c_str(), outdoc.size()) != static_cast<ssize_t>(outdoc.size())) - return; // error - - if ((current % 50) == 0 && progress) - { - progress->SetPercentage(current * 100 / total); - progress->Progress(); - if (progress->IsCanceled()) - { - progress->Close(); - m_pDS->close(); - return; - } - } - m_pDS->next(); - current++; - } - - m_pDS->close(); - - if ( asHTML ) - { - outdoc = "</table>\n</body>\n</html>\n"; - if (file.Write(outdoc.c_str(), outdoc.size()) != static_cast<ssize_t>(outdoc.size())) - return; // error - } - - file.Close(); - - if (progress) - progress->Close(); - } - catch (...) - { - CLog::Log(LOGERROR, "%s failed", __FUNCTION__); - } -} - -void CMusicDatabase::ImportKaraokeInfo(const std::string & inputFile) -{ - CGUIDialogProgress *progress = (CGUIDialogProgress *)g_windowManager.GetWindow(WINDOW_DIALOG_PROGRESS); - - try - { - if (NULL == m_pDB.get()) return; - - XFILE::CFile file; - XFILE::auto_buffer buf; - - if (file.LoadFile(inputFile, buf) <= 0) - { - CLog::Log(LOGERROR, "%s: Cannot read karaoke import file \"%s\"", __FUNCTION__, inputFile.c_str()); - return; - } - - // Null-terminate content - buf.resize(buf.size() + 1); - buf.get()[buf.size() - 1] = 0; - - file.Close(); - - if (progress) - { - progress->SetHeading(CVariant{22036}); - progress->SetLine(0, CVariant{649}); - progress->SetLine(1, CVariant{""}); - progress->SetLine(2, CVariant{""}); - progress->SetPercentage(0); - progress->Open(); - progress->ShowProgressBar(true); - } - - if (NULL == m_pDS.get()) return; - BeginTransaction(); - - // - // A simple state machine to parse the file - // - char * linestart = buf.get(); - unsigned int offset = 0, lastpercentage = 0; - - for (char * p = buf.get(); *p; p++, offset++) - { - // Skip \r - if ( *p == 0x0D ) - { - *p = '\0'; - continue; - } - - // Line number - if ( *p == 0x0A ) - { - *p = '\0'; - - unsigned int tabs = 0; - char * songpath, *artist = 0, *title = 0; - for ( songpath = linestart; *songpath; songpath++ ) - { - if ( *songpath == '\t' ) - { - tabs++; - *songpath = '\0'; - - switch( tabs ) - { - case 1: // the number end - artist = songpath + 1; - break; - - case 2: // the artist end - title = songpath + 1; - break; - - case 3: // the title end - break; - } - } - } - - int num = atoi( linestart ); - if ( num <= 0 || tabs < 3 || *artist == '\0' || *title == '\0' ) - { - CLog::Log( LOGERROR, "Karaoke import: error in line %s", linestart ); - linestart = p + 1; - continue; - } - - linestart = p + 1; - std::string strSQL=PrepareSQL("select idSong from songview " - "where strArtists like '%s' and strTitle like '%s'", artist, title ); - - if ( !m_pDS->query(strSQL) ) - { - RollbackTransaction(); - if (progress) - progress->Close(); - m_pDS->close(); - return; - } - - int iRowsFound = m_pDS->num_rows(); - if (iRowsFound == 0) - { - CLog::Log( LOGERROR, "Karaoke import: song %s by %s #%d is not found in the database, skipped", - title, artist, num ); - continue; - } - - int lResult = m_pDS->fv(0).get_asInt(); - strSQL = PrepareSQL("UPDATE karaokedata SET iKaraNumber=%i WHERE idSong=%i", num, lResult ); - m_pDS->exec(strSQL); - - if ( progress && (offset * 100 / buf.size()) != lastpercentage ) - { - lastpercentage = offset * 100 / buf.size(); - progress->SetPercentage( lastpercentage); - progress->Progress(); - if ( progress->IsCanceled() ) - { - RollbackTransaction(); - progress->Close(); - m_pDS->close(); - return; - } - } - } - } - - CommitTransaction(); - CLog::Log( LOGNOTICE, "Karaoke import: file '%s' was imported successfully", inputFile.c_str() ); - } - catch (...) - { - CLog::Log(LOGERROR, "%s failed", __FUNCTION__); - RollbackTransaction(); - } - - if (progress) - progress->Close(); -} - -bool CMusicDatabase::SetKaraokeSongDelay(int idSong, int delay) -{ - try - { - if (NULL == m_pDB.get()) return false; - if (NULL == m_pDS.get()) return false; - - std::string strSQL = PrepareSQL("UPDATE karaokedata SET iKaraDelay=%i WHERE idSong=%i", delay, idSong); - m_pDS->exec(strSQL); - - return true; - } - catch (...) - { - CLog::Log(LOGERROR, "%s failed", __FUNCTION__); - } - - return false; -} - -int CMusicDatabase::GetKaraokeSongsCount() -{ - try - { - if (NULL == m_pDB.get()) return 0; - if (NULL == m_pDS.get()) return 0; - - if (!m_pDS->query( "select count(idSong) as NumSongs from karaokedata")) return 0; - if (m_pDS->num_rows() == 0) - { - m_pDS->close(); - return 0; - } - - int iNumSongs = m_pDS->fv("NumSongs").get_asInt(); - // cleanup - m_pDS->close(); - return iNumSongs; - } - catch (...) - { - CLog::Log(LOGERROR, "%s failed", __FUNCTION__); - } - return 0; -} - void CMusicDatabase::SetPropertiesFromArtist(CFileItem& item, const CArtist& artist) { item.SetProperty("artist_instrument", StringUtils::Join(artist.instruments, g_advancedSettings.m_musicItemSeparator)); diff --git a/xbmc/music/MusicDatabase.h b/xbmc/music/MusicDatabase.h index 0925dd216b..1f07d42e97 100644 --- a/xbmc/music/MusicDatabase.h +++ b/xbmc/music/MusicDatabase.h @@ -125,7 +125,6 @@ public: \param iEndOffset [in] the end offset of the song (when using a single audio file with .cue) \param dtLastPlayed [in] the time the song was last played \param rating [in] a rating for the song - \param iKaraokeNumber [in] the karaoke id of the song \return the id of the song */ int AddSong(const int idAlbum, @@ -138,8 +137,7 @@ public: const std::string &artistString, const std::vector<std::string>& genres, int iTrack, int iDuration, int iYear, const int iTimesPlayed, int iStartOffset, int iEndOffset, - const CDateTime& dtLastPlayed, - char rating, int iKaraokeNumber); + const CDateTime& dtLastPlayed, char rating); bool GetSong(int idSong, CSong& song); /*! \brief Update a song in the database. @@ -173,7 +171,6 @@ public: \param iEndOffset [in] the end offset of the song (when using a single audio file with .cue) \param dtLastPlayed [in] the time the song was last played \param rating [in] a rating for the song - \param iKaraokeNumber [in] the karaoke id of the song \return the id of the song */ int UpdateSong(int idSong, @@ -183,8 +180,7 @@ public: const std::string& artistString, const std::vector<std::string>& genres, int iTrack, int iDuration, int iYear, int iTimesPlayed, int iStartOffset, int iEndOffset, - const CDateTime& dtLastPlayed, - char rating, int iKaraokeNumber); + const CDateTime& dtLastPlayed, char rating); //// Misc Song bool GetSongByFileName(const std::string& strFileName, CSong& song, int startOffset = 0); @@ -378,16 +374,6 @@ public: bool ScraperInUse(const std::string &scraperID) const; ///////////////////////////////////////////////// - // Karaoke - ///////////////////////////////////////////////// - void AddKaraokeData(int idSong, int iKaraokeNumber); - bool GetSongByKaraokeNumber( int number, CSong& song ); - bool SetKaraokeSongDelay( int idSong, int delay ); - int GetKaraokeSongsCount(); - void ExportKaraokeInfo(const std::string &outFile, bool asHTML ); - void ImportKaraokeInfo(const std::string &inputFile ); - - ///////////////////////////////////////////////// // Filters ///////////////////////////////////////////////// bool GetItems(const std::string &strBaseDir, CFileItemList &items, const Filter &filter = Filter(), const SortDescription &sortDescription = SortDescription()); @@ -542,9 +528,6 @@ private: song_idAlbum, song_strAlbum, song_strPath, - song_iKarNumber, - song_iKarDelay, - song_strKarEncoding, song_bCompilation, song_strAlbumArtists, song_strAlbumReleaseType, diff --git a/xbmc/music/Song.cpp b/xbmc/music/Song.cpp index c03ae91a83..50cf0f6c00 100644 --- a/xbmc/music/Song.cpp +++ b/xbmc/music/Song.cpp @@ -87,8 +87,6 @@ CSong::CSong(CFileItem& item) iEndOffset = item.m_lEndOffset; idSong = -1; iTimesPlayed = 0; - iKaraokeNumber = 0; - iKaraokeDelay = 0; //! Karaoke song lyrics-music delay in 1/10 seconds. idAlbum = -1; } @@ -128,7 +126,6 @@ void CSong::Serialize(CVariant& value) const value["timesplayed"] = iTimesPlayed; value["lastplayed"] = lastPlayed.IsValid() ? lastPlayed.GetAsDBDateTime() : ""; value["dateadded"] = dateAdded.IsValid() ? dateAdded.GetAsDBDateTime() : ""; - value["karaokenumber"] = (int64_t) iKaraokeNumber; value["albumid"] = idAlbum; } @@ -153,9 +150,6 @@ void CSong::Clear() iTimesPlayed = 0; lastPlayed.Reset(); dateAdded.Reset(); - iKaraokeNumber = 0; - strKaraokeLyrEncoding.clear(); - iKaraokeDelay = 0; idAlbum = -1; bCompilation = false; embeddedArt.clear(); diff --git a/xbmc/music/Song.h b/xbmc/music/Song.h index 2c6d7f1d02..14b32bc47b 100644 --- a/xbmc/music/Song.h +++ b/xbmc/music/Song.h @@ -143,10 +143,6 @@ public: int iEndOffset; bool bCompilation; - // Karaoke-specific information - long iKaraokeNumber; //! Karaoke song number to "select by number". 0 for non-karaoke - std::string strKaraokeLyrEncoding; //! Karaoke song lyrics encoding if known. Empty if unknown. - int iKaraokeDelay; //! Karaoke song lyrics-music delay in 1/10 seconds. ReplayGain replayGain; private: diff --git a/xbmc/music/infoscanner/MusicInfoScanner.cpp b/xbmc/music/infoscanner/MusicInfoScanner.cpp index 78b8ee1aa7..9d541d5007 100644 --- a/xbmc/music/infoscanner/MusicInfoScanner.cpp +++ b/xbmc/music/infoscanner/MusicInfoScanner.cpp @@ -587,7 +587,6 @@ void CMusicInfoScanner::FileItemsToAlbums(CFileItemList& items, VECALBUMS& album { song.iTimesPlayed = it->second.iTimesPlayed; song.lastPlayed = it->second.lastPlayed; - song.iKaraokeNumber = it->second.iKaraokeNumber; if (song.rating == '0') song.rating = it->second.rating; if (song.strThumb.empty()) song.strThumb = it->second.strThumb; } diff --git a/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp b/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp deleted file mode 100644 index 1554c4ddd8..0000000000 --- a/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.cpp +++ /dev/null @@ -1,270 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "GUIDialogKaraokeSongSelector.h" -#include "PlayListPlayer.h" -#include "playlists/PlayList.h" -#include "input/Key.h" -#include "guilib/LocalizeStrings.h" -#include "utils/log.h" -#include "utils/StringUtils.h" - -#define CONTROL_LABEL_SONGNUMBER 401 -#define CONTROL_LABEL_SONGNAME 402 - -static const unsigned int MAX_SONG_ID = 100000; - - -CGUIDialogKaraokeSongSelector::CGUIDialogKaraokeSongSelector( int id, const char *xmlFile ) - : CGUIDialog( id, xmlFile ) -{ - m_selectedNumber = 0; - m_songSelected = false; - m_updateData = false; -} - -CGUIDialogKaraokeSongSelector::~CGUIDialogKaraokeSongSelector(void) -{ -} - -void CGUIDialogKaraokeSongSelector::OnButtonNumeric( unsigned int code, bool reset_autotimer ) -{ - - // Add the number - m_selectedNumber = m_selectedNumber * 10 + code; - CLog::Log( LOGDEBUG, "CGUIDialogKaraokeSongSelector::OnButtonNumeric %d / %d" , code, m_selectedNumber); - - // If overflow (a typical way to delete the old number is add zeros), handle it - if ( m_selectedNumber >= MAX_SONG_ID ) - m_selectedNumber %= MAX_SONG_ID; - - // Reset activity timer - if ( reset_autotimer ) - SetAutoClose( m_autoCloseTimeout ); - - m_updateData = true; -} - -void CGUIDialogKaraokeSongSelector::OnButtonSelect() -{ - // We only handle "select" if a song is selected - if ( m_songSelected ) - { - std::string path = m_karaokeSong.strFileName; - CFileItemPtr pItem( new CFileItem( path, false) ); - m_songSelected = false; - - if ( m_startPlaying ) - { - g_playlistPlayer.ClearPlaylist(PLAYLIST_MUSIC); - g_playlistPlayer.SetRepeat( PLAYLIST_MUSIC, PLAYLIST::REPEAT_NONE ); - g_playlistPlayer.SetShuffle(PLAYLIST_MUSIC, false ); - g_playlistPlayer.Add( PLAYLIST_MUSIC, pItem ); - g_playlistPlayer.SetCurrentPlaylist(PLAYLIST_MUSIC); - g_playlistPlayer.Play(); - - CLog::Log(LOGDEBUG, "Karaoke song selector: playing song %s [%d]", path.c_str(), m_selectedNumber); - } - else - { - g_playlistPlayer.Add( PLAYLIST_MUSIC, pItem ); - CLog::Log(LOGDEBUG, "Karaoke song selector: adding song %s [%d]", path.c_str(), m_selectedNumber); - } - - Close(); - } -} - -int CGUIDialogKaraokeSongSelector::GetKeyNumber( int actionid ) -{ - switch( actionid ) - { - case REMOTE_0: - return 0; - - case REMOTE_1: - return 1; - - case REMOTE_2: - case ACTION_JUMP_SMS2: - return 2; - - case REMOTE_3: - case ACTION_JUMP_SMS3: - return 3; - - case REMOTE_4: - case ACTION_JUMP_SMS4: - return 4; - - case REMOTE_5: - case ACTION_JUMP_SMS5: - return 5; - - case REMOTE_6: - case ACTION_JUMP_SMS6: - return 6; - - case REMOTE_7: - case ACTION_JUMP_SMS7: - return 7; - - case REMOTE_8: - case ACTION_JUMP_SMS8: - return 8; - - case REMOTE_9: - case ACTION_JUMP_SMS9: - return 9; - } - - return -1; -} - -bool CGUIDialogKaraokeSongSelector::OnAction(const CAction & action) -{ - CLog::Log( LOGDEBUG, "CGUIDialogKaraokeSongSelector::OnAction %d" , action.GetID()); - - if ( GetKeyNumber( action.GetID() ) != -1 ) - { - OnButtonNumeric( GetKeyNumber( action.GetID() ) ); - return true; - } - - switch(action.GetID()) - { - case ACTION_SELECT_ITEM: - OnButtonSelect(); - break; - - case ACTION_DELETE_ITEM: - case ACTION_BACKSPACE: - OnBackspace(); - break; - } - - return CGUIDialog::OnAction( action ); -} - -void CGUIDialogKaraokeSongSelector::UpdateData() -{ - if ( m_updateData ) - { - // Update on-screen labels - std::string message = StringUtils::Format("%06d", m_selectedNumber); - message = g_localizeStrings.Get(179) + ": " + message; // Translated "Song" - - SET_CONTROL_LABEL(CONTROL_LABEL_SONGNUMBER, message); - - // Now try to find this song in the database - m_songSelected = m_musicdatabase.GetSongByKaraokeNumber( m_selectedNumber, m_karaokeSong ); - - if ( m_songSelected ) - message = m_karaokeSong.strTitle; - else - message = "* " + g_localizeStrings.Get(13205) + " *"; // Unknown - - SET_CONTROL_LABEL(CONTROL_LABEL_SONGNAME, message); - } - - m_updateData = false; -} - -void CGUIDialogKaraokeSongSelector::FrameMove() -{ - if ( m_updateData ) - UpdateData(); - - CGUIDialog::FrameMove(); -} - - -void CGUIDialogKaraokeSongSelector::OnBackspace() -{ - // Clear the number - m_selectedNumber /= 10; - - // Reset activity timer - SetAutoClose( m_autoCloseTimeout ); - m_updateData = true; -} - - -CGUIDialogKaraokeSongSelectorSmall::CGUIDialogKaraokeSongSelectorSmall() - : CGUIDialogKaraokeSongSelector( WINDOW_DIALOG_KARAOKE_SONGSELECT, "DialogKaraokeSongSelector.xml" ) -{ - m_autoCloseTimeout = 30000; // 30 sec - m_startPlaying = false; -} - - -CGUIDialogKaraokeSongSelectorLarge::CGUIDialogKaraokeSongSelectorLarge() - : CGUIDialogKaraokeSongSelector( WINDOW_DIALOG_KARAOKE_SELECTOR, "DialogKaraokeSongSelectorLarge.xml" ) -{ - m_autoCloseTimeout = 180000; // 180 sec - m_startPlaying = true; -} - -void CGUIDialogKaraokeSongSelector::OnInitWindow() -{ - CGUIDialog::OnInitWindow(); - - // Check if there are any karaoke songs in the database - if ( !m_musicdatabase.Open() ) - { - Close(); - return; - } - - if ( m_musicdatabase.GetKaraokeSongsCount() == 0 ) - { - Close(); - return; - } - - SetAutoClose( m_autoCloseTimeout ); -} - - -void CGUIDialogKaraokeSongSelector::OnDeinitWindow(int nextWindowID) -{ - CGUIDialog::OnDeinitWindow(nextWindowID); - m_musicdatabase.Close(); -} - - -void CGUIDialogKaraokeSongSelectorSmall::Open(unsigned int startcode) -{ - m_songSelected = false; - m_selectedNumber = 0; - - OnButtonNumeric( startcode, false ); - CGUIDialog::Open(); -} - - -void CGUIDialogKaraokeSongSelectorLarge::Open() -{ - m_songSelected = false; - m_selectedNumber = 0; - - OnButtonNumeric( 0, false ); - CGUIDialog::Open(); -} diff --git a/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.h b/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.h deleted file mode 100644 index 487ccff001..0000000000 --- a/xbmc/music/karaoke/GUIDialogKaraokeSongSelector.h +++ /dev/null @@ -1,87 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "guilib/GUIDialog.h" -#include "music/MusicDatabase.h" -#include "music/Song.h" - - -class CGUIDialogKaraokeSongSelector: public CGUIDialog -{ -public: - CGUIDialogKaraokeSongSelector( int id, const char *xmlFile ); - virtual ~CGUIDialogKaraokeSongSelector(void); - - //! Key/button parser; returns 0-9 for a numeric button action, and -1 for anything else - static int GetKeyNumber( int actionid ); - -protected: - // Those functions control the selection process - virtual void OnInitWindow(); - virtual void OnDeinitWindow(int nextWindowID); - virtual bool OnAction(const CAction &action); - virtual void FrameMove(); - - void OnButtonNumeric( unsigned int code, bool reset_autotimer = true ); // 0x00 - 0x09 - void OnButtonSelect(); // Song is selected - void OnBackspace(); // Backspace pressed - void UpdateData(); - - // Configuration - //! Auto-close timeout - unsigned int m_autoCloseTimeout; - - //! Start playing song as soon as it's selected? - bool m_startPlaying; - -protected: - //! Currently selected number - unsigned int m_selectedNumber; - - //! True if the number above did select some song and the info is in m_karaokeData - bool m_songSelected; - - //! True if we need to update fields before rendering - bool m_updateData; - - //! Database stuff - CMusicDatabase m_musicdatabase; - CSong m_karaokeSong; -}; - - -// A 'small' version of dialog using DialogKaraokeSongSelector.xml -class CGUIDialogKaraokeSongSelectorSmall : public CGUIDialogKaraokeSongSelector -{ - public: - CGUIDialogKaraokeSongSelectorSmall(); - void Open(unsigned int startcode); -}; - - -// A 'large' version of dialog using DialogKaraokeSongSelectorLarge.xml -class CGUIDialogKaraokeSongSelectorLarge : public CGUIDialogKaraokeSongSelector -{ - public: - CGUIDialogKaraokeSongSelectorLarge(); - void Open(); -}; diff --git a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp b/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp deleted file mode 100644 index 99456b4b71..0000000000 --- a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "Application.h" -#include "guilib/GUIWindowManager.h" -#include "input/Key.h" -#include "settings/AdvancedSettings.h" - -#include "GUIDialogKaraokeSongSelector.h" -#include "GUIWindowKaraokeLyrics.h" -#include "karaokelyrics.h" -#include "karaokewindowbackground.h" -#include "threads/SingleLock.h" - - -CGUIWindowKaraokeLyrics::CGUIWindowKaraokeLyrics(void) - : CGUIWindow(WINDOW_KARAOKELYRICS, "MusicKaraokeLyrics.xml") -{ - m_Lyrics = 0; - m_Background = new CKaraokeWindowBackground(); -} - - -CGUIWindowKaraokeLyrics::~ CGUIWindowKaraokeLyrics(void ) -{ - delete m_Background; -} - - -bool CGUIWindowKaraokeLyrics::OnAction(const CAction &action) -{ - CSingleLock lock (m_CritSection); - - if ( !m_Lyrics || !g_application.m_pPlayer->IsPlayingAudio() ) - return false; - - CGUIDialogKaraokeSongSelectorSmall * songSelector = (CGUIDialogKaraokeSongSelectorSmall *) - g_windowManager.GetWindow( WINDOW_DIALOG_KARAOKE_SONGSELECT ); - - switch(action.GetID()) - { - case ACTION_SUBTITLE_DELAY_MIN: - m_Lyrics->lyricsDelayDecrease(); - return true; - - case ACTION_SUBTITLE_DELAY_PLUS: - m_Lyrics->lyricsDelayIncrease(); - return true; - - default: - if ( CGUIDialogKaraokeSongSelector::GetKeyNumber( action.GetID() ) != -1 && songSelector && !songSelector->IsActive() ) - songSelector->Open( CGUIDialogKaraokeSongSelector::GetKeyNumber( action.GetID() ) ); - - break; - } - - // If our background control could handle the action, let it do it - if ( m_Background && m_Background->OnAction(action) ) - return true; - - return CGUIWindow::OnAction(action); -} - - -bool CGUIWindowKaraokeLyrics::OnMessage(CGUIMessage& message) -{ - switch ( message.GetMessage() ) - { - case GUI_MSG_WINDOW_INIT: - { - // Must be called here so we get our window ID and controls - if ( !CGUIWindow::OnMessage(message) ) - return false; - - m_Background->Init( this ); - return true; - } - break; - - case GUI_MSG_WINDOW_DEINIT: - { - CSingleLock lock (m_CritSection); - - // Close the song selector dialog if shown - CGUIDialogKaraokeSongSelectorSmall * songSelector = (CGUIDialogKaraokeSongSelectorSmall *) - g_windowManager.GetWindow( WINDOW_DIALOG_KARAOKE_SONGSELECT ); - - if ( songSelector && songSelector->IsActive() ) - songSelector->Close(); - } - break; - } - - return CGUIWindow::OnMessage(message); -} - -void CGUIWindowKaraokeLyrics::Process(unsigned int currentTime, CDirtyRegionList &dirtyregions) -{ - dirtyregions.push_back(CRect(0.0f, 0.0f, (float)g_graphicsContext.GetWidth(), (float)g_graphicsContext.GetHeight())); -} - -void CGUIWindowKaraokeLyrics::Render() -{ - g_application.ResetScreenSaver(); - CGUIWindow::Render(); - - CSingleLock lock (m_CritSection); - - if ( m_Lyrics ) - { - m_Background->Render(); - m_Lyrics->Render(); - } -} - - -void CGUIWindowKaraokeLyrics::newSong(CKaraokeLyrics * lyrics) -{ - CSingleLock lock (m_CritSection); - m_Lyrics = lyrics; - - m_Lyrics->InitGraphics(); - - // Set up current background mode - if ( m_Lyrics->HasVideo() ) - { - std::string path; - int64_t offset; - - // Start the required video - m_Lyrics->GetVideoParameters( path, offset ); - m_Background->StartVideo( path ); - } - else if ( m_Lyrics->HasBackground() && g_advancedSettings.m_karaokeAlwaysEmptyOnCdgs ) - { - m_Background->StartEmpty(); - } - else - { - m_Background->StartDefault(); - } -} - - -void CGUIWindowKaraokeLyrics::stopSong() -{ - CSingleLock lock (m_CritSection); - m_Lyrics = 0; - - m_Background->Stop(); -} - -void CGUIWindowKaraokeLyrics::pauseSong(bool now_paused) -{ - CSingleLock lock (m_CritSection); - m_Background->Pause( now_paused ); -} diff --git a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.h b/xbmc/music/karaoke/GUIWindowKaraokeLyrics.h deleted file mode 100644 index 434d003e67..0000000000 --- a/xbmc/music/karaoke/GUIWindowKaraokeLyrics.h +++ /dev/null @@ -1,53 +0,0 @@ -#pragma once - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "guilib/GUIWindow.h" - -class CKaraokeLyrics; -class CKaraokeWindowBackground; - - -class CGUIWindowKaraokeLyrics : public CGUIWindow -{ -public: - CGUIWindowKaraokeLyrics(void); - virtual ~CGUIWindowKaraokeLyrics(void); - virtual bool OnMessage(CGUIMessage& message); - virtual bool OnAction(const CAction &action); - virtual void Render(); - virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions); - - void newSong( CKaraokeLyrics * lyrics ); - void pauseSong( bool now_paused ); - void stopSong(); - -protected: - - //! Critical section protects this class from requests from different threads - CCriticalSection m_CritSection; - - //! Pointer to karaoke lyrics renderer - CKaraokeLyrics * m_Lyrics; - - //! Pointer to background object - CKaraokeWindowBackground * m_Background; -}; diff --git a/xbmc/music/karaoke/Makefile.in b/xbmc/music/karaoke/Makefile.in deleted file mode 100644 index 579ffe0964..0000000000 --- a/xbmc/music/karaoke/Makefile.in +++ /dev/null @@ -1,17 +0,0 @@ -SRCS = GUIDialogKaraokeSongSelector.cpp -SRCS += GUIWindowKaraokeLyrics.cpp -SRCS += karaokelyrics.cpp -SRCS += karaokelyricscdg.cpp -SRCS += karaokelyricsfactory.cpp -SRCS += karaokelyricsmanager.cpp -SRCS += karaokelyricstext.cpp -SRCS += karaokelyricstextkar.cpp -SRCS += karaokelyricstextlrc.cpp -SRCS += karaokelyricstextustar.cpp -SRCS += karaokevideobackground.cpp -SRCS += karaokewindowbackground.cpp - -LIB = karaoke.a - -include @abs_top_srcdir@/Makefile.include --include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) diff --git a/xbmc/music/karaoke/cdgdata.h b/xbmc/music/karaoke/cdgdata.h deleted file mode 100644 index 30d8255631..0000000000 --- a/xbmc/music/karaoke/cdgdata.h +++ /dev/null @@ -1,73 +0,0 @@ -#ifndef CDGDATA_H -#define CDGDATA_H - -// CDG Command Code -static const unsigned int CDG_COMMAND = 0x09; - -// CDG Instruction Codes -static const unsigned int CDG_INST_MEMORY_PRESET = 1; -static const unsigned int CDG_INST_BORDER_PRESET = 2; -static const unsigned int CDG_INST_TILE_BLOCK = 6; -static const unsigned int CDG_INST_SCROLL_PRESET = 20; -static const unsigned int CDG_INST_SCROLL_COPY = 24; -static const unsigned int CDG_INST_DEF_TRANSP_COL = 28; -static const unsigned int CDG_INST_LOAD_COL_TBL_0_7 = 30; -static const unsigned int CDG_INST_LOAD_COL_TBL_8_15 = 31; -static const unsigned int CDG_INST_TILE_BLOCK_XOR = 38; - -// Bitmask for all CDG fields -static const unsigned int CDG_MASK = 0x3F; - -// This is the size of the display as defined by the CDG specification. -// The pixels in this region can be painted, and scrolling operations -// rotate through this number of pixels. -static const unsigned int CDG_FULL_WIDTH = 300; -static const unsigned int CDG_FULL_HEIGHT = 216; -static const unsigned int CDG_BORDER_WIDTH = 6; -static const unsigned int CDG_BORDER_HEIGHT = 12; - -typedef struct -{ - char command; - char instruction; - char parityQ[2]; - char data[16]; - char parityP[4]; -} SubCode; - -typedef struct -{ - char color; // Only lower 4 bits are used, mask with 0x0F - char repeat; // Only lower 4 bits are used, mask with 0x0F - char filler[14]; -} CDG_MemPreset; - -typedef struct -{ - char color; // Only lower 4 bits are used, mask with 0x0F - char filler[15]; -} CDG_BorderPreset; - -typedef struct -{ - char color0; // Only lower 4 bits are used, mask with 0x0F - char color1; // Only lower 4 bits are used, mask with 0x0F - char row; // Only lower 5 bits are used, mask with 0x1F - char column; // Only lower 6 bits are used, mask with 0x3F - char tilePixels[12]; // Only lower 6 bits of each byte are used -} CDG_Tile; - -typedef struct -{ - char colorSpec[16]; // AND with 0x3F3F to clear P and Q channel -} CDG_LoadColorTable; - -typedef struct -{ - char color; // Only lower 4 bits are used, mask with 0x0F - char hScroll; // Only lower 6 bits are used, mask with 0x3F - char vScroll; // Only lower 6 bits are used, mask with 0x3F -} -CDG_Scroll; - -#endif // CDG_H diff --git a/xbmc/music/karaoke/karaokelyrics.cpp b/xbmc/music/karaoke/karaokelyrics.cpp deleted file mode 100644 index c61908aad4..0000000000 --- a/xbmc/music/karaoke/karaokelyrics.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyrics - -#include <math.h> - -#include "utils/MathUtils.h" -#include "Application.h" -#include "music/MusicDatabase.h" -#include "settings/AdvancedSettings.h" -#include "utils/log.h" - -#include "karaokelyrics.h" - -CKaraokeLyrics::CKaraokeLyrics() -{ - m_avOrigDelay = 0; - m_avDelay = 0; - m_idSong = 0; -} - - -CKaraokeLyrics::~CKaraokeLyrics() -{ -} - -void CKaraokeLyrics::Shutdown() -{ - // Update the song-specific delay in the database - if ( m_idSong && m_avOrigDelay != m_avDelay && g_advancedSettings.m_karaokeKeepDelay ) - { - // If the song is in karaoke db, get the delay - CMusicDatabase musicdatabase; - if ( musicdatabase.Open() ) - { - int delayval = MathUtils::round_int( m_avDelay * 10.0 ); - musicdatabase.SetKaraokeSongDelay( m_idSong, delayval ); - CLog::Log( LOGDEBUG, "Karaoke timing correction: set new delay %d for song %ld", delayval, m_idSong ); - } - - musicdatabase.Close(); - } - - m_idSong = 0; -} - -bool CKaraokeLyrics::InitGraphics() -{ - return true; -} - -void CKaraokeLyrics::initData( const std::string & songPath ) -{ - m_songPath = songPath; - - // Reset AV delay - m_avOrigDelay = m_avDelay = 0; - - // Get song ID if available - m_idSong = 0; - CMusicDatabase musicdatabase; - - // Get song-specific delay from the database - if ( g_advancedSettings.m_karaokeKeepDelay && musicdatabase.Open() ) - { - CSong song; - if ( musicdatabase.GetSongByFileName( songPath, song) ) - { - m_idSong = song.idSong; - if ( song.iKaraokeDelay != 0 ) - { - m_avOrigDelay = m_avDelay = (double) song.iKaraokeDelay / 10.0; - CLog::Log( LOGDEBUG, "Karaoke timing correction: restored lyrics delay from database to %g", m_avDelay ); - } - } - - musicdatabase.Close(); - } -} - -void CKaraokeLyrics::lyricsDelayIncrease() -{ - m_avDelay += 0.05; // 50ms -} - -void CKaraokeLyrics::lyricsDelayDecrease() -{ - m_avDelay -= 0.05; // 50ms -} - -double CKaraokeLyrics::getSongTime() const -{ - // m_avDelay may be negative - double songtime = g_application.GetTime() + m_avDelay; - return songtime >= 0 ? songtime : 0.0; -} - -std::string CKaraokeLyrics::getSongFile() const -{ - return m_songPath; -} diff --git a/xbmc/music/karaoke/karaokelyrics.h b/xbmc/music/karaoke/karaokelyrics.h deleted file mode 100644 index cf8f6aa638..0000000000 --- a/xbmc/music/karaoke/karaokelyrics.h +++ /dev/null @@ -1,92 +0,0 @@ -#ifndef KARAOKELYRICS_H -#define KARAOKELYRICS_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <string> - -// C++ Interface: karaokelyrics - -// Abstract interface class for all Karaoke lyrics -class CKaraokeLyrics -{ - public: - CKaraokeLyrics(); - virtual ~CKaraokeLyrics(); - - //! Parses the lyrics or song file, and loads the lyrics into memory. This function - //! returns true if the lyrics are successfully loaded, or loading is in progress, - //! and false otherwise. - virtual bool Load() = 0; - - //! Should return true if the lyrics have background, and therefore should not use - //! predefined background. - virtual bool HasBackground() = 0; - - //! Should return true if the lyrics have video file to play - virtual bool HasVideo() = 0; - - //! Should return video parameters if HasVideo() returned true - virtual void GetVideoParameters( std::string& path, int64_t& offset ) = 0; - - //! This function is called when the karoke visualisation window created. It may - //! be called after Start(), but is guaranteed to be called before Render() - //! Default implementation does nothing and returns true. - virtual bool InitGraphics(); - - //! This function is called to render the lyrics (each frame(?)) - virtual void Render() = 0; - - //! This function is called before the object is destroyed. Default implementation does nothing. - //! You must override it if your lyrics class starts threads which need to be stopped, and stop - //! all of them before returning back. - virtual void Shutdown(); - - //! This function gets 'real' time since the moment song begins, corrected by using remote control - //! to increase/decrease lyrics delays. All lyric show functions must use it to properly calculate - //! the offset. - double getSongTime() const; - - //! This function gets 'real' time since the moment song begins, corrected by using remote control - //! to increase/decrease lyrics delays. All lyric show functions must use it to properly calculate - //! the offset. - std::string getSongFile() const; - - //! Sets the path to the lyrics file, and restores musicdb values - void initData( const std::string& songPath ); - - //! Adjusts lyrics delay - void lyricsDelayIncrease(); - void lyricsDelayDecrease(); - - private: - //! Number of milliseconds the lyrics are delayed to compensate. - double m_avDelay; - - //! Original m_avDelay to see if it was changed - double m_avOrigDelay; - - //! Current playing song - std::string m_songPath; - long m_idSong; -}; - -#endif diff --git a/xbmc/music/karaoke/karaokelyricscdg.cpp b/xbmc/music/karaoke/karaokelyricscdg.cpp deleted file mode 100644 index d21aa9424e..0000000000 --- a/xbmc/music/karaoke/karaokelyricscdg.cpp +++ /dev/null @@ -1,610 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "system.h" -#include "filesystem/File.h" -#include "settings/DisplaySettings.h" -#include "guilib/GraphicContext.h" -#include "guilib/Texture.h" -#include "guilib/GUITexture.h" -#include "settings/AdvancedSettings.h" -#include "utils/MathUtils.h" -#include "utils/log.h" -#include "utils/auto_buffer.h" -#include "karaokelyricscdg.h" - - -CKaraokeLyricsCDG::CKaraokeLyricsCDG( const std::string& cdgFile ) - : CKaraokeLyrics() - , m_cdgFile(cdgFile) -{ - m_pCdgTexture = 0; - m_streamIdx = -1; - m_bgAlpha = 0xff000000; - m_fgAlpha = 0xff000000; - m_hOffset = 0; - m_vOffset = 0; - m_borderColor = 0; - m_bgColor = 0; - - memset( m_cdgScreen, 0, sizeof(m_cdgScreen) ); - - for ( int i = 0; i < 16; i++ ) - m_colorTable[i] = 0; -} - -CKaraokeLyricsCDG::~CKaraokeLyricsCDG() -{ - Shutdown(); -} - -bool CKaraokeLyricsCDG::HasBackground() -{ - return true; -} - -bool CKaraokeLyricsCDG::HasVideo() -{ - return false; -} - -void CKaraokeLyricsCDG::GetVideoParameters(std::string& path, int64_t & offset) -{ - // no bg video -} - -BYTE CKaraokeLyricsCDG::getPixel( int x, int y ) -{ - unsigned int offset = x + y * CDG_FULL_WIDTH; - - if ( x >= (int) CDG_FULL_WIDTH || y >= (int) CDG_FULL_HEIGHT ) - return m_borderColor; - - if ( x < 0 || y < 0 || offset >= CDG_FULL_HEIGHT * CDG_FULL_WIDTH ) - { - CLog::Log( LOGERROR, "CDG renderer: requested pixel (%d,%d) is out of boundary", x, y ); - return 0; - } - - return m_cdgScreen[offset]; -} - -void CKaraokeLyricsCDG::setPixel( int x, int y, BYTE color ) -{ - unsigned int offset = x + y * CDG_FULL_WIDTH; - - if ( x < 0 || y < 0 || offset >= CDG_FULL_HEIGHT * CDG_FULL_WIDTH ) - { - CLog::Log( LOGERROR, "CDG renderer: set pixel (%d,%d) is out of boundary", x, y ); - return; - } - - m_cdgScreen[offset] = color; -} - - -bool CKaraokeLyricsCDG::InitGraphics() -{ - // set the background to be completely transparent if we use visualisations, or completely solid if not - if ( g_advancedSettings.m_karaokeAlwaysEmptyOnCdgs ) - m_bgAlpha = 0xff000000; - else - m_bgAlpha = 0; - - if (!m_pCdgTexture) - { - m_pCdgTexture = new CTexture( CDG_FULL_WIDTH, CDG_FULL_HEIGHT, XB_FMT_A8R8G8B8 ); - } - - if ( !m_pCdgTexture ) - { - CLog::Log(LOGERROR, "CDG renderer: failed to create texture" ); - return false; - } - - return true; -} - -void CKaraokeLyricsCDG::Shutdown() -{ - m_cdgStream.clear(); - - if ( m_pCdgTexture ) - { - delete m_pCdgTexture; - m_pCdgTexture = NULL; - } -} - - -void CKaraokeLyricsCDG::Render() -{ - // Do not render if we have no texture - if ( !m_pCdgTexture ) - return; - - // Time to update? - unsigned int songTime = (unsigned int) MathUtils::round_int( (getSongTime() + g_advancedSettings.m_karaokeSyncDelayCDG) * 1000 ); - unsigned int packets_due = songTime * 300 / 1000; - - if ( UpdateBuffer( packets_due ) ) - { - XUTILS::auto_buffer buf(CDG_FULL_HEIGHT * CDG_FULL_WIDTH*sizeof(DWORD)); - DWORD* const pixelbuf = (DWORD*)buf.get(); - - // Update our texture content - for ( UINT y = 0; y < CDG_FULL_HEIGHT; y++ ) - { - DWORD *texel = (DWORD *) (pixelbuf + y * CDG_FULL_WIDTH); - - for ( UINT x = 0; x < CDG_FULL_WIDTH; x++ ) - { - BYTE colorindex = getPixel( x + m_hOffset, y + m_vOffset ); - DWORD TexColor = m_colorTable[ colorindex ]; - - // Is it transparent color? - if ( TexColor != 0xFFFFFFFF ) - { - TexColor &= 0x00FFFFFF; - - if ( colorindex == m_bgColor ) - TexColor |= m_bgAlpha; - else - TexColor |= m_fgAlpha; - } - else - TexColor = 0x00000000; - - *texel++ = TexColor; - } - } - - m_pCdgTexture->Update( CDG_FULL_WIDTH, CDG_FULL_HEIGHT, CDG_FULL_WIDTH * 4, XB_FMT_A8R8G8B8, (BYTE*) pixelbuf, false ); - } - - // Convert texture coordinates to (0..1) - CRect texCoords((float)CDG_BORDER_WIDTH / CDG_FULL_WIDTH, - (float)CDG_BORDER_HEIGHT / CDG_FULL_HEIGHT, - (float)(CDG_FULL_WIDTH - CDG_BORDER_WIDTH) / CDG_FULL_WIDTH, - (float)(CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT) / CDG_FULL_HEIGHT); - - // Get screen coordinates - const RESOLUTION_INFO info = g_graphicsContext.GetResInfo(); - CRect vertCoords((float)info.Overscan.left, - (float)info.Overscan.top, - (float)info.Overscan.right, - (float)info.Overscan.bottom); - - CGUITexture::DrawQuad(vertCoords, 0xffffffff, m_pCdgTexture, &texCoords); -} - -void CKaraokeLyricsCDG::cmdMemoryPreset( const char * data ) -{ - CDG_MemPreset* preset = (CDG_MemPreset*) data; - - if ( preset->repeat & 0x0F ) - return; // No need for multiple clearings - - m_bgColor = preset->color & 0x0F; - - for ( unsigned int i = CDG_BORDER_WIDTH; i < CDG_FULL_WIDTH - CDG_BORDER_WIDTH; i++ ) - for ( unsigned int j = CDG_BORDER_HEIGHT; j < CDG_FULL_HEIGHT - CDG_BORDER_HEIGHT; j++ ) - setPixel( i, j, m_bgColor ); - - //CLog::Log( LOGDEBUG, "CDG: screen color set to %d", m_bgColor ); -} - -void CKaraokeLyricsCDG::cmdBorderPreset( const char * data ) -{ - CDG_BorderPreset* preset = (CDG_BorderPreset*) data; - - m_borderColor = preset->color & 0x0F; - - for ( unsigned int i = 0; i < CDG_BORDER_WIDTH; i++ ) - { - for ( unsigned int j = 0; j < CDG_FULL_HEIGHT; j++ ) - { - setPixel( i, j, m_borderColor ); - setPixel( CDG_FULL_WIDTH - i - 1, j, m_borderColor ); - } - } - - for ( unsigned int i = 0; i < CDG_FULL_WIDTH; i++ ) - { - for ( unsigned int j = 0; j < CDG_BORDER_HEIGHT; j++ ) - { - setPixel( i, j, m_borderColor ); - setPixel( i, CDG_FULL_HEIGHT - j - 1, m_borderColor ); - } - } - - //CLog::Log( LOGDEBUG, "CDG: border color set to %d", borderColor ); -} - -void CKaraokeLyricsCDG::cmdTransparentColor( const char * data ) -{ - int index = data[0] & 0x0F; - m_colorTable[index] = 0xFFFFFFFF; -} - -void CKaraokeLyricsCDG::cmdLoadColorTable( const char * data, int index ) -{ - CDG_LoadColorTable* table = (CDG_LoadColorTable*) data; - - for ( int i = 0; i < 8; i++ ) - { - UINT colourEntry = ((table->colorSpec[2 * i] & CDG_MASK) << 8); - colourEntry = colourEntry + (table->colorSpec[(2 * i) + 1] & CDG_MASK); - colourEntry = ((colourEntry & 0x3F00) >> 2) | (colourEntry & 0x003F); - - BYTE red = ((colourEntry & 0x0F00) >> 8) * 17; - BYTE green = ((colourEntry & 0x00F0) >> 4) * 17; - BYTE blue = ((colourEntry & 0x000F)) * 17; - - m_colorTable[index+i] = (red << 16) | (green << 8) | blue; - - //CLog::Log( LOGDEBUG, "CDG: loadColors: color %d -> %02X %02X %02X (%08X)", index + i, red, green, blue, m_colorTable[index+i] ); - } -} - -void CKaraokeLyricsCDG::cmdTileBlock( const char * data ) -{ - CDG_Tile* tile = (CDG_Tile*) data; - UINT offset_y = (tile->row & 0x1F) * 12; - UINT offset_x = (tile->column & 0x3F) * 6; - - //CLog::Log( LOGERROR, "TileBlockXor: %d, %d", offset_x, offset_y ); - - if ( offset_x + 6 >= CDG_FULL_WIDTH || offset_y + 12 >= CDG_FULL_HEIGHT ) - return; - - // In the XOR variant, the color values are combined with the color values that are - // already onscreen using the XOR operator. Since CD+G only allows a maximum of 16 - // colors, we are XORing the pixel values (0-15) themselves, which correspond to - // indexes into a color lookup table. We are not XORing the actual R,G,B values. - BYTE color_0 = tile->color0 & 0x0F; - BYTE color_1 = tile->color1 & 0x0F; - - BYTE mask[6] = { 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; - - for ( int i = 0; i < 12; i++ ) - { - BYTE bTemp = tile->tilePixels[i] & 0x3F; - - for ( int j = 0; j < 6; j++ ) - { - if ( bTemp & mask[j] ) - setPixel( offset_x + j, offset_y + i, color_1 ); - else - setPixel( offset_x + j, offset_y + i, color_0 ); - } - } -} - -void CKaraokeLyricsCDG::cmdTileBlockXor( const char * data ) -{ - CDG_Tile* tile = (CDG_Tile*) data; - UINT offset_y = (tile->row & 0x1F) * 12; - UINT offset_x = (tile->column & 0x3F) * 6; - - //CLog::Log( LOGERROR, "TileBlockXor: %d, %d", offset_x, offset_y ); - - if ( offset_x + 6 >= CDG_FULL_WIDTH || offset_y + 12 >= CDG_FULL_HEIGHT ) - return; - - // In the XOR variant, the color values are combined with the color values that are - // already onscreen using the XOR operator. Since CD+G only allows a maximum of 16 - // colors, we are XORing the pixel values (0-15) themselves, which correspond to - // indexes into a color lookup table. We are not XORing the actual R,G,B values. - BYTE color_0 = tile->color0 & 0x0F; - BYTE color_1 = tile->color1 & 0x0F; - - BYTE mask[6] = { 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }; - - for ( int i = 0; i < 12; i++ ) - { - BYTE bTemp = tile->tilePixels[i] & 0x3F; - - for ( int j = 0; j < 6; j++ ) - { - // Find the original color index - BYTE origindex = getPixel( offset_x + j, offset_y + i ); - - if ( bTemp & mask[j] ) //pixel xored with color1 - setPixel( offset_x + j, offset_y + i, origindex ^ color_1 ); - else - setPixel( offset_x + j, offset_y + i, origindex ^ color_0 ); - } - } -} - -// Based on http://cdg2video.googlecode.com/svn/trunk/cdgfile.cpp -void CKaraokeLyricsCDG::cmdScroll( const char * data, bool copy ) -{ - int colour, hScroll, vScroll; - int hSCmd, hOffset, vSCmd, vOffset; - int vScrollPixels, hScrollPixels; - - // Decode the scroll command parameters - colour = data[0] & 0x0F; - hScroll = data[1] & 0x3F; - vScroll = data[2] & 0x3F; - - hSCmd = (hScroll & 0x30) >> 4; - hOffset = (hScroll & 0x07); - vSCmd = (vScroll & 0x30) >> 4; - vOffset = (vScroll & 0x0F); - - m_hOffset = hOffset < 5 ? hOffset : 5; - m_vOffset = vOffset < 11 ? vOffset : 11; - - // Scroll Vertical - Calculate number of pixels - vScrollPixels = 0; - - if (vSCmd == 2) - { - vScrollPixels = - 12; - } - else if (vSCmd == 1) - { - vScrollPixels = 12; - } - - // Scroll Horizontal- Calculate number of pixels - hScrollPixels = 0; - - if (hSCmd == 2) - { - hScrollPixels = - 6; - } - else if (hSCmd == 1) - { - hScrollPixels = 6; - } - - if (hScrollPixels == 0 && vScrollPixels == 0) - { - return; - } - - // Perform the actual scroll. - unsigned char temp[CDG_FULL_HEIGHT][CDG_FULL_WIDTH]; - int vInc = vScrollPixels + CDG_FULL_HEIGHT; - int hInc = hScrollPixels + CDG_FULL_WIDTH; - unsigned int ri; // row index - unsigned int ci; // column index - - for (ri = 0; ri < CDG_FULL_HEIGHT; ++ri) - { - for (ci = 0; ci < CDG_FULL_WIDTH; ++ci) - { - temp[(ri + vInc) % CDG_FULL_HEIGHT][(ci + hInc) % CDG_FULL_WIDTH] = getPixel( ci, ri ); - } - } - - // if copy is false, we were supposed to fill in the new pixels - // with a new colour. Go back and do that now. - - if (!copy) - { - if (vScrollPixels > 0) - { - for (ci = 0; ci < CDG_FULL_WIDTH; ++ci) - { - for (ri = 0; ri < (unsigned int)vScrollPixels; ++ri) { - temp[ri][ci] = colour; - } - } - } - else if (vScrollPixels < 0) - { - for (ci = 0; ci < CDG_FULL_WIDTH; ++ci) - { - for (ri = CDG_FULL_HEIGHT + vScrollPixels; ri < CDG_FULL_HEIGHT; ++ri) { - temp[ri][ci] = colour; - } - } - } - - if (hScrollPixels > 0) - { - for (ci = 0; ci < (unsigned int)hScrollPixels; ++ci) - { - for (ri = 0; ri < CDG_FULL_HEIGHT; ++ri) { - temp[ri][ci] = colour; - } - } - } - else if (hScrollPixels < 0) - { - for (ci = CDG_FULL_WIDTH + hScrollPixels; ci < CDG_FULL_WIDTH; ++ci) - { - for (ri = 0; ri < CDG_FULL_HEIGHT; ++ri) { - temp[ri][ci] = colour; - } - } - } - } - - // Now copy the temporary buffer back to our array - for (ri = 0; ri < CDG_FULL_HEIGHT; ++ri) - { - for (ci = 0; ci < CDG_FULL_WIDTH; ++ci) - { - setPixel( ci, ri, temp[ri][ci] ); - } - } -} - -bool CKaraokeLyricsCDG::UpdateBuffer( unsigned int packets_due ) -{ - bool screen_changed = false; - - // Are we done? - if ( m_streamIdx == -1 ) - return false; - - // Was the stream position reversed? In this case we have to "replay" the whole stream - // as the screen is a state machine, and "clear" may not be there. - if ( m_streamIdx > 0 && m_cdgStream[ m_streamIdx-1 ].packetnum > packets_due ) - { - CLog::Log( LOGDEBUG, "CDG renderer: packet number changed backward (%d played, %d asked", m_cdgStream[ m_streamIdx-1 ].packetnum, packets_due ); - m_streamIdx = 0; - } - - // Process all packets already due - while ( m_cdgStream[ m_streamIdx ].packetnum <= packets_due ) - { - SubCode& sc = m_cdgStream[ m_streamIdx ].subcode; - - // Execute the instruction - switch ( sc.instruction & CDG_MASK ) - { - case CDG_INST_MEMORY_PRESET: - cmdMemoryPreset( sc.data ); - screen_changed = true; - break; - - case CDG_INST_BORDER_PRESET: - cmdBorderPreset( sc.data ); - screen_changed = true; - break; - - case CDG_INST_LOAD_COL_TBL_0_7: - cmdLoadColorTable( sc.data, 0 ); - break; - - case CDG_INST_LOAD_COL_TBL_8_15: - cmdLoadColorTable( sc.data, 8 ); - break; - - case CDG_INST_DEF_TRANSP_COL: - cmdTransparentColor( sc.data ); - break; - - case CDG_INST_TILE_BLOCK: - cmdTileBlock( sc.data ); - screen_changed = true; - break; - - case CDG_INST_TILE_BLOCK_XOR: - cmdTileBlockXor( sc.data ); - screen_changed = true; - break; - - case CDG_INST_SCROLL_PRESET: - cmdScroll( sc.data, false ); - screen_changed = true; - break; - - case CDG_INST_SCROLL_COPY: - cmdScroll( sc.data, true ); - screen_changed = true; - break; - - default: // this shouldn't happen as we validated the stream in Load() - break; - } - - m_streamIdx++; - - if ( m_streamIdx >= (int) m_cdgStream.size() ) - { - m_streamIdx = -1; - break; - } - } - - return screen_changed; -} - -bool CKaraokeLyricsCDG::Load() -{ - // Read the whole CD+G file into memory array - XFILE::CFile file; - - m_cdgStream.clear(); - - XFILE::auto_buffer buf; - if (file.LoadFile(m_cdgFile, buf) <= 0) - { - CLog::Log(LOGERROR, "CDG loader: can't load CDG file \"%s\"", m_cdgFile.c_str()); - return false; - } - - file.Close(); - - // Parse the CD+G stream - int buggy_commands = 0; - - for (unsigned int offset = 0; offset < buf.size(); offset += sizeof(SubCode)) - { - SubCode * sc = (SubCode *)(buf.get() + offset); - - if ( ( sc->command & CDG_MASK) == CDG_COMMAND ) - { - CDGPacket packet; - - // Validate the command and instruction - switch ( sc->instruction & CDG_MASK ) - { - case CDG_INST_MEMORY_PRESET: - case CDG_INST_BORDER_PRESET: - case CDG_INST_LOAD_COL_TBL_0_7: - case CDG_INST_LOAD_COL_TBL_8_15: - case CDG_INST_TILE_BLOCK_XOR: - case CDG_INST_TILE_BLOCK: - case CDG_INST_DEF_TRANSP_COL: - case CDG_INST_SCROLL_PRESET: - case CDG_INST_SCROLL_COPY: - memcpy( &packet.subcode, sc, sizeof(SubCode) ); - packet.packetnum = offset / sizeof( SubCode ); - m_cdgStream.push_back( packet ); - break; - - default: - buggy_commands++; - break; - } - } - } - - // Init the screen - memset( m_cdgScreen, 0, sizeof(m_cdgScreen) ); - - // Init color table - for ( int i = 0; i < 16; i++ ) - m_colorTable[i] = 0; - - m_streamIdx = 0; - m_borderColor = 0; - m_bgColor = 0; - m_hOffset = 0; - m_vOffset = 0; - - if ( buggy_commands == 0 ) - CLog::Log( LOGDEBUG, "CDG loader: CDG file %s has been loading successfully, %d useful packets, %dKb used", - m_cdgFile.c_str(), (int)m_cdgStream.size(), (int)(m_cdgStream.size() * sizeof(CDGPacket) / 1024) ); - else - CLog::Log( LOGDEBUG, "CDG loader: CDG file %s was damaged, %d errors ignored, %d useful packets, %dKb used", - m_cdgFile.c_str(), buggy_commands, (int)m_cdgStream.size(), (int)(m_cdgStream.size() * sizeof(CDGPacket) / 1024) ); - - return true; -} diff --git a/xbmc/music/karaoke/karaokelyricscdg.h b/xbmc/music/karaoke/karaokelyricscdg.h deleted file mode 100644 index 2b3b5bbc48..0000000000 --- a/xbmc/music/karaoke/karaokelyricscdg.h +++ /dev/null @@ -1,114 +0,0 @@ -#ifndef KARAOKELYRICSCDG_H -#define KARAOKELYRICSCDG_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricscdg - -#include "cdgdata.h" -#include "karaokelyrics.h" - -class CBaseTexture; -typedef uint32_t color_t; - -class CKaraokeLyricsCDG : public CKaraokeLyrics -{ - public: - CKaraokeLyricsCDG( const std::string& cdgFile ); - ~CKaraokeLyricsCDG(); - - //! Parses the lyrics or song file, and loads the lyrics into memory. Returns true if the - //! lyrics are successfully loaded, false otherwise. - bool Load(); - - //! Virtually all CDG lyrics have some kind of background - virtual bool HasBackground(); - - //! Should return true if the lyrics have video file to play - virtual bool HasVideo(); - - //! Should return video parameters if HasVideo() returned true - virtual void GetVideoParameters(std::string& path, int64_t& offset); - - //! This function is called when the karoke visualisation window created. It may - //! be called after Start(), but is guaranteed to be called before Render() - //! Default implementation does nothing. - virtual bool InitGraphics(); - - //! This function is called when the karoke visualisation window is destroyed. - //! Default implementation does nothing. - virtual void Shutdown(); - - //! This function is called to render the lyrics (each frame(?)) - virtual void Render(); - - protected: - void cmdMemoryPreset( const char * data ); - void cmdBorderPreset( const char * data ); - void cmdLoadColorTable( const char * data, int index ); - void cmdTileBlock( const char * data ); - void cmdTileBlockXor( const char * data ); - void cmdTransparentColor( const char * data ); - - void cmdScroll( const char * data, bool loop ); - void scrollLeft( int color ); - void scrollRight( int color ); - void scrollUp( int color ); - void scrollDown( int color ); - - bool UpdateBuffer( unsigned int packets_due ); - void RenderIntoBuffer( unsigned char *pixels, unsigned int width, unsigned int height, unsigned int pitch ) const; - - private: - BYTE getPixel( int x, int y ); - void setPixel( int x, int y, BYTE color ); - - //! CDG file name - std::string m_cdgFile; - - typedef struct - { - unsigned int packetnum; - SubCode subcode; - } CDGPacket; - - std::vector<CDGPacket> m_cdgStream; //!< Parsed CD+G stream storage - int m_streamIdx; //!< Packet about to be rendered - DWORD m_colorTable[16]; //!< CD+G color table; color format is A8R8G8B8 - BYTE m_bgColor; //!< Background color index - BYTE m_borderColor; //!< Border color index - BYTE m_cdgScreen[CDG_FULL_WIDTH*CDG_FULL_HEIGHT]; //!< Image state for CD+G stream - - // These values are used to implement screen shifting. The CDG specification allows the entire - // screen to be shifted, up to 5 pixels right and 11 pixels down. This shift is persistent - // until it is reset to a different value. In practice, this is used in conjunction with - // scrolling (which always jumps in integer blocks of 6x12 pixels) to perform - // one-pixel-at-a-time scrolls. - BYTE m_hOffset; - BYTE m_vOffset; - - //! Rendering stuff - CBaseTexture * m_pCdgTexture; - color_t m_bgAlpha; //!< background alpha - color_t m_fgAlpha; //!< foreground alpha -}; - -#endif diff --git a/xbmc/music/karaoke/karaokelyricsfactory.cpp b/xbmc/music/karaoke/karaokelyricsfactory.cpp deleted file mode 100644 index bd44d55f04..0000000000 --- a/xbmc/music/karaoke/karaokelyricsfactory.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyricsfactory - -#include "utils/StringUtils.h" -#include "utils/URIUtils.h" -#include "filesystem/File.h" - -#include "karaokelyricscdg.h" -#include "karaokelyricstextkar.h" -#include "karaokelyricstextlrc.h" -#include "karaokelyricstextustar.h" -#include "karaokelyricsfactory.h" - - -// A helper function to have all the checks in a single place -bool CheckAndCreateLyrics( const std::string & songName, CKaraokeLyrics ** lyricptr ) -{ - std::string filename = songName; - URIUtils::RemoveExtension( filename ); - std::string ext = URIUtils::GetExtension(songName); - - // LRC lyrics have .lrc extension - if ( XFILE::CFile::Exists( filename + ".lrc" ) ) - { - if ( lyricptr ) - *lyricptr = new CKaraokeLyricsTextLRC( filename + ".lrc" ); - - return true; - } - - // MIDI/KAR files keep lyrics inside - if (StringUtils::StartsWith(ext, ".mid") || - StringUtils::StartsWith(ext, ".kar")) - { - if ( lyricptr ) - *lyricptr = new CKaraokeLyricsTextKAR( songName ); - - return true; - } - - // CD-G lyrics have .cdg extension - if ( XFILE::CFile::Exists( filename + ".cdg" ) ) - { - if ( lyricptr ) - *lyricptr = new CKaraokeLyricsCDG( filename + ".cdg" ); - - return true; - } - - // UltraStar lyrics have .txt extension - if ( XFILE::CFile::Exists( filename + ".txt" ) && CKaraokeLyricsTextUStar::isValidFile( filename + ".txt" ) ) - { - if ( lyricptr ) - *lyricptr = new CKaraokeLyricsTextUStar( filename + ".txt" ); - - return true; - } - - if ( lyricptr ) - *lyricptr = 0; - - return false; -} - - -CKaraokeLyrics * CKaraokeLyricsFactory::CreateLyrics( const std::string & songName ) -{ - CKaraokeLyrics * lyricptr = 0; - - CheckAndCreateLyrics( songName, &lyricptr ); - return lyricptr; -} - - -bool CKaraokeLyricsFactory::HasLyrics(const std::string & songName) -{ - return CheckAndCreateLyrics( songName, 0 ); -} diff --git a/xbmc/music/karaoke/karaokelyricsfactory.h b/xbmc/music/karaoke/karaokelyricsfactory.h deleted file mode 100644 index 658f5bc00e..0000000000 --- a/xbmc/music/karaoke/karaokelyricsfactory.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef KARAOKELYRICSFACTORY_H -#define KARAOKELYRICSFACTORY_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricsfactory - -#include "karaokelyrics.h" - -class CKaraokeLyricsFactory -{ - public: - CKaraokeLyricsFactory() {}; - ~CKaraokeLyricsFactory() {}; - - //! This function will be called to check if there are any classes which could load lyrics - //! for the song played. The action will be executed in a single thread, and therefore - //! should be limited to simple checks like whether the specific filename exists. - //! If the loader needs more than that to make sure lyrics are there, it must create this - //! loader, which should handle the processing in load(). - static CKaraokeLyrics * CreateLyrics( const std::string& songName ); - - //! This function returns true if the lyrics are (or might be) available for this song. - static bool HasLyrics( const std::string& songName ); -}; - -#endif diff --git a/xbmc/music/karaoke/karaokelyricsmanager.cpp b/xbmc/music/karaoke/karaokelyricsmanager.cpp deleted file mode 100644 index d698d5ff8e..0000000000 --- a/xbmc/music/karaoke/karaokelyricsmanager.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyricsmanager - -#include "threads/SystemClock.h" -#include "Application.h" -#include "guilib/GUIWindowManager.h" -#include "settings/Settings.h" - -#include "karaokelyrics.h" -#include "karaokelyricsfactory.h" -#include "karaokelyricsmanager.h" - -#include "GUIDialogKaraokeSongSelector.h" -#include "GUIWindowKaraokeLyrics.h" -#include "threads/SingleLock.h" -#include "utils/log.h" - -CKaraokeLyricsManager::CKaraokeLyricsManager() -{ - m_Lyrics = 0; - m_karaokeSongPlaying = false; - m_karaokeSongPlayed = false; - m_lastPlayedTime = 0; -} - -CKaraokeLyricsManager::~ CKaraokeLyricsManager() -{ - if ( m_Lyrics ) - { - m_Lyrics->Shutdown(); - delete m_Lyrics; - } -} - -bool CKaraokeLyricsManager::Start(const std::string & strSongPath) -{ - CSingleLock lock (m_CritSection); - - // Init to false - m_karaokeSongPlayed = false; - m_lastPlayedTime = 0; - - if ( m_Lyrics ) - Stop(); // shouldn't happen, but... - - // If disabled by configuration, do nothing - if ( !CSettings::GetInstance().GetBool(CSettings::SETTING_KARAOKE_ENABLED) ) - return false; - - m_Lyrics = CKaraokeLyricsFactory::CreateLyrics( strSongPath ); - - if ( !m_Lyrics ) - { - CLog::Log( LOGDEBUG, "Karaoke: lyrics for song %s not found", strSongPath.c_str() ); - return false; - } - - m_Lyrics->initData( strSongPath ); - - // Load the lyrics - if ( !m_Lyrics->Load() ) - { - CLog::Log( LOGWARNING, "Karaoke: lyrics for song %s found but cannot be loaded", strSongPath.c_str() ); - delete m_Lyrics; - m_Lyrics = 0; - return false; - } - - CLog::Log( LOGDEBUG, "Karaoke: lyrics for song %s loaded successfully", strSongPath.c_str() ); - - CGUIWindowKaraokeLyrics *window = (CGUIWindowKaraokeLyrics*) g_windowManager.GetWindow(WINDOW_KARAOKELYRICS); - - if ( !window ) - { - CLog::Log( LOGERROR, "Karaoke window is not found" ); - return false; - } - - // Activate karaoke window - g_windowManager.ActivateWindow(WINDOW_KARAOKELYRICS); - - // Start the song - window->newSong( m_Lyrics ); - - m_karaokeSongPlaying = true; - m_karaokeSongPlayed = true; - return true; -} - -void CKaraokeLyricsManager::Stop() -{ - CSingleLock lock (m_CritSection); - - m_karaokeSongPlaying = false; - - if ( !m_Lyrics ) - return; - - // Clean up and close karaoke window when stopping - CGUIWindowKaraokeLyrics *window = (CGUIWindowKaraokeLyrics*) g_windowManager.GetWindow(WINDOW_KARAOKELYRICS); - - if ( window ) - window->stopSong(); - - // turn off visualisation window when stopping - if (g_windowManager.GetActiveWindow() == WINDOW_KARAOKELYRICS) - g_windowManager.PreviousWindow(); - - m_Lyrics->Shutdown(); - delete m_Lyrics; - m_Lyrics = 0; -} - - -void CKaraokeLyricsManager::ProcessSlow() -{ - CSingleLock lock (m_CritSection); - - if ( g_application.m_pPlayer->IsPlaying() ) - { - if ( m_karaokeSongPlaying ) - m_lastPlayedTime = XbmcThreads::SystemClockMillis(); - - return; - } - - if ( !m_karaokeSongPlayed || !CSettings::GetInstance().GetBool(CSettings::SETTING_KARAOKE_AUTOPOPUPSELECTOR) ) - return; - - // If less than 750ms passed return; we're still processing STOP events - if ( !m_lastPlayedTime || XbmcThreads::SystemClockMillis() - m_lastPlayedTime < 750 ) - return; - - m_karaokeSongPlayed = false; // so it won't popup again - - CGUIDialogKaraokeSongSelectorLarge * selector = - (CGUIDialogKaraokeSongSelectorLarge*)g_windowManager.GetWindow( WINDOW_DIALOG_KARAOKE_SELECTOR ); - - selector->Open(); -} - -void CKaraokeLyricsManager::SetPaused(bool now_paused) -{ - CSingleLock lock (m_CritSection); - - // Clean up and close karaoke window when stopping - CGUIWindowKaraokeLyrics *window = (CGUIWindowKaraokeLyrics*) g_windowManager.GetWindow(WINDOW_KARAOKELYRICS); - - if ( window ) - window->pauseSong( now_paused ); -} diff --git a/xbmc/music/karaoke/karaokelyricsmanager.h b/xbmc/music/karaoke/karaokelyricsmanager.h deleted file mode 100644 index 68d06a4ca9..0000000000 --- a/xbmc/music/karaoke/karaokelyricsmanager.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef KARAOKELYRICSMANAGER_H -#define KARAOKELYRICSMANAGER_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricsmanager -// -#include <string> - -class CKaraokeLyrics; -class CGUIDialogKaraokeSongSelectorSmall; - - -//! This is the main lyrics manager class, which is called from XBMC code. -class CKaraokeLyricsManager -{ - public: - //! The class instance created only once during the application life, - //! and is destroyed when the app shuts down. - CKaraokeLyricsManager(); - ~CKaraokeLyricsManager(); - - //! A new song is started playing - bool Start( const std::string& strSongPath ); - - //! Called when the current song is being paused or unpaused - void SetPaused( bool now_paused ); - - //! Called when the current song is being stopped. Changing to a new song - //! in the queue generates Stop() with followed Start() calls. May be called even if - //! Start() was not called before, so please check. - void Stop(); - - //! Might pop up a selection dialog if playback is ended - void ProcessSlow(); - - private: - //! Critical section protects this class from requests from different threads - CCriticalSection m_CritSection; - - //! A class which handles loading and rendering for this specific karaoke song. - //! Obtained from KaraokeLyricsFactory - CKaraokeLyrics * m_Lyrics; - - //! True if we're playing a karaoke song - bool m_karaokeSongPlaying; - - //! True if we played a karaoke song - bool m_karaokeSongPlayed; - - //! Stores the last time the song was still played - unsigned int m_lastPlayedTime; -}; - - -#endif diff --git a/xbmc/music/karaoke/karaokelyricstext.cpp b/xbmc/music/karaoke/karaokelyricstext.cpp deleted file mode 100644 index 067cecabb9..0000000000 --- a/xbmc/music/karaoke/karaokelyricstext.cpp +++ /dev/null @@ -1,748 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyricstext - -#include <math.h> - -#include "utils/CharsetConverter.h" -#include "settings/DisplaySettings.h" -#include "settings/Settings.h" -#include "guilib/GUITextLayout.h" -#include "guilib/GUIFont.h" -#include "karaokelyricstext.h" -#include "utils/URIUtils.h" -#include "filesystem/File.h" -#include "guilib/GUIFontManager.h" -#include "addons/Skin.h" -#include "utils/MathUtils.h" -#include "utils/log.h" -#include "utils/StringUtils.h" - -typedef struct -{ - unsigned int text; - unsigned int active; - unsigned int outline; - -} LyricColors; - -// Must be synchronized with strings.xml and GUISettings.cpp! -static LyricColors gLyricColors[] = -{ - // <string id="22040">white/green</string> - // First 0xFF is alpha! - { 0xFFDADADA, 0xFF00FF00, 0xFF000000 }, - - // <string id="22041">white/red</string> - { 0xFFDADADA, 0xFFFF0000, 0xFF000000 }, - - // <string id="22042">white/blue</string> - { 0xFFDADADA, 0xFF0000FF, 0xFF000000 }, - - // <string id="22043">black/white</string> - { 0xFF000000, 0xFFDADADA, 0xFFFFFFFF }, -}; - - -CKaraokeLyricsText::CKaraokeLyricsText() - : CKaraokeLyrics() -{ - m_karaokeLayout = 0; - m_preambleLayout = 0; - m_karaokeFont = 0; - - int coloridx = CSettings::GetInstance().GetInt(CSettings::SETTING_KARAOKE_FONTCOLORS); - if ( coloridx < KARAOKE_COLOR_START || coloridx >= KARAOKE_COLOR_END ) - coloridx = 0; - - m_colorLyrics = gLyricColors[coloridx].text; - m_colorLyricsOutline = gLyricColors[coloridx].outline; - m_colorSinging = StringUtils::Format("%08X", gLyricColors[coloridx].active); - - m_delayAfter = 50; // 5 seconds - m_showLyricsBeforeStart = 50; // 7.5 seconds - m_showPreambleBeforeStart = 35; // 5.5 seconds - m_paragraphBreakTime = 50; // 5 seconds; for autodetection paragraph breaks - m_mergeLines = true; - m_hasPitch = false; - m_videoOffset = 0; - - m_lyricsState = STATE_END_SONG; -} - - -CKaraokeLyricsText::~CKaraokeLyricsText() -{ -} - -void CKaraokeLyricsText::clearLyrics() -{ - m_lyrics.clear(); - m_songName.clear(); - m_artist.clear(); - m_hasPitch = false; - m_videoFile.clear(); - m_videoOffset = 0; -} - - -void CKaraokeLyricsText::addLyrics(const std::string & text, unsigned int timing, unsigned int flags, unsigned int pitch) -{ - Lyric line; - - if ( flags & LYRICS_CONVERT_UTF8 ) - { - // Reset the flag - flags &= ~LYRICS_CONVERT_UTF8; - g_charsetConverter.unknownToUTF8(text, line.text); - } - else - { - line.text = text; - } - - line.flags = flags; - line.timing = timing; - line.pitch = pitch; - - // If this is the first entry, remove LYRICS_NEW_LINE and LYRICS_NEW_PARAGRAPH flags - if ( m_lyrics.size() == 0 ) - line.flags &= ~(LYRICS_NEW_LINE | LYRICS_NEW_PARAGRAPH ); - - // 'New paragraph' includes new line as well - if ( line.flags & LYRICS_NEW_PARAGRAPH ) - line.flags &= ~LYRICS_NEW_LINE; - - m_lyrics.push_back( line ); -} - - -bool CKaraokeLyricsText::InitGraphics() -{ - if ( m_lyrics.empty() ) - return false; - - std::string fontPath = URIUtils::AddFileToFolder("special://home/media/Fonts/", CSettings::GetInstance().GetString(CSettings::SETTING_KARAOKE_FONT)); - if (!XFILE::CFile::Exists(fontPath)) - fontPath = URIUtils::AddFileToFolder("special://xbmc/media/Fonts/", CSettings::GetInstance().GetString(CSettings::SETTING_KARAOKE_FONT)); - m_karaokeFont = g_fontManager.LoadTTF("__karaoke__", fontPath, - m_colorLyrics, 0, CSettings::GetInstance().GetInt(CSettings::SETTING_KARAOKE_FONTHEIGHT), FONT_STYLE_BOLD ); - CGUIFont *karaokeBorder = g_fontManager.LoadTTF("__karaokeborder__", fontPath, - m_colorLyrics, 0, CSettings::GetInstance().GetInt(CSettings::SETTING_KARAOKE_FONTHEIGHT), FONT_STYLE_BOLD, true ); - - if ( !m_karaokeFont ) - { - CLog::Log(LOGERROR, "CKaraokeLyricsText::PrepareGraphicsData - Unable to load subtitle font"); - return false; - } - - m_karaokeLayout = new CGUITextLayout( m_karaokeFont, true, 0, karaokeBorder ); - m_preambleLayout = new CGUITextLayout( m_karaokeFont, true, 0, karaokeBorder ); - - if ( !m_karaokeLayout || !m_preambleLayout ) - { - delete m_preambleLayout; - delete m_karaokeLayout; - m_karaokeLayout = m_preambleLayout = 0; - - CLog::Log(LOGERROR, "CKaraokeLyricsText::PrepareGraphicsData - cannot create layout"); - return false; - } - - rescanLyrics(); - - m_indexNextPara = 0; - - // Generate next paragraph - nextParagraph(); - - m_lyricsState = STATE_WAITING; - return true; -} - - -void CKaraokeLyricsText::Shutdown() -{ - CKaraokeLyrics::Shutdown(); - - delete m_preambleLayout; - m_preambleLayout = 0; - - if ( m_karaokeLayout ) - { - g_fontManager.Unload("__karaoke__"); - g_fontManager.Unload("__karaokeborder__"); - delete m_karaokeLayout; - m_karaokeLayout = NULL; - } - - m_lyricsState = STATE_END_SONG; -} - - -void CKaraokeLyricsText::Render() -{ - if ( !m_karaokeLayout ) - return; - - // Get the current song timing - unsigned int songTime = (unsigned int) MathUtils::round_int( (getSongTime() * 10) ); - - bool updatePreamble = false; - bool updateText = false; - - // No returns in switch if anything needs to be drawn! Just break! - switch ( m_lyricsState ) - { - // the next paragraph lyrics are not shown yet. Screen is clear. - // m_index points to the first entry. - case STATE_WAITING: - if ( songTime + m_showLyricsBeforeStart < m_lyrics[ m_index ].timing ) - return; - - // Is it time to play already? - if ( songTime >= m_lyrics[ m_index ].timing ) - { - m_lyricsState = STATE_PLAYING_PARAGRAPH; - } - else - { - m_lyricsState = STATE_PREAMBLE; - m_lastPreambleUpdate = songTime; - } - - updateText = true; - break; - - // the next paragraph lyrics are shown, but the paragraph hasn't start yet. - // Using m_lastPreambleUpdate, we redraw the marker each second. - case STATE_PREAMBLE: - if ( songTime < m_lyrics[ m_index ].timing ) - { - // Time to redraw preamble? - if ( songTime + m_showPreambleBeforeStart >= m_lyrics[ m_index ].timing ) - { - if ( songTime - m_lastPreambleUpdate >= 10 ) - { - // Fall through out of switch() to redraw - m_lastPreambleUpdate = songTime; - updatePreamble = true; - } - } - } - else - { - updateText = true; - m_lyricsState = STATE_PLAYING_PARAGRAPH; - } - break; - - // The lyrics are shown, but nothing is colored or no color is changed yet. - // m_indexStart, m_indexEnd and m_index are set, m_index timing shows when to color. - case STATE_PLAYING_PARAGRAPH: - if ( songTime >= m_lyrics[ m_index ].timing ) - { - while ( songTime >= m_lyrics[ m_index ].timing && m_index <= m_indexEndPara ) - m_index++; - - updateText = true; - - if ( m_index > m_indexEndPara ) - m_lyricsState = STATE_END_PARAGRAPH; - } - break; - - // the whole paragraph is colored, but still shown, waiting until it's time to clear the lyrics. - // m_index still points to the last entry, and m_indexNextPara points to the first entry of next - // paragraph, or to LYRICS_END. When the next paragraph is about to start (which is - // m_indexNextPara timing - m_showLyricsBeforeStart), the state switches to STATE_START_PARAGRAPH. When time - // goes after m_index timing + m_delayAfter, the state switches to STATE_WAITING, - case STATE_END_PARAGRAPH: - { - unsigned int paraEnd = m_lyrics[ m_indexEndPara ].timing + m_delayAfter; - - // If the next paragraph starts before current ends, use its start time as our end - if ( m_indexNextPara != LYRICS_END && m_lyrics[ m_indexNextPara ].timing <= paraEnd + m_showLyricsBeforeStart ) - { - if ( m_lyrics[ m_indexNextPara ].timing > m_showLyricsBeforeStart ) - paraEnd = m_lyrics[ m_indexNextPara ].timing - m_showLyricsBeforeStart; - else - paraEnd = 0; - } - - if ( songTime >= paraEnd ) - { - // Is the song ended? - if ( m_indexNextPara != LYRICS_END ) - { - // Are we still waiting? - if ( songTime >= m_lyrics[ m_indexNextPara ].timing ) - m_lyricsState = STATE_PLAYING_PARAGRAPH; - else - m_lyricsState = STATE_WAITING; - - // Get next paragraph - nextParagraph(); - updateText = true; - } - else - { - m_lyricsState = STATE_END_SONG; - return; - } - } - } - break; - - case STATE_END_SONG: - // the song is completed, there are no more lyrics to show. This state is finita la comedia. - return; - } - - // Calculate drawing parameters - const RESOLUTION_INFO info = g_graphicsContext.GetResInfo(); - g_graphicsContext.SetRenderingResolution(info, false); - float maxWidth = (float) info.Overscan.right - info.Overscan.left; - - // We must only fall through for STATE_DRAW_SYLLABLE or STATE_PREAMBLE - if ( updateText ) - { - // So we need to update the layout with current paragraph text, optionally colored according to index - bool color_used = false; - m_currentLyrics = ""; - - // Draw the current paragraph test if needed - if ( songTime + m_showLyricsBeforeStart >= m_lyrics[ m_indexStartPara ].timing ) - { - for ( unsigned int i = m_indexStartPara; i <= m_indexEndPara; i++ ) - { - if ( m_lyrics[i].flags & LYRICS_NEW_LINE ) - m_currentLyrics += "[CR]"; - - if ( i == m_indexStartPara && songTime >= m_lyrics[ m_indexStartPara ].timing ) - { - color_used = true; - m_currentLyrics += "[COLOR " + m_colorSinging + "]"; - } - - if ( songTime < m_lyrics[ i ].timing && color_used ) - { - color_used = false; - m_currentLyrics += "[/COLOR]"; - } - - m_currentLyrics += m_lyrics[i].text; - } - - if ( color_used ) - m_currentLyrics += "[/COLOR]"; - -// CLog::Log( LOGERROR, "Updating text: state %d, time %d, start %d, index %d (time %d) [%s], text %s", -// m_lyricsState, songTime, m_lyrics[ m_indexStartPara ].timing, m_index, m_lyrics[ m_index ].timing, -// m_lyrics[ m_index ].text.c_str(), m_currentLyrics.c_str()); - } - - m_karaokeLayout->Update(m_currentLyrics, maxWidth * 0.9f); - updateText = false; - } - - if ( updatePreamble ) - { - m_currentPreamble = ""; - - // Get number of seconds left to the song start - if ( m_lyrics[ m_indexStartPara ].timing >= songTime ) - { - unsigned int seconds = (m_lyrics[ m_indexStartPara ].timing - songTime) / 10; - - while ( seconds-- > 0 ) - m_currentPreamble += "- "; - } - - m_preambleLayout->Update( m_currentPreamble, maxWidth * 0.9f ); - } - - float x = maxWidth * 0.5f + info.Overscan.left; - float y = (float)info.Overscan.top + - (info.Overscan.bottom - info.Overscan.top) / 8; - - float textWidth, textHeight; - m_karaokeLayout->GetTextExtent(textWidth, textHeight); - m_karaokeLayout->RenderOutline(x, y, 0, m_colorLyricsOutline, XBFONT_CENTER_X, maxWidth); - - if ( !m_currentPreamble.empty() ) - { - float pretextWidth, pretextHeight; - m_preambleLayout->GetTextExtent(pretextWidth, pretextHeight); - m_preambleLayout->RenderOutline(x - textWidth / 2, y - pretextHeight, 0, m_colorLyricsOutline, XBFONT_LEFT, maxWidth); - } -} - - -void CKaraokeLyricsText::nextParagraph() -{ - if ( m_indexNextPara == LYRICS_END ) - return; - - bool new_para_found = false; - m_indexStartPara = m_index = m_indexNextPara; - - for ( m_indexEndPara = m_index + 1; m_indexEndPara < m_lyrics.size(); m_indexEndPara++ ) - { - if ( m_lyrics[ m_indexEndPara ].flags & LYRICS_NEW_PARAGRAPH - || ( m_lyrics[ m_indexEndPara ].timing - m_lyrics[ m_indexEndPara - 1 ].timing ) > m_paragraphBreakTime ) - { - new_para_found = true; - break; - } - } - - // Is this the end of array? - if ( new_para_found ) - m_indexNextPara = m_indexEndPara; - else - m_indexNextPara = LYRICS_END; - - m_indexEndPara--; -} - - -typedef struct -{ - float width; // total screen width of all lyrics in this line - int timediff; // time difference between prev line ends and this line starts - bool upper_start; // true if this line started with a capital letter - int offset_start; // offset points to a 'new line' flag entry of the current line - -} LyricTimingData; - -void CKaraokeLyricsText::rescanLyrics() -{ - // Rescan fixes the following things: - // - lyrics without spaces; - // - lyrics without paragraphs - std::vector<LyricTimingData> lyricdata; - unsigned int spaces = 0, syllables = 0, paragraph_lines = 0, max_lines_per_paragraph = 0; - - // First get some statistics from the lyrics: number of paragraphs, number of spaces - // and time difference between one line ends and second starts - for ( unsigned int i = 0; i < m_lyrics.size(); i++ ) - { - if (m_lyrics[i].text.find(" ") != std::string::npos) - spaces++; - - if ( m_lyrics[i].flags & LYRICS_NEW_LINE ) - paragraph_lines++; - - if ( m_lyrics[i].flags & LYRICS_NEW_PARAGRAPH ) - { - if ( max_lines_per_paragraph < paragraph_lines ) - max_lines_per_paragraph = paragraph_lines; - - paragraph_lines = 0; - } - - syllables++; - } - - // Second, add spaces if less than 5%, and rescan to gather more data. - bool add_spaces = (syllables && (spaces * 100 / syllables < 5)) ? true : false; - const RESOLUTION_INFO info = g_graphicsContext.GetResInfo(); - float maxWidth = (float) info.Overscan.right - info.Overscan.left; - - std::string line_text; - int prev_line_idx = -1; - int prev_line_timediff = -1; - - for ( unsigned int i = 0; i < m_lyrics.size(); i++ ) - { - if ( add_spaces ) - m_lyrics[i].text += " "; - - // We split the lyric when it is end of line, end of array, or current string is too long already - if ( i == (m_lyrics.size() - 1) - || (m_lyrics[i+1].flags & (LYRICS_NEW_LINE | LYRICS_NEW_PARAGRAPH)) != 0 - || getStringWidth( line_text + m_lyrics[i].text ) >= maxWidth ) - { - // End of line, or end of array. Add current string. - line_text += m_lyrics[i].text; - - // Reparagraph if we're out of screen width - if ( getStringWidth( line_text ) >= maxWidth ) - max_lines_per_paragraph = 0; - - LyricTimingData ld; - ld.width = getStringWidth( line_text ); - ld.timediff = prev_line_timediff; - ld.offset_start = prev_line_idx; - - // This piece extracts the first character of a new string and makes it uppercase in Unicode way - std::wstring temptext; - g_charsetConverter.utf8ToW( line_text, temptext ); - - // This is pretty ugly upper/lowercase for Russian unicode character set - if ( temptext[0] >= 0x410 && temptext[0] <= 0x44F ) - ld.upper_start = temptext[0] <= 0x42F; - else - { - std::string lower = m_lyrics[i].text; - StringUtils::ToLower(lower); - ld.upper_start = (m_lyrics[i].text == lower); - } - - lyricdata.push_back( ld ); - - // Reset the params - line_text = ""; - prev_line_idx = i + 1; - prev_line_timediff = (i == m_lyrics.size() - 1) ? -1 : m_lyrics[i+1].timing - m_lyrics[i].timing; - } - else - { - // Handle incorrect lyrics with no line feeds in the condition statement above - line_text += m_lyrics[i].text; - } - } - - // Now see if we need to re-paragraph. Basically we reasonably need a paragraph - // to have no more than 8 lines - if ( max_lines_per_paragraph == 0 || max_lines_per_paragraph > 8 ) - { - // Reparagraph - unsigned int paragraph_lines = 0; - float total_width = 0; - - CLog::Log( LOGDEBUG, "CKaraokeLyricsText: lines need to be reparagraphed" ); - - for ( unsigned int i = 0; i < lyricdata.size(); i++ ) - { - // Is this the first line? - if ( lyricdata[i].timediff == -1 ) - { - total_width = lyricdata[i].width; - continue; - } - - // Do we merge the current line with previous? We do it if: - // - there is a room on the screen for those lines combined - // - the time difference between line ends and new starts is less than 1.5 sec - // - the first character in the new line is not uppercase (i.e. new logic line) - if ( m_mergeLines && total_width + lyricdata[i].width < maxWidth && !lyricdata[i].upper_start && lyricdata[i].timediff < 15 ) - { - // Merge - m_lyrics[ lyricdata[i].offset_start ].flags &= ~(LYRICS_NEW_LINE | LYRICS_NEW_PARAGRAPH); - - // Since we merged the line, add the extra space. It will be removed later if not necessary. - m_lyrics[ lyricdata[i].offset_start ].text = " " + m_lyrics[ lyricdata[i].offset_start ].text; - total_width += lyricdata[i].width; - -// CLog::Log(LOGERROR, "Line merged; diff %d width %g, start %d, offset %d, max %g", -// lyricdata[i].timediff, lyricdata[i].width, lyricdata[i].upper_start, lyricdata[i].offset_start, maxWidth ); - } - else - { - // Do not merge; reset width and add counter - total_width = lyricdata[i].width; - paragraph_lines++; - -// CLog::Log(LOGERROR, "Line not merged; diff %d width %g, start %d, offset %d, max %g", -// lyricdata[i].timediff, lyricdata[i].width, lyricdata[i].upper_start, lyricdata[i].offset_start, maxWidth ); - } - - // Set paragraph - if ( paragraph_lines > 3 ) - { - m_lyrics[ lyricdata[i].offset_start ].flags &= ~LYRICS_NEW_LINE; - m_lyrics[ lyricdata[i].offset_start ].flags |= LYRICS_NEW_PARAGRAPH; - paragraph_lines = 0; - line_text = ""; - } - } - } - - // Prepare a new first lyric entry with song name and artist. - if ( m_songName.empty() ) - { - m_songName = URIUtils::GetFileName( getSongFile() ); - URIUtils::RemoveExtension( m_songName ); - } - - // Split the lyrics into per-character array - std::vector<Lyric> newlyrics; - bool title_entry = false; - - if ( m_lyrics.size() > 0 && m_lyrics[0].timing >= 50 ) - { - // Add a new title/artist entry - Lyric ltitle; - ltitle.flags = 0; - ltitle.timing = 0; - ltitle.text = m_songName; - - if ( !m_artist.empty() ) - ltitle.text += "[CR][CR]" + m_artist; - - newlyrics.push_back( ltitle ); - title_entry = true; - } - - bool last_was_space = false; - bool invalid_timing_reported = false; - for ( unsigned int i = 0; i < m_lyrics.size(); i++ ) - { - std::wstring utf16; - g_charsetConverter.utf8ToW( m_lyrics[i].text, utf16 ); - - // Skip empty lyrics - if ( utf16.size() == 0 ) - continue; - - // Use default timing for the last note - unsigned int next_timing = m_lyrics[ i ].timing + m_delayAfter; - - if ( i < (m_lyrics.size() - 1) ) - { - // Set the lenght for the syllable to the length of prev syllable if: - // - this is not the first lyric (as there is no prev otherwise) - // - this is the last lyric on this line (otherwise use next); - // - this is not the ONLY lyric on this line (otherwise the calculation is wrong) - // - lyrics size is the same as previous (currently removed). - if ( i > 0 - && m_lyrics[ i + 1 ].flags & (LYRICS_NEW_LINE | LYRICS_NEW_PARAGRAPH) - && ! (m_lyrics[ i ].flags & (LYRICS_NEW_LINE | LYRICS_NEW_PARAGRAPH) ) ) -// && m_lyrics[ i ].text.size() == m_lyrics[ i -1 ].text.size() ) - next_timing = m_lyrics[ i ].timing + (m_lyrics[ i ].timing - m_lyrics[ i -1 ].timing ); - - // Sanity check - if ( m_lyrics[ i+1 ].timing < m_lyrics[ i ].timing ) - { - if ( !invalid_timing_reported ) - CLog::Log( LOGERROR, "Karaoke lyrics normalizer: time went backward, enabling workaround" ); - - invalid_timing_reported = true; - m_lyrics[ i ].timing = m_lyrics[ i+1 ].timing; - } - - if ( m_lyrics[ i+1 ].timing < next_timing ) - next_timing = m_lyrics[ i+1 ].timing; - } - - // Calculate how many 1/10 seconds we have per lyric character - double time_per_char = ((double) next_timing - m_lyrics[ i ].timing) / utf16.size(); - - // Convert to characters - for ( unsigned int j = 0; j < utf16.size(); j++ ) - { - Lyric l; - - // Copy flags only to the first character - if ( j == 0 ) - l.flags = m_lyrics[i].flags; - else - l.flags = 0; - l.timing = (unsigned int) MathUtils::round_int( m_lyrics[ i ].timing + j * time_per_char ); - - g_charsetConverter.wToUTF8( utf16.substr(j, 1), l.text); - - if ( l.text == " " ) - { - if ( last_was_space ) - continue; - - last_was_space = true; - } - else - last_was_space = false; - - newlyrics.push_back( l ); - } - } - - m_lyrics = newlyrics; - - // Set the NEW PARAGRAPH flag on the first real lyric entry since we changed it - if ( title_entry ) - m_lyrics[1].flags |= LYRICS_NEW_PARAGRAPH; - - saveLyrics(); -} - - -float CKaraokeLyricsText::getStringWidth(const std::string & text) -{ - std::wstring utf16; - vecText utf32; - - g_charsetConverter.utf8ToW(text, utf16); - - utf32.resize( utf16.size() ); - for ( unsigned int i = 0; i < utf16.size(); i++ ) - utf32[i] = utf16[i]; - - return m_karaokeFont->GetTextWidth(utf32); -} - -void CKaraokeLyricsText::saveLyrics() -{ - XFILE::CFile file; - - std::string out; - - for ( unsigned int i = 0; i < m_lyrics.size(); i++ ) - { - std::string timing = StringUtils::Format("%02d:%02d.%d", - m_lyrics[i].timing / 600, - (m_lyrics[i].timing % 600) / 10, - (m_lyrics[i].timing % 10)); - - if ( (m_lyrics[i].flags & LYRICS_NEW_PARAGRAPH) != 0 ) - out += "\n\n"; - - if ( (m_lyrics[i].flags & LYRICS_NEW_LINE) != 0 ) - out += "\n"; - - out += "[" + timing + "]" + m_lyrics[i].text; - } - - out += "\n"; - - if ( !file.OpenForWrite( "special://temp/tmp.lrc", true ) ) - return; - - file.Write( out.c_str(), out.size() ); -} - - -bool CKaraokeLyricsText::HasBackground() -{ - return false; -} - -bool CKaraokeLyricsText::HasVideo() -{ - return m_videoFile.empty() ? false : true; -} - -void CKaraokeLyricsText::GetVideoParameters(std::string& path, int64_t& offset) -{ - path = m_videoFile; - offset = m_videoOffset; -} diff --git a/xbmc/music/karaoke/karaokelyricstext.h b/xbmc/music/karaoke/karaokelyricstext.h deleted file mode 100644 index 015a120412..0000000000 --- a/xbmc/music/karaoke/karaokelyricstext.h +++ /dev/null @@ -1,205 +0,0 @@ -#ifndef KARAOKELYRICSTEXT_H -#define KARAOKELYRICSTEXT_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricstext - -#include "karaokelyrics.h" - -// Karaoke colours -// If you want to add more colors, it should be done the following way: -// 1. Increase KARAOKE_COLOR_END -// 2. Add a new color description in language/English/strings.xml in block -// with id 22040 + KARAOKE_COLOR_END value -// 3. Add a new color hex mask into gLyricColors structure in karaoke/karaokelyricstext.cpp -#define KARAOKE_COLOR_START 0 -#define KARAOKE_COLOR_END 4 - -class CGUITextLayout; -class CGUIFont; - -//! This class is a base abstract class for all lyric loaders which provide text-based lyrics. -//! Once the lyrics are properly transferred to this class, it will take care of rendering. -//! Therefore the Render() function in the derived class might be empty, but must still call -//! the parent function to function properly. -class CKaraokeLyricsText : public CKaraokeLyrics -{ - public: - CKaraokeLyricsText(); - virtual ~CKaraokeLyricsText(); - - //! Parses the lyrics or song file, and loads the lyrics into memory. - //! Done in derived classes, this class only takes care of rendering. - virtual bool Load() = 0; - - //! Most of text lyrics do not have any backgrounds - virtual bool HasBackground(); - - //! UStar lyrics might have video - virtual bool HasVideo(); - virtual void GetVideoParameters(std::string& path, int64_t& offset ); - - protected: - enum - { - LYRICS_NONE = 0, - LYRICS_NEW_LINE = 0x0001, - LYRICS_NEW_PARAGRAPH = 0x0002, - LYRICS_CONVERT_UTF8 = 0x0010, - LYRICS_INVALID_PITCH = 0xFFFFFFFE, - LYRICS_END = 0xFFFFFFFF - }; - - //! Render functionality from the parent class is handled here - virtual void Render(); - - //! This function is called when the karoke visualisation window created. It may - //! be called after Start(), but is guaranteed to be called before Render() - //! Default implementation does nothing and returns true. - virtual bool InitGraphics(); - - //! This function is called when the karoke visualisation window is destroyed. - //! Default implementation does nothing. - virtual void Shutdown(); - - //! The loader should call this function to add each separate lyrics syllable. - //! timing is in 1/10 seconds; if you have time in milliseconds, multiple by 100. - //! flags could be 0 (regular), LYRICS_NEW_LINE (this syllable should start on a new line), - //! and LYRICS_NEW_PARAGRAPH (this syllable should start on a new paragraph). - //! If the lyrics support pitch (i.e. Ultrastar), it also should be specified. - void addLyrics( const std::string& text, unsigned int timing, unsigned int flags = 0, unsigned int pitch = LYRICS_INVALID_PITCH ); - - //! This function clears the lyrics array and resets song information - void clearLyrics(); - - //! This function calculares next paragraph of lyrics which will be shown. Returns true if indexes change - void nextParagraph(); - - //! Rescan lyrics, fix typical issues - void rescanLyrics(); - - //! Returns string width if rendered using current font - float getStringWidth( const std::string& text ); - - //! Saves parsed lyrics into a temporary file for debugging - void saveLyrics(); - - //! Those variables keep the song information if available, parsed from the lyrics file. - //! It should not be based on filename, as this case will be handled internally. - //! Should be set to "" if no information available. - std::string m_songName; - std::string m_artist; - bool m_hasPitch; - std::string m_videoFile; - int64_t m_videoOffset; - - private: - - //! Lyrics render state machine - enum - { - //! the next paragraph lyrics are not shown yet. Screen is clear. - //! All indexes are set, m_index points to the first element. - //! m_index timing - m_delayBefore shows when the state changes to STATE_DRAW_SYLLABLE - STATE_WAITING, - - //! the next paragraph lyrics are shown, but the paragraph hasn't start yet. - //! Using m_preambleTime, we redraw the marker each second. - STATE_PREAMBLE, - - //! the lyrics are played, the end of paragraph is not reached. - STATE_PLAYING_PARAGRAPH, - - //! the whole paragraph is colored, but still shown, waiting until it's time to clear the lyrics. - //! m_index still points to the last entry, and m_indexNextPara points to the first entry of next - //! paragraph, or to LYRICS_END. When the next paragraph is about to start (which is - //! m_indexNextPara timing - m_delayBefore), the state switches to STATE_START_PARAGRAPH. When time - //! goes after m_index timing + m_delayAfter, the state switches to STATE_WAITING, - STATE_END_PARAGRAPH, - - //!< the song is completed, there are no more lyrics to show. This state is finita la comedia. - STATE_END_SONG - }; - - typedef struct - { - std::string text; - unsigned int timing; - unsigned int flags; - unsigned int pitch; - - } Lyric; - - std::vector<Lyric> m_lyrics; - - //! Text layout for lyrics - CGUITextLayout * m_karaokeLayout; - - //! Text layout for preamble - CGUITextLayout * m_preambleLayout; - - //! Fond for lyrics - CGUIFont * m_karaokeFont; - - //! Lyrics colors - unsigned int m_colorLyrics; - unsigned int m_colorLyricsOutline; - std::string m_colorSinging; - - //! This is index in m_lyrics pointing to current paragraph first, last and current elements - unsigned int m_indexEndPara; - unsigned int m_indexStartPara; - unsigned int m_index; - - //! This is preamble timing, used to update preamble each second - unsigned int m_lastPreambleUpdate; - - //! This is index in m_lyrics pointing to next paragraph. - //! If LYRICS_END - there is no next paragraph - unsigned int m_indexNextPara; - - //! Current lyrics rendering state - unsigned int m_lyricsState; - - //! Lyrics text on screen - std::string m_currentLyrics; - - //! Preamble text on screen - std::string m_currentPreamble; - - // - // Configuration settings - // - //! Number of 1/10 seconds between the lyrics are shown and start singing. 50 means 5 seconds - unsigned int m_showLyricsBeforeStart; - unsigned int m_showPreambleBeforeStart; - bool m_mergeLines; - - //! Autosplitter uses this value to split paragraphs. If a new line starts in more than - //! m_paragraphBreakTime after current line ends, it's a new paragraph. - unsigned int m_paragraphBreakTime; - - //! Number of 1/10 seconds after the lyrics are sung. 50 means 5 seconds - unsigned int m_delayAfter; -}; - -#endif diff --git a/xbmc/music/karaoke/karaokelyricstextkar.cpp b/xbmc/music/karaoke/karaokelyricstextkar.cpp deleted file mode 100644 index 98ffd9aa42..0000000000 --- a/xbmc/music/karaoke/karaokelyricstextkar.cpp +++ /dev/null @@ -1,597 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyricstextkar - -#include "utils/CharsetConverter.h" -#include "filesystem/File.h" -#include "settings/Settings.h" -#include "utils/log.h" -#include "utils/Utf8Utils.h" -#include <math.h> - -#include "karaokelyricstextkar.h" - - -// Parsed lyrics -typedef struct -{ - unsigned int clocks; - unsigned int track; - std::string text; - unsigned int flags; - -} MidiLyrics; - - -// Parsed tempo change structure -typedef struct -{ - unsigned int clocks; - unsigned int tempo; - -} MidiTempo; - - -// Parsed per-channel info -typedef struct -{ - unsigned int total_lyrics; - unsigned int total_lyrics_space; - -} MidiChannelInfo; - - -// Based entirely on class MidiTimestamp from pyKaraoke -// Based entirely on class MidiTimestamp from pyKaraoke -class MidiTimestamp -{ - private: - const std::vector<MidiTempo>& m_tempo; - double m_currentMs; - unsigned int m_currentClick; - unsigned int m_tempoIndex; - unsigned int m_division; - - public: - MidiTimestamp( const std::vector<MidiTempo>& tempo, unsigned int division ) - : m_tempo (tempo), m_division (division) - { - reset(); - } - - void reset() - { - m_currentMs = 0.0; - m_currentClick = 0; - m_tempoIndex = 0; - } - - double getTimeForClicks( unsigned int click, unsigned int tempo ) - { - double microseconds = ( ( float(click) / m_division ) * tempo ); - return microseconds / 1000.0; - } - - // Returns the "advanced" clock value in ms. - double advanceClocks( unsigned int click ) - { - // Moves time forward to the indicated click number. - if ( m_currentClick > click ) - throw("Malformed lyrics timing"); - - unsigned int clicks = click - m_currentClick; - - while ( clicks > 0 && m_tempoIndex < m_tempo.size() ) - { - // How many clicks remain at the current tempo? - unsigned int clicksRemaining = 0; - - if ( m_tempo[ m_tempoIndex ].clocks - m_currentClick > 0 ) - clicksRemaining = m_tempo[ m_tempoIndex ].clocks - m_currentClick; - - unsigned int clicksUsed = clicks < clicksRemaining ? clicks : clicksRemaining; - - if ( clicksUsed > 0 && m_tempoIndex > 0 ) - m_currentMs += getTimeForClicks( clicksUsed, m_tempo[ m_tempoIndex - 1 ].tempo ); - - m_currentClick += clicksUsed; - clicks -= clicksUsed; - clicksRemaining -= clicksUsed; - - if ( clicksRemaining == 0 ) - m_tempoIndex++; - } - - if ( clicks > 0 ) - { - // We have reached the last tempo mark of the song, so this tempo holds forever. - m_currentMs += getTimeForClicks( clicks, m_tempo[ m_tempoIndex - 1 ].tempo ); - m_currentClick += clicks; - } - - return m_currentMs; - } -}; - - - -CKaraokeLyricsTextKAR::CKaraokeLyricsTextKAR( const std::string & midiFile ) - : CKaraokeLyricsText() - , m_midiFile(midiFile) -{ -} - - -CKaraokeLyricsTextKAR::~CKaraokeLyricsTextKAR() -{ -} - - -bool CKaraokeLyricsTextKAR::Load() -{ - XFILE::CFile file; - bool succeed = true; - m_reportedInvalidVarField = false; - - // Clear the lyrics array - clearLyrics(); - - if (file.LoadFile(m_midiFile, m_midiData) <= 0) - return false; - - file.Close(); - - // Parse MIDI - try - { - parseMIDI(); - } - catch ( const char * p ) - { - CLog::Log( LOGERROR, "KAR lyrics loader: cannot load file: %s", p ); - succeed = false; - } - - m_midiData.clear(); - return succeed; -} - - -// -// Got a lot of good ideas from pykaraoke by Kelvin Lawson (kelvinl@users.sf.net). Thanks! -// -void CKaraokeLyricsTextKAR::parseMIDI() -{ - m_midiOffset = 0; - - // Bytes 0-4: header - unsigned int header = readDword(); - - // If we get MS RIFF header, skip it - if ( header == 0x52494646 ) - { - setPos( currentPos() + 16 ); - header = readDword(); - } - - // MIDI header - if ( header != 0x4D546864 ) - throw( "Not a MIDI file" ); - - // Bytes 5-8: header length - unsigned int header_length = readDword(); - - // Bytes 9-10: format - unsigned short format = readWord(); - - if ( format > 2 ) - throw( "Unsupported format" ); - - // Bytes 11-12: tracks - unsigned short tracks = readWord(); - - // Bytes 13-14: divisious - unsigned short divisions = readWord(); - - if ( divisions > 32768 ) - throw( "Unsupported division" ); - - // Number of tracks is always 1 if format is 0 - if ( format == 0 ) - tracks = 1; - - // Parsed per-channel info - std::vector<MidiLyrics> lyrics; - std::vector<MidiTempo> tempos; - std::vector<MidiChannelInfo> channels; - - channels.resize( tracks ); - - // Set up default tempo - MidiTempo te; - te.clocks = 0; - te.tempo = 500000; - tempos.push_back( te ); - - int preferred_lyrics_track = -1; - int lastchannel = 0; - int laststatus = 0; - unsigned int firstNoteClocks = 1000000000; // arbitrary large value - unsigned int next_line_flag = 0; - - // Point to first byte after MIDI header - setPos( 8 + header_length ); - - // Parse all tracks - for ( int track = 0; track < tracks; track++ ) - { - char tempbuf[1024]; - unsigned int clocks = 0; - - channels[track].total_lyrics = 0; - channels[track].total_lyrics_space = 0; - - // Skip malformed files - if ( readDword() != 0x4D54726B ) - throw( "Malformed track header" ); - - // Next track position - int tracklen = readDword(); - unsigned int nexttrackstart = tracklen + currentPos(); - - // Parse track until end of track event - while ( currentPos() < nexttrackstart ) - { - // field length - clocks += readVarLen(); - unsigned char msgtype = readByte(); - - // - // Meta event - // - if ( msgtype == 0xFF ) - { - unsigned char metatype = readByte(); - unsigned int metalength = readVarLen(); - - if ( metatype == 3 ) - { - // Track title metatype - if ( metalength >= sizeof( tempbuf ) ) - throw( "Meta event too long" ); - - readData( tempbuf, metalength ); - tempbuf[metalength] = '\0'; - - if ( !strcmp( tempbuf, "Words" ) ) - preferred_lyrics_track = track; - } - else if ( metatype == 5 || metatype == 1 ) - { - // Lyrics metatype - if ( metalength >= sizeof( tempbuf ) ) - throw( "Meta event too long" ); - - readData( tempbuf, metalength ); - tempbuf[metalength] = '\0'; - - if ( (tempbuf[0] == '@' && tempbuf[1] >= 'A' && tempbuf[1] <= 'Z') - || strstr( tempbuf, " SYX" ) || strstr( tempbuf, "Track-" ) - || strstr( tempbuf, "%-" ) || strstr( tempbuf, "%+" ) ) - { - // Keywords - if ( tempbuf[0] == '@' && tempbuf[1] == 'T' && strlen( tempbuf + 2 ) > 0 ) - { - if ( m_songName.empty() ) - m_songName = convertText( tempbuf + 2 ); - else - { - if ( !m_artist.empty() ) - m_artist += "[CR]"; - - m_artist += convertText( tempbuf + 2 ); - } - } - } - else - { - MidiLyrics lyric; - lyric.clocks = clocks; - lyric.track = track; - lyric.flags = next_line_flag; - - if ( tempbuf[0] == '\\' ) - { - lyric.flags = CKaraokeLyricsText::LYRICS_NEW_PARAGRAPH; - lyric.text = convertText( tempbuf + 1 ); - } - else if ( tempbuf[0] == '/' ) - { - lyric.flags = CKaraokeLyricsText::LYRICS_NEW_LINE; - lyric.text = convertText( tempbuf + 1 ); - } - else if ( tempbuf[1] == '\0' && (tempbuf[0] == '\n' || tempbuf[0] == '\r' ) ) - { - // An empty line; do not add it but set the flag - if ( next_line_flag == CKaraokeLyricsText::LYRICS_NEW_LINE ) - next_line_flag = CKaraokeLyricsText::LYRICS_NEW_PARAGRAPH; - else - next_line_flag = CKaraokeLyricsText::LYRICS_NEW_LINE; - } - else - { - next_line_flag = (strchr(tempbuf, '\n') || strchr(tempbuf, '\r')) ? CKaraokeLyricsText::LYRICS_NEW_LINE : CKaraokeLyricsText::LYRICS_NONE; - lyric.text = convertText( tempbuf ); - } - - lyrics.push_back( lyric ); - - // Calculate the number of spaces in current syllable - for ( unsigned int j = 0; j < metalength; j++ ) - { - channels[ track ].total_lyrics++; - - if ( tempbuf[j] == 0x20 ) - channels[ track ].total_lyrics_space++; - } - } - } - else if ( metatype == 0x51 ) - { - // Set tempo event - if ( metalength != 3 ) - throw( "Invalid tempo" ); - - unsigned char a1 = readByte(); - unsigned char a2 = readByte(); - unsigned char a3 = readByte(); - unsigned int tempo = (a1 << 16) | (a2 << 8) | a3; - - // MIDI spec says tempo could only be on the first track... - // but some MIDI editors still put it on second. Shouldn't break anything anyway, but let's see - //if ( track != 0 ) - // throw( "Invalid tempo track" ); - - // Check tempo array. If previous tempo has higher clocks, abort. - if ( tempos.size() > 0 && tempos[ tempos.size() - 1 ].clocks > clocks ) - throw( "Invalid tempo" ); - - // If previous tempo has the same clocks value, override it. Otherwise add new. - if ( tempos.size() > 0 && tempos[ tempos.size() - 1 ].clocks == clocks ) - tempos[ tempos.size() - 1 ].tempo = tempo; - else - { - MidiTempo mt; - mt.clocks = clocks; - mt.tempo = tempo; - - tempos.push_back( mt ); - } - } - else - { - // Skip the event completely - setPos( currentPos() + metalength ); - } - } - else if ( msgtype== 0xF0 || msgtype == 0xF7 ) - { - // SysEx event - unsigned int length = readVarLen(); - setPos( currentPos() + length ); - } - else - { - // Regular MIDI event - if ( msgtype & 0x80 ) - { - // Status byte - laststatus = ( msgtype >> 4) & 0x07; - lastchannel = msgtype & 0x0F; - - if ( laststatus != 0x07 ) - msgtype = readByte() & 0x7F; - } - - switch ( laststatus ) - { - case 0: // Note off - readByte(); - break; - - case 1: // Note on - if ( (readByte() & 0x7F) != 0 ) // this would be in fact Note off - { - // Remember the time the first note played - if ( firstNoteClocks > clocks ) - firstNoteClocks = clocks; - } - break; - - case 2: // Key Pressure - case 3: // Control change - case 6: // Pitch wheel - readByte(); - break; - - case 4: // Program change - case 5: // Channel pressure - break; - - default: // case 7: Ignore this event - if ( (lastchannel & 0x0F) == 2 ) // Sys Com Song Position Pntr - readWord(); - else if ( (lastchannel & 0x0F) == 3 ) // Sys Com Song Select(Song #) - readByte(); - break; - } - } - } - } - - // The MIDI file is parsed. Now try to find the preferred lyric track - if ( preferred_lyrics_track == -1 || channels[preferred_lyrics_track].total_lyrics == 0 ) - { - unsigned int max_lyrics = 0; - - for ( unsigned int t = 0; t < tracks; t++ ) - { - if ( channels[t].total_lyrics > max_lyrics ) - { - preferred_lyrics_track = t; - max_lyrics = channels[t].total_lyrics; - } - } - } - - if ( preferred_lyrics_track == -1 ) - throw( "No lyrics found" ); - - // We found the lyrics track. Dump some debug information. - MidiTimestamp mts( tempos, divisions ); - double firstNoteTime = mts.advanceClocks( firstNoteClocks ); - - CLog::Log( LOGDEBUG, "KAR lyric loader: found lyric track %d, first offset %d (%g ms)", preferred_lyrics_track, firstNoteClocks, firstNoteTime ); - - // Now go through all lyrics on this track, convert them into time. - mts.reset(); - - for ( unsigned int i = 0; i < lyrics.size(); i++ ) - { - if ( (int) lyrics[i].track != preferred_lyrics_track ) - continue; - - double lyrics_timing = mts.advanceClocks( lyrics[i].clocks ); - - // Skip lyrics which start before the first note - if ( lyrics_timing < firstNoteTime ) - continue; - - unsigned int mstime = (unsigned int)ceil( (lyrics_timing - firstNoteTime) / 100); - addLyrics( lyrics[i].text, mstime, lyrics[i].flags ); - } -} - - -unsigned char CKaraokeLyricsTextKAR::readByte() -{ - if (m_midiOffset >= m_midiData.size()) - throw( "Cannot read byte: premature end of file" ); - - return (unsigned char) m_midiData.get()[m_midiOffset++]; -} - -unsigned short CKaraokeLyricsTextKAR::readWord() -{ - if (m_midiOffset + 1 >= m_midiData.size()) - throw( "Cannot read word: premature end of file" ); - - m_midiOffset += 2; - return ((unsigned int)((unsigned char)m_midiData.get()[m_midiOffset-2])) << 8 | - ((unsigned int)((unsigned char)m_midiData.get()[m_midiOffset-1])); -} - - -unsigned int CKaraokeLyricsTextKAR::readDword() -{ - if (m_midiOffset + 3 >= m_midiData.size()) - throw( "Cannot read dword: premature end of file" ); - - m_midiOffset += 4; - return ((unsigned int)((unsigned char)m_midiData.get()[m_midiOffset-4])) << 24 | - ((unsigned int)((unsigned char)m_midiData.get()[m_midiOffset-3])) << 16 | - ((unsigned int)((unsigned char)m_midiData.get()[m_midiOffset-2])) << 8 | - ((unsigned int)((unsigned char)m_midiData.get()[m_midiOffset-1])); -} - -int CKaraokeLyricsTextKAR::readVarLen() -{ - int l = 0, c; - - c = readByte(); - - if ( !(c & 0x80) ) - return l | c; - - l = (l | (c & 0x7f)) << 7; - c = readByte(); - - if ( !(c & 0x80) ) - return l | c; - - l = (l | (c & 0x7f)) << 7; - c = readByte(); - - if ( !(c & 0x80) ) - return l | c; - - l = (l | (c & 0x7f)) << 7; - c = readByte(); - - if ( !(c & 0x80) ) - return l | c; - - if ( !m_reportedInvalidVarField ) - { - m_reportedInvalidVarField = true; - CLog::Log( LOGWARNING, "Warning: invalid MIDI file, workaround enabled but MIDI might not sound as expected" ); - } - - l = (l | (c & 0x7f)) << 7; - c = readByte(); - - if ( !(c & 0x80) ) - return l | c; - - throw( "Cannot read variable field" ); -} - -unsigned int CKaraokeLyricsTextKAR::currentPos() const -{ - return m_midiOffset; -} - -void CKaraokeLyricsTextKAR::setPos(unsigned int offset) -{ - m_midiOffset = offset; -} - -void CKaraokeLyricsTextKAR::readData(void * buf, unsigned int length) -{ - for ( unsigned int i = 0; i < length; i++ ) - *((char*)buf + i) = readByte(); -} - -std::string CKaraokeLyricsTextKAR::convertText( const char * data ) -{ - std::string strUTF8; - - // Use some heuristics; need to replace by real detection stuff later - if (CUtf8Utils::isValidUtf8(data) || CSettings::GetInstance().GetString(CSettings::SETTING_KARAOKE_CHARSET) == "DEFAULT") - strUTF8 = data; - else - g_charsetConverter.ToUtf8( CSettings::GetInstance().GetString(CSettings::SETTING_KARAOKE_CHARSET), data, strUTF8 ); - - if ( strUTF8.size() == 0 ) - strUTF8 = " "; - - return strUTF8; -} diff --git a/xbmc/music/karaoke/karaokelyricstextkar.h b/xbmc/music/karaoke/karaokelyricstextkar.h deleted file mode 100644 index 8301e8b725..0000000000 --- a/xbmc/music/karaoke/karaokelyricstextkar.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef KARAOKELYRICSTEXTKAR_H -#define KARAOKELYRICSTEXTKAR_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricstextkar - -#include "karaokelyricstext.h" -#include "utils/auto_buffer.h" - -//! This class loads MIDI/KAR format lyrics -class CKaraokeLyricsTextKAR : public CKaraokeLyricsText -{ - public: - CKaraokeLyricsTextKAR( const std::string & midiFile ); - ~CKaraokeLyricsTextKAR(); - - //! Parses the lyrics or song file, and loads the lyrics into memory. - //! Returns true if the lyrics are successfully loaded, false otherwise. - bool Load(); - - private: - void parseMIDI(); - std::string convertText( const char * data ); - - unsigned char readByte(); - unsigned short readWord(); - unsigned int readDword(); - int readVarLen(); - void readData( void * buf, unsigned int length ); - - unsigned int currentPos() const; - void setPos( unsigned int offset ); - - // MIDI file name - std::string m_midiFile; - - // MIDI in-memory information - XUTILS::auto_buffer m_midiData; - size_t m_midiOffset; - bool m_reportedInvalidVarField; -}; - -#endif diff --git a/xbmc/music/karaoke/karaokelyricstextlrc.cpp b/xbmc/music/karaoke/karaokelyricstextlrc.cpp deleted file mode 100644 index e8ed4157ad..0000000000 --- a/xbmc/music/karaoke/karaokelyricstextlrc.cpp +++ /dev/null @@ -1,541 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyricstextlrc - -#include <math.h> - -#include "filesystem/File.h" -#include "settings/AdvancedSettings.h" -#include "utils/MathUtils.h" -#include "utils/log.h" - -#include "karaokelyricstextlrc.h" - -enum ParserState -{ - PARSER_INIT, // looking for time - PARSER_IN_TIME, // processing time - PARSER_IN_LYRICS // processing lyrics -}; - -// Used in multi-time lyric loader -typedef struct -{ - std::string text; - unsigned int timing; - unsigned int flags; -} MtLyric; - -CKaraokeLyricsTextLRC::CKaraokeLyricsTextLRC( const std::string & lyricsFile ) - : CKaraokeLyricsText() - , m_lyricsFile(lyricsFile) -{ -} - - -CKaraokeLyricsTextLRC::~CKaraokeLyricsTextLRC() -{ -} - -bool CKaraokeLyricsTextLRC::Load() -{ - XFILE::CFile file; - - // Clear the lyrics array - clearLyrics(); - - XFILE::auto_buffer buf; - if (file.LoadFile(m_lyricsFile, buf) <= 0) - { - CLog::Log(LOGERROR, "%s: can't load \"%s\" file", __FUNCTION__, m_lyricsFile.c_str()); - return false; - } - - file.Close(); - - // Parse the correction value - int timing_correction = MathUtils::round_int( g_advancedSettings.m_karaokeSyncDelayLRC * 10 ); - - unsigned int offset = 0; - - std::string songfilename = getSongFile(); - - // Skip windoze UTF8 file prefix, if any, and reject UTF16 files - if (buf.size() > 3) - { - if ((unsigned char)buf.get()[0] == 0xFF && (unsigned char)buf.get()[1] == 0xFE) - { - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file is in UTF16 encoding, must be in UTF8" ); - return false; - } - - // UTF8 prefix added by some windoze apps - if ((unsigned char)buf.get()[0] == 0xEF && (unsigned char)buf.get()[1] == 0xBB && (unsigned char)buf.get()[2] == 0xBF) - offset = 3; - } - - if (checkMultiTime(buf.get() + offset, buf.size() - offset)) - return ParserMultiTime(buf.get() + offset, buf.size() - offset, timing_correction); - else - return ParserNormal(buf.get() + offset, buf.size() - offset, timing_correction); -} - -bool CKaraokeLyricsTextLRC::checkMultiTime(char *lyricData, unsigned int lyricSize) -{ - // return true only when find lines like: - // [02:24][01:40][00:51][00:05]I'm a big big girl - // but not like: - // [00:01.10]I [00:01.09]just [00:01.50]call - bool inTime = false; - bool newLine = true; - bool maybeMultiTime = false; - unsigned int i = 0; - for ( char * p = lyricData; i < lyricSize; i++, p++ ) - { - if (inTime) - { - if (*p == ']') - inTime = false; - } - else - { - if (*p == '[') - { - inTime = true; - if (newLine) - { - newLine = false; - } - else - { - if (*(p - 1) != ']') - return false; - else - maybeMultiTime = true; - } - } - if (*p == '\n') - newLine = true; - } - } - return maybeMultiTime; -} - -bool CKaraokeLyricsTextLRC::ParserNormal(char *lyricData, unsigned int lyricSize, int timing_correction) -{ - CLog::Log( LOGDEBUG, "LRC lyric loader: parser normal lyrics file" ); - // - // A simple state machine to parse the file - // - ParserState state = PARSER_INIT; - unsigned int state_offset = 0; - unsigned int lyric_flags = 0; - int lyric_time = -1; - int start_offset = 0; - unsigned int offset = 0; - - for ( char * p = lyricData; offset < lyricSize; offset++, p++ ) - { - // Skip \r - if ( *p == 0x0D ) - continue; - - if ( state == PARSER_IN_LYRICS ) - { - // Lyrics are terminated either by \n or by [ - if ( *p == '\n' || *p == '[' || *p == '<' ) - { - // Time must be there - if ( lyric_time == -1 ) - { - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file has no time before lyrics" ); - return false; - } - - // Add existing lyrics - char current = *p; - std::string text; - - if ( offset > state_offset ) - { - // null-terminate string, we saved current char anyway - *p = '\0'; - text = &lyricData[0] + state_offset; - } - else - text = " "; // add a single space for empty lyric - - // If this was end of line, set the flags accordingly - if ( current == '\n' ) - { - // Add space after the trailing lyric in lrc - text += " "; - addLyrics( text, lyric_time, lyric_flags | LYRICS_CONVERT_UTF8 ); - state_offset = -1; - lyric_flags = CKaraokeLyricsText::LYRICS_NEW_LINE; - state = PARSER_INIT; - } - else - { - // No conversion needed as the file should be in UTF8 already - addLyrics( text, lyric_time, lyric_flags | LYRICS_CONVERT_UTF8 ); - lyric_flags = 0; - state_offset = offset + 1; - state = PARSER_IN_TIME; - } - - lyric_time = -1; - } - } - else if ( state == PARSER_IN_TIME ) - { - // Time is terminated by ] or > - if ( *p == ']' || *p == '>' ) - { - int mins, secs, htenths, ltenths = 0; - - if ( offset == state_offset ) - { - CLog::Log( LOGERROR, "LRC lyric loader: empty time" ); - return false; // [] - empty time - } - - // null-terminate string - char * timestr = &lyricData[0] + state_offset; - *p = '\0'; - - // Now check if this is time field or info tag. Info tags are like [ar:Pink Floyd] - char * fieldptr = strchr( timestr, ':' ); - if ( timestr[0] >= 'a' && timestr[0] <= 'z' && timestr[1] >= 'a' && timestr[1] <= 'z' && fieldptr ) - { - // Null-terminate the field name and switch to the field value - *fieldptr = '\0'; - fieldptr++; - - while ( isspace( *fieldptr ) ) - fieldptr++; - - // Check the info field - if ( !strcmp( timestr, "ar" ) ) - m_artist += fieldptr; - else if ( !strcmp( timestr, "sr" ) ) - { - // m_artist += "[CR]" + std::string( fieldptr ); // Add source to the artist name as a separate line - } - else if ( !strcmp( timestr, "ti" ) ) - m_songName = fieldptr; - else if ( !strcmp( timestr, "offset" ) ) - { - if ( sscanf( fieldptr, "%d", &start_offset ) != 1 ) - { - CLog::Log( LOGERROR, "LRC lyric loader: invalid [offset:] value '%s'", fieldptr ); - return false; // [] - empty time - } - - // Offset is in milliseconds; convert to 1/10 seconds - start_offset /= 100; - } - - state_offset = -1; - state = PARSER_INIT; - continue; - } - else if ( sscanf( timestr, "%d:%d.%1d%1d", &mins, &secs, &htenths, <enths ) == 4 ) - lyric_time = mins * 600 + secs * 10 + htenths + MathUtils::round_int( ltenths / 10 ); - else if ( sscanf( timestr, "%d:%d.%1d", &mins, &secs, &htenths ) == 3 ) - lyric_time = mins * 600 + secs * 10 + htenths; - else if ( sscanf( timestr, "%d:%d", &mins, &secs ) == 2 ) - lyric_time = mins * 600 + secs * 10; - else - { - // bad time - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file has no proper time field: '%s'", timestr ); - return false; - } - - // Correct timing if necessary - lyric_time += start_offset; - lyric_time += timing_correction; - - if ( lyric_time < 0 ) - lyric_time = 0; - - // Set to next char - state_offset = offset + 1; - state = PARSER_IN_LYRICS; - } - } - else if ( state == PARSER_INIT ) - { - // Ignore spaces - if ( *p == ' ' || *p == '\t' ) - continue; - - // We're looking for [ or < - if ( *p == '[' || *p == '<' ) - { - // Set to next char - state_offset = offset + 1; - state = PARSER_IN_TIME; - lyric_time = -1; - } - else if ( *p == '\n' ) - { - // If we get a newline and we're not paragraph, set it - if ( lyric_flags & CKaraokeLyricsText::LYRICS_NEW_LINE ) - lyric_flags = CKaraokeLyricsText::LYRICS_NEW_PARAGRAPH; - } - else - { - // Everything else is error - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file does not start from time" ); - return false; - } - } - } - return true; -} - -bool CKaraokeLyricsTextLRC::ParserMultiTime(char *lyricData, unsigned int lyricSize, int timing_correction) -{ - CLog::Log( LOGDEBUG, "LRC lyric loader: parser mult-time lyrics file" ); - ParserState state = PARSER_INIT; - unsigned int state_offset = 0; - unsigned int lyric_flags = 0; - std::vector<int> lyric_time(1, -1); - int time_num = 0; - std::vector<MtLyric> mtline; - MtLyric line; - int start_offset = 0; - unsigned int offset = 0; - - for ( char * p = lyricData; offset < lyricSize; offset++, p++ ) - { - // Skip \r - if ( *p == 0x0D ) - continue; - - if ( state == PARSER_IN_LYRICS ) - { - // Lyrics are terminated either by \n or by [ - if ( *p == '\n' || *p == '[' ) - { - // Time must be there - if ( lyric_time[0] == -1 ) - { - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file has no time before lyrics" ); - return false; - } - - // Add existing lyrics - char current = *p; - std::string text; - - if ( offset > state_offset ) - { - // null-terminate string, we saved current char anyway - *p = '\0'; - text = &lyricData[0] + state_offset; - } - else - text = " "; // add a single space for empty lyric - - // If this was end of line, set the flags accordingly - if ( current == '\n' ) - { - // Add space after the trailing lyric in lrc - text += " "; - for ( int i = 0; i <= time_num; i++ ) - { - line.text = text; - line.flags = lyric_flags | LYRICS_CONVERT_UTF8; - line.timing = lyric_time[i]; - mtline.push_back( line ); - } - state_offset = -1; - lyric_flags = CKaraokeLyricsText::LYRICS_NEW_LINE; - state = PARSER_INIT; - } - else - { - // No conversion needed as the file should be in UTF8 already - for ( int i = 0; i <= time_num; i++ ) - { - line.text = text; - line.flags = lyric_flags | LYRICS_CONVERT_UTF8; - line.timing = lyric_time[i]; - mtline.push_back( line ); - } - lyric_flags = 0; - state_offset = offset + 1; - state = PARSER_IN_TIME; - } - - time_num = 0; - lyric_time.resize(1); - lyric_time[0] = -1; - } - } - else if ( state == PARSER_IN_TIME ) - { - // Time is terminated by ] or > - if ( *p == ']' || *p == '>' ) - { - int mins, secs, htenths, ltenths = 0; - - if ( offset == state_offset ) - { - CLog::Log( LOGERROR, "LRC lyric loader: empty time" ); - return false; // [] - empty time - } - - // null-terminate string - char * timestr = &lyricData[0] + state_offset; - *p = '\0'; - - // Now check if this is time field or info tag. Info tags are like [ar:Pink Floyd] - char * fieldptr = strchr( timestr, ':' ); - if ( timestr[0] >= 'a' && timestr[0] <= 'z' && timestr[1] >= 'a' && timestr[1] <= 'z' && fieldptr ) - { - // Null-terminate the field name and switch to the field value - *fieldptr = '\0'; - fieldptr++; - - while ( isspace( *fieldptr ) ) - fieldptr++; - - // Check the info field - if ( !strcmp( timestr, "ar" ) ) - m_artist += fieldptr; - else if ( !strcmp( timestr, "sr" ) ) - { - // m_artist += "[CR]" + std::string( fieldptr ); // Add source to the artist name as a separate line - } - else if ( !strcmp( timestr, "ti" ) ) - m_songName = fieldptr; - else if ( !strcmp( timestr, "offset" ) ) - { - if ( sscanf( fieldptr, "%d", &start_offset ) != 1 ) - { - CLog::Log( LOGERROR, "LRC lyric loader: invalid [offset:] value '%s'", fieldptr ); - return false; // [] - empty time - } - - // Offset is in milliseconds; convert to 1/10 seconds - start_offset /= 100; - } - - state_offset = -1; - state = PARSER_INIT; - continue; - } - else if ( sscanf( timestr, "%d:%d.%1d%1d", &mins, &secs, &htenths, <enths ) == 4 ) - lyric_time[time_num] = mins * 600 + secs * 10 + htenths + MathUtils::round_int( ltenths / 10 ); - else if ( sscanf( timestr, "%d:%d.%1d", &mins, &secs, &htenths ) == 3 ) - lyric_time[time_num] = mins * 600 + secs * 10 + htenths; - else if ( sscanf( timestr, "%d:%d", &mins, &secs ) == 2 ) - lyric_time[time_num] = mins * 600 + secs * 10; - else - { - // bad time - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file has no proper time field: '%s'", timestr ); - return false; - } - - // Correct timing if necessary - lyric_time[time_num] += start_offset; - lyric_time[time_num] += timing_correction; - - if ( lyric_time[time_num] < 0 ) - lyric_time[time_num] = 0; - - // Multi-time line - if ( *(p + 1) == '[' ) - { - offset++; - p++; - state_offset = offset + 1; - state = PARSER_IN_TIME; - time_num++; - lyric_time.push_back(-1); - } - else - { - // Set to next char - state_offset = offset + 1; - state = PARSER_IN_LYRICS; - } - } - } - else if ( state == PARSER_INIT ) - { - // Ignore spaces - if ( *p == ' ' || *p == '\t' ) - continue; - - // We're looking for [ or < - if ( *p == '[' || *p == '<' ) - { - // Set to next char - state_offset = offset + 1; - state = PARSER_IN_TIME; - - time_num = 0; - lyric_time.resize(1); - lyric_time[0] = -1; - } - else if ( *p == '\n' ) - { - // If we get a newline and we're not paragraph, set it - if ( lyric_flags & CKaraokeLyricsText::LYRICS_NEW_LINE ) - lyric_flags = CKaraokeLyricsText::LYRICS_NEW_PARAGRAPH; - } - else - { - // Everything else is error - CLog::Log( LOGERROR, "LRC lyric loader: lyrics file does not start from time" ); - return false; - } - } - } - - unsigned int lyricsNum = mtline.size(); - if ( lyricsNum >= 2 ) - { - for ( unsigned int i = 0; i < lyricsNum - 1; i++ ) - { - for ( unsigned int j = i + 1; j < lyricsNum; j++ ) - { - if ( mtline[i].timing > mtline[j].timing ) - { - line = mtline[i]; - mtline[i] = mtline[j]; - mtline[j] = line; - } - } - } - } - for ( unsigned int i=0; i < lyricsNum; i++ ) - addLyrics( mtline[i].text, mtline[i].timing, mtline[i].flags ); - - return true; -} - diff --git a/xbmc/music/karaoke/karaokelyricstextlrc.h b/xbmc/music/karaoke/karaokelyricstextlrc.h deleted file mode 100644 index 07f8e855fd..0000000000 --- a/xbmc/music/karaoke/karaokelyricstextlrc.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef KARAOKELYRICSTEXTLRC_H -#define KARAOKELYRICSTEXTLRC_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricstextlrc - -#include "karaokelyricstext.h" - - -//! This class loads LRC format lyrics -class CKaraokeLyricsTextLRC : public CKaraokeLyricsText -{ - public: - CKaraokeLyricsTextLRC( const std::string & lyricsFile ); - ~CKaraokeLyricsTextLRC(); - - //! Parses the lyrics or song file, and loads the lyrics into memory. Returns true if the - //! lyrics are successfully loaded, false otherwise. - bool Load(); - - private: - bool checkMultiTime(char *lyricData, unsigned int lyricSize); - bool ParserNormal(char *lyricData, unsigned int lyricSize, int timing_correction); - bool ParserMultiTime(char *lyricData, unsigned int lyricSize, int timing_correction); - - std::string m_lyricsFile; -}; - -#endif diff --git a/xbmc/music/karaoke/karaokelyricstextustar.cpp b/xbmc/music/karaoke/karaokelyricstextustar.cpp deleted file mode 100644 index 7aba9eb8ed..0000000000 --- a/xbmc/music/karaoke/karaokelyricstextustar.cpp +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokelyricstextlrc - -#include <cstdlib> -#include <math.h> - -#include "filesystem/File.h" -#include "utils/log.h" -#include "utils/URIUtils.h" -#include "utils/StringUtils.h" -#include "karaokelyricstextustar.h" - - -CKaraokeLyricsTextUStar::CKaraokeLyricsTextUStar( const std::string & lyricsFile ) - : CKaraokeLyricsText() - , m_lyricsFile(lyricsFile) -{ -} - - -CKaraokeLyricsTextUStar::~CKaraokeLyricsTextUStar() -{ -} - - -std::vector< std::string > CKaraokeLyricsTextUStar::readFile(const std::string & lyricsFile, bool report_errors ) -{ - std::vector< std::string > lines; - - XFILE::CFile file; - XFILE::auto_buffer buf; - - if (file.LoadFile(lyricsFile, buf) <= 0) - { - if (report_errors) - CLog::Log(LOGERROR, "%s: can't load \"%s\" file", __FUNCTION__, lyricsFile.c_str()); - - return std::vector< std::string >(); - } - file.Close(); - - const size_t lyricSize = buf.size(); - - // Parse into the string array - size_t offset = 0; - size_t lineoffset = 0; - - while ( offset < lyricSize ) - { - // End of line? - if (buf.get()[offset] == 0x0D || buf.get()[offset] == 0x0A) - { - // An empty line? - if ( lineoffset != offset ) - lines.push_back(std::string(buf.get() + lineoffset, offset - lineoffset)); - - // Point to the next symbol - lineoffset = offset + 1; - } - - offset++; - } - - // Last line, if any - if ( lineoffset < lyricSize ) - lines.push_back(std::string(buf.get() + lineoffset, buf.size() - lineoffset)); - - return lines; -} - - -bool CKaraokeLyricsTextUStar::isValidFile(const std::string & lyricsFile) -{ - std::vector< std::string > lines = readFile( lyricsFile, false ); - - if ( lines.size() == 0 ) - return false; - - // Generally the first line should start with '#' and the last line should start with 'E' - return ( lines[0][0] == '#' && lines[lines.size()-1][0] == 'E' ); -} - - -bool CKaraokeLyricsTextUStar::Load() -{ - // Header parameters - std::string coverimage, bgimage; - int bpm = 0, startoffsetms = 0; - bool relative = false; - - // Read the text file - std::vector< std::string > lines = readFile( m_lyricsFile, true ); - - if ( lines.size() == 0 ) - return false; - - // Clear the lyrics array - clearLyrics(); - - // Parse and validate the header according to - // http://ultrastardeluxe.xtremeweb-hosting.net/wiki/doku.php?id=editor:txt_file - unsigned int idx = 0; - - for ( ; idx < lines.size() && lines[idx][0] == '#'; idx++ ) - { - // Parse into key:value - size_t offset = lines[idx].find(':'); - if (offset == std::string::npos) - { - CLog::Log( LOGERROR, "UStar lyric loader: invalid line '%s', no semicolon", lines[idx].c_str() ); - return false; - } - - std::string key = lines[idx].substr(1, offset - 1); - std::string value = lines[idx].substr(offset + 1); - - if ( key == "TITLE" ) - m_songName = value; - else if ( key == "ARTIST" ) - m_artist = value; - else if ( key == "VIDEO" ) - { - m_videoFile = URIUtils::GetDirectory(m_lyricsFile); - m_videoFile = URIUtils::AddFileToFolder(m_videoFile, value); - - if ( !XFILE::CFile::Exists( m_videoFile ) ) - { - CLog::Log( LOGERROR, "UStar lyric loader: VIDEO entry is present, but video file %s is not found", m_videoFile.c_str() ); - m_videoFile.clear(); - } - } - else if ( key == "COVER" ) - coverimage = value; - else if ( key == "BACKGROUND" ) - bgimage = value; - else if ( key == "VIDEOGAP" ) - m_videoOffset = atoi( value.c_str() ); - else if ( key == "BPM" ) - bpm = atoi( value.c_str() ); - else if ( key == "GAP" ) - startoffsetms = atoi( value.c_str() ); - else if ( key == "RELATIVE" ) - relative = StringUtils::EqualsNoCase(value, "YES"); - else if ( key == "LANGUAGE" || key == "EDITION" || key == "GENRE" || key == "YEAR" || key == "MP3" ) - { - ; // do nothing - } - else - CLog::Log( LOGWARNING, "UStar lyric loader: unsupported keyword '%s'", key.c_str() ); - } - - // BPM must be defined - if ( bpm == 0 ) - { - CLog::Log( LOGERROR, "UStar lyric loader: BPM is not defined, file is invalid" ); - return false; - } - - // Should be more lines - if ( idx == lines.size() ) - { - CLog::Log( LOGERROR, "UStar lyric loader: no lyrics found besides the header" ); - return false; - } - - double beatstep = 60.0 / bpm / 4.0; - CLog::Log( LOGDEBUG, "UStar lyric loader: found valid lyrics, BPM is %d (%g)", bpm, beatstep ); - - // Now parse the words/notes part - int lyric_flags = 0; - - for ( ; idx < lines.size() && lines[idx][0] != 'E'; idx++ ) - { - char type = lines[idx][0]; - - // A valid type should be followed by space - if ( type != 'F' && type != ':' && type != '*' && type != '-' && lines[idx][1] != ' ' ) - { - CLog::Log( LOGERROR, "UStar lyric loader: invalid line '%s', bad note type or no tail space", lines[idx].c_str() ); - return false; - } - - // Parse the numbers in the line into the vector - int numbercount = (type == '-') ? 1 : 3; - char * p = &(lines[idx][1]); - std::vector< int > numbers; - - while ( numbercount > 0 ) - { - unsigned int length = 0; - - // Skip all leading space - while ( isspace( *p ) ) - p++; - - // skip non-space - while ( p[length] && !isspace( p[length] ) ) - { - if ( !isdigit( p[length] ) ) - { - CLog::Log( LOGERROR, "UStar lyric loader: invalid line '%s', bad digit at back-position %d", lines[idx].c_str(), numbercount ); - return false; - } - - length++; - } - - p[length++] = '\0'; - - if ( strlen(p) == 0 ) - { - CLog::Log( LOGERROR, "UStar lyric loader: invalid line '%s', empty digit at back-position %d", lines[idx].c_str(), numbercount ); - return false; - } - - numbers.push_back( atoi( p ) ); - - // Adjust p - p += length; - numbercount--; - } - - int notestart_timing = (int)((numbers[0] * beatstep) * 10 + (startoffsetms / 100)); - - if ( type != '-' ) - { - // Pitch is not used yet; notelenght will not be used at all - //int notelength = numbers[1] * beatstep * 10; - //int notepitch = numbers[2]; - - addLyrics( p, notestart_timing, lyric_flags | LYRICS_CONVERT_UTF8 ); - lyric_flags = 0; - - //CLog::Log( LOGDEBUG, ":: %d %d [%d - %d] %d '%s'", numbers[0], numbers[1], notestart_timing, notelength, notepitch, text ); - } - else - { - lyric_flags = CKaraokeLyricsText::LYRICS_NEW_LINE; - addLyrics( " ", notestart_timing, lyric_flags | LYRICS_CONVERT_UTF8 ); - - // If we're relative, adjust to the pause start - if ( relative ) - startoffsetms += (int)((numbers[0] * beatstep) * 10); - - //CLog::Log( LOGERROR, ":: [stop] %d [%d]", numbers[0], notestart_timing ); - } - } - - // Indicate that lyrics have pitch - m_hasPitch = true; - return true; -} diff --git a/xbmc/music/karaoke/karaokelyricstextustar.h b/xbmc/music/karaoke/karaokelyricstextustar.h deleted file mode 100644 index 8e2aced3e8..0000000000 --- a/xbmc/music/karaoke/karaokelyricstextustar.h +++ /dev/null @@ -1,49 +0,0 @@ -#ifndef KARAOKELYRICSTEXTUSTAR_H -#define KARAOKELYRICSTEXTUSTAR_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokelyricstextlrc - -#include "karaokelyricstext.h" - - -//! This class loads UltraStar format lyrics -class CKaraokeLyricsTextUStar : public CKaraokeLyricsText -{ - public: - CKaraokeLyricsTextUStar( const std::string & lyricsFile ); - ~CKaraokeLyricsTextUStar(); - - //! Parses the lyrics or song file, and loads the lyrics into memory. Returns true if the - //! lyrics are successfully loaded, false otherwise. - bool Load(); - - static bool isValidFile( const std::string & lyricsFile ); - - private: - static std::vector<std::string> readFile( const std::string & lyricsFile, bool report_errors ); - - private: - std::string m_lyricsFile; -}; - -#endif diff --git a/xbmc/music/karaoke/karaokevideobackground.cpp b/xbmc/music/karaoke/karaokevideobackground.cpp deleted file mode 100644 index dae59ac251..0000000000 --- a/xbmc/music/karaoke/karaokevideobackground.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include "karaokevideobackground.h" - -#include "guilib/GraphicContext.h" -#include "guilib/Texture.h" -#include "guilib/GUITexture.h" -#include "Application.h" -#include "filesystem/SpecialProtocol.h" -#include "settings/AdvancedSettings.h" -#include "video/FFmpegVideoDecoder.h" -#include "system.h" -#include "utils/log.h" - -KaraokeVideoBackground::KaraokeVideoBackground() -{ - m_decoder = new FFmpegVideoDecoder(); - m_timeFromPrevSong = 0.0; - m_texture = 0; -} - -KaraokeVideoBackground::~KaraokeVideoBackground() -{ - delete m_decoder; - delete m_texture; -} - -bool KaraokeVideoBackground::openVideoFile( const std::string& filename ) -{ - std::string realPath = CSpecialProtocol::TranslatePath( filename ); - - if ( !m_decoder->open( realPath ) ) - { - CLog::Log( LOGERROR, "Karaoke Video Background: %s, video file %s (%s)", m_decoder->getErrorMsg().c_str(), filename.c_str(), realPath.c_str() ); - return false; - } - - m_videoWidth = m_decoder->getWidth(); - m_videoHeight = m_decoder->getHeight(); - m_curVideoFile = filename; - - // Find out the necessary aspect ratio for height (assuming fit by width) and width (assuming fit by height) - const RESOLUTION_INFO info = g_graphicsContext.GetResInfo(); - m_displayLeft = info.Overscan.left; - m_displayRight = info.Overscan.right; - m_displayTop = info.Overscan.top; - m_displayBottom = info.Overscan.bottom; - - int screen_width = m_displayRight - m_displayLeft; - int screen_height = m_displayBottom - m_displayTop; - - // Do we need to modify the output video size? This could happen in two cases: - // 1. Either video dimension is larger than the screen - video needs to be downscaled - // 2. Both video dimensions are smaller than the screen - video needs to be upscaled - if ( ( m_videoWidth > 0 && m_videoHeight > 0 ) - && ( ( m_videoWidth > screen_width || m_videoHeight > screen_height ) - || ( m_videoWidth < screen_width && m_videoHeight < screen_height ) ) ) - { - // Calculate the scale coefficients for width/height separately - double scale_width = (double) screen_width / (double) m_videoWidth; - double scale_height = (double) screen_height / (double) m_videoHeight; - - // And apply the smallest - double scale = scale_width < scale_height ? scale_width : scale_height; - m_videoWidth = (int) (m_videoWidth * scale); - m_videoHeight = (int) (m_videoHeight * scale); - } - - // Calculate the desktop dimensions to show the video - if ( m_videoWidth < screen_width || m_videoHeight < screen_height ) - { - m_displayLeft = (screen_width - m_videoWidth) / 2; - m_displayRight -= m_displayLeft; - - m_displayTop = (screen_height - m_videoHeight) / 2; - m_displayBottom -= m_displayTop; - } - - m_millisecondsPerFrame = 1.0 / m_decoder->getFramesPerSecond(); - - CLog::Log( LOGDEBUG, "Karaoke Video Background: Video file %s (%dx%d) length %g seconds opened successfully, will be shown as %dx%d at (%d, %d - %d, %d) rectangle", - filename.c_str(), - m_decoder->getWidth(), m_decoder->getHeight(), - m_decoder->getDuration(), - m_videoWidth, m_videoHeight, - m_displayLeft, m_displayTop, m_displayRight, m_displayBottom ); - - return true; -} - -void KaraokeVideoBackground::closeVideoFile() -{ - m_decoder->close(); -} - -void KaraokeVideoBackground::Render() -{ - // Just in case - if ( !m_texture ) - return; - - // Get the current song timing in ms. - // This will only fit songs up to 71,000 hours, so if you got a larger one, change to int64 - double current = g_application.GetTime(); - - // We're supposed to show m_decoder->getFramesPerSecond() frames in one second. - if ( current >= m_nextFrameTime ) - { - // We don't care to adjust for the exact timing as we don't worry about the exact frame rate - m_nextFrameTime = current + m_millisecondsPerFrame - (current - m_nextFrameTime); - - while ( true ) - { - if ( !m_decoder->nextFrame( m_texture ) ) - { - // End of video; restart - m_decoder->seek( 0.0 ); - m_nextFrameTime = 0.0; - continue; - } - - break; - } - } - - // We got a frame. Draw it. - CRect vertCoords((float) m_displayLeft, (float) m_displayTop, (float) m_displayRight, (float) m_displayBottom ); - CGUITexture::DrawQuad(vertCoords, 0xffffffff, m_texture ); -} - -bool KaraokeVideoBackground::Start( const std::string& filename ) -{ - if ( !filename.empty() ) - { - if ( !openVideoFile( filename ) ) - return false; - - m_timeFromPrevSong = 0; - } - else - { - if ( !openVideoFile( g_advancedSettings.m_karaokeDefaultBackgroundFilePath ) ) - return false; - - if ( m_timeFromPrevSong != 0.0 && !m_decoder->seek( m_timeFromPrevSong ) ) - m_timeFromPrevSong = 0; - } - - // Allocate the texture - m_texture = new CTexture( m_videoWidth, m_videoHeight, XB_FMT_A8R8G8B8 ); - - if ( !m_texture ) - { - CLog::Log( LOGERROR, "Karaoke Video Background: Could not allocate texture" ); - return false; - } - - m_nextFrameTime = 0.0; - return true; -} - -void KaraokeVideoBackground::Stop() -{ - delete m_texture; - m_texture = 0; - - m_timeFromPrevSong = m_decoder->getLastFrameTime(); -} diff --git a/xbmc/music/karaoke/karaokevideobackground.h b/xbmc/music/karaoke/karaokevideobackground.h deleted file mode 100644 index 146cdaae43..0000000000 --- a/xbmc/music/karaoke/karaokevideobackground.h +++ /dev/null @@ -1,85 +0,0 @@ -#ifndef KARAOKEVIDEOFFMPEG_H -#define KARAOKEVIDEOFFMPEG_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -#include <string> - -class CBaseTexture; -class FFmpegVideoDecoder; - -// C++ Interface: karaokevideoffmpeg -// Contact: oldnemesis -// -// FFMpeg-based background video decoder for Karaoke background. -// We are not using DVDPlayer for this because: -// 1. DVDPlayer was not designed to run at the same time when music is being played and other things (like lyrics) rendered. -// While this setup works from time to time, it constantly gets broken. Some modes, like VDPAU, lead to crash right away. -// -// 2. We do not need to decode audio, hence we don't have to use extra CPU. -// -// 3. We do not really care about frame rate. Jerky video is fine for the background. Lyrics sync is much more important. -// -class KaraokeVideoBackground -{ -public: - KaraokeVideoBackground(); - ~KaraokeVideoBackground(); - - // Start playing the video. It is called each time a new song is being played. Should continue playing existing - // video from the position it was paused. If it returns false, the video rendering is disabled and - // KaraokeVideoFFMpeg object is deleted. Must write the reason for failure into the log file. - bool Start( const std::string& filename = "" ); - - // Render the current frame into the screen. This function also must handle video loops and - // switching to the next video when necessary. Hence it shouldn't take too long. - void Render(); - - // Stops playing the video. It is called once the song is finished and the Render() is not going to be called anymore. - // The object, however, is kept and should keep its state because it must continue on next Start() call. - void Stop(); - -private: - // Initialize the object. This function is called only once when the object is created or after it has been dismissed. - // If it returns false, the video rendering is disabled and KaraokeVideoFFMpeg object is deleted - bool Init(); - - // Dismisses the object, freeing all the memory and unloading the libraries. The object must be inited before using again. - void Dismiss(); - - bool openVideoFile( const std::string& filename ); - void closeVideoFile(); - - // FFMpeg objects - FFmpegVideoDecoder * m_decoder; - - std::string m_curVideoFile; - int m_videoWidth; // shown video width, i.e. upscaled or downscaled as necessary - int m_videoHeight; // shown video height, i.e. upscaled or downscaled as necessary - int m_displayLeft, m_displayRight, m_displayTop, m_displayBottom; // Video as shown at the display - double m_millisecondsPerFrame; - double m_nextFrameTime; - double m_timeFromPrevSong; - - CBaseTexture *m_texture; -}; - -#endif diff --git a/xbmc/music/karaoke/karaokewindowbackground.cpp b/xbmc/music/karaoke/karaokewindowbackground.cpp deleted file mode 100644 index 4af54822c2..0000000000 --- a/xbmc/music/karaoke/karaokewindowbackground.cpp +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Implementation: karaokewindowbackground - -#include "system.h" -#include "settings/AdvancedSettings.h" -#include "guilib/GUIWindowManager.h" -#include "Application.h" -#include "GUIUserMessages.h" -#include "guilib/GUIVisualisationControl.h" -#include "guilib/GUIImage.h" -#include "threads/SingleLock.h" -#include "utils/log.h" - -#include "karaokewindowbackground.h" -#include "karaokevideobackground.h" - - -#define CONTROL_ID_VIS 1 -#define CONTROL_ID_IMG 2 - - -CKaraokeWindowBackground::CKaraokeWindowBackground() -{ - m_currentMode = BACKGROUND_NONE; - m_defaultMode = BACKGROUND_NONE; - m_parentWindow = 0; - - m_VisControl = 0; - m_ImgControl = 0; - - m_videoPlayer = 0; - m_parentWindow = 0; -} - - -CKaraokeWindowBackground::~CKaraokeWindowBackground() -{ - if ( m_videoPlayer ) - delete m_videoPlayer; -} - - -void CKaraokeWindowBackground::Init(CGUIWindow * wnd) -{ - // Init controls - m_VisControl = (CGUIVisualisationControl*) wnd->GetControl( CONTROL_ID_VIS ); - m_ImgControl = (CGUIImage*) wnd->GetControl( CONTROL_ID_IMG ); - - // Init visialisation variables - std::string defBkgType = g_advancedSettings.m_karaokeDefaultBackgroundType; - - if ( defBkgType.empty() || defBkgType == "none" ) - { - CLog::Log( LOGDEBUG, "Karaoke default background is set to none" ); - m_defaultMode = BACKGROUND_NONE; - } - else if ( defBkgType == "vis" || defBkgType == "viz" ) - { - CLog::Log( LOGDEBUG, "Karaoke default background is visualisation" ); - m_defaultMode = BACKGROUND_VISUALISATION; - } - else if ( defBkgType == "image" && !g_advancedSettings.m_karaokeDefaultBackgroundFilePath.empty() ) - { - CLog::Log( LOGDEBUG, "Karaoke default background is image %s", g_advancedSettings.m_karaokeDefaultBackgroundFilePath.c_str() ); - m_defaultMode = BACKGROUND_IMAGE; - m_path = g_advancedSettings.m_karaokeDefaultBackgroundFilePath; - } - else if ( defBkgType == "video" && !g_advancedSettings.m_karaokeDefaultBackgroundFilePath.empty() ) - { - CLog::Log( LOGDEBUG, "Karaoke default background is video %s", g_advancedSettings.m_karaokeDefaultBackgroundFilePath.c_str() ); - m_defaultMode = BACKGROUND_VIDEO; - } -} - - -bool CKaraokeWindowBackground::OnAction(const CAction & action) -{ - CSingleLock lock (m_CritSectionShared); - - // Send it to the visualisation if we have one - if ( m_currentMode == BACKGROUND_VISUALISATION ) - return m_VisControl->OnAction(action); - - return false; -} - - -bool CKaraokeWindowBackground::OnMessage(CGUIMessage & message) -{ - CSingleLock lock (m_CritSectionShared); - - // Forward visualisation control messages - switch ( message.GetMessage() ) - { - case GUI_MSG_PLAYBACK_STARTED: - if ( m_currentMode == BACKGROUND_VISUALISATION ) - return m_VisControl->OnMessage(message); - break; - - case GUI_MSG_GET_VISUALISATION: - if ( m_currentMode == BACKGROUND_VISUALISATION ) - return m_VisControl->OnMessage(message); - break; - - case GUI_MSG_VISUALISATION_ACTION: - if ( m_currentMode == BACKGROUND_VISUALISATION ) - return m_VisControl->OnMessage(message); - break; - } - - return false; -} - - -void CKaraokeWindowBackground::Render() -{ - CSingleLock lock (m_CritSectionShared); - - // Proceed with video rendering - if ( m_currentMode == BACKGROUND_VIDEO && m_videoPlayer ) - { - m_videoPlayer->Render(); - } - - // For other visualisations just disable the screen saver - g_application.ResetScreenSaver(); -} - - -void CKaraokeWindowBackground::StartEmpty() -{ - m_VisControl->SetVisible( false ); - m_ImgControl->SetVisible( false ); - m_currentMode = BACKGROUND_NONE; - CLog::Log( LOGDEBUG, "Karaoke background started using BACKGROUND_NONE mode" ); -} - - -void CKaraokeWindowBackground::StartVisualisation() -{ - // Showing controls - m_ImgControl->SetVisible( false ); - m_VisControl->SetVisible( true ); - - m_currentMode = BACKGROUND_VISUALISATION; - CLog::Log( LOGDEBUG, "Karaoke background started using BACKGROUND_VISUALISATION mode" ); -} - - -void CKaraokeWindowBackground::StartImage( const std::string& path ) -{ - // Showing controls - m_ImgControl->SetVisible( true ); - m_VisControl->SetVisible( false ); - - m_ImgControl->SetFileName( path ); - - m_currentMode = BACKGROUND_IMAGE; - CLog::Log( LOGDEBUG, "Karaoke background started using BACKGROUND_IMAGE mode using image %s", path.c_str() ); -} - - -void CKaraokeWindowBackground::StartVideo( const std::string& path ) -{ - if ( !m_videoPlayer ) - m_videoPlayer = new KaraokeVideoBackground(); - - if ( !m_videoPlayer->Start( path ) ) - { - delete m_videoPlayer; - m_videoPlayer = 0; - m_currentMode = BACKGROUND_NONE; - return; - } - - m_ImgControl->SetVisible( false ); - m_VisControl->SetVisible( false ); - m_currentMode = BACKGROUND_VIDEO; -} - - -void CKaraokeWindowBackground::StartDefault() -{ - // just in case - m_ImgControl->SetVisible( false ); - m_VisControl->SetVisible( false ); - - switch ( m_defaultMode ) - { - case BACKGROUND_VISUALISATION: - StartVisualisation(); - break; - - case BACKGROUND_IMAGE: - StartImage( m_path ); - break; - - case BACKGROUND_VIDEO: - StartVideo(); - break; - - default: - StartEmpty(); - break; - } -} - - -void CKaraokeWindowBackground::Stop() -{ - CSingleLock lock (m_CritSectionShared); - m_currentMode = BACKGROUND_NONE; - - if ( m_videoPlayer ) - m_videoPlayer->Stop(); - - CLog::Log( LOGDEBUG, "Karaoke background stopped" ); -} - - -void CKaraokeWindowBackground::OnPlayBackEnded() -{ -} - -void CKaraokeWindowBackground::OnPlayBackStarted() -{ -} - -void CKaraokeWindowBackground::OnPlayBackStopped() -{ -} - -void CKaraokeWindowBackground::OnQueueNextItem() -{ -} - -void CKaraokeWindowBackground::Pause(bool now_paused) -{ -} diff --git a/xbmc/music/karaoke/karaokewindowbackground.h b/xbmc/music/karaoke/karaokewindowbackground.h deleted file mode 100644 index e799716af9..0000000000 --- a/xbmc/music/karaoke/karaokewindowbackground.h +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef KARAOKEWINDOWBACKGROUND_H -#define KARAOKEWINDOWBACKGROUND_H - -/* - * Copyright (C) 2005-2013 Team XBMC - * http://xbmc.org - * - * This Program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * This Program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with XBMC; see the file COPYING. If not, see - * <http://www.gnu.org/licenses/>. - * - */ - -// C++ Interface: karaokewindowbackground - -#include "cores/IPlayerCallback.h" - -class CGUIWindow; -class CGUIImage; -class CGUIVisualisationControl; -class KaraokeVideoBackground; - -class CKaraokeWindowBackground : public IPlayerCallback -{ -public: - CKaraokeWindowBackground(); - ~CKaraokeWindowBackground(); - - virtual void Init(CGUIWindow * wnd); - - // Start with empty background - virtual void StartEmpty(); - - // Start with visualisation background - virtual void StartVisualisation(); - - // Start with song-specific still image background - virtual void StartImage( const std::string& path ); - - // Start with song-specific video background - virtual void StartVideo( const std::string& path = "" ); - - // Start with default (setting-specific) background - virtual void StartDefault(); - - // Pause or continue the background - virtual void Pause( bool now_paused ); - - // Stop any kind of background - virtual void Stop(); - - // Function forwarders - virtual bool OnAction(const CAction &action); - virtual bool OnMessage(CGUIMessage& message); - virtual void Render(); - - // IPlayer callbacks - virtual void OnPlayBackEnded(); - virtual void OnPlayBackStarted(); - virtual void OnPlayBackStopped(); - virtual void OnQueueNextItem(); - -private: - enum BackgroundMode - { - BACKGROUND_NONE, - BACKGROUND_VISUALISATION, - BACKGROUND_IMAGE, - BACKGROUND_VIDEO - }; - - // This critical section protects all variables except m_videoEnded - CCriticalSection m_CritSectionShared; - - // for visualization background - CGUIVisualisationControl * m_VisControl; - CGUIImage * m_ImgControl; - - BackgroundMode m_currentMode; - - // Parent window pointer - CGUIWindow * m_parentWindow; - - // Video player pointer - KaraokeVideoBackground * m_videoPlayer; - - // For default visualisation mode - BackgroundMode m_defaultMode; - std::string m_path; // image -}; - -#endif diff --git a/xbmc/music/windows/GUIWindowMusicBase.cpp b/xbmc/music/windows/GUIWindowMusicBase.cpp index 3d99f624c9..bc24d1a76e 100644 --- a/xbmc/music/windows/GUIWindowMusicBase.cpp +++ b/xbmc/music/windows/GUIWindowMusicBase.cpp @@ -1160,9 +1160,7 @@ bool CGUIWindowMusicBase::OnPlayMedia(int iItem) { // single music file - if we get here then we have autoplaynextitem turned off or queuebydefault // turned on, but we still want to use the playlist player in order to handle more queued items // following etc. - // Karaoke items also can be added in runtime (while the song is played), so it should be queued too. - if ( (CSettings::GetInstance().GetBool(CSettings::SETTING_MUSICPLAYER_QUEUEBYDEFAULT) && g_windowManager.GetActiveWindow() != WINDOW_MUSIC_PLAYLIST_EDITOR) - || pItem->IsKaraoke() ) + if ( (CSettings::GetInstance().GetBool(CSettings::SETTING_MUSICPLAYER_QUEUEBYDEFAULT) && g_windowManager.GetActiveWindow() != WINDOW_MUSIC_PLAYLIST_EDITOR) ) { // TODO: Should the playlist be cleared if nothing is already playing? OnQueueItem(iItem); diff --git a/xbmc/settings/AdvancedSettings.cpp b/xbmc/settings/AdvancedSettings.cpp index 19451afa53..bcba6f6b47 100644 --- a/xbmc/settings/AdvancedSettings.cpp +++ b/xbmc/settings/AdvancedSettings.cpp @@ -124,14 +124,6 @@ void CAdvancedSettings::Initialize() m_omxHWAudioDecode = false; m_omxDecodeStartWithValidFrame = true; - m_karaokeSyncDelayCDG = 0.0f; - m_karaokeSyncDelayLRC = 0.0f; - m_karaokeChangeGenreForKaraokeSongs = false; - m_karaokeKeepDelay = true; - m_karaokeStartIndex = 1; - m_karaokeAlwaysEmptyOnCdgs = 1; - m_karaokeUseSongSpecificBackground = 0; - m_audioDefaultPlayer = "paplayer"; m_audioPlayCountMinimumPercent = 90.0f; @@ -504,25 +496,6 @@ void CAdvancedSettings::ParseSettingsFile(const std::string &file) XMLUtils::GetBoolean(pElement, "omxdecodestartwithvalidframe", m_omxDecodeStartWithValidFrame); } - pElement = pRootElement->FirstChildElement("karaoke"); - if (pElement) - { - XMLUtils::GetFloat(pElement, "syncdelaycdg", m_karaokeSyncDelayCDG, -3.0f, 3.0f); // keep the old name for comp - XMLUtils::GetFloat(pElement, "syncdelaylrc", m_karaokeSyncDelayLRC, -3.0f, 3.0f); - XMLUtils::GetBoolean(pElement, "alwaysreplacegenre", m_karaokeChangeGenreForKaraokeSongs ); - XMLUtils::GetBoolean(pElement, "storedelay", m_karaokeKeepDelay ); - XMLUtils::GetInt(pElement, "autoassignstartfrom", m_karaokeStartIndex, 1, 2000000000); - XMLUtils::GetBoolean(pElement, "nocdgbackground", m_karaokeAlwaysEmptyOnCdgs ); - XMLUtils::GetBoolean(pElement, "lookupsongbackground", m_karaokeUseSongSpecificBackground ); - - TiXmlElement* pKaraokeBackground = pElement->FirstChildElement("defaultbackground"); - if (pKaraokeBackground) - { - pKaraokeBackground->QueryStringAttribute("type", &m_karaokeDefaultBackgroundType); - pKaraokeBackground->QueryStringAttribute("path", &m_karaokeDefaultBackgroundFilePath); - } - } - pElement = pRootElement->FirstChildElement("video"); if (pElement) { diff --git a/xbmc/settings/AdvancedSettings.h b/xbmc/settings/AdvancedSettings.h index 35754a4038..230f4910e7 100644 --- a/xbmc/settings/AdvancedSettings.h +++ b/xbmc/settings/AdvancedSettings.h @@ -331,16 +331,6 @@ class CAdvancedSettings : public ISettingCallback, public ISettingsHandler bool m_bVirtualShares; bool m_bAllowDeferredRendering; - float m_karaokeSyncDelayCDG; // seems like different delay is needed for CDG and MP3s - float m_karaokeSyncDelayLRC; - bool m_karaokeChangeGenreForKaraokeSongs; - bool m_karaokeKeepDelay; // store user-changed song delay in the database - int m_karaokeStartIndex; // auto-assign numbering start from this value - bool m_karaokeAlwaysEmptyOnCdgs; // always have empty background on CDG files - bool m_karaokeUseSongSpecificBackground; // use song-specific video or image if available instead of default - std::string m_karaokeDefaultBackgroundType; // empty string or "vis", "image" or "video" - std::string m_karaokeDefaultBackgroundFilePath; // only for "image" or "video" types above - std::string m_cpuTempCmd; std::string m_gpuTempCmd; diff --git a/xbmc/settings/MediaSettings.cpp b/xbmc/settings/MediaSettings.cpp index ceed26d3fc..4b17ef678d 100644 --- a/xbmc/settings/MediaSettings.cpp +++ b/xbmc/settings/MediaSettings.cpp @@ -318,51 +318,7 @@ void CMediaSettings::OnSettingAction(const CSetting *setting) return; const std::string &settingId = setting->GetId(); - if (settingId == CSettings::SETTING_KARAOKE_EXPORT) - { - CContextButtons choices; - choices.Add(1, g_localizeStrings.Get(22034)); - choices.Add(2, g_localizeStrings.Get(22035)); - - int retVal = CGUIDialogContextMenu::ShowAndGetChoice(choices); - if ( retVal > 0 ) - { - std::string path(CProfilesManager::GetInstance().GetDatabaseFolder()); - VECSOURCES shares; - g_mediaManager.GetLocalDrives(shares); - if (CGUIDialogFileBrowser::ShowAndGetDirectory(shares, g_localizeStrings.Get(661), path, true)) - { - CMusicDatabase musicdatabase; - musicdatabase.Open(); - - if ( retVal == 1 ) - { - path = URIUtils::AddFileToFolder(path, "karaoke.html"); - musicdatabase.ExportKaraokeInfo( path, true ); - } - else - { - path = URIUtils::AddFileToFolder(path, "karaoke.csv"); - musicdatabase.ExportKaraokeInfo( path, false ); - } - musicdatabase.Close(); - } - } - } - else if (settingId == CSettings::SETTING_KARAOKE_IMPORTCSV) - { - std::string path(CProfilesManager::GetInstance().GetDatabaseFolder()); - VECSOURCES shares; - g_mediaManager.GetLocalDrives(shares); - if (CGUIDialogFileBrowser::ShowAndGetFile(shares, "karaoke.csv", g_localizeStrings.Get(651) , path)) - { - CMusicDatabase musicdatabase; - musicdatabase.Open(); - musicdatabase.ImportKaraokeInfo(path); - musicdatabase.Close(); - } - } - else if (settingId == CSettings::SETTING_MUSICLIBRARY_CLEANUP) + if (settingId == CSettings::SETTING_MUSICLIBRARY_CLEANUP) { if (HELPERS::ShowYesNoDialogText(CVariant{313}, CVariant{333}) == DialogResponse::YES) g_application.StartMusicCleanup(true); diff --git a/xbmc/settings/SettingConditions.cpp b/xbmc/settings/SettingConditions.cpp index c7f23105b0..ed62e4287c 100644 --- a/xbmc/settings/SettingConditions.cpp +++ b/xbmc/settings/SettingConditions.cpp @@ -206,9 +206,6 @@ void CSettingConditions::Initialize() #if HAS_GLES == 2 m_simpleConditions.insert("has_glesv2"); #endif -#ifdef HAS_KARAOKE - m_simpleConditions.insert("has_karaoke"); -#endif #ifdef HAS_SDL_JOYSTICK m_simpleConditions.insert("has_sdl_joystick"); #endif diff --git a/xbmc/settings/Settings.cpp b/xbmc/settings/Settings.cpp index aeed0b17d2..38bb87570f 100644 --- a/xbmc/settings/Settings.cpp +++ b/xbmc/settings/Settings.cpp @@ -293,14 +293,6 @@ const std::string CSettings::SETTING_AUDIOCDS_TRACKPATHFORMAT = "audiocds.trackp const std::string CSettings::SETTING_AUDIOCDS_ENCODER = "audiocds.encoder"; const std::string CSettings::SETTING_AUDIOCDS_SETTINGS = "audiocds.settings"; const std::string CSettings::SETTING_AUDIOCDS_EJECTONRIP = "audiocds.ejectonrip"; -const std::string CSettings::SETTING_KARAOKE_ENABLED = "karaoke.enabled"; -const std::string CSettings::SETTING_KARAOKE_AUTOPOPUPSELECTOR = "karaoke.autopopupselector"; -const std::string CSettings::SETTING_KARAOKE_FONT = "karaoke.font"; -const std::string CSettings::SETTING_KARAOKE_FONTHEIGHT = "karaoke.fontheight"; -const std::string CSettings::SETTING_KARAOKE_FONTCOLORS = "karaoke.fontcolors"; -const std::string CSettings::SETTING_KARAOKE_CHARSET = "karaoke.charset"; -const std::string CSettings::SETTING_KARAOKE_EXPORT = "karaoke.export"; -const std::string CSettings::SETTING_KARAOKE_IMPORTCSV = "karaoke.importcsv"; const std::string CSettings::SETTING_MYMUSIC_STARTWINDOW = "mymusic.startwindow"; const std::string CSettings::SETTING_MYMUSIC_SONGTHUMBINVIS = "mymusic.songthumbinvis"; const std::string CSettings::SETTING_MYMUSIC_DEFAULTLIBVIEW = "mymusic.defaultlibview"; @@ -1026,8 +1018,6 @@ void CSettings::InitializeISettingCallbacks() m_settingsManager->RegisterCallback(&g_advancedSettings, settingSet); settingSet.clear(); - settingSet.insert(CSettings::SETTING_KARAOKE_EXPORT); - settingSet.insert(CSettings::SETTING_KARAOKE_IMPORTCSV); settingSet.insert(CSettings::SETTING_MUSICLIBRARY_CLEANUP); settingSet.insert(CSettings::SETTING_MUSICLIBRARY_EXPORT); settingSet.insert(CSettings::SETTING_MUSICLIBRARY_IMPORT); @@ -1108,7 +1098,6 @@ void CSettings::InitializeISettingCallbacks() settingSet.clear(); settingSet.insert(CSettings::SETTING_SUBTITLES_CHARSET); - settingSet.insert(CSettings::SETTING_KARAOKE_CHARSET); settingSet.insert(CSettings::SETTING_LOCALE_CHARSET); m_settingsManager->RegisterCallback(&g_charsetConverter, settingSet); diff --git a/xbmc/settings/Settings.h b/xbmc/settings/Settings.h index 415ed3b869..5f132f7040 100644 --- a/xbmc/settings/Settings.h +++ b/xbmc/settings/Settings.h @@ -249,14 +249,6 @@ public: static const std::string SETTING_AUDIOCDS_ENCODER; static const std::string SETTING_AUDIOCDS_SETTINGS; static const std::string SETTING_AUDIOCDS_EJECTONRIP; - static const std::string SETTING_KARAOKE_ENABLED; - static const std::string SETTING_KARAOKE_AUTOPOPUPSELECTOR; - static const std::string SETTING_KARAOKE_FONT; - static const std::string SETTING_KARAOKE_FONTHEIGHT; - static const std::string SETTING_KARAOKE_FONTCOLORS; - static const std::string SETTING_KARAOKE_CHARSET; - static const std::string SETTING_KARAOKE_EXPORT; - static const std::string SETTING_KARAOKE_IMPORTCSV; static const std::string SETTING_MYMUSIC_STARTWINDOW; static const std::string SETTING_MYMUSIC_SONGTHUMBINVIS; static const std::string SETTING_MYMUSIC_DEFAULTLIBVIEW; diff --git a/xbmc/system.h b/xbmc/system.h index 02ac222b54..52255189fb 100644 --- a/xbmc/system.h +++ b/xbmc/system.h @@ -31,7 +31,6 @@ #define HAS_DVD_SWSCALE #define HAS_DVDPLAYER #define HAS_EVENT_SERVER -#define HAS_KARAOKE #define HAS_SCREENSAVER #define HAS_PYTHON #define HAS_VIDEO_PLAYBACK diff --git a/xbmc/utils/CharsetConverter.cpp b/xbmc/utils/CharsetConverter.cpp index b56760ca08..6fa02f9eae 100644 --- a/xbmc/utils/CharsetConverter.cpp +++ b/xbmc/utils/CharsetConverter.cpp @@ -90,7 +90,6 @@ enum SpecialCharset SystemCharset, UserCharset /* locale.charset */, SubtitleCharset /* subtitles.charset */, - KaraokeCharset /* karaoke.charset */ }; @@ -252,14 +251,6 @@ std::string CConverterType::ResolveSpecialCharset(enum SpecialCharset charset) return g_langInfo.GetGuiCharSet(); case SubtitleCharset: return g_langInfo.GetSubtitleCharSet(); - case KaraokeCharset: - { - CSetting* karaokeSetting = CSettings::GetInstance().GetSetting(CSettings::SETTING_KARAOKE_CHARSET); - if (karaokeSetting == NULL || ((CSettingString*)karaokeSetting)->GetValue() == "DEFAULT") - return g_langInfo.GetGuiCharSet(); - - return ((CSettingString*)karaokeSetting)->GetValue(); - } case NotSpecialCharset: default: return "UTF-8"; /* dummy value */ @@ -598,8 +589,6 @@ void CCharsetConverter::OnSettingChanged(const CSetting* setting) resetUserCharset(); else if (settingId == CSettings::SETTING_SUBTITLES_CHARSET) resetSubtitleCharset(); - else if (settingId == CSettings::SETTING_KARAOKE_CHARSET) - resetKaraokeCharset(); } void CCharsetConverter::clear() @@ -655,7 +644,6 @@ void CCharsetConverter::resetUserCharset(void) CInnerConverter::m_stdConversion[UserCharsetToUtf8].Reset(); CInnerConverter::m_stdConversion[Utf32ToUserCharset].Reset(); resetSubtitleCharset(); - resetKaraokeCharset(); } void CCharsetConverter::resetSubtitleCharset(void) @@ -663,13 +651,9 @@ void CCharsetConverter::resetSubtitleCharset(void) CInnerConverter::m_stdConversion[SubtitleCharsetToUtf8].Reset(); } -void CCharsetConverter::resetKaraokeCharset(void) -{ -} - void CCharsetConverter::reinitCharsetsFromSettings(void) { - resetUserCharset(); // this will also reinit Subtitle and Karaoke charsets + resetUserCharset(); // this will also reinit Subtitle charsets } bool CCharsetConverter::utf8ToUtf32(const std::string& utf8StringSrc, std::u32string& utf32StringDst, bool failOnBadChar /*= true*/) diff --git a/xbmc/utils/CharsetConverter.h b/xbmc/utils/CharsetConverter.h index 91c2a76aea..36777e84ad 100644 --- a/xbmc/utils/CharsetConverter.h +++ b/xbmc/utils/CharsetConverter.h @@ -168,7 +168,6 @@ public: private: static void resetUserCharset(void); static void resetSubtitleCharset(void); - static void resetKaraokeCharset(void); static const int m_Utf8CharMinSize, m_Utf8CharMaxSize; class CInnerConverter; diff --git a/xbmc/windows/GUIMediaWindow.cpp b/xbmc/windows/GUIMediaWindow.cpp index b7b357767b..36f035f73e 100644 --- a/xbmc/windows/GUIMediaWindow.cpp +++ b/xbmc/windows/GUIMediaWindow.cpp @@ -1017,9 +1017,6 @@ bool CGUIMediaWindow::OnClick(int iItem) return true; } - // If karaoke song is being played AND popup autoselector is enabled, the playlist should not be added - bool do_not_add_karaoke = CSettings::GetInstance().GetBool(CSettings::SETTING_KARAOKE_ENABLED) && - CSettings::GetInstance().GetBool(CSettings::SETTING_KARAOKE_AUTOPOPUPSELECTOR) && pItem->IsKaraoke(); bool autoplay = m_guiState.get() && m_guiState->AutoPlayNextItem(); if (m_vecItems->IsPlugin()) @@ -1039,7 +1036,7 @@ bool CGUIMediaWindow::OnClick(int iItem) } if (autoplay && !g_partyModeManager.IsEnabled() && - !pItem->IsPlayList() && !do_not_add_karaoke) + !pItem->IsPlayList()) { return OnPlayAndQueueMedia(pItem); } |