libVLC 视频抓图

news2024/11/18 23:36:45

Windows操作系统提供了多种便捷的截图方式,常见的有以下几种:

  • 全屏截图:通过按下PrtSc键(Print Screen),可以截取整个屏幕的内容。截取的图像会保存在剪贴板中,可以通过Ctrl+V粘贴到图片编辑工具或其他软件的输入框中。
  • 当前窗口截图:同时按下Alt + PrtSc键,可以截取当前活动的窗口。同样,截图内容会被保存在剪贴板中。
  • 矩形截图:使用快捷键Windows + Shift + S,可以选择矩形截图模式,然后拖动鼠标选取屏幕上的任意矩形区域进行截图。
  • 自由形状截图:同样使用Windows + Shift + S快捷键,可以选择任意形状截图模式,允许你自由绘制截图区域的形状。

libVLC 中通过libvlc_video_take_snapshot核心接口来截图。

以下是如何使用 libVLC 设置视频裁剪区域的基本步骤:

1. 初始化 libVLC 和媒体播放器

首先,你需要初始化 libVLC 实例和媒体播放器对象。

#include <vlc/vlc.h>
 
int main(int argc, char* argv[])
{
    libvlc_instance_t* inst;
    libvlc_media_player_t* mp;
    libvlc_media_t* m;
 
    // 加载 libVLC 引擎
    inst = libvlc_new(0, NULL);
 
    // 创建一个新的 item
    m = libvlc_media_new_location(inst, "your_video_path_here");
    mp = libvlc_media_player_new_from_media(m);
 
    // 不再需要媒体对象
    libvlc_media_release(m);
}

2. 播放视频

// 播放媒体播放器
libvlc_media_player_play(mp);
 
// 保持程序运行,直到视频播放完成
while (libvlc_media_player_is_playing(mp)) {
    // 可以在这里加入延时
}
 
// 清理 libVLC
libvlc_media_player_stop(mp);
libvlc_media_player_release(mp);
libvlc_release(inst);
 
return 0;

3.截图

这里为了方便,路径写死了。

	if (vlc_mediaPlayer)
	{
		QString path = "./snap.png";
		libvlc_video_take_snapshot(vlc_mediaPlayer, 0, path.toUtf8().data(), 0, 0);
	}

以下是VLC播放器中使用的截图界面,我们仿照这个做一个界面。 

以下是效果图。

菜单添加action,并响应槽函数。

m_snapAction = m_videoMenu->addAction("截图");
connect(m_snapAction, &QAction::triggered, this, &showWidget::slotSnap);

槽函数如下图所示,为了方便,路径写死了。 

void showWidget::slotSnap()
{
	if (vlc_mediaPlayer)
	{
		QString path = "./snap.png";
		libvlc_video_take_snapshot(vlc_mediaPlayer, 0, path.toUtf8().data(), 0, 0);
	}
}

生成目录下snap.png。 

完整源码:

#pragma once
#define LIBVLC_USE_PTHREAD_CANCEL 1
#include <QtWidgets/QWidget>
#include "ui_showWidget.h"
#include <QMenu>
#include <QActionGroup>
#include <vlc/vlc.h>

#include <QDebug>
#include <QFileDialog>
#include <QThread>
#include <QMouseEvent>
#include <QKeyEvent>

enum Rate
{
	Rate2X,
	Rate1_5X,
	Rate1_25X,
	Rate1_0X,
	Rate0_75X,
	Rate0_5X
};

class showWidget : public QWidget
{
    Q_OBJECT

public:
    showWidget(QWidget *parent = nullptr);
    ~showWidget();

protected:
	virtual void mousePressEvent(QMouseEvent *event);
	virtual void mouseDoubleClickEvent(QMouseEvent *event);
	virtual void keyPressEvent(QKeyEvent *event);

private slots:
	void slotOpenFile();
	void slotPlay();
	void slotPause();
	void slotStop();
	void slotValueChanged(int value);
	void slotCurrentIndexChanged(int index);
	void slotActionTriggered(QAction *action);
	void slotCropActionTriggered(QAction *action);
	void slotScaleActionTriggered(QAction *action);

