├── README.md └── RTSPClientLib ├── .classpath ├── .project ├── .settings ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ └── org.eclipse.jdt.core.prefs.svn-base └── org.eclipse.jdt.core.prefs ├── .svn ├── all-wcprops ├── entries └── text-base │ ├── .classpath.svn-base │ ├── .project.svn-base │ ├── COPYING.LESSER.svn-base │ └── COPYING.svn-base ├── COPYING ├── COPYING.LESSER ├── bin └── br │ └── com │ └── voicetechnology │ └── rtspclient │ ├── HeaderMismatchException.class │ ├── IncompleteMessageException.class │ ├── InvalidMessageException.class │ ├── MissingHeaderException.class │ ├── RTSPClient.class │ ├── RTSPEntityMessage.class │ ├── RTSPMessage$1.class │ ├── RTSPMessage.class │ ├── RTSPMessageFactory.class │ ├── RTSPRequest.class │ ├── RTSPResponse.class │ ├── concepts │ ├── Client.class │ ├── ClientListener.class │ ├── Content.class │ ├── EntityMessage.class │ ├── Header.class │ ├── Message.class │ ├── MessageBuffer.class │ ├── MessageFactory.class │ ├── Request$Method.class │ ├── Request.class │ ├── Response.class │ ├── Transport.class │ └── TransportListener.class │ ├── headers │ ├── BaseIntegerHeader.class │ ├── BaseStringHeader.class │ ├── CSeqHeader.class │ ├── ContentEncodingHeader.class │ ├── ContentLengthHeader.class │ ├── ContentTypeHeader.class │ ├── SessionHeader.class │ ├── TransportHeader$LowerTransport.class │ └── TransportHeader.class │ ├── messages │ ├── RTSPDescribeRequest.class │ ├── RTSPOptionsRequest.class │ ├── RTSPPlayRequest.class │ ├── RTSPSetupRequest.class │ └── RTSPTeardownRequest.class │ ├── test │ ├── OPTIONSTest.class │ ├── PLAYTest.class │ └── SETUPandTEARDOWNTest.class │ └── transport │ ├── PlainTCP.class │ ├── SafeTransportListener.class │ └── TransportThread.class ├── doc ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── RTSP.mm.svn-base │ │ ├── rfc2326.txt.svn-base │ │ ├── rfc2616.txt.svn-base │ │ ├── rfc4566.txt.svn-base │ │ └── vlc-capture.txt.svn-base ├── RTSP.mm ├── rfc2326.txt ├── rfc2616.txt ├── rfc4566.txt └── vlc-capture.txt └── src ├── .svn ├── all-wcprops └── entries └── br ├── .svn ├── all-wcprops └── entries └── com ├── .svn ├── all-wcprops └── entries └── voicetechnology ├── .svn ├── all-wcprops └── entries └── rtspclient ├── .svn ├── all-wcprops ├── entries └── text-base │ ├── HeaderMismatchException.java.svn-base │ ├── IncompleteMessageException.java.svn-base │ ├── InvalidMessageException.java.svn-base │ ├── MissingHeaderException.java.svn-base │ ├── RTSPClient.java.svn-base │ ├── RTSPEntityMessage.java.svn-base │ ├── RTSPMessage.java.svn-base │ ├── RTSPMessageFactory.java.svn-base │ ├── RTSPRequest.java.svn-base │ └── RTSPResponse.java.svn-base ├── HeaderMismatchException.java ├── IncompleteMessageException.java ├── InvalidMessageException.java ├── MissingHeaderException.java ├── RTSPClient.java ├── RTSPEntityMessage.java ├── RTSPMessage.java ├── RTSPMessageFactory.java ├── RTSPRequest.java ├── RTSPResponse.java ├── concepts ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── Client.java.svn-base │ │ ├── ClientListener.java.svn-base │ │ ├── Content.java.svn-base │ │ ├── EntityMessage.java.svn-base │ │ ├── Header.java.svn-base │ │ ├── Message.java.svn-base │ │ ├── MessageBuffer.java.svn-base │ │ ├── MessageFactory.java.svn-base │ │ ├── Request.java.svn-base │ │ ├── Response.java.svn-base │ │ ├── Transport.java.svn-base │ │ └── TransportListener.java.svn-base ├── Client.java ├── ClientListener.java ├── Content.java ├── EntityMessage.java ├── Header.java ├── Message.java ├── MessageBuffer.java ├── MessageFactory.java ├── Request.java ├── Response.java ├── Transport.java └── TransportListener.java ├── headers ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── BaseIntegerHeader.java.svn-base │ │ ├── BaseStringHeader.java.svn-base │ │ ├── CSeqHeader.java.svn-base │ │ ├── ContentEncodingHeader.java.svn-base │ │ ├── ContentLengthHeader.java.svn-base │ │ ├── ContentTypeHeader.java.svn-base │ │ ├── SessionHeader.java.svn-base │ │ └── TransportHeader.java.svn-base ├── BaseIntegerHeader.java ├── BaseStringHeader.java ├── CSeqHeader.java ├── ContentEncodingHeader.java ├── ContentLengthHeader.java ├── ContentTypeHeader.java ├── SessionHeader.java └── TransportHeader.java ├── messages ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── RTSPDescribeRequest.java.svn-base │ │ ├── RTSPOptionsRequest.java.svn-base │ │ ├── RTSPPlayRequest.java.svn-base │ │ ├── RTSPSetupRequest.java.svn-base │ │ └── RTSPTeardownRequest.java.svn-base ├── RTSPDescribeRequest.java ├── RTSPOptionsRequest.java ├── RTSPPlayRequest.java ├── RTSPSetupRequest.java └── RTSPTeardownRequest.java ├── test ├── .svn │ ├── all-wcprops │ ├── entries │ └── text-base │ │ ├── OPTIONSTest.java.svn-base │ │ ├── PLAYTest.java.svn-base │ │ └── SETUPandTEARDOWNTest.java.svn-base ├── OPTIONSTest.java ├── PLAYTest.java └── SETUPandTEARDOWNTest.java └── transport ├── .svn ├── all-wcprops ├── entries └── text-base │ ├── PlainTCP.java.svn-base │ └── SafeTransportListener.java.svn-base ├── PlainTCP.java └── SafeTransportListener.java /README.md: -------------------------------------------------------------------------------- 1 | android-rtsp-client 2 | =================== 3 | 4 | a mini rtsp client implement 5 | -------------------------------------------------------------------------------- /RTSPClientLib/.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RTSPClientLib/.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | RTSPClientLib 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /RTSPClientLib/.settings/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 31 4 | /svn/!svn/ver/2/trunk/.settings 5 | END 6 | org.eclipse.jdt.core.prefs 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 58 10 | /svn/!svn/ver/2/trunk/.settings/org.eclipse.jdt.core.prefs 11 | END 12 | -------------------------------------------------------------------------------- /RTSPClientLib/.settings/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/.settings 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | org.eclipse.jdt.core.prefs 30 | file 31 | 32 | 33 | 34 | 35 | 2009-12-17T16:32:55.000000Z 36 | 37f353211aee29304d8fdb7d26849a50 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 618 62 | 63 | -------------------------------------------------------------------------------- /RTSPClientLib/.settings/.svn/text-base/org.eclipse.jdt.core.prefs.svn-base: -------------------------------------------------------------------------------- 1 | #Fri Dec 11 16:28:57 BRST 2009 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.6 13 | -------------------------------------------------------------------------------- /RTSPClientLib/.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | #Fri Dec 11 16:28:57 BRST 2009 2 | eclipse.preferences.version=1 3 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=1.6 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 12 | org.eclipse.jdt.core.compiler.source=1.6 13 | -------------------------------------------------------------------------------- /RTSPClientLib/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 21 4 | /svn/!svn/ver/1/trunk 5 | END 6 | .classpath 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 32 10 | /svn/!svn/ver/2/trunk/.classpath 11 | END 12 | .project 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 30 16 | /svn/!svn/ver/2/trunk/.project 17 | END 18 | COPYING.LESSER 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 36 22 | /svn/!svn/ver/2/trunk/COPYING.LESSER 23 | END 24 | COPYING 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 29 28 | /svn/!svn/ver/2/trunk/COPYING 29 | END 30 | -------------------------------------------------------------------------------- /RTSPClientLib/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | https://rtsplib-java.googlecode.com/svn/trunk 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:18:19.266336Z 11 | 1 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | .classpath 30 | file 31 | 2 32 | 33 | 34 | 35 | 2009-12-17T16:32:55.000000Z 36 | 0feefca3562e5167ed8224d805b3b922 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 295 62 | 63 | .project 64 | file 65 | 2 66 | 67 | 68 | 69 | 2010-01-04T17:16:29.000000Z 70 | 9021831a170ff38866367a766c7dac72 71 | 2010-01-04T21:59:35.170006Z 72 | 2 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 372 96 | 97 | COPYING.LESSER 98 | file 99 | 2 100 | 101 | 102 | 103 | 2010-01-04T17:01:40.000000Z 104 | b52f2d57d10c4f7ee67a7eb9615d5d24 105 | 2010-01-04T21:59:35.170006Z 106 | 2 107 | paulo.panhoto 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 7637 130 | 131 | doc 132 | dir 133 | 134 | src 135 | dir 136 | 137 | COPYING 138 | file 139 | 2 140 | 141 | 142 | 143 | 2010-01-04T17:02:37.000000Z 144 | d32239bcb673463ab874e80d47fae504 145 | 2010-01-04T21:59:35.170006Z 146 | 2 147 | paulo.panhoto 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 35147 170 | 171 | .settings 172 | dir 173 | 174 | -------------------------------------------------------------------------------- /RTSPClientLib/.svn/text-base/.classpath.svn-base: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /RTSPClientLib/.svn/text-base/.project.svn-base: -------------------------------------------------------------------------------- 1 | 2 | 3 | RTSPClientLib 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/HeaderMismatchException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/HeaderMismatchException.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/IncompleteMessageException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/IncompleteMessageException.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/InvalidMessageException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/InvalidMessageException.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/MissingHeaderException.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/MissingHeaderException.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPClient.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPClient.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPEntityMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPEntityMessage.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPMessage$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPMessage$1.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPMessage.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPMessageFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPMessageFactory.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPRequest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPResponse.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/RTSPResponse.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Client.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Client.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/ClientListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/ClientListener.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Content.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Content.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/EntityMessage.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/EntityMessage.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Header.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Header.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Message.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Message.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/MessageBuffer.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/MessageBuffer.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/MessageFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/MessageFactory.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Request$Method.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Request$Method.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Request.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Request.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Response.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Response.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Transport.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/Transport.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/TransportListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/concepts/TransportListener.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/BaseIntegerHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/BaseIntegerHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/BaseStringHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/BaseStringHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/CSeqHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/CSeqHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/ContentEncodingHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/ContentEncodingHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/ContentLengthHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/ContentLengthHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/ContentTypeHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/ContentTypeHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/SessionHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/SessionHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/TransportHeader$LowerTransport.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/TransportHeader$LowerTransport.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/TransportHeader.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/headers/TransportHeader.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPDescribeRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPDescribeRequest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPOptionsRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPOptionsRequest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPPlayRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPPlayRequest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPSetupRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPSetupRequest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPTeardownRequest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/messages/RTSPTeardownRequest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/test/OPTIONSTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/test/OPTIONSTest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/test/PLAYTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/test/PLAYTest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/test/SETUPandTEARDOWNTest.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/test/SETUPandTEARDOWNTest.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/transport/PlainTCP.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/transport/PlainTCP.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/transport/SafeTransportListener.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/transport/SafeTransportListener.class -------------------------------------------------------------------------------- /RTSPClientLib/bin/br/com/voicetechnology/rtspclient/transport/TransportThread.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/srclib/android-rtsp-client/9ea8d72ed9406c2732282a8dcb89d4f6a50782dc/RTSPClientLib/bin/br/com/voicetechnology/rtspclient/transport/TransportThread.class -------------------------------------------------------------------------------- /RTSPClientLib/doc/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 25 4 | /svn/!svn/ver/2/trunk/doc 5 | END 6 | RTSP.mm 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 33 10 | /svn/!svn/ver/2/trunk/doc/RTSP.mm 11 | END 12 | vlc-capture.txt 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 41 16 | /svn/!svn/ver/2/trunk/doc/vlc-capture.txt 17 | END 18 | rfc2326.txt 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 37 22 | /svn/!svn/ver/2/trunk/doc/rfc2326.txt 23 | END 24 | rfc2616.txt 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 37 28 | /svn/!svn/ver/2/trunk/doc/rfc2616.txt 29 | END 30 | rfc4566.txt 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 37 34 | /svn/!svn/ver/2/trunk/doc/rfc4566.txt 35 | END 36 | -------------------------------------------------------------------------------- /RTSPClientLib/doc/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/doc 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | RTSP.mm 30 | file 31 | 32 | 33 | 34 | 35 | 2009-12-17T16:32:54.000000Z 36 | 644981fbb48522f650514401f5600f33 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 6299 62 | 63 | vlc-capture.txt 64 | file 65 | 66 | 67 | 68 | 69 | 2010-01-04T18:40:59.000000Z 70 | 864346930dc9b9b2c4bd9dfc584a0a38 71 | 2010-01-04T21:59:35.170006Z 72 | 2 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 11630 96 | 97 | rfc2326.txt 98 | file 99 | 100 | 101 | 102 | 103 | 2009-12-17T16:32:54.000000Z 104 | c21a1c307cf023394be8e417d55e3152 105 | 2010-01-04T21:59:35.170006Z 106 | 2 107 | paulo.panhoto 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 195011 130 | 131 | rfc2616.txt 132 | file 133 | 134 | 135 | 136 | 137 | 2009-12-17T16:32:54.000000Z 138 | 9fa63f5083e4d2112d2e71b008e387e8 139 | 2010-01-04T21:59:35.170006Z 140 | 2 141 | paulo.panhoto 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 422279 164 | 165 | rfc4566.txt 166 | file 167 | 168 | 169 | 170 | 171 | 2010-01-04T19:22:03.000000Z 172 | 766b7a0eb829a3fe83800e5c0bd96ce9 173 | 2010-01-04T21:59:35.170006Z 174 | 2 175 | paulo.panhoto 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 108820 198 | 199 | -------------------------------------------------------------------------------- /RTSPClientLib/src/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 25 4 | /svn/!svn/ver/2/trunk/src 5 | END 6 | -------------------------------------------------------------------------------- /RTSPClientLib/src/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | br 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 28 4 | /svn/!svn/ver/2/trunk/src/br 5 | END 6 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | com 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 32 4 | /svn/!svn/ver/2/trunk/src/br/com 5 | END 6 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | voicetechnology 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 48 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology 5 | END 6 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | rtspclient 30 | dir 31 | 32 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 59 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient 5 | END 6 | MissingHeaderException.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 87 10 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/MissingHeaderException.java 11 | END 12 | RTSPRequest.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 76 16 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/RTSPRequest.java 17 | END 18 | IncompleteMessageException.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 91 22 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/IncompleteMessageException.java 23 | END 24 | RTSPMessageFactory.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 83 28 | /svn/!svn/ver/3/trunk/src/br/com/voicetechnology/rtspclient/RTSPMessageFactory.java 29 | END 30 | RTSPClient.java 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 75 34 | /svn/!svn/ver/3/trunk/src/br/com/voicetechnology/rtspclient/RTSPClient.java 35 | END 36 | RTSPResponse.java 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 77 40 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/RTSPResponse.java 41 | END 42 | InvalidMessageException.java 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 88 46 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/InvalidMessageException.java 47 | END 48 | RTSPEntityMessage.java 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 82 52 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/RTSPEntityMessage.java 53 | END 54 | HeaderMismatchException.java 55 | K 25 56 | svn:wc:ra_dav:version-url 57 | V 88 58 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/HeaderMismatchException.java 59 | END 60 | RTSPMessage.java 61 | K 25 62 | svn:wc:ra_dav:version-url 63 | V 76 64 | /svn/!svn/ver/4/trunk/src/br/com/voicetechnology/rtspclient/RTSPMessage.java 65 | END 66 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology/rtspclient 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | test 30 | dir 31 | 32 | RTSPRequest.java 33 | file 34 | 35 | 36 | 37 | 38 | 2010-01-04T17:11:59.000000Z 39 | c729203b7607e4f5b45ddfbfb70d3ca0 40 | 2010-01-04T21:59:35.170006Z 41 | 2 42 | paulo.panhoto 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 2396 65 | 66 | MissingHeaderException.java 67 | file 68 | 69 | 70 | 71 | 72 | 2010-01-04T17:11:38.000000Z 73 | 8f6a2b369a7751582690e5e220a5525a 74 | 2010-01-04T21:59:35.170006Z 75 | 2 76 | paulo.panhoto 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 1066 99 | 100 | RTSPResponse.java 101 | file 102 | 103 | 104 | 105 | 106 | 2010-01-04T17:12:03.000000Z 107 | 5e58bc39b7cd3a4f5504e63ffb0ccad6 108 | 2010-01-04T21:59:35.170006Z 109 | 2 110 | paulo.panhoto 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 1559 133 | 134 | InvalidMessageException.java 135 | file 136 | 137 | 138 | 139 | 140 | 2010-01-04T17:11:28.000000Z 141 | 57a75a6db65c6ce54e760e9484213b7f 142 | 2010-01-04T21:59:35.170006Z 143 | 2 144 | paulo.panhoto 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 1111 167 | 168 | transport 169 | dir 170 | 171 | IncompleteMessageException.java 172 | file 173 | 174 | 175 | 176 | 177 | 2010-01-04T17:11:19.000000Z 178 | 5b18b9ade2faaa4955640b4d16319297 179 | 2010-01-04T21:59:35.170006Z 180 | 2 181 | paulo.panhoto 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 984 204 | 205 | RTSPMessageFactory.java 206 | file 207 | 3 208 | 209 | 210 | 211 | 2010-01-05T17:10:05.000000Z 212 | bc5a834899e47fa5e41c943f27719dd0 213 | 2010-01-05T17:50:40.527794Z 214 | 3 215 | paulo.panhoto 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 6869 238 | 239 | messages 240 | dir 241 | 242 | RTSPClient.java 243 | file 244 | 3 245 | 246 | 247 | 248 | 2010-01-05T17:29:39.000000Z 249 | 0ed8c2eda86e4e108e239114f5dcb30f 250 | 2010-01-05T17:50:40.527794Z 251 | 3 252 | paulo.panhoto 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 8238 275 | 276 | RTSPEntityMessage.java 277 | file 278 | 279 | 280 | 281 | 282 | 2010-01-04T17:11:44.000000Z 283 | 11cca60734aa6c70607c8a9236f4f979 284 | 2010-01-04T21:59:35.170006Z 285 | 2 286 | paulo.panhoto 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 2286 309 | 310 | headers 311 | dir 312 | 313 | HeaderMismatchException.java 314 | file 315 | 316 | 317 | 318 | 319 | 2010-01-04T17:03:15.000000Z 320 | 83e47410422e4874b7cb60ed7cba7f75 321 | 2010-01-04T21:59:35.170006Z 322 | 2 323 | paulo.panhoto 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 334 | 335 | 336 | 337 | 338 | 339 | 340 | 341 | 342 | 343 | 344 | 345 | 1228 346 | 347 | RTSPMessage.java 348 | file 349 | 4 350 | 351 | 352 | 353 | 2010-01-06T15:09:45.424246Z 354 | ae2690b5a2f54be14466bd4292e06ad5 355 | 2010-01-06T15:11:31.566079Z 356 | 4 357 | paulo.panhoto 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 368 | 369 | 370 | 371 | 372 | 373 | 374 | 375 | 376 | 377 | 378 | 379 | 3239 380 | 381 | concepts 382 | dir 383 | 384 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/HeaderMismatchException.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | /** 23 | * Exception thrown when a class is initialized with a header name different 24 | * than expected. 25 | * 26 | * @author paulo 27 | * 28 | */ 29 | public class HeaderMismatchException extends RuntimeException 30 | { 31 | /** 32 | * 33 | */ 34 | private static final long serialVersionUID = 6316852391642646327L; 35 | 36 | public HeaderMismatchException(String expected, String current) 37 | { 38 | super("expected " + expected + " but got " + current); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/IncompleteMessageException.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | public class IncompleteMessageException extends InvalidMessageException 23 | { 24 | 25 | /** 26 | * 27 | */ 28 | private static final long serialVersionUID = -2965559263580173275L; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/InvalidMessageException.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import java.io.IOException; 23 | 24 | public class InvalidMessageException extends IOException 25 | { 26 | 27 | /** 28 | * 29 | */ 30 | private static final long serialVersionUID = -1500523453819730537L; 31 | 32 | public InvalidMessageException() 33 | { 34 | } 35 | 36 | public InvalidMessageException(Throwable cause) 37 | { 38 | super(cause); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/MissingHeaderException.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | public class MissingHeaderException extends Exception 23 | { 24 | 25 | /** 26 | * 27 | */ 28 | private static final long serialVersionUID = -3027257996891420069L; 29 | 30 | public MissingHeaderException(String header) 31 | { 32 | super("Header " + header + " wasn't found."); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/RTSPEntityMessage.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Content; 23 | import br.com.voicetechnology.rtspclient.concepts.EntityMessage; 24 | import br.com.voicetechnology.rtspclient.concepts.Message; 25 | import br.com.voicetechnology.rtspclient.headers.ContentEncodingHeader; 26 | import br.com.voicetechnology.rtspclient.headers.ContentLengthHeader; 27 | import br.com.voicetechnology.rtspclient.headers.ContentTypeHeader; 28 | 29 | public class RTSPEntityMessage implements EntityMessage 30 | { 31 | private Content content; 32 | 33 | private final Message message; 34 | 35 | public RTSPEntityMessage(Message message) 36 | { 37 | this.message = message; 38 | } 39 | 40 | public RTSPEntityMessage(Message message, Content body) 41 | { 42 | this(message); 43 | setContent(body); 44 | } 45 | 46 | @Override 47 | public Message getMessage() 48 | { 49 | return message; 50 | }; 51 | 52 | public byte[] getBytes() throws MissingHeaderException 53 | { 54 | message.getHeader(ContentTypeHeader.NAME); 55 | message.getHeader(ContentLengthHeader.NAME); 56 | return content.getBytes(); 57 | } 58 | 59 | @Override 60 | public Content getContent() 61 | { 62 | return content; 63 | } 64 | 65 | @Override 66 | public void setContent(Content content) 67 | { 68 | if(content == null) throw new NullPointerException(); 69 | this.content = content; 70 | message.addHeader(new ContentTypeHeader(content.getType())); 71 | if(content.getEncoding() != null) 72 | message.addHeader(new ContentEncodingHeader(content.getEncoding())); 73 | message.addHeader(new ContentLengthHeader(content.getBytes().length)); 74 | } 75 | 76 | @Override 77 | public boolean isEntity() 78 | { 79 | return content != null; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/RTSPMessage.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import br.com.voicetechnology.rtspclient.concepts.EntityMessage; 26 | import br.com.voicetechnology.rtspclient.concepts.Header; 27 | import br.com.voicetechnology.rtspclient.concepts.Message; 28 | import br.com.voicetechnology.rtspclient.headers.CSeqHeader; 29 | 30 | public abstract class RTSPMessage implements Message 31 | { 32 | private String line; 33 | 34 | private List
headers; 35 | 36 | private CSeqHeader cseq; 37 | 38 | private EntityMessage entity; 39 | 40 | public RTSPMessage() 41 | { 42 | headers = new ArrayList
(); 43 | } 44 | 45 | @Override 46 | public byte[] getBytes() throws MissingHeaderException 47 | { 48 | getHeader(CSeqHeader.NAME); 49 | addHeader(new Header("User-Agent", "RTSPClientLib/Java")); 50 | byte[] message = toString().getBytes(); 51 | if(getEntityMessage() != null) 52 | { 53 | byte[] body = entity.getBytes(); 54 | byte[] full = new byte[message.length + body.length]; 55 | System.arraycopy(message, 0, full, 0, message.length); 56 | System.arraycopy(body, 0, full, message.length, body.length); 57 | message = full; 58 | } 59 | return message; 60 | } 61 | 62 | @Override 63 | public Header getHeader(final String name) throws MissingHeaderException 64 | { 65 | int index = headers.indexOf(new Object() { 66 | @Override 67 | public boolean equals(Object obj) 68 | { 69 | return name.equalsIgnoreCase(((Header) obj).getName()); 70 | } 71 | }); 72 | if(index == -1) 73 | throw new MissingHeaderException(name); 74 | return headers.get(index); 75 | } 76 | 77 | @Override 78 | public Header[] getHeaders() 79 | { 80 | return headers.toArray(new Header[headers.size()]); 81 | } 82 | 83 | @Override 84 | public CSeqHeader getCSeq() 85 | { 86 | return cseq; 87 | } 88 | 89 | @Override 90 | public String getLine() 91 | { 92 | return line; 93 | } 94 | 95 | public void setLine(String line) 96 | { 97 | this.line = line; 98 | } 99 | 100 | @Override 101 | public void addHeader(Header header) 102 | { 103 | if(header == null) return; 104 | if(header instanceof CSeqHeader) 105 | cseq = (CSeqHeader) header; 106 | int index = headers.indexOf(header); 107 | if(index > -1) 108 | headers.remove(index); 109 | else 110 | index = headers.size(); 111 | headers.add(index, header); 112 | } 113 | 114 | @Override 115 | public EntityMessage getEntityMessage() 116 | { 117 | return entity; 118 | } 119 | 120 | @Override 121 | public Message setEntityMessage(EntityMessage entity) 122 | { 123 | this.entity = entity; 124 | return this; 125 | } 126 | 127 | @Override 128 | public String toString() 129 | { 130 | StringBuilder buffer = new StringBuilder(); 131 | buffer.append(getLine()).append("\r\n"); 132 | for(Header header : headers) 133 | buffer.append(header).append("\r\n"); 134 | buffer.append("\r\n"); 135 | return buffer.toString(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/RTSPRequest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import java.net.URI; 23 | import java.net.URISyntaxException; 24 | 25 | import br.com.voicetechnology.rtspclient.concepts.Client; 26 | import br.com.voicetechnology.rtspclient.concepts.Message; 27 | import br.com.voicetechnology.rtspclient.concepts.Request; 28 | import br.com.voicetechnology.rtspclient.concepts.Response; 29 | 30 | public class RTSPRequest extends RTSPMessage implements Request 31 | { 32 | private Method method; 33 | 34 | private String uri; 35 | 36 | public RTSPRequest() 37 | { 38 | } 39 | 40 | public RTSPRequest(String messageLine) throws URISyntaxException 41 | { 42 | String[] parts = messageLine.split(" "); 43 | setLine(parts[0], Method.valueOf(parts[1])); 44 | } 45 | 46 | @Override 47 | public void setLine(String uri, Method method) throws URISyntaxException 48 | { 49 | this.method = method; 50 | this.uri = new URI(uri).toString(); 51 | ; 52 | 53 | super.setLine(method.toString() + ' ' + uri + ' ' + RTSP_VERSION_TOKEN); 54 | } 55 | 56 | @Override 57 | public Method getMethod() 58 | { 59 | return method; 60 | } 61 | 62 | @Override 63 | public String getURI() 64 | { 65 | return uri; 66 | } 67 | 68 | @Override 69 | public void handleResponse(Client client, Response response) 70 | { 71 | if(testForClose(client, this) || testForClose(client, response)) 72 | client.getTransport().disconnect(); 73 | } 74 | 75 | protected void setURI(String uri) 76 | { 77 | this.uri = uri; 78 | } 79 | 80 | protected void setMethod(Method method) 81 | { 82 | this.method = method; 83 | } 84 | 85 | private boolean testForClose(Client client, Message message) 86 | { 87 | try 88 | { 89 | return message.getHeader("Connection").getRawValue().equalsIgnoreCase("close"); 90 | } catch(MissingHeaderException e) 91 | { 92 | } catch(Exception e) 93 | { 94 | client.getClientListener().generalError(client, e); 95 | } 96 | return false; 97 | } 98 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/.svn/text-base/RTSPResponse.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Response; 23 | 24 | public class RTSPResponse extends RTSPMessage implements Response 25 | { 26 | private int status; 27 | 28 | private String text; 29 | 30 | public RTSPResponse() 31 | { 32 | } 33 | 34 | public RTSPResponse(String line) 35 | { 36 | setLine(line); 37 | line = line.substring(line.indexOf(' ') + 1); 38 | status = Integer.parseInt(line.substring(0, line.indexOf(' '))); 39 | text = line.substring(line.indexOf(' ') + 1); 40 | } 41 | 42 | @Override 43 | public int getStatusCode() 44 | { 45 | return status; 46 | } 47 | 48 | @Override 49 | public String getStatusText() 50 | { 51 | return text; 52 | } 53 | 54 | @Override 55 | public void setLine(int statusCode, String statusText) 56 | { 57 | status = statusCode; 58 | text = statusText; 59 | super.setLine(RTSP_VERSION_TOKEN + ' ' + status + ' ' + text); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/HeaderMismatchException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | /** 23 | * Exception thrown when a class is initialized with a header name different 24 | * than expected. 25 | * 26 | * @author paulo 27 | * 28 | */ 29 | public class HeaderMismatchException extends RuntimeException 30 | { 31 | /** 32 | * 33 | */ 34 | private static final long serialVersionUID = 6316852391642646327L; 35 | 36 | public HeaderMismatchException(String expected, String current) 37 | { 38 | super("expected " + expected + " but got " + current); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/IncompleteMessageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | public class IncompleteMessageException extends InvalidMessageException 23 | { 24 | 25 | /** 26 | * 27 | */ 28 | private static final long serialVersionUID = -2965559263580173275L; 29 | 30 | } 31 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/InvalidMessageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import java.io.IOException; 23 | 24 | public class InvalidMessageException extends IOException 25 | { 26 | 27 | /** 28 | * 29 | */ 30 | private static final long serialVersionUID = -1500523453819730537L; 31 | 32 | public InvalidMessageException() 33 | { 34 | } 35 | 36 | public InvalidMessageException(Throwable cause) 37 | { 38 | super(cause); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/MissingHeaderException.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | public class MissingHeaderException extends Exception 23 | { 24 | 25 | /** 26 | * 27 | */ 28 | private static final long serialVersionUID = -3027257996891420069L; 29 | 30 | public MissingHeaderException(String header) 31 | { 32 | super("Header " + header + " wasn't found."); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/RTSPEntityMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Content; 23 | import br.com.voicetechnology.rtspclient.concepts.EntityMessage; 24 | import br.com.voicetechnology.rtspclient.concepts.Message; 25 | import br.com.voicetechnology.rtspclient.headers.ContentEncodingHeader; 26 | import br.com.voicetechnology.rtspclient.headers.ContentLengthHeader; 27 | import br.com.voicetechnology.rtspclient.headers.ContentTypeHeader; 28 | 29 | public class RTSPEntityMessage implements EntityMessage 30 | { 31 | private Content content; 32 | 33 | private final Message message; 34 | 35 | public RTSPEntityMessage(Message message) 36 | { 37 | this.message = message; 38 | } 39 | 40 | public RTSPEntityMessage(Message message, Content body) 41 | { 42 | this(message); 43 | setContent(body); 44 | } 45 | 46 | @Override 47 | public Message getMessage() 48 | { 49 | return message; 50 | }; 51 | 52 | public byte[] getBytes() throws MissingHeaderException 53 | { 54 | message.getHeader(ContentTypeHeader.NAME); 55 | message.getHeader(ContentLengthHeader.NAME); 56 | return content.getBytes(); 57 | } 58 | 59 | @Override 60 | public Content getContent() 61 | { 62 | return content; 63 | } 64 | 65 | @Override 66 | public void setContent(Content content) 67 | { 68 | if(content == null) throw new NullPointerException(); 69 | this.content = content; 70 | message.addHeader(new ContentTypeHeader(content.getType())); 71 | if(content.getEncoding() != null) 72 | message.addHeader(new ContentEncodingHeader(content.getEncoding())); 73 | message.addHeader(new ContentLengthHeader(content.getBytes().length)); 74 | } 75 | 76 | @Override 77 | public boolean isEntity() 78 | { 79 | return content != null; 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/RTSPMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import java.util.ArrayList; 23 | import java.util.List; 24 | 25 | import br.com.voicetechnology.rtspclient.concepts.EntityMessage; 26 | import br.com.voicetechnology.rtspclient.concepts.Header; 27 | import br.com.voicetechnology.rtspclient.concepts.Message; 28 | import br.com.voicetechnology.rtspclient.headers.CSeqHeader; 29 | 30 | public abstract class RTSPMessage implements Message 31 | { 32 | private String line; 33 | 34 | private List
headers; 35 | 36 | private CSeqHeader cseq; 37 | 38 | private EntityMessage entity; 39 | 40 | public RTSPMessage() 41 | { 42 | headers = new ArrayList
(); 43 | } 44 | 45 | @Override 46 | public byte[] getBytes() throws MissingHeaderException 47 | { 48 | getHeader(CSeqHeader.NAME); 49 | addHeader(new Header("User-Agent", "RTSPClientLib/Java")); 50 | byte[] message = toString().getBytes(); 51 | if(getEntityMessage() != null) 52 | { 53 | byte[] body = entity.getBytes(); 54 | byte[] full = new byte[message.length + body.length]; 55 | System.arraycopy(message, 0, full, 0, message.length); 56 | System.arraycopy(body, 0, full, message.length, body.length); 57 | message = full; 58 | } 59 | return message; 60 | } 61 | 62 | @Override 63 | public Header getHeader(final String name) throws MissingHeaderException 64 | { 65 | int index = headers.indexOf(new Object() { 66 | @Override 67 | public boolean equals(Object obj) 68 | { 69 | return name.equalsIgnoreCase(((Header) obj).getName()); 70 | } 71 | }); 72 | if(index == -1) 73 | throw new MissingHeaderException(name); 74 | return headers.get(index); 75 | } 76 | 77 | @Override 78 | public Header[] getHeaders() 79 | { 80 | return headers.toArray(new Header[headers.size()]); 81 | } 82 | 83 | @Override 84 | public CSeqHeader getCSeq() 85 | { 86 | return cseq; 87 | } 88 | 89 | @Override 90 | public String getLine() 91 | { 92 | return line; 93 | } 94 | 95 | public void setLine(String line) 96 | { 97 | this.line = line; 98 | } 99 | 100 | @Override 101 | public void addHeader(Header header) 102 | { 103 | if(header == null) return; 104 | if(header instanceof CSeqHeader) 105 | cseq = (CSeqHeader) header; 106 | int index = headers.indexOf(header); 107 | if(index > -1) 108 | headers.remove(index); 109 | else 110 | index = headers.size(); 111 | headers.add(index, header); 112 | } 113 | 114 | @Override 115 | public EntityMessage getEntityMessage() 116 | { 117 | return entity; 118 | } 119 | 120 | @Override 121 | public Message setEntityMessage(EntityMessage entity) 122 | { 123 | this.entity = entity; 124 | return this; 125 | } 126 | 127 | @Override 128 | public String toString() 129 | { 130 | StringBuilder buffer = new StringBuilder(); 131 | buffer.append(getLine()).append("\r\n"); 132 | for(Header header : headers) 133 | buffer.append(header).append("\r\n"); 134 | buffer.append("\r\n"); 135 | return buffer.toString(); 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/RTSPRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import java.net.URI; 23 | import java.net.URISyntaxException; 24 | 25 | import br.com.voicetechnology.rtspclient.concepts.Client; 26 | import br.com.voicetechnology.rtspclient.concepts.Message; 27 | import br.com.voicetechnology.rtspclient.concepts.Request; 28 | import br.com.voicetechnology.rtspclient.concepts.Response; 29 | 30 | public class RTSPRequest extends RTSPMessage implements Request 31 | { 32 | private Method method; 33 | 34 | private String uri; 35 | 36 | public RTSPRequest() 37 | { 38 | } 39 | 40 | public RTSPRequest(String messageLine) throws URISyntaxException 41 | { 42 | String[] parts = messageLine.split(" "); 43 | setLine(parts[0], Method.valueOf(parts[1])); 44 | } 45 | 46 | @Override 47 | public void setLine(String uri, Method method) throws URISyntaxException 48 | { 49 | this.method = method; 50 | this.uri = new URI(uri).toString(); 51 | ; 52 | 53 | super.setLine(method.toString() + ' ' + uri + ' ' + RTSP_VERSION_TOKEN); 54 | } 55 | 56 | @Override 57 | public Method getMethod() 58 | { 59 | return method; 60 | } 61 | 62 | @Override 63 | public String getURI() 64 | { 65 | return uri; 66 | } 67 | 68 | @Override 69 | public void handleResponse(Client client, Response response) 70 | { 71 | if(testForClose(client, this) || testForClose(client, response)) 72 | client.getTransport().disconnect(); 73 | } 74 | 75 | protected void setURI(String uri) 76 | { 77 | this.uri = uri; 78 | } 79 | 80 | protected void setMethod(Method method) 81 | { 82 | this.method = method; 83 | } 84 | 85 | private boolean testForClose(Client client, Message message) 86 | { 87 | try 88 | { 89 | return message.getHeader("Connection").getRawValue().equalsIgnoreCase("close"); 90 | } catch(MissingHeaderException e) 91 | { 92 | } catch(Exception e) 93 | { 94 | client.getClientListener().generalError(client, e); 95 | } 96 | return false; 97 | } 98 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/RTSPResponse.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Response; 23 | 24 | public class RTSPResponse extends RTSPMessage implements Response 25 | { 26 | private int status; 27 | 28 | private String text; 29 | 30 | public RTSPResponse() 31 | { 32 | } 33 | 34 | public RTSPResponse(String line) 35 | { 36 | setLine(line); 37 | line = line.substring(line.indexOf(' ') + 1); 38 | status = Integer.parseInt(line.substring(0, line.indexOf(' '))); 39 | text = line.substring(line.indexOf(' ') + 1); 40 | } 41 | 42 | @Override 43 | public int getStatusCode() 44 | { 45 | return status; 46 | } 47 | 48 | @Override 49 | public String getStatusText() 50 | { 51 | return text; 52 | } 53 | 54 | @Override 55 | public void setLine(int statusCode, String statusText) 56 | { 57 | status = statusCode; 58 | text = statusText; 59 | super.setLine(RTSP_VERSION_TOKEN + ' ' + status + ' ' + text); 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 68 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts 5 | END 6 | EntityMessage.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 87 10 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/EntityMessage.java 11 | END 12 | TransportListener.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 91 16 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/TransportListener.java 17 | END 18 | ClientListener.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 88 22 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/ClientListener.java 23 | END 24 | Message.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 81 28 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Message.java 29 | END 30 | Header.java 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 80 34 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Header.java 35 | END 36 | Request.java 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 81 40 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Request.java 41 | END 42 | Content.java 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 81 46 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Content.java 47 | END 48 | MessageFactory.java 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 88 52 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/MessageFactory.java 53 | END 54 | Transport.java 55 | K 25 56 | svn:wc:ra_dav:version-url 57 | V 83 58 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Transport.java 59 | END 60 | Client.java 61 | K 25 62 | svn:wc:ra_dav:version-url 63 | V 80 64 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Client.java 65 | END 66 | MessageBuffer.java 67 | K 25 68 | svn:wc:ra_dav:version-url 69 | V 87 70 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/MessageBuffer.java 71 | END 72 | Response.java 73 | K 25 74 | svn:wc:ra_dav:version-url 75 | V 82 76 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/concepts/Response.java 77 | END 78 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology/rtspclient/concepts 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | EntityMessage.java 30 | file 31 | 32 | 33 | 34 | 35 | 2010-01-04T17:12:25.000000Z 36 | 05dbc3a736ccf08e0379f02330fdaf23 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1092 62 | 63 | TransportListener.java 64 | file 65 | 66 | 67 | 68 | 69 | 2010-01-04T17:14:25.000000Z 70 | f0d80d8333e18a28891b376d04f2a01e 71 | 2010-01-04T21:59:35.170006Z 72 | 2 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1405 96 | 97 | ClientListener.java 98 | file 99 | 100 | 101 | 102 | 103 | 2010-01-04T17:12:15.000000Z 104 | 77444261985239192504eb89af319f33 105 | 2010-01-04T21:59:35.170006Z 106 | 2 107 | paulo.panhoto 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 1387 130 | 131 | Message.java 132 | file 133 | 134 | 135 | 136 | 137 | 2010-01-04T17:14:23.000000Z 138 | 6ab256d450664feba5331a7bfeddee00 139 | 2010-01-04T21:59:35.170006Z 140 | 2 141 | paulo.panhoto 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 2311 164 | 165 | Request.java 166 | file 167 | 168 | 169 | 170 | 171 | 2010-01-04T17:14:24.000000Z 172 | 9c1531211d2731e405d4db803c93a04b 173 | 2010-01-04T21:59:35.170006Z 174 | 2 175 | paulo.panhoto 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 1155 198 | 199 | Header.java 200 | file 201 | 202 | 203 | 204 | 205 | 2010-01-04T17:12:30.000000Z 206 | 72c9afbbe19470ac653a74141c2542c7 207 | 2010-01-04T21:59:35.170006Z 208 | 2 209 | paulo.panhoto 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 2227 232 | 233 | Content.java 234 | file 235 | 236 | 237 | 238 | 239 | 2010-01-04T17:12:20.000000Z 240 | 1491bb959e519883c10e66a4be07e670 241 | 2010-01-04T21:59:35.170006Z 242 | 2 243 | paulo.panhoto 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 1776 266 | 267 | MessageFactory.java 268 | file 269 | 270 | 271 | 272 | 273 | 2010-01-04T17:14:23.000000Z 274 | 3b46390d98d46568dc27aae83e0a698a 275 | 2010-01-04T21:59:35.170006Z 276 | 2 277 | paulo.panhoto 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 1667 300 | 301 | Transport.java 302 | file 303 | 304 | 305 | 306 | 307 | 2010-01-04T17:14:23.000000Z 308 | 56b01a5223db7d3c7a503ec702845aba 309 | 2010-01-04T21:59:35.170006Z 310 | 2 311 | paulo.panhoto 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | 332 | 333 | 1447 334 | 335 | Client.java 336 | file 337 | 338 | 339 | 340 | 341 | 2010-01-04T19:13:02.000000Z 342 | 3c382e4f46d0d72124f72cb40dede61a 343 | 2010-01-04T21:59:35.170006Z 344 | 2 345 | paulo.panhoto 346 | 347 | 348 | 349 | 350 | 351 | 352 | 353 | 354 | 355 | 356 | 357 | 358 | 359 | 360 | 361 | 362 | 363 | 364 | 365 | 366 | 367 | 2820 368 | 369 | Response.java 370 | file 371 | 372 | 373 | 374 | 375 | 2010-01-04T17:14:24.000000Z 376 | e2222a9cef2ce43fed97925348ccc78b 377 | 2010-01-04T21:59:35.170006Z 378 | 2 379 | paulo.panhoto 380 | 381 | 382 | 383 | 384 | 385 | 386 | 387 | 388 | 389 | 390 | 391 | 392 | 393 | 394 | 395 | 396 | 397 | 398 | 399 | 400 | 401 | 981 402 | 403 | MessageBuffer.java 404 | file 405 | 406 | 407 | 408 | 409 | 2010-01-04T17:14:24.000000Z 410 | a84b556bd6d9f86ad411cd7ee9ee028a 411 | 2010-01-04T21:59:35.170006Z 412 | 2 413 | paulo.panhoto 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 425 | 426 | 427 | 428 | 429 | 430 | 431 | 432 | 433 | 434 | 435 | 2658 436 | 437 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Client.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.io.IOException; 23 | import java.net.URI; 24 | import java.net.URISyntaxException; 25 | 26 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 27 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 28 | 29 | /** 30 | * Models a simple RTSPClient.
31 | * it MUST keep track of CSeq to match requests and responses. 32 | * 33 | * @author paulo 34 | * 35 | */ 36 | public interface Client 37 | { 38 | 39 | void setTransport(Transport transport); 40 | 41 | Transport getTransport(); 42 | 43 | void setClientListener(ClientListener listener); 44 | 45 | ClientListener getClientListener(); 46 | 47 | void setSession(SessionHeader session); 48 | 49 | MessageFactory getMessageFactory(); 50 | 51 | URI getURI(); 52 | 53 | void describe(URI uri) throws IOException; 54 | 55 | /** 56 | * Sets up a session 57 | * 58 | * @param uri 59 | * base URI for the request. 60 | * @param localPort 61 | * Port for RTP stream. RTCP port is derived by adding 1 to this 62 | * port. 63 | */ 64 | void setup(URI uri, int localPort) throws IOException; 65 | 66 | /** 67 | * Sets up a session with a specific resource. If a session has been 68 | * previously established, a call to this method will set up a different 69 | * resource with the same session identifier as the previous one. 70 | * 71 | * @see #setup(URI, int) 72 | * @param resource 73 | * resource derived from SDP (via control: attribute). the final URI 74 | * will be uri + '/' + resource. 75 | */ 76 | void setup(URI uri, int localPort, String resource) throws IOException; 77 | 78 | void teardown(); 79 | 80 | void play() throws IOException; 81 | 82 | void record() throws IOException; 83 | 84 | void options(String uri, URI endpoint) throws URISyntaxException, IOException; 85 | 86 | /** 87 | * Sends a message and, if message is a {@link Request}, store it as an 88 | * outstanding request. 89 | * 90 | * @param message 91 | * @throws IOException 92 | * @throws MissingHeaderException 93 | * Malformed message, lacking mandatory header. 94 | */ 95 | void send(Message message) throws IOException, MissingHeaderException; 96 | 97 | /** 98 | * 99 | * @return value of CSeq for next packet. 100 | */ 101 | int nextCSeq(); 102 | } 103 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/ClientListener.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | /** 23 | * Listener for {@link Client} events, such as a {@link Response} that arrives. 24 | * 25 | * @author paulo 26 | * 27 | */ 28 | public interface ClientListener 29 | { 30 | void generalError(Client client, Throwable error); 31 | 32 | /** 33 | * this method is called when a client obtains a session descriptor, such as 34 | * SDP from a DESCRIBE. 35 | * 36 | * @param client 37 | * @param descriptor 38 | */ 39 | void mediaDescriptor(Client client, String descriptor); 40 | 41 | void requestFailed(Client client, Request request, Throwable cause); 42 | 43 | void response(Client client, Request request, Response response); 44 | } 45 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Content.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 23 | import br.com.voicetechnology.rtspclient.headers.ContentEncodingHeader; 24 | import br.com.voicetechnology.rtspclient.headers.ContentTypeHeader; 25 | 26 | public class Content 27 | { 28 | private String type; 29 | 30 | private String encoding; 31 | 32 | private byte[] content; 33 | 34 | public void setDescription(Message message) throws MissingHeaderException 35 | { 36 | type = message.getHeader(ContentTypeHeader.NAME).getRawValue(); 37 | try 38 | { 39 | encoding = message.getHeader(ContentEncodingHeader.NAME).getRawValue(); 40 | } catch(MissingHeaderException e) 41 | { 42 | } 43 | } 44 | 45 | public String getType() 46 | { 47 | return type; 48 | } 49 | 50 | public void setType(String type) 51 | { 52 | this.type = type; 53 | } 54 | 55 | public String getEncoding() 56 | { 57 | return encoding; 58 | } 59 | 60 | public void setEncoding(String encoding) 61 | { 62 | this.encoding = encoding; 63 | } 64 | 65 | public byte[] getBytes() 66 | { 67 | return content; 68 | } 69 | 70 | public void setBytes(byte[] content) 71 | { 72 | this.content = content; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/EntityMessage.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 23 | 24 | public interface EntityMessage 25 | { 26 | Content getContent(); 27 | 28 | void setContent(Content content); 29 | 30 | Message getMessage(); 31 | 32 | byte[] getBytes() throws MissingHeaderException; 33 | 34 | boolean isEntity(); 35 | } 36 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Header.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.HeaderMismatchException; 23 | 24 | public class Header 25 | { 26 | private String name; 27 | 28 | private String value; 29 | 30 | /** 31 | * Constructs a new header. 32 | * 33 | * @param header 34 | * if the character ':' (colon) is not found, it will be the name of 35 | * the header. Otherwise, this constructor parses the header line. 36 | */ 37 | public Header(String header) 38 | { 39 | int colon = header.indexOf(':'); 40 | if(colon == -1) 41 | name = header; 42 | else 43 | { 44 | name = header.substring(0, colon); 45 | value = header.substring(++colon).trim(); 46 | } 47 | } 48 | 49 | public Header(String name, String value) 50 | { 51 | this.name = name; 52 | this.value = value; 53 | } 54 | 55 | public String getName() 56 | { 57 | return name; 58 | } 59 | 60 | public String getRawValue() 61 | { 62 | return value; 63 | } 64 | 65 | public void setRawValue(String value) 66 | { 67 | this.value = value; 68 | } 69 | 70 | @Override 71 | public String toString() 72 | { 73 | return name + ": " + value; 74 | } 75 | 76 | @Override 77 | public boolean equals(Object obj) 78 | { 79 | if(super.equals(obj)) 80 | return true; 81 | if(obj instanceof String) 82 | return getName().equals(obj); 83 | if(obj instanceof Header) 84 | return getName().equals(((Header) obj).getName()); 85 | return false; 86 | } 87 | 88 | protected final void checkName(String expected) 89 | { 90 | if(!expected.equalsIgnoreCase(getName())) 91 | throw new HeaderMismatchException(expected, getName()); 92 | } 93 | 94 | protected final void setName(String name) 95 | { 96 | value = this.name; 97 | this.name = name; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Message.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 23 | import br.com.voicetechnology.rtspclient.headers.CSeqHeader; 24 | 25 | /** 26 | * Models a RTSP Message 27 | * 28 | * @author paulo 29 | * 30 | */ 31 | public interface Message 32 | { 33 | static String RTSP_TOKEN = "RTSP/"; 34 | 35 | static String RTSP_VERSION = "1.0"; 36 | 37 | static String RTSP_VERSION_TOKEN = RTSP_TOKEN + RTSP_VERSION; 38 | 39 | /** 40 | * 41 | * @return the Message line (the first line of the message) 42 | */ 43 | String getLine(); 44 | 45 | /** 46 | * Returns a header, if exists 47 | * 48 | * @param name 49 | * Name of the header to be searched 50 | * @return value of that header 51 | * @throws MissingHeaderException 52 | */ 53 | Header getHeader(String name) throws MissingHeaderException; 54 | 55 | /** 56 | * Convenience method to get CSeq. 57 | * 58 | * @return 59 | */ 60 | CSeqHeader getCSeq(); 61 | 62 | /** 63 | * 64 | * @return all headers in the message, except CSeq 65 | */ 66 | Header[] getHeaders(); 67 | 68 | /** 69 | * Adds a new header or replaces if one already exists. If header to be added 70 | * is a CSeq, implementation MUST keep reference of this header. 71 | * 72 | * @param header 73 | */ 74 | void addHeader(Header header); 75 | 76 | /** 77 | * 78 | * @return message as a byte array, ready for transmission. 79 | */ 80 | byte[] getBytes() throws MissingHeaderException; 81 | 82 | /** 83 | * 84 | * @return Entity part of message, it exists. 85 | */ 86 | EntityMessage getEntityMessage(); 87 | 88 | /** 89 | * 90 | * @param entity 91 | * adds an entity part to the message. 92 | * @return this, for easier construction. 93 | */ 94 | Message setEntityMessage(EntityMessage entity); 95 | } 96 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/MessageBuffer.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | public class MessageBuffer 23 | { 24 | /** 25 | * buffer for received data 26 | */ 27 | private byte[] data; 28 | 29 | /** 30 | * offset for starting useful area 31 | */ 32 | private int offset; 33 | 34 | /** 35 | * length of useful portion. 36 | */ 37 | private int length; 38 | 39 | /** 40 | * Used (read) buffer. 41 | */ 42 | private int used; 43 | 44 | /** 45 | * {@link Message} created during last parsing. 46 | */ 47 | private Message message; 48 | 49 | /** 50 | * Adds more data to buffer and ensures the sequence [data, newData] is 51 | * contiguous. 52 | * 53 | * @param newData data to be added to the buffer. 54 | */ 55 | public void addData(byte[] newData, int newLength) 56 | { 57 | if(data == null) 58 | { 59 | data = newData; 60 | length = newLength; 61 | offset = 0; 62 | } else 63 | { 64 | // buffer seems to be small. 65 | if((data.length - offset - length) < newLength) 66 | { 67 | // try to sequeeze data at the beginning of the buffer only if current 68 | // buffer does not overlap 69 | if(offset >= length && (data.length - length) >= newLength) 70 | { 71 | System.arraycopy(data, offset, data, 0, length); 72 | offset = 0; 73 | } else 74 | { // worst-case scenario, a new buffer will have to be created 75 | byte[] temp = new byte[data.length + newLength]; 76 | System.arraycopy(data, offset, temp, 0, length); 77 | offset = 0; 78 | data = temp; 79 | } 80 | } 81 | // there's room for everything - just copy 82 | System.arraycopy(newData, 0, data, offset + length, newLength); 83 | length += newLength; 84 | } 85 | } 86 | 87 | /** 88 | * Discards used portions of the buffer. 89 | */ 90 | public void discardData() 91 | { 92 | offset += used; 93 | length -= used; 94 | } 95 | 96 | public byte[] getData() 97 | { 98 | return data; 99 | } 100 | 101 | public int getOffset() 102 | { 103 | return offset; 104 | } 105 | 106 | public int getLength() 107 | { 108 | return length; 109 | } 110 | 111 | public void setMessage(Message message) 112 | { 113 | this.message = message; 114 | } 115 | 116 | public Message getMessage() 117 | { 118 | return message; 119 | } 120 | 121 | public void setused(int used) 122 | { 123 | this.used = used; 124 | } 125 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/MessageFactory.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.InvalidMessageException; 25 | 26 | /** 27 | * A RTSP message factory to build objects from incoming messages or to 28 | * initialize outgoing messages correctly. 29 | * 30 | * 31 | * @author paulo 32 | * 33 | */ 34 | public interface MessageFactory 35 | { 36 | 37 | /** 38 | * 39 | * @param message 40 | */ 41 | void incomingMessage(MessageBuffer message) throws InvalidMessageException; 42 | 43 | Request outgoingRequest(String uri, Request.Method method, int cseq, 44 | Header... extras) throws URISyntaxException; 45 | 46 | Request outgoingRequest(Content body, String uri, Request.Method method, 47 | int cseq, Header... extras) throws URISyntaxException; 48 | 49 | Response outgoingResponse(int code, String message, int cseq, Header... extras); 50 | 51 | Response outgoingResponse(Content body, int code, String text, int cseq, 52 | Header... extras); 53 | } 54 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Request.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | public interface Request extends Message 25 | { 26 | enum Method 27 | { 28 | OPTIONS, DESCRIBE, SETUP, PLAY, RECORD, TEARDOWN 29 | }; 30 | 31 | void setLine(String uri, Method method) throws URISyntaxException; 32 | 33 | Method getMethod(); 34 | 35 | String getURI(); 36 | 37 | void handleResponse(Client client, Response response); 38 | } 39 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Response.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | public interface Response extends Message 23 | { 24 | void setLine(int statusCode, String statusPhrase); 25 | 26 | int getStatusCode(); 27 | 28 | String getStatusText(); 29 | } 30 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/Transport.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.io.IOException; 23 | import java.net.URI; 24 | 25 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 26 | 27 | /** 28 | * This interface defines a transport protocol (TCP, UDP) or method (HTTP 29 | * tunneling). Transport also MUST enqueue a command if a connection is busy at 30 | * the moment it is issued. 31 | * 32 | * @author paulo 33 | */ 34 | public interface Transport 35 | { 36 | void connect(URI to) throws IOException; 37 | 38 | void disconnect(); 39 | 40 | void sendMessage(Message message) throws IOException, MissingHeaderException; 41 | 42 | void setTransportListener(TransportListener listener); 43 | 44 | void setUserData(Object data); 45 | 46 | boolean isConnected(); 47 | } 48 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/.svn/text-base/TransportListener.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | /** 23 | * Listener for transport events. Implementations of {@link Transport}, when 24 | * calling a listener method, must catch all errors and submit them to the 25 | * error() method. 26 | * 27 | * @author paulo 28 | * 29 | */ 30 | public interface TransportListener 31 | { 32 | void connected(Transport t) throws Throwable; 33 | 34 | void error(Transport t, Throwable error); 35 | 36 | void error(Transport t, Message message, Throwable error); 37 | 38 | void remoteDisconnection(Transport t) throws Throwable; 39 | 40 | void dataReceived(Transport t, byte[] data, int size) throws Throwable; 41 | 42 | void dataSent(Transport t) throws Throwable; 43 | } 44 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Client.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.io.IOException; 23 | import java.net.URI; 24 | import java.net.URISyntaxException; 25 | 26 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 27 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 28 | 29 | /** 30 | * Models a simple RTSPClient.
31 | * it MUST keep track of CSeq to match requests and responses. 32 | * 33 | * @author paulo 34 | * 35 | */ 36 | public interface Client 37 | { 38 | 39 | void setTransport(Transport transport); 40 | 41 | Transport getTransport(); 42 | 43 | void setClientListener(ClientListener listener); 44 | 45 | ClientListener getClientListener(); 46 | 47 | void setSession(SessionHeader session); 48 | 49 | MessageFactory getMessageFactory(); 50 | 51 | URI getURI(); 52 | 53 | void describe(URI uri) throws IOException; 54 | 55 | /** 56 | * Sets up a session 57 | * 58 | * @param uri 59 | * base URI for the request. 60 | * @param localPort 61 | * Port for RTP stream. RTCP port is derived by adding 1 to this 62 | * port. 63 | */ 64 | void setup(URI uri, int localPort) throws IOException; 65 | 66 | /** 67 | * Sets up a session with a specific resource. If a session has been 68 | * previously established, a call to this method will set up a different 69 | * resource with the same session identifier as the previous one. 70 | * 71 | * @see #setup(URI, int) 72 | * @param resource 73 | * resource derived from SDP (via control: attribute). the final URI 74 | * will be uri + '/' + resource. 75 | */ 76 | void setup(URI uri, int localPort, String resource) throws IOException; 77 | 78 | void teardown(); 79 | 80 | void play() throws IOException; 81 | 82 | void record() throws IOException; 83 | 84 | void options(String uri, URI endpoint) throws URISyntaxException, IOException; 85 | 86 | /** 87 | * Sends a message and, if message is a {@link Request}, store it as an 88 | * outstanding request. 89 | * 90 | * @param message 91 | * @throws IOException 92 | * @throws MissingHeaderException 93 | * Malformed message, lacking mandatory header. 94 | */ 95 | void send(Message message) throws IOException, MissingHeaderException; 96 | 97 | /** 98 | * 99 | * @return value of CSeq for next packet. 100 | */ 101 | int nextCSeq(); 102 | } 103 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/ClientListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | /** 23 | * Listener for {@link Client} events, such as a {@link Response} that arrives. 24 | * 25 | * @author paulo 26 | * 27 | */ 28 | public interface ClientListener 29 | { 30 | void generalError(Client client, Throwable error); 31 | 32 | /** 33 | * this method is called when a client obtains a session descriptor, such as 34 | * SDP from a DESCRIBE. 35 | * 36 | * @param client 37 | * @param descriptor 38 | */ 39 | void mediaDescriptor(Client client, String descriptor); 40 | 41 | void requestFailed(Client client, Request request, Throwable cause); 42 | 43 | void response(Client client, Request request, Response response); 44 | } 45 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Content.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 23 | import br.com.voicetechnology.rtspclient.headers.ContentEncodingHeader; 24 | import br.com.voicetechnology.rtspclient.headers.ContentTypeHeader; 25 | 26 | public class Content 27 | { 28 | private String type; 29 | 30 | private String encoding; 31 | 32 | private byte[] content; 33 | 34 | public void setDescription(Message message) throws MissingHeaderException 35 | { 36 | type = message.getHeader(ContentTypeHeader.NAME).getRawValue(); 37 | try 38 | { 39 | encoding = message.getHeader(ContentEncodingHeader.NAME).getRawValue(); 40 | } catch(MissingHeaderException e) 41 | { 42 | } 43 | } 44 | 45 | public String getType() 46 | { 47 | return type; 48 | } 49 | 50 | public void setType(String type) 51 | { 52 | this.type = type; 53 | } 54 | 55 | public String getEncoding() 56 | { 57 | return encoding; 58 | } 59 | 60 | public void setEncoding(String encoding) 61 | { 62 | this.encoding = encoding; 63 | } 64 | 65 | public byte[] getBytes() 66 | { 67 | return content; 68 | } 69 | 70 | public void setBytes(byte[] content) 71 | { 72 | this.content = content; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/EntityMessage.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 23 | 24 | public interface EntityMessage 25 | { 26 | Content getContent(); 27 | 28 | void setContent(Content content); 29 | 30 | Message getMessage(); 31 | 32 | byte[] getBytes() throws MissingHeaderException; 33 | 34 | boolean isEntity(); 35 | } 36 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Header.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.HeaderMismatchException; 23 | 24 | public class Header 25 | { 26 | private String name; 27 | 28 | private String value; 29 | 30 | /** 31 | * Constructs a new header. 32 | * 33 | * @param header 34 | * if the character ':' (colon) is not found, it will be the name of 35 | * the header. Otherwise, this constructor parses the header line. 36 | */ 37 | public Header(String header) 38 | { 39 | int colon = header.indexOf(':'); 40 | if(colon == -1) 41 | name = header; 42 | else 43 | { 44 | name = header.substring(0, colon); 45 | value = header.substring(++colon).trim(); 46 | } 47 | } 48 | 49 | public Header(String name, String value) 50 | { 51 | this.name = name; 52 | this.value = value; 53 | } 54 | 55 | public String getName() 56 | { 57 | return name; 58 | } 59 | 60 | public String getRawValue() 61 | { 62 | return value; 63 | } 64 | 65 | public void setRawValue(String value) 66 | { 67 | this.value = value; 68 | } 69 | 70 | @Override 71 | public String toString() 72 | { 73 | return name + ": " + value; 74 | } 75 | 76 | @Override 77 | public boolean equals(Object obj) 78 | { 79 | if(super.equals(obj)) 80 | return true; 81 | if(obj instanceof String) 82 | return getName().equals(obj); 83 | if(obj instanceof Header) 84 | return getName().equals(((Header) obj).getName()); 85 | return false; 86 | } 87 | 88 | protected final void checkName(String expected) 89 | { 90 | if(!expected.equalsIgnoreCase(getName())) 91 | throw new HeaderMismatchException(expected, getName()); 92 | } 93 | 94 | protected final void setName(String name) 95 | { 96 | value = this.name; 97 | this.name = name; 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Message.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 23 | import br.com.voicetechnology.rtspclient.headers.CSeqHeader; 24 | 25 | /** 26 | * Models a RTSP Message 27 | * 28 | * @author paulo 29 | * 30 | */ 31 | public interface Message 32 | { 33 | static String RTSP_TOKEN = "RTSP/"; 34 | 35 | static String RTSP_VERSION = "1.0"; 36 | 37 | static String RTSP_VERSION_TOKEN = RTSP_TOKEN + RTSP_VERSION; 38 | 39 | /** 40 | * 41 | * @return the Message line (the first line of the message) 42 | */ 43 | String getLine(); 44 | 45 | /** 46 | * Returns a header, if exists 47 | * 48 | * @param name 49 | * Name of the header to be searched 50 | * @return value of that header 51 | * @throws MissingHeaderException 52 | */ 53 | Header getHeader(String name) throws MissingHeaderException; 54 | 55 | /** 56 | * Convenience method to get CSeq. 57 | * 58 | * @return 59 | */ 60 | CSeqHeader getCSeq(); 61 | 62 | /** 63 | * 64 | * @return all headers in the message, except CSeq 65 | */ 66 | Header[] getHeaders(); 67 | 68 | /** 69 | * Adds a new header or replaces if one already exists. If header to be added 70 | * is a CSeq, implementation MUST keep reference of this header. 71 | * 72 | * @param header 73 | */ 74 | void addHeader(Header header); 75 | 76 | /** 77 | * 78 | * @return message as a byte array, ready for transmission. 79 | */ 80 | byte[] getBytes() throws MissingHeaderException; 81 | 82 | /** 83 | * 84 | * @return Entity part of message, it exists. 85 | */ 86 | EntityMessage getEntityMessage(); 87 | 88 | /** 89 | * 90 | * @param entity 91 | * adds an entity part to the message. 92 | * @return this, for easier construction. 93 | */ 94 | Message setEntityMessage(EntityMessage entity); 95 | } 96 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/MessageBuffer.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | public class MessageBuffer 23 | { 24 | /** 25 | * buffer for received data 26 | */ 27 | private byte[] data; 28 | 29 | /** 30 | * offset for starting useful area 31 | */ 32 | private int offset; 33 | 34 | /** 35 | * length of useful portion. 36 | */ 37 | private int length; 38 | 39 | /** 40 | * Used (read) buffer. 41 | */ 42 | private int used; 43 | 44 | /** 45 | * {@link Message} created during last parsing. 46 | */ 47 | private Message message; 48 | 49 | /** 50 | * Adds more data to buffer and ensures the sequence [data, newData] is 51 | * contiguous. 52 | * 53 | * @param newData data to be added to the buffer. 54 | */ 55 | public void addData(byte[] newData, int newLength) 56 | { 57 | if(data == null) 58 | { 59 | data = newData; 60 | length = newLength; 61 | offset = 0; 62 | } else 63 | { 64 | // buffer seems to be small. 65 | if((data.length - offset - length) < newLength) 66 | { 67 | // try to sequeeze data at the beginning of the buffer only if current 68 | // buffer does not overlap 69 | if(offset >= length && (data.length - length) >= newLength) 70 | { 71 | System.arraycopy(data, offset, data, 0, length); 72 | offset = 0; 73 | } else 74 | { // worst-case scenario, a new buffer will have to be created 75 | byte[] temp = new byte[data.length + newLength]; 76 | System.arraycopy(data, offset, temp, 0, length); 77 | offset = 0; 78 | data = temp; 79 | } 80 | } 81 | // there's room for everything - just copy 82 | System.arraycopy(newData, 0, data, offset + length, newLength); 83 | length += newLength; 84 | } 85 | } 86 | 87 | /** 88 | * Discards used portions of the buffer. 89 | */ 90 | public void discardData() 91 | { 92 | offset += used; 93 | length -= used; 94 | } 95 | 96 | public byte[] getData() 97 | { 98 | return data; 99 | } 100 | 101 | public int getOffset() 102 | { 103 | return offset; 104 | } 105 | 106 | public int getLength() 107 | { 108 | return length; 109 | } 110 | 111 | public void setMessage(Message message) 112 | { 113 | this.message = message; 114 | } 115 | 116 | public Message getMessage() 117 | { 118 | return message; 119 | } 120 | 121 | public void setused(int used) 122 | { 123 | this.used = used; 124 | } 125 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/MessageFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.InvalidMessageException; 25 | 26 | /** 27 | * A RTSP message factory to build objects from incoming messages or to 28 | * initialize outgoing messages correctly. 29 | * 30 | * 31 | * @author paulo 32 | * 33 | */ 34 | public interface MessageFactory 35 | { 36 | 37 | /** 38 | * 39 | * @param message 40 | */ 41 | void incomingMessage(MessageBuffer message) throws InvalidMessageException; 42 | 43 | Request outgoingRequest(String uri, Request.Method method, int cseq, 44 | Header... extras) throws URISyntaxException; 45 | 46 | Request outgoingRequest(Content body, String uri, Request.Method method, 47 | int cseq, Header... extras) throws URISyntaxException; 48 | 49 | Response outgoingResponse(int code, String message, int cseq, Header... extras); 50 | 51 | Response outgoingResponse(Content body, int code, String text, int cseq, 52 | Header... extras); 53 | } 54 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Request.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | public interface Request extends Message 25 | { 26 | enum Method 27 | { 28 | OPTIONS, DESCRIBE, SETUP, PLAY, RECORD, TEARDOWN 29 | }; 30 | 31 | void setLine(String uri, Method method) throws URISyntaxException; 32 | 33 | Method getMethod(); 34 | 35 | String getURI(); 36 | 37 | void handleResponse(Client client, Response response); 38 | } 39 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Response.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | public interface Response extends Message 23 | { 24 | void setLine(int statusCode, String statusPhrase); 25 | 26 | int getStatusCode(); 27 | 28 | String getStatusText(); 29 | } 30 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/Transport.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | import java.io.IOException; 23 | import java.net.URI; 24 | 25 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 26 | 27 | /** 28 | * This interface defines a transport protocol (TCP, UDP) or method (HTTP 29 | * tunneling). Transport also MUST enqueue a command if a connection is busy at 30 | * the moment it is issued. 31 | * 32 | * @author paulo 33 | */ 34 | public interface Transport 35 | { 36 | void connect(URI to) throws IOException; 37 | 38 | void disconnect(); 39 | 40 | void sendMessage(Message message) throws IOException, MissingHeaderException; 41 | 42 | void setTransportListener(TransportListener listener); 43 | 44 | void setUserData(Object data); 45 | 46 | boolean isConnected(); 47 | } 48 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/concepts/TransportListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.concepts; 21 | 22 | /** 23 | * Listener for transport events. Implementations of {@link Transport}, when 24 | * calling a listener method, must catch all errors and submit them to the 25 | * error() method. 26 | * 27 | * @author paulo 28 | * 29 | */ 30 | public interface TransportListener 31 | { 32 | void connected(Transport t) throws Throwable; 33 | 34 | void error(Transport t, Throwable error); 35 | 36 | void error(Transport t, Message message, Throwable error); 37 | 38 | void remoteDisconnection(Transport t) throws Throwable; 39 | 40 | void dataReceived(Transport t, byte[] data, int size) throws Throwable; 41 | 42 | void dataSent(Transport t) throws Throwable; 43 | } 44 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 67 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers 5 | END 6 | BaseIntegerHeader.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 90 10 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/BaseIntegerHeader.java 11 | END 12 | CSeqHeader.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 83 16 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/CSeqHeader.java 17 | END 18 | ContentLengthHeader.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 92 22 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/ContentLengthHeader.java 23 | END 24 | ContentTypeHeader.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 90 28 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/ContentTypeHeader.java 29 | END 30 | TransportHeader.java 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 88 34 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/TransportHeader.java 35 | END 36 | BaseStringHeader.java 37 | K 25 38 | svn:wc:ra_dav:version-url 39 | V 89 40 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/BaseStringHeader.java 41 | END 42 | ContentEncodingHeader.java 43 | K 25 44 | svn:wc:ra_dav:version-url 45 | V 94 46 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/ContentEncodingHeader.java 47 | END 48 | SessionHeader.java 49 | K 25 50 | svn:wc:ra_dav:version-url 51 | V 86 52 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/headers/SessionHeader.java 53 | END 54 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology/rtspclient/headers 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | BaseIntegerHeader.java 30 | file 31 | 32 | 33 | 34 | 35 | 2010-01-04T17:14:25.000000Z 36 | ff7cda0f57d1058b1eb35768a95a41c5 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1497 62 | 63 | CSeqHeader.java 64 | file 65 | 66 | 67 | 68 | 69 | 2010-01-04T17:14:23.000000Z 70 | a5384afeee3b32c827646d26600887c8 71 | 2010-01-04T21:59:35.170006Z 72 | 2 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1084 96 | 97 | TransportHeader.java 98 | file 99 | 100 | 101 | 102 | 103 | 2010-01-04T17:14:23.000000Z 104 | 354b8364dda869f8870e3f1ee365264c 105 | 2010-01-04T21:59:35.170006Z 106 | 2 107 | paulo.panhoto 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 3929 130 | 131 | ContentTypeHeader.java 132 | file 133 | 134 | 135 | 136 | 137 | 2010-01-04T17:14:25.000000Z 138 | 0fecf094bad586ae7cba36a0fd10070d 139 | 2010-01-04T21:59:35.170006Z 140 | 2 141 | paulo.panhoto 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 1063 164 | 165 | ContentLengthHeader.java 166 | file 167 | 168 | 169 | 170 | 171 | 2010-01-04T17:14:23.000000Z 172 | 85ca2b7b61cc88957c5f4687eaad7afa 173 | 2010-01-04T21:59:35.170006Z 174 | 2 175 | paulo.panhoto 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 1143 198 | 199 | ContentEncodingHeader.java 200 | file 201 | 202 | 203 | 204 | 205 | 2010-01-04T17:14:24.000000Z 206 | c540feea4ed2ea4f34a4ef090d8a31db 207 | 2010-01-04T21:59:35.170006Z 208 | 2 209 | paulo.panhoto 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 1080 232 | 233 | BaseStringHeader.java 234 | file 235 | 236 | 237 | 238 | 239 | 2010-01-04T17:14:23.000000Z 240 | d3ae322054e0a61ff2813fcc0fd66e07 241 | 2010-01-04T21:59:35.170006Z 242 | 2 243 | paulo.panhoto 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 1233 266 | 267 | SessionHeader.java 268 | file 269 | 270 | 271 | 272 | 273 | 2010-01-04T17:14:24.000000Z 274 | ede8c875c6d8ecd75020d656d816706b 275 | 2010-01-04T21:59:35.170006Z 276 | 2 277 | paulo.panhoto 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 295 | 296 | 297 | 298 | 299 | 1048 300 | 301 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/BaseIntegerHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Header; 23 | 24 | public class BaseIntegerHeader extends Header 25 | { 26 | 27 | private int value; 28 | 29 | public BaseIntegerHeader(String name) 30 | { 31 | super(name); 32 | String text = getRawValue(); 33 | if(text != null) value = Integer.parseInt(text); 34 | } 35 | 36 | public BaseIntegerHeader(String name, int value) 37 | { 38 | super(name); 39 | setValue(value); 40 | } 41 | 42 | public BaseIntegerHeader(String name, String header) 43 | { 44 | super(header); 45 | checkName(name); 46 | value = Integer.parseInt(getRawValue()); 47 | } 48 | 49 | public final void setValue(int newValue) 50 | { 51 | value = newValue; 52 | setRawValue(String.valueOf(value)); 53 | } 54 | 55 | public final int getValue() 56 | { 57 | return value; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/BaseStringHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | import br.com.voicetechnology.rtspclient.HeaderMismatchException; 23 | import br.com.voicetechnology.rtspclient.concepts.Header; 24 | 25 | public class BaseStringHeader extends Header 26 | { 27 | public BaseStringHeader(String name) 28 | { 29 | super(name); 30 | } 31 | 32 | public BaseStringHeader(String name, String header) 33 | { 34 | super(header); 35 | try 36 | { 37 | checkName(name); 38 | } catch(HeaderMismatchException e) 39 | { 40 | setName(name); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/CSeqHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class CSeqHeader extends BaseIntegerHeader 24 | { 25 | public static final String NAME = "CSeq"; 26 | 27 | public CSeqHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public CSeqHeader(int cseq) 33 | { 34 | super(NAME, cseq); 35 | } 36 | 37 | public CSeqHeader(String line) 38 | { 39 | super(line); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/ContentEncodingHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class ContentEncodingHeader extends BaseStringHeader 24 | { 25 | public static final String NAME = "Content-Encoding"; 26 | 27 | public ContentEncodingHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public ContentEncodingHeader(String header) 33 | { 34 | super(NAME, header); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/ContentLengthHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class ContentLengthHeader extends BaseIntegerHeader 24 | { 25 | public static final String NAME = "Content-Length"; 26 | 27 | public ContentLengthHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public ContentLengthHeader(int value) 33 | { 34 | super(NAME, value); 35 | } 36 | 37 | public ContentLengthHeader(String header) 38 | { 39 | super(NAME, header); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/ContentTypeHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class ContentTypeHeader extends BaseStringHeader 24 | { 25 | public static final String NAME = "Content-Type"; 26 | 27 | public ContentTypeHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public ContentTypeHeader(String header) 33 | { 34 | super(NAME, header); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/SessionHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | public class SessionHeader extends BaseStringHeader 23 | { 24 | public static final String NAME = "Session"; 25 | 26 | public SessionHeader() 27 | { 28 | super(NAME); 29 | } 30 | 31 | public SessionHeader(String header) 32 | { 33 | super(NAME, header); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/.svn/text-base/TransportHeader.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | import java.util.Arrays; 23 | import java.util.List; 24 | 25 | import br.com.voicetechnology.rtspclient.concepts.Header; 26 | 27 | /** 28 | * Models a "Transport" header from RFC 2326. According to specification, there may be parameters, which will be inserted as a list of strings, which follow below: 29 | * 30 | parameter = ( "unicast" | "multicast" ) 31 | | ";" "destination" [ "=" address ] 32 | | ";" "interleaved" "=" channel [ "-" channel ] 33 | | ";" "append" 34 | | ";" "ttl" "=" ttl 35 | | ";" "layers" "=" 1*DIGIT 36 | | ";" "port" "=" port [ "-" port ] 37 | | ";" "client_port" "=" port [ "-" port ] 38 | | ";" "server_port" "=" port [ "-" port ] 39 | | ";" "ssrc" "=" ssrc 40 | | ";" "mode" = <"> 1\#mode <"> 41 | ttl = 1*3(DIGIT) 42 | port = 1*5(DIGIT) 43 | ssrc = 8*8(HEX) 44 | channel = 1*3(DIGIT) 45 | address = host 46 | mode = <"> *Method <"> | Method 47 | 48 | * @author paulo 49 | * 50 | */ 51 | public class TransportHeader extends Header 52 | { 53 | public static final String NAME = "Transport"; 54 | 55 | public static enum LowerTransport { 56 | TCP, UDP, DEFAULT 57 | }; 58 | 59 | private LowerTransport transport; 60 | 61 | private List parameters; 62 | 63 | public TransportHeader(String header) 64 | { 65 | super(header); 66 | String value = getRawValue(); 67 | if(!value.startsWith("RTP/AVP")) 68 | throw new IllegalArgumentException("Missing RTP/AVP"); 69 | int index = 7; 70 | if(value.charAt(index) == '/') 71 | { 72 | switch(value.charAt(++index)) 73 | { 74 | case 'T': 75 | transport = LowerTransport.TCP; 76 | break; 77 | case 'U': 78 | transport = LowerTransport.UDP; 79 | break; 80 | default: 81 | throw new IllegalArgumentException("Invalid Transport: " 82 | + value.substring(7)); 83 | } 84 | index += 2; 85 | } else 86 | transport = LowerTransport.DEFAULT; 87 | ++index; 88 | if(value.charAt(index) != ';' || index != value.length()) 89 | throw new IllegalArgumentException("Parameter block expected"); 90 | addParameters(value.substring(++index).split(";")); 91 | } 92 | 93 | public TransportHeader(LowerTransport transport, String... parameters) 94 | { 95 | super(NAME); 96 | this.transport = transport; 97 | addParameters(parameters); 98 | } 99 | 100 | void addParameters(String[] parameterList) 101 | { 102 | if(parameters == null) 103 | parameters = Arrays.asList(parameterList); 104 | else 105 | parameters.addAll(Arrays.asList(parameterList)); 106 | } 107 | 108 | LowerTransport getTransport() 109 | { 110 | return transport; 111 | } 112 | 113 | String getParameter(String part) 114 | { 115 | for(String parameter : parameters) 116 | if(parameter.startsWith(part)) 117 | return parameter; 118 | throw new IllegalArgumentException("No such parameter named " + part); 119 | } 120 | 121 | @Override 122 | public String toString() 123 | { 124 | StringBuilder buffer = new StringBuilder(NAME).append(": ").append("RTP/AVP"); 125 | if(transport != LowerTransport.DEFAULT) 126 | buffer.append('/').append(transport); 127 | for(String parameter : parameters) 128 | buffer.append(';').append(parameter); 129 | return buffer.toString(); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/BaseIntegerHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Header; 23 | 24 | public class BaseIntegerHeader extends Header 25 | { 26 | 27 | private int value; 28 | 29 | public BaseIntegerHeader(String name) 30 | { 31 | super(name); 32 | String text = getRawValue(); 33 | if(text != null) value = Integer.parseInt(text); 34 | } 35 | 36 | public BaseIntegerHeader(String name, int value) 37 | { 38 | super(name); 39 | setValue(value); 40 | } 41 | 42 | public BaseIntegerHeader(String name, String header) 43 | { 44 | super(header); 45 | checkName(name); 46 | value = Integer.parseInt(getRawValue()); 47 | } 48 | 49 | public final void setValue(int newValue) 50 | { 51 | value = newValue; 52 | setRawValue(String.valueOf(value)); 53 | } 54 | 55 | public final int getValue() 56 | { 57 | return value; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/BaseStringHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | import br.com.voicetechnology.rtspclient.HeaderMismatchException; 23 | import br.com.voicetechnology.rtspclient.concepts.Header; 24 | 25 | public class BaseStringHeader extends Header 26 | { 27 | public BaseStringHeader(String name) 28 | { 29 | super(name); 30 | } 31 | 32 | public BaseStringHeader(String name, String header) 33 | { 34 | super(header); 35 | try 36 | { 37 | checkName(name); 38 | } catch(HeaderMismatchException e) 39 | { 40 | setName(name); 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/CSeqHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class CSeqHeader extends BaseIntegerHeader 24 | { 25 | public static final String NAME = "CSeq"; 26 | 27 | public CSeqHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public CSeqHeader(int cseq) 33 | { 34 | super(NAME, cseq); 35 | } 36 | 37 | public CSeqHeader(String line) 38 | { 39 | super(line); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/ContentEncodingHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class ContentEncodingHeader extends BaseStringHeader 24 | { 25 | public static final String NAME = "Content-Encoding"; 26 | 27 | public ContentEncodingHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public ContentEncodingHeader(String header) 33 | { 34 | super(NAME, header); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/ContentLengthHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class ContentLengthHeader extends BaseIntegerHeader 24 | { 25 | public static final String NAME = "Content-Length"; 26 | 27 | public ContentLengthHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public ContentLengthHeader(int value) 33 | { 34 | super(NAME, value); 35 | } 36 | 37 | public ContentLengthHeader(String header) 38 | { 39 | super(NAME, header); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/ContentTypeHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | 23 | public class ContentTypeHeader extends BaseStringHeader 24 | { 25 | public static final String NAME = "Content-Type"; 26 | 27 | public ContentTypeHeader() 28 | { 29 | super(NAME); 30 | } 31 | 32 | public ContentTypeHeader(String header) 33 | { 34 | super(NAME, header); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/SessionHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | public class SessionHeader extends BaseStringHeader 23 | { 24 | public static final String NAME = "Session"; 25 | 26 | public SessionHeader() 27 | { 28 | super(NAME); 29 | } 30 | 31 | public SessionHeader(String header) 32 | { 33 | super(NAME, header); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/headers/TransportHeader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.headers; 21 | 22 | import java.util.Arrays; 23 | import java.util.List; 24 | 25 | import br.com.voicetechnology.rtspclient.concepts.Header; 26 | 27 | /** 28 | * Models a "Transport" header from RFC 2326. According to specification, there may be parameters, which will be inserted as a list of strings, which follow below: 29 | * 30 | parameter = ( "unicast" | "multicast" ) 31 | | ";" "destination" [ "=" address ] 32 | | ";" "interleaved" "=" channel [ "-" channel ] 33 | | ";" "append" 34 | | ";" "ttl" "=" ttl 35 | | ";" "layers" "=" 1*DIGIT 36 | | ";" "port" "=" port [ "-" port ] 37 | | ";" "client_port" "=" port [ "-" port ] 38 | | ";" "server_port" "=" port [ "-" port ] 39 | | ";" "ssrc" "=" ssrc 40 | | ";" "mode" = <"> 1\#mode <"> 41 | ttl = 1*3(DIGIT) 42 | port = 1*5(DIGIT) 43 | ssrc = 8*8(HEX) 44 | channel = 1*3(DIGIT) 45 | address = host 46 | mode = <"> *Method <"> | Method 47 | 48 | * @author paulo 49 | * 50 | */ 51 | public class TransportHeader extends Header 52 | { 53 | public static final String NAME = "Transport"; 54 | 55 | public static enum LowerTransport { 56 | TCP, UDP, DEFAULT 57 | }; 58 | 59 | private LowerTransport transport; 60 | 61 | private List parameters; 62 | 63 | public TransportHeader(String header) 64 | { 65 | super(header); 66 | String value = getRawValue(); 67 | if(!value.startsWith("RTP/AVP")) 68 | throw new IllegalArgumentException("Missing RTP/AVP"); 69 | int index = 7; 70 | if(value.charAt(index) == '/') 71 | { 72 | switch(value.charAt(++index)) 73 | { 74 | case 'T': 75 | transport = LowerTransport.TCP; 76 | break; 77 | case 'U': 78 | transport = LowerTransport.UDP; 79 | break; 80 | default: 81 | throw new IllegalArgumentException("Invalid Transport: " 82 | + value.substring(7)); 83 | } 84 | index += 2; 85 | } else 86 | transport = LowerTransport.DEFAULT; 87 | ++index; 88 | if(value.charAt(index) != ';' || index != value.length()) 89 | throw new IllegalArgumentException("Parameter block expected"); 90 | addParameters(value.substring(++index).split(";")); 91 | } 92 | 93 | public TransportHeader(LowerTransport transport, String... parameters) 94 | { 95 | super(NAME); 96 | this.transport = transport; 97 | addParameters(parameters); 98 | } 99 | 100 | void addParameters(String[] parameterList) 101 | { 102 | if(parameters == null) 103 | parameters = Arrays.asList(parameterList); 104 | else 105 | parameters.addAll(Arrays.asList(parameterList)); 106 | } 107 | 108 | LowerTransport getTransport() 109 | { 110 | return transport; 111 | } 112 | 113 | String getParameter(String part) 114 | { 115 | for(String parameter : parameters) 116 | if(parameter.startsWith(part)) 117 | return parameter; 118 | throw new IllegalArgumentException("No such parameter named " + part); 119 | } 120 | 121 | @Override 122 | public String toString() 123 | { 124 | StringBuilder buffer = new StringBuilder(NAME).append(": ").append("RTP/AVP"); 125 | if(transport != LowerTransport.DEFAULT) 126 | buffer.append('/').append(transport); 127 | for(String parameter : parameters) 128 | buffer.append(';').append(parameter); 129 | return buffer.toString(); 130 | } 131 | } 132 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 68 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/messages 5 | END 6 | RTSPDescribeRequest.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 93 10 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/messages/RTSPDescribeRequest.java 11 | END 12 | RTSPSetupRequest.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 90 16 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/messages/RTSPSetupRequest.java 17 | END 18 | RTSPTeardownRequest.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 93 22 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/messages/RTSPTeardownRequest.java 23 | END 24 | RTSPPlayRequest.java 25 | K 25 26 | svn:wc:ra_dav:version-url 27 | V 89 28 | /svn/!svn/ver/3/trunk/src/br/com/voicetechnology/rtspclient/messages/RTSPPlayRequest.java 29 | END 30 | RTSPOptionsRequest.java 31 | K 25 32 | svn:wc:ra_dav:version-url 33 | V 92 34 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/messages/RTSPOptionsRequest.java 35 | END 36 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology/rtspclient/messages 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | RTSPDescribeRequest.java 30 | file 31 | 32 | 33 | 34 | 35 | 2010-01-04T20:09:00.000000Z 36 | da62a33de7bc240ed09ba133264e05f0 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1781 62 | 63 | RTSPSetupRequest.java 64 | file 65 | 66 | 67 | 68 | 69 | 2010-01-04T17:14:23.000000Z 70 | b9c768904e227ba5f8a36791a1032006 71 | 2010-01-04T21:59:35.170006Z 72 | 2 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1826 96 | 97 | RTSPTeardownRequest.java 98 | file 99 | 100 | 101 | 102 | 103 | 2010-01-04T17:14:24.000000Z 104 | c97f41ee4b5979d524bbe7a57a7ee62b 105 | 2010-01-04T21:59:35.170006Z 106 | 2 107 | paulo.panhoto 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 1736 130 | 131 | RTSPPlayRequest.java 132 | file 133 | 3 134 | 135 | 136 | 137 | 2010-01-05T17:04:23.000000Z 138 | 1e3a58edb0392a00d8359e32730703cf 139 | 2010-01-05T17:50:40.527794Z 140 | 3 141 | paulo.panhoto 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 1404 164 | 165 | RTSPOptionsRequest.java 166 | file 167 | 168 | 169 | 170 | 171 | 2010-01-04T17:14:23.000000Z 172 | 01e9908ce0fa82e33b70bb8c8b562dc6 173 | 2010-01-04T21:59:35.170006Z 174 | 2 175 | paulo.panhoto 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 1375 198 | 199 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/text-base/RTSPDescribeRequest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.concepts.Client; 27 | import br.com.voicetechnology.rtspclient.concepts.Response; 28 | 29 | public class RTSPDescribeRequest extends RTSPRequest 30 | { 31 | 32 | public RTSPDescribeRequest() 33 | { 34 | super(); 35 | } 36 | 37 | public RTSPDescribeRequest(String messageLine) throws URISyntaxException 38 | { 39 | super(messageLine); 40 | } 41 | 42 | @Override 43 | public byte[] getBytes() throws MissingHeaderException 44 | { 45 | getHeader("Accept"); 46 | return super.getBytes(); 47 | } 48 | 49 | @Override 50 | public void handleResponse(Client client, Response response) 51 | { 52 | super.handleResponse(client, response); 53 | try 54 | { 55 | client.getClientListener().mediaDescriptor(client, 56 | new String(response.getEntityMessage().getContent().getBytes())); 57 | } catch(Exception e) 58 | { 59 | client.getClientListener().generalError(client, e); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/text-base/RTSPOptionsRequest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URI; 23 | import java.net.URISyntaxException; 24 | 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | 27 | public class RTSPOptionsRequest extends RTSPRequest 28 | { 29 | public RTSPOptionsRequest() 30 | { 31 | } 32 | 33 | public RTSPOptionsRequest(String line) throws URISyntaxException 34 | { 35 | super(line); 36 | } 37 | 38 | @Override 39 | public void setLine(String uri, Method method) throws URISyntaxException 40 | { 41 | setMethod(method); 42 | setURI("*".equals(uri) ? uri : new URI(uri).toString()); 43 | 44 | super.setLine(method.toString() + ' ' + uri + ' ' + RTSP_VERSION_TOKEN); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/text-base/RTSPPlayRequest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 27 | 28 | /** 29 | * 30 | * @author paulo 31 | * 32 | */ 33 | public class RTSPPlayRequest extends RTSPRequest 34 | { 35 | 36 | public RTSPPlayRequest() 37 | { 38 | } 39 | 40 | public RTSPPlayRequest(String messageLine) throws URISyntaxException 41 | { 42 | super(messageLine); 43 | } 44 | 45 | @Override 46 | public byte[] getBytes() throws MissingHeaderException 47 | { 48 | getHeader(SessionHeader.NAME); 49 | return super.getBytes(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/text-base/RTSPSetupRequest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.concepts.Client; 27 | import br.com.voicetechnology.rtspclient.concepts.Response; 28 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 29 | 30 | public class RTSPSetupRequest extends RTSPRequest 31 | { 32 | public RTSPSetupRequest() 33 | { 34 | } 35 | 36 | public RTSPSetupRequest(String line) throws URISyntaxException 37 | { 38 | super(line); 39 | } 40 | 41 | @Override 42 | public byte[] getBytes() throws MissingHeaderException 43 | { 44 | getHeader("Transport"); 45 | return super.getBytes(); 46 | } 47 | 48 | @Override 49 | public void handleResponse(Client client, Response response) 50 | { 51 | super.handleResponse(client, response); 52 | try 53 | { 54 | if(response.getStatusCode() == 200) 55 | client.setSession((SessionHeader) response 56 | .getHeader(SessionHeader.NAME)); 57 | } catch(MissingHeaderException e) 58 | { 59 | client.getClientListener().generalError(client, e); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/.svn/text-base/RTSPTeardownRequest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.concepts.Client; 27 | import br.com.voicetechnology.rtspclient.concepts.Response; 28 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 29 | 30 | public class RTSPTeardownRequest extends RTSPRequest 31 | { 32 | 33 | public RTSPTeardownRequest() 34 | { 35 | super(); 36 | } 37 | 38 | public RTSPTeardownRequest(String messageLine) throws URISyntaxException 39 | { 40 | super(messageLine); 41 | } 42 | 43 | @Override 44 | public byte[] getBytes() throws MissingHeaderException 45 | { 46 | getHeader(SessionHeader.NAME); 47 | return super.getBytes(); 48 | } 49 | 50 | @Override 51 | public void handleResponse(Client client, Response response) 52 | { 53 | super.handleResponse(client, response); 54 | if(response.getStatusCode() == 200) client.setSession(null); 55 | client.getTransport().disconnect(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/RTSPDescribeRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.concepts.Client; 27 | import br.com.voicetechnology.rtspclient.concepts.Response; 28 | 29 | public class RTSPDescribeRequest extends RTSPRequest 30 | { 31 | 32 | public RTSPDescribeRequest() 33 | { 34 | super(); 35 | } 36 | 37 | public RTSPDescribeRequest(String messageLine) throws URISyntaxException 38 | { 39 | super(messageLine); 40 | } 41 | 42 | @Override 43 | public byte[] getBytes() throws MissingHeaderException 44 | { 45 | getHeader("Accept"); 46 | return super.getBytes(); 47 | } 48 | 49 | @Override 50 | public void handleResponse(Client client, Response response) 51 | { 52 | super.handleResponse(client, response); 53 | try 54 | { 55 | client.getClientListener().mediaDescriptor(client, 56 | new String(response.getEntityMessage().getContent().getBytes())); 57 | } catch(Exception e) 58 | { 59 | client.getClientListener().generalError(client, e); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/RTSPOptionsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URI; 23 | import java.net.URISyntaxException; 24 | 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | 27 | public class RTSPOptionsRequest extends RTSPRequest 28 | { 29 | public RTSPOptionsRequest() 30 | { 31 | } 32 | 33 | public RTSPOptionsRequest(String line) throws URISyntaxException 34 | { 35 | super(line); 36 | } 37 | 38 | @Override 39 | public void setLine(String uri, Method method) throws URISyntaxException 40 | { 41 | setMethod(method); 42 | setURI("*".equals(uri) ? uri : new URI(uri).toString()); 43 | 44 | super.setLine(method.toString() + ' ' + uri + ' ' + RTSP_VERSION_TOKEN); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/RTSPPlayRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 27 | 28 | /** 29 | * 30 | * @author paulo 31 | * 32 | */ 33 | public class RTSPPlayRequest extends RTSPRequest 34 | { 35 | 36 | public RTSPPlayRequest() 37 | { 38 | } 39 | 40 | public RTSPPlayRequest(String messageLine) throws URISyntaxException 41 | { 42 | super(messageLine); 43 | } 44 | 45 | @Override 46 | public byte[] getBytes() throws MissingHeaderException 47 | { 48 | getHeader(SessionHeader.NAME); 49 | return super.getBytes(); 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/RTSPSetupRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.concepts.Client; 27 | import br.com.voicetechnology.rtspclient.concepts.Response; 28 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 29 | 30 | public class RTSPSetupRequest extends RTSPRequest 31 | { 32 | public RTSPSetupRequest() 33 | { 34 | } 35 | 36 | public RTSPSetupRequest(String line) throws URISyntaxException 37 | { 38 | super(line); 39 | } 40 | 41 | @Override 42 | public byte[] getBytes() throws MissingHeaderException 43 | { 44 | getHeader("Transport"); 45 | return super.getBytes(); 46 | } 47 | 48 | @Override 49 | public void handleResponse(Client client, Response response) 50 | { 51 | super.handleResponse(client, response); 52 | try 53 | { 54 | if(response.getStatusCode() == 200) 55 | client.setSession((SessionHeader) response 56 | .getHeader(SessionHeader.NAME)); 57 | } catch(MissingHeaderException e) 58 | { 59 | client.getClientListener().generalError(client, e); 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/messages/RTSPTeardownRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.messages; 21 | 22 | import java.net.URISyntaxException; 23 | 24 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 25 | import br.com.voicetechnology.rtspclient.RTSPRequest; 26 | import br.com.voicetechnology.rtspclient.concepts.Client; 27 | import br.com.voicetechnology.rtspclient.concepts.Response; 28 | import br.com.voicetechnology.rtspclient.headers.SessionHeader; 29 | 30 | public class RTSPTeardownRequest extends RTSPRequest 31 | { 32 | 33 | public RTSPTeardownRequest() 34 | { 35 | super(); 36 | } 37 | 38 | public RTSPTeardownRequest(String messageLine) throws URISyntaxException 39 | { 40 | super(messageLine); 41 | } 42 | 43 | @Override 44 | public byte[] getBytes() throws MissingHeaderException 45 | { 46 | getHeader(SessionHeader.NAME); 47 | return super.getBytes(); 48 | } 49 | 50 | @Override 51 | public void handleResponse(Client client, Response response) 52 | { 53 | super.handleResponse(client, response); 54 | if(response.getStatusCode() == 200) client.setSession(null); 55 | client.getTransport().disconnect(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 64 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/test 5 | END 6 | PLAYTest.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 78 10 | /svn/!svn/ver/3/trunk/src/br/com/voicetechnology/rtspclient/test/PLAYTest.java 11 | END 12 | SETUPandTEARDOWNTest.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 90 16 | /svn/!svn/ver/3/trunk/src/br/com/voicetechnology/rtspclient/test/SETUPandTEARDOWNTest.java 17 | END 18 | OPTIONSTest.java 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 81 22 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/test/OPTIONSTest.java 23 | END 24 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology/rtspclient/test 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | PLAYTest.java 30 | file 31 | 3 32 | 33 | 34 | 35 | 2010-01-05T17:47:54.000000Z 36 | 9df8034f3bc7bfbe926f8823560ffd34 37 | 2010-01-05T17:50:40.527794Z 38 | 3 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1875 62 | 63 | SETUPandTEARDOWNTest.java 64 | file 65 | 3 66 | 67 | 68 | 69 | 2010-01-05T17:44:23.000000Z 70 | 2373b36435a3f098bcea61fa6ac3f33c 71 | 2010-01-05T17:50:40.527794Z 72 | 3 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3827 96 | 97 | OPTIONSTest.java 98 | file 99 | 100 | 101 | 102 | 103 | 2010-01-04T17:14:25.000000Z 104 | a878c8e267e1124bf9ffa7656bdb0d7e 105 | 2010-01-04T21:59:35.170006Z 106 | 2 107 | paulo.panhoto 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 2142 130 | 131 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/.svn/text-base/OPTIONSTest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.test; 21 | 22 | import java.net.URI; 23 | 24 | import br.com.voicetechnology.rtspclient.RTSPClient; 25 | import br.com.voicetechnology.rtspclient.concepts.Client; 26 | import br.com.voicetechnology.rtspclient.concepts.ClientListener; 27 | import br.com.voicetechnology.rtspclient.concepts.Request; 28 | import br.com.voicetechnology.rtspclient.concepts.Response; 29 | import br.com.voicetechnology.rtspclient.transport.PlainTCP; 30 | 31 | public class OPTIONSTest implements ClientListener 32 | { 33 | public static void main(String[] args) throws Throwable 34 | { 35 | new OPTIONSTest(); 36 | } 37 | 38 | private OPTIONSTest() throws Exception 39 | { 40 | RTSPClient client = new RTSPClient(); 41 | 42 | client.setTransport(new PlainTCP()); 43 | client.setClientListener(this); 44 | client.options("*", new URI("rtsp://rmv8.bbc.net.uk/1xtra/")); 45 | } 46 | 47 | @Override 48 | public void requestFailed(Client client, Request request, Throwable cause) 49 | { 50 | System.out.println("Request failed \n" + request); 51 | } 52 | 53 | @Override 54 | public void response(Client client, Request request, Response response) 55 | { 56 | System.out.println("Got response: \n" + response); 57 | System.out.println("for the request: \n" + request); 58 | } 59 | 60 | @Override 61 | public void generalError(Client client, Throwable error) 62 | { 63 | error.printStackTrace(); 64 | } 65 | 66 | @Override 67 | public void mediaDescriptor(Client client, String descriptor) 68 | { 69 | // TODO Auto-generated method stub 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/.svn/text-base/PLAYTest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.test; 21 | 22 | import java.io.IOException; 23 | 24 | import br.com.voicetechnology.rtspclient.concepts.Client; 25 | import br.com.voicetechnology.rtspclient.concepts.Request; 26 | import br.com.voicetechnology.rtspclient.concepts.Response; 27 | import br.com.voicetechnology.rtspclient.concepts.Request.Method; 28 | 29 | /** 30 | * Testing the PLAY message. RTP Stream can be checked with Wireshark or a play 31 | * with RTP only capability. 32 | * 33 | * @author paulo 34 | * 35 | */ 36 | public class PLAYTest extends SETUPandTEARDOWNTest 37 | { 38 | 39 | public static void main(String[] args) throws Throwable 40 | { 41 | new PLAYTest(); 42 | } 43 | 44 | protected PLAYTest() throws Exception 45 | { 46 | super(); 47 | } 48 | 49 | @Override 50 | public void response(Client client, Request request, Response response) 51 | { 52 | try 53 | { 54 | super.response(client, request, response); 55 | 56 | if(request.getMethod() == Method.PLAY && response.getStatusCode() == 200) 57 | { 58 | Thread.sleep(10000); 59 | client.teardown(); 60 | } 61 | } catch(Throwable t) 62 | { 63 | generalError(client, t); 64 | } 65 | } 66 | 67 | @Override 68 | protected void sessionSet(Client client) throws IOException 69 | { 70 | client.play(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/.svn/text-base/SETUPandTEARDOWNTest.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.test; 21 | 22 | import java.io.IOException; 23 | import java.net.URI; 24 | import java.util.Collections; 25 | import java.util.LinkedList; 26 | import java.util.List; 27 | 28 | import br.com.voicetechnology.rtspclient.RTSPClient; 29 | import br.com.voicetechnology.rtspclient.concepts.Client; 30 | import br.com.voicetechnology.rtspclient.concepts.ClientListener; 31 | import br.com.voicetechnology.rtspclient.concepts.Request; 32 | import br.com.voicetechnology.rtspclient.concepts.Response; 33 | import br.com.voicetechnology.rtspclient.transport.PlainTCP; 34 | 35 | public class SETUPandTEARDOWNTest implements ClientListener 36 | { 37 | private final static String TARGET_URI = "rtsp://192.168.0.102/sample_50kbit.3gp"; 38 | 39 | public static void main(String[] args) throws Throwable 40 | { 41 | new SETUPandTEARDOWNTest(); 42 | } 43 | 44 | private final List resourceList; 45 | 46 | private String controlURI; 47 | 48 | private int port; 49 | 50 | protected SETUPandTEARDOWNTest() throws Exception 51 | { 52 | RTSPClient client = new RTSPClient(); 53 | 54 | client.setTransport(new PlainTCP()); 55 | client.setClientListener(this); 56 | client.describe(new URI(TARGET_URI)); 57 | resourceList = Collections.synchronizedList(new LinkedList()); 58 | port = 2000; 59 | } 60 | 61 | @Override 62 | public void requestFailed(Client client, Request request, Throwable cause) 63 | { 64 | System.out.println("Request failed \n" + request); 65 | cause.printStackTrace(); 66 | } 67 | 68 | @Override 69 | public void response(Client client, Request request, Response response) 70 | { 71 | try 72 | { 73 | System.out.println("Got response: \n" + response); 74 | System.out.println("for the request: \n" + request); 75 | if(response.getStatusCode() == 200) 76 | { 77 | switch(request.getMethod()) 78 | { 79 | case DESCRIBE: 80 | System.out.println(resourceList); 81 | if(resourceList.get(0).equals("*")) 82 | { 83 | controlURI = request.getURI(); 84 | resourceList.remove(0); 85 | } 86 | if(resourceList.size() > 0) 87 | client.setup(new URI(controlURI), nextPort(), resourceList 88 | .remove(0)); 89 | else 90 | client.setup(new URI(controlURI), nextPort()); 91 | break; 92 | 93 | case SETUP: 94 | //sets up next session or ends everything. 95 | if(resourceList.size() > 0) 96 | client.setup(new URI(controlURI), nextPort(), resourceList 97 | .remove(0)); 98 | else 99 | sessionSet(client); 100 | break; 101 | } 102 | } else 103 | client.teardown(); 104 | } catch(Throwable t) 105 | { 106 | generalError(client, t); 107 | } 108 | } 109 | 110 | @Override 111 | public void generalError(Client client, Throwable error) 112 | { 113 | error.printStackTrace(); 114 | } 115 | 116 | @Override 117 | public void mediaDescriptor(Client client, String descriptor) 118 | { 119 | // searches for control: session and media arguments. 120 | final String target = "control:"; 121 | System.out.println("Session Descriptor\n" + descriptor); 122 | int position = -1; 123 | while((position = descriptor.indexOf(target)) > -1) 124 | { 125 | descriptor = descriptor.substring(position + target.length()); 126 | resourceList.add(descriptor.substring(0, descriptor.indexOf('\r'))); 127 | } 128 | } 129 | 130 | protected void sessionSet(Client client) throws IOException 131 | { 132 | client.teardown(); 133 | } 134 | 135 | private int nextPort() 136 | { 137 | return (port += 2) - 2; 138 | } 139 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/OPTIONSTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.test; 21 | 22 | import java.net.URI; 23 | 24 | import br.com.voicetechnology.rtspclient.RTSPClient; 25 | import br.com.voicetechnology.rtspclient.concepts.Client; 26 | import br.com.voicetechnology.rtspclient.concepts.ClientListener; 27 | import br.com.voicetechnology.rtspclient.concepts.Request; 28 | import br.com.voicetechnology.rtspclient.concepts.Response; 29 | import br.com.voicetechnology.rtspclient.transport.PlainTCP; 30 | 31 | public class OPTIONSTest implements ClientListener 32 | { 33 | public static void main(String[] args) throws Throwable 34 | { 35 | new OPTIONSTest(); 36 | } 37 | 38 | private OPTIONSTest() throws Exception 39 | { 40 | RTSPClient client = new RTSPClient(); 41 | 42 | client.setTransport(new PlainTCP()); 43 | client.setClientListener(this); 44 | client.options("*", new URI("rtsp://rmv8.bbc.net.uk/1xtra/")); 45 | } 46 | 47 | @Override 48 | public void requestFailed(Client client, Request request, Throwable cause) 49 | { 50 | System.out.println("Request failed \n" + request); 51 | } 52 | 53 | @Override 54 | public void response(Client client, Request request, Response response) 55 | { 56 | System.out.println("Got response: \n" + response); 57 | System.out.println("for the request: \n" + request); 58 | } 59 | 60 | @Override 61 | public void generalError(Client client, Throwable error) 62 | { 63 | error.printStackTrace(); 64 | } 65 | 66 | @Override 67 | public void mediaDescriptor(Client client, String descriptor) 68 | { 69 | // TODO Auto-generated method stub 70 | 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/PLAYTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.test; 21 | 22 | import java.io.IOException; 23 | 24 | import br.com.voicetechnology.rtspclient.concepts.Client; 25 | import br.com.voicetechnology.rtspclient.concepts.Request; 26 | import br.com.voicetechnology.rtspclient.concepts.Response; 27 | import br.com.voicetechnology.rtspclient.concepts.Request.Method; 28 | 29 | /** 30 | * Testing the PLAY message. RTP Stream can be checked with Wireshark or a play 31 | * with RTP only capability. 32 | * 33 | * @author paulo 34 | * 35 | */ 36 | public class PLAYTest extends SETUPandTEARDOWNTest 37 | { 38 | 39 | public static void main(String[] args) throws Throwable 40 | { 41 | new PLAYTest(); 42 | } 43 | 44 | protected PLAYTest() throws Exception 45 | { 46 | super(); 47 | } 48 | 49 | @Override 50 | public void response(Client client, Request request, Response response) 51 | { 52 | try 53 | { 54 | super.response(client, request, response); 55 | 56 | if(request.getMethod() == Method.PLAY && response.getStatusCode() == 200) 57 | { 58 | Thread.sleep(10000); 59 | client.teardown(); 60 | } 61 | } catch(Throwable t) 62 | { 63 | generalError(client, t); 64 | } 65 | } 66 | 67 | @Override 68 | protected void sessionSet(Client client) throws IOException 69 | { 70 | client.play(); 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/test/SETUPandTEARDOWNTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.test; 21 | 22 | import java.io.IOException; 23 | import java.net.URI; 24 | import java.util.Collections; 25 | import java.util.LinkedList; 26 | import java.util.List; 27 | 28 | import br.com.voicetechnology.rtspclient.RTSPClient; 29 | import br.com.voicetechnology.rtspclient.concepts.Client; 30 | import br.com.voicetechnology.rtspclient.concepts.ClientListener; 31 | import br.com.voicetechnology.rtspclient.concepts.Request; 32 | import br.com.voicetechnology.rtspclient.concepts.Response; 33 | import br.com.voicetechnology.rtspclient.transport.PlainTCP; 34 | 35 | public class SETUPandTEARDOWNTest implements ClientListener 36 | { 37 | private final static String TARGET_URI = "rtsp://192.168.0.102/sample_50kbit.3gp"; 38 | 39 | public static void main(String[] args) throws Throwable 40 | { 41 | new SETUPandTEARDOWNTest(); 42 | } 43 | 44 | private final List resourceList; 45 | 46 | private String controlURI; 47 | 48 | private int port; 49 | 50 | protected SETUPandTEARDOWNTest() throws Exception 51 | { 52 | RTSPClient client = new RTSPClient(); 53 | 54 | client.setTransport(new PlainTCP()); 55 | client.setClientListener(this); 56 | client.describe(new URI(TARGET_URI)); 57 | resourceList = Collections.synchronizedList(new LinkedList()); 58 | port = 2000; 59 | } 60 | 61 | @Override 62 | public void requestFailed(Client client, Request request, Throwable cause) 63 | { 64 | System.out.println("Request failed \n" + request); 65 | cause.printStackTrace(); 66 | } 67 | 68 | @Override 69 | public void response(Client client, Request request, Response response) 70 | { 71 | try 72 | { 73 | System.out.println("Got response: \n" + response); 74 | System.out.println("for the request: \n" + request); 75 | if(response.getStatusCode() == 200) 76 | { 77 | switch(request.getMethod()) 78 | { 79 | case DESCRIBE: 80 | System.out.println(resourceList); 81 | if(resourceList.get(0).equals("*")) 82 | { 83 | controlURI = request.getURI(); 84 | resourceList.remove(0); 85 | } 86 | if(resourceList.size() > 0) 87 | client.setup(new URI(controlURI), nextPort(), resourceList 88 | .remove(0)); 89 | else 90 | client.setup(new URI(controlURI), nextPort()); 91 | break; 92 | 93 | case SETUP: 94 | //sets up next session or ends everything. 95 | if(resourceList.size() > 0) 96 | client.setup(new URI(controlURI), nextPort(), resourceList 97 | .remove(0)); 98 | else 99 | sessionSet(client); 100 | break; 101 | } 102 | } else 103 | client.teardown(); 104 | } catch(Throwable t) 105 | { 106 | generalError(client, t); 107 | } 108 | } 109 | 110 | @Override 111 | public void generalError(Client client, Throwable error) 112 | { 113 | error.printStackTrace(); 114 | } 115 | 116 | @Override 117 | public void mediaDescriptor(Client client, String descriptor) 118 | { 119 | // searches for control: session and media arguments. 120 | final String target = "control:"; 121 | System.out.println("Session Descriptor\n" + descriptor); 122 | int position = -1; 123 | while((position = descriptor.indexOf(target)) > -1) 124 | { 125 | descriptor = descriptor.substring(position + target.length()); 126 | resourceList.add(descriptor.substring(0, descriptor.indexOf('\r'))); 127 | } 128 | } 129 | 130 | protected void sessionSet(Client client) throws IOException 131 | { 132 | client.teardown(); 133 | } 134 | 135 | private int nextPort() 136 | { 137 | return (port += 2) - 2; 138 | } 139 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/transport/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 69 4 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/transport 5 | END 6 | SafeTransportListener.java 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 96 10 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/transport/SafeTransportListener.java 11 | END 12 | PlainTCP.java 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 83 16 | /svn/!svn/ver/2/trunk/src/br/com/voicetechnology/rtspclient/transport/PlainTCP.java 17 | END 18 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/transport/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | https://rtsplib-java.googlecode.com/svn/trunk/src/br/com/voicetechnology/rtspclient/transport 6 | https://rtsplib-java.googlecode.com/svn 7 | 8 | 9 | 10 | 2010-01-04T21:59:35.170006Z 11 | 2 12 | paulo.panhoto 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | ae062dfa-f976-11de-ab06-dd2c9883db02 28 | 29 | SafeTransportListener.java 30 | file 31 | 32 | 33 | 34 | 35 | 2010-01-04T17:14:24.000000Z 36 | 4a7ab96c0a2f4108b7c5e8ee9c0c585f 37 | 2010-01-04T21:59:35.170006Z 38 | 2 39 | paulo.panhoto 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2414 62 | 63 | PlainTCP.java 64 | file 65 | 66 | 67 | 68 | 69 | 2010-01-04T17:14:23.000000Z 70 | c7eb2263490ba03afd52782ac630a379 71 | 2010-01-04T21:59:35.170006Z 72 | 2 73 | paulo.panhoto 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 3458 96 | 97 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/transport/.svn/text-base/PlainTCP.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.transport; 21 | 22 | import java.io.IOException; 23 | import java.net.Socket; 24 | import java.net.URI; 25 | 26 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 27 | import br.com.voicetechnology.rtspclient.concepts.Message; 28 | import br.com.voicetechnology.rtspclient.concepts.Transport; 29 | import br.com.voicetechnology.rtspclient.concepts.TransportListener; 30 | 31 | class TransportThread extends Thread 32 | { 33 | private final PlainTCP transport; 34 | 35 | private volatile SafeTransportListener listener; 36 | 37 | public TransportThread(PlainTCP transport, TransportListener listener) 38 | { 39 | this.transport = transport; 40 | this.listener = new SafeTransportListener(listener); 41 | } 42 | 43 | public SafeTransportListener getListener() 44 | { 45 | return listener; 46 | } 47 | 48 | public void setListener(TransportListener listener) 49 | { 50 | listener = new SafeTransportListener(listener); 51 | } 52 | 53 | @Override 54 | public void run() 55 | { 56 | listener.connected(transport); 57 | byte[] buffer = new byte[2048]; 58 | int read = -1; 59 | while(transport.isConnected()) 60 | { 61 | try 62 | { 63 | read = transport.receive(buffer); 64 | if(read == -1) 65 | { 66 | transport.setConnected(false); 67 | listener.remoteDisconnection(transport); 68 | } else 69 | listener.dataReceived(transport, buffer, read); 70 | } catch(IOException e) 71 | { 72 | listener.error(transport, e); 73 | } 74 | } 75 | } 76 | } 77 | 78 | public class PlainTCP implements Transport 79 | { 80 | private Socket socket; 81 | 82 | private TransportThread thread; 83 | 84 | private TransportListener transportListener; 85 | 86 | private volatile boolean connected; 87 | 88 | public PlainTCP() 89 | { 90 | } 91 | 92 | @Override 93 | public void connect(URI to) throws IOException 94 | { 95 | if(connected) 96 | throw new IllegalStateException("Socket is still open. Close it first"); 97 | int port = to.getPort(); 98 | if(port == -1) port = 554; 99 | socket = new Socket(to.getHost(), port); 100 | setConnected(true); 101 | thread = new TransportThread(this, transportListener); 102 | thread.start(); 103 | } 104 | 105 | @Override 106 | public void disconnect() 107 | { 108 | setConnected(false); 109 | try 110 | { 111 | socket.close(); 112 | } catch(IOException e) 113 | { 114 | } 115 | } 116 | 117 | @Override 118 | public boolean isConnected() 119 | { 120 | return connected; 121 | } 122 | 123 | @Override 124 | public synchronized void sendMessage(Message message) throws IOException, 125 | MissingHeaderException 126 | { 127 | socket.getOutputStream().write(message.getBytes()); 128 | thread.getListener().dataSent(this); 129 | } 130 | 131 | @Override 132 | public void setTransportListener(TransportListener listener) 133 | { 134 | transportListener = listener; 135 | if(thread != null) 136 | thread.setListener(listener); 137 | } 138 | 139 | @Override 140 | public void setUserData(Object data) 141 | { 142 | } 143 | 144 | int receive(byte[] data) throws IOException 145 | { 146 | return socket.getInputStream().read(data); 147 | } 148 | 149 | void setConnected(boolean connected) 150 | { 151 | this.connected = connected; 152 | } 153 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/transport/.svn/text-base/SafeTransportListener.java.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.transport; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Message; 23 | import br.com.voicetechnology.rtspclient.concepts.Transport; 24 | import br.com.voicetechnology.rtspclient.concepts.TransportListener; 25 | 26 | /** 27 | * Auxiliary class to make listener calls. 28 | * 29 | * @author paulo 30 | * 31 | */ 32 | class SafeTransportListener implements TransportListener 33 | { 34 | private final TransportListener behaviour; 35 | 36 | public SafeTransportListener(TransportListener theBehaviour) 37 | { 38 | behaviour = theBehaviour; 39 | } 40 | 41 | @Override 42 | public void connected(Transport t) 43 | { 44 | if(behaviour != null) 45 | try 46 | { 47 | behaviour.connected(t); 48 | } catch(Throwable error) 49 | { 50 | behaviour.error(t, error); 51 | } 52 | } 53 | 54 | @Override 55 | public void dataReceived(Transport t, byte[] data, int size) 56 | { 57 | if(behaviour != null) 58 | try 59 | { 60 | behaviour.dataReceived(t, data, size); 61 | } catch(Throwable error) 62 | { 63 | behaviour.error(t, error); 64 | } 65 | } 66 | 67 | @Override 68 | public void dataSent(Transport t) 69 | { 70 | // TODO Auto-generated method stub 71 | if(behaviour != null) 72 | try 73 | { 74 | behaviour.dataSent(t); 75 | } catch(Throwable error) 76 | { 77 | behaviour.error(t, error); 78 | } 79 | 80 | } 81 | 82 | @Override 83 | public void error(Transport t, Throwable error) 84 | { 85 | if(behaviour != null) 86 | behaviour.error(t, error); 87 | } 88 | 89 | @Override 90 | public void error(Transport t, Message message, Throwable error) 91 | { 92 | if(behaviour != null) 93 | behaviour.error(t, message, error); 94 | } 95 | 96 | @Override 97 | public void remoteDisconnection(Transport t) 98 | { 99 | if(behaviour != null) 100 | try 101 | { 102 | behaviour.remoteDisconnection(t); 103 | } catch(Throwable error) 104 | { 105 | behaviour.error(t, error); 106 | } 107 | } 108 | 109 | } 110 | -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/transport/PlainTCP.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.transport; 21 | 22 | import java.io.IOException; 23 | import java.net.Socket; 24 | import java.net.URI; 25 | 26 | import br.com.voicetechnology.rtspclient.MissingHeaderException; 27 | import br.com.voicetechnology.rtspclient.concepts.Message; 28 | import br.com.voicetechnology.rtspclient.concepts.Transport; 29 | import br.com.voicetechnology.rtspclient.concepts.TransportListener; 30 | 31 | class TransportThread extends Thread 32 | { 33 | private final PlainTCP transport; 34 | 35 | private volatile SafeTransportListener listener; 36 | 37 | public TransportThread(PlainTCP transport, TransportListener listener) 38 | { 39 | this.transport = transport; 40 | this.listener = new SafeTransportListener(listener); 41 | } 42 | 43 | public SafeTransportListener getListener() 44 | { 45 | return listener; 46 | } 47 | 48 | public void setListener(TransportListener listener) 49 | { 50 | listener = new SafeTransportListener(listener); 51 | } 52 | 53 | @Override 54 | public void run() 55 | { 56 | listener.connected(transport); 57 | byte[] buffer = new byte[2048]; 58 | int read = -1; 59 | while(transport.isConnected()) 60 | { 61 | try 62 | { 63 | read = transport.receive(buffer); 64 | if(read == -1) 65 | { 66 | transport.setConnected(false); 67 | listener.remoteDisconnection(transport); 68 | } else 69 | listener.dataReceived(transport, buffer, read); 70 | } catch(IOException e) 71 | { 72 | listener.error(transport, e); 73 | } 74 | } 75 | } 76 | } 77 | 78 | public class PlainTCP implements Transport 79 | { 80 | private Socket socket; 81 | 82 | private TransportThread thread; 83 | 84 | private TransportListener transportListener; 85 | 86 | private volatile boolean connected; 87 | 88 | public PlainTCP() 89 | { 90 | } 91 | 92 | @Override 93 | public void connect(URI to) throws IOException 94 | { 95 | if(connected) 96 | throw new IllegalStateException("Socket is still open. Close it first"); 97 | int port = to.getPort(); 98 | if(port == -1) port = 554; 99 | socket = new Socket(to.getHost(), port); 100 | setConnected(true); 101 | thread = new TransportThread(this, transportListener); 102 | thread.start(); 103 | } 104 | 105 | @Override 106 | public void disconnect() 107 | { 108 | setConnected(false); 109 | try 110 | { 111 | socket.close(); 112 | } catch(IOException e) 113 | { 114 | } 115 | } 116 | 117 | @Override 118 | public boolean isConnected() 119 | { 120 | return connected; 121 | } 122 | 123 | @Override 124 | public synchronized void sendMessage(Message message) throws IOException, 125 | MissingHeaderException 126 | { 127 | socket.getOutputStream().write(message.getBytes()); 128 | thread.getListener().dataSent(this); 129 | } 130 | 131 | @Override 132 | public void setTransportListener(TransportListener listener) 133 | { 134 | transportListener = listener; 135 | if(thread != null) 136 | thread.setListener(listener); 137 | } 138 | 139 | @Override 140 | public void setUserData(Object data) 141 | { 142 | } 143 | 144 | int receive(byte[] data) throws IOException 145 | { 146 | return socket.getInputStream().read(data); 147 | } 148 | 149 | void setConnected(boolean connected) 150 | { 151 | this.connected = connected; 152 | } 153 | } -------------------------------------------------------------------------------- /RTSPClientLib/src/br/com/voicetechnology/rtspclient/transport/SafeTransportListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright 2010 Voice Technology Ind. e Com. Ltda. 3 | 4 | This file is part of RTSPClientLib. 5 | 6 | RTSPClientLib is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public License as published by 8 | the Free Software Foundation, either version 3 of the License, or 9 | (at your option) any later version. 10 | 11 | RTSPClientLib is distributed in the hope that it will be useful, 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | GNU Lesser General Public License for more details. 15 | 16 | You should have received a copy of the GNU Lesser General Public License 17 | along with RTSPClientLib. If not, see . 18 | 19 | */ 20 | package br.com.voicetechnology.rtspclient.transport; 21 | 22 | import br.com.voicetechnology.rtspclient.concepts.Message; 23 | import br.com.voicetechnology.rtspclient.concepts.Transport; 24 | import br.com.voicetechnology.rtspclient.concepts.TransportListener; 25 | 26 | /** 27 | * Auxiliary class to make listener calls. 28 | * 29 | * @author paulo 30 | * 31 | */ 32 | class SafeTransportListener implements TransportListener 33 | { 34 | private final TransportListener behaviour; 35 | 36 | public SafeTransportListener(TransportListener theBehaviour) 37 | { 38 | behaviour = theBehaviour; 39 | } 40 | 41 | @Override 42 | public void connected(Transport t) 43 | { 44 | if(behaviour != null) 45 | try 46 | { 47 | behaviour.connected(t); 48 | } catch(Throwable error) 49 | { 50 | behaviour.error(t, error); 51 | } 52 | } 53 | 54 | @Override 55 | public void dataReceived(Transport t, byte[] data, int size) 56 | { 57 | if(behaviour != null) 58 | try 59 | { 60 | behaviour.dataReceived(t, data, size); 61 | } catch(Throwable error) 62 | { 63 | behaviour.error(t, error); 64 | } 65 | } 66 | 67 | @Override 68 | public void dataSent(Transport t) 69 | { 70 | // TODO Auto-generated method stub 71 | if(behaviour != null) 72 | try 73 | { 74 | behaviour.dataSent(t); 75 | } catch(Throwable error) 76 | { 77 | behaviour.error(t, error); 78 | } 79 | 80 | } 81 | 82 | @Override 83 | public void error(Transport t, Throwable error) 84 | { 85 | if(behaviour != null) 86 | behaviour.error(t, error); 87 | } 88 | 89 | @Override 90 | public void error(Transport t, Message message, Throwable error) 91 | { 92 | if(behaviour != null) 93 | behaviour.error(t, message, error); 94 | } 95 | 96 | @Override 97 | public void remoteDisconnection(Transport t) 98 | { 99 | if(behaviour != null) 100 | try 101 | { 102 | behaviour.remoteDisconnection(t); 103 | } catch(Throwable error) 104 | { 105 | behaviour.error(t, error); 106 | } 107 | } 108 | 109 | } 110 | --------------------------------------------------------------------------------