Android Custom Wrapper Codec Integration

I need to develop my own video wrapper codec and integrate it into android (JB for now, ICS later). We want to use some custom decryption keys from the SIM card (don't ask!). The best way (which will allow it to work together with other unencrypted media and use a standard media player or another), apparently, is to define our own type of mime and associate it with a custom wrapper codec that can execute custom decrypt, and then transfer the data to a real codec. (Let's say now the file type .mp4.)

(An alternative might be to write your own media player, but we don’t want to go this route, because we really want the media to be displayed along with other media)

I am trying to follow this guide: how to integrate a decoder into a multimedia infrastructure

  • I'm having problems registering OMX Core. I can create libstagefright.sofrom the android source by typing make stagefright, but in the manual it says use libstagefrighthw.so, which seems suitable for JB, but I'm not sure how to do it, it does not seem to be built from use make stagefright, if I am not doing something wrong?

  • Another problem is that even if I get a registered custom codec wrapper, I’m not sure how to go about transferring data to a real codec.

If someone has suggestions (or some child can give step-by-step instructions!), I would really appreciate it - the deadline for proving the concept is pretty tight, and I know very little about codecs or media infrastructure ...

Many thanks. (ps I do not want to fight mud about drm and analog holes, etc., thanks)

+5
source share
1 answer

In this post I use H.264as an example, but the solution can be extended to support other types of codecs MPEG-4, VC-1, VP8etc. There are 2 possible solutions to solve your problem, which I give below, each with its pros and cons, to help you make an informed decision.

Solution 1. Codec extension to support the new mode

JellyBean OMX MIME, , : OMX.ABC.XYZ OMX.ABC.XYZ.secure. . , , .. MediaExtractor . OMXCodec::Create findMatchingCodecs , , .secure .

:

  • , OMX.H264.DECODER.decrypt - . media_codecs.xml. , factory factory - .

  • , , , kKeyDecryptionRequired. Metadata.h quirk OMXCodec.h.

  • OMXCodec::Create, .decrypt, .secure, .

  • OMXCodec, Metadata, MediaExtractor libstagefright.so .

Voila!! . . .decrypt.

, , , .decrypt , decryption OMX_EmptyThisBuffer, .

: , Android, , MIME.

: , , , .decrypt. Google , / .

2: MIME

, MIME , , , .

:

  • MIME MediaDefs, . , MIME const char *MEDIA_MIMETYPE_VIDEO_AVC_ENCRYPT = "video/avc-encrypt";

  • MIME media_codecs.xml. , , .

  • OMXCodec::setVideoOutputFormat MIME, H.264 . , OMXCodec MIME.

  • MediaExtractor MIME video, . .

: ? , , , OMX_EmptyThisBuffer.

: , .

: -, . MIME Stagefright. , OMXCodec MediaExtractor. , MP4, , AVI, MKV, MIME ,

, .

  • 1, .

  • ACodec. , 1 , .

  • ​​ OMX, libstagefrighthw.so. FYI, , vendor/<xyz>/hardware/.... libstagefrighthw.so.

+9

All Articles