How do I build a static libvlc under CentOS7?
Posted: 16 Jul 2018 09:07
I have a program written by PyQt that plays video by binding libvlc.
Under windows, copy the following files and directories in the VLC media player directory. The program can run on the machine without VLC media player.
Under CentOS7, is there any way to run the program without installing VLC media player?
Code: Select all
# -*- 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_())
Code: Select all
- libvlc.dll
- libvlccore.dll
- plugins