2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
19 * @file FMedia_VideoRecorderImpl.h
20 * @brief This is the header file for the %_VideoRecorderImpl class.
22 #ifndef _FMEDIA_INTERNAL_VIDEORECORDER_IMPL_H_
23 #define _FMEDIA_INTERNAL_VIDEORECORDER_IMPL_H_
25 #include <unique_ptr.h>
27 #include <FBaseColIList.h>
28 #include <FGrpDimension.h>
29 #include <FMediaTypes.h>
30 #include <FMediaVideoRecorderTypes.h>
31 #include "FMedia_ICameraCoordinatorListener.h"
32 #include "FMedia_CameraTypes.h"
33 #include "FMedia_RecorderTypes.h"
35 namespace Tizen { namespace Media
39 class IVideoRecorderEventListener;
40 class _AudioStreamCoordinator;
41 class IAudioStreamFilter;
43 class _CameraCoordinator;
44 class _VideoRecorderEvent;
45 class _VideoSourceAdapter;
48 * @class _VideoRecorderImpl
49 * @brief This class records a video.
51 class _VideoRecorderImpl
52 : public Tizen::Base::Object
53 , public _ICameraCoordinatorListener
57 * This is the default constructor for this class.
59 * @remarks The object is not fully constructed after this constructor is called. For full construction,
60 * the Construct() method must be called right after calling this constructor.
63 _VideoRecorderImpl(void);
66 * This is the destructor for this class. @n
67 * All allocated resources are deallocated by this method. This method should be called in the same thread in
68 * which the Construct() method is called. This polymorphic destructor should be overridden if required.
69 * This way, the destructors of the derived classes are called when the destructor of this interface is called.
73 virtual ~_VideoRecorderImpl(void);
76 * Initializes this instance of _VideoRecorderImpl with an associated listener and an input source.
78 * @return An error code
79 * @param[in] listener An event listener object
80 * @param[in] camera A Camera object for the input source
81 * @exception E_SUCCESS The method is successful.
82 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
83 * @exception E_SYSTEM A system error has occurred.
84 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
86 result Construct(IVideoRecorderEventListener& listener, const Camera& camera);
89 * Creates a video file for a recording.
91 * @return An error code
92 * @param[in] destMediaPath The destination for the file be written @n
93 * The available paths start with prefixes retrieved from the functions such as: @n
94 * Tizen::App::App::GetInstance()->GetAppRootPath() @n
95 * Tizen::System::Environment::GetMediaPath() @n
96 * Tizen::System::Environment::GetExternalStoragePath()
97 * @param[in] overwrite Set to @c true to overwrite the file, @n
99 * @exception E_SUCCESS The method is successful.
100 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
101 * @exception E_RESOURCE_UNAVAILABLE The required file path is unavailable.
102 * @exception E_FILE_ALREADY_EXIST The specified file already exists.
103 * @exception E_STORAGE_FULL The storage is full.
104 * @exception E_OUT_OF_MEMORY The memory is insufficient.
107 result CreateVideoFile(const Tizen::Base::String& destMediaPath, bool overwrite);
110 * Closes the video file. @n
111 * This is a synchronous method.
113 * @return An error code
114 * @exception E_SUCCESS The method is successful.
115 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
116 * @exception E_SYSTEM A system error has occurred.
117 * @exception E_OUT_OF_MEMORY The memory is insufficient.
118 * @see CreateVideoFile()
123 * Starts the recording. @n
124 * Resumes the recording if Pause() has been called.
126 * @return An error code
127 * @exception E_SUCCESS The method is successful.
128 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
129 * @exception E_SYSTEM A system error has occurred.
130 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
131 * @exception E_OUT_OF_MEMORY The memory is insufficient.
132 * @remarks This method must be called after the input media source is started (for example, Camera::StartPreview()).
133 * @see Stop(), Pause()
138 * Stops the recording.
140 * @return An error code
141 * @exception E_SUCCESS The method is successful.
142 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
143 * @exception E_SYSTEM A system error has occurred.
144 * @exception E_OUT_OF_MEMORY The memory is insufficient.
145 * @see Record(), Pause()
150 * Pauses the recording. @n
151 * To resume the recording after this method is called, Record() must be called.
153 * @return An error code
154 * @exception E_SUCCESS The method is successful.
155 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
156 * @exception E_SYSTEM A system error has occurred.
157 * @exception E_OUT_OF_MEMORY The memory is insufficient.
158 * @see Stop(), Record()
163 * Cancels the recording operation without saving the data.
165 * @return An error code
166 * @exception E_SUCCESS The method is successful.
167 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
168 * @exception E_SYSTEM A system error has occurred.
169 * @exception E_OUT_OF_MEMORY The memory is insufficient.
170 * @remarks When this method is called, the state is changed to ::RECORDER_STATE_STOPPING. @n
171 * After IVideoRecorderEventListener::OnVideoRecorderCanceled is called, the state is changed to
172 * ::RECORDER_STATE_STOPPED.
173 * @see Record(), Stop()
178 * Gets the state of a recorder.
180 * @see CreateVideoFile(), Close(), Record(), Stop(), Pause(), RecorderState()
182 RecorderState GetState(void) const;
185 * Gets the current recording time.
187 * @return The current recording time in milliseconds, @n
188 * else @c -1 if the recording has not started as yet
190 long GetRecordingTime(void) const;
193 * Gets the current recording size.
195 * @return A @c long value indicating the current recording size in bytes, @n
196 * else @c -1 if the recording has not started as yet
198 long GetRecordingSize(void) const;
201 * Sets the time limit for the recording in milliseconds.
203 * @return An error code
204 * @param[in] msTime The maximum recording time in milliseconds @n
205 * The time must be greater than @c 0.
206 * @exception E_SUCCESS The method is successful.
207 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
208 * @exception E_OUT_OF_RANGE The specified time is out of range.
209 * @exception E_OUT_OF_MEMORY The memory is insufficient.
210 * @remarks The default time is @c 60 seconds.
211 * @see GetMaxRecordingTime()
213 result SetMaxRecordingTime(long msTime);
216 * Gets the time limit of the recording in milliseconds.
218 * @return A @c long value indicating the maximum recording time in milliseconds @n
219 * else @c -1 if the recording has not started as yet
220 * @see SetMaxRecordingTime()
222 long GetMaxRecordingTime(void) const;
225 * Sets the codec for the recorder. @n
226 * Initially, the default codec from the internal configuration is set.
228 * @return An error code
229 * @param[in] codec The codec name @n
230 * It should be one of the strings listed by GetSupportedCodecListN(). @n
231 * GetSupportedCodecListN() returns the list of strings in the following formats: @n
232 * - "VIDEO_CODEC_H263" @n
233 * - "VIDEO_CODEC_MPEG4SP" @n
234 * The returned strings are different depending on each device. @n
235 * The following string is always operated upon. This value is different
236 * for each device. @n
237 * "VIDEO_CODEC_DEFAULT": the default codec
238 * @exception E_SUCCESS The method is successful.
239 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
240 * @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
241 * @exception E_SYSTEM A system error has occurred.
242 * @exception E_OUT_OF_MEMORY The memory is insufficient.
243 * @see GetCodec(), GetSupportedCodecListN()
245 result SetCodec(const Tizen::Base::String& codec);
248 * Gets the codec for the recorder.
250 * @return The current codec
251 * @see SetCodec(), GetSupportedCodecListN()
253 Tizen::Base::String GetCodec(void) const;
256 * Gets the list of supported video recorder codecs. @n
257 * Each item in the list is a Tizen::Base::String value.
259 * @return The list of strings that represents the supported video recorder codecs, @n
260 * else @c null if no codec is supported or if an exception occurs
261 * @exception E_SUCCESS The method is successful.
262 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
263 * @exception E_SYSTEM A system error has occurred.
264 * @exception E_OUT_OF_MEMORY The memory is insufficient.
265 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
266 * The return value must be released by the caller. @n
267 * All items in the list must be released by the caller.
268 * @see SetCodec(), GetCodec()
270 Tizen::Base::Collection::IList* GetSupportedCodecListN(void) const;
273 * Gets the list of supported audio codecs. @n
274 * Each item in the list has a ::CodecType value.
276 * @return A list of supported audio codecs, @n
277 * else @c null if no codec is supported or if an exception occurs
278 * @exception E_SUCCESS The method is successful.
279 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
280 * @exception E_SYSTEM A system error has occurred.
281 * @exception E_OUT_OF_MEMORY The memory is insufficient.
282 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
283 * The return value must be released by the caller.
284 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container ),
285 * GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
287 Tizen::Base::Collection::ArrayListT <CodecType>* GetSupportedAudioCodecListN(void) const;
290 * Gets the list of supported video codecs. @n
291 * Each item in the list has a ::CodecType value.
293 * @return A list of supported video codecs, @n
294 * else @c null if no codec is supported or if an exception occurs
295 * @exception E_SUCCESS The method is successful.
296 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
297 * @exception E_SYSTEM A system error has occurred.
298 * @exception E_OUT_OF_MEMORY The memory is insufficient.
299 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
300 * The return value must be released by the caller.
301 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container ), GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
303 Tizen::Base::Collection::ArrayListT <CodecType>* GetSupportedVideoCodecListN(void) const;
306 * Gets the list of supported containers. @n
307 * Each item in the list has a ::MediaContainerType value.
309 * @return A list of supported containers, @n
310 * else @c null if no container is supported or if an exception occurs
311 * @exception E_SUCCESS The method is successful.
312 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
313 * @exception E_SYSTEM A system error has occurred.
314 * @exception E_OUT_OF_MEMORY The memory is insufficient.
315 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
316 * The return value must be released by the caller.
317 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container ),
318 * GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
320 Tizen::Base::Collection::ArrayListT <MediaContainerType>* GetSupportedContainerListN(void) const;
323 * Sets the video format of the recorder. @n
324 * Initially, the default format from internal configuration is set.
326 * @return An error code
327 * @param[in] format The video format @n
328 * ::VIDEORECORDING_FORMAT_DEFAULT sets the system's default recording format.
329 * @exception E_SUCCESS The method is successful.
330 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
331 * @exception E_UNSUPPORTED_FORMAT The specified format is not supported.
332 * @exception E_OUT_OF_MEMORY The memory is insufficient.
335 result SetFormat(VideoRecordingFormat format);
338 * Gets the current format that has been set for the recorder.
340 * @return The current video format, @n
341 * else the default format if SetFormat() is not called before this method
344 VideoRecordingFormat GetFormat(void) const;
347 * Sets the mode of the recorder.
349 * @return An error code
350 * @param[in] mode The mode for the recording @n
351 * The default mode is ::VIDEORECORDER_MODE_VIDEO_WITH_AUDIO.
352 * @exception E_SUCCESS The method is successful.
353 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
354 * @exception E_INVALID_ARG The specified @c mode is not supported.
355 * @exception E_OUT_OF_MEMORY The memory is insufficient.
358 result SetMode(VideoRecorderMode mode);
361 * Gets the mode of the recorder.
363 * @return The current mode
366 VideoRecorderMode GetMode(void) const;
369 * Sets the audio and video codecs, and the container of the recorder. @n
370 * Initially, the default codec and container format are set with the internal configuration.
372 * @return An error code
373 * @param[in] audioCodec The audio codec to set @n
374 * ::CODEC_NONE makes the audio stream empty.
375 * @param[in] videoCodec The video codec to set @n
376 * ::CODEC_NONE cannot be set.
377 * @param[in] container The media container to set
378 * @exception E_SUCCESS The method is successful.
379 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
380 * @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
381 * @exception E_UNSUPPORTED_FORMAT The specified container format is not supported.
382 * @exception E_SYSTEM A system error has occurred.
383 * @exception E_OUT_OF_MEMORY The memory is insufficient.
384 * @remarks If the audio codec is ::CODEC_NONE, the audio will be ignored, and only the video stream will be recorded. @n
385 * If the specified container does not support the specified codec, E_UNSUPPORTED_FORMAT may be thrown.
386 * @see GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
388 result SetFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
391 * Gets the audio and video codecs, and the container of the recorder.
393 * @return An error code
394 * @param[out] audioCodec The retrieved audio codec
395 * @param[out] videoCodec The retrieved video codec
396 * @param[out] container The retrieved container
397 * @remarks The default codecs and container are retrieved, if SetFormat( CodecType audioCodec, CodecType
398 * videoCodec, MediaContainerType container) is not called before calling this method.
399 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container )
401 void GetFormat(CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container) const;
404 * Sets the quality of the recorder.
406 * @return An error code
407 * @param[in] quality The quality of the recorder @n
408 * The default quality is ::RECORDING_QUALITY_MEDIUM.
409 * @exception E_SUCCESS The method is successful.
410 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
411 * @exception E_INVALID_ARG The specified @c quality is not supported.
412 * @exception E_OUT_OF_MEMORY The memory is insufficient.
415 result SetQuality(RecordingQuality quality);
418 * Gets the quality of the recorder.
420 * @return The current quality
423 RecordingQuality GetQuality(void) const;
426 * Sets the recording resolution of the recorder. @n
427 * Initially, the default resolution from the internal configuration is set.
429 * @return An error code
430 * @param[in] resolution The recording resolution @n
431 * It should be one of the listed strings extracted from
432 * GetSupportedRecordingResolutionListN().
433 * @exception E_SUCCESS The method is successful.
434 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
435 * @exception E_OUT_OF_RANGE The specified resolution is out of range.
436 * @exception E_SYSTEM A system error has occurred.
437 * @exception E_OUT_OF_MEMORY The memory is insufficient.
438 * of this recording resolution.
439 * @see GetRecordingResolution(), GetSupportedRecordingResolutionListN()
441 result SetRecordingResolution(const Tizen::Graphics::Dimension& resolution);
444 * Gets the recording resolution.
446 * @return The recording resolution
447 * @see SetRecordingResolution(), GetSupportedRecordingResolutionListN()
449 Tizen::Graphics::Dimension GetRecordingResolution(void) const;
452 * Gets a list of the supported video recorder resolutions. @n
453 * Each list item is a Tizen::Graphics::Dimension value.
455 * @return A list of strings representing the supported video recorder resolutions, @n
456 * else an empty list if no recording resolution is supported or if an exception occurs
457 * @exception E_SUCCESS The method is successful.
458 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
459 * @exception E_SYSTEM A system error has occurred.
460 * @exception E_OUT_OF_MEMORY The memory is insufficient.
461 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
462 * The return value must be released by the calling method. @n
463 * All items in the list must be released by the calling method. @n
464 * This method works after the input media source is initialized (for example, Camera::PowerOn()).
465 * @see SetRecordingResolution(), GetRecordingResolution()
467 Tizen::Base::Collection::IList* GetSupportedRecordingResolutionListN(void) const;
470 * Gets the maximum supported frame rate of the input resolution.
472 * @return The maximum frame rate of the input recording resolution
473 * @param[in] dim The preview resolution of the Camera
474 * @exception E_SUCCESS The method is successful.
475 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
476 * @exception E_INVALID_ARG The specified input resolution is invalid.
477 * @exception E_SYSTEM A system error has occurred.
478 * @remark The specific error code can be accessed using the GetLastResult method. @n
479 * This method works after the input media source is initialized (for example: Camera::PowerOn()).
480 * @see Camera::SetPreviewFrameRate()
482 int GetSupportedMaxFrameRate(const Tizen::Graphics::Dimension& dim) const;
485 * Enables or disables the mute state of a recorder.
487 * @return An error code
488 * @param[in] mute Set to @c true to enable the mute state of the recorder, @n
490 * By default, the mute state is disabled.
491 * @exception E_SUCCESS The method is successful.
492 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
493 * @exception E_OUT_OF_MEMORY The memory is insufficient.
494 * @remarks The recording continues even in the mute state.
497 result SetMute(bool mute);
500 * Checks whether the mute state of the recorder is enabled.
502 * @return The mute state of the recorder
505 bool IsMuted(void) const;
508 * Sets the rotation of the recorder.
510 * @return An error code
511 * @param[in] rotation The rotation of the recorder
512 * @exception E_SUCCESS The method is successful.
513 * @exception E_INVALID_STATE This method is invalid for the current state of this instance.
514 * @exception E_INVALID_ARG The specified @c rotation is not supported.
515 * @exception E_OUT_OF_MEMORY The memory is insufficient.
516 * @remarks Before recording a video, the rotate information is tagged to the recording file. @n
517 * Using this information, a video player shows the video correctly regardless of the device orientation.
518 * @see GetRecordingRotation()
520 result SetRecordingRotation(RecordingRotation rotation);
523 * Gets the rotation of the recorder.
525 * @return The current rotation
526 * @see SetRecordingRotation()
528 RecordingRotation GetRecordingRotation(void) const;
531 * Called when the mode is prepared to change.
533 * @return An error code
534 * @param[in] mode recorder mode
536 result OnCameraCoordinatorModeChangePrepared(_CameraMode mode);
539 * Called when the mode is changed.
541 * @return An error code
542 * @param[in] mode recorder mode
544 result OnCameraCoordinatorModeChanged(_CameraMode mode);
547 * Called when the other module is removed
549 * @return An error code
551 result OnCameraCoordinatorOtherRemoved(void);
556 * @param[in] state new _VideoRecorder's state
558 void SetState(RecorderState state);
561 * Sets the recording time
563 * @param[in] recTime recording time in milliseconds
565 void SetRecordingTime(long recTime);
568 * Sets the recording size
570 * @param[in] recSize recording size in bytes
572 void SetRecordingSize(long recSize);
575 * Gets the device type
577 * @return The current device type
579 _RecorderDeviceType GetDeviceType(void) const;
582 * Called when the event is received from the %_ICameraCoordinatorListener object.
585 * @param[in] previous Previous recorder state
586 * @param[in] current Current recorder state
587 * @param[in] byPolicy true if the state is changed by policy, otherewise false
588 * @param[in] pUserData User data
590 static void StateChangedCb(recorder_state_e previous, recorder_state_e current, bool byPolicy, void* pUserData);
593 * Recording Status callback function
595 * @param[in] elapsedTime recording time elapsed
596 * @param[in] fileSize size of file written
597 * @param[in] pUserData User data
599 static void RecordingStatusCb(unsigned long long elapsedTime, unsigned long long fileSize, void *pUserData);
602 * Audio stream callback function
604 * @param[in] pStream Stream data
605 * @param[in] format Sample format
606 * @param[in] channel Sample channel
607 * @param[in] timeStampl The time stamp
608 * @param[in] pUserData User data
610 static void AudioStreamCb(void* pStream, int size, audio_sample_type_e format, int channel, unsigned int timeStamp, void *pUserData);
613 * Limit reached callback function
615 * @param[in] type Limit reached reason
616 * @param[in] pUserData User data
618 static void LimitReachedCb(recorder_recording_limit_type_e type, void *pUserData);
621 * Message callback function
623 * @param[in] error Error reason
624 * @param[in] state Error state
625 * @param[in] pUserData User data
627 static void ErrorCb(recorder_error_e error, recorder_state_e state, void *pUserData);
630 * Message callback function
632 * @param[in] policy The policy which occurs the interruption
633 * @param[in] previous Previous recorder state
634 * @param[in] current Current recorder state
635 * @param[in] pUserData User data
637 static void InterruptedCb(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *pUserData);
640 * Function check fo this object is alive.
642 * @return true if the object is alive, otherwise false.
644 static bool IsAlive(void);
647 * Gets the Impl instance.
649 * @return The pointer to %_VideoRecorderImpl
650 * @param[in] pVideoRecorder The %VideoRecorder pointer
652 static _VideoRecorderImpl* GetInstance(VideoRecorder *pVideoRecorder);
655 * Gets the Impl instance.
657 * @return The pointer to %_VideoRecorderImpl
658 * @param[in] pVideoRecorder The %VideoRecorder pointer
660 static const _VideoRecorderImpl* GetInstance(const VideoRecorder *pVideoRecorder);
663 * Adds the stream filter to process the audio stream data while recording.
665 * @return An error code
666 * @param[in] filter An instance of IAudioStreamFilter
667 * @exception E_SUCCESS The method is successful.
668 * @exception E_OBJ_ALREADY_EXIST The filter already exists.
669 * @exception E_OUT_OF_MEMORY The memory is insufficient.
671 result AddAudioStreamFilter(IAudioStreamFilter& filter);
674 * Removes the stream filter to stop processing the audio stream data.
676 * @return An error code
677 * @param[in] filter An instance of IAudioStreamFilter
678 * @exception E_SUCCESS The method is successful.
679 * @exception E_OBJ_NOT_FOUND The filter is not found.
681 result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
685 * Converts the error from recorder to Result.
687 * @return An error code
688 * @param[in] err recorder error
690 result ConvertResult(int err) const;
693 * Converts codecType to String
696 * @param[in] codecType video codec type
697 * @param[out] codec Codec in string format
699 void GetCodecString(const CodecType videoCodec, Tizen::Base::String& codec) const;
702 * Transfer the state.
704 * @return An error code
705 * @param[in] mmState recorder's destinationed state
706 * @param[in] reason state change reason
707 * @remarks This method makes the recorder's state change. @n
708 * Sometimes, acccording to this, Recorder's state is changed.
710 result ChangeStateTo(recorder_state_e mmDestState, _RecorderStateChangeReason reason);
713 * Checks the operation is for completing.
715 * @return The state change reason
716 * @remarks If the Cancel() is called, this value is false, because the Record() is not completed.
718 _RecorderStateChangeReason GetStateChangeReason(void) const;
721 * Gets the recorder's state.
726 recorder_state_e GetMmState(void) const;
729 * Get the event processing object.
731 * @return The event processing object.
732 * @remarks This event is working synchronously.
734 _VideoRecorderEvent* GetEvent(void) const;
737 * Converts String to codecType
740 * @param[in] codec Codec in string format
741 * @param[out] audioCodec Audio codec type
742 * @param[out] videoCodec Video codec type
743 * @param[out]container Container type
745 void GetMediaType(const Base::String& codec, CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container) const;
748 * Gets the new media type from the old type.
750 * @param[in] format recording type
751 * @param[out] audioCodec audiocodec type matching the input format
752 * @param[out] videoCodec videocodec type matching the input format
753 * @param[out] container container type matching the input format
756 void GetMediaType(VideoRecordingFormat format, CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container) const;
759 * Re-load configuration.
761 * @return An error code
762 * @param[in] reload reload configuration field
763 * @exception E_SUCCESS The method is successful.
764 * @exception E_SYSTEM A system error has occurred.
765 * @remarks Multiple configuration field can be set using reloadConf parameter appending.
767 result ReloadConfiguration(int reload);
770 * Load default configuration.
772 * @return An error code
773 * @param[in] reload reload configuration field
774 * @exception E_SUCCESS The method is successful.
775 * @exception E_SYSTEM A system error has occurred.
777 result LoadDefaultConfiguration(int reload);
780 * Sets the format of the recorder.
782 * @return An error code
783 * @param[in] audioCodec The audioCodec of the recorder
784 * @param[in] videoCodec The videoCodec of the recorder
785 * @param[in] container The container of the recorder
786 * @exception E_SUCCESS The method is successful.
787 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
788 * @exception E_INVALID_ARG The specified @c quality is not supported.
789 * @exception E_OUT_OF_MEMORY The memory is insufficient.
792 result SetFormatAttr(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
795 * Sets the quality of the recorder.
797 * @return An error code
798 * @param[in] quality The quality of the recorder
799 * @param[in] audioCodec The audioCodec of the recorder
800 * @param[in] videoCodec The videoCodec of the recorder
801 * @exception E_SUCCESS The method is successful.
802 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
803 * @exception E_INVALID_ARG The specified @c quality is not supported.
804 * @exception E_OUT_OF_MEMORY The memory is insufficient.
807 result SetQualityAttr(RecordingQuality quality, CodecType audioCodec, CodecType videoCodec);
810 * Enables or disables the mute state of a recorder.
812 * @return An error code
813 * @param[in] mute Set to @c true to enable the mute state of the recorder, @n
815 * By default, the mute state is disabled.
816 * @exception E_SUCCESS The method is successful.
817 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
818 * @exception E_OUT_OF_MEMORY The memory is insufficient.
819 * @remarks The recording continues even in the mute state.
822 result SetMuteAttr(bool mute);
825 * Gets the time limit of the recording in milliseconds.
827 * @return A @c long value indicating the maximum recording time in milliseconds @n
828 * else @c -1 if the recording has not started as yet
829 * @exception E_SUCCESS The method is successful.
830 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
831 * @exception E_OUT_OF_MEMORY The memory is insufficient.
832 * @remarks The specific error code can be accessed using the GetLastResult() method.
833 * @see SetMaxRecordingTime()
835 result SetMaxRecordingTimeAttr(long msTime);
838 * Sets the orientation of the recorder.
840 * @return An error code
841 * @param[in] rotation The rotation of the recorder
842 * @exception E_SUCCESS The method is successful.
843 * @exception E_INVALID_STATE This method is invalid for the current state of this instance.
844 * @exception E_INVALID_ARG The specified @c rotation is not supported.
846 result SetRecordingOrientationAttr(RecordingRotation rotation);
849 * Sets the callback of the recorder.
851 * @return An error code
852 * @exception E_SUCCESS The method is successful.
853 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
854 * @exception E_INVALID_ARG The specified @c quality is not supported.
855 * @exception E_OUT_OF_MEMORY The memory is insufficient.
856 * @see ReloadConfiguration()
858 result SetCallback(void);
860 _VideoRecorderImpl(const _VideoRecorderImpl& _VideoRecorderImpl);
861 _VideoRecorderImpl& operator =(const _VideoRecorderImpl& _VideoRecorderImpl);
863 _CameraCoordinator* __pCoordinator;
864 std::unique_ptr <_VideoRecorderEvent> __pVideoRecorderEvent;
865 IVideoRecorderEventListener* __pVideoRecorderEventListener;
866 std::unique_ptr <_VideoSourceAdapter> __pVideoSourceAdapter;
867 bool __isConstructed;
868 RecorderState __state;
872 VideoRecordingFormat __format;
873 CodecType __audioCodec;
874 CodecType __videoCodec;
875 MediaContainerType __container;
876 VideoRecorderMode __mode;
877 RecordingQuality __quality;
879 RecordingRotation __rotation;
880 _RecorderHandle __handle;
881 _RecorderDeviceType __deviceType;
882 Tizen::Graphics::Dimension __recordingResolution;
883 camera_pixel_format_e __mmSourceFormat;
884 Tizen::Base::String __filePath;
885 _RecorderStateChangeReason __stateChangeReason;
886 static bool __isUsed;
887 std::unique_ptr <_AudioStreamCoordinator> __pAudioStreamCoordinator;
888 int __audioStreamTimeDuration;
889 bool __audioStreamCallback;