	void slotSnap();

private:
	//事件处理回调
	static void vlcEvents(const libvlc_event_t *ev, void *param);

	//初始化menu
	void initMenu();

private:
    Ui::showWidgetClass ui;

private:
	libvlc_instance_t *vlc_base = nullptr;
	libvlc_media_t *vlc_media = nullptr;
	libvlc_media_player_t *vlc_mediaPlayer = nullptr;

	QList<float> m_lstRate;

	QMenu *m_menu = nullptr;
	QAction *m_video = nullptr;

	QAction *m_scaleAction = nullptr;	//缩放
	QAction *m_aspectRatioAction = nullptr;	//宽高比
	QAction *m_cropAction = nullptr;	//裁剪
	QAction *m_snapAction = nullptr;//截图

	QMenu *m_videoMenu = nullptr;

	//宽高比
	QMenu *m_aspectRatioMenu = nullptr;
	QAction *m_default = nullptr;
	QAction *m_16_9 = nullptr;
	QAction *m_4_3 = nullptr;
	QAction *m_1_1 = nullptr;
	QAction *m_16_10 = nullptr;
	QAction *m_2_21_1 = nullptr;
	QAction *m_2_35_1= nullptr;
	QAction *m_2_38_1 = nullptr;
	QAction *m_5_4 = nullptr;

	QActionGroup *m_group = nullptr;
	QAction *m_preAspectRatio = nullptr;
	//宽高比
	//裁剪
	QMenu *m_cropMenu = nullptr;
	QAction *m__cropDefault = nullptr;
	QAction *m__crop16_10 = nullptr;
	QAction *m__crop16_9 = nullptr;
	QAction *m__crop4_3 = nullptr;
	QAction *m__crop1_85_1 = nullptr;
	QAction *m__crop2_21_1 = nullptr;
	QAction *m__crop2_35_1 = nullptr;
	QAction *m__crop2_39_1 = nullptr;
	QAction *m__crop5_3 = nullptr;
	QAction *m__crop5_4 = nullptr;
	QAction *m__crop1_1 = nullptr;

	QActionGroup *m_cropGroup = nullptr;
	QAction *m_preCrop= nullptr;
	//裁剪

	//缩放
	QMenu *m_scaleMenu = nullptr;
	QAction *m_scale1_4 = nullptr;
	QAction *m_scale1_2 = nullptr;
	QAction *m_scale1_1 = nullptr;
	QAction *m_scale2_1 = nullptr;

	QActionGroup *m_scaleGroup = nullptr;
	QAction *m_preScale = nullptr;
	//缩放

	char *m_defalutRate = nullptr;
	char *m_defalutCrop = nullptr;
	float m_defalutScale = 0;
};

cpp

#include "showWidget.h"
#include <QTimer>
#include <QTime>

#pragma execution_character_set("utf-8")

showWidget::showWidget(QWidget *parent)
    : QWidget(parent)
{
    ui.setupUi(this);

	this->setWindowTitle("视频播放器");

	ui.cbxRate->setCurrentIndex(Rate1_0X);

	m_lstRate << 2.0 << 1.5 << 1.25 << 1.0 << 0.75 << 0.5;

	initMenu();

	ui.btnOpen->setFocusPolicy(Qt::NoFocus);
	ui.btnPlay->setFocusPolicy(Qt::NoFocus);
	ui.btnPause->setFocusPolicy(Qt::NoFocus);
	ui.btnStop->setFocusPolicy(Qt::NoFocus);
	ui.hSliderVolumn->setFocusPolicy(Qt::NoFocus);
	ui.cbxRate->setFocusPolicy(Qt::NoFocus);

	connect(ui.btnOpen, &QPushButton::clicked, this, &showWidget::slotOpenFile);
	connect(ui.btnPlay, &QPushButton::clicked, this, &showWidget::slotPlay);
	connect(ui.btnPause, &QPushButton::clicked, this, &showWidget::slotPause);
	connect(ui.btnStop, &QPushButton::clicked, this, &showWidget::slotStop);
	connect(ui.btnSnap, &QPushButton::clicked, this, &showWidget::slotSnap);
	connect(ui.hSliderVolumn, &QSlider::valueChanged, this, &showWidget::slotValueChanged);
	connect(ui.cbxRate,SIGNAL(currentIndexChanged(int)), this, SLOT(slotCurrentIndexChanged(int)));
}

