- Timestamp:
- 08/22/10 20:05:34 (21 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/applications/applestreamingclient/src/eventsink/varianteventsink.cpp
r31 r88 21 21 #ifdef HAS_PROTOCOL_VAR 22 22 #include "eventsink/varianteventsink.h" 23 #include "clientcontext.h" 24 #include "applestreamingclientapplication.h" 25 #include "jnihelpers.h" 23 26 24 VariantEventSink::VariantEventSink( )25 : BaseEventSink(EVENT_SYNC_VARIANT ) {27 VariantEventSink::VariantEventSink(uint32_t contextId) 28 : BaseEventSink(EVENT_SYNC_VARIANT, contextId) { 26 29 } 27 30 … … 30 33 31 34 bool VariantEventSink::SignalStreamRegistered(string streamName) { 35 if (MAP_HAS1(_streamNames, streamName)) 36 return true; 32 37 _streamNames[streamName] = streamName; 38 #ifdef ANDROID 39 Variant message; 40 message["type"] = "streamNameRegistered"; 41 message["streamName"] = GetRTSPHost() + streamName; 42 return CallJava(message); 43 #else 33 44 return true; 45 #endif 34 46 } 35 47 36 48 bool VariantEventSink::SignalStreamUnRegistered(string streamName) { 37 49 _streamNames.erase(streamName); 50 #ifdef ANDROID 51 Variant message; 52 message["type"] = "streamNameUnRegistered"; 53 message["streamName"] = GetRTSPHost() + streamName; 54 return CallJava(message); 55 #else 38 56 return true; 57 #endif 58 } 59 60 bool VariantEventSink::SignalUpgradeBandwidth(uint32_t oldBw, uint32_t newBw) { 61 #ifdef ANDROID 62 Variant message; 63 message["type"] = "upgradeBandwidth"; 64 message["oldBw"] = (uint32_t) oldBw; 65 message["newBw"] = (uint32_t) newBw; 66 return CallJava(message); 67 #else 68 return true; 69 #endif 70 } 71 72 bool VariantEventSink::SignalDowngradeBandwidth(uint32_t oldBw, uint32_t newBw) { 73 #ifdef ANDROID 74 Variant message; 75 message["type"] = "downgradeBandwidth"; 76 message["oldBw"] = (uint32_t) oldBw; 77 message["newBw"] = (uint32_t) newBw; 78 return CallJava(message); 79 #else 80 return true; 81 #endif 39 82 } 40 83 … … 49 92 } 50 93 94 #ifdef ANDROID 95 96 bool VariantEventSink::CallJava(Variant& message) { 97 ClientContext *pContext = GetContext(); 98 if (pContext == NULL) { 99 FATAL("Unable to get context"); 100 return false; 101 } 102 AppleStreamingClientApplication *pApp = pContext->GetApplication(); 103 if (pApp == NULL) { 104 FATAL("Unable to get the application"); 105 return false; 106 } 107 CallBackInfo &ci = pApp->GetJavaCallBackInterface(); 108 FINEST("CallJava message:\n%s", STR(message.ToString())); 109 return ::CallJava(ci, message); 110 } 111 112 string VariantEventSink::GetRTSPHost() { 113 if (_rtspHost != "") 114 return _rtspHost; 115 ClientContext *pContext = GetContext(); 116 if (pContext == NULL) { 117 FATAL("Unable to get context"); 118 return false; 119 } 120 AppleStreamingClientApplication *pApp = pContext->GetApplication(); 121 _rtspHost = (string) pApp->GetConfiguration()["rtspHost"]; 122 return _rtspHost; 123 } 124 #endif 125 51 126 #endif /* HAS_PROTOCOL_VAR */ 52 127
Note: See TracChangeset
for help on using the changeset viewer.
