Permalink
Browse files

Merge pull request #4577 from Stane1983/mainline

Patch for KitKat 4.4 and 4K video using AMLCodec
  • Loading branch information...
davilla committed Apr 30, 2014
2 parents 9b317c0 + cbee1c0 commit 19b3b5453d9225843a35833b6e8fa0a5d54cdced
@@ -8,6 +8,7 @@ all: .installed-$(PLATFORM)
cp -rf libamplayer $(PLATFORM)/
cd $(PLATFORM); patch -p1 < ../android-4.0-to-4.1.patch
cd $(PLATFORM); patch -p1 < ../android-4.1-to-4.2.patch
+ cd $(PLATFORM); patch -p1 < ../android-4.2-to-4.4.patch
touch $@
.installed-$(PLATFORM): .patched-$(PLATFORM)
@@ -0,0 +1,18 @@
+--- a/libamplayer/include/amcodec/amports/vformat.h
++++ b/libamplayer/include/amcodec/amports/vformat.h
+@@ -49,6 +49,7 @@ typedef enum {
+ VIDEO_DEC_FORMAT_WVC1,
+ VIDEO_DEC_FORMAT_SW,
+ VIDEO_DEC_FORMAT_AVS,
++ VIDEO_DEC_FORMAT_H264_4K2K,
+ VIDEO_DEC_FORMAT_MAX
+ } vdec_type_t;
+
+@@ -64,6 +65,7 @@ typedef enum {
+ VFORMAT_AVS,
+ VFORMAT_SW,
+ VFORMAT_H264MVC,
++ VFORMAT_H264_4K2K,
+ VFORMAT_UNSUPPORT,
+ VFORMAT_MAX
+ } vformat_t;
@@ -1069,7 +1069,7 @@ int pre_header_feeding(am_private_t *para, am_packet_t *pkt)
}
}
- if (VFORMAT_H264 == para->video_format /*|| VFORMAT_H264MVC == para->video_format*/) {
+ if (VFORMAT_H264 == para->video_format || VFORMAT_H264_4K2K == para->video_format) {
ret = h264_write_header(para, pkt);
if (ret != PLAYER_SUCCESS) {
return ret;
@@ -1512,6 +1512,11 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
am_private->video_rotation_degree = 3;
// handle extradata
am_private->video_format = codecid_to_vformat(hints.codec);
+ if (am_private->video_format == VFORMAT_H264) {
+ if (hints.width > 1920 || hints.height > 1088) {
+ am_private->video_format = VFORMAT_H264_4K2K;
+ }
+ }
switch (am_private->video_format)
{
default:
@@ -1574,6 +1579,18 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
if (m_hints.ptsinvalid)
am_private->gcodec.param = (void*)(EXTERNAL_PTS | SYNC_OUTSIDE);
break;
+ case VFORMAT_H264_4K2K:
+ if (aml_get_cputype() >= 8) {
+ am_private->gcodec.format = VIDEO_DEC_FORMAT_H264_4K2K;
+ am_private->gcodec.param = (void*)EXTERNAL_PTS;
+ // h264 in an avi file
+ if (m_hints.ptsinvalid)
+ am_private->gcodec.param = (void*)(EXTERNAL_PTS | SYNC_OUTSIDE);
+ } else {
+ CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder codec init failed, 4K supported only on Meson8.");
+ return false;
+ }
+ break;
case VFORMAT_REAL:
am_private->stream_type = AM_STREAM_RM;
am_private->vcodec.noblock = 1;
@@ -1614,6 +1631,7 @@ bool CAMLCodec::OpenDecoder(CDVDStreamInfo &hints)
CLog::Log(LOGDEBUG, "CAMLCodec::OpenDecoder codec init failed, ret=0x%x", -ret);
return false;
}
+
am_private->dumpdemux = false;
dumpfile_open(am_private);
@@ -1871,7 +1889,7 @@ void CAMLCodec::SetSpeed(int speed)
break;
default:
m_dll->codec_resume(&am_private->vcodec);
- if (am_private->video_format == VFORMAT_H264)
+ if ((am_private->video_format == VFORMAT_H264) || (am_private->video_format == VFORMAT_H264_4K2K))
m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_FFFB);
else
m_dll->codec_set_cntl_mode(&am_private->vcodec, TRICKMODE_I);
View
@@ -169,6 +169,8 @@ int aml_get_cputype()
aml_cputype = 3;
else if (cpu_hardware.find("Meson6") != std::string::npos)
aml_cputype = 6;
+ else if (cpu_hardware.find("Meson8") != std::string::npos)
+ aml_cputype = 8;
}
return aml_cputype;

3 comments on commit 19b3b54

@DEVilishWAY

This comment has been minimized.

Show comment Hide comment
@DEVilishWAY

DEVilishWAY May 3, 2014

You should rather start patching for each SDK revision concerning the AML libs to coincide with their staging releases instead of android releases. There was suppose to be a new release on 4/22 but they for some reason held off and haven't released it publicly - maybe waiting on adding the new M6 (L,C,D) models and the new T866 (finally HDMI 2.0 60fps in 4k). I can push the Libs for your reference via dropbox or git if you'd like for full reference from the test 4/22 with my updates. Would help for those needing the root method if you handle the AMLutils permissions from the codec_h_ctrl.h. Let me know, kind regards.

You should rather start patching for each SDK revision concerning the AML libs to coincide with their staging releases instead of android releases. There was suppose to be a new release on 4/22 but they for some reason held off and haven't released it publicly - maybe waiting on adding the new M6 (L,C,D) models and the new T866 (finally HDMI 2.0 60fps in 4k). I can push the Libs for your reference via dropbox or git if you'd like for full reference from the test 4/22 with my updates. Would help for those needing the root method if you handle the AMLutils permissions from the codec_h_ctrl.h. Let me know, kind regards.

@davilla

This comment has been minimized.

Show comment Hide comment
@davilla

davilla May 4, 2014

Contributor

No. android-4.2-to-4.4.patch was only added to add support for H264_4K2K. AMCodec handles AML structure abuse internally by bit reading. The reason for this is if you hard target a particular AML lib version, then you can ONLY run under that version.
So far AML has not responded to my inquiry about runtime determination of the different flavors of S80x and friends.

Also, root abuse will vanish in Helix. XBMC should not be abusing root to solve a distro issue. AML just need to get their permissions sorted and push this out to their customers.

Contributor

davilla replied May 4, 2014

No. android-4.2-to-4.4.patch was only added to add support for H264_4K2K. AMCodec handles AML structure abuse internally by bit reading. The reason for this is if you hard target a particular AML lib version, then you can ONLY run under that version.
So far AML has not responded to my inquiry about runtime determination of the different flavors of S80x and friends.

Also, root abuse will vanish in Helix. XBMC should not be abusing root to solve a distro issue. AML just need to get their permissions sorted and push this out to their customers.

@DEVilishWAY

This comment has been minimized.

Show comment Hide comment
@DEVilishWAY

DEVilishWAY May 4, 2014

I agree with the root abuse removal - AML will always leave it in the manufacturer\vendors end and it should be their responsibility to accommodate for the needed codec control. Most companies use the stock AML build and sure enough.....its forces them to other fw's or customs with /su or correct perms' but still a great deal of them have a heavy reliance on your root changes. Helix vanishing act will surprise a lot of them unless AML makes the change on their end.....which doesn't seem likely.

I never understood why you use the patch method as I always hard target the AML lib versions to lock it to that device\revision, but I get your reasoning now. Let me see what I can do on the runtime determination for the S8xx family and report here/email you directly - I can provide all that is needed of the new series T866 and S802 but the others I am not too keen on. Thanks for the confirmation, talk to you soon.

I agree with the root abuse removal - AML will always leave it in the manufacturer\vendors end and it should be their responsibility to accommodate for the needed codec control. Most companies use the stock AML build and sure enough.....its forces them to other fw's or customs with /su or correct perms' but still a great deal of them have a heavy reliance on your root changes. Helix vanishing act will surprise a lot of them unless AML makes the change on their end.....which doesn't seem likely.

I never understood why you use the patch method as I always hard target the AML lib versions to lock it to that device\revision, but I get your reasoning now. Let me see what I can do on the runtime determination for the S8xx family and report here/email you directly - I can provide all that is needed of the new series T866 and S802 but the others I am not too keen on. Thanks for the confirmation, talk to you soon.

Please sign in to comment.