showWidget::~showWidget()
{
	libvlc_release(vlc_base); //减少libvlc实例的引用计数,并销毁
}

void showWidget::mousePressEvent(QMouseEvent *event)
{
	switch (event->button())
	{
	case Qt::RightButton:
		//this->setWindowState(Qt::WindowMinimized);
		m_menu->exec(event->globalPos());
		break;
	default:
		QWidget::mousePressEvent(event);
	}
}

void showWidget::mouseDoubleClickEvent(QMouseEvent *event)
{
	if (this->isFullScreen())
	{
		this->showNormal();
	}
	else
	{
		this->showFullScreen();
	}
}

void showWidget::keyPressEvent(QKeyEvent *event)
{
	if (!vlc_mediaPlayer)
		return;

	int value = ui.hSliderVolumn->value();
	if (event->key() == Qt::Key_W)	//添加音量
	{
		qDebug() << "up";
		slotValueChanged(value+10);
	}
	else if (event->key() == Qt::Key_S)	//减小音量
	{
		slotValueChanged(value - 10);
	}
	else if (event->key() == Qt::Key_Space)
	{
		if (vlc_mediaPlayer && libvlc_media_player_get_state(vlc_mediaPlayer) == libvlc_Playing)
		{
			libvlc_media_player_pause(vlc_mediaPlayer);
		}
		else if (vlc_mediaPlayer && libvlc_media_player_get_state(vlc_mediaPlayer) == libvlc_Paused)
		{
			libvlc_media_player_play(vlc_mediaPlayer);
		}
	}
}

void showWidget::slotOpenFile()
{
	/*选择文件*/
	QString filename = QFileDialog::getOpenFileName(this, "选择打开的文件", "D:/", tr("*.*"));
	std::replace(filename.begin(), filename.end(), QChar('/'), QChar('\\'));
	vlc_base = libvlc_new(0, NULL);
	vlc_media = libvlc_media_new_path(vlc_base, filename.toUtf8().data());
	if (!vlc_media) {
		return;
	}

	// 创建libvlc实例和媒体播放器
	vlc_mediaPlayer = libvlc_media_player_new_from_media(vlc_media);
	if (!vlc_mediaPlayer) {
		return;
	}
	
	// 等待元数据加载完成
	libvlc_media_parse(vlc_media);

	m_defalutRate = libvlc_video_get_aspect_ratio(vlc_mediaPlayer);
	m_defalutCrop = libvlc_video_get_crop_geometry(vlc_mediaPlayer);

	libvlc_video_set_mouse_input(vlc_mediaPlayer, 0);
	libvlc_video_set_key_input(vlc_mediaPlayer, 0);

	// 获取各种元数据
	const char *title = libvlc_media_get_meta(vlc_media, libvlc_meta_Title);
	const char *artist = libvlc_media_get_meta(vlc_media, libvlc_meta_Artist);
	const char *album = libvlc_media_get_meta(vlc_media, libvlc_meta_Album);
	const char *url = libvlc_media_get_meta(vlc_media, libvlc_meta_URL);
	const char *date = libvlc_media_get_meta(vlc_media, libvlc_meta_Date);
	const char *lang = libvlc_media_get_meta(vlc_media, libvlc_meta_Language);
	int duration = libvlc_media_get_duration(vlc_media);  // 获取时长(单位:毫秒)

	qDebug("Title: %s", title ? title : "N/A");
	qDebug("Artist: %s", artist ? artist : "N/A");
	qDebug("Album: %s", album ? album : "N/A");
	qDebug("Duration: %d ms", duration);
	qDebug("url: %s", url ? url : "N/A");
	qDebug("date: %s", date ? date : "N/A");
	qDebug("lang: %s", lang ? lang : "N/A");
	
	libvlc_media_track_t **tracks;
	int track_count = libvlc_media_tracks_get(vlc_media,&tracks);
	for (unsigned i = 0; i < track_count; i++) 
	{
		libvlc_media_track_t* track = tracks[i];

		// 显示轨道信息
		printf("Track #%u: %s\n", i, track->psz_description);

		// 这里可以获取到每一个轨道的信息,比如轨道类型 track->i_type
		// 可能是 libvlc_track_video, libvlc_track_audio 或者 libvlc_track_text (字幕)

		if (track->i_type == libvlc_track_video) {
			// 处理视频轨道信息
			qDebug("width = %d",track->video->i_width);
			qDebug("height = %d", track->video->i_height);
			qDebug("rate_num = %d", track->video->i_frame_rate_num);
			qDebug("rate_den = %d", track->video->i_frame_rate_den);
		}
		else if (track->i_type == libvlc_track_audio) {
			// 处理音频轨道信息
			qDebug("channels = %d", track->audio->i_channels);
			qDebug("rate = %d", track->audio->i_rate);
		}
		else if (track->i_type == libvlc_track_text) {
			// 处理字幕轨道信息
		}
	}

	//获取事件管理器
	libvlc_event_manager_t *em = libvlc_media_player_event_manager(vlc_mediaPlayer);

	// 注册事件监听器
	libvlc_event_attach(em, libvlc_MediaPlayerTimeChanged, vlcEvents, this);
	libvlc_event_attach(em, libvlc_MediaPlayerEndReached, vlcEvents, this);
	libvlc_event_attach(em, libvlc_MediaPlayerStopped, vlcEvents, this);
	libvlc_event_attach(em, libvlc_MediaPlayerPlaying, vlcEvents, this);
	libvlc_event_attach(em, libvlc_MediaPlayerPaused, vlcEvents, this);

	libvlc_media_player_set_hwnd(vlc_mediaPlayer, (void *)ui.widgetShow->winId());

	QTimer::singleShot(1000, this, &showWidget::slotPlay);

}

