# HG changeset patch # User hgs # Date 1278711815 18000 # Node ID 5e8b14bae8c38db038e8ec1399130800243a528a # Parent ebf79c79991aa578ac3ad645076545bbcf9bc31d 201027 diff -r ebf79c79991a -r 5e8b14bae8c3 inc/AmrCodec.h --- a/inc/AmrCodec.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,364 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - - -#ifndef __AMRCODEC_H__ -#define __AMRCODEC_H__ - -// INCLUDES - -#include - - -// FORWARD DECLARATIONS - -class CAmrToPcmDecoderImpl; -class CPcmToAmrEncoderImpl; - - -// CLASS DECLARATION - -/** -* TAmrDecParams -* AMR decoding parameters. -*/ -class TAmrDecParams - { -public: - /** - * Default constructor. - */ - inline TAmrDecParams(); -public: - // error concealment level (0 none, 1 default) - TInt iConcealment; - }; - -TAmrDecParams::TAmrDecParams() : -iConcealment(1) {} - -/** -* TAmrEncParams -* AMR encoding parameters. -*/ -class TAmrEncParams - { -public: - /** - * Default constructor. - */ - inline TAmrEncParams(); -public: - // encoding mode 0-7 (0=MR475,1=MR515,...,7=MR122, default 7) - TInt iMode; - // DTX flag (TRUE or default FALSE) - TInt iDTX; - }; - -TAmrEncParams::TAmrEncParams() : -iMode(7), iDTX(0) {} - - -// CLASS DEFINITIONS - -/** -* TAmrFrameInfo -* AMR frame info struct. -*/ -class TAmrFrameInfo - { -public: - /** - * Default constructor. - */ - TAmrFrameInfo() {}; -public: - /** - * Returns the size of smallest AMR audio frame, i.e., the size of one DTX - * frame. NO DATA frames (size 1 byte) are not taken into account here. - * - * @since ?Series60_version - * @param none - * @return TInt - */ - IMPORT_C static TInt MinFrameSize(); - - /** - * Returns the size of biggest AMR audio frame, i.e., the size of one EFR - * frame. - * - * @since ?Series60_version - * @param none - * @return TInt - */ - IMPORT_C static TInt MaxFrameSize(); - - /** - * Returns the maximum number of samples per one audio channel in one - * AMR audio frame. - * - * @since ?Series60_version - * @param none - * @return TInt - */ - IMPORT_C static TInt MaxFrameSamples(); - - /** - * Returns the maximum number audio channels in one frame. - * - * @since ?Series60_version - * @param none - * @return TInt - */ - IMPORT_C static TInt MaxChannels(); - - /** - * Returns the size of one AMR frame header. The header must include - * all bits needed for determining the actual frame length. - * - * @since ?Series60_version - * @param none - * @return TInt Size of AMR frame header - */ - IMPORT_C static TInt FrameHeaderSize(); - - /** - * Returns the size of frame described by given coding parameters. The only - * parameter used in calculation is the coding mode (iMode). - * - * @since ?Series60_version - * @param none - * @return TInt AMR frame size - */ - IMPORT_C static TInt FrameSize(const TAmrFrameInfo& aInfo); -public: - TInt iMode; // encoding mode - TInt iBitrate; // bitrate (kbit/s) - TInt iSamplingRate; // sampling frequency (Hz) - TInt iChannels; // number of channels - TInt iFrameSize; // encoded size (bytes) - TInt iFrameSamples; // decoded size (samples per channel) -public: - TInt iSamplingRateOut; // sampling frequency after conversion (Hz) - TInt iChannelsOut; // number of audio channels after conversion (1 or 2) - TInt iFrameSamplesOut; // decoded size after conversion (samples per channel) - }; - -/** -* CAmrToPcmDecoder -* Low level AMR decoding API. -*/ -class CAmrToPcmDecoder : public CBase - { -protected: - /** - * Default constructor. - */ - IMPORT_C CAmrToPcmDecoder(); - - /** - * 2nd phase constructor. Constructs the decoder. - */ - IMPORT_C void ConstructL(); -public: - /** - * Two-phased constructor. First allocates and constructs decoder - * and then resets it according to the given configuration. - * - * @since ?Series60_version - * @param aConf Decoder configuration params - * @return CAmrToPcmDecoder* Pointer to constructed decoder - */ - IMPORT_C static CAmrToPcmDecoder* NewL(const TAmrDecParams& aConf); - - /** - * Destructor - */ - IMPORT_C virtual ~CAmrToPcmDecoder(); - - /** - * Initializes decoder and resets it into the default decoding state. - * - * @since ?Series60_version - * @param none - * @return void - */ - IMPORT_C void Reset(); - - /** - * Initializes decoder and resets it according to the given configuration. - * - * @since ?Series60_version - * @param aConf Decoder configuration params - * @return void - */ - IMPORT_C void Reset(const TAmrDecParams& aConf); - - /** - * Calculates the frame size and returns information about the frame which - * starts from the beginning of aBuf. Returns 0, if the frame bit syntax is - * incorrect or not enough bits are available for calculating the frame size - * and the frame parameters (aBufLen < TAmrCodecParams::FrameHeaderSize). - * - * The frame parameters returned via aInfo are: mode, sampling frequency, - * number of channels, frame size (same as return value) and number of - * samples in this frame. See also TMdaRawAmrAudioCodec class. - * - * @since ?Series60_version - * @param aBuf Pointer to frame buffer - * @param aBufLen Length of frame buffer - * @param aInfo Reference to frame parameters - * @return TInt Length of frame in bytes - */ - IMPORT_C static TInt FrameInfo(const TUint8* aBuf, TInt aBufLen, TAmrFrameInfo& aInfo); - - /** - * A variation of the FrameInfo above, which takes into account the - * decoding switches in calculating iSampligRateOut, iChannelsOut - * and iFrameSamplesOut.Initializes decoder and resets it according - * to the given configuration. - * - * @since ?Series60_version - * @param aBuf Pointer to frame buffer - * @param aBufLen Length of frame buffer - * @param aInfo Reference to fram parameters - * @param aConf Reference to decoding switches - * @return TInt Length of frame in bytes - */ - IMPORT_C static TInt FrameInfo(const TUint8* aBuf, TInt aBufLen, TAmrFrameInfo& aInfo, const TAmrDecParams& aConf); - - /** - * This routine seeks the start position of the next frame and returns - * the byte position of its header. Returns aBufLen, if no valid frame - * can not be found (see FrameInfo). The seek progresses from the start - * of aBuf (0) toward the end of aBuf(aBufLen - 1). - * - * The level of syntax check depends on the number of bits available. At - * minimum the first frame header bits are checked only, but if more - * bits are available, they can be used to make the sync seek more robust. - * For succesful seek the whole frame does not need to exist in aBuf. - * - * @since ?Series60_version - * @param aBuf Pointer to frame buffer - * @param aBufLen Length of frame buffer - * @return TInt Frame position or aBufLen - */ - IMPORT_C static TInt SeekSync(const TUint8* aBuf, TInt aBufLen); - - /** - * Decodes one frame. - * - * @since ?Series60_version - * @param aSrc Pointer to bit stream buffer - * @param aSrcUsed Number of consumed bytes - * @param aDst Pointer to PCM buffer - * @param aDstLen Number of produced bytes - * @param aMuteFlag If ETrue this frame is muted - * @return TInt Non-zero if decoding failed - */ - IMPORT_C TInt Decode(TUint8* aSrc, TInt& aSrcUsed, TUint8* aDst, TInt& aDstLen, TBool aMuteFlag); - - /** - * Decodes one frame from aSrc to aDst1 and aDst2. NOTE: aDst1 or - * aDst2 can be NULL and in that case decoding to that buffer is not - * requested. - * - * @since ?Series60_version - * @param aSrc Pointer to bit stream buffer - * @param aSrcUsed Number of consumed bytes - * @param aDst1 Pointer to PCM sample buffer (time domain sample) - * @param aDst2 Pointer to frequency sample buffer (frequency domain sample) - * @param aDstLen1 Number of produced bytes in aDst1 - * @param aDstLen2 Number of produced bytes in aDst2 - * @param aMuteFlag If ETrue this frame is muted - * @return TInt Non-zero if decoding failed - */ - IMPORT_C TInt Decode(TUint8* aSrc, TInt& aSrcUsed, TUint8* aDst1, TUint8* aDst2, TInt& aDstLen1, TInt& aDstLen2, TInt aMuteFlag); -private: - CAmrToPcmDecoderImpl* iState; - }; - -/** -* CPcmToAmrEncoder -* Low level AMR encoding API. -*/ -class CPcmToAmrEncoder : public CBase - { -protected: - - /** - * Default constructor. - */ - IMPORT_C CPcmToAmrEncoder(); - - /** - * 2nd phase constructor. Constructs the encoder. - */ - IMPORT_C void ConstructL(); -public: - - /** - * Two-phased constructor. First allocates and constructs encoder - * and then resets it according to the given configuration. - * - * @since ?Series60_version - * @param aConf Encoder configuration params - * @return CPcmToAmrEncoder* Pointer to constructed encoder - */ - IMPORT_C static CPcmToAmrEncoder* NewL(const TAmrEncParams& aConf); - - /** - * Destructor - */ - IMPORT_C virtual ~CPcmToAmrEncoder(); - - /** - * Initializes encoder and resets encoder state. - * - * @since ?Series60_version - * @param none - * @return void - */ - IMPORT_C void Reset(); - - /** - * Initializes encoder and resets it according to the given configuration. - * - * @since ?Series60_version - * @param aConf Encoder configuration params - * @return void - */ - IMPORT_C void Reset(const TAmrEncParams& aConf); - - /** - * Encodes one frame. - * - * @since ?Series60_version - * @param aSrc Pointer to PCM buffer - * @param aSrcUsed Number of consumed bytes - * @param aDst Pointer to bit stream buffer - * @param aDstLen Length of resulting frame - * @return TInt Non-zero if encoding failed - */ - IMPORT_C TInt Encode(TUint8* aSrc, TInt& aSrcUsed, TUint8* aDst, TInt& aDstLen); -private: - CPcmToAmrEncoderImpl* iState; - }; - -#endif //__AMRCODEC_H__ - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 inc/DebugMacros.h --- a/inc/DebugMacros.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Debug Macros used by AdvancedAudioController -* -*/ - - -#ifndef __DEBUGMACROS_H__ -#define __DEBUGMACROS_H__ - -// MACROS -#ifdef _DEBUG -#define DP0(string) RDebug::Print(string) -#define DP1(string,arg1) RDebug::Print(string,arg1) -#define DP2(string,arg1,arg2) RDebug::Print(string,arg1,arg2) -#define DP3(string,arg1,arg2,arg3) RDebug::Print(string,arg1,arg2,arg3) -#define DP4(string,arg1,arg2,arg3,arg4) RDebug::Print(string,arg1,arg2,arg3,arg4) -#define DP5(string,arg1,arg2,arg3,arg4,arg5) RDebug::Print(string,arg1,arg2,arg3,arg4,arg5) -#define DP6(string,arg1,arg2,arg3,arg4,arg5,arg6) RDebug::Print(string,arg1,arg2,arg3,arg4,arg5,arg6) -#else -#define DP0(string) -#define DP1(string,arg1) -#define DP2(string,arg1,arg2) -#define DP3(string,arg1,arg2,arg3) -#define DP4(string,arg1,arg2,arg3,arg4) -#define DP5(string,arg1,arg2,arg3,arg4,arg5) -#define DP6(string,arg1,arg2,arg3,arg4,arg5,arg6) -#endif - -#endif //__DEBUGMACROS_H__ diff -r ebf79c79991a -r 5e8b14bae8c3 inc/EAacPlusFrameParser.h --- a/inc/EAacPlusFrameParser.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - - -#ifndef EAACPLUSFRAMEPARSER_H -#define EAACPLUSFRAMEPARSER_H - -// INCLUDES -#include -#include "EAacPlusUtil.h" - -class CFrameTable; -class CMMFBuffer; - -// CLASS DECLARATION - -/** -* This class implements utility functions to extract AAC frame -* information. -* -* @lib MmfEAacPlusUtil.lib -* @since 3.2 -*/ -class CEAacPlusFrameParser : public CBase - { - public: - - class TEAacPlusParserConfig - { - public: - CEAacPlusUtil::TEAacPlusFrameLenConfig iFrameLenConfig; // config info needed by util for frame length. - TInt iOutSamplingFrequency; // output sampling freq of decoder - TInt iNumOfSamples; // samples per frame - CFrameTable* iFrameTable; // the frame table - }; - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CEAacPlusFrameParser* NewL(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CEAacPlusFrameParser(); - - public: // New functions - - /** - * Used to parse the aac frames and populate the seek table. - * @since 3.2 - * @param aBuf buffer of AAC data from start of aac content - * @param aBufLen length of aBuf - * @return status - */ - IMPORT_C TInt Parse(const CMMFBuffer& aSrc, TInt& aSrcUsed); - - /** - * Used to configure the utility with information needed to enable the apis. - * This api can be used if GetAacFrameInfo is not used to initialize the utility. - * @since 3.2 - * @param aFormatType format type - * @param aSamplingFrequency sampling frequency - * @return status - */ - IMPORT_C TInt Config(TEAacPlusParserConfig& aParserConfig); - IMPORT_C TInt ReConfig(); - - private: - - /** - * C++ default constructor. - */ - CEAacPlusFrameParser(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - CEAacPlusUtil* iAacUtil; - CFrameTable* iFrameTable; - - // local input buffer - TUint8* iTmpBuf; - const TUint8* iTmpBufPtr; - TInt iTmpBufBytes; - TInt iBytesCopied; - - TBool iUsingTmpBuf; - - TInt iPos; -// CEAacPlusUtil::TEAacPlusFormatType iFormatType; -// TInt iInSamplingFrequency; -// TInt iOutSamplingFrequency; -// TInt iNumOfSamples; - TEAacPlusParserConfig iParserConfig; - - }; - -#endif // EAACPLUSFRAMEPARSER_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 inc/EAacPlusUtil.h --- a/inc/EAacPlusUtil.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,167 +0,0 @@ -/* -* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header file for EAacPlusUtil.cpp -* -*/ - - -#ifndef EAACPLUSUTIL_H -#define EAACPLUSUTIL_H - -// INCLUDES -#include - -// CLASS DECLARATION -class EAacpAudioFrameInfo; - -/** -* This class implements utility functions to extract AAC frame -* information. -* -* @lib MmfEAacPlusUtil.lib -* @since 3.2 -*/ -class CEAacPlusUtil : public CBase - { - public: - // CONSTANTS - enum TEAacPlusFormatType - { - EAacPlusFormatRaw=0, - EAacPlusFormatAdif=1, - EAacPlusFormatAdts=2 - }; - /** - * EAAC+ frame info struct. - * - * @lib MmfEAacPlusUtil.lib - * @since 3.2 - */ - class TEAacPlusFrameInfo - { - public: - TInt iOutFrameSize; // Size of PCM Samples generated by decoder - TInt iNoOfSamples; // Number of PCM Samples generated by decoder per frame - TInt iSamplingFrequency; // Sampling freq of AAC Code decoder - TInt iNoOfChannels; // No of output channel 1=Mono; 2=Stereo - TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP - TInt iOutSamplingFrequency; // Sampling Frequence for the output samples - TInt iDownSampledMode; // 0=Normal Mode; 1=Down Sampled mode - TInt iSbr; // 0=SBR not present; 1=SBR present - TInt iPs; // 0=PS not present; 1=PS present - }; - - class TEAacPlusFrameLenConfig - { - public: - TEAacPlusFormatType iFormatType; // Container type. - TInt iSamplingFrequency; // Sampling freq of AAC core decoder - TInt iObjectType; // MPEG Audio Object Type 2=AAC-LC; 4=AAC-LTP - }; - - - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - IMPORT_C static CEAacPlusUtil* NewL(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CEAacPlusUtil(); - - public: // New functions - - /** - * Used to get the format type. - * @since 3.2 - * @param aBuf buffer of AAC data from start of aac content - * @param aBufLen length of aBuf - * @param TEAacPlusFormatType returned format type 0=raw; 1=ADIF; 2=ADTS - * @return status - */ - IMPORT_C TInt GetAacFormatType(const TUint8* aBuf, TInt aBufLen, TEAacPlusFormatType& aFormatType); - - /** - * Used to get the audio format information for ADIF and ADTS content. - * Data should be provided beginning with start of aac content including header. - * Enough data should follow the header to determine SBR and PS if needed. - * Can be used with mpeg data where aHdrBuf will contain the AudioSpecificConfig. Implicit SBR and PS - * will not be determined. - * @since 3.2 - * @param aHdrBuf buffer with AAC data beginning at start of aac content including ADIF or ADTS header - * @param aHdrLen length of aHdrBuf; header length is returned in this parameter - * @param aFrameInfo returns the format information - * @return status - */ - IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo); - - /** - * Used to get the audio format information for mpeg aac. - * aHdrBuf will contain the AudioSpecificConfig. aDataBuf will contain data at beginning of raw audio frames. - * Implicit SBR and PS can be determined. - * @since 3.2 - * @param aHdrBuf buffer with AudioSpecificConfig data. - * @param aHdrLen length of aHdrBuf - * @param aFrameInfo returns the format information - * @param aDataBuf buffer with raw audio frames - * @param aDataBufLen length of aDataBuf - * @return status - */ - IMPORT_C TInt GetAacFrameInfo (const TUint8* aHdrBuf, TInt& aHdrLen, TEAacPlusFrameInfo& aFrameInfo, - TUint8* aDataBuf, TInt aDataBufLen); - - /** - * Used to get the size in bytes of the frame found at the start of aBuf. - * @since 3.2 - * @param aBuf buffer with AAC data frame - * @param aBufLen length of aBuf - * @param aFrameLen returns the frame size in bytes - * @return status - */ - IMPORT_C TInt GetAacFrameLength(const TUint8* aBuf, TInt aBufLen, TInt& aFrameLen); - - /** - * Used to configure the utility with information needed to enable the apis. - * This api can be used if GetAacFrameInfo is not used to initialize the utility. - * @since 3.2 - * @param aFormatType format type - * @param aSamplingFrequency sampling frequency - * @return status - */ - IMPORT_C TInt Config(TEAacPlusFrameLenConfig& aFrameLenConfig); - - private: - - /** - * C++ default constructor. - */ - CEAacPlusUtil(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - private: // Data - TEAacPlusFormatType iFormat; - EAacpAudioFrameInfo* iGetFrameLenParam; - TBool iInitialized; - }; - -#endif // EAACPLUSUTIL_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 inc/FrameTable.h --- a/inc/FrameTable.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - - -#ifndef CFRAMETABLE_H -#define CFRAMETABLE_H - -// INCLUDES -#include - -// FORWARD DECLARATIONS -class MFrameTableEventObserver; - -// CLASS DEFINITIONS - -/** - * This class provides AAC utility functions. - * - * @lib AACAudioControllerUtility.lib - * @since 3.0 - */ -class CFrameTable : public CBase - { -public: - // Constructors and destructor - - enum TFrameTableEvent - { - EPosReached, - EDecodeInterval, - EPlayWindowEndPosReached - }; - - /** - * Two-phased constructor. - */ - IMPORT_C static CFrameTable* NewL(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CFrameTable(); - -public: - // New functions - - IMPORT_C TInt InitFrameTable(TInt aSampleRate, TInt aSamplesPerFrame); - IMPORT_C TInt SubmitTableEntry(TUint aPos); - - IMPORT_C TInt FindFramePosFromTime(TUint& aTimeMs, TUint& aPos); - IMPORT_C TInt FindFrameTimeFromPos(TUint& aTimeMs, TUint& aPos); - IMPORT_C TInt LastFramePos(TUint& aPos); - IMPORT_C TInt LastFrameTime(TUint& aTimeMs); - - IMPORT_C void ShrinkTable(); - IMPORT_C void ResetTable(); - - IMPORT_C TInt SetSourceReference(TUint aTimeMs, TUint aPos); - - IMPORT_C TInt RegisterForEvent(TFrameTableEvent aEvent, - MFrameTableEventObserver* aObserver, TUint aParam); - IMPORT_C TInt UnRegisterForEvent(TFrameTableEvent aEvent, - MFrameTableEventObserver* aObserver); - IMPORT_C TInt Bitrate(); - IMPORT_C TInt IsSeeking(TBool& aIsSeeking); - IMPORT_C TInt GetLastPosEvent(TUint& aPos); - -private: - - class TBufRefPosEntry - { -public: - TUint iPos; - TUint iFrameNum; - }; - - /** - * C++ default constructor. - */ - CFrameTable(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - TUint CalcFrameFromTimeMs(TUint aTimeMs); - TInt SubmitLowResTableEntry(TBufRefPosEntry& aEntry); - -private: - // Data - - RArray iFrameTable; - RArray iLowResFrameTable; - TUint iSampleRate; - TUint iSamplesPerFrame; - TUint iMsecPerFrame; - TUint iLastBytePos; - TUint iAvgBitrate; - TUint iOffset; - TUint iTimeRefMs; - TUint iPosEventMs; - TUint iPlayWindowEndPosEventMs; - TInt iIntervalRef; - TUint iIntervalEvent; - MFrameTableEventObserver* iObserver; - TUint iEventPos; - TUint iCurrentFrameCount; - TUint iFramesPerLowResInterval; - TUint iLowResIntervalMs; - TUint iFrameNum; - TBool iOkToShrink; - }; - -class MFrameTableEventObserver - { -public: - virtual TInt - HandleFrameTableEvent(CFrameTable::TFrameTableEvent aEvent) = 0; - }; - -#endif // CFRAMETABLE_H -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 inc/Mp3Codec.h --- a/inc/Mp3Codec.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - - -#ifndef __MP3CODEC_H__ -#define __MP3CODEC_H__ - -// INCLUDES -#include - -// CONSTANTS - -// DATA TYPES - -// FORWARD DECLARATION -class CMp3ToPcmDecoderImpl; - -// CLASS DEFINITIONS -/* ------------------------------------------------------------------------------ - - TMp3DecParams - - MP3 decoding parameters. - - @since 2.1 - ------------------------------------------------------------------------------ -*/ -class TMp3DecParams - { -public: - inline TMp3DecParams(); -public: - TInt iStereoToMono; // stereo to mono switch (TRUE or default FALSE) - TInt iLeftRight; // decode left or right channel (1 left, 2 right, 0 default all) - TInt iDecimFactor; // decimation factor (2, 4 or default 1) - TInt iConcealment; // error concealment level (0 none, default 1) - TInt iSampleLength; // resolution of PCM samples (default 16 bits) - TInt iSamplingFrequency; //Output sampling frequency - }; - -TMp3DecParams::TMp3DecParams() : -iStereoToMono(0), iLeftRight(0), iDecimFactor(1), iConcealment(1), iSampleLength(16), iSamplingFrequency(0) {} - - - -/* ------------------------------------------------------------------------------ - - TMp3FrameInfo - - MP3 frame info struct. - - @since 2.1 - ------------------------------------------------------------------------------ -*/ -class TMp3FrameInfo - { -public: - inline TMp3FrameInfo(); -public: - IMPORT_C static TInt MinFrameSize(); - IMPORT_C static TInt MaxFrameSize(); - IMPORT_C static TInt MaxFrameSamples(); - IMPORT_C static TInt MaxChannels(); - IMPORT_C static TInt MaxAncillaryBits(); - IMPORT_C static TInt FrameHeaderSize(); - IMPORT_C static TInt FrameSize(const TMp3FrameInfo& aInfo); -public: - TInt iId; // id of algorithm (1 MPEG-1, 0 MPEG-2) - TInt iLayer; // layer number (1, 2, 3 or 4) - TInt iErrorProtection; // err prot flag (TRUE or FALSE, TRUE if err protected) - TInt iBitrate; // bitrate (kbit/s) - TInt iSamplingRate; // sampling frequency (Hz) - TInt iPadding; // padding flag (TRUE or FALSE, TRUE if p slot exists) - TInt iPrivateBit; // bit for private use - TInt iMode; // audio mode (0 stereo, 1 jstereo, 2 dual, 3 mono) - TInt iChannels; // number of audio channels (1 for mono, otherwise 2) - TInt iCopyright; // copyright flag (TRUE or FALSE, TRUE if copyrighted) - TInt iOrigCopy; // original flag (TRUE or FALSE, TRUE if original) - TInt iFrameSize; // size of encoded frame (bytes) - TInt iFrameSamples; // length of decoded frame (samples per channel) -public: - TInt iSamplingRateOut; // sampling frequency after conversion(s) (Hz) - TInt iChannelsOut; // number of audio channels after conversion(s) (1 or 2) - TInt iFrameSamplesOut; // length of decoded frame after conversion(s) (samples per channel) - }; - -TMp3FrameInfo::TMp3FrameInfo() {} - - - -/* ------------------------------------------------------------------------------ - - CMp3ToPcmDecoder - - Low level MP3 decoding API. - - @since 2.1 - ------------------------------------------------------------------------------ -*/ -class CMp3ToPcmDecoder : public CBase - { -protected: - IMPORT_C CMp3ToPcmDecoder(); - IMPORT_C void ConstructL(); - -public: - IMPORT_C static CMp3ToPcmDecoder* NewL(const TMp3DecParams& aConf); - IMPORT_C virtual ~CMp3ToPcmDecoder(); - IMPORT_C void Reset(); - IMPORT_C void Reset(const TMp3DecParams& aConf); - IMPORT_C static TInt FrameInfo(const TUint8* aBuf, TInt aBufLen, TMp3FrameInfo& aInfo); - IMPORT_C static TInt FrameInfo(const TUint8* aBuf, TInt aBufLen, TMp3FrameInfo& aInfo, const TMp3DecParams& aConf); - IMPORT_C static TInt SeekSync(const TUint8* aBuf, TInt aBufLen); - IMPORT_C TInt Decode(TUint8* aSrc, TInt& aSrcUsed, TUint8* aDst, TInt& aDstLen, TInt aMuteFlag); - IMPORT_C TInt Decode(TUint8* aSrc, TInt& aSrcUsed, TUint8* aDst1, TUint8* aDst2, TUint8* aDst3, TInt& aDstLen1, TInt& aDstLen2, TInt& aDstLen3, TInt aMuteFlag); -private: - CMp3ToPcmDecoderImpl* iState; - }; - -#endif //__MP3CODEC_H__ -//----------------------------------------------------------------------------- -// End of File -//----------------------------------------------------------------------------- diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/group/openmaxal.mmp --- a/khronosfws/openmax_al/group/openmaxal.mmp Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/group/openmaxal.mmp Fri Jul 09 16:43:35 2010 -0500 @@ -31,6 +31,8 @@ CAPABILITY ALL -TCB MACRO USE_NGA_SURFACES +MACRO XA_API=EXPORT_C + //MACRO MARKERPOSITIONTIMERLOG //MACRO POSITIONUPDATETIMERLOG //MACRO USE_LOCAL_WINDOW_RESOURCES @@ -41,93 +43,37 @@ SOURCE xaadaptationgst.c SOURCE xagstcapabilitiesmgr.c SOURCE xaaudioencoderitfadaptation.c -SOURCE xadevicevolumeitfadaptation.c -SOURCE xadynamicsourceitfadaptation.c SOURCE xaengineadaptctx.c -SOURCE xaequalizeritfadaptation.c -SOURCE xaledarrayadaptctx.c -SOURCE xaledarrayitfadaptation.c -SOURCE xamediaplayeradaptctx.c SOURCE xamediarecorderadaptctx.c SOURCE xametadataadaptation.c -SOURCE xametadataadaptctx.c -SOURCE xaoutputmixadaptctx.c -SOURCE xaoutputmixitfadaptation.c -SOURCE xaplaybackrateitfadaptation.c -SOURCE xaplayitfadaptation.c - -SOURCE xardsitfadaptation.c SOURCE xarecorditfadaptation.c -SOURCE xaseekitfadaptation.c -SOURCE xavibraadaptctx.c -SOURCE xavibraitfadaptation.c -SOURCE xavolumeitfadaptation.c -SOURCE xastreaminformationitfadaptation.c -#ifdef OMAX_CAMERABIN -SOURCE xacameraadaptctx.c -SOURCE xacameraitfadaptation.c -SOURCE xaimagecontrolsitfadaptation.c -SOURCE xaimageeffectsitfadaptation.c -SOURCE xaimageencoderitfadaptation.c -SOURCE xasnapshotitfadaptation.c -SOURCE xastaticcameracapsadaptation.c -SOURCE xavideoencoderitfadaptation.c -SOURCE xavideopostprosessingitfadaptation.c -#endif SOURCEPATH ../src/adptcommon SOURCE xaframeworkmgr.c SOURCE xacapabilitiesmgr.c SOURCE xaadptbasectx.c -#ifdef OMAX_CAMERABIN -SOURCEPATH ../src/camera -SOURCE xacameradevice.c -SOURCE xacameraitf.c -#endif - SOURCEPATH ../src/common SOURCE openmaxal.c SOURCE xacommon.c SOURCE xaconfigextensionsitf.c SOURCE xadynamicsourceitf.c SOURCE xadynintmgmtitf.c -SOURCE xaequalizeritf.c SOURCE xametadataextractionitf.c -SOURCE xametadatatraversalitf.c SOURCE xaobjectitf.c SOURCE xaplatform.c SOURCE xathreadsafety.c SOURCE xavolumeitf.c SOURCE xastreaminformationitf.c -SOURCE xanokialinearvolume_iid.c -SOURCE xanokiavolumeext_iid.c SOURCE xanokialinearvolumeitf.c SOURCE xanokiavolumeextitf.c -#ifdef OMAX_CAMERABIN -SOURCE xaimagecontrolsitf.c -SOURCE xaimageeffectsitf.c -SOURCE xavideopostprocessingitf.c -#endif SOURCEPATH ../src/engine -SOURCE xaaudiodecodercapabilitiesitf.c SOURCE xaaudioencodercapabilitiesitf.c SOURCE xaaudioiodevicecapabilitiesitf.c -SOURCE xadevicevolumeitf.c SOURCE xaengine.c SOURCE xaengineitf.c SOURCE xathreadsyncitf.c -#ifdef OMAX_CAMERABIN -SOURCE xacameracapabilitiesitf.c -SOURCE xaimagedecodercapabilitiesitf.c -SOURCE xaimageencodercapabilitiesitf.c -SOURCE xavideodecodercapabilitiesitf.c -SOURCE xavideoencodercapabilitiesitf.c -#endif -SOURCEPATH ../src/ledarray -SOURCE xaledarraydevice.c -SOURCE xaledarrayitf.c SOURCEPATH ../src/mediaplayer SOURCE xamediaplayer.c @@ -141,27 +87,13 @@ SOURCE xamediarecorder.c SOURCE xametadatainsertionitf.c SOURCE xarecorditf.c -#ifdef OMAX_CAMERABIN -SOURCE xaimageencoderitf.c -SOURCE xasnapshotitf.c -SOURCE xavideoencoderitf.c -#endif SOURCEPATH ../src/metadataextractor SOURCE xametadataextractor.c -SOURCEPATH ../src/outputmix -SOURCE xaoutputmix.c -SOURCE xaoutputmixitf.c - SOURCEPATH ../src/radio SOURCE xaradiodevice.c SOURCE xaradioitf.c -SOURCE xardsitf.c - -SOURCEPATH ../src/vibra -SOURCE xavibradevice.c -SOURCE xavibraitf.c SOURCEPATH ../src/mmf_adaptation // Removing below file since currently there is no Engine related @@ -180,7 +112,6 @@ SOURCE xanokialinearvolumeitfadaptationmmf.c SOURCE xanokiavolumeextitfadaptationmmf.c SOURCE xammfcapabilitiesmgr.c -//SOURCE xangavideosink.cpp SOURCE markerpositiontimer.cpp SOURCE positionupdatetimer.cpp SOURCE xaseekitfadaptationmmf.c @@ -195,15 +126,11 @@ USERINCLUDE ../src/khronos USERINCLUDE ../src/mmf_adaptation USERINCLUDE ../src/gst_adaptation -USERINCLUDE ../src/camera USERINCLUDE ../src/common USERINCLUDE ../src/engine -USERINCLUDE ../src/ledarray USERINCLUDE ../src/mediaplayer USERINCLUDE ../src/mediarecorder -USERINCLUDE ../src/outputmix USERINCLUDE ../src/radio -USERINCLUDE ../src/vibra USERINCLUDE ../src/adptcommon MW_LAYER_SYSTEMINCLUDE @@ -235,9 +162,5 @@ LIBRARY libgstcoreelements.lib LIBRARY libgstcoreindexers.lib LIBRARY MetaDataUtility.lib -#ifdef OMAX_CAMERABIN -LIBRARY libgstphotography.lib -LIBRARY libgstvideo.lib -#endif STATICLIBRARY hxmetadatautil.lib diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/inc/openmaxalwrapper.h --- a/khronosfws/openmax_al/inc/openmaxalwrapper.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/inc/openmaxalwrapper.h Fri Jul 09 16:43:35 2010 -0500 @@ -16,16 +16,14 @@ * to DEF files. * */ -#ifndef _OPENMAXAL_WRAPPER_H_ -#define _OPENMAXAL_WRAPPER_H_ +#ifndef OPENMAXAL_WRAPPER_H_ +#define OPENMAXAL_WRAPPER_H_ -#include -#undef XA_API - -#define XA_API __declspec(dllexport) - +#include #include #include #include +#include -#endif +#endif //ends OPENMAXAL_WRAPPER_H_ + diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,490 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAADAPTATION_H_ -#define XAADAPTATION_H_ - -#include -#include -#include -#include -#include "openmaxalwrapper.h" -#include "XAAdaptationContextBase.h" -#include "XAGlobals.h" -#include -#include -#include -#include -#include -#include -#include "XAPlatform.h" -#include "XAStaticCapsAdaptation.h" - -#ifdef XA_IMPL_MEASURE_GST_DELAY -#include -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - -/* MACROS */ -#define FLIP_NONE 0 -#define FLIP_CLOCKWISE 1 /* Rotate clockwise 90 degrees */ -#define FLIP_ROTATE_180 2 /* Rotate 180 degrees */ -#define FLIP_COUNTERCLOCKWISE 3 /* Rotate counter-clockwise 90 degrees */ -#define FLIP_HORIZONTAL 4 /* Flip image horizontally */ -#define FLIP_VERTICAL 5 /* Flip image vertically */ - -/* TYPEDEFS */ -typedef gboolean (*GstBusCb)( GstBus *bus, GstMessage *message, gpointer data ); -#define XA_IMPL_SUPPORTED_AUDIO_OUT_NUM 3 -#define XA_IMPL_OMIX_MAX_CONNECTED_MEDIAPLAYERS 10 -#define CONTENT_PIPE_BUFFER_SIZE 1000 -#define TEST_VIDEO_WIDTH 640 -#define TEST_VIDEO_HEIGHT 480 - -typedef enum -{ - XA_AUDIO_WAVENC = 0, - XA_AUDIO_VORBISENC, - XA_AUDIO_PCM, - XA_NUM_OF_AUDIOENCODERS /* Do not move this line */ -} XAAudioEnc; - -typedef enum -{ - XA_VIDEO_JPEGENC = 0, - XA_VIDEO_THEORAENC, - XA_NUM_OF_VIDEOENCODERS /* Do not move this line */ -} XAVideoEnc; - -typedef enum CP_STATE -{ - CPStateNull =0, - CPStateInitialized, - CPStatePrerolling, - CPStateStarted, - CPStateRunning, - CPStatePaused, - CPStateStopped, - CPStateWaitForData, - CPStateEOS, - CPStateError -}CP_STATE; - -typedef enum -{ - XA_IMAGE_JPEGENC = 0, - XA_IMAGE_RAW, - XA_NUM_OF_IMAGEENCODERS /* Do not move this line */ -} XAImageEnc; - -typedef enum -{ - XA_RADIO_IDLE, - XA_RADIO_SEEKING, - XA_RADIO_SETTING_FREQUENCY, - XA_RADIO_SETTING_FREQUENCY_RANGE -} XARadioState; - -typedef enum -{ - XA_RADIO_RDS_IDLE, - XA_RADIO_RDS_GETTING_ODA_GROUP -} XARadioRDSState; -/* STRUCTURES */ - -typedef struct XAAdaptEvtHdlr_ -{ - xaAdaptEventHandler handlerfunc; /* function handling the callback */ - void *handlercontext; /* context of handler */ - XAuint32 eventtypes; /* what kind of events this handles */ -} XAAdaptEvtHdlr; - -/* Structure for content pipe thread context */ -typedef struct XAAdaptCpThrCtx_ -{ - XADataLocator_ContentPipe* pipe; /* pointer to content Pipe structure (Sink/Source) */ - CPhandle dataHandle; /* Handle to content pipe data */ - CP_STATE state; - XAConfigExtensionCpKey cpConfig; /* enum value for CP using e.g. ReadBuffer or WriteBuffer */ - XAImplSemHandle stateSem; - XAImplSemHandle mpStateSem; - XAImplSemHandle mpPrerollStateSem; - - GstAppSrc *appSrc; /* Pointer to appSrc where data is read from. Not owned */ - GstAppSink *appSink; /* Pointer to AppSink where dats is fed. Not owned */ -}XAAdaptCpThrCtx; - -/* context to track buffer insufficient event */ -typedef struct recordItfCtx_{ - XAImplSemHandle bufInsufficientSem; - XAboolean buffer_insufficient; -}recodtItfCtx; - -/* - * Structure that holds all common variables for every - * Gst-Adaptation context structures. - */ -typedef struct XAAdaptationBaseCtx_ -{ - /* Common Variables for all adaptation elements */ - XAuint32 ctxId; - GstState binWantedState; /** requested gst-bin target state **/ - GstElement *bin; /** Container for all gst elements **/ - - GstBus *bus; /** Gst-bus where gst sends messages **/ - GMainLoop *busloop; /** Gst-bus listener loop **/ - pthread_t busloopThr; - GstBusCb busCb; /** Gst-Bus callback funtion*/ - - GArray* evtHdlrs; /* array of event handlers */ - - XAboolean waitingasyncop; - sem_t semAsyncWait; - guint asynctimer; - - XAConfigExtensionCpKey cpConfig; /* enum value for CP using e.g. ReadBuffer or WriteBuffer */ - - /* Content Pipe variables */ - XAImplThreadHandle pipeSrcThr, pipeSinkThr; - XAAdaptCpThrCtx pipeSrcThrCtx, pipeSinkThrCtx; - -#ifdef XA_IMPL_MEASURE_GST_DELAY - clock_t startTime; - clock_t endTime; - double diff; -#endif /*XA_IMPL_MEASURE_GST_DELAY*/ - // VASU MOD BEGINS - XAboolean thread_launched; - pthread_mutex_t ds_mutex; - pthread_cond_t ds_condition; - XAboolean cond_mutx_inited; - // VASU MOD ENDS - /* FUNCTIONS*/ - -} XAAdaptationBaseCtx_; - -typedef struct XAEngineAdaptationCtx_ -{ - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - -} XAEngineAdaptationCtx_; - -typedef struct XAMetadataAdaptVars_ -{ - - XAuint32 childcount; - XAuint32 nodedepth; - XAuint32 traversemode; - - GstTagList* generaltags; - GstStructure* audiotags; - GstStructure* videotags; - GstStructure** currentchild; /*points to one of previous 3*/ - -} XAMetadataAdaptVars; - - -/* - * Structure for Media Player specific gst-adaptation. - */ -typedef struct XAMediaPlayerAdaptationCtx_ -{ - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - - /* OMX-AL Variables */ - XADataSource *xaSource, *xaBankSrc; - XADataSink *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra; - - /* GST elements */ - GstElement *source; - XAboolean isobjsrc; /*is source another XA object?*/ - GstElement *codecbin; - GstElement *audioppbin; - GstElement *videoppbin; - GstElement *filter; - GstElement *videoppBScrbin; - GstElement *inputSelector; - GstPad *blackScrSrcPad; - GstPad *videoScrSrcPad; - GstPad *blackScrSinkPad; - GstPad *videoScrSinkPad; - GstElement *audiosink; - XAboolean isobjasink; /*is audio sink another XA object?*/ - GstElement *videosink; - XAboolean isobjvsink; /*is video sink another XA object?*/ - - XAboolean mute; - XAuint32 imageEffectID; - XAboolean isStereoPosition; - XAmillidegree curRotation; - XAuint32 curMirror; - - XAint32 buffering; - - /* internals */ - XAboolean trackpositionenabled; - guint runpositiontimer; - GSourceFunc positionCb; - gint64 lastpos; - - XAboolean loopingenabled; - gint64 loopstart; - gint64 loopend; - - gdouble playrate; - guint32 rateprops; - - XAboolean cameraSinkSynced; - - XAMetadataAdaptVars *metadatavars; - -} XAMediaPlayerAdaptationCtx_; - -typedef struct XASnapshotItfVars_ -{ - - /*User variables*/ - XAuint32 numpics; - XAuint32 fps; - XAboolean freeze; - gchar* fnametemplate; - XADataSink* xaSink; - - /* internal variables */ - gboolean waitforbuffer; - gboolean parsenegotiated; - XAuint32 numpicstaken; - - GstBus* ssbus; - GstElement* sspipeline; - GstElement* ssbuffersrc; - GstElement* ssparser; - GstElement* ssscaler; - GstElement* ssfilter; - GstElement* ssencoder; - GstElement* sstagger; - GstElement* sssink; - gulong sighandler; - - GstBuffer* snapshotbuffer; - -} XASnapshotItfVars; - -typedef struct XAMediaRecorderAdaptationCtx_ -{ - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - - /* OMX-AL Variables */ - XADataSource *xaAudioSource, *xaVideoSource; - XADataSink *xaSink; - XAuint8 recModes; - - /* GST elements */ - GstElement *datasink; - XAboolean isobjsink; /*is sink another XA object?*/ - GstElement *codecbin; - GstElement *audioppbin; - GstElement *audiofilter; - GstElement *videoppbin; - GstElement *videofilter; - GstElement *videoextract; - GstElement *audiosource; - GstElement *audioqueue; - XAboolean isobjasrc; /*is audio source another XA object?*/ - GstElement *videosource; - GstState vsrcOrigState; - GstElement *videoqueue; - XAboolean isobjvsrc; /*is video source another XA object?*/ - XAboolean encodingchanged; - - XAboolean mute; - XAuint32 imageEffectID; - XAboolean isStereoPosition; - XAuint32 xaRecordState; - XAmillidegree curRotation; - XAuint32 curMirror; - XAboolean isRecord; - - /* internals */ - XAboolean trackpositionenabled; - gboolean runpositiontimer; - GSourceFunc positionCb; - - XAImplThreadHandle recordingEventThr; - recodtItfCtx recThrCtx; - - - /* Variables for snapshot */ - XASnapshotItfVars snapshotVars; - - XAMetadataAdaptVars *metadatavars; - - /* Variables for encoders */ - XAAudioEncoderSettings audioEncSettings; - XAVideoSettings videoEncSettings; - XAImageSettings imageEncSettings; - - /*buffersink variable*/ - guint64 writepos; - -} XAMediaRecorderAdaptationCtx_; - - -/* - * Structure for Camera specific gst-adaptation variables - */ -typedef struct XACameraAdaptationCtx_ { - - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 deviceID; - XAuint32 imageEffectID; - XAmillidegree curRotation; - XAuint32 curMirror; - - /* GST Variables */ - GstFocusStatus focusStatus; - - /* Internals */ - XAboolean recording; - XAboolean playing; - XAboolean snapshotting; -} XACameraAdaptationCtx_; - -/* - * Structure for Camera specific gst-adaptation variables - */ -typedef struct XARadioAdaptationCtx_ { - - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 frequency; - XAuint8 range; - - pthread_t emulationThread; - pthread_t rdsEmulationThread; - XARadioRDSState rdsState; - XARadioState state; - - /* GST Variables */ -} XARadioAdaptationCtx_; - - -typedef struct XAOMixAdaptConnObj_ -{ - /*pointer to connected context*/ - XAAdaptationBaseCtx* ctx; - /*pointer to sink currently used by connected ctx*/ - GstElement* currentSink; -} XAOMixAdaptConnObj; - -typedef struct XAOutputMixAdaptationCtx_ -{ - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - /* Internal variables */ - XAboolean isStereoPosition; - XAboolean mute; - - XAuint32 currentrouting; - - GArray* availableDevices; - GArray* connectedObjects; -} XAOutputMixAdaptationCtx_; - -/* - * Structure for Ledarray specific gst-adaptation variables - */ -typedef struct XALEDArrayAdaptationCtx_ { - - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 deviceID; - - /* GST Variables */ - -} XALedarrayAdaptationCtx_; - -/* - * Structure for Vibra specific gst-adaptation variables - */ -typedef struct XAVibraAdaptationCtx_ { - - /* Parent*/ - XAAdaptationBaseCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 deviceID; - - /* GST Variables */ -} XAVibraAdaptationCtx_; - -/* FUNCTIONS */ -/* - * gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ); - * Default CallBack handler for gst-bus messages. This will be called if object specific callback is - * not implemented. - */ -gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ); - -XAresult XAAdaptationBase_InitGstListener(XAAdaptationBaseCtx* ctx); -void * XAAdaptationBase_LaunchGstListener(void* args); -void XAAdaptationBase_StopGstListener(XAAdaptationBaseCtx* ctx); -void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, XAAdaptEvent* event); - -void XAAdaptationBase_PrepareAsyncWait(XAAdaptationBaseCtx* ctx); -void XAAdaptationBase_StartAsyncWait(XAAdaptationBaseCtx* ctx); -gboolean XAAdaptationBase_CancelAsyncWait(gpointer ctx); -void XAAdaptationBase_CompleteAsyncWait(XAAdaptationBaseCtx* ctx); - -GstElement* XAAdaptationBase_CreateGstSource( XADataSource* xaSrc, const char *name, XAboolean *isobj, XAboolean *isPCM, XAboolean *isRawImage ); -GstElement* XAAdaptationBase_CreateGstSink( XADataSink* xaSrc, const char *name, XAboolean *isobj ); -GstElement* XAAdaptationBase_CreateVideoPP( ); - -GstElement* XAAdaptationBase_CreateVideoPPBlackScr( ); -GstElement* XAAdaptationBase_CreateInputSelector( ); -GstElement* XAAdaptationBase_CreateAudioPP( ); -void XAAdaptationBase_PadBlockCb(GstPad *pad, gboolean blocked, gpointer user_data); -void XAAdaptationBase_SetAllCaps (GstCaps * caps, char *field, ...); - -XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer(XAMediaPlayerAdaptationCtx_* mCtx); - -XAresult XAMediaRecorderAdapt_ChangeEncoders( XAMediaRecorderAdaptationCtx_* mCtx ); -XAresult XAMediaRecorderAdapt_CheckCodec( XAMediaRecorderAdaptationCtx_* mCtx, XACapsType encType, XAuint32 encoderId ); - -XAresult XAMetadataAdapt_TryWriteTags(XAAdaptationBaseCtx* mCtx, GstBin* binToWriteTo); -void XAMetadataAdapt_FreeVars(XAMetadataAdaptVars *vars); - -GstElement* XAOutputMixAdapt_GetSink(XAAdaptationBaseCtx* bCtx); - - -XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx, GstElement* usedMix); -XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx); -void* XAAdaptationBase_ContentPipeScrThrFunc( void* arg); -void* XAAdaptationBase_ContentPipeSinkThrFunc( void* arg); -CPresult XAAdaptationBase_ContentPipeSrcCb(CP_EVENTTYPE eEvent, CPuint iParam); -CPresult XAAdaptationBase_ContentPipeSinkCb(CP_EVENTTYPE eEvent, CPuint iParam); - -#endif /* XAADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaadaptationcontextbase.c --- a/khronosfws/openmax_al/src/adaptation/xaadaptationcontextbase.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1924 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "gst/gst.h" -#include "gst/gstbuffer.h" -#include "gst/app/gstappsrc.h" -#include "XAAdaptationContextBase.h" -#include "XAAdaptation.h" -#include "XAObjectItf.h" -#include "XACameraDevice.h" -#include "XARadioDevice.h" -#include "XAOutputMix.h" -#include "XAStaticCapsAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; -/* - * XAAdaptationBaseCtx* XAAdaptationBase_Create() - * 1st phase initialization function for Adaptation Base context structure. - * Reserves memory for base context and initializes GStreamer FW. - */ -XAresult XAAdaptationBase_Init( XAAdaptationBaseCtx* pSelf, XAuint32 ctxId ) -{ - DEBUG_API("->XAAdaptationBase_Init"); - - if ( pSelf ) - { - GError* gerror = 0; - pSelf->pipeSrcThr = NULL; - pSelf->pipeSinkThr = NULL; - - /* Set context id */ - pSelf->ctxId = ctxId; - /* Add default handler for Gst-bus messages */ - pSelf->busCb = XAAdaptationBase_GstBusCb; - - // VASU MOD BEGINS - pSelf->cond_mutx_inited = XA_BOOLEAN_FALSE; - // VASU MOD ENDS - - pSelf->evtHdlrs = g_array_new (FALSE, FALSE, sizeof (XAAdaptEvtHdlr)); - - sem_init(&(pSelf->semAsyncWait),0,0); - - - if ( !gst_init_check( NULL, NULL, &gerror ) ) - { - DEBUG_ERR("Gst Initalization failure."); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Invalid Adaptation Base Context.") - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XAAdaptationBase_Init"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAAdaptationBase_PostInit() - * 2nd phase initialization for Adaptation Base. - */ -XAresult XAAdaptationBase_PostInit( XAAdaptationBaseCtx* ctx ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAAdaptationBase_PostInit"); - // VASU MOD BEGINS - ctx->thread_launched = XA_BOOLEAN_FALSE; - pthread_mutex_init(&(ctx->ds_mutex), NULL); - pthread_cond_init(&(ctx->ds_condition), NULL); - ctx->cond_mutx_inited = XA_BOOLEAN_TRUE; - // VASU MOD ENDS - DEBUG_API("<-XAAdaptationBase_PostInit"); - return ret; -} - -/* - * void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ) - * Frees all Base context variables . - */ -void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ) -{ - GstElement* fakesink = NULL; - DEBUG_API("->XAAdaptationBase_Free"); - - if ( ctx->bin ) - { - fakesink = gst_bin_get_by_name(GST_BIN(ctx->bin), "fakesink"); - if ( fakesink ) - { - gst_element_set_state( GST_ELEMENT(fakesink), GST_STATE_NULL); - gst_object_unref(fakesink); - } - - if ( gst_element_set_state(GST_ELEMENT(ctx->bin), GST_STATE_NULL )!=GST_STATE_CHANGE_SUCCESS ) - { /*not much we can do*/ - DEBUG_ERR("WARNING: Failed to change to NULL state before deletion!!") - } - } - - if(ctx->asynctimer) - { /*cancel timer*/ - g_source_remove(ctx->asynctimer); - } - sem_post(&(ctx->semAsyncWait)); - sem_destroy(&(ctx->semAsyncWait)); - - XAAdaptationBase_StopGstListener(ctx); - - if ( ctx->bin ) - { - gst_object_unref(ctx->bin); - } - - g_array_free(ctx->evtHdlrs, TRUE); - // VASU MOD BEGINS - if (ctx->cond_mutx_inited == XA_BOOLEAN_TRUE) - { - ctx->thread_launched = XA_BOOLEAN_FALSE; - pthread_mutex_destroy(&(ctx->ds_mutex)); - pthread_cond_destroy(&(ctx->ds_condition)); - ctx->cond_mutx_inited = XA_BOOLEAN_FALSE; - } - // VASU MOD ENDS - - DEBUG_API("<-XAAdaptationBase_Free"); -} - -/* - * XAresult XAAdaptationBase_AddEventHandler - * Adds event handler for certain event types. - */ -XAresult XAAdaptationBase_AddEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler, - XAuint32 evtTypes, void *pHandlerCtx ) -{ - XAuint32 i; - XAAdaptEvtHdlr tmp; - DEBUG_API("->XAAdaptationBase_AddEventHandler"); - if(!ctx) - { - DEBUG_ERR("no context"); - return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; ievtHdlrs->len; i++) - { - if( (g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i)).handlerfunc == evtHandler ) - { - return XA_RESULT_PARAMETER_INVALID; - } - } - tmp.handlerfunc = evtHandler; - tmp.handlercontext = pHandlerCtx; - tmp.eventtypes = evtTypes; - g_array_append_val(ctx->evtHdlrs, tmp); - DEBUG_API("<-XAAdaptationBase_AddEventHandler"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAAdaptationBase_RemoveEventHandler - * Removes event handler for certain event types. - */ -XAresult XAAdaptationBase_RemoveEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler) -{ - XAuint32 i; - DEBUG_API("->XAAdaptationBase_RemoveEventHandler"); - if(!ctx) - { - DEBUG_ERR("no context"); - return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; ievtHdlrs->len; i++) - { - if( (g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i)).handlerfunc == evtHandler ) - { - g_array_remove_index(ctx->evtHdlrs, i); - return XA_RESULT_SUCCESS; - } - } - DEBUG_API("<-XAAdaptationBase_RemoveEventHandler"); - /*did not find, return error*/ - return XA_RESULT_PARAMETER_INVALID; -} - -/* - * gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * Default Gst-bus message handler (Callback) - */ -gboolean XAAdaptationBase_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - GError *error; - gchar *debug; - DEBUG_API("->XAAdaptationBase_GstBusCb"); - DEBUG_INFO_A2("Received Gst callback \"%s\" from \"%s\"", - GST_MESSAGE_TYPE_NAME(message), - GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_ERROR: - gst_message_parse_error( message, &error, &debug ); - DEBUG_INFO_A1("%s", debug); - break; - case GST_MESSAGE_EOS: - break; - case GST_MESSAGE_UNKNOWN: - break; - case GST_MESSAGE_WARNING: - break; - case GST_MESSAGE_INFO: - break; - case GST_MESSAGE_TAG: - break; - case GST_MESSAGE_BUFFERING: - break; - case GST_MESSAGE_STATE_CHANGED: - break; - case GST_MESSAGE_STATE_DIRTY: - break; - case GST_MESSAGE_STEP_DONE: - break; - case GST_MESSAGE_CLOCK_PROVIDE: - break; - case GST_MESSAGE_CLOCK_LOST: - break; - case GST_MESSAGE_NEW_CLOCK: - break; - case GST_MESSAGE_STRUCTURE_CHANGE: - break; - case GST_MESSAGE_STREAM_STATUS: - break; - case GST_MESSAGE_APPLICATION: - break; - case GST_MESSAGE_ELEMENT: - break; - case GST_MESSAGE_SEGMENT_START: - break; - case GST_MESSAGE_SEGMENT_DONE: - break; - case GST_MESSAGE_DURATION: - break; - case GST_MESSAGE_LATENCY: - break; - case GST_MESSAGE_ASYNC_START: - break; - case GST_MESSAGE_ASYNC_DONE: - break; - case GST_MESSAGE_ANY: - break; - default: - DEBUG_INFO("Unhandled Gst-Bus message"); - break; - } - DEBUG_API("<-XAAdaptationBase_GstBusCb"); - return TRUE; -} - -XAresult XAAdaptationBase_InitGstListener(XAAdaptationBaseCtx* ctx) -{ - int ret; - DEBUG_API("->XAAdaptationBase_InitGstListener"); - if ( ctx->bin ) - { - ctx->bus = gst_pipeline_get_bus( GST_PIPELINE( ctx->bin )); - } - if( !ctx->bus ) - { - DEBUG_ERR("could not get gst bus!") - return XA_RESULT_INTERNAL_ERROR; - } - ret = pthread_create(&(ctx->busloopThr), NULL, (XAAdaptationBase_LaunchGstListener),(void*)ctx); - // VASU MOD BEGINS - if ( ctx->thread_launched == XA_BOOLEAN_FALSE ) - { - // Wait until the thread is created - pthread_mutex_lock(&(ctx->ds_mutex)); - pthread_cond_wait(&(ctx->ds_condition), &(ctx->ds_mutex)); - pthread_mutex_unlock(&(ctx->ds_mutex)); - // VASU MOD ENDS - } - if(ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - return XA_RESULT_INTERNAL_ERROR; - } - DEBUG_API("<-XAAdaptationBase_InitGstListener"); - return XA_RESULT_SUCCESS; -} - -void * XAAdaptationBase_LaunchGstListener(void* args) -{ - XAAdaptationBaseCtx* ctx = (XAAdaptationBaseCtx*)args; - DEBUG_API("->XAAdaptationBase_LaunchGstListener"); - // VASU MOD BEGINS - // Signal calling thread that this thread creation is completed - ctx->thread_launched = XA_BOOLEAN_TRUE; - pthread_mutex_lock(&(ctx->ds_mutex)); - pthread_cond_signal(&(ctx->ds_condition)); - pthread_mutex_unlock(&(ctx->ds_mutex)); - // VASU MOD ENDS - - ctx->busloop = g_main_loop_new( NULL, FALSE ); - if ( !ctx->busloop ) - { - DEBUG_ERR("Glib main loop failure.") - DEBUG_API("<-XAAdaptationBase_LaunchGstListener"); - assert(0); - } - else - { - DEBUG_INFO("Start Glib main loop") - g_main_loop_run(ctx->busloop); - DEBUG_INFO("Glib main loop stopped - exiting thread") - DEBUG_API("<-XAAdaptationBase_LaunchGstListener"); - pthread_exit(NULL); - } - -} - -void XAAdaptationBase_StopGstListener(XAAdaptationBaseCtx* ctx) -{ - DEBUG_API("->XAAdaptationBase_StopGstListener"); - if(ctx->busloop) - { - g_main_loop_quit (ctx->busloop); - g_main_loop_unref(ctx->busloop); - } - if(ctx->bus) - { - gst_object_unref(ctx->bus); - ctx->bus = NULL; - } - DEBUG_API("<-XAAdaptationBase_StopGstListener"); -} - -void XAAdaptationBase_SendAdaptEvents(XAAdaptationBaseCtx* ctx, XAAdaptEvent* event) -{ - XAuint32 i; - XAAdaptEvtHdlr* tmp; - for(i=0; ievtHdlrs->len; i++) - { - tmp = &g_array_index(ctx->evtHdlrs, XAAdaptEvtHdlr, i); - if( tmp->eventtypes & event->eventtype ) - { - (tmp->handlerfunc)(tmp->handlercontext, event); - } - } -} - -/* - * ASynchronous operation managing - **/ - -/* NOTE: This should NOT be called from gst callbacks - danger of deadlock!! - */ -void XAAdaptationBase_PrepareAsyncWait(XAAdaptationBaseCtx* ctx) -{ - DEBUG_API("->XAAdaptationBase_PrepareAsyncWait"); - - if( ctx->waitingasyncop ) - { /*wait previous async op*/ - DEBUG_INFO("::WARNING:: previous asynch still ongoing!!!"); - DEBUG_INFO(">>>> WAIT PREVIOUS"); - sem_wait(&(ctx->semAsyncWait)); - DEBUG_INFO("<<<< PREVIOUS COMPLETED"); - } - sem_init(&(ctx->semAsyncWait),0,0); - - ctx->waitingasyncop = XA_BOOLEAN_TRUE; - DEBUG_API("<-XAAdaptationBase_PrepareAsyncWait"); -} - -void XAAdaptationBase_StartAsyncWait(XAAdaptationBaseCtx* ctx) -{ - DEBUG_API("->XAAdaptationBase_StartAsyncWait"); - - /* timeout to try to avoid gst freeze in rollup */ - ctx->asynctimer = g_timeout_add(XA_ADAPT_ASYNC_TIMEOUT, - XAAdaptationBase_CancelAsyncWait, ctx); - /* check flag once again if callback already happened before wait */ - if(ctx->waitingasyncop) - { - DEBUG_INFO(">>>> ASYNC STARTS"); - sem_wait(&(ctx->semAsyncWait)); - DEBUG_INFO("<<<< ASYNC COMPLETED"); - } - else - { - DEBUG_INFO("<> async completed already"); - } - /*cancel timer*/ - if(ctx->asynctimer) - { - g_source_remove(ctx->asynctimer); - } - ctx->waitingasyncop = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XAAdaptationBase_StartAsyncWait"); -} - -/* async operation timeout callback*/ -gboolean XAAdaptationBase_CancelAsyncWait(gpointer ctx) -{ - XAAdaptationBaseCtx* bCtx = (XAAdaptationBaseCtx*)ctx; - DEBUG_API("->XAAdaptationBase_CancelAsyncWait"); - if( bCtx->waitingasyncop ) - { - DEBUG_ERR_A3("ASYNC TIMED OUT : current %d, gsttarget %d, wanted %d", - GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - sem_post(&(bCtx->semAsyncWait)); - } - DEBUG_API("<-XAAdaptationBase_CancelAsyncWait"); - /* return false to remove timer */ - return FALSE; -} - -void XAAdaptationBase_CompleteAsyncWait(XAAdaptationBaseCtx* ctx) -{ - DEBUG_API("->XAAdaptationBase_CompleteAsyncWait"); - if( ctx->waitingasyncop ) - { - int i; - ctx->waitingasyncop = XA_BOOLEAN_FALSE; - sem_getvalue(&(ctx->semAsyncWait),&i); - DEBUG_INFO_A1("Asynch operation succeeded, sem value %d",i); - if(i<=0) - { /* only post if locked */ - sem_post(&(ctx->semAsyncWait)); - } - else if(i>0) - { /* should not be, reset semaphore */ - sem_init(&(ctx->semAsyncWait),0,0); - } - } - DEBUG_API("<-XAAdaptationBase_CompleteAsyncWait"); -} - -XAresult XAAdaptationBase_SetCPConfiguration(XAAdaptationBaseCtx* ctx, XAConfigExtensionCpKey configValue) -{ - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("-> XAAdaptationBase_SetConfiguration"); - if( ctx ) - { - if ( configValue == XA_READ ) - { - ctx->pipeSrcThrCtx.cpConfig = configValue; - res = XA_RESULT_SUCCESS; - } - else if ( configValue == XA_READBUFFER ) - { - ctx->pipeSrcThrCtx.cpConfig = configValue; - res = XA_RESULT_SUCCESS; - } - else if ( configValue == XA_WRITE ) - { - ctx->pipeSinkThrCtx.cpConfig = configValue; - res = XA_RESULT_SUCCESS; - } - else if ( configValue == XA_WRITEBUFFER ) - { - ctx->pipeSinkThrCtx.cpConfig = configValue; - res = XA_RESULT_SUCCESS; - } - } - else - { - res = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("-> XAAdaptationBase_SetConfiguration"); - return res; -} - -/** - * GstElement* XAAdaptationBase_CreateGstSource( XADataSource* xaSrc, const XAchar *name ) - * @param XADataSource* xaSnk - XADataSource defining gst source to create - * @param const XAchar *name - string for naming the gst element - * @param XAboolean *isobj - (out param) is source another XA object? - * @return GstElement* - return newly created gst source element - * Description: Create gst source element corresponding to XA source structure - */ -GstElement* XAAdaptationBase_CreateGstSource( XADataSource* xaSrc, const char *name, XAboolean *isobj, XAboolean *isPCM, XAboolean *isRawImage ) -{ - XAuint32 locType = 0; - GstElement* gstSrc = NULL; - char* fname=NULL; - XADataLocator_URI* uri = NULL; - XADataLocator_IODevice* ioDevice = NULL; - XACameraDeviceImpl* cameraDevice = NULL; - XARadioDeviceImpl* radioDevice = NULL; - XAObjectItfImpl* pObj = NULL; - - DEBUG_API("->XAAdaptationBase_CreateGstSource"); - if( !xaSrc || !xaSrc->pLocator || !isobj ) - { - return NULL; - } - *isobj = XA_BOOLEAN_FALSE; - if( xaSrc && xaSrc->pFormat && *((XAuint32*)(xaSrc->pFormat))==XA_DATAFORMAT_PCM && isPCM ) - { - *isPCM = XA_BOOLEAN_TRUE; - } - if( xaSrc && xaSrc->pFormat && *((XAuint32*)(xaSrc->pFormat))==XA_DATAFORMAT_RAWIMAGE && isRawImage ) - { - *isRawImage = XA_BOOLEAN_TRUE; - } - locType = *((XAuint32*)(xaSrc->pLocator)); - switch ( locType ) - { - case XA_DATALOCATOR_URI: - DEBUG_INFO("XA_DATALOCATOR_URI"); - uri = (XADataLocator_URI*)xaSrc->pLocator; - gstSrc = gst_element_factory_make("filesrc",name); - if ( uri->URI != NULL ) - { - DEBUG_INFO_A1("URI: %s", uri->URI); - if(strncmp((char *)uri->URI, "file://", 7) == 0) - { - fname = (char *)&((uri->URI)[7]); - } - else - { - fname = (char *)uri->URI; - } - DEBUG_INFO_A1("->filesystem path %s", fname); - g_object_set( G_OBJECT(gstSrc), "location", fname, NULL ); - /*check for pcm - decodebin does not know how to handle raw PCM files */ - if( isPCM && strstr(fname, ".pcm") ) - { - DEBUG_INFO("PCM file detected"); - *isPCM=XA_BOOLEAN_TRUE; - } - } - else - { - DEBUG_ERR("No uri specified."); - return NULL; - } - break; /* XA_DATALOCATOR_URI */ - - - case XA_DATALOCATOR_IODEVICE: - DEBUG_INFO("XA_DATALOCATOR_IODEVICE"); - ioDevice = (XADataLocator_IODevice*)(xaSrc->pLocator); - switch ( ioDevice->deviceType ) - { - case XA_IODEVICE_AUDIOINPUT: - { - DEBUG_INFO("XA_IODEVICE_AUDIOINPUT"); - DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); - switch (ioDevice->deviceID ) - { - //case XA_ADAPTID_ALSASRC: //Krishna - case XA_ADAPTID_DEVSOUNDSRC: - //DEBUG_INFO("alsasrc"); //Krishna - DEBUG_INFO("devsoundsrc"); - gstSrc = gst_element_factory_make("devsoundsrc",name); //Krishna - changed to devsoundsrc - g_object_set (G_OBJECT (gstSrc), "num-buffers", 80, NULL); - break; - case XA_ADAPTID_AUDIOTESTSRC: - /*fall through*/ - default: - DEBUG_INFO("audiotestsrc"); - gstSrc = gst_element_factory_make("audiotestsrc",name); - break; - } - break; - } - case XA_IODEVICE_CAMERA: - { - DEBUG_INFO("XA_IODEVICE_CAMERA"); - if ( ioDevice->device ) - { /*source is camera object*/ - DEBUG_INFO("Use camerabin as source."); - /* Get camerabin from source object */ - pObj = (XAObjectItfImpl*)(*ioDevice->device); - cameraDevice = (XACameraDeviceImpl*)(pObj); - gstSrc = GST_ELEMENT(cameraDevice->adaptationCtx->bin); - /* refcount increase is needed to keep this not being deleted after use */ - gst_object_ref(GST_OBJECT(gstSrc)); - *isobj = XA_BOOLEAN_TRUE; - } - else - { - DEBUG_INFO_A1("ioDevice->deviceID: %x", ioDevice->deviceID); - switch (ioDevice->deviceID ) - { - case XA_ADAPTID_V4L2SRC: - DEBUG_INFO("Camera deviceID: v4l2src "); - - break; - case XA_ADAPTID_VIDEOTESTSRC: - DEBUG_INFO("Camera deviceID: videotestsrc"); - - break; - default: - case XA_DEFAULTDEVICEID_CAMERA: - DEBUG_INFO("Camera deviceID:Default"); - - break; - } - if ( cameraCtx ) - { - gstSrc = GST_ELEMENT(cameraCtx->baseObj.bin); - gst_object_ref(GST_OBJECT(gstSrc)); - *isobj = XA_BOOLEAN_TRUE; - } - else - { - DEBUG_ERR("No camera object created!"); - return NULL; - } - } - break; - } - case XA_IODEVICE_RADIO: - DEBUG_INFO("XA_IODEVICE_RADIO"); - if ( ioDevice->device ) - { - DEBUG_INFO("Use radio pipeline as source."); - /* Get radio_pipeline and set it to base context */ - radioDevice = (XARadioDeviceImpl*)(*ioDevice->device); - /* radio does not have actual bin, only source element*/ - gstSrc = GST_ELEMENT(radioDevice->adaptationCtx->bin); - /* refcount increase is needed to keep this not being deleted after use */ - gst_object_ref(GST_OBJECT(gstSrc)); - /**isobj = XA_BOOLEAN_TRUE;*/ - } - break; - default: - { - DEBUG_ERR("Unsupported IODevice."); - return NULL; - break; - } - } - break; /* XA_DATALOCATOR_IODEVICE */ - - case XA_DATALOCATOR_CONTENTPIPE: - { - DEBUG_INFO("XA_DATALOCATOR_CONTENTPIPE"); - gstSrc = gst_element_factory_make("appsrc",name); - break; - } - case XA_DATALOCATOR_ADDRESS: - { - XADataLocator_Address* address = (XADataLocator_Address*)(xaSrc->pLocator); - gstSrc = gst_element_factory_make("appsrc", name); - /* init gst buffer from datalocator */ - if( gstSrc ) - { - /* init GST buffer from XADataLocator*/ - GstBuffer* userBuf = gst_buffer_new(); - if( userBuf ) - { - userBuf->size = address->length; - userBuf->data = address->pAddress; - /* push the whole buffer to appsrc so it is ready for preroll */ - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(gstSrc), userBuf ); - DEBUG_INFO_A1("Sent buffer at 0x%x to appsrc", userBuf ); - gst_app_src_end_of_stream( GST_APP_SRC(gstSrc) ); - } - else - { - DEBUG_ERR("Failure allocating buffer!"); - } - } - else - { - DEBUG_ERR("Failure creating appsrc!"); - } - } - break; - - default: - DEBUG_ERR("Incorrect data locator for source.") - return NULL; - break; - } - - if ( gstSrc ) - { - DEBUG_INFO_A1("Created gstreamer source element at %x", gstSrc); - } - - DEBUG_API("<-XAAdaptationBase_CreateGstSource"); - return gstSrc; -} - - -/** - * GstElement* XAAdaptationBase_CreateGstSink( XADataSink* xaSnk, const XAchar *name ) - * @param XADataSink* xaSnk - XADataSink defining gst sink to create - * @param const XAchar *name - string for naming the gst element - * @return GstElement* - return newly created gst sink element - * Description: Create gst sink element corresponding to XA sink structure - */ -GstElement* XAAdaptationBase_CreateGstSink( XADataSink* xaSnk, const char *name, XAboolean *isobj ) -{ - XAuint32 locType = 0; - GstElement* gstSnk = NULL; - XADataLocator_URI* uri = NULL; - DEBUG_API("->XAAdaptationBase_CreateGstSink"); - if(!xaSnk || !xaSnk->pLocator) - { - DEBUG_INFO("Warning! No sink specified, use fakesink"); - gstSnk = gst_element_factory_make("fakesink",name); - if(!gstSnk) - { - DEBUG_ERR("Cannot create sink!"); - return NULL; - } - g_object_set( G_OBJECT(gstSnk),"async", FALSE, NULL); - } - else - { - locType = *((XAuint32*)(xaSnk->pLocator)); - switch ( locType ) - { - case XA_DATALOCATOR_URI: - DEBUG_INFO("XA_DATALOCATOR_URI"); - uri = (XADataLocator_URI*)xaSnk->pLocator; - gstSnk = gst_element_factory_make("filesink",name); - if(!gstSnk) - { - DEBUG_ERR("Cannot create sink!"); - return NULL; - } - if ( uri->URI != NULL ) - { - XAchar *fname; - DEBUG_INFO_A1("URI: %s", uri->URI); - if(strncmp((char *)uri->URI, "file://", 7) == 0) - { - fname = &((uri->URI)[7]); - } - else - { - fname = uri->URI; - } - DEBUG_INFO_A1("->filesystem path %s", fname); - g_object_set( G_OBJECT(gstSnk),"location", fname, - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - NULL); - } - else - { - DEBUG_ERR("No recording output uri specified."); - return NULL; - } - break; - case XA_DATALOCATOR_NATIVEDISPLAY: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_NATIVEDISPLAY"); -#ifdef USE_NGA_SURFACES - gstSnk = gst_element_factory_make("devvideosink","devvideosink"); -#else - gstSnk = gst_element_factory_make("ximagesink",name); -#endif /*USE_NGA_SURFACES*/ - if(!gstSnk) - { - DEBUG_ERR("Cannot create sink!"); - return NULL; - } - g_object_set( G_OBJECT(gstSnk), "force-aspect-ratio", TRUE, - "async", FALSE, - "qos", FALSE, - "handle-events", TRUE, - "handle-expose", TRUE, - "max-lateness", (gint64)(-1), - NULL); - break; - case XA_DATALOCATOR_OUTPUTMIX: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX"); - { - /* Get OutputMix adaptation from data locator */ - XADataLocator_OutputMix* omix = (XADataLocator_OutputMix*)(xaSnk->pLocator); - if ( omix->outputMix ) - { - XAOMixImpl* omixDevice = (XAOMixImpl*)(*omix->outputMix); - - if(omixDevice) - { - gstSnk = XAOutputMixAdapt_GetSink(omixDevice->adaptationCtx); - if(!gstSnk) - { - DEBUG_ERR("Cannot create sink!"); - return NULL; - } - *isobj = XA_BOOLEAN_TRUE; - } - else - { - DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); - gstSnk = gst_element_factory_make("alsasink",name); - } - } - else - { - DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); - gstSnk = gst_element_factory_make("alsasink",name); - } - - } - break; - case XA_DATALOCATOR_CONTENTPIPE: - DEBUG_INFO("XA_DATALOCATOR_CONTENTPIPE"); - gstSnk = gst_element_factory_make("appsink",name); - break; - case XA_DATALOCATOR_ADDRESS: - { - gstSnk = gst_element_factory_make("appsink", name); - /* Not actually object sink, but attribute used to notify recorder - * about appsink (no object sinks applicable in this use case) - **/ - *isobj=TRUE; - } - break; - case XA_DATALOCATOR_IODEVICE: - /* when only valid IOdevice sinks vibra and LED sinks implemented - * at adaptation level, add handling here (in this implementation, - * no handling needed as only dummy implementations for those) - **/ - default: - DEBUG_ERR("Incorrect data locator for sink.") - return NULL; - break; - } - } - if (gstSnk ) - { - DEBUG_INFO_A1("Created gstreamer sink element at %x", gstSnk); - } - DEBUG_API("<-XAAdaptationBase_CreateGstSink"); - return gstSnk; -} - -/** - * GstElement* XAAdaptationBase_CreateVideoPP( ) - * @return GstElement* - return newly created gst pipeline element - * Description: Create video processing pipeline - */ -GstElement* XAAdaptationBase_CreateVideoPP( ) -{ - GstElement *vpp; - DEBUG_API("->XAAdaptationBase_CreateVideoPP"); - vpp = gst_pipeline_new("videopp"); - if( vpp ) - { - GstPad *ghostsink, *ghostsrc; - GstElement *col1, - *col2, - *rotate, - *mirror, - *box, - *crop, - *gamma, - *balance, - *scale, - *scale2, -#ifdef USE_NGA_SURFACES - *identity, -#endif /*USE_NGA_SURFACES*/ - *queue; - - - /* Crete ffmpegcolorspace to convert stream to correct format */ - col1 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp1"); - if(col1) - { - DEBUG_INFO("Created ffmpegcolorspace element"); - gst_bin_add(GST_BIN(vpp), col1); - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(col1,"sink"); - if(ghostsink) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - } - - /* create video crop, this will be sink for videoPP pipeline */ - crop = gst_element_factory_make( "videocrop", "pp_crop"); - if(crop) - { - DEBUG_INFO("Created crop element"); - gst_bin_add(GST_BIN(vpp), crop); - } - - /* create video rotate */ - rotate = gst_element_factory_make( "videoflip", "pp_rotate"); - if(rotate) - { - DEBUG_INFO("Created rotate element"); - g_object_set(G_OBJECT(rotate), "method", FLIP_NONE, NULL); - gst_bin_add(GST_BIN(vpp), rotate); - } - - /* create video mirror */ - mirror = gst_element_factory_make( "videoflip", "pp_mirror"); - if(mirror) - { - DEBUG_INFO("Created mirror element"); - g_object_set(G_OBJECT(mirror), "method", FLIP_NONE, NULL); - gst_bin_add(GST_BIN(vpp), mirror); - } - - /* create video box */ - box = gst_element_factory_make( "videobox", "pp_box"); - if(box) - { - DEBUG_INFO("Created videobox element"); - gst_bin_add(GST_BIN(vpp), box); - } - - /* create video balance */ - balance = gst_element_factory_make( "videobalance", "pp_balance"); - if(balance) - { - DEBUG_INFO("Created balance element"); - gst_bin_add(GST_BIN(vpp), balance); - } - - /* create video gamma */ - gamma = gst_element_factory_make( "gamma", "pp_gamma"); - if(gamma) - { - DEBUG_INFO("Created gamma element"); - gst_bin_add(GST_BIN(vpp), gamma); - } - - /* Create videoscale element to scale postprocessed output to correct size */ - scale = gst_element_factory_make("videoscale", "pp_scale"); - if ( scale ) - { - DEBUG_INFO("Created videoscale element"); - gst_bin_add(GST_BIN(vpp), scale); - } - scale2 = gst_element_factory_make("videoscale", "pp_scale2"); - if ( scale2 ) - { - GstPad *pad = NULL; - GstCaps *caps = NULL; - DEBUG_INFO("Created videoscale element"); - pad = gst_element_get_static_pad(scale2,"src"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - gst_bin_add(GST_BIN(vpp), scale2); - } - - /* create video queue */ - queue = gst_element_factory_make( "queue", "vpp_queue"); - if(queue) - { - DEBUG_INFO("Created queue element"); - gst_bin_add(GST_BIN(vpp), queue); -#ifdef USE_NGA_SURFACES - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(queue,"sink"); - if(ghostsink) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } -#endif /*USE_NGA_SURFACES*/ - } - - - /* Crete ffmpegcolorspace to convert stream to correct format */ - col2 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp2"); - if(col2) - { - DEBUG_INFO("Created ffmpegcolorspace element"); - gst_bin_add(GST_BIN(vpp), col2); - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(col2,"src"); - if(ghostsrc) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - } - -#ifdef USE_NGA_SURFACES - //shyward - /* create identity element */ - identity = gst_element_factory_make( "identity", "identity" ); - if(identity) - { - DEBUG_INFO("Created identity element"); - gst_bin_add(GST_BIN(vpp), identity); - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(identity,"src"); - if(ghostsrc) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - } - if( !(gst_element_link_many(queue,identity,NULL)) ) -#else - //shyward - thins code assumes all the elements will have been created, which is not true - if( !(gst_element_link_many(col1, - scale, - crop, - rotate, - mirror, - box, - balance, - gamma, - queue, - scale2, -#ifdef USE_NGA_SURFACES - identity, -#endif /*USE_NGA_SURFACES*/ - col2, - NULL) - ) ) -#endif /*USE_NGA_SURFACES*/ - { - DEBUG_ERR("Could not link videopp elements!!"); - gst_object_unref(vpp); - vpp = NULL; - } - } - DEBUG_API("<-XAAdaptationBase_CreateVideoPP"); - return vpp; -} - -/** - * GstElement* XAAdaptationBase_CreateFixedSizeRecordVideoPP( ) - * @return GstElement* - return newly created gst pipeline element - * Description: Create video processing pipeline with fixed output size to TEST_VIDEO_WIDTH x TEST_VIDEO_HEIGHT - * experimental implementation for changing recorder output size - */ -GstElement* XAAdaptationBase_CreateFixedSizeVideoPP( ) -{ - GstElement *vpp; - DEBUG_API("->XAAdaptationBase_CreateFixedSizeVideoPP"); - vpp = gst_pipeline_new("videopp"); - if( vpp ) - { - GstPad *ghostsink, *ghostsrc; - GstElement *col1, - *col2, - *rotate, - *mirror, - *box, - *crop, - *gamma, - *balance, - *scale, - *scale2, - *filter, - *queue; - - - /* Crete ffmpegcolorspace to convert stream to correct format */ - col1 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp1"); - if(col1) - { - DEBUG_INFO("Created ffmpegcolorspace element"); - gst_bin_add(GST_BIN(vpp), col1); - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(col1,"sink"); - if(ghostsink) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - } - - /* create video crop, this will be sink for videoPP pipeline */ - crop = gst_element_factory_make( "videocrop", "pp_crop"); - if(crop) - { - DEBUG_INFO("Created crop element"); - gst_bin_add(GST_BIN(vpp), crop); - } - - /* create video rotate */ - rotate = gst_element_factory_make( "videoflip", "pp_rotate"); - if(rotate) - { - DEBUG_INFO("Created rotate element"); - g_object_set(G_OBJECT(rotate), "method", FLIP_NONE, NULL); - gst_bin_add(GST_BIN(vpp), rotate); - } - - /* create video mirror */ - mirror = gst_element_factory_make( "videoflip", "pp_mirror"); - if(mirror) - { - DEBUG_INFO("Created mirror element"); - g_object_set(G_OBJECT(mirror), "method", FLIP_NONE, NULL); - gst_bin_add(GST_BIN(vpp), mirror); - } - - /* create video box */ - box = gst_element_factory_make( "videobox", "pp_box"); - if(box) - { - DEBUG_INFO("Created videobox element"); - gst_bin_add(GST_BIN(vpp), box); - } - - /* create video balance */ - balance = gst_element_factory_make( "videobalance", "pp_balance"); - if(balance) - { - DEBUG_INFO("Created balance element"); - gst_bin_add(GST_BIN(vpp), balance); - } - - /* create video gamma */ - gamma = gst_element_factory_make( "gamma", "pp_gamma"); - if(gamma) - { - DEBUG_INFO("Created gamma element"); - gst_bin_add(GST_BIN(vpp), gamma); - } - - /* Create videoscale element to scale postprocessed output to correct size */ - scale = gst_element_factory_make("videoscale", "pp_scale"); - if ( scale ) - { - DEBUG_INFO("Created videoscale element"); - gst_bin_add(GST_BIN(vpp), scale); - } - scale2 = gst_element_factory_make("videoscale", "pp_scale2"); - if ( scale2 ) - { - GstPad *pad = NULL; - GstCaps *caps = NULL; - DEBUG_INFO("Created videoscale element"); - pad = gst_element_get_static_pad(scale2,"src"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - gst_bin_add(GST_BIN(vpp), scale2); - } - - /* create capsfilter for fixed video size */ - filter = gst_element_factory_make("capsfilter", "pp_filter"); - if ( filter ) - { - - g_object_set( G_OBJECT(filter), "caps", - gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, TEST_VIDEO_WIDTH, - "height", G_TYPE_INT, TEST_VIDEO_HEIGHT, NULL) - ,NULL ); - gst_bin_add(GST_BIN(vpp), filter); - } - - /* create video queue */ - queue = gst_element_factory_make( "queue", "vpp_queue"); - if(queue) - { - gst_bin_add(GST_BIN(vpp), queue); - } - - - /* Crete ffmpegcolorspace to convert stream to correct format */ - col2 = gst_element_factory_make( "ffmpegcolorspace", "pp_colsp2"); - if(col2) - { - DEBUG_INFO("Created ffmpegcolorspace element"); - gst_bin_add(GST_BIN(vpp), col2); - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(col2,"src"); - if(ghostsrc) - { - gst_element_add_pad(vpp, gst_ghost_pad_new("videopp_src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - } - if( !(gst_element_link_many(col1, - scale, - crop, - rotate, - mirror, - box, - balance, - gamma, - queue, - scale2, - filter, - col2, - NULL) - ) ) - { - DEBUG_ERR("Could not link videopp elements!!"); - gst_object_unref(vpp); - vpp = NULL; - } - } - DEBUG_API("<-XAAdaptationBase_CreateFixedSizeVideoPP"); - return vpp; -} - - - -/** - * GstElement* XAAdaptationBase_CreateVideoPPBlackScr( ) - * @return GstElement* - return newly created gst pipeline element - * Description: Create video processing pipeline for black screen - */ -GstElement* XAAdaptationBase_CreateVideoPPBlackScr( ) -{ - GstElement *vppBScr; - DEBUG_API("->XAAdaptationBase_CreateVideoPPBlackScr"); - vppBScr = gst_pipeline_new("videoppBScr"); - if( vppBScr ) - { - GstPad *ghostsrc=NULL; - GstElement *testVideo=NULL, *scale=NULL; - GstElement *ffmpegcolorspace=NULL; - - testVideo = gst_element_factory_make( "videotestsrc", "videotest"); - if(testVideo) - { - DEBUG_INFO("Created videotestsrc element"); - - g_object_set(G_OBJECT(testVideo), "pattern", (gint)2, "num-buffers", (gint)1, NULL); - gst_bin_add(GST_BIN(vppBScr), testVideo); - } - - scale = gst_element_factory_make("videoscale", "BSrc_scale"); - if(scale) - { - DEBUG_INFO("Created videoscale element"); - gst_bin_add(GST_BIN(vppBScr), scale); - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(scale,"src"); - if(ghostsrc) - { - gst_element_add_pad(vppBScr, gst_ghost_pad_new("videoppBSrc_src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - } - ffmpegcolorspace = gst_element_factory_make("ffmpegcolorspace", "BlackScrFfmpeg"); - gst_bin_add(GST_BIN(vppBScr), ffmpegcolorspace); - if( !(gst_element_link_many(testVideo, ffmpegcolorspace, scale, NULL)) ) - { - DEBUG_ERR("Could not link videoppBSrc elements!!"); - gst_object_unref(vppBScr); - vppBScr = NULL; - } - } - DEBUG_API("<-XAAdaptationBase_CreateVideoPPBlackScr"); - return vppBScr; -} - -/** - * GstElement* XAAdaptationBase_CreateInputSelector( ) - * @return GstElement* - return newly created input selector - * Description: Create input selector to processing between black screen and video screen - */ -GstElement* XAAdaptationBase_CreateInputSelector( ) -{ - GstElement *inputSelector; - DEBUG_API("->XAAdaptationBase_CreateInputSelector"); - inputSelector = gst_element_factory_make("input-selector", "input-selector"); - if( inputSelector ) - { - g_object_set(G_OBJECT(inputSelector), "select-all", TRUE, NULL); - } - DEBUG_API("<-XAAdaptationBase_CreateInputSelector"); - return inputSelector; -} - -/** - * GstElement* XAAdaptationBase_CreateAudioPP( ) - * @return GstElement* - return newly created gst pipeline element - * Description: Create video processing pipeline - */ -GstElement* XAAdaptationBase_CreateAudioPP( ) -{ - GstElement *app; - gboolean ok = TRUE; - DEBUG_API("->XAAdaptationBase_CreateAudioPP"); - app = gst_pipeline_new("audiopp"); - if( app ) - { - GstPad *ghostsink, *ghostsrc; - GstElement *ac,*vol,*eq,*queue,*pan, *ac2; - - /* first and last elements should be audioconverts to match sink and encoder formats */ - ac = gst_element_factory_make( "audioconvert", "pp_ac"); - if (ac) - { - ok = gst_bin_add(GST_BIN(app), ac); - /* make this bin link point*/ - if (ok) - { - ghostsink = gst_element_get_static_pad(ac,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - } - ac2 = gst_element_factory_make( "audioconvert", "pp_ac2"); - if (ac2 && ok) - { - ok = gst_bin_add(GST_BIN(app), ac2); - /* make this bin link point*/ - if (ok) - { - ghostsrc = gst_element_get_static_pad(ac2,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - } - - vol = gst_element_factory_make( "volume", "pp_vol"); - /* create volume controller */ - if (vol && ok) - { - ok = gst_bin_add(GST_BIN(app), vol); - g_object_set( G_OBJECT(vol), "volume", (gdouble)1, NULL ); - } - /* create 10-band equalizer */ - eq = gst_element_factory_make( "equalizer-10bands", "pp_equ"); - if (eq && ok) - { - ok = gst_bin_add(GST_BIN(app), eq); - } - /* create audio queue */ - queue = gst_element_factory_make( "queue", "app_queue"); - if(queue && ok) - { - ok = gst_bin_add(GST_BIN(app), queue); - g_object_set (G_OBJECT (queue), "max-size-buffers", 2, NULL); - } - /* create audio pan effect */ - pan = gst_element_factory_make( "audiopanorama", "pp_pan"); - if (pan && ok) - { - ok = gst_bin_add(GST_BIN(app), pan); - } - - if (ac && ok) - { - if (queue) - { - ok = gst_element_link(ac, queue); - } - else if (vol) - { - ok = gst_element_link(ac, vol); - } - else if (pan) - { - ok = gst_element_link(ac, pan); - } - else if (eq) - { - ok = gst_element_link(ac, eq); - } - else if (ac2) - { - ok = gst_element_link(ac, ac2); - } - } - if (queue && ok) - { - if (vol) - { - ok = gst_element_link(queue, vol); - } - else if (pan) - { - ok = gst_element_link(queue, pan); - } - else if (eq) - { - ok = gst_element_link(queue, eq); - } - else if (ac2) - { - ok = gst_element_link(queue, ac2); - } - } - if (vol && ok) - { - if (pan) - { - ok = gst_element_link(vol, pan); - } - else if (eq) - { - ok = gst_element_link(vol, eq); - } - else if (ac2) - { - ok = gst_element_link(vol, ac2); - } - } - if (pan && ok) - { - if (eq) - { - ok = gst_element_link(pan, eq); - } - else if (ac2) - { - ok = gst_element_link(pan, ac2); - } - } - if (eq && ok) - { - if (ac2) - { - ok = gst_element_link(eq, ac2); - } - } - - if (ac) - { - // ghost sink above - } - else if (queue && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(queue,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (vol && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(vol,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (pan && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(pan,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (eq && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(eq,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - else if (ac2 && ok) - { - /* make this bin link point*/ - ghostsink = gst_element_get_static_pad(ac2,"sink"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("sink",ghostsink)); - gst_object_unref(GST_OBJECT(ghostsink)); - } - - if (ac2) - { - // ghost src above - } - else if (eq && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(eq,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (pan && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(pan,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (vol && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(vol,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (queue && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(queue,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - else if (ac && ok) - { - /* make this bin link point*/ - ghostsrc = gst_element_get_static_pad(ac,"src"); - ok = gst_element_add_pad(app, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - -// if( !(gst_element_link_many(ac, queue, vol, ac2, NULL)) ) -// if( !(gst_element_link_many(ac, queue, vol, pan, eq, ac2, NULL)) ) - if (!ok) - { - DEBUG_ERR("Could not link audiopp elements!!"); - gst_object_unref(app); - app = NULL; - } - } - - DEBUG_API("<-XAAdaptationBase_CreateAudioPP"); - return app; -} - -/* called when pad is actually blocking/ gets unblocked*/ -void XAAdaptationBase_PadBlockCb(GstPad *pad, gboolean blocked, gpointer user_data) -{ - DEBUG_API_A2("->XAAdaptationBase_PadBlockCb pad \"%s\" of \"%s\" ", - GST_OBJECT_NAME(pad), - GST_OBJECT_NAME(gst_pad_get_parent_element(pad)) ); - DEBUG_API_A1("<-XAAdaptationBase_PadBlockCb blocked:%d",blocked); -} - -/* utility to set same fields for all media types in caps */ -void XAAdaptationBase_SetAllCaps (GstCaps * caps, char *field, ...) -{ - GstStructure *structure; - va_list var_args; - int i; - - for (i = 0; i < gst_caps_get_size (caps); i++) - { - structure = gst_caps_get_structure (caps, i); - va_start (var_args, field); - gst_structure_set_valist (structure, field, var_args); - va_end (var_args); - } -} - -/* - * void* XAAdaptationBase_ContentPipeScrThrFunc( void* arg ) - */ -void* XAAdaptationBase_ContentPipeScrThrFunc( void* arg ) -{ - XAAdaptCpThrCtx* thrCtx = (XAAdaptCpThrCtx*)arg; - XAresult ret; - CPresult cpRet; - XAuint32 requestedBytes = CONTENT_PIPE_BUFFER_SIZE; - CP_CHECKBYTESRESULTTYPE eResult; - - DEBUG_API("->XAAdaptationBase_ContentPipeScrThrFunc"); - - - /* Wait until playstate is changed */ - ret = XAImpl_WaitSemaphore( thrCtx->stateSem ); - if ( ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Could not start semaphore"); - } - - thrCtx->state = CPStateRunning; - - do - { - GstBuffer *buffer = NULL; /* Gstreamer buffer */ - - if ( thrCtx->state == CPStatePaused ) - { - /* Wait until playstate is changed */ - ret = XAImpl_WaitSemaphore( thrCtx->stateSem ); - if ( ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Could not start semaphore"); - thrCtx->state = CPStateError; - break; - } - } - - if ( thrCtx->state == CPStateWaitForData ) - { - } - /* Check do we have enough bytes in pipe */ - cpRet = thrCtx->pipe->pContentPipe->CheckAvailableBytes(&(thrCtx->dataHandle), requestedBytes, &eResult); - if ( cpRet != EXIT_SUCCESS ) - { - thrCtx->state = CPStateError; - } - - if ( eResult == CP_CheckBytesOk) - { /* We have enough bytes in content pipe */ - thrCtx->state = CPStateRunning; - DEBUG_API("CP_CheckBytesOk"); - - if ( thrCtx->cpConfig == XA_READ ) - { /* OMX-AL implementation allocates buffers */ - - /* Pointer to OMX-AL RI allocated data */ - gpointer cpBuffer = NULL; - - /* Allocate new buffer with preferred size */ - cpBuffer = g_malloc0(requestedBytes ); - cpRet = thrCtx->pipe->pContentPipe->Read( &(thrCtx->dataHandle), (CPbyte*)cpBuffer, requestedBytes ); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not read data from content pipe!"); - thrCtx->state = CPStateError; - break; - } - else - { - DEBUG_INFO_A1("Readed %u bytes", requestedBytes ); - /* Create gstBuffer, GStreamer frees data */ - buffer = gst_app_buffer_new( (void*)cpBuffer, requestedBytes, g_free, cpBuffer ); - if ( !buffer ) - { - DEBUG_ERR("Could not allocate buffer for content pipe source!"); - thrCtx->state = CPStateError; - break; - } - } - } - else - { /* Content pipe implementation allocates buffers */ - gpointer pipeBuffer = NULL; - gpointer omxBuffer = NULL; - - cpRet = thrCtx->pipe->pContentPipe->ReadBuffer( &(thrCtx->dataHandle), (CPbyte**)&pipeBuffer, &requestedBytes, FALSE); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not read data from content pipe!"); - thrCtx->state = CPStateError; - break; - } - else - { - DEBUG_INFO_A1("Readed %u bytes", requestedBytes ); - /* Copy pipe allocated data into own buffer */ - omxBuffer = g_malloc0(requestedBytes ); - memcpy( omxBuffer, pipeBuffer, requestedBytes ); - - /* Create gstBuffer, GStreamer frees data */ - buffer = gst_app_buffer_new( omxBuffer, requestedBytes, g_free, omxBuffer ); - if ( !buffer ) - { - DEBUG_ERR("Could not allocate buffer for content pipe source!"); - thrCtx->state = CPStateError; - break; - } - /* Release readbuffer */ - cpRet = thrCtx->pipe->pContentPipe->ReleaseReadBuffer( &(thrCtx->dataHandle), (CPbyte*)pipeBuffer ); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not release readbuffer!"); - thrCtx->state = CPStateError; - break; - } - pipeBuffer = NULL; - - } - } - if ( cpRet == EXIT_SUCCESS ) - { - if( buffer ) - { - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(thrCtx->appSrc), GST_BUFFER(buffer) ); - } - } - } - else if ( eResult == CP_CheckBytesNotReady ) - { - DEBUG_API("CP_CheckBytesNotReady"); - thrCtx->state = CPStateWaitForData; - } - else if ( eResult == CP_CheckBytesInsufficientBytes ) - { - DEBUG_API("CP_CheckBytesInsufficientBytes"); - if ( requestedBytes > 0 ) - { - requestedBytes = requestedBytes - 1 ; - } - else - { - thrCtx->state = CPStateError; - } - } - else if ( eResult == CP_CheckBytesAtEndOfStream) - { - DEBUG_API("XAAdaptationBase_ContentPipeScrThrFunc-> CP_CheckBytesAtEndOfStream"); - thrCtx->state = CPStateEOS; - } - }while (thrCtx->state == CPStateRunning || thrCtx->state == CPStateWaitForData || thrCtx->state == CPStatePaused ); - - if ( thrCtx->state == CPStateError ) - { - /* If error goto beginning of content */ - cpRet = thrCtx->pipe->pContentPipe->SetPosition( &(thrCtx->dataHandle),0, CP_OriginBegin); - } - else if ( thrCtx->state == CPStateEOS ) - { - /* Send EOS to appSrc */ - gst_app_src_end_of_stream( GST_APP_SRC(thrCtx->appSrc) ); - /* Set position to beginning */ - cpRet = thrCtx->pipe->pContentPipe->SetPosition( &(thrCtx->dataHandle),0, CP_OriginBegin); - } - else if ( thrCtx->state == CPStateStopped ) - { - cpRet = thrCtx->pipe->pContentPipe->SetPosition( &(thrCtx->dataHandle),0, CP_OriginBegin); - } - - thrCtx->state = CPStateInitialized; - - DEBUG_API("<-XAAdaptationBase_ContentPipeScrThrFunc"); - return NULL; -} - -/* - * void* XAAdaptationBase_ContentPipeSinkThrFunc( void* arg ) - */ -void* XAAdaptationBase_ContentPipeSinkThrFunc( void* arg ) -{ - XAAdaptCpThrCtx* thrCtx = (XAAdaptCpThrCtx*)arg; - XAresult ret; - CPresult cpRet; - XAboolean paused; - XAuint32 position = 0; - - DEBUG_API("->XAAdaptationBase_ContentPipeSinkThrFunc"); - - thrCtx->state = CPStateStarted; - - /* Wait until recordstate is changed */ - ret = XAImpl_WaitSemaphore( thrCtx->stateSem ); - if ( ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Could not start semaphore"); - } - thrCtx->state = CPStateRunning; - - do - { - GstBuffer *buffer; - - if ( thrCtx->state == CPStatePaused ) - { - /*If paused get position from end of the file*/ - paused = XA_BOOLEAN_TRUE; - DEBUG_API("Get New position"); - cpRet = thrCtx->pipe->pContentPipe->GetPosition(&(thrCtx->dataHandle), &position); - cpRet = thrCtx->pipe->pContentPipe->SetPosition(&(thrCtx->dataHandle), (CPint)position, CP_OriginEnd); - /* Wait until playstate is changed */ - ret = XAImpl_WaitSemaphore( thrCtx->stateSem ); - if ( ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Could not start waiting content pipe state semaphore"); - thrCtx->state = CPStateError; - break; - } - } - - buffer = gst_app_sink_pull_buffer(GST_APP_SINK(thrCtx->appSink) ); - if ( !buffer ) - { - DEBUG_INFO("No buffer in gstAppSink!") - if ( gst_app_sink_is_eos( thrCtx->appSink) ) - { - DEBUG_API("XAAdaptationBase_ContentPipeSinkThrFunc-> CPStateEOS") - thrCtx->state = CPStateEOS; - } - continue; - } - - if ( thrCtx->cpConfig == XA_WRITE ) - { /* OMX-AL implementation allocates buffers */ - - /* Write data to content pipe */ - cpRet = thrCtx->pipe->pContentPipe->Write( &(thrCtx->dataHandle), (CPbyte *)GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer) ); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not write data to content pipe!"); - thrCtx->state = CPStateError; - break; - } - } - else - { /* Use content pipe allocated buffers */ - - gpointer cpBuffer = NULL; - - /* Request buffer from content pipe with gst-buffer size */ - cpRet = thrCtx->pipe->pContentPipe->GetWriteBuffer( &(thrCtx->dataHandle), (CPbyte**)&cpBuffer, GST_BUFFER_SIZE(buffer) ); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not get write buffer from content pipe!"); - thrCtx->state = CPStateError; - break; - } - - /* Copy data from gst-buffer to content pipe buffer */ - memcpy( cpBuffer,GST_BUFFER_DATA(buffer),GST_BUFFER_SIZE(buffer)); - - /* Write buffer to content pipe */ - cpRet = thrCtx->pipe->pContentPipe->WriteBuffer( &(thrCtx->dataHandle), cpBuffer, GST_BUFFER_SIZE(buffer) ); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not write buffer to content pipe!"); - thrCtx->state = CPStateError; - break; - } - - g_free(cpBuffer); - cpBuffer = NULL; - } - - if ( gst_app_sink_is_eos( thrCtx->appSink) ) - { - thrCtx->state = CPStateEOS; - } - - }while (thrCtx->state == CPStateRunning || thrCtx->state == CPStatePaused ); - - if ( thrCtx->state == CPStateError ) - { - /* If error goto beginning of content */ - cpRet = thrCtx->pipe->pContentPipe->SetPosition( &(thrCtx->dataHandle),0, CP_OriginBegin); - } - else if ( thrCtx->state == CPStateStopped ) - { - cpRet = thrCtx->pipe->pContentPipe->SetPosition( &(thrCtx->dataHandle),0, CP_OriginBegin); - } - - DEBUG_API("<-XAAdaptationBase_ContentPipeSinkThrFunc"); - return NULL; -} - -/* - * CPresult XAAdaptationBase_ContentPipeSrcCb(CP_EVENTTYPE eEvent, CPuint iParam) - * Description: Callback function for content pipe source - * @param: CP_EVENTTYPE eEvent - Callback event - * @param: CPuint iParam - Param related to event - * - * No actual functionality can be handled in callback, since current - * Content Pipe specification lacks methods of supplying client context and/or - * reference to context pipe handle with CP callback. - * Khronos group is in progress on proposals for extending this functionality. - * - */ -CPresult XAAdaptationBase_ContentPipeSrcCb(CP_EVENTTYPE eEvent, CPuint iParam) -{ - XAresult ret = XA_RESULT_SUCCESS; - switch (eEvent ) - { - case CP_BytesAvailable: - /* Restart reading thread */ - break; - case CP_Overflow: - /* Handle error */ - break; - case CP_PipeDisconnected: - /* Reconnect pipe */ - case CP_EventMax: - break; - default: - break; - } - return ret; -} - -/* - * CPresult XAAdaptationBase_ContentPipeSinkCb(CP_EVENTTYPE eEvent, CPuint iParam) - * Description: Callback function for content pipe sink - * @param: CP_EVENTTYPE eEvent - Callback event - * @param: CPuint iParam - Param related to event - * - * No actual functionality can be handled in callback, since current - * Content Pipe specification lacks methods of supplying client context and/or - * reference to context pipe handle with CP callback. - * Khronos group is in progress on proposals for extending this functionality. - * - */ -CPresult XAAdaptationBase_ContentPipeSinkCb(CP_EVENTTYPE eEvent, CPuint iParam) -{ - XAresult ret = XA_RESULT_SUCCESS; - switch (eEvent ) - { - case CP_BytesAvailable: - /*Restart write thread.*/ - break; - case CP_Overflow: - /*Handle error */ - break; - case CP_PipeDisconnected: - /*Reconnect pipe */ - default: - break; - } - return ret; - -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaadaptationcontextbase.h --- a/khronosfws/openmax_al/src/adaptation/xaadaptationcontextbase.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAADAPTATIONCONTEXTBASE_H -#define XAADAPTATIONCONTEXTBASE_H - -#include -#include "XAGlobals.h" -#include "openmaxalwrapper.h" -#include "OpenMAXAL_ContentPipe.h" -#include "XAPlatform.h" - -/* ENUMERATIONS */ - -typedef enum { - XAMediaPlayerAdaptation = 0, - XAMediaRecorderAdaptation, - XARadioAdaptation, - XACameraAdaptation, - XAOutputMixAdaptation, - XAVibraAdaptation, - XALedArrayAdaptation, - XAMDAdaptation, - XAEngineAdaptation -}AdaptationContextIDS; - -/** - * enumeration for different adaptation event types. - * add more types when needed, use single bit values. - **/ -typedef enum { - XA_GENERICEVENTS = 0x1, - XA_PLAYITFEVENTS = 0x2, - XA_RECORDITFEVENTS = 0x4, - XA_SNAPSHOTITFEVENTS = 0x8, - XA_OUTPUTMIXITFEVENTS = 0x10, - XA_CAMERAITFEVENTS = 0x20, - XA_PREFETCHITFEVENTS = 0x40, - XA_RADIOITFEVENTS = 0x80, - XA_RDSITFEVENTS = 0x100, - XA_METADATAEVENTS = 0x200, - XA_ADDMORETYPES = 0x400 -}XAAdaptEventTypes; - -#define XA_ADAPT_PU_INTERVAL 50 /* position update interval */ -#define XA_ADAPT_ASYNC_TIMEOUT 3000 /* timeout to wait async events */ -#define XA_ADAPT_ASYNC_TIMEOUT_SHORT 1000 /* timeout to wait async events */ -#define XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC 1000000 /* timeout to wait async events */ - -#define XA_ADAPT_POSITION_UPDATE_EVT 0xf0 /* position update event */ -#define XA_ADAPT_SNAPSHOT_TAKEN 0xf1 /* snapshot taken event */ -#define XA_ADAPT_SNAPSHOT_INITIATED 0xf2 /* snapshot intitiated event */ -#define XA_ADAPT_MDE_TAGS_AVAILABLE 0xf3 /* metadata taglist changed */ -#define XA_ADAPT_OMIX_DEVICESET_CHANGED 0xf4 /* Output mix device changed event */ -#define XA_ADAPT_RADIO_FREQUENCY_CHANGED 0xf6 /* Radio frequency changed event */ -#define XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED 0xf7 /* Radio frequency range changed event */ -#define XA_ADAPT_RADIO_SEEK_COMPLETE 0xf8 /* Radio seek complete changed event */ -#define XA_ADAPT_RDS_GET_ODA_GROUP_DONE 0xf9 /* RDS get oda group done event */ -#define XA_ADAPT_BUFFERING 0xfa -#define XA_ADAPT_MDE_TAGS_WRITTEN 0xfb -/* TYPEDEFS */ - -#define RADIO_DEFAULT_FREQ_RANGE XA_FREQRANGE_FMEUROAMERICA -#define RADIO_DEFAULT_FREQ 88000000 - -/* Adaptation event structure */ -typedef struct XAAdaptEvent_ -{ - XAAdaptEventTypes eventtype; /* what kind of event, e.g. playitf event */ - XAuint8 eventid; /* eventtype-specific event, e.g. XA_PLAYEVENT macro */ - XAuint32 datasize; /* event data size */ - void* data; /* event data if needed */ -} XAAdaptEvent; - -/* Adaptation event callback */ -typedef void (*xaAdaptEventHandler) ( void *pHandlerCtx, XAAdaptEvent* event ); - -/* Forward declaration of adaptation basecontext */ -typedef struct XAAdaptationBaseCtx_ XAAdaptationBaseCtx; - -/* FUNCTIONS */ -XAresult XAAdaptationBase_Init( XAAdaptationBaseCtx* pSelf, XAuint32 ctxId ); -XAresult XAAdaptationBase_PostInit( XAAdaptationBaseCtx* ctx ); -XAresult XAAdaptationBase_AddEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler, - XAuint32 evtTypes,void *pHandlerCtx ); -XAresult XAAdaptationBase_RemoveEventHandler( XAAdaptationBaseCtx* ctx, xaAdaptEventHandler evtHandler ); -void XAAdaptationBase_Free( XAAdaptationBaseCtx* ctx ); -XAresult XAAdaptationBase_SetCPConfiguration(XAAdaptationBaseCtx* ctx, XAConfigExtensionCpKey configValue); - -#endif /*XAADAPTATIONCONTEXTBASE_H*/ - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaaudioencoderitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaaudioencoderitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAMediaRecorderAdaptCtx.h" -#include "XAAudioEncoderItfAdaptation.h" -#include "XAAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -/* - * XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationBaseCtx *ctx, - * XAAudioEncoderSettings *pSettings ) - * @param XAAdaptationBaseCtx *ctx - pointer to Media Recorer adaptation contex - * @param XAAudioEncoderSettings *pSettings - Settings to be setted for encoder - * @return XAresult ret - return success value - * Description: Sets preferred encoder settings for pipeline. - */ -XAresult XAAudioEncoderItfAdapt_SetEncoderSettings( XAAdaptationBaseCtx *ctx, - XAAudioEncoderSettings *pSettings ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaRecorderAdaptationCtx* mCtx = NULL; - - DEBUG_API("->XAAudioEncoderItfAdapt_SetEncoderSettings"); - if( !ctx || (ctx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAAudioEncoderItfImpl_SetEncoderSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) ctx; - - ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_AUDIO,pSettings->encoderId); - if(ret==XA_RESULT_SUCCESS) - { - /*change of settings - pipeline must be regenerated**/ - mCtx->encodingchanged = XA_BOOLEAN_TRUE; - memcpy(&mCtx->audioEncSettings, pSettings, sizeof(XAAudioEncoderSettings)); - } - DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings"); - return ret; -} - -XAresult XAAudioEncoderItfAdapt_GetEncoderSettings( XAAdaptationBaseCtx *bCtx, - XAAudioEncoderSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAAudioEncoderItfAdapt_GetEncoderSettings"); - if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - memcpy(pSettings, &(mCtx->audioEncSettings), sizeof(XAAudioEncoderSettings)); - DEBUG_API("<-XAAudioEncoderItfAdapt_GetEncoderSettings"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaaudioencoderitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaaudioencoderitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAAUDIOENCODERITFADAPTATION_H -#define XAAUDIOENCODERITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* FUNCTIONS */ -XAresult XAAudioEncoderItfAdapt_SetEncoderSettings(XAAdaptationBaseCtx *ctx, - XAAudioEncoderSettings *pSettings ); -XAresult XAAudioEncoderItfAdapt_GetEncoderSettings(XAAdaptationBaseCtx *ctx, - XAAudioEncoderSettings *pSettings ); - -#endif /* XAAUDIOENCODERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xacameraadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xacameraadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XACameraAdaptCtx.h" -#include "XAAdaptation.h" -#include -#include "XAStaticCapsAdaptation.h" - - -XAboolean cameraRealized = XA_BOOLEAN_FALSE; -XACameraAdaptationCtx_* cameraCtx = NULL; - -/* - * gboolean XACameraAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * MediaPlayer Gst-bus message handler (Callback) - */ -gboolean XACameraAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*)data; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_FOCUSSTATUS,1,NULL}; - XAuint32 status; - - /* only listen to pipeline messages */ - if(GST_MESSAGE_SRC(message)==(GstObject*)(mCtx->baseObj.bin) ) - { - DEBUG_API_A2("->XACameraAdapt_GstBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - if ( GST_MESSAGE_TYPE(message)== GST_MESSAGE_ASYNC_DONE ) - { - /* some async sequence ended */ - XAAdaptationBase_CompleteAsyncWait((&mCtx->baseObj)); - } - else if (strncmp(GST_MESSAGE_TYPE_NAME(message), GST_PHOTOGRAPHY_AUTOFOCUS_DONE, - strlen(GST_PHOTOGRAPHY_AUTOFOCUS_DONE))==0 ) - { - DEBUG_INFO("Autofocus done!.") - status = XA_CAMERA_FOCUSMODESTATUS_REACHED; - event.data = &status; - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj), &event ); - } - else if ( strncmp(GST_MESSAGE_TYPE_NAME(message), GST_PHOTOGRAPHY_SHAKE_RISK, - strlen(GST_PHOTOGRAPHY_SHAKE_RISK)) ==0 ) - { - DEBUG_INFO("Camera shake risk!") - } - DEBUG_API("<-XACameraAdapt_GstBusCb"); - } - return TRUE; -} - -/* - * XAAdaptationBaseCtx* XACameraAdapt_Create() - * Allocates memory for Camera Adaptation Context and makes 1st phase initialization - * @returns XACameraAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XACameraAdapt_Create(XAuint32 deviceID) -{ - XACameraAdaptationCtx *pSelf = calloc(1, sizeof(XACameraAdaptationCtx)); - DEBUG_API("->XACameraAdapt_Create"); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XACameraAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->deviceID = deviceID; - pSelf->curMirror = XA_VIDEOMIRROR_NONE; - pSelf->curRotation = 0; - pSelf->recording = XA_BOOLEAN_FALSE; - pSelf->playing = XA_BOOLEAN_FALSE; - pSelf->snapshotting = XA_BOOLEAN_FALSE; - cameraCtx = pSelf; /* Store global pointer */ - DEBUG_INFO_A1("Stored global camera ponter to %x", cameraCtx); - cameraRealized = XA_BOOLEAN_FALSE; - } - } - - DEBUG_API("<-XACameraAdapt_Create"); - return (XAAdaptationBaseCtx*)pSelf; -} - -/* - * XAresult XACameraAdapt_PostInit() - * 2nd phase initialization of Camera Adaptation Context - */ -XAresult XACameraAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XACameraAdaptationCtx* ctx = NULL; - DEBUG_API("->XACameraAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XACameraAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XACameraAdaptationCtx*)bCtx; - - if ( !ctx ) - { - return XA_RESULT_INTERNAL_ERROR; - } - - XAAdaptationBase_PostInit( &(ctx->baseObj) ); - - ctx->baseObj.bin = gst_element_factory_make( "camerabin", "camera"); - if ( !ctx->baseObj.bin ) - { - DEBUG_ERR("Failed to create CameraBin"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Create Gst bus listener. */ - ret = XAAdaptationBase_InitGstListener(&(ctx->baseObj)); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Bus listener creation failed!!"); - return ret; - } - /* Add Camera specific handler */ - if(ctx->baseObj.bus) - { - ctx->baseObj.busCb = XACameraAdapt_GstBusCb; - gst_bus_add_signal_watch( ctx->baseObj.bus); - g_signal_connect(ctx->baseObj.bus, "message::autofocus-done", G_CALLBACK(ctx->baseObj.busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::shake-risk", G_CALLBACK(ctx->baseObj.busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::async-done", G_CALLBACK(ctx->baseObj.busCb), ctx ); - } - else - { - DEBUG_ERR("Failed to create message bus"); - return XA_RESULT_INTERNAL_ERROR; - } - - - /* SET UP CAMERABIN */ - - /* use test video source if set, camerabin default (v4l2src) otherwise */ -#ifdef XA_USE_TEST_PLUGINS - if(ctx->deviceID == XA_ADAPTID_VIDEOTESTSRC || ctx->deviceID == XA_DEFAULTDEVICEID_CAMERA ) -#else - if(ctx->deviceID == XA_ADAPTID_VIDEOTESTSRC ) -#endif - { - g_object_set( G_OBJECT(ctx->baseObj.bin), "videosrc", gst_element_factory_make("videotestsrc", "videotestsrc"), NULL ); - } - - /* set viewfinder element to be fake for the time of preroll.. if ghost pad added now, - * stupid camerabin makes circular linking... - */ - g_object_set( G_OBJECT(ctx->baseObj.bin), "vfsink" ,gst_element_factory_make("fakesink", "fakevfsink"), NULL ); - - /* Setup camerabin to produce raw video */ - g_object_set( G_OBJECT(ctx->baseObj.bin), "videomux",NULL, NULL ); - g_object_set( G_OBJECT(ctx->baseObj.bin), "videoenc",NULL, NULL ); - g_object_set( G_OBJECT(ctx->baseObj.bin), "mute", TRUE, NULL ); - g_object_set( G_OBJECT(ctx->baseObj.bin), "async-handling", FALSE, NULL); - g_object_set( G_OBJECT(ctx->baseObj.bin), "mode",(gint)1, NULL); - - - /* drive camerabin to READY to create the elements inside bin */ - gst_element_set_state( GST_ELEMENT(ctx->baseObj.bin), GST_STATE_READY); - - if(ctx->deviceID == XA_ADAPTID_VIDEOTESTSRC) - { /* set properties for videotestsrc */ - GstElement *testsrc = gst_bin_get_by_name(GST_BIN(ctx->baseObj.bin), "videotestsrc"); - g_object_set( G_OBJECT(testsrc),"is-live", TRUE, NULL); - g_object_set( G_OBJECT(testsrc),"do-timestamp", TRUE, NULL); - gst_object_unref(G_OBJECT(testsrc)); - } - - /* do some filter optimization */ -#ifdef XA_USE_TEST_PLUGINS - g_object_set( G_OBJECT(ctx->baseObj.bin), "filter-caps", - gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "framerate",GST_TYPE_FRACTION_RANGE,0,1,30,1, NULL) - ,NULL ); -#else - g_object_set( G_OBJECT(ctx->baseObj.bin), "filter-caps", - gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('Y','U','Y','2'), - "framerate",GST_TYPE_FRACTION_RANGE,0,1,30,1, NULL) - ,NULL ); -#endif - - - /* now, unlink fake sink, create camera post processing pipeline and create ghost pad from it */ - { - GstElement *fakesink = gst_bin_get_by_name(GST_BIN(ctx->baseObj.bin),"fakevfsink"); - GstPad *fakepad = gst_element_get_static_pad(fakesink,"sink"); - GstPad *linkedpad = gst_pad_get_peer(fakepad); - GstElement *linkedelement = gst_pad_get_parent_element(linkedpad); - GstElement * cameraPP = NULL; - GstElement * camfilter = NULL; - GstElement *tee = NULL; - - /* Unlink fakesink */ - gst_element_unlink(linkedelement,fakesink); - /* Create VideoPP pipeline for Camera object */ - cameraPP = XAAdaptationBase_CreateVideoPP(); - g_object_set( G_OBJECT(cameraPP),"name", "videopp_camera", NULL); - gst_bin_add( GST_BIN(ctx->baseObj.bin), cameraPP ); - /*Link videoPP into camera bin last element */ - gst_element_link( linkedelement, cameraPP ); - - /* Add extra filter for caps negotiable after post processing*/ - camfilter = gst_element_factory_make("capsfilter", "camfilter"); - gst_bin_add( GST_BIN(ctx->baseObj.bin), camfilter ); - gst_element_link( cameraPP, camfilter ); - - /* Add tee element into camerabin */ - tee = gst_element_factory_make( "tee", "CamTee"); - gst_bin_add( GST_BIN(ctx->baseObj.bin), tee); - gst_element_link( camfilter, tee ); - - /* Unref */ - gst_object_unref(linkedelement); - gst_object_unref(linkedpad); - gst_object_unref(fakepad); - gst_bin_remove(GST_BIN(ctx->baseObj.bin),fakesink); - gst_object_unparent(GST_OBJECT(fakesink)); - } - - if ( ret == XA_RESULT_SUCCESS ) - { - cameraRealized = XA_BOOLEAN_TRUE; - } - - DEBUG_API("<-XACameraAdapt_PostInit"); - return ret; -} - -/* - * void XACameraAdapt_Destroy(XACameraAdaptationCtx* ctx) - * Destroys Camera Adaptation Context - * @param ctx - Camera Adaptation context to be destroyed - */ -void XACameraAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XACameraAdaptationCtx* ctx = NULL; - - DEBUG_API("->XACameraAdapt_Destroy"); - if(bCtx == NULL || bCtx->ctxId != XACameraAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XACameraAdapt_Destroy"); - return; - } - ctx = (XACameraAdaptationCtx*)bCtx; - - XAAdaptationBase_Free(&(ctx->baseObj)); - - free(ctx); - ctx = NULL; - cameraCtx = NULL; - cameraRealized = XA_BOOLEAN_FALSE; - DEBUG_API("<-XACameraAdapt_Destroy"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xacameraadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xacameraadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERAADAPTCTX_H -#define XACAMERAADAPTCTX_H - -#include "XAAdaptationContextBase.h" - -/* TYPEDEFS */ - -typedef struct XACameraAdaptationCtx_ XACameraAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XACameraAdapt_Create(XAuint32 deviceID); -XAresult XACameraAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XACameraAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XACAMERAADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xacameraitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xacameraitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,429 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XACameraAdaptCtx.h" -#include "XACameraItfAdaptation.h" -#include "XAAdaptation.h" - - -/* - * XAresult XACameraItfAdapt_SetFlashMode( XAAdaptationBaseCtx *bCtx, XAuint32 flashMode ); - */ -XAresult XACameraItfAdapt_SetFlashMode( XAAdaptationBaseCtx *bCtx, XAuint32 flashMode ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_FLASHREADY,0,0}; - gint gstFlashmode; - - DEBUG_API_A1("->XACameraItfAdapt_SetFlashMode 0x%x",(int)flashMode); - if(!bCtx || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - switch( flashMode ) - { - case XA_CAMERA_FLASHMODE_OFF: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_OFF; - break; - case XA_CAMERA_FLASHMODE_ON: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_ON; - break; - case XA_CAMERA_FLASHMODE_AUTO: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO; - break; - case XA_CAMERA_FLASHMODE_REDEYEREDUCTION: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE; - break; - case XA_CAMERA_FLASHMODE_FILLIN: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN; - break; - case XA_CAMERA_FLASHMODE_TORCH: - case XA_CAMERA_FLASHMODE_REDEYEREDUCTION_AUTO: - default: - DEBUG_INFO("Mode not supported in GstPhotography!"); - return XA_RESULT_PARAMETER_INVALID; - break; - } - - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_flash_mode( GST_PHOTOGRAPHY(bCtx->bin), gstFlashmode ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - if(ret == XA_RESULT_SUCCESS) - { - /* no gst event, senc cb now */ - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetFlashMode"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetFocusMode( XAAdaptationBaseCtx *bCtx, XAuint32 focusMode, - * XAmillimeter manualSetting, - * XAboolean macroEnabled ) - */ -XAresult XACameraItfAdapt_SetFocusMode( XAAdaptationBaseCtx *bCtx, XAuint32 focusMode, - XAmillimeter manualSetting, XAboolean macroEnabled ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_FOCUSSTATUS,1,NULL}; - XAuint32 status; - - DEBUG_API_A3("->XACameraItfAdapt_SetFocusMode - focusMode:%d, manualSetting:%d, macroEnabled:%d", - (int)focusMode, (int)manualSetting, (int)macroEnabled); - if(!bCtx || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( focusMode == XA_CAMERA_FOCUSMODE_AUTO ) - { - gst_photography_set_autofocus( GST_PHOTOGRAPHY(bCtx->bin), TRUE ); - status = XA_CAMERA_FOCUSMODESTATUS_REQUEST; - event.data = &status; - } - else - { - /* Only auto focus supported in GstPhotography, other modes sets auto focus off */ - DEBUG_INFO("No support in GstPhotography"); - gst_photography_set_autofocus( GST_PHOTOGRAPHY(bCtx->bin), FALSE ); - status = XA_CAMERA_FOCUSMODESTATUS_OFF; - event.data = &status; - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - } - else - { - status = XA_CAMERA_FOCUSMODESTATUS_OFF; - event.data = &status; - } - - if(event.data) - { - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetFocusMode"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetFocusRegionPattern( XAAdaptationBaseCtx *bCtx, - * XAuint32 focusPattern, - * XAuint32 activePoints1, - * XAuint32 activePoints2 ) - */ -XAresult XACameraItfAdapt_SetFocusRegionPattern( XAAdaptationBaseCtx *bCtx, XAuint32 focusPattern, - XAuint32 activePoints1, XAuint32 activePoints2 ) -{ - DEBUG_API_A3("->XACameraItfAdapt_SetFocusRegionPattern - focusPattern:%d, activePoints1:%d, activePoints2:%d", - (int)focusPattern,(int)activePoints1,(int)activePoints2); - DEBUG_INFO("No support for focus region pattern in GstPhotography "); - DEBUG_API("<-XACameraItfAdapt_SetFocusRegionPattern"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* XAresult XACameraItfAdapt_GetFocusRegionPositions( XAAdaptationBaseCtx *bCtx, XAuint32 *pNumPositionEntries, - * XAFocusPointPosition *pFocusPosition ) - */ -XAresult XACameraItfAdapt_GetFocusRegionPositions( XAAdaptationBaseCtx *bCtx, XAuint32 *pNumPositionEntries, - XAFocusPointPosition *pFocusPosition ) -{ - DEBUG_API("->XACameraItfAdapt_GetFocusRegionPositions"); - DEBUG_INFO("No focus region support in GstPhotography"); - DEBUG_API("<-XACameraItfAdapt_GetFocusRegionPositions"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetMeteringMode( XAAdaptationBaseCtx *bCtx, XAuint32 meteringMode ) - */ -XAresult XACameraItfAdapt_SetMeteringMode( XAAdaptationBaseCtx *bCtx, XAuint32 meteringMode ) -{ - DEBUG_API_A1("->XACameraItfAdapt_SetMeteringMode - meteringMode:%d",(int)meteringMode); - DEBUG_INFO("No metering modes support in GstPhotography"); - DEBUG_API("<-XACameraItfAdapt_SetMeteringMode"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetExposureMode( XAAdaptationBaseCtx *bCtx, XAuint32 exposure, XAuint32 compensation ) - */ -XAresult XACameraItfAdapt_SetExposureMode( XAAdaptationBaseCtx *bCtx, XAuint32 exposure, XAuint32 compensation ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_EXPOSURESTATUS,1,NULL}; - GstSceneMode expmode; - - DEBUG_API_A2("->XACameraItfAdapt_SetExposureMode - exposure:%d, compensation:%d", - (int)exposure, (int)compensation); - if(!bCtx || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - switch(exposure) - { - case XA_CAMERA_EXPOSUREMODE_AUTO: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO; - break; - case XA_CAMERA_EXPOSUREMODE_SPORTS: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT; - break; - case XA_CAMERA_EXPOSUREMODE_PORTRAIT: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT; - break; - case XA_CAMERA_EXPOSUREMODE_NIGHT: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT; - break; - default: - DEBUG_INFO("GstPhotography doesn't support other than manual settings"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - - if(GST_IS_PHOTOGRAPHY(bCtx->bin)&&ret==XA_RESULT_SUCCESS) - { - if (!gst_photography_set_scene_mode( GST_PHOTOGRAPHY(bCtx->bin), expmode) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - else if (exposure == XA_CAMERA_EXPOSUREMODE_AUTO) - { - if (!gst_photography_set_ev_compensation( GST_PHOTOGRAPHY(bCtx->bin), compensation) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - } - if(ret == XA_RESULT_SUCCESS) - { - event.data = &exposure; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetExposureMode"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetISOSensitivity( XAAdaptationBaseCtx *bCtx, XAuint32 isoSensitivity, XAuint32 manualSetting ) - */ -XAresult XACameraItfAdapt_SetISOSensitivity( XAAdaptationBaseCtx *bCtx, XAuint32 isoSensitivity, XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API_A2("->XACameraItfAdapt_SetISOSensitivity - isoSensitivity:%d, manualSetting:%d", - (int)isoSensitivity, (int)manualSetting); - if(!bCtx || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( isoSensitivity == XA_CAMERA_ISOSENSITIVITYMODE_MANUAL) - { - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_iso_speed (GST_PHOTOGRAPHY(bCtx->bin), manualSetting ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - } - else - { - DEBUG_INFO("Iso sensitivity auto not supported in GstPhotography, stubbed value"); - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XACameraItfAdapt_SetISOSensitivity"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetAperture( XAAdaptationBaseCtx *bCtx, XAuint32 aperture, XAuint32 manualSetting ) - */ -XAresult XACameraItfAdapt_SetAperture( XAAdaptationBaseCtx *bCtx, XAuint32 aperture, XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API_A2("->XACameraItfAdapt_SetAperture - aperture:%d, manualSetting:%d", - (int)aperture, (int)manualSetting); - if(!bCtx || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( aperture == XA_CAMERA_APERTUREMODE_MANUAL ) - { - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if (!gst_photography_set_aperture ( GST_PHOTOGRAPHY(bCtx->bin), manualSetting) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - } - else - { - DEBUG_INFO("GstPhotography doesn't support auto aperture settings"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - - DEBUG_API("<-XACameraItfAdapt_SetAperture"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetShutterSpeed( XAAdaptationBaseCtx *bCtx, XAuint32 shutterSpeed, XAmicrosecond manualSetting ) - */ -XAresult XACameraItfAdapt_SetShutterSpeed( XAAdaptationBaseCtx *bCtx, XAuint32 shutterSpeed, XAmicrosecond manualSetting ) -{ - DEBUG_API_A2("->XACameraItfAdapt_SetShutterSpeed - shutterSpeed:%d, manualSetting:%d", - (int)shutterSpeed, (int)manualSetting); - DEBUG_INFO("Shutter speed setting not supported in GstPhotography"); - DEBUG_API("<-XACameraItfAdapt_SetShutterSpeed"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetWhiteBalance( XAAdaptationBaseCtx *bCtx, XAuint32 whiteBalance, XAuint32 manualSetting ) - */ -XAresult XACameraItfAdapt_SetWhiteBalance( XAAdaptationBaseCtx *bCtx, XAuint32 whiteBalance, XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstWhiteBalanceMode gstWbMode; - - DEBUG_API_A2("->XACameraItfAdapt_SetWhiteBalance - whiteBalance:%d, manualSetting:%d", - (int)whiteBalance, (int)manualSetting); - if(!bCtx || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - switch ( whiteBalance ) - { - case XA_CAMERA_WHITEBALANCEMODE_AUTO: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_AUTO; - break; - case XA_CAMERA_WHITEBALANCEMODE_SUNLIGHT: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT; - break; - case XA_CAMERA_WHITEBALANCEMODE_CLOUDY: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_CLOUDY; - break; - case XA_CAMERA_WHITEBALANCEMODE_TUNGSTEN: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN; - break; - case XA_CAMERA_WHITEBALANCEMODE_FLUORESCENT: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT; - break; - case XA_CAMERA_WHITEBALANCEMODE_SUNSET: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_SUNSET; - break; - case XA_CAMERA_WHITEBALANCEMODE_INCANDESCENT: - case XA_CAMERA_WHITEBALANCEMODE_FLASH: - case XA_CAMERA_WHITEBALANCEMODE_MANUAL: - case XA_CAMERA_WHITEBALANCEMODE_SHADE: - DEBUG_INFO("Wanted white balance mode not supported!"); - return XA_RESULT_FEATURE_UNSUPPORTED; - break; - default: - break; - } - - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_white_balance_mode( GST_PHOTOGRAPHY(bCtx->bin), gstWbMode ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - - DEBUG_API("<-XACameraItfAdapt_SetWhiteBalance"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetAutoLocks( XAAdaptationBaseCtx *bCtx, XAuint32 locks ) - */ -XAresult XACameraItfAdapt_SetAutoLocks( XAAdaptationBaseCtx *bCtx, XAuint32 locks ) -{ - DEBUG_API_A1("->XACameraItfAdapt_SetAutoLocks - locks:%d", (int)locks); - DEBUG_INFO("No autolocks support in GstPhotography") - DEBUG_API("<-XACameraItfAdapt_SetAutoLocks"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetZoom( XAAdaptationBaseCtx *bCtx, XAuint32 zoom, XAboolean digitalEnabled, XAuint32 speed, XAboolean async ) - */ -XAresult XACameraItfAdapt_SetZoom( XAAdaptationBaseCtx *bCtx, XAuint32 zoom, XAboolean digitalEnabled, XAuint32 speed, XAboolean async ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_ZOOMSTATUS,1,NULL}; - gint gstZoom; - - DEBUG_API_A4("->XACameraItfAdapt_SetZoom - zoom:%d,digitalEnabled:%d,speed:%d,async:%d ", - (int)zoom,(int)digitalEnabled,(int)speed,(int)async); - if(!bCtx || bCtx->ctxId != XACameraAdaptation || zoom < 1 ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( zoom > 10 ) - { - gstZoom = MAX_ZOOM; - } - else - { - /* Gst Zoom range 100 - 1000, 100 = 1x, 200 = 2x, ...*/ - gstZoom = zoom * 100; - } - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_zoom( GST_PHOTOGRAPHY(bCtx->bin), gstZoom ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - if( ret == XA_RESULT_SUCCESS && async ) - { - /* no gst event, send cb now*/ - event.data = &zoom; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetZoom"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xacameraitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xacameraitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERAITFADAPTATION_H_ -#define XACAMERAITFADAPTATION_H_ - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -#define MAX_ZOOM 1000; - -/* FUNCTIONS */ - -XAresult XACameraItfAdapt_SetFlashMode( XAAdaptationBaseCtx *bCtx, XAuint32 flashMode ); -XAresult XACameraItfAdapt_SetFocusMode( XAAdaptationBaseCtx *bCtx, XAuint32 focusMode, XAmillimeter manualSetting, XAboolean macroEnabled ); -XAresult XACameraItfAdapt_SetFocusRegionPattern( XAAdaptationBaseCtx *bCtx, XAuint32 focusPattern, XAuint32 activePoints1, XAuint32 activePoints2 ); -XAresult XACameraItfAdapt_GetFocusRegionPositions( XAAdaptationBaseCtx *bCtx, XAuint32 *pNumPositionEntries, XAFocusPointPosition *pFocusPosition ); -XAresult XACameraItfAdapt_SetMeteringMode( XAAdaptationBaseCtx *bCtx, XAuint32 meteringMode ); -XAresult XACameraItfAdapt_SetExposureMode( XAAdaptationBaseCtx *bCtx, XAuint32 exposure, XAuint32 compensation ); -XAresult XACameraItfAdapt_SetISOSensitivity( XAAdaptationBaseCtx *bCtx, XAuint32 isoSensitivity, XAuint32 manualSetting ); -XAresult XACameraItfAdapt_SetAperture( XAAdaptationBaseCtx *bCtx, XAuint32 aperture, XAuint32 manualSetting ); -XAresult XACameraItfAdapt_SetShutterSpeed( XAAdaptationBaseCtx *bCtx, XAuint32 shutterSpeed, XAmicrosecond manualSetting ); -XAresult XACameraItfAdapt_SetWhiteBalance( XAAdaptationBaseCtx *bCtx, XAuint32 whiteBalance, XAuint32 manualSetting ); -XAresult XACameraItfAdapt_SetAutoLocks( XAAdaptationBaseCtx *bCtx, XAuint32 locks ); -XAresult XACameraItfAdapt_SetZoom( XAAdaptationBaseCtx *bCtx, XAuint32 zoom, XAboolean digitalEnabled, XAuint32 speed, XAboolean async ); - -#endif /* XACAMERAITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xadevicevolumeitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xadevicevolumeitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XADeviceVolumeItfAdaptation.h" -#include "XAEngineAdaptCtx.h" -#include "XAAdaptation.h" -#include "XAStaticCapsAdaptation.h" - - -/* XAresult XADeviceVolumeItfAdapt_SetVolume - * Description: Sets the device's volume. - */ -XAresult XADeviceVolumeItfAdapt_SetVolume(XAAdaptationBaseCtx *bCtx, XAuint32 deviceID, XAint32 volume) -{ - XAEngineAdaptationCtx* ctx = NULL; - GstElement* amixer = NULL; - GstMixerTrack *mixerTrack = NULL; - const GList *gList = NULL; - gint volumeIdx = 0; - - DEBUG_API("->XADeviceVolumeItfAdapt_SetVolume"); - - if(!bCtx ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_PARAMETER_INVALID; - } - - ctx = (XAEngineAdaptationCtx*) bCtx; - - amixer = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "alsamixer"); - if( !amixer ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_INTERNAL_ERROR; - } - - gList = gst_mixer_list_tracks( GST_MIXER(amixer) ); - if( !gList ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_INTERNAL_ERROR; - } - - while( gList ) - { - mixerTrack = (GstMixerTrack*)gList->data; - if( !mixerTrack ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_INTERNAL_ERROR; - } - - if( ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_DEFAULTDEVICEID_AUDIOINPUT) || -// ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_ADAPTID_ALSASRC) || //krishna - ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_ADAPTID_DEVSOUNDSRC) || - ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_ADAPTID_AUDIOTESTSRC) || - ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_DEFAULTDEVICEID_AUDIOOUTPUT) || - ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_ADAPTID_JACKSINK) || -// ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_ADAPTID_ALSASINK) ) - ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_ADAPTID_DEVSOUNDSINK) ) - { - gint *gVolume = calloc(mixerTrack->num_channels, sizeof(gint) ); - if( !gVolume ) - { - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_MEMORY_FAILURE; - } - - for( volumeIdx = 0; volumeIdx < mixerTrack->num_channels; volumeIdx++ ) - { - /* Set same volume level for all channels */ - gVolume[volumeIdx] = (gint)volume; - } - - /* found master track */ - gst_mixer_set_volume( GST_MIXER(amixer), mixerTrack, gVolume ); - free( gVolume ); - gVolume = NULL; - break; - } - gList = g_list_next(gList); - } - if ( amixer ) - { - gst_object_unref( GST_OBJECT(amixer)); - } - - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_SUCCESS; -} - -/* XAresult XADeviceVolumeItfAdapt_IsDeviceIDSupported - * Description: Check is request device ID supported. - */ -XAresult XADeviceVolumeItfAdapt_IsDeviceIDSupported(XAAdaptationBaseCtx *bCtx, XAuint32 deviceID, XAboolean *isSupported) -{ - DEBUG_API("->XADeviceVolumeItfAdapt_IsDeviceIDSupported"); - - if(!bCtx || !isSupported ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfAdapt_IsDeviceIDSupported"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is device ID supported or not supported */ -// if( deviceID == XA_DEFAULTDEVICEID_AUDIOINPUT || deviceID == XA_ADAPTID_ALSASRC || - if( deviceID == XA_DEFAULTDEVICEID_AUDIOINPUT || deviceID == XA_ADAPTID_DEVSOUNDSRC || - deviceID == XA_ADAPTID_AUDIOTESTSRC || deviceID == XA_DEFAULTDEVICEID_AUDIOOUTPUT || -// deviceID == XA_ADAPTID_JACKSINK || deviceID == XA_ADAPTID_ALSASINK ) - deviceID == XA_ADAPTID_JACKSINK || deviceID == XA_ADAPTID_DEVSOUNDSINK ) - { - *isSupported = XA_BOOLEAN_TRUE; - } - else - { - *isSupported = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XADeviceVolumeItfAdapt_IsDeviceIDSupported"); - return XA_RESULT_SUCCESS; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xadevicevolumeitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xadevicevolumeitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADEVICEVOLUMEITFADAPTATION_H_ -#define XADEVICEVOLUMEITFADAPTATION_H_ - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - - -/* FUNCTIONS */ -XAresult XADeviceVolumeItfAdapt_SetVolume( XAAdaptationBaseCtx *bCtx, XAuint32 deviceID, XAint32 volume); -XAresult XADeviceVolumeItfAdapt_IsDeviceIDSupported(XAAdaptationBaseCtx *bCtx, XAuint32 deviceID, XAboolean *isSupported); -#endif /* XADEVICEVOLUMEITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xadynamicsourceitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xadynamicsourceitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,103 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XADynamicSourceItfAdaptation.h" - -/* - * XAresult XADynamicSourceItfAdapt_SetSource(XAAdaptationBaseCtx *bCtx, XADataSource *pDataSource) - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * @param XADataSource *pDataSource - new data source - * @return XAresult ret - Success value - */ -XAresult XADynamicSourceItfAdapt_SetSource(XAAdaptationBaseCtx *bCtx, XADataSource *pDataSource) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XADynamicSourceItfAdapt_SetSource"); - if( !bCtx || !pDataSource || !pDataSource->pLocator ) - { - DEBUG_ERR("Invalid NULL parameter"); - ret = XA_RESULT_PARAMETER_INVALID; - } - else if(bCtx->ctxId == XAMediaPlayerAdaptation || bCtx->ctxId == XAMDAdaptation ) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - GstStateChangeReturn gret; - GstState origState; - GstElement* newSource = XAAdaptationBase_CreateGstSource( pDataSource, "datasrc", &(mCtx->isobjsrc), NULL, NULL); - if(!newSource) - { - DEBUG_ERR("Could not create data source!!!"); - return XA_RESULT_CONTENT_NOT_FOUND; - } - DEBUG_INFO("Changing Playback Source"); - /* store current state */ - origState = GST_STATE(bCtx->bin); - /* unroll pipeline */ - bCtx->binWantedState = GST_STATE_NULL; - XAAdaptationBase_PrepareAsyncWait(bCtx); - gret = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for unroll"); - XAAdaptationBase_StartAsyncWait(bCtx); - DEBUG_INFO("Unroll ready"); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { /*not much we can do*/ - DEBUG_ERR("WARNING: Failed to unroll pipeline!!") - return XA_RESULT_INTERNAL_ERROR; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - - /* set new source */ - gst_element_unlink(mCtx->source,mCtx->codecbin); - gst_bin_remove(GST_BIN(bCtx->bin), mCtx->source); - mCtx->source = newSource; - gst_bin_add(GST_BIN(bCtx->bin), mCtx->source); - gst_element_link(mCtx->source, mCtx->codecbin); - mCtx->xaSource = pDataSource; - - /* restore pipeline state */ - bCtx->binWantedState = origState; - DEBUG_INFO_A1("Changing pipeline back to state %s",gst_element_state_get_name(origState)); - XAAdaptationBase_PrepareAsyncWait(bCtx); - gret = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for state change"); - XAAdaptationBase_StartAsyncWait(bCtx); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("State change FAILED"); - return XA_RESULT_INTERNAL_ERROR; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - DEBUG_INFO_A1("Pipeline in state %s",gst_element_state_get_name(GST_STATE(bCtx->bin))); - - if( GST_STATE(bCtx->bin) > GST_STATE_READY ) - { /* let (possible) extraction itf to know new tags */ - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - } - DEBUG_API("<-XADynamicSourceItfAdapt_SetSource"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xadynamicsourceitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xadynamicsourceitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADYNAMICSOURCEITFADAPTATION_H -#define XADYNAMICSOURCEITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* FUNCTIONS */ - -XAresult XADynamicSourceItfAdapt_SetSource(XAAdaptationBaseCtx *bCtx, XADataSource *pDataSource); - -#endif /* XADYNAMICSOURCEITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaengineadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xaengineadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAEngineAdaptCtx.h" -#include "XAAdaptation.h" - -/* - * gboolean XAEngineAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * MediaPlayer Gst-bus message handler (Callback) - */ -gboolean XAEngineAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XAEngineAdaptationCtx* mCtx = (XAEngineAdaptationCtx*)data; - DEBUG_API("->XAEngineAdapt_GstBusCb"); - - /* only listen to pipeline messages */ - if(GST_MESSAGE_SRC(message)==(GstObject*)(mCtx->baseObj.bin) ) - { - DEBUG_API_A2("->XAEngineAdapt_GstBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - } - - DEBUG_API("<-XAEngineAdapt_GstBusCb"); - return TRUE; -} - -/* - * XAAdaptationBaseCtx* XAEngineAdapt_Create() - * Allocates memory for Engine Adaptation Context and makes 1st phase initialization - * @returns XAEngineAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XAEngineAdapt_Create() -{ - XAEngineAdaptationCtx *pSelf = NULL; - DEBUG_API("->XAEngineAdapt_Create"); - - pSelf = calloc(1, sizeof(XAEngineAdaptationCtx)); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XAEngineAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - /* Init internal variables */ - } - } - - DEBUG_API("<-XAEngineAdapt_Create"); - return (XAAdaptationBaseCtx*)pSelf; -} - -/* - * XAresult XAEngineAdapt_PostInit() - * 2nd phase initialization of engine Adaptation Context - */ -XAresult XAEngineAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstStateChangeReturn gret = GST_STATE_CHANGE_SUCCESS; - XAEngineAdaptationCtx* ctx = NULL; - - DEBUG_API("->XAEngineAdapt_PostInit"); - if( !bCtx || bCtx->ctxId != XAEngineAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAEngineAdaptationCtx*)bCtx; - - if ( !ctx ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAEngineAdapt_PostInit"); - return XA_RESULT_INTERNAL_ERROR; - } - - XAAdaptationBase_PostInit( &(ctx->baseObj) ); - - ctx->baseObj.bin = gst_pipeline_new("engine"); - // gst_bin_add(GST_BIN(ctx->baseObj.bin), gst_element_factory_make( "alsamixer", "alsamixer")); - - if ( !ctx->baseObj.bin ) - { - DEBUG_ERR("Failed to create alsamixer"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAEngineAdapt_PostInit"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Create Gst bus listener. */ - ret = XAAdaptationBase_InitGstListener(&(ctx->baseObj)); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR_A1("Bus listener creation failed!! - (%d)", ret); - DEBUG_API("<-XAEngineAdapt_PostInit"); - return ret; - } - - /* Add Engine specific handler */ - if(ctx->baseObj.bus) - { - ctx->baseObj.busCb = XAEngineAdapt_GstBusCb; - } - else - { - DEBUG_ERR("Failed to create message bus"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAEngineAdapt_PostInit"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* roll up bin */ - ctx->baseObj.binWantedState = GST_STATE_PAUSED; - XAAdaptationBase_PrepareAsyncWait(&(ctx->baseObj)); - gret = gst_element_set_state( GST_ELEMENT(ctx->baseObj.bin), ctx->baseObj.binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for preroll"); - XAAdaptationBase_StartAsyncWait(&(ctx->baseObj)); - DEBUG_INFO("Preroll ready"); - } - ctx->baseObj.waitingasyncop = XA_BOOLEAN_FALSE; - - ret = XAStaticCapsAdapt_InitCaps(); - - DEBUG_API("<-XAEngineAdapt_PostInit"); - return ret; -} - -/* - * void XAEngineAdapt_Destroy(XAEngineAdaptationCtx* ctx) - * Destroys Engine Adaptation Context - * @param ctx - Engine Adaptation context to be destroyed - */ -void XAEngineAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XAEngineAdaptationCtx* ctx = NULL; - - DEBUG_API("->XAEngineAdapt_Destroy"); - if( !bCtx || bCtx->ctxId != XAEngineAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineAdapt_Destroy"); - return; - } - ctx = (XAEngineAdaptationCtx*)bCtx; - - XAAdaptationBase_Free(&(ctx->baseObj)); - -/* gst_deinit(); */ - - free(ctx); - ctx = NULL; - - DEBUG_API("<-XAEngineAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaengineadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xaengineadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAENGINEADAPTCTX_H_ -#define XAENGINEADAPTCTX_H_ - -#include "XAAdaptationContextBase.h" -#include "XAStaticCapsAdaptation.h" - -/* TYPEDEFS */ - -typedef struct XAEngineAdaptationCtx_ XAEngineAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAEngineAdapt_Create(); -XAresult XAEngineAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XAEngineAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XAENGINEADAPTCTX_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaequalizeritfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaequalizeritfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,336 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAMediaRecorderAdaptCtx.h" -#include "XAOutputMixAdaptCtx.h" -#include "XAEqualizerItfAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -static const XAmilliHertz centerFrequencies[EQUALIZER_NUM_OF_BANDS] = { - 29000, 59000, 119000, 227000, 474000, - 947000, 1889000, 3770000, 7523000, 15011000 }; - -static const char* band_names[EQUALIZER_NUM_OF_BANDS] = { - "band0", "band1", "band2", "band3", "band4", - "band5", "band6", "band7", "band8", "band9" }; - -static const XAmilliHertz bandFreqRangeMin = 0; -static const XAmilliHertz bandFreqRangeMax = 0; -static const XAmillibel bandLevelRangeMin = -2400; -static const XAmillibel bandLevelRangeMax = 1200; - - -/* - * XAresult XAEqualizerItfAdapt_GetBandLevelRange(XAAdaptationBaseCtx *bCtx, - * XAmillibel *pMin, - * XAmillibel *pMax) - */ -XAresult XAEqualizerItfAdapt_GetBandLevelRange(XAAdaptationBaseCtx *bCtx, - XAmillibel *pMin, - XAmillibel *pMax) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetBandLevelRange"); - - if( (!pMin && !pMax) ) /* other may be NULL */ - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (pMin) - { - *pMin = bandLevelRangeMin; - } - if (pMax) - { - *pMax = bandLevelRangeMax; - } - - DEBUG_API("<-XAEqualizerItfAdapt_GetBandLevelRange"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_SetBandLevel(XAAdaptationBaseCtx *bCtx, - * XAuint16 band, - * XAmillibel level) - */ -XAresult XAEqualizerItfAdapt_SetBandLevel(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmillibel level) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstElement *equ=NULL, *audiopp=NULL; - DEBUG_API("->XAEqualizerItfAdapt_SetBandLevel"); - - if(!bCtx || - band >= EQUALIZER_NUM_OF_BANDS || - level < bandLevelRangeMin || - level > bandLevelRangeMax) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - if( bCtx->ctxId == XAMediaPlayerAdaptation || bCtx->ctxId == XAMediaRecorderAdaptation ) - { - audiopp = gst_bin_get_by_name( GST_BIN(bCtx->bin), "audiopp" ); - equ = gst_bin_get_by_name( GST_BIN(audiopp), "pp_equ" ); - if(equ) - { - g_object_set( G_OBJECT(equ), band_names[band], (gdouble)(level/1000), NULL ); - } - else - { - DEBUG_ERR("Media object equalizer element not found!!"); - } - } - else if( bCtx->ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) bCtx; - guint iterator; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = GST_BIN(g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx->bin); - equ=NULL; - audiopp=NULL; - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if(audiopp) - { - equ = gst_bin_get_by_name( GST_BIN(audiopp), "pp_equ" ); - } - if(equ) - { - g_object_set( G_OBJECT(equ), band_names[band], (gdouble)(level/1000), NULL ); - } - else - { - DEBUG_ERR_A1("Could not find equalizer for player %u!!", iterator); - } - } - } - else - { - DEBUG_ERR_A1("Not supported adaptation element: %d", bCtx->ctxId); - return XA_RESULT_PARAMETER_INVALID; - } - } - if(equ) - { - gst_object_unref(equ); - } - if(audiopp) - { - gst_object_unref(audiopp); - } - - DEBUG_API("<-XAEqualizerItfAdapt_SetBandLevel"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetCenterFreq(XAAdaptationBaseCtx *bCtx, - * XAuint16 band, - * XAmilliHertz *pCenter) - */ - -XAresult XAEqualizerItfAdapt_GetCenterFreq(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmilliHertz *pCenter) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetCenterFreq"); - - if(!pCenter || band >= EQUALIZER_NUM_OF_BANDS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pCenter = centerFrequencies[band]; - - DEBUG_API("<-XAEqualizerItfAdapt_GetCenterFreq"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetBandFreqRange(XAAdaptationBaseCtx *bCtx, - * XAuint16 band, - * XAmilliHertz *pMin, - * XAmilliHerts *pMax) - */ -XAresult XAEqualizerItfAdapt_GetBandFreqRange(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmilliHertz *pMin, - XAmilliHertz *pMax) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetBandFreqRange"); - - /* pMin or pMax may be NULL */ - if((!pMin && !pMax) || band >= EQUALIZER_NUM_OF_BANDS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* in this implementation there are no ranges */ - if (pMin) - { - *pMin = centerFrequencies[band]; - } - if (pMax) - { - *pMax = centerFrequencies[band]; - } - - DEBUG_API("<-XAEqualizerItfAdapt_GetBandFreqRange"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetBand(XAAdaptationBaseCtx *bCtx, - * XAmilliHertz frequency, - * XAuint16 *pBand) - */ -XAresult XAEqualizerItfAdapt_GetBand(XAAdaptationBaseCtx *bCtx, - XAmilliHertz frequency, - XAuint16 *pBand) -{ - XAuint16 index=0; - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetBand"); - - if(!pBand) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pBand = XA_EQUALIZER_UNDEFINED; - - /* as there are no ranges, it must match exactly */ - for (index = 0; index < EQUALIZER_NUM_OF_BANDS; index++) - { - if (frequency == centerFrequencies[index]) - { - *pBand = index; - break; - } - } - - DEBUG_API("<-XAEqualizerItfAdapt_GetBand"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetDefaultBandLevel(XAAdaptationBaseCtx *bCtx, - * XAuint16 band, - * XAmillibel *pLevel) - */ -XAresult XAEqualizerItfAdapt_GetDefaultBandLevel(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmillibel *pLevel) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetDefaultBandLevel"); - - if(!pLevel) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - pLevel = EQUALIZER_DEFAULT_BAND_LEVEL; - - DEBUG_API("<-XAEqualizerItfAdapt_GetDefaultBandLevel"); - return ret; -} -/* - * XAresult XAEqualizerItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adapCtx) - * Description: Safety thread entry - */ -XAresult XAEqualizerItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAEqualizerItfAdapt_ThreadEntry"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XAOutputMixAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfAdapt_ThreadEntry"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XAOutputMixAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); - } - - DEBUG_API("<-XAEqualizerItfAdapt_ThreadEntry"); - return XA_RESULT_SUCCESS; -} -/* - * XAresult XAEqualizerItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) - * Description: Safety thread exit - */ -XAresult XAEqualizerItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAEqualizerItfAdapt_ThreadExit"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XAOutputMixAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfAdapt_ThreadExit"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XAOutputMixAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - } - - - DEBUG_API("<-XAEqualizerItfAdapt_ThreadExit"); - return XA_RESULT_SUCCESS; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaequalizeritfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaequalizeritfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAEQUALIZERITFADAPTATION_H -#define XAEQUALIZERITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" -#include "XAThreadSafety.h" -/* MACROS */ -#define EQUALIZER_NUM_OF_BANDS 10 -#define EQUALIZER_DEFAULT_BAND_LEVEL 0 - -/* FUNCTIONS */ -XAresult XAEqualizerItfAdapt_GetBandLevelRange(XAAdaptationBaseCtx *bCtx, - XAmillibel *pMin, - XAmillibel *pMax); - -XAresult XAEqualizerItfAdapt_SetBandLevel(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmillibel level); - -XAresult XAEqualizerItfAdapt_GetCenterFreq(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmilliHertz *pCenter); - -XAresult XAEqualizerItfAdapt_GetBandFreqRange(XAAdaptationBaseCtx *bCtx, - XAuint16 band, - XAmilliHertz *pMin, - XAmilliHertz *pMax); - -XAresult XAEqualizerItfAdapt_GetBand(XAAdaptationBaseCtx *bCtx, - XAmilliHertz frequency, - XAuint16 *pBand); - -XAresult XAEqualizerItfAdapt_GetDefaultBandLevel(XAAdaptationBaseCtx *bCtx, - XAuint16 index, - XAint16 *pLevel); -XAresult XAEqualizerItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx); -XAresult XAEqualizerItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx); -#endif /* XAEQUALIZERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaimagecontrolsitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaimagecontrolsitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,393 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAMediaRecorderAdaptCtx.h" -#include "XACameraAdaptCtx.h" -#include "XAImageControlsItfAdaptation.h" - -/* - * XAresult XAImageControlsItfAdapt_SetBrightness(XAAdaptationBaseCtx *bCtx, - * XAuint32 brightness) - */ -XAresult XAImageControlsItfAdapt_SetBrightness(XAAdaptationBaseCtx *bCtx, - XAuint32 brightness) -{ - XAresult ret = XA_RESULT_SUCCESS; - - gdouble gstBrightness = 0; - XAint32 tempBrightness = 0; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageControlsItfAdapt_SetBrightness") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_SetBrightness") - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if ( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - } - } - - /* count gstBrightness from XA contrast. Allowed values for gst is -1 to 1 - * and allowed value for XA is 0 to 100 */ - tempBrightness = brightness; - - gstBrightness = ( ((gdouble)tempBrightness - SCALE_VALUE_BRIGHTNESS) / SCALE_VALUE_BRIGHTNESS ); - - if(balanceElement) - { - g_object_set(G_OBJECT(balanceElement), "brightness", gstBrightness, NULL); - - if(bCtx->ctxId == XAMediaPlayerAdaptation) - { - ret = XAImageControlsItfAdapt_HandleImageType(bCtx); - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageControlsItfAdapt_SetBrightness") - return ret; -} - -/* - * XAresult XAImageControlsItfAdapt_SetContrast(XAAdaptationBaseCtx *bCtx, - * XAuint32 contrast) - */ -XAresult XAImageControlsItfAdapt_SetContrast(XAAdaptationBaseCtx *bCtx, - XAint32 contrast) -{ - XAresult ret = XA_RESULT_SUCCESS; - - gdouble gstContrast = 1; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageControlsItfAdapt_SetContrast") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_SetContrast") - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - } - } - - /* count gstContrast from XA contrast. Allowed values for gst is 0 to 2 - * and allowed value for XA is -100 to 100 */ - gstContrast = (( (gdouble)contrast + SCALE_VALUE_CONTRAST ) / SCALE_VALUE_CONTRAST ); - - if(balanceElement) - { - g_object_set(G_OBJECT(balanceElement), "contrast", gstContrast, NULL); - - if(bCtx->ctxId == XAMediaPlayerAdaptation) - { - ret = XAImageControlsItfAdapt_HandleImageType(bCtx); - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageControlsItfAdapt_SetContrast") - return ret; -} - -/* - * XAresult XAImageControlsItfAdapt_SetGamma(XAAdaptationBaseCtx *bCtx, - * XApermille gamma) - */ -XAresult XAImageControlsItfAdapt_SetGamma(XAAdaptationBaseCtx *bCtx, - XApermille gamma) -{ - XAresult ret = XA_RESULT_SUCCESS; - - gdouble gstGamma=0; - GstElement *gammaElement = NULL; - DEBUG_API("->XAImageControlsItfAdapt_SetGamma") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_SetGamma") - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); - } - - if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); - } - - if( bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera gamma element */ - gammaElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_gamma"); - } - } - - /* count gstGamma from XA gamma */ - gstGamma = ( (gdouble)gamma / SCALE_VALUE_GAMMA ); - - if(gammaElement) - { - g_object_set(G_OBJECT(gammaElement), "gamma", gstGamma, NULL); - - if(bCtx->ctxId == XAMediaPlayerAdaptation) - { - ret = XAImageControlsItfAdapt_HandleImageType(bCtx); - } - } - - if ( gammaElement ) - { - gst_object_unref(gammaElement); - } - - DEBUG_API("<-XAImageControlsItfAdapt_SetGamma") - return ret; -} - -/* - * XAresult XAImageControlsItfAdapt_GetSupportedGammaSettings(XAAdaptationBaseCtx *bCtx, - * XApermille *pMinValue, - * XApermille *pMaxValue, - * XAuint32 *pNumSettings, - * XApermille **ppSettings) - */ -XAresult XAImageControlsItfAdapt_GetSupportedGammaSettings(XAAdaptationBaseCtx *bCtx, - XApermille *pMinValue, - XApermille *pMaxValue, - XAuint32 *pNumSettings, - XApermille **ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageControlsItfAdapt_GetSupportedGammaSettings") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation) || !pMinValue || !pMaxValue || !pNumSettings) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfAdapt_GetSupportedGammaSettings") - return XA_RESULT_PARAMETER_INVALID; - } - - *pMinValue = MIN_GAMMA_VALUE; - *pMaxValue = MAX_GAMMA_VALUE; - - /* manual settings is continuous from min to max then pNumSetting return 0. */ - *pNumSettings = 0; - - DEBUG_API("<-XAImageControlsItfAdapt_GetSupportedGammaSettings") - return ret; -} -/* - * XAresult XAImageControlsItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adapCtx) - * Description: Safety thread entry - */ -XAresult XAImageControlsItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAImageControlsItfAdapt_ThreadEntry"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XACameraAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_ThreadEntry"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XACameraAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - } - - DEBUG_API("<-XAImageControlsItfAdapt_ThreadEntry"); - return XA_RESULT_SUCCESS; -} -/* - * XAresult XAImageControlsItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) - * Description: Safety thread exit - */ -XAresult XAImageControlsItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAImageControlsItfAdapt_ThreadExit"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XACameraAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_ThreadExit"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XACameraAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - } - - - DEBUG_API("<-XAImageControlsItfAdapt_ThreadExit"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAImageControlsItfAdapt_HandleImageType(XAAdaptationBaseCtx *bCtx) - * Description: this run gstreamer for image type - * - */ -XAresult XAImageControlsItfAdapt_HandleImageType(XAAdaptationBaseCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XADataSource *dataSrc = NULL; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAImageControlsItfAdapt_HandleImageType"); - - if( !bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_HandleImageType") - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - dataSrc = mCtx->xaSource; - - if( dataSrc ) - { - XAMediaType mediaType; - ret = XACommon_CheckDataSource(dataSrc, &mediaType); - if( ret == XA_RESULT_SUCCESS && mediaType == XA_MEDIATYPE_IMAGE ) - { - gstOrigState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", GST_STATE_READY); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - gstTmpState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", gstOrigState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - } - } - DEBUG_API("<-XAImageControlsItfAdapt_HandleImageType"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaimagecontrolsitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaimagecontrolsitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGECONTROLSITFADAPTATION_H -#define XAIMAGECONTROLSITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" -#include "XAThreadSafety.h" -/* MACROS */ -#define MIN_GAMMA_VALUE 10 -#define MAX_GAMMA_VALUE 10000 -#define SCALE_VALUE_BRIGHTNESS 50 -#define SCALE_VALUE_CONTRAST 100 -#define SCALE_VALUE_GAMMA 1000 - -/* FUNCTIONS */ -XAresult XAImageControlsItfAdapt_SetBrightness(XAAdaptationBaseCtx *bCtx, - XAuint32 brightness); - -XAresult XAImageControlsItfAdapt_SetContrast(XAAdaptationBaseCtx *bCtx, - XAint32 contrast); - -XAresult XAImageControlsItfAdapt_SetGamma(XAAdaptationBaseCtx *bCtx, - XApermille gamma); - -XAresult XAImageControlsItfAdapt_GetSupportedGammaSettings(XAAdaptationBaseCtx *bCtx, - XApermille *pMinValue, - XApermille *pMaxValue, - XAuint32 *pNumSettings, - XApermille **ppSettings); -XAresult XAImageControlsItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx); -XAresult XAImageControlsItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx); -XAresult XAImageControlsItfAdapt_HandleImageType(XAAdaptationBaseCtx *bCtx); -#endif /* XAIMAGECONTROLSITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaimageeffectsitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaimageeffectsitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,729 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAMediaRecorderAdaptCtx.h" -#include "XACameraAdaptCtx.h" -#include "XAImageEffectsItfAdaptation.h" - -/* - * XAresult XAImageEffectsItfAdapt_QuerySupportedImageEffects(XAAdaptationBaseCtx *bCtx, - * XAuint32 index, - * XAuint32 *pImageEffectId) - */ -XAresult XAImageEffectsItfAdapt_QuerySupportedImageEffects(XAAdaptationBaseCtx *bCtx, - XAuint32 index, - XAuint32 *pImageEffectId) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageEffectsItfAdapt_QuerySupportedImageEffects") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation) || index > NUM_SUPPORTED_EFFECTS - 1 || !pImageEffectId) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_QuerySupportedImageEffects") - return XA_RESULT_PARAMETER_INVALID; - } - - /* check which effect is supported */ - if(bCtx->ctxId == XAMediaPlayerAdaptation || bCtx->ctxId == XAMediaRecorderAdaptation) - { - switch( index ) - { - case 0: - *pImageEffectId = XA_IMAGEEFFECT_MONOCHROME; - break; - case 1: - *pImageEffectId = XA_IMAGEEFFECT_NEGATIVE; - break; - case 2: - *pImageEffectId = XA_IMAGEEFFECT_SEPIA; - break; - case 3: - *pImageEffectId = XA_IMAGEEFFECT_EMBOSS; - break; - case 4: - *pImageEffectId = XA_IMAGEEFFECT_PAINTBRUSH; - break; - case 5: - *pImageEffectId = XA_IMAGEEFFECT_SOLARIZE; - break; - case 6: - *pImageEffectId = XA_IMAGEEFFECT_CARTOON; - break; - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - if(bCtx->ctxId == XACameraAdaptation) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - /* real image effects for camera */ - switch( index ) - { - case 0: - *pImageEffectId = XA_IMAGEEFFECT_NEGATIVE; - break; - case 1: - *pImageEffectId = XA_IMAGEEFFECT_SEPIA; - break; - case 3: - *pImageEffectId = XA_IMAGEEFFECT_SOLARIZE; - break; - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - else - { - /* Stubbed image effects for camera */ - switch( index ) - { - case 0: - *pImageEffectId = XA_IMAGEEFFECT_MONOCHROME; - break; - case 1: - *pImageEffectId = XA_IMAGEEFFECT_NEGATIVE; - break; - case 2: - *pImageEffectId = XA_IMAGEEFFECT_SEPIA; - break; - case 3: - *pImageEffectId = XA_IMAGEEFFECT_EMBOSS; - break; - case 4: - *pImageEffectId = XA_IMAGEEFFECT_PAINTBRUSH; - break; - case 5: - *pImageEffectId = XA_IMAGEEFFECT_SOLARIZE; - break; - case 6: - *pImageEffectId = XA_IMAGEEFFECT_CARTOON; - break; - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - } - - DEBUG_API("<-XAImageEffectsItfAdapt_QuerySupportedImageEffects") - return ret; -} - -/* - * XAresult XAImageEffectsItfAdapt_EnableImageEffect(XAAdaptationBaseCtx *bCtx, - * XAuint32 imageEffectID) - */ -XAresult XAImageEffectsItfAdapt_EnableImageEffect(XAAdaptationBaseCtx *bCtx, - XAuint32 imageEffectID) -{ - XAresult ret = XA_RESULT_SUCCESS; - gdouble tempImageEffect = 0; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageEffectsItfAdapt_EnableImageEffect") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_PARAMETER_INVALID; - } - - /* check which effect is enabled (STUB for player and recorder - all effect are done - * via videobalance plugin. Used different saturations values). */ - if(bCtx->ctxId == XAMediaPlayerAdaptation || bCtx->ctxId == XAMediaRecorderAdaptation) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - tempImageEffect = IMAGEEFFECT_MONOCHROME; - break; - case XA_IMAGEEFFECT_NEGATIVE: - tempImageEffect = IMAGEEFFECT_NEGATIVE; - break; - case XA_IMAGEEFFECT_SEPIA: - tempImageEffect = IMAGEEFFECT_SEPIA; - break; - case XA_IMAGEEFFECT_EMBOSS: - tempImageEffect = IMAGEEFFECT_EMBOSS; - break; - case XA_IMAGEEFFECT_PAINTBRUSH: - tempImageEffect = IMAGEEFFECT_PAINTBRUSH; - break; - case XA_IMAGEEFFECT_SOLARIZE: - tempImageEffect = IMAGEEFFECT_SOLARIZE; - break; - case XA_IMAGEEFFECT_CARTOON: - tempImageEffect = IMAGEEFFECT_CARTOON; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - if(bCtx->ctxId == XAMediaPlayerAdaptation) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)tempImageEffect, NULL); - mCtx->imageEffectID = imageEffectID; - ret = XAImageEffectsItfAdapt_HandleImageType(bCtx); - } - } - - if(bCtx->ctxId == XAMediaRecorderAdaptation) - { - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)tempImageEffect, NULL); - mCtx->imageEffectID = imageEffectID; - } - } - } - - if(bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - gint gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_NEGATIVE: - { - gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE; - break; - } - case XA_IMAGEEFFECT_SEPIA: - { - gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA; - break; - } - case XA_IMAGEEFFECT_SOLARIZE: - { - gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE; - break; - } - default: - { - mCtx->imageEffectID = 0; - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - if( imageEffectID != mCtx->imageEffectID ) - { - if( !gst_photography_set_colour_tone_mode( GST_PHOTOGRAPHY(mCtx->baseObj.bin), gstColorToneMode ) ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->imageEffectID = imageEffectID; - } - } - else - { - GstElement *videoPP = NULL; - /* Stubbed image effects for camera */ - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - tempImageEffect = IMAGEEFFECT_MONOCHROME; - break; - case XA_IMAGEEFFECT_NEGATIVE: - tempImageEffect = IMAGEEFFECT_NEGATIVE; - break; - case XA_IMAGEEFFECT_SEPIA: - tempImageEffect = IMAGEEFFECT_SEPIA; - break; - case XA_IMAGEEFFECT_EMBOSS: - tempImageEffect = IMAGEEFFECT_EMBOSS; - break; - case XA_IMAGEEFFECT_PAINTBRUSH: - tempImageEffect = IMAGEEFFECT_PAINTBRUSH; - break; - case XA_IMAGEEFFECT_SOLARIZE: - tempImageEffect = IMAGEEFFECT_SOLARIZE; - break; - case XA_IMAGEEFFECT_CARTOON: - tempImageEffect = IMAGEEFFECT_CARTOON; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - videoPP = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "videopp_camera"); - if ( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)tempImageEffect, NULL); - mCtx->imageEffectID = imageEffectID; - } - } - - if ( videoPP ) - { - gst_object_unref( videoPP ); - } - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return ret; -} - -/* - * XAresult XAImageEffectsItfAdapt_DisableImageEffect(XAAdaptationBaseCtx *bCtx, - * XAuint32 imageEffectID) - */ -XAresult XAImageEffectsItfAdapt_DisableImageEffect(XAAdaptationBaseCtx *bCtx, - XAuint32 imageEffectID) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 tempImageEffect = 0; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageEffectsItfAdapt_DisableImageEffect") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_PARAMETER_INVALID; - } - - /* check which effect is disabled (STUB for player and recorder - all effect are done - * via videobalance plugin. Used saturation default value to disabling effects). */ - if(bCtx->ctxId == XAMediaPlayerAdaptation || bCtx->ctxId == XAMediaRecorderAdaptation) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - tempImageEffect = NO_IMAGEEFFECT; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED") - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - if(bCtx->ctxId == XAMediaPlayerAdaptation) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)GST_NO_IMAGEEFFECT, NULL); - mCtx->imageEffectID = tempImageEffect; - ret = XAImageEffectsItfAdapt_HandleImageType(bCtx); - } - } - - if(bCtx->ctxId == XAMediaRecorderAdaptation) - { - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)GST_NO_IMAGEEFFECT, NULL); - mCtx->imageEffectID = tempImageEffect; - } - } - } - - if(bCtx->ctxId == XACameraAdaptation) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_SOLARIZE: - { - /* Set color tone to normal */ - if( !gst_photography_set_colour_tone_mode( GST_PHOTOGRAPHY(mCtx->baseObj.bin), - GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL ) ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->imageEffectID = NO_IMAGEEFFECT; - break; - } - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED") - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - } - else - { - GstElement *videoPP = NULL; - /* stubbed camera values */ - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - mCtx->imageEffectID = NO_IMAGEEFFECT; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED") - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - videoPP = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "videopp_camera"); - if ( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)GST_NO_IMAGEEFFECT, NULL); - mCtx->imageEffectID = tempImageEffect; - } - } - if ( videoPP ) - { - gst_object_unref(videoPP); - } - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return ret; -} - -/* - * XAresult XAImageEffectsItfAdapt_IsImageEffectEnabled(XAAdaptationBaseCtx *bCtx, - * XAuint32 imageEffectID, - * XAboolean *pEnabled) - */ -XAresult XAImageEffectsItfAdapt_IsImageEffectEnabled(XAAdaptationBaseCtx *bCtx, - XAuint32 imageEffectID, - XAboolean *pEnabled) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 tempImageEffect = 0; - DEBUG_API("->XAImageEffectsItfAdapt_IsImageEffectEnabled") - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation) || !pEnabled) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_IsImageEffectEnabled") - return XA_RESULT_PARAMETER_INVALID; - } - - if(bCtx->ctxId == XAMediaPlayerAdaptation) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - tempImageEffect = mCtx->imageEffectID; - } - - if(bCtx->ctxId == XAMediaRecorderAdaptation) - { - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - tempImageEffect = mCtx->imageEffectID; - } - - /* check is effect enabled for player and recorder */ - if(bCtx->ctxId == XAMediaPlayerAdaptation || bCtx->ctxId == XAMediaRecorderAdaptation) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - { - /* Check is wanted effect currently enabled */ - if( tempImageEffect == imageEffectID ) - { - *pEnabled = XA_BOOLEAN_TRUE; - } - else - { - *pEnabled = XA_BOOLEAN_FALSE; - } - break; - } - default: - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - - if(bCtx->ctxId == XACameraAdaptation) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_SOLARIZE: - { - /* Check is wanted effect currently enabled */ - if( mCtx->imageEffectID == imageEffectID ) - { - *pEnabled = XA_BOOLEAN_TRUE; - } - else - { - *pEnabled = XA_BOOLEAN_FALSE; - } - break; - } - default: - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else - { - /* stubbed camera values */ - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - { - /* Check is wanted effect currently enabled */ - if( mCtx->imageEffectID == imageEffectID ) - { - *pEnabled = XA_BOOLEAN_TRUE; - } - else - { - *pEnabled = XA_BOOLEAN_FALSE; - } - break; - } - default: - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - } - - DEBUG_API("<-XAImageEffectsItfAdapt_IsImageEffectEnabled"); - return ret; -} -/* - * XAresult XAImageEffectsItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adapCtx) - * Description: Safety thread entry - */ -XAresult XAImageEffectsItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAImageEffectsItfAdapt_ThreadEntry"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XACameraAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_ThreadEntry"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XACameraAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - } - - DEBUG_API("<-XAImageEffectsItfAdapt_ThreadEntry"); - return XA_RESULT_SUCCESS; -} -/* - * XAresult XAImageEffectsItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) - * Description: Safety thread exit - */ -XAresult XAImageEffectsItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAImageEffectsItfAdapt_ThreadExit"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XACameraAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_ThreadExit"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XACameraAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - } - - - DEBUG_API("<-XAImageEffectsItfAdapt_ThreadExit"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAImageEffectsItfAdapt_HandleImageType(XAAdaptationBaseCtx *bCtx) - * Description: this run gstreamer for image type - * - */ -XAresult XAImageEffectsItfAdapt_HandleImageType(XAAdaptationBaseCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XADataSource *dataSrc = NULL; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAImageEffectsItfAdapt_HandleImageType"); - - if( !bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_HandleImageType") - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - dataSrc = mCtx->xaSource; - - if( dataSrc ) - { - XAMediaType mediaType; - ret = XACommon_CheckDataSource(dataSrc, &mediaType); - if( ret == XA_RESULT_SUCCESS && mediaType == XA_MEDIATYPE_IMAGE ) - { - gstOrigState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", GST_STATE_READY); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - gstTmpState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", gstOrigState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - } - } - DEBUG_API("<-XAImageEffectsItfAdapt_HandleImageType"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaimageeffectsitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaimageeffectsitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEEFFECTSITFADAPTATION_H -#define XAIMAGEEFFECTSITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" -#include "XAThreadSafety.h" - -/* MACROS */ -#define NUM_SUPPORTED_EFFECTS 7 -#define NO_IMAGEEFFECT 0 -#define GST_NO_IMAGEEFFECT 1 -#define IMAGEEFFECT_MONOCHROME 0 -#define IMAGEEFFECT_NEGATIVE 0.2 -#define IMAGEEFFECT_SEPIA 0.3 -#define IMAGEEFFECT_EMBOSS 1.4 -#define IMAGEEFFECT_PAINTBRUSH 1.5 -#define IMAGEEFFECT_SOLARIZE 1.6 -#define IMAGEEFFECT_CARTOON 2 - -/* FUNCTIONS */ -XAresult XAImageEffectsItfAdapt_QuerySupportedImageEffects(XAAdaptationBaseCtx *bCtx, - XAuint32 index, - XAuint32 *pImageEffectId); - -XAresult XAImageEffectsItfAdapt_EnableImageEffect(XAAdaptationBaseCtx *bCtx, - XAuint32 imageEffectID); - -XAresult XAImageEffectsItfAdapt_DisableImageEffect(XAAdaptationBaseCtx *bCtx, - XAuint32 imageEffectID); - -XAresult XAImageEffectsItfAdapt_IsImageEffectEnabled(XAAdaptationBaseCtx *bCtx, - XAuint32 imageEffectID, - XAboolean *pEnabled); -XAresult XAImageEffectsItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx); -XAresult XAImageEffectsItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx); -XAresult XAImageEffectsItfAdapt_HandleImageType(XAAdaptationBaseCtx *bCtx); -#endif /* XAIMAGEEFFECTSITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaimageencoderitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaimageencoderitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAMediaRecorderAdaptCtx.h" -#include "XAImageEncoderItfAdaptation.h" -#include "XAAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -/* - * XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationBaseCtx *bCtx, - * XAImageSettings *pSettings ) - * @param XAAdaptationBaseCtx *ctx - pointer to Media Recorer adaptation context - * @param XAImageSettings *pSettings - Settings for encoder - * @return XAresult ret - return success value - * Description: Sets preferred encoder settings for pipeline. - */ -XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationBaseCtx *bCtx, - const XAImageSettings *pSettings ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAStaticCapsData temp; - - DEBUG_API("->XAImageEncoderAdapt_SetImageSettings"); - - if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_IMAGE, mCtx->imageEncSettings.encoderId, &temp) != XA_RESULT_SUCCESS) - { /* no such codec */ - return XA_RESULT_FEATURE_UNSUPPORTED; - } - /*Just copy - image settings are applied in InitiateSnapshot*/ - memcpy(&mCtx->imageEncSettings, pSettings, sizeof(XAImageSettings)); - - DEBUG_API("<-XAImageEncoderAdapt_SetImageSettings"); - return ret; -} - -XAresult XAImageEncoderItfAdapt_GetImageSettings( XAAdaptationBaseCtx *bCtx, - XAImageSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAImageEncoderItfAdapt_GetImageSettings"); - if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - memcpy(pSettings, &(mCtx->imageEncSettings), sizeof(XAImageSettings)); - DEBUG_API("<-XAImageEncoderItfAdapt_GetImageSettings"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaimageencoderitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaimageencoderitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEENCODERITFADAPTATION_H -#define XAIMAGEENCODERITFADAPTATION_H - -#include "XAAdaptationContextBase.h" - -/* FUNCTIONS */ -XAresult XAImageEncoderItfAdapt_SetImageSettings(XAAdaptationBaseCtx *bCtx, - const XAImageSettings *pSettings); -XAresult XAImageEncoderItfAdapt_GetImageSettings(XAAdaptationBaseCtx *bCtx, - XAImageSettings *pSettings); -#endif /* XAIMAGEENCODERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaledarrayadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xaledarrayadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XALEDArrayAdaptCtx.h" -#include "XAAdaptation.h" - -/* - * XALEDArrayAdaptationCtx* XALEDArrayAdapt_Create() - * Allocates memory for LEDArray Adaptation Context and makes 1st phase initialization - * @returns XALEDArrayAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XALEDArrayAdapt_Create(XAuint32 deviceID) -{ - XALEDArrayAdaptationCtx *pSelf = calloc(1, sizeof(XALEDArrayAdaptationCtx)); - DEBUG_API("->XALEDArrayAdapt_Create"); - - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XALedArrayAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->deviceID = deviceID; - - } - } - - DEBUG_API("<-XALEDArrayAdapt_Create"); - return (XAAdaptationBaseCtx*)pSelf; -} - -/* - * XAresult XALEDArrayAdapt_PostInit() - * 2nd phase initialization of LEDArray Adaptation Context - */ -XAresult XALEDArrayAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XALEDArrayAdaptationCtx* ctx = NULL; - DEBUG_API("->XALEDArrayAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XALEDArrayAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XALEDArrayAdaptationCtx*)bCtx; - if ( !ctx ) - { - return XA_RESULT_INTERNAL_ERROR; - } - - XAAdaptationBase_PostInit( &(ctx->baseObj) ); - - DEBUG_API("<-XALEDArrayAdapt_PostInit"); - return ret; -} - -/* - * void XALEDArrayAdapt_Destroy(XALEDArrayAdaptationCtx* ctx) - * Destroys LEDArray Adaptation Context - * @param ctx - LEDArray Adaptation context to be destroyed - */ -void XALEDArrayAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XALEDArrayAdaptationCtx* ctx = NULL; - DEBUG_API("->XALEDArrayAdapt_Destroy"); - if(bCtx == NULL || bCtx->ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XALEDArrayAdapt_Destroy"); - return; - } - ctx = (XALEDArrayAdaptationCtx*)bCtx; - DEBUG_API("->XALEDArrayAdapt_Destroy"); - - XAAdaptationBase_Free(&(ctx->baseObj)); - - - free(ctx); - ctx = NULL; - - DEBUG_API("<-XALEDArrayAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaledarrayadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xaledarrayadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XALEDARRAYADAPTCTX_H -#define XALEDARRAYADAPTCTX_H -#ifdef _GSTREAMER_BACKEND_ -#include "XAAdaptationContextBase.h" -#endif -/* TYPEDEFS */ - -typedef struct XALEDArrayAdaptationCtx_ XALEDArrayAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XALEDArrayAdapt_Create(XAuint32 deviceID); -XAresult XALEDArrayAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XALEDArrayAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XALEDARRAYADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaledarrayitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaledarrayitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "XALEDArrayAdaptCtx.h" -#include "XALEDArrayItfAdaptation.h" -#include "XAAdaptation.h" - -/* - * XAresult XALEDArrayItfAdapt_ActivateLEDArray ( XAAdaptationBaseCtx *bCtx, XAuint32 lightMask ) - */ -XAresult XALEDArrayItfAdapt_ActivateLEDArray ( XAAdaptationBaseCtx *bCtx, XAuint32 lightMask ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API_A1("->XALEDArrayItfAdapt_ActivateLEDArray %ld", lightMask); - - if(!bCtx || bCtx->ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XALEDArrayItfAdapt_ActivateLEDArray"); - return ret; -} -/* - * XAresult XALEDArrayItfAdapt_SetColor ( XAAdaptationBaseCtx *bCtx, XAuint8 index, const XAHSL * pColor ) - */ -XAresult XALEDArrayItfAdapt_SetColor ( XAAdaptationBaseCtx *bCtx, XAuint8 index, const XAHSL * pColor ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XALEDArrayItfAdapt_SetColor"); - - if(!bCtx || bCtx->ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XALEDArrayItfAdapt_SetColor"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaledarrayitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaledarrayitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XALEDARRAYITFADAPTATION_H_ -#define XALEDARRAYITFADAPTATION_H_ - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - - - -/* FUNCTIONS */ -XAresult XALEDArrayItfAdapt_ActivateLEDArray ( XAAdaptationBaseCtx *bCtx, XAuint32 lightMask ); -XAresult XALEDArrayItfAdapt_SetColor ( XAAdaptationBaseCtx *bCtx, XAuint8 index, const XAHSL * pColor ); -#endif /* XALEDARRAYITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xamediaplayeradaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xamediaplayeradaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1253 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "XAMediaPlayerAdaptCtx.h" -#include "XAMediaPlayerAdaptCtxMMF.h" -#include "XAAdaptation.h" -#include "XAObjectItf.h" -#include "XACameraDevice.h" -#include "XAOutputMix.h" -#include "XAMetadataAdaptation.h" -#include "XANGAVideoSink.h" - -static void need_data_for_prerolling (GstElement * pipeline, guint size, XAMediaPlayerAdaptationCtx* ctx ); -static void push_data_for_prerolling (GstElement * pipeline, GstBuffer *buffer, XAMediaPlayerAdaptationCtx* ctx); -static void enough_data_for_prerolling (GstElement * pipeline, XAMediaPlayerAdaptationCtx* ctx); -/* forward declarations */ -XAresult XAMediaPlayerAdapt_CreatePipeline( XAMediaPlayerAdaptationCtx* ctx ); - -void* ngaVideoSinkPtr = NULL; - - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/* - * static void XAMediaPlayerAdapt_NewPadCb (GstElement *element, GstPad *pad, gpointer data) - * Listen to codec bin dynamic pads - */ -static void XAMediaPlayerAdapt_NewPadCb (GstElement *element, GstPad *pad, gpointer data) -{ - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*)data; - gchar *name = gst_pad_get_name (pad); - DEBUG_API_A1("->XAMediaPlayerAdapt_NewPadCb: A new pad %s was created", name); - /*try first newly created pad to video pipe*/ - if( mCtx->videoppbin && !(gst_pad_is_linked(gst_element_get_static_pad(mCtx->videoppbin, "videopp_sink"))) ) - { - if(gst_element_link_pads (mCtx->codecbin, name, mCtx->videoppbin, "videopp_sink")) - { - DEBUG_INFO_A1("Pads linked, codecbin:%s to videopp:sink", name); - g_free (name); - DEBUG_API("<-XAMediaPlayerAdapt_NewPadCb"); - return; - } - } - /*..and then to audio pipe*/ - if( mCtx->audioppbin && !(gst_pad_is_linked(gst_element_get_static_pad(mCtx->audioppbin, "sink"))) ) - { - if(gst_element_link_pads (mCtx->codecbin, name, mCtx->audioppbin, "sink")) - { - DEBUG_INFO_A1("Pads linked, codecbin:%s to audiopp:sink", name); - g_free (name); - DEBUG_API("<-XAMediaPlayerAdapt_NewPadCb"); - return; - } - } - - g_free (name); - DEBUG_INFO("Warning: Could not find anything to link to new pad."); - DEBUG_API("<-XAMediaPlayerAdapt_NewPadCb"); -} - -/* - * void push_data_for_prerolling (GstElement * pipeline, GstBuffer *buffer, XAMediaPlayerAdaptationCtx* ctx) - * Called when "push-buffer" signal is emitted - */ -void push_data_for_prerolling (GstElement * pipeline, GstBuffer *buffer, XAMediaPlayerAdaptationCtx* ctx) -{ - DEBUG_API("->push_data_for_prerolling"); - gst_app_src_push_buffer( GST_APP_SRC(ctx->source), GST_BUFFER(buffer) ); - /*GstPad* prerollPad = NULL; - prerollPad = gst_element_get_static_pad(GST_ELEMENT(ctx->source),"src"); - gst_pad_push (prerollPad, buffer); - gst_element_send_event(GST_ELEMENT(ctx->source),gst_event_new_flush_start()); - gst_element_send_event(GST_ELEMENT(ctx->source),gst_event_new_flush_stop());*/ - DEBUG_API("<-push_data_for_prerolling"); -} - -/* - * void enough_data_for_prerolling (GstElement * pipeline, XAMediaPlayerAdaptationCtx* ctx) - * Called when appsrc has enough data - */ -void enough_data_for_prerolling (GstElement * pipeline, XAMediaPlayerAdaptationCtx* ctx) -{ - DEBUG_API("->enough_data_for_prerolling"); - /*No any functionality yet*/ - DEBUG_API("<-enough_data_for_prerolling"); -} - -/* - * void need_data_for_prerolling (GstElement * pipeline, guint size, XAMediaPlayerAdaptationCtx* ctx ) - * Called when the appsrc needs more data during prerolling - */ -void need_data_for_prerolling (GstElement * pipeline, guint size, XAMediaPlayerAdaptationCtx* ctx ) -{ - CPresult cpRet; - XAuint32 requestedBytes = size; - guint readedBytes = 0; - CP_CHECKBYTESRESULTTYPE eResult; - - DEBUG_API("->need_data_for_prerolling"); - - /*Start prerolling to contentpipe data*/ - ctx->baseObj.pipeSrcThrCtx.state = CPStatePrerolling; - - do - { - gpointer cpBuffer = NULL; - GstBuffer *buffer = NULL; - - cpRet = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->CheckAvailableBytes(&(ctx->baseObj.pipeSrcThrCtx.dataHandle), requestedBytes, &eResult); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_API("ERROR"); - ctx->baseObj.pipeSrcThrCtx.state = CPStateError; - } - - if ( eResult == CP_CheckBytesOk ) - { - cpBuffer = g_malloc0(requestedBytes ); - readedBytes =+ requestedBytes; - cpRet = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->Read( &(ctx->baseObj.pipeSrcThrCtx.dataHandle), (CPbyte*)cpBuffer, requestedBytes ); - if ( cpRet != EXIT_SUCCESS ) - { - DEBUG_ERR("Could not read data from content pipe!"); - ctx->baseObj.pipeSrcThrCtx.state = CPStateError; - } - else - { - DEBUG_INFO_A1("Readed %u bytes", requestedBytes ); - /* Create gstBuffer, GStreamer frees data */ - buffer = gst_app_buffer_new( (void*)cpBuffer, requestedBytes, g_free, cpBuffer ); - if ( !buffer ) - { - DEBUG_ERR("Could not allocate buffer for content pipe source!"); - ctx->baseObj.pipeSrcThrCtx.state = CPStateError; - } - } - - if ( cpRet == EXIT_SUCCESS ) - { - if( buffer ) - { - DEBUG_INFO("Pushing preroll buffer"); - /*CP code: causes some delay for appsrc but we use push-buffer signal at this point - GstFlowReturn ret; - g_signal_emit_by_name (ctx->source, "push-buffer", GST_BUFFER(buffer), &ret); - if( ret != GST_FLOW_OK ) - { - DEBUG_ERR("Some problem during preroll"); - DEBUG_API("<-need_data_for_prerolling"); - }*/ - gst_element_send_event(GST_ELEMENT(ctx->source),gst_event_new_flush_start()); - gst_app_src_push_buffer( GST_APP_SRC(ctx->source), GST_BUFFER(buffer) ); - gst_element_send_event(GST_ELEMENT(ctx->source),gst_event_new_flush_stop()); - break; - } - } - } - else if( eResult == CP_CheckBytesAtEndOfStream ) - { - ctx->baseObj.pipeSrcThrCtx.state = CPStateEOS; - break; - } - else if( eResult == CP_CheckBytesInsufficientBytes ) - { - ctx->baseObj.pipeSrcThrCtx.state = CPStateWaitForData; - } - else if( eResult == CP_CheckBytesVendorStartUnused ) - { - /*We use this enumeration when client is started caching from the beginning again*/ - DEBUG_API( "CP_CheckBytesVendorStartUnused from implementation"); - } - }while ( ctx->baseObj.pipeSrcThrCtx.state == CPStatePrerolling || ctx->baseObj.pipeSrcThrCtx.state == CPStateWaitForData ); - - DEBUG_API("<-need_data_for_prerolling"); -} - -/* - * gboolean XAMediaPlayerAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * MediaPlayer Gst-bus message handler (Callback) - */ -gboolean XAMediaPlayerAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XAAdaptationBaseCtx* bCtx = (XAAdaptationBaseCtx*)data; - /* only listen to bin messages */ - if(GST_MESSAGE_SRC(message)==(GstObject*)(bCtx->bin)) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*)data; - DEBUG_API_A2("->XAMediaPlayerAdapt_GstBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_EOS: - { - if( mCtx && mCtx->loopingenabled && mCtx->loopend == GST_CLOCK_TIME_NONE) - { - DEBUG_INFO_A2("Restart loop from %"GST_TIME_FORMAT" to %"GST_TIME_FORMAT, - GST_TIME_ARGS(mCtx->loopstart), GST_TIME_ARGS(mCtx->loopend)); - gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_SET, mCtx->loopstart, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ); - gst_element_get_state(bCtx->bin,NULL,NULL,XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - mCtx->lastpos = mCtx->loopstart; - if( mCtx && mCtx->trackpositionenabled ) - { - XAmillisecond posMsec = GST_TIME_AS_MSECONDS(mCtx->lastpos);/*Warning ok due to used API specification*/ - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - event.data = &posMsec; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - } - else - { - /* stop position tracking */ - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - - /* complete any ongoing client async operations */ - XAAdaptationBase_CompleteAsyncWait(bCtx); - - /* send needed events */ - { - XAMediaType mediatype; - if( mCtx->baseObj.pipeSrcThrCtx.pipe ) - { - XACommon_CheckDataSource((XADataSource*)mCtx->xaAudioSink, &mediatype); - } - else - { - XACommon_CheckDataSource(mCtx->xaSource, &mediatype); - } - if(mediatype!=XA_MEDIATYPE_IMAGE) - { - XAAdaptEvent event = { XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADATEND, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - } - if(mCtx->positionCb) - { - mCtx->positionCb(bCtx); - } - bCtx->binWantedState = GST_STATE_PAUSED; - } - break; - } - - case GST_MESSAGE_STATE_CHANGED: - { - GstState oldstate, newstate, pendingstate, gsttargetstate; - gst_message_parse_state_changed(message, &oldstate, &newstate, &pendingstate); - gsttargetstate = GST_STATE_TARGET(bCtx->bin); - DEBUG_INFO_A4("old %s -> new %s ( pending %s, gsttarget %s )", - gst_element_state_get_name(oldstate), - gst_element_state_get_name(newstate), - gst_element_state_get_name(pendingstate), - gst_element_state_get_name(gsttargetstate) ); - if(gsttargetstate!=bCtx->binWantedState) - { - DEBUG_ERR_A1("WARNING: Gst target is not wanted target [%s]!!!", - gst_element_state_get_name(bCtx->binWantedState)); - } - /* print out some more info */ - if( pendingstate == GST_STATE_VOID_PENDING ) - { - if( newstate != bCtx->binWantedState ) - { - DEBUG_INFO_A2("Gst in intermediate state transition (curr %s, target %s)", - gst_element_state_get_name(newstate), - gst_element_state_get_name(bCtx->binWantedState)); - break; // TL: add to avoid extra event sent below in this case... - } - else - { - DEBUG_INFO_A1("Gst in wanted target state (%s)", - gst_element_state_get_name(newstate)); - } - } - if( oldstate!=GST_STATE_PLAYING && newstate==GST_STATE_PLAYING ) - { - /* send needed events */ - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - /* enable position tracking if needed */ - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - if ( oldstate== GST_STATE_READY && newstate==GST_STATE_PAUSED) - { - if ( mCtx->baseObj.pipeSinkThrCtx.dataHandle ) - { - mCtx->baseObj.pipeSrcThrCtx.state = CPStateInitialized; - } - } - break; - } - - case GST_MESSAGE_ASYNC_DONE: - { - /* some async sequence ended */ - XAAdaptationBase_CompleteAsyncWait(bCtx); - break; - } - - case GST_MESSAGE_ERROR: - { - GError* error; - gchar* debug; - gst_message_parse_error(message, &error, &debug); - DEBUG_ERR_A1("Gst reports error \"%s\"", debug); - /* stop waiting any ongoing async operations */ - XAAdaptationBase_CompleteAsyncWait(bCtx); - break; - } - case GST_MESSAGE_BUFFERING: - { - gint percent; - gst_message_parse_buffering(message, &percent); - DEBUG_INFO_A1("Gst message buffering %d", percent); - mCtx->buffering = percent; - { - XAAdaptEvent event = {XA_PREFETCHITFEVENTS, XA_ADAPT_BUFFERING, 1, NULL }; - event.data = &mCtx->buffering; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - break; - } - case GST_MESSAGE_ELEMENT: - { - DEBUG_INFO("GST_MESSAGE_ELEMENT"); - if ((gst_structure_has_name(message->structure, "graphics-surface-created")) || - (gst_structure_has_name(message->structure, "graphics-surface-updated"))) - { - DEBUG_INFO("graphics-surface-created message recived"); - } - break; - } - default: - break; - } - } - else //if (GST_MESSAGE_SRC(message)==(GstObject*)(bCtx->videosink)) - { - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_ELEMENT: - { - DEBUG_INFO("GST_MESSAGE_ELEMENT"); - if ((gst_structure_has_name(message->structure, "graphics-surface-created")) || - (gst_structure_has_name(message->structure, "graphics-surface-updated"))) - { - guint32 surfaceid0, surfaceid1, surfaceid2, surfaceid3; - gint crop_rect_tl_x, crop_rect_tl_y, crop_rect_br_x, crop_rect_br_y; - gint aspect_ratio_num, aspect_ratio_denom; - - GstObject *sink= GST_MESSAGE_SRC(message); - - g_object_get(sink, "surfaceid0", &surfaceid0, NULL); - g_object_get(sink, "surfaceid1", &surfaceid1,NULL); - g_object_get(sink, "surfaceid2", &surfaceid2,NULL); - g_object_get(sink, "surfaceid3", &surfaceid3,NULL); - g_object_get(sink, "croprect_tl_x", &crop_rect_tl_x, NULL); - g_object_get(sink, "croprect_tl_y", &crop_rect_tl_y, NULL); - g_object_get(sink, "croprect_br_x", &crop_rect_br_x, NULL); - g_object_get(sink, "croprect_br_y", &crop_rect_br_y, NULL); - g_object_get(sink, "aspectratio_num", &aspect_ratio_num, NULL); - g_object_get(sink, "aspectratio_denom", &aspect_ratio_denom, NULL); - surface_created(ngaVideoSinkPtr, surfaceid0,surfaceid1,surfaceid2,surfaceid3,crop_rect_tl_x, - crop_rect_tl_y,crop_rect_br_x,crop_rect_br_y,aspect_ratio_num,aspect_ratio_denom); - } - break; - } - default: - break; - } - } - DEBUG_API("<-XAMediaPlayerAdapt_GstBusCb"); - return TRUE; -} - -/* - * XAMediaPlayerAdaptationCtx* XAMediaPlayerAdapt_Create() - * Allocates memory for Media Player Adaptation Context and makes 1st phase initialization - * @param XADataSource *pDataSrc - pointer to OMX-AL data source - * @param XADataSource *pBankSrc - pointer to instrument bank structure in Mobile DLS, if NULL default will be used. - * @param XADataSink *pAudioSnk - pointer to OMX-AL audio sink definition - * @param XADataSink *pImageVideoSnk - pointer to OMX-AL image and video sink definition - * @returns XAMediaPlayerAdaptationCtx* - Pointer to created context, NULL if error occurs. - */ -XAAdaptationBaseCtx* XAMediaPlayerAdapt_Create(XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray) -{ - XAMediaPlayerAdaptationCtx *pSelf = NULL; - XAuint32 locType = 0; - XADataLocator_IODevice *ioDevice; - XAresult res = XA_RESULT_INTERNAL_ERROR; - DEBUG_API("->XAMediaPlayerAdapt_Create"); - - //Create NGA Video Sink class - if(pImageVideoSnk) - { - ngaVideoSinkPtr = nga_video_sink_init(); - } - - pSelf = calloc(1, sizeof(XAMediaPlayerAdaptationCtx)); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XAMediaPlayerAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->xaSource = pDataSrc; - pSelf->xaBankSrc = pBankSrc; - pSelf->xaAudioSink = pAudioSnk; - pSelf->xaVideoSink = pImageVideoSnk; - pSelf->xaLEDArray = pLEDArray; - pSelf->xaVibra = pVibra; - pSelf->loopstart = 0; - pSelf->loopend = GST_CLOCK_TIME_NONE; - pSelf->playrate = 1.0; - pSelf->baseObj.pipeSrcThrCtx.state = CPStateNull; - pSelf->baseObj.pipeSinkThrCtx.dataHandle = NULL; - pSelf->rateprops = (XA_RATEPROP_SMOOTHVIDEO | XA_RATEPROP_SILENTAUDIO); - pSelf->curMirror = XA_VIDEOMIRROR_NONE; - pSelf->curRotation = 0; - pSelf->isobjsrc = XA_BOOLEAN_FALSE; - pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; - /*pSelf->waitData = XA_BOOLEAN_FALSE;*/ - if(ngaVideoSinkPtr) - { - setup_native_display(ngaVideoSinkPtr, pImageVideoSnk); - } - } - - if ( pDataSrc ) - { - locType = *((XAuint32*)(pDataSrc->pLocator)); - if ( locType == XA_DATALOCATOR_IODEVICE ) - { - ioDevice = (XADataLocator_IODevice*)(pDataSrc->pLocator); - if ( ioDevice->deviceType == XA_IODEVICE_CAMERA && !cameraRealized ) - { - DEBUG_ERR("Preconditions violated - Camera object not realized"); - XAAdaptationBase_Free(&pSelf->baseObj); - free(pSelf); - pSelf = NULL; - } - } - } - } - - DEBUG_API("<-XAMediaPlayerAdapt_Create"); - return (XAAdaptationBaseCtx*)pSelf; -} - - - -/* - * XAresult XAMediaPlayerAdapt_PostInit() - * 2nd phase initialization of Media Player Adaptation Context - * @param XAMediaPlayerAdaptationCtx* ctx - pointer to Media Player adaptation context - * @return XAresult - Success value - */ -XAresult XAMediaPlayerAdapt_PostInit( XAAdaptationBaseCtx* bCtx ) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstStateChangeReturn gret; - XAuint32 locType = 0; - XAMediaPlayerAdaptationCtx* ctx = NULL; - GstElement *videotest=NULL; - - DEBUG_API("->XAMediaPlayerAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAMediaPlayerAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAMediaPlayerAdaptationCtx*)bCtx; - assert(ctx); - ret = XAAdaptationBase_PostInit( bCtx ); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Base context postinit failed!!"); - return ret; - } - - /* top level bin for media player */ - ctx->baseObj.bin = gst_pipeline_new("media_player"); - /* Create Gst bus listener. */ - ret = XAAdaptationBase_InitGstListener(bCtx); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Bus listener creation failed!!"); - return ret; - } - /* Add Media Player specific handler */ - if(ctx->baseObj.bus) - { - ctx->baseObj.busCb = XAMediaPlayerAdapt_GstBusCb; - gst_bus_add_signal_watch( ctx->baseObj.bus ); - gst_bus_enable_sync_message_emission( ctx->baseObj.bus ); - g_signal_connect(ctx->baseObj.bus, "message::eos", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::error", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::warning", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::state-changed", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::segment-done", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::async-done", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::element", G_CALLBACK(bCtx->busCb), ctx ); - } - else - { - DEBUG_ERR("Failed to create message bus"); - return XA_RESULT_INTERNAL_ERROR; - } - - XAMetadataAdapt_PreInit(bCtx); - - /* create pipeline */ - ret = XAMediaPlayerAdapt_CreatePipeline(ctx); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to create Media Player pipeline"); - return ret; - } - - /* Init content pipe if used*/ - locType = *((XAuint32*)(ctx->xaSource->pLocator)); - if ( locType == XA_DATALOCATOR_CONTENTPIPE) - { - XAMediaPlayerAdapt_InitContentPipeSrc(ctx); - } - - -#ifdef XA_IMPL_MEASURE_GST_DELAY - ctx->baseObj.startTime = clock(); -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - /* roll up bin */ - ctx->baseObj.binWantedState = GST_STATE_PAUSED; - - XAAdaptationBase_PrepareAsyncWait(bCtx); - gret = gst_element_set_state( GST_ELEMENT(ctx->baseObj.bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for preroll"); - XAAdaptationBase_StartAsyncWait(bCtx); - DEBUG_INFO("Preroll ready"); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("Preroll FAILED"); - ret = XA_RESULT_INTERNAL_ERROR; - } - - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - - gret = gst_element_get_state( GST_ELEMENT(bCtx->bin), NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - if(GST_STATE(bCtx->bin)audioppbin && !(gst_pad_is_linked(gst_element_get_static_pad(ctx->audioppbin, "sink"))) ) - {/*could not find suitable pad for audiopipeline - remove it*/ - DEBUG_INFO("Warning! No suitable decodebin pad for audio pipeline!"); - gst_element_set_state( GST_ELEMENT(ctx->audioppbin), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->audioppbin); - gst_element_set_state( GST_ELEMENT(ctx->audiosink), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->audiosink); - } - else if( ctx->videoppbin && !(gst_pad_is_linked(gst_element_get_static_pad(ctx->videoppbin, "videopp_sink"))) ) - {/*could not find suitable pad for videopipeline - remove it*/ - DEBUG_INFO("Warning! No suitable decodebin pad for video pipeline!"); - gst_element_set_state( GST_ELEMENT(ctx->videoppbin), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->videoppbin); - gst_element_set_state( GST_ELEMENT(ctx->videosink), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->videosink); - } - gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - gst_element_get_state( GST_ELEMENT(bCtx->bin), NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - if(GST_STATE(bCtx->bin)==GST_STATE_PAUSED) - { - DEBUG_INFO("Retry preroll successful!") - ret = XA_RESULT_SUCCESS; - } - } - else - { - DEBUG_INFO("Preroll ready"); - } - /* - CP code: Removed because appsrc does not call any "need-data" signal after that. - locType = *((XAuint32*)(ctx->xaSource->pLocator)); - if( locType == XA_DATALOCATOR_CONTENTPIPE) - { - gboolean emit = gst_app_src_get_emit_signals( GST_APP_SRC( ctx->source)); - if( emit ) - { - gst_app_src_set_emit_signals( GST_APP_SRC( ctx->source), FALSE ); - } - }*/ -#ifdef XA_IMPL_MEASURE_GST_DELAY - bCtx->endTime = clock(); - double diff = bCtx->endTime - bCtx->startTime ; - diff = diff / CLOCKS_PER_SEC; - DEBUG_API_A1( "Starting up bin took %.4lf secs",diff); -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - videotest = gst_bin_get_by_name(GST_BIN(bCtx->bin), "videotest"); - if ( videotest && !ctx->isobjsrc ) - { - gst_element_set_state( GST_ELEMENT(videotest),GST_STATE_PLAYING); - } - - XAMetadataAdapt_PostInit(bCtx); - - if ( videotest ) - { - gst_object_unref(videotest); - } - - DEBUG_API("<-XAMediaPlayerAdapt_PostInit"); - return ret; -} - -/* - * void XAMediaPlayerAdapt_Destroy( XAMediaPlayerAdaptationCtx* ctx ) - * Destroys Media Player Adaptation Context - * @param ctx - Media Player Adaptation context to be destroyed - */ -void XAMediaPlayerAdapt_Destroy( XAAdaptationBaseCtx* bCtx ) -{ - XAMediaPlayerAdaptationCtx* ctx = NULL; - - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAMediaPlayerAdapt_Destroy"); - if(bCtx == NULL || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAMediaPlayerAdapt_Destroy"); - return; - } - ctx = (XAMediaPlayerAdaptationCtx*)bCtx; - - if( ctx->isobjsrc ) - { /* external source, unlink and remove now */ - /*gst_object_unparent( GST_OBJECT(ctx->source) );*/ - gst_element_unlink( ctx->source, ctx->codecbin ); - /*gst_bin_remove( GST_BIN(bCtx->bin), ctx->source );*/ - GST_OBJECT_FLAG_SET(GST_OBJECT(ctx->source),GST_OBJECT_FLOATING); - } -#if 0 - if ( ctx->xaSource ) - { - XAuint32 locType = *(XAuint32*)(ctx->xaSource->pLocator); - switch (locType ) - { - case XA_DATALOCATOR_IODEVICE: - { - XADataLocator_IODevice* ioDevice = (XADataLocator_IODevice*)(ctx->xaSource->pLocator); - if ( ioDevice->deviceType == XA_IODEVICE_RADIO ) - { - gst_object_unparent( GST_OBJECT(ctx->source) ); - gst_element_unlink( ctx->source, ctx->codecbin ); - gst_bin_remove( GST_BIN(bCtx->bin), ctx->source ); - GST_OBJECT_FLAG_SET(GST_OBJECT(ctx->source),GST_OBJECT_FLOATING); - } - } - default: - break; - } - } -#endif - - if( ctx->baseObj.pipeSrcThrCtx.dataHandle ) - { - XAuint32 locType = *(XAuint32*)(ctx->xaAudioSink->pLocator); - switch ( locType ) - { - case XA_DATALOCATOR_CONTENTPIPE: - { - res = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->Close(&(ctx->baseObj.pipeSrcThrCtx.dataHandle)); - if( res != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Cannot close contentpipe content"); - } - break; - } - default: - break; - } - } - - if( ctx->isobjasink && ctx->xaAudioSink && ctx->xaAudioSink->pLocator ) - { - XAuint32 locType = *(XAuint32*)(ctx->xaAudioSink->pLocator); - switch ( locType ) - { - case XA_DATALOCATOR_OUTPUTMIX: - { - XADataLocator_OutputMix* omix = (XADataLocator_OutputMix*)(ctx->xaAudioSink->pLocator); - XAOMixImpl* omixDevice = (XAOMixImpl*)(*omix->outputMix); - if(omixDevice) - { - XAOutputMixAdapt_DisconnectObject(omixDevice->adaptationCtx, bCtx); - } - break; - } - default: - /* Vibra and LED need no handling */ - break; - } - - } - - if( bCtx->bus ) - { - gst_bus_remove_signal_watch( bCtx->bus ); - gst_bus_disable_sync_message_emission ( bCtx->bus ); - } - XAAdaptationBase_CancelAsyncWait(bCtx); - - if( ctx->runpositiontimer ) - { - g_source_remove(ctx->runpositiontimer); - } - XAMetadataAdapt_FreeVars(ctx->metadatavars); - XAAdaptationBase_Free( bCtx ); - free(ctx); - ctx = NULL; - - DEBUG_API("<-XAMediaPlayerAdapt_Destroy"); -} - - -/* - * void XAMediaPlayerAdapt_CreatePipeline( XAMediaPlayerAdaptationCtx* ctx ); - */ -XAresult XAMediaPlayerAdapt_CreatePipeline( XAMediaPlayerAdaptationCtx* ctx ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAboolean delayedlink = XA_BOOLEAN_FALSE; - XAboolean isPCM = XA_BOOLEAN_FALSE; - XAboolean isRawImage = XA_BOOLEAN_FALSE; - XAMediaType mediatype; - XAuint32 locType = 0; - GstCaps* encSrcCaps; - DEBUG_API("->XAMediaPlayerAdapt_CreatePipeline"); - - /* create and add data source */ - XACommon_CheckDataSource(ctx->xaSource, &mediatype); - ctx->source = XAAdaptationBase_CreateGstSource( ctx->xaSource, "datasrc", &(ctx->isobjsrc), &isPCM, &isRawImage); - if( !(ctx->source) ) - { - DEBUG_ERR("Could not create data source!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - else - { - if(mediatype != XA_MEDIATYPE_AUDIO) - { - //temporary work around for video - encSrcCaps = gst_caps_new_simple ("video/h263-2000", - "framerate", GST_TYPE_FRACTION, 25, 1, - "pixel-aspect-ratio", GST_TYPE_FRACTION, 16, 9, - "width", G_TYPE_INT, 176, - "height", G_TYPE_INT, 144, - NULL); - g_object_set(G_OBJECT(ctx->source), "caps", encSrcCaps, NULL); - } - - //boolRetVal = gst_bin_add(GST_BIN(pipeline), appsrc); - - - } - - if ( !ctx->isobjsrc ) - { /* Add other than camera source to media player bin */ - DEBUG_INFO("No camera source"); - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->source); - } - else - { - GstCaps* encSrcCaps; - encSrcCaps = gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "framerate", GST_TYPE_FRACTION, 30, 1, - NULL); - DEBUG_INFO_A1("new camera encoding filter: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(ctx->source), "filter-caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - } - - /* create and add codec bin */ - if( !(ctx->isobjsrc || isPCM) ) - { - DEBUG_INFO("Create decodebin"); - if(mediatype == XA_MEDIATYPE_AUDIO) - { - ctx->codecbin = gst_element_factory_make( "decodebin" , "mpcodecbin" ); - } - else - { - ctx->codecbin = gst_element_factory_make( "identity" , "mpcodecbin" ); - } - } - else if(ctx->isobjsrc ) - { /* object sources produce framed raw data, decodebin only causes trouble */ //shyward - DEBUG_INFO("Create identity") - ctx->codecbin = gst_element_factory_make( "identity" , "mpcodecbin" ); - } - else if(isPCM) - { /* decodebin does not know how to handle PCM files */ - DEBUG_INFO("Create audioparse") - ctx->codecbin = gst_element_factory_make( "audioparse" , "mpcodecbin" ); - } - else if ( isRawImage) - { /* decodebin does not know how to handle raw unframed video data */ - DEBUG_INFO("Create videoparse") - ctx->codecbin = gst_element_factory_make( "videoparse", "mpcodecbin" ); - } - - if( ctx->codecbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->codecbin); - if ( !ctx->isobjsrc ) - { - if(mediatype == XA_MEDIATYPE_AUDIO) - { - if( !gst_element_link(ctx->source, ctx->codecbin) ) - { - DEBUG_ERR("Could not link source to decodebin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - if( !gst_element_link_filtered(ctx->source, ctx->codecbin, encSrcCaps ) ) - { - DEBUG_ERR("Could not link source to decodebin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } - else - { /* Link camera source by using ghost-pads, because elements are in different bins */ - - GstPad *cameraBinGhostPad=NULL; - GstPad* ghost=NULL; - GstElement *camTee=NULL; - GstStateChangeReturn gret; - GstPad *mpGhostSink=NULL; - - /* Set external camera source to ready for pipeline manipulation */ - DEBUG_INFO("Set ext-source PAUSED for pipeline manipulation"); - gret = gst_element_set_state( GST_ELEMENT(ctx->source), GST_STATE_READY); - gret = gst_element_get_state( GST_ELEMENT(ctx->source), NULL,NULL,XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - - /* Add new ghost-pad to external camera source */ - camTee = gst_bin_get_by_name( GST_BIN(ctx->source), "CamTee"); - if ( !camTee ) - { - DEBUG_ERR("Could not get tee-element from camera"); - } - cameraBinGhostPad = gst_element_get_request_pad( camTee, "src%d" ); - if ( !cameraBinGhostPad ) - { - DEBUG_ERR("Could not get new src-pad from CamTee element"); - } - gst_element_add_pad(ctx->source, gst_ghost_pad_new("MPObjSrc",cameraBinGhostPad)); - ghost = gst_element_get_static_pad( GST_ELEMENT(ctx->source), "MPObjSrc" ); - DEBUG_INFO_A2("Setting element:%s pad:%s to blocking.", - gst_element_get_name(ctx->baseObj.bin), - gst_pad_get_name(ghost)); - /* Set newly created pad to blocking */ - gst_pad_set_blocked_async(ghost, TRUE, XAAdaptationBase_PadBlockCb, NULL); - - - /* Create new ghost-pad to media player pipeline where external camera is connected */ - mpGhostSink = gst_element_get_static_pad( GST_ELEMENT(ctx->codecbin), "sink"); - gst_element_add_pad(ctx->baseObj.bin, gst_ghost_pad_new("MPObjSink",mpGhostSink)); - - if ( !gst_element_link_pads( GST_ELEMENT(ctx->source), "MPObjSrc", - GST_ELEMENT(ctx->baseObj.bin), "MPObjSink") ) - { - DEBUG_ERR("Could not link camera:MPObjSrc to videofilter:MPObjSink"); - return XA_RESULT_INTERNAL_ERROR; - } - - if ( cameraBinGhostPad ) - { - gst_object_unref( cameraBinGhostPad ); - } - if ( ghost ) - { - gst_object_unref( ghost ); - } - if ( mpGhostSink ) - { - gst_object_unref( mpGhostSink ); - } - if ( camTee ) - { - gst_object_unref( camTee ); - } - } - } - else - { - DEBUG_ERR("Could not create decoder bin!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* create and add video stream pipeline */ - if(!ctx->xaLEDArray && !ctx->xaVibra && mediatype!=XA_MEDIATYPE_AUDIO) /*no video for these*/ - { - /* create video processing pipeline */ - ctx->videoppbin = XAAdaptationBase_CreateVideoPP( ); - if( ctx->videoppbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videoppbin); - //shyward ---link filtered??? - // boolRetVal = gst_element_link_filtered(appsrc, videosink, caps); - //if(!gst_element_link(ctx->codecbin, ctx->videoppbin)) - if(!gst_element_link_filtered(ctx->codecbin, ctx->videoppbin,encSrcCaps)) - { - /* probably dynamic pads in codecbin */ - DEBUG_INFO("Could not link codec to videopp, trying delayed link"); - delayedlink = XA_BOOLEAN_TRUE; - } - ctx->videoScrSrcPad = gst_element_get_static_pad(ctx->videoppbin, "videopp_src"); - } - else - { - DEBUG_ERR("Could not create video pp bin!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - //shyward - /* Black screen pipeline not needed under Symbian. May need to revist for acceptance testing - ctx->videoppBScrbin = XAAdaptationBase_CreateVideoPPBlackScr( ); - if( ctx->videoppBScrbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videoppBScrbin); - ctx->blackScrSrcPad = gst_element_get_static_pad(ctx->videoppBScrbin, "videoppBSrc_src"); - } - else - { - DEBUG_ERR("Could not create video pp bin for black screen!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - */ - ctx->inputSelector = XAAdaptationBase_CreateInputSelector( ); - if( ctx->inputSelector ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->inputSelector); - ctx->videoScrSinkPad = gst_element_get_request_pad(ctx->inputSelector, "sink%d"); - ctx->blackScrSinkPad = gst_element_get_request_pad(ctx->inputSelector, "sink%d"); - gst_pad_link(ctx->blackScrSrcPad, ctx->blackScrSinkPad); - gst_pad_link(ctx->videoScrSrcPad, ctx->videoScrSinkPad); - } - - //shyward - We have no video filter at this time - /* - ctx->filter = gst_element_factory_make("ffmpegcolorspace", "videofilter"); - gst_bin_add( GST_BIN(ctx->baseObj.bin), ctx->filter); - if ( !gst_element_link( ctx->inputSelector, ctx->filter ) ) - { - DEBUG_ERR("Could not link ctx->filter <-> ctx->inputSelector"); - return XA_RESULT_INTERNAL_ERROR; - } - */ - /* create video pipe sink */ - ctx->videosink = XAAdaptationBase_CreateGstSink( ctx->xaVideoSink, "videosink", &(ctx->isobjvsink) ); - /* NOTE: no valid object sinks for video output available */ - if( ctx->videosink ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videosink); - - //shyward - //if(!gst_element_link(ctx->filter, ctx->videosink)) - if(!gst_element_link_filtered(ctx->videoppbin, ctx->videosink,encSrcCaps)) - { - DEBUG_ERR("Could not link videopp to videosink!!"); - return XA_RESULT_INTERNAL_ERROR; - } - else - { - gst_caps_unref(encSrcCaps); - } - } - else - { - DEBUG_ERR("Could not create video sink!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_INFO("Media does not contain video!"); - } - - /* create and add audio stream pipeline */ - - if(!ctx->xaLEDArray && !ctx->xaVibra && mediatype!=XA_MEDIATYPE_IMAGE) /*no audio for these*/ - { - /* create audio post processing pipeline */ - ctx->audioppbin = XAAdaptationBase_CreateAudioPP( ); - if( ctx->audioppbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audioppbin); - if(!gst_element_link(ctx->codecbin, ctx->audioppbin)) - { - DEBUG_INFO("Could not link codec to audiopp, trying delayed link"); - delayedlink = XA_BOOLEAN_TRUE; - } - } - else - { - DEBUG_ERR("Could not create audio pp bin!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* create audio pipe sink */ - ctx->audiosink = XAAdaptationBase_CreateGstSink( ctx->xaAudioSink, "audiosink", &(ctx->isobjasink) ); - if( ctx->audiosink ) - { - if( ctx->isobjasink && ctx->xaAudioSink && ctx->xaAudioSink->pLocator ) - { - locType = *(XAuint32*)(ctx->xaAudioSink->pLocator); - switch ( locType ) - { - case XA_DATALOCATOR_OUTPUTMIX: - { - XADataLocator_OutputMix* omix = (XADataLocator_OutputMix*)(ctx->xaAudioSink->pLocator); - XAOMixImpl* omixDevice = (XAOMixImpl*)(*omix->outputMix); - if(omixDevice) - { - XAOutputMixAdapt_ConnectObject(omixDevice->adaptationCtx, &(ctx->baseObj), ctx->audiosink); - } - break; - } - default: - /* Vibra and LED need no handling */ - break; - } - } - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audiosink); - if(!gst_element_link(ctx->audioppbin, ctx->audiosink)) - { - DEBUG_ERR("Could not link audiopp to audiosink!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Could not create audio sink!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_INFO("Media does not contain audio!"); - } - - if(delayedlink) - { - /* listen for dynamically created pads */ - g_signal_connect (ctx->codecbin, "pad-added", G_CALLBACK (XAMediaPlayerAdapt_NewPadCb), ctx); - } - locType = *((XAuint32*)(ctx->xaSource->pLocator)); - if( locType == XA_DATALOCATOR_CONTENTPIPE) - { - - g_signal_connect (ctx->source, "need-data", G_CALLBACK (need_data_for_prerolling), ctx); - g_signal_connect (ctx->source, "enough-data", G_CALLBACK (enough_data_for_prerolling), ctx); - g_signal_connect (ctx->source, "push-buffer", G_CALLBACK (push_data_for_prerolling), ctx); - } - DEBUG_API("<-XAMediaPlayerAdapt_CreatePipeline"); - return ret; -} - -/* - * gboolean XAMediaPlayerAdapt_PositionUpdate(gpointer ctx) - * callback. - * If position tracking enabled, periodic timer calls this method every XA_ADAPT_PU_INTERVAL msecs - * @return false to stop periodic calls - */ -gboolean XAMediaPlayerAdapt_PositionUpdate(gpointer ctx) -{ - XAAdaptationBaseCtx *bCtx = (XAAdaptationBaseCtx*) ctx; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) ctx; - gint64 position; - XAmillisecond posMsec; - GstFormat format = GST_FORMAT_TIME; - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - - DEBUG_API("->XAMediaPlayerAdapt_PositionUpdate"); - if ( !gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - DEBUG_ERR("Gst: Failed to get position"); - return( mCtx->runpositiontimer ); - } - DEBUG_INFO_A1("Current position %"GST_TIME_FORMAT, GST_TIME_ARGS(position)); - if( mCtx && mCtx->trackpositionenabled ) - { - posMsec = GST_TIME_AS_MSECONDS(position);/*Warning ok due to used API specification*/ - DEBUG_INFO_A1("mCtx->trackpositionenabled sending update, position:&ld ", posMsec); - /* send needed events */ - event.data=&posMsec; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - if( mCtx && mCtx->loopingenabled) - { - DEBUG_INFO_A2("mCtx->loopingenabled, current position:%lu, loopend:%lu ", position, mCtx->loopend); - if( (position >= mCtx->loopend) && - (mCtx->lastpos < mCtx->loopend) ) - { - DEBUG_INFO_A2("Restart loop from %"GST_TIME_FORMAT" to %"GST_TIME_FORMAT, - GST_TIME_ARGS(mCtx->loopstart), GST_TIME_ARGS(mCtx->loopend)); - gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_SET, mCtx->loopstart, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ); - mCtx->lastpos = mCtx->loopstart; - if( mCtx && mCtx->trackpositionenabled ) - { - DEBUG_INFO_A1("mCtx->trackpositionenabled sending looping update, position:%&u ", posMsec); - posMsec = GST_TIME_AS_MSECONDS(mCtx->lastpos);/*Warning ok due to used API specification*/ - /* send needed events */ - event.data=&posMsec; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - } - else - { - mCtx->lastpos = position; - } - } - DEBUG_API("<-XAMediaPlayerAdapt_PositionUpdate"); - /* return false to stop timer */ - return( mCtx->runpositiontimer ); -} - -/* - * XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer - * Enable/disable periodic position tracking callback timer - */ -XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer(XAMediaPlayerAdaptationCtx* mCtx) -{ - DEBUG_API_A2("->XAMediaPlayerAdapt_UpdatePositionCbTimer: trackposition %u, tracklooping %u", - mCtx->trackpositionenabled, mCtx->loopingenabled); - - if(mCtx->runpositiontimer==0 && (mCtx->trackpositionenabled || mCtx->loopingenabled)) - { - DEBUG_INFO("Start position tracking timer"); - mCtx->positionCb = &XAMediaPlayerAdapt_PositionUpdate; - /* if play is already on, create a timer to track position of playback */ - if( GST_STATE(mCtx->baseObj.bin) == GST_STATE_PLAYING ) - { - mCtx->runpositiontimer = g_timeout_add(XA_ADAPT_PU_INTERVAL, mCtx->positionCb, mCtx); - } - } - else if (mCtx->runpositiontimer!=0 && !(mCtx->trackpositionenabled || mCtx->loopingenabled)) - { - DEBUG_INFO("Stop position tracking timer"); - mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - } - DEBUG_API("<-XAMediaPlayerAdapt_UpdatePositionCbTimer"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAMediaPlayerAdapt_InitContentPipeSrc(ctx) - * CP code: can be moved to context base - */ -XAresult XAMediaPlayerAdapt_InitContentPipeSrc(XAMediaPlayerAdaptationCtx* ctx) -{ - XAresult ret = XA_RESULT_SUCCESS; - CPresult res; - /*GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS;*/ - DEBUG_API("->XAMediaPlayerAdapt_InitContentPipeSrc"); - ctx->baseObj.pipeSrcThrCtx.appSrc = GST_APP_SRC(ctx->source); - ctx->baseObj.pipeSrcThrCtx.pipe = (XADataLocator_ContentPipe*)(ctx->xaSource->pLocator); - - /* Create thread for content pipe source*/ - ret = XAImpl_CreateThreadHandle( &(ctx->baseObj.pipeSrcThr) ); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not create thread for content pipe source!"); - DEBUG_API("<-XAMediaPlayerAdapt_InitContentPipeSrc"); - return ret; - } - - /* Create semaphore for content pipe source */ - ret = XAImpl_CreateSemaphore( &(ctx->baseObj.pipeSrcThrCtx.stateSem)); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not create semaphore for content pipe source!"); - DEBUG_API("<-XAMediaPlayerAdapt_InitContentPipeSrc"); - return ret; - } - - /* Open content pipe */ - res = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->Open(&(ctx->baseObj.pipeSrcThrCtx.dataHandle), - (CPstring)(ctx->baseObj.pipeSrcThrCtx.pipe->URI), - CP_AccessRead ); - if ( res == EXIT_FAILURE ) - { - DEBUG_ERR("Could not open Content Pipe!") - return XA_RESULT_INTERNAL_ERROR; - } - - res = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->RegisterCallback( &(ctx->baseObj.pipeSrcThrCtx.dataHandle), &XAAdaptationBase_ContentPipeSrcCb); - if ( res == EXIT_FAILURE ) - { - DEBUG_ERR("Could not register content pipe callbacks!") - return XA_RESULT_INTERNAL_ERROR; - } - - /*gstRet = gst_element_set_state( GST_ELEMENT(ctx->source), GST_STATE_PAUSED); - gst_element_sync_state_with_parent( GST_ELEMENT( ctx->source));*/ - - XAImpl_StartThread( &(ctx->baseObj.pipeSrcThr), NULL, &XAAdaptationBase_ContentPipeScrThrFunc, &(ctx->baseObj.pipeSrcThrCtx) ); - - DEBUG_API("<-XAMediaPlayerAdapt_InitContentPipeSrc"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xamediaplayeradaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xamediaplayeradaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMEDIAPLAYERADAPTCTX_H -#define XAMEDIAPLAYERADAPTCTX_H - -#include "XAAdaptationContextBase.h" - -/* TYPEDEFS */ - -typedef struct XAMediaPlayerAdaptationCtx_ XAMediaPlayerAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAMediaPlayerAdapt_Create( XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray); -XAresult XAMediaPlayerAdapt_PostInit( XAAdaptationBaseCtx* bCtx ); -void XAMediaPlayerAdapt_Destroy( XAAdaptationBaseCtx* bCtx ); - -XAresult XAMediaPlayerAdapt_InitContentPipeSrc(XAMediaPlayerAdaptationCtx* ctx); -#endif /*XAMEDIAPLAYERADAPTCTX_H*/ - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xamediarecorderadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xamediarecorderadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1766 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "XAMediaRecorderAdaptCtx.h" -#include "XAAdaptation.h" -#include "XAMetadataAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -#define XA_ADAPTID_UNINITED 0 - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/*forward declarations*/ -GstElement* XAMediaRecorderAdapt_CreateEncodeBin( - XAMediaRecorderAdaptationCtx* ctx); -XAresult XAMediaRecorderAdapt_CreatePipeline( - XAMediaRecorderAdaptationCtx* ctx); -XAresult XAMediaRecorderAdapt_CreatePipeline_New( - XAMediaRecorderAdaptationCtx* ctx); -void XAMediaRecorderAdapt_BufferAvailable(GstElement* sink, - gpointer user_data); - -/* - * gboolean XAMediaRecorderAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * MediaPlayer Gst-bus message handler (Callback) - */ -gboolean XAMediaRecorderAdapt_GstBusCb(GstBus *bus, GstMessage *message, - gpointer data) - { - XAAdaptationBaseCtx* bCtx = (XAAdaptationBaseCtx*) data; - /* only listen to pipeline messages */ - if (GST_MESSAGE_SRC(message)==GST_OBJECT(bCtx->bin)) - { - XAMediaRecorderAdaptationCtx* mCtx = NULL; - DEBUG_API_A2("->XAMediaRecorderAdapt_GstBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - mCtx = (XAMediaRecorderAdaptationCtx*)data; - - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_EOS: - { - /* stop position tracking */ - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - - /* complete any ongoing client async operations */ - XAAdaptationBase_CompleteAsyncWait(bCtx); - - /* send needed events */ - { - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADATLIMIT, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - if(mCtx->positionCb) - { - mCtx->positionCb(bCtx); - } - bCtx->binWantedState = GST_STATE_PAUSED; - break; - } - case GST_MESSAGE_STATE_CHANGED: - { - GstState oldstate, newstate, pendingstate, gsttargetstate; - gst_message_parse_state_changed(message, &oldstate, &newstate, &pendingstate); - gsttargetstate = GST_STATE_TARGET(bCtx->bin); - DEBUG_INFO_A4("old %d -> new %d (-> pending %d -> gsttarget %d)", - oldstate, newstate, pendingstate, gsttargetstate); - if(gsttargetstate!=bCtx->binWantedState) - { - DEBUG_ERR_A1("WARNING: Gst target is not wanted target [%d]!!!", bCtx->binWantedState); - } - /* print out some more info */ - if( pendingstate == GST_STATE_VOID_PENDING ) - { - if( newstate != bCtx->binWantedState ) - { - DEBUG_INFO_A2("Gst in intermediate state transition (curr %d, target %d)", - newstate,bCtx->binWantedState); - } - else - { - DEBUG_INFO_A1("Gst in wanted target state (%d)",newstate); - } - } - if( oldstate!=GST_STATE_PLAYING && newstate==GST_STATE_PLAYING ) - { - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_RECORDEVENT_HEADMOVING, 0, NULL }; - /* send needed events */ - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - /* enable position tracking if needed */ - if( mCtx->runpositiontimer==0 && mCtx->trackpositionenabled && mCtx->positionCb ) - { - mCtx->runpositiontimer = g_timeout_add(XA_ADAPT_PU_INTERVAL, mCtx->positionCb, mCtx); - } - } - break; - } - - case GST_MESSAGE_ASYNC_DONE: - { - /* some async sequence ended */ - XAAdaptationBase_CompleteAsyncWait(bCtx); - break; - } - - case GST_MESSAGE_ERROR: - { - GError* error; - gchar* debug; - gst_message_parse_error(message, &error, &debug); - DEBUG_ERR_A1("Gst reports error \"%s\"", debug); - /* stop waiting any ongoing async operations */ - XAAdaptationBase_CompleteAsyncWait(bCtx); - break; - } - - default: - break; - } - DEBUG_API("<-XAMediaRecorderAdapt_GstBusCb"); - } - return TRUE; - } - -/* - * XAAdaptationBaseCtx* XAMediaRecorderAdapt_Create() - * Allocates memory for Media Recorder Adaptation Context and makes 1st phase initialization - * @param XADataSource *pAudioSrc - pointer to OMX-AL audio source - * @param XADataSource *pImageVideoSrc - pointer image/video source - * @param XADataSink *pDataSnk - pointer to OMX-AL sink - * @returns XAMediaRecorderAdaptationCtx* - Pointer to created context, NULL if error occurs. - */ -XAAdaptationBaseCtx* XAMediaRecorderAdapt_Create(XADataSource* pAudioSrc, - XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes) - { - XAMediaRecorderAdaptationCtx *pSelf = NULL; - XAuint32 locType = 0; - XADataLocator_IODevice *ioDevice; - DEBUG_API("->XAMediaRecorderAdapt_Create"); - - pSelf = calloc(1, sizeof(XAMediaRecorderAdaptationCtx)); - if (pSelf) - { - if (XAAdaptationBase_Init(&(pSelf->baseObj), - XAMediaRecorderAdaptation) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->xaAudioSource = pAudioSrc; - pSelf->xaVideoSource = pImageVideoSrc; - pSelf->xaSink = pDataSnk; - pSelf->baseObj.pipeSinkThrCtx.state = CPStateNull; - pSelf->xaRecordState = XA_RECORDSTATE_STOPPED; - pSelf->curMirror = XA_VIDEOMIRROR_NONE; - pSelf->curRotation = 0; - pSelf->recModes = recModes; - pSelf->isRecord = XA_BOOLEAN_FALSE; - - /* defaults from API spec */ - pSelf->imageEncSettings.width = 640; - pSelf->imageEncSettings.height = 480; - pSelf->imageEncSettings.compressionLevel = 0; - pSelf->imageEncSettings.encoderId = XA_IMAGECODEC_JPEG; - pSelf->imageEncSettings.colorFormat = XA_COLORFORMAT_UNUSED; - /* no specified defaults for rest, determined later from container type */ - pSelf->videoEncSettings.encoderId = XA_ADAPTID_UNINITED; - pSelf->videoEncSettings.width = 640; - pSelf->videoEncSettings.height = 480; - pSelf->videoEncSettings.frameRate = 15; - pSelf->audioEncSettings.encoderId = XA_ADAPTID_UNINITED; - pSelf->audioEncSettings.channelsIn = 2; - pSelf->audioEncSettings.channelsOut = 2; - pSelf->audioEncSettings.bitsPerSample = 8; - pSelf->audioEncSettings.bitRate = 128; - pSelf->audioEncSettings.sampleRate = 44100; - } - - if (pImageVideoSrc) - { - locType = *((XAuint32*) (pImageVideoSrc->pLocator)); - if (locType == XA_DATALOCATOR_IODEVICE) - { - ioDevice - = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator); - if (ioDevice->deviceType == XA_IODEVICE_CAMERA - && !cameraRealized) - { - DEBUG_ERR("Preconditions violated - Camera object not realized"); - XAAdaptationBase_Free(&pSelf->baseObj); - free(pSelf); - pSelf = NULL; - } - } - } - } - - DEBUG_API("<-XAMediaRecorderAdapt_Create"); - return (XAAdaptationBaseCtx*) pSelf; - } - -/* - * XAresult XAMediaRecorderAdapt_PostInit() - * 2nd phase initialization of Media Recorder Adaptation Context - * @param XAAdaptationBaseCtx* ctx - pointer to Media Recorder adaptation context - * @return XAresult - Success value - */ -XAresult XAMediaRecorderAdapt_PostInit(XAAdaptationBaseCtx* bCtx) - { - GstStateChangeReturn gret; - - XAresult ret = XA_RESULT_SUCCESS; - XAMediaRecorderAdaptationCtx* ctx = NULL; - DEBUG_API("->XAMediaRecorderAdapt_PostInit"); - if (bCtx == NULL || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - ret = XAAdaptationBase_PostInit(bCtx); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Base context postinit failed!!"); - return ret; - } - - /* top level bin for media recorder */ - bCtx->bin = gst_pipeline_new("media_recorder"); - - /* Create Gst bus listener. */ - ret = XAAdaptationBase_InitGstListener(bCtx); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Bus listener creation failed!!"); - return ret; - } - /* Add Media Recorder specific handler */ - if (bCtx->bus) - { - bCtx->busCb = XAMediaRecorderAdapt_GstBusCb; - gst_bus_add_signal_watch(bCtx->bus); - g_signal_connect(bCtx->bus, "message::eos", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(bCtx->bus, "message::error", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(bCtx->bus, "message::warning", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(bCtx->bus, "message::state-changed", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(bCtx->bus, "message::segment-done", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(bCtx->bus, "message::async-done", G_CALLBACK(bCtx->busCb), ctx ); - } - else - { - DEBUG_ERR("Failed to create message bus"); - return XA_RESULT_INTERNAL_ERROR; - } - - XAMetadataAdapt_PreInit(bCtx); - - /* create pipeline */ - ret = XAMediaRecorderAdapt_CreatePipeline(ctx); - //ret = XAMediaRecorderAdapt_CreatePipeline_New(ctx); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Failed to create recorder pipeline"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Init content pipe if used */ - if (ctx->xaSink && ctx->xaSink->pLocator - && *(XAuint32*) (ctx->xaSink->pLocator) - == XA_DATALOCATOR_CONTENTPIPE) - { - XAMediaRecorderAdapt_InitContentPipeSink(ctx); - } - -#ifdef XA_IMPL_MEASURE_GST_DELAY - bCtx->startTime = clock(); -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - /* roll up bin */ - bCtx->binWantedState = GST_STATE_PAUSED; - XAAdaptationBase_PrepareAsyncWait(bCtx); - gret = gst_element_set_state(GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - if (gret == GST_STATE_CHANGE_ASYNC) - { - DEBUG_INFO("Wait for preroll"); - XAAdaptationBase_StartAsyncWait(bCtx);DEBUG_INFO("Preroll ready"); - } - else if (gret == GST_STATE_CHANGE_FAILURE) - { - DEBUG_ERR("Preroll FAILED"); - /*ret = XA_RESULT_INTERNAL_ERROR;*/ - } -#ifdef XA_IMPL_MEASURE_GST_DELAY - bCtx->endTime = clock(); - double diff = bCtx->endTime - bCtx->startTime; - diff = diff / CLOCKS_PER_SEC; - DEBUG_API_A1( "Starting up bin took %.4lf secs",diff); -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - XAMetadataAdapt_PostInit(bCtx); - - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); - return ret; - } - -/* - * void XAMediaRecorderAdapt_Destroy( XAAdaptationBaseCtx* bCtx ) - * Destroys Media Recorder Adaptation Context - * @param ctx - Media Recorder Adaptation context to be destroyed - */ -void XAMediaRecorderAdapt_Destroy(XAAdaptationBaseCtx* bCtx) - { - XAMediaRecorderAdaptationCtx* ctx = NULL; - char* fname = NULL; - DEBUG_API("->XAMediaRecorderAdapt_Destroy"); - - if (bCtx == NULL || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMediaRecorderAdapt_Destroy"); - return; - } - ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - if (ctx->isRecord == XA_BOOLEAN_FALSE) - { - DEBUG_INFO("Removing unnecessary file."); - - if (ctx->xaSink && *((XAuint32*) (ctx->xaSink->pLocator)) - == XA_DATALOCATOR_URI) - { - if (strncmp( - (char *) ((XADataLocator_URI*) (ctx->xaSink->pLocator))->URI, - "file://", 7) == 0) - { - fname - = (char *) &(((XADataLocator_URI*) (ctx->xaSink->pLocator))->URI[7]); - } - else - { - fname - = (char *) ((XADataLocator_URI*) (ctx->xaSink->pLocator))->URI; - } - - if (remove(fname) != 0) - { - DEBUG_ERR_A1("Cannot remove file %s", fname); - } - } - } - - if (ctx->isobjvsrc && ctx->videosource) - { /* external source, unlink now */ - gst_element_unlink(ctx->videosource, ctx->codecbin); - GST_OBJECT_FLAG_SET(GST_OBJECT(ctx->videosource),GST_OBJECT_FLOATING); - } - if (bCtx->bus) - { - gst_bus_remove_signal_watch(bCtx->bus); - } - XAAdaptationBase_CancelAsyncWait(bCtx); - - if (ctx->runpositiontimer) - { - g_source_remove(ctx->runpositiontimer); - } - XAAdaptationBase_Free(bCtx); - - free(ctx); - ctx = NULL; - - DEBUG_API("<-XAMediaRecorderAdapt_Destroy"); - } - -/***************** INTERNAL FUNCTIONS *******************************/ - -XAresult XAMediaRecorderAdapt_CreatePipeline_New( - XAMediaRecorderAdaptationCtx* ctx) - { - XADataLocator_URI* uri; - GstCaps* caps; - gboolean ok; - - //Create gst source - ctx->audiosource - = gst_element_factory_make("devsoundsrc", "record_audio"); - if (!ctx->audiosource) - { - g_print("could not create \"record\" element!"); - return XA_RESULT_INTERNAL_ERROR; - } - - ctx->datasink = gst_element_factory_make("filesink", "filesink"); - if (!ctx->datasink) - { - g_print("could not create \"filesink\" element!"); - return XA_RESULT_INTERNAL_ERROR; - } - - ctx->codecbin = gst_element_factory_make("wavenc", "wavencoder"); - if (!ctx->codecbin) - { - g_print("could not create \"wavenc\" element!"); - return XA_RESULT_INTERNAL_ERROR; - } - uri = (XADataLocator_URI*) ctx->xaSink->pLocator; - - if (uri->URI != NULL) - { - XAchar *fname; - DEBUG_INFO_A1("URI: %s", uri->URI); - if (strncmp((char *) uri->URI, "file://", 7) == 0) - { - fname = &((uri->URI)[7]); - } - else - { - fname = uri->URI; - }DEBUG_INFO_A1("->filesystem path %s", fname); - g_object_set( G_OBJECT(ctx->datasink),"location", fname, - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - NULL); - - //g_object_set(G_OBJECT(ctx->datasink), "location", fname, NULL); - } - - // ctx->audioppbin = XAAdaptationBase_CreateAudioPP( ); - //gst_bin_add_many(GST_BIN (ctx->baseObj.bin), ctx->audiosource, ctx->audioppbin, ctx->codecbin,ctx->datasink, NULL); - - gst_bin_add_many(GST_BIN (ctx->baseObj.bin), ctx->audiosource, ctx->codecbin,ctx->datasink, NULL); - - caps = gst_caps_new_simple ("audio/x-raw-int", - "width", G_TYPE_INT, 16, - "depth", G_TYPE_INT, 16, - "signed",G_TYPE_BOOLEAN, TRUE, - "endianness",G_TYPE_INT, G_BYTE_ORDER, - "rate", G_TYPE_INT, 16000, - "channels", G_TYPE_INT, 1, NULL); - - ok = gst_element_link_filtered (ctx->audiosource, ctx->codecbin, caps); - if(!ok) - { - DEBUG_ERR("Could not link audiosrc to codecbin!!"); - } - ok = gst_element_link (ctx->codecbin, ctx->datasink); - if(!ok) - { - DEBUG_ERR("Could not link codecbin to datasink!!"); - } - gst_caps_unref (caps); - - return XA_RESULT_SUCCESS; - } - /* - * void XAMediaRecorderAdapt_CreatePipeline( XAMediaRecorderAdaptationCtx* ctx ); - */ - XAresult XAMediaRecorderAdapt_CreatePipeline( - XAMediaRecorderAdaptationCtx* ctx) - { - XAresult ret = XA_RESULT_SUCCESS; - GstCaps* encSrcCaps = NULL; - DEBUG_API("->XAMediaRecorderAdapt_CreatePipeline"); - - /* create and add video pipeline */ - ctx->codecbin = XAMediaRecorderAdapt_CreateEncodeBin(ctx); - if (ctx->codecbin) - { - if (gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->codecbin)) - { - DEBUG_API("->XAMediaRecorderAdapt_CreatePipeline: gst_bin_add success"); - } - else - { - DEBUG_ERR("Could not add codec bin"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Could not create encoding bin!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* create and add video pipeline if video source available and codec supports video */ - if (ctx->xaVideoSource - && gst_element_get_pad(ctx->codecbin, "v_sink")) - { - /* create video pipe source */ - ctx->videosource = XAAdaptationBase_CreateGstSource( - ctx->xaVideoSource, "videosource", &(ctx->isobjvsrc), - NULL, NULL ); - if (!ctx->videosource) - { - DEBUG_ERR("Could not create video source!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - if (!ctx->isobjvsrc) - { /* Add other than camera sources to media recorder bin */ - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videosource); - } - else - { /* Don't add camera source to media recorder bin */ - GstCaps * encSrcCaps; - encSrcCaps = gst_caps_new_simple( "video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "framerate", GST_TYPE_FRACTION, ctx->videoEncSettings.frameRate, 1, - NULL); - DEBUG_INFO_A1("new camera encoding filter: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(ctx->videosource), "filter-caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - } - /* create video filter for video encoder settings */ - ctx->videofilter = gst_element_factory_make("capsfilter", "videofilter"); - if( ctx->videofilter ) - { - GstCaps* encSrcCaps; - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videofilter); - encSrcCaps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, ctx->videoEncSettings.width, - "height", G_TYPE_INT, ctx->videoEncSettings.height, - "framerate", GST_TYPE_FRACTION, ctx->videoEncSettings.frameRate, 1, - NULL); - DEBUG_INFO_A1("video encoder config from settings: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(ctx->videofilter), "caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - if ( ! ctx->isobjvsrc ) - { - if(!gst_element_link(ctx->videosource, ctx->videofilter)) - { - DEBUG_ERR("Could not link videopp to videofilter!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { /* For camera source used ghost-pads for linking, because elements are in different bins */ - GstStateChangeReturn gret; - GstElement *camTee=NULL; - GstPad *cameraBinGhostPad=NULL; - GstPad *ghost=NULL; - GstPad *mrGhostSink=NULL; - - DEBUG_INFO("Set ext-source PAUSED for pipeline manipulation"); - gret = gst_element_set_state( GST_ELEMENT(ctx->videosource), GST_STATE_READY); - gret = gst_element_get_state( GST_ELEMENT(ctx->videosource), NULL,NULL,XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - - /* Add new ghost-pad to external camera source */ - camTee = gst_bin_get_by_name( GST_BIN(ctx->videosource), "CamTee"); - if ( !camTee ) - { - DEBUG_ERR("Could not get tee-element from camera"); - } - cameraBinGhostPad = gst_element_get_request_pad( camTee, "src%d" ); - if ( !cameraBinGhostPad ) - { - DEBUG_ERR("Could not get new src-pad from CamTee element"); - } - gst_element_add_pad(ctx->videosource, gst_ghost_pad_new("MRObjSrc",cameraBinGhostPad)); - ghost = gst_element_get_static_pad( GST_ELEMENT(ctx->videosource), "MRObjSrc" ); - DEBUG_INFO_A2("Setting element:%s pad:%s to blocking.", - gst_element_get_name(ctx->baseObj.bin), - gst_pad_get_name(ghost)); - /* Set newly created pad to blocking */ - gst_pad_set_blocked_async(ghost, TRUE, XAAdaptationBase_PadBlockCb, NULL); - - mrGhostSink = gst_element_get_static_pad( GST_ELEMENT(ctx->videofilter), "sink"); - gst_element_add_pad(ctx->baseObj.bin, gst_ghost_pad_new("MRObjSink",mrGhostSink)); - if ( !gst_element_link_pads( GST_ELEMENT(ctx->videosource), "MRObjSrc", - GST_ELEMENT(ctx->baseObj.bin), "MRObjSink") ) - { - DEBUG_ERR("Could not link camera:MRObjSrc to videofilter:MRObjSink"); - return XA_RESULT_INTERNAL_ERROR; - } - - if ( cameraBinGhostPad ) - { - gst_object_unref( cameraBinGhostPad ); - } - if ( ghost ) - { - gst_object_unref( ghost ); - } - if ( mrGhostSink ) - { - gst_object_unref( mrGhostSink ); - } - if ( camTee ) - { - gst_object_unref( camTee ); - } - } - } - /* create video processing pipeline */ -#ifdef XA_IMPL_FIXED_VIDEO_SIZE - ctx->videoppbin = XAAdaptationBase_CreateFixedSizeVideoPP( ); -#else - ctx->videoppbin = XAAdaptationBase_CreateVideoPP( ); -#endif - if( ctx->videoppbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videoppbin); - if(!gst_element_link(ctx->videofilter, ctx->videoppbin)) - { - DEBUG_ERR("Could not link videofilter to videopp!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Could not create video pp bin!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* create identity to extract buffers from */ - ctx->videoextract = gst_element_factory_make("identity", "videoextract"); - if( ctx->videoextract ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videoextract); - if(!gst_element_link(ctx->videoppbin, ctx->videoextract)) - { - DEBUG_ERR("Could not link videopp to videoextract!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Could not create videoextract!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - if( ctx->videoextract ) - { - if( !gst_element_link_pads(ctx->videoextract, "src", ctx->codecbin, "v_sink") ) - { - DEBUG_INFO("Warning: could not link videoextract to codec!!"); - } - } - } - else - { - DEBUG_INFO("No video input"); - } - - /* create and add audio pipeline */ - if ( ctx->xaAudioSource && gst_element_get_pad(ctx->codecbin, "sink") ) - { - /* create audio pipe source */ - ctx->audiosource = XAAdaptationBase_CreateGstSource( ctx->xaAudioSource, "audiosource", - &(ctx->isobjasrc), NULL, NULL ); - if( ctx->audiosource ) - { - if (gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audiosource)) - { - DEBUG_INFO("Added audiosource to bin"); - } - else - { - DEBUG_ERR("Could not add audiosource to bin"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Could not create audio source!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* create audio processing pipeline */ - ctx->audioppbin = XAAdaptationBase_CreateAudioPP( ); - if( ctx->audioppbin ) - { - if (gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audioppbin)) - { - DEBUG_INFO("Added audioppbin to bin"); - } - else - { - DEBUG_ERR("Could not add audioppbin to bin"); - return XA_RESULT_INTERNAL_ERROR; - } -/* if(!gst_element_link(ctx->audiosource, ctx->audioppbin)) - { - DEBUG_ERR("Could not link audiofilter to audiopp!!"); - return XA_RESULT_INTERNAL_ERROR; - } -*/ - - } - else - { - DEBUG_ERR("Could not create audio pp bin!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* create audio filter for audio encoder settings */ - ctx->audiofilter = gst_element_factory_make("capsfilter", "audiofilter"); - if( ctx->audiofilter ) - { - // GstCaps* encSrcCaps; TL - if (gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audiofilter)) - { - DEBUG_INFO("Added audiofilter to bin"); - } - else - { - DEBUG_ERR("Could not add audio filter to bin"); - return XA_RESULT_INTERNAL_ERROR; - } - encSrcCaps = gst_caps_new_full( - gst_structure_new("audio/x-raw-int", - "width", G_TYPE_INT, 16, - "depth", G_TYPE_INT, 16, - "signed",G_TYPE_BOOLEAN, 1, - "endianness",G_TYPE_INT, 1234, - "rate", G_TYPE_INT, 16000, - "bitrate", G_TYPE_INT, ctx->audioEncSettings.bitRate, - "channels", G_TYPE_INT, 1, NULL), - /*gst_structure_new("audio/x-raw-int", - "channels", G_TYPE_INT, ctx->audioEncSettings.channelsOut, - "rate", G_TYPE_INT, ctx->audioEncSettings.sampleRate, - "bitrate", G_TYPE_INT, ctx->audioEncSettings.bitRate, - NULL),*/ - gst_structure_new("audio/x-raw-float", - "channels", G_TYPE_INT, ctx->audioEncSettings.channelsOut, - "width", G_TYPE_INT, ctx->audioEncSettings.bitsPerSample, - "rate", G_TYPE_INT, ctx->audioEncSettings.sampleRate, - "bitrate", G_TYPE_INT, ctx->audioEncSettings.bitRate, - NULL), - NULL); - DEBUG_INFO_A1("audio encoder config from settings: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(ctx->audiofilter), "caps",encSrcCaps,NULL); - - if(!gst_element_link(ctx->audiosource, ctx->audiofilter)) - { - DEBUG_ERR("Could not link audiosource to audiofilter!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - } -/* if( !gst_element_link_pads_filtered(ctx->audiofilter, "src", ctx->codecbin, "sink", encSrcCaps) ) - { - DEBUG_INFO("Warning: could not link audiopp to codec!!"); - return XA_RESULT_INTERNAL_ERROR; - } -*/ - if (!gst_element_link_filtered( ctx->audiofilter , ctx->audioppbin ,encSrcCaps)) - { - DEBUG_INFO("Warning: could not link audiosource to audiopp!!"); - return XA_RESULT_INTERNAL_ERROR; - } - if(!gst_element_link(ctx->audioppbin, ctx->codecbin)) - { - DEBUG_INFO("Warning: could not link audioppbin to codecbin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_INFO("No audio input"); - } - gst_caps_unref(encSrcCaps); - - /* create and add data sink */ - ctx->datasink = XAAdaptationBase_CreateGstSink( ctx->xaSink, "datasink", &(ctx->isobjsink) ); - if( ctx->datasink ) - { - if ( GST_IS_APP_SINK(ctx->datasink) ) - { - gst_app_sink_set_emit_signals( GST_APP_SINK(ctx->datasink), TRUE ); - } - if (gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->datasink)) - { - DEBUG_INFO("Added datasink to bin"); - } - else - { - DEBUG_ERR("Could not add datasink to bin"); - return XA_RESULT_INTERNAL_ERROR; - } - if(!gst_element_link(ctx->codecbin, ctx->datasink)) - { - DEBUG_ERR("Could not link codec to sink!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* NOTE: no actual object sinks applicable, variable used to imply appsrc (recording to memory)*/ - if(ctx->isobjsink) - { - g_signal_connect(ctx->datasink, "new-buffer", - G_CALLBACK (XAMediaRecorderAdapt_BufferAvailable),ctx); - - ret = XAImpl_CreateSemaphore( &(ctx->recThrCtx.bufInsufficientSem)); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("WARN: Could not create semaphore for recorder event handler!"); - } - XAImpl_CreateThreadHandle( &(ctx->recordingEventThr) ); - } - } - else - { - DEBUG_ERR("Could not create data sink!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - DEBUG_API("<-XAMediaRecorderAdapt_CreatePipeline"); - return ret; - } - - /* - * XAresult XAMediaRecorderAdapt_CheckCodec( XAMediaRecorderAdaptationCtx_* mCtx ); - * Check codec compatibility and support with initiated datasink content - */ - XAresult XAMediaRecorderAdapt_CheckCodec( XAMediaRecorderAdaptationCtx_* mCtx, XACapsType encType, XAuint32 encoderId ) - { - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 format; - XAStaticCapsData temp; - - DEBUG_API("->XAMediaRecorderAdapt_CheckCodec"); - - /*first, check if codec supported at all*/ - ret = XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|encType, encoderId, &temp); - - if( ret==XA_RESULT_SUCCESS ) - { - if(encType & (XACAP_VIDEO|XACAP_AUDIO)) - { - if(mCtx->xaSink && mCtx->xaSink->pFormat) - { - format = *(XAuint32*)(mCtx->xaSink->pFormat); - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - } - else - { - if(mCtx->snapshotVars.xaSink && mCtx->snapshotVars.xaSink->pFormat) - { - format = *(XAuint32*)(mCtx->snapshotVars.xaSink->pFormat); - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - } - if(ret==XA_RESULT_SUCCESS) switch ( format ) - { - case XA_DATAFORMAT_PCM: - if ( (encType == XACAP_AUDIO) && (encoderId == XA_AUDIOCODEC_PCM) ) - { - ret=XA_RESULT_SUCCESS; - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - case XA_DATAFORMAT_RAWIMAGE: - if ( (encType == XACAP_IMAGE) && (encoderId == XA_IMAGECODEC_RAW) ) - { - ret=XA_RESULT_SUCCESS; - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - case XA_DATAFORMAT_MIME: - DEBUG_INFO("XA_DATAFORMAT_MIME "); - { - XADataFormat_MIME* mime = ((XADataFormat_MIME*)mCtx->xaSink->pFormat); - DEBUG_INFO_A1("mime->containerType:%u",(int)mime->containerType); - DEBUG_INFO_A1("mime->mimeType:%s",mime->mimeType); - switch ( mime->containerType ) - { - case XA_CONTAINERTYPE_RAW: - if( ((encType == XACAP_AUDIO) && (encoderId == XA_AUDIOCODEC_PCM)) || - ((encType == XACAP_VIDEO) && (encoderId == XA_ADAPTID_RAWVIDEO)) || - ((encType == XACAP_IMAGE) && (encoderId == XA_IMAGECODEC_RAW)) ) - { - ret=XA_RESULT_SUCCESS; - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - case XA_CONTAINERTYPE_AVI: - if(encType == XACAP_VIDEO) - { - switch(encoderId) - { - case XA_ADAPTID_MOTIONJPEG: - case XA_ADAPTID_RAWVIDEO: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else if(encType == XACAP_AUDIO) - { - switch(encoderId) - { - case XA_AUDIOCODEC_PCM: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - case XA_CONTAINERTYPE_WAV: - if(encType == XACAP_AUDIO) - { - switch(encoderId) - { - case XA_AUDIOCODEC_PCM: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - case XA_CONTAINERTYPE_JPG: - if(encType == XACAP_VIDEO) - { - switch(encoderId) - { - case XA_ADAPTID_MOTIONJPEG: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else if(encType == XACAP_IMAGE) - { - switch(encoderId) - { - case XA_IMAGECODEC_JPEG: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - case XA_CONTAINERTYPE_UNSPECIFIED: - if(strstr( (char *) mime->mimeType, "/ogg") != 0) - { - if(encType == XACAP_VIDEO) - { - switch(encoderId) - { - case XA_ADAPTID_THEORA: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else if(encType == XACAP_AUDIO) - { - switch(encoderId) - { - case XA_ADAPTID_VORBIS: - ret=XA_RESULT_SUCCESS; - break; - default: - ret=XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - } - else - { - ret=XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - - default: /*switch (containertype)*/ - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - break; - } - default: /*switch (format)*/ - ret = XA_RESULT_CONTENT_UNSUPPORTED; - break; - } - } - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("cannot accommodate given codec & datasink pair!!!"); - } - DEBUG_API("<-XAMediaRecorderAdapt_CheckCodec"); - return ret; - } - /* - * XAresult XAMediaRecorderAdapt_ChangeEncoders( XAMediaRecorderAdaptationCtx* mCtx ); - * re-create encodebin based on new encoder settings - */ - XAresult XAMediaRecorderAdapt_ChangeEncoders( XAMediaRecorderAdaptationCtx* mCtx ) - { - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptationBaseCtx* bCtx = &(mCtx->baseObj); - - DEBUG_API("->XAMediaRecorderAdapt_ChangeEncoders"); - /* check state */ - if(GST_STATE(mCtx->baseObj.bin)binWantedState = GST_STATE_READY; - gret = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - gret = gst_element_get_state( GST_ELEMENT(bCtx->bin), NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - - /*set new stream settings*/ - if( mCtx->videofilter ) - { - encSrcCaps = gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "width", G_TYPE_INT, mCtx->videoEncSettings.width, - "height", G_TYPE_INT, mCtx->videoEncSettings.height, - "framerate", GST_TYPE_FRACTION, mCtx->videoEncSettings.frameRate, 1, - NULL); - DEBUG_INFO_A1("new video encoder config from settings: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(mCtx->videofilter), "caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - } - if( mCtx->audiofilter ) - { - encSrcCaps = gst_caps_new_full( - gst_structure_new("audio/x-raw-int", - "channels", G_TYPE_INT, mCtx->audioEncSettings.channelsOut, - "rate", G_TYPE_INT, mCtx->audioEncSettings.sampleRate, - "bitrate", G_TYPE_INT, mCtx->audioEncSettings.bitRate, - NULL), - gst_structure_new("audio/x-raw-float", - "channels", G_TYPE_INT, mCtx->audioEncSettings.channelsOut, - "width", G_TYPE_INT, mCtx->audioEncSettings.bitsPerSample, - "rate", G_TYPE_INT, mCtx->audioEncSettings.sampleRate, - "bitrate", G_TYPE_INT, mCtx->audioEncSettings.bitRate, - NULL), - NULL); - DEBUG_INFO_A1("new audio encoder config from settings: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(mCtx->audiofilter), "caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - } - - if(mCtx->isobjvsrc) - { - moSrc = gst_element_get_static_pad(mCtx->videosource,"MRObjSrc"); - moSink = gst_pad_get_peer(moSrc); - if(moSink) - { - gst_pad_unlink(moSrc,moSink); - } - moSrc = gst_element_get_static_pad(mCtx->videosource,"mediaobjectsrc"); - encSrcCaps = gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "framerate", GST_TYPE_FRACTION, mCtx->videoEncSettings.frameRate, 1, - NULL); - DEBUG_INFO_A1("new camera encoding filter: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(mCtx->videosource), "filter-caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - } - - DEBUG_INFO("Unlink and remove old encodebin"); - asink = gst_element_get_static_pad(mCtx->codecbin,"sink"); - if(asink) - { - linkedasrc = gst_pad_get_peer(asink); - if(linkedasrc) - { - gst_pad_unlink(linkedasrc,asink); - } - } - vsink = gst_element_get_static_pad(mCtx->codecbin,"v_sink"); - if(vsink) - { - linkedvsrc = gst_pad_get_peer(vsink); - if(linkedvsrc) - { - gst_pad_unlink(linkedvsrc,vsink); - } - } - src = gst_element_get_static_pad(mCtx->codecbin,"src"); - if(src) - { - linkedsink = gst_pad_get_peer(src); - if(linkedsink) - { - gst_pad_unlink(src,linkedsink); - } - } - - gst_element_set_state( GST_ELEMENT(mCtx->codecbin), GST_STATE_NULL ); - gst_element_get_state( GST_ELEMENT(mCtx->codecbin),NULL,NULL,1000 ); - gst_bin_remove( GST_BIN(bCtx->bin), mCtx->codecbin ); - /*reset filesink too*/ - gst_element_set_state(GST_ELEMENT(mCtx->datasink),GST_STATE_NULL); - gst_element_sync_state_with_parent(mCtx->datasink); - gst_element_get_state(mCtx->datasink,NULL,NULL,XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - - DEBUG_INFO("Link new encodebin"); - mCtx->codecbin = newBin; - gst_bin_add(GST_BIN(bCtx->bin), mCtx->codecbin); - asink = gst_element_get_static_pad(mCtx->codecbin,"sink"); - if(asink && linkedasrc) - { - gst_pad_link(linkedasrc,asink); - } - vsink = gst_element_get_static_pad(mCtx->codecbin,"v_sink"); - if(vsink && linkedvsrc) - { - gst_pad_link(linkedvsrc,vsink); - } - src = gst_element_get_static_pad(mCtx->codecbin,"src"); - if(src && linkedsink) - { - gst_pad_link(src,linkedsink); - } - - if(mCtx->isobjvsrc) - { - moSrc = gst_element_get_static_pad(mCtx->videosource,"MRObjSrc"); - if(moSink&&moSrc) - { - gst_pad_link(moSrc,moSink); - } - } - - /*re-roll*/ - DEBUG_INFO("Reroll pipeline"); - bCtx->binWantedState = GST_STATE_PAUSED; - gret = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for reroll"); - XAAdaptationBase_StartAsyncWait(bCtx); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("reroll FAILED"); - ret = XA_RESULT_INTERNAL_ERROR; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - DEBUG_INFO_A1("Pipeline in state %s",gst_element_state_get_name(GST_STATE(bCtx->bin))); - } - else - { - /* could not support wanted encoders */ - DEBUG_ERR("Failed to create encodebin with new settings, using old one!"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - } - else - { /* n/a while playing */ - DEBUG_ERR("Cannot change encoder when recording ongoing!"); - ret = XA_RESULT_PRECONDITIONS_VIOLATED; - } - DEBUG_API("<-XAMediaRecorderAdapt_ChangeEncoders"); - return ret; - } - - /** - * GstElement* XAMediaRecorderAdapt_CreateEncodeBin( XAMediaRecorderAdaptationCtx* ctx ) - * @return GstElement* - pointer to created bin element - * Decription: Create encoder/muxer element based on given format and encoder settings - */ - GstElement* XAMediaRecorderAdapt_CreateEncodeBin( XAMediaRecorderAdaptationCtx* ctx ) - { - XAresult ret = XA_RESULT_SUCCESS; - GstElement *audioenc = NULL, *videoenc=NULL, *mux=NULL; - GstElement *codecbin = gst_bin_new( "mrcodecbin" ); - GstPad *ghostsrc = NULL, *ghostaudiosink = NULL, *ghostvideosink = NULL; - XAuint32 format; - XAStaticCapsData temp; - - DEBUG_API("->XAMediaRecorderAdapt_CreateEncodeBin"); - if(ctx->recModes & XA_RECMODE_STREAM) - { - if(ctx->xaSink && ctx->xaSink->pFormat) - { - format = *(XAuint32*)(ctx->xaSink->pFormat); - switch ( format ) - { - case XA_DATAFORMAT_PCM: - DEBUG_INFO("XA_DATAFORMAT_PCM"); - { - XADataFormat_PCM* pcm = ((XADataFormat_PCM*)ctx->xaSink->pFormat); - if(!ctx->xaAudioSource) - { - DEBUG_ERR("Unsupported dataformat for given data sources"); - return NULL; - } - /* no need for codec, just pass data on */ - mux = gst_element_factory_make("identity", "mux"); - gst_bin_add(GST_BIN(codecbin), mux); - ghostsrc = gst_element_get_static_pad(mux,"src"); - ghostaudiosink = gst_element_get_static_pad(mux,"sink"); - /*set usable audio settings from the sink structure*/ - ctx->audioEncSettings.encoderId = XA_AUDIOCODEC_PCM; - ctx->audioEncSettings.channelsOut = pcm->numChannels; - ctx->audioEncSettings.bitsPerSample = pcm->bitsPerSample; - } - break; - - case XA_DATAFORMAT_RAWIMAGE: - DEBUG_INFO("XA_DATAFORMAT_RAWIMAGE"); - { - XADataFormat_RawImage* img = ((XADataFormat_RawImage*)ctx->xaSink->pFormat); - if(!ctx->xaVideoSource) - { - DEBUG_ERR("Unsupported dataformat for given data sources"); - return NULL; - } - /* no need for codec, just pass data on */ - mux = gst_element_factory_make("identity", "mux"); - gst_bin_add(GST_BIN(codecbin), mux); - ghostsrc = gst_element_get_static_pad(mux,"src"); - ghostvideosink = gst_element_get_static_pad(mux,"sink"); - /*set needed image settings from the sink structure*/ - ctx->imageEncSettings.encoderId = XA_IMAGECODEC_RAW; - ctx->imageEncSettings.width = img->width; - ctx->imageEncSettings.height = img->height; - ctx->imageEncSettings.colorFormat = img->colorFormat; - } - break; - - case XA_DATAFORMAT_MIME: - DEBUG_INFO("XA_DATAFORMAT_MIME "); - { - XADataFormat_MIME* mime = ((XADataFormat_MIME*)ctx->xaSink->pFormat); - DEBUG_INFO_A1("mime->containerType:%u",(int)mime->containerType); - DEBUG_INFO_A1("mime->mimeType:%s",mime->mimeType); - switch ( mime->containerType ) - { - case XA_CONTAINERTYPE_AVI: - DEBUG_INFO("XA_CONTAINERTYPE_AVI"); - mux = gst_element_factory_make("avimux", "mux"); - if(mux) - { - if (gst_bin_add(GST_BIN(codecbin), mux)) - { - DEBUG_INFO("Added mux to codecbin"); - } - else - { - DEBUG_ERR("Could not add mux to codecbin"); - return NULL; - } - /*use this as linkpoint*/ - ghostsrc = gst_element_get_static_pad(mux,"src"); - } - /* Add and link audio/video codecs */ - /*set video defaults*/ - if(ctx->videoEncSettings.encoderId == XA_ADAPTID_UNINITED) - ctx->videoEncSettings.encoderId = XA_ADAPTID_MOTIONJPEG; - if(ctx->xaVideoSource) - { - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_VIDEO, ctx->videoEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - if(temp.adaptId) - { - videoenc = gst_element_factory_make((char*)temp.adaptId, "videoenc"); - } - } - if(videoenc) - { - gst_bin_add(GST_BIN(codecbin), videoenc); - if(!gst_element_link(videoenc, mux)) - { - DEBUG_ERR("Could not link videoenc to mux!!"); - DEBUG_API("<-XAMediaRecorderAdapt_CreateEncodeBin"); - return NULL; - } - ghostvideosink = gst_element_get_static_pad(videoenc,"sink"); - } - else - { - /*no video codec but video source = raw video case, request video pad directly from mux*/ - ghostvideosink = gst_element_get_request_pad(mux,"video_%d"); - } - } - /*set audio defaults*/ - if(ctx->audioEncSettings.encoderId == XA_ADAPTID_UNINITED) - ctx->audioEncSettings.encoderId = XA_AUDIOCODEC_PCM; - if(ctx->xaAudioSource) - { - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_AUDIO, ctx->audioEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - if(temp.adaptId) - { - audioenc = gst_element_factory_make((char*)temp.adaptId, "audioenc"); - } - } - if(audioenc) - { - gst_bin_add(GST_BIN(codecbin), audioenc); - if(!gst_element_link(audioenc, mux)) - { - DEBUG_ERR("Could not link audioenc to mux!!"); - DEBUG_API("<-XAMediaRecorderAdapt_CreateEncodeBin"); - return NULL; - } - ghostaudiosink = gst_element_get_static_pad(audioenc,"sink"); - } - else - { - /*no audio codec but audio source = PCM case, explicity request audio pad*/ - ghostaudiosink = gst_element_get_request_pad(mux,"audio_%d"); - } - } - break; - - case XA_CONTAINERTYPE_WAV: - DEBUG_INFO("XA_CONTAINERTYPE_WAV"); - audioenc = gst_element_factory_make("wavenc", "audioenc"); - if(audioenc) - { - if (gst_bin_add(GST_BIN(codecbin), audioenc)) - { - DEBUG_INFO("added audioenc to codecbin"); - } - else - { - DEBUG_ERR("Could not add audioenc to codecbin"); - return NULL; - } - /*use this as linkpoint*/ - ghostsrc = gst_element_get_static_pad(audioenc,"src"); - ghostaudiosink = gst_element_get_static_pad(audioenc,"sink"); - if ( ghostsrc == NULL || ghostaudiosink == NULL) - { - DEBUG_ERR("Could not get src or sink ghoset element(s)"); - return NULL; - } - } - /* no other codecs needed */ - break; - case XA_CONTAINERTYPE_JPG: - /*motion jpeg*/ - DEBUG_INFO("XA_CONTAINERTYPE_JPG"); - /*set defaults*/ - if(ctx->videoEncSettings.encoderId == XA_ADAPTID_UNINITED) - ctx->videoEncSettings.encoderId = XA_ADAPTID_MOTIONJPEG; - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_VIDEO, ctx->videoEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - videoenc = gst_element_factory_make((char*)temp.adaptId, "videoenc"); - } - if(videoenc) - { - gst_bin_add(GST_BIN(codecbin), videoenc); - /*use this as linkpoint*/ - ghostsrc = gst_element_get_static_pad(videoenc,"src"); - ghostvideosink = gst_element_get_static_pad(videoenc,"sink"); - } - /* no other codecs needed */ - break; - case XA_CONTAINERTYPE_RAW: - DEBUG_INFO("XA_CONTAINERTYPE_RAW"); - /* no need for codec, just pass data on */ - if(strncmp((char *)mime->mimeType, "video", 5) == 0 && ctx->xaVideoSource) - { - mux = gst_element_factory_make("identity", "mux"); - gst_bin_add(GST_BIN(codecbin), mux); - ghostvideosink = gst_element_get_static_pad(mux,"sink"); - } - else if (strncmp((char *)mime->mimeType, "audio", 5) == 0 && ctx->xaAudioSource) - { - mux = gst_element_factory_make("identity", "mux"); - gst_bin_add(GST_BIN(codecbin), mux); - ghostaudiosink = gst_element_get_static_pad(mux,"sink"); - } - else - { - ret = XA_RESULT_CONTENT_UNSUPPORTED; - DEBUG_ERR("Content mismatch with given sources!!!") - } - ghostsrc = gst_element_get_static_pad(mux,"src"); - break; - case XA_CONTAINERTYPE_UNSPECIFIED: - DEBUG_INFO("No support for requested encoder...try to select encoder from mime string"); - if(strstr( (char *) mime->mimeType, "/ogg") != 0) - { - DEBUG_INFO("XA_CONTAINERTYPE_UNSPECIFIED - mimetype ogg detected"); - mux = gst_element_factory_make("oggmux", "mux"); - if(mux) - { - gst_bin_add(GST_BIN(codecbin), mux); - /*use this as linkpoint*/ - ghostsrc = gst_element_get_static_pad(mux,"src"); - /*set defaults*/ - if(ctx->audioEncSettings.encoderId == XA_ADAPTID_UNINITED) - { - ctx->audioEncSettings.encoderId = XA_ADAPTID_VORBIS; - ctx->audioEncSettings.bitsPerSample=32; - } - if(ctx->videoEncSettings.encoderId == XA_ADAPTID_UNINITED) - { - ctx->videoEncSettings.encoderId = XA_ADAPTID_THEORA; - } - if(ctx->xaAudioSource) - { - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_AUDIO, ctx->audioEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - audioenc = gst_element_factory_make((char*)temp.adaptId, "audioenc"); - } - if(audioenc) - { - gst_bin_add(GST_BIN(codecbin), audioenc); - gst_element_link(audioenc, mux); - ghostaudiosink = gst_element_get_static_pad(audioenc,"sink"); - } - } - if(strncmp((char *)mime->mimeType, "video", 5) == 0 && ctx->xaVideoSource) - { - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_VIDEO, ctx->videoEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - videoenc = gst_element_factory_make((char*)temp.adaptId, "videoenc"); - } - if(videoenc) - { - gst_bin_add(GST_BIN(codecbin), videoenc); - gst_element_link(videoenc, mux); - ghostvideosink = gst_element_get_static_pad(videoenc,"sink"); - } - } - } - } - else - { - DEBUG_INFO("No support for requested mime/container type."); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - } - break; - case XA_CONTAINERTYPE_MOBILE_DLS: - case XA_CONTAINERTYPE_MP4: - case XA_CONTAINERTYPE_AMR: - case XA_CONTAINERTYPE_3GPP: - case XA_CONTAINERTYPE_BMP: - case XA_CONTAINERTYPE_ASF: - case XA_CONTAINERTYPE_M4A: - case XA_CONTAINERTYPE_MP3: - case XA_CONTAINERTYPE_JPG2000: - case XA_CONTAINERTYPE_MPEG_ES: - case XA_CONTAINERTYPE_MPEG_PS: - case XA_CONTAINERTYPE_MPEG_TS: - case XA_CONTAINERTYPE_QT: - case XA_CONTAINERTYPE_XMF_0: - case XA_CONTAINERTYPE_XMF_1: - case XA_CONTAINERTYPE_XMF_2: - case XA_CONTAINERTYPE_XMF_3: - case XA_CONTAINERTYPE_XMF_GENERIC: - case XA_CONTAINERTYPE_AAC: - case XA_CONTAINERTYPE_3GA: - case XA_CONTAINERTYPE_RM: - case XA_CONTAINERTYPE_DMF: - default: - DEBUG_INFO("No support for requested container type."); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - break; - } - break; - } - default: - DEBUG_ERR("Incorrect data format type."); - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - else - { - DEBUG_ERR("Invalid data sink for stream recording!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - } - else - {/* stream recording not requested, datasink ignored, use uncoded recordstream*/ - mux = gst_element_factory_make("identity", "mux"); - gst_bin_add(GST_BIN(codecbin), mux); - ghostsrc = gst_element_get_static_pad(mux,"src"); - ghostvideosink = gst_element_get_static_pad(mux,"sink"); - } - - /*set default codecs for unrecognized*/ - if(ctx->audioEncSettings.encoderId == XA_ADAPTID_UNINITED) - ctx->audioEncSettings.encoderId = XA_AUDIOCODEC_PCM; - if(ctx->imageEncSettings.encoderId == XA_ADAPTID_UNINITED) - ctx->imageEncSettings.encoderId = XA_IMAGECODEC_RAW; - if(ctx->videoEncSettings.encoderId == XA_ADAPTID_UNINITED) - ctx->videoEncSettings.encoderId = XA_ADAPTID_RAWVIDEO; - - if ( ret != XA_RESULT_SUCCESS ) - { - gst_object_unref(codecbin); - codecbin=NULL; - } - else - { - /*add ghost pad(s) to link to*/ - if(ghostsrc) - { - gst_element_add_pad(codecbin, gst_ghost_pad_new("src",ghostsrc)); - gst_object_unref(GST_OBJECT(ghostsrc)); - } - if(ghostaudiosink) - { - gst_element_add_pad(codecbin, gst_ghost_pad_new("sink",ghostaudiosink)); - gst_object_unref(GST_OBJECT(ghostaudiosink)); - } - if(ghostvideosink) - { - gst_element_add_pad(codecbin, gst_ghost_pad_new("v_sink",ghostvideosink)); - gst_object_unref(GST_OBJECT(ghostvideosink)); - } - DEBUG_INFO_A1("Created encoder bin at %x", (int)codecbin); - } - - DEBUG_API("<-XAMediaRecorderAdapt_CreateEncodeBin"); - return codecbin; - - } - - /* - * void XAMediaRecorderAdapt_BufferAvailable(GstElement* sink, gpointer user_data) - * called when new buffer is available at appsink - */ - void XAMediaRecorderAdapt_BufferAvailable(GstElement* sink, gpointer user_data) - { - GstBuffer *buffer=NULL; - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)user_data; - DEBUG_API("->XAMediaRecorderAdapt_BufferAvailable"); - if(!mCtx || !mCtx->xaSink) - { - DEBUG_ERR("Invalid context") - return; - } - /* get the buffer */ - buffer = gst_app_sink_pull_buffer(GST_APP_SINK(sink)); - if(buffer) - { - guint size; - XADataLocator_Address* address; - size = GST_BUFFER_SIZE(buffer); - DEBUG_INFO_A1("Pulled new buffer of size %d", size); - address = (XADataLocator_Address*)(mCtx->xaSink->pLocator); - if( !address || *(XAuint32*)address != XA_DATALOCATOR_ADDRESS ) - { - DEBUG_ERR("Invalid address datalocator") - return; - } - - if(mCtx->writepos + size < address->length ) - { /*enough room in buffer*/ - memcpy(((char*)(address->pAddress) + mCtx->writepos), - GST_BUFFER_DATA (buffer), size); - mCtx->writepos+=size; - } - else - { /*not enough room in buffer*/ - XAAdaptEvent event = - {XA_RECORDITFEVENTS, XA_RECORDEVENT_BUFFER_FULL, 0, NULL}; - - size = address->length - mCtx->writepos; - memcpy(((char*)(address->pAddress) + mCtx->writepos), - GST_BUFFER_DATA (buffer), size); - DEBUG_INFO_A1("Buffer insufficient, wrote %d bytes", size); - /* send event */ - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj), &event); - /* "recordhead to start" i.e. reset write position */ - mCtx->writepos=0; - mCtx->recThrCtx.buffer_insufficient = XA_BOOLEAN_TRUE; - if ( XAImpl_PostSemaphore( mCtx->recThrCtx.bufInsufficientSem ) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Posting buffer-insufficien semaphore FAILED!"); - } - } - gst_buffer_unref (buffer); - } - else - { - DEBUG_ERR("Could not pull buffer from appsink!"); - } - DEBUG_API("<-XAMediaRecorderAdapt_BufferAvailable"); - } - - /* - * XAresult XAMediaRecorderAdapt_InitContentPipeSink(ctx); - */ - XAresult XAMediaRecorderAdapt_InitContentPipeSink(XAMediaRecorderAdaptationCtx* ctx) - { - XAresult ret = XA_RESULT_SUCCESS; - CPresult res; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - DEBUG_API("->XAMediaRecorderAdapt_InitContentPipeSink"); - ctx->baseObj.pipeSinkThrCtx.appSink = GST_APP_SINK(ctx->datasink); - ctx->baseObj.pipeSinkThrCtx.pipe = (XADataLocator_ContentPipe*)(ctx->xaSink->pLocator); - - /* Create thread for content pipe source */ - ret = XAImpl_CreateThreadHandle( &(ctx->baseObj.pipeSinkThr) ); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not create thread for content pipe sink!"); - DEBUG_API("<-XAMediaRecorderAdapt_InitContentPipeSink"); - return ret; - } - - /* Create semaphore for content pipe source */ - ret = XAImpl_CreateSemaphore( &(ctx->baseObj.pipeSinkThrCtx.stateSem)); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not create semaphore for content pipe source!"); - DEBUG_API("<-XAMediaRecorderAdapt_InitContentPipeSink"); - return ret; - } - - /* Open content pipe */ - res = ctx->baseObj.pipeSinkThrCtx.pipe->pContentPipe->Open(&(ctx->baseObj.pipeSinkThrCtx.dataHandle), - (CPstring)(ctx->baseObj.pipeSinkThrCtx.pipe->URI), - CP_AccessWrite ); - if ( res == EXIT_FAILURE ) - { /* Could not open content pipe data handle, try to create new one */ - res = ctx->baseObj.pipeSinkThrCtx.pipe->pContentPipe->Create(&(ctx->baseObj.pipeSinkThrCtx.dataHandle), - (CPstring)(ctx->baseObj.pipeSinkThrCtx.pipe->URI)); - if ( res == EXIT_FAILURE) - { - DEBUG_ERR("Could not create Content Pipe data handle!") - return XA_RESULT_INTERNAL_ERROR; - } - res = ctx->baseObj.pipeSinkThrCtx.pipe->pContentPipe->Open(&(ctx->baseObj.pipeSinkThrCtx.dataHandle), - (CPstring)(ctx->baseObj.pipeSinkThrCtx.pipe->URI), - CP_AccessWrite ); - if ( res == EXIT_FAILURE) - { - DEBUG_ERR("Could not open newly created Content Pipe data handle!") - return XA_RESULT_INTERNAL_ERROR; - } - } - - res = ctx->baseObj.pipeSinkThrCtx.pipe->pContentPipe->RegisterCallback( &(ctx->baseObj.pipeSinkThrCtx.dataHandle), &XAAdaptationBase_ContentPipeSinkCb); - if ( res == EXIT_FAILURE ) - { - DEBUG_ERR("Could not register content pipe callbacks!") - return XA_RESULT_INTERNAL_ERROR; - } - - gstRet = gst_element_set_state( GST_ELEMENT(ctx->datasink), GST_STATE_PAUSED); - - ctx->baseObj.pipeSinkThrCtx.state = CPStateStarted; - XAImpl_StartThread( &(ctx->baseObj.pipeSrcThr), NULL, &XAAdaptationBase_ContentPipeSinkThrFunc, &(ctx->baseObj.pipeSinkThrCtx) ); - - DEBUG_API("<-XAMediaRecorderAdapt_InitContentPipeSink"); - return ret; - } - - /* - * void* XAMediaRecorderAdapt_RecordEventThr( void* ctx ) - */ - void* XAMediaRecorderAdapt_RecordEventThr( void* ctx ) - { - XAMediaRecorderAdaptationCtx* mrCtx = (XAMediaRecorderAdaptationCtx*)ctx; - GstStateChangeReturn gret; - XAresult ret; - DEBUG_API("->XAMediaRecorderAdapt_RecordEventThr"); - - /* Wait semaphore here */ - ret = XAImpl_WaitSemaphore( mrCtx->recThrCtx.bufInsufficientSem ); - if ( ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Could not start semaphore"); - } - - if(mrCtx->recThrCtx.buffer_insufficient) - { - mrCtx->baseObj.binWantedState = GST_STATE_PAUSED; - XAAdaptationBase_PrepareAsyncWait(&(mrCtx->baseObj)); - gret = gst_element_set_state( GST_ELEMENT(mrCtx->baseObj.bin), mrCtx->baseObj.binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Start to wait recoder state change."); - XAAdaptationBase_StartAsyncWait(&(mrCtx->baseObj)); - DEBUG_INFO("Recorder state change async. SUCCESFULL."); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_INFO("Recorder state change FAILED"); - /*ret = XA_RESULT_INTERNAL_ERROR;*/ - } - else - { - DEBUG_INFO("Recorder state change SUCCESFULL") - } - - mrCtx->baseObj.waitingasyncop= XA_BOOLEAN_FALSE; - } - DEBUG_API("<-XAMediaRecorderAdapt_RecordEventThr"); - return NULL; - } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xamediarecorderadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xamediarecorderadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMEDIARECORDERADAPTCTX_H_ -#define XAMEDIARECORDERADAPTCTX_H_ - -#include "XAAdaptationContextBase.h" - - -/* TYPEDEFS */ -#define XA_RECMODE_STREAM 1 -#define XA_RECMODE_STILL 2 - -typedef struct XAMediaRecorderAdaptationCtx_ XAMediaRecorderAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAMediaRecorderAdapt_Create( XADataSource* pAudioSrc, XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes ); -XAresult XAMediaRecorderAdapt_PostInit( XAAdaptationBaseCtx* bCtx ); -void XAMediaRecorderAdapt_Destroy( XAAdaptationBaseCtx* bCtx ); -XAresult XAMediaRecorderAdapt_InitContentPipeSink(XAMediaRecorderAdaptationCtx* ctx); -void* XAMediaRecorderAdapt_RecordEventThr(void* ctx); - -#endif /* XAMEDIARECORDERADAPTCTX_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xametadataadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xametadataadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1202 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAAdaptation.h" -#include "XAMetadataAdaptCtx.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAMediaRecorderAdaptCtx.h" -#include "XAMetadataAdaptation.h" - -/* forward declarations of internal methods */ -XAMetadataAdaptVars* XAMetadataAdapt_GetMetadataVars(XAAdaptationBaseCtx *bCtx); -GstStructure* XAMetadataAdapt_GetChildStructure(XAMetadataAdaptVars* mdv, XAuint32 index); -gboolean XAMetadataAdapt_CountTags(GQuark gkey, const GValue *gvalue, gpointer counter); -void XAMetadataAdapt_ParseTag(const GstTagList* list, const gchar* tag, gpointer listptr); -gboolean XAMetadataAdapt_ParseItem(GQuark field_id, const GValue * value, gpointer listptr); -gboolean XAMetadataAdapt_GstTagCb( GstBus *bus, GstMessage *message, gpointer data ); - -/*NOTE: no way to query these dynamically?*/ -/*supported keys for metadata insertion*/ -static char* xaMetadataAdaptSupportedKeys[] = { - KHRONOS_TITLE, - KHRONOS_ALBUM, - KHRONOS_TRACK_NUMBER, - KHRONOS_ARTIST, - KHRONOS_GENRE, - KHRONOS_COMMENT, - KHRONOS_COPYRIGHT, - GST_TAG_TITLE, - GST_TAG_TITLE_SORTNAME, - GST_TAG_ARTIST, - GST_TAG_ARTIST_SORTNAME, - GST_TAG_ALBUM, - GST_TAG_ALBUM_SORTNAME, - GST_TAG_COMPOSER, - GST_TAG_DATE, - GST_TAG_GENRE, - GST_TAG_COMMENT, - GST_TAG_EXTENDED_COMMENT, - GST_TAG_TRACK_NUMBER, - GST_TAG_TRACK_COUNT, - GST_TAG_ALBUM_VOLUME_NUMBER, - GST_TAG_ALBUM_VOLUME_COUNT, - GST_TAG_LOCATION, - GST_TAG_DESCRIPTION, - GST_TAG_VERSION, - GST_TAG_ISRC, - GST_TAG_ORGANIZATION, - GST_TAG_COPYRIGHT, - GST_TAG_COPYRIGHT_URI, - GST_TAG_CONTACT, - GST_TAG_LICENSE, - GST_TAG_LICENSE_URI, - GST_TAG_PERFORMER, - NULL -}; - -/****************************************************************************** - * COMMONS - ******************************************************************************/ - - -/* const char* XAMetadataAdapt_ParseKhronosKey(const char* pKKey) - * Translates Khronos key string to adaptation-specific key string - * @return Translated key string - */ -const XAchar* XAMetadataAdapt_ParseKhronosKey(const XAchar* pKKey) -{ - const XAchar* newKey; - DEBUG_API_A1("->XAMetadataAdapt_ParseKhronosKey: \"%s\"", (char*)pKKey); - if( strcmp((char*)pKKey,KHRONOS_TITLE) ==0 ) newKey = (XAchar*)GST_TAG_TITLE; - else if( strcmp((char*)pKKey,KHRONOS_ALBUM) ==0 ) newKey = (XAchar*)GST_TAG_ALBUM; - else if( strcmp((char*)pKKey,KHRONOS_TRACK_NUMBER) ==0 ) newKey = (XAchar*)GST_TAG_TRACK_NUMBER; - else if( strcmp((char*)pKKey,KHRONOS_ARTIST) ==0 ) newKey = (XAchar*)GST_TAG_ARTIST; - else if( strcmp((char*)pKKey,KHRONOS_GENRE) ==0 ) newKey = (XAchar*)GST_TAG_GENRE; - else if( strcmp((char*)pKKey,KHRONOS_COMMENT) ==0 ) newKey = (XAchar*)GST_TAG_COMMENT; - else if( strcmp((char*)pKKey,KHRONOS_COPYRIGHT) ==0 ) newKey = (XAchar*)GST_TAG_COPYRIGHT; - else newKey = pKKey; -/* No Gst keys for following: - else if( strcmp(pKKey,KHRONOS_YEAR) ==0 ) newKey = ; - else if( strcmp(pKKey,KHRONOS_ARTIST_URL) ==0 ) newKey = ; - else if( strcmp(pKKey,KHRONOS_CONTENT_URL) ==0 ) newKey = ; - else if( strcmp(pKKey,KHRONOS_RATING) ==0 ) newKey = ; - else if( strcmp(pKKey,KHRONOS_ALBUM_ART) ==0 ) newKey = ; - */ - DEBUG_API_A1("<-XAMetadataAdapt_ParseKhronosKey: => \"%s\"", (char*)newKey); - return newKey; -} - -/* XAresult XAMetadataAdapt_PreInit(XAAdaptationBaseCtx *bCtx) - * Initialize values needed before preroll - * @return XAresult ret - Success value - */ -XAresult XAMetadataAdapt_PreInit(XAAdaptationBaseCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv; - DEBUG_API("->XAMetadataAdapt_PreInit"); - if( bCtx->ctxId == XAMDAdaptation || - bCtx->ctxId == XAMediaPlayerAdaptation ) - { - mdv = calloc(1, sizeof(XAMetadataAdaptVars)); - mdv->currentchild = &(mdv->generaltags); - mdv->traversemode=XA_METADATATRAVERSALMODE_NODE; - ((XAMediaPlayerAdaptationCtx*)bCtx)->metadatavars = mdv; - - } - else if ( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - mdv = calloc(1, sizeof(XAMetadataAdaptVars)); - mdv->currentchild = &(mdv->generaltags); - mdv->traversemode=XA_METADATATRAVERSALMODE_NODE; - ((XAMediaRecorderAdaptationCtx*)bCtx)->metadatavars = mdv; - } - else - { - DEBUG_ERR("Unsupported metadata context!!"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - - if(ret == XA_RESULT_SUCCESS) - { - if(bCtx->bus) - { - g_signal_connect(bCtx->bus, "message::tag", G_CALLBACK(XAMetadataAdapt_GstTagCb), bCtx ); - } - else - { - DEBUG_ERR("No bus in context!!"); - ret = XA_RESULT_PRECONDITIONS_VIOLATED; - } - } - DEBUG_API_A1("<-XAMetadataAdapt_PreInit (%d)", (int)ret); - return ret; -} -/* XAresult XAMetadataAdapt_PostInit(XAAdaptationBaseCtx *bCtx) - * Initialize values after preroll - * @return XAresult ret - Success value - */ -XAresult XAMetadataAdapt_PostInit(XAAdaptationBaseCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - XAMediaPlayerAdaptationCtx* mCtx=NULL; - GstPad* tmppad=NULL; - GstCaps* tmpcaps=NULL; - GstElement* tmpelement=NULL; - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - - DEBUG_API("->XAMetadataAdapt_PostInit"); - if( bCtx->ctxId == XAMDAdaptation || - bCtx->ctxId == XAMediaPlayerAdaptation ) - { - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - mdv->childcount = 0; - /* try to dig out audio and video pads from decodebin for stream info tags */ - /* NOTE: currently no good deterministic way to dig out undecoded pads - * from decodebin's internal demuxer, this is just ugly way to try to cope - * with most demuxers. - */ - mCtx = ((XAMediaPlayerAdaptationCtx*)bCtx); - if(GST_IS_BIN(mCtx->codecbin)) - { - tmpelement=gst_bin_get_by_name(GST_BIN(mCtx->codecbin),"typefind"); - if(tmpelement) - { - tmppad = gst_element_get_static_pad(GST_ELEMENT(tmpelement),"src"); - tmpelement=NULL; - if(tmppad) - { - tmppad = gst_pad_get_peer(tmppad); - if(tmppad) - { - tmpelement = gst_pad_get_parent_element(tmppad); - } - } - /* now we have demuxer, if existing */ - if(tmpelement) - { - tmppad = gst_element_get_pad( tmpelement, "audio_00"); - if(tmppad) - { - tmpcaps = gst_pad_get_negotiated_caps( GST_PAD(tmppad) ); - if(tmpcaps==NULL || gst_caps_is_any(tmpcaps) || gst_caps_is_empty(tmpcaps)) - { - mdv->audiotags = NULL; - DEBUG_INFO("no usable audio properties found from pad !"); - } - else - { - mdv->audiotags = gst_caps_get_structure(tmpcaps,0); - mdv->childcount++; - DEBUG_INFO_A1("found audio node: %s",gst_caps_to_string(tmpcaps)); - } - } - tmppad = gst_element_get_pad( tmpelement, "video_00"); - if(tmppad) - { - tmpcaps = gst_pad_get_negotiated_caps( GST_PAD(tmppad) ); - if(tmpcaps==NULL || gst_caps_is_any(tmpcaps) || gst_caps_is_empty(tmpcaps)) - { - mdv->videotags = NULL; - DEBUG_INFO("no usable video properties found from pad !"); - } - else - { - mdv->videotags = gst_caps_get_structure(tmpcaps,0); - mdv->childcount++; - DEBUG_INFO_A1("found video node: %s",gst_caps_to_string(tmpcaps)); - } - } - } - } - } - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - } - - if ( tmpelement ) - { - gst_object_unref( tmpelement ); - } - if ( tmppad ) - { - gst_object_unref( tmppad ); - } - if ( tmpcaps ) - { - gst_object_unref( tmpcaps ); - } - - DEBUG_API_A1("<-XAMetadataAdapt_PostInit (%d)", (int)ret); - return ret; -} - -/* - * void XAMetadataAdapt_FreeImplTagList(XAMetadataImplTagList *list, XAboolean freeItems) - * deallocate elements inside taglist - */ -void XAMetadataAdapt_FreeImplTagList(XAMetadataImplTagList *list, XAboolean freeItems) -{ - XAuint16 i; - DEBUG_API("->XAMetadataExtractionItfAdapt_FreeTagList"); - if(list->mdeKeys) - { - for(i=0;iitemcount;i++) - { - if(list->mdeKeys[i]) - { - if(freeItems) - free(list->mdeKeys[i]); - list->mdeKeys[i]=NULL; - } - } - free(list->mdeKeys); - list->mdeKeys = NULL; - } - if(list->mdeValues) - { - for(i=0;iitemcount;i++) - { - if(list->mdeValues[i]) - { - if(freeItems) - free(list->mdeValues[i]); - list->mdeValues[i]=NULL; - } - } - free(list->mdeValues); - list->mdeValues = NULL; - } - list->itemcount = 0; - DEBUG_API("<-XAMetadataExtractionItfAdapt_FreeTagList"); -} - -/* - * void XAMetadataAdapt_FreeVars(XAMetadataAdaptVars *vars) - * deallocate XAMetadataAdaptVars - */ -void XAMetadataAdapt_FreeVars(XAMetadataAdaptVars *vars) -{ - DEBUG_API("->XAMetadataAdapt_FreeVars"); - if(vars) - { - if( vars->generaltags ) - { - gst_tag_list_free(vars->generaltags); - } - if( vars->audiotags ) - { - gst_structure_set_parent_refcount(vars->audiotags,NULL); - gst_structure_free(vars->audiotags); - } - if( vars->videotags ) - { - gst_structure_set_parent_refcount(vars->videotags,NULL); - gst_structure_free(vars->videotags); - } - free(vars); - } - DEBUG_API("<-XAMetadataAdapt_FreeVars"); -} - -/****************************************************************************** - * EXTRACTION - ******************************************************************************/ - -/* - * XAresult XAMetadataExtractionItfAdapt_FillTagList() - * @param tagList - contains pointer to tag list to be updated - * @return XAresult ret - Success value - */ -XAresult XAMetadataExtractionItfAdapt_FillTagList(XAAdaptationBaseCtx *bCtx, - XAMetadataImplTagList* tagList) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv; - XAuint32 newcount = 0; - DEBUG_API("->XAMetadataExtractionItfAdapt_FillTagList"); - - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - XAMetadataAdapt_FreeImplTagList(tagList, XA_BOOLEAN_TRUE); - /* get number of tags and allocate memory for them */ - if(mdv->traversemode==XA_METADATATRAVERSALMODE_ALL) - { - if(mdv->generaltags) - gst_structure_foreach(mdv->generaltags, XAMetadataAdapt_CountTags, &newcount); - if(mdv->audiotags) - gst_structure_foreach(mdv->audiotags, XAMetadataAdapt_CountTags, &newcount); - if(mdv->videotags) - gst_structure_foreach(mdv->videotags, XAMetadataAdapt_CountTags, &newcount); - } - else - { - if(mdv->currentchild && *(mdv->currentchild)) - gst_structure_foreach(*(mdv->currentchild), XAMetadataAdapt_CountTags, &newcount); - } - DEBUG_INFO_A1("tag count = %d",(int)newcount) - tagList->mdeKeys = calloc(newcount,sizeof(XAMetadataInfo*)); - tagList->mdeValues = calloc(newcount,sizeof(XAMetadataInfo*)); - - /* fill in given tag list */ - tagList->itemcount = 0; - if(mdv->traversemode==XA_METADATATRAVERSALMODE_ALL) - { - if(mdv->generaltags) - gst_tag_list_foreach(mdv->generaltags, XAMetadataAdapt_ParseTag, tagList); - if(mdv->audiotags) - gst_structure_foreach(mdv->audiotags, XAMetadataAdapt_ParseItem, tagList); - if(mdv->videotags) - gst_structure_foreach(mdv->videotags, XAMetadataAdapt_ParseItem, tagList); - } - else - { - if(mdv->currentchild && *(mdv->currentchild)) - { - if(GST_IS_TAG_LIST(*(mdv->currentchild))) - { - gst_tag_list_foreach(*(mdv->currentchild), XAMetadataAdapt_ParseTag, tagList); - } - else - { - gst_structure_foreach(*(mdv->currentchild), XAMetadataAdapt_ParseItem, tagList); - } - } - } - } - else - { - DEBUG_ERR("Metadata variables not found!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API_A1("<-XAMetadataExtractionItfAdapt_FillTagList (%d)", (int)ret); - return ret; -} - -/****************************************************************************** - * TRAVERSAL - *****************************************************************************/ - -/* - * XAresult XAMetadataTraversalItfAdapt_SetMode(XAAdaptationBaseCtx *bCtx, XAuint32 mode) - */ -XAresult XAMetadataTraversalItfAdapt_SetMode(XAAdaptationBaseCtx *bCtx, XAuint32 mode) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - - DEBUG_API("->XAMetadataTraversalItfAdapt_SetMode"); - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - mdv->traversemode = mode; - /* inform extractor to update tag list */ - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - if(mdv->traversemode==XA_METADATATRAVERSALMODE_ALL) - { - mdv->nodedepth = 0; - mdv->currentchild = &(mdv->generaltags); - } - } - else - { - DEBUG_ERR("Metadata variables not found!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XAMetadataTraversalItfAdapt_SetMode"); - return ret; -} - -/* - * XAresult XAMetadataTraversalItfAdapt_GetChildCount(XAAdaptationBaseCtx *bCtx, XAuint32 *pCount) - */ -XAresult XAMetadataTraversalItfAdapt_GetChildCount(XAAdaptationBaseCtx *bCtx, XAuint32 *pCount) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - - DEBUG_API("->XAMetadataTraversalItfAdapt_GetChildCount"); - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - /* only depth of 1 is supported */ - if( mdv->nodedepth == 0 ) - { - *pCount=mdv->childcount; - } - else - { - *pCount=0; - } - } - else - { - DEBUG_ERR("Metadata variables not found!!"); - ret = XA_RESULT_PARAMETER_INVALID; - *pCount=0; - } - DEBUG_API_A2("<-XAMetadataTraversalItfAdapt_GetChildCount(%d) count=%d", (int)ret, (int)*pCount); - return ret; -} - -/* - * XAresult XAMetadataTraversalItfAdapt_GetChildMIMETypeSize(XAAdaptationBaseCtx *bCtx, - * XAuint32 index, - * XAuint32 *pSize) - */ -XAresult XAMetadataTraversalItfAdapt_GetChildMIMETypeSize(XAAdaptationBaseCtx *bCtx, - XAuint32 index, - XAuint32 *pSize) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - - DEBUG_API("->XAMetadataTraversalItfAdapt_GetChildMIMETypeSize"); - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - GstStructure* child = XAMetadataAdapt_GetChildStructure(mdv,index); - if(child) - { - *pSize = strlen(gst_structure_get_name(child)); - } - } - else - { - DEBUG_ERR("Metadata variables not found!!"); - ret = XA_RESULT_PARAMETER_INVALID; - *pSize=0; - } - DEBUG_API("<-XAMetadataTraversalItfAdapt_GetChildMIMETypeSize"); - return ret; -} - -/* - * XAresult XAMetadataTraversalItfAdapt_GetChildInfo(XAAdaptationBaseCtx *bCtx, - * XAuint32 index, - * XAint32 *pNodeID, - * XAuint32 *pType, - * XAuint32 size, - * XAchar *pMimeType) - */ -XAresult XAMetadataTraversalItfAdapt_GetChildInfo(XAAdaptationBaseCtx *bCtx, - XAuint32 index, - XAint32 *pNodeID, - XAuint32 *pType, - XAuint32 size, - XAchar *pMimeType) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - const gchar* mime; - GstStructure* child; - - DEBUG_API("->XAMetadataTraversalItfAdapt_GetChildInfo"); - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - child = XAMetadataAdapt_GetChildStructure(mdv,index); - if(child) - { - *pNodeID = (XAint32)child; - mime = gst_structure_get_name(child); - if(strncmp(mime,"audio",5)==0) - { - *pType = XA_NODETYPE_AUDIO; - } - if(strncmp(mime,"video",5)==0) - { - *pType = XA_NODETYPE_VIDEO; - } - if(strncmp(mime,"image",5)==0) - { - *pType = XA_NODETYPE_IMAGE; - } - else - { - *pType = XA_NODETYPE_UNSPECIFIED; - } - strncpy((char*)pMimeType,mime,size); - } - } - else - { - DEBUG_ERR("Metadata variables not found!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("<-XAMetadataTraversalItfAdapt_GetChildInfo"); - return ret; -} - -/* - * XAresult XAMetadataTraversalItfAdapt_SetActiveNode(XAAdaptationBaseCtx *bCtx, - * XAuint32 index) - */ -XAresult XAMetadataTraversalItfAdapt_SetActiveNode(XAAdaptationBaseCtx *bCtx, - XAuint32 index) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - GstStructure* child; - - DEBUG_API("->XAMetadataTraversalItfAdapt_SetActiveNode"); - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - child = XAMetadataAdapt_GetChildStructure(mdv,index); - if(child) - { - mdv->currentchild = &child; - if(index==XA_NODE_PARENT) mdv->nodedepth--; - else mdv->nodedepth++; - } - } - else - { - DEBUG_ERR("Metadata variables not found!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("<-XAMetadataTraversalItfAdapt_SetActiveNode"); - return ret; -} - -/***************************************************************************** - * INSERTION - *****************************************************************************/ - -/* - * XAresult XAMetadataInsertionItfAdapt_CreateChildNode(XAAdaptationBaseCtx *bCtx, - * XAint32 parentNodeID, - * XAuint32 type, - * XAchar *mimeType, - * XAint32 *pChildNodeID) - */ -XAresult XAMetadataInsertionItfAdapt_CreateChildNode(XAAdaptationBaseCtx *bCtx, - XAint32 parentNodeID, - XAuint32 type, - XAchar *mimeType, - XAint32 *pChildNodeID) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - XAMediaRecorderAdaptationCtx* mCtx; - - DEBUG_API("->XAMetadataInsertionItfAdapt_CreateChildNode"); - if(bCtx && bCtx->ctxId == XAMediaRecorderAdaptation) - { - /* no support for more than 1 levels of childs*/ - if(parentNodeID==XA_ROOT_NODE_ID) - { - XAMediaType mediaType; - mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - - /* first check sink type */ - XACommon_CheckDataSource((XADataSource*)(mCtx->xaSink),&mediaType); - if( ((mediaType==XA_MEDIATYPE_AUDIO||mediaType==XA_MEDIATYPE_VIDEO) && type==XA_NODETYPE_IMAGE) || - (mediaType==XA_MEDIATYPE_IMAGE && (type==XA_NODETYPE_AUDIO || type==XA_NODETYPE_VIDEO)) ) - { - DEBUG_ERR("Nodetype not supported!"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - DEBUG_API_A1("<-XAMetadataInsertionItfAdapt_CreateChildNode (%d)", (int)ret); - return ret; } - - mdv = mCtx->metadatavars; - if(!mdv) - { - DEBUG_ERR("Metadata variables not initialized!"); - ret = XA_RESULT_PRECONDITIONS_VIOLATED; - } - switch(type) - { - case XA_NODETYPE_IMAGE: - /*fall-through to use video pipe tags for image*/ - case XA_NODETYPE_VIDEO: - if(!mCtx->videosource) - { - DEBUG_ERR("Nodetype not found!"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - } - else - { - if(!mdv->videotags) - { - if(strlen((char*)mimeType)==0) - { - mdv->videotags = gst_structure_empty_new("video/unknown"); - } - else - { - mdv->videotags = gst_structure_empty_new((gchar*)mimeType); - } - } - *pChildNodeID = (XAint32)mdv->videotags; - } - break; - case XA_NODETYPE_AUDIO: - if(!mCtx->audiosource) - { - DEBUG_ERR("Nodetype not found!"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - } - else - { - if(!mdv->audiotags) - { - if(strlen((char*)mimeType)==0) - { - mdv->audiotags = gst_structure_empty_new("audio/unknown"); - } - else - { - mdv->audiotags = gst_structure_empty_new((gchar*)mimeType); - } - } - *pChildNodeID = (XAint32)mdv->audiotags; - } - break; - default: - DEBUG_ERR("Nodetype not found!"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - break; - } - } - else - { - DEBUG_ERR("Only root childs supported!!"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - } - } - else - { - DEBUG_ERR("Unsupported metadata insertion context!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API_A1("<-XAMetadataInsertionItfAdapt_CreateChildNode (%d)", (int)ret); - return ret; -} - -/* - * XAresult XAMetadataInsertionItfAdapt_GetSupportedKeysCount(XAAdaptationBaseCtx *bCtx, - * XAint32 nodeID, - * XAboolean *pFreeKeys, - * XAuint32 *pKeyCount, - * XAuint32 *pEncodingCount) - */ -XAresult XAMetadataInsertionItfAdapt_GetSupportedKeysCount(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAboolean *pFreeKeys, - XAuint32 *pKeyCount, - XAuint32 *pEncodingCount) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaRecorderAdaptationCtx* mCtx; - - DEBUG_API("->XAMetadataInsertionItfAdapt_GetSupportedKeysCount"); - if(bCtx && bCtx->ctxId == XAMediaRecorderAdaptation) - { - mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - *pKeyCount = 0; - *pFreeKeys = XA_BOOLEAN_FALSE; - while(xaMetadataAdaptSupportedKeys[*pKeyCount]) - { - (*pKeyCount)++; - } - *pEncodingCount = 1; - } - else - { - DEBUG_ERR("Unsupported metadata insertion context!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("<-XAMetadataInsertionItfAdapt_GetSupportedKeysCount"); - return ret; -} - -/* - * XAresult XAMetadataInsertionItfAdapt_GetKeySize(XAAdaptationBaseCtx *bCtx, - * XAint32 nodeID, - * XAuint32 keyIndex, - * XAuint32 *pKeySize) - */ -XAresult XAMetadataInsertionItfAdapt_GetKeySize(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 *pKeySize) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAMetadataInsertionItfAdapt_GetKeySize"); - if(bCtx && bCtx->ctxId == XAMediaRecorderAdaptation) - { - if(xaMetadataAdaptSupportedKeys[keyIndex]) - { - *pKeySize = sizeof(XAMetadataInfo)+strlen(xaMetadataAdaptSupportedKeys[keyIndex]); - } - else - { - ret = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - DEBUG_ERR("Unsupported metadata insertion context!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("<-XAMetadataInsertionItfAdapt_GetKeySize"); - return ret; -} - -/* - * XAresult XAMetadataInsertionItfAdapt_GetKey(XAAdaptationBaseCtx *bCtx, - * XAint32 nodeID, - * XAuint32 keyIndex, - * XAuint32 keySize, - * XAMetadataInfo *pKey) - */ -XAresult XAMetadataInsertionItfAdapt_GetKey(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 keySize, - XAMetadataInfo *pKey) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 datasize, neededsize; - - DEBUG_API("->XAMetadataInsertionItfAdapt_GetKey"); - if(bCtx && bCtx->ctxId == XAMediaRecorderAdaptation) - { - memset(pKey,0,keySize); - if(xaMetadataAdaptSupportedKeys[keyIndex]) - { - neededsize = strlen(xaMetadataAdaptSupportedKeys[keyIndex])+1; - datasize = keySize-sizeof(XAMetadataInfo)+1; - if(neededsize>datasize) - { - strncpy((char*)pKey->data,xaMetadataAdaptSupportedKeys[keyIndex],datasize); - pKey->size=datasize; - ret=XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - strncpy((char*)pKey->data,xaMetadataAdaptSupportedKeys[keyIndex],neededsize); - pKey->size=neededsize; - } - pKey->encoding = XA_CHARACTERENCODING_ASCII; - strcpy((char*)(pKey->langCountry),"en"); - } - else - { - ret = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - DEBUG_ERR("Unsupported metadata insertion context!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("<-XAMetadataInsertionItfAdapt_GetKey"); - return ret; -} - -/* - * XAresult XAMetadataInsertionItfAdapt_GetFreeKeysEncoding(XAAdaptationBaseCtx *bCtx, - * XAint32 nodeID, - * XAuint32 encodingIndex, - * XAuint32 *pEncoding) - */ -XAresult XAMetadataInsertionItfAdapt_GetFreeKeysEncoding(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAuint32 encodingIndex, - XAuint32 *pEncoding) -{ - DEBUG_API("->XAMetadataInsertionItfAdapt_GetFreeKeysEncoding"); - DEBUG_API("<-XAMetadataInsertionItfAdapt_GetFreeKeysEncoding"); - /* no free keys*/ - return XA_RESULT_PRECONDITIONS_VIOLATED; -} - -/* - * XAresult XAMetadataInsertionItfAdapt_InsertMetadataItem(XAAdaptationBaseCtx *bCtx, - * XAint32 nodeID, - * XAMetadataInfo *pKey, - * XAMetadataInfo *pValue, - * XAboolean overwrite) - */ -XAresult XAMetadataInsertionItfAdapt_InsertMetadataItem(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAMetadataInfo *pKey, - XAMetadataInfo *pValue, - XAboolean overwrite) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - XAMediaRecorderAdaptationCtx* mCtx; - GstTagMergeMode mode = (overwrite?GST_TAG_MERGE_REPLACE:GST_TAG_MERGE_KEEP); - gchar* parsedKey = (gchar*)XAMetadataAdapt_ParseKhronosKey((XAchar*)pKey->data); - DEBUG_API("->XAMetadataInsertionItfAdapt_InsertMetadataItem"); - if(bCtx && bCtx->ctxId == XAMediaRecorderAdaptation) - { - mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - mdv = mCtx->metadatavars; - if(mdv) - { - if( nodeID==XA_ROOT_NODE_ID ) - { - if(!mdv->generaltags) - { - mdv->generaltags = gst_tag_list_new(); - } - if (gst_tag_get_type (parsedKey) == G_TYPE_STRING) - { - gst_tag_list_add(mdv->generaltags, mode, parsedKey, (gchar*)pValue->data, NULL ); - } - else - { - gst_tag_list_add(mdv->generaltags, mode, parsedKey, atoi((gchar*)pValue->data), NULL ); - } - } - else - { - if(nodeID == (XAint32)mdv->audiotags || nodeID == (XAint32)mdv->videotags) - { - if (gst_tag_get_type (parsedKey) == G_TYPE_STRING) - { - gst_structure_set((GstStructure*)nodeID, parsedKey, G_TYPE_STRING, g_strdup((gchar*)pValue->data), NULL ); - } - else - { - gst_structure_set((GstStructure*)nodeID, parsedKey, gst_tag_get_type (parsedKey), atoi((gchar*)pValue->data), NULL ); - } - } - else - { - DEBUG_ERR("Unknown node!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - } - if( ret == XA_RESULT_SUCCESS ) - { /* let (possible) extraction itf to know new tags */ - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - } - else - { - DEBUG_ERR("Metadata not initialized!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - DEBUG_ERR("Unsupported metadata insertion context!!"); - ret = XA_RESULT_PARAMETER_INVALID; - } - DEBUG_API("<-XAMetadataInsertionItfAdapt_InsertMetadataItem"); - return ret; -} - -/***************************************************************************** - * INTERNALS - *****************************************************************************/ - - -/* - * GstStructure* XAMetadataAdapt_GetChildStructure(XAMetadataAdaptVars* mdv, XAuint32 index) - * helper to get gst structure corresponding to child index - */ -GstStructure* XAMetadataAdapt_GetChildStructure(XAMetadataAdaptVars* mdv, XAuint32 index) -{ - if(mdv->nodedepth == 0) - { /*root childs, if existent, the order is 1)video 2)audio*/ - if (index==0) - { - if(mdv->videotags) return mdv->videotags; - else if (mdv->audiotags) return mdv->audiotags; - } - else if (index==1) - { - if (mdv->audiotags) return mdv->audiotags; - } - } - else - { - if(index==XA_NODE_PARENT) - { - return GST_STRUCTURE(mdv->generaltags); - } - } - /*else*/ - return NULL; -} - -/* - * XAMetadataAdaptVars* XAMetadataAdapt_GetMetadataVars(XAAdaptationBaseCtx *bCtx) - * Return metadata variables from different types of context - */ -XAMetadataAdaptVars* XAMetadataAdapt_GetMetadataVars(XAAdaptationBaseCtx *bCtx) -{ - if( bCtx->ctxId == XAMDAdaptation || - bCtx->ctxId == XAMediaPlayerAdaptation ) - { - return ((XAMediaPlayerAdaptationCtx*)bCtx)->metadatavars; - } - else if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - return ((XAMediaRecorderAdaptationCtx*)bCtx)->metadatavars; - } - else - { - DEBUG_ERR("Invalid context for metadata"); - return NULL; - } -} - -/* - * gboolean XAMetadataAdapt_CountTags(GQuark field_id, const GValue* value, gpointer counter) - * GstStructureForeachFunc to count number of items inside list - */ -gboolean XAMetadataAdapt_CountTags(GQuark field_id, const GValue* value, gpointer counter) -{ - XAuint32* cnt = (XAuint32*)counter; - (*cnt)++; - return TRUE; -} - -/* - * void XAMetadataAdapt_ParseTag(const GstTagList* list, const gchar* tag, gpointer listptr) - * GstTaglistForeachFunc to parse items inside gsttaglist - */ -void XAMetadataAdapt_ParseTag(const GstTagList* list, const gchar* tag, gpointer listptr) -{ - XAMetadataImplTagList* tagList = (XAMetadataImplTagList*)listptr; - const gchar *key; - gchar *value; - guint32 keylen, valuelen; - - DEBUG_API("->XAMetadataAdapt_ParseTag"); - key = gst_tag_get_nick(tag); - /*include null-terminator*/ - keylen = strlen(key)+1; - tagList->mdeKeys[tagList->itemcount] = calloc(1,keylen+sizeof(XAMetadataInfo)); - tagList->mdeKeys[tagList->itemcount]->size = keylen; - strncpy((char*)tagList->mdeKeys[tagList->itemcount]->data,key,keylen-1); - - if (gst_tag_get_type (tag) == G_TYPE_STRING) - { - gst_tag_list_get_string_index(list, tag, 0, &value); - } - else - { - value = g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, 0)); - } - /*include null-terminator*/ - valuelen = strlen(value)+1; - tagList->mdeValues[tagList->itemcount] = calloc(1,valuelen+sizeof(XAMetadataInfo)); - tagList->mdeValues[tagList->itemcount]->size = valuelen; - strncpy((char*)tagList->mdeValues[tagList->itemcount]->data,value,valuelen-1); - - /* NOTE: for now, encoding and language fixed */ - tagList->mdeKeys[tagList->itemcount]->encoding = XA_CHARACTERENCODING_ASCII; - tagList->mdeValues[tagList->itemcount]->encoding = XA_CHARACTERENCODING_ASCII; - strcpy((char*)tagList->mdeKeys[tagList->itemcount]->langCountry,"en"); - strcpy((char*)tagList->mdeValues[tagList->itemcount]->langCountry,"en"); - tagList->itemcount++; - DEBUG_API_A2("<-XAMetadataAdapt_ParseTag: added %s : %s", - tagList->mdeKeys[tagList->itemcount-1]->data, - tagList->mdeValues[tagList->itemcount-1]->data); -} - -/* - * gboolean XAMetadataAdapt_ParseItem(GQuark gkey, - * const GValue* gvalue, - * gpointer listptr) - * GstStructureForeachFunc to parse items inside caps structure - */ -gboolean XAMetadataAdapt_ParseItem(GQuark gkey, - const GValue* gvalue, - gpointer listptr) -{ - XAMetadataImplTagList* tagList = (XAMetadataImplTagList*)listptr; - const gchar *key; - gchar *value; - guint32 keylen, valuelen; - - DEBUG_API("->XAMetadataAdapt_ParseItem"); - key = g_quark_to_string(gkey); - /*include null-terminator*/ - keylen = strlen(key)+1; - tagList->mdeKeys[tagList->itemcount] = calloc(1,keylen+sizeof(XAMetadataInfo)); - tagList->mdeKeys[tagList->itemcount]->size = keylen; - strncpy((char*)tagList->mdeKeys[tagList->itemcount]->data,key,keylen-1); - - value = gst_value_serialize(gvalue); - /*include null-terminator*/ - valuelen = strlen(value)+1; - tagList->mdeValues[tagList->itemcount] = calloc(1,valuelen+sizeof(XAMetadataInfo)); - tagList->mdeValues[tagList->itemcount]->size = valuelen; - strncpy((char*)tagList->mdeValues[tagList->itemcount]->data,value,valuelen-1); - - /* for Gst, encoding and language fixed */ - tagList->mdeKeys[tagList->itemcount]->encoding = XA_CHARACTERENCODING_ASCII; - tagList->mdeValues[tagList->itemcount]->encoding = XA_CHARACTERENCODING_ASCII; - strcpy((char*)tagList->mdeKeys[tagList->itemcount]->langCountry,"en"); - strcpy((char*)tagList->mdeValues[tagList->itemcount]->langCountry,"en"); - tagList->itemcount++; - DEBUG_API_A2("<-XAMetadataAdapt_ParseItem: added %15s : %s", - tagList->mdeKeys[tagList->itemcount-1]->data, - tagList->mdeValues[tagList->itemcount-1]->data); - return TRUE; -} - -/* - * gboolean XAMetadataAdapt_GstTagCb( GstBus *bus, GstMessage *message, gpointer data ) - * Metadata callback - called when new tags found from stream - */ -gboolean XAMetadataAdapt_GstTagCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - GstTagList *new_tags; - GstTagList **old_tags = NULL; - XAAdaptationBaseCtx* bCtx; - GstTagMergeMode mode; - - bCtx = (XAAdaptationBaseCtx*)data; - if(GST_MESSAGE_TAG==GST_MESSAGE_TYPE(message)) - { - DEBUG_API_A2("->XAMetadataAdapt_GstTagCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - gst_message_parse_tag (message, &new_tags); - /* NOTE: only general tags received this way (not child nodes)*/ - if( bCtx->ctxId == XAMDAdaptation || - bCtx->ctxId == XAMediaPlayerAdaptation ) - { - old_tags = &((XAMediaPlayerAdaptationCtx*)bCtx)->metadatavars->generaltags; - mode = GST_TAG_MERGE_REPLACE; - } - else if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - old_tags = &((XAMediaRecorderAdaptationCtx*)bCtx)->metadatavars->generaltags; - /* keep user's tags */ - mode = GST_TAG_MERGE_KEEP; - } - else - { /*context not applicable*/ - return TRUE; - } - - if( *old_tags ) - *old_tags = gst_tag_list_merge (*old_tags, new_tags, mode); - else - *old_tags = new_tags; - - if( GST_STATE(bCtx->bin)==GST_STATE_PLAYING ) - { /* send event only for live stream, otherwise wait for preroll to complete */ - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - DEBUG_API("<-XAMetadataAdapt_GstTagCb"); - } - return TRUE; -} - -/* - * void XAMetadataAdapt_TryWriteTag(const GstTagList* list, const gchar* tag, gpointer taggerptr) - * GstTaglistForeachFunc to write single tag entries to stream - */ -void XAMetadataAdapt_TryWriteTag(const GstTagList* list, const gchar* tag, gpointer taggerptr) -{ - GstTagSetter* tagger = (GstTagSetter*)taggerptr; - const gchar *key; - gchar *value; - - DEBUG_API("->XAMetadataAdapt_ParseTag"); - key = gst_tag_get_nick(tag); - if (gst_tag_get_type (tag) == G_TYPE_STRING) - { - gst_tag_list_get_string_index(list, tag, 0, &value); - } - else - { - value = g_strdup_value_contents (gst_tag_list_get_value_index (list, tag, 0)); - } - gst_tag_setter_add_tags(tagger, GST_TAG_MERGE_REPLACE, key, value, NULL); -} - -/* - * XAresult XAMetadataAdapt_TryWriteTags(XAAdaptationBaseCtx* bCtx, GstBin* binToWriteTo) - */ -XAresult XAMetadataAdapt_TryWriteTags(XAAdaptationBaseCtx* bCtx, GstBin* binToWriteTo) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstTagSetter *tagger=NULL; - /* Find metadata tagger from bin (if any) */ - GstIterator *iter = gst_bin_iterate_all_by_interface( binToWriteTo, GST_TYPE_TAG_SETTER ); - gboolean done = FALSE; - XAMediaRecorderAdaptationCtx* mCtx; - XAAdaptEvent mdevent = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_WRITTEN, 0, NULL }; - - DEBUG_API("->XAMetadataAdapt_TryWriteTags"); - - if( bCtx->ctxId != XAMediaRecorderAdaptation ) - { - return XA_RESULT_FEATURE_UNSUPPORTED; - } - mCtx = ((XAMediaRecorderAdaptationCtx*)bCtx); - while (!done) - { - switch (gst_iterator_next(iter, (gpointer)&tagger)) - { - case GST_ITERATOR_OK: - if(mCtx->metadatavars) - { - if(mCtx->metadatavars->generaltags) - { - gst_tag_setter_merge_tags(tagger, mCtx->metadatavars->generaltags, GST_TAG_MERGE_REPLACE); - } - } - done = TRUE; - break; - case GST_ITERATOR_ERROR: - done = TRUE; - DEBUG_ERR("Pipeline does not support tag setting"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - break; - case GST_ITERATOR_DONE: - done = TRUE; - DEBUG_ERR("Pipeline does not support tag setting"); - ret = XA_RESULT_CONTENT_UNSUPPORTED; - break; - case GST_ITERATOR_RESYNC: - gst_iterator_resync(iter); - break; - } - } - /*here datasize field is used for return value*/ - mdevent.datasize = ret; - XAAdaptationBase_SendAdaptEvents(bCtx, &mdevent ); - gst_iterator_free (iter); - DEBUG_API("<-XAMetadataAdapt_TryWriteTags"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xametadataadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xametadataadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMETADATAADAPTATION_H -#define XAMETADATAADAPTATION_H - -#include "XADebug.h" -#include "XAAdaptationContextBase.h" -#include "XAMediaRecorderAdaptCtx.h" - -/* FUNCTIONS */ -typedef struct XAMetadataImplTagList -{ - XAuint32 itemcount; /* number of items in all three following arrays */ - XAMetadataInfo** mdeKeys; /* array of tag keys */ - XAMetadataInfo** mdeValues; /* array of tag values */ -} XAMetadataImplTagList; - -XAresult XAMetadataAdapt_PreInit(XAAdaptationBaseCtx *bCtx); -XAresult XAMetadataAdapt_PostInit(XAAdaptationBaseCtx *bCtx); -const XAchar* XAMetadataAdapt_ParseKhronosKey(const XAchar* KKey); -void XAMetadataAdapt_FreeImplTagList(XAMetadataImplTagList *list, XAboolean freeItems); - -XAresult XAMetadataExtractionItfAdapt_FillTagList(XAAdaptationBaseCtx *bCtx, - XAMetadataImplTagList* tagList); - - -XAresult XAMetadataTraversalItfAdapt_SetMode(XAAdaptationBaseCtx *bCtx, XAuint32 mode); -XAresult XAMetadataTraversalItfAdapt_GetChildCount(XAAdaptationBaseCtx *bCtx, XAuint32 *pCount); -XAresult XAMetadataTraversalItfAdapt_GetChildMIMETypeSize(XAAdaptationBaseCtx *bCtx, - XAuint32 index, - XAuint32 *pSize); -XAresult XAMetadataTraversalItfAdapt_GetChildInfo(XAAdaptationBaseCtx *bCtx, - XAuint32 index, - XAint32 *pNodeID, - XAuint32 *pType, - XAuint32 size, - XAchar *pMimeType); -XAresult XAMetadataTraversalItfAdapt_SetActiveNode(XAAdaptationBaseCtx *bCtx, - XAuint32 index); - -XAresult XAMetadataInsertionItfAdapt_CreateChildNode(XAAdaptationBaseCtx *bCtx, - XAint32 parentNodeID, - XAuint32 type, - XAchar *mimeType, - XAint32 *pChildNodeID); -XAresult XAMetadataInsertionItfAdapt_GetSupportedKeysCount(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAboolean *pFreeKeys, - XAuint32 *pKeyCount, - XAuint32 *pEncodingCount); -XAresult XAMetadataInsertionItfAdapt_GetKeySize(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 *pKeySize); -XAresult XAMetadataInsertionItfAdapt_GetKey(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAuint32 keyIndex, - XAuint32 keySize, - XAMetadataInfo *pKey); -XAresult XAMetadataInsertionItfAdapt_GetFreeKeysEncoding(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAuint32 encodingIndex, - XAuint32 *pEncoding); -XAresult XAMetadataInsertionItfAdapt_InsertMetadataItem(XAAdaptationBaseCtx *bCtx, - XAint32 nodeID, - XAMetadataInfo *pKey, - XAMetadataInfo *pValue, - XAboolean overwrite); -#endif /* XAMETADATAADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xametadataadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xametadataadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAMetadataAdaptCtx.h" -#include "XAAdaptation.h" - -/* - * XAAdaptationBaseCtx* XAMetadataAdapt_Create() - * Allocates memory for Metadata Adaptation Context and makes 1st phase initialization - * @returns XAMetadataAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XAMetadataAdaptCtx_Create(XADataSource* pDataSrc) -{ - /* use media player context with NULL sinks - * (no specific MDE context needed, because in GStreamer, - * playback resources are needed for getting stream tags) - **/ - return XAMediaPlayerAdapt_Create(pDataSrc,NULL,NULL,NULL,NULL,NULL); -} - -/* - * XAresult XAMetadataAdapt_PostInit() - * 2nd phase initialization of Metadata Adaptation Context - */ -XAresult XAMetadataAdaptCtx_PostInit(XAAdaptationBaseCtx* bCtx) -{ - /* pipe to media player adaptation */ - return XAMediaPlayerAdapt_PostInit(bCtx); -} - -/* - * void XAMetadataAdapt_Destroy(XAMetadataAdaptationCtx* ctx) - * Destroys Metadata Adaptation Context - * @param ctx - Metadata Adaptation context to be destroyed - */ -void XAMetadataAdaptCtx_Destroy(XAAdaptationBaseCtx* bCtx) -{ - /* pipe to media player adaptation */ - XAMediaPlayerAdapt_Destroy(bCtx); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xametadataadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xametadataadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMETADATAADAPTCTX_H -#define XAMETADATAADAPTCTX_H - -#include "XAMediaPlayerAdaptCtx.h" -/* TYPEDEFS */ - -/* use media player context with NULL sinks - * (no specific MDE context needed, because in GStreamer, - * playback resources are needed for getting stream tags) - */ -typedef struct XAMediaPlayerAdaptationCtx_ XAMetadataAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAMetadataAdaptCtx_Create(XADataSource* pDataSource); -XAresult XAMetadataAdaptCtx_PostInit(XAAdaptationBaseCtx* bCtx); -void XAMetadataAdaptCtx_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XAMETADATAADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xangavideosink.cpp --- a/khronosfws/openmax_al/src/adaptation/xangavideosink.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,160 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -/* -Media Helper Class for handling surface events - -Shy Ward -*/ - -#include "XANGAVideoSink.h" -#include "openmaxalwrapper.h" - - -CNgaVideoSink* CNgaVideoSink::NewL() -{ - CNgaVideoSink* self = new CNgaVideoSink(); - self->ConstructL(); - return self; -} - -CNgaVideoSink::~CNgaVideoSink() -{ - iMediaClientVideoDisplay->RemoveDisplayWindow(*m_pWindow); - delete iMediaClientVideoDisplay; - if(IsActive()) - { - Cancel(); - } -} - -CNgaVideoSink::CNgaVideoSink() - :CActive(EPriorityStandard) -{ - iMediaClientVideoDisplay = NULL; - CActiveScheduler::Add(this); - m_ThreadHandle.Duplicate(RThread()); - m_MediaHelperInitialized = EInitializedReady; - m_rotation = EVideoRotationNone; - m_scaleWidth = (100.0f); - m_scaleHeight = (100.0f); - m_horizPos = (EHorizontalAlignCenter); - m_vertPos = (EVerticalAlignCenter); -} - -void CNgaVideoSink::RunL() -{ - iMediaClientVideoDisplay->SurfaceCreated(m_surfaceId,m_cropRect,m_pixelAspectRatio,m_cropRegion); -} - -void CNgaVideoSink::Activate() -{ - if(!IsActive()) - { - iStatus = KRequestPending; - SetActive(); - } -} - -void CNgaVideoSink::DoCancel() -{ - if(iStatus.Int() == KRequestPending) - { - TRequestStatus* pStatus = &iStatus; - m_ThreadHandle.RequestComplete(pStatus, KErrCancel); - } -} - -void CNgaVideoSink::CompleteRequest(TInt status) -{ - // Checking for IsActive alone results in this block getting executed - // from other thread more thanone time. Hence the chk for iStatus - if(IsActive() && iStatus == KRequestPending) - { - TRequestStatus* pStatus = &iStatus; - m_ThreadHandle.RequestComplete(pStatus, status); - } -} - -void CNgaVideoSink::SurfaceCreated(int surfaceid0,int surfaceid1,int surfaceid2,int surfaceid3,int crop_rect_tl_x, - int crop_rect_tl_y,int crop_rect_br_x,int crop_rect_br_y,int aspect_ratio_num,int aspect_ratio_denom) -{ - - m_surfaceId.iInternal[0] = surfaceid0; - m_surfaceId.iInternal[1] = surfaceid1; - m_surfaceId.iInternal[2] = surfaceid2; - m_surfaceId.iInternal[3] = surfaceid3; - m_cropRect.iTl.iX = crop_rect_tl_x; - m_cropRect.iTl.iY = crop_rect_tl_y; - m_cropRect.iBr.iX = crop_rect_br_x; - m_cropRect.iBr.iY = crop_rect_br_y; - m_pixelAspectRatio.iNumerator = aspect_ratio_num; - m_pixelAspectRatio.iDenominator = aspect_ratio_denom; - - Activate(); - CompleteRequest(KErrNone); - -} - -void CNgaVideoSink::ConstructL() -{ - iMediaClientVideoDisplay = CMediaClientVideoDisplay::NewL(0); - Activate(); -} - -void CNgaVideoSink::SetNativeDisplayInformation(void* display_info) -{ - //display_info is of type XADataSink - //display_info.pLocator is of type XADataLocator_NativeDisplay - XADataLocator_NativeDisplay* nativeDisplay; - XADataSink* videoSink = (XADataSink*)display_info; - - nativeDisplay = (XADataLocator_NativeDisplay*) (videoSink->pLocator); - //TODO: scrDevice is not been passed Properly - // Add the display window - m_cropRegion = TRect(((RWindow*)(nativeDisplay->hWindow))->Size()); - m_videoExtent = TRect(((RWindow*)(nativeDisplay->hWindow))->Size()); - m_cropRect = TRect(((RWindow*)(nativeDisplay->hWindow))->Size()); - m_clipRect = TRect(((RWindow*)(nativeDisplay->hWindow))->Size()); - m_cropRegion = TRect(((RWindow*)(nativeDisplay->hWindow))->Size()); - m_pWindow = ((RWindow*)(nativeDisplay->hWindow)); - - - iMediaClientVideoDisplay->AddDisplayWindowL(m_pWindow, m_clipRect, m_cropRegion, m_videoExtent, m_scaleWidth, m_scaleHeight, - m_rotation, EAutoScaleBestFit, m_horizPos, m_vertPos, m_pWindow); - -} - -extern "C" { - - void* nga_video_sink_init() - { - return CNgaVideoSink::NewL(); - } - - void surface_created(void* context,int surfaceid0,int surfaceid1,int surfaceid2,int surfaceid3,int crop_rect_tl_x, - int crop_rect_tl_y,int crop_rect_br_x,int crop_rect_br_y,int aspect_ratio_num,int aspect_ratio_denom) - { - ((CNgaVideoSink*)(context))->SurfaceCreated(surfaceid0,surfaceid1,surfaceid2,surfaceid3,crop_rect_tl_x, - crop_rect_tl_y,crop_rect_br_x,crop_rect_br_y,aspect_ratio_num,aspect_ratio_denom); - } - - void setup_native_display(void* context, void* display_info) - { - ((CNgaVideoSink*)(context))->SetNativeDisplayInformation(display_info); - } - -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xangavideosink.h --- a/khronosfws/openmax_al/src/adaptation/xangavideosink.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ -/* -Media Helper Class for handling surface events - -Shy Ward -*/ - -#ifndef XA_CNGAVIDEOSINK_H -#define XA_CNGAVIDEOSINK_H - -#define ENABLE_GRAPHICS_SURFACE_INTEGRATION - - -#ifdef __cplusplus - -#include -#ifdef ENABLE_GRAPHICS_SURFACE_INTEGRATION -#include //TSurfaceId -#include //TVideoAspectRatio -#include -#endif - -class CNgaVideoSink : public CBase, - public CActive - { -public: - - static CNgaVideoSink* NewL(); - ~CNgaVideoSink(); - void SurfaceCreated(int surfaceid0,int surfaceid1,int surfaceid2,int surfaceid3,int crop_rect_tl_x, - int crop_rect_tl_y,int crop_rect_br_x,int crop_rect_br_y,int aspect_ratio_num,int aspect_ratio_denom); - void SetNativeDisplayInformation(void* display_info); - - // CActive methods - virtual void RunL(); - virtual void DoCancel(); - void Activate(); - - void CompleteRequest(TInt status = KErrNone); - -private: - CNgaVideoSink(); - void ConstructL(); - - RThread m_ThreadHandle; - - enum InitializeState - { - EInitializedReady = 0, - EInitializedSuccess, - EInitializedFailed, - }; - -#ifdef ENABLE_GRAPHICS_SURFACE_INTEGRATION - CMediaClientVideoDisplay* iMediaClientVideoDisplay; - TSurfaceId surfaceId; - TRect m_clipRect; - TRect m_videoExtent; - TRect m_cropRegion; - TVideoAspectRatio m_pixelAspectRatio; - RWindow* m_pWindow; - TRect m_cropRect; - TSurfaceId m_surfaceId; - InitializeState m_MediaHelperInitialized; - TVideoRotation m_rotation; - TReal32 m_scaleWidth; - TReal32 m_scaleHeight; - TInt m_horizPos; - TInt m_vertPos; - -#endif /*ENABLE_GRAPHICS_SURFACE_INTEGRATION*/ - }; -#else /* __cplusplus */ - - -extern void* nga_video_sink_init(); - -extern void surface_created(void* context,int surfaceid0,int surfaceid1,int surfaceid2,int surfaceid3,int crop_rect_tl_x, - int crop_rect_tl_y,int crop_rect_br_x,int crop_rect_br_y,int aspect_ratio_num,int aspect_ratio_denom); -extern void setup_native_display(void* context, void* display_info); - - -#endif /* __cplusplus */ - -#endif /* XA_CNGAVIDEOSINK_H */ \ No newline at end of file diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaoutputmixadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xaoutputmixadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,229 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAOutputMixAdaptCtx.h" -#include "XAAdaptation.h" -#include "XAStaticCapsAdaptation.h" - - -/* - * XAAdaptationBaseCtx* XAOutputMixAdapt_Create() - * @returns XAOutputMixAdaptationCtx* - Pointer to created context - * Description: Allocates memory for Output Mix Adaptation Context and makes 1st phase initialization - */ -XAAdaptationBaseCtx* XAOutputMixAdapt_Create() -{ - XAOutputMixAdaptationCtx *pSelf = calloc(1, sizeof(XAOutputMixAdaptationCtx)); - - DEBUG_API("->XAOutputMixAdapt_Create"); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XAOutputMixAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - XAuint32 devId; - pSelf->connectedObjects = g_array_new (FALSE, TRUE, sizeof (XAOMixAdaptConnObj)); - pSelf->availableDevices = g_array_new (FALSE, TRUE, sizeof (XAuint32)); - /*initially, only alsasink available*/ -// devId = XA_ADAPTID_ALSASINK; - devId = XA_ADAPTID_DEVSOUNDSINK; - g_array_append_val(pSelf->availableDevices, devId); - pSelf->currentrouting = devId; - } - } - DEBUG_API("<-XAOutputMixAdapt_Create"); - return (XAAdaptationBaseCtx* )pSelf; -} - -/* - * XAresult XAOutputMixAdapt_PostInit(XAAdaptationBaseCtx* bCtx) - * 2nd phase initialization of Output Mix Adaptation Context - */ -XAresult XAOutputMixAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAOutputMixAdaptationCtx* ctx = NULL; - - DEBUG_API("->XAOutputMixAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAOutputMixAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAOutputMixAdaptationCtx*)bCtx; - - /* check and add devices to pSelf->availableDevices if such detection can be done */ - DEBUG_API("<-XAOutputMixAdapt_PostInit"); - return XA_RESULT_SUCCESS; -} - -/* - * void XAOutputMixAdapt_Destroy(XAAdaptationBaseCtx* bCtx) - * Destroys Output Mix Adaptation Context - * @param ctx - Output Mix Adaptation context to be destroyed - */ -void XAOutputMixAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XAOutputMixAdaptationCtx* ctx = NULL; - DEBUG_API("->XAOutputMixAdapt_Destroy"); - if(bCtx == NULL || bCtx->ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAOutputMixAdapt_Destroy"); - return; - } - ctx = (XAOutputMixAdaptationCtx*)bCtx; - g_array_free(ctx->connectedObjects, TRUE); - g_array_free(ctx->availableDevices, TRUE); - - XAAdaptationBase_Free( &(ctx->baseObj) ); - free(ctx); - DEBUG_API("<-XAOutputMixAdapt_Destroy"); -} - -/* - * GstElement* XAOutputMixAdapt_GetSink(XAAdaptationBaseCtx* bCtx) - */ -GstElement* XAOutputMixAdapt_GetSink(XAAdaptationBaseCtx* bCtx) -{ - XAOutputMixAdaptationCtx* mixCtx = NULL; - /* create sink for current routing */ - GstElement* newsink=NULL; - XAStaticCapsData temp; - - DEBUG_API("->XAOutputMixAdapt_GetSink"); - if(bCtx == NULL || bCtx->ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAOutputMixAdapt_GetSink"); - return NULL; - } - mixCtx = (XAOutputMixAdaptationCtx*)bCtx; - - if(!mixCtx) - { - DEBUG_ERR("NULL context!"); - return NULL; - } - - if( XA_RESULT_SUCCESS == - XAStaticCapsAdapt_GetCapsById(XACAP_DEVSNK|XACAP_AUDIO, mixCtx->currentrouting, &temp) ) - { - newsink = gst_element_factory_make((char*)temp.adaptId,(char*)temp.adaptId); - if(!newsink) - { - DEBUG_ERR_A1("Could not create sink \"%s\"!", (char*)temp.adaptId); - } - } - else - { - DEBUG_ERR_A1("Could not find audio device by id 0x%x", (int)mixCtx->currentrouting); - } - DEBUG_API("<-XAOutputMixAdapt_GetSink"); - return newsink; - -} - -/* - * XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx, GstElement* usedMix) - */ -XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx, GstElement* usedMix) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 i=0; - XAOutputMixAdaptationCtx* mixCtx =NULL; - DEBUG_API("->XAOutputMixAdapt_ConnectObject"); - if( !omCtx || omCtx->ctxId!=XAOutputMixAdaptation || !bCtx || !usedMix ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_ConnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - mixCtx = (XAOutputMixAdaptationCtx*)omCtx; - if( !mixCtx || !bCtx || !usedMix ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; iconnectedObjects->len; i++) - { - if( (g_array_index(mixCtx->connectedObjects, XAOMixAdaptConnObj, i)).ctx == bCtx ) - { - /*item found already*/ - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - if(i==mixCtx->connectedObjects->len) - { - XAOMixAdaptConnObj tmp; - tmp.ctx= bCtx; - tmp.currentSink = usedMix; - g_array_append_val(mixCtx->connectedObjects, tmp); - } - - DEBUG_API("<-XAOutputMixAdapt_ConnectObject"); - return ret; -} - -/* - * XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx) - */ -XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationBaseCtx* omCtx, XAAdaptationBaseCtx* bCtx) -{ - XAuint32 i=0; - XAOutputMixAdaptationCtx* mixCtx =NULL; - DEBUG_API("->XAOutputMixAdapt_DisconnectObject"); - - if( !omCtx || omCtx->ctxId!=XAOutputMixAdaptation || !bCtx ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - mixCtx = (XAOutputMixAdaptationCtx*)omCtx; - - if( !mixCtx || !bCtx ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; iconnectedObjects->len; i++) - { - XAOMixAdaptConnObj* tmp = &(g_array_index(mixCtx->connectedObjects, XAOMixAdaptConnObj, i)); - if( tmp->ctx == bCtx ) - { - g_array_remove_index(mixCtx->connectedObjects, i); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_SUCCESS; - } - } - /*did not find, return error*/ - DEBUG_ERR("Object not found!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaoutputmixadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xaoutputmixadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAOUTPUTMIXADAPTCTX_H -#define XAOUTPUTMIXADAPTCTX_H - -#include "XAAdaptationContextBase.h" - -/* TYPEDEFS */ - -typedef struct XAOutputMixAdaptationCtx_ XAOutputMixAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAOutputMixAdapt_Create(); -XAresult XAOutputMixAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XAOutputMixAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XAOUTPUTMIXADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaoutputmixitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaoutputmixitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAOutputMixAdaptCtx.h" -#include "XAOutputMixItfAdaptation.h" -#include "XAAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -/* - * XAresult XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs( XAAdaptationBaseCtx *bCtx, - * XAint32 * pNumDevices, - * XAuint32 * pDeviceIDs ) - * @param XAAdaptationBaseCtx *bCtx - Pointer to OutputMix adaptation context - * @param XAint32 * pNumDevices - [in] Length of pDeviceIDs array - * [out] number of destination devices - * @param XAuint32 * pDeviceIDs - List of DeviceIDs - * @return XAresult success value - * Description: Returns audio output deviceIDs that are currently connected - */ -XAresult XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs( XAAdaptationBaseCtx *bCtx, XAint32 * pNumDevices, XAuint32 * pDeviceIDs ) -{ - XAOutputMixAdaptationCtx* mCtx = NULL; - XAint32 iterator = 0; - DEBUG_API_A1("->XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs pNumDevices:%ld",*pNumDevices); - if(!bCtx || bCtx->ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAOutputMixAdaptationCtx*) bCtx; - if(!mCtx) - { - DEBUG_ERR("NULL context!"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( pNumDevices ) - { - *pNumDevices = mCtx->availableDevices->len; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_PARAMETER_INVALID; - } - - if(pDeviceIDs) - { /*query devices*/ - if ( *pNumDevices < mCtx->availableDevices->len ) - { /* Lenght of pDeviceIDs is insufficient for all connected audio devices */ - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_BUFFER_INSUFFICIENT; - } - - for ( iterator = 0; iterator < mCtx->availableDevices->len; iterator++ ) - { - pDeviceIDs[iterator] = g_array_index(mCtx->availableDevices,XAuint32,iterator); - } - } - - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_SUCCESS; -} - - -/* - * XAresult XAOutputMixItfAdapt_ReRoute( XAAdaptationBaseCtx *bCtx, - * XAint32 numOutputDevices, - * XAuint32 * pOutputDeviceIDs) - * @param XAAdaptationBaseCtx *bCtx - Ponter to OutputMix adaptation context - * @param XAint32 numOutputDevices - Length of pOutputDeviceIDs - * @param XAuint32 * pOutputDeviceIDs - List of requested audio output device IDs - * @return XAresult success value - * Description: Reroutes audio output to requested destination devices - */ -XAresult XAOutputMixItfAdapt_ReRoute( XAAdaptationBaseCtx *bCtx, XAint32 numOutputDevices, XAuint32 * pOutputDeviceIDs) -{ - XAresult ret = XA_RESULT_SUCCESS; - gint32 idx = 0; - XAOutputMixAdaptationCtx* mCtx = NULL; - XAuint32 devId=0; - GstElement* newsink = NULL; - GstElement* current = NULL; - gchar* currentname= NULL; - XAStaticCapsData temp; - - DEBUG_API_A1("->XAOutputMixItfAdapt_ReRoute numOutputDevices:%ld",numOutputDevices); - if(!bCtx || - bCtx->ctxId != XAOutputMixAdaptation || - !pOutputDeviceIDs ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAOutputMixAdaptationCtx*) bCtx; - - if( numOutputDevices > 1 ) - { - /* currently, only routing to single output at time supported */ - return XA_RESULT_FEATURE_UNSUPPORTED; - } - devId = pOutputDeviceIDs[0]; - - for ( idx = 0; idx < mCtx->connectedObjects->len; idx++ ) - { - /*find wanted output plugin name*/ - if( XA_RESULT_SUCCESS == - XAStaticCapsAdapt_GetCapsById(XACAP_DEVSNK|XACAP_AUDIO, devId, &temp) ) - { - XAAdaptationBaseCtx* ctx = g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).ctx; - if(!ctx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", idx); - return XA_RESULT_INTERNAL_ERROR; - } - /*check current output plugin name*/ - current = g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).currentSink; - currentname = gst_element_get_name(current); - DEBUG_INFO_A2("OMix pl%d - current output: \"%s\"", (int)idx, (char*)currentname); - DEBUG_INFO_A3("OMix pl%d - wanted output: \"%s\" (id 0x%x)", (int)idx, (char*)temp.adaptId, (int)devId); - if(strcmp(currentname,(char*)temp.adaptId)!=0) - { - if(ret==XA_RESULT_SUCCESS) - { - mCtx->currentrouting = devId; - g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).currentSink = newsink; - } - newsink = gst_bin_get_by_name(GST_BIN(ctx->bin), (char*)temp.adaptId); - if(!newsink) - { /*not existing yet, create*/ - newsink = gst_element_factory_make((char*)temp.adaptId,(char*)temp.adaptId); - gst_bin_add(GST_BIN(ctx->bin), newsink); - } - if(!newsink) - { - DEBUG_ERR_A1("Could not create wanted sink \"%s\"!", (char*)temp.adaptId); - ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - /* switch routing: pause, block, unlink old, link new, unblock pipe, play*/ - GstPad *sinkpad=NULL, *blockpad=NULL; - sinkpad = gst_element_get_static_pad(current,"sink"); - if(sinkpad) - { - blockpad = gst_pad_get_peer(sinkpad); - } - if(blockpad && gst_pad_is_active(blockpad)) - { - DEBUG_INFO("block pad"); - gst_pad_set_blocked_async(blockpad,TRUE,XAAdaptationBase_PadBlockCb,NULL); - } - gst_pad_unlink(blockpad, sinkpad); - sinkpad = gst_element_get_static_pad(newsink,"sink"); - gst_pad_link(blockpad, sinkpad); - if(gst_pad_is_blocked(blockpad)) - { - DEBUG_INFO("unblock pad"); - gst_pad_set_blocked_async(blockpad,FALSE,XAAdaptationBase_PadBlockCb,NULL); - } - /*set sink to same state as the mp bin*/ - gst_element_sync_state_with_parent(newsink); - mCtx->currentrouting = devId; - g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).currentSink = newsink; - } - } - else - { - DEBUG_INFO("No routing switch needed"); - } - } - else - { - DEBUG_ERR_A1("Could not find audio device by id 0x%x", (int)devId); - ret = XA_RESULT_PARAMETER_INVALID; - } - } - - DEBUG_API("<-XAOutputMixItfAdapt_ReRoute"); - return ret; -} - - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaoutputmixitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaoutputmixitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef OUTPUTMIXITFADAPTATION_H_ -#define OUTPUTMIXITFADAPTATION_H_ - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -XAresult XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs( XAAdaptationBaseCtx *bCtx, XAint32 * pNumDevices, XAuint32 * pDeviceIDs ); -XAresult XAOutputMixItfAdapt_ReRoute( XAAdaptationBaseCtx *bCtx, XAint32 numOutputDevices, XAuint32 * pOutputDeviceIDs); - -#endif /* OUTPUTMIXITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaplaybackrateitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaplaybackrateitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAPlaybackRateItfAdaptation.h" -#include "XAPlayItfAdaptation.h" - -/*XA_RATEPROP_STAGGEREDVIDEO,XA_RATEPROP_SMOOTHVIDEO,XA_RATEPROP_SILENTAUDIO, - XA_RATEPROP_STAGGEREDAUDIO,XA_RATEPROP_NOPITCHCORAUDIO,XA_RATEPROP_PITCHCORAUDIO*/ -#define SUPPORTEDPROPS (XA_RATEPROP_SMOOTHVIDEO | XA_RATEPROP_SILENTAUDIO) -/* NOTE: currently rewind rates do not seem to work */ -#define MINRATE (100) -#define MAXRATE 8000 -/* - * XAresult XAPlaybackRateItfAdapt_SetRate(XAAdaptationBaseCtx *bCtx, XApermille rate) - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * @param XApermille rate - new playback rate in permilles of original speed - * @return XAresult ret - Success value - */ -XAresult XAPlaybackRateItfAdapt_SetRate(XAAdaptationBaseCtx *bCtx, XApermille rate) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - DEBUG_API_A1("->XAPlaybackRateItfAdapt_SetRate %d permilles", rate); - - if( !bCtx || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - if( rateMAXRATE ) - { - DEBUG_ERR("Invalid rate!"); - return XA_RESULT_PARAMETER_INVALID; - } - if(rate != 0) - { - mCtx->playrate = ((gdouble)rate)/1000; - if( GST_STATE(bCtx->bin) < GST_STATE_PAUSED ) - { /* This should not happen */ - DEBUG_ERR("WARNING: Gst not prerolled yet!"); - } - else - { - /* apply immediately */ - XAAdaptationBase_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Apply new playrate %f.", mCtx->playrate); - if(!gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, - GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_NONE, 0, - GST_SEEK_TYPE_NONE, -1)) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationBase_StartAsyncWait(bCtx); - DEBUG_INFO("New playrate handled.") - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - } - else - { /* Gst do not accept rate of 0, pause instead */ - mCtx->playrate = 1.0; - if( GST_STATE(bCtx->bin) > GST_STATE_PAUSED ) - { - DEBUG_ERR("Pause playback"); - XAPlayItfAdapt_SetPlayState(bCtx, XA_PLAYSTATE_PAUSED); - } - - } - - DEBUG_API("<-XAPlaybackRateItfAdapt_SetRate"); - return ret; -} - -/* - * XAresult XAPlaybackRateItfAdapt_SetPropertyConstraints(XAAdaptationBaseCtx *bCtx, - * XAuint32 constraints) - */ -XAresult XAPlaybackRateItfAdapt_SetPropertyConstraints(XAAdaptationBaseCtx *bCtx, - XAuint32 constraints) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAPlaybackRateItfAdapt_SetPropertyConstraints"); - - if( !bCtx || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - if( (constraints & SUPPORTEDPROPS ) == 0 ) - { - DEBUG_ERR("constraints cannot be satisfied!!"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - else - { - mCtx->rateprops = SUPPORTEDPROPS & constraints; - } - DEBUG_API("<-XAPlaybackRateItfAdapt_SetPropertyConstraints"); - return ret; -} - -/* - * XAresult XAPlaybackRateItfAdapt_GetProperties(XAAdaptationBaseCtx *bCtx, - * XAuint32 *pProperties) - */ -XAresult XAPlaybackRateItfAdapt_GetProperties(XAAdaptationBaseCtx *bCtx, - XAuint32 *pProperties) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAPlaybackRateItfAdapt_GetProperties"); - - if( !bCtx || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - *pProperties = mCtx->rateprops; - - DEBUG_API("<-XAPlaybackRateItfAdapt_GetProperties"); - return ret; -} - - -XAresult XAPlaybackRateItfAdapt_GetCapabilitiesOfRate(XAAdaptationBaseCtx *bCtx, - XApermille rate, - XAuint32 *pCapabilities) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAPlaybackRateItfAdapt_GetCapabilitiesOfRate"); - if( !bCtx || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - if( rateMAXRATE ) - { - DEBUG_ERR("Invalid rate!"); - *pCapabilities = 0; - ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - *pCapabilities = SUPPORTEDPROPS; - } - - DEBUG_API("<-XAPlaybackRateItfAdapt_GetCapabilitiesOfRate"); - return ret; -} - - -XAresult XAPlaybackRateItfAdapt_GetRateRange(XAAdaptationBaseCtx *bCtx, - XAuint8 index, - XApermille *pMinRate, - XApermille *pMaxRate, - XApermille *pStepSize, - XAuint32 *pCapabilities) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAPlaybackRateItfAdapt_GetRateRange"); - - if( !bCtx || bCtx->ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - /* NOTE: hardcoded values, cannot be queried from gst */ - /* only one range supported */ - if( index>0 ) - { - ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - *pMinRate = MINRATE; - *pMaxRate = MAXRATE; - *pStepSize = 0; /* continuous range */ - *pCapabilities = SUPPORTEDPROPS; - } - - DEBUG_API("<-XAPlaybackRateItfAdapt_GetRateRange"); - return ret; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaplaybackrateitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaplaybackrateitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADYNAMICSOURCEITFADAPTATION_H -#define XADYNAMICSOURCEITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* FUNCTIONS */ - -XAresult XAPlaybackRateItfAdapt_SetRate(XAAdaptationBaseCtx *bCtx, XApermille rate); - -XAresult XAPlaybackRateItfAdapt_SetPropertyConstraints(XAAdaptationBaseCtx *bCtx, - XAuint32 constraints); - -XAresult XAPlaybackRateItfAdapt_GetProperties(XAAdaptationBaseCtx *bCtx, - XAuint32 *pProperties); - -XAresult XAPlaybackRateItfAdapt_GetCapabilitiesOfRate(XAAdaptationBaseCtx *bCtx, - XApermille rate, - XAuint32 *pCapabilities); - -XAresult XAPlaybackRateItfAdapt_GetRateRange(XAAdaptationBaseCtx *bCtx, - XAuint8 index, - XApermille *pMinRate, - XApermille *pMaxRate, - XApermille *pStepSize, - XAuint32 *pCapabilities); - -#endif /* XADYNAMICSOURCEITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaplayitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaplayitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,495 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "unistd.h" -#include -#include "XAMediaPlayerAdaptCtx.h" -#include "XAPlayItfAdaptation.h" -#include "XAAdaptation.h" - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/*forward declaration of position updater callback*/ -gboolean XAPlayItfAdapt_PositionUpdate(gpointer ctx); - -/* - * XAresult XAPlayItfAdapt_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state) - * Sets play state to GStreamer. - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID - * XAuint32 state - Play state to be set - * @return XAresult ret - Success value - */ -XAresult XAPlayItfAdapt_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAboolean requestStateChange = XA_BOOLEAN_FALSE; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - XAuint32 locType = 0; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - XADataLocator_Address *address = NULL; - XAboolean playing = XA_BOOLEAN_FALSE; - DEBUG_API_A1("->XAPlayItfAdapt_SetPlayState %s",PLAYSTATENAME(state)); - - if(!bCtx || bCtx->ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - switch ( state ) - { - case XA_PLAYSTATE_STOPPED: - { - if ( cameraCtx && cameraRealized && mCtx->isobjsrc && mCtx->source ) - { - cameraCtx->playing = XA_BOOLEAN_FALSE; - if(!cameraCtx->recording && !cameraCtx->snapshotting) - { - /* Future improvement: We could block MPObjSrc pad from tee-eleement here, when - * tee-element supports sending stream to one pad when others are blocked */ - - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->source)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->source), GST_STATE_PAUSED ); - gret = gst_element_get_state( GST_ELEMENT(mCtx->source), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - - gstOrigState = GST_STATE(bCtx->bin); - if ( gstOrigState != GST_STATE_READY ) - { - DEBUG_INFO("Set gst-bin to GST_STATE_READY"); - bCtx->binWantedState = GST_STATE_READY; - XAAdaptationBase_PrepareAsyncWait(bCtx); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - XAAdaptationBase_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - gstTmpState = GST_STATE(bCtx->bin); - DEBUG_INFO_A1("Setted gst-bin to state %s", gst_element_state_get_name(gstTmpState)); - - DEBUG_INFO_A1("Restoring gst-bin state to state %s", gst_element_state_get_name(gstOrigState)); - bCtx->binWantedState = gstOrigState; - XAAdaptationBase_PrepareAsyncWait(bCtx); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - XAAdaptationBase_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - gstOrigState = GST_STATE(bCtx->bin); - DEBUG_INFO_A1("Restored gst-bin to state %s", gst_element_state_get_name(gstOrigState)); - } - - - if( bCtx->pipeSrcThrCtx.dataHandle ) - { - XAresult retVal = XA_RESULT_SUCCESS; - if ( bCtx->pipeSrcThrCtx.state != CPStateNull ) - { - bCtx->pipeSrcThrCtx.state = CPStateStopped; - } - - retVal = XAImpl_PostSemaphore( bCtx->pipeSrcThrCtx.stateSem ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not post content pipe semaphore!"); - } - - } - /* stop head and drive head to beginning */ - bCtx->binWantedState = GST_STATE_PAUSED; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - - gst_element_send_event(bCtx->bin,gst_event_new_flush_start()); - gst_element_send_event(bCtx->bin,gst_event_new_flush_stop()); - - locType = *((XAuint32*)( mCtx->xaSource->pLocator )); - if( locType == XA_DATALOCATOR_ADDRESS ) - { - address = (XADataLocator_Address*)(mCtx->xaSource->pLocator); - - /* init gst buffer from datalocator */ - if( mCtx->source ) - { - GstBuffer* userBuf = NULL; - - /* init GST buffer from XADataLocator*/ - userBuf = gst_buffer_new(); - if( userBuf ) - { - userBuf->size = address->length; - userBuf->data = address->pAddress; - /* push the whole buffer to appsrc so it is ready for preroll */ - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(mCtx->source), userBuf ); - DEBUG_INFO_A1("Sent buffer at 0x%x to appsrc", userBuf ); - gst_app_src_end_of_stream( GST_APP_SRC(mCtx->source) ); - } - else - { - DEBUG_ERR("Failure allocating buffer!"); - } - } - } - break; - } - case XA_PLAYSTATE_PAUSED: - - if ( cameraCtx && cameraRealized && mCtx->isobjsrc && mCtx->source ) - { - cameraCtx->playing = XA_BOOLEAN_FALSE; - - /* Future improvement: We could block MPObjSrc pad from tee-eleement here, when - * tee-element supports sending stream to one pad when others are blocked */ - - if(!cameraCtx->recording && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->source)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->source), GST_STATE_PAUSED ); - gret = gst_element_get_state( GST_ELEMENT(mCtx->source), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - - if ( bCtx->pipeSrcThrCtx.state != CPStateNull ) - { - bCtx->pipeSrcThrCtx.state = CPStatePaused; - } - bCtx->binWantedState = GST_STATE_PAUSED; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - break; - case XA_PLAYSTATE_PLAYING: - { - if ( cameraCtx && mCtx->isobjsrc ) - { - cameraCtx->playing = XA_BOOLEAN_TRUE; - } - - if ( mCtx->videoppBScrbin ) - { - gst_element_set_state( GST_ELEMENT(mCtx->videoppBScrbin), GST_STATE_PAUSED); - } - if (mCtx->isobjsrc && !mCtx->cameraSinkSynced && cameraCtx ) - { /* create videosink now */ - mCtx->cameraSinkSynced = XA_BOOLEAN_TRUE; - if ( mCtx->videosink ) - { - gst_element_unlink( mCtx->filter,mCtx->videosink ); - gst_element_set_state( GST_ELEMENT(mCtx->videosink), GST_STATE_NULL); - gst_bin_remove( GST_BIN(mCtx->baseObj.bin), mCtx->videosink); - mCtx->videosink = XAAdaptationBase_CreateGstSink( mCtx->xaVideoSink, "videosink", &(mCtx->isobjvsink) ); - gst_bin_add(GST_BIN(mCtx->baseObj.bin), mCtx->videosink); - gst_element_link(mCtx->filter, mCtx->videosink); - } - } - - if ( bCtx->pipeSrcThrCtx.state != CPStateNull ) - { - XAresult retVal = XA_RESULT_SUCCESS; - - if ( bCtx->pipeSrcThrCtx.state == CPStateInitialized ) - { /* Start thread if it's not running */ - retVal = XAImpl_StartThread( &(bCtx->pipeSrcThr), NULL, &XAAdaptationBase_ContentPipeScrThrFunc, &(bCtx->pipeSrcThrCtx) ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not start content pipe thread!"); - } - } - if ( bCtx->pipeSrcThrCtx.state == CPStatePaused || - bCtx->pipeSrcThrCtx.state == CPStateInitialized || - bCtx->pipeSrcThrCtx.state == CPStateStarted ) - retVal = XAImpl_PostSemaphore( bCtx->pipeSrcThrCtx.stateSem ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not post content pipe semaphore!"); - } - } - - bCtx->binWantedState = GST_STATE_PLAYING; - if(mCtx->playrate!=1 && !mCtx->isobjsrc) - { /*set seek element for ff, rew and slow*/ - XAAdaptationBase_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Apply new playrate %f.", mCtx->playrate); - if(!gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, - GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_NONE, 0, - GST_SEEK_TYPE_NONE, -1)) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationBase_StartAsyncWait(bCtx); - DEBUG_INFO("New playrate handled."); - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - - playing = XA_BOOLEAN_TRUE; - break; - } - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - /* launch Gstreamer state change only if necessary */ - if( GST_STATE_TARGET(bCtx->bin) == bCtx->binWantedState ) - { - DEBUG_INFO("Gst already in or transitioning to wanted state"); - requestStateChange = XA_BOOLEAN_FALSE; - } - else - { - if( (GST_STATE(bCtx->bin) == bCtx->binWantedState) && - (GST_STATE_PENDING(bCtx->bin) == GST_STATE_VOID_PENDING) ) - { - DEBUG_ERR_A3("WARNING : gststate %d == wanted %d != gsttarget %d and no statechange pending", - GST_STATE(bCtx->bin), bCtx->binWantedState, GST_STATE_TARGET(bCtx->bin)); - } - requestStateChange = XA_BOOLEAN_TRUE; - } - - if( requestStateChange ) - { - XAAdaptationBase_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Sending change state request to state %d", bCtx->binWantedState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - XAAdaptationBase_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_NO_PREROLL: - DEBUG_INFO("GST_STATE_CHANGE_NO_PREROLL"); - /* deliberate fall-through */ - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - ret = XA_RESULT_SUCCESS; - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - ret = XA_RESULT_UNKNOWN_ERROR; - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - - if (playing && mCtx->isobjsrc && cameraCtx ) - { - GstPad* moSrc=NULL ; - - playing = XA_BOOLEAN_FALSE; - moSrc = gst_element_get_static_pad( mCtx->source, "MPObjSrc"); - if( moSrc && gst_pad_is_linked(moSrc) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name( mCtx->source), - gst_pad_get_name(moSrc)); - gst_pad_set_blocked_async(moSrc, FALSE, XAAdaptationBase_PadBlockCb, NULL); - } - - if ( GST_STATE( GST_ELEMENT(mCtx->source)) != GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Start camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->source), GST_STATE_PLAYING ); - gret = gst_element_get_state( GST_ELEMENT(mCtx->source), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - DEBUG_API("<-XAPlayItfAdapt_SetPlayState"); - return ret; -} - -/* - * XAresult XAPlayItfAdapt_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID - * XAmillisecond *pMsec - Pointer where to store duration of stream. - * @return XAresult ret - Success value - */ -XAresult XAPlayItfAdapt_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - GstFormat format = GST_FORMAT_TIME; - gint64 duration; - DEBUG_API("->XAPlayItfAdapt_GetDuration"); - - if(!bCtx || bCtx->ctxId != XAMediaPlayerAdaptation || !pMsec) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - if( gst_element_query_duration( GST_ELEMENT(bCtx->bin), &format, &duration ) ) - { - DEBUG_INFO_A1("Duration: %"GST_TIME_FORMAT, GST_TIME_ARGS(duration)); - ret = XA_RESULT_SUCCESS; - *pMsec = GST_TIME_AS_MSECONDS(duration);/*Warning ok due to used API specification*/ - } - else - { - DEBUG_ERR("WARNING: Gst: could not get duration"); - *pMsec = XA_TIME_UNKNOWN; - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XAPlayItfAdapt_GetDuration"); - return ret; -} - -/* - * XAresult XAPlayItfAdapt_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * XAmillisecond *pMsec - Pointer where to store current position in stream. - * @return XAresult ret - Success value - */ -XAresult XAPlayItfAdapt_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - gint64 position; - GstFormat format = GST_FORMAT_TIME; - DEBUG_API("->XAPlayItfAdapt_GetPosition"); - - if(!bCtx || bCtx->ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - if ( gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - DEBUG_INFO_A1("Current position %"GST_TIME_FORMAT, GST_TIME_ARGS(position)); - ret = XA_RESULT_SUCCESS; - *pMsec = GST_TIME_AS_MSECONDS(position);/*Warning ok due to used API specification*/ - } - else - { - DEBUG_ERR("WARNING: Gst: could not get position"); - /* probably not fully prerolled - safe assumption for position = 0 */ - *pMsec = 0; - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XAPlayItfAdapt_GetPosition"); - return ret; -} - -/* - * XAresult XAPlayItfAdapt_EnablePositionTracking - * Enable/disable periodic position tracking callbacks - */ -XAresult XAPlayItfAdapt_EnablePositionTracking(XAAdaptationBaseCtx *bCtx, XAboolean enable) -{ - XAMediaPlayerAdaptationCtx* mCtx; - - DEBUG_API_A1("->XAPlayItfAdapt_EnablePositionTracking (enable: %d)", (int)enable); - if(!bCtx || bCtx->ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - if(enable && !(mCtx->trackpositionenabled)) - { - mCtx->trackpositionenabled = XA_BOOLEAN_TRUE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - else if (!enable && (mCtx->trackpositionenabled)) - { - mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - - DEBUG_API("<-XAPlayItfAdapt_EnablePositionTracking"); - return XA_RESULT_SUCCESS; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaplayitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaplayitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAPLAYITFADAPTATION_H -#define XAPLAYITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -#ifdef _DEBUG -/*parse state names for debug prints*/ -static const char* playstatenames[3] = -{ - "XA_PLAYSTATE_STOPPED", - "XA_PLAYSTATE_PAUSED", - "XA_PLAYSTATE_PLAYING" -}; -#define PLAYSTATENAME(i) (const char*)((i>0&&i<4)?playstatenames[i-1]:"INVALID") -#endif /*_DEBUG*/ - - -/* FUNCTIONS */ - -XAresult XAPlayItfAdapt_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state); -XAresult XAPlayItfAdapt_GetDuration(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec); -XAresult XAPlayItfAdapt_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec); -XAresult XAPlayItfAdapt_EnablePositionTracking(XAAdaptationBaseCtx *bCtx, XAboolean enable); - - -#endif /* XAPLAYITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaradioadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xaradioadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XARadioAdaptCtx.h" -#include "XAAdaptation.h" -#include "assert.h" - - -/* - * XAAdaptationBaseCtx* XARadioAdapt_Create() - * Allocates memory for Radio Adaptation Context and makes 1st phase initialization - * @returns XARadioAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XARadioAdapt_Create() -{ - XARadioAdaptationCtx *pSelf = calloc(1, sizeof(XARadioAdaptationCtx)); - DEBUG_API("->XARadioAdapt_Create"); - - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XARadioAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->state = XA_RADIO_IDLE; - pSelf->range = RADIO_DEFAULT_FREQ_RANGE; - pSelf->frequency = RADIO_DEFAULT_FREQ; - - pSelf->rdsEmulationThread = 0; - pSelf->emulationThread = 0; - } - } - - DEBUG_API("<-XARadioAdapt_Create"); - return (XAAdaptationBaseCtx*)pSelf; -} - -/* - * XAresult XARadioAdapt_PostInit() - * 2nd phase initialization of Radio Adaptation Context - */ -XAresult XARadioAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* ctx = NULL; - DEBUG_API("->XARadioAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XARadioAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XARadioAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XARadioAdaptationCtx*)bCtx; - - assert(ctx); - - ret = XAAdaptationBase_PostInit( &ctx->baseObj ); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Base context postinit failed!!"); - DEBUG_API("<-XARadioAdapt_PostInit"); - return ret; - } - - ctx->baseObj.bin = gst_element_factory_make( "audiotestsrc", "audiosrc"); - if ( !ctx->baseObj.bin ) - { - DEBUG_ERR("Unable to create test audio source!"); - DEBUG_API("<-XARadioAdapt_PostInit"); - return XA_RESULT_INTERNAL_ERROR; - } - g_object_set( G_OBJECT(ctx->baseObj.bin), "wave", 0x5, NULL ); - - DEBUG_API("<-XARadioAdapt_PostInit"); - return ret; -} - -/* - * void XARadioAdapt_Destroy(XAAdaptationBaseCtx* bCtx) - * Destroys Radio Adaptation Context - * @param ctx - Radio Adaptation context to be destroyed - */ -void XARadioAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XARadioAdaptationCtx* ctx = NULL; - DEBUG_API("->XARadioAdapt_Destroy"); - - if(bCtx == NULL || bCtx->ctxId != XARadioAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XARadioAdapt_Destroy"); - return; - } - ctx = (XARadioAdaptationCtx*)bCtx; - XAAdaptationBase_Free(&(ctx->baseObj)); - - free(ctx); - - DEBUG_API("<-XARadioAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaradioadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xaradioadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARADIOADAPTCTX_H -#define XARADIOADAPTCTX_H - -#include "XAAdaptationContextBase.h" - -typedef enum { - GST_AUDIO_TEST_SRC_WAVE_SINE, - GST_AUDIO_TEST_SRC_WAVE_SQUARE, - GST_AUDIO_TEST_SRC_WAVE_SAW, - GST_AUDIO_TEST_SRC_WAVE_TRIANGLE, - GST_AUDIO_TEST_SRC_WAVE_SILENCE, - GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, - GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE, - GST_AUDIO_TEST_SRC_WAVE_SINE_TAB, - GST_AUDIO_TEST_SRC_WAVE_TICKS -} GstAudioTestSrcWave; - -#define RADIO_DEFAULT_FREQ_RANGE XA_FREQRANGE_FMEUROAMERICA -#define RADIO_DEFAULT_FREQ 88000000 - -/* TYPEDEFS */ -typedef struct XARadioAdaptationCtx_ XARadioAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XARadioAdapt_Create(); - -XAresult XARadioAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XARadioAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XARADIOADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaradioitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaradioitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,796 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAAdaptation.h" -#include "XARadioItfAdaptation.h" -#include "XARadioAdaptCtx.h" - -#define NUM_OF_SUPPORTED_RANGES 2 -#define NUM_OF_CHANNELS 2 -const char* RadioPresetDefaultName = "Default"; - -/* emulated frequency range data */ -typedef struct FreqRange_ -{ - XAuint8 id; - XAuint32 minFreq; - XAuint32 maxFreq; - XAuint32 freqInterval; - XAuint32 stereoMode; -} FreqRange; - -/* emulated radio channel data */ -typedef struct Channel_ -{ - XAuint32 freq; - XAuint32 strength; -} Channel; - -/* emulated radio state */ -typedef enum -{ - RADIO_STATE_ON_CHANNEL, - RADIO_STATE_OFF_CHANNEL -} RadioState; - -/* data structure to pass onto async functions */ -typedef struct -{ - XAAdaptationBaseCtx *bCtx; - XAuint32 value; -} ThreadArgs; - -/* emulation variables and constraints */ -static const FreqRange supportedFreqRanges[NUM_OF_SUPPORTED_RANGES] = { - { XA_FREQRANGE_FMEUROAMERICA, 87500000, 108000000, 100000, XA_STEREOMODE_MONO }, - {XA_FREQRANGE_FMJAPAN, 76000000, 90000000, 100000, XA_STEREOMODE_STEREO }}; - -static const Channel channels[NUM_OF_CHANNELS] = { {88500000, 80}, - {89300000, 60 }}; - -static XAuint8 freqRangeIndex = 0; -static XAboolean squelchMode = XA_BOOLEAN_FALSE; -static XAint32 currentChannel = -1; -static RadioState radioState = RADIO_STATE_OFF_CHANNEL; - -static void* asyncdata = NULL; - -/* FORWARD DECLARATIONS */ -void * XARadioItfAdapt_AsyncSetFrequencyRange(void* args); -XAresult XARadioItfAdapt_SyncSetFrequencyRange(XAAdaptationBaseCtx *bCtx, XAuint8 range); -void * XARadioItfAdapt_AsyncSetFrequency(void* args); -XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq); -void * XARadioItfAdapt_AsyncSeek(void* args); - -/* - * XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationBaseCtx *bCtx, XAuint8 range) - */ -XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationBaseCtx *bCtx, XAuint8 range) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 index=0; - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - int pt_ret=0; - DEBUG_API("->XARadioItfAdapt_SetFreqRange"); - - if(!bCtx || range < XA_FREQRANGE_FMEUROAMERICA || range > XA_FREQRANGE_AMSW) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - for (index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == range) - { - if (mCtx->range != range) - { - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - mCtx->state = XA_RADIO_IDLE; - } - { - ThreadArgs* args = calloc(1, sizeof(ThreadArgs)); - if (!args) - { - DEBUG_ERR("Calloc failed") - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return XA_RESULT_INTERNAL_ERROR; - } - args->bCtx = bCtx; - args->value = range; - mCtx->state = XA_RADIO_SETTING_FREQUENCY_RANGE; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARadioItfAdapt_AsyncSetFrequencyRange),(void*)args); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } - break; - } - } - - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSetFrequencyRange(void* args) - */ -void * XARadioItfAdapt_AsyncSetFrequencyRange(void* args) -{ - XAresult ret = XA_RESULT_SUCCESS; - ThreadArgs* tArgs = NULL; - XARadioAdaptationCtx* mCtx = NULL; - - DEBUG_API("->XARadioItfAdapt_AsyncSetFrequencyRange"); - asyncdata = args; - tArgs = args; - - mCtx = (XARadioAdaptationCtx*) tArgs->bCtx; - - DEBUG_INFO("Setting frequency async") - usleep(100000); /* 1/10 seconds */ - - ret = XARadioItfAdapt_SyncSetFrequencyRange(tArgs->bCtx, tArgs->value); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XARadioItfAdapt_SyncSetFrequencyRange FAILED"); - } - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED, 0, NULL}; - XAAdaptationBase_SendAdaptEvents(tArgs->bCtx, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - free(args); - asyncdata = NULL; - DEBUG_API("<-XARadioItfAdapt_AsyncSetFrequencyRange"); - pthread_exit(NULL); -} - -/* - * XAresult XARadioItfAdapt_SyncSetFrequencyRange(XAAdaptationBaseCtx *bCtx, XAuint8 range) - */ -XAresult XARadioItfAdapt_SyncSetFrequencyRange(XAAdaptationBaseCtx *bCtx, XAuint8 range) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - XAuint8 index=0; - DEBUG_API("->XARadioItfAdapt_SyncSetFrequencyRange"); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequencyRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (range != mCtx->range) - { - DEBUG_INFO("Frequency range changed!") - - mCtx->range = range; - for(index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == mCtx->range) - { - freqRangeIndex = index; - } - } - - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, RADIO_DEFAULT_FREQ ); - } - - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequencyRange"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetFreqRange(XAAdaptationBaseCtx *bCtx, - * XAuint8 * pFreqRange) - */ -XAresult XARadioItfAdapt_GetFreqRange(XAAdaptationBaseCtx *bCtx, - XAuint8 * pFreqRange) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_GetFreqRange"); - - if(!bCtx || !pFreqRange) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetFreqRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - *pFreqRange = mCtx->range; - - DEBUG_API("<-XARadioItfAdapt_GetFreqRange"); - return ret; -} - - - -/* - * XAresult XARadioItfAdapt_IsFreqRangeSupported(XAAdaptationBaseCtx *bCtx, - * XAuint8 range, - * XAboolean * pSupported) - */ -XAresult XARadioItfAdapt_IsFreqRangeSupported(XAAdaptationBaseCtx *bCtx, - XAuint8 range, - XAboolean * pSupported) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 index=0; - DEBUG_API("->XARadioItfAdapt_IsFreqRangeSupported"); - - if(!bCtx || !pSupported || range < XA_FREQRANGE_FMEUROAMERICA || range > XA_FREQRANGE_AMSW) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_IsFreqRangeSupported"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pSupported = XA_BOOLEAN_FALSE; - for (index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == range) - { - *pSupported = XA_BOOLEAN_TRUE; - break; - } - } - - DEBUG_API("<-XARadioItfAdapt_IsFreqRangeSupported"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationBaseCtx *bCtx, - * XAuint8 range, - * XAuint32 * pMinFreq, - * XAuint32 * pMaxFreq, - * XAuint32 * pFreqInterval) - */ -XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationBaseCtx *bCtx, - XAuint8 range, - XAuint32 * pMinFreq, - XAuint32 * pMaxFreq, - XAuint32 * pFreqInterval) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - XAuint16 index=0; - DEBUG_API("->XARadioItfAdapt_GetFreqRangeProperties"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetFreqRangeProperties"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - for (index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == range) - { - *pMinFreq = supportedFreqRanges[index].minFreq; - *pMaxFreq = supportedFreqRanges[index].maxFreq; - *pFreqInterval = supportedFreqRanges[index].freqInterval; - break; - } - } - - DEBUG_API("<-XARadioItfAdapt_GetFreqRangeProperties"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_SetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq) - */ -XAresult XARadioItfAdapt_SetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_SetFrequency"); - - if(!bCtx || freq < supportedFreqRanges[freqRangeIndex].minFreq - || freq > supportedFreqRanges[freqRangeIndex].maxFreq - || ((freq - supportedFreqRanges[freqRangeIndex].minFreq) - % supportedFreqRanges[freqRangeIndex].freqInterval) != 0) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (freq != mCtx->frequency) - { - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - } - - { - ThreadArgs* args = calloc(1, sizeof(ThreadArgs)); - if (!args) - { - DEBUG_ERR("Calloc failed") - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return XA_RESULT_INTERNAL_ERROR; - } - args->bCtx = bCtx; - args->value = freq; - mCtx->state = XA_RADIO_SETTING_FREQUENCY; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARadioItfAdapt_AsyncSetFrequency),(void*)args); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } /* else do nothing freq was same */ - - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSetFrequency(void* args) - */ -void * XARadioItfAdapt_AsyncSetFrequency(void* args) -{ - ThreadArgs* tArgs = NULL; - XARadioAdaptationCtx* mCtx = NULL; - asyncdata = args; - tArgs = args; - - mCtx = (XARadioAdaptationCtx*) tArgs->bCtx; - DEBUG_API("->XARadioItfAdapt_AsyncSetFrequency"); - DEBUG_INFO("Setting frequency async") - usleep(100000); /* 1/10 seconds */ - - XARadioItfAdapt_SyncSetFrequency(tArgs->bCtx, tArgs->value); - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_CHANGED, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(tArgs->bCtx, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - free(args); - asyncdata = NULL; - DEBUG_API("<-XARadioItfAdapt_AsyncSetFrequency"); - pthread_exit(NULL); -} - -/* - * XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq) - */ -XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - XAboolean channelFound = XA_BOOLEAN_FALSE; - XARadioAdaptationCtx* mCtx=NULL; - - DEBUG_API("->XARadioItfAdapt_SyncSetFrequency"); - - if(!bCtx || freq < supportedFreqRanges[freqRangeIndex].minFreq - || freq > supportedFreqRanges[freqRangeIndex].maxFreq - || ((freq - supportedFreqRanges[freqRangeIndex].minFreq) - % supportedFreqRanges[freqRangeIndex].freqInterval) != 0) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (freq != mCtx->frequency) - { - for (index = 0; index < NUM_OF_CHANNELS; index++) - { - if (channels[index].freq == freq) - { - currentChannel = index; - channelFound = XA_BOOLEAN_TRUE; - break; - } - } - if ( channelFound == XA_BOOLEAN_FALSE && radioState == RADIO_STATE_ON_CHANNEL) - { - if (squelchMode == XA_BOOLEAN_FALSE) - { - DEBUG_API("Channel not found, squelch mode off, set radio to white noise"); - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, NULL ); - } - else - { - DEBUG_API("Channel not found, squelch mode off, set radio to silence"); - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_SILENCE, NULL ); - } - radioState = RADIO_STATE_OFF_CHANNEL; - } - else if ( channelFound == XA_BOOLEAN_TRUE && radioState == RADIO_STATE_OFF_CHANNEL ) - { - DEBUG_API("Channel found, set radio to sine wave"); - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_SINE, NULL ); - radioState = RADIO_STATE_ON_CHANNEL; - } - else - { - /* do nothing */ - } - - DEBUG_INFO("Frequency changed!") - - mCtx->frequency = freq; - } /* else frequency not changed do nothing */ - - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequency"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetFrequency(XAAdaptationBaseCtx *bCtx, - * XAuint32 * pFrequency) - */ -XAresult XARadioItfAdapt_GetFrequency(XAAdaptationBaseCtx *bCtx, - XAuint32 * pFrequency) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_GetFrequency"); - - if(!bCtx || !pFrequency) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - *pFrequency = mCtx->frequency; - - DEBUG_API("<-XARadioItfAdapt_GetFrequency"); - return ret; -} - - -/* - * XAresult XARadioItfAdapt_CancelSetFrequency(XAAdaptationBaseCtx *bCtx) - */ -XAresult XARadioItfAdapt_CancelSetFrequency(XAAdaptationBaseCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_CancelSetFrequency"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_CancelSetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - - if (mCtx->state == XA_RADIO_SEEKING) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - DEBUG_API("<-XARadioItfAdapt_CancelSetFrequency"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_SetSquelch(XAAdaptationBaseCtx *bCtx, XAboolean squelch) - */ -XAresult XARadioItfAdapt_SetSquelch(XAAdaptationBaseCtx *bCtx, XAboolean squelch) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARadioItfAdapt_SetSquelch"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetSquelch"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (squelch != squelchMode) - { - if (radioState == RADIO_STATE_OFF_CHANNEL) - { - if (squelch == XA_BOOLEAN_FALSE) - { - DEBUG_API("Squelch untoggled, no channel, set radio to white noise") - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, NULL ); - } - else - { - DEBUG_API("Squelch toggled, no channel, set radio to silence") - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_SILENCE, NULL ); - } - } - else - { - DEBUG_API("Squelch toggled, radio on channel, radio not changed") - } - squelchMode = squelch; - } /* else do nothing as mode not changed */ - - DEBUG_API("<-XARadioItfAdapt_SetSquelch"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationBaseCtx *bCtx, XAuint32 mode) - */ -XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationBaseCtx *bCtx, XAuint32 mode) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARadioItfAdapt_SetStereoMode"); - - if(!bCtx || mode < XA_STEREOMODE_MONO || mode > XA_STEREOMODE_AUTO ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetStereoMode"); - return XA_RESULT_PARAMETER_INVALID; - } - - switch ( mode ) - { - case XA_STEREOMODE_MONO: - /* always works */ - break; - case XA_STEREOMODE_STEREO: - if ( supportedFreqRanges[freqRangeIndex].stereoMode == XA_STEREOMODE_MONO ) - { - DEBUG_ERR("StereoMode stereo unsupported"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - case XA_STEREOMODE_AUTO: - if ( supportedFreqRanges[freqRangeIndex].stereoMode != XA_STEREOMODE_AUTO ) - { - DEBUG_ERR("StereoMode auto unsupported"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - default : - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - ret = XA_RESULT_INTERNAL_ERROR; /* shouldn't come here */ - break; - } - - DEBUG_API("<-XARadioItfAdapt_SetStereoMode"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetSignalStrength(XAAdaptationBaseCtx *bCtx, XAuint32 * pStrength) - */ -XAresult XARadioItfAdapt_GetSignalStrength(XAAdaptationBaseCtx *bCtx, XAuint32 * pStrength) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARadioItfAdapt_GetSignalStrength"); - - if(!bCtx || !pStrength) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetSignalStrength"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (currentChannel != -1) - { - *pStrength = channels[currentChannel].strength; - } - else - { - *pStrength = 0; - } - - DEBUG_API("<-XARadioItfAdapt_GetSignalStrength"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_Seek(XAAdaptationBaseCtx *bCtx, XAboolean upwards) - */ -XAresult XARadioItfAdapt_Seek(XAAdaptationBaseCtx *bCtx, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx = NULL; - int pt_ret=0; - DEBUG_API("->XARadioItfAdapt_Seek"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_Seek"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - mCtx->state = XA_RADIO_IDLE; - } - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARadioItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - DEBUG_API("<-XARadioItfAdapt_Seek"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARadioItfAdapt_Seek"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSeek(void* args) - */ -void * XARadioItfAdapt_AsyncSeek(void* args) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XAAdaptationBaseCtx *bCtx = (XAAdaptationBaseCtx*)args; - - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - - XAuint8 index=0; - XAint8 currentChannel = 0; - XAuint32 freq=0; - mCtx->state = XA_RADIO_SEEKING; - usleep(100000); /* 1/10 seconds */ - - DEBUG_INFO("Seek done!") - - for( index = 0; index < NUM_OF_CHANNELS; index++) - { - if (channels[index].freq == mCtx->frequency) - { - currentChannel = index; - break; - } - } - - freq = channels[(currentChannel + 1)%NUM_OF_CHANNELS].freq; - - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, freq ); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XARadioItfAdapt_SyncSetFrequency failed") - } - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SEEK_COMPLETE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - pthread_exit(NULL); -} - -/* - * XAresult XARadioItfAdapt_StopSeeking(XAAdaptationBaseCtx *bCtx) - */ -XAresult XARadioItfAdapt_StopSeeking(XAAdaptationBaseCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARadioItfAdapt_StopSeeking"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_StopSeeking"); - return XA_RESULT_INTERNAL_ERROR; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state == XA_RADIO_SEEKING) - { - mCtx->state = XA_RADIO_IDLE; - // pthread_cancel(mCtx->emulationThread); - - /* just put some random non-channel freq */ - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, channels[0].freq+supportedFreqRanges[freqRangeIndex].freqInterval); - if (ret != XA_RESULT_SUCCESS) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - - DEBUG_API("<-XARadioItfAdapt_StopSeeking"); - return ret; -} - -/* - * void XARadioItfAdapt_Free(XAAdaptationBaseCtx *bCtx) - */ -void XARadioItfAdapt_Free(XAAdaptationBaseCtx *bCtx) -{ - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - DEBUG_API("->XARadioItfAdapt_Free"); - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - mCtx->state = XA_RADIO_IDLE; - } - - DEBUG_API("<-XARadioItfAdapt_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaradioitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaradioitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARADIOITFFADAPTATION_H -#define XARADIOITFFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* MACROS */ -#define RADIO_DEFAULT_STEREO_MODE XA_STEREOMODE_AUTO -#define RADIO_NUM_OF_PRESETS 10 - -extern const char* RadioPresetDefaultName; - -/* FUNCTIONS */ -XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationBaseCtx *bCtx, XAuint8 range); - -XAresult XARadioItfAdapt_GetFreqRange(XAAdaptationBaseCtx *bCtx, - XAuint8 * pFreqRange); - -XAresult XARadioItfAdapt_IsFreqRangeSupported(XAAdaptationBaseCtx *bCtx, - XAuint8 range, - XAboolean * pSupported); - -XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationBaseCtx *bCtx, - XAuint8 range, - XAuint32 * pMinFreq, - XAuint32 * pMaxFreq, - XAuint32 * pFreqInterval); - -XAresult XARadioItfAdapt_SetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq); - -XAresult XARadioItfAdapt_GetFrequency(XAAdaptationBaseCtx *bCtx, - XAuint32 * pFrequency); - -XAresult XARadioItfAdapt_CancelSetFrequency(XAAdaptationBaseCtx *bCtx); - -XAresult XARadioItfAdapt_SetSquelch(XAAdaptationBaseCtx *bCtx, XAboolean squelch); - -XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationBaseCtx *bCtx, XAuint32 mode); - -XAresult XARadioItfAdapt_GetSignalStrength(XAAdaptationBaseCtx *bCtx, XAuint32 * pStrength); - -XAresult XARadioItfAdapt_Seek(XAAdaptationBaseCtx *bCtx, XAboolean upwards); - -XAresult XARadioItfAdapt_StopSeeking(XAAdaptationBaseCtx *bCtx); - -void XARadioItfAdapt_Free(XAAdaptationBaseCtx *bCtx); - -#endif /* XARADIOITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xardsitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xardsitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,875 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include - -#include "XAAdaptation.h" -#include "XARadioAdaptCtx.h" -#include "XARDSItfAdaptation.h" -#include "XARadioItfAdaptation.h" - -/* emulated device data and constraints */ - -#define NUM_OF_CHANNELS 2 -#define MAX_PS_STRING_LENGHT 17 -#define MAX_RT_STRING_LENGHT 129 -#define MAX_ODA_GROUP_SUBSCRIPTIONS 100 -#define MAX_PTY_STRING_SHORT_LENGHT 17 -#define MAX_PTY_STRING_LONG_LENGHT 33 -#define NONE_STRING_LENGHT 4 - -/* emulated rds data structure */ -typedef struct -{ - XAuint32 frequency; - XAchar *progServiceName; - XAchar *radioText; - XAuint32 programmeType; - XAchar *ptyStringShort; - XAchar *ptyStringLong; - XAint16 programmeID; - XAboolean trafficAnnouncement; - XAboolean trafficProgramme; -} RDSData; - -#define TRAFFIC_PROGRAMME_CHANNEL 0 -#define TRAFFIC_ANNOUNCEMENT_CHANNEL 0 -#define POPMUSIC_CHANNEL 1 - -/* emulated rds data from channels */ -static const RDSData rdsData[NUM_OF_CHANNELS] = { - {88500000, (XAchar *)"Traffic", (XAchar *)"All your traffic needs", XA_RDSPROGRAMMETYPE_RDSPTY_NONE, - (XAchar *)"None", (XAchar *)"None", 0x0001, XA_BOOLEAN_TRUE, XA_BOOLEAN_TRUE }, - {89300000, (XAchar *)"Popular", (XAchar *)"For the populous", XA_RDSPROGRAMMETYPE_RDSPTY_POPMUSIC, - (XAchar *)"Pop music", (XAchar *)"Pop music for the masses", 0x0002, XA_BOOLEAN_FALSE, XA_BOOLEAN_FALSE } -}; - -static const XAchar* noneString = (XAchar *)"None"; - -static XAint16 subscribedODAGroups[MAX_ODA_GROUP_SUBSCRIPTIONS]; -static XAuint16 subscribedODAGroupCount = 0; - -static XAuint32 freqSetAfterSeek; - -const RDSData* GetCurrentRdsData( XAAdaptationBaseCtx *bCtx ); -void * XARDSItfAdapt_AsyncSeek(void* args); -void * XARDSItfAdapt_AsyncGetODAGroup(void* args); - -/* exposing radio itf adaptation internal function here */ -XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationBaseCtx *bCtx, XAuint32 freq); - - -/* - * XAresult XARDSItfAdapt_QueryRDSSignal(XAAdaptationBaseCtx *bCtx, XAboolean * isSignal) - */ -XAresult XARDSItfAdapt_QueryRDSSignal(XAAdaptationBaseCtx *bCtx, XAboolean * isSignal) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_QueryRDSSignal"); - - if(!bCtx || !isSignal) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_QueryRDSSignal"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (GetCurrentRdsData(bCtx)) - { - *isSignal = XA_BOOLEAN_TRUE; - } - else - { - *isSignal = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XARDSItfAdapt_QueryRDSSignal"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeServiceName(XAAdaptationBaseCtx *bCtx, XAchar * ps) - */ -XAresult XARDSItfAdapt_GetProgrammeServiceName(XAAdaptationBaseCtx *bCtx, XAchar * ps) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeServiceName"); - - - if(!bCtx || !ps) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeServiceName"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - strncpy( (char *)ps, (char *)data->progServiceName, MAX_PS_STRING_LENGHT ); - } - else - { - *ps = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeServiceName"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetRadioText(XAAdaptationBaseCtx *bCtx, XAchar * rt) - */ -XAresult XARDSItfAdapt_GetRadioText(XAAdaptationBaseCtx *bCtx, XAchar * rt) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetRadioText"); - - if(!bCtx || !rt) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetRadioText"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - strncpy( (char *)rt, (char *)data->radioText, MAX_RT_STRING_LENGHT ); - } - else - { - *rt = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetRadioText"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetRadioTextPlus(XAAdaptationBaseCtx *bCtx, - * XAuint8 contentType, - * XAchar * informationElement, - * XAchar * descriptor, - * XAuint8 * descriptorContentType) - */ -XAresult XARDSItfAdapt_GetRadioTextPlus(XAAdaptationBaseCtx *bCtx, - XAuint8 contentType, - XAchar * informationElement, - XAchar * descriptor, - XAuint8 * descriptorContentType) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_GetRadioTextPlus"); - - if(!bCtx || contentType < XA_RDSRTPLUS_ITEMTITLE || contentType > XA_RDSRTPLUS_GETDATA - || !informationElement || !descriptor || !descriptorContentType) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetRadioTextPlus"); - return XA_RESULT_PARAMETER_INVALID; - } - - *informationElement = 0; - *descriptorContentType = 0; - - DEBUG_API("<-XARDSItfAdapt_GetRadioTextPlus"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeType(XAAdaptationBaseCtx *bCtx, XAuint32 * pty) - */ -XAresult XARDSItfAdapt_GetProgrammeType(XAAdaptationBaseCtx *bCtx, XAuint32 * pty) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeType"); - - if(!bCtx || !pty) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeType"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *pty = data->programmeType; - } - else - { - *pty = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeType"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeTypeString(XAAdaptationBaseCtx *bCtx, - * XAboolean isLengthMax16, - * XAchar * pty) - * - */ -XAresult XARDSItfAdapt_GetProgrammeTypeString(XAAdaptationBaseCtx *bCtx, - XAboolean isLengthMax16, - XAchar * pty) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeTypeString"); - - if(!bCtx || !pty) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeTypeString"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - if (isLengthMax16) - { - DEBUG_API_A1("Programme type string %s", data->ptyStringLong); - strncpy( (char *)pty, (char *)data->ptyStringLong, MAX_PTY_STRING_LONG_LENGHT ); - } - else - { - DEBUG_API_A1("Programme type string %s", data->ptyStringShort); - strncpy( (char *)pty, (char *)data->ptyStringShort, MAX_PTY_STRING_SHORT_LENGHT ); - } - } - else - { - DEBUG_API_A1("Programme type string %s", noneString); - strncpy( (char *)pty, (char *)noneString, NONE_STRING_LENGHT ); - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeTypeString"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeIdentificationCode(XAAdaptationBaseCtx *bCtx, XAint16 * pi) - */ -XAresult XARDSItfAdapt_GetProgrammeIdentificationCode(XAAdaptationBaseCtx *bCtx, XAint16 * pi) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeIdentificationCode"); - - if(!bCtx || !pi) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeIdentificationCode"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *pi = data->programmeID; - } - else - { - *pi = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeIdentificationCode"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetClockTime(XAAdaptationBaseCtx *bCtx, XAtime * dateAndTime) - */ -XAresult XARDSItfAdapt_GetClockTime(XAAdaptationBaseCtx *bCtx, XAtime * dateAndTime) -{ - XAresult ret = XA_RESULT_SUCCESS; - time_t timeRet=0; - DEBUG_API("->XARDSItfAdapt_GetClockTime"); - - if(!bCtx || !dateAndTime) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetClockTime"); - return XA_RESULT_PARAMETER_INVALID; - } - - timeRet = time(NULL); - - if (timeRet == -1) /* could not get time for some reason */ - { - ret = XA_RESULT_INTERNAL_ERROR; - } - else - { - *dateAndTime = timeRet; - } - - DEBUG_API("<-XARDSItfAdapt_GetClockTime"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean * ta) - */ -XAresult XARDSItfAdapt_GetTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean * ta) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetTrafficAnnouncement"); - - if(!bCtx || !ta) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *ta = data->trafficAnnouncement; - } - else - { - *ta = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XARDSItfAdapt_GetTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetTrafficProgramme(XAAdaptationBaseCtx *bCtx, XAboolean * tp) - */ -XAresult XARDSItfAdapt_GetTrafficProgramme(XAAdaptationBaseCtx *bCtx, XAboolean * tp) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetTrafficProgramme"); - - if(!bCtx || !tp) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetTrafficProgramme"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *tp = data->trafficProgramme; - } - else - { - *tp = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XARDSItfAdapt_GetTrafficProgramme"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SeekByProgrammeType(XAAdaptationBaseCtx *bCtx, - * XAuint32 pty, - * XAboolean upwards) - */ -XAresult XARDSItfAdapt_SeekByProgrammeType(XAAdaptationBaseCtx *bCtx, - XAuint32 pty, - XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARDSItfAdapt_SeekByProgrammeType"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SeekByProgrammeType"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - if (pty == XA_RDSPROGRAMMETYPE_RDSPTY_POPMUSIC) - { - freqSetAfterSeek = rdsData[POPMUSIC_CHANNEL].frequency; - } - else - { - freqSetAfterSeek = mCtx->frequency; - } - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARDSItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_SeekByProgrammeType"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SeekByProgrammeType"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SeekTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean upwards) - */ -XAresult XARDSItfAdapt_SeekTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARDSItfAdapt_SeekTrafficAnnouncement"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - freqSetAfterSeek = rdsData[TRAFFIC_ANNOUNCEMENT_CHANNEL].frequency; - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARDSItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficAnnouncement"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SeekTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SeekTrafficProgramme(XAAdaptationBaseCtx *bCtx, XAboolean upwards) - */ -XAresult XARDSItfAdapt_SeekTrafficProgramme(XAAdaptationBaseCtx *bCtx, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARDSItfAdapt_SeekTrafficProgramme"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficProgramme"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - freqSetAfterSeek = rdsData[TRAFFIC_PROGRAMME_CHANNEL].frequency; - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARDSItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficProgramme"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SeekTrafficProgramme"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSeek(void* args) - */ -void * XARDSItfAdapt_AsyncSeek(void* args) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptationBaseCtx *bCtx = (XAAdaptationBaseCtx*)args; - - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - - DEBUG_API("->XARDSItfAdapt_AsyncSeek"); - - usleep(100000); /* 1/10 seconds */ - - DEBUG_INFO("Seek done!"); - - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, freqSetAfterSeek ); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XARadioItfAdapt_SyncSetFrequency FAILED"); - } - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SEEK_COMPLETE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - DEBUG_API("<-XARDSItfAdapt_AsyncSeek"); - pthread_exit(NULL); -} - -/* - * XAresult XARDSItfAdapt_SetAutomaticSwitching(XAAdaptationBaseCtx *bCtx, XAboolean automatic) - */ -XAresult XARDSItfAdapt_SetAutomaticSwitching(XAAdaptationBaseCtx *bCtx, XAboolean automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_SetAutomaticSwitching"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SetAutomaticSwitching"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XA_RESULT_FEATURE_UNSUPPORTED; - - DEBUG_API("<-XARDSItfAdapt_SetAutomaticSwitching"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetAutomaticSwitching(XAAdaptationBaseCtx *bCtx, XAboolean * automatic) - */ -XAresult XARDSItfAdapt_GetAutomaticSwitching(XAAdaptationBaseCtx *bCtx, XAboolean * automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_GetAutomaticSwitching"); - - if(!bCtx || !automatic) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetAutomaticSwitching"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Feature not supported */ - *automatic = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XARDSItfAdapt_GetAutomaticSwitching"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SetAutomaticTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean automatic) - */ -XAresult XARDSItfAdapt_SetAutomaticTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_SetAutomaticTrafficAnnouncement"); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SetAutomaticTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XA_RESULT_FEATURE_UNSUPPORTED; - - DEBUG_API("<-XARDSItfAdapt_SetAutomaticTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetAutomaticTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean * automatic) - */ -XAresult XARDSItfAdapt_GetAutomaticTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean * automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_GetAutomaticTrafficAnnouncement"); - - if(!bCtx || !automatic) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetAutomaticTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - *automatic = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XARDSItfAdapt_GetAutomaticTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetODAGroup(XAAdaptationBaseCtx *bCtx, - * XAint16 AID) - */ -XAresult XARDSItfAdapt_GetODAGroup(XAAdaptationBaseCtx *bCtx, XAint16 AID) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARDSItfAdapt_GetODAGroup"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->rdsState != XA_RADIO_RDS_IDLE) - { - // pthread_cancel(mCtx->rdsEmulationThread); - mCtx->rdsState = XA_RADIO_RDS_IDLE; - DEBUG_INFO("Previous getodagroup async call cancelled") - } - - pt_ret = pthread_create(&(mCtx->rdsEmulationThread), NULL, (XARDSItfAdapt_AsyncGetODAGroup),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_GetODAGroup"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_GetODAGroup"); - return ret; -} - -/* - * void * XARDSItfAdapt_AsyncGetODAGroup(void* args) - */ -void * XARDSItfAdapt_AsyncGetODAGroup(void* args) -{ - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*)args; - - DEBUG_API("->XARDSItfAdapt_AsyncGetODAGroup"); - mCtx->rdsState = XA_RADIO_RDS_GETTING_ODA_GROUP; - - DEBUG_INFO("Get oda group async wait") - usleep(100000); /* 1/10 seconds */ - - /* Send event */ - { - XAAdaptEvent event = {XA_RDSITFEVENTS, XA_ADAPT_RDS_GET_ODA_GROUP_DONE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(args, &event ); - } - mCtx->rdsState = XA_RADIO_RDS_IDLE; - DEBUG_API("<-XARDSItfAdapt_AsyncGetODAGroup"); - pthread_exit(NULL); -} - -/* - * XAresult XARDSItfAdapt_SubscribeODAGroup(XAAdaptationBaseCtx *bCtx, - * XAint16 group, - * XAboolean useErrorCorrection) - */ -XAresult XARDSItfAdapt_SubscribeODAGroup(XAAdaptationBaseCtx *bCtx, - XAint16 group, - XAboolean useErrorCorrection) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - XAboolean groupFound = XA_BOOLEAN_FALSE; - DEBUG_API("->XARDSItfAdapt_SubscribeODAGroup"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SubscribeODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Look for group in list, if not there add it */ - if (subscribedODAGroupCount < MAX_ODA_GROUP_SUBSCRIPTIONS) - { - for (index = 0; index < subscribedODAGroupCount; index++) - { - if (subscribedODAGroups[index] == group) - { - groupFound = XA_BOOLEAN_TRUE; - } - } - if (!groupFound) - { - subscribedODAGroups[subscribedODAGroupCount] = group; - subscribedODAGroupCount++; - } - } - else - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XARDSItfAdapt_SubscribeODAGroup"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SubscribeODAGroup"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_UnsubscribeODAGroup(XAAdaptationBaseCtx *bCtx, XAint16 group) - */ -XAresult XARDSItfAdapt_UnsubscribeODAGroup(XAAdaptationBaseCtx *bCtx, XAint16 group) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - DEBUG_API("->XARDSItfAdapt_UnsubscribeODAGroup"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_UnsubscribeODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Look for group in list, if found, remove it */ - for (index = 0; index < subscribedODAGroupCount; index++) - { - if (subscribedODAGroups[index] == group) - { - subscribedODAGroups[index] = subscribedODAGroups[subscribedODAGroupCount-1]; - subscribedODAGroupCount--; - } - } - - DEBUG_API("<-XARDSItfAdapt_UnsubscribeODAGroup"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_ListODAGroupSubscriptions(XAAdaptationBaseCtx *bCtx, - * XAint16* pGroups, - * XAuint32* pLength) - */ -XAresult XARDSItfAdapt_ListODAGroupSubscriptions(XAAdaptationBaseCtx *bCtx, - XAint16* pGroups, - XAuint32* pLength) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - DEBUG_API("->XARDSItfAdapt_ListODAGroupSubscriptions"); - - if(!bCtx || !pLength) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_ListODAGroupSubscriptions"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (!pGroups) - { - *pLength = subscribedODAGroupCount; - } - else - { - if (*pLength < subscribedODAGroupCount) - { - ret = XA_RESULT_BUFFER_INSUFFICIENT; - } - for (index = 0; index < *pLength; index++) - { - pGroups[index] = subscribedODAGroups[index]; - } - } - - DEBUG_API("<-XARDSItfAdapt_ListODAGroupSubscriptions"); - return ret; -} - -/* - * const RDSData* GetCurrentRdsData( XAAdaptationBaseCtx *bCtx ) - */ -const RDSData* GetCurrentRdsData( XAAdaptationBaseCtx *bCtx ) -{ - XAuint8 index=0; - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - - for (index = 0; index < NUM_OF_CHANNELS; index++ ) - { - if (rdsData[index].frequency == mCtx->frequency) - { - DEBUG_API("<-GetCurrentRdsData"); - return &(rdsData[index]); - } - } - DEBUG_API("<-GetCurrentRdsData"); - return NULL; -} - - -/* - * void XARDSItfAdapt_Free(XAAdaptationBaseCtx *bCtx) - */ -void XARDSItfAdapt_Free(XAAdaptationBaseCtx *bCtx) -{ - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - DEBUG_API("->XARDSItfAdapt_Free"); - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - if (mCtx->rdsState != XA_RADIO_RDS_IDLE) - { - // pthread_cancel(mCtx->rdsEmulationThread); - mCtx->rdsState = XA_RADIO_RDS_IDLE; - } - - DEBUG_API("<-XARDSItfAdapt_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xardsitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xardsitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARDSITFFADAPTATION_H -#define XARDSOITFFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* MACROS */ - -/* FUNCTIONS */ - -XAresult XARDSItfAdapt_QueryRDSSignal(XAAdaptationBaseCtx *bCtx, XAboolean * isSignal); - -XAresult XARDSItfAdapt_GetProgrammeServiceName(XAAdaptationBaseCtx *bCtx, XAchar * ps); - -XAresult XARDSItfAdapt_GetRadioText(XAAdaptationBaseCtx *bCtx, XAchar * rt); - -XAresult XARDSItfAdapt_GetRadioTextPlus(XAAdaptationBaseCtx *bCtx, - XAuint8 contentType, - XAchar * informationElement, - XAchar * descriptor, - XAuint8 * descriptorContentType); - -XAresult XARDSItfAdapt_GetProgrammeType(XAAdaptationBaseCtx *bCtx, XAuint32 * pty); - -XAresult XARDSItfAdapt_GetProgrammeTypeString(XAAdaptationBaseCtx *bCtx, - XAboolean isLengthMax16, - XAchar * pty); - -XAresult XARDSItfAdapt_GetProgrammeIdentificationCode(XAAdaptationBaseCtx *bCtx, XAint16 * pi); - -XAresult XARDSItfAdapt_GetClockTime(XAAdaptationBaseCtx *bCtx, XAtime * dateAndTime); - -XAresult XARDSItfAdapt_GetTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean * ta); - -XAresult XARDSItfAdapt_GetTrafficProgramme(XAAdaptationBaseCtx *bCtx, XAboolean * tp); - -XAresult XARDSItfAdapt_SeekByProgrammeType(XAAdaptationBaseCtx *bCtx, - XAuint32 pty, - XAboolean upwards); - -XAresult XARDSItfAdapt_SeekTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean upwards); - -XAresult XARDSItfAdapt_SeekTrafficProgramme(XAAdaptationBaseCtx *bCtx, XAboolean upwards); - -XAresult XARDSItfAdapt_SetAutomaticSwitching(XAAdaptationBaseCtx *bCtx, XAboolean automatic); - -XAresult XARDSItfAdapt_GetAutomaticSwitching(XAAdaptationBaseCtx *bCtx, XAboolean * automatic); - -XAresult XARDSItfAdapt_SetAutomaticTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean automatic); - -XAresult XARDSItfAdapt_GetAutomaticTrafficAnnouncement(XAAdaptationBaseCtx *bCtx, XAboolean * automatic); - -XAresult XARDSItfAdapt_GetODAGroup(XAAdaptationBaseCtx *bCtx, XAint16 AID); - -XAresult XARDSItfAdapt_SubscribeODAGroup(XAAdaptationBaseCtx *bCtx, - XAint16 group, - XAboolean useErrorCorrection); - -XAresult XARDSItfAdapt_UnsubscribeODAGroup(XAAdaptationBaseCtx *bCtx, XAint16 group); - -XAresult XARDSItfAdapt_ListODAGroupSubscriptions(XAAdaptationBaseCtx *bCtx, - XAint16* pGroups, - XAuint32* pLength); - -void XARDSItfAdapt_Free(XAAdaptationBaseCtx *bCtx); - -#endif /* XARDSITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xarecorditfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xarecorditfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,418 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAMediaRecorderAdaptCtx.h" -#include "XARecordItfAdaptation.h" -#include "XAAdaptation.h" - -/*forward declaration of position updater callback*/ -gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx); - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/* - * XAresult XARecordItfAdapt_SetRecordState(XAAdaptationBaseCtx *ctx, XAuint32 state) - * Sets record state to GStreamer. - * @param XAAdaptationBaseCtx *ctx - Adaptation context - * XAuint32 state - Record state to be set - * @return XAresult ret - Success value - */ -XAresult XARecordItfAdapt_SetRecordState(XAAdaptationBaseCtx *bCtx, XAuint32 state) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAboolean closeSink = XA_BOOLEAN_FALSE; - XAboolean requestStateChange = XA_BOOLEAN_FALSE; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAboolean recording = XA_BOOLEAN_FALSE; - DEBUG_API_A1("->XARecordItfAdapt_SetRecordState %s",RECORDSTATENAME(state)); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdapt_SetRecordState"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - mCtx->isRecord = XA_BOOLEAN_TRUE; - - switch ( state ) - { - case XA_RECORDSTATE_STOPPED: - { - if ( cameraCtx && cameraRealized && mCtx->isobjvsrc && mCtx->videosource ) - { - cameraCtx->recording = XA_BOOLEAN_FALSE; - - if(!cameraCtx->playing && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->videosource)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->videosource), GST_STATE_PAUSED ); - gret = gst_element_get_state( GST_ELEMENT(mCtx->videosource), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - - if ( bCtx->pipeSinkThrCtx.state != CPStateNull ) - { - bCtx->pipeSinkThrCtx.state = CPStateStopped; - } - bCtx->binWantedState = GST_STATE_PAUSED; - closeSink = XA_BOOLEAN_TRUE; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - - if ( mCtx->recThrCtx.bufInsufficientSem ) - { - DEBUG_INFO("No buffer-insufficient received, posting record thr semaphore."); - if ( XAImpl_PostSemaphore( mCtx->recThrCtx.bufInsufficientSem ) != XA_RESULT_SUCCESS) - { - DEBUG_ERR("Posting buffer-insufficient semaphore FAILED!"); - } - } - - break; - } - case XA_RECORDSTATE_PAUSED: - { - if ( cameraCtx && cameraRealized && mCtx->isobjvsrc && mCtx->videosource ) - { - cameraCtx->recording = XA_BOOLEAN_FALSE; - if(!cameraCtx->playing && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->videosource)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->videosource), GST_STATE_PAUSED ); - gret = gst_element_get_state( GST_ELEMENT(mCtx->videosource), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - - if ( bCtx->pipeSinkThrCtx.state != CPStateNull ) - { - bCtx->pipeSinkThrCtx.state = CPStatePaused; - } - if(mCtx->xaRecordState==XA_RECORDSTATE_STOPPED && mCtx->encodingchanged) - { - XAMediaRecorderAdapt_ChangeEncoders( mCtx ); - mCtx->encodingchanged = XA_BOOLEAN_FALSE; - } - bCtx->binWantedState = GST_STATE_PAUSED; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - break; - } - case XA_RECORDSTATE_RECORDING: - { - if ( cameraCtx && mCtx->isobjvsrc ) - { - cameraCtx->recording = XA_BOOLEAN_TRUE; - } - - if( bCtx->pipeSinkThrCtx.pipe ) - { - if ( bCtx->pipeSinkThrCtx.state != CPStateNull ) - { - XAresult retVal = XA_RESULT_SUCCESS; - - if ( bCtx->pipeSinkThrCtx.state == CPStateInitialized ) - { /* Start thread if it's not running */ - retVal = XAImpl_StartThread( &(bCtx->pipeSinkThr), NULL, &XAAdaptationBase_ContentPipeSinkThrFunc, &(bCtx->pipeSinkThrCtx) ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not start content pipe thread!"); - } - } - if ( bCtx->pipeSinkThrCtx.state == CPStatePaused || - bCtx->pipeSinkThrCtx.state == CPStateInitialized || - bCtx->pipeSinkThrCtx.state == CPStateStarted ) - retVal = XAImpl_PostSemaphore( bCtx->pipeSinkThrCtx.stateSem ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not post content pipe semaphore!"); - } - } - } - if(mCtx->xaRecordState==XA_RECORDSTATE_STOPPED && (mCtx->encodingchanged)) - { - XAMediaRecorderAdapt_ChangeEncoders( mCtx ); - mCtx->encodingchanged = XA_BOOLEAN_FALSE; - } - /*Causes segmentation fault during contentpipe, so we must ignore - contentpipe at this point*/ - if( ! bCtx->pipeSinkThrCtx.pipe ) - { - XAMetadataAdapt_TryWriteTags(bCtx, GST_BIN(mCtx->codecbin)); - } - if ( mCtx->recThrCtx.bufInsufficientSem ) - { - /* Recording to address and recording thread semaphora is created */ - XAImpl_StartThread(&(mCtx->recordingEventThr),NULL, &XAMediaRecorderAdapt_RecordEventThr, (void*)mCtx ); - } - - bCtx->binWantedState = GST_STATE_PLAYING; - recording = XA_BOOLEAN_TRUE; - break; - } - default: - DEBUG_ERR("Unhandled state"); - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - - if( ret == XA_RESULT_SUCCESS ) - { - mCtx->xaRecordState = state; - } - - /* launch Gstreamer state change only if necessary */ - if( GST_STATE_TARGET(bCtx->bin) == bCtx->binWantedState ) - { - DEBUG_INFO("Gst already transitioning to wanted state!!"); - requestStateChange = XA_BOOLEAN_FALSE; - } - else - { - if( (GST_STATE(bCtx->bin) == bCtx->binWantedState) && - (GST_STATE_PENDING(bCtx->bin) == GST_STATE_VOID_PENDING) ) - { - DEBUG_ERR_A3("WARNING : gststate %d == wanted %d != gsttarget %d and no statechange pending", - GST_STATE(bCtx->bin), bCtx->binWantedState, GST_STATE_TARGET(bCtx->bin)); - } - requestStateChange = XA_BOOLEAN_TRUE; - } - - if( requestStateChange ) - { - XAAdaptationBase_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Sending change state request to state %d", bCtx->binWantedState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %d)",bCtx->binWantedState); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %d)",bCtx->binWantedState); - XAAdaptationBase_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_NO_PREROLL: - DEBUG_INFO("GST_STATE_CHANGE_NO_PREROLL"); - /* deliberate fall-through */ - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %d)",bCtx->binWantedState); - ret = XA_RESULT_SUCCESS; - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - ret = XA_RESULT_UNKNOWN_ERROR; - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - if( (GST_STATE(bCtx->bin) > GST_STATE_READY) && closeSink ) - { /* close the sink*/ - gst_element_send_event(bCtx->bin,gst_event_new_flush_start()); - gst_element_send_event(bCtx->bin,gst_event_new_flush_stop()); - } - - if ( recording && mCtx->isobjvsrc && mCtx->videosource ) - { - GstPad *pad = gst_element_get_static_pad( GST_ELEMENT(mCtx->videosource), "MRObjSrc"); - if( pad && gst_pad_is_linked(pad) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name(mCtx->videosource), - gst_pad_get_name(pad)); - gst_pad_set_blocked_async(pad, FALSE, XAAdaptationBase_PadBlockCb, NULL); - } - - if ( GST_STATE( GST_ELEMENT(mCtx->videosource)) != GST_STATE_PLAYING ) - { - GstStateChangeReturn gret = GST_STATE_CHANGE_SUCCESS; - DEBUG_INFO("Start camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->videosource), GST_STATE_PLAYING ); - gret = gst_element_get_state( GST_ELEMENT(mCtx->videosource), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - DEBUG_API("<-XARecordItfAdapt_SetRecordState"); - return ret; -} - -/* - * XAresult XARecordItfAdapt_GetRecordState(XAAdaptationBaseCtx *bCtx, XAuint32 *state) - * Description: Return record state - */ -XAresult XARecordItfAdapt_GetRecordState(XAAdaptationBaseCtx *bCtx, XAuint32 *state) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARecordItfAdapt_GetRecordState"); - - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdapt_GetRecordState"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - *state = mCtx->xaRecordState; - - DEBUG_API("<-XARecordItfAdapt_GetRecordState"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XARecordItfAdapt_GetPosition(XAAdaptationBaseCtx *ctx, AdaptationContextIDS ctxIDs, XAmillisecond *pMsec) - * @param XAAdaptationBaseCtx *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter - * XAmillisecond *pMsec - Pointer where to store current position in stream. - * @return XAresult ret - Success value - */ -XAresult XARecordItfAdapt_GetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond *pMsec) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaRecorderAdaptationCtx* mCtx = NULL; - gint64 position=0; - GstFormat format = GST_FORMAT_TIME; - DEBUG_API("->XARecordItfAdapt_GetPosition"); - - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdapt_GetPosition"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - if ( gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - ret = XA_RESULT_SUCCESS; - *pMsec = GST_TIME_AS_MSECONDS(position); /*Warning ok due to used API specification*/ - DEBUG_INFO_A1("Gst: Position in microseconds : %u", *pMsec ); - } - else - { - DEBUG_ERR("WARNING: Gst: could not get position"); - /* probably not fully prerolled - safe assumption for position = 0 */ - *pMsec = 0; - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XARecordItfAdapt_GetPosition"); - return ret; -} - - -/* - * gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx) - * callback. - * If position tracking enabled, periodic timer calls this method every XA_ADAPT_PU_INTERVAL msecs - * @return false to stop periodic calls - */ -gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx) -{ - XAAdaptationBaseCtx *bCtx = (XAAdaptationBaseCtx*) ctx; - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) ctx; - DEBUG_API("->XARecordItfAdapt_PositionUpdate"); - - if( mCtx && mCtx->trackpositionenabled ) - { - GstFormat format = GST_FORMAT_TIME; - gint64 position = 0; - if ( gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - XAuint32 posMsec = GST_TIME_AS_MSECONDS(position);/*Warning ok due to used API specification*/ - XAAdaptEvent event = {XA_RECORDITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - event.data = &posMsec; - DEBUG_API_A1("XARecordItfAdapt_PositionUpdate: pos %lu ms", posMsec); - /* send needed events */ - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - else - { - DEBUG_ERR("Gst: Failed to get position"); - } - } - DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); - /* return false to stop timer */ - return( mCtx->runpositiontimer ); -} - -/* - * XAresult XARecordItfAdapt_EnablePositionTracking - * Enable/disable periodic position tracking callbacks - */ -XAresult XARecordItfAdapt_EnablePositionTracking(XAAdaptationBaseCtx *bCtx, XAboolean enable) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - DEBUG_API_A1("->XARecordItfAdapt_EnablePositionTracking (enable: %lu)", enable); - - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - - /* create a timer to track position of playback */ - if(enable && !(mCtx->trackpositionenabled)) - { - mCtx->trackpositionenabled = XA_BOOLEAN_TRUE; - mCtx->positionCb = &XARecordItfAdapt_PositionUpdate; - /* if recording is already on, create a timer to track position of recording */ - if( GST_STATE(bCtx->bin) == GST_STATE_PLAYING ) - { - mCtx->runpositiontimer = g_timeout_add(XA_ADAPT_PU_INTERVAL, mCtx->positionCb, mCtx); - } - } - else if (!enable && (mCtx->trackpositionenabled)) - { - mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - } - - DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); - return XA_RESULT_SUCCESS; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xarecorditfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xarecorditfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARECORDITFADAPTATION_H -#define XARECORDITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -#ifdef _DEBUG -/*parse state names for debug prints*/ -static const char* recordstatenames[3] = -{ - "XA_RECORDSTATE_STOPPED", - "XA_RECORDSTATE_PAUSED", - "XA_RECORDSTATE_RECORDING", -}; -#define RECORDSTATENAME(i) ((i>0&&i<4)?recordstatenames[i-1]:"INVALID") -#endif /*_DEBUG*/ - -/* FUNCTIONS */ - -XAresult XARecordItfAdapt_SetRecordState(XAAdaptationBaseCtx *ctx, XAuint32 state ); -XAresult XARecordItfAdapt_SetDurationLimit( XAAdaptationBaseCtx *ctx, XAmillisecond msec ); -XAresult XARecordItfAdapt_GetPosition( XAAdaptationBaseCtx *ctx, XAmillisecond *pMsec ); -XAresult XARecordItfAdapt_EnablePositionTracking(XAAdaptationBaseCtx *ctx, XAboolean enable); -XAresult XARecordItfAdapt_GetRecordState(XAAdaptationBaseCtx *bCtx, XAuint32 *state); - -#endif /* XARECORDITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaseekitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xaseekitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XASeekItfAdaptation.h" - -/* - * XAresult XASeekItfAdapt_SetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond pos, XAuint32 seekMode) - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * XAmillisecond pos - Position to be set in Milliseconds - * XAuint32 seekMode - Preferred seek mode - * @return XAresult ret - Success value - */ -XAresult XASeekItfAdapt_SetPosition(XAAdaptationBaseCtx *bCtx, XAmillisecond pos, XAuint32 seekMode) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - gint64 gstSeekPos = pos * GST_MSECOND; - XAmillisecond newPosMs=0; - GstFormat format = GST_FORMAT_TIME; - GstSeekFlags seekFlags = GST_SEEK_FLAG_FLUSH; - DEBUG_API_A2("->XASeekItfAdapt_SetPosition (pos %ld ms, mode=%d)", pos, (int)seekMode); - if(!bCtx || bCtx->ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfAdapt_SetPosition"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( GST_STATE(bCtx->bin) < GST_STATE_PAUSED ) - { /* This should not happen */ - DEBUG_ERR("Gst not prerolled - can not seek!!"); - DEBUG_API("<-XASeekItfAdapt_SetPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - if ( seekMode == XA_SEEKMODE_FAST ) - { - seekFlags |= GST_SEEK_FLAG_KEY_UNIT; - } - else - { - seekFlags |= GST_SEEK_FLAG_ACCURATE; - } - - XAAdaptationBase_PrepareAsyncWait(bCtx); - DEBUG_INFO("Send gst_element_seek"); - mCtx->lastpos = gstSeekPos; - if ( !gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, seekFlags, - GST_SEEK_TYPE_SET, gstSeekPos, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE ) ) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationBase_StartAsyncWait(bCtx); - DEBUG_INFO("Seek handled.") - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - /* update new position to playitf */ - { - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - if ( !gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &mCtx->lastpos ) ) - { - DEBUG_ERR("WARNING: could not get position from GST") - } - DEBUG_INFO_A1("Current position %"GST_TIME_FORMAT, GST_TIME_ARGS(mCtx->lastpos)); - newPosMs = GST_TIME_AS_MSECONDS(mCtx->lastpos); - event.data = &newPosMs; - XAAdaptationBase_SendAdaptEvents(bCtx, &event ); - } - - ret = XA_RESULT_SUCCESS; - - DEBUG_API("<-XASeekItfAdapt_SetPosition"); - return ret; -} - -/* - * XAresult XASeekItfAdapt_SetLoop(void *bCtx, AdaptationContextIDS ctxIDs, XAboolean loopEnable, XAmillisecond startPos, - * XAmillisecond endPos) - * @param XAAdaptationBaseCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * XAboolean loopEnable - Enable/Disable looping - * XAmillisecond startPos - Loop start position in milliseconds - * XAmillisecond endPos - Loop end position in milliseconds - * @return XAresult ret - Success value - */ -XAresult XASeekItfAdapt_SetLoop(XAAdaptationBaseCtx *bCtx, XAboolean loopEnable, XAmillisecond startPos, - XAmillisecond endPos) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - GstFormat format = GST_FORMAT_TIME; - - DEBUG_API_A3("->XASeekItfAdapt_SetLoop (enable=%d, start=%ld, stop=%ld)", (int)loopEnable, startPos, endPos); - if(!bCtx || bCtx->ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfAdapt_SetLoop"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( loopEnable ) - { - if(endPos==XA_TIME_UNKNOWN) - { - mCtx->loopend = GST_CLOCK_TIME_NONE; - } - else - { - mCtx->loopend = (endPos*GST_MSECOND); - DEBUG_INFO_A1("Set looping to %ld", mCtx->loopend); - } - DEBUG_INFO_A2("Enable looping from %"GST_TIME_FORMAT" to %"GST_TIME_FORMAT, - GST_TIME_ARGS(mCtx->loopstart), GST_TIME_ARGS(mCtx->loopend)); - mCtx->loopstart = (startPos*GST_MSECOND); - if ( !gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &(mCtx->lastpos) ) ) - { - DEBUG_ERR("WARNING: could not get position from GST") - } - DEBUG_INFO_A1("current head position %"GST_TIME_FORMAT"",GST_TIME_ARGS(mCtx->lastpos)); - mCtx->loopingenabled = XA_BOOLEAN_TRUE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - else - { - DEBUG_INFO("Disable looping"); - mCtx->loopstart = 0; - mCtx->loopend = GST_CLOCK_TIME_NONE; - mCtx->loopingenabled = XA_BOOLEAN_FALSE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - - DEBUG_API("<-XASeekItfAdapt_SetLoop"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xaseekitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xaseekitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XASEEKITFADAPTATION_H -#define XASEEKITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* FUNCTIONS */ - -XAresult XASeekItfAdapt_SetPosition(XAAdaptationBaseCtx *ctx, XAmillisecond pos, - XAuint32 seekMode); - -XAresult XASeekItfAdapt_SetLoop(XAAdaptationBaseCtx *ctx, XAboolean loopEnable, - XAmillisecond startPos, XAmillisecond endPos); -#endif /* XASEEKITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xasnapshotitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xasnapshotitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,890 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "XAAdaptation.h" -#include "XASnapShotItfAdaptation.h" -#include "XAMediaRecorderAdaptCtx.h" -#include "XAMetadataAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -#define SSMAXPIC 30 -#define SSMAXFPS 30 /*technically, same as FPS of video stream*/ -#define SSMINFPS 1 - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/* Forward declarations for internal methods */ -XAresult XASnapshotItfAdaptation_CreateSnapshotPipeline(XAAdaptationBaseCtx* bCtx); -XAresult XASnapshotItfAdaptation_FreeSnapshot(); -const char* XASnapshotItfAdaptation_GetFileSuffix(XADataFormat_MIME* format); -void XASnapshotItfAdaptation_AllocNextFilename(char** fname, const char* template); -void XASnapshotItfAdaptation_StopSnapshotting(XAAdaptationBaseCtx* bCtx); - -/* callbacks */ -gboolean XASnapshotItfAdaptation_SnapshotBusCb( GstBus *bus, GstMessage *message, gpointer data ); -void XASnapshotItfAdaptation_BufferHandoffCb( GstElement *extract, GstBuffer *buffer, gpointer data); - -/********************************* - * SnapshotItf adaptation methods - *********************************/ - -/* - * XAresult XASnapshotItfAdaptation_InitiateSnapshot(XAAdaptationBaseCtx* bCtx, - * XAuint32 numberOfPictures, - * XAuint32 fps, - * XAboolean freezeViewFinder, - * XADataSink* sink) - */ -XAresult XASnapshotItfAdaptation_InitiateSnapshot(XAAdaptationBaseCtx* bCtx, - XAuint32 numberOfPictures, - XAuint32 fps, - XAboolean freezeViewFinder, - XADataSink* sink) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - XADataLocator_URI* uri=NULL; - - DEBUG_API("->XASnapshotItfAdaptation_InitiateSnapshot"); - /* Store initialization variables */ - mCtx->snapshotVars.numpics = numberOfPictures; - mCtx->snapshotVars.fps = fps; - mCtx->snapshotVars.freeze =freezeViewFinder; - mCtx->snapshotVars.parsenegotiated = FALSE; - mCtx->snapshotVars.snapshotbuffer = NULL; - - if( sink ) - { /* parse file sink name*/ - if( sink->pLocator && *((XAuint32*)(sink->pLocator)) == XA_DATALOCATOR_URI ) - { - uri = (XADataLocator_URI*)sink->pLocator; - if ( uri->URI != NULL ) - { - /* parse filename template: */ - mCtx->snapshotVars.fnametemplate = calloc(1,strlen((char*)uri->URI)+10); - DEBUG_INFO_A1("URI: %s", uri->URI); - if(strncmp((char*)uri->URI, "file://", 7) == 0) - { - strcat(mCtx->snapshotVars.fnametemplate, (char*)&((uri->URI)[7])); - } - else - { - strcat(mCtx->snapshotVars.fnametemplate, (char*)uri->URI); - } - strcat(mCtx->snapshotVars.fnametemplate, "%04d."); - strcat(mCtx->snapshotVars.fnametemplate, - XASnapshotItfAdaptation_GetFileSuffix(sink->pFormat)); - DEBUG_INFO_A1("->template name %s", mCtx->snapshotVars.fnametemplate); - } - else - { - DEBUG_ERR("No uri specified."); - return XA_RESULT_PARAMETER_INVALID; - } - } - else - { /* take snapshot to memory buffer */ - if( mCtx->snapshotVars.fnametemplate ) - { - free( mCtx->snapshotVars.fnametemplate ); - } - mCtx->snapshotVars.fnametemplate = NULL; - } - if( sink->pFormat && *((XAuint32*)(sink->pFormat)) == XA_DATAFORMAT_RAWIMAGE ) - { - XADataFormat_RawImage* img = ((XADataFormat_RawImage*)sink->pFormat); - /*set needed image settings from the sink structure*/ - mCtx->imageEncSettings.encoderId = XA_IMAGECODEC_RAW; - mCtx->imageEncSettings.width = img->width; - mCtx->imageEncSettings.height = img->height; - mCtx->imageEncSettings.colorFormat = img->colorFormat; - } - } - else - { - DEBUG_ERR("XASnapshotItfAdaptation_InitiateSnapshot, invalid data sink!"); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_InitiateSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - - - if( mCtx->snapshotVars.sspipeline ) - { - XASnapshotItfAdaptation_FreeSnapshot(bCtx); - } - if( XASnapshotItfAdaptation_CreateSnapshotPipeline(bCtx) != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to create pipeline!!"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XASnapshotItfAdaptation_InitiateSnapshot"); - return XA_RESULT_INTERNAL_ERROR; - } - DEBUG_API("<-XASnapshotItfAdaptation_InitiateSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_TakeSnapshot(XAAdaptationBaseCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_TakeSnapshot(XAAdaptationBaseCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - - DEBUG_API("->XASnapshotItfAdaptation_TakeSnapshot"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_TakeSnapshot"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - /*to get buffer, base pipeline must be playing...*/ - if( GST_STATE(mCtx->baseObj.bin) != GST_STATE_PLAYING ) - { - DEBUG_INFO_A1("Parent bin in state %d, set to PLAYING", GST_STATE(mCtx->baseObj.bin)); - gst_element_set_state( GST_ELEMENT(mCtx->baseObj.bin), GST_STATE_PLAYING ); - gst_element_get_state( GST_ELEMENT(mCtx->baseObj.bin), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - if ( mCtx->isobjvsrc && mCtx->videosource && cameraCtx && cameraRealized ) - { - GstPad *pad=NULL; - GstPad *pad1=NULL; - - cameraCtx->snapshotting = XA_BOOLEAN_TRUE; - pad = gst_element_get_static_pad( GST_ELEMENT(cameraCtx->baseObj.bin), "MRObjSrc"); - if( pad && gst_pad_is_linked(pad) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name(cameraCtx->baseObj.bin), - gst_pad_get_name(pad)); - gst_pad_set_blocked_async(pad, FALSE, XAAdaptationBase_PadBlockCb, NULL); - } - - pad1 = gst_element_get_static_pad( GST_ELEMENT(cameraCtx->baseObj.bin), "MPObjSrc"); - if( pad1 && gst_pad_is_linked(pad1) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name(cameraCtx->baseObj.bin), - gst_pad_get_name(pad1)); - gst_pad_set_blocked_async(pad, FALSE, XAAdaptationBase_PadBlockCb, NULL); - } - - DEBUG_INFO_A1("Using camera from global pointer %x", cameraCtx); - if ( GST_STATE( GST_ELEMENT(cameraCtx->baseObj.bin)) != GST_STATE_PLAYING ) - { - cameraCtx->baseObj.binWantedState = GST_STATE(cameraCtx->baseObj.bin); - DEBUG_INFO_A1("Camerabin state %d, set to PLAYING", GST_STATE(GST_ELEMENT(cameraCtx->baseObj.bin))); - gst_element_set_state( GST_ELEMENT(cameraCtx->baseObj.bin), GST_STATE_PLAYING ); - gst_element_get_state( GST_ELEMENT(cameraCtx->baseObj.bin), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - } - - /* Connect signal for getting current buffer from video pipeline*/ - mCtx->snapshotVars.numpicstaken = 0; - mCtx->snapshotVars.waitforbuffer = TRUE; - if(mCtx->videoextract) - { - mCtx->snapshotVars.sighandler = g_signal_connect(mCtx->videoextract, "handoff", - G_CALLBACK (XASnapshotItfAdaptation_BufferHandoffCb),mCtx); - } - if( mCtx->snapshotVars.sighandler==0 ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XASnapshotItfAdaptation_TakeSnapshot"); - return XA_RESULT_INTERNAL_ERROR; - } - DEBUG_API("<-XASnapshotItfAdaptation_TakeSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_CancelSnapshot(XAAdaptationBaseCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_CancelSnapshot(XAAdaptationBaseCtx* bCtx) -{ - DEBUG_API("->XASnapshotItfAdaptation_CancelSnapshot"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_CancelSnapshot"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - XASnapshotItfAdaptation_FreeSnapshot(bCtx); - - DEBUG_API("<-XASnapshotItfAdaptation_CancelSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_GetMaxPicsPerBurst(XAAdaptationBaseCtx* bCtx, - * XAuint32 *maxNumberOfPictures) - */ -XAresult XASnapshotItfAdaptation_GetMaxPicsPerBurst(XAAdaptationBaseCtx* bCtx, - XAuint32 *maxNumberOfPictures) -{ - DEBUG_API("->XASnapshotItfAdaptation_GetMaxPicsPerBurst"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_GetMaxPicsPerBurst"); - return XA_RESULT_PARAMETER_INVALID; - } - *maxNumberOfPictures = SSMAXPIC; - DEBUG_API("<-XASnapshotItfAdaptation_GetMaxPicsPerBurst"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_GetBurstFPSRange(XAAdaptationBaseCtx* bCtx, - * XAuint32 *minFPS, - * XAuint32 *maxFPS) - */ -XAresult XASnapshotItfAdaptation_GetBurstFPSRange(XAAdaptationBaseCtx* bCtx, - XAuint32 *minFPS, - XAuint32 *maxFPS) -{ - DEBUG_API("->XASnapshotItfAdaptation_GetBurstFPSRange"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_GetBurstFPSRange"); - return XA_RESULT_PARAMETER_INVALID; - } - *minFPS = SSMINFPS; - *maxFPS = SSMAXFPS; - - DEBUG_API("<-XASnapshotItfAdaptation_GetBurstFPSRange"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_SetShutterFeedback(XAAdaptationBaseCtx* bCtx, - * XAboolean enabled) - */ -XAresult XASnapshotItfAdaptation_SetShutterFeedback(XAAdaptationBaseCtx* bCtx, - XAboolean enabled) -{ - DEBUG_API("->XASnapshotItfAdaptation_SetShutterFeedback"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_SetShutterFeedback"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - /* stubbed, no implementation */ - DEBUG_API("<-XASnapshotItfAdaptation_SetShutterFeedback"); - return XA_RESULT_SUCCESS; -} - -/******************** - * Internal methods - ********************/ - -/* - * void XASnapshotItfAdaptation_StopSnapshotting(XAAdaptationBaseCtx* bCtx) - */ -void XASnapshotItfAdaptation_StopSnapshotting(XAAdaptationBaseCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - DEBUG_API("->XASnapshotItfAdaptation_StopSnapshotting"); - mCtx->snapshotVars.waitforbuffer = FALSE; - mCtx->snapshotVars.snapshotbuffer = NULL; - if(mCtx->snapshotVars.sighandler) - { - if(mCtx->videoextract) - { - g_signal_handler_disconnect(mCtx->videoextract,mCtx->snapshotVars.sighandler); - } - mCtx->snapshotVars.sighandler = 0; - } - /* did we change the state of parent pipeline?*/ - if( mCtx->baseObj.bin && (GST_STATE(mCtx->baseObj.bin) != mCtx->baseObj.binWantedState) ) - { - gst_element_set_state( GST_ELEMENT(mCtx->baseObj.bin), mCtx->baseObj.binWantedState ); - } - - if ( cameraCtx && (GST_STATE(cameraCtx->baseObj.bin) != cameraCtx->baseObj.binWantedState) ) - { - cameraCtx->snapshotting = XA_BOOLEAN_FALSE; - DEBUG_INFO_A2("Camerabin state %d, restored to %d", GST_STATE(cameraCtx->baseObj.bin), cameraCtx->baseObj.binWantedState ); - gst_element_set_state( GST_ELEMENT(cameraCtx->baseObj.bin), cameraCtx->baseObj.binWantedState ); - gst_element_get_state( GST_ELEMENT(cameraCtx->baseObj.bin), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - DEBUG_API("<-XASnapshotItfAdaptation_StopSnapshotting"); -} - -/* - * XAresult XASnapshotItfAdaptation_FreeSnapshot(XAAdaptationBaseCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_FreeSnapshot(XAAdaptationBaseCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - DEBUG_API("->XASnapshotItfAdaptation_FreeSnapshot"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_FreeSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - XASnapshotItfAdaptation_StopSnapshotting(bCtx); - /* Clean up pipeline and set current pipeline state to null*/ - if( mCtx->snapshotVars.sspipeline ) - { - gst_element_set_state( GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_NULL ); - gst_object_unref( GST_OBJECT(mCtx->snapshotVars.sspipeline) ); - mCtx->snapshotVars.sspipeline = NULL; - } - if( mCtx->snapshotVars.ssbus ) - { - gst_object_unref( GST_OBJECT(mCtx->snapshotVars.ssbus) ); - mCtx->snapshotVars.ssbus = NULL; - } - if( mCtx->snapshotVars.fnametemplate ) - { - free(mCtx->snapshotVars.fnametemplate); - mCtx->snapshotVars.fnametemplate=NULL; - } - DEBUG_API("<-XASnapshotItfAdaptation_FreeSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_CreateSnapshotPipeline(XAAdaptationBaseCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_CreateSnapshotPipeline(XAAdaptationBaseCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - XAStaticCapsData temp; - GstCaps *imageCaps=NULL; - - DEBUG_API("->XASnapshotItfAdaptation_CreateSnapshotPipeline"); - if(!bCtx || bCtx->ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - /*Create snapshotpipeline*/ - mCtx->snapshotVars.sspipeline = gst_pipeline_new ("sspipeline"); - if( mCtx->snapshotVars.sspipeline ) - { - /*add listener*/ - mCtx->snapshotVars.ssbus = gst_pipeline_get_bus(GST_PIPELINE( mCtx->snapshotVars.sspipeline ) ); - if( ! mCtx->snapshotVars.ssbus ) - { - DEBUG_API("Cannot create snapshotbus"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - gst_bus_add_signal_watch( mCtx->snapshotVars.ssbus ); - g_signal_connect(mCtx->snapshotVars.ssbus, "message::eos", - G_CALLBACK(XASnapshotItfAdaptation_SnapshotBusCb), bCtx ); - g_signal_connect(mCtx->snapshotVars.ssbus, "message::state-changed", - G_CALLBACK(XASnapshotItfAdaptation_SnapshotBusCb), bCtx ); - g_signal_connect(mCtx->snapshotVars.ssbus, "message::async-done", - G_CALLBACK(XASnapshotItfAdaptation_SnapshotBusCb), bCtx ); - - /*Create snapshotsource element*/ - mCtx->snapshotVars.ssbuffersrc = gst_element_factory_make("appsrc", "ssbuffersrc"); - if( !mCtx->snapshotVars.ssbuffersrc ) - { - DEBUG_ERR("Cannot create ssbuffersrc!"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - /*Frame parser*/ - mCtx->snapshotVars.ssparser = - gst_element_factory_make("videoparse","ssparser"); - if( !mCtx->snapshotVars.ssparser ) - { - DEBUG_ERR("Could not create snapshotparse"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - /*Scaler and filter for XAImageSettings width&height*/ - mCtx->snapshotVars.ssscaler = - gst_element_factory_make("videoscale","ssscaler"); - if( !mCtx->snapshotVars.ssscaler ) - { - DEBUG_ERR("Could not create ssscaler"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->snapshotVars.ssfilter = - gst_element_factory_make("capsfilter","ssfilter"); - if( !mCtx->snapshotVars.ssfilter ) - { - DEBUG_ERR("Could not create ssfilter"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - /*Create imageencoder */ - if(XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_IMAGE, mCtx->imageEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - if(temp.adaptId!=NULL) - { - mCtx->snapshotVars.ssencoder = gst_element_factory_make((char*)temp.adaptId, "ssencoder"); - } - else if(mCtx->imageEncSettings.encoderId == XA_IMAGECODEC_RAW) - { - /* raw frames are internal format, so no codec needed. just insert identity for linking*/ - mCtx->snapshotVars.ssencoder = gst_element_factory_make("identity", "ssencoder"); - } - } - if( !mCtx->snapshotVars.ssencoder ) - { - DEBUG_API("Cannot create image encoder"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Create also tag setter for JPG */ - if(mCtx->imageEncSettings.encoderId == XA_IMAGECODEC_JPEG) - { - mCtx->snapshotVars.sstagger = gst_element_factory_make("metadatamux", "sstagger"); - if( !mCtx->snapshotVars.sstagger || !gst_bin_add(GST_BIN(mCtx->snapshotVars.sspipeline),mCtx->snapshotVars.sstagger)) - { - DEBUG_API("Cannot create metadatamux"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - } - g_object_set( G_OBJECT(mCtx->snapshotVars.sstagger), "xmp", TRUE, "exif", TRUE, "iptc", TRUE, NULL ); - } - - /*Create sink*/ - if(mCtx->snapshotVars.fnametemplate) - { - DEBUG_INFO("RECORD SNAPSHOT TO FILE"); - mCtx->snapshotVars.sssink = gst_element_factory_make("filesink","ssfilesink"); - g_object_set( G_OBJECT(mCtx->snapshotVars.sssink), "location", "temp", - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - "buffer-mode", 2, - NULL ); - } - else - { - DEBUG_INFO("RECORD SNAPSHOT TO MEMORY"); - mCtx->snapshotVars.sssink = gst_element_factory_make("appsink","ssbuffersink"); - } - if( !mCtx->snapshotVars.sssink ) - { - DEBUG_ERR("Could not create sssink!!"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - g_object_set( G_OBJECT(mCtx->snapshotVars.sssink), "async", FALSE, NULL ); - - /*Add elements to bin*/ - gst_bin_add_many (GST_BIN (mCtx->snapshotVars.sspipeline), - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - mCtx->snapshotVars.ssfilter, - mCtx->snapshotVars.ssencoder, - mCtx->snapshotVars.sssink, - NULL); - - /* set needed XAImageSettings properties*/ - /* set caps from imagesettings */ - imageCaps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, mCtx->imageEncSettings.width, - "height", G_TYPE_INT, mCtx->imageEncSettings.height, NULL); - g_object_set( G_OBJECT(mCtx->snapshotVars.ssfilter), "caps", imageCaps, NULL ); - DEBUG_INFO_A1("new caps: %s",gst_caps_to_string(imageCaps)); - gst_caps_unref(imageCaps); - - /* set compression level */ - if(mCtx->imageEncSettings.encoderId == XA_IMAGECODEC_JPEG) - { - g_object_set( G_OBJECT(mCtx->snapshotVars.ssencoder), "quality", (gint)(1000 - mCtx->imageEncSettings.compressionLevel)/10, NULL ); - } - - /*Chain elements together*/ - if(mCtx->snapshotVars.sstagger) - { - if( !gst_element_link_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - mCtx->snapshotVars.ssfilter, - mCtx->snapshotVars.ssencoder, - mCtx->snapshotVars.sstagger, - mCtx->snapshotVars.sssink, - NULL) ) - { - DEBUG_ERR("Could not link pipeline") - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - if( !gst_element_link_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - mCtx->snapshotVars.ssfilter, - mCtx->snapshotVars.ssencoder, - mCtx->snapshotVars.sssink, - NULL) ) - { - DEBUG_ERR("Could not link pipeline") - return XA_RESULT_INTERNAL_ERROR; - } - } - gstRet = gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_READY); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline"); - return XA_RESULT_SUCCESS; - - } - else - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline"); - return XA_RESULT_PRECONDITIONS_VIOLATED; - } -} - -/* - * gboolean XASnapshotItfAdaptation_SnapshotBusCb( GstBus *bus, GstMessage *message, gpointer data ) - */ -gboolean XASnapshotItfAdaptation_SnapshotBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)data; - - GstState oldstate = GST_STATE_NULL , newstate = GST_STATE_NULL , pendingstate = GST_STATE_NULL; - - /* only interested in messages from snapshot pipeline */ - if( GST_MESSAGE_SRC(message) == GST_OBJECT(mCtx->snapshotVars.sspipeline) ) - { - DEBUG_API_A2("->XASnapshotItfAdaptation_SnapshotBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_EOS: - { - if( gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_READY) - == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("Error stopping snapshot pipeline!!!"); - } - gst_element_get_state(mCtx->snapshotVars.sspipeline, NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - - DEBUG_INFO_A2("Requested %lu snapshots, taked %lu",mCtx->snapshotVars.numpics,mCtx->snapshotVars.numpicstaken+1); - if( ++mCtx->snapshotVars.numpicstaken >= mCtx->snapshotVars.numpics ) - { - XAAdaptEvent takenevent = {XA_SNAPSHOTITFEVENTS, XA_ADAPT_SNAPSHOT_TAKEN, 0, NULL }; - DEBUG_INFO("Snapshot burst finished"); - XASnapshotItfAdaptation_StopSnapshotting(&(mCtx->baseObj)); - if( mCtx->snapshotVars.fnametemplate == NULL ) - { /* non-datasink snapshot, return buffer */ - GstBuffer* pullBuffer = NULL; - XADataSink* pullSink = NULL; - XADataLocator_Address* pullSinkLoc = NULL; - DEBUG_INFO("Get buffer from appsink"); - pullBuffer = gst_app_sink_pull_preroll( GST_APP_SINK(mCtx->snapshotVars.sssink) ); - /* allocate XADataSink, client should release this later*/ - pullSink = calloc(1, sizeof(XADataSink)); - pullSinkLoc = calloc(1, sizeof(XADataLocator_Address)); - pullSinkLoc->length = pullBuffer->size; - pullSinkLoc->pAddress = calloc(1, pullBuffer->size); - memcpy(pullSinkLoc->pAddress, pullBuffer->data, pullBuffer->size); - pullSinkLoc->locatorType = XA_DATALOCATOR_ADDRESS; - pullSink->pLocator = pullSinkLoc; - pullSink->pFormat = NULL; - takenevent.data = pullSink; - } - /* send needed events */ - takenevent.datasize = mCtx->snapshotVars.numpicstaken; - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj), &takenevent ); - } - else - { - /* videoparse element can not handle renegotiation of stream for new buffer - * after EOS, so recreate it */ - gst_element_unlink_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - NULL); - gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.ssparser), GST_STATE_NULL); - gst_bin_remove(GST_BIN (mCtx->snapshotVars.sspipeline),mCtx->snapshotVars.ssparser); - mCtx->snapshotVars.ssparser = gst_element_factory_make("videoparse", "ssparser"); - if( !mCtx->snapshotVars.ssparser ) - { - DEBUG_ERR("Cannot create ssparser!"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - gst_bin_add(GST_BIN (mCtx->snapshotVars.sspipeline),mCtx->snapshotVars.ssparser); - if( !gst_element_link_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - NULL) ) - { - DEBUG_ERR("Could not link pipeline") - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->snapshotVars.parsenegotiated = FALSE; - - /*now, wait for new buffer to arrive*/ - DEBUG_INFO("Wait for more pictures"); - mCtx->snapshotVars.waitforbuffer = TRUE; - mCtx->snapshotVars.sighandler = g_signal_connect(mCtx->videoextract, "handoff", - G_CALLBACK (XASnapshotItfAdaptation_BufferHandoffCb),mCtx); - } - break; - } - case GST_MESSAGE_STATE_CHANGED: - { - gst_message_parse_state_changed(message, &oldstate, &newstate, &pendingstate); - DEBUG_INFO_A4("old %s -> new %s ( pending %s, gsttarget %s )", - gst_element_state_get_name(oldstate), - gst_element_state_get_name(newstate), - gst_element_state_get_name(pendingstate), - gst_element_state_get_name(GST_STATE_TARGET(mCtx->snapshotVars.sspipeline)) ); - if( newstate==GST_STATE_READY && oldstate==GST_STATE_NULL ) - { - XAAdaptEvent initevent = {XA_SNAPSHOTITFEVENTS, XA_ADAPT_SNAPSHOT_INITIATED,0, NULL }; - DEBUG_INFO("Init complete"); - /* send needed events */ - XAAdaptationBase_SendAdaptEvents( &(mCtx->baseObj), &initevent); - } - else if( newstate==GST_STATE_PLAYING && oldstate==GST_STATE_PAUSED && mCtx->snapshotVars.snapshotbuffer ) - { - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(mCtx->snapshotVars.ssbuffersrc), - mCtx->snapshotVars.snapshotbuffer ); - DEBUG_INFO_A1("Sent buffer at 0x%x to ssbuffersrc", (int)mCtx->snapshotVars.snapshotbuffer ); - gst_app_src_end_of_stream( GST_APP_SRC(mCtx->snapshotVars.ssbuffersrc) ); - mCtx->snapshotVars.snapshotbuffer = NULL; - DEBUG_INFO("Sent EOS ssbuffersrc"); - } - - break; - } - default: - break; - } - DEBUG_API("<-XASnapshotItfAdaptation_SnapshotBusCb"); - } - return TRUE; -} - -/* - * void XASnapshotItfAdaptation_BufferHandoffCb( GstElement *extract, GstBuffer *buffer, gpointer data ) - */ -void XASnapshotItfAdaptation_BufferHandoffCb( GstElement *extract, GstBuffer *buffer, gpointer data ) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)data; - gint32 width=0, height=0; - guint32 fourcc=0, formatnum=0; - GstPad* srcPad=NULL; - GstCaps* srcPadCaps=NULL; - GstStructure* capS=NULL; - XAAdaptEvent event = {XA_SNAPSHOTITFEVENTS, XA_ADAPT_SNAPSHOT_TAKEN, 0, NULL }; - char* fname=NULL; - - DEBUG_API("->XASnapshotItfAdaptation_BufferHandoffCb"); - if( !mCtx->snapshotVars.waitforbuffer || - !GST_IS_BUFFER(buffer) ) - { /* pass on... */ - DEBUG_API("<-XASnapshotItfAdaptation_BufferHandoffCb"); - return; - } - - if(mCtx->snapshotVars.snapshotbuffer) - { - DEBUG_INFO("WARNING: snapshotbuffer already exists!!"); - gst_buffer_unref(GST_BUFFER(mCtx->snapshotVars.snapshotbuffer)); - } - DEBUG_INFO("Receiced snapshotbuffer"); - mCtx->snapshotVars.snapshotbuffer = gst_buffer_copy(buffer); - mCtx->snapshotVars.waitforbuffer = FALSE; - g_signal_handler_disconnect(mCtx->videoextract,mCtx->snapshotVars.sighandler); - mCtx->snapshotVars.sighandler = 0; - - if( GST_STATE(mCtx->snapshotVars.sspipeline)==GST_STATE_READY ) - { - if( !(mCtx->snapshotVars.parsenegotiated) ) - { - /*read relevant caps of extraction source and set them to videoparse*/ - srcPad = gst_element_get_pad( GST_ELEMENT(extract), "src"); - srcPadCaps = gst_pad_get_negotiated_caps( GST_PAD(srcPad) ); - capS = gst_caps_get_structure(srcPadCaps,0); - DEBUG_INFO_A1("buffer caps from extraction source: %s",gst_caps_to_string(srcPadCaps)); - if( !gst_structure_get_int(capS,"width",&width) || - !gst_structure_get_int(capS,"height",&height) || - !gst_structure_get_fourcc(capS,"format",&fourcc) ) - { - DEBUG_ERR("ERROR! Missing crucial capabilities for buffer!!"); - DEBUG_API("<-XASnapshotItfAdaptation_BufferHandoffCb"); - return; - } - /* convert fourcc to videoparse enumeration */ - switch(fourcc) - { - case GST_MAKE_FOURCC('I','4','2','0'): - formatnum = 0; - break; - case GST_MAKE_FOURCC('Y','V','1','2'): - formatnum = 1; - break; - case GST_MAKE_FOURCC('Y','U','Y','2'): - formatnum = 2; - break; - case GST_MAKE_FOURCC('U','Y','V','Y'): - formatnum = 3; - break; - case GST_MAKE_FOURCC('R','G','B',' '): - formatnum = 10; - break; - case GST_MAKE_FOURCC('G','R','A','Y'): - formatnum = 11; - break; - default: - formatnum = 0; - break; - } - /* set source width and height for parser */ - g_object_set(mCtx->snapshotVars.ssparser,"width",width,"height",height,"format",formatnum,NULL); - mCtx->snapshotVars.parsenegotiated = TRUE; - } - if(mCtx->snapshotVars.fnametemplate) - { /* get actual filename from template */ - XASnapshotItfAdaptation_AllocNextFilename(&fname, mCtx->snapshotVars.fnametemplate); - DEBUG_INFO_A1("start taking snapshot (%s)", fname); - gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sssink), GST_STATE_NULL); - g_object_set( G_OBJECT(mCtx->snapshotVars.sssink), "location", fname, - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - NULL ); - gst_element_sync_state_with_parent(mCtx->snapshotVars.sssink); - gst_element_get_state(mCtx->snapshotVars.sssink, NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - free(fname); - } - else - { /* take snapshot to buffer */ - DEBUG_INFO("start taking snapshot (memory buffer used)"); - } - /* write metadata, if any */ - XAMetadataAdapt_TryWriteTags(&(mCtx->baseObj), GST_BIN(mCtx->snapshotVars.sspipeline)); - /* start buffering */ - if( gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_PLAYING ) - == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("Error taking picture!!!"); - /* NOTE: no event for errors in snapshotitf!!! */ - event.datasize = mCtx->snapshotVars.numpicstaken; - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj), &event ); - } - } - else - { - DEBUG_INFO_A1("warning: sspipeline in wrong state (%d)", - GST_STATE(mCtx->snapshotVars.sspipeline)); - } - DEBUG_API("<-XASnapshotItfAdaptation_BufferHandoffCb"); -} - -/* - * const char* XASnapshotItfAdaptation_GetFileSuffix(XADataFormat_MIME* format) - */ -const char* XASnapshotItfAdaptation_GetFileSuffix(XADataFormat_MIME* format) -{ - const char* ret=NULL; - if( format ) - { - if( *(XAuint32*)format == XA_DATAFORMAT_MIME ) - { - switch (format->containerType) - { - case XA_CONTAINERTYPE_JPG: - ret = "jpg"; - break; - case XA_CONTAINERTYPE_RAW: - ret = "raw"; - break; - case XA_CONTAINERTYPE_BMP: - ret = "bmp"; - break; - default: - break; - } - if(!ret) - { /*parse from mimetype*/ - if(format->mimeType) - { - ret = strrchr((char*)format->mimeType,'/'); - if (ret) - { - ret++; - } - } - } - } - else if( *(XAuint32*)format == XA_DATAFORMAT_RAWIMAGE ) - { - ret = "raw"; - } - } - if(!ret) - { - ret="jpg"; /*default*/ - } - return ret; -} - -/* - * void XASnapshotItfAdaptation_AllocNextFilename(char** fname, const char* template) - */ -void XASnapshotItfAdaptation_AllocNextFilename(char** fname, const char* template) -{ - XAuint32 idx=0; - XAboolean found=XA_BOOLEAN_FALSE; - FILE* file=NULL; - *fname = calloc(1,strlen(template)+10); - while(!found) - { - sprintf(*fname, template, idx++ ); - strcat(*fname, "\0"); - file = fopen(*fname, "r"); - if(file==NULL) - { - found = XA_BOOLEAN_TRUE; - break; - } - fclose(file); - } -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xasnapshotitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xasnapshotitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XSNAPSHOTITFADAPTATION_H -#define XSNAPSHOTITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* DEFINES*/ - -/* MACROS */ - -/* FUNCTIONS */ - -XAresult XASnapshotItfAdaptation_InitiateSnapshot(XAAdaptationBaseCtx* ctx, - XAuint32 numberOfPictures, - XAuint32 fps, - XAboolean freezeViewFinder, - XADataSink* sink); - -XAresult XASnapshotItfAdaptation_TakeSnapshot(XAAdaptationBaseCtx* ctx); - -XAresult XASnapshotItfAdaptation_CancelSnapshot(XAAdaptationBaseCtx* ctx); - -XAresult XASnapshotItfAdaptation_GetMaxPicsPerBurst(XAAdaptationBaseCtx* ctx, - XAuint32 *maxNumberOfPictures); - -XAresult XASnapshotItfAdaptation_GetBurstFPSRange(XAAdaptationBaseCtx* ctx, - XAuint32 *minFPS, - XAuint32 *maxFPS); - -XAresult XASnapshotItfAdaptation_SetShutterFeedback(XAAdaptationBaseCtx* ctx, - XAboolean enabled); -#endif /* XSNAPSHOTITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xastaticcameracapsadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xastaticcameracapsadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,562 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "XAGlobals.h" -#include "XAStaticCameraCapsAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -#define XACAMERAIMPL_DEFAULT_MAX_ZOOM 16000 /* 16x */ -#define XACAMERAIMPL_DEFAULT_MAX_ISO 1600 -#define XACAMERAIMPL_DEFAULT_MIN_ISO 200 -#define XACAMERAIMPL_DEFAULT_MAX_APERTURE 3200 /* f/32 */ -#define XACAMERAIMPL_DEFAULT_MIN_APERTURE 75 /* f/0.75 */ - -static XAStaticCameraCapsData allCameraCaps[] = -{ -#ifdef XA_USE_TEST_PLUGINS - { XA_ADAPTID_VIDEOTESTSRC, { (XAchar*)"videotestsrc", 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -#else - { XA_ADAPTID_V4L2SRC, { (XAchar*)"v4l2src", 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -#endif -}; - -/*forward declaration*/ -XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID); - -/* - * void XAStaticCameraCaps_Init() - */ -void XAStaticCameraCaps_Init() -{ - GstElement* element=NULL; - GstPhotoCaps photoCaps = GST_PHOTOGRAPHY_CAPS_NONE; - GError* gerror=NULL; - guint32 i=0; - guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); - gboolean detected = FALSE; - - - if ( !gst_init_check( NULL, NULL, &gerror ) ) - { - DEBUG_ERR("Gst Initalization failure."); - return; - } - for(i=0;i allCameraCaps[i].XAcaps.maxWidth) - { - allCameraCaps[i].XAcaps.maxWidth = width; - } - } - - value = gst_structure_get_value( capsStruct, "height" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - detected = TRUE; - height = gst_value_get_int_range_max( value ); - if(height > allCameraCaps[i].XAcaps.maxHeight) - { - allCameraCaps[i].XAcaps.maxHeight = height; - } - } - } - } - } - } - - if(!detected) - { - DEBUG_ERR("Warn: could not get maxWidth and maxHeight from GST!!"); - allCameraCaps[i].XAcaps.maxWidth = 0x7FFFFFFF; - allCameraCaps[i].XAcaps.maxHeight = 0x7FFFFFFF; - } - - if(GST_IS_PHOTOGRAPHY(element)) - { - photoCaps = gst_photography_get_capabilities(GST_PHOTOGRAPHY(element)); - if( photoCaps & GST_PHOTOGRAPHY_CAPS_FLASH ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_FLASH; - allCameraCaps[i].XAcaps.flashModesSupported = XA_CAMERA_FLASHMODE_OFF | - XA_CAMERA_FLASHMODE_ON | - XA_CAMERA_FLASHMODE_AUTO | - XA_CAMERA_FLASHMODE_REDEYEREDUCTION | - XA_CAMERA_FLASHMODE_FILLIN; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_FOCUS ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_AUTOFOCUS; - allCameraCaps[i].XAcaps.focusModesSupported = XA_CAMERA_FOCUSMODE_AUTO; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_EXPOSURE ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALEXPOSURE; - allCameraCaps[i].XAcaps.exposureModesSupported = XA_CAMERA_EXPOSUREMODE_AUTO | - XA_CAMERA_EXPOSUREMODE_PORTRAIT | - XA_CAMERA_EXPOSUREMODE_SPORTS | - XA_CAMERA_EXPOSUREMODE_NIGHT; - } - - if( photoCaps & GST_PHOTOGRAPHY_CAPS_ISO_SPEED ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALISOSENSITIVITY; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_APERTURE ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALAPERTURE; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_WB_MODE ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_AUTOWHITEBALANCE; - allCameraCaps[i].XAcaps.whiteBalanceModesSupported = XA_CAMERA_WHITEBALANCEMODE_AUTO | - XA_CAMERA_WHITEBALANCEMODE_SUNLIGHT | - XA_CAMERA_WHITEBALANCEMODE_CLOUDY | - XA_CAMERA_WHITEBALANCEMODE_TUNGSTEN | - XA_CAMERA_WHITEBALANCEMODE_FLUORESCENT | - XA_CAMERA_WHITEBALANCEMODE_SUNSET; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_ZOOM ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_DIGITALZOOM; - } - } - } - } -} - -/* - * XAresult XAStaticCameraCaps_GetCameraCapabilities( - * XAuint32* pIndex, - * XAuint32* pCameraDeviceID, - * XACameraDescriptor* pDescriptor) - * - */ -XAresult XAStaticCameraCaps_GetCameraCapabilities( - XAuint32* pIndex, - XAuint32* pCameraDeviceID, - XACameraDescriptor* pDescriptor) -{ - guint32 idx = 0; - guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); - - if(!pDescriptor) - { - if(pIndex) /* query number of devices */ - { - *pIndex = numDevices; - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - } - - if( !pIndex && pCameraDeviceID ) - { - /* get index from ID */ - idx = XAStaticCameraCaps_IdxFromId(*pCameraDeviceID); - } - else if( pIndex && pCameraDeviceID ) - { - idx = *pIndex; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - - if( idx >= numDevices ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - /*fill capabilities*/ - memcpy(pDescriptor, &allCameraCaps[idx].XAcaps, sizeof(XACameraDescriptor) ); - *pCameraDeviceID = allCameraCaps[idx].deviceID; - } - - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_QueryFocusRegionPatterns( - * XAuint32 cameraDeviceID, - * XAuint32* pPatternID, - * XAuint32* pFocusPattern, - * XAuint32* pCustomPoints1, - * XAuint32* pCustomPoints2) - */ -XAresult XAStaticCameraCaps_QueryFocusRegionPatterns( - XAuint32 cameraDeviceID, - XAuint32* pPatternID, - XAuint32* pFocusPattern, - XAuint32* pCustomPoints1, - XAuint32* pCustomPoints2) -{ - DEBUG_API("->XAStaticCameraCaps_QueryFocusRegionPatterns"); - if( !pFocusPattern ) - { /* return number of focus patterns */ - if(!pPatternID) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - /* no support in GST */ - DEBUG_INFO("No support in gst"); - *pPatternID = 0; - } - else - { - if( !(pFocusPattern&&pCustomPoints1&&pCustomPoints2) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - DEBUG_INFO("No support in gst"); - *pFocusPattern = 0; - *pCustomPoints1 = 0; - *pCustomPoints2 = 0; - /*no focus patterns, index always out of range*/ - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedAutoLocks( - * XAuint32 cameraDeviceID, - * XAuint32* pNumCombinations, - * XAuint32** ppLocks) - */ -XAresult XAStaticCameraCaps_GetSupportedAutoLocks( - XAuint32 cameraDeviceID, - XAuint32* pNumCombinations, - XAuint32** ppLocks) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedAutoLocks"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumCombinations) - { - *pNumCombinations = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedAutoLocks"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedFocusManualSettings( - * XAuint32 cameraDeviceID, - * XAboolean macroEnabled, - * XAmillimeter* pMinValue, - * XAmillimeter* pMaxValue, - * XAuint32* pNumSettings, - * XAmillimeter** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedFocusManualSettings( - XAuint32 cameraDeviceID, - XAboolean macroEnabled, - XAmillimeter* pMinValue, - XAmillimeter* pMaxValue, - XAuint32* pNumSettings, - XAmillimeter** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedFocusManualSettings"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumSettings) - { - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedFocusManualSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedISOSensitivitySettings( - * XAuint32 cameraDeviceID, - * XAuint32* pMinValue, - * XAuint32* pMaxValue, - * XAuint32* pNumSettings, - * XAuint32** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedISOSensitivitySettings( - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); - if( !pNumSettings ) - { - return XA_RESULT_PARAMETER_INVALID; - } - if( !ppSettings ) - { - /* no items in ppSettings array*/ - *pNumSettings = 0; - } - else - { - if( !(pMinValue && pMaxValue) ) - { - DEBUG_API("<-XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); - return XA_RESULT_PARAMETER_INVALID; - } - /* continuous range */ - *pNumSettings = 0; - /* NOTE: no way to query actual values from gstreamer, use hardcoded default values */ - *pMinValue = XACAMERAIMPL_DEFAULT_MIN_ISO; - *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_ISO; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedApertureManualSettings( - * XAuint32 cameraDeviceID, - * XAuint32* pMinValue, - * XAuint32* pMaxValue, - * XAuint32* pNumSettings, - * XAuint32** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedApertureManualSettings( - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedApertureManualSettings"); - if( !pNumSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetSupportedApertureManualSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - if( !ppSettings ) - { - /* no items in ppSettings array*/ - *pNumSettings = 0; - } - else - { - /* continuous range */ - *pNumSettings = 0; - /* NOTE: no way to query actual values from gstreamer, use hardcoded default values */ - *pMinValue = XACAMERAIMPL_DEFAULT_MIN_APERTURE; - *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_APERTURE; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedApertureManualSettings"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( - * XAuint32 cameraDeviceID, - * XAmicrosecond* pMinValue, - * XAmicrosecond* pMaxValue, - * XAuint32* pNumSettings, - * XAmicrosecond** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( - XAuint32 cameraDeviceID, - XAmicrosecond* pMinValue, - XAmicrosecond* pMaxValue, - XAuint32* pNumSettings, - XAmicrosecond** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumSettings) - { - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( - * XAuint32 cameraDeviceID, - * XAuint32* pMinValue, - * XAuint32* pMaxValue, - * XAuint32* pNumSettings, - * XAuint32** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumSettings) - { - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedZoomSettings( - * XAuint32 cameraDeviceID, - * XAboolean digitalEnabled, - * XAboolean macroEnabled, - * XApermille* pMaxValue, - * XAuint32* pNumSettings, - * XApermille** ppSettings, - * XAboolean* pSpeedSupported) - */ -XAresult XAStaticCameraCaps_GetSupportedZoomSettings( - XAuint32 cameraDeviceID, - XAboolean digitalEnabled, - XAboolean macroEnabled, - XApermille* pMaxValue, - XAuint32* pNumSettings, - XApermille** ppSettings, - XAboolean* pSpeedSupported) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedZoomSettings"); - if( !ppSettings ) - { - if( !pNumSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - *pNumSettings = 0; - } - else - { - if( !(pMaxValue && pSpeedSupported) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - /*NOTE: no way to query actual max value*/ - *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_ZOOM; - /*no gst support for speed settings*/ - *pSpeedSupported = XA_BOOLEAN_FALSE; - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); - return XA_RESULT_SUCCESS; -} - -/* - * XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID) - */ -XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID) -{ - XAuint32 devId = 0; - XAuint32 idx = 0; - guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); - - if(cameraDeviceID == XA_DEFAULTDEVICEID_CAMERA) - { - devId = XACAMERAIMPL_DEFAULT_DEVICE; - } - else - { - devId = cameraDeviceID; - } - - /* query capas with id -> find index*/ - for(idx=0; idx -#include -#include -#include "XAStaticCapsAdaptation.h" - -#define AUD_D (XACAP_DECODER|XACAP_AUDIO) -#define AUD_E (XACAP_ENCODER|XACAP_AUDIO) -#define VID_D (XACAP_DECODER|XACAP_VIDEO) -#define VID_E (XACAP_ENCODER|XACAP_VIDEO) -#define IMG_D (XACAP_DECODER|XACAP_IMAGE) -#define IMG_E (XACAP_ENCODER|XACAP_IMAGE) -#define AUD_O (XACAP_DEVSNK|XACAP_AUDIO) -#define AUD_I (XACAP_DEVSRC|XACAP_AUDIO) -#define VID_O (XACAP_DEVSNK|XACAP_VIDEO) -#define VID_I (XACAP_DEVSRC|XACAP_VIDEO) -#define ANY 0x7FFFFFFF - - -/* initially contains default "any"values, later filled in by querying GStreamer plugins */ -static XAStaticCapsData allCaps[] = - {/* { type, id, adaptId, maxCh, minBPS, maxBPS, minSR, maxSR, minBR, maxBR, maxFR, maxW, maxH, extra }, */ - // { AUD_D, XA_AUDIOCODEC_PCM, (XAchar *)"audioparse", 0,0,0,0,0,0,0,0,0,0,0,0 }, - { AUD_E, XA_AUDIOCODEC_PCM, NULL, 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { AUD_D, XA_ADAPTID_VORBIS, (XAchar *)"vorbisdec", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { AUD_E, XA_ADAPTID_VORBIS, (XAchar *)"vorbisenc", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { VID_D, XA_ADAPTID_MOTIONJPEG, (XAchar *)"jpegdec", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { VID_E, XA_ADAPTID_MOTIONJPEG, (XAchar *)"jpegenc", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { VID_D, XA_ADAPTID_THEORA, (XAchar *)"theoradec", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { VID_E, XA_ADAPTID_THEORA, (XAchar *)"theoraenc", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { VID_D, XA_ADAPTID_RAWVIDEO, (XAchar *)"videoparse", 0,0,0,0,0,0,0,0,0,0,0,0 }, - { VID_E, XA_ADAPTID_RAWVIDEO, NULL, 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { IMG_D, XA_IMAGECODEC_JPEG, (XAchar *)"jpegdec", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { IMG_E, XA_IMAGECODEC_JPEG, (XAchar *)"jpegenc", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { IMG_D, XA_IMAGECODEC_RAW, (XAchar *)"videoparse", 0,0,0,0,0,0,0,0,0,0,0,0 }, - { IMG_E, XA_IMAGECODEC_RAW, NULL, 0,0,0,0,0,0,0,0,0,0,0,0 }, - { AUD_O, XA_ADAPTID_DEVSOUNDSINK, (XAchar *)"devsoundsink", 0,0,0,0,0,0,0,0,0,0,0,0 }, - { AUD_I, XA_ADAPTID_DEVSOUNDSRC, (XAchar *)"devsoundsrc", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { AUD_O, XA_ADAPTID_ALSASINK, (XAchar *)"alsasink", 0,0,0,0,0,0,0,0,0,0,0,0 }, - // { AUD_I, XA_ADAPTID_ALSASRC, (XAchar *)"alsasrc", 0,0,0,0,0,0,0,0,0,0,0,0 } -//#ifdef XA_USE_TEST_PLUGINS -// ,{ AUD_I, XA_ADAPTID_AUDIOTESTSRC, (XAchar *)"audiotestsrc", 0,0,0,0,0,0,0,0,0,0,0,0 } -//#endif - }; - -/* - * XAresult XAStaticCapsAdapt_ReadImageCaps(GstCaps* caps, XAStaticCapsData* data) - */ -XAresult XAStaticCapsAdapt_ReadImageCaps(GstCaps* caps, XAStaticCapsData* data) -{ - XAresult res = XA_RESULT_SUCCESS; - - XAuint32 widthMax = 0; - XAuint32 heightMax = 0; - gint capsCount = 0; - gint iterator = 0; - GstStructure *capsStruct = NULL; - G_CONST_RETURN GValue* value = NULL; - - DEBUG_API("->XAStaticCapsAdapt_ReadImageCaps"); - capsCount = gst_caps_get_size( caps ); - for( iterator = 0; iterator < capsCount; iterator++ ) - { - capsStruct = gst_caps_get_structure( caps, iterator ); - - DEBUG_INFO_A1("Caps from gst: %s", gst_structure_to_string(capsStruct)); - - if (gst_structure_n_fields( capsStruct ) > 0) /* Any check*/ - { - value = gst_structure_get_value( capsStruct, "width" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - widthMax = gst_value_get_int_range_max( value ); - DEBUG_INFO_A1("widthMax:%d",(int)widthMax); - } - else - { - DEBUG_ERR("Cannot get width from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadImageCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - value = gst_structure_get_value( capsStruct, "height" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - heightMax = gst_value_get_int_range_max( value ); - DEBUG_INFO_A1("heightMax:%d",(int)heightMax); - } - else - { - DEBUG_ERR("Cannot get height from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadImageCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - if (heightMax < data->maxH) - { - data->maxH = heightMax; - } - if (widthMax < data->maxW) - { - data->maxW = widthMax; - } - } - } - DEBUG_API("<-XAStaticCapsAdapt_ReadImageCaps"); - return res; -} - -/* - * XAresult XAStaticCapsAdapt_ReadAudioCaps(GstCaps* caps, XAStaticCapsData* data, GstElement* element) - */ -XAresult XAStaticCapsAdapt_ReadAudioCaps(GstCaps* caps, XAStaticCapsData* data, GstElement* element) -{ - XAresult res = XA_RESULT_SUCCESS; - - XAuint32 channelsMax = ANY; - XAuint32 minRate = 0; - XAuint32 maxRate = ANY; - XAuint32 minBPS = 0; - XAuint32 maxBPS = ANY; - XAuint32 minBR = 0; - XAuint32 maxBR = ANY; - XAboolean intCapsUsed = XA_BOOLEAN_FALSE; - - gint capsCount = 0; - gint iterator = 0; - GstStructure *capsStruct = NULL; - G_CONST_RETURN GValue* value = NULL; - const char* capsName = NULL; - - DEBUG_API("->XAStaticCapsAdapt_ReadAudioCaps"); - capsCount = gst_caps_get_size( caps ); - for( iterator = 0; iterator < capsCount; iterator++ ) - { - capsStruct = gst_caps_get_structure( caps, iterator ); - - DEBUG_INFO_A1("Caps from gst: %s", gst_structure_to_string(capsStruct)); - capsName = gst_structure_get_name(capsStruct); - - if (intCapsUsed == XA_BOOLEAN_TRUE) - { - break; // preferred caps used - } - else if (!strcmp( capsName,"audio/x-raw-int")) - { - intCapsUsed = XA_BOOLEAN_TRUE; - } - - if (gst_structure_n_fields( capsStruct ) > 0) // Any check - { - value = gst_structure_get_value( capsStruct, "channels" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - channelsMax = gst_value_get_int_range_max( value ); - DEBUG_INFO_A1("channelsMax:%d",(int)channelsMax); - } - else if (G_VALUE_HOLDS_INT(value)) - { - channelsMax = g_value_get_int( value ); - DEBUG_INFO_A1("channelsMax:%d",(int)channelsMax); - } - else - { - DEBUG_ERR("Cannot get channels from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - value = gst_structure_get_value( capsStruct, "rate" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - minRate = gst_value_get_int_range_min( value ); - maxRate = gst_value_get_int_range_max( value ); - DEBUG_INFO_A2("minRate:%d maxRate:%d",(int)minRate,(int)maxRate); - } - else - { - DEBUG_ERR("Cannot get rates from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - value = gst_structure_get_value( capsStruct, "width" ); - if (GST_VALUE_HOLDS_LIST(value)) - { - XAuint32 count = 0; - XAuint32 i = 0; - XAuint32 bps = 0; - count = gst_value_list_get_size(value); - for (i = 0; i < count; i++ ) - { - G_CONST_RETURN GValue* v = gst_value_list_get_value(value, i); - bps = g_value_get_int(v); - if (bps < minBPS || i == 0) - { - minBPS = bps; - } - if (bps > maxBPS || i == 0) - { - maxBPS = bps; - } - DEBUG_INFO_A2("minBPS:%d maxBPS:%d",(int)minBPS,(int)maxBPS); - } - } - else if (G_VALUE_HOLDS_INT(value)) - { - minBPS = g_value_get_int(value); - maxBPS = g_value_get_int(value); - DEBUG_INFO_A2("minBPS:%d maxBPS:%d",(int)minBPS,(int)maxBPS); - } - else - { - // if not there read from depth - value = gst_structure_get_value( capsStruct, "depth" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - minBPS = gst_value_get_int_range_min( value ); - maxBPS = gst_value_get_int_range_max( value ); - DEBUG_INFO_A2("minBPS:%d maxBPS:%d",(int)minBPS,(int)maxBPS); - } - else - { - DEBUG_ERR("Cannot get width from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - } - - value = gst_structure_get_value( capsStruct, "bitrate" ); - if( value && GST_VALUE_HOLDS_INT_RANGE(value) ) - { - minBR = gst_value_get_int_range_min( value ); - maxBR = gst_value_get_int_range_max( value ); - DEBUG_INFO_A2("minBR:%d maxBR:%d",(int)minBR,(int)maxBR); - } - else - { - // TL: Replaced this code... - /* GParamSpec* param = g_object_class_find_property(G_OBJECT_GET_CLASS(element), "bitrate"); - if(param && G_IS_PARAM_SPEC_INT(param)) - { - GParamSpecInt *pint = G_PARAM_SPEC_INT (param); - if(pint->minimum>0) minBR = pint->minimum; - else minBR = 1; - maxBR = pint->maximum; - } - */ - - // ...with this: - // GstBitRate *bitRate; // This object doesn't exist yet - // GObject *minBitRate = G_OBJECT(bitRate->minBitRate); - // GObject *maxBitRate = G_OBJECT(bitRate->maxBitRate); - //if (g_object_class_find_property(G_OBJECT_GET_CLASS(minBitRate), "bitrate")) - //{ - // if (minBitRate > 0) - // minBR = minBitRate; - // else - // minBR = 1; - //} - //else - // minBR = 0; - //if (g_object_class_find_property(G_OBJECT_GET_CLASS(maxBitRate), "bitrate")) - // maxBR = maxBitRate; - // else - // maxBR = 0; - } - - if (channelsMax < data->maxCh) - { - data->maxCh = channelsMax; - } - if (minRate > data->minSR) - { - data->minSR = minRate; - } - if (maxRate < data->maxSR) - { - data->maxSR = maxRate; - } - if (minBPS > data->minBPS) - { - data->minBPS = minBPS; - } - if (maxBPS < data->maxBPS) - { - data->maxBPS = maxBPS; - } - if (minBR > data->minBR) - { - data->minBR = minBR; - } - if (maxBR < data->maxBR) - { - data->maxBR = maxBR; - } - } - } - - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioCaps"); - return res; -} - -/* - * XAresult XAStaticCapsAdapt_ReadVideoCaps(GstCaps* caps, XAStaticCapsData* data) - */ -XAresult XAStaticCapsAdapt_ReadVideoCaps(GstCaps* caps, XAStaticCapsData* data) -{ - XAresult res = XA_RESULT_SUCCESS; - - XAuint32 widthMax = ANY; - XAuint32 heightMax = ANY; - XAuint32 frMax = ANY; - const GValue* framerate = NULL; - - gint capsCount = 0; - gint iterator = 0; - GstStructure *capsStruct = NULL; - G_CONST_RETURN GValue* value = NULL; - - DEBUG_API("->XAStaticCapsAdapt_ReadVideoCaps"); - capsCount = gst_caps_get_size( caps ); - for( iterator = 0; iterator < capsCount; iterator++ ) - { - capsStruct = gst_caps_get_structure( caps, iterator ); - - DEBUG_INFO_A1("Caps from gst: %s", gst_structure_to_string(capsStruct)); - - if (gst_structure_n_fields( capsStruct ) > 0) /* Any check*/ - { - value = gst_structure_get_value( capsStruct, "width" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - widthMax = gst_value_get_int_range_max( value ); - DEBUG_INFO_A1("widthMax:%d",(int)widthMax); - } - else - { - DEBUG_ERR("Cannot get width from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadVideoCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - value = gst_structure_get_value( capsStruct, "height" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - heightMax = gst_value_get_int_range_max( value ); - DEBUG_INFO_A1("heightMax:%d",(int)heightMax); - } - else - { - DEBUG_ERR("Cannot get height from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadVideoCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - value = gst_structure_get_value( capsStruct, "framerate" ); - if (GST_VALUE_HOLDS_FRACTION_RANGE(value)) - { - framerate = gst_value_get_fraction_range_max( value ); - frMax = gst_value_get_fraction_numerator( framerate ); - DEBUG_INFO_A1("frMax:%d",(int)frMax); - } - else - { - DEBUG_ERR("Cannot get height from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadVideoCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - if (heightMax < data->maxH) - { - data->maxH = heightMax; - } - if (widthMax < data->maxW) - { - data->maxW = widthMax; - } - if (frMax < data->maxFR) - { - data->maxFR = frMax; - } - } - } - - DEBUG_API("<-XAStaticCapsAdapt_ReadVideoCaps"); - return res; -} - -/* - * XAresult XAStaticCapsAdapt_ReadAudioIOCaps(GstCaps* caps, XAStaticCapsData* data) - */ -XAresult XAStaticCapsAdapt_ReadAudioIOCaps(GstCaps* caps, XAStaticCapsData* data) -{ - XAresult res = XA_RESULT_SUCCESS; - - XAuint32 minSR = 0; - XAuint32 maxSR = ANY; - gint capsCount = 0; - gint iterator = 0; - GstStructure *capsStruct = NULL; - - const char* capsName = NULL; - XAuint32 depth = 0; - - DEBUG_API("->XAStaticCapsAdapt_ReadAudioIOCaps"); - capsCount = gst_caps_get_size( caps ); - for( iterator = 0; iterator < capsCount; iterator++ ) - { - capsStruct = gst_caps_get_structure( caps, iterator ); - - DEBUG_INFO_A1("Caps from gst: %s", gst_structure_to_string(capsStruct)); - - capsName = gst_structure_get_name(capsStruct); - if (!strcmp(capsName, "audio/x-raw-int")) - { - if (gst_structure_get_int( capsStruct, "depth", (gint*)&depth)) - { - DEBUG_INFO_A1("depth:%d",(int)depth); - } - else - { - DEBUG_ERR("Cannot get depth from capabilities struct"); - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioIOCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - if (minSR == 0 && maxSR == 0) - { - minSR = depth; - maxSR = depth; - } - else - { - if (depth < minSR) - { - minSR = depth; - } - if (depth > maxSR) - { - maxSR = depth; - } - } - switch (depth) - { - case XA_PCMSAMPLEFORMAT_FIXED_8: - data->pcmProfilesSupported |= XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_8; - break; - case XA_PCMSAMPLEFORMAT_FIXED_16: - data->pcmProfilesSupported |= XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_16; - break; - case XA_PCMSAMPLEFORMAT_FIXED_20: - data->pcmProfilesSupported |= XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_20; - break; - case XA_PCMSAMPLEFORMAT_FIXED_24: - data->pcmProfilesSupported |= XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_24; - break; - case XA_PCMSAMPLEFORMAT_FIXED_28: - data->pcmProfilesSupported |= XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_28; - break; - case XA_PCMSAMPLEFORMAT_FIXED_32: - data->pcmProfilesSupported |= XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_32; - break; - default: - DEBUG_ERR("Invalid depth"); - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioIOCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } - data->minSR = minSR; - data->maxSR = maxSR; - - - DEBUG_API("<-XAStaticCapsAdapt_ReadAudioIOCaps"); - return res; -} - -/* - * XAresult XAStaticCapsAdapt_GetCapsFromGst(XAStaticCapsData* data) - */ -XAresult XAStaticCapsAdapt_GetCapsFromGst(XAStaticCapsData* data) -{ - XAresult res = XA_RESULT_SUCCESS; - GstCaps* caps = NULL; - GstPad* pad = NULL; - GstPad* pads[2] = {NULL, NULL}; - GstElement* element = NULL; - XAuint32 padCount = 2; /* default src/sink */ - XAuint32 padLoop = 0; - - DEBUG_API("->XAStaticCapsAdapt_GetCapsFromGst"); - - /* by default no constraints */ - data->maxCh = ANY; - data->minBPS = 0; - data->maxBPS = ANY; - data->minSR = 0; - data->maxSR = ANY; - data->minBR = 0; - data->maxBR = ANY; - data->maxFR = ANY; - data->maxW = ANY; - data->maxH = ANY; - data->extra = 0; - data->pcmProfilesSupported = 0; - data->numBitrates = 0; - - if (data->xaid == XA_AUDIOCODEC_PCM) - { - data->extra = XA_AUDIOPROFILE_PCM; - } - - if (data->adaptId != NULL) - { - element = gst_element_factory_make( (char *)data->adaptId, (char *)data->adaptId); - if (!element) - { - DEBUG_ERR("Cannot make gst element!"); - DEBUG_API("<-XAStaticCapsAdapt_GetelementCaps - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - if (data->captype == AUD_I || data->captype == AUD_O) - { - padCount = 1; - if (data->captype == AUD_I) - { - pads[0] = gst_element_get_static_pad( element, "src"); - } - else - { - pads[0] = gst_element_get_static_pad( element, "sink"); - } - } - else - { - padCount = 2; - pads[0] = gst_element_get_static_pad( element, "sink"); - pads[1] = gst_element_get_static_pad( element, "src"); - } - - if (!pads[0] || (!pads[1] && padCount == 2)) - { - DEBUG_ERR("Cannot get pad!"); - DEBUG_API("<-XAStaticCapsAdapt_GetCapsFromGst - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - for (padLoop = 0; padLoop < padCount; padLoop++) - { - pad = pads[padLoop]; - - caps = gst_pad_get_caps( pad ); - if( !caps ) - { - DEBUG_ERR("Cannot receive caps from pad!"); - DEBUG_API("<-XAStaticCapsAdapt_GetCapsFromGst - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - if (data->captype & XACAP_IMAGE) - { - res = XAStaticCapsAdapt_ReadImageCaps(caps, data); - } - else if(data->captype & XACAP_AUDIO) - { - res = XAStaticCapsAdapt_ReadAudioCaps(caps, data, element); - } - else if(data->captype & XACAP_VIDEO) - { - res = XAStaticCapsAdapt_ReadVideoCaps(caps, data); - } - if (data->captype == AUD_I || data->captype == AUD_O) - { - res = XAStaticCapsAdapt_ReadAudioIOCaps(caps, data); - } - } - } - - DEBUG_API("<-XAStaticCapsAdapt_GetCapsFromGst"); - return res; -} - -/* - * XAresult XAStaticCapsAdapt_InitCaps() - */ -XAresult XAStaticCapsAdapt_InitCaps() -{ - XAresult res = XA_RESULT_SUCCESS; - XAuint32 i = 0; - XAuint32 capCount = (sizeof(allCaps)/sizeof(XAStaticCapsData)); - DEBUG_API("->XAStaticCapsAdapt_InitCaps"); - - for( i = 0; i < capCount; i++) - { - res = XAStaticCapsAdapt_GetCapsFromGst(&allCaps[i]); - if (res != XA_RESULT_SUCCESS) - { - DEBUG_API("<-XAStaticCapsAdapt_InitCaps"); - return res; - } - } - - DEBUG_API("<-XAStaticCapsAdapt_InitCaps"); - return res; -} - -/* XAresult XAStaticCapsAdapt_GetCapsCount - * Description: Count capabilities of certain type. Filter is specified by - * bitmasking XACapsType values. - */ -XAresult XAStaticCapsAdapt_GetCapsCount(XACapsType filter, XAuint32 *count) -{ - XAresult res = XA_RESULT_SUCCESS; - XAuint32 capCount = (sizeof(allCaps)/sizeof(XAStaticCapsData)); - DEBUG_API("->XAStaticCapsAdapt_GetCapsCount"); - if(!count) - { - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - XAuint32 i = 0; - (*count)=0; - for( i=0; iXAStaticCapsAdapt_GetCapsById"); - if(!data) - { - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - XAuint32 i = 0; - XAboolean found = XA_BOOLEAN_FALSE; - for( i=0; iXAStaticCapsAdapt_GetCapsByIdx"); - if(!data) - { - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - XAuint32 i = 0,j=0; - XAboolean found = XA_BOOLEAN_FALSE; - for( i=0; iXAStaticCapsAdapt_QueryColorFormats"); - - if( !pIndex ) - { - DEBUG_ERR("illegal NULL parameter"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - XAStaticCapsData temp; - res = XAStaticCapsAdapt_GetCapsById(XACAP_ENCODER|XACAP_IMAGE, XA_IMAGECODEC_RAW, &temp); - if( res == XA_RESULT_SUCCESS ) - { - if( !pColorFormats ) - { /* query number of color formats */ - *pIndex = 1; /* one used by camera context */ - } - else - { /* query color format */ - if( *pIndex >= 1 ) /* one used by camera context */ - { - DEBUG_ERR("index parameter invalid"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { /* internal format used by pipeline, look camera context for details */ - *pColorFormats = XA_COLORFORMAT_YUV420PLANAR; - } - } - } - else - { - *pIndex = 0; - } - } - - DEBUG_API("<-XAStaticCapsAdapt_QueryColorFormats"); - return res; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xastaticcapsadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xastaticcapsadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,111 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XASTATICCAPSADAPTATION_H -#define XASTATICCAPSADAPTATION_H - -#include "XAGlobals.h" -#include "XADebug.h" - -/* Adaptation device IDs */ -//#define XA_ADAPTID_ALSASRC 0xAD7E5001 //Krishna commented -#define XA_ADAPTID_DEVSOUNDSRC 0xAD7E5001 -//#define XA_ADAPTID_ALSASINK 0xAD7E5002 -#define XA_ADAPTID_DEVSOUNDSINK 0xAD7E5002 -#define XA_ADAPTID_AUTOAUDIOSINK 0xAD7E5003 -#define XA_ADAPTID_AUDIOTESTSRC 0xAD7E5004 -#define XA_ADAPTID_AUTOVIDEOSINK 0xAD7E5005 -#define XA_ADAPTID_VIDEOTESTSRC 0xAD7E5006 -#define XA_ADAPTID_V4L2SRC 0xAD7E5007 -#define XA_ADAPTID_JACKSINK 0xAD7E5008 -#define XA_ADAPTID_MOTIONJPEG 0xAD7E5009 -#define XA_ADAPTID_THEORA 0xAD7E500A -#define XA_ADAPTID_VORBIS 0xAD7E500B - -#define XA_ADAPTID_VIBRA 0xAD7E500C -#define XA_ADAPTID_LEDARRAY 0xAD7E500D - -#define XA_ADAPTID_RAWVIDEO 0xAD7E500E - -//#define XA_ADAPT_DEFAULTAUDIOOUTPUT XA_ADAPTID_ALSASINK -#define XA_ADAPT_DEFAULTAUDIOOUTPUT XA_ADAPTID_DEVSOUNDSINK - -#ifdef XA_USE_TEST_PLUGINS -#define XA_ADAPT_DEFAULTAUDIOINPUT XA_ADAPTID_AUDIOTESTSRC -#else -//#define XA_ADAPT_DEFAULTAUDIOINPUT XA_ADAPTID_ALSASRC //Krishna commented -#define XA_ADAPT_DEFAULTAUDIOINPUT XA_ADAPTID_DEVSOUNDSRC -#endif - - -#define XA_ADAPT_OGGPROFILE_UNKNOWN 0x1 - -#define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_8 0x1 -#define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_16 0x2 -#define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_20 0x4 -#define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_24 0x8 -#define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_28 0x10 -#define XA_ADAPT_PCMSAMPLEFORMAT_SUPPORTED_32 0x20 - -#define XA_ADAPT_MAX_BITRATE_COUNT 10 - -typedef enum -{ - XACAP_DECODER = 0x1, - XACAP_ENCODER = 0x2, - XACAP_DEVSNK = 0x4, - XACAP_DEVSRC = 0x8, - - XACAP_AUDIO = 0x10, - XACAP_VIDEO = 0x20, - XACAP_IMAGE = 0x40 -}XACapsType; - -/* Structure to hold commonly used capabilities of codec/device. - */ -typedef struct XAStaticCapsData_ -{ - XAuint32 captype; - XAuint32 xaid; /* OpenMAX id (e.g. XA_VIDEOCODEC macro) */ - XAchar* adaptId; /* e.g. plugin name */ - XAuint32 maxCh; /* channels */ - XAuint32 minBPS; /* bits per sample */ - XAuint32 maxBPS; - XAuint32 minSR; /* samplerate */ - XAuint32 maxSR; - XAuint32 minBR; /* bitrate */ - XAuint32 maxBR; - XAuint32 maxFR; /* framerate */ - XAuint32 maxW; /* width */ - XAuint32 maxH; /* height */ - XAuint32 pcmProfilesSupported; - XAuint32 numBitrates; - XAuint32 bitratesSupported[XA_ADAPT_MAX_BITRATE_COUNT]; - - XAuint32 extra; /* some type-specific extra info */ - /*add if/when needed*/ -} XAStaticCapsData; - - -XAresult XAStaticCapsAdapt_GetCapsCount(XACapsType filter, XAuint32 *count); - -XAresult XAStaticCapsAdapt_GetCapsById(XACapsType filter, XAuint32 maxId, XAStaticCapsData* data); - -XAresult XAStaticCapsAdapt_GetCapsByIdx(XACapsType filter, XAuint32 idx, XAStaticCapsData* data); -XAresult XAStaticCapsAdapt_InitCaps(); -XAresult XAStaticCapsAdapt_QueryColorFormats(XAuint32* pIndex, XAuint32* pColorFormats); -#endif /* XASTATICCAPSADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavibraadaptctx.c --- a/khronosfws/openmax_al/src/adaptation/xavibraadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,93 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAVibraAdaptCtx.h" -#include "XAAdaptation.h" - -/* - * XAAdaptationBaseCtx* XAVibraAdapt_Create() - * Allocates memory for Vibra Adaptation Context and makes 1st phase initialization - * @returns XAVibraAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XAVibraAdapt_Create(XAuint32 deviceID) -{ - XAVibraAdaptationCtx *pSelf = calloc(1, sizeof(XAVibraAdaptationCtx)); - DEBUG_API("->XAVibraAdapt_Create"); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj),XAVibraAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - } - - DEBUG_API("<-XAVibraAdapt_Create"); - return (XAAdaptationBaseCtx*)pSelf; -} - -/* - * XAresult XAVibraAdapt_PostInit() - * 2nd phase initialization of Vibra Adaptation Context - */ -XAresult XAVibraAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraAdaptationCtx* ctx = NULL; - - DEBUG_API("->XAVibraAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAVibraAdaptationCtx*)bCtx; - - XAAdaptationBase_PostInit( &(ctx->baseObj) ); - - DEBUG_API("<-XAVibraAdapt_PostInit"); - return ret; -} - -/* - * void XAVibraAdapt_Destroy(XAVibraAdaptationCtx* ctx) - * Destroys Vibra Adaptation Context - * @param ctx - Vibra Adaptation context to be destroyed - */ -void XAVibraAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XAVibraAdaptationCtx* ctx = NULL; - DEBUG_API("->XAVibraAdapt_Destroy"); - - if(bCtx == NULL || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraAdapt_Destroy"); - return; - } - ctx = (XAVibraAdaptationCtx*)bCtx; - XAAdaptationBase_Free(&(ctx->baseObj)); - - free(ctx); - ctx = NULL; - - DEBUG_API("<-XAVibraAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavibraadaptctx.h --- a/khronosfws/openmax_al/src/adaptation/xavibraadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIBRAADAPTCTX_H -#define XAVIBRAADAPTCTX_H - -#include "XAAdaptationContextBase.h" - -/* TYPEDEFS */ - -typedef struct XAVibraAdaptationCtx_ XAVibraAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAVibraAdapt_Create(XAuint32 deviceID); - -XAresult XAVibraAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XAVibraAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XAVIBRAADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavibraitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xavibraitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "XAVibraAdaptCtx.h" -#include "XAVibraItfAdaptation.h" -#include "XAAdaptation.h" - -/* - * XAresult XAVibraItfAdapt_Vibrate( XAAdaptationBaseCtx *bCtx, XAboolean vibrate ); - */ -XAresult XAVibraItfAdapt_Vibrate( XAAdaptationBaseCtx *bCtx, XAboolean vibrate ) -{ - XAresult ret = XA_RESULT_SUCCESS; - if(vibrate) - { - DEBUG_API("->XAVibraItfAdapt_Vibrate: ON"); - } - else - DEBUG_API("->XAVibraItfAdapt_Vibrate: OFF"); - - - if(!bCtx || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfAdapt_Vibrate"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XAVibraItfAdapt_Vibrate"); - - return ret; -} -/* - * XAresult XAVibraItfAdapt_SetFrequency ( XAAdaptationBaseCtx *bCtx, XAmilliHertz frequency ); - */ -XAresult XAVibraItfAdapt_SetFrequency ( XAAdaptationBaseCtx *bCtx, XAmilliHertz frequency ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API_A1("->XAVibraItfAdapt_SetFrequency %ld", frequency); - - if(!bCtx || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfAdapt_SetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XAVibraItfAdapt_SetFrequency"); - return ret; -} -/* - * XAresult XAVibraItfAdapt_SetIntensity ( XAAdaptationBaseCtx *bCtx, XApermille intensity ); - */ -XAresult XAVibraItfAdapt_SetIntensity ( XAAdaptationBaseCtx *bCtx, XApermille intensity ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API_A1("->XAVibraItfAdapt_SetIntensity %d", intensity); - - if(!bCtx || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfAdapt_SetIntensity"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XAVibraItfAdapt_SetIntensity"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavibraitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xavibraitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVibraItfADAPTATION_H_ -#define XAVibraItfADAPTATION_H_ - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" - -/* FUNCTIONS */ -XAresult XAVibraItfAdapt_Vibrate( XAAdaptationBaseCtx *bCtx, XAboolean vibrate ); -XAresult XAVibraItfAdapt_SetFrequency ( XAAdaptationBaseCtx *bCtx, XAmilliHertz frequency ); -XAresult XAVibraItfAdapt_SetIntensity ( XAAdaptationBaseCtx *bCtx, XApermille intensity ); -#endif /* XAVIBRAITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavideoencoderitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xavideoencoderitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "XAMediaRecorderAdaptCtx.h" -#include "XAVideoEncoderItfAdaptation.h" -#include "XAAdaptation.h" -#include "XAStaticCapsAdaptation.h" - -/* - * XAresult XAVideoEncoderITfAdapt_SetVideoSettings( XAAdaptationBaseCtx *bCtx, - * XAVideoSettings *pSettings ) - * @param XAAdaptationBaseCtx *ctx - pointer to Media Recorer adaptation context - * @param XAVideoSettings *pSettings - Settings for encoder - * @return XAresult ret - return success value - * Description: Sets preferred encoder settings for pipeline. - */ -XAresult XAVideoEncoderItfAdapt_SetVideoSettings( XAAdaptationBaseCtx *bCtx, - XAVideoSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVideoEncoderAdapt_SetVideoSettings"); - if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoEncoderAdapt_SetVideoSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_VIDEO,pSettings->encoderId); - if(ret==XA_RESULT_SUCCESS) - { - /*change of settings - pipeline must be regenerated**/ - mCtx->encodingchanged = XA_BOOLEAN_TRUE; - memcpy(&mCtx->videoEncSettings, pSettings, sizeof(XAVideoSettings)); - } - DEBUG_API("<-XAVideoEncoderAdapt_SetVideoSettings"); - return ret; -} - -/* - * XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationBaseCtx *bCtx, XAVideoSettings *pSettings ) - */ -XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationBaseCtx *bCtx, - XAVideoSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVideoEncoderItfAdapt_GetVideoSettings"); - - if( !bCtx || (bCtx->ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoEncoderItfAdapt_GetVideoSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - memcpy(pSettings, &(mCtx->videoEncSettings), sizeof(XAVideoSettings)); - DEBUG_API("<-XAVideoEncoderItfAdapt_GetVideoSettings"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavideoencoderitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xavideoencoderitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOENCODERITFADAPTATION_H -#define XAVIDEOENCODERITFADAPTATION_H - -#include "XAAdaptationContextBase.h" - - -/* FUNCTIONS */ -XAresult XAVideoEncoderItfAdapt_SetVideoSettings(XAAdaptationBaseCtx *bCtx, - XAVideoSettings *pSettings ); -XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationBaseCtx *bCtx, - XAVideoSettings *pSettings ); -#endif /* XAVIDEOENCODERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavideopostprosessingitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xavideopostprosessingitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,916 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAMediaRecorderAdaptCtx.h" -#include "XACameraAdaptCtx.h" -#include "XAVideoPostProsessingItfAdaptation.h" -#include "XAStaticCameraCapsAdaptation.h" - -/* - * XAresult XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported(XAAdaptationBaseCtx *bCtx, - * XAboolean *pSupported) - */ -XAresult XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported(XAAdaptationBaseCtx *bCtx, - XAboolean *pSupported) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported"); - - if(!bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation) || !pSupported) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* This feature is not supported, return boolean false */ - *pSupported = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported"); - return ret; -} - -/* - * XAresult XAVideoPostProcessingItfAdapt_Commit(XAAdaptationBaseCtx *bCtx) - */ -XAresult XAVideoPostProcessingItfAdapt_Commit(XAAdaptationBaseCtx *bCtx, - XAmillidegree rotation, - XAuint32 scaleOptions, - XAuint32 backgroundColor, - XAuint32 renderingHints, - const XARectangle *pSrcRect, - const XARectangle *pDestRect, - XAuint32 mirror, - XAboolean isMirror, - XAboolean isRotate, - XAboolean isDestRect, - XAboolean isSrcRect, - XAboolean isScaleOptions - ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAmillidegree tempRotation = 0; - XAmillidegree newRotation = 0; - XAuint32 tempMirror = XA_VIDEOMIRROR_NONE; - XAuint32 newMirror = XA_VIDEOMIRROR_NONE; - XADataSource *dataSrc = NULL; - GstElement *cropElement = NULL; - GstElement *rotateElement = NULL; - GstElement *mirrorElement = NULL; - GstElement *boxElement = NULL; - GstElement *balanceElement = NULL; - GstElement *gammaElement = NULL; - GstElement *sink = NULL; - GstElement *col1 = NULL; - GstElement *scale = NULL; - gdouble alphaValue = 1; - gint videoBackgroundColor = 0, - cropscaleRight = 0, cropscaleBottom = 0, - cropscaleLeft = 0, - cropscaleTop = 0, - videoscaleHeight = 0; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - - DEBUG_API("->XAVideoPostProcessingItfAdapt_Commit"); - - if( !bCtx || (bCtx->ctxId != XAMediaPlayerAdaptation && bCtx->ctxId != XAMediaRecorderAdaptation - && bCtx->ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - - /* Get video pp elements */ - GstPad *pad = NULL; - GstCaps *caps = NULL; - col1 = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_colsp1"); - cropElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_crop"); - rotateElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_rotate"); - mirrorElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_mirror"); - boxElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_box"); - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); - sink = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videosink"); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - - /* get current mirror state and rotate value */ - tempMirror = ctx->curMirror; - tempRotation = ctx->curRotation; - dataSrc = ctx->xaSource; - } - - if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - /* Get video pp elements */ - GstPad *pad = NULL; - GstCaps *caps = NULL; - scale = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_scale2"); - col1 = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_colsp1"); - cropElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_crop"); - rotateElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_rotate"); - mirrorElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_mirror"); - boxElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_box"); - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); - sink = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "datasink"); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - - /* get current mirror state and rotate value */ - tempMirror = ctx->curMirror; - tempRotation = ctx->curRotation; - } - - if( bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera pp elements */ - GstPad *pad = NULL; - GstCaps *caps = NULL; - rotateElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_rotate"); - col1 = gst_bin_get_by_name( GST_BIN(videoPP), "pp_colsp1"); - cropElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_crop"); - mirrorElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_mirror"); - boxElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_box"); - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - gammaElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_gamma"); - sink = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_crop"); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - - /* get current mirror state and rotate value */ - tempMirror = ctx->curMirror; - tempRotation = ctx->curRotation; - } - } - - /* Cropping */ - if( isSrcRect && pSrcRect && cropElement && col1 ) - { - - gint cropRight = 0; - gint cropBottom = 0; - gint cropLeft = 0; - gint cropTop = 0; - GstPad *videoPad = NULL; - gint videoWidth = 0; - gint videoHeight = 0; - DEBUG_INFO("Start cropping!"); - - DEBUG_INFO_A1("pSrcRect->left:%d",(int)pSrcRect->left); - DEBUG_INFO_A1("pSrcRect->top:%d",(int)pSrcRect->top); - DEBUG_INFO_A1("pSrcRect->width:%d",(int)pSrcRect->width); - DEBUG_INFO_A1("pSrcRect->height:%d", (int)pSrcRect->height); - - if( bCtx->ctxId == XACameraAdaptation ) - { - GstCaps *caps = NULL; - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - gint capsCount = 0; - gint iterator = 0; - GstStructure *capsStruct = NULL; - - g_object_get( G_OBJECT(ctx->baseObj.bin), "filter-caps", &caps, NULL ); - - if( !caps ) - { - DEBUG_ERR("Cannot receive caps (filter-caps) from camerabin!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - capsCount = gst_caps_get_size( caps ); - - for( iterator= 0; iterator < capsCount; iterator++ ) - { - capsStruct = gst_caps_get_structure( caps, iterator ); - if( capsStruct ) - { - if( !gst_structure_get_int( capsStruct, "width", &videoWidth ) ) - { - DEBUG_ERR("Could not get width from filter-caps"); - videoWidth = TEST_VIDEO_WIDTH; - } - if( !gst_structure_get_int( capsStruct, "height", &videoHeight) ) - { - DEBUG_ERR("Could not get height from filter-caps"); - videoHeight = TEST_VIDEO_HEIGHT; - } - DEBUG_INFO_A2("videoWidth:%d, videoHeight:%d",videoWidth,videoHeight); - } - } - } - else - { - GstCaps* negcapas=NULL; - videoPad = gst_element_get_pad( col1, "src" ); - negcapas = gst_pad_get_negotiated_caps( GST_PAD(videoPad) ); - if ( negcapas ) - { - if( !gst_video_get_size( videoPad, &videoWidth, &videoHeight ) ) - { - DEBUG_ERR("WARN: Cannot receive video size, using defaults"); - videoWidth = TEST_VIDEO_WIDTH; - videoHeight = TEST_VIDEO_HEIGHT; - } - } - else - { - videoWidth = TEST_VIDEO_WIDTH; - videoHeight = TEST_VIDEO_HEIGHT; - } - } - - DEBUG_INFO_A2("Received video frame info, videoWidth:%d, videoHeight:%d",videoWidth,videoHeight); - cropLeft = (gint)pSrcRect->left; - cropTop = (gint)pSrcRect->top; - cropRight = videoWidth - ((gint)pSrcRect->left + (gint)pSrcRect->width); - cropBottom = videoHeight - ((gint)pSrcRect->top + (gint)pSrcRect->height); - DEBUG_INFO_A4("Crop values - cropLeft:%d ,cropTop:%d,cropRight:%d,cropBottom:%d", cropLeft,cropTop,cropRight,cropBottom); - - if( cropBottom >= 0 && cropLeft >=0 && cropRight >= 0 && cropTop >= 0 ) - { - g_object_set(G_OBJECT(cropElement), "bottom",cropBottom, NULL); - g_object_set(G_OBJECT(cropElement), "left", cropLeft, NULL); - g_object_set(G_OBJECT(cropElement), "right", cropRight, NULL); - g_object_set(G_OBJECT(cropElement), "top", cropTop, NULL); - } - else - { - if( cropLeft > videoWidth || cropLeft < 0 || - cropRight > videoWidth || cropRight < 0 || - cropBottom > videoHeight || cropBottom < 0 || - cropTop > videoHeight || cropTop < 0) - { - DEBUG_INFO("Cropped params out of original frame."); - } - } - } - - if(rotateElement && isRotate) - { - DEBUG_INFO("Start rotating!"); - - /* calculate rotation */ - newRotation = tempRotation + rotation; - - if( newRotation > ROTATION_RATIO || newRotation < ROTATION_RATIO_NEG ) - { - newRotation = newRotation % ROTATION_RATIO; - } - - /* Set rotation */ - switch(newRotation) - { - case 0: - { - /* no rotation */ - DEBUG_INFO("Set rotation FLIP_NONE"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_NONE, NULL); - break; - } - case 90000: - case -270000: - { - /* rotation 90 degree */ - DEBUG_INFO("Set rotation 90 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_CLOCKWISE, NULL); - break; - } - case 180000: - case -180000: - { - /* rotation 180 degree */ - DEBUG_INFO("Set rotation 180 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_ROTATE_180, NULL); - break; - } - case 270000: - case -90000: - { - /* rotation 270 degree */ - DEBUG_INFO("Set rotation 270 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_COUNTERCLOCKWISE, NULL); - break; - } - case 360000: - case -360000: - { - /* rotation 360 degree */ - DEBUG_INFO("Set rotation 360 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_NONE, NULL); - break; - } - default: - { - /* no rotation */ - DEBUG_INFO("Set rotation default (FLIP_NONE) degree"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_NONE, NULL); - break; - } - } - - /* Store current rotate value */ - if( bCtx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - ctx->curRotation = newRotation; - } - if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - ctx->curRotation = newRotation; - } - if( bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - ctx->curRotation = newRotation; - } - } - - if(mirrorElement && isMirror) - { - /* solve new mirror state */ - switch(mirror) - { - case XA_VIDEOMIRROR_NONE: - { - newMirror = tempMirror; - break; - } - case XA_VIDEOMIRROR_VERTICAL: - { - if( tempMirror == XA_VIDEOMIRROR_VERTICAL ) - { - newMirror = XA_VIDEOMIRROR_NONE; - } - else if( tempMirror == XA_VIDEOMIRROR_HORIZONTAL ) - { - newMirror = XA_VIDEOMIRROR_BOTH; - } - else if( tempMirror == XA_VIDEOMIRROR_BOTH ) - { - newMirror = XA_VIDEOMIRROR_HORIZONTAL; - } - else - { - newMirror = XA_VIDEOMIRROR_VERTICAL; - } - break; - } - case XA_VIDEOMIRROR_HORIZONTAL: - { - if( tempMirror == XA_VIDEOMIRROR_VERTICAL ) - { - newMirror = XA_VIDEOMIRROR_BOTH; - } - else if( tempMirror == XA_VIDEOMIRROR_HORIZONTAL ) - { - newMirror = XA_VIDEOMIRROR_NONE; - } - else if( tempMirror == XA_VIDEOMIRROR_BOTH ) - { - newMirror = XA_VIDEOMIRROR_VERTICAL; - } - else - { - newMirror = XA_VIDEOMIRROR_HORIZONTAL; - } - break; - } - case XA_VIDEOMIRROR_BOTH: - { - if( tempMirror == XA_VIDEOMIRROR_VERTICAL ) - { - newMirror = XA_VIDEOMIRROR_HORIZONTAL; - } - else if( tempMirror == XA_VIDEOMIRROR_HORIZONTAL ) - { - newMirror = XA_VIDEOMIRROR_VERTICAL; - } - else if( tempMirror == XA_VIDEOMIRROR_BOTH ) - { - newMirror = XA_VIDEOMIRROR_NONE; - } - else - { - newMirror = XA_VIDEOMIRROR_BOTH; - } - break; - } - default: - break; - } - - - DEBUG_INFO("Start mirroring!"); - /* Set mirror */ - switch(newMirror) - { - case XA_VIDEOMIRROR_NONE: - { - /* none */ - DEBUG_INFO("Set mirror none"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_NONE, NULL); - break; - } - case XA_VIDEOMIRROR_VERTICAL: - { - /* vertical mirror */ - DEBUG_INFO("Set mirror vertical"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_VERTICAL, NULL); - break; - } - case XA_VIDEOMIRROR_HORIZONTAL: - { - /* horizontal mirror */ - DEBUG_INFO("Set mirror horizontal"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_HORIZONTAL, NULL); - break; - } - case XA_VIDEOMIRROR_BOTH: - { - /* both mirror */ - DEBUG_INFO("Set mirror vertical and horizontal"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_ROTATE_180, NULL); - break; - } - default: - { - /* Default no mirroring */ - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_NONE, NULL); - break; - } - } - - /* Store current mirror state */ - if( bCtx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - ctx->curMirror = newMirror; - } - if( bCtx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - ctx->curMirror = newMirror; - } - if( bCtx->ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - ctx->curMirror = newMirror; - } - } - - /* Set scale */ - if ( isScaleOptions || isDestRect || isSrcRect ) - { - switch( scaleOptions ) - { - - case XA_VIDEOSCALE_STRETCH: - { - DEBUG_INFO("XA_VIDEOSCALE_STRETCH"); - /* The source and destination rectangle's width and height params are used to calculate - * the scaling factors independently. Aspect ratio is ignored. */ - if (pDestRect) - { - if (bCtx->ctxId != XAMediaRecorderAdaptation) - { - GstPad *pad = NULL; - GstCaps* simplecaps = NULL; - g_object_set ( G_OBJECT(sink), "force-aspect-ratio", FALSE, NULL); - simplecaps = gst_caps_new_simple("video/x-raw-rgb", - "width", G_TYPE_INT, pDestRect->width, - "height", G_TYPE_INT, pDestRect->height, - "framerate", GST_TYPE_FRACTION, 0,1, - NULL); - DEBUG_API_A1("caps: %s",gst_caps_to_string(simplecaps)); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - if (!gst_pad_set_caps(pad, simplecaps)) - { - DEBUG_INFO("Stubbed at this point"); - DEBUG_INFO("Cannot set destrect size during XA_VIDEOSCALE_STRETCH!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_VIDEOSCALE_STRETCH"); - return XA_RESULT_SUCCESS; - } - DEBUG_API_A1("ret: %lu",ret); - } - else - { - GstCaps* simplecaps = NULL; - GstPad *pad = NULL; - if ( !scale ) - { - DEBUG_ERR("Could not get scaling element from pipeline!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - simplecaps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, pDestRect->width, - "height", G_TYPE_INT, pDestRect->height, - "framerate", GST_TYPE_FRACTION, 0,1, - NULL); - DEBUG_API_A1("caps: %s",gst_caps_to_string(simplecaps)); - pad = gst_element_get_static_pad(GST_ELEMENT(scale),"src"); - if (!gst_pad_set_caps(pad, simplecaps)) - { - DEBUG_INFO("Stubbed at this point"); - DEBUG_INFO("Cannot set destrect size during XA_VIDEOSCALE_STRETCH!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_VIDEOSCALE_STRETCH"); - return XA_RESULT_SUCCESS; - } - - } - } - DEBUG_INFO("XA_VIDEOSCALE_STRETCH Done"); - - break; - } - case XA_VIDEOSCALE_FIT: - { - DEBUG_INFO("XA_VIDEOSCALE_FIT"); - /* The miminum scale factor between the destination rectangle's width over the - * source rectangle's source rectangle's width and the destination rectangle's height over - * the source rectangle's height is used. Aspect ratio is maintained. Frame is centered */ - if (pDestRect) - { - if (bCtx->ctxId != XAMediaRecorderAdaptation) - { - GstPad *pad = NULL; - GstCaps* simplecaps = NULL; - g_object_set ( G_OBJECT(sink), "force-aspect-ratio", TRUE, NULL); - simplecaps = gst_caps_new_simple("video/x-raw-rgb", - "width", G_TYPE_INT, pDestRect->width, - "height", G_TYPE_INT, pDestRect->height, - "framerate", GST_TYPE_FRACTION, 0,1, - NULL); - DEBUG_API_A1("caps: %s",gst_caps_to_string(simplecaps)); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - if (!gst_pad_set_caps(pad, simplecaps)) - { - DEBUG_INFO("Stubbed at this point"); - DEBUG_INFO("Cannot set destrect size during XA_VIDEOSCALE_FIT!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_VIDEOSCALE_FIT"); - return XA_RESULT_SUCCESS; - } - } - else - { - GstPad *videoScalePad = NULL; - GstCaps *negcaps = NULL; - gint videoScalePadHeight = 0, videoScalePadWidth = 0; - gfloat scaleFactorWidth = 0; - gfloat scaleFactorHeight = 0; - gfloat scaleFactor = 0; - videoScalePad = gst_element_get_pad( col1, "src" ); - negcaps = gst_pad_get_negotiated_caps( GST_PAD(videoScalePad) ); - if ( negcaps ) - { - if( !gst_video_get_size( videoScalePad, &videoScalePadWidth, &videoScalePadHeight ) ) - { - DEBUG_ERR("Cannot receive current cropscalevideo size!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("No negotiated caps in col1:src!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return XA_RESULT_SUCCESS; - } - if (pSrcRect->width != 0 && pSrcRect->height != 0) - { - scaleFactorWidth = (gfloat)videoScalePadWidth / (gfloat)pSrcRect->width; - scaleFactorHeight = (gfloat)videoScalePadHeight / (gfloat)pSrcRect->height; - if (scaleFactorWidth < scaleFactorHeight) - { - scaleFactor = scaleFactorWidth; - } - else - { - scaleFactor = scaleFactorHeight; - } - - cropscaleBottom = (gint)(pSrcRect->height*scaleFactor - videoScalePadHeight)/2; - cropscaleLeft = (gint)(pSrcRect->width*scaleFactor - videoScalePadWidth)/2; - if (cropscaleLeft > 0){ - cropscaleLeft *= -1; - } - cropscaleRight = cropscaleLeft; - if (cropscaleBottom > 0){ - cropscaleBottom *= -1; - } - cropscaleTop = cropscaleBottom; - g_object_set (G_OBJECT (boxElement), "bottom", cropscaleBottom , NULL); - g_object_set (G_OBJECT (boxElement), "right", cropscaleRight, NULL); - g_object_set (G_OBJECT (boxElement), "left", cropscaleLeft, NULL); - g_object_set (G_OBJECT (boxElement), "top", cropscaleTop, NULL); - } - } - } - DEBUG_INFO("XA_VIDEOSCALE_FIT done"); - - break; - } - case XA_VIDEOSCALE_CROP: - { - DEBUG_INFO("XA_VIDEOSCALE_CROP"); - /* The maximum scale factor between the destination rectangle's width over the source - * rectangle's width and destination rectangle's height over the source rectangle's - * height is used. Aspect ratio is maintained. Frame is centered. */ - if( pDestRect && pSrcRect ) - { - GstPad *videoScalePad = NULL; - GstCaps *negcaps = NULL; - gint videoScalePadHeight = 0, videoScalePadWidth = 0; - videoScalePad = gst_element_get_pad( col1, "src" ); - negcaps = gst_pad_get_negotiated_caps( GST_PAD(videoScalePad) ); - if ( negcaps ) - { - if( !gst_video_get_size( videoScalePad, &videoScalePadWidth, &videoScalePadHeight ) ) - { - DEBUG_ERR("Cannot receive current cropscalevideo size!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("No negotiated caps in col1:src!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return XA_RESULT_SUCCESS; - } - - DEBUG_INFO_A2( "Received video scale frame info, videoScalePadWidth:%d, " - "videoScalePadHeight:%d",videoScalePadWidth,videoScalePadHeight); - - if( pSrcRect->height > 0 && pSrcRect->width > 0 ) - { - if( pSrcRect->height > pDestRect->height ) - { - videoscaleHeight = pSrcRect->height; - if( pDestRect->top == 0) - { - cropscaleTop = ((videoscaleHeight - pDestRect->height)/2); - cropscaleBottom = ((videoscaleHeight - pDestRect->height)/2); - } - else - { - cropscaleTop = (pDestRect->top/2); - cropscaleBottom = (pDestRect->top/2); - } - } - else if( pDestRect->height > pSrcRect->height ) - { - videoscaleHeight = pDestRect->height; - if( pDestRect->top == 0) - { - cropscaleTop = -((videoscaleHeight - pSrcRect->height)/2); - cropscaleBottom = -((videoscaleHeight - pSrcRect->height)/2); - } - else - { - cropscaleTop = -(pDestRect->top/2); - cropscaleBottom = -(pDestRect->top/2); - } - } - else if( pDestRect->height == pSrcRect->height ) - { - } - else - { - } - if( pSrcRect->width > pDestRect->width ) - { - if( pDestRect->left == 0 ) - { - cropscaleLeft = ((gint)(pSrcRect->width -pDestRect->width)/2); - cropscaleRight = ((gint)(pSrcRect->width -pDestRect->width)/2); - } - else - { - cropscaleLeft = (pDestRect->left/2); - cropscaleRight = (pDestRect->left/2); - } - } - else if( pDestRect->width > pSrcRect->width ) - { - if( pDestRect->left == 0 ) - { - cropscaleLeft =-((gint)(pDestRect->width -pSrcRect->width)/2); - cropscaleRight =-((gint)(pDestRect->width -pSrcRect->width)/2); - } - else - { - cropscaleLeft = -(pDestRect->left/2); - cropscaleRight = -(pDestRect->left/2); - } - } - else if( pDestRect->width == pSrcRect->width ) - { - } - else - { - } - } - else - { - DEBUG_ERR("Invalid rectangle values in source rectangles"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit, Exit with invalid source rectangle values"); - return XA_RESULT_PARAMETER_INVALID; - } - if( pDestRect->width != pSrcRect->width && pDestRect->height != pSrcRect->height ) - { - DEBUG_INFO_A4("Crop values - cropscaleLeft:%d " - ",cropscaleTop:%d," - "cropscaleRight:%d," - "cropscaleBottom:%d", - cropscaleLeft, - cropscaleTop, - cropscaleRight, - cropscaleBottom); - g_object_set (G_OBJECT (boxElement), "bottom",cropscaleBottom , NULL); - g_object_set (G_OBJECT (boxElement), "right", cropscaleRight, NULL); - g_object_set (G_OBJECT (boxElement), "left", cropscaleLeft, NULL); - g_object_set (G_OBJECT (boxElement), "top",cropscaleTop, NULL); - } - } - break; - } - default: - DEBUG_INFO("no scale options!"); - break; - } - } - - if(pDestRect && boxElement) - { - /* is background color black */ - if((backgroundColor >> 8) & BLACK_BG_COLOR_MASK) - { - videoBackgroundColor = 0; - } - /* is background color green */ - else if((backgroundColor >> 8) & GREEN_BG_COLOR_MASK) - { - videoBackgroundColor = 1; - } - /* is background color blue */ - else if((backgroundColor >> 8) & BLUE_BG_COLOR_MASK) - { - videoBackgroundColor = 2; - } - else - { - /* by default black */ - videoBackgroundColor = 0; - } - - /* check alpha value. Gst support values 0 to 1 and XA 0 to 255 */ - { - XAuint32 tempColor = 0; - tempColor = backgroundColor & ALPHA_VALUE_MASK; - - alphaValue = (gdouble)(tempColor/ALPHA_VALUE_MASK); - } - } - - if( dataSrc ) - { - XAMediaType mediaType = XA_MEDIATYPE_UNKNOWN; - ret = XACommon_CheckDataSource(dataSrc, &mediaType); - if( ret == XA_RESULT_SUCCESS && mediaType == XA_MEDIATYPE_IMAGE ) - { - gstOrigState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", GST_STATE_READY); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - gstTmpState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", gstOrigState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - } - } - - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return ret; -} -/* - * XAresult XAVideoPostProcessingItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adapCtx) - * Description: Safety thread entry - */ -XAresult XAVideoPostProcessingItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAVideoPostProcessingItfAdapt_ThreadEntry"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XACameraAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_ThreadEntry"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XACameraAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - } - - DEBUG_API("<-XAVideoPostProcessingItfAdapt_ThreadEntry"); - return XA_RESULT_SUCCESS; -} -/* - * XAresult XAVideoPostProcessingItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) - * Description: Safety thread exit - */ -XAresult XAVideoPostProcessingItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAVideoPostProcessingItfAdapt_ThreadExit"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XACameraAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_ThreadExit"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XACameraAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - } - - DEBUG_API("<-XAVideoPostProcessingItfAdapt_ThreadExit"); - return XA_RESULT_SUCCESS; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavideopostprosessingitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xavideopostprosessingitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,56 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOPOSTPROSESSINGITFADAPTATION_H -#define XAVIDEOPOSTPROSESSINGITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" -#include "XAThreadSafety.h" -/* MACROS */ -#define BLACK_BG_COLOR_MASK 0x00FFFFFF -#define GREEN_BG_COLOR_MASK 0x0000FF00 -#define BLUE_BG_COLOR_MASK 0x000000FF -#define ALPHA_VALUE_MASK 0x000000FF - -#define TEST_VIDEO_WIDTH 640 -#define TEST_VIDEO_HEIGHT 480 - -#define ROTATION_RATIO 360000 -#define ROTATION_RATIO_NEG -360000 - -/* FUNCTIONS */ -XAresult XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported(XAAdaptationBaseCtx *bCtx, - XAboolean *pSupported); - -XAresult XAVideoPostProcessingItfAdapt_Commit(XAAdaptationBaseCtx *bCtx, - XAmillidegree rotation, - XAuint32 scaleOptions, - XAuint32 backgroundColor, - XAuint32 renderingHints, - const XARectangle *pSrcRect, - const XARectangle *pDestRect, - XAuint32 mirror, - XAboolean isMirror, - XAboolean isRotate, - XAboolean isDestRect, - XAboolean isSrcRect, - XAboolean isScaleOptions - ); -XAresult XAVideoPostProcessingItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx); -XAresult XAVideoPostProcessingItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx); -#endif /* XAVIDEOPOSTPROSESSINGITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavolumeitfadaptation.c --- a/khronosfws/openmax_al/src/adaptation/xavolumeitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,566 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "XAAdaptation.h" -#include "XAVolumeItfAdaptation.h" -#include "XAMediaPlayerAdaptCtx.h" -#include "XAStaticCapsAdaptation.h" -#include "XAOutputMixAdaptCtx.h" -#include "XAMediaRecorderAdaptCtx.h" - -/* - * XAresult XAVolumeItfAdapt_FlushBin(XAAdaptationBaseCtx *ctx) - */ -XAresult XAVolumeItfAdapt_FlushBin(XAAdaptationBaseCtx *ctx) -{ - DEBUG_API("->XAVolumeItfAdapt_FlushBin"); - if(!ctx || ( ctx->ctxId != XAMediaPlayerAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - if (GST_STATE(ctx->bin) != GST_STATE_PLAYING) - { - gint64 position = 0; - GstFormat format = GST_FORMAT_TIME; - - gst_element_query_position( GST_ELEMENT(ctx->bin), &format, &position ) ; - - XAAdaptationBase_PrepareAsyncWait(ctx); - /* in effect seeks to current position and flushing the buffer, due to - * gstreamer implementation actual position might change, if stopped, seek to beginning - */ - if(!gst_element_seek( ctx->bin, ((XAMediaPlayerAdaptationCtx*)ctx)->playrate, GST_FORMAT_TIME, - GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE, - GST_SEEK_TYPE_SET, position, - GST_SEEK_TYPE_NONE, GST_CLOCK_TIME_NONE)) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationBase_StartAsyncWait(ctx); - DEBUG_INFO("Bin flushed."); - ctx->waitingasyncop = XA_BOOLEAN_FALSE; - } - DEBUG_API("<-XAVolumeItfAdapt_FlushBin"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->ctxId, - * XAmillibel level) - * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID - * XAmillibel level - Requested volume level, in between XA_MILLIBEL_MIN and XA_MILLIBEL_MAX - * @return XAresult ret - Success value - */ -XAresult XAVolumeItfAdapt_SetVolumeLevel(XAAdaptationBaseCtx *ctx, XAmillibel level) -{ - GstElement *vol=NULL, *audiopp=NULL; - gdouble gstVolume = 0; - XAmillibel tempVolumeLevel = 0; - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API_A1("->XAVolumeItfAdapt_SetVolumeLevel (level %d)", level); - if(!ctx || ( ctx->ctxId != XAMediaPlayerAdaptation && - ctx->ctxId != XAMediaRecorderAdaptation && - ctx->ctxId != XAOutputMixAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( level <= MIN_SUPPORT_VOLUME_LEVEL ) - { - tempVolumeLevel = MIN_SUPPORT_VOLUME_LEVEL; - } - else if( level >= MAX_SUPPORT_VOLUME_LEVEL ) - { - tempVolumeLevel = MAX_SUPPORT_VOLUME_LEVEL; - } - else - { - tempVolumeLevel = level; - } - gstVolume = ( ( (gdouble)(VOLUME_LEVEL_RATIO + tempVolumeLevel)/ VOLUME_LEVEL_RATIO) ); - - if ( ctx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - DEBUG_INFO_A1("Setting gst level to %f",gstVolume); - g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL ); - - XAVolumeItfAdapt_FlushBin(ctx); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if ( ctx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - DEBUG_INFO_A1("Setting gst level to %f",gstVolume); - g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL ); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if (ctx->ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - guint iterator = 0; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = NULL; - XAAdaptationBaseCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx; - if(!bCtx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - return XA_RESULT_INTERNAL_ERROR; - } - - basebin = GST_BIN(bCtx->bin); - if(!basebin) - { - DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - return XA_RESULT_INTERNAL_ERROR; - } - - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - DEBUG_INFO_A1("Setting gst level to %f",gstVolume); - g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL ); - - XAVolumeItfAdapt_FlushBin(bCtx); - } - else - { - DEBUG_ERR_A1("Could not find gst volume controller for player %u!!", iterator); - } - } - } - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - return res; -} - -/* - * XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(void *ctx, AdaptationContextIDS ctx->ctxId, - XAmillibel *pMaxLevel) - * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter - * @param AdaptationContextIDS ctx->ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type. - * XAmillibel *pMaxLevel - Maximum volume level - * @return XAresult ret - Success value - */ -XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(XAAdaptationBaseCtx *ctx, XAmillibel *pMaxLevel) -{ - DEBUG_API("->XAVolumeItfAdapt_GetMaxVolumeLevel"); - - if(!ctx || ( ctx->ctxId != XAMediaPlayerAdaptation && - ctx->ctxId != XAMediaRecorderAdaptation && - ctx->ctxId != XAOutputMixAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_GetMaxVolumeLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; - - DEBUG_API("<-XAVolumeItfAdapt_GetMaxVolumeLevel"); - - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_SetMute(void *ctx, AdaptationContextIDS ctx->ctxId, XAboolean mute) - * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter - * @param AdaptationContextIDS ctx->ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type. - * @param XAboolean mute - status of mute value - * @return XAresult ret - Success value - */ -XAresult XAVolumeItfAdapt_SetMute(XAAdaptationBaseCtx *ctx, XAboolean mute) -{ - GstElement *vol=NULL, *audiopp=NULL; - gboolean gmute = 0; - - DEBUG_API("->XAVolumeItfAdapt_SetMute"); - if(!ctx || ( ctx->ctxId != XAMediaPlayerAdaptation && - ctx->ctxId != XAMediaRecorderAdaptation && - ctx->ctxId != XAOutputMixAdaptation ) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if ( ctx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - context->mute = mute; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - if ( mute ) - { - gmute = 1; - } - else - { - gmute = 0; - } - g_object_set( G_OBJECT(vol), "mute", gmute, NULL ); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if ( ctx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - context->mute = mute; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - if ( mute ) - { - gmute = 1; - } - else - { - gmute = 0; - } - g_object_set( G_OBJECT(vol), "mute", gmute, NULL ); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if ( ctx->ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - guint iterator = 0; - context->mute = mute; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = NULL; - XAAdaptationBaseCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx; - if(!bCtx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - return XA_RESULT_INTERNAL_ERROR; - } - - basebin = GST_BIN(bCtx->bin); - if(!basebin) - { - DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - return XA_RESULT_INTERNAL_ERROR; - } - - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - if ( mute ) - { - gmute = 1; - } - else - { - gmute = 0; - } - g_object_set( G_OBJECT(vol), "mute", gmute, NULL ); - } - else - { - DEBUG_ERR_A1("Could not find gst volume controller for player %u!!", iterator); - } - } - } - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationBaseCtx *ctx, XAboolean enable) - * @param XAAdaptationBaseCtx *ctx - Adaptation context - * @param XAboolean enable - Enable Stereo Position - * @return XAresult - Success value - */ -XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationBaseCtx *ctx, XAboolean enable) -{ - DEBUG_API("->XAVolumeItfAdapt_EnableStereoPosition"); - - if(!ctx || ( ctx->ctxId != XAMediaPlayerAdaptation && - ctx->ctxId != XAMediaRecorderAdaptation && - ctx->ctxId != XAOutputMixAdaptation ) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_EnableStereoPosition"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if ( ctx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - context->isStereoPosition = enable; - } - else if ( ctx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - context->isStereoPosition = enable; - } - else if ( ctx->ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - context->isStereoPosition = enable; - } - - DEBUG_API("<-XAVolumeItfAdapt_EnableStereoPosition"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationBaseCtx *ctx, XApermille stereoPosition) - * @param XAAdaptationBaseCtx *ctx - Adaptation context - * @param XApermille stereoPosition - Stereo Position to be set - * @return XAresult - Success value - */ -XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationBaseCtx *ctx, - XApermille stereoPosition) -{ - GstElement *audiopp = NULL, *pan = NULL; - gfloat gstPosition = 0.0; - - DEBUG_API("->XAVolumeItfAdapt_SetStereoPosition"); - if(!ctx || ( ctx->ctxId != XAMediaPlayerAdaptation && - ctx->ctxId != XAMediaRecorderAdaptation && - ctx->ctxId != XAOutputMixAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_PARAMETER_INVALID; - } - - gstPosition = ( (gfloat)stereoPosition / STEREO_POSITION_RATIO ); - - if ( ctx->ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp"); - if( !audiopp ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" ); - if( !pan ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL ); - - XAVolumeItfAdapt_FlushBin(ctx); - } - else if ( ctx->ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp"); - if( !audiopp ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" ); - if( !pan ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL ); - } - - else if ( ctx->ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - guint iterator = 0; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = NULL; - XAAdaptationBaseCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx; - if(!bCtx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator); - return XA_RESULT_INTERNAL_ERROR; - } - - basebin = GST_BIN(bCtx->bin); - if(!basebin) - { - DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator); - return XA_RESULT_INTERNAL_ERROR; - } - - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if( !audiopp ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" ); - if( !pan ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL ); - - XAVolumeItfAdapt_FlushBin(bCtx); - } - } - - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adapCtx) - * Description: Safety thread entry - */ -XAresult XAVolumeItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAVolumeItfAdapt_ThreadEntry"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XAOutputMixAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_ThreadEntry"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XAOutputMixAdaptation ) - { - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); - } - - DEBUG_API("<-XAVolumeItfAdapt_ThreadEntry"); - return XA_RESULT_SUCCESS; -} -/* - * XAresult XAVolumeItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) - * Description: Safety thread exit - */ -XAresult XAVolumeItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx) -{ - DEBUG_API("->XAVolumeItfAdapt_ThreadExit"); - if((!adaptCtx ) ||( adaptCtx->ctxId != XAMediaPlayerAdaptation && - adaptCtx->ctxId != XAMediaRecorderAdaptation && - adaptCtx->ctxId != XAOutputMixAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_ThreadExit"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - - } - - if ( adaptCtx->ctxId == XAMediaPlayerAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); - } - else if( adaptCtx->ctxId == XAMediaRecorderAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - } - else if (adaptCtx->ctxId == XAOutputMixAdaptation ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - } - - DEBUG_API("<-XAVolumeItfAdapt_ThreadExit"); - return XA_RESULT_SUCCESS; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adaptation/xavolumeitfadaptation.h --- a/khronosfws/openmax_al/src/adaptation/xavolumeitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVOLUMEITFADAPTATION_H -#define XAVOLUMEITFADAPTATION_H - -#include "XAAdaptationContextBase.h" -#include "XADebug.h" -#include "XAThreadSafety.h" - -/* MACROS */ -#define STEREO_POSITION_RATIO 1000 -#define MAX_SUPPORT_VOLUME_LEVEL 9000 -#define MIN_SUPPORT_VOLUME_LEVEL -1000 -#define VOLUME_LEVEL_RATIO 1000 - -/* FUNCTIONS */ - -XAresult XAVolumeItfAdapt_SetVolumeLevel(XAAdaptationBaseCtx *ctx, - XAmillibel level); - -XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(XAAdaptationBaseCtx *ctx, - XAmillibel *pMaxLevel); - -XAresult XAVolumeItfAdapt_SetMute(XAAdaptationBaseCtx *ctx, XAboolean mute); - -XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationBaseCtx *ctx, - XAboolean enable); - -XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationBaseCtx *ctx, - XApermille stereoPosition); - -XAresult XAVolumeItfAdapt_ThreadEntry(XAAdaptationBaseCtx *adaptCtx); -XAresult XAVolumeItfAdapt_ThreadExit(XAAdaptationBaseCtx *adaptCtx); - -#endif /* XAVOLUMEITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adptcommon/xaadptbasectx.c --- a/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.c Fri Jul 09 16:43:35 2010 -0500 @@ -161,7 +161,8 @@ DEBUG_API("->XAAdaptationBase_ThreadEntry"); if (!adaptCtx) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAAdaptationBase_ThreadEntry"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAAdaptationBase_ThreadEntry"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -169,44 +170,22 @@ switch (adaptCtx->ctxId) { case XAMediaPlayerAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer) - ; + XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaPlayer); break; case XAMediaRecorderAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder) - ; + XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); break; case XARadioAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio) - ; - break; - case XACameraAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera) - ; - break; - case XAOutputMixAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix) - ; - break; - case XAVibraAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSVibra) - ; - break; - case XALedArrayAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray) - ; + XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); break; case XAMDAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMetaDataExtractor) - ; + XA_IMPL_THREAD_SAFETY_ENTRY(XATSMetaDataExtractor); break; case XAEngineAdaptation: - XA_IMPL_THREAD_SAFETY_ENTRY(XATSEngine) - ; + XA_IMPL_THREAD_SAFETY_ENTRY(XATSEngine); break; default: - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID") - ; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ res = XA_RESULT_PARAMETER_INVALID; break; @@ -225,7 +204,8 @@ DEBUG_API("->XAAdaptationBase_ThreadExit"); if (!adaptCtx) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAAdaptationBase_ThreadExit"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAAdaptationBase_ThreadExit"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -233,44 +213,22 @@ switch (adaptCtx->ctxId) { case XAMediaPlayerAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer) - ; + XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); break; case XAMediaRecorderAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder) - ; + XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); break; case XARadioAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio) - ; - break; - case XACameraAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera) - ; - break; - case XAOutputMixAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix) - ; - break; - case XAVibraAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra) - ; - break; - case XALedArrayAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray) - ; + XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); break; case XAMDAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSMetaDataExtractor) - ; + XA_IMPL_THREAD_SAFETY_EXIT(XATSMetaDataExtractor); break; case XAEngineAdaptation: - XA_IMPL_THREAD_SAFETY_EXIT(XATSEngine) - ; + XA_IMPL_THREAD_SAFETY_EXIT(XATSEngine); break; default: - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID") - ; + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); /* invalid parameter */ res = XA_RESULT_PARAMETER_INVALID; break; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h --- a/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xaadptbasectx.h Fri Jul 09 16:43:35 2010 -0500 @@ -63,6 +63,8 @@ #define RADIO_DEFAULT_FREQ_RANGE XA_FREQRANGE_FMEUROAMERICA #define RADIO_DEFAULT_FREQ 88000000 +#define RADIO_DEFAULT_MIN_FREQ 87500000 +#define RADIO_DEFAULT_MAX_FREQ 108000000 /* TYPEDEFS */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.c --- a/khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/adptcommon/xacapabilitiesmgr.c Fri Jul 09 16:43:35 2010 -0500 @@ -99,7 +99,8 @@ if (!(*ppListHead)) { *ppListHead = firstNode; - }DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList"); + } + DEBUG_API("<-XACapabilitiesMgr_UpdateAudioIOCapabilitieList"); return res; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/camera/xacameradevice.c --- a/khronosfws/openmax_al/src/camera/xacameradevice.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,462 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xacameradevice.h" -#include "xacameraitf.h" -#include "xaconfigextensionsitf.h" -#include "xadynintmgmtitf.h" -#include "xaimagecontrolsitf.h" -#include "xaimageeffectsitf.h" -#include "xavideopostprocessingitf.h" -#include "xathreadsafety.h" -#include "xaframeworkmgr.h" -#include "xacameraadaptctx.h" -#include "xacapabilitiesmgr.h" - -/* Static mapping of enumeration XACameraDeviceInterfaces to interface iids */ -static const XAInterfaceID* XACameraDeviceItfIIDs[CAMERA_ITFCOUNT]= -{ - &XA_IID_OBJECT, - &XA_IID_CAMERA, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_IMAGECONTROLS, - &XA_IID_IMAGEEFFECTS, - &XA_IID_VIDEOPOSTPROCESSING -}; - - -/***************************************************************************** - * Global methods - *****************************************************************************/ - -/* XAResult XACameraDeviceImpl_Create - * Description: Create object - */ -XAresult XACameraDeviceImpl_CreateCameraDevice(FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf* pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired) -{ - XACameraDeviceImpl* pImpl = NULL; - XAObjectItfImpl* pBaseObj = NULL; - XAuint8 itfIndex = 0; - - DEBUG_API("->XACameraDeviceImpl_Create"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - - if( !pDevice ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraDeviceImpl_Create"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* instantiate object implementation */ - pImpl = (XACameraDeviceImpl*)calloc(1,sizeof(XACameraDeviceImpl)); - if( !pImpl ) - { - /* memory allocation failed */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XACameraDeviceImpl_Create"); - return XA_RESULT_MEMORY_FAILURE; - } - pBaseObj = &pImpl->baseObj; - - /* Initialize base object default implementation */ - XAObjectItfImpl_Init(pBaseObj, - CAMERA_ITFCOUNT, - XACameraDeviceItfIIDs, - XACameraDeviceImpl_DoRealize, - XACameraDeviceImpl_DoResume, - XACameraDeviceImpl_FreeResources); - - /* Mark interfaces that need to be exposed */ - /* Implicit and mandated interfaces */ - pBaseObj->interfaceMap[CAMERA_CAMERAITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[CAMERA_DIMITF].required = XA_BOOLEAN_TRUE; - - /* Explicit interfaces */ - if( (numInterfaces != 0) && pInterfaceIds && pInterfaceRequired ) - { - /* Check required interfaces */ - for( itfIndex = 0; itfIndex < numInterfaces; itfIndex++ ) - { - /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIndex]); - if( !entry ) - { - if( pInterfaceRequired[itfIndex] ) - { - /* required interface cannot be accommodated - fail creation */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("Required interface not found - abort creation!"); - DEBUG_API("<-XACameraDeviceImpl_Create"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - else - { - DEBUG_INFO("Requested (not required) interface not found - continue creation"); - } - } - else - { - entry->required = XA_BOOLEAN_TRUE; - } - } - } - - /* Mark interfaces that can be handled dynamically */ - /* Mandated dynamic itfs */ - pBaseObj->interfaceMap[CAMERA_IMAGEEFFECTSITF].isDynamic = XA_BOOLEAN_TRUE; - - /* This code is put here to return Feature Not Supported since adaptation is not present*/ - /*************************************************/ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("Required interface not found - abort creation!"); - DEBUG_API("<-XACameraDeviceImpl_Create"); - return XA_RESULT_FEATURE_UNSUPPORTED; - /*************************************************/ - -/* Initialize XACameraDeviceImpl variables - pImpl->deviceID = deviceID; - - pImpl->adaptationCtx = XACameraAdapt_Create(pImpl->deviceID); - - Set ObjectItf to point to newly created object - *pDevice = (XAObjectItf)&(pBaseObj->self); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraDeviceImpl_Create"); - return XA_RESULT_SUCCESS;*/ -} - -/* XAResult XACameraDeviceImpl_QueryNumSupportedInterfaces - * Description: Statically query number of supported interfaces - */ -XAresult XACameraDeviceImpl_QueryNumSupportedInterfaces( XAuint32 *pNumSupportedInterfaces ) -{ - DEBUG_API("->XACameraDeviceImpl_QueryNumSupportedInterfaces"); - if( pNumSupportedInterfaces ) - { - *pNumSupportedInterfaces = CAMERA_ITFCOUNT; - - DEBUG_API_A1("<-XACameraDeviceImpl_QueryNumSupportedInterfaces - %i", (int)(*pNumSupportedInterfaces) ); - return XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraDeviceImpl_QueryNumSupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } -} -/* XAResult XACameraDeviceImpl_QuerySupportedInterfaces - * Description: Statically query supported interfaces - */ -XAresult XACameraDeviceImpl_QuerySupportedInterfaces( XAuint32 index, - XAInterfaceID * pInterfaceId ) -{ - DEBUG_API("->XACameraDeviceImpl_QuerySupportedInterfaces"); - - if( index >= CAMERA_ITFCOUNT || !pInterfaceId ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraDeviceImpl_QuerySupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - *pInterfaceId = *(XACameraDeviceItfIIDs[index]); - - DEBUG_API("<-XACameraDeviceImpl_QuerySupportedInterfaces"); - return XA_RESULT_SUCCESS; - } -} - - -/***************************************************************************** - * base object XAObjectItfImpl methods - *****************************************************************************/ - -/* XAresult XACameraDeviceImpl_DoRealize( XAObjectItf self ) - * Description: Realize all implicit and explicitly wanted interfaces. - * Create and initialize implementation-specific variables. - * Called from base object XAObjectItfImpl - */ -XAresult XACameraDeviceImpl_DoRealize( XAObjectItf self ) -{ - XAuint8 itfIdx = 0; - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XACameraDeviceImpl* pObjImpl = (XACameraDeviceImpl*)(pObj); - XAresult ret = XA_RESULT_SUCCESS; - - - DEBUG_API("->XACameraDeviceImpl_DoRealize"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - - /* check casting from correct pointer type */ - if( !pObjImpl || pObj != pObjImpl->baseObj.self ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraDeviceImpl_DoRealize"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XACameraAdapt_PostInit( pObjImpl->adaptationCtx ); - - if( ret != XA_RESULT_SUCCESS ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR_A1("Camera adapt postinit - %d", ret); - DEBUG_API("<-XACameraDeviceImpl_DoRealize"); - return ret; - } - - /* Realize all implicit and explicitly wanted interfaces */ - for( itfIdx = 0; itfIdx < CAMERA_ITFCOUNT; itfIdx++) - { - if( !(pObj->interfaceMap[itfIdx].pItf) && - pObj->interfaceMap[itfIdx].required ) - { - void *pItf = NULL; - switch( itfIdx ) - { - case CAMERA_DIMITF: - pItf = XADIMItfImpl_Create(); - if(pItf) - { - XADIMItfImpl_Init(pItf, self, - XACameraDeviceImpl_DoAddItf, - XACameraDeviceImpl_DoResumeItf, - XACameraDeviceImpl_DoRemoveItf); - } - break; - - case CAMERA_CAMERAITF: - pItf = XACameraItfImpl_Create( pObjImpl->adaptationCtx ); - break; - case CAMERA_CONFIGEXTENSIONITF: - pItf = XAConfigExtensionsItfImpl_Create(); - break; - case CAMERA_IMAGECONTROLSITF: - pItf = XAImageControlsItfImpl_Create( pObjImpl->adaptationCtx ); - break; - case CAMERA_IMAGEEFFECTSITF: - pItf = XAImageEffectsItfImpl_Create( pObjImpl->adaptationCtx ); - break; - case CAMERA_VIDEOPOSTPROCESSINGITF: - pItf = XAVideoPostProcessingItfImpl_Create( pObjImpl->adaptationCtx ); - break; - - default: - break; - } - if( !pItf ) - { - /* memory allocation failed */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XACameraDeviceImpl_DoRealize"); - return XA_RESULT_MEMORY_FAILURE; - } - else - { - pObj->interfaceMap[itfIdx].pItf = pItf; - } - } - } - - pObj->state = XA_OBJECT_STATE_REALIZED; - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraDeviceImpl_DoRealize"); - return XA_RESULT_SUCCESS; -} - -/* XAresult XACameraDeviceImpl_DoResume - * Description: Resume object from suspended state - */ -XAresult XACameraDeviceImpl_DoResume(XAObjectItf self) -{ - DEBUG_API("->XACameraDeviceImpl_DoResume"); - DEBUG_API("<-XACameraDeviceImpl_DoResume"); - /* This implementation does not support suspended state */ - return XA_RESULT_PRECONDITIONS_VIOLATED; -} - -/* void XACameraDeviceImpl_FreeResources - * Description: Free all resources reserved at XACameraDeviceImpl_DoRealize() - */ -void XACameraDeviceImpl_FreeResources(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAuint8 itfIdx = 0; - XACameraDeviceImpl* pImpl = (XACameraDeviceImpl*)(*self); - assert( pObj && pImpl && pObj == pObj->self ); - DEBUG_API("->XACameraDeviceImpl_FreeResources"); - XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSCamera); - - - - - /* free all allocated interfaces */ - for(itfIdx = 0; itfIdx < CAMERA_ITFCOUNT; itfIdx++) - { - void *pItf = pObj->interfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) - { - case CAMERA_CAMERAITF: - XACameraItfImpl_Free( pItf ); - break; - case CAMERA_CONFIGEXTENSIONITF: - XAConfigExtensionsItfImpl_Free( pItf ); - break; - case CAMERA_DIMITF: - XADIMItfImpl_Free( pItf ); - break; - case CAMERA_IMAGECONTROLSITF: - XAImageControlsItfImpl_Free( pItf ); - break; - case CAMERA_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free( pItf ); - break; - case CAMERA_VIDEOPOSTPROCESSINGITF: - XAVideoPostProcessingItfImpl_Free( pItf ); - break; - default: - break; - } - pObj->interfaceMap[itfIdx].pItf = NULL; - } - } - - if ( pImpl->adaptationCtx != NULL ) - { - XACameraAdapt_Destroy( pImpl->adaptationCtx ); - pImpl->adaptationCtx = NULL; - } - - XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS(XATSCamera); - DEBUG_API("<-XACameraDeviceImpl_FreeResources"); - return; -} - -/***************************************************************************** - * CameraDeviceImpl -specific methods - *****************************************************************************/ - -/* XACameraDeviceImpl_DoAddItf - * Dynamically add an interface, object specific parts - */ -XAresult XACameraDeviceImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XACameraDeviceImpl* pImpl = (XACameraDeviceImpl*)(pObj); - - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XACameraDeviceImpl_DoAddItf"); - if(mapEntry) - { - switch( mapEntry->mapIdx ) - { - case CAMERA_IMAGEEFFECTSITF: - mapEntry->pItf = XAImageEffectsItfImpl_Create( pImpl->adaptationCtx ); - break; - default: - DEBUG_ERR("XACameraDeviceImpl_DoAddItf unknown id"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - - if( !mapEntry->pItf && ret == XA_RESULT_SUCCESS) - { - DEBUG_ERR("XACameraDeviceImpl_DoAddItf itf creation failed"); - ret = XA_RESULT_MEMORY_FAILURE; - } - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - ret = XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XACameraDeviceImpl_DoAddItf"); - return ret; -} - -/* XACameraDeviceImpl_DoResumeItf - * Try to resume lost interface, object specific parts - */ -XAresult XACameraDeviceImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XACameraDeviceImpl_DoResumeItf"); - /* For now, no difference between suspended and unrealised itfs */ - ret = XACameraDeviceImpl_DoAddItf(self,mapEntry); - DEBUG_API("<-XACameraDeviceImpl_DoResumeItf"); - return ret; -} - -/* XACameraDeviceImpl_DoRemoveItf - * Dynamically remove an interface, object specific parts - */ -XAresult XACameraDeviceImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XACameraDeviceImpl_DoRemoveItf"); - if(mapEntry) - { - switch( mapEntry->mapIdx ) - { - case CAMERA_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free( mapEntry->pItf ); - break; - default: - DEBUG_ERR("XACameraDeviceImpl_DoRemoveItf unknown id"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - mapEntry->pItf = NULL; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - ret = XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XACameraDeviceImpl_DoRemoveItf"); - return ret; -} -/* END OF FILE */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/camera/xacameradevice.h --- a/khronosfws/openmax_al/src/camera/xacameradevice.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERADEVICE_H -#define XACAMERADEVICE_H - -#include "openmaxalwrapper.h" -#include "xaobjectitf.h" -#include "xaglobals.h" -#include "xaadptbasectx.h" -/** MACROS **/ - - -/** TYPES **/ - - -/** ENUMERATIONS **/ -/* Enumeration for interfaces that CameraDevice supports. */ -typedef enum -{ - CAMERA_OBJECTITF, - CAMERA_CAMERAITF, - CAMERA_CONFIGEXTENSIONITF, - CAMERA_DIMITF, - CAMERA_IMAGECONTROLSITF, - CAMERA_IMAGEEFFECTSITF, - CAMERA_VIDEOPOSTPROCESSINGITF, - CAMERA_ITFCOUNT -} XACameraDeviceInterfaces; - -/** STRUCTURES **/ -/* Specification for CameraDeviceImpl. */ -typedef struct XACameraDeviceImpl_ -{ - /* Parent for XACameraDeviceImpl */ - XAObjectItfImpl baseObj; - - /* variables */ - XAuint32 deviceID; - - XAAdaptationBaseCtx* adaptationCtx; - -} XACameraDeviceImpl; - - -/** METHODS **/ - -/* base object XAObjectItfImpl methods */ -XAresult XACameraDeviceImpl_DoRealize(XAObjectItf self); -XAresult XACameraDeviceImpl_DoResume(XAObjectItf self); -void XACameraDeviceImpl_FreeResources(XAObjectItf self); - -/* CameraDeviceImpl -specific methods*/ -/* DynamicInterfaceManagement object-specific methods */ -XAresult XACameraDeviceImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XACameraDeviceImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XACameraDeviceImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); - - - -#endif /* XACAMERADEVICE_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/camera/xacameraitf.c --- a/khronosfws/openmax_al/src/camera/xacameraitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1139 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xacameraitf.h" - -#include "xacameraitfadaptation.h" - -#include "xathreadsafety.h" - -/* XACameraItfImpl* GetImpl(XACameraItf self) - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XACameraItfImpl* GetImpl(XACameraItf self) -{ - if( self ) - { - XACameraItfImpl* impl = (XACameraItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/***************************************************************************** - * Base interface XACameraItf implementation - *****************************************************************************/ - -/** - * XAresult XACameraItfImpl_RegisterCallback( XACameraItf self, - * xaCameraCallback callback, - * void *pContext ) - * Description: Sets callback for camera event notification. - **/ -XAresult XACameraItfImpl_RegisterCallback( XACameraItf self, - xaCameraCallback callback, - void *pContext ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_RegisterCallback"); - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_RegisterCallback"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - impl->callback = callback; - impl->context = pContext; - impl->cbPtrToSelf = self; - - DEBUG_API("<-XACameraItfImpl_RegisterCallback"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetFlashMode( XACameraItf self, XAuint32 flashMode ) - * Description: Sets the camera flash setting. - **/ -XAresult XACameraItfImpl_SetFlashMode( XACameraItf self, XAuint32 flashMode ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_SetFlashMode"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - - if( !impl || flashMode > XA_CAMERA_FLASHMODE_TORCH || flashMode < XA_CAMERA_FLASHMODE_OFF ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetFlashMode"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is flash mode changed */ - if( impl->flashMode != flashMode ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetFlashMode( (XAAdaptationGstCtx*)impl->adapCtx, flashMode ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->flashMode = flashMode; - } - /* wait for adaptation */ - impl->flashReady = XA_BOOLEAN_FALSE; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetFlashMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetFlashMode( XACameraItf self, XAuint32 *pFlashMode ) - * Description: Gets the camera flash setting. - **/ -XAresult XACameraItfImpl_GetFlashMode( XACameraItf self, XAuint32 *pFlashMode ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_GetFlashMode"); - if( !impl || !pFlashMode ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetFlashMode"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pFlashMode = impl->flashMode; - - DEBUG_API("<-XACameraItfImpl_GetFlashMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_IsFlashReady( XACameraItf self, XAboolean *pReady ) - * Description: Queries whether the flash is ready for use. - **/ -XAresult XACameraItfImpl_IsFlashReady( XACameraItf self, XAboolean *pReady ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_IsFlashReady"); - if( !impl || !pReady ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_IsFlashReady"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - *pReady = impl->flashReady; - - DEBUG_API("<-XACameraItfImpl_IsFlashReady"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetFocusMode( XACameraItf self, XAuint32 focusMode, - * XAmillimeter manualSetting, - * XAboolean macroEnabled ) - * Description: Sets the camera focus mode. - **/ -XAresult XACameraItfImpl_SetFocusMode( XACameraItf self, XAuint32 focusMode, - XAmillimeter manualSetting, - XAboolean macroEnabled ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_SetFocusMode"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - - if( !impl || focusMode < XA_CAMERA_FOCUSMODE_MANUAL || focusMode > XA_CAMERA_FOCUSMODE_CONTINUOUS_CENTROID ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetFocusMode"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is focus mode changed */ - if( impl->focusMode != focusMode ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetFocusMode( (XAAdaptationGstCtx*)impl->adapCtx, focusMode, manualSetting, macroEnabled ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->focusMode = focusMode; - impl->focusManualSetting = manualSetting; - impl->macroEnabled = macroEnabled; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetFocusMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetFocusMode( XACameraItf self, - * XAuint32 *pFocusMode, - * XAmillimeter *pManualSetting, - * XAboolean *pMacroEnabled ) - * Description: Gets the camera focus mode. - **/ -XAresult XACameraItfImpl_GetFocusMode( XACameraItf self, - XAuint32 *pFocusMode, - XAmillimeter *pManualSetting, - XAboolean *pMacroEnabled ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_GetFocusMode"); - if( !impl || !pFocusMode || !pManualSetting || !pMacroEnabled ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetFocusMode"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pFocusMode = impl->focusMode; - *pMacroEnabled = impl->macroEnabled; - - if( impl->focusMode & XA_CAMERA_FOCUSMODE_MANUAL ) - { - *pManualSetting = impl->focusManualSetting; - } - - DEBUG_API("<-XACameraItfImpl_GetFocusMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetFocusRegionPattern( XACameraItf self, - * XAuint32 focusPattern, - * XAuint32 activePoints1, - * XAuint32 activePoints2 ) - * Description: Set the camera focus region pattern. - **/ -XAresult XACameraItfImpl_SetFocusRegionPattern( XACameraItf self, - XAuint32 focusPattern, - XAuint32 activePoints1, - XAuint32 activePoints2 ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_SetFocusRegionPattern"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - - if( !impl || focusPattern < XA_FOCUSPOINTS_ONE || focusPattern > XA_FOCUSPOINTS_CUSTOM ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetFocusRegionPattern"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is focus pattern changed */ - if( focusPattern == impl->focusPattern ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetFocusRegionPattern( (XAAdaptationGstCtx*)impl->adapCtx, focusPattern, activePoints1, activePoints2 ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if (ret == XA_RESULT_SUCCESS) - { - impl->focusPattern = focusPattern; - if( !(impl->focusMode & XA_CAMERA_FOCUSMODE_MANUAL) ) - { - impl->activePoints1 = activePoints1; - impl->activePoints2 = activePoints2; - } - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetFocusRegionPattern"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetFocusRegionPattern( XACameraItf self, - * XAuint32 *pFocusPattern, - * XAuint32 *pActivePoints1, - * XAuint32 *pActivePoints2 ) - * Description: Gets the camera focus region pattern. - **/ -XAresult XACameraItfImpl_GetFocusRegionPattern( XACameraItf self, - XAuint32 *pFocusPattern, - XAuint32 *pActivePoints1, - XAuint32 *pActivePoints2 ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_GetFocusRegionPattern"); - if( !impl || !pFocusPattern || !pActivePoints1 || !pActivePoints2 ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetFocusRegionPattern"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pFocusPattern = impl->focusPattern; - - if( !(impl->focusMode & XA_CAMERA_FOCUSMODE_MANUAL) && - (impl->focusPattern == XA_FOCUSPOINTS_CUSTOM) ) - { - *pActivePoints1 = impl->activePoints1; - *pActivePoints2 = impl->activePoints2; - } - - DEBUG_API("<-XACameraItfImpl_GetFocusRegionPattern"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetFocusRegionPositions( XACameraItf self, - * XAuint32 *pNumPositionEntries, - * XAFocusPointPosition *pFocusPosition ) - * Description: Get the camera focus region pattern's positioning and size for each - * point in the active focus pattern. - **/ -XAresult XACameraItfImpl_GetFocusRegionPositions( XACameraItf self, - XAuint32 *pNumPositionEntries, - XAFocusPointPosition *pFocusPosition ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_GetFocusRegionPositions"); - if( !impl || !pNumPositionEntries || !pFocusPosition ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetFocusRegionPositions"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_GetFocusRegionPositions( (XAAdaptationGstCtx*)impl->adapCtx, pNumPositionEntries, - pFocusPosition ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - DEBUG_API("<-XACameraItfImpl_GetFocusRegionPositions"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetFocusModeStatus( XACameraItf self, - * XAuint32 *pFocusStatus, - * XAuint32 *pRegionStatus1, - * XAuint32 *pRegionStatus2 ) - * Description: Gets the camera focus status. - **/ -XAresult XACameraItfImpl_GetFocusModeStatus( XACameraItf self, - XAuint32 *pFocusStatus, - XAuint32 *pRegionStatus1, - XAuint32 *pRegionStatus2 ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_GetFocusModeStatus"); - if( !impl || !*pFocusStatus ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetFocusModeStatus"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - *pFocusStatus = impl->focusStatus; - - DEBUG_API("<-XACameraItfImpl_GetFocusModeStatus"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetMeteringMode( XACameraItf self, XAuint32 meteringMode ) - * Description: Sets the camera metering mode for exposure. - **/ -XAresult XACameraItfImpl_SetMeteringMode( XACameraItf self, XAuint32 meteringMode ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraItfImpl_SetMeteringMode"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - - if( !impl || meteringMode < XA_CAMERA_METERINGMODE_AVERAGE || meteringMode >XA_CAMERA_METERINGMODE_MATRIX ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetMeteringMode"); - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetMeteringMode( (XAAdaptationGstCtx*)impl->adapCtx, meteringMode ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->meteringMode = meteringMode; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetMeteringMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetMeteringMode( XACameraItf self, XAuint32 *pMeteringMode ) - * Description: Gets the camera metering mode for exposure. - **/ -XAresult XACameraItfImpl_GetMeteringMode( XACameraItf self, XAuint32 *pMeteringMode ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraItfImpl_GetMeteringMode"); - - if( !impl || !pMeteringMode ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetMeteringMode"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pMeteringMode = impl->meteringMode; - - DEBUG_API("<-XACameraItfImpl_GetMeteringMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetExposureMode( XACameraItf self, XAuint32 exposure, - * XAuint32 compensation ) - * Description: Sets the camera exposure mode. - **/ -XAresult XACameraItfImpl_SetExposureMode( XACameraItf self, XAuint32 exposure, - XAuint32 compensation ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_SetExposureMode"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - impl = GetImpl(self); - if( !impl || exposure < XA_CAMERA_EXPOSUREMODE_MANUAL || exposure > XA_CAMERA_EXPOSUREMODE_NIGHTPORTRAIT ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetExposureMode"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is focus mode changed */ - if( impl->exposureMode != exposure || impl->compensation != compensation ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetExposureMode( (XAAdaptationGstCtx*)impl->adapCtx, exposure, exposure ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->exposureMode = exposure; - impl->compensation = compensation; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetExposureMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetExposureMode( XACameraItf self, XAuint32 *pExposure, - * XAuint32 *pCompensation ) - * Description: Gets the camera exposure mode. - **/ -XAresult XACameraItfImpl_GetExposureMode( XACameraItf self, XAuint32 *pExposure, - XAuint32 *pCompensation ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetExposureMode"); - impl = GetImpl(self); - if( !impl || !pExposure || !pCompensation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetExposureMode"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pExposure = impl->exposureMode; - *pCompensation = impl->compensation; - - DEBUG_API("<-XACameraItfImpl_GetExposureMode"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetISOSensitivity( XACameraItf self, XAuint32 isoSensitivity, - * XAuint32 manualSetting ) - * Description: Sets the camera ISO sensitivity. - **/ -XAresult XACameraItfImpl_SetISOSensitivity( XACameraItf self, XAuint32 isoSensitivity, - XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_SetISOSensitivity"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - impl = GetImpl(self); - if( !impl || isoSensitivityXA_CAMERA_ISOSENSITIVITYMODE_AUTO ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetISOSensitivity"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is focus mode changed */ - if( impl->isoSensitivity != isoSensitivity || impl->isoManualSetting != manualSetting ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetISOSensitivity((XAAdaptationGstCtx*)impl->adapCtx, isoSensitivity, manualSetting ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->isoSensitivity = isoSensitivity; - impl->isoManualSetting = manualSetting; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetISOSensitivity"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetISOSensitivity( XACameraItf self, XAuint32 *pIsoSensitivity, - * XAuint32 *pManualSetting ) - * Description: Gets the camera ISO sensitivity. - **/ -XAresult XACameraItfImpl_GetISOSensitivity( XACameraItf self, XAuint32 *pIsoSensitivity, - XAuint32 *pManualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetISOSensitivity"); - impl = GetImpl(self); - if( !impl || !pIsoSensitivity || !pManualSetting ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetISOSensitivity"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pIsoSensitivity = impl->isoSensitivity; - - if( impl->isoSensitivity == XA_CAMERA_ISOSENSITIVITYMODE_MANUAL ) - { - *pManualSetting = impl->isoManualSetting; - } - if( impl->isoSensitivity == XA_CAMERA_ISOSENSITIVITYMODE_AUTO ) - { - *pManualSetting = 0; - } - - DEBUG_API("<-XACameraItfImpl_GetISOSensitivity"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetAperture( XACameraItf self, XAuint32 aperture, - * XAuint32 manualSetting ) - * Description: Sets the camera aperture. - **/ -XAresult XACameraItfImpl_SetAperture( XACameraItf self, XAuint32 aperture, - XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_SetAperture"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - impl = GetImpl(self); - if( !impl || apertureXA_CAMERA_APERTUREMODE_AUTO ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetAperture"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is aperture mode or value changed */ - if( impl->aperture != aperture || impl->apertureManualSetting != manualSetting ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetAperture( (XAAdaptationGstCtx*)impl->adapCtx, aperture, manualSetting ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->aperture = aperture; - impl->apertureManualSetting = manualSetting; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetAperture"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetAperture( XACameraItf self, XAuint32 *pAperture, - * XAuint32 *pManualSetting ) - * Description: Gets the camera aperture. - **/ -XAresult XACameraItfImpl_GetAperture( XACameraItf self, XAuint32 *pAperture, - XAuint32 *pManualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetAperture"); - impl = GetImpl(self); - if( !impl || !pAperture || !pManualSetting ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetAperture"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pAperture = impl->aperture; - - if( impl->aperture == XA_CAMERA_APERTUREMODE_MANUAL ) - { - *pManualSetting = impl->apertureManualSetting; - } - if( impl->aperture == XA_CAMERA_APERTUREMODE_AUTO ) - { - *pManualSetting = 0; - } - - DEBUG_API("<-XACameraItfImpl_GetAperture"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetShutterSpeed( XACameraItf self, XAuint32 shutterSpeed, - * XAmicrosecond manualSetting ) - * Description: Sets the camera shutter speed. - **/ -XAresult XACameraItfImpl_SetShutterSpeed( XACameraItf self, XAuint32 shutterSpeed, - XAmicrosecond manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_SetShutterSpeed"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - impl = GetImpl(self); - if( !impl || shutterSpeed < XA_CAMERA_SHUTTERSPEEDMODE_MANUAL || shutterSpeed > XA_CAMERA_SHUTTERSPEEDMODE_AUTO ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetShutterSpeed"); - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetShutterSpeed( (XAAdaptationGstCtx*)impl->adapCtx, shutterSpeed, manualSetting ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->shutterManualSetting = manualSetting; - impl->shutterSpeed = shutterSpeed; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetShutterSpeed"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetShutterSpeed( XACameraItf self, XAuint32 *pShutterSpeed, - * XAmicrosecond *pManualSetting ) - * Description: Gets the camera shutter speed. - **/ -XAresult XACameraItfImpl_GetShutterSpeed( XACameraItf self, XAuint32 *pShutterSpeed, - XAmicrosecond *pManualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetShutterSpeed"); - impl = GetImpl(self); - if( !impl || !pShutterSpeed || !pManualSetting ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetShutterSpeed"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pShutterSpeed = impl->shutterSpeed; - - if( impl->shutterSpeed == XA_CAMERA_SHUTTERSPEEDMODE_MANUAL ) - { - *pManualSetting = impl->shutterManualSetting; - } - if( impl->shutterSpeed == XA_CAMERA_SHUTTERSPEEDMODE_AUTO ) - { - *pManualSetting = 0; - } - - DEBUG_API("<-XACameraItfImpl_GetShutterSpeed"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetWhiteBalance( XACameraItf self, XAuint32 whiteBalance, - * XAuint32 manualSetting ) - * Description: Sets the camera white balance. - **/ -XAresult XACameraItfImpl_SetWhiteBalance( XACameraItf self, XAuint32 whiteBalance, - XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_SetWhiteBalance"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - impl = GetImpl(self); - if( !impl ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetWhiteBalance"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is whitebalance mode or value changed */ - if( impl->whiteBalance != whiteBalance || impl->whiteBalManualSetting != manualSetting ) - { - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetWhiteBalance( (XAAdaptationGstCtx*)impl->adapCtx, whiteBalance, manualSetting ); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - if ( ret == XA_RESULT_SUCCESS ) - { - impl->whiteBalance = whiteBalance; - impl->whiteBalManualSetting = manualSetting; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetWhiteBalance"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetWhiteBalance( XACameraItf self, XAuint32 *pWhiteBalance, - * XAuint32 *pManualSetting ) - * Description: Gets the camera white balance. - **/ -XAresult XACameraItfImpl_GetWhiteBalance( XACameraItf self, XAuint32 *pWhiteBalance, - XAuint32 *pManualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetWhiteBalance"); - impl = GetImpl(self); - if( !impl || !pWhiteBalance || !pManualSetting ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetWhiteBalance"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pWhiteBalance = impl->whiteBalance; - - if( impl->whiteBalance == XA_CAMERA_WHITEBALANCEMODE_MANUAL ) - { - *pManualSetting = impl->whiteBalManualSetting; - } - - DEBUG_API("<-XACameraItfImpl_GetWhiteBalance"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetAutoLocks( XACameraItf self, XAuint32 locks ) - * Description: Locks the given automatic camera settings. This method is typically - * called when the camera trigger is half-pressed. - **/ -XAresult XACameraItfImpl_SetAutoLocks( XACameraItf self, XAuint32 locks ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - DEBUG_API("->XACameraItfImpl_SetAutoLocks"); - impl = GetImpl(self); - if( !impl || locks < XA_CAMERA_LOCK_AUTOFOCUS || - (locks > ( XA_CAMERA_LOCK_AUTOFOCUS & XA_CAMERA_LOCK_AUTOEXPOSURE & XA_CAMERA_LOCK_AUTOWHITEBALANCE ))) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetAutoLocks"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetAutoLocks( (XAAdaptationGstCtx*)impl->adapCtx, locks ); - - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - - if ( ret == XA_RESULT_SUCCESS ) - { - impl->locks = locks; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetAutoLocks"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetAutoLocks( XACameraItf self, XAuint32 *locks ) - * Description: Gets the current state of the automatic camera settings locks. - **/ -XAresult XACameraItfImpl_GetAutoLocks( XACameraItf self, XAuint32 *locks ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetAutoLocks"); - impl = GetImpl(self); - if( !impl || !locks ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetAutoLocks"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *locks = impl->locks; - - DEBUG_API("<-XACameraItfImpl_GetAutoLocks"); - return ret; -} - -/** - * XAresult XACameraItfImpl_SetZoom( XACameraItf self, XAuint32 zoom, - * XAboolean digitalEnabled, XAuint32 speed, - * XAboolean async ) - * Description: Sets the new zoom factor. - **/ -XAresult XACameraItfImpl_SetZoom( XACameraItf self, XApermille zoom, - XAboolean digitalEnabled, XAuint32 speed, - XAboolean async ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_SetZoom"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSCamera); - impl = GetImpl(self); - if( !impl || !( speed == XA_CAMERA_ZOOM_FASTEST || speed == XA_CAMERA_ZOOM_FAST - || speed == XA_CAMERA_ZOOM_NORMAL || speed == XA_CAMERA_ZOOM_SLOW ) ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_SetZoom"); - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XACameraItfAdapt_SetZoom( (XAAdaptationGstCtx*)impl->adapCtx, zoom, digitalEnabled, speed, async ); - - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - - if ( ret == XA_RESULT_SUCCESS ) - { - impl->zoom = zoom; - impl->digitalEnabled = digitalEnabled; - impl->speed = speed; - impl->async = async; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSCamera); - DEBUG_API("<-XACameraItfImpl_SetZoom"); - return ret; -} - -/** - * XAresult XACameraItfImpl_GetZoom( XACameraItf self, XAuint32 *pZoom, - * XAboolean *pDigital ) - * Description: Gets the current zoom factor. - **/ -XAresult XACameraItfImpl_GetZoom( XACameraItf self, XApermille *pZoom, - XAboolean *pDigital ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraItfImpl* impl = NULL; - - DEBUG_API("->XACameraItfImpl_GetZoom"); - impl = GetImpl(self); - if( !impl || !pZoom || !pDigital ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraItfImpl_GetZoom"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pZoom = impl->zoom; - *pDigital = impl->digitalEnabled; - - DEBUG_API("<-XACameraItfImpl_GetZoom"); - return ret; -} - - -/***************************************************************************** - * XACameraItfImpl -specific methods - *****************************************************************************/ - -/* XACameraItfImpl* XACameraItfImpl_Create() - * Description: Allocate and initialize CameraItfImpl - */ - -XACameraItfImpl* XACameraItfImpl_Create( XAAdaptationBaseCtx *adapCtx ) -{ - XACameraItfImpl* self = (XACameraItfImpl*) - calloc(1,sizeof(XACameraItfImpl)); - DEBUG_API("->XACameraItfImpl_Create"); - if( self ) - { - /* init itf default implementation */ - self->itf.RegisterCallback = XACameraItfImpl_RegisterCallback; - self->itf.SetFlashMode = XACameraItfImpl_SetFlashMode; - self->itf.GetFlashMode = XACameraItfImpl_GetFlashMode; - self->itf.IsFlashReady = XACameraItfImpl_IsFlashReady; - self->itf.SetFocusMode = XACameraItfImpl_SetFocusMode; - self->itf.GetFocusMode = XACameraItfImpl_GetFocusMode; - self->itf.SetFocusRegionPattern = XACameraItfImpl_SetFocusRegionPattern; - self->itf.GetFocusRegionPattern = XACameraItfImpl_GetFocusRegionPattern; - self->itf.GetFocusRegionPositions = XACameraItfImpl_GetFocusRegionPositions; - self->itf.GetFocusModeStatus = XACameraItfImpl_GetFocusModeStatus; - self->itf.SetMeteringMode = XACameraItfImpl_SetMeteringMode; - self->itf.GetMeteringMode = XACameraItfImpl_GetMeteringMode; - self->itf.SetExposureMode = XACameraItfImpl_SetExposureMode; - self->itf.GetExposureMode = XACameraItfImpl_GetExposureMode; - self->itf.SetISOSensitivity = XACameraItfImpl_SetISOSensitivity; - self->itf.GetISOSensitivity = XACameraItfImpl_GetISOSensitivity; - self->itf.SetAperture = XACameraItfImpl_SetAperture; - self->itf.GetAperture = XACameraItfImpl_GetAperture; - self->itf.SetShutterSpeed = XACameraItfImpl_SetShutterSpeed; - self->itf.GetShutterSpeed = XACameraItfImpl_GetShutterSpeed; - self->itf.SetWhiteBalance = XACameraItfImpl_SetWhiteBalance; - self->itf.GetWhiteBalance = XACameraItfImpl_GetWhiteBalance; - self->itf.SetAutoLocks = XACameraItfImpl_SetAutoLocks; - self->itf.GetAutoLocks = XACameraItfImpl_GetAutoLocks; - self->itf.SetZoom = XACameraItfImpl_SetZoom; - self->itf.GetZoom = XACameraItfImpl_GetZoom; - - - /* init variables */ - self->flashReady = XA_BOOLEAN_TRUE; - self->adapCtx = adapCtx; - self->cbPtrToSelf = NULL; - XAAdaptationBase_AddEventHandler( adapCtx, &XACameraItfImp_AdaptCb, XA_CAMERAITFEVENTS, self ); - self->self = self; - } - - DEBUG_API("<-XACameraItfImpl_Create"); - return self; -} - - -/* void XACameraItfImpl_Free(XACameraItfImpl* self) - * Description: Free all resources reserved at XACameraItfImpl_Create - */ -void XACameraItfImpl_Free(XACameraItfImpl* self) -{ - DEBUG_API("->XACameraItfImpl_Free"); - assert( self==self->self ); - XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XACameraItfImp_AdaptCb ); - free( self ); - DEBUG_API("<-XACameraItfImpl_Free"); -} - -/* void XACameraItfAdapt_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) - * @param void *pHandlerCtx - pointer to cb context (XACameraItfImpl) - * @param XAAdaptEvent *event - Event - * Description: Event handler for adaptation events - */ -void XACameraItfImp_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XACameraItfImpl* impl =(XACameraItfImpl*)pHandlerCtx; - XAuint32 eventData=0; - - DEBUG_API("->XACameraItfImp_AdaptCb"); - if(!impl) - { - DEBUG_ERR("XACameraItfAdapt_AdaptCb, invalid context pointer!"); - DEBUG_API("<-XACameraItfImp_AdaptCb"); - return; - } - assert(event); - - if( event->data ) - { - eventData = *(XAuint32*)event->data; - } - switch( event->eventid ) - { - case XA_CAMERACBEVENT_FOCUSSTATUS: - impl->focusStatus = eventData; - break; - case XA_CAMERACBEVENT_ZOOMSTATUS: - impl->zoom = eventData; - break; - case XA_CAMERACBEVENT_EXPOSURESTATUS: - impl->focusStatus = eventData; - break; - case XA_CAMERACBEVENT_FLASHREADY: - impl->flashReady = XA_BOOLEAN_TRUE; - break; - case XA_CAMERACBEVENT_WHITEBALANCELOCKED: - case XA_CAMERACBEVENT_ROTATION: - default: - break; - } - - if( impl->callback ) - { - impl->callback( impl->cbPtrToSelf, impl->context, event->eventid, eventData ); - } - DEBUG_API("<-XACameraItfImp_AdaptCb"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/camera/xacameraitf.h --- a/khronosfws/openmax_al/src/camera/xacameraitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERAITF_H -#define XACAMERAITF_H - -#include "xaadptbasectx.h" -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XACameraItf implementation */ -typedef struct XACameraItfImpl_ -{ - /* parent interface */ - struct XACameraItf_ itf; - /* pointer to self */ - struct XACameraItfImpl_* self; - - /* variables */ - XAuint32 flashMode; - XAboolean flashReady; - XAuint32 focusMode; - XAuint32 focusStatus; - XAmillimeter focusManualSetting; - XAboolean macroEnabled; - XAuint32 focusPattern; - XAuint32 activePoints1; - XAuint32 activePoints2; - XAuint32 meteringMode; - XAuint32 exposureMode; - XAuint32 compensation; - XAuint32 isoSensitivity; - XAuint32 isoManualSetting; - XAuint32 aperture; - XAuint32 apertureManualSetting; - XAuint32 shutterSpeed; - XAmicrosecond shutterManualSetting; - XAuint32 whiteBalance; - XAuint32 whiteBalManualSetting; - XAuint32 locks; - XApermille zoom; - XAboolean digitalEnabled; - XAuint32 speed; - XAuint32 async; - - xaCameraCallback callback; - void *context; - XACameraItf cbPtrToSelf; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; -} XACameraItfImpl; - -/** METHODS **/ - -/* Base interface XACameraItf implementation - *See API Specification for method documentation - */ -XAresult XACameraItfImpl_RegisterCallback( XACameraItf self, - xaCameraCallback callback, - void *pContext ); - -XAresult XACameraItfImpl_SetFlashMode( XACameraItf self, XAuint32 flashMode ); - -XAresult XACameraItfImpl_GetFlashMode( XACameraItf self, XAuint32 *pFlashMode ); - -XAresult XACameraItfImpl_IsFlashReady( XACameraItf self, XAboolean *pReady ); - -XAresult XACameraItfImpl_SetFocusMode( XACameraItf self, XAuint32 focusMode, - XAmillimeter manualSetting, - XAboolean macroEnabled ); - -XAresult XACameraItfImpl_GetFocusMode( XACameraItf self, - XAuint32 *pFocusMode, - XAmillimeter *pManualSetting, - XAboolean *pMacroEnabled ); - -XAresult XACameraItfImpl_SetFocusRegionPattern( XACameraItf self, - XAuint32 focusPattern, - XAuint32 activePoints1, - XAuint32 activePoints2 ); - -XAresult XACameraItfImpl_GetFocusRegionPattern( XACameraItf self, - XAuint32 *pFocusPattern, - XAuint32 *pActivePoints1, - XAuint32 *pActivePoints2 ); - -XAresult XACameraItfImpl_GetFocusRegionPositions( XACameraItf self, - XAuint32 *pNumPositionEntries, - XAFocusPointPosition *pFocusPosition ); - -XAresult XACameraItfImpl_GetFocusModeStatus( XACameraItf self, - XAuint32 *pFocusStatus, - XAuint32 *pRegionStatus1, - XAuint32 *pRegionStatus2 ); - -XAresult XACameraItfImpl_SetMeteringMode( XACameraItf self, XAuint32 meteringMode ); - -XAresult XACameraItfImpl_GetMeteringMode( XACameraItf self, XAuint32 *pMeteringMode ); - -XAresult XACameraItfImpl_SetExposureMode( XACameraItf self, XAuint32 exposure, - XAuint32 compensation ); - -XAresult XACameraItfImpl_GetExposureMode( XACameraItf self, XAuint32 *pExposure, - XAuint32 *pCompensation ); - -XAresult XACameraItfImpl_SetISOSensitivity( XACameraItf self, XAuint32 isoSensitivity, - XAuint32 manualSetting ); - -XAresult XACameraItfImpl_GetISOSensitivity( XACameraItf self, XAuint32 *pIsoSensitivity, - XAuint32 *pManualSetting ); - -XAresult XACameraItfImpl_SetAperture( XACameraItf self, XAuint32 aperture, - XAuint32 manualSetting ); - -XAresult XACameraItfImpl_GetAperture( XACameraItf self, XAuint32 *pAperture, - XAuint32 *pManualSetting ); - -XAresult XACameraItfImpl_SetShutterSpeed( XACameraItf self, XAuint32 shutterSpeed, - XAmicrosecond manualSetting ); - -XAresult XACameraItfImpl_GetShutterSpeed( XACameraItf self, XAuint32 *pShutterSpeed, - XAmicrosecond *pManualSetting ); - -XAresult XACameraItfImpl_SetWhiteBalance( XACameraItf self, XAuint32 whiteBalance, - XAuint32 manualSetting ); - -XAresult XACameraItfImpl_GetWhiteBalance( XACameraItf self, XAuint32 *pWhiteBalance, - XAuint32 *pManualSetting ); - -XAresult XACameraItfImpl_SetAutoLocks( XACameraItf self, XAuint32 locks ); - -XAresult XACameraItfImpl_GetAutoLocks( XACameraItf self, XAuint32 *locks ); - -XAresult XACameraItfImpl_SetZoom( XACameraItf self, XApermille zoom, - XAboolean digitalEnabled, XAuint32 speed, - XAboolean async ); - -XAresult XACameraItfImpl_GetZoom( XACameraItf self, XApermille *pZoom, - XAboolean *pDigital ); - -/* XACameraItfImpl -specific methods */ -XACameraItfImpl* XACameraItfImpl_Create( XAAdaptationBaseCtx *adapCtx ); -void XACameraItfImp_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); -void XACameraItfImpl_Free(XACameraItfImpl* self); - -#endif /* XACAMERAITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/openmaxal.c --- a/khronosfws/openmax_al/src/common/openmaxal.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/openmaxal.c Fri Jul 09 16:43:35 2010 -0500 @@ -23,6 +23,9 @@ #include "openmaxalwrapper.h" #include "openmaxal_iid.c" +#include "xanokialinearvolume_iid.c" +#include "xanokiavolumeext_iid.c" + #include "xaglobals.h" #include "xaobjects.h" diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xadynamicsourceitf.c --- a/khronosfws/openmax_al/src/common/xadynamicsourceitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xadynamicsourceitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -20,7 +20,6 @@ #include #include "xadynamicsourceitf.h" -#include "xadynamicsourceitfadaptation.h" #include "xadynamicsourceitfadaptationmmf.h" /***************************************************************************** @@ -39,13 +38,16 @@ /* check casting */ if (!impl || impl != impl->self || !pDataSource) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); return XA_RESULT_PARAMETER_INVALID; } if (!impl->adaptCtx) { - DEBUG_ERR("Adaptation not ready!!");DEBUG_ERR("XA_RESULT_INTERNAL_ERROR");DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); + DEBUG_ERR("Adaptation not ready!!"); + DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); + DEBUG_API("<-XADynamicSourceItfImpl_SetSource"); res = XA_RESULT_INTERNAL_ERROR; } else @@ -53,12 +55,7 @@ res = XACommon_CheckDataSource(pDataSource, NULL); if (res == XA_RESULT_SUCCESS) { - if (impl->adaptCtx->fwtype == FWMgrFWGST) - { - res = XADynamicSourceItfAdapt_SetSource( - (XAAdaptationGstCtx*) impl->adaptCtx, pDataSource); - } - else + if (impl->adaptCtx->fwtype == FWMgrFWMMF) { res = XADynamicSourceItfAdaptMMF_SetSource( (XAAdaptationMMFCtx*) impl->adaptCtx, pDataSource); @@ -91,7 +88,8 @@ /* init variables */ self->adaptCtx = adaptCtx; self->self = self; - }DEBUG_API("<-XADynamicSourceItfImpl_Create"); + } + DEBUG_API("<-XADynamicSourceItfImpl_Create"); return self; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xadynintmgmtitf.c --- a/khronosfws/openmax_al/src/common/xadynintmgmtitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xadynintmgmtitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -53,7 +53,8 @@ DEBUG_API("->XADIMItfImpl_AddInterface"); if (!impl) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_AddInterface"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XADIMItfImpl_AddInterface"); return XA_RESULT_PARAMETER_INVALID; } @@ -154,7 +155,8 @@ if (!impl) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_ResumeInterface"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XADIMItfImpl_ResumeInterface"); return XA_RESULT_PARAMETER_INVALID; } @@ -201,7 +203,8 @@ if (!impl) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XADIMItfImpl_RegisterCallback"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XADIMItfImpl_RegisterCallback"); return XA_RESULT_PARAMETER_INVALID; } impl->dimCb = callback; @@ -242,7 +245,8 @@ free(self); self = NULL; } - }DEBUG_API("<-XADIMItfImpl_Create"); + } + DEBUG_API("<-XADIMItfImpl_Create"); return self; } @@ -288,7 +292,8 @@ { self->dimCb((XADynamicInterfaceManagementItf) (self), self->dimCbContext, event, result, iid); - }DEBUG_API("<-XADIMItfImpl_SendCbEvent"); + } + DEBUG_API("<-XADIMItfImpl_SendCbEvent"); } /* void* XADIMItfImpl_AsyncAddItf diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaequalizeritf.c --- a/khronosfws/openmax_al/src/common/xaequalizeritf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,605 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaequalizeritf.h" - -#include "xaequalizeritfadaptation.h" - -static const XAuint16 equalizerNumOfPresets = 0; - -/** - * XAEqualizerItfImpl* GetImpl(XAEqualizerItf self) - * Description: Validated interface pointer and cast it to implementations pointer. - **/ -static XAEqualizerItfImpl* GetImpl(XAEqualizerItf self) -{ - if(self) - { - XAEqualizerItfImpl *impl = (XAEqualizerItfImpl*)(*self); - if(impl && impl == impl->self) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAEqualizerItf implementation - */ - -/** - * XAresult XAEqualizerItfImpl_SetEnabled(XAEqualizerItf self,XAboolean enabled) - * Description: Enables the effect. - **/ -XAresult XAEqualizerItfImpl_SetEnabled(XAEqualizerItf self,XAboolean enabled) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAEqualizerItfImpl* impl = GetImpl(self); - XAuint16 index = 0; - DEBUG_API("->XAEqualizerItfImpl_SetEnabled"); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_SetEnabled"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - - if(enabled && !(impl->enabled)) - { - for(index = 0; index < EQUALIZER_NUM_OF_BANDS; index++) - { - if(impl->changeLevel[index]) - { - ret = XAEqualizerItfAdapt_SetBandLevel((XAAdaptationGstCtx*)impl->adapCtx, index, impl->levels[index]); - - if(XA_RESULT_SUCCESS == ret) - { - impl->changeLevel[index] = XA_BOOLEAN_FALSE; - } - } - } - } - else if(!enabled && impl->enabled) - { - for(index = 0; index < EQUALIZER_NUM_OF_BANDS; index++) - { - ret = XAEqualizerItfAdapt_SetBandLevel((XAAdaptationGstCtx*)impl->adapCtx, index, EQUALIZER_DEFAULT_BAND_LEVEL); - - if(XA_RESULT_SUCCESS == ret) - { - impl->changeLevel[index] = XA_BOOLEAN_FALSE; - } - } - } - else - { - /* do nothing */ - } - - if(ret == XA_RESULT_SUCCESS) - { - impl->enabled = enabled; - } - - DEBUG_API("<-XAEqualizerItfImpl_SetEnabled"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_IsEnabled(XAEqualizerItf self, XAboolean *pEnabled) - * Description: Gets the enabled status of the effect. - **/ -XAresult XAEqualizerItfImpl_IsEnabled(XAEqualizerItf self, XAboolean *pEnabled) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_IsEnabled"); - - if(!impl || !pEnabled) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_IsEnabled"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pEnabled = impl->enabled; - - DEBUG_API("<-XAEqualizerItfImpl_IsEnabled"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetNumberOfBands(XAEqualizerItf self, - * XAuint16 *pNumBands) - * Description: Gets the number of frequency bands that the equalizer supports. - * A valid equalizer must have at least two bands. - **/ -XAresult XAEqualizerItfImpl_GetNumberOfBands(XAEqualizerItf self, - XAuint16 *pNumBands) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetNumberOfBands"); - - if(!impl || !pNumBands) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetNumberOfBands"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pNumBands = EQUALIZER_NUM_OF_BANDS; - - DEBUG_API("<-XAEqualizerItfImpl_GetNumberOfBands"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetBandLevelRange(XAEqualizerItf self, - * XAmillibel *pMin, - * XAmillibel *pMax) - * Description: Returns the minimun and maximun band levels supported. - **/ -XAresult XAEqualizerItfImpl_GetBandLevelRange(XAEqualizerItf self, - XAmillibel *pMin, - XAmillibel *pMax) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetBandLevelRange"); - - if(!impl || (!pMin && !pMax)) /* other may be NULL */ - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetBandLevelRange"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAEqualizerItfImpl_GetBandLevelRange"); - return ret; - } - ret = XAEqualizerItfAdapt_GetBandLevelRange((XAAdaptationGstCtx*)impl->adapCtx, pMin, pMax); - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAEqualizerItfImpl_GetBandLevelRange"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_SetBandLevel(XAEqualizerItf self, XAuint16 band, - * XAmillibel level) - * Description: Sets the given equalizer band to the given gain value. - **/ -XAresult XAEqualizerItfImpl_SetBandLevel(XAEqualizerItf self, XAuint16 band, - XAmillibel level) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 numOfBands = 0; - XAmillibel minLevel = 0; - XAmillibel maxLevel = 0; - XAEqualizerItfImpl* impl = NULL; - - DEBUG_API("->XAEqualizerItfImpl_SetBandLevel"); - impl = GetImpl(self); - - /* Get number of bands */ - if(XA_RESULT_SUCCESS != XAEqualizerItfImpl_GetNumberOfBands(self, &numOfBands)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_SetBandLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* Get minimum and maximum level */ - if(XA_RESULT_SUCCESS != XAEqualizerItfImpl_GetBandLevelRange(self, &minLevel, &maxLevel)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_SetBandLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if(!impl || band > (numOfBands-1) || level < minLevel || level > maxLevel) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_SetBandLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAEqualizerItfImpl_SetBandLevel"); - return ret; - } - - if(impl->enabled) - { - ret = XAEqualizerItfAdapt_SetBandLevel((XAAdaptationGstCtx*)impl->adapCtx, band, level); - if(XA_RESULT_SUCCESS == ret) - { - impl->levels[band] = level; - } - } - else - { - impl->changeLevel[band] = XA_BOOLEAN_TRUE; - impl->levels[band] = level; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAEqualizerItfImpl_SetBandLevel"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetBandLevel(XAEqualizerItf self, XAuint16 band, - * XAmillibel *pLevel) - * Description: Gets the gain set for the given equalizer band. - **/ -XAresult XAEqualizerItfImpl_GetBandLevel(XAEqualizerItf self, XAuint16 band, - XAmillibel *pLevel) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetBandLevel"); - - if(!impl || !pLevel || band >= EQUALIZER_NUM_OF_BANDS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetBandLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pLevel = impl->levels[band]; - DEBUG_API("<-XAEqualizerItfImpl_GetBandLevel"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetCenterFreq(XAEqualizerItf self, XAuint16 band, - * XAmilliHertz *pCenter) - * Description: Gets the center frequency of the given band. - **/ -XAresult XAEqualizerItfImpl_GetCenterFreq(XAEqualizerItf self, XAuint16 band, - XAmilliHertz *pCenter) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetCenterFreq"); - - if(!impl || !pCenter) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetCenterFreq"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAEqualizerItfImpl_GetCenterFreq"); - return ret; - } - ret = XAEqualizerItfAdapt_GetCenterFreq((XAAdaptationGstCtx*)impl->adapCtx, band, pCenter); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAEqualizerItfImpl_GetCenterFreq"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetBandFreqRange(XAEqualizerItf self, XAuint16 band, - * XAmilliHertz *pMin, - * XAmilliHertz *pMax) - * Description: Gets the frequency range of the given frequency band. - **/ -XAresult XAEqualizerItfImpl_GetBandFreqRange(XAEqualizerItf self, XAuint16 band, - XAmilliHertz *pMin, - XAmilliHertz *pMax) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 numOfBands = 0; - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetBandFreqRange"); - - /* Get number of bands */ - if(XA_RESULT_SUCCESS != XAEqualizerItfImpl_GetNumberOfBands(self, &numOfBands)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetBandFreqRange"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if(!impl || (!pMin && !pMax) || band > numOfBands) /* pMin or pMax may be NULL */ - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetBandFreqRange"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAEqualizerItfImpl_GetBandFreqRange"); - return ret; - } - ret = XAEqualizerItfAdapt_GetBandFreqRange((XAAdaptationGstCtx*)impl->adapCtx, band, pMin, pMax); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAEqualizerItfImpl_GetBandFreqRange"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetBand(XAEqualizerItf self, XAmilliHertz frequency, - * XAuint16 *pBand) - * - * Description: Gets the band that has the most effect on the given frequency. - * If no band has an effect on the given frequency, XA_EQUALIZER_UNDEFINED is returned. - **/ -XAresult XAEqualizerItfImpl_GetBand(XAEqualizerItf self, XAmilliHertz frequency, - XAuint16 *pBand) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetBand"); - - if(!impl || !pBand) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetBand"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAEqualizerItfImpl_GetBand"); - return ret; - } - ret = XAEqualizerItfAdapt_GetBand((XAAdaptationGstCtx*)impl->adapCtx, frequency, pBand); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAEqualizerItfImpl_GetBand"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetCurrentPreset(XAEqualizerItf self, - * XAuint16 *pPreset) - * Description: Gets the current preset. - **/ -XAresult XAEqualizerItfImpl_GetCurrentPreset(XAEqualizerItf self, - XAuint16 *pPreset) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetCurrentPreset"); - - if(!impl || !pPreset) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetCurrentPreset"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* no presets defined */ - - if(ret == XA_RESULT_SUCCESS) - { - *pPreset = impl->preset; - } - - DEBUG_API("<-XAEqualizerItfImpl_GetCurrentPreset"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_UsePreset(XAEqualizerItf self, XAuint16 index) - * Description: Sets the equalizer according to the given preset - **/ -XAresult XAEqualizerItfImpl_UsePreset(XAEqualizerItf self, XAuint16 index) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 numOfPresets = 0; - XAEqualizerItfImpl* impl = GetImpl(self); - - DEBUG_API("->XAEqualizerItfImpl_UsePreset"); - - /* get number of presets */ - if( XA_RESULT_SUCCESS != XAEqualizerItfImpl_GetNumberOfPresets(self, &numOfPresets)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_UsePreset"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if(!impl || index >= numOfPresets ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_UsePreset"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - impl->preset = index; - - DEBUG_API("<-XAEqualizerItfImpl_UsePreset"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetNumberOfPresets(XAEqualizerItf self, - * XAuint16 *pNumPresets) - * Description: Gets the total number of presets the equalizer supports. - **/ -XAresult XAEqualizerItfImpl_GetNumberOfPresets(XAEqualizerItf self, - XAuint16 *pNumPresets) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAEqualizerItfImpl* impl = GetImpl(self); - DEBUG_API("->XAEqualizerItfImpl_GetNumberOfPresets"); - - if(!impl || !pNumPresets) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetNumberOfPresets"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* No presets defined. */ - *pNumPresets = equalizerNumOfPresets; - - DEBUG_API("<-XAEqualizerItfImpl_GetNumberOfPresets"); - return ret; -} - -/** - * XAresult XAEqualizerItfImpl_GetPresetName(XAEqualizerItf self, XAuint16 index, - * const XAchar **ppName) - * Description: Gets the preset name based on the index. - **/ -XAresult XAEqualizerItfImpl_GetPresetName(XAEqualizerItf self, XAuint16 index, - const XAchar **ppName) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 numOfPresets = 0; - XAEqualizerItfImpl* impl = GetImpl(self); - - DEBUG_API("->XAEqualizerItfImpl_GetPresetName"); - - /* get number of presets */ - if( XA_RESULT_SUCCESS != XAEqualizerItfImpl_GetNumberOfPresets(self, &numOfPresets)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetPresetName"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if(!impl || !ppName || index > (numOfPresets-1)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEqualizerItfImpl_GetPresetName"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* Implementation placeholder here for presets when defined. - Currently always return XA_RESULT_PARAMETER_INVALID */ - - DEBUG_API("<-XAEqualizerItfImpl_GetPresetName"); - return ret; -} - -/** - * XAEqualizerItfImpl -specific methods - **/ - - -/** - * XAEqualizerItfImplImpl* XAEqualizerItfImpl_Create() - * @return XAEqualizerItfImplImpl* - Pointer to EqualizerItf interface implementation - **/ -XAEqualizerItfImpl* XAEqualizerItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XAuint16 index = 0; - - XAEqualizerItfImpl *self = (XAEqualizerItfImpl*) - calloc(1,sizeof(XAEqualizerItfImpl)); - - DEBUG_API("->XAEqualizerItfImpl_Create"); - - if(self) - { - /* init itf default implementation */ - self->itf.GetBand = XAEqualizerItfImpl_GetBand; - self->itf.GetBandFreqRange = XAEqualizerItfImpl_GetBandFreqRange; - self->itf.GetBandLevel = XAEqualizerItfImpl_GetBandLevel; - self->itf.GetBandLevelRange = XAEqualizerItfImpl_GetBandLevelRange; - self->itf.GetCenterFreq = XAEqualizerItfImpl_GetCenterFreq; - self->itf.GetCurrentPreset = XAEqualizerItfImpl_GetCurrentPreset; - self->itf.GetNumberOfBands = XAEqualizerItfImpl_GetNumberOfBands; - self->itf.GetNumberOfPresets = XAEqualizerItfImpl_GetNumberOfPresets; - self->itf.GetPresetName = XAEqualizerItfImpl_GetPresetName; - self->itf.IsEnabled = XAEqualizerItfImpl_IsEnabled; - self->itf.SetBandLevel = XAEqualizerItfImpl_SetBandLevel; - self->itf.SetEnabled = XAEqualizerItfImpl_SetEnabled; - self->itf.UsePreset = XAEqualizerItfImpl_UsePreset; - - /* init variables */ - self->enabled = XA_BOOLEAN_FALSE; - self->preset = XA_EQUALIZER_UNDEFINED; - - for(index = 0; index < EQUALIZER_NUM_OF_BANDS; index++) - { - self->levels[index] = EQUALIZER_DEFAULT_BAND_LEVEL; - self->changeLevel[index] = XA_BOOLEAN_FALSE; - } - - self->adapCtx = adapCtx; - - self->self = self; - } - - DEBUG_API("<-XAEqualizerItfImpl_Create"); - return self; -} - -/** - * void XAEqualizerItfImpl_Free(XAEqualizerItfImpl* self) - * @param XAEqualizerItfImpl* self - - **/ -void XAEqualizerItfImpl_Free(XAEqualizerItfImpl* self) -{ - DEBUG_API("->XAEqualizerItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAEqualizerItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaequalizeritf.h --- a/khronosfws/openmax_al/src/common/xaequalizeritf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAEQUALIZERITF_H -#define XAEQUALIZERITF_H - -#include "xaadptbasectx.h" -#include "xaequalizeritfadaptation.h" - -/** MACROS **/ -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAEqualizerItf implementation */ -typedef struct XAEqualizerItfImpl_ -{ - /* parent interface */ - struct XAEqualizerItf_ itf; - /* pointer to self */ - struct XAEqualizerItfImpl_* self; - - /* variables */ - XAboolean enabled; - XAuint16 preset; - - XAmillibel levels[EQUALIZER_NUM_OF_BANDS]; - XAboolean changeLevel[EQUALIZER_NUM_OF_BANDS]; - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - -} XAEqualizerItfImpl; - -/** METHODS **/ - -/* Base interface XAEqualizerItf implementation */ -XAresult XAEqualizerItfImpl_SetEnabled(XAEqualizerItf self,XAboolean enabled); - -XAresult XAEqualizerItfImpl_IsEnabled(XAEqualizerItf self, XAboolean *pEnabled); - -XAresult XAEqualizerItfImpl_GetNumberOfBands(XAEqualizerItf self, - XAuint16 *pNumBands); - -XAresult XAEqualizerItfImpl_GetBandLevelRange(XAEqualizerItf self, - XAmillibel *pMin, - XAmillibel *pMax); - -XAresult XAEqualizerItfImpl_SetBandLevel(XAEqualizerItf self, XAuint16 band, - XAmillibel level); - -XAresult XAEqualizerItfImpl_GetBandLevel(XAEqualizerItf self, XAuint16 band, - XAmillibel *pLevel); - -XAresult XAEqualizerItfImpl_GetCenterFreq(XAEqualizerItf self, XAuint16 band, - XAmilliHertz *pCenter); - -XAresult XAEqualizerItfImpl_GetBandFreqRange(XAEqualizerItf self, XAuint16 band, - XAmilliHertz *pMin, - XAmilliHertz *pMax); - -XAresult XAEqualizerItfImpl_GetBand(XAEqualizerItf self, XAmilliHertz frequency, - XAuint16 *pBand); - -XAresult XAEqualizerItfImpl_GetCurrentPreset(XAEqualizerItf self, - XAuint16 *pPreset); - -XAresult XAEqualizerItfImpl_UsePreset(XAEqualizerItf self, XAuint16 index); - -XAresult XAEqualizerItfImpl_GetNumberOfPresets(XAEqualizerItf self, - XAuint16 *pNumPresets); - -XAresult XAEqualizerItfImpl_GetPresetName(XAEqualizerItf self, XAuint16 index, - const XAchar **ppName); - - -/* XAEqualizerItfImpl -specific methods */ -XAEqualizerItfImpl* XAEqualizerItfImpl_Create(XAAdaptationBaseCtx *adapCtx); - -void XAEqualizerItfImpl_Free(XAEqualizerItfImpl* self); - -#endif /* XAEQUALIZERITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaimagecontrolsitf.c --- a/khronosfws/openmax_al/src/common/xaimagecontrolsitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,356 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaimagecontrolsitf.h" -#include "xaimagecontrolsitfadaptation.h" - -/** - * XAImageControlsItfImpl* GetImpl(XAVolumeItf self) - * Description: Validated interface pointer and cast it to implementations pointer. - **/ -static XAImageControlsItfImpl* GetImpl(XAImageControlsItf self) -{ - if(self) - { - XAImageControlsItfImpl* impl = (XAImageControlsItfImpl*)(*self); - if(impl && (impl == impl->self)) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAImageControlsItf implementation - */ - -/** - * XAresult XAImageControlsItfImpl_SetBrightness(XAImageControlsItf self, - * XAuint32 brightness) - * Description: Sets the brightness level. - **/ -XAresult XAImageControlsItfImpl_SetBrightness(XAImageControlsItf self, - XAuint32 brightness) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageControlsItfImpl_SetBrightness"); - - if(!impl || brightness > MAX_BRIGHTNESS_VALUE) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_SetBrightness"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageControlsItfImpl_SetBrightness"); - return ret; - } - ret = XAImageControlsItfAdapt_SetBrightness((XAAdaptationGstCtx*)impl->adapCtx, brightness); - - if(ret == XA_RESULT_SUCCESS) - { - impl->brightness = brightness; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageControlsItfImpl_SetBrightness"); - return ret; -} - -/** - * XAresult XAImageControlsItfImpl_SetBrightness(XAImageControlsItf self, - * XAuint32 *pBrightness) - * Description: Gets the current brightness level. - **/ -XAresult XAImageControlsItfImpl_GetBrightness(XAImageControlsItf self, - XAuint32 *pBrightness) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageControlsItfImpl_GetBrightness"); - - if(!impl || !pBrightness) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_GetBrightness"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pBrightness = impl->brightness; - - DEBUG_API("<-XAImageControlsItfImpl_GetBrightness"); - return ret; -} - -/** - * XAresult XAImageControlsItfImpl_SetContrast(XAImageControlsItf self, - * XAint32 contrast) - * Description: Sets the contrast level. - **/ -XAresult XAImageControlsItfImpl_SetContrast(XAImageControlsItf self, - XAint32 contrast) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageControlsItfImpl_SetContrast"); - - if(!impl || (contrast < MIN_CONTRAST_VALUE || contrast > MAX_CONTRAST_VALUE)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_SetContrast"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED) - { - DEBUG_API("<-XAImageControlsItfImpl_SetContrast"); - return ret; - } - ret = XAImageControlsItfAdapt_SetContrast((XAAdaptationGstCtx*)impl->adapCtx, contrast); - - if(ret == XA_RESULT_SUCCESS) - { - impl->contrast = contrast; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageControlsItfImpl_SetContrast"); - return ret; -} - -/** - * XAresult XAImageControlsItfImpl_GetContrast(XAImageControlsItf self, - * XAint32 *pContrast) - * Description: Gets the contrast level. - **/ -XAresult XAImageControlsItfImpl_GetContrast(XAImageControlsItf self, - XAint32 *pContrast) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageControlsItfImpl_GetContrast"); - - if(!impl || !pContrast) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_GetContrast"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pContrast = impl->contrast; - - DEBUG_API("<-XAImageControlsItfImpl_GetContrast"); - return ret; -} - -/** - * XAresult XAImageControlsItfImpl_SetGamma(XAImageControlsItf self, - * XApermille gamma) - * Description: Sets the gamma level. - **/ -XAresult XAImageControlsItfImpl_SetGamma(XAImageControlsItf self, - XApermille gamma) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - XApermille minGammaValue = 0; - XApermille maxGammaValue = 0; - XAuint32 numSettings = 0; - DEBUG_API("->XAImageControlsItfImpl_SetGamma"); - - /* check supported min and max gamma levels */ - ret = XAImageControlsItfImpl_GetSupportedGammaSettings(self, &minGammaValue, - &maxGammaValue, &numSettings, NULL); - - if(!impl || (gamma < minGammaValue || gamma > maxGammaValue) || - ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_SetGamma"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageControlsItfImpl_SetGamma"); - return ret; - } - ret = XAImageControlsItfAdapt_SetGamma((XAAdaptationGstCtx*)impl->adapCtx, gamma); - - if(ret == XA_RESULT_SUCCESS) - { - impl->gamma = gamma; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageControlsItfImpl_SetGamma"); - return ret; -} - -/** - * XAresult XAImageControlsItfImpl_GetGamma(XAImageControlsItf self, - * XApermille *pGamma) - * Description: Gets the gamma level. - **/ -XAresult XAImageControlsItfImpl_GetGamma(XAImageControlsItf self, - XApermille *pGamma) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageControlsItfImpl_GetGamma"); - - if(!impl || !pGamma) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_GetGamma"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pGamma = impl->gamma; - - DEBUG_API("<-XAImageControlsItfImpl_GetGamma"); - return ret; -} - -/** - * XAresult XAImageControlsItfImpl_GetSupportedGammaSettings(XAImageControlsItf self, - * XApermille *pMinValue, - * XApermille *pMaxValue, - * XAuint32 *pNumSettings, - * XApermille **ppSettings) - * Description: This method gets the supported gamma settings. - **/ -XAresult XAImageControlsItfImpl_GetSupportedGammaSettings(XAImageControlsItf self, - XApermille *pMinValue, - XApermille *pMaxValue, - XAuint32 *pNumSettings, - XApermille **ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageControlsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageControlsItfImpl_GetSupportedGammaSettings"); - - if(!impl || !pMinValue || !pMaxValue || !pNumSettings) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfImpl_GetSupportedGammaSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageControlsItfImpl_GetSupportedGammaSettings"); - return ret; - } - /* if ppSettings is non-null and non-continuos from min and max gamma value is - * supported then pnunSettings is length of the ppSettings array. Else - * pNumSettings returns the number of supported gamma settings. */ - if( ppSettings && pNumSettings != 0 ) - { - /* solve array of supported gamma settings */ - ret = XAImageControlsItfAdapt_GetSupportedGammaSettings((XAAdaptationGstCtx*)impl->adapCtx, - pMinValue, pMaxValue, - pNumSettings, ppSettings); - } - else - { - /* Solve min and max values and numSettings */ - ret = XAImageControlsItfAdapt_GetSupportedGammaSettings((XAAdaptationGstCtx*)impl->adapCtx, - pMinValue, pMaxValue, - pNumSettings, NULL); - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageControlsItfImpl_GetSupportedGammaSettings"); - return ret; -} - -/** - * XAImageControlsItfImpl -specific methods - **/ - -/** - * XAImageControlsItfImplImpl* XAImageControlsItfImpl_Create() - * @return XAImageControlsItfImplImpl* - Pointer to ImageControlsItf interface implementation - **/ -XAImageControlsItfImpl* XAImageControlsItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XAImageControlsItfImpl* self = (XAImageControlsItfImpl*) - calloc(1,sizeof(XAImageControlsItfImpl)); - DEBUG_API("->XAImageControlsItfImpl_Create"); - - if(self) - { - /* init itf default implementation */ - self->itf.GetBrightness = XAImageControlsItfImpl_GetBrightness; - self->itf.GetContrast = XAImageControlsItfImpl_GetContrast; - self->itf.GetGamma = XAImageControlsItfImpl_GetGamma; - self->itf.GetSupportedGammaSettings = XAImageControlsItfImpl_GetSupportedGammaSettings; - self->itf.SetBrightness = XAImageControlsItfImpl_SetBrightness; - self->itf.SetContrast = XAImageControlsItfImpl_SetContrast; - self->itf.SetGamma = XAImageControlsItfImpl_SetGamma; - - /* init variables */ - self->brightness = DEFAULT_BRIGHTNESS_VALUE; - self->contrast = DEFAULT_CONTRAST_VALUE; - self->gamma = DEFAULT_GAMMA_VALUE; - - self->adapCtx = adapCtx; - - self->self = self; - } - DEBUG_API("<-XAImageControlsItfImpl_Create"); - return self; -} - -/** - * void XAImageControlsItfImpl_Free(XAImageControlsItfImpl* self) - * @param XAImageControlsItfImpl* self - - **/ -void XAImageControlsItfImpl_Free(XAImageControlsItfImpl* self) -{ - DEBUG_API("->XAImageControlsItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAImageControlsItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaimagecontrolsitf.h --- a/khronosfws/openmax_al/src/common/xaimagecontrolsitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGECONTROLSITF_H -#define XAIMAGECONTROLSITF_H - -#include "xaadptbasectx.h" - - -/** MACROS **/ -#define DEFAULT_BRIGHTNESS_VALUE 50 -#define DEFAULT_CONTRAST_VALUE 0 -#define DEFAULT_GAMMA_VALUE 1000 -#define MAX_BRIGHTNESS_VALUE 100 -#define MAX_CONTRAST_VALUE 100 -#define MIN_CONTRAST_VALUE -100 - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAImageControlsItf implementation */ -typedef struct XAImageControlsItfImpl_ -{ - /* parent interface */ - struct XAImageControlsItf_ itf; - /* pointer to self */ - struct XAImageControlsItfImpl_* self; - - /* variables */ - XAuint32 brightness; - XAint32 contrast; - XApermille gamma; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - - -} XAImageControlsItfImpl; - -/** METHODS **/ - -XAresult XAImageControlsItfImpl_SetBrightness(XAImageControlsItf self, - XAuint32 brightness); - -XAresult XAImageControlsItfImpl_GetBrightness(XAImageControlsItf self, - XAuint32 *pBrightness); - -XAresult XAImageControlsItfImpl_SetContrast(XAImageControlsItf self, - XAint32 contrast); - -XAresult XAImageControlsItfImpl_GetContrast(XAImageControlsItf self, - XAint32 *pContrast); - -XAresult XAImageControlsItfImpl_SetGamma(XAImageControlsItf self, - XApermille gamma); - -XAresult XAImageControlsItfImpl_GetGamma(XAImageControlsItf self, - XApermille *pGamma); - -XAresult XAImageControlsItfImpl_GetSupportedGammaSettings(XAImageControlsItf self, - XApermille *pMinValue, - XApermille *pMaxValue, - XAuint32 *pNumSettings, - XApermille **ppSettings); - -/* XAImageControlsItfImpl -specific methods */ -XAImageControlsItfImpl* XAImageControlsItfImpl_Create(XAAdaptationBaseCtx *adapCtx); -void XAImageControlsItfImpl_Free(XAImageControlsItfImpl* self); - -#endif /* XAIMAGECONTROLSITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaimageeffectsitf.c --- a/khronosfws/openmax_al/src/common/xaimageeffectsitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,249 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaimageeffectsitf.h" - -#include "xaimageeffectsitfadaptation.h" - -static XAImageEffectsItfImpl* GetImpl(XAImageEffectsItf self) -{ - if(self) - { - XAImageEffectsItfImpl* impl = (XAImageEffectsItfImpl*)(*self); - if(impl && (impl == impl->self)) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAImageEffectsItf implementation - */ - -/** - * XAresult XAImageEffectsItfImpl_QuerySupportedImageEffects(XAImageEffectsItf self, - * XAuint32 index, - * XAuint32 *pImageEffectId) - * Description: Queries image effects supported. - **/ -XAresult XAImageEffectsItfImpl_QuerySupportedImageEffects(XAImageEffectsItf self, - XAuint32 index, - XAuint32 *pImageEffectId) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageEffectsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageEffectsItfImpl_QuerySupportedImageEffects"); - - if(!impl || !pImageEffectId) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageEffectsItfImpl_QuerySupportedImageEffects"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageEffectsItfImpl_QuerySupportedImageEffects"); - return ret; - } - - ret = XAImageEffectsItfAdapt_QuerySupportedImageEffects((XAAdaptationGstCtx*)impl->adapCtx, index, - pImageEffectId); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->index = index; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageEffectsItfImpl_QuerySupportedImageEffects"); - return ret; -} - -/** - * XAresult XAImageEffectsItfImpl_EnableImageEffect(XAImageEffectsItf self, - * XAuint32 imageEffectID - * Description: Enables an image effect. - **/ -XAresult XAImageEffectsItfImpl_EnableImageEffect(XAImageEffectsItf self, - XAuint32 imageEffectID) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageEffectsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageEffectsItfImpl_EnableImageEffect"); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageEffectsItfImpl_EnableImageEffect"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageEffectsItfImpl_EnableImageEffect"); - return ret; - } - - ret = XAImageEffectsItfAdapt_EnableImageEffect((XAAdaptationGstCtx*)impl->adapCtx, imageEffectID); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->imageEffectID = imageEffectID; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageEffectsItfImpl_EnableImageEffect"); - return ret; -} - -/** - * XAresult XAImageEffectsItfImpl_DisableImageEffect(XAImageEffectsItf self, - * XAuint32 imageEffectID) - * Description: Disable an image effect. - **/ -XAresult XAImageEffectsItfImpl_DisableImageEffect(XAImageEffectsItf self, - XAuint32 imageEffectID) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageEffectsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageEffectsItfImpl_DisableImageEffect"); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageEffectsItfImpl_DisableImageEffect"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageEffectsItfImpl_DisableImageEffect"); - return ret; - } - - ret = XAImageEffectsItfAdapt_DisableImageEffect((XAAdaptationGstCtx*)impl->adapCtx, imageEffectID); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->imageEffectID = NO_IMAGE_EFFECTS; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageEffectsItfImpl_DisableImageEffect"); - return ret; -} - -/** - * XAresult XAImageEffectsItfImpl_IsImageEffectEnabled(XAImageEffectsItf self, - * XAuint32 imageEffectID, - * XAboolean *pEnabled) - * Description: Checks to see if an image effect is enabled. - **/ -XAresult XAImageEffectsItfImpl_IsImageEffectEnabled(XAImageEffectsItf self, - XAuint32 imageEffectID, - XAboolean *pEnabled) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAImageEffectsItfImpl* impl = GetImpl(self); - DEBUG_API("->XAImageEffectsItfImpl_IsImageEffectEnabled"); - - if(!impl || !pEnabled) - { - DEBUG_ERR("XA_RESUT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageEffectsItfImpl_IsImageEffectEnabled"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAImageEffectsItfImpl_IsImageEffectEnabled"); - return ret; - } - - ret = XAImageEffectsItfAdapt_IsImageEffectEnabled((XAAdaptationGstCtx*)impl->adapCtx, imageEffectID, - pEnabled); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAImageEffectsItfImpl_IsImageEffectEnabled"); - return ret; -} - -/** - * XAImageEffectsItfImpl -specific methods - **/ - -/** - * XAImageEffectsItfImplImpl* XAImageEffectsItfImpl_Create() - * @return XAImageEffectsItfImplImpl* - Pointer to ImageEffectsItf interface implementation - **/ -XAImageEffectsItfImpl* XAImageEffectsItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XAImageEffectsItfImpl* self = (XAImageEffectsItfImpl*) - calloc(1,sizeof(XAImageEffectsItfImpl)); - DEBUG_API("->XAImageEffectsItfImpl_Create"); - if(self) - { - /* init itf default implementation */ - self->itf.DisableImageEffect = XAImageEffectsItfImpl_DisableImageEffect; - self->itf.EnableImageEffect = XAImageEffectsItfImpl_EnableImageEffect; - self->itf.IsImageEffectEnabled = XAImageEffectsItfImpl_IsImageEffectEnabled; - self->itf.QuerySupportedImageEffects = XAImageEffectsItfImpl_QuerySupportedImageEffects; - - /* init variables */ - self->enabled = XA_BOOLEAN_FALSE; - self->index = 0; - self->imageEffectID = NO_IMAGE_EFFECTS; - self->adapCtx = adapCtx; - - self->self = self; - } - DEBUG_API("<-XAImageEffectsItfImpl_Create"); - return self; -} - -/** - * void XAImageEffectsItfImpl_Free(XAImageEffectsItfImpl* self) - * @param XAImageEffectsItfImpl* self - - **/ -void XAImageEffectsItfImpl_Free(XAImageEffectsItfImpl* self) -{ - DEBUG_API("->XAImageEffectsItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAImageEffectsItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaimageeffectsitf.h --- a/khronosfws/openmax_al/src/common/xaimageeffectsitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEEFFECTSITF_H -#define XAIMAGEEFFECTSITF_H - -#include "xaadptbasectx.h" - -/** MACROS **/ -#define NO_IMAGE_EFFECTS 0 - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAImageEffectsItf implementation */ -typedef struct XAImageEffectsItfImpl_ -{ - /* parent interface */ - struct XAImageEffectsItf_ itf; - /* pointer to self */ - struct XAImageEffectsItfImpl_* self; - - /* variables */ - XAuint32 index; - XAboolean enabled; - XAuint32 imageEffectID; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - - -} XAImageEffectsItfImpl; - -/** METHODS **/ - -/* Base interface XAImageEffectsItf implementation */ -XAresult XAImageEffectsItfImpl_QuerySupportedImageEffects(XAImageEffectsItf self, - XAuint32 index, - XAuint32 *pImageEffectId); - -XAresult XAImageEffectsItfImpl_EnableImageEffect(XAImageEffectsItf self, - XAuint32 imageEffectID); - -XAresult XAImageEffectsItfImpl_DisableImageEffect(XAImageEffectsItf self, - XAuint32 imageEffectID); - -XAresult XAImageEffectsItfImpl_IsImageEffectEnabled(XAImageEffectsItf self, - XAuint32 imageEffectID, - XAboolean *pEnabled); - - -/* XAImageEffectsItfImpl -specific methods */ -XAImageEffectsItfImpl* XAImageEffectsItfImpl_Create(XAAdaptationBaseCtx *adapCtx); -void XAImageEffectsItfImpl_Free(XAImageEffectsItfImpl* self); -#endif /* XAIMAGEEFFECTSITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xametadataextractionitf.c --- a/khronosfws/openmax_al/src/common/xametadataextractionitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xametadataextractionitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -150,7 +150,8 @@ impl = GetImpl(self); if (!impl || !pKeySize) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); return XA_RESULT_PARAMETER_INVALID; } *pKeySize = 0; @@ -173,7 +174,8 @@ /* check index and return unfiltered index */ if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetKeySize"); return XA_RESULT_PARAMETER_INVALID; } @@ -210,7 +212,8 @@ impl = GetImpl(self); if (!impl || !pKey) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); return XA_RESULT_PARAMETER_INVALID; } @@ -235,7 +238,8 @@ /* check index and return unfiltered index */ if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetKey"); return XA_RESULT_PARAMETER_INVALID; } @@ -284,7 +288,8 @@ impl = GetImpl(self); if (!impl || !pValueSize) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); return XA_RESULT_PARAMETER_INVALID; } *pValueSize = 0; @@ -307,7 +312,8 @@ /* check index and return unfiltered index */ if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetValueSize"); return XA_RESULT_PARAMETER_INVALID; } @@ -344,7 +350,8 @@ impl = GetImpl(self); if (!impl || !pValue) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); return XA_RESULT_PARAMETER_INVALID; } @@ -368,7 +375,8 @@ /* check index and return unfiltered index */ if (CheckAndUnfilterIndex(impl, index, &newidx) != XA_RESULT_SUCCESS) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_GetValue"); return XA_RESULT_PARAMETER_INVALID; } @@ -433,7 +441,8 @@ if (!impl) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAMetadataExtractionItfImpl_AddKeyFilter"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAMetadataExtractionItfImpl_AddKeyFilter"); return XA_RESULT_PARAMETER_INVALID; } else @@ -495,7 +504,8 @@ matchMask = 0; } } - }DEBUG_API_A1("<-XAMetadataExtractionItfImpl_AddKeyFilter (%d)", (int)res); + } + DEBUG_API_A1("<-XAMetadataExtractionItfImpl_AddKeyFilter (%d)", (int)res); return res; } @@ -627,7 +637,8 @@ impl = (XAMetadataExtractionItfImpl*) pHandlerCtx; if (!impl) { - DEBUG_ERR("XAMetadataExtractionItfImp_AdaptCb, invalid context pointer!");DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); + DEBUG_ERR("XAMetadataExtractionItfImp_AdaptCb, invalid context pointer!"); + DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); return; } if (event && event->eventid == XA_ADAPT_MDE_TAGS_AVAILABLE) @@ -646,7 +657,8 @@ else { DEBUG_INFO("unhandled"); - }DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); + } + DEBUG_API("<-XAMetadataExtractionItfImp_AdaptCb"); } /* For given index over filtered array, return index over whole array @@ -661,7 +673,8 @@ XAint16 i = -1; if (oldidx >= impl->filteredcount) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-CheckAndUnfilterIndex"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-CheckAndUnfilterIndex"); return XA_RESULT_PARAMETER_INVALID; } *newidx = 0; @@ -678,7 +691,8 @@ { /* should not end up here */ *newidx = 0; - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-CheckAndUnfilterIndex"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-CheckAndUnfilterIndex"); return XA_RESULT_PARAMETER_INVALID; } } @@ -686,7 +700,8 @@ { if (oldidx >= impl->currentTags.itemcount) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-CheckAndUnfilterIndex"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-CheckAndUnfilterIndex"); return XA_RESULT_PARAMETER_INVALID; } *newidx = oldidx; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xametadatatraversalitf.c --- a/khronosfws/openmax_al/src/common/xametadatatraversalitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,303 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include - -#include "xametadatatraversalitf.h" - -#include "xametadataadaptation.h" - -/* XAMetadataTraversalImpl* GetImpl(XAMetadataTraversalItf self) - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAMetadataTraversalImpl* GetImpl(XAMetadataTraversalItf self) -{ - if( self ) - { - XAMetadataTraversalImpl* impl = (XAMetadataTraversalImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/***************************************************************************** - * Base interface XAMetadataTraversalItf implementation - *****************************************************************************/ - -/* XAresult XAMetadataTraversalItfImpl_SetMode - * Description: Sets the metadata traversal mode - */ -XAresult XAMetadataTraversalItfImpl_SetMode(XAMetadataTraversalItf self, - XAuint32 mode) -{ - XAMetadataTraversalImpl *impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAMetadataTraversalItfImpl_SetMode"); - impl = GetImpl(self); - /* check parameters */ - if( !impl || - (mode!=XA_METADATATRAVERSALMODE_NODE && - mode!=XA_METADATATRAVERSALMODE_ALL)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else if(impl->traversemode != mode) - { - - res =XAMetadataTraversalItfAdapt_SetMode((XAAdaptationGstCtx*)impl->adaptCtx, mode); - - if( res == XA_RESULT_SUCCESS ) - { - impl->traversemode = mode; - } - } - else - { - /* do nothing */ - } - - DEBUG_API("<-XAMetadataTraversalItfImpl_SetMode"); - return res; -} - -/* XAresult XAMetadataTraversalItfImpl_GetChildCount - * Description: Returns the number of children (nodes, streams, etc.) within the current scope - */ -XAresult XAMetadataTraversalItfImpl_GetChildCount(XAMetadataTraversalItf self, - XAuint32 *pCount) -{ - XAMetadataTraversalImpl *impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAMetadataTraversalItfImpl_GetChildCount"); - impl = GetImpl(self); - if( !impl || !pCount ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if(impl->traversemode==XA_METADATATRAVERSALMODE_ALL) - { - /* for this mode, child count is always 0 */ - *pCount = 0; - res = XA_RESULT_SUCCESS; - } - else - { - - res = XAMetadataTraversalItfAdapt_GetChildCount((XAAdaptationGstCtx*)impl->adaptCtx, pCount); - - } - } - - DEBUG_API("<-XAMetadataTraversalItfImpl_GetChildCount"); - return res; -} - -/* XAresult XAMetadataTraversalItfImpl_GetChildMIMETypeSize - * Description: Returns the size in bytes needed to store the MIME type of a child - */ -XAresult XAMetadataTraversalItfImpl_GetChildMIMETypeSize(XAMetadataTraversalItf self, - XAuint32 index, - XAuint32 *pSize) -{ - XAMetadataTraversalImpl *impl = NULL; - - XAuint32 chCount = 0; - - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAMetadataTraversalItfImpl_GetChildMIMETypeSize"); - impl = GetImpl(self); - - if( !impl || !pSize) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - res = XAMetadataTraversalItfAdapt_GetChildCount((XAAdaptationGstCtx*)impl->adaptCtx, &chCount); - if(index >= chCount || res != XA_RESULT_SUCCESS) - { - /* out of bounds */ - res = XA_RESULT_PARAMETER_INVALID; - } - res = XAMetadataTraversalItfAdapt_GetChildMIMETypeSize((XAAdaptationGstCtx*)impl->adaptCtx, index, pSize); - - } - - DEBUG_API("<-XAMetadataTraversalItfImpl_GetChildMIMETypeSize"); - return res; -} - -/* XAresult XAMetadataTraversalItfImpl_GetChildInfo - * Description: Returns information about a child - */ -XAresult XAMetadataTraversalItfImpl_GetChildInfo(XAMetadataTraversalItf self, - XAuint32 index, - XAint32 *pNodeID, - XAuint32 *pType, - XAuint32 size, - XAchar *pMimeType) -{ - XAMetadataTraversalImpl *impl = NULL; - - XAuint32 chCount = 0; - - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAMetadataTraversalItfImpl_GetChildInfo"); - impl = GetImpl(self); - if( !impl || !pNodeID || !pType ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - res = XAMetadataTraversalItfAdapt_GetChildCount((XAAdaptationGstCtx*)impl->adaptCtx, &chCount); - if(index >= chCount || res != XA_RESULT_SUCCESS) - { - /* out of bounds */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAMetadataTraversalItfImpl_GetChildInfo"); - return XA_RESULT_PARAMETER_INVALID; - } - res = XAMetadataTraversalItfAdapt_GetChildInfo((XAAdaptationGstCtx*)impl->adaptCtx, index, - pNodeID, pType, size, pMimeType); - - } - - DEBUG_API("<-XAMetadataTraversalItfImpl_GetChildInfo"); - return res; -} - -/* XAresult XAMetadataTraversalItfImpl_SetActiveNode - * Description: Sets the scope to a child node - */ -XAresult XAMetadataTraversalItfImpl_SetActiveNode(XAMetadataTraversalItf self, - XAuint32 index) -{ - XAMetadataTraversalImpl *impl = NULL; - - XAuint32 chCount = 0; - - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAMetadataTraversalItfImpl_SetActiveNode"); - impl = GetImpl(self); - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - res = XAMetadataTraversalItfAdapt_GetChildCount((XAAdaptationGstCtx*)impl->adaptCtx, &chCount); - if( res == XA_RESULT_SUCCESS ) - { - if((impl->nodedepth==0 && index==XA_NODE_PARENT) || - (index >= chCount && index!=XA_NODE_PARENT)) - { - /* try to ascend from root or descend to nonexistend child node */ - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - /* update node and childs */ - res = XAMetadataTraversalItfAdapt_SetActiveNode((XAAdaptationGstCtx*)impl->adaptCtx, index); - if( res == XA_RESULT_SUCCESS ) - { - if(index==XA_NODE_PARENT) - { - impl->nodedepth++; - } - else - { - impl->nodedepth--; - } - } - } - } - else - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAMetadataTraversalItfImpl_SetActiveNode"); - return XA_RESULT_INTERNAL_ERROR; - } - - } - - DEBUG_API("<-XAMetadataTraversalItfImpl_SetActiveNode"); - return res; -} - -/***************************************************************************** - * XAMetadataTraversalImpl -specific methods - *****************************************************************************/ - -/* XAMetadataTraversalImpl* XAMetadataTraversalItfImpl_Create() - * Description: Allocate and initialize XAMetadataTraversalImpl - */ -XAMetadataTraversalImpl* XAMetadataTraversalItfImpl_Create( XAAdaptationBaseCtx *adaptCtx ) -{ - XAMetadataTraversalImpl *self = NULL; - DEBUG_API("->XAMetadataTraversalItfImpl_Create"); - - self = (XAMetadataTraversalImpl*) calloc(1,sizeof(XAMetadataTraversalImpl)); - - if( self ) - { - /* init itf default implementation */ - self->itf.SetMode = XAMetadataTraversalItfImpl_SetMode; - self->itf.GetChildCount = XAMetadataTraversalItfImpl_GetChildCount; - self->itf.GetChildMIMETypeSize = XAMetadataTraversalItfImpl_GetChildMIMETypeSize; - self->itf.GetChildInfo = XAMetadataTraversalItfImpl_GetChildInfo; - self->itf.SetActiveNode = XAMetadataTraversalItfImpl_SetActiveNode; - - /* init variables */ - self->adaptCtx = adaptCtx; - - self->self = self; - } - DEBUG_API("<-XAMetadataTraversalItfImpl_Create"); - return self; -} - -/* void XAMetadataTraversalItfImpl_Free(XAMetadataTraversalImpl* self) - * Description: Free all resources reserved at XAMetadataTraversalItfImpl_Create - */ -void XAMetadataTraversalItfImpl_Free(XAMetadataTraversalImpl* self) -{ - DEBUG_API("->XAMetadataTraversalItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAMetadataTraversalItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xametadatatraversalitf.h --- a/khronosfws/openmax_al/src/common/xametadatatraversalitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMETADATATRAVERSALITF_H -#define XAMETADATATRAVERSALITF_H - -#include "xaadptbasectx.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAMetadataTraversalItf implementation */ -typedef struct XAMetadataTraversalImpl_ -{ - /* parent interface */ - struct XAMetadataTraversalItf_ itf; - /* pointer to self */ - struct XAMetadataTraversalImpl_* self; - - /* pointer to metadata variables */ - XAuint32 traversemode; - XAuint32 index; - XAuint32 nodedepth; - - - XAAdaptationBaseCtx *adaptCtx; - -} XAMetadataTraversalImpl; - -/** METHODS **/ - -/* Base interface XAMetadataTraversalItf implementation */ -XAresult XAMetadataTraversalItfImpl_SetMode(XAMetadataTraversalItf self, - XAuint32 mode); - -XAresult XAMetadataTraversalItfImpl_GetChildCount(XAMetadataTraversalItf self, - XAuint32 *pCount); - -XAresult XAMetadataTraversalItfImpl_GetChildMIMETypeSize(XAMetadataTraversalItf self, - XAuint32 index, - XAuint32 *pSize); - -XAresult XAMetadataTraversalItfImpl_GetChildInfo(XAMetadataTraversalItf self, - XAuint32 index, - XAint32 *pNodeID, - XAuint32 *pType, - XAuint32 size, - XAchar *pMimeType); - -XAresult XAMetadataTraversalItfImpl_SetActiveNode(XAMetadataTraversalItf self, - XAuint32 index); - - -/* XAMetadataExtractionItfImpl -specific methods */ -XAMetadataTraversalImpl* XAMetadataTraversalItfImpl_Create(XAAdaptationBaseCtx *adapCtx); -void XAMetadataTraversalItfImpl_Free(XAMetadataTraversalImpl* self); - -#endif /* XAMETADATATRAVERSALITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xanokialinearvolumeitf.c --- a/khronosfws/openmax_al/src/common/xanokialinearvolumeitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanokialinearvolumeitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -126,7 +126,8 @@ if (!impl || !percentage) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -163,7 +164,8 @@ if (!impl || !pStepCount) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaLinearVolumeItfImpl_GetMaxVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -294,7 +296,8 @@ if (!impl && !event) { - DEBUG_ERR("XANokiaLinearVolumeItfImpl_AdaptCb, invalid context pointer!");DEBUG_API("<-XANokiaLinearVolumeItfImpl_AdaptCb"); + DEBUG_ERR("XANokiaLinearVolumeItfImpl_AdaptCb, invalid context pointer!"); + DEBUG_API("<-XANokiaLinearVolumeItfImpl_AdaptCb"); return; } @@ -312,5 +315,6 @@ else { /* do nothing */ - }DEBUG_API("<-XANokiaLinearVolumeItfimpl_AdaptCb"); + } + DEBUG_API("<-XANokiaLinearVolumeItfimpl_AdaptCb"); } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xanokiavolumeextitf.c --- a/khronosfws/openmax_al/src/common/xanokiavolumeextitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xanokiavolumeextitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -91,14 +91,16 @@ if (XANokiaVolumeExtItfImpl_GetMaxVolumeLevel(self, &maximumLevel) != XA_RESULT_SUCCESS) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); /* cannot solve maximum volume level */ return XA_RESULT_PARAMETER_INVALID; } if (!impl || level > maximumLevel) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_SetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -122,7 +124,8 @@ if (!impl || !pLevel) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_GetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -146,7 +149,8 @@ if (!impl || !pMaxLevel) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMaxVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMaxVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -170,7 +174,8 @@ if (!impl) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetMute"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_SetMute"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -211,7 +216,8 @@ if (!impl || !pMute) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMute"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_GetMute"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -235,7 +241,8 @@ if (!impl) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_EnableStereoPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_EnableStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -281,7 +288,8 @@ if (!impl || !pEnable) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_IsEnabledStereoPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_IsEnabledStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -307,7 +315,8 @@ if (!impl || (stereoPosition < STEREO_POSITION_LEFT) || (stereoPosition > STEREO_POSITION_RIGHT)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_SetStereoPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_SetStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -351,7 +360,8 @@ if (!impl || !pStereoPosition) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfImpl_GetStereoPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_GetStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -486,7 +496,8 @@ if (!impl) { - DEBUG_ERR("XANokiaVolumeExtItfImpl_AdaptCb, invalid context pointer!");DEBUG_API("<-XANokiaVolumeExtItfImpl_AdaptCb"); + DEBUG_ERR("XANokiaVolumeExtItfImpl_AdaptCb, invalid context pointer!"); + DEBUG_API("<-XANokiaVolumeExtItfImpl_AdaptCb"); return; } assert(event); diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xaobjectitf.c --- a/khronosfws/openmax_al/src/common/xaobjectitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xaobjectitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -80,7 +80,8 @@ { retval = pObjImp->DoRealizeImpl(self); } - }DEBUG_API("<-XAObjectItfImpl_Realize"); + } + DEBUG_API("<-XAObjectItfImpl_Realize"); return retval; } @@ -132,7 +133,8 @@ { retval = pObjImp->DoResumeImpl(self); } - }DEBUG_API("<-XAObjectItfImpl_Resume"); + } + DEBUG_API("<-XAObjectItfImpl_Resume"); return retval; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xastreaminformationitf.c --- a/khronosfws/openmax_al/src/common/xastreaminformationitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xastreaminformationitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -18,7 +18,7 @@ #include #include "xastreaminformationitf.h" -#include "xastreaminformationitfadaptation.h" + #include "xastreaminformationitfadaptationmmf.h" /* XAStreamInformationItfImpl* GetImpl @@ -56,20 +56,7 @@ return XA_RESULT_PARAMETER_INVALID; } - if (impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if (ret == XA_RESULT_PARAMETER_INVALID) - { - DEBUG_API("<-XAStreamInformationItfImpl_QueryMediaContainerInformation"); - return ret; - } - ret = XAStreamInformationItfAdapt_QueryMediaContainerInformation( - impl->adapCtx, &(info->containerType), - &(info->mediaDuration), &(info->numStreams)); - XAAdaptationBase_ThreadExit(impl->adapCtx); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); if (ret == XA_RESULT_PARAMETER_INVALID) @@ -81,7 +68,6 @@ impl->adapCtx, &(info->containerType), &(info->mediaDuration), &(info->numStreams)); XAAdaptationBase_ThreadExit(impl->adapCtx); - ; } DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) - { - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if (ret == XA_RESULT_PARAMETER_INVALID) - { - DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamType"); - return ret; - } - - ret = XAStreamInformationItfAdapt_QueryStreamType(impl->adapCtx, - streamIndex, domain); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); if (ret == XA_RESULT_PARAMETER_INVALID) @@ -128,8 +100,8 @@ streamIndex, domain); XAAdaptationBase_ThreadExit(impl->adapCtx); - ; - }DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) - { - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if (ret == XA_RESULT_PARAMETER_INVALID) - { - DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamInformation"); - return ret; - } - - ret = XAStreamInformationItfAdapt_QueryStreamInformation( - impl->adapCtx, streamIndex, info); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); if (ret == XA_RESULT_PARAMETER_INVALID) @@ -174,7 +132,6 @@ impl->adapCtx, streamIndex, info); XAAdaptationBase_ThreadExit(impl->adapCtx); - ; } DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) - { - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if (ret == XA_RESULT_PARAMETER_INVALID) - { - DEBUG_API("<-XAStreamInformationItfImpl_QueryStreamName"); - return ret; - } - - ret = XAStreamInformationItfAdapt_QueryStreamName(impl->adapCtx, - streamIndex, pNameSize, pName); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); if (ret == XA_RESULT_PARAMETER_INVALID) @@ -223,8 +166,8 @@ streamIndex, pNameSize, pName); XAAdaptationBase_ThreadExit(impl->adapCtx); - ; - }DEBUG_API("-adapCtx, - numStreams, activeStreams); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - } - else - { - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if (ret == XA_RESULT_PARAMETER_INVALID) - { - DEBUG_API("<-XAStreamInformationItfImpl_QueryActiveStreams"); - return ret; - } - ret = XAStreamInformationItfAdaptMMF_QueryActiveStreams( impl->adapCtx, numStreams, activeStreams); XAAdaptationBase_ThreadExit(impl->adapCtx); - ; } DEBUG_API("-adapCtx->fwtype == FWMgrFWGST) - { - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if (ret == XA_RESULT_PARAMETER_INVALID) - { - DEBUG_API("<-XAStreamInformationItfImpl_SetActiveStream"); - return ret; - } - - ret = XAStreamInformationItfAdapt_SetActiveStream(impl->adapCtx, - streamNum, active, commitNow); - - XAAdaptationBase_ThreadExit(impl->adapCtx); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); if (ret == XA_RESULT_PARAMETER_INVALID) @@ -343,7 +257,6 @@ streamNum, active, commitNow); XAAdaptationBase_ThreadExit(impl->adapCtx); - ; } DEBUG_API("-mutexTable[i] ); + } + DEBUG_INFO_A2("Created %s:%x",MEDIAOBJECTNAME(i), threadSafety->mutexTable[i] ); } } else @@ -129,7 +131,8 @@ else { DEBUG_INFO("Thread safety: disabled."); - }DEBUG_API("<-XAThreadSafety_Unlock"); + } + DEBUG_API("<-XAThreadSafety_Unlock"); return ret; } /* diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xathreadsafety.h --- a/khronosfws/openmax_al/src/common/xathreadsafety.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xathreadsafety.h Fri Jul 09 16:43:35 2010 -0500 @@ -25,16 +25,12 @@ #ifdef _DEBUG /*parse media object names for debug prints*/ -static const char* mediaobjectnames[9] = +static const char* mediaobjectnames[5] = { "XATSMediaPlayer", "XATSMediaRecorder", "XATSEngine", "XATSRadio", - "XATSCamera", - "XATSOutputMix", - "XATSVibra", - "XATSLEDArray", "XATSMetaDataExtractor" }; #define MEDIAOBJECTNAME(i) ((i -#include -#include -#include "xavideopostprocessingitf.h" - -#include "xavideopostprosessingitfadaptation.h" - -/** - * XAVideoPostProcessingItfImpl* GetImpl(XAVideoPostProcessingItf self) - * Description: Validated interface pointer and cast it to implementations pointer. - **/ -static XAVideoPostProcessingItfImpl* GetImpl(XAVideoPostProcessingItf self) -{ - if(self) - { - XAVideoPostProcessingItfImpl* impl = (XAVideoPostProcessingItfImpl*)(*self); - if(impl && (impl == impl->self)) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAVideoPostProcessingItf implementation - */ - -/** - * XAresult XAVideoPostProcessingItfImpl_SetRotation(XAVideoPostProcessingItf self, - * XAmillidegree rotation) - * Description: Sets post-prosessing options for rotation. - **/ -XAresult XAVideoPostProcessingItfImpl_SetRotation(XAVideoPostProcessingItf self, - XAmillidegree rotation) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - XAboolean isSupported = XA_BOOLEAN_FALSE; - DEBUG_API("->XAVideoPostProcessingItfImpl_SetRotation"); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetRotation"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - /* Check is arbitrary rotation supported */ - ret = XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported( self, &isSupported ); - - if(ret == XA_RESULT_SUCCESS) - { - if( isSupported == XA_BOOLEAN_FALSE ) - { - /* check that wanted angle is integer multiple of 90 degrees */ - if( rotation % 90000 != 0 ) - { - /* feature unsupported */ - ret = XA_RESULT_FEATURE_UNSUPPORTED; - return ret; - } - } - - impl->rotation = rotation; - impl->isRotate = XA_BOOLEAN_TRUE; - } - - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetRotation"); - return ret; -} - -/** - * XAresult XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported(XAVideoPostProcessingItf self, - * XAboolean *pSupported) - * Description: Determines if arbitrary rotation angles are supported by the implementation. - */ -XAresult XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported(XAVideoPostProcessingItf self, - XAboolean *pSupported) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported"); - if(!impl || !pSupported) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported"); - return ret; - } - - ret = XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported((XAAdaptationGstCtx*)impl->adapCtx, - pSupported); - - if(ret == XA_RESULT_SUCCESS) - { - impl->supported = *pSupported; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported"); - return ret; -} - -/** - * XAresult XAVideoPostProcessingItfImpl_SetScaleOptions(XAVideoPostProcessingItf self, - * XAuint32 scaleOptions, - * XAuint32 backgroundColor, - * XAuint32 renderingHints) - * Description: Sets the options for scaling - */ -XAresult XAVideoPostProcessingItfImpl_SetScaleOptions(XAVideoPostProcessingItf self, - XAuint32 scaleOptions, - XAuint32 backgroundColor, - XAuint32 renderingHints) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVideoPostProcessingItfImpl_SetScaleOptions"); - - if(!impl || (scaleOptions != XA_VIDEOSCALE_STRETCH && scaleOptions != XA_VIDEOSCALE_FIT - && scaleOptions != XA_VIDEOSCALE_CROP)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetScaleOptions"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - impl->scaleOptions = scaleOptions; - impl->backgroundColor = backgroundColor; - impl->renderingHints = renderingHints; - impl->isScaleOptions = XA_BOOLEAN_TRUE; - - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetScaleOptions"); - return ret; -} - -/** - * XAresult XAVideoPostProcessingItfImpl_SetSourceRectangle(XAVideoPostProcessingItf self, - * const XARectangle *pSrcRect) - * Description: Defines the rectangle in the original frame that is to be used for further processing - */ -XAresult XAVideoPostProcessingItfImpl_SetSourceRectangle(XAVideoPostProcessingItf self, - const XARectangle *pSrcRect) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVideoPostProcessingItfImpl_SetSourceRectangle"); - - if(!impl || !pSrcRect) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetSourceRectangle"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - impl->srcRect = *pSrcRect; - impl->isSrcRect = XA_BOOLEAN_TRUE; - - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetSourceRectangle"); - return ret; -} - -/** - * XAresult XAVideoPostProcessingItfImpl_SetDestinationRectangle(XAVideoPostProcessingItf self, - * const XARectangle *pDestRect) - * - * Description: Defines the destination rectangle for the processed frame. This rectangle, - * in conjunction with the scaling options used (fit, crop, stretch) determines - * the scaling applied to the frame. - */ -XAresult XAVideoPostProcessingItfImpl_SetDestinationRectangle(XAVideoPostProcessingItf self, - const XARectangle *pDestRect) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVideoPostProcessingItfImpl_SetDestinationRectangle"); - - if(!impl || !pDestRect) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetDestinationRectangle"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - impl->destRect = *pDestRect; - impl->isDestRect = XA_BOOLEAN_TRUE; - - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetDestinationRectangle"); - return ret; -} - -/** - * XAresult XAVideoPostProcessingItfImpl_SetMirror(XAVideoPostProcessingItf self, - * XAuint32 mirror) - * Description: Sets post-prosessing options for mirroring. - */ -XAresult XAVideoPostProcessingItfImpl_SetMirror(XAVideoPostProcessingItf self, - XAuint32 mirror) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVideoPostProcessingItfImpl_SetMirror"); - - if(!impl || (mirror != XA_VIDEOMIRROR_NONE && mirror != XA_VIDEOMIRROR_VERTICAL - && mirror != XA_VIDEOMIRROR_HORIZONTAL && mirror != XA_VIDEOMIRROR_BOTH )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetMirror"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - impl->mirror = mirror; - impl->isMirror = XA_BOOLEAN_TRUE; - - DEBUG_API("<-XAVideoPostProcessingItfImpl_SetMirror"); - return ret; -} - -/** - * XAresult XAVideoPostProcessingItfImpl_Commit(XAVideoPostProcessingItf self) - * Description: Commit all video post-processing changes since the last Commit(). - */ -XAresult XAVideoPostProcessingItfImpl_Commit(XAVideoPostProcessingItf self) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVideoPostProcessingItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVideoPostProcessingItfImpl_Commit"); - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfImpl_Commit"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAAdaptationBase_ThreadEntry(impl->adapCtx); - if( ret == XA_RESULT_PARAMETER_INVALID || ret == XA_RESULT_PRECONDITIONS_VIOLATED ) - { - DEBUG_API("<-XAVideoPostProcessingItfImpl_Commit"); - return ret; - } - - ret = XAVideoPostProcessingItfAdapt_Commit((XAAdaptationGstCtx*)impl->adapCtx, - impl->rotation, - impl->scaleOptions, - impl->backgroundColor, - impl->renderingHints, - &impl->srcRect, - &impl->destRect, - impl->mirror, - impl->isMirror, - impl->isRotate, - impl->isDestRect, - impl->isSrcRect, - impl->isScaleOptions); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->isMirror = XA_BOOLEAN_FALSE; - impl->isRotate = XA_BOOLEAN_FALSE; - impl->isDestRect = XA_BOOLEAN_FALSE; - impl->isSrcRect = XA_BOOLEAN_FALSE; - impl->isScaleOptions = XA_BOOLEAN_FALSE; - } - - XAAdaptationBase_ThreadExit(impl->adapCtx); - - DEBUG_API("<-XAVideoPostProcessingItfImpl_Commit"); - return ret; -} - -/** - * XAVideoPostProcessingItfImpl -specific methods - **/ -/** - * XAVideoPostProcessingItfImpl* XAVideoPostProcessingItfImpl_Create() - * @return XAVideoPostProcessingItfImpl* - Pointer to VideoPostProcessingItf interface implementation - **/ -XAVideoPostProcessingItfImpl* XAVideoPostProcessingItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XAVideoPostProcessingItfImpl* self = (XAVideoPostProcessingItfImpl*) - calloc(1,sizeof(XAVideoPostProcessingItfImpl)); - DEBUG_API("->XAVideoPostProcessingItfImpl_Create"); - if(self) - { - XARectangle emptyRect = {0,0,0,0}; - /* init itf default implementation */ - self->itf.Commit = XAVideoPostProcessingItfImpl_Commit; - self->itf.IsArbitraryRotationSupported = XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported; - self->itf.SetDestinationRectangle = XAVideoPostProcessingItfImpl_SetDestinationRectangle; - self->itf.SetMirror = XAVideoPostProcessingItfImpl_SetMirror; - self->itf.SetRotation = XAVideoPostProcessingItfImpl_SetRotation; - self->itf.SetScaleOptions = XAVideoPostProcessingItfImpl_SetScaleOptions; - self->itf.SetSourceRectangle = XAVideoPostProcessingItfImpl_SetSourceRectangle; - - /* init variables */ - self->rotation = 0; - self->scaleOptions = XA_VIDEOSCALE_FIT; - self->mirror = XA_VIDEOMIRROR_NONE; - self->backgroundColor = 0; - self->renderingHints = XA_RENDERINGHINT_NONE; - self->adapCtx = adapCtx; - self->srcRect = emptyRect; - self->destRect = emptyRect; - self->isMirror = XA_BOOLEAN_FALSE; - self->isRotate = XA_BOOLEAN_FALSE; - self->isDestRect = XA_BOOLEAN_FALSE; - self->isSrcRect = XA_BOOLEAN_FALSE; - self->isScaleOptions = XA_BOOLEAN_FALSE; - - self->self = self; - } - DEBUG_API("<-XAVideoPostProcessingItfImpl_Create"); - return self; -} - -/** - * void XAVideoPostProcessingItfImpl_Free(XAVideoPostProcessingItfImpl* self); - * @param XAVideoPostProcessingItfImpl* self - - **/ -void XAVideoPostProcessingItfImpl_Free(XAVideoPostProcessingItfImpl* self) -{ - DEBUG_API("->XAVideoPostProcessingItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAVideoPostProcessingItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xavideopostprocessingitf.h --- a/khronosfws/openmax_al/src/common/xavideopostprocessingitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,87 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOPOSTPROCESSINGITF_H -#define XAVIDEOPOSTPROCESSINGITF_H - -#include "xaadptbasectx.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAVideoPostProcessingItf implementation */ -typedef struct XAVideoPostProcessingItfImpl_ -{ - /* parent interface */ - struct XAVideoPostProcessingItf_ itf; - /* pointer to self */ - struct XAVideoPostProcessingItfImpl_* self; - - /* variables */ - XAboolean supported; - XARectangle srcRect; - XARectangle destRect; - XAuint32 scaleOptions; - XAuint32 backgroundColor; - XAuint32 renderingHints; - XAuint32 mirror; - XAmillidegree rotation; - XAboolean isRotate; - XAboolean isMirror; - XAboolean isDestRect; - XAboolean isSrcRect; - XAboolean isScaleOptions; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - -} XAVideoPostProcessingItfImpl; - -/** METHODS **/ - -/* Base interface XAVideoPostProcessingItf implementation */ -XAresult XAVideoPostProcessingItfImpl_SetRotation(XAVideoPostProcessingItf self, - XAmillidegree rotation); - -XAresult XAVideoPostProcessingItfImpl_IsArbitraryRotationSupported(XAVideoPostProcessingItf self, - XAboolean *pSupported); - -XAresult XAVideoPostProcessingItfImpl_SetScaleOptions(XAVideoPostProcessingItf self, - XAuint32 scaleOptions, - XAuint32 backgroundColor, - XAuint32 renderingHints); - -XAresult XAVideoPostProcessingItfImpl_SetSourceRectangle(XAVideoPostProcessingItf self, - const XARectangle *pSrcRect); - -XAresult XAVideoPostProcessingItfImpl_SetDestinationRectangle(XAVideoPostProcessingItf self, - const XARectangle *pDestRect); - -XAresult XAVideoPostProcessingItfImpl_SetMirror(XAVideoPostProcessingItf self, - XAuint32 mirror); - -XAresult XAVideoPostProcessingItfImpl_Commit(XAVideoPostProcessingItf self); - -/* XAVideoPostProcessingItfImpl -specific methods */ -XAVideoPostProcessingItfImpl* XAVideoPostProcessingItfImpl_Create(XAAdaptationBaseCtx *adapCtx); -void XAVideoPostProcessingItfImpl_Free(XAVideoPostProcessingItfImpl* self); - -#endif /* XAVIDEOPOSTPROCESSINGITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/common/xavolumeitf.c --- a/khronosfws/openmax_al/src/common/xavolumeitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/common/xavolumeitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -21,7 +21,6 @@ #include "xavolumeitf.h" -#include "xavolumeitfadaptation.h" #include "xanokiavolumeextitfadaptationmmf.h" /** * XAVolumeItfImpl* GetImpl(XAVolumeItf self) @@ -81,15 +80,6 @@ DEBUG_API("<-XAVolumeItfImpl_SetVolumeLevel"); return ret; } - if (impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XAVolumeItfAdapt_SetVolumeLevel( - (XAAdaptationGstCtx*) impl->adapCtx, level); - } - else - { - impl->volumeLevel = level; - } if (ret == XA_RESULT_SUCCESS) { @@ -152,15 +142,7 @@ DEBUG_API("<-XAVolumeItfImpl_GetMaxVolumeLevel"); return ret; } - if (impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XAVolumeItfAdapt_GetMaxVolumeLevel( - (XAAdaptationGstCtx*) impl->adapCtx, pMaxLevel); - } - else - { - *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; - } + *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; XAAdaptationBase_ThreadExit(impl->adapCtx); @@ -201,11 +183,6 @@ ret = XANokiaVolumeExtItfAdapt_SetMute( (XAAdaptationMMFCtx*) impl->adapCtx, mute); } - else - { - ret = XAVolumeItfAdapt_SetMute( - (XAAdaptationGstCtx*) impl->adapCtx, mute); - } if (ret == XA_RESULT_SUCCESS) { @@ -272,12 +249,7 @@ /* Check is stereo position state changed */ if (enable != impl->enableStereoPos) { - if (impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XAVolumeItfAdapt_EnableStereoPosition( - (XAAdaptationGstCtx*) impl->adapCtx, enable); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XANokiaVolumeExtItfAdapt_EnableStereoPosition( (XAAdaptationMMFCtx*) impl->adapCtx, enable); @@ -353,12 +325,7 @@ /* check is stereo position effect enabled if is then handle effect */ if (impl->enableStereoPos) { - if (impl->adapCtx->fwtype == FWMgrFWGST) - { - ret = XAVolumeItfAdapt_SetStereoPosition( - (XAAdaptationGstCtx*) impl->adapCtx, stereoPosition); - } - else + if (impl->adapCtx->fwtype == FWMgrFWMMF) { ret = XANokiaVolumeExtItfAdapt_SetStereoPosition( (XAAdaptationMMFCtx*) impl->adapCtx, stereoPosition); diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,221 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Audio Encoder Capabilities Interface Implementation - * - */ - -#include -#include -#include -#include - -#include "xaglobals.h" -#include "xaadptbasectx.h" -#include "xaaudiodecodercapabilitiesitf.h" -#include "xacapabilitiesmgr.h" -/* XAAudioDecoderCapabilitiesItfImpl* GetImpl - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAAudioDecoderCapabilitiesItfImpl* GetImpl( - XAAudioDecoderCapabilitiesItf self) - { - if (self) - { - XAAudioDecoderCapabilitiesItfImpl* impl = - (XAAudioDecoderCapabilitiesItfImpl*) (*self); - if (impl && (impl == impl->self)) - { - return impl; - } - } - return NULL; - } - -/***************************************************************************** - * Base interface XAAudioDecoderCapabilitiesItf implementation - *****************************************************************************/ - -/* XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders - * Description: Retrieves the available audio decoders. - */ -XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders( - XAAudioDecoderCapabilitiesItf self, XAuint32* pNumDecoders, - XAuint32* pDecoderIds) - { - XAAudioDecoderCapabilitiesItfImpl* impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders"); - - if (!impl || !pNumDecoders) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if (pDecoderIds) - { /* query array of decoders */ - if (*pNumDecoders < impl->numCodecs) - { - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - res = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - - XAuint32 i = 0; - XACapabilities temp; - for (i = 0; i < impl->numCodecs; i++) - { - /* query decoder id from adaptation using index value */ - XACapabilitiesMgr_GetCapsByIdx(NULL, - (XACapsType) (XACAP_DECODER | XACAP_AUDIO), i, - &temp); - pDecoderIds[i] = temp.xaid; - } - - } - } - /* return number of decoders */ - *pNumDecoders = impl->numCodecs; - }DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders"); - return res; - } - -/* XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities - * Description: Queries for the audio decoder�s capabilities. - */ -XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities( - XAAudioDecoderCapabilitiesItf self, XAuint32 decoderId, - XAuint32* pIndex, XAAudioCodecDescriptor* pDescriptor) - { - XAAudioDecoderCapabilitiesItfImpl* impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities"); - - if (!impl || !pIndex) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if (!pDescriptor) - { /* query number of capa structures */ - *pIndex = 1; - } - else - { /* query capabilities */ - if (*pIndex >= 1) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - /* query capabilities from adaptation using codec id */ - XACapabilities temp; - memset(pDescriptor, 0, sizeof(XAAudioCodecDescriptor)); - res = XACapabilitiesMgr_GetCapsById(NULL, - (XACapsType) (XACAP_DECODER | XACAP_AUDIO), - decoderId, &temp); - if (res == XA_RESULT_SUCCESS) - { - XAAudioCodecDescriptor* desc = - ((XAAudioCodecDescriptor*) (temp.pEntry)); - /* map applicable values to XAAudioCodecCapabilities */ - pDescriptor->maxChannels = desc->maxChannels; - pDescriptor->minSampleRate = desc->minSampleRate; /* milliHz */ - if (desc->maxSampleRate < (0xFFFFFFFF)) - { - pDescriptor->maxSampleRate = desc->maxSampleRate; - } - else - { - pDescriptor->maxSampleRate = 0xFFFFFFFF; - } - pDescriptor->minBitsPerSample = desc->minBitsPerSample; - pDescriptor->maxBitsPerSample = desc->maxBitsPerSample; - pDescriptor->isFreqRangeContinuous=desc->isFreqRangeContinuous; - pDescriptor->minBitRate = desc->minBitRate; - pDescriptor->maxBitRate = desc->maxBitRate; - pDescriptor->numBitratesSupported - = desc->numBitratesSupported; - pDescriptor->isBitrateRangeContinuous=desc->isBitrateRangeContinuous; - pDescriptor->profileSetting=desc->profileSetting; - pDescriptor->modeSetting=desc->modeSetting; /* no chanmode for pcm defined */ - - } - else - { - /* do nothing */ - } - /*other caps undefined*/ - } - - } - } - - - DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities"); - return res; - } - -/***************************************************************************** - * XAAudioDecoderCapabilitiesItfImpl -specific methods - *****************************************************************************/ - -/* XAAudioDecoderCapabilitiesItfImpl_Create - * Description: Allocate and initialize XAAudioDecoderCapabilitiesItfImpl - */ -XAAudioDecoderCapabilitiesItfImpl* XAAudioDecoderCapabilitiesItfImpl_Create() - { - XAAudioDecoderCapabilitiesItfImpl* self = - (XAAudioDecoderCapabilitiesItfImpl*) calloc(1, - sizeof(XAAudioDecoderCapabilitiesItfImpl)); - - DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_Create"); - - if (self) - { - /* init itf default implementation */ - self->itf.GetAudioDecoders - = XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders; - self->itf.GetAudioDecoderCapabilities - = XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities; - - /* init variables */ - - assert( XACapabilitiesMgr_GetCapsCount(NULL, (XACapsType)(XACAP_DECODER|XACAP_AUDIO), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); - - self->self = self; - }DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_Create"); - return self; - } - -/* void XAAudioDecoderCapabilitiesItfImpl_Free - * Description: Free all resources reserved at XAAudioDecoderCapabilitiesItfImpl_Create - */ -void XAAudioDecoderCapabilitiesItfImpl_Free( - XAAudioDecoderCapabilitiesItfImpl* self) - { - DEBUG_API("->XAAudioDecoderCapabilitiesItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAAudioDecoderCapabilitiesItfImpl_Free"); - } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xaaudiodecodercapabilitiesitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Audio Encoder Itf Header - * - */ - -#ifndef XAAUDIODECODERCAPABILITIESITF_H -#define XAAUDIODECODERCAPABILITIESITF_H - -#include "openmaxalwrapper.h" -#include "xaglobals.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAAudioDecoderCapabilitiesItf implementation */ -typedef struct XAAudioDecoderCapabilitiesItfImpl_ - { - /* parent interface */ - struct XAAudioDecoderCapabilitiesItf_ itf; - /* pointer to self */ - struct XAAudioDecoderCapabilitiesItfImpl_* self; - /* variables */ - XAuint32 numCodecs; - } XAAudioDecoderCapabilitiesItfImpl; - -/* Base interface XAAudioDecoderCapabilitiesItf implementation */ -XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoders( - XAAudioDecoderCapabilitiesItf self, XAuint32* pNumDecoders, - XAuint32* pDecoderIds); - -XAresult XAAudioDecoderCapabilitiesItfImpl_GetAudioDecoderCapabilities( - XAAudioDecoderCapabilitiesItf self, XAuint32 decoderId, - XAuint32* pIndex, XAAudioCodecDescriptor* pDescriptor); - -/* XAAudioDecoderCapabilitiesItfImpl -specific methods */ -XAAudioDecoderCapabilitiesItfImpl* XAAudioDecoderCapabilitiesItfImpl_Create( - void); -void XAAudioDecoderCapabilitiesItfImpl_Free( - XAAudioDecoderCapabilitiesItfImpl* self); - -#endif /* XAAUDIODECODERCAPABILITIESITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaaudioencodercapabilitiesitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -94,7 +94,8 @@ /* return number of encoders */ *pNumEncoders = impl->numCodecs; - }DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders"); + } + DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_GetAudioEncoders"); return res; } @@ -205,7 +206,8 @@ self->numCodecs = 3; self->self = self; - }DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_Create"); + } + DEBUG_API("<-XAAudioEncoderCapabilitiesItfImpl_Create"); return self; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xacameracapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xacameracapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,330 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaglobals.h" -#include "xacameracapabilitiesitf.h" - - -#include "xastaticcameracapsadaptation.h" - - -static XACameraCapabilitiesItfImpl* GetImpl(XACameraCapabilitiesItf self) -{ - if( self ) - { - XACameraCapabilitiesItfImpl* impl = (XACameraCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XACameraCapabilitiesItf implementation - */ -XAresult XACameraCapabilitiesItfImpl_GetCameraCapabilities( - XACameraCapabilitiesItf self, - XAuint32* pIndex, - XAuint32* pCameraDeviceID, - XACameraDescriptor* pDescriptor) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetCameraCapabilities"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetCameraCapabilities(pIndex,pCameraDeviceID,pDescriptor); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetCameraCapabilities"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pPatternID, - XAuint32* pFocusPattern, - XAuint32* pCustomPoints1, - XAuint32* pCustomPoints2) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_QueryFocusRegionPatterns( - cameraDeviceID, pPatternID, pFocusPattern,pCustomPoints1,pCustomPoints2); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedAutoLocks( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pNumCombinations, - XAuint32** ppLocks) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedAutoLocks"); - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedAutoLocks"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedAutoLocks( - cameraDeviceID, pNumCombinations, ppLocks); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedAutoLocks"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAboolean macroEnabled, - XAmillimeter* pMinValue, - XAmillimeter* pMaxValue, - XAuint32* pNumSettings, - XAmillimeter** ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedFocusManualSettings( - cameraDeviceID, macroEnabled,pMinValue, pMaxValue, pNumSettings, ppSettings); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedISOSensitivitySettings( - cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings ); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedApertureManualSettings( - cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings ); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAmicrosecond* pMinValue, - XAmicrosecond* pMaxValue, - XAuint32* pNumSettings, - XAmicrosecond** ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( - cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( - cameraDeviceID, pMinValue, pMaxValue, pNumSettings, ppSettings); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings"); - return ret; -} - - -XAresult XACameraCapabilitiesItfImpl_GetSupportedZoomSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAboolean digitalEnabled, - XAboolean macroEnabled, - XApermille* pMaxValue, - XAuint32* pNumSettings, - XApermille** ppSettings, - XAboolean* pSpeedSupported) -{ - XAresult ret = XA_RESULT_SUCCESS; - XACameraCapabilitiesItfImpl* impl = GetImpl(self); - DEBUG_API("->XACameraCapabilitiesItfImpl_GetSupportedZoomSettings"); - - if( !impl ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedZoomSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XAStaticCameraCaps_GetSupportedZoomSettings( - cameraDeviceID, digitalEnabled, macroEnabled, pMaxValue, - pNumSettings, ppSettings, pSpeedSupported); - - DEBUG_API("<-XACameraCapabilitiesItfImpl_GetSupportedZoomSettings"); - return ret; -} - - -/** - * XACameraCapabilitiesItfImpl -specific methods - **/ -XACameraCapabilitiesItfImpl* XACameraCapabilitiesItfImpl_Create(void) -{ - XACameraCapabilitiesItfImpl* self = (XACameraCapabilitiesItfImpl*) - calloc(1,sizeof(XACameraCapabilitiesItfImpl)); - DEBUG_API("->XACameraCapabilitiesItfImpl_Create"); - - if( self ) - { - /* init itf default implementation */ - self->itf.GetCameraCapabilities = - XACameraCapabilitiesItfImpl_GetCameraCapabilities; - self->itf.QueryFocusRegionPatterns = - XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns; - self->itf.GetSupportedAutoLocks = - XACameraCapabilitiesItfImpl_GetSupportedAutoLocks; - self->itf.GetSupportedFocusManualSettings = - XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings; - self->itf.GetSupportedISOSensitivitySettings = - XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings; - self->itf.GetSupportedApertureManualSettings = - XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings; - self->itf.GetSupportedShutterSpeedManualSettings = - XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings; - self->itf.GetSupportedWhiteBalanceManualSettings = - XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings; - self->itf.GetSupportedZoomSettings = - XACameraCapabilitiesItfImpl_GetSupportedZoomSettings; - - self->self = self; - } - DEBUG_API("<-XACameraCapabilitiesItfImpl_Create"); - return self; -} - -void XACameraCapabilitiesItfImpl_Free(XACameraCapabilitiesItfImpl* self) -{ - DEBUG_API("->XACameraCapabilitiesItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XACameraCapabilitiesItfImpl_Free"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xacameracapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xacameracapabilitiesitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERACAPABILITIESITF_H -#define XACAMERACAPABILITIESITF_H - -#include "openmaxalwrapper.h" -#include "xaglobals.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XACameraCapabilitiesItf implementation */ -typedef struct XACameraCapabilitiesItfImpl_ -{ - /* parent interface */ - struct XACameraCapabilitiesItf_ itf; - /* pointer to self */ - struct XACameraCapabilitiesItfImpl_* self; - /* variables */ -} XACameraCapabilitiesItfImpl; - -/* Base interface XACameraCapabilitiesItf implementation */ -XAresult XACameraCapabilitiesItfImpl_GetCameraCapabilities( - XACameraCapabilitiesItf self, - XAuint32* pIndex, - XAuint32* pCameraDeviceID, - XACameraDescriptor* pDescriptor); - -XAresult XACameraCapabilitiesItfImpl_QueryFocusRegionPatterns( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pPatternID, - XAuint32* pFocusPattern, - XAuint32* pCustomPoints1, - XAuint32* pCustomPoints2); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedAutoLocks( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pNumCombinations, - XAuint32** ppLocks); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedFocusManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAboolean macroEnabled, - XAmillimeter* pMinValue, - XAmillimeter* pMaxValue, - XAuint32* pNumSettings, - XAmillimeter** ppSettings); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedISOSensitivitySettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedApertureManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedShutterSpeedManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAmicrosecond* pMinValue, - XAmicrosecond* pMaxValue, - XAuint32* pNumSettings, - XAmicrosecond** ppSettings); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedWhiteBalanceManualSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings); - -XAresult XACameraCapabilitiesItfImpl_GetSupportedZoomSettings( - XACameraCapabilitiesItf self, - XAuint32 cameraDeviceID, - XAboolean digitalEnabled, - XAboolean macroEnabled, - XApermille* pMaxValue, - XAuint32* pNumSettings, - XApermille** ppSettings, - XAboolean* pSpeedSupported); - -/* XACameraCapabilitiesItfImpl -specific methods */ -XACameraCapabilitiesItfImpl* XACameraCapabilitiesItfImpl_Create(void); -void XACameraCapabilitiesItfImpl_Free(XACameraCapabilitiesItfImpl* self); - -#endif /* XACAMERACAPABILITIESITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xadevicevolumeitf.c --- a/khronosfws/openmax_al/src/engine/xadevicevolumeitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,211 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaglobals.h" -#include "xadevicevolumeitf.h" - -#include "xadevicevolumeitfadaptation.h" - - -static XADeviceVolumeItfImpl* GetImpl(XADeviceVolumeItf self) -{ - if( self ) - { - XADeviceVolumeItfImpl* impl = (XADeviceVolumeItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XADeviceVolumeItf implementation - */ - -/* XAresult XADeviceVolumeItfImpl_GetVolumeScale( XADeviceVolumeItf self, - * XAuint32 deviceID, - * XAint32* pMinValue, - * XAint32* pMaxValue, - * XAboolean* pIsMillibelScale) - * Description: Gets the properties of the volume scale supported by the given device. - */ -XAresult XADeviceVolumeItfImpl_GetVolumeScale( XADeviceVolumeItf self, - XAuint32 deviceID, - XAint32* pMinValue, - XAint32* pMaxValue, - XAboolean* pIsMillibelScale) -{ - XADeviceVolumeItfImpl* impl = GetImpl(self); - XAresult ret = XA_RESULT_SUCCESS; - XAboolean supported = XA_BOOLEAN_FALSE; - DEBUG_API("->XADeviceVolumeItfImpl_GetVolumeScale"); - if( !impl || !pMinValue || !pMaxValue || !pIsMillibelScale ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported((XAAdaptationGstCtx*)impl->adapCtx, deviceID, &supported); - - if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pMinValue = impl->minVolume; - *pMaxValue = impl->maxVolume; - *pIsMillibelScale = impl->ismBscale; - - DEBUG_API("<-XADeviceVolumeItfImpl_GetVolumeScale"); - return ret; -} - -/* XAresult XADeviceVolumeItfImpl_SetVolume( XADeviceVolumeItf self, - * XAuint32 deviceID, - * XAint32 volume) - * Description: Sets the device's volume. - */ -XAresult XADeviceVolumeItfImpl_SetVolume( XADeviceVolumeItf self, - XAuint32 deviceID, - XAint32 volume) -{ - XADeviceVolumeItfImpl* impl = GetImpl(self); - XAresult ret = XA_RESULT_SUCCESS; - - XAboolean supported = XA_BOOLEAN_FALSE; - - DEBUG_API("->XADeviceVolumeItfImpl_SetVolume"); - - if( !impl || volume < impl->minVolume || volume > impl->maxVolume ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported((XAAdaptationGstCtx*)impl->adapCtx, deviceID, &supported); - if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XADeviceVolumeItfAdapt_SetVolume((XAAdaptationGstCtx*)impl->adapCtx, deviceID, volume); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->curVolume = volume; - } - - DEBUG_API("<-XADeviceVolumeItfImpl_SetVolume"); - return ret; -} - -/* XAresult XADeviceVolumeItfImpl_GetVolume( XADeviceVolumeItf self, - * XAuint32 deviceID, - * XAint32 * pVolume) - * Description: Gets the device's volume. - */ -XAresult XADeviceVolumeItfImpl_GetVolume( XADeviceVolumeItf self, - XAuint32 deviceID, - XAint32 * pVolume) -{ - XADeviceVolumeItfImpl* impl = GetImpl(self); - XAresult ret = XA_RESULT_SUCCESS; - XAboolean supported = XA_BOOLEAN_FALSE; - DEBUG_API("->XADeviceVolumeItfImpl_GetVolume"); - - if( !impl || !pVolume ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XADeviceVolumeItfAdapt_IsDeviceIDSupported((XAAdaptationGstCtx*)impl->adapCtx, deviceID, &supported); - - if( ret != XA_RESULT_SUCCESS || supported != XA_BOOLEAN_TRUE ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume"); - return XA_RESULT_PARAMETER_INVALID; - } - *pVolume = impl->curVolume; - DEBUG_API("<-XADeviceVolumeItfImpl_GetVolume"); - return XA_RESULT_SUCCESS; -} - -/** - * XADeviceVolumeItfImpl -specific methods - **/ - -/** - * XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx) - * Description: Allocate and initialize DeviceVolumeImpl - **/ -XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XADeviceVolumeItfImpl* self = (XADeviceVolumeItfImpl*) - calloc(1,sizeof(XADeviceVolumeItfImpl)); - DEBUG_API("->XADeviceVolumeItfImpl_Create"); - - if(self) - { - /* init itf default implementation */ - self->itf.GetVolumeScale = - XADeviceVolumeItfImpl_GetVolumeScale; - self->itf.GetVolume = - XADeviceVolumeItfImpl_GetVolume; - self->itf.SetVolume = - XADeviceVolumeItfImpl_SetVolume; - - /* init variables */ - /* these values are replaced by adaptation in init phase */ - self->curVolume = DEFAULTDEVICEVOLUME; - self->minVolume = DEFAULTDEVICEMINVOLUME; - self->maxVolume = DEFAULTDEVICEMAXVOLUME; - self->ismBscale = DEFAULTSCALEISMILLIBEL; - - self->adapCtx = adapCtx; - self->self = self; - } - DEBUG_API("<-XADeviceVolumeItfImpl_Create"); - return self; -} - -/* void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self) - * Description: Free all resources reserved at XADeviceVolumeItfImpl_Create - */ -void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self) -{ - DEBUG_API("->XADeviceVolumeItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XADeviceVolumeItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xadevicevolumeitf.h --- a/khronosfws/openmax_al/src/engine/xadevicevolumeitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADEVICEVOLUMEITF_H -#define XADEVICEVOLUMEITF_H - -#include "xaadptbasectx.h" - -/** MACROS **/ -#define DEFAULTDEVICEVOLUME 5 -#define DEFAULTDEVICEMINVOLUME 0 -#define DEFAULTDEVICEMAXVOLUME 10 -#define DEFAULTSCALEISMILLIBEL XA_BOOLEAN_FALSE -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XADeviceVolumeItf implementation */ -typedef struct XADeviceVolumeItfImpl_ -{ - /* parent interface */ - struct XADeviceVolumeItf_ itf; - /* pointer to self */ - struct XADeviceVolumeItfImpl_* self; - - /* variables */ - - XAint32 curVolume; - XAint32 minVolume; - XAint32 maxVolume; - XAboolean ismBscale; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - -} XADeviceVolumeItfImpl; - -/* Base interface XADeviceVolumeItf implementation */ -XAresult XADeviceVolumeItfImpl_GetVolumeScale( - XADeviceVolumeItf self, - XAuint32 deviceID, - XAint32 * pMinValue, - XAint32 * pMaxValue, - XAboolean * pIsMillibelScale); -XAresult XADeviceVolumeItfImpl_SetVolume( - XADeviceVolumeItf self, - XAuint32 deviceID, - XAint32 volume); -XAresult XADeviceVolumeItfImpl_GetVolume( - XADeviceVolumeItf self, - XAuint32 deviceID, - XAint32 * pVolume); - -/* XADeviceVolumeItfImpl -specific methods */ -XADeviceVolumeItfImpl* XADeviceVolumeItfImpl_Create(XAAdaptationBaseCtx *adapCtx); - -void XADeviceVolumeItfImpl_Free(XADeviceVolumeItfImpl* self); - -#endif /* XADEVICEVOLUMEITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaengine.c --- a/khronosfws/openmax_al/src/engine/xaengine.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaengine.c Fri Jul 09 16:43:35 2010 -0500 @@ -25,18 +25,10 @@ #include "xathreadsyncitf.h" #include "xadynintmgmtitf.h" #include "xaaudioiodevicecapabilitiesitf.h" -#include "xaaudiodecodercapabilitiesitf.h" #include "xaaudioencodercapabilitiesitf.h" -#include "xaimagedecodercapabilitiesitf.h" -#include "xaimageencodercapabilitiesitf.h" -#include "xavideodecodercapabilitiesitf.h" -#include "xavideoencodercapabilitiesitf.h" -#include "xacameracapabilitiesitf.h" -#include "xadevicevolumeitf.h" #include "xaconfigextensionsitf.h" #include "xathreadsafety.h" #include "xaframeworkmgr.h" -#include "xastaticcameracapsadaptation.h" /* Static mapping of enumeration XAEngineInterfaces to interface iids */ static const XAInterfaceID* xaEngineItfIIDs[ENGINE_ITFCOUNT] = @@ -80,7 +72,8 @@ if (!pEngine) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineImpl_Create"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAEngineImpl_Create"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -107,7 +100,8 @@ pImpl = (XAEngineImpl*) calloc(1, sizeof(XAEngineImpl)); if (!pImpl) { - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");DEBUG_API("<-XAEngineImpl_Create"); + DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); + DEBUG_API("<-XAEngineImpl_Create"); /* memory allocation failed */ return XA_RESULT_MEMORY_FAILURE; } @@ -142,7 +136,8 @@ { /* required interface cannot be accommodated - fail creation */ XAObjectItfImpl_Destroy((XAObjectItf) &(pBaseObj)); - DEBUG_ERR("Required interface not found - abort creation!");DEBUG_API("<-XAEngineImpl_Create"); + DEBUG_ERR("Required interface not found - abort creation!"); + DEBUG_API("<-XAEngineImpl_Create"); return XA_RESULT_FEATURE_UNSUPPORTED; } else @@ -191,7 +186,8 @@ } else { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAEngineImpl_QueryNumSupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; } } @@ -293,41 +289,13 @@ pItf = XAAudioEncoderCapabilitiesItfImpl_Create( pObjImpl->capabilities); break; - /* - case ENGINE_AUDIODECODERCAPAITF: - pItf = XAAudioDecoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_CONFIGEXTENSIONSITF: - pItf = XAConfigExtensionsItfImpl_Create(); - break; - case ENGINE_DEVICEVOLUMEITF: - pItf = XADeviceVolumeItfImpl_Create(pObjImpl->adaptationCtx); - break; - case ENGINE_CAMERACAPAITF: - - XAStaticCameraCaps_Init(); - pItf = XACameraCapabilitiesItfImpl_Create(); - - break; - case ENGINE_IMAGEDECODERCAPAITF: - pItf = XAImageDecoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_IMAGEENCODERCAPAITF: - pItf = XAImageEncoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_VIDEODECODERCAPAITF: - pItf = XAVideoDecoderCapabilitiesItfImpl_Create(); - break; - case ENGINE_VIDEOENCODERCAPAITF: - pItf = XAVideoEncoderCapabilitiesItfImpl_Create(); - break; - */ default: break; } if (!pItf) { - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE");DEBUG_API("<-XAEngineImpl_DoRealize"); + DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); + DEBUG_API("<-XAEngineImpl_DoRealize"); /* memory allocation failed */ return XA_RESULT_MEMORY_FAILURE; } @@ -348,7 +316,8 @@ */ XAresult XAEngineImpl_DoResume(XAObjectItf self) { - DEBUG_API("->XAEngineImpl_DoResume");DEBUG_API("<-XAEngineImpl_DoResume"); + DEBUG_API("->XAEngineImpl_DoResume"); + DEBUG_API("<-XAEngineImpl_DoResume"); return XA_RESULT_PRECONDITIONS_VIOLATED; } @@ -387,34 +356,6 @@ case ENGINE_AUDIOENCODERCAPAITF: XAAudioEncoderCapabilitiesItfImpl_Free(pItf); break; - /* - case ENGINE_AUDIODECODERCAPAITF: - XAAudioDecoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_CONFIGEXTENSIONSITF: - XAConfigExtensionsItfImpl_Free(pItf); - break; - case ENGINE_DEVICEVOLUMEITF: - XADeviceVolumeItfImpl_Free(pItf); - break; - case ENGINE_CAMERACAPAITF: - - XACameraCapabilitiesItfImpl_Free(pItf); - - break; - case ENGINE_IMAGEDECODERCAPAITF: - XAImageDecoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_IMAGEENCODERCAPAITF: - XAImageEncoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_VIDEODECODERCAPAITF: - XAVideoDecoderCapabilitiesItfImpl_Free(pItf); - break; - case ENGINE_VIDEOENCODERCAPAITF: - XAVideoEncoderCapabilitiesItfImpl_Free(pItf); - break; - */ default: break; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaengineitf.c --- a/khronosfws/openmax_al/src/engine/xaengineitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xaengineitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -19,8 +19,6 @@ #include #include #include "xaengineitf.h" -#include "xavibraitf.h" -#include "xaledarrayitf.h" #include "xaobjects.h" #include "xacapabilitiesmgr.h" /*static XAchar implementationText[] = "Implementation does not conform to AL Spec";*/ @@ -73,9 +71,7 @@ const XAInterfaceID *pInterfaceIds, const XAboolean *pInterfaceRequired) { - return XALEDArrayDeviceImpl_CreateLEDArrayDevice( - ((XAEngineItfImpl*) self)->mapper, pDevice, deviceID, - numInterfaces, pInterfaceIds, pInterfaceRequired); + return XA_RESULT_FEATURE_UNSUPPORTED; } XAresult XAEngineItfImpl_CreateVibraDevice(XAEngineItf self, @@ -83,9 +79,7 @@ const XAInterfaceID *pInterfaceIds, const XAboolean *pInterfaceRequired) { - return XAVibraDeviceImpl_CreateVibraDevice( - ((XAEngineItfImpl*) self)->mapper, pDevice, deviceID, - numInterfaces, pInterfaceIds, pInterfaceRequired); + return XA_RESULT_FEATURE_UNSUPPORTED; } XAresult XAEngineItfImpl_CreateMediaPlayer(XAEngineItf self, @@ -118,9 +112,7 @@ XAuint32 numInterfaces, const XAInterfaceID *pInterfaceIds, const XAboolean *pInterfaceRequired) { - XAEngineItfImpl* impl = GetImpl(self); - return XAOMixImpl_CreateOutputMix(impl->mapper, impl->capabilities, pMix, - numInterfaces, pInterfaceIds, pInterfaceRequired); + return XA_RESULT_FEATURE_UNSUPPORTED; } XAresult XAEngineItfImpl_CreateMetadataExtractor(XAEngineItf self, @@ -153,7 +145,8 @@ if (!pMajor || !pMinor || !pStep) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAEngineItfImpl_GetImplementationInfo"); return XA_RESULT_PARAMETER_INVALID; } /* OpenMAX AL API ver 1.0.1 */ @@ -197,7 +190,8 @@ if (!pNumSupportedInterfaces) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAEngineItfImpl_QueryNumSupportedInterfaces"); return XA_RESULT_PARAMETER_INVALID; } *pNumSupportedInterfaces = 0; @@ -215,28 +209,10 @@ res = XAMediaRecorderImpl_QueryNumSupportedInterfaces( pNumSupportedInterfaces); break; - case XA_OBJECTID_OUTPUTMIX: - res = XAOMixImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); - break; -#ifdef OMAX_CAMERABIN - case XA_OBJECTID_CAMERADEVICE: - res = XACameraDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); - break; -#endif case XA_OBJECTID_RADIODEVICE: res = XARadioDeviceImpl_QueryNumSupportedInterfaces( pNumSupportedInterfaces); break; - case XA_OBJECTID_LEDDEVICE: - res = XALEDArrayDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); - break; - case XA_OBJECTID_VIBRADEVICE: - res = XAVibraDeviceImpl_QueryNumSupportedInterfaces( - pNumSupportedInterfaces); - break; case XA_OBJECTID_METADATAEXTRACTOR: res = XAMetadataExtractorImpl_QueryNumSupportedInterfaces( pNumSupportedInterfaces); @@ -276,27 +252,10 @@ res = XAMediaRecorderImpl_QuerySupportedInterfaces(index, pInterfaceId); break; - case XA_OBJECTID_OUTPUTMIX: - res = XAOMixImpl_QuerySupportedInterfaces(index, pInterfaceId); - break; -#ifdef OMAX_CAMERABIN - case XA_OBJECTID_CAMERADEVICE: - res = XACameraDeviceImpl_QuerySupportedInterfaces( - index, pInterfaceId ); - break; -#endif case XA_OBJECTID_RADIODEVICE: res = XARadioDeviceImpl_QuerySupportedInterfaces(index, pInterfaceId); break; - case XA_OBJECTID_LEDDEVICE: - res = XALEDArrayDeviceImpl_QuerySupportedInterfaces(index, - pInterfaceId); - break; - case XA_OBJECTID_VIBRADEVICE: - res = XAVibraDeviceImpl_QuerySupportedInterfaces(index, - pInterfaceId); - break; case XA_OBJECTID_METADATAEXTRACTOR: res = XAMetadataExtractorImpl_QuerySupportedInterfaces(index, pInterfaceId); @@ -313,9 +272,7 @@ XAuint32 *pIndex, XAuint32 *pLEDDeviceID, XALEDDescriptor *pDescriptor) { - - XALEDDescriptor descriptor; - + XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAEngineItfImpl_QueryLEDCapabilities"); if (!pDescriptor) @@ -326,52 +283,26 @@ DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); return XA_RESULT_PARAMETER_INVALID; } - /* Number of devices */ - *pIndex = 1; + else + { + /* Number of devices */ + *pIndex = 0; + } } else { - - /* query device capabilities */ - if (pIndex) - { - if (*pIndex == 0) - { - if (!pLEDDeviceID) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - *pLEDDeviceID = XA_ADAPTID_LEDARRAY; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - } - - if (*pLEDDeviceID == XA_ADAPTID_LEDARRAY) - { - descriptor.colorMask = COLOR_MASK; - descriptor.ledCount = LED_COUNT; - descriptor.primaryLED = PRIMARY_LED; - *pDescriptor = descriptor; - } - - }DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); - return XA_RESULT_SUCCESS; + // return NotSupported below + res = XA_RESULT_FEATURE_UNSUPPORTED; + } + DEBUG_API("<-XAEngineItfImpl_QueryLEDCapabilities"); + return res; } XAresult XAEngineItfImpl_QueryVibraCapabilities(XAEngineItf self, XAuint32 *pIndex, XAuint32 *pVibraDeviceID, XAVibraDescriptor *pDescriptor) { - - XAVibraDescriptor descriptor; - + XAresult res = XA_RESULT_SUCCESS; DEBUG_API("->XAEngineItfImpl_QueryVibraCapabilities"); if (!pDescriptor) @@ -380,49 +311,22 @@ { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; + res = XA_RESULT_PARAMETER_INVALID; } - /* Number of devices */ - *pIndex = 1; + else + { + /* Number of devices */ + *pIndex = 0; + } } else { - - /* query device capabilities */ - if (pIndex) - { - if (*pIndex == 0) - { - if (!pVibraDeviceID) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pVibraDeviceID = XA_ADAPTID_VIBRA; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - } - - if (*pVibraDeviceID == XA_ADAPTID_VIBRA) - { - descriptor.minFrequency = MIN_FREQUENCY; - descriptor.maxFrequency = MAX_FREQUENCY; - descriptor.supportsFrequency = XA_BOOLEAN_TRUE; - descriptor.supportsIntensity = XA_BOOLEAN_TRUE; - *pDescriptor = descriptor; - } - + // return NotSupported below + res = XA_RESULT_FEATURE_UNSUPPORTED; } DEBUG_API("<-XAEngineItfImpl_QueryVibraCapabilities"); - return XA_RESULT_SUCCESS; + return res; } XAresult XAEngineItfImpl_QueryNumSupportedExtensions(XAEngineItf self, diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaimagedecodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaimagedecodercapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include "xaglobals.h" -#include "xaimagedecodercapabilitiesitf.h" - -#include "xacapabilitiesmgr.h" - -/* XAImageDecoderCapabilitiesItfImpl* GetImpl - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAImageDecoderCapabilitiesItfImpl* GetImpl(XAImageDecoderCapabilitiesItf self) -{ - if( self ) - { - XAImageDecoderCapabilitiesItfImpl* impl = (XAImageDecoderCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAImageDecoderCapabilitiesItf implementation - **/ - -/* XAresult XAImageDecoderCapabilitiesItfImpl_GetImageDecoderCapabilities - * Description: Retrieves image decoder capabilities. - */ -XAresult XAImageDecoderCapabilitiesItfImpl_GetImageDecoderCapabilities( - XAImageDecoderCapabilitiesItf self, - XAuint32* pDecoderId, - XAImageCodecDescriptor* pDescriptor) -{ - XAImageDecoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageDecoderCapabilitiesItfImpl_GetImageDecoderCapabilities"); - - impl = GetImpl(self); - if( !impl || !pDecoderId ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if( !pDescriptor ) - { /* query number of image decoders */ - *pDecoderId = impl->numCodecs; - } - else - { - /* query capabilities from adaptation using codec id */ - - XACapabilities temp; - memset(pDescriptor,0,sizeof(XAImageCodecDescriptor)); - /* here pEncoderId refers to index rather than codec id */ - res = XACapabilitiesMgr_GetCapsByIdx(NULL, (XACapsType)(XACAP_DECODER|XACAP_IMAGE), *pDecoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - XAImageCodecDescriptor* desc = (XAImageCodecDescriptor*)(&temp.pEntry); - /* map applicable values to XAAudioCodecCapabilities */ - pDescriptor->codecId = temp.xaid; - pDescriptor->maxWidth = desc->maxWidth; - pDescriptor->maxHeight = desc->maxHeight; - } - - } - } - - DEBUG_API("<-XAImageDecoderCapabilitiesItfImpl_GetImageDecoderCapabilities"); - return res; -} - -/* XAresult XAImageDecoderCapabilitiesItfImpl_QueryColorFormats - * Description: This method is used to query the color formats supported - * by the image decoder. - */ -XAresult XAImageDecoderCapabilitiesItfImpl_QueryColorFormats( - const XAImageDecoderCapabilitiesItf self, - XAuint32* pIndex, - XAuint32* pColorFormats) -{ - XAImageDecoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageDecoderCapabilitiesItfImpl_QueryColorFormats"); - impl = GetImpl(self); - if( !impl || !pIndex ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - res = XACapabilitiesMgr_QueryColorFormats(NULL, pIndex, pColorFormats); - - } - DEBUG_API("<-XAImageDecoderCapabilitiesItfImpl_QueryColorFormats"); - return res; -} - -/** - * XAImageDecoderCapabilitiesItfImpl -specific methods - **/ - -/* XAImageDecoderCapabilitiesItfImpl_Create - * Description: Allocate and initialize XAImageDecoderCapabilitiesItfImpl - */ -XAImageDecoderCapabilitiesItfImpl* XAImageDecoderCapabilitiesItfImpl_Create() -{ - XAImageDecoderCapabilitiesItfImpl* self = (XAImageDecoderCapabilitiesItfImpl*) - calloc(1,sizeof(XAImageDecoderCapabilitiesItfImpl)); - DEBUG_API("->XAImageDecoderCapabilitiesItfImpl_Create"); - - if( self ) - { - /* init itf default implementation */ - self->itf.GetImageDecoderCapabilities = - XAImageDecoderCapabilitiesItfImpl_GetImageDecoderCapabilities; - self->itf.QueryColorFormats = - XAImageDecoderCapabilitiesItfImpl_QueryColorFormats; - - - /* init variables */ - assert( XACapabilitiesMgr_GetCapsCount( NULL, (XACapsType)(XACAP_DECODER|XACAP_IMAGE), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); - - self->self = self; - } - DEBUG_API("<-XAImageDecoderCapabilitiesItfImpl_Create"); - return self; -} - -/* void XAImageDecoderCapabilitiesItfImpl_Free - * Description: Free all resources reserved at XAImageDecoderCapabilitiesItfImpl - */ -void XAImageDecoderCapabilitiesItfImpl_Free(XAImageDecoderCapabilitiesItfImpl* self) -{ - DEBUG_API("->XAImageDecoderCapabilitiesItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAImageDecoderCapabilitiesItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaimagedecodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xaimagedecodercapabilitiesitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEDECODERCAPABILITIESITF_H -#define XAIMAGEDECODERCAPABILITIESITF_H - -#include "openmaxalwrapper.h" -#include "xaglobals.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAImageDecoderCapabilitiesItf implementation */ -typedef struct XAImageDecoderCapabilitiesItfImpl_ -{ - /* parent interface */ - struct XAImageDecoderCapabilitiesItf_ itf; - /* pointer to self */ - struct XAImageDecoderCapabilitiesItfImpl_* self; - /* variables */ - XAuint32 numCodecs; -} XAImageDecoderCapabilitiesItfImpl; - -/* Base interface XAImageDecoderCapabilitiesItf implementation */ -XAresult XAImageDecoderCapabilitiesItfImpl_GetImageDecoderCapabilities( - XAImageDecoderCapabilitiesItf self, - XAuint32* pDecoderId, - XAImageCodecDescriptor* pDescriptor); - -XAresult XAImageDecoderCapabilitiesItfImpl_QueryColorFormats( - const XAImageDecoderCapabilitiesItf self, - XAuint32* pIndex, - XAuint32* pColorFormats); - -/* XAImageDecoderCapabilitiesItfImpl -specific methods */ -XAImageDecoderCapabilitiesItfImpl* XAImageDecoderCapabilitiesItfImpl_Create(void); -void XAImageDecoderCapabilitiesItfImpl_Free(XAImageDecoderCapabilitiesItfImpl* self); - -#endif /* XAIMAGEDECODERCAPABILITIESITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaimageencodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xaimageencodercapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,164 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "xaglobals.h" -#include "xaimageencodercapabilitiesitf.h" -#include "xacapabilitiesmgr.h" -/* XAImageEncoderCapabilitiesItfImpl* GetImpl - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAImageEncoderCapabilitiesItfImpl* GetImpl(XAImageEncoderCapabilitiesItf self) -{ - if( self ) - { - XAImageEncoderCapabilitiesItfImpl* impl = (XAImageEncoderCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAImageEncoderCapabilitiesItf implementation - **/ - -/* XAresult XAImageEncoderCapabilitiesItfImpl_GetImageEncoderCapabilities - * Description: Retrieves image encoder capabilities. - */ -XAresult XAImageEncoderCapabilitiesItfImpl_GetImageEncoderCapabilities( - XAImageEncoderCapabilitiesItf self, - XAuint32* pEncoderId, - XAImageCodecDescriptor* pDescriptor) -{ - XAImageEncoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageEncoderCapabilitiesItfImpl_GetImageEncoderCapabilities"); - - impl = GetImpl(self); - - if( !impl || !pEncoderId ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if( !pDescriptor ) - { /* query number of image encoders */ - *pEncoderId = impl->numCodecs; - } - else - { - /* query capabilities from adaptation using codec id */ - - XACapabilities temp; - memset(pDescriptor,0,sizeof(XAImageCodecDescriptor)); - /* here pEncoderId refers to index rather than codec id */ - res = XACapabilitiesMgr_GetCapsByIdx(NULL, (XACapsType)(XACAP_ENCODER|XACAP_IMAGE), *pEncoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - XAImageCodecDescriptor* desc = (XAImageCodecDescriptor*)(&temp.pEntry); - /* map applicable values to XAAudioCodecCapabilities */ - pDescriptor->codecId = temp.xaid; - pDescriptor->maxWidth = desc->maxWidth; - pDescriptor->maxHeight = desc->maxHeight; - } - - } - } - - DEBUG_API("<-XAImageEncoderCapabilitiesItfImpl_GetImageEncoderCapabilities"); - return res; -} - -/* XAresult XAImageEncoderCapabilitiesItfImpl_QueryColorFormats - * Description: This method is used to query the color formats supported - * by the image encoder. - */ -XAresult XAImageEncoderCapabilitiesItfImpl_QueryColorFormats( - const XAImageEncoderCapabilitiesItf self, - XAuint32* pIndex, - XAuint32* pColorFormats) -{ - XAImageEncoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageEncoderCapabilitiesItfImpl_QueryColorFormats"); - - impl = GetImpl(self); - if( !impl || !pIndex ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - res = XACapabilitiesMgr_QueryColorFormats(NULL, pIndex, pColorFormats); - - } - DEBUG_API("<-XAImageEncoderCapabilitiesItfImpl_QueryColorFormats"); - return res; -} - -/** - * XAImageEncoderCapabilitiesItfImpl -specific methods - **/ - -/* XAImageEncoderCapabilitiesItfImpl_Create - * Description: Allocate and initialize XAImageEncoderCapabilitiesItfImpl - */ -XAImageEncoderCapabilitiesItfImpl* XAImageEncoderCapabilitiesItfImpl_Create() -{ - XAImageEncoderCapabilitiesItfImpl* self = (XAImageEncoderCapabilitiesItfImpl*) - calloc(1,sizeof(XAImageEncoderCapabilitiesItfImpl)); - DEBUG_API("->XAImageEncoderCapabilitiesItfImpl_Create"); - - if( self ) - { - /* init itf default implementation */ - self->itf.GetImageEncoderCapabilities = - XAImageEncoderCapabilitiesItfImpl_GetImageEncoderCapabilities; - self->itf.QueryColorFormats = - XAImageEncoderCapabilitiesItfImpl_QueryColorFormats; - - - /* init variables */ - assert( XACapabilitiesMgr_GetCapsCount( NULL, (XACapsType)(XACAP_ENCODER|XACAP_IMAGE), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); - - self->self = self; - } - DEBUG_API("<-XAImageEncoderCapabilitiesItfImpl_Create"); - return self; -} - -/* void XAImageEncoderCapabilitiesItfImpl_Free - * Description: Free all resources reserved at XAImageEncoderCapabilitiesItfImpl - */ -void XAImageEncoderCapabilitiesItfImpl_Free(XAImageEncoderCapabilitiesItfImpl* self) -{ - DEBUG_API("->XAImageEncoderCapabilitiesItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAImageEncoderCapabilitiesItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xaimageencodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xaimageencodercapabilitiesitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEENCODERCAPABILITIESITF_H -#define XAIMAGEENCODERCAPABILITIESITF_H - -#include "openmaxalwrapper.h" -#include "xaglobals.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAImageEncoderCapabilitiesItf implementation */ -typedef struct XAImageEncoderCapabilitiesItfImpl_ -{ - /* parent interface */ - struct XAImageEncoderCapabilitiesItf_ itf; - /* pointer to self */ - struct XAImageEncoderCapabilitiesItfImpl_* self; - /* variables */ - XAuint32 numCodecs; -} XAImageEncoderCapabilitiesItfImpl; - -/* Base interface XAImageEncoderCapabilitiesItf implementation */ -XAresult XAImageEncoderCapabilitiesItfImpl_GetImageEncoderCapabilities( - XAImageEncoderCapabilitiesItf self, - XAuint32* pEncoderId, - XAImageCodecDescriptor* pDescriptor); - -XAresult XAImageEncoderCapabilitiesItfImpl_QueryColorFormats( - const XAImageEncoderCapabilitiesItf self, - XAuint32* pIndex, - XAuint32* pColorFormats); - -/* XAImageEncoderCapabilitiesItfImpl -specific methods */ -XAImageEncoderCapabilitiesItfImpl* XAImageEncoderCapabilitiesItfImpl_Create(void); -void XAImageEncoderCapabilitiesItfImpl_Free(XAImageEncoderCapabilitiesItfImpl* self); - -#endif /* XAIMAGEENCODERCAPABILITIESITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xathreadsyncitf.c --- a/khronosfws/openmax_al/src/engine/xathreadsyncitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/engine/xathreadsyncitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -53,7 +53,8 @@ { impl->engInCritical = XA_BOOLEAN_TRUE; } - }DEBUG_API("<-XAThreadSyncItfImpl_EnterCriticalSection"); + } + DEBUG_API("<-XAThreadSyncItfImpl_EnterCriticalSection"); return ret; } @@ -85,7 +86,8 @@ /* The engine must be in critical section state */ DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); ret = XA_RESULT_PRECONDITIONS_VIOLATED; - }DEBUG_API("<-XAThreadSyncItfImpl_ExitCriticalSection"); + } + DEBUG_API("<-XAThreadSyncItfImpl_ExitCriticalSection"); return ret; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xavideodecodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xavideodecodercapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - - -#include "xaglobals.h" -#include "xavideodecodercapabilitiesitf.h" -#include "xacapabilitiesmgr.h" - - -/* XAVideoDecoderCapabilitiesItfImpl* GetImpl - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAVideoDecoderCapabilitiesItfImpl* GetImpl(XAVideoDecoderCapabilitiesItf self) -{ - if( self ) - { - XAVideoDecoderCapabilitiesItfImpl* impl = (XAVideoDecoderCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAVideoDecoderCapabilitiesItf implementation - **/ - -/* XAresult XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoders - * Description: Retrieves available video decoders. - */ -XAresult XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoders( - XAVideoDecoderCapabilitiesItf self, - XAuint32* pNumDecoders, - XAuint32* pDecoderIds) -{ - XAVideoDecoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoders"); - - impl = GetImpl(self); - if( !impl || !pNumDecoders ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if( pDecoderIds ) - { /* query array of decoders */ - if( *pNumDecoders < impl->numCodecs ) - { - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - res = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - - - XAuint32 i = 0; - XACapabilities temp; - for( i=0; inumCodecs; i++ ) - { - /* query decoder id from adaptation using index value */ - XACapabilitiesMgr_GetCapsByIdx(NULL, (XACapsType)(XACAP_DECODER|XACAP_VIDEO), i, &temp); - pDecoderIds[i] = temp.xaid; - } - - } - } - /* return number of decoders */ - *pNumDecoders = impl->numCodecs; - } - - DEBUG_API("<-XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoders"); - return res; -} - -/* XAresult XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoderCapabilities - * Description: Retrieves video decoder capabilities. - */ -XAresult XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoderCapabilities( - XAVideoDecoderCapabilitiesItf self, - XAuint32 decoderId, - XAuint32* pIndex, - XAVideoCodecDescriptor* pDescriptor) -{ - XAVideoDecoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAVideoDecoderCapabilitiesItfImpl_GetDecoderCapabilities"); - impl = GetImpl(self); - - if( !impl || !pIndex ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if( !pDescriptor ) - { /* query number of capa structures */ - *pIndex = 1; - } - else - { /* query capabilities */ - if( *pIndex >= 1 ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - /* query capabilities from adaptation using codec id */ - - XACapabilities temp; - memset(pDescriptor,0,sizeof(XAVideoCodecDescriptor)); - res = XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_DECODER|XACAP_VIDEO), decoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - XAVideoCodecDescriptor* desc = (XAVideoCodecDescriptor*)(&temp.pEntry); - /* map applicable values to XAVideoCodecCapabilities */ - pDescriptor->codecId = temp.xaid; - pDescriptor->maxWidth = desc->maxWidth; - pDescriptor->maxHeight = desc->maxHeight; - pDescriptor->maxFrameRate = (desc->maxFrameRate & 0xffff)<<16; - pDescriptor->maxBitRate = desc->maxBitRate; - /*other caps undefined*/ - pDescriptor->rateControlSupported = 0; /* reserved in decoders */ - pDescriptor->profileSetting = 0; /* unknown for theora or motionjpeg */ - pDescriptor->levelSetting = 0; /* unknown for theora or motionjpeg */ - } - - } - } - } - - DEBUG_API("<-XAVideoDecoderCapabilitiesItfImpl_GetDecoderCapabilities"); - return res; -} - -/** - * XAVideoDecoderCapabilitiesItfImpl -specific methods - **/ - -/* XAVideoDecoderCapabilitiesItfImpl_Create - * Description: Allocate and initialize XAVideoDecoderCapabilitiesItfImpl - */ -XAVideoDecoderCapabilitiesItfImpl* XAVideoDecoderCapabilitiesItfImpl_Create() -{ - XAVideoDecoderCapabilitiesItfImpl* self = (XAVideoDecoderCapabilitiesItfImpl*) - calloc(1,sizeof(XAVideoDecoderCapabilitiesItfImpl)); - DEBUG_API("->XAVideoDecoderCapabilitiesItfImpl_Create"); - - if( self ) - { - /* init itf default implementation */ - self->itf.GetVideoDecoders = - XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoders; - self->itf.GetVideoDecoderCapabilities = - XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoderCapabilities; - - - /* init variables */ - assert( XACapabilitiesMgr_GetCapsCount( NULL, (XACapsType)(XACAP_DECODER|XACAP_VIDEO), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); - - self->self = self; - } - DEBUG_API("<-XAVideoDecoderCapabilitiesItfImpl_Create"); - return self; -} - -/* void XAVideoDecoderCapabilitiesItfImpl_Free - * Description: Free all resources reserved at XAVideoDecoderCapabilitiesItfImpl_Create - */ -void XAVideoDecoderCapabilitiesItfImpl_Free(XAVideoDecoderCapabilitiesItfImpl* self) -{ - DEBUG_API("->XAVideoDecoderCapabilitiesItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAVideoDecoderCapabilitiesItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xavideodecodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xavideodecodercapabilitiesitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEODECODERCAPABILITIESITF_H -#define XAVIDEODECODERCAPABILITIESITF_H - -#include "openmaxalwrapper.h" -#include "xaglobals.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAVideoDecoderCapabilitiesItf implementation */ -typedef struct XAVideoDecoderCapabilitiesItfImpl_ -{ - /* parent interface */ - struct XAVideoDecoderCapabilitiesItf_ itf; - /* pointer to self */ - struct XAVideoDecoderCapabilitiesItfImpl_* self; - /* variables */ - XAuint32 numCodecs; -} XAVideoDecoderCapabilitiesItfImpl; - -/* Base interface XAVideoDecoderCapabilitiesItf implementation */ -XAresult XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoders( - XAVideoDecoderCapabilitiesItf self, - XAuint32* pNumDecoders, - XAuint32* pDecoderIds); - -XAresult XAVideoDecoderCapabilitiesItfImpl_GetVideoDecoderCapabilities( - XAVideoDecoderCapabilitiesItf self, - XAuint32 decoderId, - XAuint32* pIndex, - XAVideoCodecDescriptor* pDescriptor); - -/* XAVideoDecoderCapabilitiesItfImpl -specific methods */ -XAVideoDecoderCapabilitiesItfImpl* XAVideoDecoderCapabilitiesItfImpl_Create(void); -void XAVideoDecoderCapabilitiesItfImpl_Free(XAVideoDecoderCapabilitiesItfImpl* self); - -#endif /* XAVIDEODECODERCAPABILITIESITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xavideoencodercapabilitiesitf.c --- a/khronosfws/openmax_al/src/engine/xavideoencodercapabilitiesitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,200 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include - -#include "xaglobals.h" -#include "xavideoencodercapabilitiesitf.h" - -#include "xacapabilitiesmgr.h" - -/* XAVideoEncoderCapabilitiesItfImpl* GetImpl - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAVideoEncoderCapabilitiesItfImpl* GetImpl(XAVideoEncoderCapabilitiesItf self) -{ - if( self ) - { - XAVideoEncoderCapabilitiesItfImpl* impl = (XAVideoEncoderCapabilitiesItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAVideoEncoderCapabilitiesItf implementation - **/ - -/* XAresult XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoders - * Description: Retrieves available video encoders. - */ -XAresult XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoders( - XAVideoEncoderCapabilitiesItf self, - XAuint32* pNumEncoders, - XAuint32* pEncoderIds) -{ - XAVideoEncoderCapabilitiesItfImpl* impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - DEBUG_API("->XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoders"); - - if( !impl || !pNumEncoders ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if( pEncoderIds ) - { /* query array of encoders */ - if( *pNumEncoders < impl->numCodecs ) - { - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - res = XA_RESULT_BUFFER_INSUFFICIENT; - } - else - { - - - XAuint32 i = 0; - XACapabilities temp; - for( i=0; inumCodecs; i++ ) - { - /* query encoder id from adaptation using index value */ - XACapabilitiesMgr_GetCapsByIdx(NULL, (XACapsType)(XACAP_ENCODER|XACAP_VIDEO), i, &temp); - pEncoderIds[i] = temp.xaid; - } - - } - } - /* return number of encoders */ - *pNumEncoders = impl->numCodecs; - } - - DEBUG_API("<-XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoders"); - return res; -} - -/* XAresult XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoderCapabilities - * Description: Retrieves video encoder capabilities. - */ -XAresult XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoderCapabilities( - XAVideoEncoderCapabilitiesItf self, - XAuint32 encoderId, - XAuint32* pIndex, - XAVideoCodecDescriptor* pDescriptor) -{ - XAVideoEncoderCapabilitiesItfImpl* impl = NULL; - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVideoEncoderCapabilitiesItfImpl_GetEncoderCapabilities"); - impl = GetImpl(self); - if( !impl || !pIndex ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - if( !pDescriptor ) - { /* query number of capa structures */ - *pIndex = 1; - } - else - { /* query capabilities */ - if( *pIndex >= 1 ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - res = XA_RESULT_PARAMETER_INVALID; - } - else - { - - /* query capabilities from adaptation using codec id */ - XACapabilities temp; - memset(pDescriptor,0,sizeof(XAVideoCodecDescriptor)); - res = XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_ENCODER|XACAP_VIDEO), encoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - XAVideoCodecDescriptor* desc = (XAVideoCodecDescriptor*)(&temp.pEntry); - /* map applicable values to XAVideoCodecCapabilities */ - pDescriptor->codecId = temp.xaid; - pDescriptor->maxWidth = desc->maxWidth; - pDescriptor->maxHeight = desc->maxHeight; - pDescriptor->maxFrameRate = (desc->maxFrameRate & 0xffff)<<16; - pDescriptor->maxBitRate = desc->maxBitRate; - /*other caps undefined*/ - pDescriptor->rateControlSupported = XA_RATECONTROLMODE_CONSTANTBITRATE; - pDescriptor->profileSetting = 0; /* unknown for theora or motionjpeg */ - pDescriptor->levelSetting = 0; /* unknown for theora or motionjpeg */ - } - - } - } - } - - DEBUG_API("<-XAVideoEncoderCapabilitiesItfImpl_GetEncoderCapabilities"); - return res; -} - -/** - * XAVideoEncoderCapabilitiesItfImpl -specific methods - **/ - -/* XAVideoEncoderCapabilitiesItfImpl_Create - * Description: Allocate and initialize XAVideoEncoderCapabilitiesItfImpl - */ -XAVideoEncoderCapabilitiesItfImpl* XAVideoEncoderCapabilitiesItfImpl_Create() -{ - XAVideoEncoderCapabilitiesItfImpl* self = (XAVideoEncoderCapabilitiesItfImpl*) - calloc(1,sizeof(XAVideoEncoderCapabilitiesItfImpl)); - DEBUG_API("->XAVideoEncoderCapabilitiesItfImpl_Create"); - - if( self ) - { - /* init itf default implementation */ - self->itf.GetVideoEncoders = - XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoders; - self->itf.GetVideoEncoderCapabilities = - XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoderCapabilities; - - - /* init variables */ - assert( XACapabilitiesMgr_GetCapsCount( NULL, (XACapsType)(XACAP_ENCODER|XACAP_VIDEO), - &(self->numCodecs) ) == XA_RESULT_SUCCESS ); - - self->self = self; - } - DEBUG_API("<-XAVideoEncoderCapabilitiesItfImpl_Create"); - return self; -} - -/* void XAVideoEncoderCapabilitiesItfImpl_Free - * Description: Free all resources reserved at XAVideoEncoderCapabilitiesItfImpl_Create - */ -void XAVideoEncoderCapabilitiesItfImpl_Free(XAVideoEncoderCapabilitiesItfImpl* self) -{ - DEBUG_API("->XAVideoEncoderCapabilitiesItfImpl_Free"); - assert(self==self->self); - free(self); - DEBUG_API("<-XAVideoEncoderCapabilitiesItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/engine/xavideoencodercapabilitiesitf.h --- a/khronosfws/openmax_al/src/engine/xavideoencodercapabilitiesitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOENCODERCAPABILITIESITF_H -#define XAVIDEOENCODERCAPABILITIESITF_H - -#include "openmaxalwrapper.h" -#include "xaglobals.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAVideoEncoderCapabilitiesItf implementation */ -typedef struct XAVideoEncoderCapabilitiesItfImpl_ -{ - /* parent interface */ - struct XAVideoEncoderCapabilitiesItf_ itf; - /* pointer to self */ - struct XAVideoEncoderCapabilitiesItfImpl_* self; - /* variables */ - XAuint32 numCodecs; -} XAVideoEncoderCapabilitiesItfImpl; - -/* Base interface XAVideoEncoderCapabilitiesItf implementation */ -XAresult XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoders( - XAVideoEncoderCapabilitiesItf self, - XAuint32* pNumEncoders, - XAuint32* pEncoderIds); - -XAresult XAVideoEncoderCapabilitiesItfImpl_GetVideoEncoderCapabilities( - XAVideoEncoderCapabilitiesItf self, - XAuint32 decoderId, - XAuint32* pIndex, - XAVideoCodecDescriptor* pDescriptor); - -/* XAVideoEncoderCapabilitiesItfImpl -specific methods */ -XAVideoEncoderCapabilitiesItfImpl* XAVideoEncoderCapabilitiesItfImpl_Create(void); -void XAVideoEncoderCapabilitiesItfImpl_Free(XAVideoEncoderCapabilitiesItfImpl* self); - -#endif /* XAVIDEOENCODERCAPABILITIESITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaadaptationgst.c Fri Jul 09 16:43:35 2010 -0500 @@ -20,21 +20,9 @@ #include #include #include "xaobjectitf.h" -#include "xacameradevice.h" #include "xaradiodevice.h" -#include "xaoutputmix.h" -#include "xamediaplayeradaptctx.h" -#include "xacameraadaptctx.h" #include - -#ifdef OMAX_CAMERABIN -extern XAboolean cameraRealized; - -extern XACameraAdaptationCtx_* cameraCtx; -#else -XAboolean cameraRealized = XA_BOOLEAN_FALSE; -XACameraAdaptationCtx_* cameraCtx = NULL; -#endif +#include "xaadaptationgst.h" /* * XAAdaptationGstCtx* XAAdaptationGst_Create() * 1st phase initialization function for Adaptation Base context structure. @@ -55,6 +43,7 @@ } else { + GError* gerror = 0; /* Add default handler for Gst-bus messages */ pSelf->busCb = XAAdaptationGst_GstBusCb; @@ -63,6 +52,12 @@ // VASU MOD ENDS sem_init(&(pSelf->semAsyncWait), 0, 0); +//cross check + if ( !gst_init_check( NULL, NULL, &gerror ) ) + { + DEBUG_ERR("Gst Initalization failure."); + return XA_RESULT_INTERNAL_ERROR; + } } } else @@ -220,7 +215,8 @@ DEBUG_INFO("Unhandled Gst-Bus message") ; break; - }DEBUG_API("<-XAAdaptationGst_GstBusCb"); + } + DEBUG_API("<-XAAdaptationGst_GstBusCb"); return TRUE; } @@ -252,7 +248,8 @@ { DEBUG_ERR_A1("could not create thread!! (%d)",ret) return XA_RESULT_INTERNAL_ERROR; - }DEBUG_API("<-XAAdaptationGst_InitGstListener"); + } + DEBUG_API("<-XAAdaptationGst_InitGstListener"); return XA_RESULT_SUCCESS; } @@ -298,7 +295,8 @@ { gst_object_unref(ctx->bus); ctx->bus = NULL; - }DEBUG_API("<-XAAdaptationGst_StopGstListener"); + } + DEBUG_API("<-XAAdaptationGst_StopGstListener"); } /* @@ -363,7 +361,8 @@ GST_STATE(bCtx->bin), GST_STATE_TARGET(bCtx->bin), bCtx->binWantedState); bCtx->waitingasyncop = XA_BOOLEAN_FALSE; sem_post(&(bCtx->semAsyncWait)); - }DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); + } + DEBUG_API("<-XAAdaptationGst_CancelAsyncWait"); /* return false to remove timer */ return FALSE; } @@ -385,7 +384,8 @@ { /* should not be, reset semaphore */ sem_init(&(ctx->semAsyncWait), 0, 0); } - }DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); + } + DEBUG_API("<-XAAdaptationGst_CompleteAsyncWait"); } /** @@ -699,43 +699,8 @@ NULL); break; case XA_DATALOCATOR_OUTPUTMIX: - DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX") - ; + DEBUG_INFO("Sink locator type - XA_DATALOCATOR_OUTPUTMIX"); { - /* Get OutputMix adaptation from data locator */ - XADataLocator_OutputMix* omix = - (XADataLocator_OutputMix*) (xaSnk->pLocator); - if (omix->outputMix) - { - XAOMixImpl* omixDevice = - (XAOMixImpl*) (*omix->outputMix); - - if (omixDevice) - { - /*TODO we had to remove this line below since adaptationCtx - * was not a member of structure*/ - - /*gstSnk = XAOutputMixAdapt_GetSink(omixDevice->adaptationCtx);*/ - if (!gstSnk) - { - DEBUG_ERR("Cannot create sink!"); - return NULL; - } - *isobj = XA_BOOLEAN_TRUE; - } - else - { - DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); - gstSnk = gst_element_factory_make("alsasink", - name); - } - } - else - { - DEBUG_ERR("Warning - NULL outputmix object - default audio output used"); - gstSnk = gst_element_factory_make("alsasink", name); - } - } break; @@ -761,7 +726,8 @@ if (gstSnk) { DEBUG_INFO_A1("Created gstreamer sink element at %x", gstSnk); - }DEBUG_API("<-XAAdaptationGst_CreateGstSink"); + } + DEBUG_API("<-XAAdaptationGst_CreateGstSink"); return gstSnk; } @@ -947,7 +913,8 @@ gst_object_unref(vpp); vpp = NULL; } - }DEBUG_API("<-XAAdaptationGst_CreateVideoPP"); + } + DEBUG_API("<-XAAdaptationGst_CreateVideoPP"); return vpp; } @@ -1095,7 +1062,8 @@ gst_object_unref(vpp); vpp = NULL; } - }DEBUG_API("<-XAAdaptationGst_CreateFixedSizeVideoPP"); + } + DEBUG_API("<-XAAdaptationGst_CreateFixedSizeVideoPP"); return vpp; } @@ -1148,7 +1116,8 @@ gst_object_unref(vppBScr); vppBScr = NULL; } - }DEBUG_API("<-XAAdaptationGst_CreateVideoPPBlackScr"); + } + DEBUG_API("<-XAAdaptationGst_CreateVideoPPBlackScr"); return vppBScr; } @@ -1166,7 +1135,8 @@ if (inputSelector) { g_object_set(G_OBJECT(inputSelector), "select-all", TRUE, NULL); - }DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); + } + DEBUG_API("<-XAAdaptationGst_CreateInputSelector"); return inputSelector; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaaudioencoderitfadaptation.c Fri Jul 09 16:43:35 2010 -0500 @@ -52,7 +52,8 @@ mCtx->encodingchanged = XA_BOOLEAN_TRUE; memcpy(&mCtx->audioEncSettings, pSettings, sizeof(XAAudioEncoderSettings)); - }DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings"); + } + DEBUG_API("<-XAAudioEncoderItfAdapt_SetEncoderSettings"); return ret; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,294 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xacameraadaptctx.h" -#include "xaadaptationgst.h" -#include -//#include "XAStaticCapsAdaptation.h" - - -XAboolean cameraRealized = XA_BOOLEAN_FALSE; -XACameraAdaptationCtx_* cameraCtx = NULL; - -/* - * gboolean XACameraAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * MediaPlayer Gst-bus message handler (Callback) - */ -gboolean XACameraAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*)data; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_FOCUSSTATUS,1,NULL}; - XAuint32 status; - - /* only listen to pipeline messages */ - if(GST_MESSAGE_SRC(message)==(GstObject*)(mCtx->baseObj.bin) ) - { - DEBUG_API_A2("->XACameraAdapt_GstBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - if ( GST_MESSAGE_TYPE(message)== GST_MESSAGE_ASYNC_DONE ) - { - /* some async sequence ended */ - XAAdaptationGst_CompleteAsyncWait((&mCtx->baseObj)); - } - else if (strncmp(GST_MESSAGE_TYPE_NAME(message), GST_PHOTOGRAPHY_AUTOFOCUS_DONE, - strlen(GST_PHOTOGRAPHY_AUTOFOCUS_DONE))==0 ) - { - DEBUG_INFO("Autofocus done!.") - status = XA_CAMERA_FOCUSMODESTATUS_REACHED; - event.data = &status; - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj.baseObj), &event ); - } - else if ( strncmp(GST_MESSAGE_TYPE_NAME(message), GST_PHOTOGRAPHY_SHAKE_RISK, - strlen(GST_PHOTOGRAPHY_SHAKE_RISK)) ==0 ) - { - DEBUG_INFO("Camera shake risk!") - } - DEBUG_API("<-XACameraAdapt_GstBusCb"); - } - return TRUE; -} - -/* - * XAAdaptationGstCtx* XACameraAdapt_Create() - * Allocates memory for Camera Adaptation Context and makes 1st phase initialization - * @returns XACameraAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XACameraAdapt_Create(XAuint32 deviceID) -{ - XACameraAdaptationCtx *pSelf = (XACameraAdaptationCtx*) calloc(1, sizeof(XACameraAdaptationCtx)); - DEBUG_API("->XACameraAdapt_Create"); - if ( pSelf) - { - if( XAAdaptationGst_Init(&(pSelf->baseObj),XACameraAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->deviceID = deviceID; - pSelf->curMirror = XA_VIDEOMIRROR_NONE; - pSelf->curRotation = 0; - pSelf->recording = XA_BOOLEAN_FALSE; - pSelf->playing = XA_BOOLEAN_FALSE; - pSelf->snapshotting = XA_BOOLEAN_FALSE; - cameraCtx = pSelf; /* Store global pointer */ - DEBUG_INFO_A1("Stored global camera ponter to %x", cameraCtx); - cameraRealized = XA_BOOLEAN_FALSE; - } - } - - DEBUG_API("<-XACameraAdapt_Create"); - return (XAAdaptationBaseCtx*)&pSelf->baseObj; -} - -/* - * XAresult XACameraAdapt_PostInit() - * 2nd phase initialization of Camera Adaptation Context - */ -XAresult XACameraAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XACameraAdaptationCtx* ctx = NULL; - DEBUG_API("->XACameraAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XACameraAdaptation) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XACameraAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XACameraAdaptationCtx*)bCtx; - - if ( !ctx ) - { - return XA_RESULT_INTERNAL_ERROR; - } - - XAAdaptationGst_PostInit( &(ctx->baseObj) ); - - ctx->baseObj.bin = gst_element_factory_make( "camerabin", "camera"); - if ( !ctx->baseObj.bin ) - { - DEBUG_ERR("Failed to create CameraBin"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Create Gst bus listener. */ - ret = XAAdaptationGst_InitGstListener(&(ctx->baseObj)); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Bus listener creation failed!!"); - return ret; - } - /* Add Camera specific handler */ - if(ctx->baseObj.bus) - { - ctx->baseObj.busCb = XACameraAdapt_GstBusCb; - gst_bus_add_signal_watch( ctx->baseObj.bus); - g_signal_connect(ctx->baseObj.bus, "message::autofocus-done", G_CALLBACK(ctx->baseObj.busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::shake-risk", G_CALLBACK(ctx->baseObj.busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::async-done", G_CALLBACK(ctx->baseObj.busCb), ctx ); - } - else - { - DEBUG_ERR("Failed to create message bus"); - return XA_RESULT_INTERNAL_ERROR; - } - - - /* SET UP CAMERABIN */ - - /* use test video source if set, camerabin default (v4l2src) otherwise */ -#ifdef XA_USE_TEST_PLUGINS - if(ctx->deviceID == XA_ADAPTID_VIDEOTESTSRC || ctx->deviceID == XA_DEFAULTDEVICEID_CAMERA ) -#else - if(ctx->deviceID == XA_ADAPTID_VIDEOTESTSRC ) -#endif - { - g_object_set( G_OBJECT(ctx->baseObj.bin), "videosrc", gst_element_factory_make("videotestsrc", "videotestsrc"), NULL ); - } - - /* set viewfinder element to be fake for the time of preroll.. if ghost pad added now, - * stupid camerabin makes circular linking... - */ - g_object_set( G_OBJECT(ctx->baseObj.bin), "vfsink" ,gst_element_factory_make("fakesink", "fakevfsink"), NULL ); - - /* Setup camerabin to produce raw video */ - g_object_set( G_OBJECT(ctx->baseObj.bin), "videomux",NULL, NULL ); - g_object_set( G_OBJECT(ctx->baseObj.bin), "videoenc",NULL, NULL ); - g_object_set( G_OBJECT(ctx->baseObj.bin), "mute", TRUE, NULL ); - g_object_set( G_OBJECT(ctx->baseObj.bin), "async-handling", FALSE, NULL); - g_object_set( G_OBJECT(ctx->baseObj.bin), "mode",(gint)1, NULL); - - - /* drive camerabin to READY to create the elements inside bin */ - gst_element_set_state( GST_ELEMENT(ctx->baseObj.bin), GST_STATE_READY); - - if(ctx->deviceID == XA_ADAPTID_VIDEOTESTSRC) - { /* set properties for videotestsrc */ - GstElement *testsrc = gst_bin_get_by_name(GST_BIN(ctx->baseObj.bin), "videotestsrc"); - g_object_set( G_OBJECT(testsrc),"is-live", TRUE, NULL); - g_object_set( G_OBJECT(testsrc),"do-timestamp", TRUE, NULL); - gst_object_unref(G_OBJECT(testsrc)); - } - - /* do some filter optimization */ -#ifdef XA_USE_TEST_PLUGINS - g_object_set( G_OBJECT(ctx->baseObj.bin), "filter-caps", - gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "framerate",GST_TYPE_FRACTION_RANGE,0,1,30,1, NULL) - ,NULL ); -#else - g_object_set( G_OBJECT(ctx->baseObj.bin), "filter-caps", - gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('Y','U','Y','2'), - "framerate",GST_TYPE_FRACTION_RANGE,0,1,30,1, NULL) - ,NULL ); - -#endif - - /* now, unlink fake sink, create camera post processing pipeline and create ghost pad from it */ - { - GstElement *fakesink = gst_bin_get_by_name(GST_BIN(ctx->baseObj.bin),"fakevfsink"); - GstPad *fakepad = gst_element_get_static_pad(fakesink,"sink"); - GstPad *linkedpad = gst_pad_get_peer(fakepad); - GstElement *linkedelement = gst_pad_get_parent_element(linkedpad); - GstElement * cameraPP = NULL; - GstElement * camfilter = NULL; - GstElement *tee = NULL; - - /* Unlink fakesink */ - gst_element_unlink(linkedelement,fakesink); - /* Create VideoPP pipeline for Camera object */ - cameraPP = XAAdaptationGst_CreateVideoPP(); - g_object_set( G_OBJECT(cameraPP),"name", "videopp_camera", NULL); - gst_bin_add( GST_BIN(ctx->baseObj.bin), cameraPP ); - /*Link videoPP into camera bin last element */ - if (! gst_element_link( linkedelement, cameraPP )) - { - DEBUG_ERR("Could not link VideoPP to Camera bin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Add extra filter for caps negotiable after post processing*/ - camfilter = gst_element_factory_make("capsfilter", "camfilter"); - gst_bin_add( GST_BIN(ctx->baseObj.bin), camfilter ); - if(! gst_element_link( cameraPP, camfilter )) - { - DEBUG_ERR("Could not link camera bin to camerafilter!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Add tee element into camerabin */ - tee = gst_element_factory_make( "tee", "CamTee"); - gst_bin_add( GST_BIN(ctx->baseObj.bin), tee); - if (! gst_element_link( camfilter, tee )) - { - DEBUG_ERR("Could not link camera filter to tee element!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* Unref */ - gst_object_unref(linkedelement); - gst_object_unref(linkedpad); - gst_object_unref(fakepad); - gst_bin_remove(GST_BIN(ctx->baseObj.bin),fakesink); - gst_object_unparent(GST_OBJECT(fakesink)); - } - - if ( ret == XA_RESULT_SUCCESS ) - { - cameraRealized = XA_BOOLEAN_TRUE; - } - - DEBUG_API("<-XACameraAdapt_PostInit"); - return ret; -} - -/* - * void XACameraAdapt_Destroy(XACameraAdaptationCtx* ctx) - * Destroys Camera Adaptation Context - * @param ctx - Camera Adaptation context to be destroyed - */ -void XACameraAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XACameraAdaptationCtx* ctx = NULL; - - DEBUG_API("->XACameraAdapt_Destroy"); - if(bCtx == NULL || bCtx->ctxId != XACameraAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XACameraAdapt_Destroy"); - return; - } - ctx = (XACameraAdaptationCtx*)bCtx; - - XAAdaptationGst_Free(&(ctx->baseObj)); - - free(ctx); - ctx = NULL; - cameraCtx = NULL; - cameraRealized = XA_BOOLEAN_FALSE; - DEBUG_API("<-XACameraAdapt_Destroy"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xacameraadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERAADAPTCTX_H -#define XACAMERAADAPTCTX_H - -#include "xaadaptationgst.h" -#ifdef OMAX_CAMERABIN -#include -#endif -/* TYPEDEFS */ - -typedef struct XACameraAdaptationCtx_ XACameraAdaptationCtx; - -/* - * Structure for Camera specific gst-adaptation variables - */ -typedef struct XACameraAdaptationCtx_ { - - /* Parent*/ - XAAdaptationGstCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 deviceID; - XAuint32 imageEffectID; - XAmillidegree curRotation; - XAuint32 curMirror; - - /* GST Variables */ -#ifdef OMAX_CAMERABIN - GstFocusStatus focusStatus; -#endif - /* Internals */ - XAboolean recording; - XAboolean playing; - XAboolean snapshotting; -} XACameraAdaptationCtx_; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XACameraAdapt_Create(XAuint32 deviceID); -XAresult XACameraAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XACameraAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XACAMERAADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,429 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xacameraadaptctx.h" -#include "xacameraitfadaptation.h" -#include "xaadaptationgst.h" - - -/* - * XAresult XACameraItfAdapt_SetFlashMode( XAAdaptationGstCtx *bCtx, XAuint32 flashMode ); - */ -XAresult XACameraItfAdapt_SetFlashMode( XAAdaptationGstCtx *bCtx, XAuint32 flashMode ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_FLASHREADY,0,0}; - GstFlashMode gstFlashmode; - - DEBUG_API_A1("->XACameraItfAdapt_SetFlashMode 0x%x",(int)flashMode); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - switch( flashMode ) - { - case XA_CAMERA_FLASHMODE_OFF: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_OFF; - break; - case XA_CAMERA_FLASHMODE_ON: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_ON; - break; - case XA_CAMERA_FLASHMODE_AUTO: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_AUTO; - break; - case XA_CAMERA_FLASHMODE_REDEYEREDUCTION: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_RED_EYE; - break; - case XA_CAMERA_FLASHMODE_FILLIN: - gstFlashmode = GST_PHOTOGRAPHY_FLASH_MODE_FILL_IN; - break; - case XA_CAMERA_FLASHMODE_TORCH: - case XA_CAMERA_FLASHMODE_REDEYEREDUCTION_AUTO: - default: - DEBUG_INFO("Mode not supported in GstPhotography!"); - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - - if(ret == XA_RESULT_SUCCESS && GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_flash_mode( GST_PHOTOGRAPHY(bCtx->bin), gstFlashmode ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - if(ret == XA_RESULT_SUCCESS) - { - /* no gst event, senc cb now */ - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetFlashMode"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetFocusMode( XAAdaptationGstCtx *bCtx, XAuint32 focusMode, - * XAmillimeter manualSetting, - * XAboolean macroEnabled ) - */ -XAresult XACameraItfAdapt_SetFocusMode( XAAdaptationGstCtx *bCtx, XAuint32 focusMode, - XAmillimeter manualSetting, XAboolean macroEnabled ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_FOCUSSTATUS,1,NULL}; - XAuint32 status; - - DEBUG_API_A3("->XACameraItfAdapt_SetFocusMode - focusMode:%d, manualSetting:%d, macroEnabled:%d", - (int)focusMode, (int)manualSetting, (int)macroEnabled); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( focusMode == XA_CAMERA_FOCUSMODE_AUTO ) - { - gst_photography_set_autofocus( GST_PHOTOGRAPHY(bCtx->bin), TRUE ); - status = XA_CAMERA_FOCUSMODESTATUS_REQUEST; - event.data = &status; - } - else - { - /* Only auto focus supported in GstPhotography, other modes sets auto focus off */ - DEBUG_INFO("No support in GstPhotography"); - gst_photography_set_autofocus( GST_PHOTOGRAPHY(bCtx->bin), FALSE ); - status = XA_CAMERA_FOCUSMODESTATUS_OFF; - event.data = &status; - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - } - else - { - status = XA_CAMERA_FOCUSMODESTATUS_OFF; - event.data = &status; - } - - if(event.data) - { - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetFocusMode"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetFocusRegionPattern( XAAdaptationGstCtx *bCtx, - * XAuint32 focusPattern, - * XAuint32 activePoints1, - * XAuint32 activePoints2 ) - */ -XAresult XACameraItfAdapt_SetFocusRegionPattern( XAAdaptationGstCtx *bCtx, XAuint32 focusPattern, - XAuint32 activePoints1, XAuint32 activePoints2 ) -{ - DEBUG_API_A3("->XACameraItfAdapt_SetFocusRegionPattern - focusPattern:%d, activePoints1:%d, activePoints2:%d", - (int)focusPattern,(int)activePoints1,(int)activePoints2); - DEBUG_INFO("No support for focus region pattern in GstPhotography "); - DEBUG_API("<-XACameraItfAdapt_SetFocusRegionPattern"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* XAresult XACameraItfAdapt_GetFocusRegionPositions( XAAdaptationGstCtx *bCtx, XAuint32 *pNumPositionEntries, - * XAFocusPointPosition *pFocusPosition ) - */ -XAresult XACameraItfAdapt_GetFocusRegionPositions( XAAdaptationGstCtx *bCtx, XAuint32 *pNumPositionEntries, - XAFocusPointPosition *pFocusPosition ) -{ - DEBUG_API("->XACameraItfAdapt_GetFocusRegionPositions"); - DEBUG_INFO("No focus region support in GstPhotography"); - DEBUG_API("<-XACameraItfAdapt_GetFocusRegionPositions"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetMeteringMode( XAAdaptationGstCtx *bCtx, XAuint32 meteringMode ) - */ -XAresult XACameraItfAdapt_SetMeteringMode( XAAdaptationGstCtx *bCtx, XAuint32 meteringMode ) -{ - DEBUG_API_A1("->XACameraItfAdapt_SetMeteringMode - meteringMode:%d",(int)meteringMode); - DEBUG_INFO("No metering modes support in GstPhotography"); - DEBUG_API("<-XACameraItfAdapt_SetMeteringMode"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetExposureMode( XAAdaptationGstCtx *bCtx, XAuint32 exposure, XAuint32 compensation ) - */ -XAresult XACameraItfAdapt_SetExposureMode( XAAdaptationGstCtx *bCtx, XAuint32 exposure, XAuint32 compensation ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_EXPOSURESTATUS,1,NULL}; - GstSceneMode expmode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO; - - DEBUG_API_A2("->XACameraItfAdapt_SetExposureMode - exposure:%d, compensation:%d", - (int)exposure, (int)compensation); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - switch(exposure) - { - case XA_CAMERA_EXPOSUREMODE_AUTO: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_AUTO; - break; - case XA_CAMERA_EXPOSUREMODE_SPORTS: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_SPORT; - break; - case XA_CAMERA_EXPOSUREMODE_PORTRAIT: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_PORTRAIT; - break; - case XA_CAMERA_EXPOSUREMODE_NIGHT: - expmode = GST_PHOTOGRAPHY_SCENE_MODE_NIGHT; - break; - default: - DEBUG_INFO("GstPhotography doesn't support other than manual settings"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - - if(GST_IS_PHOTOGRAPHY(bCtx->bin)&&ret==XA_RESULT_SUCCESS) - { - if (!gst_photography_set_scene_mode( GST_PHOTOGRAPHY(bCtx->bin), expmode) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - else if (exposure == XA_CAMERA_EXPOSUREMODE_AUTO) - { - if (!gst_photography_set_ev_compensation( GST_PHOTOGRAPHY(bCtx->bin), compensation) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - } - if(ret == XA_RESULT_SUCCESS) - { - event.data = &exposure; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetExposureMode"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetISOSensitivity( XAAdaptationGstCtx *bCtx, XAuint32 isoSensitivity, XAuint32 manualSetting ) - */ -XAresult XACameraItfAdapt_SetISOSensitivity( XAAdaptationGstCtx *bCtx, XAuint32 isoSensitivity, XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API_A2("->XACameraItfAdapt_SetISOSensitivity - isoSensitivity:%d, manualSetting:%d", - (int)isoSensitivity, (int)manualSetting); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( isoSensitivity == XA_CAMERA_ISOSENSITIVITYMODE_MANUAL) - { - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_iso_speed (GST_PHOTOGRAPHY(bCtx->bin), manualSetting ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - } - else - { - DEBUG_INFO("Iso sensitivity auto not supported in GstPhotography, stubbed value"); - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XACameraItfAdapt_SetISOSensitivity"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetAperture( XAAdaptationGstCtx *bCtx, XAuint32 aperture, XAuint32 manualSetting ) - */ -XAresult XACameraItfAdapt_SetAperture( XAAdaptationGstCtx *bCtx, XAuint32 aperture, XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API_A2("->XACameraItfAdapt_SetAperture - aperture:%d, manualSetting:%d", - (int)aperture, (int)manualSetting); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( aperture == XA_CAMERA_APERTUREMODE_MANUAL ) - { - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if (!gst_photography_set_aperture ( GST_PHOTOGRAPHY(bCtx->bin), manualSetting) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - } - else - { - DEBUG_INFO("GstPhotography doesn't support auto aperture settings"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - - DEBUG_API("<-XACameraItfAdapt_SetAperture"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetShutterSpeed( XAAdaptationGstCtx *bCtx, XAuint32 shutterSpeed, XAmicrosecond manualSetting ) - */ -XAresult XACameraItfAdapt_SetShutterSpeed( XAAdaptationGstCtx *bCtx, XAuint32 shutterSpeed, XAmicrosecond manualSetting ) -{ - DEBUG_API_A2("->XACameraItfAdapt_SetShutterSpeed - shutterSpeed:%d, manualSetting:%d", - (int)shutterSpeed, (int)manualSetting); - DEBUG_INFO("Shutter speed setting not supported in GstPhotography"); - DEBUG_API("<-XACameraItfAdapt_SetShutterSpeed"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetWhiteBalance( XAAdaptationGstCtx *bCtx, XAuint32 whiteBalance, XAuint32 manualSetting ) - */ -XAresult XACameraItfAdapt_SetWhiteBalance( XAAdaptationGstCtx *bCtx, XAuint32 whiteBalance, XAuint32 manualSetting ) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstWhiteBalanceMode gstWbMode = GST_PHOTOGRAPHY_WB_MODE_AUTO; - - DEBUG_API_A2("->XACameraItfAdapt_SetWhiteBalance - whiteBalance:%d, manualSetting:%d", - (int)whiteBalance, (int)manualSetting); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - switch ( whiteBalance ) - { - case XA_CAMERA_WHITEBALANCEMODE_AUTO: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_AUTO; - break; - case XA_CAMERA_WHITEBALANCEMODE_SUNLIGHT: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_DAYLIGHT; - break; - case XA_CAMERA_WHITEBALANCEMODE_CLOUDY: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_CLOUDY; - break; - case XA_CAMERA_WHITEBALANCEMODE_TUNGSTEN: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_TUNGSTEN; - break; - case XA_CAMERA_WHITEBALANCEMODE_FLUORESCENT: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_FLUORESCENT; - break; - case XA_CAMERA_WHITEBALANCEMODE_SUNSET: - gstWbMode = GST_PHOTOGRAPHY_WB_MODE_SUNSET; - break; - case XA_CAMERA_WHITEBALANCEMODE_INCANDESCENT: - case XA_CAMERA_WHITEBALANCEMODE_FLASH: - case XA_CAMERA_WHITEBALANCEMODE_MANUAL: - case XA_CAMERA_WHITEBALANCEMODE_SHADE: - DEBUG_INFO("Wanted white balance mode not supported!"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - default: - break; - } - - if(ret == XA_RESULT_SUCCESS && GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_white_balance_mode( GST_PHOTOGRAPHY(bCtx->bin), gstWbMode ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - - DEBUG_API("<-XACameraItfAdapt_SetWhiteBalance"); - return ret; -} - -/* - * XAresult XACameraItfAdapt_SetAutoLocks( XAAdaptationGstCtx *bCtx, XAuint32 locks ) - */ -XAresult XACameraItfAdapt_SetAutoLocks( XAAdaptationGstCtx *bCtx, XAuint32 locks ) -{ - DEBUG_API_A1("->XACameraItfAdapt_SetAutoLocks - locks:%d", (int)locks); - DEBUG_INFO("No autolocks support in GstPhotography") - DEBUG_API("<-XACameraItfAdapt_SetAutoLocks"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XACameraItfAdapt_SetZoom( XAAdaptationGstCtx *bCtx, XAuint32 zoom, XAboolean digitalEnabled, XAuint32 speed, XAboolean async ) - */ -XAresult XACameraItfAdapt_SetZoom( XAAdaptationGstCtx *bCtx, XAuint32 zoom, XAboolean digitalEnabled, XAuint32 speed, XAboolean async ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptEvent event = {XA_CAMERAITFEVENTS,XA_CAMERACBEVENT_ZOOMSTATUS,1,NULL}; - gint gstZoom; - - DEBUG_API_A4("->XACameraItfAdapt_SetZoom - zoom:%d,digitalEnabled:%d,speed:%d,async:%d ", - (int)zoom,(int)digitalEnabled,(int)speed,(int)async); - if(!bCtx || bCtx->baseObj.ctxId != XACameraAdaptation || zoom < 1 ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( zoom > 10 ) - { - gstZoom = MAX_ZOOM; - } - else - { - /* Gst Zoom range 100 - 1000, 100 = 1x, 200 = 2x, ...*/ - gstZoom = zoom * 100; - } - if(GST_IS_PHOTOGRAPHY(bCtx->bin)) - { - if ( !gst_photography_set_zoom( GST_PHOTOGRAPHY(bCtx->bin), gstZoom ) ) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - if( ret == XA_RESULT_SUCCESS && async ) - { - /* no gst event, send cb now*/ - event.data = &zoom; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - - DEBUG_API("<-XACameraItfAdapt_SetZoom"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xacameraitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XACAMERAITFADAPTATION_H_ -#define XACAMERAITFADAPTATION_H_ - -#include "xaadaptationgst.h" - -#define MAX_ZOOM 1000; - -/* FUNCTIONS */ - -XAresult XACameraItfAdapt_SetFlashMode( XAAdaptationGstCtx *bCtx, XAuint32 flashMode ); -XAresult XACameraItfAdapt_SetFocusMode( XAAdaptationGstCtx *bCtx, XAuint32 focusMode, XAmillimeter manualSetting, XAboolean macroEnabled ); -XAresult XACameraItfAdapt_SetFocusRegionPattern( XAAdaptationGstCtx *bCtx, XAuint32 focusPattern, XAuint32 activePoints1, XAuint32 activePoints2 ); -XAresult XACameraItfAdapt_GetFocusRegionPositions( XAAdaptationGstCtx *bCtx, XAuint32 *pNumPositionEntries, XAFocusPointPosition *pFocusPosition ); -XAresult XACameraItfAdapt_SetMeteringMode( XAAdaptationGstCtx *bCtx, XAuint32 meteringMode ); -XAresult XACameraItfAdapt_SetExposureMode( XAAdaptationGstCtx *bCtx, XAuint32 exposure, XAuint32 compensation ); -XAresult XACameraItfAdapt_SetISOSensitivity( XAAdaptationGstCtx *bCtx, XAuint32 isoSensitivity, XAuint32 manualSetting ); -XAresult XACameraItfAdapt_SetAperture( XAAdaptationGstCtx *bCtx, XAuint32 aperture, XAuint32 manualSetting ); -XAresult XACameraItfAdapt_SetShutterSpeed( XAAdaptationGstCtx *bCtx, XAuint32 shutterSpeed, XAmicrosecond manualSetting ); -XAresult XACameraItfAdapt_SetWhiteBalance( XAAdaptationGstCtx *bCtx, XAuint32 whiteBalance, XAuint32 manualSetting ); -XAresult XACameraItfAdapt_SetAutoLocks( XAAdaptationGstCtx *bCtx, XAuint32 locks ); -XAresult XACameraItfAdapt_SetZoom( XAAdaptationGstCtx *bCtx, XAuint32 zoom, XAboolean digitalEnabled, XAuint32 speed, XAboolean async ); - -#endif /* XACAMERAITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xadevicevolumeitfadaptation.h" -#include "xaengineadaptctx.h" -#include "xaadaptationgst.h" -//#include "XAStaticCapsAdaptation.h" - - -/* XAresult XADeviceVolumeItfAdapt_SetVolume - * Description: Sets the device's volume. - */ -XAresult XADeviceVolumeItfAdapt_SetVolume(XAAdaptationGstCtx *bCtx, XAuint32 deviceID, XAint32 volume) -{ - XAEngineAdaptationCtx* ctx = NULL; - GstElement* amixer = NULL; - GstMixerTrack *mixerTrack = NULL; - const GList *gList = NULL; - gint volumeIdx = 0; - - DEBUG_API("->XADeviceVolumeItfAdapt_SetVolume"); - - if(!bCtx ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_PARAMETER_INVALID; - } - - ctx = (XAEngineAdaptationCtx*) bCtx; - - amixer = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "alsamixer"); - if( !amixer ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_INTERNAL_ERROR; - } - - gList = gst_mixer_list_tracks( GST_MIXER(amixer) ); - if( !gList ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_INTERNAL_ERROR; - } - - while( gList ) - { - mixerTrack = (GstMixerTrack*)gList->data; - if( !mixerTrack ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_INTERNAL_ERROR; - } - - if( ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_DEFAULTDEVICEID_AUDIOINPUT) || -// ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_ADAPTID_ALSASRC) || //krishna - ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_ADAPTID_DEVSOUNDSRC) || - ((mixerTrack->flags & GST_MIXER_TRACK_INPUT ) && deviceID == XA_ADAPTID_AUDIOTESTSRC) || - ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_DEFAULTDEVICEID_AUDIOOUTPUT) || - ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_ADAPTID_JACKSINK) || -// ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_ADAPTID_ALSASINK) ) - ((mixerTrack->flags & GST_MIXER_TRACK_OUTPUT ) && deviceID == XA_ADAPTID_DEVSOUNDSINK) ) - { - gint *gVolume = (gint*) calloc(mixerTrack->num_channels, sizeof(gint) ); - if( !gVolume ) - { - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_MEMORY_FAILURE; - } - - for( volumeIdx = 0; volumeIdx < mixerTrack->num_channels; volumeIdx++ ) - { - /* Set same volume level for all channels */ - gVolume[volumeIdx] = (gint)volume; - } - - /* found master track */ - gst_mixer_set_volume( GST_MIXER(amixer), mixerTrack, gVolume ); - free( gVolume ); - gVolume = NULL; - break; - } - gList = g_list_next(gList); - } - if ( amixer ) - { - gst_object_unref( GST_OBJECT(amixer)); - } - - DEBUG_API("<-XADeviceVolumeItfAdapt_SetVolume"); - return XA_RESULT_SUCCESS; -} - -/* XAresult XADeviceVolumeItfAdapt_IsDeviceIDSupported - * Description: Check is request device ID supported. - */ -XAresult XADeviceVolumeItfAdapt_IsDeviceIDSupported(XAAdaptationGstCtx *bCtx, XAuint32 deviceID, XAboolean *isSupported) -{ - DEBUG_API("->XADeviceVolumeItfAdapt_IsDeviceIDSupported"); - - if(!bCtx || !isSupported ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XADeviceVolumeItfAdapt_IsDeviceIDSupported"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is device ID supported or not supported */ -// if( deviceID == XA_DEFAULTDEVICEID_AUDIOINPUT || deviceID == XA_ADAPTID_ALSASRC || - if( deviceID == XA_DEFAULTDEVICEID_AUDIOINPUT || deviceID == XA_ADAPTID_DEVSOUNDSRC || - deviceID == XA_ADAPTID_AUDIOTESTSRC || deviceID == XA_DEFAULTDEVICEID_AUDIOOUTPUT || -// deviceID == XA_ADAPTID_JACKSINK || deviceID == XA_ADAPTID_ALSASINK ) - deviceID == XA_ADAPTID_JACKSINK || deviceID == XA_ADAPTID_DEVSOUNDSINK ) - { - *isSupported = XA_BOOLEAN_TRUE; - } - else - { - *isSupported = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XADeviceVolumeItfAdapt_IsDeviceIDSupported"); - return XA_RESULT_SUCCESS; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xadevicevolumeitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADEVICEVOLUMEITFADAPTATION_H_ -#define XADEVICEVOLUMEITFADAPTATION_H_ - -#include "xaadaptationgst.h" - - -/* FUNCTIONS */ -XAresult XADeviceVolumeItfAdapt_SetVolume( XAAdaptationGstCtx *bCtx, XAuint32 deviceID, XAint32 volume); -XAresult XADeviceVolumeItfAdapt_IsDeviceIDSupported(XAAdaptationGstCtx *bCtx, XAuint32 deviceID, XAboolean *isSupported); -#endif /* XADEVICEVOLUMEITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,107 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xadynamicsourceitfadaptation.h" - -/* - * XAresult XADynamicSourceItfAdapt_SetSource(XAAdaptationGstCtx *bCtx, XADataSource *pDataSource) - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * @param XADataSource *pDataSource - new data source - * @return XAresult ret - Success value - */ -XAresult XADynamicSourceItfAdapt_SetSource(XAAdaptationGstCtx *bCtx, XADataSource *pDataSource) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XADynamicSourceItfAdapt_SetSource"); - if( !bCtx || !pDataSource || !pDataSource->pLocator ) - { - DEBUG_ERR("Invalid NULL parameter"); - ret = XA_RESULT_PARAMETER_INVALID; - } - else if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation || bCtx->baseObj.ctxId == XAMDAdaptation ) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - GstStateChangeReturn gret; - GstState origState; - GstElement* newSource = XAAdaptationGst_CreateGstSource( pDataSource, "datasrc", &(mCtx->isobjsrc), NULL, NULL); - if(!newSource) - { - DEBUG_ERR("Could not create data source!!!"); - return XA_RESULT_CONTENT_NOT_FOUND; - } - DEBUG_INFO("Changing Playback Source"); - /* store current state */ - origState = GST_STATE(bCtx->bin); - /* unroll pipeline */ - bCtx->binWantedState = GST_STATE_NULL; - XAAdaptationGst_PrepareAsyncWait(bCtx); - gret = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for unroll"); - XAAdaptationGst_StartAsyncWait(bCtx); - DEBUG_INFO("Unroll ready"); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { /*not much we can do*/ - DEBUG_ERR("WARNING: Failed to unroll pipeline!!") - return XA_RESULT_INTERNAL_ERROR; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - - /* set new source */ - gst_element_unlink(mCtx->source,mCtx->codecbin); - gst_bin_remove(GST_BIN(bCtx->bin), mCtx->source); - mCtx->source = newSource; - gst_bin_add(GST_BIN(bCtx->bin), mCtx->source); - if(! gst_element_link(mCtx->source, mCtx->codecbin)) - { - DEBUG_ERR("Could not link source to codecbin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->xaSource = pDataSource; - - /* restore pipeline state */ - bCtx->binWantedState = origState; - DEBUG_INFO_A1("Changing pipeline back to state %s",gst_element_state_get_name(origState)); - XAAdaptationGst_PrepareAsyncWait(bCtx); - gret = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for state change"); - XAAdaptationGst_StartAsyncWait(bCtx); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("State change FAILED"); - return XA_RESULT_INTERNAL_ERROR; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - DEBUG_INFO_A1("Pipeline in state %s",gst_element_state_get_name(GST_STATE(bCtx->bin))); - - if( GST_STATE(bCtx->bin) > GST_STATE_READY ) - { /* let (possible) extraction itf to know new tags */ - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - } - DEBUG_API("<-XADynamicSourceItfAdapt_SetSource"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xadynamicsourceitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADYNAMICSOURCEITFADAPTATION_H -#define XADYNAMICSOURCEITFADAPTATION_H - -#include "xaadaptationgst.h" - - -/* FUNCTIONS */ - -XAresult XADynamicSourceItfAdapt_SetSource(XAAdaptationGstCtx *bCtx, XADataSource *pDataSource); - -#endif /* XADYNAMICSOURCEITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaengineadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaengineadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xaengineadaptctx.c Fri Jul 09 16:43:35 2010 -0500 @@ -169,8 +169,6 @@ XAAdaptationBase_Free(&(ctx->baseObj.baseObj)); -/* gst_deinit(); */ - free(ctx); ctx = NULL; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,268 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xamediarecorderadaptctx.h" -#include "xaoutputmixadaptctx.h" -#include "xaequalizeritfadaptation.h" -//#include "XAStaticCapsAdaptation.h" - -static const XAmilliHertz centerFrequencies[EQUALIZER_NUM_OF_BANDS] = { - 29000, 59000, 119000, 227000, 474000, - 947000, 1889000, 3770000, 7523000, 15011000 }; - -static const char* band_names[EQUALIZER_NUM_OF_BANDS] = { - "band0", "band1", "band2", "band3", "band4", - "band5", "band6", "band7", "band8", "band9" }; - -/*static const XAmilliHertz bandFreqRangeMin = 0; -static const XAmilliHertz bandFreqRangeMax = 0;*/ -static const XAmillibel bandLevelRangeMin = -2400; -static const XAmillibel bandLevelRangeMax = 1200; - - -/* - * XAresult XAEqualizerItfAdapt_GetBandLevelRange(XAAdaptationGstCtx *bCtx, - * XAmillibel *pMin, - * XAmillibel *pMax) - */ -XAresult XAEqualizerItfAdapt_GetBandLevelRange(XAAdaptationGstCtx *bCtx, - XAmillibel *pMin, - XAmillibel *pMax) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetBandLevelRange"); - - if( (!pMin && !pMax) ) /* other may be NULL */ - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (pMin) - { - *pMin = bandLevelRangeMin; - } - if (pMax) - { - *pMax = bandLevelRangeMax; - } - - DEBUG_API("<-XAEqualizerItfAdapt_GetBandLevelRange"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_SetBandLevel(XAAdaptationGstCtx *bCtx, - * XAuint16 band, - * XAmillibel level) - */ -XAresult XAEqualizerItfAdapt_SetBandLevel(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmillibel level) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstElement *equ=NULL, *audiopp=NULL; - DEBUG_API("->XAEqualizerItfAdapt_SetBandLevel"); - - if(!bCtx || - band >= EQUALIZER_NUM_OF_BANDS || - level < bandLevelRangeMin || - level > bandLevelRangeMax) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation || bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - audiopp = gst_bin_get_by_name( GST_BIN(bCtx->bin), "audiopp" ); - equ = gst_bin_get_by_name( GST_BIN(audiopp), "pp_equ" ); - if(equ) - { - g_object_set( G_OBJECT(equ), band_names[band], (gdouble)(level/1000), NULL ); - } - else - { - DEBUG_ERR("Media object equalizer element not found!!"); - } - } - else if( bCtx->baseObj.ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) bCtx; - guint iterator; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = GST_BIN(g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx->bin); - equ=NULL; - audiopp=NULL; - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if(audiopp) - { - equ = gst_bin_get_by_name( GST_BIN(audiopp), "pp_equ" ); - } - if(equ) - { - g_object_set( G_OBJECT(equ), band_names[band], (gdouble)(level/1000), NULL ); - } - else - { - DEBUG_ERR_A1("Could not find equalizer for player %u!!", iterator); - } - } - } - else - { - DEBUG_ERR_A1("Not supported adaptation element: %d", bCtx->baseObj.ctxId); - return XA_RESULT_PARAMETER_INVALID; - } - } - if(equ) - { - gst_object_unref(equ); - } - if(audiopp) - { - gst_object_unref(audiopp); - } - - DEBUG_API("<-XAEqualizerItfAdapt_SetBandLevel"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetCenterFreq(XAAdaptationGstCtx *bCtx, - * XAuint16 band, - * XAmilliHertz *pCenter) - */ - -XAresult XAEqualizerItfAdapt_GetCenterFreq(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmilliHertz *pCenter) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetCenterFreq"); - - if(!pCenter || band >= EQUALIZER_NUM_OF_BANDS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pCenter = centerFrequencies[band]; - - DEBUG_API("<-XAEqualizerItfAdapt_GetCenterFreq"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetBandFreqRange(XAAdaptationGstCtx *bCtx, - * XAuint16 band, - * XAmilliHertz *pMin, - * XAmilliHerts *pMax) - */ -XAresult XAEqualizerItfAdapt_GetBandFreqRange(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmilliHertz *pMin, - XAmilliHertz *pMax) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetBandFreqRange"); - - /* pMin or pMax may be NULL */ - if((!pMin && !pMax) || band >= EQUALIZER_NUM_OF_BANDS) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* in this implementation there are no ranges */ - if (pMin) - { - *pMin = centerFrequencies[band]; - } - if (pMax) - { - *pMax = centerFrequencies[band]; - } - - DEBUG_API("<-XAEqualizerItfAdapt_GetBandFreqRange"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetBand(XAAdaptationGstCtx *bCtx, - * XAmilliHertz frequency, - * XAuint16 *pBand) - */ -XAresult XAEqualizerItfAdapt_GetBand(XAAdaptationGstCtx *bCtx, - XAmilliHertz frequency, - XAuint16 *pBand) -{ - XAuint16 index=0; - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetBand"); - - if(!pBand) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pBand = XA_EQUALIZER_UNDEFINED; - - /* as there are no ranges, it must match exactly */ - for (index = 0; index < EQUALIZER_NUM_OF_BANDS; index++) - { - if (frequency == centerFrequencies[index]) - { - *pBand = index; - break; - } - } - - DEBUG_API("<-XAEqualizerItfAdapt_GetBand"); - return ret; -} - -/* - * XAresult XAEqualizerItfAdapt_GetDefaultBandLevel(XAAdaptationGstCtx *bCtx, - * XAuint16 band, - * XAmillibel *pLevel) - */ -XAresult XAEqualizerItfAdapt_GetDefaultBandLevel(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmillibel *pLevel) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAEqualizerItfAdapt_GetDefaultBandLevel"); - - if(!pLevel) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - pLevel = EQUALIZER_DEFAULT_BAND_LEVEL; - - DEBUG_API("<-XAEqualizerItfAdapt_GetDefaultBandLevel"); - return ret; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaequalizeritfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,54 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAEQUALIZERITFADAPTATION_H -#define XAEQUALIZERITFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xathreadsafety.h" - -/* MACROS */ -#define EQUALIZER_NUM_OF_BANDS 10 -#define EQUALIZER_DEFAULT_BAND_LEVEL 0 - -/* FUNCTIONS */ -XAresult XAEqualizerItfAdapt_GetBandLevelRange(XAAdaptationGstCtx *bCtx, - XAmillibel *pMin, - XAmillibel *pMax); - -XAresult XAEqualizerItfAdapt_SetBandLevel(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmillibel level); - -XAresult XAEqualizerItfAdapt_GetCenterFreq(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmilliHertz *pCenter); - -XAresult XAEqualizerItfAdapt_GetBandFreqRange(XAAdaptationGstCtx *bCtx, - XAuint16 band, - XAmilliHertz *pMin, - XAmilliHertz *pMax); - -XAresult XAEqualizerItfAdapt_GetBand(XAAdaptationGstCtx *bCtx, - XAmilliHertz frequency, - XAuint16 *pBand); - -XAresult XAEqualizerItfAdapt_GetDefaultBandLevel(XAAdaptationGstCtx *bCtx, - XAuint16 index, - XAint16 *pLevel); - -#endif /* XAEQUALIZERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c --- a/khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xagstcapabilitiesmgr.c Fri Jul 09 16:43:35 2010 -0500 @@ -364,7 +364,8 @@ if (!(*ppListHead)) { *ppListHead = firstNode; - }DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); + } + DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); return res; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,325 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xamediarecorderadaptctx.h" -#include "xacameraadaptctx.h" -#include "xaimagecontrolsitfadaptation.h" - -/* - * XAresult XAImageControlsItfAdapt_SetBrightness(XAAdaptationGstCtx *bCtx, - * XAuint32 brightness) - */ -XAresult XAImageControlsItfAdapt_SetBrightness(XAAdaptationGstCtx *bCtx, - XAuint32 brightness) -{ - XAresult ret = XA_RESULT_SUCCESS; - - gdouble gstBrightness = 0; - XAint32 tempBrightness = 0; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageControlsItfAdapt_SetBrightness") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_SetBrightness") - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if ( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - } - } - - /* count gstBrightness from XA contrast. Allowed values for gst is -1 to 1 - * and allowed value for XA is 0 to 100 */ - tempBrightness = brightness; - - gstBrightness = ( ((gdouble)tempBrightness - SCALE_VALUE_BRIGHTNESS) / SCALE_VALUE_BRIGHTNESS ); - - if(balanceElement) - { - g_object_set(G_OBJECT(balanceElement), "brightness", gstBrightness, NULL); - - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - ret = XAImageControlsItfAdapt_HandleImageType(bCtx); - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageControlsItfAdapt_SetBrightness") - return ret; -} - -/* - * XAresult XAImageControlsItfAdapt_SetContrast(XAAdaptationGstCtx *bCtx, - * XAuint32 contrast) - */ -XAresult XAImageControlsItfAdapt_SetContrast(XAAdaptationGstCtx *bCtx, - XAint32 contrast) -{ - XAresult ret = XA_RESULT_SUCCESS; - - gdouble gstContrast = 1; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageControlsItfAdapt_SetContrast") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_SetContrast") - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - } - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - } - } - - /* count gstContrast from XA contrast. Allowed values for gst is 0 to 2 - * and allowed value for XA is -100 to 100 */ - gstContrast = (( (gdouble)contrast + SCALE_VALUE_CONTRAST ) / SCALE_VALUE_CONTRAST ); - - if(balanceElement) - { - g_object_set(G_OBJECT(balanceElement), "contrast", gstContrast, NULL); - - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - ret = XAImageControlsItfAdapt_HandleImageType(bCtx); - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageControlsItfAdapt_SetContrast") - return ret; -} - -/* - * XAresult XAImageControlsItfAdapt_SetGamma(XAAdaptationGstCtx *bCtx, - * XApermille gamma) - */ -XAresult XAImageControlsItfAdapt_SetGamma(XAAdaptationGstCtx *bCtx, - XApermille gamma) -{ - XAresult ret = XA_RESULT_SUCCESS; - - gdouble gstGamma=0; - GstElement *gammaElement = NULL; - DEBUG_API("->XAImageControlsItfAdapt_SetGamma") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_SetGamma") - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); - } - - if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); - } - - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera gamma element */ - gammaElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_gamma"); - } - } - - /* count gstGamma from XA gamma */ - gstGamma = ( (gdouble)gamma / SCALE_VALUE_GAMMA ); - - if(gammaElement) - { - g_object_set(G_OBJECT(gammaElement), "gamma", gstGamma, NULL); - - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - ret = XAImageControlsItfAdapt_HandleImageType(bCtx); - } - } - - if ( gammaElement ) - { - gst_object_unref(gammaElement); - } - - DEBUG_API("<-XAImageControlsItfAdapt_SetGamma") - return ret; -} - -/* - * XAresult XAImageControlsItfAdapt_GetSupportedGammaSettings(XAAdaptationGstCtx *bCtx, - * XApermille *pMinValue, - * XApermille *pMaxValue, - * XAuint32 *pNumSettings, - * XApermille **ppSettings) - */ -XAresult XAImageControlsItfAdapt_GetSupportedGammaSettings(XAAdaptationGstCtx *bCtx, - XApermille *pMinValue, - XApermille *pMaxValue, - XAuint32 *pNumSettings, - XApermille **ppSettings) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageControlsItfAdapt_GetSupportedGammaSettings") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation) || !pMinValue || !pMaxValue || !pNumSettings) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XAImageControlsItfAdapt_GetSupportedGammaSettings") - return XA_RESULT_PARAMETER_INVALID; - } - - *pMinValue = MIN_GAMMA_VALUE; - *pMaxValue = MAX_GAMMA_VALUE; - - /* manual settings is continuous from min to max then pNumSetting return 0. */ - *pNumSettings = 0; - - DEBUG_API("<-XAImageControlsItfAdapt_GetSupportedGammaSettings") - return ret; -} -/* - * XAresult XAImageControlsItfAdapt_HandleImageType(XAAdaptationGstCtx *bCtx) - * Description: this run gstreamer for image type - * - */ -XAresult XAImageControlsItfAdapt_HandleImageType(XAAdaptationGstCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XADataSource *dataSrc = NULL; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAImageControlsItfAdapt_HandleImageType"); - - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageControlsItfAdapt_HandleImageType") - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - dataSrc = mCtx->xaSource; - - if( dataSrc ) - { - XAMediaType mediaType; - ret = XACommon_CheckDataSource(dataSrc, &mediaType); - if( ret == XA_RESULT_SUCCESS && mediaType == XA_MEDIATYPE_IMAGE ) - { - gstOrigState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", GST_STATE_READY); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - gstTmpState = GST_STATE(bCtx->bin); - if(gstRet == GST_STATE_CHANGE_SUCCESS && gstTmpState == GST_STATE_READY) - { - DEBUG_INFO_A1("Sending change state request to state %d", gstOrigState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - } - } - } - DEBUG_API("<-XAImageControlsItfAdapt_HandleImageType"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaimagecontrolsitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGECONTROLSITFADAPTATION_H -#define XAIMAGECONTROLSITFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xathreadsafety.h" - -/* MACROS */ -#define MIN_GAMMA_VALUE 10 -#define MAX_GAMMA_VALUE 10000 -#define SCALE_VALUE_BRIGHTNESS 50 -#define SCALE_VALUE_CONTRAST 100 -#define SCALE_VALUE_GAMMA 1000 - -/* FUNCTIONS */ -XAresult XAImageControlsItfAdapt_SetBrightness(XAAdaptationGstCtx *bCtx, - XAuint32 brightness); - -XAresult XAImageControlsItfAdapt_SetContrast(XAAdaptationGstCtx *bCtx, - XAint32 contrast); - -XAresult XAImageControlsItfAdapt_SetGamma(XAAdaptationGstCtx *bCtx, - XApermille gamma); - -XAresult XAImageControlsItfAdapt_GetSupportedGammaSettings(XAAdaptationGstCtx *bCtx, - XApermille *pMinValue, - XApermille *pMaxValue, - XAuint32 *pNumSettings, - XApermille **ppSettings); - -XAresult XAImageControlsItfAdapt_HandleImageType(XAAdaptationGstCtx *bCtx); -#endif /* XAIMAGECONTROLSITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,661 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - - -#include -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xamediarecorderadaptctx.h" -#include "xacameraadaptctx.h" -#include "xaimageeffectsitfadaptation.h" - -/* - * XAresult XAImageEffectsItfAdapt_QuerySupportedImageEffects(XAAdaptationGstCtx *bCtx, - * XAuint32 index, - * XAuint32 *pImageEffectId) - */ -XAresult XAImageEffectsItfAdapt_QuerySupportedImageEffects(XAAdaptationGstCtx *bCtx, - XAuint32 index, - XAuint32 *pImageEffectId) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAImageEffectsItfAdapt_QuerySupportedImageEffects") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation) || index > NUM_SUPPORTED_EFFECTS - 1 || !pImageEffectId) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_QuerySupportedImageEffects") - return XA_RESULT_PARAMETER_INVALID; - } - - /* check which effect is supported */ - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation || bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - switch( index ) - { - case 0: - *pImageEffectId = XA_IMAGEEFFECT_MONOCHROME; - break; - case 1: - *pImageEffectId = XA_IMAGEEFFECT_NEGATIVE; - break; - case 2: - *pImageEffectId = XA_IMAGEEFFECT_SEPIA; - break; - case 3: - *pImageEffectId = XA_IMAGEEFFECT_EMBOSS; - break; - case 4: - *pImageEffectId = XA_IMAGEEFFECT_PAINTBRUSH; - break; - case 5: - *pImageEffectId = XA_IMAGEEFFECT_SOLARIZE; - break; - case 6: - *pImageEffectId = XA_IMAGEEFFECT_CARTOON; - break; - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - if(bCtx->baseObj.ctxId == XACameraAdaptation) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - /* real image effects for camera */ - switch( index ) - { - case 0: - *pImageEffectId = XA_IMAGEEFFECT_NEGATIVE; - break; - case 1: - *pImageEffectId = XA_IMAGEEFFECT_SEPIA; - break; - case 3: - *pImageEffectId = XA_IMAGEEFFECT_SOLARIZE; - break; - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - else - { - /* Stubbed image effects for camera */ - switch( index ) - { - case 0: - *pImageEffectId = XA_IMAGEEFFECT_MONOCHROME; - break; - case 1: - *pImageEffectId = XA_IMAGEEFFECT_NEGATIVE; - break; - case 2: - *pImageEffectId = XA_IMAGEEFFECT_SEPIA; - break; - case 3: - *pImageEffectId = XA_IMAGEEFFECT_EMBOSS; - break; - case 4: - *pImageEffectId = XA_IMAGEEFFECT_PAINTBRUSH; - break; - case 5: - *pImageEffectId = XA_IMAGEEFFECT_SOLARIZE; - break; - case 6: - *pImageEffectId = XA_IMAGEEFFECT_CARTOON; - break; - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - } - - DEBUG_API("<-XAImageEffectsItfAdapt_QuerySupportedImageEffects") - return ret; -} - -/* - * XAresult XAImageEffectsItfAdapt_EnableImageEffect(XAAdaptationGstCtx *bCtx, - * XAuint32 imageEffectID) - */ -XAresult XAImageEffectsItfAdapt_EnableImageEffect(XAAdaptationGstCtx *bCtx, - XAuint32 imageEffectID) -{ - XAresult ret = XA_RESULT_SUCCESS; - gdouble tempImageEffect = 0; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageEffectsItfAdapt_EnableImageEffect") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_PARAMETER_INVALID; - } - - /* check which effect is enabled (STUB for player and recorder - all effect are done - * via videobalance plugin. Used different saturations values). */ - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation || bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - tempImageEffect = IMAGEEFFECT_MONOCHROME; - break; - case XA_IMAGEEFFECT_NEGATIVE: - tempImageEffect = IMAGEEFFECT_NEGATIVE; - break; - case XA_IMAGEEFFECT_SEPIA: - tempImageEffect = IMAGEEFFECT_SEPIA; - break; - case XA_IMAGEEFFECT_EMBOSS: - tempImageEffect = IMAGEEFFECT_EMBOSS; - break; - case XA_IMAGEEFFECT_PAINTBRUSH: - tempImageEffect = IMAGEEFFECT_PAINTBRUSH; - break; - case XA_IMAGEEFFECT_SOLARIZE: - tempImageEffect = IMAGEEFFECT_SOLARIZE; - break; - case XA_IMAGEEFFECT_CARTOON: - tempImageEffect = IMAGEEFFECT_CARTOON; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)tempImageEffect, NULL); - mCtx->imageEffectID = imageEffectID; - ret = XAImageEffectsItfAdapt_HandleImageType(bCtx); - } - } - - if(bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)tempImageEffect, NULL); - mCtx->imageEffectID = imageEffectID; - } - } - } - - if(bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - GstColourToneMode gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_NEGATIVE: - { - gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NEGATIVE; - break; - } - case XA_IMAGEEFFECT_SEPIA: - { - gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SEPIA; - break; - } - case XA_IMAGEEFFECT_SOLARIZE: - { - gstColorToneMode = GST_PHOTOGRAPHY_COLOUR_TONE_MODE_SOLARIZE; - break; - } - default: - { - mCtx->imageEffectID = 0; - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - if( imageEffectID != mCtx->imageEffectID ) - { - if( !gst_photography_set_colour_tone_mode( GST_PHOTOGRAPHY(mCtx->baseObj.bin), gstColorToneMode ) ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->imageEffectID = imageEffectID; - } - } - else - { - GstElement *videoPP = NULL; - /* Stubbed image effects for camera */ - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - tempImageEffect = IMAGEEFFECT_MONOCHROME; - break; - case XA_IMAGEEFFECT_NEGATIVE: - tempImageEffect = IMAGEEFFECT_NEGATIVE; - break; - case XA_IMAGEEFFECT_SEPIA: - tempImageEffect = IMAGEEFFECT_SEPIA; - break; - case XA_IMAGEEFFECT_EMBOSS: - tempImageEffect = IMAGEEFFECT_EMBOSS; - break; - case XA_IMAGEEFFECT_PAINTBRUSH: - tempImageEffect = IMAGEEFFECT_PAINTBRUSH; - break; - case XA_IMAGEEFFECT_SOLARIZE: - tempImageEffect = IMAGEEFFECT_SOLARIZE; - break; - case XA_IMAGEEFFECT_CARTOON: - tempImageEffect = IMAGEEFFECT_CARTOON; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - videoPP = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "videopp_camera"); - if ( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)tempImageEffect, NULL); - mCtx->imageEffectID = imageEffectID; - } - } - - if ( videoPP ) - { - gst_object_unref( videoPP ); - } - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return ret; -} - -/* - * XAresult XAImageEffectsItfAdapt_DisableImageEffect(XAAdaptationGstCtx *bCtx, - * XAuint32 imageEffectID) - */ -XAresult XAImageEffectsItfAdapt_DisableImageEffect(XAAdaptationGstCtx *bCtx, - XAuint32 imageEffectID) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 tempImageEffect = 0; - GstElement *balanceElement = NULL; - DEBUG_API("->XAImageEffectsItfAdapt_DisableImageEffect") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_PARAMETER_INVALID; - } - - /* check which effect is disabled (STUB for player and recorder - all effect are done - * via videobalance plugin. Used saturation default value to disabling effects). */ - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation || bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - tempImageEffect = NO_IMAGEEFFECT; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED") - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)GST_NO_IMAGEEFFECT, NULL); - mCtx->imageEffectID = tempImageEffect; - ret = XAImageEffectsItfAdapt_HandleImageType(bCtx); - } - } - - if(bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - balanceElement = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "pp_balance"); - - if( balanceElement ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)GST_NO_IMAGEEFFECT, NULL); - mCtx->imageEffectID = tempImageEffect; - } - } - } - - if(bCtx->baseObj.ctxId == XACameraAdaptation) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_SOLARIZE: - { - /* Set color tone to normal */ - if( !gst_photography_set_colour_tone_mode( GST_PHOTOGRAPHY(mCtx->baseObj.bin), - GST_PHOTOGRAPHY_COLOUR_TONE_MODE_NORMAL ) ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAImageEffectsItfAdapt_EnableImageEffect") - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->imageEffectID = NO_IMAGEEFFECT; - break; - } - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED") - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - } - else - { - GstElement *videoPP = NULL; - /* stubbed camera values */ - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - mCtx->imageEffectID = NO_IMAGEEFFECT; - break; - default: - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED") - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - videoPP = gst_bin_get_by_name( GST_BIN(mCtx->baseObj.bin), "videopp_camera"); - if ( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera balance element */ - balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - - if( balanceElement && (imageEffectID != mCtx->imageEffectID) ) - { - g_object_set(G_OBJECT(balanceElement), "saturation", (gdouble)GST_NO_IMAGEEFFECT, NULL); - mCtx->imageEffectID = tempImageEffect; - } - } - if ( videoPP ) - { - gst_object_unref(videoPP); - } - } - } - - if ( balanceElement ) - { - gst_object_unref(balanceElement); - } - - DEBUG_API("<-XAImageEffectsItfAdapt_DisableImageEffect") - return ret; -} - -/* - * XAresult XAImageEffectsItfAdapt_IsImageEffectEnabled(XAAdaptationGstCtx *bCtx, - * XAuint32 imageEffectID, - * XAboolean *pEnabled) - */ -XAresult XAImageEffectsItfAdapt_IsImageEffectEnabled(XAAdaptationGstCtx *bCtx, - XAuint32 imageEffectID, - XAboolean *pEnabled) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 tempImageEffect = 0; - DEBUG_API("->XAImageEffectsItfAdapt_IsImageEffectEnabled") - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation) || !pEnabled) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_IsImageEffectEnabled") - return XA_RESULT_PARAMETER_INVALID; - } - - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - tempImageEffect = mCtx->imageEffectID; - } - - if(bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - tempImageEffect = mCtx->imageEffectID; - } - - /* check is effect enabled for player and recorder */ - if(bCtx->baseObj.ctxId == XAMediaPlayerAdaptation || bCtx->baseObj.ctxId == XAMediaRecorderAdaptation) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - { - /* Check is wanted effect currently enabled */ - if( tempImageEffect == imageEffectID ) - { - *pEnabled = XA_BOOLEAN_TRUE; - } - else - { - *pEnabled = XA_BOOLEAN_FALSE; - } - break; - } - default: - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - - if(bCtx->baseObj.ctxId == XACameraAdaptation) - { - XACameraAdaptationCtx* mCtx = (XACameraAdaptationCtx*) bCtx; - - if(GST_IS_PHOTOGRAPHY(mCtx->baseObj.bin)) - { - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_SOLARIZE: - { - /* Check is wanted effect currently enabled */ - if( mCtx->imageEffectID == imageEffectID ) - { - *pEnabled = XA_BOOLEAN_TRUE; - } - else - { - *pEnabled = XA_BOOLEAN_FALSE; - } - break; - } - default: - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - else - { - /* stubbed camera values */ - switch( imageEffectID ) - { - case XA_IMAGEEFFECT_MONOCHROME: - case XA_IMAGEEFFECT_NEGATIVE: - case XA_IMAGEEFFECT_SEPIA: - case XA_IMAGEEFFECT_EMBOSS: - case XA_IMAGEEFFECT_PAINTBRUSH: - case XA_IMAGEEFFECT_SOLARIZE: - case XA_IMAGEEFFECT_CARTOON: - { - /* Check is wanted effect currently enabled */ - if( mCtx->imageEffectID == imageEffectID ) - { - *pEnabled = XA_BOOLEAN_TRUE; - } - else - { - *pEnabled = XA_BOOLEAN_FALSE; - } - break; - } - default: - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - } - } - - DEBUG_API("<-XAImageEffectsItfAdapt_IsImageEffectEnabled"); - return ret; -} -/* - * XAresult XAImageEffectsItfAdapt_HandleImageType(XAAdaptationGstCtx *bCtx) - * Description: this run gstreamer for image type - * - */ -XAresult XAImageEffectsItfAdapt_HandleImageType(XAAdaptationGstCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XADataSource *dataSrc = NULL; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAImageEffectsItfAdapt_HandleImageType"); - - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEffectsItfAdapt_HandleImageType") - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - - dataSrc = mCtx->xaSource; - - if( dataSrc ) - { - XAMediaType mediaType; - ret = XACommon_CheckDataSource(dataSrc, &mediaType); - if( ret == XA_RESULT_SUCCESS && mediaType == XA_MEDIATYPE_IMAGE ) - { - gstOrigState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", GST_STATE_READY); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - gstTmpState = GST_STATE(bCtx->bin); - if(gstRet == GST_STATE_CHANGE_SUCCESS && gstTmpState == GST_STATE_READY) - { - DEBUG_INFO_A1("Sending change state request to state %d", gstOrigState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - } - } - } - DEBUG_API("<-XAImageEffectsItfAdapt_HandleImageType"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaimageeffectsitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEEFFECTSITFADAPTATION_H -#define XAIMAGEEFFECTSITFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xathreadsafety.h" - -/* MACROS */ -#define NUM_SUPPORTED_EFFECTS 7 -#define NO_IMAGEEFFECT 0 -#define GST_NO_IMAGEEFFECT 1 -#define IMAGEEFFECT_MONOCHROME 0 -#define IMAGEEFFECT_NEGATIVE 0.2 -#define IMAGEEFFECT_SEPIA 0.3 -#define IMAGEEFFECT_EMBOSS 1.4 -#define IMAGEEFFECT_PAINTBRUSH 1.5 -#define IMAGEEFFECT_SOLARIZE 1.6 -#define IMAGEEFFECT_CARTOON 2 - -/* FUNCTIONS */ -XAresult XAImageEffectsItfAdapt_QuerySupportedImageEffects(XAAdaptationGstCtx *bCtx, - XAuint32 index, - XAuint32 *pImageEffectId); - -XAresult XAImageEffectsItfAdapt_EnableImageEffect(XAAdaptationGstCtx *bCtx, - XAuint32 imageEffectID); - -XAresult XAImageEffectsItfAdapt_DisableImageEffect(XAAdaptationGstCtx *bCtx, - XAuint32 imageEffectID); - -XAresult XAImageEffectsItfAdapt_IsImageEffectEnabled(XAAdaptationGstCtx *bCtx, - XAuint32 imageEffectID, - XAboolean *pEnabled); - -XAresult XAImageEffectsItfAdapt_HandleImageType(XAAdaptationGstCtx *bCtx); -#endif /* XAIMAGEEFFECTSITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaimageencoderitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaimageencoderitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,74 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "xamediarecorderadaptctx.h" -#include "xaimageencoderitfadaptation.h" -#include "xacapabilitiesmgr.h" - - -/* - * XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationGstCtx *bCtx, - * XAImageSettings *pSettings ) - * @param XAAdaptationGstCtx *ctx - pointer to Media Recorer adaptation context - * @param XAImageSettings *pSettings - Settings for encoder - * @return XAresult ret - return success value - * Description: Sets preferred encoder settings for pipeline. - */ -XAresult XAImageEncoderItfAdapt_SetImageSettings( XAAdaptationGstCtx *bCtx, - const XAImageSettings *pSettings ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XACapabilities temp; - - DEBUG_API("->XAImageEncoderAdapt_SetImageSettings"); - - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - if(XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_ENCODER|XACAP_IMAGE), mCtx->imageEncSettings.encoderId, &temp) != XA_RESULT_SUCCESS) - { /* no such codec */ - return XA_RESULT_FEATURE_UNSUPPORTED; - } - /*Just copy - image settings are applied in InitiateSnapshot*/ - memcpy(&mCtx->imageEncSettings, pSettings, sizeof(XAImageSettings)); - - DEBUG_API("<-XAImageEncoderAdapt_SetImageSettings"); - return ret; -} - -XAresult XAImageEncoderItfAdapt_GetImageSettings( XAAdaptationGstCtx *bCtx, - XAImageSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAImageEncoderItfAdapt_GetImageSettings"); - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - memcpy(pSettings, &(mCtx->imageEncSettings), sizeof(XAImageSettings)); - DEBUG_API("<-XAImageEncoderItfAdapt_GetImageSettings"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaimageencoderitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaimageencoderitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEENCODERITFADAPTATION_H -#define XAIMAGEENCODERITFADAPTATION_H - -#include "xaadaptationgst.h" - -/* FUNCTIONS */ -XAresult XAImageEncoderItfAdapt_SetImageSettings(XAAdaptationGstCtx *bCtx, - const XAImageSettings *pSettings); -XAresult XAImageEncoderItfAdapt_GetImageSettings(XAAdaptationGstCtx *bCtx, - XAImageSettings *pSettings); -#endif /* XAIMAGEENCODERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaledarrayadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaledarrayadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,104 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaledarrayadaptctx.h" -#include "xaadaptationgst.h" - -/* - * XALEDArrayAdaptationCtx* XALEDArrayAdapt_Create() - * Allocates memory for LEDArray Adaptation Context and makes 1st phase initialization - * @returns XALEDArrayAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XALEDArrayAdapt_Create(XAuint32 deviceID) -{ - XALEDArrayAdaptationCtx *pSelf = (XALEDArrayAdaptationCtx *)calloc(1, sizeof(XALEDArrayAdaptationCtx)); - DEBUG_API("->XALEDArrayAdapt_Create"); - - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XALedArrayAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->deviceID = deviceID; - - } - } - - DEBUG_API("<-XALEDArrayAdapt_Create"); - return (XAAdaptationBaseCtx*)&pSelf->baseObj; -} - -/* - * XAresult XALEDArrayAdapt_PostInit() - * 2nd phase initialization of LEDArray Adaptation Context - */ -XAresult XALEDArrayAdapt_PostInit(XAAdaptationGstCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XALEDArrayAdaptationCtx* ctx = NULL; - DEBUG_API("->XALEDArrayAdapt_PostInit"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XALEDArrayAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XALEDArrayAdaptationCtx*)bCtx; - if ( !ctx ) - { - return XA_RESULT_INTERNAL_ERROR; - } - - XAAdaptationBase_PostInit( &(ctx->baseObj.baseObj) ); - - DEBUG_API("<-XALEDArrayAdapt_PostInit"); - return ret; -} - -/* - * void XALEDArrayAdapt_Destroy(XALEDArrayAdaptationCtx* ctx) - * Destroys LEDArray Adaptation Context - * @param ctx - LEDArray Adaptation context to be destroyed - */ -void XALEDArrayAdapt_Destroy(XAAdaptationGstCtx* bCtx) -{ - XALEDArrayAdaptationCtx* ctx = NULL; - DEBUG_API("->XALEDArrayAdapt_Destroy"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XALEDArrayAdapt_Destroy"); - return; - } - ctx = (XALEDArrayAdaptationCtx*)bCtx; - DEBUG_API("->XALEDArrayAdapt_Destroy"); - - XAAdaptationBase_Free(&(ctx->baseObj.baseObj)); - - - free(ctx); - ctx = NULL; - - DEBUG_API("<-XALEDArrayAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaledarrayadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaledarrayadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XALEDARRAYADAPTCTX_H -#define XALEDARRAYADAPTCTX_H - -#include "xaadaptationgst.h" - -/* TYPEDEFS */ - -typedef struct XALEDArrayAdaptationCtx_ XALEDArrayAdaptationCtx; - -/* - * Structure for Ledarray specific gst-adaptation variables - */ -typedef struct XALEDArrayAdaptationCtx_ { - - /* Parent*/ - XAAdaptationGstCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 deviceID; - - /* GST Variables */ - -} XALedarrayAdaptationCtx_; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XALEDArrayAdapt_Create(XAuint32 deviceID); -XAresult XALEDArrayAdapt_PostInit(XAAdaptationGstCtx* bCtx); -void XALEDArrayAdapt_Destroy(XAAdaptationGstCtx* bCtx); - -#endif /* XALEDARRAYADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaledarrayitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaledarrayitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,57 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "xaledarrayadaptctx.h" -#include "xaledarrayitfadaptation.h" -#include "xaadaptationgst.h" - -/* - * XAresult XALEDArrayItfAdapt_ActivateLEDArray ( XAAdaptationGstCtx *bCtx, XAuint32 lightMask ) - */ -XAresult XALEDArrayItfAdapt_ActivateLEDArray ( XAAdaptationGstCtx *bCtx, XAuint32 lightMask ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API_A1("->XALEDArrayItfAdapt_ActivateLEDArray %ld", lightMask); - - if(!bCtx || bCtx->baseObj.ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XALEDArrayItfAdapt_ActivateLEDArray"); - return ret; -} -/* - * XAresult XALEDArrayItfAdapt_SetColor ( XAAdaptationGstCtx *bCtx, XAuint8 index, const XAHSL * pColor ) - */ -XAresult XALEDArrayItfAdapt_SetColor ( XAAdaptationGstCtx *bCtx, XAuint8 index, const XAHSL * pColor ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XALEDArrayItfAdapt_SetColor"); - - if(!bCtx || bCtx->baseObj.ctxId != XALedArrayAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XALEDArrayItfAdapt_SetColor"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaledarrayitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaledarrayitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XALEDARRAYITFADAPTATION_H_ -#define XALEDARRAYITFADAPTATION_H_ - -#include "xaadaptationgst.h" - - -/* FUNCTIONS */ -XAresult XALEDArrayItfAdapt_ActivateLEDArray ( XAAdaptationGstCtx *bCtx, XAuint32 lightMask ); -XAresult XALEDArrayItfAdapt_SetColor ( XAAdaptationGstCtx *bCtx, XAuint8 index, const XAHSL * pColor ); -#endif /* XALEDARRAYITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1114 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "xamediaplayeradaptctx.h" -#include "xamediaplayeradaptctxmmf.h" -#include "xaadaptationgst.h" -#include "xaobjectitf.h" -#include "xacameradevice.h" -#include "xaoutputmix.h" -#include "xametadataadaptation.h" -/*#include "xangavideosink.h"*/ -#include "xacameraadaptctx.h" -#include "xaoutputmixadaptctx.h" - -/* forward declarations */ -XAresult XAMediaPlayerAdapt_CreatePipeline( XAMediaPlayerAdaptationCtx* ctx ); - -void* ngaVideoSinkPtr = NULL; - - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/* - * static void XAMediaPlayerAdapt_NewPadCb (GstElement *element, GstPad *pad, gpointer data) - * Listen to codec bin dynamic pads - */ -static void XAMediaPlayerAdapt_NewPadCb (GstElement *element, GstPad *pad, gpointer data) -{ - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*)data; - gchar *name = gst_pad_get_name (pad); - DEBUG_API_A1("->XAMediaPlayerAdapt_NewPadCb: A new pad %s was created", name); - /*try first newly created pad to video pipe*/ - if( mCtx->videoppbin && !(gst_pad_is_linked(gst_element_get_static_pad(mCtx->videoppbin, "videopp_sink"))) ) - { - if(gst_element_link_pads (mCtx->codecbin, name, mCtx->videoppbin, "videopp_sink")) - { - DEBUG_INFO_A1("Pads linked, codecbin:%s to videopp:sink", name); - g_free (name); - DEBUG_API("<-XAMediaPlayerAdapt_NewPadCb"); - return; - } - } - /*..and then to audio pipe*/ - if( mCtx->audioppbin && !(gst_pad_is_linked(gst_element_get_static_pad(mCtx->audioppbin, "sink"))) ) - { - if(gst_element_link_pads (mCtx->codecbin, name, mCtx->audioppbin, "sink")) - { - DEBUG_INFO_A1("Pads linked, codecbin:%s to audiopp:sink", name); - g_free (name); - DEBUG_API("<-XAMediaPlayerAdapt_NewPadCb"); - return; - } - } - - g_free (name); - DEBUG_INFO("Warning: Could not find anything to link to new pad."); - DEBUG_API("<-XAMediaPlayerAdapt_NewPadCb"); -} - -/* - * void push_data_for_prerolling (GstElement * pipeline, GstBuffer *buffer, XAMediaPlayerAdaptationCtx* ctx) - * Called when "push-buffer" signal is emitted - */ -void push_data_for_prerolling (GstElement * pipeline, GstBuffer *buffer, XAMediaPlayerAdaptationCtx* ctx) -{ - DEBUG_API("->push_data_for_prerolling"); - gst_app_src_push_buffer( GST_APP_SRC(ctx->source), GST_BUFFER(buffer) ); - /*GstPad* prerollPad = NULL; - prerollPad = gst_element_get_static_pad(GST_ELEMENT(ctx->source),"src"); - gst_pad_push (prerollPad, buffer); - gst_element_send_event(GST_ELEMENT(ctx->source),gst_event_new_flush_start()); - gst_element_send_event(GST_ELEMENT(ctx->source),gst_event_new_flush_stop());*/ - DEBUG_API("<-push_data_for_prerolling"); -} - - -/* - * gboolean XAMediaPlayerAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) - * MediaPlayer Gst-bus message handler (Callback) - */ -gboolean XAMediaPlayerAdapt_GstBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XAAdaptationGstCtx* bCtx = (XAAdaptationGstCtx*)data; - /* only listen to bin messages */ - if(GST_MESSAGE_SRC(message)==(GstObject*)(bCtx->bin)) - { - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*)data; - DEBUG_API_A2("->XAMediaPlayerAdapt_GstBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_EOS: - { - if( mCtx && mCtx->loopingenabled && mCtx->loopend == GST_CLOCK_TIME_NONE) - { - DEBUG_INFO_A2("Restart loop from %"GST_TIME_FORMAT" to %"GST_TIME_FORMAT, - GST_TIME_ARGS(mCtx->loopstart), GST_TIME_ARGS(mCtx->loopend)); - gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE), - GST_SEEK_TYPE_SET, mCtx->loopstart, - GST_SEEK_TYPE_NONE, (gint64)GST_CLOCK_TIME_NONE ); - gst_element_get_state(bCtx->bin,NULL,NULL,XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - mCtx->lastpos = mCtx->loopstart; - if( mCtx && mCtx->trackpositionenabled ) - { - XAmillisecond posMsec = GST_TIME_AS_MSECONDS(mCtx->lastpos);/*Warning ok due to used API specification*/ - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - event.data = &posMsec; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - } - else - { - /* stop position tracking */ - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - - /* complete any ongoing client async operations */ - XAAdaptationGst_CompleteAsyncWait(bCtx); - - /* send needed events */ - { - XAMediaType mediatype; -/* - if( mCtx->baseObj.pipeSrcThrCtx.pipe ) - { - XACommon_CheckDataSource((XADataSource*)mCtx->xaAudioSink, &mediatype); - } - else -*/ - { - XACommon_CheckDataSource(mCtx->xaSource, &mediatype); - } - if(mediatype!=XA_MEDIATYPE_IMAGE) - { - XAAdaptEvent event = { XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADATEND, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - } - if(mCtx->positionCb) - { - mCtx->positionCb(bCtx); - } - bCtx->binWantedState = GST_STATE_PAUSED; - } - break; - } - - case GST_MESSAGE_STATE_CHANGED: - { - GstState oldstate, newstate, pendingstate, gsttargetstate; - gst_message_parse_state_changed(message, &oldstate, &newstate, &pendingstate); - gsttargetstate = GST_STATE_TARGET(bCtx->bin); - DEBUG_INFO_A4("old %s -> new %s ( pending %s, gsttarget %s )", - gst_element_state_get_name(oldstate), - gst_element_state_get_name(newstate), - gst_element_state_get_name(pendingstate), - gst_element_state_get_name(gsttargetstate) ); - if(gsttargetstate!=bCtx->binWantedState) - { - DEBUG_ERR_A1("WARNING: Gst target is not wanted target [%s]!!!", - gst_element_state_get_name(bCtx->binWantedState)); - } - /* print out some more info */ - if( pendingstate == GST_STATE_VOID_PENDING ) - { - if( newstate != bCtx->binWantedState ) - { - DEBUG_INFO_A2("Gst in intermediate state transition (curr %s, target %s)", - gst_element_state_get_name(newstate), - gst_element_state_get_name(bCtx->binWantedState)); - break; // TL: add to avoid extra event sent below in this case... - } - else - { - DEBUG_INFO_A1("Gst in wanted target state (%s)", - gst_element_state_get_name(newstate)); - } - } - if( oldstate!=GST_STATE_PLAYING && newstate==GST_STATE_PLAYING ) - { - /* send needed events */ - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_PLAYEVENT_HEADMOVING, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - /* enable position tracking if needed */ - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - if ( oldstate== GST_STATE_READY && newstate==GST_STATE_PAUSED) - { -/* if ( mCtx->baseObj.pipeSinkThrCtx.dataHandle ) - { - mCtx->baseObj.pipeSrcThrCtx.state = CPStateInitialized; - }*/ - } - break; - } - - case GST_MESSAGE_ASYNC_DONE: - { - /* some async sequence ended */ - XAAdaptationGst_CompleteAsyncWait(bCtx); - break; - } - - case GST_MESSAGE_ERROR: - { - GError* error; - gchar* debug; - gst_message_parse_error(message, &error, &debug); - DEBUG_ERR_A1("Gst reports error \"%s\"", debug); - /* stop waiting any ongoing async operations */ - XAAdaptationGst_CompleteAsyncWait(bCtx); - break; - } - case GST_MESSAGE_BUFFERING: - { - gint percent; - gst_message_parse_buffering(message, &percent); - DEBUG_INFO_A1("Gst message buffering %d", percent); - mCtx->buffering = percent; - { - XAAdaptEvent event = {XA_PREFETCHITFEVENTS, XA_ADAPT_BUFFERING, 1, NULL }; - event.data = &mCtx->buffering; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - break; - } - case GST_MESSAGE_ELEMENT: - { - DEBUG_INFO("GST_MESSAGE_ELEMENT"); - if ((gst_structure_has_name(message->structure, "graphics-surface-created")) || - (gst_structure_has_name(message->structure, "graphics-surface-updated"))) - { - DEBUG_INFO("graphics-surface-created message recived"); - } - break; - } - default: - break; - } - } - else //if (GST_MESSAGE_SRC(message)==(GstObject*)(bCtx->videosink)) - { - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_ELEMENT: - { - DEBUG_INFO("GST_MESSAGE_ELEMENT"); - if ((gst_structure_has_name(message->structure, "graphics-surface-created")) || - (gst_structure_has_name(message->structure, "graphics-surface-updated"))) - { - guint32 surfaceid0, surfaceid1, surfaceid2, surfaceid3; - gint crop_rect_tl_x, crop_rect_tl_y, crop_rect_br_x, crop_rect_br_y; - gint aspect_ratio_num, aspect_ratio_denom; - - GstObject *sink= GST_MESSAGE_SRC(message); - - g_object_get(sink, "surfaceid0", &surfaceid0, NULL); - g_object_get(sink, "surfaceid1", &surfaceid1,NULL); - g_object_get(sink, "surfaceid2", &surfaceid2,NULL); - g_object_get(sink, "surfaceid3", &surfaceid3,NULL); - g_object_get(sink, "croprect_tl_x", &crop_rect_tl_x, NULL); - g_object_get(sink, "croprect_tl_y", &crop_rect_tl_y, NULL); - g_object_get(sink, "croprect_br_x", &crop_rect_br_x, NULL); - g_object_get(sink, "croprect_br_y", &crop_rect_br_y, NULL); - g_object_get(sink, "aspectratio_num", &aspect_ratio_num, NULL); - g_object_get(sink, "aspectratio_denom", &aspect_ratio_denom, NULL); -/* - surface_created(ngaVideoSinkPtr, surfaceid0,surfaceid1,surfaceid2,surfaceid3,crop_rect_tl_x, - crop_rect_tl_y,crop_rect_br_x,crop_rect_br_y,aspect_ratio_num,aspect_ratio_denom); -*/ - } - break; - } - default: - break; - } - } - DEBUG_API("<-XAMediaPlayerAdapt_GstBusCb"); - return TRUE; -} - -/* - * XAMediaPlayerAdaptationCtx* XAMediaPlayerAdapt_Create() - * Allocates memory for Media Player Adaptation Context and makes 1st phase initialization - * @param XADataSource *pDataSrc - pointer to OMX-AL data source - * @param XADataSource *pBankSrc - pointer to instrument bank structure in Mobile DLS, if NULL default will be used. - * @param XADataSink *pAudioSnk - pointer to OMX-AL audio sink definition - * @param XADataSink *pImageVideoSnk - pointer to OMX-AL image and video sink definition - * @returns XAMediaPlayerAdaptationCtx* - Pointer to created context, NULL if error occurs. - */ -XAAdaptationBaseCtx* XAMediaPlayerAdapt_Create(XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray) -{ - XAMediaPlayerAdaptationCtx *pSelf = NULL; - XAuint32 locType = 0; - XADataLocator_IODevice *ioDevice; - - DEBUG_API("->XAMediaPlayerAdapt_Create"); - - //Create NGA Video Sink class -/* if(pImageVideoSnk) - { - ngaVideoSinkPtr = nga_video_sink_init(); - }*/ - - pSelf = calloc(1, sizeof(XAMediaPlayerAdaptationCtx)); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XAMediaPlayerAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - return NULL; - } - else - { - pSelf->xaSource = pDataSrc; - pSelf->xaBankSrc = pBankSrc; - pSelf->xaAudioSink = pAudioSnk; - pSelf->xaVideoSink = pImageVideoSnk; - pSelf->xaLEDArray = pLEDArray; - pSelf->xaVibra = pVibra; - pSelf->loopstart = 0; - pSelf->loopend = (gint64)GST_CLOCK_TIME_NONE; - pSelf->playrate = 1.0; - pSelf->rateprops = (XA_RATEPROP_SMOOTHVIDEO | XA_RATEPROP_SILENTAUDIO); - pSelf->curMirror = XA_VIDEOMIRROR_NONE; - pSelf->curRotation = 0; - pSelf->isobjsrc = XA_BOOLEAN_FALSE; - pSelf->cameraSinkSynced = XA_BOOLEAN_FALSE; -/* if(pImageVideoSnk && ngaVideoSinkPtr) - { - setup_native_display(ngaVideoSinkPtr, pImageVideoSnk); - }*/ - } - - if ( pDataSrc ) - { - locType = *((XAuint32*)(pDataSrc->pLocator)); - if ( locType == XA_DATALOCATOR_IODEVICE ) - { - ioDevice = (XADataLocator_IODevice*)(pDataSrc->pLocator); - if ( ioDevice->deviceType == XA_IODEVICE_CAMERA && !cameraRealized ) - { - DEBUG_ERR("Preconditions violated - Camera object not realized"); - XAAdaptationBase_Free(&pSelf->baseObj.baseObj); - free(pSelf); - pSelf = NULL; - } - } - } - } - - DEBUG_API("<-XAMediaPlayerAdapt_Create"); - return (XAAdaptationBaseCtx*)(&pSelf->baseObj); -} - - - -/* - * XAresult XAMediaPlayerAdapt_PostInit() - * 2nd phase initialization of Media Player Adaptation Context - * @param XAMediaPlayerAdaptationCtx* ctx - pointer to Media Player adaptation context - * @return XAresult - Success value - */ -XAresult XAMediaPlayerAdapt_PostInit( XAAdaptationGstCtx* bCtx ) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstStateChangeReturn gret; - - XAMediaPlayerAdaptationCtx* ctx = NULL; - GstElement *videotest=NULL; - - DEBUG_API("->XAMediaPlayerAdapt_PostInit"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAMediaPlayerAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAMediaPlayerAdaptationCtx*)bCtx; - assert(ctx); - ret = XAAdaptationBase_PostInit( &bCtx->baseObj ); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Base context postinit failed!!"); - return ret; - } - - /* top level bin for media player */ - ctx->baseObj.bin = gst_pipeline_new("media_player"); - /* Create Gst bus listener. */ - ret = XAAdaptationGst_InitGstListener(bCtx); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Bus listener creation failed!!"); - return ret; - } - /* Add Media Player specific handler */ - if(ctx->baseObj.bus) - { - ctx->baseObj.busCb = XAMediaPlayerAdapt_GstBusCb; - gst_bus_add_signal_watch( ctx->baseObj.bus ); - gst_bus_enable_sync_message_emission( ctx->baseObj.bus ); - g_signal_connect(ctx->baseObj.bus, "message::eos", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::error", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::warning", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::state-changed", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::segment-done", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::async-done", G_CALLBACK(bCtx->busCb), ctx ); - g_signal_connect(ctx->baseObj.bus, "message::element", G_CALLBACK(bCtx->busCb), ctx ); - } - else - { - DEBUG_ERR("Failed to create message bus"); - return XA_RESULT_INTERNAL_ERROR; - } - - XAMetadataAdapt_PreInit(bCtx); - - /* create pipeline */ - ret = XAMediaPlayerAdapt_CreatePipeline(ctx); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to create Media Player pipeline"); - return ret; - } - -#ifdef XA_IMPL_MEASURE_GST_DELAY - ctx->baseObj.startTime = clock(); -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - /* roll up bin */ - ctx->baseObj.binWantedState = GST_STATE_PAUSED; - - XAAdaptationGst_PrepareAsyncWait(bCtx); - gret = gst_element_set_state( GST_ELEMENT(ctx->baseObj.bin), bCtx->binWantedState); - if( gret == GST_STATE_CHANGE_ASYNC ) - { - DEBUG_INFO("Wait for preroll"); - XAAdaptationGst_StartAsyncWait(bCtx); - DEBUG_INFO("Preroll ready"); - } - else if( gret == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("Preroll FAILED"); - ret = XA_RESULT_INTERNAL_ERROR; - } - - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - - gret = gst_element_get_state( GST_ELEMENT(bCtx->bin), NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - if(GST_STATE(bCtx->bin)audioppbin && !(gst_pad_is_linked(gst_element_get_static_pad(ctx->audioppbin, "sink"))) ) - {/*could not find suitable pad for audiopipeline - remove it*/ - DEBUG_INFO("Warning! No suitable decodebin pad for audio pipeline!"); - gst_element_set_state( GST_ELEMENT(ctx->audioppbin), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->audioppbin); - gst_element_set_state( GST_ELEMENT(ctx->audiosink), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->audiosink); - } - else if( ctx->videoppbin && !(gst_pad_is_linked(gst_element_get_static_pad(ctx->videoppbin, "videopp_sink"))) ) - {/*could not find suitable pad for videopipeline - remove it*/ - DEBUG_INFO("Warning! No suitable decodebin pad for video pipeline!"); - gst_element_set_state( GST_ELEMENT(ctx->videoppbin), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->videoppbin); - gst_element_set_state( GST_ELEMENT(ctx->videosink), GST_STATE_NULL); - gst_bin_remove(GST_BIN(bCtx->bin), ctx->videosink); - } - gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - gst_element_get_state( GST_ELEMENT(bCtx->bin), NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - if(GST_STATE(bCtx->bin)==GST_STATE_PAUSED) - { - DEBUG_INFO("Retry preroll successful!") - ret = XA_RESULT_SUCCESS; - } - } - else - { - DEBUG_INFO("Preroll ready"); - } - -#ifdef XA_IMPL_MEASURE_GST_DELAY - bCtx->endTime = clock(); - double diff = bCtx->endTime - bCtx->startTime ; - diff = diff / CLOCKS_PER_SEC; - DEBUG_API_A1( "Starting up bin took %.4lf secs",diff); -#endif /* XA_IMPL_MEASURE_GST_DELAY */ - videotest = gst_bin_get_by_name(GST_BIN(bCtx->bin), "videotest"); - if ( videotest && !ctx->isobjsrc ) - { - gst_element_set_state( GST_ELEMENT(videotest),GST_STATE_PLAYING); - } - - XAMetadataAdapt_PostInit(bCtx); - - if ( videotest ) - { - gst_object_unref(videotest); - } - - DEBUG_API("<-XAMediaPlayerAdapt_PostInit"); - return ret; -} - -/* - * void XAMediaPlayerAdapt_Destroy( XAMediaPlayerAdaptationCtx* ctx ) - * Destroys Media Player Adaptation Context - * @param ctx - Media Player Adaptation context to be destroyed - */ -void XAMediaPlayerAdapt_Destroy( XAAdaptationGstCtx* bCtx ) -{ - XAMediaPlayerAdaptationCtx* ctx = NULL; - - DEBUG_API("->XAMediaPlayerAdapt_Destroy"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAMediaPlayerAdapt_Destroy"); - return; - } - ctx = (XAMediaPlayerAdaptationCtx*)bCtx; - - if( ctx->isobjsrc ) - { /* external source, unlink and remove now */ - /*gst_object_unparent( GST_OBJECT(ctx->source) );*/ - gst_element_unlink( ctx->source, ctx->codecbin ); - /*gst_bin_remove( GST_BIN(bCtx->bin), ctx->source );*/ - GST_OBJECT_FLAG_SET(GST_OBJECT(ctx->source),GST_OBJECT_FLOATING); - } -#if 0 - if ( ctx->xaSource ) - { - XAuint32 locType = *(XAuint32*)(ctx->xaSource->pLocator); - switch (locType ) - { - case XA_DATALOCATOR_IODEVICE: - { - XADataLocator_IODevice* ioDevice = (XADataLocator_IODevice*)(ctx->xaSource->pLocator); - if ( ioDevice->deviceType == XA_IODEVICE_RADIO ) - { - gst_object_unparent( GST_OBJECT(ctx->source) ); - gst_element_unlink( ctx->source, ctx->codecbin ); - gst_bin_remove( GST_BIN(bCtx->bin), ctx->source ); - GST_OBJECT_FLAG_SET(GST_OBJECT(ctx->source),GST_OBJECT_FLOATING); - } - } - default: - break; - } - } -#endif - - if( ctx->isobjasink && ctx->xaAudioSink && ctx->xaAudioSink->pLocator ) - { - XAuint32 locType = *(XAuint32*)(ctx->xaAudioSink->pLocator); - switch ( locType ) - { - case XA_DATALOCATOR_OUTPUTMIX: - { - XADataLocator_OutputMix* omix = (XADataLocator_OutputMix*)(ctx->xaAudioSink->pLocator); - XAOMixImpl* omixDevice = (XAOMixImpl*)(*omix->outputMix); - if(omixDevice) - { - XAOutputMixAdapt_DisconnectObject((XAAdaptationGstCtx*)omixDevice->adaptationCtx, bCtx); - } - break; - } - default: - /* Vibra and LED need no handling */ - break; - } - - } - - if( bCtx->bus ) - { - gst_bus_remove_signal_watch( bCtx->bus ); - gst_bus_disable_sync_message_emission ( bCtx->bus ); - } - XAAdaptationGst_CancelAsyncWait(bCtx); - - if( ctx->runpositiontimer ) - { - g_source_remove(ctx->runpositiontimer); - } - XAMetadataAdapt_FreeVars(ctx->metadatavars); - XAAdaptationBase_Free( &bCtx->baseObj ); - free(ctx); - ctx = NULL; - - DEBUG_API("<-XAMediaPlayerAdapt_Destroy"); -} - - -/* - * void XAMediaPlayerAdapt_CreatePipeline( XAMediaPlayerAdaptationCtx* ctx ); - */ -XAresult XAMediaPlayerAdapt_CreatePipeline( XAMediaPlayerAdaptationCtx* ctx ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAboolean delayedlink = XA_BOOLEAN_FALSE; - XAboolean isPCM = XA_BOOLEAN_FALSE; - XAboolean isRawImage = XA_BOOLEAN_FALSE; - XAMediaType mediatype; - XAuint32 locType = 0; - GstCaps* encSrcCaps = NULL; - DEBUG_API("->XAMediaPlayerAdapt_CreatePipeline"); - - /* create and add data source */ - XACommon_CheckDataSource(ctx->xaSource, &mediatype); - ctx->source = XAAdaptationGst_CreateGstSource( ctx->xaSource, "datasrc", &(ctx->isobjsrc), &isPCM, &isRawImage); - if( !(ctx->source) ) - { - DEBUG_ERR("Could not create data source!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - else - { - if(mediatype != XA_MEDIATYPE_AUDIO) - { - //temporary work around for video - encSrcCaps = gst_caps_new_simple ("video/h263-2000", - "framerate", GST_TYPE_FRACTION, 25, 1, - "pixel-aspect-ratio", GST_TYPE_FRACTION, 16, 9, - "width", G_TYPE_INT, 176, - "height", G_TYPE_INT, 144, - NULL); - g_object_set(G_OBJECT(ctx->source), "caps", encSrcCaps, NULL); - } - - //boolRetVal = gst_bin_add(GST_BIN(pipeline), appsrc); - - - } - - if ( !ctx->isobjsrc ) - { /* Add other than camera source to media player bin */ - DEBUG_INFO("No camera source"); - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->source); - } - else - { - GstCaps* encSrcCaps; - encSrcCaps = gst_caps_new_simple("video/x-raw-yuv", - "format", GST_TYPE_FOURCC,GST_MAKE_FOURCC('I','4','2','0'), - "framerate", GST_TYPE_FRACTION, 30, 1, - NULL); - DEBUG_INFO_A1("new camera encoding filter: %s",gst_caps_to_string(encSrcCaps)); - g_object_set( G_OBJECT(ctx->source), "filter-caps",encSrcCaps,NULL); - gst_caps_unref(encSrcCaps); - } - - /* create and add codec bin */ - if( !(ctx->isobjsrc || isPCM) ) - { - DEBUG_INFO("Create decodebin"); - if(mediatype == XA_MEDIATYPE_AUDIO) - { - ctx->codecbin = gst_element_factory_make( "decodebin" , "mpcodecbin" ); - } - else - { - ctx->codecbin = gst_element_factory_make( "identity" , "mpcodecbin" ); - } - } - else if(ctx->isobjsrc ) - { /* object sources produce framed raw data, decodebin only causes trouble */ //shyward - DEBUG_INFO("Create identity") - ctx->codecbin = gst_element_factory_make( "identity" , "mpcodecbin" ); - } - else if(isPCM) - { /* decodebin does not know how to handle PCM files */ - DEBUG_INFO("Create audioparse") - ctx->codecbin = gst_element_factory_make( "audioparse" , "mpcodecbin" ); - } - else if ( isRawImage) - { /* decodebin does not know how to handle raw unframed video data */ - DEBUG_INFO("Create videoparse") - ctx->codecbin = gst_element_factory_make( "videoparse", "mpcodecbin" ); - } - - if( ctx->codecbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->codecbin); - if ( !ctx->isobjsrc ) - { - if(mediatype == XA_MEDIATYPE_AUDIO) - { - if( !gst_element_link(ctx->source, ctx->codecbin) ) - { - DEBUG_ERR("Could not link source to decodebin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - if( !gst_element_link_filtered(ctx->source, ctx->codecbin, encSrcCaps ) ) - { - DEBUG_ERR("Could not link source to decodebin!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } - else - { /* Link camera source by using ghost-pads, because elements are in different bins */ - - GstPad *cameraBinGhostPad=NULL; - GstPad* ghost=NULL; - GstElement *camTee=NULL; - GstStateChangeReturn gret; - GstPad *mpGhostSink=NULL; - - /* Set external camera source to ready for pipeline manipulation */ - DEBUG_INFO("Set ext-source PAUSED for pipeline manipulation"); - gret = gst_element_set_state( GST_ELEMENT(ctx->source), GST_STATE_READY); - if(gret == GST_STATE_CHANGE_SUCCESS) - { - gret = gst_element_get_state( GST_ELEMENT(ctx->source), NULL,NULL,XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - - /* Add new ghost-pad to external camera source */ - camTee = gst_bin_get_by_name( GST_BIN(ctx->source), "CamTee"); - if ( !camTee ) - { - DEBUG_ERR("Could not get tee-element from camera"); - } - cameraBinGhostPad = gst_element_get_request_pad( camTee, "src%d" ); - if ( !cameraBinGhostPad ) - { - DEBUG_ERR("Could not get new src-pad from CamTee element"); - } - gst_element_add_pad(ctx->source, gst_ghost_pad_new("MPObjSrc",cameraBinGhostPad)); - ghost = gst_element_get_static_pad( GST_ELEMENT(ctx->source), "MPObjSrc" ); - DEBUG_INFO_A2("Setting element:%s pad:%s to blocking.", - gst_element_get_name(ctx->baseObj.bin), - gst_pad_get_name(ghost)); - /* Set newly created pad to blocking */ - gst_pad_set_blocked_async(ghost, TRUE, XAAdaptationGst_PadBlockCb, NULL); - - - /* Create new ghost-pad to media player pipeline where external camera is connected */ - mpGhostSink = gst_element_get_static_pad( GST_ELEMENT(ctx->codecbin), "sink"); - gst_element_add_pad(ctx->baseObj.bin, gst_ghost_pad_new("MPObjSink",mpGhostSink)); - - if ( !gst_element_link_pads( GST_ELEMENT(ctx->source), "MPObjSrc", - GST_ELEMENT(ctx->baseObj.bin), "MPObjSink") ) - { - DEBUG_ERR("Could not link camera:MPObjSrc to videofilter:MPObjSink"); - return XA_RESULT_INTERNAL_ERROR; - } - - if ( cameraBinGhostPad ) - { - gst_object_unref( cameraBinGhostPad ); - } - if ( ghost ) - { - gst_object_unref( ghost ); - } - if ( mpGhostSink ) - { - gst_object_unref( mpGhostSink ); - } - if ( camTee ) - { - gst_object_unref( camTee ); - } - } - } - else - { - DEBUG_ERR("Could not create decoder bin!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* create and add video stream pipeline */ - if(!ctx->xaLEDArray && !ctx->xaVibra && mediatype!=XA_MEDIATYPE_AUDIO) /*no video for these*/ - { - /* create video processing pipeline */ - ctx->videoppbin = XAAdaptationGst_CreateVideoPP( ); - if( ctx->videoppbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videoppbin); - //shyward ---link filtered??? - // boolRetVal = gst_element_link_filtered(appsrc, videosink, caps); - //if(!gst_element_link(ctx->codecbin, ctx->videoppbin)) - if(!gst_element_link_filtered(ctx->codecbin, ctx->videoppbin,encSrcCaps)) - { - /* probably dynamic pads in codecbin */ - DEBUG_INFO("Could not link codec to videopp, trying delayed link"); - delayedlink = XA_BOOLEAN_TRUE; - } - ctx->videoScrSrcPad = gst_element_get_static_pad(ctx->videoppbin, "videopp_src"); - } - else - { - DEBUG_ERR("Could not create video pp bin!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - //shyward - /* Black screen pipeline not needed under Symbian. May need to revist for acceptance testing - ctx->videoppBScrbin = XAAdaptationBase_CreateVideoPPBlackScr( ); - if( ctx->videoppBScrbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videoppBScrbin); - ctx->blackScrSrcPad = gst_element_get_static_pad(ctx->videoppBScrbin, "videoppBSrc_src"); - } - else - { - DEBUG_ERR("Could not create video pp bin for black screen!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - */ - ctx->inputSelector = XAAdaptationGst_CreateInputSelector( ); - if( ctx->inputSelector ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->inputSelector); - ctx->videoScrSinkPad = gst_element_get_request_pad(ctx->inputSelector, "sink%d"); - ctx->blackScrSinkPad = gst_element_get_request_pad(ctx->inputSelector, "sink%d"); - gst_pad_link(ctx->blackScrSrcPad, ctx->blackScrSinkPad); - gst_pad_link(ctx->videoScrSrcPad, ctx->videoScrSinkPad); - } - - //shyward - We have no video filter at this time - /* - ctx->filter = gst_element_factory_make("ffmpegcolorspace", "videofilter"); - gst_bin_add( GST_BIN(ctx->baseObj.bin), ctx->filter); - if ( !gst_element_link( ctx->inputSelector, ctx->filter ) ) - { - DEBUG_ERR("Could not link ctx->filter <-> ctx->inputSelector"); - return XA_RESULT_INTERNAL_ERROR; - } - */ - /* create video pipe sink */ - ctx->videosink = XAAdaptationGst_CreateGstSink( ctx->xaVideoSink, "videosink", &(ctx->isobjvsink) ); - /* NOTE: no valid object sinks for video output available */ - if( ctx->videosink ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->videosink); - - //shyward - //if(!gst_element_link(ctx->filter, ctx->videosink)) - if(!gst_element_link_filtered(ctx->videoppbin, ctx->videosink,encSrcCaps)) - { - DEBUG_ERR("Could not link videopp to videosink!!"); - return XA_RESULT_INTERNAL_ERROR; - } - else - { - gst_caps_unref(encSrcCaps); - } - } - else - { - DEBUG_ERR("Could not create video sink!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_INFO("Media does not contain video!"); - } - - /* create and add audio stream pipeline */ - - if(!ctx->xaLEDArray && !ctx->xaVibra && mediatype!=XA_MEDIATYPE_IMAGE) /*no audio for these*/ - { - /* create audio post processing pipeline */ - ctx->audioppbin = XAAdaptationGst_CreateAudioPP( ); - if( ctx->audioppbin ) - { - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audioppbin); - if(!gst_element_link(ctx->codecbin, ctx->audioppbin)) - { - DEBUG_INFO("Could not link codec to audiopp, trying delayed link"); - delayedlink = XA_BOOLEAN_TRUE; - } - } - else - { - DEBUG_ERR("Could not create audio pp bin!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - /* create audio pipe sink */ - ctx->audiosink = XAAdaptationGst_CreateGstSink( ctx->xaAudioSink, "audiosink", &(ctx->isobjasink) ); - if( ctx->audiosink ) - { - if( ctx->isobjasink && ctx->xaAudioSink && ctx->xaAudioSink->pLocator ) - { - locType = *(XAuint32*)(ctx->xaAudioSink->pLocator); - switch ( locType ) - { - case XA_DATALOCATOR_OUTPUTMIX: - { - XADataLocator_OutputMix* omix = (XADataLocator_OutputMix*)(ctx->xaAudioSink->pLocator); - XAOMixImpl* omixDevice = (XAOMixImpl*)(*omix->outputMix); - if(omixDevice) - { - XAOutputMixAdapt_ConnectObject((XAAdaptationGstCtx*)omixDevice->adaptationCtx, &(ctx->baseObj), ctx->audiosink); - } - break; - } - default: - /* Vibra and LED need no handling */ - break; - } - } - gst_bin_add(GST_BIN(ctx->baseObj.bin), ctx->audiosink); - if(!gst_element_link(ctx->audioppbin, ctx->audiosink)) - { - DEBUG_ERR("Could not link audiopp to audiosink!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("Could not create audio sink!!!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_INFO("Media does not contain audio!"); - } - - if(delayedlink) - { - /* listen for dynamically created pads */ - g_signal_connect (ctx->codecbin, "pad-added", G_CALLBACK (XAMediaPlayerAdapt_NewPadCb), ctx); - } - locType = *((XAuint32*)(ctx->xaSource->pLocator)); - - DEBUG_API("<-XAMediaPlayerAdapt_CreatePipeline"); - return ret; -} - -/* - * gboolean XAMediaPlayerAdapt_PositionUpdate(gpointer ctx) - * callback. - * If position tracking enabled, periodic timer calls this method every XA_ADAPT_PU_INTERVAL msecs - * @return false to stop periodic calls - */ -gboolean XAMediaPlayerAdapt_PositionUpdate(gpointer ctx) -{ - XAAdaptationGstCtx *bCtx = (XAAdaptationGstCtx*) ctx; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) ctx; - gint64 position; - XAmillisecond posMsec; - GstFormat format = GST_FORMAT_TIME; - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - - DEBUG_API("->XAMediaPlayerAdapt_PositionUpdate"); - if ( !gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - DEBUG_ERR("Gst: Failed to get position"); - return( mCtx->runpositiontimer ); - } - DEBUG_INFO_A1("Current position %"GST_TIME_FORMAT, GST_TIME_ARGS(position)); - if( mCtx && mCtx->trackpositionenabled ) - { - posMsec = GST_TIME_AS_MSECONDS(position);/*Warning ok due to used API specification*/ - DEBUG_INFO_A1("mCtx->trackpositionenabled sending update, position:&ld ", posMsec); - /* send needed events */ - event.data=&posMsec; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - if( mCtx && mCtx->loopingenabled) - { - DEBUG_INFO_A2("mCtx->loopingenabled, current position:%lu, loopend:%lu ", position, mCtx->loopend); - if( (position >= mCtx->loopend) && - (mCtx->lastpos < mCtx->loopend) ) - { - DEBUG_INFO_A2("Restart loop from %"GST_TIME_FORMAT" to %"GST_TIME_FORMAT, - GST_TIME_ARGS(mCtx->loopstart), GST_TIME_ARGS(mCtx->loopend)); - gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE), - GST_SEEK_TYPE_SET, mCtx->loopstart, - GST_SEEK_TYPE_NONE, (gint64)GST_CLOCK_TIME_NONE ); - mCtx->lastpos = mCtx->loopstart; - if( mCtx && mCtx->trackpositionenabled ) - { - DEBUG_INFO_A1("mCtx->trackpositionenabled sending looping update, position:%&u ", posMsec); - posMsec = GST_TIME_AS_MSECONDS(mCtx->lastpos);/*Warning ok due to used API specification*/ - /* send needed events */ - event.data=&posMsec; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - } - else - { - mCtx->lastpos = position; - } - } - DEBUG_API("<-XAMediaPlayerAdapt_PositionUpdate"); - /* return false to stop timer */ - return( mCtx->runpositiontimer ); -} - -/* - * XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer - * Enable/disable periodic position tracking callback timer - */ -XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer(XAMediaPlayerAdaptationCtx* mCtx) -{ - DEBUG_API_A2("->XAMediaPlayerAdapt_UpdatePositionCbTimer: trackposition %u, tracklooping %u", - mCtx->trackpositionenabled, mCtx->loopingenabled); - - if(mCtx->runpositiontimer==0 && (mCtx->trackpositionenabled || mCtx->loopingenabled)) - { - DEBUG_INFO("Start position tracking timer"); - mCtx->positionCb = &XAMediaPlayerAdapt_PositionUpdate; - /* if play is already on, create a timer to track position of playback */ - if( GST_STATE(mCtx->baseObj.bin) == GST_STATE_PLAYING ) - { - mCtx->runpositiontimer = g_timeout_add(XA_ADAPT_PU_INTERVAL, mCtx->positionCb, mCtx); - } - } - else if (mCtx->runpositiontimer!=0 && !(mCtx->trackpositionenabled || mCtx->loopingenabled)) - { - DEBUG_INFO("Stop position tracking timer"); - mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - } - DEBUG_API("<-XAMediaPlayerAdapt_UpdatePositionCbTimer"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAMediaPlayerAdapt_InitContentPipeSrc(ctx) - * CP code: can be moved to context base - */ -/*XAresult XAMediaPlayerAdapt_InitContentPipeSrc(XAMediaPlayerAdaptationCtx* ctx) -{ - XAresult ret = XA_RESULT_SUCCESS; - CPresult res; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - DEBUG_API("->XAMediaPlayerAdapt_InitContentPipeSrc"); - ctx->baseObj.pipeSrcThrCtx.appSrc = GST_APP_SRC(ctx->source); - ctx->baseObj.pipeSrcThrCtx.pipe = (XADataLocator_ContentPipe*)(ctx->xaSource->pLocator); - - Create thread for content pipe source - ret = XAImpl_CreateThreadHandle( &(ctx->baseObj.pipeSrcThr) ); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not create thread for content pipe source!"); - DEBUG_API("<-XAMediaPlayerAdapt_InitContentPipeSrc"); - return ret; - } - - Create semaphore for content pipe source - ret = XAImpl_CreateSemaphore( &(ctx->baseObj.pipeSrcThrCtx.stateSem)); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not create semaphore for content pipe source!"); - DEBUG_API("<-XAMediaPlayerAdapt_InitContentPipeSrc"); - return ret; - } - - Open content pipe - res = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->Open(&(ctx->baseObj.pipeSrcThrCtx.dataHandle), - (CPstring)(ctx->baseObj.pipeSrcThrCtx.pipe->URI), - CP_AccessRead ); - if ( res == EXIT_FAILURE ) - { - DEBUG_ERR("Could not open Content Pipe!") - return XA_RESULT_INTERNAL_ERROR; - } - - res = ctx->baseObj.pipeSrcThrCtx.pipe->pContentPipe->RegisterCallback( &(ctx->baseObj.pipeSrcThrCtx.dataHandle), &XAAdaptationBase_ContentPipeSrcCb); - if ( res == EXIT_FAILURE ) - { - DEBUG_ERR("Could not register content pipe callbacks!") - return XA_RESULT_INTERNAL_ERROR; - } - - gstRet = gst_element_set_state( GST_ELEMENT(ctx->source), GST_STATE_PAUSED); - gst_element_sync_state_with_parent( GST_ELEMENT( ctx->source)); - - XAImpl_StartThread( &(ctx->baseObj.pipeSrcThr), NULL, &XAAdaptationBase_ContentPipeScrThrFunc, &(ctx->baseObj.pipeSrcThrCtx) ); - - DEBUG_API("<-XAMediaPlayerAdapt_InitContentPipeSrc"); - return ret; -}*/ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xamediaplayeradaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMEDIAPLAYERADAPTCTX_H -#define XAMEDIAPLAYERADAPTCTX_H - -#include "xaadaptationgst.h" -#include "xametadataadaptation.h" -/* TYPEDEFS */ - -typedef struct XAMediaPlayerAdaptationCtx_ XAMediaPlayerAdaptationCtx; - -/* - * Structure for Media Player specific gst-adaptation. - */ -typedef struct XAMediaPlayerAdaptationCtx_ -{ - /* Parent*/ - XAAdaptationGstCtx_ baseObj; - - /* OMX-AL Variables */ - XADataSource *xaSource, *xaBankSrc; - XADataSink *xaAudioSink, *xaVideoSink, *xaLEDArray, *xaVibra; - - /* GST elements */ - GstElement *source; - XAboolean isobjsrc; /*is source another XA object?*/ - GstElement *codecbin; - GstElement *audioppbin; - GstElement *videoppbin; - GstElement *filter; - GstElement *videoppBScrbin; - GstElement *inputSelector; - GstPad *blackScrSrcPad; - GstPad *videoScrSrcPad; - GstPad *blackScrSinkPad; - GstPad *videoScrSinkPad; - GstElement *audiosink; - XAboolean isobjasink; /*is audio sink another XA object?*/ - GstElement *videosink; - XAboolean isobjvsink; /*is video sink another XA object?*/ - - XAboolean mute; - XAuint32 imageEffectID; - XAboolean isStereoPosition; - XAmillidegree curRotation; - XAuint32 curMirror; - - XAint32 buffering; - - /* internals */ - XAboolean trackpositionenabled; - guint runpositiontimer; - GSourceFunc positionCb; - gint64 lastpos; - - XAboolean loopingenabled; - gint64 loopstart; - gint64 loopend; - - gdouble playrate; - guint32 rateprops; - - XAboolean cameraSinkSynced; - - XAMetadataAdaptVars *metadatavars; - -} XAMediaPlayerAdaptationCtx_; - - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAMediaPlayerAdapt_Create( XADataSource *pDataSrc, XADataSource *pBankSrc, - XADataSink *pAudioSnk, XADataSink *pImageVideoSnk, - XADataSink *pVibra, XADataSink *pLEDArray); -XAresult XAMediaPlayerAdapt_PostInit( XAAdaptationGstCtx* bCtx ); -void XAMediaPlayerAdapt_Destroy( XAAdaptationGstCtx* bCtx ); -XAresult XAMediaPlayerAdapt_UpdatePositionCbTimer(XAMediaPlayerAdaptationCtx_* mCtx); - -XAresult XAMediaPlayerAdapt_InitContentPipeSrc(XAMediaPlayerAdaptationCtx* ctx); -#endif /*XAMEDIAPLAYERADAPTCTX_H*/ - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xamediarecorderadaptctx.c Fri Jul 09 16:43:35 2010 -0500 @@ -21,11 +21,6 @@ #include #include "xacapabilitiesmgr.h" #include "xamediarecorderadaptctx.h" -#include "xacameraadaptctx.h" - - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; /*forward declarations*/ GstElement* XAMediaRecorderAdapt_CreateEncodeBin( @@ -165,8 +160,6 @@ XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes) { XAMediaRecorderAdaptationCtx *pSelf = NULL; - XAuint32 locType = 0; - XADataLocator_IODevice *ioDevice; DEBUG_API("->XAMediaRecorderAdapt_Create"); pSelf = (XAMediaRecorderAdaptationCtx*)calloc(1, sizeof(XAMediaRecorderAdaptationCtx)); @@ -219,26 +212,6 @@ pSelf->audioEncSettings.encodeOptions = 0; pSelf->audioEncSettings.blockAlignment = 0; } - - if (pImageVideoSrc) - { - locType = *((XAuint32*) (pImageVideoSrc->pLocator)); - if (locType == XA_DATALOCATOR_IODEVICE) - { - ioDevice - = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator); - if (ioDevice->deviceType == XA_IODEVICE_CAMERA - && !cameraRealized) - { - DEBUG_ERR("Preconditions violated - Camera object not realized"); - XAAdaptationBase_Free(&pSelf->baseObj.baseObj); - free(pSelf); - pSelf = NULL; - DEBUG_API("<-XAMediaRecorderAdapt_Create"); - return NULL; - } - } - } } DEBUG_API("<-XAMediaRecorderAdapt_Create"); @@ -260,7 +233,8 @@ DEBUG_API("->XAMediaRecorderAdapt_PostInit"); if (bCtx == NULL || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) { - DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); + DEBUG_ERR("Invalid parameter!!"); + DEBUG_API("<-XAMediaRecorderAdapt_PostInit"); return XA_RESULT_PARAMETER_INVALID; } ctx = (XAMediaRecorderAdaptationCtx*) bCtx; @@ -354,7 +328,8 @@ if (bCtx == NULL || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) { - DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMediaRecorderAdapt_Destroy"); + DEBUG_ERR("Invalid parameter!!"); + DEBUG_API("<-XAMediaRecorderAdapt_Destroy"); return; } ctx = (XAMediaRecorderAdaptationCtx*) bCtx; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xametadataadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xametadataadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xametadataadaptation.c Fri Jul 09 16:43:35 2010 -0500 @@ -18,8 +18,7 @@ #include #include #include "xaadaptationgst.h" -#include "xametadataadaptctx.h" -#include "xamediaplayeradaptctx.h" + #include "xamediarecorderadaptctx.h" #include "xametadataadaptation.h" @@ -111,16 +110,8 @@ XAresult ret = XA_RESULT_SUCCESS; XAMetadataAdaptVars* mdv; DEBUG_API("->XAMetadataAdapt_PreInit"); - if( bCtx->baseObj.ctxId == XAMDAdaptation || - bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - mdv = (XAMetadataAdaptVars*) calloc(1, sizeof(XAMetadataAdaptVars)); - mdv->currentchild = &(mdv->generaltags); - mdv->traversemode=XA_METADATATRAVERSALMODE_NODE; - ((XAMediaPlayerAdaptationCtx*)bCtx)->metadatavars = mdv; - - } - else if ( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) + + if ( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) { mdv = (XAMetadataAdaptVars*) calloc(1, sizeof(XAMetadataAdaptVars)); mdv->currentchild = &(mdv->generaltags); @@ -155,97 +146,7 @@ XAresult XAMetadataAdapt_PostInit(XAAdaptationGstCtx *bCtx) { XAresult ret = XA_RESULT_SUCCESS; - XAMetadataAdaptVars* mdv=NULL; - XAMediaPlayerAdaptationCtx* mCtx=NULL; - GstPad* tmppad=NULL; - GstCaps* tmpcaps=NULL; - GstElement* tmpelement=NULL; - XAAdaptEvent event = {XA_METADATAEVENTS, XA_ADAPT_MDE_TAGS_AVAILABLE, 0, NULL }; - DEBUG_API("->XAMetadataAdapt_PostInit"); - if( bCtx->baseObj.ctxId == XAMDAdaptation || - bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - mdv = XAMetadataAdapt_GetMetadataVars(bCtx); - if( mdv ) - { - mdv->childcount = 0; - /* try to dig out audio and video pads from decodebin for stream info tags */ - /* NOTE: currently no good deterministic way to dig out undecoded pads - * from decodebin's internal demuxer, this is just ugly way to try to cope - * with most demuxers. - */ - mCtx = ((XAMediaPlayerAdaptationCtx*)bCtx); - if(GST_IS_BIN(mCtx->codecbin)) - { - tmpelement=gst_bin_get_by_name(GST_BIN(mCtx->codecbin),"typefind"); - if(tmpelement) - { - tmppad = gst_element_get_static_pad(GST_ELEMENT(tmpelement),"src"); - tmpelement=NULL; - if(tmppad) - { - tmppad = gst_pad_get_peer(tmppad); - if(tmppad) - { - tmpelement = gst_pad_get_parent_element(tmppad); - } - } - /* now we have demuxer, if existing */ - if(tmpelement) - { - tmppad = gst_element_get_pad( tmpelement, "audio_00"); - if(tmppad) - { - tmpcaps = gst_pad_get_negotiated_caps( GST_PAD(tmppad) ); - if(tmpcaps==NULL || gst_caps_is_any(tmpcaps) || gst_caps_is_empty(tmpcaps)) - { - mdv->audiotags = NULL; - DEBUG_INFO("no usable audio properties found from pad !"); - } - else - { - mdv->audiotags = gst_caps_get_structure(tmpcaps,0); - mdv->childcount++; - DEBUG_INFO_A1("found audio node: %s",gst_caps_to_string(tmpcaps)); - } - } - tmppad = gst_element_get_pad( tmpelement, "video_00"); - if(tmppad) - { - tmpcaps = gst_pad_get_negotiated_caps( GST_PAD(tmppad) ); - if(tmpcaps==NULL || gst_caps_is_any(tmpcaps) || gst_caps_is_empty(tmpcaps)) - { - mdv->videotags = NULL; - DEBUG_INFO("no usable video properties found from pad !"); - } - else - { - mdv->videotags = gst_caps_get_structure(tmpcaps,0); - mdv->childcount++; - DEBUG_INFO_A1("found video node: %s",gst_caps_to_string(tmpcaps)); - } - } - } - } - } - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - } - - if ( tmpelement ) - { - gst_object_unref( tmpelement ); - } - if ( tmppad ) - { - gst_object_unref( tmppad ); - } - if ( tmpcaps ) - { - gst_object_unref( tmpcaps ); - } - DEBUG_API_A1("<-XAMetadataAdapt_PostInit (%d)", (int)ret); return ret; } @@ -621,7 +522,8 @@ DEBUG_ERR("Nodetype not supported!"); ret = XA_RESULT_CONTENT_UNSUPPORTED; DEBUG_API_A1("<-XAMetadataInsertionItfAdapt_CreateChildNode (%d)", (int)ret); - return ret; } + return ret; + } mdv = mCtx->metadatavars; if(!mdv) @@ -956,12 +858,8 @@ */ XAMetadataAdaptVars* XAMetadataAdapt_GetMetadataVars(XAAdaptationGstCtx *bCtx) { - if( bCtx->baseObj.ctxId == XAMDAdaptation || - bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - return ((XAMediaPlayerAdaptationCtx*)bCtx)->metadatavars; - } - else if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) + + if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) { return ((XAMediaRecorderAdaptationCtx*)bCtx)->metadatavars; } @@ -1087,13 +985,8 @@ GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); gst_message_parse_tag (message, &new_tags); /* NOTE: only general tags received this way (not child nodes)*/ - if( bCtx->baseObj.ctxId == XAMDAdaptation || - bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - old_tags = &((XAMediaPlayerAdaptationCtx*)bCtx)->metadatavars->generaltags; - mode = GST_TAG_MERGE_REPLACE; - } - else if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) + + if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) { old_tags = &((XAMediaRecorderAdaptationCtx*)bCtx)->metadatavars->generaltags; /* keep user's tags */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xametadataadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xametadataadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xametadataadaptctx.h" -#include "xaadaptationgst.h" - -/* - * XAAdaptationGstCtx* XAMetadataAdapt_Create() - * Allocates memory for Metadata Adaptation Context and makes 1st phase initialization - * @returns XAMetadataAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XAMetadataAdaptCtx_Create(XADataSource* pDataSrc) -{ - /* use media player context with NULL sinks - * (no specific MDE context needed, because in GStreamer, - * playback resources are needed for getting stream tags) - **/ - return XAMediaPlayerAdapt_Create(pDataSrc,NULL,NULL,NULL,NULL,NULL); -} - -/* - * XAresult XAMetadataAdapt_PostInit() - * 2nd phase initialization of Metadata Adaptation Context - */ -XAresult XAMetadataAdaptCtx_PostInit(XAAdaptationGstCtx* bCtx) -{ - /* pipe to media player adaptation */ - return XAMediaPlayerAdapt_PostInit(bCtx); -} - -/* - * void XAMetadataAdapt_Destroy(XAMetadataAdaptationCtx* ctx) - * Destroys Metadata Adaptation Context - * @param ctx - Metadata Adaptation context to be destroyed - */ -void XAMetadataAdaptCtx_Destroy(XAAdaptationGstCtx* bCtx) -{ - /* pipe to media player adaptation */ - XAMediaPlayerAdapt_Destroy(bCtx); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xametadataadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xametadataadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAMETADATAADAPTCTX_H -#define XAMETADATAADAPTCTX_H - -#include "xamediaplayeradaptctx.h" -/* TYPEDEFS */ - -/* use media player context with NULL sinks - * (no specific MDE context needed, because in GStreamer, - * playback resources are needed for getting stream tags) - */ -typedef struct XAMediaPlayerAdaptationCtx_ XAMetadataAdaptationCtx; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAMetadataAdaptCtx_Create(XADataSource* pDataSource); -XAresult XAMetadataAdaptCtx_PostInit(XAAdaptationGstCtx* bCtx); -void XAMetadataAdaptCtx_Destroy(XAAdaptationGstCtx* bCtx); - - -#endif /* XAMETADATAADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaoutputmixadaptctx.h" -#include "xaadaptationgst.h" -#include "xacapabilitiesmgr.h" - - -/* - * XAAdaptationGstCtx* XAOutputMixAdapt_Create() - * @returns XAOutputMixAdaptationCtx* - Pointer to created context - * Description: Allocates memory for Output Mix Adaptation Context and makes 1st phase initialization - */ -XAAdaptationBaseCtx* XAOutputMixAdapt_Create() -{ - XAOutputMixAdaptationCtx *pSelf = (XAOutputMixAdaptationCtx*)calloc(1, sizeof(XAOutputMixAdaptationCtx)); - - DEBUG_API("->XAOutputMixAdapt_Create"); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XAOutputMixAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - XAuint32 devId; - pSelf->connectedObjects = g_array_new (FALSE, TRUE, sizeof (XAOMixAdaptConnObj)); - pSelf->availableDevices = g_array_new (FALSE, TRUE, sizeof (XAuint32)); - /*initially, only alsasink available*/ -// devId = XA_ADAPTID_ALSASINK; - devId = XA_ADAPTID_DEVSOUNDSINK; - g_array_append_val(pSelf->availableDevices, devId); - pSelf->currentrouting = devId; - } - } - DEBUG_API("<-XAOutputMixAdapt_Create"); - return (XAAdaptationBaseCtx* )&pSelf->baseObj; -} - -/* - * XAresult XAOutputMixAdapt_PostInit(XAAdaptationGstCtx* bCtx) - * 2nd phase initialization of Output Mix Adaptation Context - */ -XAresult XAOutputMixAdapt_PostInit(XAAdaptationGstCtx* bCtx) -{ - DEBUG_API("->XAOutputMixAdapt_PostInit"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAOutputMixAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check and add devices to pSelf->availableDevices if such detection can be done */ - DEBUG_API("<-XAOutputMixAdapt_PostInit"); - return XA_RESULT_SUCCESS; -} - -/* - * void XAOutputMixAdapt_Destroy(XAAdaptationGstCtx* bCtx) - * Destroys Output Mix Adaptation Context - * @param ctx - Output Mix Adaptation context to be destroyed - */ -void XAOutputMixAdapt_Destroy(XAAdaptationGstCtx* bCtx) -{ - XAOutputMixAdaptationCtx* ctx = NULL; - DEBUG_API("->XAOutputMixAdapt_Destroy"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAOutputMixAdapt_Destroy"); - return; - } - ctx = (XAOutputMixAdaptationCtx*)bCtx; - g_array_free(ctx->connectedObjects, TRUE); - g_array_free(ctx->availableDevices, TRUE); - - XAAdaptationBase_Free( &(ctx->baseObj.baseObj) ); - free(ctx); - DEBUG_API("<-XAOutputMixAdapt_Destroy"); -} - -/* - * GstElement* XAOutputMixAdapt_GetSink(XAAdaptationGstCtx* bCtx) - */ -GstElement* XAOutputMixAdapt_GetSink(XAAdaptationGstCtx* bCtx) -{ - XAOutputMixAdaptationCtx* mixCtx = NULL; - /* create sink for current routing */ - GstElement* newsink=NULL; - XACapabilities temp; - - DEBUG_API("->XAOutputMixAdapt_GetSink"); - if(bCtx == NULL || bCtx->baseObj.ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XAOutputMixAdapt_GetSink"); - return NULL; - } - mixCtx = (XAOutputMixAdaptationCtx*)bCtx; - - if(!mixCtx) - { - DEBUG_ERR("NULL context!"); - return NULL; - } - - if( XA_RESULT_SUCCESS == - XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)((XACapsType)(XACAP_DEVSNK|XACAP_AUDIO)), mixCtx->currentrouting, &temp) ) - { - newsink = gst_element_factory_make((char*)temp.adaptId,(char*)temp.adaptId); - if(!newsink) - { - DEBUG_ERR_A1("Could not create sink \"%s\"!", (char*)temp.adaptId); - } - } - else - { - DEBUG_ERR_A1("Could not find audio device by id 0x%x", (int)mixCtx->currentrouting); - } - DEBUG_API("<-XAOutputMixAdapt_GetSink"); - return newsink; - -} - -/* - * XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationGstCtx* omCtx, XAAdaptationGstCtx* bCtx, GstElement* usedMix) - */ -XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationGstCtx* omCtx, XAAdaptationGstCtx* bCtx, GstElement* usedMix) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 i=0; - XAOutputMixAdaptationCtx* mixCtx =NULL; - DEBUG_API("->XAOutputMixAdapt_ConnectObject"); - if( !omCtx || omCtx->baseObj.ctxId!=XAOutputMixAdaptation || !bCtx || !usedMix ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_ConnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - mixCtx = (XAOutputMixAdaptationCtx*)omCtx; - if( !mixCtx || !bCtx || !usedMix ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; iconnectedObjects->len; i++) - { - if( (g_array_index(mixCtx->connectedObjects, XAOMixAdaptConnObj, i)).ctx == bCtx ) - { - /*item found already*/ - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - } - if(i==mixCtx->connectedObjects->len) - { - XAOMixAdaptConnObj tmp; - tmp.ctx= bCtx; - tmp.currentSink = usedMix; - g_array_append_val(mixCtx->connectedObjects, tmp); - } - - DEBUG_API("<-XAOutputMixAdapt_ConnectObject"); - return ret; -} - -/* - * XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationGstCtx* omCtx, XAAdaptationGstCtx* bCtx) - */ -XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationGstCtx* omCtx, XAAdaptationGstCtx* bCtx) -{ - XAuint32 i=0; - XAOutputMixAdaptationCtx* mixCtx =NULL; - DEBUG_API("->XAOutputMixAdapt_DisconnectObject"); - - if( !omCtx || omCtx->baseObj.ctxId!=XAOutputMixAdaptation || !bCtx ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - mixCtx = (XAOutputMixAdaptationCtx*)omCtx; - - if( !mixCtx || !bCtx ) - { - DEBUG_ERR("Invalid attribute!!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; - } - for(i=0; iconnectedObjects->len; i++) - { - XAOMixAdaptConnObj* tmp = &(g_array_index(mixCtx->connectedObjects, XAOMixAdaptConnObj, i)); - if( tmp->ctx == bCtx ) - { - g_array_remove_index(mixCtx->connectedObjects, i); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_SUCCESS; - } - } - /*did not find, return error*/ - DEBUG_ERR("Object not found!"); - DEBUG_API("<-XAOutputMixAdapt_DisconnectObject"); - return XA_RESULT_PARAMETER_INVALID; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAOUTPUTMIXADAPTCTX_H -#define XAOUTPUTMIXADAPTCTX_H - -#include "xaadaptationgst.h" - -/* TYPEDEFS */ - -typedef struct XAOutputMixAdaptationCtx_ XAOutputMixAdaptationCtx; - -typedef struct XAOutputMixAdaptationCtx_ -{ - /* Parent*/ - XAAdaptationGstCtx_ baseObj; - /* Internal variables */ - XAboolean isStereoPosition; - XAboolean mute; - - XAuint32 currentrouting; - - GArray* availableDevices; - GArray* connectedObjects; -} XAOutputMixAdaptationCtx_; - -typedef struct XAOMixAdaptConnObj_ -{ - /*pointer to connected context*/ - XAAdaptationGstCtx* ctx; - /*pointer to sink currently used by connected ctx*/ - GstElement* currentSink; -} XAOMixAdaptConnObj; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAOutputMixAdapt_Create(void); -XAresult XAOutputMixAdapt_PostInit(XAAdaptationGstCtx* bCtx); -void XAOutputMixAdapt_Destroy(XAAdaptationGstCtx* bCtx); - - -GstElement* XAOutputMixAdapt_GetSink(XAAdaptationGstCtx* bCtx); -XAresult XAOutputMixAdapt_ConnectObject(XAAdaptationGstCtx* omCtx, XAAdaptationGstCtx* bCtx, GstElement* usedMix); -XAresult XAOutputMixAdapt_DisconnectObject(XAAdaptationGstCtx* omCtx, XAAdaptationGstCtx* bCtx); - -#endif /* XAOUTPUTMIXADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xaoutputmixadaptctx.h" -#include "xaoutputmixitfadaptation.h" -#include "xaadaptationgst.h" -#include "xacapabilitiesmgr.h" - -/* - * XAresult XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs( XAAdaptationGstCtx *bCtx, - * XAint32 * pNumDevices, - * XAuint32 * pDeviceIDs ) - * @param XAAdaptationGstCtx *bCtx - Pointer to OutputMix adaptation context - * @param XAint32 * pNumDevices - [in] Length of pDeviceIDs array - * [out] number of destination devices - * @param XAuint32 * pDeviceIDs - List of DeviceIDs - * @return XAresult success value - * Description: Returns audio output deviceIDs that are currently connected - */ -XAresult XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs( XAAdaptationGstCtx *bCtx, XAint32 * pNumDevices, XAuint32 * pDeviceIDs ) -{ - XAOutputMixAdaptationCtx* mCtx = NULL; - XAint32 iterator = 0; - DEBUG_API_A1("->XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs pNumDevices:%ld",*pNumDevices); - if(!bCtx || bCtx->baseObj.ctxId != XAOutputMixAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAOutputMixAdaptationCtx*) bCtx; - if(!mCtx) - { - DEBUG_ERR("NULL context!"); - return XA_RESULT_PARAMETER_INVALID; - } - - if ( pNumDevices ) - { - *pNumDevices = mCtx->availableDevices->len; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_PARAMETER_INVALID; - } - - if(pDeviceIDs) - { /*query devices*/ - if ( *pNumDevices < mCtx->availableDevices->len ) - { /* Lenght of pDeviceIDs is insufficient for all connected audio devices */ - DEBUG_ERR("XA_RESULT_BUFFER_INSUFFICIENT"); - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_BUFFER_INSUFFICIENT; - } - - for ( iterator = 0; iterator < mCtx->availableDevices->len; iterator++ ) - { - pDeviceIDs[iterator] = g_array_index(mCtx->availableDevices,XAuint32,iterator); - } - } - - DEBUG_API("<-XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs"); - return XA_RESULT_SUCCESS; -} - - -/* - * XAresult XAOutputMixItfAdapt_ReRoute( XAAdaptationGstCtx *bCtx, - * XAint32 numOutputDevices, - * XAuint32 * pOutputDeviceIDs) - * @param XAAdaptationGstCtx *bCtx - Ponter to OutputMix adaptation context - * @param XAint32 numOutputDevices - Length of pOutputDeviceIDs - * @param XAuint32 * pOutputDeviceIDs - List of requested audio output device IDs - * @return XAresult success value - * Description: Reroutes audio output to requested destination devices - */ -XAresult XAOutputMixItfAdapt_ReRoute( XAAdaptationGstCtx *bCtx, XAint32 numOutputDevices, XAuint32 * pOutputDeviceIDs) -{ - XAresult ret = XA_RESULT_SUCCESS; - gint32 idx = 0; - XAOutputMixAdaptationCtx* mCtx = NULL; - XAuint32 devId=0; - GstElement* newsink = NULL; - GstElement* current = NULL; - gchar* currentname= NULL; - XACapabilities temp; - - DEBUG_API_A1("->XAOutputMixItfAdapt_ReRoute numOutputDevices:%ld",numOutputDevices); - if(!bCtx || - bCtx->baseObj.ctxId != XAOutputMixAdaptation || - !pOutputDeviceIDs ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAOutputMixAdaptationCtx*) bCtx; - - if( numOutputDevices > 1 ) - { - /* currently, only routing to single output at time supported */ - return XA_RESULT_FEATURE_UNSUPPORTED; - } - devId = pOutputDeviceIDs[0]; - - for ( idx = 0; idx < mCtx->connectedObjects->len; idx++ ) - { - /*find wanted output plugin name*/ - if( XA_RESULT_SUCCESS == - XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_DEVSNK|XACAP_AUDIO), devId, &temp) ) - { - XAAdaptationGstCtx* ctx = g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).ctx; - if(!ctx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", idx); - return XA_RESULT_INTERNAL_ERROR; - } - /*check current output plugin name*/ - current = g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).currentSink; - currentname = gst_element_get_name(current); - DEBUG_INFO_A2("OMix pl%d - current output: \"%s\"", (int)idx, (char*)currentname); - DEBUG_INFO_A3("OMix pl%d - wanted output: \"%s\" (id 0x%x)", (int)idx, (char*)temp.adaptId, (int)devId); - if(strcmp(currentname,(char*)temp.adaptId)!=0) - { - if(ret==XA_RESULT_SUCCESS) - { - mCtx->currentrouting = devId; - g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).currentSink = newsink; - } - newsink = gst_bin_get_by_name(GST_BIN(ctx->bin), (char*)temp.adaptId); - if(!newsink) - { /*not existing yet, create*/ - newsink = gst_element_factory_make((char*)temp.adaptId,(char*)temp.adaptId); - gst_bin_add(GST_BIN(ctx->bin), newsink); - } - if(!newsink) - { - DEBUG_ERR_A1("Could not create wanted sink \"%s\"!", (char*)temp.adaptId); - ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - /* switch routing: pause, block, unlink old, link new, unblock pipe, play*/ - GstPad *sinkpad=NULL, *blockpad=NULL; - sinkpad = gst_element_get_static_pad(current,"sink"); - if(sinkpad) - { - blockpad = gst_pad_get_peer(sinkpad); - } - if(blockpad && gst_pad_is_active(blockpad)) - { - DEBUG_INFO("block pad"); - gst_pad_set_blocked_async(blockpad,TRUE,XAAdaptationGst_PadBlockCb,NULL); - } - gst_pad_unlink(blockpad, sinkpad); - sinkpad = gst_element_get_static_pad(newsink,"sink"); - gst_pad_link(blockpad, sinkpad); - if(gst_pad_is_blocked(blockpad)) - { - DEBUG_INFO("unblock pad"); - gst_pad_set_blocked_async(blockpad,FALSE,XAAdaptationGst_PadBlockCb,NULL); - } - /*set sink to same state as the mp bin*/ - gst_element_sync_state_with_parent(newsink); - mCtx->currentrouting = devId; - g_array_index(mCtx->connectedObjects,XAOMixAdaptConnObj,idx).currentSink = newsink; - } - } - else - { - DEBUG_INFO("No routing switch needed"); - } - } - else - { - DEBUG_ERR_A1("Could not find audio device by id 0x%x", (int)devId); - ret = XA_RESULT_PARAMETER_INVALID; - } - } - - DEBUG_API("<-XAOutputMixItfAdapt_ReRoute"); - return ret; -} - - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaoutputmixitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef OUTPUTMIXITFADAPTATION_H_ -#define OUTPUTMIXITFADAPTATION_H_ - -#include "xaadaptationgst.h" - - -XAresult XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs( XAAdaptationGstCtx *bCtx, XAint32 * pNumDevices, XAuint32 * pDeviceIDs ); -XAresult XAOutputMixItfAdapt_ReRoute( XAAdaptationGstCtx *bCtx, XAint32 numOutputDevices, XAuint32 * pOutputDeviceIDs); - -#endif /* OUTPUTMIXITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,209 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xaplaybackrateitfadaptation.h" -#include "xaplayitfadaptation.h" - -/*XA_RATEPROP_STAGGEREDVIDEO,XA_RATEPROP_SMOOTHVIDEO,XA_RATEPROP_SILENTAUDIO, - XA_RATEPROP_STAGGEREDAUDIO,XA_RATEPROP_NOPITCHCORAUDIO,XA_RATEPROP_PITCHCORAUDIO*/ -#define SUPPORTEDPROPS (XA_RATEPROP_SMOOTHVIDEO | XA_RATEPROP_SILENTAUDIO) -/* NOTE: currently rewind rates do not seem to work */ -#define MINRATE (100) -#define MAXRATE 8000 -/* - * XAresult XAPlaybackRateItfAdapt_SetRate(XAAdaptationGstCtx *bCtx, XApermille rate) - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * @param XApermille rate - new playback rate in permilles of original speed - * @return XAresult ret - Success value - */ -XAresult XAPlaybackRateItfAdapt_SetRate(XAAdaptationGstCtx *bCtx, XApermille rate) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - DEBUG_API_A1("->XAPlaybackRateItfAdapt_SetRate %d permilles", rate); - - if( !bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - if( rateMAXRATE ) - { - DEBUG_ERR("Invalid rate!"); - return XA_RESULT_PARAMETER_INVALID; - } - if(rate != 0) - { - mCtx->playrate = ((gdouble)rate)/1000; - if( GST_STATE(bCtx->bin) < GST_STATE_PAUSED ) - { /* This should not happen */ - DEBUG_ERR("WARNING: Gst not prerolled yet!"); - } - else - { - /* apply immediately */ - XAAdaptationGst_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Apply new playrate %f.", mCtx->playrate); - if(!gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, - (GstSeekFlags)(GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_ACCURATE), - GST_SEEK_TYPE_NONE, 0, - GST_SEEK_TYPE_NONE, -1)) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationGst_StartAsyncWait(bCtx); - DEBUG_INFO("New playrate handled.") - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - } - else - { /* Gst do not accept rate of 0, pause instead */ - mCtx->playrate = 1.0; - if( GST_STATE(bCtx->bin) > GST_STATE_PAUSED ) - { - DEBUG_ERR("Pause playback"); - XAPlayItfAdaptGST_SetPlayState((XAAdaptationBaseCtx *)bCtx, XA_PLAYSTATE_PAUSED); - } - - } - - DEBUG_API("<-XAPlaybackRateItfAdapt_SetRate"); - return ret; -} - -/* - * XAresult XAPlaybackRateItfAdapt_SetPropertyConstraints(XAAdaptationGstCtx *bCtx, - * XAuint32 constraints) - */ -XAresult XAPlaybackRateItfAdapt_SetPropertyConstraints(XAAdaptationGstCtx *bCtx, - XAuint32 constraints) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAPlaybackRateItfAdapt_SetPropertyConstraints"); - - if( !bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - if( (constraints & SUPPORTEDPROPS ) == 0 ) - { - DEBUG_ERR("constraints cannot be satisfied!!"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - else - { - mCtx->rateprops = SUPPORTEDPROPS & constraints; - } - DEBUG_API("<-XAPlaybackRateItfAdapt_SetPropertyConstraints"); - return ret; -} - -/* - * XAresult XAPlaybackRateItfAdapt_GetProperties(XAAdaptationGstCtx *bCtx, - * XAuint32 *pProperties) - */ -XAresult XAPlaybackRateItfAdapt_GetProperties(XAAdaptationGstCtx *bCtx, - XAuint32 *pProperties) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - DEBUG_API("->XAPlaybackRateItfAdapt_GetProperties"); - - if( !bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - *pProperties = mCtx->rateprops; - - DEBUG_API("<-XAPlaybackRateItfAdapt_GetProperties"); - return ret; -} - - -XAresult XAPlaybackRateItfAdapt_GetCapabilitiesOfRate(XAAdaptationGstCtx *bCtx, - XApermille rate, - XAuint32 *pCapabilities) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAPlaybackRateItfAdapt_GetCapabilitiesOfRate"); - if( !bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - - if( rateMAXRATE ) - { - DEBUG_ERR("Invalid rate!"); - *pCapabilities = 0; - ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - *pCapabilities = SUPPORTEDPROPS; - } - - DEBUG_API("<-XAPlaybackRateItfAdapt_GetCapabilitiesOfRate"); - return ret; -} - - -XAresult XAPlaybackRateItfAdapt_GetRateRange(XAAdaptationGstCtx *bCtx, - XAuint8 index, - XApermille *pMinRate, - XApermille *pMaxRate, - XApermille *pStepSize, - XAuint32 *pCapabilities) -{ - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAPlaybackRateItfAdapt_GetRateRange"); - - if( !bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation ) - { - DEBUG_ERR("Invalid context!"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* NOTE: hardcoded values, cannot be queried from gst */ - /* only one range supported */ - if( index>0 ) - { - ret = XA_RESULT_PARAMETER_INVALID; - } - else - { - *pMinRate = MINRATE; - *pMaxRate = MAXRATE; - *pStepSize = 0; /* continuous range */ - *pCapabilities = SUPPORTEDPROPS; - } - - DEBUG_API("<-XAPlaybackRateItfAdapt_GetRateRange"); - return ret; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaplaybackrateitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XADYNAMICSOURCEITFADAPTATION_H -#define XADYNAMICSOURCEITFADAPTATION_H - -#include "xaadaptationgst.h" - - -/* FUNCTIONS */ - -XAresult XAPlaybackRateItfAdapt_SetRate(XAAdaptationGstCtx *bCtx, XApermille rate); - -XAresult XAPlaybackRateItfAdapt_SetPropertyConstraints(XAAdaptationGstCtx *bCtx, - XAuint32 constraints); - -XAresult XAPlaybackRateItfAdapt_GetProperties(XAAdaptationGstCtx *bCtx, - XAuint32 *pProperties); - -XAresult XAPlaybackRateItfAdapt_GetCapabilitiesOfRate(XAAdaptationGstCtx *bCtx, - XApermille rate, - XAuint32 *pCapabilities); - -XAresult XAPlaybackRateItfAdapt_GetRateRange(XAAdaptationGstCtx *bCtx, - XAuint8 index, - XApermille *pMinRate, - XApermille *pMaxRate, - XApermille *pStepSize, - XAuint32 *pCapabilities); - -#endif /* XADYNAMICSOURCEITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,499 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "unistd.h" -#include -#include "xamediaplayeradaptctx.h" -#include "xaplayitfadaptation.h" -#include "xaadaptationgst.h" -#include "xacameraadaptctx.h" - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/*forward declaration of position updater callback*/ -gboolean XAPlayItfAdapt_PositionUpdate(gpointer ctx); - -/* - * XAresult XAPlayItfAdaptGST_SetPlayState(XAAdaptationGstCtx *bCtx, XAuint32 state) - * Sets play state to GStreamer. - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID - * XAuint32 state - Play state to be set - * @return XAresult ret - Success value - */ -XAresult XAPlayItfAdaptGST_SetPlayState(XAAdaptationBaseCtx *ctx, XAuint32 state) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAboolean requestStateChange = XA_BOOLEAN_FALSE; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = NULL; - XAuint32 locType = 0; - GstState gstOrigState = GST_STATE_PLAYING; - XADataLocator_Address *address = NULL; - XAboolean playing = XA_BOOLEAN_FALSE; - XAAdaptationGstCtx *bCtx = (XAAdaptationGstCtx *)ctx; - - DEBUG_API_A1("->XAPlayItfAdaptGST_SetPlayState %s",PLAYSTATENAME(state)); - - - if(!bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - switch ( state ) - { - case XA_PLAYSTATE_STOPPED: - { - if ( cameraCtx && cameraRealized && mCtx->isobjsrc && mCtx->source ) - { - cameraCtx->playing = XA_BOOLEAN_FALSE; - if(!cameraCtx->recording && !cameraCtx->snapshotting) - { - /* Future improvement: We could block MPObjSrc pad from tee-eleement here, when - * tee-element supports sending stream to one pad when others are blocked */ - - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->source)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->source), GST_STATE_PAUSED ); - if(gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( GST_ELEMENT(mCtx->source), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - - gstOrigState = GST_STATE(bCtx->bin); - if ( gstOrigState != GST_STATE_READY ) - { - DEBUG_INFO("Set gst-bin to GST_STATE_READY"); - bCtx->binWantedState = GST_STATE_READY; - XAAdaptationGst_PrepareAsyncWait(bCtx); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - XAAdaptationGst_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - DEBUG_INFO_A1("Setted gst-bin to state %s", gst_element_state_get_name(GST_STATE(bCtx->bin))); - - DEBUG_INFO_A1("Restoring gst-bin state to state %s", gst_element_state_get_name(gstOrigState)); - bCtx->binWantedState = gstOrigState; - XAAdaptationGst_PrepareAsyncWait(bCtx); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - XAAdaptationGst_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - gstOrigState = GST_STATE(bCtx->bin); - DEBUG_INFO_A1("Restored gst-bin to state %s", gst_element_state_get_name(gstOrigState)); - } - - -/* if( bCtx->pipeSrcThrCtx.dataHandle ) - { - XAresult retVal = XA_RESULT_SUCCESS; - if ( bCtx->pipeSrcThrCtx.state != CPStateNull ) - { - bCtx->pipeSrcThrCtx.state = CPStateStopped; - } - - retVal = XAImpl_PostSemaphore( bCtx->pipeSrcThrCtx.stateSem ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not post content pipe semaphore!"); - } - - }*/ - /* stop head and drive head to beginning */ - bCtx->binWantedState = GST_STATE_PAUSED; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - - gst_element_send_event(bCtx->bin,gst_event_new_flush_start()); - gst_element_send_event(bCtx->bin,gst_event_new_flush_stop()); - - locType = *((XAuint32*)( mCtx->xaSource->pLocator )); - if( locType == XA_DATALOCATOR_ADDRESS ) - { - address = (XADataLocator_Address*)(mCtx->xaSource->pLocator); - - /* init gst buffer from datalocator */ - if( mCtx->source ) - { - GstBuffer* userBuf = NULL; - - /* init GST buffer from XADataLocator*/ - userBuf = gst_buffer_new(); - if( userBuf ) - { - userBuf->size = address->length; - userBuf->data = address->pAddress; - /* push the whole buffer to appsrc so it is ready for preroll */ - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(mCtx->source), userBuf ); - DEBUG_INFO_A1("Sent buffer at 0x%x to appsrc", userBuf ); - gst_app_src_end_of_stream( GST_APP_SRC(mCtx->source) ); - } - else - { - DEBUG_ERR("Failure allocating buffer!"); - } - } - } - break; - } - case XA_PLAYSTATE_PAUSED: - - if ( cameraCtx && cameraRealized && mCtx->isobjsrc && mCtx->source ) - { - cameraCtx->playing = XA_BOOLEAN_FALSE; - - /* Future improvement: We could block MPObjSrc pad from tee-eleement here, when - * tee-element supports sending stream to one pad when others are blocked */ - - if(!cameraCtx->recording && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if ( GST_STATE( GST_ELEMENT(mCtx->source)) == GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->source), GST_STATE_PAUSED ); - if(gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( GST_ELEMENT(mCtx->source), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - } - -/* if ( bCtx->pipeSrcThrCtx.state != CPStateNull ) - { - bCtx->pipeSrcThrCtx.state = CPStatePaused; - }*/ - bCtx->binWantedState = GST_STATE_PAUSED; - if(mCtx->runpositiontimer > 0) - { - g_source_remove(mCtx->runpositiontimer); - mCtx->runpositiontimer=0; - } - break; - case XA_PLAYSTATE_PLAYING: - { - if ( cameraCtx && mCtx->isobjsrc ) - { - cameraCtx->playing = XA_BOOLEAN_TRUE; - } - - if ( mCtx->videoppBScrbin ) - { - gst_element_set_state( GST_ELEMENT(mCtx->videoppBScrbin), GST_STATE_PAUSED); - } - if (mCtx->isobjsrc && !mCtx->cameraSinkSynced && cameraCtx ) - { /* create videosink now */ - mCtx->cameraSinkSynced = XA_BOOLEAN_TRUE; - if ( mCtx->videosink ) - { - gst_element_unlink( mCtx->filter,mCtx->videosink ); - gst_element_set_state( GST_ELEMENT(mCtx->videosink), GST_STATE_NULL); - gst_bin_remove( GST_BIN(mCtx->baseObj.bin), mCtx->videosink); - mCtx->videosink = XAAdaptationGst_CreateGstSink( mCtx->xaVideoSink, "videosink", &(mCtx->isobjvsink) ); - gst_bin_add(GST_BIN(mCtx->baseObj.bin), mCtx->videosink); - if (! gst_element_link(mCtx->filter, mCtx->videosink)) - { - DEBUG_ERR("Could not link Filter to videosink!!"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } - -/* if ( bCtx->pipeSrcThrCtx.state != CPStateNull ) - { - XAresult retVal = XA_RESULT_SUCCESS; - - if ( bCtx->pipeSrcThrCtx.state == CPStateInitialized ) - { Start thread if it's not running - retVal = XAImpl_StartThread( &(bCtx->pipeSrcThr), NULL, &XAAdaptationGst_ContentPipeScrThrFunc, &(bCtx->pipeSrcThrCtx) ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not start content pipe thread!"); - } - } - if ( bCtx->pipeSrcThrCtx.state == CPStatePaused || - bCtx->pipeSrcThrCtx.state == CPStateInitialized || - bCtx->pipeSrcThrCtx.state == CPStateStarted ) - retVal = XAImpl_PostSemaphore( bCtx->pipeSrcThrCtx.stateSem ); - if ( retVal != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not post content pipe semaphore!"); - } - }*/ - - bCtx->binWantedState = GST_STATE_PLAYING; - if(mCtx->playrate!=1 && !mCtx->isobjsrc) - { /*set seek element for ff, rew and slow*/ - XAAdaptationGst_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Apply new playrate %f.", mCtx->playrate); - if(!gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, - (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE), - GST_SEEK_TYPE_NONE, 0, - GST_SEEK_TYPE_NONE, -1)) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationGst_StartAsyncWait(bCtx); - DEBUG_INFO("New playrate handled."); - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - - playing = XA_BOOLEAN_TRUE; - break; - } - default: - ret = XA_RESULT_PARAMETER_INVALID; - break; - } - /* launch Gstreamer state change only if necessary */ - if( GST_STATE_TARGET(bCtx->bin) == bCtx->binWantedState ) - { - DEBUG_INFO("Gst already in or transitioning to wanted state"); - requestStateChange = XA_BOOLEAN_FALSE; - } - else - { - if( (GST_STATE(bCtx->bin) == bCtx->binWantedState) && - (GST_STATE_PENDING(bCtx->bin) == GST_STATE_VOID_PENDING) ) - { - DEBUG_ERR_A3("WARNING : gststate %d == wanted %d != gsttarget %d and no statechange pending", - GST_STATE(bCtx->bin), bCtx->binWantedState, GST_STATE_TARGET(bCtx->bin)); - } - requestStateChange = XA_BOOLEAN_TRUE; - } - - if( requestStateChange ) - { - XAAdaptationGst_PrepareAsyncWait(bCtx); - DEBUG_INFO_A1("Sending change state request to state %d", bCtx->binWantedState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), bCtx->binWantedState); - switch ( gstRet ) - { - case GST_STATE_CHANGE_FAILURE: - DEBUG_ERR_A1("FAILED to change state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - bCtx->binWantedState = GST_STATE(bCtx->bin); - ret = XA_RESULT_INTERNAL_ERROR; - break; - case GST_STATE_CHANGE_ASYNC: - DEBUG_INFO_A1("Change state will happen asyncronously (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - XAAdaptationGst_StartAsyncWait(bCtx); - ret = XA_RESULT_SUCCESS; - break; - case GST_STATE_CHANGE_NO_PREROLL: - DEBUG_INFO("GST_STATE_CHANGE_NO_PREROLL"); - /* deliberate fall-through */ - case GST_STATE_CHANGE_SUCCESS: - DEBUG_INFO_A1("Successfully changed state (target %s)", - gst_element_state_get_name(bCtx->binWantedState)); - ret = XA_RESULT_SUCCESS; - break; - default: - DEBUG_ERR_A1("Unhandled error (%d)",gstRet); - ret = XA_RESULT_UNKNOWN_ERROR; - break; - } - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - } - - if (playing && mCtx->isobjsrc && cameraCtx ) - { - GstPad* moSrc=NULL ; - - playing = XA_BOOLEAN_FALSE; - moSrc = gst_element_get_static_pad( mCtx->source, "MPObjSrc"); - if( moSrc && gst_pad_is_linked(moSrc) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name( mCtx->source), - gst_pad_get_name(moSrc)); - gst_pad_set_blocked_async(moSrc, FALSE, XAAdaptationGst_PadBlockCb, NULL); - } - - if ( GST_STATE( GST_ELEMENT(mCtx->source)) != GST_STATE_PLAYING ) - { - GstStateChangeReturn gret; - DEBUG_INFO("Start camera source"); - gret = gst_element_set_state( GST_ELEMENT(mCtx->source), GST_STATE_PLAYING ); - if(gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( GST_ELEMENT(mCtx->source), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC ); - } - } - DEBUG_API("<-XAPlayItfAdaptGST_SetPlayState"); - return ret; -} - -/* - * XAresult XAPlayItfAdaptGST_GetDuration(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec) - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID - * XAmillisecond *pMsec - Pointer where to store duration of stream. - * @return XAresult ret - Success value - */ -XAresult XAPlayItfAdaptGST_GetDuration(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec) -{ - XAresult ret = XA_RESULT_SUCCESS; - GstFormat format = GST_FORMAT_TIME; - gint64 duration; - DEBUG_API("->XAPlayItfAdaptGST_GetDuration"); - - if(!bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation || !pMsec) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( gst_element_query_duration( GST_ELEMENT(bCtx->bin), &format, &duration ) ) - { - DEBUG_INFO_A1("Duration: %"GST_TIME_FORMAT, GST_TIME_ARGS(duration)); - ret = XA_RESULT_SUCCESS; - *pMsec = GST_TIME_AS_MSECONDS(duration);/*Warning ok due to used API specification*/ - } - else - { - DEBUG_ERR("WARNING: Gst: could not get duration"); - *pMsec = XA_TIME_UNKNOWN; - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XAPlayItfAdaptGST_GetDuration"); - return ret; -} - -/* - * XAresult XAPlayItfAdaptGST_GetPosition(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec) - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * XAmillisecond *pMsec - Pointer where to store current position in stream. - * @return XAresult ret - Success value - */ -XAresult XAPlayItfAdaptGST_GetPosition(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec) -{ - XAresult ret = XA_RESULT_SUCCESS; - gint64 position; - GstFormat format = GST_FORMAT_TIME; - DEBUG_API("->XAPlayItfAdapGSTt_GetPosition"); - - if(!bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if ( gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &position ) ) - { - DEBUG_INFO_A1("Current position %"GST_TIME_FORMAT, GST_TIME_ARGS(position)); - ret = XA_RESULT_SUCCESS; - *pMsec = GST_TIME_AS_MSECONDS(position);/*Warning ok due to used API specification*/ - } - else - { - DEBUG_ERR("WARNING: Gst: could not get position"); - /* probably not fully prerolled - safe assumption for position = 0 */ - *pMsec = 0; - ret = XA_RESULT_SUCCESS; - } - - DEBUG_API("<-XAPlayItfAdaptGST_GetPosition"); - return ret; -} - -/* - * XAresult XAPlayItfAdapt_EnablePositionTracking - * Enable/disable periodic position tracking callbacks - */ -XAresult XAPlayItfAdapt_EnablePositionTracking(XAAdaptationGstCtx *bCtx, XAboolean enable) -{ - XAMediaPlayerAdaptationCtx* mCtx; - - DEBUG_API_A1("->XAPlayItfAdapt_EnablePositionTracking (enable: %d)", (int)enable); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - if(enable && !(mCtx->trackpositionenabled)) - { - mCtx->trackpositionenabled = XA_BOOLEAN_TRUE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - else if (!enable && (mCtx->trackpositionenabled)) - { - mCtx->trackpositionenabled = XA_BOOLEAN_FALSE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - - DEBUG_API("<-XAPlayItfAdapt_EnablePositionTracking"); - return XA_RESULT_SUCCESS; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaplayitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,43 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAPLAYITFADAPTATION_H -#define XAPLAYITFADAPTATION_H - -#include "xaadaptationgst.h" - -#ifdef _DEBUG -/*parse state names for debug prints*/ -static const char* playstatenames[3] = -{ - "XA_PLAYSTATE_STOPPED", - "XA_PLAYSTATE_PAUSED", - "XA_PLAYSTATE_PLAYING" -}; -#define PLAYSTATENAME(i) (const char*)((i>0&&i<4)?playstatenames[i-1]:"INVALID") -#endif /*_DEBUG*/ - - -/* FUNCTIONS */ - -XAresult XAPlayItfAdaptGST_SetPlayState(XAAdaptationBaseCtx *bCtx, XAuint32 state); -XAresult XAPlayItfAdaptGST_GetDuration(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec); -XAresult XAPlayItfAdaptGST_GetPosition(XAAdaptationGstCtx *bCtx, XAmillisecond *pMsec); -XAresult XAPlayItfAdapt_EnablePositionTracking(XAAdaptationGstCtx *bCtx, XAboolean enable); - - -#endif /* XAPLAYITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaradioadaptctx.h" -#include "xaadaptationgst.h" -#include "assert.h" - - -/* - * XAAdaptationGstCtx* XARadioAdapt_Create() - * Allocates memory for Radio Adaptation Context and makes 1st phase initialization - * @returns XARadioAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XARadioAdapt_Create() -{ - XARadioAdaptationCtx *pSelf = (XARadioAdaptationCtx*)calloc(1, sizeof(XARadioAdaptationCtx)); - DEBUG_API("->XARadioAdapt_Create"); - - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XARadioAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - else - { - pSelf->state = XA_RADIO_IDLE; - pSelf->range = RADIO_DEFAULT_FREQ_RANGE; - pSelf->frequency = RADIO_DEFAULT_FREQ; - - pSelf->rdsEmulationThread = 0; - pSelf->emulationThread = 0; - } - } - - DEBUG_API("<-XARadioAdapt_Create"); - return (XAAdaptationBaseCtx*)&pSelf->baseObj; -} - -/* - * XAresult XARadioAdapt_PostInit() - * 2nd phase initialization of Radio Adaptation Context - */ -XAresult XARadioAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* ctx = NULL; - DEBUG_API("->XARadioAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XARadioAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XARadioAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XARadioAdaptationCtx*)bCtx; - - assert(ctx); - - ret = XAAdaptationBase_PostInit( &ctx->baseObj.baseObj ); - if( ret!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Base context postinit failed!!"); - DEBUG_API("<-XARadioAdapt_PostInit"); - return ret; - } - - ctx->baseObj.bin = gst_element_factory_make( "audiotestsrc", "audiosrc"); - if ( !ctx->baseObj.bin ) - { - DEBUG_ERR("Unable to create test audio source!"); - DEBUG_API("<-XARadioAdapt_PostInit"); - return XA_RESULT_INTERNAL_ERROR; - } - g_object_set( G_OBJECT(ctx->baseObj.bin), "wave", 0x5, NULL ); - - DEBUG_API("<-XARadioAdapt_PostInit"); - return ret; -} - -/* - * void XARadioAdapt_Destroy(XAAdaptationGstCtx* bCtx) - * Destroys Radio Adaptation Context - * @param ctx - Radio Adaptation context to be destroyed - */ -void XARadioAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XARadioAdaptationCtx* ctx = NULL; - DEBUG_API("->XARadioAdapt_Destroy"); - - if(bCtx == NULL || bCtx->ctxId != XARadioAdaptation ) - { - DEBUG_ERR("Invalid parameter!!"); - DEBUG_API("<-XARadioAdapt_Destroy"); - return; - } - ctx = (XARadioAdaptationCtx*)bCtx; - XAAdaptationBase_Free(&(ctx->baseObj.baseObj)); - - free(ctx); - - DEBUG_API("<-XARadioAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaradioadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARADIOADAPTCTX_H -#define XARADIOADAPTCTX_H - -#include "xaadaptationgst.h" - -typedef enum { - GST_AUDIO_TEST_SRC_WAVE_SINE, - GST_AUDIO_TEST_SRC_WAVE_SQUARE, - GST_AUDIO_TEST_SRC_WAVE_SAW, - GST_AUDIO_TEST_SRC_WAVE_TRIANGLE, - GST_AUDIO_TEST_SRC_WAVE_SILENCE, - GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, - GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE, - GST_AUDIO_TEST_SRC_WAVE_SINE_TAB, - GST_AUDIO_TEST_SRC_WAVE_TICKS -} GstAudioTestSrcWave; - -typedef enum -{ - XA_RADIO_IDLE, - XA_RADIO_SEEKING, - XA_RADIO_SETTING_FREQUENCY, - XA_RADIO_SETTING_FREQUENCY_RANGE -} XARadioState; - -typedef enum -{ - XA_RADIO_RDS_IDLE, - XA_RADIO_RDS_GETTING_ODA_GROUP -} XARadioRDSState; - -#define RADIO_DEFAULT_FREQ_RANGE XA_FREQRANGE_FMEUROAMERICA -#define RADIO_DEFAULT_FREQ 88000000 - -/* TYPEDEFS */ -typedef struct XARadioAdaptationCtx_ XARadioAdaptationCtx; - -/* - * Structure for Camera specific gst-adaptation variables - */ -typedef struct XARadioAdaptationCtx_ { - - /* Parent*/ - XAAdaptationGstCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 frequency; - XAuint8 range; - - pthread_t emulationThread; - pthread_t rdsEmulationThread; - XARadioRDSState rdsState; - XARadioState state; - - /* GST Variables */ -} XARadioAdaptationCtx_; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XARadioAdapt_Create(void); -XAresult XARadioAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XARadioAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XARADIOADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,797 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xaadaptationgst.h" -#include "xaradioitfadaptation.h" -#include "xaradioadaptctx.h" - -#define NUM_OF_SUPPORTED_RANGES 2 -#define NUM_OF_CHANNELS 2 -const char* RadioPresetDefaultName = "Default"; - -/* emulated frequency range data */ -typedef struct FreqRange_ -{ - XAuint8 id; - XAuint32 minFreq; - XAuint32 maxFreq; - XAuint32 freqInterval; - XAuint32 stereoMode; -} FreqRange; - -/* emulated radio channel data */ -typedef struct Channel_ -{ - XAuint32 freq; - XAuint32 strength; -} Channel; - -/* emulated radio state */ -typedef enum -{ - RADIO_STATE_ON_CHANNEL, - RADIO_STATE_OFF_CHANNEL -} RadioState; - -/* data structure to pass onto async functions */ -typedef struct -{ - XAAdaptationGstCtx *bCtx; - XAuint32 value; -} ThreadArgs; - -/* emulation variables and constraints */ -static const FreqRange supportedFreqRanges[NUM_OF_SUPPORTED_RANGES] = { - { XA_FREQRANGE_FMEUROAMERICA, 87500000, 108000000, 100000, XA_STEREOMODE_MONO }, - {XA_FREQRANGE_FMJAPAN, 76000000, 90000000, 100000, XA_STEREOMODE_STEREO }}; - -static const Channel channels[NUM_OF_CHANNELS] = { {88500000, 80}, - {89300000, 60 }}; - -static XAuint8 freqRangeIndex = 0; -static XAboolean squelchMode = XA_BOOLEAN_FALSE; -static XAint32 currentChannel = -1; -static RadioState radioState = RADIO_STATE_OFF_CHANNEL; - -static void* asyncdata = NULL; - -/* FORWARD DECLARATIONS */ -void * XARadioItfAdapt_AsyncSetFrequencyRange(void* args); -XAresult XARadioItfAdapt_SyncSetFrequencyRange(XAAdaptationGstCtx *bCtx, XAuint8 range); -void * XARadioItfAdapt_AsyncSetFrequency(void* args); -XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq); -void * XARadioItfAdapt_AsyncSeek(void* args); - -/* - * XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationGstCtx *bCtx, XAuint8 range) - */ -XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationGstCtx *bCtx, XAuint8 range) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 index=0; - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - int pt_ret=0; - DEBUG_API("->XARadioItfAdapt_SetFreqRange"); - - if(!bCtx || range < XA_FREQRANGE_FMEUROAMERICA || range > XA_FREQRANGE_AMSW) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - for (index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == range) - { - if (mCtx->range != range) - { - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - mCtx->state = XA_RADIO_IDLE; - } - { - ThreadArgs* args = (ThreadArgs*)calloc(1, sizeof(ThreadArgs)); - if (!args) - { - DEBUG_ERR("Calloc failed") - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return XA_RESULT_INTERNAL_ERROR; - } - args->bCtx = bCtx; - args->value = range; - mCtx->state = XA_RADIO_SETTING_FREQUENCY_RANGE; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARadioItfAdapt_AsyncSetFrequencyRange),(void*)args); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } - break; - } - } - - DEBUG_API("<-XARadioItfAdapt_SetFreqRange"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSetFrequencyRange(void* args) - */ -void * XARadioItfAdapt_AsyncSetFrequencyRange(void* args) -{ - XAresult ret = XA_RESULT_SUCCESS; - ThreadArgs* tArgs = NULL; - XARadioAdaptationCtx* mCtx = NULL; - - DEBUG_API("->XARadioItfAdapt_AsyncSetFrequencyRange"); - asyncdata = args; - tArgs = args; - - mCtx = (XARadioAdaptationCtx*) tArgs->bCtx; - - DEBUG_INFO("Setting frequency async") - usleep(100000); /* 1/10 seconds */ - - ret = XARadioItfAdapt_SyncSetFrequencyRange(tArgs->bCtx, tArgs->value); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XARadioItfAdapt_SyncSetFrequencyRange FAILED"); - } - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_RANGE_CHANGED, 0, NULL}; - XAAdaptationBase_SendAdaptEvents(&tArgs->bCtx->baseObj, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - free(args); - asyncdata = NULL; - DEBUG_API("<-XARadioItfAdapt_AsyncSetFrequencyRange"); - pthread_exit(NULL); - return NULL; -} - -/* - * XAresult XARadioItfAdapt_SyncSetFrequencyRange(XAAdaptationGstCtx *bCtx, XAuint8 range) - */ -XAresult XARadioItfAdapt_SyncSetFrequencyRange(XAAdaptationGstCtx *bCtx, XAuint8 range) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - XAuint8 index=0; - DEBUG_API("->XARadioItfAdapt_SyncSetFrequencyRange"); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequencyRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (range != mCtx->range) - { - DEBUG_INFO("Frequency range changed!") - - mCtx->range = range; - for(index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == mCtx->range) - { - freqRangeIndex = index; - } - } - - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, RADIO_DEFAULT_FREQ ); - } - - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequencyRange"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetFreqRange(XAAdaptationGstCtx *bCtx, - * XAuint8 * pFreqRange) - */ -XAresult XARadioItfAdapt_GetFreqRange(XAAdaptationGstCtx *bCtx, - XAuint8 * pFreqRange) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_GetFreqRange"); - - if(!bCtx || !pFreqRange) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetFreqRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - *pFreqRange = mCtx->range; - - DEBUG_API("<-XARadioItfAdapt_GetFreqRange"); - return ret; -} - - - -/* - * XAresult XARadioItfAdapt_IsFreqRangeSupported(XAAdaptationGstCtx *bCtx, - * XAuint8 range, - * XAboolean * pSupported) - */ -XAresult XARadioItfAdapt_IsFreqRangeSupported(XAAdaptationGstCtx *bCtx, - XAuint8 range, - XAboolean * pSupported) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint16 index=0; - DEBUG_API("->XARadioItfAdapt_IsFreqRangeSupported"); - - if(!bCtx || !pSupported || range < XA_FREQRANGE_FMEUROAMERICA || range > XA_FREQRANGE_AMSW) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_IsFreqRangeSupported"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pSupported = XA_BOOLEAN_FALSE; - for (index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == range) - { - *pSupported = XA_BOOLEAN_TRUE; - break; - } - } - - DEBUG_API("<-XARadioItfAdapt_IsFreqRangeSupported"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationGstCtx *bCtx, - * XAuint8 range, - * XAuint32 * pMinFreq, - * XAuint32 * pMaxFreq, - * XAuint32 * pFreqInterval) - */ -XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationGstCtx *bCtx, - XAuint8 range, - XAuint32 * pMinFreq, - XAuint32 * pMaxFreq, - XAuint32 * pFreqInterval) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XAuint16 index=0; - DEBUG_API("->XARadioItfAdapt_GetFreqRangeProperties"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetFreqRangeProperties"); - return XA_RESULT_PARAMETER_INVALID; - } - - for (index = 0; index < NUM_OF_SUPPORTED_RANGES; index++) - { - if (supportedFreqRanges[index].id == range) - { - *pMinFreq = supportedFreqRanges[index].minFreq; - *pMaxFreq = supportedFreqRanges[index].maxFreq; - *pFreqInterval = supportedFreqRanges[index].freqInterval; - break; - } - } - - DEBUG_API("<-XARadioItfAdapt_GetFreqRangeProperties"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_SetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq) - */ -XAresult XARadioItfAdapt_SetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_SetFrequency"); - - if(!bCtx || freq < supportedFreqRanges[freqRangeIndex].minFreq - || freq > supportedFreqRanges[freqRangeIndex].maxFreq - || ((freq - supportedFreqRanges[freqRangeIndex].minFreq) - % supportedFreqRanges[freqRangeIndex].freqInterval) != 0) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (freq != mCtx->frequency) - { - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - } - - { - ThreadArgs* args = (ThreadArgs*)calloc(1, sizeof(ThreadArgs)); - if (!args) - { - DEBUG_ERR("Calloc failed") - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return XA_RESULT_INTERNAL_ERROR; - } - args->bCtx = bCtx; - args->value = freq; - mCtx->state = XA_RADIO_SETTING_FREQUENCY; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARadioItfAdapt_AsyncSetFrequency),(void*)args); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return XA_RESULT_INTERNAL_ERROR; - } - } - } /* else do nothing freq was same */ - - DEBUG_API("<-XARadioItfAdapt_SetFrequency"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSetFrequency(void* args) - */ -void * XARadioItfAdapt_AsyncSetFrequency(void* args) -{ - ThreadArgs* tArgs = NULL; - XARadioAdaptationCtx* mCtx = NULL; - asyncdata = args; - tArgs = args; - - mCtx = (XARadioAdaptationCtx*) tArgs->bCtx; - DEBUG_API("->XARadioItfAdapt_AsyncSetFrequency"); - DEBUG_INFO("Setting frequency async") - usleep(100000); /* 1/10 seconds */ - - XARadioItfAdapt_SyncSetFrequency(tArgs->bCtx, tArgs->value); - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_FREQUENCY_CHANGED, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(&tArgs->bCtx->baseObj, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - free(args); - asyncdata = NULL; - DEBUG_API("<-XARadioItfAdapt_AsyncSetFrequency"); - pthread_exit(NULL); - return NULL; -} - -/* - * XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq) - */ -XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - XAboolean channelFound = XA_BOOLEAN_FALSE; - XARadioAdaptationCtx* mCtx=NULL; - - DEBUG_API("->XARadioItfAdapt_SyncSetFrequency"); - - if(!bCtx || freq < supportedFreqRanges[freqRangeIndex].minFreq - || freq > supportedFreqRanges[freqRangeIndex].maxFreq - || ((freq - supportedFreqRanges[freqRangeIndex].minFreq) - % supportedFreqRanges[freqRangeIndex].freqInterval) != 0) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (freq != mCtx->frequency) - { - for (index = 0; index < NUM_OF_CHANNELS; index++) - { - if (channels[index].freq == freq) - { - currentChannel = index; - channelFound = XA_BOOLEAN_TRUE; - break; - } - } - if ( channelFound == XA_BOOLEAN_FALSE && radioState == RADIO_STATE_ON_CHANNEL) - { - if (squelchMode == XA_BOOLEAN_FALSE) - { - DEBUG_API("Channel not found, squelch mode off, set radio to white noise"); - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, NULL ); - } - else - { - DEBUG_API("Channel not found, squelch mode off, set radio to silence"); - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_SILENCE, NULL ); - } - radioState = RADIO_STATE_OFF_CHANNEL; - } - else if ( channelFound == XA_BOOLEAN_TRUE && radioState == RADIO_STATE_OFF_CHANNEL ) - { - DEBUG_API("Channel found, set radio to sine wave"); - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_SINE, NULL ); - radioState = RADIO_STATE_ON_CHANNEL; - } - else - { - /* do nothing */ - } - - DEBUG_INFO("Frequency changed!") - - mCtx->frequency = freq; - } /* else frequency not changed do nothing */ - - DEBUG_API("<-XARadioItfAdapt_SyncSetFrequency"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetFrequency(XAAdaptationGstCtx *bCtx, - * XAuint32 * pFrequency) - */ -XAresult XARadioItfAdapt_GetFrequency(XAAdaptationGstCtx *bCtx, - XAuint32 * pFrequency) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_GetFrequency"); - - if(!bCtx || !pFrequency) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - *pFrequency = mCtx->frequency; - - DEBUG_API("<-XARadioItfAdapt_GetFrequency"); - return ret; -} - - -/* - * XAresult XARadioItfAdapt_CancelSetFrequency(XAAdaptationGstCtx *bCtx) - */ -XAresult XARadioItfAdapt_CancelSetFrequency(XAAdaptationGstCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARadioItfAdapt_CancelSetFrequency"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_CancelSetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - - if (mCtx->state == XA_RADIO_SEEKING) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - DEBUG_API("<-XARadioItfAdapt_CancelSetFrequency"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_SetSquelch(XAAdaptationGstCtx *bCtx, XAboolean squelch) - */ -XAresult XARadioItfAdapt_SetSquelch(XAAdaptationGstCtx *bCtx, XAboolean squelch) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARadioItfAdapt_SetSquelch"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetSquelch"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (squelch != squelchMode) - { - if (radioState == RADIO_STATE_OFF_CHANNEL) - { - if (squelch == XA_BOOLEAN_FALSE) - { - DEBUG_API("Squelch untoggled, no channel, set radio to white noise") - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_WHITE_NOISE, NULL ); - } - else - { - DEBUG_API("Squelch toggled, no channel, set radio to silence") - g_object_set( G_OBJECT(bCtx->bin), "wave", GST_AUDIO_TEST_SRC_WAVE_SILENCE, NULL ); - } - } - else - { - DEBUG_API("Squelch toggled, radio on channel, radio not changed") - } - squelchMode = squelch; - } /* else do nothing as mode not changed */ - - DEBUG_API("<-XARadioItfAdapt_SetSquelch"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationGstCtx *bCtx, XAuint32 mode) - */ -XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationGstCtx *bCtx, XAuint32 mode) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARadioItfAdapt_SetStereoMode"); - - if(!bCtx || mode > XA_STEREOMODE_AUTO ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_SetStereoMode"); - return XA_RESULT_PARAMETER_INVALID; - } - - switch ( mode ) - { - case XA_STEREOMODE_MONO: - /* always works */ - break; - case XA_STEREOMODE_STEREO: - if ( supportedFreqRanges[freqRangeIndex].stereoMode == XA_STEREOMODE_MONO ) - { - DEBUG_ERR("StereoMode stereo unsupported"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - case XA_STEREOMODE_AUTO: - if ( supportedFreqRanges[freqRangeIndex].stereoMode != XA_STEREOMODE_AUTO ) - { - DEBUG_ERR("StereoMode auto unsupported"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - } - break; - default : - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - ret = XA_RESULT_INTERNAL_ERROR; /* shouldn't come here */ - break; - } - - DEBUG_API("<-XARadioItfAdapt_SetStereoMode"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_GetSignalStrength(XAAdaptationGstCtx *bCtx, XAuint32 * pStrength) - */ -XAresult XARadioItfAdapt_GetSignalStrength(XAAdaptationGstCtx *bCtx, XAuint32 * pStrength) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARadioItfAdapt_GetSignalStrength"); - - if(!bCtx || !pStrength) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_GetSignalStrength"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (currentChannel != -1) - { - *pStrength = channels[currentChannel].strength; - } - else - { - *pStrength = 0; - } - - DEBUG_API("<-XARadioItfAdapt_GetSignalStrength"); - return ret; -} - -/* - * XAresult XARadioItfAdapt_Seek(XAAdaptationGstCtx *bCtx, XAboolean upwards) - */ -XAresult XARadioItfAdapt_Seek(XAAdaptationGstCtx *bCtx, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx = NULL; - int pt_ret=0; - DEBUG_API("->XARadioItfAdapt_Seek"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_Seek"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - mCtx->state = XA_RADIO_IDLE; - } - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARadioItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret) - DEBUG_API("<-XARadioItfAdapt_Seek"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARadioItfAdapt_Seek"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSeek(void* args) - */ -void * XARadioItfAdapt_AsyncSeek(void* args) -{ - XAresult ret = XA_RESULT_SUCCESS; - - XAAdaptationGstCtx *bCtx = (XAAdaptationGstCtx*)args; - - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - - XAuint8 index=0; - XAint8 currentChannel = 0; - XAuint32 freq=0; - mCtx->state = XA_RADIO_SEEKING; - usleep(100000); /* 1/10 seconds */ - - DEBUG_INFO("Seek done!") - - for( index = 0; index < NUM_OF_CHANNELS; index++) - { - if (channels[index].freq == mCtx->frequency) - { - currentChannel = index; - break; - } - } - - freq = channels[(currentChannel + 1)%NUM_OF_CHANNELS].freq; - - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, freq ); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XARadioItfAdapt_SyncSetFrequency failed") - } - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SEEK_COMPLETE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - pthread_exit(NULL); - return NULL; -} - -/* - * XAresult XARadioItfAdapt_StopSeeking(XAAdaptationGstCtx *bCtx) - */ -XAresult XARadioItfAdapt_StopSeeking(XAAdaptationGstCtx *bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARadioItfAdapt_StopSeeking"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARadioItfAdapt_StopSeeking"); - return XA_RESULT_INTERNAL_ERROR; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state == XA_RADIO_SEEKING) - { - mCtx->state = XA_RADIO_IDLE; - // pthread_cancel(mCtx->emulationThread); - - /* just put some random non-channel freq */ - ret = XARadioItfAdapt_SyncSetFrequency( bCtx, channels[0].freq+supportedFreqRanges[freqRangeIndex].freqInterval); - if (ret != XA_RESULT_SUCCESS) - { - ret = XA_RESULT_INTERNAL_ERROR; - } - } - - DEBUG_API("<-XARadioItfAdapt_StopSeeking"); - return ret; -} - -/* - * void XARadioItfAdapt_Free(XAAdaptationGstCtx *bCtx) - */ -void XARadioItfAdapt_Free(XAAdaptationBaseCtx *bCtx) -{ - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - DEBUG_API("->XARadioItfAdapt_Free"); - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - if (asyncdata) - { - free(asyncdata); - asyncdata = NULL; - } - mCtx->state = XA_RADIO_IDLE; - } - - DEBUG_API("<-XARadioItfAdapt_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaradioitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARADIOITFFADAPTATION_H -#define XARADIOITFFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xadebug.h" - -/* MACROS */ -#define RADIO_DEFAULT_STEREO_MODE XA_STEREOMODE_AUTO -#define RADIO_NUM_OF_PRESETS 10 - -extern const char* RadioPresetDefaultName; - -/* FUNCTIONS */ -XAresult XARadioItfAdapt_SetFreqRange(XAAdaptationGstCtx *bCtx, XAuint8 range); - -XAresult XARadioItfAdapt_GetFreqRange(XAAdaptationGstCtx *bCtx, - XAuint8 * pFreqRange); - -XAresult XARadioItfAdapt_IsFreqRangeSupported(XAAdaptationGstCtx *bCtx, - XAuint8 range, - XAboolean * pSupported); - -XAresult XARadioItfAdapt_GetFreqRangeProperties(XAAdaptationGstCtx *bCtx, - XAuint8 range, - XAuint32 * pMinFreq, - XAuint32 * pMaxFreq, - XAuint32 * pFreqInterval); - -XAresult XARadioItfAdapt_SetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq); - -XAresult XARadioItfAdapt_GetFrequency(XAAdaptationGstCtx *bCtx, - XAuint32 * pFrequency); - -XAresult XARadioItfAdapt_CancelSetFrequency(XAAdaptationGstCtx *bCtx); - -XAresult XARadioItfAdapt_SetSquelch(XAAdaptationGstCtx *bCtx, XAboolean squelch); - -XAresult XARadioItfAdapt_SetStereoMode(XAAdaptationGstCtx *bCtx, XAuint32 mode); - -XAresult XARadioItfAdapt_GetSignalStrength(XAAdaptationGstCtx *bCtx, XAuint32 * pStrength); - -XAresult XARadioItfAdapt_Seek(XAAdaptationGstCtx *bCtx, XAboolean upwards); - -XAresult XARadioItfAdapt_StopSeeking(XAAdaptationGstCtx *bCtx); - -void XARadioItfAdapt_Free(XAAdaptationBaseCtx *bCtx); - -#endif /* XARADIOITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xardsitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xardsitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,877 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include - -#include "xaadaptationgst.h" -#include "xaradioadaptctx.h" -#include "xardsitfadaptation.h" -#include "xaradioitfadaptation.h" - -/* emulated device data and constraints */ - -#define NUM_OF_CHANNELS 2 -#define MAX_PS_STRING_LENGHT 17 -#define MAX_RT_STRING_LENGHT 129 -#define MAX_ODA_GROUP_SUBSCRIPTIONS 100 -#define MAX_PTY_STRING_SHORT_LENGHT 17 -#define MAX_PTY_STRING_LONG_LENGHT 33 -#define NONE_STRING_LENGHT 4 - -/* emulated rds data structure */ -typedef struct -{ - XAuint32 frequency; - XAchar *progServiceName; - XAchar *radioText; - XAuint32 programmeType; - XAchar *ptyStringShort; - XAchar *ptyStringLong; - XAint16 programmeID; - XAboolean trafficAnnouncement; - XAboolean trafficProgramme; -} RDSData; - -#define TRAFFIC_PROGRAMME_CHANNEL 0 -#define TRAFFIC_ANNOUNCEMENT_CHANNEL 0 -#define POPMUSIC_CHANNEL 1 - -/* emulated rds data from channels */ -static const RDSData rdsData[NUM_OF_CHANNELS] = { - {88500000, (XAchar *)"Traffic", (XAchar *)"All your traffic needs", XA_RDSPROGRAMMETYPE_RDSPTY_NONE, - (XAchar *)"None", (XAchar *)"None", 0x0001, XA_BOOLEAN_TRUE, XA_BOOLEAN_TRUE }, - {89300000, (XAchar *)"Popular", (XAchar *)"For the populous", XA_RDSPROGRAMMETYPE_RDSPTY_POPMUSIC, - (XAchar *)"Pop music", (XAchar *)"Pop music for the masses", 0x0002, XA_BOOLEAN_FALSE, XA_BOOLEAN_FALSE } -}; - -static const XAchar* noneString = (XAchar *)"None"; - -static XAint16 subscribedODAGroups[MAX_ODA_GROUP_SUBSCRIPTIONS]; -static XAuint16 subscribedODAGroupCount = 0; - -//static XAuint32 freqSetAfterSeek; - -const RDSData* GetCurrentRdsData( XAAdaptationGstCtx *bCtx ); -void * XARDSItfAdapt_AsyncSeek(void* args); -void * XARDSItfAdapt_AsyncGetODAGroup(void* args); - -/* exposing radio itf adaptation internal function here */ -//XAresult XARadioItfAdapt_SyncSetFrequency(XAAdaptationGstCtx *bCtx, XAuint32 freq); - - -/* - * XAresult XARDSItfAdapt_QueryRDSSignal(XAAdaptationGstCtx *bCtx, XAboolean * isSignal) - */ -XAresult XARDSItfAdapt_QueryRDSSignal(XAAdaptationGstCtx *bCtx, XAboolean * isSignal) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_QueryRDSSignal"); - - if(!bCtx || !isSignal) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_QueryRDSSignal"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (GetCurrentRdsData(bCtx)) - { - *isSignal = XA_BOOLEAN_TRUE; - } - else - { - *isSignal = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XARDSItfAdapt_QueryRDSSignal"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeServiceName(XAAdaptationGstCtx *bCtx, XAchar * ps) - */ -XAresult XARDSItfAdapt_GetProgrammeServiceName(XAAdaptationGstCtx *bCtx, XAchar * ps) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeServiceName"); - - - if(!bCtx || !ps) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeServiceName"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - strncpy( (char *)ps, (char *)data->progServiceName, MAX_PS_STRING_LENGHT ); - } - else - { - *ps = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeServiceName"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetRadioText(XAAdaptationGstCtx *bCtx, XAchar * rt) - */ -XAresult XARDSItfAdapt_GetRadioText(XAAdaptationGstCtx *bCtx, XAchar * rt) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetRadioText"); - - if(!bCtx || !rt) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetRadioText"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - strncpy( (char *)rt, (char *)data->radioText, MAX_RT_STRING_LENGHT ); - } - else - { - *rt = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetRadioText"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetRadioTextPlus(XAAdaptationGstCtx *bCtx, - * XAuint8 contentType, - * XAchar * informationElement, - * XAchar * descriptor, - * XAuint8 * descriptorContentType) - */ -XAresult XARDSItfAdapt_GetRadioTextPlus(XAAdaptationGstCtx *bCtx, - XAuint8 contentType, - XAchar * informationElement, - XAchar * descriptor, - XAuint8 * descriptorContentType) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_GetRadioTextPlus"); - - if(!bCtx || contentType < XA_RDSRTPLUS_ITEMTITLE || contentType > XA_RDSRTPLUS_GETDATA - || !informationElement || !descriptor || !descriptorContentType) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetRadioTextPlus"); - return XA_RESULT_PARAMETER_INVALID; - } - - *informationElement = 0; - *descriptorContentType = 0; - - DEBUG_API("<-XARDSItfAdapt_GetRadioTextPlus"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeType(XAAdaptationGstCtx *bCtx, XAuint32 * pty) - */ -XAresult XARDSItfAdapt_GetProgrammeType(XAAdaptationGstCtx *bCtx, XAuint32 * pty) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeType"); - - if(!bCtx || !pty) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeType"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *pty = data->programmeType; - } - else - { - *pty = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeType"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeTypeString(XAAdaptationGstCtx *bCtx, - * XAboolean isLengthMax16, - * XAchar * pty) - * - */ -XAresult XARDSItfAdapt_GetProgrammeTypeString(XAAdaptationGstCtx *bCtx, - XAboolean isLengthMax16, - XAchar * pty) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeTypeString"); - - if(!bCtx || !pty) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeTypeString"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - if (isLengthMax16) - { - DEBUG_API_A1("Programme type string %s", data->ptyStringLong); - strncpy( (char *)pty, (char *)data->ptyStringLong, MAX_PTY_STRING_LONG_LENGHT ); - } - else - { - DEBUG_API_A1("Programme type string %s", data->ptyStringShort); - strncpy( (char *)pty, (char *)data->ptyStringShort, MAX_PTY_STRING_SHORT_LENGHT ); - } - } - else - { - DEBUG_API_A1("Programme type string %s", noneString); - strncpy( (char *)pty, (char *)noneString, NONE_STRING_LENGHT ); - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeTypeString"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetProgrammeIdentificationCode(XAAdaptationGstCtx *bCtx, XAint16 * pi) - */ -XAresult XARDSItfAdapt_GetProgrammeIdentificationCode(XAAdaptationGstCtx *bCtx, XAint16 * pi) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetProgrammeIdentificationCode"); - - if(!bCtx || !pi) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetProgrammeIdentificationCode"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *pi = data->programmeID; - } - else - { - *pi = 0; - } - - DEBUG_API("<-XARDSItfAdapt_GetProgrammeIdentificationCode"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetClockTime(XAAdaptationGstCtx *bCtx, XAtime * dateAndTime) - */ -XAresult XARDSItfAdapt_GetClockTime(XAAdaptationGstCtx *bCtx, XAtime * dateAndTime) -{ - XAresult ret = XA_RESULT_SUCCESS; - time_t timeRet=0; - DEBUG_API("->XARDSItfAdapt_GetClockTime"); - - if(!bCtx || !dateAndTime) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetClockTime"); - return XA_RESULT_PARAMETER_INVALID; - } - - timeRet = time(NULL); - - if (timeRet == -1) /* could not get time for some reason */ - { - ret = XA_RESULT_INTERNAL_ERROR; - } - else - { - *dateAndTime = timeRet; - } - - DEBUG_API("<-XARDSItfAdapt_GetClockTime"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean * ta) - */ -XAresult XARDSItfAdapt_GetTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean * ta) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetTrafficAnnouncement"); - - if(!bCtx || !ta) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *ta = data->trafficAnnouncement; - } - else - { - *ta = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XARDSItfAdapt_GetTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetTrafficProgramme(XAAdaptationGstCtx *bCtx, XAboolean * tp) - */ -XAresult XARDSItfAdapt_GetTrafficProgramme(XAAdaptationGstCtx *bCtx, XAboolean * tp) -{ - XAresult ret = XA_RESULT_SUCCESS; - const RDSData* data; - DEBUG_API("->XARDSItfAdapt_GetTrafficProgramme"); - - if(!bCtx || !tp) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetTrafficProgramme"); - return XA_RESULT_PARAMETER_INVALID; - } - - data = GetCurrentRdsData( bCtx ); - - if (data) - { - *tp = data->trafficProgramme; - } - else - { - *tp = XA_BOOLEAN_FALSE; - } - - DEBUG_API("<-XARDSItfAdapt_GetTrafficProgramme"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SeekByProgrammeType(XAAdaptationGstCtx *bCtx, - * XAuint32 pty, - * XAboolean upwards) - */ -XAresult XARDSItfAdapt_SeekByProgrammeType(XAAdaptationGstCtx *bCtx, - XAuint32 pty, - XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARDSItfAdapt_SeekByProgrammeType"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SeekByProgrammeType"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - if (pty == XA_RDSPROGRAMMETYPE_RDSPTY_POPMUSIC) - { - //freqSetAfterSeek = rdsData[POPMUSIC_CHANNEL].frequency; - } - else - { - //freqSetAfterSeek = mCtx->frequency; - } - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARDSItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_SeekByProgrammeType"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SeekByProgrammeType"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SeekTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean upwards) - */ -XAresult XARDSItfAdapt_SeekTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARDSItfAdapt_SeekTrafficAnnouncement"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - //freqSetAfterSeek = rdsData[TRAFFIC_ANNOUNCEMENT_CHANNEL].frequency; - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARDSItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficAnnouncement"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SeekTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SeekTrafficProgramme(XAAdaptationGstCtx *bCtx, XAboolean upwards) - */ -XAresult XARDSItfAdapt_SeekTrafficProgramme(XAAdaptationGstCtx *bCtx, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx = NULL; - DEBUG_API("->XARDSItfAdapt_SeekTrafficProgramme"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficProgramme"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - //freqSetAfterSeek = rdsData[TRAFFIC_PROGRAMME_CHANNEL].frequency; - - mCtx->state = XA_RADIO_SEEKING; - pt_ret = pthread_create(&(mCtx->emulationThread), NULL, (XARDSItfAdapt_AsyncSeek),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_SeekTrafficProgramme"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SeekTrafficProgramme"); - return ret; -} - -/* - * void * XARadioItfAdapt_AsyncSeek(void* args) - */ -void * XARDSItfAdapt_AsyncSeek(void* args) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAAdaptationGstCtx *bCtx = (XAAdaptationGstCtx*)args; - - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - - DEBUG_API("->XARDSItfAdapt_AsyncSeek"); - - usleep(100000); /* 1/10 seconds */ - - DEBUG_INFO("Seek done!"); - - //ret = XARadioItfAdapt_SyncSetFrequency( bCtx, freqSetAfterSeek ); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR("XARadioItfAdapt_SyncSetFrequency FAILED"); - } - - /* Send event to RadioItf */ - { - XAAdaptEvent event = {XA_RADIOITFEVENTS, XA_ADAPT_RADIO_SEEK_COMPLETE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - mCtx->state = XA_RADIO_IDLE; - - DEBUG_API("<-XARDSItfAdapt_AsyncSeek"); - pthread_exit(NULL); - return NULL; -} - -/* - * XAresult XARDSItfAdapt_SetAutomaticSwitching(XAAdaptationGstCtx *bCtx, XAboolean automatic) - */ -XAresult XARDSItfAdapt_SetAutomaticSwitching(XAAdaptationGstCtx *bCtx, XAboolean automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_SetAutomaticSwitching"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SetAutomaticSwitching"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XA_RESULT_FEATURE_UNSUPPORTED; - - DEBUG_API("<-XARDSItfAdapt_SetAutomaticSwitching"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetAutomaticSwitching(XAAdaptationGstCtx *bCtx, XAboolean * automatic) - */ -XAresult XARDSItfAdapt_GetAutomaticSwitching(XAAdaptationGstCtx *bCtx, XAboolean * automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_GetAutomaticSwitching"); - - if(!bCtx || !automatic) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetAutomaticSwitching"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Feature not supported */ - *automatic = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XARDSItfAdapt_GetAutomaticSwitching"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_SetAutomaticTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean automatic) - */ -XAresult XARDSItfAdapt_SetAutomaticTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_SetAutomaticTrafficAnnouncement"); - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SetAutomaticTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XA_RESULT_FEATURE_UNSUPPORTED; - - DEBUG_API("<-XARDSItfAdapt_SetAutomaticTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetAutomaticTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean * automatic) - */ -XAresult XARDSItfAdapt_GetAutomaticTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean * automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XARDSItfAdapt_GetAutomaticTrafficAnnouncement"); - - if(!bCtx || !automatic) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetAutomaticTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - *automatic = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XARDSItfAdapt_GetAutomaticTrafficAnnouncement"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_GetODAGroup(XAAdaptationGstCtx *bCtx, - * XAint16 AID) - */ -XAresult XARDSItfAdapt_GetODAGroup(XAAdaptationGstCtx *bCtx, XAint16 AID) -{ - XAresult ret = XA_RESULT_SUCCESS; - int pt_ret=0; - XARadioAdaptationCtx* mCtx=NULL; - DEBUG_API("->XARDSItfAdapt_GetODAGroup"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_GetODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - mCtx = (XARadioAdaptationCtx*) bCtx; - - if (mCtx->rdsState != XA_RADIO_RDS_IDLE) - { - // pthread_cancel(mCtx->rdsEmulationThread); - mCtx->rdsState = XA_RADIO_RDS_IDLE; - DEBUG_INFO("Previous getodagroup async call cancelled") - } - - pt_ret = pthread_create(&(mCtx->rdsEmulationThread), NULL, (XARDSItfAdapt_AsyncGetODAGroup),(void*)bCtx); - - if(pt_ret) - { - DEBUG_ERR_A1("could not create thread!! (%d)",ret); - DEBUG_API("<-XARDSItfAdapt_GetODAGroup"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_GetODAGroup"); - return ret; -} - -/* - * void * XARDSItfAdapt_AsyncGetODAGroup(void* args) - */ -void * XARDSItfAdapt_AsyncGetODAGroup(void* args) -{ - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*)args; - - DEBUG_API("->XARDSItfAdapt_AsyncGetODAGroup"); - mCtx->rdsState = XA_RADIO_RDS_GETTING_ODA_GROUP; - - DEBUG_INFO("Get oda group async wait") - usleep(100000); /* 1/10 seconds */ - - /* Send event */ - { - XAAdaptEvent event = {XA_RDSITFEVENTS, XA_ADAPT_RDS_GET_ODA_GROUP_DONE, 0, NULL }; - XAAdaptationBase_SendAdaptEvents(args, &event ); - } - mCtx->rdsState = XA_RADIO_RDS_IDLE; - DEBUG_API("<-XARDSItfAdapt_AsyncGetODAGroup"); - pthread_exit(NULL); - return NULL; -} - -/* - * XAresult XARDSItfAdapt_SubscribeODAGroup(XAAdaptationGstCtx *bCtx, - * XAint16 group, - * XAboolean useErrorCorrection) - */ -XAresult XARDSItfAdapt_SubscribeODAGroup(XAAdaptationGstCtx *bCtx, - XAint16 group, - XAboolean useErrorCorrection) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - XAboolean groupFound = XA_BOOLEAN_FALSE; - DEBUG_API("->XARDSItfAdapt_SubscribeODAGroup"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_SubscribeODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Look for group in list, if not there add it */ - if (subscribedODAGroupCount < MAX_ODA_GROUP_SUBSCRIPTIONS) - { - for (index = 0; index < subscribedODAGroupCount; index++) - { - if (subscribedODAGroups[index] == group) - { - groupFound = XA_BOOLEAN_TRUE; - } - } - if (!groupFound) - { - subscribedODAGroups[subscribedODAGroupCount] = group; - subscribedODAGroupCount++; - } - } - else - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XARDSItfAdapt_SubscribeODAGroup"); - return XA_RESULT_INTERNAL_ERROR; - } - - DEBUG_API("<-XARDSItfAdapt_SubscribeODAGroup"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_UnsubscribeODAGroup(XAAdaptationGstCtx *bCtx, XAint16 group) - */ -XAresult XARDSItfAdapt_UnsubscribeODAGroup(XAAdaptationGstCtx *bCtx, XAint16 group) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - DEBUG_API("->XARDSItfAdapt_UnsubscribeODAGroup"); - - if(!bCtx) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_UnsubscribeODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Look for group in list, if found, remove it */ - for (index = 0; index < subscribedODAGroupCount; index++) - { - if (subscribedODAGroups[index] == group) - { - subscribedODAGroups[index] = subscribedODAGroups[subscribedODAGroupCount-1]; - subscribedODAGroupCount--; - } - } - - DEBUG_API("<-XARDSItfAdapt_UnsubscribeODAGroup"); - return ret; -} - -/* - * XAresult XARDSItfAdapt_ListODAGroupSubscriptions(XAAdaptationGstCtx *bCtx, - * XAint16* pGroups, - * XAuint32* pLength) - */ -XAresult XARDSItfAdapt_ListODAGroupSubscriptions(XAAdaptationGstCtx *bCtx, - XAint16* pGroups, - XAuint32* pLength) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint8 index=0; - DEBUG_API("->XARDSItfAdapt_ListODAGroupSubscriptions"); - - if(!bCtx || !pLength) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XARDSItfAdapt_ListODAGroupSubscriptions"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (!pGroups) - { - *pLength = subscribedODAGroupCount; - } - else - { - if (*pLength < subscribedODAGroupCount) - { - ret = XA_RESULT_BUFFER_INSUFFICIENT; - } - for (index = 0; index < *pLength; index++) - { - pGroups[index] = subscribedODAGroups[index]; - } - } - - DEBUG_API("<-XARDSItfAdapt_ListODAGroupSubscriptions"); - return ret; -} - -/* - * const RDSData* GetCurrentRdsData( XAAdaptationGstCtx *bCtx ) - */ -const RDSData* GetCurrentRdsData( XAAdaptationGstCtx *bCtx ) -{ - XAuint8 index=0; - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - - for (index = 0; index < NUM_OF_CHANNELS; index++ ) - { - if (rdsData[index].frequency == mCtx->frequency) - { - DEBUG_API("<-GetCurrentRdsData"); - return &(rdsData[index]); - } - } - DEBUG_API("<-GetCurrentRdsData"); - return NULL; -} - - -/* - * void XARDSItfAdapt_Free(XAAdaptationGstCtx *bCtx) - */ -void XARDSItfAdapt_Free(XAAdaptationBaseCtx *bCtx) -{ - XARadioAdaptationCtx* mCtx = (XARadioAdaptationCtx*) bCtx; - DEBUG_API("->XARDSItfAdapt_Free"); - - if (mCtx->state != XA_RADIO_IDLE) - { - // pthread_cancel(mCtx->emulationThread); - mCtx->state = XA_RADIO_IDLE; - } - - if (mCtx->rdsState != XA_RADIO_RDS_IDLE) - { - // pthread_cancel(mCtx->rdsEmulationThread); - mCtx->rdsState = XA_RADIO_RDS_IDLE; - } - - DEBUG_API("<-XARDSItfAdapt_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xardsitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xardsitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARDSITFFADAPTATION_H -#define XARDSOITFFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xadebug.h" - -/* MACROS */ - -/* FUNCTIONS */ - -XAresult XARDSItfAdapt_QueryRDSSignal(XAAdaptationGstCtx *bCtx, XAboolean * isSignal); - -XAresult XARDSItfAdapt_GetProgrammeServiceName(XAAdaptationGstCtx *bCtx, XAchar * ps); - -XAresult XARDSItfAdapt_GetRadioText(XAAdaptationGstCtx *bCtx, XAchar * rt); - -XAresult XARDSItfAdapt_GetRadioTextPlus(XAAdaptationGstCtx *bCtx, - XAuint8 contentType, - XAchar * informationElement, - XAchar * descriptor, - XAuint8 * descriptorContentType); - -XAresult XARDSItfAdapt_GetProgrammeType(XAAdaptationGstCtx *bCtx, XAuint32 * pty); - -XAresult XARDSItfAdapt_GetProgrammeTypeString(XAAdaptationGstCtx *bCtx, - XAboolean isLengthMax16, - XAchar * pty); - -XAresult XARDSItfAdapt_GetProgrammeIdentificationCode(XAAdaptationGstCtx *bCtx, XAint16 * pi); - -XAresult XARDSItfAdapt_GetClockTime(XAAdaptationGstCtx *bCtx, XAtime * dateAndTime); - -XAresult XARDSItfAdapt_GetTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean * ta); - -XAresult XARDSItfAdapt_GetTrafficProgramme(XAAdaptationGstCtx *bCtx, XAboolean * tp); - -XAresult XARDSItfAdapt_SeekByProgrammeType(XAAdaptationGstCtx *bCtx, - XAuint32 pty, - XAboolean upwards); - -XAresult XARDSItfAdapt_SeekTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean upwards); - -XAresult XARDSItfAdapt_SeekTrafficProgramme(XAAdaptationGstCtx *bCtx, XAboolean upwards); - -XAresult XARDSItfAdapt_SetAutomaticSwitching(XAAdaptationGstCtx *bCtx, XAboolean automatic); - -XAresult XARDSItfAdapt_GetAutomaticSwitching(XAAdaptationGstCtx *bCtx, XAboolean * automatic); - -XAresult XARDSItfAdapt_SetAutomaticTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean automatic); - -XAresult XARDSItfAdapt_GetAutomaticTrafficAnnouncement(XAAdaptationGstCtx *bCtx, XAboolean * automatic); - -XAresult XARDSItfAdapt_GetODAGroup(XAAdaptationGstCtx *bCtx, XAint16 AID); - -XAresult XARDSItfAdapt_SubscribeODAGroup(XAAdaptationGstCtx *bCtx, - XAint16 group, - XAboolean useErrorCorrection); - -XAresult XARDSItfAdapt_UnsubscribeODAGroup(XAAdaptationGstCtx *bCtx, XAint16 group); - -XAresult XARDSItfAdapt_ListODAGroupSubscriptions(XAAdaptationGstCtx *bCtx, - XAint16* pGroups, - XAuint32* pLength); - -void XARDSItfAdapt_Free(XAAdaptationBaseCtx *bCtx); - -#endif /* XARDSITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/gst_adaptation/xarecorditfadaptation.c Fri Jul 09 16:43:35 2010 -0500 @@ -20,14 +20,11 @@ #include "xamediarecorderadaptctx.h" #include "xarecorditfadaptation.h" #include "xaadaptationgst.h" -#include "xacameraadaptctx.h" + /*forward declaration of position updater callback*/ gboolean XARecordItfAdapt_PositionUpdate(gpointer ctx); -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - /* * XAresult XARecordItfAdapt_SetRecordState(XAAdaptationGstCtx *ctx, XAuint32 state) * Sets record state to GStreamer. @@ -74,30 +71,6 @@ } } - if (cameraCtx && cameraRealized && mCtx->isobjvsrc - && mCtx->videosource) - { - cameraCtx->recording = XA_BOOLEAN_FALSE; - - if (!cameraCtx->playing && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if (GST_STATE( GST_ELEMENT(mCtx->videosource)) - == GST_STATE_PLAYING) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( - GST_ELEMENT(mCtx->videosource), - GST_STATE_PAUSED); - if (gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( - GST_ELEMENT(mCtx->videosource), NULL, - NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - } - } - bCtx->binWantedState = GST_STATE_PAUSED; closeSink = XA_BOOLEAN_TRUE; if (mCtx->runpositiontimer > 0) @@ -120,29 +93,6 @@ } case XA_RECORDSTATE_PAUSED: { - if (cameraCtx && cameraRealized && mCtx->isobjvsrc - && mCtx->videosource) - { - cameraCtx->recording = XA_BOOLEAN_FALSE; - if (!cameraCtx->playing && !cameraCtx->snapshotting) - { - /* Neither view finder or recorder is running -> pause camera */ - if (GST_STATE( GST_ELEMENT(mCtx->videosource)) - == GST_STATE_PLAYING) - { - GstStateChangeReturn gret; - DEBUG_INFO("Stop camera source"); - gret = gst_element_set_state( - GST_ELEMENT(mCtx->videosource), - GST_STATE_PAUSED); - if (gret == GST_STATE_CHANGE_SUCCESS) - gret = gst_element_get_state( - GST_ELEMENT(mCtx->videosource), NULL, - NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - } - } - if (mCtx->xaRecordState == XA_RECORDSTATE_STOPPED && mCtx->encodingchanged) { @@ -163,11 +113,6 @@ } case XA_RECORDSTATE_RECORDING: { - if (cameraCtx && mCtx->isobjvsrc) - { - cameraCtx->recording = XA_BOOLEAN_TRUE; - } - if (mCtx->xaRecordState == XA_RECORDSTATE_STOPPED && (mCtx->encodingchanged)) { @@ -288,7 +233,8 @@ gret = gst_element_get_state(GST_ELEMENT(mCtx->videosource), NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); } - }DEBUG_API("<-XARecordItfAdapt_SetRecordState"); + } + DEBUG_API("<-XARecordItfAdapt_SetRecordState"); return ret; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,153 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xaseekitfadaptation.h" - -/* - * XAresult XASeekItfAdapt_SetPosition(XAAdaptationGstCtx *bCtx, XAmillisecond pos, XAuint32 seekMode) - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * XAmillisecond pos - Position to be set in Milliseconds - * XAuint32 seekMode - Preferred seek mode - * @return XAresult ret - Success value - */ -XAresult XASeekItfAdapt_SetPosition(XAAdaptationGstCtx *bCtx, XAmillisecond pos, XAuint32 seekMode) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - gint64 gstSeekPos = pos * GST_MSECOND; - XAmillisecond newPosMs=0; - GstFormat format = GST_FORMAT_TIME; - GstSeekFlags seekFlags = GST_SEEK_FLAG_FLUSH; - DEBUG_API_A2("->XASeekItfAdapt_SetPosition (pos %ld ms, mode=%d)", pos, (int)seekMode); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfAdapt_SetPosition"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( GST_STATE(bCtx->bin) < GST_STATE_PAUSED ) - { /* This should not happen */ - DEBUG_ERR("Gst not prerolled - can not seek!!"); - DEBUG_API("<-XASeekItfAdapt_SetPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - if ( seekMode == XA_SEEKMODE_FAST ) - { - seekFlags |= GST_SEEK_FLAG_KEY_UNIT; - } - else - { - seekFlags |= GST_SEEK_FLAG_ACCURATE; - } - - XAAdaptationGst_PrepareAsyncWait(bCtx); - DEBUG_INFO("Send gst_element_seek"); - mCtx->lastpos = gstSeekPos; - if ( !gst_element_seek( bCtx->bin, mCtx->playrate, GST_FORMAT_TIME, seekFlags, - GST_SEEK_TYPE_SET, gstSeekPos, - GST_SEEK_TYPE_NONE, (gint64)GST_CLOCK_TIME_NONE ) ) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationGst_StartAsyncWait(bCtx); - DEBUG_INFO("Seek handled.") - bCtx->waitingasyncop = XA_BOOLEAN_FALSE; - /* update new position to playitf */ - { - XAAdaptEvent event = {XA_PLAYITFEVENTS, XA_ADAPT_POSITION_UPDATE_EVT, 1, NULL}; - if ( !gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &mCtx->lastpos ) ) - { - DEBUG_ERR("WARNING: could not get position from GST") - } - DEBUG_INFO_A1("Current position %"GST_TIME_FORMAT, GST_TIME_ARGS(mCtx->lastpos)); - newPosMs = GST_TIME_AS_MSECONDS(mCtx->lastpos); - event.data = &newPosMs; - XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event ); - } - - ret = XA_RESULT_SUCCESS; - - DEBUG_API("<-XASeekItfAdapt_SetPosition"); - return ret; -} - -/* - * XAresult XASeekItfAdapt_SetLoop(void *bCtx, AdaptationContextIDS ctxIDs, XAboolean loopEnable, XAmillisecond startPos, - * XAmillisecond endPos) - * @param XAAdaptationGstCtx *bCtx - Adaptation context, this will be casted to correct type regarding to contextID value - * XAboolean loopEnable - Enable/Disable looping - * XAmillisecond startPos - Loop start position in milliseconds - * XAmillisecond endPos - Loop end position in milliseconds - * @return XAresult ret - Success value - */ -XAresult XASeekItfAdapt_SetLoop(XAAdaptationGstCtx *bCtx, XAboolean loopEnable, XAmillisecond startPos, - XAmillisecond endPos) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAMediaPlayerAdaptationCtx* mCtx = (XAMediaPlayerAdaptationCtx*) bCtx; - GstFormat format = GST_FORMAT_TIME; - - DEBUG_API_A3("->XASeekItfAdapt_SetLoop (enable=%d, start=%ld, stop=%ld)", (int)loopEnable, startPos, endPos); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaPlayerAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfAdapt_SetLoop"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( loopEnable ) - { - if(endPos==XA_TIME_UNKNOWN) - { - mCtx->loopend = (gint64)GST_CLOCK_TIME_NONE; - } - else - { - mCtx->loopend = (endPos*GST_MSECOND); - DEBUG_INFO_A1("Set looping to %ld", mCtx->loopend); - } - DEBUG_INFO_A2("Enable looping from %"GST_TIME_FORMAT" to %"GST_TIME_FORMAT, - GST_TIME_ARGS(mCtx->loopstart), GST_TIME_ARGS(mCtx->loopend)); - mCtx->loopstart = (startPos*GST_MSECOND); - if ( !gst_element_query_position( GST_ELEMENT(bCtx->bin), &format, &(mCtx->lastpos) ) ) - { - DEBUG_ERR("WARNING: could not get position from GST") - } - DEBUG_INFO_A1("current head position %"GST_TIME_FORMAT"",GST_TIME_ARGS(mCtx->lastpos)); - mCtx->loopingenabled = XA_BOOLEAN_TRUE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - else - { - DEBUG_INFO("Disable looping"); - mCtx->loopstart = 0; - mCtx->loopend = (gint64)GST_CLOCK_TIME_NONE; - mCtx->loopingenabled = XA_BOOLEAN_FALSE; - XAMediaPlayerAdapt_UpdatePositionCbTimer(mCtx); - } - - DEBUG_API("<-XASeekItfAdapt_SetLoop"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xaseekitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XASEEKITFADAPTATION_H -#define XASEEKITFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xadebug.h" - -/* FUNCTIONS */ - -XAresult XASeekItfAdapt_SetPosition(XAAdaptationGstCtx *ctx, XAmillisecond pos, - XAuint32 seekMode); - -XAresult XASeekItfAdapt_SetLoop(XAAdaptationGstCtx *ctx, XAboolean loopEnable, - XAmillisecond startPos, XAmillisecond endPos); -#endif /* XASEEKITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,891 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "xaadaptationgst.h" -#include "xasnapshotitfadaptation.h" -#include "xamediarecorderadaptctx.h" -#include "xametadataadaptation.h" -#include "xacameraadaptctx.h" -#include "xacapabilitiesmgr.h" - -#define SSMAXPIC 30 -#define SSMAXFPS 30 /*technically, same as FPS of video stream*/ -#define SSMINFPS 1 - -extern XAboolean cameraRealized; -extern XACameraAdaptationCtx_* cameraCtx; - -/* Forward declarations for internal methods */ -XAresult XASnapshotItfAdaptation_CreateSnapshotPipeline(XAAdaptationGstCtx* bCtx); -XAresult XASnapshotItfAdaptation_FreeSnapshot(XAAdaptationGstCtx* bCtx); -const char* XASnapshotItfAdaptation_GetFileSuffix(XADataFormat_MIME* format); -void XASnapshotItfAdaptation_AllocNextFilename(char** fname, const char* template); -void XASnapshotItfAdaptation_StopSnapshotting(XAAdaptationGstCtx* bCtx); - -/* callbacks */ -gboolean XASnapshotItfAdaptation_SnapshotBusCb( GstBus *bus, GstMessage *message, gpointer data ); -void XASnapshotItfAdaptation_BufferHandoffCb( GstElement *extract, GstBuffer *buffer, gpointer data); - -/********************************* - * SnapshotItf adaptation methods - *********************************/ - -/* - * XAresult XASnapshotItfAdaptation_InitiateSnapshot(XAAdaptationGstCtx* bCtx, - * XAuint32 numberOfPictures, - * XAuint32 fps, - * XAboolean freezeViewFinder, - * XADataSink* sink) - */ -XAresult XASnapshotItfAdaptation_InitiateSnapshot(XAAdaptationGstCtx* bCtx, - XAuint32 numberOfPictures, - XAuint32 fps, - XAboolean freezeViewFinder, - XADataSink* sink) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - XADataLocator_URI* uri=NULL; - - DEBUG_API("->XASnapshotItfAdaptation_InitiateSnapshot"); - /* Store initialization variables */ - mCtx->snapshotVars.numpics = numberOfPictures; - mCtx->snapshotVars.fps = fps; - mCtx->snapshotVars.freeze =freezeViewFinder; - mCtx->snapshotVars.parsenegotiated = FALSE; - mCtx->snapshotVars.snapshotbuffer = NULL; - - if( sink ) - { /* parse file sink name*/ - if( sink->pLocator && *((XAuint32*)(sink->pLocator)) == XA_DATALOCATOR_URI ) - { - uri = (XADataLocator_URI*)sink->pLocator; - if ( uri->URI != NULL ) - { - /* parse filename template: */ - mCtx->snapshotVars.fnametemplate = (char*)calloc(1,strlen((char*)uri->URI)+10); - DEBUG_INFO_A1("URI: %s", uri->URI); - if(strncmp((char*)uri->URI, "file://", 7) == 0) - { - strcat(mCtx->snapshotVars.fnametemplate, (char*)&((uri->URI)[7])); - } - else - { - strcat(mCtx->snapshotVars.fnametemplate, (char*)uri->URI); - } - strcat(mCtx->snapshotVars.fnametemplate, "%04d."); - strcat(mCtx->snapshotVars.fnametemplate, - XASnapshotItfAdaptation_GetFileSuffix(sink->pFormat)); - DEBUG_INFO_A1("->template name %s", mCtx->snapshotVars.fnametemplate); - } - else - { - DEBUG_ERR("No uri specified."); - return XA_RESULT_PARAMETER_INVALID; - } - } - else - { /* take snapshot to memory buffer */ - if( mCtx->snapshotVars.fnametemplate ) - { - free( mCtx->snapshotVars.fnametemplate ); - } - mCtx->snapshotVars.fnametemplate = NULL; - } - if( sink->pFormat && *((XAuint32*)(sink->pFormat)) == XA_DATAFORMAT_RAWIMAGE ) - { - XADataFormat_RawImage* img = ((XADataFormat_RawImage*)sink->pFormat); - /*set needed image settings from the sink structure*/ - mCtx->imageEncSettings.encoderId = XA_IMAGECODEC_RAW; - mCtx->imageEncSettings.width = img->width; - mCtx->imageEncSettings.height = img->height; - mCtx->imageEncSettings.colorFormat = img->colorFormat; - } - } - else - { - DEBUG_ERR("XASnapshotItfAdaptation_InitiateSnapshot, invalid data sink!"); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_InitiateSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - - - if( mCtx->snapshotVars.sspipeline ) - { - XASnapshotItfAdaptation_FreeSnapshot(bCtx); - } - if( XASnapshotItfAdaptation_CreateSnapshotPipeline(bCtx) != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to create pipeline!!"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XASnapshotItfAdaptation_InitiateSnapshot"); - return XA_RESULT_INTERNAL_ERROR; - } - DEBUG_API("<-XASnapshotItfAdaptation_InitiateSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_TakeSnapshot(XAAdaptationGstCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_TakeSnapshot(XAAdaptationGstCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - - DEBUG_API("->XASnapshotItfAdaptation_TakeSnapshot"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_TakeSnapshot"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*)bCtx; - /*to get buffer, base pipeline must be playing...*/ - if( GST_STATE(mCtx->baseObj.bin) != GST_STATE_PLAYING ) - { - DEBUG_INFO_A1("Parent bin in state %d, set to PLAYING", GST_STATE(mCtx->baseObj.bin)); - gst_element_set_state( GST_ELEMENT(mCtx->baseObj.bin), GST_STATE_PLAYING ); - gst_element_get_state( GST_ELEMENT(mCtx->baseObj.bin), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - if ( mCtx->isobjvsrc && mCtx->videosource && cameraCtx && cameraRealized ) - { - GstPad *pad=NULL; - GstPad *pad1=NULL; - - cameraCtx->snapshotting = XA_BOOLEAN_TRUE; - pad = gst_element_get_static_pad( GST_ELEMENT(cameraCtx->baseObj.bin), "MRObjSrc"); - if( pad && gst_pad_is_linked(pad) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name(cameraCtx->baseObj.bin), - gst_pad_get_name(pad)); - gst_pad_set_blocked_async(pad, FALSE, XAAdaptationGst_PadBlockCb, NULL); - } - - pad1 = gst_element_get_static_pad( GST_ELEMENT(cameraCtx->baseObj.bin), "MPObjSrc"); - if( pad1 && gst_pad_is_linked(pad1) ) - { - DEBUG_INFO_A2("unblock element:%s pad:%s", - gst_element_get_name(cameraCtx->baseObj.bin), - gst_pad_get_name(pad1)); - gst_pad_set_blocked_async(pad, FALSE, XAAdaptationGst_PadBlockCb, NULL); - } - - DEBUG_INFO_A1("Using camera from global pointer %x", cameraCtx); - if ( GST_STATE( GST_ELEMENT(cameraCtx->baseObj.bin)) != GST_STATE_PLAYING ) - { - cameraCtx->baseObj.binWantedState = GST_STATE(cameraCtx->baseObj.bin); - DEBUG_INFO_A1("Camerabin state %d, set to PLAYING", GST_STATE(GST_ELEMENT(cameraCtx->baseObj.bin))); - gst_element_set_state( GST_ELEMENT(cameraCtx->baseObj.bin), GST_STATE_PLAYING ); - gst_element_get_state( GST_ELEMENT(cameraCtx->baseObj.bin), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - } - - /* Connect signal for getting current buffer from video pipeline*/ - mCtx->snapshotVars.numpicstaken = 0; - mCtx->snapshotVars.waitforbuffer = TRUE; - if(mCtx->videoextract) - { - mCtx->snapshotVars.sighandler = g_signal_connect(mCtx->videoextract, "handoff", - G_CALLBACK (XASnapshotItfAdaptation_BufferHandoffCb),mCtx); - } - if( mCtx->snapshotVars.sighandler==0 ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XASnapshotItfAdaptation_TakeSnapshot"); - return XA_RESULT_INTERNAL_ERROR; - } - DEBUG_API("<-XASnapshotItfAdaptation_TakeSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_CancelSnapshot(XAAdaptationGstCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_CancelSnapshot(XAAdaptationGstCtx* bCtx) -{ - DEBUG_API("->XASnapshotItfAdaptation_CancelSnapshot"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_CancelSnapshot"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - XASnapshotItfAdaptation_FreeSnapshot(bCtx); - - DEBUG_API("<-XASnapshotItfAdaptation_CancelSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_GetMaxPicsPerBurst(XAAdaptationGstCtx* bCtx, - * XAuint32 *maxNumberOfPictures) - */ -XAresult XASnapshotItfAdaptation_GetMaxPicsPerBurst(XAAdaptationGstCtx* bCtx, - XAuint32 *maxNumberOfPictures) -{ - DEBUG_API("->XASnapshotItfAdaptation_GetMaxPicsPerBurst"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_GetMaxPicsPerBurst"); - return XA_RESULT_PARAMETER_INVALID; - } - *maxNumberOfPictures = SSMAXPIC; - DEBUG_API("<-XASnapshotItfAdaptation_GetMaxPicsPerBurst"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_GetBurstFPSRange(XAAdaptationGstCtx* bCtx, - * XAuint32 *minFPS, - * XAuint32 *maxFPS) - */ -XAresult XASnapshotItfAdaptation_GetBurstFPSRange(XAAdaptationGstCtx* bCtx, - XAuint32 *minFPS, - XAuint32 *maxFPS) -{ - DEBUG_API("->XASnapshotItfAdaptation_GetBurstFPSRange"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_GetBurstFPSRange"); - return XA_RESULT_PARAMETER_INVALID; - } - *minFPS = SSMINFPS; - *maxFPS = SSMAXFPS; - - DEBUG_API("<-XASnapshotItfAdaptation_GetBurstFPSRange"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_SetShutterFeedback(XAAdaptationGstCtx* bCtx, - * XAboolean enabled) - */ -XAresult XASnapshotItfAdaptation_SetShutterFeedback(XAAdaptationGstCtx* bCtx, - XAboolean enabled) -{ - DEBUG_API("->XASnapshotItfAdaptation_SetShutterFeedback"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_SetShutterFeedback"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - /* stubbed, no implementation */ - DEBUG_API("<-XASnapshotItfAdaptation_SetShutterFeedback"); - return XA_RESULT_SUCCESS; -} - -/******************** - * Internal methods - ********************/ - -/* - * void XASnapshotItfAdaptation_StopSnapshotting(XAAdaptationGstCtx* bCtx) - */ -void XASnapshotItfAdaptation_StopSnapshotting(XAAdaptationGstCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - DEBUG_API("->XASnapshotItfAdaptation_StopSnapshotting"); - mCtx->snapshotVars.waitforbuffer = FALSE; - mCtx->snapshotVars.snapshotbuffer = NULL; - if(mCtx->snapshotVars.sighandler) - { - if(mCtx->videoextract) - { - g_signal_handler_disconnect(mCtx->videoextract,mCtx->snapshotVars.sighandler); - } - mCtx->snapshotVars.sighandler = 0; - } - /* did we change the state of parent pipeline?*/ - if( mCtx->baseObj.bin && (GST_STATE(mCtx->baseObj.bin) != mCtx->baseObj.binWantedState) ) - { - gst_element_set_state( GST_ELEMENT(mCtx->baseObj.bin), mCtx->baseObj.binWantedState ); - } - - if ( cameraCtx && (GST_STATE(cameraCtx->baseObj.bin) != cameraCtx->baseObj.binWantedState) ) - { - cameraCtx->snapshotting = XA_BOOLEAN_FALSE; - DEBUG_INFO_A2("Camerabin state %d, restored to %d", GST_STATE(cameraCtx->baseObj.bin), cameraCtx->baseObj.binWantedState ); - gst_element_set_state( GST_ELEMENT(cameraCtx->baseObj.bin), cameraCtx->baseObj.binWantedState ); - gst_element_get_state( GST_ELEMENT(cameraCtx->baseObj.bin), NULL,NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - } - DEBUG_API("<-XASnapshotItfAdaptation_StopSnapshotting"); -} - -/* - * XAresult XASnapshotItfAdaptation_FreeSnapshot(XAAdaptationGstCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_FreeSnapshot(XAAdaptationGstCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - DEBUG_API("->XASnapshotItfAdaptation_FreeSnapshot"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfAdaptation_FreeSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - XASnapshotItfAdaptation_StopSnapshotting(bCtx); - /* Clean up pipeline and set current pipeline state to null*/ - if( mCtx->snapshotVars.sspipeline ) - { - gst_element_set_state( GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_NULL ); - gst_object_unref( GST_OBJECT(mCtx->snapshotVars.sspipeline) ); - mCtx->snapshotVars.sspipeline = NULL; - } - if( mCtx->snapshotVars.ssbus ) - { - gst_object_unref( GST_OBJECT(mCtx->snapshotVars.ssbus) ); - mCtx->snapshotVars.ssbus = NULL; - } - if( mCtx->snapshotVars.fnametemplate ) - { - free(mCtx->snapshotVars.fnametemplate); - mCtx->snapshotVars.fnametemplate=NULL; - } - DEBUG_API("<-XASnapshotItfAdaptation_FreeSnapshot"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XASnapshotItfAdaptation_CreateSnapshotPipeline(XAAdaptationGstCtx* bCtx) - */ -XAresult XASnapshotItfAdaptation_CreateSnapshotPipeline(XAAdaptationGstCtx* bCtx) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - - XACapabilities temp; - GstCaps *imageCaps=NULL; - - DEBUG_API("->XASnapshotItfAdaptation_CreateSnapshotPipeline"); - if(!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - /*Create snapshotpipeline*/ - mCtx->snapshotVars.sspipeline = gst_pipeline_new ("sspipeline"); - if( mCtx->snapshotVars.sspipeline ) - { - /*add listener*/ - mCtx->snapshotVars.ssbus = gst_pipeline_get_bus(GST_PIPELINE( mCtx->snapshotVars.sspipeline ) ); - if( ! mCtx->snapshotVars.ssbus ) - { - DEBUG_API("Cannot create snapshotbus"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - gst_bus_add_signal_watch( mCtx->snapshotVars.ssbus ); - g_signal_connect(mCtx->snapshotVars.ssbus, "message::eos", - G_CALLBACK(XASnapshotItfAdaptation_SnapshotBusCb), bCtx ); - g_signal_connect(mCtx->snapshotVars.ssbus, "message::state-changed", - G_CALLBACK(XASnapshotItfAdaptation_SnapshotBusCb), bCtx ); - g_signal_connect(mCtx->snapshotVars.ssbus, "message::async-done", - G_CALLBACK(XASnapshotItfAdaptation_SnapshotBusCb), bCtx ); - - /*Create snapshotsource element*/ - mCtx->snapshotVars.ssbuffersrc = gst_element_factory_make("appsrc", "ssbuffersrc"); - if( !mCtx->snapshotVars.ssbuffersrc ) - { - DEBUG_ERR("Cannot create ssbuffersrc!"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - /*Frame parser*/ - mCtx->snapshotVars.ssparser = - gst_element_factory_make("videoparse","ssparser"); - if( !mCtx->snapshotVars.ssparser ) - { - DEBUG_ERR("Could not create snapshotparse"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - /*Scaler and filter for XAImageSettings width&height*/ - mCtx->snapshotVars.ssscaler = - gst_element_factory_make("videoscale","ssscaler"); - if( !mCtx->snapshotVars.ssscaler ) - { - DEBUG_ERR("Could not create ssscaler"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->snapshotVars.ssfilter = - gst_element_factory_make("capsfilter","ssfilter"); - if( !mCtx->snapshotVars.ssfilter ) - { - DEBUG_ERR("Could not create ssfilter"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - /*Create imageencoder */ - if(XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_ENCODER|XACAP_IMAGE), mCtx->imageEncSettings.encoderId, &temp) == XA_RESULT_SUCCESS) - { - if(temp.adaptId != NULL) - { - mCtx->snapshotVars.ssencoder = gst_element_factory_make((char*)temp.adaptId, "ssencoder"); - } - else if(mCtx->imageEncSettings.encoderId == XA_IMAGECODEC_RAW) - { - /* raw frames are internal format, so no codec needed. just insert identity for linking*/ - mCtx->snapshotVars.ssencoder = gst_element_factory_make("identity", "ssencoder"); - } - } - if( !mCtx->snapshotVars.ssencoder ) - { - DEBUG_API("Cannot create image encoder"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - /* Create also tag setter for JPG */ - if(mCtx->imageEncSettings.encoderId == XA_IMAGECODEC_JPEG) - { - mCtx->snapshotVars.sstagger = gst_element_factory_make("metadatamux", "sstagger"); - if( !mCtx->snapshotVars.sstagger || !gst_bin_add(GST_BIN(mCtx->snapshotVars.sspipeline),mCtx->snapshotVars.sstagger)) - { - DEBUG_API("Cannot create metadatamux"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - } - g_object_set( G_OBJECT(mCtx->snapshotVars.sstagger), "xmp", TRUE, "exif", TRUE, "iptc", TRUE, NULL ); - } - - /*Create sink*/ - if(mCtx->snapshotVars.fnametemplate) - { - DEBUG_INFO("RECORD SNAPSHOT TO FILE"); - mCtx->snapshotVars.sssink = gst_element_factory_make("filesink","ssfilesink"); - g_object_set( G_OBJECT(mCtx->snapshotVars.sssink), "location", "temp", - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - "buffer-mode", 2, - NULL ); - } - else - { - DEBUG_INFO("RECORD SNAPSHOT TO MEMORY"); - mCtx->snapshotVars.sssink = gst_element_factory_make("appsink","ssbuffersink"); - } - if( !mCtx->snapshotVars.sssink ) - { - DEBUG_ERR("Could not create sssink!!"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - g_object_set( G_OBJECT(mCtx->snapshotVars.sssink), "async", FALSE, NULL ); - - /*Add elements to bin*/ - gst_bin_add_many (GST_BIN (mCtx->snapshotVars.sspipeline), - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - mCtx->snapshotVars.ssfilter, - mCtx->snapshotVars.ssencoder, - mCtx->snapshotVars.sssink, - NULL); - - /* set needed XAImageSettings properties*/ - /* set caps from imagesettings */ - imageCaps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, mCtx->imageEncSettings.width, - "height", G_TYPE_INT, mCtx->imageEncSettings.height, NULL); - g_object_set( G_OBJECT(mCtx->snapshotVars.ssfilter), "caps", imageCaps, NULL ); - DEBUG_INFO_A1("new caps: %s",gst_caps_to_string(imageCaps)); - gst_caps_unref(imageCaps); - - /* set compression level */ - if(mCtx->imageEncSettings.encoderId == XA_IMAGECODEC_JPEG) - { - g_object_set( G_OBJECT(mCtx->snapshotVars.ssencoder), "quality", (gint)(1000 - mCtx->imageEncSettings.compressionLevel)/10, NULL ); - } - - /*Chain elements together*/ - if(mCtx->snapshotVars.sstagger) - { - if( !gst_element_link_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - mCtx->snapshotVars.ssfilter, - mCtx->snapshotVars.ssencoder, - mCtx->snapshotVars.sstagger, - mCtx->snapshotVars.sssink, - NULL) ) - { - DEBUG_ERR("Could not link pipeline") - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - if( !gst_element_link_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - mCtx->snapshotVars.ssfilter, - mCtx->snapshotVars.ssencoder, - mCtx->snapshotVars.sssink, - NULL) ) - { - DEBUG_ERR("Could not link pipeline") - return XA_RESULT_INTERNAL_ERROR; - } - } - gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_READY); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline"); - return XA_RESULT_SUCCESS; - - } - else - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline"); - return XA_RESULT_PRECONDITIONS_VIOLATED; - } -} - -/* - * gboolean XASnapshotItfAdaptation_SnapshotBusCb( GstBus *bus, GstMessage *message, gpointer data ) - */ -gboolean XASnapshotItfAdaptation_SnapshotBusCb( GstBus *bus, GstMessage *message, gpointer data ) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)data; - - GstState oldstate = GST_STATE_NULL , newstate = GST_STATE_NULL , pendingstate = GST_STATE_NULL; - - /* only interested in messages from snapshot pipeline */ - if( GST_MESSAGE_SRC(message) == GST_OBJECT(mCtx->snapshotVars.sspipeline) ) - { - DEBUG_API_A2("->XASnapshotItfAdaptation_SnapshotBusCb:\"%s\" from object \"%s\"", - GST_MESSAGE_TYPE_NAME(message), GST_OBJECT_NAME(GST_MESSAGE_SRC(message))); - - switch( GST_MESSAGE_TYPE(message)) - { - case GST_MESSAGE_EOS: - { - if( gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_READY) - == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("Error stopping snapshot pipeline!!!"); - } - gst_element_get_state(mCtx->snapshotVars.sspipeline, NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - - DEBUG_INFO_A2("Requested %lu snapshots, taked %lu",mCtx->snapshotVars.numpics,mCtx->snapshotVars.numpicstaken+1); - if( ++mCtx->snapshotVars.numpicstaken >= mCtx->snapshotVars.numpics ) - { - XAAdaptEvent takenevent = {XA_SNAPSHOTITFEVENTS, XA_ADAPT_SNAPSHOT_TAKEN, 0, NULL }; - DEBUG_INFO("Snapshot burst finished"); - XASnapshotItfAdaptation_StopSnapshotting(&(mCtx->baseObj)); - if( mCtx->snapshotVars.fnametemplate == NULL ) - { /* non-datasink snapshot, return buffer */ - GstBuffer* pullBuffer = NULL; - XADataSink* pullSink = NULL; - XADataLocator_Address* pullSinkLoc = NULL; - DEBUG_INFO("Get buffer from appsink"); - pullBuffer = gst_app_sink_pull_preroll( GST_APP_SINK(mCtx->snapshotVars.sssink) ); - /* allocate XADataSink, client should release this later*/ - pullSink = (XADataSink*)calloc(1, sizeof(XADataSink)); - pullSinkLoc = (XADataLocator_Address*)calloc(1, sizeof(XADataLocator_Address)); - pullSinkLoc->length = pullBuffer->size; - pullSinkLoc->pAddress = (XADataLocator_Address*)calloc(1, pullBuffer->size); - memcpy(pullSinkLoc->pAddress, pullBuffer->data, pullBuffer->size); - pullSinkLoc->locatorType = XA_DATALOCATOR_ADDRESS; - pullSink->pLocator = pullSinkLoc; - pullSink->pFormat = NULL; - takenevent.data = pullSink; - } - /* send needed events */ - takenevent.datasize = mCtx->snapshotVars.numpicstaken; - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj.baseObj), &takenevent ); - } - else - { - /* videoparse element can not handle renegotiation of stream for new buffer - * after EOS, so recreate it */ - gst_element_unlink_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - NULL); - gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.ssparser), GST_STATE_NULL); - gst_bin_remove(GST_BIN (mCtx->snapshotVars.sspipeline),mCtx->snapshotVars.ssparser); - mCtx->snapshotVars.ssparser = gst_element_factory_make("videoparse", "ssparser"); - if( !mCtx->snapshotVars.ssparser ) - { - DEBUG_ERR("Cannot create ssparser!"); - DEBUG_API("<-XASnapshotItfAdaptation_CreateSnapshotPipeline - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - gst_bin_add(GST_BIN (mCtx->snapshotVars.sspipeline),mCtx->snapshotVars.ssparser); - if( !gst_element_link_many( - mCtx->snapshotVars.ssbuffersrc, - mCtx->snapshotVars.ssparser, - mCtx->snapshotVars.ssscaler, - NULL) ) - { - DEBUG_ERR("Could not link pipeline") - return XA_RESULT_INTERNAL_ERROR; - } - mCtx->snapshotVars.parsenegotiated = FALSE; - - /*now, wait for new buffer to arrive*/ - DEBUG_INFO("Wait for more pictures"); - mCtx->snapshotVars.waitforbuffer = TRUE; - mCtx->snapshotVars.sighandler = g_signal_connect(mCtx->videoextract, "handoff", - G_CALLBACK (XASnapshotItfAdaptation_BufferHandoffCb),mCtx); - } - break; - } - case GST_MESSAGE_STATE_CHANGED: - { - gst_message_parse_state_changed(message, &oldstate, &newstate, &pendingstate); - DEBUG_INFO_A4("old %s -> new %s ( pending %s, gsttarget %s )", - gst_element_state_get_name(oldstate), - gst_element_state_get_name(newstate), - gst_element_state_get_name(pendingstate), - gst_element_state_get_name(GST_STATE_TARGET(mCtx->snapshotVars.sspipeline)) ); - if( newstate==GST_STATE_READY && oldstate==GST_STATE_NULL ) - { - XAAdaptEvent initevent = {XA_SNAPSHOTITFEVENTS, XA_ADAPT_SNAPSHOT_INITIATED,0, NULL }; - DEBUG_INFO("Init complete"); - /* send needed events */ - XAAdaptationBase_SendAdaptEvents( &(mCtx->baseObj.baseObj), &initevent); - } - else if( newstate==GST_STATE_PLAYING && oldstate==GST_STATE_PAUSED && mCtx->snapshotVars.snapshotbuffer ) - { - DEBUG_INFO("Pushing buffer"); - gst_app_src_push_buffer( GST_APP_SRC(mCtx->snapshotVars.ssbuffersrc), - mCtx->snapshotVars.snapshotbuffer ); - DEBUG_INFO_A1("Sent buffer at 0x%x to ssbuffersrc", (int)mCtx->snapshotVars.snapshotbuffer ); - gst_app_src_end_of_stream( GST_APP_SRC(mCtx->snapshotVars.ssbuffersrc) ); - mCtx->snapshotVars.snapshotbuffer = NULL; - DEBUG_INFO("Sent EOS ssbuffersrc"); - } - - break; - } - default: - break; - } - DEBUG_API("<-XASnapshotItfAdaptation_SnapshotBusCb"); - } - return TRUE; -} - -/* - * void XASnapshotItfAdaptation_BufferHandoffCb( GstElement *extract, GstBuffer *buffer, gpointer data ) - */ -void XASnapshotItfAdaptation_BufferHandoffCb( GstElement *extract, GstBuffer *buffer, gpointer data ) -{ - XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)data; - gint32 width=0, height=0; - guint32 fourcc=0, formatnum=0; - GstPad* srcPad=NULL; - GstCaps* srcPadCaps=NULL; - GstStructure* capS=NULL; - XAAdaptEvent event = {XA_SNAPSHOTITFEVENTS, XA_ADAPT_SNAPSHOT_TAKEN, 0, NULL }; - char* fname=NULL; - - DEBUG_API("->XASnapshotItfAdaptation_BufferHandoffCb"); - if( !mCtx->snapshotVars.waitforbuffer || - !GST_IS_BUFFER(buffer) ) - { /* pass on... */ - DEBUG_API("<-XASnapshotItfAdaptation_BufferHandoffCb"); - return; - } - - if(mCtx->snapshotVars.snapshotbuffer) - { - DEBUG_INFO("WARNING: snapshotbuffer already exists!!"); - gst_buffer_unref(GST_BUFFER(mCtx->snapshotVars.snapshotbuffer)); - } - DEBUG_INFO("Receiced snapshotbuffer"); - mCtx->snapshotVars.snapshotbuffer = gst_buffer_copy(buffer); - mCtx->snapshotVars.waitforbuffer = FALSE; - g_signal_handler_disconnect(mCtx->videoextract,mCtx->snapshotVars.sighandler); - mCtx->snapshotVars.sighandler = 0; - - if( GST_STATE(mCtx->snapshotVars.sspipeline)==GST_STATE_READY ) - { - if( !(mCtx->snapshotVars.parsenegotiated) ) - { - /*read relevant caps of extraction source and set them to videoparse*/ - srcPad = gst_element_get_pad( GST_ELEMENT(extract), "src"); - srcPadCaps = gst_pad_get_negotiated_caps( GST_PAD(srcPad) ); - capS = gst_caps_get_structure(srcPadCaps,0); - DEBUG_INFO_A1("buffer caps from extraction source: %s",gst_caps_to_string(srcPadCaps)); - if( !gst_structure_get_int(capS,"width",&width) || - !gst_structure_get_int(capS,"height",&height) || - !gst_structure_get_fourcc(capS,"format",&fourcc) ) - { - DEBUG_ERR("ERROR! Missing crucial capabilities for buffer!!"); - DEBUG_API("<-XASnapshotItfAdaptation_BufferHandoffCb"); - return; - } - /* convert fourcc to videoparse enumeration */ - switch(fourcc) - { - case GST_MAKE_FOURCC('I','4','2','0'): - formatnum = 0; - break; - case GST_MAKE_FOURCC('Y','V','1','2'): - formatnum = 1; - break; - case GST_MAKE_FOURCC('Y','U','Y','2'): - formatnum = 2; - break; - case GST_MAKE_FOURCC('U','Y','V','Y'): - formatnum = 3; - break; - case GST_MAKE_FOURCC('R','G','B',' '): - formatnum = 10; - break; - case GST_MAKE_FOURCC('G','R','A','Y'): - formatnum = 11; - break; - default: - formatnum = 0; - break; - } - /* set source width and height for parser */ - g_object_set(mCtx->snapshotVars.ssparser,"width",width,"height",height,"format",formatnum,NULL); - mCtx->snapshotVars.parsenegotiated = TRUE; - } - if(mCtx->snapshotVars.fnametemplate) - { /* get actual filename from template */ - XASnapshotItfAdaptation_AllocNextFilename(&fname, mCtx->snapshotVars.fnametemplate); - DEBUG_INFO_A1("start taking snapshot (%s)", fname); - gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sssink), GST_STATE_NULL); - g_object_set( G_OBJECT(mCtx->snapshotVars.sssink), "location", fname, - "async", FALSE, - "qos", FALSE, - "max-lateness", (gint64)(-1), - NULL ); - gst_element_sync_state_with_parent(mCtx->snapshotVars.sssink); - gst_element_get_state(mCtx->snapshotVars.sssink, NULL, NULL, XA_ADAPT_ASYNC_TIMEOUT_SHORT_NSEC); - free(fname); - } - else - { /* take snapshot to buffer */ - DEBUG_INFO("start taking snapshot (memory buffer used)"); - } - /* write metadata, if any */ - XAMetadataAdapt_TryWriteTags(&(mCtx->baseObj), GST_BIN(mCtx->snapshotVars.sspipeline)); - /* start buffering */ - if( gst_element_set_state(GST_ELEMENT(mCtx->snapshotVars.sspipeline), GST_STATE_PLAYING ) - == GST_STATE_CHANGE_FAILURE ) - { - DEBUG_ERR("Error taking picture!!!"); - /* NOTE: no event for errors in snapshotitf!!! */ - event.datasize = mCtx->snapshotVars.numpicstaken; - XAAdaptationBase_SendAdaptEvents(&(mCtx->baseObj.baseObj), &event ); - } - } - else - { - DEBUG_INFO_A1("warning: sspipeline in wrong state (%d)", - GST_STATE(mCtx->snapshotVars.sspipeline)); - } - DEBUG_API("<-XASnapshotItfAdaptation_BufferHandoffCb"); -} - -/* - * const char* XASnapshotItfAdaptation_GetFileSuffix(XADataFormat_MIME* format) - */ -const char* XASnapshotItfAdaptation_GetFileSuffix(XADataFormat_MIME* format) -{ - const char* ret=NULL; - if( format ) - { - if( *(XAuint32*)format == XA_DATAFORMAT_MIME ) - { - switch (format->containerType) - { - case XA_CONTAINERTYPE_JPG: - ret = "jpg"; - break; - case XA_CONTAINERTYPE_RAW: - ret = "raw"; - break; - case XA_CONTAINERTYPE_BMP: - ret = "bmp"; - break; - default: - break; - } - if(!ret) - { /*parse from mimetype*/ - if(format->mimeType) - { - ret = strrchr((char*)format->mimeType,'/'); - if (ret) - { - ret++; - } - } - } - } - else if( *(XAuint32*)format == XA_DATAFORMAT_RAWIMAGE ) - { - ret = "raw"; - } - } - if(!ret) - { - ret="jpg"; /*default*/ - } - return ret; -} - -/* - * void XASnapshotItfAdaptation_AllocNextFilename(char** fname, const char* template) - */ -void XASnapshotItfAdaptation_AllocNextFilename(char** fname, const char* template) -{ - XAuint32 idx=0; - XAboolean found=XA_BOOLEAN_FALSE; - FILE* file=NULL; - *fname = (char*)calloc(1,strlen(template)+10); - while(!found) - { - sprintf(*fname, template, idx++ ); - strcat(*fname, "\0"); - file = fopen(*fname, "r"); - if(file==NULL) - { - found = XA_BOOLEAN_TRUE; - break; - } - fclose(file); - } -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xasnapshotitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XSNAPSHOTITFADAPTATION_H -#define XSNAPSHOTITFADAPTATION_H - -#include "xaadaptationgst.h" - - -/* DEFINES*/ - -/* MACROS */ - -/* FUNCTIONS */ - -XAresult XASnapshotItfAdaptation_InitiateSnapshot(XAAdaptationGstCtx* ctx, - XAuint32 numberOfPictures, - XAuint32 fps, - XAboolean freezeViewFinder, - XADataSink* sink); - -XAresult XASnapshotItfAdaptation_TakeSnapshot(XAAdaptationGstCtx* ctx); - -XAresult XASnapshotItfAdaptation_CancelSnapshot(XAAdaptationGstCtx* ctx); - -XAresult XASnapshotItfAdaptation_GetMaxPicsPerBurst(XAAdaptationGstCtx* ctx, - XAuint32 *maxNumberOfPictures); - -XAresult XASnapshotItfAdaptation_GetBurstFPSRange(XAAdaptationGstCtx* ctx, - XAuint32 *minFPS, - XAuint32 *maxFPS); - -XAresult XASnapshotItfAdaptation_SetShutterFeedback(XAAdaptationGstCtx* ctx, - XAboolean enabled); -#endif /* XSNAPSHOTITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xastaticcameracapsadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xastaticcameracapsadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,562 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "xaglobals.h" -#include "xastaticcameracapsadaptation.h" -#include "xaadptbasectx.h" - -#define XACAMERAIMPL_DEFAULT_MAX_ZOOM 16000 /* 16x */ -#define XACAMERAIMPL_DEFAULT_MAX_ISO 1600 -#define XACAMERAIMPL_DEFAULT_MIN_ISO 200 -#define XACAMERAIMPL_DEFAULT_MAX_APERTURE 3200 /* f/32 */ -#define XACAMERAIMPL_DEFAULT_MIN_APERTURE 75 /* f/0.75 */ - -static XAStaticCameraCapsData allCameraCaps[] = -{ -#ifdef XA_USE_TEST_PLUGINS - { XA_ADAPTID_VIDEOTESTSRC, { (XAchar*)"videotestsrc", 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -#else - { XA_ADAPTID_V4L2SRC, { (XAchar*)"v4l2src", 0, 0, 0, 0, 0, 0, 0, 0, 0 } } -#endif -}; - -/*forward declaration*/ -XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID); - -/* - * void XAStaticCameraCaps_Init() - */ -void XAStaticCameraCaps_Init() -{ - GstElement* element=NULL; - GstPhotoCaps photoCaps = GST_PHOTOGRAPHY_CAPS_NONE; - GError* gerror=NULL; - guint32 i=0; - guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); - gboolean detected = FALSE; - - - if ( !gst_init_check( NULL, NULL, &gerror ) ) - { - DEBUG_ERR("Gst Initalization failure."); - return; - } - for(i=0;i allCameraCaps[i].XAcaps.maxWidth) - { - allCameraCaps[i].XAcaps.maxWidth = width; - } - } - - value = gst_structure_get_value( capsStruct, "height" ); - if (GST_VALUE_HOLDS_INT_RANGE(value)) - { - detected = TRUE; - height = gst_value_get_int_range_max( value ); - if(height > allCameraCaps[i].XAcaps.maxHeight) - { - allCameraCaps[i].XAcaps.maxHeight = height; - } - } - } - } - } - } - - if(!detected) - { - DEBUG_ERR("Warn: could not get maxWidth and maxHeight from GST!!"); - allCameraCaps[i].XAcaps.maxWidth = 0x7FFFFFFF; - allCameraCaps[i].XAcaps.maxHeight = 0x7FFFFFFF; - } - - if(GST_IS_PHOTOGRAPHY(element)) - { - photoCaps = gst_photography_get_capabilities(GST_PHOTOGRAPHY(element)); - if( photoCaps & GST_PHOTOGRAPHY_CAPS_FLASH ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_FLASH; - allCameraCaps[i].XAcaps.flashModesSupported = XA_CAMERA_FLASHMODE_OFF | - XA_CAMERA_FLASHMODE_ON | - XA_CAMERA_FLASHMODE_AUTO | - XA_CAMERA_FLASHMODE_REDEYEREDUCTION | - XA_CAMERA_FLASHMODE_FILLIN; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_FOCUS ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_AUTOFOCUS; - allCameraCaps[i].XAcaps.focusModesSupported = XA_CAMERA_FOCUSMODE_AUTO; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_EXPOSURE ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALEXPOSURE; - allCameraCaps[i].XAcaps.exposureModesSupported = XA_CAMERA_EXPOSUREMODE_AUTO | - XA_CAMERA_EXPOSUREMODE_PORTRAIT | - XA_CAMERA_EXPOSUREMODE_SPORTS | - XA_CAMERA_EXPOSUREMODE_NIGHT; - } - - if( photoCaps & GST_PHOTOGRAPHY_CAPS_ISO_SPEED ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALISOSENSITIVITY; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_APERTURE ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_MANUALAPERTURE; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_WB_MODE ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_AUTOWHITEBALANCE; - allCameraCaps[i].XAcaps.whiteBalanceModesSupported = XA_CAMERA_WHITEBALANCEMODE_AUTO | - XA_CAMERA_WHITEBALANCEMODE_SUNLIGHT | - XA_CAMERA_WHITEBALANCEMODE_CLOUDY | - XA_CAMERA_WHITEBALANCEMODE_TUNGSTEN | - XA_CAMERA_WHITEBALANCEMODE_FLUORESCENT | - XA_CAMERA_WHITEBALANCEMODE_SUNSET; - } - if( photoCaps & GST_PHOTOGRAPHY_CAPS_ZOOM ) - { - allCameraCaps[i].XAcaps.featuresSupported |= XA_CAMERACAP_DIGITALZOOM; - } - } - } - } -} - -/* - * XAresult XAStaticCameraCaps_GetCameraCapabilities( - * XAuint32* pIndex, - * XAuint32* pCameraDeviceID, - * XACameraDescriptor* pDescriptor) - * - */ -XAresult XAStaticCameraCaps_GetCameraCapabilities( - XAuint32* pIndex, - XAuint32* pCameraDeviceID, - XACameraDescriptor* pDescriptor) -{ - guint32 idx = 0; - guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); - - if(!pDescriptor) - { - if(pIndex) /* query number of devices */ - { - *pIndex = numDevices; - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - } - - if( !pIndex && pCameraDeviceID ) - { - /* get index from ID */ - idx = XAStaticCameraCaps_IdxFromId(*pCameraDeviceID); - } - else if( pIndex && pCameraDeviceID ) - { - idx = *pIndex; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - - if( idx >= numDevices ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - /*fill capabilities*/ - memcpy(pDescriptor, &allCameraCaps[idx].XAcaps, sizeof(XACameraDescriptor) ); - *pCameraDeviceID = allCameraCaps[idx].deviceID; - } - - DEBUG_API("<-XAStaticCameraCaps_GetCameraCapabilities"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_QueryFocusRegionPatterns( - * XAuint32 cameraDeviceID, - * XAuint32* pPatternID, - * XAuint32* pFocusPattern, - * XAuint32* pCustomPoints1, - * XAuint32* pCustomPoints2) - */ -XAresult XAStaticCameraCaps_QueryFocusRegionPatterns( - XAuint32 cameraDeviceID, - XAuint32* pPatternID, - XAuint32* pFocusPattern, - XAuint32* pCustomPoints1, - XAuint32* pCustomPoints2) -{ - DEBUG_API("->XAStaticCameraCaps_QueryFocusRegionPatterns"); - if( !pFocusPattern ) - { /* return number of focus patterns */ - if(!pPatternID) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - /* no support in GST */ - DEBUG_INFO("No support in gst"); - *pPatternID = 0; - } - else - { - if( !(pFocusPattern&&pCustomPoints1&&pCustomPoints2) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - DEBUG_INFO("No support in gst"); - *pFocusPattern = 0; - *pCustomPoints1 = 0; - *pCustomPoints2 = 0; - /*no focus patterns, index always out of range*/ - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XAStaticCameraCaps_QueryFocusRegionPatterns"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedAutoLocks( - * XAuint32 cameraDeviceID, - * XAuint32* pNumCombinations, - * XAuint32** ppLocks) - */ -XAresult XAStaticCameraCaps_GetSupportedAutoLocks( - XAuint32 cameraDeviceID, - XAuint32* pNumCombinations, - XAuint32** ppLocks) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedAutoLocks"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumCombinations) - { - *pNumCombinations = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedAutoLocks"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedFocusManualSettings( - * XAuint32 cameraDeviceID, - * XAboolean macroEnabled, - * XAmillimeter* pMinValue, - * XAmillimeter* pMaxValue, - * XAuint32* pNumSettings, - * XAmillimeter** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedFocusManualSettings( - XAuint32 cameraDeviceID, - XAboolean macroEnabled, - XAmillimeter* pMinValue, - XAmillimeter* pMaxValue, - XAuint32* pNumSettings, - XAmillimeter** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedFocusManualSettings"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumSettings) - { - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedFocusManualSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedISOSensitivitySettings( - * XAuint32 cameraDeviceID, - * XAuint32* pMinValue, - * XAuint32* pMaxValue, - * XAuint32* pNumSettings, - * XAuint32** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedISOSensitivitySettings( - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); - if( !pNumSettings ) - { - return XA_RESULT_PARAMETER_INVALID; - } - if( !ppSettings ) - { - /* no items in ppSettings array*/ - *pNumSettings = 0; - } - else - { - if( !(pMinValue && pMaxValue) ) - { - DEBUG_API("<-XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); - return XA_RESULT_PARAMETER_INVALID; - } - /* continuous range */ - *pNumSettings = 0; - /* NOTE: no way to query actual values from gstreamer, use hardcoded default values */ - *pMinValue = XACAMERAIMPL_DEFAULT_MIN_ISO; - *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_ISO; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedISOSensitivitySettings"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedApertureManualSettings( - * XAuint32 cameraDeviceID, - * XAuint32* pMinValue, - * XAuint32* pMaxValue, - * XAuint32* pNumSettings, - * XAuint32** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedApertureManualSettings( - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedApertureManualSettings"); - if( !pNumSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetSupportedApertureManualSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - if( !ppSettings ) - { - /* no items in ppSettings array*/ - *pNumSettings = 0; - } - else - { - /* continuous range */ - *pNumSettings = 0; - /* NOTE: no way to query actual values from gstreamer, use hardcoded default values */ - *pMinValue = XACAMERAIMPL_DEFAULT_MIN_APERTURE; - *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_APERTURE; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedApertureManualSettings"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( - * XAuint32 cameraDeviceID, - * XAmicrosecond* pMinValue, - * XAmicrosecond* pMaxValue, - * XAuint32* pNumSettings, - * XAmicrosecond** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings( - XAuint32 cameraDeviceID, - XAmicrosecond* pMinValue, - XAmicrosecond* pMaxValue, - XAuint32* pNumSettings, - XAmicrosecond** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumSettings) - { - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedShutterSpeedManualSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( - * XAuint32 cameraDeviceID, - * XAuint32* pMinValue, - * XAuint32* pMaxValue, - * XAuint32* pNumSettings, - * XAuint32** ppSettings) - */ -XAresult XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings( - XAuint32 cameraDeviceID, - XAuint32* pMinValue, - XAuint32* pMaxValue, - XAuint32* pNumSettings, - XAuint32** ppSettings) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings"); - /* No support in gst. - * Spec: "If no settings are supported, - * this method returns XA_RESULT_FEATURE_UNSUPPORTED." - **/ - DEBUG_INFO("No support in gst"); - if(pNumSettings) - { - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedWhiteBalanceManualSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; -} - -/* - * XAresult XAStaticCameraCaps_GetSupportedZoomSettings( - * XAuint32 cameraDeviceID, - * XAboolean digitalEnabled, - * XAboolean macroEnabled, - * XApermille* pMaxValue, - * XAuint32* pNumSettings, - * XApermille** ppSettings, - * XAboolean* pSpeedSupported) - */ -XAresult XAStaticCameraCaps_GetSupportedZoomSettings( - XAuint32 cameraDeviceID, - XAboolean digitalEnabled, - XAboolean macroEnabled, - XApermille* pMaxValue, - XAuint32* pNumSettings, - XApermille** ppSettings, - XAboolean* pSpeedSupported) -{ - DEBUG_API("->XAStaticCameraCaps_GetSupportedZoomSettings"); - if( !ppSettings ) - { - if( !pNumSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - *pNumSettings = 0; - } - else - { - if( !(pMaxValue && pSpeedSupported) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - /*NOTE: no way to query actual max value*/ - *pMaxValue = XACAMERAIMPL_DEFAULT_MAX_ZOOM; - /*no gst support for speed settings*/ - *pSpeedSupported = XA_BOOLEAN_FALSE; - *pNumSettings = 0; - } - DEBUG_API("<-XAStaticCameraCaps_GetSupportedZoomSettings"); - return XA_RESULT_SUCCESS; -} - -/* - * XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID) - */ -XAuint32 XAStaticCameraCaps_IdxFromId(XAuint32 cameraDeviceID) -{ - XAuint32 devId = 0; - XAuint32 idx = 0; - guint32 numDevices = sizeof(allCameraCaps)/sizeof(XAStaticCameraCapsData); - - if(cameraDeviceID == XA_DEFAULTDEVICEID_CAMERA) - { - devId = XACAMERAIMPL_DEFAULT_DEVICE; - } - else - { - devId = cameraDeviceID; - } - - /* query capas with id -> find index*/ - for(idx=0; idxXAStreamInformationItfAdapt_QueryMediaContainerInformation"); - /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) -/* !((adaptCtx->ctxId == XAMediaPlayerAdaptation) || - (adaptCtx->ctxId == XAMDAdaptation) ) ) -*/ - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId ); - - /* Initialize to unspecified */ - *containerType = XA_CONTAINERTYPE_UNSPECIFIED; - xaDataSource = ((XAMediaPlayerAdaptationCtx*) adaptCtx)->xaSource; -/* DEBUG_INFO("Obtained handle to xaDataSource");*/ - if ( xaDataSource && - xaDataSource->pFormat && - ( (*(XAuint32*)xaDataSource->pFormat ) == XA_DATAFORMAT_MIME) ) - { - *containerType = ((XADataFormat_MIME*)(xaDataSource->pFormat))->containerType; - DEBUG_INFO_A1("Container type obtained from xaDataSource->pFormat is [%u]", (unsigned int)(*containerType)); - } - else - { - DEBUG_INFO("Container type unspecified"); - } - - /* Get media duration */ - ret = XAPlayItfAdaptGST_GetDuration((XAAdaptationGstCtx*)adaptCtx, mediaDuration); - if ( ret != XA_RESULT_SUCCESS ) - return ret; - - /* Determine number of streams */ - codecbin = ((XAMediaPlayerAdaptationCtx*) adaptCtx)->codecbin; - if ( codecbin == NULL ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-numsrcpads; - - DEBUG_API("-XAStreamInformationItfAdapt_QueryStreamType"); - - ret = XAStreamInformationItfAdapt_QueryMediaContainerInformation( - adaptCtx, &containerType, &mediaDuration, &numStreams); - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); - DEBUG_API("- numStreams ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-xaSource; - if( xaDataSource->pFormat && - ( (*(XAuint32*)xaDataSource->pFormat ) == XA_DATAFORMAT_RAWIMAGE) ) - { - *domain = XA_DOMAINTYPE_IMAGE; - return XA_RESULT_SUCCESS; - } - else - { - GstElement *codecbin = ((XAMediaPlayerAdaptationCtx*) adaptCtx)->codecbin; - if ( codecbin == NULL ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-srcpads, - containerType, - streamIndex, - domain); - GST_OBJECT_UNLOCK( codecbin ); - } - - DEBUG_API("-XAStreamInformationItfAdapt_QueryStreamInformation"); - - /* stream index is validated in XAStreamInformationItfAdapt_QueryStreamType */ - ret = XAStreamInformationItfAdapt_QueryStreamType( - adaptCtx, streamIndex, &domain); - - if (ret != XA_RESULT_SUCCESS) - { - DEBUG_ERR_A1("XA_RESULT_[0x%x]", (unsigned int)ret); - DEBUG_API("-codecbin; - if ( codecbin == NULL ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-srcpads, (streamIndex -1 )); - DEBUG_INFO_A1("Obtaining SrcPad%u from Decode bin", (unsigned int)(streamIndex-1)); - if (srcPad == NULL) - { - GST_OBJECT_UNLOCK( codecbin ); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-codecId = codecId; - streamInfo->channels = channels; - streamInfo->sampleRate = sampleRate; - streamInfo->bitRate = bitRate; - streamInfo->langCountry[0] = '\0'; - streamInfo->duration = duration; - } - break; - case XA_DOMAINTYPE_MIDI: - { - XAMIDIStreamInformation* streamInfo = (XAMIDIStreamInformation*)info; - DEBUG_INFO("Assigning values for XAMIDIStreamInformation"); - /*currently there is no way to get these information from gstreamer*/ - streamInfo->channels = XA_MIDI_UNKNOWN; - streamInfo->tracks = XA_MIDI_UNKNOWN; - streamInfo->bankType = XA_MIDIBANK_DEVICE; - /*streamInfo->bitRate = 0;*/ - streamInfo->langCountry[0] = '\0'; - streamInfo->duration = duration; - } - break; - case XA_DOMAINTYPE_VIDEO: - { - XAVideoStreamInformation* streamInfo = (XAVideoStreamInformation*)info; - DEBUG_INFO("Assigning values for XAVideoStreamInformation"); - streamInfo->codecId = codecId; - streamInfo->width = width; - streamInfo->height = height; - streamInfo->bitRate = bitRate; - streamInfo->duration = duration; - } - break; - case XA_DOMAINTYPE_IMAGE: - { - XAImageStreamInformation* streamInfo = (XAImageStreamInformation*)info; - DEBUG_INFO("Assigning values for XAImageStreamInformation"); - streamInfo->codecId = codecId; - streamInfo->width = width; - streamInfo->height = height; - streamInfo->presentationDuration = duration; - } - break; - default: - break; - }; - } /*if ( ret == XA_RESULT_SUCCESS)*/ - - DEBUG_API("-XAStreamInformationItfAdapt_QueryStreamName"); - /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-codecbin; - if ( codecbin == NULL ) - { - DEBUG_INFO("Unable to get codec bin"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-numsrcpads; - - /* validate stream index */ - if ( streamIndex > numStreams ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-XAStreamInformationItfAdapt_QueryActiveStreams"); - - /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId == XAMDAdaptation) - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("-codecbin; - if ( codecbin == NULL ) - { - DEBUG_INFO("Unable to get codec bin"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-numsrcpads; - - if ( activeStreams ) - { - XAuint32 loopIndex; - if (inputNumStreams < *numStreams ) - { - DEBUG_INFO("numStreams param value is smaller than number of streams"); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-XAStreamInformationItfAdapt_QueryActiveStreams"); - return XA_RESULT_SUCCESS; -} - -XAresult XAStreamInformationItfAdapt_SetActiveStream( - XAAdaptationBaseCtx *adaptCtx, - XAuint32 streamNum, - XAboolean active, - XAboolean commitNow) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAuint32 numStreams; - GstElement *codecbin; - - DEBUG_API("->XAStreamInformationItfAdapt_SetActiveStream"); - - /* Both Media Player and Metadata Extractor objec uses the same ctxId */ - if( !adaptCtx || - (adaptCtx->ctxId != XAMediaPlayerAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-ctxId == XAMDAdaptation) - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("-codecbin; - if ( codecbin == NULL ) - { - DEBUG_INFO("Unable to get codec bin"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-numsrcpads; - - /* validate stream index */ - if ( streamNum > numStreams ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("-XAStreamInformationItfAdapt_SetActiveStream"); - return ret; -} - -/* local functions */ - -XAresult GetDomainTypeFromCodecBinSrcPads( - GList *sourcePads, - XAuint32 containerType, - XAuint32 streamIndex, - XAuint32 *domain) -{ - GstPad* srcPad; - GstCaps* negotiatedCaps; - const GstStructure* gstStruct; - const gchar *mime; - - DEBUG_API("->GetDomainTypeFromCodecBinSrcPads"); - - - srcPad = (GstPad*) g_list_nth_data(sourcePads, (streamIndex -1 )); - if (srcPad == NULL) - { - DEBUG_INFO_A1("Error obtaining SrcPad%u", (unsigned int)streamIndex); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-GetAudioStreamInfoFromPads"); - - negotiatedCaps = gst_pad_get_negotiated_caps(srcPad); - if ( negotiatedCaps == NULL ) - { - DEBUG_INFO("Obtaining allowed caps from SrcPad."); - negotiatedCaps = gst_pad_get_allowed_caps (srcPad); - } - - if ( negotiatedCaps == NULL ) - { - DEBUG_INFO("Unable to obtain negotiated and allowed caps from SrcPad"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-GetVideoStreamInfoFromPads"); - - negotiatedCaps = gst_pad_get_negotiated_caps(srcPad); - if ( negotiatedCaps == NULL ) - { - DEBUG_INFO("Obtaining allowed caps from SrcPad."); - negotiatedCaps = gst_pad_get_allowed_caps (srcPad); - } - - if ( negotiatedCaps == NULL ) - { - DEBUG_INFO("Unable to obtain negotiated and allowed caps from SrcPad"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("-GetImageStreamInfoFromPads"); - - negotiatedCaps = gst_pad_get_negotiated_caps(srcPad); - if ( negotiatedCaps == NULL ) - { - DEBUG_INFO("Obtaining allowed caps from SrcPad."); - negotiatedCaps = gst_pad_get_allowed_caps (srcPad); - } - - if ( negotiatedCaps == NULL ) - { - DEBUG_INFO("Unable to obtain negotiated and allowed caps from SrcPad"); - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("- -#include "xavibraadaptctx.h" -#include "xaadaptationgst.h" - -/* - * XAAdaptationGstCtx* XAVibraAdapt_Create() - * Allocates memory for Vibra Adaptation Context and makes 1st phase initialization - * @returns XAVibraAdaptationCtx* - Pointer to created context - */ -XAAdaptationBaseCtx* XAVibraAdapt_Create(XAuint32 deviceID) -{ - XAVibraAdaptationCtx *pSelf = (XAVibraAdaptationCtx*)calloc(1, sizeof(XAVibraAdaptationCtx)); - DEBUG_API("->XAVibraAdapt_Create"); - if ( pSelf) - { - if( XAAdaptationBase_Init(&(pSelf->baseObj.baseObj),XAVibraAdaptation) - != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Failed to init base context!!!"); - free(pSelf); - pSelf = NULL; - } - } - - DEBUG_API("<-XAVibraAdapt_Create"); - return (XAAdaptationBaseCtx*)&pSelf->baseObj; -} - -/* - * XAresult XAVibraAdapt_PostInit() - * 2nd phase initialization of Vibra Adaptation Context - */ -XAresult XAVibraAdapt_PostInit(XAAdaptationBaseCtx* bCtx) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraAdaptationCtx* ctx = NULL; - - DEBUG_API("->XAVibraAdapt_PostInit"); - if(bCtx == NULL || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraAdapt_PostInit"); - return XA_RESULT_PARAMETER_INVALID; - } - ctx = (XAVibraAdaptationCtx*)bCtx; - - XAAdaptationBase_PostInit( &(ctx->baseObj.baseObj) ); - - DEBUG_API("<-XAVibraAdapt_PostInit"); - return ret; -} - -/* - * void XAVibraAdapt_Destroy(XAVibraAdaptationCtx* ctx) - * Destroys Vibra Adaptation Context - * @param ctx - Vibra Adaptation context to be destroyed - */ -void XAVibraAdapt_Destroy(XAAdaptationBaseCtx* bCtx) -{ - XAVibraAdaptationCtx* ctx = NULL; - DEBUG_API("->XAVibraAdapt_Destroy"); - - if(bCtx == NULL || bCtx->ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraAdapt_Destroy"); - return; - } - ctx = (XAVibraAdaptationCtx*)bCtx; - XAAdaptationBase_Free(&(ctx->baseObj.baseObj)); - - free(ctx); - ctx = NULL; - - DEBUG_API("<-XAVibraAdapt_Destroy"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavibraadaptctx.h --- a/khronosfws/openmax_al/src/gst_adaptation/xavibraadaptctx.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIBRAADAPTCTX_H -#define XAVIBRAADAPTCTX_H - -#include "xaadaptationgst.h" - -/* TYPEDEFS */ - -typedef struct XAVibraAdaptationCtx_ XAVibraAdaptationCtx; - -/* - * Structure for Vibra specific gst-adaptation variables - */ -typedef struct XAVibraAdaptationCtx_ { - - /* Parent*/ - XAAdaptationGstCtx_ baseObj; - - /* OMX-AL Variables */ - XAuint32 deviceID; - - /* GST Variables */ -} XAVibraAdaptationCtx_; - -/* FUNCTIONS */ -XAAdaptationBaseCtx* XAVibraAdapt_Create(XAuint32 deviceID); - -XAresult XAVibraAdapt_PostInit(XAAdaptationBaseCtx* bCtx); -void XAVibraAdapt_Destroy(XAAdaptationBaseCtx* bCtx); - -#endif /* XAVIBRAADAPTCTX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavibraitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xavibraitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "xavibraadaptctx.h" -#include "xavibraitfadaptation.h" -#include "xaadaptationgst.h" - -/* - * XAresult XAVibraItfAdapt_Vibrate( XAAdaptationGstCtx *bCtx, XAboolean vibrate ); - */ -XAresult XAVibraItfAdapt_Vibrate( XAAdaptationGstCtx *bCtx, XAboolean vibrate ) -{ - XAresult ret = XA_RESULT_SUCCESS; - if(vibrate) - { - DEBUG_API("->XAVibraItfAdapt_Vibrate: ON"); - } - else - DEBUG_API("->XAVibraItfAdapt_Vibrate: OFF"); - - - if(!bCtx || bCtx->baseObj.ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfAdapt_Vibrate"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XAVibraItfAdapt_Vibrate"); - - return ret; -} -/* - * XAresult XAVibraItfAdapt_SetFrequency ( XAAdaptationGstCtx *bCtx, XAmilliHertz frequency ); - */ -XAresult XAVibraItfAdapt_SetFrequency ( XAAdaptationGstCtx *bCtx, XAmilliHertz frequency ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API_A1("->XAVibraItfAdapt_SetFrequency %ld", frequency); - - if(!bCtx || bCtx->baseObj.ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfAdapt_SetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XAVibraItfAdapt_SetFrequency"); - return ret; -} -/* - * XAresult XAVibraItfAdapt_SetIntensity ( XAAdaptationGstCtx *bCtx, XApermille intensity ); - */ -XAresult XAVibraItfAdapt_SetIntensity ( XAAdaptationGstCtx *bCtx, XApermille intensity ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API_A1("->XAVibraItfAdapt_SetIntensity %d", intensity); - - if(!bCtx || bCtx->baseObj.ctxId != XAVibraAdaptation ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfAdapt_SetIntensity"); - return XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_INFO("No support > stubbed."); - DEBUG_API("<-XAVibraItfAdapt_SetIntensity"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavibraitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xavibraitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVibraItfADAPTATION_H_ -#define XAVibraItfADAPTATION_H_ - -#include "xaadaptationgst.h" - -/* FUNCTIONS */ -XAresult XAVibraItfAdapt_Vibrate( XAAdaptationGstCtx *bCtx, XAboolean vibrate ); -XAresult XAVibraItfAdapt_SetFrequency ( XAAdaptationGstCtx *bCtx, XAmilliHertz frequency ); -XAresult XAVibraItfAdapt_SetIntensity ( XAAdaptationGstCtx *bCtx, XApermille intensity ); -#endif /* XAVIBRAITFADAPTATION_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include "xamediarecorderadaptctx.h" -#include "xavideoencoderitfadaptation.h" -#include "xaadaptationgst.h" - - -/* - * XAresult XAVideoEncoderITfAdapt_SetVideoSettings( XAAdaptationGstCtx *bCtx, - * XAVideoSettings *pSettings ) - * @param XAAdaptationGstCtx *ctx - pointer to Media Recorer adaptation context - * @param XAVideoSettings *pSettings - Settings for encoder - * @return XAresult ret - return success value - * Description: Sets preferred encoder settings for pipeline. - */ -XAresult XAVideoEncoderItfAdapt_SetVideoSettings( XAAdaptationGstCtx *bCtx, - XAVideoSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVideoEncoderAdapt_SetVideoSettings"); - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoEncoderAdapt_SetVideoSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - - ret = XAMediaRecorderAdapt_CheckCodec(mCtx,XACAP_VIDEO,pSettings->encoderId); - if(ret==XA_RESULT_SUCCESS) - { - /*change of settings - pipeline must be regenerated**/ - mCtx->encodingchanged = XA_BOOLEAN_TRUE; - memcpy(&mCtx->videoEncSettings, pSettings, sizeof(XAVideoSettings)); - } - DEBUG_API("<-XAVideoEncoderAdapt_SetVideoSettings"); - return ret; -} - -/* - * XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationGstCtx *bCtx, XAVideoSettings *pSettings ) - */ -XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationGstCtx *bCtx, - XAVideoSettings *pSettings ) -{ - XAMediaRecorderAdaptationCtx* mCtx = NULL; - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVideoEncoderItfAdapt_GetVideoSettings"); - - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoEncoderItfAdapt_GetVideoSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - mCtx = (XAMediaRecorderAdaptationCtx*) bCtx; - memcpy(pSettings, &(mCtx->videoEncSettings), sizeof(XAVideoSettings)); - DEBUG_API("<-XAVideoEncoderItfAdapt_GetVideoSettings"); - return ret; -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xavideoencoderitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOENCODERITFADAPTATION_H -#define XAVIDEOENCODERITFADAPTATION_H - -#include "xaadaptationgst.h" - - -/* FUNCTIONS */ -XAresult XAVideoEncoderItfAdapt_SetVideoSettings(XAAdaptationGstCtx *bCtx, - XAVideoSettings *pSettings ); -XAresult XAVideoEncoderItfAdapt_GetVideoSettings( XAAdaptationGstCtx *bCtx, - XAVideoSettings *pSettings ); -#endif /* XAVIDEOENCODERITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,863 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xaadaptationgst.h" -#include "xamediaplayeradaptctx.h" -#include "xamediarecorderadaptctx.h" -#include "xacameraadaptctx.h" -#include "xavideopostprosessingitfadaptation.h" -#include "xastaticcameracapsadaptation.h" - -/* - * XAresult XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported(XAAdaptationGstCtx *bCtx, - * XAboolean *pSupported) - */ -XAresult XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported(XAAdaptationGstCtx *bCtx, - XAboolean *pSupported) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported"); - - if(!bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation) || !pSupported) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* This feature is not supported, return boolean false */ - *pSupported = XA_BOOLEAN_FALSE; - - DEBUG_API("<-XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported"); - return ret; -} - -/* - * XAresult XAVideoPostProcessingItfAdapt_Commit(XAAdaptationGstCtx *bCtx) - */ -XAresult XAVideoPostProcessingItfAdapt_Commit(XAAdaptationGstCtx *bCtx, - XAmillidegree rotation, - XAuint32 scaleOptions, - XAuint32 backgroundColor, - XAuint32 renderingHints, - const XARectangle *pSrcRect, - const XARectangle *pDestRect, - XAuint32 mirror, - XAboolean isMirror, - XAboolean isRotate, - XAboolean isDestRect, - XAboolean isSrcRect, - XAboolean isScaleOptions - ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAmillidegree tempRotation = 0; - XAmillidegree newRotation = 0; - XAuint32 tempMirror = XA_VIDEOMIRROR_NONE; - XAuint32 newMirror = XA_VIDEOMIRROR_NONE; - XADataSource *dataSrc = NULL; - GstElement *cropElement = NULL; - GstElement *rotateElement = NULL; - GstElement *mirrorElement = NULL; - GstElement *boxElement = NULL; -/* - GstElement *balanceElement = NULL; - GstElement *gammaElement = NULL; -*/ - GstElement *sink = NULL; - GstElement *col1 = NULL; - GstElement *scale = NULL; -/* - gdouble alphaValue = 1; - gint videoBackgroundColor = 0; -*/ - gint cropscaleRight = 0, cropscaleBottom = 0, - cropscaleLeft = 0, - cropscaleTop = 0, - videoscaleHeight = 0; - GstStateChangeReturn gstRet = GST_STATE_CHANGE_SUCCESS; - GstState gstOrigState = GST_STATE_PLAYING; - GstState gstTmpState = GST_STATE_PLAYING; - - DEBUG_API("->XAVideoPostProcessingItfAdapt_Commit"); - - if( !bCtx || (bCtx->baseObj.ctxId != XAMediaPlayerAdaptation && bCtx->baseObj.ctxId != XAMediaRecorderAdaptation - && bCtx->baseObj.ctxId != XACameraAdaptation)) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return XA_RESULT_PARAMETER_INVALID; - } - - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - - - /* Get video pp elements */ - GstPad *pad = NULL; - GstCaps *caps = NULL; - col1 = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_colsp1"); - cropElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_crop"); - rotateElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_rotate"); - mirrorElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_mirror"); - boxElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_box"); -/* - balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma"); -*/ - sink = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videosink"); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - - /* get current mirror state and rotate value */ - tempMirror = ctx->curMirror; - tempRotation = ctx->curRotation; - dataSrc = ctx->xaSource; - } - - if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - - /* Get video pp elements */ - GstPad *pad = NULL; - GstCaps *caps = NULL; - scale = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_scale2"); - col1 = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_colsp1"); - cropElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_crop"); - rotateElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_rotate"); - mirrorElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_mirror"); - boxElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_box"); -/* balanceElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_balance"); - gammaElement = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_gamma");*/ - sink = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "datasink"); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - - /* get current mirror state and rotate value */ - tempMirror = ctx->curMirror; - tempRotation = ctx->curRotation; - } - - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - - GstElement *videoPP = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "videopp_camera"); - if( !videoPP ) - { - DEBUG_ERR("Could not receive videopp from camerabin!"); - } - else - { - /* Get camera pp elements */ - GstPad *pad = NULL; - GstCaps *caps = NULL; - rotateElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_rotate"); - col1 = gst_bin_get_by_name( GST_BIN(videoPP), "pp_colsp1"); - cropElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_crop"); - mirrorElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_mirror"); - boxElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_box"); -/* balanceElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_balance"); - gammaElement = gst_bin_get_by_name( GST_BIN(videoPP), "pp_gamma");*/ - sink = gst_bin_get_by_name( GST_BIN(ctx->baseObj.bin), "pp_crop"); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - caps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT,0, - "height", G_TYPE_INT,0, - NULL); - gst_pad_set_caps(pad, caps); - - /* get current mirror state and rotate value */ - tempMirror = ctx->curMirror; - tempRotation = ctx->curRotation; - } - } - - /* Cropping */ - if( isSrcRect && pSrcRect && cropElement && col1 ) - { - - gint cropRight = 0; - gint cropBottom = 0; - gint cropLeft = 0; - gint cropTop = 0; - GstPad *videoPad = NULL; - gint videoWidth = 0; - gint videoHeight = 0; - DEBUG_INFO("Start cropping!"); - - DEBUG_INFO_A1("pSrcRect->left:%d",(int)pSrcRect->left); - DEBUG_INFO_A1("pSrcRect->top:%d",(int)pSrcRect->top); - DEBUG_INFO_A1("pSrcRect->width:%d",(int)pSrcRect->width); - DEBUG_INFO_A1("pSrcRect->height:%d", (int)pSrcRect->height); - - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - GstCaps *caps = NULL; - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - gint capsCount = 0; - gint iterator = 0; - GstStructure *capsStruct = NULL; - - g_object_get( G_OBJECT(ctx->baseObj.bin), "filter-caps", &caps, NULL ); - - if( !caps ) - { - DEBUG_ERR("Cannot receive caps (filter-caps) from camerabin!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - - capsCount = gst_caps_get_size( caps ); - - for( iterator= 0; iterator < capsCount; iterator++ ) - { - capsStruct = gst_caps_get_structure( caps, iterator ); - if( capsStruct ) - { - if( !gst_structure_get_int( capsStruct, "width", &videoWidth ) ) - { - DEBUG_ERR("Could not get width from filter-caps"); - videoWidth = TEST_VIDEO_WIDTH; - } - if( !gst_structure_get_int( capsStruct, "height", &videoHeight) ) - { - DEBUG_ERR("Could not get height from filter-caps"); - videoHeight = TEST_VIDEO_HEIGHT; - } - DEBUG_INFO_A2("videoWidth:%d, videoHeight:%d",videoWidth,videoHeight); - } - } - } - else - { - GstCaps* negcapas=NULL; - videoPad = gst_element_get_pad( col1, "src" ); - negcapas = gst_pad_get_negotiated_caps( GST_PAD(videoPad) ); - if ( negcapas ) - { - if( !gst_video_get_size( videoPad, &videoWidth, &videoHeight ) ) - { - DEBUG_ERR("WARN: Cannot receive video size, using defaults"); - videoWidth = TEST_VIDEO_WIDTH; - videoHeight = TEST_VIDEO_HEIGHT; - } - } - else - { - videoWidth = TEST_VIDEO_WIDTH; - videoHeight = TEST_VIDEO_HEIGHT; - } - } - - DEBUG_INFO_A2("Received video frame info, videoWidth:%d, videoHeight:%d",videoWidth,videoHeight); - cropLeft = (gint)pSrcRect->left; - cropTop = (gint)pSrcRect->top; - cropRight = videoWidth - ((gint)pSrcRect->left + (gint)pSrcRect->width); - cropBottom = videoHeight - ((gint)pSrcRect->top + (gint)pSrcRect->height); - DEBUG_INFO_A4("Crop values - cropLeft:%d ,cropTop:%d,cropRight:%d,cropBottom:%d", cropLeft,cropTop,cropRight,cropBottom); - - if( cropBottom >= 0 && cropLeft >=0 && cropRight >= 0 && cropTop >= 0 ) - { - g_object_set(G_OBJECT(cropElement), "bottom",cropBottom, NULL); - g_object_set(G_OBJECT(cropElement), "left", cropLeft, NULL); - g_object_set(G_OBJECT(cropElement), "right", cropRight, NULL); - g_object_set(G_OBJECT(cropElement), "top", cropTop, NULL); - } - else - { - if( cropLeft > videoWidth || cropLeft < 0 || - cropRight > videoWidth || cropRight < 0 || - cropBottom > videoHeight || cropBottom < 0 || - cropTop > videoHeight || cropTop < 0) - { - DEBUG_INFO("Cropped params out of original frame."); - } - } - } - - if(rotateElement && isRotate) - { - DEBUG_INFO("Start rotating!"); - - /* calculate rotation */ - newRotation = tempRotation + rotation; - - if( newRotation > ROTATION_RATIO || newRotation < ROTATION_RATIO_NEG ) - { - newRotation = newRotation % ROTATION_RATIO; - } - - /* Set rotation */ - switch(newRotation) - { - case 0: - { - /* no rotation */ - DEBUG_INFO("Set rotation FLIP_NONE"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_NONE, NULL); - break; - } - case 90000: - case -270000: - { - /* rotation 90 degree */ - DEBUG_INFO("Set rotation 90 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_CLOCKWISE, NULL); - break; - } - case 180000: - case -180000: - { - /* rotation 180 degree */ - DEBUG_INFO("Set rotation 180 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_ROTATE_180, NULL); - break; - } - case 270000: - case -90000: - { - /* rotation 270 degree */ - DEBUG_INFO("Set rotation 270 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_COUNTERCLOCKWISE, NULL); - break; - } - case 360000: - case -360000: - { - /* rotation 360 degree */ - DEBUG_INFO("Set rotation 360 degrees"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_NONE, NULL); - break; - } - default: - { - /* no rotation */ - DEBUG_INFO("Set rotation default (FLIP_NONE) degree"); - g_object_set(G_OBJECT(rotateElement), "method", FLIP_NONE, NULL); - break; - } - } - - /* Store current rotate value */ - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - ctx->curRotation = newRotation; - } - if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - ctx->curRotation = newRotation; - } - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - ctx->curRotation = newRotation; - } - } - - if(mirrorElement && isMirror) - { - /* solve new mirror state */ - switch(mirror) - { - case XA_VIDEOMIRROR_NONE: - { - newMirror = tempMirror; - break; - } - case XA_VIDEOMIRROR_VERTICAL: - { - if( tempMirror == XA_VIDEOMIRROR_VERTICAL ) - { - newMirror = XA_VIDEOMIRROR_NONE; - } - else if( tempMirror == XA_VIDEOMIRROR_HORIZONTAL ) - { - newMirror = XA_VIDEOMIRROR_BOTH; - } - else if( tempMirror == XA_VIDEOMIRROR_BOTH ) - { - newMirror = XA_VIDEOMIRROR_HORIZONTAL; - } - else - { - newMirror = XA_VIDEOMIRROR_VERTICAL; - } - break; - } - case XA_VIDEOMIRROR_HORIZONTAL: - { - if( tempMirror == XA_VIDEOMIRROR_VERTICAL ) - { - newMirror = XA_VIDEOMIRROR_BOTH; - } - else if( tempMirror == XA_VIDEOMIRROR_HORIZONTAL ) - { - newMirror = XA_VIDEOMIRROR_NONE; - } - else if( tempMirror == XA_VIDEOMIRROR_BOTH ) - { - newMirror = XA_VIDEOMIRROR_VERTICAL; - } - else - { - newMirror = XA_VIDEOMIRROR_HORIZONTAL; - } - break; - } - case XA_VIDEOMIRROR_BOTH: - { - if( tempMirror == XA_VIDEOMIRROR_VERTICAL ) - { - newMirror = XA_VIDEOMIRROR_HORIZONTAL; - } - else if( tempMirror == XA_VIDEOMIRROR_HORIZONTAL ) - { - newMirror = XA_VIDEOMIRROR_VERTICAL; - } - else if( tempMirror == XA_VIDEOMIRROR_BOTH ) - { - newMirror = XA_VIDEOMIRROR_NONE; - } - else - { - newMirror = XA_VIDEOMIRROR_BOTH; - } - break; - } - default: - break; - } - - - DEBUG_INFO("Start mirroring!"); - /* Set mirror */ - switch(newMirror) - { - case XA_VIDEOMIRROR_NONE: - { - /* none */ - DEBUG_INFO("Set mirror none"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_NONE, NULL); - break; - } - case XA_VIDEOMIRROR_VERTICAL: - { - /* vertical mirror */ - DEBUG_INFO("Set mirror vertical"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_VERTICAL, NULL); - break; - } - case XA_VIDEOMIRROR_HORIZONTAL: - { - /* horizontal mirror */ - DEBUG_INFO("Set mirror horizontal"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_HORIZONTAL, NULL); - break; - } - case XA_VIDEOMIRROR_BOTH: - { - /* both mirror */ - DEBUG_INFO("Set mirror vertical and horizontal"); - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_ROTATE_180, NULL); - break; - } - default: - { - /* Default no mirroring */ - g_object_set(G_OBJECT(mirrorElement), "method", FLIP_NONE, NULL); - break; - } - } - - /* Store current mirror state */ - if( bCtx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* ctx = (XAMediaPlayerAdaptationCtx*) bCtx; - ctx->curMirror = newMirror; - } - if( bCtx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* ctx = (XAMediaRecorderAdaptationCtx*) bCtx; - ctx->curMirror = newMirror; - } - if( bCtx->baseObj.ctxId == XACameraAdaptation ) - { - XACameraAdaptationCtx* ctx = (XACameraAdaptationCtx*) bCtx; - ctx->curMirror = newMirror; - } - } - - /* Set scale */ - if ( isScaleOptions || isDestRect || isSrcRect ) - { - switch( scaleOptions ) - { - - case XA_VIDEOSCALE_STRETCH: - { - DEBUG_INFO("XA_VIDEOSCALE_STRETCH"); - /* The source and destination rectangle's width and height params are used to calculate - * the scaling factors independently. Aspect ratio is ignored. */ - if (pDestRect) - { - if (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { - GstPad *pad = NULL; - GstCaps* simplecaps = NULL; - g_object_set ( G_OBJECT(sink), "force-aspect-ratio", FALSE, NULL); - simplecaps = gst_caps_new_simple("video/x-raw-rgb", - "width", G_TYPE_INT, pDestRect->width, - "height", G_TYPE_INT, pDestRect->height, - "framerate", GST_TYPE_FRACTION, 0,1, - NULL); - DEBUG_API_A1("caps: %s",gst_caps_to_string(simplecaps)); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - if (!gst_pad_set_caps(pad, simplecaps)) - { - DEBUG_INFO("Stubbed at this point"); - DEBUG_INFO("Cannot set destrect size during XA_VIDEOSCALE_STRETCH!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_VIDEOSCALE_STRETCH"); - return XA_RESULT_SUCCESS; - } - DEBUG_API_A1("ret: %lu",ret); - } - else - { - GstCaps* simplecaps = NULL; - GstPad *pad = NULL; - if ( !scale ) - { - DEBUG_ERR("Could not get scaling element from pipeline!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - simplecaps = gst_caps_new_simple("video/x-raw-yuv", - "width", G_TYPE_INT, pDestRect->width, - "height", G_TYPE_INT, pDestRect->height, - "framerate", GST_TYPE_FRACTION, 0,1, - NULL); - DEBUG_API_A1("caps: %s",gst_caps_to_string(simplecaps)); - pad = gst_element_get_static_pad(GST_ELEMENT(scale),"src"); - if (!gst_pad_set_caps(pad, simplecaps)) - { - DEBUG_INFO("Stubbed at this point"); - DEBUG_INFO("Cannot set destrect size during XA_VIDEOSCALE_STRETCH!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_VIDEOSCALE_STRETCH"); - return XA_RESULT_SUCCESS; - } - - } - } - DEBUG_INFO("XA_VIDEOSCALE_STRETCH Done"); - - break; - } - case XA_VIDEOSCALE_FIT: - { - DEBUG_INFO("XA_VIDEOSCALE_FIT"); - /* The miminum scale factor between the destination rectangle's width over the - * source rectangle's source rectangle's width and the destination rectangle's height over - * the source rectangle's height is used. Aspect ratio is maintained. Frame is centered */ - if (pDestRect) - { - if (bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) - { - GstPad *pad = NULL; - GstCaps* simplecaps = NULL; - g_object_set ( G_OBJECT(sink), "force-aspect-ratio", TRUE, NULL); - simplecaps = gst_caps_new_simple("video/x-raw-rgb", - "width", G_TYPE_INT, pDestRect->width, - "height", G_TYPE_INT, pDestRect->height, - "framerate", GST_TYPE_FRACTION, 0,1, - NULL); - DEBUG_API_A1("caps: %s",gst_caps_to_string(simplecaps)); - pad = gst_element_get_static_pad(GST_ELEMENT(sink),"sink"); - if (!gst_pad_set_caps(pad, simplecaps)) - { - DEBUG_INFO("Stubbed at this point"); - DEBUG_INFO("Cannot set destrect size during XA_VIDEOSCALE_FIT!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_VIDEOSCALE_FIT"); - return XA_RESULT_SUCCESS; - } - } - else - { - GstPad *videoScalePad = NULL; - GstCaps *negcaps = NULL; - gint videoScalePadHeight = 0, videoScalePadWidth = 0; - gfloat scaleFactorWidth = 0; - gfloat scaleFactorHeight = 0; - gfloat scaleFactor = 0; - videoScalePad = gst_element_get_pad( col1, "src" ); - negcaps = gst_pad_get_negotiated_caps( GST_PAD(videoScalePad) ); - if ( negcaps ) - { - if( !gst_video_get_size( videoScalePad, &videoScalePadWidth, &videoScalePadHeight ) ) - { - DEBUG_ERR("Cannot receive current cropscalevideo size!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("No negotiated caps in col1:src!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return XA_RESULT_SUCCESS; - } - if (pSrcRect->width != 0 && pSrcRect->height != 0) - { - scaleFactorWidth = (gfloat)videoScalePadWidth / (gfloat)pSrcRect->width; - scaleFactorHeight = (gfloat)videoScalePadHeight / (gfloat)pSrcRect->height; - if (scaleFactorWidth < scaleFactorHeight) - { - scaleFactor = scaleFactorWidth; - } - else - { - scaleFactor = scaleFactorHeight; - } - - cropscaleBottom = (gint)(pSrcRect->height*scaleFactor - videoScalePadHeight)/2; - cropscaleLeft = (gint)(pSrcRect->width*scaleFactor - videoScalePadWidth)/2; - if (cropscaleLeft > 0){ - cropscaleLeft *= -1; - } - cropscaleRight = cropscaleLeft; - if (cropscaleBottom > 0){ - cropscaleBottom *= -1; - } - cropscaleTop = cropscaleBottom; - g_object_set (G_OBJECT (boxElement), "bottom", cropscaleBottom , NULL); - g_object_set (G_OBJECT (boxElement), "right", cropscaleRight, NULL); - g_object_set (G_OBJECT (boxElement), "left", cropscaleLeft, NULL); - g_object_set (G_OBJECT (boxElement), "top", cropscaleTop, NULL); - } - } - } - DEBUG_INFO("XA_VIDEOSCALE_FIT done"); - - break; - } - case XA_VIDEOSCALE_CROP: - { - DEBUG_INFO("XA_VIDEOSCALE_CROP"); - /* The maximum scale factor between the destination rectangle's width over the source - * rectangle's width and destination rectangle's height over the source rectangle's - * height is used. Aspect ratio is maintained. Frame is centered. */ - if( pDestRect && pSrcRect ) - { - GstPad *videoScalePad = NULL; - GstCaps *negcaps = NULL; - gint videoScalePadHeight = 0, videoScalePadWidth = 0; - videoScalePad = gst_element_get_pad( col1, "src" ); - negcaps = gst_pad_get_negotiated_caps( GST_PAD(videoScalePad) ); - if ( negcaps ) - { - if( !gst_video_get_size( videoScalePad, &videoScalePadWidth, &videoScalePadHeight ) ) - { - DEBUG_ERR("Cannot receive current cropscalevideo size!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit - XA_RESULT_INTERNAL_ERROR"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("No negotiated caps in col1:src!"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return XA_RESULT_SUCCESS; - } - - DEBUG_INFO_A2( "Received video scale frame info, videoScalePadWidth:%d, " - "videoScalePadHeight:%d",videoScalePadWidth,videoScalePadHeight); - - if( pSrcRect->height > 0 && pSrcRect->width > 0 ) - { - if( pSrcRect->height > pDestRect->height ) - { - videoscaleHeight = pSrcRect->height; - if( pDestRect->top == 0) - { - cropscaleTop = ((videoscaleHeight - pDestRect->height)/2); - cropscaleBottom = ((videoscaleHeight - pDestRect->height)/2); - } - else - { - cropscaleTop = (pDestRect->top/2); - cropscaleBottom = (pDestRect->top/2); - } - } - else if( pDestRect->height > pSrcRect->height ) - { - videoscaleHeight = pDestRect->height; - if( pDestRect->top == 0) - { - cropscaleTop = -((videoscaleHeight - pSrcRect->height)/2); - cropscaleBottom = -((videoscaleHeight - pSrcRect->height)/2); - } - else - { - cropscaleTop = -(pDestRect->top/2); - cropscaleBottom = -(pDestRect->top/2); - } - } - else if( pDestRect->height == pSrcRect->height ) - { - } - else - { - } - if( pSrcRect->width > pDestRect->width ) - { - if( pDestRect->left == 0 ) - { - cropscaleLeft = ((gint)(pSrcRect->width -pDestRect->width)/2); - cropscaleRight = ((gint)(pSrcRect->width -pDestRect->width)/2); - } - else - { - cropscaleLeft = (pDestRect->left/2); - cropscaleRight = (pDestRect->left/2); - } - } - else if( pDestRect->width > pSrcRect->width ) - { - if( pDestRect->left == 0 ) - { - cropscaleLeft =-((gint)(pDestRect->width -pSrcRect->width)/2); - cropscaleRight =-((gint)(pDestRect->width -pSrcRect->width)/2); - } - else - { - cropscaleLeft = -(pDestRect->left/2); - cropscaleRight = -(pDestRect->left/2); - } - } - else if( pDestRect->width == pSrcRect->width ) - { - } - else - { - } - } - else - { - DEBUG_ERR("Invalid rectangle values in source rectangles"); - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit, Exit with invalid source rectangle values"); - return XA_RESULT_PARAMETER_INVALID; - } - if( pDestRect->width != pSrcRect->width && pDestRect->height != pSrcRect->height ) - { - DEBUG_INFO_A4("Crop values - cropscaleLeft:%d " - ",cropscaleTop:%d," - "cropscaleRight:%d," - "cropscaleBottom:%d", - cropscaleLeft, - cropscaleTop, - cropscaleRight, - cropscaleBottom); - g_object_set (G_OBJECT (boxElement), "bottom",cropscaleBottom , NULL); - g_object_set (G_OBJECT (boxElement), "right", cropscaleRight, NULL); - g_object_set (G_OBJECT (boxElement), "left", cropscaleLeft, NULL); - g_object_set (G_OBJECT (boxElement), "top",cropscaleTop, NULL); - } - } - break; - } - default: - DEBUG_INFO("no scale options!"); - break; - } - } - - - /*TODO The Code below does nothing. just set the variable which are never used. - * commenting the code below. */ -/* if(pDestRect && boxElement) - { - is background color black - if((backgroundColor >> 8) & BLACK_BG_COLOR_MASK) - { - videoBackgroundColor = 0; - } - is background color green - else if((backgroundColor >> 8) & GREEN_BG_COLOR_MASK) - { - videoBackgroundColor = 1; - } - is background color blue - else if((backgroundColor >> 8) & BLUE_BG_COLOR_MASK) - { - videoBackgroundColor = 2; - } - else - { - by default black - videoBackgroundColor = 0; - } - - check alpha value. Gst support values 0 to 1 and XA 0 to 255 - { - XAuint32 tempColor = 0; - tempColor = backgroundColor & ALPHA_VALUE_MASK; - - alphaValue = (gdouble)(tempColor/ALPHA_VALUE_MASK); - } - - - }*/ - - if( dataSrc ) - { - XAMediaType mediaType = XA_MEDIATYPE_UNKNOWN; - ret = XACommon_CheckDataSource(dataSrc, &mediaType); - if( ret == XA_RESULT_SUCCESS && mediaType == XA_MEDIATYPE_IMAGE ) - { - gstOrigState = GST_STATE(bCtx->bin); - - DEBUG_INFO_A1("Sending change state request to state %d", GST_STATE_READY); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), GST_STATE_READY); - gstTmpState = GST_STATE(bCtx->bin); - - if(gstRet == GST_STATE_CHANGE_SUCCESS && gstTmpState == GST_STATE_READY) - { - DEBUG_INFO_A1("Sending change state request to state %d", gstOrigState); - gstRet = gst_element_set_state( GST_ELEMENT(bCtx->bin), gstOrigState); - } - } - } - - DEBUG_API("<-XAVideoPostProcessingItfAdapt_Commit"); - return ret; -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xavideopostprosessingitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOPOSTPROSESSINGITFADAPTATION_H -#define XAVIDEOPOSTPROSESSINGITFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xathreadsafety.h" - -/* MACROS */ -#define BLACK_BG_COLOR_MASK 0x00FFFFFF -#define GREEN_BG_COLOR_MASK 0x0000FF00 -#define BLUE_BG_COLOR_MASK 0x000000FF -#define ALPHA_VALUE_MASK 0x000000FF - -#define TEST_VIDEO_WIDTH 640 -#define TEST_VIDEO_HEIGHT 480 - -#define ROTATION_RATIO 360000 -#define ROTATION_RATIO_NEG -360000 - -/* FUNCTIONS */ -XAresult XAVideoPostProcessingItfAdapt_IsArbitraryRotationSupported(XAAdaptationGstCtx *bCtx, - XAboolean *pSupported); - -XAresult XAVideoPostProcessingItfAdapt_Commit(XAAdaptationGstCtx *bCtx, - XAmillidegree rotation, - XAuint32 scaleOptions, - XAuint32 backgroundColor, - XAuint32 renderingHints, - const XARectangle *pSrcRect, - const XARectangle *pDestRect, - XAuint32 mirror, - XAboolean isMirror, - XAboolean isRotate, - XAboolean isDestRect, - XAboolean isSrcRect, - XAboolean isScaleOptions - ); - -#endif /* XAVIDEOPOSTPROSESSINGITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.c --- a/khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,502 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include "xaadaptationgst.h" -#include "xavolumeitfadaptation.h" -#include "xamediaplayeradaptctx.h" - -#include "xaoutputmixadaptctx.h" -#include "xamediarecorderadaptctx.h" - -/* - * XAresult XAVolumeItfAdapt_FlushBin(XAAdaptationGstCtx *ctx) - */ -XAresult XAVolumeItfAdapt_FlushBin(XAAdaptationGstCtx *ctx) -{ - DEBUG_API("->XAVolumeItfAdapt_FlushBin"); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation )) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - if (GST_STATE(ctx->bin) != GST_STATE_PLAYING) - { - gint64 position = 0; - GstFormat format = GST_FORMAT_TIME; - - if (! gst_element_query_position( GST_ELEMENT(ctx->bin), &format, &position )) - { - DEBUG_ERR("Gst: Failed to get position"); - return XA_RESULT_INTERNAL_ERROR; - } - XAAdaptationGst_PrepareAsyncWait(ctx); - /* in effect seeks to current position and flushing the buffer, due to - * gstreamer implementation actual position might change, if stopped, seek to beginning - */ - if(!gst_element_seek( ctx->bin, ((XAMediaPlayerAdaptationCtx*)ctx)->playrate, GST_FORMAT_TIME, - (GstSeekFlags)(GST_SEEK_FLAG_FLUSH|GST_SEEK_FLAG_ACCURATE), - GST_SEEK_TYPE_SET, position, - GST_SEEK_TYPE_NONE, (gint64)GST_CLOCK_TIME_NONE)) - { - DEBUG_ERR("WARN: gst reports seek not handled"); - } - /* flushed seeks always asynchronous */ - XAAdaptationGst_StartAsyncWait(ctx); - DEBUG_INFO("Bin flushed."); - ctx->waitingasyncop = XA_BOOLEAN_FALSE; - } - DEBUG_API("<-XAVolumeItfAdapt_FlushBin"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_SetVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, - * XAmillibel level) - * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID - * XAmillibel level - Requested volume level, in between XA_MILLIBEL_MIN and XA_MILLIBEL_MAX - * @return XAresult ret - Success value - */ -XAresult XAVolumeItfAdapt_SetVolumeLevel(XAAdaptationGstCtx *ctx, XAmillibel level) -{ - GstElement *vol=NULL, *audiopp=NULL; - gdouble gstVolume = 0; - XAmillibel tempVolumeLevel = 0; - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API_A1("->XAVolumeItfAdapt_SetVolumeLevel (level %d)", level); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XAOutputMixAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if( level <= MIN_SUPPORT_VOLUME_LEVEL ) - { - tempVolumeLevel = MIN_SUPPORT_VOLUME_LEVEL; - } - else if( level >= MAX_SUPPORT_VOLUME_LEVEL ) - { - tempVolumeLevel = MAX_SUPPORT_VOLUME_LEVEL; - } - else - { - tempVolumeLevel = level; - } - gstVolume = ( ( (gdouble)(VOLUME_LEVEL_RATIO + tempVolumeLevel)/ VOLUME_LEVEL_RATIO) ); - - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - DEBUG_INFO_A1("Setting gst level to %f",gstVolume); - g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL ); - - XAVolumeItfAdapt_FlushBin(ctx); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - DEBUG_INFO_A1("Setting gst level to %f",gstVolume); - g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL ); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if (ctx->baseObj.ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - guint iterator = 0; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = NULL; - XAAdaptationGstCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx; - if(!bCtx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - return XA_RESULT_INTERNAL_ERROR; - } - - basebin = GST_BIN(bCtx->bin); - if(!basebin) - { - DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - return XA_RESULT_INTERNAL_ERROR; - } - - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - DEBUG_INFO_A1("Setting gst level to %f",gstVolume); - g_object_set( G_OBJECT(vol), "volume", (gdouble)gstVolume, NULL ); - - XAVolumeItfAdapt_FlushBin(bCtx); - } - else - { - DEBUG_ERR_A1("Could not find gst volume controller for player %u!!", iterator); - } - } - } - DEBUG_API("<-XAVolumeItfAdapt_SetVolumeLevel"); - return res; -} - -/* - * XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, - XAmillibel *pMaxLevel) - * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter - * @param AdaptationContextIDS ctx->baseObj.ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type. - * XAmillibel *pMaxLevel - Maximum volume level - * @return XAresult ret - Success value - */ -XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(XAAdaptationGstCtx *ctx, XAmillibel *pMaxLevel) -{ - DEBUG_API("->XAVolumeItfAdapt_GetMaxVolumeLevel"); - - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XAOutputMixAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_GetMaxVolumeLevel"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - *pMaxLevel = MAX_SUPPORT_VOLUME_LEVEL; - - DEBUG_API("<-XAVolumeItfAdapt_GetMaxVolumeLevel"); - - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_SetMute(void *ctx, AdaptationContextIDS ctx->baseObj.ctxId, XAboolean mute) - * @param void *ctx - Adaptation context, this will be casted to correct type regarding to contextID value given as 2nd parameter - * @param AdaptationContextIDS ctx->baseObj.ctxId - Type specifier for context, this will be used to cast ctx pointer to correct type. - * @param XAboolean mute - status of mute value - * @return XAresult ret - Success value - */ -XAresult XAVolumeItfAdapt_SetMute(XAAdaptationGstCtx *ctx, XAboolean mute) -{ - GstElement *vol=NULL, *audiopp=NULL; - gboolean gmute = 0; - - DEBUG_API("->XAVolumeItfAdapt_SetMute"); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XAOutputMixAdaptation ) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - context->mute = mute; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - if ( mute ) - { - gmute = 1; - } - else - { - gmute = 0; - } - g_object_set( G_OBJECT(vol), "mute", gmute, NULL ); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - context->mute = mute; - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - if ( mute ) - { - gmute = 1; - } - else - { - gmute = 0; - } - g_object_set( G_OBJECT(vol), "mute", gmute, NULL ); - } - else - { - DEBUG_ERR("Could not find gst volume controller element!!"); - } - } - else if ( ctx->baseObj.ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - guint iterator = 0; - context->mute = mute; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = NULL; - XAAdaptationGstCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx; - if(!bCtx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - return XA_RESULT_INTERNAL_ERROR; - } - - basebin = GST_BIN(bCtx->bin); - if(!basebin) - { - DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator); - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - return XA_RESULT_INTERNAL_ERROR; - } - - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if(audiopp) - { - vol = gst_bin_get_by_name( GST_BIN(audiopp), "pp_vol" ); - } - if(vol) - { - if ( mute ) - { - gmute = 1; - } - else - { - gmute = 0; - } - g_object_set( G_OBJECT(vol), "mute", gmute, NULL ); - } - else - { - DEBUG_ERR_A1("Could not find gst volume controller for player %u!!", iterator); - } - } - } - DEBUG_API("<-XAVolumeItfAdapt_SetMute"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationGstCtx *ctx, XAboolean enable) - * @param XAAdaptationGstCtx *ctx - Adaptation context - * @param XAboolean enable - Enable Stereo Position - * @return XAresult - Success value - */ -XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationGstCtx *ctx, XAboolean enable) -{ - DEBUG_API("->XAVolumeItfAdapt_EnableStereoPosition"); - - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XAOutputMixAdaptation ) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_EnableStereoPosition"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - context->isStereoPosition = enable; - } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - context->isStereoPosition = enable; - } - else if ( ctx->baseObj.ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - context->isStereoPosition = enable; - } - - DEBUG_API("<-XAVolumeItfAdapt_EnableStereoPosition"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationGstCtx *ctx, XApermille stereoPosition) - * @param XAAdaptationGstCtx *ctx - Adaptation context - * @param XApermille stereoPosition - Stereo Position to be set - * @return XAresult - Success value - */ -XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationGstCtx *ctx, - XApermille stereoPosition) -{ - GstElement *audiopp = NULL, *pan = NULL; - gfloat gstPosition = 0.0; - - DEBUG_API("->XAVolumeItfAdapt_SetStereoPosition"); - if(!ctx || ( ctx->baseObj.ctxId != XAMediaPlayerAdaptation && - ctx->baseObj.ctxId != XAMediaRecorderAdaptation && - ctx->baseObj.ctxId != XAOutputMixAdaptation) ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_PARAMETER_INVALID; - } - - gstPosition = ( (gfloat)stereoPosition / STEREO_POSITION_RATIO ); - - if ( ctx->baseObj.ctxId == XAMediaPlayerAdaptation ) - { - XAMediaPlayerAdaptationCtx* context = (XAMediaPlayerAdaptationCtx*) ctx; - - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp"); - if( !audiopp ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" ); - if( !pan ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL ); - - XAVolumeItfAdapt_FlushBin(ctx); - } - else if ( ctx->baseObj.ctxId == XAMediaRecorderAdaptation ) - { - XAMediaRecorderAdaptationCtx* context = (XAMediaRecorderAdaptationCtx*) ctx; - - audiopp = gst_bin_get_by_name( GST_BIN(context->baseObj.bin), "audiopp"); - if( !audiopp ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" ); - if( !pan ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - - g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL ); - } - - else if ( ctx->baseObj.ctxId == XAOutputMixAdaptation ) - { - XAOutputMixAdaptationCtx* context = (XAOutputMixAdaptationCtx*) ctx; - guint iterator = 0; - for ( iterator = 0; iterator < context->connectedObjects->len; iterator++ ) - { - GstBin* basebin = NULL; - XAAdaptationGstCtx* bCtx = g_array_index(context->connectedObjects,XAOMixAdaptConnObj,iterator).ctx; - if(!bCtx) - { - DEBUG_ERR_A1("Context in connected objects array (index %u) is NULL!", iterator); - return XA_RESULT_INTERNAL_ERROR; - } - - basebin = GST_BIN(bCtx->bin); - if(!basebin) - { - DEBUG_ERR_A1("Bin in connected objects context (index %u) is NULL!", iterator); - return XA_RESULT_INTERNAL_ERROR; - } - - audiopp = gst_bin_get_by_name( basebin, "audiopp" ); - if( !audiopp ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - pan = gst_bin_get_by_name( GST_BIN(audiopp), "pp_pan" ); - if( !pan ) - { - DEBUG_ERR("XA_RESULT_INTERNAL_ERROR"); - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_INTERNAL_ERROR; - } - g_object_set( G_OBJECT(pan), "panorama", gstPosition, NULL ); - - XAVolumeItfAdapt_FlushBin(bCtx); - } - } - - DEBUG_API("<-XAVolumeItfAdapt_SetStereoPosition"); - return XA_RESULT_SUCCESS; -} - - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.h --- a/khronosfws/openmax_al/src/gst_adaptation/xavolumeitfadaptation.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVOLUMEITFADAPTATION_H -#define XAVOLUMEITFADAPTATION_H - -#include "xaadaptationgst.h" -#include "xathreadsafety.h" - -/* MACROS */ -#define STEREO_POSITION_RATIO 1000 -#define MIN_SUPPORT_VOLUME_LEVEL -1000 -#define VOLUME_LEVEL_RATIO 1000 - -/* FUNCTIONS */ - -XAresult XAVolumeItfAdapt_SetVolumeLevel(XAAdaptationGstCtx *ctx, - XAmillibel level); - -XAresult XAVolumeItfAdapt_GetMaxVolumeLevel(XAAdaptationGstCtx *ctx, - XAmillibel *pMaxLevel); - -XAresult XAVolumeItfAdapt_SetMute(XAAdaptationGstCtx *ctx, XAboolean mute); - -XAresult XAVolumeItfAdapt_EnableStereoPosition(XAAdaptationGstCtx *ctx, - XAboolean enable); - -XAresult XAVolumeItfAdapt_SetStereoPosition(XAAdaptationGstCtx *ctx, - XApermille stereoPosition); - -#endif /* XAVOLUMEITFADAPTATION_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/ledarray/xaledarraydevice.c --- a/khronosfws/openmax_al/src/ledarray/xaledarraydevice.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,348 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaledarraydevice.h" -#include "xaledarrayitf.h" -#include "xaconfigextensionsitf.h" -#include "xadynintmgmtitf.h" -#include "xathreadsafety.h" -#include "xaledarrayadaptctx.h" - -/* Static mapping of enumeration XALEDArrayDeviceInterfaces to interface iids */ -static const XAInterfaceID* XALEDArrayDeviceItfIIDs[LEDARRAY_ITFCOUNT]= -{ - &XA_IID_OBJECT, - &XA_IID_LED, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, -}; - - -/***************************************************************************** - * Global methods - *****************************************************************************/ - -/* XAResult XALEDArrayDeviceImpl_Create - * Description: Create object - */ -XAresult XALEDArrayDeviceImpl_CreateLEDArrayDevice(FrameworkMap* mapper, - XAObjectItf* pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired) -{ - - - XAuint8 itfIndex = 0; - - XALEDArrayDeviceImpl* pImpl = NULL; - XAObjectItfImpl* pBaseObj = NULL; - - - DEBUG_API("->XALEDArrayDeviceImpl_Create"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray); - - if( !pDevice ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayDeviceImpl_Create"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* instantiate object implementation */ - pImpl = (XALEDArrayDeviceImpl*)calloc(1,sizeof(XALEDArrayDeviceImpl)); - if( !pImpl ) - { - /* memory allocation failed */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XALEDArrayDeviceImpl_Create"); - return XA_RESULT_MEMORY_FAILURE; - } - pBaseObj = &pImpl->baseObj; - - - - /* Initialize base object default implementation */ - XAObjectItfImpl_Init(pBaseObj, - LEDARRAY_ITFCOUNT, - XALEDArrayDeviceItfIIDs, - XALEDArrayDeviceImpl_DoRealize, - XALEDArrayDeviceImpl_DoResume, - XALEDArrayDeviceImpl_FreeResources); - - /* Mark interfaces that need to be exposed */ - /* Implicit and mandated interfaces */ - pBaseObj->interfaceMap[LEDARRAY_LEDARRAYITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[LEDARRAY_DIMITF].required = XA_BOOLEAN_TRUE; - - /* Explicit interfaces */ - if( (numInterfaces != 0) && pInterfaceIds && pInterfaceRequired ) - { - /* Check required interfaces */ - for( itfIndex = 0; itfIndex < numInterfaces; itfIndex++ ) - { - /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIndex]); - if( !entry ) - { - if( pInterfaceRequired[itfIndex] ) - { - /* required interface cannot be accommodated - fail creation */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("Required interface not found - abort creation!"); - DEBUG_API("<-XALEDArrayDeviceImpl_Create"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - else - { - DEBUG_INFO("Requested (not required) interface not found - continue creation"); - } - } - else - { - entry->required = XA_BOOLEAN_TRUE; - } - } - } - - - /* This code is put here to return Feature Not Supported since adaptation is not present*/ - /*************************************************/ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("Required interface not found - abort creation!"); - DEBUG_API("<-XALEDArrayDeviceImpl_Create"); - return XA_RESULT_FEATURE_UNSUPPORTED; - /*************************************************/ - -/* // Initialize XALEDArrayDeviceImpl variables - pImpl->deviceID = deviceID; - pImpl->adaptationCtx = XALEDArrayAdapt_Create(pImpl->deviceID); - - // Set ObjectItf to point to newly created object - *pDevice = (XAObjectItf)&(pBaseObj->self); - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_API("<-XALEDArrayDeviceImpl_Create"); - return XA_RESULT_SUCCESS;*/ -} - -/* XAResult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces - * Description: Statically query number of supported interfaces - */ -XAresult XALEDArrayDeviceImpl_QueryNumSupportedInterfaces( XAuint32 *pNumSupportedInterfaces ) -{ - DEBUG_API("->XALEDArrayDeviceImpl_QueryNumSupportedInterfaces"); - if( pNumSupportedInterfaces ) - { - - *pNumSupportedInterfaces = LEDARRAY_ITFCOUNT; - - DEBUG_API_A1("<-XALEDArrayDeviceImpl_QueryNumSupportedInterfaces - %ld", *pNumSupportedInterfaces ); - return XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayDeviceImpl_QueryNumSupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } -} -/* XAResult XALEDArrayDeviceImpl_QuerySupportedInterfaces - * Description: Statically query supported interfaces - */ -XAresult XALEDArrayDeviceImpl_QuerySupportedInterfaces( XAuint32 index, - XAInterfaceID * pInterfaceId ) -{ - DEBUG_API("->XALEDArrayDeviceImpl_QuerySupportedInterfaces"); - - - if( index >= LEDARRAY_ITFCOUNT || !pInterfaceId ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayDeviceImpl_QuerySupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - *pInterfaceId = *(XALEDArrayDeviceItfIIDs[index]); - - DEBUG_API("<-XALEDArrayDeviceImpl_QuerySupportedInterfaces"); - return XA_RESULT_SUCCESS; - - } - -} - - -/***************************************************************************** - * base object XAObjectItfImpl methods - *****************************************************************************/ - -/* XAresult XALEDArrayDeviceImpl_DoRealize( XAObjectItf self ) - * Description: Realize all implicit and explicitly wanted interfaces. - * Create and initialize implementation-specific variables. - * Called from base object XAObjectItfImpl - */ -XAresult XALEDArrayDeviceImpl_DoRealize( XAObjectItf self ) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAuint8 itfIdx = 0; - XALEDArrayDeviceImpl* pObjImpl = (XALEDArrayDeviceImpl*)(pObj); - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XALEDArrayDeviceImpl_DoRealize"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray); - - /* check casting from correct pointer type */ - if( !pObjImpl || pObj != pObjImpl->baseObj.self ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XALEDArrayAdapt_PostInit( (XAAdaptationGstCtx*)pObjImpl->adaptationCtx ); - if( ret != XA_RESULT_SUCCESS ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR_A1("Error: %d",ret); - DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); - return ret; - } - - /* Realize all implicit and explicitly wanted interfaces */ - for( itfIdx = 0; itfIdx < LEDARRAY_ITFCOUNT; itfIdx++) - { - if( !(pObj->interfaceMap[itfIdx].pItf) && - pObj->interfaceMap[itfIdx].required ) - { - void *pItf = NULL; - switch( itfIdx ) - { - case LEDARRAY_LEDARRAYITF: - pItf = XALEDArrayItfImpl_Create( pObjImpl->adaptationCtx ); - break; - case LEDARRAY_CONFIGEXTENSIONITF: - pItf = XAConfigExtensionsItfImpl_Create(); - break; - case LEDARRAY_DIMITF: - pItf = XADIMItfImpl_Create(); - break; - default: - break; - } - if( !pItf ) - { - /* memory allocation failed */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); - return XA_RESULT_MEMORY_FAILURE; - } - else - { - pObj->interfaceMap[itfIdx].pItf = pItf; - } - } - } - - pObj->state = XA_OBJECT_STATE_REALIZED; - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - - DEBUG_API("<-XALEDArrayDeviceImpl_DoRealize"); - return XA_RESULT_SUCCESS; -} - -/* XAresult XALEDArrayDeviceImpl_DoResume - * Description: Resume object from suspended state - */ -XAresult XALEDArrayDeviceImpl_DoResume(XAObjectItf self) -{ - DEBUG_API("->XALEDArrayDeviceImpl_DoResume"); - DEBUG_API("<-XALEDArrayDeviceImpl_DoResume"); - /* This implementation does not support suspended state */ - return XA_RESULT_PRECONDITIONS_VIOLATED; -} - -/* void XALEDArrayDeviceImpl_FreeResources - * Description: Free all resources reserved at XALEDArrayDeviceImpl_DoRealize() - */ -void XALEDArrayDeviceImpl_FreeResources(XAObjectItf self) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XALEDArrayDeviceImpl* pImpl = (XALEDArrayDeviceImpl*)(*self); - XAuint8 itfIdx = 0; - DEBUG_API("->XALEDArrayDeviceImpl_FreeResources"); - XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSLEDArray); - assert( pObj && pImpl && pObj == pObj->self ); - - if ( pImpl->adaptationCtx != NULL ) - { - XALEDArrayAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtx ); - pImpl->adaptationCtx = NULL; - } - - /* free all allocated interfaces */ - for(itfIdx = 0; itfIdx < LEDARRAY_ITFCOUNT; itfIdx++) - { - void *pItf = pObj->interfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) - { - case LEDARRAY_LEDARRAYITF: - XALEDArrayItfImpl_Free( pItf ); - break; - case LEDARRAY_CONFIGEXTENSIONITF: - XAConfigExtensionsItfImpl_Free( pItf ); - break; - case LEDARRAY_DIMITF: - XADIMItfImpl_Free( pItf ); - break; - - default: - break; - } - pObj->interfaceMap[itfIdx].pItf = NULL; - } - } - - if ( pImpl->adaptationCtx != NULL ) - { - XALEDArrayAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtx ); - pImpl->adaptationCtx = NULL; - } - - XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS(XATSLEDArray); - DEBUG_API("<-XALEDArrayDeviceImpl_FreeResources"); - - return; -} -/* END OF FILE */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/ledarray/xaledarraydevice.h --- a/khronosfws/openmax_al/src/ledarray/xaledarraydevice.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XALEDARRAYDEVICE_H -#define XALEDARRAYDEVICE_H - -#include "openmaxalwrapper.h" -#include "xaobjectitf.h" -#include "xaglobals.h" - -#include "xaadptbasectx.h" -/** MACROS **/ - - -/** TYPES **/ - - -/** ENUMERATIONS **/ -/* Enumeration for interfaces that LEDArrayDevice supports. */ -typedef enum -{ - LEDARRAY_OBJECTITF, - LEDARRAY_LEDARRAYITF, - LEDARRAY_CONFIGEXTENSIONITF, - LEDARRAY_DIMITF, - LEDARRAY_ITFCOUNT -} XALEDArrayDeviceInterfaces; - -/** STRUCTURES **/ -/* Specification for LEDArrayDeviceImpl. */ -typedef struct XALEDArrayDeviceImpl_ -{ - /* Parent for XALEDArrayDeviceImpl */ - XAObjectItfImpl baseObj; - - /* variables */ - XAuint32 deviceID; - - XAAdaptationBaseCtx* adaptationCtx; - -} XALEDArrayDeviceImpl; - - -/** METHODS **/ - -/* base object XAObjectItfImpl methods */ -XAresult XALEDArrayDeviceImpl_DoRealize(XAObjectItf self); -XAresult XALEDArrayDeviceImpl_DoResume(XAObjectItf self); -void XALEDArrayDeviceImpl_FreeResources(XAObjectItf self); - -#endif /* XALEDARRAYDEVICE_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/ledarray/xaledarrayitf.c --- a/khronosfws/openmax_al/src/ledarray/xaledarrayitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,252 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xaledarrayitf.h" - -#include "xaledarrayitfadaptation.h" - -#include "xathreadsafety.h" - -/* XALEDArrayItfImpl* GetImpl(XALEDArrayItf self) - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XALEDArrayItfImpl* GetImpl(XALEDArrayItf self) -{ - if( self ) - { - XALEDArrayItfImpl* impl = (XALEDArrayItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/***************************************************************************** - * Base interface XALEDArrayItf implementation - *****************************************************************************/ -/* - * XAresult XALEDArrayItfImpl_ActivateLEDArray ( XALEDArrayItf self, - * XAuint32 lightMask ) - * Description: Activates or deactivates individual LEDs in an array of LEDs. - */ -XAresult XALEDArrayItfImpl_ActivateLEDArray ( XALEDArrayItf self, - XAuint32 lightMask ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XALEDArrayItfImpl* impl = GetImpl(self); - - DEBUG_API("->XALEDArrayItfImpl_ActivateLEDArray"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray); - - if( !impl || lightMask > LED_COUNT) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayItfImpl_ActivateLEDArray"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is ligtMask mode changed */ - if( impl->lightMask != lightMask ) - { - - ret = XALEDArrayItfAdapt_ActivateLEDArray( (XAAdaptationGstCtx*)impl->adapCtx, lightMask ); - - if ( ret == XA_RESULT_SUCCESS ) - { - impl->lightMask = lightMask; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_API("<-XALEDArrayItfImpl_ActivateLEDArray"); - return ret; -} -/* - * XAresult XALEDArrayItfImpl_IsLEDArrayActivated ( XALEDArrayItf self, - * XAuint32 * pLightMask ) - * Description: Returns the state of each LED in an array of LEDs. - */ -XAresult XALEDArrayItfImpl_IsLEDArrayActivated ( XALEDArrayItf self, - XAuint32 * pLightMask ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XALEDArrayItfImpl* impl = GetImpl(self); - DEBUG_API("->XALEDArrayItfImpl_IsLEDArrayActivated"); - - if( !impl || !pLightMask) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayItfImpl_IsLEDArrayActivated"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pLightMask = impl->lightMask; - - if( *pLightMask ) - { - DEBUG_API("The LED is on."); - } - else - { - DEBUG_API("The LED is off."); - } - - DEBUG_API("<-XALEDArrayItfImpl_IsLEDArrayActivated"); - return ret; -} -/* - * XAresult XALEDArrayItfImpl_SetColor ( XALEDArrayItf self, - * XAuint8 index, - * const XAHSL * pColor ) - * Description: Sets the color of an individual LED. - */ -XAresult XALEDArrayItfImpl_SetColor ( XALEDArrayItf self, - XAuint8 index, - const XAHSL * pColor ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XALEDArrayItfImpl* impl = GetImpl(self); - XAboolean support = XA_BOOLEAN_FALSE; - - DEBUG_API("->XALEDArrayItfImpl_SetColor"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSLEDArray); - - if( !impl || index > LED_COUNT - 1 || !pColor ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayItfImpl_SetColor"); - return XA_RESULT_PARAMETER_INVALID; - } - - support = ( COLOR_MASK >> index ) & 0x1; - if( !support ) /* Not supporting color*/ - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED: not supporting color"); - DEBUG_API("<-XALEDArrayItfImpl_SetColor"); - return XA_RESULT_PRECONDITIONS_VIOLATED; - } - else - { - - ret = XALEDArrayItfAdapt_SetColor( (XAAdaptationGstCtx*)impl->adapCtx, index, pColor); - - if ( ret == XA_RESULT_SUCCESS ) - { - impl->color = *pColor; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSLEDArray); - DEBUG_API("<-XALEDArrayItfImpl_SetColor"); - return ret; -} -/* - * XAresult XALEDArrayItfImpl_GetColor ( XALEDArrayItf self, - * XAuint8 index, - * const XAHSL * pColor ) - * Description: Returns the color of an individual LED. - */ -XAresult XALEDArrayItfImpl_GetColor ( XALEDArrayItf self, - XAuint8 index, - XAHSL * pColor ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XALEDArrayItfImpl* impl = GetImpl(self); - XAboolean support = XA_BOOLEAN_FALSE; - DEBUG_API("->XALEDArrayItfImpl_GetColor"); - - if( !impl || index > LED_COUNT - 1 || !pColor ) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XALEDArrayItfImpl_GetColor"); - return XA_RESULT_PARAMETER_INVALID; - } - - - support = ( COLOR_MASK >> index ) & 0x1; - if( !support ) /* Not supporting color*/ - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED: not supporting color"); - DEBUG_API("<-XALEDArrayItfImpl_GetColor"); - return XA_RESULT_PRECONDITIONS_VIOLATED; - } - else - { - *pColor = impl->color; - } - - DEBUG_API_A3("<-XALEDArrayItfImpl_GetColor: hue = %ld, saturation = %d, lightness = %d", pColor->hue, pColor->saturation, pColor->lightness); - return ret; -} - -/***************************************************************************** - * XALEDArrayItfImpl -specific methods - *****************************************************************************/ - - -/* XALEDArrayItfImpl* XALEDArrayItfImpl_Create() - * Description: Allocate and initialize LEDArrayItfImpl - */ -XALEDArrayItfImpl* XALEDArrayItfImpl_Create( XAAdaptationBaseCtx *adapCtx ) -{ - XALEDArrayItfImpl* self = (XALEDArrayItfImpl*) - calloc(1,sizeof(XALEDArrayItfImpl)); - DEBUG_API("->XALEDArrayItfImpl_Create"); - if( self ) - { - /* init itf default implementation */ - self->itf.ActivateLEDArray = XALEDArrayItfImpl_ActivateLEDArray; - self->itf.IsLEDArrayActivated = XALEDArrayItfImpl_IsLEDArrayActivated; - self->itf.SetColor = XALEDArrayItfImpl_SetColor; - self->itf.GetColor = XALEDArrayItfImpl_GetColor; - - /* init variables */ - self->lightMask = 0; - self->color.hue = 0; - self->color.saturation = 0; - self->color.lightness = 0; - self->adapCtx = adapCtx; - - self->self = self; - } - - DEBUG_API("<-XALEDArrayItfImpl_Create"); - return self; -} - -/* void XALEDArrayItfImpl_Free(XALEDArrayItfImpl* self) - * Description: Free all resources reserved at XALEDArrayItfImpl_Create - */ -void XALEDArrayItfImpl_Free(XALEDArrayItfImpl* self) -{ - DEBUG_API("->XALEDArrayItfImpl_Free"); - assert( self==self->self ); - free( self ); - DEBUG_API("<-XALEDArrayItfImpl_Free"); -} diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/ledarray/xaledarrayitf.h --- a/khronosfws/openmax_al/src/ledarray/xaledarrayitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XALEDARRAYITF_H -#define XALEDARRAYITF_H - -#include "xaadptbasectx.h" - -/** MACROS **/ -#define LED_COUNT 1 -#define PRIMARY_LED 0 -#define COLOR_MASK 1 - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XALEDArrayItf implementation */ -typedef struct XALEDArrayItfImpl_ -{ - /* parent interface */ - struct XALEDArrayItf_ itf; - /* pointer to self */ - struct XALEDArrayItfImpl_* self; - - /* variables */ - XAuint32 lightMask; - XAHSL color; - - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - -} XALEDArrayItfImpl; - -/** METHODS **/ - -/* Base interface XALEDArrayItf implementation - *See API Specification for method documentation - */ -XAresult XALEDArrayItfImpl_ActivateLEDArray ( XALEDArrayItf self, XAuint32 lightMask ); -XAresult XALEDArrayItfImpl_IsLEDArrayActivated ( XALEDArrayItf self, XAuint32 * pLightMask ); -XAresult XALEDArrayItfImpl_SetColor ( XALEDArrayItf self, XAuint8 index, const XAHSL * pColor ); -XAresult XALEDArrayItfImpl_GetColor ( XALEDArrayItf self, XAuint8 index, XAHSL * pColor ); -/* XALEDArrayItfImpl -specific methods */ - -XALEDArrayItfImpl* XALEDArrayItfImpl_Create( XAAdaptationBaseCtx *adapCtx ); -void XALEDArrayItfImpl_Free(XALEDArrayItfImpl* self); - - -#endif /* XALEDARRAYITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediaplayer/xamediaplayer.c --- a/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.c Fri Jul 09 16:43:35 2010 -0500 @@ -26,12 +26,7 @@ #include "xadynintmgmtitf.h" #include "xavolumeitf.h" #include "xametadataextractionitf.h" -#include "xametadatatraversalitf.h" #include "xaplaybackrateitf.h" -#include "xaequalizeritf.h" -#include "xaimagecontrolsitf.h" -#include "xaimageeffectsitf.h" -#include "xavideopostprocessingitf.h" #include "xaconfigextensionsitf.h" #include "xathreadsafety.h" #include "xametadataadaptation.h" @@ -46,24 +41,19 @@ /* Static mapping of enumeration XAMediaPlayerInterfaces to interface iids */ static const XAInterfaceID* xaMediaPlayerItfIIDs[MP_ITFCOUNT] = { - &XA_IID_OBJECT, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_PLAY, - &XA_IID_SEEK, - &XA_IID_VOLUME, - &XA_IID_PREFETCHSTATUS, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICSOURCE, - &XA_IID_EQUALIZER, - &XA_IID_IMAGECONTROLS, - &XA_IID_IMAGEEFFECTS, - &XA_IID_METADATAEXTRACTION, - &XA_IID_METADATATRAVERSAL, - &XA_IID_PLAYBACKRATE, - &XA_IID_VIDEOPOSTPROCESSING, - &XA_IID_NOKIAVOLUMEEXT, - &XA_IID_NOKIALINEARVOLUME, - &XA_IID_STREAMINFORMATION + &XA_IID_OBJECT, + &XA_IID_DYNAMICINTERFACEMANAGEMENT, + &XA_IID_PLAY, + &XA_IID_SEEK, + &XA_IID_VOLUME, + &XA_IID_PREFETCHSTATUS, + &XA_IID_CONFIGEXTENSION, + &XA_IID_DYNAMICSOURCE, + &XA_IID_METADATAEXTRACTION, + &XA_IID_PLAYBACKRATE, + &XA_IID_NOKIAVOLUMEEXT, + &XA_IID_NOKIALINEARVOLUME, + &XA_IID_STREAMINFORMATION }; /* Global methods */ @@ -164,13 +154,8 @@ } else { /* weed out unsupported content-aware itf's */ - if ((mediaType == XA_MEDIATYPE_IMAGE && (entry->mapIdx - == MP_SEEKITF || entry->mapIdx == MP_EQUALIZERITF - || entry->mapIdx == MP_VOLUMEITF)) || (mediaType - == XA_MEDIATYPE_AUDIO && (entry->mapIdx - == MP_IMAGECONTROLSITF || entry->mapIdx - == MP_IMAGEEFFECTSITF || entry->mapIdx - == MP_VIDEOPOSTPROCESSINGITF))) + if ((mediaType == XA_MEDIATYPE_IMAGE && (entry->mapIdx == MP_SEEKITF + || entry->mapIdx == MP_VOLUMEITF))) { entry->required = XA_BOOLEAN_FALSE; if (pInterfaceRequired[itfIdx]) @@ -196,12 +181,8 @@ /* Mark interfaces that can be handled dynamically */ /* Mandated dynamic itfs */ - pBaseObj->interfaceMap[MP_EQUALIZERITF].isDynamic = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MP_IMAGEEFFECTSITF].isDynamic = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MP_METADATAEXTRACTIONITF].isDynamic = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MP_METADATATRAVERSALITF].isDynamic - = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MP_PLAYBACKRATEITF].isDynamic = XA_BOOLEAN_TRUE; /*Set ObjectItf to point to newly created object*/ @@ -258,15 +239,6 @@ pPlayerImpl->curAdaptCtx = pPlayerImpl->adaptationCtxMMF; } - else - { - pPlayerImpl->adaptationCtxGst = XAMediaPlayerAdapt_Create( - pPlayerImpl->dataSrc, pPlayerImpl->bankSrc, - pPlayerImpl->audioSnk, pPlayerImpl->imageVideoSnk, - pPlayerImpl->vibra, pPlayerImpl->LEDArray); - - pPlayerImpl->curAdaptCtx = pPlayerImpl->adaptationCtxGst; - } pPlayerImpl->curAdaptCtx->capslist = capabilities; pPlayerImpl->curAdaptCtx->fwtype = fwType; @@ -401,10 +373,6 @@ pItf = XAMetadataExtractionItfImpl_Create( pImpl->curAdaptCtx); break; - case MP_METADATATRAVERSALITF: - pItf = XAMetadataTraversalItfImpl_Create( - pImpl->curAdaptCtx); - break; case MP_PLAYBACKRATEITF: pItf = XAPlaybackRateItfImpl_Create(pImpl); break; @@ -416,20 +384,6 @@ case MP_DYNAMICSOURCEITF: pItf = XADynamicSourceItfImpl_Create(pImpl->curAdaptCtx); break; - case MP_EQUALIZERITF: - pItf = XAEqualizerItfImpl_Create(pImpl->curAdaptCtx); - break; -#ifdef OMAX_CAMERABIN - case MP_IMAGECONTROLSITF: - pItf = XAImageControlsItfImpl_Create(pImpl->curAdaptCtx); - break; - case MP_IMAGEEFFECTSITF: - pItf = XAImageEffectsItfImpl_Create(pImpl->curAdaptCtx); - break; - case MP_VIDEOPOSTPROCESSINGITF: - pItf = XAVideoPostProcessingItfImpl_Create(pImpl->curAdaptCtx); - break; -#endif case MP_NOKIAVOLUMEEXT: pItf = XANokiaVolumeExtItfImpl_Create(pImpl->curAdaptCtx); break; @@ -464,11 +418,7 @@ ret = XAMediaPlayerAdaptMMF_PostInit( (XAAdaptationMMFCtx*) pImpl->adaptationCtxMMF); } - else - { - ret = XAMediaPlayerAdapt_PostInit( - (XAAdaptationGstCtx*) pImpl->adaptationCtxGst); - } + if (ret != XA_RESULT_SUCCESS) { XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -533,9 +483,6 @@ case MP_METADATAEXTRACTIONITF: XAMetadataExtractionItfImpl_Free(pItf); break; - case MP_METADATATRAVERSALITF: - XAMetadataTraversalItfImpl_Free(pItf); - break; case MP_PLAYBACKRATEITF: XAPlaybackRateItfImpl_Free(pItf); break; @@ -545,20 +492,6 @@ case MP_DYNAMICSOURCEITF: XADynamicSourceItfImpl_Free(pItf); break; - case MP_EQUALIZERITF: - XAEqualizerItfImpl_Free(pItf); - break; -#ifdef OMAX_CAMERABIN - case MP_IMAGECONTROLSITF: - XAImageControlsItfImpl_Free(pItf); - break; - case MP_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free(pItf); - break; - case MP_VIDEOPOSTPROCESSINGITF: - XAVideoPostProcessingItfImpl_Free(pItf); - break; -#endif case MP_NOKIAVOLUMEEXT: XANokiaVolumeExtItfImpl_Free(pItf); break; @@ -581,11 +514,6 @@ XAMediaPlayerAdaptMMF_Destroy( (XAAdaptationMMFCtx*) pImpl->adaptationCtxMMF); } - else - { - XAMediaPlayerAdapt_Destroy( - (XAAdaptationGstCtx*) pImpl->adaptationCtxGst); - } } XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); @@ -615,22 +543,9 @@ mapEntry->pItf = XAMetadataExtractionItfImpl_Create( pImpl->curAdaptCtx); break; - case MP_METADATATRAVERSALITF: - mapEntry->pItf = XAMetadataTraversalItfImpl_Create( - pImpl->curAdaptCtx); - break; case MP_PLAYBACKRATEITF: mapEntry->pItf = XAPlaybackRateItfImpl_Create(pImpl); break; - case MP_EQUALIZERITF: - mapEntry->pItf - = XAEqualizerItfImpl_Create(pImpl->curAdaptCtx); - break; -#ifdef OMAX_CAMERABIN - case MP_IMAGEEFFECTSITF: - mapEntry->pItf = XAImageEffectsItfImpl_Create( pImpl->curAdaptCtx ); - break; -#endif default: DEBUG_ERR("XAMediaPlayerImpl_DoAddItf unknown id") ; @@ -683,20 +598,9 @@ case MP_METADATAEXTRACTIONITF: XAMetadataExtractionItfImpl_Free(mapEntry->pItf); break; - case MP_METADATATRAVERSALITF: - XAMetadataTraversalItfImpl_Free(mapEntry->pItf); - break; case MP_PLAYBACKRATEITF: XAPlaybackRateItfImpl_Free(mapEntry->pItf); break; - case MP_EQUALIZERITF: - XAEqualizerItfImpl_Free(mapEntry->pItf); - break; -#ifdef OMAX_CAMERABIN - case MP_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free(mapEntry->pItf); - break; -#endif default: DEBUG_ERR("XAMediaPlayerImpl_DoRemoveItf unknown id") ; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediaplayer/xamediaplayer.h --- a/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xamediaplayer.h Fri Jul 09 16:43:35 2010 -0500 @@ -21,7 +21,6 @@ #include "openmaxalwrapper.h" #include "xaglobals.h" #include "xaobjectitf.h" -#include "xamediaplayeradaptctx.h" #include "xamediaplayeradaptctxmmf.h" #include "xacapabilitiesmgr.h" /** MACROS **/ @@ -40,13 +39,8 @@ MP_PREFETCHSTATUSITF, MP_CONFIGEXTENSIONITF, MP_DYNAMICSOURCEITF, - MP_EQUALIZERITF, - MP_IMAGECONTROLSITF, - MP_IMAGEEFFECTSITF, MP_METADATAEXTRACTIONITF, - MP_METADATATRAVERSALITF, MP_PLAYBACKRATEITF, - MP_VIDEOPOSTPROCESSINGITF, MP_NOKIAVOLUMEEXT, MP_NOKIALINEARVOLUME, MP_STREAMINFORMATIONITF, diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediaplayer/xaplaybackrateitf.c --- a/khronosfws/openmax_al/src/mediaplayer/xaplaybackrateitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaplaybackrateitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -20,7 +20,6 @@ #include #include "xaplaybackrateitf.h" -#include "xaplaybackrateitfadaptation.h" #include "xaplaybackrateitfadaptationmmf.h" #include "xathreadsafety.h" @@ -57,11 +56,7 @@ return XA_RESULT_PARAMETER_INVALID; } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - res = XAPlaybackRateItfAdapt_SetRate((XAAdaptationGstCtx*)impl->adaptCtx, rate); - } - else if(impl->adaptCtx->fwtype == FWMgrFWMMF) + if(impl->adaptCtx->fwtype == FWMgrFWMMF) { res = XAPlaybackRateItfAdaptMMF_SetRate((XAAdaptationMMFCtx*)impl->adaptCtx, rate); } @@ -93,11 +88,8 @@ DEBUG_API("<-XAPlaybackRateItfImpl_GetRate"); return XA_RESULT_PARAMETER_INVALID; } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - *pRate = impl->currentRate; - } - else if(impl->adaptCtx->fwtype == FWMgrFWMMF) + + if(impl->adaptCtx->fwtype == FWMgrFWMMF) { *pRate = impl->currentRate; } @@ -127,12 +119,7 @@ return XA_RESULT_PARAMETER_INVALID; } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - /* set to adaptation */ - res = XAPlaybackRateItfAdapt_SetPropertyConstraints((XAAdaptationGstCtx*)impl->adaptCtx, constraints); - } - else if(impl->adaptCtx->fwtype == FWMgrFWMMF) + if(impl->adaptCtx->fwtype == FWMgrFWMMF) { /* set to adaptation */ res = XAPlaybackRateItfAdaptMMF_SetPropertyConstraints((XAAdaptationMMFCtx*)impl->adaptCtx, constraints); @@ -162,12 +149,7 @@ return XA_RESULT_PARAMETER_INVALID; } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - /* needs to be queried from adaptation */ - res = XAPlaybackRateItfAdapt_GetProperties((XAAdaptationGstCtx*)impl->adaptCtx, pProperties); - } - else if(impl->adaptCtx->fwtype == FWMgrFWMMF) + if(impl->adaptCtx->fwtype == FWMgrFWMMF) { /* needs to be queried from adaptation */ res = XAPlaybackRateItfAdaptMMF_GetProperties((XAAdaptationMMFCtx*)impl->adaptCtx, pProperties); @@ -200,12 +182,7 @@ return XA_RESULT_PARAMETER_INVALID; } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - /* needs to be queried from adaptation */ - res = XAPlaybackRateItfAdapt_GetCapabilitiesOfRate((XAAdaptationGstCtx*)impl->adaptCtx, rate, pCapabilities); - } - else if(impl->adaptCtx->fwtype == FWMgrFWMMF) + if(impl->adaptCtx->fwtype == FWMgrFWMMF) { /* needs to be queried from adaptation */ res = XAPlaybackRateItfAdaptMMF_GetCapabilitiesOfRate((XAAdaptationMMFCtx*)impl->adaptCtx, rate, pCapabilities); @@ -240,13 +217,8 @@ DEBUG_API("<-XAPlaybackRateItfImpl_GetRateRange"); return XA_RESULT_PARAMETER_INVALID; } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - /* needs to be queried from adaptation */ - res = XAPlaybackRateItfAdapt_GetRateRange((XAAdaptationGstCtx*)impl->adaptCtx, index, pMinRate, - pMaxRate,pStepSize, pCapabilities); - } - else if(impl->adaptCtx->fwtype == FWMgrFWMMF) + + if(impl->adaptCtx->fwtype == FWMgrFWMMF) { /* needs to be queried from adaptation */ res = XAPlaybackRateItfAdaptMMF_GetRateRange((XAAdaptationMMFCtx*)impl->adaptCtx, index, pMinRate, diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediaplayer/xaplayitf.c --- a/khronosfws/openmax_al/src/mediaplayer/xaplayitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaplayitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -21,8 +21,6 @@ #include "xaplayitf.h" -#include "xaplayitfadaptation.h" - #include "xaplayitfadaptationmmf.h" #include "xathreadsafety.h" #include @@ -73,31 +71,6 @@ { ret = XAPlayItfAdaptMMF_SetPlayState(impl->pObjImpl->curAdaptCtx, state); - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_API("<-XAPlayItfImpl_SetPlayState"); - return ret; - } - - /* check is play state changed, if not do nothing */ - if (state != impl->playbackState) - { - if (state == XA_PLAYSTATE_PLAYING) - { - XAPlayItfAdaptGST_GetPosition( - (XAAdaptationGstCtx*) impl->adapCtx, - &(impl->lastPosition)); - } - ret = XAPlayItfAdaptGST_SetPlayState(impl->adapCtx, state); - - if (ret == XA_RESULT_SUCCESS) - { - impl->playbackState = state; - if (state == XA_PLAYSTATE_STOPPED || state == XA_PLAYSTATE_PAUSED) - { - impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; - impl->lastPosition = 0; - } - } } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -131,10 +104,6 @@ ret = XAPlayItfAdaptMMF_GetPlayState(impl->pObjImpl->curAdaptCtx, pState); } - else - { - *pState = impl->playbackState; - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -167,11 +136,6 @@ ret = XAPlayItfAdaptMMF_GetDuration(impl->pObjImpl->curAdaptCtx, pMsec); } - else - { - ret = XAPlayItfAdaptGST_GetDuration( - (XAAdaptationGstCtx*) impl->adapCtx, pMsec); - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); @@ -206,19 +170,6 @@ ret = XAPlayItfAdaptMMF_GetPosition(impl->pObjImpl->curAdaptCtx, pMsec); } - else - { - - if (impl->playbackState == XA_PLAYSTATE_STOPPED) - { - *pMsec = 0; - DEBUG_API("<-XAPlayItfImpl_GetPosition"); - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - return XA_RESULT_SUCCESS; - } - ret = XAPlayItfAdaptGST_GetPosition( - (XAAdaptationGstCtx*) impl->adapCtx, pMsec); - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_GetPosition"); @@ -289,7 +240,8 @@ | XA_PLAYEVENT_HEADMOVING | XA_PLAYEVENT_HEADSTALLED))) { /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); return XA_RESULT_PARAMETER_INVALID; } @@ -307,29 +259,6 @@ return ret; } - /* enable position tracking if client wants so */ - if ((eventFlags & (XA_PLAYEVENT_HEADATMARKER | XA_PLAYEVENT_HEADATNEWPOS)) - && impl->adapCtx && !impl->positionupdateOn) - { - ret = XAPlayItfAdapt_EnablePositionTracking( - (XAAdaptationGstCtx*) impl->adapCtx, XA_BOOLEAN_TRUE); - if (ret == XA_RESULT_SUCCESS) - { - impl->positionupdateOn = XA_BOOLEAN_TRUE; - } - } - else if (!(eventFlags & (XA_PLAYEVENT_HEADATMARKER - | XA_PLAYEVENT_HEADATNEWPOS)) && impl->adapCtx - && impl->positionupdateOn) - { - ret = XAPlayItfAdapt_EnablePositionTracking( - (XAAdaptationGstCtx*) impl->adapCtx, XA_BOOLEAN_FALSE); - if (ret == XA_RESULT_SUCCESS) - { - impl->positionupdateOn = XA_BOOLEAN_FALSE; - } - } - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XAPlayItfImpl_SetCallbackEventsMask"); return ret; @@ -608,7 +537,6 @@ void XAPlayItfImpl_AdaptCb(void *pHandlerCtx, XAAdaptEvent *event) { XAPlayItfImpl* impl = (XAPlayItfImpl*) pHandlerCtx; - XAuint32 newpos = 0; DEBUG_API("->XAPlayItfImpl_AdaptCb"); XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); @@ -629,101 +557,6 @@ return; } - /* check position update events */ - if (event->eventid == XA_ADAPT_POSITION_UPDATE_EVT) - { - assert(event->data); - newpos = *((XAuint32*) (event->data)); - DEBUG_API_A1("Position update from adaptation: new position %lu ms",newpos); - - /* Check is looping start file playing before marker position */ - if (newpos < impl->markerPosition || impl->lastPosition > newpos) - { - DEBUG_INFO("Restart looping, clear marker position callback flag."); - impl->isMarkerPosCbSend = XA_BOOLEAN_FALSE; - } - - /* check if marker passed and callback needed */ - if ((impl->markerPosition != NO_POSITION) && (impl->eventFlags - & XA_PLAYEVENT_HEADATMARKER)) - { - if (impl->callback && (((impl->lastPosition - < impl->markerPosition) - && (newpos > impl->markerPosition)) || (newpos - == impl->markerPosition))) - { - /* Check is callback already send */ - if (impl->isMarkerPosCbSend != XA_BOOLEAN_TRUE) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, - XA_PLAYEVENT_HEADATMARKER); - impl->isMarkerPosCbSend = XA_BOOLEAN_TRUE; - } - } - } - /* check if update period passed and callback needed */ - if ((impl->positionUpdatePeriod > 0) && (impl->eventFlags - & XA_PLAYEVENT_HEADATNEWPOS) && impl->callback) - { - if ((XAuint32) ((impl->lastPosition) - / (impl->positionUpdatePeriod)) < (XAuint32) (newpos - / (impl->positionUpdatePeriod))) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, - XA_PLAYEVENT_HEADATNEWPOS); - } - } - /* store position */ - impl->lastPosition = newpos; - } - - /* check other events */ - else if (event->eventid == XA_PLAYEVENT_HEADATEND) - { - impl->playbackState = XA_PLAYSTATE_STOPPED; - impl->lastPosition = 0; - /* send callback if needed */ - if ((XA_PLAYEVENT_HEADATEND & impl->eventFlags) && impl->callback) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, - XA_PLAYEVENT_HEADATEND); - } - } - else if (event->eventid == XA_PLAYEVENT_HEADSTALLED) - { - impl->playbackState = XA_PLAYSTATE_PAUSED; - if (impl->adapCtx->fwtype == FWMgrFWMMF) - { - //XAPlayItfAdaptMMF_GetPosition((XAAdaptationGstCtx*)impl->adapCtx, &(impl->lastPosition)); - } - else - { - XAPlayItfAdaptGST_GetPosition( - (XAAdaptationGstCtx*) impl->adapCtx, - &(impl->lastPosition)); - } - /* send callback if needed */ - if ((XA_PLAYEVENT_HEADSTALLED & impl->eventFlags) && impl->callback) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, - XA_PLAYEVENT_HEADSTALLED); - } - } - else if (event->eventid == XA_PLAYEVENT_HEADMOVING) - { - impl->playbackState = XA_PLAYSTATE_PLAYING; - /* send callback if needed */ - if ((XA_PLAYEVENT_HEADMOVING & impl->eventFlags) && impl->callback) - { - impl->callback(impl->cbPtrToSelf, impl->cbcontext, - XA_PLAYEVENT_HEADMOVING); - } - } - else - { - /* do nothing */ - } - DEBUG_API("<-XAPlayItfImpl_AdaptCb"); XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS( XATSMediaPlayer ); } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediaplayer/xaseekitf.c --- a/khronosfws/openmax_al/src/mediaplayer/xaseekitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediaplayer/xaseekitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -20,9 +20,6 @@ #include #include "xaseekitf.h" - -#include "xaseekitfadaptation.h" -#include "xaplayitfadaptation.h" #include "xathreadsafety.h" #include "xaplayitfadaptationmmf.h" #include "xaseekitfadaptationmmf.h" @@ -108,46 +105,6 @@ impl->seekMode = seekMode; } } - else - { - /* Get duration of the content */ - if (XAPlayItfAdaptGST_GetDuration( - (XAAdaptationGstCtx*) impl->adapCtx, &duration) - != XA_RESULT_SUCCESS) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfImpl_SetPosition"); - return XA_RESULT_PARAMETER_INVALID; - } - if (pos > duration) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfImpl_SetPosition"); - return XA_RESULT_PARAMETER_INVALID; - } - - if (seekMode != XA_SEEKMODE_FAST && seekMode != XA_SEEKMODE_ACCURATE) - { - /* seek mode unsupported */ - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASeekItfImpl_SetPosition"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - - ret = XASeekItfAdapt_SetPosition((XAAdaptationGstCtx*) impl->adapCtx, - pos, seekMode); - if (ret == XA_RESULT_SUCCESS) - { - impl->playbackPosition = pos; - impl->seekMode = seekMode; - } - - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XASeekItfImpl_SetPosition"); @@ -208,38 +165,6 @@ impl->endPos = endPos; } } - else - { - /* Get duration of the content */ - if (XAPlayItfAdaptGST_GetDuration( - (XAAdaptationGstCtx*) impl->adapCtx, &duration) - != XA_RESULT_SUCCESS) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfImpl_SetLoop"); - return XA_RESULT_PARAMETER_INVALID; - } - if (endPos > duration && endPos != XA_TIME_UNKNOWN) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASeekItfImpl_SetLoop"); - return XA_RESULT_PARAMETER_INVALID; - } - - ret = XASeekItfAdapt_SetLoop((XAAdaptationGstCtx*) impl->adapCtx, - loopEnable, startPos, endPos); - if (ret == XA_RESULT_SUCCESS) - { - impl->loopEnable = loopEnable; - impl->startPos = startPos; - impl->endPos = endPos; - } - - } XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaPlayer ); DEBUG_API("<-XASeekItfImpl_SetLoop"); @@ -305,7 +230,8 @@ self->adapCtx = impl->curAdaptCtx; self->self = self; - }DEBUG_API("<-XASeekItfImpl_Create"); + } + DEBUG_API("<-XASeekItfImpl_Create"); return self; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xaaudioencoderitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -258,7 +258,8 @@ { ret = XAAudioEncoderItfAdapt_GetEncoderSettings(impl->adapCtx, pSettings); - }DEBUG_API("<-XAAudioEncoderItfImpl_GetEncoderSettings"); + } + DEBUG_API("<-XAAudioEncoderItfImpl_GetEncoderSettings"); return ret; } @@ -292,7 +293,8 @@ self->adapCtx = impl->adaptationCtx; self->self = self; - }DEBUG_API("<-XAAudioEncoderItfImpl_Create"); + } + DEBUG_API("<-XAAudioEncoderItfImpl_Create"); return self; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xaimageencoderitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xaimageencoderitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,283 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "xaimageencoderitf.h" - -#include "xaimageencoderitfadaptation.h" -#include "xarecorditfadaptation.h" -#include "xathreadsafety.h" -#include "xacapabilitiesmgr.h" - -#define APPROX_MAXRATIO (90/100) - -/* static XAImageEncoderItfImpl* GetImpl(XAImageEncoderItf self) - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAImageEncoderItfImpl* GetImpl(XAImageEncoderItf self) -{ - if( self ) - { - XAImageEncoderItfImpl* impl = (XAImageEncoderItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/***************************************************************************** - * Base interface XAImageEncoderItf implementation - *****************************************************************************/ - -/* XAresult XAImageEncoderItfImpl_SetImageSettings - * Description: Set image encoder settings. - */ -XAresult XAImageEncoderItfImpl_SetImageSettings(XAImageEncoderItf self, - const XAImageSettings *pSettings) -{ - XAresult res = XA_RESULT_SUCCESS; - XACapabilities temp; - XAImageEncoderItfImpl *impl = GetImpl(self); - - DEBUG_API("->XAImageEncoderItfImpl_SetImageSettings"); - XA_IMPL_THREAD_SAFETY_ENTRY( XATSMediaRecorder ); - - if( !impl || !pSettings ) - { - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEncoderItfImpl_SetImageSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - res = XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_ENCODER|XACAP_IMAGE), pSettings->encoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { -#ifdef OMAX_CAMERABIN - res = XAImageEncoderItfAdapt_SetImageSettings((XAAdaptationGstCtx*)impl->adaptCtx, pSettings); -#endif - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT( XATSMediaRecorder ); - - DEBUG_API("<-XAImageEncoderItfImpl_SetImageSettings"); - return res; -} - -/* XAresult XAImageEncoderItfImpl_GetImageSettings - * Description: Get image encoder settings. - */ -XAresult XAImageEncoderItfImpl_GetImageSettings(XAImageEncoderItf self, - XAImageSettings *pSettings) -{ - XAresult res = XA_RESULT_SUCCESS; - XAImageEncoderItfImpl *impl = GetImpl(self); - - DEBUG_API("->XAImageEncoderItfImpl_GetImageSettings"); - if( !impl || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEncoderItfImpl_GetImageSettings"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { -#ifdef OMAX_CAMERABIN - res = XAImageEncoderItfAdapt_GetImageSettings((XAAdaptationGstCtx*)impl->adaptCtx, pSettings); -#endif - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEncoderItfImpl_GetImageSettings"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - - DEBUG_API("<-XAImageEncoderItfImpl_GetImageSettings"); - return res; -} - -/* XAresult XAImageEncoderItfImpl_GetSizeEstimate - * Description: Get estimated image size. - */ -XAresult XAImageEncoderItfImpl_GetSizeEstimate(XAImageEncoderItf self, - XAuint32 *pSize) -{ - XAuint32 bpp = 0; /*bytes per pixel*/ - XAuint32 compPct = 0; /*compression percentage*/ - XAImageEncoderItfImpl *impl = GetImpl(self); - XAImageSettings curSettings = {0,0,0,0,0}; - DEBUG_API("->XAImageEncoderItfImpl_GetImageSettings"); - - if( !impl || !pSize ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAImageEncoderItfImpl_GetImageSettings"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - /* calculate size estimate */ - - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { -#ifdef OMAX_CAMERABIN - XAImageEncoderItfAdapt_GetImageSettings((XAAdaptationGstCtx*)impl->adaptCtx, &curSettings); -#endif - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XAImageEncoderItfImpl_GetSizeEstimate"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - - switch(curSettings.colorFormat) - { - case XA_COLORFORMAT_MONOCHROME: - bpp = 1; - break; - case XA_COLORFORMAT_L2: - bpp = 2; - break; - case XA_COLORFORMAT_L4: - bpp = 4; - break; - case XA_COLORFORMAT_8BITRGB332: - case XA_COLORFORMAT_RAWBAYER8BIT: - case XA_COLORFORMAT_RAWBAYER8BITCOMPRESSED: - case XA_COLORFORMAT_L8: - bpp = 8; - break; - case XA_COLORFORMAT_RAWBAYER10BIT: - bpp = 10; - break; - case XA_COLORFORMAT_12BITRGB444: - case XA_COLORFORMAT_YUV444INTERLEAVED: - case XA_COLORFORMAT_YUV411PLANAR: - case XA_COLORFORMAT_YUV420PLANAR: - case XA_COLORFORMAT_YUV420SEMIPLANAR: - bpp = 12; - break; - case XA_COLORFORMAT_16BITARGB4444: - case XA_COLORFORMAT_16BITARGB1555: - case XA_COLORFORMAT_16BITRGB565: - case XA_COLORFORMAT_16BITBGR565: - case XA_COLORFORMAT_YCBYCR: - case XA_COLORFORMAT_YCRYCB: - case XA_COLORFORMAT_CBYCRY: - case XA_COLORFORMAT_CRYCBY: - case XA_COLORFORMAT_L16: - case XA_COLORFORMAT_YUV422PLANAR: - case XA_COLORFORMAT_YUV422SEMIPLANAR: - bpp = 16; - break; - case XA_COLORFORMAT_18BITRGB666: - case XA_COLORFORMAT_18BITARGB1665: - case XA_COLORFORMAT_18BITBGR666: - bpp = 18; - break; - case XA_COLORFORMAT_19BITARGB1666: - bpp = 19; - break; - case XA_COLORFORMAT_24BITRGB888: - case XA_COLORFORMAT_24BITBGR888: - case XA_COLORFORMAT_24BITARGB1887: - case XA_COLORFORMAT_24BITARGB6666: - case XA_COLORFORMAT_24BITABGR6666: - case XA_COLORFORMAT_L24: - bpp = 24; - break; - case XA_COLORFORMAT_25BITARGB1888: - bpp = 25; - break; - case XA_COLORFORMAT_32BITBGRA8888: - case XA_COLORFORMAT_32BITARGB8888: - case XA_COLORFORMAT_L32: - bpp = 32; - break; - default: - bpp = 8; - break; - } - - compPct = (1000 - (curSettings.compressionLevel*APPROX_MAXRATIO))/1000; - - /* numofpixels * colorformat(bits/pixel) * compression rate */ - *pSize = (curSettings.height * curSettings.width ) * bpp/8 * compPct; - - DEBUG_API("<-XAImageEncoderItfImpl_GetImageSettings"); - return XA_RESULT_SUCCESS; -} -/***************************************************************************** - * XAImageEncoderItfImpl -specific methods - *****************************************************************************/ - - -/* XAImageEncoderItfImpl* XAImageEncoderItfImpl_Create() - * Description: Allocate and initialize ImageEncoderItfImpl - */ -XAImageEncoderItfImpl* XAImageEncoderItfImpl_Create(XAMediaRecorderImpl* impl) -{ - XAImageEncoderItfImpl* self = (XAImageEncoderItfImpl*) - calloc(1,sizeof(XAImageEncoderItfImpl)); - //XAMediaRecorderAdaptationCtx* mCtx = (XAMediaRecorderAdaptationCtx*)(impl->adaptationCtx); - - DEBUG_API("->XAImageEncoderItfImpl_Create"); - if( self ) - { - //if(mCtx->fwtype == FWMgrFWGST) - { - /* init itf default implementation */ - self->itf.GetImageSettings = XAImageEncoderItfImpl_GetImageSettings; - self->itf.SetImageSettings = XAImageEncoderItfImpl_SetImageSettings; - self->itf.GetSizeEstimate = XAImageEncoderItfImpl_GetSizeEstimate; - } - - /* init variables */ - self->adaptCtx = impl->adaptationCtx; - - self->self = self; - } - DEBUG_API("<-XAImageEncoderItfImpl_Create"); - return self; -} - -/* void XAImageEncoderItfImpl_Free(XAImageEncoderItfImpl* self) - * Description: Free all resources reserved at XAImageEncoderItfImpl_Create() - */ -void XAImageEncoderItfImpl_Free(XAImageEncoderItfImpl* self) -{ - DEBUG_API("->XAImageEncoderItfImpl_Free"); - assert( self==self->self ); - free( self ); - DEBUG_API("<-XAImageEncoderItfImpl_Free"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xaimageencoderitf.h --- a/khronosfws/openmax_al/src/mediarecorder/xaimageencoderitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,60 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAIMAGEENCODERITF_H -#define XAIMAGEENCODERITF_H - -#include "xamediarecorder.h" -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAImageEncoderItf implementation */ -typedef struct XAImageEncoderItfImpl_ -{ - /* parent interface */ - struct XAImageEncoderItf_ itf; - /* pointer to self */ - struct XAImageEncoderItfImpl_* self; - /* variables */ - XAAdaptationBaseCtx *adaptCtx; - -} XAImageEncoderItfImpl; - -/** METHODS **/ - -/* Base interface XAImageEncoderItf implementation - * See API Specification for method documentation - */ -XAresult XAImageEncoderItfImpl_SetImageSettings(XAImageEncoderItf self, - const XAImageSettings *pSettings); - -XAresult XAImageEncoderItfImpl_GetImageSettings(XAImageEncoderItf self, - XAImageSettings *pSettings); - -XAresult XAImageEncoderItfImpl_GetSizeEstimate(XAImageEncoderItf self, - XAuint32 * pSize); - - -/* XAImageEncoderItfImpl -specific methods */ -XAImageEncoderItfImpl* XAImageEncoderItfImpl_Create(XAMediaRecorderImpl* impl); -void XAImageEncoderItfImpl_Free(XAImageEncoderItfImpl* self); - -#endif /* XAIMAGEENCODERITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xamediarecorder.c --- a/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.c Fri Jul 09 16:43:35 2010 -0500 @@ -22,18 +22,10 @@ #include "xaaudioencoderitf.h" #include "xaconfigextensionsitf.h" #include "xadynintmgmtitf.h" -#include "xaequalizeritf.h" -#include "xaimagecontrolsitf.h" -#include "xaimageeffectsitf.h" -#include "xaimageencoderitf.h" #include "xametadatainsertionitf.h" #include "xarecorditf.h" -#include "xasnapshotitf.h" -#include "xavideoencoderitf.h" -#include "xavideopostprocessingitf.h" #include "xavolumeitf.h" #include "xametadataextractionitf.h" -#include "xametadatatraversalitf.h" #include "xathreadsafety.h" #include #include "xacapabilitiesmgr.h" @@ -42,22 +34,14 @@ /* Static mapping of enumeration XAMediaRecorderInterfaces to interface iids */ static const XAInterfaceID* xaMediaRecorderItfIIDs[MR_ITFCOUNT] = { - &XA_IID_OBJECT, - &XA_IID_AUDIOENCODER, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_EQUALIZER, - &XA_IID_IMAGECONTROLS, - &XA_IID_IMAGEEFFECTS, - &XA_IID_IMAGEENCODER, - &XA_IID_METADATAINSERTION, - &XA_IID_RECORD, - &XA_IID_SNAPSHOT, - &XA_IID_VIDEOENCODER, - &XA_IID_VIDEOPOSTPROCESSING, - &XA_IID_VOLUME, - &XA_IID_METADATAEXTRACTION, - &XA_IID_METADATATRAVERSAL + &XA_IID_OBJECT, + &XA_IID_AUDIOENCODER, + &XA_IID_CONFIGEXTENSION, + &XA_IID_DYNAMICINTERFACEMANAGEMENT, + &XA_IID_METADATAINSERTION, + &XA_IID_RECORD, + &XA_IID_VOLUME, + &XA_IID_METADATAEXTRACTION }; /* Global methods */ @@ -128,12 +112,7 @@ { pBaseObj->interfaceMap[MR_AUDIOENCODERITF].required = XA_BOOLEAN_TRUE; } - if (pImageVideoSrc && mediaType != XA_MEDIATYPE_AUDIO) - { - pBaseObj->interfaceMap[MR_VIDEOENCODER].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MR_IMAGEENCODERITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MR_SNAPSHOTITF].required = XA_BOOLEAN_TRUE; - } + pBaseObj->interfaceMap[MR_DIMITF].required = XA_BOOLEAN_TRUE; /* Explicit interfaces */ @@ -163,17 +142,8 @@ } else { /* weed out unsupported content-aware itf's */ - if (((mediaType == XA_MEDIATYPE_IMAGE || !pAudioSrc) - && (entry->mapIdx == MR_EQUALIZERITF || entry->mapIdx - == MR_VOLUMEITF || entry->mapIdx - == MR_AUDIOENCODERITF)) || ((mediaType - == XA_MEDIATYPE_AUDIO || !pImageVideoSrc) - && (entry->mapIdx == MR_IMAGECONTROLSITF - || entry->mapIdx == MR_IMAGEEFFECTSITF - || entry->mapIdx == MR_VIDEOPOSTPROCESSINGITF - || entry->mapIdx == MR_VIDEOENCODER - || entry->mapIdx == MR_IMAGEENCODERITF - || entry->mapIdx == MR_SNAPSHOTITF))) + if ((mediaType == XA_MEDIATYPE_IMAGE || !pAudioSrc) + && (entry->mapIdx == MR_VOLUMEITF || entry->mapIdx == MR_AUDIOENCODERITF)) { entry->required = XA_BOOLEAN_FALSE; if (pInterfaceRequired[itfIdx]) @@ -188,11 +158,6 @@ entry->required = XA_BOOLEAN_TRUE; } - if (entry->mapIdx == MR_SNAPSHOTITF) - { - DEBUG_ERR("SnapshotItf requested - support still mode"); - pImpl->recModes |= XA_RECMODE_STILL; - } if (entry->mapIdx == MR_RECORDITF) { DEBUG_ERR("RecordItf requested - support stream mode"); @@ -235,8 +200,6 @@ /* Mandated dynamic itfs */ pBaseObj->interfaceMap[MR_METADATAINSERTIONITF].isDynamic = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MR_EQUALIZERITF].isDynamic = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MR_IMAGEEFFECTSITF].isDynamic = XA_BOOLEAN_TRUE; /* Initialize XAMediaRecorderImpl variables */ pImpl->audioSrc = pAudioSrc; @@ -412,17 +375,6 @@ case MR_AUDIOENCODERITF: pItf = XAAudioEncoderItfImpl_Create(pObjImpl); break; -#ifdef OMAX_CAMERABIN - case MR_SNAPSHOTITF: - pItf = XASnapshotItfImpl_Create(pObjImpl); - break; - case MR_VIDEOENCODER: - pItf = XAVideoEncoderItfImpl_Create(pObjImpl); - break; - case MR_IMAGEENCODERITF: - pItf = XAImageEncoderItfImpl_Create(pObjImpl); - break; -#endif case MR_METADATAINSERTIONITF: pItf = XAMetadataInsertionItfImpl_Create(pObjImpl); break; @@ -432,20 +384,6 @@ XAConfigExtensionsItfImpl_SetContext(pItf, pObjImpl->adaptationCtx); break; - case MR_EQUALIZERITF: - pItf = XAEqualizerItfImpl_Create(pObjImpl->adaptationCtx); - break; -#ifdef OMAX_CAMERABIN - case MR_IMAGECONTROLSITF: - pItf = XAImageControlsItfImpl_Create( pObjImpl->adaptationCtx ); - break; - case MR_IMAGEEFFECTSITF: - pItf = XAImageEffectsItfImpl_Create( pObjImpl->adaptationCtx ); - break; - case MR_VIDEOPOSTPROCESSINGITF: - pItf = XAVideoPostProcessingItfImpl_Create( pObjImpl->adaptationCtx ); - break; -#endif case MR_VOLUMEITF: pItf = XAVolumeItfImpl_Create(pObjImpl->adaptationCtx); break; @@ -453,11 +391,6 @@ pItf = XAMetadataExtractionItfImpl_Create( pObjImpl->adaptationCtx); break; - case MR_METADATATRAVERSALITF: - pItf = XAMetadataTraversalItfImpl_Create( - pObjImpl->adaptationCtx); - break; - default: break; } @@ -522,46 +455,18 @@ case MR_DIMITF: XADIMItfImpl_Free(pItf); break; - case MR_EQUALIZERITF: - XAEqualizerItfImpl_Free(pItf); - break; -#ifdef OMAX_CAMERABIN - case MR_IMAGECONTROLSITF: - XAImageControlsItfImpl_Free(pItf); - break; - case MR_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free(pItf); - break; - case MR_IMAGEENCODERITF: - XAImageEncoderItfImpl_Free(pItf); - break; -#endif case MR_METADATAINSERTIONITF: XAMetadataInsertionItfImpl_Free(pItf); break; case MR_RECORDITF: XARecordItfImpl_Free(pItf); break; -#ifdef OMAX_CAMERABIN - case MR_SNAPSHOTITF: - XASnapshotItfImpl_Free(pItf); - break; - case MR_VIDEOENCODER: - XAVideoEncoderItfImpl_Free(pItf); - break; - case MR_VIDEOPOSTPROCESSINGITF: - XAVideoPostProcessingItfImpl_Free(pItf); - break; -#endif case MR_VOLUMEITF: XAVolumeItfImpl_Free(pItf); break; case MR_METADATAEXTRACTIONITF: XAMetadataExtractionItfImpl_Free(pItf); break; - case MR_METADATATRAVERSALITF: - XAMetadataTraversalItfImpl_Free(pItf); - break; default: break; } @@ -618,18 +523,8 @@ case MR_METADATAINSERTIONITF: mapEntry->pItf = XAMetadataInsertionItfImpl_Create(pImpl); break; - case MR_EQUALIZERITF: - mapEntry->pItf = XAEqualizerItfImpl_Create( - pImpl->adaptationCtx); - break; -#ifdef OMAX_CAMERABIN - case MR_IMAGEEFFECTSITF: - mapEntry->pItf = XAImageEffectsItfImpl_Create( pImpl->adaptationCtx ); - break; -#endif default: - DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id") - ; + DEBUG_ERR("XAMediaRecorderImpl_DoAddItf unknown id"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; } @@ -682,17 +577,8 @@ case MR_METADATAINSERTIONITF: XAMetadataInsertionItfImpl_Free(mapEntry->pItf); break; - case MR_EQUALIZERITF: - XAEqualizerItfImpl_Free(mapEntry->pItf); - break; -#ifdef OMAX_CAMERABIN - case MR_IMAGEEFFECTSITF: - XAImageEffectsItfImpl_Free( mapEntry->pItf ); - break; -#endif default: - DEBUG_ERR("XAMediaRecorderImpl_DoRemoveItf unknown id") - ; + DEBUG_ERR("XAMediaRecorderImpl_DoRemoveItf unknown id"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xamediarecorder.h --- a/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xamediarecorder.h Fri Jul 09 16:43:35 2010 -0500 @@ -36,18 +36,10 @@ MR_AUDIOENCODERITF, MR_CONFIGEXTENSIONITF, MR_DIMITF, - MR_EQUALIZERITF, - MR_IMAGECONTROLSITF, - MR_IMAGEEFFECTSITF, - MR_IMAGEENCODERITF, MR_METADATAINSERTIONITF, MR_RECORDITF, - MR_SNAPSHOTITF, - MR_VIDEOENCODER, - MR_VIDEOPOSTPROCESSINGITF, MR_VOLUMEITF, MR_METADATAEXTRACTIONITF, - MR_METADATATRAVERSALITF, MR_ITFCOUNT } MRInterfaces; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xametadatainsertionitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -64,7 +64,6 @@ } else { - if (impl->adaptCtx && impl->adaptCtx->fwtype == FWMgrFWGST) { if (impl->adaptCtx) @@ -85,7 +84,8 @@ DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); return XA_RESULT_FEATURE_UNSUPPORTED; } - }DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_CreateChildNode"); return ret; } @@ -129,7 +129,8 @@ DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); return XA_RESULT_PARAMETER_INVALID; } - }DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_GetSupportedKeysCount"); return ret; } @@ -173,7 +174,8 @@ DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); return XA_RESULT_PARAMETER_INVALID; } - }DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_GetKeySize"); return ret; } @@ -219,7 +221,8 @@ return XA_RESULT_PARAMETER_INVALID; } - }DEBUG_API("<-XAMetadataInsertionItfImpl_GetKey"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_GetKey"); return ret; } @@ -264,7 +267,8 @@ DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); return XA_RESULT_PARAMETER_INVALID; } - }DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); return ret; } @@ -312,7 +316,8 @@ DEBUG_API("<-XAMetadataInsertionItfImpl_GetFreeKeysEncoding"); return XA_RESULT_FEATURE_UNSUPPORTED; } - }DEBUG_API("<-XAMetadataInsertionItfImpl_InsertMetadataItem"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_InsertMetadataItem"); return ret; } @@ -399,7 +404,8 @@ sizeof(XAMetadataInfo*)); self->self = self; - }DEBUG_API("<-XAMetadataInsertionItfImpl_Create"); + } + DEBUG_API("<-XAMetadataInsertionItfImpl_Create"); return self; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xarecorditf.c --- a/khronosfws/openmax_al/src/mediarecorder/xarecorditf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mediarecorder/xarecorditf.c Fri Jul 09 16:43:35 2010 -0500 @@ -521,7 +521,8 @@ XAAdaptationBase_AddEventHandler(impl->adaptationCtx, &XARecordItfImpl_AdaptCb, XA_RECORDITFEVENTS, self); self->self = self; - }DEBUG_API("<-XARecordItfImpl_Create"); + } + DEBUG_API("<-XARecordItfImpl_Create"); return self; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xasnapshotitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xasnapshotitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,597 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xasnapshotitf.h" - -#include "xasnapshotitfadaptation.h" - -#include "xathreadsafety.h" -#include "xaplayitf.h" -#include "xaglobals.h" - -extern void* vfHandle; - -/** - * static XASnapshotItfImpl* GetImpl(XASnapshotItf self) - * Description: Validated interface pointer and cast it to implementations pointer. - **/ -static XASnapshotItfImpl* GetImpl(XASnapshotItf self) -{ - if( self ) - { - XASnapshotItfImpl* impl = (XASnapshotItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XASnapshotItf implementation - */ - -/* - This method prepares the device for snapshot to shorten the actual shooting - delay with TakeSnapshot() method. The various settings for snapshot are - set with this method: the specified number of snapshots, the output location - either to the XADataSink (if it is specified) or to memory (if no XADataSink - is specified) and then calls xaSnapshotInitiatedCallback() method. - Asynchronous. - Second call of this method before the call to TakeSnapshot() method will - reinitialize the shooting with the new parameter values. -*/ -XAresult XASnapshotItfImpl_InitiateSnapshot(XASnapshotItf self, - XAuint32 numberOfPictures, - XAuint32 fps, - XAboolean freezeViewFinder, - XADataSink sink, - xaSnapshotInitiatedCallback initiatedCallback, - xaSnapshotTakenCallback takenCallback, - void * pContext) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - XAuint32 minF = 0, maxF = 0, maxP = 0; - - DEBUG_API("->XASnapshotItfImpl_InitiateSnapshot"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - - if(!impl) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfImpl_InitiateSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - XASnapshotItfAdaptation_GetBurstFPSRange((XAAdaptationGstCtx*)impl->adapCtx,&minF,&maxF); - XASnapshotItfAdaptation_GetMaxPicsPerBurst((XAAdaptationGstCtx*)impl->adapCtx,&maxP); - - /*Check attributes and initialize local variables*/ - /*NOTE: bug in spec? - should sink attribute be a pointer?*/ - if( numberOfPictures > maxP || - (numberOfPictures!=1 && !(sink.pLocator) ) ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XASnapshotItfImpl_InitiateSnapshot -" - "XA_RESULT_PARAMETER_INVALID (numberOfPictures)"); - DEBUG_API("<-XASnapshotItfImpl_InitiateSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - if( numberOfPictures!=1 && (fpsmaxF) ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XASnapshotItfImpl_InitiateSnapshot -" - "XA_RESULT_PARAMETER_INVALID (fps)"); - DEBUG_API("<-XASnapshotItfImpl_InitiateSnapshot"); - return XA_RESULT_PARAMETER_INVALID; - } - - impl->numberofpictures = numberOfPictures; - impl->usercontext = pContext; - impl->initcallback = initiatedCallback; - impl->takencallback = takenCallback; - impl->cbPtrToSelf = self; - impl->freezevf = freezeViewFinder; - - - if( impl->initongoing || - impl->initialized || - impl->snapshotongoing ) - { - res = XASnapshotItfAdaptation_CancelSnapshot((XAAdaptationGstCtx*)impl->adapCtx); - impl->initongoing = XA_BOOLEAN_FALSE; - impl->snapshotongoing = XA_BOOLEAN_FALSE; - } - - /* Initialize snapshot to adaptation */ - if( impl->adapCtx ) - { - impl->initongoing = XA_BOOLEAN_TRUE; - res = XASnapshotItfAdaptation_InitiateSnapshot((XAAdaptationGstCtx*)impl->adapCtx, - numberOfPictures, - fps, - freezeViewFinder, - &sink); - } - else - { - res = XA_RESULT_INTERNAL_ERROR; - } - - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_InitiateSnapshot"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API_A1("<-XASnapshotItfImpl_InitiateSnapshot (%d)", (int)res); - return res; -} - -/* - This method takes the specified number of snapshots, stores them either to - the XADataSink (if it is specified by InitiateSnapshot()) or to memory (if - no XADataSink is specified) and then calls xaSnapshotTakenCallback() - method. - */ -XAresult XASnapshotItfImpl_TakeSnapshot(XASnapshotItf self) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XASnapshotItfImpl_TakeSnapshot"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if(!impl) - { - DEBUG_ERR("XASnapshotItfImpl_TakeSnapshot -" - "XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - res = XA_RESULT_PARAMETER_INVALID; - } - - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - if( impl->initongoing || - impl->snapshotongoing || - !impl->initialized ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XASnapshotItfImpl_TakeSnapshot -" - "XA_RESULT_PRECONDITIONS_VIOLATED"); - DEBUG_API("<-XASnapshotItfImpl_TakeSnapshot"); - return XA_RESULT_PRECONDITIONS_VIOLATED; - } - - if( impl->numberofpictures == 0 ) - { - if( impl->takencallback ) - { - impl->takencallback(impl->cbPtrToSelf, impl->usercontext, - impl->numberofpictures, NULL); - } - res = XA_RESULT_SUCCESS; - } - /*Inform adaptation to take snapshot*/ - else if( impl->adapCtx ) - { - impl->snapshotongoing = XA_BOOLEAN_TRUE; - res = XASnapshotItfAdaptation_TakeSnapshot((XAAdaptationGstCtx*)impl->adapCtx); - if( res!=XA_RESULT_SUCCESS ) - { - DEBUG_ERR_A1("Adaptation returns error %d taking snapshot!", (int)res); - impl->snapshotongoing = XA_BOOLEAN_FALSE; - } - } - else - { - res = XA_RESULT_INTERNAL_ERROR; - DEBUG_ERR("XASnapshotItfImpl_TakeSnapshot" - "-XA_RESULT_INTERNAL_ERROR "); - } - - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_TakeSnapshot"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API("<-XASnapshotItfImpl_TakeSnapshot"); - return res; -} - -/* - This method cancels an ongoing shooting session. Snapshooting needs to be - initiated again after calling this method with InitiateSnapshot method. - - Synchronous. -*/ -XAresult XASnapshotItfImpl_CancelSnapshot(XASnapshotItf self) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XASnapshotItfImpl_CancelSnapshot"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfImpl_CancelSnapshot"); - /* invalid parameter */ - res = XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - if( impl->initongoing || - impl->snapshotongoing || - impl->initialized ) - { - if( impl->adapCtx ) - { - res = XASnapshotItfAdaptation_CancelSnapshot((XAAdaptationGstCtx*)impl->adapCtx); - } - else - { - DEBUG_ERR("No adaptation context!!"); - res = XA_RESULT_INTERNAL_ERROR; - } - impl->initongoing = XA_BOOLEAN_FALSE; - impl->snapshotongoing = XA_BOOLEAN_FALSE; - impl->initialized = XA_BOOLEAN_FALSE; - } - - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_CancelSnapshot"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API_A1("<-XASnapshotItfImpl_CancelSnapshot (%d)", (int)res); - return res; -} - -/* - This method releases the given buffer. - */ -XAresult XASnapshotItfImpl_ReleaseBuffers(XASnapshotItf self, - XADataSink *image) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XASnapshotItfImpl_ReleaseBuffers"); - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - res = XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - if( image && (image->pLocator) && - *((XAuint32*)(image->pLocator)) == XA_DATALOCATOR_ADDRESS ) - { - if( ((XADataLocator_Address*)(image->pLocator))->pAddress ) - { - free(((XADataLocator_Address*)(image->pLocator))->pAddress); - } - image->pLocator = NULL; - image->pFormat = NULL; - DEBUG_API("<-XASnapshotItfImpl_ReleaseBuffers- buffers released"); - res = XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR_A1("<-XASnapshotItfImpl_ReleaseBuffers- " - "INVALID XADataSink at 0x%x", (int)image); - res = XA_RESULT_PARAMETER_INVALID; - } - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_ReleaseBuffers"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - DEBUG_API("<-XASnapshotItfImpl_ReleaseBuffers"); - return res; -} - -/* - This method tells how many pictures it is possible to - be taken during single burst. -*/ -XAresult XASnapshotItfImpl_GetMaxPicsPerBurst(XASnapshotItf self, - XAuint32 *maxNumberOfPictures) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XASnapshotItfImpl_GetMaxPicsPerBurst"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if( !impl || !maxNumberOfPictures ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfImpl_GetMaxPicsPerBurst"); - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - if( impl->adapCtx ) - { - res = XASnapshotItfAdaptation_GetMaxPicsPerBurst((XAAdaptationGstCtx*)impl->adapCtx, maxNumberOfPictures); - } - else - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API("<-XASnapshotItfImpl_GetMaxPicsPerBurst"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_GetMaxPicsPerBurst"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API("<-XASnapshotItfImpl_GetMaxPicsPerBurst"); - return res; -} - -/* - This method tells the range of shooting rates possible in burst shooting - mode. Please note that these rates might be different depending on which - encoder and which resolution has been chosen; not all the rates can - necessarily be reached with every resolution or encoder. -*/ -XAresult XASnapshotItfImpl_GetBurstFPSRange(XASnapshotItf self, - XAuint32 *minFPS, - XAuint32 *maxFPS) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XASnapshotItfImpl_GetBurstFPSRange"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if( !impl || !minFPS || !maxFPS ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfImpl_GetBurstFPSRange"); - return XA_RESULT_PARAMETER_INVALID; - } - - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - if( impl->adapCtx ) - { - res = XASnapshotItfAdaptation_GetBurstFPSRange((XAAdaptationGstCtx*)impl->adapCtx,minFPS,maxFPS); - } - else - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API("<-XASnapshotItfImpl_GetBurstFPSRange"); - return XA_RESULT_INTERNAL_ERROR; - } - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_GetBurstFPSRange"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API("<-XASnapshotItfImpl_GetBurstFPSRange"); - return res; -} - -/* - Toggles the shutter feedback (such as shutter sound or some visual - feedback while taking a snapshot). -*/ -XAresult XASnapshotItfImpl_SetShutterFeedback(XASnapshotItf self, - XAboolean enabled) -{ - XASnapshotItfImpl *impl = GetImpl(self); - XAresult res = XA_RESULT_SUCCESS; - - DEBUG_API("->XASnapshotItfImpl_SetShutterFeedback"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - res = XA_RESULT_PARAMETER_INVALID; - } - impl->shutterfeedback = enabled; - if(impl->adapCtx && impl->adapCtx->fwtype == FWMgrFWGST) - { - if( impl->adapCtx ) - { - /*Inform adaptation about shutter feedback */ - res = XASnapshotItfAdaptation_SetShutterFeedback((XAAdaptationGstCtx*)impl->adapCtx, enabled); - } - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - DEBUG_API("<-XASnapshotItfImpl_GetBurstFPSRange"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_API("<-XASnapshotItfImpl_SetShutterFeedback"); - return res; -} - -/* - This method tells if the shutter feedback (such as shutter sound or some - visual feedback while taking a snapshot) is enabled. - */ -XAresult XASnapshotItfImpl_GetShutterFeedback(XASnapshotItf self, - XAboolean *enabled) -{ - XASnapshotItfImpl *impl = GetImpl(self); - DEBUG_API("->XASnapshotItfImpl_GetShutterFeedback"); - if( !impl || !enabled ) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XASnapshotItfImpl_GetShutterFeedback"); - return XA_RESULT_PARAMETER_INVALID; - } - enabled = (XAboolean*)impl->shutterfeedback; - - DEBUG_API("<-XASnapshotItfImpl_GetShutterFeedback"); - return XA_RESULT_SUCCESS; -} - -/** - * XASnapshotItfImpl -specific methods - **/ - - -/** - * XASnapshotItfImpl* XASnapshotItfImpl_Create() - * Description: Allocate and initialize SnapshotItfImpl - **/ -XASnapshotItfImpl* XASnapshotItfImpl_Create(XAMediaRecorderImpl* impl) -{ - XASnapshotItfImpl* self = (XASnapshotItfImpl*) - calloc(1,sizeof(XASnapshotItfImpl)); - - - DEBUG_API("->XASnapshotItfImpl_Create"); - if( self ) - { - /* init itf default implementation */ - self->itf.CancelSnapshot = XASnapshotItfImpl_CancelSnapshot; - self->itf.GetBurstFPSRange = XASnapshotItfImpl_GetBurstFPSRange; - self->itf.GetMaxPicsPerBurst = XASnapshotItfImpl_GetMaxPicsPerBurst; - self->itf.GetShutterFeedback = XASnapshotItfImpl_GetShutterFeedback; - self->itf.InitiateSnapshot = XASnapshotItfImpl_InitiateSnapshot; - self->itf.ReleaseBuffers = XASnapshotItfImpl_ReleaseBuffers; - self->itf.SetShutterFeedback = XASnapshotItfImpl_SetShutterFeedback; - self->itf.TakeSnapshot = XASnapshotItfImpl_TakeSnapshot; - - /* init variables */ - self->adapCtx = impl->adaptationCtx; - self->self = self; - self->cbPtrToSelf = NULL; - } - - /* Add call back function to eventhandler. */ - XAAdaptationBase_AddEventHandler( impl->adaptationCtx, &XASnapshotItfImpl_AdaptCb, XA_SNAPSHOTITFEVENTS, self ); - DEBUG_API("<-XASnapshotItfImpl_Create"); - return self; -} - -/** - * void XASnapshotItfImpl_Free(XASnapshotItfImpl* self) - * Description: Free all resources reserved at XASnapshotItfImpl_Create() - **/ -void XASnapshotItfImpl_Free(XASnapshotItfImpl* self) -{ - DEBUG_API("->XASnapshotItfImpl_Free"); - assert( self==self->self ); - /* - * Free all resources reserved at XASnapshotItfImpl_Create - */ - self->itf.CancelSnapshot(self->cbPtrToSelf); - XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XASnapshotItfImpl_AdaptCb ); - free( self ); - DEBUG_API("<-XASnapshotItfImpl_Free"); -} - -/* void XASnapshotItfImpl_AdaptCb - * Description: - * Listen adaptation callBacks from camera adaptation - */ -void XASnapshotItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XASnapshotItfImpl* impl = (XASnapshotItfImpl*)pHandlerCtx; - DEBUG_API("->XASnapshotItfImpl_AdaptCb"); - - if(!impl) - { - DEBUG_ERR("XASnapshotItfImpl_AdaptCb, invalid context pointer!"); - return; - } - assert(event); - - if( event->eventid == XA_ADAPT_SNAPSHOT_TAKEN ) - { - DEBUG_INFO("**Snapshot taken**"); - impl->snapshotongoing = XA_BOOLEAN_FALSE; - if( impl->takencallback ) - { - if ( vfHandle && impl->freezevf ) - { - XAresult ret = XA_RESULT_SUCCESS; - XAPlayItfImpl* vf = (XAPlayItfImpl*)vfHandle; - DEBUG_INFO_A1("Using global view finder handle from %x to freeze view finder", vf); - ret = XAPlayItfImpl_SetPlayState( (XAPlayItf)&vf, XA_PLAYSTATE_PAUSED); - if ( ret != XA_RESULT_SUCCESS ) - { - DEBUG_ERR("Could not change view finder to pause"); - } - } - /* datasize used for "number taken", the pointer to - * data sink structure itself contains the data size */ - impl->takencallback(impl->cbPtrToSelf, impl->usercontext, - event->datasize, (XADataSink*)event->data); - } - } - else if( event->eventid == XA_ADAPT_SNAPSHOT_INITIATED ) - { - DEBUG_INFO("**Snapshot initiated**"); - impl->initongoing = XA_BOOLEAN_FALSE; - impl->initialized = XA_BOOLEAN_TRUE; - if( impl->initcallback ) - { - impl->initcallback(impl->cbPtrToSelf, impl->usercontext); - } - } - DEBUG_API("<-XASnapshotItfImpl_AdaptCb"); -} -/*End of file*/ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xasnapshotitf.h --- a/khronosfws/openmax_al/src/mediarecorder/xasnapshotitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XASNAPSHOTITF_H -#define XASNAPSHOTITF_H - -#include - -#include "xamediarecorder.h" - -/** MACROS **/ - -/** TYPES **/ - -/*Callbacks*/ - - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ - - -/* Definition of XASnapshotItf implementation */ -typedef struct XASnapshotItfImpl_ -{ - /* parent interface */ - struct XASnapshotItf_ itf; - /* pointer to self */ - struct XASnapshotItfImpl_* self; - - /* variables */ - XAuint32 numberofpictures; - XAboolean shutterfeedback; - xaSnapshotInitiatedCallback initcallback; - xaSnapshotTakenCallback takencallback; - void* usercontext; - XASnapshotItf cbPtrToSelf; - - - XAAdaptationBaseCtx *adapCtx; - - XAboolean snapshotongoing; - XAboolean initongoing; - XAboolean initialized; - XAboolean freezevf; - -} XASnapshotItfImpl; - -/** METHODS **/ - -/* Base interface XASnapshotItf implementation */ -XAresult XASnapshotItfImpl_InitiateSnapshot(XASnapshotItf self, - XAuint32 numberOfPictures, - XAuint32 fps, - XAboolean freezeViewFinder, - XADataSink sink, - xaSnapshotInitiatedCallback initiatedCallback, - xaSnapshotTakenCallback takenCallback, - void * pContext); - -XAresult XASnapshotItfImpl_TakeSnapshot(XASnapshotItf self); - -XAresult XASnapshotItfImpl_CancelSnapshot(XASnapshotItf self); - -XAresult XASnapshotItfImpl_ReleaseBuffers(XASnapshotItf self, - XADataSink *image); - -XAresult XASnapshotItfImpl_GetMaxPicsPerBurst(XASnapshotItf self, - XAuint32 *maxNumberOfPictures); - -XAresult XASnapshotItfImpl_GetBurstFPSRange(XASnapshotItf self, - XAuint32 *minFPS, - XAuint32 *maxFPS); - -XAresult XASnapshotItfImpl_SetShutterFeedback(XASnapshotItf self, - XAboolean enabled); - -XAresult XASnapshotItfImpl_GetShutterFeedback(XASnapshotItf self, - XAboolean *enabled); - -/* XASnapshotItfImpl -specific methods */ -XASnapshotItfImpl* XASnapshotItfImpl_Create(XAMediaRecorderImpl* impl); -void XASnapshotItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); -void XASnapshotItfImpl_Free(XASnapshotItfImpl* self); - -#endif /* XASNAPSHOTITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xavideoencoderitf.c --- a/khronosfws/openmax_al/src/mediarecorder/xavideoencoderitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,177 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include -#include "xavideoencoderitf.h" - -#include "xavideoencoderitfadaptation.h" -#include "xarecorditfadaptation.h" -#include "xacapabilitiesmgr.h" -#include "xathreadsafety.h" - - -/* static XAVideoEncoderItfImpl* GetImpl(XAVideoEncoderItf self) - * Description: Validate interface pointer and cast it to implementation pointer. - */ -static XAVideoEncoderItfImpl* GetImpl(XAVideoEncoderItf self) -{ - if( self ) - { - XAVideoEncoderItfImpl* impl = (XAVideoEncoderItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/***************************************************************************** - * Base interface XAVideoEncoderItf implementation - *****************************************************************************/ - -/* XAresult XAVideoEncoderItfImpl_SetVideoSettings - * Description: Set video encoder settings. - */ -XAresult XAVideoEncoderItfImpl_SetVideoSettings(XAVideoEncoderItf self, - XAVideoSettings *pSettings) -{ - XAresult res = XA_RESULT_SUCCESS; - XACapabilities temp; - XAuint32 recState = XA_RECORDSTATE_STOPPED; - XAVideoEncoderItfImpl *impl = GetImpl(self); - DEBUG_API("->XAVideoEncoderItfImpl_SetVideoSettings"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSMediaRecorder); - - if( !impl || !pSettings ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoEncoderItfImpl_SetVideoSettings"); - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - res = XACapabilitiesMgr_GetCapsById(NULL, (XACapsType)(XACAP_ENCODER|XACAP_VIDEO), pSettings->encoderId, &temp); - if( res == XA_RESULT_SUCCESS ) - { - res = XARecordItfAdapt_GetRecordState( (XAAdaptationGstCtx*)impl->adaptCtx, &recState ); - if( res == XA_RESULT_SUCCESS ) - { - if( XA_RECORDSTATE_STOPPED == recState ) - { - res = XAVideoEncoderItfAdapt_SetVideoSettings((XAAdaptationGstCtx*)impl->adaptCtx, pSettings); - } - else - { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED"); - res = XA_RESULT_PRECONDITIONS_VIOLATED; - } - } - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaRecorder); - - DEBUG_API("<-XAVideoEncoderItfImpl_SetVideoSettings"); - return res; -} - -/* XAresult XAVideoEncoderItfImpl_GetVideoSettings - * Description: Get video encoder settings. - */ -XAresult XAVideoEncoderItfImpl_GetVideoSettings(XAVideoEncoderItf self, - XAVideoSettings *pSettings) -{ - XAresult res = XA_RESULT_SUCCESS; - XAVideoEncoderItfImpl *impl = GetImpl(self); - DEBUG_API("->XAVideoEncoderItfImpl_GetVideoSettings"); - if( !impl || !pSettings ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVideoEncoderItfImpl_GetVideoSettings"); - /* invalid parameter */ - return XA_RESULT_PARAMETER_INVALID; - } - if(impl->adaptCtx->fwtype == FWMgrFWGST) - { - res = XAVideoEncoderItfAdapt_GetVideoSettings((XAAdaptationGstCtx*)impl->adaptCtx, pSettings); - } - else - { - DEBUG_ERR("XA_RESULT_FEATURE_UNSUPPORTED"); - res = XA_RESULT_FEATURE_UNSUPPORTED; - } - - DEBUG_API("<-XAVideoEncoderItfImpl_GetVideoSettings"); - return res; -} - -/***************************************************************************** - * XAVideoEncoderItfImpl -specific methods - *****************************************************************************/ - - -/* XAVideoEncoderItfImpl* XAVideoEncoderItfImpl_Create() - * Description: Allocate and initialize VideoEncoderItfImpl - */ -XAVideoEncoderItfImpl* XAVideoEncoderItfImpl_Create( XAMediaRecorderImpl* impl ) -{ - XAVideoEncoderItfImpl* self = (XAVideoEncoderItfImpl*) - calloc(1,sizeof(XAVideoEncoderItfImpl)); - DEBUG_API("->XAVideoEncoderItfImpl_Create"); - - if( self ) - { - /* init itf default implementation */ - self->itf.GetVideoSettings = XAVideoEncoderItfImpl_GetVideoSettings; - self->itf.SetVideoSettings = XAVideoEncoderItfImpl_SetVideoSettings; - - /* init variables */ - self->adaptCtx = impl->adaptationCtx; - self->self = self; - } - DEBUG_API("<-XAVideoEncoderItfImpl_Create"); - return self; -} - -/* void XAVideoEncoderItfImpl_Free(XAVideoEncoderItfImpl* self) - * Description: Free all resources reserved at XAVideoEncoderItfImpl_Create() - */ -void XAVideoEncoderItfImpl_Free(XAVideoEncoderItfImpl* self) -{ - DEBUG_API("->XAVideoEncoderItfImpl_Free"); - assert( self==self->self ); - free( self ); - DEBUG_API("<-XAVideoEncoderItfImpl_Free"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mediarecorder/xavideoencoderitf.h --- a/khronosfws/openmax_al/src/mediarecorder/xavideoencoderitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIDEOENCODERITF_H -#define XAVIDEOENCODERITF_H - - -#include "xamediarecorder.h" -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAVideoEncoderItf implementation */ -typedef struct XAVideoEncoderItfImpl_ -{ - /* parent interface */ - struct XAVideoEncoderItf_ itf; - /* pointer to self */ - struct XAVideoEncoderItfImpl_* self; - - /* variables */ - XAAdaptationBaseCtx *adaptCtx; - -} XAVideoEncoderItfImpl; - -/** METHODS **/ - -/* Base interface XAVideoEncoderItf implementation - * See API Specification for method documentation - */ -XAresult XAVideoEncoderItfImpl_SetVideoSettings(XAVideoEncoderItf self, - XAVideoSettings *pSettings); - -XAresult XAVideoEncoderItfImpl_GetVideoSettings(XAVideoEncoderItf self, - XAVideoSettings *pSettings); - - -/* XAVideoEncoderItfImpl -specific methods */ -XAVideoEncoderItfImpl* XAVideoEncoderItfImpl_Create( XAMediaRecorderImpl* impl ); -void XAVideoEncoderItfImpl_Free(XAVideoEncoderItfImpl* self); - -#endif /* XAVIDEOENCODERITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/metadataextractor/xametadataextractor.c --- a/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.c Fri Jul 09 16:43:35 2010 -0500 @@ -22,10 +22,8 @@ #include "xadynamicsourceitf.h" #include "xadynintmgmtitf.h" #include "xametadataextractionitf.h" -#include "xametadatatraversalitf.h" #include "xaconfigextensionsitf.h" -#include "xametadataadaptctx.h" #include "xacapabilitiesmgr.h" #include "xathreadsafety.h" @@ -35,12 +33,11 @@ /* Static mapping of enumeration XAMetadataInterfaces to interface iids */ static const XAInterfaceID* xaMetadataExtractorItfIIDs[MDE_ITFCOUNT] = { - &XA_IID_OBJECT, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_METADATAEXTRACTION, - &XA_IID_METADATATRAVERSAL, - &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICSOURCE + &XA_IID_OBJECT, + &XA_IID_DYNAMICINTERFACEMANAGEMENT, + &XA_IID_METADATAEXTRACTION, + &XA_IID_CONFIGEXTENSION, + &XA_IID_DYNAMICSOURCE }; /***************************************************************************** @@ -107,8 +104,6 @@ /* Implicit and mandated interfaces */ pBaseObj->interfaceMap[MDE_METADATAEXTRACTIONITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[MDE_METADATATRAVERSALITF].required - = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MDE_DYNAMICSOURCEITF].required = XA_BOOLEAN_TRUE; pBaseObj->interfaceMap[MDE_DIMITF].required = XA_BOOLEAN_TRUE; @@ -180,16 +175,8 @@ if (fwType == FWMgrFWMMF) { pImpl->adaptationCtxMMF = XAMetadataAdaptCtxMMF_Create(pDataSource); - pImpl->curAdaptCtx = pImpl->adaptationCtxMMF; } - else - { - // Create metadata adaptation context - pImpl->adaptationCtxGst = XAMetadataAdaptCtx_Create(pDataSource); - - pImpl->curAdaptCtx = pImpl->adaptationCtxGst; - } XA_IMPL_THREAD_SAFETY_EXIT(XATSMediaPlayer); DEBUG_API("<-XAMetadataExtractorImpl_Create"); @@ -213,7 +200,8 @@ { DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); res = XA_RESULT_PARAMETER_INVALID; - }DEBUG_API_A1("<-XAMetadataExtractorImpl_QueryNumSupportedInterfaces (%d)", (int)res); + } + DEBUG_API_A1("<-XAMetadataExtractorImpl_QueryNumSupportedInterfaces (%d)", (int)res); return res; } /* XAResult XAMetadataExtractorImpl_QuerySupportedInterfaces @@ -234,7 +222,8 @@ { *pInterfaceId = *(xaMetadataExtractorItfIIDs[index]); res = XA_RESULT_SUCCESS; - }DEBUG_API_A1("<-XAMetadataExtractorImpl_QuerySupportedInterfaces (%d)", (int)res); + } + DEBUG_API_A1("<-XAMetadataExtractorImpl_QuerySupportedInterfaces (%d)", (int)res); return res; } @@ -291,10 +280,6 @@ pItf = XAMetadataExtractionItfImpl_Create( pObjImpl->curAdaptCtx); break; - case MDE_METADATATRAVERSALITF: - pItf = XAMetadataTraversalItfImpl_Create( - pObjImpl->curAdaptCtx); - break; case MDE_CONFIGEXTENSIONITF: pItf = XAConfigExtensionsItfImpl_Create(); XAConfigExtensionsItfImpl_SetContext(pItf, @@ -330,11 +315,6 @@ ret = XAMetadataAdaptCtxMMF_PostInit( (XAAdaptationMMFCtx*) pObjImpl->adaptationCtxMMF); } - else - { - ret = XAMetadataAdaptCtx_PostInit( - (XAAdaptationGstCtx*) pObjImpl->adaptationCtxGst); - } if (ret != XA_RESULT_SUCCESS) { @@ -385,9 +365,6 @@ case MDE_METADATAEXTRACTIONITF: XAMetadataExtractionItfImpl_Free(pItf); break; - case MDE_METADATATRAVERSALITF: - XAMetadataTraversalItfImpl_Free(pItf); - break; case MDE_DYNAMICSOURCEITF: XADynamicSourceItfImpl_Free(pItf); break; @@ -410,12 +387,6 @@ (XAAdaptationMMFCtx*) pImpl->adaptationCtxMMF); pImpl->adaptationCtxMMF = NULL; } - else - { - XAMetadataAdaptCtx_Destroy( - (XAAdaptationGstCtx*) pImpl->adaptationCtxGst); - pImpl->adaptationCtxGst = NULL; - } } pImpl->curAdaptCtx = NULL; @@ -454,8 +425,7 @@ break; default: - DEBUG_ERR("XAMetadataExtractorImpl_DoAddItf unknown id") - ; + DEBUG_ERR("XAMetadataExtractorImpl_DoAddItf unknown id"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; } @@ -505,8 +475,7 @@ XAConfigExtensionsItfImpl_Free(mapEntry->pItf); break; default: - DEBUG_ERR("XAMetadataExtractorImpl_DoRemoveItf unknown id") - ; + DEBUG_ERR("XAMetadataExtractorImpl_DoRemoveItf unknown id"); ret = XA_RESULT_FEATURE_UNSUPPORTED; break; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/metadataextractor/xametadataextractor.h --- a/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/metadataextractor/xametadataextractor.h Fri Jul 09 16:43:35 2010 -0500 @@ -34,7 +34,6 @@ MDE_OBJECTITF, /* <-keep this first */ MDE_DIMITF, MDE_METADATAEXTRACTIONITF, - MDE_METADATATRAVERSALITF, MDE_CONFIGEXTENSIONITF, MDE_DYNAMICSOURCEITF, MDE_ITFCOUNT diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -15,7 +15,6 @@ * */ -#include #include #include #include diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h --- a/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmetadatautilityitf.h Fri Jul 09 16:43:35 2010 -0500 @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp --- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -86,6 +86,12 @@ iRadioPlayerUtility = &iRadioUtility->RadioPlayerUtilityL( *this ); } +// SetForceMonoFlag(); + iDefaultFrequency = RADIO_DEFAULT_FREQ; + iDefaultFreqRange = (TFmRadioFrequencyRange)RADIO_DEFAULT_FREQ_RANGE; + iDefaultMinFreq = RADIO_DEFAULT_MIN_FREQ; + iDefaultMaxFreq = RADIO_DEFAULT_MAX_FREQ; + } void CMMFRadioBackendEngine::StationSeek(XAboolean aUpwards) { @@ -111,6 +117,11 @@ if (iFmTunerUtility) { ret = iFmTunerUtility->GetFrequency(aFreq); + if (ret != KErrNone) + { + aFreq = iDefaultFrequency; + ret = KErrNone; + } } DEBUG_API_A1("CMMFRadioBackendEngine::GetFrequency RET: %d", ret); // RDebug::Print(_L("CMMFRadioBackendEngine::GetFrequency RET: %d"), ret); @@ -162,6 +173,13 @@ if (iFmTunerUtility) { ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)minFreq, (TInt&)maxFreq); + if (ret != KErrNone) + { + aRange = iDefaultFreqRange; + minFreq = iDefaultMinFreq; + maxFreq = iDefaultMaxFreq; + ret = KErrNone; + } } DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRange RET: %d", ret); // RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRange RET: %d"), ret); @@ -174,7 +192,14 @@ if (iFmTunerUtility) { - ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)aMinFreq, (TInt&)aMaxFreq); + ret = iFmTunerUtility->GetFrequencyRange((TFmRadioFrequencyRange&)aRange, (TInt&)aMinFreq, (TInt&)aMaxFreq); + if (ret != KErrNone) + { + aRange = iDefaultFreqRange; + aMinFreq = iDefaultMinFreq; + aMaxFreq = iDefaultMaxFreq; + ret = KErrNone; + } } DEBUG_API_A1("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d", ret); // RDebug::Print(_L("CMMFRadioBackendEngine::GetFreqRangeProperties RET: %d"), ret); @@ -232,9 +257,14 @@ if (iFmTunerUtility) { ret = iFmTunerUtility->GetForcedMonoReception(forceMono); + if (ret == KErrNotReady) + { + aForcedMono = XA_STEREOMODE_STEREO; // Radio Utility Default value + return KErrNone; + } } -// RDebug::Print(_L("CMMFRadioBackendEngine::GetForcedMonoReception RET: %d, aForcedMono = %d"), ret, aForcedMono); + if (forceMono) { aForcedMono = XA_STEREOMODE_MONO; @@ -311,6 +341,33 @@ return ret; } +XAresult CMMFRadioBackendEngine::SetForceMonoFlag() +{ + TInt ret = KErrNotFound; + TBool forceMono; + + if (iFmTunerUtility) + { + ret = iFmTunerUtility->GetForcedMonoReception(forceMono); + if (ret == KErrNotReady) + { + // For Radio Utility Default value = XA_STEREOMODE_STEREO + iForceStereo = ETrue; + return KErrNone; + } + + } + + if (forceMono == XA_STEREOMODE_MONO) + { + iForceStereo = EFalse; + } + else + { + iForceStereo = ETrue; + } + return ret; +} XAresult CMMFRadioBackendEngine::SetRadioAdaptContext(void * adaptcontext) { iRadioAdaptContext = adaptcontext; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h --- a/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/cmmfradiobackendengine.h Fri Jul 09 16:43:35 2010 -0500 @@ -227,6 +227,7 @@ CMMFRadioBackendEngine(); void ConstructL(); XAresult TranslateError(TInt error); + XAresult SetForceMonoFlag(); private: CRadioUtility* iRadioUtility; @@ -235,6 +236,10 @@ TBool iForceStereo; void* iRadioAdaptContext; void* iPlayerAdaptContext; + TFmRadioFrequencyRange iDefaultFreqRange; + XAuint32 iDefaultFrequency; + TInt iDefaultMinFreq; + TInt iDefaultMaxFreq; }; @@ -258,6 +263,7 @@ extern void stop_radio(void * context); extern void play_radio(void* context); extern XAresult set_volume(void* context, XAuint32 vol); +extern XAresult get_volume(void* context, XAuint32* vol); extern XAresult mmf_set_player_adapt_context(void * context, void * adaptcontext); extern XAresult set_mute(void* context, XAboolean mute); #endif /* __cplusplus */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediaplayeradaptctxmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -169,7 +169,8 @@ free(pSelf); pSelf = NULL; return NULL; - }DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); + } + DEBUG_API("<-XAMediaPlayerAdaptMMF_Create"); return (XAAdaptationBaseCtx*) (&pSelf->baseObj.baseObj); } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xamediarecorderadaptctxmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -22,8 +22,6 @@ #include "cmmfbackendengine.h" #include "xaadptbasectx.h" -extern XAboolean cameraRealized; - /* * XAAdaptationBaseCtx* XAMediaRecorderAdaptMMF_Create() * Allocates memory for Media Recorder Adaptation Context and makes 1st phase initialization @@ -36,9 +34,7 @@ XADataSource* pImageVideoSrc, XADataSink* pDataSnk, XAuint8 recModes) { XAMediaRecorderAdaptationMMFCtx *pSelf = NULL; - XAuint32 locType = 0; XAresult res; - XADataLocator_IODevice *ioDevice; DEBUG_API("->XAMediaRecorderAdaptMMF_Create"); pSelf = (XAMediaRecorderAdaptationMMFCtx*) calloc(1, @@ -81,27 +77,6 @@ pSelf->audioEncSettings.bitRate = 128; pSelf->audioEncSettings.sampleRate = 44100; } - - if (pImageVideoSrc) - { - locType = *((XAuint32*) (pImageVideoSrc->pLocator)); - if (locType == XA_DATALOCATOR_IODEVICE) - { - ioDevice - = (XADataLocator_IODevice*) (pImageVideoSrc->pLocator); - if (ioDevice->deviceType == XA_IODEVICE_CAMERA - - && !cameraRealized - - ) - { - DEBUG_ERR("Preconditions violated - Camera object not realized"); - XAAdaptationBaseMMF_Free(&pSelf->baseObj); - free(pSelf); - pSelf = NULL; - } - } - } } else { @@ -138,7 +113,7 @@ XADataFormat_MIME* tempFormat; XAMediaRecorderAdaptationMMFCtx *pSelf; DEBUG_API("->XAMediaRecorderAdapt_PostInit"); - if(bCtx) + if(!bCtx) { ret = XA_RESULT_PARAMETER_INVALID; return ret; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xametadataadaptctxmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -94,7 +94,8 @@ DEBUG_API("->XAMetadataAdaptCtxMMF_Destroy"); if (bCtx == NULL) { - DEBUG_ERR("Invalid parameter!!");DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy"); + DEBUG_ERR("Invalid parameter!!"); + DEBUG_API("<-XAMetadataAdaptCtxMMF_Destroy"); return; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xammfcapabilitiesmgr.c Fri Jul 09 16:43:35 2010 -0500 @@ -133,7 +133,8 @@ if (!(*ppListHead)) { *ppListHead = firstNode; - }DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); + } + DEBUG_API("<-XAGSTCapabilitiesMgr_UpdateCapabilitieList"); return res; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokialinearvolumeitfadaptationmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -47,6 +47,12 @@ *percentage = (vol * MAX_PERCENTAGE_VOLUME)/maxvol; } + else if (ctx->baseObj.ctxId == XARadioAdaptation) + { + mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx); + res = get_volume(cmmfradiobackendengine_init(), &vol); + *percentage = vol; + } DEBUG_API_A1("<-XANokiaLinearVolumeItfAdapt_GetVolumeLevel %d", percentage); return res; @@ -70,7 +76,8 @@ && ctx->baseObj.ctxId != XAMediaRecorderAdaptation && ctx->baseObj.ctxId != XARadioAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); /* invalid parameter */ res = XA_RESULT_PARAMETER_INVALID; return res; @@ -93,7 +100,8 @@ { mmf_set_player_adapt_context(cmmfradiobackendengine_init(), ctx); res = set_volume(cmmfradiobackendengine_init(), percentage); - }DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); + } + DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); return res; } @@ -106,7 +114,8 @@ && ctx->baseObj.ctxId != XAMediaRecorderAdaptation && ctx->baseObj.ctxId != XARadioAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaLinearVolumeItfAdapt_SetVolumeLevel"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xanokiavolumeextitfadaptationmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -115,7 +115,8 @@ if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation && ctx->baseObj.ctxId != XAMediaRecorderAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfAdapt_EnableStereoPosition"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -152,7 +153,8 @@ if (!ctx || (ctx->baseObj.ctxId != XAMediaPlayerAdaptation && ctx->baseObj.ctxId != XAMediaRecorderAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XANokiaVolumeExtItfAdapt_SetStereoPosition"); return XA_RESULT_PARAMETER_INVALID; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xaplayitfadaptationmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -23,8 +23,6 @@ #include "cmmfradiobackendengine.h" #include -extern XAboolean cameraRealized; - /*forward declaration of position updater callback*/ gboolean XAPlayItfAdapt_PositionUpdate(gpointer ctx); diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xarecorditfadaptationmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -41,7 +41,8 @@ DEBUG_API_A1("->XARecordItfAdaptMMF_SetRecordState %s",RECORDSTATENAME(state)); if (!bCtx) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdaptMMF_SetRecordState"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XARecordItfAdaptMMF_SetRecordState"); return XA_RESULT_PARAMETER_INVALID; } @@ -111,7 +112,8 @@ if (!bCtx) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdaptMMF_GetRecordState"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XARecordItfAdaptMMF_GetRecordState"); return XA_RESULT_PARAMETER_INVALID; } @@ -139,7 +141,8 @@ if (!bCtx) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdaptMMF_GetPosition"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XARecordItfAdaptMMF_GetPosition"); /* invalid parameter */ ret = XA_RESULT_PARAMETER_INVALID; return ret; @@ -178,7 +181,8 @@ event.data = &posInMsec; DEBUG_API_A1("XARecordItfAdapt_PositionUpdate: pos %lu ms", posInMsec); XAAdaptationBase_SendAdaptEvents(&bCtx->baseObj, &event); - }DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); + } + DEBUG_API_A1("<-XARecordItfAdapt_PositionUpdate: %d", mCtx->runpositiontimer); return (mCtx->runpositiontimer); } /* return false to stop timer */ @@ -198,7 +202,8 @@ if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } @@ -233,7 +238,8 @@ if (!bCtx || bCtx->baseObj.ctxId != XAMediaRecorderAdaptation) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); + DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); + DEBUG_API("<-XARecordItfAdapt_EnablePositionTracking"); /* invalid parameter */ return XA_RESULT_PARAMETER_INVALID; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.c --- a/khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/mmf_adaptation/xastreaminformationitfadaptationmmf.c Fri Jul 09 16:43:35 2010 -0500 @@ -38,7 +38,8 @@ /* Both Media Player and Metadata Extractor objec uses the same ctxId */ if (!adaptCtx || (adaptCtx->ctxId != XAMediaPlayerAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("- numStreams) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-ctxId != XAMediaPlayerAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("- numStreams) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-ctxId != XAMediaPlayerAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-ctxId == XAMDAdaptation) { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED");DEBUG_API("-ctxId != XAMediaPlayerAdaptation)) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("-ctxId == XAMDAdaptation) { - DEBUG_ERR("XA_RESULT_PRECONDITIONS_VIOLATED");DEBUG_API("- numStreams) { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID");DEBUG_API("- -#include -#include - -#include "xaoutputmix.h" -#include "xaobjectitf.h" -#include "xadynintmgmtitf.h" -#include "xaconfigextensionsitf.h" -#include "xaequalizeritf.h" -#include "xavolumeitf.h" -#include "xaoutputmixitf.h" -#include "xathreadsafety.h" -#include "xaoutputmixadaptctx.h" -#include "xacapabilitiesmgr.h" - -/* Static mapping of enumeration XAOMixInterfaces to interface iids */ -static const XAInterfaceID* xaOMixItfIIDs[OMIX_ITFCOUNT]={ - &XA_IID_OBJECT, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_CONFIGEXTENSION, - &XA_IID_OUTPUTMIX, - &XA_IID_EQUALIZER, - &XA_IID_VOLUME -}; - -/***************************************************************************** - * Global methods - *****************************************************************************/ - - -/* - *XAresult XAOMixImpl_CreateOutputMix(XAObjectItf *pMix, - * XAuint32 numInterfaces, - * const XAInterfaceID *pInterfaceIds, - * const XAboolean *pInterfaceRequired) - * Description: Create object - */ -XAresult XAOMixImpl_CreateOutputMix(FrameworkMap* mapper, - XACapabilities* capabilities, - XAObjectItf *pMix, - XAuint32 numInterfaces, - const XAInterfaceID *pInterfaceIds, - const XAboolean *pInterfaceRequired) -{ - - XAObjectItfImpl* pBaseObj = NULL; - XAOMixImpl* pImpl = NULL; - XAuint32 itfIdx = 0; - DEBUG_API("->XAOMixImpl_CreateOutputMix"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); - - - - if(!pMix) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOMixImpl_CreateOutputMix"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* instantiate object */ - pImpl = (XAOMixImpl*)calloc(1,sizeof(XAOMixImpl)); - if(!pImpl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - /* memory allocation failed */ - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XAOMixImpl_CreateOutputMix"); - return XA_RESULT_MEMORY_FAILURE; - } - pBaseObj = &pImpl->baseObj; - - XAObjectItfImpl_Init(pBaseObj, - OMIX_ITFCOUNT, - xaOMixItfIIDs, - XAOMixImpl_DoRealize, - XAOMixImpl_DoResume, - XAOMixImpl_FreeResources ); - - /* Mark interfaces that need to be exposed */ - /* Implicit and mandated interfaces */ - pBaseObj->interfaceMap[OMIX_OUTPUTMIXITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[OMIX_DIMITF].required = XA_BOOLEAN_TRUE; - - /* Explicit interfaces */ - if((numInterfaces != 0) && pInterfaceIds && pInterfaceRequired) - { - /* Check required interfaces */ - for(itfIdx = 0; itfIdx < numInterfaces; itfIdx++) - { - /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIdx]); - if( !entry ) - { - if( pInterfaceRequired[itfIdx] ) - { - /* required interface cannot be accommodated - fail creation */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_ERR("Required interface not found - abort creation!"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - else - { - DEBUG_INFO("Requested (not required) interface not found - continue creation"); - } - } - else - { - entry->required = XA_BOOLEAN_TRUE; - } - } - } - /* Mark interfaces that can be handled dynamically */ - pBaseObj->interfaceMap[OMIX_EQUALIZERITF].isDynamic = XA_BOOLEAN_TRUE; - - /* This code is put here to return Feature Not Supported since adaptation is not present*/ - /*************************************************/ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_ERR("Required interface not found - abort creation!"); - return XA_RESULT_FEATURE_UNSUPPORTED; - /*************************************************/ - -/* // Create outputmix adaptation context - pImpl->adaptationCtx = XAOutputMixAdapt_Create(); - - //Set ObjectItf to point to newly created object - *pMix = (XAObjectItf)&(pBaseObj->self); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - - DEBUG_API("<-XAOMixImpl_CreateOutputMix"); - return XA_RESULT_SUCCESS;*/ -} - -/* - * XAresult XAOMixImpl_QueryNumSupportedInterfaces(XAuint32 * pNumSupportedInterfaces) - * Description: Query number of supported interfaces - */ -XAresult XAOMixImpl_QueryNumSupportedInterfaces(XAuint32 * pNumSupportedInterfaces) -{ - DEBUG_API("->XAOMixImpl_QueryNumSupportedInterfaces"); - if( pNumSupportedInterfaces ) - { - *pNumSupportedInterfaces = OMIX_ITFCOUNT; - DEBUG_API_A1("<-XAOMixImpl_QueryNumSupportedInterfaces - %lu", *pNumSupportedInterfaces ); - return XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOMixImpl_QueryNumSupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } -} - -/* - * XAresult XAOMixImpl_QuerySupportedInterfaces(XAuint32 index, XAInterfaceID * pInterfaceId) - * Description: Statically query supported interfaces - */ -XAresult XAOMixImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID * pInterfaceId) -{ - DEBUG_API("->XAOMixImpl_QuerySupportedInterfaces"); - if (index >= OMIX_ITFCOUNT || !pInterfaceId) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOMixImpl_QuerySupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - - *pInterfaceId = *(xaOMixItfIIDs[index]); - - DEBUG_API("<-XAOMixImpl_QuerySupportedInterfaces"); - return XA_RESULT_SUCCESS; - } -} - -/***************************************************************************** - * base object XAObjectItfImpl methods - *****************************************************************************/ - -/* XAresult XAOMixImpl_DoRealize(XAObjectItf self) - * Description: Realize all implicit and explicitly wanted interfaces. - * Create and initialize implementation-specific variables. - * Called from base object XAObjectItfImpl - */ -XAresult XAOMixImpl_DoRealize(XAObjectItf self) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAresult ret = XA_RESULT_SUCCESS; - XAOMixImpl* pMixImpl = (XAOMixImpl*)(pObj); - XAuint8 itfIdx = 0; - DEBUG_API("->XAOMixImpl_DoRealize"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); - - /* check casting from correct pointer type */ - if( !pMixImpl || pObj != pMixImpl->baseObj.self ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOMixImpl_DoRealize"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* Initialize adaptation */ - ret = XAOutputMixAdapt_PostInit( (XAAdaptationGstCtx*)pMixImpl->adaptationCtx ); - if( ret != XA_RESULT_SUCCESS ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_API("<-XAOMixImpl_DoRealize"); - return ret; - } - - /* Realize all implicit and explicitly wanted interfaces */ - for( itfIdx = 0; itfIdx < OMIX_ITFCOUNT; itfIdx++) - { - if( !(pObj->interfaceMap[itfIdx].pItf) && pObj->interfaceMap[itfIdx].required ) - { - void *pItf = NULL; - switch( itfIdx ) - { - case OMIX_CONFIGEXTENSIONITF: - pItf = XAConfigExtensionsItfImpl_Create(); - break; - case OMIX_DIMITF: - pItf = XADIMItfImpl_Create(); - if(pItf) - { - XADIMItfImpl_Init(pItf, self, - XAOMixImpl_DoAddItf, - XAOMixImpl_DoResumeItf, - XAOMixImpl_DoRemoveItf); - } - break; - case OMIX_EQUALIZERITF: - pItf = XAEqualizerItfImpl_Create(pMixImpl->adaptationCtx); - break; - case OMIX_VOLUMEITF: - pItf = XAVolumeItfImpl_Create(pMixImpl->adaptationCtx); - break; - case OMIX_OUTPUTMIXITF: - pItf = XAOutputMixItfImpl_Create(pMixImpl->adaptationCtx); - break; - default: - break; - } - if( !pItf ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - /* memory allocation failed */ - DEBUG_API("<-XAOMixImpl_DoRealize"); - return XA_RESULT_MEMORY_FAILURE; - } - else - { - pObj->interfaceMap[itfIdx].pItf = pItf; - } - } - } - - pObj->state = XA_OBJECT_STATE_REALIZED; - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - - DEBUG_API("<-XAOMixImpl_DoRealize"); - return XA_RESULT_SUCCESS; -} - -/* - * XAresult XAOMixImpl_DoResume(XAObjectItf self) - * Description: Resume object from suspended state - */ -XAresult XAOMixImpl_DoResume(XAObjectItf self) -{ - DEBUG_API("->XAOMixImpl_DoResume"); - DEBUG_API("<-XAOMixImpl_DoResume"); - /* This implementation does not support suspended state */ - return XA_RESULT_PRECONDITIONS_VIOLATED; -} - -/* - * void XAOMixImpl_FreeResources(XAObjectItf self) - * Description: Free all resources reserved at XACameraDeviceImpl_DoRealize() - */ -void XAOMixImpl_FreeResources(XAObjectItf self) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAOMixImpl* pImpl = (XAOMixImpl*)(*self); - XAuint8 itfIdx = 0; - DEBUG_API("->XAOMixImpl_FreeResources"); - XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSOutputMix); - assert( pObj && pImpl && pObj == pObj->self ); - - if ( pImpl->adaptationCtx != NULL ) - { - XAOutputMixAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtx ); - pImpl->adaptationCtx = NULL; - } - - /* free all allocated interfaces */ - for(itfIdx = 0; itfIdx < OMIX_ITFCOUNT; itfIdx++) - { - void *pItf = pObj->interfaceMap[itfIdx].pItf; - if(pItf) - { - switch(itfIdx) - { - case OMIX_CONFIGEXTENSIONITF: - XAConfigExtensionsItfImpl_Free( pItf ); - break; - case OMIX_DIMITF: - XADIMItfImpl_Free( pItf ); - break; - case OMIX_EQUALIZERITF: - XAEqualizerItfImpl_Free(pItf); - break; - case OMIX_VOLUMEITF: - XAVolumeItfImpl_Free(pItf); - break; - case OMIX_OUTPUTMIXITF: - XAOutputMixItfImpl_Free( pItf ); - break; - default: - break; - } - pObj->interfaceMap[itfIdx].pItf = NULL; - } - } - - if ( pImpl->adaptationCtx != NULL ) - { - XAOutputMixAdapt_Destroy( (XAAdaptationGstCtx*)pImpl->adaptationCtx ); - pImpl->adaptationCtx = NULL; - } - - XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS(XATSOutputMix); - - DEBUG_API("<-XAOMixImpl_FreeResources"); -} - -/***************************************************************************** - * MediaRecorderImpl -specific methods - *****************************************************************************/ - -/* XAOMixImpl_DoAddItf - * Dynamically add an interface, object specific parts - */ -XAresult XAOMixImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAOMixImpl* pImpl = (XAOMixImpl*)(pObj); - - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAOMixImpl_DoAddItf"); - if(mapEntry) - { - switch( mapEntry->mapIdx ) - { - case OMIX_EQUALIZERITF: - - mapEntry->pItf = XAEqualizerItfImpl_Create( pImpl->adaptationCtx ); - - break; - default: - DEBUG_ERR("XAOMixImpl_DoAddItf unknown id"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - if( !mapEntry->pItf && ret == XA_RESULT_SUCCESS) - { - DEBUG_ERR("XAOMixImpl_DoAddItf itf creation failed"); - ret = XA_RESULT_MEMORY_FAILURE; - } - } - else - { - ret = XA_RESULT_PARAMETER_INVALID; - } - - - DEBUG_API("<-XAOMixImpl_DoAddItf"); - return ret; -} - -/* XAOMixImpl_DoResumeItf - * Try to resume lost interface, object specific parts - */ -XAresult XAOMixImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAOMixImpl_DoResumeItf"); - /* For now, no difference between suspended and unrealised itfs */ - ret = XAOMixImpl_DoAddItf(self,mapEntry); - DEBUG_API("<-XAOMixImpl_DoResumeItf"); - return ret; -} - -/* XAOMixImpl_DoRemoveItf - * Dynamically remove an interface, object specific parts - */ -XAresult XAOMixImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ) -{ - XAresult ret = XA_RESULT_SUCCESS; - DEBUG_API("->XAOMixImpl_DoRemoveItf"); - - if(mapEntry) - { - switch( mapEntry->mapIdx ) - { - case OMIX_EQUALIZERITF: - XAEqualizerItfImpl_Free( mapEntry->pItf ); - break; - default: - DEBUG_ERR("XAOMixImpl_DoRemoveItf unknown id"); - ret = XA_RESULT_FEATURE_UNSUPPORTED; - break; - } - mapEntry->pItf = NULL; - } - else - { - ret = XA_RESULT_PARAMETER_INVALID; - } - - DEBUG_API("<-XAOMixImpl_DoRemoveItf"); - return ret; -} - -/*END OF FILE*/ - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/outputmix/xaoutputmix.h --- a/khronosfws/openmax_al/src/outputmix/xaoutputmix.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAOUTPUTMIX_H -#define XAOUTPUTMIX_H - -#include "openmaxalwrapper.h" -#include "xaobjectitf.h" -#include "xaglobals.h" -#include "xaadptbasectx.h" - -/** MACROS **/ - - -/** TYPES **/ - - -/** ENUMERATIONS **/ -/* Enumeration for interfaces that OutputMix supports. */ -typedef enum -{ - OMIX_OBJECTITF, - OMIX_DIMITF, - OMIX_CONFIGEXTENSIONITF, - OMIX_OUTPUTMIXITF, - OMIX_EQUALIZERITF, - OMIX_VOLUMEITF, - OMIX_ITFCOUNT -} XAOMixInterfaces; - - -/** STRUCTURES **/ -/* Specification for MediaPlayerImpl.*/ -typedef struct XAOMixImpl_ -{ - /* Parent for XAMediaPlayerImpl */ - XAObjectItfImpl baseObj; - - /* variables */ - XAAdaptationBaseCtx* adaptationCtx; - -} XAOMixImpl; - - -/** METHODS **/ - -/* base object XAObjectItfImpl methods */ -XAresult XAOMixImpl_DoRealize(XAObjectItf self); -XAresult XAOMixImpl_DoResume(XAObjectItf self); -void XAOMixImpl_FreeResources(XAObjectItf self); - -/* XAOMixImpl -specific methods*/ -XAresult XAOMixImpl_DoAddItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAOMixImpl_DoResumeItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); -XAresult XAOMixImpl_DoRemoveItf(XAObjectItf self, XAObjItfMapEntry *mapEntry ); - -#endif /* XAOUTPUTMIX_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/outputmix/xaoutputmixitf.c --- a/khronosfws/openmax_al/src/outputmix/xaoutputmixitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,226 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include "xaoutputmixitf.h" - -#include "xaoutputmixitfadaptation.h" - -#include -#include "xathreadsafety.h" -#include "e32def.h" -/** - * XAOutputMixtfImpl* GetImpl(XAOutputMixtfImpl self) - * Description: Validated interface pointer and cast it to implementations pointer. - **/ -static XAOutputMixItfImpl* GetImpl(XAOutputMixItf self) -{ - if(self) - { - XAOutputMixItfImpl* impl = (XAOutputMixItfImpl*)(*self); - if(impl && impl == impl->self) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XAOutputMixtf implementation - */ - -/* - * XAresult XAOutputMixItfImpl_GetDestinationOutputDeviceIDs( XAOutputMixItf self, - * XAint32 * pNumDevices, - * XAuint32 * pDeviceIDs ) - * Description: Retrieves the device IDs of the destination output devices currently - * associated with the output mix. - */ -XAresult XAOutputMixItfImpl_GetDestinationOutputDeviceIDs( XAOutputMixItf self, XAint32 * pNumDevices, XAuint32 * pDeviceIDs ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAOutputMixItfImpl* impl = GetImpl(self); - DEBUG_API_A1("->XAOutputMixItfImpl_GetDestinationOutputDeviceIDs - pNumDevices %ld",*pNumDevices); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); - if(!impl || !pNumDevices ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfImpl_GetDestinationOutputDeviceIDs"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAOutputMixItfAdapt_GetDestinationOutputDeviceIDs((XAAdaptationGstCtx*)impl->adapCtx, pNumDevices, pDeviceIDs ); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_API_A1("<-XAOutputMixItfImpl_GetDestinationOutputDeviceIDs - pNumDevices %ld",*pNumDevices); - return ret; -} - -/* - * XAresult XAOutputMixItfImpl_RegisterDeviceChangeCallback( XAOutputMixItf self, - * xaMixDeviceChangeCallback callback, - * void * pContext) - * Description: Registers a callback to notify client when there are changes to the - * device IDs associated with the output mix. - */ -XAresult XAOutputMixItfImpl_RegisterDeviceChangeCallback( XAOutputMixItf self, xaMixDeviceChangeCallback callback, void * pContext) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAOutputMixItfImpl* impl = GetImpl(self); - DEBUG_API("->XAOutputMixItfImpl_RegisterDeviceChangeCallback"); - if(!impl) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfImpl_RegisterDeviceChangeCallback"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* callback may be NULL (to remove callback) */ - impl->callback = callback; - impl->cbContext = pContext; - impl->cbPtrToSelf = self; - - if(callback) - { /* start listening */ - XAAdaptationBase_AddEventHandler( impl->adapCtx, &XAOutputMixItfImpl_AdaptCb, XA_OUTPUTMIXITFEVENTS, (void*)self ); - } - else - { /* stop listening */ - XAAdaptationBase_RemoveEventHandler( impl->adapCtx, &XAOutputMixItfImpl_AdaptCb ); - } - - - DEBUG_API("<-XAOutputMixItfImpl_RegisterDeviceChangeCallback"); - return ret; -} - -/* - * XAresult XAOutputMixItfImpl_ReRoute( XAOutputMixItf self, - * XAint32 numOutputDevices, - * XAuint32 * pOutputDeviceIDs) - * Description: Requests a change to the specified set of output devices on an output mix. - */ -XAresult XAOutputMixItfImpl_ReRoute( XAOutputMixItf self, XAint32 numOutputDevices, XAuint32 * pOutputDeviceIDs) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAOutputMixItfImpl* impl = GetImpl(self); - - DEBUG_API("->XAOutputMixItfImpl_ReRoute"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSOutputMix); - - if(!impl || ( numOutputDevices > 0 && !pOutputDeviceIDs) ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAOutputMixItfImpl_ReRoute"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAOutputMixItfAdapt_ReRoute((XAAdaptationGstCtx*)impl->adapCtx, numOutputDevices, pOutputDeviceIDs ); - - - XA_IMPL_THREAD_SAFETY_EXIT(XATSOutputMix); - DEBUG_API("<-XAOutputMixItfImpl_ReRoute"); - return ret; - -} - -/** - * XAVolumeItfImpl -specific methods - **/ - - -/* - * XAOutputMixItfImpl* XAOutputMixItfImpl_Create(XAAdaptationBaseCtx *adapCtx) - * Description: Creates new Output mix itf implmementation - */ -XAOutputMixItfImpl* XAOutputMixItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XAOutputMixItfImpl *self = (XAOutputMixItfImpl*) - calloc(1,sizeof(XAOutputMixItfImpl)); - DEBUG_API("->XAVolumeItfImpl_Create"); - - if(self) - { - /* init itf default implementation */ - self->itf.GetDestinationOutputDeviceIDs = XAOutputMixItfImpl_GetDestinationOutputDeviceIDs; - self->itf.RegisterDeviceChangeCallback = XAOutputMixItfImpl_RegisterDeviceChangeCallback; - self->itf.ReRoute = XAOutputMixItfImpl_ReRoute; - - /* init variables */ - self->adapCtx = adapCtx; - self->callback = NULL; - self->cbContext = NULL; - self->cbPtrToSelf = NULL; - - self->self = self; - } - - DEBUG_API("<-XAVolumeItfImpl_Create"); - return self; -} - -/* - * void XAOutputMixItfImpl_Free(XAOutputMixItfImpl* self) - * Description: Frees XAOutputMixItfImpl - */ -void XAOutputMixItfImpl_Free(XAOutputMixItfImpl* self) -{ - DEBUG_API("->XAOutputMixItfImpl_Free"); - assert(self==self->self); - if( self->callback ) - { - XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XAOutputMixItfImpl_AdaptCb ); - } - free(self); - DEBUG_API("<-XAOutputMixItfImpl_Free"); -} - - - -/* void XAOutputMixItfImpl_AdaptCb( void *pHandlerCtx, - * XAAdaptEvent *event ) - * Description: Listen changes in adaptation - */ -void XAOutputMixItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XAOutputMixItfImpl* impl = (XAOutputMixItfImpl*)pHandlerCtx; - DEBUG_API("->XAOutputMixItfImpl_AdaptCb"); - - if(!impl) - { - DEBUG_ERR("XAOutputMixItfImpl_AdaptCb, invalid context pointer!"); - return; - } - assert(event); - - /* send callback if needed. - * Check event-id to avoid sending incorrect events. */ - if( (event->eventid==XA_ADAPT_OMIX_DEVICESET_CHANGED) && impl->callback ) - { - impl->callback(impl->cbPtrToSelf, impl->cbContext); - } - - DEBUG_API("<-XAOutputMixItfImpl_AdaptCb"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/outputmix/xaoutputmixitf.h --- a/khronosfws/openmax_al/src/outputmix/xaoutputmixitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAOUTPUTMIXITF_H_ -#define XAOUTPUTMIXITF_H_ - -#include "xaadptbasectx.h" - -/** MACROS **/ - -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAOutputMixItf implementation */ -typedef struct XAOutputMixItfImpl_ -{ - /* parent interface */ - struct XAOutputMixItf_ itf; - /* pointer to self */ - struct XAOutputMixItfImpl_* self; - - /* Variables */ - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - - XAuint32 eventFlags; - xaMixDeviceChangeCallback callback; - void *cbContext; - XAOutputMixItf cbPtrToSelf; - -} XAOutputMixItfImpl; - -/** METHODS **/ - -/* Base interface XAOutputMixItf implementation */ -XAresult XAOutputMixItfImpl_GetDestinationOutputDeviceIDs( XAOutputMixItf self, XAint32 * pNumDevices, XAuint32 * pDeviceIDs ); -XAresult XAOutputMixItfImpl_RegisterDeviceChangeCallback( XAOutputMixItf self, xaMixDeviceChangeCallback callback, void * pContext); -XAresult XAOutputMixItfImpl_ReRoute( XAOutputMixItf self, XAint32 numOutputDevices, XAuint32 * pOutputDeviceIDs); - - -/* XAOutputMixItfImpl -specific methods */ -XAOutputMixItfImpl* XAOutputMixItfImpl_Create(XAAdaptationBaseCtx *adapCtx); -void XAOutputMixItfImpl_Free(XAOutputMixItfImpl* self); -void XAOutputMixItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); - - -#endif /* XAOUTPUTMIXITF_H_ */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/radio/xaradiodevice.c --- a/khronosfws/openmax_al/src/radio/xaradiodevice.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/radio/xaradiodevice.c Fri Jul 09 16:43:35 2010 -0500 @@ -22,7 +22,6 @@ #include "xaradioitf.h" #include "xaconfigextensionsitf.h" #include "xadynintmgmtitf.h" -#include "xardsitf.h" #include "xathreadsafety.h" #include "xaradioadaptctx.h" /* Static mapping of enumeration XARadioDeviceInterfaces to interface iids */ @@ -31,8 +30,7 @@ &XA_IID_OBJECT, &XA_IID_RADIO, &XA_IID_CONFIGEXTENSION, - &XA_IID_DYNAMICINTERFACEMANAGEMENT, - &XA_IID_RDS + &XA_IID_DYNAMICINTERFACEMANAGEMENT }; /***************************************************************************** @@ -233,11 +231,6 @@ case RADIO_DIMITF: pItf = XADIMItfImpl_Create(); break; - case RADIO_RDSITF: - - pItf = XARDSItfImpl_Create( pObjImpl->adaptationCtx ); - - break; default: break; } @@ -305,9 +298,6 @@ case RADIO_DIMITF: XADIMItfImpl_Free( pItf ); break; - case RADIO_RDSITF: - XARDSItfImpl_Free( pItf ); - break; default: break; } diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/radio/xaradiodevice.h --- a/khronosfws/openmax_al/src/radio/xaradiodevice.h Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/radio/xaradiodevice.h Fri Jul 09 16:43:35 2010 -0500 @@ -37,7 +37,6 @@ RADIO_RADIOITF, RADIO_CONFIGEXTENSIONITF, RADIO_DIMITF, - RADIO_RDSITF, RADIO_ITFCOUNT } XARadioDeviceInterfaces; diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/radio/xaradioitf.c --- a/khronosfws/openmax_al/src/radio/xaradioitf.c Fri Jun 25 17:36:03 2010 -0500 +++ b/khronosfws/openmax_al/src/radio/xaradioitf.c Fri Jul 09 16:43:35 2010 -0500 @@ -19,7 +19,6 @@ #include #include #include -#include #include "xaradioitf.h" #include "xaradioitfadaptation.h" #include "xathreadsafety.h" diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/radio/xardsitf.c --- a/khronosfws/openmax_al/src/radio/xardsitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,881 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xardsitf.h" -#include "xardsitfadaptation.h" -#include "xathreadsafety.h" -#include "xaadaptationgst.h" -/** - * XARDSItfImpl* GetImpl(XARDSItf self) - * Description: Validated interface pointer and cast it to implementations pointer. - **/ -static XARDSItfImpl* GetImpl(XARDSItf self) -{ - if(self) - { - XARDSItfImpl *impl = (XARDSItfImpl*)(*self); - if(impl && impl == impl->self) - { - return impl; - } - } - return NULL; -} - -/** - * Base interface XARDSItf implementation - */ - -/** - * XAresult XARDSItfImpl_QueryRDSSignal(XARDSItf self, XAboolean * isSignal) - * Description: Returns the status of the RDS reception. - **/ -XAresult XARDSItfImpl_QueryRDSSignal(XARDSItf self, XAboolean * isSignal) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_QueryRDSSignal"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl || !isSignal) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_QueryRDSSignal"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_QueryRDSSignal((XAAdaptationGstCtx*)impl->adapCtx, isSignal); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_QueryRDSSignal"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetProgrammeServiceName(XARDSItf self, XAchar * ps) - * Description: Gets the current Programme Service name (PS). - **/ -XAresult XARDSItfImpl_GetProgrammeServiceName(XARDSItf self, XAchar * ps) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetProgrammeServiceName"); - if(!impl || !ps) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetProgrammeServiceName"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetProgrammeServiceName((XAAdaptationGstCtx*)impl->adapCtx, ps); - - DEBUG_API("<-XARDSItfImpl_GetProgrammeServiceName"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetRadioText(XARDSItf self, XAchar * rt) - * Description: Gets the current Radio Text (RT). - **/ -XAresult XARDSItfImpl_GetRadioText(XARDSItf self, XAchar * rt) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetRadioText"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || !rt) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetRadioText"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetRadioText((XAAdaptationGstCtx*)impl->adapCtx, rt); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetRadioText"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetRadioTextPlus(XARDSItf self, - * XAuint8 contentType, - * XAchar * informationElement, - * XAchar * descriptor, - * XAuint8 * descriptorContentType) - * Description: Gets the current Radio Text+ (RT+) information element based - * on the given class code. - **/ -XAresult XARDSItfImpl_GetRadioTextPlus(XARDSItf self, - XAuint8 contentType, - XAchar * informationElement, - XAchar * descriptor, - XAuint8 * descriptorContentType) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetRadioTextPlus"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || contentType < XA_RDSRTPLUS_ITEMTITLE || contentType > XA_RDSRTPLUS_GETDATA - || !informationElement || !descriptor || !descriptorContentType) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetRadioTextPlus"); - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_GetRadioTextPlus((XAAdaptationGstCtx*)impl->adapCtx, contentType, informationElement, - // descriptor, descriptorContentType); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetRadioTextPlus"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetProgrammeType(XARDSItf self, XAuint32 * pty) - * Description: Gets the current Programme TYpe (PTY) as short. The - * return value zero corresponds to No Programme Type - * or to undefined type. Please note that PTYs in RBDS - * differ from the ones in RDS. - **/ -XAresult XARDSItfImpl_GetProgrammeType(XARDSItf self, XAuint32 * pty) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetProgrammeType"); - - if(!impl || !pty) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetProgrammeType"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetProgrammeType((XAAdaptationGstCtx*)impl->adapCtx, pty); - - DEBUG_API("<-XARDSItfImpl_GetProgrammeType"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetProgrammeTypeString(XARDSItf self, - * XAboolean isLengthMax16, - * XAchar * pty) - * Description: Gets the current Programme TYpe (PTY) as a String with - * the maximum of 8 or 16 characters in English (char set TBD) - * as defined in RDS and RBDS specifications. Please note - * that PTYs in RBDS differ from the ones in RDS. - **/ -XAresult XARDSItfImpl_GetProgrammeTypeString(XARDSItf self, - XAboolean isLengthMax16, - XAchar * pty) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetProgrammeTypeString"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || !pty) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetProgrammeTypeString"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetProgrammeTypeString((XAAdaptationGstCtx*)impl->adapCtx, isLengthMax16, pty); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetProgrammeTypeString"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetProgrammeIdentificationCode(XARDSItf self, XAint16 * pi) - * Description: Gets the current Programme Identification code (PI). The PI is not - * intended for directly displaying to the end user, but instead to - * identify uniquely a programme. This can be used to detect that two - * frequencies are transmitting the same programme. - **/ -XAresult XARDSItfImpl_GetProgrammeIdentificationCode(XARDSItf self, XAint16 * pi) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetProgrammeIdentificationCode"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || !pi) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetProgrammeIdentificationCode"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetProgrammeIdentificationCode((XAAdaptationGstCtx*)impl->adapCtx, pi); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetProgrammeIdentificationCode"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetClockTime(XARDSItf self, XAtime * dateAndTime) - * Description: Gets the current Clock Time and date (CT). - **/ -XAresult XARDSItfImpl_GetClockTime(XARDSItf self, XAtime * dateAndTime) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetClockTime"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || !dateAndTime) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetClockTime"); - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_GetClockTime((XAAdaptationGstCtx*)impl->adapCtx, dateAndTime); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetClockTime"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetTrafficAnnouncement(XARDSItf self, XAboolean * ta) - * Description: Gets the current status of the Traffic Announcement (TA) switch. - **/ -XAresult XARDSItfImpl_GetTrafficAnnouncement(XARDSItf self, XAboolean * ta) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetTrafficAnnouncement"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || !ta) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetTrafficAnnouncement((XAAdaptationGstCtx*)impl->adapCtx, ta); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetTrafficAnnouncement"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetTrafficProgramme(XARDSItf self, XAboolean * tp) - * Description: Gets the current status of the Traffic Programme (TP) switch. - **/ -XAresult XARDSItfImpl_GetTrafficProgramme(XARDSItf self, XAboolean * tp) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetTrafficProgramme"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl || !tp) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetTrafficProgramme"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetTrafficProgramme((XAAdaptationGstCtx*)impl->adapCtx, tp); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetTrafficProgramme"); - return ret; -} - -/** - * XAresult XARDSItfImpl_SeekByProgrammeType(XARDSItf self, - * XAuint32 pty, - * XAboolean upwards) - * Description: Seeks for the frequency sending the given Programme TYpe (PTY). - * If the end of the tuner’s frequency band is reached before the - * given Programme TYpe is found, the scan continues from the other - * end until the given Programme TYpe is found or the original frequency - * is reached. Asynchronous - tuner callback xaRadioCallback() and - * XA_RADIO_EVENT_SEEK_COMPLETED is used for notifying of the result. - * StopSeeking() method of XARadioItf can be used to abort an ongoing seek. - **/ -XAresult XARDSItfImpl_SeekByProgrammeType(XARDSItf self, - XAuint32 pty, - XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_SeekByProgrammeType"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl || pty > XA_RDSPROGRAMMETYPE_RDSPTY_ALARM) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_SeekByProgrammeType"); - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_SeekByProgrammeType((XAAdaptationGstCtx*)impl->adapCtx, pty, upwards); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_SeekByProgrammeType"); - return ret; -} - -/** - * XAresult XARDSItfImpl_SeekTrafficAnnouncement(XARDSItf self, XAboolean upwards) - * Description: Seeks for a frequency sending Traffic Announcement (TA). If the end - * of the tuner’s frequency band is reached before a Traffic Announcement - * is found, the scan continues from the other end until a Traffic - * Announcement is found or the original frequency is reached. Asynchronous - * - tuner callback xaRadioCallback() and XA_RADIO_EVENT_SEEK_COMPLETED - * is used for notifying of the result. StopSeeking() method of XARadioItf - * can be used to abort an ongoing seek. - **/ -XAresult XARDSItfImpl_SeekTrafficAnnouncement(XARDSItf self, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_SeekTrafficAnnouncement"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_SeekTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_SeekTrafficAnnouncement((XAAdaptationGstCtx*)impl->adapCtx, upwards); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_SeekTrafficAnnouncement"); - return ret; -} - -/** - * XAresult XARDSItfImpl_SeekTrafficProgramme(XARDSItf self, XAboolean upwards) - * Description: Seeks for a frequency sending Traffic Programme (TP). If the end - * of the tuner’s frequency band is reached before a Traffic Programme - * is found, the scan continues from the other end until a Traffic - * Programme is found or the original frequency is reached. Asynchronous - * - tuner callback xaRadioCallback() and XA_RADIO_EVENT_SEEK_COMPLETED - * is used for notifying of the result. StopSeeking() method of XARadioItf - * can be used to abort an ongoing seek. - **/ -XAresult XARDSItfImpl_SeekTrafficProgramme(XARDSItf self, XAboolean upwards) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_SeekTrafficProgramme"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_SeekTrafficProgramme"); - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_SeekTrafficProgramme((XAAdaptationGstCtx*)impl->adapCtx, upwards); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_SeekTrafficProgramme"); - return ret; -} - -/** - * XAresult XARDSItfImpl_SetAutomaticSwitching(XARDSItf self, XAboolean automatic) - * Description: Sets the automatic switching of the transmitter in the case of a - * stronger transmitter with the same PI presence. Based on AF and/or - * EON fields. Please note that NOT ALL IMPLEMENTATIONS SUPPORT THIS - * FUNCTIONALITY. - **/ -XAresult XARDSItfImpl_SetAutomaticSwitching(XARDSItf self, XAboolean automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_SetAutomaticSwitching"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_SetAutomaticSwitching"); - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_SetAutomaticSwitching((XAAdaptationGstCtx*)impl->adapCtx, automatic); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_SetAutomaticSwitching"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetAutomaticSwitching(XARDSItf self, XAboolean * automatic) - * Description: Gets the mode of the automatic switching of the transmitter in - * case of a stronger transmitter with the same PI presence. - **/ -XAresult XARDSItfImpl_GetAutomaticSwitching(XARDSItf self, XAboolean * automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetAutomaticSwitching"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl || !automatic) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetAutomaticSwitching"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_GetAutomaticSwitching((XAAdaptationGstCtx*)impl->adapCtx, automatic); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetAutomaticSwitching"); - return ret; -} - -/** - * XAresult XARDSItfImpl_SetAutomaticTrafficAnnouncement(XARDSItf self, XAboolean automatic) - * Description: Sets the automatic switching of the program in case of the presence - * of Traffic Announcement in another program. Based on TP and TA fields. - * Please note that NOT ALL IMPLEMENTATIONS SUPPORT THIS FUNCTIONALITY. - **/ -XAresult XARDSItfImpl_SetAutomaticTrafficAnnouncement(XARDSItf self, XAboolean automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_SetAutomaticTrafficAnnouncement"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_SetAutomaticTrafficAnnouncement"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_SetAutomaticTrafficAnnouncement((XAAdaptationGstCtx*)impl->adapCtx, automatic); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_SetAutomaticTrafficAnnouncement"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetAutomaticTrafficAnnouncement(XARDSItf self, XAboolean * automatic) - * Description: Gets the mode of the automatic switching of the program in case of - * the presence of Traffic Announcement in another program. Based on - * TP and TA fields. - **/ -XAresult XARDSItfImpl_GetAutomaticTrafficAnnouncement(XARDSItf self, XAboolean * automatic) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetAutomaticTrafficAnnouncement"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl || !automatic) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetAutomaticTrafficAnnouncement"); - - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_GetAutomaticTrafficAnnouncement((XAAdaptationGstCtx*)impl->adapCtx, automatic); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetAutomaticTrafficAnnouncement"); - return ret; -} - -/** - * XAresult XARDSItfImpl_GetODAGroup(XARDSItf self, - * XAint16 AID, - * xaGetODAGroupCallback callback, - * void * pContext) - * Description: Returns asynchronously via callback (xaGetODAGroupCallback()) - * the application Group and the message bits concerning the given - * ODA (Open Data Application). ODA is a mechanism that a broadcaster - * can use to transfer data that is not explicitly specified in the RDS - * standard. Open Data Applications are subject to a registration process. - * Transmission protocols used by ODAs may be public or private. See RDS - * Forum web page (http://www.rds.org.uk/)for details. - **/ -XAresult XARDSItfImpl_GetODAGroup(XARDSItf self, - XAuint16 AID, - xaGetODAGroupCallback callback, - void * pContext) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_GetODAGroup"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_GetODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - impl->odaGroupCallback = callback; - impl->odaGroupContext = pContext; - impl->odaGroupCbPtrToSelf = self; - - if (callback) - { - - // ret = XARDSItfAdapt_GetODAGroup((XAAdaptationGstCtx*)impl->adapCtx, AID); - - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_GetODAGroup"); - - return ret; -} - -/** - * XAresult XARDSItfImpl_SubscribeODAGroup(XARDSItf self, - * XAint16 group, - * XAboolean useErrorCorrection) - * Description: Subscribes the given ODA group. If the given group was already - * subscribed, this call doesn’t do anything. Only new data in groups - * that have been subscribed will cause a newODA callback. - **/ -XAresult XARDSItfImpl_SubscribeODAGroup(XARDSItf self, - XAint16 group, - XAboolean useErrorCorrection) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - - DEBUG_API("->XARDSItfImpl_SubscribeODAGroup"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_SubscribeODAGroup"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// ret = XARDSItfAdapt_SubscribeODAGroup((XAAdaptationGstCtx*)impl->adapCtx, group, useErrorCorrection); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_SubscribeODAGroup"); - return ret; -} - -/** - * XAresult XARDSItfImpl_UnsubscribeODAGroup(XARDSItf self, XAint16 group) - * Description: Unsubscribes the given ODA group. If the given group has not - * been subscribed, this doesn’t do anything. Only new data in - * groups that have been subscribed will cause a newODA callback. - **/ -XAresult XARDSItfImpl_UnsubscribeODAGroup(XARDSItf self, XAint16 group) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - - DEBUG_API("->XARDSItfImpl_UnsubscribeODAGroup"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - - if(!impl) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_UnsubscribeODAGroup"); - - return XA_RESULT_PARAMETER_INVALID; - } - - - // ret = XARDSItfAdapt_UnsubscribeODAGroup((XAAdaptationGstCtx*)impl->adapCtx, group); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_UnsubscribeODAGroup"); - return ret; -} - -/** - * XAresult XARDSItfImpl_ListODAGroupSubscriptions(XARDSItf self, - * XAint16* pGroups, - * XAuint32* pLength); - * Description: Lists ODA groups that are currently subscribed. - **/ -XAresult XARDSItfImpl_ListODAGroupSubscriptions(XARDSItf self, - XAint16* pGroups, - XAuint32* pLength) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSRadio); - DEBUG_API("->XARDSItfImpl_ListODAGroupSubscriptions"); - - if(!impl || !pLength) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_ListODAGroupSubscriptions"); - return XA_RESULT_PARAMETER_INVALID; - } - - -// XARDSItfAdapt_ListODAGroupSubscriptions((XAAdaptationGstCtx*)impl->adapCtx, pGroups, pLength); - - XA_IMPL_THREAD_SAFETY_EXIT(XATSRadio); - DEBUG_API("<-XARDSItfImpl_ListODAGroupSubscriptions"); - return ret; -} - -/** - * XAresult XARDSItfImpl_RegisterRDSCallback(XARDSItf self, - * xaRDSCallback callback, - * void * pContext) - * Description: Sets or clears the xaNewODADataCallback(). xaNewODADataCallback() - * is used tranfer the actual ODA data to the application. - **/ -XAresult XARDSItfImpl_RegisterRDSCallback(XARDSItf self, - xaRDSCallback callback, - void * pContext) -{ - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_RegisterRDSCallback"); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_RegisterRDSCallback"); - return XA_RESULT_PARAMETER_INVALID; - } - - impl->rdsCallback = callback; - impl->rdsContext = pContext; - impl->rdsCbPtrToSelf = self; - - DEBUG_API("<-XARDSItfImpl_RegisterRDSCallback"); - return ret; -} - -/** - * XAresult XARDSItfImpl_RegisterODADataCallback(XARDSItf self, - * xaNewODADataCallback callback, - * void * pContext) - * Description: Sets or clears the xaRDSCallback(). xaRDSCallback() is used to monitor - * changes in RDS fields. - **/ -XAresult XARDSItfImpl_RegisterODADataCallback(XARDSItf self, - xaNewODADataCallback callback, - void * pContext) -{ - - XAresult ret = XA_RESULT_SUCCESS; - XARDSItfImpl* impl = GetImpl(self); - DEBUG_API("->XARDSItfImpl_RegisterODADataCallback"); - - if(!impl) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - /* invalid parameter */ - DEBUG_API("<-XARDSItfImpl_RegisterODADataCallback"); - return XA_RESULT_PARAMETER_INVALID; - } - - impl->odaDataCallback = callback; - impl->odaDataContext = pContext; - impl->odaDataCbPtrToSelf = self; - - DEBUG_API("<-XARDSItfImpl_RegisterODADataCallback"); - return ret; -} - -/** - * XARDSItfImpl -specific methods - **/ - - -/** - * XARDSItfImplImpl* XARDSItfImpl_Create() - * @return XARDSItfImplImpl* - Pointer to RDSItf interface implementation - **/ -XARDSItfImpl* XARDSItfImpl_Create(XAAdaptationBaseCtx *adapCtx) -{ - XARDSItfImpl *self = (XARDSItfImpl*) - calloc(1,sizeof(XARDSItfImpl)); - DEBUG_API("->XARDSItfImpl_Create"); - if(self) - { - /* init itf default implementation */ - self->itf.QueryRDSSignal = XARDSItfImpl_QueryRDSSignal; - self->itf.GetProgrammeServiceName = XARDSItfImpl_GetProgrammeServiceName; - self->itf.GetRadioText = XARDSItfImpl_GetRadioText; - self->itf.GetRadioTextPlus = XARDSItfImpl_GetRadioTextPlus; - self->itf.GetProgrammeType = XARDSItfImpl_GetProgrammeType; - self->itf.GetProgrammeTypeString = XARDSItfImpl_GetProgrammeTypeString; - self->itf.GetProgrammeIdentificationCode = XARDSItfImpl_GetProgrammeIdentificationCode; - self->itf.GetClockTime = XARDSItfImpl_GetClockTime; - self->itf.GetTrafficAnnouncement = XARDSItfImpl_GetTrafficAnnouncement; - self->itf.GetTrafficProgramme = XARDSItfImpl_GetTrafficProgramme; - self->itf.SeekByProgrammeType = XARDSItfImpl_SeekByProgrammeType; - self->itf.SeekTrafficAnnouncement = XARDSItfImpl_SeekTrafficAnnouncement; - self->itf.SeekTrafficProgramme = XARDSItfImpl_SeekTrafficProgramme; - self->itf.SetAutomaticSwitching = XARDSItfImpl_SetAutomaticSwitching; - self->itf.GetAutomaticSwitching = XARDSItfImpl_GetAutomaticSwitching; - self->itf.SetAutomaticTrafficAnnouncement = XARDSItfImpl_SetAutomaticTrafficAnnouncement; - self->itf.GetAutomaticTrafficAnnouncement = XARDSItfImpl_GetAutomaticTrafficAnnouncement; - self->itf.GetODAGroup = XARDSItfImpl_GetODAGroup; - self->itf.SubscribeODAGroup = XARDSItfImpl_SubscribeODAGroup; - self->itf.UnsubscribeODAGroup = XARDSItfImpl_UnsubscribeODAGroup; - self->itf.ListODAGroupSubscriptions = XARDSItfImpl_ListODAGroupSubscriptions; - self->itf.RegisterRDSCallback = XARDSItfImpl_RegisterRDSCallback; - self->itf.RegisterODADataCallback = XARDSItfImpl_RegisterODADataCallback; - - /* init variables */ - - self->odaDataCallback = NULL; - self->odaDataContext = NULL; - self->odaDataCbPtrToSelf = NULL; - self->odaGroupCallback = NULL; - self->odaGroupContext = NULL; - self->odaGroupCbPtrToSelf = NULL; - self->rdsCallback = NULL; - self->rdsContext = NULL; - self->rdsCbPtrToSelf = NULL; - - XAAdaptationBase_AddEventHandler( adapCtx, &XARDSItfImpl_AdaptCb, XA_RDSITFEVENTS, self ); - - self->adapCtx = adapCtx; - - self->self = self; - } - - DEBUG_API("<-XARDSItfImpl_Create"); - return self; -} - -/* void XARDSItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) - * @param void *pHandlerCtx - pointer to cb context (XARadioItfImpl) - * @param XAAdaptEvent *event - Event - * Description: Event handler for adaptation events - */ -void XARDSItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ) -{ - XARDSItfImpl* impl =(XARDSItfImpl*)pHandlerCtx; - DEBUG_API("->XARDSItfImpl_AdaptCb"); - - if(!impl) - { - DEBUG_ERR("XARadioItfImpl_AdaptCb, invalid context pointer!"); - DEBUG_API("<-XARDSItfImpl_AdaptCb"); - return; - } - assert(event); - - if( event->eventid == XA_ADAPT_RDS_GET_ODA_GROUP_DONE && impl->odaGroupCallback ) - { - /* stubbed (enough for emulation purposes) */ - /* XA_BOOLEAN_FALSE and -1 means oda group not found */ - impl->odaGroupCallback( (XARadioItf) impl->odaGroupCbPtrToSelf, impl->odaGroupContext, XA_BOOLEAN_FALSE, -1, 0 ); - } - DEBUG_API("<-XARDSItfImpl_AdaptCb"); -} - -/** - * void XARDSItfImpl_Free(XARDSItfImpl* self) - * @param XARDSItfImpl* self - - **/ -void XARDSItfImpl_Free(XARDSItfImpl* self) -{ - DEBUG_API("->XARDSItfImpl_Free"); - XA_IMPL_THREAD_SAFETY_ENTRY_FOR_VOID_FUNCTIONS(XATSRadio); - assert(self==self->self); - - XAAdaptationBase_RemoveEventHandler( self->adapCtx, &XARDSItfImpl_AdaptCb ); - - XARDSItfAdapt_Free(self->adapCtx); - - free(self); - XA_IMPL_THREAD_SAFETY_EXIT_FOR_VOID_FUNCTIONS(XATSRadio); - DEBUG_API("<-XARDSItfImpl_Free"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/radio/xardsitf.h --- a/khronosfws/openmax_al/src/radio/xardsitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,130 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XARDSITF_H -#define XARDSITF_H - -#include "xaadptbasectx.h" -/** MACROS **/ -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ -/* Definition of XAEqualizerItf implementation */ -typedef struct XARDSItfImpl_ -{ - /* parent interface */ - struct XARDSItf_ itf; - /* pointer to self */ - struct XARDSItfImpl_* self; - - /* variables */ - - xaRDSCallback rdsCallback; - void *rdsContext; - XARDSItf rdsCbPtrToSelf; - - xaGetODAGroupCallback odaGroupCallback; - void *odaGroupContext; - XARDSItf odaGroupCbPtrToSelf; - - xaNewODADataCallback odaDataCallback; - void *odaDataContext; - XARDSItf odaDataCbPtrToSelf; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; -} XARDSItfImpl; - -/** METHODS **/ - -/* Base interface XARDSItf implementation */ - -XAresult XARDSItfImpl_QueryRDSSignal(XARDSItf self, XAboolean * isSignal); - -XAresult XARDSItfImpl_GetProgrammeServiceName(XARDSItf self, XAchar * ps); - -XAresult XARDSItfImpl_GetRadioText(XARDSItf self, XAchar * rt); - -XAresult XARDSItfImpl_GetRadioTextPlus(XARDSItf self, - XAuint8 contentType, - XAchar * informationElement, - XAchar * descriptor, - XAuint8 * descriptorContentType); - -XAresult XARDSItfImpl_GetProgrammeType(XARDSItf self, XAuint32 * pty); - -XAresult XARDSItfImpl_GetProgrammeTypeString(XARDSItf self, - XAboolean isLengthMax16, - XAchar * pty); - -XAresult XARDSItfImpl_GetProgrammeIdentificationCode(XARDSItf self, XAint16 * pi); - -XAresult XARDSItfImpl_GetClockTime(XARDSItf self, XAtime * dateAndTime); - -XAresult XARDSItfImpl_GetTrafficAnnouncement(XARDSItf self, XAboolean * ta); - -XAresult XARDSItfImpl_GetTrafficProgramme(XARDSItf self, XAboolean * tp); - -XAresult XARDSItfImpl_SeekByProgrammeType(XARDSItf self, - XAuint32 pty, - XAboolean upwards); - -XAresult XARDSItfImpl_SeekTrafficAnnouncement(XARDSItf self, XAboolean upwards); - -XAresult XARDSItfImpl_SeekTrafficProgramme(XARDSItf self, XAboolean upwards); - -XAresult XARDSItfImpl_SetAutomaticSwitching(XARDSItf self, XAboolean automatic); - -XAresult XARDSItfImpl_GetAutomaticSwitching(XARDSItf self, XAboolean * automatic); - -XAresult XARDSItfImpl_SetAutomaticTrafficAnnouncement(XARDSItf self, XAboolean automatic); - -XAresult XARDSItfImpl_GetAutomaticTrafficAnnouncement(XARDSItf self, XAboolean * automatic); - -XAresult XARDSItfImpl_GetODAGroup(XARDSItf self, - XAuint16 AID, - xaGetODAGroupCallback callback, - void * pContext); - -XAresult XARDSItfImpl_SubscribeODAGroup(XARDSItf self, - XAint16 group, - XAboolean useErrorCorrection); - -XAresult XARDSItfImpl_UnsubscribeODAGroup(XARDSItf self, XAint16 group); - -XAresult XARDSItfImpl_ListODAGroupSubscriptions(XARDSItf self, - XAint16* pGroups, - XAuint32* pLength); - -XAresult XARDSItfImpl_RegisterRDSCallback(XARDSItf self, - xaRDSCallback callback, - void * pContext); - -XAresult XARDSItfImpl_RegisterODADataCallback(XARDSItf self, - xaNewODADataCallback callback, - void * pContext); - - -/* XARDSItfImpl -specific methods */ -XARDSItfImpl* XARDSItfImpl_Create(XAAdaptationBaseCtx *adapCtx); - -void XARDSItfImpl_AdaptCb( void *pHandlerCtx, XAAdaptEvent *event ); -void XARDSItfImpl_Free(XARDSItfImpl* self); - -#endif /* XARDSITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/vibra/xavibradevice.c --- a/khronosfws/openmax_al/src/vibra/xavibradevice.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,315 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xavibradevice.h" -#include "xavibraitf.h" -#include "xaconfigextensionsitf.h" -#include "xadynintmgmtitf.h" -#include "xavibraadaptctx.h" - -/* Static mapping of enumeration XAVibraDeviceInterfaces to interface iids */ -static const XAInterfaceID* XAVibraDeviceItfIIDs[VIBRA_ITFCOUNT]= -{ - &XA_IID_OBJECT, - &XA_IID_CONFIGEXTENSION, - &XA_IID_VIBRA, - &XA_IID_DYNAMICINTERFACEMANAGEMENT -}; - - -/***************************************************************************** - * Global methods - *****************************************************************************/ -/* - * XAresult XAVibraDeviceImpl_CreateVibraDevice - * Description: Create object - */ -XAresult XAVibraDeviceImpl_CreateVibraDevice(FrameworkMap* mapper, - XAObjectItf* pDevice, - XAuint32 deviceID, - XAuint32 numInterfaces, - const XAInterfaceID * pInterfaceIds, - const XAboolean * pInterfaceRequired) -{ - XAVibraDeviceImpl* pImpl = NULL; - XAObjectItfImpl* pBaseObj = NULL; - XAuint8 itfIndex = 0; - - DEBUG_API("->XAVibraDeviceImpl_CreateVibraDevice"); - - if( !pDevice ) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraDeviceImpl_CreateVibraDevice"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* instantiate object implementation */ - pImpl = (XAVibraDeviceImpl*)calloc(1,sizeof(XAVibraDeviceImpl)); - if( !pImpl ) - { - /* memory allocation failed */ - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XAVibraDeviceImpl_CreateVibraDevice"); - return XA_RESULT_MEMORY_FAILURE; - } - pBaseObj = &pImpl->baseObj; - - /* Initialize base object default implementation */ - XAObjectItfImpl_Init(pBaseObj, - VIBRA_ITFCOUNT, - XAVibraDeviceItfIIDs, - XAVibraDeviceImpl_DoRealize, - XAVibraDeviceImpl_DoResume, - XAVibraDeviceImpl_FreeResources); - - /* Mark interfaces that need to be exposed */ - /* Implicit and mandated interfaces */ - pBaseObj->interfaceMap[VIBRA_VIBRAITF].required = XA_BOOLEAN_TRUE; - pBaseObj->interfaceMap[VIBRA_DIMITF].required = XA_BOOLEAN_TRUE; - - /* Explicit interfaces */ - if( (numInterfaces != 0) && pInterfaceIds && pInterfaceRequired ) - { - /* Check required interfaces */ - for( itfIndex = 0; itfIndex < numInterfaces; itfIndex++ ) - { - /* If mapEntry is null then required interface is not supported.*/ - XAObjItfMapEntry *entry = - XAObjectItfImpl_GetItfEntry((XAObjectItf)&(pBaseObj), pInterfaceIds[itfIndex]); - if( !entry ) - { - if( pInterfaceRequired[itfIndex] ) - { - /* required interface cannot be accommodated - fail creation */ - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - DEBUG_ERR("Required interface not found - abort creation!"); - DEBUG_API("<-XAVibraDeviceImpl_CreateVibraDevice"); - return XA_RESULT_FEATURE_UNSUPPORTED; - } - else - { - DEBUG_INFO("Requested (not required) interface not found - continue creation"); - } - } - else - { - entry->required = XA_BOOLEAN_TRUE; - } - } - } - - /* This code is put here to return Feature Not Supported since adaptation is not present*/ - /*************************************************/ - DEBUG_ERR("Required interface not found - abort creation!"); - XAObjectItfImpl_Destroy((XAObjectItf)&(pBaseObj)); - DEBUG_API("<-XAVibraDeviceImpl_CreateVibraDevice"); - return XA_RESULT_FEATURE_UNSUPPORTED; - /*************************************************/ - -/* // Initialize XAVibraDeviceImpl variables - pImpl->deviceID = deviceID; - - - pImpl->adaptationCtx = XAVibraAdapt_Create(pImpl->deviceID); - - //Set ObjectItf to point to newly created object - *pDevice = (XAObjectItf)&(pBaseObj->self); - - DEBUG_API("<-XAVibraDeviceImpl_Create"); - return XA_RESULT_SUCCESS;*/ -} -/* XAResult XAVibraDeviceImpl_QueryNumSupportedInterfaces - * Description: Statically query number of supported interfaces - */ -XAresult XAVibraDeviceImpl_QueryNumSupportedInterfaces(XAuint32 *pNumSupportedInterfaces) -{ - DEBUG_API("->XAVibraDeviceImpl_QueryNumSupportedInterfaces"); - if( pNumSupportedInterfaces ) - { - *pNumSupportedInterfaces = VIBRA_ITFCOUNT; - - DEBUG_API_A1("<-XAVibraDeviceImpl_QueryNumSupportedInterfaces - %ld", *pNumSupportedInterfaces ); - return XA_RESULT_SUCCESS; - } - else - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraDeviceImpl_QueryNumSupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } -} -/* XAResult XACVibraDeviceImpl_QuerySupportedInterfaces - * Description: Statically query supported interfaces - */ -XAresult XAVibraDeviceImpl_QuerySupportedInterfaces(XAuint32 index, - XAInterfaceID *pInterfaceId) -{ - DEBUG_API("->XAVibraDeviceImpl_QuerySupportedInterfaces"); - - if( index >= VIBRA_ITFCOUNT || !pInterfaceId ) - { - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraDeviceImpl_QuerySupportedInterfaces"); - return XA_RESULT_PARAMETER_INVALID; - } - else - { - *pInterfaceId = *(XAVibraDeviceItfIIDs[index]); - - DEBUG_API("<-XAVibraDeviceImpl_QuerySupportedInterfaces"); - return XA_RESULT_SUCCESS; - } -} -/***************************************************************************** - * base object XAObjectItfImpl methods - *****************************************************************************/ -/* XAResult XAVibraDeviceImpl_DoRealize - * Description: Realize all implicit and explicitly wanted interfaces. - * Create and initialize implementation-specific variables. - * Called from base object XAObjectItfImpl - */ -XAresult XAVibraDeviceImpl_DoRealize(XAObjectItf self) -{ - XAuint8 itfIdx = 0; - XAObjectItfImpl* pObj = (XAObjectItfImpl*)(*self); - XAVibraDeviceImpl* pObjImpl = (XAVibraDeviceImpl*)(pObj); - XAresult ret = XA_RESULT_SUCCESS; - - DEBUG_API("->XAVibraDeviceImpl_DoRealize"); - - /* check casting from correct pointer type */ - if( !pObjImpl || pObj != pObjImpl->baseObj.self ) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); - return XA_RESULT_PARAMETER_INVALID; - } - - - ret = XAVibraAdapt_PostInit( pObjImpl->adaptationCtx ); - - if( ret != XA_RESULT_SUCCESS ) - { - DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); - return ret; - } - - /* Realize all implicit and explicitly wanted interfaces */ - for( itfIdx = 0; itfIdx < VIBRA_ITFCOUNT; itfIdx++) - { - if( !(pObj->interfaceMap[itfIdx].pItf) && - pObj->interfaceMap[itfIdx].required ) - { - void *pItf = NULL; - switch( itfIdx ) - { - case VIBRA_VIBRAITF: - - pItf = XAVibraItfImpl_Create(pObjImpl->adaptationCtx); - - break; - case VIBRA_CONFIGEXTENSIONITF: - pItf = XAConfigExtensionsItfImpl_Create(); - break; - case VIBRA_DIMITF: - pItf = XADIMItfImpl_Create(); - break; - default: - break; - } - if( !pItf ) - { - /* memory allocation failed */ - DEBUG_ERR("XA_RESULT_MEMORY_FAILURE"); - DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); - return XA_RESULT_MEMORY_FAILURE; - } - else - { - pObj->interfaceMap[itfIdx].pItf = pItf; - } - } - } - - pObj->state = XA_OBJECT_STATE_REALIZED; - DEBUG_API("<-XAVibraDeviceImpl_DoRealize"); - return XA_RESULT_SUCCESS; -} - -/* XAResult XAVibraDeviceImpl_DoResume - * Description: Resume object from suspended state - */ -XAresult XAVibraDeviceImpl_DoResume(XAObjectItf self) -{ - DEBUG_API("->XAVibraDeviceImpl_DoResume"); - DEBUG_API("<-XAVibraDeviceImpl_DoResume"); - /* This implementation does not support suspended state */ - return XA_RESULT_PRECONDITIONS_VIOLATED; -} -/* void XAVibraDeviceImpl_FreeResources - * Description: Free all resources reserved at XAVibraDeviceImpl_DoRealize() - */ -void XAVibraDeviceImpl_FreeResources(XAObjectItf self) -{ - XAObjectItfImpl* pObj = (XAObjectItfImpl*) (*self); - XAVibraDeviceImpl* pImpl = (XAVibraDeviceImpl*) (*self); - XAuint8 itfIdx = 0; - DEBUG_API("->XAVibraDeviceImpl_FreeResources"); - - - assert( pObj && pImpl && pObj == pObj->self ); - if (pImpl->adaptationCtx != NULL) - { - XAVibraAdapt_Destroy(pImpl->adaptationCtx); - pImpl->adaptationCtx = NULL; - } - - /* free all allocated interfaces */ - for (itfIdx = 0; itfIdx < VIBRA_ITFCOUNT; itfIdx++) - { - void *pItf = pObj->interfaceMap[itfIdx].pItf; - if (pItf) - { - switch (itfIdx) - { - case VIBRA_VIBRAITF: - XAVibraItfImpl_Free( pItf ); - break; - case VIBRA_CONFIGEXTENSIONITF: - XAConfigExtensionsItfImpl_Free( pItf ); - break; - case VIBRA_DIMITF: - XADIMItfImpl_Free( pItf ); - break; - default: - break; - } - pObj->interfaceMap[itfIdx].pItf = NULL; - } - } - - DEBUG_API("<-XAVibraDeviceImpl_FreeResources"); - - return; -} -/* END OF FILE*/ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/vibra/xavibradevice.h --- a/khronosfws/openmax_al/src/vibra/xavibradevice.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIBRADEVICE_H -#define XAVIBRADEVICE_H - -#include "xaobjectitf.h" -#include "xaadptbasectx.h" -/** MACROS **/ - - -/** TYPES **/ - - -/** ENUMERATIONS **/ -/* Enumeration for interfaces that CameraDevice supports. */ -typedef enum -{ - VIBRA_OBJECTITF, - VIBRA_CONFIGEXTENSIONITF, - VIBRA_VIBRAITF, - VIBRA_DIMITF, - VIBRA_ITFCOUNT -} XAVibraDeviceInterfaces; - -/** STRUCTURES **/ -/* Specification for VibraDeviceImpl. */ -typedef struct XAVibraDeviceImpl_ -{ - /* Parent for XACameraDeviceImpl */ - XAObjectItfImpl baseObj; - - /* variables */ - XAuint32 deviceID; - - XAAdaptationBaseCtx* adaptationCtx; - -} XAVibraDeviceImpl; - -/** METHODS **/ - -/* base object XAObjectItfImpl methods */ -XAresult XAVibraDeviceImpl_DoRealize(XAObjectItf self); -XAresult XAVibraDeviceImpl_DoResume(XAObjectItf self); -void XAVibraDeviceImpl_FreeResources(XAObjectItf self); - -#endif /* XAVIBRADEVICE_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/vibra/xavibraitf.c --- a/khronosfws/openmax_al/src/vibra/xavibraitf.c Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,280 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#include -#include -#include -#include "xavibraitf.h" - -#include "xavibraitfadaptation.h" - -#include "xathreadsafety.h" -/* XAVibraItfImpl* GetImpl(XAVibraItf self) - * Description: Validate interface pointer and cast it to implementation pointer. -*/ -static XAVibraItfImpl* GetImpl(XAVibraItf self) -{ - if( self ) - { - XAVibraItfImpl* impl = (XAVibraItfImpl*)(*self); - if( impl && (impl == impl->self) ) - { - return impl; - } - } - return NULL; -} - -/***************************************************************************** - * Base interface XAVibraItf implementation - *****************************************************************************/ -/* - * XAresult XAVibraItfImpl_Vibrate ( XAVibraItf self, XAboolean vibrate ) - * Description: Activates or deactivates vibration for the I/O device. - */ -XAresult XAVibraItfImpl_Vibrate ( XAVibraItf self, - XAboolean vibrate ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVibraItfImpl_Vibrate"); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSVibra); - - if( !impl ) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfImpl_Vibrate"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is vibrate mode changed */ - if( impl->vibrate != vibrate ) - { - - ret = XAVibraItfAdapt_Vibrate( (XAAdaptationGstCtx*)impl->adapCtx, vibrate ); - - if ( ret == XA_RESULT_SUCCESS ) - { - impl->vibrate = vibrate; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); - DEBUG_API("<-XAVibraItfImpl_Vibrate"); - return ret; -} -/* - * XAresult XAVibraItfImpl_IsVibrating ( XAVibraItf self, XAboolean * pVibrating ) - * Description: Returns whether the I/O device is vibrating. - */ -XAresult XAVibraItfImpl_IsVibrating ( XAVibraItf self, XAboolean * pVibrating ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVibraItfImpl_IsVibrating"); - - if( !impl || !pVibrating) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfImpl_IsVibrating"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pVibrating = impl->vibrate; - - if( *pVibrating ) - { - DEBUG_API("It's vibrating"); - } - else - { - DEBUG_API("Vibrate is off."); - } - - DEBUG_API("<-XAVibraItfImpl_IsVibrating"); - return ret; -} -/* - * XAresult XAVibraItfImpl_SetFrequency ( XAVibraItf self, XAmilliHertz frequency ) - * Description: Sets the vibration frequency of the I/O device. - */ -XAresult XAVibraItfImpl_SetFrequency ( XAVibraItf self, XAmilliHertz frequency ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraItfImpl* impl = GetImpl(self); - - DEBUG_API_A1("->XAVibraItfImpl_SetFrequency %ld", frequency); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSVibra); - - if( !impl || frequency < MIN_FREQUENCY || frequency > MAX_FREQUENCY) - { - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfImpl_SetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is vibration frequency changed */ - if( impl->frequency != frequency ) - { - - ret = XAVibraItfAdapt_SetFrequency( (XAAdaptationGstCtx*)impl->adapCtx, frequency ); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->frequency = frequency; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); - DEBUG_API("<-XAVibraItfImpl_SetFrequency"); - return ret; -} -/* - * XAresult XAVibraItfImpl_GetFrequency ( XAVibraItf self, XAmilliHertz * pFrequency ) - * Description: Returns the vibration frequency of the I/O device. - */ -XAresult XAVibraItfImpl_GetFrequency ( XAVibraItf self, XAmilliHertz * pFrequency ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVibraItfImpl_GetFrequency"); - if( !impl || !pFrequency) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfImpl_GetFrequency"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pFrequency = impl->frequency; - - DEBUG_API_A1("Frequency is %ld", *pFrequency); - DEBUG_API("<-XAVibraItfImpl_GetFrequency"); - return ret; -} -/* - * XAresult XAVibraItfImpl_SetIntensity ( XAVibraItf self, XApermille intensity ) - * Description: Sets the vibration intensity of the Vibra I/O device. - */ -XAresult XAVibraItfImpl_SetIntensity ( XAVibraItf self, XApermille intensity ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraItfImpl* impl = GetImpl(self); - DEBUG_API_A1("->XAVibraItfImpl_SetIntensity %d", intensity); - XA_IMPL_THREAD_SAFETY_ENTRY(XATSVibra); - - if( !impl || intensity < MIN_INTENSITY || intensity > MAX_INTENSITY ) - { - /* invalid parameter */ - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfImpl_SetIntensity"); - return XA_RESULT_PARAMETER_INVALID; - } - - /* check is vibration intensity changed */ - if( impl->intensity != intensity ) - { - - ret = XAVibraItfAdapt_SetIntensity( (XAAdaptationGstCtx*)impl->adapCtx, intensity ); - - if( ret == XA_RESULT_SUCCESS ) - { - impl->intensity = intensity; - } - } - - XA_IMPL_THREAD_SAFETY_EXIT(XATSVibra); - DEBUG_API("<-XAVibraItfImpl_SetIntensity"); - return ret; -} -/* - * XAresult XAVibraItfImpl_GetIntensity ( XAVibraItf self, XApermille * pIntensity ) - * Description: Returns the vibration intensity of the Vibra I/O device. - */ -XAresult XAVibraItfImpl_GetIntensity ( XAVibraItf self, XApermille * pIntensity ) -{ - XAresult ret = XA_RESULT_SUCCESS; - XAVibraItfImpl* impl = GetImpl(self); - DEBUG_API("->XAVibraItfImpl_GetIntensity"); - - if( !impl || !pIntensity) - { - /* invalid parameter */ - DEBUG_ERR("XA_RESULT_PARAMETER_INVALID"); - DEBUG_API("<-XAVibraItfImpl_GetIntensity"); - return XA_RESULT_PARAMETER_INVALID; - } - - *pIntensity = impl->intensity; - - DEBUG_API_A1("Intensity is %d", *pIntensity); - DEBUG_API("<-XAVibraItfImpl_GetIntensity"); - return ret; -} - - - -/***************************************************************************** - * XAVibraItfImpl -specific methods - *****************************************************************************/ -/* XAVibraItfImpl* XAVibraItfImpl_Create() - * Description: Allocate and initialize VibraItfImpl - */ -XAVibraItfImpl* XAVibraItfImpl_Create( XAAdaptationBaseCtx *adapCtx ) -{ - XAVibraItfImpl* self = (XAVibraItfImpl*) calloc(1,sizeof(XAVibraItfImpl)); - DEBUG_API("->XAVibraItfImpl_Create"); - if( self ) - { - /* init itf default implementation*/ - self->itf.Vibrate = XAVibraItfImpl_Vibrate; - self->itf.IsVibrating = XAVibraItfImpl_IsVibrating; - self->itf.SetFrequency = XAVibraItfImpl_SetFrequency; - self->itf.GetFrequency = XAVibraItfImpl_GetFrequency; - self->itf.SetIntensity = XAVibraItfImpl_SetIntensity; - self->itf.GetIntensity = XAVibraItfImpl_GetIntensity; - - /* init variables*/ - self->vibrate = XA_BOOLEAN_FALSE; - self->frequency = 0; - self->intensity = 0; - self->adapCtx = adapCtx; - - self->self = self; - } - - DEBUG_API("<-XAVibraItfImpl_Create"); - return self; -} - -/* void XAVibraItfImpl_Free(XAVibraItfImpl* self) - * Description: Free all resources reserved at XAVibraItfImpl_Create - */ -void XAVibraItfImpl_Free(XAVibraItfImpl* self) -{ - DEBUG_API("->XAVibraItfImpl_Free"); - assert( self==self->self ); - free( self ); - DEBUG_API("<-XAVibraItfImpl_Free"); -} - diff -r ebf79c79991a -r 5e8b14bae8c3 khronosfws/openmax_al/src/vibra/xavibraitf.h --- a/khronosfws/openmax_al/src/vibra/xavibraitf.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -#ifndef XAVIBRAITF_H -#define XAVIBRAITF_H - -#include "xaadptbasectx.h" - -/** MACROS **/ -#define MIN_INTENSITY 0 -#define MAX_INTENSITY 1000 -#define MIN_FREQUENCY 0x00000001 -#define MAX_FREQUENCY 0xFFFFFFFF -/** TYPES **/ - -/** ENUMERATIONS **/ - -/** STRUCTURES **/ - -/* Definition of XAXAVibraItfItf implementation */ -typedef struct XAVibraItfImpl_ -{ - /* parent interface */ - struct XAVibraItf_ itf; - /* pointer to self */ - struct XAVibraItfImpl_* self; - - /* variables */ - XAboolean vibrate; - XAmilliHertz frequency; - XApermille intensity; - - /*Adaptation variables*/ - XAAdaptationBaseCtx *adapCtx; - -} XAVibraItfImpl; - -/** METHODS **/ - -/* Base interface XAVibraItf implementation - * See API Specification for method documentation -*/ -XAresult XAVibraItfImpl_Vibrate ( XAVibraItf self, XAboolean vibrate ); -XAresult XAVibraItfImpl_IsVibrating ( XAVibraItf self, XAboolean * pVibrating ); -XAresult XAVibraItfImpl_SetFrequency ( XAVibraItf self, XAmilliHertz frequency ); -XAresult XAVibraItfImpl_GetFrequency ( XAVibraItf self, XAmilliHertz * pFrequency ); -XAresult XAVibraItfImpl_SetIntensity ( XAVibraItf self, XApermille intensity ); -XAresult XAVibraItfImpl_GetIntensity ( XAVibraItf self, XApermille * pIntensity ); - - -/* XAVibraItfImpl -specific methods*/ -XAVibraItfImpl* XAVibraItfImpl_Create( XAAdaptationBaseCtx *adapCtx ); - -void XAVibraItfImpl_Free(XAVibraItfImpl* self); -#endif /* XAVIBRAITF_H */ diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/ActiveScheduledTestModule/data/mmc/Tone/Espionage.rng --- a/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/ActiveScheduledTestModule/data/mmc/Tone/Espionage.rng Fri Jun 25 17:36:03 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/ActiveScheduledTestModule/data/mmc/Tone/Espionage.rng Fri Jul 09 16:43:35 2010 -0500 @@ -1,1 +1,1 @@ -J:e +J:e diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/ActiveScheduledTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/data/mmc/Tone/Espionage.rng --- a/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/data/mmc/Tone/Espionage.rng Fri Jun 25 17:36:03 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/data/mmc/Tone/Espionage.rng Fri Jul 09 16:43:35 2010 -0500 @@ -1,1 +1,1 @@ -J:e +J:e diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioPlaybackTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioRecorderTestModule/data/mmc/Tone/Espionage.rng --- a/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioRecorderTestModule/data/mmc/Tone/Espionage.rng Fri Jun 25 17:36:03 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioRecorderTestModule/data/mmc/Tone/Espionage.rng Fri Jul 09 16:43:35 2010 -0500 @@ -1,1 +1,1 @@ -J:e +J:e diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioRecorderTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioStreamTestModule/data/mmc/Tone/Espionage.rng --- a/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioStreamTestModule/data/mmc/Tone/Espionage.rng Fri Jun 25 17:36:03 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioStreamTestModule/data/mmc/Tone/Espionage.rng Fri Jul 09 16:43:35 2010 -0500 @@ -1,1 +1,1 @@ -J:e +J:e diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioStreamTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioToneTestModule/data/mmc/Tone/Espionage.rng --- a/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioToneTestModule/data/mmc/Tone/Espionage.rng Fri Jun 25 17:36:03 2010 -0500 +++ b/mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioToneTestModule/data/mmc/Tone/Espionage.rng Fri Jul 09 16:43:35 2010 -0500 @@ -1,1 +1,1 @@ -J:e +J:e diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/advancedaudiocontroller/tsrc/advancedaudiocontrollertestmodule/AudioToneTestModule/data/mmc/metadata/DRM_NRTmeta.dcf diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/ClientProgDLSource.cpp --- a/mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/ClientProgDLSource.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,569 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of the ClientProgDLSource class. -* -*/ - - -#include -#include -#include -#include "ClientProgDLSource.h" -#include "EventNotifier.h" -#include "EventAO.h" -#include "ErrorCode.h" -#include "ProgDLSourceUid.h" - -#define RETURN_IF_ERROR(x) if(x != KErrNone) return x - -// CONSTANTS -const TInt KLocalFile = -1; -const TInt KTranferRateMonitorFrequency = 2; -const TInt KFileSizeChangeDelta = 10000; -const TInt KNofityAfterPercentage = 5; - -using namespace multimedia; - -CClientProgDLSource::CClientProgDLSource() - { - iSourceState = CMultimediaDataSource::ECLOSED; - isDownloadComplete = false; - iProgressiveMode = false; - } - -CClientProgDLSource::~CClientProgDLSource() - { - delete iEventNotifier; - delete iMonitor; - delete iFileName; - - if(iStateEvent->IsActive()) - { - iStateEvent->Cancel(); - } - - delete iStateEvent; - } - -TInt CClientProgDLSource::PostConstructor() - { - TInt status(KErrNone); - // Make sure this doesn't get called second time around. - if ( !iEventNotifier ) - { - TRAP(status, iEventNotifier = CEventNotifier::NewL()); - } - - RETURN_IF_ERROR(status); - - TRAP(status, iStateEvent = CEventAO::NewL(*this)); - - return status; - } - -TInt CClientProgDLSource::AddObserver( MControlObserver& aObserver ) - { - return iEventNotifier->AddObserver( aObserver ); - } - -TInt CClientProgDLSource::RemoveObserver( MControlObserver& aObserver ) - { - return iEventNotifier->RemoveObserver( aObserver ); - } - -TUid CClientProgDLSource::Type() - { - return KProgDLSourceControl; - } - -TControlType CClientProgDLSource::ControlType() - { - return ESourceControl; - } - -TInt CClientProgDLSource::GetSize( TUint& aSize ) - { - TInt status(KErrNone); - aSize = iSourceSize; - return status; - } - -TInt CClientProgDLSource::GetMimeType( TDes8& aMimeType ) - { - TInt status = iDownloadGateway->GetMimeType(iDownloadId,aMimeType); - return status; - } - -TInt CClientProgDLSource::Close() - { - TInt status(KErrNone); - if(iMonitor) - { - iMonitor->Stop(); - } - // Reset the Progressive Mode flag always - iDownloadGateway->SetProgressiveMode(iDownloadId,EFalse); - iProgressiveMode = EFalse; - iDownloadId = 0; - iCurrentBytes = 0; - isDownloadPaused = EFalse; - isDownloadComplete = EFalse; - iCurrentSize = 0; - iSourceSize = 0; - iServerSourceExists = EFalse; - return status; - } - -TInt CClientProgDLSource::SetDownloadGateway(CDownloadGateway* aDownloadGateway) - { - iDownloadGateway = aDownloadGateway; - return KErrNone; - } - - -TInt CClientProgDLSource::Open(const TDesC& aFileName,TInt32 aDLTxId ) - { - TInt status(KErrNone); - if(aDLTxId != KLocalFile) - { - status = iDownloadGateway->ConnectToDownload(aDLTxId,*this,KNullUid); - if(status == KErrNone) - { - iDownloadId = aDLTxId; - isDownloadComplete = EFalse; - //Gets current downloaded size - status = iDownloadGateway->GetDownloadSize(iDownloadId,iSourceSize); - RETURN_IF_ERROR(status); - } - else - { - iDownloadId = 0; - return status; - } - } - else - { - isDownloadComplete = ETrue; - } - - if(iFileName) - { - delete iFileName; - iFileName = NULL; - } - - TRAP(status,iFileName = HBufC::NewL(aFileName.Size())); - - if(!status) - { - TPtr des = iFileName->Des(); - des.Copy(aFileName); - } - - return status; - } - -TInt CClientProgDLSource::MoveFile(const TDesC& aDestFileName ) - { - TInt status(KErrNone); - iDestFileName.Copy(aDestFileName); - status = iDownloadGateway->MoveFile(iDownloadId,aDestFileName); - return status; - } - -TInt CClientProgDLSource::IsDownloadComplete(TBool& aBool) - { - TInt status(KErrNone); - - TDownloadStatus dlStatus; - status = iDownloadGateway->GetDownloadStatus(iDownloadId,dlStatus); - if(dlStatus == ECompleted) - { - aBool = true; - } - else - { - aBool = false; - } - - return status; - } - -TInt CClientProgDLSource::GetPercentageDownloaded(TUint& aPercent) - { - TInt status(KErrNone); - TUint curSize; - TUint fullSize; - if(!isDownloadComplete) - { - status = iDownloadGateway->GetCurrentSize(iDownloadId,curSize); - RETURN_IF_ERROR(status); - status = iDownloadGateway->GetDownloadSize(iDownloadId,fullSize); - RETURN_IF_ERROR(status); - } - else - { - curSize = iCurrentSize; - fullSize = iSourceSize; - } - - if(fullSize) - { - aPercent = (curSize*100/fullSize); - } - else - { - aPercent = 0; - } - return status; - } - -TInt CClientProgDLSource::GetDownloadingRate(TUint& aRate) - { - TInt status(KErrNone); - if(iMonitor) - { - aRate = iMonitor->TransferRate(); - } - else - { - status = KErrNotFound; - } - return status; - } - -TInt CClientProgDLSource::GetCurrentFileSize( TUint& aSize ) - { - TInt status(KErrNotFound); - if(!isDownloadComplete) - { - status = iDownloadGateway->GetCurrentSize(iDownloadId,aSize); - } - else - { - iCurrentSize = iSourceSize; - status = KErrNone; - } - return status; - } - -TInt CClientProgDLSource::GetExpectedFileSize( TUint& aSize ) - { - TInt status(KErrNotFound); - if(!isDownloadComplete) - { - status = iDownloadGateway->GetDownloadSize(iDownloadId,aSize); - } - else - { - aSize = iSourceSize; - status = KErrNone; - } - return status; - } - -MProgDLSource::TDownloadStatus CClientProgDLSource::GetDownloadStatus() - { - MProgDLSource::TDownloadStatus dlStatus; - iDownloadGateway->GetDownloadStatus(iDownloadId,dlStatus); - return dlStatus; - } - - -TInt CClientProgDLSource::GetPercentageBuffered(TUint& aPercent) - { - //Source Custom Command - TPckgBuf pckg; - if(iServerSourceExists) - { - iCustomCommand->CustomCommandSync( iSourceHandle, EGetPercentageBuffered, KNullDesC8, KNullDesC8, pckg ); - aPercent = pckg(); - return KErrNone; - } - else - { - aPercent = 0; - return KErrNotFound; - } - } - -TInt CClientProgDLSource::GetBitRate(TUint& aRate) - { - //Source Custom Command - TPckgBuf pckg; - if(iServerSourceExists) - { - iCustomCommand->CustomCommandSync( iSourceHandle, EGetBitRate, KNullDesC8, KNullDesC8, pckg ); - aRate = pckg(); - return KErrNone; - } - else - { - aRate = 0; - return KErrNotFound; - } - } - -TInt CClientProgDLSource::FileName(TPtr& aFileName) - { - TInt status(KErrNone); - aFileName.Set(iFileName->Des()); - return status; - } - - -TInt CClientProgDLSource::CancelDownload() - { - TInt status(KErrNone); - status = iDownloadGateway->DeleteDownload(iDownloadId); - return status; - } - -TInt CClientProgDLSource::ResumeDownload() - { - TInt status(KErrNone); - if(isDownloadPaused) - { - iDownloadGateway->ResumeDownload(iDownloadId); - } - return status; - } - -void CClientProgDLSource::ServerSourceCreated( MCustomCommand& aCustomCommand, - TMMFMessageDestination& aSourceHandle ) - { - iServerSourceExists = ETrue; - iCustomCommand = &aCustomCommand; - iSourceHandle = aSourceHandle; - - if(!isDownloadComplete) - { - TRAPD(err1,iMonitor = CTransferRateMonitor::NewL(*this, KTranferRateMonitorFrequency, KFileSizeChangeDelta)); - if(!err1) - { - iMonitor->Start(); - } - - // Send data to server source - TPckgBuf pckg(iSourceSize); - iCustomCommand->CustomCommandSync( iSourceHandle, ESetActualSize, pckg, KNullDesC8 ); - - iStateEvent->SetActive(); - iStatePckg() = iSourceState; - iCustomCommand->CustomCommandAsync( - iSourceHandle, - (TInt)EGetSourceState, - iStatePckg, - KNullDesC8, - iStatePckg, - iStateEvent->iStatus); - - } - else - { - iCustomCommand->CustomCommandSync( iSourceHandle, ESetDownloadState, KNullDesC8, KNullDesC8 ); - } - } - -void CClientProgDLSource::ServerSourceDeleted() - { -#ifdef _DEBUG - RDebug::Print(_L("CClientProgDLSource::ServerSourceDeleted()")); -#endif - iServerSourceExists = EFalse; - iCustomCommand = NULL; - - if(iMonitor) - { - iMonitor->Stop(); - } - } - -TBool CClientProgDLSource::IsEncrypted() - { - return EFalse; - } - -TUid CClientProgDLSource::GetSourceUid() - { - return KMmfProgDLSource; - } - -TInt CClientProgDLSource::GetHeaderData(TPtr& /*aPtr*/) - { - return KErrNotSupported; - } - -void CClientProgDLSource::MoveFileComplete(TInt aError) - { - if(iServerSourceExists) - { - TPtr des = iFileName->Des(); - if(aError == KErrNone) - { - des.Copy(iDestFileName); - } - else - { - iDownloadGateway->GetLocalFileName(iDownloadId,des); - } - TPckgBuf pckg(iDestFileName); - iCustomCommand->CustomCommandSync( iSourceHandle, ESetUpdateFileName, pckg, KNullDesC8 ); - } - - CErrorCode* event1 = new CErrorCode( aError ); - iEventNotifier->Event(this,MSourceControlObserver::KFileMoveCompleteEvent,event1); - } - -void CClientProgDLSource::Event(TDownloadStatus aStatus) - { -#ifdef _DEBUG - RDebug::Print(_L("CClientProgDLSource::Event DownloadStatus[%d]"),aStatus); -#endif - - switch(aStatus) - { - case ECompleted: - { - if(iMonitor) - { - iMonitor->Stop(); - } - TUint size(0); - GetCurrentFileSize(size); - TInt value = size; - TPckgBuf pckg(value); - if(iServerSourceExists) - { - if (iSourceState != CMultimediaDataSource::ESTOPPED) - { - iCustomCommand->CustomCommandSync( iSourceHandle, ESetDownloadSize, pckg, KNullDesC8 ); - } - iCustomCommand->CustomCommandSync( iSourceHandle, ESetDownloadState, KNullDesC8, KNullDesC8 ); - } - isDownloadComplete = ETrue; - break; - } - case EStarted: - { - isDownloadPaused = EFalse; - break; - } - case EPaused: - { - isDownloadPaused = ETrue; - break; - } - case EDeleted: - { - if(iMonitor) - { - iMonitor->Stop(); - } - break; - } - - case EUnknown: - break; - - } - //Send only Known Events - if(aStatus != EUnknown) - { - CErrorCode* event1 = new CErrorCode( KErrNone ); - iEventNotifier->Event(this,MSourceControlObserver::KDownloadStatusChangedEvent,event1); - } - } - -TInt CClientProgDLSource::GetCurrentSize( TUint& aCurrentSize ) - { - //RDebug::Print(_L("CClientProgDLSource::GetCurrentSize")); - TUint value(0); - GetExpectedFileSize(value); - - GetCurrentFileSize(aCurrentSize); - - if(aCurrentSize - iCurrentBytes > ((KNofityAfterPercentage/100) * value)) //Currently checking for 5% - { - iCurrentBytes = aCurrentSize; - CErrorCode* event1 = new CErrorCode( KErrNone ); - iEventNotifier->Event(this,MSourceControlObserver::KPercentageDownloadedChangedEvent,event1); - } - - iCurrentSize = aCurrentSize; - - if ( iServerSourceExists && iSourceState != CMultimediaDataSource::ESTOPPED) - { - // Send data to server source - - TPckgBuf pckg(iCurrentSize); - iCustomCommand->CustomCommandSync( iSourceHandle, ESetDownloadSize, pckg, KNullDesC8 ); - - } -#ifdef _DEBUG - RDebug::Print(_L("CClientProgDLSource::GetCurrentSize:[%d]"), aCurrentSize); -#endif - - return KErrNone; - } - -void CClientProgDLSource::TransferRateChanged() - { -#ifdef _DEBUG - RDebug::Print(_L("CClientProgDLSource::TransferRateChanged:[%d]"), iMonitor->TransferRate()); -#endif - if ( iServerSourceExists && !isDownloadComplete && iSourceState != CMultimediaDataSource::ESTOPPED) - { - // Send data to server source - - TPckgBuf pckg1(iMonitor->TransferRate()); - iCustomCommand->CustomCommandSync( iSourceHandle, EDownloadRate, pckg1, KNullDesC8 ); - - } - } - -void CClientProgDLSource::SourceStateChanged() - { -#ifdef _DEBUG - RDebug::Print(_L("CClientProgDLSource::SourceStateChanged() :PrevState[%d] NewState[%d]"), iSourceState,iStatePckg()); -#endif - iSourceState = iStatePckg(); - - if(iSourceState == CMultimediaDataSource::ESTOPPED || iSourceState == CMultimediaDataSource::ECLOSED) - { - //iDownloadGateway->SetProgressiveMode(iDownloadId,EFalse); - iProgressiveMode = EFalse; - } - else if(!iProgressiveMode && !isDownloadComplete) - { - iDownloadGateway->SetProgressiveMode(iDownloadId,ETrue); - TPtr ptrFileName = iFileName->Des(); - iDownloadGateway->SetLocalFileName( iDownloadId, ptrFileName ); - iProgressiveMode = ETrue; - } - - - if(iStateEvent->Error() != KErrDied && iServerSourceExists) - { - iStateEvent->SetActive(); - iCustomCommand->CustomCommandAsync( - iSourceHandle, - (TInt)EGetSourceState, - iStatePckg, - KNullDesC8, - iStatePckg, - iStateEvent->iStatus); - } - } -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/ClientProgDLSource.h --- a/mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/ClientProgDLSource.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,383 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Definition of the ClientProgDLSource class. -* -*/ - - -#ifndef C_CCLIENTAUDIOPROGDLSOURCE_H -#define C_CCLIENTAUDIOPROGDLSOURCE_H - -#include -#include -#include -#include -#include - -#include "SourceBase.h" -#include "TransferRateMonitor.h" -#include "ProgDLSourceCustomCommands.h" -#include "EventAO.h" -#include "DownloadGateway.h" - - -class MCustomCommand; - -namespace multimedia - { - - class CEventNotifier; - - class MTransferRateMonitor; - - /** - * Implements the ClientSide Source for the ProgDL Source. - * Provides functionality to the Clients to query attributes - * from the ServerSide source - * @lib EnhancedMediaClient.lib - * @since S60 v3.2 - */ - class CClientProgDLSource : public CSourceBase, - public MProgDLSource, - public MDownloadGatewayObserver, - public MTransferRateObserver, - public MSourceStateObserver - { - public: - /** - * Function to Create the Object. - */ - CClientProgDLSource(); - /** - * Destructor. - */ - ~CClientProgDLSource(); - /** - * Post Contructor. This is to Support the new type of Construction - * of the Object. Notice there is no Two phased Constructor in this class - */ - TInt PostConstructor(); - - /** - * Associates the DownloadGateway with the Progressive Download Source. - * This Gateway class sends all the Browser Events to the Source. - */ - TInt SetDownloadGateway(CDownloadGateway* aDownloadGateway); - - // From MControl begins - /** - * From MControl. - * Adds the Observer to this Object - * @since S60 v3.2 - * @param aObserver Client which set the Observer. - */ - TInt AddObserver( MControlObserver& aObserver ); - /** - * From MControl. - * Removes the Observer to this Object - * @since S60 v3.2 - * @param aObserver Client which set the Observer. - */ - TInt RemoveObserver( MControlObserver& aObserver ); - /** - * From MControl. - * Returns the Type of this Object. - * request and that it is now outstanding - * @since S60 v3.2 - */ - TUid Type(); - /** - * From MControl. - * Returns the Control Type of this Object. - * - * @since S60 v3.2 - */ - TControlType ControlType(); - // From MControl ends - - // From MSourceControl begins - /** - * From MSourceControl. - * Returns the Size in Bytes of the Source. - * Since this is ProgDL Source, the size represents - * the file size which will be passed by the Client - * to the Source - * @since S60 v3.2 - * @param aSize Size returned by the Source. - */ - TInt GetSize( TUint& aSize ); - /** - * From MSourceControl. - * Returns the Mime Type of the Data for which - * the Source is initialized. - * @since S60 v3.2 - * @param aMimeType MimeType returned by the Source. - */ - TInt GetMimeType( TDes8& aMimeType ); - /** - * From MSourceControl. - * Closes the Source. - * - * @since S60 v3.2 - */ - TInt Close(); - // From MSourceControl ends - - // From MProgDLSource begins - /** - * From MProgDLSource. - * Opens the Source with the FileName and TransactionID - * Here it connects to the Browser and attaches to the - * download corresponding to the TransactionID - * - * @since S60 v3.2 - * @param aFileName FileName to be Opened by the Source - * @param aDLTxId TransactionID to connect to the Browser - */ - TInt Open( const TDesC& aFileName,TInt32 aDLTxId ); - /** - * From MProgDLSource. - * Moves the Finished Download to the new Location. This is done - * by calling the browser which is invoked through the Gateway. - * - * @since S60 v3.2 - * @param aFileName FileName to be Opened by the Source - */ - TInt MoveFile(const TDesC& aDestFileName ); - /** - * From MProgDLSource. - * Cancels the Ongoing Download - * - * @since S60 v3.2 - */ - TInt CancelDownload(); - /** - * From MProgDLSource. - * Resumes the Paused download - * - * @since S60 v3.2 - */ - TInt ResumeDownload(); - /** - * From MProgDLSource. - * Gets the Current FileSize from the Browser which is getting - * Downloaded - * - * @since S60 v3.2 - * @param aSize Size of the File already downloaded - */ - TInt GetCurrentFileSize( TUint& aSize ); - /** - * From MProgDLSource. - * Gets the Expected FileSize from the Browser which is getting - * Downloaded - * - * @since S60 v3.2 - * @param aSize Final Size of the File - */ - TInt GetExpectedFileSize( TUint& aSize ); - /** - * From MProgDLSource. - * Return the Current Download Status of the Download - * - * @since S60 v3.2 - */ - TDownloadStatus GetDownloadStatus(); - /** - * From MProgDLSource. - * Queries if the Download is Complete from the Gateway - * - * @since S60 v3.2 - * @param aBool Download Complete Status - */ - TInt IsDownloadComplete(TBool& aBool); - /** - * From MProgDLSource. - * Gets the Percentage of the File already Downloaded - * - * @since S60 v3.2 - * @param aPercent Percentage of the File downloaded - */ - TInt GetPercentageDownloaded(TUint& aPercent); - /** - * From MProgDLSource. - * Gets the Percentage of the File Buffered before Playback starts. - * This query is to the ServerSide Source which is in Buffering State - * - * @since S60 v3.2 - * @param aPercent Percentage of Data Buffered before Playback starts. - */ - TInt GetPercentageBuffered(TUint& aPercent); - /** - * From MProgDLSource. - * This is the DownloadRate that tells you how fast data is downloaded - * by the Download Manager - * - * @since S60 v3.2 - * @param aRate Rate at which Data is Downloaded. - */ - TInt GetDownloadingRate(TUint& aRate); - /** - * From MProgDLSource. - * Returns the BitRate of the Data played from the Source - * - * @since S60 v3.2 - * @param aRate BitRate of the Data Played from the Source - */ - TInt GetBitRate(TUint& aRate); - /** - * From MProgDLSource. - * Returns the FileName associated with the Download. - * This value is set by the Client when it calls Open(). - * - * @since S60 v3.2 - * @param aFileName FileName to be Opened by the Source - */ - TInt FileName(TPtr& aFileName); - // From MProgDLSource ends - - // From MDownloadGatewayObserver - /** - * From MDownloadGatewayObserver. - * The Gateway Observer sends event which it receives from the - * Download Manager. - * - * @since S60 v3.2 - * @param aStatus Current Download Status - */ - void Event(TDownloadStatus aStatus); - /** - * From MDownloadGatewayObserver. - * Notifies the Client that the Move of the File Complete - * with an ErrorCode returned. - * - * @since S60 v3.2 - * @param aError Move Complete with this ErrorCode. - */ - void MoveFileComplete(TInt aError); - // MDownloadGatewayObserver Ends - - - // From CSourceBase begins - /** - * From CSourceBase. - * Callback from the StreamControl when the Source is Created - * - * @since S60 v3.2 - * @param aCustomCommand Custom Command handle to send message to the Source - * @param aSourceHandle Handle Identifying the Source - */ - void ServerSourceCreated( MCustomCommand& aCustomCommand, - TMMFMessageDestination& aSourceHandle ); - /** - * From CSourceBase. - * Callback from the StreamControl when the ServerSource is Deleted - * - * @since S60 v3.2 - */ - void ServerSourceDeleted(); - /** - * From CSourceBase. - * Returns the Content Protection information to the Stream Control - * Currently returns KErrNotSupported - * @since S60 v3.2 - */ - TBool IsEncrypted(); - /** - * From CSourceBase. - * Returns the SourceUID - * - * @since S60 v3.2 - */ - TUid GetSourceUid(); - /** - * From CSourceBase. - * Returns the Header Data passed when the Client calls Open - * Currently return KErrNotSupported - * @since S60 v3.2 - */ - TInt GetHeaderData(TPtr& aPtr); - // From CSourceBase ends - - //MTransferRateObserver begins - /** - * From MTransferRateObserver. - * Callback from the TransferRate Monitor that the Rate Changed - * @since S60 v3.2 - */ - void TransferRateChanged(); - /** - * From MTransferRateObserver - * Method from the Transfer Rate Monitor to query CurrentFile Size. - * @since S60 v3.2 - * @param aCurrentSize Current File Size returned to the Caller - */ - TInt GetCurrentSize( TUint& aCurrentSize ); - // MTransferRateObserver ends - - // MSourceStateObserver begins - /** - * From MSourceStateObserver. - * Callback from the Active Object that the Source State changed. - * @since S60 v3.2 - */ - void SourceStateChanged(); - // MSourceStateObserver ends - - private: - // Variable to determine if the ServerSource exists - TBool iServerSourceExists; - - // FileSize from the Client - TUint iSourceSize; - // Current Size from the Browser - TInt iCurrentSize; - // Destination File Name - TFileName iDestFileName; - - // Handle to send messages to the Server Side Source - MCustomCommand* iCustomCommand; - // Handle Identifying the Server Side Source - TMMFMessageDestination iSourceHandle; - - // Current State of the Source - TPckgBuf iStatePckg; - // Observer monitoring the State change event - CEventAO* iStateEvent; - // Current State of the Source - CMultimediaDataSource::TState iSourceState; - // Event Notifier to notify Clients - CEventNotifier* iEventNotifier; - // Storing the Download Complete Status - TBool isDownloadComplete; - // Storing the Download Paused status - TBool isDownloadPaused; - // Storing the DownloadID/Transaction ID - TInt32 iDownloadId; - // FileName passed to Open the Source - HBufC* iFileName; - // Gateway Attached to this Source to talk to Browser - CDownloadGateway* iDownloadGateway; - // Transfer Rate monitor - CTransferRateMonitor* iMonitor; - // Current Size of the File in Bytes. - TUint iCurrentBytes; - // Is the Playback in Progressive Mode - TBool iProgressiveMode; - }; - } // namespace multimedia - -#endif // CLIENTAUDIOPROGDLSOURCE_H - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/DownloadGateway.cpp --- a/mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/DownloadGateway.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,273 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of DownloadGateway class. -* -*/ - - -#include "DownloadGateway.h" -#include - -#define RETURN_IF_ERROR(x) if(x != KErrNone) return x - -using namespace multimedia; - -// CONSTANTS -CDownloadGateway::CDownloadGateway() - { - iDMgrConnected = EFalse; - iDownload = NULL; - iDownloadId = 0; - } - -CDownloadGateway::~CDownloadGateway() - { - if ( iDMgrConnected ) - { - iDownloadMgr.Close(); - } - } - -TInt CDownloadGateway::Initialize(TUid aClientUid) - { - TInt status(KErrNone); - if ( !iDMgrConnected ) - { - TRAP(status,iDownloadMgr.ConnectL( aClientUid, *this, EFalse )); - if(!status) - { - iDMgrConnected = ETrue; - } - } - return status; - } - -TInt CDownloadGateway::MoveFile( TInt aId, const TDesC& aDestFileName ) - { - TInt status(KErrNotFound); - // Check here if the download is complete and the Source is in Stopped State - if(iDownloadId == aId && iDownload) - { - status = iDownload->SetStringAttribute( EDlAttrDestFilename, aDestFileName ); - if(!status) - { - iDownload->Move(); - } - } - return status; - } - -TInt CDownloadGateway::ConnectToDownload(TInt aId, MDownloadGatewayObserver& aObserver, TUid /*aAppUid*/) - { - TInt status(KErrNotFound); - TRAP(status, iDownload = &(iDownloadMgr.AttachToDownloadL( aId ))); - if(status == KErrNone) - { - iObserver = &aObserver; - iDownloadId = aId; - } - else - { - iDownload = NULL; - } - return status; - } - -TInt CDownloadGateway::DisconnectFromDownload(TInt aId) - { - TInt status(KErrNotFound); - if(iDownloadId == aId && iDownload) - { - iDownload = NULL; - iDownloadId = 0; - status = KErrNone; - } - return status; - } - -TInt CDownloadGateway::GetMimeType(TInt aId, TDes8& aMimeType) - { - TInt status(KErrNotFound); - if(iDownloadId == aId && iDownload) - { - status = iDownload->GetStringAttribute( EDlAttrContentType, aMimeType ); - } - return status; - } - -TInt CDownloadGateway::GetCurrentSize( TInt aId, TUint& aSize ) - { - TInt status(KErrNotFound); - TInt32 value(0); - if(iDownloadId == aId && iDownload) - { - status = iDownload->GetIntAttribute( EDlAttrDownloadedSize, value ); - if(!status) - { - aSize = value; - } - } - return status; - } - -TInt CDownloadGateway::GetDownloadSize( TInt aId, TUint& aSize ) - { - TInt status(KErrNotFound); - TInt32 value(0); - if(iDownloadId == aId && iDownload) - { - status = iDownload->GetIntAttribute( EDlAttrLength, value ); - if(status == KErrNone) - { - aSize = value; - } - } - return status; - } - -TInt CDownloadGateway::GetDownloadStatus(TInt aId, MProgDLSource::TDownloadStatus& aStatus) - { - TInt status(KErrNotFound); - if(iDownloadId == aId && iDownload) - { - aStatus = iDownloadStatus; - } - return status; - } - -TInt CDownloadGateway::DeleteDownload(TInt aId) - { - TInt status(KErrNotFound); - if(iDownloadId == aId && iDownload) - { - status = iDownload->Delete(); - } - return status; - } - -TInt CDownloadGateway::ResumeDownload(TInt aId) - { - TInt status(KErrNotFound); - if(iDownloadId == aId && iDownload) - { - status = iDownload->Start(); - } - return status; - } - -TInt CDownloadGateway::SetProgressiveMode(TInt aId, TBool aMode) - { - TInt status(KErrNotFound); - if(iDownloadId == aId && iDownloadStatus != MProgDLSource::EDeleted && iDownload) - { - status = iDownload->SetBoolAttribute( EDlAttrProgressive, aMode ); - } - return status; - } - -TInt CDownloadGateway::SetLocalFileName( TInt aId, TDesC& aFilName ) - { - TInt status(KErrNotFound); - if( iDownloadId == aId && iDownload) - { - status = iDownload->SetStringAttribute( EDlAttrLocalFileName, aFilName ); - } - return status; - } - -TInt CDownloadGateway::GetLocalFileName( TInt aId, TDes& aFileName ) - { - TInt status(KErrNotFound); - if( iDownloadId == aId && iDownload) - { - status = iDownload->GetStringAttribute( EDlAttrDestFilename, aFileName ); - } - return status; - } - -void CDownloadGateway::HandleDMgrEventL( RHttpDownload& /*aDownload*/, THttpDownloadEvent aEvent ) - { -#ifdef _DEBUG - RDebug::Print(_L("CDownloadGateway::HandleDMgrEventL DownloadState[%d] ProgressState[%d]"),aEvent.iDownloadState,aEvent.iProgressState); -#endif - MProgDLSource::TDownloadStatus status; - - // When the new evnet is different in one of the states - // then the current event - if(iPrevEvent.iDownloadState != aEvent.iDownloadState) - { - switch(aEvent.iDownloadState) - { - case EHttpDlCreated: - status = MProgDLSource::EConnecting; - break; - case EHttpDlInprogress: - status = MProgDLSource::EStarted; - break; - case EHttpDlPaused: - status = MProgDLSource::EPaused; - break; - case EHttpDlCompleted: - status = MProgDLSource::ECompleted; - break; - case EHttpDlFailed: - status = MProgDLSource::EFailed; - break; - case EHttpDlDeleting: - status = MProgDLSource::EDeleted; - break; - default: - status = MProgDLSource::EUnknown; - break; - }; - - iDownloadStatus = status; - iObserver->Event(status); - } - - if(iPrevEvent.iProgressState != aEvent.iProgressState) - { - switch(aEvent.iProgressState) - { - - case EHttpProgContentFileMoved: - { - TInt32 value(0); - TInt err = iDownload->GetIntAttribute( EDlAttrErrorId, value ); -#ifdef _DEBUG - RDebug::Print(_L("Delete File Code 2[%d][%d]"),err,value); -#endif - if(!err) - { - iObserver->MoveFileComplete(value); - } - } - break; - case EHttpProgCodLoadEnd: - // Case for COD download complete - iDownloadStatus = MProgDLSource::ECompleted; - iObserver->Event(MProgDLSource::ECompleted); - break; - case EHttpProgContentFileMovedAndDestFNChanged: - { - iObserver->MoveFileComplete(KErrAlreadyExists); - break; - } - }; - } - - iPrevEvent = aEvent; - } - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/DownloadGateway.h --- a/mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/DownloadGateway.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of DownloadGateway class. -* -*/ - - -#ifndef DOWNLOADGATEWAY_H -#define DOWNLOADGATEWAY_H - -#include -#include -#include - -namespace multimedia - { - - /** - * Observer that sends browser events to the Client - * @lib EnhancedMediaClient.lib - * @since S60 v3.2 - */ - class MDownloadGatewayObserver - { - public: - virtual void Event(MProgDLSource::TDownloadStatus aStatus) = 0; - virtual void MoveFileComplete(TInt aError) = 0; - }; - - /** - * Implements the Gateway from which the Clients talk to the DownloadMgr. - * Provides functionality to the Clients to query attributes - * from the Browser - * @lib EnhancedMediaClient.lib - * @since S60 v3.2 - */ - class CDownloadGateway : public MHttpDownloadMgrObserver - { - public: - /** - * Function to Create the Object. - */ - CDownloadGateway(); - /** - * Destructor. - */ - ~CDownloadGateway(); - - /** - * Initialize the Gateway with the Client UID. - * Here it connect to the DownloadMgr Server. - * @since S60 v3.2 - * @param aClientUid Client which wants to connect. - */ - TInt Initialize(TUid aClientUid); - /** - * Calls Move on the DownloadMgr for the TransactionID - * @since S60 v3.2 - * @param aId TransactionID for which the File has to be moved. - * @param aDestFileName Full Pathname where the file needs to be moved. - */ - TInt MoveFile( TInt aId, const TDesC& aDestFileName ); - /** - * Called by the Client which wants to Connect to the Download - * @since S60 v3.2 - * @param aId TransactionID for which the File has to be moved. - * @param aObserver Observer where the Client wants the Callbacks - * @param aAppUid UID for the App which Connects. - */ - TInt ConnectToDownload(TInt aId, MDownloadGatewayObserver& aObserver, TUid aAppUid); - /** - * Disconnect from the Download - * Here it connect to the DownloadMgr Server. - * @since S60 v3.2 - * @param aId DownloadID from which the Client wants to Disconnect. - */ - TInt DisconnectFromDownload(TInt aId); - /** - * Gets the Current Downloaded Size of the Download - * @since S60 v3.2 - * @param aId TransactionID of the Download which the FileSize is queried. - * @param aSize Size of the Download returned - */ - TInt GetCurrentSize( TInt aId, TUint& aSize ); - /** - * Total Size of the File which is being downloaded - * Here it connect to the DownloadMgr Server. - * @since S60 v3.2 - * @param aId TransactionID of the Download which the FileSize is queried. - * @param aSize Total Size of the File being Downloaded returned - */ - TInt GetDownloadSize( TInt aId, TUint& aSize ); - /** - * Gets the Download Status for a particular Download - * @since S60 v3.2 - * @param aId TransactionID of the Download which the FileSize is queried. - * @param aStatus Download Status for the Download - */ - TInt GetDownloadStatus(TInt aTxId, MProgDLSource::TDownloadStatus& aStatus); - /** - * Cancelling a Particular Download - * @since S60 v3.2 - * @param aId TransactionID of the Download to be deleted - */ - TInt DeleteDownload(TInt aId); - /** - * Resuming a Paused Download - * @since S60 v3.2 - * @param aId TransactionID of the Download to be Resumed - */ - TInt ResumeDownload(TInt aId); - /** - * Queries the MimeType of the File from the DownloadMgr - * @since S60 v3.2 - * @param aId TransactionID of the Download to be queried - * @param aMimeType MimeType returned from the Browser. - */ - TInt GetMimeType(TInt aId, TDes8& aMimeType); - /** - * Tells the Browser if the Download is being Progressively Played - * @since S60 v3.2 - * @param aId TransactionID of the Dowload to be Resumed - * @param aMode Whether the Mode is True or False. - */ - TInt SetProgressiveMode(TInt aId, TBool aMode); - /** - * Before Calling Move we need to Call this to set the Local FileName - * @since S60 v3.2 - * @param aId TransactionID of the Dowload for setting the FileName - * @param aFileName Name to be Set - */ - TInt SetLocalFileName( TInt aId, TDesC& aFileName ); - /** - * Gets the Local FileName from the DownloadMgr - * @since S60 v3.2 - * @param aId TransactionID of the Dowload to be Resumed - * @param aFileName Gets the FileName from the DownloadMgr - */ - TInt GetLocalFileName(TInt aId, TDes& aFileName ); - // From MhttpDownloadMgrObserver - /** - * From MhttpDownloadMgrObserver. - * Callback from the DownloadManager notifying Client Events. - * @since S60 v3.2 - * @param aDownload Download for which the Event is meant - * @param aEvent Actual Event - */ - void HandleDMgrEventL( RHttpDownload& aDownload, THttpDownloadEvent aEvent ); - // MhttpDownloadMgrObserver Ends - - private: - // The Observer where we need to forward the Browser events - MDownloadGatewayObserver* iObserver; - // Download Manager instance to which we connect - RHttpDownloadMgrApiExt iDownloadMgr; - // Download for which we connect - RHttpDownload* iDownload; - // Status if we are connected - TBool iDMgrConnected; - // Previous DLMgr Event - THttpDownloadEvent iPrevEvent; - // Current Download ID - TInt iDownloadId; - // Current Download Status - MProgDLSource::TDownloadStatus iDownloadStatus; - }; - } // namespace multimedia - -#endif // DOWNLOADGATEWAY_H - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/EventAO.cpp --- a/mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/EventAO.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,85 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of EventAO class. -* -*/ - - -#include "EventAO.h" - -using namespace multimedia; - -CEventAO::CEventAO(MSourceStateObserver& aObserver ) -: CActive(CActive::EPriorityStandard), -iObserver(aObserver), -iError(KErrNone) - { - CActiveScheduler::Add(this); - } - -CEventAO::~CEventAO() - { - Cancel(); - } - -CEventAO* CEventAO::NewL( MSourceStateObserver& aObserver ) - { - CEventAO* self = new (ELeave)CEventAO( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -void CEventAO::ConstructL() - { - } - -void CEventAO::SetActive() - { - if (!IsActive()) - { - CActive::SetActive(); - } - } - -TInt CEventAO::Error() - { - return iError; - } - -// From CActive -void CEventAO::RunL() - { - // Save the error code - iError = iStatus.Int(); - // Signal the observer that this request is serviced - iObserver.SourceStateChanged(); - } - -void CEventAO::DoCancel() - { - if(iStatus.Int() != 0) - { - TRequestStatus* status = &iStatus; - User::RequestComplete(status,KErrCancel); - } - } - -TInt CEventAO::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/EventAO.h --- a/mmfenh/enhancedmediaclient/Client/src/Components/ClientProgDLSource/EventAO.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,101 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: header of EventAO class. -* -*/ - - -#ifndef C_CEVENTAO_H -#define C_CEVENTAO_H - -// INCLUDES -#include - -namespace multimedia - { - - // Observer - /** - * Observer that monitors the Source State changes - * @lib EnhancedMediaClient.lib - * @since S60 v3.2 - */ - class MSourceStateObserver - { - public: - virtual void SourceStateChanged() = 0; - }; - - /** - * Active Object that monitors the Source State Change - * Event from the Source Side - * @lib EnhancedMediaClient.lib - * @since S60 v3.2 - */ - class CEventAO : public CActive - { - public: // Constructors and destructor - /** - * Function to Create the Object. - * @param aObserver Observer to callback the Event. - */ - static CEventAO* NewL(MSourceStateObserver& aObserver); - /** - * Destructor. - */ - virtual ~CEventAO(); - - /** - * From CActive. - * Indicates that this active object has issued a - * request and that it is now outstanding - * - * @since S60 v3.2 - */ - void SetActive(); - - /** - * From CEventAO. - * Returns the Error Stoted on Completion of the Request - * - * @since S60 v3.2 - */ - TInt Error(); - - protected: - // From CActive - void RunL(); - void DoCancel(); - TInt RunError( TInt aError ); - - private: - CEventAO( MSourceStateObserver& aObserver ); - void ConstructL(); - - private: - /** - * Observer stored to Callback - */ - MSourceStateObserver& iObserver; - /** - * Error Stored upon Request Completion - */ - TInt iError; - }; - - } // namespace multimedia - -#endif // C_CEVENTAO_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/bwins/ProgDLSource.def --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/bwins/ProgDLSource.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &) - ?NewL@CProgDLMultimediaSource@@SAPAV1@AAVMDataSource@@@Z @ 2 NONAME ; class CProgDLMultimediaSource * CProgDLMultimediaSource::NewL(class MDataSource &) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/data/10207B45.rss --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/data/10207B45.rss Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file of ProgDLSource. -* -*/ - - -#include "ProgDLSourceUid.hrh" -#include -#include - - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x10207B45; //The DLL's 3rd UID. - interfaces = - { - INTERFACE_INFO - { - interface_uid = KMmfUidPluginInterfaceDataSource; //ECOM UID for a Transport Adapter plug-in - implementations = - { - // This DLL contains only a single adapter implementation. - IMPLEMENTATION_INFO - { - implementation_uid = KMmfProgDLSourceUid; //UID for this Adapter - version_no = 1; - display_name = "Progressive Download Source"; //Human readable string for UI purposes. - default_data = ""; //Not used. - opaque_data = ""; //Not used. - } - }; - } - }; - } - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/eabi/ProgDLSource.def --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/eabi/ProgDLSource.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -EXPORTS - _Z24ImplementationGroupProxyRi @ 1 NONAME - _ZN23CProgDLMultimediaSource4NewLER11MDataSource @ 2 NONAME - _ZTI12CContentFile @ 3 NONAME ; ## - _ZTI12CReadRequest @ 4 NONAME ; ## - _ZTI13CProgDLSource @ 5 NONAME ; ## - _ZTI14CSinkQueueItem @ 6 NONAME ; ## - _ZTI17CReadWriteRequest @ 7 NONAME ; ## - _ZTI23CProgDLMultimediaSource @ 8 NONAME ; ## - _ZTI8CF32File @ 9 NONAME ; ## - _ZTV12CContentFile @ 10 NONAME ; ## - _ZTV12CReadRequest @ 11 NONAME ; ## - _ZTV13CProgDLSource @ 12 NONAME ; ## - _ZTV14CSinkQueueItem @ 13 NONAME ; ## - _ZTV17CReadWriteRequest @ 14 NONAME ; ## - _ZTV23CProgDLMultimediaSource @ 15 NONAME ; ## - _ZTV8CF32File @ 16 NONAME ; ## - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/group/ProgDLSource.mmp --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/group/ProgDLSource.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,65 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for EnhancedMediaClient Utility -* -*/ - - -#include -#include - -TARGET ProgDLSource.dll -TARGETTYPE PLUGIN -UID 0x10009D8D 0x10207B45 - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - -TARGETPATH /System/Libs/Plugins - -USERINCLUDE ../inc -USERINCLUDE ../src -USERINCLUDE ../../../../../inc - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/mmf/common -SYSTEMINCLUDE /epoc32/include/mmf/server - -SOURCEPATH ../src - -SOURCE Main.cpp -SOURCE fileaccess.cpp -SOURCE ProgDLSource.cpp -SOURCE SinkQueueItem.cpp - -SOURCEPATH ../data - -START RESOURCE 10207B45.rss -TARGET ProgDLSource.rsc -END - -LIBRARY euser.lib -LIBRARY ecom.lib -LIBRARY efsrv.lib -LIBRARY mmfcontrollerframework.lib -LIBRARY estor.lib -LIBRARY mmfserverbaseclasses.lib -LIBRARY caf.lib -LIBRARY cafutils.lib -LIBRARY TransferRateMonitor.lib -LIBRARY centralrepository.lib - -DEFFILE ProgDLSource.def -NOSTRICTDEF diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/group/bld.inf --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Blf.inf file for the ProgDLSource Project -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES -ProgDLSource.mmp diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/MmfFile.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/MmfFile.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,275 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of ProgDLSource. -* -*/ - -#ifndef __MMFFILE_H_ -#define __MMFFILE_H_ - -#include - -#include -#include -#include - -class CReadWriteRequest; -class CTransferBufferCopy; -class MGenericFile; - -/** -@publishedAll -@released - - Provides the filename and path of file. - - Used by CMMFFile::ConstructL(). -*/ -class TMMFFileParams - { - public: - /** - Filename and path of file. - */ - TFileName iPath ; // Filename and path of file. - private: - /** - This member is internal and not intended for use. - */ - TInt iReserved1; - }; - - /** - @internalTechnology -*/ -const TUid KFileHandleUid = {0x101FFA19}; -const TUid KMMFileSourceUid = {0x101F7DA9}; -const TUid KMMFileHandleSourceUid = {0x101F7DAA}; - -/** -@publishedAll -@released - - Provides a pointer to the file handle - - Used by CMMFFile::ConstructL(). -*/ -class TMMFFileHandleParams - { - public: - TMMFFileHandleParams(RFile* aFile) : iUid(KFileHandleUid), iFile(aFile) {} - TMMFFileHandleParams() : iUid(KFileHandleUid) {} - - TUid iUid; - /** - Handle of file - */ - RFile* iFile; - private: - /** - This member is internal and not intended for use. - */ - TInt iReserved1; - }; - - - - - /** - @publishedAll - @released -*/ -typedef TPckgBuf TMMFFileConfig ; - -/** -@publishedAll -@released -*/ -typedef TPckgBuf TMMFFileHandleConfig ; - - -/** -@publishedAll -@released - - This details how big the iTransferBufferCopies array of CMMFFile may - become before we start looking to free entries. -*/ -const TInt KAcceptableTransferBufferCopiesSize = 5; - -/** -@publishedAll -@released - - This details how big the iTransferBufferCopies array of CMMFFile may - become before we start looking to free entries. -*/ -const TInt KMaximumTransferBufferCopiesSize = 100; - - -/** -@publishedAll -@released - - MultiMedia framework class. Represents a physical file. - - This may be source file from which data is read or destination to which data is written. - - Intended to be used by controller plugin developers for source and sink plugins. -*/ -class CMMFFile : public CMMFClip - { - public: - // From MDataSource - virtual TFourCC SourceDataTypeCode(TMediaId aMediaId) ; - virtual void FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId ) ; - virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) ; - virtual TBool CanCreateSourceBuffer() ; - virtual CMMFBuffer* CreateSourceBufferL( TMediaId aMediaId, TBool &aReference ) ; - virtual TInt SourceThreadLogon(MAsyncEventHandler& aEventHandler) ; - virtual void SourceThreadLogoff(); - virtual void SourcePrimeL(); - virtual void SourceStopL(); - - // From MDataSink - virtual TFourCC SinkDataTypeCode(TMediaId aMediaId) ; //used by data path MDataSource/Sink for codec matching - virtual void EmptyBufferL( CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId ) ; - virtual void BufferFilledL( CMMFBuffer* aBuffer ) ; - virtual TBool CanCreateSinkBuffer() ; - virtual CMMFBuffer* CreateSinkBufferL( TMediaId aMediaId , TBool &aReference) ; - virtual TInt SinkThreadLogon(MAsyncEventHandler& aEventHandler) ; - virtual void SinkThreadLogoff(); - virtual void SinkPrimeL(); - virtual void SinkStopL(); - - // From CMMFClip - virtual void ReadBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer); - virtual void WriteBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier); - virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) ; - virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) ; - virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition ) ; - virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition ) ; - virtual TInt64 BytesFree() ; // amount of space available for the clip - virtual TInt Size() ; - virtual TInt Delete(); - virtual TInt SetSize(TInt aSize); - - // New Functions - virtual const TDesC& FileName() const ; - virtual const TDesC& Extension() const ; - virtual const TDesC& FilePath() const ; - virtual const TDesC& FileDrive() const ; - virtual const TFileName FullName() const; - virtual RFile& FileL() ; - - public : - virtual ~CMMFFile() ; - static MDataSource* NewSourceL() ; - static MDataSink* NewSinkL() ; - - void SetTransferBuffer (TBool aTBuffer) ; - TBool CanUseTransferBuffer () ; - virtual TBool SinkStopped(); - - protected: - /** - Indicates for which purpose the object instance is being created - */ - enum TMMFileMode - { - /** The object is created for being a source */ - ESourceMode, - /** The object is created for being a sink */ - ESinkMode - }; - virtual void ConstructSourceL( const TDesC8& aInitData ) ; - virtual void ConstructSinkL( const TDesC8& aInitData ) ; - void ConstructL(const TDesC8& aInitData, TMMFileMode aFileMode) ; - CMMFFile() ; - - void StoreRequestL( CReadWriteRequest* aRequest ) ; - void CancelRequests(); - - - CTransferBufferCopy* ObtainCopyOfTransferBufferL(TInt aMaxLength); - - public: - // Additional virtuals for DRM Intent - virtual TInt ExecuteIntent(ContentAccess::TIntent aIntent); - virtual TInt EvaluateIntent(ContentAccess::TIntent aIntent) const; - virtual TBool IsProtectedL() const; - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue); - virtual const TDesC& UniqueId() const; - - private: - class CMMFFileAsyncEventHandler : public MAsyncEventHandler - { - public: - CMMFFileAsyncEventHandler(CMMFFile* aParent); - virtual ~CMMFFileAsyncEventHandler(); - public: - virtual TInt SendEventToClient(const TMMFEvent& aEvent); - private: - CMMFFile* iParent; - }; - - class CCAFParameters : public CBase - { - public: - CCAFParameters() : iUniqueId(NULL), iEnableUI(EFalse) {} - ~CCAFParameters() { delete iUniqueId; } - public: - HBufC* iUniqueId; - TBool iEnableUI; - }; - - private: - MGenericFile* iFile; - RFs iFsSession; - - TBool iFileHandle; - RFile iHandle; - TBool iReserved; - - TBool iSinkNotStopped; - - TFileName iFullFileName ; - HBufC* iFileName ; - HBufC* iFileExt ; - HBufC* iFilePath ; - HBufC* iFileDrive ; - CCAFParameters* iCAFParameters; - TInt iFileSize; //holds the cached file size - - //Keeps track of the read position within the file. Needed in order to enable passing of the - //read position to the CReadRequest to manage the LastBuffer flag. - //NB: Continuous reads once EOF has been reached will result in iPosition going > iFileSize, - //but this causes no ill effects - TUint iPosition; - - TFourCC iSinkFourCC ; - TFourCC iSourceFourCC ; - - - RPointerArray iRequests; - - MAsyncEventHandler *iEventHandler; - CMMFFileAsyncEventHandler* iMmfFileEventHandler; - - RPointerArray iTransferBufferCopies; - friend class CMMFFileAsyncEventHandler; - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLDataSource.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLDataSource.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,155 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of ProgDLSource. -* -*/ - - -#ifndef __PROGDLDATASOURCE_H_ -#define __PROGDLDATASOURCE_H_ - - -#include -#include -#include - -class CSinkQueueItem; -using multimedia::TBufferingConfig; -/** -@publishedAll -@released - -Provides the filename and path of file. - -Used by CProgDLMultimediaSource::ConstructL(). -*/ -class TMMFFileParams - { - public: - /** - Filename and path of file. - */ - TFileName iPath ; // Filename and path of file. - private: - /** - This member is internal and not intended for use. - */ - TInt iReserved1; - }; - - /** - @internalTechnology -*/ -const TUid KFileHandleUid = {0x101FFA19}; -const TUid KMMFileSourceUid = {0x101F7DA9}; -const TUid KMMFileHandleSourceUid = {0x101F7DAA}; - -/** -@publishedAll -@released - - Provides a pointer to the file handle - - Used by CProgDLMultimediaSource::ConstructL(). -*/ -class TMMFFileHandleParams - { - public: - TMMFFileHandleParams(RFile* aFile) : iUid(KFileHandleUid), iFile(aFile) {} - TMMFFileHandleParams() : iUid(KFileHandleUid) {} - - TUid iUid; - /** - Handle of file - */ - RFile* iFile; - private: - /** - This member is internal and not intended for use. - */ - TInt iReserved1; - }; - - - - - /** - @publishedAll - @released -*/ -typedef TPckgBuf TMMFFileConfig ; - -/** -@publishedAll -@released -*/ -typedef TPckgBuf TMMFFileHandleConfig ; - - -/** -@publishedAll -@released - - This details how big the iTransferBufferCopies array of CProgDLMultimediaSource may - become before we start looking to free entries. -*/ -const TInt KAcceptableTransferBufferCopiesSize = 5; - -/** -@publishedAll -@released - - This details how big the iTransferBufferCopies array of CProgDLMultimediaSource may - become before we start looking to free entries. -*/ -const TInt KMaximumTransferBufferCopiesSize = 100; - -class CProgDLMultimediaSource; - -class CProgDLSource : public MDataSource - { - public: - static CProgDLSource* NewL( TUid aType ); - ~CProgDLSource(void); - // From MDataSource begins - TFourCC SourceDataTypeCode(TMediaId aMediaId) ; - void FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId ) ; - void BufferEmptiedL( CMMFBuffer* aBuffer ) ; - TBool CanCreateSourceBuffer() ; - CMMFBuffer* CreateSourceBufferL( TMediaId aMediaId, TBool &aReference ) ; - TInt SourceThreadLogon(MAsyncEventHandler& aEventHandler) ; - void SourceThreadLogoff(); - void SourcePrimeL(); - void SourcePlayL(); - void SourceStopL(); - void SourceCustomCommand(TMMFMessage& aMessage); - void ConstructSourceL(const TDesC8 &aInitData); - TUid DataSourceType() const; - TInt SetSourceDataTypeCode(TFourCC aSourceFourCC, TMediaId /*aMediaId*/ ); - // From MDataSource ends - - void SetMultimediaSource(CProgDLMultimediaSource& aMultimediaSource); - TDesC8& GetInitData(); - private: - CProgDLSource(TUid aType); - - void ConstructL (void); - private: - //Data - CProgDLMultimediaSource* iMultiMediaSource; - HBufC8* iInitData; - - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLMultimediaSource.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLMultimediaSource.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,223 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of ProgDLMultimediaSource. -* -*/ - - - - -#ifndef __PROGDLMULTIMEDIASOURCE_H_ -#define __PROGDLMULTIMEDIASOURCE_H_ - - -#include - -class CReadWriteRequest; -class CTransferBufferCopy; -class MGenericFile; - - - - -/** -@publishedAll -@released - -MultiMedia framework class. Represents a physical file. -This may be source file from which data is read or destination to which data is written. -Intended to be used by controller plugin developers for source and sink plugins.*/ - -class CProgDLMultimediaSource : public CMultimediaDataSource - { - public: - // From MDataSource - IMPORT_C static CProgDLMultimediaSource* NewL(MDataSource& aDataSource); - - // From CMultimediaDataSource begins - TInt SetObserver( MMultimediaDataSourceObserver& aObserver ); - TInt GetObserver( MMultimediaDataSourceObserver*& aObserver ); - void Event( TUid aEvent ); - TInt SetDataTypeCode(TFourCC aSourceFourCC ); - TInt GetDataTypeCode(TFourCC& aSourceFourCC ); - TInt GetSize( TUint& aSize ); - TInt Open(); - TInt Close(); - TInt Prime(); - TInt Play(); - TInt Stop(); - TInt FillBuffer( CMMFBuffer* aBuffer); - TInt Seek( TUint aPosInBytes ); - TInt GetSeekingSupport( TBool& aSeekSupport ); - TInt GetRandomSeekingSupport( TBool& aSeekSupport ); - // From CMultimediaDataSource ends - - TInt GetDRMProtection( TBool& aIsProtected ); - TInt EvaluateIntent( ContentAccess::TIntent aIntent ) const; - TInt ExecuteIntent( ContentAccess::TIntent aIntent ); - TInt SetAgentProperty( ContentAccess::TAgentProperty aProperty, - TInt aValue); - const TDesC& UniqueId() const; - // From MCustomInterface - TAny* CustomInterface( TUid aInterfaceUid ); - void SourceCustomCommand(TMMFMessage& aMessage); - - void FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId ) ; - - - public : - virtual ~CProgDLMultimediaSource() ; - // static MDataSource* NewSourceL(/*TUid aType*/) ; - - void SetTransferBuffer (TBool aTBuffer) ; - TBool CanUseTransferBuffer () ; - TInt ReadRequestStatus(CReadWriteRequest* aRequest,TRequestStatus& aStatus); - - protected: - /** - Indicates for which purpose the object instance is being created - */ - enum TMMFileMode - { - /** The object is created for being a source */ - ESourceMode, - /** The object is created for being a sink */ - ESinkMode - }; - - void ConstructL(const TDesC8& aInitData, TMMFileMode aFileMode) ; - void ConstructL(); - CProgDLMultimediaSource(MDataSource& aDataSource); - - void StoreRequestL( CReadWriteRequest* aRequest ) ; - void CancelRequests(); - - TInt EmptySinkQueue(); - CTransferBufferCopy* ObtainCopyOfTransferBufferL(TInt aMaxLength); - - // Calculate BufferedDataSize - void CalculateBufferedDataSize(); - void StateChanged(TState newState); - - // A common function that implements FillBuffer requests - TInt AppendBufferToSinkQueue( CMMFBuffer* aBuffer, - MMultimediaDataSourceObserver* aObserver, - MDataSink* aConsumer,TBool aTop); - - TInt ServiceFillBuffer(); - private: - - // New Functions - const TDesC& FileName() const ; - const TDesC& Extension() const ; - const TDesC& FilePath() const ; - const TDesC& FileDrive() const ; - const TFileName FullName() const; - RFile& FileL() ; - - private: - class CProgDLMultimediaSourceAsyncEventHandler : public MAsyncEventHandler - { - public: - CProgDLMultimediaSourceAsyncEventHandler(CProgDLMultimediaSource* aParent); - virtual ~CProgDLMultimediaSourceAsyncEventHandler(); - public: - virtual TInt SendEventToClient(const TMMFEvent& aEvent); - private: - CProgDLMultimediaSource* iParent; - }; - - class CCAFParameters : public CBase - { - public: - CCAFParameters() : iUniqueId(NULL), iEnableUI(EFalse) {} - ~CCAFParameters() { delete iUniqueId; } - public: - HBufC* iUniqueId; - TBool iEnableUI; - }; - - void GetAudioConfiguration(); - TInt ReOpenCAF(); - - private: - MGenericFile* iFile; - RFs iFsSession; - - TBool iFileHandle; - RFile iHandle; - TBool iReserved; - - TFileName iFullFileName ; - HBufC* iFileName ; - HBufC* iFileExt ; - HBufC* iFilePath ; - HBufC* iFileDrive ; - CCAFParameters* iCAFParameters; - - - - - - TFourCC iSinkFourCC ; - TFourCC iSourceFourCC ; - - // Queue of buffers from controller - TSglQue* iSinkQueue; - //MDataSink* iConsumer; - // Sink item Counter - TInt iSnkItemsCount; - // Observer bit rate in bps - //Keeps track of the read position within the file. Needed in order to enable passing of the - //read position to the CReadRequest to manage the LastBuffer flag. - //NB: Continuous reads once EOF has been reached will result in iPosition going > iDLFileSize, - //but this causes no ill effects - TUint iSnkBytes; - - TInt iDownloadSize; - - // Transfer bit rate in bps - TUint iTransferRate; - - TUint iObserverBitRate; - - // Buffering size in bytes - TUint iBufferedDataSize; - - TInt iDLFileSize; //holds the cached file size - TMMFMessage* iMessage; - - MMultimediaDataSourceObserver* iObserver; - RPointerArray iRequests; - - MAsyncEventHandler *iEventHandler; - - RPointerArray iTransferBufferCopies; - TBool isDownloadComplete; - - TBool iReOpenCAF; - - TInt iFileSize; - - // Pointer to the Preset Repository - CRepository* iAudioConfigRepository; - TBufferingConfig iPrimaryBufferingConfig; - TBufferingConfig iSecondaryBufferingConfig; - TUint iInitialBufferingPercentage; - TInt iReadRequestPending; - MDataSource* iParentDataSource; - HBufC8* iInitData; - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLSourceCustomCommands.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLSourceCustomCommands.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,36 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Definition of the S60 ProgDL custom command msg codes. -* -*/ - - -#ifndef PROGDLSOURCECUSTOMCOMMANDS_H -#define PROGDLSOURCECUSTOMCOMMANDS_H - -enum TProgDLSourceCC - { - EDownloadRate = 1, - ESetDownloadSize, - ESetActualSize, - EGetSourceState, - ESetDownloadState, - EGetBitRate, - EGetPercentageBuffered, - ESetUpdateFileName - }; - -#endif // PROGDLSOURCECUSTOMCOMMANDS_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLSourceUid.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLSourceUid.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contains the SourceUid for ProgDL Source -* -*/ - - -#ifndef PROGDLSOURCEUID_H -#define PROGDLSOURCEUID_H - -#include "ProgDLSourceUid.hrh" - -// This is the ECOM Interface UID for the streaming source and DataSourceType -// for Streaming Data Source. - -const TUid KMmfProgDLSource = {KMmfProgDLSourceUid}; - -#endif // PROGDLSOURCEUID_H - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLSourceUid.hrh --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/inc/ProgDLSourceUid.hrh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Contains the SourceUid for ProgDL Source -* -*/ - - -#ifndef PROGDLSOURCEUID_HRH -#define PROGDLSOURCEUID_HRH - - -// These are the ECOM Interface UIDs for the prog dl source - -#define KMmfProgDLSourceUid 0x10207B46 - -#endif // PROGDLSOURCEUID_HRH - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/FileAccess.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/FileAccess.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,143 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of FileAccess Classes. -* -*/ - -#ifndef __FILE_ACCESS_H__ -#define __FILE_ACCESS_H__ - -#include -#include -#include - -// Abstract class providing generic file access -class MGenericFile - { - public: - virtual ~MGenericFile(); - - virtual TInt Seek(TSeek aSeekMode, TInt aPosition)=0; - virtual TInt Read(TDes8& aDes,TInt aLength)=0; - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus)=0; - - virtual TInt Write(const TDesC8& aDes,TInt aLength)=0; - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus)=0; - - virtual TInt Size(TInt& aSize)=0; - virtual TInt SetSize(TInt aSize)=0; - - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const = 0; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent) = 0; - virtual TBool IsProtected()const = 0; - - // legacy file support - virtual RFile& FileL()=0; - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) = 0; - - }; - -// Provide RFile based file access -class CF32File : public CBase, public MGenericFile - { - public: - static CF32File* NewL(RFs& aSession, TDesC& aPath, TUint aMode); - static CF32File* NewL(RFile& aFile); - void ConstructL(RFile& aFile); - void ConstructL(RFs& aSession, TDesC& aPath, TUint aMode); - - virtual ~CF32File(); - - // from MGenericFile - virtual TInt Seek(TSeek aSeekMode, TInt aPosition); - virtual TInt Read(TDes8& aDes,TInt aLength); - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Write(const TDesC8& aDes,TInt aLength); - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Size(TInt& aSize); - virtual TInt SetSize(TInt aSize); - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent); - virtual TBool IsProtected() const; - virtual RFile& FileL(); - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty, TInt aValue); - - private: - CF32File(); - - private: - RFs* iSession; // not owned - HBufC* iFilePath; - RFile iFile; - - TBool iFileHandle; - TInt iFileSize; - }; - -// Provides content access framework based file access -class CContentFile : public CBase, public MGenericFile - { - public: - static CContentFile* NewL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint aMode, TBool aEnableUI); - void ConstructL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint aMode, TBool aEnableUI); - - static CContentFile* NewL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI); - void ConstructL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI); - - virtual ~CContentFile(); - - // from MGenericFile - virtual TInt Seek(TSeek aSeekMode, TInt aPosition); - virtual TInt Read(TDes8& aDes,TInt aLength); - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Write(const TDesC8& aDes,TInt aLength); - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Size(TInt& aSize); - virtual TInt SetSize(TInt aSize); - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent); - virtual TBool IsProtected() const; - virtual RFile& FileL(); - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty, TInt aValue); - - private: - CContentFile(); - - - private: - RFs* iSession; // not owned - HBufC* iFilePath; - ContentAccess::CData* iData; - - RFile iLegacyFile; - TBool iLegacyFileOpen; - }; - - -inline CF32File::CF32File() - { - } - -inline CContentFile::CContentFile() - { - } - -inline MGenericFile::~MGenericFile() - { - } - -#endif //__FILE_ACCESS_H__ diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/Main.cpp --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/Main.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of ProgDLSource. -* -*/ - - -#include // ECom -#include "ProgDLDataSource.h" -#include "ProgDLSourceUid.h" - -// __________________________________________________________________________ -// Exported proxy for instantiation method resolution -// Define the interface UIDs - - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KMmfProgDLSourceUid, CProgDLSource::NewL) - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/MmffilePriv.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/MmffilePriv.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,172 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of TransferBuffer. -* -*/ - - -#ifndef __MMFFILEPRIV_H_ -#define __MMFFILEPRIV_H_ - -#include - -#include -#include - -/** -* @publishedAll -* -* Represents a copy of a KUidMmfTransferBuffer used for reading/writting to the file server -*/ - -class CTransferBufferCopy : public CBase - { - public: - static CTransferBufferCopy* NewL(TInt aMaxLength); - - virtual ~CTransferBufferCopy() - {delete iBuffer;} - - - TDes8& Des() {return iBufferDes;} - - TInt MaxLength() {return iBufferDes.MaxLength();} - - void ReUse(TInt aMaxLength) {iBufferDes.Set(iBuffer,0, Min(aMaxLength, iMaxLength));} - - TBool InUse() {return iInUse;} - - void SetInUse(TBool aInUse) {iInUse=aInUse;} - - private: - CTransferBufferCopy(TInt aMaxLength) : CBase(), iMaxLength(aMaxLength), iBufferDes(0,0,0), iInUse(EFalse){} - - void ConstructL(); - - private: - TUint8* iBuffer; - - //Holds the original MaxLength when class constructed. - //May be larger than MaxLength of iBufferDes - TInt iMaxLength; - - TPtr8 iBufferDes; - - TBool iInUse; - }; - - - - - /** - * @internalComponent - * - * A request is created when an external object requests or supplies data. Calls to the File Server are - * made asynchronously and a CReadWriteRequest created to notify the caller on completion. - * - * CReadWriteRequest is an abstract class. Concrete instances are of CReadRequest & CWriteRequest. - * Concrete instances need to know whether to call MDataSink::BufferFilledL() or MDataSource::BufferEmptiedL() -*/ -class CReadWriteRequest : public CActive - { - public: - CReadWriteRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer,TBool aSourceType) - : CActive(EPriorityStandard), - iSinkOrSource(aSinkOrSource), - iBuffer(aBuffer), - iSourceType(aSourceType) - { - CActiveScheduler::Add( this ); - } - - CReadWriteRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer, CTransferBufferCopy* aOptionalDataBuffer,TBool aSourceType) - : CActive(EPriorityStandard), - iSinkOrSource(aSinkOrSource), - iBuffer(aBuffer), - iSourceType(aSourceType), - iTransferBufferCopy(aOptionalDataBuffer) - { - CActiveScheduler::Add( this ); - iTransferBufferCopy->SetInUse(ETrue); - } - - CReadWriteRequest(CReadWriteRequest& aRequest) - : CActive(EPriorityStandard), - iSinkOrSource(aRequest.iSinkOrSource), - iBuffer(aRequest.iBuffer), - iSourceType(aRequest.iSourceType), - iTransferBufferCopy(aRequest.iTransferBufferCopy) - { - CActiveScheduler::Add( this ); - iTransferBufferCopy->SetInUse(ETrue); - } - - - TBool Completed() ; - TInt SetStatus(TBool aStatus); - TDes8& BufferDes() ; - TBool SourceType(); - const TDesC8& BufferDesC() ; - CMMFBuffer* Buffer(); - TAny* GetSinkOrSource(); - ~CReadWriteRequest() ; - - - // CActive functions. - // - void SetActive() ; - void DoCancel() ; - virtual void RunL() = 0 ; - virtual TInt RunError( TInt aError ) ; - - - protected : - TAny* iSinkOrSource; - CMMFBuffer* iBuffer; - TBool iSourceType; - CTransferBufferCopy* iTransferBufferCopy; - - TBool iCompleted ; - TDes8* iBufferDes ; - TInt iError ; - TBool iUseTransferBuffer ; - void SetTransferBuffer (TBool aTBuffer) ; - TBool CanUseTransferBuffer () ; - } ; - - /** - * @internalComponent -*/ -class CReadRequest : public CReadWriteRequest - { - public : - CReadRequest(TAny* aParent,TAny* aSinkOrSource, CMMFBuffer* aBuffer, TUint aPosition, TUint aFileSize,TBool aSourceType) - : CReadWriteRequest(aSinkOrSource, aBuffer,aSourceType), - iPosition(aPosition), iFileSize(aFileSize),iParent(aParent) - { } - - CReadRequest(TAny* aParent,TAny* aSinkOrSource, CMMFBuffer* aBuffer, CTransferBufferCopy* aOptionalDataBuffer, TUint aPosition, TUint aFileSize,TBool aSourceType) - : CReadWriteRequest(aSinkOrSource, aBuffer, aOptionalDataBuffer,aSourceType), - iPosition(aPosition), iFileSize(aFileSize),iParent(aParent) - { } - - void RunL(); - private: - TUint iPosition; - TUint iFileSize; - TAny* iParent; - }; - -#endif - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/ProgDLSource.cpp --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/ProgDLSource.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1803 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of ProgDLSource. -* -*/ - - -#include -#include -#include -#include -#include -#include -#include "ProgDLDataSource.h" -#include "ProgDLMultimediaSource.h" -#include "MmffilePriv.h" -#include "FileAccess.h" -#include "SinkQueueItem.h" -#include "ProgDLSourceCustomCommands.h" -#include -#include "ProgDLSourceUid.h" -#include "AudioConfigurationPrivateCRKeys.h" - -#ifdef _DEBUG -#define DEBPRN1(str) RDebug::Print(str); -#define DEBPRN2(str, val1) RDebug::Print(str, val1); -#define DEBPRN3(str, val1, val2) RDebug::Print(str, val1, val2); -#define DEBPRN4(str, val1, val2, val3) RDebug::Print(str, val1, val2, val3); -#define DEBPRN5(str, val1, val2, val3, val4) RDebug::Print(str, val1, val2, val3, val4); -#else -#define DEBPRN1(str) -#define DEBPRN2(str, val1) -#define DEBPRN3(str, val1, val2) -#define DEBPRN4(str, val1, val2, val3) -#define DEBPRN5(str, val1, val2, val3, val4) -#endif // _DEBUG - -const TUint KMinPlaybackDuration = 15; // 15 second - -void Panic(TMMFFilePanicCode aPanicCode) - { - _LIT(KMMFFilePanicCategory, "MMFFile"); - User::Panic(KMMFFilePanicCategory, aPanicCode); - } - - /** - * Constructs a CTransferBufferCopy - * - * @return CTransferBufferCopy* -*/ -CTransferBufferCopy* CTransferBufferCopy::NewL(TInt aMaxLength) - { - CTransferBufferCopy* self = new (ELeave) CTransferBufferCopy(aMaxLength); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - /** - * Second phase constructor for CTransferBufferCopy - * - * @return void -*/ -void CTransferBufferCopy::ConstructL() - { - iBuffer = static_cast(User::AllocL(iMaxLength)); - iBufferDes.Set(iBuffer,0,iMaxLength); - } - -/************************/ -CProgDLSource* CProgDLSource::NewL(TUid aType ) - { - DEBPRN1(_L("CProgDLSource::NewL")); - CProgDLSource* self = new (ELeave) CProgDLSource(aType); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CProgDLSource::CProgDLSource(TUid aType) -: MDataSource(aType) - { - iInitData = NULL; - } - -CProgDLSource::~CProgDLSource(void) - { - delete iInitData; - iInitData = NULL; - } - -void CProgDLSource::ConstructL (void) - { - } - -// From MDataSource begins -TUid CProgDLSource::DataSourceType() const - { - return KMmfProgDLSource; - } - - -TFourCC CProgDLSource::SourceDataTypeCode(TMediaId /*aMediaId*/ ) - { - TFourCC fourCC; - return iMultiMediaSource->GetDataTypeCode(fourCC); - } - -TInt CProgDLSource::SetSourceDataTypeCode(TFourCC aSourceFourCC, - TMediaId /*aMediaId*/ ) - { - iMultiMediaSource->SetDataTypeCode(aSourceFourCC); - return KErrNone; - } - -void CProgDLSource::FillBufferL(CMMFBuffer* aBuffer, - MDataSink* aConsumer, - TMediaId aMediaId ) - { - iMultiMediaSource->FillBufferL(aBuffer,aConsumer,aMediaId); - } - -void CProgDLSource::BufferEmptiedL(CMMFBuffer* /*aBuffer*/ ) - { - User::Leave(KErrUnknown); - } - -TBool CProgDLSource::CanCreateSourceBuffer() - { - return EFalse; - } - -CMMFBuffer* CProgDLSource::CreateSourceBufferL(TMediaId /*aMediaId*/, - TBool &/*aReference*/ ) - { - return NULL; - } - -TInt CProgDLSource::SourceThreadLogon( MAsyncEventHandler& /*aEventHandler*/ ) - { - return iMultiMediaSource->Open(); - } - -void CProgDLSource::SourceThreadLogoff() - { - iMultiMediaSource->Close(); - } - -void CProgDLSource::SourcePrimeL() - { - DEBPRN1(_L("CProgDLSource::SourcePrimeL")); - User::LeaveIfError(iMultiMediaSource->Prime()); - } - -void CProgDLSource::SourcePlayL() - { - DEBPRN1(_L("CProgDLSource::SourcePlayL")); - User::LeaveIfError(iMultiMediaSource->Play()); - } - -void CProgDLSource::SourceStopL() - { - DEBPRN1(_L("CProgDLSource::SourceStopL")); - User::LeaveIfError(iMultiMediaSource->Stop()); - } - - -void CProgDLSource::ConstructSourceL(const TDesC8& aInitData ) - { - if(iInitData) - { - delete iInitData; - iInitData = NULL; - } - iInitData = aInitData.AllocL(); - } - -void CProgDLSource::SourceCustomCommand(TMMFMessage& aMessage) - { - iMultiMediaSource->SourceCustomCommand(aMessage); - } - -void CProgDLSource::SetMultimediaSource(CProgDLMultimediaSource& aMultimediaSource) - { - iMultiMediaSource = &aMultimediaSource; - } - -TDesC8& CProgDLSource::GetInitData() - { - return *iInitData; - } -/****************************/ - - -EXPORT_C CProgDLMultimediaSource* CProgDLMultimediaSource::NewL(MDataSource& aDataSource) - { - DEBPRN1(_L("CProgDLMultimediaSource::NewL")); - CProgDLMultimediaSource* self = new (ELeave) CProgDLMultimediaSource(aDataSource); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - /** - Destructor. -*/ -CProgDLMultimediaSource::~CProgDLMultimediaSource() - { - DEBPRN1(_L("CProgDLMultimediaSource::~CProgDLMultimediaSource() ")); - delete iInitData; - delete iFile; - EmptySinkQueue(); - iHandle.Close(); - iFsSession.Close(); - delete iFileName; - delete iFileExt; - delete iFilePath; - delete iFileDrive; - - - delete iCAFParameters; - delete iSinkQueue; - delete iAudioConfigRepository; - - if(iMessage) - { - if(!iMessage->IsCompleted()) - { - iMessage->Complete(KErrDied); - delete iMessage; - iMessage = NULL; - } - } - // Get rid of everything in RArray's & close them. - iRequests.ResetAndDestroy(); - iTransferBufferCopies.ResetAndDestroy(); - DEBPRN1(_L("CProgDLMultimediaSource::~CProgDLMultimediaSource() exit")); - } - - /** - Protected constructor. - - The default implementation is empty. -*/ -CProgDLMultimediaSource::CProgDLMultimediaSource(MDataSource& aDataSource) - : iSnkItemsCount(0), - iSnkBytes(0), - iDownloadSize(0), - iTransferRate(0), - //iConsumer(NULL), - iBufferedDataSize(0), - iDLFileSize(0), - isDownloadComplete(EFalse), - iFileSize(0), - iParentDataSource(&aDataSource) - { - iMessage = NULL; - iFile = NULL; - iState = ECLOSED; - iObserver = NULL; - iReadRequestPending = 0; - iReOpenCAF = EFalse; - iObserverBitRate = 0; - } - - /** - Constructs an CProgDLMultimediaSource MDataSource. - - @return A pointer to the new CProgDLMultimediaSource data source. -*/ -/*MDataSource* CProgDLMultimediaSource::NewSourceL() -{ -CProgDLMultimediaSource* self = new (ELeave) CProgDLMultimediaSource( KMmfProgDLSource ) ; -return STATIC_CAST( MDataSource*, self ) ; - }*/ - - - /** - Perform source construction dependant on the source construction - initialisation data aInitData. - - @param aInitData - The TPckg descriptor package containing the file name and full path. -*/ -void CProgDLMultimediaSource::ConstructL() - { - CProgDLSource* progDLSource = static_cast(iParentDataSource); - iInitData = (progDLSource->GetInitData()).AllocL(); - progDLSource->SetMultimediaSource(*this); - ConstructL(*iInitData, ESourceMode); - iSinkQueue = new(ELeave) TSglQue(_FOFF(CSinkQueueItem, iLink)); - } - - - /** - Protected constructor. - - Extracts the initialisation data provided by the calling functions: ConstructSourceL() and - ConstructSinkL(). Creates a file server session and sets up file name. If there is a file name and - it cannot be found this function leaves. If there is no file name the function leaves. Does not - attempt to open the file or check whether the file exists. - - If aInitData contains a TMMFFileHandleParams instead of TMMFFileParams, the source/sink is constructed from - the file handle provided by the caller - - @param aInitData - Initialisation data packaged in a TMMFFileParams or in a TMMFFileHandleParams (File Handle) -*/ -void CProgDLMultimediaSource::ConstructL(const TDesC8& aInitData,TMMFileMode aFileMode) - { - User::LeaveIfError(iFsSession.Connect()); - // on IPCv2 we auto attach - User::LeaveIfError(iFsSession.ShareAuto()); - - User::LeaveIfError(iFsSession.ShareProtected()); - - TBool fileInit = EFalse; - HBufC* filename = NULL; - TBool filenamePushed = EFalse; - - iCAFParameters = new (ELeave) CCAFParameters; - TBool drmContent = EFalse; - RDesReadStream stream(aInitData); - CleanupClosePushL(stream); - - iAudioConfigRepository = CRepository::NewL(KCRUidAudioConfiguration); - - // From Central Repository - GetAudioConfiguration(); - - TUid initUid; - - initUid = TUid::Uid(stream.ReadInt32L()); - - if (initUid == KMMFileHandleSourceUid) - { - TPckgBuf fileptr; - stream.ReadL(fileptr); - - iHandle.Duplicate(*fileptr()); - - TInt length; - length = stream.ReadInt32L(); - if (length>0) - { - iCAFParameters->iUniqueId = HBufC::NewL(length); - TPtr16 ptr = iCAFParameters->iUniqueId->Des(); - stream.ReadL(ptr, length); - } - iFileHandle = ETrue; - filename = HBufC::NewMaxL(KMaxFileName); - TPtr ptr = filename->Des(); - iHandle.Name(ptr); - fileInit = ETrue; - drmContent = ETrue; - - iCAFParameters->iEnableUI = stream.ReadInt32L(); - } - - else if (initUid == KMMFileSourceUid) - { - TInt length; - length = stream.ReadInt32L(); - filename = HBufC::NewMaxLC(length); - TPtr ptr = filename->Des(); - stream.ReadL(ptr, length); - - length = stream.ReadInt32L(); - if (length>0) - { - iCAFParameters->iUniqueId = HBufC::NewMaxL(length); - ptr.Set(iCAFParameters->iUniqueId->Des()); - stream.ReadL(ptr, length); - } - CleanupStack::Pop(filename); - - fileInit = ETrue; - drmContent = ETrue; - iFileHandle = EFalse; - iCAFParameters->iEnableUI = stream.ReadInt32L(); - } - else - { - // TODO If the UID is unknown we should reject, but currently - // code also used for older calls that just supply filename. - // User::Leave(KErrNotSupported); - } - - CleanupStack::PopAndDestroy(&stream); - - if (!fileInit && aInitData.Length() == sizeof(TMMFFileHandleParams)) - { - TMMFFileHandleParams params; - TPckgC config(params); - config.Set(aInitData); - params = config(); - - - if (params.iUid == KFileHandleUid) - { - fileInit = ETrue; - User::LeaveIfError(iHandle.Duplicate(*params.iFile)); - TInt pos = 0; - // make sure the duplicate handle is at the start of the file - the usage of the file handle really requires this - User::LeaveIfError(iHandle.Seek(ESeekStart, pos)); - iFileHandle = ETrue; - filename = HBufC::NewMaxLC(KMaxFileName); - filenamePushed = ETrue; - TPtr ptr = filename->Des(); - User::LeaveIfError(iHandle.Name(ptr)); - } - } - - if (!fileInit) // do old case as last resort - { - TMMFFileParams params; - TPckgC config(params); - config.Set(aInitData); - params = config(); - - filename = params.iPath.AllocL(); - fileInit = ETrue; - } - - if (!filenamePushed) - { - // from now on it is assumed pushed. - CleanupStack::PushL(filename); - } - - TParse parser ; - User::LeaveIfError(parser.Set(*filename, NULL, NULL)); - CleanupStack::PopAndDestroy(filename); - if ( !( parser.NamePresent() ) && !( parser.ExtPresent() ) ) - User::Leave( KErrBadName ) ; - - iFullFileName.Copy( parser.FullName() ) ; - iFileName = parser.Name().AllocL() ; - iFileExt = parser.Ext().AllocL() ; - iFilePath = parser.Path().AllocL() ; - iFileDrive = parser.Drive().AllocL() ; - - // in order to simulate old behaviour we are not passing error out - // but will try to create Content again during PrimeL() - if (fileInit && drmContent && aFileMode==ESourceMode) - { - TInt contentError; - if (iFileHandle) - { - TRAP(contentError, - iFile = CContentFile::NewL(iHandle, UniqueId(), iCAFParameters->iEnableUI); - ); - } - else - { - // Open for read-only access - TRAP(contentError, - iFile = CContentFile::NewL(iFsSession, iFullFileName, UniqueId(), EFileShareAny, iCAFParameters->iEnableUI); - ); - } - } - } - - -/** -@deprecated - -Returns an RFile handle to the current file. - -If there is no current file, one is created. If the file exists then it is opened with read access -if it is read only, write access otherwise. If the file does not exist then it is opened with -write access. - -@leave KErrNotReady -The file is not open. - -@return A handle to the current file. -*/ -RFile& CProgDLMultimediaSource::FileL() - { - if (!iFile) - User::Leave(KErrNotReady); - if (iFileHandle) - return iHandle; - else - return iFile->FileL(); - } - -/** -Returns the file name of the current file. - - Note: This will give the wrong answer if the file is renamed! - - @return The FileName (without extension). -*/ -const TDesC& CProgDLMultimediaSource::FileName() const - { - return *iFileName ; - } - -/** -Returns the extension of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The File Extension. -*/ -const TDesC& CProgDLMultimediaSource::Extension() const - { - return *iFileExt ; - } - -/** -Returns the path of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The FilePath (without filename and extension) -*/ -const TDesC& CProgDLMultimediaSource::FilePath() const - { - return *iFilePath ; - } - -/** -Returns the drive on which the current file is located. - -Note: This will give the wrong answer if the file is renamed! - -@return The FileDrive (drive letter only, without path, filename and extension). -*/ -const TDesC& CProgDLMultimediaSource::FileDrive() const - { - return *iFileDrive ; - } - -/** -Returns the full name of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The file name (full filename including drive letter, without path, filename and extension). -*/ -const TFileName CProgDLMultimediaSource::FullName() const - { - return iFullFileName; - } - -/** -Returns the uniqueID associated with this content. If no uniqueID has been provided, a null -descriptor will be provided - -@return The UniqueID -*/ -const TDesC& CProgDLMultimediaSource::UniqueId() const - { - if (iCAFParameters->iUniqueId) - return *(iCAFParameters->iUniqueId); - else - return KNullDesC; - } - -/** -Obtains a CTransferBufferCopy from iTransferBufferCopies that is -at least as big as that required. - -There is no need to put the pointer returned by this method onto the CleanupStack -as it will have already been placed into iTransferBufferCopies. - -@param aMaxLength -The size required. - -@return A pointer to a valid CTransferBufferCopy. -*/ -CTransferBufferCopy* CProgDLMultimediaSource::ObtainCopyOfTransferBufferL(TInt aMaxLength) - { - //find a free transfer buffer copy of the right size - TInt firstFree = -1; - CTransferBufferCopy* transBufCopyToUse = NULL; - - for(TInt cnt=0; cnt < iTransferBufferCopies.Count(); cnt++) - { - if(!iTransferBufferCopies[cnt]->InUse()) - { - //record the first free entry, we may remove this - //if entries in iTransferBufferCopies > KAcceptableTransferBufferCopiesSize - if(firstFree == -1) - firstFree = cnt; - - if(iTransferBufferCopies[cnt]->MaxLength() >= aMaxLength) - { - transBufCopyToUse = iTransferBufferCopies[cnt]; - - //Set the MaxLength. This will ensure that the copy acts the same as - //the original Transfer buffer, eg. file server will throw KErrOverflow - transBufCopyToUse->ReUse(aMaxLength); - break; - } - } - } - - //If we failed to find a suitable entry, we need to create a new one - if(!transBufCopyToUse) - { - //Firstly, should we re-cycle an existing entry? - //There must be entries in the array, a free entry must have been found, - //the size of the array must be beyond the water mark where we want to start - //cycling free entries. - if((iTransferBufferCopies.Count() > 0) && - (firstFree != -1) && - (iTransferBufferCopies.Count() > KAcceptableTransferBufferCopiesSize)) - { - delete iTransferBufferCopies[firstFree]; - iTransferBufferCopies.Remove(firstFree); - - transBufCopyToUse = CTransferBufferCopy::NewL(aMaxLength); - CleanupStack::PushL(transBufCopyToUse); - User::LeaveIfError(iTransferBufferCopies.Insert(transBufCopyToUse,firstFree)); - - CleanupStack::Pop(); - } - else - { - #ifdef _DEBUG - if(iTransferBufferCopies.Count() > KMaximumTransferBufferCopiesSize) - { - User::Panic(_L("iTransferBufferCopies grew too large in CProgDLMultimediaSource"),KErrTooBig); - } - #endif - - transBufCopyToUse = CTransferBufferCopy::NewL(aMaxLength); - CleanupStack::PushL(transBufCopyToUse); - User::LeaveIfError(iTransferBufferCopies.Append(transBufCopyToUse)); - - CleanupStack::Pop(); - } - } - - return transBufCopyToUse; - } - - - -/** -Loads aBuffer from iFile. - -The file must already be open for reading. File read is asynchronous. CReadRequest is created to -respond to completion. - -@param aBuffer -The buffer to be filled from the file. -@param aConsumer -The data sink consumer of the buffer. -*/ -void CProgDLMultimediaSource::FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId /*aMediaId*/ ) - { - // Requires that iFile is open for read. - // Reads data from iFile into aBuffer - TInt status(KErrNone); - DEBPRN2(_L("CProgDLMultimediaSource::FillBuffer[%x]]"), aBuffer ); - if ((!aConsumer) || (!aBuffer)) - User::Leave(KErrArgument); - - if (!iFile) - User::Leave(KErrNotReady); - - AppendBufferToSinkQueue(aBuffer,NULL,aConsumer,EFalse); - DEBPRN4(_L("CProgDLMultimediaSource::FillBuffer DLComplete[%d] ReOpenCAF[%d] RequestPending[%d]"), isDownloadComplete,iReOpenCAF,iReadRequestPending ); - if(isDownloadComplete && !iReOpenCAF) - { - if(!iReadRequestPending) - { - ReOpenCAF(); - status = ServiceFillBuffer(); - if(status == KErrUnderflow) - { - StateChanged(EBUFFERING); - } - } - } - else - { - status = ServiceFillBuffer(); - - if(status == KErrUnderflow) - { - StateChanged(EBUFFERING); - } - } - } - -/** -Stores a request in an array. - -CReadWriteRequests are stored in the array iRequests. -This function takes ownership and places the request in the array. -It also checks the array for completed requests and removes them. - -@param aRequest -The request to store. -*/ -void CProgDLMultimediaSource::StoreRequestL( CReadWriteRequest* aRequest ) - { - // add aRequest to iRequests - User::LeaveIfError( iRequests.Append( aRequest ) ) ; - - // Clear out any completed requests - for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ ) - { - if (iRequests[ii]->Completed()) - { - CReadWriteRequest* request = iRequests[ii]; - delete request; - - iRequests.Remove(ii); - ii--; - } - } - } - - -/** -Cancels outstanding requests. - -CReadWriteRequests are stored in the array iRequests. -This function cancels any outstanding requests and removes them -from iRequests. -*/ -void CProgDLMultimediaSource::CancelRequests() - { - // Clear out any completed requests - for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ ) - { - CReadWriteRequest* request = iRequests[ii]; - delete request; - iRequests.Remove(ii); - ii--; - } - } - - -/** -Evaluates a given intent against the rights associated with the file. - -The rights are not updated by this function call. - -@param aIntent -The intent to evaluate. - - @return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgDLMultimediaSource::EvaluateIntent(ContentAccess::TIntent aIntent) const - { - if (!iFile) - { - return KErrNotReady; - } - - return iFile->EvaluateIntent(aIntent); - } - -/** -Evaluates and executes a given intent against the rights associated with the file. - -The rights object is updated after calling this function. - -@param aIntent -The intent to evaluate. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise -another of the system-wide error codes. -*/ -TInt CProgDLMultimediaSource::ExecuteIntent(ContentAccess::TIntent aIntent) - { - if (!iFile) - { - return KErrNotReady; - } - - return iFile->ExecuteIntent(aIntent); - } - -/** -Returns whether the file is protected. - -@return A boolean indicating if the file is protected. ETrue if the file is protected. -*/ -TInt CProgDLMultimediaSource::GetDRMProtection(TBool& aIsProtected) - { - TInt err(KErrNone); - if (!iFile) - { - return KErrNotReady; - } - - TRAP(err,aIsProtected = iFile->IsProtected()); - return err; - } - -TInt CProgDLMultimediaSource::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) - { - if (!iFile) - { - return KErrNotReady; - } - - return iFile->SetAgentProperty(aProperty, aValue); - } - -/* -* Returns ETrue if the request can safely be deleted. -*/ -TBool CReadWriteRequest::Completed() - { - return iCompleted ; - } - -TInt CReadWriteRequest::SetStatus(TBool aStatus) - { - iCompleted = aStatus; - return KErrNone; - } - -TBool CReadWriteRequest::SourceType() - { - return iSourceType ; - } - - -/* -* Returns the data member of CMMFDataBuffer or CMMFTransferBuffer (as TPtr8) -* -*/ -TDes8& CReadWriteRequest::BufferDes() - { - if(iTransferBufferCopy) - return iTransferBufferCopy->Des(); - else - { - //reset iBufferDes in case iBuffer has changed... - iBufferDes = &(STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data()); - return *iBufferDes; - } - } - -const TDesC8& CReadWriteRequest::BufferDesC() - { - if(iTransferBufferCopy) - return iTransferBufferCopy->Des(); - else - return BufferDes(); - } - -CMMFBuffer* CReadWriteRequest::Buffer() - { - return iBuffer; - } - -TAny* CReadWriteRequest::GetSinkOrSource() - { - return iSinkOrSource; - } - -/* -* Destructor. -*/ -CReadWriteRequest::~CReadWriteRequest() - { - Cancel(); - if(iTransferBufferCopy) - iTransferBufferCopy->SetInUse(EFalse); - } - -/* -* Allows owning class access to SetActive() -*/ -void CReadWriteRequest::SetActive() - { - CActive::SetActive() ; - } - -/* -* For the moment at least... Canceled requests may be deleted -*/ -void CReadWriteRequest::DoCancel() - { - iCompleted = ETrue ; - } - -/* -* Called when errors in RunL force Leave. For the moment just mark the request deletable -*/ -TInt CReadWriteRequest::RunError( TInt aError ) - { - //RunL can leave. - iCompleted = ETrue ; - iError = aError; //keep this error internally for now - return KErrNone ; - } - -/* -* On completion of read request call back to the MDataSink -*/ -void CReadRequest::RunL() - { - //Copy the data from the normal buffer into the Transfer buffer - if(iTransferBufferCopy) - { - //must specify the size here as the dest may be smaller than the source. - TDes8& destDesc = STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data(); - destDesc.Copy(iTransferBufferCopy->Des().Left(destDesc.MaxLength())); - - iTransferBufferCopy->SetInUse(EFalse); - } - - STATIC_CAST(CProgDLMultimediaSource*,iParent)->ReadRequestStatus(STATIC_CAST(CReadWriteRequest*,this),iStatus); - } - - // From CMultimediaDataSource begins -TInt CProgDLMultimediaSource::SetObserver( MMultimediaDataSourceObserver& aObserver ) - { - TInt status(KErrNone); - iObserver = &aObserver; - return status; - } - -TInt CProgDLMultimediaSource::GetObserver( MMultimediaDataSourceObserver*& aObserver ) - { - TInt status(KErrNone); - aObserver = iObserver; - return status; - } - -void CProgDLMultimediaSource::Event( TUid aEvent ) - { - if( aEvent == KMultimediaDataSourceEventBitRateChanged ) - { - - if(iObserver) - { - iObserver->GetBitRate( iObserverBitRate ); - if(iState == EBUFFERING) - CalculateBufferedDataSize(); - } - } - - } - -TInt CProgDLMultimediaSource::SetDataTypeCode(TFourCC aSourceFourCC ) - { - TInt status(KErrNone); - iSourceFourCC = aSourceFourCC; - return status; - } - -TInt CProgDLMultimediaSource::GetDataTypeCode(TFourCC& aSourceFourCC ) - { - TInt status(KErrNone); - aSourceFourCC = iSourceFourCC; - return status; - } - -TInt CProgDLMultimediaSource::GetSize( TUint& aSize ) - { - TInt err = KErrNone; - if (iDLFileSize >=0) - { - aSize = iDLFileSize; - } - else - { - aSize = 0; - } - return err; - } - -TInt CProgDLMultimediaSource::Open() - { - TInt status(KErrNotReady); - DEBPRN1(_L("CProgDLMultimediaSource::Open")); - switch ( iState ) - { - case ECLOSED: - StateChanged(ESTOPPED); - status = KErrNone; - break; - case ESTOPPED: - case EPRIMED: - case EEXECUTING: - case EBUFFERING: - default: - DEBPRN2(_L("CProgDLMultimediaSource::Open[Illegal cmd on state[%d]]"), iState ); - break; - }; - return status; - } - -TInt CProgDLMultimediaSource::Close() - { - TInt status(KErrNone); - iHandle.Close(); - iFsSession.Close(); - - StateChanged(ECLOSED); - // Clear app buffers - EmptySinkQueue(); - iSnkBytes = 0; - // Clear observer buffers - return status; - } - -TInt CProgDLMultimediaSource::Prime() - { - TInt status(KErrNotReady); - DEBPRN1(_L("CProgDLMultimediaSource::Prime")); - switch ( iState ) - { - case ESTOPPED: - - // don't reopen file if already open - if (!iFile) - { - if (iFileHandle) - { - TRAPD(err,iFile = CContentFile::NewL(iHandle, UniqueId(), iCAFParameters->iEnableUI)); - if(err) - return err; - } - else - { - // Open for read-only access - TRAPD(err,iFile = CContentFile::NewL(iFsSession, iFullFileName, UniqueId(), EFileShareAny, iCAFParameters->iEnableUI)); - if(err) - return err; - } - } - - if(iFile) - { - if(iFile->IsProtected()) - iFile->Size(iFileSize); - else - iFileSize = iDLFileSize; - } - - StateChanged(EPRIMED); - status = KErrNone; - break; - case EPRIMED: - status = KErrNone; - break; - case ECLOSED: - case EEXECUTING: - case EBUFFERING: - default: - DEBPRN2(_L("CProgDLMultimediaSource::Prime[Illegal cmd on state[%d]]"), iState ); - break; - } - return status; - } - -TInt CProgDLMultimediaSource::Play() - { - TInt status(KErrNotReady); - DEBPRN1(_L("CProgDLMultimediaSource::Play")); - switch ( iState ) - { - case EPRIMED: - CalculateBufferedDataSize(); - StateChanged(EEXECUTING); - - while ( !iSinkQueue->IsEmpty() ) - { - status = ServiceFillBuffer(); - } - - if(status == KErrUnderflow) - { - StateChanged(EBUFFERING); - } - - status = KErrNone; - break; - case EEXECUTING: - case EBUFFERING: - status = KErrNone; - // No op - break; - case ECLOSED: - case ESTOPPED: - default: - DEBPRN2(_L("CProgDLMultimediaSource::Play[Illegal cmd on state[%d]]"), iState ); - break; - }; - return status; - } - -TInt CProgDLMultimediaSource::Stop() - { - TInt status(KErrNotReady); - DEBPRN1(_L("CProgDLMultimediaSource::Stop")); - switch ( iState ) - { - case EPRIMED: - case EEXECUTING: - case EBUFFERING: - { - TInt pos = 0; - CancelRequests(); - delete iFile; - iFile = NULL; - //iDLFileSize = -1; - iSnkBytes=pos; - iBufferedDataSize = 0; - EmptySinkQueue(); - StateChanged(ESTOPPED); - status = KErrNone; - } - break; - case ECLOSED: - default: - DEBPRN2(_L("CProgDLMultimediaSource::Stop[Illegal cmd on state[%d]]"), iState ); - break; - }; - return status; - } - - -TInt CProgDLMultimediaSource::FillBuffer( CMMFBuffer* aBuffer ) - { - // Requires that iFile is open for read. - // Reads data from iFile into aBuffer - - TInt status(KErrNone); - DEBPRN2(_L("CProgDLMultimediaSource::FillBuffer[%x]]"), aBuffer ); - if (!aBuffer) - return KErrArgument; - - if (!iFile) - return KErrNotReady; - - AppendBufferToSinkQueue(aBuffer,iObserver,NULL,EFalse); - - DEBPRN4(_L("CProgDLMultimediaSource::FillBuffer DLComplete[%d] ReOpenCAF[%d] RequestPending[%d]"), isDownloadComplete,iReOpenCAF,iReadRequestPending ); - if(isDownloadComplete && !iReOpenCAF) - { - if(!iReadRequestPending) - { - ReOpenCAF(); - status = ServiceFillBuffer(); - if(status == KErrUnderflow) - { - StateChanged(EBUFFERING); - } - } - } - else - { - status = ServiceFillBuffer(); - - if(status == KErrUnderflow) - { - StateChanged(EBUFFERING); - } - } - return status; - } - - -TAny* CProgDLMultimediaSource::CustomInterface( TUid /*aInterfaceUid*/ ) - { - return NULL; - } - -TInt CProgDLMultimediaSource::AppendBufferToSinkQueue( CMMFBuffer* aBuffer, - MMultimediaDataSourceObserver* aObserver, - MDataSink* aConsumer,TBool aTop ) - { - TInt status(KErrNone); - - DEBPRN2(_L("CProgDLMultimediaSource::AppendBufferToSinkQueue() Buffer[%x]"), aBuffer ); - // Add observer buffer to queue - CMMFDataBuffer* dest = static_cast( aBuffer ); - TDes8& destBufferDes = dest->Data(); - - CSinkQueueItem* request(NULL); - - TRAP( status, request = CSinkQueueItem::NewL( aBuffer, aObserver,aConsumer) ); - if ( status == KErrNone ) - { - if(aTop) - iSinkQueue->AddFirst(*request); - else - iSinkQueue->AddLast(*request); - - iSnkItemsCount++; - - DEBPRN3(_L("CProgDLMultimediaSource::AppendBufferToQueue[ReqSize[%d]SnkItems[%d]]"), \ - aBuffer->RequestSize(), iSnkItemsCount ); - } - return status; - } - -void CProgDLMultimediaSource::SourceCustomCommand(TMMFMessage& aMessage) - { - TInt err(KErrNone); - switch ( aMessage.Function() ) - { - - case ESetUpdateFileName: - { - // Read size info - TPckgBuf sizePckg; - err = aMessage.ReadData1FromClient(sizePckg); - if ( err == KErrNone ) - { - iFullFileName = sizePckg(); - } - aMessage.Complete(KErrNone); - - } - break; - - case EDownloadRate: - { - - // Read size info - TPckgBuf sizePckg; - err = aMessage.ReadData1FromClient(sizePckg); - if ( err == KErrNone ) - { - iTransferRate = sizePckg(); - } - aMessage.Complete(KErrNone); - DEBPRN2(_L("CProgDLMultimediaSource::SourceCustomCommand EDownloadRate[%u] "),iTransferRate); - if(iState == EBUFFERING /*&& !iSinkQueue->IsEmpty()*/) - { - CalculateBufferedDataSize(); - } - } - break; - case ESetDownloadState: - { - isDownloadComplete = ETrue; - if(iFile) - iFile->Size(iFileSize); - - if(iFileSize != iDLFileSize) - iDLFileSize = iFileSize; - - iDownloadSize = iFileSize; - iBufferedDataSize = 0; - aMessage.Complete(KErrNone); - - if(iObserver) - iObserver->Event(KMultimediaDataSourceEventRandomSeekingSupportChanged); - - if(iState == EBUFFERING ) - { - if((iDownloadSize - iSnkBytes) > iBufferedDataSize) - { - StateChanged(EEXECUTING); - while ( !iSinkQueue->IsEmpty() ) - { - err = ServiceFillBuffer(); - if(err == KErrUnderflow) - { - StateChanged(EBUFFERING); - break; - } - } - } - } - } - break; - - case ESetDownloadSize: - { - // Read size info - TPckgBuf sizePckg; - err = aMessage.ReadData1FromClient(sizePckg); - if ( err == KErrNone ) - { - iDownloadSize = sizePckg(); - } - aMessage.Complete(KErrNone); - TInt size = 0; - - if(iFile) - iFile->Size(size); - - DEBPRN4(_L("CProgDLMultimediaSource::SourceCustomCommand ********BufferedDataSize[%u] DownloadSize[%d] iSnkbytes[%d]"), iBufferedDataSize ,iDownloadSize, iSnkBytes ); - DEBPRN4(_L("CProgDLMultimediaSource::SourceCustomCommand ********iDLFileSize[%d] iFileSize[%d]ActualSize[%d]"), iDLFileSize,iFileSize,size); - if(iState == EBUFFERING ) - { - if((iDownloadSize - iSnkBytes) > iBufferedDataSize) - { - StateChanged(EEXECUTING); - while ( !iSinkQueue->IsEmpty() ) - { - err = ServiceFillBuffer(); - if(err == KErrUnderflow) - { - StateChanged(EBUFFERING); - break; - } - } - } - } - } - break; - - case ESetActualSize: - { - // Read size info - TPckgBuf sizePckg; - err = aMessage.ReadData1FromClient(sizePckg); - if ( err == KErrNone ) - { - iDLFileSize = sizePckg(); - } - aMessage.Complete(KErrNone); - - if(iFile) - { - if(iFile->IsProtected()) - iFile->Size(iFileSize); - else - iFileSize = iDLFileSize; - } - DEBPRN3(_L("CProgDLMultimediaSource::SourceCustomCommand ActualSize********iDLFileSize[%d] iFileSize[%d]"), iDLFileSize,iFileSize); - - if(iObserver) - iObserver->Event(KMultimediaDataSourceObserverEventSourceSizeChanged); - - } - break; - - case EGetSourceState: - { - TPckgBuf statePckg; - aMessage.ReadData1FromClient(statePckg); - DEBPRN3(_L("CProgDLMultimediaSource::SourceCustomCommand() Client State[%d] SourceState[%d]"), statePckg(), iState); - - if(iState != statePckg()) - { - statePckg() = iState; - aMessage.WriteDataToClient(statePckg); - aMessage.Complete(KErrNone); - } - else - iMessage = new(ELeave) TMMFMessage(aMessage); - } - break; - - case EGetBitRate: - { - TPckgBuf bitRatePckg; - DEBPRN2(_L("CProgDLMultimediaSource::SourceCustomCommand() Client BitRateFromS[%d]"),iObserverBitRate); - bitRatePckg() = iObserverBitRate ; - aMessage.WriteDataToClient(bitRatePckg); - aMessage.Complete(KErrNone); - } - break; - - case EGetPercentageBuffered: - { - TPckgBuf perBufPckg; - TUint perBuf = 0; - if(iState == EBUFFERING && iBufferedDataSize != 0) - { - CalculateBufferedDataSize(); - if ( iBufferedDataSize == 0 ) - { - perBuf = 0; - } - else - { - perBuf = (iDownloadSize - iSnkBytes) * 100 / iBufferedDataSize; - } - } - - RDebug::Print(_L(" Percentage Buffered [%d]"),perBuf); - perBufPckg() = perBuf; - aMessage.WriteDataToClient(perBufPckg); - aMessage.Complete(KErrNone); - } - break; - - default: - err = KErrArgument; - break; - } - } - -TInt CProgDLMultimediaSource::ServiceFillBuffer() - { - - DEBPRN3(_L("CProgDLMultimediaSource::ServiceFillBuffer() state[%d] Download Size[%d]"), iState ,iDownloadSize ); - - TInt status(KErrNone); - if ( iSinkQueue->IsEmpty() ) - return KErrNone; - - CSinkQueueItem* tempsnkItem = iSinkQueue->First(); - CMMFBuffer* tempbuffer = tempsnkItem->Buffer(); - - TInt bufSize = tempbuffer->RequestSize(); - - DEBPRN5(_L("CProgDLMultimediaSource::ServiceFillBuffer() ********BufferedDataSize[%u] DownloadSize[%d] iSnkbytes[%d] BufSize[%d]"), iBufferedDataSize ,iDownloadSize, iSnkBytes,bufSize ); - if((((iDownloadSize - iSnkBytes) > bufSize) && - iState == EEXECUTING && - iDownloadSize > iBufferedDataSize && ((iReadRequestPending + 1)*bufSize < (iDownloadSize - iSnkBytes))) || (iFileSize == iDownloadSize)) - { - iReadRequestPending++; - CSinkQueueItem* snkItem = iSinkQueue->First(); - iSinkQueue->Remove(*snkItem); - iSnkItemsCount--; - CMMFBuffer* buffer = snkItem->Buffer(); - DEBPRN2(_L("CProgDLMultimediaSource::ServiceFillBuffer() Buffer[%x]"), buffer ); - MMultimediaDataSourceObserver* observer = snkItem->Observer(); - MDataSink* consumer = snkItem->Consumer(); - delete snkItem; - - if (CMMFBuffer::IsSupportedDataBuffer(buffer->Type())) - { - CTransferBufferCopy* transBufCopy = NULL; - CReadRequest* request = NULL; - - TDes8& bufferDes = STATIC_CAST( CMMFDataBuffer*, buffer )->Data(); - - TInt requestSize; - if(buffer->RequestSize()) - requestSize = buffer->RequestSize(); - else - requestSize = bufferDes.MaxLength(); - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if (!CMMFBuffer::IsFileServerSafe(buffer->Type())) - { - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - TRAP(status,transBufCopy = ObtainCopyOfTransferBufferL(bufferDes.MaxLength())); - - if(consumer && !observer) - request = new(ELeave) CReadRequest(this,STATIC_CAST(TAny*, consumer), buffer, transBufCopy, iSnkBytes, iDownloadSize, ETrue); - else - request = new(ELeave) CReadRequest(this,STATIC_CAST(TAny*, observer), buffer, transBufCopy, iSnkBytes, iDownloadSize, EFalse); - - } - else - { - if(consumer && !observer) - request = new(ELeave) CReadRequest(this,STATIC_CAST(TAny*, consumer), buffer, iSnkBytes, iDownloadSize, ETrue); - else - request = new(ELeave) CReadRequest(this,STATIC_CAST(TAny*, observer), buffer, iSnkBytes, iDownloadSize, EFalse); - } - - CleanupStack::PushL( request ); - - TRAP_IGNORE(StoreRequestL(request)); // transfers ownership - CleanupStack::Pop() ; // request - - request->SetActive(); - - // iSnkBytes += requestSize; - - if ((iSnkBytes + request->Buffer()->RequestSize()) >= iDownloadSize && isDownloadComplete) - { - request->Buffer()->SetLastBuffer(ETrue); - DEBPRN1(_L("CProgDLMultimediaSource::ServiceFillBuffer() LastBuffer$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$")); - } - - iFile->Read(request->BufferDes(), requestSize, request->iStatus); - - } - else // if (CMMFBuffer::IsSupportedDataBuffer(buffer->Type())) - return KErrNotSupported; - } - /*else if(iDownloadSize == iSnkBytes) - { - Stop(); - }*/ - else - { - - //StateChanged(EBUFFERING); - return KErrUnderflow; - } - return status; - } - -TInt CProgDLMultimediaSource::EmptySinkQueue() - { - TInt status(KErrNone); - // Empty sink queue - CSinkQueueItem* snkItem; - while ( !iSinkQueue->IsEmpty() ) - { - snkItem = iSinkQueue->First(); - iSinkQueue->Remove(*snkItem); - delete snkItem; - } - - iSnkItemsCount = 0; - return status; - } - -void CProgDLMultimediaSource::CalculateBufferedDataSize() - { - DEBPRN1(_L("CProgDLMultimediaSource::CalculateBufferedDataSize()")); - iBufferedDataSize = 0; - - // Get the bit rate from observer - if(iObserver) - iObserver->GetBitRate( iObserverBitRate ); - - // If we don't know observer bit rate - if(iDownloadSize == iDLFileSize) - { - iBufferedDataSize = 0; - return; - } - - if(iObserverBitRate == 0 && (iSinkQueue->First() != NULL)) - { - if(iPrimaryBufferingConfig.iType == TBufferingConfig::FIXEDDURATION - || iPrimaryBufferingConfig.iType == TBufferingConfig::DYNAMICDURATION) - { - if(iSecondaryBufferingConfig.iType == TBufferingConfig::FIXEDDURATION - || iSecondaryBufferingConfig.iType == TBufferingConfig::DYNAMICDURATION) - { - iBufferedDataSize = iDLFileSize * iInitialBufferingPercentage / 100; - } - else - { - if(iDLFileSize < iSecondaryBufferingConfig.iAmount) - { - iBufferedDataSize = iDLFileSize; - } - else - { - iBufferedDataSize = iSecondaryBufferingConfig.iAmount; - } - } - } - else - { - if(iDLFileSize < iPrimaryBufferingConfig.iAmount) - { - iBufferedDataSize = iDLFileSize; - } - else - { - iBufferedDataSize = iPrimaryBufferingConfig.iAmount; - } - } - - } - else - { - if(iPrimaryBufferingConfig.iType == TBufferingConfig::FIXEDDURATION - || iPrimaryBufferingConfig.iType == TBufferingConfig::DYNAMICDURATION) - { - TUint constantC = KMinPlaybackDuration * iObserverBitRate / 8; - - // calculate time remaining - //TInt64 timeRemaining = ( iDLFileSize - iSnkBytes ) * 8 / iObserverBitRate; - TUint bytesRemaining = iDLFileSize - iSnkBytes; - iBufferedDataSize = bytesRemaining < constantC ? bytesRemaining : constantC; - -// timeRemaining = timeRemaining < 0 ? 0 : timeRemaining; - - // calculate the value in a temporary variable -// TInt64 bufferedDataSize = ((TInt64(iObserverBitRate)) - (TInt64(iTransferRate))) * timeRemaining / 8; -// bufferedDataSize = bufferedDataSize < constantC ? bufferedDataSize : constantC; - -// iBufferedDataSize = bufferedDataSize > KMaxTUint ? KMaxTUint : I64LOW(bufferedDataSize); - } - else - { - iBufferedDataSize = iPrimaryBufferingConfig.iAmount; - } - } - - DEBPRN5(_L("CProgDLMultimediaSource::CalculateBufferdDataSize[%u] ObserverBitRate[%d] SnkBytes[%u] TransferRate[%d]"), iBufferedDataSize,iObserverBitRate,iSnkBytes,iTransferRate ); - } - -void CProgDLMultimediaSource::StateChanged(TState newState) - { - DEBPRN3(_L("CProgDLMultimediaSource::StateChanged OLD[%d] NEW[%d]"),iState, newState); - if(iState != newState) - { - if(iMessage) - { - if(!iMessage->IsCompleted()) - { - TPckgBuf statePckg(newState); - iMessage->WriteDataToClient(statePckg); - iMessage->Complete(KErrNone); - delete iMessage; - iMessage = NULL; - } - } - iState = newState; - } - } - -TInt CProgDLMultimediaSource::ReadRequestStatus(CReadWriteRequest* aRequest, TRequestStatus& aStatus) - { - - if(aStatus != KErrNone) - { - TMMFEvent event(KMMFErrorCategoryControllerGeneralError, aStatus.Int()); - iEventHandler->SendEventToClient(event); - return KErrNone; - } - else - { - - DEBPRN4(_L("CProgDLMultimediaSource::ReadRequestStatus Buffer[%x] BufferSize[%d] RequestSize[%d]"),aRequest->Buffer(),aRequest->Buffer()->BufferSize(),aRequest->Buffer()->RequestSize()); - DEBPRN3(_L("CProgDLMultimediaSource::ReadRequestStatus Buffer[%x] LastBuffer[%d]"),aRequest->Buffer(),aRequest->Buffer()->LastBuffer()); - - TBool lastBuffer = aRequest->Buffer()->LastBuffer(); - - if((aRequest->Buffer()->BufferSize() != aRequest->Buffer()->RequestSize()) && !lastBuffer) - { - if(aRequest->SourceType()) - { - MDataSink* sinkOrSource = REINTERPRET_CAST(MDataSink*,aRequest->GetSinkOrSource()); - TUint position = aRequest->Buffer()->Position(); - TUint newPos = position - aRequest->Buffer()->BufferSize(); - aRequest->Buffer()->SetPosition(newPos); - AppendBufferToSinkQueue(aRequest->Buffer(),(MMultimediaDataSourceObserver*)NULL,sinkOrSource,ETrue); - //iSnkBytes -= aRequest->Buffer()->BufferSize(); - iFile->Seek(ESeekStart,iSnkBytes); - StateChanged(EBUFFERING); - } - else - { - MMultimediaDataSourceObserver* sinkOrSource = REINTERPRET_CAST(MMultimediaDataSourceObserver*,aRequest->GetSinkOrSource()); - TInt position = aRequest->Buffer()->Position(); - TInt newPos = position - aRequest->Buffer()->BufferSize(); - aRequest->Buffer()->SetPosition(newPos); - AppendBufferToSinkQueue(aRequest->Buffer(),sinkOrSource,(MDataSink*)NULL,ETrue); - //iSnkBytes -= aRequest->Buffer()->BufferSize(); - iFile->Seek(ESeekStart,iSnkBytes); - StateChanged(EBUFFERING); - } - } - else - { - iSnkBytes += aRequest->Buffer()->BufferSize(); - - - if(aRequest->SourceType()) - REINTERPRET_CAST(MDataSink*, aRequest->GetSinkOrSource())->BufferFilledL(aRequest->Buffer()) ; // callback to MDataSource/Sink - else - REINTERPRET_CAST(MMultimediaDataSourceObserver*, aRequest->GetSinkOrSource())->BufferFilled(aRequest->Buffer()) ; // callback to MDataSource/Sink - - - } - - iReadRequestPending--; - DEBPRN4(_L("CProgDLMultimediaSource::ReadRequestStatus iReadRequestPending[%d] isDownloadComplete[%d] iReOpenCAF[%d]"),iReadRequestPending,isDownloadComplete,iReOpenCAF); - if(!iReadRequestPending && isDownloadComplete && !iReOpenCAF) - { - ReOpenCAF(); - while ( !iSinkQueue->IsEmpty() ) - { - TInt err = ServiceFillBuffer(); - if(err == KErrUnderflow) - { - StateChanged(EBUFFERING); - break; - } - } - } - - aRequest->SetStatus(ETrue); - return KErrNone; - } - } - - -TInt CProgDLMultimediaSource::ReOpenCAF() - { - TInt status(KErrNone); - DEBPRN2(_L("CProgDLMultimediaSource::StateChanged ReOpenCAF[%d]"),iSnkBytes); - delete iFile; - iFile = NULL; - - if (!iFile) - { - if (iFileHandle) - { - TRAPD(status,iFile = CContentFile::NewL(iHandle, UniqueId(), iCAFParameters->iEnableUI)); - if(status) - return status; - } - else - { - // Open for read-only access - TRAPD(status,iFile = CContentFile::NewL(iFsSession, iFullFileName, UniqueId(), EFileShareAny, iCAFParameters->iEnableUI)); - if(status) - return status; - } - - if(!status) - iFile->Seek(ESeekCurrent,iSnkBytes); - } - - if(iFile) - { - if(iFile->IsProtected()) - { - iFile->Size(iFileSize); - iDownloadSize = iFileSize; - iDLFileSize = iFileSize; - - if(iObserver) - { - iObserver->Event(KMultimediaDataSourceObserverEventSourceSizeChanged); - } - } - else - { - iFileSize = iDLFileSize; - } - } - - iReOpenCAF = ETrue; - DEBPRN3(_L("CProgDLMultimediaSource::StateChanged Exit status[%d] iFileSize[%d]"),status,iFileSize); - return status; - } - -void CProgDLMultimediaSource::GetAudioConfiguration() - { - TInt bufType = 0; - TInt bufAmount = 0; - TInt bufPer = 0; - - iAudioConfigRepository->Get(KPDLPrimaryBufferingType,bufType); - iAudioConfigRepository->Get(KPDLPrimaryBufferingAmount,bufAmount); - - iPrimaryBufferingConfig.iType = TBufferingConfig::TBufferingType(bufType); - iPrimaryBufferingConfig.iAmount = bufAmount; - - iAudioConfigRepository->Get(KPDLSecondaryBufferingType,bufType); - iAudioConfigRepository->Get(KPDLSecondaryBufferingAmount,bufAmount); - - iSecondaryBufferingConfig.iType = TBufferingConfig::TBufferingType(bufType); - iSecondaryBufferingConfig.iAmount = bufAmount; - - iAudioConfigRepository->Get(KPDLInitialBufferingPercentage,bufPer); - iInitialBufferingPercentage = bufPer; - } - -TInt CProgDLMultimediaSource::Seek(TUint aPosInBytes) - { - DEBPRN2(_L("CProgDLMultimediaSource::Seek[%d]]"), aPosInBytes ); - TInt status(KErrNone); - if(aPosInBytes <= iFileSize) - { - iSnkBytes = aPosInBytes; - status = iFile->Seek(ESeekStart,iSnkBytes); - } - else - { - status = KErrNotReady; - } - return status; - } - -TInt CProgDLMultimediaSource::GetSeekingSupport( TBool& aSeekSupport ) - { - aSeekSupport = ETrue; - return KErrNone; - } - -TInt CProgDLMultimediaSource::GetRandomSeekingSupport( TBool& aSeekSupport ) - { - aSeekSupport = ETrue; - return KErrNone; - } -//End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/SinkQueueItem.cpp --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/SinkQueueItem.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of ProgDL Source Reader active object. -* -*/ - - - -// INCLUDE FILES -#ifdef _DEBUG -#include -#endif - -#include "SinkQueueItem.h" -#include -#include -#include - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CSinkQueueItem::CSinkQueueItem -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CSinkQueueItem::CSinkQueueItem( - CMMFBuffer* aBuffer, - MMultimediaDataSourceObserver* aMMDSObserver, - MDataSink* aConsumer ) - :iBuffer(aBuffer), - iMMDSObserver(aMMDSObserver), - iConsumer(aConsumer) - { - } - -// ----------------------------------------------------------------------------- -// CSinkQueueItem::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CSinkQueueItem::ConstructL() - { - } - -// ----------------------------------------------------------------------------- -// CSinkQueueItem::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -CSinkQueueItem* CSinkQueueItem::NewL( - CMMFBuffer* aBuffer, - MMultimediaDataSourceObserver* aMMDSObserver, - MDataSink* aConsumer ) - { - CSinkQueueItem* self = new(ELeave) CSinkQueueItem( aBuffer, aMMDSObserver, aConsumer ); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - - -// ----------------------------------------------------------------------------- -// CSinkQueueItem::~CSinkQueueItem -// Destructor -// ----------------------------------------------------------------------------- -// -CSinkQueueItem::~CSinkQueueItem() - { - } - -CMMFDataBuffer* CSinkQueueItem::Buffer() - { - return static_cast(iBuffer); - } - -MMultimediaDataSourceObserver* CSinkQueueItem::Observer() - { - return iMMDSObserver; - } - -MDataSink* CSinkQueueItem::Consumer() - { - return iConsumer; - } - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/SinkQueueItem.h --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/SinkQueueItem.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Definition of the ProgDL source reader active object class -* -*/ - - -#ifndef SINKQUEUEITEM_H -#define SINKQUEUEITEM_H - -// INCLUDES -#include - -class CMMFBuffer; -class CMMFDataBuffer; -class MMultimediaDataSourceObserver; -class MDataSink; - -class CSinkQueueItem : public CBase - { - public: // Constructors and destructor - static CSinkQueueItem* NewL( - CMMFBuffer* aBuffer, - MMultimediaDataSourceObserver* aMMDSObserver, - MDataSink* aConsumer ); - virtual ~CSinkQueueItem(); - - CMMFDataBuffer* Buffer(); - MMultimediaDataSourceObserver* Observer(); - // This exists for legacy support - MDataSink* Consumer(); - - private: - CSinkQueueItem( - CMMFBuffer* aBuffer, - MMultimediaDataSourceObserver* aMMDSObserver, - MDataSink* aConsumer ); - void ConstructL(); - - public: - // next item - TSglQueLink* iLink; - - private: - // Buffer to be sent to server-side - CMMFBuffer* iBuffer; - // Reference to Multimedia data source observer - MMultimediaDataSourceObserver* iMMDSObserver; - // Reference to MDataSink - MDataSink* iConsumer; - }; - -#endif // SINKQUEUEITEM_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/fileaccess.cpp --- a/mmfenh/enhancedmediaclient/Plugins/ProgDLSource/src/fileaccess.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,303 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of FileAccess Classes. -* -*/ - -#include -#include -#include -#include -#include -#include -using namespace ContentAccess; -#include - -#include "FileAccess.h" - -CF32File::~CF32File() - { - if (!iFileHandle) - iFile.Close(); - delete iFilePath; - } - -CF32File* CF32File::NewL(RFs& aSession, TDesC& aFilePath, TUint aMode) - { - CF32File* self = new (ELeave) CF32File; - CleanupStack::PushL(self); - self->ConstructL(aSession, aFilePath, aMode); - CleanupStack::Pop(self); - return self; - } - - -void CF32File::ConstructL(RFs& aSession, TDesC& aPath, TUint aFileMode) - { - iSession = &aSession; - iFilePath = aPath.AllocL(); - TUint attributes = 0; - TInt err = iSession->Att(*iFilePath, attributes); - if (err == KErrNone) - { - if ( attributes & KEntryAttReadOnly ) - User::LeaveIfError(iFile.Open(*iSession, *iFilePath, EFileShareReadersOnly )) ; - else //if ( !( attributes & KEntryAttReadOnly ) ) - User::LeaveIfError(iFile.Open(*iSession, *iFilePath, aFileMode)) ; - } - else if ((err == KErrNotFound) && (aFileMode & EFileWrite)) - { - User::LeaveIfError(iFile.Create(*iSession, *iFilePath, aFileMode )) ; - } - else - { - User::Leave(err); - } - } - - -RFile& CF32File::FileL() - { - return iFile; - } - -TInt CF32File::Seek(TSeek aSeekMode, TInt aPos) - { - return iFile.Seek(aSeekMode, aPos); - } - -TInt CF32File::Read(TDes8& aDes,TInt aLength) - { - return iFile.Read(aDes, aLength); - } - -void CF32File::Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) - { - iFile.Read(aDes, aLength, aStatus); - } - -TInt CF32File::Write(const TDesC8& aDes,TInt aLength) - { - return iFile.Write(aDes, aLength); - } - -void CF32File::Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus) - { - iFile.Write(aDes, aLength, aStatus); - } - -TInt CF32File::Size(TInt& aSize) - { - return iFile.Size(aSize); - } - -TInt CF32File::SetSize(TInt aSize) - { - TInt err = iFile.SetSize(aSize); - if(err == KErrNone) - iFileSize = aSize; - else - iFileSize = -1; - - return err; - } - -TInt CF32File::EvaluateIntent(TIntent /*aIntent*/) const - { - return KErrNone; - } - - -TInt CF32File::ExecuteIntent(TIntent /*aIntent*/) - { - return KErrNone; - } - -TBool CF32File::IsProtected() const - { - return EFalse; - } - -TInt CF32File::SetAgentProperty(TAgentProperty /*aProperty*/, TInt /*aValue*/) - { - // not an error to set this if not supported, just wont do anything - return KErrNone; - } - -CContentFile::~CContentFile() - { - delete iData; - - if (iLegacyFileOpen) - iLegacyFile.Close(); - delete iFilePath; - } - - -CContentFile* CContentFile::NewL(RFs& aSession, const TDesC& aFilePath, const TDesC& aUniqueId, TUint aMode, TBool aEnableUI) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aSession, aFilePath, aUniqueId, aMode, aEnableUI); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint /*aMode*/, TBool aEnableUI) - { - iSession = &aSession; - iFilePath = aPath.AllocL(); - - // Assume that we want the content to be shared and read-only. - if (aUniqueId.Length() > 0) - { - iData = CData::NewL(TVirtualPathPtr(*iFilePath, aUniqueId), EContentShareReadWrite); - } - else - { - iData = CData::NewL(TVirtualPathPtr(*iFilePath), EContentShareReadWrite); - } - - TInt err = iData->SetProperty(EAgentPropertyAgentUI, aEnableUI); - if (err != KErrNone && err != KErrCANotSupported) - { - User::Leave(err); - } - User::LeaveIfError(iData->EvaluateIntent(EPeek)); - } - - - -TInt CContentFile::EvaluateIntent(TIntent aIntent) const - { - ASSERT(iData); - return iData->EvaluateIntent(aIntent); - } - - -TInt CContentFile::ExecuteIntent(TIntent aIntent) - { - ASSERT(iData); - return iData->ExecuteIntent(aIntent); - } - -TBool CContentFile::IsProtected() const - { - ASSERT(iData); - TInt value = 0; - TInt err =iData->GetAttribute(EIsProtected, value); - return (err == KErrNone && value); - } - -TInt CContentFile::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) - { - ASSERT(iData); - return iData->SetProperty(aProperty, aValue); - } - -TInt CContentFile::Seek(TSeek aSeekMode, TInt aPos) - { - ASSERT(iData); - return iData->Seek(aSeekMode, aPos); - } - -TInt CContentFile::Read(TDes8& aDes,TInt aLength) - { - ASSERT(iData); - return iData->Read(aDes,aLength); - } - -void CContentFile::Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) - { - ASSERT(iData); - iData->Read(aDes, aLength, aStatus); - } - -TInt CContentFile::Write(const TDesC8& /*aDes*/,TInt /*aLength*/) - { - return KErrAccessDenied; - } -void CContentFile::Write(const TDesC8& /*aDes*/, TInt /*aLength*/, TRequestStatus& aStatus) - { - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrAccessDenied); - } - -TInt CContentFile::SetSize(TInt /*aSize*/) - { - // Only a source is implemented, hence this cannot be allowed - return KErrAccessDenied; - } - - -// Get the size of file -// this method opens a new, read-only, RFile the first time this method is called - -TInt CContentFile::Size(TInt& aSize) - { - ASSERT(iData); - TRAPD(err, iData->DataSizeL(aSize)); - return err; - } - - /** - * return a RFile for the legacy RFile method - * this method opens a new, read-only, RFile the first time this method is called - * @internalTechnology - * @return Reference to RFile handle to current file -*/ -RFile& CContentFile::FileL() - { - if (!iLegacyFileOpen) - { - User::LeaveIfError(iLegacyFile.Open(*iSession, *iFilePath, EFileRead | EFileStream | EFileShareReadersOnly)); - iLegacyFileOpen = ETrue; - } - return iLegacyFile; - } - -CF32File* CF32File::NewL(RFile& aFile) - { - CF32File* self = new (ELeave) CF32File; - CleanupStack::PushL(self); - self->ConstructL(aFile); - CleanupStack::Pop(self); - return self; - } - -void CF32File::ConstructL(RFile& aFile) - { - iFile = aFile; - iFileHandle = ETrue; - } - -CContentFile* CContentFile::NewL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aFile, aUniqueId, aEnableUI); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI) - { - iData = CData::NewL(aFile, aUniqueId); - TInt err = iData->SetProperty(EAgentPropertyAgentUI, aEnableUI); - if (err != KErrNone && err != KErrCANotSupported) - { - User::Leave(err); - } - User::LeaveIfError(iData->EvaluateIntent(EPeek)); - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/BWINS/TransferRateMonitor.def --- a/mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/BWINS/TransferRateMonitor.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,9 +0,0 @@ -EXPORTS - ??1CTransferRateMonitor@@UAE@XZ @ 1 NONAME ; CTransferRateMonitor::~CTransferRateMonitor(void) - ?NewL@CTransferRateMonitor@@SAPAV1@AAVMTransferRateObserver@@II@Z @ 2 NONAME ; class CTransferRateMonitor * CTransferRateMonitor::NewL(class MTransferRateObserver &, unsigned int, unsigned int) - ?Reset@CTransferRateMonitor@@QAEHXZ @ 3 NONAME ; int CTransferRateMonitor::Reset(void) - ?Start@CTransferRateMonitor@@QAEHXZ @ 4 NONAME ; int CTransferRateMonitor::Start(void) - ?Stop@CTransferRateMonitor@@QAEXXZ @ 5 NONAME ; void CTransferRateMonitor::Stop(void) - ?Tick@CTransferRateMonitor@@CAHPAX@Z @ 6 NONAME ; int CTransferRateMonitor::Tick(void *) - ?TransferRate@CTransferRateMonitor@@QAEIXZ @ 7 NONAME ; unsigned int CTransferRateMonitor::TransferRate(void) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/EABI/TransferRateMonitor.def --- a/mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/EABI/TransferRateMonitor.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,13 +0,0 @@ -EXPORTS - _ZN20CTransferRateMonitor12TransferRateEv @ 1 NONAME - _ZN20CTransferRateMonitor4NewLER21MTransferRateObserverjj @ 2 NONAME - _ZN20CTransferRateMonitor4StopEv @ 3 NONAME - _ZN20CTransferRateMonitor4TickEPv @ 4 NONAME - _ZN20CTransferRateMonitor5ResetEv @ 5 NONAME - _ZN20CTransferRateMonitor5StartEv @ 6 NONAME - _ZN20CTransferRateMonitorD0Ev @ 7 NONAME - _ZN20CTransferRateMonitorD1Ev @ 8 NONAME - _ZN20CTransferRateMonitorD2Ev @ 9 NONAME - _ZTI20CTransferRateMonitor @ 10 NONAME DATA 12 ; ## - _ZTV20CTransferRateMonitor @ 11 NONAME DATA 20 ; ## - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/group/TransferRateMonitor.mmp --- a/mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/group/TransferRateMonitor.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for EnhancedMediaClient Utility -* -*/ - - -#include -#include - -TARGET TransferRateMonitor.dll -TARGETTYPE DLL -UID 0x1000008D 0x10207B4D -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -SOURCEPATH ../src -SOURCE TransferRateMonitor.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE - -LIBRARY euser.lib - -DEFFILE TransferRateMonitor.def -NOSTRICTDEF diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/group/bld.inf --- a/mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,23 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Blf.inf file for the TransferRateMonitor Project -* -*/ - - -PRJ_EXPORTS - - -PRJ_MMPFILES -TransferRateMonitor.mmp diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/inc/TransferRateMonitor.h --- a/mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/inc/TransferRateMonitor.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,75 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for EnhancedMediaClient Utility -* -*/ - - -#ifndef TRANSFERRATEMONITOR_H -#define TRANSFERRATEMONITOR_H - -#include - -class MTransferRateObserver - { - public: - // Called by CTransferRateMonitor when transfer rate changes by delta. - virtual void TransferRateChanged() = 0; - virtual TInt GetCurrentSize( TUint& aCurrentSize ) = 0; - }; - -class CTransferRateMonitor : public CBase - { - public: - IMPORT_C static CTransferRateMonitor* NewL( MTransferRateObserver& aObserver, - TUint aFrequency, - TUint aDelta ) ; - IMPORT_C ~CTransferRateMonitor(); - - // Returns previously calculated transfer rate. - IMPORT_C TUint TransferRate(); - - IMPORT_C TInt Start(); - IMPORT_C void Stop(); - IMPORT_C TInt Reset(); - - private: - CTransferRateMonitor( MTransferRateObserver& aObserver, - TUint aFrequency, - TUint aDelta ) ; - void ConstructL(); - - static TInt Tick(TAny* aObject); - void DoTick(); - - private: - // Pointer reference to observer - MTransferRateObserver* iObserver; - // Frequency in seconds after which timer need to go off - TUint iFrequency; - // Change in transfer rate that will trigger observer callback - TUint iDelta; - // Current transfer rate - TUint iTransferRate; - // Reference transfer rate at which observer callback was triggered - TUint iRefTransferRate; - // Size from last transfer rate calculation - TUint iPrevSize; - // timer - CPeriodic* iPeriodic; - }; - -#endif // TRANSFERRATEMONITOR_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/src/TransferRateMonitor.cpp --- a/mmfenh/enhancedmediaclient/Plugins/TransferRateMonitor/src/TransferRateMonitor.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,113 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for EnhancedMediaClient Utility -* -*/ - - -#include "TransferRateMonitor.h" -#include - -CTransferRateMonitor::CTransferRateMonitor( MTransferRateObserver& aObserver, - TUint aFrequency, - TUint aDelta ) - : iObserver(&aObserver), - iFrequency(aFrequency), - iDelta(aDelta) - { - // Create timer here - } - -EXPORT_C CTransferRateMonitor::~CTransferRateMonitor() - { - if ( iPeriodic ) - { - iPeriodic->Cancel(); - } - delete iPeriodic; - } -EXPORT_C CTransferRateMonitor* CTransferRateMonitor::NewL( MTransferRateObserver& aObserver, - TUint aFrequency, - TUint aDelta ) - { - CTransferRateMonitor* self = new (ELeave)CTransferRateMonitor( aObserver, aFrequency, aDelta ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -void CTransferRateMonitor::ConstructL() - { - iPeriodic = CPeriodic::NewL( CActive::EPriorityStandard ); - } - -EXPORT_C TUint CTransferRateMonitor::TransferRate() - { - return iTransferRate; - } - -EXPORT_C TInt CTransferRateMonitor::Start() - { - TInt status(KErrNotReady); - if ( !iPeriodic->IsActive() ) - { - TTimeIntervalMicroSeconds32 interval( iFrequency * 1000000 ); // Convert to micro seconds - iPeriodic->Start( interval, interval, TCallBack(Tick, this) ); - status = KErrNone; - } - return status; - } - -EXPORT_C void CTransferRateMonitor::Stop() - { - iPeriodic->Cancel(); - } - -EXPORT_C TInt CTransferRateMonitor::Reset() - { - TInt status(KErrNotReady); - if ( !iPeriodic->IsActive() ) - { - iTransferRate = 0; - iRefTransferRate = 0; - iPrevSize = 0; - status = KErrNone; - } - return status; - } - -EXPORT_C TInt CTransferRateMonitor::Tick(TAny* aObject) - { - ((CTransferRateMonitor*)aObject)->DoTick(); - return 1; - } - -void CTransferRateMonitor::DoTick() - { - TUint curSize(0); - if (iObserver->GetCurrentSize(curSize) == KErrNone) - { - iTransferRate = ( curSize - iPrevSize ) * 8 / iFrequency; - iPrevSize = curSize; - TInt diffInTransferRate = Abs ( iTransferRate - iRefTransferRate ); - if ( diffInTransferRate >= iDelta ) - { - iRefTransferRate = iTransferRate; - iObserver->TransferRateChanged(); - } - } - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/Data/Create_ProgressiveDownload_STUB_SIS.bat --- a/mmfenh/progressivedownload/Data/Create_ProgressiveDownload_STUB_SIS.bat Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -rem -rem Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -rem All rights reserved. -rem This component and the accompanying materials are made available -rem under the terms of "Eclipse Public License v1.0" -rem which accompanies this distribution, and is available -rem at the URL "http://www.eclipse.org/legal/epl-v10.html". -rem -rem Initial Contributors: -rem Nokia Corporation - initial contribution. -rem -rem Contributors: -rem -rem Description: batch file for PDU -rem - -makesis -s ProgressiveDownload_Stub.pkg ProgressiveDownload_Stub.sis diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/Data/ProgressiveDownload_Stub.SIS Binary file mmfenh/progressivedownload/Data/ProgressiveDownload_Stub.SIS has changed diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/Data/ProgressiveDownload_Stub.pkg --- a/mmfenh/progressivedownload/Data/ProgressiveDownload_Stub.pkg Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: pkg for PDU -; -;Language -&en - -;Header -# {"Progressive Download"}, (0x10207BC3), 1, 0, 0, TYPE=SA, RU - -;Dependency header - -;Localised Vendor name -%{"Nokia"} - -;Unique Vendor name -:"Nokia" - -;Optional logofile - -;Files to install diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/BWINS/PROGRESSIVEDOWNLOADSOURCE.def --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/BWINS/PROGRESSIVEDOWNLOADSOURCE.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 1 NONAME ; struct TImplementationProxy const * __cdecl ImplementationGroupProxy(int &) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/data/10207a7b.rss --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/data/10207a7b.rss Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,52 +0,0 @@ -/* -* Copyright (c) 1020 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Resource file for ECOM registry for ProgressiveDownloadSource. -* -*/ - - - - - - -#include "ProgressiveDownloadSourceUIDs.hrh" -#include -#include - - -RESOURCE REGISTRY_INFO theInfo - { - dll_uid = 0x10207A7B; //The DLL's 3rd UID. - interfaces = - { - INTERFACE_INFO - { - interface_uid = KMmfUidPluginInterfaceDataSource; //ECOM UID - implementations = - { - // This DLL contains only a single adapter implementation. - IMPLEMENTATION_INFO - { - implementation_uid = KProgressiveDownloadSourceUid; //UID - // Same value as in implementation table. - version_no = 1; - display_name = "ProgressiveDownloadSource"; //Human readable string for UI purposes. - default_data = ""; //Ignored. - opaque_data = ""; //Ignored. - } - }; - } - }; - } - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/group/ProgressiveDownloadSource.mmp --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/group/ProgressiveDownloadSource.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for Progressive Dowload DataSource -* -*/ - - -#include -#include - - -TARGET ProgressiveDownloadSource.dll - -TARGETTYPE PLUGIN - - -UID 0x10009d8d 0x10207A7B - - -CAPABILITY CAP_ECOM_PLUGIN -VENDORID VID_DEFAULT - - - -TARGETPATH /System/Libs/Plugins - - -SOURCEPATH ../src -SOURCE fileaccess.cpp -SOURCE ProgressiveDownloadSource.cpp - -SOURCEPATH ../data - - -START RESOURCE 10207a7b.rss -TARGET ProgressiveDownloadSource.rsc -END - - - -USERINCLUDE ../inc ../src -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/ecom -SYSTEMINCLUDE /epoc32/include/mmf/server -SYSTEMINCLUDE /epoc32/include/mmf/common -SYSTEMINCLUDE /epoc32/include/mmf/plugin - - - -LIBRARY euser.lib -LIBRARY ECom.lib -LIBRARY efsrv.lib -LIBRARY mmfcontrollerframework.lib -LIBRARY estor.lib -LIBRARY mmfserverbaseclasses.lib -LIBRARY caf.lib -LIBRARY cafutils.lib - - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/group/bld.inf --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project build file for ProgressiveDownloadSource -* -*/ - - -PRJ_PLATFORMS -DEFAULT - -PRJ_MMPFILES -progressivedownloadsource.mmp - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/src/FileAccess.h --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/src/FileAccess.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,159 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - -#ifndef __FILE_ACCESS_H__ -#define __FILE_ACCESS_H__ - -#include -#include -#include - -// Abstract class providing generic file access -class MGenericFile - { -public: - virtual ~MGenericFile(); - - virtual TInt Seek(TSeek aSeekMode, TInt aPosition)=0; - virtual TInt Read(TDes8& aDes,TInt aLength)=0; - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus)=0; - - virtual TInt Write(const TDesC8& aDes,TInt aLength)=0; - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus)=0; - - virtual TInt Size(TInt& aSize)=0; - virtual TInt SetSize(TInt aSize)=0; - - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const = 0; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent) = 0; - virtual TBool IsProtected()const = 0; - - // legacy file support - virtual RFile& FileL()=0; - - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) = 0; - - - }; - -// Provide RFile based file access -class CF32File : public CBase, public MGenericFile - { -public: - static CF32File* NewL(RFs& aSession, TDesC& aPath, TUint aMode); - - static CF32File* NewL(RFile& aFile); - void ConstructL(RFile& aFile); - - void ConstructL(RFs& aSession, TDesC& aPath, TUint aMode); - - virtual ~CF32File(); - - // from MGenericFile - virtual TInt Seek(TSeek aSeekMode, TInt aPosition); - virtual TInt Read(TDes8& aDes,TInt aLength); - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Write(const TDesC8& aDes,TInt aLength); - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Size(TInt& aSize); - virtual TInt SetSize(TInt aSize); - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent); - virtual TBool IsProtected() const; - virtual RFile& FileL(); - - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty, TInt aValue); - - -private: - CF32File(); - -private: - RFs* iSession; // not owned - HBufC* iFilePath; - RFile iFile; - - TBool iFileHandle; - TInt iFileSize; - }; - -// Provides content access framework based file access -class CContentFile : public CBase, public MGenericFile - { -public: - - static CContentFile* NewL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint aMode); - void ConstructL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint aMode); - - static CContentFile* NewL(RFs& aSession, const TDesC& aPath, TUint aMode); - void ConstructL(RFs& aSession, const TDesC& aPath, TUint aMode); - - - - static CContentFile* NewL(RFile& aFile, const TDesC& aUniqueId); - void ConstructL(RFile& aFile, const TDesC& aUniqueId); - - - virtual ~CContentFile(); - - // from MGenericFile - virtual TInt Seek(TSeek aSeekMode, TInt aPosition); - virtual TInt Read(TDes8& aDes,TInt aLength); - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Write(const TDesC8& aDes,TInt aLength); - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Size(TInt& aSize); - virtual TInt SetSize(TInt aSize); - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent); - virtual TBool IsProtected() const; - virtual RFile& FileL(); - - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty, TInt aValue); - - -private: - CContentFile(); - - -private: - RFs* iSession; // not owned - HBufC* iFilePath; - ContentAccess::CContent* iContent; - ContentAccess::CData* iData; - - RFile iLegacyFile; - TBool iLegacyFileOpen; - }; - - -inline CF32File::CF32File() - { - } - -inline CContentFile::CContentFile() - { - } - -inline MGenericFile::~MGenericFile() - { - } - -#endif //__FILE_ACCESS_H__ diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/src/MmffilePriv.h --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/src/MmffilePriv.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,188 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - -#ifndef __MMFFILEPRIV_H_ -#define __MMFFILEPRIV_H_ - -#include - -#include -#include - - -/** - * @publishedAll - * - * Represents a copy of a KUidMmfTransferBuffer used for reading/writting to the file server - */ - -class CTransferBufferCopy : public CBase - { -public: - static CTransferBufferCopy* NewL(TInt aMaxLength); - - virtual ~CTransferBufferCopy() - {delete iBuffer;} - - - TDes8& Des() {return iBufferDes;} - - TInt MaxLength() {return iBufferDes.MaxLength();} - - void ReUse(TInt aMaxLength) {iBufferDes.Set(iBuffer,0, Min(aMaxLength, iMaxLength));} - - TBool InUse() {return iInUse;} - - void SetInUse(TBool aInUse) {iInUse=aInUse;} - -private: - CTransferBufferCopy(TInt aMaxLength) : CBase(), iMaxLength(aMaxLength), iBufferDes(0,0,0), iInUse(EFalse){} - - void ConstructL(); - -private: - TUint8* iBuffer; - - //Holds the original MaxLength when class constructed. - //May be larger than MaxLength of iBufferDes - TInt iMaxLength; - - TPtr8 iBufferDes; - - TBool iInUse; - }; - - - - -/** - * @internalComponent - * - * A request is created when an external object requests or supplies data. Calls to the File Server are - * made asynchronously and a CReadWriteRequest created to notify the caller on completion. - * - * CReadWriteRequest is an abstract class. Concrete instances are of CReadRequest & CWriteRequest. - * Concrete instances need to know whether to call MDataSink::BufferFilledL() or MDataSource::BufferEmptiedL() - */ -class CReadWriteRequest : public CActive - { -public: - CReadWriteRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer,MAsyncEventHandler* aEventHandler) - : CActive(EPriorityStandard), - iSinkOrSource(aSinkOrSource), - iBuffer(aBuffer), - iEventHandler(aEventHandler) - { - CActiveScheduler::Add( this ); - } - - CReadWriteRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer, CTransferBufferCopy* aOptionalDataBuffer, MAsyncEventHandler* aEventHandler) - : CActive(EPriorityStandard), - iSinkOrSource(aSinkOrSource), - iBuffer(aBuffer), - iTransferBufferCopy(aOptionalDataBuffer), - iEventHandler(aEventHandler) - { - CActiveScheduler::Add( this ); - iTransferBufferCopy->SetInUse(ETrue); - } - - CReadWriteRequest(CReadWriteRequest& aRequest) - : CActive(EPriorityStandard), - iSinkOrSource(aRequest.iSinkOrSource), - iBuffer(aRequest.iBuffer), - iTransferBufferCopy(aRequest.iTransferBufferCopy), - iEventHandler(aRequest.iEventHandler) - { - CActiveScheduler::Add( this ); - iTransferBufferCopy->SetInUse(ETrue); - } - - - TBool Completed() ; - TDes8& BufferDes() ; - const TDesC8& BufferDesC() ; - - ~CReadWriteRequest() ; - - - // CActive functions. - // - void SetActive() ; - void DoCancel() ; - virtual void RunL() = 0 ; - virtual TInt RunError( TInt aError ) ; - - -protected : - TAny* iSinkOrSource; - CMMFBuffer* iBuffer; - CTransferBufferCopy* iTransferBufferCopy; - - MAsyncEventHandler* iEventHandler; - TBool iCompleted ; - TDes8* iBufferDes ; - TInt iError ; - TBool iUseTransferBuffer ; - void SetTransferBuffer (TBool aTBuffer) ; - TBool CanUseTransferBuffer () ; - } ; - -/** - * @internalComponent - */ -class CReadRequest : public CReadWriteRequest - { -public : - CReadRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer, TUint aPosition, TUint aFileSize, TInt aBytesDownloaded,MAsyncEventHandler* aEventHandler) - : CReadWriteRequest(aSinkOrSource, aBuffer, aEventHandler), - iPosition(aPosition), iFileSize(aFileSize),iBytesDownloaded(aBytesDownloaded) - { } - - CReadRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer, CTransferBufferCopy* aOptionalDataBuffer, TUint aPosition, TUint aFileSize,TInt aBytesDownloaded, MAsyncEventHandler* aEventHandler) - : CReadWriteRequest(aSinkOrSource, aBuffer, aOptionalDataBuffer,aEventHandler), - iPosition(aPosition), iFileSize(aFileSize),iBytesDownloaded(aBytesDownloaded) - { } - - void RunL(); -private: - TUint iPosition; - TUint iFileSize; - TInt iBytesDownloaded; - }; - -/** - * @internalComponent - */ -class CWriteRequest : public CReadWriteRequest - { -public : - CWriteRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer, MAsyncEventHandler* aEventHandler) - : CReadWriteRequest(aSinkOrSource, aBuffer, aEventHandler) - { } - - CWriteRequest(TAny* aSinkOrSource, CMMFBuffer* aBuffer, CTransferBufferCopy* aOptionalDataBuffer, MAsyncEventHandler* aEventHandler) - : CReadWriteRequest(aSinkOrSource, aBuffer, aOptionalDataBuffer, aEventHandler) - { } - - void RunL(); - }; - - -#endif - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/src/ProgressiveDownloadSource.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/src/ProgressiveDownloadSource.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1810 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - -#include -#include -#include -#include -#include -#include -//#include "mmffile.h" - -#include "MmffilePriv.h" -#include "FileAccess.h" - - -#include "ProgressiveDownloadSource.h" -#include - -const TUid KUidProgressiveDlSource = {KProgressiveDownloadSourceUid}; - - -void Panic(TMMFFilePanicCode aPanicCode) - { - _LIT(KMMFFilePanicCategory, "CProgressiveDownloadSource"); - User::Panic(KMMFFilePanicCategory, aPanicCode); - } - - -/** - * Constructs a CTransferBufferCopy - * - * @return CTransferBufferCopy* - */ -CTransferBufferCopy* CTransferBufferCopy::NewL(TInt aMaxLength) - { - CTransferBufferCopy* self = new (ELeave) CTransferBufferCopy(aMaxLength); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -/** - * Second phase constructor for CTransferBufferCopy - * - * @return void - */ -void CTransferBufferCopy::ConstructL() - { - iBuffer = static_cast(User::AllocL(iMaxLength)); - iBufferDes.Set(iBuffer,0,iMaxLength); - } - -/** -Destructor. -*/ -CProgressiveDownloadSource::~CProgressiveDownloadSource() - { - delete iFile; - - iHandle.Close(); - iFsSession.Close(); - delete iFileName; - delete iFileExt; - delete iFilePath; - delete iFileDrive; - delete iMmfFileEventHandler; - delete iUniqueId; - - // Get rid of everything in RArray's & close them. - iRequests.ResetAndDestroy(); - iTransferBufferCopies.ResetAndDestroy(); - } - -/** -Protected constructor. - -The default implementation is empty. -*/ -CProgressiveDownloadSource::CProgressiveDownloadSource() : CMMFClip(KUidProgressiveDlSource/*KUidMmfFileSource*/, KUidMmfFileSink ), iFileSize(-1) - { - iSinkNotStopped = EFalse; - } - -/** -Constructs an CProgressiveDownloadSource MDataSource. - -@return A pointer to the new CProgressiveDownloadSource data source. -*/ -MDataSource* CProgressiveDownloadSource::NewSourceL() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::NewSourceL")); - #endif - CProgressiveDownloadSource* self = new (ELeave) CProgressiveDownloadSource ; - return STATIC_CAST( MDataSource*, self ) ; - } - -/** -Constructs a CProgressiveDownloadSource MDataSink - -@return A pointer to the new CProgressiveDownloadSource data sink. -*/ -MDataSink* CProgressiveDownloadSource::NewSinkL() - { - CProgressiveDownloadSource* self = new (ELeave) CProgressiveDownloadSource ; - return STATIC_CAST( MDataSink*, self ) ; - } - -/** -Perform source construction dependant on the source construction -initialisation data aInitData. - -@param aInitData - The TPckg descriptor package containing the file name and full path. -*/ -void CProgressiveDownloadSource::ConstructSourceL(const TDesC8& aInitData ) - { - ConstructL(aInitData, ESourceMode); - } - -/** -Performs sink construction dependant on the sink construction -initialisation data aInitData. - -@param aInitData - The TPckg descriptor package containing the file name and full path. -*/ -void CProgressiveDownloadSource::ConstructSinkL(const TDesC8& aInitData) - { - ConstructL(aInitData, ESinkMode); - } - -/** -Protected constructor. - -Extracts the initialisation data provided by the calling functions: ConstructSourceL() and -ConstructSourceL(). Creates a file server session and sets up file name. If there is a file name and -it cannot be found this function leaves. If there is no file name the function leaves. Does not -attempt to open the file or check whether the file exists. - -@param aInitData - Initialisation data packaged in a TMMFFileParams. -*/ -void CProgressiveDownloadSource::ConstructL(const TDesC8& aInitData,TMMFileMode aFileMode) - { - User::LeaveIfError(iFsSession.Connect()); -#ifdef __IPC_V2_PRESENT__ - // on IPCv2 we auto attach - User::LeaveIfError(iFsSession.ShareAuto()); -#else - // on IPCv1 - we use explicit - more efficient - User::LeaveIfError(iFsSession.Share(RSessionBase::EExplicitAttach)); -#endif - - - TBool fileInit = EFalse; - HBufC* filename = NULL; - TBool filenamePushed = EFalse; - - - TBool drmContent = EFalse; - RDesReadStream stream(aInitData); - CleanupClosePushL(stream); - - TUid initUid; - - initUid = TUid::Uid(stream.ReadInt32L()); - - if (initUid == KMMFileHandleSourceUid) - { - TPckgBuf fileptr; - stream.ReadL(fileptr); - - iHandle.Duplicate(*fileptr()); - - TInt length; - length = stream.ReadInt32L(); - if (length>0) - { - iUniqueId = HBufC::NewL(length); - TPtr16 ptr = iUniqueId->Des(); - stream.ReadL(ptr, length); - } - iFileHandle = ETrue; - filename = HBufC::NewMaxL(KMaxFileName); - TPtr ptr = filename->Des(); - iHandle.Name(ptr); - fileInit = ETrue; - drmContent = ETrue; - } - - else if (initUid == KMMFileSourceUid) - { - TInt length; - length = stream.ReadInt32L(); - filename = HBufC::NewMaxLC(length); - TPtr ptr = filename->Des(); - stream.ReadL(ptr, length); - - length = stream.ReadInt32L(); - if (length>0) - { - iUniqueId = HBufC::NewMaxL(length); - ptr.Set(iUniqueId->Des()); - stream.ReadL(ptr, length); - } - CleanupStack::Pop(filename); - - fileInit = ETrue; - drmContent = ETrue; - } - else - { -// TODO If the UID is unknown we should reject, but currently -// code also used for older calls that just supply filename. -// User::Leave(KErrNotSupported); - } - - CleanupStack::PopAndDestroy(&stream); - - if (!fileInit && aInitData.Length() == sizeof(TMMFFileHandleParams)) - { - TMMFFileHandleParams params; - TPckgC config(params); - config.Set(aInitData); - params = config(); - - - if (params.iUid == KFileHandleUid) - { - fileInit = ETrue; - User::LeaveIfError(iHandle.Duplicate(*params.iFile)); - TInt pos = 0; - // make sure the duplicate handle is at the start of the file - the usage of the file handle really requires this - User::LeaveIfError(iHandle.Seek(ESeekStart, pos)); - iFileHandle = ETrue; - filename = HBufC::NewMaxLC(KMaxFileName); - filenamePushed = ETrue; - TPtr ptr = filename->Des(); - User::LeaveIfError(iHandle.Name(ptr)); - } - } - - - if (!fileInit) // do old case as last resort - { - TMMFFileParams params; - TPckgC config(params); - config.Set(aInitData); - params = config(); - - filename = params.iPath.AllocL(); - fileInit = ETrue; - } - - if (!filenamePushed) - { - // from now on it is assumed pushed. - CleanupStack::PushL(filename); - } - - TParse parser ; - User::LeaveIfError(parser.Set(*filename, NULL, NULL)); - CleanupStack::PopAndDestroy(filename); - if ( !( parser.NamePresent() ) && !( parser.ExtPresent() ) ) - User::Leave( KErrBadName ) ; - - iFullFileName.Copy( parser.FullName() ) ; - iFileName = parser.Name().AllocL() ; - iFileExt = parser.Ext().AllocL() ; - iFilePath = parser.Path().AllocL() ; - iFileDrive = parser.Drive().AllocL() ; - - - // in order to simulate old behaviour we are not passing error out - // but will try to create Content again during PrimeL() - if (fileInit && drmContent && aFileMode==ESourceMode) - { - TInt contentError; - if (iFileHandle) - { - TRAP(contentError, - iFile = CContentFile::NewL(iHandle, UniqueId()); - ); - } - else - { - // Open for read-only access - //rj progressive download needs shared access - TRAP(contentError, - iFile = CContentFile::NewL(iFsSession, iFullFileName, UniqueId(), EFileShareAny); - ); - } - iFileOpen = (contentError==KErrNone); - } - - (void)(aFileMode=ESourceMode); // prevent from compiler warning - - } - - -/** -@deprecated - -Returns an RFile handle to the current file. - -If there is no current file, one is created. If the file exists then it is opened with read access -if it is read only, write access otherwise. If the file does not exist then it is opened with -write access. - -@leave KErrNotReady - The file is not open. - -@return A handle to the current file. -*/ -RFile& CProgressiveDownloadSource::FileL() - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::FileL")); - #endif - if (!iFile) - User::Leave(KErrNotReady); - if (iFileHandle) - return iHandle; - else - return iFile->FileL(); - - } - -/** -Returns the file name of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The FileName (without extension). -*/ -const TDesC& CProgressiveDownloadSource::FileName() const - { - return *iFileName ; - } - -/** -Returns the extension of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The File Extension. -*/ -const TDesC& CProgressiveDownloadSource::Extension() const - { - return *iFileExt ; - } - -/** -Returns the path of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The FilePath (without filename and extension) -*/ -const TDesC& CProgressiveDownloadSource::FilePath() const - { - return *iFilePath ; - } - -/** -Returns the drive on which the current file is located. - -Note: This will give the wrong answer if the file is renamed! - -@return The FileDrive (drive letter only, without path, filename and extension). -*/ -const TDesC& CProgressiveDownloadSource::FileDrive() const - { - return *iFileDrive ; - } - -/** -Returns the full name of the current file. - -Note: This will give the wrong answer if the file is renamed! - -@return The file name (full filename including drive letter, without path, filename and extension). -*/ -const TFileName CProgressiveDownloadSource::FullName() const - { - return iFullFileName; - } - - -/** -Returns the uniqueID associated with this content. If no uniqueID has been provided, a null -descriptor will be provided - -@return The UniqueID -*/ -const TDesC& CProgressiveDownloadSource::UniqueId() const - { - if (iUniqueId) - return *iUniqueId; - else - return KNullDesC; - } - - - -/** -Deletes the file. - -Closes the currently open file, then deletes it. If the file source is accessing a file handle, -the file is truncated to 0 bytes instead. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgressiveDownloadSource::Delete() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::Delete")); - #endif - if (!iFileHandle) - { - delete iFile; - iFile = NULL; - iFileSize=-1; - iPosition=0; - - return iFsSession.Delete(iFullFileName); - } - else - { - iFileSize=-1; - iPosition=0; - - return iFile->SetSize(0); - } - - } - -/** -Sets the file size. - -@param aSize - The size of the file. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgressiveDownloadSource::SetSize(TInt aSize) - { - #if _DEBUG - RDebug::Print(_L("[%x]CProgressiveDownloadSource::SetSize to %d"),this,aSize); - #endif - - iFix = aSize; - - if ( !iFile ) - return KErrNotReady; - - TInt err = iFile->SetSize(aSize); - if(err == KErrNone) - iFileSize = aSize; - else - iFileSize = -1; - - return err; - } - -/** -Obtains a CTransferBufferCopy from iTransferBufferCopies that is -at least as big as that required. - -There is no need to put the pointer returned by this method onto the CleanupStack -as it will have already been placed into iTransferBufferCopies. - -@param aMaxLength - The size required. - -@return A pointer to a valid CTransferBufferCopy. -*/ -CTransferBufferCopy* CProgressiveDownloadSource::ObtainCopyOfTransferBufferL(TInt aMaxLength) - { - //find a free transfer buffer copy of the right size - TInt firstFree = -1; - CTransferBufferCopy* transBufCopyToUse = NULL; - - for(TInt cnt=0; cnt < iTransferBufferCopies.Count(); cnt++) - { - if(!iTransferBufferCopies[cnt]->InUse()) - { - //record the first free entry, we may remove this - //if entries in iTransferBufferCopies > KAcceptableTransferBufferCopiesSize - if(firstFree == -1) - firstFree = cnt; - - if(iTransferBufferCopies[cnt]->MaxLength() >= aMaxLength) - { - transBufCopyToUse = iTransferBufferCopies[cnt]; - - //Set the MaxLength. This will ensure that the copy acts the same as - //the original Transfer buffer, eg. file server will throw KErrOverflow - transBufCopyToUse->ReUse(aMaxLength); - break; - } - } - } - - //If we failed to find a suitable entry, we need to create a new one - if(!transBufCopyToUse) - { - //Firstly, should we re-cycle an existing entry? - //There must be entries in the array, a free entry must have been found, - //the size of the array must be beyond the water mark where we want to start - //cycling free entries. - if((iTransferBufferCopies.Count() > 0) && - (firstFree != -1) && - (iTransferBufferCopies.Count() > KAcceptableTransferBufferCopiesSize)) - { - delete iTransferBufferCopies[firstFree]; - iTransferBufferCopies.Remove(firstFree); - - transBufCopyToUse = CTransferBufferCopy::NewL(aMaxLength); - CleanupStack::PushL(transBufCopyToUse); - User::LeaveIfError(iTransferBufferCopies.Insert(transBufCopyToUse,firstFree)); - - CleanupStack::Pop(); - } - else - { -#ifdef _DEBUG - if(iTransferBufferCopies.Count() > KMaximumTransferBufferCopiesSize) - { - User::Panic(_L("iTransferBufferCopies grew too large in CProgressiveDownloadSource"),KErrTooBig); - } -#endif - - transBufCopyToUse = CTransferBufferCopy::NewL(aMaxLength); - CleanupStack::PushL(transBufCopyToUse); - User::LeaveIfError(iTransferBufferCopies.Append(transBufCopyToUse)); - - CleanupStack::Pop(); - } - } - - return transBufCopyToUse; - } - - - -/** -Loads aBuffer from iFile. - -The file must already be open for reading. File read is asynchronous. CReadRequest is created to -respond to completion. - -@param aBuffer - The buffer to be filled from the file. -@param aConsumer - The data sink consumer of the buffer. -*/ -void CProgressiveDownloadSource::FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId /*aMediaId*/ ) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::FillBufferL")); - #endif - // Requires that iFile is open for read. - // Reads data from iFile into aBuffer - if ((aConsumer == NULL) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (!iFile || (iMmfFileEventHandler == NULL)) - User::Leave(KErrNotReady); - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - CTransferBufferCopy* transBufCopy = NULL; - CReadRequest* request = NULL; - - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - TInt requestSize; - if(aBuffer->RequestSize()) - requestSize = aBuffer->RequestSize(); - else - requestSize = aBufferDes.MaxLength(); - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if (!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - { - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - transBufCopy = ObtainCopyOfTransferBufferL(aBufferDes.MaxLength()); - request = new(ELeave) CReadRequest(STATIC_CAST(TAny*, aConsumer), aBuffer, transBufCopy, iPosition, Size(),iBytesDownloaded, iMmfFileEventHandler); - } - else - { - request = new(ELeave) CReadRequest(STATIC_CAST(TAny*, aConsumer), aBuffer, iPosition, Size(),iBytesDownloaded, iMmfFileEventHandler); - } - - CleanupStack::PushL( request ); - - StoreRequestL(request); // transfers ownership - CleanupStack::Pop() ; // request - - iFile->Read(request->BufferDes(), requestSize, request->iStatus); - iPosition += requestSize; - - if (iPosition >= iFileSize) - { - aBuffer->SetLastBuffer(ETrue); - } - - request->SetActive(); - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - User::Leave( KErrNotSupported ) ; - } - -/** -Empties aBuffer into iFile. The file must be already open for writing. - -@param aBuffer - The buffer to be written to the file. -@param aSupplier - The data source supplier of the buffer. -*/ -void CProgressiveDownloadSource::EmptyBufferL( CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId /*aMediaId*/ ) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::EmptyBufferL")); - #endif - // Requires that iFile is open for write. - // Writes data from iFile into aBuffer - if ((aSupplier == NULL) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (!iFile || (iMmfFileEventHandler == NULL)) - User::Leave(KErrNotReady); - - CTransferBufferCopy* transBufCopy = NULL; - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - CWriteRequest* request = NULL; - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if (!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - { - //Obtain a normal buffer to send to the file server - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - transBufCopy = ObtainCopyOfTransferBufferL(aBufferDes.MaxLength()); - - //Copy the data into the buffer we will send to the file server - transBufCopy->Des().Copy(aBufferDes); - - request = new(ELeave) CWriteRequest(STATIC_CAST(TAny*, aSupplier), aBuffer, transBufCopy, iMmfFileEventHandler); - } - else - { - request = new(ELeave) CWriteRequest(STATIC_CAST(TAny*, aSupplier), aBuffer, iMmfFileEventHandler); - } - - CleanupStack::PushL( request ); - - StoreRequestL(request); // transfers ownership - CleanupStack::Pop(); // request - - iFile->Write(request->BufferDes(), request->BufferDes().Length(), request->iStatus); - request->SetActive(); - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - User::Leave( KErrNotSupported ) ; - } - } - -/** -Loads aLength number of bytes into aBuffer from specified point in iFile. - -@param aLength - The number of bytes to be read into buffer. -@param aBuffer - The buffer to be filled from the file. -@param aPosition - The offset into the file at which to start reading. -@param aConsumer - The data sink consumer of the buffer. -*/ -void CProgressiveDownloadSource::ReadBufferL(TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::ReadBufferL Async")); - #endif - // Requires that iFile is open for read. - // Reads data from iFile into aBuffer - if ((aLength < 0) || (aPosition<0) || (aConsumer == NULL) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (!iFile || (iMmfFileEventHandler == NULL)) - User::Leave(KErrNotReady); - - CTransferBufferCopy* transBufCopy = NULL; - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - CReadRequest* request = NULL; - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if (!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - { - //Obtain a normal buffer to send to the file server - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - transBufCopy = ObtainCopyOfTransferBufferL(aBufferDes.MaxLength()); - - request = new(ELeave) CReadRequest(STATIC_CAST(TAny*, aConsumer), aBuffer, transBufCopy, aPosition, Size(), iBytesDownloaded,iMmfFileEventHandler); - } - else - { - request = new(ELeave) CReadRequest(STATIC_CAST(TAny*, aConsumer), aBuffer, aPosition, Size(), iBytesDownloaded,iMmfFileEventHandler); - } - - CleanupStack::PushL( request ); - - StoreRequestL(request) ; //transfers ownership - CleanupStack::Pop() ; //request - - - - TInt err = iFile->Seek(ESeekStart, aPosition); - if (err==KErrNone) - iFile->Read(request->BufferDes(), aLength, request->iStatus); - else - { - TRequestStatus* status = &request->iStatus; - User::RequestComplete(status, err); - } - - //rj wait until runl is completed - // iPosition = aPosition + aLength; - iPosition = aPosition; - - // rj if (iPosition >= iFileSize) - // { - // aBuffer->SetLastBuffer(ETrue); - // } - - request->SetActive(); - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - User::Leave( KErrNotSupported ) ; - } - - -/** -Loads aBuffer from specified point in iFile. - -The file must already be open for reading. - -@param aBuffer - The buffer to be filled from the file. -@param aPosition - The offset into file at which to start reading. -@param aConsumer - The data sink consumer of the buffer. -*/ -void CProgressiveDownloadSource::ReadBufferL(CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::ReadBufferL Async")); - #endif - - // Requires that iFile is open for read. - // Reads data from iFile into aBuffer - if ((aPosition<0) || (aConsumer == NULL) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - TInt requestSize; - if(aBuffer->RequestSize()) - requestSize = aBuffer->RequestSize(); - else - requestSize = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data().MaxLength(); - - ReadBufferL(requestSize, aBuffer, aPosition, aConsumer); - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - User::Leave(KErrNotSupported); - } - - -/** -Loads aBuffer from specified point in iFile. Note that this is a synchronous read. - -@param aBuffer - The buffer to be filled from the file. -@param aPosition - The offset into file at which to start reading. -*/ -void CProgressiveDownloadSource::ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::ReadBufferL Sync")); - #endif - // Requires that iFile is open for read. - // Reads data from iFile into aBuffer - if ((aPosition<0) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (!iFile) - User::Leave(KErrNotReady); - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - TInt requestSize; - if(aBuffer->RequestSize()) - requestSize = aBuffer->RequestSize(); - else - requestSize = aBufferDes.MaxLength(); - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if (!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - { - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - CTransferBufferCopy* transBufCopy = ObtainCopyOfTransferBufferL(aBufferDes.MaxLength()); - - User::LeaveIfError(iFile->Seek(ESeekStart, aPosition)); - User::LeaveIfError(iFile->Read(transBufCopy->Des(), requestSize)); - aBufferDes.Copy(transBufCopy->Des().Left(aBufferDes.MaxLength())); - } - else - { - User::LeaveIfError(iFile->Seek(ESeekStart, aPosition)); - User::LeaveIfError(iFile->Read(aBufferDes, requestSize)); - } - - iPosition = aPosition + aBufferDes.Length(); - - //check if the buffer is the last buffer and if so set the last buffer flag on the CMMFDataBuffer - //NB: setting last buffer is the done by the formatter, but this is a hang over to account for - //existing formatters that may fail if this is removed. - if (aBufferDes.Length() < requestSize) - aBuffer->SetLastBuffer(ETrue); - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - User::Leave(KErrNotSupported); - } - -/** -Empties aLength bytes from aBuffer into iFile at specified location. - -@param aLength - The number of bytes to be emptied from buffer. -@param aBuffer - The data buffer containing bytes to be written. -@param aPosition - The offset into file at which to start writing. -@param aSupplier - The data source to be notified when the write has been completed. - -@leave KErrNotReady - SinkPrimeL() and SinkThreadLogon() have not been called. -@leave KErrArgument - aLength<0 or aPosition<0 or aSupplier is NULL. -@leave KErrNotSupported - aBuffer is not a supported CMMFDataBuffer -*/ -void CProgressiveDownloadSource::WriteBufferL(TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::WriteBufferL Async")); - #endif - - if ((aLength<0) || (aPosition<0) || (aSupplier == NULL) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (!iFile || (iMmfFileEventHandler == NULL)) - User::Leave(KErrNotReady); - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - CWriteRequest* request = NULL; - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if (!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - { - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - CTransferBufferCopy* transBufCopy = ObtainCopyOfTransferBufferL(aBufferDes.MaxLength()); - - transBufCopy->Des().Copy(aBufferDes); - - request = new(ELeave) CWriteRequest(STATIC_CAST(TAny*, aSupplier), aBuffer, transBufCopy, iMmfFileEventHandler); - } - else - { - request = new(ELeave) CWriteRequest(STATIC_CAST(TAny*, aSupplier), aBuffer, iMmfFileEventHandler); - } - - CleanupStack::PushL( request ); - - StoreRequestL(request); // transfers ownership - CleanupStack::Pop(); // request - - iFile->Seek(ESeekStart, aPosition); - iFile->Write(request->BufferDes(), aLength, request->iStatus); - //iFileSize = -1; //reset cached size - - request->SetActive(); - } - else // if (!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - { - //write bitmap to file - User::Leave(KErrNotSupported); - } - } - -/** -Empties aBuffer into iFile at the specified location. - -@param aBuffer - The data buffer containing bytes to be written. -@param aPosition - The offset into file at which to start writing. -@param aSupplier - The data source to be notified when the write has been completed. - -@leave KErrNotReady - SinkPrimeL() and SinkThreadLogon() have not been called. -@leave KErrArgument - aSupplier is NULL. -@leave KErrNotSupported - The aBuffer is not of type KMMFDataBuffer. -*/ -void CProgressiveDownloadSource::WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::WriteBufferL Async")); - #endif - // Requires that iFile is open for write. - // Writes data from iFile into aBuffer - if ((aPosition<0) || (aSupplier == NULL) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - TUint requestSize = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data().Length(); - - WriteBufferL(requestSize, aBuffer, aPosition, aSupplier); - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - //write bitmap to file - User::Leave( KErrNotSupported ) ; - } - } - -/** -Empties aBuffer into iFile at specified location. Note that this is a synchronous write. - -@param aBuffer - The data buffer containing bytes to be written. -@param aPosition - The offset into file at which to start writing. - -@return The error code from RFile. -*/ -void CProgressiveDownloadSource::WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition ) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::WriteBufferL Sync")); - #endif - if ((aPosition<0) || (aBuffer == NULL)) - User::Leave(KErrArgument); - - if (!iFile) - User::Leave(KErrNotReady); - - TInt err(KErrNone) ; - - //check whether buffer is safe to send to file server - //if not, eg for a transfer buffer, then it needs to be copied - if ((!CMMFBuffer::IsFileServerSafe(aBuffer->Type())) - && (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type()))) - { - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - //NB: failure in this method will NOT cause transBufCopy to leak as it will be - //inserted into iTransferBufferCopies by ObtainCopyOfTransferBufferL. - CTransferBufferCopy* transBufCopy = ObtainCopyOfTransferBufferL(aBufferDes.MaxLength()); - - transBufCopy->Des().Copy(aBufferDes); - err = iFile->Seek(ESeekStart, aPosition); - if (err==KErrNone) - err = iFile->Write(transBufCopy->Des(),transBufCopy->Des().Length()); - //iFileSize = -1; //reset cached size - } - else if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - TDes8& aBufferDes = STATIC_CAST( CMMFDataBuffer*, aBuffer )->Data(); - - err = iFile->Seek(ESeekStart, aPosition); - if (err==KErrNone) - err = iFile->Write(aBufferDes, aBufferDes.Length()); - //iFileSize = -1; //reset cached size - } - else // if (CMMFBuffer::IsSupportedDataBuffer(aBuffer->Type())) - { - User::Leave(KErrNotSupported); - } - - User::LeaveIfError(err); - } - -/** -Gets the number of free bytes in the device's file system. - -@return The number of free bytes. -*/ -TInt64 CProgressiveDownloadSource::BytesFree() - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::BytesFree")); - #endif - - TVolumeInfo volInfo; - if (iFsSession.Volume(volInfo) == KErrNone) - return volInfo.iFree; - return TInt64(0); - } - -/** -Returns the size of the file in bytes. - -Note: This is not the maximum length. - -@return The size of the file in bytes. -*/ -TInt CProgressiveDownloadSource::Size() - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::size iFileSize %d"),iFileSize); - RDebug::Print(_L("CProgressiveDownloadSource::size iFixSize %d"),iFix); - #endif - - TInt size = 0; - TInt err = KErrNone; - TBool fileOpened = EFalse; - - - if(iFix != 0) //rj - { - iFileSize = iFix; - return iFix; - } - - - if(iFileSize != -1) - return iFileSize; - - if (!iFile) - { - // Open the file. - TRAP(err, SourcePrimeL()); - if (iFile) - fileOpened = ETrue; - } - if (err == KErrNone && iFile) - err = iFile->Size(size); - if (err) - { - size = 0; - // iFileSize = -1; //reset cached size - } - else - iFileSize = size; //cache the filesize - - if (fileOpened) - TRAP_IGNORE(SourceStopL()); // Close the file - - return size; - - } - -/** -Source thread logon. - -Shares fsSession between threads - -@param aEventHandler - This is an MAsyncEventHandler to handle asynchronous events that occur during the - transfer of multimedia data. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgressiveDownloadSource::SourceThreadLogon(MAsyncEventHandler& aEventHandler) - { - iEventHandler = &aEventHandler; - if(!iMmfFileEventHandler) - { - iMmfFileEventHandler = new CMMFFileAsyncEventHandler(this); - if(!iMmfFileEventHandler) - return KErrNoMemory; - } -#ifdef __IPC_V2_PRESENT__ - return KErrNone; // nothing to do -#else - return iFsSession.Attach(); -#endif // __HIDE_IPC_V1__ - } - -/** -Logs off source thread. -*/ -void CProgressiveDownloadSource::SourceThreadLogoff() - { - delete iMmfFileEventHandler; - iMmfFileEventHandler = NULL; - iEventHandler = NULL; - } - - -/** -Sink thread logon. - -Shares fsSession between threads. - -@param aEventHandler - This is an MAsyncEventHandler to handle asynchronous events that occur during the - transfer of multimedia data. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgressiveDownloadSource::SinkThreadLogon(MAsyncEventHandler& aEventHandler) - { - iEventHandler = &aEventHandler; - if(!iMmfFileEventHandler) - { - iMmfFileEventHandler = new CMMFFileAsyncEventHandler(this); - if(!iMmfFileEventHandler) - return KErrNoMemory; - } -#ifdef __IPC_V2_PRESENT__ - return KErrNone; -#else - return iFsSession.Attach(); -#endif // __HIDE_IPC_V1__ - } - -/** -Sink thread log off. -*/ -void CProgressiveDownloadSource::SinkThreadLogoff() - { - delete iMmfFileEventHandler; - iMmfFileEventHandler = NULL; - iEventHandler = NULL; - } - -/** -Stores a request in an array. - -CReadWriteRequests are stored in the array iRequests. -This function takes ownership and places the request in the array. -It also checks the array for completed requests and removes them. - -@param aRequest - The request to store. -*/ -void CProgressiveDownloadSource::StoreRequestL( CReadWriteRequest* aRequest ) - { - // add aRequest to iRequests - User::LeaveIfError( iRequests.Append( aRequest ) ) ; - - // Clear out any completed requests - for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ ) - { - if (iRequests[ii]->Completed()) - { - CReadWriteRequest* request = iRequests[ii]; - delete request; - - iRequests.Remove(ii); - ii--; - } - } - } - - -/** -Cancels outstanding requests. - -CReadWriteRequests are stored in the array iRequests. -This function cancels any outstanding requests and removes them -from iRequests. -*/ -void CProgressiveDownloadSource::CancelRequests() - { - // Clear out any completed requests - for ( TInt ii = 0 ; ii < iRequests.Count() ; ii++ ) - { - CReadWriteRequest* request = iRequests[ii]; - delete request; - iRequests.Remove(ii); - ii--; - } - } - - - -/** -Returns the data type as a fourCC code of CProgressiveDownloadSource as a data source. - -@return The data type fourCC code. -*/ -TFourCC CProgressiveDownloadSource::SourceDataTypeCode(TMediaId /*aMediaId*/) - { - return iSourceFourCC ; - } - -/** -Returns the data type as a fourCC code of CProgressiveDownloadSource as a data sink. - -@return The data type fourCC code -*/ -TFourCC CProgressiveDownloadSource::SinkDataTypeCode(TMediaId /*aMediaId*/) - { - return iSinkFourCC ; - } - - -/** -CProgressiveDownloadSource as a source is always passive so this function is not supported. - -@param aBuffer - The emptied buffer. -*/ -void CProgressiveDownloadSource::BufferEmptiedL(CMMFBuffer* /* aBuffer */) - { - Panic(EMMFFilePanicBufferEmptiedLNotSupported); - } - -/** -Tests whether a source buffer can be created. - -@return A boolean indicating if if CProgressiveDownloadSource can create its own buffer. EFalse if CProgressiveDownloadSource cannot - create it's own buffer. -*/ -TBool CProgressiveDownloadSource::CanCreateSourceBuffer() - { - return EFalse; - } - -/** -Creates a source buffer. - -@param aMediaId - The Media ID. -@param aReference - A boolean indicating if MDataSource owns the buffer. ETrue if it does, EFalse if the caller - owns the buffer. - -@return NULL as a CProgressiveDownloadSource cannot create it's own buffer -*/ -CMMFBuffer* CProgressiveDownloadSource::CreateSourceBufferL( TMediaId /*aMediaId*/ , TBool& /*aReference*/) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::CreateSourceBufferL")); - #endif - User::Leave(KErrNotSupported); - return NULL ; - } - -/** -CProgressiveDownloadSource as a sink is always passive so this function is not supported. - -@param aBuffer - The buffer. -*/ -void CProgressiveDownloadSource::BufferFilledL(CMMFBuffer* /* aBuffer */) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::BufferFilledL")); - #endif - Panic(EMMFFilePanicBufferFilledLNotSupported); - } - -/** -Tests whether a sink buffer can be created. - -@return A boolean indicating if the sink buffer can be created. EFalse if CProgressiveDownloadSource cannot create - it's own buffer -*/ -TBool CProgressiveDownloadSource::CanCreateSinkBuffer() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::CanCreateSinkBuffer")); - #endif - return EFalse ; - } - -/** -Creates a sink buffer. - -@param aMediaId - The Media ID. -@param aReference - A boolean indicating if MDataSource owns the buffer. ETrue if MDataSource owns the buffer, - EFalse if the caller owns the buffer. - -@return NULL as a CProgressiveDownloadSource cannot create it's own buffer -*/ -CMMFBuffer* CProgressiveDownloadSource::CreateSinkBufferL(TMediaId /*aMediaId*/ , TBool& /*aReference*/) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::CreateSinkBufferL")); - #endif - User::Leave(KErrNotSupported); - return NULL ; - } - - -/** -Primes the source. - -When used as a source, the file prime opens the file as read only. -*/ -void CProgressiveDownloadSource::SourcePrimeL() - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::SourcePrimeL")); - #endif - - // don't reopen file if already open - if (!iFile) - { - - if (iFileHandle) - { - iFile = CContentFile::NewL(iHandle, UniqueId()); - } - else - { - // rj Open for progressive download need to have shared access - iFile = CContentFile::NewL(iFsSession, iFullFileName, UniqueId(), EFileShareAny); - - } - - } - iFileOpen = ETrue; - } - -/** -Primes the sink. - -When used as a sink, the file prime opens the file for read/write access. -*/ -void CProgressiveDownloadSource::SinkPrimeL() - { - // don't reopen file if already open - if (!iFile) - { - - if (iFileHandle) - iFile = CF32File::NewL(iHandle); - else - iFile = CF32File::NewL(iFsSession, iFullFileName, EFileRead | EFileWrite); - - iSinkNotStopped = ETrue; - } - iFileOpen = ETrue; - } - -/** -Stops the file source. When stopping close the file. -*/ -void CProgressiveDownloadSource::SourceStopL() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::SourceStopL")); - #endif - CancelRequests(); - - if(iFile == NULL) //rj - return; - - iFileOpen = EFalse; - TInt pos = 0; - if (!iFileHandle && !iFile->IsProtected()) - { - delete iFile; - iFile = NULL; - // iFileSize = -1; - } - else - { - User::LeaveIfError(iFile->Seek(ESeekStart, pos)); - - } - - iPosition=pos; - } - -/** -Stops the file sink. - -When stopping close the file. -*/ -void CProgressiveDownloadSource::SinkStopL() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::SinkStopL")); - #endif - - CancelRequests(); - iFileOpen = EFalse; - if (!iFileHandle) - { - iSinkNotStopped = EFalse; - delete iFile; - iFile = NULL; - } - else - { - TInt pos = 0; - User::LeaveIfError(iFile->Seek(ESeekStart, pos)); - } - //iFileSize = -1; - iPosition=0; - } - -/** -Returns a boolean indicating if the sink has been stopped. - -@return A boolean indicating if the sink has stopped. - */ -TBool CProgressiveDownloadSource::SinkStopped() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::SinkStopped")); - #endif - if(iSinkNotStopped == EFalse) - return ETrue; - else - return EFalse; - } - -/** -Evaluates a given intent against the rights associated with the file. - -The rights are not updated by this function call. - -@param aIntent - The intent to evaluate. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgressiveDownloadSource::EvaluateIntent(ContentAccess::TIntent aIntent) const - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::EvaluateIntent")); - #endif - if (iFile==NULL) - { - return KErrNotReady; - } - - return iFile->EvaluateIntent(aIntent); - } - -/** -Evaluates and executes a given intent against the rights associated with the file. - -The rights object is updated after calling this function. - -@param aIntent - The intent to evaluate. - -@return An error code indicating if the function call was successful. KErrNone on success, otherwise - another of the system-wide error codes. -*/ -TInt CProgressiveDownloadSource::ExecuteIntent(ContentAccess::TIntent aIntent) - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::ExecuteIntent")); - #endif - if (!iFile) - return KErrNotReady; - - return iFile->ExecuteIntent(aIntent); - } - -/** -Returns whether the file is protected. - -@return A boolean indicating if the file is protected. ETrue if the file is protected. -*/ -TBool CProgressiveDownloadSource::IsProtectedL() const - { - - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::IsProtectedL")); - #endif - if (!iFile) - User::Leave(KErrNotReady); - - return iFile->IsProtected(); - } - - - - - -TInt CProgressiveDownloadSource::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) - { - if (iFile==NULL) - { - return KErrNotReady; - } - - return iFile->SetAgentProperty(aProperty, aValue); - } - -void CProgressiveDownloadSource::SourceCustomCommand(TMMFMessage& aMessage) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::SourceCustomCommand")); - #endif - - TInt err= KErrNone; - switch(aMessage.Function()) - { - case EGETFILEPOSITION: - { - //get iPosition; - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::SrcCustomCommand file position %d"),iPosition); - #endif - TPckgBuf positionPckg(iPosition); - err = aMessage.WriteDataToClient(positionPckg); - - break; - } - case ESETFILESIZE: - { - //set file size; - TPckgBuf fileSizePckg; - err = aMessage.ReadData1FromClient(fileSizePckg); - if((err==KErrNone) && (fileSizePckg()>0)) - SetSize(fileSizePckg()); - - break; - - } - case ESETBYTESDOWNLOADED: - { - TPckgBuf bytesDownloadedPckg; - err = aMessage.ReadData1FromClient(bytesDownloadedPckg); - - if((err==KErrNone) &&(bytesDownloadedPckg()>0)) - iBytesDownloaded = bytesDownloadedPckg(); - break; - } - default: - err = KErrNotSupported; - break; - } - - aMessage.Complete(err); - - } - -/* - * Returns ETrue if the request can safely be deleted. - */ -TBool CReadWriteRequest::Completed() - { - return iCompleted ; - } - -/* - * Returns the data member of CMMFDataBuffer or CMMFTransferBuffer (as TPtr8) - * - */ -TDes8& CReadWriteRequest::BufferDes() - { - if(iTransferBufferCopy) - return iTransferBufferCopy->Des(); - else - { - //reset iBufferDes in case iBuffer has changed... - iBufferDes = &(STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data()); - return *iBufferDes; - } - } - -const TDesC8& CReadWriteRequest::BufferDesC() - { - if(iTransferBufferCopy) - return iTransferBufferCopy->Des(); - else - return BufferDes(); - } - - -/* - * Destructor. - */ -CReadWriteRequest::~CReadWriteRequest() - { - Cancel(); - if(iTransferBufferCopy) - iTransferBufferCopy->SetInUse(EFalse); - } - -/* - * Allows owning class access to SetActive() - */ -void CReadWriteRequest::SetActive() - { - CActive::SetActive() ; - } - -/* - * For the moment at least... Canceled requests may be deleted - */ -void CReadWriteRequest::DoCancel() - { - iCompleted = ETrue ; - } - -/* - * Called when errors in RunL force Leave. For the moment just mark the request deletable - */ -TInt CReadWriteRequest::RunError( TInt aError ) - { - //RunL can leave. - iCompleted = ETrue ; - iError = aError; //keep this error internally for now - return KErrNone ; - } - -/* - * On completion of read request call back to the MDataSink - */ -void CReadRequest::RunL() - { - - #if _DEBUG - RDebug::Print(_L("CReadRequest::RunL file byte position %d"),iPosition); - RDebug::Print(_L("CReadRequest::RunL buffer length %d"),BufferDes().Length()); - #endif - - if (iStatus != KErrNone) - { - TMMFEvent event(KMMFErrorCategoryControllerGeneralError, iStatus.Int()); - iEventHandler->SendEventToClient(event); - } - else - { - //Copy the data from the normal buffer into the Transfer buffer - if(iTransferBufferCopy) - { - //must specify the size here as the dest may be smaller than the source. - TDes8& destDesc = STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data(); - destDesc.Copy(iTransferBufferCopy->Des().Left(destDesc.MaxLength())); - - iTransferBufferCopy->SetInUse(EFalse); - } - - #if _DEBUG - RDebug::Print(_L("CReadRequest::RunL bytes downloaded %d"),iBytesDownloaded); - #endif - if(iBytesDownloaded > 0 && - iBytesDownloaded <= iPosition + BufferDes().Length() && - iBytesDownloaded < iFileSize) - { - #if _DEBUG - RDebug::Print(_L("CReadRequest::RunL - OUT OF DATA")); - #endif - - STATIC_CAST(CMMFDataBuffer*, iBuffer)->Data().SetLength(0); - - } - else - { - iPosition = iPosition + BufferDes().Length(); - } - - //has all the files data been read - if(iPosition >= iFileSize) - { - #if _DEBUG - RDebug::Print(_L("CReadRequest::RunL filesize %d"),iFileSize); - RDebug::Print(_L("CReadRequest::RunL file position %d"),iPosition); - RDebug::Print(_L("CReadRequest::RunL setlastbuffer ")); - #endif - - iBuffer->SetLastBuffer(ETrue); - } - - REINTERPRET_CAST(MDataSink*, iSinkOrSource)->BufferFilledL(iBuffer) ; // callback to MDataSource/Sink - } - - iCompleted = ETrue ; - } - -/* - * On completion of write request call back to the MDataSource - */ -void CWriteRequest::RunL() - { - if(iTransferBufferCopy) - iTransferBufferCopy->SetInUse(EFalse); - - if (iStatus != KErrNone) - { - TMMFEvent event(KMMFErrorCategoryControllerGeneralError, iStatus.Int()); - iEventHandler->SendEventToClient(event); - } - else - REINTERPRET_CAST(MDataSource*, iSinkOrSource)->BufferEmptiedL(iBuffer) ; // callback to MDataSource/Sink - - iCompleted = ETrue ; - } - -CProgressiveDownloadSource::CMMFFileAsyncEventHandler::CMMFFileAsyncEventHandler(CProgressiveDownloadSource* aParent) - { - iParent = aParent; - } - -CProgressiveDownloadSource::CMMFFileAsyncEventHandler::~CMMFFileAsyncEventHandler() - { - } - -TInt CProgressiveDownloadSource::CMMFFileAsyncEventHandler::SendEventToClient(const TMMFEvent& aEvent) - { - -#if _DEBUG - RDebug::Print(_L("CProgressiveDownloadSource::CMMFFileAsyncEventHandler::SendEventToClient err=%d"),aEvent.iErrorCode); -#endif - - if(aEvent.iErrorCode == KErrNotReady)//i.e. MMC removed while recording - TRAP_IGNORE(iParent->SinkStopL()); - return iParent->iEventHandler->SendEventToClient(aEvent); - } - - - -// __________________________________________________________________________ -// Exported proxy for instantiation method resolution -// Define the interface UIDs - -const TImplementationProxy ImplementationTable[] = - { - IMPLEMENTATION_PROXY_ENTRY(KProgressiveDownloadSourceUid,CProgressiveDownloadSource::NewSourceL) - }; - -EXPORT_C const TImplementationProxy* ImplementationGroupProxy(TInt& aTableCount) - { - aTableCount = sizeof(ImplementationTable) / sizeof(TImplementationProxy); - - return ImplementationTable; - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/src/ProgressiveDownloadSource.h --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/src/ProgressiveDownloadSource.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,280 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - - -#ifndef __PROGRESSIVEDOWNLOADSOURCE_H_ -#define __PROGRESSIVEDOWNLOADSOURCE_H_ - -#include - -#include -#include -#include - -#include "ProgressiveDownloadSourceUIDs.hrh" - -class CReadWriteRequest; -class CTransferBufferCopy; -class MGenericFile; - -/** -@publishedAll -@released - -Provides the filename and path of file. - -Used by CMMFFile::ConstructL(). -*/ -class TMMFFileParams - { -public: - /** - Filename and path of file. - */ - TFileName iPath ; // Filename and path of file. -private: - /** - This member is internal and not intended for use. - */ - TInt iReserved1; - }; - -/** -@internalTechnology -*/ -const TUid KFileHandleUid = {0x101FFA19}; -const TUid KMMFileSourceUid = {0x101F7DA9}; -const TUid KMMFileHandleSourceUid = {0x101F7DAA}; -/** -@publishedAll -@released - -Provides a pointer to the file handle - -Used by CMMFFile::ConstructL(). -*/ -class TMMFFileHandleParams - { -public: - TMMFFileHandleParams(RFile* aFile) : iUid(KFileHandleUid), iFile(aFile) {} - TMMFFileHandleParams() : iUid(KFileHandleUid) {} - - TUid iUid; - /** - Handle of file - */ - RFile* iFile; -private: - /** - This member is internal and not intended for use. - */ - TInt iReserved1; - }; - - - - -/** -@publishedAll -@released -*/ -typedef TPckgBuf TMMFFileConfig ; - -/** -@publishedAll -@released -*/ -typedef TPckgBuf TMMFFileHandleConfig ; - - -/** -@publishedAll -@released - -This details how big the iTransferBufferCopies array of CMMFFile may -become before we start looking to free entries. -*/ -const TInt KAcceptableTransferBufferCopiesSize = 5; - -/** -@publishedAll -@released - -This details how big the iTransferBufferCopies array of CMMFFile may -become before we start looking to free entries. -*/ -const TInt KMaximumTransferBufferCopiesSize = 100; - - -/** -@publishedAll -@released - -MultiMedia framework class. Represents a physical file. - -This may be source file from which data is read or destination to which data is written. - -Intended to be used by controller plugin developers for source and sink plugins. -*/ -class CProgressiveDownloadSource : public CMMFClip - { -public: - // From MDataSource - virtual TFourCC SourceDataTypeCode(TMediaId aMediaId) ; - virtual void FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId ) ; - virtual void BufferEmptiedL( CMMFBuffer* aBuffer ) ; - virtual TBool CanCreateSourceBuffer() ; - virtual CMMFBuffer* CreateSourceBufferL( TMediaId aMediaId, TBool &aReference ) ; - virtual TInt SourceThreadLogon(MAsyncEventHandler& aEventHandler) ; - virtual void SourceThreadLogoff(); - virtual void SourcePrimeL(); - virtual void SourceStopL(); - - // From MDataSink - virtual TFourCC SinkDataTypeCode(TMediaId aMediaId) ; //used by data path MDataSource/Sink for codec matching - virtual void EmptyBufferL( CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId ) ; - virtual void BufferFilledL( CMMFBuffer* aBuffer ) ; - virtual TBool CanCreateSinkBuffer() ; - virtual CMMFBuffer* CreateSinkBufferL( TMediaId aMediaId , TBool &aReference) ; - virtual TInt SinkThreadLogon(MAsyncEventHandler& aEventHandler) ; - virtual void SinkThreadLogoff(); - virtual void SinkPrimeL(); - virtual void SinkStopL(); - - // From CMMFClip - virtual void ReadBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer); - virtual void WriteBufferL( TInt aLength, CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier); - virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSink* aConsumer) ; - virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition, MDataSource* aSupplier) ; - virtual void ReadBufferL( CMMFBuffer* aBuffer, TInt aPosition ) ; - virtual void WriteBufferL( CMMFBuffer* aBuffer, TInt aPosition ) ; - virtual TInt64 BytesFree() ; // amount of space available for the clip - virtual TInt Size() ; - virtual TInt Delete(); - virtual TInt SetSize(TInt aSize); - - // New Functions - virtual const TDesC& FileName() const ; - virtual const TDesC& Extension() const ; - virtual const TDesC& FilePath() const ; - virtual const TDesC& FileDrive() const ; - virtual const TFileName FullName() const; - virtual RFile& FileL() ; - - virtual void SourceCustomCommand(TMMFMessage& aMessage); - - -public : - virtual ~CProgressiveDownloadSource() ; - static MDataSource* NewSourceL() ; - static MDataSink* NewSinkL() ; - - void SetTransferBuffer (TBool aTBuffer) ; - TBool CanUseTransferBuffer () ; - virtual TBool SinkStopped(); - -protected : - /** - Indicates for which purpose the object instance is being created - */ - enum TMMFileMode - { - /** The object is created for being a source */ - ESourceMode, - /** The object is created for being a sink */ - ESinkMode - }; - virtual void ConstructSourceL( const TDesC8& aInitData ) ; - virtual void ConstructSinkL( const TDesC8& aInitData ) ; - void ConstructL(const TDesC8& aInitData, TMMFileMode aFileMode) ; - CProgressiveDownloadSource() ; - - void StoreRequestL( CReadWriteRequest* aRequest ) ; - void CancelRequests(); - - - CTransferBufferCopy* ObtainCopyOfTransferBufferL(TInt aMaxLength); - -public: - // Additional virtuals for DRM Intent - virtual TInt ExecuteIntent(ContentAccess::TIntent aIntent); - virtual TInt EvaluateIntent(ContentAccess::TIntent aIntent) const; - virtual TBool IsProtectedL() const; - - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue); - virtual const TDesC& UniqueId() const; - - -private: - class CMMFFileAsyncEventHandler : public MAsyncEventHandler - { - public: - CMMFFileAsyncEventHandler(CProgressiveDownloadSource* aParent); - virtual ~CMMFFileAsyncEventHandler(); - public: - virtual TInt SendEventToClient(const TMMFEvent& aEvent); - private: - CProgressiveDownloadSource* iParent; - }; -private: - MGenericFile* iFile; - RFs iFsSession; - - TBool iFileHandle; - RFile iHandle; - TBool iFileOpen; // "virtual" open, makes sure that certain accesses are between Prime and Stop - - TBool iSinkNotStopped; - - TFileName iFullFileName ; - HBufC* iFileName ; - HBufC* iFileExt ; - HBufC* iFilePath ; - HBufC* iFileDrive ; - - HBufC* iUniqueId; - - TInt iFileSize; //holds the cached file size - - TInt iFix; - - //Keeps track of the read position within the file. Needed in order to enable passing of the - //read position to the CReadRequest to manage the LastBuffer flag. - //NB: Continuous reads once EOF has been reached will result in iPosition going > iFileSize, - //but this causes no ill effects - TUint iPosition; - - TFourCC iSinkFourCC ; - TFourCC iSourceFourCC ; - - - RPointerArray iRequests; - - MAsyncEventHandler *iEventHandler; - CMMFFileAsyncEventHandler* iMmfFileEventHandler; - - RPointerArray iTransferBufferCopies; - friend class CMMFFileAsyncEventHandler; - TInt iBytesDownloaded; - }; - - - - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/src/ProgressiveDownloadSourceUIDs.hrh --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/src/ProgressiveDownloadSourceUIDs.hrh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,35 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - -#ifndef __PROGRESSIVEDOWNLOADSOURCEUIDS_HRH__ -#define __PROGRESSIVEDOWNLOADSOURCEUIDS_HRH__ - - -// These are the ECOM Interface UIDs - -#define KProgressiveDownloadSourceUid 0x10207A7C - - - -//DataSource CustomCommands -enum -{ -EGETFILEPOSITION, -ESETFILESIZE, -ESETBYTESDOWNLOADED -}; -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadSource/src/fileaccess.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadSource/src/fileaccess.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,331 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - -#include -#include -#include -#include -#include -#include -using namespace ContentAccess; -#include - -#include "FileAccess.h" - -CF32File::~CF32File() - { - if (!iFileHandle) - iFile.Close(); - delete iFilePath; - } - -CF32File* CF32File::NewL(RFs& aSession, TDesC& aFilePath, TUint aMode) - { - CF32File* self = new (ELeave) CF32File; - CleanupStack::PushL(self); - self->ConstructL(aSession, aFilePath, aMode); - CleanupStack::Pop(self); - return self; - } - - -void CF32File::ConstructL(RFs& aSession, TDesC& aPath, TUint aFileMode) - { - iSession = &aSession; - iFilePath = aPath.AllocL(); - TUint attributes = 0; - TInt err = iSession->Att(*iFilePath, attributes); - if (err == KErrNone) - { - if ( attributes & KEntryAttReadOnly ) - User::LeaveIfError(iFile.Open(*iSession, *iFilePath, EFileShareAny )) ; - else //if ( !( attributes & KEntryAttReadOnly ) ) - User::LeaveIfError(iFile.Open(*iSession, *iFilePath, EFileShareAny)) ; - } - else if ((err == KErrNotFound) && (aFileMode & EFileWrite)) - { - User::LeaveIfError(iFile.Create(*iSession, *iFilePath, EFileShareAny )) ; - } - else - { - User::Leave(err); - } - } - - -RFile& CF32File::FileL() - { - return iFile; - } - -TInt CF32File::Seek(TSeek aSeekMode, TInt aPos) - { - return iFile.Seek(aSeekMode, aPos); - } - -TInt CF32File::Read(TDes8& aDes,TInt aLength) - { - return iFile.Read(aDes, aLength); - } - -void CF32File::Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) - { - iFile.Read(aDes, aLength, aStatus); - } - -TInt CF32File::Write(const TDesC8& aDes,TInt aLength) - { - return iFile.Write(aDes, aLength); - } - -void CF32File::Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus) - { - iFile.Write(aDes, aLength, aStatus); - } - -TInt CF32File::Size(TInt& aSize) - { - #if _DEBUG - RDebug::Print(_L("[%x]CF32File::Size to %d\n"),this,aSize); - #endif - - return iFile.Size(aSize); - } - -TInt CF32File::SetSize(TInt aSize) - { - #if _DEBUG - RDebug::Print(_L("[%x]CF32File::SetSize to %d\n"),this,aSize); - #endif - - - TInt err = iFile.SetSize(aSize); - if(err == KErrNone) - iFileSize = aSize; - else - iFileSize = -1; - - return err; - } - -TInt CF32File::EvaluateIntent(TIntent /*aIntent*/) const - { - return KErrNone; - } - - -TInt CF32File::ExecuteIntent(TIntent /*aIntent*/) - { - return KErrNone; - } - -TBool CF32File::IsProtected() const - { - return EFalse; - } - - -TInt CF32File::SetAgentProperty(TAgentProperty /*aProperty*/, TInt /*aValue*/) - { - // not an error to set this if not supported, just wont do anything - return KErrNone; - } - - -CContentFile::~CContentFile() - { - delete iData; - delete iContent; - - if (iLegacyFileOpen) - iLegacyFile.Close(); - delete iFilePath; - } - - - -CContentFile* CContentFile::NewL(RFs& aSession, const TDesC& aFilePath, const TDesC& aUniqueId, TUint aMode) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aSession, aFilePath, aUniqueId, aMode); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint /*aMode*/) - { - iSession = &aSession; - iFilePath = aPath.AllocL(); - - iContent = CContent::NewL(*iFilePath,EContentShareReadWrite); - if (aUniqueId.Length()>0) - { - iData = iContent->OpenContentL(EPeek, aUniqueId);//rj need mode for this one. - } - else - { - iData = iContent->OpenContentL(EPeek,EContentShareReadWrite); - } - } - -CContentFile* CContentFile::NewL(RFs& aSession, const TDesC& aFilePath, TUint aMode) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aSession, aFilePath, aMode); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFs& aSession, const TDesC& aPath, TUint /*aMode*/) - { - iSession = &aSession; - iFilePath = aPath.AllocL(); - - iContent = CContent::NewL(*iFilePath, EContentShareReadWrite) ; - iData = iContent->OpenContentL(EPeek,EContentShareReadWrite); - } - - - - - -TInt CContentFile::EvaluateIntent(TIntent aIntent) const - { - ASSERT(iData); - return iData->EvaluateIntent(aIntent); - } - - -TInt CContentFile::ExecuteIntent(TIntent aIntent) - { - ASSERT(iData); - return iData->ExecuteIntent(aIntent); - } - -TBool CContentFile::IsProtected() const - { - ASSERT(iContent && iData); - TInt value = 0; - TInt err =iData->GetAttribute(EIsProtected, value); - return (err == KErrNone && value); - } - - -TInt CContentFile::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) - { - ASSERT(iContent); - return iContent->SetProperty(aProperty, aValue); - } - - -TInt CContentFile::Seek(TSeek aSeekMode, TInt aPos) - { - ASSERT(iData); - return iData->Seek(aSeekMode, aPos); - } - -TInt CContentFile::Read(TDes8& aDes,TInt aLength) - { - ASSERT(iData); - return iData->Read(aDes,aLength); - } - -void CContentFile::Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) - { - ASSERT(iData); - iData->Read(aDes, aLength, aStatus); - } - -TInt CContentFile::Write(const TDesC8& /*aDes*/,TInt /*aLength*/) - { - return KErrAccessDenied; - } -void CContentFile::Write(const TDesC8& /*aDes*/, TInt /*aLength*/, TRequestStatus& aStatus) - { - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrAccessDenied); - } - -TInt CContentFile::SetSize(TInt /*aSize*/) - { - // Only a source is implemented, hence this cannot be allowed - return KErrAccessDenied; - } - - -// Get the size of file -// this method opens a new, read-only, RFile the first time this method is called - -TInt CContentFile::Size(TInt& aSize) - { - ASSERT(iData); - TRAPD(err, iData->DataSizeL(aSize)); - return err; - } - -/** - * return a RFile for the legacy RFile method - * this method opens a new, read-only, RFile the first time this method is called - * @internalTechnology - * @return Reference to RFile handle to current file - */ -RFile& CContentFile::FileL() - { - if (!iLegacyFileOpen) - { - User::LeaveIfError(iLegacyFile.Open(*iSession, *iFilePath, EFileRead | EFileStream | EFileShareAny)); - iLegacyFileOpen = ETrue; - } - return iLegacyFile; - } - - -CF32File* CF32File::NewL(RFile& aFile) - { - CF32File* self = new (ELeave) CF32File; - CleanupStack::PushL(self); - self->ConstructL(aFile); - CleanupStack::Pop(self); - return self; - } - -void CF32File::ConstructL(RFile& aFile) - { - iFile = aFile; - iFileHandle = ETrue; - } - -CContentFile* CContentFile::NewL(RFile& aFile, const TDesC& aUniqueId) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aFile, aUniqueId); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFile& aFile, const TDesC& aUniqueId) - { - iContent = CContent::NewL(aFile) ; - if (aUniqueId.Length()>0) - iData = iContent->OpenContentL(EPeek, aUniqueId); //need mode - else - iData = iContent->OpenContentL(EPeek, aUniqueId); - } - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/BWINS/PDProperties.def --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/BWINS/PDProperties.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - ??1CPdProperties@@UAE@XZ @ 1 NONAME ; CPdProperties::~CPdProperties(void) - ?NewL@CPdProperties@@SAPAV1@XZ @ 2 NONAME ; class CPdProperties * CPdProperties::NewL(void) - ?NewLC@CPdProperties@@SAPAV1@XZ @ 3 NONAME ; class CPdProperties * CPdProperties::NewLC(void) - ?OpenL@CPdProperties@@QAEPAVCAudioPdPlayUtility@@ABVRFile@@AAVMAudioPdPlayUtilityCallback@@@Z @ 4 NONAME ; class CAudioPdPlayUtility * CPdProperties::OpenL(class RFile const &, class MAudioPdPlayUtilityCallback &) - ?OpenL@CPdProperties@@QAEPAVCAudioPdPlayUtility@@ABVTDesC16@@AAVMAudioPdPlayUtilityCallback@@@Z @ 5 NONAME ; class CAudioPdPlayUtility * CPdProperties::OpenL(class TDesC16 const &, class MAudioPdPlayUtilityCallback &) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/BWINS/ProgressiveDownloadUtility.def --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/BWINS/ProgressiveDownloadUtility.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,6 +0,0 @@ -EXPORTS - ??1CProgressiveDownloadUtility@@UAE@XZ @ 1 NONAME ; CProgressiveDownloadUtility::~CProgressiveDownloadUtility(void) - ?NewL@CProgressiveDownloadUtility@@SAPAV1@XZ @ 2 NONAME ; class CProgressiveDownloadUtility * CProgressiveDownloadUtility::NewL(void) - ?OpenL@CProgressiveDownloadUtility@@QAEPAVMAudioPdPlayUtility@@ABVRFile@@AAVMAudioPdPlayUtilityCallback@@@Z @ 3 NONAME ; class MAudioPdPlayUtility * CProgressiveDownloadUtility::OpenL(class RFile const &, class MAudioPdPlayUtilityCallback &) - ?OpenL@CProgressiveDownloadUtility@@QAEPAVMAudioPdPlayUtility@@ABVTDesC16@@AAVMAudioPdPlayUtilityCallback@@@Z @ 4 NONAME ; class MAudioPdPlayUtility * CProgressiveDownloadUtility::OpenL(class TDesC16 const &, class MAudioPdPlayUtilityCallback &) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/EABI/PDProperties.def --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/EABI/PDProperties.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -EXPORTS - _ZN13CPdProperties4NewLEv @ 1 NONAME - _ZN13CPdProperties5NewLCEv @ 2 NONAME - _ZN13CPdProperties5OpenLERK5RFileR27MAudioPdPlayUtilityCallback @ 3 NONAME - _ZN13CPdProperties5OpenLERK7TDesC16R27MAudioPdPlayUtilityCallback @ 4 NONAME - _ZN13CPdPropertiesD0Ev @ 5 NONAME - _ZN13CPdPropertiesD1Ev @ 6 NONAME - _ZN13CPdPropertiesD2Ev @ 7 NONAME - _ZTI13CPdProperties @ 8 NONAME ; ## - _ZTI18CAudioPdProperties @ 9 NONAME ; ## - _ZTI19CAudioPdPlayUtility @ 10 NONAME ; ## - _ZTI26CMMFMdaAudioPlayerCallBack @ 11 NONAME ; ## - _ZTI27CRepeatTrailingSilenceTimer @ 12 NONAME ; ## - _ZTIN10multimedia21CBufferEmptiedEventAOE @ 13 NONAME ; ## - _ZTIN25CMMFFindAndOpenController7CConfigE @ 14 NONAME ; ## - _ZTV13CPdProperties @ 15 NONAME ; ## - _ZTV18CAudioPdProperties @ 16 NONAME ; ## - _ZTV19CAudioPdPlayUtility @ 17 NONAME ; ## - _ZTV26CMMFMdaAudioPlayerCallBack @ 18 NONAME ; ## - _ZTV27CRepeatTrailingSilenceTimer @ 19 NONAME ; ## - _ZTVN10multimedia21CBufferEmptiedEventAOE @ 20 NONAME ; ## - _ZTVN25CMMFFindAndOpenController7CConfigE @ 21 NONAME ; ## - _ZTI12CContentFile @ 22 NONAME ; ## - _ZTV12CContentFile @ 23 NONAME ; ## - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/EABI/ProgressiveDownloadUtility.def --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/EABI/ProgressiveDownloadUtility.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,10 +0,0 @@ -EXPORTS - _ZN27CProgressiveDownloadUtility4NewLEv @ 1 NONAME - _ZN27CProgressiveDownloadUtility5OpenLERK5RFileR27MAudioPdPlayUtilityCallback @ 2 NONAME - _ZN27CProgressiveDownloadUtility5OpenLERK7TDesC16R27MAudioPdPlayUtilityCallback @ 3 NONAME - _ZN27CProgressiveDownloadUtilityD0Ev @ 4 NONAME - _ZN27CProgressiveDownloadUtilityD1Ev @ 5 NONAME - _ZN27CProgressiveDownloadUtilityD2Ev @ 6 NONAME - _ZTI27CProgressiveDownloadUtility @ 7 NONAME ; ## - _ZTV27CProgressiveDownloadUtility @ 8 NONAME ; ## - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/group/PDProperties.mmp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/group/PDProperties.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,71 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for ProgressiveDownloadUtility -* -*/ - - -#include - -TARGET PDProperties.dll -TARGETTYPE DLL - -DEFFILE PDProperties.def -NOSTRICTDEF - - - -UID 0x10207BA7 - -CAPABILITY ALL -Tcb - -USERINCLUDE ../inc ../../ProgressiveDownloadSource/src -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/mmf/server -SYSTEMINCLUDE /epoc32/include/kernel -SYSTEMINCLUDE /epoc32/include/mmf/common -SYSTEMINCLUDE /epoc32/include/caf - -SOURCEPATH ../src -SOURCE BufferEmptiedEventAO.cpp -#ifdef RD_PD_FOR_AUDIO_CONTENT_VIA_HELIX_ENGINE -SOURCE EMCPdPlayUtility.cpp -#else -SOURCE AudioPdPlayUtility.cpp -#endif -SOURCE mmfclientutility.cpp -SOURCE ContentFile.cpp -SOURCE PDProperties.cpp - - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY ecom.lib -LIBRARY mmfcontrollerframework.lib -LIBRARY mmfstandardcustomcommands.lib -LIBRARY DownloadMgr.lib -LIBRARY caf.lib -LIBRARY cafutils.lib -LIBRARY EnhancedMediaClient.lib -LIBRARY apgrfx.lib -LIBRARY apmime.lib -LIBRARY MetaDataUtility.lib - -#ifdef SYMBIAN_CAF_V2 -LIBRARY estor.lib -LIBRARY mmcommon.lib -#endif - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/group/ProgressiveDownloadUtility.mmp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/group/ProgressiveDownloadUtility.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for ProgressiveDownloadUtility -* -*/ - - -#include - -TARGET ProgressiveDownloadUtility.dll -TARGETTYPE DLL - -DEFFILE ProgressiveDownloadUtility.def -NOSTRICTDEF - - - -UID 0x10207A7A - -CAPABILITY ALL -Tcb - -USERINCLUDE ../inc ../../ProgressiveDownloadSource/src -USERINCLUDE ../../../../inc - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/mmf/server -SYSTEMINCLUDE /epoc32/include/kernel -SYSTEMINCLUDE /epoc32/include/mmf/common - - - -SOURCEPATH ../src -SOURCE ProgressiveDownloadUtility.cpp - - -LIBRARY euser.lib -LIBRARY efsrv.lib -LIBRARY ecom.lib -LIBRARY mmfcontrollerframework.lib -LIBRARY mmfstandardcustomcommands.lib -LIBRARY PDProperties.lib - -#ifdef SYMBIAN_CAF_V2 -LIBRARY estor.lib -LIBRARY mmcommon.lib -#endif - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/group/bld.inf --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project build file for ProgressiveDownloadUtility -* -*/ - - -PRJ_PLATFORMS -DEFAULT - - -PRJ_EXPORTS - - -PRJ_MMPFILES -PDProperties.mmp -ProgressiveDownloadUtility.mmp diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/AudioPdPlayUtility.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/AudioPdPlayUtility.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,947 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - -#include -#include -#include -#include "AudioPdPlayUtility.h" -#include "AudioPdProperties.h" -#include "progressivedownloadsourceuids.hrh" - -#include - -//void Panic(TInt aPanicCode); - -const TUid KUidProgressiveDlSource = {KProgressiveDownloadSourceUid}; - -void Panic(TInt aPanicCode) - { - _LIT(KProgressiveDownloadUtility, "ProgressiveDownloadUtility"); - User::Panic(KProgressiveDownloadUtility, aPanicCode); - } - -CAudioPdPlayUtility* CAudioPdPlayUtility::NewL(MAudioPdPlayUtilityCallback& aCallback) - { - CAudioPdPlayUtility* self = new(ELeave) CAudioPdPlayUtility(); - CleanupStack::PushL(self); - - self->iProperties = CAudioPdProperties::NewL(aCallback); - CleanupStack::Pop(self); - return self; - } - -CAudioPdPlayUtility::~CAudioPdPlayUtility() - { - delete iProperties; - } - -CAudioPdPlayUtility::CAudioPdPlayUtility() - { - - } - -void CAudioPdPlayUtility::ConstructL() - { - - } - -//For Download Status -void CAudioPdPlayUtility::HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue) - { - iProperties->HandleDownloadEventL(aTransactionID,aEvent,aValue); - } - - -void CAudioPdPlayUtility::Play() - { - iProperties->Play(); - } -void CAudioPdPlayUtility::Stop() - { - iProperties->Stop(); - } -TInt CAudioPdPlayUtility::Pause() - { - return iProperties->Pause(); - } -void CAudioPdPlayUtility::SetVolume(TInt aVolume) - { - iProperties->SetVolume(aVolume); - } -void CAudioPdPlayUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence) - { - iProperties->SetRepeats(aRepeatNumberOfTimes,aTrailingSilence); - } -void CAudioPdPlayUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) - { - iProperties->SetVolumeRamp(aRampDuration); - } -const TTimeIntervalMicroSeconds& CAudioPdPlayUtility::Duration() - { - return iProperties->Duration(); - } -TInt CAudioPdPlayUtility:: MaxVolume() - { - return iProperties->MaxVolume(); - } -void CAudioPdPlayUtility::Close() - { - iProperties->Close(); - } -TInt CAudioPdPlayUtility::GetPosition(TTimeIntervalMicroSeconds& aPosition) - { - return iProperties->GetPosition(aPosition); - } -void CAudioPdPlayUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition) - { - iProperties->SetPosition(aPosition); - } - -TInt CAudioPdPlayUtility::SetPriority(TInt aPriority, TMdaPriorityPreference aPref) - { - return iProperties->SetPriority(aPriority,aPref); - } -TInt CAudioPdPlayUtility::GetVolume(TInt& aVolume) - { - return iProperties->GetVolume(aVolume); - } -TInt CAudioPdPlayUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries) - { - return iProperties->GetNumberOfMetaDataEntries(aNumEntries); - } - - -CMMFMetaDataEntry* CAudioPdPlayUtility::GetMetaDataEntryL(TInt aMetaDataIndex) - { - return iProperties->GetMetaDataEntryL(aMetaDataIndex); - } - -TInt CAudioPdPlayUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd) - { - return iProperties->SetPlayWindow(aStart,aEnd); - } - -TInt CAudioPdPlayUtility::ClearPlayWindow() - { - return iProperties->ClearPlayWindow(); - } -TInt CAudioPdPlayUtility::SetBalance(TInt aBalance) - { - return iProperties->SetBalance(aBalance); - } -TInt CAudioPdPlayUtility::GetBalance(TInt& aBalance) - { - return iProperties->GetBalance(aBalance); - } -TInt CAudioPdPlayUtility::GetBitRate(TUint& aBitRate) - { - return iProperties->GetBitRate(aBitRate); - } - - -void CAudioPdPlayUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback) - { - iProperties->RegisterForAudioLoadingNotification(aCallback); - } - -void CAudioPdPlayUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress) - { - iProperties->GetAudioLoadingProgressL(aPercentageProgress); - } - -const CMMFControllerImplementationInformation& CAudioPdPlayUtility::ControllerImplementationInformationL() - { - return iProperties->ControllerImplementationInformationL(); - } - - -TInt CAudioPdPlayUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) - { - return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); - } -TInt CAudioPdPlayUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) - { - return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); - } -void CAudioPdPlayUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) - { - iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); - } -void CAudioPdPlayUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) - { - iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); - } - -void CAudioPdPlayUtility::OpenFileL(const TDesC& aFileName) - { - iProperties->OpenFileL(aFileName); - } - - -void CAudioPdPlayUtility::OpenFileL(const RFile& aFile) - { - RFile& file = const_cast(aFile); - iProperties->OpenFileL(file); - } - - -void CAudioPdPlayUtility::OpenFileL(const TMMSource& aSource) - { - iProperties->OpenFileL(aSource); - } - -void CAudioPdPlayUtility::DlCompleteOpenFileL(const TDesC& aFileName) - { - iProperties->DlCompleteOpenFileL(aFileName); - } - -TInt CAudioPdPlayUtility::GetFilePosition(TInt& aFilePosition) - { - return iProperties->GetFilePosition(aFilePosition); - } - -TInt CAudioPdPlayUtility::SetFileSize(TInt aFileSize) - { - return iProperties->SetFileSize(aFileSize); - } - -TInt CAudioPdPlayUtility::SetBytesDownloaded(TInt aBytesDownloaded, TBool aDownloadComplete) - { - return iProperties->SetBytesDownloaded(aBytesDownloaded,aDownloadComplete); - } - -MMMFDRMCustomCommand* CAudioPdPlayUtility::GetDRMCustomCommand() - { - //ASSERT(iProperties); - return iProperties->GetDRMCustomCommand(); - } - - -TInt CAudioPdPlayUtility::CheckAudioPlayerState() - { - return iProperties->CheckAudioPlayerState(); - } - - -//=============================================================== -// CAudioPdProperties implementation begins -// -//=============================================================== -CAudioPdProperties* CAudioPdProperties::NewL(MAudioPdPlayUtilityCallback& aCallback) - { - CAudioPdProperties* self = new(ELeave) CAudioPdProperties(aCallback); - CleanupStack::PushL(self); - self->ConstructL(aCallback); - CleanupStack::Pop(self); - return self; - } -CAudioPdProperties* CAudioPdProperties::NewLC(MAudioPdPlayUtilityCallback& /*aCallback*/) - { - return NULL; - } - -CAudioPdProperties::~CAudioPdProperties() - { - - delete iControllerImplementationInformation; - delete iAsyncCallBack; - delete iRepeatTrailingSilenceTimer; - delete iFindAndOpenController; - delete iControllerEventMonitor; - iMediaIds.Close(); - iController.Close(); - } - -CAudioPdProperties::CAudioPdProperties(/*MMdaAudioPlayerCallback*/MAudioPdPlayUtilityCallback& aCallback): - iCallback(aCallback), - iAudioPlayDeviceCommands(iController), - iAudioPlayControllerCommands(iController), - iDRMCustomCommands(iController) - { - iState = EStopped; - iPrioritySettings.iPriority = KAudioPriorityRealOnePlayer;//80 - iPrioritySettings.iPref =(TMdaPriorityPreference) KAudioPrefRealOneLocalPlayback;// 0x01420001; - iPlayStart = TTimeIntervalMicroSeconds(0); - iPlayEnd = TTimeIntervalMicroSeconds(0); - iPlayWindowSet = ENone; - iSourceHandle = NULL; - } - -void CAudioPdProperties::ConstructL(MAudioPdPlayUtilityCallback& /*aCallback*/) - { - - iControllerEventMonitor = CMMFControllerEventMonitor::NewL(*this, iController); - iRepeatTrailingSilenceTimer = CRepeatTrailingSilenceTimer::NewL(*this); - iAsyncCallBack = CMMFMdaAudioPlayerCallBack::NewL(iCallback); - User::LeaveIfError(iMediaIds.Append(KUidMediaTypeAudio)); - iFindAndOpenController = CMMFFindAndOpenController::NewL(*this); - iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings); - iFindAndOpenController->ConfigureController(iController, *iControllerEventMonitor, CMMFFindAndOpenController::EPlayback); - - } - -void CAudioPdProperties::MfaocComplete( - TInt& aError, - RMMFController* /*aController*/, - TUid aControllerUid, - TMMFMessageDestination* aSourceHandle, - TMMFMessageDestination* /*aSinkHandle*/) - { - - iSourceHandle = aSourceHandle; - - if (aError == KErrNone) - { - iControllerUid = aControllerUid; - - // Get the clip duration - iDuration = TTimeIntervalMicroSeconds(0); - aError = iController.GetDuration(iDuration); - - // If an error occurred in any of the above, close the controller. - if (aError != KErrNone) - { - iControllerEventMonitor->Cancel(); - iController.Close(); - } - } - - iAsyncCallBack->InitComplete(aError, iDuration); - } - -void CAudioPdProperties::HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue) - { - iCallback.HandleDownloadEventL(aTransactionID,aEvent,aValue); - - } - - -void CAudioPdProperties::OpenFileL(const TDesC& aFileName) - { - TMMFileSource filesource(aFileName, ContentAccess::KDefaultContentObject, ContentAccess::EPlay); - OpenFileL(filesource); - } - - -void CAudioPdProperties::OpenFileL(const RFile& aFile) - { - RFile& file = const_cast(aFile); - TMMFileHandleSource filesource(file, KNullDesC, ContentAccess::EPlay); - OpenFileL(filesource); - } - -void CAudioPdProperties::OpenFileL(const TMMSource& aSource) - { - // If iAsyncCallBack is already active, we're still in the process of notifying the client - // that a previous request to Open...(...) has completed. - if (iAsyncCallBack->IsActive()) - User::Leave(KErrNotReady); - - - if (aSource.SourceType()==KUidMMFileHandleSource) - { - - RFile& fileHandle = static_cast(aSource).Handle(); - - iFindAndOpenController->ConfigureSourceSink( - CMMFFindAndOpenController::TSourceSink(KUidProgressiveDlSource,fileHandle), - CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput)); - - } - if (aSource.SourceType()==KUidMMFileSource) - { - const TDesC& fileName = static_cast(aSource).Name(); - - iFindAndOpenController->ConfigureSourceSink( - CMMFFindAndOpenController::TSourceSink(KUidProgressiveDlSource, - CMMFFindAndOpenController::GetConfigFile(fileName)), - CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput)); - - } - - iFindAndOpenController->OpenByFileSource(aSource); - } - -void CAudioPdProperties::DlCompleteOpenFileL(const TDesC& aFileName) - { - if (iAsyncCallBack->IsActive()) - User::Leave(KErrNotReady); - - Close(); - - TMMFileSource filesource(aFileName, ContentAccess::KDefaultContentObject, ContentAccess::EPlay); - - - iFindAndOpenController->ConfigureSourceSink( - TMMFileSource(aFileName, filesource.UniqueId(), filesource.Intent(), filesource.IsUIEnabled()), - CMMFFindAndOpenController::TSourceSink(KUidMmfAudioOutput)); - - iFindAndOpenController->OpenByFileSource(filesource); - - - } - - -void CAudioPdProperties::Play() - { - // if we're already playing, call the client's callback with KErrNotReady. - // This is what the controller would do if we allowed the Play() - // to propagate down. Need to do it here too (for consistency) - // in case we're in a trailing silence period. - if (iState == EPlaying) - { - iAsyncCallBack->PlayComplete(KErrNotReady); - return; - } - - // cancel the repeat timer in case the client has called Play() - // without waiting for the previous play to complete - iRepeatTrailingSilenceTimer->Cancel(); - // Reset played count - iNumberOfTimesPlayed = 0; - - DoPlay(); - } - -void CAudioPdProperties::DoPlay() - { -#if defined(__AUDIO_PROFILING) - RDebug::ProfileStart(4); -#endif // defined(__AUDIO_PROFILING) - TInt err = KErrNone; - if (iState != EPaused) - { - err = iController.Prime(); - -#if defined(__AUDIO_PROFILING) - RDebug::ProfileEnd(4); -#endif // defined(__AUDIO_PROFILING) - - // make sure we don't set the position outside the play window - - // but allow it to remain unchanged if it's within the window - if (iPlayWindowSet == ESet && - (iPosition < iPlayStart || iPosition >= iPlayEnd)) - iPosition = iPlayStart; - - if (err==KErrNone) - err = iController.SetPosition(iPosition); - } - - if (err==KErrNone) - { - if (iPlayWindowSet == ESet) - err = iAudioPlayControllerCommands.SetPlaybackWindow(iPlayStart, iPlayEnd); - else if (iPlayWindowSet == EClear) - { - err = iAudioPlayControllerCommands.DeletePlaybackWindow(); - iPlayWindowSet = ENone; // assume window will stay cleared - } - } - - if (err==KErrNone) - { -#if defined(__AUDIO_PROFILING) - RDebug::ProfileStart(5); -#endif // defined(__AUDIO_PROFILING) - - err = iController.Play(); - -#if defined(__AUDIO_PROFILING) - RDebug::ProfileEnd(5); -#endif // defined(__AUDIO_PROFILING) - } - - if (err!=KErrNone) - iAsyncCallBack->PlayComplete(err); - else - { - iState = EPlaying; - iCallback.Playing(); - } - } - - -void CAudioPdProperties::Stop() - { - if (iState==EPlaying || iState==EPaused) - { - // cancel the repeat timer in case the client has called Stop() - // during the trailing silence period - iRepeatTrailingSilenceTimer->Cancel(); - - iController.Stop(); - iPosition = iPlayStart; - iState = EStopped; - } - - } -TInt CAudioPdProperties::Pause() - { - TInt err = KErrNone; - if (iState==EPlaying) - { - err = iController.Pause(); - if (!err || err==KErrNotReady) - err = iController.GetPosition(iPosition); - iState = EPaused; - iCallback.Paused(); - } - return err; - } -void CAudioPdProperties::SetVolume(TInt aVolume) - { - TInt err = iAudioPlayDeviceCommands.SetVolume(aVolume); - - __ASSERT_ALWAYS(err==KErrNone, Panic(EMMFMediaClientBadArgument)); - } -void CAudioPdProperties::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence) - { - iNumberOfTimesToRepeat = aRepeatNumberOfTimes; - iTrailingSilence = aTrailingSilence; - } -void CAudioPdProperties::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) - { - iAudioPlayDeviceCommands.SetVolumeRamp(aRampDuration); - } -const TTimeIntervalMicroSeconds& CAudioPdProperties::Duration() - { - TInt err = iController.GetDuration(iDuration); - if (err) - { - iDuration = 0; - } - return iDuration; - } -TInt CAudioPdProperties:: MaxVolume() - { - TInt maxVolume = 0; -#ifdef _DEBUG - TInt error = -#endif - iAudioPlayDeviceCommands.GetMaxVolume(maxVolume); - __ASSERT_DEBUG(error==KErrNone, Panic(EMMFMediaClientPanicServerCommunicationProblem)); - return maxVolume; - } -void CAudioPdProperties::Close() - { - // Reset the audio player state. - Stop(); - iControllerEventMonitor->Cancel(); - iController.Close(); - } -TInt CAudioPdProperties::GetPosition(TTimeIntervalMicroSeconds& aPosition) - { - TInt error = KErrNone; -// if (iState==EPlaying) - //For progressivedownload pause and resume I need to get the - //last position even if not playing. - error = iController.GetPosition(iPosition); - - aPosition = iPosition; - return error; - } -void CAudioPdProperties::SetPosition(const TTimeIntervalMicroSeconds& aPosition) - { - // Clip the position if aPosition is greater than the duration - // or if aPosition is negative. - const TTimeIntervalMicroSeconds maxPosition(Duration()); - const TTimeIntervalMicroSeconds minPosition(0); - - if (aPosition > maxPosition) - iPosition = maxPosition; - else if (aPosition < minPosition) - iPosition = minPosition; - else - iPosition = aPosition; - - if (iState==EPlaying || iState==EPaused || iState == EStopped) - { - iController.SetPosition(iPosition); - } -// else if (iState == EPaused) -// { -// Stop(); // We call stop so that DevSound's internal buffers are reset -// } - } - -TInt CAudioPdProperties::SetPriority(TInt aPriority, TMdaPriorityPreference aPref) - { - iPrioritySettings.iPref = aPref; - iPrioritySettings.iPriority = aPriority; - iFindAndOpenController->Configure(iMediaIds[0], iPrioritySettings); - - return iController.SetPrioritySettings(iPrioritySettings); - } -TInt CAudioPdProperties::GetVolume(TInt& aVolume) - { - TInt error = iAudioPlayDeviceCommands.GetVolume(aVolume); - return error; - } -TInt CAudioPdProperties::GetNumberOfMetaDataEntries(TInt& aNumEntries) - { - TInt error = iController.GetNumberOfMetaDataEntries(aNumEntries); - return error; - } - - -CMMFMetaDataEntry* CAudioPdProperties::GetMetaDataEntryL(TInt aMetaDataIndex) - { - return iController.GetMetaDataEntryL(aMetaDataIndex); - } - -TInt CAudioPdProperties::SetPlayWindow(const TTimeIntervalMicroSeconds& aPlayStart, - const TTimeIntervalMicroSeconds& aPlayEnd) - { - TInt error = KErrNone; - - if (aPlayStart >= TTimeIntervalMicroSeconds(0) && - aPlayStart < iDuration && - aPlayStart < aPlayEnd && - aPlayEnd <= iDuration ) - { - iPlayStart = aPlayStart; - iPlayEnd = aPlayEnd; - iPlayWindowSet = ESet; - - if (iState==EPlaying) - error = iAudioPlayControllerCommands.SetPlaybackWindow(aPlayStart, aPlayEnd); - } - else - error = KErrArgument; - - return error; - } - -TInt CAudioPdProperties::ClearPlayWindow() - { - // clear play window start - very important because this is assigned - // to iPosition when we stop & is used to set the position on the next Play() - iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0); - - iPlayWindowSet = EClear; - TInt err = KErrNone; - if (iState==EPlaying) - err = iAudioPlayControllerCommands.DeletePlaybackWindow(); - return err; - } -TInt CAudioPdProperties::SetBalance(TInt aBalance) - { - TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance); - return err; - } -TInt CAudioPdProperties::GetBalance(TInt& aBalance) - { - TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance); - return err; - } - -TInt CAudioPdProperties::GetBitRate(TUint& aBitRate) - { - RMMFAudioControllerCustomCommands controller(iController); - TInt err = controller.GetSourceBitRate(aBitRate); - return err; - } - -void CAudioPdProperties::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver) - { - iLoadingObserver = &aLoadingObserver; - } - -void CAudioPdProperties::GetAudioLoadingProgressL(TInt& aPercentageProgress) - { - User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress)); - } - -const CMMFControllerImplementationInformation& CAudioPdProperties::ControllerImplementationInformationL() - { - if (!iControllerImplementationInformation) - { - if (iControllerUid==KNullUid) - User::Leave(KErrNotReady); - iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid); - } - return *iControllerImplementationInformation; - } - -TInt CAudioPdProperties::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) - { - return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); - } -TInt CAudioPdProperties::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) - { - return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); - } -void CAudioPdProperties::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) - { - iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); - } -void CAudioPdProperties::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) - { - iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); - } - -TInt CAudioPdProperties::GetFilePosition(TInt& aFilePosition) - { - TInt err = KErrNone; - TPckgBuf dataFrom; - - if(iSourceHandle != NULL) - { - TMMFMessageDestinationPckg destPckg(*iSourceHandle); - err =CustomCommandSync(destPckg, EGETFILEPOSITION, KNullDesC8, KNullDesC8, dataFrom); - } - else - { - err = KErrNotFound; - } - - if(err==KErrNone) - aFilePosition = dataFrom(); - - return err; - } - -TInt CAudioPdProperties::SetFileSize(TInt aFileSize) - { - TInt err = KErrNone; - if(iSourceHandle != NULL) - { - TMMFMessageDestinationPckg destPckg(*iSourceHandle); - TPckgBuf data1(aFileSize); - err = CustomCommandSync(destPckg, ESETFILESIZE, data1, KNullDesC8); - } - else - { - err = KErrNotFound; - } - return err; - } - -TInt CAudioPdProperties::SetBytesDownloaded(TInt aBytesDownloaded, TBool /*aDownloadComplete*/) - { - TInt err = KErrNone; - if(iSourceHandle != NULL) - { - TMMFMessageDestinationPckg destPckg(*iSourceHandle); - TPckgBuf data1(aBytesDownloaded); - err = CustomCommandSync(destPckg, ESETBYTESDOWNLOADED, data1, KNullDesC8); - } - else - { - err = KErrNotFound; - } - - return err; - } - - -MMMFDRMCustomCommand* CAudioPdProperties::GetDRMCustomCommand() - { - if (iDRMCustomCommands.IsSupported()) - { - return static_cast(&iDRMCustomCommands); - } - else - { - return NULL; - } - } - - -TInt CAudioPdProperties::CheckAudioPlayerState() - { - return iState; - } -void CAudioPdProperties::HandleEvent(const TMMFEvent& aEvent) - { - // handle loading started/complete messages first, as the later code does not explicitly check the event type - if (aEvent.iEventType==KMMFEventCategoryAudioLoadingStarted) - { - if (iLoadingObserver) - iLoadingObserver->MaloLoadingStarted(); - } - else if (aEvent.iEventType==KMMFEventCategoryAudioLoadingComplete) - { - if (iLoadingObserver) - iLoadingObserver->MaloLoadingComplete(); - } - else if (aEvent.iEventType==KMMFEventCategoryPlaybackComplete) - { - TInt oldState = iState; - iPosition = iPlayStart; - if (aEvent.iErrorCode == KErrNone) - { - //If we weren't playing, ignore the event. - if(oldState == EPlaying) - { - //we finished playing the clip so repeat if required - iNumberOfTimesPlayed++; - if ((iNumberOfTimesPlayed>iNumberOfTimesToRepeat) && (iNumberOfTimesToRepeat!=KMdaRepeatForever)) - { - //we've repeated enough times now - iNumberOfTimesPlayed = 0; - iState = EStopped; - iCallback.MapcPlayComplete(KErrNone); - } - else - { - // We need to repeat the clip - // we're truncating the trailingsilence here so maximum time is ~37mins - TTimeIntervalMicroSeconds32 silence = I64INT(iTrailingSilence.Int64()); - iRepeatTrailingSilenceTimer->After(silence); - } - } - } - else - { //aEvent.iErrorCode != KErrNone - //if we weren't playing, don't advise Client. - iState = EStopped; - if(oldState == EPlaying) - iCallback.MapcPlayComplete(aEvent.iErrorCode); - } - } - - // else we have an unexpected event that cannot be dealt with by the client. - // We will simply ignore this. - } - - -void CAudioPdProperties::RepeatTrailingSilenceTimerComplete() - { - // reset the position for subsequent plays - iPosition = iPlayStart; - DoPlay(); - } - - -CRepeatTrailingSilenceTimer* CRepeatTrailingSilenceTimer::NewL(MRepeatTrailingSilenceTimerObs& aObs) - { - CRepeatTrailingSilenceTimer* s = new(ELeave) CRepeatTrailingSilenceTimer(aObs); - CleanupStack::PushL(s); - s->ConstructL(); - CleanupStack::Pop(); - return s; - } - -void CRepeatTrailingSilenceTimer::RunL() - { - iObs.RepeatTrailingSilenceTimerComplete(); - } - -CRepeatTrailingSilenceTimer::CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs) : - CTimer(EPriorityHigh), - iObs(aObs) - { - CActiveScheduler::Add(this); - } - - -CMMFMdaAudioPlayerCallBack* CMMFMdaAudioPlayerCallBack::NewL(MAudioPdPlayUtilityCallback& aCallback) - { - return new(ELeave) CMMFMdaAudioPlayerCallBack(aCallback); - } - -CMMFMdaAudioPlayerCallBack::CMMFMdaAudioPlayerCallBack(MAudioPdPlayUtilityCallback& aCallback) : - CActive(CActive::EPriorityHigh), iCallback(aCallback) - { - CActiveScheduler::Add(this); - } - -CMMFMdaAudioPlayerCallBack::~CMMFMdaAudioPlayerCallBack() - { - Cancel(); - } - -void CMMFMdaAudioPlayerCallBack::InitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) - { - iError = aError; - iDuration = aDuration; - iState = ECallbackInitComplete; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - -void CMMFMdaAudioPlayerCallBack::PlayComplete(TInt aError) - { - iError = aError; - iState = ECallbackPlayComplete; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - - -void CMMFMdaAudioPlayerCallBack::PlayingCallback() - { - iState = ECallbackPlaying; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - -void CMMFMdaAudioPlayerCallBack::PausedCallback() - { - iState = ECallbackPaused; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - - -void CMMFMdaAudioPlayerCallBack::RunL() - { - switch (iState) - { - case ECallbackInitComplete: - iCallback.MapcInitComplete(iError, iDuration); - break; - case ECallbackPlayComplete: - iCallback.MapcPlayComplete(iError); - break; - case ECallbackPlaying: - iCallback.Playing(); - break; - case ECallbackPaused: - iCallback.Paused(); - break; - - } - } - -void CMMFMdaAudioPlayerCallBack::DoCancel() - { - // Nothing to cancel - } - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/AudioPdPlayUtility.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/AudioPdPlayUtility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,126 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - -#ifndef __CAUDIOPDPLAYUTILITY_H__ -#define __CAUDIOPDPLAYUTILITY_H__ - -#include -#include -#include -#include "MAudioPdPlayUtility.h" - - - -class CAudioPdProperties; - -/** -Concrete implementation of the CAudioPdPlayUtility API. -@see CAudioPdPlayUtility -*/ - -class CAudioPdPlayUtility: public CBase, - public MAudioPdPlayUtility - //public MAudioPdPlayUtilityCallback - { - -public: - - - - static CAudioPdPlayUtility* NewL(MAudioPdPlayUtilityCallback& aCallback); - - ~CAudioPdPlayUtility(); - - //For Download Status - void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue); - - //For Audio control - void Play(); - void Stop(); - TInt Pause(); - void SetVolume(TInt aVolume); - void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); - void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); - const TTimeIntervalMicroSeconds& Duration(); - TInt MaxVolume(); - void Close(); - TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); - void SetPosition(const TTimeIntervalMicroSeconds& aPosition); - - TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); - TInt GetVolume(TInt& aVolume); - TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); - CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); - TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd); - TInt ClearPlayWindow(); - TInt SetBalance(TInt aBalance = KMMFBalanceCenter); - TInt GetBalance(TInt& aBalance); - TInt GetBitRate(TUint& aBitRate); - - void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); - void GetAudioLoadingProgressL(TInt& aPercentageProgress); - const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); - - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); - - - - MMMFDRMCustomCommand* GetDRMCustomCommand(); - - - void OpenFileL(const TDesC& aFileName); - - - void OpenFileL(const RFile& aFile); - - void OpenFileL(const TMMSource& aSource); - - - void DlCompleteOpenFileL(const TDesC& aFileName); - - //Source CustomCommands - TInt GetFilePosition(TInt& aFilePosition); - TInt SetFileSize(TInt aFileSize); - TInt SetBytesDownloaded(TInt aBytesDownloaded, TBool aDownloadComplete); - - TInt CheckAudioPlayerState(); - - -protected: - -private: - - - CAudioPdPlayUtility(); - void ConstructL(); - - - - - CAudioPdProperties* iProperties; - - - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/AudioPdProperties.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/AudioPdProperties.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,262 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - -#ifndef __AUDIOPDPLAYPROPERTIES_H__ -#define __AUDIOPDPLAYPROPERTIES_H__ - - - -#include -#include -#include -#include "MAudioPlayUtility.h" -#include "AudioPdPlayUtility.h" - - -#include "MmfClientUtility.h" - -#include - -static const TUid KUidMmfAudioController = {KMmfUidControllerAudio}; - -/** -Mixin class to allow notification that the timed silence has finished. -*/ -class MRepeatTrailingSilenceTimerObs - { -public: - virtual void RepeatTrailingSilenceTimerComplete() = 0; - }; - -/** -CTimer-based active object that waits the requested time before notifying its observer. -*/ -class CRepeatTrailingSilenceTimer : public CTimer - { -public: - static CRepeatTrailingSilenceTimer* NewL(MRepeatTrailingSilenceTimerObs& aObs); - void RunL(); -private: - CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs); -private: - MRepeatTrailingSilenceTimerObs& iObs; - }; - -/** -Active object utility class to allow the callback to be called asynchronously. -This should help prevent re-entrant code in clients of the mediaframework. -*/ -class CMMFMdaAudioPlayerCallBack : public CActive - { -public: - enum TCallbackState { - ECallbackInitComplete, - ECallbackPlayComplete, - ECallbackPlaying, - ECallbackPaused - }; - - -public: - static CMMFMdaAudioPlayerCallBack* NewL(MAudioPdPlayUtilityCallback& aCallback); - ~CMMFMdaAudioPlayerCallBack(); - void InitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); - void PlayComplete(TInt aError); - void PlayingCallback(); - void PausedCallback(); -private: - CMMFMdaAudioPlayerCallBack(MAudioPdPlayUtilityCallback& aCallback); - void RunL(); - void DoCancel(); -private: - MAudioPdPlayUtilityCallback& iCallback; - TInt iError; - TTimeIntervalMicroSeconds iDuration; - TCallbackState iState; - }; - - - -/** -Concrete implementation of the CAudioPdPlayUtility API. -@see CAudioPdPlayUtility -*/ - -class CAudioPdProperties: public CBase, - // public MAudioPdPlayUtility //may not be necessary - public MMMFControllerEventMonitorObserver, - public MRepeatTrailingSilenceTimerObs, - public MMMFFindAndOpenControllerObserver - { - -public: - - friend class CAudioPdPlayUtility; - - - enum TMMFAudioPlayerState - { - EStopped, - EOpening, - EPaused, - EPlaying - }; - - static CAudioPdProperties* NewL(MAudioPdPlayUtilityCallback& aCallback); - static CAudioPdProperties* NewLC(MAudioPdPlayUtilityCallback& aCallback); - - ~CAudioPdProperties(); - - - //For Download Status - void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue); - - - //For Audio control - void Play(); - void Stop(); - TInt Pause(); - void SetVolume(TInt aVolume); - void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); - void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); - const TTimeIntervalMicroSeconds& Duration(); - TInt MaxVolume(); - void Close(); - TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); - void SetPosition(const TTimeIntervalMicroSeconds& aPosition); - - TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); - TInt GetVolume(TInt& aVolume); - TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); - CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); - TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd); - TInt ClearPlayWindow(); - TInt SetBalance(TInt aBalance = KMMFBalanceCenter); - TInt GetBalance(TInt& aBalance); - TInt GetBitRate(TUint& aBitRate); - - void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); - void GetAudioLoadingProgressL(TInt& aPercentageProgress); - const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); - - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); - - - MMMFDRMCustomCommand* GetDRMCustomCommand(); - - - // from MMMFControllerEventMonitorObserver - virtual void HandleEvent(const TMMFEvent& aEvent); - // from MRepeatTrailingSilenceTimerObs - virtual void RepeatTrailingSilenceTimerComplete(); - - // from MMMFFindAndOpenControllerObserver - virtual void MfaocComplete( - TInt& aError, - RMMFController* aController, - TUid aControllerUid, - TMMFMessageDestination* aSourceHandle, - TMMFMessageDestination* aSinkHandle); - - - void OpenFileL(const TDesC& aFileName); - - - void OpenFileL(const RFile& aFile); - - void OpenFileL(const TMMSource& aSource); - - - void DlCompleteOpenFileL(const TDesC& aFileName); - - TInt GetFilePosition(TInt& aFilePosition); - TInt SetFileSize(TInt aFileSize); - TInt SetBytesDownloaded(TInt aBytesDownloaded, TBool aDownloadComplete); - - TInt CheckAudioPlayerState(); - - void DoPlay(); - -protected: - -private: - CAudioPdProperties(/*MMdaAudioPlayerCallback*/MAudioPdPlayUtilityCallback& aCallback); - void ConstructL(MAudioPdPlayUtilityCallback& aCallback); - - - MAudioPdPlayUtilityCallback* iAudioPdPlayCallback; - - // last play window command - enum TPlayWindowCommand - { - ENone, - ESet, - EClear - }; - - /*MMdaAudioPlayerCallback*/MAudioPdPlayUtilityCallback& iCallback; - CMMFMdaAudioPlayerCallBack* iAsyncCallBack; - MAudioLoadingObserver* iLoadingObserver; - RMMFController iController; - CMMFControllerEventMonitor* iControllerEventMonitor; - TMMFAudioPlayerState iState; - TTimeIntervalMicroSeconds iDuration; // Needed because of api "Duration()" that returns a reference - TMMFPrioritySettings iPrioritySettings; - - TInt iNumberOfTimesPlayed; - TInt iNumberOfTimesToRepeat; - TTimeIntervalMicroSeconds iTrailingSilence; - CRepeatTrailingSilenceTimer* iRepeatTrailingSilenceTimer; - - // Source and sink handle info - TMMFMessageDestination* iSourceHandle; - TMMFMessageDestination iSinkHandle; - - // Custom command handlers - RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCommands; - RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCommands; - - - RMMFDRMCustomCommands iDRMCustomCommands; - - - // Current playback time so we can resume from where we were stopped - TTimeIntervalMicroSeconds iPosition; - - // Play window start and end times and whether it has been set - TTimeIntervalMicroSeconds iPlayStart; - TTimeIntervalMicroSeconds iPlayEnd; - TPlayWindowCommand iPlayWindowSet; - RArray iMediaIds; - - CMMFControllerImplementationInformation* iControllerImplementationInformation; - TUid iControllerUid; - - // utility class to find and open a suitable controller asynchronously - CMMFFindAndOpenController* iFindAndOpenController; - - - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/BufferEmptiedEventAO.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/BufferEmptiedEventAO.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Implementation of the BufTypeSupEventAO class. -* -*/ - - -#include "BufferEmptiedEventAO.h" -#include - -using namespace multimedia; - -CBufferEmptiedEventAO::CBufferEmptiedEventAO(MBufferEmptiedObserver& aObserver ) -: CActive(CActive::EPriorityStandard), -iObserver(aObserver), -iError(KErrNone) - { - CActiveScheduler::Add(this); - } - -CBufferEmptiedEventAO::~CBufferEmptiedEventAO() - { - Cancel(); - } - -CBufferEmptiedEventAO* CBufferEmptiedEventAO::NewL( MBufferEmptiedObserver& aObserver ) - { - CBufferEmptiedEventAO* self = new (ELeave)CBufferEmptiedEventAO( aObserver ); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -void CBufferEmptiedEventAO::ConstructL() - { - } - -void CBufferEmptiedEventAO::SetActive() - { - if (!IsActive()) - { - CActive::SetActive(); - } - } - -TInt CBufferEmptiedEventAO::Error() - { - return iError; - } - -// From CActive -void CBufferEmptiedEventAO::RunL() - { - // Save the error code - iError = iStatus.Int(); - // Signal the observer that this request is serviced - iObserver.BufferEmptiedBySource(); - } - -void CBufferEmptiedEventAO::DoCancel() - { - if(iStatus.Int() != 0) - { - TRequestStatus* status = &iStatus; - User::RequestComplete(status,KErrCancel); - } - } - -TInt CBufferEmptiedEventAO::RunError( TInt /*aError*/ ) - { - return KErrNone; - } - -void CBufferEmptiedEventAO::SetBuffer(MDataBuffer* aBuffer) - { - iBuffer = aBuffer; - } - -MDataBuffer* CBufferEmptiedEventAO::GetBuffer() - { - return iBuffer; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/BufferEmptiedEventAO.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/BufferEmptiedEventAO.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Definition of the BufTypeSupEventAO class. -* -*/ - - -#ifndef BUFFEREMPTIEDEVENTAO_H -#define BUFFEREMPTIEDEVENTAO_H - -// INCLUDES -#include - -namespace multimedia - { - - class MDataBuffer; - // Observer - class MBufferEmptiedObserver - { - public: - virtual void BufferEmptiedBySource() = 0; - }; - - /** - * Class to encapsulate a queue item. - */ - class CBufferEmptiedEventAO : public CActive - { - public: // Constructors and destructor - static CBufferEmptiedEventAO* NewL(MBufferEmptiedObserver&); - virtual ~CBufferEmptiedEventAO(); - - void SetActive(); - TInt Error(); - - void SetBuffer(MDataBuffer* aBuffer); - MDataBuffer* GetBuffer(); - - protected: - // From CActive - void RunL(); - void DoCancel(); - TInt RunError( TInt aError ); - - private: - CBufferEmptiedEventAO( MBufferEmptiedObserver& aObserver ); - void ConstructL(); - - private: - MBufferEmptiedObserver& iObserver; - MDataBuffer* iBuffer; - TInt iError; - }; - } -#endif // BUFTYPESUPEVENTAO_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/ContentFile.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/ContentFile.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,178 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Implementation of ContentFile Classes. -* -*/ - -#include -#include -#include -#include - -using namespace ContentAccess; - -#include "ContentFile.h" - - -CContentFile::~CContentFile() - { - delete iData; - - if (iLegacyFileOpen) - iLegacyFile.Close(); - delete iFilePath; - } - - -CContentFile* CContentFile::NewL(RFs& aSession, const TDesC& aFilePath, const TDesC& aUniqueId, TUint aMode, TBool aEnableUI) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aSession, aFilePath, aUniqueId, aMode, aEnableUI); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint /*aMode*/, TBool aEnableUI) - { - iSession = &aSession; - iFilePath = aPath.AllocL(); - - // Assume that we want the content to be shared and read-only. - if (aUniqueId.Length() > 0) - { - iData = CData::NewL(TVirtualPathPtr(*iFilePath, aUniqueId), EContentShareReadWrite); - } - else - { - iData = CData::NewL(TVirtualPathPtr(*iFilePath), EContentShareReadWrite); - } - - TInt err = iData->SetProperty(EAgentPropertyAgentUI, aEnableUI); - if (err != KErrNone && err != KErrCANotSupported) - { - User::Leave(err); - } - User::LeaveIfError(iData->EvaluateIntent(EPeek)); - } - - - -TInt CContentFile::EvaluateIntent(TIntent aIntent) const - { - ASSERT(iData); - return iData->EvaluateIntent(aIntent); - } - - -TInt CContentFile::ExecuteIntent(TIntent aIntent) - { - ASSERT(iData); - return iData->ExecuteIntent(aIntent); - } - -TBool CContentFile::IsProtected() const - { - ASSERT(iData); - TInt value = 0; - TInt err =iData->GetAttribute(EIsProtected, value); - return (err == KErrNone && value); - } - -TInt CContentFile::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) - { - ASSERT(iData); - return iData->SetProperty(aProperty, aValue); - } - -TInt CContentFile::Seek(TSeek aSeekMode, TInt& aPos) - { - ASSERT(iData); - return iData->Seek(aSeekMode, aPos); - } - -TInt CContentFile::Read(TDes8& aDes,TInt aLength) - { - ASSERT(iData); - return iData->Read(aDes,aLength); - } - -void CContentFile::Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus) - { - ASSERT(iData); - iData->Read(aDes, aLength, aStatus); - } - -TInt CContentFile::Write(const TDesC8& /*aDes*/,TInt /*aLength*/) - { - return KErrAccessDenied; - } -void CContentFile::Write(const TDesC8& /*aDes*/, TInt /*aLength*/, TRequestStatus& aStatus) - { - TRequestStatus* status = &aStatus; - User::RequestComplete(status, KErrAccessDenied); - } - -TInt CContentFile::SetSize(TInt /*aSize*/) - { - // Only a source is implemented, hence this cannot be allowed - return KErrAccessDenied; - } - - -// Get the size of file -// this method opens a new, read-only, RFile the first time this method is called - -TInt CContentFile::Size(TInt& aSize) - { - ASSERT(iData); - TRAPD(err, iData->DataSizeL(aSize)); - return err; - } - - /** - * return a RFile for the legacy RFile method - * this method opens a new, read-only, RFile the first time this method is called - * @internalTechnology - * @return Reference to RFile handle to current file -*/ -RFile& CContentFile::FileL() - { - if (!iLegacyFileOpen) - { - User::LeaveIfError(iLegacyFile.Open(*iSession, *iFilePath, EFileRead | EFileStream | EFileShareReadersOnly)); - iLegacyFileOpen = ETrue; - } - return iLegacyFile; - } - -CContentFile* CContentFile::NewL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI) - { - CContentFile* self = new (ELeave) CContentFile; - CleanupStack::PushL(self); - self->ConstructL(aFile, aUniqueId, aEnableUI); - CleanupStack::Pop(self); - return self; - } - -void CContentFile::ConstructL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI) - { - iData = CData::NewL(aFile, aUniqueId); - TInt err = iData->SetProperty(EAgentPropertyAgentUI, aEnableUI); - if (err != KErrNone && err != KErrCANotSupported) - { - User::Leave(err); - } - User::LeaveIfError(iData->EvaluateIntent(EPeek)); - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/ContentFile.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/ContentFile.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Header of ContentFile Classes. -* -*/ - -#ifndef __CONTENT_FILE_H__ -#define __CONTENT_FILE_H__ - -#include -#include -#include - -// Provides content access framework based file access -class CContentFile : public CBase - { - public: - static CContentFile* NewL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint aMode, TBool aEnableUI); - void ConstructL(RFs& aSession, const TDesC& aPath, const TDesC& aUniqueId, TUint aMode, TBool aEnableUI); - - static CContentFile* NewL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI); - void ConstructL(RFile& aFile, const TDesC& aUniqueId, TBool aEnableUI); - - virtual ~CContentFile(); - - // from MGenericFile - virtual TInt Seek(TSeek aSeekMode, TInt& aPosition); - virtual TInt Read(TDes8& aDes,TInt aLength); - virtual void Read(TDes8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Write(const TDesC8& aDes,TInt aLength); - virtual void Write(const TDesC8& aDes, TInt aLength, TRequestStatus& aStatus); - virtual TInt Size(TInt& aSize); - virtual TInt SetSize(TInt aSize); - virtual TInt EvaluateIntent(const ContentAccess::TIntent aIntent) const; - virtual TInt ExecuteIntent(const ContentAccess::TIntent aIntent); - virtual TBool IsProtected() const; - virtual RFile& FileL(); - - virtual TInt SetAgentProperty(ContentAccess::TAgentProperty, TInt aValue); - - private: - CContentFile(); - - - private: - RFs* iSession; // not owned - HBufC* iFilePath; - ContentAccess::CData* iData; - - RFile iLegacyFile; - TBool iLegacyFileOpen; - }; - -inline CContentFile::CContentFile() - { - } - -#endif //__CONTENT_FILE_H__ diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/EMCPdPlayUtility.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/EMCPdPlayUtility.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1573 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - -#include -#include -#include -#include "EMCPdPlayUtility.h" -#include "EMCPdProperties.h" -#include "MProgressiveDownloadUtility.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -_LIT8(KWMAMimeType,"audio/x-ms-wma"); - -using namespace ContentAccess; -using namespace DRM; - -#ifdef _DEBUG -#define DEBPRN1(str) RDebug::Print(str); -#define DEBPRN2(str, val1) RDebug::Print(str, val1); -#define DEBPRN3(str, val1, val2) RDebug::Print(str, val1, val2); -#define DEBPRN4(str, val1, val2, val3) RDebug::Print(str, val1, val2, val3); -#define DEBPRN5(str, val1, val2, val3, val4) RDebug::Print(str, val1, val2, val3, val4); -#else -#define DEBPRN1(str) -#define DEBPRN2(str, val1) -#define DEBPRN3(str, val1, val2) -#define DEBPRN4(str, val1, val2, val3) -#define DEBPRN5(str, val1, val2, val3, val4) -#endif // _DEBUG - -const TInt KNumberOfBuffers = 10; -//const TUid KUidProgressiveDlSource = {KProgressiveDownloadSourceUid}; -const TInt KBufferingAmount = 40960; - -void Panic(TInt aPanicCode) - { - _LIT(KProgressiveDownloadUtility, "ProgressiveDownloadUtility"); - User::Panic(KProgressiveDownloadUtility, aPanicCode); - } - -CAudioPdPlayUtility* CAudioPdPlayUtility::NewL(MAudioPdPlayUtilityCallback& aCallback) - { - CAudioPdPlayUtility* self = new(ELeave) CAudioPdPlayUtility(); - CleanupStack::PushL(self); - - self->iProperties = CAudioPdProperties::NewL(aCallback); - CleanupStack::Pop(self); - return self; - } - -CAudioPdPlayUtility::~CAudioPdPlayUtility() - { - delete iProperties; - } - -CAudioPdPlayUtility::CAudioPdPlayUtility() - { - - } - -void CAudioPdPlayUtility::ConstructL() - { - - } - -//For Download Status -void CAudioPdPlayUtility::HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue) - { - iProperties->HandleDownloadEventL(aTransactionID,aEvent,aValue); - } - - -void CAudioPdPlayUtility::Play() - { - iProperties->Play(); - } -void CAudioPdPlayUtility::Stop() - { - iProperties->Stop(); - } -TInt CAudioPdPlayUtility::Pause() - { - return iProperties->Pause(); - } -void CAudioPdPlayUtility::SetVolume(TInt aVolume) - { - iProperties->SetVolume(aVolume); - } -void CAudioPdPlayUtility::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence) - { - iProperties->SetRepeats(aRepeatNumberOfTimes,aTrailingSilence); - } -void CAudioPdPlayUtility::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) - { - iProperties->SetVolumeRamp(aRampDuration); - } -const TTimeIntervalMicroSeconds& CAudioPdPlayUtility::Duration() - { - return iProperties->Duration(); - } -TInt CAudioPdPlayUtility:: MaxVolume() - { - return iProperties->MaxVolume(); - } -void CAudioPdPlayUtility::Close() - { - iProperties->Close(); - } -TInt CAudioPdPlayUtility::GetPosition(TTimeIntervalMicroSeconds& aPosition) - { - return iProperties->GetPosition(aPosition); - } -void CAudioPdPlayUtility::SetPosition(const TTimeIntervalMicroSeconds& aPosition) - { - iProperties->SetPosition(aPosition); - } - -TInt CAudioPdPlayUtility::SetPriority(TInt aPriority, TMdaPriorityPreference aPref) - { - return iProperties->SetPriority(aPriority,aPref); - } -TInt CAudioPdPlayUtility::GetVolume(TInt& aVolume) - { - return iProperties->GetVolume(aVolume); - } -TInt CAudioPdPlayUtility::GetNumberOfMetaDataEntries(TInt& aNumEntries) - { - return iProperties->GetNumberOfMetaDataEntries(aNumEntries); - } - - -CMMFMetaDataEntry* CAudioPdPlayUtility::GetMetaDataEntryL(TInt aMetaDataIndex) - { - return iProperties->GetMetaDataEntryL(aMetaDataIndex); - } - -TInt CAudioPdPlayUtility::SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd) - { - return iProperties->SetPlayWindow(aStart,aEnd); - } - -TInt CAudioPdPlayUtility::ClearPlayWindow() - { - return iProperties->ClearPlayWindow(); - } -TInt CAudioPdPlayUtility::SetBalance(TInt aBalance) - { - return iProperties->SetBalance(aBalance); - } -TInt CAudioPdPlayUtility::GetBalance(TInt& aBalance) - { - return iProperties->GetBalance(aBalance); - } -TInt CAudioPdPlayUtility::GetBitRate(TUint& aBitRate) - { - return iProperties->GetBitRate(aBitRate); - } - - -void CAudioPdPlayUtility::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback) - { - iProperties->RegisterForAudioLoadingNotification(aCallback); - } - -void CAudioPdPlayUtility::GetAudioLoadingProgressL(TInt& aPercentageProgress) - { - iProperties->GetAudioLoadingProgressL(aPercentageProgress); - } - -const CMMFControllerImplementationInformation& CAudioPdPlayUtility::ControllerImplementationInformationL() - { - return iProperties->ControllerImplementationInformationL(); - } - - -TInt CAudioPdPlayUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) - { - return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); - } -TInt CAudioPdPlayUtility::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) - { - return iProperties->CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); - } -void CAudioPdPlayUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) - { - iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); - } -void CAudioPdPlayUtility::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) - { - iProperties->CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); - } - -void CAudioPdPlayUtility::OpenFileL(const TDesC& aFileName) - { - iProperties->OpenFileL(aFileName); - } - - -void CAudioPdPlayUtility::OpenFileL(const RFile& aFile) - { - RFile& file = const_cast(aFile); - iProperties->OpenFileL(file); - } - -void CAudioPdPlayUtility::DlCompleteOpenFileL(const TDesC& aFileName) - { - iProperties->DlCompleteOpenFileL(aFileName); - } - -TInt CAudioPdPlayUtility::GetFilePosition(TInt& aFilePosition) - { - return iProperties->GetFilePosition(aFilePosition); - } - -TInt CAudioPdPlayUtility::SetFileSize(TInt aFileSize) - { - return iProperties->SetFileSize(aFileSize); - } - -TInt CAudioPdPlayUtility::SetBytesDownloaded(TInt aBytesDownloaded, TBool aDownloadComplete) - { - return iProperties->SetBytesDownloaded(aBytesDownloaded,aDownloadComplete); - } - -MMMFDRMCustomCommand* CAudioPdPlayUtility::GetDRMCustomCommand() - { - //ASSERT(iProperties); - return iProperties->GetDRMCustomCommand(); - } - - -TInt CAudioPdPlayUtility::CheckAudioPlayerState() - { - return iProperties->CheckAudioPlayerState(); - } - - -//=============================================================== -// CAudioPdProperties implementation begins -// -//=============================================================== -CAudioPdProperties* CAudioPdProperties::NewL(MAudioPdPlayUtilityCallback& aCallback) - { - CAudioPdProperties* self = new(ELeave) CAudioPdProperties(aCallback); - CleanupStack::PushL(self); - self->ConstructL(aCallback); - CleanupStack::Pop(self); - return self; - } -CAudioPdProperties* CAudioPdProperties::NewLC(MAudioPdPlayUtilityCallback& /*aCallback*/) - { - return NULL; - } - -CAudioPdProperties::~CAudioPdProperties() - { - - if(iMimeType) - { - delete iMimeType; - iMimeType = NULL; - } - - if(iBufferEmptiedEventAO->IsActive()) - { - iBufferEmptiedEventAO->Cancel(); - } - - delete iBufferEmptiedEventAO; - - iFactory->DeleteStreamControl(iStreamControl); - - while(iBuffers.Count()) - { - MDataBuffer* temp = iBuffers[0]; - iBuffers.Remove(0); - iFactory->DeleteDataBuffer(temp); - } - - if(iMDataBufferSource) - { - MSourceControl* objPtr = iMDataBufferSource; - iFactory->DeleteSourceControl(objPtr); - iMDataBufferSource = NULL; - } - - MSinkControl* objPtr1 = iMAudioSink; - iFactory->DeleteSinkControl(objPtr1); - - if(iMVolumeControl) - { - MEffectControl* effectObj = iMVolumeControl; - iFactory->DeleteEffectControl(effectObj); - iMVolumeControl = NULL; - } - - if(iFileName) - { - delete iFileName; - iFileName = NULL; - } - - if (iMetaDataEntries.Count()) - { - iMetaDataEntries.ResetAndDestroy(); - iMetaDataEntries.Close(); - } - - delete iFile; - iFile = NULL; - iFs.Close(); - iBuffers.ResetAndDestroy(); - iBuffers.Close(); - iAvailable.Close(); - - delete iFactory; - - delete iControllerImplementationInformation; - delete iAsyncCallBack; -// iController.Close(); - } - -CAudioPdProperties::CAudioPdProperties(/*MMdaAudioPlayerCallback*/MAudioPdPlayUtilityCallback& aCallback): - iCallback(aCallback), - iAudioPlayDeviceCommands(iController), - iAudioPlayControllerCommands(iController), - iDRMCustomCommands(iController) - { - iState = EStopped; - iPrioritySettings.iPriority = KAudioPriorityRealOnePlayer;//80 - iPrioritySettings.iPref =(TMdaPriorityPreference) KAudioPrefRealOneLocalPlayback;// 0x01420001; - iPlayStart = TTimeIntervalMicroSeconds(0); - iPlayEnd = TTimeIntervalMicroSeconds(0); - iPlayWindowSet = ENone; - iBuffering = EFalse; - iControllerPtr = NULL; - iStopCalled = EFalse; - iFileName = NULL; - } - -void CAudioPdProperties::ConstructL(MAudioPdPlayUtilityCallback& /*aCallback*/) - { - iAsyncCallBack = CMMFMdaAudioPlayerCallBack::NewL(iCallback); - iBufferEmptiedEventAO = CBufferEmptiedEventAO::NewL(*this); - iMimeType = HBufC8::NewL(20); - TInt status = CMultimediaFactory::CreateFactory( iFactory ); - - TInt err = iFactory->CreateStreamControl( KStreamControl, iStreamControl ); - User::LeaveIfError(err); - iStreamControl->AddObserver( *this ); - - MSinkControl* tempSinkCtrl(NULL); - err = iFactory->CreateSinkControl( KMMFAudioOutputSinkControl, tempSinkCtrl ); - User::LeaveIfError(err); - iMAudioSink = tempSinkCtrl; - iStreamControl->AddSink( *iMAudioSink ); - - MSourceControl* tempCtrl(NULL); - err = iFactory->CreateSourceControl( KDataBufferSourceControl, tempCtrl ); - User::LeaveIfError(err); - CreateAudioBuffersL(); - iMDataBufferSource = static_cast(tempCtrl); - iMDataBufferSource->AddObserver( *this ); - - //Create Volume Control - MEffectControl* effectCtrl(NULL); - err = iFactory->CreateEffectControl( KVolumeEffectControl, effectCtrl ); - User::LeaveIfError(err); - - iMVolumeControl = static_cast(effectCtrl); - err = iStreamControl->AddEffect( *iMVolumeControl ); - } - -void CAudioPdProperties::HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue) - { - iCallback.HandleDownloadEventL(aTransactionID,aEvent,aValue); - } - - -void CAudioPdProperties::CreateAudioBuffersL() - { - MDataBuffer* buffer; - iBuffers.ResetAndDestroy(); - iAvailable.Reset(); - for (int i = 0; i < KNumberOfBuffers; i++ ) - { - iFactory->CreateDataBuffer(KDataBufferSourceControl,4096,buffer); - User::LeaveIfError(iBuffers.Append(buffer)); - buffer = NULL; - iAvailable.AppendL(ETrue); - } - } - -void CAudioPdProperties::DetermineFNMimeType(const TDesC& aFileName, TDes8& aMimeType) - { - RApaLsSession ls; - TInt err; - err=ls.Connect(); - - TDataRecognitionResult result; - err = ls.RecognizeData(aFileName,KNullDesC8(),result); - if(!err && (result.iConfidence >= CApaDataRecognizerType::EProbable)) - { - aMimeType.Copy(result.iDataType.Des8()); - } - ls.Close(); - } - -void CAudioPdProperties::DetermineFHMimeType(const RFile& aFile, TDes8& aMimeType) - { - RApaLsSession ls; - TInt err; - err=ls.Connect(); - - TDataRecognitionResult result; - err = ls.RecognizeData(aFile,result); - if(!err && (result.iConfidence >= CApaDataRecognizerType::EProbable)) - { - aMimeType.Copy(result.iDataType.Des8()); - } - ls.Close(); - } - - -void CAudioPdProperties::OpenFileL(const TDesC& aFileName) - { - TBuf8<20> mimeType; - User::LeaveIfError(iFs.Connect()); - - if(iFileName) - { - delete iFileName; - iFileName = NULL; - } - - iFileName = HBufC::NewL(aFileName.Length()); - TPtr des = iFileName->Des(); - des.Copy(aFileName); - - TInt err = ExtractDRMRestrictionsL(); - User::LeaveIfError(err); - if(!isProtected) - { - DetermineFNMimeType(aFileName,mimeType); - iMimeType->Des().Copy(mimeType); - } - - - if(iMimeType->Des().Length()) - { - DEBPRN1(_L("CAudioPdProperties::OpenFileL() Before iFile Open ")); - iFile = CContentFile::NewL(iFs,aFileName, KNullDesC, EFileShareAny,EFalse); - DEBPRN2(_L("CAudioPdProperties::OpenFileL() After iFile Open Error[%d]"),err); - iStreamControl->AddSource(*iMDataBufferSource); - MDataBuffer* dataBuffer = NULL; - err = iMDataBufferSource->Open(*iMimeType,*dataBuffer); - User::LeaveIfError(err); - SetPriority(iPrioritySettings.iPriority,(TMdaPriorityPreference)iPrioritySettings.iPref); - iStreamControl->Open(); - } - else - { - User::Leave(KErrNotSupported); - } - } - - -void CAudioPdProperties::OpenFileL(const RFile& aFile) - { - TBuf8<20> mimeType; - iFileHandle = aFile; - TInt err = ExtractDRMRestrictionsL(); - User::LeaveIfError(err); - if(!isProtected) - { - DetermineFHMimeType(iFileHandle,mimeType); - iMimeType->Des().Copy(mimeType); - } - - iFile = CContentFile::NewL(iFileHandle, KNullDesC ,EFalse); - - if(iMimeType->Des().Length()) - { - MDataBuffer* dataBuffer = NULL; - TInt err = iMDataBufferSource->Open(*iMimeType,*dataBuffer); - User::LeaveIfError(err); - SetPriority(iPrioritySettings.iPriority,(TMdaPriorityPreference)iPrioritySettings.iPref); - iStreamControl->Open(); - } - else - { - User::Leave(KErrNotSupported); - } - } - -void CAudioPdProperties::DlCompleteOpenFileL(const TDesC& aFileName) - { - OpenFileL(aFileName); - } - - -void CAudioPdProperties::Play() - { - DEBPRN2(_L("CAudioPdProperties::Play() enter iIsEOFReached[%d]"),iIsEOFReached); - if (iPlayWindowSet == ESet) - { - iAudioPlayControllerCommands.SetPlaybackWindow(iPlayStart, iPlayEnd); - } - else if (iPlayWindowSet == EClear) - { - iAudioPlayControllerCommands.DeletePlaybackWindow(); - iPlayWindowSet = ENone; // assume window will stay cleared - } - - if(iIsEOFReached) - { - delete iFile; - iFile = NULL; - if(iFileName) - { - DEBPRN2(_L("CAudioPdProperties::Play() iIsEOFReached[%d] "),iIsEOFReached); - iFile = CContentFile::NewL(iFs,*iFileName, KNullDesC, EFileShareAny,EFalse); - } - else - { - DEBPRN2(_L("CAudioPdProperties::Play() iIsEOFReached[%d] "),iIsEOFReached); - iFile = CContentFile::NewL(iFileHandle, KNullDesC ,EFalse); - } - iIsEOFReached = EFalse; - } - - if(iState != EStopped) - { - FillSourceBuffers(); - } - - if(!iDisableAutoIntent && iFile) - { - iFile->ExecuteIntent((iState == EPaused) ? ContentAccess::EContinue : ContentAccess::EPlay); - } - - iStreamControl->Start(); - } - -void CAudioPdProperties::Stop() - { - DEBPRN1(_L("CAudioPdProperties::Stop() enter")); - iStopCalled = ETrue; - iStreamControl->Stop(); - } -TInt CAudioPdProperties::Pause() - { - TInt err = KErrNone; - DEBPRN1(_L("CAudioPdProperties::Pause() enter")); - if(!iDisableAutoIntent && iFile) - { - iFile->ExecuteIntent(ContentAccess::EPause); - } - - err = iStreamControl->Pause(); - return err; - } - -void CAudioPdProperties::SetVolume(TInt aVolume) - { - if(iMVolumeControl) - { - iMVolumeControl->SetVolume(aVolume); - iMVolumeControl->Apply(); - } - } - -void CAudioPdProperties::SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence) - { - iNumberOfTimesToRepeat = aRepeatNumberOfTimes; - iTrailingSilence = aTrailingSilence; - } - -void CAudioPdProperties::SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration) - { - TInt curVol = 0; - MVolumeControl::TVolumeRampMode aMode= MVolumeControl::EIMMEDIATE; - TUint64 duration = aRampDuration.Int64(); - TInt err = iMVolumeControl->GetVolume(curVol); - if(iMVolumeControl) - { - iMVolumeControl->SetVolumeRamp(0,curVol,duration, - aMode); - iMVolumeControl->Apply(); - } - } -const TTimeIntervalMicroSeconds& CAudioPdProperties::Duration() - { - TInt64 duration = 0; - TInt err = iStreamControl->GetDuration(duration); - iDuration = duration; - return iDuration; - } - -TInt CAudioPdProperties:: MaxVolume() - { - TInt volume; - if(iMVolumeControl) - iMVolumeControl->GetMaxVolume(volume); - return volume; - } - -void CAudioPdProperties::Close() - { - // Reset the audio player state. - DEBPRN1(_L("CAudioPdProperties::Close() enter")); - Stop(); - DEBPRN1(_L("CAudioPdProperties::Close() Before File Close ")); - delete iFile; - iFile = NULL; - DEBPRN1(_L("CAudioPdProperties::Close() After File Close ")); - } - -TInt CAudioPdProperties::GetPosition(TTimeIntervalMicroSeconds& aPosition) - { - TInt error = KErrNone; - TInt64 position = 0; - error = iStreamControl->GetPosition(position); - aPosition = iPosition = position; - return error; - } - -void CAudioPdProperties::SetPosition(const TTimeIntervalMicroSeconds& aPosition) - { - TInt64 position = aPosition.Int64(); - TTimeIntervalMicroSeconds currentPosition(0); - GetPosition(currentPosition); - - // We only set the Position if the Current Position is different then the - // the new Position - if(currentPosition != aPosition) - { - //iStreamControl->SetPosition(position); - } - } - -TInt CAudioPdProperties::SetPriority(TInt aPriority, TMdaPriorityPreference aPref) - { - TInt err = iStreamControl->SetPriority(aPriority,aPref); - return err; - } - -TInt CAudioPdProperties::GetVolume(TInt& aVolume) - { - TInt error = iAudioPlayDeviceCommands.GetVolume(aVolume); - return error; - } - -TInt CAudioPdProperties::GetNumberOfMetaDataEntries(TInt& aNumEntries) - { - TInt status(KErrNotReady); - if(!iMimeType->Des().Compare(KWMAMimeType())) - { - status = iController.GetNumberOfMetaDataEntries(aNumEntries); - } - else - { - if (!iMetaDataRead && iControllerLoaded) - { - CMetaDataUtility* metaDataUtility = CMetaDataUtility::NewL(); - CleanupStack::PushL(metaDataUtility); - - RArray wantedFields; - CleanupClosePushL(wantedFields); - wantedFields.Append(EMetaDataSongTitle); - wantedFields.Append(EMetaDataArtist); - wantedFields.Append(EMetaDataAlbum); - wantedFields.Append(EMetaDataYear); - wantedFields.Append(EMetaDataComment); - wantedFields.Append(EMetaDataAlbumTrack); - wantedFields.Append(EMetaDataGenre); - wantedFields.Append(EMetaDataComposer); - wantedFields.Append(EMetaDataCopyright); - wantedFields.Append(EMetaDataOriginalArtist); - wantedFields.Append(EMetaDataUrl); - wantedFields.Append(EMetaDataJpeg); - wantedFields.Append(EMetaDataUserUrl); - - if(iFileName) - { - TRAP(status,metaDataUtility->OpenFileL(*iFileName, wantedFields)); - } - else - { - TRAP(status,metaDataUtility->OpenFileL(iFileHandle, wantedFields)); - } - - if(status != KErrNone) - { - CleanupStack::PopAndDestroy(&wantedFields); // wantedFields - CleanupStack::PopAndDestroy(metaDataUtility); //metaDataUtility - return status; - } - TInt count = metaDataUtility->MetaDataCount(); - - if (count > 0) - { - const CMetaDataFieldContainer& container = metaDataUtility->MetaDataFieldsL(); - TMetaDataFieldId id; - for (TInt i = 0; i < count; i++) - { - TPtrC content = container.At(i, id); - CMMFMetaDataEntry* metaData = NULL; - switch (id) - { - case EMetaDataSongTitle: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntrySongTitle, content); - break; - case EMetaDataArtist: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryArtist, content); - break; - case EMetaDataAlbum: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryAlbum, content); - break; - case EMetaDataYear: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryYear, content); - break; - case EMetaDataComment: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryComment, content); - break; - case EMetaDataAlbumTrack: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryAlbumTrack, content); - break; - case EMetaDataGenre: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryGenre, content); - break; - case EMetaDataComposer: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryComposer, content); - break; - case EMetaDataCopyright: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryCopyright, content); - break; - case EMetaDataOriginalArtist: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryOriginalArtist, content); - break; - case EMetaDataUrl: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryWOAF, content); - break; - case EMetaDataJpeg: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryAPIC, content); - break; - case EMetaDataUserUrl: - metaData = CMMFMetaDataEntry::NewL(KMMFMetaEntryWXXX, content); - break; - default: // Should never get here really... - break; - } - if (metaData) - { - CleanupStack::PushL(metaData); - User::LeaveIfError(iMetaDataEntries.Append(metaData)); - CleanupStack::Pop(metaData); // metaData - } - } - } - iMetaDataRead = ETrue; - CleanupStack::PopAndDestroy(&wantedFields); // wantedFields - CleanupStack::PopAndDestroy(metaDataUtility); //metaDataUtility - } - aNumEntries = iMetaDataEntries.Count(); - status = KErrNone; - } - return status; - } - - -CMMFMetaDataEntry* CAudioPdProperties::GetMetaDataEntryL(TInt aMetaDataIndex) - { - if(!iMimeType->Des().Compare(KWMAMimeType())) - { - return iController.GetMetaDataEntryL(aMetaDataIndex); - } - else - { - if (aMetaDataIndex > iMetaDataEntries.Count() - 1) - { - User::Leave(KErrArgument); - } - - return CMMFMetaDataEntry::NewL(*iMetaDataEntries[aMetaDataIndex]); - } - } - -TInt CAudioPdProperties::SetPlayWindow(const TTimeIntervalMicroSeconds& aPlayStart, - const TTimeIntervalMicroSeconds& aPlayEnd) - { - TInt error = KErrNone; - - if (aPlayStart >= TTimeIntervalMicroSeconds(0) && - aPlayStart < iDuration && - aPlayStart < aPlayEnd && - aPlayEnd <= iDuration ) - { - iPlayStart = aPlayStart; - iPlayEnd = aPlayEnd; - iPlayWindowSet = ESet; - - if (iState==EPlaying) - error = iAudioPlayControllerCommands.SetPlaybackWindow(aPlayStart, aPlayEnd); - } - else - error = KErrArgument; - - return error; - } - -TInt CAudioPdProperties::ClearPlayWindow() - { - // clear play window start - very important because this is assigned - // to iPosition when we stop & is used to set the position on the next Play() - iPosition = iPlayStart = iPlayEnd = TTimeIntervalMicroSeconds(0); - - iPlayWindowSet = EClear; - TInt err = KErrNone; - if (iState==EPlaying) - err = iAudioPlayControllerCommands.DeletePlaybackWindow(); - return err; - } - -TInt CAudioPdProperties::SetBalance(TInt aBalance) - { - TInt err = iAudioPlayDeviceCommands.SetBalance(aBalance); - return err; - } - -TInt CAudioPdProperties::GetBalance(TInt& aBalance) - { - TInt err = iAudioPlayDeviceCommands.GetBalance(aBalance); - return err; - } - -TInt CAudioPdProperties::GetBitRate(TUint& aBitRate) - { - TInt status = KErrNone; - if(iMDataBufferSource) - { - status = iMDataBufferSource->GetBitRate(aBitRate); - } - return status; - } - -void CAudioPdProperties::RegisterForAudioLoadingNotification(MAudioLoadingObserver& aLoadingObserver) - { - iLoadingObserver = &aLoadingObserver; - } - -void CAudioPdProperties::GetAudioLoadingProgressL(TInt& aPercentageProgress) - { - User::LeaveIfError(iAudioPlayControllerCommands.GetLoadingProgress(aPercentageProgress)); - } - -const CMMFControllerImplementationInformation& CAudioPdProperties::ControllerImplementationInformationL() - { - if (!iControllerImplementationInformation) - { - TUid* contUid = static_cast(iStreamControl->CustomInterface(KUidSCControllerUid)); - iControllerUid = *contUid; - if (iControllerUid==KNullUid) - User::Leave(KErrNotReady); - iControllerImplementationInformation = CMMFControllerImplementationInformation::NewL(iControllerUid); - } - return *iControllerImplementationInformation; - } - -TInt CAudioPdProperties::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom) - { - return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom); - } -TInt CAudioPdProperties::CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2) - { - return iController.CustomCommandSync(aDestination, aFunction, aDataTo1, aDataTo2); - } -void CAudioPdProperties::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus) - { - iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aDataFrom, aStatus); - } -void CAudioPdProperties::CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus) - { - iController.CustomCommandAsync(aDestination, aFunction, aDataTo1, aDataTo2, aStatus); - } - -TInt CAudioPdProperties::GetFilePosition(TInt& /*aFilePosition*/) - { - return KErrNone; - } - -TInt CAudioPdProperties::SetFileSize(TInt aFileSize) - { - TInt status(KErrNone); - if(!isProtected) - { - iFileSize = aFileSize; - status = iMDataBufferSource->SetSize(aFileSize); - } - return status; - } - -TInt CAudioPdProperties::SetBytesDownloaded(TInt aBytesDownloaded, TBool aDownloadComplete) - { - TInt status(KErrNone); - iBytesDownloaded = aBytesDownloaded; - iDownloadComplete = aDownloadComplete; - - if(iDownloadComplete && iFile) - { - ReOpenCAF(); - } - - if(iBuffering) - { - if(((aBytesDownloaded - iBytesReadFromFile) > KBufferingAmount) - || ((iFileSize - aBytesDownloaded) < KBufferingAmount)) - { - FillSourceBuffers(); - } - } - return status; - } - - -MMMFDRMCustomCommand* CAudioPdProperties::GetDRMCustomCommand() - { - return this; - } - - -TInt CAudioPdProperties::DisableAutomaticIntent(TBool aDisableAutoIntent) - { - if (iDRMCustomCommands.IsSupported()) - { - iDisableAutoIntent = aDisableAutoIntent; - return KErrNone; - } - else - { - return KErrNotSupported; - } - } - -TInt CAudioPdProperties::ExecuteIntent(ContentAccess::TIntent aIntent) - { - if (iDRMCustomCommands.IsSupported()) - { - if(iFile) - { - return iFile->ExecuteIntent(aIntent); - } - else - { - return KErrNotReady; - } - } - else - { - return KErrNotSupported; - } - } - -TInt CAudioPdProperties::EvaluateIntent(ContentAccess::TIntent aIntent) - { - if (iDRMCustomCommands.IsSupported()) - { - if(iFile) - { - return iFile->EvaluateIntent(aIntent); - } - else - { - return KErrNotReady; - } - } - else - { - return KErrNotSupported; - } - } - -TInt CAudioPdProperties::SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue) - { - if (iDRMCustomCommands.IsSupported()) - { - if(iFile) - { - return iFile->SetAgentProperty(aProperty,aValue); - } - else - { - return KErrNotReady; - } - } - else - { - return KErrNotSupported; - } - } - -TInt CAudioPdProperties::CheckAudioPlayerState() - { - return iState; - } - -CRepeatTrailingSilenceTimer* CRepeatTrailingSilenceTimer::NewL(MRepeatTrailingSilenceTimerObs& aObs) - { - CRepeatTrailingSilenceTimer* s = new(ELeave) CRepeatTrailingSilenceTimer(aObs); - CleanupStack::PushL(s); - s->ConstructL(); - CleanupStack::Pop(); - return s; - } - -void CRepeatTrailingSilenceTimer::RunL() - { - iObs.RepeatTrailingSilenceTimerComplete(); - } - -CRepeatTrailingSilenceTimer::CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs) : - CTimer(EPriorityHigh), - iObs(aObs) - { - CActiveScheduler::Add(this); - } - - -CMMFMdaAudioPlayerCallBack* CMMFMdaAudioPlayerCallBack::NewL(MAudioPdPlayUtilityCallback& aCallback) - { - return new(ELeave) CMMFMdaAudioPlayerCallBack(aCallback); - } - -CMMFMdaAudioPlayerCallBack::CMMFMdaAudioPlayerCallBack(MAudioPdPlayUtilityCallback& aCallback) : - CActive(CActive::EPriorityHigh), iCallback(aCallback) - { - CActiveScheduler::Add(this); - } - -CMMFMdaAudioPlayerCallBack::~CMMFMdaAudioPlayerCallBack() - { - Cancel(); - } - -void CMMFMdaAudioPlayerCallBack::InitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) - { - iError = aError; - iDuration = aDuration; - iState = ECallbackInitComplete; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - -void CMMFMdaAudioPlayerCallBack::PlayComplete(TInt aError) - { - iError = aError; - iState = ECallbackPlayComplete; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - -void CMMFMdaAudioPlayerCallBack::PlayingCallback() - { - iState = ECallbackPlaying; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - -void CMMFMdaAudioPlayerCallBack::PausedCallback() - { - iState = ECallbackPaused; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - - -void CMMFMdaAudioPlayerCallBack::RunL() - { - switch (iState) - { - case ECallbackInitComplete: - iCallback.MapcInitComplete(iError, iDuration); - break; - case ECallbackPlayComplete: - iCallback.MapcPlayComplete(iError); - break; - case ECallbackPlaying: - iCallback.Playing(); - break; - case ECallbackPaused: - iCallback.Paused(); - break; - - } - } - -void CMMFMdaAudioPlayerCallBack::DoCancel() - { - // Nothing to cancel - } - -void CAudioPdProperties::Event( MControl* /*aControl*/, TUint aEventType, TAny* aEventObject ) - { - switch (aEventType) - { - case MStreamControlObserver::KStateChangedEvent: - { - //MStreamControl* control1 = (MStreamControl*)(aControl); - //MErrorCode* evt = (MErrorCode*)aEventObject; - MStateChangedEvent* evt = (MStateChangedEvent*)aEventObject; - DEBPRN1(_L("CAudioPdProperties::Event:EStateChanged")); - iStreamState = evt->GetState(); - switch(evt->GetState()) - { - case MStreamControl::CLOSED: - iState = EStopped; - iControllerLoaded = EFalse; - DEBPRN1(_L("CAudioPdProperties::Event:EStateChanged[Closed]")); - break; - case MStreamControl::INITIALIZED: - DEBPRN3(_L("CAudioPdProperties::Event:EStateChanged[Opened] [%d]StopCalled[%d]"),evt->GetErrorCode(),iStopCalled); - iState = EOpening; - if( evt->GetErrorCode() == KErrEof || iStopCalled) - { - iIsEOFReached = ETrue; - iBytesReadFromFile = 0; - DEBPRN1(_L("CAudioPdProperties::Event() Before File Close ")); - delete iFile; - iFile = NULL; - DEBPRN1(_L("CAudioPdProperties::Event() After File Close ")); - if(!iStopCalled) - { - iAsyncCallBack->PlayComplete(KErrNone); - } - iStopCalled = EFalse; - } - else if(evt->GetErrorCode() == KErrNone ) - { - - iControllerPtr = static_cast (iStreamControl->CustomInterface(KUidSCControllerRef)); - iController = *iControllerPtr; - iControllerLoaded = ETrue; - if(iFileSize == -1 || isProtected) - { - iFile->Size(iFileSize); - iMDataBufferSource->SetSize(iFileSize); - } - else - { - SetFileSize(iFileSize); - } - FillSourceBuffers(); - iStreamControl->Prime(); - } - else - { - switch(evt->GetErrorCode()) - { - case KErrNotSupported: - case KErrPermissionDenied: - case KErrCANoRights: - iAsyncCallBack->PlayComplete(evt->GetErrorCode()); - iIsEOFReached = ETrue; - delete iFile; - iFile = NULL; - break; - - case KErrDied: - Stop(); - iAsyncCallBack->PlayComplete(evt->GetErrorCode()); - iIsEOFReached = ETrue; - delete iFile; - iFile = NULL; - break; - } - } - break; - case MStreamControl::PRIMED: - iState = EPrimed; - DEBPRN1(_L("CAudioPdProperties::Event:EStateChanged[Primed]")); - iAsyncCallBack->InitComplete(evt->GetErrorCode(), Duration()); - break; - case MStreamControl::EXECUTING: - DEBPRN1(_L("CAudioPdProperties::Event:EStateChanged[Playing]")); - iStopCalled = EFalse; - iState = EPlaying; - iAsyncCallBack->PlayingCallback(); - break; - case MStreamControl::BUFFERING: - DEBPRN1(_L("CAudioPdProperties::Event:EStateChanged[Buffering]")); - if(iBuffering) - { - iStreamControl->Pause(); - //iAsyncCallBack->PlayComplete(KErrDied); - iAsyncCallBack->PlayComplete(KErrUnderflow); - } - iState = EBuffering; - break; - case MStreamControl::PAUSED: - iState = EPaused; - iAsyncCallBack->PausedCallback(); - DEBPRN2(_L("CAudioPdProperties::Event:EStateChanged[Paused] [%d]"),evt->GetErrorCode()); - break; - default: - break; - }; - } - break; - - - case MSourceControlObserver::KBufferProcessedEvent: - { - MBufferProcessedEvent* evt = (MBufferProcessedEvent*)aEventObject; - DEBPRN3(_L("CAudioPdProperties::Event:EBufferProcessed[AudioBuffer[0x%x]Reason[%d]]") , evt->GetDataBuffer(), evt->GetErrorCode() ); - TInt index = iBuffers.Find( evt->GetDataBuffer() ); - if ( index >= 0 ) - { - iAvailable[index] = ETrue; - } - - if(!iBufferEmptiedEventAO->IsActive() && !iIsEOFReached) - { - iBufferEmptiedEventAO->SetActive(); - iBufferEmptiedEventAO->SetBuffer(evt->GetDataBuffer()); - } - - if(iBufferEmptiedEventAO->IsActive()) - { - TRequestStatus* status = &(iBufferEmptiedEventAO->iStatus); - User::RequestComplete(status,evt->GetErrorCode()); - } - } - break; - - case MSourceControlObserver::KBitRateChangedEvent: - { - //TUint rate = 0; - //DEBPRN2(_L("CAudioPdProperties::Event:BitRateChanged[%d]"),rate); - } - break; - - case MStreamControlObserver::KDurationChangedEvent: - break; - default: - break; - }; - } - -TInt CAudioPdProperties::ReadFromFileAndWriteToStream(TInt aIndex) - { - MDataBuffer* buffer = iBuffers[aIndex]; - buffer->GetBufferPtr().FillZ(); - // Read data into CAudioBuffer - TInt filePos = 0; - iFile->Seek(ESeekCurrent,filePos); - - DEBPRN4(_L("CAudioPdProperties::ReadFromFileAndWriteToStream \ - BytesDL[%d] filePos[%d] MaxLength[%d]"),iBytesDownloaded,filePos, buffer->GetBufferPtr().MaxLength()); - TInt err1(KErrNone); - if(iBytesDownloaded - filePos > buffer->GetBufferPtr().MaxLength() || iDownloadComplete) - { - err1 = iFile->Read( buffer->GetBufferPtr(), buffer->GetBufferPtr().MaxLength()); - } - else - { - iBuffering = ETrue; - return KErrUnderflow; - } - DEBPRN2(_L("CAudioPdProperties::ReadFromFileAndWriteToStream File Read Error [%d]"),err1); - User::LeaveIfError(err1); - iBytesReadFromFile += buffer->GetBufferPtr().Length(); - - DEBPRN3(_L("CAudioPdProperties::ReadFromFileAndWriteToStream\ - bufferReadLen[%d] Buf Len[%d]"),buffer->GetBufferPtr().Length(),buffer->GetBufferPtr().MaxLength() ); - - if (buffer->GetBufferPtr().Length() < buffer->GetBufferPtr().MaxLength() && (iBytesReadFromFile < iFileSize)) - { - - iBytesReadFromFile = iBytesReadFromFile - buffer->GetBufferPtr().Length(); - TInt seekOffset = -(buffer->GetBufferPtr().Length()); - iFile->Seek( ESeekCurrent, seekOffset ); - iBuffering = ETrue; - DEBPRN3(_L("CAudioPdProperties::ReadFromFileAndWriteToStream\ - BytesReadFromFile[%d] seekOffset[%d]"),iBytesReadFromFile,seekOffset ); - return KErrOverflow; - } - else if(buffer->GetBufferPtr().Length() < buffer->GetBufferPtr().MaxLength()) - { - buffer->SetLastBuffer( ETrue ); - iIsEOFReached = ETrue; - //iFile.Close(); - } - else - { - buffer->SetLastBuffer( EFalse ); - } - - // Write data into iMDataBufferSource - DEBPRN4(_L("CAudioPdProperties::ReadFromFileAndWriteToStream\ - [AudioBuffer[0x%x]FileSize[%d]BytesRead[%d]]") , buffer, iFileSize, iBytesReadFromFile ); - - TInt err(KErrNone); - err = iMDataBufferSource->WriteData( *buffer ); - - if (err == KErrNone) - { - iAvailable[aIndex] = EFalse; - } - else if ( err == KErrOverflow ) - { - // There isn't enough memory in the player to buffer the data. - // reset the file pos - TInt size = -(buffer->GetBufferPtr().Length()); - iFile->Seek( ESeekCurrent, size ); - iBytesReadFromFile -= size; - } - return err; - } - - -void CAudioPdProperties::BufferEmptiedBySource() - { - TInt i = 0; - if (!iIsEOFReached && - ( iBufferEmptiedEventAO->Error() == KErrNone) ) - { - - for(i=0; i < iAvailable.Count(); i++) - { - if(iAvailable[i]) - break; - } - - if(!iBuffering) - { - TInt err = ReadFromFileAndWriteToStream( i ); - if ( err != KErrNone) - { - // Do Something.. - } - } - } - else if (iBufferEmptiedEventAO->Error() == KErrCancel) - { - - /*if(!iStopCalled) - { - MDataBuffer* buffer = iBufferEmptiedEventAO->GetBuffer(); - iBytesReadFromFile = iBytesReadFromFile - buffer->GetBufferPtr().Length(); - TInt seekOffset = -(buffer->GetBufferPtr().Length()); - iFile.Seek( ESeekCurrent, seekOffset ); - - TInt filePos = 0; - iFile.Seek(ESeekCurrent,filePos); - - DEBPRN4(_L("CAudioPdProperties::BufferEmptiedBySource() \ - BytesReadFromFile[%d] filePos[%d] MaxLength[%d]"),iBytesReadFromFile,filePos, buffer->GetBufferPtr().MaxLength()); - }*/ - } - } - -void CAudioPdProperties::FillSourceBuffers() - { - DEBPRN1(_L("CAudioPdProperties::FillSourceBuffers() enter")); - TInt index = iAvailable.Find(ETrue); - DEBPRN2(_L("CAudioPdProperties::FillSourceBuffers() index[%d]"),index); - while ( (index != KErrNotFound ) && (!iIsEOFReached)) - { - TInt err = ReadFromFileAndWriteToStream( index ); - if(err) - { - iBuffering = ETrue; - break; - } - else - { - iBuffering = EFalse; - } - // Exit the loop if file EOF. - if ( !iIsEOFReached ) - { - // Get the next free buffer - index = iAvailable.Find(ETrue); - } - } - DEBPRN2(_L("CAudioPdProperties::FillSourceBuffers() exit Buffering[%d]"), iBuffering); - } - -TInt CAudioPdProperties::ExtractDRMRestrictionsL() - { - DEBPRN1(_L("CAudioPdProperties::ExtractDRMRestrictionsL() enter")); - TInt status(KErrNone); - - ContentAccess::CContent* content(NULL); - ContentAccess::CData* data(NULL); - CDRMConfigIntfc* drmConfigIntfc(NULL); - - - if(iFileName) - { - content = CContent::NewL(*iFileName, EContentShareReadWrite) ; - } - else - { - content = CContent::NewL(iFileHandle); - } - data = content->OpenContentL(EPeek,EContentShareReadWrite); - - status = data->GetAttribute(EIsProtected, isProtected); - - if(!isProtected) - { - DEBPRN2(_L("CAudioPdProperties::ExtractDRMRestrictionsL() isProtected[%d]"),isProtected); - delete data; - delete content; - return status; - } - - TInt value = 0; - content->GetAttribute(EDrmAllowedOutputs,value); - TPtr8 des = iMimeType->Des(); - data->GetMimeTypeL(des); - - TAny* intfc(NULL); - TVersion ver(KDRMConfigIntfcMajorVer1, KDRMConfigIntfcMinorVer1, KDRMConfigIntfcBuildVer1); - status = iMDataBufferSource->GetInterface(KDRMConfigIntfc, - ver, - intfc); - if (status == KErrNone) - { - drmConfigIntfc = (CDRMConfigIntfc*)intfc; - } - else - { - delete data; - delete content; - return status; - } - - if(value & EDrmAllowAudioAnalog) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowAnalog); - } - if(value & EDrmAllowAudioFmTransmitter) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowFMTx); - } - if(value & EDrmAllowAudioBluetooth) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowBTA2DP); - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowBTHFPHSP); - } - if(value & EDrmAllowAudioUplink) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowUplink); - } - if(value & EDrmAllowVideoAnalog) - { - drmConfigIntfc->AppendAllowedOutputDevice(EVideoAllowAnalog); - } - if(value & EDrmAllowVideoMacroVision) - { - drmConfigIntfc->AppendAllowedOutputDevice(EVideoAllowMacroVision); - } - - if(value == EDrmAllowAll) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowAll); - } - /** - * RIM CR 417-7642: HDMI with HDCP to Resctricted Audio Output API - * Due to addition of new ENUMs to CRestrictedAudioOutput::TAllowedOutputPreference for HDMI and HDCP - * EAllowAudioHDMI and EAllowAudioHdmiHdcpRequired,the same is matched by adding - * EAudioAllowHDMI and EAudioAllowHdmiHdcpRequired. These ENUM values are matched for the values from drmagents.h - */ - - if(value == EDrmAllowAudioHdmi) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowHDMI); - } - if(value == EDrmAllowAudioHdmiHdcpRequired) - { - drmConfigIntfc->AppendAllowedOutputDevice(EAudioAllowHdmiHdcpRequired); - } - - delete data; - delete content; - delete drmConfigIntfc; - - return status; - - } - -TInt CAudioPdProperties::ReOpenCAF() - { - TInt status(KErrNone); - DEBPRN1(_L("CAudioPdProperties::ReOpenCAF")); - - // Read data into CAudioBuffer - TInt filePos = 0; - iFile->Seek(ESeekCurrent,filePos); - - delete iFile; - iFile = NULL; - - if(iFileName) - { - iFile = CContentFile::NewL(iFs,*iFileName, KNullDesC, EFileShareAny,EFalse); - } - else - { - iFile = CContentFile::NewL(iFileHandle, KNullDesC ,EFalse); - } - - if(iFile) - { - status = iFile->Seek(ESeekStart,filePos); - if(isProtected) - { - iFile->Size(iFileSize); - SetFileSize(iFileSize); - } - } - - DEBPRN3(_L("CAudioPdProperties::ReOpenCAF Exit status[%d] iFileSize[%d]"),status,iFileSize); - return status; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/EMCPdPlayUtility.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/EMCPdPlayUtility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,134 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - -#ifndef __CAUDIOPDPLAYUTILITY_H__ -#define __CAUDIOPDPLAYUTILITY_H__ - -#include -#include -//#include -#include -#include -#include -#include -#include -#include -#include "mmfclientutility.h" - -#include - -#include -#include "MAudioPdPlayUtility.h" -#include "MProgressiveDownloadUtility.h" - - -class CAudioPdProperties; - -/** -Concrete implementation of the CAudioPdPlayUtility API. -@see CAudioPdPlayUtility -*/ - -class CAudioPdPlayUtility: public CBase, - public MAudioPdPlayUtility - //public MAudioPdPlayUtilityCallback - { - -public: - - - - static CAudioPdPlayUtility* NewL(MAudioPdPlayUtilityCallback& aCallback); - - ~CAudioPdPlayUtility(); - - //For Download Status - void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue); - - //For Audio control - void Play(); - void Stop(); - TInt Pause(); - void SetVolume(TInt aVolume); - void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); - void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); - const TTimeIntervalMicroSeconds& Duration(); - TInt MaxVolume(); - void Close(); - TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); - void SetPosition(const TTimeIntervalMicroSeconds& aPosition); - - TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); - TInt GetVolume(TInt& aVolume); - TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); - CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); - TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd); - TInt ClearPlayWindow(); - TInt SetBalance(TInt aBalance = KMMFBalanceCenter); - TInt GetBalance(TInt& aBalance); - TInt GetBitRate(TUint& aBitRate); - - void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); - void GetAudioLoadingProgressL(TInt& aPercentageProgress); - const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); - - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); - - - - MMMFDRMCustomCommand* GetDRMCustomCommand(); - - - void OpenFileL(const TDesC& aFileName); - - - void OpenFileL(const RFile& aFile); - - void DlCompleteOpenFileL(const TDesC& aFileName); - - //Source CustomCommands - TInt GetFilePosition(TInt& aFilePosition); - TInt SetFileSize(TInt aFileSize); - TInt SetBytesDownloaded(TInt aBytesDownloaded, TBool aDownloadComplete); - - TInt CheckAudioPlayerState(); - - -protected: - -private: - - - CAudioPdPlayUtility(); - void ConstructL(); - - - - - CAudioPdProperties* iProperties; - - - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/EMCPdProperties.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/EMCPdProperties.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,299 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - -#ifndef __EMCPDPROPERTIES_H__ -#define __EMCPDPROPERTIES_H__ - -#include -#include -#include -#include "MAudioPlayUtility.h" -#include "EMCPdPlayUtility.h" - -#include "mmfclientutility.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "BufferEmptiedEventAO.h" -#include "ContentFile.h" - -using namespace multimedia; - -using multimedia::MStreamControl; -using multimedia::MControlObserver; -using multimedia::MDataBufferSource; -using multimedia::MDataBuffer; -using multimedia::MControl; -using multimedia::CMultimediaFactory; -using multimedia::MSinkControl; -using multimedia::MVolumeControl; -using multimedia::MSourceControlObserver; -using multimedia::MStreamControlObserver; - -//static const TUid KUidMmfAudioController = {KMmfUidControllerAudio}; - - -/** -Mixin class to allow notification that the timed silence has finished. -*/ -class MRepeatTrailingSilenceTimerObs - { -public: - virtual void RepeatTrailingSilenceTimerComplete() = 0; - }; - -/** -CTimer-based active object that waits the requested time before notifying its observer. -*/ -class CRepeatTrailingSilenceTimer : public CTimer - { -public: - static CRepeatTrailingSilenceTimer* NewL(MRepeatTrailingSilenceTimerObs& aObs); - void RunL(); -private: - CRepeatTrailingSilenceTimer(MRepeatTrailingSilenceTimerObs& aObs); -private: - MRepeatTrailingSilenceTimerObs& iObs; - }; - -/** -Active object utility class to allow the callback to be called asynchronously. -This should help prevent re-entrant code in clients of the mediaframework. -*/ -class CMMFMdaAudioPlayerCallBack : public CActive - { -public: - enum TCallbackState { - ECallbackInitComplete, - ECallbackPlayComplete, - ECallbackPlaying, - ECallbackPaused - }; - - -public: - static CMMFMdaAudioPlayerCallBack* NewL(MAudioPdPlayUtilityCallback& aCallback); - ~CMMFMdaAudioPlayerCallBack(); - void InitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); - void PlayComplete(TInt aError); - void PlayingCallback(); - void PausedCallback(); -private: - CMMFMdaAudioPlayerCallBack(MAudioPdPlayUtilityCallback& aCallback); - void RunL(); - void DoCancel(); -private: - MAudioPdPlayUtilityCallback& iCallback; - TInt iError; - TTimeIntervalMicroSeconds iDuration; - TCallbackState iState; - }; - - - -/** -Concrete implementation of the CAudioPdPlayUtility API. -@see CAudioPdPlayUtility -*/ - -class CAudioPdProperties: public CBase, - public MControlObserver, - public MBufferEmptiedObserver, - public MMMFDRMCustomCommand - { - -public: - - enum TMMFAudioPlayerState - { - EStopped, - EOpening, - EPaused, - EPlaying, - EBuffering, - EPrimed - }; - - static CAudioPdProperties* NewL(MAudioPdPlayUtilityCallback& aCallback); - static CAudioPdProperties* NewLC(MAudioPdPlayUtilityCallback& aCallback); - - ~CAudioPdProperties(); - - - //For Download Status - void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue); - - - //For Audio control - void Play(); - void Stop(); - TInt Pause(); - void SetVolume(TInt aVolume); - void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence); - void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration); - const TTimeIntervalMicroSeconds& Duration(); - TInt MaxVolume(); - void Close(); - TInt GetPosition(TTimeIntervalMicroSeconds& aPosition); - void SetPosition(const TTimeIntervalMicroSeconds& aPosition); - - TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref); - TInt GetVolume(TInt& aVolume); - TInt GetNumberOfMetaDataEntries(TInt& aNumEntries); - CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex); - TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd); - TInt ClearPlayWindow(); - TInt SetBalance(TInt aBalance = KMMFBalanceCenter); - TInt GetBalance(TInt& aBalance); - TInt GetBitRate(TUint& aBitRate); - - void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback); - void GetAudioLoadingProgressL(TInt& aPercentageProgress); - const CMMFControllerImplementationInformation& ControllerImplementationInformationL(); - - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom); - TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus); - void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus); - - - MMMFDRMCustomCommand* GetDRMCustomCommand(); - - void OpenFileL(const TDesC& aFileName); - void OpenFileL(const RFile& aFile); - - void DlCompleteOpenFileL(const TDesC& aFileName); - - TInt GetFilePosition(TInt& aFilePosition); - TInt SetFileSize(TInt aFileSize); - TInt SetBytesDownloaded(TInt aBytesDownloaded, TBool isDownloadComplete); - - TInt CheckAudioPlayerState(); - - TInt DisableAutomaticIntent(TBool aDisableAutoIntent); - TInt ExecuteIntent(ContentAccess::TIntent aIntent); - TInt EvaluateIntent(ContentAccess::TIntent aIntent); - TInt SetAgentProperty(ContentAccess::TAgentProperty aProperty, TInt aValue); - -private: - - void Event( MControl* aControl, TUint aEventType, TAny* aEventObject ); - void BufferEmptiedBySource(); - void FillSourceBuffers(); - void CreateAudioBuffersL(); - void DetermineFNMimeType(const TDesC& aFileName, TDes8& aMimeType); - void DetermineFHMimeType(const RFile& aFile, TDes8& aMimeType); - TInt ReadFromFileAndWriteToStream(TInt aIndex) ; - TInt ExtractDRMRestrictionsL(); - TInt ReOpenCAF(); - - CAudioPdProperties(/*MMdaAudioPlayerCallback*/MAudioPdPlayUtilityCallback& aCallback); - void ConstructL(MAudioPdPlayUtilityCallback& aCallback); - -private: - - //MAudioPdPlayUtilityCallback* iAudioPdPlayCallback; - - // last play window command - enum TPlayWindowCommand - { - ENone, - ESet, - EClear - }; - - MAudioPdPlayUtilityCallback& iCallback; - CMMFMdaAudioPlayerCallBack* iAsyncCallBack; - - MAudioLoadingObserver* iLoadingObserver; - RMMFController iController; - RMMFController* iControllerPtr; - TMMFAudioPlayerState iState; - TTimeIntervalMicroSeconds iDuration; // Needed because of api "Duration()" that returns a reference - TMMFPrioritySettings iPrioritySettings; - - TInt iNumberOfTimesPlayed; - TInt iNumberOfTimesToRepeat; - TTimeIntervalMicroSeconds iTrailingSilence; - - // Custom command handlers - RMMFAudioPlayDeviceCustomCommands iAudioPlayDeviceCommands; - RMMFAudioPlayControllerCustomCommands iAudioPlayControllerCommands; - RMMFDRMCustomCommands iDRMCustomCommands; - - // Current playback time so we can resume from where we were stopped - TTimeIntervalMicroSeconds iPosition; - - // Play window start and end times and whether it has been set - TTimeIntervalMicroSeconds iPlayStart; - TTimeIntervalMicroSeconds iPlayEnd; - TPlayWindowCommand iPlayWindowSet; - //RArray iMediaIds; - - CMMFControllerImplementationInformation* iControllerImplementationInformation; - TUid iControllerUid; - - - MStreamControl* iStreamControl; - MDataBufferSource* iMDataBufferSource; - MSinkControl* iMAudioSink; - MVolumeControl* iMVolumeControl; - - RFs iFs; - CContentFile* iFile; - RFile iFileHandle; - - RPointerArray iBuffers; - RArray iAvailable; - TBool iIsEOFReached; - TInt iBytesReadFromFile; - TInt iFileSizeInBytes; - CMultimediaFactory* iFactory; - HBufC8* iMimeType; - MStreamControl::TStreamState iStreamState; - CBufferEmptiedEventAO* iBufferEmptiedEventAO; - TInt iFileSize; - TBool iBuffering; - TInt iBytesDownloaded; - TBool iStopCalled; - HBufC* iFileName; - TBool isProtected; - TBool iDisableAutoIntent; - TBool iMetaDataRead; - // Metadata entries, if supported - RPointerArray iMetaDataEntries; - TBool iControllerLoaded; - TBool iDownloadComplete; - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/PDProperties.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/PDProperties.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,446 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - - -#include "PdProperties.h" - -//Percentage (increments) of the file [TBD] -//that needs to be downloaded/buffered before playing begins -//Should try at 25%,50%,75%,100% -const TInt KPercentageToBufferIncrement =25; - - -//Percentage of the file needed for header [TBD] -//const TInt KPercentageNeededForHeader = 33; -const TInt KBytesNeededForHeader = 200000;//102400; - -//const TInt KMinFileSize = 100000; - -//Max attempts to openfile -const TInt KRetryOpen = 1; - - -//=============================================================== -// CPdProperties implementation begins -// -//=============================================================== -EXPORT_C CPdProperties* CPdProperties::NewL() - { - CPdProperties* self = new(ELeave) CPdProperties(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -EXPORT_C CPdProperties* CPdProperties::NewLC() - { - CPdProperties* self = new (ELeave) CPdProperties(); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } - -EXPORT_C CPdProperties::~CPdProperties() - { - delete iFileName; - - } - -void CPdProperties::ConstructL() - { - - iFileOpened = EFalse; - iAttemptsToOpen = 0; - iState = EStopped; - iPercentageToBuffer= KPercentageToBufferIncrement; - iDownloadCompleted = EFalse; - iFileBytePosition = 0; - iTimePosition = 0; - iBytesDownloaded = 0; - iOpenInProgress = EFalse; - - } - -CPdProperties::CPdProperties() - { - - } - -EXPORT_C CAudioPdPlayUtility* CPdProperties::OpenL(const TDesC& aFileName, - MAudioPdPlayUtilityCallback& aCallback) - { - iUseFileHandle = EFalse; - iFileName = HBufC::NewL ( aFileName.Length() ); - iFileName->Des().Copy( aFileName ); - - iCallback = &aCallback; - - iAudioPdPlayUtility = CAudioPdPlayUtility::NewL(*this); - - return iAudioPdPlayUtility; - } - -EXPORT_C CAudioPdPlayUtility* CPdProperties::OpenL(const RFile& aFileHandle, - MAudioPdPlayUtilityCallback& aCallback) - { - iUseFileHandle = ETrue; - iFileHandle.Duplicate(aFileHandle); - - iCallback = &aCallback; - - iAudioPdPlayUtility = CAudioPdPlayUtility::NewL(*this); - - - return iAudioPdPlayUtility; - } - - -void CPdProperties::HandleDownloadEventL(TUint /*aTransactionID*/, - TBrCtlDownloadEvent aEvent, - TUint aValue) - { -/* -Event Value (optional) Comment -EDownloadEventStarted Total Bytes Size of content as specified in header. -EDownloadEventCompleted Total Bytes Received Total number received should be same as specified at start. -EDownloadEventProgress Bytes Received Number of bytes received so far. May be used to determine % received for progress bar. This will be sent multiple times. Frequency to be determined. Perhaps on every chunk received. -EDownloadEventCanceled N/A Cancelled by Download Manager -EDownloadEventError N/A Cancelled by BrowserEngine due to network/http error. -EDownloadEventPaused, aValue is the size downloaded so far -EDownloadEventResumed, aValue is the size downloaded -EDownloadEventPausable aValue = true when it is pausable -*/ - - switch (aEvent) - { - case EDownloadEventStarted: //Started - { - if(aValue) - iFileSize = aValue; - break; - } - - case EDownloadEventCompleted: //Completed - { - iDownloadCompleted = ETrue; - iBytesDownloaded = aValue; - - if((!iFileOpened) && (!iOpenInProgress)) - { - //Used for when metadata is at the end of file - //or when the file is in cache and already downloaded. - iAudioPdPlayUtility->SetFileSize(iFileSize); - iAudioPdPlayUtility->SetBytesDownloaded(iBytesDownloaded, iDownloadCompleted); - iAudioPdPlayUtility->DlCompleteOpenFileL(iFileName->Des()); - iOpenInProgress = ETrue; - iAttemptsToOpen++; - } - break; - } - - case EDownloadEventProgress: //Progress - { - if(aValue) - iBytesDownloaded = aValue; - break; - } - case EDownloadEventCanceled: //Cancelled - case EDownloadEventError: //Error - { - iBytesDownloaded = 0; - iFileSize = 0; - break; - } - - case EDownloadEventPaused: //Paused - case EDownloadEventResumed: //Resumed - case EDownloadEventPausable: //Pausable - //do nothing - break; - - default: - break; - - } // switch(aEvent) - - - #if _DEBUG - RDebug::Print(_L("CPdProperties::HandleDownloadEventL")); - RDebug::Print(_L("file byte position %d"),iFileBytePosition); - RDebug::Print(_L("bytes downloaded %d"),iBytesDownloaded); - RDebug::Print(_L("file size %d"),iFileSize); - RDebug::Print(_L("percentage to buffer %d"),iPercentageToBuffer); - RDebug::Print(_L("download state %d"),aEvent); - #endif - - HandleDownloadUpdateL(); - } - -TInt CPdProperties::CalculatePercentageDownloaded() - { - TInt percentageDone = 0; - if((iFileSize>0) && (iBytesDownloaded>0)) - percentageDone= ((100*iBytesDownloaded)/iFileSize); - - return percentageDone; - } - -void CPdProperties::SavePosition() - { - #if _DEBUG - RDebug::Print(_L("CPdProperties::SavePosition")); - #endif - TTimeIntervalMicroSeconds timeposition; - if(iState==EPlaying) - { - iAudioPdPlayUtility->GetFilePosition(iFileBytePosition); - - iAudioPdPlayUtility->GetPosition(timeposition); - if(timeposition >iTimePosition) - iTimePosition = timeposition; - } - - #if _DEBUG - RDebug::Print(_L("CPdProperties::SavePosition iTimePosition %d"),I64INT(iTimePosition.Int64())); - #endif - - } - -void CPdProperties::HandleDownloadUpdateL() - { - TInt percentageDone=0; - - percentageDone = CalculatePercentageDownloaded(); - - #if _DEBUG - RDebug::Print(_L("iFileOpened %d "),iFileOpened); - RDebug::Print(_L("iState %d "),iState); - RDebug::Print(_L("percentage downloaded %d "),percentageDone); - RDebug::Print(_L("iBytesDownloaded %d "),iBytesDownloaded); - RDebug::Print(_L("iAttemptsToOpen %d "),iAttemptsToOpen); - RDebug::Print(_L("iOpenInProgress %d "),iOpenInProgress); - RDebug::Print(_L("iFileSize %d "),iFileSize); - #endif - //if((percentageDone>KPercentageNeededForHeader)&& - if((iBytesDownloaded>KBytesNeededForHeader)&& - (!iFileOpened) && iAttemptsToOpenSetFileSize(iFileSize); -#endif - iAudioPdPlayUtility->OpenFileL(iFileHandle); - } - else - { -#ifdef RD_PD_FOR_AUDIO_CONTENT_VIA_HELIX_ENGINE - iAudioPdPlayUtility->SetFileSize(iFileSize); -#endif - TRAP(err,iAudioPdPlayUtility->OpenFileL(iFileName->Des())); - } - - if(err != KErrNone) - { - MapcInitComplete(err,0); - return; - } - iOpenInProgress = ETrue; - iAttemptsToOpen++; - - } - - //Pass bytes downloaded to ProgressiveDownload DataSource - iAudioPdPlayUtility->SetBytesDownloaded(iBytesDownloaded, iDownloadCompleted); - - if(iFileOpened) - {//if the file is opened/playing save the - //file byte position and the time position - SavePosition(); - switch (iState) - { - case EPlaying: - { - if((iFileBytePosition >=iBytesDownloaded) && - (percentageDone<=100)) - { - //Should have paused, but is causing problems - //with DRM1 FL - #if _DEBUG - RDebug::Print(_L("Should have paused")); - #endif - //StartPaused(); - } - break; - } - // Try to automatically resume only if we are stopped due to lac - // of data (KErrUnderflow) - //case EPaused: - //case EStopped: - case EStoppedAutoResume: - { - //if stopped attempt to play at 25%,50%,75%,100% - if( percentageDone >= iPercentageToBuffer ) - { - StartPlaying(); - } - break; - } - default: - break; - }//switch iState - - if( percentageDone > iPercentageToBuffer ) - { - iPercentageToBuffer += KPercentageToBufferIncrement; - } - }//iFileOpened - - } - -/* -void CPdProperties::StartPaused() - { - #if _DEBUG - RDebug::Print(_L("ProgressiveDownload audio paused")); - #endif - iState = EPaused; - iAudioPdPlayUtility->Pause(); //Audio Pause - //iCallback->Paused(); - } -*/ - -void CPdProperties::StartPlaying() - { - #if _DEBUG - RDebug::Print(_L("ProgressiveDownload audio play")); - #endif - - //Will disable automatic play if manual play was started. - TInt state = iAudioPdPlayUtility->CheckAudioPlayerState(); - - if(iState!=EPlaying) - { - iState = EPlaying; - - TTimeIntervalMicroSeconds timeposition(0); - TInt error = iAudioPdPlayUtility->GetPosition(timeposition); - - #if _DEBUG - RDebug::Print(_L("ProgressiveDownload SetPosition SavePos[%d] CurPos[%d]"), I64INT(iTimePosition.Int64()),I64INT(timeposition.Int64())); - #endif - - if(timeposition != iTimePosition) - { - iAudioPdPlayUtility->SetPosition(iTimePosition); - } - - iAudioPdPlayUtility->Play(); - //iCallback->Playing(); - } - } - -//From MMdaAudioPlayerCallback -void CPdProperties::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration) - { - -#if _DEBUG - RDebug::Print(_L("ProgressiveDownload file opened err =%d"),aError); -#endif - //iError = aError; - iOpenInProgress = EFalse; - - iState = EStopped; - - if( aError == KErrNone ) - { - if( aDuration > 0 ) - { - iFileOpened = ETrue; - } - else - { -#if _DEBUG - RDebug::Print(_L("ProgressiveDownload - Open failed - could not calculate duration")); - RDebug::Print(_L("metadata is at the end of file PD not supported")); -#endif - iFileOpened = EFalse; - return; - } - - if( iFileSize > 0 ) - { - TInt err = iAudioPdPlayUtility->SetFileSize(iFileSize); -#if _DEBUG - RDebug::Print(_L("CPdProperties::SetFileSize=%d err %d"),iFileSize,err); -#endif - } - // After init is complete successfully, playback is to be started - // automatically. - iState = EStoppedAutoResume; - } - iCallback->MapcInitComplete(aError,aDuration); - - //Last chance to automatically play a file with very fast download - //or when the file is in cache and there are only a couple of download events. - if ( (iDownloadCompleted) && (aError == KErrNone ) ) - { - StartPlaying(); - } - } - -void CPdProperties::MapcPlayComplete(TInt aError) - { -#if _DEBUG - RDebug::Print(_L("ProgressiveDownload play complete err=%d"),aError); -#endif - //iError = aError; - // Playback stopped due to lac of data (KErrUnderflow) - if( aError == KErrUnderflow ) - {// By now, Controller would've gone to STOPPED state and would've reset - // play position to zero. There is no point in querying position here. - TTimeIntervalMicroSeconds timeposition; - TInt error = iAudioPdPlayUtility->GetPosition(timeposition); - if(timeposition > iTimePosition) - { - iTimePosition = timeposition; - } -#if _DEBUG - RDebug::Print(_L("ProgressiveDownload GetPosition return [%d] error[%d]"), I64INT(iTimePosition.Int64()), error); -#endif - iState = EStoppedAutoResume; - iCallback->Paused(); - } - else - { - iState = EStopped; - iCallback->MapcPlayComplete(aError); - } - } - -void CPdProperties::Playing() - { - iCallback->Playing(); - } - -void CPdProperties::Paused() - { - iCallback->Paused(); - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/PdProperties.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/PdProperties.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility -* -*/ - - - -#ifndef __PDPROPERTIES_H__ -#define __PDPROPERTIES_H__ - -#include -#include -#include -#include "AudioPdPlayUtility.h" - -//Forward Declaration - - -class CPdProperties :public CBase, - public MAudioPdPlayUtilityCallback - { - public: - - IMPORT_C static CPdProperties* NewL(); - IMPORT_C static CPdProperties* NewLC(); - - IMPORT_C ~CPdProperties(); - - IMPORT_C CAudioPdPlayUtility* OpenL(const TDesC& aFileName,MAudioPdPlayUtilityCallback& aCallback); - IMPORT_C CAudioPdPlayUtility* OpenL(const RFile& aFileHandle,MAudioPdPlayUtilityCallback& aCallback); - - private: - CPdProperties(); - void ConstructL(); - void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue); - - TInt CalculatePercentageDownloaded(); - void SavePosition(); - void HandleDownloadUpdateL(); - - // This function is no where used. Remove it. - //void StartPaused(); - void StartPlaying(); - - void Playing(); - void Paused(); - - //From MMdaAudioPlayerCallback - void MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& aDuration); - void MapcPlayComplete(TInt aError); - - enum TState - { - EStopped, - /*EOpening,*/ - /*EPaused,*/ - EStoppedAutoResume, /* State which will automatically re-start playback*/ - EPlaying - }; - - TTimeIntervalMicroSeconds iTimePosition; - MAudioPdPlayUtilityCallback* iCallback; - CAudioPdPlayUtility* iAudioPdPlayUtility; - HBufC* iFileName; - RFile iFileHandle; - TBool iFileOpened; - TInt iAttemptsToOpen; - TBool iUseFileHandle; - //TInt iError; /* Not used */ - TInt iFileSize; - TInt iBytesDownloaded; - TInt iFileBytePosition; - TBool iDownloadCompleted; - enum TState iState; - TInt iPercentageToBuffer; - TBool iOpenInProgress; - }; - -#endif - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/ProgressiveDownloadUtility.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/ProgressiveDownloadUtility.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,72 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Progressive Download Utility -* -*/ - - - -#include -#include "PdProperties.h" -/** -Concrete implementation of the CProgressDownloadUtility API. -@see CProgressDownloadUtility -*/ - -EXPORT_C CProgressiveDownloadUtility* CProgressiveDownloadUtility::NewL() - { - CProgressiveDownloadUtility* self = new(ELeave) CProgressiveDownloadUtility(); - CleanupStack::PushL(self); - - self->iProperties = CPdProperties::NewL(); - CleanupStack::Pop(self); - return self; - } - -EXPORT_C CProgressiveDownloadUtility::~CProgressiveDownloadUtility() - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadUtility::~CProgressiveDownloadUtility")); - #endif - delete iProperties; - } - -void CProgressiveDownloadUtility::ConstructL() - { - - } - -CProgressiveDownloadUtility::CProgressiveDownloadUtility() - { - - } - -EXPORT_C MAudioPdPlayUtility* CProgressiveDownloadUtility::OpenL(const TDesC& aFileName,MAudioPdPlayUtilityCallback& aCallback) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadUtility::OpenL by filename")); - #endif - return STATIC_CAST(MAudioPdPlayUtility*,iProperties->OpenL(aFileName,aCallback)); - - } - -EXPORT_C MAudioPdPlayUtility* CProgressiveDownloadUtility::OpenL(const RFile& aFileHandle,MAudioPdPlayUtilityCallback& aCallback) - { - #if _DEBUG - RDebug::Print(_L("CProgressiveDownloadUtility::OpenL by filehandle")); - #endif - return STATIC_CAST(MAudioPdPlayUtility*,iProperties->OpenL(aFileHandle,aCallback)); - } - -// ENd of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/mmfclientutility.cpp --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/mmfclientutility.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,2308 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Audio, MIDI and Video client utility functions. -* -*/ - - -#include -#include -#include -#include -#include -using namespace ContentAccess; - -#include "mmfclientutility.h" -#include - -const TInt KMaxMimeLength = 256; -const TInt KMaxHeaderSize = 256; -#ifdef __WINDOWS_MEDIA -_LIT8(KWMAMimeType,"audio/x-ms-wma"); -#endif - -void CUPanic(TInt aCUPanicCode) - { - _LIT(KMMFMediaClientUtilityPaanicCategory, "MMFClientUtility"); - User::Panic(KMMFMediaClientUtilityPaanicCategory, aCUPanicCode); - } - -/** - * @internalComponent - */ - TUid CMMFClientUtility::ConvertMdaFormatUidToECOMWrite(TUid aMdaFormatUid) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::ConvertMdaFormatUidToECOMWrite\n")); - #endif - TUid ECOMUid = KNullUid; - if (aMdaFormatUid == KUidMdaClipFormatWav) - ECOMUid = TUid::Uid(KMmfUidFormatWAVWrite); - else if (aMdaFormatUid == KUidMdaClipFormatAu) - ECOMUid = TUid::Uid(KMmfUidFormatAUWrite); - else if (aMdaFormatUid == KUidMdaClipFormatRawAudio) - ECOMUid = TUid::Uid(KMmfUidFormatRAWWrite); - else if (aMdaFormatUid == KUidMdaClipFormatRawAmr) - ECOMUid = TUid::Uid(KAdvancedUidFormatAMRWrite); - - return ECOMUid; - } - -/** - * @internalComponent - */ - TUid CMMFClientUtility::ConvertMdaFormatUidToECOMRead(TUid aMdaFormatUid) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::ConvertMdaFormatUidToECOMRead\n")); - #endif - TUid ECOMUid = KNullUid; - if (aMdaFormatUid == KUidMdaClipFormatWav) - ECOMUid = TUid::Uid(KMmfUidFormatWAVRead); - else if (aMdaFormatUid == KUidMdaClipFormatAu) - ECOMUid = TUid::Uid(KMmfUidFormatAURead); - else if (aMdaFormatUid == KUidMdaClipFormatRawAudio) - ECOMUid = TUid::Uid(KMmfUidFormatRAWRead); - else if (aMdaFormatUid == KUidMdaClipFormatRawAmr) - ECOMUid = TUid::Uid(KAdvancedUidFormatAMRRead); - - return ECOMUid; - } - -/** - * @internalComponent - */ - TInt CMMFClientUtility::GetFileHeaderData(const TDesC& aFileName, TDes8& aHeaderData, TInt aMaxLength) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::GetFileHeaderData***\n")); - #endif - RFs fsSession; - RFile file; - TInt error = KErrNone; - TInt size = 0; - if ((error = fsSession.Connect()) == KErrNone) - { - //rj if ((error = file.Open(fsSession, aFileName, EFileShareReadersOnly)) == KErrNone) - if ((error = file.Open(fsSession, aFileName, EFileShareAny)) == KErrNone) - { - - - if ((error = file.Size(size)) == KErrNone) - { - if (size > 0) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::GetFileHeaderData actual size= %d \n"),size); - #endif - if (size > aMaxLength) - size = aMaxLength; - - error = file.Read(aHeaderData, size); - } - } - file.Close(); - } - fsSession.Close(); - - - } - - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::GetFileHeaderData err %d header %d\n"),error,size); - #endif - - return error; - } - -/** - * @internalComponent - */ - TFourCC CMMFClientUtility::ConvertMdaCodecToFourCC(TMdaPackage& aCodec) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::ConvertMdaCodecToFourCC\n")); - #endif - TFourCC dataType = KMMFFourCCCodeNULL; - switch (aCodec.Uid().iUid) - { - case KUidMdaWavPcmCodecDefine: - { - TMdaPcmWavCodec* pcmWavCodec = (TMdaPcmWavCodec*)&aCodec; - if (pcmWavCodec->iBits == TMdaPcmWavCodec::E8BitPcm) - dataType = KMMFFourCCCodePCMU8; //8 bit PCM - else - dataType = KMMFFourCCCodePCM16; //16 bit PCM - break; - } - case KUidMdaAu8PcmCodecDefine: - dataType = KMMFFourCCCodePCM8; - break; - case KUidMdaAuCodecDefine: - case KUidMdaAu16PcmCodecDefine: - dataType = KMMFFourCCCodePCM16B; - break; - - case KUidMdaAuMulawCodecDefine: - case KUidMdaWavMulawCodecDefine: - case KUidMdaRawAudioMulawCodecDefine: //uLAW - dataType = KMMFFourCCCodeMuLAW; - break; - case KUidMdaAuAlawCodecDefine: - case KUidMdaWavAlawCodecDefine: - case KUidMdaRawAudioAlawCodecDefine: //ALAW - dataType = KMMFFourCCCodeALAW; - break; - case KUidMdaRawAudioS8PcmCodecDefine: // P8 - dataType = KMMFFourCCCodePCM8; - break; - case KUidMdaRawAudioU8PcmCodecDefine: // PU8 - dataType = KMMFFourCCCodePCMU8; - break; - case KUidMdaRawAudioSL16PcmCodecDefine: // P16 - dataType = KMMFFourCCCodePCM16; - break; - case KUidMdaRawAudioSB16PcmCodecDefine: //P16B - dataType = KMMFFourCCCodePCM16B; - break; - case KUidMdaRawAudioUL16PcmCodecDefine: //PU16 - dataType = KMMFFourCCCodePCMU16; - break; - case KUidMdaRawAudioUB16PcmCodecDefine: //PU6B - dataType = KMMFFourCCCodePCMU16B; - break; - case KUidMdaGsmWavCodecDefine: //GSM6 - dataType = KMMFFourCCCodeGSM610; - break; - case KUidMdaWavImaAdpcmCodecDefine: - dataType = KMMFFourCCCodeIMAD; - break; - case KUidMdaRawAmrCodecDefine: - dataType = KMMFFourCCCodeAMR; - break; - default: // Not a Uid we recognise - dataType = KMMFFourCCCodeNULL; - break; - } - return dataType; - } - - -CMMFUtilityFileInfo* CMMFUtilityFileInfo::NewL(TMMSource& aSource) - { - CMMFUtilityFileInfo* self = CMMFUtilityFileInfo::NewLC(aSource); - CleanupStack::Pop(self); - return self; - } - - -CMMFUtilityFileInfo* CMMFUtilityFileInfo::NewLC(TMMSource& aSource) - { - CMMFUtilityFileInfo* self = new (ELeave) CMMFUtilityFileInfo; - CleanupStack::PushL(self); - self->ConstructL(aSource); - return self; - } - - -void CMMFUtilityFileInfo::ConstructL(const TMMSource& aSource) - { - if (aSource.SourceType()==KUidMMFileSource) - { - const TMMFileSource& fileSource = static_cast(aSource); - iData = CData::NewL(TVirtualPathPtr(fileSource.Name(), fileSource.UniqueId()), - EContentShareReadWrite/*EContentShareReadOnly*/); - } - - if (aSource.SourceType()==KUidMMFileHandleSource) - { - const TMMFileHandleSource& fileHandleSource = static_cast(aSource); - iData = CData::NewL(fileHandleSource.Handle(), fileHandleSource.UniqueId()); - } - - TInt err = iData->SetProperty(EAgentPropertyAgentUI, aSource.IsUIEnabled()); - - if (err != KErrNone && err != KErrCANotSupported) - { - // KErrCANotSupported isn't a problem for us so eat the error code. - User::Leave(err); - } - - err = iData->EvaluateIntent(aSource.Intent()); - User::LeaveIfError(err); - } - -TInt CMMFUtilityFileInfo::EvaluateIntent(TIntent aIntent) - { - return iData->EvaluateIntent(aIntent); - } -/** - * @internalComponent - */ -TBool CMMFUtilityFileInfo::GetFileMimeTypeL(TDes8& aMimeType) - { - #if _DEBUG - RDebug::Print(_L("CMMFUtilityFileInfo::GetFileMimeTypeL\n")); - #endif - return iData->GetMimeTypeL(aMimeType); - } - -/** - * @internalComponent - */ -void CMMFUtilityFileInfo::GetFileHeaderDataL(TDes8& aHeaderData, TInt aMaxLength) - { - #if _DEBUG - RDebug::Print(_L("CMMFUtilityFileInfo::GetFileHeaderDataL\n")); - #endif - TInt size = 0; - iData->DataSizeL(size); - if (size > 0) - { - if (size > aMaxLength) - size = aMaxLength; - TInt pos = 0; - User::LeaveIfError(iData->Seek(ESeekStart, pos)); - User::LeaveIfError(iData->Read(aHeaderData, size)); - } - } - -/** - * @internalComponent - */ - HBufC8* CMMFClientUtility::GetFileExtensionL(const TDesC& aFileName) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::GetFileExtensionL\n")); - #endif - TParse fileName; - fileName.Set(aFileName,NULL,NULL); - HBufC8* fileSuffix = NULL; - if(fileName.ExtPresent()) - { - TPtrC fileSuffixPtr(fileName.Ext()); - fileSuffix = HBufC8::NewL(fileSuffixPtr.Length()); - fileSuffix->Des().Copy(fileSuffixPtr); - } - else - { - fileSuffix = KNullDesC8().AllocL(); - } - return fileSuffix; - } - - -/** - * @internalComponent - */ -CMMFUtilityFileInfo::~CMMFUtilityFileInfo() - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::~CMMFUtilityFileInfo\n")); - #endif - delete iData; - } - -/* - * @internalComponent - * - * Returns an integer rating indicating how well the supplied format matches - * the header data and file extension supplied. - * 3 brownie points awarded for data & suffix match. - * 2 brownie points awarded for data match alone. - * 1 brownie point awarded for suffix match alone. - */ -TInt CMMFClientUtility::GetBestMatchL(const CMMFFormatImplementationInformation* format, const TDesC8& aHeaderData, const TDesC8& aFileExtension) - { - #if _DEBUG - RDebug::Print(_L("CMMFClientUtility::GetBestMatchL\n")); - #endif - TInt browniePoints = 0; - - if (aHeaderData.Length() > 0) // Non empty file - { - if (aFileExtension.Length() > 0) // With a file extension - { - if (format->SupportsHeaderDataL(aHeaderData) && - format->SupportsFileExtension(aFileExtension)) - { - browniePoints = 3; - } - else if (format->SupportsHeaderDataL(aHeaderData)) - { - browniePoints = 2; - } - else - { - // See if this format has any 'empty' match data or no match data, indicating - // that this format will match extension alone even if data present. - // (A format may have more than one match data string.) - const CDesC8Array& supportedHeaderData = format->SupportedHeaderData(); - - if (supportedHeaderData.Count() == 0) - { - // No header data indicated. - if (format->SupportsFileExtension(aFileExtension)) - { - browniePoints = 1; - } - } - else - { - for (register TInt i = 0; i < supportedHeaderData.Count(); i++) - { - if ((supportedHeaderData[i].Length() == 0) && - format->SupportsFileExtension(aFileExtension)) - { - browniePoints = 1; - } - } - } - } - } - else - { - // No file suffix, so must match header data alone. - if (format->SupportsHeaderDataL(aHeaderData)) - { - browniePoints = 2; - } - } - } - else // Empty File - { - // We have no choice but to match extension, if there is one. - if ((aFileExtension.Length() > 0) && format->SupportsFileExtension(aFileExtension)) - { - browniePoints = 1; - } - } - - return browniePoints; -} - -/** - * @internalComponent - * - * This function parses all the play & record formats in the given list of controllers, - * looking for controllers & formats that best match the requirements. - * Play controllers will be returned before record controllers, and - * in cases of equal priority between formats, ECom order will be maintained. - * - * @param "aControllers" - * A reference to a user supplied list of controllers retrieved from ECom. - * This list may be have been filtered for audio/video/play/record. - * @param "aHeaderDataPlayback" - * A descriptor reference containing the file's header data. - * for matching against a controller's play formats. May be KNullDesC8 - * @param "aFileExtensionPlayback" - * A descriptor reference containing the filename's extension. - * for matching against a controller's play formats. May be KNullDesC8 - * @param "aHeaderDataRecord" - * A descriptor reference containing the file's header data. - * for matching against a controller's record formats. May be KNullDesC8 - * @param "aFileExtensionRecord" - * A descriptor reference containing the filename's extension. - * for matching against a controller's record formats. May be KNullDesC8 - * @param "aPrioritisedControllers" - * A reference to a user supplied list through which the list of - * prioritised controllers will be returned. - * @since 7.0s - * @lib "MediaClientUtility.lib" - */ -void CMMFClientUtility::PrioritiseControllersL( - const RMMFControllerImplInfoArray& aControllers, - const TDesC8& aHeaderDataPlayback, - const TDesC8& aFileExtensionPlayback, - const TDesC8& aHeaderDataRecord, - const TDesC8& aFileExtensionRecord, - RMMFControllerImplInfoArray& prioritisedControllers) - { - RMMFControllerImplInfoArray fullMatchControllers; // data AND suffix - CleanupClosePushL(fullMatchControllers); - RMMFControllerImplInfoArray partMatchControllers; // data OR suffix - CleanupClosePushL(partMatchControllers); - - TBool checkingPlaybackFormats = EFalse; - TBool checkingRecordFormats = EFalse; - - if (aHeaderDataPlayback != KNullDesC8 || aFileExtensionPlayback != KNullDesC8) - checkingPlaybackFormats = ETrue; - if (aHeaderDataRecord != KNullDesC8 || aFileExtensionRecord != KNullDesC8) - checkingRecordFormats = ETrue; - - // Examine each format for each controller. We only want to know at this stage - // if the controller has suitable formats, so as soon as we know it has, we can - // add it to out list, ranked by how well it matched. - for (register TInt i = 0; i < aControllers.Count(); i++) - { - const CMMFControllerImplementationInformation* controller = aControllers[i]; - TInt savedBrowniePointsPlayback = 0; - TInt savedBrowniePointsRecord = 0; - - if (checkingPlaybackFormats) - { - for (register TInt p = 0; p < controller->PlayFormats().Count(); p++) - { - const CMMFFormatImplementationInformation* format = controller->PlayFormats()[p]; - - TInt browniePoints = GetBestMatchL(format, aHeaderDataPlayback, aFileExtensionPlayback); - - if (browniePoints >= savedBrowniePointsPlayback) - savedBrowniePointsPlayback = browniePoints; - } - } - - if (checkingRecordFormats) - { - for (register TInt r = 0; r < controller->RecordFormats().Count(); r++) - { - const CMMFFormatImplementationInformation* format = controller->RecordFormats()[r]; - - TInt browniePoints = GetBestMatchL(format, aHeaderDataRecord, aFileExtensionRecord); - - if (browniePoints >= savedBrowniePointsRecord) - savedBrowniePointsRecord = browniePoints; - } - } - - TInt savedBrowniePoints = 0; - // if we're checking both playback & record formats - // make sure we've found both - if (checkingPlaybackFormats && checkingRecordFormats) - { - savedBrowniePoints = Min(savedBrowniePointsPlayback, savedBrowniePointsRecord); - } - else if (checkingPlaybackFormats) - { - savedBrowniePoints = savedBrowniePointsPlayback; - } - else if (checkingRecordFormats) - { - savedBrowniePoints = savedBrowniePointsRecord; - } - - // Checked all formats for this controller, now count our brownie points. - switch (savedBrowniePoints) - { - case 3: - User::LeaveIfError(fullMatchControllers.Append(controller)); - break; - case 2: - User::LeaveIfError(partMatchControllers.Insert(controller, 0)); - break; - case 1: - User::LeaveIfError(partMatchControllers.Append(controller)); - break; - default: - break; - } - } - - // The better the controller matches, the earlier it will be in the final list. - for (register TInt x = 0; x < fullMatchControllers.Count(); x++) - { - if (prioritisedControllers.Find(fullMatchControllers[x]) == KErrNotFound) - { - User::LeaveIfError(prioritisedControllers.Append(fullMatchControllers[x])); - } - } - - for (register TInt y = 0; y < partMatchControllers.Count(); y++) - { - if (prioritisedControllers.Find(partMatchControllers[y]) == KErrNotFound) - { - User::LeaveIfError(prioritisedControllers.Append(partMatchControllers[y])); - } - } - - CleanupStack::PopAndDestroy(2, &fullMatchControllers); // fullMatchControllers, partMatchControllers - } - -/** - * @internalComponent - */ - CMMFMdaObjectStateChangeObserverCallback* CMMFMdaObjectStateChangeObserverCallback::NewL(MMdaObjectStateChangeObserver& aCallback) - { - return new(ELeave) CMMFMdaObjectStateChangeObserverCallback(aCallback); - } - -/** - * @internalComponent - */ -CMMFMdaObjectStateChangeObserverCallback::~CMMFMdaObjectStateChangeObserverCallback() - { - Cancel(); - } - -/** - * @internalComponent - */ - void CMMFMdaObjectStateChangeObserverCallback::CallBack(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode) - { - iObject = aObject; - iPreviousState = aPreviousState; - iCurrentState = aCurrentState; - iErrorCode = aErrorCode; - if (!IsActive()) - { - TRequestStatus* s = &iStatus; - SetActive(); - User::RequestComplete(s, KErrNone); - } - } - -CMMFMdaObjectStateChangeObserverCallback::CMMFMdaObjectStateChangeObserverCallback(MMdaObjectStateChangeObserver& aCallback) : - CActive(CActive::EPriorityHigh), - iCallback(aCallback) - { - #if _DEBUG - RDebug::Print(_L("CMMFMdaObjectStateChangeObserverCallback::CMMFMdaObjectStateChangeObserverCallback\n")); - #endif - CActiveScheduler::Add(this); - } - -void CMMFMdaObjectStateChangeObserverCallback::RunL() - { - #if _DEBUG - RDebug::Print(_L("CMMFMdaObjectStateChangeObserverCallback::RunL\n")); - #endif - iCallback.MoscoStateChangeEvent(iObject, iPreviousState, iCurrentState, iErrorCode); - } - -void CMMFMdaObjectStateChangeObserverCallback::DoCancel() - { - #if _DEBUG - RDebug::Print(_L("CMMFMdaObjectStateChangeObserverCallback::DoCancel\n")); - #endif - //nothing to cancel - } - - -//**************************************** -// CMMFFindAndOpenController -//**************************************** - -/** - * Factory function to create a CMMFFindAndOpenController class - * - * @internalComponent - */ - CMMFFindAndOpenController* CMMFFindAndOpenController::NewL(MMMFFindAndOpenControllerObserver& aObserver) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::NewL\n")); - #endif - CMMFFindAndOpenController* self = new(ELeave) CMMFFindAndOpenController(aObserver); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -CMMFFindAndOpenController::~CMMFFindAndOpenController() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::~CMMFFindAndOpenController\n")); - #endif - Cancel(); - - // delete temporary variables - Close(); - - // this should cancel the AO - delete iAddDataSourceSinkAsync; - - delete iPrimaryConfig; - delete iSecondaryConfig; - } - -/** - * Function to free up memory after a successful open has completed - * Useful to allow a alloc testing to work. - * Must not be called if ReOpen() is to be called - * - * @internalComponent - */ - void CMMFFindAndOpenController::Close() - { - - Cancel(); - - if(iAddDataSourceSinkAsync) - { - iAddDataSourceSinkAsync->Cancel(); - } - - if (iPrimaryConfig) - iPrimaryConfig->Close(); - if (iSecondaryConfig) - iSecondaryConfig->Close(); - - iPrioritisedControllers.Close(); - iControllers.ResetAndDestroy(); - iControllers.Close(); - - iFileName.SetLength(0); - iFileNameSecondary.SetLength(0); - - delete iUrl; - iUrl = NULL; - - delete iMimeType; - iMimeType = NULL; - - delete iUniqueId; - iUniqueId = NULL; - - iFileHandle.Close(); - iUseFileHandle = EFalse; - } - -CMMFFindAndOpenController::CMMFFindAndOpenController(MMMFFindAndOpenControllerObserver& aObserver) : - CActive(EPriorityStandard), - iObserver(aObserver), - iDescriptor(NULL, 0) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::CMMFFindAndOpenController\n")); - #endif - CActiveScheduler::Add(this); - } - -void CMMFFindAndOpenController::ConstructL() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::ConstructL\n")); - #endif - iAddDataSourceSinkAsync = CMMFAddDataSourceSinkAsync::NewL(*this); - iPrimaryConfig = new (ELeave) CConfig(); - iSecondaryConfig = new (ELeave) CConfig; - iCurrentConfig = iPrimaryConfig; - } - -void CMMFFindAndOpenController::RunL() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::RunL\n")); - #endif - Process(); - } - -void CMMFFindAndOpenController::DoCancel() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::DoCancel\n")); - #endif - iAddDataSourceSinkAsync->Cancel(); - } - -/** - * Defines the media ID & priority to be used when opening a controller - * Normally called once only after class has been constructed - * - * @param aMediaId - * the media ID to use when searching for a controller - * e.g. KUidMediaTypeAudio - * @param aPrioritySettings - * the priority settings to use when opening a controller - * @param aMediaIdMatchType - * Defines the type of media id match to be performed on the plugins - * returned from the ECOM registry. - * @leave can leave with KErrNoMemory - - * @internalComponent - */ - void CMMFFindAndOpenController::Configure( - TUid aMediaId, - TMMFPrioritySettings aPrioritySettings, - CMMFPluginSelectionParameters::TMediaIdMatchType aMediaIdMatchType) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::Configure\n")); - #endif - iPrioritySettings = aPrioritySettings; - - iMediaIdMatchType = aMediaIdMatchType; - - iMediaId = aMediaId; - } - -void CMMFFindAndOpenController::ConfigureController( - CConfig& config, - RMMFController& aController, - CMMFControllerEventMonitor& aEventMonitor, - TControllerMode aControllerMode) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::ConfigureController\n")); - #endif - config.iController = &aController; - config.iEventMonitor = &aEventMonitor; - config.iControllerMode = aControllerMode; - } - -/** - * Configures the primary controller - * - * @param aController - * a reference to the client controller object to use - * @param aEventMonitor - * a reference to an event monitor object for receiving - * events from the controller - * @param aControllerMode - * indicates whether this controller is to be used for recording - * or playback - * - * @internalComponent - */ - void CMMFFindAndOpenController::ConfigureController( - RMMFController& aController, - CMMFControllerEventMonitor& aEventMonitor, - TControllerMode aControllerMode) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::ConfigureController2\n")); - #endif - ConfigureController( - *iPrimaryConfig, - aController, - aEventMonitor, - aControllerMode); - } - -/** - * Configures the secondary controller - * - * This is only needed for the audio recorder utility which opens - * one controller for playback and another for recording - * - * @param aController - * a reference to the client controller object to use - * @param aEventMonitor - * a reference to an event monitor object for receiving - * events from the controller - * @param aControllerMode - * indicates whether this controller is to be used for recording - * or playback or converting - * - * @internalComponent - */ - void CMMFFindAndOpenController::ConfigureSecondaryController( - RMMFController& aController, - CMMFControllerEventMonitor& aEventMonitor, - TControllerMode aControllerMode) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::ConfigureSecondaryController\n")); - #endif - ConfigureController( - *iSecondaryConfig, - aController, - aEventMonitor, - aControllerMode); - } - -void CMMFFindAndOpenController::Init() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::Init\n")); - #endif - // This should be called prior to opening, so reset the error - iError = KErrNone; - iSourceSinkConfigured = EFalse; - iControllerCount = 0; - } - -void CMMFFindAndOpenController::ConfigureSourceSink( - CConfig& config, - TSourceSink aSource, - TSourceSink aSink) - { - TInt err; - TRAP(err, config.iSource = CreateSourceSinkL(aSource)); - if (err != KErrNone) - { - iError = err; - return; - } - - TRAP(err, config.iSink = CreateSourceSinkL(aSink)); - if (err != KErrNone) - { - iError = err; - return; - } - } - - -void CMMFFindAndOpenController::ConfigureSourceSink( - CConfig& config, - const TMMSource& aSource, - TSourceSink aSink) - { - TInt err; - TRAP(err, config.iSource = CreateSourceSinkL(aSource)); - if (err != KErrNone) - { - iError = err; - return; - } - - TRAP(err, config.iSink = CreateSourceSinkL(aSink)); - if (err != KErrNone) - { - iError = err; - return; - } - } - - - -/** - * Configure the primary controller's source and sink - * The descriptors passed to this function are copied so they do not need to be persistent. - * To simplify the API, any errors that occur are reported back asynchronously following - * a subsequent call to OpenByXXX() - * - * @param aSourceUid - * the UID of the data source - * @param aSourceData - * a reference to a descriptor used to configure the source - * @param aSinkUid - * the UID of the data sink - * @param aSinkData - * a reference to a descriptor used to configure the sink - * - * @internalComponent - */ - void CMMFFindAndOpenController::ConfigureSourceSink( - TSourceSink aSource, - TSourceSink aSink) - { - - CConfig* config = NULL; - - Init(); - config = iPrimaryConfig; - - - // must have already called ConfigureController() - __ASSERT_ALWAYS(config->iController != NULL, CUPanic(EMMFMediaClientUtilityBadState)); - - ConfigureSourceSink( - *config, - aSource, - aSink); - iCurrentConfig = config; - - iSourceSinkConfigured = ETrue; - } - - -/** - * Configure the primary controller's source and sink - * The descriptors passed to this function are copied so they do not need to be persistent. - * To simplify the API, any errors that occur are reported back asynchronously following - * a subsequent call to OpenByXXX() - * - * @param aSourceUid - * the UID of the data source - * @param aSourceData - * a reference to a descriptor used to configure the source - * @param aSinkUid - * the UID of the data sink - * @param aSinkData - * a reference to a descriptor used to configure the sink - * - * @internalComponent - */ - void CMMFFindAndOpenController::ConfigureSecondarySourceSink( - TSourceSink aSource, - TSourceSink aSink) - { - if (iError != KErrNone) - { - // if there was an error configuring the primary source/sink, do not try the secondary one - // Don't return the error, since the stored error will be returned by the OpenBy... method - return; - } - - CConfig* config = NULL; - - config = iSecondaryConfig; - - // must have already configured the primary controller - __ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState)); - config = iSecondaryConfig; - - // must have already called ConfigureController() - __ASSERT_ALWAYS(config->iController != NULL, CUPanic(EMMFMediaClientUtilityBadState)); - - ConfigureSourceSink( - *config, - aSource, - aSink); - iCurrentConfig = config; - - iSourceSinkConfigured = ETrue; - } - - - - - void CMMFFindAndOpenController::ConfigureSourceSink( - const TMMSource& aSource, - TSourceSink aSink) - { - Init(); - CConfig* config = iPrimaryConfig; - - // must have already called ConfigureController() - __ASSERT_ALWAYS(config->iController != NULL, CUPanic(EMMFMediaClientUtilityBadState)); - - ConfigureSourceSink( - *config, - aSource, - aSink); - iCurrentConfig = config; - - iSourceSinkConfigured = ETrue; - } - - - - -/** - * Opens a controller using the supplied controller UID - * and adds the source & sink - * Completion is indicated asynchonously by a call to MfaocComplete() - * - * @param aControllerUid - * the UID of the primary controller - * @param aControllerUid - * the UID of the secondary controller - * - * @internalComponent - */ - void CMMFFindAndOpenController::OpenByControllerUid( - TUid aControllerUid, - TUid aSecondaryControllerUid) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::OpenByControllerUid\n")); - #endif - // must have already called ConfigureSourceSink() - __ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState)); - - // Have there been any errors so far ? - if (iError != KErrNone) - { - SchedSendError(); - return; - } - - if (iCurrentConfig == iPrimaryConfig) - { - // only do this for the playback controller - TRAP(iError, iCurrentConfig->iSource->EvaluateIntentL()) - - if (iError != KErrNone) - { - SchedSendError(); - return; - } - } - - iPrimaryConfig->iControllerUid = aControllerUid; - if (iCurrentConfig == iSecondaryConfig) - { - if (aSecondaryControllerUid == KNullUid) - iSecondaryConfig->iControllerUid = aControllerUid; - else - iSecondaryConfig->iControllerUid = aSecondaryControllerUid; - } - - iMode = EOpenByControllerUid; - iControllerImplInfo = NULL; - iState = EOpenController; - KickState(); - } - -/** - * Opens a controller using the supplied file name - * and adds the source & sink - * A copy is made of the filename or file handle so that it need not be persistent - * Completion is indicated asynchonously by a call to MfaocComplete() - * - * @param aSource - * a reference to a TFileSource object to be used when searching - * for a controller - * @param aFileNameSecondary - * a reference to the seconday filename to be used when searching - * for a controller. This need only be supplied when converting - * between two files. - * - * @internalComponent - */ - void CMMFFindAndOpenController::OpenByFileSource(const TMMSource& aSource, const TDesC& aFileNameSecondary) - { - // must have already called ConfigureSourceSink() - __ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState)); - - TInt err; - // Have there been any errors so far ? - if (iError != KErrNone) - { - SchedSendError(); - return; - } - - if (aSource.SourceType()==KUidMMFileSource) - { - const TMMFileSource& fileSource = static_cast(aSource); - iFileName = fileSource.Name(); - } - - if (aSource.SourceType()==KUidMMFileHandleSource) - { - const TMMFileHandleSource& fileHandleSource = static_cast(aSource); - err = iFileHandle.Duplicate(fileHandleSource.Handle()); - - - if (err != KErrNone) - { - SchedSendError(err); - return; - } - - iFileHandle.Name(iFileName); //ignore error return since we'll just do without the filename if not available - - - iUseFileHandle = ETrue; - } - - TRAP(err, iUniqueId = aSource.UniqueId().AllocL()); - iIntent = aSource.Intent(); - if (err != KErrNone) - { - SchedSendError(err); - return; - } - - - // take a copy of the secondary file name - iFileNameSecondary = aFileNameSecondary; - - iMode = EOpenByFileName; - iState = EBuildControllerList; - KickState(); - } - -/** - * Opens a controller using the supplied format UID - * and adds the source & sink - * Completion is indicated asynchonously by a call to MfaocComplete() - * - * @param aFormatUid - * the UID of a format that must be supported by the controller - * @param aFormatUidSecondary - * the UID of a secondary format that must be supported by the controller - * This need only be supplied when converting between two differnet formats. - * - * @internalComponent - */ - void CMMFFindAndOpenController::OpenByFormatUid(TUid aFormatUid, TUid aFormatUidSecondary) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::OpenByFormatUid\n")); - #endif - // must have already called ConfigureSourceSink() - __ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState)); - - // Have there been any errors so far ? - if (iError != KErrNone) - { - SchedSendError(); - return; - } - - iFormatUid = aFormatUid; - iFormatUidSecondary = aFormatUidSecondary; - - iMode = EOpenByFormatUid; - iState = EBuildControllerList; - KickState(); - } - -/** - * Opens a controller using the supplied descriptor - * and adds the source & sink - * Completion is indicated asynchonously by a call to MfaocComplete() - * - * @param aDescriptor - * a reference to the descriptor to be used when searching - * for a controller - * - * @internalComponent - */ - void CMMFFindAndOpenController::OpenByDescriptor(const TDesC8& aDescriptor) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::OpenByDescriptor\n")); - #endif - // must have already called ConfigureSourceSink() - __ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState)); - - // Have there been any errors so far ? - if (iError != KErrNone) - { - SchedSendError(); - return; - } - - // take a copy of the descriptor - TUint8* desBufferPtr = const_cast (aDescriptor.Ptr()); - iDescriptor.Set( desBufferPtr,aDescriptor.Length(),aDescriptor.Length()); - - iMode = EOpenByDescriptor; - iState = EBuildControllerList; - KickState(); - } - -/** - * Opens a controller using the supplied URL - * and adds the source & sink - * Completion is indicated asynchonously by a call to MfaocComplete() - * - * @param aUrl - * a reference to the URL to be used when searching for a controller - * @param aIapId - * the IAP ID to be used when searching for a controller - * @param aMimeType - * the MIME type of the data to be used when searching for a controller - * - * @internalComponent - */ - void CMMFFindAndOpenController::OpenByUrl(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::OpenByUrl\n")); - #endif - // must have already called ConfigureSourceSink() - __ASSERT_ALWAYS(iSourceSinkConfigured, CUPanic(EMMFMediaClientUtilityBadState)); - - // Have there been any errors so far ? - if (iError != KErrNone) - { - SchedSendError(); - return; - } - - // take a copy of the Url - delete iUrl; - iUrl = NULL; - iUrl = aUrl.Alloc(); - if (iUrl == NULL) - { - SchedSendError(KErrNoMemory); - return; - } - - // take a copy of the IapId - iIapId = aIapId; - - // take a copy of the mime type - delete iMimeType; - iMimeType = NULL; - iMimeType = aMimeType.Alloc(); - if (iMimeType == NULL) - { - SchedSendError(KErrNoMemory); - return; - } - - iMode = EOpenByUrl; - iState = EBuildControllerList; - KickState(); - } - -/** - * Static function to return a TMMFFileConfig object - * suitable for passing to ConfigureSourceSink() - * - * @param aFileName - * the filename to use - * - * @internalComponent - */ - TMMFFileConfig CMMFFindAndOpenController::GetConfigFile(const TDesC& aFileName) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::GetConfigFile\n")); - #endif - TMMFFileConfig sourceSinkData; - sourceSinkData().iPath = aFileName; - return sourceSinkData; - } - -/** - * Static function to return a TMMFDescriptorConfig object - * suitable for passing to ConfigureSourceSink() - * - * @param aFileName - * the filename to use - * - * @internalComponent - */ - TMMFDescriptorConfig CMMFFindAndOpenController::GetConfigDescriptor(const TDesC8& aDescriptor) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::GetConfigDescriptor\n")); - #endif - TMMFDescriptorConfig sourceSinkData; - sourceSinkData().iDes = (TAny*)&aDescriptor; - sourceSinkData().iDesThreadId = RThread().Id(); - return sourceSinkData; - } - -/** - * Static function to create a CBufFlat object - * suitable for passing to ConfigureSourceSink() - * - * @param aUrlCfgBuffer - * the reference to a caller-supplied pointer used to create - * a CBufFlat object. The caller is responsible for deletion. - * @param aUrl - * a reference to the URL to be used - * @param aIapId - * the IAP ID to be used - * @return can return KErrNone or KErrNoMemory - * - * @internalComponent - */ - TInt CMMFFindAndOpenController::GetConfigUrl(CBufFlat*& aUrlCfgBuffer, const TDesC& aUrl, TInt aIapId) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::GetConfigDescriptor\n")); - #endif - TInt error; - delete aUrlCfgBuffer; - aUrlCfgBuffer = NULL; - - CMMFUrlParams* urlCfg = NULL; - TRAP(error, urlCfg = CMMFUrlParams::NewL(aUrl,aIapId)); - if (error != KErrNone) - return error; - - TRAP(error, - aUrlCfgBuffer = urlCfg->ExternalizeToCBufFlatLC(); - CleanupStack::Pop(aUrlCfgBuffer); - ); - - delete urlCfg; - - return error; - } - -/** - * ReOpens the previously opened primary controller - * - * @internalComponent - */ - void CMMFFindAndOpenController::ReOpen() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::ReOpen\n")); - #endif - // should already have a valid controller uid so just open it - iControllerImplInfo = NULL; - iState = EOpenController; - KickState(); - } - -void CMMFFindAndOpenController::OpenPrimaryController(void) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::OpenPrimaryController\n")); - #endif - iCurrentConfig = iPrimaryConfig; - switch(iMode) - { - case EOpenByFileName: - case EOpenByFormatUid: - case EOpenByDescriptor: - case EOpenByUrl: - iState = EBuildControllerList; - break; - case EOpenByControllerUid: - iControllerImplInfo = NULL; - iState = EOpenController; - break; - } - KickState(); - } - -void CMMFFindAndOpenController::KickState() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::KickState\n")); - #endif - TRequestStatus* status = &iStatus; - User::RequestComplete(status, KErrNone); - SetActive(); - } - -void CMMFFindAndOpenController::CloseController() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::CloseController\n")); - #endif - if (iCurrentConfig->iEventMonitor) - iCurrentConfig->iEventMonitor->Cancel(); - iCurrentConfig->iController->Close(); - } - -void CMMFFindAndOpenController::Process() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::Process\n")); - #endif - switch(iState) - { - case EBuildControllerList: - switch(iMode) - { - case EOpenByFileName: - TRAP(iError, BuildControllerListFileNameL()); - break; - case EOpenByDescriptor: - TRAP(iError, BuildControllerListDescriptorL()); - break; - case EOpenByUrl: - TRAP(iError, BuildControllerListUrlL()); - break; - case EOpenByFormatUid: - TRAP(iError, BuildControllerListFormatL()); - break; - default: - CUPanic(EMMFMediaClientUtilityBadState); - } - - if (iError != KErrNone) - { - iState = EIdle; - SendError(); - break; - } - - // try the first controller - iControllerIndex = -1; - TryNextController(); - break; - - case EOpenController: - // Make sure any existing controller is closed. - CloseController(); - - // Open the controller - if (iControllerImplInfo) - { - iError = iCurrentConfig->iController->Open(*iControllerImplInfo, iPrioritySettings); - } - else - { - iError = iCurrentConfig->iController->Open(iCurrentConfig->iControllerUid, iPrioritySettings); - } - - if (iError) - { - TryNextController(); - } - else - { - - iCurrentConfig->iEventMonitor->Start(); - - if (iCurrentConfig == iSecondaryConfig) - { - iState = EAddSource; - KickState(); - } - else - { - iState = EAddSink; - KickState(); - } - } - break; - - case EAddSource: - { - iState = EWaitingForSource; - const CMMSourceSink* source = iCurrentConfig->iSource; - iAddDataSourceSinkAsync->AddDataSource(*iCurrentConfig->iController, - source->SourceSinkUid(), - source->SourceSinkData()); - } - break; - - case EAddSink: - { - iState = EWaitingForSink; - const CMMSourceSink* sink = iCurrentConfig->iSink; - iAddDataSourceSinkAsync->AddDataSink(*iCurrentConfig->iController, - sink->SourceSinkUid(), - sink->SourceSinkData()); - } - break; - - case EWaitingForSource: - break; - - case EWaitingForSink: - break; - - case ESendError: - SendError(); - iState = EIdle; - break; - - case EIdle: - default: - break; - } - } - -void CMMFFindAndOpenController::TryNextController() - { - - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::TryNextController\n")); - #endif - // If an error occurred close the controller. - if (iError != KErrNone) - CloseController(); - - // take the first available exit if we're out of memory - if (iError == KErrNoMemory) - { - SendError(); - return; - } - - if (iMode == EOpenByControllerUid || ++iControllerIndex >= iControllerCount) - { - SendError(KErrNotSupported); // KErrNotSupported - return; - } - - if (iMode == EOpenByFileName || iMode == EOpenByFormatUid) - { - iControllerImplInfo = iPrioritisedControllers[iControllerIndex]; - } - else //if (iMode == EOpenByDescriptor || iMode == EOpenByUrl) - { - iControllerImplInfo = iControllers[iControllerIndex]; - } - - // This Flag is defined so that if the Helix Controller Supports - // the playback of Local Media for WMA, then the ProgDL still - // goes through the Old WMA Controller( AdvancedAudioController) - // We are launching the Old WMA Controller using the UID. - -#ifdef __WINDOWS_MEDIA - HBufC8* mimeType = HBufC8::NewLC(KMaxMimeLength); - TPtr8 mimeTypePtr = mimeType->Des(); - mimeTypePtr.Copy(KWMAMimeType()); - - TBool IsSupported = EFalse; - const RMMFFormatImplInfoArray& playFormatInfo = iControllerImplInfo->PlayFormats(); - - for (TInt p = 0; p < iControllerImplInfo->PlayFormats().Count(); p++) - { - const CMMFFormatImplementationInformation* format = iControllerImplInfo->PlayFormats()[p]; - IsSupported = format->SupportsMimeType(*mimeType); - if(IsSupported) - break; - } - - if(IsSupported) - { - iControllerImplInfo = NULL; - iCurrentConfig->iControllerUid = TUid::Uid(0x10207A9B); - } - else -#endif - { - iCurrentConfig->iControllerUid = iControllerImplInfo->Uid(); - } - -#ifdef __WINDOWS_MEDIA - CleanupStack::PopAndDestroy(mimeType); -#endif - iState = EOpenController; - KickState(); - } - -void CMMFFindAndOpenController::MadssaoAddDataSourceSinkAsyncComplete(TInt aError, const TMMFMessageDestination& aHandle) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::MadssaoAddDataSourceSinkAsyncComplete\n")); - #endif - iError = aError; - - // take the first available exit if we're out of memory - // or we've been cancelled - if (iError == KErrNoMemory || iError == KErrCancel) - { - SendError(); - return; - } - - // failed to add source or sink - try the next controller - if (aError != KErrNone) - { - TryNextController(); - return; - } - - if (iState == EWaitingForSource) - { - iSourceHandle = aHandle; - if (iCurrentConfig == iSecondaryConfig) - { - iState = EAddSink; - } - else // completed ok ! - { - iState = EIdle; - iError = KErrNone; - SendError(); - return; - } - } - else if (iState == EWaitingForSink) - { - iSinkHandle = aHandle; - if (iCurrentConfig == iSecondaryConfig) // completed ok ! - { - iState = EIdle; - iError = KErrNone; - SendError(); - return; - } - else - { - iState = EAddSource; - } - } - - KickState(); - } - -void CMMFFindAndOpenController::SendError(TInt aError) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::SendError err= %d\n"),aError); - #endif - if (iError == KErrNone) - iError = aError; - - iObserver.MfaocComplete(iError, iCurrentConfig->iController, iCurrentConfig->iControllerUid, &iSourceHandle, &iSinkHandle); - - // if we've just attempted to open the Secondary controller, - // try to open the Primary controller - if (iCurrentConfig == iSecondaryConfig) - { - if (iError == KErrNone) - OpenPrimaryController(); - } - - // if we failed to open, may as well free up some memory - // if open succeeded we need to preserve state in case of a re-open - if (iError != KErrNone) - Close(); - } - -void CMMFFindAndOpenController::SchedSendError(TInt aError) - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::SchedSendError\n")); - #endif - if (aError != KErrNone) - iError = aError; - iState = ESendError; - KickState(); - } - -void CMMFFindAndOpenController::BuildControllerListFileNameL() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::BuildControllerListFileNameL\n")); - #endif - // Retrieve a list of possible controllers from ECOM - // If we don't have a match, leave with unsupported - - iControllers.ResetAndDestroy(); - iPrioritisedControllers.Reset(); - - TControllerMode mode = iCurrentConfig->iControllerMode; - - // if we're playing, try to get the MIME type from the Content Access - // Framework (CAF) & use that to select a controller - if that fails, - // try to select a controller based on the header data/file extension - - CMMFUtilityFileInfo* fileInfo = NULL; - - TInt error; - - //If the current CMMSourceSink is a CMMFileSourceSink - // Using the previous version we'd get KErrCANoPermission when calling EvaluateIntent in the - // CMMFUtilityFileInfo ConstructL as the intent == EUnknown, so now pass the intent as a parameter - // to TMMFileHandleSource and.... - if (iUseFileHandle) - { - if (iUniqueId != NULL) - { - TMMFileHandleSource fileHandleSource(iFileHandle, (*iUniqueId), iIntent); - TRAP(error, fileInfo = CMMFUtilityFileInfo::NewL(fileHandleSource)); - } - else - { - TMMFileHandleSource fileHandleSource(iFileHandle); - TRAP(error, fileInfo = CMMFUtilityFileInfo::NewL(fileHandleSource)); - } - } - else - { - if (iUniqueId != NULL) - { - TMMFileSource fileSource(iFileName, (*iUniqueId), iIntent); - TRAP(error, fileInfo = CMMFUtilityFileInfo::NewL(fileSource)); - } - else - { - TMMFileSource fileSource(iFileName); - TRAP(error, fileInfo = CMMFUtilityFileInfo::NewL(fileSource)); - } - } - - if (fileInfo != NULL) - { - CleanupDeletePushL(fileInfo); - } - - if (error != KErrNone) - { - // if playback mode, leave for any error - // if record mode, allow KErrNotFound - if (mode == EPlayback || (mode != EPlayback && error != KErrNotFound)) - { - User::Leave(error); - } - } - - CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC(); - RArray mediaIds; - CleanupClosePushL(mediaIds); - User::LeaveIfError(mediaIds.Append(iMediaId)); - - cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType); - - - if (mode == EPlayback) - { - ASSERT(fileInfo!=NULL); - TBuf8 mimeType; - TBool mimeTypeKnown = fileInfo->GetFileMimeTypeL(mimeType); - if (mimeTypeKnown) - { - CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); - fSelect->SetMatchToMimeTypeL(mimeType); - cSelect->SetRequiredPlayFormatSupportL(*fSelect); - cSelect->ListImplementationsL(iControllers); - CleanupStack::PopAndDestroy(fSelect); - } - - - // copy to the iPrioritisedControllers array - this is a NOOP if the - // MIME type is not known since iControllers will be empty - ASSERT(mimeTypeKnown || iControllers.Count() == 0); - for (TInt controllerIndex=0; controllerIndex < iControllers.Count(); controllerIndex++) - User::LeaveIfError(iPrioritisedControllers.Append(iControllers[controllerIndex])); - - iControllerCount = iPrioritisedControllers.Count(); - if (iControllerCount > 0) - { - // Clean up - // cSelect, mediaIds, - CleanupStack::PopAndDestroy(2, cSelect); - if (fileInfo != NULL) - { - CleanupStack::PopAndDestroy(fileInfo); - } - return; - } - } - - // Retrieve header data first. If file doesn't exist, its ok. - HBufC8* headerData = HBufC8::NewLC(KMaxHeaderSize); - TPtr8 headerDataPtr = headerData->Des(); - if (fileInfo) - { - fileInfo->GetFileHeaderDataL(headerDataPtr, KMaxHeaderSize); - } - - // Get the filename's suffix - HBufC8* fileSuffix = CMMFClientUtility::GetFileExtensionL(iFileName); - - CleanupStack::PushL(fileSuffix); - TPtr8 fileSuffixPtr = fileSuffix->Des(); - - // Get the secondary filename's header data (for convert) - HBufC8* headerDataSecondary = HBufC8::NewLC(KMaxHeaderSize); - TPtr8 headerDataPtrSecondary = headerDataSecondary->Des(); - if (iFileNameSecondary.Length() > 0 && fileInfo) - { - fileInfo->GetFileHeaderDataL(headerDataPtrSecondary, KMaxHeaderSize); - } - - // Get the secondary filename's suffix - HBufC8* fileSuffixSecondary = CMMFClientUtility::GetFileExtensionL(iFileNameSecondary); - CleanupStack::PushL(fileSuffixSecondary); - TPtr8 fileSuffixPtrSecondary = fileSuffixSecondary->Des(); - - - CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); - - if (mode == EPlayback || mode == EConvert) - cSelect->SetRequiredPlayFormatSupportL(*fSelect); - if (mode == ERecord || mode == EConvert) - cSelect->SetRequiredRecordFormatSupportL(*fSelect); - - cSelect->ListImplementationsL(iControllers); - - if (iControllers.Count()==0) - User::Leave(KErrNotSupported); - - if (mode == ERecord) - { - CMMFClientUtility::PrioritiseControllersL( - iControllers, - headerDataPtrSecondary, - fileSuffixPtrSecondary, - headerDataPtr, - fileSuffixPtr, - iPrioritisedControllers); - } - else - { - CMMFClientUtility::PrioritiseControllersL( - iControllers, - headerDataPtr, - fileSuffixPtr, - headerDataPtrSecondary, - fileSuffixPtrSecondary, - iPrioritisedControllers); - } - - iControllerCount = iPrioritisedControllers.Count(); - if (iControllerCount == 0) - User::Leave(KErrNotSupported); - - // Clean up - // cSelect, mediaIds, - // headerData, fileSuffix, headerDataSecondary, fileSuffixSecondary, - // fSelect - CleanupStack::PopAndDestroy(7, cSelect); - if (fileInfo != NULL) - { - CleanupStack::PopAndDestroy(fileInfo); - } - } - -void CMMFFindAndOpenController::BuildControllerListDescriptorL() - { - // Retrieve a list of possible controllers from ECOM - // If we don't have a match, leave with unsupported - - iControllers.ResetAndDestroy(); - - CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC(); - CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); - - - RArray mediaIds; - CleanupClosePushL(mediaIds); - User::LeaveIfError(mediaIds.Append(iMediaId)); - - cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType); - - TPtrC8 header = iDescriptor.Left(KMaxHeaderSize); - fSelect->SetMatchToHeaderDataL(header); - - - TControllerMode mode = iCurrentConfig->iControllerMode; - if (mode == EPlayback || mode == EConvert) - cSelect->SetRequiredPlayFormatSupportL(*fSelect); - if (mode == ERecord || mode == EConvert) - cSelect->SetRequiredRecordFormatSupportL(*fSelect); - - cSelect->ListImplementationsL(iControllers); - - iControllerCount = iControllers.Count(); - if (iControllerCount == 0) - User::Leave(KErrNotSupported); - - // Clean up - // cSelect, fSelect, mediaIds - CleanupStack::PopAndDestroy(3, cSelect); - } - -void CMMFFindAndOpenController::BuildControllerListUrlL() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::BuildControllerListUrlL")); - #endif - // Retrieve a list of possible controllers from ECOM - // If we don't have a match, leave with unsupported - - iControllers.ResetAndDestroy(); - - CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC(); - CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); - - RArray mediaIds; - CleanupClosePushL(mediaIds); - User::LeaveIfError(mediaIds.Append(iMediaId)); - - cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType); - - - if (*iMimeType != KNullDesC8) - { - fSelect->SetMatchToMimeTypeL(*iMimeType);//We match to mime type - } - else - fSelect->SetMatchToUriL(*iUrl); - - - TControllerMode mode = iCurrentConfig->iControllerMode; - if (mode == EPlayback || mode == EConvert) - cSelect->SetRequiredPlayFormatSupportL(*fSelect); - if (mode == ERecord || mode == EConvert) - cSelect->SetRequiredRecordFormatSupportL(*fSelect); - - cSelect->ListImplementationsL(iControllers); - - iControllerCount = iControllers.Count(); - if (iControllerCount == 0) - User::Leave(KErrNotSupported); - - // Clean up - // cSelect, fSelect, mediaIds - CleanupStack::PopAndDestroy(3, cSelect); - } - -void CMMFFindAndOpenController::BuildControllerListFormatL() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::BuildControllerListFormatL")); - #endif - // Retrieve a list of possible controllers from ECOM - // If we don't have a match, leave with unsupported - - iControllers.ResetAndDestroy(); - iPrioritisedControllers.Reset(); - - CMMFControllerPluginSelectionParameters* cSelect = CMMFControllerPluginSelectionParameters::NewLC(); - - // Select the media IDs to allow - RArray mediaIds; - CleanupClosePushL(mediaIds); - User::LeaveIfError(mediaIds.Append(iMediaId)); - - cSelect->SetMediaIdsL(mediaIds, iMediaIdMatchType); - - CMMFFormatSelectionParameters* fSelect = CMMFFormatSelectionParameters::NewLC(); - - TControllerMode mode = iCurrentConfig->iControllerMode; - if (mode == EPlayback || mode == EConvert) - cSelect->SetRequiredPlayFormatSupportL(*fSelect); - if (mode == ERecord || mode == EConvert) - cSelect->SetRequiredRecordFormatSupportL(*fSelect); - - //Obtain a list of the controllers - cSelect->ListImplementationsL(iControllers); - - CleanupStack::PopAndDestroy(3, cSelect); // cSelect, mediaIds, fSelect - - iControllerCount = iControllers.Count(); - if (iControllerCount == 0) - User::Leave(KErrNotSupported); - - TUid formatUidPrimary; - TUid formatUidSecondary; - if (mode == ERecord) - { - formatUidSecondary = iFormatUid; - formatUidPrimary = iFormatUidSecondary; - } - else - { - formatUidPrimary = iFormatUid; - formatUidSecondary = iFormatUidSecondary; - } - - for (TInt controllerIndex=0; controllerIndex < iControllers.Count(); controllerIndex++) - { - const RMMFFormatImplInfoArray& recFormatInfo = iControllers[controllerIndex]->RecordFormats(); - const RMMFFormatImplInfoArray& playFormatInfo = iControllers[controllerIndex]->PlayFormats(); - - TBool playFormatMatched = EFalse; - TBool recordFormatMatched = EFalse; - - if (formatUidPrimary == KNullUid) - { - playFormatMatched = ETrue; - } - else - { - for(TInt playFormatIndex =0; playFormatIndex < playFormatInfo.Count(); playFormatIndex++) - { - if(playFormatInfo[playFormatIndex]->Uid() == formatUidPrimary) - { - playFormatMatched = ETrue; - break; - } - } - } - - if (formatUidSecondary == KNullUid) - { - recordFormatMatched = ETrue; - } - else - { - for (TInt recFormatIndex =0; recFormatIndex < recFormatInfo.Count(); recFormatIndex++) - { - if (recFormatInfo[recFormatIndex]->Uid() == formatUidSecondary) - { - recordFormatMatched = ETrue; - break; - } - } - } - - if (playFormatMatched && recordFormatMatched) - User::LeaveIfError(iPrioritisedControllers.Append(iControllers[controllerIndex])); - } - - iControllerCount = iPrioritisedControllers.Count(); - if (iControllerCount == 0) - User::Leave(KErrNotSupported); - } - -CMMSourceSink* CMMFFindAndOpenController::CreateSourceSinkL(const TSourceSink& aParams) - { - if (aParams.iUseFileHandle) - { - return CMMFileSourceSink::NewL(aParams.iUid, aParams.iFileHandle); - } - return CMMSourceSink::NewL(aParams.iUid, aParams.iConfigData); - } - - -CMMSourceSink* CMMFFindAndOpenController::CreateSourceSinkL(const TMMSource& aSource) - { - if (!(aSource.SourceType()==KUidMMFileSource || - aSource.SourceType()==KUidMMFileHandleSource)) - User::Leave(KErrNotSupported); - - return CMMFileSourceSink::NewL(KUidMmfFileSource, aSource); - } - - - - CMMFFindAndOpenController::TSourceSink::TSourceSink(TUid aUid, const TDesC8& aConfigData) - : iConfigData(aConfigData) - { - iUid = aUid; - - iUseFileHandle = EFalse; - } - - CMMFFindAndOpenController::TSourceSink::TSourceSink(TUid aUid, const RFile& aFile) - : iConfigData(KNullDesC8) - { - iUid = aUid; - - iFileHandle = aFile; - iUseFileHandle = ETrue; - } - -CMMFFindAndOpenController::CConfig::CConfig() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::CConfig")); - #endif - } - -void CMMFFindAndOpenController::CConfig::Close() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::Close")); - #endif - delete iSource; - iSource = NULL; - delete iSink; - iSink = NULL; - } -CMMFFindAndOpenController::CConfig::~CConfig() - { - #if _DEBUG - RDebug::Print(_L("CMMFFindAndOpenController::~CConfig")); - #endif - Close(); - } - - CMMSourceSink* CMMSourceSink::NewLC(TUid aUid, const TDesC8& aDescriptor) - { - CMMSourceSink* self = new (ELeave) CMMSourceSink(aUid); - CleanupStack::PushL(self); - self->ConstructL(aDescriptor); - return self; - } - - CMMSourceSink* CMMSourceSink::NewL(TUid aUid, const TDesC8& aDescriptor) - { - CMMSourceSink* sourcesink = CMMSourceSink::NewLC(aUid, aDescriptor); - CleanupStack::Pop(sourcesink); - return sourcesink; - } - -CMMSourceSink::CMMSourceSink(TUid aUid) - : iUid(aUid) - { - } - -CMMSourceSink::~CMMSourceSink() - { - delete iBuf; - } - -void CMMSourceSink::ConstructL(const TDesC8& aDescriptor) - { - iBuf = aDescriptor.AllocL(); - } - -TUid CMMSourceSink::SourceSinkUid() const - { - return iUid; - } - -const TDesC8& CMMSourceSink::SourceSinkData() const - { - return *iBuf; - } - - CMMFileSourceSink* CMMFileSourceSink::NewLC(TUid aUid, const RFile& aFile) - { - CMMFileSourceSink* self = new (ELeave) CMMFileSourceSink(aUid); - CleanupStack::PushL(self); - self->ConstructL(aFile); - return self; - } - - CMMFileSourceSink* CMMFileSourceSink::NewL(TUid aUid, const RFile& aFile) - { - CMMFileSourceSink* sourcesink = CMMFileSourceSink::NewLC(aUid, aFile); - CleanupStack::Pop(sourcesink); - return sourcesink; - } - -CMMFileSourceSink::CMMFileSourceSink(TUid aUid) - : CMMSourceSink(aUid) - { - } - -void CMMFileSourceSink::ConstructL(const RFile& aFile) - { - iHandle.Duplicate(aFile); - iUsingFileHandle = ETrue; - iFileName = HBufC::NewMaxL(KMaxFileName); - TPtr fileNamePtr = iFileName->Des(); - iHandle.Name(fileNamePtr); - DoCreateFileHandleSourceConfigDataL(); - } -const TInt KExpandSize = 100; - -void CMMFileSourceSink::DoCreateFileHandleSourceConfigDataL() - { - CBufFlat* buf = CBufFlat::NewL(KExpandSize); - CleanupStack::PushL(buf); - RBufWriteStream stream; - stream.Open(*buf); - CleanupClosePushL(stream); - - TPckgBuf fileptr(&iHandle); - stream.WriteInt32L(KMMFileHandleSourceUid.iUid); - - stream.WriteL(fileptr); - - TInt length = 0; - if (iUniqueId != NULL) - length = iUniqueId->Length(); - stream.WriteInt32L(length); - if (length>0) - stream.WriteL(*iUniqueId); - - stream.WriteInt32L(iEnableUI); - - stream.CommitL(); - CleanupStack::PopAndDestroy(&stream); - - iSourceSinkData = buf->Ptr(0).AllocL(); - - CleanupStack::PopAndDestroy(buf); - } - -const TDesC8& CMMFileSourceSink::SourceSinkData() const - { - ASSERT(iSourceSinkData); - return *iSourceSinkData; - } - -CMMFileSourceSink::~CMMFileSourceSink() - { - iHandle.Close(); - delete iFileName; - delete iSourceSinkData; - delete iUniqueId; - } - - CMMFileSourceSink* CMMFileSourceSink::NewLC(TUid aUid, const TMMSource& aSource) - { - CMMFileSourceSink* self = new (ELeave) CMMFileSourceSink(aUid); - CleanupStack::PushL(self); - self->ConstructL(aSource); - return self; - } - - CMMFileSourceSink* CMMFileSourceSink::NewL(TUid aUid, const TMMSource& aSource) - { - CMMFileSourceSink* sourcesink = CMMFileSourceSink::NewLC(aUid, aSource); - CleanupStack::Pop(sourcesink); - return sourcesink; - } - -void CMMFileSourceSink::ConstructL(const TMMSource& aSource) - { - iUniqueId = aSource.UniqueId().AllocL(); - iIntent = aSource.Intent(); - iEnableUI = aSource.IsUIEnabled(); - - if (aSource.SourceType() == KUidMMFileSource) - { - const TMMFileSource& fileSource = static_cast(aSource); - iFileName = fileSource.Name().AllocL(); - - DoCreateFileSourceConfigDataL(); - } - else if (aSource.SourceType() == KUidMMFileHandleSource) - { - const TMMFileHandleSource& fileHandleSource = static_cast(aSource); - iHandle.Duplicate(fileHandleSource.Handle()); - iUsingFileHandle = ETrue; - iFileName = HBufC::NewMaxL(KMaxFileName); - TPtr fileNamePtr = iFileName->Des(); - iHandle.Name(fileNamePtr); - - DoCreateFileHandleSourceConfigDataL(); - } - else - { - User::Leave(KErrNotSupported); - } - } - -void CMMSourceSink::EvaluateIntentL() - { - } - -void CMMFileSourceSink::EvaluateIntentL() - { - if (iUsingFileHandle) - { - ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(iHandle); - Content->OpenContentLC(iIntent, *iUniqueId); - CleanupStack::PopAndDestroy(2, Content); - } - else - { - ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(*iFileName); - Content->OpenContentLC(iIntent, *iUniqueId); - CleanupStack::PopAndDestroy(2, Content); - } - } - - - - void CMMFileSourceSink::EvaluateIntentL(ContentAccess::TIntent aIntent) - { - if (iUsingFileHandle) - { - ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(iHandle); - Content->OpenContentLC(aIntent, *iUniqueId); - CleanupStack::PopAndDestroy(2, Content); - } - else - { - ContentAccess::CContent* Content = ContentAccess::CContent::NewLC(*iFileName); - Content->OpenContentLC(aIntent, *iUniqueId); - CleanupStack::PopAndDestroy(2, Content); - } - } - -void CMMFileSourceSink::DoCreateFileSourceConfigDataL() - { - CBufFlat* buf = CBufFlat::NewL(KExpandSize); - CleanupStack::PushL(buf); - RBufWriteStream stream; - stream.Open(*buf); - CleanupClosePushL(stream); - - stream.WriteInt32L(KMMFileSourceUid.iUid); - stream.WriteInt32L(iFileName->Length()); - stream.WriteL(*iFileName); - TInt length = 0; - if (iUniqueId != NULL) - length = iUniqueId->Length(); - stream.WriteInt32L(length); - if (length>0) - stream.WriteL(*iUniqueId); - - stream.WriteInt32L(iEnableUI); - - stream.CommitL(); - CleanupStack::PopAndDestroy(&stream); - - iSourceSinkData = buf->Ptr(0).AllocL(); - - CleanupStack::PopAndDestroy(buf); - } - - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/ProgressiveDownloadUtility/src/mmfclientutility.h --- a/mmfenh/progressivedownload/ProgressiveDownloadUtility/src/mmfclientutility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,447 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Progressive Download Utility Client utility functions -* -*/ - - - -#ifndef __MMF_CLIENT_UTILITY_H__ -#define __MMF_CLIENT_UTILITY_H__ - -#include -#include -#include -#include -#include -#include "mmf/server/mmffile.h" -#include "mmf/server/mmfdes.h" -#include "mmf/common/mmfcontroller.h" - -#include -#include -#include - - -class CMMSourceSink; // declared here. - -NONSHARABLE_CLASS( CMMSourceSink ): public CBase - { -public: - static CMMSourceSink* NewL(TUid aUid, const TDesC8& aDescriptor); - static CMMSourceSink* NewLC(TUid aUid, const TDesC8& aDescriptor); - - virtual ~CMMSourceSink(); - virtual TUid SourceSinkUid() const; - virtual const TDesC8& SourceSinkData() const; - - virtual void EvaluateIntentL(); -protected: - CMMSourceSink(TUid aUid); - - -private: - void ConstructL(const TDesC8& aDescriptor); - - const TUid iUid; - HBufC8* iBuf; - }; - - - - - -class CMMFileSourceSink; // declared here. - -NONSHARABLE_CLASS( CMMFileSourceSink ): public CMMSourceSink - { -public: - static CMMFileSourceSink* NewL(TUid aUid, const RFile& aFile); - static CMMFileSourceSink* NewLC(TUid aUid, const RFile& aFile); - - static CMMFileSourceSink* NewL(TUid aUid, const TMMSource& aMMSource); - static CMMFileSourceSink* NewLC(TUid aUid, const TMMSource& aMMSource); - - const TDesC& UniqueId() const {return *iUniqueId;} - - virtual ~CMMFileSourceSink(); - - const TDesC& FileName() const {return *iFileName;} - const TDesC8& SourceSinkData() const; - - void EvaluateIntentL(ContentAccess::TIntent aIntent); - virtual void EvaluateIntentL(); - -protected: - CMMFileSourceSink(TUid aUid); - -private: - void ConstructL(const TMMSource& aSource); - void DoCreateFileSourceConfigDataL(); - void ConstructL(const RFile& aFile); - void DoCreateFileHandleSourceConfigDataL(); - - TBool iUsingFileHandle; - RFile iHandle; - HBufC* iFileName; - HBufC8* iSourceSinkData; - HBufC* iUniqueId; - ContentAccess::TIntent iIntent; - TBool iEnableUI; - }; - - - - -class CMMFMdaObjectStateChangeObserverCallback; // declared here. -/** -Active object utility class to allow the callback to be called asynchronously. -This should help prevent re-entrant code in clients of the mediaframework. -*/ -NONSHARABLE_CLASS( CMMFMdaObjectStateChangeObserverCallback ): public CActive - { -public: - static CMMFMdaObjectStateChangeObserverCallback* NewL(MMdaObjectStateChangeObserver& aCallback); - virtual ~CMMFMdaObjectStateChangeObserverCallback(); - void CallBack(CBase* aObject, TInt aPreviousState, TInt aCurrentState, TInt aErrorCode); -private: - CMMFMdaObjectStateChangeObserverCallback(MMdaObjectStateChangeObserver& aCallback); - void RunL(); - void DoCancel(); -private: - MMdaObjectStateChangeObserver& iCallback; - CBase* iObject; - TInt iPreviousState; - TInt iCurrentState; - TInt iErrorCode; - }; - -class CMMFClientUtility; // declared here. - -NONSHARABLE_CLASS( CMMFClientUtility ) - { -public: - static TUid ConvertMdaFormatUidToECOMWrite(TUid aMdaFormatUid); - static TUid ConvertMdaFormatUidToECOMRead(TUid aMdaFormatUid); - static TFourCC ConvertMdaCodecToFourCC(TMdaPackage& aCodec); - static TInt GetFileHeaderData(const TDesC& aFileName, TDes8& aHeaderData, TInt aMaxLength); - static HBufC8* GetFileExtensionL(const TDesC& aFileName); - static void PrioritiseControllersL( - const RMMFControllerImplInfoArray& aControllers, - const TDesC8& aHeaderDataPlayback, - const TDesC8& aFileExtensionPlayback, - const TDesC8& aHeaderDataRecord, - const TDesC8& aFileExtensionRecord, - RMMFControllerImplInfoArray& aPrioritisedControllers); - static TInt GetBestMatchL(const CMMFFormatImplementationInformation* format, const TDesC8& aHeaderData, const TDesC8& aFileExtension); - -private: - CMMFClientUtility(); - }; - -class CMMFUtilityFileInfo; // declared here. - -NONSHARABLE_CLASS( CMMFUtilityFileInfo ): public CBase - { -public: - - static CMMFUtilityFileInfo* NewL(TMMSource& aSource); - static CMMFUtilityFileInfo* NewLC(TMMSource& aSource); - - ~CMMFUtilityFileInfo(); - - TBool GetFileMimeTypeL(TDes8& aMimeType); - void GetFileHeaderDataL(TDes8& aHeaderData, TInt aMaxLength); - TInt EvaluateIntent(ContentAccess::TIntent aIntent); - -private: - CMMFUtilityFileInfo(); - - void ConstructL(const TMMSource& aSource); - -private: - ContentAccess::CData* iData; - }; - -inline CMMFUtilityFileInfo::CMMFUtilityFileInfo() - { - }; - -/** - * Mixin class that the user of the class CMMFFindAndOpenController must derive from. - * @internalComponent - */ -class MMMFFindAndOpenControllerObserver - { -public: - /** - * Callback function to indicate the success or failure - * of an attempt to find and open a suitable controller and - * to add a source and sink. - * @see CMMFFindAndOpenController - * - * @param aError - * Indicates whether a controller has been opened sucessfully - * This is passed by reference, mainly for the audio recorder utility - * which opens two controllers: if the secondary controller (which is - * always opened first) fails to open, then the audio recorder utility - * may choose to set aError = KErrNone in the MfaocComplete() callback - * to indicate to CFindAndOpenControler() that it should continue - * to open the primary controller, even though opening the secondary failed. - * @param aController - * A pointer to the controller that has been opened or has failed to open - * This is mainly for the audio recorder utility to indicate - * which controller (primary or secondary) has been opened. - * @param aControllerUid - * the UID of the controller that has been opened - * @param aSourceHandle - * a pointer to the source handle - * @internalComponent - * a pointer to the sink handle - */ - virtual void MfaocComplete( - TInt& aError, - RMMFController* aController, - TUid aControllerUid = KNullUid, - TMMFMessageDestination* aSourceHandle = NULL, - TMMFMessageDestination* aSinkHandle = NULL) = 0; - }; - - -class CMMFFindAndOpenController; // declared here. -/** - * Utility class used by the MMF client API classes. - * Finds and opens a suitable controller and adds a source and a sink - * asynchronously. Completion is indicated asynchronously - * using the MMMFFindAndOpenControllerObserver mixin class. - * - * @internalComponent - */ -NONSHARABLE_CLASS( CMMFFindAndOpenController ): public CActive, public MMMFAddDataSourceSinkAsyncObserver - { -public: - enum TControllerMode - { - EPlayback, - ERecord, - EConvert - }; - - enum TControllerNumber - { - EPrimaryController, - ESecondaryController - }; - - class TSourceSink - { - public: - TSourceSink(TUid aUid, const TDesC8& aData = KNullDesC8); - TSourceSink(TUid aUid, const RFile& aFile); - - TUid iUid; - const TDesC8& iConfigData; - TBool iUseFileHandle; - RFile iFileHandle; - }; - - - - -public: - static CMMFFindAndOpenController* NewL(MMMFFindAndOpenControllerObserver& aObserver); - virtual ~CMMFFindAndOpenController(); - - // from CActive - virtual void DoCancel(); - virtual void RunL(); - - // from MMMFAddDataSourceSinkAsyncObserver - virtual void MadssaoAddDataSourceSinkAsyncComplete(TInt aError, const TMMFMessageDestination& aHandle); - - void Configure( - TUid aMediaId, - TMMFPrioritySettings aPrioritySettings, - CMMFPluginSelectionParameters::TMediaIdMatchType aMediaIdMatchType = CMMFPluginSelectionParameters::EAllowOnlySuppliedMediaIds); - - void ConfigureController(RMMFController& aController, CMMFControllerEventMonitor& aEventMonitor, TControllerMode aControllerMode = EPlayback); - void ConfigureSecondaryController(RMMFController& aController, CMMFControllerEventMonitor& aEventMonitor, TControllerMode aControllerMode = EPlayback); - void ConfigureSourceSink( - TSourceSink aSource, - TSourceSink aSink); - void ConfigureSecondarySourceSink( - TSourceSink aSource, - TSourceSink aSink); - - - void ConfigureSourceSink( - const TMMSource& aSource, - TSourceSink aSink); - - - - void OpenByFileSource(const TMMSource& aFileSource, const TDesC& aFileNameSecondary = KNullDesC); - - void OpenByFilename(const TDesC& aFileName, const TDesC& aFileNameSecondary = KNullDesC); - void OpenByFileHandle(const RFile& aFile); - - - void OpenByFormatUid(TUid aFormatUid, TUid aFormatUidSecondary = KNullUid); - void OpenByDescriptor(const TDesC8& aDescriptor); - void OpenByUrl(const TDesC& aUrl, TInt aIapId, const TDesC8& aMimeType); - void OpenByControllerUid(TUid aControllerUid, TUid aSecondaryControllerUid = KNullUid); - void ReOpen(); - void Close(); - - static TMMFFileConfig GetConfigFile(const TDesC& aFileName); - static TMMFDescriptorConfig GetConfigDescriptor(const TDesC8& aDescriptor); - static TInt GetConfigUrl(CBufFlat*& aUrlCfgBuffer, const TDesC& aUrl, TInt aIapId); - -private: - class CConfig: public CBase - { - public: - CConfig(); - ~CConfig(); - void Close(); - public: - RMMFController* iController; // not owned - CMMFControllerEventMonitor* iEventMonitor; // not owned - - /** indicates whether this controller is being used for - playback, recording or converting */ - TControllerMode iControllerMode; - - CMMSourceSink* iSource; - CMMSourceSink* iSink; - TUid iControllerUid; - }; - - CMMFFindAndOpenController(MMMFFindAndOpenControllerObserver& aObserver); - void ConstructL(); - - void Init(); - - void ConfigureSourceSink( - CConfig& config, - TSourceSink aSource, - TSourceSink aSink); - - - void ConfigureSourceSink( - CConfig& config, - const TMMSource& aSource, - TSourceSink aSink); - - - - void ConfigureController( - CConfig& config, - RMMFController& aController, - CMMFControllerEventMonitor& aEventMonitor, - TControllerMode aControllerMode); - - void CloseController(); - - void OpenPrimaryController(void); - - void KickState(); - void Process(); - void SendError(TInt aError = KErrNone); - void SchedSendError(TInt aError = KErrNone); - void BuildControllerListFileNameL(); - void BuildControllerListDescriptorL(); - void BuildControllerListUrlL(); - void BuildControllerListFormatL(); - void TryNextController(); - - CMMSourceSink* CreateSourceSinkL(const TSourceSink& aParams); - - CMMSourceSink* CreateSourceSinkL(const TMMSource& aSource); - - -private: - /** primary controller details */ - CConfig* iPrimaryConfig; - /** secondary controller details */ - CConfig* iSecondaryConfig; - /** points to either iPrimaryConfig or iSecondaryConfig */ - CConfig* iCurrentConfig; // not owned - - enum TMode - { - EOpenByControllerUid, - EOpenByFileName, - EOpenByDescriptor, - EOpenByUrl, - EOpenByFormatUid - }; - TMode iMode; - - /** indicates what state the state machine is in */ - enum TState - { - EIdle, - EBuildControllerList, - EOpenController, - EAddSource, - EAddSink, - EWaitingForSource, - EWaitingForSink, - ESendError - }; - TState iState; - - MMMFFindAndOpenControllerObserver& iObserver; - CMMFAddDataSourceSinkAsync* iAddDataSourceSinkAsync; - - TInt iControllerIndex; - TInt iControllerCount; - - TFileName iFileNameSecondary; // for converting - - TFileName iFileName; - TBool iUseFileHandle; - TBool iUseFileSource; - HBufC* iUniqueId; - RFile iFileHandle; - ContentAccess::TIntent iIntent; - - HBufC* iUrl; - HBufC8* iMimeType; - TPtr8 iDescriptor; - TInt iIapId; - TUid iFormatUid; - TUid iFormatUidSecondary; // for converting - - TUid iMediaId; - TMMFPrioritySettings iPrioritySettings; - CMMFPluginSelectionParameters::TMediaIdMatchType iMediaIdMatchType; - - RMMFControllerImplInfoArray iControllers; - RMMFControllerImplInfoArray iPrioritisedControllers; - - // if this is non-null, then it points to an element in - // either iControllers or iPrioritisedControllers - CMMFControllerImplementationInformation* iControllerImplInfo; // not owned - - TControllerMode iControllerMode; - TBool iSourceSinkConfigured; - TInt iError; - - TMMFMessageDestination iSourceHandle; - TMMFMessageDestination iSinkHandle; - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/group/bld.inf --- a/mmfenh/progressivedownload/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project build file for ProgressiveDownloadUtility -* -*/ - - -#include - -PRJ_PLATFORMS - -DEFAULT - -PRJ_EXPORTS -../Data/ProgressiveDownload_Stub.SIS /epoc32/data/z/system/install/ProgressiveDownload_Stub.SIS -../rom/progressivedownload.iby CORE_MW_LAYER_IBY_EXPORT_PATH(progressivedownload.iby) - - -PRJ_MMPFILES -#ifdef __SERIES60_NATIVE_BROWSER -#ifdef RD_PROGDOWNLOAD -../ProgressiveDownloadSource/group/ProgressiveDownloadSource.mmp -../ProgressiveDownloadUtility/group/PDProperties.mmp -../ProgressiveDownloadUtility/group/ProgressiveDownloadUtility.mmp -#endif -#endif - -PRJ_TESTMMPFILES -#ifdef __SERIES60_NATIVE_BROWSER -#ifdef RD_PROGDOWNLOAD -//../internal/progdownloadtestapp/group/progdownload.mmp -#endif -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmfenh/progressivedownload/rom/progressivedownload.iby --- a/mmfenh/progressivedownload/rom/progressivedownload.iby Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for ProgressiveDownloadUtility -* -*/ - - - - -#ifndef PROGRESSIVEDOWNLOAD_IBY -#define PROGRESSIVEDOWNLOAD_IBY - -#ifdef __SERIES60_NATIVE_BROWSER -#ifdef RD_PROGDOWNLOAD - -file=ABI_DIR\BUILD_DIR\ProgressiveDownloadUtility.dll SHARED_LIB_DIR\ProgressiveDownloadUtility.dll -file=ABI_DIR\BUILD_DIR\PDProperties.dll SHARED_LIB_DIR\PDProperties.dll - -// For ProgressiveDownload DataSource -ECOM_PLUGIN(ProgressiveDownloadSource.dll, ProgressiveDownloadSource.rsc) - -#endif -#endif - -// PROGRESSIVEDOWNLOAD STUB -data=ZSYSTEM\install\ProgressiveDownload_Stub.SIS System\Install\ProgressiveDownload_Stub.SIS - - -#endif //PROGRESSIVEDOWNLOAD_IBY - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_info/mmmw_metadata/mmmw_metadata.mrp --- a/mmmw_info/mmmw_metadata/mmmw_metadata.mrp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmmw_info/mmmw_metadata/mmmw_metadata.mrp Fri Jul 09 16:43:35 2010 -0500 @@ -1,19 +1,3 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# - component mmmw_metadata source \sf\mw\mmmw\mmmw_info\mmmw_metadata source \sf\mw\mmmw\package_definition.xml diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/audio_metadata_reader_api/inc/MetaDataField.hrh --- a/mmmw_plat/audio_metadata_reader_api/inc/MetaDataField.hrh Fri Jun 25 17:36:03 2010 -0500 +++ b/mmmw_plat/audio_metadata_reader_api/inc/MetaDataField.hrh Fri Jul 09 16:43:35 2010 -0500 @@ -44,7 +44,9 @@ EMetaDataDuration, EMetaDataDate, EMetaDataUnsyncLyrics, - EMetaDataProtected // get the Protected info, "0"=non protected, "1"=protected + EMetaDataProtected, // get the Protected info, "0"=non protected, "1"=protected + EMetaDataSampleRate, // Hz + EMetaDataBitRate // Bps // More later... }; diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/emc_progressive_download_source_api/emc_progressive_download_source_api.metaxml --- a/mmmw_plat/emc_progressive_download_source_api/emc_progressive_download_source_api.metaxml Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - EMC Progressive Download Source API - This API defines a Progressive Download Source API for progressively downloading media file on the S60 platform using Enhanced Audio Playback API. - c++ - audioenhancements - - - - - - - - - no - no - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/emc_progressive_download_source_api/group/bld.inf --- a/mmmw_plat/emc_progressive_download_source_api/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File that exports the files belonging to -: EMC Progressive Download Source API -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/ProgDLSource.h MW_LAYER_PLATFORM_EXPORT_PATH(ProgDLSource.h) diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/emc_progressive_download_source_api/inc/ProgDLSource.h --- a/mmmw_plat/emc_progressive_download_source_api/inc/ProgDLSource.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,66 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Header of ProgDLSource class. -* -*/ - - -#ifndef PROGDLSOURCE_H -#define PROGDLSOURCE_H - -#include -#include - -namespace multimedia - { - - const TUid KProgDLSourceControl = {0x10207B43}; - - - // Class declaration - class MProgDLSource : public MSourceControl - { - public: - - enum TDownloadStatus - { - EUnknown, - EConnecting, - EStarted, - EPaused, - EFailed, - EDeleted, - ECompleted - }; - - // Control msg - virtual TInt Open(const TDesC& aFileName,TInt32 aDLTxId ) = 0; - virtual TInt MoveFile(const TDesC& aDestFileName ) = 0; - virtual TInt CancelDownload() = 0; - virtual TInt ResumeDownload() = 0; - virtual TInt GetCurrentFileSize( TUint& aSize ) = 0; - virtual TInt GetExpectedFileSize( TUint& aSize ) = 0; - virtual TDownloadStatus GetDownloadStatus() = 0; - virtual TInt IsDownloadComplete(TBool& aBool) = 0; - virtual TInt GetPercentageDownloaded(TUint& aPercent) = 0; - virtual TInt GetPercentageBuffered(TUint& aPercent) = 0; - virtual TInt GetDownloadingRate(TUint& aRate) = 0; - virtual TInt GetBitRate(TUint& aRate) = 0; - virtual TInt FileName(TPtr& aFileName) = 0; - }; - } // namespace multimedia - -#endif // PROGDLSOURCE_H - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/equalizer_ui_api.metaxml --- a/mmmw_plat/equalizer_ui_api/equalizer_ui_api.metaxml Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - Equalizer UI API - An API for launching Equalizer UI. - c++ - audioeffectsui - - - - - - - - - no - no - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/group/bld.inf --- a/mmmw_plat/equalizer_ui_api/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File that exports the files belonging to -: Equalizer UI API -* -*/ - - - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -../inc/EqualizerPresetsDialog.h MW_LAYER_PLATFORM_EXPORT_PATH(EqualizerPresetsDialog.h) -../inc/EqualizerConstants.h MW_LAYER_PLATFORM_EXPORT_PATH(EqualizerConstants.h) diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/inc/EqualizerConstants.h --- a/mmmw_plat/equalizer_ui_api/inc/EqualizerConstants.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,41 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains declarations for public constants for -* Equalizer -* -*/ - - - -#ifndef EQUALIZERCONSTANTS_H -#define EQUALIZERCONSTANTS_H - -// INCLUDES - -#include - -// CONSTANTS -// Used by client application for activating the preset "None" -const TInt KEqualizerPresetNone = -1; - -// Used as the maximum length of a ListBox model entry (like "0\tNone") -const TInt KListBoxEntryMaxLength = 64; - -// DATA TYPES -// Used to store a preset name or ListBox model entry -typedef TBuf TPresetName; - -#endif // EQUALIZERCONSTANTS_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/inc/EqualizerPresetsDialog.h --- a/mmmw_plat/equalizer_ui_api/inc/EqualizerPresetsDialog.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,369 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declaration of EqualizerPresetsDialog class -* -*/ - - - - -#ifndef EQUALIZERPRESETSDIALOG_H -#define EQUALIZERPRESETSDIALOG_H - -// INCLUDES -#include -#include -#include -#include - -// CLASS DECLARATION -class CEqualizerPresetListArray; -class CEqualizerEditingDialog; - -/** -* This class is used to notify the client application about the activation -* of a new preset. -* -* @lib Equalizer.lib -* @since Series 60 3.0 -*/ -NONSHARABLE_CLASS(MEqualizerPresetActivationObserver) - { - public: // New functions - /** - * This member is called by the Equalizer UI when the user activates - * a new preset. - * @ since Series 60 3.0 - * @ aActivatedPreset It is KEqualizerPresetNone if the preset "None" - * is active. Otherwise, it is the value of - * TEfAudioEqualizerUtilityPreset::iPresetNameKey for the entry - * whose TEfAudioEqualizerUtilityPreset::iPresetName matches the - * activated preset name, in the array retrieved using - * CAudioEqualizerUtility::Presets(). - */ - virtual void HandlePresetActivation (TInt aActivatedPreset) = 0; - }; - -/** -* This class is used to display the preset list view of the Equalizer. -* -* @lib Equalizer.lib -* @since Series 60 3.0 -*/ -class CEqualizerPresetsDialog : public CAknDialog -#ifdef RD_SCALABLE_UI_V2 - , public MEikListBoxObserver -#endif //RD_SCALABLE_UI_V2 - { - public: //Constructors and Destructors - /** - * This function is called to create an object of - * type CEqualizerPresetsDialog - Two phase Construction - * @since 3.0 - * @param aAudEqUtility a reference to CAudioEqualizerUtility - * @param aCurrentActivePreset It is KEqualizerPresetNone if the preset - * "None" is active. Otherwise, it is the value of - * TEfAudioEqualizerUtilityPreset::iPresetNameKey for the entry - * whose TEfAudioEqualizerUtilityPreset::iPresetName matches the - * activated preset name, in the array retrieved using - * CAudioEqualizerUtility::Presets(). - * @param aEqualizerPresetActivationObserver a reference to an object - * of type MEqualizerPresetActivationObserver - */ - IMPORT_C static CEqualizerPresetsDialog* NewL( - CAudioEqualizerUtility* aAudEqUtility, - TInt aCurrentActivePreset, - MEqualizerPresetActivationObserver& aEqrPresetActObserver); - - /** - * Destructor - * @since 3.0 - */ - virtual ~CEqualizerPresetsDialog(); - private: //New functions - /** - * Second Phase Constructor - * @since 3.0 - * @param aCurrentActivePreset the index into the preset array retrieved - * with the method CAudioEqualizerUtility::Presets()if a preset other - * than "None" is active. It is KEqualizerPresetNone if the preset - * "None" is active. - */ - void ConstructL(const TInt aCurrentActivePreset); - /** - * This function is called to create an object of - * type CEqualizerPresetsDialog - First Phase Constructor - * @since 3.0 - * @param aAudEqUtility a reference to CAudioEqualizerUtility - * @param aEqualizerPresetActivationObserver a reference to an object - * of type MEqualizerPresetActivationObserver - */ - CEqualizerPresetsDialog ( - CAudioEqualizerUtility* aAudEqUtility, - MEqualizerPresetActivationObserver& aEqrPresetActObserver); - - /** - * This function is called to get a free preset name - * @since 3.0 - * @param aName Used to reurn a free preset name - */ - void BuildPresetNameL( TDes& aName) const; - - /** - * This function returns the highlighted Preset in ListBox - * @since 3.0 - * @return Highlighted Preset e.g. "None" - */ - TPresetName GetHighlightedPresetInListBox() const; - /** - * This function is called to find the index of a preset in the list - * of presets returned by CAudioEqualizerUtility::Presets() - * @since 3.0 - * @param aPreset The preset focussed in ListBox - * @return index of the highlighted preset in the ListBox in the - * list of presets returned by CAudioEqualizerUtility::Presets() - */ - TInt GetEngineIndexL(const TPresetName& aPreset) const; - /** - * This function is used for the activation of a preset - * @since 3.0 - * @param aIndex The index of the preset in the ListBox - * @param aPresetName The name of the preset - */ - void ActivateEqrPresetL(const TInt aIndex, const TDesC& aPreset); - /** - * This function is used for the editing of a preset - * @since 3.0 - * @param aIndex The index of the preset in the ListBox - * @param aPresetName The name of the preset - */ - void EditEqrPresetL(const TInt aIndex, const TDesC& aPreset); - /** - * This function is used for the creation of a new preset - * @since 3.0 - * @param aIndex The index of the preset in the ListBox. This is set - * to a the index in the ListBox if preset creation is successful. - * If the creation is unscuccessful, then the parameter is not changed. - * @param aPreset The name of the preset created - */ - void CreateNewEqrPresetL(TInt& aIndex, TPresetName& aPreset) const; - - /** - * This function is used for the renaming of a preset - * @since 3.0 - * @param aIndex The index of the preset in the ListBox - * @param aPresetName The name of the preset - */ - void RenameEqrPresetL(const TInt aIndex, const TDesC& aPreset); - - /** - * This function is used for the deletion of a preset - * @since 3.0 - * @param aIndex The index of the preset in the ListBox - * @param aPresetName The name of the preset - */ - void DeleteEqrPresetL(const TInt aIndex, const TDesC& aPreset); - - /** - * This function is used to display a dialog to query the user - * for a new name. It is used while creating a new preset or - * renaming an existing preset. - * @since 3.0 - * @param aResourceId The resource id to use for the dialog - * @param aPresetName - * @return ETrue if the user did not cancel the dialog box - * EFalse otherwise - */ - TBool GetNewNameL(const TInt aResourceId, TDes& aPresetName) const; - - /** - * This function is used to load the ListBox icons in an array - * @since 3.0 - * @returns array of ListBox icons - */ - CArrayPtr* GetListBoxIconsL() const; - - /** - * This function is used to inform the client application about the - * currently active preset - * engine - * @since 3.0 - */ - void SetCurrentPreset(const TPresetName& aPreset); - - /** - * This function is used to rturn the currently active preset - * engine - * @since 3.0 - */ - TPresetName CurrentPreset() const; - - /** - * This function is used to search for a preset name in the ListBox - * @since 3.0 - * @param aPreset The preset name to search for - * @return It returns the index of the preset, if found and - * KErrNotFound if not found. - */ - TInt SearchPresetL(const TPresetName& aPreset) const; - - /** - * This function is used to display a dialog to the user for - * editing a particular preset. - * @since 3.0 - * @param aAudEqUtility pointer to CAudioEqualizerUtility - * @param aIndex the index of the preset in the array of presets - * @param aIsActive whether the preset is active or not? - * returned by CAudioEqualizerUtility::Presets() - */ - void DisplaySettingsL(CAudioEqualizerUtility* aAudEqUtility, - const TInt aIndex, const TBool aIsActive); - - /** - * This function is used to display a note to the user if - * memory is below critical level when creating a new preset. - * @since 3.1 - */ - void ShowDiskFullNoteL() const; - - public: - /** - * This function is used to execute the Dialog. - * @since 3.0 - * @returns return value of CAknDialog::ExecuteLD() - */ - IMPORT_C TInt ExecuteLD(); - - /** - * This function is used to set new values for CAudioEqualizerUtility* - * @since 3.0 - * @param aAudEqUtility New pointer to CAudioEqualizerUtility - */ - IMPORT_C void SetAudioEqualizerL(CAudioEqualizerUtility* aAudEqUtility); - - private: //Functions from base classes - - /** - * From CAknDialog - * This function responds to the size changes to sets the - * size and position of the - * contents of this control. - */ - void SizeChanged(); - - /** - * From CAknDialog - * Handles changes to the application - * when it switches to or from the foreground. - */ - void HandleForegroundEventL( TBool aForeground); - - /** - * From CAknDialog - * Responds to a change in focus. - * This is called whenever the control gains or loses focus - */ - void FocusChanged(TDrawNow aDrawNow); - - /** - * From CCoeControl - * This function is called when there is a Skin change event - * or layout change event - */ - void HandleResourceChangeL(TInt aType); - - /** - * This function is called when there is a Skin change event - * or layout change event, it calls HandleResourceChangeL() - */ - void HandleResourceChange(TInt aType); - - /** - * From CAknDialog Called when a key event happens. - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, - TEventCode aType ); - /** - * From CAknDialog Called just before the dialog is displayed. - */ - void PreLayoutDynInitL(void); - /** - * From CAknDialog Called to process a user's menu command. - */ - void ProcessCommandL(TInt aCommandId); - /** - * From CAknDialog Called just before the menu pane is displayed - */ - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - /** - * From CAknDialog Called when OK key is pressed - */ - TBool OkToExitL(TInt aButtonId); - - /** - * Get help context for the control. - * @param aContext The context that is filled in. - * @return None. - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - -#ifdef RD_SCALABLE_UI_V2 - /** - * From MEikListBoxObserver - * Handles listbox events. - * @param aListBox Listbox where the event occurred. - * @param aEventType Event type. - * - */ - void HandleListBoxEventL( CEikListBox* aListBox, - TListBoxEvent aEventType ); -#endif //RD_SCALABLE_UI_V2 - - private: - // Used to store whether the "OK" key has been pressed or not - // and accordingly invoke appropriate code in DynInitMenuPaneL(). - // It is set to ETrue in OkToExitL() when the key pressed is "OK" - // and set to EFalse in DynInitMenuPaneL() after the "Context - // Sensitive" menu handling has been done. - TBool iContextSensitiveMenu; - // Used to store the offset of the resource file - TInt iResourceFileOffset; - // The ListBox control - CAknSingleGraphicStyleListBox* iListBox; - // Name of currently active preset - TPresetName iActivePreset; - // Application title text - HBufC* iAppTitleText; - // Preset "None" Text - HBufC* iPresetNoneText; - // Equalizer's title text - HBufC* iTitleText; - // Used to store a pointer to CAudioEqualizerUtility - CAudioEqualizerUtility* iAudEqUtility; - // Used to store a reference to the observer class - MEqualizerPresetActivationObserver& iEqrPresetActObserver; - // ListBox Item Array - CEqualizerPresetListArray* iItemArray; - // Ignore Key events between track changes - TBool iIgnoreKeyEvents; - //Editing dialog - CEqualizerEditingDialog *iEditingDialog; - CRepository* iRepository; - // Status pane layout before launching this dialog - TInt iPreviousStatusPaneLayout; - }; - -#endif // EQUALIZERPRESETSDIALOG_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/conf/tcequalizertest.cfg --- a/mmmw_plat/equalizer_ui_api/tsrc/conf/tcequalizertest.cfg Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -[Test] -title 1: CEqualizerPresetsDialog::NewL() -run testscripter c:\testframework\ui_equalizertest.cfg 1 -[Endtest] - -[Test] -title 2: CEqualizerPresetsDialog::ExecuteLD() - //show dialog -run testscripter c:\testframework\ui_equalizertest.cfg 2 - //press key to dismiss dialog -run testscripter c:\testframework\ui_equalizertest.cfg 4 -[Endtest] - -[Test] -title 3: CEqualizerPresetsDialog::SetAudioEqualizerL() -run testscripter c:\testframework\ui_equalizertest.cfg 3 -[Endtest] - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/conf/ui_equalizertest.cfg --- a/mmmw_plat/equalizer_ui_api/tsrc/conf/ui_equalizertest.cfg Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -[Test] -title 1: CEqualizerPresetsDialog::NewL() -create ui_equalizertest equalizer -bringtoforeground -equalizer CEqualizerPresetsDialogNewL -equalizer Release -sendtobackground -delete equalizer -pause 1000 -[Endtest] - -[Test] -title 2: CEqualizerPresetsDialog::ExecuteLD() -create ui_equalizertest equalizer -bringtoforeground -equalizer CEqualizerPresetsDialogNewL -equalizer ExecuteLD -equalizer Release -sendtobackground -delete equalizer -pause 1000 -[Endtest] - -[Test] -title 3: CEqualizerPresetsDialog::SetAudioEqualizerL() -create ui_equalizertest equalizer -bringtoforeground -equalizer CEqualizerPresetsDialogNewL -equalizer SetAudioEqualizerL -equalizer Release -sendtobackground -delete equalizer -pause 1000 -[Endtest] - -[Test] -title 4: press right soft key -pause 3000 -presskey global EKeyDevice1 -[Endtest] diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/group/bld.inf --- a/mmmw_plat/equalizer_ui_api/tsrc/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File that exports the files belonging to -: equalizer ui api -* -*/ - -// Version : %version: da1mmcf#3 % - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_TESTEXPORTS - -PRJ_MMPFILES - -PRJ_TESTMMPFILES -#include "../ui_equalizertest/group/bld.inf" diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/init/TestFramework.ini --- a/mmmw_plat/equalizer_ui_api/tsrc/init/TestFramework.ini Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,197 +0,0 @@ -# -# This is STIF initialization file -# Comment lines start with '#'-character. -# See STIF TestFramework users guide.doc for instructions - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set following test engine settings: -# - Set Test Reporting mode. TestReportMode's possible values are: -# + 'Summary': Summary of the tested test cases. -# + 'Environment': Hardware and software info. -# + 'TestCases': Test case report. -# + 'FullReport': Set of all above ones. -# + Example 'TestReportMode= Summary TestCases' -# -# - CreateTestReport setting controls report creation mode -# + YES, Test report will created. -# + NO, No Test report. -# -# - File path indicates the base path of the test report. -# - File name indicates the name of the test report. -# -# - File format indicates the type of the test report. -# + TXT, Test report file will be txt type, for example 'TestReport.txt'. -# + HTML, Test report will be html type, for example 'TestReport.html'. -# -# - File output indicates output source of the test report. -# + FILE, Test report logging to file. -# + RDEBUG, Test report logging to using rdebug. -# -# - File Creation Mode indicates test report overwriting if file exist. -# + OVERWRITE, Overwrites if the Test report file exist. -# + APPEND, Continue logging after the old Test report information if -# report exist. -# - Sets a device reset module's dll name(Reboot). -# + If Nokia specific reset module is not available or it is not correct one -# StifHWResetStub module may use as a template for user specific reset -# module. -# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation -# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 -# - -[Engine_Defaults] - -TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', - 'TestCases' or 'FullReport' - -CreateTestReport= YES # Possible values: YES or NO - -TestReportFilePath= C:\LOGS\TestFramework\ -TestReportFileName= TestReport_ui_equalizertest - -TestReportFormat= TXT # Possible values: TXT or HTML -TestReportOutput= FILE # Possible values: FILE or RDEBUG -TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting - -DisableMeasurement= stifmeasurementdisablenone # Possible values are: - # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' - # 'stifmeasurementplugin01', 'stifmeasurementplugin02', - # 'stifmeasurementplugin03', 'stifmeasurementplugin04', - # 'stifmeasurementplugin05' or 'stifbappeaprofiler' - -Timeout= 0 # Default timeout value for each test case. In milliseconds -UITestingSupport= YES -[End_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Module configurations start -# Modules are added between module tags -# tags. Module name is specified after ModuleName= tag, like -# ModuleName= XXXXXXXXX -# Modules might have initialisation file, specified as -# IniFile= c:\testframework\YYYYYY -# Modules might have several configuration files, like -# TestCaseFile= c:\testframework\NormalCases.txt -# TestCaseFile= c:\testframework\SmokeCases.txt -# TestCaseFile= c:\testframework\ManualCases.txt - -# (TestCaseFile is synonym for old term ConfigFile) - -# Following case specifies demo module settings. Demo module -# does not read any settings from file, so tags -# IniFile and TestCaseFile are not used. -# In the simplest case it is enough to specify only the -# name of the test module when adding new test module - -[New_Module] -ModuleName= testcombiner -TestCaseFile= c:\testframework\tcequalizertest.cfg -[End_Module] - - -# Load testmoduleXXX, optionally with initialization file and/or test case files -#[New_Module] -#ModuleName= testmodulexxx - -#TestModuleXXX used initialization file -#IniFile= c:\testframework\init.txt - -#TestModuleXXX used configuration file(s) -#TestCaseFile= c:\testframework\testcases1.cfg -#TestCaseFile= c:\testframework\testcases2.cfg -#TestCaseFile= c:\testframework\manualtestcases.cfg - -#[End_Module] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - - - -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -# Set STIF logging overwrite parameters for Logger. -# Hardware and emulator environment logging path and styles can -# be configured from here to overwrite the Logger's implemented values. -# -# Settings description: -# - Indicates option for creation log directory/directories. If log directory/directories -# is/are not created by user they will make by software. -# + YES, Create log directory/directories if not allready exist. -# + NO, Log directory/directories not created. Only created one is used. -# -# - Overwrite emulator path setting. -# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined -# Logger's path 'D:\\LOGS\\Module\\' with those definition the path -# will be 'C:\LOGS\TestFramework\LOGS\Module\' -# -# - Overwrite emulator's logging format. -# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. -# + HTML, Log file(s) will be html type(s), for example 'Module.html'. -# -# - Overwrited emulator logging output source. -# + FILE, Logging to file(s). -# + RDEBUG, Logging to using rdebug(s). -# -# - Overwrite hardware path setting (Same description as above in emulator path). -# - Overwrite hardware's logging format(Same description as above in emulator format). -# - Overwrite hardware's logging output source(Same description as above in emulator output). -# -# - File Creation Mode indicates file overwriting if file exist. -# + OVERWRITE, Overwrites if file(s) exist. -# + APPEND, Continue logging after the old logging information if file(s) exist. -# -# - Will thread id include to the log filename. -# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. -# + NO, No thread id to log file(s), Example filename 'Module.txt'. -# -# - Will time stamps include the to log file. -# + YES, Time stamp added to each line in log file(s). Time stamp is -# for example'12.Nov.2003 115958 LOGGING INFO' -# + NO, No time stamp(s). -# -# - Will line breaks include to the log file. -# + YES, Each logging event includes line break and next log event is in own line. -# + NO, No line break(s). -# -# - Will event ranking include to the log file. -# + YES, Event ranking number added to each line in log file(s). Ranking number -# depends on environment's tics, for example(includes time stamp also) -# '012 12.Nov.2003 115958 LOGGING INFO' -# + NO, No event ranking. -# -# - Will write log file in unicode format. -# + YES, Log file will be written in unicode format -# + NO, Log will be written as normal, not unicode, file. -# - -[Logger_Defaults] - -#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' -#NOTE: TestEngine and TestServer logging settings cannot change here - -#CreateLogDirectories= YES # Possible values: YES or NO - -#EmulatorBasePath= C:\LOGS\TestFramework\ -#EmulatorFormat= HTML # Possible values: TXT or HTML -#EmulatorOutput= FILE # Possible values: FILE or RDEBUG - -#HardwareBasePath= D:\LOGS\TestFramework\ -#HardwareFormat= HTML # Possible values: TXT or HTML -#HardwareOutput= FILE # Possible values: FILE or RDEBUG - -#FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND - -#ThreadIdToLogFile= YES # Possible values: YES or NO -#WithTimeStamp= YES # Possible values: YES or NO -#WithLineBreak= YES # Possible values: YES or NO -#WithEventRanking= YES # Possible values: YES or NO - -#FileUnicode= YES # Possible values: YES or NO -#AddTestCaseTitle= YES # Possible values: YES or NO -[End_Logger_Defaults] -# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -# End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/Bmarm/ui_equalizertestU.DEF --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/Bmarm/ui_equalizertestU.DEF Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - LibEntryL__FR13CTestModuleIf @ 1 NONAME R3UNUSED ; LibEntryL(CTestModuleIf &) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/Bwins/ui_equalizertestU.DEF --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/Bwins/ui_equalizertestU.DEF Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,3 +0,0 @@ -EXPORTS - ?LibEntryL@@YAPAVCScriptBase@@AAVCTestModuleIf@@@Z @ 1 NONAME ; class CScriptBase * __cdecl LibEntryL(class CTestModuleIf &) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/EABI/ui_equalizertestU.def --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/EABI/ui_equalizertestU.def Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - _Z9LibEntryLR13CTestModuleIf @ 1 NONAME - _ZTI17CEdwinTestControl @ 2 NONAME ; ## - _ZTV17CEdwinTestControl @ 3 NONAME ; ## - diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/group/bld.inf --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here -// defaults to WINS MARM so you can ignore this if you just build these - - DEFAULT - -PRJ_TESTEXPORTS -// NOTE: If using ARS requirements all export operations should be done under this. -// 'abld test export' - -PRJ_EXPORTS -// Specify the source file followed by its destination here -// copy will be used to copy the source file to its destination -// If there's no destination then the source file will be copied -// to the same name in /epoc32/include -// Example: -/* -/agnmodel/inc/AGMCOMON.H -*/ - -PRJ_TESTMMPFILES - - ui_equalizertest.mmp - -PRJ_MMPFILES - - -// Specify the .mmp files required for building the important component -// releasables. -// -// Specify "tidy" if the component you need to build doesn't need to be -// released. Specify "ignore" if the MMP file exists but should be -// ignored. -// Example: -/* -/agnmodel/group/agnmodel.mmp -#if defined(MARM) -/agnmodel/group/agsvexe.mmp -#endif -*/ - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/group/ui_equalizertest.mmp --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/group/ui_equalizertest.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,89 +0,0 @@ -/*TYPE TESTCLASS*/ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: MMP file for STIF Test Framework's TestScripter -* testclass test module. -* -*/ - -#include - -TARGET ui_equalizertest.dll -TARGETTYPE dll -UID 0x1000008D 0x101FB3E3 - -CAPABILITY ALL -TCB -/* Remove comments and replace 0x00000000 with correct vendor id */ -// VENDORID 0x00000000 -/* Remove comments and replace 0x00000000 with correct secure id */ -// SECUREID 0x00000000 - -//TARGETPATH ?target_path -DEFFILE ui_equalizertest.def - -USERINCLUDE ../inc - -#if 0 -MW_LAYER_SYSTEMINCLUDE -#endif -SYSTEMINCLUDE /epoc32/include /epoc32/include/mw /epoc32/include/platform/mw /epoc32/include/platform /epoc32/include/platform/loc /epoc32/include/platform/mw/loc /epoc32/include/platform/loc/sc /epoc32/include/platform/mw/loc/sc +/include/a3f +/include/mmf/server - -SOURCEPATH ../src - -SOURCE ui_equalizertest.cpp -SOURCE ui_equalizertestBlocks.cpp EdwinTestControl.cpp - -//RESOURCE resource_file -//RESOURCE resource_file2 - -LIBRARY euser.lib -LIBRARY stiftestinterface.lib -LIBRARY stiftestengine.lib Equalizer.lib -LIBRARY AudioEqualizerUtility.lib -LIBRARY mediaclientaudio.lib CustomInterfaceUtility.lib CustomCommandUtility.lib -LIBRARY mmfcodeccommon.lib -LIBRARY mmfcontrollerframework.lib -LIBRARY mmfglblaudioeffect.lib -LIBRARY mmfserverbaseclasses.lib -LIBRARY ecom.lib -LIBRARY cone.lib -LIBRARY eikcoctl.lib AknSkins.lib -LIBRARY eikcore.lib -LIBRARY avkon.lib - -LANG SC - -/* -START WINS -?wins_specific_information -END - -START MARM -?marm_specific_information -END -*/ -// Other possible keywords: - -// DOCUMENT ?file, that is not compiled, but added to MSVC project workspace (i.e. release notes) -/* -START BITMAP ?target -TARGETPATH ?emulated_path_on_target_machine -HEADER -SOURCE ?color_depth ?source_bitmap -END -*/ -// DEFFILE ?filename -// AIF ?filename - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/group/ui_equalizertest.pkg --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/group/ui_equalizertest.pkg Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -; -; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -; All rights reserved. -; This component and the accompanying materials are made available -; under the terms of "Eclipse Public License v1.0" -; which accompanies this distribution, and is available -; at the URL "http://www.eclipse.org/legal/epl-v10.html". -; -; Initial Contributors: -; Nokia Corporation - initial contribution. -; -; Contributors: -; -; Description: -; -; Installation file for STIF -; - -; Languages -&EN - -; Provide value for uid -#{"STIF equalizer ui test Application"},(0x10005942),1,1,0,TYPE=SA - - -; Localised Vendor name -%{"Nokia"} - -; Unique Vendor name -:"Nokia" - -; Logo -; None - -; Package signature - Optional -; None - -; Start of Package body - -; Condition blocks -; None - -; Options list -; None - -; Install files -"\epoc32\release\armv5\urel\ui_equalizertest.dll" - "c:\Sys\Bin\ui_equalizertest.dll" -"..\..\init\TestFramework.ini" - "c:\testframework\TestFramework.ini" -"..\..\conf\ui_equalizertest.cfg" - "c:\testframework\ui_equalizertest.cfg" -"..\..\conf\tcequalizertest.cfg" - "c:\testframework\tcequalizertest.cfg" - -; Embedded SIS -; None - -; End of Package body - -; PKG dependencies -; None - -; PKG capabilities -; None diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/inc/EdwinTestControl.h --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/inc/EdwinTestControl.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: CEdwinTestControl test class for STIF Test Framework TestScripter. -* -*/ -#ifndef EDWINTESTCONTROL_H_ -#define EDWINTESTCONTROL_H_ - -#include - -class CAknsBasicBackgroundControlContext; - -class CEdwinTestControl : public CCoeControl, public MCoeControlObserver - { -public: - static CEdwinTestControl* NewL(void); - virtual ~CEdwinTestControl(); -protected: - TTypeUid::Ptr MopSupplyObject(TTypeUid aId); // -private: - virtual void SizeChanged(); - virtual void HandleResourceChange(TInt aType); - virtual TInt CountComponentControls() const; - virtual CCoeControl* ComponentControl(TInt aIndex) const; - void ConstructL(/*void*/); - void Draw(const TRect& aRect) const; - - void HandleControlEventL( CCoeControl* aControl, TCoeEvent aEventType); - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, TEventCode aType ); -private: - CAknsBasicBackgroundControlContext* iBgContext; - CEikEdwin* iEditWin; -}; - - -#endif /*EDWINTESTCONTROL_H_*/ diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/inc/ui_equalizertest.h --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/inc/ui_equalizertest.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,255 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: STIF testclass declaration -* -*/ - -#ifndef UI_EQUALIZERTEST_H -#define UI_EQUALIZERTEST_H - -// INCLUDES -#include -#include -#include -#include -#include -#include - -#include -#include -#include "edwintestcontrol.h" - - - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def -#define TEST_CLASS_VERSION_MAJOR 0 -#define TEST_CLASS_VERSION_MINOR 0 -#define TEST_CLASS_VERSION_BUILD 0 - - -#ifdef __WINSCW__ -// Logging path -_LIT( Kui_equalizertestLogPath, "\\logs\\testframework\\ui_equalizertest\\" ); -// Log file -_LIT( Kui_equalizertestLogFile, "ui_equalizertest.txt" ); -_LIT( Kui_equalizertestLogFileWithTitle, "ui_equalizertest_[%S].txt" ); -_LIT( Kui_equalizer_TestData_Path, "c:\\testing\\data\\" ); -#else -// Logging path -_LIT( Kui_equalizertestLogPath, "\\logs\\testframework\\ui_equalizertest\\" ); -// Log file -_LIT( Kui_equalizertestLogFile, "ui_equalizertest.txt" ); -_LIT( Kui_equalizertestLogFileWithTitle, "ui_equalizertest_[%S].txt" ); -_LIT( Kui_equalizer_TestData_Path, "e:\\testing\\data\\" ); -#endif - - - -// FUNCTION PROTOTYPES -//?type ?function_name(?arg_list); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; -class Cui_equalizertest; -class CCustomCommandUtility; -class CCustomCommand; - -// DATA TYPES -//enum ?declaration -//typedef ?declaration -//extern ?data_type; - -// CLASS DECLARATION - -/** -* Cui_equalizertest test class for STIF Test Framework TestScripter. -* ?other_description_lines -* -* @lib ?library -* @since ?Series60_version -*/ -NONSHARABLE_CLASS(Cui_equalizertest) : public CScriptBase, -// public MMdaAudioPlayerCallback, - public MEqualizerPresetActivationObserver//, -// public MCustomInterface, -// public MMdaObjectStateChangeObserver, -// public MMPXPlaybackObserver, -// public MMPXCustomCommandObserver - - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - */ - static Cui_equalizertest* NewL( CTestModuleIf& aTestModuleIf ); - - /** - * Destructor. - */ - virtual ~Cui_equalizertest(); - - public: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - - /** - * From MEqualizerPresetActivationObserver - * Handle preset id activation from Equalizer dialog. - * - * @param aActivatedPreset Current activated preset id. - */ - virtual void HandlePresetActivation( TInt aActivatedPreset ); - - - - - /** - * Handle custom commands. - * - * @since S60 3.2.3 - * @param aUid Command category Uid. Different command set will have - * different Uid to avoid clash. - * @param aCommand Command to be handled. - * @param aData data for the specific command - */ - void HandleCustomCommand( - const TUid& /*aUid*/, - const TInt /*aCommand*/, - const TDesC8& aData = KNullDesC8 ){}; - - - public: // Functions from base classes - - /** - * From CScriptBase Runs a script line. - * @since ?Series60_version - * @param aItem Script line containing method name and parameters - * @return Symbian OS error code - */ - virtual TInt RunMethodL( CStifItemParser& aItem ); - - - - protected: // New functions - - /** - * ?member_description. - * @since ?Series60_version - * @param ?arg1 ?description - * @return ?description - */ - //?type ?member_function( ?type ?arg1 ); - - protected: // Functions from base classes - - /** - * From ?base_class ?member_description - */ - //?type ?member_function(); - - private: - - /** - * C++ default constructor. - */ - Cui_equalizertest( CTestModuleIf& aTestModuleIf ); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - // Prohibit copy constructor if not deriving from CBase. - // ?classname( const ?classname& ); - // Prohibit assigment operator if not deriving from CBase. - // ?classname& operator=( const ?classname& ); - - /** - * Frees all resources allocated from test methods. - * @since ?Series60_version - */ - void Delete(); - - /** - * Test methods are listed below. - */ - - /** - * Example test method. - * @since ?Series60_version - * @param aItem Script line containing parameters. - * @return Symbian OS error code. - */ - virtual TInt ExampleL( CStifItemParser& aItem ); - - // Test functions for EqualizerPresetsDialog.h - TInt CEqualizerPresetsDialogNewL( CStifItemParser& aItem ); - TInt ExecuteLD( CStifItemParser& aItem ); - TInt SetAudioEqualizerL( CStifItemParser& aItem ); - TInt Release( CStifItemParser& aItem ); - - /** - * Method used to log version of test class - */ - void SendTestClassVersion(); - - //ADD NEW METHOD DEC HERE - //[TestMethods] - Do not remove - - public: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - protected: // Data - // ?one_line_short_description_of_data - //?data_declaration; - - private: // Data - - // ?one_line_short_description_of_data - //?data_declaration; - - // Reserved pointer for future extension - //TAny* iReserved; - - public: // Friend classes - //?friend_class_declaration; - protected: // Friend classes - //?friend_class_declaration; - private: // Friend classes - //?friend_class_declaration; - // Used to store a pointer to CAudioEqualizerUtility - CAudioEqualizerUtility* iAudEqUtility; - CEqualizerPresetsDialog* iEqDialog; - CCustomCommand* iCustomCommand; - CEdwinTestControl* iEdwinTestControl; - TInt iInitStatus; - - }; - -#endif // UI_EQUALIZERTEST_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/src/EdwinTestControl.cpp --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/src/EdwinTestControl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,150 +0,0 @@ -/* -* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: STIF for MPEngine -* -*/ - -// Version : %version: da1mmcf#2 % - - - -#include "EdwinTestControl.h" -#include -#include -#include -#include -#include - - -CEdwinTestControl::~CEdwinTestControl() - { - delete iEditWin; - iEditWin = NULL; - delete iBgContext; - iBgContext = NULL; - } - -CEdwinTestControl* CEdwinTestControl::NewL(void) - { - CEdwinTestControl* self = new(ELeave)CEdwinTestControl(); - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop( self ); - return self; - } - -void CEdwinTestControl::ConstructL() - { - CreateWindowL(); - - iEditWin = new (ELeave) CEikEdwin(); - iEditWin->ConstructL( 0, 100, 100, 1 ); - iEditWin->SetContainerWindowL( *this ); - iEditWin->CreateTextViewL(); -// iEditWin->SetInputCapabilitiesL( TCoeInputCapabilities::EAllText ); - - // make first with no size at all - iBgContext = CAknsBasicBackgroundControlContext::NewL(KAknsIIDQsnBgScreen,TRect(0,0,1,1), ETrue ); - // Setting rect will cause SizeChanged to be called - // and iBgContext size & position is updated accordingly. - SetRect( CEikonEnv::Static()->EikAppUi()->ClientRect() ); - - ActivateL(); - DrawNow(); - } - -void CEdwinTestControl::SizeChanged() - { - if ( iBgContext ) - { - iBgContext->SetRect(Rect()); - - if ( &Window() ) - { - iBgContext->SetParentPos( PositionRelativeToScreen() ); - } - } - if ( iEditWin ) - { - iEditWin->SetRect(Rect()); - } - } - - -void CEdwinTestControl::HandleResourceChange( TInt aType ) - { - TRect rect; - - if ( aType == KEikDynamicLayoutVariantSwitch ) - { - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); - SetRect(rect); - } - - CCoeControl::HandleResourceChange(aType); - } - - -TTypeUid::Ptr CEdwinTestControl::MopSupplyObject(TTypeUid aId) - { - if ( iBgContext ) - { - return MAknsControlContext::SupplyMopObject( aId, iBgContext ); - } - - return CCoeControl::MopSupplyObject( aId ); - } - - -void CEdwinTestControl::Draw(const TRect& aRect) const - { - CWindowGc& gc = SystemGc(); - - // draw background skin first. - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - AknsDrawUtils::Background( skin, iBgContext, this, gc, aRect ); - } - -TInt CEdwinTestControl::CountComponentControls() const -{ - return 1; -} - -CCoeControl* CEdwinTestControl::ComponentControl(TInt aIndex) const -{ - switch (aIndex) - { - case 0: - return iEditWin; - default: - return 0; - } -} - -void CEdwinTestControl::HandleControlEventL( CCoeControl* /*aControl*/, TCoeEvent /*aEventType*/) - { - // TODO: Add your control event handler code here - } - -TKeyResponse CEdwinTestControl::OfferKeyEventL( const TKeyEvent& aKeyEvent, TEventCode aType ) - { - if ( iEditWin ) - { - return iEditWin->OfferKeyEventL( aKeyEvent, aType ); - } - else - { - return EKeyWasNotConsumed; - } - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/src/ui_equalizertest.cpp --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/src/ui_equalizertest.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,203 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains testclass implementation. -* -*/ - -// INCLUDE FILES -#include -#include "ui_equalizertest.h" -#include - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::Cui_equalizertest -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -Cui_equalizertest::Cui_equalizertest( - CTestModuleIf& aTestModuleIf ): - CScriptBase( aTestModuleIf ) - { - } - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void Cui_equalizertest::ConstructL() - { - //Read logger settings to check whether test case name is to be - //appended to log file name. - RSettingServer settingServer; - TInt ret = settingServer.Connect(); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Struct to StifLogger settigs. - TLoggerSettings loggerSettings; - // Parse StifLogger defaults from STIF initialization file. - ret = settingServer.GetLoggerSettings(loggerSettings); - if(ret != KErrNone) - { - User::Leave(ret); - } - // Close Setting server session - settingServer.Close(); - - TFileName logFileName; - - if(loggerSettings.iAddTestCaseTitle) - { - TName title; - TestModuleIf().GetTestCaseTitleL(title); - logFileName.Format(Kui_equalizertestLogFileWithTitle, &title); - } - else - { - logFileName.Copy(Kui_equalizertestLogFile); - } - - iLog = CStifLogger::NewL( Kui_equalizertestLogPath, - logFileName, - CStifLogger::ETxt, - CStifLogger::EFile, - EFalse ); - - SendTestClassVersion(); - - - - - } - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -Cui_equalizertest* Cui_equalizertest::NewL( - CTestModuleIf& aTestModuleIf ) - { - Cui_equalizertest* self = new (ELeave) Cui_equalizertest( aTestModuleIf ); - - CleanupStack::PushL( self ); - self->ConstructL(); - CleanupStack::Pop(); - - return self; - - } - -// Destructor -Cui_equalizertest::~Cui_equalizertest() - { - - // Delete resources allocated from test methods - Delete(); - - // Delete logger - delete iLog; - - } - -//----------------------------------------------------------------------------- -// Cui_equalizertest::SendTestClassVersion -// Method used to send version of test class -//----------------------------------------------------------------------------- -// -void Cui_equalizertest::SendTestClassVersion() - { - TVersion moduleVersion; - moduleVersion.iMajor = TEST_CLASS_VERSION_MAJOR; - moduleVersion.iMinor = TEST_CLASS_VERSION_MINOR; - moduleVersion.iBuild = TEST_CLASS_VERSION_BUILD; - - TFileName moduleName; - moduleName = _L("ui_equalizertest.dll"); - - TBool newVersionOfMethod = ETrue; - TestModuleIf().SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod); - } - -// ========================== OTHER EXPORTED FUNCTIONS ========================= - -// ----------------------------------------------------------------------------- -// LibEntryL is a polymorphic Dll entry point. -// Returns: CScriptBase: New CScriptBase derived object -// ----------------------------------------------------------------------------- -// -EXPORT_C CScriptBase* LibEntryL( - CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework - { - - return ( CScriptBase* ) Cui_equalizertest::NewL( aTestModuleIf ); - - } - - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/src/ui_equalizertestBlocks.cpp --- a/mmmw_plat/equalizer_ui_api/tsrc/ui_equalizertest/src/ui_equalizertestBlocks.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,382 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains testclass implementation. -* -*/ - -// [INCLUDE FILES] - do not remove -#include -#include -#include -#include "ui_equalizertest.h" - -#include - - - class CCustomCommand : public CCustomCommandUtility - { - public: - CCustomCommand() - { - - } - - ~CCustomCommand() - { - - } - - TInt CustomCommandSync(const TMMFMessageDestinationPckg& /*aDestination*/, - TInt aFunction, - const TDesC8& /*aDataTo1*/, - const TDesC8& /*aDataTo2*/, - TDes8& aDataFrom) - { - const TUid KUidCustomInterfaceBuilder = {0x10200017}; - const TUid KUidAudioEqualizerEffect = { 0x1020382A }; - if( aFunction == 3 ) - { - TPckgBuf buf( 1 ); - aDataFrom = buf; - } - //if( aFunction == 1 || aDestination().Interface() == KUidCustomInterfaceBuilder ) - else - { - TMMFMessageDestination builderHandle(KUidCustomInterfaceBuilder); - TMMFMessageDestinationPckg builderHandlePckg( builderHandle ); - aDataFrom = builderHandlePckg; - } - return 0; - } - - TInt CustomCommandSync(const TMMFMessageDestinationPckg& /*aDestination*/, - TInt /*aFunction*/, - const TDesC8& /*aDataTo1*/, - const TDesC8& /*aDataTo2*/) - { - return 0; - } - - void CustomCommandAsync(const TMMFMessageDestinationPckg& /*aDestination*/, - TInt /*aFunction*/, - const TDesC8& /*aDataTo1*/, - const TDesC8& /*aDataTo2*/, - TDes8& /*aDataFrom*/, - TRequestStatus& /*aStatus*/) - { - - } - - void CustomCommandAsync(const TMMFMessageDestinationPckg& /*aDestination*/, - TInt /*aFunction*/, - const TDesC8& /*aDataTo1*/, - const TDesC8& /*aDataTo2*/, - TRequestStatus& /*aStatus*/) - { - - } - }; - - - - - - - - -// EXTERNAL DATA STRUCTURES -//extern ?external_data; - -// EXTERNAL FUNCTION PROTOTYPES -//extern ?external_function( ?arg_type,?arg_type ); - -// CONSTANTS -//const ?type ?constant_var = ?constant; - -// MACROS -//#define ?macro ?macro_def - -// LOCAL CONSTANTS AND MACROS -//const ?type ?constant_var = ?constant; -//#define ?macro_name ?macro_def - -// MODULE DATA STRUCTURES -//enum ?declaration -//typedef ?declaration - -// LOCAL FUNCTION PROTOTYPES -//?type ?function_name( ?arg_type, ?arg_type ); - -// FORWARD DECLARATIONS -//class ?FORWARD_CLASSNAME; - -// ============================= LOCAL FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// ?function_name ?description. -// ?description -// Returns: ?value_1: ?description -// ?value_n: ?description_line1 -// ?description_line2 -// ----------------------------------------------------------------------------- -// -/* -?type ?function_name( - ?arg_type arg, // ?description - ?arg_type arg) // ?description - { - - ?code // ?comment - - // ?comment - ?code - } -*/ - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::Delete -// Delete here all resources allocated and opened from test methods. -// Called from destructor. -// ----------------------------------------------------------------------------- -// - - -void Cui_equalizertest::Delete() - { - - } - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::RunMethodL -// Run specified method. Contains also table of test mothods and their names. -// ----------------------------------------------------------------------------- -// -TInt Cui_equalizertest::RunMethodL( - CStifItemParser& aItem ) - { - - static TStifFunctionInfo const KFunctions[] = - { - // Copy this line for every implemented function. - // First string is the function name used in TestScripter script file. - // Second is the actual implementation member function. - ENTRY( "Example", Cui_equalizertest::ExampleL ), - //ADD NEW ENTRY HERE - // [test cases entries] - Do not remove - // Test functions for EqualizerPresetsDialog.h - ENTRY( "CEqualizerPresetsDialogNewL", Cui_equalizertest::CEqualizerPresetsDialogNewL ), - ENTRY( "ExecuteLD", Cui_equalizertest::ExecuteLD ), - ENTRY( "SetAudioEqualizerL", Cui_equalizertest::SetAudioEqualizerL ), - ENTRY( "Release", Cui_equalizertest::Release ), - - - }; - - const TInt count = sizeof( KFunctions ) / - sizeof( TStifFunctionInfo ); - - return RunInternalL( KFunctions, count, aItem ); - - } - - - -// --------------------------------------------------------------------------- -// From MEqualizerPresetActivationObserver -// Handle preset id activation from Equalizer dialog. -// --------------------------------------------------------------------------- -// -void Cui_equalizertest::HandlePresetActivation( - TInt aActivatedPreset ) - { - iLog->Log(_L("Cui_equalizertest::HandlePresetActivation :-> aActivatedPreset[%d]"), aActivatedPreset ); - } - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::ExampleL -// Example test method function. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -TInt Cui_equalizertest::ExampleL( CStifItemParser& aItem ) - { - - // Print to UI - _LIT( Kui_equalizertest, "ui_equalizertest" ); - _LIT( KExample, "In Example" ); - TestModuleIf().Printf( 0, Kui_equalizertest, KExample ); - // Print to log file - iLog->Log( KExample ); - - TInt i = 0; - TPtrC string; - _LIT( KParam, "Param[%i]: %S" ); - while ( aItem.GetNextString ( string ) == KErrNone ) - { - TestModuleIf().Printf( i, Kui_equalizertest, - KParam, i, &string ); - i++; - } - - return KErrNone; - - } - - -// --------------------------------------------------------------------------- -// Cui_equalizertest::CEqualizerPresetsDialogNewL -// ?implementation_description -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -TInt Cui_equalizertest::CEqualizerPresetsDialogNewL( CStifItemParser& /*aItem*/ ) - { - iLog->Log(_L("Cui_equalizertest::CEqualizerPresetsDialogNewL")); - TInt err = KErrNone; - TInt presetId = 0; - - - iCustomCommand = new (ELeave) CCustomCommand; - - iAudEqUtility = CAudioEqualizerUtility::NewL( iCustomCommand ); - - //iEqDialog = CEqualizerPresetsDialog::NewL( iAudEqUtility, presetId, *this ); - - TRAP( err , iEqDialog = CEqualizerPresetsDialog::NewL( iAudEqUtility, presetId, *this ) ); - - if ( err == KErrNone ) - { - iLog->Log(_L("CEqualizerPresetsDialogNewL return with no error!")); - } - else - { - iLog->Log(_L("ERROR:CEqualizerPresetsDialogNewL fails!%d returns!"),err); - } - return err; - } - -// --------------------------------------------------------------------------- -// Cui_equalizertest::ExecuteLD -// ?implementation_description -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -TInt Cui_equalizertest::ExecuteLD( CStifItemParser& /*aItem*/ ) - { - iLog->Log(_L("Cui_equalizertest::ExecuteLD")); - TInt err = KErrNone; - TInt ret = 0; - - iEdwinTestControl = CEdwinTestControl::NewL(); - CleanupStack::PushL( iEdwinTestControl ); - CCoeEnv::Static()->AppUi()->AddToStackL( iEdwinTestControl ); - iEdwinTestControl->MakeVisible(ETrue); - CleanupStack::Pop( iEdwinTestControl ); - - //TRAP_IGNORE( ret = iEqDialog->ExecuteLD() ); - //TRAP( err,ret = iEqDialog->ExecuteLD() ); - ret = iEqDialog->ExecuteLD(); - - //iEqDialog->OfferKeyEventL( ret ); - - if ( err == KErrNone ) - { - iLog->Log(_L("ExecuteLD return with no error!")); - iLog->Log(_L("ExecuteLD() return [%d]!"),ret); - } - else - { - iLog->Log(_L("ERROR:ExecuteLD fails!%d returns!"),err); - } - return err; - } - -// --------------------------------------------------------------------------- -// Cui_equalizertest::SetAudioEqualizerL -// ?implementation_description -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -TInt Cui_equalizertest::SetAudioEqualizerL( CStifItemParser& /*aItem*/ ) - { - iLog->Log(_L("Cui_equalizertest::SetAudioEqualizerL")); - TInt err = KErrNone; - if( iAudEqUtility ) - { - //iEqDialog->SetAudioEqualizerL( iAudEqUtility ); - TRAP( err,iEqDialog->SetAudioEqualizerL( iAudEqUtility ) ); - if ( err == KErrNone ) - { - iLog->Log(_L("SetAudioEqualizerL return with no error!")); - } - else - { - iLog->Log(_L("ERROR:SetAudioEqualizerL fails!%d returns!"),err); - } - } - else - { - iLog->Log(_L("iAudEqUtility is NULL, can not call SetAudioEqualizerL(). User leave here.")); - User::Leave( 1000 ); - } - return err; - } - -// --------------------------------------------------------------------------- -// Cui_equalizertest::Release -// ?implementation_description -// (other items were commented in a header). -// --------------------------------------------------------------------------- -// -TInt Cui_equalizertest::Release( CStifItemParser& /*aItem*/ ) - { - iLog->Log(_L("Cui_equalizertest::Release")); - TInt err = KErrNone; - if( iEqDialog ) - { - delete iEqDialog; - } - if( iAudEqUtility ) - { - delete iAudEqUtility; - } - if( iEdwinTestControl ) - { - delete iEdwinTestControl; - } - return err; - } - -// ----------------------------------------------------------------------------- -// Cui_equalizertest::?member_function -// ?implementation_description -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -/* -TInt Cui_equalizertest::?member_function( - CItemParser& aItem ) - { - - ?code - - } -*/ - -// ========================== OTHER EXPORTED FUNCTIONS ========================= -// None - -// [End of File] - Do not remove diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_radioitf.cfg --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_radioitf.cfg Fri Jun 25 17:36:03 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/conf/openmaxaltestmodule_radioitf.cfg Fri Jul 09 16:43:35 2010 -0500 @@ -30,7 +30,7 @@ [Endtest] [Test] -title 21.2 RadioItf Set Freq 106.0 MHz +title 21.2 RadioItf Get Frequency (DEFAULT) create openmaxaltestmodule ALImpl ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE @@ -40,7 +40,6 @@ ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO ALImpl al_radioitf_RegisterRadioCallback - ALImpl al_SetDataLocator 3 5 0 1 ALImpl al_SetDataSource 3 0 1 ALImpl al_SetDataSink 3 6 1 @@ -51,10 +50,7 @@ ALImpl al_objitf_GetInterface 4 XA_IID_PLAY ALImpl al_playitf_RegisterCallback -request Event_XA_RADIO_EVENT_FREQUENCY_CHANGED -ALImpl al_radioitf_SetFrequency 106000000 -wait Event_XA_RADIO_EVENT_FREQUENCY_CHANGED -release Event_XA_RADIO_EVENT_FREQUENCY_CHANGED +ALImpl al_radioitf_GetFrequencyDefault ALImpl al_objitf_Destroy MO_RADIO ALImpl al_objitf_Destroy MO_PLAYER @@ -63,7 +59,36 @@ [Endtest] [Test] -title 21.3 RadioItf Get Freq +title 21.3 RadioItf Get Freq Range (DEFAULT) +create openmaxaltestmodule ALImpl +ALImpl al_createEngine 1 1 0 0 +ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE +ALImpl al_engitf_CreateRadioDevice 0 +ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO +ALImpl al_radioitf_RegisterRadioCallback + +ALImpl al_SetDataLocator 3 5 0 1 +ALImpl al_SetDataSource 3 0 1 +ALImpl al_SetDataSink 3 6 1 + +ALImpl al_engitf_CreateMediaPlayer 0 + +ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface 4 XA_IID_PLAY +ALImpl al_playitf_RegisterCallback + +ALImpl al_radioitf_GetFreqRangeDefault + +ALImpl al_objitf_Destroy MO_RADIO +ALImpl al_objitf_Destroy MO_PLAYER +ALImpl al_objitf_Destroy MO_ENGINE +delete ALImpl +[Endtest] + +[Test] +title 21.4 RadioItf Set-Get Freq 106.0 create openmaxaltestmodule ALImpl ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE @@ -98,41 +123,7 @@ [Endtest] [Test] -title 21.4 RadioItf Set Freq Range -create openmaxaltestmodule ALImpl -ALImpl al_createEngine 1 1 0 0 -ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE -ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE -ALImpl al_engitf_CreateRadioDevice 0 -ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE -ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO -ALImpl al_radioitf_RegisterRadioCallback - - -ALImpl al_SetDataLocator 3 5 0 1 -ALImpl al_SetDataSource 3 0 1 -ALImpl al_SetDataSink 3 6 1 - -ALImpl al_engitf_CreateMediaPlayer 0 - -ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE -ALImpl al_objitf_GetInterface 4 XA_IID_PLAY -ALImpl al_playitf_RegisterCallback - -request Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED -ALImpl al_radioitf_SetFreqRange 1 // EFmRangeJapan -wait Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED -release Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED - - -ALImpl al_objitf_Destroy MO_RADIO -ALImpl al_objitf_Destroy MO_PLAYER -ALImpl al_objitf_Destroy MO_ENGINE -delete ALImpl -[Endtest] - -[Test] -title 21.5 RadioItf Get Freq Range +title 21.5 RadioItf Set-Get Freq Range create openmaxaltestmodule ALImpl ALImpl al_createEngine 1 1 0 0 ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE @@ -153,11 +144,11 @@ ALImpl al_playitf_RegisterCallback request Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED -ALImpl al_radioitf_SetFreqRange 1 // EFmRangeJapan +ALImpl al_radioitf_SetFreqRange 2 //XA_FREQRANGE_FMJAPAN wait Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED release Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED -ALImpl al_radioitf_GetFreqRange 1 // EFmRangeJapan +ALImpl al_radioitf_GetFreqRange 2 // EFmRangeJapan ALImpl al_objitf_Destroy MO_RADIO ALImpl al_objitf_Destroy MO_PLAYER @@ -176,7 +167,6 @@ ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO ALImpl al_radioitf_RegisterRadioCallback - ALImpl al_SetDataLocator 3 5 0 1 ALImpl al_SetDataSource 3 0 1 ALImpl al_SetDataSink 3 6 1 @@ -188,11 +178,11 @@ ALImpl al_playitf_RegisterCallback request Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED -ALImpl al_radioitf_SetFreqRange 0 // EFmRangeEuroAmerica +ALImpl al_radioitf_SetFreqRange 1 //XA_FREQRANGE_FMEUROAMERICA wait Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED release Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED -ALImpl al_radioitf_GetFreqRangeProperties 0 87500000 108000000 20 // range expected: min freq, max freq, freq interval +ALImpl al_radioitf_GetFreqRangeProperties 1 87500000 108000000 200000 // range expected: min freq, max freq, freq interval ALImpl al_objitf_Destroy MO_RADIO ALImpl al_objitf_Destroy MO_PLAYER @@ -211,7 +201,6 @@ ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO ALImpl al_radioitf_RegisterRadioCallback - ALImpl al_SetDataLocator 3 5 0 1 ALImpl al_SetDataSource 3 0 1 ALImpl al_SetDataSink 3 6 1 @@ -726,4 +715,74 @@ ALImpl al_objitf_Destroy MO_PLAYER ALImpl al_objitf_Destroy MO_ENGINE delete ALImpl -[Endtest] \ No newline at end of file +[Endtest] + +[Test] +title 21.22 RadioItf Set Freq ERROR--too big +create openmaxaltestmodule ALImpl +ALImpl al_createEngine 1 1 0 0 +ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE +ALImpl al_engitf_CreateRadioDevice 0 +ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO +ALImpl al_radioitf_RegisterRadioCallback + + +ALImpl al_SetDataLocator 3 5 0 1 +ALImpl al_SetDataSource 3 0 1 +ALImpl al_SetDataSink 3 6 1 + +ALImpl al_engitf_CreateMediaPlayer 0 + +ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface 4 XA_IID_PLAY +ALImpl al_playitf_RegisterCallback + +request Event_XA_RADIO_EVENT_FREQUENCY_CHANGED +allownextresult -5 +ALImpl al_radioitf_SetFrequency 109000000 + +wait Event_XA_RADIO_EVENT_FREQUENCY_CHANGED +release Event_XA_RADIO_EVENT_FREQUENCY_CHANGED + +ALImpl al_objitf_Destroy MO_RADIO +ALImpl al_objitf_Destroy MO_PLAYER +ALImpl al_objitf_Destroy MO_ENGINE +delete ALImpl +[Endtest] + +[Test] +title 21.23 RadioItf Set Invalid Freq Range +create openmaxaltestmodule ALImpl +ALImpl al_createEngine 1 1 0 0 +ALImpl al_objitf_Realize MO_ENGINE XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface MO_ENGINE XA_IID_ENGINE +ALImpl al_engitf_CreateRadioDevice 0 +ALImpl al_objitf_Realize MO_RADIO XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface MO_RADIO XA_IID_RADIO +ALImpl al_radioitf_RegisterRadioCallback + + +ALImpl al_SetDataLocator 3 5 0 1 +ALImpl al_SetDataSource 3 0 1 +ALImpl al_SetDataSink 3 6 1 + +ALImpl al_engitf_CreateMediaPlayer 0 + +ALImpl al_objitf_Realize MO_PLAYER XA_BOOLEAN_FALSE +ALImpl al_objitf_GetInterface 4 XA_IID_PLAY +ALImpl al_playitf_RegisterCallback + +//request Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED +allownextresult 2 +ALImpl al_radioitf_SetFreqRange 50 +//wait Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED +//release Event_XA_RADIO_EVENT_FREQUENCY_RANGE_CHANGED + + +ALImpl al_objitf_Destroy MO_RADIO +ALImpl al_objitf_Destroy MO_PLAYER +ALImpl al_objitf_Destroy MO_ENGINE +delete ALImpl +[Endtest] \ No newline at end of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/inc/openmaxaltestmodule.h --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/inc/openmaxaltestmodule.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/inc/openmaxaltestmodule.h Fri Jul 09 16:43:35 2010 -0500 @@ -370,6 +370,9 @@ virtual TInt al_radioitf_Seek(CStifItemParser& aItem ); virtual TInt al_radioitf_StopSeeking(CStifItemParser& aItem ); virtual TInt al_radioitf_RegisterRadioCallback(CStifItemParser& aItem ); + virtual TInt al_radioitf_GetFrequencyDefault( CStifItemParser& aItem); + virtual TInt al_radioitf_GetFreqRangeDefault( CStifItemParser& aItem ); + virtual TInt al_strminfoitf_QueryMediaContainerInformation( CStifItemParser& aItem ); virtual TInt al_strminfoitf_QueryStreamType( CStifItemParser& aItem ); virtual TInt al_strminfoitf_QueryStreamInformation( CStifItemParser& aItem ); diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/common/openmaxaltestmoduleblocks.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -248,11 +248,13 @@ /*RadioItf begins*/ ENTRY( "al_radioitf_SetFreqRange", COpenMAXALTestModule::al_radioitf_SetFreqRange ), ENTRY( "al_radioitf_GetFreqRange", COpenMAXALTestModule::al_radioitf_GetFreqRange ), + ENTRY( "al_radioitf_GetFreqRangeDefault", COpenMAXALTestModule::al_radioitf_GetFreqRangeDefault ), ENTRY( "al_radioitf_IsFreqRangeSupported", COpenMAXALTestModule::al_radioitf_IsFreqRangeSupported ), ENTRY( "al_radioitf_GetFreqRangeProperties", COpenMAXALTestModule::al_radioitf_GetFreqRangeProperties ), ENTRY( "al_radioitf_SetFrequency", COpenMAXALTestModule::al_radioitf_SetFrequency ), ENTRY( "al_radioitf_CancelSetFrequency", COpenMAXALTestModule::al_radioitf_CancelSetFrequency ), ENTRY( "al_radioitf_GetFrequency", COpenMAXALTestModule::al_radioitf_GetFrequency ), + ENTRY( "al_radioitf_GetFrequencyDefault", COpenMAXALTestModule::al_radioitf_GetFrequencyDefault ), ENTRY( "al_radioitf_SetSquelch", COpenMAXALTestModule::al_radioitf_SetSquelch ), ENTRY( "al_radioitf_GetSquelch", COpenMAXALTestModule::al_radioitf_GetSquelch ), ENTRY( "al_radioitf_SetStereoMode", COpenMAXALTestModule::al_radioitf_SetStereoMode ), diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp --- a/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmmw_plat/openmax_al_api/tsrc/openmaxaltestmodule/src/radio/openmaxalradioitftests.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -227,6 +227,36 @@ } return status; } + +TInt COpenMAXALTestModule::al_radioitf_GetFrequencyDefault( CStifItemParser& aItem) + { + TInt status(KErrCompletion); + XAuint32 freq; + + if (m_RadioItf) + { + status = (*m_RadioItf)->GetFrequency( + m_RadioItf, &freq); + } + return status; + } + +TInt COpenMAXALTestModule::al_radioitf_GetFreqRangeDefault( CStifItemParser& aItem ) + { + TInt status(KErrCompletion); + XAuint8 freqRange; + + if (m_RadioItf) + { + status = (*m_RadioItf)->GetFreqRange( + m_RadioItf, &freqRange); + } + else + { + status = KErrNotFound; + } + return status; + } TInt COpenMAXALTestModule::al_radioitf_RegisterRadioCallback( CStifItemParser& /*aItem*/ ) { diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/progressive_download_api/group/bld.inf --- a/mmmw_plat/progressive_download_api/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,34 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: File that exports the files belonging to -: Progressive Download API -* -*/ - - -#include - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -#ifdef __SERIES60_NATIVE_BROWSER -#ifdef RD_PROGDOWNLOAD -../inc/MAudioPlayUtility.h MW_LAYER_PLATFORM_EXPORT_PATH(MAudioPlayUtility.h) -../inc/ProgressiveDownloadUtility.h MW_LAYER_PLATFORM_EXPORT_PATH(ProgressiveDownloadUtility.h) -../inc/MProgressiveDownloadUtility.h MW_LAYER_PLATFORM_EXPORT_PATH(MProgressiveDownloadUtility.h) -../inc/MAudioPdPlayUtility.h MW_LAYER_PLATFORM_EXPORT_PATH(MAudioPdPlayUtility.h) -#endif -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/progressive_download_api/inc/MAudioPdPlayUtility.h --- a/mmmw_plat/progressive_download_api/inc/MAudioPdPlayUtility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,50 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Interface definition for the ProgressiveDownloadUtility functions. -* -*/ - - -#ifndef __MAUDIOPDPLAYUTILITY_H__ -#define __MAUDIOPDPLAYUTILITY_H__ - -#include -#include -#include "MProgressiveDownloadUtility.h" -#include "MAudioPlayUtility.h" - - - - -class MAudioPdPlayUtilityCallback: public MProgressiveDownloadUtilityCallback, - public MMdaAudioPlayerCallback - { - public: - virtual void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue)=0; - - }; - -class MAudioPdPlayUtility:public MProgessiveDownloadUtility, - public MAudioPlayUtility - { - public: - virtual ~MAudioPdPlayUtility(){}; - - }; - - - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/progressive_download_api/inc/MAudioPlayUtility.h --- a/mmmw_plat/progressive_download_api/inc/MAudioPlayUtility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,77 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Interface definition for the ProgressiveDownloadUtility functions. -* -*/ - - - -#ifndef __MAUDIOPLAYUTILITY_H__ -#define __MAUDIOPLAYUTILITY_H__ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -class MAudioPlayUtility - { - public: - - virtual void Play()=0; - virtual void Stop()=0; - virtual TInt Pause()=0; - virtual void SetVolume(TInt aVolume)=0; - virtual void SetRepeats(TInt aRepeatNumberOfTimes, const TTimeIntervalMicroSeconds& aTrailingSilence)=0; - virtual void SetVolumeRamp(const TTimeIntervalMicroSeconds& aRampDuration)=0; - virtual const TTimeIntervalMicroSeconds& Duration()=0; - virtual TInt MaxVolume()=0; - virtual void Close()=0; - virtual TInt GetPosition(TTimeIntervalMicroSeconds& aPosition)=0; - virtual void SetPosition(const TTimeIntervalMicroSeconds& aPosition)=0; - - virtual TInt SetPriority(TInt aPriority, TMdaPriorityPreference aPref)=0; - virtual TInt GetVolume(TInt& aVolume)=0; - virtual TInt GetNumberOfMetaDataEntries(TInt& aNumEntries)=0; - virtual CMMFMetaDataEntry* GetMetaDataEntryL(TInt aMetaDataIndex)=0; - virtual TInt SetPlayWindow(const TTimeIntervalMicroSeconds& aStart, - const TTimeIntervalMicroSeconds& aEnd)=0; - virtual TInt ClearPlayWindow()=0; - virtual TInt SetBalance(TInt aBalance = KMMFBalanceCenter)=0; - virtual TInt GetBalance(TInt& aBalance)=0; - virtual TInt GetBitRate(TUint& aBitRate)=0; - - virtual void RegisterForAudioLoadingNotification(MAudioLoadingObserver& aCallback)=0; - virtual void GetAudioLoadingProgressL(TInt& aPercentageProgress)=0; - virtual const CMMFControllerImplementationInformation& ControllerImplementationInformationL()=0; - - virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom)=0; - virtual TInt CustomCommandSync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2)=0; - virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TDes8& aDataFrom, TRequestStatus& aStatus)=0; - virtual void CustomCommandAsync(const TMMFMessageDestinationPckg& aDestination, TInt aFunction, const TDesC8& aDataTo1, const TDesC8& aDataTo2, TRequestStatus& aStatus)=0; - - - virtual MMMFDRMCustomCommand* GetDRMCustomCommand()=0; - - - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/progressive_download_api/inc/MProgressiveDownloadUtility.h --- a/mmmw_plat/progressive_download_api/inc/MProgressiveDownloadUtility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Interface definition for the ProgressiveDownloadUtility functions. -* -*/ - - - -#ifndef __MPROGRESSIVEDOWNLOADUTILITY_H__ -#define __MPROGRESSIVEDOWNLOADUTILITY_H__ - - -#include - - -class MProgessiveDownloadUtility//:public MBrCtlDownloadObserver - { - public: - virtual void HandleDownloadEventL(TUint aTransactionID, - TBrCtlDownloadEvent aEvent, - TUint aValue)=0; - }; - - -class MProgressiveDownloadUtilityCallback - { - public: - virtual void Paused()=0; - virtual void Playing()=0; - - }; - - -#endif \ No newline at end of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/progressive_download_api/inc/ProgressiveDownloadUtility.h --- a/mmmw_plat/progressive_download_api/inc/ProgressiveDownloadUtility.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,88 +0,0 @@ -/* -* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Class definition for the ProgressiveDownloadUtility functions. -* -*/ - -#ifndef __CPROGRESSIVEDOWNLOADUTILITY_H__ -#define __CPROGRESSIVEDOWNLOADUTILITY_H__ - -#include -#include -#include - - -//Forward Declaration -class MAudioPdPlayUtility; -class MAudioPdPlayUtilityCallback; -class CPdProperties; - - -// CLASS DEFINITIONS - -/** -* This class provides Progressive download utility functions. -* -* @lib ProgressiveDownloadUtility.lib -* @since 3.0 -*/ -class CProgressiveDownloadUtility: public CBase - { - -public: - /** - * Two-phased constructor. - */ - IMPORT_C static CProgressiveDownloadUtility* NewL(); - - /** - * Destructor. - */ - IMPORT_C virtual ~CProgressiveDownloadUtility(); - - /** - * From CProgressiveDownloadUtility - * @param aFileName - * @param aCallback - * @return MAudioPdPlayUtility* - */ - IMPORT_C MAudioPdPlayUtility* OpenL(const TDesC& aFileName,MAudioPdPlayUtilityCallback& aCallback); - - /** - * From CProgressiveDownloadUtility - * @param aFileHandle - * @param aCallback - * @return MAudioPdPlayUtility* - */ - IMPORT_C MAudioPdPlayUtility* OpenL(const RFile& aFileHandle,MAudioPdPlayUtilityCallback& aCallback); - -protected: - - -private: - /** - * C++ default constructor. - */ - CProgressiveDownloadUtility(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - - CPdProperties* iProperties; - - }; - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmmw_plat/progressive_download_api/progressive_download_api.metaxml --- a/mmmw_plat/progressive_download_api/progressive_download_api.metaxml Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ - - - Progressive Download API - An API for playing back an audio file that is currently being downloaded. - c++ - audioenhancements - - - - - - - - - no - no - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/bwinscw/EqualizerU.DEF --- a/mmserv/audioeffectsui/equalizer/bwinscw/EqualizerU.DEF Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,5 +0,0 @@ -EXPORTS - ?ExecuteLD@CEqualizerPresetsDialog@@QAEHXZ @ 1 NONAME ; int CEqualizerPresetsDialog::ExecuteLD(void) - ?NewL@CEqualizerPresetsDialog@@SAPAV1@PAVCAudioEqualizerUtility@@HAAVMEqualizerPresetActivationObserver@@@Z @ 2 NONAME ; class CEqualizerPresetsDialog * CEqualizerPresetsDialog::NewL(class CAudioEqualizerUtility *, int, class MEqualizerPresetActivationObserver &) - ?SetAudioEqualizerL@CEqualizerPresetsDialog@@QAEXPAVCAudioEqualizerUtility@@@Z @ 3 NONAME ; void CEqualizerPresetsDialog::SetAudioEqualizerL(class CAudioEqualizerUtility *) - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/data/Equalizer.rss --- a/mmserv/audioeffectsui/equalizer/data/Equalizer.rss Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,447 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RSS for Equalizer -* -*/ - - - -// RESOURCE IDENTIFIER -NAME EQUI // 4 letter ID - -// INCLUDES -#include -#include -#include -#include -#include - -#include "Equalizer.rh" -#include "Equalizer.hrh" -#include - - -// CONSTANTS -// EqualizerEngine has a limit of 32 characters for the preset name -#define KMaxPresetNameLength 32 -// MACROS - -// RESOURCE DEFINITIONS - -RESOURCE RSS_SIGNATURE { } - -RESOURCE TBUF { buf=""; } - -RESOURCE CBA r_equalizer_softkeys_options_back__select - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeySelect; txt=qtn_msk_eq_activate;} - }; - } - -RESOURCE CBA r_equalizer_softkeys_options_back__contextoptions - { - buttons = - { - CBA_BUTTON {id=EAknSoftkeyOptions; txt = text_softkey_option;}, - CBA_BUTTON {id=EAknSoftkeyBack; txt = text_softkey_back; }, - CBA_BUTTON {id=EAknSoftkeyContextOptions; txt = text_softkey_option;} - }; - } - -RESOURCE EIK_APP_INFO - { - menubar=r_equalizer_container_menubar; - cba=R_AVKON_SOFTKEYS_OPTIONS_BACK; - } - -//---------------------------------------------------- -// -// r_equalizer_container_menubar -// This resource is used to create the Equalizer -// listbox view menubar -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_equalizer_container_menubar - { - titles= - { - MENU_TITLE { menu_pane=r_equalizer_container_menu; txt=""; } - }; - } - -//---------------------------------------------------- -// -// r_equalizer_container_menu -// This resource is used to create the equalizer -// menu items -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_equalizer_container_menu - { - items= - { - MENU_ITEM { command=EEqualizerCmdActivate; - txt=qtn_eq_options_activate; -#ifdef SINGLE_CLICK_INCLUDED - flags = EEikMenuItemAction; -#endif - }, - MENU_ITEM { command=EEqualizerCmdEdit; txt=qtn_eq_options_edit; -#ifdef SINGLE_CLICK_INCLUDED - flags = EEikMenuItemSpecific; -#endif - }, - MENU_ITEM { command=EEqualizerCmdCreateNew; - txt=qtn_eq_options_create_new;}, - MENU_ITEM { command=EEqualizerCmdDelete; txt=qtn_eq_options_delete;}, - MENU_ITEM { command=EEqualizerCmdRename; txt=qtn_eq_options_rename;}, - MENU_ITEM {command = EEqualizerCmdHelp; txt=qtn_options_help;}, - MENU_ITEM { command = EAknCmdExit ; txt=qtn_options_exit;} - }; - } - -//---------------------------------------------------- -// -// r_equalizer_settings_menubar -// This resource is used to create the Equalizer -// frequency bands view menubar -// -//---------------------------------------------------- -// -RESOURCE MENU_BAR r_equalizer_settings_menubar - { - titles= - { - MENU_TITLE { menu_pane=r_equalizer_settings_menu; txt=""; } - }; - } - -//---------------------------------------------------- -// -// r_equalizer_settings_menu -// This resource is used to create the equalizer -// frequency bands view menu items -// -//---------------------------------------------------- -// -RESOURCE MENU_PANE r_equalizer_settings_menu - { - items= - { - MENU_ITEM { command=EEqualizerCmdReset; txt=qtn_eq_options_reset;}, - MENU_ITEM {command = EEqualizerCmdHelp; txt=qtn_options_help;}, - MENU_ITEM { command = EAknCmdExit ; txt=qtn_options_exit;} - }; - } - -// --------------------------------------------------------- -// -// r_equalizer_editing_dialog -// Dialog used for the equalizer editing view -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_equalizer_editing_dialog - { - flags = EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | - EEikDialogFlagWait| EEikDialogFlagFillAppClientRect; - - buttons = r_equalizer_softkeys_options_back__contextoptions; - - items = - { - DLG_LINE - { - id = EEqualizerCustomCtrlDlgCIdCustomControl; - type = EEqualizerCustomCtrlDlgCtCustomControl; - control=EQUALIZER_CONTROL - { - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_equalizer_dialog -// Dialog used for the equalizer preset view -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_equalizer_dialog - { - flags = EEikDialogFlagNoDrag | EEikDialogFlagCbaButtons | - EEikDialogFlagWait| EEikDialogFlagFillAppClientRect | EEikDialogFlagNotifyEsc; - title = qtn_eq_title_equalizer; - buttons = r_equalizer_softkeys_options_back__select; - - items = - { - DLG_LINE - { - type = EAknCtSingleGraphicListBox; - id = ESelectionListControl; - control = LISTBOX - { - flags = EAknListBoxSelectionList; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_dialog_text_rename_item_name -// Dialog for the name of a to be renamed item -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_dialog_text_rename_item_name - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = qtn_fldr_item_name_prmpt; - control = EDWIN - { - flags = EEikEdwinNoLineOrParaBreaks; - maxlength = KMaxPresetNameLength; - }; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_dialog_text_new_item_name -// Dialog for the name of a new item -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_dialog_text_new_item_name - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_OK_CANCEL; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_DATA_QUERY - { - layout = EDataLayout; - label = qtn_eq_title_preset_name; - control = EDWIN - { - flags = EEikEdwinNoLineOrParaBreaks; - maxlength = KMaxPresetNameLength; - }; - }; - } - }; - } - -// --------------------------------------------------------- -// -// r_equalizer_confirmation_query -// For delete confirmation -// -// --------------------------------------------------------- -// -RESOURCE DIALOG r_equalizer_confirmation_query - { - flags = EGeneralQueryFlags; - buttons = R_AVKON_SOFTKEYS_YES_NO; - items = - { - DLG_LINE - { - type = EAknCtQuery; - id = EGeneralQuery; - control = AVKON_CONFIRMATION_QUERY - { - layout = EConfirmationLayout; - }; - } - }; - } - -// --------------------------------------------------- -// -// r_qtn_equalizer_title_text -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_equalizer_title_text - { - buf = qtn_eq_title_equalizer; - } - -// --------------------------------------------------- -// -// r_qtn_eq_preset_default_name -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_eq_preset_default_name - { - buf = qtn_eq_preset_default_name; - } - -// --------------------------------------------------- -// -// r_eq_note_info_preset_activated -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_eq_note_info_preset_activated - { - buf = qtn_eq_note_info_preset_activated; - } - -// --------------------------------------------------- -// -// r_qtn_eq_note_err_preset_in_use_no_rename -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_eq_note_err_preset_in_use_no_rename - { - buf = qtn_eq_note_err_preset_in_use_no_rename; - } - -// --------------------------------------------------- -// -// r_eq_note_err_preset_in_use -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_eq_note_err_preset_in_use - { - buf = qtn_eq_note_err_preset_in_use; - } - -// --------------------------------------------------- -// -// r_qtn_query_common_conf_delete -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_query_common_conf_delete - { - buf = qtn_query_common_conf_delete; - } - -// --------------------------------------------------- -// -// r_qtn_fldr_illegal_characters -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_fldr_illegal_characters - { - buf = qtn_fldr_illegal_characters; - } - -// --------------------------------------------------- -// -// r_qtn_fldr_name_already_used -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_fldr_name_already_used - { - buf = qtn_fldr_name_already_used; - } - -// --------------------------------------------------- -// -// r_qtn_equalizer_preset_none -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_equalizer_preset_none - { - buf = qtn_eq_preset_none; - } - -// --------------------------------------------------- -// -// r_qtn_memlo_not_enough_memory -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_memlo_not_enough_memory - { - buf = qtn_memlo_not_enough_memory; - } - -// --------------------------------------------------- -// -// r_qtn_eq_preset_frequency_hz -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_eq_preset_frequency_hz - { - buf= qtn_eq_preset_frequency_hz; - } - -// --------------------------------------------------- -// -// r_qtn_eq_preset_frequency_khz -// -// --------------------------------------------------- -// -RESOURCE TBUF r_qtn_eq_preset_frequency_khz - { - buf= qtn_eq_preset_frequency_khz; - } - -// --------------------------------------------------------- -// -// r_equalizer_predefined_presets -// Predefined preset names with localised names -// -// --------------------------------------------------------- -// -RESOURCE ARRAY r_equalizer_predefined_presets - { - items= - { - LBUF { txt = "Rock""\t"qtn_eq_preset_rock; }, - LBUF { txt = "Pop""\t"qtn_eq_preset_pop; }, - LBUF { txt = "Jazz""\t"qtn_eq_preset_jazz; }, - LBUF { txt = "Classic""\t"qtn_eq_preset_classic; }, - LBUF { txt = "Bass Booster""\t"qtn_eq_preset_bassboost; } - }; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/eabi/EqualizerU.DEF --- a/mmserv/audioeffectsui/equalizer/eabi/EqualizerU.DEF Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,7 +0,0 @@ -EXPORTS - _ZN23CEqualizerPresetsDialog18SetAudioEqualizerLEP22CAudioEqualizerUtility @ 1 NONAME - _ZN23CEqualizerPresetsDialog4NewLEP22CAudioEqualizerUtilityiR34MEqualizerPresetActivationObserver @ 2 NONAME - _ZN23CEqualizerPresetsDialog9ExecuteLDEv @ 3 NONAME - _ZTI23CEqualizerPresetsDialog @ 4 NONAME ; ## - _ZTV23CEqualizerPresetsDialog @ 5 NONAME ; ## - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/group/Equalizer.mmp --- a/mmserv/audioeffectsui/equalizer/group/Equalizer.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Project file for Equalizer DLL -* -*/ - - - - -#include -#include -#include -#include "../../inc/audioeffectsuibldvariant.hrh" - -TARGET Equalizer.dll -TARGETTYPE dll -UID 0x1000008d 0x101FD659 - -CAPABILITY CAP_GENERAL_DLL -VENDORID VID_DEFAULT - -#ifdef IAD_INCLUDE_SINGLE_CLICK -MACRO SINGLE_CLICK_INCLUDED -#endif - -SOURCEPATH ../src -SOURCE EqualizerMain.cpp -SOURCE EqualizerPresetsDialog.cpp -SOURCE EqualizerFreqBandContainer.cpp -SOURCE EqualizerPresetListArray.cpp -SOURCE EqualizerFreqBand.cpp -SOURCE EqualizerEditingDialog.cpp - -USERINCLUDE ../inc -USERINCLUDE ../../../inc - -MW_LAYER_SYSTEMINCLUDE -SYSTEMINCLUDE /epoc32/include/mmf/server -SYSTEMINCLUDE /epoc32/include/mmf/common -SYSTEMINCLUDE /epoc32/include/app // temporary fix build break on header relocation change - -SOURCEPATH ../data -START RESOURCE Equalizer.rss -HEADER -TARGETPATH APP_RESOURCE_DIR -LANGUAGE_IDS -END // RESOURCE - -LIBRARY euser.lib -LIBRARY apparc.lib -LIBRARY cone.lib -LIBRARY eikcore.lib -LIBRARY eikcoctl.lib -LIBRARY avkon.lib -LIBRARY estor.lib -LIBRARY bafl.lib -LIBRARY commonengine.lib -LIBRARY eikctl.lib -LIBRARY eikcdlg.lib -LIBRARY eikdlg.lib -LIBRARY fbscli.lib -LIBRARY ws32.lib -LIBRARY efsrv.lib -LIBRARY audioequalizerutility.lib -LIBRARY audioequalizereffect.lib -LIBRARY CdlEngine.lib -LIBRARY AknSkins.lib -LIBRARY egul.lib -LIBRARY AknLayout2Scalable.lib -LIBRARY AknIcon.lib -LIBRARY hlplch.lib // for "Help" options menu -LIBRARY featmgr.lib -LIBRARY aknnotify.lib -LIBRARY SysUtil.lib -LIBRARY aknlayout2.lib -LIBRARY centralrepository.lib -#if defined(RD_TACTILE_FEEDBACK) -LIBRARY touchfeedback.lib -#endif - -#if defined(ARMCC) -deffile ../eabi/ -#elif defined(WINSCW) -deffile ../bwinscw/ -#elif defined(WINS) -deffile ../bwins/ -#else -deffile ../bmarm/ -#endif - -//LANG SC - -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/group/EqualizerIcons.txt --- a/mmserv/audioeffectsui/equalizer/group/EqualizerIcons.txt Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -/c8,8 empty13x13 -/c8,8 qgn_prop_psln_active -/c8,8 qgn_indi_mup_eq_bg -/c8,8 qgn_indi_mup_eq_slider diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/group/EqualizerIcons2.txt --- a/mmserv/audioeffectsui/equalizer/group/EqualizerIcons2.txt Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,4 +0,0 @@ -/c8,8 empty13x13 -/c8,8 qgn_prop_psln_active -/c8,8 qgn_indi_mup2_eq_bg -/c8,8 qgn_indi_mup_eq_slider diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/group/bld.inf --- a/mmserv/audioeffectsui/equalizer/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file provides the information required for building the -* implementation collection. -* -*/ - - - - -#include - -#include "../help/group/bld.inf" - -PRJ_PLATFORMS -// specify the platforms your component needs to be built for here - -PRJ_EXPORTS -// iby file -../rom/Equalizer.iby CORE_MW_LAYER_IBY_EXPORT_PATH(Equalizer.iby) -../rom/EqualizerResources.iby LANGUAGE_MW_LAYER_IBY_EXPORT_PATH(EqualizerResources.iby) - -// loc file -../loc/equalizer.loc MW_LAYER_LOC_EXPORT_PATH(equalizer.loc) - -PRJ_EXTENSIONS -START EXTENSION s60/mifconv -OPTION TARGETFILE equalizer.mif -OPTION HEADERFILE equalizer.mbg -OPTION SOURCES -c8,8 empty13x13 -c8,8 qgn_prop_psln_active \ - -c8,8 qgn_indi_mup2_eq_bg -c8,8 qgn_indi_mup_eq_slider -END - -PRJ_MMPFILES -// Specify the .mmp files required for building the important component -// releasables. Note that you should specify any .mmp files for test -// programs further down the file. - - -Equalizer.mmp - - -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/group/icons.mk --- a/mmserv/audioeffectsui/equalizer/group/icons.mk Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -# -# Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: This file is used to invoke "mifconv" tool to -# generate mbm and mif files -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\equalizer.mif - -HEADERDIR=\epoc32\include -HEADERFILENAME=$(HEADERDIR)\equalizer.mbg - -ICONLISTFILE=..\Group\EqualizerIcons2.txt - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- -# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by -# MifConv if the mask detph is defined. -# -# NOTE 2: Usually, source paths should not be included in the bitmap -# definitions. MifConv searches for the icons in all icon directories in a -# predefined order, which is currently \s60\icons, \s60\bitmaps2. -# The directory \s60\icons is included in the search only if the feature flag -# __SCALABLE_ICONS is defined. -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) /f$(ICONLISTFILE) - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/group/icons_dc.mk --- a/mmserv/audioeffectsui/equalizer/group/icons_dc.mk Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -# -# Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: This file is used to invoke "mifconv" tool to -# generate mbm and mif files -# - -ifeq (WINS,$(findstring WINS, $(PLATFORM))) -ZDIR=\epoc32\release\$(PLATFORM)\$(CFG)\Z -else -ZDIR=\epoc32\data\z -endif - -TARGETDIR=$(ZDIR)\resource\apps -ICONTARGETFILENAME=$(TARGETDIR)\equalizer.mif - -HEADERDIR=\epoc32\include -HEADERFILENAME=$(HEADERDIR)\equalizer.mbg - -ICONLISTFILE=..\Group\EqualizerIcons.txt - -do_nothing : - @rem do_nothing - -MAKMAKE : do_nothing - -BLD : do_nothing - -CLEAN : do_nothing - -LIB : do_nothing - -CLEANLIB : do_nothing - -# ---------------------------------------------------------------------------- -# NOTE 1: DO NOT DEFINE MASK FILE NAMES! They are included automatically by -# MifConv if the mask detph is defined. -# -# NOTE 2: Usually, source paths should not be included in the bitmap -# definitions. MifConv searches for the icons in all icon directories in a -# predefined order, which is currently \s60\icons, \s60\bitmaps2. -# The directory \s60\icons is included in the search only if the feature flag -# __SCALABLE_ICONS is defined. -# ---------------------------------------------------------------------------- - -RESOURCE : - mifconv $(ICONTARGETFILENAME) /h$(HEADERFILENAME) /f$(ICONLISTFILE) - -FREEZE : do_nothing - -SAVESPACE : do_nothing - -RELEASABLES : - @echo $(HEADERFILENAME)&& \ - @echo $(ICONTARGETFILENAME) - -FINAL : do_nothing - - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/help/data/xhtml.zip Binary file mmserv/audioeffectsui/equalizer/help/data/xhtml.zip has changed diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/help/group/bld.inf --- a/mmserv/audioeffectsui/equalizer/help/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,26 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - Initial contribution -* -* Contributors: -* -* -* Description: -* Export help related files. -* -*/ - -#include -PRJ_EXPORTS -:zip ../data/xhtml.zip /epoc32/data/z/resource/ overwrite -:zip ../data/xhtml.zip /epoc32/winscw/c/resource/ overwrite - -../inc/eq.hlp.hrh MW_LAYER_PLATFORM_EXPORT_PATH(csxhelp/eq.hlp.hrh) -../rom/equalizerhelps_variant.iby CUSTOMER_APP_LAYER_IBY_EXPORT_PATH(equalizerhelps_variant.iby) diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/help/inc/eq.hlp.hrh --- a/mmserv/audioeffectsui/equalizer/help/inc/eq.hlp.hrh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,28 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: -* -*/ - -// -// eq.hlp.hrh generated by CSXHelp Utilities. -// - -#ifndef __EQ_HLP_HRH__ -#define __EQ_HLP_HRH__ - -_LIT(KEQ_HLP_EDITING_VIEW, "EQ_HLP_EDITING_VIEW"); // -_LIT(KEQ_HLP_LIST_VIEW, "EQ_HLP_LIST_VIEW"); // - -#endif \ No newline at end of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/help/rom/equalizerhelps_variant.iby --- a/mmserv/audioeffectsui/equalizer/help/rom/equalizerhelps_variant.iby Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Help IBY file -* -*/ - - -#ifndef __EQUALIZERHELPS_VARIANT_IBY__ -#define __EQUALIZERHELPS_VARIANT_IBY__ - -#if defined(FF_S60_HELPS_IN_USE) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FD659\contents.zip, RESOURCE_FILES_DIR\xhtml\%02d\0x101FD659\contents.zip) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FD659\index.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101FD659\index.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FD659\keywords.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101FD659\keywords.xml) - data=LOCALISE(DATAZ_\resource\xhtml\%02d\0x101FD659\meta.xml, RESOURCE_FILES_DIR\xhtml\%02d\0x101FD659\meta.xml) -#endif - -#endif \ No newline at end of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/Equalizer.hrh --- a/mmserv/audioeffectsui/equalizer/inc/Equalizer.hrh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,70 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains declarations for constants of Equalizer -* -*/ - - - -#ifndef EQUALIZER_HRH -#define EQUALIZER_HRH - -// DATA TYPES - -// Used as Command ids for menubar -enum TEqualizerCommandIds - { - EEqualizerCmdActivate = 1, - EEqualizerCmdEdit, - EEqualizerCmdCreateNew, - EEqualizerCmdDelete, - EEqualizerCmdRename, - EEqualizerCmdHelp, - EEqualizerCmdReset - }; - -// Used for custom Control Id and type -enum TEqualizerCustomControlIds - { - EEqualizerCustomCtrlDlgCIdCustomControl = 1000, - EEqualizerCustomCtrlDlgCtCustomControl - }; - -//Used for the equalizer varieties -enum TEqualizerVarieties - { - EEqualizerVarietyNotUsed = -1, - EEqualizerVarietyOne = 0, - EEqualizerVarietyTwo - }; - -//Used for retriving the rect from the layout information -enum TEqualizerComponents - { - EEqualizerFreqBand1 = 0, - EEqualizerFreqBand2, - EEqualizerFreqBand3, - EEqualizerFreqBand4, - EEqualizerFreqBand5, - EEqualizerFreqBand6, - EEqualizerFreqBand7, - EEqualizerFreqBand8, - EEqualizerMainPane, - EEqualizerScale, - EEqualizerBackground, - EEqualizerSlider - }; - -#endif //EQUALIZER_HRH -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/Equalizer.rh --- a/mmserv/audioeffectsui/equalizer/inc/Equalizer.rh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RH for storing Custom Control parameters struct -* -*/ - - - - -#ifndef EQUALIZER_RH -#define EQUALIZER_RH - -STRUCT EQUALIZER_CONTROL - { - } - -#endif //EQUALIZER_RH - -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/EqualizerEditingDialog.h --- a/mmserv/audioeffectsui/equalizer/inc/EqualizerEditingDialog.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,194 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declares classes related to Equalizer Settings -* -*/ - - - - -#ifndef EQUALIZEREDITINGDIALOG_H -#define EQUALIZEREDITINGDIALOG_H - -// INCLUDES -#include -#include "EqualizerPrivateConstants.h" - -#include "EqualizerPresetsDialog.h" -// FORWARD DECLARATIONS -class CAudioEqualizerUtility; -class CEqualizerFreqBandContainer; - -// CLASS DECLARATIONS -NONSHARABLE_CLASS(CEqualizerEditingDialog) : public CAknDialog - { - public: // Constructors and destructor - - /** - * This function is called to create an object of - * type CEqualizerPresetsDialog - Two phase Construction - * @since 3.0 - * @param aAudEqUtility a pointer to CAudioEqualizerUtility - * @param aPresetIndex the index into the preset array retrieved - * with the method CAudioEqualizerUtility::Presets() - * @param aRect a reference to the view rectangle - * returned by CAudioEqualizerUtility::Presets() - * @param aIsPresetActive whether the preset is active or not? - */ - static CEqualizerEditingDialog* NewL( - CAudioEqualizerUtility* aAudEqUtility,const TInt aPresetIndex, - TRect& aRect, const TBool aIsPresetActive, - MEqualizerPresetActivationObserver& aObs, - TInt aPresetKey); - /** - * Destructor - * @since 3.0 - */ - virtual ~CEqualizerEditingDialog(); - - public: // New functions - /** - * This function is used to execute the Dialog. - * @since 3.0 - * @returns return value of CAknDialog::ExecuteLD() - */ - TInt ExecuteLD(); - /** - * This function is used to read the positions of the mover for the - * frequency bands from the engine. - * @since 3.0 - * @param aReset Whether the preset is being reset - */ - void SetMoverPositionsL(TBool aReset); - - /** - * This function is used to set new values for CAudioEqualizerUtility* - * @since 3.0 - * @param aAudEqUtility New pointer to CAudioEqualizerUtility - */ - void SetAudioEqualizerL(CAudioEqualizerUtility* aAudEqUtility); - - /** - * This function is used to return current mover position for each frequence band - * @since 3.0 - * @param aBandIndex Frequence band index for which mover position is required - * @returns current mover position - */ - TInt GetMoverPosition(TInt aBandIndex); - - private: - /** - * First Phase Constructor - * @since 3.0 - * @param aAudEqUtility a pointer to CAudioEqualizerUtility - * @param aPresetIndex the index into the preset array retrieved - * with the method CAudioEqualizerUtility::Presets() - * @param aRect a reference to the view rectangle - * returned by CAudioEqualizerUtility::Presets() - * @param aIsPresetActive whether the preset is active or not? - */ - CEqualizerEditingDialog(CAudioEqualizerUtility* aAudEqUtility, - const TInt aPresetIndex, TRect& aRect, - const TBool aIsPresetActive, - MEqualizerPresetActivationObserver& aObs, - TInt aPresetKey); - - /** - * Second Phase Constructor - * @since 3.0 - */ - void ConstructL(); - - private: // Functions from base classes - /** - * From CAknDialog Called when a key event happens. - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, - TEventCode aType ); - /** - * From CAknDialog Called just before the menu pane is displayed - */ - void DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane); - /** - * From CAknDialog Called just before the menu pane is displayed - */ - void ProcessCommandL(TInt aCommandId); - /** - * From CAknDialog Called when OK key is pressed - */ - TBool OkToExitL(TInt aButtonId); - /** - * From CAknDialog Called when a custom control is to be created - */ - SEikControlInfo CreateCustomControlL ( TInt aControlType ); - - /** - * From CAknDialog - * This function will respond to any change in the controls size. - */ - void SizeChanged(); - /** - * Get help context for the control. - * @param aContext The context that is filled in. - * @return None. - */ - void GetHelpContext( TCoeHelpContext& aContext ) const; - - /** - * This function is called to retrieve the rectangle - * of the freq band control, scale and slider from the layout - */ - void GetLayoutRect(); - - private: - // Used to store a pointer to CAudioEqualizerUtility - CAudioEqualizerUtility* iAudEqUtility; - // Used to store a pointer to CEqualizerFreqBandContainer - CEqualizerFreqBandContainer* iFreqBandContainer; - // Used to store the preset name - TPresetName iPresetName; - // The index of the preset in the array returned by - // CAudioEqualizerUtility::Presets() - const TInt iPresetIndex; - // The rectangle in which the Dialog is displayed - TRect& iRect; - // Whether the preset displayed is an active preset? - const TBool iIsActivePreset; - // Used to store the offset of the resource file - TInt iResourceFileOffset; - // Stores the positions of the movers in the various bands. - CArrayFix* iMover; - // Number of Frequency bands - TUint iNumberOfFreqBands; - // Ignore Key events between track changes - TBool iIgnoreKeyEvents; - // Array to store the rects of the freq band - RArray iFreqBandRect; - // Array to store the rects of the freq band scale - RArray iScaleRect; - // Array to store the rects of the background - RArray iBackgroundRect; - // Array to store the rects of the slider - RArray iSliderRect; - // Used to determine if context sensitive menu is ON or not when pressing MSK - TBool iContextSensitiveMenu; - - // Observer for changing presets - MEqualizerPresetActivationObserver& iObserver; - TInt iPresetKey; - }; - -#endif //EQUALIZEREDITINGDIALOG_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/EqualizerFreqBand.h --- a/mmserv/audioeffectsui/equalizer/inc/EqualizerFreqBand.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declares classes related to Equalizer Settings -* -*/ - - - - -#ifndef EQUALIZERFREQBAND_H -#define EQUALIZERFREQBAND_H - -// INCLUDES -#include -#include "EqualizerPrivateConstants.h" - -// FORWARD DECLARATIONS -class CAudioEqualizerUtility; -class CAudioEqualizer; - -// CLASS DECLARATIONS - -NONSHARABLE_CLASS(CEqualizerFreqBand) : public CCoeControl - { - public: // Constructors and destructor - /** - * This function is called to create an object of - * type CEqualizerFreqBand - Two phase Construction - * @since 3.0 - * @param aaEqEditingDialog a reference to CEqualizerEditingDialog - * @param aAudEqUtility a reference to CAudioEqualizerUtility - * @param aPresetIndex the index of the Preset being edited - * @param aIsActivePreset whether the preset is active or not? - * @param aBandIndex the index of the Frequncy band - * @param aContainerRect the CEqualizerFreqBandContainer rectangle - */ - static CEqualizerFreqBand* NewL(CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility*& aAudEqUtility, - const TInt aPresetIndex, const TBool aIsActivePreset, const TInt aBandIndex, - TRect& aContainerRect); - /** - * This function is called to create an object of - * type CEqualizerFreqBand - Two phase Construction - * @since 3.0 - * @param aaEqEditingDialog a reference to CEqualizerEditingDialog - * @param aAudEqUtility a reference to CAudioEqualizerUtility - * @param aPresetIndex the index of the Preset being edited - * @param aIsActivePreset whether the preset is active or not? - * @param aBandIndex the index of the Frequncy band - * @param aContainerRect the CEqualizerFreqBandContainer rectangle - */ - static CEqualizerFreqBand* NewLC(CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility*& aAudEqUtility, - const TInt aPresetIndex, const TBool aIsActivePreset, const TInt aBandIndex, - TRect& aContainerRect); - /** - * Destructor - * @since 3.0 - */ - virtual ~CEqualizerFreqBand(); - - public: // Functions from base classes - /** - * From CCoeControl Called when user presses a key - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent, - TEventCode aType); - - public: - - /** - * Function to return the Rect of the controls from the - * layout [read from the CDL file]. - * TRect aRect : parent controls rect - * TInt aVariety : equalizer variety based on the number - * of frequnecy bands - * TInt aComponentNumber : Controls which are enumerated for - * which the rectangle is required from the layout - */ - static TRect ComponentRect(const TRect& aRect, TInt aVariety, - TInt aComponentNumber); - - private://Constructors - /** - * This function is called to create an object of - * type CEqualizerFreqBand - First phase Constructor - * @since 3.0 - * @param aaEqEditingDialog a reference to CEqualizerEditingDialog - * @param aAudEqUtility a reference to CAudioEqualizerUtility - * @param aPresetIndex the index of the Preset being edited - * @param aIsActivePreset whether the preset is active or not? - * @param aBandIndex the index of the Frequncy band - * @param aContainerRect the CEqualizerFreqBandContainer rectangle - */ - CEqualizerFreqBand(CEqualizerEditingDialog* aEqEditingDialog,CAudioEqualizerUtility*& aAudEqUtility, - const TInt aPresetIndex, const TBool aIsActivePreset, - const TInt aBandIndex, - TRect& aContainerRect); - - /* - * Second Phase Constructor - */ - void ConstructL(); - - private: // New functions - /** - *This function is called to load the bitmaps from the icons file - */ - void LoadBitmapsL(); - - /** - * This member is called by the Equalizer UI to update the new band - * level in the engine - * a new preset. - * @ since Series 60 3.0 - * lastIncFlag : Flag which indicates that the slider has reached the - * the limits - */ - void UpdateBandLevelInEngineL(TBool lastIncFlag); - public: // New functions - /** - * This function is used to set new values for CAudioEqualizerUtility* - * @since 3.0 - * @param aAudEqUtility New pointer to CAudioEqualizerUtility - */ - void SetAudioEqualizerL(CAudioEqualizerUtility* aAudEqUtility); - -#ifdef RD_SCALABLE_UI_V2 - /** - * This function is used by the frequency band container to send - * pointer events to individual bands - * @since 3.2 - * @param aPointerEvent pointer event - */ - void HandlePointerEventL(const TPointerEvent& aPointerEvent); -#endif //RD_SCALABLE_UI_V2 - - private: // Functions from base classes - /** - * From CCoeControl Called to draw a control - */ - void Draw(const TRect& aRect) const; - /** - * From CCoeControl Called when the control's size is changed - */ - void SizeChanged(); - /** - * From CCoeControl Called when a control's focus is changed - */ - void FocusChanged(TDrawNow aDrawNow); - - /** - * From CCoeControl - * This function is called when there is a skin change or - * change in the layout - */ - void HandleResourceChange(TInt aType); - - private: //Data - //Pointers to hold the equalizer backgroung bitmap and mask - CFbsBitmap * iBgBitmap; - CFbsBitmap * iBgBitmapMask; - - //Pointers to hold the equalizer scale bitmap and mask - CFbsBitmap * iSliderBitmap; - CFbsBitmap * iSliderBitmapMask; - - // Stores the zero position of mover - TInt iZeroPos; - // Minimum frequency band decibel level - TInt32 iMinBandLevel; - // Maximum frequency band decibel level - TInt32 iMaxBandLevel; - // Used to store a pointer to CEqualizerEditingDialog - CEqualizerEditingDialog* iEqEditingDialog; - // Used to store a pointer to CAudioEqualizerUtility - CAudioEqualizerUtility* iAudEqUtility; - // Used to store a pointer to CAudioEqualizer - CAudioEqualizer* iAudioEqualizer; - // The index of the preset in the array returned by - // CAudioEqualizerUtility::Presets() - const TInt iPresetIndex; - // Used to store the name of the preset - TPresetName iPresetName; - // Whether the preset displayed is an active preset? - const TBool iIsActivePreset; - // Index of the Frequency Band as passed to Engine - const TInt iBandIndex; - // Position of the mover - TInt iMoverPos; - //Stores the container's rect value - TRect& iContainerRect; - //Stores the freq band Scale's rectangle - TRect iScaleRect; - //Stores the slider's rectangle - TRect iSliderRect; - //Stores the background rectangle - TRect iBackgroundRect; - //Stores the step count of the slider - TInt32 iStepCount; - }; - - -#endif //EQUALIZERFREQBAND_H -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/EqualizerFreqBandContainer.h --- a/mmserv/audioeffectsui/equalizer/inc/EqualizerFreqBandContainer.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,185 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Declares class for frequency band container -* -*/ - - - - -#ifndef EQUALIZERFREQBANDCONTAINER_H -#define EQUALIZERFREQBANDCONTAINER_H - -// INCLUDES -#include -#include "EqualizerFreqBand.h" -#include "EqualizerPrivateConstants.h" - -// FORWARD DECLARATIONS -class CAudioEqualizerUtility; -class CAudioEqualizer; -class CAknsBasicBackgroundControlContext; - -// CLASS DECLARATIONS - -////////////////////////////////////////////////////////////////////////////// -// -// -----> CEqualizerFreqBandContainer(definition) -// -////////////////////////////////////////////////////////////////////////////// -NONSHARABLE_CLASS(CEqualizerFreqBandContainer) : public CCoeControl - { - public: - /** - * This function is called to create an object of - * type CEqualizerFreqBandContainer - First phase Constructor - * @since 3.0 - * @param aaEqEditingDialog a reference to CEqualizerEditingDialog - * @param aAudEqUtility a pointer to CAudioEqualizerUtility - * @param aPresetIndex the index of the Preset being edited - * @param aIsActivePreset whether the preset is active or not? - * @param aRect the CEqualizerFreqBandContainer rectangle - */ - CEqualizerFreqBandContainer( - CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility* aAudEqUtility, - const TInt aPresetIndex, const TBool aIsActivePreset, TRect& aRect, - MEqualizerPresetActivationObserver& aObserver, TInt aPresetKey, - TPresetName& aPresetName ); - /** - * Destructor - * @since 3.0 - */ - virtual ~CEqualizerFreqBandContainer(); - - public: - /** - * Handles key events - * @param aKeyEvent key event. - * @param aType key code - * @return TKeyResponse - */ - TKeyResponse OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType); - - - private: //New Functions - void ConstructL(TRect& aRect); - /** - * This function is used to swap the focus from one control to other - * @since 3.0 - * @param aPrevControl Previous control - * @param aNewControl New Control - */ - void SwapFocus(CCoeControl* aPrevControl, CCoeControl* aNewControl) ; - - /** - * This function is used to construct the frequency value labels - * @since 3.2 - */ - void ConstructLabelsL(); - - public: // New functions - /** - * This function is used to set new values for CAudioEqualizerUtility* - * @since 3.0 - * @param aAudEqUtility New pointer to CAudioEqualizerUtility - */ - void SetAudioEqualizerL(CAudioEqualizerUtility* aAudEqUtility); - - private: //Functions from base classes - /** - * This function is called by the framework whenever a custom control - * is constructed inside the Dialog - */ - void ConstructFromResourceL(TResourceReader& aReader); - /** - * Virtual, defined by CCoeControl; replaces the default implementation - * provided by CCoeControl. - */ - void Draw(const TRect& /*aRect*/) const; - - /** - * Virtual, defined by CCoeControl; replaces the default implementation - * provided by CCoeControl. - */ - TInt CountComponentControls() const; - - /** Virtual, defined by CCoeControl; replaces the default implementation - * provided by CCoeControl. - */ - CCoeControl* ComponentControl(TInt aIndex) const; - /** - *Virtual, defined by CCoeControl; empty implementation provided by - * CCoeControl; full implementation provided by this class - */ - void SizeChanged(); - /* - * From CCoeControl Called when a control's focus is changed - */ - void FocusChanged(TDrawNow aDrawNow); - - /* - * From CCoeControl - * @see CCoeControl - */ - TTypeUid::Ptr MopSupplyObject(TTypeUid aId); - -#ifdef RD_SCALABLE_UI_V2 - /* - * From CCoeControl - * @see CCoeControl - */ - void HandlePointerEventL(const TPointerEvent& aPointerEvent); -#endif //RD_SCALABLE_UI_V2 - - private: - // Data members defined and used by this class. - //Array of frequency band pointers - CArrayPtr* iFreqBand; - // Stores the currently focussed frequency band - CCoeControl* iFocussedFreqBand; - // Stores the Index of the currently focussed frequency band - TUint iIndexOfFocussedFreqBand; - // Used to store a pointer to CEqualizerEditingDialog - CEqualizerEditingDialog* iEqEditingDialog; - // Used to store a pointer to CAudioEqualizerUtility - CAudioEqualizerUtility* iAudEqUtility; - // Used to store the preset index - const TInt iPresetIndex; - // Whether the preset displayed is an active preset? - const TBool iIsActivePreset; - // Rectangle in which to display the control - TRect& iRect; - // Number of Frequency bands - TUint iNumberOfFreqBands; - // For skin in the background - CAknsBasicBackgroundControlContext* iBackGround; - //Array of frequence band labels - CArrayPtr* iFreqLabels; - - // Observer for changing equalizer presets - MEqualizerPresetActivationObserver& iObserver; - TInt iPresetKey; - - // Used to indicate a band is selected in touch - TBool iBandSelected; - - // Used to store the preset name - TPresetName iPresetName; - - }; - -#endif //EQUALIZERFREQBANDCONTAINER_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/EqualizerPresetListArray.h --- a/mmserv/audioeffectsui/equalizer/inc/EqualizerPresetListArray.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,168 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Item text array for Equalizer listbox. -* -*/ - - - - - -#ifndef CEQUALIZERPRESETLISTARRAY_H -#define CEQUALIZERPRESETLISTARRAY_H - -// INCLUDES -#include "EqualizerPrivateConstants.h" -#include - -// FORWARD DECLARATIONS - - -// CLASS DECLARATION - -/** -* Item text array for playlist listbox. -* Creates item text descriptors according to playlist data stored to playlist -* model. -* -* @lib Equalizer.dll -* @since 3.0 -*/ -NONSHARABLE_CLASS(CEqualizerPresetListArray) : public CBase, - public MDesCArray - { - public: // Constructors and destructor - - /** - * Two-phased constructor. - * @since 3.0 - * @param aAudEqUtility a pointer to CAudioEqualizerUtility - * @param aActivePreset Currently active preset - */ - static CEqualizerPresetListArray* NewL( - CAudioEqualizerUtility* aAudioEqUtil, - TInt aActivePresetKey); - - /** - * Destructor. - */ - virtual ~CEqualizerPresetListArray(); - - public: //New Functions - /** - * Used to set the currently active preset - * @since 3.0 - * @param aActivePreset Currently active preset - */ - void SetCurrentActivePreset(const TPtrC& aActivePreset); - - /** - * Returns the currently actibe preset - */ - void CEqualizerPresetListArray::GetCurrentActivePreset(TPresetName& - aActivePreset); - /** - * Updates the sorted array with the changed user-defined presets - */ - void UpdateSortedArrayL(); - - /** - * Returns the PresetNameKey given the localised name for the preset - */ - void GetPresetKeyFromLocalisedName(TInt& aPresetNameKey, - const TPresetName& aPresetName); - /** - * Returns the localised name for the preset given the PresetNameKey - */ - void GetLocalisedPresetNameFromKey(TInt aPresetNameKey, - TPresetName& aPresetName); - - /** - * This function is used to set new values for currently active preset - * @since 3.0 - * @param aActivePreset Active preset - */ - void SetCurrentActivePreset(const TDesC& aActivePreset); - - /** - * This function is used to set new values for CAudioEqualizerUtility* - * @since 3.0 - * @param aAudEqUtility New pointer to CAudioEqualizerUtility - */ - void SetAudioEqualizer(CAudioEqualizerUtility* aAudEqUtility); - - /** - * This function is used to get the length of prefix (eg "0\t") - * before the preset name. - * @since 3.0 - * @returns Length of the prefix - */ - TInt CEqualizerPresetListArray::GetPrefixLength(); - - public: // Functions from base classes - - /** - * From MDesCArray, returns the number of descriptor elements - * in a descriptor - */ - TInt MdcaCount() const; - - /** - * From MDesCArray, indexes into a descriptor array. - */ - TPtrC MdcaPoint(TInt aIndex) const; - - - private: // Constructors - - /** - * First-phase constructor. - * @since 3.0 - * @param aAudioEqUtil a pointer to CAudioEqualizerUtility - */ - CEqualizerPresetListArray(CAudioEqualizerUtility* aAudioEqUtil); - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(TInt aActivePresetKey); - - /** - * Creates the ListBox text including the icon information. - * e.g "0\tNone" - */ - void CreateListBoxIconText(const TPtrC& aPresetName) const; - - /** - * Searches for a localised name for a preset found in the CenRep - */ - HBufC* SearchForPredefinedPresetL(const CDesCArray& - aPresetArray, const TPresetName& aCenrepPreset); - private: // Data - HBufC* iItem; - // Pointer to CAudioEqualizerUtility - CAudioEqualizerUtility* iAudEqUtility; - // This preset array contains alphabetically sorted user-defined - // presets - CDesCArray* iSortedPresetArray; - // This preset array contains localised predefined presets - CDesCArray* iPreDefinedPresetArray; - //Preset "None" - HBufC* iPresetNoneText; - //Current active preset - TPresetName iActivePreset; - }; - -#endif // CEQUALIZERPRESETLISTARRAY_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/EqualizerPrivateConstants.h --- a/mmserv/audioeffectsui/equalizer/inc/EqualizerPrivateConstants.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,63 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: This file contains declarations for private constants for -* Equalizer -* -*/ - - - -#ifndef EQUALIZERPRIVATECONSTANTS_H -#define EQUALIZERPRIVATECONSTANTS_H - -// INCLUDES - -#include -#include -#include "EqualizerConstants.h" - -// CONSTANTS - -// Used as the maximum length of a Preset name -const TInt KMaxPresetNameLength = 32; -// Uid of Equalizer -const TUid KUidEqualizer = { 0x101FD659 }; -// Used to set the array granularity for dynamic arrays -const TUint KEqualizerArrayGranularity = 4; -// Equalizer rsc file name -_LIT( KEqualizerResourceFileName, "Z:Equalizer.rsc" ); -// Equalizer mif file name -_LIT(KIconsFilename, "Z:Equalizer.mbm"); -// Used if the number of bands returned from engine is 8 -const TInt KEqualizerEightBands = 8; -// Used if the number of bands returned from engine is 5 -const TInt KEqualizerFiveBands = 5; -// Number of slider movements -const TInt KNumberOfSteps = 20; - -// for old s60 musicplayer -//const TUid KCRUidMusicPlayerSettings = {0x101F880C}; -//const TUint32 KMPlayerEqPresetId = 0x00000009; -const TUid KCRUidMusicPlayerSettings = {0x101FFCDC}; -const TUint32 KMPlayerEqPresetId = 0x00000001; - -// MACROS -//Used in model text -_LIT(KEqrTab, "\t"); - -// DATA TYPES - -#endif // EQUALIZERPRIVATECONSTANTS_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/inc/eq.hlp.hrh --- a/mmserv/audioeffectsui/equalizer/inc/eq.hlp.hrh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: RH for storing Custom Control parameters struct -* -*/ - - - - - -#ifndef __EQ_HLP_HRH__ -#define __EQ_HLP_HRH__ - - -_LIT(KEQ_HLP_LIST_VIEW,"EQ_HLP_LIST_VIEW"); //Selecting equalizer presets vuew -_LIT(KEQ_HLP_EDITING_VIEW,"EQ_HLP_EDITING_VIEW"); //Editing frequency presets view - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/loc/equalizer.loc --- a/mmserv/audioeffectsui/equalizer/loc/equalizer.loc Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,175 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Localisation file for Equalizer dll -* -*/ - - - - -// LOCALISATION STRINGS - -//d: Displayed if the maximum number of presets is reached -//l: popup_note_window -//w: -//r:3.0 -// -#define qtn_eq_note_err_max_preset_number_reached "Maximum number of presets reached. Delete some preset and try again" - -//d: Command resets the values of presets to default values -//l: list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_options_reset "Reset values" - -//d: Displayed if the user tries to rename a preset which is currently active -//l: popup_note_window -//w: -//r:3.0 -// -#define qtn_eq_note_err_preset_in_use_no_rename "Preset in use. Cannot be renamed." - -//d: Displayed if the user tries to delete a preset which is currently active -//l: popup_note_window -//w: -//r:3.0 -// -#define qtn_eq_note_err_preset_in_use "Preset in use. Unable to delete." - -//d: Displayed as the default name for a preset -//l: popup_query_data_window -//w: -//r:3.0 -// -#define qtn_eq_preset_default_name "Preset" - -//d: Displayed when the user tries to name a new preset -//l: popup_query_data_window -//w: -//r:3.0 -// -#define qtn_eq_title_preset_name "Preset name:" - -//d: Displayed when the user activates a preset -//l: popup_note_window -//w: -//r:3.0 -// -#define qtn_eq_note_info_preset_activated "Activated preset: %U" - -//d: This command isused to rename a preset -//l: list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_options_rename "Rename" - -//d: This command is used to delete a preset -//l: list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_options_delete "Delete" - -//d: This command is used to create a new preset -//l: list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_options_create_new "Create new" - -//d: This command is used to edit preset values -//l: list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_options_edit "Edit" - -//d: This command is used to activate a preset -//l: list_single_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_options_activate "Activate" - -//d: A pre-defined preset. -//l: list_single_graphic_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_preset_rock "Rock" - -//d: A pre-defined preset. -//l: list_single_graphic_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_preset_pop "Pop" - -//d: A pre-defined preset. -//l: list_single_graphic_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_preset_jazz "Jazz" - -//d: A pre-defined preset. -//l: list_single_graphic_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_preset_classic "Classic" - -//d: A pre-defined preset. -//l: list_single_graphic_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_preset_bassboost "Bass Booster" - -//d: Title of the Equalizer UI -//l: title_pane_t2/opt9 -//w: -//r:3.0 -// -#define qtn_eq_title_equalizer "Equalizer" - -//d: A pre-defined preset. -//l: list_single_graphic_pane_t1_cp2 -//w: -//r:3.0 -// -#define qtn_eq_preset_none "None" - -//d: Frequency band label for Hz. -//l: main_mup_eq_pane_t9/opt2 -//w: -//r:3.2 -// -#define qtn_eq_preset_frequency_hz "Hz" - -//d: Frequency band label for KHz. -//l: main_mup_eq_pane_t10/opt2 -//w: -//r:3.2 -// -#define qtn_eq_preset_frequency_khz "KHz" - -//d:Text in middle soft key (for Equalizer CBA) -//l:control_pane_t3/opt7 -//w: -//r:3.2 -#define qtn_msk_eq_activate "Activate" -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/rom/Equalizer.iby --- a/mmserv/audioeffectsui/equalizer/rom/Equalizer.iby Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for Equalizer -* -*/ - - - -#ifndef EQUALIZER_IBY -#define EQUALIZER_IBY - -S60_APP_BITMAP(Equalizer) -file=ABI_DIR\BUILD_DIR\Equalizer.dll SHARED_LIB_DIR\Equalizer.dll - -#endif -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/rom/EqualizerResources.iby --- a/mmserv/audioeffectsui/equalizer/rom/EqualizerResources.iby Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,27 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: IBY file for Equalizer Resources -* -*/ - - - -#ifndef EQUALIZERRESOURCES_IBY__ -#define EQUALIZERRESOURCES_IBY__ - -REM Equalizer - -data=DATAZ_\APP_RESOURCE_DIR\Equalizer.rsc APP_RESOURCE_DIR\Equalizer.rsc - -#endif // EQUALIZERRESOURCES_IBY__ diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/src/EqualizerEditingDialog.cpp --- a/mmserv/audioeffectsui/equalizer/src/EqualizerEditingDialog.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,554 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Defines functionality related to Equalizer Settings Dialog -* -*/ - - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -//LAF and Skin changes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include "EqualizerPrivateConstants.h" -#include -#include "EqualizerEditingDialog.h" -#include "EqualizerFreqBandContainer.h" -#include "Equalizer.hrh" - -// ============================ MEMBER FUNCTIONS ============================= - -// ------------------------------------------------------------------- -// CEqualizerEditingDialog* CEqualizerEditingDialog::NewL( -// CAudioEqualizerUtility& aAudEqUtility, -// const TInt aPresetIndex, TRect& aRect, const TBool aIsActivePreset) -// Create instance of concrete ECOM interface implementation -// ------------------------------------------------------------------- -// -CEqualizerEditingDialog* CEqualizerEditingDialog::NewL( -CAudioEqualizerUtility* aAudEqUtility, const TInt aPresetIndex, - TRect& aRect, const TBool aIsActivePreset, - MEqualizerPresetActivationObserver& aObserver, - TInt aPresetKey) - { - CEqualizerEditingDialog* self = new (ELeave) CEqualizerEditingDialog( - aAudEqUtility, aPresetIndex, aRect, aIsActivePreset, aObserver, - aPresetKey); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// ------------------------------------------------------------------- -// CEqualizerEditingDialog::ConstructL() -// Second Phase Constructor -// ------------------------------------------------------------------- -// -void CEqualizerEditingDialog::ConstructL() - { - //Initially set these variable to EFalse - iIgnoreKeyEvents = EFalse; - iContextSensitiveMenu = EFalse; - - iPresetName = iAudEqUtility->GetPresetL(iPresetIndex); - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iNumberOfFreqBands = audioEqualizer.NumberOfBands(); - iMover=new(ELeave)CArrayFixSeg(KEqualizerArrayGranularity); - - iFreqBandRect = RArray(iNumberOfFreqBands); - iScaleRect = RArray(iNumberOfFreqBands); - iBackgroundRect = RArray(iNumberOfFreqBands); - iSliderRect = RArray(iNumberOfFreqBands); - GetLayoutRect(); - - // Find which drive this DLL is installed. - TFileName fileName; - - // Get the full resource file - TParse fp; - - // Add the resource dir - fp.Set( KEqualizerResourceFileName, &KDC_APP_RESOURCE_DIR, NULL); - // Get the filename with full path - fileName = fp.FullName(); - //for localisation of resource file - BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), fileName ); - iResourceFileOffset = iEikonEnv->AddResourceFileL( fileName ); - CAknDialog::ConstructL(R_EQUALIZER_SETTINGS_MENUBAR); - } - -// --------------------------------------------------------------------- -// CEqualizerEditingDialog::CEqualizerEditingDialog -// (CAudioEqualizerUtility* aAudEqUtility, TInt aPresetIndex, -// TRect& aRect, const TBool aIsActivePreset) -// First phase constructor -// --------------------------------------------------------------------- -// -CEqualizerEditingDialog::CEqualizerEditingDialog(CAudioEqualizerUtility* -aAudEqUtility, const TInt aPresetIndex, TRect& aRect, -const TBool aIsActivePreset, MEqualizerPresetActivationObserver& aObserver, -TInt aPresetKey ): -iAudEqUtility(aAudEqUtility), -iPresetIndex(aPresetIndex), iRect(aRect), -iIsActivePreset(aIsActivePreset), -iObserver( aObserver ), iPresetKey( aPresetKey ) - { - } - -// -------------------------------------------------------------------- -// CEqualizerEditingDialog::~CEqualizerEditingDialog() -// Destructor -// -------------------------------------------------------------------- -// -CEqualizerEditingDialog::~CEqualizerEditingDialog() - { - if (iResourceFileOffset) - { - iEikonEnv->DeleteResourceFile(iResourceFileOffset); - } - - if (iMover) - { - iMover->Reset(); - delete iMover; - } - - iFreqBandRect.Close(); - iScaleRect.Close(); - iBackgroundRect.Close(); - iSliderRect.Close(); - } - -// -------------------------------------------------------------------- -// SEikControlInfo CEqualizerEditingDialog:: -// CreateCustomControlL ( TInt aControlType ) -// This function is called by the framework to create a custom control -// inside the dialog -// -------------------------------------------------------------------- -// -SEikControlInfo CEqualizerEditingDialog::CreateCustomControlL ( TInt - aControlType ) - { - SEikControlInfo controlInfo; - controlInfo.iControl = NULL; - controlInfo.iTrailerTextId = 0; - controlInfo.iFlags = 0; - - SetMoverPositionsL(EFalse); - - switch ( aControlType) - { - case EEqualizerCustomCtrlDlgCtCustomControl: - controlInfo.iControl = new(ELeave) CEqualizerFreqBandContainer - (this, iAudEqUtility, iPresetIndex, iIsActivePreset, - iRect, iObserver, iPresetKey, iPresetName); - - iFreqBandContainer = (CEqualizerFreqBandContainer*) - controlInfo.iControl; - break; - default: - break; - } - - return controlInfo; - } - -// ------------------------------------------------------------------- -// void CEqualizerEditingDialog::SizeChanged() -// -// This function is called by the framework whenever the control size -// is changed -// -------------------------------------------------------------------- -// -void CEqualizerEditingDialog::SizeChanged() - { - CAknDialog::SizeChanged(); - iRect = Rect(); - GetLayoutRect(); - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iAudEqUtility->ModifyPresetL(iPresetIndex, iPresetName, audioEqualizer); - iMover->Reset(); - SetMoverPositionsL(EFalse); - } - -// ------------------------------------------------------------------- -// void CEqualizerEditingDialog::GetLayoutRect() -// -// This function is called to retrive the freqband rect, scale rect -// slider rect from the layout -// -------------------------------------------------------------------- -// -void CEqualizerEditingDialog::GetLayoutRect() - { - iFreqBandRect.Reset(); - iScaleRect.Reset(); - iBackgroundRect.Reset(); - iSliderRect.Reset(); - - TInt variety = EEqualizerVarietyOne; - - if(iNumberOfFreqBands == KEqualizerFiveBands) - variety = EEqualizerVarietyTwo; - - for(TInt count = 0; count < iNumberOfFreqBands; count++) - { - iFreqBandRect.Append(CEqualizerFreqBand::ComponentRect( - iRect,variety+2,count)); - iScaleRect.Append(CEqualizerFreqBand::ComponentRect( - iFreqBandRect[count],variety,EEqualizerScale)); - iBackgroundRect.Append(CEqualizerFreqBand::ComponentRect( - iScaleRect[count],EEqualizerVarietyNotUsed,EEqualizerBackground)); - iSliderRect.Append(CEqualizerFreqBand::ComponentRect( - iScaleRect[count],EEqualizerVarietyNotUsed,EEqualizerSlider)); - } - } - -// -------------------------------------------------------------------- -// void CEqualizerEditingDialog::SetMoverPositionsL(TBool aReset) -// This function is used to read the positions of the mover for the -// various bands from the engine. -// -------------------------------------------------------------------- -// -void CEqualizerEditingDialog::SetMoverPositionsL(TBool aReset) - { - //Calulate change in db level - TInt32 minBandLevel; - TInt32 maxBandLevel; - iAudEqUtility->GetPresetL(iPresetIndex); - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - - audioEqualizer.DbLevelLimits(minBandLevel, maxBandLevel); - - //The minimum band level should always be negative and the - // maximum band level should always be positive. - if (( minBandLevel > 0 ) || (maxBandLevel < 0)) - { - User::Leave(KErrNotSupported); - } - - for (TInt i =0; i= minBandLevel) || - (curBandlevel <= maxBandLevel), User::Invariant()); - if ((curBandlevel < minBandLevel) || (curBandlevel > maxBandLevel)) - { - curBandlevel = 0; //Band level is invalid, use zero instead. - } - - if (curBandlevel > 0) - { - TReal frac = (TReal)curBandlevel / maxBandLevel; - TInt moverPos = (TInt) (scaleZeroPos - (frac * - diffUIBandLevel * sliderInc)); - if((moverPos < (iBackgroundRect[i].iTl.iY + halfSliderSize)) || - ((scaleZeroPos - moverPos) >= (diffUIBandLevel * sliderInc))) - { - moverPos = iBackgroundRect[i].iTl.iY + halfSliderSize; - } - - if (aReset) - { - (*iMover)[i] = moverPos; - } - else - { - iMover->AppendL(moverPos); - } - } - else if (curBandlevel < 0) - { - TReal frac = (TReal)curBandlevel / minBandLevel; - TInt moverPos = (TInt) (scaleZeroPos + (frac * - diffUIBandLevel * sliderInc)); - if((moverPos > ((iBackgroundRect[i].iBr.iY ) - halfSliderSize)) || - ((moverPos - scaleZeroPos) >= (diffUIBandLevel * sliderInc))) - { - moverPos = (iBackgroundRect[i].iBr.iY ) - halfSliderSize; - } - - if (aReset) - { - (*iMover)[i] = moverPos; - } - else - { - iMover->AppendL(moverPos); - } - } - else - { - if (aReset) - { - (*iMover)[i] = scaleZeroPos; - } - else - { - iMover->AppendL(scaleZeroPos); - } - } - } - } - -// --------------------------------------------------------- -// CEqualizerEditingDialog::OfferKeyEventL( -// const TKeyEvent& aKeyEvent,TEventCode aType) -// This function is used to handle key events -// --------------------------------------------------------- -// -TKeyResponse CEqualizerEditingDialog::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if (iIgnoreKeyEvents) - { - return EKeyWasNotConsumed; - } - else - { - return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerEditingDialog::ProcessCommandL(TInt aCommandId) -// This function is called by the framework to handle the user's -// menubar command options -// -------------------------------------------------------------------- -// -void CEqualizerEditingDialog::ProcessCommandL(TInt aCommandId) - { - // Need to do this in all cases or menu does not disappear after - // a selection is made - CAknDialog::ProcessCommandL(aCommandId); - - switch(aCommandId) - { - case EAknCmdExit : - case EEikCmdExit : - { - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iAudEqUtility->ModifyPresetL(iPresetIndex, iPresetName, audioEqualizer); - iAvkonAppUi->HandleCommandL( aCommandId ); - break; - } - - case EEqualizerCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL - ( iEikonEnv->WsSession(), - CEikonEnv::Static()->AppUi()->AppHelpContextL() ); - break; - } - - case EEqualizerCmdReset: - { - iAudEqUtility->GetPresetL(iPresetIndex); - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - - if (iPresetIndex < iAudEqUtility->NumberOfPreDefinedPresets()) - { - //Predefined preset - iAudEqUtility->ResetPresetL(iPresetIndex); - SetMoverPositionsL(ETrue); - } - else - { - //User defined preset, Reset manually - for (TInt i =0; iModifyPresetL(iPresetIndex, iPresetName, - audioEqualizer); - } - - if (iIsActivePreset) - { - TRAP_IGNORE(iAudEqUtility->ApplyPresetL(iPresetIndex)); - } - - // In MPX, we need to callback to observer when a preset is changed - if( iIsActivePreset ) - { - iObserver.HandlePresetActivation( iPresetKey ); - } - iFreqBandContainer->SetRect(iRect); - DrawNow(); - break; - } - - default: - { - break; - } - } - } - -// ------------------------------------------------------------------- -// void CEqualizerEditingDialog::GetHelpContext( -// TCoeHelpContext& aContext ) const -// Get help context for the control -// -------------------------------------------------------------------- -// -void CEqualizerEditingDialog::GetHelpContext( - TCoeHelpContext& aContext ) const - { - aContext.iMajor = KUidEqualizer; - aContext.iContext = KEQ_HLP_EDITING_VIEW; - } - -// --------------------------------------------------------------------------- -// CEqualizerEditingDialog::DynInitMenuPaneL( -// TInt aResourceId,CEikMenuPane* aMenuPane) -// This function is called by the EIKON framework just before it displays -// a menu pane. Its default implementation is empty, and by overriding it, -// the application can set the state of menu items dynamically according -// to the state of application data. -// --------------------------------------------------------------------------- -// -void CEqualizerEditingDialog::DynInitMenuPaneL( - TInt aResourceId, CEikMenuPane* aMenuPane) - { - if ( aResourceId == R_EQUALIZER_SETTINGS_MENU) - { - iMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); - // Help should be displayed only if the feature is supported - // according to Feature Manager - if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) - { - aMenuPane->SetItemDimmed(EEqualizerCmdHelp, ETrue); - } - - if(iContextSensitiveMenu) - { - iMenuBar->SetMenuType(CEikMenuBar::EMenuContext); - aMenuPane->SetItemDimmed(EAknCmdExit, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdHelp, ETrue); - iContextSensitiveMenu = EFalse; - } - } - } - -// ---------------------------------------------------------------------------- -// CEqualizerEditingDialog::SetAudioEqualizerL(CAudioEqualizerUtility* -// aAudEqUtility) -// This function is used to set a new CAudioEqualizerUtility* -// ---------------------------------------------------------------------------- -// -void CEqualizerEditingDialog::SetAudioEqualizerL( -CAudioEqualizerUtility* aAudEqUtility) - { - iAudEqUtility=aAudEqUtility; - if (iAudEqUtility) - { - iIgnoreKeyEvents = EFalse; - iFreqBandContainer->SetAudioEqualizerL(aAudEqUtility); - } - else - { - iIgnoreKeyEvents = ETrue; - } - } - -// ------------------------------------------------------------------- -// TInt CEqualizerEditingDialog::ExecuteLD() -// This function is called to execute and delete the dialog -// -------------------------------------------------------------------- -// -TInt CEqualizerEditingDialog::ExecuteLD() - { - return CAknDialog::ExecuteLD(R_EQUALIZER_EDITING_DIALOG); - } - -// ------------------------------------------------------------------- -// TBool CEqualizerEditingDialog::OkToExitL(TInt aButtonId) -// This function is called when the OK key is pressed -// -------------------------------------------------------------------- -// -TBool CEqualizerEditingDialog::OkToExitL(TInt aButtonId) - { - TBool ret = EFalse; - if (aButtonId == EEikBidOk) - { - ret = EFalse; - } - else if (aButtonId == EAknSoftkeyBack) - { - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iAudEqUtility->ModifyPresetL(iPresetIndex, iPresetName, audioEqualizer); - - HBufC* iTitleText = StringLoader::LoadLC(R_QTN_EQUALIZER_TITLE_TEXT); - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); - tp->SetTextL(*iTitleText); - CleanupStack::PopAndDestroy(iTitleText); - - ret = CAknDialog::OkToExitL( aButtonId ); - } - else if(aButtonId == EAknSoftkeyContextOptions) - { - iContextSensitiveMenu = ETrue; - DisplayMenuL(); - } - else - { - ret = CAknDialog::OkToExitL( aButtonId ); - } - return ret; - } - -// ------------------------------------------------------------------- -// TInt CEqualizerEditingDialog::GetMoverPosition(TInt aBandIndex) -// This function returns the current mover position for each frequency band -// -------------------------------------------------------------------- -// -TInt CEqualizerEditingDialog::GetMoverPosition(TInt aBandIndex) -{ - return (*iMover)[aBandIndex]; -} - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/src/EqualizerFreqBand.cpp --- a/mmserv/audioeffectsui/equalizer/src/EqualizerFreqBand.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,741 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Defines functionality related to Equalizer Frequency band -* -*/ - - - -// INCLUDE FILES - -#include -#include -#include -#include -#include -#include -//LAF and Skin changes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#if defined(RD_TACTILE_FEEDBACK) -#include -#endif - -#include -#include "EqualizerPrivateConstants.h" -#include "EqualizerEditingDialog.h" -#include "EqualizerFreqBand.h" -#include "Equalizer.hrh" - -// ============================ MEMBER FUNCTIONS ============================= - -//============================================================================ -// -----> CEqualizerFreqBand (implementation) -//============================================================================ - -// ---------------------------------------------------------------------------- -// CEqualizerFreqBand* CEqualizerFreqBand::NewL(CEqualizerEditingDialog* aEqEditingDialog, -// CAudioEqualizerUtility*& aAudEqUtility, CAudioEqualizer& aAudEqualizer, -// const TInt aPresetIndex, const TBool aIsActivePreset, -// const TInt aBandIndex, TInt& aMoverPos, TRect& aRect) -// -// Two Phase construction -// ---------------------------------------------------------------------------- -// -CEqualizerFreqBand* CEqualizerFreqBand::NewL(CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility*& aAudEqUtility, const TInt aPresetIndex, - const TBool aIsActivePreset, const TInt aBandIndex, - TRect& aRect) - { - CEqualizerFreqBand* self = CEqualizerFreqBand::NewLC(aEqEditingDialog, aAudEqUtility, - aPresetIndex, aIsActivePreset, aBandIndex, - aRect); - CleanupStack::Pop(self); - return self; - } - -// ---------------------------------------------------------------------------- -// CEqualizerFreqBand* CEqualizerFreqBand::NewLC(CEqualizerEditingDialog* aEqEditingDialog, -// CAudioEqualizerUtility*& aAudEqUtility, const TInt aPresetIndex, -// const TBool aIsActivePreset, const TInt aBandIndex, TInt& aMoverPos, -// TRect& aRect) -// Two Phase construction -// ---------------------------------------------------------------------------- -// -CEqualizerFreqBand* CEqualizerFreqBand::NewLC(CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility*& aAudEqUtility, const TInt aPresetIndex, - const TBool aIsActivePreset, const TInt aBandIndex, - TRect& aRect) - { - CEqualizerFreqBand* self = new (ELeave) CEqualizerFreqBand(aEqEditingDialog, aAudEqUtility, - aPresetIndex, aIsActivePreset, aBandIndex, - aRect); - CleanupStack::PushL(self); - self->ConstructL(); - return self; - } -// ---------------------------------------------------------------------------- -//CEqualizerFreqBand::CEqualizerFreqBand(CEqualizerEditingDialog* aEqEditingDialog, -// CAudioEqualizerUtility*& aAudEqUtility, -// const TPresetName& aPresetName, const TBool aIsActivePreset, -// const TInt aBandIndex, TInt& aMoverPos, TRect& aRect) -// -// First phase constructor -// ---------------------------------------------------------------------------- -CEqualizerFreqBand::CEqualizerFreqBand(CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility*& aAudEqUtility, const TInt aPresetIndex, - const TBool aIsActivePreset, - const TInt aBandIndex, TRect& aContainerRect) - : iEqEditingDialog(aEqEditingDialog), iAudEqUtility(aAudEqUtility), iPresetIndex(aPresetIndex), - iIsActivePreset(aIsActivePreset), iBandIndex(aBandIndex), - iContainerRect(aContainerRect) - { - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::ConstructL() -// -// Second phase constructor -// -------------------------------------------------------------------- -// -void CEqualizerFreqBand::ConstructL() - { - LoadBitmapsL(); - iPresetName = iAudEqUtility->GetPresetL(iPresetIndex); - iAudioEqualizer = &iAudEqUtility->Equalizer(); - iAudioEqualizer->DbLevelLimits(iMinBandLevel, iMaxBandLevel); - } - -// ------------------------------------------------------------------- -// CEqualizerFreqBand::~CEqualizerFreqBand() -// -// Destructor -// -------------------------------------------------------------------- -// -CEqualizerFreqBand::~CEqualizerFreqBand() - { - delete iBgBitmap; - delete iBgBitmapMask; - delete iSliderBitmap; - delete iSliderBitmapMask; - -#if defined(RD_TACTILE_FEEDBACK) - MTouchFeedback* feedback = MTouchFeedback::Instance(); - if (feedback) - { - feedback->RemoveFeedbackForControl(this); - } -#endif - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::Draw(const TRect& aRect) const -// -// Function to draw the control -// -------------------------------------------------------------------- -// -void CEqualizerFreqBand::Draw(const TRect& /*aRect*/) const - { - CWindowGc& gc=SystemGc(); - MAknsSkinInstance* skinInstance = AknsUtils::SkinInstance(); - MAknsControlContext* cc = AknsDrawUtils::ControlContext( this ); - AknsDrawUtils::Background( skinInstance, cc, this, gc, iBackgroundRect ); - TRect innerRect = iBackgroundRect; - innerRect.Shrink( TSize( 5, 5) ); - if (IsFocused()) - { - - AknsDrawUtils::DrawFrame( skinInstance, gc, iBackgroundRect, - innerRect,KAknsIIDQsnFrGrid, KAknsIIDQsnFrGridCenter); - } - - gc.BitBltMasked(iBackgroundRect.iTl,iBgBitmap, TRect(TPoint(), - iBackgroundRect.Size()), iBgBitmapMask, ETrue); - - TInt halfSliderSize = iSliderRect.Height() / 2; - TInt sliderRectYCoord = iSliderRect.iTl.iY; - TInt yCoordOffset = ((iMoverPos - sliderRectYCoord) - halfSliderSize); - TRect tempSliderRect = iSliderRect; - tempSliderRect.Move(0,yCoordOffset); - - gc.BitBltMasked(tempSliderRect.iTl,iSliderBitmap,TRect(TPoint(), - tempSliderRect.Size()),iSliderBitmapMask,ETrue); - } -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::SizeChanged() -// -// This function is called by the framework whenever the control size -// is changed -// -------------------------------------------------------------------- -void CEqualizerFreqBand::SizeChanged() - { - TInt variety = EEqualizerVarietyOne; - - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - TUint numberOfFreqBands = audioEqualizer.NumberOfBands(); - - if(numberOfFreqBands == KEqualizerFiveBands) - { - variety = EEqualizerVarietyTwo; - } - - iScaleRect = ComponentRect(Rect(), - variety,EEqualizerScale); - iBackgroundRect = ComponentRect(iScaleRect, - EEqualizerVarietyNotUsed,EEqualizerBackground); - iSliderRect = ComponentRect(iScaleRect, - EEqualizerVarietyNotUsed,EEqualizerSlider); - -#if defined(RD_TACTILE_FEEDBACK) - MTouchFeedback* feedback = MTouchFeedback::Instance(); - if (feedback) - { - feedback->SetFeedbackArea(this, 0, iBackgroundRect, - ETouchFeedbackBasic, ETouchEventStylusDown); - } -#endif - - AknIconUtils::SetSize(iBgBitmap,iBackgroundRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize(iBgBitmapMask,iBackgroundRect.Size(), EAspectRatioNotPreserved); - - AknIconUtils::SetSize(iSliderBitmap,iSliderRect.Size(), EAspectRatioNotPreserved); - AknIconUtils::SetSize(iSliderBitmapMask,iSliderRect.Size(), EAspectRatioNotPreserved); - - TInt scaleHeight = iBackgroundRect.Height(); - TInt zeroCoord = iBackgroundRect.iTl.iY + (scaleHeight / 2); - iZeroPos = zeroCoord; - iMoverPos = iEqEditingDialog->GetMoverPosition(iBandIndex); - - TInt sliderInc = iBackgroundRect.Height() / KNumberOfSteps; - TReal res,frac; - frac = (TReal)(iMoverPos - iZeroPos) / sliderInc; - Math::Round(res,frac,0); - Math::Int(iStepCount,res); - iStepCount += KNumberOfSteps / 2; - if(iStepCount > KNumberOfSteps) - { - iStepCount = KNumberOfSteps; - } - if(iStepCount < 0) - { - iStepCount = 0; - } - - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::FocusChanged(TDrawNow aDrawNow) -// -// This function is called by the framework whenever the control's -// focus is changed -// -------------------------------------------------------------------- -// -void CEqualizerFreqBand::FocusChanged(TDrawNow aDrawNow) - { - if (aDrawNow) - { - DrawNow(); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::HandleResourceChange(TInt aType) -// -// This function is called by the framework whenever there is a -// change in skin -// ------------------------------------------------------------------- -void CEqualizerFreqBand::HandleResourceChange(TInt aType) - { - if (aType == KAknsMessageSkinChange) - { - TInt tempMoverPos = iMoverPos; - LoadBitmapsL(); - SizeChanged(); - iMoverPos = tempMoverPos; - DrawNow(); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::LoadBitmapsL() -// This function is called to load the bitmaps from the icons file -// -------------------------------------------------------------------- -// -void CEqualizerFreqBand::LoadBitmapsL() - { - // Find which drive this DLL is installed. - TFileName fileName; - // Get the full resource file - TParse fp; - // Add the resource dir - fp.Set( KIconsFilename, &KDC_APP_BITMAP_DIR, NULL); - // Get the filename with full path - fileName = fp.FullName(); - - MAknsSkinInstance * skinInstance; - skinInstance = AknsUtils::SkinInstance(); - - //Destroying previously created background icons - if (iBgBitmap) - { - delete iBgBitmap; - iBgBitmap = NULL; - } - - if (iBgBitmapMask) - { - delete iBgBitmapMask; - iBgBitmapMask = NULL; - } - - //Destroying previously created slider icons - if (iSliderBitmap) - { - delete iSliderBitmap; - iSliderBitmap = NULL; - } - - if (iSliderBitmapMask) - { - delete iSliderBitmapMask; - iSliderBitmapMask = NULL; - } - - //Creating the background icon - AknsUtils::CreateIconL(skinInstance,KAknsIIDQgnIndiMupEqBg, - iBgBitmap,iBgBitmapMask,fileName, - EMbmEqualizerQgn_indi_mup2_eq_bg, - EMbmEqualizerQgn_indi_mup2_eq_bg_mask); - - //Creating the slider icon - AknsUtils::CreateIconL(skinInstance,KAknsIIDQgnIndiMupEqSlider, - iSliderBitmap,iSliderBitmapMask,fileName, - EMbmEqualizerQgn_indi_mup_eq_slider, - EMbmEqualizerQgn_indi_mup_eq_slider_mask); - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::UpdateBandLevelInEngineL() -// This function is called to update the engine with the new band level -// -------------------------------------------------------------------- -// -void CEqualizerFreqBand::UpdateBandLevelInEngineL(TBool lastIncFlag) - { - //Update engine - TInt sliderInc = iBackgroundRect.Height() / KNumberOfSteps; - TInt diffUIBandLevel = KNumberOfSteps / 2; - TInt bandLevel; - TReal frac; - TInt sliderNoOfPix; - TInt actualNoOfPix; - TInt pixDiff; - TReal fracDiff; - - if (iMoverPos > iZeroPos) - { - frac = (TReal)(iMoverPos - iZeroPos) / ((TReal)diffUIBandLevel * sliderInc); - if(lastIncFlag) - { - sliderNoOfPix = diffUIBandLevel * sliderInc; - actualNoOfPix = iMoverPos - iZeroPos; - if(sliderNoOfPix > actualNoOfPix) - { - pixDiff = sliderNoOfPix - actualNoOfPix; - fracDiff = (TReal)pixDiff / ((TReal)diffUIBandLevel * sliderInc); - frac += fracDiff; - } - else - { - pixDiff = actualNoOfPix - sliderNoOfPix; - fracDiff = (TReal)pixDiff / ((TReal)diffUIBandLevel * sliderInc); - frac -= fracDiff; - } - } - if (frac > 1) - { - frac = 1; - } - else - if (frac < -1) - { - frac = -1; - } - bandLevel=(TInt)(frac * iMinBandLevel); - } - else if (iMoverPos < iZeroPos) - { - frac = (TReal)(iZeroPos - iMoverPos) / ((TReal)diffUIBandLevel * sliderInc); - if(lastIncFlag) - { - sliderNoOfPix = diffUIBandLevel * sliderInc; - actualNoOfPix = iZeroPos - iMoverPos; - if(sliderNoOfPix > actualNoOfPix) - { - pixDiff = sliderNoOfPix - actualNoOfPix; - fracDiff = (TReal)pixDiff / ((TReal)diffUIBandLevel * sliderInc); - frac += fracDiff; - } - else - { - pixDiff = actualNoOfPix - sliderNoOfPix; - fracDiff = (TReal)pixDiff / ((TReal)diffUIBandLevel * sliderInc); - frac -= fracDiff; - } - } - if (frac > 1) - { - frac = 1; - } - else - if (frac < -1) - { - frac = -1; - } - bandLevel=(TInt)(frac * iMaxBandLevel); - } - else - { - bandLevel = 0; - } - -//RDebug::Printf("Todd1 ==> bnad index=%d, Level set = %d", iBandIndex+1, bandLevel); - iAudioEqualizer->SetBandLevelL(iBandIndex+1, bandLevel); - - if (iIsActivePreset) - { - TInt err; - TRAP(err, iAudioEqualizer->EnableL()); - } - } - -// ------------------------------------------------------------------- -// TKeyResponse CEqualizerFreqBand::OfferKeyEventL -// (const TKeyEvent& aKeyEvent,TEventCode aType) -// This function is called to handle key events -// -------------------------------------------------------------------- -// -TKeyResponse CEqualizerFreqBand::OfferKeyEventL(const TKeyEvent& aKeyEvent, -TEventCode aType) - { - TKeyResponse ret = EKeyWasNotConsumed; - - TInt halfSliderSize = iSliderRect.Height() / 2; - TInt sliderInc = iBackgroundRect.Height() / KNumberOfSteps; - TInt nextInc; - TBool lastIncFlag = 0; - - if (aType==EEventKey && (aKeyEvent.iScanCode==EStdKeyDownArrow )) - { - if (iMoverPos < (iBackgroundRect.iBr.iY - halfSliderSize)) - { - nextInc = sliderInc; - iStepCount += 1; - if(((iMoverPos + nextInc) <= - (iBackgroundRect.iBr.iY - halfSliderSize)) - && (iStepCount != KNumberOfSteps)) - { - TInt offset = Abs(iMoverPos - iZeroPos) % sliderInc; - if(offset==0) - iMoverPos += nextInc ; - else - { - //iStepCount--; - if(iMoverPos>iZeroPos) - iMoverPos+= sliderInc - offset; - - if(iMoverPos KNumberOfSteps ) - iStepCount = KNumberOfSteps; - } - if(((iMoverPos) == (iBackgroundRect.iBr.iY - halfSliderSize)) || - (iStepCount == KNumberOfSteps)) - { - lastIncFlag = 1; - } - //Update engine - UpdateBandLevelInEngineL(lastIncFlag); - } - DrawNow(); - ret = EKeyWasConsumed; - } - else if (aType==EEventKey && (aKeyEvent.iScanCode==EStdKeyUpArrow)) - { - if (iMoverPos > (iBackgroundRect.iTl.iY+halfSliderSize)) - { - nextInc = sliderInc; - iStepCount -= 1; - if(((iMoverPos - nextInc) >= (iBackgroundRect.iTl.iY + halfSliderSize)) - && (iStepCount != 0)) - { - TInt offset = Abs(iMoverPos - iZeroPos) % sliderInc; - if(offset==0) - iMoverPos -= nextInc; - else - { - //iStepCount++; - if(iMoverPos>iZeroPos) - iMoverPos-= nextInc + offset; - - if(iMoverPosModifyPresetL(iPresetIndex, iPresetName, *iAudioEqualizer); - - // Set new value for CAudioEqualizerUtility - __ASSERT_DEBUG((iAudEqUtility != NULL), User::Invariant()); - iAudEqUtility = aAudEqUtility; - iPresetName = iAudEqUtility->GetPresetL(iPresetIndex); - iAudioEqualizer = &iAudEqUtility->Equalizer(); - } - -#ifdef RD_SCALABLE_UI_V2 -// ---------------------------------------------------------------------------- -// CEqualizerFreqBand::HandlePointerEventL(const TPointerEvent& -// aPointerEvent) -// This function is used handle pen input events -// ---------------------------------------------------------------------------- -// -void CEqualizerFreqBand::HandlePointerEventL(const TPointerEvent& aPointerEvent) - { - TInt pos; - TInt halfSliderSize = iSliderRect.Height() / 2; - TInt sliderInc = iBackgroundRect.Height() / KNumberOfSteps; - TInt offset; - TBool lastIncFlag = 0; -#if defined(RD_TACTILE_FEEDBACK) - MTouchFeedback* feedback = NULL; -#endif - - if ( aPointerEvent.iPosition.iY < iBackgroundRect.iTl.iY ) - { - pos = iBackgroundRect.iTl.iY; - } - else if ( aPointerEvent.iPosition.iY > iBackgroundRect.iBr.iY ) - { - pos = iBackgroundRect.iBr.iY; - } - else - { - pos = aPointerEvent.iPosition.iY; - } - - if (AknLayoutUtils::PenEnabled()) - { - switch (aPointerEvent.iType) - { - case TPointerEvent::EButton1Down: - break; - - case TPointerEvent::EButton1Up: - offset = Abs(pos- iZeroPos) % sliderInc; - - if(pos<= iZeroPos) - { - if(offset!=0) - { - if(offset <= (sliderInc/2)) - pos+= offset; - else - pos+= offset - sliderInc; - } - } - else - { - if(offset!=0) - { - if(offset <= (sliderInc/2)) - pos-= offset; - else - pos+= sliderInc - offset; - } - } - - iStepCount = (pos - iBackgroundRect.iTl.iY)/sliderInc; - - if(iStepCount == 0) - { - lastIncFlag = 1; - pos = iBackgroundRect.iTl.iY + halfSliderSize; - } - - if(iStepCount >= KNumberOfSteps) - { - lastIncFlag = 1; - pos = iBackgroundRect.iBr.iY - halfSliderSize; - } - - iMoverPos = pos; - UpdateBandLevelInEngineL(lastIncFlag); - DrawNow(); - break; - - case TPointerEvent::EDrag: -#if defined(RD_TACTILE_FEEDBACK) - feedback = MTouchFeedback::Instance(); - if (feedback) - { - feedback->InstantFeedback(ETouchFeedbackSensitive); - } -#endif - if(pos< (iBackgroundRect.iTl.iY + halfSliderSize)) - { - pos = iBackgroundRect.iTl.iY + halfSliderSize; - lastIncFlag = 1; - } - - if(pos> (iBackgroundRect.iBr.iY - halfSliderSize)) - { - pos=iBackgroundRect.iBr.iY - halfSliderSize; - lastIncFlag = 1; - } - - iMoverPos = pos; - UpdateBandLevelInEngineL(lastIncFlag); - DrawNow(); - break; - default: -//RDebug::Printf("Todd2 %d=", aPointerEvent.iType); - break; - } - } - } -#endif //RD_SCALABLE_UI_V2 -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/src/EqualizerFreqBandContainer.cpp --- a/mmserv/audioeffectsui/equalizer/src/EqualizerFreqBandContainer.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,709 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Defines functionality related to Equalizer Frequency Band -* Container -* -*/ - - - -// INCLUDE FILES - -#include -#include -#include -#include -#include - -//LAF and Skin changes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "EqualizerPrivateConstants.h" -#include "EqualizerEditingDialog.h" -#include "EqualizerFreqBand.h" -#include "EqualizerFreqBandContainer.h" -#include "Equalizer.hrh" - -_LIT(KLabelFormatInt,"%d"); -_LIT(KLabelFormatFloat,"%.1f"); - -// ============================ MEMBER FUNCTIONS ============================= - -////////////////////////////////////////////////////////////////////////////// -// -// -----> CEqualizerFreqBandContainer (implementation) -// -////////////////////////////////////////////////////////////////////////////// - -// ------------------------------------------------------------------- -// CEqualizerFreqBandContainer::CEqualizerFreqBandContainer -//(CAudioEqualizerUtility* aAudEqUtility, TInt aPresetIndex, -// TRect& aRect) -// -// First phase constructor -// -------------------------------------------------------------------- -// -CEqualizerFreqBandContainer::CEqualizerFreqBandContainer( - CEqualizerEditingDialog* aEqEditingDialog, - CAudioEqualizerUtility* aAudEqUtility, TInt aPresetIndex, - const TBool aIsActivePreset, TRect& aRect, - MEqualizerPresetActivationObserver& aObserver, - TInt aPresetKey, TPresetName& aPresetName ) - :iEqEditingDialog(aEqEditingDialog), iAudEqUtility(aAudEqUtility), iPresetIndex(aPresetIndex), - iIsActivePreset(aIsActivePreset), iRect(aRect), iObserver( aObserver ), iPresetKey( aPresetKey ), - iBandSelected(EFalse), iPresetName( aPresetName ) - { - } - -// ------------------------------------------------------------------- -// CEqualizerFreqBandContainer::~CEqualizerFreqBandContainer() -// -// Destructor -// -------------------------------------------------------------------- -// -CEqualizerFreqBandContainer::~CEqualizerFreqBandContainer() - { - delete iBackGround; - if (iFreqBand) - { - iFreqBand->ResetAndDestroy(); //delete items - delete (iFreqBand); - } - if (iFreqLabels) - { - iFreqLabels->ResetAndDestroy(); //delete items - delete (iFreqLabels); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBandContainer::ConstructL(TRect& aRect) -// -// Because CEqualizerFreqBandContainer is a compound control, it needs a -// ConstructL() for when it's created outside a dialog, and a -// ConstructFromResourceL() for when it's created inside a dialog. -// -------------------------------------------------------------------- -// -void CEqualizerFreqBandContainer::ConstructL(TRect& aRect) - { - iBackGround = CAknsBasicBackgroundControlContext::NewL - ( KAknsIIDQsnBgAreaMain, Rect(), EFalse ); - iAudEqUtility->GetPresetL(iPresetIndex); - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iNumberOfFreqBands = audioEqualizer.NumberOfBands(); - iFreqBand = new(ELeave) CArrayPtrFlat - (KEqualizerArrayGranularity); - iFreqLabels = new(ELeave) CArrayPtrFlat - (KEqualizerArrayGranularity); - - for (int i=0; iAppendL(band); - CleanupStack::Pop(band); - (*iFreqBand)[i]->SetContainerWindowL(*this); - } - - (*iFreqBand)[0]->SetFocus(ETrue); - iIndexOfFocussedFreqBand = 0; - -#ifdef RD_SCALABLE_UI_V2 - EnableDragEvents(); -#endif //RD_SCALABLE_UI_V2 - ConstructLabelsL(); - // Set the bounding rectangle of this control (this will result in - // a call to SizeChangedL(). The component controls must be - // created before calling this, because SizeChangedL() sets their - // sizes. - SetRect(aRect); - ActivateL(); - } - -// ---------------------------------------------------------------------- -// void CEqualizerFreqBandContainer::ConstructFromResourceL -// (TResourceReader& /*aReader*/) -// -// This function is used when the CEqualizerFreqBandContainer is created -// inside a dialog. -// ---------------------------------------------------------------------- -// -void CEqualizerFreqBandContainer::ConstructFromResourceL(TResourceReader& -/*aReader*/) - { - ConstructL(iRect); - } - -// ------------------------------------------------------------------- -// TInt CEqualizerFreqBandContainer::CountComponentControls() const -// -// Returns the number of controls in a compound control. -// ------------------------------------------------------------------- -// -TInt CEqualizerFreqBandContainer::CountComponentControls() const - { - return iNumberOfFreqBands + iFreqLabels->Count(); - } - -// ------------------------------------------------------------------- -// CCoeControl* CEqualizerFreqBandContainer::ComponentControl -// (TInt aIndex) const -// -// Returns the control given by the index in a compind control. -// ------------------------------------------------------------------- -// -CCoeControl* CEqualizerFreqBandContainer::ComponentControl(TInt aIndex) const - { - if(aIndex Variety = 0 - * Number of bands = 5 ==> Variety = 1 - */ - if(iNumberOfFreqBands == KEqualizerEightBands) - { - equalizerVariety = EEqualizerVarietyOne; - } - - if(iNumberOfFreqBands == KEqualizerFiveBands) - { - equalizerVariety = EEqualizerVarietyTwo; - } - - //Setting the position and size for the frequency bands from the layout - //obtained - for(TInt count = 0;count < iNumberOfFreqBands; count++) - { - TRect freqBandRect = CEqualizerFreqBand::ComponentRect(iRect, - equalizerVariety+2,count); - (*iFreqBand)[count]->SetRect(freqBandRect); - } - - TInt variety=0; - if(Layout_Meta_Data::IsLandscapeOrientation()) - variety=4; - TRect temp; - AknLayoutUtils::LayoutMetricsRect( AknLayoutUtils::EApplicationWindow, temp ); - TAknLayoutRect mainPaneLayout; - mainPaneLayout.LayoutRect( temp,AknLayoutScalable_Apps::main_pane(variety).LayoutLine() ); - myRect = mainPaneLayout.Rect(); - myRect.iBr.iY = myRect.iBr.iY - myRect.iTl.iY; - myRect.iTl.iY = 0; - - TAknTextLineLayout tLayout; - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t9(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[0], myRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t10(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[1], myRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t1(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[2], iRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t2(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[3], iRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t3(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[4], iRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t4(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[5], iRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t5(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[6], iRect, tLayout); - - if(equalizerVariety == 0) - { - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t6(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[7], iRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t7(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[8], iRect, tLayout); - - tLayout = AknLayoutScalable_Apps::main_mup_eq_pane_t8(equalizerVariety); - AknLayoutUtils::LayoutLabel((*iFreqLabels)[9], iRect, tLayout); - } - - if (iBackGround) - { - iBackGround->SetRect(iRect); - } - TRgb color; - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - for(TInt i=0; iCount(); i++) - { - CCoeControl* label( ComponentControl( i+iNumberOfFreqBands )); - TInt error = AknsUtils::GetCachedColor( skin, color, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG6 ); - if ( !error ) - AknLayoutUtils::OverrideControlColorL( *label, - EColorLabelText, - color); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBandContainer::Draw(const TRect& aRect) const -// -// This function gets called to draw a control -// ------------------------------------------------------------------- -// -void CEqualizerFreqBandContainer::Draw(const TRect& aRect) const - { - CWindowGc& gc=SystemGc(); - gc.Clear(iRect); - // Drawing skin - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - if (iBackGround) - { - AknsDrawUtils::Background(skin, iBackGround, this, gc, iRect); - } - - for(TInt i=0; iCount(); i++) - { - if( (*iFreqLabels)[i] ) - { - (*iFreqLabels)[i]->Draw(aRect); - } - } - } - -// --------------------------------------------------------------------- -// void CEqualizerFreqBandContainer::FocusChanged(TDrawNow aDrawNow) -// -// This function gets called whenever the application calls SetFocus(). -// It redraws the CEqualizerFreqBandContainer, so that they are updated -// to show which one now has focus. -// --------------------------------------------------------------------- -// -void CEqualizerFreqBandContainer::FocusChanged(TDrawNow aDrawNow) - { - if (IsFocused()) - { - (*iFreqBand)[0]->SetFocus(ETrue, EDrawNow); - iFocussedFreqBand = (*iFreqBand)[0]; - iIndexOfFocussedFreqBand = 0; - } - else - { - if (iFocussedFreqBand && iFocussedFreqBand->IsFocused()) - { - iFocussedFreqBand->SetFocus(EFalse, EDrawNow); - } - } - if (aDrawNow) - { - DrawNow(); - } - } - -// ---------------------------------------------------------------------- -// void CEqualizerFreqBandContainer::SwapFocus(CCoeControl* aPrevControl, -// CCoeControl* aNewControl) -// -// This function is called from OfferKeyEventL() whenever the user -// presses left/right arrow keys to change to the previous/next band -// ---------------------------------------------------------------------- -// -void CEqualizerFreqBandContainer::SwapFocus(CCoeControl* aPrevControl, -CCoeControl* aNewControl) - { - aPrevControl->SetFocus(EFalse, EDrawNow); - aNewControl->SetFocus(ETrue, EDrawNow); - iFocussedFreqBand = aNewControl; - } - -// ------------------------------------------------------------------------- -// CEqualizerFreqBandContainer::OfferKeyEventL -// Function for handling key events. -// ------------------------------------------------------------------------- -// -TKeyResponse CEqualizerFreqBandContainer::OfferKeyEventL(const TKeyEvent& -aKeyEvent,TEventCode aType) - { - TKeyResponse ret = EKeyWasNotConsumed; - TInt indexOfLastFocussedBand = -1; - if( aType == EEventKey ) - { - // Use the arrow keys to move focus between the two CEqualizerFreqBands. - switch (aKeyEvent.iCode) - { - case EKeyUpArrow: - case EKeyDownArrow: - { - ret = (*iFreqBand)[iIndexOfFocussedFreqBand]->OfferKeyEventL( - aKeyEvent, aType); - - // In MPX the band dialog presets need to be saved - // and called back to the observer - // - if( iIsActivePreset ) - { - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iAudEqUtility->ModifyPresetL(iPresetIndex, iPresetName, audioEqualizer); - - iObserver.HandlePresetActivation( iPresetKey ); - } - } - break; - - case EKeyRightArrow: - if (AknLayoutUtils::LayoutMirrored()) - { - // For Series60 Arabic Hebrew LAF - // Bugfix for Id: TCON-6HKGAB - indexOfLastFocussedBand = iIndexOfFocussedFreqBand; - iIndexOfFocussedFreqBand = - (indexOfLastFocussedBand+iNumberOfFreqBands-1) - %iNumberOfFreqBands; - SwapFocus((*iFreqBand)[indexOfLastFocussedBand], - (*iFreqBand)[iIndexOfFocussedFreqBand]); - ret = EKeyWasConsumed; - } - else - { - indexOfLastFocussedBand = iIndexOfFocussedFreqBand; - iIndexOfFocussedFreqBand = - (indexOfLastFocussedBand+1)%iNumberOfFreqBands; - SwapFocus((*iFreqBand)[indexOfLastFocussedBand], - (*iFreqBand)[iIndexOfFocussedFreqBand]); - ret = EKeyWasConsumed; - } - break; - case EKeyLeftArrow: - if (AknLayoutUtils::LayoutMirrored()) - { - // For Series60 Arabic Hebrew LAF - // Bugfix for Id: TCON-6HKGAB - indexOfLastFocussedBand = iIndexOfFocussedFreqBand; - iIndexOfFocussedFreqBand = (indexOfLastFocussedBand + 1)% - iNumberOfFreqBands; - SwapFocus((*iFreqBand)[indexOfLastFocussedBand], - (*iFreqBand)[iIndexOfFocussedFreqBand]); - ret = EKeyWasConsumed; - } - else - { - indexOfLastFocussedBand = iIndexOfFocussedFreqBand; - iIndexOfFocussedFreqBand = (indexOfLastFocussedBand + - iNumberOfFreqBands -1)% iNumberOfFreqBands; - SwapFocus((*iFreqBand)[indexOfLastFocussedBand], - (*iFreqBand)[iIndexOfFocussedFreqBand]); - ret = EKeyWasConsumed; - } - break; - - default: - break; - } - } - - // If the CEqualizerFreqBandContainer didn't use the key event, it - // must return EKeyWasNotConsumed, - // so that the key event is passed to other controls on the stack. - return ret; - } - -// ---------------------------------------------------------------------------- -// CEqualizerFreqBandContainer::SetAudioEqualizerL(CAudioEqualizerUtility* -// aAudEqUtility) -// This function is used to set a new CAudioEqualizerUtility* -// ---------------------------------------------------------------------------- -// -void CEqualizerFreqBandContainer::SetAudioEqualizerL( -CAudioEqualizerUtility* aAudEqUtility) - { - iAudEqUtility=aAudEqUtility; - for (int i=0; iSetAudioEqualizerL(aAudEqUtility); - } - } - -// --------------------------------------------------------- -// CEqualizerFreqBandContainer::MopSupplyObject -// Pass skin information if need. -// (other items were commented in a header). -// --------------------------------------------------------- -// -TTypeUid::Ptr CEqualizerFreqBandContainer::MopSupplyObject(TTypeUid aId) - { - if ( aId.iUid == MAknsControlContext::ETypeId ) - { - // Return the control context for the childs - return MAknsControlContext::SupplyMopObject( aId, iBackGround ); - } - return CCoeControl::MopSupplyObject( aId ); - } - -// --------------------------------------------------------- -// CEqualizerFreqBandContainer::ConstructLabelsL -// Contruct the frequency value labels. -// (other items were commented in a header). -// --------------------------------------------------------- -// -void CEqualizerFreqBandContainer::ConstructLabelsL() - { - - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - CEikLabel* tempLabel; - TBuf<15> tempStr; - TReal x,y; - - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - HBufC* hzText = StringLoader::LoadLC(R_QTN_EQ_PRESET_FREQUENCY_HZ); - tempLabel->SetTextL(hzText->Des()); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - CleanupStack::PopAndDestroy(); // hzText - - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - HBufC* mhzText = StringLoader::LoadLC(R_QTN_EQ_PRESET_FREQUENCY_KHZ); - tempLabel->SetTextL(mhzText->Des()); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - CleanupStack::PopAndDestroy(); // MhzText - - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - tempStr.Format(KLabelFormatInt,audioEqualizer.CenterFrequency(1)); - AknTextUtils::LanguageSpecificNumberConversion( tempStr ); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - tempStr.Format(KLabelFormatInt, audioEqualizer.CenterFrequency(2)); - AknTextUtils::LanguageSpecificNumberConversion( tempStr ); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - tempStr.Format(KLabelFormatInt, audioEqualizer.CenterFrequency(3)); - AknTextUtils::LanguageSpecificNumberConversion( tempStr ); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - Math::Round(y,(TReal)audioEqualizer.CenterFrequency(4)/1000,1); - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - Math::Mod(x,y*10,10); - if(x==0) - tempStr.Format(KLabelFormatInt,(TInt)y); - else - tempStr.Format(KLabelFormatFloat,y); - AknTextUtils::LanguageSpecificNumberConversion( tempStr ); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - Math::Round(y,(TReal)audioEqualizer.CenterFrequency(5)/1000,1); - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - Math::Mod(x,y*10,10); - if(x==0) - tempStr.Format(KLabelFormatInt,(TInt)y); - else - tempStr.Format(KLabelFormatFloat,y); - AknTextUtils::LanguageSpecificNumberConversion( tempStr ); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - if(iNumberOfFreqBands ==KEqualizerEightBands) - { - Math::Round(y,(TReal)audioEqualizer.CenterFrequency(6)/1000,1); - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - Math::Mod(x,y*10,10); - if(x==0) - tempStr.Format(KLabelFormatInt,(TInt)y); - else - tempStr.Format(KLabelFormatFloat,y); - AknTextUtils::LanguageSpecificNumberConversion( tempStr ); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - Math::Round(y,(TReal)audioEqualizer.CenterFrequency(7)/1000,1); - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - Math::Mod(x,y*10,10); - if(x==0) - tempStr.Format(KLabelFormatInt,(TInt)y); - else - tempStr.Format(KLabelFormatFloat,y); - AknTextUtils::LanguageSpecificNumberConversion(tempStr); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - - Math::Round(y,(TReal)audioEqualizer.CenterFrequency(8)/1000,1); - tempLabel = new (ELeave) CEikLabel; - tempLabel->SetContainerWindowL( *this ); - Math::Mod(x,y*10,10); - if(x==0) - tempStr.Format(KLabelFormatInt,(TInt)y); - else - tempStr.Format(KLabelFormatFloat,y); - AknTextUtils::LanguageSpecificNumberConversion(tempStr); - tempLabel->SetTextL(tempStr); - tempLabel->SetBrushStyle(CGraphicsContext::ENullBrush); - CleanupStack::PushL(tempLabel); - iFreqLabels->AppendL(tempLabel); - CleanupStack::Pop(tempLabel); - } - - TRgb color; - MAknsSkinInstance* skin = AknsUtils::SkinInstance(); - - for(TInt i=0; iCount(); i++) - { - CCoeControl* label( ComponentControl( i+iNumberOfFreqBands )); - TInt error = AknsUtils::GetCachedColor( skin, color, - KAknsIIDQsnTextColors, - EAknsCIQsnTextColorsCG6 ); - if ( !error ) - AknLayoutUtils::OverrideControlColorL( *label, - EColorLabelText, - color); - } - - } - -#ifdef RD_SCALABLE_UI_V2 -// --------------------------------------------------------- -// CEqualizerFreqBandContainer::HandlePointerEventL -// This function is used to handle pen input events. -// --------------------------------------------------------- -// -void CEqualizerFreqBandContainer::HandlePointerEventL(const TPointerEvent& aPointerEvent) - { - if (AknLayoutUtils::PenEnabled()) - { - if ( aPointerEvent.iType == TPointerEvent::EButton1Down ) - { - for ( TInt i = 0; i < iNumberOfFreqBands; i++ ) - { - TRect x = (*iFreqBand)[i]->Rect(); - if (x.Contains(aPointerEvent.iPosition)) - { - if ( iIndexOfFocussedFreqBand != i ) - { - TInt indexOfLastFocussedBand = iIndexOfFocussedFreqBand; - iIndexOfFocussedFreqBand = i; - SwapFocus((*iFreqBand)[indexOfLastFocussedBand], - (*iFreqBand)[iIndexOfFocussedFreqBand]); - } - iBandSelected = ETrue; - break; - } - } - } - - if ( iBandSelected ) - { - (*iFreqBand)[iIndexOfFocussedFreqBand]->HandlePointerEventL(aPointerEvent); - } - - // In MPX the band dialog presets need to be saved - // and called back to the observer - // - if ( iBandSelected && - ( (aPointerEvent.iType == TPointerEvent::EButton1Up) || - (aPointerEvent.iType == TPointerEvent::EDrag) ) ) - { - if ( iIsActivePreset ) - { - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iAudEqUtility->ModifyPresetL(iPresetIndex, iPresetName, audioEqualizer); - iObserver.HandlePresetActivation( iPresetKey ); - } - if ( aPointerEvent.iType == TPointerEvent::EButton1Up ) - { - iBandSelected = EFalse; - } - } - } - } -#endif //RD_SCALABLE_UI_V2 - -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/src/EqualizerMain.cpp --- a/mmserv/audioeffectsui/equalizer/src/EqualizerMain.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Standard entry point for a DLL -* -*/ - - - - -// INCLUDE FILES -#include - - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/src/EqualizerPresetListArray.cpp --- a/mmserv/audioeffectsui/equalizer/src/EqualizerPresetListArray.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,405 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Item text array for Equalizer Preset Listbox. -* -*/ - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include - -#include // Contains the resource definition -#include "EqualizerPrivateConstants.h" -#include "EqualizerPresetListArray.h" - -// CONSTANTS - -const TInt KEqrActiveIcon = 1; -const TInt KEqrNonActiveIcon = 0; - -// ============================ MEMBER FUNCTIONS =============================== - -// ----------------------------------------------------------------------------- -// CEqualizerPresetListArray::CEqualizerPresetListArray -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -CEqualizerPresetListArray::CEqualizerPresetListArray ( - CAudioEqualizerUtility* aAudioEqUtil): - iAudEqUtility(aAudioEqUtil) - { - } - -// ----------------------------------------------------------------------------- -// CEqualizerPresetListArray::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::ConstructL(TInt aActivePresetKey) - { - //Read text for preset "None" from rss file - iPresetNoneText = StringLoader::LoadL(R_QTN_EQUALIZER_PRESET_NONE); - - // iItem length cannot be defined dynamically as MdcaPoint is const function - iItem = HBufC::NewL(KListBoxEntryMaxLength); - iSortedPresetArray = new (ELeave) CDesCArrayFlat - (KEqualizerArrayGranularity); - UpdateSortedArrayL(); - - HBufC* tempText = NULL; - iPreDefinedPresetArray = new (ELeave) CDesCArrayFlat - (KEqualizerArrayGranularity); - if (iAudEqUtility) - { - // construct the array of available languages - TResourceReader reader; - CEikonEnv::Static()->CreateResourceReaderLC( reader, - R_EQUALIZER_PREDEFINED_PRESETS ); - CDesCArray* presetStringArray; - presetStringArray = reader.ReadDesCArrayL(); - CleanupStack::PopAndDestroy(); // resource reader - CleanupStack::PushL( presetStringArray ); - - TArray presets = - iAudEqUtility->Presets(); - TInt numPreDefinedPresets =iAudEqUtility->NumberOfPreDefinedPresets(); - for (TInt presetIndex = 0; - presetIndex < numPreDefinedPresets; presetIndex++) - { - TArray presets = - iAudEqUtility->Presets(); - TInt numPreDefinedPresets = - iAudEqUtility->NumberOfPreDefinedPresets(); - for (TInt presetIndex = 0; - presetIndex < numPreDefinedPresets; presetIndex++) - { - if ((tempText = SearchForPredefinedPresetL(*presetStringArray, - presets[presetIndex].iPresetName)) == NULL) - { - // If control reaches here then there is a predefined preset in - // the cenrep whose name is not localised - // In case no match is found display the English text - tempText = presets[presetIndex].iPresetName.AllocL(); - } - CleanupStack::PushL(tempText); - iPreDefinedPresetArray->AppendL(*tempText); - CleanupStack::PopAndDestroy(tempText); - } - GetLocalisedPresetNameFromKey(aActivePresetKey, iActivePreset); - } - CleanupStack::PopAndDestroy(presetStringArray); - } - } - - - -// ----------------------------------------------------------------------------- -// CEqualizerPresetListArray::NewL -// Two-phased constructor. -// ---------------------------------------------------------------------------- -// -CEqualizerPresetListArray* CEqualizerPresetListArray::NewL( - CAudioEqualizerUtility* aAudioEqUtil, - TInt aActivePresetKey) - { - CEqualizerPresetListArray* self = new(ELeave) CEqualizerPresetListArray - (aAudioEqUtil); - CleanupStack::PushL(self); - self->ConstructL(aActivePresetKey); - CleanupStack::Pop(self); - - return self; - } - -// --------------------------------------------------------------------------- -// CEqualizerPresetListArray::~CEqualizerPresetListArray -// Destructor. -// --------------------------------------------------------------------------- -// -CEqualizerPresetListArray::~CEqualizerPresetListArray() - { - delete iPresetNoneText; - delete iItem; - if (iSortedPresetArray) - { - iSortedPresetArray->Reset(); - delete iSortedPresetArray; - } - if (iPreDefinedPresetArray) - { - iPreDefinedPresetArray->Reset(); - delete iPreDefinedPresetArray; - } - } - -// --------------------------------------------------------------------------- -// CEqualizerPresetListArray::MdcaCount() const -// Returns the number of descriptor elements in a descriptor array. -// --------------------------------------------------------------------------- -// -TInt CEqualizerPresetListArray::MdcaCount() const - { - TInt ret = 0; - // Check if iAudEqUtility is NULL, if it is NULL then the ListBox - // is empty. - if (iAudEqUtility) - { - TArray presets = - iAudEqUtility->Presets(); - ret = presets.Count() + 1; //Add the preset "None" - } - - return ret; - } - -// ----------------------------------------------------------------------------- -// CEqualizerPresetListArray::MdcaPoint -// Indexes into a descriptor array. -// ----------------------------------------------------------------------------- -// -TPtrC CEqualizerPresetListArray::MdcaPoint(TInt aIndex) const - { - TPtrC item; - TArray presets = iAudEqUtility->Presets(); - - if (aIndex <= iAudEqUtility->NumberOfPreDefinedPresets()) - { // The predefined presets do not need to be sorted - if (aIndex == 0) - { - CreateListBoxIconText(*iPresetNoneText); - } - else - { - CreateListBoxIconText((*iPreDefinedPresetArray)[aIndex-1]); - } - } - else - { // Sort the user defined presets - CreateListBoxIconText((*iSortedPresetArray)[aIndex - - iAudEqUtility->NumberOfPreDefinedPresets()-1]); - } - - item.Set(*iItem); - return item; - - } - -// --------------------------------------------------------------------------- -// CEqualizerPresetListArray::UpdateSortedArrayL() -// Updates the sorted array with the changed user-defined presets -// --------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::UpdateSortedArrayL() - { - TInt presetIndex; - TInt numPreDefinedPresets = iAudEqUtility->NumberOfPreDefinedPresets(); - TArray presets = iAudEqUtility->Presets(); - iSortedPresetArray->Reset(); - for (presetIndex = numPreDefinedPresets; presetIndex < presets.Count(); - presetIndex++) - { - TPresetName preset = presets[presetIndex].iPresetName; - iSortedPresetArray->InsertIsqL(presets[presetIndex].iPresetName, - ECmpCollated); - } - } - -// --------------------------------------------------------------------------- -// CEqualizerPresetListArray::GetLocalisedPresetNameFromKey() -// Returns the localised name for the preset given the PresetNameKey -// --------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::GetLocalisedPresetNameFromKey(TInt aPresetNameKey, - TPresetName& aPresetName) - { - TInt count; - - //If a junk aCurrentActivePreset is passed to us we activate preset "None" - aPresetName = *iPresetNoneText; - - if (aPresetNameKey == KEqualizerPresetNone) - { - aPresetName = *iPresetNoneText; - } - else - { - TArray presets = iAudEqUtility->Presets(); - TInt numPredefinedPresets = iAudEqUtility->NumberOfPreDefinedPresets(); - TInt numPresets = presets.Count(); - for (count = 0; count < numPresets; count++) - { - if (presets[count].iPresetNameKey == aPresetNameKey) - { - if (count < numPredefinedPresets) - { - TPtrC selectedItem = MdcaPoint(count+1); - TInt begin = selectedItem.FindC(KEqrTab); - TPtrC localisedPreset = selectedItem.Right - (selectedItem.Length() -begin-1); - aPresetName = localisedPreset; - } - else - { - aPresetName = presets[count].iPresetName; - } - } - } - } - } - -// --------------------------------------------------------------------------- -// CEqualizerPresetListArray::GetPresetKeyFromLocalisedName() -// Returns the PresetNameKey given the localised name for the preset -// --------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::GetPresetKeyFromLocalisedName(TInt& - aPresetNameKey, const TPresetName& aPresetName) - { - TInt count; - - if (aPresetName == *iPresetNoneText) - { - aPresetNameKey = KEqualizerPresetNone; - } - else - { - TArray presets = iAudEqUtility->Presets(); - TInt numPredefinedPresets = iAudEqUtility->NumberOfPreDefinedPresets(); - TInt numPresets = presets.Count(); - for (count = 0; count < numPresets; count++) - { - TPtrC selectedItem = MdcaPoint(count+1); - TInt begin = selectedItem.FindC(KEqrTab); - TPtrC localisedPreset = selectedItem.Right(selectedItem.Length() - -begin-1); - - if (((count < numPredefinedPresets) && (localisedPreset == - aPresetName)) || (presets[count].iPresetName == aPresetName)) - { - aPresetNameKey = presets[count].iPresetNameKey; - break; - } - } - } - } - -// --------------------------------------------------------------------------- -// HBufC* CEqualizerPresetListArray::SearchForPredefinedPresetL -// (const CDesCArray& aPresetArray, const TPresetName& aCenrepPreset) -// Searches for a localised name for a preset found in the CenRep -// --------------------------------------------------------------------------- -// -HBufC* CEqualizerPresetListArray::SearchForPredefinedPresetL(const CDesCArray& - aPresetArray, const TPresetName& aCenrepPreset) - { - HBufC* retLocalisedPreset = NULL; - for (TInt index =0; indexDes(); - ptr.Zero(); - if (aPresetName == iActivePreset) - { - ptr.AppendNumUC(KEqrActiveIcon); - } - else - { - ptr.AppendNumUC(KEqrNonActiveIcon); - } - ptr.Append(KEqrTab); - ptr.Append(aPresetName); - } - -// ----------------------------------------------------------------------------- -// void CEqualizerPresetListArray::SetCurrentActivePreset(const TDesC& -// aActivePreset) -// Used to set the currently active preset. -// ----------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::SetCurrentActivePreset(const TDesC& - aActivePreset) - { - iActivePreset = aActivePreset; - } - -// ----------------------------------------------------------------------------- -// TPtrC CEqualizerPresetListArray::GetCurrentActivePreset() -// Used to set the currently active preset. -// ----------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::GetCurrentActivePreset(TPresetName& aActivePreset) - { - aActivePreset = iActivePreset; - } - -// ---------------------------------------------------------------------------- -// CEqualizerPresetListArray::SetAudioEqualizer(CAudioEqualizerUtility* -// aAudEqUtility) -// This function is used to set a new CAudioEqualizerUtility* -// ---------------------------------------------------------------------------- -// -void CEqualizerPresetListArray::SetAudioEqualizer( -CAudioEqualizerUtility* aAudEqUtility) - { - iAudEqUtility=aAudEqUtility; - } - -// ---------------------------------------------------------------------------- -// CEqualizerPresetListArray::GetPrefixLength() -// This function is used to get the length of prefix (eg "0\t") -// before the preset name. -// ---------------------------------------------------------------------------- -// -TInt CEqualizerPresetListArray::GetPrefixLength() - { - TPtr ptr = iItem->Des(); - ptr.Zero(); - ptr.AppendNumUC(KEqrActiveIcon); - ptr.Append(KEqrTab); - return ptr.Length(); - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/equalizer/src/EqualizerPresetsDialog.cpp --- a/mmserv/audioeffectsui/equalizer/src/EqualizerPresetsDialog.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1228 +0,0 @@ -/* -* Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Implementation of CEqualizerPresetsDialog class -* -*/ - - - - -// INCLUDE FILES -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -//LAF and Skin changes -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include // Contains the resource definition -#include -#include "EqualizerPrivateConstants.h" -#include "EqualizerPresetsDialog.h" -#include "EqualizerPresetListArray.h" -#include "EqualizerEditingDialog.h" -#include "Equalizer.hrh" - -// CONSTANTS -//Used during building a new preset name -_LIT( KEqrFormat, "%d)" ); -_LIT( KEqrZero, "0" ); -_LIT( KEqrParenthesis, "(" ); - -// Used for checking if the new preset name contains illegal characters -_LIT(KEqrLessThan, "<"); -_LIT(KEqrGreaterThan, ">"); -_LIT(KEqrQuote, "\""); -_LIT(KEqrBackSlash, "\\"); -_LIT(KEqrForwardSlash, "/"); -_LIT(KEqrOrSymbol, "|"); -_LIT(KEqrColon, ":"); -_LIT(KEqrAsterisk, "*"); -_LIT(KEqrQuestionMark, "?"); - -// ================= MEMBER FUNCTIONS ======================= - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog* CEqualizerPresetsDialog::NewL() -// Create instance of concrete ECOM interface implementation -// ------------------------------------------------------------------- -// -EXPORT_C CEqualizerPresetsDialog* CEqualizerPresetsDialog::NewL( - CAudioEqualizerUtility* aAudEqUtility, - TInt aCurrentActivePreset, - MEqualizerPresetActivationObserver& aEqrPresetActObserver) - { - CEqualizerPresetsDialog* self = new (ELeave) CEqualizerPresetsDialog( - aAudEqUtility, aEqrPresetActObserver); - CleanupStack::PushL(self); - self->ConstructL(aCurrentActivePreset); - CleanupStack::Pop(self); - return self; - } - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog::CEqualizerPresetsDialog( -// CAudioEqualizerUtility*& aAudEqUtility, -// MEqualizerPresetActivationObserver& aEqrPresetActObserver) -// First Phase Construction -// ------------------------------------------------------------------- -// -CEqualizerPresetsDialog::CEqualizerPresetsDialog( - CAudioEqualizerUtility* aAudEqUtility, - MEqualizerPresetActivationObserver& aEqrPresetActObserver): - - iAudEqUtility(aAudEqUtility), - iEqrPresetActObserver(aEqrPresetActObserver) - { - } - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog::ConstructL() -// Second Phase Constructor -// ------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::ConstructL(const TInt aCurrentActivePreset) - { - //Initially set these variable to EFalse - iContextSensitiveMenu = EFalse; - iIgnoreKeyEvents = EFalse; - - iRepository = CRepository::NewL(KCRUidMusicPlayerSettings); - - //Add the resource file - - // Find which drive this DLL is installed. - TFileName fileName; - // Get the full resource file - TParse fp; - // Add the resource dir - fp.Set( KEqualizerResourceFileName, &KDC_APP_RESOURCE_DIR, NULL); - // Get the filename with full path - fileName = fp.FullName(); - //for localisation of resource file - BaflUtils::NearestLanguageFile( iEikonEnv->FsSession(), fileName ); - iResourceFileOffset = iEikonEnv->AddResourceFileL( fileName ); - - //Read text for preset "None" from rss file - iPresetNoneText = StringLoader::LoadL(R_QTN_EQUALIZER_PRESET_NONE); - iTitleText = StringLoader::LoadL(R_QTN_EQUALIZER_TITLE_TEXT); - - iItemArray = CEqualizerPresetListArray::NewL(iAudEqUtility, - aCurrentActivePreset); - - iItemArray->GetCurrentActivePreset(iActivePreset); - - CAknDialog::ConstructL(R_EQUALIZER_CONTAINER_MENUBAR); - } - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog::~CEqualizerPresetsDialog() -// Destructor -// -------------------------------------------------------------------- -// -CEqualizerPresetsDialog::~CEqualizerPresetsDialog() - { - if (iResourceFileOffset) - { - iEikonEnv->DeleteResourceFile(iResourceFileOffset); - } - delete iRepository; - if (iAppTitleText) - { - // restore musicplayer's title - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid(EEikStatusPaneUidTitle)); - tp->SetTextL(*iAppTitleText); - delete iAppTitleText; - } - delete iPresetNoneText; - delete iTitleText; - delete iItemArray; - } - -// -------------------------------------------------------------------------- -// void CEqualizerPresetsDialog::BuildPresetNameL( TDes& aName) const -// Returns free folder name -// -------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::BuildPresetNameL( TDes& aName) const - { - //set name in the query box to "Preset" - HBufC* defaultText = StringLoader::LoadLC( - R_QTN_EQ_PRESET_DEFAULT_NAME); - - TInt n(0); - - // Numbers start from 1 - TBool found( EFalse ); - TBuf number; - - // The loop is iterated until a free folder name is found. - FOREVER - { - found = EFalse; - // Constructs a candidate for the name - TBuf newName; - newName.Copy( *defaultText ); - - if( n > 0 ) - // First new is without number ( New folder, New folder(01), New folder(02), ...) - { - // Creates the current number. - number.Format( KEqrFormat, n ); - AknTextUtils::LanguageSpecificNumberConversion ( number ); - - TInt leadingZeroLength( 0 ); - if( n < 10 ) - { - leadingZeroLength = KEqrZero().Length(); - } - - // checks the total length of the costructed string - if( ( number.Length() + newName.Length() + KEqrParenthesis().Length() - + leadingZeroLength ) > KMaxPresetNameLength ) - { - User::Leave( KErrOverflow ); - } - - // Appends the first parenthesis - newName.Append( KEqrParenthesis ); - if( n < 10 ) - { - // Appends the leading zero ( always two digits 08, 09, 10, 11,...) - TBuf< 16 > zero(KEqrZero); - AknTextUtils::DisplayTextLanguageSpecificNumberConversion( zero ); - newName.Append( KEqrZero ); - } - newName.Append( number ); - } - found = SearchPresetL(newName); - - if( found == KErrNotFound ) - { - aName = newName; - CleanupStack::PopAndDestroy( defaultText); - return; - } - n++; - } - } - -// ----------------------------------------------------------------------- -// CEqualizerPresetsDialog::GetNewName(TInt aResourceId, TDes& presetName) -// -// This function is called to display the dialog box to get a new name -// during "Raname" or "Create new" -// ----------------------------------------------------------------------- -// -TBool CEqualizerPresetsDialog::GetNewNameL(const TInt aResourceId, TDes& -aPresetName) const - { - CAknTextQueryDialog* dlg; - TBool ret = EFalse; - - while (1) - { - dlg = CAknTextQueryDialog::NewL(aPresetName); - if (dlg->ExecuteLD(aResourceId)) - { - // Illegal characters in a preset name are < > \" \\ / | : * ?" - - if ( (aPresetName.FindC( KEqrLessThan ) != KErrNotFound ) || - (aPresetName.FindC( KEqrGreaterThan ) != KErrNotFound ) || - (aPresetName.FindC( KEqrQuote ) != KErrNotFound ) || - (aPresetName.FindC( KEqrBackSlash ) != KErrNotFound ) || - (aPresetName.FindC( KEqrForwardSlash ) != KErrNotFound ) || - (aPresetName.FindC( KEqrOrSymbol ) != KErrNotFound ) || - (aPresetName.FindC( KEqrColon ) != KErrNotFound ) || - (aPresetName.FindC( KEqrAsterisk ) != KErrNotFound ) || - (aPresetName.FindC( KEqrQuestionMark ) != KErrNotFound ) - ) - { - HBufC* text = StringLoader::LoadLC( - R_QTN_FLDR_ILLEGAL_CHARACTERS); - CAknInformationNote* note = new( ELeave ) CAknInformationNote(ETrue); - note->ExecuteLD( *text ); - CleanupStack::PopAndDestroy(text); - continue; - } - - TInt error = SearchPresetL(aPresetName); - if (error != KErrNotFound) - { - // display error - HBufC* label = StringLoader::LoadLC( - R_QTN_FLDR_NAME_ALREADY_USED, aPresetName ); - CAknInformationNote* note = new( ELeave ) - CAknInformationNote( ETrue ); - note->ExecuteLD( *label ); - CleanupStack::PopAndDestroy(label); - continue; - } - // New name entered - ret = ETrue; - } - // Break, in case user Cancels the data query or - // enters a valid name - break; - } - return ret; - } - -// --------------------------------------------------------------------------- -// TPresetName CEqualizerPresetsDialog::GetHighlightedPresetInListBox() const -// This function returns the highlighted Preset in ListBox -// --------------------------------------------------------------------------- -// -TPresetName CEqualizerPresetsDialog::GetHighlightedPresetInListBox() const - { - TInt selectedIndex = iListBox->CurrentItemIndex(); - CTextListBoxModel* model = iListBox->Model(); - TPresetName selectedItem(model->ItemText(selectedIndex)); - TPresetName highlightedPreset = - selectedItem.Right(selectedItem.Length()- iItemArray->GetPrefixLength()); - return highlightedPreset; - } - -// --------------------------------------------------------------------------- -//void CEqualizerPresetsDialog::ActivateEqrPresetL(const TInt aIndex, -//const TDesC& aPreset) const -// -//This function is used for the activation of a preset -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::ActivateEqrPresetL(const TInt aIndex, -const TDesC& aPreset) - { - TInt err; - // Store activated preset in central repository - SetCurrentPreset(aPreset); - - // Set the active preset in the equalizer item array - iItemArray->SetCurrentActivePreset(aPreset); - - // Display Confirmation note - HBufC* activateNoteText = StringLoader::LoadLC( - R_QTN_EQ_NOTE_INFO_PRESET_ACTIVATED, aPreset); - CAknConfirmationNote* dialog = new(ELeave)CAknConfirmationNote(); - dialog->ExecuteLD(*activateNoteText); - CleanupStack::PopAndDestroy(activateNoteText); - - // Inform the engine - if (aPreset.Compare(*iPresetNoneText) == 0) - { - TRAP(err, iAudEqUtility->DisableEqualizerL()); - } - else - { - TRAP(err, iAudEqUtility->ApplyPresetL(GetEngineIndexL(aPreset))); - } - - if(!err) - { - iListBox->HandleItemAdditionL(); - iListBox->SetCurrentItemIndexAndDraw(aIndex); - // To prevent two tickmarks from appearing sometimes - iListBox->DrawNow(); - } - } - -// --------------------------------------------------------------------------- -//void CEqualizerPresetsDialog::RenameEqrPresetL(const TInt aIndex, -//const TDesC& aPreset) const -// -//This function is used for the renaming of a preset -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::RenameEqrPresetL(const TInt /*aIndex*/, -const TDesC& aPreset) - { - //Check if this is an active preset - TPresetName activePresetName = CurrentPreset(); - if (aPreset.Compare(activePresetName) == 0) - { - //Display Confirmation note - HBufC* renameText = StringLoader::LoadLC( - R_QTN_EQ_NOTE_ERR_PRESET_IN_USE_NO_RENAME); - CAknErrorNote* dialog = new(ELeave)CAknErrorNote(); - dialog->ExecuteLD(*renameText); - CleanupStack::PopAndDestroy(renameText); - } - else - { - TPresetName presetName; - presetName = aPreset; - TBool nameEnteredIsFine = - GetNewNameL(R_DIALOG_TEXT_RENAME_ITEM_NAME, presetName); - - if (nameEnteredIsFine) - { - TInt engineIndex = GetEngineIndexL(aPreset); - //Update Engine - iAudEqUtility->GetPresetL(engineIndex); - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - - iAudEqUtility->ModifyPresetL(engineIndex,presetName, - audioEqualizer); - - //Update listbox - // Sort the array of user-defined presets - iItemArray->UpdateSortedArrayL(); - iListBox->SetCurrentItemIndex(SearchPresetL(presetName)); - iListBox->DrawNow(); - } - } - } - -// --------------------------------------------------------------------------- -// void CEqualizerPresetsDialog::EditEqrPresetL(const TInt aIndex, -// const TDesC& aPreset) const -// -// This function is used for the editing of a preset -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::EditEqrPresetL(const TInt /*aIndex*/, -const TDesC& aPreset) - { - //Set application name in the title pane to preset name. - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid( - EEikStatusPaneUidTitle)); - tp->SetTextL(aPreset); - TInt engineIndex = GetEngineIndexL(aPreset); - //Update Engine - TBool isActivePreset = (aPreset==CurrentPreset()); - - DisplaySettingsL(iAudEqUtility, engineIndex, isActivePreset); - } - -// --------------------------------------------------------------------------- -// void CEqualizerPresetsDialog::CreateNewEqrPresetL(TInt& aIndex, -// TPresetName& aPreset) const -// -// This function is used for the creation of a new preset. -// @param aIndex The index of the preset in the ListBox. This is set -// to a the index in the ListBox if preset creation is successful. -// If the creation is unscuccessful, then the parameter is not changed. -// @param aPreset The name of the preset created -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::CreateNewEqrPresetL(TInt& aIndex, -TPresetName& aPreset) const - { - RFs fs; - User::LeaveIfError( fs.Connect() ); - CleanupClosePushL( fs ); - - if (SysUtil::FFSSpaceBelowCriticalLevelL(&fs,0)) - { - ShowDiskFullNoteL(); // Phone memory full, show note - } - else - { - TPresetName presetName; - BuildPresetNameL(presetName); - - TBool nameEnteredIsFine = GetNewNameL(R_DIALOG_TEXT_NEW_ITEM_NAME, - presetName); - - if (nameEnteredIsFine) - { - //Update Engine - CAudioEqualizer& audioEqualizer = iAudEqUtility->Equalizer(); - iAudEqUtility->CreatePresetL(presetName, audioEqualizer); - - //Set the level of all bands to 0. - TInt numFreqBand = audioEqualizer.NumberOfBands(); - for (TInt i = 0; i < numFreqBand; i++) - { - audioEqualizer.SetBandLevelL(i+1, 0); - } - - iItemArray->UpdateSortedArrayL(); - //Update AudioEqualizerUtility object, setting the level of all - // bands to 0 - iAudEqUtility->ModifyPresetL(GetEngineIndexL(presetName), - presetName, audioEqualizer); - - //Set the focus to the new preset - iListBox->HandleItemAdditionL(); - iListBox->SetCurrentItemIndex(SearchPresetL(presetName)); - iListBox->DrawNow(); - - aPreset = presetName; - aIndex = iItemArray->MdcaCount()-1; - } - } - CleanupStack::PopAndDestroy(); - } - -// --------------------------------------------------------------------------- -//void CEqualizerPresetsDialog::DeleteEqrPresetL(const TInt aIndex, -//const TDesC& aPreset) const -// -//This function is used for the deletion of a preset -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::DeleteEqrPresetL(const TInt aIndex, -const TDesC& aPreset) - { - //Check if this is an active preset - TPresetName activePresetName = CurrentPreset(); - if (aPreset.Compare(activePresetName) == 0) - { - //Display error note - HBufC* renameText = - StringLoader::LoadLC(R_QTN_EQ_NOTE_ERR_PRESET_IN_USE); - CAknErrorNote* dialog = new(ELeave)CAknErrorNote(); - dialog->ExecuteLD(*renameText); - CleanupStack::PopAndDestroy(renameText); - } - else - { - //Delete?\n%U" qtn.query.common.conf.delete? - HBufC* text = - StringLoader::LoadLC( R_QTN_QUERY_COMMON_CONF_DELETE, - aPreset); - - // Show confirmation note - CAknQueryDialog* dlg = CAknQueryDialog::NewL(); - TInt result( - dlg->ExecuteLD( R_EQUALIZER_CONFIRMATION_QUERY, *text ) ); - CleanupStack::PopAndDestroy(text); // text - - if ( result ) - { - //Update Engine - iAudEqUtility->DeletePresetL(GetEngineIndexL(aPreset)); - //Remove from listbox - iItemArray->UpdateSortedArrayL(); - iListBox->HandleItemRemovalL(); - // This is to avoid the gap observed when the last entry present - // in the Preset List is deleted - iListBox->SetCurrentItemIndexAndDraw(0); - //If we are at the last preset set focus to the next preset - // else the previous preset - if (aIndex == iItemArray->MdcaCount()) - { - iListBox->SetCurrentItemIndexAndDraw(aIndex - 1); - } - else - { - iListBox->SetCurrentItemIndexAndDraw(aIndex); - } - iListBox->DrawNow(); - } - } - } - -// ------------------------------------------------------------------- -// TInt CEqualizerPresetsDialog::GetEngineIndexL -// (const TPresetName& aPresetName) -// -// This function is called to find the index of a preset in the list of -// presets returned by CAudioEqualizerUtility::Presets() -// -------------------------------------------------------------------- -// -TInt CEqualizerPresetsDialog::GetEngineIndexL(const TPresetName& aPresetName) const - { - TInt engineIndex = KErrNotFound; - TInt count; - - TArray presets = iAudEqUtility->Presets(); - TInt numPredefinedPresets = iAudEqUtility->NumberOfPreDefinedPresets(); - TInt numPresets = presets.Count(); - for (count = 0; count < numPresets; count++) - { - TPresetName selectedItem = iItemArray->MdcaPoint(count+1); - TPresetName presetName = selectedItem.Right( - selectedItem.Length() - iItemArray->GetPrefixLength()); - - - if (((count < numPredefinedPresets) && (presetName == aPresetName)) - || (presets[count].iPresetName == aPresetName)) - { - engineIndex = count; - } - } - if (engineIndex == KErrNotFound) - { - // Leave if this function is called for preset "None" or a preset - // which is there in the ListBox but not in the Engine. - User::Leave(KErrArgument); - } - - return engineIndex; - } - -// ----------------------------------------------------------------------- -// CEqualizerPresetsDialog::DisplaySettingsL -// (CAudioEqualizerUtility *aAudEqUtility, TInt aIndex, -// const TBool aIsActivePreset)) const -// -// This function is used to display the current equalizer settings -// by creating a new dialog. The dialog can also be used for editing, etc. -// of the settings. -// ------------------------------------------------------------------------ -// -void CEqualizerPresetsDialog::DisplaySettingsL(CAudioEqualizerUtility* - aAudEqUtility, const TInt aIndex, const TBool aIsActivePreset) - { - TRect rect = Rect(); - - TInt item; - TPresetName preset = GetHighlightedPresetInListBox(); - iItemArray->GetPresetKeyFromLocalisedName(item, preset); - iEditingDialog = CEqualizerEditingDialog::NewL(aAudEqUtility, - aIndex, rect, aIsActivePreset,iEqrPresetActObserver, item); - iEditingDialog->ExecuteLD(); - iEditingDialog = NULL; - } - -// -------------------------------------------------------------- -// CEqualizerPresetsDialog::CurrentPreset() -// This function is used to read the currently active preset from -// the central repository -// -------------------------------------------------------------- -// -TPresetName CEqualizerPresetsDialog::CurrentPreset() const - { - TInt res = 0; - TPresetName preset; - User::LeaveIfError(iRepository->Get(KMPlayerEqPresetId, res)); - iItemArray->GetLocalisedPresetNameFromKey(res,preset ); - return preset; - } - -// ---------------------------------------------------------------- -// CEqualizerPresetsDialog::SetCurrentPreset(const TPtrC& aPreset) -// This function is used to store the currently active preset into -// the central repository -// ---------------------------------------------------------------- -// -void CEqualizerPresetsDialog::SetCurrentPreset(const TPresetName& aPreset) - { - TInt activePresetKey; - iActivePreset = aPreset; - iItemArray->GetPresetKeyFromLocalisedName(activePresetKey, aPreset); - iEqrPresetActObserver.HandlePresetActivation(activePresetKey); - } - -// ---------------------------------------------------------------------------- -// CEqualizerPresetsDialog::SearchPresetL(const TPresetName& aPreset) const -// This function is used to search for a preset name in the ListBox. -// It return the index of the preset, if found and KErrNotFound if not found. -// ---------------------------------------------------------------------------- -// -TInt CEqualizerPresetsDialog::SearchPresetL(const TPresetName& aPreset) const - { - TInt ret = KErrNotFound; - iItemArray->UpdateSortedArrayL(); - - for (TInt i=0; iMdcaCount(); i++) - { - TPresetName selectedItem = iItemArray->MdcaPoint(i); - TPresetName presetName = selectedItem.Right(selectedItem.Length() - iItemArray->GetPrefixLength()); - - if (aPreset == presetName) - { - ret = i; - break; - } - } - return ret; - } - -// ---------------------------------------------------------------------------- -// CEqualizerPresetsDialog::SetAudioEqualizerL(CAudioEqualizerUtility* -// aAudEqUtility) -// This function is used to set a new CAudioEqualizerUtility* -// ---------------------------------------------------------------------------- -// -EXPORT_C void CEqualizerPresetsDialog::SetAudioEqualizerL( -CAudioEqualizerUtility* aAudEqUtility) - { - iAudEqUtility=aAudEqUtility; - if (iItemArray) - { - iItemArray->SetAudioEqualizer(iAudEqUtility); - } - - if (iEditingDialog) - { - iEditingDialog->SetAudioEqualizerL(iAudEqUtility); - } - - - if (iAudEqUtility) - { - iIgnoreKeyEvents = EFalse; - } - else - { - iIgnoreKeyEvents = ETrue; - } - } - -// ---------------------------------------------------------------------- -// CEqualizerPresets::GetListBoxIconsL() -// This function is used to load the lisitbox icons into an array -// ---------------------------------------------------------------------- -// -CArrayPtr* CEqualizerPresetsDialog::GetListBoxIconsL() const - { - // Get the icon array and deleted if already exists. Memory leak error. - CArrayPtr* previcons = iListBox->ItemDrawer()->ColumnData()->IconArray(); - if( previcons ) - { - previcons->ResetAndDestroy(); - delete previcons; - previcons = NULL; - } - - // CGulIcon class packages two bitmaps: icon image and its mask - // CAknIconArray inherits from CArrayPtrFlat - CArrayPtr* iconList = new (ELeave) - CAknIconArray(KEqualizerArrayGranularity); - CleanupStack::PushL(iconList); - - // Find which drive this DLL is installed. - TFileName fileName; - // Get the full resource file - TParse fp; - // Add the resource dir - fp.Set( KIconsFilename, &KDC_APP_BITMAP_DIR, NULL); - - // Get the filename with full path - fileName = fp.FullName(); - - MAknsSkinInstance* skinInstance; - CFbsBitmap* newIconBmp = NULL; - CFbsBitmap* newIconBmpMask = NULL; - CGulIcon* newIcon = NULL; - - skinInstance = AknsUtils::SkinInstance(); - - //creating blank icon - AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropEmpty, - newIconBmp,newIconBmpMask,fileName, - EMbmEqualizerEmpty13x13, - EMbmEqualizerEmpty13x13_mask); - - newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask); - - CleanupStack::Pop(2); - CleanupStack::PushL(newIcon); - iconList->AppendL(newIcon); - - CleanupStack::Pop(); - - //creating TICK mark icon - AknsUtils::CreateIconLC(skinInstance,KAknsIIDQgnPropPslnActive, - newIconBmp,newIconBmpMask,fileName, - EMbmEqualizerQgn_prop_psln_active, - EMbmEqualizerQgn_prop_psln_active_mask); - - - newIcon = CGulIcon::NewL(newIconBmp,newIconBmpMask); - - CleanupStack::Pop(2); - CleanupStack::PushL(newIcon); - iconList->AppendL(newIcon); - - CleanupStack::Pop(); - - CleanupStack::Pop(iconList); - - newIconBmp = NULL; - newIconBmpMask = NULL; - newIcon = NULL; - - return iconList; - } - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog::ExecuteLD() -// -// This function is called to create a dialog -// to display the preset list view of the equalizer -// -------------------------------------------------------------------- -// -EXPORT_C TInt CEqualizerPresetsDialog::ExecuteLD() - { - TInt ret = CAknDialog::ExecuteLD(R_EQUALIZER_DIALOG); - return ret; - } - -// --------------------------------------------------------------------------- -// void CEqualizerPresetsDialog::PreLayoutDynInitL(void) -// This function is called just before the dialog is displayed -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::PreLayoutDynInitL(void) - { - - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid( - EEikStatusPaneUidTitle)); - // Store the Application's title text - iAppTitleText = tp->Text()->AllocL(); - - // Set preset name in the title pane - tp->SetTextL(*iTitleText); - - iPreviousStatusPaneLayout = sp->CurrentLayoutResId(); - - if ( sp ) - { - if ( R_AVKON_STATUS_PANE_LAYOUT_USUAL != iPreviousStatusPaneLayout ) - { - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); - } - } - iListBox= (CAknSingleGraphicStyleListBox*)Control(ESelectionListControl); - iListBox->ItemDrawer()->ColumnData()->SetIconArray(GetListBoxIconsL()); - - // Set item array to listbox model - iListBox->Model()->SetItemTextArray(iItemArray); - // Item array is not owned by ListBox so it has to be freed. - iListBox->Model()->SetOwnershipType(ELbmDoesNotOwnItemArray); - - // - // Create a scrollbar that will be displayed automatically - // if all the items cannot be displayed on screen - // - iListBox->CreateScrollBarFrameL(ETrue); - iListBox->ScrollBarFrame()->SetScrollBarVisibilityL( - CEikScrollBarFrame::EOff,CEikScrollBarFrame::EAuto); - // Set focus to the currently active preset - -#ifdef RD_SCALABLE_UI_V2 - iListBox->SetListBoxObserver(this); -#endif //RD_SCALABLE_UI_V2 - TPresetName currentPreset = CurrentPreset(); - - TInt cur = SearchPresetL(currentPreset); - if (cur == KErrNotFound) //Some preset should always be active - { - User::Leave(KErrNotSupported); - } - iListBox->SetCurrentItemIndexAndDraw(cur); - - } - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog::OkToExitL(TInt aButtonId) -// -// This function is called when the user presses the selection key -// for displaying context sesitive menu -// -------------------------------------------------------------------- -// -TBool CEqualizerPresetsDialog::OkToExitL(TInt aButtonId) - { - TBool ret = EFalse; - if (aButtonId == EEikBidOk) - { - iContextSensitiveMenu = ETrue; - DisplayMenuL(); - } - else if (aButtonId == EAknSoftkeyBack) - { - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid( - EEikStatusPaneUidTitle)); - - if (iAppTitleText) - { - //set application name in the title pane - tp->SetTextL(*iAppTitleText); - } - ret = CAknDialog::OkToExitL( aButtonId ); - } - else if (aButtonId == EAknSoftkeySelect) - { - const TInt index = iListBox->CurrentItemIndex(); - TPresetName preset = GetHighlightedPresetInListBox(); - ActivateEqrPresetL(index, preset); - } - else - { - ret = CAknDialog::OkToExitL( aButtonId ); - } - - if ( ret ) - { - // Restore landscape layout - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - if( Layout_Meta_Data::IsLandscapeOrientation() ) - { - if ( sp && KErrNone != iPreviousStatusPaneLayout ) - { - if ( sp->CurrentLayoutResId() != R_AVKON_STATUS_PANE_LAYOUT_USUAL ) - { - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL ); - } - } - } - else - { - CAknLocalScreenClearer* clearer = CAknLocalScreenClearer::NewLC( ETrue ); - sp->SwitchLayoutL( R_AVKON_STATUS_PANE_LAYOUT_USUAL_FLAT ); - CleanupStack::PopAndDestroy( clearer ); - } - } - return ret; - } - -// ------------------------------------------------------------------- -// void CEqualizerPresetsDialog::SizeChanged() -// -// This function is called by the framework whenever there is a change -// in the size of the control -// ------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::SizeChanged() - { - TRect rect = Rect(); - //Getting the layout for the list box - AknLayoutUtils::LayoutControl(iListBox, rect, AknLayout::list_gen_pane(1)); - CAknDialog::SizeChanged(); - } - -// ------------------------------------------------------------------- -// void CEqualizerPresetsDialog::HandleForegroundEventL( TBool aForeground) -// -// Handles changes to the application -// when it switches to or from the foreground. -// ------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::HandleForegroundEventL( TBool aForeground) - { - if (aForeground) - { - CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane(); - CAknTitlePane* tp=(CAknTitlePane*)sp->ControlL(TUid::Uid( - EEikStatusPaneUidTitle)); - tp->SetTextL(*iTitleText); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerPresetsDialog::FocusChanged(TDrawNow aDrawNow) -// -// Responds to a change in focus. -// This is called whenever the control gains or loses focus -// ------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::FocusChanged(TDrawNow /*aDrawNow*/) - { - iItemArray->UpdateSortedArrayL(); - TPresetName currentPreset = CurrentPreset(); - iItemArray->SetCurrentActivePreset(currentPreset); - - if(iListBox) - { - iListBox->HandleItemAdditionL(); - } - } - -// ------------------------------------------------------------------- -// void CEqualizerFreqBand::HandleResourceChangeL(TInt aType) -// -// This function is called by the framework whenever there is a -// change in skin or layout -// ------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::HandleResourceChangeL(TInt aType) - { - if (aType == KAknsMessageSkinChange) - { - //Creating the icons for the new Skin - iListBox->ItemDrawer()->ColumnData()->SetIconArray(GetListBoxIconsL()); - iListBox->HandleResourceChange(aType); - } - - else if (aType == KEikDynamicLayoutVariantSwitch) - { - TRect rect; - AknLayoutUtils::LayoutMetricsRect(AknLayoutUtils::EMainPane, rect); - SetRect(rect); - } - - } - -void CEqualizerPresetsDialog::HandleResourceChange(TInt aType) - { - CAknDialog::HandleResourceChange( aType ); - HandleResourceChangeL(aType); - } - -// --------------------------------------------------------- -// CEqualizerPresetsDialog::OfferKeyEventL( -// const TKeyEvent& aKeyEvent,TEventCode aType) -// This function is used to handle key events -// --------------------------------------------------------- -// -TKeyResponse CEqualizerPresetsDialog::OfferKeyEventL( - const TKeyEvent& aKeyEvent, - TEventCode aType ) - { - if (iIgnoreKeyEvents) - { - return EKeyWasNotConsumed; - } - if (aType == EEventKey) - { - if (aKeyEvent.iCode == EKeyBackspace) - { - // Find the preset highlighted - const TInt listBoxIndex = iListBox->CurrentItemIndex(); - - // pre-defined presets cannot be deleted. - // preset "None" is not stored in engine. - if (listBoxIndex > (TInt) - (iAudEqUtility->NumberOfPreDefinedPresets())) - { - TPresetName preset = GetHighlightedPresetInListBox(); - DeleteEqrPresetL(listBoxIndex, preset); - } - return EKeyWasConsumed; - } - } - return CAknDialog::OfferKeyEventL( aKeyEvent, aType ); - } - -// --------------------------------------------------------------------------- -// CEqualizerPresetsDialog::DynInitMenuPaneL( -// TInt aResourceId,CEikMenuPane* aMenuPane) -// This function is called by the EIKON framework just before it displays -// a menu pane. Its default implementation is empty, and by overriding it, -// the application can set the state of menu items dynamically according -// to the state of application data. -// --------------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::DynInitMenuPaneL( - TInt aResourceId, CEikMenuPane* aMenuPane) - { - TPresetName selectedItem = GetHighlightedPresetInListBox(); - - TInt selectedIndex = iListBox->CurrentItemIndex(); - TInt numberOfPreDefinedPresets = - iAudEqUtility->NumberOfPreDefinedPresets(); - - if ( aResourceId == R_EQUALIZER_CONTAINER_MENU) - { - //Is the menubar invoked from Options menu or selection key? - if (iContextSensitiveMenu == EFalse) - { - // The menubar is invoked from Options menu - iMenuBar->SetMenuType(CEikMenuBar::EMenuOptions); - // The selected preset is "None" - if (selectedItem.Compare(*iPresetNoneText) == 0) - { - aMenuPane->SetItemDimmed(EEqualizerCmdRename, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdDelete, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdEdit, ETrue); - } - // The selected preset is a pre defined preset other than "None" - if (selectedIndex <= numberOfPreDefinedPresets) - { - aMenuPane->SetItemDimmed(EEqualizerCmdRename, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdDelete, ETrue); - } - // Help should be displayed only if the feature is supported - // according to Feature Manager - if (!FeatureManager::FeatureSupported(KFeatureIdHelp)) - { - aMenuPane->SetItemDimmed(EEqualizerCmdHelp, ETrue); - } - } - else - { - // The menubar is invoked from selection key - iMenuBar->SetMenuType(CEikMenuBar::EMenuContext); - // These Options are always hidden - aMenuPane->SetItemDimmed(EEqualizerCmdDelete, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdRename, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdCreateNew, ETrue); - aMenuPane->SetItemDimmed(EEqualizerCmdHelp, ETrue); - aMenuPane->SetItemDimmed(EAknCmdExit, ETrue); - - // The selected preset is "None" - if (selectedItem.Compare(*iPresetNoneText) == 0) - { - aMenuPane->SetItemDimmed(EEqualizerCmdEdit, ETrue); - } - iContextSensitiveMenu = EFalse; - } - } - } - -// ------------------------------------------------------------------- -// CEqualizerPresetsDialog::ProcessCommandL(TInt aCommandId ) -// -// This function is called to process the menubar command in a dialog -// -------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::ProcessCommandL(TInt aCommandId ) - { - // Need to do this in all cases or menu does not disappear after - // a selection is made - CAknDialog::ProcessCommandL(aCommandId); - - // Find the preset highlighted - const TInt index = iListBox->CurrentItemIndex(); - TPresetName preset = GetHighlightedPresetInListBox(); - - switch(aCommandId) - { - case EAknCmdExit : - case EEikCmdExit : - { - iAvkonAppUi->HandleCommandL( aCommandId ); - break; - } - case EEqualizerCmdEdit: - { - EditEqrPresetL(index, preset); - break; - } - case EEqualizerCmdActivate: - { - ActivateEqrPresetL(index, preset); - break; - } - case EEqualizerCmdCreateNew: - { - TInt presetIndex = -1; - TPresetName presetName; - - CreateNewEqrPresetL(presetIndex, presetName); - - if (presetIndex != -1) - { - // A valid preset name has been entered - EditEqrPresetL(presetIndex, presetName); - } - break; - } - - case EEqualizerCmdDelete: - { - DeleteEqrPresetL(index, preset); - break; - } - - case EEqualizerCmdRename: - { - RenameEqrPresetL(index, preset); - break; - } - - case EEqualizerCmdHelp: - { - HlpLauncher::LaunchHelpApplicationL - ( iEikonEnv->WsSession(), - CEikonEnv::Static()->AppUi()->AppHelpContextL() ); - break; - } - - default: - { - break; - } - } - } - -// ------------------------------------------------------------------- -// void CEqualizerPresetsDialog::GetHelpContext( -// TCoeHelpContext& aContext ) const -// Get help context for the control -// -------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::GetHelpContext( - TCoeHelpContext& aContext ) const - { - aContext.iMajor = KUidEqualizer; - aContext.iContext = KEQ_HLP_LIST_VIEW; - } - -// ------------------------------------------------------------------- -// void CEqualizerPresetsDialog::ShowDiskFullNoteL() -// This function is used to display a note to the user if -// memory is below critical level when creating a new preset. -// -------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::ShowDiskFullNoteL() const - { - HBufC* message = NULL; - message = StringLoader::LoadLC(R_QTN_MEMLO_NOT_ENOUGH_MEMORY); - - CAknGlobalNote* note = CAknGlobalNote::NewLC(); - note->SetSoftkeys(R_AVKON_SOFTKEYS_OK_EMPTY); - note->ShowNoteL(/*status,*/ EAknGlobalErrorNote, *message); - - CleanupStack::PopAndDestroy(note); // note, message - CleanupStack::PopAndDestroy(message); // note, message - } - -#ifdef RD_SCALABLE_UI_V2 -// ------------------------------------------------------------------- -// void CEqualizerPresetsDialog::HandleListBoxEventL -// This function callback from MEikListBoxObserver when a listbox item -// is double clicked using a pen input . -// -------------------------------------------------------------------- -// -void CEqualizerPresetsDialog::HandleListBoxEventL( - CEikListBox* /*aListBox*/, - TListBoxEvent aEventType ) - { - switch ( aEventType ) - { -#ifdef SINGLE_CLICK_INCLUDED - case EEventItemSingleClicked: -#endif - case EEventItemDoubleClicked: - { - const TInt index = iListBox->CurrentItemIndex(); - TPresetName preset = GetHighlightedPresetInListBox(); - ActivateEqrPresetL(index, preset); - break; - } - default: - break; - } - } -#endif //RD_SCALABLE_UI_V2 -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/group/bld.inf --- a/mmserv/audioeffectsui/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: Build information file for equalizer -* -*/ - - - - -PRJ_PLATFORMS -DEFAULT - -PRJ_EXPORTS - -PRJ_MMPFILES -#include "../equalizer/group/bld.inf" - - -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/audioeffectsui/inc/audioeffectsuibldvariant.hrh --- a/mmserv/audioeffectsui/inc/audioeffectsuibldvariant.hrh Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* -* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: bldvariant headers for project audioeffectsui -* -*/ - - - -#ifndef AUDIOEFFECTSUIBLDVARIANT_HRH -#define AUDIOEFFECTSUIBLDVARIANT_HRH - - -#define IAD_INCLUDE_SINGLE_CLICK - - -#endif // AUDIOEFFECTSUIBLDVARIANT_HRH - -// End of File \ No newline at end of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/metadatautility/Src/MetaDataParserWMA.cpp --- a/mmserv/metadatautility/Src/MetaDataParserWMA.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/metadatautility/Src/MetaDataParserWMA.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -11,8 +11,7 @@ * * Contributors: * -* Description: This class implements an ID3v1 and v1.1 parser as specified in -* www.id3.org. +* Description: This class implements a wma parser * */ @@ -42,9 +41,12 @@ * Preroll, QWORD, 64 * Flags, DWORD, 32 */ -const TInt KDurationOffset = 64; // duration offset from File Property object -const TInt KPrerollOffset = 80; // preRoll offset from File Property object -const TInt KFlagsOffset = 88; // flags offset from File Property object +const TInt KDurationOffset = 64; // duration offset in File Property object +const TInt KPrerollOffset = 80; // preRoll offset in File Property object +const TInt KFlagsOffset = 88; // flags offset in File Property object +const TInt KSampleRateOffset = 82; // sample rate offset in stream properties object +const TInt KBitRateOffset = 86; // bit rate offset in stream properties object + // ASF Header Object GUIDs @@ -70,6 +72,7 @@ #ifdef __WINDOWS_MEDIA _LIT(KWMProvider, "WM/Provider\0"); #endif +_LIT8 (KASFStreamPropertiesObject, "B7DC0791A9B711CF8EE600C00C205365"); // ============================ MEMBER FUNCTIONS =============================== @@ -125,10 +128,10 @@ // Destructor CMetaDataParserWMA::~CMetaDataParserWMA() - { - delete iHeaderData; - delete iCharacterSet; - iFs.Close(); + { + delete iHeaderData; + delete iCharacterSet; + iFs.Close(); } // ----------------------------------------------------------------------------- @@ -183,6 +186,8 @@ #ifdef __WINDOWS_MEDIA TRAP(err, GetExtContDesEntryL(EMetaDataVendor, iProviderOffset)); #endif + TRAP(err, GetSampleRateL()); + TRAP(err, GetBitRateL()); } else { @@ -244,6 +249,12 @@ case EMetaDataVendor: TRAP(err, GetExtContDesEntryL(EMetaDataVendor, iProviderOffset)); #endif + case EMetaDataSampleRate: + TRAP(err, GetSampleRateL()); + break; + case EMetaDataBitRate: + TRAP(err, GetBitRateL()); + break; default: break; } @@ -336,6 +347,12 @@ iHeaderExtensionObjectExists = ETrue; iHeaderExtensionOffset = objOffset; } + if(!iStreamPropertiesObjectExists && objGUID == + KASFStreamPropertiesObject) + { + iStreamPropertiesObjectExists = ETrue; + iStreamPropertiesOffset = objOffset; + } TBuf8<8> size = iHeaderData->Mid(objOffset + 16, 8); TInt objSize = ConvertToInt64(size); // upper 32 bits? if(0 > objSize) @@ -345,7 +362,8 @@ objOffset += objSize; if(objOffset >= headerSize - 30 || (iContentDescriptionObjectExists && iFilePropertiesObjectExists - && iExtendedContentDescriptionObjectExists && iHeaderExtensionObjectExists) ) + && iExtendedContentDescriptionObjectExists && iHeaderExtensionObjectExists + && iStreamPropertiesObjectExists) ) { loop = EFalse; } @@ -374,7 +392,7 @@ // ----------------------------------------------------------------------------- // void CMetaDataParserWMA::FormatGUID(TDes8 &aGUID) -{ + { TBuf8<16> copyGUID(aGUID); TInt i; for(i = 0; i < 4; i++) @@ -396,16 +414,16 @@ aGUID.Delete(0, 32); for(i = 0; i <16; i++) { - aGUID.AppendNumFixedWidthUC(copyGUID[i], EHex, 2); + aGUID.AppendNumFixedWidthUC(copyGUID[i], EHex, 2); } -} + } // ----------------------------------------------------------------------------- // CMetaDataParserWMA::ConvertToInt64 // ----------------------------------------------------------------------------- // TInt64 CMetaDataParserWMA::ConvertToInt64(TDesC8& aDes) -{ + { TInt64 num = 0; TInt i; for(i = 7 ; i >= 0; i--) @@ -414,14 +432,14 @@ num |= aDes[i]; } return num; -} + } // ----------------------------------------------------------------------------- // CMetaDataParserWMA::ConvertToInt32 // ----------------------------------------------------------------------------- // TInt CMetaDataParserWMA::ConvertToInt32(TDesC8& aDes) -{ + { TInt num = 0; for(TInt i = 3 ; i >= 0; i--) { @@ -429,7 +447,7 @@ num |= aDes[i]; } return num; -} + } // ----------------------------------------------------------------------------- @@ -437,7 +455,7 @@ // ----------------------------------------------------------------------------- // TInt CMetaDataParserWMA::ConvertToInt16(TDesC8& aDes) -{ + { TInt num = 0; for(TInt i = 1 ; i >= 0; i--) { @@ -445,7 +463,7 @@ num |= aDes[i]; } return num; -} + } // ----------------------------------------------------------------------------- // CMetaDataParserWMA::ConvertDes8toDes16 @@ -573,15 +591,15 @@ // ----------------------------------------------------------------------------- // void CMetaDataParserWMA::GetJpegL() -{ + { if (iPictureOffset <= 0) - { - return; - } + { + return; + } TInt offset = iPictureOffset; if(!iMetadatLibraryObjectJpegExists) - { + { TPtrC8 dataType = iHeaderData->Mid(offset, 2); offset += 2; TInt dataTypeInt = ConvertToInt16(dataType); @@ -603,28 +621,28 @@ TInt picType = 0; picType |= picData[0]; if(picType != 3) - { + { return; // only Front Album Cover supported - } + } TPtrC8 picLengthData = iHeaderData->Mid(offset, 4); offset += 4; TInt picLength = ConvertToInt32(picLengthData); if(picLength <= 0) - { + { return; - } + } _LIT8(KNULL, "\0\0"); TPtrC8 data = iHeaderData->Mid(offset, picLength); TInt pos = data.Find(KNULL); if(pos != 0) - { + { pos++; // for unicode coding for strings. - } + } // check mime type if(pos != KErrNotFound) - { + { HBufC8 *mimeType = iHeaderData->Mid(offset, pos + 2).AllocLC(); offset += pos + 2; HBufC* name16 = HBufC::NewLC( (pos+2)/2); @@ -633,26 +651,26 @@ _LIT(KJPEG, "image/jpeg\0"); _LIT(KJPG, "image/jpg\0"); if(mimeType16.Compare(KJPEG) != 0 && mimeType16.Compare(KJPG) != 0) - { + { CleanupStack::PopAndDestroy(2, mimeType); return; // only JPEG & JPG supported - } + } CleanupStack::PopAndDestroy(2); // mimeType16, mimeType - } + } // skip the picture description TPtrC8 picDesc = iHeaderData->Mid(offset, picLength); pos = picDesc.Find(KNULL); if(pos != 0) - { + { pos++; // for unicode coding for strings. - } + } offset += pos + 2; // picture data TPtrC8 pic8 = iHeaderData->Mid(offset, picLength); iContainer->AppendL( EMetaDataJpeg, pic8 ); -} + } // ----------------------------------------------------------------------------- @@ -660,7 +678,7 @@ // ----------------------------------------------------------------------------- // TBool CMetaDataParserWMA::GetExtContDesEntryL(TMetaDataFieldId aFieldId, TInt aOffset) -{ + { TBool ret = EFalse; if(iExtendedContentDescriptionCount == 0) { @@ -705,7 +723,7 @@ ret = ETrue; } return ret; -} + } // ----------------------------------------------------------------------------- // CMetaDataParserWMA::GetDurationL @@ -757,7 +775,7 @@ TDes16& aUnicode ) { TPtrC8 unicodeData; - TUint characterSetId = 0; + TUint characterSetId = 0; CCnvCharacterSetConverter* charSetConv = CCnvCharacterSetConverter::NewLC(); TInt state = CCnvCharacterSetConverter::KStateDefault; @@ -784,17 +802,17 @@ // void CMetaDataParserWMA::ParseContentDescriptionObject() { - TBuf8<2> data = iHeaderData->Mid(iContentDescriptionOffset + 24, 2); - iTitleLength = ConvertToInt16(data); - data = iHeaderData->Mid(iContentDescriptionOffset + 26, 2); - iAuthorLength = ConvertToInt16(data); - data = iHeaderData->Mid(iContentDescriptionOffset + 28, 2); - iCopyrightLength = ConvertToInt16(data); - data = iHeaderData->Mid(iContentDescriptionOffset + 30, 2); - iDescriptionLength = ConvertToInt16(data); - data = iHeaderData->Mid(iContentDescriptionOffset + 32, 2); - iRatingLength = ConvertToInt16(data); - return; + TBuf8<2> data = iHeaderData->Mid(iContentDescriptionOffset + 24, 2); + iTitleLength = ConvertToInt16(data); + data = iHeaderData->Mid(iContentDescriptionOffset + 26, 2); + iAuthorLength = ConvertToInt16(data); + data = iHeaderData->Mid(iContentDescriptionOffset + 28, 2); + iCopyrightLength = ConvertToInt16(data); + data = iHeaderData->Mid(iContentDescriptionOffset + 30, 2); + iDescriptionLength = ConvertToInt16(data); + data = iHeaderData->Mid(iContentDescriptionOffset + 32, 2); + iRatingLength = ConvertToInt16(data); + return; } @@ -1006,4 +1024,65 @@ } } +// ----------------------------------------------------------------------------- +// CMetaDataParserWMA::GetSampleRateL +// ----------------------------------------------------------------------------- +// +void CMetaDataParserWMA::GetSampleRateL() + { +#ifdef _DEBUG + RDebug::Print(_L("CMetaDataParserWMA::GetSampleRateL")); +#endif + if(!iStreamPropertiesObjectExists) + { + return; + } + TInt offset = iStreamPropertiesOffset + KSampleRateOffset; + TPtrC8 sampleRate = iHeaderData->Mid(offset, 4); + if(offset+4 > iHeaderData->Length()) //Header Size is too small + { + return ; + } + + TInt sampleRateValue = ConvertToInt32(sampleRate); + TBuf16<20> des16; + des16.Num(sampleRateValue); // convert to string + + iContainer->AppendL( EMetaDataSampleRate, des16 ); + +#ifdef _DEBUG + RDebug::Print(_L("CMetaDataParserWMA::GetSampleRateL(), SampleRate=%S"), &des16); +#endif + } + +// ----------------------------------------------------------------------------- +// CMetaDataParserWMA::GetBitRateL +// ----------------------------------------------------------------------------- +// +void CMetaDataParserWMA::GetBitRateL() + { +#ifdef _DEBUG + RDebug::Print(_L("CMetaDataParserWMA::GetBitRateL")); +#endif + if(!iStreamPropertiesObjectExists) + { + return; + } + TInt offset = iStreamPropertiesOffset + KBitRateOffset; + if(offset+4 > iHeaderData->Length()) //Header Size is too small + { + return ; + } + TPtrC8 byteRate = iHeaderData->Mid(offset, 4); // byte rate + + TInt bitRateValue = ConvertToInt32(byteRate) * 8; // multiply by 8 to get bit rate + TBuf16<20> des16; + des16.Num(bitRateValue); // convert to string + + iContainer->AppendL( EMetaDataBitRate, des16 ); +#ifdef _DEBUG + RDebug::Print(_L("CMetaDataParserWMA::GetBitRateL(), bitRate=%S"), &des16); +#endif + } + // End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/metadatautility/Src/MetaDataParserWMA.h --- a/mmserv/metadatautility/Src/MetaDataParserWMA.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/metadatautility/Src/MetaDataParserWMA.h Fri Jul 09 16:43:35 2010 -0500 @@ -11,8 +11,7 @@ * * Contributors: * -* Description: This class implements an ID3v1 and v1.1 parser as specified in -* www.id3.org. +* Description: This class implements a wma parser * */ @@ -119,6 +118,18 @@ * @return void */ void GetDurationL(); + + /** + * Append sample rate to the container, if found. + * @return void + */ + void GetSampleRateL(); + + /** + * Append bit rate to the container, if found. + * @return void + */ + void GetBitRateL(); /** * Parses all entries in Content Description Object @@ -240,6 +251,9 @@ TBool iHeaderExtensionObjectExists; TBool iMetadataLibraryObjectExists; TBool iMetadatLibraryObjectJpegExists; + TBool iStreamPropertiesObjectExists; + + TInt iStreamPropertiesOffset; }; #endif // CMetaDataParserWMA_H diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/sts/inc/sts.h --- a/mmserv/sts/sts/inc/sts.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/sts/sts/inc/sts.h Fri Jul 09 16:43:35 2010 -0500 @@ -22,11 +22,16 @@ #ifndef STS_H_ #define STS_H_ + #include #include #include "stsplayer.h" +class MProEngEngine; +class MProEngProfile; + + class CSts : private MStsPlayerObserver { public: @@ -41,6 +46,8 @@ CSts(); virtual ~CSts(); bool Init(); + void LoadActiveProfileSettingsL(); + private: void CleanUpPlayers(); @@ -53,6 +60,16 @@ class CPlayerNode; typedef std::map TPlayerMap; TPlayerMap iPlayerMap; + + TPtrC iFileName; + MProEngEngine* iEngine; + MProEngProfile* iProfile; + + TInt iVolume; + TBool iWarningToneEnabled; + TUint iAudioPreference; + TUint iAudioPriority; + }; #endif //STS_H diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/sts/inc/stsplayer.h --- a/mmserv/sts/sts/inc/stsplayer.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/sts/sts/inc/stsplayer.h Fri Jul 09 16:43:35 2010 -0500 @@ -18,11 +18,10 @@ #ifndef STSPLAYER_H_ #define STSPLAYER_H_ -#include -#include -class MProEngEngine; -class MProEngProfile; +#include +#include + class MStsPlayerObserver { @@ -35,26 +34,28 @@ public: static CStsPlayer* CreateTonePlayer(MStsPlayerObserver& aObserver, - CSystemToneService::TToneType aTone, unsigned int aContext); + CSystemToneService::TToneType aTone, unsigned int aContext, + const TDesC& aFileName, TInt aVolume, + TUint aAudioPreference, TUint aAudioPriority); static CStsPlayer* CreateAlarmPlayer(MStsPlayerObserver& aObserver, - CSystemToneService::TAlarmType aAlarm, unsigned int aContext); + CSystemToneService::TAlarmType aAlarm, unsigned int aContext, + const TDesC& aFileName, TInt aVolume, + TUint aAudioPreference, TUint aAudioPriority); virtual ~CStsPlayer(); void Play(); void Stop(); - - -protected: + - void LoadActiveProfileSettingsL(); - void SetToneSettings(CSystemToneService::TToneType aTone); - void SetAlarmSettings(CSystemToneService::TAlarmType aAlarm); +protected: + CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName, - int aRepeatNumberOfTimes, unsigned int aContext); + int aRepeatNumberOfTimes, unsigned int aContext, + TInt aVolume, TUint aAudioPreference, TUint aAudioPriority); bool Init(); private: void MapcInitComplete(TInt aError, - const TTimeIntervalMicroSeconds& aDuration); + const TTimeIntervalMicroSeconds& aDuration); void MapcPlayComplete(TInt aError); MStsPlayerObserver& iObserver; @@ -63,14 +64,11 @@ int iRepeatNumberOfTimes; unsigned int iContext; - MProEngEngine* iEngine; - MProEngProfile* iProfile; - - TInt iVolume; + TInt iVolume; TBool iWarningToneEnabled; TUint iAudioPreference; TUint iAudioPriority; - + }; #endif // STSPLAYER_H_ diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/sts/src/sts.cpp --- a/mmserv/sts/sts/src/sts.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/sts/sts/src/sts.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -17,6 +17,15 @@ */ #include "sts.h" +#include +#include +#include +#include +#include +#include + +_LIT(KDefaultFile,"z:\\data\\sounds\\digital\\clock.aac"); + class CSts::CPlayerNode { @@ -66,15 +75,21 @@ /*static*/CSts* CSts::Create() { CSts* self = new CSts(); + if (self != 0) { bool successful = self->Init(); - if (!successful) - { + + if(successful) + { + TRAPD( err ,self->LoadActiveProfileSettingsL()); + if( (err != KErrNone ) && (!successful)) + { delete self; self = 0; - } + } } + } return self; } @@ -90,18 +105,112 @@ bool CSts::Init() { + iEngine = ProEngFactory::NewEngineL(); return true; } CSts::~CSts() { CleanUpPlayers(); + if (iProfile) + { + iProfile->Release(); + } + if (iEngine) + { + iEngine->Release(); + } + } + +void CSts::LoadActiveProfileSettingsL() + { + if(!iEngine) + { + iEngine = ProEngFactory::NewEngineL(); + } + + if (iEngine) + iProfile = iEngine->ActiveProfileL(); + + if (iProfile) + { + MProEngToneSettings& settings = iProfile->ToneSettings(); + iWarningToneEnabled = settings.WarningAndGameTones(); + } + + } + void CSts::PlayTone(CSystemToneService::TToneType aTone) { + if(iProfile) + + { + MProEngTones& tones = iProfile->ProfileTones(); + + switch (aTone) + { + case CSystemToneService::EEmailAlert: + { + iFileName.Set(tones.EmailAlertTone()); + iAudioPreference = KAudioPrefNewSMS; + iAudioPriority = KAudioPriorityRecvMsg ; + break; + } + case CSystemToneService::ESmsAlert: + { + iFileName.Set(tones.MessageAlertTone()); + iAudioPreference = KAudioPrefNewSMS; + iAudioPriority = KAudioPriorityRecvMsg; + break; + } + case CSystemToneService::EMmsAlert: + { + iFileName.Set(tones.MessageAlertTone()); + iAudioPreference = KAudioPrefNewSMS; + iAudioPriority = KAudioPriorityRecvMsg; + break; + } + case CSystemToneService::EChatAlert: + { + iFileName.Set(tones.MessageAlertTone()); + iAudioPreference = KAudioPrefNewSMS ; + iAudioPriority = KAudioPriorityRecvMsg; + break; + } + case CSystemToneService::EWarningBeep: + { + iAudioPreference = KAudioPrefWarning; + iAudioPriority = KAudioPriorityWarningTone ; + if (iWarningToneEnabled) + iFileName.Set(KDefaultFile); + else + iVolume = 0; + + break; + } + default: + { + iFileName.Set(KDefaultFile); + iAudioPreference = KAudioPrefDefaultTone; + iAudioPriority = KAudioPriorityWarningTone ; + break; + } + } + } + + else + { + iFileName.Set(KDefaultFile); + iAudioPreference = KAudioPrefDefaultTone; + iAudioPriority = KAudioPriorityWarningTone ; + } + + CStsPlayer* player = CStsPlayer::CreateTonePlayer(*this, aTone, - iNextContext); + iNextContext, iFileName, iVolume, + iAudioPreference, iAudioPriority); if (player != 0) { iPlayerMap[iNextContext] = new CPlayerNode(player); @@ -119,8 +228,55 @@ void CSts::PlayAlarm(CSystemToneService::TAlarmType aAlarm, unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver) { + + if(iProfile) + + { + MProEngTones& tones = iProfile->ProfileTones(); + + switch (aAlarm) + { + case CSystemToneService::EIncomingCall: + { + iFileName.Set(tones.RingingTone1()); + iAudioPreference = KAudioPrefIncomingCall ; + iAudioPriority = KAudioPriorityRingingTone ; + break; + } + case CSystemToneService::EIncomingCallLine2: + { + iFileName.Set(tones.RingingTone2()); + iAudioPreference = KAudioPrefIncomingCall; + iAudioPriority = KAudioPriorityRingingTone ; + break; + } + case CSystemToneService::EIncomingDataCall: + { + iFileName.Set(tones.VideoCallRingingTone()); + iAudioPreference = KAudioPrefIncomingDataCall; + iAudioPriority = KAudioPriorityRealOnePlayer; + break; + } + default: + { + iFileName.Set(KDefaultFile); + iAudioPreference = KAudioPrefAlarmClock ; + iAudioPriority = KAudioPriorityAlarm; + break; + } + } + } + else + { + iFileName.Set(KDefaultFile); + iAudioPreference = KAudioPrefDefaultTone; + iAudioPriority = KAudioPriorityWarningTone ; + + } + CStsPlayer* player = CStsPlayer::CreateAlarmPlayer(*this, aAlarm, - iNextContext); + iNextContext, iFileName, iVolume, + iAudioPreference, iAudioPriority); if (player != 0) { iPlayerMap[iNextContext] = new CPlayerNode(player, aObserver); diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/sts/src/stsplayer.cpp --- a/mmserv/sts/sts/src/stsplayer.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/sts/sts/src/stsplayer.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -17,40 +17,21 @@ */ #include "stsplayer.h" #include -#include -#include -#include -#include -#include #include -_LIT(KDefaultFile,"z:\\data\\sounds\\digital\\clock.aac"); - - - - /*static*/CStsPlayer* CStsPlayer::CreateTonePlayer( - MStsPlayerObserver& aObserver, CSystemToneService::TToneType aTone, - unsigned int aContext) + MStsPlayerObserver& aObserver,CSystemToneService::TToneType aTone, + unsigned int aContext, const TDesC& aFileName, TInt aVolume, + TUint aAudioPreference, TUint aAudioPriority) { CStsPlayer* self = 0; - - self = new CStsPlayer(aObserver, KDefaultFile, 0, aContext); + - if( self != 0) - { - TRAPD(err,self->LoadActiveProfileSettingsL()); - - if( err == KErrNone ) - self->SetToneSettings(aTone); - else - { - delete self; - self = 0; - } - + self = new CStsPlayer(aObserver, aFileName, 0, aContext, aVolume, aAudioPreference, aAudioPriority); + + if (self != 0) { bool successful = self->Init(); @@ -60,30 +41,20 @@ self = 0; } } - } + return self; } /*static*/CStsPlayer* CStsPlayer::CreateAlarmPlayer( MStsPlayerObserver& aObserver, CSystemToneService::TAlarmType aAlarm, - unsigned int aContext) + unsigned int aContext, const TDesC& aFileName, TInt aVolume, + TUint aAudioPreference, TUint aAudioPriority) { CStsPlayer* self = 0; - self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext); + self = new CStsPlayer(aObserver, aFileName, 10, aContext, aVolume, aAudioPreference, aAudioPriority); - if( self != 0) - { - TRAPD(err,self->LoadActiveProfileSettingsL()); - - if( err == KErrNone ) - self->SetAlarmSettings(aAlarm); - else - { - delete self; - self = 0; - } - + if (self != 0) { bool successful = self->Init(); @@ -93,132 +64,21 @@ self = 0; } } - } + return self; } -void CStsPlayer::LoadActiveProfileSettingsL() - { - if(!iEngine) - { - iEngine = ProEngFactory::NewEngineL(); - } - - if (iEngine) - iProfile = iEngine->ActiveProfileL(); - - if (iProfile) - { - MProEngToneSettings& settings = iProfile->ToneSettings(); - iWarningToneEnabled = settings.WarningAndGameTones(); - } - - - - - } - -void CStsPlayer::SetToneSettings(CSystemToneService::TToneType aTone) - { - - if(iProfile) - - { - MProEngTones& tones = iProfile->ProfileTones(); - - switch (aTone) - { - case CSystemToneService::EEmailAlert: - iFileName.Set(tones.EmailAlertTone()); - iAudioPreference = KAudioPrefNewSMS; - iAudioPriority = KAudioPriorityRecvMsg ; - break; - case CSystemToneService::ESmsAlert: - iFileName.Set(tones.MessageAlertTone()); - iAudioPreference = KAudioPrefNewSMS; - iAudioPriority = KAudioPriorityRecvMsg; - break; - case CSystemToneService::EMmsAlert: - iFileName.Set(tones.MessageAlertTone()); - iAudioPreference = KAudioPrefNewSMS; - iAudioPriority = KAudioPriorityRecvMsg; - break; - case CSystemToneService::EChatAlert: - iFileName.Set(tones.MessageAlertTone()); - iAudioPreference = KAudioPrefNewSMS ; - iAudioPriority = KAudioPriorityRecvMsg; - break; - case CSystemToneService::EWarningBeep: - iAudioPreference = KAudioPrefWarning; - iAudioPriority = KAudioPriorityWarningTone ; - if (iWarningToneEnabled) - iFileName.Set(KDefaultFile); - else - iVolume = 0; - - break; - default: - iAudioPreference = KAudioPrefDefaultTone; - iAudioPriority = KAudioPriorityWarningTone ; - break; - } - } - - else - { - iAudioPreference = KAudioPrefDefaultTone; - iAudioPriority = KAudioPriorityWarningTone ; - } - - } - - -void CStsPlayer::SetAlarmSettings(CSystemToneService::TAlarmType aAlarm) - { - if(iProfile) - - { - MProEngTones& tones = iProfile->ProfileTones(); - - switch (aAlarm) - { - case CSystemToneService::EIncomingCall: - iFileName.Set(tones.RingingTone1()); - iAudioPreference = KAudioPrefIncomingCall ; - iAudioPriority = KAudioPriorityRingingTone ; - break; - case CSystemToneService::EIncomingCallLine2: - iFileName.Set(tones.RingingTone2()); - iAudioPreference = KAudioPrefIncomingCall; - iAudioPriority = KAudioPriorityRingingTone ; - break; - case CSystemToneService::EIncomingDataCall: - iFileName.Set(tones.VideoCallRingingTone()); - iAudioPreference = KAudioPrefIncomingDataCall; - iAudioPriority = KAudioPriorityRealOnePlayer; - break; - default: - iAudioPreference = KAudioPrefAlarmClock ; - iAudioPriority = KAudioPriorityAlarm; - break; - } - } - else - { - iAudioPreference = KAudioPrefDefaultTone; - iAudioPriority = KAudioPriorityWarningTone ; - } - } CStsPlayer::CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName, - int aRepeatNumberOfTimes, unsigned int aContext) : + int aRepeatNumberOfTimes, unsigned int aContext, TInt aVolume, TUint aAudioPreference, TUint aAudioPriority ) : iObserver(aObserver), iPlayer(0), iFileName(aFileName), - iRepeatNumberOfTimes(aRepeatNumberOfTimes), iContext(aContext) + iRepeatNumberOfTimes(aRepeatNumberOfTimes), iContext(aContext), iVolume(aVolume), + iAudioPreference(aAudioPreference), iAudioPriority(aAudioPriority) { - iEngine = ProEngFactory::NewEngineL(); + } bool CStsPlayer::Init() @@ -233,15 +93,7 @@ CStsPlayer::~CStsPlayer() { - if (iProfile) - { - iProfile->Release(); - } - if (iEngine) - { - iEngine->Release(); - } - + delete iPlayer; } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsimplementation/group/bld.inf --- a/mmserv/sts/stsimplementation/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This file provides the information required for building the - * system tone service implementation. - */ - -PRJ_MMPFILES -stsimplementation.mmp diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsimplementation/group/stsimplementation.mmp --- a/mmserv/sts/stsimplementation/group/stsimplementation.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is the project specification file for building the - * stsimplementation static library. - */ - -#include - -TARGET stsimplementation.lib -TARGETTYPE lib - -MW_LAYER_SYSTEMINCLUDE -USERINCLUDE ../../inc - -SOURCEPATH ../src - -SOURCE stsimplementation.cpp rstssession.cpp diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsimplementation/src/rstssession.cpp --- a/mmserv/sts/stsimplementation/src/rstssession.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,207 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * The file provides the implementation of the client side session - * to the STS Server. - */ - -#include "rstssession.h" -#include "stsclientservercommon.h" - -const TUint KNumSlots = 30; - -/*static*/TInt RStsSession::CallBackThreadMain(TAny* aSession) - { - TInt err = KErrNoMemory; - - RThread myThread; - myThread.SetPriority(EPriorityAbsoluteHigh); - myThread.Close(); - - CTrapCleanup* cleanup = CTrapCleanup::New(); - - if (cleanup) - { - // Run the server and request a thread rendezvous. - TRAP( err, ((RStsSession*)aSession)->RunThreadL() ); - delete cleanup; - } - - return err; - } - -void RStsSession::RunThreadL() - { - // Initialisation complete, now signal the client, if requested. - RThread::Rendezvous(KErrNone); - - while (true) - { - TStsCallBack message; - iMsgQueue.ReceiveBlocking(message); - TStsCallBackType type = message.callBackType; - if (type == EStsPlayAlarmComplete) - { - message.observer->PlayAlarmComplete(message.alarmContext); - } - else if (type == EStsShutdown) - { - break; - } - else - { - //TODO: Log error message - } - } - } - -TInt RStsSession::StartMsgQueue() - { - // Create a nameless global message queue, then pass the handle to the queue to the server. - TInt err = iMsgQueue.CreateGlobal(KNullDesC, 30); - if (err == KErrNone) - { - err = SendReceive(StsMsg_RegisterMsgQueue, TIpcArgs(iMsgQueue)); - } - return err; - } - -TInt RStsSession::StartServer() - { - TInt err = KErrNone; - - // Launch the server executable (i.e. in it its own process). - - // Create a new server process. Simultaneous launching of two such processes - // should be detected when the second one attempts to create the server - // object, failing with KErrAlreadyExists. - RProcess server; - err = server.Create(KStsServerFile, KNullDesC); - - if (err == KErrNone) - { - TRequestStatus rendezvousStatus; - server.Rendezvous(rendezvousStatus); - server.Resume(); - - // wait for start or death - User::WaitForRequest(rendezvousStatus); - - // we can't use the 'exit reason' if the server panicked as this - // is the panic 'reason' and may be '0' which cannot be distinguished - // from KErrNone - if (server.ExitType() == EExitPanic) - { - err = KErrGeneral; - } - else - { - err = rendezvousStatus.Int(); - } - } - - server.Close(); - - return err; - } - -TInt RStsSession::StartThread() - { - TInt result = iThread.Create(KNullDesC, - RStsSession::CallBackThreadMain, KDefaultStackSize, - &User::Heap(), (TAny*) this); - - if (result == KErrNone) - { - TRequestStatus rendezvousStatus = KRequestPending; - - // Register for rendezvous notification when thread is started. - iThread.Rendezvous(rendezvousStatus); - - // Start the thread execution - iThread.Resume(); - - // Wait for thread to start. - User::WaitForRequest(rendezvousStatus); - - result = rendezvousStatus.Int(); - - if (result != KErrNone) - { - iThread.Kill(result); - } - } - - return result; - } - -TInt RStsSession::Connect() - { - // Try to create a session with the server - TInt result = CreateSession(KStsServerName, TVersion( - KStsServerMajorVersion, KStsServerMinorVersion, KStsServerBuild), - KNumSlots, EIpcSession_Sharable); - - // If the server wasn't found, start the server and try creating a session again - if (result == KErrNotFound) - { - result = StartServer(); - if (result == KErrNone || result == KErrAlreadyExists) - { - result = CreateSession(KStsServerName, TVersion( - KStsServerMajorVersion, KStsServerMinorVersion, - KStsServerBuild), KNumSlots, EIpcSession_Sharable); - } - } - - // Create thread for receiving asynch callbacks from the server - if (result == KErrNone) - { - result = StartMsgQueue(); - if (result == KErrNone) - { - result = StartThread(); - } - } - - return result; - } - -void RStsSession::Close() - { - TRequestStatus logonStatus = KRequestPending; - iThread.Logon(logonStatus); - RSessionBase::Close(); - User::WaitForRequest(logonStatus); - iThread.Close(); - iMsgQueue.Close(); - } - -TInt RStsSession::SendPlayTone(CSystemToneService::TToneType aTone) - { - return SendReceive(StsMsg_PlayTone, TIpcArgs(aTone)); - } - -TInt RStsSession::SendPlayAlarm(CSystemToneService::TAlarmType aAlarm, - unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver) - { - TPckg alarmContextPckg(aAlarmContext); - return SendReceive(StsMsg_PlayAlarm, TIpcArgs(aAlarm, &alarmContextPckg, - &aObserver)); - } - -TInt RStsSession::SendStopAlarm(unsigned int aAlarmContext) - { - return SendReceive(StsMsg_StopAlarm, TIpcArgs(aAlarmContext)); - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsimplementation/src/rstssession.h --- a/mmserv/sts/stsimplementation/src/rstssession.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This file defines the interface to the client side session of the - * STS Server. - */ - -#ifndef RSTSSESSION_H_ -#define RSTSSESSION_H_ - -#include -#include - -#include "stsclientservercommon.h" - -class RStsSession : public RSessionBase - { -public: - - TInt Connect(); - - void Close(); - - TInt SendPlayTone(CSystemToneService::TToneType aTone); - - TInt SendPlayAlarm(CSystemToneService::TAlarmType aAlarm, - unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver); - - TInt SendStopAlarm(unsigned int aAlarmContext); - -private: - - static TInt CallBackThreadMain(TAny* aSession); - void RunThreadL(); - - TInt StartMsgQueue(); - TInt StartServer(); - TInt StartThread(); - - RThread iThread; - RMsgQueue iMsgQueue; - }; - -#endif // RSTSSESSION_H_ diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsimplementation/src/stsimplementation.cpp --- a/mmserv/sts/stsimplementation/src/stsimplementation.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * The file provides the actual implementation of the STS API. - * All of the STS API methods are implemented by passing the - * calls to the STS Server through the client side STS - * Session. - */ - -// Include Files -#include "stsimplementation.h" -#include "rstssession.h" - -// Member Functions -/*static*/CStsImplementation* CStsImplementation::Create() - { - CStsImplementation* self = new CStsImplementation(); - if (self != 0) - { - bool successful = self->Init(); - if (!successful) - { - delete self; - self = 0; - } - } - return self; - } - -CStsImplementation::CStsImplementation() : - iSession(NULL) - { - } - -CStsImplementation::~CStsImplementation() - { - iSession->Close(); - delete iSession; - } - -bool CStsImplementation::Init() - { - bool result = false; - iSession = new RStsSession(); - if (iSession) - { - TInt err = iSession->Connect(); - result = err == KErrNone; - } - return result; - } - -void CStsImplementation::PlayTone(CSystemToneService::TToneType aTone) - { - iSession->SendPlayTone(aTone); - } - -void CStsImplementation::PlayAlarm(CSystemToneService::TAlarmType aAlarm, - unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver) - { - //TODO: Add logging and error checking - iSession->SendPlayAlarm(aAlarm, aAlarmContext, aObserver); - } - -void CStsImplementation::StopAlarm(unsigned int aAlarmContext) - { - //TODO: Add logging and error checking - iSession->SendStopAlarm(aAlarmContext); - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsplayer/group/bld.inf --- a/mmserv/sts/stsplayer/group/bld.inf Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,20 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This file provides the information required for building the - * system tone service player. - */ - -PRJ_MMPFILES -stsplayer.mmp diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsplayer/group/stsplayer.mmp --- a/mmserv/sts/stsplayer/group/stsplayer.mmp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This is the project specification file for building the - * stsimplementation static library. - */ - -#include - -TARGET stsplayer.lib -TARGETTYPE lib - -MW_LAYER_SYSTEMINCLUDE -OS_LAYER_LIBC_SYSTEMINCLUDE -OS_LAYER_STDCPP_SYSTEMINCLUDE -USERINCLUDE ../../inc - -SOURCEPATH ../src - -SOURCE sts.cpp -SOURCE stsplayer.cpp diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsplayer/src/sts.cpp --- a/mmserv/sts/stsplayer/src/sts.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,181 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This file provides the implementation of System Tone Service used - * by the STS Server. - */ - -#include "sts.h" - -class CSts::CPlayerNode - { -public: - CPlayerNode(CStsPlayer* aPlayer); - CPlayerNode(CStsPlayer* aPlayer, MStsPlayAlarmObserver& aObserver); - ~CPlayerNode(); - bool HasObserver(); - CStsPlayer* Player(); - MStsPlayAlarmObserver& Observer(); -private: - CStsPlayer* iPlayer; - MStsPlayAlarmObserver* iObserver; - }; - -CSts::CPlayerNode::CPlayerNode(CStsPlayer* aPlayer) : - iPlayer(aPlayer), iObserver(0) - { - } - -CSts::CPlayerNode::CPlayerNode(CStsPlayer* aPlayer, - MStsPlayAlarmObserver& aObserver) : - iPlayer(aPlayer), iObserver(&aObserver) - { - } - -CSts::CPlayerNode::~CPlayerNode() - { - delete iPlayer; - } - -bool CSts::CPlayerNode::HasObserver() - { - return iObserver != 0; - } - -CStsPlayer* CSts::CPlayerNode::Player() - { - return iPlayer; - } - -MStsPlayAlarmObserver& CSts::CPlayerNode::Observer() - { - return *iObserver; - } - -/*static*/CSts* CSts::Create() - { - CSts* self = new CSts(); - if (self != 0) - { - bool successful = self->Init(); - if (!successful) - { - delete self; - self = 0; - } - } - return self; - } - -/*static*/void CSts::Delete(CSts* aSts) - { - delete aSts; - } - -CSts::CSts() : - iNextContext(1) - { - } - -bool CSts::Init() - { - return true; - } - -CSts::~CSts() - { - CleanUpPlayers(); - } - -void CSts::PlayTone(CSystemToneService::TToneType aTone) - { - CStsPlayer* player = CStsPlayer::CreateTonePlayer(*this, aTone, - iNextContext); - if (player != 0) - { - iPlayerMap[iNextContext] = new CPlayerNode(player); - iNextContext++; - if (iNextContext == 0) - iNextContext++; - player->Play(); - } - else - { - //TODO: Add trace here - } - } - -void CSts::PlayAlarm(CSystemToneService::TAlarmType aAlarm, - unsigned int& aAlarmContext, MStsPlayAlarmObserver& aObserver) - { - CStsPlayer* player = CStsPlayer::CreateAlarmPlayer(*this, aAlarm, - iNextContext); - if (player != 0) - { - iPlayerMap[iNextContext] = new CPlayerNode(player, aObserver); - aAlarmContext = iNextContext; - iNextContext++; - if (iNextContext == 0) - iNextContext++; - player->Play(); - } - else - { - //TODO: Add trace here - aAlarmContext = 0; - } - } - -void CSts::StopAlarm(unsigned int aAlarmContext) - { - CPlayerNode* node = iPlayerMap[aAlarmContext]; - iPlayerMap.erase(aAlarmContext); - if (node) - { - node->Player()->Stop(); - delete node; - } - else - { - //TODO: Add trace here - } - } - -void CSts::CleanUpPlayers() - { - while (!iPlayerMap.empty()) - { - //TODO: Add trace here - StopAlarm(iPlayerMap.begin()->first); - } - } - -void CSts::PlayComplete(unsigned int aContext) - { - CPlayerNode* node = iPlayerMap[aContext]; - iPlayerMap.erase(aContext); - if (node) - { - CStsPlayer* player = node->Player(); - if (node->HasObserver()) - { - node->Observer().PlayAlarmComplete(aContext); - } - delete node; - } - else - { - // TODO: log unexpected error - } - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/sts/stsplayer/src/stsplayer.cpp --- a/mmserv/sts/stsplayer/src/stsplayer.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: - * This file provides the implementation for creating and deleting a - * an MMF based player for playing and stopping a tone playback. - */ - -#include "stsplayer.h" - -_LIT(KDefaultFile,"z:\\data\\sounds\\digital\\clock.aac"); - -/*static*/CStsPlayer* CStsPlayer::CreateTonePlayer( - MStsPlayerObserver& aObserver, CSystemToneService::TToneType aTone, - unsigned int aContext) - { - CStsPlayer* self = 0; - switch (aTone) - { - default: - self = new CStsPlayer(aObserver, KDefaultFile, 0, aContext); - break; - } - if (self != 0) - { - bool successful = self->Init(); - if (!successful) - { - delete self; - self = 0; - } - } - return self; - } - -/*static*/CStsPlayer* CStsPlayer::CreateAlarmPlayer( - MStsPlayerObserver& aObserver, CSystemToneService::TAlarmType aAlarm, - unsigned int aContext) - { - CStsPlayer* self = 0; - switch (aAlarm) - { - case CSystemToneService::EClockAlarm: - self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext); - break; - default: - self = new CStsPlayer(aObserver, KDefaultFile, 10, aContext); - break; - } - if (self != 0) - { - bool successful = self->Init(); - if (!successful) - { - delete self; - self = 0; - } - } - return self; - } - -CStsPlayer::CStsPlayer(MStsPlayerObserver& aObserver, const TDesC& aFileName, - int aRepeatNumberOfTimes, unsigned int aContext) : - iObserver(aObserver), iPlayer(0), iFileName(aFileName), - iRepeatNumberOfTimes(aRepeatNumberOfTimes), iContext(aContext) - { - } - -bool CStsPlayer::Init() - { - TRAPD(result, iPlayer = CMdaAudioPlayerUtility::NewL(*this)); - return result == KErrNone; - } - -CStsPlayer::~CStsPlayer() - { - delete iPlayer; - } - -void CStsPlayer::Play() - { - // Play the tone - TRAPD(err, iPlayer->OpenFileL(iFileName)); - - // If there is an error, indicate that the playback is complete. - if (err) - { - //TODO: Add trace here - iObserver.PlayComplete(iContext); - } - } - -void CStsPlayer::Stop() - { - iPlayer->Stop(); - } - -void CStsPlayer::MapcInitComplete(TInt aError, - const TTimeIntervalMicroSeconds& /*aDuration*/) - { - if (aError == KErrNone) - { - TTimeIntervalMicroSeconds delay = 0; - iPlayer->SetRepeats(iRepeatNumberOfTimes, delay); - iPlayer->Play(); - } - else - { - //TODO: add trace - // Since there is an error, indicate that the playback is complete - iObserver.PlayComplete(iContext); - } - } - -void CStsPlayer::MapcPlayComplete(TInt aError) - { - if (aError != KErrNone) - { - //TODO: add trace - } - iObserver.PlayComplete(iContext); - } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/thumbnailengine/TneProcessorInc/Yuv2rgb16.h --- a/mmserv/thumbnailengine/TneProcessorInc/Yuv2rgb16.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,98 +0,0 @@ -/* -* Copyright (c) 2002 Nokia Corporation and/or its subsidiary(-ies). -* All rights reserved. -* This component and the accompanying materials are made available -* under the terms of "Eclipse Public License v1.0" -* which accompanies this distribution, and is available -* at the URL "http://www.eclipse.org/legal/epl-v10.html". -* -* Initial Contributors: -* Nokia Corporation - initial contribution. -* -* Contributors: -* -* Description: YUV to EColor64K colorspace converter concrete classes -* -*/ - - - -#ifndef __YUV2RGB16_H__ -#define __YUV2RGB16_H__ - -// INCLUDES - -#ifndef __YUVCONVERTER_H__ -#include "yuvconverter.h" -#endif - -// CLASS DEFINITIONS - -class CYuv2Rgb16 : public CYuvConverter -{ -public: // CYuvConverter methods - // Constructors & destructor - CYuv2Rgb16(); - ~CYuv2Rgb16(); - void ConstructL(TUint aWidth, TUint aHeight, TUint aMaxWidth, TUint aMaxHeight); - - void Convert(const TUint8 *aYBuf, const TUint8 *aUBuf, - const TUint8 *aVBuf, - TUint aBufWidth, TUint aBufHeight, - TUint8 *aTarget, TUint aTargetScanlineLength); - - void SetGamma(TInt /*aGamma*/) {}; - -protected: // Data - - TUint iWidth, iHeight; - -}; - - -// The fixed point constants for YUV -> RGB conversion -const TInt KYMult = 296; -const TInt KCrToR = 408; -const TInt KCbToG = 96; -const TInt KCrToG = 204; -const TInt KCbToB = 520; - -// ----------------------------------------------------------------------------- -// UvToRDiff -// Calculate the red color difference from Cr by using fixed point values. -// ----------------------------------------------------------------------------- -// -inline TInt UvToRDiff( - TInt aCr, - TInt /*aCb*/) - { - return (KCrToR * aCr) / 256; - } - -// ----------------------------------------------------------------------------- -// UvToGDiff -// Calculate the green color difference from Cr and Cb components -// by using fixed point values. -// ----------------------------------------------------------------------------- -// -inline TInt UvToGDiff( - TInt aCr, - TInt aCb) - { - return (KCbToG * aCb + KCrToG * aCr) / 256; - } - -// ----------------------------------------------------------------------------- -// UvToBDiff -// Calculate the blue color difference from Cb by using fixed point values. -// ----------------------------------------------------------------------------- -// -inline TInt UvToBDiff( - TInt /*aCr*/, - TInt aCb) - { - return (KCbToB * aCb) / 256; - } - - -#endif diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmscallclisrv.h --- a/mmserv/tms/inc/tmscallclisrv.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmscallclisrv.h Fri Jul 09 16:43:35 2010 -0500 @@ -53,6 +53,7 @@ TMS_ROUTING_OUTPUT_GET, TMS_ROUTING_PREVIOUSOUTPUT_GET, TMS_ROUTING_AVAILABLE_OUTPUT_GET, + TMS_GET_ACTIVE_CALL_PARAMS, //For TMS Format TMS_FORMAT_SETCODECMODE, @@ -69,10 +70,7 @@ TMS_FORMAT_SETCNG, TMS_FORMAT_GETCNG, TMS_FORMAT_SETPLC, - TMS_FORMAT_GETPLC, - TMS_DTMF_START, - TMS_DTMF_STOP, - TMS_DTMF_CONTINUE + TMS_FORMAT_GETPLC }; struct TMSCliSrvStreamCreateDataStruct @@ -124,6 +122,15 @@ typedef TPckgBuf TMSCliSrvDataXferChunkHndlDataStructBufPckg; +struct TmsCallMsgBuf + { + gint iRequest; + gint iStatus; + gboolean iBool; + gint iInt; + }; +typedef TPckgBuf TmsCallMsgBufPckg; + } //namespace TMS #endif // TMSCALLCLISRV_H diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsclientserver.h --- a/mmserv/tms/inc/tmsclientserver.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsclientserver.h Fri Jul 09 16:43:35 2010 -0500 @@ -60,6 +60,7 @@ ETMSRingToneMute, ETMSStartDTMFNotifier, ETMSCancelDTMFNotifier, + ETMSInitDTMF, ETMSStartDTMF, ETMSStopDTMF, ETMSContinueDTMF, diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsdtmfbody.h --- a/mmserv/tms/inc/tmsdtmfbody.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsdtmfbody.h Fri Jul 09 16:43:35 2010 -0500 @@ -42,3 +42,4 @@ } //namespace TMS #endif //TMS_GLOBAL_ROUTING_BODY_H + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsdtmfimpl.h --- a/mmserv/tms/inc/tmsdtmfimpl.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsdtmfimpl.h Fri Jul 09 16:43:35 2010 -0500 @@ -32,14 +32,11 @@ IMPORT_C static gint Delete(TMSDTMF*& dtmf); private: - TMSDTMFImpl(TMSStreamType streamtype); - gint PostConstruct(); - gint SetParent(TMSDTMF*& parent); - -private: - TMSStreamType iStreamType; + TMSDTMFImpl(); + gint PostConstruct(TMSStreamType streamtype); }; } //namespace TMS #endif //TMS_DTMF_IMPL_H + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsproxy.h --- a/mmserv/tms/inc/tmsproxy.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsproxy.h Fri Jul 09 16:43:35 2010 -0500 @@ -93,6 +93,7 @@ IMPORT_C gint MuteRT(); // TMSDTMF + IMPORT_C gint InitDTMFPlayer(TMSStreamType streamtype); IMPORT_C gint StartDTMF(TMSStreamType streamtype, GString* tone); IMPORT_C gint StopDTMF(TMSStreamType streamtype); IMPORT_C gint ContinueDTMFStringSending(TBool continuesending); diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsstreambody.h --- a/mmserv/tms/inc/tmsstreambody.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsstreambody.h Fri Jul 09 16:43:35 2010 -0500 @@ -55,10 +55,9 @@ virtual gint Start(gint retrytime) = 0; virtual gint Stop() = 0; virtual void Deinit() = 0; - -private: }; } //namespace TMS #endif //TMS_STREAM_BODY_H + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsstreamimpl.h --- a/mmserv/tms/inc/tmsstreamimpl.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsstreamimpl.h Fri Jul 09 16:43:35 2010 -0500 @@ -45,4 +45,3 @@ #endif // TMS_STREAM_IMPL_H -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/inc/tmsutility.h --- a/mmserv/tms/inc/tmsutility.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/inc/tmsutility.h Fri Jul 09 16:43:35 2010 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2006-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -11,7 +11,7 @@ * * Contributors: * - * Description: Telephony Multimedia Service + * Description: Tracing and convertion utility. * */ @@ -60,6 +60,7 @@ #define RET_REASON_IF_ERR(s) if(s!=0) return s #define TMSRESULT(result) TMSUtility::TMSResult(result) +#define SYMBIANRESULT(result) TMSUtility::SymbianResult(result) #define TOTMSOUTPUT(output) TMSUtility::ToTMSOutput(output) #define TOTAROUTPUT(output) TMSUtility::ToTAROutput(output) #define TOFOURCC(format) TMSUtility::ToFourCC(format) @@ -73,6 +74,7 @@ { public: IMPORT_C static gint TMSResult(const gint error); + IMPORT_C static TInt SymbianResult(const gint error); IMPORT_C static gint EtelToTMSResult(const gint error); IMPORT_C static TMSAudioOutput ToTMSOutput( CTelephonyAudioRouting::TAudioOutput taroutput); diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/eabi/tmscallserver.def --- a/mmserv/tms/tmscallserver/eabi/tmscallserver.def Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/eabi/tmscallserver.def Fri Jul 09 16:43:35 2010 -0500 @@ -8,26 +8,16 @@ _ZTIN3TMS13TMSIPDownlinkE @ 7 NONAME _ZTIN3TMS14TMSCallSessionE @ 8 NONAME _ZTIN3TMS14TMSTarSettingsE @ 9 NONAME - _ZTIN3TMS15TMSDTMFProviderE @ 10 NONAME - _ZTIN3TMS15TMSDtmfNotifierE @ 11 NONAME - _ZTIN3TMS17TMSCallDelayTimerE @ 12 NONAME - _ZTIN3TMS18TMSEtelDtmfMonitorE @ 13 NONAME - _ZTIN3TMS19TMSIPCallStreamBaseE @ 14 NONAME - _ZTIN3TMS22TMSAudioDtmfTonePlayerE @ 15 NONAME - _ZTIN3TMS22TMSEtelDtmfStopMonitorE @ 16 NONAME - _ZTVN3TMS11TMSCallAdptE @ 17 NONAME - _ZTVN3TMS11TMSIPUplinkE @ 18 NONAME - _ZTVN3TMS13TMSCallCSAdptE @ 19 NONAME - _ZTVN3TMS13TMSCallIPAdptE @ 20 NONAME - _ZTVN3TMS13TMSCallServerE @ 21 NONAME - _ZTVN3TMS13TMSIPDownlinkE @ 22 NONAME - _ZTVN3TMS14TMSCallSessionE @ 23 NONAME - _ZTVN3TMS14TMSTarSettingsE @ 24 NONAME - _ZTVN3TMS15TMSDTMFProviderE @ 25 NONAME - _ZTVN3TMS15TMSDtmfNotifierE @ 26 NONAME - _ZTVN3TMS17TMSCallDelayTimerE @ 27 NONAME - _ZTVN3TMS18TMSEtelDtmfMonitorE @ 28 NONAME - _ZTVN3TMS19TMSIPCallStreamBaseE @ 29 NONAME - _ZTVN3TMS22TMSAudioDtmfTonePlayerE @ 30 NONAME - _ZTVN3TMS22TMSEtelDtmfStopMonitorE @ 31 NONAME + _ZTIN3TMS17TMSCallDelayTimerE @ 10 NONAME + _ZTIN3TMS19TMSIPCallStreamBaseE @ 11 NONAME + _ZTVN3TMS11TMSCallAdptE @ 12 NONAME + _ZTVN3TMS11TMSIPUplinkE @ 13 NONAME + _ZTVN3TMS13TMSCallCSAdptE @ 14 NONAME + _ZTVN3TMS13TMSCallIPAdptE @ 15 NONAME + _ZTVN3TMS13TMSCallServerE @ 16 NONAME + _ZTVN3TMS13TMSIPDownlinkE @ 17 NONAME + _ZTVN3TMS14TMSCallSessionE @ 18 NONAME + _ZTVN3TMS14TMSTarSettingsE @ 19 NONAME + _ZTVN3TMS17TMSCallDelayTimerE @ 20 NONAME + _ZTVN3TMS19TMSIPCallStreamBaseE @ 21 NONAME diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/group/tmscallserver.mmp --- a/mmserv/tms/tmscallserver/group/tmscallserver.mmp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/group/tmscallserver.mmp Fri Jul 09 16:43:35 2010 -0500 @@ -52,11 +52,6 @@ SOURCE tmscsdownlink.cpp SOURCE tmscsuplink.cpp SOURCE tmstarsettings.cpp -SOURCE tmsdtmftoneplayer.cpp -SOURCE tmsdtmfprovider.cpp -SOURCE tmseteldtmfmonitor.cpp -SOURCE tmseteldtmfstopmonitor.cpp -SOURCE tmsdtmfnotifier.cpp USERINCLUDE ../inc USERINCLUDE ../../inc @@ -99,10 +94,6 @@ LIBRARY profileengine.lib LIBRARY telephonyaudiorouting.lib LIBRARY tmsutility.lib -// Libraries for ETel -LIBRARY etelmm.lib -LIBRARY etel.lib -LIBRARY customapi.lib DEFFILE tmscallserver.def NOSTRICTDEF diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmscalladpt.h --- a/mmserv/tms/tmscallserver/inc/tmscalladpt.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/inc/tmscalladpt.h Fri Jul 09 16:43:35 2010 -0500 @@ -26,6 +26,14 @@ // TMSCallAdpt class class TMSCallAdpt { +protected: + enum TMSStreamState + { + EIdle = 0, + EInitialized, + EActivated + }; + public: static gint CreateCallL(gint callType, TMSCallAdpt*& callAdpt); virtual ~TMSCallAdpt(); @@ -93,10 +101,8 @@ virtual gint GetPreviousOutput(TMSAudioOutput& output) = 0; virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuf) = 0; - // From TMSDTMF - virtual gint StartDTMF(const TMSStreamType streamtype, TDes& dtmfstr) = 0; - virtual gint StopDTMF(const TMSStreamType streamtype) = 0; - virtual gint ContinueDTMF(const gboolean sending) = 0; + void GetCallType(TMSCallType& callType); + gboolean IsUplActivated(); protected: TMSCallAdpt(); @@ -105,10 +111,12 @@ protected: gint iGlobalVol; gint iGlobalGain; + TMSStreamState iUplState; + TMSStreamState iDnlState; + gint iCallType; }; } //namespace TMS #endif // CALLADPT_H -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmscallcsadpt.h --- a/mmserv/tms/tmscallserver/inc/tmscallcsadpt.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/inc/tmscallcsadpt.h Fri Jul 09 16:43:35 2010 -0500 @@ -25,10 +25,8 @@ #include #include #include "tmsclientserver.h" -#include "tmsdtmftoneplayerobserver.h" #include "tmscalladpt.h" #include "tmscsdevsoundobserver.h" -#include "tmsdtmfobserver.h" namespace TMS { @@ -45,9 +43,7 @@ */ class TMSCallCSAdpt : public TMSCallAdpt, public TMSCSDevSoundObserver, - public MTelephonyAudioRoutingObserver, - public TMSDTMFTonePlayerObserver, - public TMSDTMFObserver + public MTelephonyAudioRoutingObserver { public: static TMSCallCSAdpt* NewL(); @@ -117,25 +113,12 @@ virtual gint GetPreviousOutput(TMSAudioOutput& output); virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuf); - // From TMSDTMF - virtual gint StartDTMF(const TMSStreamType streamtype, TDes& dtmfstr); - virtual gint StopDTMF(const TMSStreamType streamtype); - virtual gint ContinueDTMF(const gboolean sending); - //From TMSCSDevSoundObserver void DownlinkInitCompleted(gint status); void UplinkInitCompleted(gint status); void DownlinkActivationCompleted(gint status); void UplinkActivationCompleted(gint status); - //From TMSDTMFTonePlayerObserver - void DTMFInitCompleted(gint status); - void DTMFToneFinished(gint status); - - //From TMSDTMFObserver - void HandleDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent event, - const gint status, const TChar tone); - private: TMSCallCSAdpt(); void ConstructL(); @@ -157,18 +140,13 @@ TMSCSDownlink* iCSDownlink; CTelephonyAudioRouting* iRouting; TMSTarSettings* iTarSettings; - TMSAudioDtmfTonePlayer* iDTMFDnlinkPlayer; - TMSDtmfNotifier* iDTMFNotifier; - TMSDTMFProvider* iDTMFUplinkPlayer; // Message queues for communication and data transfer back to the client RMsgQueue iMsgQueueUp; RMsgQueue iMsgQueueDn; TmsMsgBuf iMsgBuffer; - gboolean iUplinkInitialized; gint iUplinkStreamId; - gboolean iDnlinkInitialized; gint iDnlinkStreamId; }; @@ -176,4 +154,3 @@ #endif // CALLCSADPT_H -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmscallipadpt.h --- a/mmserv/tms/tmscallserver/inc/tmscallipadpt.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/inc/tmscallipadpt.h Fri Jul 09 16:43:35 2010 -0500 @@ -25,8 +25,6 @@ #include "tmsshared.h" #include "tmscalladpt.h" #include "tmsipcallstream.h" -#include "tmsdtmftoneplayer.h" -#include "tmsdtmfnotifier.h" namespace TMS { @@ -38,8 +36,7 @@ * TMSCallIPAdpt class */ class TMSCallIPAdpt : public TMSCallAdpt, - public TMSIPDevSoundObserver, - public TMSDTMFTonePlayerObserver + public TMSIPDevSoundObserver { public: static TMSCallIPAdpt* NewL(); @@ -109,11 +106,6 @@ virtual gint GetPreviousOutput(TMSAudioOutput& output); virtual gint GetAvailableOutputsL(gint& count, CBufFlat*& outputsbuf); - // From TMSDTMF - virtual gint StartDTMF(const TMSStreamType streamtype, TDes& dtmfstr); - virtual gint StopDTMF(const TMSStreamType streamtype); - virtual gint ContinueDTMF(const gboolean sending); - // From TMS codec formats gint SetIlbcCodecMode(const gint mode, const TMSStreamType strmtype); gint GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype); @@ -138,10 +130,6 @@ void DownlinkStarted(gint status); void UplinkStarted(gint status); - //From TMSDTMFTonePlayerObserver - void DTMFInitCompleted(gint status); - void DTMFToneFinished(gint status); - private: TMSCallIPAdpt(); void ConstructL(); @@ -149,7 +137,6 @@ gint OpenDownlink(const RMessage2& message, const gint retrytime); gint OpenUplink(const RMessage2& message, const gint retrytime); - gint InitDTMF(TMSStreamType strmtype); void GetSupportedBitRatesL(CBufFlat*& brbuffer); void NotifyClient(const gint strmId, const gint command, const gint status = KErrNone, const gint64 int64 = TInt64(0)); @@ -158,17 +145,13 @@ gint iNextStreamId; TMSIPUplink* iIPUplink; TMSIPDownlink* iIPDownlink; - TMSAudioDtmfTonePlayer* iDTMFDnlinkPlayer; - TMSDtmfNotifier* iDTMFNotifier; - TMSAudioDtmfTonePlayer* iDTMFUplinkPlayer; + // Message queues for communication and data transfer back to the client RMsgQueue iMsgQueueUp; RMsgQueue iMsgQueueDn; TmsMsgBuf iMsgBuffer; - gboolean iUplinkInitialized; gint iUplinkStreamId; - gboolean iDnlinkInitialized; gint iDnlinkStreamId; TMMFPrioritySettings iPriority; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmscallsession.h --- a/mmserv/tms/tmscallserver/inc/tmscallsession.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/inc/tmscallsession.h Fri Jul 09 16:43:35 2010 -0500 @@ -87,10 +87,7 @@ void HandleRoutingGetOutputL(const RMessage2& aMessage); void HandleRoutingGetPreviousOutputL(const RMessage2& aMessage); void HandleRoutingGetAvailableOutputsL(const RMessage2& aMessage); - - void HandleDTMFStart(const RMessage2& aMessage); - void HandleDTMFStop(const RMessage2& aMessage); - void HandleDTMFContinue(const RMessage2& aMessage); + void HandleGetActiveCallL(const RMessage2& aMessage); private: TMSCallServer& iTMSCallServer; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmsdtmfnotifier.h --- a/mmserv/tms/tmscallserver/inc/tmsdtmfnotifier.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef DTMFNOTIFIER_H -#define DTMFNOTIFIER_H - -// INCLUDES -#include -#include -#include "tmsclientserver.h" - -namespace TMS { - -// CLASS DECLARATION -class TMSDtmfNotifier - { -public: - // Constructors and destructor - - /** - * Two-phased constructor. - */ - static TMSDtmfNotifier* NewL(); - - /** - * Destructor. - */ - virtual ~TMSDtmfNotifier(); - -public: - // New functions - - void SetDtmf(TmsMsgBufPckg dtmfpckg, gboolean publish = TRUE); - -private: - - /** - * C++ default constructor. - */ - TMSDtmfNotifier(); - - /** - * By default Symbian 2nd phase constructor is private. - */ - void ConstructL(); - -private: - gint iVolume; - }; - -} //namespace TMS - -#endif // DTMFNOTIFIER_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmsdtmfobserver.h --- a/mmserv/tms/tmscallserver/inc/tmsdtmfobserver.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef TMSDTMFOBSERVER_H -#define TMSDTMFOBSERVER_H - -#include - -namespace TMS { - -/** - * CCP DTMF related events observer class. - * This class is used for notifying DTMF specific events. - */ -class TMSDTMFObserver - { -public: - - /** DTMF Events */ - enum TCCPDtmfEvent - { - /** Unknown */ - ECCPDtmfUnknown = 0, - /** DTMF sending started manually */ - ECCPDtmfManualStart = 5, - /** DTMF sending stopped manually */ - ECCPDtmfManualStop = 6, - /** DTMF sending aborted manually */ - ECCPDtmfManualAbort = 7, - /** Automatic DTMF sending initialized */ - ECCPDtmfSequenceStart = 9, - /** Automatic DTMF sending stopped */ - ECCPDtmfSequenceStop = 10, - /** Automatic DTMF sending aborted */ - ECCPDtmfSequenceAbort = 11, - /** There was stop mark in DTMF string */ - ECCPDtmfStopInDtmfString, - /** DTMF sending completed succesfully */ - ECCPDtmfStringSendingCompleted - }; - - //protected: - /** - * Protects the observer being deleted through the observer interface. - */ - //virtual inline ~TMSDTMFObserver() {}; - -public: - - /** - * HandleDTMFEvents. - * @param event Event type - * @param status Error code - * @param tone Character - * @return none - */ - virtual void HandleDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent event, - const gint status, const TChar tone) /*const*/ = 0; - }; - -} //namespace TMS - -#endif // TMSDTMFOBSERVER_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h --- a/mmserv/tms/tmscallserver/inc/tmsdtmfprovider.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,182 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef TMSDTMFPROVIDER_H -#define TMSDTMFPROVIDER_H - -#include -#include -#include -#include -#include "tmsdtmfobserver.h" - -namespace TMS { - -// FORWARD DECLARATIONS -class TMSEtelDtmfMonitor; -class TMSEtelDtmfStopMonitor; - -/** - * TMSDTMFProvider class - * Makes asynchronic request to ETel interface according to given request type. - * Provides canceling via CActive::Cancel(). - */ -class TMSDTMFProvider : public CActive - { -public: - - /** - * Two phased constructing of the DTMF provider instance. - * @param aPhone mobile phone handle - * @param aMmCustom custom API handle for special DTMF event - * monitoring. - * @return the DTMF provider instance - */ - static TMSDTMFProvider* NewL(); - - /** - * C++ default destructor - */ - virtual ~TMSDTMFProvider(); - - /** - * HandleDTMFEvents. - * @param aEvent Event type - * @param aError Error code - * @param aTone Character - */ - void NotifyDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent aEvent, - const gint aError, const TChar aTone); - - // from base class MCCPDTMFProvider - /** - * Cancels asynchronous DTMF string sending. - * @return KErrNone if succesfull, otherwise another system wide error code - */ - gint CancelDtmfStringSending(); - - /** - * Starts the transmission of a single DTMF tone across a - * connected and active call. - * @param aTone Tone to be played. - * @return KErrNone if succesfull, otherwise another system wide error code - */ - gint StartDtmfTone(const TChar aTone); - - /** - * Stops playing current DTMF tone. - * @return KErrNone if succesfull, otherwise another system wide error code - */ - gint StopDtmfTone(); - - /** - * Plays DTMF string. - * @param aString String to be played. - * @return KErrNone if succesfull, otherwise another system wide error code - * KErrArgument if the specified string contains illegal DTMF characters - */ - gint SendDtmfToneString(const TDesC& aString); - - /** - * Continue or cancel sending DTMF string which was stopped with 'w' - * character in string. - * @param aContinue ETrue if sending of the DTMF string should continue, - * EFalse if the rest of the DTMF string is to be discarded. - * @return KErrNone if succesfull, otherwise another system wide error code - */ - gint ContinueDtmfStringSending(const gboolean aContinue); - - /** - * Add an observer for DTMF related events. - * Plug-in dependent feature if duplicates or more than one observers - * are allowed or not. Currently CCE will set only one observer. - * @param aObserver Observer - * @leave system error if observer adding fails - */ - void AddObserver(const TMSDTMFObserver& aObserver); - - /** - * Remove an observer. - * @param aObserver Observer - * @return KErrNone if removed succesfully. KErrNotFound if observer was - * not found. Any other system error depending on the error. - */ - gint RemoveObserver(const TMSDTMFObserver& aObserver); - - // from base class CActive -protected: - /** - * From CActive - * RunL - */ - void RunL(); - - /** - * From CActive - * Cancels the monitor - */ - void DoCancel(); - -private: - /** - * Constructs the requester. - * - * @param aPhone handle to ETel phone - * @param aMmCustom custom API handle - */ - TMSDTMFProvider(); - - /** - * Constructing the provider in the second phase. - */ - void ConstructL(); - -private: - /** - * DTMF event observer. - */ - RPointerArray iObservers; - - /** - * ETel phone handle for DTMF functionality. - */ - RMobilePhone iPhone; - - /** - * Monitor for DTMF events and changes. - * Own. - */ - TMSEtelDtmfMonitor* iMonitor; - - /** - * Monitor for DTMF stopping. - * Own. - */ - TMSEtelDtmfStopMonitor* iStopMonitor; - - /** - * Custom API reference. - */ - RMmCustomAPI iMmCustom; - - RTelServer iServer; - TBuf<25> iTsyname; - }; - -} //namespace TMS - -#endif //TMSDTMFPROVIDER_H diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmsdtmftoneplayer.h --- a/mmserv/tms/tmscallserver/inc/tmsdtmftoneplayer.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef TMSAUDIODTMFTONEPLAYER_H -#define TMSAUDIODTMFTONEPLAYER_H - -// INCLUDES -#include -#include -#include "tmsdtmftoneplayerobserver.h" - -// FORWARD DECLARATIONS -class CMMFDevSound; - -// CLASS DECLARATION - -/** - * Plays DTMF tones using media server - */ - -namespace TMS { - -class TMSAudioDtmfTonePlayer : public MDevSoundObserver - { -public: - // Constructors and destructor - - /** - * Two-phased constructor. - */ - static TMSAudioDtmfTonePlayer* NewL(TMSDTMFTonePlayerObserver& obsrvr, - guint audioPreference, guint audioPriority); - - /** - * Destructor. - */ - virtual ~TMSAudioDtmfTonePlayer(); - -public: - - /** - * Sets volume. - * @param aVolume volume value or KDtmfSilent. - * @return None. - */ - void SetVolume(gint volume); - - /** - * Starts playing given dtmf tone infinitely. - * @param aTone Tone to be played. - * @return None. - */ - void PlayDtmfTone(TDes& tone); - - /** - * Cancels playing. - * @param None. - * @return None. - */ - void Cancel(); - -public: - //From MDevSoundObserver - /** - * See MDevSoundObserver - */ - void InitializeComplete(TInt aError); - - /** - * See MDevSoundObserver - */ - void ToneFinished(TInt aError); - - /** - * See MDevSoundObserver - */ - void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {} - - /** - * See MDevSoundObserver - */ - void PlayError(TInt /*aError*/) {} - - /** - * See MDevSoundObserver - */ - void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {} - - /** - * See MDevSoundObserver - */ - void RecordError(TInt /*aError*/) {} - - /** - * See MDevSoundObserver - */ - void ConvertError(TInt /*aError*/) {} - /** - * See MDevSoundObserver - */ - void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {} - -protected: - - /** - * C++ default constructor. - */ - TMSAudioDtmfTonePlayer(TMSDTMFTonePlayerObserver& obsrvr, - guint audioPreference, guint audioPriority); - - void ConstructL(); - - /** - * Normalize tone. - * @param aTone dtmf tone. - * @return None. - */ - void Normalize(TChar& tone); - -private: - //new functions - - /** - * Converts the given value to the one that matches tha range used by - * CMMFDevSound. The CMMFDevSound uses valuess that can from 0 to the - * value returned by a call to CMMFDevSound::MaxVolume(). - */ - gint ConvertVolumeLevel(gint volume); - -protected: - // Data - - // Current volume setting. - gint iVolume; - - // DTMF player instance - CMMFDevSound* iDTMFPlayer; - - TMSDTMFTonePlayerObserver& iObserver; - guint iPref; - guint iPrior; - }; - -} //namespace TMS - -#endif // TMSAUDIODTMFTONEPLAYER_H - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmsdtmftoneplayerobserver.h --- a/mmserv/tms/tmscallserver/inc/tmsdtmftoneplayerobserver.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef DTMFTONEPLAYEROBSERVER_H -#define DTMFTONEPLAYEROBSERVER_H - -#include - -namespace TMS { - -/** - * Observer interface for knowing when dtmf tone player has been initialized. - */ -class TMSDTMFTonePlayerObserver - { -public: - virtual void DTMFInitCompleted(gint status) = 0; - virtual void DTMFToneFinished(gint status) = 0; - }; -} //namespace TMS - -#endif // DTMFTONEPLAYEROBSERVER_H - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmseteldtmfmonitor.h --- a/mmserv/tms/tmscallserver/inc/tmseteldtmfmonitor.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef TMSETELDTMFMONITOR_H -#define TMSETELDTMFMONITOR_H - -#include -#include -#include - -namespace TMS { - -// FORWARD DECLARATIONS -class TMSCSPCall; -class TMSDTMFProvider; - -/** - * TMSEtelDtmfMonitor class - * - * Monitors ETel for DTMF events. - * - * This monitor is applied only for listening incoming calls, i.e. - * line capabilites are not monitored. - * - * @lib csplugin.dll - * - */ -class TMSEtelDtmfMonitor : public CActive - { -public: - /** - * Two-phased constructing for the monitor. - * - * @param aObserver the observer for getting notification - * @param aMmCustom Custom API handle - */ - static TMSEtelDtmfMonitor* NewL(TMSDTMFProvider& aObserver, - RMmCustomAPI& aMmCustom); - - /** - * C++ default destructor - */ - virtual ~TMSEtelDtmfMonitor(); - - /** - * Start monitoring call events - */ - void StartMonitoring(); - -protected: // From CActive - /** - * From CActive - * RunL - */ - void RunL(); - - /** - * From CActive - * Cancels the monitor - */ - void DoCancel(); - -private: - /** - * C++ default constructor - * @param aObserver the observer for status change (incoming call) - * @param aMmCustom Custom API handle - */ - TMSEtelDtmfMonitor(TMSDTMFProvider& aObserver, RMmCustomAPI& aMmCustom); - -private: - /** - * Forwards events. - */ - TMSDTMFProvider& iObserver; - - /** - * Event data. Updated when event occurs. - */ - RMmCustomAPI::TDtmfInfo iEventData; - - /** - * Custom API reference. - */ - RMmCustomAPI& iMmCustom; - }; - -} //namespace TMS - -#endif // TMSETELDTMFMONITOR_H - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/inc/tmseteldtmfstopmonitor.h --- a/mmserv/tms/tmscallserver/inc/tmseteldtmfstopmonitor.h Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#ifndef TMSETELDTMFSTOPMONITOR_H -#define TMSETELDTMFSTOPMONITOR_H - -#include -#include - -namespace TMS { - -// FORWARD DECLARATIONS -class TMSDTMFProvider; - -/** - * TMSEtelDtmfStopMonitor class - * - * Monitors single ETel RMobilePhone for DTMF events. - * - * This monitor is applied only for listening incoming calls, i.e. - * line capabilites are not monitored. - * - */ -class TMSEtelDtmfStopMonitor : public CActive - { -public: - /** - * Two-phased constructing for the monitor. - * - * @param aObserver the observer for getting notification - * @param aPhone the line to monitor - */ - static TMSEtelDtmfStopMonitor* NewL(TMSDTMFProvider& aObserver, - RMobilePhone& aPhone); - - /** - * C++ default destructor - */ - virtual ~TMSEtelDtmfStopMonitor(); - - /** - * Start monitoring call events - */ - void StartMonitoring(); - -protected: // From CActive - /** - * From CActive - * RunL - */ - void RunL(); - - /** - * From CActive - * Cancels the monitor - */ - void DoCancel(); - -private: - /** - * C++ default constructor - * @param aObserver the observer for status change (incoming call) - * @param aPhone the line associated with the call - */ - TMSEtelDtmfStopMonitor(TMSDTMFProvider& aObserver, RMobilePhone& aPhone); - -private: - /** - * Forwards events. - */ - TMSDTMFProvider& iObserver; - - /** - * Phone that is being observed for incoming call. - */ - RMobilePhone& iPhone; - - /** - * Event received. - */ - RMobilePhone::TMobilePhoneDTMFEvent iEventData; - - }; - -} //namespace TMS - -#endif // TMSETELDTMFSTOPMONITOR_H - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscalladpt.cpp --- a/mmserv/tms/tmscallserver/src/tmscalladpt.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscalladpt.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -53,8 +53,9 @@ gint TMSCallAdpt::CreateCallL(gint callType, TMSCallAdpt*& callAdpt) { TRACE_PRN_FN_ENT; + gint retVal(TMS_RESULT_SUCCESS); TMSCallAdpt* self(NULL); - gint retVal(TMS_RESULT_SUCCESS); + switch (callType) { case TMS_CALL_IP: @@ -63,6 +64,7 @@ if (self) { retVal = self->PostConstruct(); + self->iCallType = callType; if (retVal != TMS_RESULT_SUCCESS) { delete self; @@ -77,6 +79,7 @@ if (self) { retVal = self->PostConstruct(); + self->iCallType = callType; if (retVal != TMS_RESULT_SUCCESS) { delete self; @@ -93,4 +96,23 @@ return retVal; } -// End of file +// ----------------------------------------------------------------------------- +// TMSCallAdpt::GetCallType +// +// ----------------------------------------------------------------------------- +// +void TMSCallAdpt::GetCallType(TMSCallType& callType) + { + callType = iCallType; + } + +// ----------------------------------------------------------------------------- +// TMSCallAdpt::IsUplActivated +// +// ----------------------------------------------------------------------------- +// +gboolean TMSCallAdpt::IsUplActivated() + { + return (iUplState == EActivated)? TRUE : FALSE; + } + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp --- a/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscallcsadpt.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -26,9 +26,6 @@ #include "tmsshared.h" #include "tmsclientserver.h" #include "tmstarsettings.h" -#include "tmsdtmftoneplayer.h" -#include "tmsdtmfprovider.h" -#include "tmsdtmfnotifier.h" using namespace TMS; @@ -58,9 +55,6 @@ iCSUplink = NULL; iRouting = NULL; iTarSettings = NULL; - iDTMFDnlinkPlayer = NULL; - iDTMFUplinkPlayer = NULL; - iDTMFNotifier = NULL; TRACE_PRN_FN_EXT; } @@ -84,9 +78,6 @@ delete iRouting; delete iTarSettings; - delete iDTMFUplinkPlayer; - delete iDTMFDnlinkPlayer; - delete iDTMFNotifier; delete iCSUplink; delete iCSDownlink; @@ -112,8 +103,8 @@ TRACE_PRN_FN_ENT; gint status(TMS_RESULT_SUCCESS); iNextStreamId = 1; - iUplinkInitialized = FALSE; - iDnlinkInitialized = FALSE; + iUplState = EIdle; + iDnlState = EIdle; TRACE_PRN_FN_EXT; return status; } @@ -133,12 +124,11 @@ case TMS_STREAM_UPLINK: { status = TMS_RESULT_ALREADY_EXIST; - if (!iUplinkInitialized) + if (iUplState == EIdle) { iUplinkStreamId = iNextStreamId; outStrmId = iUplinkStreamId; iNextStreamId++; - //iUplinkInitialized = TRUE; //not initialized yet! status = TMS_RESULT_SUCCESS; } break; @@ -146,12 +136,11 @@ case TMS_STREAM_DOWNLINK: { status = TMS_RESULT_ALREADY_EXIST; - if (!iDnlinkInitialized) + if (iDnlState == EIdle) { iDnlinkStreamId = iNextStreamId; outStrmId = iDnlinkStreamId; iNextStreamId++; - //iDnlinkInitialized = TRUE; //not initialized yet! status = TMS_RESULT_SUCCESS; } break; @@ -242,15 +231,6 @@ { TRAP(status, iCSUplink = TMSCSUplink::NewL(*this, retrytime)); } - if (!iDTMFUplinkPlayer && status == TMS_RESULT_SUCCESS) - { - TRAP(status, iDTMFUplinkPlayer = TMSDTMFProvider::NewL()); - iDTMFUplinkPlayer->AddObserver(*this); - } - if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS) - { - TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL()); - } return status; } @@ -275,15 +255,6 @@ { TRAP(status, iTarSettings = TMSTarSettings::NewL()); } - if (!iDTMFDnlinkPlayer && status == TMS_RESULT_SUCCESS) - { - TRAP(status, iDTMFDnlinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this, - KAudioDTMFString, KAudioPriorityDTMFString)); - } - if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS) - { - TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL()); - } return status; } @@ -301,7 +272,8 @@ { case TMS_STREAM_UPLINK: { - if (iCSUplink && strmId == iUplinkStreamId) + if (iCSUplink && strmId == iUplinkStreamId && + iUplState == EInitialized) { iCSUplink->Activate(retrytime); status = TMS_RESULT_SUCCESS; @@ -310,7 +282,8 @@ } case TMS_STREAM_DOWNLINK: { - if (iCSDownlink && strmId == iDnlinkStreamId) + if (iCSDownlink && strmId == iDnlinkStreamId && + iDnlState == EInitialized) { iCSDownlink->Activate(retrytime); status = TMS_RESULT_SUCCESS; @@ -356,9 +329,11 @@ { case TMS_STREAM_UPLINK: { - if (iCSUplink && strmId == iUplinkStreamId) + if (iCSUplink && strmId == iUplinkStreamId && + iUplState == EActivated) { iCSUplink->Deactivate(); + iUplState = EInitialized; status = TMS_RESULT_SUCCESS; NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status); } @@ -366,9 +341,11 @@ } case TMS_STREAM_DOWNLINK: { - if (iCSDownlink && strmId == iDnlinkStreamId) + if (iCSDownlink && strmId == iDnlinkStreamId && + iDnlState == EActivated) { iCSDownlink->Deactivate(); + iDnlState = EInitialized; status = TMS_RESULT_SUCCESS; NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status); } @@ -399,19 +376,21 @@ { case TMS_STREAM_UPLINK: { - if (iCSUplink && strmId == iUplinkStreamId) + if (iCSUplink && strmId == iUplinkStreamId && iUplState != EIdle) { iCSUplink->Deactivate(); - iUplinkInitialized = FALSE; + iUplState = EIdle; status = TMS_RESULT_SUCCESS; NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete, status); } break; + } case TMS_STREAM_DOWNLINK: - if (iCSDownlink && strmId == iDnlinkStreamId) + { + if (iCSDownlink && strmId == iDnlinkStreamId && iDnlState != EIdle) { iCSDownlink->Deactivate(); - iDnlinkInitialized = FALSE; + iDnlState = EIdle; status = TMS_RESULT_SUCCESS; NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete, status); @@ -445,7 +424,7 @@ if (strmId == iUplinkStreamId) { iUplinkStreamId = -1; - iUplinkInitialized = FALSE; + iUplState = EIdle; } break; } @@ -454,7 +433,7 @@ if (strmId == iDnlinkStreamId) { iDnlinkStreamId = -1; - iDnlinkInitialized = FALSE; + iDnlState = EIdle; } break; } @@ -521,7 +500,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSDownlink && iDnlinkInitialized) + if (iCSDownlink && iDnlState != EIdle) { volume = iCSDownlink->MaxVolume(); status = TMS_RESULT_SUCCESS; @@ -540,7 +519,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSDownlink && iDnlinkInitialized) + if (iCSDownlink && iDnlState != EIdle) { iCSDownlink->SetVolume(volume); status = TMS_RESULT_SUCCESS; @@ -559,7 +538,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSDownlink && iDnlinkInitialized) + if (iCSDownlink && iDnlState != EIdle) { volume = iCSDownlink->Volume(); status = TMS_RESULT_SUCCESS; @@ -577,7 +556,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSUplink && iUplinkInitialized) + if (iCSUplink && iUplState != EIdle) { gain = iCSUplink->MaxGain(); status = TMS_RESULT_SUCCESS; @@ -596,7 +575,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSUplink && iUplinkInitialized) + if (iCSUplink && iUplState != EIdle) { iCSUplink->SetGain(gain); status = TMS_RESULT_SUCCESS; @@ -615,7 +594,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSUplink && iUplinkInitialized) + if (iCSUplink && iUplState != EIdle) { gain = iCSUplink->Gain(); status = TMS_RESULT_SUCCESS; @@ -633,7 +612,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSDownlink && iDnlinkInitialized) + if (iCSDownlink && iDnlState != EIdle) { volume = iCSDownlink->MaxVolume(); status = TMS_RESULT_SUCCESS; @@ -653,7 +632,7 @@ TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); iGlobalVol = volume; - if (iCSDownlink && iDnlinkInitialized) + if (iCSDownlink && iDnlState != EIdle) { iCSDownlink->SetVolume(volume); status = TMS_RESULT_SUCCESS; @@ -671,7 +650,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSDownlink && iDnlinkInitialized) + if (iCSDownlink && iDnlState != EIdle) { volume = iCSDownlink->Volume(); status = TMS_RESULT_SUCCESS; @@ -689,7 +668,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSUplink && iUplinkInitialized) + if (iCSUplink && iUplState != EIdle) { gain = iCSUplink->MaxGain(); status = TMS_RESULT_SUCCESS; @@ -709,7 +688,7 @@ TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); iGlobalGain = gain; - if (iCSUplink && iUplinkInitialized) + if (iCSUplink && iUplState != EIdle) { iCSUplink->SetGain(gain); status = TMS_RESULT_SUCCESS; @@ -727,7 +706,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iCSUplink && iUplinkInitialized) + if (iCSUplink && iUplState != EIdle) { gain = iCSUplink->Gain(); status = TMS_RESULT_SUCCESS; @@ -942,7 +921,6 @@ status = TMS_RESULT_SUCCESS; output = TOTMSOUTPUT(taroutput); } - TRACE_PRN_FN_EXT; return status; } @@ -984,10 +962,8 @@ RBufWriteStream stream; stream.Open(*outputsbuf); CleanupClosePushL(stream); - TArray availableOutputs = iRouting->AvailableOutputs(); - guint numOfItems = availableOutputs.Count(); count = numOfItems; for (guint i = 0; i < numOfItems; i++) @@ -995,7 +971,6 @@ tmsoutput = TOTMSOUTPUT(availableOutputs[i]); stream.WriteUint32L(tmsoutput); } - CleanupStack::PopAndDestroy(&stream); status = TMS_RESULT_SUCCESS; } @@ -1005,176 +980,6 @@ } // ----------------------------------------------------------------------------- -// TMSCallCSAdpt::StartDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallCSAdpt::StartDTMF(const TMSStreamType strmtype, TDes& dtmfstring) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED); - TmsMsgBufPckg dtmfpckg; - dtmfpckg().iStatus = status; - dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; - - if (strmtype == TMS_STREAM_DOWNLINK && iDnlinkInitialized) - { - if (iDTMFDnlinkPlayer) - { - iDTMFDnlinkPlayer->PlayDtmfTone(dtmfstring); - status = TMS_RESULT_SUCCESS; - } - dtmfpckg().iStatus = TMS_RESULT_SUCCESS; - dtmfpckg().iRequest = ECmdDTMFToneDnlPlayStarted; - } - else if (strmtype == TMS_STREAM_UPLINK && iUplinkInitialized) - { - //use etel for uplink - if (iDTMFUplinkPlayer) - { - status = iDTMFUplinkPlayer->SendDtmfToneString(dtmfstring); - status = TMS_RESULT_SUCCESS; - } - dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status); - dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted; - } - - if (iDTMFNotifier) - { - iDTMFNotifier->SetDtmf(dtmfpckg); - } - - TRACE_PRN_IF_ERR(status); - TRACE_PRN_FN_EXT; - return status; - } - -// ----------------------------------------------------------------------------- -// TMSCallCSAdpt::StopDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallCSAdpt::StopDTMF(const TMSStreamType streamtype) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_SUCCESS); - - if (streamtype == TMS_STREAM_DOWNLINK && iDTMFDnlinkPlayer) - { - iDTMFDnlinkPlayer->Cancel(); - } - else if (streamtype == TMS_STREAM_UPLINK && iDTMFUplinkPlayer) - { - status = iDTMFUplinkPlayer->StopDtmfTone(); - status = TMSUtility::EtelToTMSResult(status); - } - - TRACE_PRN_FN_EXT; - return status; - } - -// ----------------------------------------------------------------------------- -// TMSCallCSAdpt::ContinueDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallCSAdpt::ContinueDTMF(const gboolean sending) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - - if (iDTMFUplinkPlayer) - { - status = iDTMFUplinkPlayer->ContinueDtmfStringSending(sending); - status = TMSUtility::EtelToTMSResult(status); - } - - TRACE_PRN_FN_EXT; - return status; - } - -//From TMSDTMFTonePlayerObserver -// ----------------------------------------------------------------------------- -// TMSCallCSAdpt::DTMFInitCompleted -// -// ----------------------------------------------------------------------------- -// -void TMSCallCSAdpt::DTMFInitCompleted(gint /*status*/) - { - TRACE_PRN_FN_ENT; - // TODO: process error - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSCallCSAdpt::DTMFToneFinished -// -// ----------------------------------------------------------------------------- -// -void TMSCallCSAdpt::DTMFToneFinished(gint status) - { - TRACE_PRN_FN_ENT; - TRACE_PRN_IF_ERR(status); - TmsMsgBufPckg dtmfpckg; - - // KErrUnderflow indicates end of DTMF playback. - if (status == KErrUnderflow || status == KErrInUse) - { - status = TMS_RESULT_SUCCESS; - } - dtmfpckg().iStatus = TMSUtility::TMSResult(status); - dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; - if (iDTMFNotifier) - { - iDTMFNotifier->SetDtmf(dtmfpckg); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSCallCSAdpt::HandleDTMFEvent -// -// ----------------------------------------------------------------------------- -// -void TMSCallCSAdpt::HandleDTMFEvent( - const TMSDTMFObserver::TCCPDtmfEvent event, const gint status, - const TChar /*tone*/) - { - TRACE_PRN_FN_ENT; - TmsMsgBufPckg dtmfpckg; - - TRACE_PRN_N1(_L("**TMS TMSCallCSAdpt::HandleDTMFEvent error:%d"), status); - - dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status); - - switch (event) - { - case ECCPDtmfUnknown: //Unknown - break; - case ECCPDtmfManualStart: //DTMF sending started manually - case ECCPDtmfSequenceStart: //Automatic DTMF sending initialized - dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted; - break; - case ECCPDtmfManualStop: //DTMF sending stopped manually - case ECCPDtmfManualAbort: //DTMF sending aborted manually - case ECCPDtmfSequenceStop: //Automatic DTMF sending stopped - case ECCPDtmfSequenceAbort: //Automatic DTMF sending aborted - case ECCPDtmfStopInDtmfString: //There was stop mark in DTMF string - case ECCPDtmfStringSendingCompleted: //DTMF sending success - dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; - break; - default: - break; - } - - if (iDTMFNotifier) - { - iDTMFNotifier->SetDtmf(dtmfpckg, TRUE); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- // TMSCallCSAdpt::DownlinkInitCompleted // From TMSCSDevSoundObserver // ----------------------------------------------------------------------------- @@ -1184,7 +989,7 @@ TRACE_PRN_FN_ENT; if (status == TMS_RESULT_SUCCESS) { - iDnlinkInitialized = TRUE; + iDnlState = EInitialized; } NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status); TRACE_PRN_FN_EXT; @@ -1200,7 +1005,7 @@ TRACE_PRN_FN_ENT; if (status == TMS_RESULT_SUCCESS) { - iUplinkInitialized = TRUE; + iUplState = EInitialized; } NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status); TRACE_PRN_FN_EXT; @@ -1214,6 +1019,10 @@ void TMSCallCSAdpt::UplinkActivationCompleted(gint status) { TRACE_PRN_FN_ENT; + if (status == TMS_RESULT_SUCCESS) + { + iUplState = EActivated; + } NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status); TRACE_PRN_FN_EXT; } @@ -1226,6 +1035,10 @@ void TMSCallCSAdpt::DownlinkActivationCompleted(gint status) { TRACE_PRN_FN_ENT; + if (status == TMS_RESULT_SUCCESS) + { + iDnlState = EActivated; + } NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status); TRACE_PRN_FN_EXT; } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscallipadpt.cpp --- a/mmserv/tms/tmscallserver/src/tmscallipadpt.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscallipadpt.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -47,9 +47,6 @@ TRACE_PRN_FN_ENT; iIPDownlink = NULL; iIPUplink = NULL; - iDTMFDnlinkPlayer = NULL; - iDTMFUplinkPlayer = NULL; - iDTMFNotifier = NULL; TRACE_PRN_FN_EXT; } @@ -74,9 +71,6 @@ iCodecs.Reset(); iCodecs.Close(); iArrBitrates.Reset(); - delete iDTMFUplinkPlayer; - delete iDTMFDnlinkPlayer; - delete iDTMFNotifier; delete iIPUplink; delete iIPDownlink; @@ -102,8 +96,8 @@ TRACE_PRN_FN_ENT; gint status(TMS_RESULT_SUCCESS); iNextStreamId = 1; - iUplinkInitialized = FALSE; - iDnlinkInitialized = FALSE; + iUplState = EIdle; + iDnlState = EIdle; TRACE_PRN_FN_EXT; return status; } @@ -123,12 +117,11 @@ case TMS_STREAM_UPLINK: { status = TMS_RESULT_ALREADY_EXIST; - if (!iUplinkInitialized) + if (iUplState == EIdle) { iUplinkStreamId = iNextStreamId; outStrmId = iUplinkStreamId; iNextStreamId++; - //iUplinkInitialized = TRUE; //not initialized yet! status = TMS_RESULT_SUCCESS; } break; @@ -136,12 +129,11 @@ case TMS_STREAM_DOWNLINK: { status = TMS_RESULT_ALREADY_EXIST; - if (!iDnlinkInitialized) + if (iDnlState == EIdle) { iDnlinkStreamId = iNextStreamId; outStrmId = iDnlinkStreamId; iNextStreamId++; - //iDnlinkInitialized = TRUE; //not initialized yet! status = TMS_RESULT_SUCCESS; } break; @@ -183,10 +175,6 @@ { SetFormat(iUplinkStreamId, fourCC); status = OpenUplink(message, retrytime); - if (status == TMS_RESULT_SUCCESS) - { - status = InitDTMF(TMS_STREAM_UPLINK); - } } break; } @@ -197,10 +185,6 @@ { SetFormat(iDnlinkStreamId, fourCC); status = OpenDownlink(message, retrytime); - if (status == TMS_RESULT_SUCCESS) - { - status = InitDTMF(TMS_STREAM_DOWNLINK); - } } break; } @@ -230,21 +214,21 @@ { case TMS_STREAM_UPLINK: { - if (iIPUplink && strmId == iUplinkStreamId) + if (iIPUplink && strmId == iUplinkStreamId && + iUplState == EInitialized) { iIPUplink->Start(retrytime); status = TMS_RESULT_SUCCESS; - NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status); } break; } case TMS_STREAM_DOWNLINK: { - if (iIPDownlink && strmId == iDnlinkStreamId) + if (iIPDownlink && strmId == iDnlinkStreamId && + iDnlState == EInitialized) { iIPDownlink->Start(retrytime); status = TMS_RESULT_SUCCESS; - NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status); } break; } @@ -315,9 +299,11 @@ { case TMS_STREAM_UPLINK: { - if (iIPUplink && strmId == iUplinkStreamId) + if (iIPUplink && strmId == iUplinkStreamId && + iUplState == EActivated) { iIPUplink->Stop(); + iUplState = EInitialized; status = TMS_RESULT_SUCCESS; NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status); } @@ -325,9 +311,11 @@ } case TMS_STREAM_DOWNLINK: { - if (iIPDownlink && strmId == iDnlinkStreamId) + if (iIPDownlink && strmId == iDnlinkStreamId && + iDnlState == EActivated) { iIPDownlink->Stop(); + iDnlState = EInitialized; status = TMS_RESULT_SUCCESS; NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status); } @@ -358,11 +346,10 @@ { case TMS_STREAM_UPLINK: { - if (iIPUplink && strmId == iUplinkStreamId) + if (iIPUplink && strmId == iUplinkStreamId && iUplState != EIdle) { iIPUplink->Stop(); - //iUplinkStreamId = -1; - iUplinkInitialized = FALSE; + iUplState = EIdle; status = TMS_RESULT_SUCCESS; NotifyClient(iUplinkStreamId, ECmdUplinkDeInitComplete, status); } @@ -370,11 +357,10 @@ } case TMS_STREAM_DOWNLINK: { - if (iIPDownlink && strmId == iDnlinkStreamId) + if (iIPDownlink && strmId == iDnlinkStreamId && iDnlState != EIdle) { iIPDownlink->Stop(); - //iDnlinkStreamId = -1; - iDnlinkInitialized = FALSE; + iDnlState = EIdle; status = TMS_RESULT_SUCCESS; NotifyClient(iDnlinkStreamId, ECmdDownlinkDeInitComplete, status); @@ -387,7 +373,6 @@ break; } } - TRACE_PRN_FN_EXT; return status; } @@ -409,7 +394,7 @@ if (strmId == iUplinkStreamId) { iUplinkStreamId = -1; - iUplinkInitialized = FALSE; + iUplState = EIdle; } break; } @@ -418,7 +403,7 @@ if (strmId == iDnlinkStreamId) { iDnlinkStreamId = -1; - iDnlinkInitialized = FALSE; + iDnlState = EIdle; } break; } @@ -538,7 +523,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iDnlinkInitialized && iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->GetMaxVolume(volume); iMaxVolume = volume; @@ -557,7 +542,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iDnlinkInitialized && iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->SetVolume(volume); NotifyClient(iDnlinkStreamId, ECmdSetVolume, status); @@ -575,7 +560,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iDnlinkInitialized && iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->GetVolume(volume); } @@ -592,7 +577,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iUplinkInitialized && iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetMaxGain(gain); iMaxGain = gain; @@ -611,7 +596,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iUplinkInitialized && iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->SetGain(gain); NotifyClient(iUplinkStreamId, ECmdSetGain, status); @@ -629,7 +614,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iUplinkInitialized && iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetGain(gain); } @@ -646,7 +631,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iDnlinkInitialized && iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->GetMaxVolume(volume); iMaxVolume = volume; @@ -666,7 +651,7 @@ TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); //iGlobalVol = volume; - if (iDnlinkInitialized && iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->SetVolume(volume); } @@ -683,7 +668,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iDnlinkInitialized && iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->GetVolume(volume); } @@ -700,7 +685,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iUplinkInitialized && iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetMaxGain(gain); iMaxGain = gain; @@ -720,7 +705,7 @@ TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); //iGlobalGain = gain; - if (iUplinkInitialized && iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->SetGain(gain); } @@ -737,7 +722,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iUplinkInitialized && iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetGain(gain); } @@ -806,7 +791,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetSupportedBitrates(iArrBitrates); count = iArrBitrates.Count(); @@ -862,7 +847,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetBitrate(bitrate); } @@ -879,7 +864,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->SetBitrate(bitrate); } @@ -896,7 +881,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->GetVad(fmttype, vad); } @@ -913,7 +898,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPUplink) + if (iIPUplink && iUplState != EIdle) { status = iIPUplink->SetVad(fmttype, vad); } @@ -930,7 +915,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPDownlink) + if (iIPDownlink && iDnlState == EInitialized) { status = iIPDownlink->GetCng(fmttype, cng); } @@ -947,7 +932,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPDownlink) + if (iIPDownlink && iDnlState == EInitialized) { status = iIPDownlink->SetCng(fmttype, cng); } @@ -964,7 +949,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPDownlink) + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->GetPlc(fmttype, plc); } @@ -981,7 +966,7 @@ { TRACE_PRN_FN_ENT; gint status(TMS_RESULT_INVALID_STATE); - if (iIPDownlink) + if (iIPDownlink && iDnlState == EInitialized) { status = iIPDownlink->SetPlc(fmttype, plc); } @@ -1172,23 +1157,22 @@ gint TMSCallIPAdpt::SetIlbcCodecMode(const gint mode, const TMSStreamType strmtype) { - gint status(TMS_RESULT_INVALID_ARGUMENT); + gint status(TMS_RESULT_SUCCESS); - if (strmtype == TMS_STREAM_DOWNLINK) + if (strmtype == TMS_STREAM_DOWNLINK && iIPDownlink && + iDnlState == EInitialized) { - if (iDnlinkInitialized && iIPDownlink) - { - status = iIPDownlink->SetIlbcCodecMode(mode); - } + status = iIPDownlink->SetIlbcCodecMode(mode); } - else if (strmtype == TMS_STREAM_UPLINK) + else if (strmtype == TMS_STREAM_UPLINK && iIPUplink && + iUplState == EInitialized) { - if (iUplinkInitialized && iIPUplink) - { - status = iIPUplink->SetIlbcCodecMode(mode); - } + status = iIPUplink->SetIlbcCodecMode(mode); } - + else + { + status = TMS_RESULT_INVALID_STATE; + } return status; } @@ -1199,23 +1183,22 @@ // gint TMSCallIPAdpt::GetIlbcCodecMode(gint& mode, const TMSStreamType strmtype) { - gint status(TMS_RESULT_INVALID_ARGUMENT); + gint status(TMS_RESULT_SUCCESS); - if (strmtype == TMS_STREAM_DOWNLINK) + if (strmtype == TMS_STREAM_DOWNLINK && iIPDownlink && + iDnlState != EIdle) { - if (iDnlinkInitialized && iIPDownlink) - { - status = iIPDownlink->GetIlbcCodecMode(mode); - } + status = iIPDownlink->GetIlbcCodecMode(mode); } - else if (strmtype == TMS_STREAM_UPLINK) + else if (strmtype == TMS_STREAM_UPLINK && iIPUplink && + iUplState != EIdle) { - if (iUplinkInitialized && iIPUplink) - { - status = iIPUplink->GetIlbcCodecMode(mode); - } + status = iIPUplink->GetIlbcCodecMode(mode); } - + else + { + status = TMS_RESULT_INVALID_STATE; + } return status; } @@ -1227,23 +1210,22 @@ gint TMSCallIPAdpt::SetG711CodecMode(const gint mode, const TMSStreamType strmtype) { - gint status(TMS_RESULT_INVALID_ARGUMENT); + gint status(TMS_RESULT_SUCCESS); - if (strmtype == TMS_STREAM_DOWNLINK) + if (strmtype == TMS_STREAM_DOWNLINK && iIPDownlink && + iDnlState == EInitialized) { - if (iDnlinkInitialized && iIPDownlink) - { - status = iIPDownlink->SetG711CodecMode(mode); - } + status = iIPDownlink->SetG711CodecMode(mode); } - else if (strmtype == TMS_STREAM_UPLINK) + else if (strmtype == TMS_STREAM_UPLINK && iIPUplink && + iUplState == EInitialized) { - if (iUplinkInitialized && iIPUplink) - { - status = iIPUplink->SetG711CodecMode(mode); - } + status = iIPUplink->SetG711CodecMode(mode); } - + else + { + status = TMS_RESULT_INVALID_STATE; + } return status; } @@ -1254,23 +1236,22 @@ // gint TMSCallIPAdpt::GetG711CodecMode(gint& mode, const TMSStreamType strmtype) { - gint status(TMS_RESULT_INVALID_ARGUMENT); + gint status(TMS_RESULT_SUCCESS); - if (strmtype == TMS_STREAM_DOWNLINK) + if (strmtype == TMS_STREAM_DOWNLINK && iIPDownlink && + iDnlState != EIdle) { - if (iDnlinkInitialized && iIPDownlink) - { - status = iIPDownlink->GetG711CodecMode(mode); - } + status = iIPDownlink->GetG711CodecMode(mode); } - else if (strmtype == TMS_STREAM_UPLINK) + else if (strmtype == TMS_STREAM_UPLINK && iIPUplink && + iUplState != EIdle) { - if (iUplinkInitialized && iIPUplink) - { - status = iIPUplink->GetG711CodecMode(mode); - } + status = iIPUplink->GetG711CodecMode(mode); } - + else + { + status = TMS_RESULT_INVALID_STATE; + } return status; } @@ -1281,8 +1262,8 @@ // gint TMSCallIPAdpt::FrameModeRqrdForEC(gboolean& frmodereq) { - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState == EInitialized) { status = iIPDownlink->FrameModeRqrdForEC(frmodereq); } @@ -1296,8 +1277,8 @@ // gint TMSCallIPAdpt::SetFrameMode(const gboolean frmode) { - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState == EInitialized) { status = iIPDownlink->SetFrameMode(frmode); } @@ -1311,8 +1292,8 @@ // gint TMSCallIPAdpt::GetFrameMode(gboolean& frmode) { - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState != EIdle) { status = iIPDownlink->GetFrameMode(frmode); } @@ -1325,8 +1306,8 @@ // gint TMSCallIPAdpt::ConcealErrorForNextBuffer() { - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState == EActivated) { status = iIPDownlink->ConcealErrorForNextBuffer(); } @@ -1340,8 +1321,8 @@ // gint TMSCallIPAdpt::BadLsfNextBuffer() { - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState == EActivated) { status = iIPDownlink->BadLsfNextBuffer(); } @@ -1356,14 +1337,15 @@ gint TMSCallIPAdpt::SetOutput(TMSAudioOutput output) { TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iDnlinkInitialized && iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState != EIdle) { TRAP(status, iIPDownlink->SetAudioDeviceL(output)); } TRACE_PRN_FN_EXT; return status; } + // ----------------------------------------------------------------------------- // TMSCallIPAdpt::GetOutput // @@ -1372,8 +1354,8 @@ gint TMSCallIPAdpt::GetOutput(TMSAudioOutput& output) { TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_UNINITIALIZED_OBJECT); - if (iDnlinkInitialized && iIPDownlink) + gint status(TMS_RESULT_INVALID_STATE); + if (iIPDownlink && iDnlState != EIdle) { TRAP(status, iIPDownlink->GetAudioDeviceL(output)); } @@ -1399,162 +1381,11 @@ gint TMSCallIPAdpt::GetAvailableOutputsL(gint& /*count*/, CBufFlat*& /*outputsbuf*/) { + //TODO: return public & private return TMS_RESULT_FEATURE_NOT_SUPPORTED; } // ----------------------------------------------------------------------------- -// TMSCallIPAdpt::InitDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallIPAdpt::InitDTMF(TMSStreamType strmtype) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED); - - if (strmtype == TMS_STREAM_DOWNLINK) - { - delete iDTMFDnlinkPlayer; - iDTMFDnlinkPlayer = NULL; - TRAP(status, iDTMFDnlinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this, - KAudioDTMFString, KAudioPriorityDTMFString)); - } - else if (strmtype == TMS_STREAM_UPLINK) - { - delete iDTMFUplinkPlayer; - iDTMFUplinkPlayer = NULL; - TRAP(status, iDTMFUplinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this, - KAudioDTMFString, KAudioPriorityDTMFString)); - } - - if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS) - { - TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL()); - } - - TRACE_PRN_FN_EXT; - return status; - } - -// ----------------------------------------------------------------------------- -// TMSCallIPAdpt::StartDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallIPAdpt::StartDTMF(TMSStreamType strmtype, TDes& dtmfstring) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED); - TmsMsgBufPckg dtmfpckg; - dtmfpckg().iStatus = status; - dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; - - if (strmtype == TMS_STREAM_DOWNLINK) - { - status = TMS_RESULT_UNINITIALIZED_OBJECT; - if (iDTMFDnlinkPlayer) - { - iDTMFDnlinkPlayer->PlayDtmfTone(dtmfstring); - status = TMS_RESULT_SUCCESS; - } - dtmfpckg().iStatus = status; - dtmfpckg().iRequest = ECmdDTMFToneDnlPlayStarted; - } - else if (strmtype == TMS_STREAM_UPLINK) - { - status = TMS_RESULT_UNINITIALIZED_OBJECT; - if (iDTMFUplinkPlayer) - { - iDTMFUplinkPlayer->PlayDtmfTone(dtmfstring); - status = TMS_RESULT_SUCCESS; - } - dtmfpckg().iStatus = status; - dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted; - } - - if (iDTMFNotifier) - { - iDTMFNotifier->SetDtmf(dtmfpckg); - } - - TRACE_PRN_IF_ERR(status); - TRACE_PRN_FN_EXT; - return status; - } - -// ----------------------------------------------------------------------------- -// TMSCallIPAdpt::StopDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallIPAdpt::StopDTMF(TMSStreamType streamtype) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_SUCCESS); - - if (streamtype == TMS_STREAM_DOWNLINK && iDTMFDnlinkPlayer) - { - iDTMFDnlinkPlayer->Cancel(); - } - else if (streamtype == TMS_STREAM_UPLINK && iDTMFUplinkPlayer) - { - //status = iDTMFUplinkPlayer->StopDtmfTone(); - iDTMFUplinkPlayer->Cancel(); - } - - TRACE_PRN_FN_EXT; - return status; - } - -// ----------------------------------------------------------------------------- -// TMSCallIPAdpt::ContinueDTMF -// -// ----------------------------------------------------------------------------- -// -gint TMSCallIPAdpt::ContinueDTMF(const gboolean /*sending*/) - { - return TMS_RESULT_FEATURE_NOT_SUPPORTED; - } - -//From DTMFTonePlayerObserver -// ----------------------------------------------------------------------------- -// TMSCallIPAdpt::DTMFInitCompleted -// -// ----------------------------------------------------------------------------- -// -void TMSCallIPAdpt::DTMFInitCompleted(gint /*status*/) - { - TRACE_PRN_FN_ENT; - // TODO: process error - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSCallIPAdpt::DTMFToneFinished -// -// ----------------------------------------------------------------------------- -// -void TMSCallIPAdpt::DTMFToneFinished(gint status) - { - TRACE_PRN_FN_ENT; - TRACE_PRN_IF_ERR(status); - TmsMsgBufPckg dtmfpckg; - - // KErrUnderflow indicates end of DTMF playback. - if (status == KErrUnderflow /*|| status == KErrInUse*/) - { - status = TMS_RESULT_SUCCESS; - } - dtmfpckg().iStatus = TMSUtility::TMSResult(status); - dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; - if (iDTMFNotifier) - { - iDTMFNotifier->SetDtmf(dtmfpckg); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- // TMSCallIPAdpt::DownlinkInitCompleted // From TMSIPDevSoundObserver // ----------------------------------------------------------------------------- @@ -1564,7 +1395,7 @@ TRACE_PRN_FN_ENT; if (status == TMS_RESULT_SUCCESS) { - iDnlinkInitialized = TRUE; + iDnlState = EInitialized; } NotifyClient(iDnlinkStreamId, ECmdDownlinkInitComplete, status); TRACE_PRN_FN_EXT; @@ -1580,7 +1411,7 @@ TRACE_PRN_FN_ENT; if (status == TMS_RESULT_SUCCESS) { - iUplinkInitialized = TRUE; + iUplState = EInitialized; } NotifyClient(iUplinkStreamId, ECmdUplinkInitComplete, status); TRACE_PRN_FN_EXT; @@ -1594,6 +1425,10 @@ void TMSCallIPAdpt::UplinkStarted(gint status) { TRACE_PRN_FN_ENT; + if (status == TMS_RESULT_SUCCESS) + { + iUplState = EActivated; + } NotifyClient(iUplinkStreamId, ECmdUplinkStarted, status); TRACE_PRN_FN_EXT; } @@ -1606,6 +1441,10 @@ void TMSCallIPAdpt::DownlinkStarted(gint status) { TRACE_PRN_FN_ENT; + if (status == TMS_RESULT_SUCCESS) + { + iDnlState = EActivated; + } NotifyClient(iDnlinkStreamId, ECmdDownlinkStarted, status); TRACE_PRN_FN_EXT; } @@ -1630,4 +1469,3 @@ } } -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscallsession.cpp --- a/mmserv/tms/tmscallserver/src/tmscallsession.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscallsession.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -225,14 +225,8 @@ case TMS_ROUTING_AVAILABLE_OUTPUT_GET: HandleRoutingGetAvailableOutputsL(aMessage); break; - case TMS_DTMF_START: - HandleDTMFStart(aMessage); - break; - case TMS_DTMF_STOP: - HandleDTMFStop(aMessage); - break; - case TMS_DTMF_CONTINUE: - HandleDTMFContinue(aMessage); + case TMS_GET_ACTIVE_CALL_PARAMS: + HandleGetActiveCallL(aMessage); break; default: User::Leave(TMS_RESULT_ILLEGAL_OPERATION); @@ -1113,68 +1107,24 @@ CleanupStack::PopAndDestroy(outputbuf); } aMessage.Complete(status); - } - -void TMSCallSession::HandleDTMFStart(const RMessage2& aMessage) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_DOES_NOT_EXIST); - - if (iCallAdpt) - { - TMSStreamType strmtype; - gint len = 0; - strmtype = (TMSStreamType) aMessage.Int0(); - len = aMessage.GetDesLength(1); - HBufC* tone(NULL); - if (len > 0) - { - TRAP(status,tone = HBufC::NewL(len)); - if (status == KErrNone) - { - TPtr ptr = tone->Des(); - status = aMessage.Read(1, ptr); - TRACE_PRN_N(ptr); - if (status == KErrNone) - { - status = iCallAdpt->StartDTMF(strmtype, ptr); - } - } - delete tone; - tone = NULL; - } - } - - aMessage.Complete(status); TRACE_PRN_FN_EXT; } -void TMSCallSession::HandleDTMFStop(const RMessage2& aMessage) +void TMSCallSession::HandleGetActiveCallL(const RMessage2& aMessage) { - TRACE_PRN_FN_ENT; gint status(TMS_RESULT_DOES_NOT_EXIST); + TMSCallType callType; + gboolean active(FALSE); if (iCallAdpt) { - TMSStreamType streamtype; - streamtype = (TMSStreamType) aMessage.Int0(); - status = iCallAdpt->StopDTMF(streamtype); + iCallAdpt->GetCallType(callType); + active = iCallAdpt->IsUplActivated(); + TmsCallMsgBufPckg p; + p().iInt = (gint) callType; + p().iBool = active; + aMessage.WriteL(0, p); + status = TMS_RESULT_SUCCESS; } aMessage.Complete(status); - TRACE_PRN_FN_EXT; } -void TMSCallSession::HandleDTMFContinue(const RMessage2& aMessage) - { - TRACE_PRN_FN_ENT; - gint status(TMS_RESULT_DOES_NOT_EXIST); - if (iCallAdpt) - { - TBool continuesending; - continuesending = (TBool) aMessage.Int0(); - status = iCallAdpt->ContinueDTMF(continuesending); - } - aMessage.Complete(status); - TRACE_PRN_FN_EXT; - } - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscsdevsound.cpp --- a/mmserv/tms/tmscallserver/src/tmscsdevsound.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscsdevsound.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -183,6 +183,7 @@ CancelTimer(); NotifyEvent(aError); } + TRACE_PRN_IF_ERR(aError); TRACE_PRN_FN_EXT; } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscsdownlink.cpp --- a/mmserv/tms/tmscallserver/src/tmscsdownlink.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscsdownlink.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -141,7 +141,8 @@ TRACE_PRN_N1(_L("TMSCSDownlink::PlayError[%d]"), aError); // We don't react to devsound errors unless we are activating. - if (iActivationOngoing && aError == KErrAccessDenied) + if (iActivationOngoing && (aError == KErrAccessDenied || + aError == KErrInUse)) { if (iStartRetryTime != 0) { diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmscsuplink.cpp --- a/mmserv/tms/tmscallserver/src/tmscsuplink.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmscsuplink.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -145,7 +145,8 @@ TRACE_PRN_N1(_L("TMSCSUplink::RecordError[%d]"), aError); // We dont react to devsound messages unless we are activating. - if (iActivationOngoing && aError == KErrAccessDenied) + if (iActivationOngoing && (aError == KErrAccessDenied || + aError == KErrInUse)) { if (iStartRetryTime != 0) { diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmsdtmfnotifier.cpp --- a/mmserv/tms/tmscallserver/src/tmsdtmfnotifier.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -// INCLUDE FILES -#include "tmsdtmfnotifier.h" -#include "tmsclientserver.h" -#include "tmsutility.h" - -using namespace TMS; - -// CONSTANTS -_LIT_SECURITY_POLICY_PASS(KTMSServerReadPolicy); -_LIT_SECURITY_POLICY_C1(KTMSServerWritePolicy, ECapabilityWriteUserData); - -// ----------------------------------------------------------------------------- -// TMSDtmfNotifier::TMSDtmfNotifier -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -TMSDtmfNotifier::TMSDtmfNotifier() - { - } - -// ----------------------------------------------------------------------------- -// TMSDtmfNotifier::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void TMSDtmfNotifier::ConstructL() - { - TRACE_PRN_FN_ENT; - gint err = RProperty::Define(EDtmfPs, RProperty::EByteArray, - KTMSServerReadPolicy, KTMSServerWritePolicy); - TRACE_PRN_N1(_L("DtmfSetting::ConstructL err:%d"), err); - - if (err != KErrAlreadyExists) - { - User::LeaveIfError(err); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSDtmfNotifier::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -TMSDtmfNotifier* TMSDtmfNotifier::NewL() - { - TMSDtmfNotifier* self = new (ELeave) TMSDtmfNotifier(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -// Destructor -TMSDtmfNotifier::~TMSDtmfNotifier() - { - TRACE_PRN_FN_ENT; - gint err = RProperty::Delete(KTMSPropertyCategory, EDtmfPs); - TRACE_PRN_N1(_L("DtmfSetting::~TMSDtmfNotifier err:%d"), err); - TRACE_PRN_FN_ENT; - } - -// ----------------------------------------------------------------------------- -// TMSDtmfNotifier::SetDtmf -// ----------------------------------------------------------------------------- -// -void TMSDtmfNotifier::SetDtmf(TmsMsgBufPckg dtmfpckg, gboolean publish) - { - TRACE_PRN_FN_ENT; - if (publish) - { - gint err = RProperty::Set(KTMSPropertyCategory, EDtmfPs, dtmfpckg); - TRACE_PRN_N1(_L("DtmfSetting::SetDtmf err:%d"), err); - } - TRACE_PRN_FN_EXT; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmsdtmfprovider.cpp --- a/mmserv/tms/tmscallserver/src/tmsdtmfprovider.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,305 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#include -#include -#include "tmsdtmfprovider.h" -#include "tmsdtmfobserver.h" -#include "tmsutility.h" -#include "tmseteldtmfmonitor.h" -#include "tmseteldtmfstopmonitor.h" - -using namespace TMS; - -TMSDTMFProvider* TMSDTMFProvider::NewL() - { - TRACE_PRN_FN_ENT; - TMSDTMFProvider* self = new (ELeave) TMSDTMFProvider(); - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - TRACE_PRN_FN_EXT; - return self; - } - -// ----------------------------------------------------------------------------- -// Destructor of the object. -// ----------------------------------------------------------------------------- -// -TMSDTMFProvider::~TMSDTMFProvider() - { - TRACE_PRN_FN_ENT; - Cancel(); - iObservers.Close(); - delete iMonitor; - delete iStopMonitor; - - iMmCustom.Close(); - iPhone.Close(); - iServer.UnloadPhoneModule(iTsyname); - iServer.Close(); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Constructs the requester. -// ----------------------------------------------------------------------------- -// -TMSDTMFProvider::TMSDTMFProvider() : - CActive(EPriorityStandard) - { - TRACE_PRN_FN_ENT; - CActiveScheduler::Add(this); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Constructs the requester in the second phase. -// ----------------------------------------------------------------------------- -// -void TMSDTMFProvider::ConstructL() - { - TRACE_PRN_FN_ENT; - - CleanupClosePushL(iServer); - User::LeaveIfError(iServer.Connect()); - - TRACE_PRN_N(_L("**TMS ETel iServer.Connect")); - - iServer.GetTsyName(0, iTsyname); - - //Load in the phone device driver - User::LeaveIfError(iServer.LoadPhoneModule(iTsyname)); - - TRACE_PRN_N(_L("**TMS ETel iServer.LoadPhoneModule")); - - //Find the number of phones available from the tel server - gint numberPhones; - User::LeaveIfError(iServer.EnumeratePhones(numberPhones)); - - TRACE_PRN_N(_L("**TMS ETel iServer.EnumeratePhones")); - - //Check there are available phones - if (numberPhones < 1) - { - User::Leave(KErrNotFound); - } - - //Get info about the first available phone - RTelServer::TPhoneInfo info; - User::LeaveIfError(iServer.GetPhoneInfo(0, info)); - - TRACE_PRN_N(_L("**TMS ETel iServer.GetPhoneInfo")); - - CleanupClosePushL(iPhone); - User::LeaveIfError(iPhone.Open(iServer, info.iName)); - - TRACE_PRN_N(_L("**TMS ETel iPhone.Open")); - - RMobilePhone::TLineInfo lineInfo; - User::LeaveIfError(iPhone.GetLineInfo(0, lineInfo)); - - TRACE_PRN_N(_L("**TMS ETel iPhone.GetLineInfo")); - - gint errorCode = iMmCustom.Open(iPhone); - - if (!iPhone.SubSessionHandle() || !iMmCustom.SubSessionHandle()) - { - User::Leave(KErrArgument); - } - iMonitor = TMSEtelDtmfMonitor::NewL(*this, iMmCustom); - iMonitor->StartMonitoring(); - iStopMonitor = TMSEtelDtmfStopMonitor::NewL(*this, iPhone); - // iStopMonitor->StartMonitoring(); - - CleanupStack::Pop(2);//telserver,phone - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Notifies observers about a DTMF event -// ----------------------------------------------------------------------------- -// -void TMSDTMFProvider::NotifyDTMFEvent( - const TMSDTMFObserver::TCCPDtmfEvent aEvent, const gint aError, - const TChar aTone) - { - TRACE_PRN_FN_ENT; - for (gint i = 0; i < iObservers.Count(); i++) - { - TMSDTMFObserver* obs = iObservers[i]; - if (obs) - { - iObservers[i]->HandleDTMFEvent(aEvent, aError, aTone); - } - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Cancel DTMF string sending -// ----------------------------------------------------------------------------- -// -gint TMSDTMFProvider::CancelDtmfStringSending() - { - TRACE_PRN_FN_ENT; - gint ret(KErrAlreadyExists); - if (IsActive()) - { - Cancel(); - ret = KErrNone; - } - TRACE_PRN_FN_EXT; - return ret; - } - -// ----------------------------------------------------------------------------- -// Starts DTMF string sending -// ----------------------------------------------------------------------------- -// -gint TMSDTMFProvider::StartDtmfTone(const TChar aTone) - { - TRACE_PRN_FN_ENT; - gint ret(KErrAlreadyExists); - if (!IsActive()) - { - ret = iPhone.StartDTMFTone(aTone); - } - TRACE_PRN_FN_EXT; - return ret; - } - -// ----------------------------------------------------------------------------- -// Stop DTMF tone -// ----------------------------------------------------------------------------- -// -gint TMSDTMFProvider::StopDtmfTone() - { - TRACE_PRN_FN_ENT; - gint ret(KErrAlreadyExists); - if (!IsActive()) - { - ret = iPhone.StopDTMFTone(); - } - TRACE_PRN_FN_EXT; - return ret; - } - -// ----------------------------------------------------------------------------- -// Send DTMF string -// ----------------------------------------------------------------------------- -// -gint TMSDTMFProvider::SendDtmfToneString(const TDesC& aString) - { - TRACE_PRN_FN_ENT; - gint ret = KErrInUse; - if (!IsActive()) - { - iStatus = KRequestPending; - iPhone.SendDTMFTones(iStatus, aString); - SetActive(); - ret = KErrNone; - } - TRACE_PRN_FN_EXT; - return ret; - } - -// ----------------------------------------------------------------------------- -// Continue DTMF string sending -// ----------------------------------------------------------------------------- -// -gint TMSDTMFProvider::ContinueDtmfStringSending(const gboolean aContinue) - { - TRACE_PRN_FN_ENT; - gint status = iPhone.ContinueDTMFStringSending(aContinue); - TRACE_PRN_FN_EXT; - return status; - } - -// ----------------------------------------------------------------------------- -// Adds observer. -// ----------------------------------------------------------------------------- -// -void TMSDTMFProvider::AddObserver(const TMSDTMFObserver& aObserver) - { - TRACE_PRN_FN_ENT; - if (iObservers.Find(&aObserver) == KErrNotFound) - { - iObservers.Append(&aObserver); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Removes given observer. -// ----------------------------------------------------------------------------- -// -gint TMSDTMFProvider::RemoveObserver(const TMSDTMFObserver& aObserver) - { - TRACE_PRN_FN_ENT; - gint ret = KErrNotFound; - gint found = iObservers.Find(&aObserver); - if (found != KErrNotFound) - { - iObservers.Remove(found); - ret = KErrNone; - } - TRACE_PRN_FN_EXT; - return ret; - } - -// ----------------------------------------------------------------------------- -// From CActive. -// Handles request completion. -// ----------------------------------------------------------------------------- -// -void TMSDTMFProvider::RunL() - { - TRACE_PRN_FN_ENT; - if (iStatus == KErrNone) - { - TMSDTMFObserver::TCCPDtmfEvent event = - TMSDTMFObserver::ECCPDtmfStringSendingCompleted; - NotifyDTMFEvent(event, KErrNone, NULL); - } - else - { - gint error = iStatus.Int(); - if (error != KErrCancel) - { - TMSDTMFObserver::TCCPDtmfEvent event = - TMSDTMFObserver::ECCPDtmfStringSendingCompleted; - NotifyDTMFEvent(event, error, NULL); - } - // Cancel is not notified - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// From CActive -// Canceling functionality. -// ----------------------------------------------------------------------------- -// -void TMSDTMFProvider::DoCancel() - { - TRACE_PRN_FN_ENT; - iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones); - TRACE_PRN_FN_EXT; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmsdtmftoneplayer.cpp --- a/mmserv/tms/tmscallserver/src/tmsdtmftoneplayer.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -// INCLUDE FILES -#include "tmsutility.h" -#include "tmsdtmftoneplayer.h" - -// CONSTANTS -const gint KBufSize = 10; -const gint KMaxVolumeLevel = 10; - -_LIT(KPhoneTone_Asterisk, "*+w"); - -//from voip -const guint KDTMFToneLengthOn = 250000; -const guint KDTMFToneLengthOff = 50000; -const guint KDTMFToneLengthPause = 2500000; - -using namespace TMS; - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::NewL -// Two-phased constructor. -// ----------------------------------------------------------------------------- -// -TMSAudioDtmfTonePlayer* TMSAudioDtmfTonePlayer::NewL( - TMSDTMFTonePlayerObserver& obsrvr, guint audioPreference, - guint audioPriority) - { - TMSAudioDtmfTonePlayer* self = new (ELeave) TMSAudioDtmfTonePlayer(obsrvr, - audioPreference, audioPriority); - - CleanupStack::PushL(self); - self->ConstructL(); - CleanupStack::Pop(self); - return self; - } - -//Destructor -TMSAudioDtmfTonePlayer::~TMSAudioDtmfTonePlayer() - { - TRACE_PRN_FN_ENT; - Cancel(); - delete iDTMFPlayer; - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::TMSAudioDtmfTonePlayer -// C++ default constructor can NOT contain any code, that -// might leave. -// ----------------------------------------------------------------------------- -// -TMSAudioDtmfTonePlayer::TMSAudioDtmfTonePlayer( - TMSDTMFTonePlayerObserver& obsrvr, guint audioPreference, - guint audioPriority) : - iObserver(obsrvr), - iPref(audioPreference), - iPrior(audioPriority) - { - TRACE_PRN_FN_ENT; - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::ConstructL -// Symbian 2nd phase constructor can leave. -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::ConstructL() - { - TRACE_PRN_FN_ENT; - - TMMFPrioritySettings dtmfClickPlayerPrioritySettings; - iDTMFPlayer = CMMFDevSound::NewL(); - iDTMFPlayer->InitializeL(*this, EMMFStateTonePlaying); - - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::SetVolume -// Sets the volume level that is used when the dtmf tone is played. -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::SetVolume(gint volume) - { - TRACE_PRN_FN_ENT; - gint vol = ConvertVolumeLevel(volume); - - if (vol != iVolume) - { - iVolume = vol; - iDTMFPlayer->SetVolume(iVolume); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::PlayDtmfTone -// Searches the given DTMF tone from iToneArray and calls PlayCurrentTone -// member function. -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::PlayDtmfTone(TDes& tone) - { - TRACE_PRN_FN_ENT; - Cancel(); - - // DTMF signaling. - if (iDTMFPlayer) - { - TBuf key; - key.Append(tone); - TRAP_IGNORE(iDTMFPlayer->PlayDTMFStringL(tone)); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::Cancel -// Cancels the currently playing tone. -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::Cancel() - { - TRACE_PRN_FN_ENT; - iDTMFPlayer->Stop(); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::Normalize -// Lowers case for chars and if its '*','+', or 'w' sets it to asterisk -// char ('*'). -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::Normalize(TChar& tone) - { - TRACE_PRN_FN_ENT; - tone.LowerCase(); - TPtrC ast(KPhoneTone_Asterisk); - - if (ast.Locate(tone) != KErrNotFound) - { - tone = ast[0]; - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::InitializeComplete -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::InitializeComplete(TInt aError) - { - TRACE_PRN_FN_ENT; - - if (aError == KErrNone) - { - TMMFPrioritySettings dtmfPlayerSettings; - dtmfPlayerSettings.iPref = iPref; - dtmfPlayerSettings.iPriority = iPrior; - dtmfPlayerSettings.iState = EMMFStateTonePlaying; - iDTMFPlayer->SetPrioritySettings(dtmfPlayerSettings); - - TTimeIntervalMicroSeconds32 length(KDTMFToneLengthOn); - TTimeIntervalMicroSeconds32 pause(KDTMFToneLengthOff); - TTimeIntervalMicroSeconds32 zero(KDTMFToneLengthPause); - iDTMFPlayer->SetDTMFLengths(length, pause, zero); - iDTMFPlayer->SetVolume(iDTMFPlayer->MaxVolume()); - } - - iObserver.DTMFInitCompleted(aError); - - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::ToneFinished -// ----------------------------------------------------------------------------- -// -void TMSAudioDtmfTonePlayer::ToneFinished(TInt aError) - { - TRACE_PRN_FN_ENT; - iObserver.DTMFToneFinished(aError); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// TMSAudioDtmfTonePlayer::ConvertVolumeLevel -// ----------------------------------------------------------------------------- -// -gint TMSAudioDtmfTonePlayer::ConvertVolumeLevel(gint volume) - { - TRACE_PRN_FN_ENT; - gint result = iDTMFPlayer->MaxVolume() * volume / KMaxVolumeLevel; - TRACE_PRN_FN_EXT; - return result; - } - -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmseteldtmfmonitor.cpp --- a/mmserv/tms/tmscallserver/src/tmseteldtmfmonitor.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#include -#include -#include "tmsdtmfprovider.h" -#include "tmsdtmfobserver.h" -#include "tmseteldtmfmonitor.h" -#include "tmsutility.h" - -using namespace TMS; - -// ----------------------------------------------------------------------------- -// TMSEtelDtmfMonitor::NewL. -// ----------------------------------------------------------------------------- -// -TMSEtelDtmfMonitor* TMSEtelDtmfMonitor::NewL(TMSDTMFProvider& aObserver, - RMmCustomAPI& aMmCustom) - { - TRACE_PRN_FN_ENT; - TMSEtelDtmfMonitor* self = new (ELeave) TMSEtelDtmfMonitor(aObserver, - aMmCustom); - TRACE_PRN_FN_EXT; - return self; - } - -// ----------------------------------------------------------------------------- -// Constructs the monitor. -// ----------------------------------------------------------------------------- -// -TMSEtelDtmfMonitor::TMSEtelDtmfMonitor(TMSDTMFProvider& aObserver, - RMmCustomAPI& aMmCustom) : - CActive(EPriorityStandard), - iObserver(aObserver), - iMmCustom(aMmCustom) - { - TRACE_PRN_FN_ENT; - CActiveScheduler::Add(this); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Destructs the object by canceling first ongoing monitoring. -// ----------------------------------------------------------------------------- -// -TMSEtelDtmfMonitor::~TMSEtelDtmfMonitor() - { - TRACE_PRN_FN_ENT; - Cancel(); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Starts the monitor. -// ----------------------------------------------------------------------------- -// -void TMSEtelDtmfMonitor::StartMonitoring() - { - TRACE_PRN_FN_ENT; - if (!IsActive()) - { - iStatus = KRequestPending; - iMmCustom.NotifyDtmfEvent(iStatus, iEventData); - SetActive(); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// From CActive. -// Handles line status change notifying. -// ----------------------------------------------------------------------------- -// -void TMSEtelDtmfMonitor::RunL() - { - TRACE_PRN_FN_ENT; - gint err = iStatus.Int(); - TRACE_PRN_N1(_L("**TMS TMSEtelDtmfMonitor::RunL: status:%d"), err); - - if (err == KErrNone) - { - TMSDTMFObserver::TCCPDtmfEvent event; - if (iEventData.iEvent == RMmCustomAPI::EDtmfStart - && iEventData.iType == RMmCustomAPI::EDtmfManual) - { - event = TMSDTMFObserver::ECCPDtmfManualStart; - } - else if (iEventData.iEvent == RMmCustomAPI::EDtmfStart - && iEventData.iType == RMmCustomAPI::EDtmfSequence) - { - event = TMSDTMFObserver::ECCPDtmfSequenceStart; - } - else if (iEventData.iEvent == RMmCustomAPI::EDtmfStop - && iEventData.iType == RMmCustomAPI::EDtmfManual) - { - event = TMSDTMFObserver::ECCPDtmfManualStop; - } - else if (iEventData.iEvent == RMmCustomAPI::EDtmfStop - && iEventData.iType == RMmCustomAPI::EDtmfSequence) - { - event = TMSDTMFObserver::ECCPDtmfSequenceStop; - } - else if (iEventData.iEvent == RMmCustomAPI::EDtmfAbort - && iEventData.iType == RMmCustomAPI::EDtmfManual) - { - event = TMSDTMFObserver::ECCPDtmfManualAbort; - } - else if (iEventData.iEvent == RMmCustomAPI::EDtmfAbort - && iEventData.iType == RMmCustomAPI::EDtmfSequence) - { - event = TMSDTMFObserver::ECCPDtmfSequenceAbort; - } - else - { - // Refresh and return (no observer notfiying). - TRACE_PRN_N2(_L("**TMS TMSEtelDtmfMonitor::RunL: Unknown event \ - = %d, type = %d"), iEventData.iEvent,iEventData.iType); - StartMonitoring(); - return; - } - - iObserver.NotifyDTMFEvent(event, err, iEventData.iTone); - } - else - { - TRACE_PRN_N1(_L("**TMS TMSEtelDtmfMonitor::RunL: Error \ - from DTMF: %d"),err); - } - - // Continue if not in offline mode - if (err != KErrGsmOfflineOpNotAllowed && err != KErrCancel - && err != KErrNotSupported) - { - StartMonitoring(); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// From CActive -// Canceling functionality. -// ----------------------------------------------------------------------------- -// -void TMSEtelDtmfMonitor::DoCancel() - { - TRACE_PRN_FN_ENT; - iMmCustom.CancelAsyncRequest(ECustomNotifyDtmfEventIPC); - TRACE_PRN_FN_EXT; - } - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmseteldtmfstopmonitor.cpp --- a/mmserv/tms/tmscallserver/src/tmseteldtmfstopmonitor.cpp Fri Jun 25 17:36:03 2010 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). - * All rights reserved. - * This component and the accompanying materials are made available - * under the terms of "Eclipse Public License v1.0" - * which accompanies this distribution, and is available - * at the URL "http://www.eclipse.org/legal/epl-v10.html". - * - * Initial Contributors: - * Nokia Corporation - initial contribution. - * - * Contributors: - * - * Description: Telephony Multimedia Service - * - */ - -#include -#include "tmsutility.h" -#include "tmsdtmfobserver.h" -#include "tmsdtmfprovider.h" -#include "tmseteldtmfstopmonitor.h" - -using namespace TMS; - -// ----------------------------------------------------------------------------- -// TMSEtelDtmfStopMonitor::NewL. -// ----------------------------------------------------------------------------- -// -TMSEtelDtmfStopMonitor* TMSEtelDtmfStopMonitor::NewL(TMSDTMFProvider& aObserver, - RMobilePhone& aPhone) - { - TRACE_PRN_FN_EXT; - TMSEtelDtmfStopMonitor* self = new (ELeave) TMSEtelDtmfStopMonitor( - aObserver, aPhone); - TRACE_PRN_FN_EXT; - return self; - } - -// ----------------------------------------------------------------------------- -// Constructs the monitor. -// ----------------------------------------------------------------------------- -// -TMSEtelDtmfStopMonitor::TMSEtelDtmfStopMonitor(TMSDTMFProvider& aObserver, - RMobilePhone& aPhone) : - CActive(EPriorityStandard), - iObserver(aObserver), - iPhone(aPhone) - { - TRACE_PRN_FN_ENT; - CActiveScheduler::Add(this); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Destructs the object by canceling first ongoing monitoring. -// ----------------------------------------------------------------------------- -// -TMSEtelDtmfStopMonitor::~TMSEtelDtmfStopMonitor() - { - TRACE_PRN_FN_ENT; - Cancel(); - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// Starts the monitor. -// ----------------------------------------------------------------------------- -// -void TMSEtelDtmfStopMonitor::StartMonitoring() - { - TRACE_PRN_FN_ENT; - if (!IsActive()) - { - iStatus = KRequestPending; - iPhone.NotifyStopInDTMFString(iStatus); - SetActive(); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// From CActive. -// Handles line status change notifying. -// ----------------------------------------------------------------------------- -// -void TMSEtelDtmfStopMonitor::RunL() - { - TRACE_PRN_FN_ENT; - gint err = iStatus.Int(); - TRACE_PRN_N1(_L("**TMS TMSEtelDtmfStopMonitor::RunL: status: %d"), err); - - if (err != KErrCancel && err != KErrServerTerminated) - { - TChar tone = NULL; - TMSDTMFObserver::TCCPDtmfEvent event = - TMSDTMFObserver::ECCPDtmfStopInDtmfString; - iObserver.NotifyDTMFEvent(event, err, tone); - } - else - { - TRACE_PRN_N1(_L("**TMS TMSEtelDtmfStopMonitor::RunL: Error \ - from RMobilePhone: %d"),iStatus.Int()); - } - - // Continue if not in offline mode - if (err != KErrGsmOfflineOpNotAllowed && err != KErrCancel - && err != KErrNotSupported) - { - StartMonitoring(); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- -// From CActive -// Canceling functionality. -// ----------------------------------------------------------------------------- -// -void TMSEtelDtmfStopMonitor::DoCancel() - { - TRACE_PRN_FN_ENT; - iPhone.CancelAsyncRequest(EMobilePhoneNotifyStopInDTMFString); - TRACE_PRN_FN_EXT; - } - -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmsipcalldownlinkds.cpp --- a/mmserv/tms/tmscallserver/src/tmsipcalldownlinkds.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmsipcalldownlinkds.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -112,11 +112,7 @@ { TRAP(err, iDevSound->PlayInitL()); TRACE_PRN_IF_ERR(err); - if (err != TMS_RESULT_SUCCESS) - { - iStatus = EReady; - iObserver.DownlinkStarted(err); - } + iObserver.DownlinkStarted(err); } TRACE_PRN_FN_EXT; } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp --- a/mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmscallserver/src/tmsipcalluplinkds.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -112,12 +112,7 @@ { TRAP(err, iDevSound->RecordInitL()); TRACE_PRN_IF_ERR(err); - - if (err != TMS_RESULT_SUCCESS) - { - iStatus = EReady; - iObserver.UplinkStarted(err); - } + iObserver.UplinkStarted(err); } TRACE_PRN_FN_EXT; } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp --- a/mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsfactory/src/tmsfactoryimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -25,7 +25,6 @@ #include "tmsringtoneimpl.h" #include "tmsdtmfimpl.h" #include "tmsinbandtoneimpl.h" - #include "tmsutility.h" #include "tmsproxy.h" #include "tmsfactoryimpl.h" diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/bwins/tmsimpl.def --- a/mmserv/tms/tmsimpl/bwins/tmsimpl.def Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/bwins/tmsimpl.def Fri Jul 09 16:43:35 2010 -0500 @@ -1,23 +1,23 @@ EXPORTS ?Create@TMSEffectImpl@TMS@@SAHHAAPAVTMSEffect@2@@Z @ 1 NONAME ; int TMS::TMSEffectImpl::Create(int, class TMS::TMSEffect * &) - ?Create@TMSDTMFImpl@TMS@@SAHHAAPAVTMSDTMF@2@@Z @ 2 NONAME ; int TMS::TMSDTMFImpl::Create(int, class TMS::TMSDTMF * &) - ?Delete@TMSDTMFImpl@TMS@@SAHAAPAVTMSDTMF@2@@Z @ 3 NONAME ; int TMS::TMSDTMFImpl::Delete(class TMS::TMSDTMF * &) - ?Create@TMSSourceImpl@TMS@@SAHHAAPAVTMSSource@2@@Z @ 4 NONAME ; int TMS::TMSSourceImpl::Create(int, class TMS::TMSSource * &) - ?Delete@TMSRingToneImpl@TMS@@SAHAAPAVTMSRingTone@2@@Z @ 5 NONAME ; int TMS::TMSRingToneImpl::Delete(class TMS::TMSRingTone * &) - ?Create@TMSRingToneImpl@TMS@@SAHAAPAVTMSRingTone@2@@Z @ 6 NONAME ; int TMS::TMSRingToneImpl::Create(class TMS::TMSRingTone * &) - ?Delete@TMSFormatImpl@TMS@@SAHAAPAVTMSFormat@2@@Z @ 7 NONAME ; int TMS::TMSFormatImpl::Delete(class TMS::TMSFormat * &) - ?Delete@TMSCallImpl@TMS@@SAHAAPAVTMSCall@2@@Z @ 8 NONAME ; int TMS::TMSCallImpl::Delete(class TMS::TMSCall * &) - ?Delete@TMSSinkImpl@TMS@@SAHAAPAVTMSSink@2@@Z @ 9 NONAME ; int TMS::TMSSinkImpl::Delete(class TMS::TMSSink * &) - ?Delete@TMSBufferImpl@TMS@@SAHAAPAVTMSBuffer@2@@Z @ 10 NONAME ; int TMS::TMSBufferImpl::Delete(class TMS::TMSBuffer * &) - ?Delete@TMSSourceImpl@TMS@@SAHAAPAVTMSSource@2@@Z @ 11 NONAME ; int TMS::TMSSourceImpl::Delete(class TMS::TMSSource * &) - ?Delete@TMSEffectImpl@TMS@@SAHAAPAVTMSEffect@2@@Z @ 12 NONAME ; int TMS::TMSEffectImpl::Delete(class TMS::TMSEffect * &) - ?Create@TMSBufferImpl@TMS@@SAHHIAAPAVTMSBuffer@2@@Z @ 13 NONAME ; int TMS::TMSBufferImpl::Create(int, unsigned int, class TMS::TMSBuffer * &) - ?Create@TMSCallImpl@TMS@@SAHHAAPAVTMSCall@2@I@Z @ 14 NONAME ; int TMS::TMSCallImpl::Create(int, class TMS::TMSCall * &, unsigned int) - ?Delete@TMSGlobalRoutingImpl@TMS@@SAHAAPAVTMSGlobalRouting@2@@Z @ 15 NONAME ; int TMS::TMSGlobalRoutingImpl::Delete(class TMS::TMSGlobalRouting * &) - ?Create@TMSRingToneImpl@TMS@@SAHAAPAVTMSRingTone@2@AAVRWindow@@H@Z @ 16 NONAME ; int TMS::TMSRingToneImpl::Create(class TMS::TMSRingTone * &, class RWindow &, int) - ?Delete@TMSInbandToneImpl@TMS@@SAHAAPAVTMSInbandTone@2@@Z @ 17 NONAME ; int TMS::TMSInbandToneImpl::Delete(class TMS::TMSInbandTone * &) - ?Create@TMSSinkImpl@TMS@@SAHHAAPAVTMSSink@2@@Z @ 18 NONAME ; int TMS::TMSSinkImpl::Create(int, class TMS::TMSSink * &) - ?Create@TMSInbandToneImpl@TMS@@SAHAAPAVTMSInbandTone@2@@Z @ 19 NONAME ; int TMS::TMSInbandToneImpl::Create(class TMS::TMSInbandTone * &) - ?Create@TMSFormatImpl@TMS@@SAHHAAPAVTMSFormat@2@@Z @ 20 NONAME ; int TMS::TMSFormatImpl::Create(int, class TMS::TMSFormat * &) - ?Create@TMSGlobalRoutingImpl@TMS@@SAHAAPAVTMSGlobalRouting@2@@Z @ 21 NONAME ; int TMS::TMSGlobalRoutingImpl::Create(class TMS::TMSGlobalRouting * &) + ?Create@TMSSourceImpl@TMS@@SAHHAAPAVTMSSource@2@@Z @ 2 NONAME ; int TMS::TMSSourceImpl::Create(int, class TMS::TMSSource * &) + ?Delete@TMSRingToneImpl@TMS@@SAHAAPAVTMSRingTone@2@@Z @ 3 NONAME ; int TMS::TMSRingToneImpl::Delete(class TMS::TMSRingTone * &) + ?Create@TMSRingToneImpl@TMS@@SAHAAPAVTMSRingTone@2@@Z @ 4 NONAME ; int TMS::TMSRingToneImpl::Create(class TMS::TMSRingTone * &) + ?Delete@TMSFormatImpl@TMS@@SAHAAPAVTMSFormat@2@@Z @ 5 NONAME ; int TMS::TMSFormatImpl::Delete(class TMS::TMSFormat * &) + ?Delete@TMSCallImpl@TMS@@SAHAAPAVTMSCall@2@@Z @ 6 NONAME ; int TMS::TMSCallImpl::Delete(class TMS::TMSCall * &) + ?Delete@TMSSinkImpl@TMS@@SAHAAPAVTMSSink@2@@Z @ 7 NONAME ; int TMS::TMSSinkImpl::Delete(class TMS::TMSSink * &) + ?Delete@TMSBufferImpl@TMS@@SAHAAPAVTMSBuffer@2@@Z @ 8 NONAME ; int TMS::TMSBufferImpl::Delete(class TMS::TMSBuffer * &) + ?Delete@TMSSourceImpl@TMS@@SAHAAPAVTMSSource@2@@Z @ 9 NONAME ; int TMS::TMSSourceImpl::Delete(class TMS::TMSSource * &) + ?Delete@TMSEffectImpl@TMS@@SAHAAPAVTMSEffect@2@@Z @ 10 NONAME ; int TMS::TMSEffectImpl::Delete(class TMS::TMSEffect * &) + ?Create@TMSBufferImpl@TMS@@SAHHIAAPAVTMSBuffer@2@@Z @ 11 NONAME ; int TMS::TMSBufferImpl::Create(int, unsigned int, class TMS::TMSBuffer * &) + ?Create@TMSCallImpl@TMS@@SAHHAAPAVTMSCall@2@I@Z @ 12 NONAME ; int TMS::TMSCallImpl::Create(int, class TMS::TMSCall * &, unsigned int) + ?Delete@TMSGlobalRoutingImpl@TMS@@SAHAAPAVTMSGlobalRouting@2@@Z @ 13 NONAME ; int TMS::TMSGlobalRoutingImpl::Delete(class TMS::TMSGlobalRouting * &) + ?Create@TMSRingToneImpl@TMS@@SAHAAPAVTMSRingTone@2@AAVRWindow@@H@Z @ 14 NONAME ; int TMS::TMSRingToneImpl::Create(class TMS::TMSRingTone * &, class RWindow &, int) + ?Delete@TMSInbandToneImpl@TMS@@SAHAAPAVTMSInbandTone@2@@Z @ 15 NONAME ; int TMS::TMSInbandToneImpl::Delete(class TMS::TMSInbandTone * &) + ?Create@TMSSinkImpl@TMS@@SAHHAAPAVTMSSink@2@@Z @ 16 NONAME ; int TMS::TMSSinkImpl::Create(int, class TMS::TMSSink * &) + ?Create@TMSInbandToneImpl@TMS@@SAHAAPAVTMSInbandTone@2@@Z @ 17 NONAME ; int TMS::TMSInbandToneImpl::Create(class TMS::TMSInbandTone * &) + ?Create@TMSFormatImpl@TMS@@SAHHAAPAVTMSFormat@2@@Z @ 18 NONAME ; int TMS::TMSFormatImpl::Create(int, class TMS::TMSFormat * &) + ?Create@TMSGlobalRoutingImpl@TMS@@SAHAAPAVTMSGlobalRouting@2@@Z @ 19 NONAME ; int TMS::TMSGlobalRoutingImpl::Create(class TMS::TMSGlobalRouting * &) + ?Create@TMSDTMFImpl@TMS@@SAHHAAPAVTMSDTMF@2@@Z @ 20 NONAME ; int TMS::TMSDTMFImpl::Create(int, class TMS::TMSDTMF * &) + ?Delete@TMSDTMFImpl@TMS@@SAHAAPAVTMSDTMF@2@@Z @ 21 NONAME ; int TMS::TMSDTMFImpl::Delete(class TMS::TMSDTMF * &) diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/inc/tmsdtmfbodyimpl.h --- a/mmserv/tms/tmsimpl/inc/tmsdtmfbodyimpl.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/inc/tmsdtmfbodyimpl.h Fri Jul 09 16:43:35 2010 -0500 @@ -33,10 +33,11 @@ class TMSDTMFBodyImpl : public TMSDTMFBody { public: - static gint Create(TMSStreamType streamtype, TMSDTMFBody*& bodyimpl); + static gint Create(TMSStreamType streamtype, TMSDTMF& parent, + TMSDTMFBody*& bodyimpl); virtual ~TMSDTMFBodyImpl(); - // From TMSDTMFBody begins + // From TMSDTMFBody virtual gint AddObserver(TMSDTMFObserver& obsrvr, gpointer user_data); virtual gint RemoveObserver(TMSDTMFObserver& obsrvr); virtual gint Start(); @@ -44,11 +45,9 @@ virtual gint SetTone(GString* string); virtual gint ContinueDTMFStringSending(gboolean sending); - void SetParent(TMSDTMF*& parent); - private: TMSDTMFBodyImpl(); - gint PostConstruct(); + gint PostConstruct(TMSStreamType stype, TMSDTMF& parent); private: TMSDTMFObserver* iObserver; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/inc/tmsstreambodyimpl.h --- a/mmserv/tms/tmsimpl/inc/tmsstreambodyimpl.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/inc/tmsstreambodyimpl.h Fri Jul 09 16:43:35 2010 -0500 @@ -118,4 +118,3 @@ #endif // TMS_STREAM_BODY_IMPL_H -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmscallimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmscallimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmscallimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -36,11 +36,10 @@ gint TMSCallImpl::PostConstruct(TMSCallType ctype, guint /*ctxid*/) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); TMSCallBody* tmscallimplbody(NULL); - TRACE_PRN_FN_ENT; - switch (ctype) { case TMS_CALL_IP: @@ -65,10 +64,10 @@ EXPORT_C gint TMSCallImpl::Create(TMSCallType ctype, TMSCall*& tmscall, guint ctxid) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); TMSCallImpl *self = new TMSCallImpl(); - TRACE_PRN_FN_ENT; if (self) { ret = self->PostConstruct(ctype, ctxid); diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmscscallbodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmscscallbodyimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmscscallbodyimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -66,7 +66,6 @@ { gint ret(TMS_RESULT_SUCCESS); TRACE_PRN_FN_ENT; - iSession = new TMSCallProxy(); TRACE_PRN_FN_ENT; @@ -106,9 +105,7 @@ gint TMSCSCallBodyImpl::GetCallContextId(guint& ctxid) { gint ret(TMS_RESULT_FEATURE_NOT_SUPPORTED); - TRACE_PRN_FN_ENT; ctxid = 0; - TRACE_PRN_FN_EXT; return ret; } @@ -138,14 +135,18 @@ } else { - //TODO: delete call only if no active sessions left if (iSession) { + //TODO: delete call only if no active sessions left iSession->DeleteCall(); iSession->Close(); delete iSession; iSession = NULL; } + else + { + ret = TMS_RESULT_UNINITIALIZED_OBJECT; + } } break; default: diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsdtmfbodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsdtmfbodyimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsdtmfbodyimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -52,31 +52,30 @@ TRACE_PRN_FN_EXT; } -gint TMSDTMFBodyImpl::Create(TMSStreamType streamtype, TMSDTMFBody*& bodyimpl) +gint TMSDTMFBodyImpl::Create(TMSStreamType streamtype, TMSDTMF& parent, + TMSDTMFBody*& bodyimpl) { gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); TMSDTMFBodyImpl* self = new TMSDTMFBodyImpl(); if (self) { - ret = self->PostConstruct(); + ret = self->PostConstruct(streamtype, parent); if (ret != TMS_RESULT_SUCCESS) { delete self; self = NULL; } - else - { - self->iStreamType = streamtype; - } } bodyimpl = self; return ret; } -gint TMSDTMFBodyImpl::PostConstruct() +gint TMSDTMFBodyImpl::PostConstruct(TMSStreamType streamtype, TMSDTMF& parent) { gint ret(TMS_RESULT_SUCCESS); iClientId = 1; + iParent = &parent; + iStreamType = streamtype; iProxy = new TMSProxy(); if (!iProxy) { @@ -109,6 +108,7 @@ if (ret == TMS_RESULT_SUCCESS) { ret = iProxy->StartDTMFNotifier(); + ret |= iProxy->InitDTMFPlayer(iStreamType); } } else @@ -179,7 +179,6 @@ __ASSERT_ALWAYS(string, PANIC(TMS_RESULT_NULL_ARGUMENT)); gint ret(TMS_RESULT_SUCCESS); - if (iString) { if (iString->len) @@ -206,8 +205,3 @@ return ret; } -void TMSDTMFBodyImpl::SetParent(TMSDTMF*& parent) - { - iParent = parent; - } - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsdtmfimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsdtmfimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsdtmfimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -21,10 +21,9 @@ using namespace TMS; -TMSDTMFImpl::TMSDTMFImpl(TMSStreamType streamtype) +TMSDTMFImpl::TMSDTMFImpl() { TRACE_PRN_FN_ENT; - iStreamType = streamtype; TRACE_PRN_FN_EXT; } @@ -34,12 +33,12 @@ TRACE_PRN_FN_EXT; } -gint TMSDTMFImpl::PostConstruct() +gint TMSDTMFImpl::PostConstruct(TMSStreamType streamtype) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); TMSDTMFBody* bodyimpl(NULL); - TRACE_PRN_FN_ENT; - ret = TMSDTMFBodyImpl::Create(iStreamType, bodyimpl); + ret = TMSDTMFBodyImpl::Create(streamtype, *this, bodyimpl); if (ret == TMS_RESULT_SUCCESS) { @@ -51,49 +50,32 @@ EXPORT_C gint TMSDTMFImpl::Create(TMSStreamType streamtype, TMSDTMF*& dtmf) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); - TMSDTMFImpl *self = new TMSDTMFImpl(streamtype); + TMSDTMFImpl *self = new TMSDTMFImpl(); - TRACE_PRN_FN_ENT; if (self) { - ret = self->PostConstruct(); + ret = self->PostConstruct(streamtype); if (ret != TMS_RESULT_SUCCESS) { delete self; self = NULL; } } - if (self && ret == TMS_RESULT_SUCCESS) - { - dtmf = self; - ret = self->SetParent(dtmf); - } + + dtmf = self; TRACE_PRN_FN_EXT; return ret; } EXPORT_C gint TMSDTMFImpl::Delete(TMSDTMF*& dtmf) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_SUCCESS); - TRACE_PRN_FN_ENT; - delete (static_cast(dtmf)); + delete (static_cast (dtmf)); dtmf = NULL; TRACE_PRN_FN_EXT; return ret; } -gint TMSDTMFImpl::SetParent(TMSDTMF*& parent) - { - gint ret(TMS_RESULT_SUCCESS); - if (this->iBody) - { - static_cast(this->iBody)->SetParent(parent); - } - else - { - ret = TMS_RESULT_UNINITIALIZED_OBJECT; - } - return ret; - } - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmseffectimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmseffectimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmseffectimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -61,19 +61,19 @@ switch (effecttype) { case TMS_EFFECT_VOLUME: - delete (static_cast(tmseffect)); + delete (static_cast (tmseffect)); tmseffect = NULL; break; case TMS_EFFECT_GAIN: - delete (static_cast(tmseffect)); + delete (static_cast (tmseffect)); tmseffect = NULL; break; case TMS_EFFECT_GLOBAL_VOL: - delete (static_cast(tmseffect)); + delete (static_cast (tmseffect)); tmseffect = NULL; break; case TMS_EFFECT_GLOBAL_GAIN: - delete (static_cast(tmseffect)); + delete (static_cast (tmseffect)); tmseffect = NULL; break; default: diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsg711impl.cpp --- a/mmserv/tms/tmsimpl/src/tmsg711impl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsg711impl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -43,7 +43,7 @@ if (ret == TMS_RESULT_SUCCESS) { this->iBody = bodyimpl; - this->iFormatBody = static_cast(bodyimpl); + this->iFormatBody = static_cast (bodyimpl); } TRACE_PRN_FN_EXT; return ret; @@ -52,7 +52,7 @@ gint TMSG711FormatImpl::Create(TMSFormat*& tmsformat) { gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); - TMSG711FormatImpl *self = new TMSG711FormatImpl(); + TMSG711FormatImpl* self = new TMSG711FormatImpl(); TRACE_PRN_FN_ENT; if (self) @@ -75,7 +75,7 @@ gint ret(TMS_RESULT_SUCCESS); if (this->iBody) { - static_cast(this->iBody)->SetProxy(context, + static_cast (this->iBody)->SetProxy(context, queuehandler); } else @@ -85,4 +85,3 @@ return ret; } -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsipcallbodyimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -68,37 +68,38 @@ TRACE_PRN_FN_ENT; iSession = new TMSCallProxy(); - if (iSession) + TRACE_PRN_FN_ENT; + if (!iSession) + { + ret = TMS_RESULT_INSUFFICIENT_MEMORY; + } + RET_REASON_IF_ERR(ret); + + if (iSession->Connect() != TMS_RESULT_SUCCESS) { - if (iSession->Connect() != TMS_RESULT_SUCCESS) + delete iSession; + iSession = NULL; + ret = TMS_RESULT_FATAL_ERROR; + } + else + { + ret = iSession->CreateCall(TMS_CALL_IP); + if (ret != TMS_RESULT_SUCCESS && ret != TMS_RESULT_ALREADY_EXIST) { + iSession->Close(); delete iSession; iSession = NULL; ret = TMS_RESULT_FATAL_ERROR; } - else - { - ret = iSession->CreateCall(TMS_CALL_IP); - if (ret != TMS_RESULT_SUCCESS && ret != TMS_RESULT_ALREADY_EXIST) - { - iSession->Close(); - delete iSession; - ret = TMS_RESULT_FATAL_ERROR; - } - } } - else - { - ret = TMS_RESULT_INSUFFICIENT_MEMORY; - } + RET_REASON_IF_ERR(ret); TRACE_PRN_FN_EXT; return ret; } TMSCallType TMSIPCallBodyImpl::GetCallType() { - TMSCallType ctype(TMS_CALL_IP); - return ctype; + return TMS_CALL_IP; } gint TMSIPCallBodyImpl::GetCallContextId(guint& ctxid) @@ -127,7 +128,7 @@ ret = AddStreamToList(strm); } //TODO:Need longer term fix to not destory everything - //if more the one stream is trying to be created. + //if more than one stream is trying to be created. else if (ret == TMS_RESULT_ALREADY_EXIST) { break; @@ -193,9 +194,10 @@ if (itStrm) { + // Remove stream object from the vector. After removing, the iterator + // will point to the next item (if available); so, do NOT attempt + // deleting itStrm here! (Will result in KERN-EXEC) iStreamsVector.erase(itStrm); // Remove from array - // Don't delete itStrm as the iterator advanced to the next - // item on the list ret = TMSStreamImpl::Delete(strm); } TRACE_PRN_FN_EXT; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsringtonebodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsringtonebodyimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsringtonebodyimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -81,18 +81,18 @@ gint ret(TMS_RESULT_SUCCESS); iClientId = 1; iProxy = new TMSProxy(); - if (!iProxy) { ret = TMS_RESULT_INSUFFICIENT_MEMORY; } - RET_REASON_IF_ERR(ret); - - if (iProxy->Connect() != TMS_RESULT_SUCCESS) + else { - delete iProxy; - iProxy = NULL; - ret = TMS_RESULT_FATAL_ERROR; + if (iProxy->Connect() != TMS_RESULT_SUCCESS) + { + delete iProxy; + iProxy = NULL; + ret = TMS_RESULT_FATAL_ERROR; + } } RET_REASON_IF_ERR(ret); return ret; @@ -223,7 +223,6 @@ return ret; } - void TMSRingToneBodyImpl::SetParent(TMSRingTone*& parent) { iParent = parent; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsstreambodyimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -49,11 +49,13 @@ iFormat(NULL), iStreamState(TMS_STREAM_UNINITIALIZED) { - //TMSStream::Construct(this); + TRACE_PRN_FN_ENT; + TRACE_PRN_FN_EXT; } TMSStreamBodyImpl::~TMSStreamBodyImpl() { + TRACE_PRN_FN_ENT; if (iMsgQHandler) { iMsgQHandler->Cancel(); @@ -71,6 +73,7 @@ iContext.CallProxy->DeleteStream(iContext.CallType, iContext.StreamType, iContext.StreamId); } + TRACE_PRN_FN_EXT; } gint TMSStreamBodyImpl::Create(TMSCallType callType, TMSStreamType stype, diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsimpl/src/tmsstreamimpl.cpp --- a/mmserv/tms/tmsimpl/src/tmsstreamimpl.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsimpl/src/tmsstreamimpl.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -36,21 +36,23 @@ gint TMSStreamImpl::PostConstruct(TMSCallType callType, TMSStreamType stype, TMSCallProxy* proxy) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); - TMSStreamBody* tmsstreamimplbody(NULL); - ret = TMSStreamBodyImpl::Create(callType, stype, proxy, *this, - tmsstreamimplbody); + TMSStreamBody* bodyimpl(NULL); + ret = TMSStreamBodyImpl::Create(callType, stype, proxy, *this, bodyimpl); if (ret == TMS_RESULT_SUCCESS) { - this->iBody = tmsstreamimplbody; + this->iBody = bodyimpl; } + TRACE_PRN_FN_EXT; return ret; } gint TMSStreamImpl::Create(TMSCallType callType, TMSStreamType stype, TMSCallProxy* proxy, TMSStream*& strm) { + TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_INSUFFICIENT_MEMORY); TMSStreamImpl *self = new TMSStreamImpl(); @@ -64,6 +66,7 @@ } } strm = self; + TRACE_PRN_FN_EXT; return ret; } @@ -71,7 +74,7 @@ { TRACE_PRN_FN_ENT; gint ret(TMS_RESULT_SUCCESS); - delete (static_cast(strm)); + delete (static_cast (strm)); strm = NULL; TRACE_PRN_FN_EXT; return ret; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsproxy/bwins/tmsproxy.def --- a/mmserv/tms/tmsproxy/bwins/tmsproxy.def Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsproxy/bwins/tmsproxy.def Fri Jul 09 16:43:35 2010 -0500 @@ -31,9 +31,10 @@ ?Close@TMSProxy@TMS@@QAEXXZ @ 30 NONAME ; void TMS::TMSProxy::Close(void) ??0TMSProxy@TMS@@QAE@XZ @ 31 NONAME ; TMS::TMSProxy::TMSProxy(void) ?SetOutput@TMSProxy@TMS@@QAEHH@Z @ 32 NONAME ; int TMS::TMSProxy::SetOutput(int) - ?DeinitRT@TMSProxy@TMS@@QAEHXZ @ 33 NONAME ; int TMS::TMSProxy::DeinitRT(void) - ?CancelGlobalEffectNotifier@TMSProxy@TMS@@QAEHXZ @ 34 NONAME ; int TMS::TMSProxy::CancelGlobalEffectNotifier(void) - ?GetMaxGain@TMSProxy@TMS@@QAEHAAI@Z @ 35 NONAME ; int TMS::TMSProxy::GetMaxGain(unsigned int &) - ?StartGlobalEffectNotifier@TMSProxy@TMS@@QAEHXZ @ 36 NONAME ; int TMS::TMSProxy::StartGlobalEffectNotifier(void) - ?CancelDTMFNotifier@TMSProxy@TMS@@QAEHXZ @ 37 NONAME ; int TMS::TMSProxy::CancelDTMFNotifier(void) + ?InitDTMFPlayer@TMSProxy@TMS@@QAEHH@Z @ 33 NONAME ; int TMS::TMSProxy::InitDTMFPlayer(int) + ?DeinitRT@TMSProxy@TMS@@QAEHXZ @ 34 NONAME ; int TMS::TMSProxy::DeinitRT(void) + ?CancelGlobalEffectNotifier@TMSProxy@TMS@@QAEHXZ @ 35 NONAME ; int TMS::TMSProxy::CancelGlobalEffectNotifier(void) + ?GetMaxGain@TMSProxy@TMS@@QAEHAAI@Z @ 36 NONAME ; int TMS::TMSProxy::GetMaxGain(unsigned int &) + ?StartGlobalEffectNotifier@TMSProxy@TMS@@QAEHXZ @ 37 NONAME ; int TMS::TMSProxy::StartGlobalEffectNotifier(void) + ?CancelDTMFNotifier@TMSProxy@TMS@@QAEHXZ @ 38 NONAME ; int TMS::TMSProxy::CancelDTMFNotifier(void) diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsproxy/eabi/tmsproxy.def --- a/mmserv/tms/tmsproxy/eabi/tmsproxy.def Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsproxy/eabi/tmsproxy.def Fri Jul 09 16:43:35 2010 -0500 @@ -1,44 +1,45 @@ EXPORTS _ZN3TMS8TMSProxy10GetMaxGainERj @ 1 NONAME _ZN3TMS8TMSProxy11GetMaxLevelERj @ 2 NONAME - _ZN3TMS8TMSProxy14StopInbandToneEv @ 3 NONAME - _ZN3TMS8TMSProxy15StartInbandToneEi @ 4 NONAME - _ZN3TMS8TMSProxy17GetPreviousOutputERi @ 5 NONAME - _ZN3TMS8TMSProxy17StartDTMFNotifierEv @ 6 NONAME - _ZN3TMS8TMSProxy18CancelDTMFNotifierEv @ 7 NONAME - _ZN3TMS8TMSProxy19GetAvailableOutputsERSt6vectorIjSaIjEE @ 8 NONAME - _ZN3TMS8TMSProxy19SetMsgQueueNotifierENS_23TMSMsgQueueNotifierTypeEPvS2_i @ 9 NONAME - _ZN3TMS8TMSProxy20GetSupportedDecodersER6RArrayImERi @ 10 NONAME - _ZN3TMS8TMSProxy20GetSupportedEncodersER6RArrayImERi @ 11 NONAME - _ZN3TMS8TMSProxy20StartRoutingNotifierEv @ 12 NONAME - _ZN3TMS8TMSProxy21CancelRoutingNotifierEv @ 13 NONAME - _ZN3TMS8TMSProxy22RemoveMsgQueueNotifierENS_23TMSMsgQueueNotifierTypeEPv @ 14 NONAME - _ZN3TMS8TMSProxy23GetTMSCallSessionHandleEv @ 15 NONAME - _ZN3TMS8TMSProxy25ContinueDTMFStringSendingEi @ 16 NONAME - _ZN3TMS8TMSProxy25StartGlobalEffectNotifierEv @ 17 NONAME - _ZN3TMS8TMSProxy26CancelGlobalEffectNotifierEv @ 18 NONAME - _ZN3TMS8TMSProxy5CloseEv @ 19 NONAME - _ZN3TMS8TMSProxy6InitRTEiP8_GStringS2_ @ 20 NONAME - _ZN3TMS8TMSProxy6MuteRTEv @ 21 NONAME - _ZN3TMS8TMSProxy6PlayRTEv @ 22 NONAME - _ZN3TMS8TMSProxy6StopRTEv @ 23 NONAME - _ZN3TMS8TMSProxy7ConnectEv @ 24 NONAME - _ZN3TMS8TMSProxy7GetGainERj @ 25 NONAME - _ZN3TMS8TMSProxy7PauseRTEv @ 26 NONAME - _ZN3TMS8TMSProxy7SetGainEj @ 27 NONAME - _ZN3TMS8TMSProxy8DeinitRTEv @ 28 NONAME - _ZN3TMS8TMSProxy8GetLevelERj @ 29 NONAME - _ZN3TMS8TMSProxy8SetLevelEj @ 30 NONAME - _ZN3TMS8TMSProxy8StopDTMFEi @ 31 NONAME - _ZN3TMS8TMSProxy9GetOutputERi @ 32 NONAME - _ZN3TMS8TMSProxy9SetOutputEi @ 33 NONAME - _ZN3TMS8TMSProxy9StartDTMFEiP8_GString @ 34 NONAME - _ZN3TMS8TMSProxyC1Ev @ 35 NONAME - _ZN3TMS8TMSProxyC2Ev @ 36 NONAME - _ZN3TMS8TMSProxyD0Ev @ 37 NONAME - _ZN3TMS8TMSProxyD1Ev @ 38 NONAME - _ZN3TMS8TMSProxyD2Ev @ 39 NONAME - _ZNK3TMS8TMSProxy7VersionEv @ 40 NONAME - _ZTIN3TMS8TMSProxyE @ 41 NONAME - _ZTVN3TMS8TMSProxyE @ 42 NONAME + _ZN3TMS8TMSProxy14InitDTMFPlayerEi @ 3 NONAME + _ZN3TMS8TMSProxy14StopInbandToneEv @ 4 NONAME + _ZN3TMS8TMSProxy15StartInbandToneEi @ 5 NONAME + _ZN3TMS8TMSProxy17GetPreviousOutputERi @ 6 NONAME + _ZN3TMS8TMSProxy17StartDTMFNotifierEv @ 7 NONAME + _ZN3TMS8TMSProxy18CancelDTMFNotifierEv @ 8 NONAME + _ZN3TMS8TMSProxy19GetAvailableOutputsERSt6vectorIjSaIjEE @ 9 NONAME + _ZN3TMS8TMSProxy19SetMsgQueueNotifierENS_23TMSMsgQueueNotifierTypeEPvS2_i @ 10 NONAME + _ZN3TMS8TMSProxy20GetSupportedDecodersER6RArrayImERi @ 11 NONAME + _ZN3TMS8TMSProxy20GetSupportedEncodersER6RArrayImERi @ 12 NONAME + _ZN3TMS8TMSProxy20StartRoutingNotifierEv @ 13 NONAME + _ZN3TMS8TMSProxy21CancelRoutingNotifierEv @ 14 NONAME + _ZN3TMS8TMSProxy22RemoveMsgQueueNotifierENS_23TMSMsgQueueNotifierTypeEPv @ 15 NONAME + _ZN3TMS8TMSProxy23GetTMSCallSessionHandleEv @ 16 NONAME + _ZN3TMS8TMSProxy25ContinueDTMFStringSendingEi @ 17 NONAME + _ZN3TMS8TMSProxy25StartGlobalEffectNotifierEv @ 18 NONAME + _ZN3TMS8TMSProxy26CancelGlobalEffectNotifierEv @ 19 NONAME + _ZN3TMS8TMSProxy5CloseEv @ 20 NONAME + _ZN3TMS8TMSProxy6InitRTEiP8_GStringS2_ @ 21 NONAME + _ZN3TMS8TMSProxy6MuteRTEv @ 22 NONAME + _ZN3TMS8TMSProxy6PlayRTEv @ 23 NONAME + _ZN3TMS8TMSProxy6StopRTEv @ 24 NONAME + _ZN3TMS8TMSProxy7ConnectEv @ 25 NONAME + _ZN3TMS8TMSProxy7GetGainERj @ 26 NONAME + _ZN3TMS8TMSProxy7PauseRTEv @ 27 NONAME + _ZN3TMS8TMSProxy7SetGainEj @ 28 NONAME + _ZN3TMS8TMSProxy8DeinitRTEv @ 29 NONAME + _ZN3TMS8TMSProxy8GetLevelERj @ 30 NONAME + _ZN3TMS8TMSProxy8SetLevelEj @ 31 NONAME + _ZN3TMS8TMSProxy8StopDTMFEi @ 32 NONAME + _ZN3TMS8TMSProxy9GetOutputERi @ 33 NONAME + _ZN3TMS8TMSProxy9SetOutputEi @ 34 NONAME + _ZN3TMS8TMSProxy9StartDTMFEiP8_GString @ 35 NONAME + _ZN3TMS8TMSProxyC1Ev @ 36 NONAME + _ZN3TMS8TMSProxyC2Ev @ 37 NONAME + _ZN3TMS8TMSProxyD0Ev @ 38 NONAME + _ZN3TMS8TMSProxyD1Ev @ 39 NONAME + _ZN3TMS8TMSProxyD2Ev @ 40 NONAME + _ZNK3TMS8TMSProxy7VersionEv @ 41 NONAME + _ZTIN3TMS8TMSProxyE @ 42 NONAME + _ZTVN3TMS8TMSProxyE @ 43 NONAME diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsproxy/src/tmsproxy.cpp --- a/mmserv/tms/tmsproxy/src/tmsproxy.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsproxy/src/tmsproxy.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -30,12 +30,12 @@ using namespace TMS; // CONSTANTS -const TUint KTMSServerConnectRetries = 2; -const TUint KSessionMessageSlots = 10; -const TUint KUTF8Multiply = 2; +const guint KTMSServerConnectRetries = 2; +const guint KSessionMessageSlots = 10; +const guint KUTF8Multiply = 2; // ----------------------------------------------------------------------------- -// StartServer +// TMSProxy::StartServer // // Function that will launch TMS server executable in it its own process. // Start the server process/thread, which lives in an EPOCEXE object. @@ -119,14 +119,13 @@ { TRACE_PRN_FN_ENT; - gint retry = KTMSServerConnectRetries; + guint retry = KTMSServerConnectRetries; gint err(TMS_RESULT_GENERAL_ERROR); - gint numMessageSlots = KSessionMessageSlots; for (;;) { // Try to create a new session with the server - err = CreateSession(KTMSServerName, Version(), numMessageSlots); + err = CreateSession(KTMSServerName, Version(), KSessionMessageSlots); if ((err != KErrNotFound) && (err != KErrServerTerminated)) { @@ -183,9 +182,8 @@ EXPORT_C gint TMSProxy::GetTMSCallSessionHandle() { - gint err(TMS_RESULT_SUCCESS); - err = SendReceive(ETMSCallSessionHandle); - return TMSRESULT(err); + gint handle = SendReceive(ETMSCallSessionHandle); + return handle; } EXPORT_C gint TMSProxy::GetSupportedDecoders(RArray& aDecoders, @@ -414,7 +412,7 @@ { // Convert buffer from UTF-8 to unicode (16-bit) // Note: UTF-8 strings can take up to 4 bytes per character - gint unilen = tts->len / KUTF8Multiply; + guint unilen = tts->len / KUTF8Multiply; TRAP(status, ttsBuf = HBufC::NewL(unilen)); if (status == KErrNone) { @@ -438,7 +436,7 @@ HBufC* buf(NULL); // Convert buffer from UTF-8 to unicode (16-bit) // Note: UTF-8 strings can take up to 4 bytes per character - gint unilen = str->len / KUTF8Multiply; + guint unilen = str->len / KUTF8Multiply; TRAP(status, buf = HBufC::NewL(unilen)); if (buf && status == KErrNone) @@ -537,6 +535,15 @@ return TMSRESULT(status); } +EXPORT_C gint TMSProxy::InitDTMFPlayer(TMSStreamType streamtype) + { + gint status(TMS_RESULT_SUCCESS); + TIpcArgs args; + args.Set(0, streamtype); + status = RSessionBase::SendReceive(ETMSInitDTMF, args); + return TMSRESULT(status); + } + EXPORT_C gint TMSProxy::StartDTMF(TMSStreamType streamtype, GString* tone) { TRACE_PRN_FN_ENT; diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/group/tmsserver.mmp --- a/mmserv/tms/tmsserver/group/tmsserver.mmp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/group/tmsserver.mmp Fri Jul 09 16:43:35 2010 -0500 @@ -45,6 +45,11 @@ SOURCE tmsrtaudiohdlr.cpp SOURCE tmsrtplayer.cpp SOURCE tmsasyncreqao.cpp +SOURCE tmsdtmftoneplayer.cpp +SOURCE tmsdtmfprovider.cpp +SOURCE tmseteldtmfmonitor.cpp +SOURCE tmseteldtmfstopmonitor.cpp +SOURCE tmsdtmfnotifier.cpp USERINCLUDE ../inc USERINCLUDE ../../inc @@ -76,6 +81,10 @@ LIBRARY apmime.lib LIBRARY charconv.lib LIBRARY caf.lib +// Libraries for ETel +LIBRARY etelmm.lib +LIBRARY etel.lib +LIBRARY customapi.lib SMPSAFE diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmsdtmfnotifier.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmsdtmfnotifier.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef DTMFNOTIFIER_H +#define DTMFNOTIFIER_H + +// INCLUDES +#include +#include +#include "tmsclientserver.h" + +namespace TMS { + +// CLASS DECLARATION +class TMSDtmfNotifier + { +public: + // Constructors and destructor + + /** + * Two-phased constructor. + */ + static TMSDtmfNotifier* NewL(); + + /** + * Destructor. + */ + virtual ~TMSDtmfNotifier(); + +public: + // New functions + + void SetDtmf(TmsMsgBufPckg dtmfpckg, gboolean publish = TRUE); + +private: + + /** + * C++ default constructor. + */ + TMSDtmfNotifier(); + + /** + * By default Symbian 2nd phase constructor is private. + */ + void ConstructL(); + +private: + gint iVolume; + }; + +} //namespace TMS + +#endif // DTMFNOTIFIER_H + +// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmsdtmfobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmsdtmfobserver.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef TMSDTMFOBSERVER_H +#define TMSDTMFOBSERVER_H + +#include + +namespace TMS { + +/** + * CCP DTMF related events observer class. + * This class is used for notifying DTMF specific events. + */ +class TMSDTMFObserver + { +public: + + /** DTMF Events */ + enum TCCPDtmfEvent + { + /** Unknown */ + ECCPDtmfUnknown = 0, + /** DTMF sending started manually */ + ECCPDtmfManualStart = 5, + /** DTMF sending stopped manually */ + ECCPDtmfManualStop = 6, + /** DTMF sending aborted manually */ + ECCPDtmfManualAbort = 7, + /** Automatic DTMF sending initialized */ + ECCPDtmfSequenceStart = 9, + /** Automatic DTMF sending stopped */ + ECCPDtmfSequenceStop = 10, + /** Automatic DTMF sending aborted */ + ECCPDtmfSequenceAbort = 11, + /** There was stop mark in DTMF string */ + ECCPDtmfStopInDtmfString, + /** DTMF sending completed succesfully */ + ECCPDtmfStringSendingCompleted + }; + + //protected: + /** + * Protects the observer being deleted through the observer interface. + */ + //virtual inline ~TMSDTMFObserver() {}; + +public: + + /** + * HandleDTMFEvents. + * @param event Event type + * @param status Error code + * @param tone Character + * @return none + */ + virtual void HandleDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent event, + const gint status, const TChar tone) /*const*/ = 0; + }; + +} //namespace TMS + +#endif // TMSDTMFOBSERVER_H + +// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmsdtmfprovider.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmsdtmfprovider.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef TMSDTMFPROVIDER_H +#define TMSDTMFPROVIDER_H + +#include +#include +#include +#include +#include "tmsdtmfobserver.h" + +namespace TMS { + +// FORWARD DECLARATIONS +class TMSEtelDtmfMonitor; +class TMSEtelDtmfStopMonitor; + +/** + * TMSDTMFProvider class + * Makes asynchronic request to ETel interface according to given request type. + * Provides canceling via CActive::Cancel(). + */ +class TMSDTMFProvider : public CActive + { +public: + + /** + * Two phased constructing of the DTMF provider instance. + * @param aPhone mobile phone handle + * @param aMmCustom custom API handle for special DTMF event + * monitoring. + * @return the DTMF provider instance + */ + static TMSDTMFProvider* NewL(); + + /** + * C++ default destructor + */ + virtual ~TMSDTMFProvider(); + + /** + * HandleDTMFEvents. + * @param aEvent Event type + * @param aError Error code + * @param aTone Character + */ + void NotifyDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent aEvent, + const gint aError, const TChar aTone); + + // from base class MCCPDTMFProvider + /** + * Cancels asynchronous DTMF string sending. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + gint CancelDtmfStringSending(); + + /** + * Starts the transmission of a single DTMF tone across a + * connected and active call. + * @param aTone Tone to be played. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + gint StartDtmfTone(const TChar aTone); + + /** + * Stops playing current DTMF tone. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + gint StopDtmfTone(); + + /** + * Plays DTMF string. + * @param aString String to be played. + * @return KErrNone if succesfull, otherwise another system wide error code + * KErrArgument if the specified string contains illegal DTMF characters + */ + gint SendDtmfToneString(const TDesC& aString); + + /** + * Continue or cancel sending DTMF string which was stopped with 'w' + * character in string. + * @param aContinue ETrue if sending of the DTMF string should continue, + * EFalse if the rest of the DTMF string is to be discarded. + * @return KErrNone if succesfull, otherwise another system wide error code + */ + gint ContinueDtmfStringSending(const gboolean aContinue); + + /** + * Add an observer for DTMF related events. + * Plug-in dependent feature if duplicates or more than one observers + * are allowed or not. Currently CCE will set only one observer. + * @param aObserver Observer + * @leave system error if observer adding fails + */ + void AddObserver(const TMSDTMFObserver& aObserver); + + /** + * Remove an observer. + * @param aObserver Observer + * @return KErrNone if removed succesfully. KErrNotFound if observer was + * not found. Any other system error depending on the error. + */ + gint RemoveObserver(const TMSDTMFObserver& aObserver); + + // from base class CActive +protected: + /** + * From CActive + * RunL + */ + void RunL(); + + /** + * From CActive + * Cancels the monitor + */ + void DoCancel(); + +private: + /** + * Constructs the requester. + * + * @param aPhone handle to ETel phone + * @param aMmCustom custom API handle + */ + TMSDTMFProvider(); + + /** + * Constructing the provider in the second phase. + */ + void ConstructL(); + +private: + /** + * DTMF event observer. + */ + RPointerArray iObservers; + + /** + * ETel phone handle for DTMF functionality. + */ + RMobilePhone iPhone; + + /** + * Monitor for DTMF events and changes. + * Own. + */ + TMSEtelDtmfMonitor* iMonitor; + + /** + * Monitor for DTMF stopping. + * Own. + */ + TMSEtelDtmfStopMonitor* iStopMonitor; + + /** + * Custom API reference. + */ + RMmCustomAPI iMmCustom; + + RTelServer iServer; + TBuf<25> iTsyname; + }; + +} //namespace TMS + +#endif //TMSDTMFPROVIDER_H diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmsdtmftoneplayer.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmsdtmftoneplayer.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef TMSAUDIODTMFTONEPLAYER_H +#define TMSAUDIODTMFTONEPLAYER_H + +// INCLUDES +#include +#include +#include "tmsdtmftoneplayerobserver.h" + +// FORWARD DECLARATIONS +class CMMFDevSound; + +// CLASS DECLARATION + +/** + * Plays DTMF tones using media server + */ + +namespace TMS { + +class TMSAudioDtmfTonePlayer : public MDevSoundObserver + { +public: + // Constructors and destructor + + /** + * Two-phased constructor. + */ + static TMSAudioDtmfTonePlayer* NewL(TMSDTMFTonePlayerObserver& obsrvr, + guint audioPreference, guint audioPriority); + + /** + * Destructor. + */ + virtual ~TMSAudioDtmfTonePlayer(); + +public: + + /** + * Sets volume. + * @param aVolume volume value or KDtmfSilent. + * @return None. + */ + void SetVolume(gint volume); + + /** + * Starts playing given dtmf tone infinitely. + * @param aTone Tone to be played. + * @return None. + */ + void PlayDtmfTone(TDes& tone); + + /** + * Cancels playing. + * @param None. + * @return None. + */ + void Cancel(); + +public: + //From MDevSoundObserver + /** + * See MDevSoundObserver + */ + void InitializeComplete(TInt aError); + + /** + * See MDevSoundObserver + */ + void ToneFinished(TInt aError); + + /** + * See MDevSoundObserver + */ + void BufferToBeFilled(CMMFBuffer* /*aBuffer*/) {} + + /** + * See MDevSoundObserver + */ + void PlayError(TInt /*aError*/) {} + + /** + * See MDevSoundObserver + */ + void BufferToBeEmptied(CMMFBuffer* /*aBuffer*/) {} + + /** + * See MDevSoundObserver + */ + void RecordError(TInt /*aError*/) {} + + /** + * See MDevSoundObserver + */ + void ConvertError(TInt /*aError*/) {} + /** + * See MDevSoundObserver + */ + void DeviceMessage(TUid /*aMessageType*/, const TDesC8& /*aMsg*/) {} + +protected: + + /** + * C++ default constructor. + */ + TMSAudioDtmfTonePlayer(TMSDTMFTonePlayerObserver& obsrvr, + guint audioPreference, guint audioPriority); + + void ConstructL(); + + /** + * Normalize tone. + * @param aTone dtmf tone. + * @return None. + */ + void Normalize(TChar& tone); + +private: + //new functions + + /** + * Converts the given value to the one that matches tha range used by + * CMMFDevSound. The CMMFDevSound uses valuess that can from 0 to the + * value returned by a call to CMMFDevSound::MaxVolume(). + */ + gint ConvertVolumeLevel(gint volume); + +protected: + // Data + + // Current volume setting. + gint iVolume; + + // DTMF player instance + CMMFDevSound* iDTMFPlayer; + + TMSDTMFTonePlayerObserver& iObserver; + guint iPref; + guint iPrior; + }; + +} //namespace TMS + +#endif // TMSAUDIODTMFTONEPLAYER_H + +// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmsdtmftoneplayerobserver.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmsdtmftoneplayerobserver.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef DTMFTONEPLAYEROBSERVER_H +#define DTMFTONEPLAYEROBSERVER_H + +#include + +namespace TMS { + +/** + * Observer interface for knowing when dtmf tone player has been initialized. + */ +class TMSDTMFTonePlayerObserver + { +public: + virtual void DTMFInitCompleted(gint status) = 0; + virtual void DTMFToneFinished(gint status) = 0; + }; +} //namespace TMS + +#endif // DTMFTONEPLAYEROBSERVER_H + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmseteldtmfmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmseteldtmfmonitor.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef TMSETELDTMFMONITOR_H +#define TMSETELDTMFMONITOR_H + +#include +#include +#include + +namespace TMS { + +// FORWARD DECLARATIONS +class TMSCSPCall; +class TMSDTMFProvider; + +/** + * TMSEtelDtmfMonitor class + * + * Monitors ETel for DTMF events. + * + * This monitor is applied only for listening incoming calls, i.e. + * line capabilites are not monitored. + * + * @lib csplugin.dll + * + */ +class TMSEtelDtmfMonitor : public CActive + { +public: + /** + * Two-phased constructing for the monitor. + * + * @param aObserver the observer for getting notification + * @param aMmCustom Custom API handle + */ + static TMSEtelDtmfMonitor* NewL(TMSDTMFProvider& aObserver, + RMmCustomAPI& aMmCustom); + + /** + * C++ default destructor + */ + virtual ~TMSEtelDtmfMonitor(); + + /** + * Start monitoring call events + */ + void StartMonitoring(); + +protected: // From CActive + /** + * From CActive + * RunL + */ + void RunL(); + + /** + * From CActive + * Cancels the monitor + */ + void DoCancel(); + +private: + /** + * C++ default constructor + * @param aObserver the observer for status change (incoming call) + * @param aMmCustom Custom API handle + */ + TMSEtelDtmfMonitor(TMSDTMFProvider& aObserver, RMmCustomAPI& aMmCustom); + +private: + /** + * Forwards events. + */ + TMSDTMFProvider& iObserver; + + /** + * Event data. Updated when event occurs. + */ + RMmCustomAPI::TDtmfInfo iEventData; + + /** + * Custom API reference. + */ + RMmCustomAPI& iMmCustom; + }; + +} //namespace TMS + +#endif // TMSETELDTMFMONITOR_H + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmseteldtmfstopmonitor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/inc/tmseteldtmfstopmonitor.h Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#ifndef TMSETELDTMFSTOPMONITOR_H +#define TMSETELDTMFSTOPMONITOR_H + +#include +#include + +namespace TMS { + +// FORWARD DECLARATIONS +class TMSDTMFProvider; + +/** + * TMSEtelDtmfStopMonitor class + * + * Monitors single ETel RMobilePhone for DTMF events. + * + * This monitor is applied only for listening incoming calls, i.e. + * line capabilites are not monitored. + * + */ +class TMSEtelDtmfStopMonitor : public CActive + { +public: + /** + * Two-phased constructing for the monitor. + * + * @param aObserver the observer for getting notification + * @param aPhone the line to monitor + */ + static TMSEtelDtmfStopMonitor* NewL(TMSDTMFProvider& aObserver, + RMobilePhone& aPhone); + + /** + * C++ default destructor + */ + virtual ~TMSEtelDtmfStopMonitor(); + + /** + * Start monitoring call events + */ + void StartMonitoring(); + +protected: // From CActive + /** + * From CActive + * RunL + */ + void RunL(); + + /** + * From CActive + * Cancels the monitor + */ + void DoCancel(); + +private: + /** + * C++ default constructor + * @param aObserver the observer for status change (incoming call) + * @param aPhone the line associated with the call + */ + TMSEtelDtmfStopMonitor(TMSDTMFProvider& aObserver, RMobilePhone& aPhone); + +private: + /** + * Forwards events. + */ + TMSDTMFProvider& iObserver; + + /** + * Phone that is being observed for incoming call. + */ + RMobilePhone& iPhone; + + /** + * Event received. + */ + RMobilePhone::TMobilePhoneDTMFEvent iEventData; + + }; + +} //namespace TMS + +#endif // TMSETELDTMFSTOPMONITOR_H + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmsserver.h --- a/mmserv/tms/tmsserver/inc/tmsserver.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/inc/tmsserver.h Fri Jul 09 16:43:35 2010 -0500 @@ -15,8 +15,8 @@ * */ -#ifndef __TMSSERVER_H -#define __TMSSERVER_H +#ifndef TMSSERVER_H +#define TMSSERVER_H #include #include @@ -25,6 +25,8 @@ #include "tmsclientserver.h" #include "tmsrtplayerobsrv.h" #include "tmsrtplayer.h" +#include "tmsdtmfobserver.h" +#include "tmsdtmftoneplayerobserver.h" namespace TMS { @@ -37,13 +39,18 @@ class TMSCSPCenRepListener; class TMSCenRepAudioHandler; class TMSDtmfEventHandler; +class TMSAudioDtmfTonePlayer; +class TMSDTMFProvider; +class TMSDtmfNotifier; // ----------------------------------------------------------------------------- // TMSServer class // ----------------------------------------------------------------------------- // class TMSServer : public CServer2, - private TMSRtPlayerObsrv + private TMSRtPlayerObsrv, + private TMSDTMFObserver, + private TMSDTMFTonePlayerObserver { public: static void RunServerL(); @@ -53,12 +60,6 @@ void DropSession(); TInt SessionCount() const; - void SetDnLinkSession(const TBool aSession); - void SetUpLinkSession(const TBool aSession); - - TBool HasDnLinkSession() const; - TBool HasUpLinkSession() const; - void GetNewTMSCallSessionHandleL(RHandleBase& aHandle); TInt SetOutput(CSession2* sid, TInt output); TInt GetOutput(const RMessage2& aMessage); @@ -75,12 +76,15 @@ TInt GetSupportedCodecs(const TMSStreamType strmType, RArray*& aCodecs); - TInt NotifyTarClients(TRoutingMsgBufPckg routingpckg); + // for DTMF player + TInt InitDTMF(const RMessage2& aMessage); TInt StartDTMF(const RMessage2& aMessage); TInt StopDTMF(const RMessage2& aMessage); TInt ContinueSendingDTMF(const RMessage2& aMessage); TInt NotifyDtmfClients(TmsMsgBufPckg dtmfpckg); + gint FindActiveCallType(); + TInt NotifyTarClients(TRoutingMsgBufPckg routingpckg); void StartDTMFNotifierL(); void CancelDTMFNotifier(); void StartRoutingNotifierL(); @@ -106,6 +110,14 @@ // from TMSRtPlayerObsrv void RtPlayerEvent(TInt aEventType, TInt aError); + //From TMSDTMFTonePlayerObserver + void DTMFInitCompleted(gint status); + void DTMFToneFinished(gint status); + + //From TMSDTMFObserver + void HandleDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent event, + const gint status, const TChar tone); + private: static TMSServer* NewLC(); TMSServer(); @@ -122,9 +134,6 @@ TInt iSession; TMSServerShutDown *iShutdownTimer; - TBool iDnlinkSession; - TBool iUplinkSession; - mutable RPointerArray iTMSCallServList; TMSGlobalEffectsSettings* iEffectSettings; TMSTarEventHandler* iTarHandler; @@ -134,6 +143,7 @@ TInt iTarHandlerCount; TInt iAudioCenRepHandlerCount; TInt iDTMFHandlerCount; + TMSCallType iActiveCallType; // for RT TMSRingTonePlayer* iTMSRtPlayer; @@ -141,6 +151,12 @@ HBufC8* iRtSequence; HBufC* iTtsText; + // for DTMF + TMSAudioDtmfTonePlayer* iDTMFDnlinkPlayer; + TMSDtmfNotifier* iDTMFNotifier; + TMSAudioDtmfTonePlayer* iDTMFUplinkPlayer; + TMSDTMFProvider* iDTMFUplinkPlayerEtel; + // for codecs count RArray iDnlCodecs; RArray iUplCodecs; @@ -191,6 +207,5 @@ } //namespace TMS -#endif //__TMSSERVER_H +#endif //TMSSERVER_H -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/inc/tmstareventhandler.h --- a/mmserv/tms/tmsserver/inc/tmstareventhandler.h Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/inc/tmstareventhandler.h Fri Jul 09 16:43:35 2010 -0500 @@ -53,6 +53,12 @@ **/ void RunL(); + /** + * From CActive + * Called when RunL leaves. + **/ + TInt RunError(TInt aError); + private: /** @@ -74,4 +80,3 @@ #endif //TMSTAREVENTHANDLER_H -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp --- a/mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsaudioinbandtoneplayer.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -263,7 +263,7 @@ default: break; } -#ifndef __WINS__ +#ifndef __WINSCW__ //Play the tone iPlayer->Play(); #endif @@ -285,22 +285,6 @@ } // ----------------------------------------------------------------------------- -// TMSAudioInbandTonePlayer::MatoPrepareComplete -// Updates flag values and plays current inbandtone. -// (other items were commented in a header). -// ----------------------------------------------------------------------------- -// -void TMSAudioInbandTonePlayer::MatoPrepareComplete(TInt aError) - { - TRACE_PRN_FN_ENT; - if (aError == KErrNone) - { - PlayCurrentTone(); - } - TRACE_PRN_FN_EXT; - } - -// ----------------------------------------------------------------------------- // TMSAudioInbandTonePlayer::SetVolume // ----------------------------------------------------------------------------- // @@ -322,15 +306,40 @@ } // ----------------------------------------------------------------------------- +// TMSAudioInbandTonePlayer::MatoPrepareComplete +// Updates flag values and plays current inbandtone. +// (other items were commented in a header). +// ----------------------------------------------------------------------------- +// +void TMSAudioInbandTonePlayer::MatoPrepareComplete(TInt aError) + { + TRACE_PRN_FN_ENT; + if (aError == KErrNone) + { + PlayCurrentTone(); + } + TRACE_PRN_IF_ERR(aError); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- // TMSAudioInbandTonePlayer::MatoPlayComplete // - // (other items were commented in a header). // ----------------------------------------------------------------------------- // -void TMSAudioInbandTonePlayer::MatoPlayComplete(TInt /*aError*/) +void TMSAudioInbandTonePlayer::MatoPlayComplete( +#ifdef _DEBUG + TInt aError) +#else + TInt /*aError*/) +#endif { TRACE_PRN_FN_ENT; // TODO: process error? +#ifdef _DEBUG + TRACE_PRN_IF_ERR(aError); +#endif TRACE_PRN_FN_EXT; } @@ -360,4 +369,3 @@ TRACE_PRN_FN_EXT; } -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsdtmfeventhandler.cpp --- a/mmserv/tms/tmsserver/src/tmsdtmfeventhandler.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsdtmfeventhandler.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -96,15 +96,12 @@ TRACE_PRN_FN_ENT; // Subscribe immediately before analyzing the notification to ensure that we // don't miss further updates. -//if (iStatus.Int() == KErrNone) -// { iStatus = KRequestPending; iProperty.Subscribe(iStatus); SetActive(); TmsMsgBufPckg dtmfpckg; iProperty.Get(dtmfpckg); iTMSSer->NotifyDtmfClients(dtmfpckg); -// } TRACE_PRN_FN_EXT; } @@ -117,5 +114,3 @@ return aError; } -// End of File - diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsdtmfnotifier.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/src/tmsdtmfnotifier.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +// INCLUDE FILES +#include "tmsdtmfnotifier.h" +#include "tmsclientserver.h" +#include "tmsutility.h" + +using namespace TMS; + +// CONSTANTS +_LIT_SECURITY_POLICY_PASS(KTMSServerReadPolicy); +_LIT_SECURITY_POLICY_C1(KTMSServerWritePolicy, ECapabilityWriteUserData); + +// ----------------------------------------------------------------------------- +// TMSDtmfNotifier::TMSDtmfNotifier +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +TMSDtmfNotifier::TMSDtmfNotifier() + { + } + +// ----------------------------------------------------------------------------- +// TMSDtmfNotifier::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void TMSDtmfNotifier::ConstructL() + { + TRACE_PRN_FN_ENT; + gint err = RProperty::Define(EDtmfPs, RProperty::EByteArray, + KTMSServerReadPolicy, KTMSServerWritePolicy); + TRACE_PRN_N1(_L("DtmfSetting::ConstructL err:%d"), err); + + if (err != KErrAlreadyExists) + { + User::LeaveIfError(err); + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSDtmfNotifier::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +TMSDtmfNotifier* TMSDtmfNotifier::NewL() + { + TMSDtmfNotifier* self = new (ELeave) TMSDtmfNotifier(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +// Destructor +TMSDtmfNotifier::~TMSDtmfNotifier() + { + TRACE_PRN_FN_ENT; + gint err = RProperty::Delete(KTMSPropertyCategory, EDtmfPs); + TRACE_PRN_N1(_L("DtmfSetting::~TMSDtmfNotifier err:%d"), err); + TRACE_PRN_FN_ENT; + } + +// ----------------------------------------------------------------------------- +// TMSDtmfNotifier::SetDtmf +// ----------------------------------------------------------------------------- +// +void TMSDtmfNotifier::SetDtmf(TmsMsgBufPckg dtmfpckg, gboolean publish) + { + TRACE_PRN_FN_ENT; + if (publish) + { + gint err = RProperty::Set(KTMSPropertyCategory, EDtmfPs, dtmfpckg); + TRACE_PRN_N1(_L("DtmfSetting::SetDtmf err:%d"), err); + } + TRACE_PRN_FN_EXT; + } + +// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsdtmfprovider.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/src/tmsdtmfprovider.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,307 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#include +#include +#include "tmsdtmfprovider.h" +#include "tmsdtmfobserver.h" +#include "tmsutility.h" +#include "tmseteldtmfmonitor.h" +#include "tmseteldtmfstopmonitor.h" + +using namespace TMS; + +TMSDTMFProvider* TMSDTMFProvider::NewL() + { + TRACE_PRN_FN_ENT; + TMSDTMFProvider* self = new (ELeave) TMSDTMFProvider(); + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + TRACE_PRN_FN_EXT; + return self; + } + +// ----------------------------------------------------------------------------- +// Destructor of the object. +// ----------------------------------------------------------------------------- +// +TMSDTMFProvider::~TMSDTMFProvider() + { + TRACE_PRN_FN_ENT; + Cancel(); + iObservers.Close(); + delete iMonitor; + delete iStopMonitor; + + iMmCustom.Close(); + iPhone.Close(); + iServer.UnloadPhoneModule(iTsyname); + iServer.Close(); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Constructs the requester. +// ----------------------------------------------------------------------------- +// +TMSDTMFProvider::TMSDTMFProvider() : + CActive(EPriorityStandard) + { + TRACE_PRN_FN_ENT; + CActiveScheduler::Add(this); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Constructs the requester in the second phase. +// ----------------------------------------------------------------------------- +// +void TMSDTMFProvider::ConstructL() + { + TRACE_PRN_FN_ENT; + + User::LeaveIfError(iServer.Connect()); + + TRACE_PRN_N(_L("**TMS ETel iServer.Connect")); + + User::LeaveIfError(iServer.GetTsyName(0, iTsyname)); + + //Load in the phone device driver + User::LeaveIfError(iServer.LoadPhoneModule(iTsyname)); + + TRACE_PRN_N(_L("**TMS ETel iServer.LoadPhoneModule")); + + //Find the number of phones available from the tel server + gint numberPhones; + User::LeaveIfError(iServer.EnumeratePhones(numberPhones)); + + TRACE_PRN_N(_L("**TMS ETel iServer.EnumeratePhones")); + + //Check there are available phones + if (numberPhones < 1) + { + User::Leave(KErrNotFound); + } + + //Get info about the first available phone + RTelServer::TPhoneInfo info; + User::LeaveIfError(iServer.GetPhoneInfo(0, info)); + + TRACE_PRN_N(_L("**TMS ETel iServer.GetPhoneInfo")); + + CleanupClosePushL(iPhone); + User::LeaveIfError(iPhone.Open(iServer, info.iName)); + + TRACE_PRN_N(_L("**TMS ETel iPhone.Open")); + + RMobilePhone::TLineInfo lineInfo; + User::LeaveIfError(iPhone.GetLineInfo(0, lineInfo)); + + TRACE_PRN_N(_L("**TMS ETel iPhone.GetLineInfo")); + + gint errorCode = iMmCustom.Open(iPhone); + + if (!iPhone.SubSessionHandle() || !iMmCustom.SubSessionHandle()) + { + User::Leave(KErrArgument); + } + iMonitor = TMSEtelDtmfMonitor::NewL(*this, iMmCustom); + iMonitor->StartMonitoring(); + iStopMonitor = TMSEtelDtmfStopMonitor::NewL(*this, iPhone); + // iStopMonitor->StartMonitoring(); + + CleanupStack::Pop(1);//phone + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Notifies observers about a DTMF event +// ----------------------------------------------------------------------------- +// +void TMSDTMFProvider::NotifyDTMFEvent( + const TMSDTMFObserver::TCCPDtmfEvent aEvent, const gint aError, + const TChar aTone) + { + TRACE_PRN_FN_ENT; + for (gint i = 0; i < iObservers.Count(); i++) + { + TMSDTMFObserver* obs = iObservers[i]; + if (obs) + { + iObservers[i]->HandleDTMFEvent(aEvent, aError, aTone); + } + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Cancel DTMF string sending +// ----------------------------------------------------------------------------- +// +gint TMSDTMFProvider::CancelDtmfStringSending() + { + TRACE_PRN_FN_ENT; + gint ret(KErrAlreadyExists); + if (IsActive()) + { + Cancel(); + ret = KErrNone; + } + TRACE_PRN_FN_EXT; + return ret; + } + +// ----------------------------------------------------------------------------- +// Starts DTMF string sending +// ----------------------------------------------------------------------------- +// +gint TMSDTMFProvider::StartDtmfTone(const TChar aTone) + { + TRACE_PRN_FN_ENT; + gint ret(KErrAlreadyExists); + if (!IsActive()) + { + ret = iPhone.StartDTMFTone(aTone); + } + TRACE_PRN_IF_ERR(ret); + TRACE_PRN_FN_EXT; + return ret; + } + +// ----------------------------------------------------------------------------- +// Stop DTMF tone +// ----------------------------------------------------------------------------- +// +gint TMSDTMFProvider::StopDtmfTone() + { + TRACE_PRN_FN_ENT; + gint ret(KErrAlreadyExists); + if (!IsActive()) + { + ret = iPhone.StopDTMFTone(); + } + TRACE_PRN_IF_ERR(ret); + TRACE_PRN_FN_EXT; + return ret; + } + +// ----------------------------------------------------------------------------- +// Send DTMF string +// ----------------------------------------------------------------------------- +// +gint TMSDTMFProvider::SendDtmfToneString(const TDesC& aString) + { + TRACE_PRN_FN_ENT; + gint ret = KErrInUse; + if (!IsActive()) + { + iStatus = KRequestPending; + iPhone.SendDTMFTones(iStatus, aString); + SetActive(); + ret = KErrNone; + } + TRACE_PRN_IF_ERR(ret); + TRACE_PRN_FN_EXT; + return ret; + } + +// ----------------------------------------------------------------------------- +// Continue DTMF string sending +// ----------------------------------------------------------------------------- +// +gint TMSDTMFProvider::ContinueDtmfStringSending(const gboolean aContinue) + { + TRACE_PRN_FN_ENT; + gint status = iPhone.ContinueDTMFStringSending(aContinue); + TRACE_PRN_FN_EXT; + return status; + } + +// ----------------------------------------------------------------------------- +// Adds observer. +// ----------------------------------------------------------------------------- +// +void TMSDTMFProvider::AddObserver(const TMSDTMFObserver& aObserver) + { + TRACE_PRN_FN_ENT; + if (iObservers.Find(&aObserver) == KErrNotFound) + { + iObservers.Append(&aObserver); + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Removes given observer. +// ----------------------------------------------------------------------------- +// +gint TMSDTMFProvider::RemoveObserver(const TMSDTMFObserver& aObserver) + { + TRACE_PRN_FN_ENT; + gint ret = KErrNotFound; + gint found = iObservers.Find(&aObserver); + if (found != KErrNotFound) + { + iObservers.Remove(found); + ret = KErrNone; + } + TRACE_PRN_FN_EXT; + return ret; + } + +// ----------------------------------------------------------------------------- +// From CActive. +// Handles request completion. +// ----------------------------------------------------------------------------- +// +void TMSDTMFProvider::RunL() + { + TRACE_PRN_FN_ENT; + if (iStatus == KErrNone) + { + TMSDTMFObserver::TCCPDtmfEvent event = + TMSDTMFObserver::ECCPDtmfStringSendingCompleted; + NotifyDTMFEvent(event, KErrNone, NULL); + } + else + { + gint error = iStatus.Int(); + if (error != KErrCancel) + { + TMSDTMFObserver::TCCPDtmfEvent event = + TMSDTMFObserver::ECCPDtmfStringSendingCompleted; + NotifyDTMFEvent(event, error, NULL); + TRACE_PRN_IF_ERR(error); + } + // Cancel is not notified + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// From CActive +// Canceling functionality. +// ----------------------------------------------------------------------------- +// +void TMSDTMFProvider::DoCancel() + { + TRACE_PRN_FN_ENT; + iPhone.CancelAsyncRequest(EMobilePhoneSendDTMFTones); + TRACE_PRN_FN_EXT; + } + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsdtmftoneplayer.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/src/tmsdtmftoneplayer.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +// INCLUDE FILES +#include "tmsutility.h" +#include "tmsdtmftoneplayer.h" + +// CONSTANTS +const gint KDTMFMaxBufSize = 64; +const gint KMaxVolumeLevel = 10; + +_LIT(KPhoneTone_Asterisk, "*+w"); + +//from voip +const guint KDTMFToneLengthOn = 250000; +const guint KDTMFToneLengthOff = 50000; +const guint KDTMFToneLengthPause = 2500000; + +using namespace TMS; + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::NewL +// Two-phased constructor. +// ----------------------------------------------------------------------------- +// +TMSAudioDtmfTonePlayer* TMSAudioDtmfTonePlayer::NewL( + TMSDTMFTonePlayerObserver& obsrvr, guint audioPreference, + guint audioPriority) + { + TMSAudioDtmfTonePlayer* self = new (ELeave) TMSAudioDtmfTonePlayer(obsrvr, + audioPreference, audioPriority); + + CleanupStack::PushL(self); + self->ConstructL(); + CleanupStack::Pop(self); + return self; + } + +//Destructor +TMSAudioDtmfTonePlayer::~TMSAudioDtmfTonePlayer() + { + TRACE_PRN_FN_ENT; + Cancel(); + delete iDTMFPlayer; + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::TMSAudioDtmfTonePlayer +// C++ default constructor can NOT contain any code, that +// might leave. +// ----------------------------------------------------------------------------- +// +TMSAudioDtmfTonePlayer::TMSAudioDtmfTonePlayer( + TMSDTMFTonePlayerObserver& obsrvr, guint audioPreference, + guint audioPriority) : + iObserver(obsrvr), + iPref(audioPreference), + iPrior(audioPriority) + { + TRACE_PRN_FN_ENT; + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::ConstructL +// Symbian 2nd phase constructor can leave. +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::ConstructL() + { + TRACE_PRN_FN_ENT; + + TMMFPrioritySettings dtmfClickPlayerPrioritySettings; + iDTMFPlayer = CMMFDevSound::NewL(); + iDTMFPlayer->InitializeL(*this, EMMFStateTonePlaying); + + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::SetVolume +// Sets the volume level that is used when the dtmf tone is played. +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::SetVolume(gint volume) + { + TRACE_PRN_FN_ENT; + gint vol = ConvertVolumeLevel(volume); + + if (vol != iVolume) + { + iVolume = vol; + iDTMFPlayer->SetVolume(iVolume); + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::PlayDtmfTone +// Searches the given DTMF tone from iToneArray and calls PlayCurrentTone +// member function. +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::PlayDtmfTone(TDes& tone) + { + TRACE_PRN_FN_ENT; + Cancel(); + + // DTMF signaling. + if (iDTMFPlayer) + { + TBuf key; + key.Append(tone); + TRAP_IGNORE(iDTMFPlayer->PlayDTMFStringL(tone)); + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::Cancel +// Cancels the currently playing tone. +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::Cancel() + { + TRACE_PRN_FN_ENT; + iDTMFPlayer->Stop(); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::Normalize +// Lowers case for chars and if its '*','+', or 'w' sets it to asterisk +// char ('*'). +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::Normalize(TChar& tone) + { + TRACE_PRN_FN_ENT; + tone.LowerCase(); + TPtrC ast(KPhoneTone_Asterisk); + + if (ast.Locate(tone) != KErrNotFound) + { + tone = ast[0]; + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::InitializeComplete +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::InitializeComplete(TInt aError) + { + TRACE_PRN_FN_ENT; + + if (aError == KErrNone) + { + TMMFPrioritySettings dtmfPlayerSettings; + dtmfPlayerSettings.iPref = iPref; + dtmfPlayerSettings.iPriority = iPrior; + dtmfPlayerSettings.iState = EMMFStateTonePlaying; + iDTMFPlayer->SetPrioritySettings(dtmfPlayerSettings); + + TTimeIntervalMicroSeconds32 length(KDTMFToneLengthOn); + TTimeIntervalMicroSeconds32 pause(KDTMFToneLengthOff); + TTimeIntervalMicroSeconds32 zero(KDTMFToneLengthPause); + iDTMFPlayer->SetDTMFLengths(length, pause, zero); + iDTMFPlayer->SetVolume(iDTMFPlayer->MaxVolume()); + } + + iObserver.DTMFInitCompleted(aError); + TRACE_PRN_IF_ERR(aError); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::ToneFinished +// ----------------------------------------------------------------------------- +// +void TMSAudioDtmfTonePlayer::ToneFinished(TInt aError) + { + TRACE_PRN_FN_ENT; + iObserver.DTMFToneFinished(aError); + TRACE_PRN_IF_ERR(aError); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSAudioDtmfTonePlayer::ConvertVolumeLevel +// ----------------------------------------------------------------------------- +// +gint TMSAudioDtmfTonePlayer::ConvertVolumeLevel(gint volume) + { + TRACE_PRN_FN_ENT; + gint result = iDTMFPlayer->MaxVolume() * volume / KMaxVolumeLevel; + TRACE_PRN_FN_EXT; + return result; + } + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmseteldtmfmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/src/tmseteldtmfmonitor.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#include +#include +#include "tmsdtmfprovider.h" +#include "tmsdtmfobserver.h" +#include "tmseteldtmfmonitor.h" +#include "tmsutility.h" + +using namespace TMS; + +// ----------------------------------------------------------------------------- +// TMSEtelDtmfMonitor::NewL. +// ----------------------------------------------------------------------------- +// +TMSEtelDtmfMonitor* TMSEtelDtmfMonitor::NewL(TMSDTMFProvider& aObserver, + RMmCustomAPI& aMmCustom) + { + TRACE_PRN_FN_ENT; + TMSEtelDtmfMonitor* self = new (ELeave) TMSEtelDtmfMonitor(aObserver, + aMmCustom); + TRACE_PRN_FN_EXT; + return self; + } + +// ----------------------------------------------------------------------------- +// Constructs the monitor. +// ----------------------------------------------------------------------------- +// +TMSEtelDtmfMonitor::TMSEtelDtmfMonitor(TMSDTMFProvider& aObserver, + RMmCustomAPI& aMmCustom) : + CActive(EPriorityStandard), + iObserver(aObserver), + iMmCustom(aMmCustom) + { + TRACE_PRN_FN_ENT; + CActiveScheduler::Add(this); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Destructs the object by canceling first ongoing monitoring. +// ----------------------------------------------------------------------------- +// +TMSEtelDtmfMonitor::~TMSEtelDtmfMonitor() + { + TRACE_PRN_FN_ENT; + Cancel(); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Starts the monitor. +// ----------------------------------------------------------------------------- +// +void TMSEtelDtmfMonitor::StartMonitoring() + { + TRACE_PRN_FN_ENT; + if (!IsActive()) + { + iStatus = KRequestPending; + iMmCustom.NotifyDtmfEvent(iStatus, iEventData); + SetActive(); + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// From CActive. +// Handles line status change notifying. +// ----------------------------------------------------------------------------- +// +void TMSEtelDtmfMonitor::RunL() + { + TRACE_PRN_FN_ENT; + gint err = iStatus.Int(); + TRACE_PRN_N1(_L("**TMS TMSEtelDtmfMonitor::RunL: status:%d"), err); + + if (err == KErrNone) + { + TMSDTMFObserver::TCCPDtmfEvent event; + if (iEventData.iEvent == RMmCustomAPI::EDtmfStart + && iEventData.iType == RMmCustomAPI::EDtmfManual) + { + event = TMSDTMFObserver::ECCPDtmfManualStart; + } + else if (iEventData.iEvent == RMmCustomAPI::EDtmfStart + && iEventData.iType == RMmCustomAPI::EDtmfSequence) + { + event = TMSDTMFObserver::ECCPDtmfSequenceStart; + } + else if (iEventData.iEvent == RMmCustomAPI::EDtmfStop + && iEventData.iType == RMmCustomAPI::EDtmfManual) + { + event = TMSDTMFObserver::ECCPDtmfManualStop; + } + else if (iEventData.iEvent == RMmCustomAPI::EDtmfStop + && iEventData.iType == RMmCustomAPI::EDtmfSequence) + { + event = TMSDTMFObserver::ECCPDtmfSequenceStop; + } + else if (iEventData.iEvent == RMmCustomAPI::EDtmfAbort + && iEventData.iType == RMmCustomAPI::EDtmfManual) + { + event = TMSDTMFObserver::ECCPDtmfManualAbort; + } + else if (iEventData.iEvent == RMmCustomAPI::EDtmfAbort + && iEventData.iType == RMmCustomAPI::EDtmfSequence) + { + event = TMSDTMFObserver::ECCPDtmfSequenceAbort; + } + else + { + // Refresh and return (no observer notfiying). + TRACE_PRN_N2(_L("**TMS TMSEtelDtmfMonitor::RunL: Unknown event \ + = %d, type = %d"), iEventData.iEvent,iEventData.iType); + StartMonitoring(); + return; + } + + iObserver.NotifyDTMFEvent(event, err, iEventData.iTone); + } + else + { + TRACE_PRN_N1(_L("**TMS TMSEtelDtmfMonitor::RunL: Error \ + from DTMF: %d"),err); + } + + // Continue if not in offline mode + if (err != KErrGsmOfflineOpNotAllowed && err != KErrCancel + && err != KErrNotSupported) + { + StartMonitoring(); + } + TRACE_PRN_IF_ERR(err); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// From CActive +// Canceling functionality. +// ----------------------------------------------------------------------------- +// +void TMSEtelDtmfMonitor::DoCancel() + { + TRACE_PRN_FN_ENT; + iMmCustom.CancelAsyncRequest(ECustomNotifyDtmfEventIPC); + TRACE_PRN_FN_EXT; + } + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmseteldtmfstopmonitor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mmserv/tms/tmsserver/src/tmseteldtmfstopmonitor.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * All rights reserved. + * This component and the accompanying materials are made available + * under the terms of "Eclipse Public License v1.0" + * which accompanies this distribution, and is available + * at the URL "http://www.eclipse.org/legal/epl-v10.html". + * + * Initial Contributors: + * Nokia Corporation - initial contribution. + * + * Contributors: + * + * Description: Telephony Multimedia Service + * + */ + +#include +#include "tmsutility.h" +#include "tmsdtmfobserver.h" +#include "tmsdtmfprovider.h" +#include "tmseteldtmfstopmonitor.h" + +using namespace TMS; + +// ----------------------------------------------------------------------------- +// TMSEtelDtmfStopMonitor::NewL. +// ----------------------------------------------------------------------------- +// +TMSEtelDtmfStopMonitor* TMSEtelDtmfStopMonitor::NewL(TMSDTMFProvider& aObserver, + RMobilePhone& aPhone) + { + TRACE_PRN_FN_EXT; + TMSEtelDtmfStopMonitor* self = new (ELeave) TMSEtelDtmfStopMonitor( + aObserver, aPhone); + TRACE_PRN_FN_EXT; + return self; + } + +// ----------------------------------------------------------------------------- +// Constructs the monitor. +// ----------------------------------------------------------------------------- +// +TMSEtelDtmfStopMonitor::TMSEtelDtmfStopMonitor(TMSDTMFProvider& aObserver, + RMobilePhone& aPhone) : + CActive(EPriorityStandard), + iObserver(aObserver), + iPhone(aPhone) + { + TRACE_PRN_FN_ENT; + CActiveScheduler::Add(this); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Destructs the object by canceling first ongoing monitoring. +// ----------------------------------------------------------------------------- +// +TMSEtelDtmfStopMonitor::~TMSEtelDtmfStopMonitor() + { + TRACE_PRN_FN_ENT; + Cancel(); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// Starts the monitor. +// ----------------------------------------------------------------------------- +// +void TMSEtelDtmfStopMonitor::StartMonitoring() + { + TRACE_PRN_FN_ENT; + if (!IsActive()) + { + iStatus = KRequestPending; + iPhone.NotifyStopInDTMFString(iStatus); + SetActive(); + } + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// From CActive. +// Handles line status change notifying. +// ----------------------------------------------------------------------------- +// +void TMSEtelDtmfStopMonitor::RunL() + { + TRACE_PRN_FN_ENT; + gint err = iStatus.Int(); + TRACE_PRN_N1(_L("**TMS TMSEtelDtmfStopMonitor::RunL: status: %d"), err); + + if (err != KErrCancel && err != KErrServerTerminated) + { + TChar tone = NULL; + TMSDTMFObserver::TCCPDtmfEvent event = + TMSDTMFObserver::ECCPDtmfStopInDtmfString; + iObserver.NotifyDTMFEvent(event, err, tone); + } + else + { + TRACE_PRN_N1(_L("**TMS TMSEtelDtmfStopMonitor::RunL: Error \ + from RMobilePhone: %d"),iStatus.Int()); + } + + // Continue if not in offline mode + if (err != KErrGsmOfflineOpNotAllowed && err != KErrCancel + && err != KErrNotSupported) + { + StartMonitoring(); + } + TRACE_PRN_IF_ERR(err); + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// From CActive +// Canceling functionality. +// ----------------------------------------------------------------------------- +// +void TMSEtelDtmfStopMonitor::DoCancel() + { + TRACE_PRN_FN_ENT; + iPhone.CancelAsyncRequest(EMobilePhoneNotifyStopInDTMFString); + TRACE_PRN_FN_EXT; + } + diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsglobaleffectssettings.cpp --- a/mmserv/tms/tmsserver/src/tmsglobaleffectssettings.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsglobaleffectssettings.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -26,7 +26,7 @@ const TInt KDefaultMaxVolume = 10; const TInt KDefaultGain = 1; -#ifndef __WINS__ +#ifndef __WINSCW__ const TInt KDefaultMaxGain = 1; #else const TInt KDefaultMaxGain = 64; @@ -176,4 +176,3 @@ return iMaxGain; } -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsrtaudiohdlr.cpp --- a/mmserv/tms/tmsserver/src/tmsrtaudiohdlr.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsrtaudiohdlr.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -392,9 +392,8 @@ void TMSRtAudioHdlr::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds& /*aDuration*/) { - TRACE_PRN_N2( - _L("TMS->TMSRtAudioHdlr::MapcInitComplete: player[%d], err[%d]"), - iRtType, aError); + TRACE_PRN_FN_ENT; + TRACE_PRN_N2(_L("RT player type[%d], err[%d]"), iRtType, aError); __ASSERT_DEBUG((iFormat == EFormatSample) || ((iFormat == EFormatTts) && (iPlayerStatus == EToneLoading)), @@ -414,6 +413,7 @@ } } iObserver.RtAudioHdlrEvent(ECmdRingToneOpenComplete, aError, iRtType); + TRACE_PRN_FN_EXT; } // ----------------------------------------------------------------------------- @@ -422,9 +422,8 @@ // void TMSRtAudioHdlr::MapcPlayComplete(TInt aError) { - TRACE_PRN_N2( - _L("TMS->TMSRtAudioHdlr::MapcPlayComplete: player[%d], err[%d]"), - iRtType, aError); + TRACE_PRN_FN_ENT; + TRACE_PRN_N2(_L("RT player type[%d], err[%d]"), iRtType, aError); iPlayerStatus = EToneReady; @@ -437,6 +436,7 @@ i3DPlugin = NULL; }*/ iObserver.RtAudioHdlrEvent(ECmdRingTonePlayComplete, aError, iRtType); + TRACE_PRN_FN_EXT; } // ----------------------------------------------------------------------------- @@ -445,9 +445,8 @@ // void TMSRtAudioHdlr::MatoPrepareComplete(TInt aError) { - TRACE_PRN_N2( - _L("TMS->TMSRtAudioHdlr::MatoPrepareComplete: player[%d], err[%d]"), - iRtType, aError); + TRACE_PRN_FN_ENT; + TRACE_PRN_N2(_L("RT player type[%d], err[%d]"), iRtType, aError); __ASSERT_DEBUG(((iFormat == EFormatTone) && (iPlayerStatus == EToneLoading)), PANIC(TMS_RESULT_INVALID_STATE)); @@ -466,6 +465,7 @@ } } iObserver.RtAudioHdlrEvent(ECmdRingToneOpenComplete, aError, iRtType); + TRACE_PRN_FN_ENT; } // ----------------------------------------------------------------------------- @@ -474,12 +474,11 @@ // void TMSRtAudioHdlr::MatoPlayComplete(TInt aError) { - TRACE_PRN_N2( - _L("TMS->TMSRtAudioHdlr::MatoPlayComplete: player[%d], err[%d]"), - iRtType, aError); - + TRACE_PRN_FN_ENT; + TRACE_PRN_N2(_L("RT player type[%d], err[%d]"), iRtType, aError); iObserver.RtAudioHdlrEvent(ECmdRingTonePlayComplete, aError, iRtType); - } + TRACE_PRN_FN_EXT; + } // ----------------------------------------------------------------------------- // TMSRtAudioHdlr::DoPlay @@ -505,7 +504,7 @@ } else { -#ifdef __WINS__ +#ifdef __WINSCW__ iSamplePlayer->Play(); #else /* @@ -529,7 +528,7 @@ } }*/ iSamplePlayer->Play(); -#endif //__WINS__ +#endif //__WINSCW__ } TRACE_PRN_FN_EXT; @@ -830,4 +829,3 @@ } } -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsrtplayer.cpp --- a/mmserv/tms/tmsserver/src/tmsrtplayer.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsrtplayer.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -48,7 +48,7 @@ _LIT(KTMSTtsHeader, "(tts)"); -#ifdef __WINS__ +#ifdef __WINSCW__ //_LIT(KTMSDefaultSoundFile, "z:\\data\\sounds\\digital\\Nokia_tune.aac"); _LIT(KTMSDefaultSoundFile, "Z:\\Data\\Sounds\\Digital\\Nokia tune.aac"); //_LIT(KTMSDefaultSoundFile, "c:\\data\\sounds\\digital\\test_8khz.wav"); @@ -67,7 +67,7 @@ \x40\x64\x06\x0B"); _LIT8(KTMSUnsecureVoIPCall, "\x00\x11\x0B\x67\x04\x40\x04\x67\x04\x40\x04\ \x6C\x04\x40\x04\x6D\x04\x0B"); -#endif // __WINS__ +#endif // __WINSCW__ // ----------------------------------------------------------------------------- // TMSRingTonePlayer::NewL @@ -371,7 +371,7 @@ delete iBeepOncePlayer; iBeepOncePlayer = NULL; -#ifdef __WINS__ +#ifdef __WINSCW__ TParse* fp = new (ELeave) TParse(); fp->Set(KTMSBeepSequence, NULL, NULL); TFileName fileName(fp->FullName()); @@ -381,7 +381,7 @@ #else iBeepOncePlayer = TMSRtAudioHdlr::NewSeqL(KTMSBeepSequence(), iRtParam.iPriority, iRtParam.iPreference, *this, EPlayerBeepOnce); -#endif // __WINS__ +#endif // __WINSCW__ iRtParam.iType = EPlayerBeepOnce; TRACE_PRN_FN_EXT; @@ -399,7 +399,7 @@ delete iSilentPlayer; iSilentPlayer = NULL; -#ifdef __WINS__ +#ifdef __WINSCW__ TParse* fp = new (ELeave) TParse(); fp->Set(KTMSNoSoundSequence, NULL, NULL); TFileName fileName(fp->FullName()); @@ -409,7 +409,7 @@ #else iSilentPlayer = TMSRtAudioHdlr::NewSeqL(KTMSNoSoundSequence(), iRtParam.iPriority, iRtParam.iPreference, *this, EPlayerSilent); -#endif // __WINS__ +#endif // __WINSCW__ iRtParam.iType = EPlayerSilent; TRACE_PRN_FN_EXT; @@ -426,7 +426,7 @@ delete iUnsecureVoIPTonePlayer; iUnsecureVoIPTonePlayer = NULL; -#ifdef __WINS__ +#ifdef __WINSCW__ TParse* fp = new (ELeave) TParse(); fp->Set(KTMSUnsecureVoIPCall, NULL, NULL); TFileName fileName(fp->FullName()); @@ -438,7 +438,7 @@ iUnsecureVoIPTonePlayer = TMSRtAudioHdlr::NewSeqL(KTMSUnsecureVoIPCall(), iRtParam.iPriority, iRtParam.iPreference, *this, EPlayerUnsecureVoIP); -#endif // __WINS__ +#endif // __WINSCW__ iRtParam.iType = EPlayerUnsecureVoIP; TRACE_PRN_FN_EXT; @@ -449,7 +449,7 @@ // ----------------------------------------------------------------------------- // void TMSRingTonePlayer::CreateCustomSequencePlayerL(const TDesC8& -#ifdef __WINS__ +#ifdef __WINSCW__ /*aSequence*/) #else aSequence) @@ -460,7 +460,7 @@ delete iSequencePlayer; iSequencePlayer = NULL; -#ifdef __WINS__ +#ifdef __WINSCW__ TParse* fp = new (ELeave) TParse(); fp->Set(KTMSBeepSequence, NULL, NULL); TFileName fileName(fp->FullName()); @@ -470,7 +470,7 @@ #else iSequencePlayer = TMSRtAudioHdlr::NewSeqL(aSequence, iRtParam.iPriority, iRtParam.iPreference, *this, EPlayerSequence); -#endif // __WINS__ +#endif // __WINSCW__ iRtParam.iType = EPlayerSequence; TRACE_PRN_FN_EXT; @@ -1378,12 +1378,12 @@ iAudioPlayer = NULL; } -#ifdef __WINS__ +#ifdef __WINSCW__ TRAP_IGNORE(PlayAudioRingToneL()); iTonePlayingStatus = EDefaultTonePlaying; #else TRAP_IGNORE(PlayDefaultToneL()); -#endif +#endif //__WINSCW__ break; } case EDefaultTonePlaying: @@ -1710,4 +1710,3 @@ return audioHdlr; } -// End of File diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsserver.cpp --- a/mmserv/tms/tmsserver/src/tmsserver.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsserver.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -30,6 +30,9 @@ #include "tmsglobaleffectssettings.h" #include "tmstareventhandler.h" #include "tmscenrepaudiohandler.h" +#include "tmsdtmftoneplayer.h" +#include "tmsdtmfprovider.h" +#include "tmsdtmfnotifier.h" #include "tmsdtmfeventhandler.h" #include "tmsrtparam.h" #include "tmsserver.h" @@ -86,6 +89,10 @@ delete iDTMFHandler; DeinitRingTonePlayer(); delete iTMSRtPlayer; + delete iDTMFUplinkPlayer; + delete iDTMFUplinkPlayerEtel; + delete iDTMFDnlinkPlayer; + delete iDTMFNotifier; TRACE_PRN_FN_EXT; } @@ -136,6 +143,10 @@ iAudioCenRepHandler = NULL; iDTMFHandler = NULL; iCurrentRouting = TMS_AUDIO_OUTPUT_PRIVATE; + iDTMFDnlinkPlayer = NULL; + iDTMFUplinkPlayer = NULL; + iDTMFUplinkPlayerEtel = NULL; + iDTMFNotifier = NULL; //TODO: EUnit fails to initialize ProfileEngine in RT in eshell mode TRAP_IGNORE(InitRingTonePlayerL()); @@ -190,46 +201,6 @@ } // ----------------------------------------------------------------------------- -// TMSServer::SetDnLinkSession -// -// ----------------------------------------------------------------------------- -// -void TMSServer::SetDnLinkSession(const TBool aSession) - { - iDnlinkSession = aSession; - } - -// ----------------------------------------------------------------------------- -// TMSServer::SetUpLinkSession -// -// ----------------------------------------------------------------------------- -// -void TMSServer::SetUpLinkSession(const TBool aSession) - { - iUplinkSession = aSession; - } - -// ----------------------------------------------------------------------------- -// TMSServer::HasDnLinkSession -// -// ----------------------------------------------------------------------------- -// -TBool TMSServer::HasDnLinkSession() const - { - return iDnlinkSession; - } - -// ----------------------------------------------------------------------------- -// TMSServer::HasUpLinkSession -// -// ----------------------------------------------------------------------------- -// -TBool TMSServer::HasUpLinkSession() const - { - return iUplinkSession; - } - -// ----------------------------------------------------------------------------- // TMSServer::GetNewTMSCallSessionHandleL // // ----------------------------------------------------------------------------- @@ -272,7 +243,7 @@ TInt status = TMS_RESULT_SUCCESS; TMSStartAndMonitorTMSCallThread* callServerThread = NULL; - TRAP(status, callServerThread =TMSStartAndMonitorTMSCallThread::NewL( + TRAP(status, callServerThread = TMSStartAndMonitorTMSCallThread::NewL( const_cast(this))); if (status != TMS_RESULT_SUCCESS) { @@ -668,16 +639,12 @@ } iSessionIter.SetToFirst(); - TMSServerSession* serverSession = - static_cast (iSessionIter++); - - while (serverSession != NULL) + TMSServerSession* ss = static_cast (iSessionIter++); + while (ss != NULL) { - serverSession->HandleGlobalEffectChange( - TMS_EVENT_EFFECT_VOL_CHANGED, level, EFalse, - iCurrentRouting); - - serverSession = static_cast (iSessionIter++); + ss->HandleGlobalEffectChange(TMS_EVENT_EFFECT_VOL_CHANGED, level, + EFalse, iCurrentRouting); + ss = static_cast (iSessionIter++); } } @@ -744,15 +711,11 @@ iAudioCenRepHandler->SetMuteState(level); iEffectSettings->SetGain(level); iSessionIter.SetToFirst(); - - TMSServerSession* serverSession = - static_cast (iSessionIter++); - - while (serverSession != NULL) + TMSServerSession* ss = static_cast (iSessionIter++); + while (ss != NULL) { - serverSession->HandleGlobalEffectChange( - TMS_EVENT_EFFECT_GAIN_CHANGED, level); - serverSession = static_cast (iSessionIter++); + ss->HandleGlobalEffectChange(TMS_EVENT_EFFECT_GAIN_CHANGED, level); + ss = static_cast (iSessionIter++); } } @@ -885,18 +848,17 @@ TInt status = SendMessageToCallServ(TMS_EFFECT_GLOBAL_VOL_SET, vol); iSessionIter.SetToFirst(); - TMSServerSession* serverSession = - static_cast (iSessionIter++); - while (serverSession != NULL) + TMSServerSession* ss = static_cast (iSessionIter++); + while (ss != NULL) { // Send only if there is a subscriber to TMS routing notifications. if (iTarHandlerCount > 1) { - serverSession->HandleRoutingChange(routingpckg); + ss->HandleRoutingChange(routingpckg); } - serverSession->HandleGlobalEffectChange(TMS_EVENT_EFFECT_VOL_CHANGED, - vol, ETrue, iCurrentRouting); - serverSession = static_cast (iSessionIter++); + ss->HandleGlobalEffectChange(TMS_EVENT_EFFECT_VOL_CHANGED, vol, ETrue, + iCurrentRouting); + ss = static_cast (iSessionIter++); } TRACE_PRN_FN_EXT; @@ -904,6 +866,57 @@ } // ----------------------------------------------------------------------------- +// TMSServer::InitDTMF +// +// ----------------------------------------------------------------------------- +// +TInt TMSServer::InitDTMF(const RMessage2& aMessage) + { + TRACE_PRN_FN_ENT; + TInt status(TMS_RESULT_SUCCESS); + TMSStreamType strmtype; + strmtype = (TMSStreamType) aMessage.Int0(); + + if (strmtype == TMS_STREAM_UPLINK) + { + if (!iDTMFUplinkPlayerEtel) //CS call + { + // Uses ETel for uplink + TRAP(status, iDTMFUplinkPlayerEtel = TMSDTMFProvider::NewL()); + if (iDTMFUplinkPlayerEtel && status == TMS_RESULT_SUCCESS) + { + iDTMFUplinkPlayerEtel->AddObserver(*this); + } + } + if (!iDTMFUplinkPlayer) //IP call + { + TRAP(status, iDTMFUplinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this, +// KAudioPrefVoipAudioUplinkNonSignal, +// KAudioPrefVoipAudioUplink, +// KAudioPrefUnknownVoipAudioUplink +// KAudioPriorityDTMFString)); + KAudioDTMFString, KAudioPriorityDTMFString)); + } + } + else if (strmtype == TMS_STREAM_DOWNLINK) + { + if (!iDTMFDnlinkPlayer) //CS or IP call + { + TRAP(status, iDTMFDnlinkPlayer = TMSAudioDtmfTonePlayer::NewL(*this, + KAudioDTMFString, KAudioPriorityDTMFString)); + } + } + if (!iDTMFNotifier && status == TMS_RESULT_SUCCESS) + { + TRAP(status, iDTMFNotifier = TMSDtmfNotifier::NewL()); + } + + aMessage.Complete(status); + TRACE_PRN_FN_EXT; + return status; + } + +// ----------------------------------------------------------------------------- // TMSServer::StartDTMF // // ----------------------------------------------------------------------------- @@ -915,31 +928,71 @@ TInt status(TMS_RESULT_SUCCESS); TInt len(0); TMSStreamType strmtype; - strmtype = (TMSStreamType) aMessage.Int0(); len = aMessage.GetDesLength(1); - HBufC* tone(NULL); if (len > 0) { - delete tone; - tone = NULL; - TRAP(status,tone = HBufC::NewL(len)); + HBufC* tone(NULL); + TRAP(status, tone = HBufC::NewL(len)); if (status == TMS_RESULT_SUCCESS) { TPtr ptr = tone->Des(); status = aMessage.Read(1, ptr); TRACE_PRN_N(ptr); + TmsMsgBufPckg dtmfpckg; + dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; - TIpcArgs args; - args.Set(0, strmtype); - args.Set(1, &ptr); - status = SendMessageToCallServ(TMS_DTMF_START, args); - delete tone; - tone = NULL; + if (strmtype == TMS_STREAM_UPLINK) + { +//#ifdef __WINSCW__ + // Just to test playback in wins +// iActiveCallType = TMS_CALL_IP; +//#else + FindActiveCallType(); +//#endif + if (iActiveCallType == TMS_CALL_IP && iDTMFUplinkPlayer) + { + iDTMFUplinkPlayer->PlayDtmfTone(ptr); + status = TMS_RESULT_SUCCESS; + dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted; + } + else if (iActiveCallType == TMS_CALL_CS && + iDTMFUplinkPlayerEtel) + { + status = iDTMFUplinkPlayerEtel->SendDtmfToneString(ptr); + dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted; + } + else + { + status = TMS_RESULT_INVALID_STATE; + } + } + else if (strmtype == TMS_STREAM_DOWNLINK) + { + //status = TMS_RESULT_UNINITIALIZED_OBJECT; + if (iDTMFDnlinkPlayer) + { + iDTMFDnlinkPlayer->PlayDtmfTone(ptr); + status = TMS_RESULT_SUCCESS; + dtmfpckg().iRequest = ECmdDTMFToneDnlPlayStarted; + } + } + else + { + status = TMS_RESULT_STREAM_TYPE_NOT_SUPPORTED; + } + + if (iDTMFNotifier) + { + dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status); + iDTMFNotifier->SetDtmf(dtmfpckg); + } } + delete tone; + tone = NULL; } + aMessage.Complete(status); - TRACE_PRN_FN_EXT; return status; } @@ -953,12 +1006,41 @@ { TRACE_PRN_FN_ENT; - TInt status(TMS_RESULT_SUCCESS); + TInt status(TMS_RESULT_INVALID_STATE); TMSStreamType streamtype; streamtype = (TMSStreamType) aMessage.Int0(); - status = SendMessageToCallServ(TMS_DTMF_STOP, streamtype); + + if (streamtype == TMS_STREAM_UPLINK) + { + if (iActiveCallType == TMS_CALL_IP && iDTMFUplinkPlayer) + { + iDTMFUplinkPlayer->Cancel(); + status = TMS_RESULT_SUCCESS; + } + else if (iActiveCallType == TMS_CALL_CS && + iDTMFUplinkPlayerEtel) + { + status = iDTMFUplinkPlayerEtel->StopDtmfTone(); + status = TMSUtility::EtelToTMSResult(status); + } + } + else if (streamtype == TMS_STREAM_DOWNLINK) + { + if (iDTMFDnlinkPlayer) + { + iDTMFDnlinkPlayer->Cancel(); + status = TMS_RESULT_SUCCESS; + } + } + if (iDTMFNotifier) + { + TmsMsgBufPckg dtmfpckg; + dtmfpckg().iStatus = status; + dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; + iDTMFNotifier->SetDtmf(dtmfpckg); + } + aMessage.Complete(status); - TRACE_PRN_FN_EXT; return status; } @@ -972,12 +1054,16 @@ { TRACE_PRN_FN_ENT; - TInt status(TMS_RESULT_SUCCESS); - TBool continuesending; - continuesending = (TBool) aMessage.Int0(); - status = SendMessageToCallServ(TMS_DTMF_CONTINUE, continuesending); + TInt status(TMS_RESULT_INVALID_STATE); + TBool continuesnd; + continuesnd = (TBool) aMessage.Int0(); + if (iActiveCallType == TMS_CALL_CS && iDTMFUplinkPlayerEtel) + { + status = iDTMFUplinkPlayerEtel->ContinueDtmfStringSending(continuesnd); + status = TMSUtility::EtelToTMSResult(status); + } + aMessage.Complete(status); - TRACE_PRN_FN_EXT; return status; } @@ -990,19 +1076,123 @@ TInt TMSServer::NotifyDtmfClients(TmsMsgBufPckg dtmfpckg) { TRACE_PRN_FN_ENT; + iSessionIter.SetToFirst(); + TMSServerSession* ss = static_cast (iSessionIter++); + while (ss != NULL) + { + ss->NotifyClient(dtmfpckg().iRequest, dtmfpckg().iStatus); + ss = static_cast (iSessionIter++); + } + TRACE_PRN_FN_EXT; + return TMS_RESULT_SUCCESS; + } - iSessionIter.SetToFirst(); - TMSServerSession* serverSession = - static_cast (iSessionIter++); +//From DTMFTonePlayerObserver +// ----------------------------------------------------------------------------- +// TMSServer::DTMFInitCompleted +// +// ----------------------------------------------------------------------------- +// +void TMSServer::DTMFInitCompleted(gint /*status*/) + { + TRACE_PRN_FN_ENT; + // TODO: process error + TRACE_PRN_FN_EXT; + } + +// ----------------------------------------------------------------------------- +// TMSServer::DTMFToneFinished +// +// ----------------------------------------------------------------------------- +// +void TMSServer::DTMFToneFinished(gint status) + { + TRACE_PRN_FN_ENT; + TRACE_PRN_IF_ERR(status); + TmsMsgBufPckg dtmfpckg; + + // KErrUnderflow indicates end of DTMF playback. + if (status == KErrUnderflow /*|| status == KErrInUse*/) + { + status = TMS_RESULT_SUCCESS; + } + dtmfpckg().iStatus = TMSRESULT(status); + dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; + if (iDTMFNotifier) + { + iDTMFNotifier->SetDtmf(dtmfpckg); + } + TRACE_PRN_FN_EXT; + } - while (serverSession != NULL) +// ----------------------------------------------------------------------------- +// TMSServer::FindActiveCallType +// +// ----------------------------------------------------------------------------- +// +gint TMSServer::FindActiveCallType() + { + TInt status(TMS_RESULT_INVALID_STATE); + iActiveCallType = -1; + TInt i = 0; + while (i < iTMSCallServList.Count()) { - serverSession->NotifyClient(dtmfpckg().iRequest, dtmfpckg().iStatus); - serverSession = static_cast (iSessionIter++); + TMSStartAndMonitorTMSCallThread* callThread = iTMSCallServList[i]; + if (callThread) + { + TmsCallMsgBufPckg pckg; + TIpcArgs args(&pckg); + status = callThread->iTMSCallProxyLocal.ReceiveFromCallServer( + TMS_GET_ACTIVE_CALL_PARAMS, args); + if (pckg().iBool || status != TMS_RESULT_SUCCESS) + { + iActiveCallType = static_cast (pckg().iInt); + break; + } + } + i++; + } + return status; + } + +// ----------------------------------------------------------------------------- +// TMSServer::HandleDTMFEvent +// +// ----------------------------------------------------------------------------- +// +void TMSServer::HandleDTMFEvent(const TMSDTMFObserver::TCCPDtmfEvent event, + const gint status, const TChar /*tone*/) + { + TRACE_PRN_FN_ENT; + TRACE_PRN_IF_ERR(status); + TmsMsgBufPckg dtmfpckg; + dtmfpckg().iStatus = TMSUtility::EtelToTMSResult(status); + + switch (event) + { + case ECCPDtmfUnknown: //Unknown + break; + case ECCPDtmfManualStart: //DTMF sending started manually + case ECCPDtmfSequenceStart: //Automatic DTMF sending initialized + dtmfpckg().iRequest = ECmdDTMFToneUplPlayStarted; + break; + case ECCPDtmfManualStop: //DTMF sending stopped manually + case ECCPDtmfManualAbort: //DTMF sending aborted manually + case ECCPDtmfSequenceStop: //Automatic DTMF sending stopped + case ECCPDtmfSequenceAbort: //Automatic DTMF sending aborted + case ECCPDtmfStopInDtmfString: //There was stop mark in DTMF string + case ECCPDtmfStringSendingCompleted://DTMF sending success + dtmfpckg().iRequest = ECmdDTMFTonePlayFinished; + break; + default: + break; } + if (iDTMFNotifier) + { + iDTMFNotifier->SetDtmf(dtmfpckg); + } TRACE_PRN_FN_EXT; - return TMS_RESULT_SUCCESS; } // ----------------------------------------------------------------------------- @@ -1575,4 +1765,3 @@ return r; } -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmsserversession.cpp --- a/mmserv/tms/tmsserver/src/tmsserversession.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmsserversession.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -239,6 +239,9 @@ iServer.CancelDTMFNotifier(); aMessage.Complete(TMS_RESULT_SUCCESS); break; + case ETMSInitDTMF: + iServer.InitDTMF(aMessage); + break; case ETMSStartDTMF: iServer.StartDTMF(aMessage); break; @@ -522,4 +525,3 @@ } } -// End of file diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsserver/src/tmstareventhandler.cpp --- a/mmserv/tms/tmsserver/src/tmstareventhandler.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsserver/src/tmstareventhandler.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -108,5 +108,12 @@ TRACE_PRN_FN_EXT; } -// End of File +// ----------------------------------------------------------------------------- +// TMSTarEventHandler::RunError +// ----------------------------------------------------------------------------- +// +TInt TMSTarEventHandler::RunError(TInt aError) + { + return aError; + } diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsutility/bwins/tmsutility.def --- a/mmserv/tms/tmsutility/bwins/tmsutility.def Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsutility/bwins/tmsutility.def Fri Jul 09 16:43:35 2010 -0500 @@ -8,7 +8,8 @@ ?FourCCToTMSFormat@TMSUtility@TMS@@SAHK@Z @ 7 NONAME ; int TMS::TMSUtility::FourCCToTMSFormat(unsigned long) ?NotifyAfter@TMSTimer@TMS@@QAEXHAAVTMSTimerObserver@2@@Z @ 8 NONAME ; void TMS::TMSTimer::NotifyAfter(int, class TMS::TMSTimerObserver &) ?ToTAROutput@TMSUtility@TMS@@SA?AW4TAudioOutput@CTelephonyAudioRouting@@H@Z @ 9 NONAME ; enum CTelephonyAudioRouting::TAudioOutput TMS::TMSUtility::ToTAROutput(int) - ?ToFourCC@TMSUtility@TMS@@SAKH@Z @ 10 NONAME ; unsigned long TMS::TMSUtility::ToFourCC(int) - ??1TMSTimer@TMS@@UAE@XZ @ 11 NONAME ; TMS::TMSTimer::~TMSTimer(void) - ?NotifyAfter@TMSTimer@TMS@@QAEXHVTCallBack@@@Z @ 12 NONAME ; void TMS::TMSTimer::NotifyAfter(int, class TCallBack) + ?SymbianResult@TMSUtility@TMS@@SAHH@Z @ 10 NONAME ; int TMS::TMSUtility::SymbianResult(int) + ?ToFourCC@TMSUtility@TMS@@SAKH@Z @ 11 NONAME ; unsigned long TMS::TMSUtility::ToFourCC(int) + ??1TMSTimer@TMS@@UAE@XZ @ 12 NONAME ; TMS::TMSTimer::~TMSTimer(void) + ?NotifyAfter@TMSTimer@TMS@@QAEXHVTCallBack@@@Z @ 13 NONAME ; void TMS::TMSTimer::NotifyAfter(int, class TCallBack) diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsutility/eabi/tmsutility.def --- a/mmserv/tms/tmsutility/eabi/tmsutility.def Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsutility/eabi/tmsutility.def Fri Jul 09 16:43:35 2010 -0500 @@ -1,18 +1,19 @@ EXPORTS _ZN3TMS10TMSUtility11ToTAROutputEi @ 1 NONAME _ZN3TMS10TMSUtility11ToTMSOutputEN22CTelephonyAudioRouting12TAudioOutputE @ 2 NONAME - _ZN3TMS10TMSUtility15EtelToTMSResultEi @ 3 NONAME - _ZN3TMS10TMSUtility17FourCCToTMSFormatEm @ 4 NONAME - _ZN3TMS10TMSUtility8ToFourCCEi @ 5 NONAME - _ZN3TMS10TMSUtility9TMSResultEi @ 6 NONAME - _ZN3TMS8TMSTimer11NotifyAfterEi9TCallBack @ 7 NONAME - _ZN3TMS8TMSTimer11NotifyAfterEiRNS_16TMSTimerObserverE @ 8 NONAME - _ZN3TMS8TMSTimer12CancelNotifyEv @ 9 NONAME - _ZN3TMS8TMSTimer4NewLEi @ 10 NONAME - _ZN3TMS8TMSTimer9IsRunningEv @ 11 NONAME - _ZN3TMS8TMSTimerD0Ev @ 12 NONAME - _ZN3TMS8TMSTimerD1Ev @ 13 NONAME - _ZN3TMS8TMSTimerD2Ev @ 14 NONAME - _ZTIN3TMS8TMSTimerE @ 15 NONAME - _ZTVN3TMS8TMSTimerE @ 16 NONAME + _ZN3TMS10TMSUtility13SymbianResultEi @ 3 NONAME + _ZN3TMS10TMSUtility15EtelToTMSResultEi @ 4 NONAME + _ZN3TMS10TMSUtility17FourCCToTMSFormatEm @ 5 NONAME + _ZN3TMS10TMSUtility8ToFourCCEi @ 6 NONAME + _ZN3TMS10TMSUtility9TMSResultEi @ 7 NONAME + _ZN3TMS8TMSTimer11NotifyAfterEi9TCallBack @ 8 NONAME + _ZN3TMS8TMSTimer11NotifyAfterEiRNS_16TMSTimerObserverE @ 9 NONAME + _ZN3TMS8TMSTimer12CancelNotifyEv @ 10 NONAME + _ZN3TMS8TMSTimer4NewLEi @ 11 NONAME + _ZN3TMS8TMSTimer9IsRunningEv @ 12 NONAME + _ZN3TMS8TMSTimerD0Ev @ 13 NONAME + _ZN3TMS8TMSTimerD1Ev @ 14 NONAME + _ZN3TMS8TMSTimerD2Ev @ 15 NONAME + _ZTIN3TMS8TMSTimerE @ 16 NONAME + _ZTVN3TMS8TMSTimerE @ 17 NONAME diff -r ebf79c79991a -r 5e8b14bae8c3 mmserv/tms/tmsutility/src/tmsutility.cpp --- a/mmserv/tms/tmsutility/src/tmsutility.cpp Fri Jun 25 17:36:03 2010 -0500 +++ b/mmserv/tms/tmsutility/src/tmsutility.cpp Fri Jul 09 16:43:35 2010 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). + * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" @@ -120,6 +120,52 @@ } // ----------------------------------------------------------------------------- +// TMSUtility::SymbianResult +// +// ----------------------------------------------------------------------------- +// +EXPORT_C TInt TMSUtility::SymbianResult(const gint aError) + { + TInt result(KErrNone); + + if (aError <= TMS_RESULT_SUCCESS) + { + return aError; //return Symbian error + } + + switch (aError) + { + case TMS_RESULT_DOES_NOT_EXIST: + result = KErrNotFound; + break; + case TMS_RESULT_OPERATION_CANCELLED: + result = KErrCancel; + break; + case TMS_RESULT_INSUFFICIENT_MEMORY: + result = KErrNoMemory; + break; + case TMS_RESULT_ILLEGAL_OPERATION: + result = KErrNotSupported; + break; + case TMS_RESULT_INVALID_ARGUMENT: + result = KErrArgument; + break; + case TMS_RESULT_BUFFER_LATENCY_ERROR: + result = KErrUnderflow; + break; + case TMS_RESULT_ALREADY_EXIST: + result = KErrAlreadyExists; + break; + case TMS_RESULT_FATAL_ERROR: + case TMS_RESULT_GENERAL_ERROR: + default: + result = KErrGeneral; + break; + } + return result; + } + +// ----------------------------------------------------------------------------- // TMSUtility::EtelToTMSResult // // -----------------------------------------------------------------------------