I wanted to change the code as less as possible to I tried to use
MediaMetadataRetriever and
I found an easier way to import MediaMetadataRetriever or any non-
public api.
1. remove {@hide} in MediaMetadataRetriever.java (so it can be a
public class like MediaPlayer.)
2. m or make in mydroid root (this build will take a while.)
3. make update-api (this script copies mydroid/out/target/common/obj/
PACKAGING/public_api.xml to mydroid/frameworks/base/api/current.xml)
4. replace sdk's android.jar with mydroid/out/target/common/obj/
JAVA_LIBRARIES/android_stubs_current_intermediates/javalib.jar
now you can use MediaMetadataRetriever in eclipse.
But when I try to use MediaMetadataRetriever, I found something
strange.
1. MediaMetadataRetriever.java's setMode(value) calls
metadatadriver.cpp's setMode(value),
but framemetadatautility doesn't use this value but uses
PV_FRAME_METADATA_INTERFACE_MODE_SOURCE_METADATA_AND_THUMBNAIL.
2. I happend to make a small bug in my cpm plugin so it returned
PVMFFailure in DoReset().
Because of this PVMFFailure, PVPlayerEngine::HandleSourceNodeReset
never calls RunIfNotReady() and the whole process stops.
I think whether DoReset returns PVMFSuccess or not,
PVPlayerEngine::HandleSourceNodeReset should call RunIfNotReady() so
PVPlayerEngine::Run() can be called.
3. MediaMetadataRetriever.setDataSource() calls cpm plugin's
UsageComplete. This is quite frustrating to me... I don't want
MediaMetadataRetriever to decrease the drm count. I don't know if I
can tell I actually playback the content or just get metadata of it.
Unless the third issue is solved, I will try the way to add getMetadata
() method in MediaPlayer.java and modify related files (jni,
opencore).
If there is any better way, Please tell me...
On Sep 22, 6:28 am, RaviY <
yend...@pv.com> wrote:
> On Sep 21, 12:14 pm, Hedge <
awoo...@gmail.com> wrote:> @NoraBora - Yes, I'm glad we're not the only ones interested in this
> > topic!
>
> > PVPlayerExtHandler sounds interesting, but adding an arbitrary
> > getMetadataValue(String query) to MediaPlayer would seem the easiest
> > solution (similar to MediaPlayer's getDuration, getVideoHeight, etc.)
> > Maybe there is a good reason why this wouldn't work or is inelegant?
>
> There is one in works already.
>
>
>
> > On Sep 21, 10:03 am, Hedge <
awoo...@gmail.com> wrote:
>
> > > As Ravi and I said, MediaMetadataRetriever is not a public API, so you
> > > can't just import it into your app. However, if you have access to
> > > the source (i.e. on the emulator, or you're working with an OEM) you
> > > can add it manually. Here's how I added it to my emulator
> > > environment:
> > > To use MediaMetadataRetriever, compile it with JAVAC
> > > e.g. javac -classpath ".;...\android-1.5\android.jar" android\media
> > > \MediaMetadataRetriever.java
> > > Then add the class file to the android.jar file with JAR.
> > > e.g. jar uf android.jar android\media\MediaMetadataRetriever.class
>
> > > I agree, we need a way to accessmetadatafrom the MediaPlayer class.
> > > Otherwise what is the point of havingmetadataand implementing the
> > > MetadataInterface? I am very interested in hearing more about this
> > > PVPlayerExtHandler.
>
> > > On Sep 20, 7:15 pm, Hyeong-Ho Yoo <
noranb...@gmail.com> wrote:
>
> > > > Thank you for your quick reply, RaviY.
>
> > > > You suggested using MediaMetadataRetriever but I can't import it in
> > > > emulator.
> > > > (I'm working with windows xp emulator & sdk 1.5r3)
> > > > How can I use unpublished API?
>
> > > > If it is not possible to import, I think of adding a extractMetadata method
> > > > to MediaPlayer.java by myself..
> > > > Because using MediaMetadataRetriever and MediaPlayer seems ineffective for
> > > > me.(file open twice, init twice, close twice) MediaPlayer.getDuration &
> > > > MediaMetadataRetriever.extractMetadata will be good references, I guess...
>
> > > > Or is this a solution you mentioned below('We will arrive at a solution
> > > > soon.), hopefully..? merging MediaMetadataRetriever to MediaPlayer?
>
> > > > 2009/9/20 RaviY <
yend...@pv.com>
>
> > > > > - As mentioned above, with the current order of events in the SDK
> > > > > below, there is no good place, that I can think of, for the app. to
> > > > > show the user the DRM information before consuming an additional count
> > > > > of license. We will arrive at a solution soon.
> > > > > - One way, which is very kludgy, to achieve what you are trying to do
> > > > > is .. (a) user selects a clip, (b) you start a MediaMetadataRetriever
> > > > > and retrieve the requiredmetadatato show the user, (c) show a dialog
> > > > > box to the user, and (d) when user says "continue", you start a
> > > > > MediaPlayer.
> > > > > - PVME is theMetadataEngine. This is a special engine designed for
> > > > > fast retrieval of arbitrarymetadata. This is -not- intended to be
> ...
>
> read more »