void showWidget::slotPlay()
{
	if (vlc_mediaPlayer)
	{
		libvlc_media_player_play(vlc_mediaPlayer);
		m_defalutScale = libvlc_video_get_scale(vlc_mediaPlayer);
	}
	
}

void showWidget::slotPause()
{
	if (vlc_mediaPlayer)
		libvlc_media_player_pause(vlc_mediaPlayer);
}

void showWidget::slotStop()
{
	if (vlc_mediaPlayer)
		libvlc_media_player_stop(vlc_mediaPlayer);
}

void showWidget::slotValueChanged(int value)
{
	if (vlc_mediaPlayer)
		libvlc_audio_set_volume(vlc_mediaPlayer, value);
}

void showWidget::slotCurrentIndexChanged(int index)
{
	if (vlc_mediaPlayer)
		libvlc_media_player_set_rate(vlc_mediaPlayer, m_lstRate[index]);
}

void showWidget::slotActionTriggered(QAction *action)
{
	if (!vlc_mediaPlayer)
		return;

	if (action == m_default)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer,m_defalutRate);
	else if(action == m_16_9)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "16:9");
	else if (action == m_4_3)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "4:3");
	else if (action == m_1_1)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "1:1");
	else if (action == m_16_10)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "16:10");
	else if (action == m_2_21_1)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "221:100");
	else if (action == m_2_35_1)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "235:100");
	else if (action == m_2_38_1)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "238:100");
	else if (action == m_5_4)
		libvlc_video_set_aspect_ratio(vlc_mediaPlayer, "5:4");

	action->setIcon(QIcon(":/image/images/point.png"));
	m_preAspectRatio->setIcon(QIcon());
	m_preAspectRatio = action;
}

