SDL2.0 VLC ubuntu安装和黑屏问题

开发环境安装:

1,执行:"sudo apt-get build-dep libsdl1.2",确定依赖库都装全了。

sdl2.0没有正式发布到ubuntu,使用下面方法安装:

https://launchpad.net/~zoogie/+archive/sdl2-snapshots

 sudo apt-add-repository ppa:zoogie/sdl2-snapshots 

sudo apt-get update

sudo apt-get install libsdl2 libsdl2-dbg libsdl2-dev libsdl2-image libsdl2-image-dev libsdl2-ttf libsdl2-ttf-dev libsdl2-mixer  libsdl2-mixer-dev

(在ubuntu 13.10 中,依赖库: sudo apt-get build-dep libsdl2)

 2, vlc的安装

 sudo apt-get install libvlc-dev

3,运行示例代码

  

显示上是黑屏。没有视频显示。

后修改代码测试:

将struct context context; 放到全局。在display回调里面用全局render fill rect。在main循环里面也用同样的代码画方框。结果main中的方框可以画出。从vlc回调回的display画方框无法显示。

  

单步跟踪后,发现render infor里面是opengl。将

context.renderer = SDL_CreateRenderer(window, -1, 0);

改成context.renderer = SDL_CreateRenderer(window, 1, 0);后,可以正常播放。

 可以打印出所有 render 信息:


int nRenderDrivers = SDL_GetNumRenderDrivers();
int i = 0;
for (; i < nRenderDrivers; i++) {
SDL_RendererInfo info;
SDL_GetRenderDriverInfo(i, &info); //d3d
printf("====info name %d: %s =====\n", i, info.name);
printf("====max_texture_height %d =====\n", i, info.max_texture_height);
printf("====max_texture_width %d =====\n", i, info.max_texture_width);

}

————————————————————————————

When you build SDL2, make sure that when you run the initial cmake 
step that all the video options are marked as ON, including 
VIDEO_OPENGL and VIDEO_X11_*. 

A quick way to make sure you've got all the dependencies you need is 
to run "sudo apt-get build-dep libsdl1.2"; this installs the list of 
build prerequisites for Ubuntu's SDL 1.2 package, which are more or 
less unchanged for SDL2. I believe it's libgl1-mesa-dev which contains 
the OpenGL headers.


 *** remove unity ****
sudo apt-get purge unity unity-2d unity-2d-common unity-2d-panel unity-2d-shell unity-2d-spread unity-asset-pool unity-common unity-lens-applications unity-lens-files unity-lens-music unity-lens-video unity-scope-musicstores unity-scope-video-remote unity-services indicator-messages indicator-status-provider-mc5 appmenu-qt appmenu-gtk appmenu-gtk3 lightdm unity-greeter overlay-scrollbar zeitgeist zeitgeist-core zeitgeist-datahub activity-log-manager-common activity-log-manager-control-center

ensure that SDL2 has full OpenGL and X support

 sudo apt install build-essential xorg-dev libudev-dev libts-dev libgl1-mesa-dev libglu1-mesa-dev libasound2-dev libpulse-dev libopenal-dev libogg-dev libvorbis-dev libaudiofile-dev libpng12-dev libfreetype6-dev libusb-dev libdbus-1-dev zlib1g-dev libdirectfb-dev
 

VLC 源码编译参考:
 
sudo apt-get install git libtool build-essential pkg-config autoconf
sudo apt-get build-dep vlc

posted @   Bigben  阅读(2672)  评论(0编辑  收藏  举报
编辑推荐:
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
阅读排行:
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?
点击右上角即可分享
微信分享提示