Allow sequential frame retrieval to reuse the decoder without
re-init and re-seek.
Get rid of IMediaMetadataRetriever api that retrieves multiple
frames at a time, this method could hold up more memory than
what's needed, because the client side has to copy the frames
to a separate set of bitmaps anyways.
This change is needed to support animation Drawbles efficiently
which typically get one frame at a time.
bug: 120414514
test: cts MediaMetadataRetrieverTest, local tests that tests MetadataRetriever thumbnails
Change-Id: I09924408b51bc7491fc5dee121dce9a286c5911f
Add an api to IMediaMetadataRetriever to decode image rect.
It will reuse the same full frame IMemory, and decode only
the requested rect. For now, StagefrightMetadataRetriever
will only allow decoding of rect that's a full row of tiles,
and the requested must be issued sequentially (i.e. no
arbitrary rects). When the extract side is fixed to allow
seeking by tiles, it can be extended to allow arbitrary
rects.
This allows HeifDecoderImpl (on client side) to start
processing the getScanlines in parallel with the decoding.
Test: CTS MediaMetadataRetrieverTest;
Manual testing of HEIF decoding of files with or without tiles;
Manual testing of HEIF thumbnails generation in Downloads app.
bug: 78475896
Change-Id: I820b21cdf33f80593ee6092d8e1ba68b3beb65dd
This change refactors ImageDecoder to prepare it for reuse
for multi-slice decoding. There is no functional change.
bug: 78475896
Test: CTS MediaMetadataRetrieverTest;
Manual test of HEIF image decoding and thumbnail extraction.
Change-Id: I8c16042020c7db3d3714d22322e6304ea4192e33
Add plumbing to retieve the embedded thumbnail from
MPEG4Extractor/ItemTable.
bug: 74395267
Test: CTS MediaMetadataRetriever test; manual test of thumbnail
extraction by browsing new folders containing heif files in
Downloads app.
Change-Id: Ic49f6dfa47eddc229b9f4b0e1835d58df1dce9f8
Adding support for two new sets of APIs on MediaMetadataRetriever:
- getImageAtIndex() and getPrimaryImage()
- getFrameAtIndex() and getFramesAtIndex()
Outline of changes:
- Proper indexing of all displayable still images, so that they
can be retrieved by getImageAtIndex()
- Exposing still images as "image/x.android.heic" tracks in
MediaExtractor with necessary descriptive keys (such as "grid-*")
- Support to retrieve video frames by absolute index instead
of timestamps, as image use cases mostly are interested in
getting the images and care less about timing.
- Support to retrieve video frames in batches because retrieving
one frame at a time is inefficient.
- Refactor image / frame decoding code into FrameDecoder, and split
still image decoding and video sequence decoding into to sub
classes to facilite future development.
bug: 63633199
test:
cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
Change-Id: I2fe8519fb6907f315a8b513921fc1cc7f436e28d
- Allow setDataSource() to specify mime. In case of HEIF decoding
request from skia, we don't want to sniff any other format other
than mp4.
- Allow getFrameAtTime() to specify dst color format.
bug: 64077740
Test: cts-tradefed run cts-dev --module CtsMediaTestCases --compatibility:module-arg CtsMediaTestCases:include-annotation:android.platform.test.annotations.RequiresDevice
Change-Id: I471f41c28a2252417c4b3331dcfd4bd00a24408a
This allows apps to implement MediaDataSource, which is modeled on
stagefright's DataSource, to supply media data to the framework. This
was already implemented for MediaExtractor, but it was renamed from
DataSource.
MediaExtractor, MediaPlayer and MediaMetadataRetriever each have a new
overload: #setDataSource(android.media.MediaDataSource)
Only NuPlayer supports this new data source.
The change introduces:
* IDataSource: The binder interface for DataSource.
* JMediaDataSource: The native counterpart to the java interface. It
implements IDataSource.
* CallbackDataSource: A stagefright DataSource that wraps an
IDataSource.
Change-Id: Ib3c944b49cc8a792c8eb9c85e5015c07f298ebc1
o Removed setMode() methods and related mode constants
o Removed some of the unused the metadata keys
o Updated the javadoc
o part of a multi-project change.
bug - 2433195
Change-Id: I5ed167f1fd6a53cb143b7dc385b149431d434438
This patch modifies the native binder interface to the metadata
retriever to pass the caller's thread group across the binder
interface. On the server side, the thread scheduler group is
set to the caller's scheduler group temporarily and restored
after the request has completed. This patch also reverts a
previous patch where the priority of the thread was forced to
a low priority foreground thread.
This should give apps more control over the priority of their
metadata retrieval, particularly allow background process to
run without hogging the CPU.
This change forces metadata retreiver threads to background priority.
Uses an inner class to encapsulate the priority change so that it
automatically restores priority when returning to the client.
1. mRetriever was initialized twice: one in the constructor and the other in the setDataSource
2. cached the mode so that setMode can still be called before setDataSource.
mRetriever won't be initialized until data source is set; thus we have to do this