void showWidget::slotCropActionTriggered(QAction *action)
{
	if (!vlc_mediaPlayer)
		return;

	if (action == m__cropDefault)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, m_defalutCrop);
	else if (action == m__crop16_10)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "16:10");
	else if (action == m__crop16_9)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "16:9");
	else if (action == m__crop4_3)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "4:3");
	else if (action == m__crop1_85_1)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "185:100");
	else if (action == m__crop2_21_1)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "221:100");
	else if (action == m__crop2_35_1)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "235:100");
	else if (action == m__crop2_39_1)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "239:100");
	else if (action == m__crop5_3)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "5:3");
	else if (action == m__crop5_4)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "5:4");
	else if (action == m__crop1_1)
		libvlc_video_set_crop_geometry(vlc_mediaPlayer, "1:1");

	action->setIcon(QIcon(":/image/images/point.png"));
	m_preCrop->setIcon(QIcon());
	m_preCrop = action;
}

void showWidget::slotScaleActionTriggered(QAction *action)
{
	if (!vlc_mediaPlayer)
		return;

	if (action == m_scale1_4)
		libvlc_video_set_scale(vlc_mediaPlayer, 0.25);
	else if (action == m_scale1_2)
		libvlc_video_set_scale(vlc_mediaPlayer, 0.5);
	else if (action == m_scale1_1)
		libvlc_video_set_scale(vlc_mediaPlayer, 1);
	else if (action == m_scale2_1)
		libvlc_video_set_scale(vlc_mediaPlayer, 2);

	action->setIcon(QIcon(":/image/images/point.png"));
	m_preScale->setIcon(QIcon());
	m_preScale = action;
}

void showWidget::slotSnap()
{
	if (vlc_mediaPlayer)
	{
		QString path = "./snap.png";
		libvlc_video_take_snapshot(vlc_mediaPlayer, 0, path.toUtf8().data(), 0, 0);
	}
}

//事件回调
void showWidget::vlcEvents(const libvlc_event_t *ev, void *param)
{
	showWidget *w = (showWidget*)param;
	//处理不同的事件
	switch (ev->type) {
	case libvlc_MediaPlayerTimeChanged:
	{
		//qDebug() << "VLC媒体播放器时间已更改";
		qint64 len = libvlc_media_player_get_time(w->vlc_mediaPlayer);
		libvlc_time_t lenSec = len / 1000;

		libvlc_time_t totalLen = libvlc_media_player_get_length(w->vlc_mediaPlayer);
		libvlc_time_t totalLenSec = totalLen / 1000;

		int thh, tmm, tss;
		thh = lenSec / 3600;
		tmm = (lenSec % 3600) / 60;
		tss = (lenSec % 60);
		QTime time(thh, tmm, tss);
		w->ui.lbCurTime->setText(time.toString("hh:mm:ss"));

		thh = totalLenSec / 3600;
		tmm = (totalLenSec % 3600) / 60;
		tss = (totalLenSec % 60);
		QTime TotalTime(thh, tmm, tss);
		w->ui.lbTotalTime->setText(TotalTime.toString("hh:mm:ss"));

		double pos = (double)lenSec / totalLenSec * 100;
		w->ui.horizontalSlider->setValue(pos);
	}
		break;
	case libvlc_MediaPlayerEndReached:
		qDebug() << "VLC播放完毕.";
		break;
	case libvlc_MediaPlayerStopped:
		qDebug() << "VLC停止播放";
		break;
	case libvlc_MediaPlayerPlaying:
		qDebug() << "VLC开始播放";
		break;
	case libvlc_MediaPlayerPaused:
		qDebug() << "VLC暂停播放";
		break;
	}
}

