javauis/mmapi_qt/baseline/src/videocontrol.cpp
changeset 49 35baca0e7a2e
parent 26 dc7c549001d5
child 67 63b81d807542
equal deleted inserted replaced
35:85266cc22c7f 49:35baca0e7a2e
    70 }
    70 }
    71 
    71 
    72 
    72 
    73 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty
    73 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty
    74 (JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
    74 (JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
    75  jint aPropertyA, jint aPropertyB, jint aPropertyType)
    75  jint aPropertyA, jint aPropertyB, jint aPropertyType, jint aDisplayType)
    76 {
    76 {
    77     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty");
    77     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty");
    78 
    78 
    79     CMMAVideoControl* videoControl =
    79     CMMAVideoControl* videoControl =
    80         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
    80         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
    86                    User::Panic(_L("videocontrol::control is null"),
    86                    User::Panic(_L("videocontrol::control is null"),
    87                                KErrArgument));
    87                                KErrArgument));
    88     __ASSERT_DEBUG(eventSource,
    88     __ASSERT_DEBUG(eventSource,
    89                    User::Panic(_L("videocontrol::eventsource is null"),
    89                    User::Panic(_L("videocontrol::eventsource is null"),
    90                                KErrArgument));
    90                                KErrArgument));
    91 
    91     TInt error = 0;
    92     TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticSetPropertyL,
    92     if (aDisplayType == CMMAVideoControl::EDISPLAY_ESWT)
    93                                         videoControl,
    93     {
    94                                         aPropertyType,
    94         TRAP(error,CMMAVideoControl::StaticSetPropertyL(videoControl, aPropertyType, aPropertyA, aPropertyB));
    95                                         aPropertyA,
    95     }
    96                                         aPropertyB));
    96     else
       
    97     {
       
    98         error = eventSource->ExecuteTrap(&CMMAVideoControl::StaticSetPropertyL,
       
    99                                          videoControl,
       
   100                                          aPropertyType,
       
   101                                          aPropertyA,
       
   102                                          aPropertyB);
       
   103     }
    97     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty -");
   104     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1setDisplayProperty -");
    98     return error;
   105     return error;
    99 }
   106 }
   100 
   107 
   101 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty
   108 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty
   102 (JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
   109 (JNIEnv*, jobject, jint aControlHandle, jint aEventSourceHandle,
   103  jint aPropertyType)
   110  jint aPropertyType, jint aDisplayType)
   104 {
   111 {
   105     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty");
   112     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty");
   106 
   113 
   107     CMMAVideoControl* videoControl =
   114     CMMAVideoControl* videoControl =
   108         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
   115         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
   115                                KErrArgument));
   122                                KErrArgument));
   116     __ASSERT_DEBUG(eventSource,
   123     __ASSERT_DEBUG(eventSource,
   117                    User::Panic(_L("videocontrol::evetnsource is null"),
   124                    User::Panic(_L("videocontrol::evetnsource is null"),
   118                                KErrArgument));
   125                                KErrArgument));
   119     TInt returnValue(KErrNone);
   126     TInt returnValue(KErrNone);
   120 
   127     TInt error = 0;
   121     TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::StaticGetPropertyL,
   128 
   122                                         videoControl,
   129     if (aDisplayType == CMMAVideoControl::EDISPLAY_ESWT)
   123                                         aPropertyType,
   130     {
   124                                         &returnValue));
   131         TRAP(error,CMMAVideoControl::StaticGetPropertyL(videoControl, aPropertyType, &returnValue));
       
   132     }
       
   133     else
       
   134     {
       
   135         error = eventSource->ExecuteTrap(&CMMAVideoControl::StaticGetPropertyL,
       
   136                                          videoControl,
       
   137                                          aPropertyType,
       
   138                                          &returnValue);
       
   139     }
   125     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty - ");
   140     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getControlProperty - ");
   126     if (error == KErrNone)
   141     if (error == KErrNone)
   127     {
   142     {
   128         return returnValue;
   143         return returnValue;
   129     }
   144     }
   130     return error;
   145     return error;
   131 }
   146 }
   132 
   147 
   133 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot
   148 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot
   134 (JNIEnv* aJni, jobject, jint aControlHandle, jint aEventSourceHandle,
   149 (JNIEnv* aJni, jobject, jint aControlHandle, jint /*aEventSourceHandle*/,
   135  jstring aProperties)
   150  jstring aProperties)
   136 {
   151 {
   137     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot + ");
   152     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot + ");
   138 
   153 
   139     CMMAVideoControl* videoControl =
   154     CMMAVideoControl* videoControl =
   140         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
   155         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
   141 
   156 
   142     MMAFunctionServer* eventSource =
   157     //MMAFunctionServer* eventSource =
   143         reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
   158     //   reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
   144 
   159 
   145     __ASSERT_DEBUG(videoControl,
   160     __ASSERT_DEBUG(videoControl,
   146                    User::Panic(_L("videocontrol::control is null"),
   161                    User::Panic(_L("videocontrol::control is null"),
   147                                KErrArgument));
   162                                KErrArgument));
   148     __ASSERT_DEBUG(eventSource,
   163 //    __ASSERT_DEBUG(eventSource,
   149                    User::Panic(_L("videocontrol::evetnsource is null"),
   164 //                   User::Panic(_L("videocontrol::evetnsource is null"),
   150                                KErrArgument));
   165 //                               KErrArgument));
   151 
   166 
   152     JStringUtils properties(*aJni, aProperties);
   167     JStringUtils properties(*aJni, aProperties);
       
   168 
       
   169     TInt error = 0;
       
   170     TRAP(error,CMMAVideoControl::TakeSnapShotL(videoControl, (const TDesC*)&properties));
       
   171 
       
   172     /*
   153     TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::TakeSnapShotL,
   173     TInt error(eventSource->ExecuteTrap(&CMMAVideoControl::TakeSnapShotL,
   154                                         videoControl,
   174                                         videoControl,
   155                                         (const TDesC*)&properties));
   175                                         (const TDesC*)&properties));
       
   176      */
   156     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot - ");
   177     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1getSnapshot - ");
   157     return error;
   178     return error;
   158 }
   179 }
   159 
   180 
   160 /**
   181 /**
   161  * Initializes dynamic display mode
   182  * Initializes dynamic display mode
   162  * @return handle to MMMADirectContent or error code
   183  * @return handle to MMMADirectContent or error code
   163  */
   184  */
   164 /*
       
   165 LOCAL_C jint InitDynamicMode(MMAFunctionServer* aEventSource,
   185 LOCAL_C jint InitDynamicMode(MMAFunctionServer* aEventSource,
       
   186                              JNIEnv* aJni,
   166                              CMMAVideoControl* aVideoControl,
   187                              CMMAVideoControl* aVideoControl,
   167                              jobject aGUIObject,
   188                              jobject aGUIObject,
   168                              CMMAEvent* aDeleteRefEvent)
   189                              CMMAEvent* aDeleteRefEvent)
   169 {
   190 {
   170     TInt contentHandle = 0;
   191     TInt contentHandle = 0;
   171     TInt error = aEventSource->ExecuteTrap(
   192     /* TInt error = aEventSource->ExecuteTrap(
   172                      &CMMAVideoControl::StaticInitDynamicModeL,
   193                       &CMMAVideoControl::StaticInitDynamicModeL,
   173                      aVideoControl,
   194                       aVideoControl,
   174                      &contentHandle,
   195                       &contentHandle,
   175                      aEventSource,
   196                       aEventSource,
   176                      aGUIObject,
   197                       aGUIObject,
   177                      aDeleteRefEvent);
   198                       aDeleteRefEvent);
       
   199     */
       
   200     TRAPD(error,CMMAVideoControl::StaticInitDynamicModeL(aVideoControl, aJni, &contentHandle, aEventSource, aGUIObject, aDeleteRefEvent));
   178 
   201 
   179     // if init failed return error code
   202     // if init failed return error code
   180     if (error != KErrNone)
   203     if (error != KErrNone)
   181     {
   204     {
   182         contentHandle = error;
   205         contentHandle = error;
   183     }
   206     }
   184     return contentHandle;
   207     return contentHandle;
   185 }
   208 }
   186 */
       
   187 
   209 
   188 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode
   210 JNIEXPORT jint JNICALL Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode
   189 (JNIEnv* aJni, jobject aJavaVideoControl, jint aControlHandle, jint aEventSourceHandle,
   211 (JNIEnv* aJni, jobject aJavaVideoControl, jint aControlHandle, jint aEventSourceHandle,
   190  jobject aJavaDisplayObj, jobject aComponent,jboolean aGuiType)
   212  jobject aJavaDisplayObj, jobject aComponent,jint aGuiType)
   191 {
   213 {
   192     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode +");
   214     LOG(EJavaMMAPI, EInfo, "Java_com_nokia_microedition_media_control_VideoControl__1initDisplayMode +");
   193     LOG1(EJavaMMAPI, EInfo, "aControlHandle = %d", aControlHandle);
   215     LOG1(EJavaMMAPI, EInfo, "aControlHandle = %d", aControlHandle);
   194     LOG1(EJavaMMAPI, EInfo, "aEventSourceHandle = %d", aEventSourceHandle);
   216     LOG1(EJavaMMAPI, EInfo, "aEventSourceHandle = %d", aEventSourceHandle);
   195 //    LOG1( EJavaMMAPI, EInfo, "aComponentHandle = %d", aComponentHandle);
   217 //    LOG1( EJavaMMAPI, EInfo, "aComponentHandle = %d", aComponentHandle);
   196 
   218 
   197     TBool type = aGuiType;
   219     TInt type = aGuiType;
   198     CMMAVideoControl* videoControl =
   220     CMMAVideoControl* videoControl =
   199         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
   221         reinterpret_cast< CMMAVideoControl* >(aControlHandle);
   200 
   222 
   201     MMAFunctionServer* eventSource =
   223     MMAFunctionServer* eventSource =
   202         reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
   224         reinterpret_cast< MMAFunctionServer *>(aEventSourceHandle);
   229     if (javaDisplayRef == NULL)
   251     if (javaDisplayRef == NULL)
   230     {
   252     {
   231         return KErrNoMemory;
   253         return KErrNoMemory;
   232     }
   254     }
   233 
   255 
   234     /*// other modes has component
   256     // other modes has component
   235     if (aComponentHandle == 0)
   257     if (type == CMMAVideoControl::EDISPLAY_ESWT)
   236     {
   258     {
   237         return InitDynamicMode(eventSource,
   259         return InitDynamicMode(eventSource,
       
   260                                aJni,
   238                                videoControl,
   261                                videoControl,
   239                                componentRef,
   262                                javaDisplayRef,
   240                                deleteRefEvent);
   263                                deleteRefEvent);
   241     }
   264     }
   242     */
   265 
   243     //  MMIDComponent* component = JavaUnhand< MMIDComponent >(aComponentHandle);
   266     //  MMIDComponent* component = JavaUnhand< MMIDComponent >(aComponentHandle);
   244 
   267 
   245 
   268 
   246     __ASSERT_DEBUG(videoControl,
   269     __ASSERT_DEBUG(videoControl,
   247                    User::Panic(_L("videocontrol::control is null"),
   270                    User::Panic(_L("videocontrol::control is null"),