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;
45 class _VideoRecorderEvent;
46 class _VideoSourceAdapter;
49 * @class _VideoRecorderImpl
50 * @brief This class records a video.
52 class _VideoRecorderImpl
53 : public Tizen::Base::Object
54 , public _ICameraCoordinatorListener
58 * This is the default constructor for this class.
60 * @remarks The object is not fully constructed after this constructor is called. For full construction,
61 * the Construct() method must be called right after calling this constructor.
64 _VideoRecorderImpl(void);
67 * This is the destructor for this class. @n
68 * All allocated resources are deallocated by this method. This method should be called in the same thread in
69 * which the Construct() method is called. This polymorphic destructor should be overridden if required.
70 * This way, the destructors of the derived classes are called when the destructor of this interface is called.
74 virtual ~_VideoRecorderImpl(void);
77 * Initializes this instance of _VideoRecorderImpl with an associated listener and an input source.
79 * @return An error code
80 * @param[in] listener An event listener object
81 * @param[in] camera A Camera object for the input source
82 * @exception E_SUCCESS The method is successful.
83 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
84 * @exception E_SYSTEM A system error has occurred.
85 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
87 result Construct(IVideoRecorderEventListener& listener, const Camera& camera);
90 * Creates a video file for a recording.
92 * @return An error code
93 * @param[in] destMediaPath The destination for the file be written @n
94 * The available paths start with prefixes retrieved from the functions such as: @n
95 * Tizen::App::App::GetInstance()->GetAppRootPath() @n
96 * Tizen::System::Environment::GetMediaPath() @n
97 * Tizen::System::Environment::GetExternalStoragePath()
98 * @param[in] overwrite Set to @c true to overwrite the file, @n
100 * @exception E_SUCCESS The method is successful.
101 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
102 * @exception E_RESOURCE_UNAVAILABLE The required file path is unavailable.
103 * @exception E_FILE_ALREADY_EXIST The specified file already exists.
104 * @exception E_STORAGE_FULL The storage is full.
105 * @exception E_OUT_OF_MEMORY The memory is insufficient.
108 result CreateVideoFile(const Tizen::Base::String& destMediaPath, bool overwrite);
111 * Closes the video file. @n
112 * This is a synchronous method.
114 * @return An error code
115 * @exception E_SUCCESS The method is successful.
116 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
117 * @exception E_SYSTEM A system error has occurred.
118 * @exception E_OUT_OF_MEMORY The memory is insufficient.
119 * @see CreateVideoFile()
124 * Starts the recording. @n
125 * Resumes the recording if Pause() has been called.
127 * @return An error code
128 * @exception E_SUCCESS The method is successful.
129 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
130 * @exception E_SYSTEM A system error has occurred.
131 * @exception E_DEVICE_BUSY The device cannot be approached because of other operations.
132 * @exception E_OUT_OF_MEMORY The memory is insufficient.
133 * @remarks This method must be called after the input media source is started (for example, Camera::StartPreview()).
134 * @see Stop(), Pause()
139 * Stops the recording.
141 * @return An error code
142 * @exception E_SUCCESS The method is successful.
143 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
144 * @exception E_SYSTEM A system error has occurred.
145 * @exception E_OUT_OF_MEMORY The memory is insufficient.
146 * @see Record(), Pause()
151 * Pauses the recording. @n
152 * To resume the recording after this method is called, Record() must be called.
154 * @return An error code
155 * @exception E_SUCCESS The method is successful.
156 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
157 * @exception E_SYSTEM A system error has occurred.
158 * @exception E_OUT_OF_MEMORY The memory is insufficient.
159 * @see Stop(), Record()
164 * Cancels the recording operation without saving the data.
166 * @return An error code
167 * @exception E_SUCCESS The method is successful.
168 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
169 * @exception E_SYSTEM A system error has occurred.
170 * @exception E_OUT_OF_MEMORY The memory is insufficient.
171 * @remarks When this method is called, the state is changed to ::RECORDER_STATE_STOPPING. @n
172 * After IVideoRecorderEventListener::OnVideoRecorderCanceled is called, the state is changed to
173 * ::RECORDER_STATE_STOPPED.
174 * @see Record(), Stop()
179 * Gets the state of a recorder.
181 * @see CreateVideoFile(), Close(), Record(), Stop(), Pause(), RecorderState()
183 RecorderState GetState(void) const;
186 * Gets the current recording time.
188 * @return The current recording time in milliseconds, @n
189 * else @c -1 if the recording has not started as yet
191 long GetRecordingTime(void) const;
194 * Gets the current recording size.
196 * @return A @c long value indicating the current recording size in bytes, @n
197 * else @c -1 if the recording has not started as yet
199 long GetRecordingSize(void) const;
202 * Sets the time limit for the recording in milliseconds.
204 * @return An error code
205 * @param[in] msTime The maximum recording time in milliseconds @n
206 * The time must be greater than @c 0.
207 * @exception E_SUCCESS The method is successful.
208 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
209 * @exception E_OUT_OF_RANGE The specified time is out of range.
210 * @exception E_OUT_OF_MEMORY The memory is insufficient.
211 * @remarks The default time is @c 60 seconds.
212 * @see GetMaxRecordingTime()
214 result SetMaxRecordingTime(long msTime);
217 * Gets the time limit of the recording in milliseconds.
219 * @return A @c long value indicating the maximum recording time in milliseconds @n
220 * else @c -1 if the recording has not started as yet
221 * @see SetMaxRecordingTime()
223 long GetMaxRecordingTime(void) const;
226 * Sets the codec for the recorder. @n
227 * Initially, the default codec from the internal configuration is set.
229 * @return An error code
230 * @param[in] codec The codec name @n
231 * It should be one of the strings listed by GetSupportedCodecListN(). @n
232 * GetSupportedCodecListN() returns the list of strings in the following formats: @n
233 * - "VIDEO_CODEC_H263" @n
234 * - "VIDEO_CODEC_MPEG4SP" @n
235 * The returned strings are different depending on each device. @n
236 * The following string is always operated upon. This value is different
237 * for each device. @n
238 * "VIDEO_CODEC_DEFAULT": the default codec
239 * @exception E_SUCCESS The method is successful.
240 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
241 * @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
242 * @exception E_SYSTEM A system error has occurred.
243 * @exception E_OUT_OF_MEMORY The memory is insufficient.
244 * @see GetCodec(), GetSupportedCodecListN()
246 result SetCodec(const Tizen::Base::String& codec);
249 * Gets the codec for the recorder.
251 * @return The current codec
252 * @see SetCodec(), GetSupportedCodecListN()
254 Tizen::Base::String GetCodec(void) const;
257 * Gets the list of supported video recorder codecs. @n
258 * Each item in the list is a Tizen::Base::String value.
260 * @return The list of strings that represents the supported video recorder codecs, @n
261 * else @c null if no codec is supported or if an exception occurs
262 * @exception E_SUCCESS The method is successful.
263 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
264 * @exception E_SYSTEM A system error has occurred.
265 * @exception E_OUT_OF_MEMORY The memory is insufficient.
266 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
267 * The return value must be released by the caller. @n
268 * All items in the list must be released by the caller.
269 * @see SetCodec(), GetCodec()
271 Tizen::Base::Collection::IList* GetSupportedCodecListN(void) const;
274 * Gets the list of supported audio codecs. @n
275 * Each item in the list has a ::CodecType value.
277 * @return A list of supported audio codecs, @n
278 * else @c null if no codec is supported or if an exception occurs
279 * @exception E_SUCCESS The method is successful.
280 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
281 * @exception E_SYSTEM A system error has occurred.
282 * @exception E_OUT_OF_MEMORY The memory is insufficient.
283 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
284 * The return value must be released by the caller.
285 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container ),
286 * GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
288 Tizen::Base::Collection::ArrayListT <CodecType>* GetSupportedAudioCodecListN(void) const;
291 * Gets the list of supported video codecs. @n
292 * Each item in the list has a ::CodecType value.
294 * @return A list of supported video codecs, @n
295 * else @c null if no codec is supported or if an exception occurs
296 * @exception E_SUCCESS The method is successful.
297 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
298 * @exception E_SYSTEM A system error has occurred.
299 * @exception E_OUT_OF_MEMORY The memory is insufficient.
300 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
301 * The return value must be released by the caller.
302 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container ), GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
304 Tizen::Base::Collection::ArrayListT <CodecType>* GetSupportedVideoCodecListN(void) const;
307 * Gets the list of supported containers. @n
308 * Each item in the list has a ::MediaContainerType value.
310 * @return A list of supported containers, @n
311 * else @c null if no container is supported or if an exception occurs
312 * @exception E_SUCCESS The method is successful.
313 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
314 * @exception E_SYSTEM A system error has occurred.
315 * @exception E_OUT_OF_MEMORY The memory is insufficient.
316 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
317 * The return value must be released by the caller.
318 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container ),
319 * GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
321 Tizen::Base::Collection::ArrayListT <MediaContainerType>* GetSupportedContainerListN(void) const;
324 * Sets the video format of the recorder. @n
325 * Initially, the default format from internal configuration is set.
327 * @return An error code
328 * @param[in] format The video format @n
329 * ::VIDEORECORDING_FORMAT_DEFAULT sets the system's default recording format.
330 * @exception E_SUCCESS The method is successful.
331 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
332 * @exception E_UNSUPPORTED_FORMAT The specified format is not supported.
333 * @exception E_OUT_OF_MEMORY The memory is insufficient.
336 result SetFormat(VideoRecordingFormat format);
339 * Gets the current format that has been set for the recorder.
341 * @return The current video format, @n
342 * else the default format if SetFormat() is not called before this method
345 VideoRecordingFormat GetFormat(void) const;
348 * Sets the mode of the recorder.
350 * @return An error code
351 * @param[in] mode The mode for the recording @n
352 * The default mode is ::VIDEORECORDER_MODE_VIDEO_WITH_AUDIO.
353 * @exception E_SUCCESS The method is successful.
354 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
355 * @exception E_INVALID_ARG The specified @c mode is not supported.
356 * @exception E_OUT_OF_MEMORY The memory is insufficient.
359 result SetMode(VideoRecorderMode mode);
362 * Gets the mode of the recorder.
364 * @return The current mode
367 VideoRecorderMode GetMode(void) const;
370 * Sets the audio and video codecs, and the container of the recorder. @n
371 * Initially, the default codec and container format are set with the internal configuration.
373 * @return An error code
374 * @param[in] audioCodec The audio codec to set @n
375 * ::CODEC_NONE makes the audio stream empty.
376 * @param[in] videoCodec The video codec to set @n
377 * ::CODEC_NONE cannot be set.
378 * @param[in] container The media container to set
379 * @exception E_SUCCESS The method is successful.
380 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
381 * @exception E_UNSUPPORTED_CODEC The specified codec is not supported.
382 * @exception E_UNSUPPORTED_FORMAT The specified container format is not supported.
383 * @exception E_SYSTEM A system error has occurred.
384 * @exception E_OUT_OF_MEMORY The memory is insufficient.
385 * @remarks If the audio codec is ::CODEC_NONE, the audio will be ignored, and only the video stream will be recorded. @n
386 * If the specified container does not support the specified codec, E_UNSUPPORTED_FORMAT may be thrown.
387 * @see GetFormat( CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container ) const
389 result SetFormat(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
392 * Gets the audio and video codecs, and the container of the recorder.
394 * @return An error code
395 * @param[out] audioCodec The retrieved audio codec
396 * @param[out] videoCodec The retrieved video codec
397 * @param[out] container The retrieved container
398 * @remarks The default codecs and container are retrieved, if SetFormat( CodecType audioCodec, CodecType
399 * videoCodec, MediaContainerType container) is not called before calling this method.
400 * @see SetFormat( CodecType audioCodec, CodecType videoCodec, MediaContainerType container )
402 void GetFormat(CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container) const;
405 * Sets the quality of the recorder.
407 * @return An error code
408 * @param[in] quality The quality of the recorder @n
409 * The default quality is ::RECORDING_QUALITY_MEDIUM.
410 * @exception E_SUCCESS The method is successful.
411 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
412 * @exception E_INVALID_ARG The specified @c quality is not supported.
413 * @exception E_OUT_OF_MEMORY The memory is insufficient.
416 result SetQuality(RecordingQuality quality);
419 * Gets the quality of the recorder.
421 * @return The current quality
424 RecordingQuality GetQuality(void) const;
427 * Sets the recording resolution of the recorder. @n
428 * Initially, the default resolution from the internal configuration is set.
430 * @return An error code
431 * @param[in] resolution The recording resolution @n
432 * It should be one of the listed strings extracted from
433 * GetSupportedRecordingResolutionListN().
434 * @exception E_SUCCESS The method is successful.
435 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
436 * @exception E_OUT_OF_RANGE The specified resolution is out of range.
437 * @exception E_SYSTEM A system error has occurred.
438 * @exception E_OUT_OF_MEMORY The memory is insufficient.
439 * of this recording resolution.
440 * @see GetRecordingResolution(), GetSupportedRecordingResolutionListN()
442 result SetRecordingResolution(const Tizen::Graphics::Dimension& resolution);
445 * Gets the recording resolution.
447 * @return The recording resolution
448 * @see SetRecordingResolution(), GetSupportedRecordingResolutionListN()
450 Tizen::Graphics::Dimension GetRecordingResolution(void) const;
453 * Gets a list of the supported video recorder resolutions. @n
454 * Each list item is a Tizen::Graphics::Dimension value.
456 * @return A list of strings representing the supported video recorder resolutions, @n
457 * else an empty list if no recording resolution is supported or if an exception occurs
458 * @exception E_SUCCESS The method is successful.
459 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
460 * @exception E_SYSTEM A system error has occurred.
461 * @exception E_OUT_OF_MEMORY The memory is insufficient.
462 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
463 * The return value must be released by the calling method. @n
464 * All items in the list must be released by the calling method. @n
465 * This method works after the input media source is initialized (for example, Camera::PowerOn()).
466 * @see SetRecordingResolution(), GetRecordingResolution()
468 Tizen::Base::Collection::IList* GetSupportedRecordingResolutionListN(void) const;
471 * Gets the maximum supported frame rate of the input resolution.
473 * @return The maximum frame rate of the input recording resolution
474 * @param[in] dim The preview resolution of the Camera
475 * @exception E_SUCCESS The method is successful.
476 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
477 * @exception E_INVALID_ARG The specified input resolution is invalid.
478 * @exception E_SYSTEM A system error has occurred.
479 * @remark The specific error code can be accessed using the GetLastResult method. @n
480 * This method works after the input media source is initialized (for example: Camera::PowerOn()).
481 * @see Camera::SetPreviewFrameRate()
483 int GetSupportedMaxFrameRate(const Tizen::Graphics::Dimension& dim) const;
486 * Enables or disables the mute state of a recorder.
488 * @return An error code
489 * @param[in] mute Set to @c true to enable the mute state of the recorder, @n
491 * By default, the mute state is disabled.
492 * @exception E_SUCCESS The method is successful.
493 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
494 * @exception E_OUT_OF_MEMORY The memory is insufficient.
495 * @remarks The recording continues even in the mute state.
498 result SetMute(bool mute);
501 * Checks whether the mute state of the recorder is enabled.
503 * @return The mute state of the recorder
506 bool IsMuted(void) const;
509 * Sets the rotation of the recorder.
511 * @return An error code
512 * @param[in] rotation The rotation of the recorder
513 * @exception E_SUCCESS The method is successful.
514 * @exception E_INVALID_STATE This method is invalid for the current state of this instance.
515 * @exception E_INVALID_ARG The specified @c rotation is not supported.
516 * @exception E_OUT_OF_MEMORY The memory is insufficient.
517 * @remarks Before recording a video, the rotate information is tagged to the recording file. @n
518 * Using this information, a video player shows the video correctly regardless of the device orientation.
519 * @see GetRecordingRotation()
521 result SetRecordingRotation(RecordingRotation rotation);
524 * Gets the rotation of the recorder.
526 * @return The current rotation
527 * @see SetRecordingRotation()
529 RecordingRotation GetRecordingRotation(void) const;
532 * Called when the mode is prepared to change.
534 * @return An error code
535 * @param[in] mode recorder mode
537 result OnCameraCoordinatorModeChangePrepared(_CameraMode mode);
540 * Called when the mode is changed.
542 * @return An error code
543 * @param[in] mode recorder mode
545 result OnCameraCoordinatorModeChanged(_CameraMode mode);
548 * Called when the other module is removed
550 * @return An error code
552 result OnCameraCoordinatorOtherRemoved(void);
557 * @param[in] state new _VideoRecorder's state
559 void SetState(RecorderState state);
562 * Sets the recording time
564 * @param[in] recTime recording time in milliseconds
566 void SetRecordingTime(long recTime);
569 * Sets the recording size
571 * @param[in] recSize recording size in bytes
573 void SetRecordingSize(long recSize);
576 * Gets the device type
578 * @return The current device type
580 _RecorderDeviceType GetDeviceType(void) const;
583 * Called when the event is received from the %_ICameraCoordinatorListener object.
586 * @param[in] previous Previous recorder state
587 * @param[in] current Current recorder state
588 * @param[in] byPolicy true if the state is changed by policy, otherewise false
589 * @param[in] pUserData User data
591 static void StateChangedCb(recorder_state_e previous, recorder_state_e current, bool byPolicy, void* pUserData);
594 * Recording Status callback function
596 * @param[in] elapsedTime recording time elapsed
597 * @param[in] fileSize size of file written
598 * @param[in] pUserData User data
600 static void RecordingStatusCb(unsigned long long elapsedTime, unsigned long long fileSize, void *pUserData);
603 * Audio stream callback function
605 * @param[in] pStream Stream data
606 * @param[in] format Sample format
607 * @param[in] channel Sample channel
608 * @param[in] timeStampl The time stamp
609 * @param[in] pUserData User data
611 static void AudioStreamCb(void* pStream, int size, audio_sample_type_e format, int channel, unsigned int timeStamp, void *pUserData);
614 * Limit reached callback function
616 * @param[in] type Limit reached reason
617 * @param[in] pUserData User data
619 static void LimitReachedCb(recorder_recording_limit_type_e type, void *pUserData);
622 * Message callback function
624 * @param[in] error Error reason
625 * @param[in] state Error state
626 * @param[in] pUserData User data
628 static void ErrorCb(recorder_error_e error, recorder_state_e state, void *pUserData);
631 * Message callback function
633 * @param[in] policy The policy which occurs the interruption
634 * @param[in] previous Previous recorder state
635 * @param[in] current Current recorder state
636 * @param[in] pUserData User data
638 static void InterruptedCb(recorder_policy_e policy, recorder_state_e previous, recorder_state_e current, void *pUserData);
641 * Gets the Impl instance.
643 * @return The pointer to %_VideoRecorderImpl
644 * @param[in] pVideoRecorder The %VideoRecorder pointer
646 static _VideoRecorderImpl* GetInstance(VideoRecorder *pVideoRecorder);
649 * Gets the Impl instance.
651 * @return The pointer to %_VideoRecorderImpl
652 * @param[in] pVideoRecorder The %VideoRecorder pointer
654 static const _VideoRecorderImpl* GetInstance(const VideoRecorder *pVideoRecorder);
657 * Adds the stream filter to process the audio stream data while recording.
659 * @return An error code
660 * @param[in] filter An instance of IAudioStreamFilter
661 * @exception E_SUCCESS The method is successful.
662 * @exception E_OBJ_ALREADY_EXIST The filter already exists.
663 * @exception E_OUT_OF_MEMORY The memory is insufficient.
665 result AddAudioStreamFilter(IAudioStreamFilter& filter);
668 * Removes the stream filter to stop processing the audio stream data.
670 * @return An error code
671 * @param[in] filter An instance of IAudioStreamFilter
672 * @exception E_SUCCESS The method is successful.
673 * @exception E_OBJ_NOT_FOUND The filter is not found.
675 result RemoveAudioStreamFilter(IAudioStreamFilter& filter);
679 * Converts the error from recorder to Result.
681 * @return An error code
682 * @param[in] err recorder error
684 result ConvertResult(int err) const;
687 * Converts codecType to String
690 * @param[in] codecType video codec type
691 * @param[out] codec Codec in string format
693 void GetCodecString(const CodecType videoCodec, Tizen::Base::String& codec) const;
696 * Transfer the state.
698 * @return An error code
699 * @param[in] mmState recorder's destinationed state
700 * @param[in] reason state change reason
701 * @remarks This method makes the recorder's state change. @n
702 * Sometimes, acccording to this, Recorder's state is changed.
704 result ChangeStateTo(recorder_state_e mmDestState, _RecorderStateChangeReason reason);
707 * Checks the operation is for completing.
709 * @return The state change reason
710 * @remarks If the Cancel() is called, this value is false, because the Record() is not completed.
712 _RecorderStateChangeReason GetStateChangeReason(void) const;
715 * Gets the recorder's state.
720 recorder_state_e GetMmState(void) const;
723 * Get the event processing object.
725 * @return The event processing object.
726 * @remarks This event is working synchronously.
728 _VideoRecorderEvent* GetEvent(void) const;
731 * Converts String to codecType
734 * @param[in] codec Codec in string format
735 * @param[out] audioCodec Audio codec type
736 * @param[out] videoCodec Video codec type
737 * @param[out]container Container type
739 void GetMediaType(const Base::String& codec, CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container) const;
742 * Gets the new media type from the old type.
744 * @param[in] format recording type
745 * @param[out] audioCodec audiocodec type matching the input format
746 * @param[out] videoCodec videocodec type matching the input format
747 * @param[out] container container type matching the input format
750 void GetMediaType(VideoRecordingFormat format, CodecType& audioCodec, CodecType& videoCodec, MediaContainerType& container) const;
753 * Re-load configuration.
755 * @return An error code
756 * @param[in] reload reload configuration field
757 * @exception E_SUCCESS The method is successful.
758 * @exception E_SYSTEM A system error has occurred.
759 * @remarks Multiple configuration field can be set using reloadConf parameter appending.
761 result ReloadConfiguration(int reload);
764 * Load default configuration.
766 * @return An error code
767 * @param[in] reload reload configuration field
768 * @exception E_SUCCESS The method is successful.
769 * @exception E_SYSTEM A system error has occurred.
771 result LoadDefaultConfiguration(int reload);
774 * Sets the format of the recorder.
776 * @return An error code
777 * @param[in] audioCodec The audioCodec of the recorder
778 * @param[in] videoCodec The videoCodec of the recorder
779 * @param[in] container The container of the recorder
780 * @exception E_SUCCESS The method is successful.
781 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
782 * @exception E_INVALID_ARG The specified @c quality is not supported.
783 * @exception E_OUT_OF_MEMORY The memory is insufficient.
786 result SetFormatAttr(CodecType audioCodec, CodecType videoCodec, MediaContainerType container);
789 * Sets the quality of the recorder.
791 * @return An error code
792 * @param[in] quality The quality of the recorder
793 * @param[in] audioCodec The audioCodec of the recorder
794 * @param[in] videoCodec The videoCodec of the recorder
795 * @exception E_SUCCESS The method is successful.
796 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
797 * @exception E_INVALID_ARG The specified @c quality is not supported.
798 * @exception E_OUT_OF_MEMORY The memory is insufficient.
801 result SetQualityAttr(RecordingQuality quality, CodecType audioCodec, CodecType videoCodec);
804 * Enables or disables the mute state of a recorder.
806 * @return An error code
807 * @param[in] mute Set to @c true to enable the mute state of the recorder, @n
809 * By default, the mute state is disabled.
810 * @exception E_SUCCESS The method is successful.
811 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
812 * @exception E_OUT_OF_MEMORY The memory is insufficient.
813 * @remarks The recording continues even in the mute state.
816 result SetMuteAttr(bool mute);
819 * Gets the time limit of the recording in milliseconds.
821 * @return A @c long value indicating the maximum recording time in milliseconds @n
822 * else @c -1 if the recording has not started as yet
823 * @exception E_SUCCESS The method is successful.
824 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
825 * @exception E_OUT_OF_MEMORY The memory is insufficient.
826 * @remarks The specific error code can be accessed using the GetLastResult() method.
827 * @see SetMaxRecordingTime()
829 result SetMaxRecordingTimeAttr(long msTime);
832 * Sets the orientation of the recorder.
834 * @return An error code
835 * @param[in] rotation The rotation of the recorder
836 * @exception E_SUCCESS The method is successful.
837 * @exception E_INVALID_STATE This method is invalid for the current state of this instance.
838 * @exception E_INVALID_ARG The specified @c rotation is not supported.
840 result SetRecordingOrientationAttr(RecordingRotation rotation);
843 * Sets the callback of the recorder.
845 * @return An error code
846 * @exception E_SUCCESS The method is successful.
847 * @exception E_INVALID_STATE This instance is in an invalid state for this method.
848 * @exception E_INVALID_ARG The specified @c quality is not supported.
849 * @exception E_OUT_OF_MEMORY The memory is insufficient.
850 * @see ReloadConfiguration()
852 result SetCallback(void);
854 _VideoRecorderImpl(const _VideoRecorderImpl& _VideoRecorderImpl);
855 _VideoRecorderImpl& operator =(const _VideoRecorderImpl& _VideoRecorderImpl);
857 _CameraCoordinator* __pCoordinator;
858 std::unique_ptr <_RecorderRef> __pRecorderRef;
859 std::unique_ptr <_VideoRecorderEvent> __pVideoRecorderEvent;
860 IVideoRecorderEventListener* __pVideoRecorderEventListener;
861 std::unique_ptr <_VideoSourceAdapter> __pVideoSourceAdapter;
862 bool __isConstructed;
863 RecorderState __state;
867 VideoRecordingFormat __format;
868 CodecType __audioCodec;
869 CodecType __videoCodec;
870 MediaContainerType __container;
871 VideoRecorderMode __mode;
872 RecordingQuality __quality;
874 RecordingRotation __rotation;
875 _RecorderHandle __handle;
876 _RecorderDeviceType __deviceType;
877 Tizen::Graphics::Dimension __recordingResolution;
878 camera_pixel_format_e __mmSourceFormat;
879 Tizen::Base::String __filePath;
880 _RecorderStateChangeReason __stateChangeReason;
881 std::unique_ptr <_AudioStreamCoordinator> __pAudioStreamCoordinator;
882 int __audioStreamTimeDuration;
883 bool __audioStreamCallback;