void showWidget::initMenu()
{
	//总菜单
	m_menu = new QMenu(this);
	m_video = m_menu->addAction("视频");

	//视频菜单
	m_videoMenu = new QMenu(this);
	m_scaleAction = m_videoMenu->addAction("缩放");
	m_aspectRatioAction = m_videoMenu->addAction("宽高比");
	m_cropAction = m_videoMenu->addAction("裁剪");
	m_snapAction = m_videoMenu->addAction("截图");
	connect(m_snapAction, &QAction::triggered, this, &showWidget::slotSnap);

	m_video->setMenu(m_videoMenu);

	//宽高比菜单
	m_aspectRatioMenu = new QMenu(this);
	m_aspectRatioAction->setMenu(m_aspectRatioMenu);

	//设置宽高比菜单
	m_default = m_aspectRatioMenu->addAction(QIcon(":/image/images/point.png"), "默认");
	m_16_9 = m_aspectRatioMenu->addAction("16:9");
	m_4_3 = m_aspectRatioMenu->addAction("4:3");
	m_1_1 = m_aspectRatioMenu->addAction("1:1");
	m_16_10 = m_aspectRatioMenu->addAction("16:10");
	m_2_21_1 = m_aspectRatioMenu->addAction("2.21:1");
	m_2_35_1 = m_aspectRatioMenu->addAction("2.35:1");
	m_2_38_1 = m_aspectRatioMenu->addAction("2.38:1");
	m_5_4 = m_aspectRatioMenu->addAction("5:4");

	m_preAspectRatio = m_default;

	m_group = new QActionGroup(this);
	m_group->addAction(m_default);
	m_group->addAction(m_16_9);
	m_group->addAction(m_4_3);
	m_group->addAction(m_1_1);
	m_group->addAction(m_16_10);
	m_group->addAction(m_2_21_1);
	m_group->addAction(m_2_35_1);
	m_group->addAction(m_2_38_1);
	m_group->addAction(m_5_4);

	connect(m_group, &QActionGroup::triggered, this, &showWidget::slotActionTriggered);

	//设置裁剪菜单
	m_cropMenu = new QMenu(this);
	m_cropAction->setMenu(m_cropMenu);

	m__cropDefault = m_cropMenu->addAction(QIcon(":/image/images/point.png"), "默认");
	m__crop16_10 = m_cropMenu->addAction("16:10");
	m__crop16_9 = m_cropMenu->addAction("16:9");
	m__crop4_3 = m_cropMenu->addAction("4:3");
	m__crop1_85_1 = m_cropMenu->addAction("1.85:1");
	m__crop2_21_1 = m_cropMenu->addAction("2.21:1");
	m__crop2_35_1 = m_cropMenu->addAction("2.35:1");
	m__crop2_39_1 = m_cropMenu->addAction("2.39:1");
	m__crop5_3 = m_cropMenu->addAction("5:3");
	m__crop5_4 = m_cropMenu->addAction("5:4");
	m__crop1_1 = m_cropMenu->addAction("1:1");

	m_preCrop = m__cropDefault;

	m_cropGroup = new QActionGroup(this);
	m_cropGroup->addAction(m__cropDefault);
	m_cropGroup->addAction(m__crop16_10);
	m_cropGroup->addAction(m__crop16_9);
	m_cropGroup->addAction(m__crop4_3);
	m_cropGroup->addAction(m__crop1_85_1);
	m_cropGroup->addAction(m__crop2_21_1);
	m_cropGroup->addAction(m__crop2_35_1);
	m_cropGroup->addAction(m__crop2_39_1);
	m_cropGroup->addAction(m__crop5_3);
	m_cropGroup->addAction(m__crop5_4);
	m_cropGroup->addAction(m__crop1_1);

	connect(m_cropGroup, &QActionGroup::triggered, this, &showWidget::slotCropActionTriggered);


	//设置缩放菜单
	m_scaleMenu = new QMenu(this);
	m_scaleAction->setMenu(m_scaleMenu);

	m_scale1_4 = m_scaleMenu->addAction("1:4 四分之一");
	m_scale1_2 = m_scaleMenu->addAction("1:2 二分之一");
	m_scale1_1 = m_scaleMenu->addAction(QIcon(":/image/images/point.png"),"1:1 原始");
	m_scale2_1 = m_scaleMenu->addAction("2:1 双倍");

	m_scaleGroup = new QActionGroup(this);
	m_scaleGroup->addAction(m_scale1_4);
	m_scaleGroup->addAction(m_scale1_2);
	m_scaleGroup->addAction(m_scale1_1);
	m_scaleGroup->addAction(m_scale2_1);

	m_preScale = m_scale1_1;

	connect(m_scaleGroup, &QActionGroup::triggered, this, &showWidget::slotScaleActionTriggered);
}

更多参考:

libVLC 事件机制-CSDN博客

libVLC windows开发环境搭建-CSDN博客

https://sunnnnnn666.blog.csdn.net/article/details/137023036

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/1549977.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

