| ID | CS001065 | Creation date | July 7, 2008 |
| Platform | S60 3rd Edition, FP2 | Tested on devices | |
| Category | Symbian C++ | Subcategory | Multimedia, Video |
| Keywords (APIs, classes, methods, functions): MDFDevVideo Record API |
| Note! |
|---|
|
The Video Encoding and Recording API is also known as the DevVideoRecord API. Multimedia Framework (MMF) plug-ins use this interface to access video encoders and preprocessors in a platform and hardware-independent manner.
#include <devvideorecord.h>
LIBRARY devvideo.lib
The MMMFDevVideoObserver class defines the observer mixin interface that any client using CMMFDevVideoRecord must implement.
//MMMFDevVideoRecordObserver virtual void MdvroReturnPicture(TVideoPicture* aPicture) = 0; virtual void MdvroSupplementalInfoSent() = 0; virtual void MdvroNewBuffers() = 0; virtual void MdvpoError(TInt aError) = 0; virtual void MdvroInitializeComplete(TInt aError); Virtual void MdvroStreamEnd(); //NewL() delete iDvr; iDvr = NULL; iDvr = CMMFDevVideoRecord::NewL(*this); // Find an accelerated encoder if possible, non-accelerated if not RArray<TUid> encs; iDvr->FindEncodersL(KMime, 0, encs, EFalse); TUid enc = TUid::Uid(0); TBool foundAccel = EFalse; for ( TInt i = 0; i < encs.Count(); i++ ) { CVideoEncoderInfo *info = iDvr->VideoEncoderInfoLC(encs[i]); if ( info->Accelerated() ) { enc = encs[i]; foundAccel = ETrue; } else if ( !foundAccel ) { LFPRINT((_L("Not accelerated, but haven't seen one so far --using this"))); enc = encs[i]; } else { LFPRINT((_L("Not accelerated and already have one -- skipping"))); } CleanupStack::PopAndDestroy(); } if ( enc.iUid == 0 ) { User::Leave(KErrNotSupported); } // Select encoder iEnc = iDvr->SelectEncoderL(enc); // Input format TSize size(176, 144); TUncompressedVideoFormat fmt; fmt.iDataFormat = EYuvRawData; fmt.iYuvFormat.iCoefficients = EYuvBt601Range1; fmt.iYuvFormat.iPattern = EYuv420Chroma2; fmt.iYuvFormat.iDataLayout = EYuvDataPlanar; fmt.iYuvFormat.iYuv2RgbMatrix = NULL; fmt.iYuvFormat.iRgb2YuvMatrix = NULL; fmt.iYuvFormat.iAspectRatioNum = 1; fmt.iYuvFormat.iAspectRatioDenom = 1; iDvr->SetInputFormatL(iEnc, fmt, size); // Output format CCompressedVideoFormat *cfmt = CCompressedVideoFormat::NewL(KMime); CleanupStack::PushL(cfmt); iDvr->SetOutputFormatL(iEnc, *cfmt, EDuCodedPicture,EDuElementaryStream, EFalse); CleanupStack::PopAndDestroy(); //cfmt // Buffer options TEncoderBufferOptions bopt; bopt.iMaxPreEncoderBufferPictures = 1; bopt.iHrdVbvSpec = EHrdVbvNone; bopt.iHrdVbvParams.Set(NULL, 0); bopt.iMaxOutputBufferSize = 10240; bopt.iMaxCodedPictureSize = 10240; bopt.iMaxCodedSegmentSize = 10240; // ignored in non-segmented mode bopt.iMinNumOutputBuffers = 2; iDvr->SetBufferOptionsL(bopt); // Source is memory iDvr->SetSourceMemoryL(15.0, EFalse, EFalse); // not real-time // Initialize iDvr->Initialize(); //WRITE PIC // Generate data TInt y = iPicNum % 14; Mem::Fill(iYuv, 176*y*10, 200); Mem::Fill(iYuv + 176*y*10, 176*144 - 176*y*10, 0); Mem::Fill(iYuv + 176*144, 176*144/2, 128); // Write picture iPic.iData.iDataFormat = EYuvRawData; iPic.iData.iDataSize = TSize(176,144); iPicDataPtr.Set(iYuv, 176*144*3/2, 176*144*3/2); iPic.iData.iRawData = &iPicDataPtr; iPic.iOptions = TVideoPicture::ETimestamp; iPic.iTimestamp = (1000000 * iPicNum) / 15; TRAPD(err, iDvr->WritePictureL(&iPic)); if ( err != KErrNone ) { LFPRINT((_L("WritePictureL failed with %d"), err)); TestComplete(err); } iPicNum++;
This application does very basic MPEG-4 video encoding from a memory source and writes the results to a file. It does just about the least amount of work to get everything up and running, and while the settings may be too basic for a real application, it should be useful for comparison purposes. Once the application is running, you can start adding additional rate control and other settings as needed.
| Thread | Thread Starter | Forum | Replies | Last Post |
|---|---|---|---|---|
| Video recording advice needed | nuker85 | Symbian Media (Graphics & Sounds) | 3 | 2008-11-10 15:16 |
| delete recordstore permanently from mobile | snehalpatil | Mobile Java General | 2 | 2008-03-14 06:01 |
| Supported NDEF action record | cde | Near Field Communication | 2 | 2008-02-08 07:52 |
| Recording Files | pergentino | Mobile Java General | 0 | 2004-11-20 02:20 |
| Full Duplex Audio (record and play simultaneously) on N71 | vvsnaresh | General Symbian C++ | 0 | 2006-06-02 07:09 |