diff options
58 files changed, 5 insertions, 6785 deletions
diff --git a/.gitignore b/.gitignore index d1424f77ac..7db5a759aa 100644 --- a/.gitignore +++ b/.gitignore @@ -945,11 +945,6 @@ lib/cpluff/stamp-h1 /lib/libhdhomerun/Makefile -# /lib/libhts/Win32 -/lib/libhts/Win32/Debug -/lib/libhts/Win32/Release - - # /lib/libRTV/ /lib/libRTV/Makefile /lib/libRTV/Debug diff --git a/Kodi.xcodeproj/project.pbxproj b/Kodi.xcodeproj/project.pbxproj index c546e623c6..d78a33434a 100644 --- a/Kodi.xcodeproj/project.pbxproj +++ b/Kodi.xcodeproj/project.pbxproj @@ -1153,7 +1153,6 @@ DFF0F16B17528350002DA3A4 /* DVDDemuxBXA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE89ACA41621DAB800E17DBC /* DVDDemuxBXA.cpp */; }; DFF0F16C17528350002DA3A4 /* DVDDemuxCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52566B1732C1890094A464 /* DVDDemuxCDDA.cpp */; }; DFF0F16D17528350002DA3A4 /* DVDDemuxFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E25C20D263DE200618676 /* DVDDemuxFFmpeg.cpp */; }; - DFF0F16E17528350002DA3A4 /* DVDDemuxHTSP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55110440F5C3C0000955236 /* DVDDemuxHTSP.cpp */; }; DFF0F16F17528350002DA3A4 /* DVDDemuxPVRClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8482902156CFED9005A996F /* DVDDemuxPVRClient.cpp */; }; DFF0F17017528350002DA3A4 /* DVDDemuxShoutcast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E154D0D25F9F900618676 /* DVDDemuxShoutcast.cpp */; }; DFF0F17117528350002DA3A4 /* DVDDemuxUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E154F0D25F9F900618676 /* DVDDemuxUtils.cpp */; }; @@ -1164,7 +1163,6 @@ DFF0F17617528350002DA3A4 /* DVDInputStreamBluray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58E293711FFC103006F4D46 /* DVDInputStreamBluray.cpp */; }; DFF0F17717528350002DA3A4 /* DVDInputStreamFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E155D0D25F9FA00618676 /* DVDInputStreamFFmpeg.cpp */; }; DFF0F17817528350002DA3A4 /* DVDInputStreamFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E155F0D25F9FA00618676 /* DVDInputStreamFile.cpp */; }; - DFF0F17917528350002DA3A4 /* DVDInputStreamHTSP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F51CEF860F5C64A5004F4602 /* DVDInputStreamHTSP.cpp */; }; DFF0F17A17528350002DA3A4 /* DVDInputStreamHttp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15610D25F9FA00618676 /* DVDInputStreamHttp.cpp */; }; DFF0F17B17528350002DA3A4 /* DVDInputStreamMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15630D25F9FA00618676 /* DVDInputStreamMemory.cpp */; }; DFF0F17C17528350002DA3A4 /* DVDInputStreamNavigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15650D25F9FA00618676 /* DVDInputStreamNavigator.cpp */; }; @@ -1293,8 +1291,6 @@ DFF0F20017528350002DA3A4 /* FTPParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E60D25F9FA00618676 /* FTPParse.cpp */; }; DFF0F20317528350002DA3A4 /* HDHomeRunDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F51444B568007C6459 /* HDHomeRunDirectory.cpp */; }; DFF0F20417528350002DA3A4 /* HDHomeRunFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */; }; - DFF0F20517528350002DA3A4 /* HTSPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196140FB2382E0030E150 /* HTSPDirectory.cpp */; }; - DFF0F20617528350002DA3A4 /* HTSPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196160FB2382E0030E150 /* HTSPSession.cpp */; }; DFF0F20717528350002DA3A4 /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */; }; DFF0F20817528350002DA3A4 /* HTTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF9A71EC1639C8F6005ECB2E /* HTTPFile.cpp */; }; DFF0F20917528350002DA3A4 /* IDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EC0D25F9FA00618676 /* IDirectory.cpp */; }; @@ -1879,13 +1875,6 @@ DFF0F47417528350002DA3A4 /* XBMC_keytable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8EC5D0C1369519D00CCC10D /* XBMC_keytable.cpp */; }; DFF0F47517528350002DA3A4 /* WinEventsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4991571174E661300741B6D /* WinEventsIOS.mm */; }; DFF0F47617528350002DA3A4 /* WinSystemIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4991573174E661300741B6D /* WinSystemIOS.mm */; }; - DFF0F47717528350002DA3A4 /* htsatomic.c in Sources */ = {isa = PBXBuildFile; fileRef = F551106D0F5C424700955236 /* htsatomic.c */; }; - DFF0F47817528350002DA3A4 /* htsbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = F551106F0F5C424700955236 /* htsbuf.c */; }; - DFF0F47917528350002DA3A4 /* htsmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110710F5C424700955236 /* htsmsg.c */; }; - DFF0F47A17528350002DA3A4 /* htsmsg_binary.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110730F5C424700955236 /* htsmsg_binary.c */; }; - DFF0F47B17528350002DA3A4 /* htsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110760F5C424700955236 /* htsstr.c */; }; - DFF0F47C17528350002DA3A4 /* net_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = F551107B0F5C424700955236 /* net_posix.c */; }; - DFF0F47D17528350002DA3A4 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = F51CF2CE0F6055A4004F4602 /* sha1.c */; }; DFF0F47E17528350002DA3A4 /* AutoPool.mm in Sources */ = {isa = PBXBuildFile; fileRef = F57A1D1D1329B15300498CC7 /* AutoPool.mm */; }; DFF0F48017528350002DA3A4 /* DarwinUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = F5B13C8C1334056B0045076D /* DarwinUtils.mm */; }; DFF0F48117528350002DA3A4 /* OSXGNUReplacements.c in Sources */ = {isa = PBXBuildFile; fileRef = F51CEEEE0F5C5D20004F4602 /* OSXGNUReplacements.c */; }; @@ -2251,8 +2240,6 @@ E3E91FFE0D8C61DF002BF43D /* EventServer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E91FFB0D8C61DF002BF43D /* EventServer.cpp */; }; E3E91FFF0D8C61DF002BF43D /* Socket.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E91FFC0D8C61DF002BF43D /* Socket.cpp */; }; E3E920020D8C622A002BF43D /* EventClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E3E920010D8C622A002BF43D /* EventClient.cpp */; }; - E43196170FB2382E0030E150 /* HTSPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196140FB2382E0030E150 /* HTSPDirectory.cpp */; }; - E43196180FB2382E0030E150 /* HTSPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196160FB2382E0030E150 /* HTSPSession.cpp */; }; E46F7C2A0F77217400C25D29 /* Zeroconf.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46F7C280F77217400C25D29 /* Zeroconf.cpp */; }; E46F7C2D0F77219700C25D29 /* ZeroconfOSX.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E46F7C2C0F77219700C25D29 /* ZeroconfOSX.cpp */; }; E499108C174D0D2600741B6D /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = E499108B174D0D2600741B6D /* UIKit.framework */; }; @@ -2386,7 +2373,6 @@ E49911D3174E5D2E00741B6D /* DVDDemuxBXA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = AE89ACA41621DAB800E17DBC /* DVDDemuxBXA.cpp */; }; E49911D4174E5D2E00741B6D /* DVDDemuxCDDA.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF52566B1732C1890094A464 /* DVDDemuxCDDA.cpp */; }; E49911D5174E5D2E00741B6D /* DVDDemuxFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E25C20D263DE200618676 /* DVDDemuxFFmpeg.cpp */; }; - E49911D6174E5D2E00741B6D /* DVDDemuxHTSP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55110440F5C3C0000955236 /* DVDDemuxHTSP.cpp */; }; E49911D7174E5D2E00741B6D /* DVDDemuxPVRClient.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8482902156CFED9005A996F /* DVDDemuxPVRClient.cpp */; }; E49911D8174E5D2E00741B6D /* DVDDemuxShoutcast.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E154D0D25F9F900618676 /* DVDDemuxShoutcast.cpp */; }; E49911D9174E5D2E00741B6D /* DVDDemuxUtils.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E154F0D25F9F900618676 /* DVDDemuxUtils.cpp */; }; @@ -2397,7 +2383,6 @@ E49911DE174E5D3700741B6D /* DVDInputStreamBluray.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F58E293711FFC103006F4D46 /* DVDInputStreamBluray.cpp */; }; E49911DF174E5D3700741B6D /* DVDInputStreamFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E155D0D25F9FA00618676 /* DVDInputStreamFFmpeg.cpp */; }; E49911E0174E5D3700741B6D /* DVDInputStreamFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E155F0D25F9FA00618676 /* DVDInputStreamFile.cpp */; }; - E49911E1174E5D3700741B6D /* DVDInputStreamHTSP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F51CEF860F5C64A5004F4602 /* DVDInputStreamHTSP.cpp */; }; E49911E2174E5D3700741B6D /* DVDInputStreamHttp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15610D25F9FA00618676 /* DVDInputStreamHttp.cpp */; }; E49911E3174E5D3700741B6D /* DVDInputStreamMemory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15630D25F9FA00618676 /* DVDInputStreamMemory.cpp */; }; E49911E4174E5D3700741B6D /* DVDInputStreamNavigator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E15650D25F9FA00618676 /* DVDInputStreamNavigator.cpp */; }; @@ -2526,8 +2511,6 @@ E4991269174E5D8F00741B6D /* FTPParse.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16E60D25F9FA00618676 /* FTPParse.cpp */; }; E499126C174E5D8F00741B6D /* HDHomeRunDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F51444B568007C6459 /* HDHomeRunDirectory.cpp */; }; E499126D174E5D8F00741B6D /* HDHomeRunFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */; }; - E499126E174E5D8F00741B6D /* HTSPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196140FB2382E0030E150 /* HTSPDirectory.cpp */; }; - E499126F174E5D8F00741B6D /* HTSPSession.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E43196160FB2382E0030E150 /* HTSPSession.cpp */; }; E4991270174E5D8F00741B6D /* HTTPDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */; }; E4991271174E5D8F00741B6D /* HTTPFile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DF9A71EC1639C8F6005ECB2E /* HTTPFile.cpp */; }; E4991272174E5D8F00741B6D /* IDirectory.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E38E16EC0D25F9FA00618676 /* IDirectory.cpp */; }; @@ -3112,13 +3095,6 @@ E499156F174E65AC00741B6D /* XBMC_keytable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C8EC5D0C1369519D00CCC10D /* XBMC_keytable.cpp */; }; E4991574174E661400741B6D /* WinEventsIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4991571174E661300741B6D /* WinEventsIOS.mm */; }; E4991575174E661400741B6D /* WinSystemIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = E4991573174E661300741B6D /* WinSystemIOS.mm */; }; - E4991577174E67EE00741B6D /* htsatomic.c in Sources */ = {isa = PBXBuildFile; fileRef = F551106D0F5C424700955236 /* htsatomic.c */; }; - E4991578174E67EE00741B6D /* htsbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = F551106F0F5C424700955236 /* htsbuf.c */; }; - E4991579174E67EE00741B6D /* htsmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110710F5C424700955236 /* htsmsg.c */; }; - E499157A174E67EE00741B6D /* htsmsg_binary.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110730F5C424700955236 /* htsmsg_binary.c */; }; - E499157B174E67EE00741B6D /* htsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110760F5C424700955236 /* htsstr.c */; }; - E499157C174E67EE00741B6D /* net_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = F551107B0F5C424700955236 /* net_posix.c */; }; - E499157D174E67EE00741B6D /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = F51CF2CE0F6055A4004F4602 /* sha1.c */; }; E499157E174E681200741B6D /* librtv.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E38E256C0D263A1C00618676 /* librtv.a */; }; E4991580174E681600741B6D /* libxdaap.a in Frameworks */ = {isa = PBXBuildFile; fileRef = E38E25680D2639F100618676 /* libxdaap.a */; }; E4991581174E681600741B6D /* SlingboxLib.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18404DA51396C31B00863BBA /* SlingboxLib.a */; }; @@ -3149,7 +3125,6 @@ F50FDC5A119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FDC59119B4B2C00C8B8CD /* GUIDialogTextViewer.cpp */; }; F50FE04E11A3411A00C8B8CD /* EncoderFFmpeg.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F50FE04D11A3411A00C8B8CD /* EncoderFFmpeg.cpp */; }; F51CEEEF0F5C5D20004F4602 /* OSXGNUReplacements.c in Sources */ = {isa = PBXBuildFile; fileRef = F51CEEEE0F5C5D20004F4602 /* OSXGNUReplacements.c */; }; - F51CEF880F5C64A5004F4602 /* DVDInputStreamHTSP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F51CEF860F5C64A5004F4602 /* DVDInputStreamHTSP.cpp */; }; F51CF2D00F6055A4004F4602 /* sha1.c in Sources */ = {isa = PBXBuildFile; fileRef = F51CF2CE0F6055A4004F4602 /* sha1.c */; }; F52A733D1560BC34005B1A0B /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F52A733C1560BC34005B1A0B /* CoreFoundation.framework */; }; F52B063B11869862004B1D66 /* Skin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F52B063A11869862004B1D66 /* Skin.cpp */; }; @@ -3171,13 +3146,6 @@ 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 */; }; - F55110450F5C3C0100955236 /* DVDDemuxHTSP.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F55110440F5C3C0000955236 /* DVDDemuxHTSP.cpp */; }; - F551107C0F5C424700955236 /* htsatomic.c in Sources */ = {isa = PBXBuildFile; fileRef = F551106D0F5C424700955236 /* htsatomic.c */; }; - F551107D0F5C424700955236 /* htsbuf.c in Sources */ = {isa = PBXBuildFile; fileRef = F551106F0F5C424700955236 /* htsbuf.c */; }; - F551107E0F5C424700955236 /* htsmsg.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110710F5C424700955236 /* htsmsg.c */; }; - F551107F0F5C424700955236 /* htsmsg_binary.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110730F5C424700955236 /* htsmsg_binary.c */; }; - F55110800F5C424700955236 /* htsstr.c in Sources */ = {isa = PBXBuildFile; fileRef = F55110760F5C424700955236 /* htsstr.c */; }; - F55110820F5C424700955236 /* net_posix.c in Sources */ = {isa = PBXBuildFile; fileRef = F551107B0F5C424700955236 /* net_posix.c */; }; 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 */; }; @@ -5582,10 +5550,6 @@ E3E91FFB0D8C61DF002BF43D /* EventServer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventServer.cpp; sourceTree = "<group>"; }; E3E91FFC0D8C61DF002BF43D /* Socket.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Socket.cpp; sourceTree = "<group>"; }; E3E920010D8C622A002BF43D /* EventClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventClient.cpp; sourceTree = "<group>"; }; - E43196130FB2382D0030E150 /* HTSPDirectory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTSPDirectory.h; sourceTree = "<group>"; }; - E43196140FB2382E0030E150 /* HTSPDirectory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTSPDirectory.cpp; sourceTree = "<group>"; }; - E43196150FB2382E0030E150 /* HTSPSession.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTSPSession.h; sourceTree = "<group>"; }; - E43196160FB2382E0030E150 /* HTSPSession.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTSPSession.cpp; sourceTree = "<group>"; }; E46F7C280F77217400C25D29 /* Zeroconf.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Zeroconf.cpp; sourceTree = "<group>"; }; E46F7C290F77217400C25D29 /* Zeroconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Zeroconf.h; sourceTree = "<group>"; }; E46F7C2B0F77219700C25D29 /* ZeroconfOSX.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZeroconfOSX.h; sourceTree = "<group>"; }; @@ -5687,8 +5651,6 @@ F50FE04D11A3411A00C8B8CD /* EncoderFFmpeg.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EncoderFFmpeg.cpp; sourceTree = "<group>"; }; F51CEEEE0F5C5D20004F4602 /* OSXGNUReplacements.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = OSXGNUReplacements.c; sourceTree = "<group>"; }; F51CEEF00F5C5D28004F4602 /* OSXGNUReplacements.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = OSXGNUReplacements.h; sourceTree = "<group>"; }; - F51CEF860F5C64A5004F4602 /* DVDInputStreamHTSP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DVDInputStreamHTSP.cpp; path = xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp; sourceTree = SOURCE_ROOT; }; - F51CEF870F5C64A5004F4602 /* DVDInputStreamHTSP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DVDInputStreamHTSP.h; path = xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h; sourceTree = SOURCE_ROOT; }; F51CF2CE0F6055A4004F4602 /* sha1.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = sha1.c; sourceTree = "<group>"; }; F51CF2CF0F6055A4004F4602 /* sha1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sha1.h; sourceTree = "<group>"; }; F52A733C1560BC34005B1A0B /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; }; @@ -5727,22 +5689,6 @@ 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>"; }; - F55110430F5C3C0000955236 /* DVDDemuxHTSP.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DVDDemuxHTSP.h; path = xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.h; sourceTree = SOURCE_ROOT; }; - F55110440F5C3C0000955236 /* DVDDemuxHTSP.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DVDDemuxHTSP.cpp; path = xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp; sourceTree = SOURCE_ROOT; }; - F551106C0F5C424700955236 /* hts_strtab.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hts_strtab.h; sourceTree = "<group>"; }; - F551106D0F5C424700955236 /* htsatomic.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = htsatomic.c; sourceTree = "<group>"; }; - F551106E0F5C424700955236 /* htsatomic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htsatomic.h; sourceTree = "<group>"; }; - F551106F0F5C424700955236 /* htsbuf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = htsbuf.c; sourceTree = "<group>"; }; - F55110700F5C424700955236 /* htsbuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htsbuf.h; sourceTree = "<group>"; }; - F55110710F5C424700955236 /* htsmsg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = htsmsg.c; sourceTree = "<group>"; }; - F55110720F5C424700955236 /* htsmsg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htsmsg.h; sourceTree = "<group>"; }; - F55110730F5C424700955236 /* htsmsg_binary.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = htsmsg_binary.c; sourceTree = "<group>"; }; - F55110740F5C424700955236 /* htsmsg_binary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htsmsg_binary.h; sourceTree = "<group>"; }; - F55110750F5C424700955236 /* htsq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htsq.h; sourceTree = "<group>"; }; - F55110760F5C424700955236 /* htsstr.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = htsstr.c; sourceTree = "<group>"; }; - F55110770F5C424700955236 /* htsstr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = htsstr.h; sourceTree = "<group>"; }; - F551107A0F5C424700955236 /* net.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = net.h; sourceTree = "<group>"; }; - F551107B0F5C424700955236 /* net_posix.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = net_posix.c; 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>"; }; @@ -8669,8 +8615,6 @@ DF52566C1732C1890094A464 /* DVDDemuxCDDA.h */, E38E25C20D263DE200618676 /* DVDDemuxFFmpeg.cpp */, E38E154C0D25F9F900618676 /* DVDDemuxFFmpeg.h */, - F55110440F5C3C0000955236 /* DVDDemuxHTSP.cpp */, - F55110430F5C3C0000955236 /* DVDDemuxHTSP.h */, C8482902156CFED9005A996F /* DVDDemuxPVRClient.cpp */, C8482903156CFED9005A996F /* DVDDemuxPVRClient.h */, E38E154D0D25F9F900618676 /* DVDDemuxShoutcast.cpp */, @@ -8698,8 +8642,6 @@ E38E155E0D25F9FA00618676 /* DVDInputStreamFFmpeg.h */, E38E155F0D25F9FA00618676 /* DVDInputStreamFile.cpp */, E38E15600D25F9FA00618676 /* DVDInputStreamFile.h */, - F51CEF860F5C64A5004F4602 /* DVDInputStreamHTSP.cpp */, - F51CEF870F5C64A5004F4602 /* DVDInputStreamHTSP.h */, E38E15610D25F9FA00618676 /* DVDInputStreamHttp.cpp */, E38E15620D25F9FA00618676 /* DVDInputStreamHttp.h */, E38E15630D25F9FA00618676 /* DVDInputStreamMemory.cpp */, @@ -8911,10 +8853,6 @@ DF93D7F41444B568007C6459 /* HDHomeRunDirectory.h */, DF93D7F01444B54A007C6459 /* HDHomeRunFile.cpp */, DF93D7F11444B54A007C6459 /* HDHomeRunFile.h */, - E43196140FB2382E0030E150 /* HTSPDirectory.cpp */, - E43196130FB2382D0030E150 /* HTSPDirectory.h */, - E43196160FB2382E0030E150 /* HTSPSession.cpp */, - E43196150FB2382E0030E150 /* HTSPSession.h */, F584E12D0F257C5100DB26A5 /* HTTPDirectory.cpp */, F584E12C0F257C5100DB26A5 /* HTTPDirectory.h */, DF9A71EC1639C8F6005ECB2E /* HTTPFile.cpp */, @@ -9145,7 +9083,6 @@ children = ( E38E18820D25F9FA00618676 /* libexif */, E38E196D0D25F9FB00618676 /* libhdhomerun */, - F551106A0F5C424700955236 /* libhts */, E38E1A130D25F9FB00618676 /* libRTV */, E38E1A550D25F9FB00618676 /* libUPnP */, E38E1C840D25F9FC00618676 /* libXDAAP */, @@ -9778,29 +9715,6 @@ name = commons; sourceTree = "<group>"; }; - F551106A0F5C424700955236 /* libhts */ = { - isa = PBXGroup; - children = ( - F551106C0F5C424700955236 /* hts_strtab.h */, - F551106D0F5C424700955236 /* htsatomic.c */, - F551106E0F5C424700955236 /* htsatomic.h */, - F551106F0F5C424700955236 /* htsbuf.c */, - F55110700F5C424700955236 /* htsbuf.h */, - F55110710F5C424700955236 /* htsmsg.c */, - F55110720F5C424700955236 /* htsmsg.h */, - F55110730F5C424700955236 /* htsmsg_binary.c */, - F55110740F5C424700955236 /* htsmsg_binary.h */, - F55110750F5C424700955236 /* htsq.h */, - F55110760F5C424700955236 /* htsstr.c */, - F55110770F5C424700955236 /* htsstr.h */, - F551107A0F5C424700955236 /* net.h */, - F551107B0F5C424700955236 /* net_posix.c */, - F51CF2CE0F6055A4004F4602 /* sha1.c */, - F51CF2CF0F6055A4004F4602 /* sha1.h */, - ); - path = libhts; - sourceTree = "<group>"; - }; F563529F16E53FE900D21BAD /* dialogs */ = { isa = PBXGroup; children = ( @@ -10770,24 +10684,13 @@ 7C2D6AE40F35453E00DD2E85 /* SpecialProtocol.cpp in Sources */, F5AD1EA80F488A1A0065EB5D /* GUIWindowKaraokeLyrics.cpp in Sources */, F56A084B0F4A18FB003F9F87 /* karaokewindowbackground.cpp in Sources */, - F55110450F5C3C0100955236 /* DVDDemuxHTSP.cpp in Sources */, - F551107C0F5C424700955236 /* htsatomic.c in Sources */, - F551107D0F5C424700955236 /* htsbuf.c in Sources */, - F551107E0F5C424700955236 /* htsmsg.c in Sources */, - F551107F0F5C424700955236 /* htsmsg_binary.c in Sources */, - F55110800F5C424700955236 /* htsstr.c in Sources */, - F55110820F5C424700955236 /* net_posix.c in Sources */, F51CEEEF0F5C5D20004F4602 /* OSXGNUReplacements.c in Sources */, - F51CEF880F5C64A5004F4602 /* DVDInputStreamHTSP.cpp in Sources */, - F51CF2D00F6055A4004F4602 /* sha1.c in Sources */, F5EA02260F6DA990005C2EC5 /* CocoaPowerSyscall.cpp in Sources */, F5EA02270F6DA9A5005C2EC5 /* PowerManager.cpp in Sources */, F5EA05C20F733812005C2EC5 /* CocoaInterface.mm in Sources */, E46F7C2A0F77217400C25D29 /* Zeroconf.cpp in Sources */, E46F7C2D0F77219700C25D29 /* ZeroconfOSX.cpp in Sources */, 83E0B2490F7C95FF0091643F /* Atomics.cpp in Sources */, - E43196170FB2382E0030E150 /* HTSPDirectory.cpp in Sources */, - E43196180FB2382E0030E150 /* HTSPSession.cpp in Sources */, F5AACA680FB3DE2D00DBB77C /* GUIDialogSelect.cpp in Sources */, F5AACA970FB3E2B800DBB77C /* GUIDialogSlider.cpp in Sources */, F59876C00FBA351D008EF4FB /* VideoReferenceClock.cpp in Sources */, @@ -11574,7 +11477,6 @@ DFF0F16B17528350002DA3A4 /* DVDDemuxBXA.cpp in Sources */, DFF0F16C17528350002DA3A4 /* DVDDemuxCDDA.cpp in Sources */, DFF0F16D17528350002DA3A4 /* DVDDemuxFFmpeg.cpp in Sources */, - DFF0F16E17528350002DA3A4 /* DVDDemuxHTSP.cpp in Sources */, DFF0F16F17528350002DA3A4 /* DVDDemuxPVRClient.cpp in Sources */, DFF0F17017528350002DA3A4 /* DVDDemuxShoutcast.cpp in Sources */, DFF0F17117528350002DA3A4 /* DVDDemuxUtils.cpp in Sources */, @@ -11585,7 +11487,6 @@ DFF0F17617528350002DA3A4 /* DVDInputStreamBluray.cpp in Sources */, DFF0F17717528350002DA3A4 /* DVDInputStreamFFmpeg.cpp in Sources */, DFF0F17817528350002DA3A4 /* DVDInputStreamFile.cpp in Sources */, - DFF0F17917528350002DA3A4 /* DVDInputStreamHTSP.cpp in Sources */, DFF0F17A17528350002DA3A4 /* DVDInputStreamHttp.cpp in Sources */, DFF0F17B17528350002DA3A4 /* DVDInputStreamMemory.cpp in Sources */, DFF0F17C17528350002DA3A4 /* DVDInputStreamNavigator.cpp in Sources */, @@ -11720,8 +11621,6 @@ DFF0F20317528350002DA3A4 /* HDHomeRunDirectory.cpp in Sources */, DFF0F20417528350002DA3A4 /* HDHomeRunFile.cpp in Sources */, 395F6DE41A81FACF0088CC74 /* HTTPImageTransformationHandler.cpp in Sources */, - DFF0F20517528350002DA3A4 /* HTSPDirectory.cpp in Sources */, - DFF0F20617528350002DA3A4 /* HTSPSession.cpp in Sources */, DFF0F20717528350002DA3A4 /* HTTPDirectory.cpp in Sources */, DFF0F20817528350002DA3A4 /* HTTPFile.cpp in Sources */, DFF0F20917528350002DA3A4 /* IDirectory.cpp in Sources */, @@ -12341,14 +12240,7 @@ DFF0F47517528350002DA3A4 /* WinEventsIOS.mm in Sources */, 395C29F21A98A16300EBC7AD /* HTTPPythonWsgiInvoker.cpp in Sources */, DFF0F47617528350002DA3A4 /* WinSystemIOS.mm in Sources */, - DFF0F47717528350002DA3A4 /* htsatomic.c in Sources */, - DFF0F47817528350002DA3A4 /* htsbuf.c in Sources */, DF32466419E931A8005E8CFB /* ActiveAEResampleFFMPEG.cpp in Sources */, - DFF0F47917528350002DA3A4 /* htsmsg.c in Sources */, - DFF0F47A17528350002DA3A4 /* htsmsg_binary.c in Sources */, - DFF0F47B17528350002DA3A4 /* htsstr.c in Sources */, - DFF0F47C17528350002DA3A4 /* net_posix.c in Sources */, - DFF0F47D17528350002DA3A4 /* sha1.c in Sources */, DFF0F47E17528350002DA3A4 /* AutoPool.mm in Sources */, DFF0F48017528350002DA3A4 /* DarwinUtils.mm in Sources */, DFF0F48117528350002DA3A4 /* OSXGNUReplacements.c in Sources */, @@ -12643,7 +12535,6 @@ E49911D3174E5D2E00741B6D /* DVDDemuxBXA.cpp in Sources */, E49911D4174E5D2E00741B6D /* DVDDemuxCDDA.cpp in Sources */, E49911D5174E5D2E00741B6D /* DVDDemuxFFmpeg.cpp in Sources */, - E49911D6174E5D2E00741B6D /* DVDDemuxHTSP.cpp in Sources */, E49911D7174E5D2E00741B6D /* DVDDemuxPVRClient.cpp in Sources */, E49911D8174E5D2E00741B6D /* DVDDemuxShoutcast.cpp in Sources */, E49911D9174E5D2E00741B6D /* DVDDemuxUtils.cpp in Sources */, @@ -12654,7 +12545,6 @@ E49911DE174E5D3700741B6D /* DVDInputStreamBluray.cpp in Sources */, E49911DF174E5D3700741B6D /* DVDInputStreamFFmpeg.cpp in Sources */, E49911E0174E5D3700741B6D /* DVDInputStreamFile.cpp in Sources */, - E49911E1174E5D3700741B6D /* DVDInputStreamHTSP.cpp in Sources */, E49911E2174E5D3700741B6D /* DVDInputStreamHttp.cpp in Sources */, E49911E3174E5D3700741B6D /* DVDInputStreamMemory.cpp in Sources */, F597B05C18A804E0005AADAE /* DVDVideoCodec.cpp in Sources */, @@ -12790,8 +12680,6 @@ E4991269174E5D8F00741B6D /* FTPParse.cpp in Sources */, E499126C174E5D8F00741B6D /* HDHomeRunDirectory.cpp in Sources */, E499126D174E5D8F00741B6D /* HDHomeRunFile.cpp in Sources */, - E499126E174E5D8F00741B6D /* HTSPDirectory.cpp in Sources */, - E499126F174E5D8F00741B6D /* HTSPSession.cpp in Sources */, E4991270174E5D8F00741B6D /* HTTPDirectory.cpp in Sources */, E4991271174E5D8F00741B6D /* HTTPFile.cpp in Sources */, E4991272174E5D8F00741B6D /* IDirectory.cpp in Sources */, @@ -13409,14 +13297,7 @@ E499156F174E65AC00741B6D /* XBMC_keytable.cpp in Sources */, E4991574174E661400741B6D /* WinEventsIOS.mm in Sources */, E4991575174E661400741B6D /* WinSystemIOS.mm in Sources */, - E4991577174E67EE00741B6D /* htsatomic.c in Sources */, - E4991578174E67EE00741B6D /* htsbuf.c in Sources */, - E4991579174E67EE00741B6D /* htsmsg.c in Sources */, - E499157A174E67EE00741B6D /* htsmsg_binary.c in Sources */, - E499157B174E67EE00741B6D /* htsstr.c in Sources */, DF56EF251A798A5E00CAAEFB /* HttpRangeUtils.cpp in Sources */, - E499157C174E67EE00741B6D /* net_posix.c in Sources */, - E499157D174E67EE00741B6D /* sha1.c in Sources */, E4991582174E682F00741B6D /* AutoPool.mm in Sources */, E4991583174E684000741B6D /* CocoaInterface.mm in Sources */, E4991584174E684000741B6D /* DarwinUtils.mm in Sources */, diff --git a/Makefile.in b/Makefile.in index 244c206e15..690c4629ac 100644 --- a/Makefile.in +++ b/Makefile.in @@ -30,7 +30,6 @@ DIRECTORY_ARCHIVES=$(DVDPLAYER_ARCHIVES) \ lib/SlingboxLib/SlingboxLib.a \ lib/libRTV/librtv.a \ lib/libXDAAP/libxdaap.a \ - lib/libhts/libhts.a \ xbmc/addons/addons.a \ xbmc/cdrip/cdrip.a \ xbmc/cores/AudioEngine/audioengine.a \ diff --git a/addons/resource.language.en_gb/resources/strings.po b/addons/resource.language.en_gb/resources/strings.po index 4bf8263899..b44d49da4b 100644 --- a/addons/resource.language.en_gb/resources/strings.po +++ b/addons/resource.language.en_gb/resources/strings.po @@ -10328,10 +10328,7 @@ msgctxt "#20255" msgid "First logon, edit your profile" msgstr "" -#: xbmc/network/GUIDialogNetworkSetup.cpp -msgctxt "#20256" -msgid "HTS Tvheadend client" -msgstr "" +#empty string with id 20256 #empty strings from id 20257 to 20258 @@ -12091,9 +12088,7 @@ msgctxt "#22017" msgid "By group" msgstr "" -msgctxt "#22018" -msgid "Live channels" -msgstr "" +#empty string with id 22018 msgctxt "#22019" msgid "Recordings by title" diff --git a/lib/libhts/Makefile b/lib/libhts/Makefile deleted file mode 100644 index 078d4f1b1b..0000000000 --- a/lib/libhts/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -INCLUDES=-I. - -SRCS = htsmsg.c \ - htsmsg_binary.c \ - htsbuf.c \ - htsstr.c \ - net_posix.c \ - sha1.c \ - -CFLAGS=-std=c99 -D_GNU_SOURCE -LIB=libhts.a - -include ../../Makefile.include --include $(patsubst %.cpp,%.P,$(patsubst %.c,%.P,$(SRCS))) diff --git a/lib/libhts/Win32/include/getopt.h b/lib/libhts/Win32/include/getopt.h deleted file mode 100644 index 6b6f643b7d..0000000000 --- a/lib/libhts/Win32/include/getopt.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 1987, 1993, 1994, 1996 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#ifndef __GETOPT_H__ -#define __GETOPT_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -extern int opterr; /* if error message should be printed */ -extern int optind; /* index into parent argv vector */ -extern int optopt; /* character checked for validity */ -extern int optreset; /* reset getopt */ -extern char *optarg; /* argument associated with option */ - -int getopt (int, char * const *, const char *); - -#ifdef __cplusplus -} -#endif - -#endif /* __GETOPT_H__ */ - -#ifndef __UNISTD_GETOPT__ -#ifndef __GETOPT_LONG_H__ -#define __GETOPT_LONG_H__ - -#ifdef __cplusplus -extern "C" { -#endif - -struct option { - const char *name; - int has_arg; - int *flag; - int val; -}; - -int getopt_long (int, char *const *, const char *, const struct option *, int *); -#ifndef HAVE_DECL_GETOPT -#define HAVE_DECL_GETOPT 1 -#endif - -#define no_argument 0 -#define required_argument 1 -#define optional_argument 2 - -#ifdef __cplusplus -} -#endif - -#endif /* __GETOPT_LONG_H__ */ -#endif /* __UNISTD_GETOPT__ */ diff --git a/lib/libhts/Win32/include/inttypes.h b/lib/libhts/Win32/include/inttypes.h deleted file mode 100644 index 1475fbf02f..0000000000 --- a/lib/libhts/Win32/include/inttypes.h +++ /dev/null @@ -1,306 +0,0 @@ -// ISO C9x compliant inttypes.h for Microsoft Visual Studio -// Based on ISO/IEC 9899:TC2 Committee draft (May 6, 2005) WG14/N1124 -// -// Copyright (c) 2006 Alexander Chemeris -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// 1. Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// 3. The name of the author may be used to endorse or promote products -// derived from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED -// WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO -// EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, -// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; -// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR -// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF -// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -/////////////////////////////////////////////////////////////////////////////// - -#ifndef _MSC_VER // [ -#error "Use this header only with Microsoft Visual C++ compilers!" -#endif // _MSC_VER ] - -#ifndef _MSC_INTTYPES_H_ // [ -#define _MSC_INTTYPES_H_ - -#if _MSC_VER > 1000 -#pragma once -#endif - -#include <stdint.h> - -// 7.8 Format conversion of integer types - -typedef struct { - intmax_t quot; - intmax_t rem; -} imaxdiv_t; - -// 7.8.1 Macros for format specifiers - -#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS) // [ See footnote 185 at page 198 - -// The fprintf macros for signed integers are: -#define PRId8 "d" -#define PRIi8 "i" -#define PRIdLEAST8 "d" -#define PRIiLEAST8 "i" -#define PRIdFAST8 "d" -#define PRIiFAST8 "i" - -#define PRId16 "hd" -#define PRIi16 "hi" -#define PRIdLEAST16 "hd" -#define PRIiLEAST16 "hi" -#define PRIdFAST16 "hd" -#define PRIiFAST16 "hi" - -#define PRId32 "I32d" -#define PRIi32 "I32i" -#define PRIdLEAST32 "I32d" -#define PRIiLEAST32 "I32i" -#define PRIdFAST32 "I32d" -#define PRIiFAST32 "I32i" - -#define PRId64 "I64d" -#define PRIi64 "I64i" -#define PRIdLEAST64 "I64d" -#define PRIiLEAST64 "I64i" -#define PRIdFAST64 "I64d" -#define PRIiFAST64 "I64i" - -#define PRIdMAX "I64d" -#define PRIiMAX "I64i" - -#define PRIdPTR "Id" -#define PRIiPTR "Ii" - -// The fprintf macros for unsigned integers are: -#define PRIo8 "o" -#define PRIu8 "u" -#define PRIx8 "x" -#define PRIX8 "X" -#define PRIoLEAST8 "o" -#define PRIuLEAST8 "u" -#define PRIxLEAST8 "x" -#define PRIXLEAST8 "X" -#define PRIoFAST8 "o" -#define PRIuFAST8 "u" -#define PRIxFAST8 "x" -#define PRIXFAST8 "X" - -#define PRIo16 "ho" -#define PRIu16 "hu" -#define PRIx16 "hx" -#define PRIX16 "hX" -#define PRIoLEAST16 "ho" -#define PRIuLEAST16 "hu" -#define PRIxLEAST16 "hx" -#define PRIXLEAST16 "hX" -#define PRIoFAST16 "ho" -#define PRIuFAST16 "hu" -#define PRIxFAST16 "hx" -#define PRIXFAST16 "hX" - -#define PRIo32 "I32o" -#define PRIu32 "I32u" -#define PRIx32 "I32x" -#define PRIX32 "I32X" -#define PRIoLEAST32 "I32o" -#define PRIuLEAST32 "I32u" -#define PRIxLEAST32 "I32x" -#define PRIXLEAST32 "I32X" -#define PRIoFAST32 "I32o" -#define PRIuFAST32 "I32u" -#define PRIxFAST32 "I32x" -#define PRIXFAST32 "I32X" - -#define PRIo64 "I64o" -#define PRIu64 "I64u" -#define PRIx64 "I64x" -#define PRIX64 "I64X" -#define PRIoLEAST64 "I64o" -#define PRIuLEAST64 "I64u" -#define PRIxLEAST64 "I64x" -#define PRIXLEAST64 "I64X" -#define PRIoFAST64 "I64o" -#define PRIuFAST64 "I64u" -#define PRIxFAST64 "I64x" -#define PRIXFAST64 "I64X" - -#define PRIoMAX "I64o" -#define PRIuMAX "I64u" -#define PRIxMAX "I64x" -#define PRIXMAX "I64X" - -#define PRIoPTR "Io" -#define PRIuPTR "Iu" -#define PRIxPTR "Ix" -#define PRIXPTR "IX" - -// The fscanf macros for signed integers are: -#define SCNd8 "d" -#define SCNi8 "i" -#define SCNdLEAST8 "d" -#define SCNiLEAST8 "i" -#define SCNdFAST8 "d" -#define SCNiFAST8 "i" - -#define SCNd16 "hd" -#define SCNi16 "hi" -#define SCNdLEAST16 "hd" -#define SCNiLEAST16 "hi" -#define SCNdFAST16 "hd" -#define SCNiFAST16 "hi" - -#define SCNd32 "ld" -#define SCNi32 "li" -#define SCNdLEAST32 "ld" -#define SCNiLEAST32 "li" -#define SCNdFAST32 "ld" -#define SCNiFAST32 "li" - -#define SCNd64 "I64d" -#define SCNi64 "I64i" -#define SCNdLEAST64 "I64d" -#define SCNiLEAST64 "I64i" -#define SCNdFAST64 "I64d" -#define SCNiFAST64 "I64i" - -#define SCNdMAX "I64d" -#define SCNiMAX "I64i" - -#ifdef _WIN64 // [ -# define SCNdPTR "I64d" -# define SCNiPTR "I64i" -#else // _WIN64 ][ -# define SCNdPTR "ld" -# define SCNiPTR "li" -#endif // _WIN64 ] - -// The fscanf macros for unsigned integers are: -#define SCNo8 "o" -#define SCNu8 "u" -#define SCNx8 "x" -#define SCNX8 "X" -#define SCNoLEAST8 "o" -#define SCNuLEAST8 "u" -#define SCNxLEAST8 "x" -#define SCNXLEAST8 "X" -#define SCNoFAST8 "o" -#define SCNuFAST8 "u" -#define SCNxFAST8 "x" -#define SCNXFAST8 "X" - -#define SCNo16 "ho" -#define SCNu16 "hu" -#define SCNx16 "hx" -#define SCNX16 "hX" -#define SCNoLEAST16 "ho" -#define SCNuLEAST16 "hu" -#define SCNxLEAST16 "hx" -#define SCNXLEAST16 "hX" -#define SCNoFAST16 "ho" -#define SCNuFAST16 "hu" -#define SCNxFAST16 "hx" -#define SCNXFAST16 "hX" - -#define SCNo32 "lo" -#define SCNu32 "lu" -#define SCNx32 "lx" -#define SCNX32 "lX" -#define SCNoLEAST32 "lo" -#define SCNuLEAST32 "lu" -#define SCNxLEAST32 "lx" -#define SCNXLEAST32 "lX" -#define SCNoFAST32 "lo" -#define SCNuFAST32 "lu" -#define SCNxFAST32 "lx" -#define SCNXFAST32 "lX" - -#define SCNo64 "I64o" -#define SCNu64 "I64u" -#define SCNx64 "I64x" -#define SCNX64 "I64X" -#define SCNoLEAST64 "I64o" -#define SCNuLEAST64 "I64u" -#define SCNxLEAST64 "I64x" -#define SCNXLEAST64 "I64X" -#define SCNoFAST64 "I64o" -#define SCNuFAST64 "I64u" -#define SCNxFAST64 "I64x" -#define SCNXFAST64 "I64X" - -#define SCNoMAX "I64o" -#define SCNuMAX "I64u" -#define SCNxMAX "I64x" -#define SCNXMAX "I64X" - -#ifdef _WIN64 // [ -# define SCNoPTR "I64o" -# define SCNuPTR "I64u" -# define SCNxPTR "I64x" -# define SCNXPTR "I64X" -#else // _WIN64 ][ -# define SCNoPTR "lo" -# define SCNuPTR "lu" -# define SCNxPTR "lx" -# define SCNXPTR "lX" -#endif // _WIN64 ] - -#endif // __STDC_FORMAT_MACROS ] - -// 7.8.2 Functions for greatest-width integer types - -// 7.8.2.1 The imaxabs function -#define imaxabs _abs64 - -// 7.8.2.2 The imaxdiv function - -// This is modified version of div() function from Microsoft's div.c found -// in %MSVC.NET%\crt\src\div.c -#ifdef STATIC_IMAXDIV // [ -static -#else // STATIC_IMAXDIV ][ -_inline -#endif // STATIC_IMAXDIV ] -imaxdiv_t __cdecl imaxdiv(intmax_t numer, intmax_t denom) -{ - imaxdiv_t result; - - result.quot = numer / denom; - result.rem = numer % denom; - - if (numer < 0 && result.rem > 0) { - // did division wrong; must fix up - ++result.quot; - result.rem -= denom; - } - - return result; -} - -// 7.8.2.3 The strtoimax and strtoumax functions -#define strtoimax _strtoi64 -#define strtoumax _strtoui64 - -// 7.8.2.4 The wcstoimax and wcstoumax functions -#define wcstoimax _wcstoi64 -#define wcstoumax _wcstoui64 - -#define ssize_t int - -#endif // _MSC_INTTYPES_H_ ] diff --git a/lib/libhts/Win32/include/msvc.h b/lib/libhts/Win32/include/msvc.h deleted file mode 100644 index 0a7ed2d3c8..0000000000 --- a/lib/libhts/Win32/include/msvc.h +++ /dev/null @@ -1,34 +0,0 @@ -#ifdef WIN32 - -#define strtoll(p, e, b) _strtoi64(p, e, b) -#define snprintf _snprintf -#define strcasecmp stricmp -#define strncasecmp strnicmp -#define strdup _strdup -#if _MSC_VER < 1500 -#define vsnprintf _vsnprintf -#endif - -static char * strndup(const char* str, size_t len) -{ - size_t i = 0; - char* p = (char*)str; - while(*p != 0 && i < len) - { - p++; - i++; - } - p = malloc(len+1); - memcpy(p, str, len); - p[len] = 0; - return p; -} - -#ifndef M_PI -#define M_PI 3.1415926535897932384626433832795 -#endif - -#define S_IFREG 0100000 -#define S_ISREG(m) (((m) & S_IFMT) == S_IFREG) - -#endif diff --git a/lib/libhts/Win32/include/sys/queue.h b/lib/libhts/Win32/include/sys/queue.h deleted file mode 100644 index 5661c71d08..0000000000 --- a/lib/libhts/Win32/include/sys/queue.h +++ /dev/null @@ -1,574 +0,0 @@ -/* - * Copyright (c) 1991, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @(#)queue.h 8.5 (Berkeley) 8/20/94 - */ - -#ifndef _SYS_QUEUE_H_ -#define _SYS_QUEUE_H_ - -/* - * This file defines five types of data structures: singly-linked lists, - * lists, simple queues, tail queues, and circular queues. - * - * A singly-linked list is headed by a single forward pointer. The - * elements are singly linked for minimum space and pointer manipulation - * overhead at the expense of O(n) removal for arbitrary elements. New - * elements can be added to the list after an existing element or at the - * head of the list. Elements being removed from the head of the list - * should use the explicit macro for this purpose for optimum - * efficiency. A singly-linked list may only be traversed in the forward - * direction. Singly-linked lists are ideal for applications with large - * datasets and few or no removals or for implementing a LIFO queue. - * - * A list is headed by a single forward pointer (or an array of forward - * pointers for a hash table header). The elements are doubly linked - * so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before - * or after an existing element or at the head of the list. A list - * may only be traversed in the forward direction. - * - * A simple queue is headed by a pair of pointers, one the head of the - * list and the other to the tail of the list. The elements are singly - * linked to save space, so elements can only be removed from the - * head of the list. New elements can be added to the list after - * an existing element, at the head of the list, or at the end of the - * list. A simple queue may only be traversed in the forward direction. - * - * A tail queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or - * after an existing element, at the head of the list, or at the end of - * the list. A tail queue may be traversed in either direction. - * - * A circle queue is headed by a pair of pointers, one to the head of the - * list and the other to the tail of the list. The elements are doubly - * linked so that an arbitrary element can be removed without a need to - * traverse the list. New elements can be added to the list before or after - * an existing element, at the head of the list, or at the end of the list. - * A circle queue may be traversed in either direction, but has a more - * complex end of list detection. - * - * For details on the use of these macros, see the queue(3) manual page. - */ - -/* - * List definitions. - */ -#define LIST_HEAD(name, type) \ -struct name { \ - struct type *lh_first; /* first element */ \ -} - -#define LIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define LIST_ENTRY(type) \ -struct { \ - struct type *le_next; /* next element */ \ - struct type **le_prev; /* address of previous next element */ \ -} - -/* - * List functions. - */ -#define LIST_INIT(head) do { \ - (head)->lh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_AFTER(listelm, elm, field) do { \ - if (((elm)->field.le_next = (listelm)->field.le_next) != NULL) \ - (listelm)->field.le_next->field.le_prev = \ - &(elm)->field.le_next; \ - (listelm)->field.le_next = (elm); \ - (elm)->field.le_prev = &(listelm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.le_next = (head)->lh_first) != NULL) \ - (head)->lh_first->field.le_prev = &(elm)->field.le_next;\ - (head)->lh_first = (elm); \ - (elm)->field.le_prev = &(head)->lh_first; \ -} while (/*CONSTCOND*/0) - -#define LIST_REMOVE(elm, field) do { \ - if ((elm)->field.le_next != NULL) \ - (elm)->field.le_next->field.le_prev = \ - (elm)->field.le_prev; \ - *(elm)->field.le_prev = (elm)->field.le_next; \ -} while (/*CONSTCOND*/0) - -#define LIST_FOREACH(var, head, field) \ - for ((var) = ((head)->lh_first); \ - (var); \ - (var) = ((var)->field.le_next)) - -/* - * List access methods. - */ -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#define LIST_FIRST(head) ((head)->lh_first) -#define LIST_NEXT(elm, field) ((elm)->field.le_next) - - -/* - * Singly-linked List definitions. - */ -#define SLIST_HEAD(name, type) \ -struct name { \ - struct type *slh_first; /* first element */ \ -} - -#define SLIST_HEAD_INITIALIZER(head) \ - { NULL } - -#define SLIST_ENTRY(type) \ -struct { \ - struct type *sle_next; /* next element */ \ -} - -/* - * Singly-linked List functions. - */ -#define SLIST_INIT(head) do { \ - (head)->slh_first = NULL; \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_AFTER(slistelm, elm, field) do { \ - (elm)->field.sle_next = (slistelm)->field.sle_next; \ - (slistelm)->field.sle_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.sle_next = (head)->slh_first; \ - (head)->slh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE_HEAD(head, field) do { \ - (head)->slh_first = (head)->slh_first->field.sle_next; \ -} while (/*CONSTCOND*/0) - -#define SLIST_REMOVE(head, elm, type, field) do { \ - if ((head)->slh_first == (elm)) { \ - SLIST_REMOVE_HEAD((head), field); \ - } \ - else { \ - struct type *curelm = (head)->slh_first; \ - while(curelm->field.sle_next != (elm)) \ - curelm = curelm->field.sle_next; \ - curelm->field.sle_next = \ - curelm->field.sle_next->field.sle_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SLIST_FOREACH(var, head, field) \ - for((var) = (head)->slh_first; (var); (var) = (var)->field.sle_next) - -/* - * Singly-linked List access methods. - */ -#define SLIST_EMPTY(head) ((head)->slh_first == NULL) -#define SLIST_FIRST(head) ((head)->slh_first) -#define SLIST_NEXT(elm, field) ((elm)->field.sle_next) - - -/* - * Singly-linked Tail queue declarations. - */ -#define STAILQ_HEAD(name, type) \ -struct name { \ - struct type *stqh_first; /* first element */ \ - struct type **stqh_last; /* addr of last next element */ \ -} - -#define STAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).stqh_first } - -#define STAILQ_ENTRY(type) \ -struct { \ - struct type *stqe_next; /* next element */ \ -} - -/* - * Singly-linked Tail queue functions. - */ -#define STAILQ_INIT(head) do { \ - (head)->stqh_first = NULL; \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.stqe_next = (head)->stqh_first) == NULL) \ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (head)->stqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.stqe_next = NULL; \ - *(head)->stqh_last = (elm); \ - (head)->stqh_last = &(elm)->field.stqe_next; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.stqe_next = (listelm)->field.stqe_next) == NULL)\ - (head)->stqh_last = &(elm)->field.stqe_next; \ - (listelm)->field.stqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE_HEAD(head, field) do { \ - if (((head)->stqh_first = (head)->stqh_first->field.stqe_next) == NULL) \ - (head)->stqh_last = &(head)->stqh_first; \ -} while (/*CONSTCOND*/0) - -#define STAILQ_REMOVE(head, elm, type, field) do { \ - if ((head)->stqh_first == (elm)) { \ - STAILQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->stqh_first; \ - while (curelm->field.stqe_next != (elm)) \ - curelm = curelm->field.stqe_next; \ - if ((curelm->field.stqe_next = \ - curelm->field.stqe_next->field.stqe_next) == NULL) \ - (head)->stqh_last = &(curelm)->field.stqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define STAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->stqh_first); \ - (var); \ - (var) = ((var)->field.stqe_next)) - -#define STAILQ_CONCAT(head1, head2) do { \ - if (!STAILQ_EMPTY((head2))) { \ - *(head1)->stqh_last = (head2)->stqh_first; \ - (head1)->stqh_last = (head2)->stqh_last; \ - STAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Singly-linked Tail queue access methods. - */ -#define STAILQ_EMPTY(head) ((head)->stqh_first == NULL) -#define STAILQ_FIRST(head) ((head)->stqh_first) -#define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) - - -/* - * Simple queue definitions. - */ -#define SIMPLEQ_HEAD(name, type) \ -struct name { \ - struct type *sqh_first; /* first element */ \ - struct type **sqh_last; /* addr of last next element */ \ -} - -#define SIMPLEQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).sqh_first } - -#define SIMPLEQ_ENTRY(type) \ -struct { \ - struct type *sqe_next; /* next element */ \ -} - -/* - * Simple queue functions. - */ -#define SIMPLEQ_INIT(head) do { \ - (head)->sqh_first = NULL; \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.sqe_next = (head)->sqh_first) == NULL) \ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (head)->sqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.sqe_next = NULL; \ - *(head)->sqh_last = (elm); \ - (head)->sqh_last = &(elm)->field.sqe_next; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.sqe_next = (listelm)->field.sqe_next) == NULL)\ - (head)->sqh_last = &(elm)->field.sqe_next; \ - (listelm)->field.sqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE_HEAD(head, field) do { \ - if (((head)->sqh_first = (head)->sqh_first->field.sqe_next) == NULL) \ - (head)->sqh_last = &(head)->sqh_first; \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_REMOVE(head, elm, type, field) do { \ - if ((head)->sqh_first == (elm)) { \ - SIMPLEQ_REMOVE_HEAD((head), field); \ - } else { \ - struct type *curelm = (head)->sqh_first; \ - while (curelm->field.sqe_next != (elm)) \ - curelm = curelm->field.sqe_next; \ - if ((curelm->field.sqe_next = \ - curelm->field.sqe_next->field.sqe_next) == NULL) \ - (head)->sqh_last = &(curelm)->field.sqe_next; \ - } \ -} while (/*CONSTCOND*/0) - -#define SIMPLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->sqh_first); \ - (var); \ - (var) = ((var)->field.sqe_next)) - -/* - * Simple queue access methods. - */ -#define SIMPLEQ_EMPTY(head) ((head)->sqh_first == NULL) -#define SIMPLEQ_FIRST(head) ((head)->sqh_first) -#define SIMPLEQ_NEXT(elm, field) ((elm)->field.sqe_next) - - -/* - * Tail queue definitions. - */ -#define _TAILQ_HEAD(name, type, qual) \ -struct name { \ - qual type *tqh_first; /* first element */ \ - qual type *qual *tqh_last; /* addr of last next element */ \ -} -#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,) - -#define TAILQ_HEAD_INITIALIZER(head) \ - { NULL, &(head).tqh_first } - -#define _TAILQ_ENTRY(type, qual) \ -struct { \ - qual type *tqe_next; /* next element */ \ - qual type *qual *tqe_prev; /* address of previous next element */\ -} -#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,) - -/* - * Tail queue functions. - */ -#define TAILQ_INIT(head) do { \ - (head)->tqh_first = NULL; \ - (head)->tqh_last = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_HEAD(head, elm, field) do { \ - if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \ - (head)->tqh_first->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (head)->tqh_first = (elm); \ - (elm)->field.tqe_prev = &(head)->tqh_first; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.tqe_next = NULL; \ - (elm)->field.tqe_prev = (head)->tqh_last; \ - *(head)->tqh_last = (elm); \ - (head)->tqh_last = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \ - if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\ - (elm)->field.tqe_next->field.tqe_prev = \ - &(elm)->field.tqe_next; \ - else \ - (head)->tqh_last = &(elm)->field.tqe_next; \ - (listelm)->field.tqe_next = (elm); \ - (elm)->field.tqe_prev = &(listelm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_REMOVE(head, elm, field) do { \ - if (((elm)->field.tqe_next) != NULL) \ - (elm)->field.tqe_next->field.tqe_prev = \ - (elm)->field.tqe_prev; \ - else \ - (head)->tqh_last = (elm)->field.tqe_prev; \ - *(elm)->field.tqe_prev = (elm)->field.tqe_next; \ -} while (/*CONSTCOND*/0) - -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); \ - (var); \ - (var) = ((var)->field.tqe_next)) - -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) - -#define TAILQ_CONCAT(head1, head2, field) do { \ - if (!TAILQ_EMPTY(head2)) { \ - *(head1)->tqh_last = (head2)->tqh_first; \ - (head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \ - (head1)->tqh_last = (head2)->tqh_last; \ - TAILQ_INIT((head2)); \ - } \ -} while (/*CONSTCOND*/0) - -/* - * Tail queue access methods. - */ -#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL) -#define TAILQ_FIRST(head) ((head)->tqh_first) -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) - -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) - - -/* - * Circular queue definitions. - */ -#define CIRCLEQ_HEAD(name, type) \ -struct name { \ - struct type *cqh_first; /* first element */ \ - struct type *cqh_last; /* last element */ \ -} - -#define CIRCLEQ_HEAD_INITIALIZER(head) \ - { (void *)&head, (void *)&head } - -#define CIRCLEQ_ENTRY(type) \ -struct { \ - struct type *cqe_next; /* next element */ \ - struct type *cqe_prev; /* previous element */ \ -} - -/* - * Circular queue functions. - */ -#define CIRCLEQ_INIT(head) do { \ - (head)->cqh_first = (void *)(head); \ - (head)->cqh_last = (void *)(head); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_AFTER(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm)->field.cqe_next; \ - (elm)->field.cqe_prev = (listelm); \ - if ((listelm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (listelm)->field.cqe_next->field.cqe_prev = (elm); \ - (listelm)->field.cqe_next = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_BEFORE(head, listelm, elm, field) do { \ - (elm)->field.cqe_next = (listelm); \ - (elm)->field.cqe_prev = (listelm)->field.cqe_prev; \ - if ((listelm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (listelm)->field.cqe_prev->field.cqe_next = (elm); \ - (listelm)->field.cqe_prev = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_HEAD(head, elm, field) do { \ - (elm)->field.cqe_next = (head)->cqh_first; \ - (elm)->field.cqe_prev = (void *)(head); \ - if ((head)->cqh_last == (void *)(head)) \ - (head)->cqh_last = (elm); \ - else \ - (head)->cqh_first->field.cqe_prev = (elm); \ - (head)->cqh_first = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_INSERT_TAIL(head, elm, field) do { \ - (elm)->field.cqe_next = (void *)(head); \ - (elm)->field.cqe_prev = (head)->cqh_last; \ - if ((head)->cqh_first == (void *)(head)) \ - (head)->cqh_first = (elm); \ - else \ - (head)->cqh_last->field.cqe_next = (elm); \ - (head)->cqh_last = (elm); \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_REMOVE(head, elm, field) do { \ - if ((elm)->field.cqe_next == (void *)(head)) \ - (head)->cqh_last = (elm)->field.cqe_prev; \ - else \ - (elm)->field.cqe_next->field.cqe_prev = \ - (elm)->field.cqe_prev; \ - if ((elm)->field.cqe_prev == (void *)(head)) \ - (head)->cqh_first = (elm)->field.cqe_next; \ - else \ - (elm)->field.cqe_prev->field.cqe_next = \ - (elm)->field.cqe_next; \ -} while (/*CONSTCOND*/0) - -#define CIRCLEQ_FOREACH(var, head, field) \ - for ((var) = ((head)->cqh_first); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_next)) - -#define CIRCLEQ_FOREACH_REVERSE(var, head, field) \ - for ((var) = ((head)->cqh_last); \ - (var) != (const void *)(head); \ - (var) = ((var)->field.cqe_prev)) - -/* - * Circular queue access methods. - */ -#define CIRCLEQ_EMPTY(head) ((head)->cqh_first == (void *)(head)) -#define CIRCLEQ_FIRST(head) ((head)->cqh_first) -#define CIRCLEQ_LAST(head) ((head)->cqh_last) -#define CIRCLEQ_NEXT(elm, field) ((elm)->field.cqe_next) -#define CIRCLEQ_PREV(elm, field) ((elm)->field.cqe_prev) - -#define CIRCLEQ_LOOP_NEXT(head, elm, field) \ - (((elm)->field.cqe_next == (void *)(head)) \ - ? ((head)->cqh_first) \ - : (elm->field.cqe_next)) -#define CIRCLEQ_LOOP_PREV(head, elm, field) \ - (((elm)->field.cqe_prev == (void *)(head)) \ - ? ((head)->cqh_last) \ - : (elm->field.cqe_prev)) - -#endif /* sys/queue.h */
\ No newline at end of file diff --git a/lib/libhts/Win32/include/unistd.h b/lib/libhts/Win32/include/unistd.h deleted file mode 100644 index 4799c2bffe..0000000000 --- a/lib/libhts/Win32/include/unistd.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the Mingw32 package. - * - * unistd.h maps (roughly) to io.h - */ - -#ifndef _UNISTD_H -#define _UNISTD_H - -#include <io.h> -#include <process.h> - -#define __UNISTD_GETOPT__ -#include <getopt.h> -#undef __UNISTD_GETOPT__ - -/* These are also defined in stdio.h. */ -#ifndef SEEK_SET -#define SEEK_SET 0 -#endif - -#ifndef SEEK_CUR -#define SEEK_CUR 1 -#endif - -#ifndef SEEK_END -#define SEEK_END 2 -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -/* This is defined as a real library function to allow autoconf - to verify its existence. */ -//int ftruncate(int, off_t); -//__CRT_INLINE int ftruncate(int __fd, off_t __length) -//{ -// return _chsize (__fd, __length); -//} - -#ifdef __cplusplus -} -#endif - -#endif /* _UNISTD_H */ diff --git a/lib/libhts/Win32/libhts_2010.vcxproj b/lib/libhts/Win32/libhts_2010.vcxproj deleted file mode 100644 index 9efa555361..0000000000 --- a/lib/libhts/Win32/libhts_2010.vcxproj +++ /dev/null @@ -1,99 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup Label="ProjectConfigurations"> - <ProjectConfiguration Include="Debug|Win32"> - <Configuration>Debug</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - <ProjectConfiguration Include="Release|Win32"> - <Configuration>Release</Configuration> - <Platform>Win32</Platform> - </ProjectConfiguration> - </ItemGroup> - <PropertyGroup Label="Globals"> - <ProjectName>libhts</ProjectName> - <ProjectGuid>{00700E12-A63B-4E54-B962-4011A90584BD}</ProjectGuid> - <RootNamespace>libhts</RootNamespace> - <Keyword>Win32Proj</Keyword> - </PropertyGroup> - <Import Project="$(SolutionDir)\XBMC.core-defaults.props" /> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>false</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - <WholeProgramOptimization>true</WholeProgramOptimization> - </PropertyGroup> - <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> - <ConfigurationType>StaticLibrary</ConfigurationType> - <UseDebugLibraries>true</UseDebugLibraries> - <CharacterSet>Unicode</CharacterSet> - </PropertyGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> - <ImportGroup Label="ExtensionSettings"> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(SolutionDir)\XBMC.defaults.props" /> - </ImportGroup> - <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets"> - <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> - <Import Project="$(SolutionDir)\XBMC.defaults.props" /> - </ImportGroup> - <PropertyGroup Label="UserMacros" /> - <PropertyGroup> - <_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)libs\$(TargetName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(SolutionDir)objs\$(TargetName)\$(Configuration)\</IntDir> - <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)libs\$(TargetName)\$(Configuration)\</OutDir> - <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(SolutionDir)objs\$(TargetName)\$(Configuration)\</IntDir> - </PropertyGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;_SECURE_SCL=0;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Lib> - <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> - </Lib> - </ItemDefinitionGroup> - <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'"> - <ClCompile> - <AdditionalIncludeDirectories>$(ProjectDir)include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> - <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> - <ExceptionHandling> - </ExceptionHandling> - <PrecompiledHeader> - </PrecompiledHeader> - </ClCompile> - <Lib> - <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries> - </Lib> - </ItemDefinitionGroup> - <ItemGroup> - <ClInclude Include="..\hts_strtab.h" /> - <ClInclude Include="..\htsatomic.h" /> - <ClInclude Include="..\htsbuf.h" /> - <ClInclude Include="..\htsmsg.h" /> - <ClInclude Include="..\htsmsg_binary.h" /> - <ClInclude Include="..\htsq.h" /> - <ClInclude Include="..\htsstr.h" /> - <ClInclude Include="include\msvc.h" /> - <ClInclude Include="..\net.h" /> - <ClInclude Include="..\sha1.h" /> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\htsatomic.c" /> - <ClCompile Include="..\htsbuf.c" /> - <ClCompile Include="..\htsmsg.c" /> - <ClCompile Include="..\htsmsg_binary.c" /> - <ClCompile Include="..\htsstr.c" /> - <ClCompile Include="..\net_winsock.c" /> - <ClCompile Include="..\sha1.c" /> - </ItemGroup> - <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> - <ImportGroup Label="ExtensionTargets"> - </ImportGroup> -</Project>
\ No newline at end of file diff --git a/lib/libhts/Win32/libhts_2010.vcxproj.filters b/lib/libhts/Win32/libhts_2010.vcxproj.filters deleted file mode 100644 index a4be5cadf0..0000000000 --- a/lib/libhts/Win32/libhts_2010.vcxproj.filters +++ /dev/null @@ -1,64 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <Filter Include="Source Files"> - <UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier> - <Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions> - </Filter> - </ItemGroup> - <ItemGroup> - <ClInclude Include="..\hts_strtab.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\htsatomic.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\htsbuf.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\htsmsg.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\htsmsg_binary.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\htsq.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\htsstr.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="include\msvc.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\net.h"> - <Filter>Source Files</Filter> - </ClInclude> - <ClInclude Include="..\sha1.h"> - <Filter>Source Files</Filter> - </ClInclude> - </ItemGroup> - <ItemGroup> - <ClCompile Include="..\htsatomic.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\htsbuf.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\htsmsg.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\htsmsg_binary.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\htsstr.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\net_winsock.c"> - <Filter>Source Files</Filter> - </ClCompile> - <ClCompile Include="..\sha1.c"> - <Filter>Source Files</Filter> - </ClCompile> - </ItemGroup> -</Project>
\ No newline at end of file diff --git a/lib/libhts/hts_strtab.h b/lib/libhts/hts_strtab.h deleted file mode 100644 index 706c611da6..0000000000 --- a/lib/libhts/hts_strtab.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * tvheadend - * Copyright (C) 2007 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef STRTAB_H_ -#define STRTAB_H_ - -#include <strings.h> - -struct strtab { - const char *str; - int val; -}; - -static int str2val0(const char *str, struct strtab tab[], int l) - __attribute((unused)); - -static int -str2val0(const char *str, struct strtab tab[], int l) -{ - int i; - for(i = 0; i < l; i++) - if(!strcasecmp(str, tab[i].str)) - return tab[i].val; - - return -1; -} - -#define str2val(str, tab) str2val0(str, tab, sizeof(tab) / sizeof(tab[0])) - -static const char * val2str0(int val, struct strtab tab[], int l) - __attribute__((unused)); - -static const char * -val2str0(int val, struct strtab tab[], int l) -{ - int i; - for(i = 0; i < l; i++) - if(tab[i].val == val) - return tab[i].str; - return NULL; -} - -#define val2str(val, tab) val2str0(val, tab, sizeof(tab) / sizeof(tab[0])) - -#endif /* STRTAB_H_ */ diff --git a/lib/libhts/htsatomic.c b/lib/libhts/htsatomic.c deleted file mode 100644 index 8583b4e89d..0000000000 --- a/lib/libhts/htsatomic.c +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Atomic ops - * Copyright (C) 2008 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -/* Nothing here yet */ diff --git a/lib/libhts/htsatomic.h b/lib/libhts/htsatomic.h deleted file mode 100644 index 62fb5f8fc6..0000000000 --- a/lib/libhts/htsatomic.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Atomic ops - * Copyright (C) 2008 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef HTSATOMIC_H__ -#define HTSATOMIC_H__ - -/** - * Atomically add 'incr' to *ptr and return the previous value - */ -#if defined(__i386__) || defined(__x86_64__) -static inline int -atomic_add(volatile int *ptr, int incr) -{ - int r; - asm volatile("lock; xaddl %0, %1" : - "=r"(r), "=m"(*ptr) : "0" (incr), "m" (*ptr) : "memory"); - return r; -} -#endif - -#endif /* HTSATOMIC_H__ */ diff --git a/lib/libhts/htsbuf.c b/lib/libhts/htsbuf.c deleted file mode 100644 index 09ec334486..0000000000 --- a/lib/libhts/htsbuf.c +++ /dev/null @@ -1,255 +0,0 @@ -/* - * Buffer management functions - * Copyright (C) 2008 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <assert.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include "htsbuf.h" -#ifdef _MSC_VER -#include "msvc.h" -#endif - -#ifndef MIN -#define MIN(a, b) ((a) < (b) ? (a) : (b)) -#endif - -#ifndef MAX -#define MAX(a, b) ((a) > (b) ? (a) : (b)) -#endif - - -/** - * - */ -void -htsbuf_queue_init(htsbuf_queue_t *hq, unsigned int maxsize) -{ - if(maxsize == 0) - maxsize = INT32_MAX; - TAILQ_INIT(&hq->hq_q); - hq->hq_size = 0; - hq->hq_maxsize = maxsize; -} - - -/** - * - */ -void -htsbuf_data_free(htsbuf_queue_t *hq, htsbuf_data_t *hd) -{ - TAILQ_REMOVE(&hq->hq_q, hd, hd_link); - free(hd->hd_data); - free(hd); -} - - -/** - * - */ -void -htsbuf_queue_flush(htsbuf_queue_t *hq) -{ - htsbuf_data_t *hd; - - hq->hq_size = 0; - - while((hd = TAILQ_FIRST(&hq->hq_q)) != NULL) - htsbuf_data_free(hq, hd); -} - -/** - * - */ -void -htsbuf_append(htsbuf_queue_t *hq, const char *buf, size_t len) -{ - htsbuf_data_t *hd = TAILQ_LAST(&hq->hq_q, htsbuf_data_queue); - int c; - hq->hq_size += len; - - if(hd != NULL) { - /* Fill out any previous buffer */ - c = MIN(hd->hd_data_size - hd->hd_data_len, len); - memcpy(hd->hd_data + hd->hd_data_len, buf, c); - hd->hd_data_len += c; - buf += c; - len -= c; - } - if(len == 0) - return; - - hd = malloc(sizeof(htsbuf_data_t)); - TAILQ_INSERT_TAIL(&hq->hq_q, hd, hd_link); - - c = MAX(len, 1000); /* Allocate 1000 bytes to support lots of small writes */ - - hd->hd_data = malloc(c); - hd->hd_data_size = c; - hd->hd_data_len = len; - hd->hd_data_off = 0; - memcpy(hd->hd_data, buf, len); -} - -/** - * - */ -void -htsbuf_append_prealloc(htsbuf_queue_t *hq, const char *buf, size_t len) -{ - htsbuf_data_t *hd; - - hq->hq_size += len; - - hd = malloc(sizeof(htsbuf_data_t)); - TAILQ_INSERT_TAIL(&hq->hq_q, hd, hd_link); - - hd->hd_data = (void *)buf; - hd->hd_data_size = len; - hd->hd_data_len = len; - hd->hd_data_off = 0; -} - -/** - * - */ -size_t -htsbuf_read(htsbuf_queue_t *hq, char *buf, size_t len) -{ - size_t r = 0; - int c; - - htsbuf_data_t *hd; - - while(len > 0) { - hd = TAILQ_FIRST(&hq->hq_q); - if(hd == NULL) - break; - - c = MIN(hd->hd_data_len - hd->hd_data_off, len); - memcpy(buf, hd->hd_data + hd->hd_data_off, c); - - r += c; - buf += c; - len -= c; - hd->hd_data_off += c; - hq->hq_size -= c; - if(hd->hd_data_off == hd->hd_data_len) - htsbuf_data_free(hq, hd); - } - return r; -} - - -/** - * - */ -size_t -htsbuf_find(htsbuf_queue_t *hq, uint8_t v) -{ - htsbuf_data_t *hd; - unsigned int i, o = 0; - - TAILQ_FOREACH(hd, &hq->hq_q, hd_link) { - for(i = hd->hd_data_off; i < hd->hd_data_len; i++) { - if(hd->hd_data[i] == v) - return o + i - hd->hd_data_off; - } - o += hd->hd_data_len - hd->hd_data_off; - } - return -1; -} - - - -/** - * - */ -size_t -htsbuf_peek(htsbuf_queue_t *hq, char *buf, size_t len) -{ - size_t r = 0; - int c; - - htsbuf_data_t *hd = TAILQ_FIRST(&hq->hq_q); - - while(len > 0 && hd != NULL) { - c = MIN(hd->hd_data_len - hd->hd_data_off, len); - memcpy(buf, hd->hd_data + hd->hd_data_off, c); - - buf += c; - len -= c; - - hd = TAILQ_NEXT(hd, hd_link); - } - return r; -} - -/** - * - */ -size_t -htsbuf_drop(htsbuf_queue_t *hq, size_t len) -{ - size_t r = 0; - int c; - htsbuf_data_t *hd; - - while(len > 0) { - hd = TAILQ_FIRST(&hq->hq_q); - if(hd == NULL) - break; - - c = MIN(hd->hd_data_len - hd->hd_data_off, len); - len -= c; - hd->hd_data_off += c; - - if(hd->hd_data_off == hd->hd_data_len) - htsbuf_data_free(hq, hd); - } - return r; -} - -/** - * - */ -void -htsbuf_vqprintf(htsbuf_queue_t *hq, const char *fmt, va_list ap) -{ - char buf[5000]; - htsbuf_append(hq, buf, vsnprintf(buf, sizeof(buf), fmt, ap)); -} - - -/** - * - */ -void -htsbuf_qprintf(htsbuf_queue_t *hq, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - htsbuf_vqprintf(hq, fmt, ap); - va_end(ap); -} - - diff --git a/lib/libhts/htsbuf.h b/lib/libhts/htsbuf.h deleted file mode 100644 index 2ef22100ba..0000000000 --- a/lib/libhts/htsbuf.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Buffer management functions - * Copyright (C) 2008 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef HTSBUF_H__ -#define HTSBUF_H__ - -#include <stdarg.h> -#include "htsq.h" -#include <inttypes.h> - -TAILQ_HEAD(htsbuf_data_queue, htsbuf_data); - -typedef struct htsbuf_data { - TAILQ_ENTRY(htsbuf_data) hd_link; - uint8_t *hd_data; - unsigned int hd_data_size; /* Size of allocation hb_data */ - unsigned int hd_data_len; /* Number of valid bytes from hd_data */ - unsigned int hd_data_off; /* Offset in data, used for partial writes */ -} htsbuf_data_t; - -typedef struct htsbuf_queue { - struct htsbuf_data_queue hq_q; - unsigned int hq_size; - unsigned int hq_maxsize; -} htsbuf_queue_t; - -void htsbuf_queue_init(htsbuf_queue_t *hq, unsigned int maxsize); - -void htsbuf_queue_flush(htsbuf_queue_t *hq); - -void htsbuf_vqprintf(htsbuf_queue_t *hq, const char *fmt, va_list ap); - -void htsbuf_qprintf(htsbuf_queue_t *hq, const char *fmt, ...); - -void htsbuf_append(htsbuf_queue_t *hq, const char *buf, size_t len); - -void htsbuf_append_prealloc(htsbuf_queue_t *hq, const char *buf, size_t len); - -void htsbuf_data_free(htsbuf_queue_t *hq, htsbuf_data_t *hd); - -size_t htsbuf_read(htsbuf_queue_t *hq, char *buf, size_t len); - -size_t htsbuf_peek(htsbuf_queue_t *hq, char *buf, size_t len); - -size_t htsbuf_drop(htsbuf_queue_t *hq, size_t len); - -size_t htsbuf_find(htsbuf_queue_t *hq, uint8_t v); - -#endif /* HTSBUF_H__ */ diff --git a/lib/libhts/htsmsg.c b/lib/libhts/htsmsg.c deleted file mode 100644 index 3d5c316d02..0000000000 --- a/lib/libhts/htsmsg.c +++ /dev/null @@ -1,578 +0,0 @@ -/* - * Functions for manipulating HTS messages - * Copyright (C) 2007 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <assert.h> -#include <sys/types.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <stdarg.h> -#include <string.h> - -#ifdef _MSC_VER -#include "msvc.h" -#endif - -#include "htsmsg.h" - -static void htsmsg_clear(htsmsg_t *msg); - -/* - * - */ -static void -htsmsg_field_destroy(htsmsg_t *msg, htsmsg_field_t *f) -{ - TAILQ_REMOVE(&msg->hm_fields, f, hmf_link); - - switch(f->hmf_type) { - case HMF_MAP: - case HMF_LIST: - htsmsg_clear(&f->hmf_msg); - break; - - case HMF_STR: - if(f->hmf_flags & HMF_ALLOCED) - free((void *)f->hmf_str); - break; - - case HMF_BIN: - if(f->hmf_flags & HMF_ALLOCED) - free((void *)f->hmf_bin); - break; - default: - break; - } - if(f->hmf_flags & HMF_NAME_ALLOCED) - free((void *)f->hmf_name); - free(f); -} - -/* - * - */ -static void -htsmsg_clear(htsmsg_t *msg) -{ - htsmsg_field_t *f; - - while((f = TAILQ_FIRST(&msg->hm_fields)) != NULL) - htsmsg_field_destroy(msg, f); -} - - - -/* - * - */ -htsmsg_field_t * -htsmsg_field_add(htsmsg_t *msg, const char *name, int type, int flags) -{ - htsmsg_field_t *f = malloc(sizeof(htsmsg_field_t)); - - TAILQ_INSERT_TAIL(&msg->hm_fields, f, hmf_link); - - if(msg->hm_islist) { - assert(name == NULL); - } else { - assert(name != NULL); - } - - if(flags & HMF_NAME_ALLOCED) - f->hmf_name = name ? strdup(name) : NULL; - else - f->hmf_name = name; - - f->hmf_type = type; - f->hmf_flags = flags; - return f; -} - - -/* - * - */ -static htsmsg_field_t * -htsmsg_field_find(htsmsg_t *msg, const char *name) -{ - htsmsg_field_t *f; - - TAILQ_FOREACH(f, &msg->hm_fields, hmf_link) { - if(f->hmf_name != NULL && !strcmp(f->hmf_name, name)) - return f; - } - return NULL; -} - - - -/** - * - */ -int -htsmsg_delete_field(htsmsg_t *msg, const char *name) -{ - htsmsg_field_t *f; - - if((f = htsmsg_field_find(msg, name)) == NULL) - return HTSMSG_ERR_FIELD_NOT_FOUND; - htsmsg_field_destroy(msg, f); - return 0; -} - - -/* - * - */ -htsmsg_t * -htsmsg_create_map(void) -{ - htsmsg_t *msg; - - msg = malloc(sizeof(htsmsg_t)); - TAILQ_INIT(&msg->hm_fields); - msg->hm_data = NULL; - msg->hm_islist = 0; - return msg; -} - -/* - * - */ -htsmsg_t * -htsmsg_create_list(void) -{ - htsmsg_t *msg; - - msg = malloc(sizeof(htsmsg_t)); - TAILQ_INIT(&msg->hm_fields); - msg->hm_data = NULL; - msg->hm_islist = 1; - return msg; -} - - -/* - * - */ -void -htsmsg_destroy(htsmsg_t *msg) -{ - if(msg == NULL) - return; - - htsmsg_clear(msg); - free((void *)msg->hm_data); - free(msg); -} - -/* - * - */ -void -htsmsg_add_u32(htsmsg_t *msg, const char *name, uint32_t u32) -{ - htsmsg_field_t *f = htsmsg_field_add(msg, name, HMF_S64, HMF_NAME_ALLOCED); - f->hmf_s64 = u32; -} - -/* - * - */ -void -htsmsg_add_s64(htsmsg_t *msg, const char *name, int64_t s64) -{ - htsmsg_field_t *f = htsmsg_field_add(msg, name, HMF_S64, HMF_NAME_ALLOCED); - f->hmf_s64 = s64; -} - -/* - * - */ -void -htsmsg_add_s32(htsmsg_t *msg, const char *name, int32_t s32) -{ - htsmsg_field_t *f = htsmsg_field_add(msg, name, HMF_S64, HMF_NAME_ALLOCED); - f->hmf_s64 = s32; -} - - - -/* - * - */ -void -htsmsg_add_str(htsmsg_t *msg, const char *name, const char *str) -{ - htsmsg_field_t *f = htsmsg_field_add(msg, name, HMF_STR, - HMF_ALLOCED | HMF_NAME_ALLOCED); - f->hmf_str = strdup(str); -} - -/* - * - */ -void -htsmsg_add_bin(htsmsg_t *msg, const char *name, const void *bin, size_t len) -{ - htsmsg_field_t *f = htsmsg_field_add(msg, name, HMF_BIN, - HMF_ALLOCED | HMF_NAME_ALLOCED); - void *v; - f->hmf_bin = v = malloc(len); - f->hmf_binsize = len; - memcpy(v, bin, len); -} - -/* - * - */ -void -htsmsg_add_binptr(htsmsg_t *msg, const char *name, const void *bin, size_t len) -{ - htsmsg_field_t *f = htsmsg_field_add(msg, name, HMF_BIN, HMF_NAME_ALLOCED); - f->hmf_bin = bin; - f->hmf_binsize = len; -} - - -/* - * - */ -void -htsmsg_add_msg(htsmsg_t *msg, const char *name, htsmsg_t *sub) -{ - htsmsg_field_t *f; - - f = htsmsg_field_add(msg, name, sub->hm_islist ? HMF_LIST : HMF_MAP, - HMF_NAME_ALLOCED); - - assert(sub->hm_data == NULL); - TAILQ_MOVE(&f->hmf_msg.hm_fields, &sub->hm_fields, hmf_link); - free(sub); -} - - - -/* - * - */ -void -htsmsg_add_msg_extname(htsmsg_t *msg, const char *name, htsmsg_t *sub) -{ - htsmsg_field_t *f; - - f = htsmsg_field_add(msg, name, sub->hm_islist ? HMF_LIST : HMF_MAP, 0); - - assert(sub->hm_data == NULL); - TAILQ_MOVE(&f->hmf_msg.hm_fields, &sub->hm_fields, hmf_link); - free(sub); -} - - - -/** - * - */ -int -htsmsg_get_s64(htsmsg_t *msg, const char *name, int64_t *s64p) -{ - htsmsg_field_t *f; - - if((f = htsmsg_field_find(msg, name)) == NULL) - return HTSMSG_ERR_FIELD_NOT_FOUND; - - switch(f->hmf_type) { - default: - return HTSMSG_ERR_CONVERSION_IMPOSSIBLE; - case HMF_STR: - *s64p = strtoll(f->hmf_str, NULL, 0); - break; - case HMF_S64: - *s64p = f->hmf_s64; - break; - } - return 0; -} - - -/* - * - */ -int -htsmsg_get_u32(htsmsg_t *msg, const char *name, uint32_t *u32p) -{ - int r; - int64_t s64; - - if((r = htsmsg_get_s64(msg, name, &s64)) != 0) - return r; - - if(s64 < 0 || s64 > 0xffffffffLL) - return HTSMSG_ERR_CONVERSION_IMPOSSIBLE; - - *u32p = (uint32_t)s64; - return 0; -} - -/** - * - */ -int -htsmsg_get_u32_or_default(htsmsg_t *msg, const char *name, uint32_t def) -{ - uint32_t u32; - return htsmsg_get_u32(msg, name, &u32) ? def : u32; -} - - - -/* - * - */ -int -htsmsg_get_s32(htsmsg_t *msg, const char *name, int32_t *s32p) -{ - int r; - int64_t s64; - - if((r = htsmsg_get_s64(msg, name, &s64)) != 0) - return r; - - if(s64 < -0x80000000LL || s64 > 0x7fffffffLL) - return HTSMSG_ERR_CONVERSION_IMPOSSIBLE; - - *s32p = (int32_t)s64; - return 0; -} - - -/* - * - */ -int -htsmsg_get_bin(htsmsg_t *msg, const char *name, const void **binp, - size_t *lenp) -{ - htsmsg_field_t *f; - - if((f = htsmsg_field_find(msg, name)) == NULL) - return HTSMSG_ERR_FIELD_NOT_FOUND; - - if(f->hmf_type != HMF_BIN) - return HTSMSG_ERR_CONVERSION_IMPOSSIBLE; - - *binp = f->hmf_bin; - *lenp = f->hmf_binsize; - return 0; -} - -/** - * - */ -const char * -htsmsg_field_get_string(htsmsg_field_t *f) -{ - char buf[40]; - - switch(f->hmf_type) { - default: - return NULL; - case HMF_STR: - break; - case HMF_S64: - snprintf(buf, sizeof(buf), "%"PRId64, f->hmf_s64); - f->hmf_str = strdup(buf); - f->hmf_type = HMF_STR; - break; - } - return f->hmf_str; -} - -/* - * - */ -const char * -htsmsg_get_str(htsmsg_t *msg, const char *name) -{ - htsmsg_field_t *f; - - if((f = htsmsg_field_find(msg, name)) == NULL) - return NULL; - return htsmsg_field_get_string(f); - -} - -/* - * - */ -htsmsg_t * -htsmsg_get_map(htsmsg_t *msg, const char *name) -{ - htsmsg_field_t *f; - - if((f = htsmsg_field_find(msg, name)) == NULL || f->hmf_type != HMF_MAP) - return NULL; - - return &f->hmf_msg; -} - -/** - * - */ -htsmsg_t * -htsmsg_get_map_multi(htsmsg_t *msg, ...) -{ - va_list ap; - const char *n; - va_start(ap, msg); - - while(msg != NULL && (n = va_arg(ap, char *)) != NULL) - msg = htsmsg_get_map(msg, n); - return msg; -} - -/* - * - */ -htsmsg_t * -htsmsg_get_list(htsmsg_t *msg, const char *name) -{ - htsmsg_field_t *f; - - if((f = htsmsg_field_find(msg, name)) == NULL || f->hmf_type != HMF_LIST) - return NULL; - - return &f->hmf_msg; -} - -/** - * - */ -htsmsg_t * -htsmsg_detach_submsg(htsmsg_field_t *f) -{ - htsmsg_t *r = htsmsg_create_map(); - - TAILQ_MOVE(&r->hm_fields, &f->hmf_msg.hm_fields, hmf_link); - TAILQ_INIT(&f->hmf_msg.hm_fields); - r->hm_islist = f->hmf_type == HMF_LIST; - return r; -} - - -/* - * - */ -static void -htsmsg_print0(htsmsg_t *msg, int indent) -{ - htsmsg_field_t *f; - int i; - - TAILQ_FOREACH(f, &msg->hm_fields, hmf_link) { - - for(i = 0; i < indent; i++) printf("\t"); - - printf("%s (", f->hmf_name ? f->hmf_name : ""); - - switch(f->hmf_type) { - - case HMF_MAP: - printf("MAP) = {\n"); - htsmsg_print0(&f->hmf_msg, indent + 1); - for(i = 0; i < indent; i++) printf("\t"); printf("}\n"); - break; - - case HMF_LIST: - printf("LIST) = {\n"); - htsmsg_print0(&f->hmf_msg, indent + 1); - for(i = 0; i < indent; i++) printf("\t"); printf("}\n"); - break; - - case HMF_STR: - printf("STR) = \"%s\"\n", f->hmf_str); - break; - - case HMF_BIN: - printf("BIN) = ["); - for(i = 0; i < (int)f->hmf_binsize - 1; i++) - printf("%02x.", ((uint8_t *)f->hmf_bin)[i]); - printf("%02x]\n", ((uint8_t *)f->hmf_bin)[i]); - break; - - case HMF_S64: - printf("S64) = %" PRId64 "\n", f->hmf_s64); - break; - } - } -} - -/* - * - */ -void -htsmsg_print(htsmsg_t *msg) -{ - htsmsg_print0(msg, 0); -} - - -/** - * - */ -static void -htsmsg_copy_i(htsmsg_t *src, htsmsg_t *dst) -{ - htsmsg_field_t *f; - htsmsg_t *sub; - - TAILQ_FOREACH(f, &src->hm_fields, hmf_link) { - - switch(f->hmf_type) { - - case HMF_MAP: - case HMF_LIST: - sub = f->hmf_type == HMF_LIST ? - htsmsg_create_list() : htsmsg_create_map(); - htsmsg_copy_i(&f->hmf_msg, sub); - htsmsg_add_msg(dst, f->hmf_name, sub); - break; - - case HMF_STR: - htsmsg_add_str(dst, f->hmf_name, f->hmf_str); - break; - - case HMF_S64: - htsmsg_add_s64(dst, f->hmf_name, f->hmf_s64); - break; - - case HMF_BIN: - htsmsg_add_bin(dst, f->hmf_name, f->hmf_bin, f->hmf_binsize); - break; - } - } -} - -htsmsg_t * -htsmsg_copy(htsmsg_t *src) -{ - htsmsg_t *dst = src->hm_islist ? htsmsg_create_list() : htsmsg_create_map(); - htsmsg_copy_i(src, dst); - return dst; -} diff --git a/lib/libhts/htsmsg.h b/lib/libhts/htsmsg.h deleted file mode 100644 index a39883cf0e..0000000000 --- a/lib/libhts/htsmsg.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Functions for manipulating HTS messages - * Copyright (C) 2007 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef HTSMSG_H_ -#define HTSMSG_H_ - -#include <inttypes.h> -#include "htsq.h" - -#define HTSMSG_ERR_FIELD_NOT_FOUND -1 -#define HTSMSG_ERR_CONVERSION_IMPOSSIBLE -2 - -TAILQ_HEAD(htsmsg_field_queue, htsmsg_field); - -typedef struct htsmsg { - /** - * fields - */ - struct htsmsg_field_queue hm_fields; - - /** - * Set if this message is a list, otherwise it is a map. - */ - int hm_islist; - - /** - * Data to be free'd when the message is destroyed - */ - const void *hm_data; -} htsmsg_t; - - -#define HMF_MAP 1 -#define HMF_S64 2 -#define HMF_STR 3 -#define HMF_BIN 4 -#define HMF_LIST 5 - -typedef struct htsmsg_field { - TAILQ_ENTRY(htsmsg_field) hmf_link; - const char *hmf_name; - uint8_t hmf_type; - uint8_t hmf_flags; - -#define HMF_ALLOCED 0x1 -#define HMF_NAME_ALLOCED 0x2 - - union { - int64_t s64; - const char *str; - struct { - const char *data; - size_t len; - } bin; - htsmsg_t msg; - } u; -} htsmsg_field_t; - -#define hmf_s64 u.s64 -#define hmf_msg u.msg -#define hmf_str u.str -#define hmf_bin u.bin.data -#define hmf_binsize u.bin.len - -#define htsmsg_get_map_by_field(f) \ - ((f)->hmf_type == HMF_MAP ? &(f)->hmf_msg : NULL) - -#define HTSMSG_FOREACH(f, msg) TAILQ_FOREACH(f, &(msg)->hm_fields, hmf_link) - -/** - * Create a new map - */ -htsmsg_t *htsmsg_create_map(void); - -/** - * Create a new list - */ -htsmsg_t *htsmsg_create_list(void); - -/** - * Destroys a message (map or list) - */ -void htsmsg_destroy(htsmsg_t *msg); - -/** - * Add an integer field where source is unsigned 32 bit. - */ -void htsmsg_add_u32(htsmsg_t *msg, const char *name, uint32_t u32); - -/** - * Add an integer field where source is signed 32 bit. - */ -void htsmsg_add_s32(htsmsg_t *msg, const char *name, int32_t s32); - -/** - * Add an integer field where source is signed 64 bit. - */ -void htsmsg_add_s64(htsmsg_t *msg, const char *name, int64_t s64); - -/** - * Add a string field. - */ -void htsmsg_add_str(htsmsg_t *msg, const char *name, const char *str); - -/** - * Add an field where source is a list or map message. - */ -void htsmsg_add_msg(htsmsg_t *msg, const char *name, htsmsg_t *sub); - -/** - * Add an field where source is a list or map message. - * - * This function will not strdup() \p name but relies on the caller - * to keep the string allocated for as long as the message is valid. - */ -void htsmsg_add_msg_extname(htsmsg_t *msg, const char *name, htsmsg_t *sub); - -/** - * Add an binary field. The data is copied to a malloced storage - */ -void htsmsg_add_bin(htsmsg_t *msg, const char *name, const void *bin, - size_t len); - -/** - * Add an binary field. The data is not copied, instead the caller - * is responsible for keeping the data valid for as long as the message - * is around. - */ -void htsmsg_add_binptr(htsmsg_t *msg, const char *name, const void *bin, - size_t len); - -/** - * Get an integer as an unsigned 32 bit integer. - * - * @return HTSMSG_ERR_FIELD_NOT_FOUND - Field does not exist - * HTSMSG_ERR_CONVERSION_IMPOSSIBLE - Field is not an integer or - * out of range for the requested storage. - */ -int htsmsg_get_u32(htsmsg_t *msg, const char *name, uint32_t *u32p); - -/** - * Get an integer as an signed 32 bit integer. - * - * @return HTSMSG_ERR_FIELD_NOT_FOUND - Field does not exist - * HTSMSG_ERR_CONVERSION_IMPOSSIBLE - Field is not an integer or - * out of range for the requested storage. - */ -int htsmsg_get_s32(htsmsg_t *msg, const char *name, int32_t *s32p); - -/** - * Get an integer as an signed 64 bit integer. - * - * @return HTSMSG_ERR_FIELD_NOT_FOUND - Field does not exist - * HTSMSG_ERR_CONVERSION_IMPOSSIBLE - Field is not an integer or - * out of range for the requested storage. - */ -int htsmsg_get_s64(htsmsg_t *msg, const char *name, int64_t *s64p); - -/** - * Get pointer to a binary field. No copying of data is performed. - * - * @param binp Pointer to a void * that will be filled in with a pointer - * to the data - * @param lenp Pointer to a size_t that will be filled with the size of - * the data - * - * @return HTSMSG_ERR_FIELD_NOT_FOUND - Field does not exist - * HTSMSG_ERR_CONVERSION_IMPOSSIBLE - Field is not a binary blob. - */ -int htsmsg_get_bin(htsmsg_t *msg, const char *name, const void **binp, - size_t *lenp); - -/** - * Get a field of type 'list'. No copying is done. - * - * @return NULL if the field can not be found or not of list type. - * Otherwise a htsmsg is returned. - */ -htsmsg_t *htsmsg_get_list(htsmsg_t *msg, const char *name); - -/** - * Get a field of type 'string'. No copying is done. - * - * @return NULL if the field can not be found or not of string type. - * Otherwise a pointer to the data is returned. - */ -const char *htsmsg_get_str(htsmsg_t *msg, const char *name); - -/** - * Get a field of type 'map'. No copying is done. - * - * @return NULL if the field can not be found or not of map type. - * Otherwise a htsmsg is returned. - */ -htsmsg_t *htsmsg_get_map(htsmsg_t *msg, const char *name); - -/** - * Traverse a hierarchy of htsmsg's to find a specific child. - */ -htsmsg_t *htsmsg_get_map_multi(htsmsg_t *msg, ...); - -/** - * Given the field \p f, return a string if it is of type string, otherwise - * return NULL - */ -const char *htsmsg_field_get_string(htsmsg_field_t *f); - -/** - * Return the field \p name as an u32. - * - * @return An unsigned 32 bit integer or NULL if the field can not be found - * or if conversion is not possible. - */ -int htsmsg_get_u32_or_default(htsmsg_t *msg, const char *name, uint32_t def); - -/** - * Remove the given field called \p name from the message \p msg. - */ -int htsmsg_delete_field(htsmsg_t *msg, const char *name); - -/** - * Detach will remove the given field (and only if it is a list or map) - * from the message and make it a 'standalone message'. This means - * the the contents of the sub message will stay valid if the parent is - * destroyed. The caller is responsible for freeing this new message. - */ -htsmsg_t *htsmsg_detach_submsg(htsmsg_field_t *f); - -/** - * Print a message to stdout. - */ -void htsmsg_print(htsmsg_t *msg); - -/** - * Create a new field. Primarily intended for htsmsg internal functions. - */ -htsmsg_field_t *htsmsg_field_add(htsmsg_t *msg, const char *name, - int type, int flags); - -/** - * Clone a message. - */ -htsmsg_t *htsmsg_copy(htsmsg_t *src); - -#define HTSMSG_FOREACH(f, msg) TAILQ_FOREACH(f, &(msg)->hm_fields, hmf_link) - -#endif /* HTSMSG_H_ */ diff --git a/lib/libhts/htsmsg_binary.c b/lib/libhts/htsmsg_binary.c deleted file mode 100644 index a5539765b4..0000000000 --- a/lib/libhts/htsmsg_binary.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * Functions converting HTSMSGs to/from a simple binary format - * Copyright (C) 2007 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <assert.h> -#include <sys/types.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> - -#include "htsmsg_binary.h" - -/* - * - */ -static int -htsmsg_binary_des0(htsmsg_t *msg, const uint8_t *buf, size_t len) -{ - unsigned type, namelen, datalen; - htsmsg_field_t *f; - htsmsg_t *sub; - char *n; - uint64_t u64; - int i; - - while(len > 5) { - - type = buf[0]; - namelen = buf[1]; - datalen = (buf[2] << 24) | - (buf[3] << 16) | - (buf[4] << 8 ) | - (buf[5] ); - - buf += 6; - len -= 6; - - if(len < namelen + datalen) - return -1; - - f = malloc(sizeof(htsmsg_field_t)); - f->hmf_type = type; - - if(namelen > 0) { - n = malloc(namelen + 1); - memcpy(n, buf, namelen); - n[namelen] = 0; - - buf += namelen; - len -= namelen; - f->hmf_flags = HMF_NAME_ALLOCED; - - } else { - n = NULL; - f->hmf_flags = 0; - } - - f->hmf_name = n; - - switch(type) { - case HMF_STR: - f->hmf_str = n = malloc(datalen + 1); - memcpy(n, buf, datalen); - n[datalen] = 0; - f->hmf_flags |= HMF_ALLOCED; - break; - - case HMF_BIN: - f->hmf_bin = (const void *)buf; - f->hmf_binsize = datalen; - break; - - case HMF_S64: - u64 = 0; - for(i = datalen - 1; i >= 0; i--) - u64 = (u64 << 8) | buf[i]; - f->hmf_s64 = u64; - break; - - case HMF_MAP: - case HMF_LIST: - sub = &f->hmf_msg; - TAILQ_INIT(&sub->hm_fields); - sub->hm_data = NULL; - if(htsmsg_binary_des0(sub, buf, datalen) < 0) - return -1; - break; - - default: - free(n); - free(f); - return -1; - } - - TAILQ_INSERT_TAIL(&msg->hm_fields, f, hmf_link); - buf += datalen; - len -= datalen; - } - return 0; -} - - - -/* - * - */ -htsmsg_t * -htsmsg_binary_deserialize(const void *data, size_t len, const void *buf) -{ - htsmsg_t *msg = htsmsg_create_map(); - msg->hm_data = buf; - - if(htsmsg_binary_des0(msg, data, len) < 0) { - htsmsg_destroy(msg); - return NULL; - } - return msg; -} - - - -/* - * - */ -static size_t -htsmsg_binary_count(htsmsg_t *msg) -{ - htsmsg_field_t *f; - size_t len = 0; - uint64_t u64; - - TAILQ_FOREACH(f, &msg->hm_fields, hmf_link) { - - len += 6; - len += f->hmf_name ? strlen(f->hmf_name) : 0; - - switch(f->hmf_type) { - case HMF_MAP: - case HMF_LIST: - len += htsmsg_binary_count(&f->hmf_msg); - break; - - case HMF_STR: - len += strlen(f->hmf_str); - break; - - case HMF_BIN: - len += f->hmf_binsize; - break; - - case HMF_S64: - u64 = f->hmf_s64; - while(u64 != 0) { - len++; - u64 = u64 >> 8; - } - break; - } - } - return len; -} - - -/* - * - */ -static void -htsmsg_binary_write(htsmsg_t *msg, uint8_t *ptr) -{ - htsmsg_field_t *f; - uint64_t u64; - int l, i, namelen; - - TAILQ_FOREACH(f, &msg->hm_fields, hmf_link) { - namelen = f->hmf_name ? strlen(f->hmf_name) : 0; - *ptr++ = f->hmf_type; - *ptr++ = namelen; - - switch(f->hmf_type) { - case HMF_MAP: - case HMF_LIST: - l = htsmsg_binary_count(&f->hmf_msg); - break; - - case HMF_STR: - l = strlen(f->hmf_str); - break; - - case HMF_BIN: - l = f->hmf_binsize; - break; - - case HMF_S64: - u64 = f->hmf_s64; - l = 0; - while(u64 != 0) { - l++; - u64 = u64 >> 8; - } - break; - default: - abort(); - } - - - *ptr++ = l >> 24; - *ptr++ = l >> 16; - *ptr++ = l >> 8; - *ptr++ = l; - - if(namelen > 0) { - memcpy(ptr, f->hmf_name, namelen); - ptr += namelen; - } - - switch(f->hmf_type) { - case HMF_MAP: - case HMF_LIST: - htsmsg_binary_write(&f->hmf_msg, ptr); - break; - - case HMF_STR: - memcpy(ptr, f->hmf_str, l); - break; - - case HMF_BIN: - memcpy(ptr, f->hmf_bin, l); - break; - - case HMF_S64: - u64 = f->hmf_s64; - for(i = 0; i < l; i++) { - ptr[i] = (uint8_t)(u64 & 0xFF); - u64 = u64 >> 8; - } - break; - } - ptr += l; - } -} - - -/* - * - */ -int -htsmsg_binary_serialize(htsmsg_t *msg, void **datap, size_t *lenp, int maxlen) -{ - size_t len; - uint8_t *data; - - len = htsmsg_binary_count(msg); - if(len + 4 > (size_t)maxlen) - return -1; - - data = malloc(len + 4); - - data[0] = len >> 24; - data[1] = len >> 16; - data[2] = len >> 8; - data[3] = len; - - htsmsg_binary_write(msg, data + 4); - *datap = data; - *lenp = len + 4; - return 0; -} diff --git a/lib/libhts/htsmsg_binary.h b/lib/libhts/htsmsg_binary.h deleted file mode 100644 index 02b41cac73..0000000000 --- a/lib/libhts/htsmsg_binary.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Functions converting HTSMSGs to/from a simple binary format - * Copyright (C) 2007 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef HTSMSG_BINARY_H_ -#define HTSMSG_BINARY_H_ - -#include "htsmsg.h" - -/** - * htsmsg_binary_deserialize - */ -htsmsg_t *htsmsg_binary_deserialize(const void *data, size_t len, - const void *buf); - -int htsmsg_binary_serialize(htsmsg_t *msg, void **datap, size_t *lenp, - int maxlen); - -#endif /* HTSMSG_BINARY_H_ */ diff --git a/lib/libhts/htsq.h b/lib/libhts/htsq.h deleted file mode 100644 index 5d9244c225..0000000000 --- a/lib/libhts/htsq.h +++ /dev/null @@ -1,146 +0,0 @@ -/* - * sys/queue.h wrappers and helpers - */ - -#ifndef HTSQ_H -#define HTSQ_H - -#ifdef _MSC_VER -#undef SLIST_ENTRY -#include "Win32/include/sys/queue.h" -#else -#include <sys/queue.h> -#endif - -/* - * Complete missing LIST-ops - */ - -#ifndef LIST_FOREACH -#define LIST_FOREACH(var, head, field) \ - for ((var) = ((head)->lh_first); \ - (var); \ - (var) = ((var)->field.le_next)) -#endif - -#ifndef LIST_EMPTY -#define LIST_EMPTY(head) ((head)->lh_first == NULL) -#endif - -#ifndef LIST_FIRST -#define LIST_FIRST(head) ((head)->lh_first) -#endif - -#ifndef LIST_NEXT -#define LIST_NEXT(elm, field) ((elm)->field.le_next) -#endif - -#ifndef LIST_INSERT_BEFORE -#define LIST_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.le_prev = (listelm)->field.le_prev; \ - (elm)->field.le_next = (listelm); \ - *(listelm)->field.le_prev = (elm); \ - (listelm)->field.le_prev = &(elm)->field.le_next; \ -} while (/*CONSTCOND*/0) -#endif - -/* - * Complete missing TAILQ-ops - */ - -#ifndef TAILQ_INSERT_BEFORE -#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \ - (elm)->field.tqe_prev = (listelm)->field.tqe_prev; \ - (elm)->field.tqe_next = (listelm); \ - *(listelm)->field.tqe_prev = (elm); \ - (listelm)->field.tqe_prev = &(elm)->field.tqe_next; \ -} while (0) -#endif - -#ifndef TAILQ_FOREACH -#define TAILQ_FOREACH(var, head, field) \ - for ((var) = ((head)->tqh_first); (var); (var) = ((var)->field.tqe_next)) -#endif - -#ifndef TAILQ_FIRST -#define TAILQ_FIRST(head) ((head)->tqh_first) -#endif - -#ifndef TAILQ_NEXT -#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next) -#endif - -#ifndef TAILQ_LAST -#define TAILQ_LAST(head, headname) \ - (*(((struct headname *)((head)->tqh_last))->tqh_last)) -#endif - -#ifndef TAILQ_PREV -#define TAILQ_PREV(elm, headname, field) \ - (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) -#endif - -#ifndef TAILQ_FOREACH_REVERSE -#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \ - for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \ - (var); \ - (var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last))) -#endif - -/* - * Some extra functions for LIST manipulation - */ - -#define LIST_MOVE(newhead, oldhead, field) do { \ - if((oldhead)->lh_first) { \ - (oldhead)->lh_first->field.le_prev = &(newhead)->lh_first; \ - } \ - (newhead)->lh_first = (oldhead)->lh_first; \ -} while (0) - -#define LIST_INSERT_SORTED(head, elm, field, cmpfunc) do { \ - if(LIST_EMPTY(head)) { \ - LIST_INSERT_HEAD(head, elm, field); \ - } else { \ - typeof(elm) _tmp; \ - LIST_FOREACH(_tmp,head,field) { \ - if(cmpfunc(elm,_tmp) <= 0) { \ - LIST_INSERT_BEFORE(_tmp,elm,field); \ - break; \ - } \ - if(!LIST_NEXT(_tmp,field)) { \ - LIST_INSERT_AFTER(_tmp,elm,field); \ - break; \ - } \ - } \ - } \ -} while(0) - -#define TAILQ_INSERT_SORTED(head, elm, field, cmpfunc) do { \ - if(TAILQ_FIRST(head) == NULL) { \ - TAILQ_INSERT_HEAD(head, elm, field); \ - } else { \ - typeof(elm) _tmp; \ - TAILQ_FOREACH(_tmp,head,field) { \ - if(cmpfunc(elm,_tmp) <= 0) { \ - TAILQ_INSERT_BEFORE(_tmp,elm,field); \ - break; \ - } \ - if(!TAILQ_NEXT(_tmp,field)) { \ - TAILQ_INSERT_AFTER(head,_tmp,elm,field); \ - break; \ - } \ - } \ - } \ -} while(0) - -#define TAILQ_MOVE(newhead, oldhead, field) do { \ - if(TAILQ_FIRST(oldhead)) { \ - TAILQ_FIRST(oldhead)->field.tqe_prev = &(newhead)->tqh_first; \ - } \ - (newhead)->tqh_first = (oldhead)->tqh_first; \ - (newhead)->tqh_last = (oldhead)->tqh_last; \ -} while (/*CONSTCOND*/0) - - -#endif /* HTSQ_H */ diff --git a/lib/libhts/htsstr.c b/lib/libhts/htsstr.c deleted file mode 100644 index 7aa91ee165..0000000000 --- a/lib/libhts/htsstr.c +++ /dev/null @@ -1,193 +0,0 @@ -/* - * String helper functions - * Copyright (C) 2008 Andreas Öman - * Copyright (C) 2008 Mattias Wadman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#ifdef __APPLE__ -#include "osx/OSXGNUReplacements.h" -#elif defined(_MSC_VER) -#include "msvc.h" -#endif -#include "htsstr.h" - - -static void htsstr_argsplit_add(char ***argv, int *argc, char *s); -static int htsstr_format0(const char *str, char *out, char **map); - - -char * -htsstr_unescape(char *str) { - char *s; - - for(s = str; *s; s++) { - if(*s != '\\') - continue; - - if(*(s + 1) == 'b') - *s = '\b'; - else if(*(s + 1) == 'f') - *s = '\f'; - else if(*(s + 1) == 'n') - *s = '\n'; - else if(*(s + 1) == 'r') - *s = '\r'; - else if(*(s + 1) == 't') - *s = '\t'; - else - *s = *(s + 1); - - if(*(s + 1)) { - /* shift string left, copies terminator too */ - memmove(s + 1, s + 2, strlen(s + 2) + 1); - } - } - - return str; -} - -static void -htsstr_argsplit_add(char ***argv, int *argc, char *s) -{ - *argv = realloc(*argv, sizeof((*argv)[0]) * (*argc + 1)); - (*argv)[(*argc)++] = s; -} - -char ** -htsstr_argsplit(const char *str) { - int quote = 0; - int inarg = 0; - const char *start = NULL; - const char *stop = NULL; - const char *s; - char **argv = NULL; - int argc = 0; - - for(s = str; *s; s++) { - if(start && stop) { - htsstr_argsplit_add(&argv, &argc, - htsstr_unescape(strndup(start, stop - start))); - start = stop = NULL; - } - - if(inarg) { - switch(*s) { - case '\\': - s++; - break; - case '"': - if(quote) { - inarg = 0; - quote = 0; - stop = s; - } - break; - case ' ': - if(quote) - break; - inarg = 0; - stop = s; - break; - default: - break; - } - } else { - switch(*s) { - case ' ': - break; - case '"': - quote = 1; - s++; - /* fallthru */ - default: - inarg = 1; - start = s; - stop = NULL; - break; - } - } - } - - if(start) { - if(!stop) - stop = str + strlen(str); - htsstr_argsplit_add(&argv, &argc, - htsstr_unescape(strndup(start, stop - start))); - } - - htsstr_argsplit_add(&argv, &argc, NULL); - - return argv; -} - -void -htsstr_argsplit_free(char **argv) { - int i; - - for(i = 0; argv[i]; i++) - free(argv[i]); - - free(argv); -} - -static int -htsstr_format0(const char *str, char *out, char **map) { - const char *s = str; - char *f; - int n = 0; - - while(*s) { - switch(*s) { - case '%': - f = map[(unsigned char)*(s + 1)]; - if(*(s + 1) != '%' && f) { - s += 2; /* skip %f * */ - if(out) - strcpy(&out[n], f); - n += strlen(f); - break; - } - /* fallthru */ - default: - if(out) - out[n] = *s; - s++; - n++; - break; - } - } - - if(out) - out[n] = '\0'; - - return n + 1; /* + \0 */ -} - -char * -htsstr_format(const char *str, char **map) -{ - char *s; - - s = malloc(htsstr_format0(str, NULL, map)); - htsstr_format0(str, s, map); - - return s; -} - diff --git a/lib/libhts/htsstr.h b/lib/libhts/htsstr.h deleted file mode 100644 index d2f0294a9f..0000000000 --- a/lib/libhts/htsstr.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * String helper functions - * Copyright (C) 2008 Andreas Öman - * Copyright (C) 2008 Mattias Wadman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - - -#ifndef HTSSTR_H__ -#define HTSSTR_H__ - -char *htsstr_unescape(char *str); - -char **htsstr_argsplit(const char *str); - -void htsstr_argsplit_free(char **argv); - -char *htsstr_format(const char *str, char **map); - -#endif /* HTSSTR_H__ */ diff --git a/lib/libhts/net.h b/lib/libhts/net.h deleted file mode 100644 index f817599abb..0000000000 --- a/lib/libhts/net.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Networking - * Copyright (C) 2007-2008 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef NET_H__ -#define NET_H__ - -#include <sys/types.h> -#include <stdint.h> -#include "htsbuf.h" - -#ifdef _MSC_VER -typedef SOCKET socket_t; -#else -typedef int socket_t; -#endif - -socket_t htsp_tcp_connect(const char *hostname, int port, char *errbuf, - size_t errbufsize, int timeout); - -int htsp_tcp_write_queue(socket_t fd, htsbuf_queue_t *q); - -int htsp_tcp_read_line(socket_t fd, char *buf, const size_t bufsize, - htsbuf_queue_t *spill); - -int htsp_tcp_read_data(socket_t fd, char *buf, const size_t bufsize, - htsbuf_queue_t *spill); - -int htsp_tcp_read(socket_t fd, void *buf, size_t len); - -int htsp_tcp_read_timeout(socket_t fd, void *buf, size_t len, int timeout); - -void htsp_tcp_close(socket_t fd); - - -#endif /* NET_H__ */ diff --git a/lib/libhts/net_posix.c b/lib/libhts/net_posix.c deleted file mode 100644 index c9f0e481fe..0000000000 --- a/lib/libhts/net_posix.c +++ /dev/null @@ -1,350 +0,0 @@ -/* - * Networking under POSIX - * Copyright (C) 2007-2008 Andreas Öman - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <netdb.h> -#ifdef __APPLE__ -/* Needed on Mac OS/X */ -#ifndef SOL_TCP -#define SOL_TCP IPPROTO_TCP -#endif -#include "osx/OSXGNUReplacements.h" -#elif defined(__FreeBSD__) -#ifndef SOL_TCP -#define SOL_TCP IPPROTO_TCP -#endif -#else -#include <sys/epoll.h> -#endif -#include <poll.h> -#include <assert.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <fcntl.h> -#include <errno.h> -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <arpa/inet.h> - -#if defined(__FreeBSD__) -#include <sys/socket.h> -#endif - -#include "net.h" - - -/** - * - */ -socket_t -htsp_tcp_connect_addr(struct addrinfo* addr, char *errbuf, size_t errbufsize, - int timeout) -{ - socket_t fd; - int r, err, val; - socklen_t errlen = sizeof(int); - - fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); - if(fd == -1) { - snprintf(errbuf, errbufsize, "Unable to create socket: %s", - strerror(errno)); - return -1; - } - - /** - * Switch to nonblocking - */ - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) | O_NONBLOCK); - - r = connect(fd, addr->ai_addr, addr->ai_addrlen); - - if(r == -1) { - if(errno == EINPROGRESS) { - struct pollfd pfd; - - pfd.fd = fd; - pfd.events = POLLOUT; - pfd.revents = 0; - - r = poll(&pfd, 1, timeout); - if(r == 0) { - /* Timeout */ - snprintf(errbuf, errbufsize, "Connection attempt timed out"); - close(fd); - return -1; - } - - if(r == -1) { - snprintf(errbuf, errbufsize, "poll() error: %s", strerror(errno)); - close(fd); - return -1; - } - - getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &errlen); - } else { - err = errno; - } - } else { - err = 0; - } - - if(err != 0) { - snprintf(errbuf, errbufsize, "%s", strerror(err)); - close(fd); - return -1; - } - - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL) & ~O_NONBLOCK); - - val = 1; - setsockopt(fd, SOL_TCP, TCP_NODELAY, &val, sizeof(val)); - - return fd; -} - - -socket_t -htsp_tcp_connect(const char *hostname, int port, char *errbuf, size_t errbufsize, - int timeout) -{ - struct addrinfo hints; - struct addrinfo *result, *addr; - char service[33]; - int res; - socket_t fd = -1; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - sprintf(service, "%d", port); - - res = getaddrinfo(hostname, service, &hints, &result); - if(res) { - switch(res) { - case EAI_NONAME: - snprintf(errbuf, errbufsize, "The specified host is unknown"); - break; - - case EAI_FAIL: - snprintf(errbuf, errbufsize, "A nonrecoverable failure in name resolution occurred"); - break; - - case EAI_MEMORY: - snprintf(errbuf, errbufsize, "A memory allocation failure occurred"); - break; - - case EAI_AGAIN: - snprintf(errbuf, errbufsize, "A temporary error occurred on an authoritative name server"); - break; - - default: - snprintf(errbuf, errbufsize, "Unknown error %d", res); - break; - } - return -1; - } - - for(addr = result; addr; addr = addr->ai_next) { - fd = htsp_tcp_connect_addr(addr, errbuf, errbufsize, timeout); - if(fd != -1) - break; - } - - freeaddrinfo(result); - return fd; -} - - -/** - * - */ -int -htsp_tcp_write_queue(socket_t fd, htsbuf_queue_t *q) -{ - htsbuf_data_t *hd; - int l, r; - - while((hd = TAILQ_FIRST(&q->hq_q)) != NULL) { - TAILQ_REMOVE(&q->hq_q, hd, hd_link); - - l = hd->hd_data_len - hd->hd_data_off; - r = write(fd, hd->hd_data + hd->hd_data_off, l); - free(hd->hd_data); - free(hd); - } - q->hq_size = 0; - return 0; -} - - -/** - * - */ -static int -tcp_fill_htsbuf_from_fd(socket_t fd, htsbuf_queue_t *hq) -{ - htsbuf_data_t *hd = TAILQ_LAST(&hq->hq_q, htsbuf_data_queue); - int c; - - if(hd != NULL) { - /* Fill out any previous buffer */ - c = hd->hd_data_size - hd->hd_data_len; - - if(c > 0) { - - c = read(fd, hd->hd_data + hd->hd_data_len, c); - if(c < 1) - return -1; - - hd->hd_data_len += c; - hq->hq_size += c; - return 0; - } - } - - hd = malloc(sizeof(htsbuf_data_t)); - - hd->hd_data_size = 1000; - hd->hd_data = malloc(hd->hd_data_size); - - c = read(fd, hd->hd_data, hd->hd_data_size); - if(c < 1) { - free(hd->hd_data); - free(hd); - return -1; - } - hd->hd_data_len = c; - hd->hd_data_off = 0; - TAILQ_INSERT_TAIL(&hq->hq_q, hd, hd_link); - hq->hq_size += c; - return 0; -} - - -/** - * - */ -int -htsp_tcp_read_line(socket_t fd, char *buf, const size_t bufsize, htsbuf_queue_t *spill) -{ - int len; - - while(1) { - len = htsbuf_find(spill, 0xa); - - if(len == -1) { - if(tcp_fill_htsbuf_from_fd(fd, spill) < 0) - return -1; - continue; - } - - if(len >= (int)bufsize - 1) - return -1; - - htsbuf_read(spill, buf, len); - buf[len] = 0; - while(len > 0 && buf[len - 1] < 32) - buf[--len] = 0; - htsbuf_drop(spill, 1); /* Drop the \n */ - return 0; - } -} - - -/** - * - */ -int -htsp_tcp_read_data(socket_t fd, char *buf, const size_t bufsize, htsbuf_queue_t *spill) -{ - int x, tot = htsbuf_read(spill, buf, bufsize); - - if(tot == (int)bufsize) - return 0; - - x = recv(fd, buf + tot, bufsize - tot, MSG_WAITALL); - if(x != (int)bufsize - tot) - return -1; - - return 0; -} - -/** - * - */ -int -htsp_tcp_read(socket_t fd, void *buf, size_t len) -{ - int x = recv(fd, buf, len, MSG_WAITALL); - - if(x == -1) - return errno; - if(x != (int)len) - return ECONNRESET; - return 0; - -} - -/** - * - */ -int -htsp_tcp_read_timeout(socket_t fd, void *buf, size_t len, int timeout) -{ - int x, tot = 0; - struct pollfd fds; - - assert(timeout > 0); - - fds.fd = fd; - fds.events = POLLIN; - fds.revents = 0; - - while(tot != (int)len) { - - x = poll(&fds, 1, timeout); - if(x == 0) - return ETIMEDOUT; - - x = recv(fd, buf + tot, len - tot, MSG_DONTWAIT); - if(x == -1) { - if(errno == EAGAIN) - continue; - return errno; - } - - if(x == 0) - return ECONNRESET; - - tot += x; - } - return 0; -} - -/** - * - */ -void -htsp_tcp_close(socket_t fd) -{ - close(fd); -} diff --git a/lib/libhts/net_winsock.c b/lib/libhts/net_winsock.c deleted file mode 100644 index 3f540dd03b..0000000000 --- a/lib/libhts/net_winsock.c +++ /dev/null @@ -1,391 +0,0 @@ -/* - * Networking under WINDOWS - * Copyright (C) 2007-2008 Andreas Öman - * Copyright (C) 2007-2008 Joakim Plate - * - * 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 - * of the License, 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 this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include <errno.h> - -#include <winsock2.h> -#include <Ws2tcpip.h> -#include "msvc.h" -#include "net.h" - - -static int socket_errno() -{ - int error = WSAGetLastError(); - switch(error) - { - case WSAEINPROGRESS: return EINPROGRESS; - case WSAECONNRESET : return ECONNRESET; - case WSAETIMEDOUT : return ETIMEDOUT; - case WSAEWOULDBLOCK: return EAGAIN; - default : return error; - } -} - -#ifndef MSG_WAITALL -#define MSG_WAITALL 0x8 -#endif - -static int recv_fixed (SOCKET s, char * buf, int len, int flags) -{ - char* org = buf; - int res = 1; - - if((flags & MSG_WAITALL) == 0) - return recv(s, buf, len, flags); - - flags &= ~MSG_WAITALL; - while(len > 0 && res > 0) - { - res = recv(s, buf, len, flags); - if(res < 0) - return res; - - buf += res; - len -= res; - } - return buf - org; -} -#define recv(s, buf, len, flags) recv_fixed(s, buf, len, flags) - -/** - * - */ -socket_t -htsp_tcp_connect_addr(struct addrinfo* addr, char *errbuf, size_t errbufsize, - int timeout) -{ - socket_t fd; - int r, err, val; - socklen_t errlen = sizeof(int); - - fd = socket(addr->ai_family, addr->ai_socktype, addr->ai_protocol); - if(fd == -1) { - snprintf(errbuf, errbufsize, "Unable to create socket: %s", - strerror(socket_errno())); - return -1; - } - - /** - * Switch to nonblocking - */ - val = 1; - ioctlsocket(fd, FIONBIO, &val); - - r = connect(fd, addr->ai_addr, addr->ai_addrlen); - - if(r == -1) { - if(socket_errno() == EINPROGRESS || - socket_errno() == EAGAIN) { - fd_set fd_write, fd_except; - struct timeval tv; - - tv.tv_sec = timeout / 1000; - tv.tv_usec = 1000 * (timeout % 1000); - - FD_ZERO(&fd_write); - FD_ZERO(&fd_except); - - FD_SET(fd, &fd_write); - FD_SET(fd, &fd_except); - - r = select((int)fd+1, NULL, &fd_write, &fd_except, &tv); - - if(r == 0) { - /* Timeout */ - snprintf(errbuf, errbufsize, "Connection attempt timed out"); - closesocket(fd); - return -1; - } - - if(r == -1) { - snprintf(errbuf, errbufsize, "select() error: %s", strerror(socket_errno())); - closesocket(fd); - return -1; - } - - getsockopt(fd, SOL_SOCKET, SO_ERROR, (void *)&err, &errlen); - } else { - err = socket_errno(); - } - } else { - err = 0; - } - - if(err != 0) { - snprintf(errbuf, errbufsize, "%s", strerror(err)); - closesocket(fd); - return -1; - } - - val = 0; - ioctlsocket(fd, FIONBIO, &val); - - val = 1; - setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const char*)&val, sizeof(val)); - - return fd; -} - - -socket_t -htsp_tcp_connect(const char *hostname, int port, char *errbuf, size_t errbufsize, - int timeout) -{ - struct addrinfo hints; - struct addrinfo *result, *addr; - char service[33]; - int res; - socket_t fd = INVALID_SOCKET; - - memset(&hints, 0, sizeof(hints)); - hints.ai_family = AF_UNSPEC; - hints.ai_socktype = SOCK_STREAM; - hints.ai_protocol = IPPROTO_TCP; - sprintf(service, "%d", port); - - res = getaddrinfo(hostname, service, &hints, &result); - if(res) { - switch(res) { - case EAI_NONAME: - snprintf(errbuf, errbufsize, "The specified host is unknown"); - break; - - case EAI_FAIL: - snprintf(errbuf, errbufsize, "A nonrecoverable failure in name resolution occurred"); - break; - - case EAI_MEMORY: - snprintf(errbuf, errbufsize, "A memory allocation failure occurred"); - break; - - case EAI_AGAIN: - snprintf(errbuf, errbufsize, "A temporary error occurred on an authoritative name server"); - break; - - default: - snprintf(errbuf, errbufsize, "Unknown error %d", res); - break; - } - return -1; - } - - for(addr = result; addr; addr = addr->ai_next) { - fd = htsp_tcp_connect_addr(addr, errbuf, errbufsize, timeout); - if(fd != INVALID_SOCKET) - break; - } - - freeaddrinfo(result); - return fd; -} - - -/** - * - */ -int -htsp_tcp_write_queue(socket_t fd, htsbuf_queue_t *q) -{ - htsbuf_data_t *hd; - int l, r; - - while((hd = TAILQ_FIRST(&q->hq_q)) != NULL) { - TAILQ_REMOVE(&q->hq_q, hd, hd_link); - - l = hd->hd_data_len - hd->hd_data_off; - r = send(fd, hd->hd_data + hd->hd_data_off, l, 0); - free(hd->hd_data); - free(hd); - } - q->hq_size = 0; - return 0; -} - - -/** - * - */ -static int -tcp_fill_htsbuf_from_fd(socket_t fd, htsbuf_queue_t *hq) -{ - htsbuf_data_t *hd = TAILQ_LAST(&hq->hq_q, htsbuf_data_queue); - int c; - - if(hd != NULL) { - /* Fill out any previous buffer */ - c = hd->hd_data_size - hd->hd_data_len; - - if(c > 0) { - - c = recv(fd, hd->hd_data + hd->hd_data_len, c, MSG_WAITALL); - if(c < 1) - return -1; - - hd->hd_data_len += c; - hq->hq_size += c; - return 0; - } - } - - hd = malloc(sizeof(htsbuf_data_t)); - - hd->hd_data_size = 1000; - hd->hd_data = malloc(hd->hd_data_size); - - c = recv(fd, hd->hd_data, hd->hd_data_size, MSG_WAITALL); - if(c < 1) { - free(hd->hd_data); - free(hd); - return -1; - } - hd->hd_data_len = c; - hd->hd_data_off = 0; - TAILQ_INSERT_TAIL(&hq->hq_q, hd, hd_link); - hq->hq_size += c; - return 0; -} - - -/** - * - */ -int -htsp_tcp_read_line(socket_t fd, char *buf, const size_t bufsize, htsbuf_queue_t *spill) -{ - int len; - - while(1) { - len = htsbuf_find(spill, 0xa); - - if(len == -1) { - if(tcp_fill_htsbuf_from_fd(fd, spill) < 0) - return -1; - continue; - } - - if(len >= (int)bufsize - 1) - return -1; - - htsbuf_read(spill, buf, len); - buf[len] = 0; - while(len > 0 && buf[len - 1] < 32) - buf[--len] = 0; - htsbuf_drop(spill, 1); /* Drop the \n */ - return 0; - } -} - - -/** - * - */ -int -htsp_tcp_read_data(socket_t fd, char *buf, const size_t bufsize, htsbuf_queue_t *spill) -{ - int x, tot = htsbuf_read(spill, buf, bufsize); - - if(tot == bufsize) - return 0; - - x = recv(fd, buf + tot, bufsize - tot, MSG_WAITALL); - if(x != bufsize - tot) - return -1; - - return 0; -} - -/** - * - */ -int -htsp_tcp_read(socket_t fd, void *buf, size_t len) -{ - int x = recv(fd, buf, len, MSG_WAITALL); - - if(x == -1) - return socket_errno(); - if(x != len) - return ECONNRESET; - return 0; - -} - -/** - * - */ -int -htsp_tcp_read_timeout(socket_t fd, char *buf, size_t len, int timeout) -{ - int x, tot = 0, val, err; - fd_set fd_read; - struct timeval tv; - - assert(timeout > 0); - - while(tot != len) { - - tv.tv_sec = timeout / 1000; - tv.tv_usec = 1000 * (timeout % 1000); - - FD_ZERO(&fd_read); - FD_SET(fd, &fd_read); - - x = select((int)fd+1, &fd_read, NULL, NULL, &tv); - - if(x == 0) - return ETIMEDOUT; - - val = 1; - ioctlsocket(fd, FIONBIO, &val); - - x = recv(fd, buf + tot, len - tot, 0); - err = socket_errno(); - - val = 0; - ioctlsocket(fd, FIONBIO, &val); - - if(x == 0) - return ECONNRESET; - else if(x == -1) - { - if(err == EAGAIN) - continue; - return err; - } - - tot += x; - } - return 0; -} - -/** - * - */ -void -htsp_tcp_close(socket_t fd) -{ - closesocket(fd); -} diff --git a/lib/libhts/sha1.c b/lib/libhts/sha1.c deleted file mode 100644 index 0867b942e6..0000000000 --- a/lib/libhts/sha1.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at> - * based on public domain SHA-1 code by Steve Reid <steve@edmweb.com> - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Modified by Joakim Plate <elupus@ecce.se> to be stand alone from libavutil - */ - -#include "sha1.h" -#include <string.h> - - -static uint16_t bswap_16(uint16_t x) -{ - x= (x>>8) | (x<<8); - return x; -} - - -static uint32_t bswap_32(uint32_t x) -{ - x= ((x<<8)&0xFF00FF00) | ((x>>8)&0x00FF00FF); - x= (x>>16) | (x<<16); - return x; -} - -static uint64_t bswap_64(uint64_t x) -{ - union { - uint64_t ll; - uint32_t l[2]; - } w, r; - w.ll = x; - r.l[0] = bswap_32 (w.l[1]); - r.l[1] = bswap_32 (w.l[0]); - return r.ll; -} - -// be2me ... big-endian to machine-endian -// le2me ... little-endian to machine-endian - -#ifdef WORDS_BIGENDIAN -#define be2me_16(x) (x) -#define be2me_32(x) (x) -#define be2me_64(x) (x) -#define le2me_16(x) bswap_16(x) -#define le2me_32(x) bswap_32(x) -#define le2me_64(x) bswap_64(x) -#else -#define be2me_16(x) bswap_16(x) -#define be2me_32(x) bswap_32(x) -#define be2me_64(x) bswap_64(x) -#define le2me_16(x) (x) -#define le2me_32(x) (x) -#define le2me_64(x) (x) -#endif - -typedef struct HTSSHA1 { - uint64_t count; - uint8_t buffer[64]; - uint32_t state[5]; -} HTSSHA1; - -const int hts_sha1_size = sizeof(HTSSHA1); - -#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits)))) - -/* (R0+R1), R2, R3, R4 are the different operations used in SHA1 */ -#define blk0(i) (block[i] = be2me_32(((const uint32_t*)buffer)[i])) -#define blk(i) (block[i] = rol(block[i-3]^block[i-8]^block[i-14]^block[i-16],1)) - -#define R0(v,w,x,y,z,i) z+=((w&(x^y))^y) +blk0(i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R1(v,w,x,y,z,i) z+=((w&(x^y))^y) +blk (i)+0x5A827999+rol(v,5);w=rol(w,30); -#define R2(v,w,x,y,z,i) z+=( w^x ^y) +blk (i)+0x6ED9EBA1+rol(v,5);w=rol(w,30); -#define R3(v,w,x,y,z,i) z+=(((w|x)&y)|(w&x))+blk (i)+0x8F1BBCDC+rol(v,5);w=rol(w,30); -#define R4(v,w,x,y,z,i) z+=( w^x ^y) +blk (i)+0xCA62C1D6+rol(v,5);w=rol(w,30); - -/* Hash a single 512-bit block. This is the core of the algorithm. */ - -static void transform(uint32_t state[5], const uint8_t buffer[64]){ - uint32_t block[80]; - unsigned int i, a, b, c, d, e; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; -#if CONFIG_SMALL - for(i=0; i<80; i++){ - int t; - if(i<16) t= be2me_32(((uint32_t*)buffer)[i]); - else t= rol(block[i-3]^block[i-8]^block[i-14]^block[i-16],1); - block[i]= t; - t+= e+rol(a,5); - if(i<40){ - if(i<20) t+= ((b&(c^d))^d) +0x5A827999; - else t+= ( b^c ^d) +0x6ED9EBA1; - }else{ - if(i<60) t+= (((b|c)&d)|(b&c))+0x8F1BBCDC; - else t+= ( b^c ^d) +0xCA62C1D6; - } - e= d; - d= c; - c= rol(b,30); - b= a; - a= t; - } -#else - for(i=0; i<15; i+=5){ - R0(a,b,c,d,e,0+i); R0(e,a,b,c,d,1+i); R0(d,e,a,b,c,2+i); R0(c,d,e,a,b,3+i); R0(b,c,d,e,a,4+i); - } - R0(a,b,c,d,e,15); R1(e,a,b,c,d,16); R1(d,e,a,b,c,17); R1(c,d,e,a,b,18); R1(b,c,d,e,a,19); - for(i=20; i<40; i+=5){ - R2(a,b,c,d,e,0+i); R2(e,a,b,c,d,1+i); R2(d,e,a,b,c,2+i); R2(c,d,e,a,b,3+i); R2(b,c,d,e,a,4+i); - } - for(; i<60; i+=5){ - R3(a,b,c,d,e,0+i); R3(e,a,b,c,d,1+i); R3(d,e,a,b,c,2+i); R3(c,d,e,a,b,3+i); R3(b,c,d,e,a,4+i); - } - for(; i<80; i+=5){ - R4(a,b,c,d,e,0+i); R4(e,a,b,c,d,1+i); R4(d,e,a,b,c,2+i); R4(c,d,e,a,b,3+i); R4(b,c,d,e,a,4+i); - } -#endif - state[0] += a; - state[1] += b; - state[2] += c; - state[3] += d; - state[4] += e; -} - -void hts_sha1_init(HTSSHA1* ctx){ - ctx->state[0] = 0x67452301; - ctx->state[1] = 0xEFCDAB89; - ctx->state[2] = 0x98BADCFE; - ctx->state[3] = 0x10325476; - ctx->state[4] = 0xC3D2E1F0; - ctx->count = 0; -} - -void hts_sha1_update(HTSSHA1* ctx, const uint8_t* data, unsigned int len){ - unsigned int i, j; - - j = ctx->count & 63; - ctx->count += len; -#if CONFIG_SMALL - for( i = 0; i < len; i++ ){ - ctx->buffer[ j++ ] = data[i]; - if( 64 == j ){ - transform(ctx->state, ctx->buffer); - j = 0; - } - } -#else - if ((j + len) > 63) { - memcpy(&ctx->buffer[j], data, (i = 64-j)); - transform(ctx->state, ctx->buffer); - for ( ; i + 63 < len; i += 64) { - transform(ctx->state, &data[i]); - } - j=0; - } - else i = 0; - memcpy(&ctx->buffer[j], &data[i], len - i); -#endif -} - -void hts_sha1_final(HTSSHA1* ctx, uint8_t digest[20]){ - int i; - uint64_t finalcount= be2me_64(ctx->count<<3); - - hts_sha1_update(ctx, (const uint8_t*)"\200", 1); - while ((ctx->count & 63) != 56) { - hts_sha1_update(ctx, (const uint8_t*)"", 1); - } - hts_sha1_update(ctx, (uint8_t *)&finalcount, 8); /* Should cause a transform() */ - for(i=0; i<5; i++) - ((uint32_t*)digest)[i]= be2me_32(ctx->state[i]); -} - -#ifdef TEST -#include <stdio.h> -#undef printf - -int main(void){ - int i, k; - HTSSHA1 ctx; - unsigned char digest[20]; - - for(k=0; k<3; k++){ - av_sha1_init(&ctx); - if(k==0) - av_sha1_update(&ctx, "abc", 3); - else if(k==1) - av_sha1_update(&ctx, "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", 56); - else - for(i=0; i<1000*1000; i++) - av_sha1_update(&ctx, "a", 1); - av_sha1_final(&ctx, digest); - for (i = 0; i < 20; i++) - printf("%02X", digest[i]); - putchar('\n'); - } - //test vectors (from FIPS PUB 180-1) - printf("A9993E36 4706816A BA3E2571 7850C26C 9CD0D89D\n" - "84983E44 1C3BD26E BAAE4AA1 F95129E5 E54670F1\n" - "34AA973C D4C4DAA4 F61EEB2B DBAD2731 6534016F\n"); - - return 0; -} -#endif diff --git a/lib/libhts/sha1.h b/lib/libhts/sha1.h deleted file mode 100644 index e4ce492699..0000000000 --- a/lib/libhts/sha1.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007 Michael Niedermayer <michaelni@gmx.at> - * - * This file is part of FFmpeg. - * - * FFmpeg is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * FFmpeg 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with FFmpeg; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * Modified by Joakim Plate <elupus@ecce.se> to be stand alone from libavutil - */ - -#ifndef HTS_SHA1_H -#define HTS_SHA1_H - -#include <stdint.h> - -extern const int hts_sha1_size; - -struct HTSSHA1; - -void hts_sha1_init(struct HTSSHA1* context); -void hts_sha1_update(struct HTSSHA1* context, const uint8_t* data, unsigned int len); -void hts_sha1_final(struct HTSSHA1* context, uint8_t digest[20]); - -#endif /* HTS_SHA1_H */ diff --git a/project/VS2010Express/XBMC for Windows.sln b/project/VS2010Express/XBMC for Windows.sln index e1d8afee9a..5bfbcc3ef2 100644 --- a/project/VS2010Express/XBMC for Windows.sln +++ b/project/VS2010Express/XBMC for Windows.sln @@ -11,8 +11,6 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libPlatinum", "libPlatinum. EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UnrarXLib", "UnrarXLib.vcxproj", "{FE0A91C0-E30A-47CD-8A92-A508C9292452}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libhts", "..\..\lib\libhts\Win32\libhts_2010.vcxproj", "{00700E12-A63B-4E54-B962-4011A90584BD}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "visMilkdrop", "..\..\xbmc\visualizations\Milkdrop\Plugin.vcxproj", "{5E479372-4F34-426D-AA1E-9879E94C105D}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libXDAAP", "..\..\lib\libXDAAP\libXDAAP_win32\libXDAAP_win32.vcxproj", "{19B16CD0-3B47-47B7-AB0E-81EF2BF1B187}" diff --git a/project/VS2010Express/XBMC.vcxproj b/project/VS2010Express/XBMC.vcxproj index 6d5e36dcc5..de03ab7a97 100644 --- a/project/VS2010Express/XBMC.vcxproj +++ b/project/VS2010Express/XBMC.vcxproj @@ -314,8 +314,6 @@ <ClCompile Include="..\..\xbmc\filesystem\FTPParse.cpp" /> <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunDirectory.cpp" /> <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunFile.cpp" /> - <ClCompile Include="..\..\xbmc\filesystem\HTSPDirectory.cpp" /> - <ClCompile Include="..\..\xbmc\filesystem\HTSPSession.cpp" /> <ClCompile Include="..\..\xbmc\filesystem\HTTPDirectory.cpp" /> <ClCompile Include="..\..\xbmc\filesystem\HTTPFile.cpp" /> <ClCompile Include="..\..\xbmc\filesystem\IDirectory.cpp" /> @@ -1097,8 +1095,6 @@ <ClInclude Include="..\..\xbmc\filesystem\FTPParse.h" /> <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunDirectory.h" /> <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunFile.h" /> - <ClInclude Include="..\..\xbmc\filesystem\HTSPDirectory.h" /> - <ClInclude Include="..\..\xbmc\filesystem\HTSPSession.h" /> <ClInclude Include="..\..\xbmc\filesystem\HTTPDirectory.h" /> <ClInclude Include="..\..\xbmc\filesystem\IDirectory.h" /> <ClInclude Include="..\..\xbmc\filesystem\IFile.h" /> @@ -1534,7 +1530,6 @@ <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDCodecs\Overlay\DVDOverlayCodecTX3G.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemux.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxFFmpeg.cpp" /> - <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxHTSP.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxShoutcast.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxUtils.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDFactoryDemuxer.cpp" /> @@ -1542,7 +1537,6 @@ <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStream.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamFFmpeg.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamFile.cpp" /> - <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHTSP.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHttp.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamMemory.cpp" /> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamNavigator.cpp" /> @@ -2231,7 +2225,6 @@ <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDCodecs\Overlay\DVDOverlayText.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemux.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxFFmpeg.h" /> - <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxHTSP.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxShoutcast.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxUtils.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDFactoryDemuxer.h" /> @@ -2240,7 +2233,6 @@ <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStream.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamFFmpeg.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamFile.h" /> - <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHTSP.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHttp.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamMemory.h" /> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamNavigator.h" /> @@ -2401,10 +2393,6 @@ <ProjectReference Include="..\..\lib\gtest\msvc\gtest.vcxproj" Condition="'$(Configuration)|$(Platform)'=='Debug Testsuite|Win32'"> <Project>{c8f6c172-56f2-4e76-b5fa-c3b423b31be7}</Project> </ProjectReference> - <ProjectReference Include="..\..\lib\libhts\Win32\libhts_2010.vcxproj"> - <Project>{00700e12-a63b-4e54-b962-4011a90584bd}</Project> - <ReferenceOutputAssembly>false</ReferenceOutputAssembly> - </ProjectReference> <ProjectReference Include="..\..\lib\libRTV\libRTV.vcxproj"> <Project>{dd4818ae-7e35-40b7-a6a0-0ff83aa1c916}</Project> <Private>true</Private> diff --git a/project/VS2010Express/XBMC.vcxproj.filters b/project/VS2010Express/XBMC.vcxproj.filters index 36dd7e6e71..9dc1c1fd7b 100644 --- a/project/VS2010Express/XBMC.vcxproj.filters +++ b/project/VS2010Express/XBMC.vcxproj.filters @@ -450,9 +450,6 @@ <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxFFmpeg.cpp"> <Filter>cores\dvdplayer\DVDDemuxers</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxHTSP.cpp"> - <Filter>cores\dvdplayer\DVDDemuxers</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxShoutcast.cpp"> <Filter>cores\dvdplayer\DVDDemuxers</Filter> </ClCompile> @@ -474,9 +471,6 @@ <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamFile.cpp"> <Filter>cores\dvdplayer\DVDInputStreams</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHTSP.cpp"> - <Filter>cores\dvdplayer\DVDInputStreams</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHttp.cpp"> <Filter>cores\dvdplayer\DVDInputStreams</Filter> </ClCompile> @@ -2026,12 +2020,6 @@ <ClCompile Include="..\..\xbmc\filesystem\HDHomeRunFile.cpp"> <Filter>filesystem</Filter> </ClCompile> - <ClCompile Include="..\..\xbmc\filesystem\HTSPDirectory.cpp"> - <Filter>filesystem</Filter> - </ClCompile> - <ClCompile Include="..\..\xbmc\filesystem\HTSPSession.cpp"> - <Filter>filesystem</Filter> - </ClCompile> <ClCompile Include="..\..\xbmc\filesystem\HTTPDirectory.cpp"> <Filter>filesystem</Filter> </ClCompile> @@ -3313,9 +3301,6 @@ <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxFFmpeg.h"> <Filter>cores\dvdplayer\DVDDemuxers</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxHTSP.h"> - <Filter>cores\dvdplayer\DVDDemuxers</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDDemuxers\DVDDemuxShoutcast.h"> <Filter>cores\dvdplayer\DVDDemuxers</Filter> </ClInclude> @@ -3340,9 +3325,6 @@ <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamFile.h"> <Filter>cores\dvdplayer\DVDInputStreams</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHTSP.h"> - <Filter>cores\dvdplayer\DVDInputStreams</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\cores\dvdplayer\DVDInputStreams\DVDInputStreamHttp.h"> <Filter>cores\dvdplayer\DVDInputStreams</Filter> </ClInclude> @@ -5037,12 +5019,6 @@ <ClInclude Include="..\..\xbmc\filesystem\HDHomeRunFile.h"> <Filter>filesystem</Filter> </ClInclude> - <ClInclude Include="..\..\xbmc\filesystem\HTSPDirectory.h"> - <Filter>filesystem</Filter> - </ClInclude> - <ClInclude Include="..\..\xbmc\filesystem\HTSPSession.h"> - <Filter>filesystem</Filter> - </ClInclude> <ClInclude Include="..\..\xbmc\filesystem\HTTPDirectory.h"> <Filter>filesystem</Filter> </ClInclude> diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index 66f9b3a3f2..18b21e161a 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -70,9 +70,6 @@ #ifdef HAS_FILESYSTEM_SAP #include "filesystem/SAPDirectory.h" #endif -#ifdef HAS_FILESYSTEM_HTSP -#include "filesystem/HTSPDirectory.h" -#endif #include "utils/SystemInfo.h" #include "utils/TimeUtils.h" #include "GUILargeTextureManager.h" @@ -4226,11 +4223,6 @@ void CApplication::ProcessSlow() // check for any idle curl connections g_curlInterface.CheckIdle(); -#ifdef HAS_FILESYSTEM_HTSP - // check for any idle htsp sessions - HTSP::CHTSPDirectorySession::CheckIdle(); -#endif - #ifdef HAS_KARAOKE if ( m_pKaraokeMgr ) m_pKaraokeMgr->ProcessSlow(); diff --git a/xbmc/Util.cpp b/xbmc/Util.cpp index ca9c0bf680..e61e394c75 100644 --- a/xbmc/Util.cpp +++ b/xbmc/Util.cpp @@ -198,10 +198,6 @@ std::string CUtil::GetTitleFromPath(const CURL& url, bool bIsFolder /* = false * else if (url.IsProtocol("rtv")) strFilename = "ReplayTV Devices"; - // HTS Tvheadend client - else if (url.IsProtocol("htsp")) - strFilename = g_localizeStrings.Get(20256); - // SAP Streams else if (url.IsProtocol("sap") && strFilename.empty()) strFilename = "SAP Streams"; @@ -490,18 +486,12 @@ bool CUtil::IsPVR(const std::string& strFile) return StringUtils::StartsWithNoCase(strFile, "pvr:"); } -bool CUtil::IsHTSP(const std::string& strFile) -{ - return StringUtils::StartsWithNoCase(strFile, "htsp:"); -} - bool CUtil::IsLiveTV(const std::string& strFile) { if (StringUtils::StartsWithNoCase(strFile, "pvr://channels")) return true; if(URIUtils::IsHDHomeRun(strFile) - || URIUtils::IsHTSP(strFile) || StringUtils::StartsWithNoCase(strFile, "sap:")) return true; diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp deleted file mode 100644 index 3674416516..0000000000 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.cpp +++ /dev/null @@ -1,391 +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 "DVDCodecs/DVDCodecs.h" -#include "DVDInputStreams/DVDInputStream.h" -#include "DVDInputStreams/DVDInputStreamHTSP.h" -#include "DVDDemuxHTSP.h" -#include "DVDDemuxUtils.h" -#include "DVDClock.h" -#include "dialogs/GUIDialogKaiToast.h" -#include "utils/log.h" -#include "utils/StringUtils.h" -#include <arpa/inet.h> - -extern "C" { -#include "lib/libhts/net.h" -#include "lib/libhts/htsmsg.h" -#include "lib/libhts/htsmsg_binary.h" -} - -using namespace std; -using namespace HTSP; - -class CDemuxStreamVideoHTSP - : public CDemuxStreamVideo -{ - CDVDDemuxHTSP *m_parent; - string m_codec; -public: - CDemuxStreamVideoHTSP(CDVDDemuxHTSP *parent, const string& codec) - : m_parent(parent) - , m_codec(codec) - {} - void GetStreamInfo(std::string& strInfo) - { - strInfo = StringUtils::Format("%s, delay: %u, drops: %ub %up %ui" - , m_codec.c_str() - , m_parent->m_QueueStatus.delay - , m_parent->m_QueueStatus.bdrops - , m_parent->m_QueueStatus.pdrops - , m_parent->m_QueueStatus.idrops); - } -}; - -class CDemuxStreamAudioHTSP - : public CDemuxStreamAudio -{ - CDVDDemuxHTSP *m_parent; - string m_codec; -public: - CDemuxStreamAudioHTSP(CDVDDemuxHTSP *parent, const string& codec) - : m_parent(parent) - , m_codec(codec) - - {} - void GetStreamInfo(string& strInfo) - { - strInfo = StringUtils::Format("%s", m_codec.c_str()); - } -}; - -CDVDDemuxHTSP::CDVDDemuxHTSP() - : CDVDDemux() - , m_Input(NULL) - , m_StatusCount(0) -{ -} - -CDVDDemuxHTSP::~CDVDDemuxHTSP() -{ - Dispose(); -} - -bool CDVDDemuxHTSP::Open(CDVDInputStream* input) -{ - Dispose(); - - if(!input->IsStreamType(DVDSTREAM_TYPE_HTSP)) - return false; - - m_Input = (CDVDInputStreamHTSP*)input; - m_StatusCount = 0; - - while(m_Streams.empty() && m_StatusCount == 0) - { - DemuxPacket* pkg = Read(); - if(!pkg) - return false; - CDVDDemuxUtils::FreeDemuxPacket(pkg); - } - - return true; -} - -void CDVDDemuxHTSP::Dispose() -{ -} - -void CDVDDemuxHTSP::Reset() -{ -} - - -void CDVDDemuxHTSP::Flush() -{ -} - -bool CDVDDemuxHTSP::ReadStream(uint8_t* buf, int len) -{ - while(len > 0) - { - int ret = m_Input->Read(buf, len); - if(ret <= 0) - return false; - len -= ret; - buf += ret; - } - return true; -} - -htsmsg_t* CDVDDemuxHTSP::ReadStream() -{ - if(m_Input->IsStreamType(DVDSTREAM_TYPE_HTSP)) - return ((CDVDInputStreamHTSP*)m_Input)->ReadStream(); - - uint32_t l; - if(!ReadStream((uint8_t*)&l, 4)) - return NULL; - - l = ntohl(l); - if(l == 0) - return htsmsg_create_map(); - - uint8_t* buf = (uint8_t*)malloc(l); - if(!buf) - return NULL; - - if(!ReadStream(buf, l)) - return NULL; - - return htsmsg_binary_deserialize(buf, l, buf); /* consumes 'buf' */ -} - -DemuxPacket* CDVDDemuxHTSP::Read() -{ - htsmsg_t * msg; - while((msg = ReadStream())) - { - const char* method = htsmsg_get_str(msg, "method"); - if(method == NULL) - break; - - if (strcmp("subscriptionStart", method) == 0) - SubscriptionStart(msg); - else if(strcmp("subscriptionStop", method) == 0) - SubscriptionStop (msg); - else if(strcmp("subscriptionStatus", method) == 0) - SubscriptionStatus(msg); - else if(strcmp("queueStatus" , method) == 0) - CHTSPSession::ParseQueueStatus(msg, m_QueueStatus); - else if(strcmp("muxpkt" , method) == 0) - { - uint32_t index, duration; - const void* bin; - size_t binlen; - int64_t ts; - - if(htsmsg_get_u32(msg, "stream" , &index) || - htsmsg_get_bin(msg, "payload", &bin, &binlen)) - break; - - DemuxPacket* pkt = CDVDDemuxUtils::AllocateDemuxPacket(binlen); - - memcpy(pkt->pData, bin, binlen); - pkt->iSize = binlen; - - if(!htsmsg_get_u32(msg, "duration", &duration)) - pkt->duration = (double)duration * DVD_TIME_BASE / 1000000; - - if(!htsmsg_get_s64(msg, "dts", &ts)) - pkt->dts = (double)ts * DVD_TIME_BASE / 1000000; - else - pkt->dts = DVD_NOPTS_VALUE; - - if(!htsmsg_get_s64(msg, "pts", &ts)) - pkt->pts = (double)ts * DVD_TIME_BASE / 1000000; - else - pkt->pts = DVD_NOPTS_VALUE; - - pkt->iStreamId = -1; - for(int i = 0; i < (int)m_Streams.size(); i++) - { - if(m_Streams[i]->iPhysicalId == (int)index) - { - pkt->iStreamId = i; - break; - } - } - - htsmsg_destroy(msg); - return pkt; - } - - break; - } - - if(msg) - { - htsmsg_destroy(msg); - return CDVDDemuxUtils::AllocateDemuxPacket(0); - } - return NULL; -} - -void CDVDDemuxHTSP::SubscriptionStart (htsmsg_t *m) -{ - htsmsg_t *streams; - htsmsg_t *info; - htsmsg_field_t *f; - - if((info = htsmsg_get_map(m, "sourceinfo"))) - { - HTSMSG_FOREACH(f, info) - { - if(f->hmf_type != HMF_STR) - continue; - CLog::Log(LOGDEBUG, "CDVDDemuxHTSP::SubscriptionStart - %s: %s", f->hmf_name, htsmsg_field_get_string(f)); - } - } - - if((streams = htsmsg_get_list(m, "streams")) == NULL) - { - CLog::Log(LOGERROR, "CDVDDemuxHTSP::SubscriptionStart - malformed message"); - return; - } - - for(int i = 0; i < (int)m_Streams.size(); i++) - delete m_Streams[i]; - m_Streams.clear(); - - HTSMSG_FOREACH(f, streams) - { - uint32_t index; - const char* type; - const char* lang; - htsmsg_t* sub; - - if(f->hmf_type != HMF_MAP) - continue; - sub = &f->hmf_msg; - - if((type = htsmsg_get_str(sub, "type")) == NULL) - continue; - - if(htsmsg_get_u32(sub, "index", &index)) - continue; - - union { - CDemuxStream* g; - CDemuxStreamAudio* a; - CDemuxStreamVideo* v; - CDemuxStreamSubtitle* s; - CDemuxStreamTeletext* t; - } st; - - CLog::Log(LOGDEBUG, "CDVDDemuxHTSP::SubscriptionStart - id: %d, type: %s", index, type); - - if(!strcmp(type, "AC3")) { - st.a = new CDemuxStreamAudioHTSP(this, type); - st.a->codec = AV_CODEC_ID_AC3; - } else if(!strcmp(type, "EAC3")) { - st.a = new CDemuxStreamAudioHTSP(this, type); - st.a->codec = AV_CODEC_ID_EAC3; - } else if(!strcmp(type, "MPEG2AUDIO")) { - st.a = new CDemuxStreamAudioHTSP(this, type); - st.a->codec = AV_CODEC_ID_MP2; - } else if(!strcmp(type, "AAC")) { - st.a = new CDemuxStreamAudioHTSP(this, type); - st.a->codec = AV_CODEC_ID_AAC; - } else if(!strcmp(type, "MPEG2VIDEO")) { - st.v = new CDemuxStreamVideoHTSP(this, type); - st.v->codec = AV_CODEC_ID_MPEG2VIDEO; - st.v->iWidth = htsmsg_get_u32_or_default(sub, "width" , 0); - st.v->iHeight = htsmsg_get_u32_or_default(sub, "height", 0); - } else if(!strcmp(type, "H264")) { - st.v = new CDemuxStreamVideoHTSP(this, type); - st.v->codec = AV_CODEC_ID_H264; - st.v->iWidth = htsmsg_get_u32_or_default(sub, "width" , 0); - st.v->iHeight = htsmsg_get_u32_or_default(sub, "height", 0); - } else if(!strcmp(type, "DVBSUB")) { - st.s = new CDemuxStreamSubtitle(); - st.s->codec = AV_CODEC_ID_DVB_SUBTITLE; - uint32_t composition_id = 0, ancillary_id = 0; - htsmsg_get_u32(sub, "composition_id", &composition_id); - htsmsg_get_u32(sub, "ancillary_id" , &ancillary_id); - if(composition_id || ancillary_id) - { - st.s->ExtraData = new uint8_t[4]; - st.s->ExtraSize = 4; - st.s->ExtraData[0] = (composition_id >> 8) & 0xff; - st.s->ExtraData[1] = (composition_id >> 0) & 0xff; - st.s->ExtraData[2] = (ancillary_id >> 8) & 0xff; - st.s->ExtraData[3] = (ancillary_id >> 0) & 0xff; - } - } else if(!strcmp(type, "TEXTSUB")) { - st.s = new CDemuxStreamSubtitle(); - st.s->codec = AV_CODEC_ID_TEXT; - } else if(!strcmp(type, "TELETEXT")) { - st.t = new CDemuxStreamTeletext(); - st.t->codec = AV_CODEC_ID_DVB_TELETEXT; - } else { - continue; - } - - if((lang = htsmsg_get_str(sub, "language"))) - { - strncpy(st.g->language, lang, sizeof(st.g->language)); - st.g->language[sizeof(st.g->language) - 1] = '\0'; - } - - st.g->iId = m_Streams.size(); - st.g->iPhysicalId = index; - m_Streams.push_back(st.g); - } -} -void CDVDDemuxHTSP::SubscriptionStop (htsmsg_t *m) -{ - for(int i = 0; i < (int)m_Streams.size(); i++) - delete m_Streams[i]; - m_Streams.clear(); -} - -void CDVDDemuxHTSP::SubscriptionStatus(htsmsg_t *m) -{ - const char* status; - status = htsmsg_get_str(m, "status"); - if(status == NULL) - m_Status = ""; - else - { - m_StatusCount++; - m_Status = status; - CLog::Log(LOGDEBUG, "CDVDDemuxHTSP::SubscriptionStatus - %s", status); - CGUIDialogKaiToast::QueueNotification(CGUIDialogKaiToast::Info, "TVHeadend Status", status, TOAST_DISPLAY_TIME, false); - } -} - -CDemuxStream* CDVDDemuxHTSP::GetStream(int iStreamId) -{ - if(iStreamId >= 0 && iStreamId < (int)m_Streams.size()) - return m_Streams[iStreamId]; - - return NULL; -} - -int CDVDDemuxHTSP::GetNrOfStreams() -{ - return m_Streams.size(); -} - -std::string CDVDDemuxHTSP::GetFileName() -{ - if(m_Input) - return m_Input->GetFileName(); - else - return ""; -} - -void CDVDDemuxHTSP::Abort() -{ - if(m_Input) - return m_Input->Abort(); -} diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.h b/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.h deleted file mode 100644 index 6d73a9d764..0000000000 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDDemuxHTSP.h +++ /dev/null @@ -1,68 +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/>. - * - */ - -#pragma once -#include "DVDDemux.h" -#include "filesystem/HTSPSession.h" - -class CDVDInputStreamHTSP; -typedef struct htsmsg htsmsg_t; - -class CDVDDemuxHTSP : public CDVDDemux -{ -public: - CDVDDemuxHTSP(); - virtual ~CDVDDemuxHTSP(); - - bool Open(CDVDInputStream* input); - void Dispose(); - void Reset(); - void Flush(); - void Abort(); - void SetSpeed(int iSpeed){}; - - std::string GetFileName(); - - DemuxPacket* Read(); - - bool SeekTime(int time, bool backwords = false, double* startpts = NULL) { return false; } - int GetStreamLength() { return 0; } - - CDemuxStream* GetStream(int iStreamId); - int GetNrOfStreams(); - -protected: - friend class CDemuxStreamVideoHTSP; - - void SubscriptionStart (htsmsg_t *m); - void SubscriptionStop (htsmsg_t *m); - void SubscriptionStatus(htsmsg_t *m); - - htsmsg_t* ReadStream(); - bool ReadStream(uint8_t* buf, int len); - - typedef std::vector<CDemuxStream*> TStreams; - - CDVDInputStream* m_Input; - TStreams m_Streams; - std::string m_Status; - int m_StatusCount; - HTSP::SQueueStatus m_QueueStatus; -}; diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp index f909c32886..e1e7326fe2 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp +++ b/xbmc/cores/dvdplayer/DVDDemuxers/DVDFactoryDemuxer.cpp @@ -27,9 +27,6 @@ #include "DVDDemuxFFmpeg.h" #include "DVDDemuxShoutcast.h" -#ifdef HAS_FILESYSTEM_HTSP -#include "DVDDemuxHTSP.h" -#endif #include "DVDDemuxBXA.h" #include "DVDDemuxCDDA.h" #include "DVDDemuxPVRClient.h" @@ -88,17 +85,6 @@ CDVDDemux* CDVDFactoryDemuxer::CreateDemuxer(CDVDInputStream* pInputStream, bool } } -#ifdef HAS_FILESYSTEM_HTSP - if (pInputStream->IsStreamType(DVDSTREAM_TYPE_HTSP)) - { - unique_ptr<CDVDDemuxHTSP> demuxer(new CDVDDemuxHTSP()); - if(demuxer->Open(pInputStream)) - return demuxer.release(); - else - return NULL; - } -#endif - bool streaminfo = true; /* Look for streams before playback */ if (pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER)) { diff --git a/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in b/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in index 98493fe075..6283d6fca4 100644 --- a/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in +++ b/xbmc/cores/dvdplayer/DVDDemuxers/Makefile.in @@ -4,7 +4,6 @@ SRCS = DVDDemux.cpp SRCS += DVDDemuxBXA.cpp SRCS += DVDDemuxCDDA.cpp SRCS += DVDDemuxFFmpeg.cpp -SRCS += DVDDemuxHTSP.cpp SRCS += DVDDemuxPVRClient.cpp SRCS += DVDDemuxShoutcast.cpp SRCS += DVDDemuxUtils.cpp diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp index 830f806b7d..5d49a03b59 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDFactoryInputStream.cpp @@ -31,9 +31,6 @@ #ifdef HAVE_LIBBLURAY #include "DVDInputStreamBluray.h" #endif -#ifdef HAS_FILESYSTEM_HTSP -#include "DVDInputStreamHTSP.h" -#endif #ifdef ENABLE_DVDINPUTSTREAM_STACK #include "DVDInputStreamStack.h" #endif @@ -104,10 +101,6 @@ CDVDInputStream* CDVDFactoryInputStream::CreateInputStream(IDVDPlayer* pPlayer, || file.substr(0, 8) == "rtmps://") return new CDVDInputStreamRTMP(); #endif -#ifdef HAS_FILESYSTEM_HTSP - else if(file.substr(0, 7) == "htsp://") - return new CDVDInputStreamHTSP(); -#endif else if (item.IsInternetStream()) { if (item.IsType(".m3u8")) diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h index 11df1b804b..e629885a43 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h +++ b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStream.h @@ -38,7 +38,6 @@ enum DVDStreamType DVDSTREAM_TYPE_FFMPEG = 5, DVDSTREAM_TYPE_TV = 6, DVDSTREAM_TYPE_RTMP = 7, - DVDSTREAM_TYPE_HTSP = 8, DVDSTREAM_TYPE_MPLS = 10, DVDSTREAM_TYPE_BLURAY = 11, DVDSTREAM_TYPE_PVRMANAGER = 12, diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp deleted file mode 100644 index eae1fb73ef..0000000000 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.cpp +++ /dev/null @@ -1,275 +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 "DVDInputStreamHTSP.h" -#include "URL.h" -#include "FileItem.h" -#include "utils/log.h" -#include <limits.h> - -extern "C" { -#include "lib/libhts/net.h" -#include "lib/libhts/htsmsg.h" -#include "lib/libhts/htsmsg_binary.h" -#include "lib/libhts/sha1.h" -} - -using namespace std; -using namespace HTSP; - - - -htsmsg_t* CDVDInputStreamHTSP::ReadStream() -{ - htsmsg_t* msg; - - /* after anything has started reading, * - * we can guarantee a new stream */ - m_startup = false; - - while((msg = m_session.ReadMessage(1000))) - { - const char* method; - if((method = htsmsg_get_str(msg, "method")) == NULL) - return msg; - - if (strstr(method, "channelAdd")) - CHTSPSession::ParseChannelUpdate(msg, m_channels); - else if(strstr(method, "channelUpdate")) - CHTSPSession::ParseChannelUpdate(msg, m_channels); - else if(strstr(method, "channelRemove")) - CHTSPSession::ParseChannelRemove(msg, m_channels); - - uint32_t subs; - if(htsmsg_get_u32(msg, "subscriptionId", &subs) || subs != m_subs) - { - htsmsg_destroy(msg); - continue; - } - - return msg; - } - return NULL; -} - -CDVDInputStreamHTSP::CDVDInputStreamHTSP() - : CDVDInputStream(DVDSTREAM_TYPE_HTSP) - , m_subs(0) - , m_startup(false) - , m_channel(0) - , m_tag(0) -{ -} - -CDVDInputStreamHTSP::~CDVDInputStreamHTSP() -{ - Close(); -} - -bool CDVDInputStreamHTSP::Open(const char* file, const std::string& content) -{ - if (!CDVDInputStream::Open(file, content)) - return false; - - CURL url(file); - if(sscanf(url.GetFileName().c_str(), "tags/%d/%d", &m_tag, &m_channel) != 2) - { - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::Open - invalid url (%s)\n", url.GetFileName().c_str()); - return false; - } - - if(!m_session.Connect(url.GetHostName(), url.GetPort())) - return false; - - if(!url.GetUserName().empty()) - m_session.Auth(url.GetUserName(), url.GetPassWord()); - - m_session.SendEnableAsync(); - - if(!m_session.SendSubscribe(m_subs, m_channel)) - return false; - - m_startup = true; - return true; -} - -bool CDVDInputStreamHTSP::IsEOF() -{ - return false; -} - -void CDVDInputStreamHTSP::Close() -{ - CDVDInputStream::Close(); - m_session.Close(); - m_read.Clear(); -} - -int CDVDInputStreamHTSP::Read(uint8_t* buf, int buf_size) -{ - size_t count = m_read.Size(); - if(count == 0) - { - htsmsg_t* msg = ReadStream(); - if(msg == NULL) - return -1; - - uint8_t* p; - if(htsmsg_binary_serialize(msg, (void**)&p, &count, INT_MAX) < 0) - { - htsmsg_destroy(msg); - return -1; - } - htsmsg_destroy(msg); - - m_read.Clear(); - m_read.buf = p; - m_read.cur = p; - m_read.end = p + count; - } - - if(count == 0) - return 0; - - if(count > (size_t)buf_size) - count = buf_size; - - memcpy(buf, m_read.cur, count); - m_read.cur += count; - return count; -} - -bool CDVDInputStreamHTSP::SetChannel(int channel) -{ - CLog::Log(LOGDEBUG, "CDVDInputStreamHTSP::SetChannel - changing to channel %d", channel); - - if(!m_session.SendUnsubscribe(m_subs)) - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::SetChannel - failed to unsubscribe from previous channel"); - - if(!m_session.SendSubscribe(m_subs+1, channel)) - { - if(m_session.SendSubscribe(m_subs, m_channel)) - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::SetChannel - failed to set channel"); - else - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::SetChannel - failed to set channel and restore old channel"); - - return false; - } - - m_channel = channel; - m_subs = m_subs+1; - m_startup = true; - return true; -} - -bool CDVDInputStreamHTSP::GetChannels(SChannelV &channels, SChannelV::iterator &it) -{ - for(SChannels::iterator it2 = m_channels.begin(); it2 != m_channels.end(); ++it2) - { - if(m_tag == 0 || it2->second.MemberOf(m_tag)) - channels.push_back(it2->second); - } - sort(channels.begin(), channels.end()); - - for(it = channels.begin(); it != channels.end(); ++it) - if(it->id == m_channel) - return true; - return false; -} - -bool CDVDInputStreamHTSP::NextChannel(bool preview/* = false*/) -{ - SChannelV channels; - SChannelV::iterator it; - if(!GetChannels(channels, it)) - return false; - - SChannelC circ(channels.begin(), channels.end(), it); - if(++circ == it) - return false; - else - return SetChannel(circ->id); -} - -bool CDVDInputStreamHTSP::PrevChannel(bool preview/* = false*/) -{ - SChannelV channels; - SChannelV::iterator it; - if(!GetChannels(channels, it)) - return false; - - SChannelC circ(channels.begin(), channels.end(), it); - if(--circ == it) - return false; - else - return SetChannel(circ->id); -} - -bool CDVDInputStreamHTSP::SelectChannelByNumber(unsigned int channel) -{ - return SetChannel(channel); -} - -bool CDVDInputStreamHTSP::UpdateItem(CFileItem& item) -{ - SChannels::iterator it = m_channels.find(m_channel); - if(it == m_channels.end()) - return false; - - SChannel& channel = it->second; - - if(channel.event != m_event.id) - { - if(!m_session.GetEvent(m_event, channel.event)) - { - m_event.Clear(); - m_event.id = channel.event; - } - } - CFileItem current(item); - CHTSPSession::ParseItem(channel, m_tag, m_event, item); - item.SetArt("thumb", channel.icon); - return current.GetPath() != item.GetPath() - || current.m_strTitle != item.m_strTitle; -} - -int CDVDInputStreamHTSP::GetTotalTime() -{ - if(m_event.id == 0) - return 0; - return (m_event.stop - m_event.start) * 1000; -} - -int CDVDInputStreamHTSP::GetTime() -{ - CDateTimeSpan time; - time = CDateTime::GetUTCDateTime() - - CDateTime((time_t)m_event.start); - - return time.GetDays() * 1000 * 60 * 60 * 24 - + time.GetHours() * 1000 * 60 * 60 - + time.GetMinutes() * 1000 * 60 - + time.GetSeconds() * 1000; -} - -void CDVDInputStreamHTSP::Abort() -{ - m_session.Abort(); -} diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h b/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h deleted file mode 100644 index f078491af7..0000000000 --- a/xbmc/cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h +++ /dev/null @@ -1,93 +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/>. - * - */ - -#pragma once -#include "DVDInputStream.h" -#include "filesystem/HTSPSession.h" - -class CDVDInputStreamHTSP - : public CDVDInputStream - , public CDVDInputStream::IChannel - , public CDVDInputStream::IDisplayTime -{ -public: - CDVDInputStreamHTSP(); - virtual ~CDVDInputStreamHTSP(); - virtual bool Open(const char* file, const std::string &content); - virtual void Close(); - virtual int Read(uint8_t* buf, int buf_size); - virtual int64_t Seek(int64_t offset, int whence) { return -1; } - virtual bool Pause(double dTime) { return false; }; - virtual bool IsEOF(); - virtual int64_t GetLength() { return -1; } - - virtual ENextStream NextStream() { return m_startup ? NEXTSTREAM_OPEN : NEXTSTREAM_NONE; } - - virtual void Abort(); - - bool NextChannel(bool preview = false); - bool PrevChannel(bool preview = false); - bool SelectChannelByNumber(unsigned int channel); - bool UpdateItem(CFileItem& item); - - bool CanRecord() { return false; } - bool IsRecording() { return false; } - bool Record(bool bOnOff) { return false; } - - bool CanPause() { return false; } - bool CanSeek() { return false; } - - int GetTotalTime(); - int GetTime(); - - htsmsg_t* ReadStream(); - -private: - typedef std::vector<HTSP::SChannel> SChannelV; - typedef HTSP::const_circular_iter<SChannelV::iterator> SChannelC; - bool GetChannels(SChannelV &channels, SChannelV::iterator &it); - bool SetChannel(int channel); - unsigned m_subs; - bool m_startup; - HTSP::CHTSPSession m_session; - int m_channel; - int m_tag; - HTSP::SChannels m_channels; - HTSP::SEvent m_event; - - struct SRead - { - SRead() { buf = NULL; Clear(); } - ~SRead() { Clear(); } - - int Size() { return end - cur; } - void Clear() - { - free(buf); - buf = NULL; - cur = NULL; - end = NULL; - } - - uint8_t* buf; - uint8_t* cur; - uint8_t* end; - } m_read; -}; diff --git a/xbmc/cores/dvdplayer/DVDInputStreams/Makefile b/xbmc/cores/dvdplayer/DVDInputStreams/Makefile index 4607ed3842..d21ac428c6 100644 --- a/xbmc/cores/dvdplayer/DVDInputStreams/Makefile +++ b/xbmc/cores/dvdplayer/DVDInputStreams/Makefile @@ -6,7 +6,6 @@ SRCS= DVDFactoryInputStream.cpp \ DVDInputStreamBluray.cpp \ DVDInputStreamFFmpeg.cpp \ DVDInputStreamFile.cpp \ - DVDInputStreamHTSP.cpp \ DVDInputStreamHttp.cpp \ DVDInputStreamMemory.cpp \ DVDInputStreamNavigator.cpp \ diff --git a/xbmc/cores/dvdplayer/DVDPlayer.cpp b/xbmc/cores/dvdplayer/DVDPlayer.cpp index d17867faca..46c402dc9b 100644 --- a/xbmc/cores/dvdplayer/DVDPlayer.cpp +++ b/xbmc/cores/dvdplayer/DVDPlayer.cpp @@ -756,8 +756,7 @@ bool CDVDPlayer::OpenInputStream() // find any available external subtitles for non dvd files if (!m_pInputStream->IsStreamType(DVDSTREAM_TYPE_DVD) && !m_pInputStream->IsStreamType(DVDSTREAM_TYPE_PVRMANAGER) - && !m_pInputStream->IsStreamType(DVDSTREAM_TYPE_TV) - && !m_pInputStream->IsStreamType(DVDSTREAM_TYPE_HTSP)) + && !m_pInputStream->IsStreamType(DVDSTREAM_TYPE_TV)) { // find any available external subtitles std::vector<std::string> filenames; diff --git a/xbmc/filesystem/DirectoryFactory.cpp b/xbmc/filesystem/DirectoryFactory.cpp index 3db2a80d53..79802b3957 100644 --- a/xbmc/filesystem/DirectoryFactory.cpp +++ b/xbmc/filesystem/DirectoryFactory.cpp @@ -77,9 +77,6 @@ #ifdef HAS_FILESYSTEM_SAP #include "SAPDirectory.h" #endif -#ifdef HAS_FILESYSTEM_HTSP -#include "HTSPDirectory.h" -#endif #ifdef HAS_PVRCLIENTS #include "PVRDirectory.h" #endif @@ -211,9 +208,6 @@ IDirectory* CDirectoryFactory::Create(const CURL& url) #ifdef HAS_FILESYSTEM_SAP if (url.IsProtocol("sap")) return new CSAPDirectory(); #endif -#ifdef HAS_FILESYSTEM_HTSP - if (url.IsProtocol("htsp")) return new CHTSPDirectory(); -#endif #ifdef HAS_PVRCLIENTS if (url.IsProtocol("pvr")) return new CPVRDirectory(); #endif diff --git a/xbmc/filesystem/HTSPDirectory.cpp b/xbmc/filesystem/HTSPDirectory.cpp deleted file mode 100644 index e15abd5f16..0000000000 --- a/xbmc/filesystem/HTSPDirectory.cpp +++ /dev/null @@ -1,464 +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 "threads/SystemClock.h" -#include "HTSPDirectory.h" -#include "URL.h" -#include "FileItem.h" -#include "settings/Settings.h" -#include "guilib/LocalizeStrings.h" -#include "cores/dvdplayer/DVDInputStreams/DVDInputStreamHTSP.h" -#include "threads/SingleLock.h" -#include "utils/log.h" -#include "utils/TimeUtils.h" -#include "utils/StringUtils.h" - -#include <cassert> - -extern "C" { -#include "libhts/htsmsg.h" -#include "libhts/htsmsg_binary.h" -} - -using namespace XFILE; -using namespace HTSP; - -struct SSession -{ - SSession() - { - session = NULL; - port = 0; - refs = 0; - last = 0; - } - - std::string hostname; - int port; - std::string username; - std::string password; - CHTSPDirectorySession* session; - int refs; - unsigned int last; -}; - -struct STimedOut -{ - STimedOut(DWORD idle) : m_idle(idle) - { - m_time = XbmcThreads::SystemClockMillis(); - } - bool operator()(SSession& data) - { - return data.refs == 0 && (m_time - data.last) > m_idle; - } - unsigned int m_idle; - unsigned int m_time; -}; - -typedef std::vector<SSession> SSessions; - - -static SSessions g_sessions; -static CCriticalSection g_section; - - -CHTSPDirectorySession::CHTSPDirectorySession() : CThread("HTSPDirectorySession") -{ -} - -CHTSPDirectorySession::~CHTSPDirectorySession() -{ - Close(); -} - -CHTSPDirectorySession* CHTSPDirectorySession::Acquire(const CURL& url) -{ - CSingleLock lock(g_section); - - for(SSessions::iterator it = g_sessions.begin(); it != g_sessions.end(); ++it) - { - if(it->hostname == url.GetHostName() - && it->port == url.GetPort() - && it->username == url.GetUserName() - && it->password == url.GetPassWord()) - { - it->refs++; - return it->session; - } - } - lock.Leave(); - - CHTSPDirectorySession* session = new CHTSPDirectorySession(); - if(session->Open(url)) - { - SSession data; - data.hostname = url.GetHostName(); - data.port = url.GetPort(); - data.username = url.GetUserName(); - data.password = url.GetPassWord(); - data.session = session; - data.refs = 1; - lock.Enter(); - g_sessions.push_back(data); - return session; - } - - delete session; - return NULL; -} - -void CHTSPDirectorySession::Release(CHTSPDirectorySession* &session) -{ - if(session == NULL) - return; - - CSingleLock lock(g_section); - for(SSessions::iterator it = g_sessions.begin(); it != g_sessions.end(); ++it) - { - if(it->session == session) - { - it->refs--; - it->last = XbmcThreads::SystemClockMillis(); - return; - } - } - CLog::Log(LOGERROR, "CHTSPDirectorySession::Release - release of invalid session"); - assert(0); -} - -void CHTSPDirectorySession::CheckIdle(DWORD idle) -{ - CSingleLock lock(g_section); - STimedOut timeout(idle); - - for(SSessions::iterator it = g_sessions.begin(); it != g_sessions.end();) - { - if(timeout(*it)) - { - CLog::Log(LOGINFO, "CheckIdle - Closing session to htsp://%s:%i", it->hostname.c_str(), it->port); - delete it->session; - it = g_sessions.erase(it); - } - else - ++it; - } -} - -bool CHTSPDirectorySession::Open(const CURL& url) -{ - if(!m_session.Connect(url.GetHostName(), url.GetPort())) - return false; - - if(m_session.GetProtocol() < 2) - { - CLog::Log(LOGERROR, "CHTSPDirectory::GetDirectory - incompatible protocol version %d", m_session.GetProtocol()); - return false; - } - - if(!url.GetUserName().empty()) - m_session.Auth(url.GetUserName(), url.GetPassWord()); - - if(!m_session.SendEnableAsync()) - return false; - - Create(); - - m_started.WaitMSec(30000); - return !m_bStop; -} - -void CHTSPDirectorySession::Close() -{ - m_bStop = true; - m_session.Abort(); - StopThread(); - m_session.Close(); -} - -htsmsg_t* CHTSPDirectorySession::ReadResult(htsmsg_t* m) -{ - CSingleLock lock(m_section); - unsigned seq (m_session.AddSequence()); - - SMessage &message(m_queue[seq]); - message.event = new CEvent(); - message.msg = NULL; - - lock.Leave(); - htsmsg_add_u32(m, "seq", seq); - if(!m_session.SendMessage(m)) - { - m_queue.erase(seq); - return NULL; - } - - if(!message.event->WaitMSec(2000)) - CLog::Log(LOGERROR, "CHTSPDirectorySession::ReadResult - Timeout waiting for response"); - lock.Enter(); - - m = message.msg; - delete message.event; - - m_queue.erase(seq); - - return m; -} - -bool CHTSPDirectorySession::GetEvent(SEvent& event, uint32_t id) -{ - if(id == 0) - { - event.Clear(); - return false; - } - - SEvents::iterator it = m_events.find(id); - if(it != m_events.end()) - { - event = it->second; - return true; - } - - htsmsg_t *msg = htsmsg_create_map(); - htsmsg_add_str(msg, "method", "getEvent"); - htsmsg_add_u32(msg, "eventId", id); - if((msg = ReadResult(msg)) == NULL) - { - CLog::Log(LOGDEBUG, "CHTSPSession::GetEvent - failed to get event %u", id); - return false; - } - if(!CHTSPSession::ParseEvent(msg, id, event)) - return false; - - m_events[id] = event; - return true; -} - -void CHTSPDirectorySession::Process() -{ - CLog::Log(LOGDEBUG, "CHTSPDirectorySession::Process() - Starting"); - - htsmsg_t* msg; - - while(!m_bStop) - { - if((msg = m_session.ReadMessage()) == NULL) - break; - - uint32_t seq; - if(htsmsg_get_u32(msg, "seq", &seq) == 0) - { - CSingleLock lock(m_section); - SMessages::iterator it = m_queue.find(seq); - if(it != m_queue.end()) - { - it->second.msg = msg; - it->second.event->Set(); - continue; - } - } - - const char* method; - if((method = htsmsg_get_str(msg, "method")) == NULL) - { - htsmsg_destroy(msg); - continue; - } - - if (strstr(method, "channelAdd")) - CHTSPSession::ParseChannelUpdate(msg, m_channels); - else if(strstr(method, "channelUpdate")) - CHTSPSession::ParseChannelUpdate(msg, m_channels); - else if(strstr(method, "channelRemove")) - CHTSPSession::ParseChannelRemove(msg, m_channels); - if (strstr(method, "tagAdd")) - CHTSPSession::ParseTagUpdate(msg, m_tags); - else if(strstr(method, "tagUpdate")) - CHTSPSession::ParseTagUpdate(msg, m_tags); - else if(strstr(method, "tagRemove")) - CHTSPSession::ParseTagRemove(msg, m_tags); - else if(strstr(method, "initialSyncCompleted")) - m_started.Set(); - - htsmsg_destroy(msg); - } - - m_started.Set(); - CLog::Log(LOGDEBUG, "CHTSPDirectorySession::Process() - Exiting"); -} - -SChannels CHTSPDirectorySession::GetChannels() -{ - return GetChannels(0); -} - -SChannels CHTSPDirectorySession::GetChannels(int tag) -{ - CSingleLock lock(m_section); - if(tag == 0) - return m_channels; - - STags::iterator it = m_tags.find(tag); - if(it == m_tags.end()) - { - SChannels channels; - return channels; - } - return GetChannels(it->second); -} - -SChannels CHTSPDirectorySession::GetChannels(STag& tag) -{ - CSingleLock lock(m_section); - SChannels channels; - - std::vector<int>::iterator it; - for(it = tag.channels.begin(); it != tag.channels.end(); ++it) - { - SChannels::iterator it2 = m_channels.find(*it); - if(it2 == m_channels.end()) - { - CLog::Log(LOGERROR, "CHTSPDirectorySession::GetChannels - tag points to unknown channel %d", *it); - continue; - } - channels[*it] = it2->second; - } - return channels; -} - - -STags CHTSPDirectorySession::GetTags() -{ - CSingleLock lock(m_section); - return m_tags; -} - -CHTSPDirectory::CHTSPDirectory(void) -{ - m_session = NULL; -} - -CHTSPDirectory::~CHTSPDirectory(void) -{ - CHTSPDirectorySession::Release(m_session); -} - - -bool CHTSPDirectory::GetChannels(const CURL &base, CFileItemList &items) -{ - SChannels channels = m_session->GetChannels(); - return GetChannels(base, items, channels, 0); -} - -bool CHTSPDirectory::GetChannels( const CURL &base - , CFileItemList &items - , SChannels channels - , int tag) -{ - CURL url(base); - - SEvent event; - - for(SChannels::iterator it = channels.begin(); it != channels.end(); ++it) - { - if(!m_session->GetEvent(event, it->second.event)) - event.Clear(); - - CFileItemPtr item(new CFileItem("", true)); - - url.SetFileName(""); - item->SetPath(url.Get()); - CHTSPSession::ParseItem(it->second, tag, event, *item); - item->m_bIsFolder = false; - item->SetLabel(item->m_strTitle); - item->m_strTitle = StringUtils::Format("%d", it->second.num); - - items.Add(item); - } - - items.AddSortMethod(SortByTrackNumber, 554, LABEL_MASKS("%K[ - %B]", "%Z", "%L", "")); - items.AddSortMethod(SortByAlbum, 558, LABEL_MASKS("%B", "%Z", "%L", ""), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone); - items.AddSortMethod(SortByLabel, 551, LABEL_MASKS("%Z", "%B", "%L", ""), CSettings::Get().GetBool("filelists.ignorethewhensorting") ? SortAttributeIgnoreArticle : SortAttributeNone); - - items.SetContent("livetv"); - - return !channels.empty(); - -} - -bool CHTSPDirectory::GetTag(const CURL &base, CFileItemList &items) -{ - CURL url(base); - - int id = 0; - if (url.GetFileName().size() >= 5) - id = atoi(url.GetFileName().substr(5).c_str()); - - SChannels channels = m_session->GetChannels(id); - if(channels.empty()) - return false; - - return GetChannels(base, items, channels, id); -} - - -bool CHTSPDirectory::GetDirectory(const CURL& url, CFileItemList &items) -{ - CHTSPDirectorySession::Release(m_session); - if(!(m_session = CHTSPDirectorySession::Acquire(url))) - return false; - - - if(url.GetFileName().empty()) - { - CFileItemPtr item; - - item.reset(new CFileItem("", true)); - CURL url2(url); - url2.SetFileName("tags/0/"); - item->SetURL(url2); - item->SetLabel(g_localizeStrings.Get(22018)); - item->SetLabelPreformated(true); - items.Add(item); - - STags tags = m_session->GetTags(); - std::string filename, label; - for(STags::iterator it = tags.begin(); it != tags.end(); ++it) - { - filename = StringUtils::Format("tags/%d/", it->second.id); - label = StringUtils::Format("Tag: %s", it->second.name.c_str()); - - item.reset(new CFileItem("", true)); - CURL url2(url); - url2.SetFileName(filename); - item->SetURL(url2); - item->SetLabel(label); - item->SetLabelPreformated(true); - item->SetArt("thumb", it->second.icon); - items.Add(item); - } - - return true; - } - else if (StringUtils::StartsWith(url.GetFileName(), "tags/")) - return GetTag(url, items); - return false; -} diff --git a/xbmc/filesystem/HTSPDirectory.h b/xbmc/filesystem/HTSPDirectory.h deleted file mode 100644 index 953883a9e2..0000000000 --- a/xbmc/filesystem/HTSPDirectory.h +++ /dev/null @@ -1,95 +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/>. - * - */ - -#pragma once -#include "IDirectory.h" -#include "threads/Thread.h" -#include "threads/CriticalSection.h" -#include "threads/Event.h" -#include "HTSPSession.h" -#include <memory> - -class CURL; -class CFileItem; typedef std::shared_ptr<CFileItem> CFileItemPtr; - -namespace HTSP -{ - class CHTSPDirectorySession - : public CThread - { - public: - bool GetEvent(SEvent& event, uint32_t id); - SChannels GetChannels(); - SChannels GetChannels(int tag); - SChannels GetChannels(STag &tag); - STags GetTags(); - htsmsg_t* ReadResult(htsmsg_t* m); - - - static CHTSPDirectorySession* Acquire(const CURL& url); - static void Release(CHTSPDirectorySession* &session); - static void CheckIdle(DWORD idle = 60000); - - protected: - CHTSPDirectorySession(); - ~CHTSPDirectorySession(); - - bool Open(const CURL& url); - void Close(); - - private: - virtual void Process(); - CHTSPSession m_session; - SChannels m_channels; - STags m_tags; - SEvents m_events; - CCriticalSection m_section; - CEvent m_started; - - struct SMessage - { - CEvent * event; - htsmsg_t * msg; - }; - typedef std::map<int, SMessage> SMessages; - - SMessages m_queue; - }; -} - -namespace XFILE -{ - - class CHTSPDirectory : public IDirectory - { - public: - CHTSPDirectory(void); - virtual ~CHTSPDirectory(void); - virtual bool GetDirectory(const CURL& url, CFileItemList &items); - virtual DIR_CACHE_TYPE GetCacheType(const CURL& url) const { return DIR_CACHE_ONCE; }; - private: - bool GetChannels(const CURL& base, CFileItemList &items); - bool GetChannels(const CURL& base, CFileItemList &items, HTSP::SChannels channels, int tag); - bool GetTag (const CURL& base, CFileItemList &items); - - HTSP::CHTSPDirectorySession* m_session; - }; -} - diff --git a/xbmc/filesystem/HTSPSession.cpp b/xbmc/filesystem/HTSPSession.cpp deleted file mode 100644 index 0465ec21d5..0000000000 --- a/xbmc/filesystem/HTSPSession.cpp +++ /dev/null @@ -1,670 +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 "HTSPSession.h" -#include "URL.h" -#include "video/VideoInfoTag.h" -#include "FileItem.h" -#include "utils/log.h" -#include "utils/StringUtils.h" -#include "utils/SystemInfo.h" -#include "settings/AdvancedSettings.h" -#include "Util.h" - -#include <netinet/in.h> -#include <netinet/tcp.h> -#include <sys/socket.h> - -extern "C" { -#include "libhts/net.h" -#include "libhts/htsmsg.h" -#include "libhts/htsmsg_binary.h" -#include "libhts/sha1.h" -} - - -struct SContentType -{ - unsigned id; - const char* genre; -}; - -static const SContentType g_dvb_content_group[] = -{ { 0x1, "Movie/Drama" } -, { 0x2, "News/Current Affairs" } -, { 0x3, "Show/Game show" } -, { 0x4, "Sports" } -, { 0x5, "Children's/Youth" } -, { 0x6, "Music/Ballet/Dance" } -, { 0x7, "Arts/Culture (without music)" } -, { 0x8, "Social/Political issues/Economics" } -, { 0x9, "Childrens/Youth Education/Science/Factual" } -, { 0xa, "Leisure hobbies" } -, { 0xb, "Misc" } -, { 0xf, "Unknown" } -}; - -static const SContentType g_dvb_content_type[] = -{ -// movie/drama - { 0x11, "Detective/Thriller" } -, { 0x12, "Adventure/Western/War" } -, { 0x13, "Science Fiction/Fantasy/Horror" } -, { 0x14, "Comedy" } -, { 0x15, "Soap/Melodrama/Folkloric" } -, { 0x16, "Romance" } -, { 0x17, "Serious/ClassicalReligion/Historical" } -, { 0x18, "Adult Movie/Drama" } - -// news/current affairs -, { 0x21, "News/Weather Report" } -, { 0x22, "Magazine" } -, { 0x23, "Documentary" } -, { 0x24, "Discussion/Interview/Debate" } - -// show/game show -, { 0x31, "Game show/Quiz/Contest" } -, { 0x32, "Variety" } -, { 0x33, "Talk" } - -// sports -, { 0x41, "Special Event (Olympics/World cup/...)" } -, { 0x42, "Magazine" } -, { 0x43, "Football/Soccer" } -, { 0x44, "Tennis/Squash" } -, { 0x45, "Team sports (excluding football)" } -, { 0x46, "Athletics" } -, { 0x47, "Motor Sport" } -, { 0x48, "Water Sport" } -, { 0x49, "Winter Sports" } -, { 0x4a, "Equestrian" } -, { 0x4b, "Martial sports" } - -// childrens/youth -, { 0x51, "Pre-school" } -, { 0x52, "Entertainment (6 to 14 year-olds)" } -, { 0x53, "Entertainment (10 to 16 year-olds)" } -, { 0x54, "Informational/Educational/Schools" } -, { 0x55, "Cartoons/Puppets" } - -// music/ballet/dance -, { 0x61, "Rock/Pop" } -, { 0x62, "Serious music/Classical Music" } -, { 0x63, "Folk/Traditional music" } -, { 0x64, "Jazz" } -, { 0x65, "Musical/Opera" } -, { 0x66, "Ballet" } - -// arts/culture -, { 0x71, "Performing Arts" } -, { 0x72, "Fine Arts" } -, { 0x73, "Religion" } -, { 0x74, "Popular Culture/Tradital Arts" } -, { 0x75, "Literature" } -, { 0x76, "Film/Cinema" } -, { 0x77, "Experimental Film/Video" } -, { 0x78, "Broadcasting/Press" } -, { 0x79, "New Media" } -, { 0x7a, "Magazine" } -, { 0x7b, "Fashion" } - -// social/political/economic -, { 0x81, "Magazine/Report/Domentary" } -, { 0x82, "Economics/Social Advisory" } -, { 0x83, "Remarkable People" } - -// children's youth: educational/science/factual -, { 0x91, "Nature/Animals/Environment" } -, { 0x92, "Technology/Natural sciences" } -, { 0x93, "Medicine/Physiology/Psychology" } -, { 0x94, "Foreign Countries/Expeditions" } -, { 0x95, "Social/Spiritual Sciences" } -, { 0x96, "Further Education" } -, { 0x97, "Languages" } - -// leisure hobbies -, { 0xa1, "Tourism/Travel" } -, { 0xa2, "Handicraft" } -, { 0xa3, "Motoring" } -, { 0xa4, "Fitness & Health" } -, { 0xa5, "Cooking" } -, { 0xa6, "Advertisement/Shopping" } -, { 0xa7, "Gardening" } - -// misc -, { 0xb0, "Original Language" } -, { 0xb1, "Black and White" } -, { 0xb2, "Unpublished" } -, { 0xb3, "Live Broadcast" } -}; - -using namespace std; -using namespace HTSP; - -string CHTSPSession::GetGenre(unsigned type) -{ - // look for full content - for(unsigned int i = 0; i < ARRAY_SIZE(g_dvb_content_type); i++) - { - if(g_dvb_content_type[i].id == type) - return g_dvb_content_type[i].genre; - } - - // look for group - type = (type >> 4) & 0xf; - for(unsigned int i = 0; i < ARRAY_SIZE(g_dvb_content_group); i++) - { - if(g_dvb_content_group[i].id == type) - return g_dvb_content_group[i].genre; - } - - return ""; -} - -CHTSPSession::CHTSPSession() - : m_fd(INVALID_SOCKET) - , m_seq(0) - , m_challenge(NULL) - , m_challenge_len(0) - , m_protocol(0) - , m_queue_size(1000) -{ -} - -CHTSPSession::~CHTSPSession() -{ - Close(); -} - -void CHTSPSession::Abort() -{ - shutdown(m_fd, SHUT_RDWR); -} - -void CHTSPSession::Close() -{ - if(m_fd != INVALID_SOCKET) - { - closesocket(m_fd); - m_fd = INVALID_SOCKET; - } - - if(m_challenge) - { - free(m_challenge); - m_challenge = NULL; - m_challenge_len = 0; - } -} - -bool CHTSPSession::Connect(const std::string& hostname, int port) -{ - char errbuf[1024]; - int errlen = sizeof(errbuf); - htsmsg_t *m; -// const char *method; - const char *server, *version; - const void * chall = NULL; - size_t chall_len = 0; - int32_t proto = 0; - - if(port == 0) - port = 9982; - - m_fd = htsp_tcp_connect(hostname.c_str() - , port - , errbuf, errlen, 3000); - if(m_fd == INVALID_SOCKET) - { - CLog::Log(LOGERROR, "CHTSPSession::Open - failed to connect to server (%s)\n", errbuf); - return false; - } - - // send hello - m = htsmsg_create_map(); - htsmsg_add_str(m, "method", "hello"); - std::string fullAppName = CSysInfo::GetAppName(); - fullAppName += " Media Center"; - htsmsg_add_str(m, "clientname", fullAppName.c_str()); - htsmsg_add_u32(m, "htspversion", 1); - - // read welcome - if((m = ReadResult(m)) == NULL) - { - CLog::Log(LOGERROR, "CHTSPSession::Open - failed to read greeting from server"); - return false; - } -// method = htsmsg_get_str(m, "method"); - htsmsg_get_s32(m, "htspversion", &proto); - server = htsmsg_get_str(m, "servername"); - version = htsmsg_get_str(m, "serverversion"); - htsmsg_get_bin(m, "challenge", &chall, &chall_len); - - CLog::Log(LOGDEBUG, "CHTSPSession::Open - connected to server: [%s], version: [%s], proto: %d" - , server ? server : "", version ? version : "", proto); - - m_protocol = proto; - - if(chall && chall_len) - { - m_challenge = malloc(chall_len); - m_challenge_len = chall_len; - memcpy(m_challenge, chall, chall_len); - } - - htsmsg_destroy(m); - return true; -} - -bool CHTSPSession::Auth(const std::string& username, const std::string& password) -{ - htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "method" , "authenticate"); - htsmsg_add_str(m, "username", username.c_str()); - - if(password != "" && m_challenge) - { - struct HTSSHA1* shactx = (struct HTSSHA1*) malloc(hts_sha1_size); - uint8_t d[20]; - hts_sha1_init(shactx); - hts_sha1_update(shactx - , (const uint8_t *)password.c_str() - , password.length()); - hts_sha1_update(shactx - , (const uint8_t *)m_challenge - , m_challenge_len); - hts_sha1_final(shactx, d); - htsmsg_add_bin(m, "digest", d, 20); - free(shactx); - } - - return ReadSuccess(m, false, "get reply from authentication with server"); -} - -htsmsg_t* CHTSPSession::ReadMessage(int timeout) -{ - void* buf; - uint32_t l; - int x; - - if(m_queue.size()) - { - htsmsg_t* m = m_queue.front(); - m_queue.pop_front(); - return m; - } - - x = htsp_tcp_read_timeout(m_fd, &l, 4, timeout); - if(x == ETIMEDOUT) - return htsmsg_create_map(); - - if(x) - { - CLog::Log(LOGERROR, "CHTSPSession::ReadMessage - Failed to read packet size (%d)\n", x); - return NULL; - } - - l = ntohl(l); - if(l == 0) - return htsmsg_create_map(); - - buf = malloc(l); - - x = htsp_tcp_read(m_fd, buf, l); - if(x) - { - CLog::Log(LOGERROR, "CHTSPSession::ReadMessage - Failed to read packet (%d)\n", x); - free(buf); - return NULL; - } - - return htsmsg_binary_deserialize(buf, l, buf); /* consumes 'buf' */ -} - -bool CHTSPSession::SendMessage(htsmsg_t* m) -{ - void* buf; - size_t len; - - if(htsmsg_binary_serialize(m, &buf, &len, -1) < 0) - { - htsmsg_destroy(m); - return false; - } - htsmsg_destroy(m); - - if(send(m_fd, (char*)buf, len, 0) < 0) - { - free(buf); - return false; - } - free(buf); - return true; -} - -htsmsg_t* CHTSPSession::ReadResult(htsmsg_t* m, bool sequence) -{ - if(sequence) - htsmsg_add_u32(m, "seq", ++m_seq); - - if(!SendMessage(m)) - return NULL; - - std::deque<htsmsg_t*> queue; - m_queue.swap(queue); - - while((m = ReadMessage())) - { - uint32_t seq; - if(!sequence) - break; - if(!htsmsg_get_u32(m, "seq", &seq) && seq == m_seq) - break; - - queue.push_back(m); - if(queue.size() >= m_queue_size) - { - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::ReadResult - maximum queue size (%u) reached", m_queue_size); - m_queue.swap(queue); - return NULL; - } - } - - m_queue.swap(queue); - - const char* error; - if(m && (error = htsmsg_get_str(m, "error"))) - { - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::ReadResult - error (%s)", error); - htsmsg_destroy(m); - return NULL; - } - uint32_t noaccess; - if(m && !htsmsg_get_u32(m, "noaccess", &noaccess) && noaccess) - { - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::ReadResult - access denied (%d)", noaccess); - htsmsg_destroy(m); - return NULL; - } - - return m; -} - -bool CHTSPSession::ReadSuccess(htsmsg_t* m, bool sequence, std::string action) -{ - if((m = ReadResult(m, sequence)) == NULL) - { - CLog::Log(LOGDEBUG, "CDVDInputStreamHTSP::ReadSuccess - failed to %s", action.c_str()); - return false; - } - htsmsg_destroy(m); - return true; -} - -bool CHTSPSession::SendSubscribe(int subscription, int channel) -{ - htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "method" , "subscribe"); - htsmsg_add_s32(m, "channelId" , channel); - htsmsg_add_s32(m, "subscriptionId", subscription); - return ReadSuccess(m, true, "subscribe to channel"); -} - -bool CHTSPSession::SendUnsubscribe(int subscription) -{ - htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "method" , "unsubscribe"); - htsmsg_add_s32(m, "subscriptionId", subscription); - return ReadSuccess(m, true, "unsubscribe from channel"); -} - -bool CHTSPSession::SendEnableAsync() -{ - htsmsg_t *m = htsmsg_create_map(); - htsmsg_add_str(m, "method", "enableAsyncMetadata"); - return ReadSuccess(m, true, "enableAsyncMetadata failed"); -} - -bool CHTSPSession::GetEvent(SEvent& event, uint32_t id) -{ - if(id == 0) - { - event.Clear(); - return false; - } - - htsmsg_t *msg = htsmsg_create_map(); - htsmsg_add_str(msg, "method", "getEvent"); - htsmsg_add_u32(msg, "eventId", id); - if((msg = ReadResult(msg, true)) == NULL) - { - CLog::Log(LOGDEBUG, "CHTSPSession::GetEvent - failed to get event %d", id); - return false; - } - return ParseEvent(msg, id, event); -} - -bool CHTSPSession::ParseEvent(htsmsg_t* msg, uint32_t id, SEvent &event) -{ - uint32_t start, stop, next, content; - const char *title, *desc; - if( htsmsg_get_u32(msg, "start", &start) - || htsmsg_get_u32(msg, "stop" , &stop) - || (title = htsmsg_get_str(msg, "title")) == NULL) - { - CLog::Log(LOGDEBUG, "CHTSPSession::ParseEvent - malformed event"); - htsmsg_print(msg); - htsmsg_destroy(msg); - return false; - } - event.Clear(); - event.id = id; - event.start = start; - event.stop = stop; - event.title = title; - if((desc = htsmsg_get_str(msg, "description"))) - event.descs = desc; - if(htsmsg_get_u32(msg, "nextEventId", &next)) - event.next = 0; - else - event.next = next; - - if(htsmsg_get_u32(msg, "contentType", &content) == 0) - event.content = content; - - CLog::Log(LOGDEBUG, "CHTSPSession::ParseEvent - id:%u, title:'%s', desc:'%s', start:%u, stop:%u, next:%u, content:%u" - , event.id - , event.title.c_str() - , event.descs.c_str() - , event.start - , event.stop - , event.next - , event.content); - - return true; -} - -void CHTSPSession::ParseChannelUpdate(htsmsg_t* msg, SChannels &channels) -{ - uint32_t id, event = 0, num = 0; - const char *name, *icon; - if(htsmsg_get_u32(msg, "channelId", &id)) - { - CLog::Log(LOGERROR, "CHTSPSession::ParseChannelUpdate - malformed message received"); - htsmsg_print(msg); - return; - } - - SChannel &channel = channels[id]; - channel.id = id; - - if(htsmsg_get_u32(msg, "eventId", &event) == 0) - channel.event = event; - - if((name = htsmsg_get_str(msg, "channelName"))) - channel.name = name; - - if((icon = htsmsg_get_str(msg, "channelIcon"))) - channel.icon = icon; - - if(htsmsg_get_u32(msg, "channelNumber", &num) == 0) - { - if(num == 0) - channel.num = id + 1000; - else - channel.num = num; - } - else - channel.num = id; // fallback older servers - - htsmsg_t *tags; - - if((tags = htsmsg_get_list(msg, "tags"))) - { - channel.tags.clear(); - - htsmsg_field_t *f; - HTSMSG_FOREACH(f, tags) - { - if(f->hmf_type != HMF_S64) - continue; - channel.tags.push_back((int)f->hmf_s64); - } - } - - - CLog::Log(LOGDEBUG, "CHTSPSession::ParseChannelUpdate - id:%u, name:'%s', icon:'%s', event:%u" - , id, name ? name : "(null)", icon ? icon : "(null)", event); -} - -void CHTSPSession::ParseChannelRemove(htsmsg_t* msg, SChannels &channels) -{ - uint32_t id; - if(htsmsg_get_u32(msg, "channelId", &id)) - { - CLog::Log(LOGERROR, "CDVDInputStreamHTSP::ParseChannelRemove - malformed message received"); - htsmsg_print(msg); - return; - } - CLog::Log(LOGDEBUG, "CHTSPSession::ParseChannelRemove - id:%u", id); - - channels.erase(id); -} - -void CHTSPSession::ParseTagUpdate(htsmsg_t* msg, STags &tags) -{ - uint32_t id; - const char *name, *icon; - if(htsmsg_get_u32(msg, "tagId", &id)) - { - CLog::Log(LOGERROR, "CHTSPSession::ParseTagUpdate - malformed message received"); - htsmsg_print(msg); - return; - } - STag &tag = tags[id]; - tag.id = id; - - if((icon = htsmsg_get_str(msg, "tagIcon"))) - tag.icon = icon; - - if((name = htsmsg_get_str(msg, "tagName"))) - tag.name = name; - - htsmsg_t *channels; - - if((channels = htsmsg_get_list(msg, "members"))) - { - tag.channels.clear(); - - htsmsg_field_t *f; - HTSMSG_FOREACH(f, channels) - { - if(f->hmf_type != HMF_S64) - continue; - tag.channels.push_back((int)f->hmf_s64); - } - } - - CLog::Log(LOGDEBUG, "CHTSPSession::ParseTagUpdate - id:%u, name:'%s', icon:'%s'" - , id, name ? name : "(null)", icon ? icon : "(null)"); - -} - -void CHTSPSession::ParseTagRemove(htsmsg_t* msg, STags &tags) -{ - uint32_t id; - if(htsmsg_get_u32(msg, "tagId", &id)) - { - CLog::Log(LOGERROR, "CHTSPSession::ParseTagRemove - malformed message received"); - htsmsg_print(msg); - return; - } - CLog::Log(LOGDEBUG, "CHTSPSession::ParseTagRemove - id:%u", id); - - tags.erase(id); -} - -bool CHTSPSession::ParseItem(const SChannel& channel, int tagid, const SEvent& event, CFileItem& item) -{ - CVideoInfoTag* tag = item.GetVideoInfoTag(); - - CURL url(item.GetPath()); - std::string temp = StringUtils::Format("tags/%d/%d.ts", tagid, channel.id); - url.SetFileName(temp); - - tag->m_iSeason = 0; - tag->m_iEpisode = 0; - tag->m_iTrack = channel.num; - tag->m_strAlbum = channel.name; - tag->m_strShowTitle = event.title; - tag->m_strPlot = event.descs; - tag->m_strStatus = "livetv"; - tag->m_genre = StringUtils::Split(GetGenre(event.content), g_advancedSettings.m_videoItemSeparator); - - tag->m_strTitle = tag->m_strAlbum; - if(tag->m_strShowTitle.length() > 0) - tag->m_strTitle += " : " + tag->m_strShowTitle; - - item.SetPath(url.Get()); - item.m_strTitle = tag->m_strTitle; - item.SetArt("thumb", channel.icon); - item.SetMimeType("video/X-htsp"); - return true; -} - -bool CHTSPSession::ParseQueueStatus (htsmsg_t* msg, SQueueStatus &queue) -{ - if(htsmsg_get_u32(msg, "packets", &queue.packets) - || htsmsg_get_u32(msg, "bytes", &queue.bytes) - || htsmsg_get_u32(msg, "Bdrops", &queue.bdrops) - || htsmsg_get_u32(msg, "Pdrops", &queue.pdrops) - || htsmsg_get_u32(msg, "Idrops", &queue.idrops)) - { - CLog::Log(LOGERROR, "CHTSPSession::ParseQueueStatus - malformed message received"); - htsmsg_print(msg); - return false; - } - - /* delay isn't always transmitted */ - if(htsmsg_get_u32(msg, "delay", &queue.delay)) - queue.delay = 0; - - return true; -} diff --git a/xbmc/filesystem/HTSPSession.h b/xbmc/filesystem/HTSPSession.h deleted file mode 100644 index 9c31c8ece8..0000000000 --- a/xbmc/filesystem/HTSPSession.h +++ /dev/null @@ -1,232 +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/>. - * - */ - -#pragma once -#include "deque" -#include "system.h" // for SOCKET - -#include <algorithm> -#include <string> -#include <vector> -#include <map> - -typedef struct htsmsg htsmsg_t; - -class CFileItem; - -namespace HTSP -{ - -template<typename T> -class const_circular_iter - : public std::iterator< typename std::iterator_traits<T>::iterator_category - , typename std::iterator_traits<T>::value_type - , typename std::iterator_traits<T>::difference_type - , typename std::iterator_traits<T>::pointer - , typename std::iterator_traits<T>::reference> -{ - protected: - T begin; - T end; - T iter; - public: - typedef typename std::iterator_traits<T>::value_type value_type; - typedef typename std::iterator_traits<T>::difference_type difference_type; - typedef typename std::iterator_traits<T>::pointer pointer; - typedef typename std::iterator_traits<T>::reference reference; - - const_circular_iter(const const_circular_iter& src) : begin(src.begin), end(src.end), iter(src.iter) {}; - const_circular_iter(const T& b, const T& e) : begin(b), end(e), iter(b) {}; - const_circular_iter(const T& b, const T& e, const T& c) : begin(b), end(e), iter(c) {}; - const_circular_iter<T>& operator++() - { - if(begin == end) - return(*this); - ++iter; - if (iter == end) - iter = begin; - return(*this); - } - - const_circular_iter<T>& operator--() - { - if(begin == end) - return(*this); - if (iter == begin) - iter = end; - iter--; - return(*this); - } - - reference operator*() const { return (*iter); } - const pointer operator->() const { return &(*iter); } - bool operator==(const const_circular_iter<T>& rhs) const { return (iter == rhs.iter); } - bool operator==(const T& rhs) const { return (iter == rhs); } - bool operator!=(const const_circular_iter<T>& rhs) const { return ! operator==(rhs); } - bool operator!=(const T& rhs) const { return ! operator==(rhs); } -}; - -struct STag -{ - int id; - std::string name; - std::string icon; - std::vector<int> channels; - - STag() { Clear(); } - void Clear() - { - id = 0; - name.clear(); - icon.clear(); - channels.clear(); - } - bool BelongsTo(int channel) const - { - return std::find(channels.begin(), channels.end(), channel) != channels.end(); - } - -}; - -struct SChannel -{ - int id; - std::string name; - std::string icon; - int event; - int num; - std::vector<int> tags; - - SChannel() { Clear(); } - void Clear() - { - id = 0; - event = 0; - num = 0; - name.clear(); - icon.clear(); - tags.clear(); - } - bool MemberOf(int tag) const - { - return std::find(tags.begin(), tags.end(), tag) != tags.end(); - } - bool operator<(const SChannel &right) const - { - return num < right.num; - } -}; - -struct SEvent -{ - int id; - int next; - - int start; - int stop; - unsigned content; - std::string title; - std::string descs; - - SEvent() { Clear(); } - void Clear() - { - id = 0; - next = 0; - start = 0; - stop = 0; - content = 0; - title.clear(); - descs.clear(); - } -}; - -struct SQueueStatus -{ - uint32_t packets; // Number of data packets in queue. - uint32_t bytes; // Number of bytes in queue. - uint32_t delay; // Estimated delay of queue (in µs) - uint32_t bdrops; // Number of B-frames dropped - uint32_t pdrops; // Number of P-frames dropped - uint32_t idrops; // Number of I-frames dropped - - SQueueStatus() { Clear(); } - void Clear() - { - packets = 0; - bytes = 0; - delay = 0; - bdrops = 0; - pdrops = 0; - idrops = 0; - } -}; - -typedef std::map<int, SChannel> SChannels; -typedef std::map<int, STag> STags; -typedef std::map<int, SEvent> SEvents; - - -class CHTSPSession -{ -public: - CHTSPSession(); - ~CHTSPSession(); - - bool Connect(const std::string& hostname, int port); - void Close(); - void Abort(); - bool Auth(const std::string& username, const std::string& password); - - htsmsg_t* ReadMessage(int timeout = 10000); - bool SendMessage(htsmsg_t* m); - - htsmsg_t* ReadResult (htsmsg_t* m, bool sequence = true); - bool ReadSuccess(htsmsg_t* m, bool sequence = true, std::string action = ""); - - bool SendSubscribe (int subscription, int channel); - bool SendUnsubscribe(int subscription); - bool SendEnableAsync(); - bool GetEvent(SEvent& event, uint32_t id); - - int GetProtocol() { return m_protocol; } - unsigned AddSequence() { return ++m_seq; } - - static bool ParseEvent (htsmsg_t* msg, uint32_t id, SEvent &event); - static void ParseChannelUpdate(htsmsg_t* msg, SChannels &channels); - static void ParseChannelRemove(htsmsg_t* msg, SChannels &channels); - static void ParseTagUpdate (htsmsg_t* msg, STags &tags); - static void ParseTagRemove (htsmsg_t* msg, STags &tags); - static bool ParseItem (const SChannel& channel, int tag, const SEvent& event, CFileItem& item); - static bool ParseQueueStatus (htsmsg_t* msg, SQueueStatus &queue); - static std::string GetGenre(unsigned type); - -private: - SOCKET m_fd; - unsigned m_seq; - void* m_challenge; - int m_challenge_len; - int m_protocol; - - std::deque<htsmsg_t*> m_queue; - const unsigned int m_queue_size; -}; - -} diff --git a/xbmc/filesystem/Makefile.in b/xbmc/filesystem/Makefile.in index 0096d2f454..72f1087ca9 100644 --- a/xbmc/filesystem/Makefile.in +++ b/xbmc/filesystem/Makefile.in @@ -27,8 +27,6 @@ SRCS += FTPDirectory.cpp SRCS += FTPParse.cpp SRCS += HDHomeRunDirectory.cpp SRCS += HDHomeRunFile.cpp -SRCS += HTSPDirectory.cpp -SRCS += HTSPSession.cpp SRCS += HTTPDirectory.cpp SRCS += HTTPFile.cpp SRCS += IDirectory.cpp diff --git a/xbmc/filesystem/ZeroconfDirectory.cpp b/xbmc/filesystem/ZeroconfDirectory.cpp index c99faeb2c1..fc3388ebca 100644 --- a/xbmc/filesystem/ZeroconfDirectory.cpp +++ b/xbmc/filesystem/ZeroconfDirectory.cpp @@ -48,8 +48,6 @@ namespace return "SAMBA"; else if(fcr_service_type == "_ftp._tcp.") return "FTP"; - else if(fcr_service_type == "_htsp._tcp.") - return "HTS"; else if(fcr_service_type == "_daap._tcp.") return "iTunes Music Sharing"; else if(fcr_service_type == "_webdav._tcp.") @@ -67,8 +65,6 @@ namespace fr_protocol = "smb"; else if(fcr_service_type == "_ftp._tcp.") fr_protocol = "ftp"; - else if(fcr_service_type == "_htsp._tcp.") - fr_protocol = "htsp"; else if(fcr_service_type == "_daap._tcp.") fr_protocol = "daap"; else if(fcr_service_type == "_webdav._tcp.") diff --git a/xbmc/network/GUIDialogNetworkSetup.cpp b/xbmc/network/GUIDialogNetworkSetup.cpp index d8f199d6d6..6fbfe7ee29 100644 --- a/xbmc/network/GUIDialogNetworkSetup.cpp +++ b/xbmc/network/GUIDialogNetworkSetup.cpp @@ -118,7 +118,6 @@ void CGUIDialogNetworkSetup::OnInitWindow() #ifdef HAS_FILESYSTEM_SMB labels.push_back(make_pair(g_localizeStrings.Get(20171), NET_PROTOCOL_SMB)); #endif - labels.push_back(make_pair(g_localizeStrings.Get(20256), NET_PROTOCOL_HTSP)); labels.push_back(make_pair(g_localizeStrings.Get(20301), NET_PROTOCOL_HTTPS)); labels.push_back(make_pair(g_localizeStrings.Get(20300), NET_PROTOCOL_HTTP)); labels.push_back(make_pair(g_localizeStrings.Get(20254), NET_PROTOCOL_DAVS)); @@ -199,8 +198,6 @@ void CGUIDialogNetworkSetup::OnProtocolChange() m_port = "443"; else if (m_protocol == NET_PROTOCOL_DAAP) m_port = "3689"; - else if (m_protocol == NET_PROTOCOL_HTSP) - m_port = "9982"; else if (m_protocol == NET_PROTOCOL_SFTP) m_port = "22"; else @@ -228,8 +225,7 @@ void CGUIDialogNetworkSetup::UpdateButtons() // remote path SET_CONTROL_LABEL2(CONTROL_REMOTE_PATH, m_path); CONTROL_ENABLE_ON_CONDITION(CONTROL_REMOTE_PATH, m_protocol != NET_PROTOCOL_DAAP && - m_protocol != NET_PROTOCOL_UPNP && - m_protocol != NET_PROTOCOL_HTSP); + m_protocol != NET_PROTOCOL_UPNP); if (m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || @@ -262,7 +258,6 @@ void CGUIDialogNetworkSetup::UpdateButtons() m_protocol == NET_PROTOCOL_HTTPS || m_protocol == NET_PROTOCOL_DAV || m_protocol == NET_PROTOCOL_DAVS || - m_protocol == NET_PROTOCOL_HTSP || m_protocol == NET_PROTOCOL_RSS || m_protocol == NET_PROTOCOL_DAAP || m_protocol == NET_PROTOCOL_SFTP); @@ -278,7 +273,7 @@ void CGUIDialogNetworkSetup::UpdateButtons() SendMessage(GUI_MSG_SET_TYPE, CONTROL_PASSWORD, CGUIEditControl::INPUT_TYPE_PASSWORD, 12326); // TODO: FIX BETTER DAAP SUPPORT - // server browse should be disabled if we are in DAAP, FTP, HTTP, HTTPS, RSS, HTSP, DAV or DAVS + // server browse should be disabled if we are in DAAP, FTP, HTTP, HTTPS, RSS, DAV or DAVS CONTROL_ENABLE_ON_CONDITION(CONTROL_SERVER_BROWSE, !m_server.empty() || !(m_protocol == NET_PROTOCOL_FTP || m_protocol == NET_PROTOCOL_HTTP || m_protocol == NET_PROTOCOL_HTTPS || @@ -286,7 +281,6 @@ void CGUIDialogNetworkSetup::UpdateButtons() m_protocol == NET_PROTOCOL_DAVS || m_protocol == NET_PROTOCOL_DAAP || m_protocol == NET_PROTOCOL_RSS || - m_protocol == NET_PROTOCOL_HTSP || m_protocol == NET_PROTOCOL_SFTP)); } @@ -311,8 +305,6 @@ std::string CGUIDialogNetworkSetup::ConstructPath() const url.SetProtocol("upnp"); else if (m_protocol == NET_PROTOCOL_RSS) url.SetProtocol("rss"); - else if (m_protocol == NET_PROTOCOL_HTSP) - url.SetProtocol("htsp"); else if (m_protocol == NET_PROTOCOL_NFS) url.SetProtocol("nfs"); else if (m_protocol == NET_PROTOCOL_SFTP) @@ -333,7 +325,6 @@ std::string CGUIDialogNetworkSetup::ConstructPath() const (m_protocol == NET_PROTOCOL_DAVS) || (m_protocol == NET_PROTOCOL_RSS) || (m_protocol == NET_PROTOCOL_DAAP && !m_server.empty()) || - (m_protocol == NET_PROTOCOL_HTSP) || (m_protocol == NET_PROTOCOL_SFTP) || (m_protocol == NET_PROTOCOL_NFS)) && !m_port.empty() && atoi(m_port.c_str()) > 0) @@ -364,8 +355,6 @@ void CGUIDialogNetworkSetup::SetPath(const std::string &path) m_protocol = NET_PROTOCOL_DAAP; else if (url.IsProtocol("upnp")) m_protocol = NET_PROTOCOL_UPNP; - else if (url.IsProtocol("htsp")) - m_protocol = NET_PROTOCOL_HTSP; else if (url.IsProtocol("rss")) m_protocol = NET_PROTOCOL_RSS; else if (url.IsProtocol("nfs")) diff --git a/xbmc/network/GUIDialogNetworkSetup.h b/xbmc/network/GUIDialogNetworkSetup.h index 07d81876e7..8d2942cbc4 100644 --- a/xbmc/network/GUIDialogNetworkSetup.h +++ b/xbmc/network/GUIDialogNetworkSetup.h @@ -36,7 +36,6 @@ public: NET_PROTOCOL_DAAP, NET_PROTOCOL_UPNP, NET_PROTOCOL_RSS, - NET_PROTOCOL_HTSP, NET_PROTOCOL_SFTP, NET_PROTOCOL_NFS}; CGUIDialogNetworkSetup(void); diff --git a/xbmc/network/ZeroconfBrowser.cpp b/xbmc/network/ZeroconfBrowser.cpp index 3fee48c7fe..7bcb07c28c 100644 --- a/xbmc/network/ZeroconfBrowser.cpp +++ b/xbmc/network/ZeroconfBrowser.cpp @@ -57,7 +57,6 @@ CZeroconfBrowser::CZeroconfBrowser():mp_crit_sec(new CCriticalSection),m_started AddServiceType("_smb._tcp."); #endif AddServiceType("_ftp._tcp."); - AddServiceType("_htsp._tcp."); AddServiceType("_daap._tcp."); AddServiceType("_webdav._tcp."); #ifdef HAS_FILESYSTEM_NFS diff --git a/xbmc/system.h b/xbmc/system.h index 99a89e1d10..b6e262d48a 100644 --- a/xbmc/system.h +++ b/xbmc/system.h @@ -55,7 +55,6 @@ #define HAS_FILESYSTEM_RTV #define HAS_FILESYSTEM_DAAP #define HAS_FILESYSTEM_SAP -#define HAS_FILESYSTEM_HTSP #ifdef HAVE_LIBSMBCLIENT #define HAS_FILESYSTEM_SMB diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index 45b1416fbe..b8b66a0a1a 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -935,11 +935,6 @@ bool URIUtils::IsSlingbox(const std::string& strFile) return IsProtocol(strFile, "sling"); } -bool URIUtils::IsHTSP(const std::string& strFile) -{ - return IsProtocol(strFile, "htsp"); -} - bool URIUtils::IsLiveTV(const std::string& strFile) { std::string strFileWithoutSlash(strFile); @@ -947,7 +942,6 @@ bool URIUtils::IsLiveTV(const std::string& strFile) if (IsHDHomeRun(strFile) || IsSlingbox(strFile) - || IsHTSP(strFile) || IsProtocol(strFile, "sap") ||(StringUtils::EndsWithNoCase(strFileWithoutSlash, ".pvr") && !PathStarts(strFileWithoutSlash, "pvr://recordings"))) return true; diff --git a/xbmc/utils/URIUtils.h b/xbmc/utils/URIUtils.h index 8d39a792ee..2d0de36ba3 100644 --- a/xbmc/utils/URIUtils.h +++ b/xbmc/utils/URIUtils.h @@ -126,7 +126,6 @@ public: static bool IsHD(const std::string& strFileName); static bool IsHDHomeRun(const std::string& strFile); static bool IsSlingbox(const std::string& strFile); - static bool IsHTSP(const std::string& strFile); static bool IsInArchive(const std::string& strFile); static bool IsInRAR(const std::string& strFile); static bool IsInternetStream(const std::string& path, bool bStrictCheck = false); diff --git a/xbmc/utils/test/TestURIUtils.cpp b/xbmc/utils/test/TestURIUtils.cpp index 89c163520e..8c6a2ddba9 100644 --- a/xbmc/utils/test/TestURIUtils.cpp +++ b/xbmc/utils/test/TestURIUtils.cpp @@ -296,11 +296,6 @@ TEST_F(TestURIUtils, IsSlingbox) EXPECT_TRUE(URIUtils::IsSlingbox("sling://path/to/file")); } -TEST_F(TestURIUtils, IsHTSP) -{ - EXPECT_TRUE(URIUtils::IsHTSP("htsp://path/to/file")); -} - TEST_F(TestURIUtils, IsInArchive) { EXPECT_TRUE(URIUtils::IsInArchive("zip://path/to/file")); @@ -334,7 +329,6 @@ TEST_F(TestURIUtils, IsLiveTV) { EXPECT_TRUE(URIUtils::IsLiveTV("hdhomerun://path/to/file")); EXPECT_TRUE(URIUtils::IsLiveTV("sling://path/to/file")); - EXPECT_TRUE(URIUtils::IsLiveTV("htsp://path/to/file")); EXPECT_TRUE(URIUtils::IsLiveTV("sap://path/to/file")); } |