Machine Learning机器学习之K近邻算法(K-Nearest Neighbors,KNN)

目录 前言 背景介绍&#xff1a; 思想&#xff1a; 原理&#xff1a; KNN算法关键问题 一、构建KNN算法 总结&#xff1a; 博主介绍&#xff1a;✌专注于前后端、机器学习、人工智能应用领域开发的优质创作者、秉着互联网精神开源贡献精神&#xff0c;答疑解惑、坚持优质作品共…

探索MongoDB:发展历程、优势与应用场景

一、MongoDB简介 MongoDB 始于 2007 年&#xff0c;由 Dwight Merriman、Eliot Horowitz 和 Kevin Ryan –&#xff08;DoubleClick 的主理团队&#xff09;共同创立。 DoubleClick 是一家互联网广告公司&#xff08;现隶属于 Google&#xff09;&#xff0c;公司团队开发并利…

前端埋点全解及埋点SDK实现方式

一、什么是埋点 所谓“埋点”&#xff0c;是数据采集领域&#xff08;尤其是用户行为数据采集领域&#xff09;的术语&#xff0c;指的是针对特定用户行为或事件进行捕获、处理和发送的相关技术及其实施过程。比如用户某个icon点击次数、观看某个视频的时长等等。 埋点…

python-pytorch获取FashionMNIST实际图片标签数据集

在查看pytorch官方文档的时候&#xff0c;在这里链接中https://pytorch.org/tutorials/beginner/basics/data_tutorial.html的Creating a Custom Dataset for your files章节&#xff0c;有提到要自定义数据集&#xff0c;需要用到实际的图片和标签。 在网上找了半天没找到&a…

Jenkins用户角色权限管理

Jenkins作为一款强大的自动化构建与持续集成工具&#xff0c;用户角色权限管理是其功能体系中不可或缺的一环。有效的权限管理能确保项目的安全稳定&#xff0c;避免敏感信息泄露。 1、安装插件&#xff1a;Role-based Authorization Strategy 系统管理 > 插件管理 > 可…

java入门学习Day01

本篇文章主要是学会如何使用IDEA&#xff0c;和运行第一个java文件。 java环境安装&#xff1a;Windows下Java环境配置教程_windows java环境配置-CSDN博客 IDEA安装&#xff1a;IDEA 2023.2.5 最新激活码,注册码&#xff08;亲测好用&#xff09; - 异常教程 以上两个链接…

Docker中常见的命令行

1 docker的全部命令 docker attach #连接到正在运行中的容器 docker build #使用 Dockerfile 创建镜像 docker builder #管理builds docker builder prune #清除build缓存 docker checkpoint #管理checkpoints docker checkpoint create #从正在运行的容器创建检…

数据结构与算法 单链表的基本运算

一、实验内容 编写一个程序实现&#xff0c;实现单链表的各种基本运算&#xff08;假设单链表的元素类型为char&#xff09;&#xff0c;并以此为基础设计一个程序完成下列功能&#xff1a; 初始化单链表&#xff1b;采用尾插法依次插入元素a&#xff0c;b&#xff0c;c&…

小米HyperOS 澎湃os机型免答题 免社区等级 秒接bl锁操作步骤解析

小米机型解锁bl 绕过社区等级5才可以解锁的限制的教程_没有五级社区怎么解锁bl-CSDN博客 上次解析了小米有些出厂不是HyperOS系统的机型绕社区等级接bl锁的操作。目前有更新出厂为HyperOS系统的机型免社区登录等级限制 免答题解锁bl的操作。而且有网友在米14 平板6sp k70这些新…

SCI一区顶刊优化算法改进:基于强化学习的神经网络算法RLNNA,你绝对没见过,非常新颖!

声明&#xff1a;文章是从本人公众号中复制而来&#xff0c;因此&#xff0c;想最新最快了解各类智能优化算法及其改进的朋友&#xff0c;可关注我的公众号&#xff1a;强盛机器学习&#xff0c;不定期会有很多免费代码分享~ 目录 神经网络优化算法NNA&#xff1a; 基于强化…

