quick_recipes (779892), страница 46

Файл №779892 quick_recipes (Symbian Books) 46 страницаquick_recipes (779892) страница 462018-01-10СтудИзба
Просмтор этого файла доступен только зарегистрированным пользователям. Но у нас супер быстрая регистрация: достаточно только электронной почты!

Текст из файла (страница 46)

Each method has some more variants; we will notdiscuss all of them.CCamera::StartViewFinderDirectL() is used to start the directviewfinder:virtual void StartViewFinderDirectL(RWsSession& aWs,CWsScreenDevice& aScreenDevice, RWindowBase& aWindow,TRect& aScreenRect)=0;258SYMBIAN C++ RECIPESYou would usually use CCoeEnv::WsSession(), CCoeEnv::ScreenDevice() and CCoeControl::DrawableWindow() to assign the first three parameters.The last parameter is the area where the viewfinder will be displayed.The position is relative to the origin of the screen.CCamera::StartViewFinderBitmapsL() is used to start thebitmap viewfinder:virtual void StartViewFinderBitmapsL(TSize& aSize);StartViewFinderBitmapsL() requires one parameter with typeTSize, which is the size of the viewfinder to be used. When callingStartViewFinderBitmapsL(), you have to initialize aSize withthe area where you want to display the viewfinder.

On return, aSize willbe assigned to the actual size of the viewfinder. They may be differentbecause the control size and the viewfinder size may have different aspectratio.You can only display the viewfinder after the camera’s power has beenswitched on. This means you have to do it after MCameraObserver::PowerOnComplete() has been called.In the case of a direct viewfinder, you don’t need to do anything elseafter calling StartViewFinderDirectL(). The viewfinder drawing isdone direct to the screen by the API.When using a bitmap viewfinder, you have to draw the viewfinder manually. MCameraObserver::ViewFinderFrameReady() is calledperiodically when the new viewfinder frame is ready.

This callbackhas one parameter with type CFbsBitmap&, which is the viewfinder tobe displayed.There are applications that may require the viewfinder to process theimage from the camera without actually capturing it. For example, it canbe used in a motion detector application. When the application detectsa moving object, it performs a specific action (this is discussed furtherin the Symbian Press book Games on Symbian OS – see developer.symbian.com/gamesbook for more details). A game may also use aviewfinder as its controller. When the user moves the camera in onedirection, a character in the game also moves in the same direction.4.7.3.4Capture Still Images from a CameraAmount of time required: 20 minutesLocation of example code: \Multimedia\CameraImageRequired libraries: ecam.libRequired header file(s): ecam.hRequired platform security capability(s): UserEnvironmentMULTIMEDIA259Problem: You want to capture still images from the device’s camera.

Theimages are then saved to a file in JPEG format.Solution: In the recipe, the CCameraEngine::CaptureImageL()method is used to capture still images from the camera. This is anasynchronous method. When complete, it calls CCameraEngine::DoSaveImageL() to save the image to a file.Discussion:Preparing image captureCapturing a still image using a camera is done by calling CCamera::CaptureImage(). This is an asynchronous method. When itcompletes, it calls MCameraObserver::ImageReady().Before capturing any image, the CCamera::PrepareImageCaptureL() method has to be called to keep the latency of CaptureImage() to a minimum. It needs to be called only once formultiple CaptureImage() calls.The PrepareImageCaptureL() method requires two parameters.The first parameter is the format of the image.

Here is the list of formatsfor still images:• EFormatMonochrome• EFormat16bitRGB444• EFormat16BitRGB565• EFormat32BitRGB888• EFormatJpeg• EFormatExif• EFormatFbsBitmapColor4K• EFormatFbsBitmapColor64K• EFormatFbsBitmapColor16M• EFormatFbsBitmapColor16MU.One device may not support all the formats above. You can checkwhich formats are supported by a device from TCameraInfo::iImageFormatsSupported.

It is a bit flag with type CCamera::TFormat.The second parameter of PrepareImageCaptureL() is the indexof the image size. It must be in the range of 0 to (TCameraInfo::iNumImageSizesSupported – 1). You can get all supported image sizes bycalling CCamera::EnumerateCaptureSizes().260SYMBIAN C++ RECIPESFor the sake of simplicity, the discussion in this book focuses only onJPEG (Joint Photographic Expert Group) and EXIF (Exchangeable ImageFile Format) formats. The EXIF format is a specification of an image fileformat used by digital cameras that contains additional metadata tags,such as date and time information, aperture, shutter speed, ISO speedand many more. It is supported by JPEG and some other formats.

