添加VLC录像API

本文介绍了如何在Linux环境下使用C语言编译并运行VLC录像功能。通过`gcc test.c -o test -lvlc`命令进行编译,实现录像功能。注意到`libvlc_media_player_stop()`可能导致死锁,该问题与线程安全相关,作者计划后续深入研究。
摘要由CSDN通过智能技术生成
最近使用VLC播放RTSP数据想在本地截图录像,但libvlc中并不包含录像api,网上找到一些资料,自己添加这个接口并测试成功。接口主要是按照官方网站来做的(https://patches.videolan.org/patch/606/)。我是用的源码是最新的,编译过程中很顺利,前提是安装好各种依赖包。测试代码如下:
#include <vlc/vlc.h>
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <unistd.h>

static const char * test_defaults_args[] = {
    "-v",
    "--ignore-config",
    "-I",
    "dummy",
    "--no-media-library"
};

static const int test_defaults_nargs =
    sizeof (test_defaults_args) / sizeof (test_defaults_args[0]);

int main (void)
{

    libvlc_instance_t *instance;
    libvlc_media_t *media;
    libvlc_media_player_t *player;
    const char * file = "rtsp://192.168.1.68";

    //instance = libvlc_new (test_defaults_nargs, test_defaults_args);
    instance = libvlc_new (0, NULL);
    assert (instan
  • 3
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 10
    评论
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值