VLC SDK

Recently I am searching for an easy-to-use library of media framework that can be embedded to my own codes. First I have tried ffmpeg and SDL2 libraries, which I found too difficult for me since I have little experience of developing multimedia related applications. Then I found VLC media player after I searched the internet using a key word of “media player library”. I thought maybe it was a good choice and searched related projects in github. There is a very simple demo project called Controlling VLC media player using OpenCV. I was extracted by the word “OpenCV” because I am an engineer in computer vision. After I clicked the link, BINGO! THAT’S ALL I NEED!

Install libvlc

  1. A simple command is used to install libvlc sudo apt-get install libvlc-dev.
  2. One may need to install vlc media player to get the plugins work sudo apt-get install vlc.

Use libvlc

The following code is a simple demo of how to use libvlc to play a video

#include <vlc/vlc.h>
// LibVLC requirements, plays video specified as a command line argument
libvlc_instance_t *instance = libvlc_new(0, NULL);
libvlc_media_t *media = libvlc_media_new_path(instance, argv[1]);   
libvlc_media_player_t *mplayer = libvlc_media_player_new_from_media(media);

while(1)
{
    //something to do while playing video
    //...
}

libvlc_media_release(media);
libvlc_release(instance);

The libvlc will handle the multimedia thread. All we need to do is controlling the player in main thread. More document can be found here.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值