def checkSong(self, song): instance = vlc.libvlc_new(1, ["-q"]) try: media = instance.media_new(song.stream.url) return True except TypeError: print("Error found adding: " + '\033[92m' + song.name + '\033[0m' + " searching for playable version") return False
def __init__(self): self.client = Client() self.client.init() self.sc = songs_controller() self.sc.clearSongsTable() vlc_args = [""] self.instance = vlc.libvlc_new(len(vlc_args),vlc_args) self.mlist = self.instance.media_list_new() self.player = self.instance.media_player_new() self.mlp = self.instance.media_list_player_new() self.mlp.set_media_player(self.player) self.mlp.set_media_list(self.mlist) self.em = self.player.event_manager() self.em.event_attach(vlc.EventType.MediaPlayerEndReached, self.songEnded)
def __init__(self): self.p_instance = vlc.libvlc_new(0,None) self.isFullScreen = False self.p_mi = None
img = cv2.CreateImage((VIDEO_WIDTH, VIDEO_HEIGHT), IPL_DEPTH_8U, 4) img.imageData = videobuf cv2.ShowImage(vlc.libvlc_get_version(), img) cv2.WaitKey(10) cv2.ReleaseImage(img) def unlock(data, id, p_pixels): assert id == None if __name__ == '__main__': vlc_args = ["-I", "dummy", "--ignore-config"] arguments = [bytes(a, "utf-8") for a in vlc_args] #videobuf = (char*)malloc((VIDEO_WIDTH * VIDEO_HEIGHT) << 2); #memset(videobuf, 0, (VIDEO_WIDTH * VIDEO_HEIGHT) << 2); instance = vlc.libvlc_new(len(arguments), (ctypes.c_char_p * len(arguments))(*arguments)) media = vlc.libvlc_media_new_location(instance, "rtsp://192.168.200.20:8554/test") mediaPlayer = vlc.libvlc_media_player_new_from_media(media) vlc.libvlc_media_release(media) #libvlc_media_player_set_media(mediaPlayer, media) vlc.libvlc_video_set_callbacks(mediaPlayer, lock, unlock, display, None) vlc.libvlc_video_set_format(mediaPlayer, "RV32", VIDEO_WIDTH, VIDEO_HEIGHT, VIDEO_WIDTH << 2) vlc.libvlc_media_player_play(mediaPlayer)
#Gets the containing directory given a file path def getDirectoryFromPath(path): arr = path.split(os.sep)#seperate the folders based on os size = len(arr) - 1 dir = r'' for i in range(0, size): dir += arr[i] + os.sep return dir #Returns all files in a given directory def getFilesFromDirectory(directory): return [f for f in listdir(directory) if isfile(join(directory, f))] #Returns a libvlc_media_t* def addFile(libvlc, path): return vlc.libvlc_media_new_path(libvlc, path.encode()) #Returns 0 on success, -1 if the media list is read-only def addFileToMediaList(list, item, index = 0): return vlc.libvlc_media_list_insert_media(list, item, index) #returns the previous and current state def showStateProgress(prevState, newState): return str(prevState) + "------->" + str(newState) #initialize libvlc = vlc.libvlc_new(0, None)# init libvlc mediaListPlayer = vlc.MediaListPlayer()#set media List player