Ignore:
Timestamp:
08/22/10 20:05:34 (21 months ago)
Author:
shiretu
Message:

-- android related stuff

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/applications/applestreamingclient/src/eventsink/varianteventsink.cpp

    r31 r88  
    2121#ifdef HAS_PROTOCOL_VAR 
    2222#include "eventsink/varianteventsink.h" 
     23#include "clientcontext.h" 
     24#include "applestreamingclientapplication.h" 
     25#include "jnihelpers.h" 
    2326 
    24 VariantEventSink::VariantEventSink() 
    25 : BaseEventSink(EVENT_SYNC_VARIANT) { 
     27VariantEventSink::VariantEventSink(uint32_t contextId) 
     28: BaseEventSink(EVENT_SYNC_VARIANT, contextId) { 
    2629} 
    2730 
     
    3033 
    3134bool VariantEventSink::SignalStreamRegistered(string streamName) { 
     35        if (MAP_HAS1(_streamNames, streamName)) 
     36                return true; 
    3237        _streamNames[streamName] = streamName; 
     38#ifdef ANDROID 
     39        Variant message; 
     40        message["type"] = "streamNameRegistered"; 
     41        message["streamName"] = GetRTSPHost() + streamName; 
     42        return CallJava(message); 
     43#else 
    3344        return true; 
     45#endif 
    3446} 
    3547 
    3648bool VariantEventSink::SignalStreamUnRegistered(string streamName) { 
    3749        _streamNames.erase(streamName); 
     50#ifdef ANDROID 
     51        Variant message; 
     52        message["type"] = "streamNameUnRegistered"; 
     53        message["streamName"] = GetRTSPHost() + streamName; 
     54        return CallJava(message); 
     55#else 
    3856        return true; 
     57#endif 
     58} 
     59 
     60bool 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 
     72bool 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 
    3982} 
    4083 
     
    4992} 
    5093 
     94#ifdef ANDROID 
     95 
     96bool 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 
     112string 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 
    51126#endif /* HAS_PROTOCOL_VAR */ 
    52127 
Note: See TracChangeset for help on using the changeset viewer.