vue2项目设置浏览器标题title及图标logo

工作中肯定会遇到要修改网页的标题title及图标logo 一、固定设置标题方案 方法一&#xff1a;在vue.config.js文件&#xff0c;添加如下代码&#xff1a; chainWebpack: config > {// 配置网页标题config.plugin(html).tap((args) > {args[0].title 标题return args})…

LoadBalance 负载均衡服务调用

前身:Ribbon LB负载均衡(Load Balance)是什么 简单的说就是将用户的请求平摊的分配到多个服务上&#xff0c;从而达到系统的HA&#xff08;高可用&#xff09;&#xff0c;常见的负载均衡有软件Nginx&#xff0c;LVS&#xff0c;硬件 F5等 spring-cloud-starter-loadbalancer组…

Bash and a Tough Math Puzzle 线段树维护区间gcd

还是一道很不错的题目&#xff0c;很容易想到用一棵线段树来维护区间gcd 注意用倍数来剪枝就好了&#xff0c;很是一到很好的题目的 #include<iostream> #include<vector> using namespace std; const int N 5e510; int n,q; struct Segment{int l,r;int d; }tr[…

AI智聊功能支持生成旅游攻略、作文、标题优化,方便视频剪辑

在快节奏的生活中&#xff0c;我们总是需要快速、准确地获取所需信息。无论是撰写旅游攻略、作文&#xff0c;还是准备演讲稿&#xff0c;AI智聊都能为您一键生成精彩文案&#xff0c;让您的创意无限发挥&#xff01; 媒体梦工厂的AI智聊功能&#xff0c;利用先进的自然语言处…

python Flask扩展:如何查找高效开发的第三方模块(库/插件)

如何找到扩展以及使用扩展的文档 一、背景二、如何寻找框架的扩展&#xff1f;三、找到想要的扩展四、找到使用扩展的文档五、项目中实战扩展 一、背景 刚入门python的flask的框架&#xff0c;跟着文档学习了一些以后&#xff0c;想着其实在项目开发中&#xff0c;经常会用到发…

神经网络:梯度下降法更新模型参数

作者&#xff1a;CSDN _养乐多_ 在神经网络领域&#xff0c;梯度下降是一种核心的优化算法&#xff0c;本文将介绍神经网络中梯度下降法更新参数的公式&#xff0c;并通过实例演示其在模型训练中的应用。通过本博客&#xff0c;读者将能够更好地理解深度学习中的优化算法和损…

Android-Handler详解_原理解析

为了方便阅读将文章分为使用篇和源码解析两篇&#xff0c;上一篇已经写了Handler是什么、有什么、怎们用&#xff0c;这一片从源码的角度分析完整流程&#xff0c;看看Handler消息机制到底是啥原理。才疏学浅&#xff0c;如有错误&#xff0c;欢迎指正&#xff0c;多谢。 完整…

XR虚拟直播间,引领创新风潮,打破直播局限!

随着互联网技术日新月异的发展&#xff0c;直播行业也迎来了蓬勃发展的春天。然而&#xff0c;大多数直播间在吸引观众眼球和延长用户观看时长方面&#xff0c;仍然面临着巨大的挑战。正是在这样的背景下&#xff0c;XR虚拟直播系统应运而生&#xff0c;以其多维度的直播场景、…

[flask]异常抛出和捕获异常

Python学习之Flask全局异常处理流程_flask 异常处理-CSDN博客 读取文件错误 OSError: [Errno 22] Invalid argument:_[errno 22] invalid argument: ..\\data\\snli_1.0\\-CSDN博客 异常触发 assert触发异常&#xff1a; 在Python中&#xff0c;使用assert语句可以检查某个条…

Altium Designer 22 DRC规则检查解析(转载)

原文链接&#xff1a;Altium Designer 22 DRC规则检查解析 - 哔哩哔哩 (bilibili.com) PCB Designer Rules 即用来约束PCB走线或布局的规则条例。通常有如&#xff0c;PCB板厂所提供给你的最小线宽线距参数、最小字符宽高度、最小VIA&PAD内外径参数等&#xff0c;需要设计…