Using hardware codec element in Android

Sebastian Dröge sebastian at centricular.com
Fri Apr 25 04:35:25 PDT 2014


On Fr, 2014-04-25 at 02:49 -0700, JYbob wrote:
> Hi , I'm trying to use hardware codec element in Android.
> 
> I saw this mail 
> http://lists.freedesktop.org/archives/gstreamer-android/2013-October/000629.html
> <http://lists.freedesktop.org/archives/gstreamer-android/2013-October/000629.html>  
> 
> and I commanded like this on my board(freescale),
> # cat media_codecs.xml
> 
>  <Decoders>
>         <MediaCodec name="OMX.Freescale.std.video_decoder.mpeg4.hw-based"
> type="video/mp4v-es" >
>             <Quirk name="requires-allocate-on-output-ports" />
>         </MediaCodec>
>         <MediaCodec name="OMX.Freescale.std.video_decoder.h263.hw-based"
> type="video/3gpp" >
>             <Quirk name="requires-allocate-on-output-ports" />
>         </MediaCodec>
>         <MediaCodec name="OMX.Freescale.std.video_decoder.avc.v3.hw-based"
> type="video/avc" >
>             <Quirk name="requires-allocate-on-output-ports" />
>         </MediaCodec>
>         <MediaCodec name="OMX.Freescale.std.video_decoder.vpx.hw-based"
> type="video/x-vnd.on2.vp8" >
>             <Quirk name="requires-allocate-on-output-ports" />
>         </MediaCodec>
> 
>         <MediaCodec name="OMX.google.mp3.decoder" type="audio/mpeg" />
>         <MediaCodec name="OMX.google.amrnb.decoder" type="audio/3gpp" />
>         <MediaCodec name="OMX.google.amrwb.decoder" type="audio/amr-wb" />
>         <MediaCodec name="OMX.google.aac.decoder" type="audio/mp4a-latm" />
>         <MediaCodec name="OMX.google.g711.alaw.decoder"
> type="audio/g711-alaw" />
>         <MediaCodec name="OMX.google.g711.mlaw.decoder"
> type="audio/g711-mlaw" />
>         <MediaCodec name="OMX.google.vorbis.decoder" type="audio/vorbis" />
> 
>         <MediaCodec name="OMX.google.mpeg4.decoder" type="video/mp4v-es" />
>         <MediaCodec name="OMX.google.h263.decoder" type="video/3gpp" />
>         <MediaCodec name="OMX.google.h264.decoder" type="video/avc" />
>         <MediaCodec name="OMX.google.vpx.decoder" type="video/x-vnd.on2.vp8"
> />
>     </Decoders>
> ...
> 
> I think <MediaCodec name="OMX.Freescale.std.video_decoder.avc.v3.hw-based"
> type="video/avc" > is hardwaredecoder.
> 
> but when I execute my bianary files to check decoder elements, the source
> code was :
> ...
> GList *elements = gst_element_factory_list_get_elements
> (GST_ELEMENT_FACTORY_TYPE_DECODER, GST_RANK_NONE);
> GList *l;
> 
> for (l = elements; l; l = l->next) {
>   GstElementFactory *f = l->data;
>   g_print ("factory: %s\n", GST_OBJECT_NAME (f));
> }
> gst_plugin_feature_list_free (elements);
> ..
>  
> 
> the result was :
> 
> factory:adpcmdec
> factory:alawdec
> factory:flacdec
> factory:flxdec
> factory:jpegdec
> factory:katedec
> factory:mulawdec
> factory:ogmaudioparse
> factory:ogmtextparse
> factory:ogmvideoparse
> factory:opusdec
> factory:pngdec
> factory:pnmdec
> factory:schrodec
> factory:speexdec
> factory:theoradec
> factory:vorbisdec
> factory:vp8dec
> factory:wavpackdec
> factory:amcauddec-omxgoogleaacdecoder
> factory:amcauddec-omxgoogleamrnbdecoder
> factory:amcauddec-omxgoogleamrwbdecoder
> factory:amcauddec-omxgooglemp3decoder
> factory:amcviddec-omxgoogleh263decoder
> factory:amcviddec-omxgoogleh264decoder
> factory:amcviddec-omxgooglempeg4decoder
> factory:amcviddec-omxgooglevpxdecoder
> factory:ivorbisdec
> factory:dvdec
> factory:sirendec
> factory:decodebin
> factory:uridecodebin
> 
> there was noting about harware decoder.
> 
> and I knew that decodebin is automatically find decoder and use it. so, I
> make the pipeline like this 
> 
> gst_parse_launch(filesrc location=/data/sample.h264 ! queue ! h264parse !
> queue ! decodebin ! autovideosink);
> 
> I check GST_DEBUG=4 to check more specific.
> the result was 
> 
> 0:00:01.046712667  3488 0x42082600 INFO                     amc
> gstamc.c:1668:scan_codecs: Checking codec
> 'OMX.Freescale.std.video_decoder.avc.v3.hw-based'
> 0:00:01.046931667  3488 0x42082600 INFO                     amc
> gstamc.c:1690:scan_codecs: Skipping non-Google codec
> 'OMX.Freescale.std.video_decoder.avc.v3.hw-based' in standalone mode
> 0:00:01.756036001  3488 0x43249830 INFO              GST_STATES
> gstbin.c:2656:gst_bin_change_state_func:<decodebin0> child
> 'amcvideodec-omxgoogleh264decoder0' changed state to 4(PLAYING) successfully
> 
> they know that there is hardware decoder, but decodebin finally matched the
> cviddec-omxgoogleh264decoder.

The problem here is that you run gst-launch directly on an Android
device (and the androidmedia plugin had to start dalvik, that's the
standalone mode). The hardware codecs only work reliably if you use them
from inside a Android app and dalvik and everything else is started by
Android.

-- 
Sebastian Dröge, Centricular Ltd - http://www.centricular.com
Expertise, Straight from the Source
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140425/834569c0/attachment-0001.sig>


More information about the gstreamer-devel mailing list