2013年9月12日星期四

How to video decoder ported to Android,

Boss wants AVS decoder ported to Android 2.3 system, but do not know how to start younger now , please prawn kind , if there is relevant information for the better , thank you .
------ Solution ---------------------------------------- ----
can reference framework / base / media / libstagefright / AwesomePlayer.cpp in
sp OMXCodec :: Create (
const sp & omx,
const sp & meta, bool createEncoder,
const sp & source,
const char * matchComponentName,
uint32_t flags)
function .
android created in the inside soft decoder
soft decoders are generally derived from MediaSource.
can only provide so much help .
------ Solution ---------------------------------------- ----
1 write java side player, leaving jni interfaces
2 Use your local code c ( already decoded code ) to achieve this jni interface.

1> about writing player, I came up with a basic interface layout outside , you will use SurfaceView is the underlying support opengl drawing view. this if you do not know , look at the code to find some game engine would be helpful .

your entire process flow is

player to open the file , get the input stream , the input stream to the decoder , the decoder decoding , the decoder output stream , the output stream to java side , java -side call SurfaceView drawing.

Or I look at some game graphics , also used the c + + code, you can refer to , so that should be more efficient .


------ Solution ------------------------------------ --------
transplant decoders only, no need to also have to write their own players , right
Reference libstatefright / codecs directory code encapsulation start, stop, read three interfaces can be
------ eference -------------- -------------------------
understand Bangding ......
If you are using C / C + + code decoder , can not pass or ndk jni call asv decoder interface functions ?
------ eference --------------------------------------- < br> I'm looking for some information on the Internet , or NDK using JNI should be able to achieve this function , but the internet, said all good fuzzy , do not really understand the whole process , so under the guidance of experts .

------ eference ------------------------------------ ---
  This reply was moderator deleted at 2011-04-06 15:09:46

------ eference ------------------------------------ ---
make the necessary third-party interface can only call it using JNI or NDK

Android source code media player is also achieved through this method , multi vivid example yet.
framework / ....... / various functions . cpp
jni call to put some result value returned to the upper java
packages / apps / ...... / various corresponding functions . java

Just try it

------ eference ------------------------------------ ---
  This reply was moderator deleted at 2011-04-06 10:03:29

------ eference ------------------------------------ ---
attention to the next
PS: 6 Floor android avatar too , haha ​​
------ eference ------------------------- --------------
look at it , I also do transplants, head hurts
------ eference ---------- -----------------------------
without any problems, you can achieve the OMX, component, and then inherited into OPENCORE or STAGEFRIGHT calls inside
------ eference -------------------------------------- -
Thank you very much , I now see in the media player android realization method, but no experience , please enlighten look for specific examples of what is good , thank you ~ ~

------ eference ------------------------------------ ---
initial idea is to AVS decoder as omx plugin , then use omx interface calls back to the top of the decoder , the reality decoding capabilities. However , I might not be looking for information , I could not find how to add to the omx decoder information , please enlighten prawn how to do the next , thank you

------ eference ------------------------------------ ---
  This reply was moderator deleted at 2011-04-14 09:17:31

------ eference ------------------------------------ ---
good , thank you. You can be more careful next, specifically to see what code do ? I did not find in libstagefright catalog codecs. . .

------ eference ------------------------------------ ---
how to ask the landlord to do , and I have to transplant decoders , there is no clue
------ eference --------------- ------------------------
I also do , looked back , 13L answer should be the best,
is no need to write anything jni call interface directly using standard meidaPlayer write a simple application on the line , csdn there are many player download ,
To expand decoder ( I do is based on 2.2 , 2.2 are used statefrightPlayer framework after the process )
first understand the system itself, call flow , statefrightPlayer use AwesomePlayer to achieve,
So from Awesomeplayer began to look on the line , the first is the realization of the separator , the system itself does not support the format is no separator ,
specifically look at the code ( I only play local files for example , do not say Internet streaming ) ,
Awesomeplayer.cpp of setDataSource_l (
const sp & dataSource) {
sp extractor = MediaExtractor :: Create (dataSource);

This is the place to create a separator , View Code MediaExtractor.cpp the create function , datasource 's sniff function is to automatically detect the type of container of media formats , the main floor of the original system does not recognize new media formats , must not be effective separator, so here need to create your own splitter , I no corresponding sniff write their own functions , each format XXXXExtractor.cpp functions have SniffXXXX function constructor in Awesomeplayer this one DataSource :: RegisterDefaultSniffers () is to register a good sniff all functions , the amount of points that you want to standardize so doing, to write an own XXXExtractor class , still write XXXXsinff function, RegisterDefaultSniffers add your own functions ,
then is how to achieve their own splitter , this was their own way , and to see what your media format , there will be a corresponding separation logic , separated audio and video stream, is to enter the decode stage of the ,
status_t AwesomePlayer :: initVideoDecoder () {
mVideoSource = OMXCodec :: Create (
mClient.interface (), mVideoTrack-> getFormat (),
false,
mVideoTrack);
this is to create a decoder , create the last parameter is separated from the independent video streams , with the most important thing is to read interface, the interface is implemented in the separator , this track is XXXXExtractor in getTrack acquired their own bar code carefully to see more , there are many details that need her own , I only said about,
Then decoder implementation , estimated landlord active bar code, the corresponding video stream format corresponds to your own decoders,
decoder logic mainly concentrated in OMXCodec.cpp in , sp softwareCodec =
InstantiateSoftwareCodec (componentName, source);
This function is to find the decoder , you definitely want to kDecoderInfo array inside to add your own codec name , registered in kFactoryInfo create your own decoder function ,
similar process is this put on display some do not have control , the decoder butt render part , they will be ready , the most important foreign decoder interface is also a read interface , returns a decoded frame after the data ,
------ eference ------------------------------------ ---
OMX saw a bunch of information , but do not know how dynamic loading its own decoder
------ eference ---------------- -----------------------

let OMX dynamic loading its own decoder do ?
------ eference --------------------------------------- < br>

looks like it was necessary to re- compile
------ eference ----------------------------- ----------

I think so too , felt that it needs to re- build system , applications can not do
------ eference - --------------------------------------
look at it , I also do transplants , his head hurt
------ eference ------------------------------------ ---
I also do not know transplant transplant transplant decoder library functions and has set up what difference
------ eference ------- --------------------------------
nobody answered this question ah
------ eference ---------------------------------------
a source , then it will use the NDK compile source code for the library file that can be invoked by the Java through JNI can also be invoked by the C language

------ eference ------------------------------------ ---
landlord Hello , I want to ask , your decoder successful transplantation did not , and now the boss let me do the same work with you , want to talk to you next . Thank you !
------ eference --------------------------------------- < br> I have to do the same job , how about get upstairs ?
------ eference --------------------------------------- < br>

没有评论:

发表评论