It is notsupported by JPEG 2000, PNG and GIF though.What may go wrong when you do this: Before using a format, you haveto make sure that it is supported by the device. For example, most S60devices do not support EFormatJpeg. They support EFormatExif.In order to keep the recipe simple, it uses the synchronous overloadof RFile::Write() to save the captured image. In production code,we recommend that you use the asynchronous method, called using anactive object, to keep the GUI responsive.4.7.3.5Record VideoAmount of time required: 30 minutesLocation of example code: \Multimedia\VideoRecordingRequired libraries: mediaclientvideo.libRequired header file(s): videorecorder.hRequired platform security capability(s): UserEnvironmentProblem: You want to record a video clip from a camera and save it toa file.Solution: Before you continue reading this recipe, make sure that youalready know how to use the CCamera class (see Recipe 4.7.3.2).The class from MMF that is used to record video is CVideoRecorderUtility.

As for many other MMF APIs, there is an observerclass: MVideoRecorderUtilityObserver.The CVideoRecorderUtility class requires UserEnvironmentcapability. There are some methods that require MultimediaDD, butthey will not be discussed in this book.What may go wrong when you do this: There is a known issue on somedevices, which require that applications that perform video recordingpossess the MultimediaDD capability. A good example of this is theNokia N93 and on early firmware of the Nokia N93i. Please check theForum Nokia Technical Library at www.forum.nokia.com for moreinformation.MULTIMEDIA261Using CVideoRecorderUtility is similar to CMdaAudioRecorderUtility, although it is a little more complex.

Here arethe steps required to record a video:• Display the viewfinder using CCamera class (see Recipe 4.7.3.2).• Create an observer that implements MVideoRecorderUtilityObserver.• Create a new instance of CVideoRecorderUtility.• Open the file by calling CVideoRecorderUtility::OpenFileL().• Wait until the observer method, MVideoRecorderUtilityObserver::MvruoOpenComplete(), is called.• Set some configurations, such as audio type.• Call CVideoRecorderUtility::Prepare() to prepare for videorecording.• Wait until the observer method, MVideoRecorderUtilityObserver::MvruoPrepareComplete(), is called.• Call CVideoRecorderUtility::Record() to start recording.• Stop the recording by calling CVideoRecorderUtility::Stop().In our recipe, the CSimpleVideoRecorder class implementsMVideoRecorderUtilityObserver.Discussion: First, let’s take a look at the usage of CVideoRecorderUtility::OpenFileL().

This method requires several parameters, asshown below:IMPORT_C void OpenFileL(const TDesC& aFileName, TInt aCameraHandle,TUid aControllerUid, TUid aVideoFormat,const TDesC8& aVideoType=KNullDesC8,TFourCC aAudioType = KMMFFourCCCodeNULL);The first parameter, aFileName, is the filename to which the videoclip is saved.The aCameraHandle parameter is the handle to the camera touse for recording.

You can get the handle of the camera from theCCamera::Handle() method.The aControllerUid parameter is the UID of the controller to usefor recording. Phone manufacturers provide a controller plug-in to the262SYMBIAN C++ RECIPESMMF, and you must specify the UID of the video controllers in thisparameter. This is different from audio recording, where you don’t needto specify which controller because the audio recorder utility class selectsthe controller automatically based on the file extension.The aVideoFormat parameter is the UID of the video format torecord to, and it depends on the controller plug-in. If you specify a videoformat that is not supported by the controller, you will receive an error.The aVideoType parameter is the descriptor containing the videoMIME type.

Характеристики

Тип файла
PDF-файл
Размер
1,59 Mb
Материал
Тип материала
Высшее учебное заведение

Список файлов книги

Свежие статьи
Популярно сейчас
А знаете ли Вы, что из года в год задания практически не меняются? Математика, преподаваемая в учебных заведениях, никак не менялась минимум 30 лет. Найдите нужный учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
6392
Авторов
на СтудИзбе
307
Средний доход
с одного платного файла
Обучение Подробнее