29 #include "mccinternalevents.h" |
29 #include "mccinternalevents.h" |
30 #include "CXPSPacketSink.h" |
30 #include "CXPSPacketSink.h" |
31 #include "mmcccodecamr.h" |
31 #include "mmcccodecamr.h" |
32 #include "mccvideosinkuser.h" |
32 #include "mccvideosinkuser.h" |
33 #include "mccdef.h" |
33 #include "mccdef.h" |
34 #include "mccredrawhandler.h" |
|
35 #include "mccinternaldef.h" |
34 #include "mccinternaldef.h" |
36 #include <videoplayer2.h> |
35 #include <videoplayer2.h> |
37 |
36 |
38 // CONSTANTS |
37 // CONSTANTS |
39 |
38 |
137 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl window ordinal priority:", |
136 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl window ordinal priority:", |
138 iSettings.iWindowOrdinalPriority ) |
137 iSettings.iWindowOrdinalPriority ) |
139 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl rotation:", |
138 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl rotation:", |
140 iSettings.iRotation ) |
139 iSettings.iRotation ) |
141 |
140 |
142 // Create window group |
141 CreateWindowingElementsL(iSettings); |
143 TInt groupId = iRwSession.GetFocusWindowGroup(); |
|
144 iRwGroup = new (ELeave) RWindowGroup( iRwSession ); |
|
145 |
|
146 User::LeaveIfError( iRwGroup->Construct( groupId, EFalse ) ); |
|
147 iRwGroup->SetName( KMccWindowGroupName ); |
|
148 |
|
149 // TBD: use also iWindowOrdinalPriority |
|
150 iRwGroup->SetOrdinalPosition( iSettings.iWindowOrdinalPosition ); |
|
151 iRwGroup->AutoForeground( EFalse ); |
|
152 |
|
153 // Create screen device |
|
154 iDev = new (ELeave) CWsScreenDevice( iRwSession ); |
|
155 User::LeaveIfError( iDev->Construct( iSettings.iDeviceIndex ) ); |
|
156 |
|
157 // Create window |
|
158 iRw = new (ELeave) RWindow( iRwSession ); |
|
159 |
|
160 User::LeaveIfError( iRw->Construct( *iRwGroup, (TUint32)iRw ) ); |
|
161 |
|
162 iRw->SetPosition( iSettings.iLocation ); |
|
163 iRw->SetSize( iSettings.iSize ); |
|
164 |
|
165 iRw->SetOrdinalPosition( iSettings.iWindowOrdinalPosition ); |
|
166 |
|
167 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: creating graphics context ..." ) |
|
168 User::LeaveIfError( iDev->CreateContext( iGc ) ); |
|
169 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: graphics context created!" ) |
|
170 |
|
171 |
|
172 iRw->Activate(); |
|
173 |
|
174 iRwSession.Flush(); |
|
175 |
|
176 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: creating redraw handler" ) |
|
177 |
|
178 iRedrawHandler = CMccRedrawHandler::NewL( iRwSession, *iRw, *iGc ); |
|
179 |
|
180 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: created redraw handler" ) |
|
181 |
142 |
182 // Videoplayer needs to be created last, otherwise destruction |
143 // Videoplayer needs to be created last, otherwise destruction |
183 // order causes problems |
144 // order causes problems |
184 iVideoPlayer = CVideoPlayerUtility2::NewL( |
145 iVideoPlayer = CVideoPlayerUtility2::NewL( |
185 *this, |
146 *this, |
776 |
732 |
777 if ( AnalyzeTimeStampL( user, aHeaderInfo ) && |
733 if ( AnalyzeTimeStampL( user, aHeaderInfo ) && |
778 user.PacketOverflowState() != CMccVideoSinkUser::EOccured && |
734 user.PacketOverflowState() != CMccVideoSinkUser::EOccured && |
779 dataSize >= KMccMinPacketSize ) |
735 dataSize >= KMccMinPacketSize ) |
780 { |
736 { |
781 iRedrawHandler->BlackDrawingL( EFalse ); |
|
782 |
|
783 __V_SOURCESINK_CONTROLL( |
737 __V_SOURCESINK_CONTROLL( |
784 "CMccVideoSinkImpl::EmptyBufferL, sending packet to helix" ) |
738 "CMccVideoSinkImpl::EmptyBufferL, sending packet to helix" ) |
785 |
739 |
786 CMccVideoJitterBuffer::TMccPacketBufferingStatus bufferingStatus = |
740 CMccVideoJitterBuffer::TMccPacketBufferingStatus bufferingStatus = |
787 user.EnqueueL( aHeaderInfo, buf->Data() ); |
741 user.EnqueueL( aHeaderInfo, buf->Data() ); |
836 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl window ordinal priority:", |
790 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl window ordinal priority:", |
837 aSettings.iWindowOrdinalPriority ) |
791 aSettings.iWindowOrdinalPriority ) |
838 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl rotation:", |
792 __V_SOURCESINK_CONTROLL_INT1( "CMccVideoSinkImpl rotation:", |
839 aSettings.iRotation ) |
793 aSettings.iRotation ) |
840 |
794 |
841 __ASSERT_ALWAYS( iRw && iRwGroup && iDev, User::Leave( KErrNotReady ) ); |
795 // Need to recreate windowing stuff, otherwise orientation switch does not work |
842 |
796 DeleteWindowingElements(); |
843 // TBD: use also aSettings.iWindowOrdinalPriority |
797 CreateWindowingElementsL(aSettings); |
844 iRwGroup->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); |
798 |
845 |
799 UpdateScreenTransparencyL(aSettings); |
846 iRw->SetPosition( aSettings.iLocation ); |
|
847 iRw->SetSize( aSettings.iSize ); |
|
848 iRw->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); |
|
849 |
|
850 iRwSession.Flush(); |
|
851 |
800 |
852 SetDisplayWindowL( iRwSession, *iDev, *iRw ); |
801 SetDisplayWindowL( iRwSession, *iDev, *iRw ); |
853 |
802 |
854 SetRotationL( aSettings.iRotation, aForceUpdate ); |
803 SetRotationL( aSettings.iRotation, aForceUpdate ); |
855 |
804 |
1945 allUsersReady = EFalse; |
1894 allUsersReady = EFalse; |
1946 } |
1895 } |
1947 } |
1896 } |
1948 return allUsersReady; |
1897 return allUsersReady; |
1949 } |
1898 } |
|
1899 |
|
1900 // --------------------------------------------------------------------------- |
|
1901 // |
|
1902 // --------------------------------------------------------------------------- |
|
1903 // |
|
1904 void CMccVideoSinkImpl::UpdateScreenTransparencyL(const TMccVideoSinkSetting& aSettings) |
|
1905 { |
|
1906 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::UpdateScreenTransparencyL" ) |
|
1907 __ASSERT_ALWAYS( iGc && iRw, User::Leave( KErrNotReady ) ); |
|
1908 TRect vfRect( TPoint( 0, 0 ), aSettings.iSize ); |
|
1909 iGc->Activate( *iRw ); |
|
1910 iRw->Invalidate( vfRect ); |
|
1911 iRw->BeginRedraw( vfRect ); |
|
1912 iGc->CancelClippingRect(); |
|
1913 iGc->SetDrawMode( CGraphicsContext::EDrawModeWriteAlpha ); |
|
1914 iGc->SetBrushStyle( CGraphicsContext::ESolidBrush ); |
|
1915 iGc->SetBrushColor( TRgb( 0, 0, 0, 0 ) ); |
|
1916 iGc->DrawRect( vfRect ); |
|
1917 iRw->EndRedraw(); |
|
1918 iGc->Deactivate(); |
|
1919 iRwSession.Flush(); |
|
1920 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::UpdateScreenTransparencyL, exit" ) |
|
1921 } |
|
1922 |
|
1923 // --------------------------------------------------------------------------- |
|
1924 // |
|
1925 // --------------------------------------------------------------------------- |
|
1926 // |
|
1927 void CMccVideoSinkImpl::DeleteWindowingElements() |
|
1928 { |
|
1929 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::DeleteWindowingElements" ) |
|
1930 if ( iVideoPlayer && iRw ) |
|
1931 { |
|
1932 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: removing window from player" ) |
|
1933 iVideoPlayer->RemoveDisplayWindow( *iRw ); |
|
1934 } |
|
1935 delete iGc; |
|
1936 iGc = NULL; |
|
1937 delete iDev; |
|
1938 iDev = NULL; |
|
1939 delete iRw; |
|
1940 iRw = NULL; |
|
1941 delete iRwGroup; |
|
1942 iRwGroup = NULL; |
|
1943 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::DeleteWindowingElements, exit" ) |
|
1944 } |
|
1945 |
|
1946 // --------------------------------------------------------------------------- |
|
1947 // |
|
1948 // --------------------------------------------------------------------------- |
|
1949 // |
|
1950 void CMccVideoSinkImpl::CreateWindowingElementsL(const TMccVideoSinkSetting& aSettings) |
|
1951 { |
|
1952 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::CreateWindowingElementsL" ) |
|
1953 |
|
1954 __ASSERT_ALWAYS( !iGc && !iDev && !iRw && !iRwGroup, User::Leave( KErrAlreadyExists ) ); |
|
1955 |
|
1956 TInt groupId = iRwSession.GetFocusWindowGroup(); |
|
1957 iRwGroup = new (ELeave) RWindowGroup( iRwSession ); |
|
1958 |
|
1959 User::LeaveIfError( iRwGroup->Construct( groupId, EFalse ) ); |
|
1960 iRwGroup->SetName( KMccWindowGroupName ); |
|
1961 |
|
1962 // TBD: use also iWindowOrdinalPriority |
|
1963 iRwGroup->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); |
|
1964 iRwGroup->AutoForeground( EFalse ); |
|
1965 |
|
1966 // Create screen device |
|
1967 iDev = new (ELeave) CWsScreenDevice( iRwSession ); |
|
1968 User::LeaveIfError( iDev->Construct( aSettings.iDeviceIndex ) ); |
|
1969 |
|
1970 // Create window |
|
1971 iRw = new (ELeave) RWindow( iRwSession ); |
|
1972 |
|
1973 User::LeaveIfError( iRw->Construct( *iRwGroup, (TUint32)iRw ) ); |
|
1974 |
|
1975 iRw->SetPosition( aSettings.iLocation ); |
|
1976 iRw->SetSize( aSettings.iSize ); |
|
1977 |
|
1978 iRw->SetOrdinalPosition( aSettings.iWindowOrdinalPosition ); |
|
1979 |
|
1980 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: creating graphics context ..." ) |
|
1981 User::LeaveIfError( iDev->CreateContext( iGc ) ); |
|
1982 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl: graphics context created!" ) |
|
1983 |
|
1984 iRw->Activate(); |
|
1985 |
|
1986 iRwSession.Flush(); |
|
1987 |
|
1988 __V_SOURCESINK_CONTROLL( "CMccVideoSinkImpl::CreateWindowingElementsL, exit" ) |
|
1989 } |
1950 |
1990 |
1951 // End of file |
1991 // End of file |
1952 |
1992 |