CentOS7下如何构建静态libvlc?
How do I build a static libvlc under CentOS7?
我有一个PyQt写的程序,通过绑定libvlc播放视频
# -*- coding: utf-8 -*-
import sys
import os
import vlc
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
class vlc_demo(QWidget):
def __init__(self):
super(vlc_demo, self).__init__()
self.__ui__()
self.__load__()
def __ui__(self):
self.setFixedSize(800,600)
t_lay_parent = QVBoxLayout()
self.m_label_media = QLabel()
t_lay_bottom = QHBoxLayout()
self.m_button_one = QPushButton("one")
self.m_button_too = QPushButton("too")
self.m_button_three = QPushButton("three")
t_lay_bottom.addWidget(self.m_button_one)
t_lay_bottom.addWidget(self.m_button_too)
t_lay_bottom.addWidget(self.m_button_three)
self.m_button_one.clicked.connect(self.slt_one)
self.m_button_too.clicked.connect(self.slt_too)
self.m_button_three.clicked.connect(self.slt_three)
t_lay_parent.addWidget(self.m_label_media)
t_lay_parent.addLayout(t_lay_bottom)
self.setLayout(t_lay_parent)
def __load__(self):
self.m_instance = vlc.Instance()
self.m_player = self.m_instance.media_player_new()
self.m_win_id = self.m_label_media.winId()
if sys.platform.startswith('linux'): # linux
self.m_player.set_xwindow(self.m_win_id)
elif sys.platform == "win32": # windows
self.m_player.set_hwnd(self.m_win_id)
elif sys.platform == "darwin": # mac
self.m_player.set_nsobject(self.m_win_id)
def slt_one(self):
self.m_label_media.show()
media = self.m_instance.media_new("1.mp4")
self.m_player.set_media(media)
self.m_player.play()
def slt_too(self):
self.m_label_media.show()
media = self.m_instance.media_new("2.mp4")
self.m_player.set_media(media)
self.m_player.play()
def slt_three(self):
self.m_label_media.hide()
if __name__ == "__main__":
app = QApplication(sys.argv)
win = vlc_demo()
win.show()
sys.exit(app.exec_())
在windows下,复制VLC媒体播放器目录中的以下文件和目录。该程序可以运行在没有VLC媒体播放器的机器上。
- libvlc.dll
- libvlccore.dll
- plugins
在CentOS7下,有什么办法可以运行不安装VLC媒体播放器的程序吗?
我相信您可能会使用 AFAIU 专为此设计的 Snapcraft Parts。
对于 VLC 那是 https://github.com/videolan/vlc/blob/master/extras/package/snap/snapcraft.yaml
我有一个PyQt写的程序,通过绑定libvlc播放视频
# -*- coding: utf-8 -*-
import sys
import os
import vlc
from PySide2.QtGui import *
from PySide2.QtCore import *
from PySide2.QtWidgets import *
class vlc_demo(QWidget):
def __init__(self):
super(vlc_demo, self).__init__()
self.__ui__()
self.__load__()
def __ui__(self):
self.setFixedSize(800,600)
t_lay_parent = QVBoxLayout()
self.m_label_media = QLabel()
t_lay_bottom = QHBoxLayout()
self.m_button_one = QPushButton("one")
self.m_button_too = QPushButton("too")
self.m_button_three = QPushButton("three")
t_lay_bottom.addWidget(self.m_button_one)
t_lay_bottom.addWidget(self.m_button_too)
t_lay_bottom.addWidget(self.m_button_three)
self.m_button_one.clicked.connect(self.slt_one)
self.m_button_too.clicked.connect(self.slt_too)
self.m_button_three.clicked.connect(self.slt_three)
t_lay_parent.addWidget(self.m_label_media)
t_lay_parent.addLayout(t_lay_bottom)
self.setLayout(t_lay_parent)
def __load__(self):
self.m_instance = vlc.Instance()
self.m_player = self.m_instance.media_player_new()
self.m_win_id = self.m_label_media.winId()
if sys.platform.startswith('linux'): # linux
self.m_player.set_xwindow(self.m_win_id)
elif sys.platform == "win32": # windows
self.m_player.set_hwnd(self.m_win_id)
elif sys.platform == "darwin": # mac
self.m_player.set_nsobject(self.m_win_id)
def slt_one(self):
self.m_label_media.show()
media = self.m_instance.media_new("1.mp4")
self.m_player.set_media(media)
self.m_player.play()
def slt_too(self):
self.m_label_media.show()
media = self.m_instance.media_new("2.mp4")
self.m_player.set_media(media)
self.m_player.play()
def slt_three(self):
self.m_label_media.hide()
if __name__ == "__main__":
app = QApplication(sys.argv)
win = vlc_demo()
win.show()
sys.exit(app.exec_())
在windows下,复制VLC媒体播放器目录中的以下文件和目录。该程序可以运行在没有VLC媒体播放器的机器上。
- libvlc.dll
- libvlccore.dll
- plugins
在CentOS7下,有什么办法可以运行不安装VLC媒体播放器的程序吗?
我相信您可能会使用 AFAIU 专为此设计的 Snapcraft Parts。
对于 VLC 那是 https://github.com/videolan/vlc/blob/master/extras/package/snap/snapcraft.yaml