Kodi Community Forum
Android how to add hardware video decoding support - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: Android (https://forum.kodi.tv/forumdisplay.php?fid=164)
+---- Thread: Android how to add hardware video decoding support (/showthread.php?tid=143640)

Pages: 1 2 3 4


RE: how to add hardware video decoding support - davilla - 2012-12-23


dvdplayer/amcodec solutions has added tricks to keep a/v sync. But until we see how HISPlayer does this, it would be hard to recommend how to do the same.


RE: how to add hardware video decoding support - sonach - 2012-12-24

(2012-12-23, 11:54)Memphiz Wrote: you got it right - davilla implemented an amlcodec for usage with the dvdplayer Smile
Cool! This provides a good guideline for us!

(2012-12-23, 18:02)davilla Wrote: dvdplayer/amcodec solutions has added tricks to keep a/v sync. But until we see how HISPlayer does this, it would be hard to recommend how to do the same.

davilla,
I think "until we see how HISPlayer does this" should mean "until we see what the vendor(in our case, it is hisilicon) provides "?

your dvdplayer/amcodec solution does give us another direction to do our work. we will look into this when doing further work and we are appreciated to know your progress Smile


RE: how to add hardware video decoding support - sonach - 2012-12-24

(2012-12-23, 18:02)davilla Wrote: dvdplayer/amcodec solutions has added tricks to keep a/v sync. But until we see how HISPlayer does this, it would be hard to recommend how to do the same.

another question.
Since you have implemented an amcodec, what do you do with the decoded data(put it directly to EGL texture?)? where do you render it?
AFAIK, one of the difficulty of using hw video decode is how to handle the decoded data(some vendors even doe not privde the API to get the decoded data). So in HISPlayer situation, we just don't care about the decoded data, just let it be in the black-box Tongue


RE: how to add hardware video decoding support - davilla - 2012-12-24

Since aml decodes to a separate video plane that is not accessible by OpenGLES, dvdplayer and renderer runs in a bypass mode where it knows where the video is set to appear and makes a hole for it. Otherwise, it does nothing to render it as it does not handle the actual rendering of the video frames.

Most embedded solutions work the same way with hardware decoders, video is actually decoded to a separate video plane that is under the framebuffer/opengles layer and they are blended together with a hw scaler.




RE: how to add hardware video decoding support - sonach - 2012-12-24

(2012-12-24, 04:31)davilla Wrote: Since aml decodes to a separate video plane that is not accessible by OpenGLES, dvdplayer and renderer runs in a bypass mode where it knows where the video is set to appear and makes a hole for it. Otherwise, it does nothing to render it as it does not handle the actual rendering of the video frames.
Most embedded solutions work the same way with hardware decoders, video is actually decoded to a separate video plane that is under the framebuffer/opengles layer and they are blended together with a hw scaler.
(1) Yeah, "dvdplayer and renderer runs in a bypass" that is a keypoint! hisilicon also decodes video to a seperate video plane called VO Smile
(2) the question is, what is the advantage of writing a delicated amcodec over writing a delicated AMLPlayer? both are hardware specific... Maybe the former solution can share some code with other hardware(for example, hisilicon)?



RE: how to add hardware video decoding support - davilla - 2012-12-24

The advantage is the ability to handle the various input streams that dvdplayer can handle such as hts (tvheadend), pvr and rtmp. These are a pain to duplicate and is what lead me to look again at dvdplayer+amcodec. Subtitle handling as well as HD audio too.



RE: how to add hardware video decoding support - sonach - 2012-12-24

davilla, got your point!
Maybe this solution is by far the best for STB hardwareSmile


RE: how to add hardware video decoding support - adolph - 2013-01-06

(2012-12-23, 18:02)davilla Wrote: dvdplayer/amcodec solutions has added tricks to keep a/v sync. But until we see how HISPlayer does this, it would be hard to recommend how to do the same.

hi davilla, I want to know some details about your dvdplayer/amlcodec, and could you please offer the link to your source code ?


RE: how to add hardware video decoding support - davilla - 2013-01-06

you blind ? Smile

https://github.com/pivosgroup
https://github.com/Pivosgroup/xbmc/blob/master/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
https://github.com/Pivosgroup/xbmc/blob/master/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp



RE: how to add hardware video decoding support - adolph - 2013-01-22

(2013-01-06, 15:50)davilla Wrote: you blind ? Smile

https://github.com/pivosgroup
https://github.com/Pivosgroup/xbmc/blob/master/xbmc/cores/dvdplayer/DVDCodecs/Video/AMLCodec.cpp
https://github.com/Pivosgroup/xbmc/blob/master/xbmc/cores/dvdplayer/DVDCodecs/Video/DVDVideoCodecAmlogic.cpp

hi, davilla. I read your code and I have some questions. In your AMLCodec method, the video stream use hardware decoder and the audio stream use software decoder, right? And without enough media knowledge, I did not understand the way how to synchronize video and audio.

By the way, I follow your code and do some simple test on our own platform. Now I can only play some videos.


RE: how to add hardware video decoding support - davilla - 2013-01-22

see CAMLCodec:Tonguerocess

get_pts_video returns the pts of the last video frame that was presented by hw decoder

GetPlayerPtsSeconds returns the pts of dvdplayer according to the audio clock

SetVideoPtsSeconds is where we tell the hw video decoder to adjust its presentation pts to match dvdplayer.



RE: how to add hardware video decoding support - adolph - 2013-01-23

(2013-01-22, 17:35)davilla Wrote: see CAMLCodec:Tonguerocess

get_pts_video returns the pts of the last video frame that was presented by hw decoder

GetPlayerPtsSeconds returns the pts of dvdplayer according to the audio clock

SetVideoPtsSeconds is where we tell the hw video decoder to adjust its presentation pts to match dvdplayer.

thank you very much, I will go to see the code you point out.


RE: how to add hardware video decoding support - sonach - 2013-01-23

(2013-01-22, 17:35)davilla Wrote: see CAMLCodec:Tonguerocess

get_pts_video returns the pts of the last video frame that was presented by hw decoder

GetPlayerPtsSeconds returns the pts of dvdplayer according to the audio clock

SetVideoPtsSeconds is where we tell the hw video decoder to adjust its presentation pts to match dvdplayer.

so now audio is decoded by CPU? It seems that it is a bit CPU-intensive(total CPU% is 65% when playing one TS file with video-hw-decode) on our hardware.


RE: how to add hardware video decoding support - davilla - 2013-01-23

(2013-01-23, 04:42)sonach Wrote:
(2013-01-22, 17:35)davilla Wrote: see CAMLCodec:Tonguerocess

get_pts_video returns the pts of the last video frame that was presented by hw decoder

GetPlayerPtsSeconds returns the pts of dvdplayer according to the audio clock

SetVideoPtsSeconds is where we tell the hw video decoder to adjust its presentation pts to match dvdplayer.

so now audio is decoded by CPU? It seems that it is a bit CPU-intensive(total CPU% is 65% when playing one TS file with video-hw-decode) on our hardware.

Patches welcome to enable hw audio decode with dvdplayer Smile Your choice is use amlplayer or dvdplayer, dvdplayer handles much more network streaming formats than amlplayer.




RE: how to add hardware video decoding support - sonach - 2013-01-23

(2013-01-23, 04:52)davilla Wrote: Patches welcome to enable hw audio decode with dvdplayer Smile Your choice is use amlplayer or dvdplayer, dvdplayer handles much more network streaming formats than amlplayer.

We are evaluting amlplayer solution and dvdplayer solution at the moment. If dvdplayer solution is better for us, we might try to enable hw audio decode. If we can get it work, we are happy to share the workSmile
I agree with you, dvdplayer solution is more 'generic' than amlplayer solution. Amlplayer solution depends heavily on vendor's SDK.