1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
16 #ifndef __VIDEORECORDHWDEVICE_H__
17 #define __VIDEORECORDHWDEVICE_H__
19 #include <mmf/devvideo/devvideobase.h>
20 #include <mmf/devvideo/devvideorecord.h>
23 A base class for all video recording (encoding and pre-processing) hardware devices. Since both encoders
24 and pre-processors can implement pre-processing functionality, this class includes all pre-processing
29 class CMMFVideoRecordHwDevice : public CMMFVideoHwDevice
33 Retrieves information about the pre-processing capabilities of this hardware device.
35 @return "Pre-processor information as a CPreProcessorInfo object. The object is pushed to the
36 cleanup stack, and must be deallocated by the client."
37 @leave "The method will leave if an error occurs."
39 virtual CPreProcessorInfo* PreProcessorInfoLC() = 0;
42 Sets the hardware device input format. If both a pre-processor and an encoder are used, the
43 pre-processor output format and the encoder input format must be the same. The input format for
44 the first device in the system is the input format for video input data. The method has to be called
45 for both direct capture as well as memory buffer input.
47 @param "aFormat" "The input format to use."
48 @param "aPictureSize" "The input picture size in pixels."
49 @leave "The method will leave if an error occurs. Typical error codes used:
50 - KErrNotSupported - The input format specified is not supported."
51 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
53 virtual void SetInputFormatL(const TUncompressedVideoFormat& aFormat, const TSize& aPictureSize) = 0;
56 Sets the data source to be a camera, and sets the device to use direct capture for input.
58 @param "aCameraHandle" "A camera handle for the camera to use. The handle is passed
59 to CCamera::NewDuplicateL() in the camera API "
60 @param "aPictureRate" "Video capture picture rate."
61 @leave "The method will leave if an error occurs. Typical error codes used:
62 - KErrNotSupported - Direct capture is not supported or the picture rate specified is not
64 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
66 virtual void SetSourceCameraL(TInt aCameraHandle, TReal aPictureRate) = 0;
69 Sets the data source to be memory buffers.
71 @param "aMaxPictureRate" "The maximum picture rate for input pictures."
72 @param "aConstantPictureRate" "True if the input picture rate is constant. In that case,
73 aMaxPictureRate specifies the picture rate."
74 @param "aProcessRealtime" "True if real-time processing is needed, false if not. Real-time
75 processing is typically neede for video recording applications, while
76 video conversion and off-line processing applications do not require it."
77 @leave "The method will leave if an error occurs. Typical error codes used:
78 - KErrNotSupported - The picture rate specified is not supported."
79 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
81 virtual void SetSourceMemoryL(TReal aMaxPictureRate, TBool aConstantPictureRate, TBool aProcessRealtime) = 0;
84 Sets the clock source to use for video timing. When video recording is synchronized with audio,
85 the clock source is implemented by the audio playback subsystem, otherwise the clock source should
86 get the time from the system clock.
88 If no clock source is set, video recording will not be synchronized, but will proceed as fast as
89 possible, depending on input data and output buffer availability. If direct capturing is used without
90 a clock source, the timestamps in the output data may not be valid.
92 @param "aClock" "The clock source to use."
93 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
95 virtual void SetClockSource(MMMFClockSource* aClock) = 0;
98 Sets pre-processing options for RGB to YUV color space conversion. By default, input RGB data is
99 assumed to use the full value range ([0…255]), and the output YUV format is the hardware device output
100 format, so typically calling this method is not necessary.
102 @param "aRange" "Input RGB data range"
103 @param "aOutputFormat" "Conversion output YUV format."
104 @leave "The method will leave if an error occurs. Typical error codes used:
105 - KErrNotSupported - The formats specified are not supported"
106 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
108 virtual void SetRgbToYuvOptionsL(TRgbRange aRange, const TYuvFormat& aOutputFormat) = 0;
111 Sets pre-processing options for YUV to YUV data format conversion. By default, the hardware device input
112 and output data formats are used. For encoder devices, the device input format and a the closest matching
113 format supported by the encoding process are used. Typically calling this method is not necessary.
115 @param "aInputFormat" "Conversion input format."
116 @param "aOutputFormat" "Conversion output format."
117 @leave "The method will leave if an error occurs. Typical error codes used:
118 - KErrNotSupported - The formats specified are not supported"
119 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
121 virtual void SetYuvToYuvOptionsL(const TYuvFormat& aInputFormat, const TYuvFormat& aOutputFormat) = 0;
124 Sets the pre-processing types to be used.
126 @param "aPreProcessTypes" "The pre-processing steps to perform, a bitwise OR of values from
127 TPrePostProcessType."
128 @leave "The method will leave if an error occurs. Typical error codes used:
129 - KErrNotSupported - The pre-processing combination is not supported"
130 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
131 If called after initialization, the change must only be committed when CommitL() is called."
133 virtual void SetPreProcessTypesL(TUint32 aPreProcessTypes) = 0;
136 Sets pre-processing options for rotation.
138 @param "aRotationType" "The rotation to perform."
139 @leave "The method will leave if an error occurs. Typical error codes used:
140 - KErrNotSupported - The rotation type is not supported."
141 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
142 If called after initialization, the change must only be committed when CommitL() is called."
144 virtual void SetRotateOptionsL(TRotationType aRotationType) = 0;
147 Sets pre-processing options for scaling.
149 @param "aTargetSize" "Target picture size. If a fixed scale factor size is used, the new
150 dimensions must be set to:
151 width=floor(factor*width), height=floor(factor*height).
152 For example, scaling a QCIF (176x144) picture up by a factor of 4/3
153 yields a size of 234x192."
154 @param "aAntiAliasFiltering" "True if anti-aliasing filtering should be used. If the pre-processor
155 does not support anti-aliased scaling, or supports anti-aliased scaling
156 only, this argument is ignored."
157 @leave "The method will leave if an error occurs. Typical error codes used:
158 - KErrNotSupported - The specified target size is not supported."
159 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
160 If called after initialization, the change must only be committed when CommitL() is called."
162 virtual void SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering) = 0;
165 Sets pre-processing options for input cropping. Input cropping is typically used for digital zooming.
167 @param "aRect" "The input cropping rectangle specifying the area of the picture to use. The rectangle
168 must fit completely inside the input picture."
169 @leave "The method will leave if an error occurs. Typical error codes used:
170 - KErrNotSupported - The specified cropping rectangle is not supported."
171 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
172 If called after initialization, the change must only be committed when CommitL() is called."
174 virtual void SetInputCropOptionsL(const TRect& aRect) = 0;
177 Sets pre-processing options for output cropping. Output cropping is performed after other
178 pre-processing operations but before output padding. Output cropping and padding can be used in
179 combination to prepare the picture size to suit the encoder, typically video encoders only support
180 picture sizes that are multiples of 16 pixels.
182 @param "aRect" "The output cropping rectangle specifying the area of the picture to use. The
183 rectangle must fit completely inside the picture."
184 @leave "The method will leave if an error occurs. Typical error codes used:
185 - KErrNotSupported - The specified cropping rectangle is not supported."
186 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
187 If called after initialization, the change must only be committed when CommitL() is called."
189 virtual void SetOutputCropOptionsL(const TRect& aRect) = 0;
192 Sets pre-processing options for output padding. Output padding is performed as the last pre-processing
193 operation, and typically used to prepare the picture size to suit the encoder. The image is padded with
196 @param "aOutputSize" "The padded output picture size. The output size must be large enough for the
197 picture in its new position."
198 @param "aPicturePos" "The position for the original picture in the new padded picture. The original
199 picture in its new position must fit completely inside the new picture."
200 @leave "The method will leave if an error occurs. Typical error codes used:
201 - KErrNotSupported - The specified padding settings are not supported."
202 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
203 If called after initialization, the change must only be committed when CommitL() is called."
205 virtual void SetOutputPadOptionsL(const TSize& aOutputSize, const TPoint& aPicturePos) = 0;
208 Sets color enhancement pre-processing options.
210 @param "aOptions" "Color enchancement options."
211 @leave "The method will leave if an error occurs. Typical error codes used:
212 - KErrNotSupported - The specified settings are not supported."
213 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
214 If called after initialization, the change must only be committed when CommitL() is called."
216 virtual void SetColorEnhancementOptionsL(const TColorEnhancementOptions& aOptions) = 0;
219 Sets frame stabilisation options.
221 @param "aOutputSize" "Output picture size. The output picture size must be smaller than
222 or equal to the hardware device input picture size."
223 @param "aFrameStabilisation" "True if frame stabilisation should be used. By default stabilisation is
225 @leave "The method will leave if an error occurs. Typical error codes used:
226 - KErrNotSupported - The specified settings are not supported."
227 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
228 If called after initialization, the change must only be committed when CommitL() is called."
230 virtual void SetFrameStabilisationOptionsL(const TSize& aOutputSize, TBool aFrameStabilisation) = 0;
233 Sets custom implementation-specific pre-processing options.
235 @param "aOptions" "Post-processing options. The data format is implementation-specific."
236 @leave "The method will leave if an error occurs. Typical error codes used:
237 - KErrNotSupported - The options are not supported."
238 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
239 If called after initialization, the change must only be committed when CommitL() is called."
241 virtual void SetCustomPreProcessOptionsL(const TDesC8& aOptions) = 0;
244 Initializes the device, and reserves hardware resources. If direct capture is used, this method also
245 prepares the camera API for capture by calling PrepareVideoCaptureL(). This method is asynchronous,
246 the device will call MMMFDevVideoRecordProxy::MdvrpInitializeComplete() after initialization has completed.
247 Video capturing and encoding can be started with Start() with a relatively low delay since the hardware
248 has already been set up.
250 Error handling: Errors are reported using the MdvrpInitializeComplete() callback method. Typical error
252 - KErrHardwareNotAvailable - Not enough free video processing hardware resources
253 - KErrNotSupported - The current configuration is not supported.
254 @pre "This method can only be called before the hwdevice has been initialized."
256 virtual void Initialize() = 0;
259 Commit all changes since the last CommitL(), Revert() or Initialize()
260 to the hardware device. This only applies to methods which can be called both
261 before AND after DevVideoPlay has been initialized.
263 @see CMMFVideoEncodeHwDevice::SetOutputRectL
264 @see CMMFVideoRecordHwDevice::SetPreProcessTypesL
265 @see CMMFVideoRecordHwDevice::SetRotateOptionsL
266 @see CMMFVideoRecordHwDevice::SetScaleOptionsL
267 @see CMMFVideoRecordHwDevice::SetInputCropOptionsL
268 @see CMMFVideoRecordHwDevice::SetOutputCropOptionsL
269 @see CMMFVideoRecordHwDevice::SetOutputPadOptionsL
270 @see CMMFVideoRecordHwDevice::SetColorEnhancementOptionsL
271 @see CMMFVideoRecordHwDevice::SetFrameStabilisationOptionsL
272 @see CMMFVideoRecordHwDevice::SetCustomPreProcessOptionsL
273 @see CMMFVideoEncodeHwDevice::SetCodingStandardSpecificOptionsL
274 @see CMMFVideoEncodeHwDevice::SetImplementationSpecificEncoderOptionsL
276 @leave "The method will leave if an error occurs."
277 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
279 virtual void CommitL() = 0;
282 Revert all changes since the last CommitL(), Revert() or Initialize()
283 back to their previous settings. This only applies to methods which can
284 be called both before AND after DevVideoPlay has been initialized.
286 @see CMMFVideoEncodeHwDevice::SetOutputRectL
287 @see CMMFVideoRecordHwDevice::SetPreProcessTypesL
288 @see CMMFVideoRecordHwDevice::SetRotateOptionsL
289 @see CMMFVideoRecordHwDevice::SetScaleOptionsL
290 @see CMMFVideoRecordHwDevice::SetInputCropOptionsL
291 @see CMMFVideoRecordHwDevice::SetOutputCropOptionsL
292 @see CMMFVideoRecordHwDevice::SetOutputPadOptionsL
293 @see CMMFVideoRecordHwDevice::SetColorEnhancementOptionsL
294 @see CMMFVideoRecordHwDevice::SetFrameStabilisationOptionsL
295 @see CMMFVideoRecordHwDevice::SetCustomPreProcessOptionsL
296 @see CMMFVideoEncodeHwDevice::SetCodingStandardSpecificOptionsL
297 @see CMMFVideoEncodeHwDevice::SetImplementationSpecificEncoderOptionsL
299 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
301 virtual void Revert() = 0;
304 Writes an uncompressed input picture. When the picture has been used, it must be returned to the client
305 with MMMFDevVideoRecordProxy::MdvrpReturnPicture(). This method must not be called if direct capture is
308 @param "aPicture" "The picture to write."
309 @leave "The method will leave if an error occurs."
310 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
312 virtual void WritePictureL(TVideoPicture* aPicture) = 0;
315 Notifies the hardware device that the end of input data has been reached and no more input pictures
316 will be written. The hardware device can use this signal to ensure that the remaining data gets
317 processed, without waiting for new data. After the remaining data has been processed, the hardware
318 device must call the proxy callback MdvrpStreamEnd().
319 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
321 virtual void InputEnd() = 0;
324 Starts recording video. This includes capturing pictures from the camera (if direct capture is used),
325 pre-processing and encoding. Recording will proceed until it is stopped or paused. Initally recording
327 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
329 virtual void Start() = 0;
332 Stops recording video. No new pictures will be captured, pre-processed, or encoded. If input pictures
333 are written while recording is stopped, they will be returned immediately.
334 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
336 virtual void Stop() = 0;
339 Pauses video recording. Recording can be resumed using Resume().
340 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
342 virtual void Pause() = 0;
345 Resumes video recording after a pause.
346 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
348 virtual void Resume() = 0;
351 Freezes the input picture. Normal encoding can be continued using ReleaseFreeze().
352 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
354 virtual void Freeze() = 0;
357 Releases a frozen input picture. Video capturing and encoding continues normally.
358 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
360 virtual void ReleaseFreeze() = 0;
363 Returns the current recording position. The position is the capture timestamp from the latest input
364 picture, or the capture timestamp for the latest picture captured from the camera when direct capture
367 @return "The current recording position."
368 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
370 virtual TTimeIntervalMicroSeconds RecordingPosition() = 0;
373 Reads various counters related to processed video pictures. See the definition of TPictureCounters
374 for a description of the counters. The counters are reset when Initialize() or this method is called,
375 and thus they only include pictures processed since the last call.
377 @param "aCounters" "The counter structure to fill."
378 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
380 virtual void GetPictureCounters(CMMFDevVideoRecord::TPictureCounters& aCounters) = 0;
383 Reads the frame stabilisation output picture position. This information can be used for positioning the
384 viewfinder. The position returned is the stabilisation result for the most recent input picture.
386 @param ""aRect "The position of the stabilisation output picture inside the input picture. If frame
387 stabilisation is not used, the rectangle is set to cover the entire input picture."
388 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
390 virtual void GetFrameStabilisationOutput(TRect& aRect) = 0;
393 Retrieves the number of complexity control levels available for this hardware device. Devices can
394 support processing the same input data with different computational complexity levels. The complexity
395 level can affect, for example, the motion vector search range used in an encoder.
397 @return "The number of complexity control levels available, one if multiple levels are not supported."
398 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
400 virtual TUint NumComplexityLevels() = 0;
403 Sets the complexity level to use for video processing in a hardware device. The level can be changed
406 @param "aLevel" "The computational complexity level to use. Level zero (0) is the most complex one,
407 with the highest quality. Higher level numbers require less processing and may have
409 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
411 virtual void SetComplexityLevel(TUint aLevel) = 0;
416 CMMFVideoEncodeHwDevice is the MSL video encoder hardware device interface. All video encoders must
417 implement this interface.
421 class CMMFVideoEncodeHwDevice : public CMMFVideoRecordHwDevice
425 Creates a new video encoder hardware device object, based on the implementation UID.
427 @param "aUid" "Encoder implementation UID."
428 @param "aProxy" "The proxy implementation to use."
429 @return "A new CMMFVideoEncodeHwDevice object."
430 @leave "This method will leave if an error occurs."
432 IMPORT_C static CMMFVideoEncodeHwDevice* NewL(TUid aUid, MMMFDevVideoRecordProxy& aProxy);
435 Creates a new video encoder hardware device adapter object, based on the Interface Implementation of a Processing Unit.
437 @param "aImplInfo" "The registration data relating to the Interface Implementation of the Processing Unit."
438 @param "aProxy" "The proxy implementation to use."
439 @return "A new CMMFVideoEncodeHwDevice object."
440 @leave "This method will leave if an error occurs."
442 IMPORT_C static CMMFVideoEncodeHwDevice* NewPuAdapterL(const CImplementationInformation& aImplInfo, MMMFDevVideoRecordProxy& aProxy);
447 IMPORT_C virtual ~CMMFVideoEncodeHwDevice();
450 Retrieves information about the video encoder.
452 @return "Encoder information as a CVideoEncoderInfo object. The object is pushed to the cleanup stack,
453 and must be deallocated by the caller."
454 @leave "This method will leave if an error occurs."
456 virtual CVideoEncoderInfo* VideoEncoderInfoLC() = 0;
459 Sets the encoder output format. The picture size depends on the input data format and possible
462 @param "aFormat" "The video format to use."
463 @param "aDataUnitType" "The type of output coded data units."
464 @param "aDataEncapsulation" "Data encapsulation type for output encoded data units."
465 @param "aSegmentationAllowed" "True if a coded data unit can be segmented into multiple output buffers
466 if a single buffer is not large enough."
467 @leave "The method will leave if an error occurs. Typical error codes used:
468 - KErrNotSupported - The format specified is not supported."
469 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
471 virtual void SetOutputFormatL(const CCompressedVideoFormat& aFormat,
472 TVideoDataUnitType aDataUnitType,
473 TVideoDataUnitEncapsulation aDataEncapsulation,
474 TBool aSegmentationAllowed=EFalse) = 0;
477 Sets the pre-processor device that will write data to this encoder. Uncompressed pictures will be
478 written with WritePictureL() or through a custom interface. After pictures have been processed,
479 they must be returned to the pre-processor using ReturnPicture().
481 @param "aDevice" "The input pre-processor device to use."
482 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
484 virtual void SetInputDevice(CMMFVideoPreProcHwDevice* aDevice) = 0;
487 Sets the number of bit-rate scalability layers to use. Set to 1 to disable layered scalability.
489 Bit-rate scalability refers to the ability of a coded stream to be decoded at different bit-rates.
490 Scalable video is typically ordered into hierarchical layers of data. A base layer contains an
491 individual representation of a video stream and enhancement layers contain refinement data in addition
492 to the base layer. The quality of the decoded video stream progressively improves as enhancement layers
493 are added to the base layer.
495 @param "aNumLayers" "The number of bit-rate scalability layers to use, set to 1 to disable
497 @leave "The method will leave if an error occurs. Typical error codes used:
498 - KErrNotSupported - The scalability layers are not supported or too many layers specified."
499 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
501 virtual void SetNumBitrateLayersL(TUint aNumLayers) = 0;
504 Sets the scalability type for a bit-rate scalability layer.
506 @param "aLayer" "Layer number. Layers are numbered [0...n-1], where n is the number of layers
507 available. The first layer is the base layer, it can be decoded independently from the other
508 layers, and it has the lowest total bitrate."
509 @param "aScalabilityType" "Layer scalability type."
510 @leave " The method will leave if an error occurs. Typical error codes used:
511 - KErrNotSupported - The scalability layers or the specified scalability type are not
513 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
515 virtual void SetScalabilityLayerTypeL(TUint aLayer, TScalabilityType aScalabilityType) = 0;
518 Sets the reference picture options to be used for all scalability layers. The settings can be overridden
519 for an individual scalability layer by using SetLayerReferenceOptions().
521 @param "aMaxReferencePictures" "The maximum number of reference pictures to be used. More than one
522 reference frame can be used in the H.264 | MPEG-4 AVC and in some
523 advanced profiles of MPEG-4 Part 2 and H.263. The minimum value is one."
524 @param "aMaxPictureOrderDelay" "The maximum picture order delay, in number of pictures. This specifies
525 the maximum amount of pictures that precede any picture in the sequence
526 in decoding order and follow the picture in presentation order. Pictures
527 may be coded/decoded in different order from their capture/display order.
528 Thus, decoded pictures have to be buffered to order them in correct
529 display order. For example, if one conventional B picture is coded
530 between P pictures, a one-picture display ordering delay has to be
531 applied in the decoder. The minimum value is zero, which indicates
532 that pictures must be coded in capture/display order."
533 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
535 virtual void SetGlobalReferenceOptions(TUint aMaxReferencePictures, TUint aMaxPictureOrderDelay) = 0;
538 Sets the reference picture options to be used for a single scalability layer. These settings override
539 those set with SetGlobalReferenceOptions().
541 @param "aLayer" "Layer number."
542 @param "aMaxReferencePictures" "The maximum number of reference pictures to be used."
543 @param "aMaxPictureOrderDelay" "The maximum picture order delay, in number of pictures."
544 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
546 virtual void SetLayerReferenceOptions(TUint aLayer, TUint aMaxReferencePictures, TUint aMaxPictureOrderDelay) = 0;
549 Sets encoder buffering options.
551 @param "aOptions" "The buffering options."
552 @leave "The method will leave if an error occurs. Typical error codes used:
553 - KErrNotSupported - The specified settings are not supported."
554 @pre "This method may only be called before the hwdevice has been initialized using Initialize()."
556 virtual void SetBufferOptionsL(const TEncoderBufferOptions& aOptions) = 0;
559 Sets the encoder output rectangle. This rectangle specifies the part of the input and output pictures
560 which is displayed after encoding. Many video codecs process data in 16x16 pixel units but enable
561 specifying and coding the encoder output rectangle for image sizes that are not multiple of 16 pixels
564 @param "aRect" "The encoder output rectangle."
565 @leave "The method will leave if an error occurs."
566 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
567 If called after initialization, the change must only be committed when CommitL() is called."
569 virtual void SetOutputRectL(const TRect& aRect) = 0;
572 Sets whether bit errors or packets losses can be expected in the video transmission. The video encoder
573 can use this information to optimize the bitstream.
575 @param "aBitErrors" "True if bit errors can be expected."
576 @param "aPacketLosses" "True if packet losses can be expected."
577 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
578 If called after initialization, the change must only be committed when CommitL() is called."
580 virtual void SetErrorsExpected(TBool aBitErrors, TBool aPacketLosses) = 0;
583 Sets the minimum frequency (in time) for instantaneous random access points in the bitstream. An
584 instantaneous random access point is such where the decoder can achieve a full output picture
585 immediately by decoding data starting from the random access point. The random access point frequency
586 may be higher than signalled, if the sequence contains scene cuts which typically cause a coding
587 of a random access point.
589 @param "aRate" "Random access point rate, in pictures per second. For example, to request a random
590 access point every ten seconds, set the value to 0.1."
591 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
592 If called after initialization, the change must only be committed when CommitL() is called."
594 virtual void SetMinRandomAccessRate(TReal aRate) = 0;
597 Sets coding-standard specific encoder options.
599 @param "aOptions" "The options to use. The data format for the options is coding-standard specific,
600 and defined separately."
601 @leave "The method will leave if an error occurs. Typical error codes used:
602 - KErrNotSupported - The specified settings are not supported."
603 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
604 If called after initialization, the change must only be committed when CommitL() is called."
606 virtual void SetCodingStandardSpecificOptionsL(const TDesC8& aOptions) = 0;
609 Sets implementation-specific encoder options.
611 @param "aOptions" "The options to use. The data format for the options is specific to the encoder
612 implementation, and defined separately by the encoder implementer."
613 @leave "The method will leave if an error occurs. Typical error codes used:
614 - KErrNotSupported - The specified settings are not supported."
615 @pre "This method can be called either before or after the hwdevice has been initialized with Initialize().
616 If called after initialization, the change must only be committed when CommitL() is called."
618 virtual void SetImplementationSpecificEncoderOptionsL(const TDesC8& aOptions) = 0;
621 Returns coding-standard specific initialization output from the encoder. The information can contain,
622 for example, the MPEG-4 VOL header. This method can be called after Initialize() has been called.
624 @return "Coding-standard specific initialization output. The data format is coding-standard specific
625 and defined separately. The buffer is pushed to the cleanup stack, and the caller is responsible
626 for deallocating it."
627 @leave "The method will leave if an error occurs."
628 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
630 virtual HBufC8* CodingStandardSpecificInitOutputLC() = 0;
633 Returns implementation-specific initialization output from the encoder. This method can be called after
634 Initialize() has been called.
636 @return "Implementation-specific initialization output. The data format is specific to the encoder
637 implementation, and defined by the encoder supplier. The buffer is pushed to the cleanup stack,
638 and the caller is responsible for deallocating it."
639 @leave "The method will leave if an error occurs."
640 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
642 virtual HBufC8* ImplementationSpecificInitOutputLC() = 0;
645 Sets the number of unequal error protection levels. By default unequal error protection is not used.
647 @param "aNumLevels" "The number of unequal error protection levels. To disable unequal error
648 protection, set this value to one"
649 @param "aSeparateBuffers" "True if each unequal error protection level of a coded data unit shall be
650 encapsulated in its own output buffer. Ignored if unequal error protection
652 @leave "The method will leave if an error occurs. Typical error codes used:
653 - KErrNotSupported - Unequal error protection is not supported."
654 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
656 virtual void SetErrorProtectionLevelsL(TUint aNumLevels, TBool aSeparateBuffers) = 0;
659 Sets up an unequal error protection level. If unequal error protection is not used, this method can be
660 used to control settings for the whole encoded bitstream.
662 @param "aLevel" "Error protection level number. This argument is ignored if unequal error protection
664 @param "aBitrate" "Target bit-rate for this error protection level."
665 @param "aStrength" "Forward error control strength for this error protection level. The strength
666 can be specified using values from TErrorControlStrength (EFecStrengthNone,
667 EFecStrengthLow, EFecStrengthNormal, EFecStrengthHigh), or with intermediate
668 values between those constants."
669 @leave "The method will leave if an error occurs. Typical error codes used:
670 - KErrNotSupported - The specified bit-rate cannot be supported. "
671 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
673 virtual void SetErrorProtectionLevelL(TUint aLevel, TUint aBitrate, TUint aStrength) = 0;
676 Sets the expected or prevailing channel conditions for an unequal error protection level, in terms of
677 expected packet loss rate. The video encoder can use this information to optimize the generated bitstream.
679 @param "aLevel" "Error protection level number. This argument is ignored if unequal error
680 protection is not in use."
681 @param "aLossRate" "Packet loss rate, in number of packets lost per second. Set to 0.0 if
682 packet losses are not expected."
683 @param "aLossBurstLength" "Expected average packet loss burst length. Set to zero if the information is
685 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
687 virtual void SetChannelPacketLossRate(TUint aLevel,
689 TTimeIntervalMicroSeconds32 aLossBurstLength) = 0;
692 Sets the expected or prevailing channel conditions for an unequal error protection level, in terms of
693 expected bit error rate. The video encoder can use this information to optimize the generated bitstream.
695 @param "aLevel" "Error protection level number. This argument is ignored if unequal error
696 protection is not in use."
697 @param "aErrorRate" "Expected bit error rate, as a fraction of the total bits transmitted. Set
698 to 0.0 if bit errors are not expected."
699 @param "aStdDeviation" "Expected bit error rate standard deviation."
700 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
702 virtual void SetChannelBitErrorRate(TUint aLevel, TReal aErrorRate, TReal aStdDeviation) = 0;
705 Sets the target size of each coded video segment. The segment target size can be specified in terms of
706 number of bytes per segment, number of macroblocks per segment, or both.
708 @param "aLayer" "Layer number. Layers are numbered [0...n-1], where n is the number of
709 layers available. Use zero if layered bit-rate scalability is not used."
710 @param "aSizeBytes" "Segment target size in bytes. Set to zero to use unlimited segment size. The
711 segment size in bytes should include all data that is typically stored or
712 transmitted for each segment in the format currently in use. This includes all
714 @param "aSizeMacroblocks" "Segment target size in number of macroblocks per segment. Set to zero to
715 use unlimited segment size."
716 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
718 virtual void SetSegmentTargetSize(TUint aLayer, TUint aSizeBytes, TUint aSizeMacroblocks) = 0;
721 Sets the bit-rate control options for a layer. If layered bit-rate scalability is not used, the options
722 are set for the whole bitstream.
724 @param "aLayer" "Layer number. Layers are numbered [0...n-1], where n is the number of layers
725 available. Use zero if layered bit-rate scalability is not used."
726 @param "aOptions" "Bit-rate control options."
727 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
729 virtual void SetRateControlOptions(TUint aLayer, const TRateControlOptions& aOptions) = 0;
732 Sets in-layer scalability options for a layer. In-layer bit-rate scalability refers to techniques where
733 a specific part of a single-layer coded stream can be decoded correctly without decoding the leftover
734 part. For example, B-pictures can be used for this. By default in-layer scalability is not used.
736 @param "aLayer" "Layer number. Layers are numbered [0…n-1], where n is the number of layers
737 available. Use zero if layered bit-rate scalability is not used."
738 @param "aNumSteps" "The number of in-layer scalability steps to use. Set to one to disable
739 in-layer scalability."
740 @param "aScalabilityType" "The scalability type to use."
741 @param "aBitrateShare" "Bit-rate share for each scalability step. The bit-rate shares are defined
742 as fractions of total layer bit-rate, with the share for one layer being
743 aBitrateShare[i]/sum(aBitrateShare). For example, to use 2/3 of the total
744 bitrate for the first layer and the remaining 1/3 for the second, the array
745 contents would be {2,1}."
746 @param "aPictureShare" "Picture rate share for each scalability step. The picture rate shares are
747 defined similarly to the bit-rate shares. For example, a client wishing to
748 use two B-pictures between each pair of reference pictures should set the
749 array contents to {1,2}."
750 @leave "The method will leave if an error occurs. Typical error codes used:
751 - KErrNotSupported - In-layer scalability is not supported.
752 - KErrArgument - Some of the arguments are out of range. For example, it is not
753 possible to use the specified in-layer scalability setup due to other
754 constraints (such as the maximum picture order delay)."
755 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
757 virtual void SetInLayerScalabilityL(TUint aLayer,
759 TInLayerScalabilityType aScalabilityType,
760 const TArray<TUint>& aBitrateShare,
761 const TArray<TUint>& aPictureShare) = 0;
764 Sets the period for layer promotions points for a scalability layer. A layer promotion point is a
765 picture where it is possible to start decoding this enhancement layer if only the lower layers were
768 @param "aLayer" "Layer number."
769 @param "aPeriod" "Layer promotion point period. A value of one signals that each picture should be a
770 layer promotion point, value two that there is one picture between each promotion
772 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
774 virtual void SetLayerPromotionPointPeriod(TUint aLayer, TUint aPeriod) = 0;
777 Returns coding-standard specific settings output from the encoder. The information can contain, for
778 example, some bitstream headers that can change based on settings modified while encoding is in progress.
780 @return "Coding-standard specific initialization output. The data format is coding-standard specific
781 and defined separately. The buffer is pushed to the cleanup stack, and the caller is responsible
782 for deallocating it."
783 @leave "The method will leave if an error occurs."
784 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
786 virtual HBufC8* CodingStandardSpecificSettingsOutputLC() = 0;
789 Returns implementation-specific settings output from the encoder. The information can contain, for
790 example, some bitstream headers that can change based on settings modified while encoding is in progress.
792 @return "Implementation-specific initialization output. The data format is implementation-specific and
793 defined separately by the encoder supplier. The buffer is pushed to the cleanup stack, and the
794 caller is responsible for deallocating it."
795 @leave "The method will leave if an error occurs."
796 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
798 virtual HBufC8* ImplementationSpecificSettingsOutputLC() = 0;
801 Requests the encoder to sends supplemental information in the bitstream. The information data format is
802 coding-standard dependent. Only one supplemental information send request can be active at a time. This
803 variant encodes the information to the next possible picture.
805 The client must be notified after then information has been sent by calling
806 MMMFDevVideoRecordProxy::MdvrpSupplementalInfoSent().
808 @param "aData" "Supplemental information data to send."
809 @leave "The method will leave if an error occurs. Typical error codes used:
810 - KErrNotSupported - Supplemental information is not supported"
811 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
813 virtual void SendSupplementalInfoL(const TDesC8& aData) = 0;
816 Requests the encoder to sends supplemental information in the bitstream. The information data format is
817 coding-standard dependent. Only one supplemental information send request can be active at a time. This
818 variant encodes the information to the picture specified.
820 @param "aData" "Supplemental information data to send."
821 @param "aTimestamp" "Timestamp for the picture in which the supplemental information should be
822 included. If a picture with the matching timestamp is never encoded, or the
823 timestamp is in the past, the supplemental information will not be sent."
824 @leave "The method will leave if an error occurs. Typical error codes used:
825 - KErrNotSupported - Supplemental information is not supported"
826 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
828 virtual void SendSupplementalInfoL(const TDesC8& aData, const TTimeIntervalMicroSeconds& aTimestamp) = 0;
831 Cancels the current supplemental information send request. The memory buffer reserved for supplemental
832 information data can be reused or deallocated after the method returns.
833 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
835 virtual void CancelSupplementalInfo() = 0;
838 Gets the current output buffer status. The information includes the number of free output buffers and
839 the total size of free buffers in bytes.
841 @param "aNumFreeBuffers" "Target for the number of free output buffers."
842 @param "aTotalFreeBytes" "Target for the total free buffer size in bytes."
843 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
845 virtual void GetOutputBufferStatus(TUint& aNumFreeBuffers, TUint& aTotalFreeBytes) = 0;
848 Returns a used output buffer back to the encoder. The buffer can be reused or deallocated.
850 @param "aBuffer" "The buffer to return."
851 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
853 virtual void ReturnBuffer(TVideoOutputBuffer* aBuffer) = 0;
856 Indicates a picture loss to the encoder, without specifying the lost picture. The encoder can react
857 to this by transmitting an intra-picture.
858 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
860 virtual void PictureLoss() = 0;
863 Indicates to the encoder the pictures that have been lost. The encoder can react to this by
864 transmitting an intra-picture.
865 @param "aPictures" "Picture identifiers for the lost pictures."
866 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
868 virtual void PictureLoss(const TArray<TPictureId>& aPictures) = 0;
871 Indicates a slice loss to the encoder.
873 @param "aFirstMacroblock" "The first lost macroblock. The macroblocks are numbered such
874 that the macroblock in the upper left corner of the picture is considered
875 macroblock number 1 and the number for each macroblock increases from left
876 to right and then from top to bottom in raster-scan order."
877 @param "aNumMacroblocks" "The number of macroblocks in the lost slice."
878 @param "aPicture" "The picture identified for the picture where the slice was lost. If the
879 picture is not known, aPicture.iIdType is set to ENone."
880 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
882 virtual void SliceLoss(TUint aFirstMacroblock, TUint aNumMacroblocks, const TPictureId& aPicture) = 0;
885 Sends a reference picture selection request to the encoder. The request is delivered as a
886 coding-standard specific binary message. Reference picture selection can be used to select a previous
887 correctly transmitted picture to use as a reference in case later pictures have been lost.
889 @param "aSelectionData" "The reference picture selection request message. The message format is
890 coding-standard specific, and defined separately."
891 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
893 virtual void ReferencePictureSelection(const TDesC8& aSelectionData) = 0;
899 IMPORT_C CMMFVideoEncodeHwDevice();
902 Set the proxy implementation to be used. Called just after the object is constructed.
903 @param "aProxy" "The proxy to use."
905 virtual void SetProxy(MMMFDevVideoRecordProxy& aProxy) = 0;
912 CMMFVideoPreProcHwDevice is the MSL video pre-processor plug-in interface. All MSL video pre-processors
913 must implement this interface.
917 class CMMFVideoPreProcHwDevice : public CMMFVideoRecordHwDevice
921 Creates a new video pre-processor hardware device object, based on the implementation UID.
922 @param "aUid" "Pre-processor implementation UID."
923 @param "aProxy" "The proxy implementation to use."
924 @return "A new CMMFVideoPreProcHwDevice object."
925 @leave "This method will leave if an error occurs."
927 IMPORT_C static CMMFVideoPreProcHwDevice* NewL(TUid aUid, MMMFDevVideoRecordProxy& aProxy);
932 IMPORT_C virtual ~CMMFVideoPreProcHwDevice();
935 Sets the device output format. The picture size depends on the input data format and possible
938 @param "aFormat" "The video format to use."
939 @leave " The method will leave if an error occurs. Typical error codes used:
940 - KErrNotSupported - The format specified is not supported."
941 @pre "This method can only be called before the hwdevice has been initialized with Initialize()."
943 virtual void SetOutputFormatL(const TUncompressedVideoFormat& aFormat) = 0;
946 Sets the video encoder device that will receive data from this pre-processor. Pre-processed pictures
947 will be written with WritePictureL() or through a custom interface, and the encoder will return used
948 pictures using ReturnPicture().
950 @param "aDevice" "The output encoder device to use."
951 @pre "This method can only be called before the hwdevice has been initialized with Initialize()."
953 virtual void SetOutputDevice(CMMFVideoEncodeHwDevice* aDevice) = 0;
956 Returns a used picture back to the pre-processor. Called by an encoder device when used as output
957 device from a pre-processor.
959 @param "aPicture" "The picture to return."
960 @pre "This method can only be called after the hwdevice has been initialized with Initialize()."
962 virtual void ReturnPicture(TVideoPicture* aPicture) = 0;
968 IMPORT_C CMMFVideoPreProcHwDevice();
971 Set the proxy implementation to be used. Called just after the object is constructed.
972 @param "aProxy" "The proxy to use."
974 virtual void SetProxy(MMMFDevVideoRecordProxy& aProxy) = 0;