Changeset 715
- Timestamp:
- 01/13/12 09:32:27 (4 months ago)
- Files:
-
- 8 edited
-
branches/1.0/sources/thelib/include/protocols/rtmp/basertmpappprotocolhandler.h (modified) (2 diffs)
-
branches/1.0/sources/thelib/include/protocols/rtmp/streaming/innetrtmpstream.h (modified) (2 diffs)
-
branches/1.0/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp (modified) (3 diffs)
-
branches/1.0/sources/thelib/src/protocols/rtmp/streaming/innetrtmpstream.cpp (modified) (1 diff)
-
trunk/sources/thelib/include/protocols/rtmp/basertmpappprotocolhandler.h (modified) (2 diffs)
-
trunk/sources/thelib/include/protocols/rtmp/streaming/innetrtmpstream.h (modified) (2 diffs)
-
trunk/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp (modified) (3 diffs)
-
trunk/sources/thelib/src/protocols/rtmp/streaming/innetrtmpstream.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/1.0/sources/thelib/include/protocols/rtmp/basertmpappprotocolhandler.h
r658 r715 27 27 #include "protocols/rtmp/rtmpprotocolserializer.h" 28 28 #include "protocols/rtmp/sharedobjects/somanager.h" 29 #include "basertmpprotocol.h" 29 #include "streaming/baseoutstream.h" 30 #include "streaming/baseoutfilestream.h" 30 31 31 32 class OutboundRTMPProtocol; 32 33 class BaseRTMPProtocol; 34 class BaseOutFileStream; 33 35 34 36 class DLLEXP BaseRTMPAppProtocolHandler … … 234 236 bool SendRTMPMessage(BaseRTMPProtocol *pTo, Variant message, 235 237 bool trackResponse = false); 238 239 /* 240 * Create a file stream for writing to disk. 241 * pFrom - The connection which wants to stream to disk 242 * meta - Stream metadata 243 * append - Whether to append this stream to an exiting file 244 * */ 245 virtual BaseOutFileStream *CreateOutFileStream(BaseRTMPProtocol *pFrom, Variant &meta, bool append); 236 246 private: 237 247 /* -
branches/1.0/sources/thelib/include/protocols/rtmp/streaming/innetrtmpstream.h
r637 r715 28 28 class BaseRTMPProtocol; 29 29 class BaseOutStream; 30 class BaseOutFileStream; 30 31 31 32 class DLLEXP InNetRTMPStream … … 71 72 bool persistent = true); 72 73 bool SendOnStatusStreamPublished(); 73 bool RecordFLV(Variant &meta, bool append); 74 bool RecordMP4(Variant &meta); 74 bool Record(BaseOutFileStream* pOutFileStream); 75 75 76 76 virtual void SignalOutStreamAttached(BaseOutStream *pOutStream); -
branches/1.0/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp
r688 r715 29 29 #include "protocols/rtmp/streaming/infilertmpstream.h" 30 30 #include "protocols/rtmp/streaming/innetrtmpstream.h" 31 #include "protocols/rtmp/streaming/outfilertmpflvstream.h" 31 32 #include "streaming/streamstypes.h" 32 33 #include "streaming/baseinstream.h" … … 812 813 Variant meta = GetMetaData(streamName, false); 813 814 814 if ((meta[META_MEDIA_TYPE] == MEDIA_TYPE_LIVE_OR_FLV) || 815 (meta[META_MEDIA_TYPE] == MEDIA_TYPE_FLV)) { 816 if (!pInNetRTMPStream->RecordFLV(meta, appending)) { 817 FATAL("Unable to bind the recording stream"); 818 return false; 819 } 820 } else if (meta[META_MEDIA_TYPE] == MEDIA_TYPE_MP4) { 821 if (!pInNetRTMPStream->RecordMP4(meta)) { 822 FATAL("Unable to bind the recording stream"); 823 return false; 824 } 815 BaseOutFileStream *pOutFileStream = CreateOutFileStream(pFrom, meta, appending); 816 if (!pOutFileStream || !pInNetRTMPStream->Record(pOutFileStream)) { 817 FATAL("Unable to bind the recording stream"); 818 return false; 825 819 } 826 820 } … … 1866 1860 } 1867 1861 1862 BaseOutFileStream* BaseRTMPAppProtocolHandler::CreateOutFileStream( 1863 BaseRTMPProtocol *pFrom, Variant &meta, bool append) 1864 { 1865 //1. Compute the file name 1866 string fileName = meta[META_SERVER_MEDIA_DIR]; 1867 fileName += (string) meta[META_SERVER_FILE_NAME]; 1868 FINEST("fileName: %s", STR(fileName)); 1869 1870 //2. Delete the old file 1871 if (append) { 1872 WARN("append not supported yet. File will be overwritten"); 1873 } 1874 deleteFile(fileName); 1875 1876 if ((meta[META_MEDIA_TYPE] == MEDIA_TYPE_LIVE_OR_FLV) || 1877 (meta[META_MEDIA_TYPE] == MEDIA_TYPE_FLV)) { 1878 return new OutFileRTMPFLVStream(pFrom, 1879 GetApplication()->GetStreamsManager(), fileName); 1880 } 1881 if (meta[META_MEDIA_TYPE] == MEDIA_TYPE_MP4) { 1882 FATAL("Streaming to MP4 file not supported"); 1883 return NULL; 1884 } 1885 FATAL("Media type not supported"); 1886 return NULL; 1887 } 1888 1868 1889 string NormalizeStreamName(string streamName) { 1869 1890 replace(streamName, "-", "_"); -
branches/1.0/sources/thelib/src/protocols/rtmp/streaming/innetrtmpstream.cpp
r701 r715 188 188 } 189 189 190 bool InNetRTMPStream::RecordFLV(Variant &meta, bool append) { 191 //1. Compute the file name 192 string fileName = meta[META_SERVER_MEDIA_DIR]; 193 fileName += (string) meta[META_SERVER_FILE_NAME]; 194 FINEST("fileName: %s", STR(fileName)); 195 196 //2. Delete the old file 197 if (append) { 198 WARN("append not supported yet. File will be overwritten"); 199 } 200 deleteFile(fileName); 201 202 //3. Create the out file 203 _pOutFileRTMPFLVStream = new OutFileRTMPFLVStream(_pProtocol, 204 _pStreamsManager, fileName); 205 206 //4. Link it 190 bool InNetRTMPStream::Record(BaseOutFileStream *pOutStream) { 191 192 _pOutFileRTMPFLVStream = pOutStream; 207 193 return _pOutFileRTMPFLVStream->Link(this); 208 }209 210 bool InNetRTMPStream::RecordMP4(Variant &meta) {211 NYIR;212 194 } 213 195 -
trunk/sources/thelib/include/protocols/rtmp/basertmpappprotocolhandler.h
r658 r715 27 27 #include "protocols/rtmp/rtmpprotocolserializer.h" 28 28 #include "protocols/rtmp/sharedobjects/somanager.h" 29 #include "basertmpprotocol.h" 29 #include "streaming/baseoutstream.h" 30 #include "streaming/baseoutfilestream.h" 30 31 31 32 class OutboundRTMPProtocol; 32 33 class BaseRTMPProtocol; 34 class BaseOutFileStream; 33 35 34 36 class DLLEXP BaseRTMPAppProtocolHandler … … 234 236 bool SendRTMPMessage(BaseRTMPProtocol *pTo, Variant message, 235 237 bool trackResponse = false); 238 239 /* 240 * Create a file stream for writing to disk. 241 * pFrom - The connection which wants to stream to disk 242 * meta - Stream metadata 243 * append - Whether to append this stream to an exiting file 244 * */ 245 virtual BaseOutFileStream *CreateOutFileStream(BaseRTMPProtocol *pFrom, Variant &meta, bool append); 236 246 private: 237 247 /* -
trunk/sources/thelib/include/protocols/rtmp/streaming/innetrtmpstream.h
r637 r715 28 28 class BaseRTMPProtocol; 29 29 class BaseOutStream; 30 class BaseOutFileStream; 30 31 31 32 class DLLEXP InNetRTMPStream … … 71 72 bool persistent = true); 72 73 bool SendOnStatusStreamPublished(); 73 bool RecordFLV(Variant &meta, bool append); 74 bool RecordMP4(Variant &meta); 74 bool Record(BaseOutFileStream* pOutFileStream); 75 75 76 76 virtual void SignalOutStreamAttached(BaseOutStream *pOutStream); -
trunk/sources/thelib/src/protocols/rtmp/basertmpappprotocolhandler.cpp
r688 r715 29 29 #include "protocols/rtmp/streaming/infilertmpstream.h" 30 30 #include "protocols/rtmp/streaming/innetrtmpstream.h" 31 #include "protocols/rtmp/streaming/outfilertmpflvstream.h" 31 32 #include "streaming/streamstypes.h" 32 33 #include "streaming/baseinstream.h" … … 812 813 Variant meta = GetMetaData(streamName, false); 813 814 814 if ((meta[META_MEDIA_TYPE] == MEDIA_TYPE_LIVE_OR_FLV) || 815 (meta[META_MEDIA_TYPE] == MEDIA_TYPE_FLV)) { 816 if (!pInNetRTMPStream->RecordFLV(meta, appending)) { 817 FATAL("Unable to bind the recording stream"); 818 return false; 819 } 820 } else if (meta[META_MEDIA_TYPE] == MEDIA_TYPE_MP4) { 821 if (!pInNetRTMPStream->RecordMP4(meta)) { 822 FATAL("Unable to bind the recording stream"); 823 return false; 824 } 815 BaseOutFileStream *pOutFileStream = CreateOutFileStream(pFrom, meta, appending); 816 if (!pOutFileStream || !pInNetRTMPStream->Record(pOutFileStream)) { 817 FATAL("Unable to bind the recording stream"); 818 return false; 825 819 } 826 820 } … … 1866 1860 } 1867 1861 1862 BaseOutFileStream* BaseRTMPAppProtocolHandler::CreateOutFileStream( 1863 BaseRTMPProtocol *pFrom, Variant &meta, bool append) 1864 { 1865 //1. Compute the file name 1866 string fileName = meta[META_SERVER_MEDIA_DIR]; 1867 fileName += (string) meta[META_SERVER_FILE_NAME]; 1868 FINEST("fileName: %s", STR(fileName)); 1869 1870 //2. Delete the old file 1871 if (append) { 1872 WARN("append not supported yet. File will be overwritten"); 1873 } 1874 deleteFile(fileName); 1875 1876 if ((meta[META_MEDIA_TYPE] == MEDIA_TYPE_LIVE_OR_FLV) || 1877 (meta[META_MEDIA_TYPE] == MEDIA_TYPE_FLV)) { 1878 return new OutFileRTMPFLVStream(pFrom, 1879 GetApplication()->GetStreamsManager(), fileName); 1880 } 1881 if (meta[META_MEDIA_TYPE] == MEDIA_TYPE_MP4) { 1882 FATAL("Streaming to MP4 file not supported"); 1883 return NULL; 1884 } 1885 FATAL("Media type not supported"); 1886 return NULL; 1887 } 1888 1868 1889 string NormalizeStreamName(string streamName) { 1869 1890 replace(streamName, "-", "_"); -
trunk/sources/thelib/src/protocols/rtmp/streaming/innetrtmpstream.cpp
r701 r715 188 188 } 189 189 190 bool InNetRTMPStream::RecordFLV(Variant &meta, bool append) { 191 //1. Compute the file name 192 string fileName = meta[META_SERVER_MEDIA_DIR]; 193 fileName += (string) meta[META_SERVER_FILE_NAME]; 194 FINEST("fileName: %s", STR(fileName)); 195 196 //2. Delete the old file 197 if (append) { 198 WARN("append not supported yet. File will be overwritten"); 199 } 200 deleteFile(fileName); 201 202 //3. Create the out file 203 _pOutFileRTMPFLVStream = new OutFileRTMPFLVStream(_pProtocol, 204 _pStreamsManager, fileName); 205 206 //4. Link it 190 bool InNetRTMPStream::Record(BaseOutFileStream *pOutStream) { 191 192 _pOutFileRTMPFLVStream = pOutStream; 207 193 return _pOutFileRTMPFLVStream->Link(this); 208 }209 210 bool InNetRTMPStream::RecordMP4(Variant &meta) {211 NYIR;212 194 } 213 195
Note: See TracChangeset
for help on using the changeset viewer.
