src/FMedia_Mp3Decoder.cpp
src/FMedia_AmrDecoder.cpp
src/FMedia_VorbisDecoder.cpp
- src/FMedia_AlawDecoder.cpp
- src/FMedia_UlawDecoder.cpp
+ src/FMedia_G711Decoder.cpp
src/FMedia_AmrEncoder.cpp
src/FMedia_AudioDecoderImpl.cpp
src/FMedia_AudioEncoderImpl.cpp
src/FMedia_CameraUtil.cpp
src/FMedia_CameraManager.cpp
src/FMedia_CameraCapabilitySession.cpp
- src/FMedia_CameraPreProcessUtil.cpp
src/FMedia_CameraBuffer.cpp
src/FMediaAudioRecorder.cpp
src/FMedia_AudioRecorderImpl.cpp
src/FMedia_AudioRouteManagerImpl.cpp
src/FMedia_AudioRouteEvent.cpp
src/FMedia_AudioRouteEventArg.cpp
- src/FMediaVoipAudioSessionManager.cpp
- src/FMedia_VoipAudioSessionManagerImpl.cpp
- src/FMediaAudioSessionManager.cpp
- src/FMedia_AudioSessionManagerImpl.cpp
- src/FMedia_AudioSessionEvent.cpp
- src/FMedia_AudioSessionEventArg.cpp
src/FMedia_AudioManagerConvert.cpp
src/FMediaAudioEqualizer.cpp
src/FMedia_AudioEqualizerImpl.cpp
src/FMediaVideoFrameExtractor.cpp
src/FMedia_VideoFrameExtractorImpl.cpp
+ src/FMediaAudioFrame.cpp
+ src/FMedia_AudioFrameImpl.cpp
+ src/FMedia_AudioStreamCoordinator.cpp
+ src/FMediaVideoFrame.cpp
+ src/FMedia_VideoFrameImpl.cpp
+ src/FMedia_VideoStreamCoordinator.cpp
)
## Definitions
#define _FMEDIA_H_
// Include
-#include "FMediaAudioDecoder.h"
+#include <FMediaAudioDecoder.h>
-#include "FMediaAudioEncoder.h"
+#include <FMediaAudioEncoder.h>
-#include "FMediaAudioEqualizer.h"
+#include <FMediaAudioEqualizer.h>
-#include "FMediaAudioIn.h"
+#include <FMediaAudioFrame.h>
-#include "FMediaAudioOut.h"
+#include <FMediaAudioIn.h>
-#include "FMediaAudioRecorder.h"
+#include <FMediaAudioOut.h>
-#include "FMediaAudioRouteInfo.h"
+#include <FMediaAudioRecorder.h>
-#include "FMediaAudioRouteManager.h"
+#include <FMediaAudioRouteInfo.h>
-#include "FMediaAudioSessionManager.h"
+#include <FMediaAudioRouteManager.h>
-#include "FMediaCapability.h"
+#include <FMediaCapability.h>
-#include "FMediaCamera.h"
+#include <FMediaCamera.h>
-#include "FMediaGifDecoder.h"
+#include <FMediaGifDecoder.h>
-#include "FMediaImage.h"
+#include <FMediaIAudioStreamFilter.h>
-#include "FMediaImageBuffer.h"
+#include <FMediaImage.h>
-#include "FMediaImageUtil.h"
+#include <FMediaImageBuffer.h>
-#include "FMediaMediaStreamInfo.h"
+#include <FMediaImageUtil.h>
-#include "FMediaPlayer.h"
+#include <FMediaIVideoStreamFilter.h>
-#include "FMediaTonePlayer.h"
+#include <FMediaMediaStreamInfo.h>
-#include "FMediaTypes.h"
+#include <FMediaPlayer.h>
-#include "FMediaVoipAudioSessionManager.h"
+#include <FMediaTonePlayer.h>
-#include "FMediaVideoDecoder.h"
+#include <FMediaTypes.h>
-#include "FMediaVideoEncoder.h"
+#include <FMediaVideoDecoder.h>
-#include "FMediaVideoFrameExtractor.h"
+#include <FMediaVideoEncoder.h>
-#include "FMediaVideoRecorder.h"
+#include <FMediaVideoFrame.h>
+
+#include <FMediaVideoFrameExtractor.h>
+
+#include <FMediaVideoRecorder.h>
/**
* @namespace Tizen::Media
namespace Tizen { namespace Media
{
/**
- * @if VISPARTNER
* @class AudioEqualizer
- * This class is used to apply audio equalizer settings
+ * @brief This class is used to apply audio equalizer settings.
*
* @since 2.0
*
* @final This class is not intended for extension.
*
- * @visibility partner
- *
* @remarks The functionality includes querying and setting the levels of the different frequency bands.
*
* The following example demonstrates how to use the %AudioEqualizer class.
* }
*
* @endcode
- *
- * @endif
*/
class _OSP_EXPORT_ AudioEqualizer
{
public:
/**
- * @if VISPARTNER
* The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
*
* @since 2.0
*
- * @visibility partner
- *
* @remarks After creating an instance of this class, the Construct() method must be called explicitly to
* initialize this instance.
* @see Construct()
- * @endif
*/
AudioEqualizer(void);
/**
- * @if VISPARTNER
* This destructor overrides Tizen::Base::Object::~Object().
*
* @since 2.0
*
- * @visibility partner
- * @endif
*/
virtual ~AudioEqualizer(void);
/**
- * @if VISPARTNER
- * Initializes this instance of %AudioEqualizer with the given %Player.
+ * Initializes this instance of %AudioEqualizer with the given Player.
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
- * @param[in] player The player instance that the equalizer will be applied.
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @param[in] player The player instance that the equalizer will be applied
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_UNSUPPORTED_OPERATION This device does not support the audio equalizer feature.
* @remarks If player is deleted, then this instance cannot be used properly.
- * @endif
*/
result Construct(Player& player);
/**
- * @if VISPARTNER
* Gets the count of bands that equalizer supports.
*
* @since 2.0
*
- * @visibility partner
- *
* @return The count of bands, @n
- else @c -1 if it fails.
+ * else @c -1 if it fails
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
* @remarks The specific error code can be accessed using the GetLastResult() method.
- * @endif
*/
int GetBandCount(void) const;
/**
- * @if VISPARTNER
- * Gets the level range of the frequency band
+ * Gets the level range of the frequency band.
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
- * @param[in] index Index of the frequency band. @n
- Index starts from 0.
- * @param[out] minValue Minimum level of the frequency band specified via index
- * @param[out] maxValue Maximum level of the frequency band specified via index
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_ARG The specified input parameter is invalid
+ * @param[in] index Index of the frequency band @n
+ * Index starts from 0.
+ * @param[out] minValue The minimum level of the frequency band specified by index
+ * @param[out] maxValue The maximum level of the frequency band specified by index
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
* @see GetBandCount()
- * @endif
*/
result GetBandLevelRange(int index, int& minValue, int& maxValue) const;
/**
- * @if VISPARTNER
- * Sets the level of the frequency band specified by index
+ * Sets the level of the frequency band specified by index.
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
- * @param[in] index Index of the frequency band. @n
- Index starts from 0.
- * @param[in] level The level to which the frequency band should be set to
+ * @param[in] index Index of the frequency band @n
+ * Index starts from 0.
+ * @param[in] level The level to which the frequency band should be set
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_RANGE The level value does not lie within minimum and maximum range of frequency band.
- * @exception E_INVALID_ARG The specified input parameter is invalid
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
* @see GetBandCount()
- * @endif
*/
result SetBandLevel(int index, int level);
/**
- * @if VISPARTNER
* Sets the level of all the frequency bands
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
* @param[in] pLevels The pointer of the level array which has settings of all the frequency bands
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_RANGE The level values do not lie within minimum and maximum range of frequency bands
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The level values do not lie within minimum and maximum range of frequency bands.
* @exception E_INVALID_ARG The specified input parameter is invalid. List is either empty or does not have level settings for all frequeny bands.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
- * @endif
*/
result SetAllBandsLevel(const Tizen::Base::Collection::IListT<int>* pLevels);
/**
- * @if VISPARTNER
- * Gets the level of frequency band specified via index
+ * Gets the level of frequency band specified by index.
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
- * @param[in] index Index of the frequency band. @n
- Index starts from 0.
- * @param[out] level Level of the frequency band specified via index
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_ARG The specified input parameter is invalid
+ * @param[in] index Index of the frequency band @n
+ * Index starts from 0.
+ * @param[out] level The level of the frequency band specified by index
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
- * @endif
*/
result GetBandLevel(int index, int& level) const;
/**
- * @if VISPARTNER
- * Gets the center frequency of the frequency band specified by index
+ * Gets the center frequency of the frequency band specified by index.
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
- * @param[in] index Index of the frequency band. @n
- Index starts from 0.
- * @param[out] frequency Center frequency in Hz of the frequency band specified by index
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_ARG The specified input parameter is invalid
+ * @param[in] index Index of the frequency band @n
+ * Index starts from 0.
+ * @param[out] frequency The center frequency in Hz of the frequency band specified by index
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
- * @endif
*/
result GetBandCenterFrequency(int index, int& frequency) const;
/**
- * @if VISPARTNER
- * Clears the equalizer effect and resets all bands to the default values
+ * Clears the equalizer effect and resets all bands to the default values.
*
* @since 2.0
*
- * @visibility partner
- *
* @return An error code
- * @exception E_SUCCESS The method is successful
+ * @exception E_SUCCESS The method is successful.
* @exception E_INVALID_OPERATION The associated audio instance is no longer valid.
- * @endif
*/
result ResetAllToDefault(void);
private:
/**
- * @if VISPARTNER
* The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
*
* @since 2.0
*
- * @visibility private
- * @endif
*/
AudioEqualizer(const AudioEqualizer& rhs);
/**
- * @if VISPARTNER
- * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
*
* @since 2.0
*
- * @visibility private
- * @endif
*/
AudioEqualizer& operator =(const AudioEqualizer& rhs);
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMediaAudioFrame.h
+ * @brief This is the header file for the %AudioFrame class.
+ *
+ * This header file contains the declarations of the %AudioFrame class.
+ */
+
+#ifndef _FMEDIA_AUDIO_FRAME_H_
+#define _FMEDIA_AUDIO_FRAME_H_
+
+#include <FBase.h>
+#include <FMediaAudioTypes.h>
+
+namespace Tizen { namespace Media
+{
+
+/**
+ * @class AudioFrame
+ * @brief This class has the audio frame data.
+ *
+ * @since 2.1
+ *
+ * @final This class is not intended for extension
+ *
+ * The %AudioFrame class has the audio frame data.
+ * The frame has several plane components. @n
+ * This object is delivered to the application by IAudioStreamFilter::ProcessAudioStream() when the audio stream is coming.
+ *
+ * The following example demonstrates how to use the %AudioFrame class.
+ *
+ * @code
+ * #include <FBase.h>
+ * #include <FMedia.h>
+ * #include <FApp.h>
+ *
+ * using namespace Tizen::Media;
+ *
+ * class AudioFrameSample
+ * : public Tizen::Media::IAudioRecorderEventListener
+ * , public Tizen::Media::IAudioStreamFilter
+ * {
+ * public:
+ * AudioFrameSample(void);
+ * result Start(void);
+ * void Stop(void);
+ *
+ * protected:
+ * virtual void OnAudioRecorderStopped(result r) {}
+ * virtual void OnAudioRecorderCanceled(result r) {}
+ * virtual void OnAudioRecorderPaused(result r) {}
+ * virtual void OnAudioRecorderStarted(result r) {}
+ * virtual void OnAudioRecorderEndReached(RecordingEndCondition endCondition) {}
+ * virtual void OnAudioRecorderClosed(result r) {}
+ * virtual void OnAudioRecorderErrorOccurred(RecorderErrorReason r) {}
+ * virtual void ProcessAudioStream(AudioFrame &frame);
+ *
+ * private:
+ * AudioRecorder __recorder;
+ * };
+ *
+ * AudioFrameSample::AudioFrameSample(void)
+ * {
+ * }
+ *
+ * result
+ * AudioFrameSample::Start(void)
+ * {
+ * result r = E_SUCCESS;
+ * String destFilePath = Tizen::App::App::GetInstance()->GetAppRootPath() + L"data/test.amr";
+ *
+ * r = __recorder.Construct(*this);
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * r = __recorder.CreateAudioFile(destFilePath, true);
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * r = __recorder.AddAudioStreamListener(*this);
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * r = __recorder.Record();
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * return E_SUCCESS;
+ * }
+ *
+ * void
+ * AudioFrameSample::Stop(void)
+ * {
+ * __recorder.Stop();
+ * __recorder.Close();
+ * }
+ *
+ * void
+ * AudioFrameSample::ProcessAudioStream(AudioFrame &frame)
+ * {
+ * // manipulate audio frmae data.
+ * // Get peak value from the audio frame.
+ * // This code supports only signed 16-bits sample format.
+ * if (frame.GetPlaneCount() < 1 || frame.GetSampleType() != AUDIO_TYPE_PCM_S16_LE)
+ * {
+ * return;
+ * }
+ * short* pSampleData = (short*)(frame.GetPlaneData(0)->GetPointer())
+ * int peakValue = 0;
+ * int sampleCount = frame.GetPlaneSize(0) / 2;
+ * for (int i = 0; i<sampleCount; i++)
+ * {
+ * if (pSampleData[i] >peakValue)
+ * peakValue = pSampleData[i];
+ * }
+ * }
+ *
+ * @endcode
+ *
+ *
+ */
+class _OSP_EXPORT_ AudioFrame
+ : public Tizen::Base::Object
+{
+public:
+
+ /**
+ *
+ * Gets the plane count which the frame data has.
+ *
+ *
+ * @return The plane count
+ *
+ */
+ int GetPlaneCount(void) const;
+
+ /**
+ *
+ * Gets the audio channel.
+ *
+ *
+ * @return The audio channel
+ *
+ */
+ AudioChannelType GetChannelType(void) const;
+
+ /**
+ *
+ * Gets the audio sample type.
+ *
+ *
+ * @return The audio sample type
+ *
+ */
+ AudioSampleType GetSampleType(void) const;
+
+ /**
+ *
+ * Gets the audio sampling rate.
+ *
+ *
+ * @return The audio sampling rate in hertz (Hz)
+ *
+ */
+ int GetSamplingRate(void) const;
+
+ /**
+ *
+ * Gets the plane data at the specified index from the frame.
+ *
+ *
+ * @return The plane data, @n
+ * else @null if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The buufer in ByteBuffer is shared with @c AudioFrame instance. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ */
+ Tizen::Base::ByteBuffer* GetPlaneData(int index) const;
+
+private:
+
+ /**
+ * This is the default constructor for this class.
+ *
+ * @remarks The object is not fully constructed after this constructor is called. For full construction,
+ * the Construct() method must be called right after calling this constructor.
+ */
+ AudioFrame(void);
+
+ /**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ */
+ virtual ~AudioFrame(void);
+
+ /**
+ * Constructs the instance of this class. @n
+ *
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ *
+ */
+ result Construct(void);
+
+ /**
+ * This is the copy constructor for this class.
+ *
+ *
+ * @remarks The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ AudioFrame(const AudioFrame& rhs);
+
+ /**
+ * This is the copy assignment operator for this class.
+ *
+ *
+ * @remarks The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ */
+ AudioFrame& operator =(const AudioFrame& rhs);
+
+ friend class _AudioStreamCoordinator;
+ friend class _AudioFrameImpl;
+ class _AudioFrameImpl* __pImpl;
+};
+
+}}// Tizen::Media
+
+#endif
* @since 2.0
*
* @remarks After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
- * @see Construct()
*/
AudioIn(void);
/**
* Initializes this instance of %AudioIn with the specified IAudioInEventListener. @n
- * This method creates an instance of %AudioIn in the subsystem.
+ * The %Construct() method creates an instance of %AudioIn in the subsystem.
*
* @since 2.0
*
* @param[in] listener An instance of IAudioInEventListener
* @exception E_SUCCESS The method is successful.
* @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
+ * @exception E_UNSUPPORTED_OPERATION This operation is not supported.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_SYSTEM A system error has occurred.
* @remarks Only one instance of %AudioIn is operational at a given time.
* Prepares the specified audio input device with the application-defined settings. @n
* When the caller finishes using the audio input device, the resources must be released by calling the Unprepare() method.
*
- * @brief <i> [Deprecated] </i>
+ * @brief <i> [Deprecated] </i>
* @deprecated This method is deprecated because AudioInputDevice is no longer used in %AudioIn class. @n
* Instead of using this method, use Prepare(AudioSampleType audioSampleType, AudioChannelType audioChannelType, int audioSampleRate).
*
* @exception E_SYSTEM A system error has occurred.
* @exception E_INVALID_ARG A specified input parameter is invalid.
* @exception E_UNSUPPORTED_FORMAT The specified audio sample type is not supported.
- * @see Unprepare()
* @endif
*/
result Prepare(AudioInputDevice audioInputDevice, AudioSampleType audioSampleType, AudioChannelType audioChannelType, int audioSampleRate);
* @exception E_DEVICE_FAILED The device failed with unknown reason.
* @exception E_INVALID_ARG A specified input parameter is invalid.
* @exception E_UNSUPPORTED_FORMAT The specified audio sample type is not supported.
- * @see Unprepare()
*/
result Prepare(AudioSampleType audioSampleType, AudioChannelType audioChannelType, int audioSampleRate);
/**
* Stops the usage of the input device and releases the allocated resources during the execution of the Prepare() method. @n
- * Resources allocated during Prepare() are released.
+ * Resources allocated during %Prepare() are released.
*
* @since 2.0
*
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
- * @see Prepare()
*/
result Unprepare(void);
* @exception E_SYSTEM A system error has occurred.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @remarks The data size of @c pByteBuffer must be the same as every call of this method.
- * @see Start(), IAudioInEventListener::OnAudioInBufferIsFilled()
+ * @see Start()
+ * @see IAudioInEventListener::OnAudioInBufferIsFilled()
*/
result AddBuffer(const Tizen::Base::ByteBuffer* pByteBuffer);
* @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
* @exception E_SYSTEM A system error has occurred.
* @remarks Several buffers must be added to the queue with AddBuffer() before calling this method.
- * @see Stop(), IAudioInEventListener::OnAudioInBufferIsFilled()
+ * @see Stop()
+ * @see IAudioInEventListener::OnAudioInBufferIsFilled()
*/
result Start(void);
/**
* Stops using the audio input device. @n
* All pending and current buffers that are filled with audio data
- * at the time of calling this method, are returned to the listener.
+ * at the time of calling the %Stop() method, are returned to the listener.
* Use Start() to start capturing audio input data again.
*
* @since 2.0
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
- * @see Start(), IAudioInEventListener::OnAudioInBufferIsFilled()
+ * @see IAudioInEventListener::OnAudioInBufferIsFilled()
*/
result Stop(void);
/**
* Resets using the audio input device without returning buffers to the caller. @n
* All pending and current buffers are released immediately without any notifications.
- * The state is changed to AUDIOIN_STATE_PREPARED.
+ * The state is changed to @c AUDIOIN_STATE_PREPARED.
*
* @since 2.0
*
*
* @since 2.0
*
- * @return The minimum size of the buffer in bytes, @n
+ * @return The minimum size of the buffer in bytes, @n
* else @c -1 if an error occurs
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @file FMediaAudioManagerTypes.h
* @brief This is the header file for the types of audio manager classes.
*
-* This header files contains all the common things required for audio manager classes and associated classes
+* This header files contains all the common things required for audio manager classes and its associated classes.
*
*/
#ifndef _FMEDIA_AUDIO_MANAGER_TYPES_H_
namespace Tizen { namespace Media
{
/**
- * @if VISPARTNER
* @enum InputAudioDevice
*
* Defines the input audio devices.
*
* @since 2.0
- * @visibility partner
- * @endif
*/
enum InputAudioDevice
{
/**
- * @if VISPARTNER
* @enum OutputAudioDevice
*
- * Defines the output audio devices
+ * Defines the output audio devices.
*
* @since 2.0
- * @visibility partner
- * @endif
*/
enum OutputAudioDevice
{
OUTPUT_AUDIO_DEVICE_WIRED_ACCESSORY, /**< The wired accessory such as earjack, headphone or headset*/
OUTPUT_AUDIO_DEVICE_BT_SCO, /**< The bluetooth(SCO) */
OUTPUT_AUDIO_DEVICE_BT_A2DP, /**< The bluetooth(A2DP) */
-};
-
-/**
- * @if VISPARTNER
- * @enum AudioSessionMode
- *
- * Defines the audio session mode.
- *
- * @since 2.0
- * @visibility partner
- * @endif
- */
-enum AudioSessionMode
-{
- AUDIO_SESSION_MODE_SHARED, /**< Shared session mode that mutiple applications can use an audio device simultaneously */
- AUDIO_SESSION_MODE_EXCLUSIVE, /**< Exclusive session mode that only one application can use an audio device at a time */
- AUDIO_SESSION_MODE_EMERGENCY, /**< Emergency session mode that only one application can use all available audio devices at a time*/
+ OUTPUT_AUDIO_DEVICE_DOCK, /**DOCK device*/
+ OUTPUT_AUDIO_DEVICE_HDMI, /** HDMI device*/
+ OUTPUT_AUDIO_DEVICE_WFD, /** WiFi-Direct device*/
+ OUTPUT_AUDIO_DEVICE_USB_AUDIO, /** USB audio device*/
};
/**
AUDIO_STREAM_TYPE_CALL /**< Call type audio */
};
-/**
- * @if VISPARTNER
- * @enum VoipAudioSessionMode
- *
- * Defines enums of VoIP call session mode.
- *
- * @since 2.0
- * @visibility partner
- * @endif
- */
-enum VoipAudioSessionMode
-{
- VOIP_AUDIO_SESSION_MODE_NONE, /**< VoIP audio session mode is none */
- VOIP_AUDIO_SESSION_MODE_VOICE, /**< VoIP audio session mode is voice */
- VOIP_AUDIO_SESSION_MODE_RINGTONE, /**< VoIP audio session mode is ringtone */
- VOIP_AUDIO_SESSION_MODE_MEDIA /**< VoIP audio session mode is media */
-};
-
}} //Tizen::Media
#endif
* @since 2.0
*
* @remarks After creating an instance of this class, the Construct() method must be called explicitly to initialize this instance.
- * @see Construct()
*/
AudioOut(void);
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @exception E_RESOURCE_UNAVAILABLE The AudioOut's resources are unavailable.
+ * @exception E_RESOURCE_UNAVAILABLE The %AudioOut's resources are unavailable.
*/
result Construct(IAudioOutEventListener& listener);
/**
* Writes into the data buffer containing the audio data to be played to this audio output device. @n
- * When the end of the buffer is reached, the application gets the notification through %IAudioOutEventListener.
+ * When the end of the buffer is reached, the application gets the notification through IAudioOutEventListener.
*
* @since 2.0
*
* @exception E_SYSTEM A system error has occurred.
* @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_OVERFLOW The specified input instance has overflowed.
- * @see Start(), IAudioOutEventListener::OnAudioOutBufferEndReached()
+ * @see Start()
+ * @see IAudioOutEventListener::OnAudioOutBufferEndReached()
*/
result WriteBuffer(const Tizen::Base::ByteBuffer& userData);
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
* @remarks Use Start() to resume the playback from the current playback position.
- * @see Start(), IAudioOutEventListener::OnAudioOutBufferEndReached()
+ * @see IAudioOutEventListener::OnAudioOutBufferEndReached()
*/
result Stop(void);
/**
* Resets the audio output device. @n
* All pending and current data buffers in the queue are removed immediately without any notification. The
- * state is changed to AUDIOOUT_STATE_PREPARED.
+ * state is changed to @c AUDIOOUT_STATE_PREPARED.
*
* @since 2.0
*
{
class _AudioRecorderImpl;
+class IAudioStreamFilter;
/**
* @class AudioRecorder
* For more information, see @ref CompIoPathPage "here".
* @endif
*
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @param[in] destMediaPath The file destination to write @n
* Closes a file.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Records an audio file.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Stops a recording.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* To resume a recording after this method is called, the Record() method must be called.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Cancels a recording operation without saving the data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Sets the recording time limit for a file in milliseconds.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @param[in] msTime The maximum recording time in milliseconds @n
* @deprecated This method is deprecated. Instead of this method, use the SetFormat(CodecType audioCodec, MediaContainerType container) method
* that sets the audio codec and container together.
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @param[in] format The audio format to set @n
* Initially, the default codec and the container format are set using the internal configuration.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @param[in] audioCodec The audio codec to set
* Sets the audio recording quality of the audio recorder.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @param[in] quality The audio recording quality of the audio recorder @n
* Sets the mute state of an audio recorder.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/audiorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
*
* @return An error code
* @param[in] mute The mute state @n
*/
bool IsMuted(void) const;
+ /**
+ * Adds the stream filter to process the audio stream data while recording.
+ *
+ * @since 2.1
+ * @privilevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks IAudioStreamFilter::ProcessAudioStream() will be called when the audio frame is ready.
+ */
+ result AddAudioStreamFilter(IAudioStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop processing the audio stream data.
+ *
+ * @since 2.1
+ * @privilevel public
+ * @privilege http://tizen.org/privilege/audiorecorder
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
+
private:
/**
* This is the copy constructor for this class.
*
* @since 2.0
*
- * @see AudioRecorder::SetFormat(), AudioRecorder::GetFormat()
+ * @see AudioRecorder::SetFormat()
+ * @see AudioRecorder::GetFormat()
* @endif
*/
enum AudioRecordingFormat
{
AUDIORECORDING_FORMAT_DEFAULT, /**< @if OSPDEPREC The default format @endif */
- AUDIORECORDING_FORMAT_AMR, /**< @if OSPDEPREC The AMR format @endif */
+ AUDIORECORDING_FORMAT_AMR, /**< @if OSPDEPREC The AMR format @endif */
AUDIORECORDING_FORMAT_WAVE, /**< @if OSPDEPREC The WAVE format @endif */
};
/**
* @file FMediaAudioRouteInfo.h
-* @brief This is the header file for the common types of audio route information.
+* @brief This is the header file for the %AudioRouteInfo class.
*
-* This header files contains all the commons things required for audio route information and associated classes
+* This header files contains the declarations of the %AudioRouteInfo class and its associated classes.
*
*/
#ifndef _FMEDIA_AUDIO_ROUTE_INFO_H_
namespace Tizen { namespace Media
{
/**
- * @if VISPARTNER
- * @class AudioRouteInfo
- * @brief This class contains audio route information
+ * @class AudioRouteInfo
+ * @brief This class contains audio route information.
*
* @since 2.0
*
* @final This class is not intended for extension.
*
- * @visibility partner
+ * @remarks Audio routing can be done using this class instances as input/output audio devices.
*
- * @remarks Audio routing can be done using this class instances as input/output audio devices
- * @endif
+ * The %AudioRouteInfo class contains audio route information.
*/
class _OSP_EXPORT_ AudioRouteInfo
:public Tizen::Base::Object
{
public:
/**
- * @if VISPARTNER
* Initializes this instance of %AudioRouteInfo with the specified audio devices.
*
* @since 2.0
*
- * @visibility partner
- *
* @param[in] in The input audio device
* @param[in] out The output audio device
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_MEMORY Not enough memory to perform the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient to perform the operation.
*
- * @endif
*/
AudioRouteInfo(InputAudioDevice in, OutputAudioDevice out);
/**
- * @if VISPARTNER
* This destructor overrides Tizen::Base::Object::~Object().
*
* @since 2.0
*
- * @visibility partner
- * @endif
*/
virtual ~AudioRouteInfo(void);
/**
- * @if VISPARTNER
- * Sets the input audio device
+ * Sets the input audio device.
*
* @since 2.0
*
- * @visibility partner
- *
* @param[in] in The input audio device
- * @endif
*/
void SetInputAudioDevice(InputAudioDevice in);
/**
- * @if VISPARTNER
- * Sets the output audio device
+ * Sets the output audio device.
*
* @since 2.0
*
- * @visibility partner
- *
* @param[in] out The output audio device
- * @endif
*/
void SetOutputAudioDevice(OutputAudioDevice out);
/**
- * @if VISPARTNER
- * Gets the input audio device
+ * Gets the input audio device.
*
* @since 2.0
*
- * @visibility partner
- *
- * @return Input audio device
- * @endif
+ * @return The input audio device
*/
InputAudioDevice GetInputAudioDevice(void) const;
/**
- * @if VISPARTNER
- * Gets the output audio device
+ * Gets the output audio device.
*
* @since 2.0
*
- * @visibility partner
- *
- * @return Output audio device
- * @endif
+ * @return The output audio device
*/
OutputAudioDevice GetOutputAudioDevice(void) const;
/**
- * @if VISPARTNER
* Copying of objects using this copy constructor is allowed.
*
* @since 2.0
*
- * @visibility partner
- *
* @return The copy of this instance
* @param[in] rhs An instance of %AudioRouteInfo
- * @endif
*/
AudioRouteInfo(const AudioRouteInfo& rhs);
/**
- * @if VISPARTNER
* Copying of objects using this copy assignment operator is allowed.
*
* @since 2.0
*
- * @visibility partner
- *
- * @return The instance of AudioRouteInfo
- * @param[in] rhs AudioRouteInfo instance
- * @endif
+ * @return The instance of %AudioRouteInfo
+ * @param[in] rhs An instance of %AudioRouteInfo
*/
AudioRouteInfo& operator =(const AudioRouteInfo& rhs);
/**
- * @if VISPARTNER
* Compares the specified instance of %AudioRouteInfo with the calling instance.
*
* @since 2.0
*
- * @visibility partner
- *
- * @return @c true if the object is the same,@n
- else @c false
- * @param[in] obj The object
- * @endif
+ * @return @c true if the object is the same, @n
+ * else @c false
+ * @param[in] obj The object to compare with the current instance
*/
virtual bool Equals(const Object& obj) const;
/**
- * @if VISPARTNER
- * Gets the hash code for %AudioRouteInfo instance
+ * Gets the hash code for the %AudioRouteInfo instance.
*
* @since 2.0
*
- * @visibility partner
- *
- * @return Hash code
- * @endif
+ * @return The hash code
*/
virtual int GetHashCode(void) const;
namespace Tizen { namespace Media
{
/**
- * @if VISPARTNER
* @class AudioRouteManager
* @brief This class is used to manage audio routing.
*
* }
*
* @endcode
- *
- * @endif
*/
class _OSP_EXPORT_ AudioRouteManager
{
public:
/**
- * @if VISPARTNER
- * Gets the audio route manager instance pointer
+ * Gets the audio route manager instance pointer.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return A pointer to the audio route manager instance, @n
- else @c null if it fails
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_MEMORY Not enough memory to perform the operation
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
+ * else @c null if it fails
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient to perform the operation.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
* @remarks The specific error code can be accessed using the GetLastResult() method.
- * @endif
*/
static AudioRouteManager* GetInstance(void);
/**
- * @if VISPARTNER
- * Sets audio route event listener
+ * Sets audio route event listener.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return An error code
- * @param[in] pListener The audio route event listener. @n
- To unset the listener, pass a @c null value to the listener parameter.
- * @exception E_SUCCESS The method is successful
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @endif
+ * @param[in] pListener The audio route event listener @n
+ * To unset the listener, pass a @c null value to the listener parameter.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result SetAudioRouteEventListener(IAudioRouteEventListener* pListener);
/**
- * @if VISPARTNER
- * Gets the name of the active bluetooth A2DP device
+ * Gets the name of the active bluetooth A2DP device.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return The name of active bluetooth A2DP device
- * @exception E_SUCCESS The method is successful
- * @exception E_DEVICE_UNAVAILABLE A2DP device is not connected or available
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @endif
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_DEVICE_UNAVAILABLE A2DP device is not connected or available.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
*/
Tizen::Base::String GetActiveBluetoothA2dpName(void) const;
/**
- * @if VISPARTNER
* Gets the active audio stream type
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return An active audio stream type
- * @exception E_SUCCESS The method is successful
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks AUDIO_STREAM_TYPE_NO_SOUND is returned when no sound is playing
- * @endif
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @remarks @c AUDIO_STREAM_TYPE_NO_SOUND is returned when no sound is playing.
*/
AudioStreamType GetActiveAudioStreamType(void) const;
/**
- * @if VISPARTNER
- * Gets available audio routes
+ * Gets available audio routes.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return The list of available audio routes, @n
- else @c null if it fails
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_MEMORY No memory to make the list
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remark The item type of returned list is AudioRouteInfo.
- * @endif
+ * else @c null if it fails
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient to make the list.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @remarks The item type of returned list is AudioRouteInfo.
*/
Tizen::Base::Collection::IList* GetAvailableAudioRouteListN(void) const;
/**
- * @if VISPARTNER
- * Checks the specified route availability.
+ * Checks the specified @c route availability.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
- * @return @c true if the audio route is available,@n
- else @c false
- * @param[in] route Audio route
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_ARG A specified input parameter is invalid
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @endif
+ * @return @c true if the audio route is available, @n
+ * else @c false
+ * @param[in] route An instance of AudioRouteInfo
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
*/
bool IsAudioRouteAvailable(const AudioRouteInfo& route) const;
/**
- * @if VISPARTNER
- * Sets the active audio route
+ * Sets the active audio route.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return An error code
- * @param[in] route Audio route to set
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_ARG A specified input parameter is invalid
- * @exception E_DEVICE_UNAVAILABLE Audio route is not available
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @endif
+ * @param[in] route An instance of AudioRouteInfo to set
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @exception E_DEVICE_UNAVAILABLE The audio route is not available.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
*/
result SetActiveAudioRoute(const AudioRouteInfo& route);
/**
- * @if VISPARTNER
- * Gets the active audio route
+ * Gets the active audio route.
*
* @since 2.0
*
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.route
+ * @privlevel partner
+ * @privilege http://tizen.org/privilege/audiomanager.route
*
* @return The active audio route
- * @exception E_SUCCESS The method is successful
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks INPUT_AUDIO_DEVICE_NONE and OUTPUT_AUDIO_DEVICE_NONE are set in AudioRouteInfo if fails.
- * @endif
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks The specific error code can be accessed using the GetLastResult() method.
+ * @remarks @c INPUT_AUDIO_DEVICE_NONE and @c OUTPUT_AUDIO_DEVICE_NONE are set in AudioRouteInfo if this method fails.
*/
AudioRouteInfo GetActiveAudioRoute(void) const;
private:
/**
- * @if VISPARTNER
* This default constructor is intentionally declared as private to implement the Singleton semantic.
*
* @since 2.0
*
- * @visibility partner
- * @endif
*/
AudioRouteManager(void);
/**
- * @if VISPARTNER
* This destructor is intentionally declared as private to implement the Singleton semantic.
*
* @since 2.0
*
- * @visibility partner
- * @endif
*/
virtual ~AudioRouteManager(void);
/**
- * @if VISPARTNER
* The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
*
* @since 2.0
*
- * @visibility partner
- * @endif
*/
AudioRouteManager(const AudioRouteManager& rhs);
/**
- * @if VISPARTNER
* The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
*
* @since 2.0
*
- * @visibility partner
- * @endif
*/
AudioRouteManager& operator =(const AudioRouteManager& rhs);
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FMediaAudioSessionManager.h
- * @brief This is the header file for the %AudioSessionManager class.
- *
- * This header file contains the declarations of the %AudioSessionManager class.
- */
-
-#ifndef _FMEDIA_AUDIO_SESSION_MANAGER_H_
-#define _FMEDIA_AUDIO_SESSION_MANAGER_H_
-
-#include <FMediaAudioManagerTypes.h>
-#include <FMediaIAudioSessionEventListener.h>
-
-namespace Tizen { namespace Media
-{
-/**
- * @if VISPARTNER
- * @class AudioSessionManager
- * @brief This class is used to manage application's audio session.
- * This will handle the audio session policy between applications.
- * The audio session will be applied when an media-related instance is constructed right after the given session is set.
- * As the precondition, all media-related instances MUST be destroyed before the audio session mode is set.
- *
- * @since 2.0
- *
- * @final This class is not intended for extension.
- *
- * @visibility partner
- *
- * @remarks Only one instance of the class works at a time.
- * @endif
- */
-
-class _OSP_EXPORT_ AudioSessionManager
- :public Tizen::Base::Object
-{
-public:
- /**
- * @if VISPARTNER
- * Gets the audio session manager's pointer.
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.session
- *
- * @return A pointer to the audio session manager, @n
- else @c null if it fails
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_MEMORY Not enough memory to perform the operation
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks The specific error code can be accessed using the GetLastResult() method.
- * @endif
- */
- static AudioSessionManager* GetInstance(void);
-
- /**
- * @if VISPARTNER
- * Sets the event listener that receives audio session related events.
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.session
- *
- * @return An error code
- * @param[in] pListener The event listener @n
- To unset the listener, pass a @c null value to the listener parameter
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_STATE The audio session state is not valid.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks All media-related instances MUST be destroyed before the audio session mode is set.@n
- if not, this method returns E_INVALID_STATE.
- * @endif
- */
- result SetAudioSessionEventListener(IAudioSessionEventListener* pListener);
-
- /**
- * @if VISPARTNER
- * Sets application's audio session mode.
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.session
- *
- * @return An error code
- * @param[in] sessionMode The audio session mode to set
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_ARG A specified input parameter is invalid
- * @exception E_INVALID_STATE The audio session state is not valid.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks All media-related instances MUST be destroyed before the audio session mode is set.@n
- if not, this method returns E_INVALID_STATE.
- * @endif
- */
- result SetMode(AudioSessionMode sessionMode);
-
- /**
- * @if VISPARTNER
- * Gets application's audio session mode.
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.session
- *
- * @return The audio session mode of application
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_STATE The audio session state is not valid.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks This method will return the default session mode before the audio session mode is set.
- * @endif
- */
- AudioSessionMode GetMode(void) const;
-
-private:
- /**
- * @if VISPARTNER
- * This default constructor is intentionally declared as private to implement the Singleton semantic.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- AudioSessionManager(void);
-
- /**
- * @if VISPARTNER
- * This destructor is intentionally declared as private to implement the Singleton semantic.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- virtual ~AudioSessionManager(void);
-
- /**
- * @if VISPARTNER
- * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- AudioSessionManager(const AudioSessionManager& rhs);
-
- /**
- * @if VISPARTNER
- * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit assigning of objects.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- AudioSessionManager& operator =(const AudioSessionManager& rhs);
-
- class _AudioSessionManagerImpl* __pAudioSessionManagerImpl;
-
-};
-
-}} // Tizen::Media
-
-#endif
*
* @since 2.0
*
- * @see AudioIn::Prepare(), AudioOut::Prepare()
+ * @see AudioIn::Prepare()
+ * @see AudioOut::Prepare()
*/
enum AudioChannelType
{
*
* @since 2.0
*
- * @see AudioIn::Prepare(), AudioOut::Prepare()
+ * @see AudioIn::Prepare()
+ * @see AudioOut::Prepare()
*/
enum AudioSampleType
{
namespace Tizen { namespace Media
{
+class IVideoStreamFilter;
class _CameraImpl;
/**
* Powers the camera on.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Powers the camera off.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
*
* @return @c true if the camera is powered on, @n
* else @c false
- * @see PowerOn(), PowerOff()
+ * @see PowerOn()
+ * @see PowerOff()
*/
bool IsPoweredOn(void) const;
* callback is not invoked. The default value of @c previewedData is @c false.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] pBufferInfo The buffer information for the camera preview display
* Stops displaying the preview image on the camera device.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* The captured image is passed through ICameraEventListener::OnCameraCaptured().
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Sets the brightness level of the camera input data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] brightness The brightness level to set @n
* Sets the contrast level of the %Camera input data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] contrast The contrast level to set @n
* Zooms in the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Zooms out the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Sets the current resolution of the preview.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] resolution The preview resolution @n
* Initially, the default resolution is set using the internal configuration.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] resolution The display resolution @n
* Sets the effect for the input data of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] effect The effect for the input data of the camera
* @deprecated This method is deprecated. @n
* Instead of using this method, use the SetFlashMode() method.
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] flashOn Set to @c true to switch on the flash light, @n
* Sets the camera's flash mode.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] flashMode flash mode to switch on the flash light.
* Sets the exposure level of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] exposure The camera exposure level @n
* Sets the white balance level of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] whiteBalance The camera white balance level
* Sets the capturing quality of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] quality The camera's quality level
* Sets the focus mode of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] focusMode focus mode
* Sets the auto focus point list.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] pointList The auto focus point list which consists of Tizen::Graphics::Point pointers
* Sets the auto focus mode of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] callback Set to @c true to enable auto focus callback, @n
* Initially, the default format is set using the internal configuration.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] format The camera's capture format @n
* Initially, the default format is set using the internal configuration.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] format The camera's preview format @n
* Sets the ISO level of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] isoLevel The camera's ISO level @n
* Initially, the default frame rate is set using the internal configuration.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] fps The frame rate per second
* Sets the orientation value in the Exchangeable Image File Format (EXIF) field of the captured data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] orientation The orientation value to set in EXIF
* Sets the GPS coordinates in the Exchangeable %Image File Format (EXIF) field for the captured data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] latitude The latitude value to set in EXIF @n
* Disables the insertion of the GPS coordinates in the Exchangeable %Image File Format (EXIF) field for the captured data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Sets the flip type for the previewed and captured data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] flip The camera flip type
* Sets the rotation for the previewed data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] rotation The camera rotation
* Sets the metering mode of the camera.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/camera
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
*
* @return An error code
* @param[in] meteringMode The metering mode
CameraMeteringMode GetMeteringMode(void) const;
/**
+ * Sets the scene mode of the camera.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/camera
+ *
+ * @return An error code
+ * @param[in] sceneMode The scene mode
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE This instance is in an invalid state for this method.
+ * @exception E_DEVICE_BUSY The camera is under use by other application.
+ * @exception E_DEVICE_UNAVAILABLE The camera becomes unavailable.
+ * @exception E_DEVICE_FAILED The device operation has failed.
+ * @exception E_INVALID_ARG The specified scene mode is invalid.
+ * @exception E_UNSUPPORTED_OPERATION The target device does not support scene mode configuration feature.
+ * @exception E_UNSUPPORTED_TYPE The specified @c sceneMode is not supported.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks In a specific scene mode, camera's attributes such as brightness, metering mode, iso level, white balance, flash and focus are changed to the ones which are pre-defined by each scene mode.@n
+ * In a specific scene mode, if an application sets any attribute which is related to the scene, the mode can be changed to ::CAMERA_SCENE_OFF.@n
+ * Thus it is recommended that the application checks the current scene mode after setting the attributes.@n
+ * In case that the scene mode is changed to ::CAMERA_SCENE_OFF, all the attributes set by the application are re-loaded.@n
+ */
+ result SetSceneMode(CameraSceneMode sceneMode);
+
+
+ /**
+ * Gets the scene mode of the camera.
+ *
+ * @since 2.1
+ *
+ * @return The %Camera scene mode
+ */
+ CameraSceneMode GetSceneMode(void) const;
+
+ /**
+ * Adds the stream filter to process the video stream data while previewing or recording.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks IVideoStreamFilter::ProcessVideoStream() will be called when the video frame is ready.
+ */
+ result AddVideoStreamFilter(Tizen::Media::IVideoStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop receiving the video stream data.
+ *
+ * @since 2.1
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/camera
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result RemoveVideoStreamFilter(Tizen::Media::IVideoStreamFilter& filter);
+
+ /**
* This value can be used to set the preview frame rate by using the SetPreviewFrameRate() method. @n
* If the preview frame rate is set using this value, the frame rate during the preview is automatically adjusted as per the light condition.
*
CAMERA_METERING_MODE_SPOT, /**< Spot metering mode that uses information of very small area of the scene */
};
+/**
+* @enum CameraSceneMode
+*
+* Defines the camera scene mode
+* @since 2.1
+*/
+enum CameraSceneMode
+{
+ CAMERA_SCENE_OFF, /**< No Specific Scene. Scene mode is off. */
+ CAMERA_SCENE_PORTRAIT, /**< This mode is for pictures of people */
+ CAMERA_SCENE_LANDSCAPE, /**< This mode is for pictures on distant objects */
+ CAMERA_SCENE_SPORTS, /**< This mode is for pictures of fast moving objects */
+ CAMERA_SCENE_PARTY_INDOOR, /**< This mode is for pictures in indoor */
+ CAMERA_SCENE_BEACH_SHOW, /**< This mode is for pictures on the beach */
+ CAMERA_SCENE_SUNSET, /**< This mode is for sunset's pictures */
+ CAMERA_SCENE_DUSK_DAWN, /**< This mode is for dusk-dawn pictures */
+ CAMERA_SCENE_AUTUMN_COLOR, /**< This mode is for pictures of autumn colors leaves in fall*/
+ CAMERA_SCENE_NIGHT, /**< This mode is for pictures at night */
+ CAMERA_SCENE_FIREWORK, /**< This mode is for pictures of fireworks display */
+ CAMERA_SCENE_TEXT, /**< This mode is for text's pictures on short distance */
+ CAMERA_SCENE_SHOW_WINDOW, /**< This mode is for pictures of object through show-window */
+ CAMERA_SCENE_CANDLELIGHT, /**< This mode is for pictures of object under candle light */
+ CAMERA_SCENE_BACKLIGHT /**< This mode is for pictures when there is a lot of brightness behind object */
+};
+
+
}}// Tizen::Media
_OSP_EXPORT_ extern const wchar_t* const CAMERA_PRIMARY_METERING_MODE;
/**
+* The property key to check the list of scene mode that the primary camera supports.
+*
+* @since 2.1
+*/
+_OSP_EXPORT_ extern const wchar_t* const CAMERA_PRIMARY_SCENE_MODE;
+
+
+/**
* The property key to check the list of capture formats that the secondary camera supports.
*
* @since 2.0
_OSP_EXPORT_ extern const wchar_t* const CAMERA_SECONDARY_METERING_MODE;
/**
+* The property key to check the list of scene mode that the secondary camera supports.
+*
+* @since 2.1
+*/
+_OSP_EXPORT_ extern const wchar_t* const CAMERA_SECONDARY_SCENE_MODE;
+
+/**
* The property key to check the list of audio codecs that the player supports.
*
* @since 2.0
* Called when an audio recording focus is changed to another application.
*
* @since 2.0
- * @remarks After the audio focus is being changed, the recording is stopped and the state of this instance is changed to AUDIOIN_STATE_STOPPED.
- * @remarks An application can start recording in the state of AUDIOIN_STATE_STOPPED but the interaction between device and user needs to record again. Because there is a possibility of a race condition between applications which try to resume without the interaction.
+ * @remarks After the audio focus is being changed, the recording is stopped and the state of this instance is changed to @c AUDIOIN_STATE_STOPPED.
+ * @remarks User interaction with the device is required for an application in @c AUDIOIN_STATE_STOPPED state to resume recording. This is to avoid the occurrence of a race condition among applications that try to resume without user interaction.
* @remarks An application cannot start recording again even in the state of AUDIOIN_STATE_STOPPED due to other applications which have a higher priority.
*/
*
* @since 2.0
*
- * @param[in] src A pointer to the AudioOut instance that fired the event
+ * @param[in] src An instance of AudioOut that fires the event
*/
virtual void OnAudioOutBufferEndReached(Tizen::Media::AudioOut& src) = 0;
*
* @since 2.0
*
- * @param[in] src A pointer to the AudioOut instance that fired the event
+ * @param[in] src An instance of AudioOut that fires the event
*/
virtual void OnAudioOutInterrupted(Tizen::Media::AudioOut& src) = 0;
*
* @since 2.0
*
- * @param[in] src A pointer to the AudioOut instance that fired the event
+ * @param[in] src An instance of AudioOut that fires the event
*/
virtual void OnAudioOutReleased(Tizen::Media::AudioOut& src) = 0;
*
* @since 2.0
*
- * @param[in] src A pointer to the AudioOut instance that fired the event
- * @remarks After the audio focus is being changed, the playback is stopped and the state of this instance is changed to AUDIOOUT_STATE_STOPPED.
- * @remarks An application can start playback again in the state of AUDIOOUT_STATE_STOPPED but the interaction between device and user needs for starting again. Because there is a possibility of a race condition between applications which try to start without the interaction
+ * @param[in] src An instance of AudioOut that fires the event
+ * @remarks After the audio focus is being changed, the playback is stopped and the state of this instance is changed to @c AUDIOOUT_STATE_STOPPED.
+ * @remarks User interaction with the device is required for an application in @c AUDIOOUT_STATE_STOPPED state to resume playing. This is to avoid the occurrence of a race condition among applications that try to start without user interaction.
* @remarks An application cannot start playback again even in the state of AUDIOOUT_STATE_STOPPED due to other applications which have a higher priority.
*/
virtual void OnAudioOutAudioFocusChanged(Tizen::Media::AudioOut& src) {}
public:
/**
- * This is the destructor for this class.
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
*
* @since 2.0
*/
/**
* @file FMediaIAudioRouteEventListener.h
-* @brief This is the header file for the IAudioRouteEventListener interface.
+* @brief This is the header file for the %IAudioRouteEventListener interface.
*
-* This header files contains all the commons things required for %IAudioRouteEventListener and associated classes
+* This header files contains the declarations of the %IAudioRouteEventListener interface and its associated classes.
*
*/
#ifndef _FMEDIA_IAUDIO_ROUTE_EVENT_LISTENER_H_
namespace Tizen { namespace Media
{
/**
- * @if VISPARTNER
* @interface IAudioRouteEventListener
* @brief This interface provides a listener that receives events associated with the active audio device or available audio devices.
*
* @since 2.0
*
- * @visibility partner
- *
* The %IAudioRouteEventListener interface specifies the methods used to notify the changes in active audio device or in available audio devices.
* There are many audio devices in the device. Thus If the application wants to know the currently active audio device or available audio devices,
* it has to listen to this interface.
- *
- * @endif
*/
class _OSP_EXPORT_ IAudioRouteEventListener
: virtual public Tizen::Base::Runtime::IEventListener
{
public:
/**
- * @if VISPARTNER
- * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor@n
- * of this interface is called.
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
*
* @since 2.0
- *
- * @visibility partner
- * @endif
*/
virtual ~IAudioRouteEventListener(void) { }
/**
- * @if VISPARTNER
* Called when active audio route changes.
*
* @since 2.0
- *
- * @visibility partner
- *
- * @param[in] route %AudioRouteInfo for which currently became active
- * @endif
+ * @param[in] route An instance of AudioRouteInfo that is active currently
*/
virtual void OnActiveAudioRouteChanged(const AudioRouteInfo& route) = 0;
/**
- * @if VISPARTNER
- * Called when an available audio route added.
+ * Called when an available audio route is added.
*
* @since 2.0
- *
- * @visibility partner
- *
- * @param[in] route %AudioRouteInfo for which routing status changed
- * @endif
+ * @param[in] route An instance of AudioRouteInfo for which the routing status is changed
*/
virtual void OnAudioRouteAdded(const AudioRouteInfo& route) = 0;
/**
- * @if VISPARTNER
- * Called when an audio route removed.
+ * Called when an audio route is removed.
*
* @since 2.0
- *
- * @visibility partner
- *
- * @param[in] route %AudioRouteInfo for which routing status changed
- * @endif
+ * @param[in] route An instance of AudioRouteInfo for which the routing status is changed
*/
virtual void OnAudioRouteRemoved(const AudioRouteInfo& route) = 0;
protected:
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
-* @file FMediaIAudioSessionEventListener.h
-* @brief This is the header file for the AudioSessionEventListener interface.
-*
-* This header files contains all the commons things required for IAudioSessionEventListener and associated classes
-*
-*/
-#ifndef _FMEDIA_IAUDIO_SESSION_EVENT_LISTENER_H_
-#define _FMEDIA_IAUDIO_SESSION_EVENT_LISTENER_H_
-
-#include <FMediaAudioManagerTypes.h>
-#include "FBaseRtIEventListener.h"
-
-namespace Tizen { namespace Media
-{
-/**
- * @if VISPARTNER
- * @interface IAudioSessionEventListener
- * @brief This interface provides a listener that receives events associated with the audio sessions.
- *
- * @since 2.0
- *
- * @visibility partner
- *
- * The %IAudioSessionEventListener interface specifies the methods used to notify when the application
- * audio session is interrupted or released.
- *
- * @endif
- */
-class _OSP_EXPORT_ IAudioSessionEventListener
- : virtual public Tizen::Base::Runtime::IEventListener
-{
-public:
- /**
- * @if VISPARTNER
- * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor@n
- * of this interface is called.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- virtual ~IAudioSessionEventListener(void) { }
-
- /**
- * @if VISPARTNER
- * Called when the audio session is interrupted.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- virtual void OnAudioSessionInterrupted(void) = 0;
-
- /**
- * @if VISPARTNER
- * Called when the interrupted session is released.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- virtual void OnAudioSessionInterruptReleased(void) = 0;
- /**
- * Called when an audio recording or playback focus is changed to another application.
- *
- * @since 2.0
- * @remarks After the audio focus is being changed, the playback or recording task is paused or stopped.
- * @remarks An application can play or record again, but the interaction between device and user needs for doing it again. Because there is a possibility of a race condition between applications which try to play without the interaction
- */
- virtual void OnAudioSessionAudioFocusChanged(void) {}
-protected:
- //
- // This method is for internal use only. Using this method can cause behavioral, security-related,
- // and consistency-related issues in the application.
- //
- // This method is reserved and may change its name at any time without
- // prior notice.
- //
- // @since 2.0
- //
- virtual void IAudioSessionEventListener_Reserved1(void) {}
-
- //
- // This method is for internal use only. Using this method can cause behavioral, security-related,
- // and consistency-related issues in the application.
- //
- // This method is reserved and may change its name at any time without
- // prior notice.
- //
- // @since 2.0
- //
- virtual void IAudioSessionEventListener_Reserved2(void) {}
-
- //
- // This method is for internal use only. Using this method can cause behavioral, security-related,
- // and consistency-related issues in the application.
- //
- // This method is reserved and may change its name at any time without
- // prior notice.
- //
- // @since 2.0
- //
- virtual void IAudioSessionEventListener_Reserved3(void) {}
-
-};
-}} //Tizen::Media
-#endif
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMediaIAudioStreamFilter.h
+ * @brief This is the header file for the %IAudioStreamFilter interface.
+ *
+ * This header file contains the declarations of the %IAudioStreamFilter interface.
+ */
+
+#ifndef _FMEDIA_IAUDIO_STREAM_FILTER_H_
+#define _FMEDIA_IAUDIO_STREAM_FILTER_H_
+
+namespace Tizen { namespace Media
+{
+class AudioFrame;
+
+/**
+ * @interface IAudioStreamFilter
+ * @brief This interface represents a filter that process the audio stream data.
+ *
+ * @since 2.1
+ *
+ * The %IAudioStreamFilter interface represents a filter that process the audio stream data.
+*/
+class _OSP_EXPORT_ IAudioStreamFilter
+{
+
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when
+ * the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~IAudioStreamFilter(void) {}
+
+ /**
+ * Process a audio stream.
+ *
+ * @since 2.1
+ *
+ * @param[in,out] frame A frame object containing the audio frame data
+ * @remarks This method should not contain any operations that harm thread safety or performance degradation.
+ */
+ virtual void ProcessAudioStream(AudioFrame& frame) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IAudioStreamFilter_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IAudioStreamFilter_Reserved2(void) {}
+};
+
+}}// Tizen::Media
+
+#endif
public:
/**
- * This is the destructor for this class.
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
*
* @since 2.0
*/
* @param[in] r The cause of the error
* @exception E_SUCCESS The method is successful.
* @exception E_SYSTEM A system error has occurred.
+ * @exception E_INVALID_DATA The specified buffer contains invalid data.
* @exception E_CONNECTION_FAILED The network connection has failed.
- * @exception E_UNSUPPORTED_FORMAT The specified format is not supported.
- * @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
+ * @exception E_FILE_NOT_FOUND The file cannot be found or accessed.
+ * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @see Player::OpenFile(), Player::OpenUrl(), Player::OpenBuffer()
+ * @exception E_RIGHT_EXPIRED The right is expired.
+ * @exception E_RIGHT_NO_LICENSE The right does not exist.
+ * @exception E_RIGHT_FUTURE_USE The right is for future use.
+ * @see Player::OpenFile()
+ * @see Player::OpenUrl()
+ * @see Player::OpenBuffer()
*/
virtual void OnPlayerOpened(result r) = 0;
virtual void OnPlayerBuffering(int percent) = 0;
/**
- * Called when an error has occurs while the Player is working.
+ * Called when an error has occurred while the Player is working.
*
* @since 2.0
*
* @param[in] r A player error reason of type ::PlayerErrorReason
- * @remarks While playing streaming media, the player might throw an error like ::PLAYER_ERROR_CONNECTION_LOST
- * ::PLAYER_ERROR_STREAMING_TIMEOUT, ::PLAYER_ERROR_TRANSPORT or ::PLAYER_ERROR_SERVER. @n
+ * @remarks While playing streaming media, the player might throw an error like ::PLAYER_ERROR_CONNECTION_LOST,
+ * ::PLAYER_ERROR_STREAMING_TIMEOUT, ::PLAYER_ERROR_TRANSPORT, or ::PLAYER_ERROR_SERVER. @n
* If the content includes invalid data, ::PLAYER_ERROR_INVALID_DATA may occur.
* @see PlayerErrorReason
*/
/**
- * Called when the Player is being interrupted by a task of higher priority than the Player.
+ * Called when the Player is being interrupted by a task of higher priority than the %Player.
*
* @since 2.0
*/
* Called when an audio playback focus is changed to another application.
*
* @since 2.0
- * @remarks After the audio focus is being changed, the playback is paused or stopped and the state of this instance is changed to PLAYER_STATE_PAUSED or PLAYER_STATE_CLOSED.
- * @remarks An application can play again in the state of PLAYER_STATE_PAUSED but the interaction between device and user needs for playback again. Because there is a possibility of a race condition between applications which try to play without the interaction
+ * @remarks After the audio focus is being changed, the playback is paused or stopped and the state of this instance is changed to @c PLAYER_STATE_PAUSED or @c PLAYER_STATE_CLOSED.
+ * @remarks User interaction with the device is required for an application in @c PLAYER_STATE_PAUSED state to resume playing. This is to avoid the occurrence of a race condition among applications that try to play without user interaction.
* @remarks An application can not play again even in the state of PLAYER_STATE_PAUSED due to the application which has a higher priority.
*/
virtual void OnPlayerAudioFocusChanged(void) {}
/**
* @file FMediaIPlayerProgressiveDownloadListener.h
-* @brief This is the header file for the IPlayerProgressiveDownloadListener interface.
+* @brief This is the header file for the %IPlayerProgressiveDownloadListener interface.
*
-* This header files contains the common thing required for IPlayerProgressiveDownloadListener.
+* This header files contains the declarations of the %IPlayerProgressiveDownloadListener interface.
*
*/
#ifndef _FMEDIA_IPLAYER_PROGRESSIVE_DOWNLOAD_LISTENER_H_
{
public:
/**
- * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor@n
- * of this interface is called.
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when the destructor of this interface is called.
*
* @since 2.0
*/
virtual ~IPlayerProgressiveDownloadListener(void) { }
/**
- * Called when the progressive download started.
+ * Called when the progressive download has started.
*
* @since 2.0
*
- * @param[in] player A pointer to the Player instance that fired the event
+ * @param[in] player An instance of Player that fires the event
*/
virtual void OnPlayerProgressiveDownloadStarted(Player& player) = 0;
*
* @since 2.0
*
- * @param[in] player A pointer to the Player instance that fired the event
+ * @param[in] player An instance of Player that fires the event
* @param[in] downloadedSize The total downloaded size in bytes
* @param[in] totalSize The total size in bytes
*/
/**
- * Called when the progressive download completed.
+ * Called when the progressive download has completed.
*
* @since 2.0
*
- * @param[in] player A pointer to the Player instance that fired the event
- * @param[in] r The result of progressive download.
+ * @param[in] player An instance of Player that fires the event
+ * @param[in] r The result of progressive download
* @exception E_SUCCESS The method is successful.
* @exception E_STORAGE_FULL The storage is full.
* @exception E_INACCESSIBLE_PATH The file path is invalid to store media data.
*
* @since 2.0
*
- * @param[in] src A pointer to the Player instance that fired the event
- * @param[in] bitmapPixelFormat A pixel format type of the decoded video frame
+ * @param[in] src An instance of Player that fires the event
+ * @param[in] bitmapPixelFormat A pixel format type of the decoded video frame
* @param[in] dim A dimension of the decoded video frame
* @param[in] pBuffer A pointer to a decoded video frame buffer
* @param[in] sizeOfBuffer A size of a buffer
* @exception E_SYSTEM A system error has occurred.
* @exception E_INVALID_DATA The video frame has invalid blocks.
* @remarks The lifecycle of @c pBuffer is valid inside this method.
- * @see Player::Play(), Player::PlayAndPause(), Player::SeekTo()
+ * @see Player::Play()
+ * @see Player::PlayAndPause()
+ * @see Player::SeekTo()
*/
virtual void OnVideoFrameDecoded(Tizen::Media::Player& src, Tizen::Graphics::BitmapPixelFormat bitmapPixelFormat, const Tizen::Graphics::Dimension& dim, const byte* pBuffer, int sizeOfBuffer, result r) = 0;
virtual ~ITonePlayerEventListener(void) {}
/**
- * Called when the tone player reaches to the end of the tone or the end of the list of tones.
+ * Called when the tone player reaches the end of the tone or the end of the list of tones.
*
* @since 2.0
*
* @since 2.0
*
* @param[in] src An instance of TonePlayer that fires the event
- * @param[in] r A cause of the error
+ * @param[in] r The cause of the error
* @exception E_SYSTEM A system error has occurred.
*/
virtual void OnTonePlayerErrorOccurred(Tizen::Media::TonePlayer& src, result r) = 0;
*
* @since 2.0
*
- * @param[in] src A pointer to the TonePlayer instance that fired the event
- * @remarks After the audio focus is being changed, the playback is paused and the state of this instance is changed to TONE_PLAYER_STATE_PAUSED.
- * @remarks An application can play again in the state of TONE_PLAYER_STATE_PAUSED but the interaction between device and user needs for playback again. Because there is a possibility of a race condition between applications which try to play without the interaction
+ * @param[in] src An instance of TonePlayer that fires the event
+ * @remarks After the audio focus is being changed, the playback is paused and the state of this instance is changed to @c TONE_PLAYER_STATE_PAUSED.
+ * @remarks User interaction with the device is required for an application in @c TONE_PLAYER_STATE_PAUSED state to resume playing. This is to avoid the occurrence of a race condition among applications that try to play without user interaction.
* @remarks An application cannot start playback again even in the state of TONE_PLAYER_STATE_PAUSED due to other applications which have a higher priority.
*/
virtual void OnTonePlayerAudioFocusChanged(Tizen::Media::TonePlayer& src) {}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMediaIVideoStreamFilter.h
+ * @brief This is the header file for the %IVideoStreamFilter interface.
+ *
+ * This header file contains the declarations of the %IVideoStreamFilter interface.
+ */
+
+#ifndef _FMEDIA_IVIDEO_STREAM_FILTER_H
+#define _FMEDIA_IVIDEO_STREAM_FILTER_H
+
+namespace Tizen { namespace Media
+{
+class VideoFrame;
+
+/**
+ * @interface IVideoStreamFilter
+ * @brief This interface represents a filter that process the video stream data.
+ *
+ * @since 2.1
+ *
+ * The %IVideoStreamFilter interface represents a filter that process the video stream data.
+ *
+ */
+class _OSP_EXPORT_ IVideoStreamFilter
+{
+
+public:
+ /**
+ * This polymorphic destructor should be overridden if required. This way, the destructors of the derived classes are called when
+ * the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~IVideoStreamFilter(void) {}
+
+ /**
+ * Process a video frame.
+ *
+ * @since 2.1
+ *
+ * @param[in,out] frame A frame object containing the video frame data
+ * @remarks This method should not contain any operations that harm thread safety or performance degradation.
+ */
+ virtual void ProcessVideoStream(VideoFrame& frame) = 0;
+
+protected:
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IVideoStreamFilter_Reserved1(void) {}
+
+ //
+ // This method is for internal use only. Using this method can cause behavioral, security-related, and consistency-related issues in the application.
+ //
+ // This method is reserved and may change its name at any time without prior notice.
+ //
+ // @since 2.1
+ //
+ virtual void IVideoStreamFilter_Reserved2(void) {}
+};
+
+}}// Tizen::Media
+
+#endif
* @since 2.0
*
* The %MediaStreamInfo class provides methods to get media stream information, including:
- * - Content metadata, such as the title, artist, album title, genre, year, and album art.
+ * - %Content metadata, such as the title, artist, album title, genre, year, and album art.
* - Audio and video stream information.
*
* This class supports multiple stream content that consists of several audio or video tracks.
/**
* @if OSPDEPREC
* @namespace Tizen::Media::Openal
- * @brief <i> [Deprecated] </i>This namespace contains interfaces for %OpenAL.
+ * @brief <i> [Deprecated] </i>This namespace contains interfaces for %OpenAL.
* @deprecated This namespace is deprecated because libopenal/libalut open source libraries are supported directly on Tizen.
* @since 2.0
*
*
* The %OpenAL namespace provides %OpenAL (Version 1.1) methods and utilities.
* %OpenAL is a cross platform three-dimensional audio method. It can also be referred as a software interface to audio hardware.
- * The primary purpose of %OpenAL is to allow an application to position audio sources in three dimensional spaces around a listener, producing reasonable spatialization of the sources for the audio system.
+ * The primary purpose of %OpenAL is to allow an application to position audio sources in three-dimensional spaces around a listener, producing reasonable spatialization of the sources for the audio system.
* %OpenAL is appropriate for many audio applications, but is specifically designed for gaming audio.
- * The %OpenAL namespace provides %OpenAL Utility Toolkit (ALUT) features.
+ * This namespace provides %OpenAL Utility Toolkit (ALUT) features.
*
* For more information, see the <a href="http://connect.creativelabs.com/openal/default.aspx" target="_blank">Creative Labs Web site</a>.
* @endif
*
* @remarks After creating an instance of this class, the Construct() method must be called explicitly to
* initialize this instance.
- * @see Construct()
*/
Player(void);
/**
- * This destructor overrides Tizen::Base::Object::~Object().
+ * This destructor overrides Tizen::Base::Object::~Object(). @n
* This method deallocates the resources. This method must be called in the same thread as the Construct()
* method.
*
/**
* Opens an audio or video file to be played. @n
- * This method works synchronously, but when the second parameter, @c isAsync is set to @c true, this method works asynchronously.
+ * The %OpenFile() method works synchronously, but when the second parameter, @c isAsync is set to @c true, this method works asynchronously.
* Note that a method that works asynchronously must implement a listener.
*
* @if OSPCOMPAT
* @endif
* @since 2.0
* @if OSPCOMPAT
- * @compatibility This method has compatibility issues with OSP compatible applications. @n
+ * @compatibility This method has compatibility issues with %Tizen API versions@n
* For more information, see @ref CompIoPathPage "here".
* @endif
*
- * @return An error code
- * @param[in] mediaLocalPath The local file path of the media source
- * @param[in] isAsync Set to @c true for the asynchronous mode, @n
+ * @return An error code
+ * @param[in] mediaLocalPath The local file path of the media source
+ * @param[in] isAsync Set to @c true for the asynchronous mode, @n
* else @c false for the synchronous mode
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_SYSTEM A system error has occurred.
- * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
- * @exception E_INVALID_DATA The specified file contains invalid data.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE This instance is in an invalid state for this method.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_FILE_NOT_FOUND The specified file cannot be found or accessed.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
+ * @exception E_RIGHT_EXPIRED The right is expired.
+ * @exception E_RIGHT_NO_LICENSE The right does not exist.
+ * @exception E_RIGHT_FUTURE_USE The right is for future use.
* @see Close()
*/
result OpenFile(const Tizen::Base::String& mediaLocalPath, bool isAsync = false);
/**
* Opens an audio or video streaming content to play through the specified URL. @n
- * This method works synchronously, but when the second parameter @c isAsync is set to @c true,
+ * The %OpenUrl() method works synchronously, but when the second parameter @c isAsync is set to @c true,
* this method works asynchronously. Note that a method that works asynchronously must implement a listener.
*
* @since 2.0
*
* @return An error code
- * @param[in] mediaUri The URL of the media source
+ * @param[in] mediaUri The URI of the media source
* @param[in] isAsync Set to @c true for the asynchronous mode, @n
* else @c false for the synchronous mode
* @exception E_SUCCESS The method is successful.
* @exception E_CONNECTION_FAILED The network connection has failed.
* @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported.
* @exception E_SYSTEM A system error has occurred.
+ * @exception E_FILE_NOT_FOUND The remote file cannot be found or accessed.
+ * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
+ * @exception E_RIGHT_EXPIRED The right is expired.
+ * @exception E_RIGHT_NO_LICENSE The right does not exist.
+ * @exception E_RIGHT_FUTURE_USE The right is for future use.
* @remarks This method is not thread-safe when @c isAsync is @c false.
* @remarks Input URL should be encoded if there are non-alphanumeric characters in URL.
* @see Close()
/**
* Opens an audio or video content to play on the memory. @n
- * This method works synchronously, but when the second parameter @c isAsync is set to @c true, this method works asynchronously.
+ * The %OpenBuffer() method works synchronously, but when the second parameter @c isAsync is set to @c true, this method works asynchronously.
* Note that a method that works asynchronously must implement a listener.
*
* @since 2.0
*
- * @return An error code
- * @param[in] mediaBuffer A pointer to the media source in the external memory
- * @param[in] isAsync Set to @c true for asynchronous mode, @n
+ * @return An error code
+ * @param[in] mediaBuffer A pointer to the media source in the external memory
+ * @param[in] isAsync Set to @c true for asynchronous mode, @n
* else @c false for synchronous mode
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_SYSTEM A system error has occurred.
- * @exception E_OBJ_NOT_FOUND The specified media buffer cannot be found.
- * @exception E_INVALID_DATA The specified buffer contains invalid data.
- * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE This instance is in an invalid state for this method.
+ * @exception E_SYSTEM A system error has occurred.
+ * @exception E_OBJ_NOT_FOUND The specified media buffer cannot be found.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_UNSUPPORTED_FORMAT The given content format is not supported.
+ * @exception E_RIGHT_EXPIRED The right is expired.
+ * @exception E_RIGHT_NO_LICENSE The right does not exist.
+ * @exception E_RIGHT_FUTURE_USE The right is for future use.
* @see Close()
*/
result OpenBuffer(const Tizen::Base::ByteBuffer& mediaBuffer, bool isAsync = false);
/**
* Closes the audio or video content. @n
- * This method works synchronously.
+ * The %Close() method works synchronously.
*
* @since 2.0
*
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
- * @see OpenFile(), OpenBuffer(), OpenUrl()
+ * @see OpenFile()
+ * @see OpenBuffer()
+ * @see OpenUrl()
*/
result Close(void);
* @return An error code
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_DEVICE_BUSY The device cannot be approached because of other applications which have a higher priority.
+ * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
* @exception E_UNSUPPORTED_FORMAT The specified format is not supported.
* @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
* @exception E_SYSTEM A system error has occurred. @n
* E_SYSTEM is returned when unsupported format or codec media data are received during streaming. @n
* E_SYSTEM is returned when the unsupport resolution is set for rendering .
* @remarks When this method is called after the %Player instance is created with the Construct() method that accepts the IPlayVideoEventListener
- * interface as a parameter, it delivers every video frame of a video content continuously until the state is changed to PLAYER_STATE_ENDOFCLIP,
+ * interface as a parameter, it delivers every video frame of a video content continuously until the state is changed to @c PLAYER_STATE_ENDOFCLIP,
* or the Stop() or Pause() method is called .
- * @see Stop(), Pause(), IPlayerVideoEventListener
+ * @see Stop()
+ * @see Pause()
+ * @see IPlayerVideoEventListener
*/
result Play(void);
/**
- * Stops the playback of the audio or video content. This method works synchronously.
+ * Stops the playback of the audio or video content. @n
+ * The %Stop() method works synchronously.
*
* @since 2.0
*
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
* @remarks In the Real Time Streaming Protocol (RTSP), this method stops the media stream and requests the termination of the network session.
- * @see Play(), Pause()
+ * @see Play()
+ * @see Pause()
*/
result Stop(void);
/**
* Pauses the playback of the audio or video content. @n
- * To resume the playback, the Play() method must be called. This method works synchronously.
+ * To resume the playback, the Play() method must be called. The %Pause() method works synchronously.
*
* @since 2.0
*
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
- * @see Play(), Stop()
+ * @see Play()
+ * @see Stop()
*/
result Pause(void);
* @since 2.0
*
* @return The current state of the player
- * @see Close(), Play(), Stop(), Pause(), PlayerState
+ * @see Close()
+ * @see Play()
+ * @see Stop()
+ * @see Pause()
+ * @see PlayerState
*/
PlayerState GetState(void) const;
* Gets the time for the current playback position of the audio or video content. @n
* Accuracy of the retrieved time is determined by the subsystem (for example, the time slice of the OS scheduler,
* time resolution of the audio or video codec, or implementation of the audio or video player).
- * Note that it must not be assumed that this method can reach the exact position mentioned by GetDuration().
+ * Note that it must not be assumed that the %GetPosition() method can reach the exact position mentioned by GetDuration().
*
* @since 2.0
*
/**
* Seeks the current playback position of the audio or video content to the specified time. @n
- * This method works asynchronously. @n
+ * The %SeekTo() method works asynchronously. @n
* Note that a method that works asynchronously must implement a listener. @n
- * This method only works for the PLAYER_STATE_PLAYING, PLAYER_STATE_PAUSED and PLAYER_STATE_OPENED(local file/buffer playback only) states of the player. @n
+ * This method only works for the @c PLAYER_STATE_PLAYING, @c PLAYER_STATE_PAUSED, and @c PLAYER_STATE_OPENED(local file/buffer playback only) states of the player. @n
* This method changes the playback position as well as the time value. @n
* In video, it may not change position accurately.
*
* This method returns E_INVALID_STATE, if this method is called again before
* IPlayerEventListener::OnPlayerSeekCompleted() is called.
* @exception E_OUT_OF_RANGE The specified time is out of range.
- * @exception E_INVALID_DATA The media data is inappropriate for seeking.
+ * @exception E_OPERATION_FAILED The operation is failed.
* @exception E_SYSTEM A system error has occurred.
* @remarks For video, this method delivers one video frame on the specified position through the video
* event. Before calling this method, the %Player instance must be created with the Construct()
* method has a parameter of the IPlayVideoEventListener interface .
- * @see GetPosition(), IPlayerVideoEventListener
+ * @see GetPosition()
+ * @see IPlayerVideoEventListener
*/
result SeekTo(long msTime);
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @remarks The specific error code can be accessed using the GetLastResult() method. @n
* While playing live streaming, this operation returns @c 0.
- * @remarks This method is valid in the playing and paused state of this instance.
+ * @remarks This method is valid in @c PLAYER_STATE_OPENED @c PLAYER_STATE_PLAYING @c PLAYER_STATE_PAUSED @c PLAYER_STATE_STOPPED player states
* @see GetPosition()
*/
long GetDuration(void) const;
* @param[in] volume The new value of volume @n
* The range of this parameter is @c 0 to @c 100 and it is proportional to the current media sound volume level in setting.
* @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified volume is out of range.
+ * @exception E_OUT_OF_RANGE The specified @c volume is out of range.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @see GetVolume(), IsMuted(), SetMute()
+ * @see GetVolume()
+ * @see IsMuted()
+ * @see SetMute()
*/
result SetVolume(int volume);
*
* @return The current volume level @n
* The range of this return value is @c 0 to @c 100.
- * @see SetVolume(), IsMuted(), SetMute()
+ * @see SetVolume()
+ * @see IsMuted()
+ * @see SetMute()
*/
int GetVolume(void) const;
* else @c false
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @see GetVolume(), SetVolume(), IsMuted()
+ * @see GetVolume()
+ * @see SetVolume()
+ * @see IsMuted()
*/
result SetMute(bool mute);
*
* @return @c true if the audio or video player is muted, @n
* else @c false
- * @see GetVolume(), SetVolume(), SetMute()
+ * @see GetVolume()
+ * @see SetVolume()
+ * @see SetMute()
*/
bool IsMuted(void) const;
/**
* Sets an audio or video player to be in a loop. @n
- * Set the looping to @c true to continuously play the audio or video content.
+ * Sets the looping to @c true to continuously play the audio or video content.
*
* @since 2.0
*
* else @c false
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @remarks In streaming, this method throws E_INVALID_STATE for the cost of network.
+ * @remarks In streaming, this method throws @c E_INVALID_STATE for the cost of network.
* @see IsLooping()
*/
result SetLooping(bool looping);
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_INVALID_CONTENT The content is inappropriate to compose media stream information.
* @exception E_SYSTEM A system error has occurred.
- * @remarks This method returns a stream information of the media, which is currently being played.
+ * @remarks This method returns a stream information of the media, which is currently being opened.
* The specific error code can be accessed using the GetLastResult() method.
- * This method must be called after Play() to get the correct data.
- * @see MediaStreamInfo
+ * This method is valid in @c PLAYER_STATE_OPENED @c PLAYER_STATE_PLAYING @c PLAYER_STATE_PAUSED @c PLAYER_STATE_STOPPED player states
*/
MediaStreamInfo* GetCurrentMediaStreamInfoN(void) const;
* @exception E_INVALID_ARG The specified input parameter is invalid.
* @exception E_SYSTEM A system error has occurred. @n
* E_SYSTEM is returned when the unsupport resolution is set for rendering .
- * @remarks This method works for the PLAYER_STATE_OPENED, PLAYER_STATE_ENDOFCLIP, PLAYER_STATE_STOPPED, PLAYER_STATE_PAUSED, and PLAYER_STATE_PLAYING states of the player.
- * @remarks This method throws E_INVALID_STATE after the player instance is constructed with IPlayerVideoEventListener.
+ * @remarks This method works for the @c PLAYER_STATE_OPENED, @c PLAYER_STATE_ENDOFCLIP, @c PLAYER_STATE_STOPPED, @c PLAYER_STATE_PAUSED, and @c PLAYER_STATE_PLAYING states of the player.
+ * @remarks This method throws @c E_INVALID_STATE after the player instance is constructed with IPlayerVideoEventListener.
*/
result SetRenderingBuffer(const Tizen::Graphics::BufferInfo& bufferInfo);
* @exception E_RESOURCE_UNAVAILABLE The player's resources are unavailable.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @remarks This method constructs the %Player instance to render the video content into the buffer of the video event listener.
- * @see IPlayerVideoEventListener
*/
result Construct(IPlayerEventListener& listener, IPlayerVideoEventListener& videoListener);
/**
* Captures the video frame. @n
- * This method delivers one video frame of a video content by using the IPlayVideoEventListener interface only once in the %Player instance. @n
- * This method works only for the PLAYER_STATE_OPENED state of the %Player instance, and the state of the %Player instance is changed to PLAYER_STATE_PAUSED from PLAYER_STATE_OPENED after calling this method.
+ * The %CaptureVideo() method delivers one video frame of a video content by using the IPlayVideoEventListener interface only once in the %Player instance. @n
+ * This method works only for the @c PLAYER_STATE_OPENED state of the %Player instance, and the state of the %Player instance is changed to @c PLAYER_STATE_PAUSED from @c PLAYER_STATE_OPENED after calling this method.
*
* @since 2.0
*
* @exception E_INVALID_OPERATION This method is invalid for the current media content.
* @exception E_SYSTEM A system error has occurred.
* @remarks In the Real Time Streaming Protocol (RTSP), this method does not work properly.
- * @see IPlayerVideoEventListener
*/
result CaptureVideo(void);
/**
- * Sets audio stream type
+ * Sets the audio stream type.
*
* @since 2.0
*
* @return An error code
* @param[in] type An audio stream type
* @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
*/
result SetAudioStreamType(AudioStreamType type);
/**
- * Opens an audio or video streaming content to play through the specified URL with the HTTP header.@n
- * This method works asynchronously, thus application can call further APIs of %Player after IPlayerEventListener::OnPlayerOpened() is called.
+ * Opens an audio or video streaming content to play through the specified URL with the HTTP header. @n
+ * The %OpenUrlAsync() method works asynchronously, thus application can call further methods of %Player after IPlayerEventListener::OnPlayerOpened() is called.
*
* @since 2.0
*
* @return An error code
* @param[in] url The URL of the media source
* @param[in] pHeader The list of field and value pairs that will be added in HTTP request header. @n
- The types of field and value are described in the Programming Guide. If @c null, then default values will be set
+ The types of field and value are described in the Programming Guide. If @c null, then default values will be set.
*
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @remarks See Programming Guide for the detail information of supported HTTP header fields.
* @remarks Input URL should be encoded if there are non-alphanumeric characters in URL.
/**
* Opens an audio or video streaming content to play through the specified HTTP URL with the HTTP header for the progressive download playback. @n
- * This method works asynchronously, thus application can call further APIs of %Player after IPlayerEventListener::OnPlayerOpened() is called.
- * The content information of the media source should be located at the beginning of the file for the progressive download playback. Otherwise, it does not guarantee to play and download media stream properly.
+ * The %OpenUrlAsync() method works asynchronously, thus application can call further methods of %Player after IPlayerEventListener::OnPlayerOpened() is called.
+ * The content information of the media source must be located at the beginning of the file for the progressive download playback. Otherwise, it does not guarantee to play and download media stream properly.
*
* @since 2.0
*
* @return An error code
* @param[in] url The URL of the media source
- * @param[in] filePath The file path on local file system that the downloaded content will be saved.
+ * @param[in] filePath The file path on local file system where the downloaded content will be saved
* @param[in] listener The download listener
- * @param[in] pHeader The list of field and value pairs that will be added in HTTP request header. @n
- The types of field and value are described in the Programming Guide.
- If @c null, then default values will be set..
+ * @param[in] pHeader The list of field and value pairs that will be added in HTTP request header @n
+ * The types of field and value are described in the Programming Guide.
+ * If @c null, then default values will be set.
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_UNSUPPORTED_PROTOCOL The protocol is not supported.
- * @exception E_INVALID_ARG The specified input parameter is invalid.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
* @exception E_OUT_OF_MEMORY The memory is insufficient.
- * @remarks Download will start when Play() is called.
+ * @remarks The download will start when Play() is called.
* @remarks If the specified file name already exists, then the old file will be overwritten with the new one.
* @remarks See Programming Guide for the detail information of supported HTTP header fields.
* @remarks Input URL should be encoded if there are non-alphanumeric characters in URL.
- * @see Close(), Play()
+ * @see Close()
*/
result OpenUrlAsync(const Tizen::Base::String& url, const Tizen::Base::String& filePath, IPlayerProgressiveDownloadListener& listener, const Tizen::Base::Collection::IMap* pHeader = null);
/**
- * Sets the interval of calling the progress event
+ * Sets the interval of calling the progress event.
*
* @since 2.0
*
- * @param[in] percent The progress period interval as a percentage value.
+ * @param[in] percent The progress period interval as a percentage value
* @remark If the server does not provide the information about the content size, progress event will occur randomly.
* @remarks If the percentage value is not set, @c 10 will be set as a default value.
- * @see OnPlayerProgressiveDownloadInProgress(), IPlayerProgressiveDownloadListener
+ * @see IPlayerProgressiveDownloadListener::OnPlayerProgressiveDownloadInProgress()
*/
void SetProgressiveDownloadIntervalByPercent(int percent);
/**
* @file FMediaPlayerTypes.h
- * @brief This is the header file for the Player class.
+ * @brief This is the header file for the enumerations of the Player class.
*
* This header file contains the declarations of the enumerations of the Player class.
*/
PLAYER_STATE_INITIALIZED, /**< The player is initialized */
PLAYER_STATE_OPENING, /**< The player opening behavior is processed */
PLAYER_STATE_OPENED, /**< The source is opened */
- PLAYER_STATE_ENDOFCLIP, /**< The player has reached to the end of the clip */
+ PLAYER_STATE_ENDOFCLIP, /**< The player has reached the end of the clip */
PLAYER_STATE_STOPPED, /**< The player has stopped and has no current play-time, but the media content is still opened and initialized */
PLAYER_STATE_PAUSED, /**< The player playback is paused */
PLAYER_STATE_PLAYING, /**< The player is playing the media content */
PLAYER_ERROR_SERVER, /**< The server has failed */
PLAYER_ERROR_OUT_OF_MEMORY, /**< The memory is insufficient*/
PLAYER_ERROR_DEVICE_FAILED, /**< The player device has failed */
+ PLAYER_ERROR_RIGHT_EXPIRED, /**< The right has expired */
+ PLAYER_ERROR_RIGHT_NO_LICENSE, /**< The content has no right */
+ PLAYER_ERROR_RIGHT_FUTURE_USE, /**< The right is for future use */
};
}} // Tizen::Media
{
public:
/**
- * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
+ * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
*
* @since 2.0
*
* @remarks After creating an instance of this class, one of the Construct() methods must be called explicitly to initialize this instance.
- * @see Construct()
*/
Tone(void);
/**
- * This destructor overrides Tizen::Base::Object::~Object().
+ * This destructor overrides Tizen::Base::Object::~Object(). @n
* The resources are deallocated by this method.
* This method must be called in the same thread as the Construct() method.
*
public:
/**
* @if OSPDEPREC
- * Initializes this instance of %Tone with the values of the specified tone.
+ * Initializes this instance of %Tone with the values of the specified tone.
*
* @brief <i> [Deprecated] </i>
* @deprecated This method is deprecated because this method is not used as 2-phase constructor.
*
* @return An error code
* @param[in] firstFrequency The first frequency of the dual tone in hertz (Hz) @n
- * The range of this parameter is @c 0 Hz ~ @c 15000 Hz.
+ * The range of this parameter is @c 0 Hz to @c 15000 Hz.
* @param[in] secondFrequency The second frequency of the dual tone in hertz (Hz) @n
- * The range of this parameter is @c 0 Hz ~ @c 15000 Hz.
+ * The range of this parameter is @c 0 Hz to @c 15000 Hz.
* @param[in] duration The duration of the tone in milliseconds @n
* The value of this parameter must be greater than @c 0.
* @exception E_SUCCESS The method is successful.
long GetDuration(void) const;
/**
- * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
- *
+ * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor. @n
+ *
* Initializes this instance of %Tone with the values of the specified tone.
*
* @since 2.0
*
* @param[in] firstFrequency The first frequency of the dual tone in hertz (Hz) @n
- * The range of this parameter is @c 0 Hz ~ @c 15000 Hz.
+ * The range of this parameter is @c 0 Hz to @c 15000 Hz.
* @param[in] secondFrequency The second frequency of the dual tone in hertz (Hz) @n
- * The range of this parameter is @c 0 Hz ~ @c 15000 Hz.
+ * The range of this parameter is @c 0 Hz to @c 15000 Hz.
* @param[in] duration The duration of the tone in milliseconds @n
* The value of this parameter must be greater than @c 0.
* @remarks If both the input frequencies are @c 0 Hz, the tone is set as a silent tone.
Tone(int firstFrequency, int secondFrequency, long duration);
/**
- * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
+ * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor. @n
* Initializes this instance of %Tone with the values of the specified DTMF preset tone.
*
* @since 2.0
*
* @return @c true if the values match, @n
* else @c false
- * @param[in] rhs The other Object to be compared
- * @see Object::Equals()
+ * @param[in] rhs The other Tizen::Base::Object to compare
+ * @see Tizen::Base::Object::Equals()
*/
virtual bool Equals(const Object& rhs) const;
*
* @since 2.0
*
- * @return The current instance's hash value
+ * @return The hash value of the current instance
*/
virtual int GetHashCode(void) const;
*
* @remarks After creating an instance of this class, the Construct() method must be
* called explicitly to initialize this instance
- * @see Construct()
*/
TonePlayer(void);
*
* @since 2.0
*
- * @see Construct()
*/
virtual ~TonePlayer(void);
* @exception E_OUT_OF_MEMORY The memory is insufficient.
* @exception E_OUT_OF_RANGE The count is out of range.
* @exception E_SYSTEM A system error has occurred.
- * @remarks The item(s) of the specified @c toneList should be an instance(s) of Tone.
+ * @remarks The item(s) of the specified @c toneList must be an instance(s) of Tone.
* @see Close()
*/
result Open(const Tizen::Base::Collection::IList& toneList, int repeatCount = 1);
/**
* Plays the playback or resumes the playback if Pause() has been called. @n
- * In case of the TONE_PLAYER_STATE_END_OF_TONE state, the tone(s) can be played again.
+ * In case of the @c TONEPLAYER_STATE_ENDOFTONE state, the tone(s) can be played again.
*
* @since 2.0
*
* @exception E_SYSTEM A system error has occurred.
* @remarks The playback starts from the current position. If playback is paused, playback restarts from
* the last position.
- * @see Stop(), Pause()
+ * @see Stop()
+ * @see Pause()
*/
result Play(void);
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
- * @see Play(), Pause()
+ * @see Play()
+ * @see Pause()
*/
result Stop(void);
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
* @exception E_SYSTEM A system error has occurred.
- * @see Play(), Stop()
+ * @see Stop()
*/
result Pause(void);
* @since 2.0
*
* @return An error code
- * @param[in] volume The new value for volume @n
+ * @param[in] volume The new value for @c volume @n
* The range of this parameter is @c 0 to @c 100 and it is proportional to the current media sound volume level in setting.
* @exception E_SUCCESS The method is successful.
* @exception E_OUT_OF_RANGE The specified @c volume parameter is out of range.
result SetVolume(int volume);
/**
- * Gets the current volume level
+ * Gets the current volume level.
*
* @since 2.0
*
TonePlayerState GetState(void) const;
/**
- * Sets audio stream type for tone playback
+ * Sets an audio stream type for tone playback.
*
* @since 2.0
*
* @param[in] type An audio stream type
* @exception E_SUCCESS The method is successful.
* @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @exception E_INVALID_ARG The specified input parameter is invalid.
* @remarks This method should be called before Open().
*/
result SetAudioStreamType(AudioStreamType type);
DTMF_PRESET_B, /**< The DTMF tone for key B: 1633Hz, 770Hz */
DTMF_PRESET_C, /**< The DTMF tone for key C: 1633Hz, 852Hz */
DTMF_PRESET_D, /**< The DTMF tone for key D: 1633Hz, 941Hz */
- DTMF_PRESET_P, /**< The DTMF tone for key #: 1477Hz, 941Hz */
- DTMF_PRESET_S, /**< The DTMF tone for key *: 1209Hz, 941Hz */
+ DTMF_PRESET_P, /**< The DTMF tone for key P(#): 1477Hz, 941Hz */
+ DTMF_PRESET_S, /**< The DTMF tone for key S(*): 1209Hz, 941Hz */
};
}} // Tizen::Media
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMediaVideoFrame.h
+ * @brief This is the header file for the %VideoFrame class.
+ *
+ * This header file contains the declarations of the %VideoFrame class.
+ */
+
+#ifndef _FMEDIA_VIDEO_FRAME_H_
+#define _FMEDIA_VIDEO_FRAME_H_
+
+#include <FBase.h>
+#include <FMediaTypes.h>
+
+namespace Tizen { namespace Media
+{
+
+/**
+ * @class VideoFrame
+ * @brief This class has the video frame data.
+ *
+ * @final This class is not intended for extension.
+ *
+ * @since 2.1
+ *
+ * The %VideoFrame class has the video frame data.
+ * The frame has several plane components which represents each color of YUV. @n
+ * This object is delivered to the application by IVideoStreamFilter::ProcessVideoStream() when the video stream is coming.
+ *
+ * The following example demonstrates how to use the %VideoFrame class.
+ *
+ * @code
+ * #include <FBase.h>
+ * #include <FMedia.h>
+ *
+ * using namespace Tizen::Graphics;
+ * using namespace Tizen::Ui;
+ * using namespace Tizen::Ui::Controls;
+ * using namespace Tizen::Media;
+ *
+ * class VideoFrameSample
+ * : public Tizen::Ui::Controls::Form
+ * , public Tizen::Media::ICameraEventListener
+ * , public Tizen::Media::IVideoStreamFilter
+ * {
+ * public:
+ * VideoFrameSample(void);
+ * result Start(void);
+ * void Stop(void);
+ *
+ * protected:
+ * virtual void OnCameraAutoFocused(bool completeCondition) {}
+ * virtual void OnCameraPreviewed( Tizen::Base::ByteBuffer& previewedData, result r) {}
+ * virtual void OnCameraCaptured( Tizen::Base::ByteBuffer& capturedData, result r) {}
+ * virtual void OnCameraErrorOccurred(CameraErrorReason r ) {}
+ * virtual void ProcessVideoStream(VideoFrame &frame);
+ *
+ * private:
+ * Camera __camera;
+ * OverlayRegion * __pOverlay;
+ * };
+ *
+ * VideoFrameSample::VideoFrameSample(void)
+ * {
+ * __pOverlay = null;
+ * }
+ *
+ * result
+ * VideoFrameSample::Start(void)
+ * {
+ * result r = E_SUCCESS;
+ * Rectangle rect(0, 0, 320, 240);
+ * bool modified = false;
+ * bool isValid = false;
+ * BufferInfo bufferInfo;
+ *
+ * r = __camera.Construct(*this, CAMERA_PRIMARY);
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * r = __camera.PowerOn();
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * r = __camera.AddVideoStreamFilter(*this);
+ * if (IsFailed(r))
+ * {
+ * return r;
+ * }
+ *
+ * isValid = OverlayRegion::EvaluateBounds(OVERLAY_REGION_EVALUATION_OPTION_LESS_THAN, rect, modified);
+ * if (isValid != true)
+ * {
+ * return GetLastResult();
+ * }
+ *
+ * // Gets OverlayRegion from this Form
+ * __pOverlay = GetOverlayRegionN(rect, OVERLAY_REGION_TYPE_PRIMARY_CAMERA);
+ * if (__pOverlay == null)
+ * {
+ * return GetLastResult();
+ * }
+ *
+ * __pOverlay->GetBackgroundBufferInfo(bufferInfo);
+ *
+ * r = __camera.StartPreview(&bufferInfo, true);
+ * if (IsFailed(r))
+ * {
+ * goto CATCH;
+ * }
+ *
+ * return E_SUCCESS;
+ * CATCH:
+ * if (__pOverlay)
+ * {
+ * delete __pOverlay;
+ * __pOverlay = null;
+ * }
+ * return r;
+ * }
+ *
+ * void
+ * VideoFrameSample::Stop(void)
+ * {
+ * __camera.StopPreview();
+ * __camera.PowerOff();
+ * if (__pOverlay)
+ * {
+ * delete __pOverlay;
+ * __pOverlay = null;
+ * }
+ * }
+ *
+ * void
+ * VideoFrameSample::ProcessVideoStream(VideoFrame &frame)
+ * {
+ * MediaPixelFormat format = frame.GetPixelFormat();
+ * int count = frame.GetPlaneCount();
+ * int width = frame.GetWidth();
+ * int height = frame.GetHeight();
+ *
+ * for (int i=0; i<count; i++)
+ * {
+ * switch(frame.GetPlaneType(i))
+ * {
+ * case VIDEO_PLANE_TYPE_Y:
+ * // manipulate Y plane.
+ * break;
+ * case VIDEO_PLANE_TYPE_U:
+ * // manipulate U plane.
+ * break;
+ * case VIDEO_PLANE_TYPE_V:
+ * // manipulate V plane.
+ * break;
+ * case VIDEO_PLANE_TYPE_YUV:
+ * // manipulate YUV plane, which YUV data exists in linear memory space. Check pixel format to detect the order of YUV data.
+ * break;
+ * case VIDEO_PLANE_TYPE_UV:
+ * // manipulate UV plane, which UV data exists in linear memory space. Check pixel format to detect the order or UV data.
+ * break;
+ * default:
+ * break;
+ * }
+ * }
+ *
+ * @endcode
+ *
+ *
+ */
+class _OSP_EXPORT_ VideoFrame
+ : public Tizen::Base::Object
+{
+public:
+ /**
+ *
+ * Gets the plane count which the frame data has.
+ *
+ * @since 2.1
+ *
+ * @return The plane count
+ *
+ */
+ int GetPlaneCount(void) const;
+
+ /**
+ *
+ * Gets the video plane type at the specified index from the frame.
+ *
+ * @since 2.1
+ *
+ * @return The video plane type, @n
+ * else ::VIDEO_PLANE_TYPE_NONE if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ *
+ */
+ VideoPlaneType GetPlaneType(int index) const;
+
+ /**
+ *
+ * Gets the plane data at the specified index from the frame.
+ *
+ * @since 2.1
+ *
+ * @return The plane data, @n
+ * else @null if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The buffer in ByteBuffer is shared with @c VideoFrame instance. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ *
+ */
+ Tizen::Base::ByteBuffer* GetPlaneData(int index) const;
+
+ /**
+ *
+ * Gets the bytes count per a line of the specified index plane.
+ *
+ * @since 2.1
+ *
+ * @return The number of bytes per a line of the plane, @n
+ * else @c 0 if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ *
+ */
+ int GetBytesCountPerLine(int index) const;
+
+ /**
+ *
+ * Gets the width of the frame.
+ *
+ * @since 2.1
+ *
+ * @return The width of the frame
+ *
+ */
+ int GetWidth(void) const;
+
+ /**
+ *
+ * Gets the height of the frame.
+ *
+ * @since 2.1
+ *
+ * @return The height of the frame
+ *
+ */
+ int GetHeight(void) const;
+
+ /**
+ *
+ * Gets the pixel format of the frame.
+ *
+ * @since 2.1
+ *
+ * @return The pixel format of the frame
+ *
+ */
+ MediaPixelFormat GetPixelFormat(void) const;
+
+private:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.1
+ * @remarks The object is not fully constructed after this constructor is called. For full construction,
+ * the Construct() method must be called right after calling this constructor.
+ */
+ VideoFrame(void);
+
+ /**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ * @since 2.1
+ */
+ virtual ~VideoFrame(void);
+
+ /**
+ * Constructs the instance of this class. @n
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ *
+ */
+ result Construct(void);
+
+ /**
+ * This is the copy constructor for this class.
+ *
+ * @since 2.1
+ *
+ * @remarks The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ VideoFrame(const VideoFrame& rhs);
+
+ /**
+ * This is the copy assignment operator for this class.
+ *
+ * @since 2.1
+ *
+ * @remarks The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ *
+ */
+ VideoFrame& operator =(const VideoFrame& rhs);
+
+ friend class _VideoStreamCoordinator;
+ friend class _VideoFrameImpl;
+ class _VideoFrameImpl* __pImpl;
+
+};
+
+}}// Tizen::Media
+
+#endif
#include <FBaseObject.h>
#include <FMediaImageBuffer.h>
+#include <FMediaRecorderTypes.h>
namespace Tizen { namespace Media {
*/
static ImageBuffer* GetFrameN(const Tizen::Base::String& path, MediaPixelFormat pixelFormat, long timestamp);
+ /**
+ * Gets the current recording rotation of video data. @n
+ *
+ * @since 2.1
+ *
+ * @return Recording rotation information of the current video data.
+ */
+ RecordingRotation GetRecordingRotation(void) const;
+
+
private:
/**
* This is the copy constructor for this class.
{
class _VideoRecorderImpl;
+class IAudioStreamFilter;
/**
* @class VideoRecorder
* @compatibility This method has compatibility issues with OSP compatible applications. @n
* For more information, see @ref CompIoPathPage "here".
* @endif
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] destMediaPath The destination for the file that is written @n
* This is a synchronous method.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Resumes the recording if Pause() has been called.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Stops the recording.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* To resume the recording after the %Pause() method is called, Record() must be called.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Cancels the recording operation without saving the data.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @exception E_SUCCESS The method is successful.
* Sets the time limit for the recording in milliseconds.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] msTime The maximum recording time in milliseconds @n
* Instead of using this method, use the SetFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container) method that
* sets the audio/video codec and container together.
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] codec The codec name @n
* Instead of using this method, use the SetFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container) method that sets
* the audio/video codec and container together.
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] format The video format @n
* Instead of using this method, use the SetFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container) method that
* determines whether the video recorder includes the audio codec.
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] mode The mode for the recording @n
* Initially, the default codec and container format are set with the internal configuration.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] audioCodec The audio codec to set @n
* Sets the quality of the recorder.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] quality The quality of the recorder @n
* Initially, the default resolution from the internal configuration is set.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] resolution The recording resolution @n
* Sets the mute state of a recorder.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] mute Set to @c true to enable the mute state of the recorder, @n
* Sets the recording rotation of the recorder.
*
* @since 2.0
- * @privilege %http://tizen.org/privilege/videorecorder
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/videorecorder
*
* @return An error code
* @param[in] rotation The rotation of the recorder
*/
RecordingRotation GetRecordingRotation(void) const;
+ /**
+ * Adds the stream filter to process the audio stream data while recording.
+ *
+ * @since 2.1
+ * @privilevel public
+ * @privilege http://tizen.org/privilege/videorecorder
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ * @remarks IAudioStreamFilter::ProcessAudioStream() will be called when the audio frame is ready.
+ */
+ result AddAudioStreamFilter(IAudioStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop processing the audio stream data.
+ *
+ * @since 2.1
+ * @privilevel public
+ * @privilege http://tizen.org/privilege/videorecorder
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
+ */
+ result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
+
private:
/**
* This is the copy constructor for this class.
*/
enum VideoRecorderMode
{
- VIDEORECORDER_MODE_VIDEO_WITH_AUDIO, /**< @if OSPDEPREC The video with audio mode @endif */
- VIDEORECORDER_MODE_VIDEO_ONLY, /**< @if OSPDEPREC The video only mode @endif */
+ VIDEORECORDER_MODE_VIDEO_WITH_AUDIO, /**< The video with audio mode*/
+ VIDEORECORDER_MODE_VIDEO_ONLY, /**< The video only mode*/
};
}}
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FMediaVoipAudioSessionManager.h
- * @brief This is the header file for the %VoipAudioSessionManager class.
- *
- * This header file contains the declarations of the %VoipAudioSessionManager class.
- */
-
-#ifndef _FMEDIA_VOIP_AUDIO_SESSION_MANAGER_H_
-#define _FMEDIA_VOIP_AUDIO_SESSION_MANAGER_H_
-
-#include <FMediaAudioManagerTypes.h>
-
-namespace Tizen { namespace Media
-{
-/**
- * @if VISPARTNER
- * @class VoipAudioSessionManager
- * @brief This class is used to manage audio session for VoIP call.
- * The audio system related operation will be performed based on the VoIP call scenario with the methods of this class.
- * As the precondition, all media-related instances MUST be destroyed before this class is used.
- *
- * @since 2.0
- *
- * @final This class is not intended for extension.
- *
- * @visibility partner
- *
- * @remarks Only one instance of the class works at a time.
- * @endif
- */
-class _OSP_EXPORT_ VoipAudioSessionManager
- :public Tizen::Base::Object
-{
-public:
- /**
- * @if VISPARTNER
- * Gets the VoIP audio session manager instance's pointer.
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.voipsession
- *
- * @return A pointer to the VoIP audio session manager instance, @n
- else @c null if it fails
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_MEMORY Not enough memory to perform the operation
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks The specific error code can be accessed using the GetLastResult() method.
- * @endif
- */
- static VoipAudioSessionManager* GetInstance(void);
-
- /**
- * @if VISPARTNER
- * Enters a new VoIP call session
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.voipsession
- *
- * @return An error code
- * @exception E_SUCCESS The method is successful
- * @exception E_OUT_OF_MEMORY Not enough memory to make a VoIP call
- * @exception E_INVALID_STATE This instance is in an invalid state for this method
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks The method returns E_INVALID_STATE when this method is called more than once.
- * @remarks All media-related instances MUST be destroyed before entering the VoIP call audio session.@n
- if not, this method returns E_INVALID_STATE.
- * @endif
- */
- result EnterCallSession(void);
-
- /**
- * @if VISPARTNER
- * Sets the VoIP call session's current operation mode such as voice calling, ringing, or playing media stream.
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.voipsession
- *
- * @return An error code
- * @param[in] mode The VoIP audio session mode
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_INVALID_ARG A specified input parameter is invalid
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks This method should be called after EnterCallSession(), if not, this method returns E_INVALID_STATE.
- * @endif
- */
- result SetCallSessionMode(VoipAudioSessionMode mode);
-
- /**
- * @if VISPARTNER
- * Gets the current VoIP call session mode
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.voipsession
- *
- * @return VoIP audio session mode,@n
- or returns VOIP_AUDIO_SESSION_MODE_NONE when this method fail.
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks If exception is occured then this method returns VOIP_CALL_SESSION_MODE_NONE
- * @remarks This method should be called after EnterCallSession(), if not, this method returns E_INVALID_STATE.
- * @endif
- */
- VoipAudioSessionMode GetCallSessionMode(void) const;
-
- /**
- * @if VISPARTNER
- * Exits current VoIP call session
- *
- * @since 2.0
- *
- * @visibility partner
- * @privilege %http://tizen.org/privilege/audiomanager.voipsession
- *
- * @return An error code
- * @exception E_SUCCESS The method is successful
- * @exception E_INVALID_STATE This instance is in an invalid state for this method.
- * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method
- * @remarks This method should be called after EnterCallSession(), if not, this method returns E_INVALID_STATE.
- * @endif
- */
- result ExitCallSession(void);
-
-private:
- /**
- * @if VISPARTNER
- * This default constructor is intentionally declared as private to implement the Singleton semantic.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- VoipAudioSessionManager(void);
-
- /**
- * @if VISPARTNER
- * This destructor is intentionally declared as private to implement the Singleton semantic.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- virtual ~VoipAudioSessionManager(void);
-
- /**
- * @if VISPARTNER
- * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- VoipAudioSessionManager(const VoipAudioSessionManager& rhs);
-
- /**
- * @if VISPARTNER
- * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit assigning of objects.
- *
- * @since 2.0
- *
- * @visibility partner
- * @endif
- */
- VoipAudioSessionManager& operator =(const VoipAudioSessionManager& rhs);
-
- class _VoipAudioSessionManagerImpl* __pVoipAudioSessionManagerImpl;
-
-};
-
-}} // Tizen::Media
-
-#endif
Name: osp-media
Summary: The Media library of OSP
-Version: 1.2.0.0
+Version: 1.2.1.0
Release: 1
Group: TO_BE/FILLED_IN
License: TO BE FILLED IN
Tizen::Base::Collection::IListT<MediaPropertyType>*
AudioDecoder::GetSupportedPropertyListN(void) const
{
- result r = E_SUCCESS;
Tizen::Base::Collection::IListT<MediaPropertyType> *pList = null;
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
pList = __pImpl->GetSupportedPropertyListN();
- SysTryCatch(NID_MEDIA, pList != null, , GetLastResult(), "[%s] Propagating", GetErrorMessage(GetLastResult()));
+ SysTryReturn(NID_MEDIA, pList != null, null , GetLastResult(), "[%s] Propagating", GetErrorMessage(GetLastResult()));
SetLastResult(E_SUCCESS);
return pList;
-
-CATCH:
- return null;
}
bool
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMediaAudioFrame.cpp
+ * @brief This file contains the implementation of the %AudioFrame class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FMediaAudioFrame.h>
+#include "FMedia_AudioFrameImpl.h"
+
+using namespace Tizen::Base;
+
+namespace Tizen { namespace Media
+{
+
+AudioFrame::AudioFrame(void)
+ : __pImpl(null)
+{
+
+}
+
+AudioFrame::~AudioFrame(void)
+{
+ delete __pImpl;
+}
+
+result
+AudioFrame::Construct(void)
+{
+ SysAssertf(__pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ result r = E_SUCCESS;
+
+ std::unique_ptr<_AudioFrameImpl> pImpl(new (std::nothrow) _AudioFrameImpl());
+ SysTryReturn(NID_MEDIA, pImpl.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ __pImpl = pImpl.release();
+ return r;
+}
+
+int
+AudioFrame::GetPlaneCount(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetPlaneCount();
+}
+
+AudioChannelType
+AudioFrame::GetChannelType(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetChannelType();
+}
+
+AudioSampleType
+AudioFrame::GetSampleType(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetSampleType();
+}
+
+int
+AudioFrame::GetSamplingRate(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetSamplingRate();
+}
+
+Tizen::Base::ByteBuffer*
+AudioFrame::GetPlaneData(int index) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetPlaneData(index);
+}
+
+}}// Tizen::Media
}
result
+AudioRecorder::AddAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_AUDIORECORDER);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->AddAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+AudioRecorder::RemoveAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_AUDIORECORDER);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->RemoveAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+
+ return r;
+}
+
+result
AudioRecorder::Close(void)
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License)
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <FBaseSysLog.h>
-#include <FSec_AccessController.h>
-#include <FMediaAudioManagerTypes.h>
-#include <FMediaAudioSessionManager.h>
-#include "FMedia_AudioSessionManagerImpl.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Security;
-
-namespace Tizen { namespace Media
-{
-
-AudioSessionManager::AudioSessionManager(void)
-{
- __pAudioSessionManagerImpl = _AudioSessionManagerImpl::GetInstance();
-}
-
-AudioSessionManager::~AudioSessionManager(void)
-{
- if (__pAudioSessionManagerImpl != null)
- {
- __pAudioSessionManagerImpl = null;
- }
-}
-
-AudioSessionManager*
-AudioSessionManager::GetInstance(void)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_SESSION);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- static AudioSessionManager audioSessionManager;
- return (&audioSessionManager);
-
-CATCH:
- return null;
-
-}
-
-result
-AudioSessionManager::SetAudioSessionEventListener(IAudioSessionEventListener* pListener)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_SESSION);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pAudioSessionManagerImpl->SetAudioSessionEventListener(pListener);
-}
-
-result
-AudioSessionManager::SetMode(AudioSessionMode sessionMode)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_SESSION);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pAudioSessionManagerImpl->SetMode(sessionMode);
-}
-
-AudioSessionMode
-AudioSessionManager::GetMode(void) const
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_SESSION);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pAudioSessionManagerImpl->GetMode();
-
-CATCH:
- return (AudioSessionMode) -1;
-}
-
-};
-};
Camera::~Camera()
{
- if (__pImpl != null)
- {
- delete __pImpl;
- }
+ delete __pImpl;
}
result
return CAMERA_METERING_MODE_NONE;
}
+result
+Camera::SetSceneMode(CameraSceneMode sceneMode)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_CAMERA);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->SetSceneMode(sceneMode);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+CameraSceneMode
+Camera::GetSceneMode(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+ CameraSceneMode mode = CAMERA_SCENE_OFF;
+ ClearLastResult();
+
+ mode = __pImpl->GetSceneMode();
+ r = GetLastResult();
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return mode;
+
+CATCH:
+ return CAMERA_SCENE_OFF;
+}
+
+result
+Camera::AddVideoStreamFilter(IVideoStreamFilter& filter)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_CAMERA);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->AddVideoStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+Camera::RemoveVideoStreamFilter(IVideoStreamFilter& filter)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_CAMERA);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->RemoveVideoStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
}}// Tizen::Media
const wchar_t* const CAMERA_PRIMARY_FLASH_MODE = L"Camera.Primary.FlashMode";
const wchar_t* const CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT = L"Camera.Primary.DefaultPreviewFormat";
const wchar_t* const CAMERA_PRIMARY_METERING_MODE = L"Camera.Primary.MeteringMode";
+const wchar_t* const CAMERA_PRIMARY_SCENE_MODE = L"Camera.Primary.SceneMode";
const wchar_t* const CAMERA_SECONDARY_CAPTURE_FORMAT = L"Camera.Secondary.CaptureFormat";
const wchar_t* const CAMERA_SECONDARY_CAPTURE_RESOLUTION = L"Camera.Secondary.CaptureResolution";
const wchar_t* const CAMERA_SECONDARY_FLASH_MODE = L"Camera.Secondary.FlashMode";
const wchar_t* const CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT = L"Camera.Secondary.DefaultPreviewFormat";
const wchar_t* const CAMERA_SECONDARY_METERING_MODE = L"Camera.Secondary.MeteringMode";
+const wchar_t* const CAMERA_SECONDARY_SCENE_MODE = L"Camera.Secondary.SceneMode";
const wchar_t* const PLAYER_AUDIO_CODEC = L"Player.AudioCodec";
const wchar_t* const PLAYER_COUNT_MAX = L"Player.CountMax";
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMediaVideoFrame.cpp
+ * @brief This file contains the implementation of the %VideoFrame class.
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FMediaVideoFrame.h>
+#include "FMedia_VideoFrameImpl.h"
+
+using namespace Tizen::Base;
+
+namespace Tizen { namespace Media
+{
+
+VideoFrame::VideoFrame(void)
+: __pImpl(null)
+{
+
+}
+
+VideoFrame::~VideoFrame(void)
+{
+ delete __pImpl;
+}
+
+result
+VideoFrame::Construct(void)
+{
+ SysAssertf(__pImpl == null, "Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
+ result r = E_SUCCESS;
+
+ std::unique_ptr <_VideoFrameImpl> pImpl (new (std::nothrow) _VideoFrameImpl());
+ SysTryReturn(NID_MEDIA, pImpl.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ __pImpl = pImpl.release();
+ return r;
+}
+
+int
+VideoFrame::GetPlaneCount(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetPlaneCount();
+}
+
+VideoPlaneType
+VideoFrame::GetPlaneType(int index) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetPlaneType(index);
+}
+
+Tizen::Base::ByteBuffer*
+VideoFrame::GetPlaneData(int index) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetPlaneData(index);
+}
+
+int
+VideoFrame::GetBytesCountPerLine(int index) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetBytesCountPerLine(index);
+}
+
+int
+VideoFrame::GetWidth(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetWidth();
+}
+
+int
+VideoFrame::GetHeight(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetHeight();
+}
+
+MediaPixelFormat
+VideoFrame::GetPixelFormat(void) const
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+
+ return __pImpl->GetPixelFormat();
+}
+
+}}// Tizen::Media
{
delete __pImpl;
__pImpl = null;
- }
+ }
}
result
"Not yet constructed. Construct() should be called before use.");
return __pImpl->GetHeight();
-
}
long
"Not yet constructed. Construct() should be called before use.");
return __pImpl->GetFrameN(timestamp);
-
}
ImageBuffer*
VideoFrameExtractor::GetFrameN(const Tizen::Base::String& path, MediaPixelFormat pixelFormat, long timestamp )
{
- return _VideoFrameExtractorImpl::GetFrameN(path, pixelFormat, timestamp);
+ return _VideoFrameExtractorImpl::GetFrameN(path, pixelFormat, timestamp);
+}
+
+RecordingRotation
+VideoFrameExtractor::GetRecordingRotation(void) const
+{
+ SysAssertf(__pImpl != null,
+ "Not yet constructed. Construct() should be called before use.");
+ return __pImpl->GetRecordingRotation();
}
}} // Tizen::Media
}
result
+VideoRecorder::AddAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_VIDEORECORDER);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->AddAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+VideoRecorder::RemoveAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+ result r = E_SUCCESS;
+
+ r = _AccessController::CheckUserPrivilege(_PRV_VIDEORECORDER);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED]. This application does not have the privilege to call this method.");
+
+ r = __pImpl->RemoveAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
VideoRecorder::Close(void)
{
SysAssertf(__pImpl != null, "Not yet constructed. Construct() should be called before use.");
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License)
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <FBase.h>
-#include <FBaseSysLog.h>
-#include <FSec_AccessController.h>
-#include <FMediaAudioManagerTypes.h>
-#include <FMediaVoipAudioSessionManager.h>
-#include "FMedia_VoipAudioSessionManagerImpl.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Runtime;
-using namespace Tizen::Security;
-
-namespace Tizen { namespace Media
-{
-
-
-VoipAudioSessionManager::VoipAudioSessionManager()
-{
- __pVoipAudioSessionManagerImpl = _VoipAudioSessionManagerImpl::GetInstance();
-}
-
-VoipAudioSessionManager::~VoipAudioSessionManager()
-{
- if (__pVoipAudioSessionManagerImpl != null)
- {
- __pVoipAudioSessionManagerImpl = null;
- }
-}
-
-VoipAudioSessionManager*
-VoipAudioSessionManager::GetInstance(void)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- static VoipAudioSessionManager voipSessionManager;
- return (&voipSessionManager);
-
-CATCH:
- return null;
-}
-
-result
-VoipAudioSessionManager::EnterCallSession(void)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pVoipAudioSessionManagerImpl->EnterCallSession();
-}
-
-
-result
-VoipAudioSessionManager::ExitCallSession(void)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pVoipAudioSessionManagerImpl->ExitCallSession();
-}
-
-result
-VoipAudioSessionManager::SetCallSessionMode(VoipAudioSessionMode mode)
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_PRIVILEGE_DENIED, E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pVoipAudioSessionManagerImpl->SetCallSessionMode(mode);
-}
-
-VoipAudioSessionMode
-VoipAudioSessionManager::GetCallSessionMode(void) const
-{
- result r = E_SUCCESS;
-
- r = _AccessController::CheckUserPrivilege(_PRV_AUDIOMANAGER_VOIPSESSION);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , E_PRIVILEGE_DENIED, "[E_PRIVILEGE_DENIED] This application does not have the privilege to call this method.");
-
- return __pVoipAudioSessionManagerImpl->GetCallSessionMode();
-
-CATCH:
- return (VoipAudioSessionMode) -1;
-}
-
-};
-};
#include <FBaseSysLog.h>
#include <FBaseInteger.h>
#include "FMedia_Ffmpeg.h"
+#include "FMedia_FfmpegUtil.h"
#include "FMedia_IAudioDecoder.h"
#include "FMedia_AacDecoder.h"
#include "FMedia_BitWriter.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Io;
using namespace Tizen::Base::Collection;
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));
__pCodec = avcodec_find_decoder(CODEC_ID_AAC);
SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_AAC",GetErrorMessage(E_SYSTEM));
+ "[%s] Find Decoder Failed for CODEC_ID_AAC",GetErrorMessage(E_SYSTEM));
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
+ "[%s] Context Allcoation Failed",GetErrorMessage(E_SYSTEM));
if (pOption != null)
{
// The initialization values are given in the Hashmap
- std::unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
+ unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
if (pMapEnum.get() != null)
{
- while (pMapEnum.get()->MoveNext() == E_SUCCESS)
+ while (pMapEnum->MoveNext() == E_SUCCESS)
{
- pKey = static_cast<Integer*>(pMapEnum.get()->GetKey());
- pValue = static_cast<Integer*>(pMapEnum.get()->GetValue());
+ pKey = static_cast<Integer*>(pMapEnum->GetKey());
+ pValue = static_cast<Integer*>(pMapEnum->GetValue());
if (pKey && pValue)
{
key = pKey->ToInt();
case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
SysTryCatch(NID_MEDIA, !(value < 0), r = E_OUT_OF_RANGE, E_OUT_OF_RANGE,
- "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
+ "[%s] Invalid argument: %d", GetErrorMessage(E_OUT_OF_RANGE), value);
__pCodecCtx->sample_rate = value;
break;
}
__pCodecCtx->sample_fmt = AV_SAMPLE_FMT_S16;
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] AVCODEC Codec Open Failed for CODEC_ID_AAC",GetErrorMessage(E_SYSTEM));
return r;
}
-const ByteBuffer*
+ByteBuffer*
_AacDecoder::GetHeaderN(int sampleRate, int channels, int size, int pce_size)
{
- ByteBuffer* pBuf = null;
result r = E_SUCCESS;
+ unique_ptr<ByteBuffer> pBuf(new (std::nothrow) ByteBuffer());
- pBuf = new (std::nothrow) ByteBuffer();
-
- if (pBuf == null)
- {
- return null;
- }
+ SysTryReturn(NID_MEDIA, pBuf.get() != null, null, E_OUT_OF_MEMORY, "new ByteBuffer() failed");
r = pBuf->Construct(ADTS_HEADER_SIZE);
- if (r != E_SUCCESS)
- {
- delete pBuf;
- return null;
- }
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] ByteBuffer.Construct(%d) failed", GetErrorMessage(r), ADTS_HEADER_SIZE);
_BitWriter bw((byte*)pBuf->GetPointer(),pBuf->GetCapacity());
int sampleRateIndex = 0x0b;
pBuf->SetPosition(0);
r = pBuf->SetLimit(ADTS_HEADER_SIZE);
- if (r != E_SUCCESS)
- {
- delete pBuf;
- return null;
- }
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] ByteBuffer.SetLimit(%d) failed", GetErrorMessage(r), ADTS_HEADER_SIZE);
- return pBuf;
+ return pBuf.release();
}
result
_AacDecoder::Decode(const byte* pSrcBuf, int srcBufSize, int& srcBufUsed,
byte* pDstBuf, int dstBufSize, int& dstBufUsed)
{
- result r = E_SUCCESS;
int res = 0;
AVPacket inputPacket;
int outBufSize = 0;
- int16_t* pOutBuf = null;
- int errStrLen = 256;
- char errStr[errStrLen];
- uint8_t* pInputData = null;
- const ByteBuffer* pAdtsHeader = null;
+ unique_ptr<AVFrame, _FfmpegDeleter> pOutFrame(avcodec_alloc_frame(), ffmpegDeleter);
+ int gotFrame = 0;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, (pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0),
- r = E_INVALID_ARG, E_INVALID_ARG, "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
+ SysTryReturnResult(NID_MEDIA, __pCodecCtx != null, E_INVALID_STATE, "The instance is in invalid state");
+ SysTryReturnResult(NID_MEDIA, (pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0),
+ E_INVALID_ARG, "Invalid argument. pSrcBuf(0x%x), srcBufSize(%d), pDstBuf(0x%x), dstBufSize",
+ pSrcBuf, srcBufSize, pDstBuf, dstBufSize);
+ SysTryReturnResult(NID_MEDIA, pOutFrame.get() != null, E_OUT_OF_MEMORY, "avcodec_alloc_frame() failed");
av_init_packet(&inputPacket);
inputPacket.size = srcBufSize;
inputPacket.data = (uint8_t*)pSrcBuf;
- if (dstBufSize >= DEFAULT_BUFFER_SIZE)
- {
- pOutBuf = (int16_t*)pDstBuf;
- outBufSize = dstBufSize;
- }
- else
- {
- pOutBuf = (int16_t*)__pOutBuf;
- outBufSize = DEFAULT_BUFFER_SIZE;
- }
-
// Decoding the Audio packet
- res = avcodec_decode_audio3(__pCodecCtx, pOutBuf, &outBufSize, &inputPacket);
+ res = avcodec_decode_audio4(__pCodecCtx, pOutFrame.get(), &gotFrame, &inputPacket);
// add adts header and try to decode
if ( res < 0 && !((pSrcBuf[0] == 0xff) && ((pSrcBuf[1] & 0xf6) == 0xf0)))
{
- pInputData = new (std::nothrow) uint8_t[srcBufSize + ADTS_HEADER_SIZE];
- SysTryCatch(NID_MEDIA, pInputData != null, r = E_OUT_OF_MEMORY,
- E_OUT_OF_MEMORY, "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
- pAdtsHeader = GetHeaderN(__pCodecCtx->sample_rate,__pCodecCtx->channels,srcBufSize,0);
- if (pAdtsHeader)
- {
- memcpy(pInputData,pAdtsHeader->GetPointer(),ADTS_HEADER_SIZE);
- memcpy(pInputData + ADTS_HEADER_SIZE ,pSrcBuf,srcBufSize);
- inputPacket.size = srcBufSize + ADTS_HEADER_SIZE;
- inputPacket.data = pInputData;
- res = avcodec_decode_audio3(__pCodecCtx, pOutBuf, &outBufSize, &inputPacket);
- delete pAdtsHeader;
- pAdtsHeader = null;
- }
- delete []pInputData;
- pInputData = null;
+ unique_ptr<uint8_t[]> pInputData(new (std::nothrow) uint8_t[srcBufSize + ADTS_HEADER_SIZE]);
+ unique_ptr<ByteBuffer> pAdtsHeader(GetHeaderN(__pCodecCtx->sample_rate,__pCodecCtx->channels, srcBufSize, 0));
+
+ SysTryReturnResult(NID_MEDIA, pInputData.get() != null, E_OUT_OF_MEMORY, "new byte[%d] failed", srcBufSize + ADTS_HEADER_SIZE);
+ SysTryReturnResult(NID_MEDIA, pAdtsHeader.get() != null, E_OUT_OF_MEMORY,
+ "ADTS header generate failed:%d %d %d", __pCodecCtx->sample_rate,__pCodecCtx->channels, srcBufSize);
+
+ memcpy(pInputData.get(),pAdtsHeader->GetPointer(), ADTS_HEADER_SIZE);
+ memcpy(pInputData.get() + ADTS_HEADER_SIZE, pSrcBuf, srcBufSize);
+ inputPacket.size = srcBufSize + ADTS_HEADER_SIZE;
+ inputPacket.data = pInputData.get();
+ res = avcodec_decode_audio4(__pCodecCtx, pOutFrame.get(), &gotFrame, &inputPacket);
}
- SysTryCatch(NID_MEDIA,(res > 0 && outBufSize > 0), r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The instance is not available ",GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryCatch(NID_MEDIA,dstBufSize >= outBufSize, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
- dstBufUsed = outBufSize; // The decoded audio data size
- srcBufUsed = res; //Input bytes used
+ SysTryReturnResult(NID_MEDIA, (res > 0 && gotFrame > 0), E_UNSUPPORTED_FORMAT, "decode audio failed:%d", res);
+
if (inputPacket.size == (srcBufSize + ADTS_HEADER_SIZE))
{
dstBufUsed = outBufSize; // The decoded audio data size
srcBufUsed = res; //Input bytes used
}
- if ( pDstBuf != (byte*)pOutBuf)
+ if (gotFrame)
{
- memcpy(pDstBuf, pOutBuf, outBufSize);
- }
- __decodeCalled = true;
- return r;
+ outBufSize = av_samples_get_buffer_size(NULL, __pCodecCtx->channels, pOutFrame->nb_samples, __pCodecCtx->sample_fmt, 1);
-CATCH:
- if (res < 0)
- {
- res = av_strerror(res, errStr, errStrLen);
- if (!res)
- {
- SysLog(NID_MEDIA, "Error is %s. %d ", errStr, res);
+ SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
+
+ dstBufUsed = outBufSize; // The decoded audio data size
+ memcpy(pDstBuf, pOutFrame->data[0], outBufSize);
}
+ else
+ {
+ dstBufUsed = 0;
}
- return r;
+
+ __decodeCalled = true;
+ return E_SUCCESS;
}
result
Tizen::Media::AudioChannelType& channelType, int& sampleRate)
{
result r = E_SUCCESS;
- int res = 0;
- AVPacket inputPacket;
- int outBufSize = 0;
- int16_t* pOutBuf = null;
-
-
- SysTryCatch(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, (pSrcBuf != null && srcBufLength > 0), r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
-
- av_init_packet(&inputPacket);
-
- inputPacket.data = (uint8_t*) pSrcBuf;
- inputPacket.size = srcBufLength;
+ unique_ptr<byte[]> pDstBuf(new (std::nothrow) byte[DEFAULT_BUFFER_SIZE]);
+ int srcBufUsed = 0;
+ int dstBufUsed = 0;
- pOutBuf = (int16_t*)__pOutBuf;
- outBufSize = DEFAULT_BUFFER_SIZE;
-
- // Decoding the Audio packet
- res = avcodec_decode_audio3(__pCodecCtx, pOutBuf, &outBufSize, &inputPacket);
- SysTryCatch(NID_MEDIA, (res > 0 && outBufSize > 0) , r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));
- switch (__pCodecCtx->channels)
- {
- case 0:
- channelType = AUDIO_CHANNEL_TYPE_NONE;
- break;
+ SysTryReturnResult(NID_MEDIA, pDstBuf.get() != null, E_OUT_OF_MEMORY, "new byte[%d] failed", DEFAULT_BUFFER_SIZE);
- case 1:
- channelType = AUDIO_CHANNEL_TYPE_MONO;
- break;
-
- case 2:
- channelType = AUDIO_CHANNEL_TYPE_STEREO;
- break;
-
- default:
- break;
- }
-
- switch (__pCodecCtx->sample_fmt)
- {
- case AV_SAMPLE_FMT_NONE:
- // fall through
- case AV_SAMPLE_FMT_S32:
- // fall through
- case AV_SAMPLE_FMT_FLT:
- // fall through
- case AV_SAMPLE_FMT_DBL:
- // fall through
- case AV_SAMPLE_FMT_NB:
- sampleType = AUDIO_TYPE_NONE;
- break;
-
- case AV_SAMPLE_FMT_U8:
- sampleType = AUDIO_TYPE_PCM_U8;
- break;
-
- case AV_SAMPLE_FMT_S16:
- sampleType = AUDIO_TYPE_PCM_S16_LE;
- break;
-
- default:
- sampleType = AUDIO_TYPE_NONE;
- break;
- }
+ r = Decode(pSrcBuf, srcBufLength, srcBufUsed, pDstBuf.get(), DEFAULT_BUFFER_SIZE, dstBufUsed);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Decode() failed", GetErrorMessage(r));
+ channelType = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
+ sampleType = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
sampleRate = __pCodecCtx->sample_rate;
- __decodeCalled = true;
- return r;
-CATCH:
- return r;
+ SysTryReturnResult(NID_MEDIA, channelType != AUDIO_CHANNEL_TYPE_NONE, E_UNSUPPORTED_FORMAT, "Unknown channel type:%d", __pCodecCtx->channels);
+ SysTryReturnResult(NID_MEDIA, sampleType != AUDIO_TYPE_NONE, E_UNSUPPORTED_FORMAT, "Unknown sample type:%d", __pCodecCtx->sample_fmt);
+ SysTryReturnResult(NID_MEDIA, sampleRate > 0, E_UNSUPPORTED_FORMAT, "Unknown sample rate:%d", __pCodecCtx->sample_rate);
+
+ return E_SUCCESS;
}
result
_AacDecoder::Reset(void)
{
- result r = E_SUCCESS;
- SysTryCatch(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
+ SysTryReturnResult(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), E_INVALID_STATE, "The instance is in invalid state");
avcodec_flush_buffers(__pCodecCtx);
__decodeCalled = false;
- return r;
-CATCH:
- return r;
+ return E_SUCCESS;
}
result
_AacDecoder::GetValue(MediaPropertyType type, int& value) const
{
- result r = E_SUCCESS;
- SysTryCatch(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, 0 < type, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
- SysTryCatch(NID_MEDIA, __decodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
+ SysTryReturnResult(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), E_INVALID_STATE, "The instance is in invalid state");
+ SysTryReturnResult(NID_MEDIA, 0 < type, E_INVALID_ARG, "Invalid argument: type=%d", type);
+ SysTryReturnResult(NID_MEDIA, __decodeCalled, E_INVALID_STATE, "No decoding or probing has performed.");
switch (type)
{
case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
- switch (__pCodecCtx->channels)
- {
- case 0:
- value = AUDIO_CHANNEL_TYPE_NONE;
- break;
-
- case 1:
- value = AUDIO_CHANNEL_TYPE_MONO;
- break;
-
- case 2:
- value = AUDIO_CHANNEL_TYPE_STEREO;
- break;
-
- default:
- break;
- }
- break;
+ value = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
+ break;
case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
- switch (__pCodecCtx->sample_fmt)
- {
- case AV_SAMPLE_FMT_NONE:
- // fall through
- case AV_SAMPLE_FMT_S32:
- // fall through
- case AV_SAMPLE_FMT_FLT:
- // fall through
- case AV_SAMPLE_FMT_DBL:
- // fall through
- case AV_SAMPLE_FMT_NB:
- value = AUDIO_TYPE_NONE;
- break;
-
- case AV_SAMPLE_FMT_U8:
- value = AUDIO_TYPE_PCM_U8;
- break;
-
- case AV_SAMPLE_FMT_S16:
- value = AUDIO_TYPE_PCM_S16_LE;
- break;
-
- default:
- value = AUDIO_TYPE_NONE;
- break;
- }
- break;
+ value = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
+ break;
case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
value = __pCodecCtx->sample_rate;
- break;
+ break;
default:
return E_OBJ_NOT_FOUND;
- break;
+ break;
}
- return r;
-
-CATCH:
- return r;
+ return E_SUCCESS;
}
result
_AacDecoder::GetValue(MediaPropertyType type, float& value) const
{
- result r = E_SUCCESS;
- SysTryCatch(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type < 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
- SysTryCatch(NID_MEDIA, type < MEDIA_PROPERTY_VIDEO_WIDTH || type >= MEDIA_PROPERTY_AUDIO_SAMPLE_RATE,
- r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND,
- "[%s] The instance is not available ",GetErrorMessage(E_OBJ_NOT_FOUND));
- SysTryCatch(NID_MEDIA, __decodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
+ SysTryReturnResult(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), E_INVALID_STATE, "The instance is in invalid state");
+ SysTryReturnResult(NID_MEDIA, 0 < type, E_INVALID_ARG, "Invalid argument: type=%d", type);
+ SysTryReturnResult(NID_MEDIA, __decodeCalled, E_INVALID_STATE, "No decoding or probing has performed.");
return E_OBJ_NOT_FOUND;
-
-CATCH:
- return r;
}
Tizen::Base::Collection::IListT<MediaPropertyType>*
virtual bool IsPropertySupported(MediaPropertyType type) const;
- const Tizen::Base::ByteBuffer* GetHeaderN(int sampleRate, int channels, int size, int pce_size);
+ Tizen::Base::ByteBuffer* GetHeaderN(int sampleRate, int channels, int size, int pce_size);
+
private:
static const int DEFAULT_BUFFER_SIZE = 192000;
/ SAMPLE_SIZE * __pCodecCtx->sample_rate;
}
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] avcodec open failed:%d", GetErrorMessage(E_SYSTEM), res);
{
result r = E_SUCCESS;
int res = 0;
- int outIndex = 0;
int samples = 0;
int minSrcBufLength = 0;
int minDstBufLength = FF_MIN_BUFFER_SIZE;
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <stdio.h>
-#include <unique_ptr.h>
-#include <FBaseColArrayListT.h>
-#include <FBaseInteger.h>
-#include <FBaseColHashMap.h>
-#include <FMediaTypes.h>
-#include <FMediaAudioTypes.h>
-#include <FBaseSysLog.h>
-#include "FMedia_Ffmpeg.h"
-#include "FMedia_FfmpegUtil.h"
-#include "FMedia_IAudioDecoder.h"
-#include "FMedia_AlawDecoder.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Base::Collection;
-
-namespace Tizen { namespace Media
-{
-
-_IAudioDecoder*
-_AlawDecoder_CreateInstance(void)
-{
- return new (std::nothrow) _AlawDecoder();
-}
-
-_AlawDecoder::_AlawDecoder(void)
-{
- __pCodecCtx = null;
- __pCodec = null;
- __decodeCalled = false;
- __pOutBuf = null;
- __decoderConfigured = false;
-}
-
-_AlawDecoder::~_AlawDecoder(void)
-{
- if (__pCodecCtx != null)
- {
- avcodec_close(__pCodecCtx);
- av_free(__pCodecCtx);
- }
- if (__pOutBuf != null)
- {
- delete[] __pOutBuf;
- }
-}
-
-result
-_AlawDecoder::Construct(const Tizen::Base::Collection::HashMap* pOption)
-{
- result r = E_SUCCESS;
- int res = 0;
- Integer* pKey = null;
- Integer* pValue = null;
- int key = -1;
- int value = -1;
-
- SysAssertf((__pCodecCtx == null && __pCodec == null), " Already Constructed .");
- SysTryReturnResult(NID_MEDIA, pOption != null, E_INVALID_ARG, "pOtion is null");
-
- avcodec_register_all();
-
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));
- __pCodec = avcodec_find_decoder(CODEC_ID_PCM_ALAW);
- SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_PCM_ALAW",GetErrorMessage(E_SYSTEM));
-
- if (pOption != null)
- {
- // The initialization values are given in the Hashmap
- std::unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
- if (pMapEnum.get() != null)
- {
- while (pMapEnum.get()->MoveNext() == E_SUCCESS)
- {
- pKey = static_cast<Integer*>(pMapEnum.get()->GetKey());
- pValue = static_cast<Integer*>(pMapEnum.get()->GetValue());
- if (pKey && pValue)
- {
- key = pKey->ToInt();
- value = pValue->ToInt();
- switch (key)
- {
- case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
- SysTryCatch(NID_MEDIA, (value == 0 || value == 1 || value == 2), r = E_OUT_OF_RANGE,
- E_OUT_OF_RANGE, "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
- __pCodecCtx->channels = value;
- __decoderConfigured = true;
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
- SysTryCatch(NID_MEDIA, !(value < 0), r = E_OUT_OF_RANGE, E_OUT_OF_RANGE,
- "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
- __pCodecCtx->sample_rate = value;
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
- SysTryCatch(NID_MEDIA, !(value < 0), r = E_OUT_OF_RANGE, E_OUT_OF_RANGE,
- "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
- __pCodecCtx->sample_fmt = _FfmpegUtil::ToAvSampleFormat((AudioSampleType)value);
- break;
-
- default:
- break;
- }
- }
- } // while
-
- }
- }
-
- SysTryReturnResult(NID_MEDIA, __pCodecCtx->channels != 0, E_INVALID_ARG, "Channel is not set");
- SysTryReturnResult(NID_MEDIA, __pCodecCtx->sample_rate != 0, E_INVALID_ARG, "Sample rate is not set");
- SysTryReturnResult(NID_MEDIA, __pCodecCtx->sample_fmt != AV_SAMPLE_FMT_NONE, E_INVALID_ARG, "Sample type is not set");
-
- res = avcodec_open(__pCodecCtx, __pCodec);
- SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Codec Open Failed for CODEC_ID_PCM_ALAW",GetErrorMessage(E_SYSTEM));
-
- // AVCodecContext parameters
- if (__pCodec->capabilities & CODEC_CAP_TRUNCATED)
- {
- __pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
- }
-
- __pCodecCtx->debug_mv = 0; //set by user
- __pCodecCtx->debug = 0; //set by user
- __pCodecCtx->workaround_bugs = 1; //set by user
- __pCodecCtx->lowres = 0; //set by user
-
- __pOutBuf = new (std::nothrow) byte[MIN_OUT_BUFFER_SIZE];
- SysTryCatch(NID_MEDIA, __pOutBuf != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
-
- return r;
-
-CATCH:
- if (__pCodecCtx != null)
- {
- avcodec_close(__pCodecCtx);
- av_free(__pCodecCtx);
- __pCodecCtx = null;
- __pCodec = null;
- }
- if (__pOutBuf != null)
- {
- delete[] __pOutBuf;
- __pOutBuf = null;
- }
- return r;
-}
-
-result
-_AlawDecoder::Decode(const byte* pSrcBuf, int srcBufSize, int& srcBufUsed,
- byte* pDstBuf, int dstBufSize, int& dstBufUsed)
-{
- result r = E_SUCCESS;
- int res = 0;
- AVPacket inputPacket;
- int outBufSize = 0;
- byte* pOutBuf = null;
- int offSet = 0;
-
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0,
- r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
-
- // This blocks reads the input data format , i.e channel count and format type is read.
- // No error checkin id done here as we are trying to get the channel count if user wont specify
-#if 0
- if (__decoderConfigured == false)
- {
-
- _WavFormatInfo wavFormatInfo;
- _RiffFileHeader riffHdr;
- _RiffChunkHeader chunkHdr;
-
- if ( srcBufSize > _MIN_WAVE_HEADER_SIZE )
- {
- memcpy(&riffHdr, pSrcBuf, sizeof(riffHdr)); // file header of 12 bytes
- offSet += sizeof(riffHdr);
- memcpy(&chunkHdr, pSrcBuf + offSet, sizeof(chunkHdr)); // format sub chunk header of 8 bytes
- offSet += sizeof(chunkHdr);
- memcpy(&wavFormatInfo, pSrcBuf + offSet, sizeof(wavFormatInfo)); // format sub chunk consists of wave info 16 bytes
- offSet += sizeof(wavFormatInfo);
- // assign to codec context if it is mono or stereo
- if ( riffHdr.chunkId == _RIFF_CHUNK_ID && riffHdr.format== _RIFF_FORMAT_WAVE )
- {
- __pCodecCtx->channels = wavFormatInfo.channels;
- __decoderConfigured = true;
- // Data starts in next sub chunk
- memcpy(&chunkHdr, pSrcBuf + offSet, sizeof(chunkHdr)); // data sub chunk header of 8 bytes
- offSet += sizeof(chunkHdr); // offset is now at data start
- }
- else
- {
- offSet = 0; // Header info is not available
- }
-
- }
-
- }
-#endif
-
- av_init_packet(&inputPacket);
-
- inputPacket.size = srcBufSize -offSet;
- inputPacket.data = (uint8_t*)pSrcBuf + offSet;
-
- if (dstBufSize >= MIN_OUT_BUFFER_SIZE)
- {
- pOutBuf = pDstBuf;
- outBufSize = dstBufSize;
- }
- else
- {
- pOutBuf = __pOutBuf;
- outBufSize = MIN_OUT_BUFFER_SIZE;
- }
-
- SysTryCatch(NID_MEDIA, __decoderConfigured == true, r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));
- res = avcodec_decode_audio3(__pCodecCtx, (int16_t*)pOutBuf, &outBufSize, &inputPacket);
- SysTryCatch(NID_MEDIA, (res > 0 && outBufSize > 0), r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));
-
- SysTryCatch(NID_MEDIA, dstBufSize >= outBufSize, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
-
- dstBufUsed = outBufSize; // the decoded audio data size
- srcBufUsed = res + offSet; // // input bytes used + offset header that is skipped
- if (pOutBuf != pDstBuf)
- {
- memcpy(pDstBuf, pOutBuf, outBufSize);
- }
- __decodeCalled = true;
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_AlawDecoder::Probe(const byte* pSrcBuf, const int srcBufSize,
- AudioSampleType& sampleType, AudioChannelType& channelType, int& sampleRate)
-{
- result r = E_SUCCESS;
- int dstBufUsed = 0;
- int srcBufUsed = 0;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, pSrcBuf != null && srcBufSize > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
-
- r = Decode(pSrcBuf, srcBufSize, srcBufUsed, __pOutBuf, MIN_OUT_BUFFER_SIZE, dstBufUsed);
-
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Decode failed", GetErrorMessage(r));
-
- channelType = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
- sampleType = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
- sampleRate = __pCodecCtx->sample_rate;
-
- SetLastResult(E_SUCCESS);
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_AlawDecoder::Reset(void)
-{
- result r = E_SUCCESS;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
-
- avcodec_flush_buffers(__pCodecCtx);
-
- __decodeCalled = false;
- __decoderConfigured = false;
-
- SetLastResult(E_SUCCESS);
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_AlawDecoder::GetValue(MediaPropertyType type, int& value) const
-{
- result r = E_SUCCESS;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
- SysTryCatch(NID_MEDIA, __decodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
-
- switch (type)
- {
- case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
- value = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
- value = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
- value = __pCodecCtx->sample_rate;
- break;
-
- default:
- r = E_OBJ_NOT_FOUND;
- break;
- }
- SetLastResult(r);
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_AlawDecoder::GetValue(MediaPropertyType type, float& value) const
-{
- result r = E_SUCCESS;
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
- SysTryCatch(NID_MEDIA, __decodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
-
- return E_OBJ_NOT_FOUND;
-
-CATCH:
- return r;
-}
-
-Tizen::Base::Collection::IListT<MediaPropertyType>*
-_AlawDecoder::GetSupportedPropertyListN(void) const
-{
- result r = E_SUCCESS;
- ArrayListT<MediaPropertyType>* pList = new (std::nothrow) ArrayListT<MediaPropertyType>;
-
- SysTryCatch(NID_MEDIA, pList != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
- pList->Add(MEDIA_PROPERTY_AUDIO_SAMPLE_RATE);
- pList->Add(MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE);
- pList->Add(MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE);
- SetLastResult(r);
- return pList;
-
-CATCH:
- return null;
-}
-
-bool
-_AlawDecoder::IsPropertySupported(MediaPropertyType type) const
-{
- result r = E_SUCCESS;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type == MEDIA_PROPERTY_AUDIO_SAMPLE_RATE ||
- type == MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE ||
- type == MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE,
- r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND,
- "[%s] The instance is not available ",GetErrorMessage(E_OBJ_NOT_FOUND));
- SetLastResult(r);
- return true;
-
-CATCH:
- return false;
-}
-
-} } // Tizen::Media
// limitations under the License.
//
+#include <unique_ptr.h>
#include <FBaseColHashMap.h>
#include <FBaseColArrayListT.h>
#include <FBaseInteger.h>
#include <FMedia_Ffmpeg.h>
#include "FMedia_AmrDecoder.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Io;
using namespace Tizen::Base::Collection;
namespace Tizen { namespace Media
{
+static const byte _AMR_HEADER[] = { 0x23, 0x21, 0x41, 0x4D, 0x52, 0x0A };
+
_IAudioDecoder*
_AmrDecoder_CreateInstance(void)
{
{
__pCodecCtx = null;
__pCodec = null;
- __isDecodeCalled = false;
__pResampleContext = null;
__isHdrParsingDone = false;
- __pOutBuf = null;
}
_AmrDecoder::~_AmrDecoder(void)
{
audio_resample_close(__pResampleContext);
}
- if (__pOutBuf != null)
- {
- delete[] __pOutBuf;
- }
}
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));\r
__pCodec = avcodec_find_decoder(CODEC_ID_AMR_NB);
SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_AMR_NB ",GetErrorMessage(E_SYSTEM));\r
+ "[%s] AVCODEC Find Decoder Failed for CODEC_ID_AMR_NB ",GetErrorMessage(E_SYSTEM));
+
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
+ "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));\r
\r
__pCodecCtx->sample_rate = DEFAULT_SAMPLE_RATE;
__pCodecCtx->channels = 1; // AMR is always mono channel
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] AVCODEC Codec Open Failed for CODEC_ID_AMR_NB",GetErrorMessage(E_SYSTEM));\r
__pCodecCtx->skip_idct = AVDISCARD_DEFAULT; //set by user
__pCodecCtx->skip_loop_filter = AVDISCARD_DEFAULT; //set by user
- __pOutBuf = new (std::nothrow) byte[DECODED_FRAME_SIZE];
- SysTryCatch(NID_MEDIA, __pOutBuf != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));\r
-
return r;
CATCH:
__pCodecCtx = null;
__pCodec = null;
}
- if (__pOutBuf != null)
- {
- delete[] __pOutBuf;
- __pOutBuf = null;
- }
+
return r;
}
_AmrDecoder::Decode(const byte* pSrcBuf, int srcBufSize, int &srcBufUsed,
byte* pDstBuf, int dstBufSize, int &dstBufUsed)
{
- result r = E_SUCCESS;
int res = 0;
AVPacket inputPacket;
int outBufSize = DECODED_FRAME_SIZE;
int samples = 0;
bool hasHdr = false;
- byte* pOutBuf = null;
+ unique_ptr<AVFrame, _FfmpegDeleter> pOutFrame(avcodec_alloc_frame(), ffmpegDeleter);
+ int gotFrame = 0;
-
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
- SysTryCatch(NID_MEDIA, (pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize >= 0 ),
- r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
+ SysTryReturnResult(NID_MEDIA, __pCodecCtx != null, E_INVALID_STATE, "The instance is in invalid state");\r
+ SysTryReturnResult(NID_MEDIA, (pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize >= 0 ), E_INVALID_ARG,
+ "Invalid argument: pSrcBuf(0x%x), srcBufSize(%d), pDstBuf(0x%x), dstBufSize(%d)",
+ pSrcBuf, srcBufSize, pDstBuf, dstBufSize);\r
+ SysTryReturnResult(NID_MEDIA, pOutFrame.get() != null, E_OUT_OF_MEMORY, "avcodec_alloc_frame() failed");
av_init_packet(&inputPacket);
inputPacket.size = srcBufSize;
inputPacket.data = (uint8_t*) pSrcBuf;
// Check whether the buffer passed has the amr header
- if (!__isHdrParsingDone)
+ if ( memcmp(pSrcBuf, _AMR_HEADER, sizeof(_AMR_HEADER)) == 0)
{
- int i = 0;
- if ( pSrcBuf[i] == 0x23 && pSrcBuf[i+1] == 0x21 && pSrcBuf[i+2] == 0x41 &&
- pSrcBuf[i+3] == 0x4D && pSrcBuf[i+4] == 0x52 && pSrcBuf[i+5] == 0x0A)
- {
- // The input buffer has the header
- inputPacket.size = srcBufSize - NB_HEADER_SIZE;
- inputPacket.data = (uint8_t*)( pSrcBuf + NB_HEADER_SIZE);
- hasHdr = true;
- }
- __isHdrParsingDone = true;
+ // The input buffer has the header
+ inputPacket.size = srcBufSize - NB_HEADER_SIZE;
+ inputPacket.data = (uint8_t*)( pSrcBuf + NB_HEADER_SIZE);
+ hasHdr = true;
}
+
// Decoding the Audio packet
- pOutBuf = __pOutBuf;
- res = avcodec_decode_audio3(__pCodecCtx, (int16_t*)pOutBuf, &outBufSize, &inputPacket);
- SysTryCatch(NID_MEDIA, (res > 0 && outBufSize > 0), r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));\r
- if (__pCodecCtx->sample_fmt == AV_SAMPLE_FMT_FLT)
+ res = avcodec_decode_audio4(__pCodecCtx, pOutFrame.get(), &gotFrame, &inputPacket);
+
+ SysTryReturnResult(NID_MEDIA, res > 0, E_UNSUPPORTED_FORMAT, "decode audio failed:%d", res);
+
+ if (gotFrame)
{
- if (!__pResampleContext)
+ if (__pCodecCtx->sample_fmt != AV_SAMPLE_FMT_S16)
{
- __pResampleContext =
- av_audio_resample_init(AUDIO_CHANNEL_TYPE_MONO, __pCodecCtx->channels,
- DEFAULT_SAMPLE_RATE, __pCodecCtx->sample_rate,
- AV_SAMPLE_FMT_S16, __pCodecCtx->sample_fmt,
- 0, 0, 0, 0);
- SysTryCatch(NID_MEDIA, __pResampleContext != null, r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));\r
+ if (__pResampleContext == null)
+ {
+ __pResampleContext = av_audio_resample_init(1 /* mono */, __pCodecCtx->channels,
+ DEFAULT_SAMPLE_RATE, __pCodecCtx->sample_rate, AV_SAMPLE_FMT_S16, __pCodecCtx->sample_fmt, 0, 0, 0, 0);
+ SysTryReturnResult(NID_MEDIA, __pResampleContext != null, E_UNSUPPORTED_FORMAT, "resample init failed:ch(%d) sr(%d) fmt(%d)",
+ __pCodecCtx->channels, __pCodecCtx->sample_rate, __pCodecCtx->sample_fmt);
+ }
+
+ outBufSize = av_samples_get_buffer_size(NULL, 1 /* mono */, pOutFrame->nb_samples, AV_SAMPLE_FMT_S16, 1);
+
+ SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
+
+ samples = audio_resample(__pResampleContext, (short *)pDstBuf, (short *)pOutFrame->data[0], pOutFrame->nb_samples);
+ dstBufUsed = samples * 2; // The decoded audio data size since each sample is 2 bytes
}
- SysTryCatch(NID_MEDIA, dstBufSize >= S16_FRAME_SIZE, r = E_OUT_OF_MEMORY,
- E_OUT_OF_MEMORY, "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));\r
-
- samples = audio_resample (__pResampleContext, (short *) pDstBuf, (short *)pOutBuf, outBufSize/4);
- dstBufUsed = samples * 2; // The decoded audio data size since each sample is 2 bytes
- srcBufUsed = res; //Input bytes used
- // Header bytes are also consumed
- if (hasHdr)
+ else
{
- srcBufUsed += NB_HEADER_SIZE;
+ outBufSize = av_samples_get_buffer_size(NULL, __pCodecCtx->channels, pOutFrame->nb_samples, __pCodecCtx->sample_fmt, 1);
+
+ SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
+
+ memcpy(pDstBuf, pOutFrame->data[0], outBufSize);
+ dstBufUsed = outBufSize; // The decoded audio data size
}
- __isDecodeCalled = true;
+ }
+ else
+ {
+ dstBufUsed = 0;
}
- return r;
-
-CATCH:
+ srcBufUsed = res;
+ if (hasHdr)
+ {
+ srcBufUsed += NB_HEADER_SIZE;
+ }
- return r;
+ return E_SUCCESS;
}
result
Tizen::Media::AudioChannelType& channelType, int& sampleRate)
{
result r = E_SUCCESS;
- int res = 0;
- AVPacket inputPacket;
- int outBufSize = DECODED_FRAME_SIZE;
- byte* pOutBuf = null;
-
+ unique_ptr<byte[]> pDstBuf(new (std::nothrow) byte[DECODED_FRAME_SIZE]);
+ int srcBufUsed = 0;
+ int dstBufUsed = 0;
- SysTryCatch(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
- SysTryCatch(NID_MEDIA, (pSrcBuf != null && srcBufLength > 0), r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
+ SysTryReturnResult(NID_MEDIA, __pCodecCtx != null, E_INVALID_STATE, "The instance is in invalid state");\r
+ SysTryReturnResult(NID_MEDIA, (pSrcBuf != null && srcBufLength > 0), E_INVALID_ARG,
+ "Invalid argument: pSrcBuf(0x%x) srcBufLength(%d)", pSrcBuf, srcBufLength);\r
+ SysTryReturnResult(NID_MEDIA, pDstBuf.get() != null, E_OUT_OF_MEMORY, "new byte[%d] failed", DECODED_FRAME_SIZE);
- av_init_packet(&inputPacket);
+ r = Decode(pSrcBuf, srcBufLength, srcBufUsed, pDstBuf.get(), DECODED_FRAME_SIZE, dstBufUsed);
- inputPacket.size = srcBufLength;
- inputPacket.data = (uint8_t*) pSrcBuf;
-
- if (!__isHdrParsingDone)
- {
- int i = 0;
- if ( pSrcBuf[i] == 0x23 && pSrcBuf[i+1] == 0x21 && pSrcBuf[i+2] == 0x41 &&
- pSrcBuf[i+3] == 0x4D && pSrcBuf[i+4] == 0x52 && pSrcBuf[i+5] == 0x0A)
- {
- // The input buffer has the header
- inputPacket.size = srcBufLength - NB_HEADER_SIZE;
- inputPacket.data = (uint8_t*)( pSrcBuf + NB_HEADER_SIZE);
- SysLog(NID_MEDIA, "Has AMR HEADER");
- }
- }
- // Decoding the Audio packet
- pOutBuf = __pOutBuf;
- res = avcodec_decode_audio3(__pCodecCtx, (int16_t*)pOutBuf, &outBufSize, &inputPacket);
- SysTryCatch(NID_MEDIA, (res > 0 && outBufSize > 0), r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));\r
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Decode failed", GetErrorMessage(r));
channelType = AUDIO_CHANNEL_TYPE_MONO;
sampleType = AUDIO_TYPE_PCM_S16_LE;
sampleRate = DEFAULT_SAMPLE_RATE;
- __isDecodeCalled = true;
- return r;
-CATCH:
return r;
}
SysTryCatch(NID_MEDIA, (__pCodecCtx != null && __pCodec != null), r = E_INVALID_STATE, E_INVALID_STATE,
"[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
avcodec_flush_buffers(__pCodecCtx);
- __isDecodeCalled = false;
__isHdrParsingDone = false;
return r;
"[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
SysTryCatch(NID_MEDIA, 0 < type, r = E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
- SysTryCatch(NID_MEDIA, __isDecodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
+ SysTryCatch(NID_MEDIA, __pCodecCtx->sample_rate != 0, r = E_INVALID_STATE, E_INVALID_STATE,
"[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
switch (type)
"[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
SysTryCatch(NID_MEDIA, type < MEDIA_PROPERTY_VIDEO_WIDTH || type >= MEDIA_PROPERTY_AUDIO_SAMPLE_RATE,
r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The instance is not available ",GetErrorMessage(E_OBJ_NOT_FOUND));\r
- SysTryCatch(NID_MEDIA, __isDecodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
+ SysTryCatch(NID_MEDIA, __pCodecCtx->sample_rate != 0, r = E_INVALID_STATE, E_INVALID_STATE,
"[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
return E_OBJ_NOT_FOUND;
_AmrDecoder& operator =(const _AmrDecoder&);
private:
- bool __isDecodeCalled;
AVCodecContext* __pCodecCtx;
AVCodec* __pCodec;
ReSampleContext* __pResampleContext;
bool __isHdrParsingDone;
- byte* __pOutBuf;
};
} } // Tizen::Media
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_AudioFrameImpl.cpp
+ * @brief This file contains the implementation of the _AudioFrameImpl class.
+ *
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FMediaAudioFrame.h>
+#include <FMediaAudioTypes.h>
+#include "FMedia_AudioFrameImpl.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Media
+{
+static const int _AUDIO_PLANE_COUNT = 1;
+
+_AudioFrameImpl::_AudioFrameImpl(void)
+ : __samplingRate(0)
+ , __channel(AUDIO_CHANNEL_TYPE_NONE)
+ , __sampleType(AUDIO_TYPE_NONE)
+ , __planeCount(_AUDIO_PLANE_COUNT)
+ , __pAudioStreamBuffer(null)
+{
+
+}
+
+_AudioFrameImpl::~_AudioFrameImpl(void)
+{
+}
+
+result
+_AudioFrameImpl::Initialize(byte* pStream, int size, int samplingRate, AudioChannelType channel, AudioSampleType sampleType)
+{
+ result r = E_SUCCESS;
+
+ __pAudioStreamBuffer.reset(new (std::nothrow) Tizen::Base::ByteBuffer());
+ SysTryReturn(NID_MEDIA, __pAudioStreamBuffer.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = __pAudioStreamBuffer->Construct(pStream, 0, size, size);
+ SysTryReturn(NID_MEDIA, r== E_SUCCESS, r, r, "[%s] Propogating", GetErrorMessage(r));
+
+ __samplingRate = samplingRate;
+ __channel = channel;
+ __sampleType = sampleType;
+
+ return r;
+}
+
+int
+_AudioFrameImpl:: GetPlaneCount(void) const
+{
+ return __planeCount;
+}
+
+Tizen::Base::ByteBuffer*
+_AudioFrameImpl::GetPlaneData(int index) const
+{
+ SysTryReturn(NID_MEDIA, index < __planeCount, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] The index %d is out of range, plane count %d.",index, __planeCount);
+
+ return __pAudioStreamBuffer.get();
+}
+
+int
+_AudioFrameImpl::GetSamplingRate(void) const
+{
+ return __samplingRate;
+}
+
+AudioChannelType
+_AudioFrameImpl::GetChannelType(void) const
+{
+ return __channel;
+}
+
+AudioSampleType
+_AudioFrameImpl::GetSampleType(void) const
+{
+ return __sampleType;
+}
+
+_AudioFrameImpl*
+_AudioFrameImpl::GetInstance(AudioFrame *pAudioFrame)
+{
+ if ( pAudioFrame != null )
+ {
+ return pAudioFrame->__pImpl;
+ }
+ return null;
+}
+
+const _AudioFrameImpl*
+_AudioFrameImpl::GetInstance(const AudioFrame *pAudioFrame)
+{
+ if ( pAudioFrame != null)
+ {
+ return pAudioFrame->__pImpl;
+ }
+ return null;
+}
+
+}} // Tizen::Media
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_AudioFrameImpl.h
+ * @brief This header file contains the declaration of the _AudioFrame_Impl class.
+ */
+
+#ifndef _FMEDIA_INTERNAL_AUDIOFRAME_IMPL_H_
+#define _FMEDIA_INTERNAL_AUDIOFRAME_IMPL_H_
+
+#include <FMediaTypes.h>
+#include <FMediaAudioTypes.h>
+
+namespace Tizen { namespace Media
+{
+
+/**
+ * @class _AudioFrameImpl
+ * @brief This class saves the audio PCM data attributes
+ */
+
+class _AudioFrameImpl
+ : public Tizen::Base::Object
+{
+
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ *
+ */
+ _AudioFrameImpl(void);
+
+ /**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method.
+ *
+ *
+ */
+ virtual ~_AudioFrameImpl(void);
+
+ /**
+ *
+ * Create an audio stream buffer assuming only one plane data
+ *
+ *
+ * @return An error code
+ *
+ * @param[in] pStream The audio stream buffer data
+ * @param[in] size The audio stream buffer data size
+ * @param[in] samplingRate Sampling rate of the audio stream buffer
+ * @param[in] channel Number of channel
+ * @param[in] sampleType Number of bits used to represent one audio stream sample
+ *
+ */
+ result Initialize(byte* pStream, int size, int samplingRate, AudioChannelType channel, AudioSampleType sampleType);
+
+ /**
+ *
+ * Gets the plane count which the frame data has.
+ *
+ *
+ * @return The plane count
+ *
+ */
+ int GetPlaneCount(void) const;
+
+ /**
+ * Get the sampling rate of the audio stream buffer
+ *
+ * @return Sampling rate of the audio stream buffer
+ */
+ int GetSamplingRate(void) const;
+
+ /**
+ * Get the channel information of the audio stream
+ *
+ * @return number of channel
+ */
+ AudioChannelType GetChannelType(void) const;
+
+ /**
+ * Get the number of bits used to represent one audio stream sample
+ *
+ * @return Number of bits used to represent one audio stream sample
+ */
+ AudioSampleType GetSampleType(void) const;
+
+ /**
+ *
+ * Gets the plane data at the specific index from frame
+ *
+ *
+ * @return The plane data. @n
+ * else @null if any error occurred
+ * @param[in] index The index at which the value is read
+ *
+ */
+ Tizen::Base::ByteBuffer* GetPlaneData(int index) const;
+
+ /**
+ * Gets the Impl instance.
+ *
+ * @return The pointer to %_AudioFrameImpl
+ * @param[in] pAudioFrame The %AudioFrame pointer
+ */
+ static _AudioFrameImpl* GetInstance(AudioFrame *pAudioFrame);
+
+ /**
+ * Gets the Impl instance.
+ *
+ * @return The pointer to %_AudioFrameImpl
+ * @param[in] pAudioFrame The %AudioFrame pointer
+ */
+ static const _AudioFrameImpl* GetInstance(const AudioFrame *pAudioFrame);
+
+private:
+
+ _AudioFrameImpl(const _AudioFrameImpl&);
+ _AudioFrameImpl& operator =(const _AudioFrameImpl& _AudioFrameImpl);
+
+ int __samplingRate;
+ AudioChannelType __channel;
+ AudioSampleType __sampleType;
+ int __planeCount;
+ std::unique_ptr <Tizen::Base::ByteBuffer> __pAudioStreamBuffer;
+
+};
+
+}}// Tizen::Media
+
+#endif
r = this->Unprepare();
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
-
- if (__pAudioInEvent.get() && __pAudioInEventListener)
- {
- __pAudioInEvent->RemoveListener(*__pAudioInEventListener);
- __pAudioInEventListener = null;
- }
return;
CATCH:
result SendAudioFocusChanged();
result MapExceptionToResult(int reason);
-
std::unique_ptr<_AudioInEvent> __pAudioInEvent;
std::unique_ptr<Tizen::Base::Runtime::Thread> __pWorkerThread;
std::unique_ptr<Tizen::Base::Runtime::Monitor> __pBufferSync;
}
}
-sound_session_type_e
-_AudioManagerConvert::ConvertAudioSession2SoundSession(AudioSessionMode audioSessionType)
-{
- switch (audioSessionType)
- {
- case AUDIO_SESSION_MODE_SHARED:
- return SOUND_SESSION_TYPE_SHARE;
- case AUDIO_SESSION_MODE_EXCLUSIVE:
- return SOUND_SESSION_TYPE_EXCLUSIVE;
- case AUDIO_SESSION_MODE_EMERGENCY:
- return SOUND_SESSION_TYPE_EXCLUSIVE;
- default:
- return SOUND_SESSION_TYPE_SHARE;
- }
-}
-
-AudioSessionMode
-_AudioManagerConvert::ConvertSoundSession2AudioSession(sound_session_type_e soundSession)
-{
- switch (soundSession)
- {
- case SOUND_SESSION_TYPE_SHARE:
- return AUDIO_SESSION_MODE_SHARED;
- case SOUND_SESSION_TYPE_EXCLUSIVE:
- return AUDIO_SESSION_MODE_EXCLUSIVE;
- case SOUND_SESSION_TYPE_EMERGENCY:
- return AUDIO_SESSION_MODE_EMERGENCY;
- default:
- return AUDIO_SESSION_MODE_SHARED;
- }
-}
-
-sound_call_session_mode_e
-_AudioManagerConvert::ConvertVoipMode2CallMode(VoipAudioSessionMode voipSessionMode)
-{
- switch (voipSessionMode)
- {
- case VOIP_AUDIO_SESSION_MODE_VOICE:
- return SOUND_CALL_SESSION_MODE_VOICE;
- case VOIP_AUDIO_SESSION_MODE_RINGTONE:
- return SOUND_CALL_SESSION_MODE_RINGTONE;
- case VOIP_AUDIO_SESSION_MODE_MEDIA:
- return SOUND_CALL_SESSION_MODE_MEDIA;
- case VOIP_AUDIO_SESSION_MODE_NONE:
- return SOUND_CALL_SESSION_MODE_VOICE;
- default:
- return SOUND_CALL_SESSION_MODE_VOICE;
- }
-}
-
-VoipAudioSessionMode
-_AudioManagerConvert::ConvertCallSessionMode2VoipMode(sound_call_session_mode_e soundSessionMode)
-{
- switch (soundSessionMode)
- {
- case SOUND_CALL_SESSION_MODE_VOICE:
- return VOIP_AUDIO_SESSION_MODE_VOICE;
- case SOUND_CALL_SESSION_MODE_RINGTONE:
- return VOIP_AUDIO_SESSION_MODE_RINGTONE;
- case SOUND_CALL_SESSION_MODE_MEDIA:
- return VOIP_AUDIO_SESSION_MODE_MEDIA;
- default:
- return VOIP_AUDIO_SESSION_MODE_NONE;
- }
-}
-
sound_type_e
_AudioManagerConvert::ConvertAudioStreamType2SoundType(AudioStreamType type)
{
static audio_sample_type_e ConvertSampleTypeAudio(AudioSampleType audioSampleType);
static audio_channel_e ConvertChannelTypeAudio(AudioChannelType audioChannelType);
static result CovertSoundManagerError2Result(int error);
- static sound_session_type_e ConvertAudioSession2SoundSession(AudioSessionMode audioSessionType);
- static AudioSessionMode ConvertSoundSession2AudioSession(sound_session_type_e soundSession);
- static sound_call_session_mode_e ConvertVoipMode2CallMode(VoipAudioSessionMode voipSessionMode);
- static VoipAudioSessionMode ConvertCallSessionMode2VoipMode(sound_call_session_mode_e soundSessionMode);
static sound_type_e ConvertAudioStreamType2SoundType(AudioStreamType type);
private :
int _AudioOutImpl::audioOutOptimalSampleRate = 44100;
int _AudioOutImpl::audioOutMinimumBufferSize = 2048;
int _AudioOutImpl::audioOutMaximumBufferSize = 164112;
-
std::unique_ptr<Tizen::Base::Runtime::Mutex> _AudioOutImpl::__pInstanceMutex;
bool _AudioOutImpl::__isInstanceMutexInitialized = false;
this->UnPrepare();
}
__pAudioOut = null;
- if (__pAudioOutEvent.get() && __pAudioOutEventListener)
- {
- __pAudioOutEvent->RemoveListener(*__pAudioOutEventListener);
- }
if ((__audioOutState == AUDIOOUT_STATE_INITIALIZED ) || __audioOutState == AUDIOOUT_STATE_UNPREPARED )
{
*
*/
-#include <unique_ptr.h>
+
#include <FBaseSysLog.h>
#include <FBaseInteger.h>
#include <FBase_StringConverter.h>
#include "FMedia_RecorderCapability.h"
#include "FMedia_RecorderManager.h"
#include "FMedia_CamPtrUtil.h"
+#include "FMedia_AudioStreamCoordinator.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
, __quality(RECORDING_QUALITY_MEDIUM)
, __mute(false)
, __handle(MM_INVALID_HANDLE)
- ,__stateChangeReason(_RECORDER_STATE_REASON_NORMAL)
+ , __stateChangeReason(_RECORDER_STATE_REASON_NORMAL)
+ , __pAudioStreamCoordinator(null)
+ , __audioStreamTimeDuration(0)
+ , __audioStreamCallback(false)
{
}
{
result r = E_SUCCESS;
int err = ::RECORDER_ERROR_NONE;
+ int streamFps = 0;
+ _CapabilityImpl* pCapabilityImpl = null;
+
SysLog(NID_MEDIA, "Starting Audio Recorder construct.");
SysTryReturn(NID_MEDIA, !__isUsed, E_DEVICE_BUSY, E_DEVICE_BUSY,
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
__pAudioRecorderEventListener = &listener;
+ // Create audio stream coordinator
+ __pAudioStreamCoordinator.reset(new (std::nothrow) _AudioStreamCoordinator());
+ SysTryCatch(NID_MEDIA, __pAudioStreamCoordinator.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = __pAudioStreamCoordinator->Construct();
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pCapabilityImpl = _CapabilityImpl::GetInstance();
+ SysTryCatch(NID_MEDIA, pCapabilityImpl != null, r= E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Capability is not obtained.");
+
+ // Get the capability
+ r = pCapabilityImpl->GetValue(String(L"AudioRecorder.Device.fps"), streamFps);
+ //SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ streamFps = 50;
+
+ if (streamFps != 0)
+ {
+ __audioStreamTimeDuration = (1000/streamFps); //Time duration in milisec
+ }
+
__pRecorderManager = _RecorderManager::AddInstance(_RECORDER_DEVICE_AUDIO);
r = GetLastResult();
SysTryCatch(NID_MEDIA, __pRecorderManager != null, , r, "[%s] audio recorder creation failed");
r = ConvertResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] audio recorder set message callback failed.", GetErrorMessage(r));
- err = recorder_set_audio_stream_cb(__handle, AudioStreamCb, this);
- r = ConvertResult(err);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] audio recorder set audio stream callback failed.", GetErrorMessage(r));
-
err = recorder_set_recording_status_cb(__handle, RecordingStatusCb, this);
r = ConvertResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] audio recorder set recording status callback failed.", GetErrorMessage(r));
if (__handle != MM_INVALID_HANDLE)
{
err = recorder_unset_state_changed_cb(__handle);
- err = recorder_unset_audio_stream_cb(__handle);
err = recorder_unset_recording_limit_reached_cb(__handle);
err = recorder_unset_error_cb(__handle);
err = recorder_unset_recording_status_cb(__handle);
}
result
+_AudioRecorderImpl::AddAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pAudioStreamCoordinator->AddAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__audioStreamCallback != true)
+ {
+ int err = ::RECORDER_ERROR_NONE;
+ err = recorder_set_audio_stream_cb(__handle, AudioStreamCb, this);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] audio recorder set audio stream callback failed.", GetErrorMessage(r));
+ __audioStreamCallback = true;
+ }
+
+ return r;
+}
+
+result
+_AudioRecorderImpl::RemoveAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pAudioStreamCoordinator->RemoveAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__pAudioStreamCoordinator->GetFilterListCount() == 0)
+ {
+ int err = ::RECORDER_ERROR_NONE;
+ err = recorder_unset_audio_stream_cb(__handle);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] audio recorder unset recording status callback failed.", GetErrorMessage(r));
+ __audioStreamCallback = false;
+ }
+
+ return r;
+}
+
+result
_AudioRecorderImpl::CreateAudioFile(const Tizen::Base::String& mediaLocalPath, bool overwrite)
{
result r = E_SUCCESS;
_AudioRecorderImpl::AudioStreamCb(void* pStream, int size, audio_sample_type_e format, int channel, unsigned int timeStamp, void *pUserData)
{
_AudioRecorderImpl* pObj = static_cast<_AudioRecorderImpl*>(pUserData);
+ int samplingRate =0;
SysTryReturn(NID_MEDIA, _AudioRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
SysTryReturn(NID_MEDIA, pObj != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. pObj is null.");
SysTryReturn(NID_MEDIA, pStream != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _AudioRecorderImpl instance is not available. Stream data is null.");
-// SysLog(NID_MEDIA, "Size:%d, format:%d, channel:%d, timeStamp:%u", size, format, channel, timeStamp);
+ if (pObj->__audioStreamCallback == true)
+ {
+ samplingRate = _RecorderUtil::CalculateSampleRate(size, channel, pObj->__audioStreamTimeDuration, _RecorderUtil::GetOspSampleType(format));
+ (pObj->__pAudioStreamCoordinator)->ProcessAudioStreamData((byte*)pStream, size, samplingRate, _RecorderUtil::GetOspChannelType(channel), _RecorderUtil::GetOspSampleType(format));
+ }
}
void
#ifndef _FMEDIA_INTERNAL_AUDIORECORDER_IMPL_H_
#define _FMEDIA_INTERNAL_AUDIORECORDER_IMPL_H_
+#include <unique_ptr.h>
#include <FBaseColArrayListT.h>
#include <FMediaTypes.h>
#include <FMediaAudioRecorderTypes.h>
#include "FMedia_RecorderTypes.h"
-#include "FMedia_RecorderTypes.h"
namespace Tizen { namespace Media
{
class IAudioRecorderEventListener;
class _AudioRecorderEvent;
class _RecorderManager;
+class _AudioStreamCoordinator;
+class IAudioStreamFilter;
/**
* @class _AudioRecorderImpl
*/
static const _AudioRecorderImpl* GetInstance(const AudioRecorder *pAudioRecorder);
+ /**
+ * Adds the stream filter to process the audio stream data while recording.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ */
+ result AddAudioStreamFilter(IAudioStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop processing the audio stream data.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ */
+ result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
+
private:
/**
* Converts the error from recorder to Result.
_RecorderHandle __handle;
_RecorderStateChangeReason __stateChangeReason;
static bool __isUsed;
+ std::unique_ptr <_AudioStreamCoordinator> __pAudioStreamCoordinator;
+ int __audioStreamTimeDuration;
+ bool __audioStreamCallback;
};
}}// Tizen::Media
return SOUND_ROUTE_OUT_WIRED_ACCESSORY;
case OUTPUT_AUDIO_DEVICE_BT_A2DP:
return SOUND_ROUTE_OUT_BLUETOOTH;
+ case OUTPUT_AUDIO_DEVICE_DOCK:
+ return SOUND_ROUTE_OUT_DOCK;
+ case OUTPUT_AUDIO_DEVICE_HDMI:
+ return SOUND_ROUTE_OUT_HDMI;
+ case OUTPUT_AUDIO_DEVICE_WFD:
+ return SOUND_ROUTE_OUT_WFD ;
+ case OUTPUT_AUDIO_DEVICE_USB_AUDIO:
+ return SOUND_ROUTE_OUT_USB_AUDIO;
default:
return 0;
}
return OUTPUT_AUDIO_DEVICE_WIRED_ACCESSORY;
case SOUND_ROUTE_OUT_BLUETOOTH:
return OUTPUT_AUDIO_DEVICE_BT_A2DP;
+ case SOUND_ROUTE_OUT_DOCK:
+ return OUTPUT_AUDIO_DEVICE_DOCK;
+ case SOUND_ROUTE_OUT_HDMI:
+ return OUTPUT_AUDIO_DEVICE_HDMI;
+ case SOUND_ROUTE_OUT_WFD:
+ return OUTPUT_AUDIO_DEVICE_WFD;
+ case SOUND_ROUTE_OUT_USB_AUDIO:
+ return OUTPUT_AUDIO_DEVICE_USB_AUDIO;
default:
return OUTPUT_AUDIO_DEVICE_NONE;
}
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <FBaseRtThread.h>
-#include <FBaseRtIEventListener.h>
-#include <FBaseSysLog.h>
-#include <FBaseRtIEventArg.h>
-#include "FMedia_AudioSessionEvent.h"
-#include "FMedia_AudioSessionEventArg.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Runtime;
-
-namespace Tizen { namespace Media
-{
-
-_AudioSessionEvent::_AudioSessionEvent(void)
- :__pListener(null)
-{
-}
-
-_AudioSessionEvent::~_AudioSessionEvent(void)
-{
-}
-
-result
-_AudioSessionEvent::Construct(void)
-{
- result r = E_SUCCESS;
- __pListener = null;
-
- r = _Event::Initialize();
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
- return r;
-}
-
-
-void
-_AudioSessionEvent::FireImpl(IEventListener& listener, const IEventArg& arg)
-{
- IAudioSessionEventListener *pAudioSessionEventListener = dynamic_cast<IAudioSessionEventListener*> (&listener);
- SysTryReturn(NID_MEDIA, pAudioSessionEventListener, , E_SYSTEM, "[E_SYSTEM] A system error has been occureed. The value of listener is null.");
-
- __pListener = pAudioSessionEventListener;
-
- const Tizen::Base::Runtime::IEventArg* pTempArg = const_cast <const Tizen::Base::Runtime::IEventArg*>(&arg);
-
- _AudioSessionEventArg *pArg = (_AudioSessionEventArg*) pTempArg;
-
- switch (pArg->GetEventType())
- {
- case _AUDIO_SESSION_EVENT_INTERRUPTED:
- pAudioSessionEventListener->OnAudioSessionInterrupted();
- break;
- case _AUDIO_SESSION_EVENT_RELEASED:
- pAudioSessionEventListener->OnAudioSessionInterruptReleased();
- break;
- case _AUDIO_SESSION_EVENT_AUDIO_FOCUS_CHANGED:
- pAudioSessionEventListener->OnAudioSessionAudioFocusChanged();
- break;
- default:
- SysTryLog(NID_MEDIA, false, "The event type is wrong.");
- break;
- }
-}
-};
-};
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-//
-// @file FMedia_AudioSessionEvent.h
-// @brief This header file contains the declaration related to AudioIn class
-//
-//
-
-
-#ifndef _FMEDIA_INTERNAL_AUDIO_SESSION_EVENT_H_
-#define _FMEDIA_INTERNAL_AUDIO_SESSION_EVENT_H_
-
-#include <FBaseRtThread.h>
-#include <FBaseRtIEventListener.h>
-#include <FBaseRtIEventArg.h>
-#include <FMediaIAudioSessionEventListener.h>
-#include <FMediaAudioIn.h>
-#include "FBaseRt_Event.h"
-
-namespace Tizen { namespace Media
-{
-
-
-class _AudioSessionEvent
- : public Tizen::Base::Runtime::_Event
-{
-
-public:
- _AudioSessionEvent(void);
- ~_AudioSessionEvent(void);
- result Construct(void);
-
-protected:
- void FireImpl(Tizen::Base::Runtime::IEventListener& listener, const Tizen::Base::Runtime::IEventArg& arg);
-private:
- _AudioSessionEvent(const _AudioSessionEvent& rhs);
- _AudioSessionEvent& operator =(const _AudioSessionEvent& rhs);
- IAudioSessionEventListener* __pListener;
-}; // _AudioSessionEvent
-
-}}//Tizen::Media
-
-#endif
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include "FMedia_AudioSessionEventArg.h"
-
-namespace Tizen { namespace Media
-{
-
-_AudioSessionEventTypeArg::_AudioSessionEventTypeArg(void)
- : __audioSessionEventType(_AUDIO_SESSION_EVENT_NONE)
-{
-
-}
-
-_AudioSessionEventTypeArg::~_AudioSessionEventTypeArg(void)
-{
-
-}
-
-void
-_AudioSessionEventTypeArg::SetEventType(_AudioSessionEventType eType)
-{
- __audioSessionEventType = eType;
-}
-
-_AudioSessionEventType
-_AudioSessionEventTypeArg::GetEventType(void) const
-{
- return __audioSessionEventType;
-}
-
-_AudioSessionEventArg::_AudioSessionEventArg(void)
-{
-
-}
-
-_AudioSessionEventArg::~_AudioSessionEventArg(void)
-{
-
-}
-
-};
-}; // Tizen::Media
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-//
-// @file FMedia_AudioSessionEventArg.h
-// @brief This header file contains the declaration related to _AudioSessionImpl class.
-//
-//
-
-
-#ifndef _FMEDIA_INTERNAL_AUDIO_SESSSION_EVENT_ARG_H_
-#define _FMEDIA_INTERNAL_AUDIO_SESSSION_EVENT_ARG_H_
-#include <FBaseObject.h>
-#include <FBaseRtIEventArg.h>
-#include <FMediaAudioManagerTypes.h>
-
-namespace Tizen {namespace Media
-{
-
-enum _AudioSessionEventType
-{
- _AUDIO_SESSION_EVENT_NONE,
- _AUDIO_SESSION_EVENT_INTERRUPTED,
- _AUDIO_SESSION_EVENT_RELEASED,
- _AUDIO_SESSION_EVENT_AUDIO_FOCUS_CHANGED
-};
-
-class _AudioSessionImpl;
-
-class _AudioSessionEventTypeArg
- : public Tizen::Base::Runtime::IEventArg
- , public Tizen::Base::Object
-{
-public:
- _AudioSessionEventTypeArg(void);
- virtual ~_AudioSessionEventTypeArg(void);
- _AudioSessionEventType GetEventType(void) const;
-private:
- void SetEventType(_AudioSessionEventType eType);
- _AudioSessionEventTypeArg(const _AudioSessionEventTypeArg& rhs);
- _AudioSessionEventTypeArg& operator =(const _AudioSessionEventTypeArg& rhs);
- _AudioSessionEventType __audioSessionEventType;
- friend class _AudioSessionManagerImpl;
-}; //_AudioSessionEventTypeArg
-
-class _AudioSessionEventArg
- : public _AudioSessionEventTypeArg
-{
-public:
- _AudioSessionEventArg(void);
- ~_AudioSessionEventArg(void);
-private:
- friend class _AudioSessionManagerImpl;
-}; //_AudioSessionEventArg
-
-}}// Tizen::Media
-
-#endif
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#include <iostream>
-#include <pthread.h>
-#include <FBaseSysLog.h>
-#include <FMediaIAudioSessionEventListener.h>
-#include "FMedia_AudioSessionManagerImpl.h"
-#include "FMedia_AudioManagerConvert.h"
-
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Base::Runtime;
-namespace Tizen{ namespace Media{
-
-_AudioSessionManagerImpl* _AudioSessionManagerImpl::__pAudioSessionImpl = null;
-
-void
-_AudioSessionManagerImpl::InitAudioSessionManagerImpl(void)
-{
- static _AudioSessionManagerImpl instance;
- __pAudioSessionImpl = &instance;
-}
-
-_AudioSessionManagerImpl*
-_AudioSessionManagerImpl::GetInstance()
-{
- result r = E_SUCCESS;
- static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
- if (__pAudioSessionImpl == null)
- {
- pthread_once(&onceBlock, InitAudioSessionManagerImpl);
- r = __pAudioSessionImpl->Construct();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, ,r, "[%s] Propagating.", GetErrorMessage(r));
- }
- return __pAudioSessionImpl;
-CATCH:
- __pAudioSessionImpl = null;
- return null;
-}
-
-result
-_AudioSessionManagerImpl::Construct(void)
-{
- result r = E_SUCCESS;
- int ret = 0;
-
- __pAudioSessionEvent.reset(new (std::nothrow) _AudioSessionEvent);
- SysTryCatch(NID_MEDIA, __pAudioSessionEvent.get(), r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- r = __pAudioSessionEvent->Construct();
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
- ret = sound_manager_set_interrupted_cb(SoundSessionNotificationsCallback, (void*)this);
- SysTryCatch(NID_MEDIA, ret == SOUND_MANAGER_ERROR_NONE, r = E_SYSTEM, E_SYSTEM,
- "[E_SYSTEM] A system error has been occurred. Failed to perform sound_manager_set_interrupted_cb operation with error code : 0x%x", ret);
- return r;
-CATCH:
- return r;
-}
-
-_AudioSessionManagerImpl::_AudioSessionManagerImpl()
- : __pSingleAudioSessionListner(null)
- , __currentSessionMode(AUDIO_SESSION_MODE_SHARED)
- , __interruptedEvent(SOUND_INTERRUPTED_BY_MEDIA)
- , __interruptFlag(false)
-{
-
-}
-
-_AudioSessionManagerImpl::~_AudioSessionManagerImpl()
-{
- sound_manager_unset_interrupted_cb();
- __pSingleAudioSessionListner = null;
- __pAudioSessionImpl = null;
-}
-
-result
-_AudioSessionManagerImpl::AddListener(IAudioSessionEventListener *pListener)
-{
- SysTryReturn(NID_MEDIA, pListener != null, E_INVALID_ARG, E_INVALID_ARG,
- "[E_INVALID_ARG] Invalid argument is used. The value of pListener is null.");
- return __pAudioSessionEvent->AddListener(*pListener);
-}
-
-result
-_AudioSessionManagerImpl::SetAudioSessionEventListener(IAudioSessionEventListener* pListener)
-{
- result r = E_SUCCESS;
- SysTryReturn(NID_MEDIA, __pAudioSessionEvent.get() != null, E_INVALID_OPERATION, E_INVALID_OPERATION,
- "[E_INVALID_OPERATION] A error has been occurred. The value of __pAudioSessionEvent is null.");
- if (__pSingleAudioSessionListner != null)
- {
- r = __pAudioSessionEvent->RemoveListener(*__pSingleAudioSessionListner);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] RemoveListener() failed", GetErrorMessage(r));
- __pSingleAudioSessionListner = null;
- }
- if (pListener != null)
- {
- r = __pAudioSessionEvent->AddListener(*pListener);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] AddListener() failed", GetErrorMessage(r));
- __pSingleAudioSessionListner = pListener;
- }
- return r;
-}
-
-result
-_AudioSessionManagerImpl::RemoveListener(IAudioSessionEventListener *pListener)
-{
- return __pAudioSessionEvent->RemoveListener(*pListener);
-}
-
-
-result
-_AudioSessionManagerImpl::SetMode(AudioSessionMode sessionMode)
-{
- result r = E_SUCCESS;
- int ret = SOUND_MANAGER_ERROR_NONE;
- ret = sound_manager_set_session_type(_AudioManagerConvert::ConvertAudioSession2SoundSession(sessionMode));
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryReturnResult(NID_MEDIA, r == E_SUCCESS, r,
- "Failed to perform sound_manager_set_session_type operation with error code : 0x%x", ret);
- __currentSessionMode = sessionMode;
- return r;
-
-}
-
-AudioSessionMode
-_AudioSessionManagerImpl::GetMode(void)
-{
- result r = E_SUCCESS;
- int ret = SOUND_MANAGER_ERROR_NONE;
- sound_session_type_e soundSession = SOUND_SESSION_TYPE_SHARE;
- ret = sound_manager_get_session_type(&soundSession);
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, ,r, "[%s] Propagating.", GetErrorMessage(r));
- return _AudioManagerConvert::ConvertSoundSession2AudioSession(soundSession);
-CATCH:
- //return default session type
- return AUDIO_SESSION_MODE_SHARED;
-}
-
-sound_interrupted_code_e
-_AudioSessionManagerImpl::GetInterruptType(void)
-{
- return __interruptedEvent;
-}
-
-void
-_AudioSessionManagerImpl::SoundSessionNotificationsCallback(sound_interrupted_code_e notify, void* pUserData)
-{
- SysLog(NID_MEDIA, "This instance received message code : %d", notify);
- _AudioSessionManagerImpl *pAudioSessionManagerImpl = (_AudioSessionManagerImpl *)pUserData;
-
- switch (notify)
- {
- case SOUND_INTERRUPTED_COMPLETED:
- if (!(pAudioSessionManagerImpl->__interruptFlag))
- {
- __pAudioSessionImpl->SendReleased();
- }
- pAudioSessionManagerImpl->__interruptFlag = false;
- break;
- case SOUND_INTERRUPTED_BY_CALL:
- pAudioSessionManagerImpl->__interruptFlag = true;
- //fall through
- case SOUND_INTERRUPTED_BY_MEDIA:
- //fall through
- case SOUND_INTERRUPTED_BY_RESOURCE_CONFLICT:
- //fall through
- case SOUND_INTERRUPTED_BY_EARJACK_UNPLUG:
- __pAudioSessionImpl->SendAudioFocusChanged(notify);
- break;
- case SOUND_INTERRUPTED_BY_EMERGENCY:
- //fall through
- case SOUND_INTERRUPTED_BY_ALARM:
- __pAudioSessionImpl->SendInterrupted(notify);
- break;
- default:
- SysLogException(NID_MEDIA, E_SYSTEM, "A system error occurred. Invalid notify signal is %d",notify);
- break;
- }
-}
-
-void
-_AudioSessionManagerImpl::SendInterrupted(sound_interrupted_code_e notify)
-{
- result r = E_SUCCESS;
- _AudioSessionEventArg* pAudioSessionEventArg = new (std::nothrow) _AudioSessionEventArg;
- SysTryReturn(NID_MEDIA, pAudioSessionEventArg, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- pAudioSessionEventArg->SetEventType(_AUDIO_SESSION_EVENT_INTERRUPTED);
- __interruptedEvent = notify;
- r = __pAudioSessionEvent->FireAsync(*pAudioSessionEventArg);
- SysTryLog(NID_MEDIA, r == E_SUCCESS, "[%s] Failed to perform FireAsync operation.", GetErrorMessage(r));
-}
-
-void
-_AudioSessionManagerImpl::SendAudioFocusChanged(sound_interrupted_code_e notify)
-{
- result r = E_SUCCESS;
- _AudioSessionEventArg* pAudioSessionEventArg = new (std::nothrow) _AudioSessionEventArg;
- SysTryReturn(NID_MEDIA, pAudioSessionEventArg, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- pAudioSessionEventArg->SetEventType(_AUDIO_SESSION_EVENT_AUDIO_FOCUS_CHANGED);
- __interruptedEvent = notify;
- r = __pAudioSessionEvent->FireAsync(*pAudioSessionEventArg);
- SysTryLog(NID_MEDIA, r == E_SUCCESS, "[%s]Failed to perform FireAsync operation.", GetErrorMessage(r));
-}
-
-void
-_AudioSessionManagerImpl::SendReleased()
-{
- result r = E_SUCCESS;
- _AudioSessionEventArg* pAudioSessionEventArg = new (std::nothrow) _AudioSessionEventArg;
- SysTryReturn(NID_MEDIA, pAudioSessionEventArg, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
- pAudioSessionEventArg->SetEventType(_AUDIO_SESSION_EVENT_RELEASED);
- r = __pAudioSessionEvent->FireAsync(*pAudioSessionEventArg);
- SysTryLog(NID_MEDIA, r == E_SUCCESS, "[%s] Failed to perform FireAsync operation.", GetErrorMessage(r));
-}
-
-}
-}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_AudioStreamCoordinator.cpp
+ * @brief This file contains the implementation of the _AudioStreamCoordinator class.
+ *
+ */
+
+#include <FBaseSysLog.h>
+#include <unique_ptr.h>
+#include "FMediaAudioFrame.h"
+#include "FMedia_AudioFrameImpl.h"
+#include "FMediaIAudioStreamFilter.h"
+#include "FMedia_AudioStreamCoordinator.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Media
+{
+_AudioStreamCoordinator::_AudioStreamCoordinator(void)
+ : __pStreamFilterList(null, _ListPtrUtil::remover)
+{
+
+}
+
+_AudioStreamCoordinator::~_AudioStreamCoordinator(void)
+{
+
+}
+
+result
+_AudioStreamCoordinator::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ __pStreamFilterList.reset(new (std::nothrow) ArrayListT<IAudioStreamFilter*>);
+ SysTryReturn(NID_MEDIA, __pStreamFilterList.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = __pStreamFilterList->Construct();
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_AudioStreamCoordinator::ProcessAudioStreamData(byte* pStream, int size, int samplingRate, AudioChannelType channel, AudioSampleType sampleType)
+{
+ result r = E_SUCCESS;
+
+ AudioFrame audioFrame;
+ r = audioFrame.Construct();
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ _AudioFrameImpl* pAudioFrameImpl = _AudioFrameImpl::GetInstance(&audioFrame);
+ SysTryReturn(NID_MEDIA, pAudioFrameImpl != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The implementation object is not found.");
+
+ r = pAudioFrameImpl->Initialize(pStream, size, samplingRate, channel, sampleType);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ std::unique_ptr< IEnumeratorT< IAudioStreamFilter*> > pEnum (__pStreamFilterList->GetEnumeratorN());
+ SysTryReturn(NID_MEDIA, pEnum.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ IAudioStreamFilter* pFilter = null;
+ r = pEnum->GetCurrent(pFilter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ pFilter->ProcessAudioStream(audioFrame);
+ }
+
+ return r;
+}
+
+result
+_AudioStreamCoordinator::AddAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ SysTryReturn(NID_MEDIA, __pStreamFilterList->Contains(&filter) != true, E_OBJ_ALREADY_EXIST, E_OBJ_ALREADY_EXIST, "[E_OBJ_ALREADY_EXIST] The filter already exists.");
+
+ result r = E_SUCCESS;
+ r = __pStreamFilterList->Add(&filter);
+ SysTryReturn(NID_MEDIA, r== E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_AudioStreamCoordinator::RemoveAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pStreamFilterList->Remove(&filter);
+ SysTryReturn(NID_MEDIA, r== E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+int
+_AudioStreamCoordinator::GetFilterListCount(void) const
+{
+ return __pStreamFilterList->GetCount();
+}
+
+}} // Tizen::Media
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_AudioStreamCoordinator.h
+ * @brief This header file contains the declaration of the _AudioStreamCoordinator class.
+ */
+
+#ifndef _FMEDIA_INTERNAL_AUDIO_STREAM_COORDINATOR_H_
+#define _FMEDIA_INTERNAL_AUDIO_STREAM_COORDINATOR_H_
+
+#include <FMediaAudioTypes.h>
+#include "FMedia_CamPtrUtil.h"
+
+namespace Tizen { namespace Media
+{
+class IAudioStreamFilter;
+
+/**
+ * @class _AudioStreamCoordinator
+ * @brief This class coordinates the audio stream data
+ */
+
+class _AudioStreamCoordinator
+ : public Tizen::Base::Object
+{
+
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ *
+ */
+ _AudioStreamCoordinator(void);
+
+ /**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ */
+ virtual ~_AudioStreamCoordinator(void);
+
+
+public:
+ /**
+ * Constructs the instance of this class. @n
+ *
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ *
+ */
+ result Construct(void);
+
+ /**
+ * Adds the stream filter to process the audio stream data while recording.
+ *
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ */
+ result AddAudioStreamFilter(IAudioStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop processing the audio stream data.
+ *
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ */
+ result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
+
+ /**
+ * Process the audio stream data and send to filter
+ *
+ *
+ * @return An error code
+ * @param[in, out] pStream audio stream data
+ * @param[in] size audio stream data size
+ * @param[in] samplingRate sampling rate in Hz
+ * @param[in] channel audio channel
+ * @param[in] sampleType audio sample
+ * @exception E_SUCCESS The method is successful.
+ */
+ result ProcessAudioStreamData(byte* pStream, int size, int samplingRate, AudioChannelType channel, AudioSampleType sampleType);
+
+ /**
+ * Return the count of the filter handle stored
+ *
+ * @return count of filter handle
+ */
+ int GetFilterListCount(void) const;
+
+private:
+
+ std::unique_ptr <Tizen::Base::Collection::ArrayListT< IAudioStreamFilter*>, _ListPtrUtil::Remover> __pStreamFilterList;
+};
+
+}}// Tizen::Media
+
+#endif
#include <camera.h>
#include <FBaseColIList.h>
#include <FBaseColIListT.h>
+#include <FBaseColQueue.h>
#include <FGrpPixelFormat.h>
#include <FMediaTypes.h>
+#include <FMediaIAudioStreamFilter.h>
+#include <FMediaIVideoStreamFilter.h>
#include "FMedia_CameraTypes.h"
namespace Tizen { namespace Media
{
-
+class IAudioStreamFilter;
/**
* @class _ListPtrUtil
* @brief This class is utility for list pointer handling.
delete pList;
}
}
+
+ void operator() (Tizen::Base::Collection::IListT<IAudioStreamFilter*>* pList) const
+ {
+ if (pList != null)
+ {
+ pList->RemoveAll();
+ delete pList;
+ }
+ }
+
+ void operator() (Tizen::Base::Collection::IListT<IVideoStreamFilter*>* pList) const
+ {
+ if (pList != null)
+ {
+ pList->RemoveAll();
+ delete pList;
+ }
+ }
+
+ void operator() (Tizen::Base::Collection::Queue* pQueue) const
+ {
+ if (pQueue != null)
+ {
+ pQueue->RemoveAll(true);
+ delete pQueue;
+ }
+ }
};
static Remover remover;
_COP_PRIMARY_METERING_MODE, _CAMERA_DEVICE_PRIMARY, GetSupportedMeteringModeN
},
{
+ _COP_PRIMARY_SCENE_MODE, _CAMERA_DEVICE_PRIMARY, GetSupportedSceneModeN
+ },
+ {
_COP_PRIMARY_WHITE_BALANCE, _CAMERA_DEVICE_PRIMARY, GetSupportedWhiteBalanceN
},
{
_COP_SECONDARY_METERING_MODE, _CAMERA_DEVICE_SECONDARY, GetSupportedMeteringModeN
},
{
+ _COP_SECONDARY_SCENE_MODE, _CAMERA_DEVICE_SECONDARY, GetSupportedSceneModeN
+ },
+ {
_COP_SECONDARY_WHITE_BALANCE, _CAMERA_DEVICE_SECONDARY, GetSupportedWhiteBalanceN
},
{
}
Tizen::Base::Object*
-_CameraCapability::GetSupportedSceneN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
+_CameraCapability::GetSupportedSceneModeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType)
{
Object* pScene = null;
int err = MM_SUCCESS;
else if (queryType == _QUERY_DEFAULT_VALUE)
{
int mmAttr = ::CAMERA_ATTR_SCENE_MODE_NORMAL;
- _CameraSceneMode value = CAMERA_SCENE_NONE;
+ CameraSceneMode value = CAMERA_SCENE_OFF;
pCapability->GetInitValue(_CameraCapability::ATTR_SCENE_MODE, mmAttr);
- r = _CameraUtil::GetOspScene((camera_attr_scene_mode_e)mmAttr, value);
+ r = _CameraUtil::GetOspSceneMode((camera_attr_scene_mode_e)mmAttr, value);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, null, r, "[%s] Propagating.", GetErrorMessage(r));
std::unique_ptr<Integer> pSceneValue (new (std::nothrow) Integer((int)value));
Tizen::Graphics::PixelFormat capturePixelValue = (Tizen::Graphics::PixelFormat)MEDIA_INVALID_VALUE;
// This means that the raw format capture is not supported yet.
- if ( format == ::CAMERA_PIXEL_FORMAT_I420 || format == ::CAMERA_PIXEL_FORMAT_YUYV )
+ if (format != ::CAMERA_PIXEL_FORMAT_JPEG)
{
return true;
}
_CameraCapability::SupportedCameraAttrSceneModeCb(camera_attr_scene_mode_e mode, void *pUserData)
{
result r = E_SUCCESS;
- _CameraSceneMode sceneModeValue = (_CameraSceneMode)MEDIA_INVALID_VALUE;
+ CameraSceneMode sceneModeValue = (CameraSceneMode)MEDIA_INVALID_VALUE;
_MediaSafeArrayList* pSceneList = static_cast<_MediaSafeArrayList*>(pUserData);
SysTryReturn(NID_MEDIA, pSceneList != null, false, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The user list is not found.");
- r = _CameraUtil::GetOspScene(mode, sceneModeValue);
+ r = _CameraUtil::GetOspSceneMode(mode, sceneModeValue);
if (r == E_SUCCESS)
{
std::unique_ptr<Object> pInteger (new (std::nothrow) Integer(sceneModeValue));
* @exception E_OUT_OF_MEMORY system has no memory
* @exception E_OBJ_NOT_FOUND invalid key
*/
- static Tizen::Base::Object* GetSupportedSceneN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType);
+ static Tizen::Base::Object* GetSupportedSceneModeN(_CameraDeviceType deviceType, _QueryType queryType, _ResultType& itemType);
/**
* function to get the supported metering
#include <FMediaCamera.h>
#include <FMediaICameraEventListener.h>
#include <FMediaCapabilityTypes.h>
+#include <FMediaIVideoStreamFilter.h>
#include "FMedia_CameraImpl.h"
#include "FMedia_CameraEvent.h"
#include "FMedia_CameraUtil.h"
#include "FMedia_CameraCapability.h"
#include "FMedia_CameraCoordinator.h"
#include "FMedia_CapabilityImpl.h"
-#include "FMedia_CamPtrUtil.h"
+#include "FMedia_VideoStreamCoordinator.h"
#define _CAMERA_EVAS_PIXMAP_ 1
static const int _RELOAD_FOCUS_MODE = 0x1 << 21;
static const int _RELOAD_ZERO_SHUTTER_LAG = 0x1 << 22;
static const int _RELOAD_METERING_MODE = 0x1 << 23;
-static const int _RELOAD_EXTRA = 0x1 << 24;
+static const int _RELOAD_SCENE_MODE = 0x1 << 24;
+static const int _RELOAD_EXTRA = 0x1 << 25;
static const int _PREVIEW_PRE_PROCESSING = 0x01;
static const int _PREVIEW_POST_PROCESSING = 0x01 << 1;
static const double _CAMERA_EXIF_GPS_INVALID_LONGITUDE = 180.1;
static const int _MAX_CAPTURE_BUFFER_COUNT = 10;
-static const int _MAX_PREVIEW_BUFFER_COUNT = 2;
+static const int _MAX_PREVIEW_BUFFER_COUNT = 1;
static const int _MIN_PROPERTY = 0;
static const int _MAX_PROPERTY = 9;
static const int _INVALID_FOCUS_COORDINATE = -1;
, __state(CAMERA_STATE_INITIALIZED)
, __handle(MM_INVALID_HANDLE)
, __pCameraEvent(null)
+ , __pVideoStreamCoordinator(null)
, __pCameraEventListener(null)
- , __pCaptureBufferQueue(null)
- , __pPreviewBufferQueue(null)
+ , __pCaptureBufferQueue(null, _ListPtrUtil::remover)
+ , __pPreviewBufferQueue(null, _ListPtrUtil::remover)
, __isConstructed(false)
, __isPoweredOn(false)
, __selection(CAMERA_PRIMARY)
, __flashMode(CAMERA_FLASH_MODE_OFF)
, __zeroShutterLag(false)
, __meteringMode(CAMERA_METERING_MODE_NONE)
+ , __sceneMode(CAMERA_SCENE_OFF)
, __focusCallback(false)
, __isFocusAreaSet(false)
, __exifOrientation(CAMERA_EXIF_ORIENTATION_NONE)
, __physicalDirection(CAMERA_DIRECTION_BACK)
, __physicalRotation(CAMERA_ROTATION_NONE)
, __supportedFocusPointCount(0)
- , __pPreProcessCbFunc(null)
- , __pPreProcessUserData(null)
{
__previewResolution.width = 0;
__previewResolution.height = 0;
int err = MM_SUCCESS;
err = camera_unset_state_changed_cb(__handle);
err = camera_unset_interrupted_cb(__handle);
+ err = camera_unset_error_cb(__handle);
err = camera_unset_focus_changed_cb(__handle);
err = camera_unset_preview_cb(__handle);
__handle = MM_INVALID_HANDLE;
_CameraCapability::Release(__deviceType);
}
- if (__pCameraEvent != null)
- {
- delete __pCameraEvent;
- }
-
- if (__pCaptureBufferQueue != null)
- {
- __pCaptureBufferQueue->RemoveAll(true);
- delete __pCaptureBufferQueue;
- }
-
- if (__pPreviewBufferQueue != null)
- {
- __pPreviewBufferQueue->RemoveAll(true);
- delete __pPreviewBufferQueue;
- }
-
if ( __isConstructed )
{
__isUsed = false;
__supportedFocusPointCount = focusPoint;
// Create Event
- __pCameraEvent = new (std::nothrow) _CameraEvent();
- SysTryReturn(NID_MEDIA, __pCameraEvent != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pCameraEvent.reset(new (std::nothrow) _CameraEvent());
+ SysTryReturn(NID_MEDIA, __pCameraEvent.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = __pCameraEvent->Construct(*this);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
__pCameraEventListener = &listener;
+// Video stream coordinator
+ __pVideoStreamCoordinator.reset(new (std::nothrow) _VideoStreamCoordinator());
+ SysTryReturn(NID_MEDIA, __pVideoStreamCoordinator.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = __pVideoStreamCoordinator->Construct();
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
// Prepare captured buffer list
- __pCaptureBufferQueue = new (std::nothrow) Tizen::Base::Collection::Queue();
- SysTryCatch(NID_MEDIA, __pCaptureBufferQueue != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pCaptureBufferQueue.reset(new (std::nothrow) Tizen::Base::Collection::Queue());
+ SysTryCatch(NID_MEDIA, __pCaptureBufferQueue.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = __pCaptureBufferQueue->Construct(_MAX_CAPTURE_BUFFER_COUNT); // For async panorama shot.
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
// Prepare preview buffer list
- __pPreviewBufferQueue = new (std::nothrow) Tizen::Base::Collection::Queue();
- SysTryCatch(NID_MEDIA, __pPreviewBufferQueue != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+ __pPreviewBufferQueue.reset(new (std::nothrow) Tizen::Base::Collection::Queue());
+ SysTryCatch(NID_MEDIA, __pPreviewBufferQueue.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
r = __pPreviewBufferQueue->Construct(_MAX_PREVIEW_BUFFER_COUNT); // For async preview data.
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
r = ConvertResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ err = camera_set_error_cb(__handle, ErrorCb, this);
+ r = ConvertResult(err);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
err = camera_set_focus_changed_cb(__handle, FocusStateChangedCb, this);
r = ConvertResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Failed to set the focus changed callback.", GetErrorMessage(r));
{
err = camera_unset_state_changed_cb(__handle);
err = camera_unset_interrupted_cb(__handle);
+ err = camera_unset_error_cb(__handle);
err = camera_unset_focus_changed_cb(__handle);
}
__pCameraEventListener = null;
}
- if (__pCameraEvent != null)
- {
- delete __pCameraEvent;
- __pCameraEvent = null;
- }
-
- if (__pCaptureBufferQueue != null)
- {
- __pCaptureBufferQueue->RemoveAll(true);
- delete __pCaptureBufferQueue;
- __pCaptureBufferQueue = null;
- }
+ __pCameraEvent.reset(null);
+ __pVideoStreamCoordinator.reset(null);
+ __pCaptureBufferQueue.reset(null);
return r;
}
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Temporarily forbidden the preview callback.", GetErrorMessage(r));
// re-configuration for new camera handle. active conf.
- r = ReloadConfiguration(_RELOAD_BRIGHTNESS | _RELOAD_CONTRAST | _RELOAD_EXPOSURE | _RELOAD_MAX_ZOOM_LEVEL
+ if (__sceneMode == CAMERA_SCENE_OFF)
+ {
+ r = ReloadConfiguration(_RELOAD_BRIGHTNESS | _RELOAD_WB | _RELOAD_ISO | _RELOAD_METERING_MODE | _RELOAD_FLASH);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] camera reload configuration failed", GetErrorMessage(r));
+ }
+
+ r = ReloadConfiguration(_RELOAD_CONTRAST | _RELOAD_EXPOSURE | _RELOAD_MAX_ZOOM_LEVEL
| _RELOAD_PREVIEW_RESOLUTION | _RELOAD_CAPTURE_RESOLUTION | _RELOAD_PREVIEW_FORMAT
- | _RELOAD_CAPTURE_FORMAT | _RELOAD_FPS | _RELOAD_EFFECT | _RELOAD_WB | _RELOAD_QUALITY | _RELOAD_ISO
+ | _RELOAD_CAPTURE_FORMAT | _RELOAD_FPS | _RELOAD_EFFECT | _RELOAD_QUALITY
| _RELOAD_EXIF_ORIENTATION | _RELOAD_EXIF_GPS_COORDINATES
- | _RELOAD_FLIP | _RELOAD_PREVIEW_ROTATION | _RELOAD_FLASH
+ | _RELOAD_FLIP | _RELOAD_PREVIEW_ROTATION | _RELOAD_SCENE_MODE
| _RELOAD_EXTRA);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] camera reload configuration failed", GetErrorMessage(r));
return r;
displayHandle = pBufferInfoImpl->GetHandle(_BufferInfoImpl::HANDLE_TYPE_VE_SURFACE);
displayType = ::CAMERA_DISPLAY_TYPE_EVAS;
}
+ SysLog(NID_MEDIA, "Display type %d", displayType);
SysTryCatch(NID_MEDIA, displayHandle != _BufferInfoImpl::INVALID_BUFFER_HANDLE, r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. displayHandle:%d is wrong", displayHandle);
if ((displayHandle != __previewRegionHandle) || (state != CAMERA_STATE_CAPTURED))
if (__isPoweredOn)
{
+ if(__sceneMode != CAMERA_SCENE_OFF)
+ {//because this attribute is related to scene mode.
+ r = SetSceneModeAttr(CAMERA_SCENE_OFF);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. ResetSceneMode", GetErrorMessage(r));
+ }
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_BRIGHTNESS : _COP_SECONDARY_BRIGHTNESS);
r = SetProperty(operation, _MIN_PROPERTY, _MAX_PROPERTY, brightness);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. brightness:%d", GetErrorMessage(r), brightness);
state = GetState();
SysTryReturn(NID_MEDIA, state == CAMERA_STATE_INITIALIZED || state == CAMERA_STATE_PREVIEW || state == CAMERA_STATE_CAPTURED
, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Camera is in an invalid state. This method is not working in this state. Current state is :%d", state);
+ SysTryReturn(NID_MEDIA, flashMode >= CAMERA_FLASH_MODE_OFF, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Invalid argument(flashMode) is used. flashMode=%d", flashMode);
_CameraOperationType operation = _COP_NONE;
operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_FLASH_MODE : _COP_SECONDARY_FLASH_MODE);
SysTryCatch(NID_MEDIA, pFlashModeList->Contains(Integer(flashMode)) || flashMode == CAMERA_FLASH_MODE_OFF,
r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This flashMode(%d) is not supported in the device.\n", flashMode);
+ if(__sceneMode != CAMERA_SCENE_OFF)
+ {//because this attribute is related to scene mode.
+ r = SetSceneModeAttr(CAMERA_SCENE_OFF);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. ResetSceneMode", GetErrorMessage(r));
+ }
r = _CameraUtil::GetMmFlashMode(flashMode, attr);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. flashMode:%d", GetErrorMessage(r), flashMode);
SysTryCatch(NID_MEDIA, pWbList->GetCount() > 0, r = E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION]");
SysTryCatch(NID_MEDIA, pWbList->Contains(Integer(whiteBalance)), r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This whiteBalance(%d) is not supported in the device.\n", whiteBalance);
+ if(__sceneMode != CAMERA_SCENE_OFF)
+ {//because this attribute is related to scene mode.
+ r = SetSceneModeAttr(CAMERA_SCENE_OFF);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. ResetSceneMode", GetErrorMessage(r));
+ }
camera_attr_whitebalance_e attr = ::CAMERA_ATTR_WHITE_BALANCE_NONE;
r = _CameraUtil::GetMmWhiteBalance(whiteBalance, attr);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. whiteBalance:%d", GetErrorMessage(r), whiteBalance);
SysTryCatch(NID_MEDIA, pSupportedList->Contains(Integer(focusMode))
, r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This mode(%d) is not supported in the device.\n", focusMode);
+ if(__sceneMode != CAMERA_SCENE_OFF)
+ {//because this attribute is related to scene mode.
+ r = SetSceneModeAttr(CAMERA_SCENE_OFF);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. ResetSceneMode", GetErrorMessage(r));
+ }
// Set the __focusCallback to false not to call the focus callback in case of CAF.
r = ChangeFocusModeTo(__focusMode, focusMode);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. current focus mode is %d, new focus mode is %d", GetErrorMessage(r), __focusMode, focusMode);
SysTryCatch(NID_MEDIA, pIsoList->Contains(Integer(isoLevel)) || isoLevel == CAMERA_ISO_DEFAULT || isoLevel == CAMERA_ISO_MIN
|| isoLevel == CAMERA_ISO_MAX, r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This isoLevel(%d) is not supported in the device.\n", isoLevel);
+ if(__sceneMode != CAMERA_SCENE_OFF)
+ {//because this attribute is related to scene mode.
+ r = SetSceneModeAttr(CAMERA_SCENE_OFF);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. ResetSceneMode", GetErrorMessage(r));
+ }
r = _CameraUtil::GetMmIso(isoLevel, attr);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. isoLevel :%d", GetErrorMessage(r), isoLevel);
SysTryCatch(NID_MEDIA, pSupportedList->Contains(Integer(meteringMode)) || meteringMode == CAMERA_METERING_MODE_NONE
, r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This mode(%d) is not supported in the device.\n", meteringMode);
+ if(__sceneMode != CAMERA_SCENE_OFF)
+ {//because this attribute is related to scene mode.
+ r = SetSceneModeAttr(CAMERA_SCENE_OFF);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating. ResetSceneMode", GetErrorMessage(r));
+ }
r = _CameraUtil::GetMmMeteringMode(meteringMode, attr);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. rotation:%d", GetErrorMessage(r), meteringMode);
}
result
+_CameraImpl::SetSceneMode(CameraSceneMode sceneMode)
+{
+ result r = E_SUCCESS;
+ CameraState state = CAMERA_STATE_ERROR;
+ int err = MM_SUCCESS;
+ camera_attr_scene_mode_e attr = ::CAMERA_ATTR_SCENE_MODE_NORMAL;
+ SysLog(NID_MEDIA, "Enter. sceneMode:%d", sceneMode);
+
+ SysTryReturn(NID_MEDIA, __isPoweredOn == true, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Camera was not powered on.");
+
+ state = GetState();
+ SysTryReturn(NID_MEDIA, state == CAMERA_STATE_INITIALIZED || state == CAMERA_STATE_PREVIEW || state == CAMERA_STATE_CAPTURED
+ , E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] This method is not working in this state. Current state is :%d", state);
+ SysTryReturn(NID_MEDIA, sceneMode >= CAMERA_SCENE_OFF, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] This mode %d cannot be set.", sceneMode);
+
+ _CameraOperationType operation = _COP_NONE;
+ _ResultType itemType = _RESULT_INTEGER_LIST;
+ operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_SCENE_MODE : _COP_SECONDARY_SCENE_MODE);
+ std::unique_ptr <IList, _ListPtrUtil::Remover> pSceneModeList (GetPropertyListN(operation, itemType), _ListPtrUtil::remover);
+ SysTryCatch(NID_MEDIA, pSceneModeList.get() != null, r = E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION]");
+
+ SysTryCatch(NID_MEDIA, pSceneModeList->GetCount() > 0, r = E_UNSUPPORTED_OPERATION, E_UNSUPPORTED_OPERATION, "[E_UNSUPPORTED_OPERATION]");
+ SysTryCatch(NID_MEDIA, pSceneModeList->Contains(Integer(sceneMode))
+ , r = E_UNSUPPORTED_TYPE, E_UNSUPPORTED_TYPE, "[E_UNSUPPORTED_TYPE]. This mode(%d) is not supported in the device.\n", sceneMode);
+
+ r = _CameraUtil::GetMmSceneMode(sceneMode, attr);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. sceneMode:%d", GetErrorMessage(r), sceneMode);
+
+ err = camera_attr_set_scene_mode(__handle, attr);
+ r = ConvertResult(err);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] camera scene mode failed. sceneMode:%d", GetErrorMessage(r), sceneMode);
+
+ if ((sceneMode == CAMERA_SCENE_OFF) && (__sceneMode != CAMERA_SCENE_OFF))
+ {
+ __sceneMode = sceneMode;
+ r = ReloadConfiguration(_RELOAD_BRIGHTNESS | _RELOAD_WB | _RELOAD_ISO | _RELOAD_METERING_MODE | _RELOAD_FOCUS_MODE | _RELOAD_FLASH);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+ }
+ else
+ {
+ __sceneMode = sceneMode;
+ }
+CATCH:
+ return r;
+}
+
+CameraSceneMode
+_CameraImpl::GetSceneMode(void) const
+{
+ return __sceneMode;
+}
+
+result
+_CameraImpl::SetSceneModeAttr(CameraSceneMode sceneMode)
+{
+ result r = E_SUCCESS;
+ int err = MM_SUCCESS;
+ camera_attr_scene_mode_e attr = ::CAMERA_ATTR_SCENE_MODE_NORMAL;
+
+ r = _CameraUtil::GetMmSceneMode(sceneMode, attr);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. sceneMode:%d", GetErrorMessage(r), sceneMode);
+
+ err = camera_attr_set_scene_mode(__handle, attr);
+ r = ConvertResult(err);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] camera scene mode failed. sceneMode:%d", GetErrorMessage(r), sceneMode);
+ __sceneMode = sceneMode;
+
+ if(sceneMode == CAMERA_SCENE_OFF)
+ {
+ r = ReloadConfiguration(_RELOAD_BRIGHTNESS | _RELOAD_WB | _RELOAD_ISO | _RELOAD_METERING_MODE | _RELOAD_FOCUS_MODE | _RELOAD_FLASH);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+ }
+CATCH:
+ return r;
+}
+
+result
+_CameraImpl::AddVideoStreamFilter(IVideoStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pVideoStreamCoordinator->AddVideoStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+
+ __previewProcessing = __previewProcessing | _PREVIEW_PRE_PROCESSING;
+
+ return r;
+}
+
+result
+_CameraImpl::RemoveVideoStreamFilter(IVideoStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pVideoStreamCoordinator->RemoveVideoStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+
+ if (__pVideoStreamCoordinator->GetFilterListCount() == 0)
+ {
+ __previewProcessing = __previewProcessing & (~_PREVIEW_PRE_PROCESSING);
+ }
+
+ return r;
+}
+
+result
_CameraImpl::ConvertResult(int err) const
{
result r = E_SYSTEM;
__state = state;
}
-_CameraEvent*
-_CameraImpl::GetEvent(void) const
-{
- return __pCameraEvent;
-}
-
CameraSelection
_CameraImpl::GetSelection(void) const
{
return __selection;
}
-int
-_CameraImpl::GetPreviewProcessing(void) const
-{
- return __previewProcessing;
-}
-
result
_CameraImpl::EnqueueData(_CameraBuffer& cameraBuffer)
{
return null;
}
-int
-_CameraImpl::GetDataCount(_CameraBufferType bufferType)
-{
- int count = 0;
- switch (bufferType)
- {
- case _CAMERA_BUFFER_CAPTURE:
- count = __pCaptureBufferQueue->GetCount();
- break;
-
- case _CAMERA_BUFFER_PREVIEW:
- count = __pPreviewBufferQueue->GetCount();
- break;
-
- case _CAMERA_BUFFER_NONE:
- default:
- break;
- }
- return count;
-}
-
_CameraCoordinator*
_CameraImpl::GetCoordinator(void)
{
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. metering:%d", GetErrorMessage(r), __meteringMode);
}
}
+ if (reload & _RELOAD_SCENE_MODE)
+ {
+ _CameraOperationType operation = _COP_NONE;
+ operation = (__selection == CAMERA_PRIMARY ? _COP_PRIMARY_SCENE_MODE : _COP_SECONDARY_SCENE_MODE);
+
+ if ( _CameraCapability::IsSupported(operation))
+ {
+ camera_attr_scene_mode_e attr = ::CAMERA_ATTR_SCENE_MODE_NORMAL;
+ r = _CameraUtil::GetMmSceneMode(__sceneMode, attr);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. scenemode:%d", GetErrorMessage(r), __sceneMode);
+
+ err = camera_attr_set_scene_mode(__handle, attr);
+ r = ConvertResult(err);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. scenemode:%d", GetErrorMessage(r), __sceneMode);
+ }
+ }
if (reload & _RELOAD_EXTRA)
{
err = camera_attr_enable_tag(__handle, true);
result r = E_SUCCESS;
SysLog(NID_MEDIA, "Mode:%d", mode);
- r = ReloadConfiguration(_RELOAD_BRIGHTNESS | _RELOAD_CONTRAST | _RELOAD_EXPOSURE | _RELOAD_MAX_ZOOM_LEVEL | _RELOAD_ZOOM_LEVEL | _RELOAD_EFFECT
- | _RELOAD_WB | _RELOAD_QUALITY | _RELOAD_ISO | _RELOAD_EXIF_ORIENTATION | _RELOAD_EXIF_GPS_COORDINATES
- | _RELOAD_FLASH | _RELOAD_FOCUS_MODE | _RELOAD_METERING_MODE
- | _RELOAD_EXTRA);
+ if (__sceneMode == CAMERA_SCENE_OFF)
+ {
+ r = ReloadConfiguration(_RELOAD_BRIGHTNESS | _RELOAD_WB | _RELOAD_ISO | _RELOAD_METERING_MODE | _RELOAD_FLASH | _RELOAD_FOCUS_MODE );
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+ }
+
+ r = ReloadConfiguration(_RELOAD_CONTRAST | _RELOAD_EXPOSURE | _RELOAD_MAX_ZOOM_LEVEL | _RELOAD_ZOOM_LEVEL | _RELOAD_EFFECT
+ | _RELOAD_QUALITY | _RELOAD_EXIF_ORIENTATION | _RELOAD_EXIF_GPS_COORDINATES
+ | _RELOAD_SCENE_MODE | _RELOAD_EXTRA);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
SysLog(NID_MEDIA, "Post mode changed operation succeeded.");
SysLog(NID_MEDIA, "Captured data sending. size is %d", pBuffer->GetLimit());
if (pBuffer->GetLimit() > 0)
{
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_NONE, E_SUCCESS, pBuffer);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_NONE, E_SUCCESS, pBuffer);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
else
{
SysLogException(NID_MEDIA, E_INVALID_DATA, "[E_INVALID_DATA] The captured data is invalid.");
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_DEVICE_FAILED, E_INVALID_DATA, pBuffer);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_DEVICE_FAILED, E_INVALID_DATA, pBuffer);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
delete pBuffer;
else
{
SysLogException(NID_MEDIA, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Out of memory for capturing anymore.");
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, null);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_CAPTURED, CAMERA_ERROR_OUT_OF_MEMORY, E_OUT_OF_MEMORY, null);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
}
void
-_CameraImpl::SetPreprocessingCb(_CameraPreprocessingCallback pPreProcessCbFunc, void* pPreProcessUserData)
-{
- if (pPreProcessCbFunc != null)
- {
- __previewProcessing = __previewProcessing | _PREVIEW_PRE_PROCESSING;
- }
- else
- {
- __previewProcessing = __previewProcessing & (~_PREVIEW_PRE_PROCESSING);
- }
-
- __pPreProcessCbFunc = pPreProcessCbFunc;
- __pPreProcessUserData = pPreProcessUserData;
-}
-
-void
-_CameraImpl::GetPreprocessingCb(_CameraPreprocessingCallback& pPreProcessCbFunc, void*& pPreProcessUserData)
-{
- pPreProcessCbFunc = __pPreProcessCbFunc;
- pPreProcessUserData= __pPreProcessUserData;
-}
-
-void
_CameraImpl::PreviewCb(camera_preview_data_s *pFrame, void *pUserData)
{
result r = E_SUCCESS;
SysTryReturn(NID_MEDIA, pFrame != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] camera_preview_data_s instance is not available.");
SysLog(NID_MEDIA, "Enter. preview format:%d, width:%d, height:%d, num_of_planes:%d", pFrame->format, pFrame->width, pFrame->height, pFrame->num_of_planes);
- queueCount = pImpl->GetDataCount(_CAMERA_BUFFER_PREVIEW);
+ queueCount = pImpl->__pPreviewBufferQueue->GetCount();
if (queueCount < _MAX_PREVIEW_BUFFER_COUNT)
{
- int previewProcessing = pImpl->GetPreviewProcessing();
+ int previewProcessing = pImpl->__previewProcessing;
if (previewProcessing & _PREVIEW_PRE_PROCESSING)
{
//for Preprocessing
- int size[4] = {0,};
- byte* data[4] = {0,};
+ int size[MAX_CAMERA_PLANE_COUNT] = {0,};
+ byte* data[MAX_CAMERA_PLANE_COUNT] = {0,};
+ VideoPlaneType planeType[MAX_CAMERA_PLANE_COUNT] = {VIDEO_PLANE_TYPE_NONE,};
if (pFrame->num_of_planes == 1)
{
size[0] = pFrame->data.single_plane.size;
data[0] = pFrame->data.single_plane.yuv;
+ planeType[0] = VIDEO_PLANE_TYPE_YUV;
}
else if (pFrame->num_of_planes == 2)
size[1] = pFrame->data.double_plane.uv_size;
data[0] = pFrame->data.double_plane.y;
data[1] = pFrame->data.double_plane.uv;
+ planeType[0] = VIDEO_PLANE_TYPE_Y;
+ planeType[1] = VIDEO_PLANE_TYPE_UV;
}
else if (pFrame->num_of_planes == 3)
{
data[0] = pFrame->data.triple_plane.y;
data[1] = pFrame->data.triple_plane.u;
data[2] = pFrame->data.triple_plane.v;
+ planeType[0] = VIDEO_PLANE_TYPE_Y;
+ planeType[1] = VIDEO_PLANE_TYPE_U;
+ planeType[2] = VIDEO_PLANE_TYPE_V;
}
MediaPixelFormat mediaFormat = MEDIA_PIXEL_FORMAT_NONE;
double ratio = 0.0;
_CameraUtil::GetOspMediaPixelFormat(pFrame->format, mediaFormat, ratio);
- _CameraPreprocessingCallback pPreProcessCbFunc = null;
- void* pPreProcessUserData = null;
- pImpl->GetPreprocessingCb(pPreProcessCbFunc, pPreProcessUserData);
-
- (pPreProcessCbFunc)(mediaFormat, data, size, pPreProcessUserData);
+ r = pImpl->__pVideoStreamCoordinator->ProcessVideoStreamData(mediaFormat, pFrame->width, pFrame->height, pFrame->num_of_planes, data, size, planeType);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. mediaFormat:%d, plane count:%d, width:%d, height:%d, size:%d"
+ , GetErrorMessage(r), mediaFormat, pFrame->num_of_planes, pFrame->width, pFrame->height, size);
}
if (previewProcessing & _PREVIEW_POST_PROCESSING)
r = pImpl->EnqueueData(mmCameraBuffer);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating. size:%d", GetErrorMessage(r), mmPreviewSize);
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_PREVIEWED_DATA, CAMERA_ERROR_NONE, E_SUCCESS, null); // For the performance, we don't copy the preview data to the event argument.
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_PREVIEWED_DATA, CAMERA_ERROR_NONE, E_SUCCESS, null); // For the performance, we don't copy the preview data to the event argument.
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
}
CATCH:
SysLogException(NID_MEDIA, E_INVALID_DATA, "[E_INVALID_DATA] Invalid data is streamed..");
- if (queueCount < pImpl->GetDataCount(_CAMERA_BUFFER_PREVIEW)) // if the queue is increased.
+ if (queueCount < pImpl->__pPreviewBufferQueue->GetCount()) // if the queue is increased.
{
ByteBuffer* pBuffer = null;
pBuffer = pImpl->DequeueDataN(_CAMERA_BUFFER_PREVIEW);
SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
SysTryReturn(NID_MEDIA, pImpl->IsPoweredOn() == true, , E_INVALID_OPERATION ,"The camera is already power-offed");
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_ERROR, CAMERA_ERROR_DEVICE_INTERRUPTED, E_DEVICE_FAILED, null);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_ERROR, CAMERA_ERROR_DEVICE_INTERRUPTED, E_DEVICE_FAILED, null);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "Sending camera interrupted failed [%s] .", GetErrorMessage(r));
CATCH:
return;
}
void
+_CameraImpl::ErrorCb(camera_error_e error, camera_state_e current, void *pUserData)
+{
+ result r = E_SUCCESS;
+ _CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
+ SysLog(NID_MEDIA, "ErrorCb called, error is 0x%x, current state is %d, pUserData address is %x ", error, current, pUserData );
+ SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
+ SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
+ switch (error)
+ {
+ case ::CAMERA_ERROR_OUT_OF_MEMORY:
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_ERROR, CAMERA_ERROR_OUT_OF_MEMORY, E_DEVICE_FAILED, null);
+ break;
+ case ::CAMERA_ERROR_DEVICE:
+ //fall through
+ case ::CAMERA_ERROR_DEVICE_BUSY:
+ //fall through
+ case ::CAMERA_ERROR_DEVICE_NOT_FOUND:
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_ERROR, CAMERA_ERROR_DEVICE_FAILED, E_DEVICE_FAILED, null);
+ break;
+ default:
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_ERROR, CAMERA_ERROR_DEVICE_FAILED, E_DEVICE_FAILED, null);
+ break;
+ }
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "Sending camera error failed [%s] .", GetErrorMessage(r));
+CATCH:
+ return;
+}
+
+void
_CameraImpl::FocusStateChangedCb(camera_focus_state_e state, void *pUserData)
{
result r = E_SUCCESS;
_CameraImpl* pImpl = static_cast<_CameraImpl*>(pUserData);
CameraErrorReason cameraErrorReason = CAMERA_ERROR_NONE;
result cameraResult = E_SUCCESS;
+ SysLog(NID_MEDIA, "Enter. state is %d.", state);
SysTryReturn(NID_MEDIA, _CameraImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _CameraImpl instance is not available.");
{
cameraErrorReason = CAMERA_ERROR_NONE;
cameraResult = E_OPERATION_CANCELED;
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_AUTO_FOCUSED, cameraErrorReason, cameraResult, null);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_AUTO_FOCUSED, cameraErrorReason, cameraResult, null);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
}
cameraResult = E_DEVICE_FAILED;
if (pImpl->ReadyToAutoFocusCallback())
{
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_AUTO_FOCUSED, cameraErrorReason, cameraResult, null);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_AUTO_FOCUSED, cameraErrorReason, cameraResult, null);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
else // No auto focus event is fired.
case ::CAMERA_FOCUS_STATE_FOCUSED:
if (pImpl->ReadyToAutoFocusCallback())
{
- r = pImpl->GetEvent()->SendEvent(_CAMERA_EVENT_AUTO_FOCUSED, cameraErrorReason, cameraResult, null);
+ r = pImpl->__pCameraEvent->SendEvent(_CAMERA_EVENT_AUTO_FOCUSED, cameraErrorReason, cameraResult, null);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
}
else // No auto focus event is fired.
#ifndef _FMEDIA_INTERNAL_CAMERA_IMPL_H_
#define _FMEDIA_INTERNAL_CAMERA_IMPL_H_
+#include <unique_ptr.h>
#include <camera.h>
#include <FBaseColIList.h>
#include <FBaseColIListT.h>
#include <FGrpRectangle.h>
#include <FMediaCameraTypes.h>
#include <FMediaTypes.h>
+#include <FMediaIVideoStreamFilter.h>
#include "FMedia_CameraTypes.h"
#include "FMedia_CapabilityTypes.h"
#include "FMedia_ICameraCoordinatorListener.h"
#include "FMedia_CameraBuffer.h"
+#include "FMedia_CamPtrUtil.h"
namespace Tizen { namespace Media
{
class _CameraCoordinator;
class _CameraCapability;
class _ImageUtilImpl;
-
-typedef void (*_CameraPreprocessingCallback)( MediaPixelFormat format, byte* data[4], int size[4], void* user);
+class _VideoStreamCoordinator;
/**
* @class _CameraImpl
CameraMeteringMode GetMeteringMode(void) const;
/**
+ * Sets the scene mode of the camera.
+ *
+ * @return An error code
+ * @param[in] sceneMode The scene mode
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_STATE This instance is in an invalid state for this method.
+ * @exception E_DEVICE_BUSY The camera is under use by other application.
+ * @exception E_DEVICE_UNAVAILABLE The camera becomes unavailable.
+ * @exception E_DEVICE_FAILED The device operation has failed.
+ * @exception E_INVALID_ARG The specified scene mode is invalid.
+ * @exception E_UNSUPPORTED_OPERATION The target device does not support scene mode configuration feature.
+ * @exception E_UNSUPPORTED_TYPE The specified @c sceneMode is not supported.
+ * @remarks In a specific scene mode, camera's attributes such as brightness, metering mode, iso level, white balance, flash and focus are changed to the ones which are pre-defined by each scene mode.@n
+ * In a specific scene mode, if an application sets any attribute which is related to the scene, the mode can be changed to ::CAMERA_SCENE_OFF.@n
+ * Thus it is recommended that the application checks the current scene mode after setting the attributes.@n
+ * In case that the scene mode is changed to ::CAMERA_SCENE_OFF, all the attributes set by the application are re-loaded.@n
+ */
+ result SetSceneMode(CameraSceneMode sceneMode);
+
+ /**
+ * Adds the stream filter to process the video stream data while previewing or recording.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @remarks IVideoStreamFilter::ProcessVideoStream() will be called when the video frame is ready.
+ */
+ result AddVideoStreamFilter(IVideoStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop receiving the video stream data.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ */
+ result RemoveVideoStreamFilter(IVideoStreamFilter& filter);
+
+ /**
+ * Gets the scene mode of the camera.
+ *
+ * @return The %Camera scene mode
+ */
+ CameraSceneMode GetSceneMode(void) const;
+
+ /**
* Gets the camera's state.
*
* @return The state
void SetState(CameraState state);
/**
- * Get the event processing object.
- *
- * @return The event processing object.
- * @remarks This event is working synchronously.
- */
- _CameraEvent* GetEvent(void) const;
-
- /**
* Get the camera selection.
*
* @return The camera selection.
CameraSelection GetSelection(void) const;
/**
- * Gets the preview process flag
- *
- * @return The preview processing flag
- */
- int GetPreviewProcessing(void) const;
-
- /**
* Enqueues the preview or captured data.
*
* @return An error code
_CameraBuffer* DequeueDataN(_CameraBufferType bufferType);
/**
- * Gets the queue's element count.
- *
- * @return A count of queue element
- * @param[in] bufferType Queue type
- */
- int GetDataCount(_CameraBufferType bufferType);
-
- /**
* Gets the camera coordinator.
*
* @return camera coordinator
result OnCameraCoordinatorModeChanged(_CameraMode mode);
/**
- * Sets the preprocessing callback fuction pointer.
- *
- * @param[in] pPreProcessCbFunc preprocessing callback fuction pointer
- * @param[in] pPreProcessUserData preprocessing userdata pointer
- */
- void SetPreprocessingCb(_CameraPreprocessingCallback pPreProcessCbFunc, void* pPreProcessUserData);
-
- /**
- * Gets the preprocessing callback fuction pointer.
- *
- * @param[out] pPreProcessCbFunc preprocessing callback fuction pointer
- * @param[out] pPreProcessUserData preprocessing userdata pointer
- */
- void GetPreprocessingCb(_CameraPreprocessingCallback& pPreProcessCbFunc, void*& pPreProcessUserData);
-
- /**
* Function definition for start capture.
*
* @return This function returns 0 on success, else on failure.
*/
static void InterruptedCb(camera_policy_e policy, camera_state_e previous, camera_state_e current, void *pUserData);
+
+ /**
+ * Function definition for error callback.
+ *
+ * @param[in] error The cause which made the error
+ * @param[in] current Current state
+ * @param[in] pUserData User parameter which is received from user when callback function was set
+ * @remarks This function is called in the camera created thread.
+ */
+ static void ErrorCb(camera_error_e error, camera_state_e current, void *pUserData);
+
/**
* Function definition for focus changed callback.
*
*/
result HandleAutoFocus(CameraFocusMode currentMode);
+ /**
+ * Sets the scene mode of the camera internally.
+ *
+ * @return An error code
+ * @param[in] sceneMode The scene mode
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_DEVICE_FAILED The device operation has failed.
+ * @exception E_SYSTEM A system error has occurred.
+ */
+ result SetSceneModeAttr(CameraSceneMode sceneMode);
+
_CameraImpl(const _CameraImpl& camera);
_CameraImpl& operator =(const _CameraImpl& camera);
CameraState __state;
_CameraHandle __handle;
- _CameraEvent* __pCameraEvent;
+ std::unique_ptr <_CameraEvent> __pCameraEvent;
+ std::unique_ptr <_VideoStreamCoordinator> __pVideoStreamCoordinator;
ICameraEventListener* __pCameraEventListener;
- Tizen::Base::Collection::Queue* __pCaptureBufferQueue;
- Tizen::Base::Collection::Queue* __pPreviewBufferQueue;
+ std::unique_ptr <Tizen::Base::Collection::Queue, _ListPtrUtil::Remover> __pCaptureBufferQueue;
+ std::unique_ptr <Tizen::Base::Collection::Queue, _ListPtrUtil::Remover> __pPreviewBufferQueue;
bool __isConstructed;
bool __isPoweredOn;
CameraFlashMode __flashMode;
bool __zeroShutterLag;
CameraMeteringMode __meteringMode;
+ CameraSceneMode __sceneMode;
bool __focusCallback;
bool __isFocusAreaSet;
int __supportedFocusPointCount;
static bool __isUsed;
-
- _CameraPreprocessingCallback __pPreProcessCbFunc;
- void* __pPreProcessUserData;
+ static const int MAX_CAMERA_PLANE_COUNT = 4;
};
}}// Tizen::Media
* @brief This file contains the implementation of the %_CameraManager class.
*
*/
-
+
#include <pthread.h>
#include <camera.h>
#include <FBaseSysLog.h>
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FMedia_CameraPreProcessUtil.h
- * @brief This file contains the implementation of Camera's extened functions.
- *
- */
-
-#include <FBaseSysLog.h>
-#include <FMediaCamera.h>
-#include "FMedia_CameraImpl.h"
-#include "FMedia_CameraPreProcessUtil.h"
-
-namespace Tizen { namespace Media
-{
-result
-SetPreProcessingCallback(Tizen::Media::Camera &cam, _CameraPreprocessingCallback pPreProcessCbFunc, void* pPreProcessUserData)
-{
- Tizen::Media::_CameraImpl* pCamImpl = null;
- SysLog(NID_MEDIA, "Enter.");
-
- pCamImpl = _CameraImpl::GetInstance(&cam);
- SysTryReturn(NID_MEDIA, pCamImpl != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Camera is not constructed.");
-
- pCamImpl->SetPreprocessingCb(pPreProcessCbFunc, pPreProcessUserData);
-
- return E_SUCCESS;
-}
-
-result
-UnSetPreProcessingCallback(Tizen::Media::Camera &cam)
-{
- Tizen::Media::_CameraImpl* pCamImpl = null;
- SysLog(NID_MEDIA, "Enter.");
-
- pCamImpl = _CameraImpl::GetInstance(&cam);
- SysTryReturn(NID_MEDIA, pCamImpl != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] Camera is not constructed.");
-
- pCamImpl->SetPreprocessingCb(null, null);
-
- return E_SUCCESS;
-}
-
-}} // Tizen::Media
#define MEDIA_INVALID_VALUE -1
#define MM_SUCCESS 0
-// @enum _CameraSceneMode\r
-// Defines the camera scen mode
-enum _CameraSceneMode\r
-{
- CAMERA_SCENE_NONE,
- CAMERA_SCENE_AUTO,
- CAMERA_SCENE_PORTRAIT,
- CAMERA_SCENE_LANDSCAPE,
- CAMERA_SCENE_SPORTS,
- CAMERA_SCENE_PARTY_INDOOR,
- CAMERA_SCENE_BEACH_SHOW,
- CAMERA_SCENE_SUNSET,
- CAMERA_SCENE_DUSK_DAWN,
- CAMERA_SCENE_FALLCOLOR,
- CAMERA_SCENE_NIGHTSHOT,
- CAMERA_SCENE_FIREWORK,
- CAMERA_SCENE_TEXT,
- CAMERA_SCENE_SHOW_WINDOW,
- CAMERA_SCENE_CANDLELIGHT,
- CAMERA_SCENE_BACKLIGHT
-};
-
//@enum _CameraDisplayOrientationType\r
//Defines the camera's display orientation type
enum _CameraDisplayOrientationType\r
typedef struct
{
camera_attr_scene_mode_e mmAttr;
- _CameraSceneMode value;
+ CameraSceneMode value;
}_CameraSceneTable;
-static const _CameraSceneTable _CAMERA_SCENE[] =
+static const _CameraSceneTable _CAMERA_SCENE_MODE[] =
{
- {::CAMERA_ATTR_SCENE_MODE_NORMAL, CAMERA_SCENE_NONE},
+ {::CAMERA_ATTR_SCENE_MODE_NORMAL, CAMERA_SCENE_OFF},
// {::, CAMERA_SCENE_AUTO},
{::CAMERA_ATTR_SCENE_MODE_PORTRAIT, CAMERA_SCENE_PORTRAIT},
{::CAMERA_ATTR_SCENE_MODE_LANDSCAPE, CAMERA_SCENE_LANDSCAPE},
{::CAMERA_ATTR_SCENE_MODE_BEACH_N_INDOOR, CAMERA_SCENE_BEACH_SHOW},
{::CAMERA_ATTR_SCENE_MODE_SUNSET, CAMERA_SCENE_SUNSET},
{::CAMERA_ATTR_SCENE_MODE_DUSK_N_DAWN, CAMERA_SCENE_DUSK_DAWN},
- {::CAMERA_ATTR_SCENE_MODE_FALL_COLOR, CAMERA_SCENE_FALLCOLOR},
- {::CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE, CAMERA_SCENE_NIGHTSHOT},
+ {::CAMERA_ATTR_SCENE_MODE_FALL_COLOR, CAMERA_SCENE_AUTUMN_COLOR},
+ {::CAMERA_ATTR_SCENE_MODE_NIGHT_SCENE, CAMERA_SCENE_NIGHT},
{::CAMERA_ATTR_SCENE_MODE_FIREWORK, CAMERA_SCENE_FIREWORK},
{::CAMERA_ATTR_SCENE_MODE_TEXT, CAMERA_SCENE_TEXT},
{::CAMERA_ATTR_SCENE_MODE_SHOW_WINDOW, CAMERA_SCENE_SHOW_WINDOW},
};
result
-_CameraUtil::GetMmScene(_CameraSceneMode value, camera_attr_scene_mode_e& mmAttr)
+_CameraUtil::GetMmSceneMode(CameraSceneMode value, camera_attr_scene_mode_e& mmAttr)
{
bool findFlag = false;
- int size = sizeof(_CAMERA_SCENE)/sizeof(_CAMERA_SCENE[0]);
+ int size = sizeof(_CAMERA_SCENE_MODE)/sizeof(_CAMERA_SCENE_MODE[0]);
for (int i = 0; i < size; i++)
{
- if (_CAMERA_SCENE[i].value == value)
+ if (_CAMERA_SCENE_MODE[i].value == value)
{
- mmAttr = _CAMERA_SCENE[i].mmAttr;
+ mmAttr = _CAMERA_SCENE_MODE[i].mmAttr;
findFlag = true;
break;
}
}
result
-_CameraUtil::GetOspScene(camera_attr_scene_mode_e mmAttr, _CameraSceneMode& value)
+_CameraUtil::GetOspSceneMode(camera_attr_scene_mode_e mmAttr, CameraSceneMode& value)
{
bool findFlag = false;
- int size = sizeof(_CAMERA_SCENE)/sizeof(_CAMERA_SCENE[0]);
+ int size = sizeof(_CAMERA_SCENE_MODE)/sizeof(_CAMERA_SCENE_MODE[0]);
for (int i = 0; i < size; i++)
{
- if (_CAMERA_SCENE[i].mmAttr == mmAttr)
+ if (_CAMERA_SCENE_MODE[i].mmAttr == mmAttr)
{
- value = _CAMERA_SCENE[i].value;
+ value = _CAMERA_SCENE_MODE[i].value;
findFlag = true;
break;
}
static result GetMmWhiteBalance(CameraWhiteBalance value, camera_attr_whitebalance_e& mmAttr);
static result GetOspWhiteBalance(camera_attr_whitebalance_e mmAttr, CameraWhiteBalance& value);
- static result GetMmScene(_CameraSceneMode value, camera_attr_scene_mode_e& mmAttr);
- static result GetOspScene(camera_attr_scene_mode_e mmAttr, _CameraSceneMode& value);
+ static result GetMmSceneMode(CameraSceneMode value, camera_attr_scene_mode_e& mmAttr);
+ static result GetOspSceneMode(camera_attr_scene_mode_e mmAttr, CameraSceneMode& value);
static result GetMmFocusMode(CameraFocusMode value, camera_attr_af_mode_e& mmAttr);
static result GetOspFocusMode(camera_attr_af_mode_e mmAttr, CameraFocusMode& value);
{ CAMERA_PRIMARY_FLASH_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
{ CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
{ CAMERA_PRIMARY_METERING_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
+ { CAMERA_PRIMARY_SCENE_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_PRIMARY_CAMERA },
{ CAMERA_SECONDARY_CAPTURE_FORMAT, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
{ CAMERA_SECONDARY_CAPTURE_RESOLUTION, _CapabilityImpl::CopyListDimension, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
{ CAMERA_SECONDARY_FLASH_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
{ CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
{ CAMERA_SECONDARY_METERING_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
+ { CAMERA_SECONDARY_SCENE_MODE, _CapabilityImpl::CopyListInteger, _MEDIA_CAP_CATEGORY_SECONDARY_CAMERA },
{ PLAYER_AUDIO_CODEC, _CapabilityImpl::CopyListString, _MEDIA_CAP_CATEGORY_PLAYER },
{ PLAYER_COUNT_MAX, _CapabilityImpl::CopyInteger, _MEDIA_CAP_CATEGORY_PLAYER },
// { CAMERA_PRIMARY_FLASH_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FLASH_MODE_MAP },
// { CAMERA_PRIMARY_DEFAULT_PREVIEW_FORMAT, ParseContent, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
// { CAMERA_PRIMARY_METERING_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_METERING_MODE_MAP },
+// { CAMERA_PRIMARY_SCENE_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_SCENE_MODE_MAP },
// { CAMERA_SECONDARY_CAPTURE_FORMAT, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
// { CAMERA_SECONDARY_CAPTURE_RESOLUTION, ParseValueList, _CapabilityImpl::ConvertCharToDimension, 0 },
// { CAMERA_SECONDARY_FLASH_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_FLASH_MODE_MAP },
// { CAMERA_SECONDARY_DEFAULT_PREVIEW_FORMAT, ParseContent, _CapabilityImpl::ConvertCharToEnum, _PIXEL_FORMAT_MAP },
// { CAMERA_SECONDARY_METERING_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_METERING_MODE_MAP },
+// { CAMERA_SECONDARY_SCENE_MODE, ParseValueList, _CapabilityImpl::ConvertCharToEnum, _CAMERA_SCENE_MODE_MAP },
{ PLAYER_AUDIO_CODEC, ParseValueList, _CapabilityImpl::ConvertCharToString, 0 },
{ PLAYER_COUNT_MAX, ParseContent, _CapabilityImpl::ConvertCharToInteger, 0 },
}
{
+ _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_PRIMARY_SCENE_MODE, itemType);
+ if (pList)
+ {
+ String* pKey = null;
+
+ pKey = new (std::nothrow) String(CAMERA_PRIMARY_SCENE_MODE);
+ SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
+
+ r = __pMap->Add(*pKey, *pList);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+
+ {
Object* pObj = _CameraCapability::GetValueN(_COP_PRIMARY_PREVIEW_FORMAT, _QUERY_DEFAULT_VALUE, itemType);
if (pObj != null)
{
}
{
+ _MediaSafeArrayList* pList = (_MediaSafeArrayList*) _CameraCapability::GetListN(_COP_SECONDARY_SCENE_MODE, itemType);
+ if (pList)
+ {
+ String* pKey = null;
+
+ pKey = new (std::nothrow) String(CAMERA_SECONDARY_SCENE_MODE);
+ SysTryCatch(NID_MEDIA, pKey !=null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The key is not created.");
+
+ r = __pMap->Add(*pKey, *pList);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ }
+ }
+
+ {
Object* pObj = _CameraCapability::GetValueN(_COP_SECONDARY_PREVIEW_FORMAT, _QUERY_DEFAULT_VALUE, itemType);
if (pObj != null)
{
_COP_PRIMARY_FLASH_MODE,
_COP_PRIMARY_FOCUS_MODE,
_COP_PRIMARY_METERING_MODE,
+ _COP_PRIMARY_SCENE_MODE,
_COP_PRIMARY_WHITE_BALANCE,
_COP_PRIMARY_ZOOM_TYPE,
_COP_PRIMARY_FLIP,
- _COP_PRIMARY_PREVIEW_ROTATION,
- _COP_PRIMARY_ZERO_SHUTTER_LAG, //21
+ _COP_PRIMARY_PREVIEW_ROTATION, //21
+ _COP_PRIMARY_ZERO_SHUTTER_LAG,
_COP_PRIMARY_ZOOM_LEVEL,
_COP_PRIMARY_MAX_FRAMERATE,
- _COP_SECONDARY_CAPTURE_FORMAT, //24
+ _COP_SECONDARY_CAPTURE_FORMAT, //25
_COP_SECONDARY_CAPTURE_RESOLUTION,
_COP_SECONDARY_DIRECTION,
_COP_SECONDARY_EFFECT,
_COP_SECONDARY_ISO_LEVEL,
_COP_SECONDARY_PREVIEW_FORMAT,
- _COP_SECONDARY_PREVIEW_FRAMERATE,
- _COP_SECONDARY_PREVIEW_RESOLUTION, //31
+ _COP_SECONDARY_PREVIEW_FRAMERATE, //31
+ _COP_SECONDARY_PREVIEW_RESOLUTION,
_COP_SECONDARY_RECORDING_RESOLUTION,
_COP_SECONDARY_ROTATION,
_COP_SECONDARY_BRIGHTNESS,
_COP_SECONDARY_FLASH_MODE,
_COP_SECONDARY_FOCUS_MODE,
_COP_SECONDARY_METERING_MODE,
+ _COP_SECONDARY_SCENE_MODE, //41
_COP_SECONDARY_WHITE_BALANCE,
- _COP_SECONDARY_ZOOM_TYPE, //41
+ _COP_SECONDARY_ZOOM_TYPE,
_COP_SECONDARY_FLIP,
_COP_SECONDARY_PREVIEW_ROTATION,
_COP_SECONDARY_ZERO_SHUTTER_LAG,
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+#include <stdio.h>
+#include <unique_ptr.h>
+#include <FBaseColArrayListT.h>
+#include <FBaseInteger.h>
+#include <FBaseColHashMap.h>
+#include <FMediaTypes.h>
+#include <FMediaAudioTypes.h>
+#include <FBaseSysLog.h>
+#include "FMedia_Ffmpeg.h"
+#include "FMedia_FfmpegUtil.h"
+#include "FMedia_IAudioDecoder.h"
+#include "FMedia_G711Decoder.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Io;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Media
+{
+
+_IAudioDecoder*
+_AlawDecoder_CreateInstance(void)
+{
+ return new (std::nothrow) _G711Decoder(G711_ALAW);
+}
+
+_IAudioDecoder*
+_UlawDecoder_CreateInstance(void)
+{
+ return new (std::nothrow) _G711Decoder(G711_MULAW);
+}
+
+_G711Decoder::_G711Decoder(G711Type type)
+ : __pCodecCtx(null, ffmpegDeleter)
+{
+ __pCodec = null;
+ __type = type;
+}
+
+_G711Decoder::~_G711Decoder(void)
+{
+}
+
+result
+_G711Decoder::Construct(const Tizen::Base::Collection::HashMap* pOption)
+{
+ int res = 0;
+ Integer* pKey = null;
+ Integer* pValue = null;
+ int key = -1;
+ int value = -1;
+ std::unique_ptr<AVCodecContext, _FfmpegDeleter> pCodecCtx(null, ffmpegDeleter);
+ AVCodec* pCodec = null;
+
+ SysAssertf(__pCodecCtx.get() == null, " Already Constructed.");
+ SysTryReturnResult(NID_MEDIA, pOption != null, E_INVALID_ARG, "pOtion is null");
+ SysTryReturnResult(NID_MEDIA, __type >= G711_ALAW && __type <= G711_MULAW, E_INVALID_ARG, "__type is invalid:%d", __type);
+
+ avcodec_register_all();
+
+ AVCodecID codecId = (__type == G711_ALAW) ? CODEC_ID_PCM_ALAW : CODEC_ID_PCM_MULAW;
+ pCodec = avcodec_find_decoder(codecId);
+ SysTryReturnResult(NID_MEDIA, pCodec != null, E_UNSUPPORTED_FORMAT, "Find Decoder Failed:%d", codecId);
+
+ pCodecCtx.reset(avcodec_alloc_context3(pCodec));
+ SysTryReturnResult(NID_MEDIA, pCodecCtx.get() != null, E_OUT_OF_MEMORY, "Context Allcoation Failed");
+
+ // The initialization values are given in the Hashmap
+ std::unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
+ if (pMapEnum.get() != null )
+ {
+ while (pMapEnum->MoveNext() == E_SUCCESS)
+ {
+ pKey = static_cast<Integer*>(pMapEnum->GetKey());
+ pValue = static_cast<Integer*>(pMapEnum->GetValue());
+ if (pKey == null || pValue == null)
+ continue;
+
+ key = pKey->ToInt();
+ value = pValue->ToInt();
+ switch (key)
+ {
+ case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
+ SysTryReturnResult(NID_MEDIA, value == 1 || value == 2, E_OUT_OF_RANGE, "Invalid channel type: %d", value);
+ pCodecCtx->channels = value;
+ break;
+
+ case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
+ SysTryReturnResult(NID_MEDIA, value > 0, E_OUT_OF_RANGE, "Invalid sample rate: %d", value);
+ pCodecCtx->sample_rate = value;
+ break;
+
+ case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
+ SysTryReturnResult(NID_MEDIA, value > 0, E_OUT_OF_RANGE, "Invalid sample type: %d", value);
+ pCodecCtx->sample_fmt = _FfmpegUtil::ToAvSampleFormat((AudioSampleType)value);
+ break;
+
+ default:
+ break;
+ }
+ } // while
+ }
+
+ SysTryReturnResult(NID_MEDIA, pCodecCtx->channels != 0, E_INVALID_ARG, "Channel is not set");
+ SysTryReturnResult(NID_MEDIA, pCodecCtx->sample_rate != 0, E_INVALID_ARG, "Sample rate is not set");
+ SysTryReturnResult(NID_MEDIA, pCodecCtx->sample_fmt != AV_SAMPLE_FMT_NONE, E_INVALID_ARG, "Sample type is not set");
+
+ res = avcodec_open2(pCodecCtx.get(), pCodec, null);
+ SysTryReturnResult(NID_MEDIA, res >= 0, E_UNSUPPORTED_FORMAT, "codec open failed:%d %d", res, __type);
+
+ // AVCodecContext parameters
+ if (pCodec->capabilities & CODEC_CAP_TRUNCATED)
+ {
+ pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
+ }
+
+ pCodecCtx->debug_mv = 0; //set by user
+ pCodecCtx->debug = 0; //set by user
+ pCodecCtx->workaround_bugs = 1; //set by user
+ pCodecCtx->lowres = 0; //set by user
+
+ __pCodecCtx.reset(pCodecCtx.release());
+ __pCodec = pCodec;
+
+ return E_SUCCESS;
+}
+
+result
+_G711Decoder::Decode(const byte* pSrcBuf, int srcBufSize, int& srcBufUsed,
+ byte* pDstBuf, int dstBufSize, int& dstBufUsed)
+{
+ int res = 0;
+ AVPacket inputPacket;
+ int outBufSize = 0;
+ unique_ptr<AVFrame, _FfmpegDeleter> pOutFrame(avcodec_alloc_frame(), ffmpegDeleter);
+ int gotFrame = 0;
+
+ SysAssertf(__pCodecCtx.get() != null, "Not Constructed.");
+ SysTryReturnResult(NID_MEDIA, pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0, E_INVALID_ARG,
+ "Invalid argument: pSrcBuf(0x%x), srcBufSize(%d), pDstBuf(0x%x), dstBufSize(%d)",
+ pSrcBuf, srcBufSize, pDstBuf, dstBufSize);
+ SysTryReturnResult(NID_MEDIA, pOutFrame.get() != null, E_OUT_OF_MEMORY, "alloc frame failed");
+
+ av_init_packet(&inputPacket);
+
+ inputPacket.size = srcBufSize;
+ inputPacket.data = (uint8_t*)pSrcBuf;
+
+ res = avcodec_decode_audio4(__pCodecCtx.get(), pOutFrame.get(), &gotFrame, &inputPacket);
+ SysTryReturnResult(NID_MEDIA, res > 0, E_UNSUPPORTED_FORMAT, "decode audio failed:%d", res);
+
+ if (gotFrame)
+ {
+ outBufSize = av_samples_get_buffer_size(NULL, __pCodecCtx->channels, pOutFrame->nb_samples, __pCodecCtx->sample_fmt, 1);
+
+ SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
+
+ dstBufUsed = outBufSize; // The decoded audio data size
+ memcpy(pDstBuf, pOutFrame->data[0], outBufSize);
+ }
+ else
+ {
+ dstBufUsed = 0;
+ }
+
+ srcBufUsed = res; // input bytes used
+
+ return E_SUCCESS;
+}
+
+result
+_G711Decoder::Probe(const byte* pSrcBuf, const int srcBufSize,
+ AudioSampleType& sampleType, AudioChannelType& channelType, int& sampleRate)
+{
+ result r = E_SUCCESS;
+ int dstBufUsed = 0;
+ int srcBufUsed = 0;
+ unique_ptr<byte[]> pOutBuf(new (std::nothrow) byte[MIN_OUT_BUFFER_SIZE]);
+
+ r = Decode(pSrcBuf, srcBufSize, srcBufUsed, pOutBuf.get(), MIN_OUT_BUFFER_SIZE, dstBufUsed);
+
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Decode failed", GetErrorMessage(r));
+
+ channelType = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
+ sampleType = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
+ sampleRate = __pCodecCtx->sample_rate;
+
+ SetLastResult(E_SUCCESS);
+ return E_SUCCESS;
+}
+
+result
+_G711Decoder::Reset(void)
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCodecCtx.get() != null, "Not Constructed.");
+
+ avcodec_flush_buffers(__pCodecCtx.get());
+
+ SetLastResult(E_SUCCESS);
+ return r;
+}
+
+result
+_G711Decoder::GetValue(MediaPropertyType type, int& value) const
+{
+ result r = E_SUCCESS;
+
+ SysAssertf(__pCodecCtx.get() != null, "Not Constructed.");
+ SysTryReturnResult(NID_MEDIA, type > 0, E_INVALID_ARG, "Invalid type: %d", type);
+
+ switch (type)
+ {
+ case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
+ value = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
+ break;
+
+ case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
+ value = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
+ break;
+
+ case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
+ value = __pCodecCtx->sample_rate;
+ break;
+
+ default:
+ r = E_OBJ_NOT_FOUND;
+ break;
+ }
+ SetLastResult(r);
+ return r;
+}
+
+result
+_G711Decoder::GetValue(MediaPropertyType type, float& value) const
+{
+ SysAssertf(__pCodecCtx.get() != null, "Not Constructed.");
+ SysTryReturnResult(NID_MEDIA, type > 0, E_INVALID_ARG, "Invalid type: %d", type);
+
+ return E_OBJ_NOT_FOUND;
+}
+
+Tizen::Base::Collection::IListT<MediaPropertyType>*
+_G711Decoder::GetSupportedPropertyListN(void) const
+{
+ ArrayListT<MediaPropertyType>* pList = new (std::nothrow) ArrayListT<MediaPropertyType>;
+
+ SysTryReturn(NID_MEDIA, pList != null, null, E_OUT_OF_MEMORY, "[%s] new ArrayListT Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
+
+ pList->Add(MEDIA_PROPERTY_AUDIO_SAMPLE_RATE);
+ pList->Add(MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE);
+ pList->Add(MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE);
+ SetLastResult(E_SUCCESS);
+ return pList;
+}
+
+bool
+_G711Decoder::IsPropertySupported(MediaPropertyType type) const
+{
+ SysTryReturn(NID_MEDIA, type == MEDIA_PROPERTY_AUDIO_SAMPLE_RATE ||
+ type == MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE ||
+ type == MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE, false,
+ E_OBJ_NOT_FOUND,
+ "[%s] The property is not available:%d",GetErrorMessage(E_OBJ_NOT_FOUND), type);
+ SetLastResult(E_SUCCESS);
+ return true;
+}
+
+} } // Tizen::Media
//
/**
- * @file FMedia_AlawDecoder.h
- * @brief This is the header file for the Tizen::Media::_AlawDecoder.
+ * @file FMedia_G711Decoder.h
+ * @brief This is the header file for the Tizen::Media::_G711Decoder.
*
- * This header file contains the declarations of the Tizen::Media::_AlawDecoder.
+ * This header file contains the declarations of the Tizen::Media::_G711Decoder.
*/
-#ifndef _FMEDIA_INTERNAL_ALAWDECODER_H_
-#define _FMEDIA_INTERNAL_ALAWDECODER_H_
+#ifndef _FMEDIA_INTERNAL_G711DECODER_H_
+#define _FMEDIA_INTERNAL_G711DECODER_H_
+
+
+#include <unique_ptr.h>
+#include "FMedia_Ffmpeg.h"
namespace Tizen { namespace Media
unsigned int size;
};
-class _AlawDecoder
+enum G711Type
+{
+ G711_ALAW,
+ G711_MULAW,
+};
+
+class _G711Decoder
: public _IAudioDecoder
{
public:
- _AlawDecoder(void);
+ _G711Decoder(G711Type type);
- virtual ~_AlawDecoder(void);
+ virtual ~_G711Decoder(void);
public:
virtual result Construct(const Tizen::Base::Collection::HashMap* pOption = null);
static const int MONO_CHANNEL = 1;
static const int STEREO_CHANNEL = 2;
- _AlawDecoder(const _AlawDecoder&);
+ _G711Decoder(const _G711Decoder&);
- _AlawDecoder& operator =(const _AlawDecoder&);
+ _G711Decoder& operator =(const _G711Decoder&);
private:
- AVCodecContext* __pCodecCtx;
+ std::unique_ptr<AVCodecContext, _FfmpegDeleter> __pCodecCtx;
AVCodec* __pCodec;
- bool __decodeCalled;
- byte* __pOutBuf;
- bool __decoderConfigured;
+ G711Type __type;
};
} } // Tizen::Media
-#endif // _FMEDIA_INTERNAL_AlawDecoder_H_
+#endif // _FMEDIA_INTERNAL_G711DECODER_H_
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));\r
__pCodec = avcodec_find_decoder(CODEC_ID_H263);
SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_H263",GetErrorMessage(E_SYSTEM));\r
+ "[%s] AVCODEC Find Decoder Failed for CODEC_ID_H263",GetErrorMessage(E_SYSTEM));
+
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
+ "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));\r
\r
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] AVCODEC Codec Open Failed for CODEC_ID_H263",GetErrorMessage(E_SYSTEM));\r
#ifndef FMEDIA_INTERNAL_H263DECODER_H_
#define FMEDIA_INTERNAL_H263DECODER_H_
+#include <unique_ptr.h>
+
namespace Tizen { namespace Media
{
#include "FMedia_IVideoEncoder.h"
#include "FMedia_H263Encoder.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Io;
using namespace Tizen::Base::Collection;
//avcodec_init();
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] Failed to allocate avcodec context", GetErrorMessage(E_SYSTEM));
__pCodec = avcodec_find_encoder(CODEC_ID_H263P);
SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM, "[%s] Failed to get avcodec encoder",GetErrorMessage(E_SYSTEM));
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
+ "[%s] Failed to allocate avcodec context", GetErrorMessage(E_SYSTEM));
+
__pCodecCtx->bit_rate = BITRATE_IN_BITS;
__pCodecCtx->width = WIDTH;
__pCodecCtx->height = HEIGHT;
if (pOption != null)
{
// The initialization values are given in the Hashmap
- std::unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
+ unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
SysTryCatch(NID_MEDIA, pMapEnum.get() != null, r = E_SYSTEM, E_SYSTEM, "Propagating");
- while (pMapEnum.get()->MoveNext() == E_SUCCESS)
+ while (pMapEnum->MoveNext() == E_SUCCESS)
{
- pKey = dynamic_cast<Integer*> (pMapEnum.get()->GetKey());
- pValue = dynamic_cast<Integer*> (pMapEnum.get()->GetValue());
+ pKey = dynamic_cast<Integer*> (pMapEnum->GetKey());
+ pValue = dynamic_cast<Integer*> (pMapEnum->GetValue());
if (pKey == null || pValue == null)
{
}
}
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] avcodec open failed %d ", GetErrorMessage(E_SYSTEM), res);
int res = 0;
int outIndex = 0;
int minSrcBufLength = 0;
+ int gotOutput = 0;
+ unique_ptr<AVPacket, _FfmpegDeleter> pPkt(null, ffmpegDeleter);
SysTryReturnResult(NID_MEDIA, __pCodecCtx, E_INVALID_STATE, "not constructed");
+
minSrcBufLength = __pCodecCtx->width * __pCodecCtx->height * 3 / 2;
SysTryCatch(NID_MEDIA, (srcBuf != null && dstBuf != null && srcBufLength >= minSrcBufLength
&& dstBufLength >= FF_MIN_BUFFER_SIZE),
r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[%s] Invalid argument is used. 0x%x %d %d 0x%x %d %d",
- GetErrorMessage(E_INVALID_ARG), srcBuf, srcBufLength, minSrcBufLength, dstBuf, dstBufLength, FF_MIN_BUFFER_SIZE);
+ GetErrorMessage(E_OUT_OF_MEMORY), srcBuf, srcBufLength, minSrcBufLength, dstBuf, dstBufLength, FF_MIN_BUFFER_SIZE);
__pFrame->data[0] = (uint8_t*)srcBuf;
__pFrame->data[1] = (uint8_t*)srcBuf + __pCodecCtx->width * __pCodecCtx->height;
__pFrame->linesize[1] = __pCodecCtx->width / 2;
__pFrame->linesize[2] = __pCodecCtx->width / 2;
+ pPkt.reset(new (std::nothrow) AVPacket);
+ SysTryReturnResult(NID_MEDIA, pPkt.get() != null, E_OUT_OF_MEMORY, "new AVPacket failed.");
+ av_init_packet(pPkt.get());
+ pPkt->data = NULL; // packet data will be allocated by the encoder
+ pPkt->size = 0;
+#if 0
res = avcodec_encode_video(__pCodecCtx, (uint8_t*) dstBuf+outIndex, dstBufLength, __pFrame);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM, "[%s] H263 Video Encode Failed %d", GetErrorMessage(E_SYSTEM), res);
srcBufLength = minSrcBufLength;
dstBufLength = res + outIndex;
+#endif
+
+ __pFrame->pts++;
+
+ res = avcodec_encode_video2(__pCodecCtx, pPkt.get(), __pFrame, &gotOutput);
+ SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM, "[%s] Video Encode Failed %d", GetErrorMessage(E_SYSTEM), res);
+
+ if (gotOutput)
+ {
+ SysTryCatch(NID_MEDIA, pPkt->size <= dstBufLength, r = E_INVALID_ARG, E_INVALID_ARG,
+ "[%s] dst buffer is insufficient:%d %d", GetErrorMessage(E_INVALID_ARG), dstBufLength, pPkt->size);
+ memcpy(dstBuf+outIndex, pPkt->data, pPkt->size);
+ srcBufLength = minSrcBufLength;
+ dstBufLength = pPkt->size + outIndex;
+ }
+ else
+ {
+ srcBufLength = minSrcBufLength;
+ dstBufLength = outIndex;
+ }
CATCH:
return r;
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM, "[%s] AVCODEC Context Allcoation Failed", GetErrorMessage(E_SYSTEM));\r
__pCodec = avcodec_find_decoder(CODEC_ID_H264);
- SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM, "[%s] AVCODEC Find Decoder Failed for CODEC_ID_H264", GetErrorMessage(E_SYSTEM));\r
+ SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM, "[%s] AVCODEC Find Decoder Failed for CODEC_ID_H264", GetErrorMessage(E_SYSTEM));
+
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM, "[%s] AVCODEC Context Allcoation Failed", GetErrorMessage(E_SYSTEM));\r
// AVCodecContext parameters
__pCodecCtx->debug_mv = 0; //set by user
__pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
}
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] AVCODEC Codec Open Failed for CODEC_ID_H264, \
result of avcodec_open() = %d ",
#ifndef FMEDIA_INTERNAL_H264DECODER_H_
#define FMEDIA_INTERNAL_H264DECODER_H_
-
namespace Tizen { namespace Media
{
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#ifndef FMEDIA_INTERNAL_ISESSION_MANAGER_EVENT_H_
-#define FMEDIA_INTERNAL_ISESSION_MANAGER_EVENT_H_
-
-namespace Tizen { namespace Media
-{
-class _ISessionManagerListener
-{
-public:
- virtual void OnSoundSessionInturrupted(void) = 0;
- virtual void OnSoundSessionReleased(void) = 0;
-
-protected:
- virtual ~_ISessionManagerListener(void) {}
-};
-
-}}
-
-#endif
//
#include <stdio.h>
+#include <unique_ptr.h>
#include <FBaseColArrayListT.h>
#include <FBaseColHashMap.h>
#include <FMediaTypes.h>
#include "FMedia_IAudioDecoder.h"
#include "FMedia_Mp3Decoder.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Io;
using namespace Tizen::Base::Collection;
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));\r
__pCodec = avcodec_find_decoder(CODEC_ID_MP3);
SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_MP3",GetErrorMessage(E_SYSTEM));\r
+ "[%s] AVCODEC Find Decoder Failed for CODEC_ID_MP3",GetErrorMessage(E_SYSTEM));
+
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
+ "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));\r
\r
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] AVCODEC Codec Open Failed for CODEC_ID_MP3",GetErrorMessage(E_SYSTEM));\r
_Mp3Decoder::Decode(const byte* pSrcBuf, int srcBufSize, int& srcBufUsed,
byte* pDstBuf, int dstBufSize, int& dstBufUsed)
{
- result r = E_SUCCESS;
int res = 0;
AVPacket inputPacket;
int outBufSize = 0;
bool hasSyncBits = false;
- byte* pOutBuf = null;
int srcBytesSkipped = 0;
+ unique_ptr<AVFrame, _FfmpegDeleter> pOutFrame(avcodec_alloc_frame(), ffmpegDeleter);
+ int gotFrame = 0;
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
- SysTryCatch(NID_MEDIA, pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0,
- r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
+ SysTryReturnResult(NID_MEDIA, __pCodecCtx != null, E_INVALID_STATE, "The instance is in invalid state");\r
+ SysTryReturnResult(NID_MEDIA, pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0, E_INVALID_ARG,
+ "Invalid argument: pSrcBuf(0x%x), srcBufSize(%d), pDstBuf(0x%x), dstBufSize(%d)",
+ pSrcBuf, srcBufSize, pDstBuf, dstBufSize);\r
+ SysTryReturnResult(NID_MEDIA, pOutFrame.get() != null, E_OUT_OF_MEMORY, "avcodec_alloc_frame() failed");
av_init_packet(&inputPacket);
}
}
- SysTryCatch(NID_MEDIA, hasSyncBits, r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));\r
+ SysTryReturnResult(NID_MEDIA, hasSyncBits, E_UNSUPPORTED_FORMAT, "The input data format is not supported");\r
+
+ res = avcodec_decode_audio4(__pCodecCtx, pOutFrame.get(), &gotFrame, &inputPacket);
+
+ SysTryReturnResult(NID_MEDIA, res > 0, E_UNSUPPORTED_FORMAT, "decode audio failed:%d", res);
- if (dstBufSize >= _MIN_OUT_BUFFER_SIZE)
+ if (gotFrame)
{
- pOutBuf = pDstBuf;
- outBufSize = dstBufSize;
+ outBufSize = av_samples_get_buffer_size(NULL, __pCodecCtx->channels, pOutFrame->nb_samples, __pCodecCtx->sample_fmt, 1);
+
+ SysTryReturnResult(NID_MEDIA, dstBufSize >= outBufSize, E_OUT_OF_MEMORY, "pDstBuf(%d) is smaller than decoded data(%d)", dstBufSize, outBufSize);
+
+ dstBufUsed = outBufSize; // The decoded audio data size
+ memcpy(pDstBuf, pOutFrame->data[0], outBufSize);
+ __decodeCalled = true;
}
else
{
- pOutBuf = __pOutBuf;
- outBufSize = _MIN_OUT_BUFFER_SIZE;
+ dstBufUsed = 0;
}
- res = avcodec_decode_audio3(__pCodecCtx, (int16_t*)pOutBuf, &outBufSize, &inputPacket);
- SysTryCatch(NID_MEDIA, (res > 0 && outBufSize > 0), r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));\r
-
- SysTryCatch(NID_MEDIA, dstBufSize >= outBufSize, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));\r
-
- dstBufUsed = outBufSize; // the decoded audio data size
srcBufUsed = res + srcBytesSkipped; // input bytes used
- if (pOutBuf != pDstBuf)
- {
- memcpy(pDstBuf, pOutBuf, outBufSize);
- __decodeCalled = true;
- }
- return r;
-CATCH:
- return r;
+ return E_SUCCESS;
}
result
avcodec_register_all();
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed", GetErrorMessage(E_SYSTEM));\r
-
__pCodec = avcodec_find_decoder(CODEC_ID_MPEG4);
SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_MPEG4", GetErrorMessage(E_SYSTEM));\r
+ "[%s] AVCODEC Find Decoder Failed for CODEC_ID_MPEG4", GetErrorMessage(E_SYSTEM));
+
+ __pCodecCtx = avcodec_alloc_context3(__pCodec);
+ SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
+ "[%s] AVCODEC Context Allcoation Failed", GetErrorMessage(E_SYSTEM));\r
\r
- res = avcodec_open(__pCodecCtx, __pCodec);
+ res = avcodec_open2(__pCodecCtx, __pCodec, null);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
"[%s] AVCODEC Codec Open Failed for CODEC_ID_MPEG4, \
result of avcodec_open() = %d",
SysTryReturnResult(NID_MEDIA, __pCodecCtx, E_INVALID_STATE, "not constructed");
SysTryCatch(NID_MEDIA, __isDecodeCalled == true, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
+ "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
SysTryCatch(NID_MEDIA, type > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
+ "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
SysTryCatch(NID_MEDIA, type >= MEDIA_PROPERTY_VIDEO_WIDTH && type <= MEDIA_PROPERTY_AUDIO_SAMPLE_RATE,
r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[%s] The instance is not available ",GetErrorMessage(E_OBJ_NOT_FOUND));\r
SysTryReturnResult(NID_MEDIA, __pCodecCtx, E_INVALID_STATE, "not constructed");
SysTryCatch(NID_MEDIA, __isDecodeCalled == true, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
+ "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));\r
SysTryCatch(NID_MEDIA, 0 < type, r = E_INVALID_ARG, E_INVALID_ARG,
"[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));\r
SysTryCatch(NID_MEDIA, type >= MEDIA_PROPERTY_VIDEO_WIDTH && type <= MEDIA_PROPERTY_AUDIO_SAMPLE_RATE,
#ifndef FMEDIA_INTERNAL_MPEG4DECODER_H_
#define FMEDIA_INTERNAL_MPEG4DECODER_H_
+
namespace Tizen { namespace Media
{
#include "FMedia_IVideoEncoder.h"
#include "FMedia_Mpeg4Encoder.h"
+using namespace std;
using namespace Tizen::Base;
using namespace Tizen::Io;
using namespace Tizen::Base::Collection;
int res = 0;
int outIndex = 0;
int minSrcBufLength = 0;
+ int gotOutput = 0;
+ unique_ptr<AVPacket, _FfmpegDeleter> pPkt(null, ffmpegDeleter);
SysTryReturnResult(NID_MEDIA, __pCodecCtx, E_INVALID_STATE, "not constructed");
+
minSrcBufLength = __pCodecCtx->width * __pCodecCtx->height * 3 / 2;
SysTryCatch(NID_MEDIA, (srcBuf != null && dstBuf != null && srcBufLength >= minSrcBufLength && dstBufLength >= FF_MIN_BUFFER_SIZE),
r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
outIndex += __pCodecCtx->extradata_size;
}
-#ifdef OLD_API
- res = avcodec_encode_video(__pCodecCtx, (uint8_t*)dstBuf+outIndex, dstBufLength, __pFrame);
+ pPkt.reset(new (std::nothrow) AVPacket);
+ SysTryReturnResult(NID_MEDIA, pPkt.get() != null, E_OUT_OF_MEMORY, "new AVPacket failed.");
+ av_init_packet(pPkt.get());
+ pPkt->data = NULL; // packet data will be allocated by the encoder
+ pPkt->size = 0;
+
+ __pFrame->pts++;
+ res = avcodec_encode_video2(__pCodecCtx, pPkt.get(), __pFrame, &gotOutput);
SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM, "[%s] Video Encode Failed %d", GetErrorMessage(E_SYSTEM), res);
- srcBufLength = minSrcBufLength;
- dstBufLength = res + outIndex;
-#else
+ if (gotOutput)
{
- AVPacket pkt;
- int gotOutput;
-
- av_init_packet(&pkt);
- pkt.data = NULL; // packet data will be allocated by the encoder
- pkt.size = 0;
-
- __pFrame->pts++;
-
- /* encode the image */
- res = avcodec_encode_video2(__pCodecCtx, &pkt, __pFrame, &gotOutput);
- SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM, "[%s] Video Encode Failed %d", GetErrorMessage(E_SYSTEM), res);
-
- if (gotOutput)
- {
- SysTryCatch(NID_MEDIA, pkt.size <= dstBufLength, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] dst buffer is insufficient:%d %d", GetErrorMessage(E_INVALID_ARG), dstBufLength, pkt.size);
- memcpy(dstBuf+outIndex, pkt.data, pkt.size);
- srcBufLength = minSrcBufLength;
- dstBufLength = pkt.size + outIndex;
- av_free_packet(&pkt);
- }
- else
- {
- srcBufLength = minSrcBufLength;
- dstBufLength = outIndex;
- }
+ SysTryCatch(NID_MEDIA, pPkt->size <= dstBufLength, r = E_INVALID_ARG, E_INVALID_ARG,
+ "[%s] dst buffer is insufficient:%d %d", GetErrorMessage(E_INVALID_ARG), dstBufLength, pPkt->size);
+ memcpy(dstBuf+outIndex, pPkt->data, pPkt->size);
+ srcBufLength = minSrcBufLength;
+ dstBufLength = pPkt->size + outIndex;
+ }
+ else
+ {
+ srcBufLength = minSrcBufLength;
+ dstBufLength = outIndex;
}
-#endif
CATCH:
return r;
, __orientation(ORIENTATION_PORTRAIT)
, __currentVolume(DEFAULT_PLAYER_VOLUME)
, __currentState(PLAYER_STATE_INITIALIZED)
+ , __preState(PLAYER_STATE_INITIALIZED)
, __videoPixelFormat(BITMAP_PIXEL_FORMAT_MIN)
, __bufferDataSize(0)
, __decodedFrameWidth(0)
}
r = __pMutex->Release();
SysTryLog(NID_MEDIA, r == E_SUCCESS, "[%s] Propagating.", GetErrorMessage(r));
-
- if (__pPlayerEvent && __pPlayerEventListener)
- {
- __pPlayerEvent->RemoveListener(*__pPlayerEventListener);
- __pPlayerEventListener = null;
- }
-
- if (__pPlayerVideoEvent && __pPlayerVideoEventListener)
- {
- __pPlayerVideoEvent->RemoveListener(*__pPlayerVideoEventListener);
- __pPlayerVideoEventListener = null;
- }
__pVideoTextureImpl = null;
}
SysTryCatch(NID_MEDIA, pInputFilePath.get() , r = E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. pInputFilePath is null");
SysLog(NID_MEDIA, "Input file path after conversion is [%s]", pInputFilePath.get());
+ __preState = __currentState;
__currentState = PLAYER_STATE_OPENING;
__isAsync = isAsync;
SysTryCatch(NID_MEDIA, __bufferDataSize > 0, r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Buffer instance is not available.");
SysTryCatch(NID_MEDIA, __pTargetByteBuffer->GetPointer() , r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] Buffer instance is not available.");
+ __preState = __currentState;
__currentState = PLAYER_STATE_OPENING;
__isAsync = isAsync;
pInputFilePath.reset(_StringConverter::CopyToCharArrayN(mediaUri.ToString()));
__isAsync = isAync;
__isStreamingContent = true;
+ __preState = __currentState;
__currentState = PLAYER_STATE_OPENING;
r = OpenInputData(std::move(pInputFilePath));
err = player_set_x11_display_pixmap(__hPlayer, _VideoTextureImpl::GetPixmap, (void*)__pVideoTextureImpl);
r = MapExceptionToResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "%s error has been occurred. Failed to perform player_set_x11_display_pixmap with - 0x%x", GetErrorMessage(r), err);
+
+ err = player_set_x11_display_pixmap_error_cb(__hPlayer, _VideoTextureImpl::PixmapErrorCallback, (void*)__pVideoTextureImpl);
+ r = MapExceptionToResult(err);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "%s error has been occurred. Failed to perform player_set_x11_display_pixmap_error_cb with 0x%x", GetErrorMessage(r), err);
}
if (__videoEventCreated)
{
{
return PLAYER_STATE_INITIALIZED;
}
- __currentState = PLAYER_STATE_CLOSED;
- return PLAYER_STATE_CLOSED;
+ else if (__currentState == PLAYER_STATE_OPENING)
+ {
+ return PLAYER_STATE_OPENING;
+ }
+ else if(__currentState = PLAYER_STATE_CLOSED)
+ {
+ return PLAYER_STATE_CLOSED;
+ }
}
return __currentState;
CATCH:
SysAssertf(__hPlayer != null, "Not yet constructed! Construct() should be called before use");
- SysTryCatch(NID_MEDIA, ((__currentState == PLAYER_STATE_PLAYING) || (__currentState == PLAYER_STATE_PAUSED)),
+ SysTryCatch(NID_MEDIA, (
+ (__currentState == PLAYER_STATE_PLAYING) ||
+ (__currentState == PLAYER_STATE_PAUSED) ||
+ (__currentState == PLAYER_STATE_OPENED) ||
+ (__currentState == PLAYER_STATE_STOPPED)),
r = E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Player state is in an invalid state. State is %d", __currentState);
//As a last resort try with palyer_get_duration
err = player_set_display_mode(__hPlayer, PLAYER_DISPLAY_MODE_FULL_SCREEN);
r = MapExceptionToResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "%s error has been occurred. Failed to perform player_set_display_mode operation with - 0x%x", GetErrorMessage(r), err);
+
CATCH:
return r;
}
return PLAYER_ERROR_STREAMING_TIMEOUT;
break;
+ case PLAYER_ERROR_DRM_EXPIRED:
+ return PLAYER_ERROR_RIGHT_EXPIRED;
+ break;
+
+ case PLAYER_ERROR_DRM_NO_LICENSE:
+ return PLAYER_ERROR_RIGHT_NO_LICENSE;
+ break;
+
+ case PLAYER_ERROR_DRM_FUTURE_USE:
+ return PLAYER_ERROR_RIGHT_FUTURE_USE;
+ break;
+
//Sound policy error
case PLAYER_ERROR_SOUND_POLICY:
//fall through
break;
//Invalid operation
case PLAYER_ERROR_INVALID_OPERATION:
- return E_INVALID_OPERATION;
+ return E_SYSTEM;
break;
//Invalid state
case PLAYER_ERROR_INVALID_STATE:
case PLAYER_ERROR_VIDEO_CAPTURE_FAILED:
return E_OPERATION_FAILED;
break;
+
+ case PLAYER_ERROR_DRM_EXPIRED:
+ return E_RIGHT_EXPIRED;
+ break;
+
+ case PLAYER_ERROR_DRM_NO_LICENSE:
+ return E_RIGHT_NO_LICENSE;
+ break;
+
+ case PLAYER_ERROR_DRM_FUTURE_USE:
+ return E_RIGHT_FUTURE_USE;
+ break;
+
default:
return E_SYSTEM;
break;
{
SysTryReturn(NID_MEDIA, pUserData, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. pUserData is null.");
_PlayerImpl *pPlyarImpl = (_PlayerImpl *)pUserData;
- pPlyarImpl->HandlePlayerPrepared();
+ pPlyarImpl->HandlePlayerPrepared(0);
}
void
//Intentional fall through
case PLAYER_INTERRUPTED_BY_EARJACK_UNPLUG:
//Interrupted by earjack unplug
- pPlyarImpl->HandlePlayerAudioFoucsChanged();
+ pPlyarImpl->HandlePlayerAudioFocusChanged();
break;
case PLAYER_INTERRUPTED_BY_EMERGENCY:
//Interrupted by emergency
{
SysTryReturn(NID_MEDIA, pUserData, , E_SYSTEM, "[E_SYSTEM] A system error has been occurred. pUserData is null.");
_PlayerImpl *pPlyarImpl = (_PlayerImpl *)pUserData;
- pPlyarImpl->HandlePlayerError(errorCode);
+ if ((errorCode == PLAYER_ERROR_DRM_EXPIRED) ||
+ (errorCode == PLAYER_ERROR_DRM_NO_LICENSE) ||
+ (errorCode == PLAYER_ERROR_DRM_FUTURE_USE))
+ {
+ pPlyarImpl->HandlePlayerPrepared(errorCode);
+ }
+ else
+ {
+ pPlyarImpl->HandlePlayerError(errorCode);
+ }
}
void
_PlayerImpl::PlayerBufferingCallBack(int percent, void *pUserData)
//Tizen Handle Functions
void
-_PlayerImpl::HandlePlayerPrepared(void)
+_PlayerImpl::HandlePlayerPrepared(int errorCode)
{
int err = PLAYER_ERROR_NONE;
result r = E_SUCCESS;
err = player_get_state(__hPlayer, &__corePlayerCurState);
r = MapExceptionToResult(err);
SysTryReturn(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Failed to perform player_get_state operation with - 0x%x", GetErrorMessage(r), err);
- SysTryReturn(NID_MEDIA, __corePlayerCurState == ::PLAYER_STATE_READY , , r = E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Current state is %d.", __corePlayerCurState);
+ SysTryLog(NID_MEDIA, __corePlayerCurState == ::PLAYER_STATE_READY , "[E_SYSTEM] A system error has been occurred. Current state is %d with error code (%d).", __corePlayerCurState, errorCode);
- __currentState = PLAYER_STATE_OPENED;
- SendEvent(_PLAYER_EVENT_OPENED, 0);
+ r = MapExceptionToResult(errorCode);
+ if (r == E_SUCCESS)
+ {
+ __currentState = PLAYER_STATE_OPENED;
+ }
+ else
+ {
+ __currentState = __preState;
+ }
+ SendEvent(_PLAYER_EVENT_OPENED, r);
}
void
}
void
-_PlayerImpl::HandlePlayerAudioFoucsChanged(void)
+_PlayerImpl::HandlePlayerAudioFocusChanged(void)
{
int ret = PLAYER_ERROR_NONE;
result r = E_SUCCESS;
{
return CODEC_WMA;
}
+ if (!String::Compare(String(pAudioCodec), String("WMA Version 9")))
+ {
+ return CODEC_WMA;
+ }
if (!String::Compare(String(pAudioCodec), String("Uncompressed 16-bit PCM audio")))
{
return CODEC_LPCM;
r = MapExceptionToResult(err);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Failed to perform player_get_state operation with 0x%x ", GetErrorMessage(r), err);
- SysTryCatch(NID_MEDIA, __corePlayerCurState == ::PLAYER_STATE_PLAYING || __corePlayerCurState == ::PLAYER_STATE_PAUSED ,
- r = E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Player state is in an invalid state. Current state is %d", __corePlayerCurState);
+ SysTryCatch(NID_MEDIA, (__corePlayerCurState == ::PLAYER_STATE_PLAYING) || (__corePlayerCurState == ::PLAYER_STATE_PAUSED) || (__corePlayerCurState == ::PLAYER_STATE_READY) ,
+ r = E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] Player state is in an invalid state. Current state is %d", __corePlayerCurState);
err = player_get_codec_info(__hPlayer, &pAudioCodec, &pVideoCodec);
SysTryCatch(NID_MEDIA, err == PLAYER_ERROR_NONE, r = E_SYSTEM, E_SYSTEM,
pInputFilePath.reset(_StringConverter::CopyToCharArrayN(url));
__isAsync = true;
__isStreamingContent = true;
+ __preState = __currentState;
__currentState = PLAYER_STATE_OPENING;
r = OpenInputData(std::move(pInputFilePath));
}
}
}
-
+ __preState = __currentState;
__currentState = PLAYER_STATE_OPENING;
r = OpenInputData(std::move(pInputFilePath));
#include "FMedia_RecorderSession.h"
#include "FMedia_CameraTypes.h"
#include "FMedia_CameraCoordinator.h"
+#include "FMedia_CapabilityImpl.h"
using namespace Tizen::Base;
_RecorderDeviceType targetRecorder = _RECORDER_DEVICE_NONE;
SysLog(NID_MEDIA, "Enter.");
+ int cameraCount = 0;
+ _CapabilityImpl* pCapabilityImpl = _CapabilityImpl::GetInstance();
+ SysTryReturn(NID_MEDIA, pCapabilityImpl != null, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Capability is not obtained.");
+ SysTryReturn(NID_MEDIA, cameraCount < 1, E_DEVICE_UNAVAILABLE, E_DEVICE_UNAVAILABLE, "[E_DEVICE_UNAVAILABLE] The camera(%d) is not available.", cameraCount);
+
+ r = pCapabilityImpl->GetValue(L"Camera.Count", cameraCount);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Number of Camera was not obtained.");
+
if (recorderSource == _RECORDER_SOURCE_VIDEO)
{
if (_CameraCoordinator::HasInstance(_RECORDER_DEVICE_VIDEO_PRIMARY_CAMERA) != null)
if (__pCoordinator->GetMode() == _CAMERA_MODE_IMAGE)
{
- if(__pCoordinator->IsCalmChangeMode(_CAMERA_MODE_VIDEO))
+ if (cameraCount < 2)
{
targetRecorder = (runningCamera == _CAMERA_DEVICE_PRIMARY ? _RECORDER_DEVICE_VIDEO_PRIMARY_CAMERA : _RECORDER_DEVICE_VIDEO_SECONDARY_CAMERA);
r = __pCoordinator->ChangeMode(_CAMERA_MODE_VIDEO, false);
}
else
{
- // If the current coordinator(camera) is not proper state to get the recorder without flickering.
- _CameraCoordinator::Release(runningCamera);
-
- // Pick the other camera for the recorder
- targetRecorder = (runningCamera == _CAMERA_DEVICE_PRIMARY ? _RECORDER_DEVICE_VIDEO_SECONDARY_CAMERA : _RECORDER_DEVICE_VIDEO_PRIMARY_CAMERA);
-
- // Get the other coordinator(camera)
- __pCoordinator = _CameraCoordinator::AddInstance(targetRecorder);
- SysTryCatch(NID_MEDIA, __pCoordinator != null, , E_SYSTEM, "[E_SYSTEM] The camera coordinator is null.");
-
if(__pCoordinator->IsCalmChangeMode(_CAMERA_MODE_VIDEO))
{
+ targetRecorder = (runningCamera == _CAMERA_DEVICE_PRIMARY ? _RECORDER_DEVICE_VIDEO_PRIMARY_CAMERA : _RECORDER_DEVICE_VIDEO_SECONDARY_CAMERA);
r = __pCoordinator->ChangeMode(_CAMERA_MODE_VIDEO, false);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
__previousCameraMode = _CAMERA_MODE_IMAGE;
}
else
{
- SysLogException(NID_MEDIA, E_SYSTEM, "[E_SYSTEM] Both cameras' state are not proper to change mode.");
- goto CATCH;
+ // If the current coordinator(camera) is not proper state to get the recorder without flickering.
+ _CameraCoordinator::Release(runningCamera);
+
+ // Pick the other camera for the recorder
+ targetRecorder = (runningCamera == _CAMERA_DEVICE_PRIMARY ? _RECORDER_DEVICE_VIDEO_SECONDARY_CAMERA : _RECORDER_DEVICE_VIDEO_PRIMARY_CAMERA);
+
+ // Get the other coordinator(camera)
+ __pCoordinator = _CameraCoordinator::AddInstance(targetRecorder);
+ SysTryCatch(NID_MEDIA, __pCoordinator != null, , E_SYSTEM, "[E_SYSTEM] The camera coordinator is null.");
+
+ if(__pCoordinator->IsCalmChangeMode(_CAMERA_MODE_VIDEO))
+ {
+ r = __pCoordinator->ChangeMode(_CAMERA_MODE_VIDEO, false);
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+ __previousCameraMode = _CAMERA_MODE_IMAGE;
+ }
+ else
+ {
+ SysLogException(NID_MEDIA, E_SYSTEM, "[E_SYSTEM] Both cameras' state are not proper to change mode.");
+ goto CATCH;
+ }
}
}
}
return r;
}
+AudioSampleType
+_RecorderUtil::GetOspSampleType(audio_sample_type_e audioSampleType)
+{
+ switch (audioSampleType)
+ {
+ case AUDIO_SAMPLE_TYPE_U8:
+ return AUDIO_TYPE_PCM_U8;
+ break;
+
+ case AUDIO_SAMPLE_TYPE_S16_LE:
+ return AUDIO_TYPE_PCM_S16_LE;
+ break;
+
+ default:
+ return AUDIO_TYPE_PCM_S16_LE;
+ break;
+ }
+}
+
+AudioChannelType
+_RecorderUtil::GetOspChannelType(int audioChannelType)
+{
+ switch (audioChannelType)
+ {
+ case 1:
+ return AUDIO_CHANNEL_TYPE_MONO;
+ break;
+
+ case 2:
+ return AUDIO_CHANNEL_TYPE_STEREO;
+ break;
+
+ default:
+ return AUDIO_CHANNEL_TYPE_NONE;
+ break;
+ }
+}
+
+int
+_RecorderUtil::ConvertAudioSampleTypeToInt(AudioSampleType sampleType)
+{
+ int bitDepth = 0;
+ switch(sampleType)
+ {
+ case AUDIO_TYPE_NONE:
+ bitDepth = 0;
+ break;
+ case AUDIO_TYPE_PCM_S8:
+ //fall through
+ case AUDIO_TYPE_PCM_U8:
+ bitDepth = 8;
+ break;
+ case AUDIO_TYPE_PCM_U16_LE:
+ //fall through
+ case AUDIO_TYPE_PCM_S16_LE:
+ //fall through
+ case AUDIO_TYPE_PCM_S16_BE:
+ //fall through
+ case AUDIO_TYPE_PCM_U16_BE:
+ bitDepth = 16;
+ break;
+ default:
+ bitDepth = 16;
+ break;
+ }
+ return bitDepth;
+}
+
+int
+_RecorderUtil::CalculateSampleRate(int size, int channel, int timeStamp, AudioSampleType sampleType)
+{
+ //bitRate = sample Rate * bitDepth * No of Channel;
+
+ SysTryReturn(NID_MEDIA, timeStamp != 0, 0, E_INVALID_DATA, "[E_INVALID_DATA] Sampling rate cannot be calculated");
+
+ int bitRate = 0;
+ int bitDepth = 0;
+ int sampleRate = 0;
+
+ bitRate = (size * 1000 * 8)/timeStamp; // convert from bytes to bits for "Packet duration" mili sec of data
+
+ bitDepth = ConvertAudioSampleTypeToInt(sampleType);
+ sampleRate = (bitRate / (bitDepth * channel));
+
+ return sampleRate;
+}
+
}}// Tizen::Media
#include <FMediaTypes.h>
#include <FMediaCameraTypes.h>
#include <FMediaRecorderTypes.h>
+#include <FMediaAudioTypes.h>
#include "FMedia_CameraTypes.h"
namespace Tizen { namespace Media
static bool CheckFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
static result PrepareFile(const Tizen::Base::String &path, bool overwrite);
+ static AudioSampleType GetOspSampleType(audio_sample_type_e audioSampleType);
+ static AudioChannelType GetOspChannelType(int audioChannelType);
+ static int ConvertAudioSampleTypeToInt(AudioSampleType sampleType);
+ static int CalculateSampleRate(int size, int channel, int timeStamp, AudioSampleType sampleType);
private:
_RecorderUtil(void);
if (__pWorkerThread.get())
{
__pWorkerThread->Join();
+ __pWorkerThread.reset(null);
}
if (__tonePlayerState == TONE_PLAYER_STATE_PLAYING)
if (__pWorkerThread.get())
{
__pWorkerThread->Join();
+ __pWorkerThread.reset(null);
}
ret = audio_out_unprepare(__audioOutHandle);
result SendError(result r);
result MapExceptionToResult(int reason);
+ //sicne 3.0
static _TonePlayerImpl* GetInstance(TonePlayer* pTonePlayer);
static const _TonePlayerImpl* GetInstance(const TonePlayer* pTonePlayer);
static void InitInstanceMutex(void);
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-#include <stdio.h>
-#include <unique_ptr.h>
-#include <FBaseColArrayListT.h>
-#include <FBaseColHashMap.h>
-#include <FBaseInteger.h>
-#include <FMediaTypes.h>
-#include <FMediaAudioTypes.h>
-#include <FBaseSysLog.h>
-#include "FMedia_Ffmpeg.h"
-#include "FMedia_FfmpegUtil.h"
-#include "FMedia_IAudioDecoder.h"
-#include "FMedia_UlawDecoder.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Io;
-using namespace Tizen::Base::Collection;
-
-namespace Tizen { namespace Media
-{
-
-_IAudioDecoder*
-_UlawDecoder_CreateInstance(void)
-{
- return new (std::nothrow) _UlawDecoder();
-}
-
-_UlawDecoder::_UlawDecoder(void)
-{
- __pCodecCtx = null;
- __pCodec = null;
- __decodeCalled = false;
- __pOutBuf = null;
- __decoderConfigured = false;
-
-}
-
-_UlawDecoder::~_UlawDecoder(void)
-{
- if (__pCodecCtx != null)
- {
- avcodec_close(__pCodecCtx);
- av_free(__pCodecCtx);
- }
- if (__pOutBuf != null)
- {
- delete[] __pOutBuf;
- }
-}
-
-result
-_UlawDecoder::Construct(const Tizen::Base::Collection::HashMap* pOption)
-{
- result r = E_SUCCESS;
- int res = 0;
- Integer* pKey = null;
- Integer* pValue = null;
- int key = -1;
- int value = -1;
-
- SysAssertf((__pCodecCtx == null && __pCodec == null), " Already Constructed .");
- SysTryReturnResult(NID_MEDIA, pOption != null, E_INVALID_ARG, "pOtion is null");
-
- avcodec_register_all();
-
- __pCodecCtx = avcodec_alloc_context();
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Context Allcoation Failed",GetErrorMessage(E_SYSTEM));
- __pCodec = avcodec_find_decoder(CODEC_ID_PCM_MULAW);
- SysTryCatch(NID_MEDIA, __pCodec != null, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Find Decoder Failed for CODEC_ID_PCM_MULAW",GetErrorMessage(E_SYSTEM));
-
- if (pOption != null)
- {
- // The initialization values are given in the Hashmap
- std::unique_ptr<IMapEnumerator> pMapEnum(pOption->GetMapEnumeratorN());
- if (pMapEnum.get() != null)
- {
- while (pMapEnum.get()->MoveNext() == E_SUCCESS)
- {
- pKey = static_cast<Integer*>(pMapEnum.get()->GetKey());
- pValue = static_cast<Integer*>(pMapEnum.get()->GetValue());
- if (pKey && pValue)
- {
- key = pKey->ToInt();
- value = pValue->ToInt();
- switch (key)
- {
- case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
- SysTryCatch(NID_MEDIA, (value == 0 || value == 1 || value == 2), r = E_OUT_OF_RANGE,
- E_OUT_OF_RANGE, "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
- __pCodecCtx->channels = value;
- __decoderConfigured = true;
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
- SysTryCatch(NID_MEDIA, !(value < 0), r = E_OUT_OF_RANGE, E_OUT_OF_RANGE,
- "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
- __pCodecCtx->sample_rate = value;
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
- SysTryCatch(NID_MEDIA, !(value < 0), r = E_OUT_OF_RANGE, E_OUT_OF_RANGE,
- "[%s] Invalid argument is used. The value is out of range",GetErrorMessage(E_OUT_OF_RANGE));
- __pCodecCtx->sample_fmt = _FfmpegUtil::ToAvSampleFormat((AudioSampleType)value);
- break;
-
- default:
- break;
- }
- }
- } // while
- }
- }
-
- SysTryReturnResult(NID_MEDIA, __pCodecCtx->channels != 0, E_INVALID_ARG, "Channel is not set");
- SysTryReturnResult(NID_MEDIA, __pCodecCtx->sample_rate != 0, E_INVALID_ARG, "Sample rate is not set");
- SysTryReturnResult(NID_MEDIA, __pCodecCtx->sample_fmt != AV_SAMPLE_FMT_NONE, E_INVALID_ARG, "Sample type is not set");
-
- res = avcodec_open(__pCodecCtx, __pCodec);
- SysTryCatch(NID_MEDIA, res >= 0, r = E_SYSTEM, E_SYSTEM,
- "[%s] AVCODEC Codec Open Failed for CODEC_ID_PCM_MULAW",GetErrorMessage(E_SYSTEM));
-
- // AVCodecContext parameters
- if (__pCodec->capabilities & CODEC_CAP_TRUNCATED)
- {
- __pCodecCtx->flags |= CODEC_FLAG_TRUNCATED;
- }
-
- __pCodecCtx->debug_mv = 0; //set by user
- __pCodecCtx->debug = 0; //set by user
- __pCodecCtx->workaround_bugs = 1; //set by user
- __pCodecCtx->lowres = 0; //set by user
-
- __pOutBuf = new (std::nothrow) byte[OUT_BUFFER_SIZE];
- SysTryCatch(NID_MEDIA, __pOutBuf != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
-
- return r;
-
-CATCH:
-
- if (__pCodecCtx != null)
- {
- avcodec_close(__pCodecCtx);
- av_free(__pCodecCtx);
- __pCodecCtx = null;
- __pCodec = null;
- }
- if (__pOutBuf != null)
- {
- delete[] __pOutBuf;
- __pOutBuf = null;
- }
- return r;
-}
-
-result
-_UlawDecoder::Decode(const byte* pSrcBuf, int srcBufSize, int& srcBufUsed,
- byte* pDstBuf, int dstBufSize, int& dstBufUsed)
-{
- result r = E_SUCCESS;
- int res = 0;
- AVPacket inputPacket;
- int outBufSize = 0;
- byte* pOutBuf = null;
- int offSet = 0;
-
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, pSrcBuf != null && pDstBuf != null && srcBufSize > 0 && dstBufSize > 0,
- r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
-#if 0
- // This blocks reads the input data format , i.e channel count and format type is read.
- // No error checkin id done here as we are trying to get the channel count if user wont specify
- if (__decoderConfigured == false)
- {
-
- _WavFormatInfo wavFormatInfo;
- _RiffFileHeader riffHdr;
- _RiffChunkHeader chunkHdr;
-
- if ( srcBufSize > _MIN_WAVE_HEADER_SIZE )
- {
- memcpy(&riffHdr, pSrcBuf, sizeof(riffHdr)); // file header of 12 bytes
- offSet += sizeof(riffHdr);
- memcpy(&chunkHdr, pSrcBuf + offSet, sizeof(chunkHdr)); // format sub chunk header of 8 bytes
- offSet += sizeof(chunkHdr);
- memcpy(&wavFormatInfo, pSrcBuf + offSet, sizeof(wavFormatInfo)); // format sub chunk consists of wave info 16 bytes
- offSet += sizeof(wavFormatInfo);
- // assign to codec context if it is mono or stereo
- if ( riffHdr.chunkId == _RIFF_CHUNK_ID && riffHdr.format== _RIFF_FORMAT_WAVE )
- {
- __pCodecCtx->channels = wavFormatInfo.channels;
- __decoderConfigured = true;
- // Data starts in next sub chunk
- memcpy(&chunkHdr, pSrcBuf + offSet, sizeof(chunkHdr)); // data sub chunk header of 8 bytes
- offSet += sizeof(chunkHdr); // offset is now at data start
- }
- else
- {
- offSet = 0; // Header info is not available
- }
-
- }
-
- }
-#endif
- av_init_packet(&inputPacket);
-
- inputPacket.size = srcBufSize -offSet;
- inputPacket.data = (uint8_t*)pSrcBuf + offSet;
-
- if (dstBufSize >= OUT_BUFFER_SIZE)
- {
- pOutBuf = pDstBuf;
- outBufSize = dstBufSize;
- }
- else
- {
- pOutBuf = __pOutBuf;
- outBufSize = OUT_BUFFER_SIZE;
- }
-
- SysTryCatch(NID_MEDIA, __decoderConfigured == true, r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));
- res = avcodec_decode_audio3(__pCodecCtx, (int16_t*)pOutBuf, &outBufSize, &inputPacket);
- SysTryCatch(NID_MEDIA, (res > 0 && outBufSize > 0), r = E_UNSUPPORTED_FORMAT, E_UNSUPPORTED_FORMAT,
- "[%s] The input data format is not supported ",GetErrorMessage(E_UNSUPPORTED_FORMAT));
-
- SysTryCatch(NID_MEDIA, dstBufSize >= outBufSize, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
-
- dstBufUsed = outBufSize; // the decoded audio data size
- srcBufUsed = res + offSet; // input bytes used + offset header that is skipped
- if (pOutBuf != pDstBuf)
- {
- memcpy(pDstBuf, pOutBuf, outBufSize);
- }
- __decodeCalled = true;
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_UlawDecoder::Probe(const byte* pSrcBuf, const int srcBufSize,
- AudioSampleType& sampleType, AudioChannelType& channelType, int& sampleRate)
-{
- result r = E_SUCCESS;
- int dstBufUsed = 0;
- int srcBufUsed = 0;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, pSrcBuf != null && srcBufSize > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
-
- r = Decode(pSrcBuf, srcBufSize, srcBufUsed, __pOutBuf, OUT_BUFFER_SIZE, dstBufUsed);
-
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Decode failed", GetErrorMessage(r));
-
- channelType = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
- sampleType = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
- sampleRate = __pCodecCtx->sample_rate;
-
- SetLastResult(E_SUCCESS);
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_UlawDecoder::Reset(void)
-{
- result r = E_SUCCESS;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
-
- avcodec_flush_buffers(__pCodecCtx);
-
- __decodeCalled = false;
- SetLastResult(E_SUCCESS);
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_UlawDecoder::GetValue(MediaPropertyType type, int& value) const
-{
- result r = E_SUCCESS;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
- SysTryCatch(NID_MEDIA, __decodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
-
- switch (type)
- {
- case MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE:
- value = _FfmpegUtil::ToAudioChannelType(__pCodecCtx->channels);
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE:
- value = _FfmpegUtil::ToAudioSampleType(__pCodecCtx->sample_fmt);
- break;
-
- case MEDIA_PROPERTY_AUDIO_SAMPLE_RATE:
- value = __pCodecCtx->sample_rate;
- break;
-
- default:
- r = E_OBJ_NOT_FOUND;
- break;
- }
- SetLastResult(r);
- return r;
-
-CATCH:
- return r;
-}
-
-result
-_UlawDecoder::GetValue(MediaPropertyType type, float& value) const
-{
- result r = E_SUCCESS;
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type > 0, r = E_INVALID_ARG, E_INVALID_ARG,
- "[%s] Invalid argument is used. The argument is not valid",GetErrorMessage(E_INVALID_ARG));
- SysTryCatch(NID_MEDIA, __decodeCalled, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
-
- return E_OBJ_NOT_FOUND;
-
-CATCH:
- return r;
-}
-
-Tizen::Base::Collection::IListT<MediaPropertyType>*
-_UlawDecoder::GetSupportedPropertyListN(void) const
-{
- result r = E_SUCCESS;
- ArrayListT<MediaPropertyType>* pList = new (std::nothrow) ArrayListT<MediaPropertyType>;
-
- SysTryCatch(NID_MEDIA, pList != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
- "[%s] Memory Allocation Failed ",GetErrorMessage(E_OUT_OF_MEMORY));
- pList->Add(MEDIA_PROPERTY_AUDIO_SAMPLE_RATE);
- pList->Add(MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE);
- pList->Add(MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE);
- SetLastResult(r);
- return pList;
-
-CATCH:
- return null;
-}
-
-bool
-_UlawDecoder::IsPropertySupported(MediaPropertyType type) const
-{
- result r = E_SUCCESS;
-
- SysTryCatch(NID_MEDIA, __pCodecCtx != null, r = E_INVALID_STATE, E_INVALID_STATE,
- "[%s] The instance is in invalid state",GetErrorMessage(E_INVALID_STATE));
- SysTryCatch(NID_MEDIA, type == MEDIA_PROPERTY_AUDIO_SAMPLE_RATE ||
- type == MEDIA_PROPERTY_AUDIO_CHANNEL_TYPE ||
- type == MEDIA_PROPERTY_AUDIO_SAMPLE_TYPE,
- r = E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND,
- "[%s] The instance is not available ",GetErrorMessage(E_OBJ_NOT_FOUND));
- SetLastResult(r);
- return true;
-
-CATCH:
- return false;
-}
-
-} } // Tizen::Media
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FMedia_UlawDecoder.h
- * @brief This is the header file for the Tizen::Media::_UlawDecoder.
- *
- * This header file contains the declarations of the Tizen::Media::_UlawDecoder.
- */
-#ifndef _FMEDIA_INTERNAL_UlawDecoder_H_
-#define _FMEDIA_INTERNAL_UlawDecoder_H_
-
-
-namespace Tizen { namespace Media
-{
-
-// Generally fiel header + format sub chunk is 36 byte + data chunk header 8 bytes;
-static const int _MIN_WAVE_HEADER_SIZE = 44;
-static const unsigned int _RIFF_CHUNK_ID = 0x46464952; // 'RIFF'
-static const unsigned int _RIFF_FORMAT_WAVE = 0x45564157; // 'WAVE'
-static const unsigned int _WAVE_FORMAT_CHUNK_ID = 0x20746d66; // 'fmt '
-static const unsigned int _WAVE_DATA_CHUNK_ID = 0x61746164; // 'data'
-
-struct _WavFormatInfo
-{
- unsigned short formatTag;
- unsigned short channels;
- unsigned int samplesPerSec;
- unsigned int avgBytesPerSec;
- unsigned short blockAlign;
- unsigned short bitsPerSample;
-};
-
-struct _RiffFileHeader
-{
- unsigned int chunkId;
- unsigned int size;
- unsigned int format;
-};
-
-struct _RiffChunkHeader
-{
- unsigned int chunkId;
- unsigned int size;
-};
-
-class _UlawDecoder
- : public _IAudioDecoder
-{
-public:
- _UlawDecoder(void);
-
- virtual ~_UlawDecoder(void);
-
-public:
- virtual result Construct(const Tizen::Base::Collection::HashMap* pOption = null);
-
- virtual result Probe(const byte* srcBuf, const int length,
- AudioSampleType& sampleType, AudioChannelType& channelType, int& sampleRate);
-
- virtual result Decode(const byte* srcBuf, int srcBufSize, int &srcBufUsed,
- byte* dstBuf, int dstBufSize, int &dstBufUsed);
-
- virtual result Reset(void);
-
- virtual result GetValue(MediaPropertyType type, int& value) const;
-
- virtual result GetValue(MediaPropertyType type, float& value) const;
-
- virtual Tizen::Base::Collection::IListT<MediaPropertyType>* GetSupportedPropertyListN(void) const;
-
- virtual bool IsPropertySupported(MediaPropertyType type) const;
-
-private:
- _UlawDecoder(const _UlawDecoder&);
-
- _UlawDecoder& operator =(const _UlawDecoder&);
-
-private:
- static const int OUT_BUFFER_SIZE = AVCODEC_MAX_AUDIO_FRAME_SIZE; // ffmpeg mandates this size as it checks with this size
- static const int INPUT_BUFFER_PADDING_SIZE = 8;
- static const int MONO_CHANNEL = 1;
- static const int STEREO_CHANNEL = 2;
-
- AVCodecContext* __pCodecCtx;
- AVCodec* __pCodec;
- bool __decodeCalled;
- byte* __pOutBuf;
- bool __decoderConfigured;
-};
-
-} } // Tizen::Media
-
-#endif // _FMEDIA_INTERNAL_UlawDecoder_H_
#include <FMediaImageUtil.h>
#include <FBaseSysLog.h>
#include <metadata_extractor.h>
+#include <FBase_StringConverter.h>
#include "FMedia_VideoFrameExtractorImpl.h"
#include "FMedia_ColorConverter.h"
#include <FIo.h>
namespace Tizen { namespace Media {
+typedef struct
+{
+ RecordingRotation recordingRotation;
+ int rotation;
+} _recordingRotationMap;
+
+static const _recordingRotationMap _RECORDING_ROTATION_MAP[] =
+{
+ { RECORDING_ROTATION_NONE, 0 },
+ { RECORDING_ROTATION_90, 90 },
+ { RECORDING_ROTATION_180, 180 },
+ { RECORDING_ROTATION_270, 270 },
+};
+
_VideoFrameExtractorImpl::_VideoFrameExtractorImpl(void)
: __extractor(null)
, __pixelFormat(MEDIA_PIXEL_FORMAT_NONE)
, __width(0)
, __height(0)
, __duration(0)
+ , __rotation(RECORDING_ROTATION_NONE)
{
}
result r = E_SUCCESS;
int ret = 0;
std::unique_ptr<char[]> pPath;
- int length = 0;
-
+ int rotation = 0;
SysAssertf(__extractor == null,
"Already constructed. Calling Construct() twice or more on a same instance is not allowed for this class.");
__pixelFormat = pixelFormat;
- length = filePath.GetLength();
- pPath.reset(new (std::nothrow) char[length + 2]);
-
+ pPath.reset(_StringConverter::CopyToCharArrayN(filePath));
SysTryReturn(NID_MEDIA, pPath.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY,
"[%s] Propagating. ", GetErrorMessage(GetLastResult()));
- snprintf(pPath.get(), length+2, "%ls", filePath.GetPointer());
-
ret = metadata_extractor_set_path(__extractor, pPath.get());
TryCatch(ret == METADATA_EXTRACTOR_ERROR_NONE, r = ToResult(ret), "metadata_extractor_set_path:%d", ret);
__duration = val;
}
+ r = GetMetaDataValue(__extractor, METADATA_ROTATE, rotation);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if ( rotation != 0 )
+ {
+ for (unsigned int i = 0; i < sizeof(_RECORDING_ROTATION_MAP)/sizeof(_RECORDING_ROTATION_MAP[0]); i++)
+ {
+ if (rotation == _RECORDING_ROTATION_MAP[i].rotation)
+ {
+ __rotation = _RECORDING_ROTATION_MAP[i].recordingRotation;
+ break;
+ }
+ }
+ }
CATCH:
return r;
}
int ret = -1;
ret = metadata_extractor_get_metadata(extractor, (metadata_extractor_attr_e)key, &pOutStr);
- TryCatch(ret == METADATA_EXTRACTOR_ERROR_NONE, r = ToResult(ret), "[%s] Propagating .", GetErrorMessage(ToResult(ret)));
+ SysTryReturn(NID_MEDIA, ret == METADATA_EXTRACTOR_ERROR_NONE, ToResult(ret), ToResult(ret), "[%s] Propagating .", GetErrorMessage(ToResult(ret)));
- value = atoi(pOutStr);
- free(pOutStr);
- pOutStr = null;
-
-CATCH:
+ if (pOutStr != null)
+ {
+ value = atoi(pOutStr);
+ free(pOutStr);
+ pOutStr = null;
+ }
return r;
}
+RecordingRotation
+_VideoFrameExtractorImpl::GetRecordingRotation(void) const
+{
+ return __rotation;
+}
}} // Tizen::Media
#include <FBaseObject.h>
#include <FMediaImageBuffer.h>
#include <FMediaVideoFrameExtractor.h>
+#include <FMediaRecorderTypes.h>
namespace Tizen { namespace Media {
long GetDuration(void) const;
/**
+ * @see VideoFrameExtractor::GetRecordingRotation()
+ */
+ RecordingRotation GetRecordingRotation(void) const;
+
+ /**
* @see VideoFrameExtractor::GetFrameN()
*/
ImageBuffer* GetFrameN(long timestamp);
static const _VideoFrameExtractorImpl* GetInstance(const VideoFrameExtractor *pVideoFrameExtractor);
static result ToResult(int ret);
+
static result GetMetaDataValue(struct metadata_extractor_s*& extractor,int key, int &value);
private:
struct metadata_extractor_s* __extractor;
MediaPixelFormat __pixelFormat;
+ RecordingRotation __rotation;
int __width;
int __height;
long __duration;
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_VideoFrameImpl.cpp
+ * @brief This file contains the implementation of the _VideoFrameImpl class.
+ *
+ */
+
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FMediaVideoFrame.h>
+#include "FMedia_VideoFrameImpl.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+
+namespace Tizen { namespace Media
+{
+typedef struct
+{
+ VideoPlaneType planeType;
+ MediaPixelFormat pixelFormat;
+ double sizeRatio;
+}BytesCountPerLineTable;
+
+_VideoFrameImpl::_VideoFrameImpl(void)
+: __pixelFormat(MEDIA_PIXEL_FORMAT_NONE)
+, __width(0)
+, __height(0)
+, __planeCount(0)
+, __pPlaneType(null)
+{
+ __planeBytesCountPerLine = {0, };
+}
+
+_VideoFrameImpl::~_VideoFrameImpl(void)
+{
+}
+
+result
+_VideoFrameImpl::Initialize(MediaPixelFormat format, int width, int height, int planeCount, byte* data[], int size[], VideoPlaneType planeType[])
+{
+ const static BytesCountPerLineTable bytesCountPerLine[] =
+ {
+ { VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_YUV420P, 1 },
+ { VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_NV12, 1 },
+ { VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_NV21, 1 },
+ { VIDEO_PLANE_TYPE_Y, MEDIA_PIXEL_FORMAT_YUV444P, 1 },
+
+ { VIDEO_PLANE_TYPE_U, MEDIA_PIXEL_FORMAT_YUV420P, 0.5 },
+ { VIDEO_PLANE_TYPE_U, MEDIA_PIXEL_FORMAT_YUV444P, 1 },
+ { VIDEO_PLANE_TYPE_V, MEDIA_PIXEL_FORMAT_YUV420P, 0.5 },
+ { VIDEO_PLANE_TYPE_V, MEDIA_PIXEL_FORMAT_YUV444P, 1 },
+
+ { VIDEO_PLANE_TYPE_UV, MEDIA_PIXEL_FORMAT_NV12, 0.5 },
+ { VIDEO_PLANE_TYPE_UV, MEDIA_PIXEL_FORMAT_NV21, 0.5 },
+
+ { VIDEO_PLANE_TYPE_YUV, MEDIA_PIXEL_FORMAT_YUYV422, 2 },
+ { VIDEO_PLANE_TYPE_YUV, MEDIA_PIXEL_FORMAT_UYVY422, 2 },
+ };
+
+ SysTryReturn(NID_MEDIA, format > MEDIA_PIXEL_FORMAT_NONE && format <= MEDIA_PIXEL_FORMAT_GRAY
+ , E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] This format %d is invalid.", format);
+ SysTryReturn(NID_MEDIA, data != null && size != null, E_INVALID_ARG, E_INVALID_ARG, "[E_INVALID_ARG] This data:%d or size:%d is invalid.", format);
+
+ result r = E_SUCCESS;
+ int i = 0;
+ int tableSize = sizeof(bytesCountPerLine)/sizeof(bytesCountPerLine[0]);
+ while (i < planeCount)
+ {
+ std::unique_ptr <ByteBuffer> pByteBuffer (new ByteBuffer());
+ r = pByteBuffer->Construct(data[i], 0, size[i], size[i]);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+ __pVideoStreamBuffer[i].reset(pByteBuffer.release());
+
+ int j = 0;
+ while (j < tableSize)
+ {
+ if (planeType[i] == bytesCountPerLine[j].planeType && format == bytesCountPerLine[j].pixelFormat)
+ {
+ __planeBytesCountPerLine[i] = width * bytesCountPerLine[j].sizeRatio;
+ break;
+ }
+ j++;
+ }
+ i++;
+ }
+
+ __pixelFormat = format;
+ __width = width;
+ __height = height;
+ __planeCount = planeCount;
+ __pPlaneType = planeType;
+
+ return r;
+}
+
+int
+_VideoFrameImpl::GetPlaneCount(void) const
+{
+ return __planeCount;
+}
+
+VideoPlaneType
+_VideoFrameImpl::GetPlaneType(int index) const
+{
+ SysTryReturn(NID_MEDIA, index < __planeCount, VIDEO_PLANE_TYPE_NONE, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index:%d is greater than the count:%d or negative value.", index, __planeCount);
+ return __pPlaneType[index];
+}
+
+
+Tizen::Base::ByteBuffer*
+_VideoFrameImpl::GetPlaneData(int index) const
+{
+ SysTryReturn(NID_MEDIA, index < __planeCount, null, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index:%d is greater than the count:%d or negative value.", index, __planeCount);
+ return __pVideoStreamBuffer[index].get();
+}
+
+int
+_VideoFrameImpl::GetBytesCountPerLine(int index) const
+{
+ SysTryReturn(NID_MEDIA, index < __planeCount, 0, E_OUT_OF_RANGE, "[E_OUT_OF_RANGE] This index:%d is greater than the count:%d or negative value.", index, __planeCount);
+ return __planeBytesCountPerLine[index];
+}
+
+int
+_VideoFrameImpl::GetWidth(void) const
+{
+ return __width;
+}
+
+int
+_VideoFrameImpl::GetHeight(void) const
+{
+ return __height;
+}
+
+MediaPixelFormat
+_VideoFrameImpl::GetPixelFormat(void) const
+{
+ return __pixelFormat;
+}
+
+_VideoFrameImpl*
+_VideoFrameImpl::GetInstance(VideoFrame *pVideoFrame)
+{
+ if ( pVideoFrame != null )
+ {
+ return pVideoFrame->__pImpl;
+ }
+ return null;
+}
+
+const _VideoFrameImpl*
+_VideoFrameImpl::GetInstance(const VideoFrame *pVideoFrame)
+{
+ if ( pVideoFrame != null )
+ {
+ return pVideoFrame->__pImpl;
+ }
+ return null;
+}
+
+}} // Tizen::Media
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_VideoFrameImpl.h
+ * @brief This header file contains the declaration of the _VideoFrame_Impl class.
+ */
+
+#ifndef _FMEDIA_INTERNAL_VIDEOFRAME_IMPL_H_
+#define _FMEDIA_INTERNAL_VIDEOFRAME_IMPL_H_
+
+#include <FMediaTypes.h>
+
+namespace Tizen { namespace Media
+{
+class VideoFrame;
+
+/**
+ * @class _VideoFrameImpl
+ * @brief This class saves the video frame attributes
+ */
+
+class _VideoFrameImpl
+ : public Tizen::Base::Object
+{
+
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ */
+ _VideoFrameImpl(void);
+
+ /**
+ * This is the destructor for this class. @n
+ * All allocated resources are deallocated by this method. This polymorphic destructor should be overridden if required.
+ * This way, the destructors of the derived classes are called when the destructor of this interface is called.
+ *
+ */
+ virtual ~_VideoFrameImpl(void);
+
+ /**
+ *
+ * Initialize the frame.
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @param[in] format The pixel format
+ * @param[in] width The width
+ * @param[in] height The height
+ * @param[in] planeCount The plane count
+ * @param[in] data The array of the data
+ * @param[in] size The array of the data size
+ * @param[in] planeType The array of the plane type
+ * @remarks The %c data, %c planeType' memories are shared with the caller.
+ *
+ */
+ result Initialize(MediaPixelFormat format, int width, int height, int planeCount, byte* data[], int size[], VideoPlaneType planeType[]);
+
+ /**
+ *
+ * Gets the plane count which the frame data has.
+ *
+ * @return The plane count
+ *
+ */
+ int GetPlaneCount(void) const;
+
+ /**
+ *
+ * Gets the video plane type at the specified index from the frame.
+ *
+ * @return The video plane type, @n
+ * else ::VIDEO_PLANE_TYPE_NONE if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ *
+ */
+ VideoPlaneType GetPlaneType(int index) const;
+
+ /**
+ *
+ * Gets the plane data at the specified index from the frame.
+ *
+ * @return The plane data, @n
+ * else @null if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The buffer in ByteBuffer is shared with @c VideoFrame instance. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ *
+ */
+ Tizen::Base::ByteBuffer* GetPlaneData(int index) const;
+
+ /**
+ *
+ * Gets the bytes count per a line of the specified index plane.
+ *
+ * @return The number of bytes per a line of the plane, @n
+ * else @c 0 if an error occurred
+ * @param[in] index The index at which the value is read
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range.
+ * @remarks The index should be less than the plane count. @n
+ * The specific error code can be accessed using the GetLastResult() method.
+ *
+ */
+ int GetBytesCountPerLine(int index) const;
+
+ /**
+ *
+ * Gets the width of the frame.
+ *
+ * @return The width of the frame
+ *
+ */
+ int GetWidth(void) const;
+
+ /**
+ *
+ * Gets the height of the frame.
+ *
+ * @return The height of the frame
+ *
+ */
+ int GetHeight(void) const;
+
+ /**
+ *
+ * Gets the pixel format of the frame.
+ *
+ * @return The pixel format of the frame
+ *
+ */
+ MediaPixelFormat GetPixelFormat(void) const;
+
+ /**
+ * Gets the Impl instance.
+ *
+ * @return The pointer to %_VideoFramempl
+ * @param[in] pVideoFrame The %VideoFrame pointer
+ */
+ static _VideoFrameImpl* GetInstance(VideoFrame *pVideoFrame);
+
+ /**
+ * Gets the Impl instance.
+ *
+ * @return The pointer to %_VideoFramempl
+ * @param[in] pVideoFrame The %VideoFrame pointer
+ */
+ static const _VideoFrameImpl* GetInstance(const VideoFrame *pVideoFrame);
+
+private:
+ _VideoFrameImpl(const _VideoFrameImpl&);
+ _VideoFrameImpl& operator =(const _VideoFrameImpl& _VideoFrameImpl);
+
+ static const int MAX_PLANE_COUNT = 4;
+
+ MediaPixelFormat __pixelFormat;
+ int __width;
+ int __height;
+ int __planeCount;
+ VideoPlaneType* __pPlaneType;
+ int __planeBytesCountPerLine[MAX_PLANE_COUNT];
+ std::unique_ptr <Tizen::Base::ByteBuffer> __pVideoStreamBuffer[MAX_PLANE_COUNT];
+};
+
+}}// Tizen::Media
+
+#endif
#include "FMedia_RecorderUtil.h"
#include "FMedia_RecorderCapability.h"
#include "FMedia_CamPtrUtil.h"
+#include "FMedia_AudioStreamCoordinator.h"
using namespace Tizen::Base;
using namespace Tizen::Base::Collection;
, __mute(false)
, __rotation(RECORDING_ROTATION_NONE)
, __handle(MM_INVALID_HANDLE)
- ,__deviceType(_RECORDER_DEVICE_NONE)
- ,__mmSourceFormat(CAMERA_PIXEL_FORMAT_INVALID)
- ,__stateChangeReason(_RECORDER_STATE_REASON_NORMAL)
+ , __deviceType(_RECORDER_DEVICE_NONE)
+ , __mmSourceFormat(CAMERA_PIXEL_FORMAT_INVALID)
+ , __stateChangeReason(_RECORDER_STATE_REASON_NORMAL)
+ , __pAudioStreamCoordinator(null)
+ , __audioStreamTimeDuration(0)
+ , __audioStreamCallback(false)
{
__recordingResolution.width = 0;
__recordingResolution.height = 0;
{
int err = ::RECORDER_ERROR_NONE;
err = recorder_unset_state_changed_cb(__handle);
+ err = recorder_unset_audio_stream_cb(__handle);
err = recorder_unset_recording_limit_reached_cb(__handle);
err = recorder_unset_error_cb(__handle);
err = recorder_unset_recording_status_cb(__handle);
Tizen::Media::_CameraImpl* pCamImpl = null;
_CameraHandle cameraHandle = MM_INVALID_HANDLE;
int err = MM_SUCCESS;
+ int streamFps = 0;
+ _CapabilityImpl* pCapabilityImpl = null;
SysTryReturn(NID_MEDIA, !__isUsed, E_DEVICE_BUSY, E_DEVICE_BUSY, "[E_DEVICE_BUSY] _VideoRecorderImpl is now being used.");
SysTryReturn(NID_MEDIA, !__isConstructed, E_INVALID_STATE, E_INVALID_STATE, "[E_INVALID_STATE] VideoRecorder is in an invalid state. A device is already constructed.");
r = __pVideoRecorderEvent->AddListener(listener);
SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
-
__pVideoRecorderEventListener = &listener;
+ // Create audio stream coordinator
+ __pAudioStreamCoordinator.reset(new (std::nothrow) _AudioStreamCoordinator());
+ SysTryCatch(NID_MEDIA, __pAudioStreamCoordinator.get() != null, r = E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = __pAudioStreamCoordinator->Construct();
+ SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ // Get the capability
+ pCapabilityImpl = _CapabilityImpl::GetInstance();
+ SysTryCatch(NID_MEDIA, pCapabilityImpl != null, r= E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error has been occurred. Capability is not obtained.");
+
+ r = pCapabilityImpl->GetValue(String(L"VideoRecorder.Device.fps"), streamFps);
+ //SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+ streamFps = 50;
+
+ if (streamFps != 0)
+ {
+ __audioStreamTimeDuration = (1000/streamFps); //Time duration in milisec
+ }
+
__deviceType = (pCamImpl->GetSelection() == CAMERA_PRIMARY ? _RECORDER_DEVICE_VIDEO_PRIMARY_CAMERA
: _RECORDER_DEVICE_VIDEO_SECONDARY_CAMERA);
}
result
+_VideoRecorderImpl::AddAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pAudioStreamCoordinator->AddAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__audioStreamCallback != true)
+ {
+ int err = ::RECORDER_ERROR_NONE;
+ err = recorder_set_audio_stream_cb(__handle, AudioStreamCb, this);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] audio recorder set audio stream callback failed.", GetErrorMessage(r));
+ __audioStreamCallback = true;
+ }
+
+ return r;
+}
+
+result
+_VideoRecorderImpl::RemoveAudioStreamFilter(IAudioStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pAudioStreamCoordinator->RemoveAudioStreamFilter(filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ if (__pAudioStreamCoordinator->GetFilterListCount() == 0)
+ {
+ int err = ::RECORDER_ERROR_NONE;
+ err = recorder_unset_audio_stream_cb(__handle);
+ r = ConvertResult(err);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] audio recorder unset recording status callback failed.", GetErrorMessage(r));
+ __audioStreamCallback = false;
+ }
+
+ return r;
+}
+
+result
_VideoRecorderImpl::CreateVideoFile(const Tizen::Base::String& mediaLocalPath, bool overwrite)
{
result r = E_SUCCESS;
_VideoRecorderImpl::AudioStreamCb(void* pStream, int size, audio_sample_type_e format, int channel, unsigned int timeStamp, void *pUserData)
{
_VideoRecorderImpl* pImpl = static_cast<_VideoRecorderImpl*>(pUserData);
+ int samplingRate =0;
SysTryReturn(NID_MEDIA, _VideoRecorderImpl::IsAlive(), , E_INVALID_OPERATION, "[E_INVALID_OPERATION] The object was already destroyed.");
SysTryReturn(NID_MEDIA, pImpl != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] _VideoRecorderImpl instance is not available. Impl is null.");
SysTryReturn(NID_MEDIA, pStream != null, , E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] void instance is not available. pStream is null.");
-// SysLog(NID_MEDIA, "Size:%d, format:%d, channel:%d, timeStamp:%u", size, format, channel, timeStamp);
+ if (pImpl->__audioStreamCallback == true)
+ {
+ samplingRate = _RecorderUtil::CalculateSampleRate(size, channel, pImpl->__audioStreamTimeDuration, _RecorderUtil::GetOspSampleType(format));
+ (pImpl->__pAudioStreamCoordinator)->ProcessAudioStreamData((byte*)pStream, size, samplingRate, _RecorderUtil::GetOspChannelType(channel), _RecorderUtil::GetOspSampleType(format));
+ }
}
void
#ifndef _FMEDIA_INTERNAL_VIDEORECORDER_IMPL_H_
#define _FMEDIA_INTERNAL_VIDEORECORDER_IMPL_H_
+#include <unique_ptr.h>
#include <recorder.h>
#include <FBaseColIList.h>
#include <FGrpDimension.h>
#include "FMedia_ICameraCoordinatorListener.h"
#include "FMedia_CameraTypes.h"
#include "FMedia_RecorderTypes.h"
-#include "FMedia_RecorderTypes.h"
namespace Tizen { namespace Media
{
class Camera;
class VideoRecorder;
class IVideoRecorderEventListener;
+class _AudioStreamCoordinator;
+class IAudioStreamFilter;
class _CameraCoordinator;
class _VideoRecorderEvent;
*/
static const _VideoRecorderImpl* GetInstance(const VideoRecorder *pVideoRecorder);
+ /**
+ * Adds the stream filter to process the audio stream data while recording.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ */
+ result AddAudioStreamFilter(IAudioStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop processing the audio stream data.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IAudioStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ */
+ result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
+
private:
/**
* Converts the error from recorder to Result.
camera_pixel_format_e __mmSourceFormat;
Tizen::Base::String __filePath;
_RecorderStateChangeReason __stateChangeReason;
-
static bool __isUsed;
+ std::unique_ptr <_AudioStreamCoordinator> __pAudioStreamCoordinator;
+ int __audioStreamTimeDuration;
+ bool __audioStreamCallback;
+
};
}}// Tizen::Media
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_VideoStreamCoordinator.cpp
+ * @brief This file contains the video stream processing.
+ *
+ */
+#include <unique_ptr.h>
+#include <FBaseSysLog.h>
+#include <FMediaVideoFrame.h>
+#include "FMedia_VideoFrameImpl.h"
+#include "FMedia_VideoStreamCoordinator.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+namespace Tizen { namespace Media
+{
+
+_VideoStreamCoordinator::_VideoStreamCoordinator(void)
+: __pStreamFilterList(null, _ListPtrUtil::remover)
+{
+
+}
+
+_VideoStreamCoordinator::~_VideoStreamCoordinator(void)
+{
+
+}
+
+result
+_VideoStreamCoordinator::Construct(void)
+{
+ result r = E_SUCCESS;
+
+ __pStreamFilterList.reset(new (std::nothrow) ArrayListT<IVideoStreamFilter*>);
+ SysTryReturn(NID_MEDIA, __pStreamFilterList.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ r = __pStreamFilterList->Construct();
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_VideoStreamCoordinator::ProcessVideoStreamData(MediaPixelFormat format, int width, int height, int planeCount, byte* data[], int size[], VideoPlaneType planeType[])
+{
+ result r = E_SUCCESS;
+
+ VideoFrame videoFrame;
+ r = videoFrame.Construct();
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+
+ _VideoFrameImpl* pVideoFrameImpl = _VideoFrameImpl::GetInstance(&videoFrame);
+ SysTryReturn(NID_MEDIA, pVideoFrameImpl != null, E_OBJ_NOT_FOUND, E_OBJ_NOT_FOUND, "[E_OBJ_NOT_FOUND] The implementation object is not found.");
+
+ r = pVideoFrameImpl->Initialize(format, width, height, planeCount, data, size, planeType);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+
+ std::unique_ptr <IEnumeratorT<IVideoStreamFilter*> > pEnum (__pStreamFilterList->GetEnumeratorN());
+ SysTryReturn(NID_MEDIA, pEnum.get() != null, E_OUT_OF_MEMORY, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed. The object is not created.");
+
+ while (pEnum->MoveNext() == E_SUCCESS)
+ {
+ IVideoStreamFilter* pFilter = null;
+ r = pEnum->GetCurrent(pFilter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+
+ pFilter->ProcessVideoStream(videoFrame);
+ }
+
+ return r;
+}
+
+result
+_VideoStreamCoordinator::AddVideoStreamFilter(IVideoStreamFilter& filter)
+{
+ SysTryReturn(NID_MEDIA, __pStreamFilterList->Contains(&filter) != true, E_OBJ_ALREADY_EXIST, E_OBJ_ALREADY_EXIST, "[E_OBJ_ALREADY_EXIST] The filter already exists.");
+
+ result r = E_SUCCESS;
+ r = __pStreamFilterList->Add(&filter);
+ SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r, "[%s] Propagating", GetErrorMessage(r));
+
+ return r;
+}
+
+result
+_VideoStreamCoordinator::RemoveVideoStreamFilter(IVideoStreamFilter& filter)
+{
+ result r = E_SUCCESS;
+
+ r = __pStreamFilterList->Remove(&filter);
+ SysTryReturn(NID_MEDIA, r== E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
+int
+_VideoStreamCoordinator::GetFilterListCount(void) const
+{
+ return __pStreamFilterList->GetCount();
+}
+
+}}
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FMedia_VideoStreamCoordinator.h
+ * @brief This header file contains the declaration of _VideoStreamCoordinator class.
+ *
+ */
+
+#ifndef _FMEDIA_INTERNAL_VIDEO_STREAM_COORDINATOR_H_
+#define _FMEDIA_INTERNAL_VIDEO_STREAM_COORDINATOR_H_
+
+#include <FMediaImageTypes.h>
+#include "FMedia_CameraUtil.h"
+#include "FMedia_CamPtrUtil.h"
+
+namespace Tizen { namespace Media
+{
+
+class IVideoStreamFilter;
+
+/**
+ * @class _VideoStreamCoordinator
+ * @brief This class provides the Video stream coordinator.
+ *
+ */
+class _VideoStreamCoordinator
+{
+
+public:
+ /**
+ * The constructor.
+ */
+ _VideoStreamCoordinator(void);
+
+ /**
+ * The destructor.
+ */
+ ~_VideoStreamCoordinator(void);
+
+ /**
+ * Initializes a new instance of this class
+ *
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_SYSTEM The system error
+ */
+ result Construct(void);
+
+ /**
+ * Process the video pre-processing.
+ *
+ * @return An error code
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG A specified input parameter is invalid.
+ * @param[in] format The pixel format
+ * @param[in] width The width
+ * @param[in] height The height * @param[in] data The array of the data
+ * @param[in] planeCount The plane count
+ * @param[in] size The array of the data size
+ * @param[in] planeType The array of the plane type
+ */
+ result ProcessVideoStreamData(MediaPixelFormat format, int width, int height, int planeCount, byte* data[], int size[], VideoPlaneType planeType[]);
+
+ /**
+ * Adds the stream filter to process the video stream data while previewing or recording.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_ALREADY_EXIST The filter already exists.
+ * @exception E_OUT_OF_MEMORY The memory is insufficient.
+ * @remarks IVideoStreamFilter::ProcessVideoStream() will be called when the video frame is ready.
+ */
+ result AddVideoStreamFilter(IVideoStreamFilter& filter);
+
+ /**
+ * Removes the stream filter to stop receiving the video stream data.
+ *
+ * @return An error code
+ * @param[in] filter An instance of IVideoStreamFilter
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The filter is not found.
+ */
+ result RemoveVideoStreamFilter(IVideoStreamFilter& filter);
+
+ /**
+ * Gets the stream filter added count
+ *
+ * @return The added filter count
+ */
+ int GetFilterListCount(void) const;
+
+private:
+ _VideoStreamCoordinator(const _VideoStreamCoordinator& rhs);
+ _VideoStreamCoordinator& operator =(const _VideoStreamCoordinator& rhs);
+
+ std::unique_ptr <Tizen::Base::Collection::ArrayListT<IVideoStreamFilter*>, _ListPtrUtil::Remover> __pStreamFilterList;
+
+};
+
+}}
+
+#endif
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License)
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#include <iostream>
-#include <pthread.h>
-#include <sound_manager.h>
-#include <FBaseRt.h>
-#include <FBaseSysLog.h>
-#include <FMediaAudioManagerTypes.h>
-#include "FMedia_AudioManagerConvert.h"
-#include "FMedia_VoipAudioSessionManagerImpl.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Runtime;
-
-namespace Tizen { namespace Media {
-
-_VoipAudioSessionManagerImpl* _VoipAudioSessionManagerImpl::__pVoipAudioSessionManagerImpl = null;
-
-_VoipAudioSessionManagerImpl::_VoipAudioSessionManagerImpl()
- :__soundCallSessionHandle(null)
-{
-
-}
-
-_VoipAudioSessionManagerImpl::~_VoipAudioSessionManagerImpl(void)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- result r = E_SUCCESS;
- if (__soundCallSessionHandle != null)
- {
- ret = sound_manager_call_session_destroy(__soundCallSessionHandle);
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryLog(NID_MEDIA, r == E_SUCCESS,
- "[%s] Failed to perform sound_manager_call_session_destroy operation.", GetErrorMessage(r));
- __soundCallSessionHandle = null;
- }
-}
-
-void
-_VoipAudioSessionManagerImpl::InitVoipAudioSessionManagerImpl(void)
-{
- static _VoipAudioSessionManagerImpl instance;
- __pVoipAudioSessionManagerImpl = &instance;
-}
-
-_VoipAudioSessionManagerImpl*
-_VoipAudioSessionManagerImpl::GetInstance(void)
-{
- ClearLastResult();
- static pthread_once_t onceBlock = PTHREAD_ONCE_INIT;
- if (__pVoipAudioSessionManagerImpl == null)
- {
- pthread_once(&onceBlock, InitVoipAudioSessionManagerImpl);
- }
- return __pVoipAudioSessionManagerImpl;
-}
-
-result
-_VoipAudioSessionManagerImpl::EnterCallSession(void)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- result r = E_SUCCESS;
- SysTryReturn(NID_MEDIA, __soundCallSessionHandle == null , E_INVALID_OPERATION, E_INVALID_OPERATION,
- "[E_INVALID_OPERATION] A error has been occurred. The value of __soundCallSessionHandle is not null.");
-
- ret = sound_manager_call_session_create(SOUND_SESSION_TYPE_VOIP, &__soundCallSessionHandle);
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r,
- "[%s] Failed to perform sound_manager_get_a2dp_status operation with error code : 0x%x", GetErrorMessage(r), ret);
- SysTryCatch(NID_MEDIA, __soundCallSessionHandle != null, r = E_SYSTEM, E_SYSTEM,
- "[E_SYSTEM] A system error has been occurred. The value of __soundCallSessionHandle is null.");
-
- return E_SUCCESS;
-CATCH:
- if (__soundCallSessionHandle)
- {
- sound_manager_call_session_destroy(__soundCallSessionHandle);
- __soundCallSessionHandle = null;
- }
- return r;
-}
-
-result
-_VoipAudioSessionManagerImpl::ExitCallSession(void)
-{
- SysTryReturn(NID_MEDIA, __soundCallSessionHandle != null , E_INVALID_OPERATION, E_INVALID_OPERATION,
- "[E_INVALID_OPERATION] A error has been occurred. The value of __soundCallSessionHandle is null.");
- int ret = SOUND_MANAGER_ERROR_NONE;
- result r = E_SUCCESS;
- ret = sound_manager_call_session_destroy(__soundCallSessionHandle);
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r,"[%s] Failed to perform sound_manager_call_session_destroy operation.", GetErrorMessage(r));
- __soundCallSessionHandle = null;
- return E_SUCCESS;
-}
-
-result
-_VoipAudioSessionManagerImpl::SetCallSessionMode(VoipAudioSessionMode mode)
-{
- result r = E_SUCCESS;
- int ret = SOUND_MANAGER_ERROR_NONE;
- SysAssertf(__soundCallSessionHandle != null, "Not yet constructed! Construct() should be called before use");
- SysTryReturn(NID_MEDIA, mode != VOIP_AUDIO_SESSION_MODE_NONE , E_INVALID_ARG, E_INVALID_ARG,
- " [E_INVALID_ARG] Invalid argument is used. The mode is not correct : %d", mode);
- ret = sound_manager_call_session_set_mode(__soundCallSessionHandle, _AudioManagerConvert::ConvertVoipMode2CallMode(mode));
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryReturn(NID_MEDIA, r == E_SUCCESS, r, r,
- "[%s] Failed to perform sound_manager_call_session_set_mode operation.", GetErrorMessage(r));
- return r;
-}
-
-VoipAudioSessionMode
-_VoipAudioSessionManagerImpl::GetCallSessionMode(void)
-{
- int ret = SOUND_MANAGER_ERROR_NONE;
- result r = E_SUCCESS;
- SysAssertf(__soundCallSessionHandle != null, "Not yet constructed! Construct() should be called before use");
- sound_call_session_mode_e soundCallSessionMode = SOUND_CALL_SESSION_MODE_VOICE;
- ret = sound_manager_call_session_get_mode(__soundCallSessionHandle, &soundCallSessionMode);
- r = _AudioManagerConvert::CovertSoundManagerError2Result(ret);
- SysTryCatch(NID_MEDIA, r == E_SUCCESS, , r,
- "[%s] Failed to perform sound_manager_call_session_get_mode operation with error code : 0x%x", GetErrorMessage(r), ret);
- return _AudioManagerConvert::ConvertCallSessionMode2VoipMode(soundCallSessionMode);
-CATCH:
- return VOIP_AUDIO_SESSION_MODE_NONE;
-}
-
-};
-}; //Tizen::Media
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-#ifndef _FMEDIA_INTERNAL_AUDIO_SESSION_MANAGER_IMPL_H_
-#define _FMEDIA_INTERNAL_AUDIO_SESSION_MANAGER_IMPL_H_
-#include <unique_ptr.h>
-#include <sound_manager.h>
-#include <FBaseObject.h>
-#include <FBaseRt.h>
-#include <FMediaAudioManagerTypes.h>
-#include "FMedia_AudioSessionEvent.h"
-#include "FMedia_AudioSessionEventArg.h"
-
-namespace Tizen{ namespace Media{
-class IAudioSessionEventListener;
-
-class _AudioSessionManagerImpl
- :public Tizen::Base::Object
-{
-public:
- static _AudioSessionManagerImpl* GetInstance();
- static void SoundSessionNotificationsCallback(sound_interrupted_code_e notify, void* pUserData);
- result SetAudioSessionEventListener(IAudioSessionEventListener* pListener);
- result AddListener(IAudioSessionEventListener* pListener);
- result RemoveListener(IAudioSessionEventListener* pListener);
- result SetMode(AudioSessionMode sessionMode);
- AudioSessionMode GetMode(void);
- sound_interrupted_code_e GetInterruptType(void);
-
-private:
- _AudioSessionManagerImpl();
- virtual ~_AudioSessionManagerImpl();
- _AudioSessionManagerImpl(const _AudioSessionManagerImpl& audioSessionManager);
- _AudioSessionManagerImpl& operator =(const _AudioSessionManagerImpl& audioSessionManager);
- static void InitAudioSessionManagerImpl(void);
- result Construct(void);
- void SendInterrupted(sound_interrupted_code_e notify);
- void SendAudioFocusChanged(sound_interrupted_code_e notify);
- void SendReleased();
- static _AudioSessionManagerImpl* __pAudioSessionImpl;
- std::unique_ptr<_AudioSessionEvent> __pAudioSessionEvent;
- IAudioSessionEventListener* __pSingleAudioSessionListner;
- AudioSessionMode __currentSessionMode;
- sound_interrupted_code_e __interruptedEvent;
- bool __interruptFlag;
-};
-
-};
-};
-#endif
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-/**
- * @file FMedia_CameraPreProcessUtil.h
- * @brief This header file contains the declarations of Camera's extened functions.
- *
- */
-
-#ifndef _FMEDIA_INTERNAL_CAMERA_PROCESSING_H_
-#define _FMEDIA_INTERNAL_CAMERA_PROCESSING_H_
-
-#include <FMediaTypes.h>
-
-namespace Tizen { namespace Media
-{
-class Camera;
-
-typedef void (*_CameraPreprocessingCallback)( MediaPixelFormat format, byte* data[4], int size[4], void* user);
-
-extern "C" _OSP_EXPORT_ result SetPreProcessingCallback(Camera &cam, _CameraPreprocessingCallback pPreProcessCbFunc, void* pPreProcessUserData);
-extern "C" _OSP_EXPORT_ result UnSetPreProcessingCallback(Camera &cam);
-
-}}// Tizen::Media
-
-#endif
-
static result MapExceptionToResult(int reason);
static CodecType ConvertAudioCodec(char *pAudioCodec);
static CodecType ConvertVideoCodec(char *pVideoCodec);
- void HandlePlayerPrepared(void);
+ void HandlePlayerPrepared(int errorCode);
void HandlePlayerCompleted(void);
void HandlePlayerError(int errorCode);
void HandlePlayerBuffering(int percent);
void HandlePlayerSeekCompleted(void);
void HandlePlayerInterrupted(void);
void HandlePlayerReleased(void);
- void HandlePlayerAudioFoucsChanged(void);
+ void HandlePlayerAudioFocusChanged(void);
result HandlePdMessageCallBack(player_pd_message_type_e type);
static void InitInstanceMutex(void);
Orientation __orientation;
int __currentVolume;
PlayerState __currentState;
+ PlayerState __preState;
Tizen::Graphics::BitmapPixelFormat __videoPixelFormat;
int __bufferDataSize;
int __decodedFrameWidth;
+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-
-// @file FMedia_VoipAudioSessionManagerImpl.h
-// @brief This is the header file for the FMedia_VoipAudioSessionManagerImpl.h
-//
-// This header file contains the declarations of the FMedia_VoipAudioSessionManagerImpl.h
-//
-//
-#ifndef _FMEDIA_VOIP_AUDIO_SESSION_MANAGER_IMPL_H
-#define _FMEDIA_VOIP_AUDIO_SESSION_MANAGER_IMPL_H_
-#include <memory>
-#include <sound_manager.h>
-#include <FBaseRt.h>
-#include <FMediaAudioManagerTypes.h>
-
-namespace Tizen { namespace Media
-{
-class _VoipAudioSessionManagerImpl
- :public Tizen::Base::Object
-{
-public:
- static _VoipAudioSessionManagerImpl* GetInstance();
- result EnterCallSession(void);
- result ExitCallSession(void);
- result SetCallSessionMode(VoipAudioSessionMode mode);
- VoipAudioSessionMode GetCallSessionMode(void);
-private:
- _VoipAudioSessionManagerImpl(void);
- virtual ~_VoipAudioSessionManagerImpl(void);
- static void InitVoipAudioSessionManagerImpl(void);
- sound_call_session_h __soundCallSessionHandle;
- static _VoipAudioSessionManagerImpl* __pVoipAudioSessionManagerImpl;
-};
-}} //Tizen::Media
-#endif