mmsharing/mmshui/src/musuiclipsharingcontroller.cpp
branchRCL_3
changeset 18 0da2e08216b6
parent 11 ff8a573c0e2e
child 19 95754dcd27ad
equal deleted inserted replaced
16:71306c87785a 18:0da2e08216b6
   325     delete iAddress;
   325     delete iAddress;
   326     iAddress = NULL;
   326     iAddress = NULL;
   327     iAddress = aRecipient.AllocL();
   327     iAddress = aRecipient.AllocL();
   328     
   328     
   329     
   329     
   330     TRAPD( err, iSession->InviteL( aRecipient ) );
   330     TBool inviteProceeding = DoInviteL();
   331     MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::InviteL: After TRAPD" );
   331     if ( !inviteProceeding )
   332 
   332         {
   333     // If address is in wrong format, Manual Address Entry Dialog
   333         MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::InviteL, invite failed" );
   334     // is displayed
   334         return;
   335     if ( err != KErrNone )
   335         }      
   336         {
       
   337         DismissWaitDialog();
       
   338         MusUiDialogUtil::ShowGlobalErrorDialogL(
       
   339                                 R_MUS_LIVE_SHARING_VIEW_NOTE_INVITE_ERROR );
       
   340         if ( ( ++iTriedInvitations < 2 )  && ( err == KErrArgument ) )
       
   341             {
       
   342             MUS_LOG( "mus: [MUSUI ]     CMusUiLiveSharingController::InviteL: iTriedInvitations < 2" );
       
   343             iManualAddressTyped = ETrue;
       
   344             iResourceHandler->RequestKeypadL( ETrue );
       
   345 
       
   346             // If the address has to be queried again...:
       
   347             iTranscode = EFalse;
       
   348             
       
   349             MUS_LOG_TDESC( "mus: [MUSUI ]     CMusUiClipSharingController::InviteL: ",
       
   350                        iFileName->Des() )
       
   351                                                  
       
   352             iSendObserver.ManualAddressEntryL( *iRemoteSipAddressProposal );
       
   353             return;
       
   354             }
       
   355         else
       
   356             {
       
   357             MUS_LOG( "mus: [MUSUI ]     CMusUiLiveSharingController::InviteL: ++iTriedInvitations > 1" );
       
   358             DeleteEngineSession();
       
   359             HandleExitL();
       
   360             return;
       
   361             }
       
   362         }
       
   363         
       
   364 
       
   365     if( iTranscode )
   336     if( iTranscode )
   366         {
   337         {
   367         MUS_LOG( "mus: [MUSUI ]     Starting transcode..." );
   338         MUS_LOG( "mus: [MUSUI ]     Starting transcode..." );
   368         iTranscode = EFalse;
   339         iTranscode = EFalse;
   369         // Show progress dialog:
   340       
   370         iClipObserver.ShowTranscodingProgressDialogL();
       
   371         // Start transcoding
   341         // Start transcoding
   372         iTranscodingGoing = ETrue;
   342         iTranscodingGoing = ETrue;
   373         
   343         
   374         SetFileNameL( VideoFileNameL() );
   344         SetFileNameL( VideoFileNameL() );
   375         TRAPD( err, iSession->TranscodeL( *iFileName ) );
   345         TRAPD( err, iSession->TranscodeL( *iFileName ) );
   376         
   346         
   377         if ( err != KErrNone )
   347         if ( err != KErrNone )
   378             {
   348             {
   379             MUS_LOG1( "mus: [MUSUI ]     Transcoding failed: %d", err );
   349             MUS_LOG1( "mus: [MUSUI ]     Transcoding failed: %d", err );
   380             iTranscodingGoing = EFalse;
   350             iTranscodingGoing = EFalse;
   381             if ( err == KErrNotFound )  // No Video Editor Engine
   351             if ( iTranscodeDueUnknownRemoteCapas )
   382                 {
   352                 {
   383                 DismissWaitDialog();
   353                 MUS_LOG( "mus: [MUSUI ]     Retry invite without transcoding" );
       
   354                 // Still retry the clip without transcoding as other end might support current codec.
       
   355                 iVideoToBeSaved = EFalse;
       
   356                 inviteProceeding = DoInviteL();
       
   357                 }
       
   358             else if ( err == KErrNotFound )  // No Video Editor Engine
       
   359                 {
   384                 MusUiDialogUtil::ShowGlobalErrorDialogL(
   360                 MusUiDialogUtil::ShowGlobalErrorDialogL(
   385                     R_MUS_LIVE_SHARING_VIEW_NOTE_TRANSCODING_NOT_SUPPORTED );
   361                     R_MUS_LIVE_SHARING_VIEW_NOTE_TRANSCODING_NOT_SUPPORTED );
   386                 DeleteEngineSession();
   362                 DeleteEngineSession();
   387                 iVideoToBeSaved = EFalse;
   363                 iVideoToBeSaved = EFalse;
   388                 HandleExitL();
   364                 HandleExitL();
       
   365                 inviteProceeding = EFalse;
   389                 }
   366                 }
   390             else
   367             else
   391                 {
   368                 {
   392                 // Unable to convert clip, if transc. leaves.
   369                 // Unable to convert clip, if transc. leaves.
   393                 // After note return back to the media gallery.
   370                 // After note return back to the media gallery.
   394                 TranscodingFailed();
   371                 TranscodingFailed();
   395                 }
   372                 inviteProceeding = EFalse;
   396             return;
   373                 }
   397             }
   374             }
   398         }
   375         else
   399     else
   376             {
       
   377             // Show progress dialog:
       
   378             iClipObserver.ShowTranscodingProgressDialogL();
       
   379             inviteProceeding = EFalse;
       
   380             }
       
   381         }
       
   382     
       
   383     if ( inviteProceeding )
   400         {
   384         {
   401         SetConnectionInitialized( ETrue );
   385         SetConnectionInitialized( ETrue );
   402         ShowInvitingWaitDialogL();
   386         ShowInvitingWaitDialogL();
   403         }
   387         }
   404         
   388         
   405     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::InviteL" );
   389     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::InviteL" );
   406     }
   390     }
   407 
   391 
       
   392 // -----------------------------------------------------------------------------
       
   393 //
       
   394 // -----------------------------------------------------------------------------
       
   395 //
       
   396 TBool CMusUiClipSharingController::DoInviteL()
       
   397     {
       
   398     __ASSERT_ALWAYS( iAddress, User::Leave( KErrNotReady ) );
       
   399     TRAPD( err, iSession->InviteL( *iAddress ) );
       
   400     MUS_LOG( "mus: [MUSUI ]     CMusUiClipSharingController::DoInviteL: After TRAPD" );
       
   401     
       
   402     // If address is in wrong format, Manual Address Entry Dialog
       
   403     // is displayed
       
   404     if ( err != KErrNone )
       
   405         {
       
   406         DismissWaitDialog();
       
   407         MusUiDialogUtil::ShowGlobalErrorDialogL(
       
   408                           R_MUS_LIVE_SHARING_VIEW_NOTE_INVITE_ERROR );
       
   409         if ( ( ++iTriedInvitations < 2 )  && ( err == KErrArgument ) )
       
   410             {
       
   411             MUS_LOG( "mus: [MUSUI ]     CMusUiLiveSharingController::DoInviteL: iTriedInvitations < 2" );
       
   412             iManualAddressTyped = ETrue;
       
   413             iResourceHandler->RequestKeypadL( ETrue );
       
   414             
       
   415             // If the address has to be queried again...:
       
   416             iTranscode = EFalse;
       
   417             
       
   418             MUS_LOG_TDESC( "mus: [MUSUI ]     CMusUiClipSharingController::DoInviteL: ",
       
   419                      iFileName->Des() )
       
   420                                                
       
   421             iSendObserver.ManualAddressEntryL( *iRemoteSipAddressProposal );
       
   422             }
       
   423         else
       
   424             {
       
   425             MUS_LOG( "mus: [MUSUI ]     CMusUiLiveSharingController::DoInviteL: ++iTriedInvitations > 1" );
       
   426             DeleteEngineSession();
       
   427             HandleExitL();
       
   428             }
       
   429         }
       
   430     return ( err == KErrNone );
       
   431     }
   408 
   432 
   409 // -----------------------------------------------------------------------------
   433 // -----------------------------------------------------------------------------
   410 //
   434 //
   411 // -----------------------------------------------------------------------------
   435 // -----------------------------------------------------------------------------
   412 //
   436 //
   838 
   862 
   839 // -----------------------------------------------------------------------------
   863 // -----------------------------------------------------------------------------
   840 //
   864 //
   841 // -----------------------------------------------------------------------------
   865 // -----------------------------------------------------------------------------
   842 //
   866 //
   843 void CMusUiClipSharingController::TranscodingNeeded()
   867 void CMusUiClipSharingController::TranscodingNeeded(TBool aDueUnknownRemoteCapabilities)
   844     {
   868     {
   845     MUS_LOG( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingNeeded" );
   869     MUS_LOG1( "mus: [MUSUI ]  -> CMusUiClipSharingController::TranscodingNeeded, %d", 
       
   870                aDueUnknownRemoteCapabilities);
   846     iTranscode = ETrue;
   871     iTranscode = ETrue;
       
   872     iTranscodeDueUnknownRemoteCapas = aDueUnknownRemoteCapabilities;
   847     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingNeeded" );
   873     MUS_LOG( "mus: [MUSUI ]  <- CMusUiClipSharingController::TranscodingNeeded" );
   848     }
   874     }
   849 
   875 
   850 
   876 
   851 // -----------------------------------------------------------------------------
   877 // -----------------------------------------------------------------------------