Video rotation on android using LibVLC

橙三吉。 提交于 2019-12-18 17:55:12

问题


I'm using LibVLC to display video files. It's working fine so far, despite of the orientation. I'm able to get the orientation out of meta-data but don't really know how to force LibVLC to rotate it from landscape to portrait.

It would be nice to get a hint for a workaround.

Thanks!


回答1:


I had a similar problem. Unfortunately LibVLC for android does not expose all features, so I had to change code in the jni layer to get it working. Here is how to do it:

Edit libvlcjni.c, and find the function : Java_org_videolan_libvlc_LibVLC_nativeInit. Look for the local varibale argv array and add the following to items to it:

"--video-filter=transform" "--transform-type="

Where transform type is one of the following: 90, 180, 270, hfilp, vfilp.

If you omit --transform-type you'l get a 90 degree rotation by default.

What this modifications does, is it loads the transform filter and then sets the transformation. You can do more fine grained rotation using --rotation-angle, but you'll have to load the appropriate filter first.

Hope this helps.



来源:https://stackoverflow.com/questions/23672155/video-rotation-on-android-using-libvlc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!