symba (Symbian Books), страница 12
Описание файла
Файл "symba" внутри архива находится в папке "Symbian Books". PDF-файл из архива "Symbian Books", который расположен в категории "". Всё это находится в предмете "основы автоматизированного проектирования (оап)" из 3 семестр, которые можно найти в файловом архиве МГТУ им. Н.Э.Баумана. Не смотря на прямую связь этого архива с МГТУ им. Н.Э.Баумана, его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "основы автоматизированного производства (оап)" в общих файлах.
Просмотр PDF-файла онлайн
Текст 12 страницы из PDF
The broadcast industry already has its own set of technologies34MULTIMEDIA ARCHITECTUREand business models which are likely to be used in the early implementations of mobile TV. They tend to involve proprietary middleware andconditional access solutions. As such, third-party developers are not likelyto be able to access any mobile TV functionality via public APIs. Symbianis enabling the integration of mobile TV tuners via a common hardwareabstraction layer for device integrators and middleware vendors.In addition to broadcast services, mobile TV can also be delivered via3G mobile networks.
There are a number of different systems based onboth proprietary and open standards, such as Multimedia Broadcast Multicast Service (MBMS). They can involve streaming, progressive download,or download and play. The multimedia framework can be used in theimplementation of such services but specific details are beyond the scopeof this book. For more information on mobile TV, turn to Section 7.4.2.Links to the most up-to-date resources connected with this book canbe found on the wiki page at developer.symbian.com/multimediabookwikipage.3The Onboard CameraIn the previous chapters, we learnt about the multimedia subsystem andits components.
From this chapter onwards, we take a closer look ateach component. This chapter introduces you to the Onboard Cameracomponent.The chapter begins with an introduction to the Onboard CameraAPI. After understanding the need for a common API, we learn how toaccess and control the camera, through this API, to use the camera’s fullcapabilities. We then look at capturing still images and video frames andwe finish by looking at some advanced topics, such as multiple cameraclients.3.1 IntroductionAs cameras became more widespread on phones, different APIs wereintroduced by the phone manufacturers to allow developers to accessthe camera functionality.
Fragmentation began to occur; meaning thatdifferent camera handling code had to be written depending on the phoneplatform and the individual device’s capabilities.To resolve this, Symbian defined a common Camera API, the ECamAPI, which was first released in Symbian OS v7.0s. In each subsequentrelease of the operating system, additional functionality has been addedto cover the variety of camera hardware available, and to provide acommon API for developers to work with irrespective of the hardwareavailable on any particular Symbian smartphone.The ECam API provides functionality to display a viewfinder andcapture still images from the camera. It is also possible to use it forcapturing video; however we recommend that you use the video APIoutlined in Chapter 4.
The implementation of the camera API is notsupplied by Symbian since it is highly dependent on the hardwarearchitecture of each phone. Each phone manufacturer provides its own36THE ONBOARD CAMERAimplementation, using the same ECam API. You may therefore find thatthe behavior differs slightly between phones and manufacturers.3.2 Accessing the CameraThe ECam API is an open, extensible, generic API that provides functionality to control the digital camera on the phone and to request andreceive specific image data from it. Figure 3.1 shows where the ECamAPI is placed in the multimedia subsystem and the other multimediacomponents it interacts with.“Still Image”Client Application“Multimedia”Client Application(e.g. camera app)(e.g. video player)ImageConversionLibraryOnboardCamera APIMultimediaFrameworkMDFFigure 3.1 The multimedia subsystemFurther information about the Multimedia Framework can be found inChapters 4 and 5 of this book; the Image Conversion Library is discussedin Chapter 6.The onboard camera component provides images to its clients.
A clientmay be an application with image requirements, for example a cameraapplication, or an MMF video controller being used by a camcorderapplication (for information about video, look in Chapter 4). Clients havespecific priorities and may pre-empt others in their interactions with thecamera. When a camera client needs to share the camera with anothercomponent, it creates a handle to the camera and passes this handle tothe component (see Section 3.8).Platform security requires that applications have UserEnvironmentcapability to create a CCamera object.
Client applications should includethe ecam.h header file and link against ecam.lib.To access the camera, use CCamera::NewL() to create the object.Upon creation of the CCamera object, the method NewL() might leave;ACCESSING THE CAMERA37common leave error codes at this point are:• KErrPermissionDenied(-46) if the application does not havethe UserEnvironment capability.• KErrNotSupported(-5) if:• camera functionality is not supported. Some emulators do notsupport camera functionality and you must test on the device.• MCameraObserver2 observer is given, but only the olderMCameraObserver is supported (these callback interfaces arediscussed below).After the camera object is created the camera is reserved for your useby calling CCamera::Reserve().A client must implement a callback interface so that the camera cannotify it when events occur, such as when an image has been captured ora buffer of video data is ready.
The recommended callback interface toimplement is MCameraObserver2 since it provides extra functionalitysuch as allowing image capture without buffer copy and it unifies the presentation to the client of the images, video and viewfinder data. However,as MCameraObserver2 is still not widely implemented on S60 devices,we recommend also implementing the older MCameraObserver interface to provide compatibility with existing S60 smartphones.Before you attempt to access and use the camera on a Symbiansmartphone, you should first check that one exists. The static CCamera::CamerasAvailable() method returns the number of cameras present.Many phones capable of video telephony have more than one; often onefacing towards the user and one facing away.To initiate CCamera, simply call CCamera::NewL() which acceptsan observer parameter of MCameraObserver or MCameraObserver2,1specifying the index of the camera you want to use as the aCameraIndexparameter.// Determine the number of available camerasTInt camerasAvailable = CCamera::CamerasAvailable();TInt cameraIndex = 0; // range from 0 to camerasAvailable-1TInt priority = 0; // priority between -100 and 100// Try to create camera with MCameraObserver2// Note the current class must be derived from both observers so we// can just dereference the "this" pointerTRAPD(error, iCamera = CCamera::NewL(*this, cameraIndex, priority));if (error == KErrNotSupported){// if MCameraObserver2 is unsupported, try using MCameraObserveriCamera = CCamera::NewL(*this, cameraIndex);1 S60 3rd Edition FP2 SDKs use two separate functions for the different observer interfaces,NewL() and New2L().38THE ONBOARD CAMERA}else{User::LeaveIfError(error);}If you want to select a camera to use on the basis of its orientation or capabilities, you should instantiate a CCamera instance for eachone and check the capabilities using the CameraInfo() method.
Thismethod returns a TCameraInfo class that contains a variety of information about the camera in question, such as the camera’s orientation,iOrientation, and the options supported, iOptionsSupported.The iOrientation member can take one of the following values:• EOrientationOutwards – the camera faces away from the userand so would usually be used to take pictures.• EOrientationInwards – the camera faces towards the user and isprobably used for video telephony.• EOrientationMobile – the orientation of the camera can bechanged by the user; in this case, you cannot rely on knowingthe present orientation of the camera.• EOrientationUnknown – the orientation of the camera is notknown.Something that is not covered by these enumerations, unfortunately, isthat the camera can be mounted in portrait or landscape orientation withrespect to the viewfinder.
If your camera application is not in the sameorientation as the main camera application of the device, the cameraAPI will rotate the image – but you may find that the resolution you cancapture is restricted.The iOptionsSupported member of TCameraInfo is a bitfieldindicating a number of options that a camera supports. The values forthe bits are defined by enumeration TCameraInfo::TOptions. Thefollowing example values are useful in selecting a camera:• EImageCaptureSupported indicates that the camera can capturestill images.• EVideoCaptureSupported indicates that the camera can capturevideo.// member of classTCameraInfo info;// Retrieve camera informationCAMERA CONTROL39iCamera->CameraInfo(info);// Camera orientationTCameraInfo::TCameraOrientation orientation = info.iOrientation;// Supported modesTBool imageCaptureSupported = info.iOptionsSupported &TCameraInfo::EImageCaptureSupported;TBool videoCaptureSupported = info.iOptionsSupported &TCameraInfo::EVideoCaptureSupported;3.3 Camera ControlA client may not always be able to gain control of the camera.