If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

BB10 Camera API

After seeing the BB10Jam DEV179 session and reviewing the BB10 Camera Library reference I must say I'm quite impressed. It seems like a very complete and well-designed API. Well done folks!

 

Of course I have some questions and comments, and I'm hoping the RIM folks (Sean?) will jump in and join the discussion here.

 

To kick things off, here are my thoughts:

 

  1. during video recording, can a callback decide to skip frames? This could be interesting for HDR video, timelapse or motion-activated recording.
  2. does camera_set_video_property() with CAMERA_IMGPROP_FRAMERATE work for framerates < 1.0 fps, e.g. timelapse?
  3. if a callback modifies the raw image buffer, are the changes respected downstream? E.g. to add an effect, overlay captions etc.
  4. is mp4 compression during video recording hardware accellerated? If so, is there any reason why we couldn't use that to compress other (processed or non-recorded) video by simply recording a video but replacing the content with our own in a callback? Of course an API to use the hardware accelleration independant of the camera would be better, but this might be a stop-gap solution.
  5. any tips on debugging callbacks where timing may be an issue, e.g. in video recording? Are there thread issues to keep in mind?
  6. is there any way to start developing with the API on PlayBook, for those of us who don't have a Dev Alpha yet?

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
Developer
peter9477
Posts: 6,473
Registered: ‎12-08-2010
My Device: PlayBook, Z10
My Carrier: none

Re: BB10 Camera API

I think I can answer #3 at least, which is that the callback has full access to modify the buffer if it wants to, with changes seen downstream. For performance reasons (among others?) there's very little copying going on, so the callback is getting direct access to the real buffer(s).

Peter Hansen -- (BB10 and dev-related blog posts at http://peterhansen.ca.)
Author of White Noise and Battery Guru for BB10 and for PlayBook | Get more from your battery!
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BB10 Camera API

Good questions.  Answers are as follows:

 

1.  Not with the available API.  The video encoder and user callbacks operate in parallel, so one cannot interrupt the other.  There is a "filter" mode callback which is not yet exposed which would allow you to do this, as the filter sits ahead of all of the other callbacks in the pipeline.  Alternately, if you implement your own encoder, you can do whatever you want.

 

2.  Might not be in 10.0.4, but we do have a camera_get_video_vf_framerates() implemented which reports available framerates.  While CAMERA_IMGPROP_FRAMERATE is exposed as floating-point already, internally it is currently being rounded to an int.  I would like to get fractional rates working in the future (we are dealing with Q16's at the h/w level), but I was not sure if the video encoder would respect it.  If you want to run at a very low framerate today, a software encoder and your own discard logic would do the trick.  At <1fps, this is definitely doable.

 

3.  Yes, however you need a read/write callback for this.  In 10.0.4, only read-only callbacks are exposed.  This functionality should be publicly available by launch.

 

4.  Yes it is.  And yes you could.  There is a QNX framework called MMF (multimedia framework) which we are using to do the encoding, and in fact, the encoding is happening in your application process' context.  MMF is a bit unwieldy to work with, but I am hoping that eventually, the multimedia team can expose a friendly API for general consumption.

 

5.  All callbacks run in their own thread.  Not sure what else to tell you.  That being said, there is an event-based API which should be available in the next s/w release in case you want to pull all of your callbacks back into a single thread (or as many threads as you want).

 

6.  Not in the 2.0.1 release.  I can't speak as to when it will be available, however I can tell you that 2.0.1 is the last playbook release which used the old API-less camera architecture.

 

 

Again, appologies for the lack of example code.. maybe if I find some spare time this weekend or late at night, I can clean up one of my demos and get it up on github.  I will endeavour to answer any technical questions you have though if you are stuck.

 

Cheers,

Sean

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: BB10 Camera API

[ Edited ]

Thanks for the details, Sean! Is this what you mean by MMF used for hardware assisted encoding? The last release there is from 3 years ago. Am I looking in the right place?

 

I've scanned through the various documents, and there seems to be little mention of MMF or (video) encoding except for a brief sample in "MME Utilities reference" about io-media-generic.

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BB10 Camera API

That's the precursor to it.  It has continued to evolve for PlayBook and BB10 platforms.  Those docs will give you an idea of what I am talking about, but will not likely be particularly useful to you.  MMF is not publicly available except to QNX's partners and vendors who are integrating into their products.  The variant on PlayBook evolves and breaks backwards compatibility frequently, so isn't particularly well suited to use by developers.

That being said, I'd be delighted if someone would commit to formalizing a subset of the API and making it publicly available.  This is what mm-renderer is built on top of, FYI.

 

Cheers,

Sean

Please use plain text.
Developer
Innovatology
Posts: 1,280
Registered: ‎03-03-2011
My Device: Playbook, Z10, Q10, Z30 with Files & Folders and Orbit of course
My Carrier: Vodafone

Re: BB10 Camera API


smcveigh wrote:

That's the precursor to it.  It has continued to evolve for PlayBook and BB10 platforms.  Those docs will give you an idea of what I am talking about, but will not likely be particularly useful to you.  MMF is not publicly available except to QNX's partners and vendors who are integrating into their products.  The variant on PlayBook evolves and breaks backwards compatibility frequently, so isn't particularly well suited to use by developers.


OK, so it's software only encoding for now. Still, such low-level access to the camera will be a big step in the right direction.


That being said, I'd be delighted if someone would commit to formalizing a subset of the API and making it publicly available.  This is what mm-renderer is built on top of, FYI.


I'd have a good look at OpenMAX. Why reinvent the wheel?

 

Files & Folders, the unified file & cloud manager for PlayBook and BB10 with SkyDrive, SugarSync, Box, Dropbox, Google Drive, Google Docs. Free 3-day trial! - Jon Webb - Innovatology - Utrecht, Netherlands
Please use plain text.
BlackBerry Development Advisor
smcveigh
Posts: 665
Registered: ‎11-29-2011
My Device: developer
My Carrier: other

Re: BB10 Camera API

Oh don't worry.  We're intimately familiar with OpenMAX.

And h/w encoding is available to you today via the camera API, but only in the use cases that I have provided right now (eg. camera input, fixed set of framerates, sizes, etc.)

 

Cheers,

Sean

Please use plain text.
Guru I
Xandrex
Posts: 18,380
Registered: ‎07-29-2008
My Device: Z10 10.1.0.2312 / Playbook 2.1 / 8900 5.0
My Carrier: Vodafone France (SFR) & B&You

Re: BB10 Camera API

just a follow-up... OpenMAX is now on the Native roadmap. Expected in may 2014.

 

http://developer.blackberry.com/native/downloads/roadmap/




The search box on top-right of this page is your true friend, and the public Knowledge Base too:
Please use plain text.
Developer
knobtviker
Posts: 115
Registered: ‎05-31-2013
My Device: BlackBerry Z10 Limited Edition
My Carrier: Bonbon

Re: BB10 Camera API

Oh I'm so gonna milk that one...

Please use plain text.