2

I have just started to work on the Android Multimedia Framework (Stagefright) and have a basic idea of how local playback works in AwesomePlayer which uses OMXCodec.

I have been mapping my understanding using the MediaPlayer state diagram http://developer.android.com/reference/android/media/MediaPlayer.html and so far it has been pretty good. I have been able to map my understanding to the code.

But I look at the ACodec module (probably for streaming rtsp, HLS etc) I am finding difficulty. I am not able to understand how MediaCodec comes into picture.

I checked this article Android: MPEG4Writer fails to start when using OMXCodec as MediaSource but still not able to come to terms with MediaCodec.

  1. Is the flow diagram different for Streaming vs Local Playback.
  2. How is MediaCodec different from OMXCodec

I do know that the engine in case of Local Playback is Awesome which is replaced by NuPlayer in case of streaming.

Community
  • 1
  • 1
Sam2203
  • 21
  • 1
  • 3

1 Answers1

2

From an architectural perspective OMXCodec and ACodec are the lower most abstractions of an underlying OMX component. OMXCodec was the first one to be introduced, whereas ACodec came into picture with NuPlayer.

Both these entities work with an underlying OMX component and can support both audio and video codecs. However, some newer features such as Adaptive Playback, Miracast are supported through ACodec only for the reasons below.

MediaCodec is a native (NDK) and Java (SDK) level interface that provides an end-user to instantiate a standalone codec. Android has been exposing the building blocks such as MediaExtractor, MediaMuxer to provide better flexibility to application developers. MediaCodec is one such interface.

Internally MediaCodec instantiates an ACodec instance and hence, architecturally is a level higher than OMXCodec. All new features like Miracast, Adaptive Playback are reflected in MediaCodec only and hence, correspondingly the related changes are seen only in ACodec.

Ganesh
  • 5,880
  • 2
  • 36
  • 54
  • Thanks Ganesh for the prompt response. Are there any documents I can get for understanding NuPlayer architecture specially I have heard that from L-OS Google has moved the default engine to NuPlayer. – Sam2203 Nov 08 '14 at 17:05
  • @Sam2203 .. The best way to get to know more about `NuPlayer` is to look into the code. I am not sure if there is any published documentation, but there could be some useful information in forums like __SO__. In `Lollipop`, you are right that default player is `NuPlayer`, but `StagefrightPlayer` can also be enabled through system properties. Please have a look here http://androidxref.com/5.0.0_r2/xref/frameworks/av/media/libmediaplayerservice/MediaPlayerFactory.cpp#63 – Ganesh Nov 09 '14 at 00:24
  • @Sam2203.. If you are not satisfied with available literature, please do raise another question. Surely, some of us would be able to help out – Ganesh Nov 09 '14 at 04:47