+++ /dev/null
-.classpath
-.project
-.settings/*
-core/.classpath
-core/.project
-core/.settings/*
-core/target/*
-samples/client/.classpath
-samples/client/.project
-samples/client/.settings/*
-samples/client/target/*
-samples/target/*
-target/*
-
+++ /dev/null
-
- First of all, this is a *developers* only version
-
-
-How to compile JVLC
--------------------
-
- JVLC uses maven2 as a project the management tool, take a look at
-
-http://maven.apache.org
-
- to download and for general instructions on how to use it.
-
- To compile the project, run from the bindings/java folder:
-
-mvn install
-
- To import the jvlc project into the eclipse IDE:
-
-mvn eclipse:eclipse
-
- and then import as an existing Java project.
-
-
-How to run the sample client
-----------------------------
-
- 1. mvn install (in bindings/java)
-
- 2. mvn package exec:java (in bindings/java/samples/client)
-
-
-How to create the jvlc site
----------------------------
-
- 1. mvn site
-
-
-
- Happy playing.
+++ /dev/null
-Thanks to:
-
-* Adrien Grand
- for splitting the maven project into modules
-
-* Kuldipsingh Pabla
- for solaris port and various contributions to the native interface.
- for the GenericVideoWidget class
-
-* Tvrtko Bedekovic
- for initial win32 port
-
+++ /dev/null
-[general]
-* JUnit testing
-
-[build system]
-* Detect SWT to add the SWTVideoWidget
-
-
-Items are ordered by priority, the first having the highest priority
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.videolan</groupId>
- <artifactId>jvlc-parent</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- </parent>
- <artifactId>jvlc-core</artifactId>
- <packaging>jar</packaging>
- <name>JVLC - Core</name>
- <description>Java Bindings for VideoLAN - Core</description>
- <licenses>
- <license>
- <name>GPLv2</name>
- <url>http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</url>
- </license>
- </licenses>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- </plugin>
- </plugins>
- </build>
- <dependencies>
- <dependency>
- <groupId>net.java.dev.jna</groupId>
- <artifactId>jna</artifactId>
- <version>3.0.9</version>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-log4j12</artifactId>
- <version>1.5.2</version>
- </dependency>
- <dependency>
- <groupId>commons-io</groupId>
- <artifactId>commons-io</artifactId>
- <version>1.3.2</version>
- <scope>test</scope>
- </dependency>
- </dependencies>
- <ciManagement>
- <system>Hudson</system>
- <url>http://hudson.videolan.org/</url>
- </ciManagement>
- <repositories>
- <repository>
- <id>jvlc</id>
- <name>JVLC Maven Repository</name>
- <url>http://jvlc.ihack.it/maven2</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- <repository>
- <id>central</id>
- <name>Maven Repository</name>
- <url>http://repo1.maven.org/maven2</url>
- <snapshots>
- <enabled>false</enabled>
- </snapshots>
- </repository>
- </repositories>
-</project>
+++ /dev/null
-/*****************************************************************************
- * Audio.java: VLC Java Bindings, audio methods
- *****************************************************************************
- *
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Author: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id: $
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *
- */
-
-package org.videolan.jvlc;
-
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class Audio
-{
-
- private final JVLC jvlc;
-
- /**
- * Constant for left channel audio
- */
- public static final int LEFT_CHANNEL = 3;
-
- /**
- * Constant for right channel audio
- */
- public static final int RIGHT_CHANNEL = 4;
-
- /**
- * Constant for reverse channel audio
- */
- public static final int REVERSE_CHANNEL = 2;
-
- /**
- * Constant for stereo channel audio
- */
- public static final int STEREO_CHANNEL = 1;
-
- /**
- * Constant for dolby channel audio
- */
- public final int DOLBY_CHANNEL = 5;
-
-
- public Audio(JVLC jvlc)
- {
- this.jvlc = jvlc;
- }
-
- public int getTrack(MediaPlayer mediaInstance)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_audio_get_track(mediaInstance.getInstance(), exception);
- }
-
- public int getTrackCount(MediaPlayer mediaInstance)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_audio_get_track_count(mediaInstance.getInstance(), exception);
- }
-
- public void setTrack(MediaPlayer mediaInstance, int track)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_audio_set_track(mediaInstance.getInstance(), track, exception);
- }
-
- public int getChannel()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_audio_get_channel(jvlc.getInstance(), exception);
- }
-
- public void setChannel(int channel)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_audio_set_channel(jvlc.getInstance(), channel, exception);
- }
-
- public boolean getMute()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_audio_get_mute(jvlc.getInstance(), exception) == 1 ? true : false;
- }
-
- public void setMute(boolean value)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_audio_set_mute(jvlc.getInstance(), value ? 1 : 0, exception);
- }
-
- public void toggleMute()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_audio_toggle_mute(jvlc.getInstance(), exception);
- }
-
- public int getVolume()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_audio_get_volume(jvlc.getInstance(), exception);
- }
-
- public void setVolume(int volume)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_audio_set_volume(jvlc.getInstance(), volume, exception);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * JVLC.java: Main Java Class, represents a libvlc_instance_t object
- *****************************************************************************
- *
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Author: Filippo Carone <filippo@carone.org>
- * Philippe Morin <phmorin@free.fr>
- *
- * Created on 28-feb-2006
- *
- * $Id: JVLC.java 20141 2007-05-16 19:31:35Z littlejohn $
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *
- */
-
-package org.videolan.jvlc;
-
-import java.awt.Canvas;
-
-import org.videolan.jvlc.internal.LibVlc;
-import org.videolan.jvlc.internal.LibVlc.LibVlcInstance;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-public class JVLC
-{
-
- private final LibVlcInstance instance;
-
- private final LibVlc libvlc = LibVlc.SYNC_INSTANCE;
-
- private VLM vlm;
-
- private Audio audio;
-
- private volatile boolean released;
-
- private Canvas canvas;
-
- public JVLC()
- {
- this(new String[] {});
- }
-
- public JVLC(String[] args)
- {
- instance = createInstance(args);
- audio = new Audio(this);
- }
-
- public JVLC(String args)
- {
- this(args.split(" "));
- }
-
- /*
- * Core methods
- */
- private LibVlcInstance createInstance(String[] args)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_new(args.length, args, exception);
- }
-
- public MediaPlayer play(String media)
- {
- MediaDescriptor mediaDescriptor = new MediaDescriptor(this, media);
- MediaPlayer mediaPlayer = new MediaPlayer(mediaDescriptor);
- if (canvas != null)
- {
- mediaPlayer.setParent(canvas);
- }
- mediaPlayer.play();
- mediaDescriptor.release();
- return mediaPlayer;
- }
-
- public void setVideoOutput(Canvas canvas)
- {
- this.canvas = canvas;
- }
-
- public Logger getLogger()
- {
- return new Logger(this);
- }
-
- public VLM getVLM()
- {
- if (vlm != null)
- {
- vlm.release();
- }
- this.vlm = new VLM(this);
- return vlm;
- }
-
- public LoggerVerbosityLevel getLogVerbosity()
- {
- int level = libvlc.libvlc_get_log_verbosity(instance);
- return LoggerVerbosityLevel.getSeverity(level);
- }
-
- public void setLogVerbosity(LoggerVerbosityLevel level)
- {
- libvlc.libvlc_set_log_verbosity(instance, level.ordinal());
- }
-
-
- /**
- * Returns the _instance.
- * @return the _instance
- */
- LibVlcInstance getInstance()
- {
- return instance;
- }
-
- /**
- * Returns the libvlc.
- * @return the libvlc
- */
- LibVlc getLibvlc()
- {
- return libvlc;
- }
-
- /**
- * Releases this instance and the native resources.
- */
- public void release()
- {
- if (released)
- {
- return;
- }
- released = true;
- if (vlm != null)
- {
- vlm.release();
- vlm = null;
- }
-
- libvlc.libvlc_release(instance);
- }
-
- /*
- * (non-Javadoc)
- * @see java.lang.Object#finalize()
- */
- @Override
- protected void finalize() throws Throwable
- {
- release();
- super.finalize();
- }
-
- /**
- * @return
- */
- public Audio getAudio()
- {
- return audio;
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * Logger.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import java.util.Iterator;
-
-import org.videolan.jvlc.internal.LibVlc;
-import org.videolan.jvlc.internal.LibVlc.LibVlcLog;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class Logger
-{
- LibVlcLog logInstance;
- LibVlc libvlc;
-
-
- /**
- * @param jvlc The current jvlc instance
- */
- public Logger(JVLC jvlc)
- {
- this.libvlc = jvlc.getLibvlc();
- libvlc_exception_t exception = new libvlc_exception_t();
- this.logInstance = jvlc.getLibvlc().libvlc_log_open(jvlc.getInstance(), exception);
- if (exception.b_raised == 1)
- {
- throw new RuntimeException("Native exception thrown");
- }
- }
-
- public void clear()
- {
- libvlc.libvlc_log_clear(logInstance);
- }
-
- public void close()
- {
- libvlc.libvlc_log_close(logInstance);
- }
-
- public int count()
- {
- return libvlc.libvlc_log_count(logInstance);
- }
-
- public Iterator<LoggerMessage> iterator()
- {
- return new LoggerIterator(this);
- }
-
-
-}
+++ /dev/null
-/*****************************************************************************
- * LoggerIterator.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import java.util.Iterator;
-
-import org.videolan.jvlc.internal.LibVlc.LibVlcLogIterator;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-import org.videolan.jvlc.internal.LibVlc.libvlc_log_message_t;
-
-
-public class LoggerIterator implements Iterator<LoggerMessage>
-{
-
- private Logger logger;
- private LibVlcLogIterator logIterator;
-
- /**
- * @param logInstance
- */
- LoggerIterator(Logger logger)
- {
- this.logger = logger;
- libvlc_exception_t exception = new libvlc_exception_t();
- this.logIterator = logger.libvlc.libvlc_log_get_iterator(logger.logInstance, exception);
- }
-
- /**
- * {@inheritDoc}
- */
- public boolean hasNext()
- {
- return logger.libvlc.libvlc_log_iterator_has_next(logIterator) != 0;
- }
-
- /**
- * {@inheritDoc}
- */
- public LoggerMessage next()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc_log_message_t message = new libvlc_log_message_t();
- logger.libvlc.libvlc_log_iterator_next(logIterator, message, exception);
- LoggerMessage result = new LoggerMessage(message);
- return result;
- }
-
- /**
- * {@inheritDoc}
- * Does not remove the element.
- */
- public void remove()
- {
- //
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- logger.libvlc.libvlc_log_iterator_free(logIterator);
- super.finalize();
- }
-
-
-
-}
+++ /dev/null
-/*****************************************************************************
- * LoggerMessage.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import org.videolan.jvlc.internal.LibVlc.libvlc_log_message_t;
-
-
-public class LoggerMessage
-{
-
- private LoggerVerbosityLevel severity;
- private String header;
- private String message;
- private String name;
- private String type;
-
- /**
- * @param message
- */
- LoggerMessage(libvlc_log_message_t message)
- {
- this.severity = LoggerVerbosityLevel.getSeverity(message.i_severity);
- this.header = message.psz_header;
- this.message = message.psz_message;
- this.name = message.psz_name;
- this.type = message.psz_type;
- }
-
-
- /**
- * Returns the header.
- * @return the header
- */
- public String getHeader()
- {
- return header;
- }
-
-
- /**
- * Returns the message.
- * @return the message
- */
- public String getMessage()
- {
- return message;
- }
-
-
- /**
- * Returns the name.
- * @return the name
- */
- public String getName()
- {
- return name;
- }
-
-
- /**
- * Returns the type.
- * @return the type
- */
- public String getType()
- {
- return type;
- }
-
-
-
- /**
- * Returns the severity.
- * @return the severity
- */
- public LoggerVerbosityLevel getSeverity()
- {
- return severity;
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * LoggerSeverityEnum.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-public enum LoggerVerbosityLevel {
-
- INFO, ERROR, WARNING, DEBUG;
-
- public static LoggerVerbosityLevel getSeverity(int ordinal)
- {
- return new LoggerVerbosityLevel[]{INFO, ERROR, WARNING, DEBUG }[ordinal];
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaDescriptor.java: VLC Java Bindings Media Descriptor
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import org.videolan.jvlc.internal.LibVlc;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class MediaDescriptor
-{
- private LibVlcMedia instance;
- private LibVlc libvlc;
- private LibVlcEventManager eventManager;
- private volatile boolean released;
-
- private MediaPlayer mediaPlayer;
-
- /**
- * @param jvlc The jvlc instance to create the media descriptor for.
- * @param media The media string
- */
- public MediaDescriptor(JVLC jvlc, String media)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc = jvlc.getLibvlc();
- instance = libvlc.libvlc_media_new(jvlc.getInstance(), media, exception);
- eventManager = libvlc.libvlc_media_event_manager(instance, exception);
- }
-
- MediaDescriptor(JVLC jvlc, LibVlcMedia instance)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc = jvlc.getLibvlc();
- this.instance = instance;
- eventManager = libvlc.libvlc_media_event_manager(instance, exception);
- }
-
- public void addOption(String option)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_add_option(instance, option, exception );
- }
-
- public String getMrl()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_get_mrl(instance, exception);
- }
-
- public MediaPlayer getMediaPlayer()
- {
- if (mediaPlayer == null)
- {
- this.mediaPlayer = new MediaPlayer(this);
- }
- return this.mediaPlayer;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- release();
- super.finalize();
- }
-
-
-
- /**
- * Returns the instance.
- * @return the instance
- */
- LibVlcMedia getInstance()
- {
- return instance;
- }
-
- /**
- * Returns the libvlc.
- * @return the libvlc
- */
- LibVlc getLibvlc()
- {
- return libvlc;
- }
-
- /**
- *
- */
- public void release()
- {
- if (released)
- {
- return;
- }
- released = true;
- libvlc.libvlc_media_release(instance);
- }
-
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaList.java: VLC Java Bindings, MediaList
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class MediaList
-{
-
- private final JVLC jvlc;
-
- private final LibVlcMediaList instance;
-
- private List<String> items = new ArrayList<String>();
-
- private LibVlcEventManager eventManager;
-
- private volatile boolean released;
-
- public MediaList(JVLC jvlc)
- {
- this.jvlc = jvlc;
- libvlc_exception_t exception = new libvlc_exception_t();
- instance = jvlc.getLibvlc().libvlc_media_list_new(jvlc.getInstance(), exception);
- eventManager = jvlc.getLibvlc().libvlc_media_list_event_manager(instance, exception);
- }
-
- /**
- * @param mrl The media resource locator to add to the media list.
- */
- public void addMedia(String mrl)
- {
- MediaDescriptor descriptor = new MediaDescriptor(jvlc, mrl);
- addMedia(descriptor);
- }
-
- /**
- * @param descriptor The media descriptor to add to the media list.
- */
- public void addMedia(MediaDescriptor descriptor)
- {
- if (items.contains(descriptor.getMrl()))
- {
- return;
- }
- items.add(descriptor.getMrl());
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_add_media(instance, descriptor.getInstance(), exception);
- }
-
- /**
- * @return The current number of items in the media list.
- */
- public int size()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_media_list_count(instance, exception);
- }
-
- /**
- * @param descriptor The media descriptor to get the index of.
- * @return The index of the media descriptor, or -1 if not found.
- */
- public int indexOf(MediaDescriptor descriptor)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_media_list_index_of_item(instance, descriptor.getInstance(), exception);
- }
-
- /**
- * @param index The index of the media descriptor to get.
- * @return The media descriptor at the given index.
- * @throws IndexOutOfBoundsException if index is bigger than size() or < 0, or there are no items in the media_list.
- */
- public MediaDescriptor getMediaDescriptorAtIndex(int index)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- if (size() == 0)
- {
- throw new IndexOutOfBoundsException();
- }
- if (index < 0 || index > size())
- {
- throw new IndexOutOfBoundsException();
- }
- LibVlcMedia descriptor = jvlc.getLibvlc().libvlc_media_list_item_at_index(instance, index, exception);
- return new MediaDescriptor(jvlc, descriptor);
- }
-
- /**
- * @param index The index of the media to remove.
- * @return True if the media was successfully removed, false otherwise.
- */
- public boolean removeMedia(int index)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_remove_index(instance, index, exception);
- if (exception.b_raised == 0)
- {
- items.remove(index);
- return true;
- }
- return false;
- }
-
- /**
- * @param mrl The media descriptor mrl.
- */
- public boolean removeMedia(String mrl)
- {
- int index = items.indexOf(mrl);
- if (index == -1)
- {
- return false;
- }
- return removeMedia(index);
- }
-
- /**
- * @param mediaDescriptor The media descriptor to remove.
- */
- public boolean removeMedia(MediaDescriptor mediaDescriptor)
- {
- String mrl = mediaDescriptor.getMrl();
- int index = items.indexOf(mrl);
- if (index == -1)
- {
- return false;
- }
- return removeMedia(index);
- }
-
- /**
- * Removes all items from the media list.
- */
- public void clear()
- {
- for (int i = 0; i < size(); i++)
- {
- removeMedia(i);
- }
- }
-
- /**
- * @param descriptor The media descriptor to insert.
- * @param index The index of the inserted media descriptor.
- */
- public void insertMediaDescriptor(MediaDescriptor descriptor, int index)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc
- .getLibvlc()
- .libvlc_media_list_insert_media(instance, descriptor.getInstance(), index, exception);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- release();
- super.finalize();
- }
-
- /**
- * Returns the instance.
- * @return the instance
- */
- LibVlcMediaList getInstance()
- {
- return instance;
- }
-
- /**
- *
- */
- public void release()
- {
- if (released)
- {
- return;
- }
- released = true;
-
- jvlc.getLibvlc().libvlc_media_list_release(instance);
- }
-
-
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaListPlayer.java: VLC Java Bindings, MediaList player
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaListPlayer;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class MediaListPlayer
-{
-
- private final LibVlcMediaListPlayer instance;
-
- private final JVLC jvlc;
-
- private volatile boolean released;
-
- public MediaListPlayer(JVLC jvlc)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- this.jvlc = jvlc;
- instance = jvlc.getLibvlc().libvlc_media_list_player_new(jvlc.getInstance(), exception);
- }
-
- public void setMediaList(MediaList list)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_set_media_list(instance, list.getInstance(), exception);
- }
-
- public boolean isPlaying()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 1;
- }
-
-
- /**
- *
- */
- public void play()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_play(instance, exception);
- try
- {
- while (jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 0)
- {
- Thread.sleep(25);
- }
- }
- catch(InterruptedException e)
- {
- //
- }
- }
-
- public void stop()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_stop(instance, exception);
- }
-
- public void pause()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_pause(instance, exception);
- }
-
- public void next()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_next(instance, exception);
- }
-
- /**
- * Plays the given descriptor and returns only when the player has started to play.
- * @param descriptor The media descriptor to play
- */
- public void playItem(MediaDescriptor descriptor)
- {
- playItem(descriptor, true);
- }
-
- /**
- * @param descriptor The media descriptor to play
- * @param synchronous If true it does not return until the player is not playing.
- */
- public void playItem(MediaDescriptor descriptor, boolean synchronous)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_play_item(instance, descriptor.getInstance(), exception);
- if (!synchronous)
- {
- return;
- }
-
- try
- {
- while (jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 0)
- {
- Thread.sleep(25);
- }
- }
- catch(InterruptedException e)
- {
- //
- }
-
- }
-
- /**
- * Plays the item at the given index and returns only when the player has started to play.
- * @param index The item index to play.
- */
- public void playItem(int index)
- {
- playItem(index, true);
- }
-
- /**
- * @param index The item index to play.
- * @param synchronous If true it does not return until the player is not playing.
- */
- public void playItem(int index, boolean synchronous)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_play_item_at_index(instance, index, exception);
- try
- {
- while (jvlc.getLibvlc().libvlc_media_list_player_is_playing(instance, exception) == 0)
- {
- Thread.sleep(25);
- }
- }
- catch(InterruptedException e)
- {
- //
- }
- }
-
- public void setMediaInstance(MediaPlayer mediaInstance)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_media_list_player_set_media_player(instance, mediaInstance.getInstance(), exception);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- release();
- super.finalize();
- }
-
- /**
- *
- */
- public void release()
- {
- if (released)
- {
- return;
- }
- released = true;
- jvlc.getLibvlc().libvlc_media_list_player_release(instance);
-
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaInstance.java: VLC Java Bindings Media Instance
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import java.awt.Canvas;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.List;
-
-import org.videolan.jvlc.event.MediaPlayerCallback;
-import org.videolan.jvlc.event.MediaPlayerListener;
-import org.videolan.jvlc.internal.LibVlc;
-import org.videolan.jvlc.internal.LibVlcEventType;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaPlayer;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-import com.sun.jna.Native;
-import com.sun.jna.Platform;
-
-
-public class MediaPlayer
-{
-
- private final LibVlcMediaPlayer instance;
-
- private final LibVlc libvlc;
-
- private final LibVlcEventManager eventManager;
-
- private List<MediaPlayerCallback> callbacks = new ArrayList<MediaPlayerCallback>();
-
- private MediaDescriptor mediaDescriptor;
-
- private volatile boolean released;
-
- MediaPlayer(JVLC jvlc, LibVlcMediaPlayer instance)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- this.instance = instance;
- libvlc = jvlc.getLibvlc();
- eventManager = libvlc.libvlc_media_player_event_manager(instance, exception);
- }
-
- public MediaPlayer(MediaDescriptor mediaDescriptor)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc = mediaDescriptor.getLibvlc();
- instance = libvlc.libvlc_media_player_new_from_media(mediaDescriptor.getInstance(), exception);
- eventManager = libvlc.libvlc_media_player_event_manager(instance, exception);
- this.mediaDescriptor = mediaDescriptor;
- }
-
- public MediaDescriptor getMediaDescriptor()
- {
- return mediaDescriptor;
- }
-
- public void play()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_player_play(instance, exception);
- }
-
- public void stop()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_player_stop(instance, exception);
- }
-
- public void pause()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_player_pause(instance, exception);
- }
-
- public long getLength()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_player_get_length(instance, exception);
- }
-
- public long getTime()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_player_get_time(instance, exception);
- }
-
- public void setTime(long time)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_player_set_time(instance, time, exception);
- }
-
- public float getPosition()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_player_get_position(instance, exception);
- }
-
- public void setPosition(float position)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_player_set_position(instance, position, exception);
- }
-
- public boolean willPlay()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return (libvlc.libvlc_media_player_will_play(instance, exception) == 1);
- }
-
- public float getRate()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_player_get_rate(instance, exception);
- }
-
- public void setRate(float rate)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_media_player_set_rate(instance, rate, exception);
- }
-
- public boolean hasVideoOutput()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return (libvlc.libvlc_media_player_has_vout(instance, exception) == 1);
- }
-
- public float getFPS()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_player_get_fps(instance, exception);
- }
-
- public boolean isPlaying()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_media_player_is_playing(instance, exception) == 1 ? true : false;
- }
-
- public void addListener(final MediaPlayerListener listener)
- {
- MediaPlayerCallback callback = new MediaPlayerCallback(this, listener);
- libvlc_exception_t exception = new libvlc_exception_t();
- for (LibVlcEventType event : EnumSet.range(
- LibVlcEventType.libvlc_MediaPlayerPlaying,
- LibVlcEventType.libvlc_MediaPlayerTimeChanged))
- {
- libvlc.libvlc_event_attach(eventManager, event.ordinal(), callback, null, exception);
- }
- callbacks.add(callback);
- }
-
- public void setParent(Canvas canvas)
- {
- long drawable = Native.getComponentID(canvas);
- libvlc_exception_t exception = new libvlc_exception_t();
- if (Platform.isWindows())
- {
- libvlc.libvlc_media_player_set_hwnd(instance, drawable, exception);
- }
- else
- {
- libvlc.libvlc_media_player_set_xwindow(instance, drawable, exception);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- release();
- super.finalize();
- }
-
- public void release()
- {
- if (released)
- {
- return;
- }
- released = true;
-
- libvlc_exception_t exception = new libvlc_exception_t();
- for (MediaPlayerCallback callback : callbacks)
- {
- for (LibVlcEventType event : EnumSet.range(
- LibVlcEventType.libvlc_MediaPlayerPlaying,
- LibVlcEventType.libvlc_MediaPlayerPositionChanged))
- {
- libvlc.libvlc_event_detach(eventManager, event.ordinal(), callback, null, exception);
- }
- }
- libvlc.libvlc_media_player_release(instance);
-
- }
-
- /**
- * Returns the instance.
- * @return the instance
- */
- LibVlcMediaPlayer getInstance()
- {
- return instance;
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * JVLC.java: Main Java Class, represents a libvlc_instance_t object
- *****************************************************************************
- *
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * Author: Philippe Morin <phmorin@free.fr>
- *
- * Created on 18-jul-2006
- *
- * $Id $
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *
- */
-
-package org.videolan.jvlc;
-
-import java.lang.Exception;
-
-
-public class VLCException extends Exception
-{
-
- /**
- *
- */
- private static final long serialVersionUID = -3063632323017889L;
-
- public VLCException()
- {
- super();
- }
-
- public VLCException(String message)
- {
- super(message);
- }
-
- public VLCException(String message, Throwable cause)
- {
- super(message, cause);
- }
-
- public VLCException(Throwable cause)
- {
- super(cause);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * VLM.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class VLM
-{
-
- private JVLC jvlc;
-
- private volatile boolean released;
-
- public VLM(JVLC jvlc)
- {
- this.jvlc = jvlc;
- }
-
- public void addBroadcast(String name, String input, String output, String[] options, boolean enabled, boolean loop)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_add_broadcast(
- jvlc.getInstance(),
- name,
- input,
- output,
- options == null ? 0 : options.length,
- options,
- enabled ? 1 : 0,
- loop ? 1 : 0,
- exception);
- }
-
- public void addVod(String name, String input, String[] options, boolean enabled, String muxer)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_add_vod(
- jvlc.getInstance(),
- name,
- input,
- options == null ? 0 : options.length,
- options,
- enabled ? 1 : 0,
- muxer,
- exception);
- }
-
- public void deleteMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_del_media(jvlc.getInstance(), name, exception);
- }
-
- public void enableMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_set_enabled(jvlc.getInstance(), name, 1, exception);
- }
-
- public void disableMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_set_enabled(jvlc.getInstance(), name, 0, exception);
- }
-
- public void setMediaOutput(String name, String output)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_set_output(jvlc.getInstance(), name, output, exception);
- }
-
- public void setMediaInput(String name, String input)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_set_input(jvlc.getInstance(), name, input, exception);
- }
-
- public void addMediaInput(String name, String input)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_add_input(jvlc.getInstance(), name, input, exception);
- }
-
- public void setMux(String name, String muxer)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_set_mux(jvlc.getInstance(), name, muxer, exception);
- }
-
- public void setMediaLoop(String media, boolean loop)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_set_loop(jvlc.getInstance(), media, loop ? 1 : 0, exception);
- }
-
- public void changeMedia(String name, String input, String output, String[] options, boolean enabled, boolean loop)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_change_media(
- jvlc.getInstance(),
- name,
- input,
- output,
- options == null ? 0 : options.length,
- options,
- enabled ? 1 : 0,
- loop ? 1 : 0,
- exception);
- }
-
- public void playMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_play_media(jvlc.getInstance(), name, exception);
- }
-
- public void stopMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_stop_media(jvlc.getInstance(), name, exception);
- }
-
- public void pauseMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_pause_media(jvlc.getInstance(), name, exception);
- }
-
- public void seekMedia(String name, float percentage)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_seek_media(jvlc.getInstance(), name, percentage, exception);
- }
-
- public void showMedia(String name)
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_show_media(jvlc.getInstance(), name, exception);
- }
-
- /**
- * Releases native resources related to VLM.
- */
- public void release()
- {
- if (released)
- {
- return;
- }
- released = true;
- libvlc_exception_t exception = new libvlc_exception_t();
- jvlc.getLibvlc().libvlc_vlm_release(jvlc.getInstance(), exception);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected void finalize() throws Throwable
- {
- release();
- super.finalize();
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * Video.java: JVLC Video Output
- *****************************************************************************
- *
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Author: Filippo Carone <filippo@carone.org>
- * Philippe Morin <phmorin@free.fr>
- *
- * Created on 28-feb-2006
- *
- * $Id: JVLC.java 20141 2007-05-16 19:31:35Z littlejohn $
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
- *
- */
-package org.videolan.jvlc;
-
-import java.awt.Dimension;
-
-import org.videolan.jvlc.internal.LibVlc;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-public class Video
-{
-
- private final LibVlc libvlc;
-
- public Video( JVLC jvlc) {
- this.libvlc = jvlc.getLibvlc();
- }
-
- /** (non-Javadoc)
- * @deprecated
- * @since
- */
- public void destroyVideo(MediaPlayer media)
- {
- return;
- }
-
- /* (non-Javadoc)
- * @see org.videolan.jvlc.VideoIntf#getFullscreen()
- */
- public boolean getFullscreen(MediaPlayer media) {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_get_fullscreen(media.getInstance(), exception) == 1 ? true : false;
- }
-
- /* (non-Javadoc)
- * @see org.videolan.jvlc.VideoIntf#getSnapshot(java.lang.String)
- */
- public void getSnapshot(MediaPlayer media, String filepath, int width, int height) {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_video_take_snapshot(media.getInstance(), filepath, width, height, exception);
- }
-
- /* (non-Javadoc)
- * @see org.videolan.jvlc.VideoIntf#getVideoHeight()
- */
- public int getHeight(MediaPlayer media) {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_video_get_height(media.getInstance(), exception);
- }
-
- /* (non-Javadoc)
- * @see org.videolan.jvlc.VideoIntf#getVideoWidth()
- */
- public int getWidth(MediaPlayer media) {
- libvlc_exception_t exception = new libvlc_exception_t();
- return libvlc.libvlc_video_get_width(media.getInstance(), exception);
- }
-
- /**
- * @deprecated
- */
- public void reparent(MediaPlayer media, java.awt.Canvas canvas) {
- }
-
- /**
- * @deprecated
- */
- public void setSize(int width, int height) {
- }
-
- public void setFullscreen(MediaPlayer media, boolean fullscreen) {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_set_fullscreen(media.getInstance(), fullscreen? 1 : 0, exception);
- }
-
- public void toggleFullscreen(MediaPlayer media) {
- libvlc_exception_t exception = new libvlc_exception_t();
- libvlc.libvlc_toggle_fullscreen(media.getInstance(), exception);
- }
-
- public Dimension getSize(MediaPlayer media) {
- return new Dimension (getWidth(media), getHeight(media));
- }
-
-
- /**
- * @param d
- * @deprecated
- */
- public void setSize(Dimension d) {
- setSize(d.width, d.height);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * MediaInstancePlayCallback.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.event;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.videolan.jvlc.MediaPlayer;
-import org.videolan.jvlc.internal.LibVlc;
-import org.videolan.jvlc.internal.LibVlcEventType;
-import org.videolan.jvlc.internal.LibVlc.LibVlcCallback;
-import org.videolan.jvlc.internal.LibVlc.libvlc_event_t;
-import org.videolan.jvlc.internal.LibVlc.media_player_time_changed;
-
-import com.sun.jna.Pointer;
-
-
-public class MediaPlayerCallback implements LibVlcCallback
-{
-
- private MediaPlayerListener listener;
- private MediaPlayer mediaPlayer;
-
- /**
- * Logger.
- */
- private Logger log = LoggerFactory.getLogger(MediaPlayerCallback.class);
-
- public MediaPlayerCallback(MediaPlayer mediaInstance, MediaPlayerListener listener)
- {
- this.mediaPlayer = mediaInstance;
- this.listener = listener;
- }
- /**
- * {@inheritDoc}
- */
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal())
- {
- listener.playing(mediaPlayer);
- }
- else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPaused.ordinal())
- {
- listener.paused(mediaPlayer);
- }
- else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerEndReached.ordinal())
- {
- listener.endReached(mediaPlayer);
- }
- else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerPositionChanged.ordinal())
- {
- listener.positionChanged(mediaPlayer);
- }
- else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerStopped.ordinal())
- {
- listener.stopped(mediaPlayer);
- }
- else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerTimeChanged.ordinal())
- {
- libvlc_event.event_type_specific.setType(LibVlc.media_player_time_changed.class);
- LibVlc.media_player_time_changed timeChanged = (media_player_time_changed) libvlc_event.event_type_specific
- .readField("media_player_time_changed");
- listener.timeChanged(mediaPlayer, timeChanged.new_time);
- }
- else if (libvlc_event.type == LibVlcEventType.libvlc_MediaPlayerEncounteredError.ordinal())
- {
- log.warn("Media player encountered error.");
- listener.errorOccurred(mediaPlayer);
- }
- else
- {
- log.debug("Unsupported event error. Event id: {}", libvlc_event.type);
- }
- }
-}
+++ /dev/null
-/*****************************************************************************
- * mediaPlayerPlayListener.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.event;
-
-import org.videolan.jvlc.MediaPlayer;
-
-
-public interface MediaPlayerListener
-{
-
- void playing(MediaPlayer mediaPlayer);
-
- void paused(MediaPlayer mediaPlayer);
-
- void stopped(MediaPlayer mediaPlayer);
-
- void endReached(MediaPlayer mediaPlayer);
-
- void timeChanged(MediaPlayer mediaPlayer, long newTime);
-
- void positionChanged(MediaPlayer mediaPlayer);
-
- void errorOccurred(MediaPlayer mediaPlayer);
-
-}
+++ /dev/null
-package org.videolan.jvlc.example;
-
-import org.videolan.jvlc.Audio;
-import org.videolan.jvlc.JVLC;
-import org.videolan.jvlc.MediaDescriptor;
-import org.videolan.jvlc.MediaPlayer;
-import org.videolan.jvlc.Video;
-import org.videolan.jvlc.event.MediaPlayerListener;
-
-
-public class VLCExample
-{
-
- public static void main(String[] args) throws InterruptedException
- {
- System.out.println("== Starting VLCExample ==");
- if (args.length == 0)
- {
- System.out.print("Creating a JVLC instance without args");
- }
- else
- {
- System.out.println("Creating a JVLC instance with args: ");
- for (int i = 0; i < args.length; i++)
- {
- System.out.println(i + ") " + args[i]);
- }
- }
- JVLC jvlc = new JVLC(args);
- System.out.println("... done.");
-
- MediaDescriptor mediaDescriptor = new MediaDescriptor(jvlc, "/home/carone/apps/a.avi");
- MediaPlayer mediaPlayer = mediaDescriptor.getMediaPlayer();
-
- mediaPlayer.addListener(new MediaPlayerListener()
- {
-
- public void endReached(MediaPlayer mediaPlayer)
- {
- System.out.println("Media instance end reached. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
- }
-
- public void paused(MediaPlayer mediaPlayer)
- {
- System.out.println("Media instance paused. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
- }
-
- public void playing(MediaPlayer mediaPlayer)
- {
- System.out.println("Media instance played. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
- }
-
- public void positionChanged(MediaPlayer mediaPlayer)
- {
- // TODO Auto-generated method stub
- }
-
- public void timeChanged(MediaPlayer mediaPlayer, long newTime)
- {
- System.out.println("new time: " + newTime);
- }
-
- public void stopped(MediaPlayer mediaPlayer)
- {
- System.out.println("Media player stopped. MRL: " + mediaPlayer.getMediaDescriptor().getMrl());
- }
-
- public void errorOccurred(MediaPlayer mediaPlayer)
- {
- System.out.println("An error has occurred.");
- }
- });
- mediaPlayer.play();
-
- while (!mediaPlayer.hasVideoOutput())
- {
- Thread.sleep(100);
- }
-
- Video video = new Video(jvlc);
- System.out.print(video.getWidth(mediaPlayer));
- System.out.print("x");
- System.out.println(video.getHeight(mediaPlayer));
- System.out.print("Fullscreen... ");
- video.setFullscreen(mediaPlayer, true);
- Thread.sleep(3000);
- System.out.println("real size.");
- video.setFullscreen(mediaPlayer, false);
- System.out.print("Taking snapshot... ");
- video.getSnapshot(mediaPlayer, System.getProperty("user.dir") + "/snap.png", 0, 0);
- System.out.println("taken. (see " + System.getProperty("user.dir") + "/snap.png )");
- Thread.sleep(2000);
- System.out.println("Resizing to 300x300");
- video.setSize(300, 300);
-
- System.out.print("Muting...");
- Audio audio = new Audio(jvlc);
- audio.setMute(true);
- Thread.sleep(3000);
- System.out.println("unmuting.");
- audio.setMute(false);
- Thread.sleep(3000);
- System.out.println("Volume is: " + audio.getVolume());
- System.out.print("Setting volume to 150... ");
- audio.setVolume(150);
- System.out.println("done");
- System.out.println("== AUDIO INFO ==");
- System.out.println("Audio track number: " + audio.getTrack(mediaPlayer));
- System.out.println("Audio channel info: " + audio.getChannel());
- Thread.sleep(3000);
- System.out.println("MEDIA PLAYER INFORMATION");
- System.out.println("--------------------------");
- System.out.println("Total length (ms) :\t" + mediaPlayer.getLength());
- System.out.println("Input time (ms) :\t" + mediaPlayer.getTime());
- System.out.println("Input position [0-1]:\t" + mediaPlayer.getPosition());
- System.out.println("Input FPS :\t" + mediaPlayer.getFPS());
-
- System.out.println("Everything fine ;)");
- return;
- }
-}
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import com.sun.jna.Callback;
-import com.sun.jna.Library;
-import com.sun.jna.Native;
-import com.sun.jna.NativeLong;
-import com.sun.jna.Platform;
-import com.sun.jna.Pointer;
-import com.sun.jna.PointerType;
-import com.sun.jna.Structure;
-import com.sun.jna.Union;
-
-
-public interface LibVlc extends Library
-{
-
- LibVlc INSTANCE = (LibVlc) Native.loadLibrary(Platform.isWindows() ? "libvlc" : "vlc", LibVlc.class);
-
- LibVlc SYNC_INSTANCE = (LibVlc) Native.synchronizedLibrary(INSTANCE);
-
- public static class libvlc_exception_t extends Structure
- {
-
- public int b_raised;
- }
-
- public static interface LibVlcCallback extends Callback
- {
-
- void callback(libvlc_event_t libvlc_event, Pointer userData);
- }
-
- public static class libvlc_log_message_t extends Structure
- {
-
- public int sizeof_msg; /* sizeof() of message structure, must be filled in by user */
-
- public int i_severity; /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
-
- public String psz_type; /* module type */
-
- public String psz_name; /* module name */
-
- public String psz_header; /* optional header */
-
- public String psz_message; /* message */
- }
-
- public static class libvlc_event_t extends Structure
- {
-
- public int type;
-
- public Pointer p_obj;
-
- public event_type_specific event_type_specific;
-
- }
-
- public class media_meta_changed extends Structure
- {
-
- // Enum !
- public Pointer meta_type;
- }
-
- public class media_subitem_added extends Structure
- {
-
- public LibVlcMedia new_child;
- }
-
- public class media_duration_changed extends Structure
- {
-
- public NativeLong new_duration;
- }
-
- public class media_preparsed_changed extends Structure
- {
-
- public int new_status;
- }
-
- public class media_freed extends Structure
- {
-
- public LibVlcMedia md;
- }
-
- public class media_state_changed extends Structure
- {
-
- // @todo: check this one
- public int new_state;
- }
-
- /* media instance */
-
- public class media_player_position_changed extends Structure
- {
-
- public float new_position;
- }
-
- public class media_player_time_changed extends Structure
- {
-
- // @todo: check this one
- public long new_time;
- }
-
- public class media_player_title_changed extends Structure
- {
-
- public int new_title;
- }
-
- public class media_player_seekable_changed extends Structure
- {
-
- public NativeLong new_seekable;
- }
-
- public class media_player_pausable_changed extends Structure
- {
-
- public NativeLong new_pausable;
- }
-
- /* media list */
- public class media_list_item_added extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_will_add_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_item_deleted extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_will_delete_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- /* media list view */
- public class media_list_view_item_added extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_view_will_add_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_view_item_deleted extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_view_will_delete_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_player_next_item_set extends Structure
- {
-
- public LibVlcMedia item;
- }
-
- public class media_player_snapshot_taken extends Structure
- {
-
- public String psz_filename;
- }
-
- public class media_player_length_changed extends Structure
- {
-
- // @todo: check the type
- public long new_length;
- }
-
- public class vlm_media_event extends Structure
- {
-
- public String psz_media_name;
-
- public String psz_instance_name;
- }
-
- public class event_type_specific extends Union
- {
-
- public media_meta_changed media_meta_changed;
-
- public media_subitem_added media_subitem_added;
-
- public media_duration_changed media_duration_changed;
-
- public media_preparsed_changed media_preparsed_changed;
-
- public media_freed media_freed;
-
- public media_state_changed media_state_changed;
-
- public media_player_position_changed media_player_position_changed;
-
- public media_player_time_changed media_player_time_changed;
-
- public media_player_title_changed media_player_title_changed;
-
- public media_player_seekable_changed media_player_seekable_changed;
-
- public media_player_pausable_changed media_player_pausable_changed;
-
- public media_list_item_added media_list_item_added;
-
- public media_list_will_add_item media_list_will_add_item;
-
- public media_list_item_deleted media_list_item_deleted;
-
- public media_list_will_delete_item media_list_will_delete_item;
-
- public media_list_view_item_added media_list_view_item_added;
-
- public media_list_view_will_add_item media_list_view_will_add_item;
-
- public media_list_view_item_deleted media_list_view_item_deleted;
-
- public media_list_view_will_delete_item media_list_view_will_delete_item;
-
- public media_list_player_next_item_set media_list_player_next_item_set;
-
- public media_player_snapshot_taken media_player_snapshot_taken;
-
- public media_player_length_changed media_player_length_changed;
-
- public vlm_media_event vlm_media_event;
- }
-
- public class LibVlcLog extends PointerType
- {
- }
-
- public class LibVlcMediaListView extends PointerType
- {
- }
-
- public class LibVlcTrackDescription extends PointerType
- {
- }
-
- public class LibVlcMediaListPlayer extends PointerType
- {
- }
-
- public class LibVlcInstance extends PointerType
- {
- }
-
- public class LibVlcEventManager extends PointerType
- {
- }
-
- public class LibVlcMediaLibrary extends PointerType
- {
- }
-
- public class LibVlcMediaList extends PointerType
- {
- }
-
- public class LibVlcAudioOutput extends PointerType
- {
- }
-
- public class LibVlcMediaPlayer extends PointerType
- {
- }
-
- public class LibVlcMedia extends PointerType
- {
- }
-
- public class LibVlcMediaDiscoverer extends PointerType
- {
- }
-
- public class LibVlcLogIterator extends PointerType
- {
- }
-
- void libvlc_exception_init(libvlc_exception_t p_exception);
-
- void libvlc_exception_clear(libvlc_exception_t p_exception);
-
- int libvlc_exception_raised(final libvlc_exception_t exception);
-
- String libvlc_errmsg();
-
- void libvlc_clearerr();
-
- LibVlcInstance libvlc_new(int argc, String[] argv, libvlc_exception_t p_e);
-
- void libvlc_release(LibVlcInstance p_instance);
-
- void libvlc_retain(LibVlcInstance p_instance);
-
- int libvlc_add_intf(LibVlcInstance p_instance, String name, libvlc_exception_t p_exception);
-
- void libvlc_wait(LibVlcInstance p_instance);
-
- String libvlc_get_version();
-
- String libvlc_get_compiler();
-
- String libvlc_get_changeset();
-
- void libvlc_free(Pointer ptr);
-
- void libvlc_event_attach(LibVlcEventManager p_event_manager, int i_event_type, LibVlcCallback f_callback,
- Pointer user_data, libvlc_exception_t p_e);
-
- void libvlc_event_detach(LibVlcEventManager p_event_manager, int i_event_type, LibVlcCallback f_callback,
- Pointer p_user_data, libvlc_exception_t p_e);
-
- String libvlc_event_type_name(int event_type);
-
- int libvlc_get_log_verbosity(LibVlcInstance p_instance);
-
- void libvlc_set_log_verbosity(LibVlcInstance p_instance, int level);
-
- LibVlcLog libvlc_log_open(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_log_close(LibVlcLog p_log);
-
- int libvlc_log_count(LibVlcLog p_log);
-
- void libvlc_log_clear(LibVlcLog p_log);
-
- LibVlcLogIterator libvlc_log_get_iterator(LibVlcLog p_log, libvlc_exception_t p_e);
-
- void libvlc_log_iterator_free(LibVlcLogIterator p_iter);
-
- int libvlc_log_iterator_has_next(LibVlcLogIterator p_iter);
-
- libvlc_log_message_t libvlc_log_iterator_next(LibVlcLogIterator p_iter, libvlc_log_message_t p_buffer,
- libvlc_exception_t p_e);
-
- LibVlcMediaDiscoverer libvlc_media_discoverer_new_from_name(LibVlcInstance p_inst, String psz_name,
- libvlc_exception_t p_e);
-
- void libvlc_media_discoverer_release(LibVlcMediaDiscoverer p_mdis);
-
- String libvlc_media_discoverer_localized_name(LibVlcMediaDiscoverer p_mdis);
-
- LibVlcMediaList libvlc_media_discoverer_media_list(LibVlcMediaDiscoverer p_mdis);
-
- LibVlcEventManager libvlc_media_discoverer_event_manager(LibVlcMediaDiscoverer p_mdis);
-
- int libvlc_media_discoverer_is_running(LibVlcMediaDiscoverer p_mdis);
-
- LibVlcMedia libvlc_media_new(LibVlcInstance p_instance, String psz_mrl, libvlc_exception_t p_e);
-
- LibVlcMedia libvlc_media_new_as_node(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
-
- void libvlc_media_add_option(LibVlcMedia p_md, String ppsz_options, libvlc_exception_t p_e);
-
- void libvlc_media_add_option_flag(LibVlcMedia p_md, String ppsz_options, MediaOption i_flags, libvlc_exception_t p_e);
-
- void libvlc_media_retain(LibVlcMedia p_meta_desc);
-
- void libvlc_media_release(LibVlcMedia p_meta_desc);
-
- String libvlc_media_get_mrl(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- LibVlcMedia libvlc_media_duplicate(LibVlcMedia p_meta_desc);
-
- String libvlc_media_get_meta(LibVlcMedia p_meta_desc, Meta e_meta, libvlc_exception_t p_e);
-
- int libvlc_media_get_state(LibVlcMedia p_meta_desc, libvlc_exception_t p_e);
-
- LibVlcMediaList libvlc_media_subitems(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- LibVlcEventManager libvlc_media_event_manager(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- long libvlc_media_get_duration(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- int libvlc_media_is_preparsed(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- void libvlc_media_set_user_data(LibVlcMedia p_md, Pointer p_new_user_data, libvlc_exception_t p_e);
-
- Pointer libvlc_media_get_user_data(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- LibVlcMediaLibrary libvlc_media_library_new(LibVlcInstance p_inst, libvlc_exception_t p_e);
-
- void libvlc_media_library_release(LibVlcMediaLibrary p_mlib);
-
- void libvlc_media_library_retain(LibVlcMediaLibrary p_mlib);
-
- void libvlc_media_library_load(LibVlcMediaLibrary p_mlib, libvlc_exception_t p_e);
-
- void libvlc_media_library_save(LibVlcMediaLibrary p_mlib, libvlc_exception_t p_e);
-
- LibVlcMediaList libvlc_media_library_media_list(LibVlcMediaLibrary p_mlib, libvlc_exception_t p_e);
-
- LibVlcMediaList libvlc_media_list_new(LibVlcInstance p_libvlc, libvlc_exception_t p_e);
-
- void libvlc_media_list_release(LibVlcMediaList p_ml);
-
- void libvlc_media_list_retain(LibVlcMediaList p_ml);
-
- void libvlc_media_list_set_media(LibVlcMediaList p_ml, LibVlcMedia p_mi, libvlc_exception_t p_e);
-
- LibVlcMedia libvlc_media_list_media(LibVlcMediaList p_ml, libvlc_exception_t p_e);
-
- void libvlc_media_list_add_media(LibVlcMediaList p_ml, LibVlcMedia p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_list_insert_media(LibVlcMediaList p_ml, LibVlcMedia p_mi, int i_pos, libvlc_exception_t p_e);
-
- void libvlc_media_list_remove_index(LibVlcMediaList p_ml, int i_pos, libvlc_exception_t p_e);
-
- int libvlc_media_list_count(LibVlcMediaList p_mlist, libvlc_exception_t p_e);
-
- LibVlcMedia libvlc_media_list_item_at_index(LibVlcMediaList p_ml, int i_pos, libvlc_exception_t p_e);
-
- int libvlc_media_list_index_of_item(LibVlcMediaList p_ml, LibVlcMedia p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_list_is_readonly(LibVlcMediaList p_mlist);
-
- void libvlc_media_list_lock(LibVlcMediaList p_ml);
-
- void libvlc_media_list_unlock(LibVlcMediaList p_ml);
-
- LibVlcMediaListView libvlc_media_list_flat_view(LibVlcMediaList p_ml, libvlc_exception_t p_ex);
-
- LibVlcMediaListView libvlc_media_list_hierarchical_view(LibVlcMediaList p_ml, libvlc_exception_t p_ex);
-
- LibVlcMediaListView libvlc_media_list_hierarchical_node_view(LibVlcMediaList p_ml, libvlc_exception_t p_ex);
-
- LibVlcEventManager libvlc_media_list_event_manager(LibVlcMediaList p_ml, libvlc_exception_t p_ex);
-
- LibVlcMediaListPlayer libvlc_media_list_player_new(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_release(LibVlcMediaListPlayer p_mlp);
-
- LibVlcEventManager libvlc_media_list_player_event_manager(LibVlcMediaListPlayer p_mlp);
-
- void libvlc_media_list_player_set_media_player(LibVlcMediaListPlayer p_mlp, LibVlcMediaPlayer p_mi,
- libvlc_exception_t p_e);
-
- void libvlc_media_list_player_set_media_list(LibVlcMediaListPlayer p_mlp, LibVlcMediaList p_mlist,
- libvlc_exception_t p_e);
-
- void libvlc_media_list_player_play(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_pause(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- int libvlc_media_list_player_is_playing(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- int libvlc_media_list_player_get_state(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_play_item_at_index(LibVlcMediaListPlayer p_mlp, int i_index, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_play_item(LibVlcMediaListPlayer p_mlp, LibVlcMedia p_md, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_stop(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_next(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_previous(LibVlcMediaListPlayer p_mlp, libvlc_exception_t p_e);
-
- void libvlc_media_list_player_set_playback_mode(LibVlcMediaListPlayer p_mlp, PlaybackMode e_mode,
- libvlc_exception_t p_e);
-
- void libvlc_media_list_view_retain(LibVlcMediaListView p_mlv);
-
- void libvlc_media_list_view_release(LibVlcMediaListView p_mlv);
-
- LibVlcEventManager libvlc_media_list_view_event_manager(LibVlcMediaListView p_mlv);
-
- int libvlc_media_list_view_count(LibVlcMediaListView p_mlv, libvlc_exception_t p_e);
-
- LibVlcMedia libvlc_media_list_view_item_at_index(LibVlcMediaListView p_mlv, int i_index, libvlc_exception_t p_e);
-
- LibVlcMediaListView libvlc_media_list_view_children_at_index(LibVlcMediaListView p_mlv, int index,
- libvlc_exception_t p_e);
-
- LibVlcMediaListView libvlc_media_list_view_children_for_item(LibVlcMediaListView p_mlv, LibVlcMedia p_md,
- libvlc_exception_t p_e);
-
- LibVlcMediaList libvlc_media_list_view_parent_media_list(LibVlcMediaListView p_mlv, libvlc_exception_t p_e);
-
- LibVlcMediaPlayer libvlc_media_player_new(LibVlcInstance p_libvlc_instance, libvlc_exception_t p_e);
-
- LibVlcMediaPlayer libvlc_media_player_new_from_media(LibVlcMedia p_md, libvlc_exception_t p_e);
-
- void libvlc_media_player_release(LibVlcMediaPlayer p_mi);
-
- void libvlc_media_player_retain(LibVlcMediaPlayer p_mi);
-
- void libvlc_media_player_set_media(LibVlcMediaPlayer p_mi, LibVlcMedia p_md, libvlc_exception_t p_e);
-
- LibVlcMedia libvlc_media_player_get_media(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- LibVlcEventManager libvlc_media_player_event_manager(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_is_playing(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_play(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_pause(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_stop(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_set_nsobject(LibVlcMediaPlayer p_mi, Pointer drawable, libvlc_exception_t p_e);
-
- Pointer libvlc_media_player_get_nsobject(LibVlcMediaPlayer p_mi);
-
- void libvlc_media_player_set_agl(LibVlcMediaPlayer p_mi, long drawable, libvlc_exception_t p_e);
-
- long libvlc_media_player_get_agl(LibVlcMediaPlayer p_mi);
-
- void libvlc_media_player_set_xwindow(LibVlcMediaPlayer p_mi, long drawable, libvlc_exception_t p_e);
-
- long libvlc_media_player_get_xwindow(LibVlcMediaPlayer p_mi);
-
- void libvlc_media_player_set_hwnd(LibVlcMediaPlayer p_mi, long drawable, libvlc_exception_t p_e);
-
- Pointer libvlc_media_player_get_hwnd(LibVlcMediaPlayer p_mi);
-
- long libvlc_media_player_get_length(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- long libvlc_media_player_get_time(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_set_time(LibVlcMediaPlayer p_mi, long the, libvlc_exception_t p_e);
-
- float libvlc_media_player_get_position(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_set_position(LibVlcMediaPlayer p_mi, float f_pos, libvlc_exception_t p_e);
-
- void libvlc_media_player_set_chapter(LibVlcMediaPlayer p_mi, int i_chapter, libvlc_exception_t p_e);
-
- int libvlc_media_player_get_chapter(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_get_chapter_count(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_will_play(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_get_chapter_count_for_title(LibVlcMediaPlayer p_mi, int i_title, libvlc_exception_t p_e);
-
- void libvlc_media_player_set_title(LibVlcMediaPlayer p_mi, int i_title, libvlc_exception_t p_e);
-
- int libvlc_media_player_get_title(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_get_title_count(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_previous_chapter(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_next_chapter(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- float libvlc_media_player_get_rate(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_set_rate(LibVlcMediaPlayer p_mi, float movie, libvlc_exception_t p_e);
-
- int libvlc_media_player_get_state(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- float libvlc_media_player_get_fps(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_has_vout(LibVlcMediaPlayer p_md, libvlc_exception_t p_e);
-
- int libvlc_media_player_is_seekable(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_media_player_can_pause(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_media_player_next_frame(LibVlcMediaPlayer p_input, libvlc_exception_t p_e);
-
- void libvlc_track_description_release(LibVlcTrackDescription p_track_description);
-
- void libvlc_toggle_fullscreen(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- void libvlc_set_fullscreen(LibVlcMediaPlayer p_mediaplayer, int b_fullscreen, libvlc_exception_t p_e);
-
- int libvlc_get_fullscreen(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- int libvlc_video_get_height(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- int libvlc_video_get_width(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- float libvlc_video_get_scale(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- void libvlc_video_set_scale(LibVlcMediaPlayer p_mediaplayer, float i_factor, libvlc_exception_t p_e);
-
- String libvlc_video_get_aspect_ratio(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- void libvlc_video_set_aspect_ratio(LibVlcMediaPlayer p_mediaplayer, String psz_aspect, libvlc_exception_t p_e);
-
- int libvlc_video_get_spu(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- int libvlc_video_get_spu_count(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- LibVlcTrackDescription libvlc_video_get_spu_description(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- void libvlc_video_set_spu(LibVlcMediaPlayer p_mediaplayer, int i_spu, libvlc_exception_t p_e);
-
- int libvlc_video_set_subtitle_file(LibVlcMediaPlayer p_mediaplayer, String psz_subtitle, libvlc_exception_t p_e);
-
- LibVlcTrackDescription libvlc_video_get_title_description(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- LibVlcTrackDescription libvlc_video_get_chapter_description(LibVlcMediaPlayer p_mediaplayer, int i_title,
- libvlc_exception_t p_e);
-
- String libvlc_video_get_crop_geometry(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- void libvlc_video_set_crop_geometry(LibVlcMediaPlayer p_mediaplayer, String psz_geometry, libvlc_exception_t p_e);
-
- void libvlc_toggle_teletext(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- int libvlc_video_get_teletext(LibVlcMediaPlayer p_mediaplayer, libvlc_exception_t p_e);
-
- void libvlc_video_set_teletext(LibVlcMediaPlayer p_mediaplayer, int i_page, libvlc_exception_t p_e);
-
- int libvlc_video_get_track_count(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- LibVlcTrackDescription libvlc_video_get_track_description(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_video_get_track(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_video_set_track(LibVlcMediaPlayer p_mi, int i_track, libvlc_exception_t p_e);
-
- void libvlc_video_take_snapshot(LibVlcMediaPlayer p_mi, String psz_filepath, int i_width, int i_height,
- libvlc_exception_t p_e);
-
- void libvlc_video_set_deinterlace(LibVlcMediaPlayer p_mi, int b_enable, String psz_mode, libvlc_exception_t p_e);
-
- int libvlc_video_get_marquee_int(LibVlcMediaPlayer p_mi, VideoMarqueeIntOption option,
- libvlc_exception_t p_e);
-
- String libvlc_video_get_marquee_string(LibVlcMediaPlayer p_mi, VideoMarqueeStringOption option,
- libvlc_exception_t p_e);
-
- void libvlc_video_set_marquee_int(LibVlcMediaPlayer p_mi, VideoMarqueeIntOption option, int i_val,
- libvlc_exception_t p_e);
-
- void libvlc_video_set_marquee_string(LibVlcMediaPlayer p_mi, VideoMarqueeStringOption option,
- String psz_text, libvlc_exception_t p_e);
-
- LibVlcAudioOutput libvlc_audio_output_list_get(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_audio_output_list_release(LibVlcAudioOutput p_list);
-
- int libvlc_audio_output_set(LibVlcInstance p_instance, String psz_name);
-
- int libvlc_audio_output_device_count(LibVlcInstance p_instance, String psz_audio_output);
-
- String libvlc_audio_output_device_longname(LibVlcInstance p_instance, String psz_audio_output, int i_device);
-
- String libvlc_audio_output_device_id(LibVlcInstance p_instance, String psz_audio_output, int i_device);
-
- void libvlc_audio_output_device_set(LibVlcInstance p_instance, String psz_audio_output, String psz_device_id);
-
- int libvlc_audio_output_get_device_type(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_audio_output_set_device_type(LibVlcInstance p_instance, int device_type, libvlc_exception_t p_e);
-
- void libvlc_audio_toggle_mute(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- int libvlc_audio_get_mute(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_audio_set_mute(LibVlcInstance p_instance, int status, libvlc_exception_t p_e);
-
- int libvlc_audio_get_volume(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_audio_set_volume(LibVlcInstance p_instance, int i_volume, libvlc_exception_t p_e);
-
- int libvlc_audio_get_track_count(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- LibVlcTrackDescription libvlc_audio_get_track_description(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- int libvlc_audio_get_track(LibVlcMediaPlayer p_mi, libvlc_exception_t p_e);
-
- void libvlc_audio_set_track(LibVlcMediaPlayer p_mi, int i_track, libvlc_exception_t p_e);
-
- int libvlc_audio_get_channel(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_audio_set_channel(LibVlcInstance p_instance, int channel, libvlc_exception_t p_e);
-
- void libvlc_vlm_release(LibVlcInstance p_instance, libvlc_exception_t p_e);
-
- void libvlc_vlm_add_broadcast(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
- int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
-
- void libvlc_vlm_add_vod(LibVlcInstance p_instance, String psz_name, String psz_input, int i_options,
- String[] ppsz_options, int b_enabled, String psz_mux, libvlc_exception_t p_e);
-
- void libvlc_vlm_del_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
-
- void libvlc_vlm_set_enabled(LibVlcInstance p_instance, String psz_name, int b_enabled, libvlc_exception_t p_e);
-
- void libvlc_vlm_set_output(LibVlcInstance p_instance, String psz_name, String psz_output, libvlc_exception_t p_e);
-
- void libvlc_vlm_set_input(LibVlcInstance p_instance, String psz_name, String psz_input, libvlc_exception_t p_e);
-
- void libvlc_vlm_add_input(LibVlcInstance p_instance, String psz_name, String psz_input, libvlc_exception_t p_e);
-
- void libvlc_vlm_set_loop(LibVlcInstance p_instance, String psz_name, int b_loop, libvlc_exception_t p_e);
-
- void libvlc_vlm_set_mux(LibVlcInstance p_instance, String psz_name, String psz_mux, libvlc_exception_t p_e);
-
- void libvlc_vlm_change_media(LibVlcInstance p_instance, String psz_name, String psz_input, String psz_output,
- int i_options, String[] ppsz_options, int b_enabled, int b_loop, libvlc_exception_t p_e);
-
- void libvlc_vlm_play_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
-
- void libvlc_vlm_stop_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
-
- void libvlc_vlm_pause_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
-
- void libvlc_vlm_seek_media(LibVlcInstance p_instance, String psz_name, float f_percentage, libvlc_exception_t p_e);
-
- String libvlc_vlm_show_media(LibVlcInstance p_instance, String psz_name, libvlc_exception_t p_e);
-
- float libvlc_vlm_get_media_instance_position(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- int libvlc_vlm_get_media_instance_time(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- int libvlc_vlm_get_media_instance_length(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- int libvlc_vlm_get_media_instance_rate(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- int libvlc_vlm_get_media_instance_title(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- int libvlc_vlm_get_media_instance_chapter(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- int libvlc_vlm_get_media_instance_seekable(LibVlcInstance p_instance, String psz_name, int i_instance,
- libvlc_exception_t p_e);
-
- LibVlcEventManager libvlc_vlm_get_event_manager(LibVlcInstance p_instance, libvlc_exception_t p_exception);
-
-}
+++ /dev/null
- /*****************************************************************************
- * LibVlcEventType.java: VLC Java Bindings event types enum
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum LibVlcEventType {
-
- libvlc_MediaMetaChanged, // 0
- libvlc_MediaSubItemAdded, // 1
- libvlc_MediaDurationChanged, // 2
- libvlc_MediaPreparsedChanged, // 3
- libvlc_MediaFreed, // 4
- libvlc_MediaStateChanged, // 5
-
- libvlc_MediaPlayerNothingSpecial, // 6
- libvlc_MediaPlayerOpening, // 7
- libvlc_MediaPlayerBuffering, // 8
- libvlc_MediaPlayerPlaying, // 9
- libvlc_MediaPlayerPaused, // 10
- libvlc_MediaPlayerStopped, // 11
- libvlc_MediaPlayerForward, // 12
- libvlc_MediaPlayerBackward, // 13
- libvlc_MediaPlayerEndReached, // 14
- libvlc_MediaPlayerEncounteredError, // 15
- libvlc_MediaPlayerTimeChanged, // 16
- libvlc_MediaPlayerPositionChanged, // 17
- libvlc_MediaPlayerSeekableChanged, // 18
- libvlc_MediaPlayerPausableChanged, // 19
-
- libvlc_MediaListItemAdded, // 20
- libvlc_MediaListWillAddItem, // 21
- libvlc_MediaListItemDeleted, // 22
- libvlc_MediaListWillDeleteItem, // 23
-
- libvlc_MediaListViewItemAdded, // 24
- libvlc_MediaListViewWillAddItem, // 25
- libvlc_MediaListViewItemDeleted, // 26
- libvlc_MediaListViewWillDeleteItem, // 27
-
- libvlc_MediaListPlayerPlayed, // 28
- libvlc_MediaListPlayerNextItemSet, // 29
- libvlc_MediaListPlayerStopped, // 30
-
- libvlc_MediaDiscovererStarted, // 31
- libvlc_MediaDiscovererEnded, // 32
-
- libvlc_MediaPlayerTitleChanged, // 33
- libvlc_MediaPlayerSnapshotTaken, // 34
- libvlc_MediaPlayerLengthChanged, // 35
-
- libvlc_VlmMediaAdded, // 36
- libvlc_VlmMediaRemoved, // 37
- libvlc_VlmMediaChanged, // 38
- libvlc_VlmMediaInstanceStarted, // 39
- libvlc_VlmMediaInstanceStopped, // 40
- libvlc_VlmMediaInstanceStatusInit, // 41
- libvlc_VlmMediaInstanceStatusOpening, // 42
- libvlc_VlmMediaInstanceStatusPlaying, // 43
- libvlc_VlmMediaInstanceStatusPause, // 44
- libvlc_VlmMediaInstanceStatusEnd, // 45
- libvlc_VlmMediaInstanceStatusError; // 46
-}
+++ /dev/null
-/*****************************************************************************
- * ${file_name}: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2007 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import java.awt.Canvas;
-
-import javax.swing.JFrame;
-import javax.swing.JPanel;
-
-import org.videolan.jvlc.internal.LibVlc.LibVlcCallback;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcInstance;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaPlayer;
-import org.videolan.jvlc.internal.LibVlc.libvlc_event_t;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-import com.sun.jna.Platform;
-import com.sun.jna.Pointer;
-
-
-public class LibVlcImpl
-{
-
- public static boolean done;
-
- public static void main(String[] args) throws InterruptedException
- {
- LibVlc libVlc = LibVlc.SYNC_INSTANCE;
- libvlc_exception_t exception = new libvlc_exception_t();
- libVlc.libvlc_exception_init(exception);
-
- final Object lock = new Object();
-
- System.out.println("Starting vlc");
- System.out.println("version: " + libVlc.libvlc_get_version());
- System.out.println("changeset: " + libVlc.libvlc_get_changeset());
- System.out.println("compiler: " + libVlc.libvlc_get_compiler());
-
- LibVlcInstance libvlc_instance_t = libVlc.libvlc_new(0, new String[] {"/usr/local/bin/vlc"}, exception);
-
- LibVlcMedia mediaDescriptor = libVlc
- .libvlc_media_new(libvlc_instance_t, "/home/carone/apps/a.avi", exception);
-
- LibVlcMediaPlayer mediaPlayer = libVlc.libvlc_media_player_new_from_media(mediaDescriptor, exception);
-
- LibVlcEventManager mediaInstanceEventManager = libVlc.libvlc_media_player_event_manager(mediaPlayer, exception);
-
- LibVlcCallback played = new LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event_t, Pointer pointer)
- {
- System.out.println("Playing started.");
- }
- };
-
- LibVlcCallback endReached = new LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event_t, Pointer pointer)
- {
- synchronized (lock)
- {
- System.out.println("Playing finished.");
- LibVlcImpl.done = true;
- }
- }
- };
-
- libVlc.libvlc_event_attach(
- mediaInstanceEventManager,
- LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal(),
- played,
- null,
- exception);
-
- libVlc.libvlc_event_attach(
- mediaInstanceEventManager,
- LibVlcEventType.libvlc_MediaPlayerEndReached.ordinal(),
- endReached,
- null,
- exception);
-
- JFrame frame = new JFrame("title");
- frame.setVisible(true);
- frame.setLocation(100, 100);
- frame.setSize(500, 500);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
-
- JPanel panel = new JPanel();
- Canvas canvas = new Canvas();
- canvas.setSize(500, 500);
- panel.add(canvas);
- frame.getContentPane().add(panel);
- frame.pack();
-
- int drawable = (int) com.sun.jna.Native.getComponentID(canvas);
-
- if (Platform.isWindows())
- {
- libVlc.libvlc_media_player_set_hwnd(mediaPlayer, drawable, exception);
- }
- else
- {
- libVlc.libvlc_media_player_set_xwindow(mediaPlayer, drawable, exception);
- }
- libVlc.libvlc_media_player_play(mediaPlayer, exception);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcState.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum LibVlcState
-{
- libvlc_NothingSpecial, // 0
- libvlc_Opening, // 1
- libvlc_Buffering, // 2
- libvlc_Playing, // 3
- libvlc_Paused, // 4
- libvlc_Stopped, // 5
- libvlc_Ended, // 6
- libvlc_Error; // 7
-}
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum MediaOption
-{
-
- libvlc_media_option_trusted, // 0x2,
- libvlc_media_option_unique, // 0x100,
-}
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum Meta
-{
-
- libvlc_meta_Title, // 0,
- libvlc_meta_Artist, // 1,
- libvlc_meta_Genre, // 2,
- libvlc_meta_Copyright, // 3,
- libvlc_meta_Album, // 4,
- libvlc_meta_TrackNumber, // 5,
- libvlc_meta_Description, // 6,
- libvlc_meta_Rating, // 7,
- libvlc_meta_Date, // 8,
- libvlc_meta_Setting, // 9,
- libvlc_meta_URL, // 10,
- libvlc_meta_Language, // 11,
- libvlc_meta_NowPlaying, // 12,
- libvlc_meta_Publisher, // 13,
- libvlc_meta_EncodedBy, // 14,
- libvlc_meta_ArtworkURL, // 15,
- libvlc_meta_TrackID, // 16,
-}
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum PlaybackMode
-{
-
- libvlc_playback_mode_default, // 0,
- libvlc_playback_mode_loop, // 1,
- libvlc_playback_mode_repeat, // 2,
-}
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum VideoMarqueeIntOption
-{
-
- libvlc_marquee_Enabled, // 0,
- libvlc_marquee_Color, // 1,
- libvlc_marquee_Opacity, // 2,
- libvlc_marquee_Position, // 3,
- libvlc_marquee_Refresh, // 4,
- libvlc_marquee_Size, // 5,
- libvlc_marquee_Timeout, // 6,
- libvlc_marquee_X, // 7,
- libvlc_marquee_Y, // 8,
-}
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-
-public enum VideoMarqueeStringOption
-{
-
- libvlc_marquee_Text, // 0,
-}
+++ /dev/null
-/*****************************************************************************
- * AbstractJVLCTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import org.apache.commons.io.IOUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.videolan.jvlc.internal.AbstractVLCInternalTest;
-
-
-public abstract class AbstractJVLCTest
-{
-
- protected JVLC jvlc;
-
- protected String mrl;
-
- private String address = "http://streams.videolan.org/streams-videolan/avi/Hero-Div3.avi";
-
- /**
- * Logger.
- */
- private Logger log = LoggerFactory.getLogger(AbstractVLCInternalTest.class);
-
- @Before
- public void testSetup()
- {
- jvlc = new JVLC("-vvv --ignore-config --no-media-library -I dummy -A dummy -V dummy --rtsp-host 127.0.0.1:5554");
- jvlc.setLogVerbosity(LoggerVerbosityLevel.DEBUG);
- downloadSample();
- }
-
- @After
- public void tearDown()
- {
- jvlc.release();
- }
-
- private void downloadSample()
- {
- OutputStream out = null;
- URLConnection conn = null;
- InputStream in = null;
- URL sampleResource = this.getClass().getResource("/sample.avi");
- if (sampleResource != null)
- {
- log.debug("Sample file already downloaded");
- mrl = sampleResource.getPath();
- return;
- }
- try
- {
- log.info("Downloading sample: {}", address);
- String testResoucesPath = this.getClass().getResource("/sample").getPath();
- URL url = new URL(address);
- out = new BufferedOutputStream(new FileOutputStream(testResoucesPath + ".avi"));
- conn = url.openConnection();
- in = conn.getInputStream();
- byte[] buffer = new byte[1024];
- int numRead;
- long numWritten = 0;
- while ((numRead = in.read(buffer)) != -1)
- {
- out.write(buffer, 0, numRead);
- numWritten += numRead;
- }
- log.info("Sample downloaded.");
- mrl = testResoucesPath + ".avi";
- }
- catch (Exception e)
- {
- log.error("{}", e);
- }
- finally
- {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
- }
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * JVLCTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-
-public class JVLCTest extends AbstractJVLCTest
-{
-
- String mrl = getClass().getResource("/raffa_voice.ogg").getFile();
-
- @Test
- public void jvlcNew()
- {
- JVLC jvlc = new JVLC();
- Assert.assertNotNull(jvlc.getAudio());
- }
-
- @Test
- public void jvlcPlay()
- {
- MediaPlayer instance = jvlc.play(mrl);
- Assert.assertNotNull(instance);
- }
-
- @Test
- public void jvlcRelease()
- {
- JVLC jvlc = new JVLC();
- jvlc.release();
- }
-
- @Test
- public void jvlcMultipleInstances()
- {
- JVLC[] jvlcInstancesArray = new JVLC[10];
-
- for (int i = 0; i < jvlcInstancesArray.length; i++)
- {
- jvlcInstancesArray[i] = new JVLC();
- }
- for (int i = 0; i < jvlcInstancesArray.length; i++)
- {
- jvlcInstancesArray[i].release();
- }
-
- }
-
- @Test
- public void twoAudioInstancesTest() throws Exception
- {
- JVLC instance1 = new JVLC();
- JVLC instance2 = new JVLC();
-
- instance1.play(mrl);
- instance2.play(mrl);
-
- Thread.sleep(1000);
-
- instance1.getAudio().setMute(true);
- Assert.assertNotNull(instance2.getAudio());
- Assert.assertTrue(instance1.getAudio().getMute());
- Assert.assertTrue(!instance2.getAudio().getMute());
-
- }
-}
+++ /dev/null
-/*****************************************************************************
- * LoggerTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import java.util.Iterator;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-public class LoggerTest extends AbstractJVLCTest
-{
-
- @Test
- public void testLogDebug()
- {
- jvlc.setLogVerbosity(LoggerVerbosityLevel.DEBUG);
- Logger logger = jvlc.getLogger();
- jvlc.play(mrl);
- Assert.assertTrue(logger.count() > 0);
- logger.close();
- }
-
- /**
- * Timeout added because of a poor spinlock usage in the native side.
- */
- // @Test(timeout = 5000L)
- public void testLogError()
- {
- jvlc.setLogVerbosity(LoggerVerbosityLevel.DEBUG);
- Logger logger = jvlc.getLogger();
- logger.clear();
- Assert.assertEquals(0, logger.count());
-
- jvlc.play(mrl);
-
- Iterator<LoggerMessage> loggerIterator = logger.iterator();
- while (loggerIterator.hasNext())
- {
- LoggerMessage message = loggerIterator.next();
- Assert.assertNotNull(message.getMessage());
- }
- logger.close();
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaDescriptorTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-
-public class MediaDescriptorTest extends AbstractJVLCTest
-{
-
- @Test
- public void getMrlTest()
- {
- MediaDescriptor md = new MediaDescriptor(jvlc, mrl);
- Assert.assertEquals(mrl, md.getMrl());
- }
-
- @Test
- public void getMediaPlayer()
- {
- MediaDescriptor md = new MediaDescriptor(jvlc, mrl);
- MediaPlayer mp = md.getMediaPlayer();
- Assert.assertNotNull(mp);
- MediaPlayer mp2 = md.getMediaPlayer();
- Assert.assertSame(mp, mp2);
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaListTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-
-public class MediaListTest extends AbstractJVLCTest
-{
-
- @Test
- public void mediaListAddMedia()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.addMedia(mrl);
- Assert.assertEquals(1, mlist.size());
- }
-
- @Test
- public void mediaListAddMedia2()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.addMedia(mrl);
- Assert.assertEquals(1, mlist.size());
- mlist.addMedia(mrl);
- Assert.assertEquals(1, mlist.size());
- mlist.addMedia(new MediaDescriptor(jvlc, mrl));
- Assert.assertEquals(1, mlist.size());
- mlist.addMedia("non-existing");
- Assert.assertEquals(2, mlist.size());
- }
-
- @Test
- public void mediaListRemoveMedia()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.addMedia(mrl);
- Assert.assertEquals(1, mlist.size());
- mlist.removeMedia(0);
- Assert.assertEquals(0, mlist.size());
- }
-
- @Test
- public void mediaListRemoveMedia2()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.addMedia(mrl);
- Assert.assertEquals(1, mlist.size());
- mlist.removeMedia(0);
- Assert.assertEquals(0, mlist.size());
-
- mlist.addMedia(mrl);
- mlist.removeMedia(0);
- Assert.assertEquals(0, mlist.size());
-
- mlist.addMedia(new MediaDescriptor(jvlc, mrl));
- mlist.removeMedia(0);
- Assert.assertEquals(0, mlist.size());
-
- mlist.addMedia(new MediaDescriptor(jvlc, mrl));
- mlist.removeMedia(mrl);
- Assert.assertEquals(0, mlist.size());
-
- mlist.addMedia(new MediaDescriptor(jvlc, mrl));
- mlist.removeMedia(new MediaDescriptor(jvlc, mrl));
- Assert.assertEquals(0, mlist.size());
- }
-
- @Test
- public void mediaListRemoveNonExistingMedia()
- {
- MediaList mlist = new MediaList(jvlc);
- boolean result = mlist.removeMedia(3);
- Assert.assertFalse(result);
- }
-
- @Test
- public void mediaListIndexOfNonExistingMediaDescriptor()
- {
- MediaList mlist = new MediaList(jvlc);
- MediaDescriptor md = new MediaDescriptor(jvlc, "dummy");
- int result = mlist.indexOf(md);
- Assert.assertEquals(-1, result);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void mediaListGetMediaDesciptorAtInvalidIndex()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.getMediaDescriptorAtIndex(5);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void mediaListGetMediaDesciptorAtInvalidIndex2()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.getMediaDescriptorAtIndex(-5);
- }
-
- @Test(expected = IndexOutOfBoundsException.class)
- public void mediaListGetMediaDesciptorAtInvalidIndex3()
- {
- MediaList mlist = new MediaList(jvlc);
- mlist.getMediaDescriptorAtIndex(0);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * VLMTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-
-
-public class VLMTest extends AbstractJVLCTest
-{
- private String mediaName = "test";
-
- @Test
- public void testVLMInit()
- {
- VLM vlm = jvlc.getVLM();
- Assert.assertNotNull(vlm);
- }
-
- //@Test
- public void testAddBroadcast()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- }
-
- //@Test(timeout = 2000L)
- public void testAddVod()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- }
-
- //@Test
- public void testShowBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- vlm.showMedia(mediaName);
- }
-
- //@Test
- public void testShowVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.showMedia(mediaName);
- }
-
- //@Test
- public void testDisableBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- vlm.disableMedia(mediaName);
- }
-
- //@Test
- public void testDisableVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.disableMedia(mediaName);
- }
-
- //@Test
- public void testPauseBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- vlm.playMedia(mediaName);
- vlm.pauseMedia(mediaName);
- vlm.stopMedia(mediaName);
- }
-
- //@Test
- public void testPauseVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.playMedia(mediaName);
- vlm.pauseMedia(mediaName);
- vlm.stopMedia(mediaName);
- }
-
-
- //@Test
- public void testStopBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- vlm.playMedia(mediaName);
- vlm.stopMedia(mediaName);
- }
-
- //@Test
- public void testStopVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.playMedia(mediaName);
- vlm.stopMedia(mediaName);
- }
-
- //@Test
- public void testSeekBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- vlm.playMedia(mediaName);
- vlm.seekMedia(mediaName, 0.3f);
- vlm.stopMedia(mediaName);
- }
-
- //@Test
- public void testSeekVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.playMedia(mediaName);
- vlm.seekMedia(mediaName, 0.3f);
- vlm.stopMedia(mediaName);
- }
-
- //@Test
- public void testAddMediaInputToBroadcast()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, true, false);
- vlm.addMediaInput(mediaName, "file://" + mrl);
- }
-
- //@Test
- public void testAddMediaInputToVod()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.addMediaInput(mediaName, "file://" + mrl);
- }
-
- //@Test
- public void testEnableBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
- vlm.enableMedia(mediaName);
- }
-
- //@Test
- public void testEnableVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.enableMedia(mediaName);
- }
-
- //@Test
- public void testDeleteBroadcastMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
- vlm.deleteMedia(mediaName);
- }
-
- //@Test
- public void testDeleteVodMedia()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.deleteMedia(mediaName);
- }
-
- //@Test
- public void testMediaLoop()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addBroadcast(mediaName, "file://" + mrl, "", null, false, false);
- vlm.setMediaLoop(mediaName, true);
- }
-
- //@Test
- public void testSetMux()
- {
- VLM vlm = jvlc.getVLM();
- vlm.addVod(mediaName, "file://" + mrl, null, true, null);
- vlm.setMux(mediaName, "ts");
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * AbstractVLCEventTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import org.junit.After;
-
-
-public abstract class AbstractVLCEventTest extends AbstractVLCInternalTest
-{
- protected int eventFired;
-
- @After
- public void cleanupFired()
- {
- eventFired = 0;
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * VLMInternalTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import java.io.BufferedOutputStream;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.URL;
-import java.net.URLConnection;
-
-import junit.framework.Assert;
-
-import org.apache.commons.io.IOUtils;
-import org.junit.After;
-import org.junit.Before;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.videolan.jvlc.internal.LibVlc.LibVlcInstance;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public abstract class AbstractVLCInternalTest
-{
-
- protected LibVlc libvlc = LibVlc.SYNC_INSTANCE;
-
- protected LibVlcInstance libvlcInstance;
-
- protected String mrl;
-
- protected libvlc_exception_t exception;
-
- private String address = "http://streams.videolan.org/streams-videolan/avi/Hero-Div3.avi";
-
- /**
- * Logger.
- */
- private Logger log = LoggerFactory.getLogger(AbstractVLCInternalTest.class);
-
- @Before
- public void testSetup()
- {
- exception = new libvlc_exception_t();
- String[] args = new String[]{
- "-vvv",
- "--ignore-config",
- "--reset-plugins-cache",
- "--no-media-library",
- "-I",
- "dummy",
- "-A",
- "dummy",
- "-V",
- "dummy" };
- libvlcInstance = libvlc.libvlc_new(args.length, args, exception);
- libvlc.libvlc_exception_clear(exception);
-
- downloadSample();
- }
-
- @After
- public void tearDown()
- {
- libvlc.libvlc_release(libvlcInstance);
- libvlc.libvlc_exception_clear(exception);
- }
-
- protected void catchException(libvlc_exception_t exception)
- {
- Assert.assertEquals(libvlc.libvlc_errmsg(), 0, libvlc.libvlc_exception_raised(exception));
- }
-
- private void downloadSample()
- {
- OutputStream out = null;
- URLConnection conn = null;
- InputStream in = null;
- URL sampleResource = this.getClass().getResource("/sample.avi");
- if (sampleResource != null)
- {
- log.debug("Sample file already downloaded");
- mrl = sampleResource.getPath();
- return;
- }
- try
- {
- log.info("Downloading sample: {}", address);
- String testResoucesPath = this.getClass().getResource("/sample").getPath();
- URL url = new URL(address);
- out = new BufferedOutputStream(new FileOutputStream(testResoucesPath + ".avi"));
- conn = url.openConnection();
- in = conn.getInputStream();
- byte[] buffer = new byte[1024];
- int numRead;
- long numWritten = 0;
- while ((numRead = in.read(buffer)) != -1)
- {
- out.write(buffer, 0, numRead);
- numWritten += numRead;
- }
- if (numWritten == 0)
- {
- throw new RuntimeException("Cannot download sample, please check the url or your internet connection.");
- }
- log.info("Sample downloaded.");
- mrl = testResoucesPath + ".avi";
- }
- catch (Exception e)
- {
- log.error("{}", e);
- }
- finally
- {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
- }
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcCoreTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcInstance;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class LibVlcCoreTest
-{
-
- private LibVlc instance = LibVlc.SYNC_INSTANCE;
-
- @Test
- public void testNew() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {"-I","dummy","--aout=dummy","--vout=dummy"}, exception);
- Assert.assertNotNull(libvlcInstance);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void testRelease() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {}, exception);
- instance.libvlc_release(libvlcInstance);
- }
-
- @Test
- public void testAddIntf() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcInstance libvlcInstance = instance.libvlc_new(0, new String[] {}, exception);
- instance.libvlc_add_intf(libvlcInstance, "dummy", exception);
- Assert.assertEquals(0, exception.b_raised);
- instance.libvlc_release(libvlcInstance);
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcLogTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcLog;
-import org.videolan.jvlc.internal.LibVlc.LibVlcLogIterator;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class LibVlcLogTest extends AbstractVLCInternalTest
-{
-
- @Test
- public void testLogOpen()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
- Assert.assertNotNull(libvlcLog);
- }
-
- @Test
- public void testLogClose()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
- libvlc.libvlc_log_close(libvlcLog);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- //@Test
- public void testLogClear()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
- libvlc.libvlc_log_clear(libvlcLog);
- Assert.assertEquals(0, libvlc.libvlc_log_count(libvlcLog));
- }
-
- //@Test
- public void testLogGetIterator()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcLog libvlcLog = libvlc.libvlc_log_open(libvlcInstance, exception);
- libvlc.libvlc_log_clear(libvlcLog);
- Assert.assertEquals(0, exception.b_raised);
- Assert.assertEquals(0, libvlc.libvlc_log_count(libvlcLog));
- LibVlcLogIterator logIterator = libvlc.libvlc_log_get_iterator(libvlcLog, exception);
- Assert.assertNotNull(logIterator);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcMediaEventsTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcCallback;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.libvlc_event_t;
-
-import com.sun.jna.Pointer;
-
-
-public class LibVlcMediaEventsTest extends AbstractVLCEventTest
-{
-
- @Test
- public void mediaFreedTest()
- {
- LibVlcMedia media = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcEventManager eventManager = libvlc.libvlc_media_event_manager(media, exception);
- LibVlcCallback callback = new LibVlc.LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- Assert.assertEquals(LibVlcEventType.libvlc_MediaFreed.ordinal(), libvlc_event.type);
- eventFired = 1;
- }
-
- };
- libvlc.libvlc_event_attach(eventManager, LibVlcEventType.libvlc_MediaFreed.ordinal(), callback, null, exception);
- libvlc.libvlc_media_release(media);
- Assert.assertEquals(1, eventFired);
- }
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcMediaListEventsTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcCallback;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
-import org.videolan.jvlc.internal.LibVlc.libvlc_event_t;
-
-import com.sun.jna.Pointer;
-
-
-public class LibVlcMediaListEventsTest extends AbstractVLCEventTest
-{
-
- @Test
- public void itemAddedTest()
- {
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia media = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
-
- LibVlcEventManager eventManager = libvlc.libvlc_media_list_event_manager(mediaList, exception);
- LibVlcCallback callback = new LibVlc.LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- Assert.assertEquals(LibVlcEventType.libvlc_MediaListItemAdded.ordinal(), libvlc_event.type);
- eventFired = 1;
- }
- };
-
- libvlc.libvlc_event_attach(
- eventManager,
- LibVlcEventType.libvlc_MediaListItemAdded.ordinal(),
- callback,
- null,
- exception);
-
- libvlc.libvlc_media_list_add_media(mediaList, media, exception);
- Assert.assertEquals(1, eventFired);
- }
-
- @Test
- public void itemDeletedTest()
- {
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia media = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
-
- LibVlcEventManager eventManager = libvlc.libvlc_media_list_event_manager(mediaList, exception);
- LibVlcCallback callback = new LibVlc.LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- Assert.assertEquals(LibVlcEventType.libvlc_MediaListItemDeleted.ordinal(), libvlc_event.type);
- eventFired = 1;
- }
- };
-
- libvlc.libvlc_event_attach(
- eventManager,
- LibVlcEventType.libvlc_MediaListItemDeleted.ordinal(),
- callback,
- null,
- exception);
-
- libvlc.libvlc_media_list_add_media(mediaList, media, exception);
- libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
- Assert.assertEquals(1, eventFired);
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaListPlayerTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import junit.framework.Assert;
-
-import org.junit.After;
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaPlayer;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaListPlayer;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class LibVlcMediaListPlayerTest extends AbstractVLCInternalTest
-{
-
- private LibVlcMediaListPlayer current;
-
- @Test
- public void mediaListPlayerNewTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- Assert.assertNotNull(mediaListPlayer);
- Assert.assertEquals(0, exception.b_raised);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerSetMediaListTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- Assert.assertEquals(0, exception.b_raised);
- libvlc.libvlc_media_list_release(mediaList);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerSetMediaListTest2()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- Assert.assertEquals(0, exception.b_raised);
- libvlc.libvlc_media_list_release(mediaList);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerIsNotPlayingTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- int result = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
- Assert.assertEquals(0, result);
- Assert.assertEquals(0, exception.b_raised);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerPlayNoItemTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
- Assert.assertEquals(1, exception.b_raised);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerPlay()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- current = mediaListPlayer;
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- libvlc.libvlc_media_list_player_play(mediaListPlayer, exception);
- Assert.assertEquals(0, exception.b_raised);
- libvlc.libvlc_media_release(mediaDescriptor);
- libvlc.libvlc_media_list_release(mediaList);
- }
-
- @Test
- public void mediaListPlayerPlayItemAtIndex() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- libvlc.libvlc_media_list_player_play_item_at_index(mediaListPlayer, 0, exception);
- while (true)
- {
- int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
- if (exception.b_raised == 1)
- {
- throw new RuntimeException("Native exception thrown");
- }
- if (playing == 1)
- {
- break;
- }
- Thread.sleep(150);
- }
- libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception);
- while (libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception) != LibVlcState.libvlc_Ended
- .ordinal())
- {
- Thread.sleep(100);
- }
- libvlc.libvlc_media_release(mediaDescriptor);
- libvlc.libvlc_media_list_release(mediaList);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerPlayItem() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception);
- Assert.assertEquals(0, exception.b_raised);
- while (true)
- {
- int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
- if (exception.b_raised == 1)
- {
- throw new RuntimeException("Native exception thrown");
- }
- if (playing == 1)
- {
- break;
- }
- Thread.sleep(150);
- }
- Thread.sleep(400);
- libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception);
- libvlc.libvlc_media_list_release(mediaList);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerGetStateEnded()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
- Assert.assertEquals(LibVlcState.libvlc_Ended.ordinal(), state);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaLtistPlayerPause() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception);
- while (true)
- {
- int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
- if (exception.b_raised == 1)
- {
- throw new RuntimeException("Native exception thrown");
- }
- if (playing == 1)
- {
- break;
- }
- Thread.sleep(150);
- }
- libvlc.libvlc_media_list_player_pause(mediaListPlayer, exception);
-
- Thread.sleep(500);
-
- int state = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
- Assert.assertEquals(0, exception.b_raised);
- Thread.sleep(200L);
- Assert.assertEquals(
- "Expected state: " + LibVlcState.libvlc_Paused + ".\n",
- LibVlcState.libvlc_Paused.ordinal(),
- state);
- libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception);
- libvlc.libvlc_media_list_release(mediaList);
- libvlc.libvlc_media_list_player_release(mediaListPlayer);
- }
-
- @Test
- public void mediaListPlayerSetMediaInstance()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_list_player_set_media_player(mediaListPlayer, mi, exception);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListPlayerNextNoItems()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- libvlc.libvlc_media_list_player_next(mediaListPlayer, exception);
- Assert.assertEquals(1, exception.b_raised);
- }
-
- /**
- * fails, see https://trac.videolan.org/vlc/ticket/1535
- */
- // @Test
- public void mediaListPlayerNext() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- libvlc.libvlc_media_list_player_play_item_at_index(mediaListPlayer, 0, exception);
- Thread.sleep(150);
- libvlc.libvlc_media_list_player_next(mediaListPlayer, exception);
- Assert.assertEquals(0, exception.b_raised);
- libvlc.libvlc_media_list_release(mediaList);
- }
-
- @Test
- public void mediaListPlayerIsPlaying() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaListPlayer mediaListPlayer = libvlc.libvlc_media_list_player_new(libvlcInstance, exception);
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- LibVlcMedia mediaDescriptor = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- libvlc.libvlc_media_list_add_media(mediaList, mediaDescriptor, exception);
- libvlc.libvlc_media_list_player_set_media_list(mediaListPlayer, mediaList, exception);
- libvlc.libvlc_media_list_player_play_item(mediaListPlayer, mediaDescriptor, exception);
-
- while (true)
- {
- int playing = libvlc.libvlc_media_list_player_get_state(mediaListPlayer, exception);
- Assert.assertEquals(0, exception.b_raised);
- if (playing == LibVlcState.libvlc_Playing.ordinal())
- {
- break;
- }
- Thread.sleep(150);
- }
-
- libvlc.libvlc_media_list_player_stop(mediaListPlayer, exception);
- while (true)
- {
- int playing = libvlc.libvlc_media_list_player_is_playing(mediaListPlayer, exception);
- Assert.assertEquals(0, exception.b_raised);
- if (playing == 0)
- {
- break;
- }
- Thread.sleep(150);
- }
- Assert.assertEquals(LibVlcState.libvlc_Ended.ordinal(), libvlc.libvlc_media_list_player_get_state(
- mediaListPlayer,
- exception));
- libvlc.libvlc_media_list_release(mediaList);
- }
-
- @Override
- @After
- public void tearDown()
- {
- if (current != null)
- {
- libvlc.libvlc_media_list_player_stop(current, exception);
- while (libvlc.libvlc_media_list_player_get_state(current, exception) != LibVlcState.libvlc_Ended.ordinal())
- {
- try
- {
- Thread.sleep(100);
- }
- catch (InterruptedException e)
- {
- //
- }
- }
- }
- current = null;
- super.tearDown();
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcMediaListTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaList;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class LibVlcMediaListTest extends AbstractVLCInternalTest
-{
-
- @Test
- public void mediaListNew()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- Assert.assertNotNull(mediaList);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListAddMediaDescriptor()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
- LibVlcMedia libvlc_media = libvlc.libvlc_media_new(
- libvlcInstance,
- mrl,
- exception);
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListCountTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
- LibVlcMedia libvlc_media = libvlc.libvlc_media_new(
- libvlcInstance,
- mrl,
- exception);
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- int result = libvlc.libvlc_media_list_count(mediaList, exception);
- Assert.assertEquals(1, result);
- Assert.assertEquals(0, exception.b_raised);
-
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- result = libvlc.libvlc_media_list_count(mediaList, exception);
- Assert.assertEquals(2, result);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListEventManagerTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- Assert.assertNotNull(libvlc.libvlc_media_list_event_manager(mediaList, exception));
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListIndexOfItemTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
- LibVlcMedia libvlc_media = libvlc.libvlc_media_new(
- libvlcInstance,
- mrl,
- exception);
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- int index = libvlc.libvlc_media_list_index_of_item(mediaList, libvlc_media, exception);
- Assert.assertEquals(0, index);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListRemoveIndexTest()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
- LibVlcMedia libvlc_media = libvlc.libvlc_media_new(
- libvlcInstance,
- mrl,
- exception);
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaListRemoveIndexTest2()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMediaList mediaList = libvlc.libvlc_media_list_new(libvlcInstance, exception);
- String mrl = this.getClass().getResource("/raffa_voice.ogg").getPath();
- LibVlcMedia libvlc_media = libvlc.libvlc_media_new(
- libvlcInstance,
- mrl,
- exception);
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
- Assert.assertEquals(0, exception.b_raised);
-
- libvlc_media = libvlc.libvlc_media_new(
- libvlcInstance,
- mrl,
- exception);
- libvlc.libvlc_media_list_add_media(mediaList, libvlc_media, exception);
- libvlc.libvlc_media_list_remove_index(mediaList, 0, exception);
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcMediaPlayerEventsTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import junit.framework.Assert;
-
-import org.junit.After;
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcCallback;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaPlayer;
-import org.videolan.jvlc.internal.LibVlc.libvlc_event_t;
-
-import com.sun.jna.Pointer;
-
-
-public class LibVlcMediaPlayerEventsTest extends AbstractVLCEventTest
-{
- @Test
- public void testPlayingEvent() throws Exception
- {
- LibVlcMedia media = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mediaPlayer = libvlc.libvlc_media_player_new_from_media(media, exception);
- LibVlcEventManager eventManager = libvlc.libvlc_media_player_event_manager(mediaPlayer, exception);
- LibVlcCallback callback = new LibVlc.LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- Assert.assertEquals(LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal(), libvlc_event.type);
- eventFired = 1;
- }
- };
-
- libvlc.libvlc_event_attach(
- eventManager,
- LibVlcEventType.libvlc_MediaPlayerPlaying.ordinal(),
- callback,
- null,
- exception);
- libvlc.libvlc_media_player_play(mediaPlayer, exception);
- Thread.sleep(2000L);
- Assert.assertEquals(1, eventFired);
- }
-
- @Test
- public void testPausedEvent() throws Exception
- {
- LibVlcMedia media = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mediaPlayer = libvlc.libvlc_media_player_new_from_media(media, exception);
- LibVlcEventManager eventManager = libvlc.libvlc_media_player_event_manager(mediaPlayer, exception);
- LibVlcCallback callback = new LibVlc.LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- Assert.assertEquals(LibVlcEventType.libvlc_MediaPlayerPaused.ordinal(), libvlc_event.type);
- eventFired = 1;
- }
- };
-
- libvlc.libvlc_event_attach(
- eventManager,
- LibVlcEventType.libvlc_MediaPlayerPaused.ordinal(),
- callback,
- null,
- exception);
-
- libvlc.libvlc_media_player_play(mediaPlayer, exception);
- Thread.sleep(1000L);
- libvlc.libvlc_media_player_pause(mediaPlayer, exception);
- Thread.sleep(1000L);
-
- Assert.assertEquals(1, eventFired);
- }
-
- @Test
- public void testStoppedEvent() throws Exception
- {
- LibVlcMedia media = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mediaPlayer = libvlc.libvlc_media_player_new_from_media(media, exception);
- LibVlcEventManager eventManager = libvlc.libvlc_media_player_event_manager(mediaPlayer, exception);
- LibVlcCallback callback = new LibVlc.LibVlcCallback()
- {
-
- public void callback(libvlc_event_t libvlc_event, Pointer userData)
- {
- Assert.assertEquals(LibVlcEventType.libvlc_MediaPlayerStopped.ordinal(), libvlc_event.type);
- eventFired = 1;
- }
- };
-
- libvlc.libvlc_event_attach(
- eventManager,
- LibVlcEventType.libvlc_MediaPlayerStopped.ordinal(),
- callback,
- null,
- exception);
-
- libvlc.libvlc_media_player_play(mediaPlayer, exception);
- Thread.sleep(1000L);
- libvlc.libvlc_media_player_stop(mediaPlayer, exception);
- Thread.sleep(1000L);
-
- Assert.assertEquals(1, eventFired);
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * LibVlcMediaInstanceTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import org.junit.Assert;
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMediaPlayer;
-
-
-public class LibVlcMediaPlayerTest extends AbstractVLCInternalTest
-{
- @Test
- public void mediaPlayerNew()
- {
- LibVlcMediaPlayer instance = libvlc.libvlc_media_player_new(libvlcInstance, exception);
- Assert.assertNotNull(instance);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaPlayerPlayBad()
- {
- LibVlcMediaPlayer instance = libvlc.libvlc_media_player_new(libvlcInstance, exception);
- libvlc.libvlc_media_player_play(instance, exception);
- Assert.assertEquals(1, exception.b_raised); // no associated media descriptor
- }
-
- @Test
- public void mediaPlayerPlay()
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_player_play(mi, exception);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaPlayerIsPlaying() throws Exception
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- Assert.assertEquals(0, libvlc.libvlc_media_player_is_playing(mi, exception));
- libvlc.libvlc_media_player_play(mi, exception);
- Assert.assertEquals(0, exception.b_raised);
- Thread.sleep(200);
- Assert.assertEquals(1, libvlc.libvlc_media_player_is_playing(mi, exception));
- }
-
- @Test
- public void mediaPlayerPauseBad()
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_player_pause(mi, exception);
- Assert.assertEquals(1, exception.b_raised);
- }
-
- @Test
- public void mediaPlayerPause()
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_player_play(mi, exception);
- libvlc.libvlc_media_player_pause(mi, exception);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void mediaPlayerSetPosition()
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_player_play(mi, exception);
- libvlc.libvlc_media_player_set_position(mi, 0.5f, exception);
- Assert.assertEquals(0, exception.b_raised);
- float position = libvlc.libvlc_media_player_get_position(mi, exception);
- Assert.assertTrue("Position is: " + position, position >= 0.5f);
- }
-
- @Test
- public void mediaPlayerStop()
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_player_stop(mi, exception);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test(timeout = 2000L)
- public void mediaPlayerStop2() throws Exception
- {
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMediaPlayer mi = libvlc.libvlc_media_player_new_from_media(md, exception);
- libvlc.libvlc_media_player_play(mi, exception);
- Thread.sleep(100);
- libvlc.libvlc_media_player_stop(mi, exception);
- Thread.sleep(500);
- Assert.assertEquals(0, exception.b_raised);
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * MediaDescriptorTest.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-package org.videolan.jvlc.internal;
-
-import junit.framework.Assert;
-
-import org.junit.Test;
-import org.videolan.jvlc.internal.LibVlc.LibVlcEventManager;
-import org.videolan.jvlc.internal.LibVlc.LibVlcMedia;
-import org.videolan.jvlc.internal.LibVlc.libvlc_exception_t;
-
-
-public class LibVlcMediaTest extends AbstractVLCInternalTest
-{
-
- @Test
- public void testMediaNew() throws Exception
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- Assert.assertNotNull(md);
- Assert.assertEquals(0, exception.b_raised);
- }
-
- @Test
- public void testMediaGetMrl()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- String mdMrl = libvlc.libvlc_media_get_mrl(md, exception);
- Assert.assertEquals(mrl, mdMrl);
- }
-
- @Test
- public void testMediaDuplicate()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcMedia md2 = libvlc.libvlc_media_duplicate(md);
- Assert.assertNotSame(md.getPointer(), md2.getPointer());
- Assert.assertEquals(libvlc.libvlc_media_get_mrl(md2, exception), libvlc.libvlc_media_get_mrl(md, exception));
- }
-
- @Test
- public void testMediaEventManager()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- LibVlcEventManager evManager = libvlc.libvlc_media_event_manager(md, exception);
- Assert.assertEquals(0, exception.b_raised);
- Assert.assertNotNull(evManager);
- }
-
- @Test
- public void testMediaGetState()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- int state = libvlc.libvlc_media_get_state(md, exception);
- Assert.assertEquals(0, exception.b_raised);
- Assert.assertEquals(LibVlcState.libvlc_NothingSpecial.ordinal(), state);
- }
-
- @Test
- public void testMediaIsPreparsed()
- {
- libvlc_exception_t exception = new libvlc_exception_t();
- LibVlcMedia md = libvlc.libvlc_media_new(libvlcInstance, mrl, exception);
- int state = libvlc.libvlc_media_is_preparsed(md, exception);
- Assert.assertEquals(0, exception.b_raised);
- Assert.assertEquals(0, state);
- }
-
-
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration>
- <!-- log4j test configuration -->
- <appender name="test-appender" class="org.apache.log4j.ConsoleAppender">
- <layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%-5p %c.%M(%C{1}.java:%L) %m%n" />
- <!-- <param name="ConversionPattern" value="%-5p %m%n" />-->
- </layout>
- </appender>
- <category name="org.videolan">
- <priority value="info" />
- </category>
- <root>
- <priority value="debug" />
- <appender-ref ref="test-appender" />
- </root>
-</log4j:configuration>
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/python
-"""
-vlc to jna almost-automatized interface converter.
-
-This program is free software. It comes without any warranty, to
-the extent permitted by applicable law. You can redistribute it
-and/or modify it under the terms of the Do What The Fuck You Want
-To Public License, Version 2, as published by Sam Hocevar. See
-http://sam.zoy.org/wtfpl/COPYING for more details.
-
-"""
-
-import sys
-
-file = open('libvlc.h', 'r')
-
-parameter_parsing = False
-prototype_parsing = False
-
-types_map = [
- ["const ", ""],
- ["VLC_PUBLIC_API ", ""],
- ["char**", "String[] "],
- ["char **" , "String[] "],
- ["char*" , "String "],
- ["char *" , "String "],
- ["libvlc_instance_t *", "LibVlcInstance "],
- ["libvlc_exception_t *", "libvlc_exception_t "],
- ["libvlc_log_t *", "LibVlcLog "],
- ["libvlc_log_iterator_t *", "LibVlcLogIterator "],
- ["libvlc_log_message_t *", "libvlc_log_message_t "],
- ["unsigned", "int"],
-]
-
-def convert_prototype(proto, parameters):
- #print proto
- #print parameters
- tokens = proto.split(",")
- last = tokens.pop().split(")")
- res = ''
- for i in tokens:
- param = parameters.pop(0)
- if i.find(param)==-1:
- res += i + " " + param + ","
- else:
- res += i + " ,"
- if len(parameters):
- param = parameters.pop(0)
- if last[0].find(param)==-1:
- res += last[0] + " " + param + ")" + last[1]
- else:
- res += last[0] + ")" + last[1]
-
- for k,v in types_map:
- res = res.replace(k,v)
- print res
-
-for line in file.readlines():
- if line.find("/**")!=-1:
- parameters = []
- parameter_parsing = True
-
- if line.find("VLC_PUBLIC_API")!=-1:
- if not parameters:
- continue
- prototype_line = ''
- prototype_parsing = True
-
- if parameter_parsing:
- param_index = line.find("\param ")
- if not param_index==-1:
- parameter = line.split()[2]
- parameters.append(parameter)
- if line.find("*/")!=-1:
- parameter_parsing = False
-
- if prototype_parsing:
- prototype_line += line.strip()
- if line.find(");")!=-1:
- prototype_parsing = False
- convert_prototype(prototype_line, parameters)
- parameters = None
- continue
-
- #sys.stdout.write(line)
-
-# vi:ts=4
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
- <modelVersion>4.0.0</modelVersion>
- <groupId>org.videolan</groupId>
- <artifactId>jvlc-parent</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- <packaging>pom</packaging>
- <name>JVLC</name>
- <description>Java Bindings for VideoLAN</description>
- <url>http://jvlc.ihack.it/</url>
- <inceptionYear>2005</inceptionYear>
- <organization>
- <name>The VideoLAN Team</name>
- <url>http://www.videolan.org/</url>
- </organization>
-
- <licenses>
- <license>
- <name>GPLv2</name>
- <url>http://www.gnu.org/licenses/old-licenses/gpl-2.0.html</url>
- </license>
- </licenses>
-
- <issueManagement>
- <system>Trac</system>
- <url>http://trac.videolan.org/jvlc</url>
- </issueManagement>
-
- <scm>
- <connection>scm:git:git://git.videolan.org/vlc</connection>
- <developerConnection>scm:git:git://git.videolan.org/vlc</developerConnection>
- <tag>HEAD</tag>
- <url>http://git.videolan.org/gitweb.cgi</url>
- </scm>
-
- <developers>
- <developer>
- <name>Filippo Carone</name>
- <id>littlejohn</id>
- <roles>
- <role>developer</role>
- <role>project admin</role>
- </roles>
- <timezone>+1</timezone>
- <email>littlejohn[at]videolan[dot]org</email>
- </developer>
- <developer>
- <name>Philippe Morin</name>
- <id>phmo95</id>
- <roles>
- <role>developer</role>
- </roles>
- <email>phmorin[at]free[dot]fr</email>
- </developer>
- </developers>
- <contributors>
- <contributor>
- <name>Adrien Grand</name>
- <email>jpountz[at]jpountz[dot]net</email>
- </contributor>
- <contributor>
- <name>Cristian Maglie</name>
- <email>megabug[at]autisici[dot]org</email>
- </contributor>
- </contributors>
-
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <source>1.5</source>
- <target>1.5</target>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-site-plugin</artifactId>
- <version>2.0-beta-5</version>
- <configuration>
- <stagingSiteURL>
- scp://jvlc.ihack.it//home/littlejohn/www/ihack.it/jvlc/maven-site/staging/${pom.artifactId}/
- </stagingSiteURL>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <reporting>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-surefire-report-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jxr-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-pmd-plugin</artifactId>
- <configuration>
- <linkXref>true</linkXref>
- <sourceEncoding>utf-8</sourceEncoding>
- <targetJdk>1.5</targetJdk>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>cobertura-maven-plugin</artifactId>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-javadoc-plugin</artifactId>
- <configuration>
- <links>
- <link>
- http://java.sun.com/j2se/1.5.0/docs/api/
- </link>
- </links>
- </configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- </plugin>
- </plugins>
-
- </reporting>
-
- <modules>
- <module>core</module>
- <module>samples</module>
- </modules>
-
- <distributionManagement>
- <repository>
- <id>jvlc.ihack.it</id>
- <name>jvlc repository</name>
- <url>scp://jvlc.ihack.it/www/ihack.it/jvlc/maven2</url>
- </repository>
- <snapshotRepository>
- <id>snapshots.jvlc.ihack.it</id>
- <name>openmind snapshot repository</name>
- <url>scp://jvlc.ihack.it/home/littlejohn/www/ihack.it/jvlc/maven2-snapshots</url>
- </snapshotRepository>
- </distributionManagement>
-
-
-</project>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.videolan</groupId>
- <artifactId>jvlc-samples</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- </parent>
- <groupId>org.videolan</groupId>
- <artifactId>jvlc-samples-client</artifactId>
- <packaging>jar</packaging>
- <name>JVLC - Client sample</name>
- <description>Java Bindings for VideoLAN - Client sample</description>
- <version>1.0.2-SNAPSHOT</version>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>exec-maven-plugin</artifactId>
- <executions>
- <execution>
- <goals>
- <goal>java</goal>
- </goals>
- </execution>
- </executions>
- <configuration>
- <mainClass>VlcClient</mainClass>
- </configuration>
- </plugin>
- <plugin>
- <artifactId>maven-assembly-plugin</artifactId>
- <configuration>
- <descriptorRefs>
- <descriptorRef>jar-with-dependencies</descriptorRef>
- </descriptorRefs>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
- <dependencies>
- <dependency>
- <groupId>org.videolan</groupId>
- <artifactId>jvlc-core</artifactId>
- <version>${project.version}</version>
- </dependency>
- </dependencies>
-
-</project>
+++ /dev/null
-import java.awt.Canvas;
-import java.awt.Color;
-import java.awt.Frame;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JPanel;
-
-import org.videolan.jvlc.JVLC;
-
-/*****************************************************************************
- * MultipleVideosSample.java: VLC Java Bindings
- *****************************************************************************
- * Copyright (C) 1998-2008 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
-public class MultipleVideosSample
-{
-
- private static int videosNumber = 6;
- private static String filename ="/home/carone/a.avi";
-
- public static void main(String[] args) throws Exception
- {
- Frame frame = new java.awt.Frame();
- frame.setBounds(0, 0, 600, 700);
- JPanel jvcc = new JPanel();
- Canvas[] videoCanvasesArray = new Canvas[videosNumber];
- frame.add(jvcc);
-
- if (args.length > 0)
- {
- filename = args[0];
- }
-
- for (int i = 0; i < videosNumber; i++)
- {
- Canvas jvlcCanvas = new Canvas();
- videoCanvasesArray[i] = jvlcCanvas;
- jvlcCanvas.setSize(200, 200);
- jvlcCanvas.setBackground(new Color(0x0));
- jvcc.add(jvlcCanvas);
- }
-
- frame.addWindowListener(new WindowAdapter()
- {
-
- @Override
- public void windowClosing(WindowEvent ev)
- {
- System.exit(0);
- }
- });
-
- frame.setVisible(true);
- JVLC[] jvlcArray = new JVLC[videosNumber];
- for (int i = 0; i < videosNumber; i++)
- {
- JVLC jvlc = new JVLC();
- jvlcArray[i] = jvlc;
- jvlc.setVideoOutput(videoCanvasesArray[i]);
- }
-
- for (int i = 0; i < videosNumber; i++)
- {
- jvlcArray[i].play(filename);
- jvlcArray[i].setVideoOutput(videoCanvasesArray[i]);
- Thread.sleep(500);
- }
- }
-
-}
+++ /dev/null
-/*****************************************************************************
- * VlcClient.java: Sample Swing player
- *****************************************************************************
- * Copyright (C) 1998-2006 the VideoLAN team
- *
- * Created on 28-feb-2006
- *
- * $Id: $
- *
- * This program is free software; you can redistribute it
- * and/or modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public
- * License along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
- *
- */
-
-import java.awt.Canvas;
-import java.awt.Frame;
-import java.awt.event.WindowAdapter;
-import java.awt.event.WindowEvent;
-
-import javax.swing.JPanel;
-
-import org.videolan.jvlc.JVLC;
-import org.videolan.jvlc.MediaPlayer;
-
-
-class VLCPlayerFrame extends Frame
-{
-
- /**
- *
- */
- private static final long serialVersionUID = -7471950211795850421L;
-
- public Canvas jvcanvas;
-
- private MediaPlayer mediaPlayer;
-
- public VLCPlayerFrame(String[] args)
- {
- initComponents(args);
- }
-
- private void initComponents(String[] args)
- {
-
- java.awt.GridBagConstraints gridBagConstraints;
-
- fullScreenButton = new javax.swing.JButton();
- jTextField1 = new javax.swing.JTextField();
- setButton = new javax.swing.JButton();
- pauseButton = new javax.swing.JButton();
- stopButton = new javax.swing.JButton();
-
- jvcc = new JPanel();
- jvcanvas = new java.awt.Canvas();
- jvcanvas.setSize(200, 200);
- jvcc.add(jvcanvas);
-
- jvlc = new JVLC(args);
- jvlc.setVideoOutput(jvcanvas);
-
- setLayout(new java.awt.GridBagLayout());
-
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridwidth = java.awt.GridBagConstraints.CENTER;
- gridBagConstraints.gridx = 0;
- gridBagConstraints.gridy = 0;
- add(jvcc, gridBagConstraints);
-
- fullScreenButton.setText("FullScreen");
- fullScreenButton.addActionListener(new java.awt.event.ActionListener()
- {
-
- public void actionPerformed(java.awt.event.ActionEvent evt)
- {
- fullScreenButtonActionPerformed(evt);
- }
- });
-
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridx = 0;
- gridBagConstraints.gridy = 2;
- gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
- add(fullScreenButton, gridBagConstraints);
-
- jTextField1.setText("file://a.avi");
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridx = 0;
- gridBagConstraints.gridy = 1;
- gridBagConstraints.gridwidth = 2;
- gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
- add(jTextField1, gridBagConstraints);
-
- setButton.setText("Set item");
- setButton.addActionListener(new java.awt.event.ActionListener()
- {
-
- public void actionPerformed(java.awt.event.ActionEvent evt)
- {
- setButtonActionPerformed(evt);
- }
- });
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridx = 2;
- gridBagConstraints.gridy = 1;
- gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
- add(setButton, gridBagConstraints);
-
- pauseButton.setText("Play/Pause");
- pauseButton.addActionListener(new java.awt.event.ActionListener()
- {
-
- public void actionPerformed(java.awt.event.ActionEvent evt)
- {
- pauseButtonActionPerformed(evt);
- }
- });
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridx = 1;
- gridBagConstraints.gridy = 2;
- gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
- add(pauseButton, gridBagConstraints);
-
- stopButton.setText("Stop");
- stopButton.addActionListener(new java.awt.event.ActionListener()
- {
-
- public void actionPerformed(java.awt.event.ActionEvent evt)
- {
- stopButtonActionPerformed(evt);
- }
- });
- gridBagConstraints = new java.awt.GridBagConstraints();
- gridBagConstraints.gridx = 2;
- gridBagConstraints.gridy = 2;
- gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
- add(stopButton, gridBagConstraints);
-
- pack();
-
- }
-
- private void stopButtonActionPerformed(java.awt.event.ActionEvent evt)
- {
- if (mediaPlayer == null)
- {
- return;
- }
- mediaPlayer.stop();
- }
-
- private void pauseButtonActionPerformed(java.awt.event.ActionEvent evt)
- {
- if (mediaPlayer == null)
- {
- return;
- }
- mediaPlayer.pause();
- }
-
- private void setButtonActionPerformed(java.awt.event.ActionEvent evt)
- {
- if (mediaPlayer != null)
- {
- mediaPlayer.stop();
- mediaPlayer.release();
- jvcanvas = new java.awt.Canvas();
- }
- mediaPlayer = jvlc.play(jTextField1.getText());
- }
-
- private void fullScreenButtonActionPerformed(java.awt.event.ActionEvent evt)
- {
- // jvlc.fullScreen();
- }
-
- private javax.swing.JButton setButton;
-
- private javax.swing.JButton pauseButton;
-
- private javax.swing.JButton stopButton;
-
- private javax.swing.JButton fullScreenButton;
-
- private javax.swing.JTextField jTextField1;
-
- private JPanel jvcc;
-
- public JVLC jvlc;
- // MediaControlInstance mci;
-
-}
-
-
-public class VlcClient
-{
-
- public static void main(String[] args)
- {
- Frame f = new VLCPlayerFrame(args);
- f.setBounds(0, 0, 500, 500);
- f.addWindowListener(new WindowAdapter()
- {
-
- @Override
- public void windowClosing(WindowEvent ev)
- {
- System.exit(0);
- }
- });
- f.setVisible(true);
- }
-}
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd ">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.videolan</groupId>
- <artifactId>jvlc-parent</artifactId>
- <version>1.0.2-SNAPSHOT</version>
- </parent>
- <artifactId>jvlc-samples</artifactId>
- <packaging>pom</packaging>
- <name>JVLC - Samples</name>
- <description>Java Bindings for VideoLAN - Samples</description>
- <version>1.0.2-SNAPSHOT</version>
-
- <modules>
- <module>client</module>
- </modules>
-
-</project>
+++ /dev/null
-.svn
-Makefile
-CMakeTmp
+++ /dev/null
-project(Phonon)
-
-cmake_minimum_required(VERSION 2.6.2 FATAL_ERROR)
-
-# CMP0002: we have multiple targets with the same name for the unit tests
-cmake_policy(SET CMP0002 OLD)
-
-# enable unit tests
-option(PHONON_BUILD_TESTS "Build the tests")
-option(PHONON_BUILD_EXAMPLES "Build the examples")
-
-if (PHONON_BUILD_TESTS)
- enable_testing()
-endif (PHONON_BUILD_TESTS)
-
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
-
-include(PhononMacros)
-
-include(MacroLogFeature)
-include(MacroOptionalFindPackage)
-
-set(QT_MIN_VERSION 4.4.0)
-find_package(Qt4 REQUIRED)
-if (NOT QT_QTDBUS_FOUND)
- message(STATUS "Warning: Phonon won't be compiled with DBus support.")
-endif(NOT QT_QTDBUS_FOUND)
-
-find_package(Automoc4 REQUIRED)
-include (CheckCXXCompilerFlag)
-include (MacroEnsureVersion)
-
-find_package(Phonon REQUIRED)
-if(PHONON_PULSESUPPORT)
- add_definitions(-DPHONON_PULSESUPPORT)
-endif(PHONON_PULSESUPPORT)
-find_package(VLC REQUIRED)
-if (NOT AUTOMOC4_VERSION)
- set(AUTOMOC4_VERSION "0.9.83")
-endif (NOT AUTOMOC4_VERSION)
-macro_ensure_version("0.9.86" "${AUTOMOC4_VERSION}" _automoc4_version_ok)
-if (NOT _automoc4_version_ok)
- message(FATAL_ERROR "Your version of automoc4 is too old. You have ${AUTOMOC4_VERSION}, you need at least 0.9.86")
-endif (NOT _automoc4_version_ok)
-
-if (CMAKE_COMPILER_IS_GNUCXX)
- set (KDE4_ENABLE_EXCEPTIONS -fexceptions)
- # Select flags.
- set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
- set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")
- set(CMAKE_CXX_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
- set(CMAKE_CXX_FLAGS_DEBUGFULL "-g3 -fno-inline")
- set(CMAKE_CXX_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
- set(CMAKE_C_FLAGS_RELWITHDEBINFO "-O2 -g")
- set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")
- set(CMAKE_C_FLAGS_DEBUG "-g -O2 -fno-reorder-blocks -fno-schedule-insns -fno-inline")
- set(CMAKE_C_FLAGS_DEBUGFULL "-g3 -fno-inline")
- set(CMAKE_C_FLAGS_PROFILE "-g3 -fno-inline -ftest-coverage -fprofile-arcs")
-
- if (CMAKE_SYSTEM_NAME MATCHES Linux)
- set ( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-long-long -std=iso9899:1990 -Wundef -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security -Wmissing-format-attribute -fno-common")
- set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-exceptions -fno-check-new -fno-common")
- add_definitions (-D_BSD_SOURCE)
- endif (CMAKE_SYSTEM_NAME MATCHES Linux)
-
- # gcc under Windows
- if (MINGW)
- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--export-all-symbols -Wl,--disable-auto-import")
- set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -Wl,--export-all-symbols -Wl,--disable-auto-import")
-
- # we always link against the release version of QT with mingw
- # (even for debug builds). So we need to define QT_NO_DEBUG
- # or else QPluginLoader rejects plugins because it thinks
- # they're built against the wrong QT.
- add_definitions(-DQT_NO_DEBUG)
- endif (MINGW)
-
- check_cxx_compiler_flag(-fPIE HAVE_FPIE_SUPPORT)
- if(KDE4_ENABLE_FPIE)
- if(HAVE_FPIE_SUPPORT)
- set (KDE4_CXX_FPIE_FLAGS "-fPIE")
- set (KDE4_PIE_LDFLAGS "-pie")
- else(HAVE_FPIE_SUPPORT)
- message(STATUS "Your compiler doesn't support PIE flag")
- endif(HAVE_FPIE_SUPPORT)
- endif(KDE4_ENABLE_FPIE)
-
- check_cxx_compiler_flag(-Woverloaded-virtual __KDE_HAVE_W_OVERLOADED_VIRTUAL)
- if(__KDE_HAVE_W_OVERLOADED_VIRTUAL)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Woverloaded-virtual")
- endif(__KDE_HAVE_W_OVERLOADED_VIRTUAL)
-
- # visibility support
- check_cxx_compiler_flag(-fvisibility=hidden __KDE_HAVE_GCC_VISIBILITY)
- set( __KDE_HAVE_GCC_VISIBILITY ${__KDE_HAVE_GCC_VISIBILITY} CACHE BOOL "GCC support for hidden visibility")
-
- # get the gcc version
- exec_program(${CMAKE_C_COMPILER} ARGS --version OUTPUT_VARIABLE _gcc_version_info)
-
- string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" _gcc_version "${_gcc_version_info}")
- # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
- if (NOT _gcc_version)
- string (REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" _gcc_version "${_gcc_version_info}")
- endif (NOT _gcc_version)
-
- macro_ensure_version("4.1.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_1)
- macro_ensure_version("4.2.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_2)
- macro_ensure_version("4.3.0" "${_gcc_version}" GCC_IS_NEWER_THAN_4_3)
-
- # save a little by making local statics not threadsafe
- # ### do not enable it for older compilers, see
- # ### http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31806
- if (GCC_IS_NEWER_THAN_4_3)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-threadsafe-statics")
- endif (GCC_IS_NEWER_THAN_4_3)
-
- set(_GCC_COMPILED_WITH_BAD_ALLOCATOR FALSE)
- if (GCC_IS_NEWER_THAN_4_1)
- exec_program(${CMAKE_C_COMPILER} ARGS -v OUTPUT_VARIABLE _gcc_alloc_info)
- string(REGEX MATCH "(--enable-libstdcxx-allocator=mt)" _GCC_COMPILED_WITH_BAD_ALLOCATOR "${_gcc_alloc_info}")
- endif (GCC_IS_NEWER_THAN_4_1)
-
- if (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
- set (KDE4_C_FLAGS "-fvisibility=hidden")
- # check that Qt defines Q_DECL_EXPORT as __attribute__ ((visibility("default")))
- # if it doesn't and KDE compiles with hidden default visibiltiy plugins will break
- set(_source "#include <QtCore/QtGlobal>\n int main()\n {\n #ifdef QT_VISIBILITY_AVAILABLE \n return 0;\n #else \n return 1; \n #endif \n }\n")
- set(_source_file ${CMAKE_BINARY_DIR}/CMakeTmp/check_qt_visibility.cpp)
- file(WRITE "${_source_file}" "${_source}")
- set(_include_dirs "-DINCLUDE_DIRECTORIES:STRING=${QT_INCLUDES}")
-
- try_run(_run_result _compile_result ${CMAKE_BINARY_DIR} ${_source_file} CMAKE_FLAGS "${_include_dirs}")
-
- if(NOT _compile_result)
- message(FATAL_ERROR "Could not compile simple test program:\n ${_source}")
- endif(NOT _compile_result)
- if(_run_result)
- message(FATAL_ERROR "Qt compiled without support for -fvisibility=hidden. This will break plugins and linking of some applications. Please fix your Qt installation.")
- endif(_run_result)
-
- if (GCC_IS_NEWER_THAN_4_2)
- set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden")
- endif (GCC_IS_NEWER_THAN_4_2)
- else (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
- set (__KDE_HAVE_GCC_VISIBILITY 0)
- endif (__KDE_HAVE_GCC_VISIBILITY AND GCC_IS_NEWER_THAN_4_1 AND NOT _GCC_COMPILED_WITH_BAD_ALLOCATOR)
-
-endif (CMAKE_COMPILER_IS_GNUCXX)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
-set(CMAKE_INCLUDE_DIRECTORIES_PROJECT_BEFORE ON)
-set(CMAKE_COLOR_MAKEFILE ON)
-
-set(PHONON_LIB_MAJOR_VERSION "4")
-set(PHONON_LIB_MINOR_VERSION "3")
-set(PHONON_LIB_PATCH_VERSION "50")
-set(PHONON_LIB_VERSION "${PHONON_LIB_MAJOR_VERSION}.4.0")
-set(PHONON_LIB_SOVERSION ${PHONON_LIB_MAJOR_VERSION})
-
-add_definitions(${QT_DEFINITIONS})
-remove_definitions(-DQT3_SUPPORT_WARNINGS -DQT3_SUPPORT)
-if(MSVC)
- add_definitions( -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS )
-endif(MSVC)
-
-# for including config.h and for includes like <kparts/foo.h>
-include_directories(${QT_INCLUDES} ${PHONON_INCLUDES} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/includes ${CMAKE_CURRENT_SOURCE_DIR}/phonon ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/phonon)
-
-macro(_SET_FANCY _var _value _comment)
- if (KDESupport_SOURCE_DIR)
- # when building inside kdesupport other subprojects write crap into our variables
- set(${_var} "${_value}")
- else (KDESupport_SOURCE_DIR)
- if (NOT DEFINED ${_var})
- set(${_var} "${_value}")
- else (NOT DEFINED ${_var})
- set(${_var} "${${_var}}" CACHE PATH "${_comment}")
- endif (NOT DEFINED ${_var})
- endif (KDESupport_SOURCE_DIR)
-endmacro(_SET_FANCY)
-
-set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)" )
-
-_set_fancy(EXEC_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" "Base directory for executables and libraries")
-_set_fancy(SHARE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}/share" "Base directory for files which go to share/")
-_set_fancy(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" "The install dir for executables (default ${EXEC_INSTALL_PREFIX}/bin)")
-_set_fancy(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" "The subdirectory relative to the install prefix where libraries will be installed (default is ${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX})")
-_set_fancy(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" "The subdirectory to the header prefix")
-_set_fancy(PLUGIN_INSTALL_DIR "${LIB_INSTALL_DIR}/kde4" "The subdirectory relative to the install prefix where plugins will be installed (default is ${LIB_INSTALL_DIR}/kde4)")
-_set_fancy(ICON_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/icons" "The icon install dir (default ${SHARE_INSTALL_PREFIX}/share/icons/)")
-_set_fancy(SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/kde4/services" "The install dir for service (desktop, protocol, ...) files")
-_set_fancy(DBUS_INTERFACES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/interfaces" "The dbus interfaces install dir (default: ${SHARE_INSTALL_PREFIX}/dbus-1/interfaces)")
-_set_fancy(DBUS_SERVICES_INSTALL_DIR "${SHARE_INSTALL_PREFIX}/dbus-1/services" "The dbus services install dir (default: ${SHARE_INSTALL_PREFIX}/dbus-1/services)")
-
-set(INSTALL_TARGETS_DEFAULT_ARGS RUNTIME DESTINATION "${BIN_INSTALL_DIR}"
- LIBRARY DESTINATION "${LIB_INSTALL_DIR}"
- ARCHIVE DESTINATION "${LIB_INSTALL_DIR}" COMPONENT Devel )
-
-add_definitions(-DPHONON_LIB_INSTALL_DIR="${LIB_INSTALL_DIR}")
-# on the Mac support an extra install directory for application bundles
-if(APPLE)
- set(INSTALL_TARGETS_DEFAULT_ARGS ${INSTALL_TARGETS_DEFAULT_ARGS}
- BUNDLE DESTINATION "${BUNDLE_INSTALL_DIR}" )
- set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined dynamic_lookup")
- set(CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS "${CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS} -flat_namespace -undefined dynamic_lookup")
-endif(APPLE)
-
-if (CMAKE_SYSTEM_NAME MATCHES Linux)
- if (CMAKE_COMPILER_IS_GNUCXX)
- set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")
- set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}")
-
- set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--enable-new-dtags ${CMAKE_SHARED_LINKER_FLAGS}")
- set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--enable-new-dtags ${CMAKE_MODULE_LINKER_FLAGS}")
- set ( CMAKE_EXE_LINKER_FLAGS "-Wl,--enable-new-dtags ${CMAKE_EXE_LINKER_FLAGS}")
-
- # we profile...
- if(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile)
- set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
- set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage")
- endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES profile)
- endif (CMAKE_COMPILER_IS_GNUCXX)
- if (CMAKE_C_COMPILER MATCHES "icc")
- set ( CMAKE_SHARED_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_SHARED_LINKER_FLAGS}")
- set ( CMAKE_MODULE_LINKER_FLAGS "-Wl,--fatal-warnings -Wl,--no-undefined -lc ${CMAKE_MODULE_LINKER_FLAGS}")
- endif (CMAKE_C_COMPILER MATCHES "icc")
-endif (CMAKE_SYSTEM_NAME MATCHES Linux)
-
-list(APPEND PHONON_LIBS phonon ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
-if(QT_QTDBUS_FOUND)
- list(APPEND PHONON_LIBS phonon ${QT_QTDBUS_LIBRARY})
-endif(QT_QTDBUS_FOUND)
-
-set(EXECUTABLE_OUTPUT_PATH ${Phonon_BINARY_DIR}/bin)
-if (WIN32)
- set(LIBRARY_OUTPUT_PATH ${EXECUTABLE_OUTPUT_PATH})
-else (WIN32)
- set(LIBRARY_OUTPUT_PATH ${Phonon_BINARY_DIR}/lib)
-endif (WIN32)
-
-if (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER MATCHES "icc")
- set ( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-check-new -fno-common")
-endif (CMAKE_COMPILER_IS_GNUCXX OR CMAKE_C_COMPILER MATCHES "icc")
-
-# Set up RPATH handling, so the libs are found if they are installed to a non-standard location.
-# By default cmake builds the targets with full RPATH to everything in the build directory,
-# but then removes the RPATH when installing.
-# These two options below make it set the RPATH of the installed targets to all
-# RPATH directories outside the current CMAKE_BINARY_DIR and also the library
-# install directory. Alex
-set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
-set(CMAKE_INSTALL_RPATH "${LIB_INSTALL_DIR}" )
-
-if(APPLE)
- set(CMAKE_INSTALL_NAME_DIR ${LIB_INSTALL_DIR})
-endif(APPLE)
-
-if (Q_WS_X11)
- add_subdirectory(vlc)
-endif (Q_WS_X11)
-
-macro_display_feature_log()
+++ /dev/null
-# - Try to find automoc4
-# Once done this will define
-#
-# AUTOMOC4_FOUND - automoc4 has been found
-# AUTOMOC4_EXECUTABLE - the automoc4 tool
-# AUTOMOC4_VERSION - the full version of automoc4
-# AUTOMOC4_VERSION_MAJOR, AUTOMOC4_VERSION_MINOR, AUTOMOC4_VERSION_PATCH - AUTOMOC4_VERSION
-# broken into its components
-#
-# It also adds the following macros
-# AUTOMOC4(<target> <SRCS_VAR>)
-# Use this to run automoc4 on all files contained in the list <SRCS_VAR>.
-#
-# AUTOMOC4_MOC_HEADERS(<target> header1.h header2.h ...)
-# Use this to add more header files to be processed with automoc4.
-#
-# AUTOMOC4_ADD_EXECUTABLE(<target_NAME> src1 src2 ...)
-# This macro does the same as ADD_EXECUTABLE, but additionally
-# adds automoc4 handling for all source files.
-#
-# AUTOMOC4_ADD_LIBRARY(<target_NAME> src1 src2 ...)
-# This macro does the same as ADD_LIBRARY, but additionally
-# adds automoc4 handling for all source files.
-
-# Internal helper macro, may change or be removed anytime:
-# _ADD_AUTOMOC4_TARGET(<target_NAME> <SRCS_VAR>)
-#
-# Since version 0.9.88:
-# The following two macros are only to be used for KDE4 projects
-# and do something which makes sure automoc4 works for KDE. Don't
-# use them anywhere else.
-# _AUTOMOC4_KDE4_PRE_TARGET_HANDLING(<target_NAME> <SRCS_VAR>)
-# _AUTOMOC4_KDE4_POST_TARGET_HANDLING(<target_NAME>)
-
-
-# Copyright (c) 2008-2009, Alexander Neundorf, <neundorf@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-# check if we are inside KDESupport and automoc is enabled
-if("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
- # when building this project as part of kdesupport
- set(AUTOMOC4_CONFIG_FILE "${KDESupport_SOURCE_DIR}/automoc/Automoc4Config.cmake")
-else("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
- # when building this project outside kdesupport
-
- # CMAKE_[SYSTEM_]PREFIX_PATH exists starting with cmake 2.6.0
- file(TO_CMAKE_PATH "$ENV{CMAKE_PREFIX_PATH}" _env_CMAKE_PREFIX_PATH)
- file(TO_CMAKE_PATH "$ENV{CMAKE_LIBRARY_PATH}" _env_CMAKE_LIBRARY_PATH)
-
- find_file(AUTOMOC4_CONFIG_FILE NAMES Automoc4Config.cmake
- PATH_SUFFIXES automoc4 lib/automoc4 lib64/automoc4
- PATHS ${_env_CMAKE_PREFIX_PATH} ${CMAKE_PREFIX_PATH} ${CMAKE_SYSTEM_PREFIX_PATH}
- ${_env_CMAKE_LIBRARY_PATH} ${CMAKE_LIBRARY_PATH} ${CMAKE_SYSTEM_LIBRARY_PATH}
- ${CMAKE_INSTALL_PREFIX}
- NO_DEFAULT_PATH )
-endif("${KDESupport_SOURCE_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
-
-
-if(AUTOMOC4_CONFIG_FILE)
- include(${AUTOMOC4_CONFIG_FILE})
- set(AUTOMOC4_FOUND TRUE)
-else(AUTOMOC4_CONFIG_FILE)
- set(AUTOMOC4_FOUND FALSE)
-endif(AUTOMOC4_CONFIG_FILE)
-
-if (AUTOMOC4_FOUND)
- if (NOT Automoc4_FIND_QUIETLY)
- message(STATUS "Found Automoc4: ${AUTOMOC4_EXECUTABLE}")
- endif (NOT Automoc4_FIND_QUIETLY)
-else (AUTOMOC4_FOUND)
- if (Automoc4_FIND_REQUIRED)
- message(FATAL_ERROR "Did not find automoc4 (part of kdesupport).")
- else (Automoc4_FIND_REQUIRED)
- if (NOT Automoc4_FIND_QUIETLY)
- message(STATUS "Did not find automoc4 (part of kdesupport).")
- endif (NOT Automoc4_FIND_QUIETLY)
- endif (Automoc4_FIND_REQUIRED)
-endif (AUTOMOC4_FOUND)
+++ /dev/null
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME (DEFAULT_MSG|"Custom failure message") VAR1 ... )
-#
-# This macro is intended to be used in FindXXX.cmake modules files.
-# It handles the REQUIRED and QUIET argument to FIND_PACKAGE() and
-# it also sets the <UPPERCASED_NAME>_FOUND variable.
-# The package is found if all variables listed are TRUE.
-# Example:
-#
-# FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibXml2 DEFAULT_MSG LIBXML2_LIBRARIES LIBXML2_INCLUDE_DIR)
-#
-# LibXml2 is considered to be found, if both LIBXML2_LIBRARIES and
-# LIBXML2_INCLUDE_DIR are valid. Then also LIBXML2_FOUND is set to TRUE.
-# If it is not found and REQUIRED was used, it fails with FATAL_ERROR,
-# independent whether QUIET was used or not.
-#
-# If it is found, the location is reported using the VAR1 argument, so
-# here a message "Found LibXml2: /usr/lib/libxml2.so" will be printed out.
-# If the second argument is DEFAULT_MSG, the message in the failure case will
-# be "Could NOT find LibXml2", if you don't like this message you can specify
-# your own custom failure message there.
-
-MACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FAIL_MSG _VAR1 )
-
- IF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
- IF (${_NAME}_FIND_REQUIRED)
- SET(_FAIL_MESSAGE "Could not find REQUIRED package ${_NAME}")
- ELSE (${_NAME}_FIND_REQUIRED)
- SET(_FAIL_MESSAGE "Could not find OPTIONAL package ${_NAME}")
- ENDIF (${_NAME}_FIND_REQUIRED)
- ELSE("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
- SET(_FAIL_MESSAGE "${_FAIL_MSG}")
- ENDIF("${_FAIL_MSG}" STREQUAL "DEFAULT_MSG")
-
- STRING(TOUPPER ${_NAME} _NAME_UPPER)
-
- SET(${_NAME_UPPER}_FOUND TRUE)
- IF(NOT ${_VAR1})
- SET(${_NAME_UPPER}_FOUND FALSE)
- ENDIF(NOT ${_VAR1})
-
- FOREACH(_CURRENT_VAR ${ARGN})
- IF(NOT ${_CURRENT_VAR})
- SET(${_NAME_UPPER}_FOUND FALSE)
- ENDIF(NOT ${_CURRENT_VAR})
- ENDFOREACH(_CURRENT_VAR)
-
- IF (${_NAME_UPPER}_FOUND)
- IF (NOT ${_NAME}_FIND_QUIETLY)
- MESSAGE(STATUS "Found ${_NAME}: ${${_VAR1}}")
- ENDIF (NOT ${_NAME}_FIND_QUIETLY)
- ELSE (${_NAME_UPPER}_FOUND)
- IF (${_NAME}_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}")
- ELSE (${_NAME}_FIND_REQUIRED)
- IF (NOT ${_NAME}_FIND_QUIETLY)
- MESSAGE(STATUS "${_FAIL_MESSAGE}")
- ENDIF (NOT ${_NAME}_FIND_QUIETLY)
- ENDIF (${_NAME}_FIND_REQUIRED)
- ENDIF (${_NAME_UPPER}_FOUND)
-ENDMACRO(FIND_PACKAGE_HANDLE_STANDARD_ARGS)
+++ /dev/null
-# Find libphonon
-# Once done this will define
-#
-# PHONON_FOUND - system has Phonon Library
-# PHONON_INCLUDES - the Phonon include directory
-# PHONON_LIBS - link these to use Phonon
-# PHONON_VERSION - the version of the Phonon Library
-
-# Copyright (c) 2008, Matthias Kretz <kretz@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-macro(_phonon_find_version)
- set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/phonon/phononnamespace.h")
- if (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
- set(_phonon_namespace_header_file "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
- endif (APPLE AND EXISTS "${PHONON_INCLUDE_DIR}/Headers/phononnamespace.h")
- file(READ ${_phonon_namespace_header_file} _phonon_header LIMIT 5000 OFFSET 1000)
- string(REGEX MATCH "define PHONON_VERSION_STR \"(4\\.[0-9]+\\.[0-9a-z]+)\"" _phonon_version_match "${_phonon_header}")
- set(PHONON_VERSION "${CMAKE_MATCH_1}")
- message(STATUS "Phonon Version: ${PHONON_VERSION}")
-endmacro(_phonon_find_version)
-
-if(PHONON_FOUND)
- # Already found, nothing more to do except figuring out the version
- _phonon_find_version()
-else(PHONON_FOUND)
- if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
- set(PHONON_FIND_QUIETLY TRUE)
- endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
-
- # As discussed on kde-buildsystem: first look at CMAKE_PREFIX_PATH, then at the suggested PATHS (kde4 install dir)
- find_library(PHONON_LIBRARY NAMES phonon PATHS ${KDE4_LIB_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
- # then at the default system locations (CMAKE_SYSTEM_PREFIX_PATH, i.e. /usr etc.)
- find_library(PHONON_LIBRARY NAMES phonon)
-
- find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h PATHS ${KDE4_INCLUDE_INSTALL_DIR} ${QT_INCLUDE_DIR} ${INCLUDE_INSTALL_DIR} ${QT_LIBRARY_DIR} NO_SYSTEM_ENVIRONMENT_PATH NO_CMAKE_SYSTEM_PATH)
- find_path(PHONON_INCLUDE_DIR NAMES phonon/phonon_export.h)
-
- if(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
- set(PHONON_LIBS ${phonon_LIB_DEPENDS} ${PHONON_LIBRARY})
- set(PHONON_INCLUDES ${PHONON_INCLUDE_DIR}/KDE ${PHONON_INCLUDE_DIR})
- set(PHONON_FOUND TRUE)
- _phonon_find_version()
- find_path(PHONON_PULSESUPPORT NAMES phonon/pulsesupport.h PATHS ${PHONON_INCLUDES})
- else(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
- set(PHONON_FOUND FALSE)
- endif(PHONON_INCLUDE_DIR AND PHONON_LIBRARY)
-
- if(PHONON_FOUND)
- if(NOT PHONON_FIND_QUIETLY)
- message(STATUS "Found Phonon: ${PHONON_LIBRARY}")
- message(STATUS "Found Phonon Includes: ${PHONON_INCLUDES}")
- if(PHONON_PULSESUPPORT)
- message(STATUS "Found Phonon PulseAudio Support: Yes")
- else(PHONON_PULSESUPPORT)
- message(STATUS "Found Phonon PulseAudio Support: No")
- endif(PHONON_PULSESUPPORT)
- endif(NOT PHONON_FIND_QUIETLY)
- else(PHONON_FOUND)
- if(Phonon_FIND_REQUIRED)
- if(NOT PHONON_INCLUDE_DIR)
- message(STATUS "Phonon includes NOT found!")
- endif(NOT PHONON_INCLUDE_DIR)
- if(NOT PHONON_LIBRARY)
- message(STATUS "Phonon library NOT found!")
- endif(NOT PHONON_LIBRARY)
- message(FATAL_ERROR "Phonon library or includes NOT found!")
- else(Phonon_FIND_REQUIRED)
- message(STATUS "Unable to find Phonon")
- endif(Phonon_FIND_REQUIRED)
- endif(PHONON_FOUND)
-
-
- mark_as_advanced(PHONON_INCLUDE_DIR PHONON_LIBRARY PHONON_INCLUDES)
-endif(PHONON_FOUND)
+++ /dev/null
-# - Try to find VLC library
-# Once done this will define
-#
-# VLC_FOUND - system has VLC
-# VLC_INCLUDE_DIR - The VLC include directory
-# VLC_LIBRARIES - The libraries needed to use VLC
-# VLC_DEFINITIONS - Compiler switches required for using VLC
-#
-# Copyright (C) 2008, Tanguy Krotoff <tkrotoff@gmail.com>
-# Copyright (C) 2008, Lukas Durfina <lukas.durfina@gmail.com>
-# Copyright (c) 2009, Fathi Boudra <fboudra@gmail.com>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-#
-
-if(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
- # in cache already
- set(VLC_FIND_QUIETLY TRUE)
-endif(VLC_INCLUDE_DIR AND VLC_LIBRARIES)
-
-# use pkg-config to get the directories and then use these values
-# in the FIND_PATH() and FIND_LIBRARY() calls
-if(NOT WIN32)
- find_package(PkgConfig)
- pkg_check_modules(VLC libvlc>=1.0.0)
- set(VLC_DEFINITIONS ${VLC_CFLAGS})
- set(VLC_LIBRARIES ${VLC_LDFLAGS})
-endif(NOT WIN32)
-
-# TODO add argument support to pass version on find_package
-include(MacroEnsureVersion)
-macro_ensure_version(1.0.0 ${VLC_VERSION} VLC_VERSION_OK)
-if(VLC_VERSION_OK)
- set(VLC_FOUND TRUE)
- message(STATUS "VLC library found")
-else(VLC_VERSION_OK)
- set(VLC_FOUND FALSE)
- message(FATAL_ERROR "VLC library not found")
-endif(VLC_VERSION_OK)
-
-find_path(VLC_INCLUDE_DIR
- NAMES vlc.h
- PATHS ${VLC_INCLUDE_DIRS}
- PATH_SUFFIXES vlc)
-
-find_library(VLC_LIBRARIES
- NAMES vlc
- PATHS ${VLC_LIBRARY_DIRS})
-
-include(FindPackageHandleStandardArgs)
-find_package_handle_standard_args(VLC DEFAULT_MSG VLC_INCLUDE_DIR VLC_LIBRARIES)
-
-# show the VLC_INCLUDE_DIR and VLC_LIBRARIES variables only in the advanced view
-mark_as_advanced(VLC_INCLUDE_DIR VLC_LIBRARIES)
+++ /dev/null
-# This file defines the following macros for developers to use in ensuring
-# that installed software is of the right version:
-#
-# MACRO_ENSURE_VERSION - test that a version number is greater than
-# or equal to some minimum
-# MACRO_ENSURE_VERSION_RANGE - test that a version number is greater than
-# or equal to some minimum and less than some
-# maximum
-# MACRO_ENSURE_VERSION2 - deprecated, do not use in new code
-#
-
-# MACRO_ENSURE_VERSION
-# This macro compares version numbers of the form "x.y.z" or "x.y"
-# MACRO_ENSURE_VERSION( FOO_MIN_VERSION FOO_VERSION_FOUND FOO_VERSION_OK)
-# will set FOO_VERSION_OK to true if FOO_VERSION_FOUND >= FOO_MIN_VERSION
-# Leading and trailing text is ok, e.g.
-# MACRO_ENSURE_VERSION( "2.5.31" "flex 2.5.4a" VERSION_OK)
-# which means 2.5.31 is required and "flex 2.5.4a" is what was found on the system
-
-# Copyright (c) 2006, David Faure, <faure@kde.org>
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# MACRO_ENSURE_VERSION_RANGE
-# This macro ensures that a version number of the form
-# "x.y.z" or "x.y" falls within a range defined by
-# min_version <= found_version < max_version.
-# If this expression holds, FOO_VERSION_OK will be set TRUE
-#
-# Example: MACRO_ENSURE_VERSION_RANGE3( "0.1.0" ${FOOCODE_VERSION} "0.7.0" FOO_VERSION_OK )
-#
-# This macro will break silently if any of x,y,z are greater than 100.
-#
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# NORMALIZE_VERSION
-# Helper macro to convert version numbers of the form "x.y.z"
-# to an integer equal to 10^4 * x + 10^2 * y + z
-#
-# This macro will break silently if any of x,y,z are greater than 100.
-#
-# Copyright (c) 2006, David Faure, <faure@kde.org>
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-# CHECK_RANGE_INCLUSIVE_LOWER
-# Helper macro to check whether x <= y < z
-#
-# Copyright (c) 2007, Will Stephenson <wstephenson@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-MACRO(NORMALIZE_VERSION _requested_version _normalized_version)
- STRING(REGEX MATCH "[^0-9]*[0-9]+\\.[0-9]+\\.[0-9]+.*" _threePartMatch "${_requested_version}")
- if (_threePartMatch)
- # parse the parts of the version string
- STRING(REGEX REPLACE "[^0-9]*([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" _major_vers "${_requested_version}")
- STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" _minor_vers "${_requested_version}")
- STRING(REGEX REPLACE "[^0-9]*[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" _patch_vers "${_requested_version}")
- else (_threePartMatch)
- STRING(REGEX REPLACE "([0-9]+)\\.[0-9]+" "\\1" _major_vers "${_requested_version}")
- STRING(REGEX REPLACE "[0-9]+\\.([0-9]+)" "\\1" _minor_vers "${_requested_version}")
- set(_patch_vers "0")
- endif (_threePartMatch)
-
- # compute an overall version number which can be compared at once
- MATH(EXPR ${_normalized_version} "${_major_vers}*10000 + ${_minor_vers}*100 + ${_patch_vers}")
-ENDMACRO(NORMALIZE_VERSION)
-
-MACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER _lower_limit _value _upper_limit _ok)
- if (${_value} LESS ${_lower_limit})
- set( ${_ok} FALSE )
- elseif (${_value} EQUAL ${_lower_limit})
- set( ${_ok} TRUE )
- elseif (${_value} EQUAL ${_upper_limit})
- set( ${_ok} FALSE )
- elseif (${_value} GREATER ${_upper_limit})
- set( ${_ok} FALSE )
- else (${_value} LESS ${_lower_limit})
- set( ${_ok} TRUE )
- endif (${_value} LESS ${_lower_limit})
-ENDMACRO(MACRO_CHECK_RANGE_INCLUSIVE_LOWER)
-
-MACRO(MACRO_ENSURE_VERSION requested_version found_version var_too_old)
- NORMALIZE_VERSION( ${requested_version} req_vers_num )
- NORMALIZE_VERSION( ${found_version} found_vers_num )
-
- if (found_vers_num LESS req_vers_num)
- set( ${var_too_old} FALSE )
- else (found_vers_num LESS req_vers_num)
- set( ${var_too_old} TRUE )
- endif (found_vers_num LESS req_vers_num)
-
-ENDMACRO(MACRO_ENSURE_VERSION)
-
-MACRO(MACRO_ENSURE_VERSION2 requested_version2 found_version2 var_too_old2)
- MACRO_ENSURE_VERSION( ${requested_version2} ${found_version2} ${var_too_old2})
-ENDMACRO(MACRO_ENSURE_VERSION2)
-
-MACRO(MACRO_ENSURE_VERSION_RANGE min_version found_version max_version var_ok)
- NORMALIZE_VERSION( ${min_version} req_vers_num )
- NORMALIZE_VERSION( ${found_version} found_vers_num )
- NORMALIZE_VERSION( ${max_version} max_vers_num )
-
- MACRO_CHECK_RANGE_INCLUSIVE_LOWER( ${req_vers_num} ${found_vers_num} ${max_vers_num} ${var_ok})
-ENDMACRO(MACRO_ENSURE_VERSION_RANGE)
-
-
+++ /dev/null
-# This file defines the Feature Logging macros.
-#
-# MACRO_LOG_FEATURE(VAR FEATURE DESCRIPTION URL [REQUIRED [MIN_VERSION [COMMENTS]]])
-# Logs the information so that it can be displayed at the end
-# of the configure run
-# VAR : TRUE or FALSE, indicating whether the feature is supported
-# FEATURE: name of the feature, e.g. "libjpeg"
-# DESCRIPTION: description what this feature provides
-# URL: home page
-# REQUIRED: TRUE or FALSE, indicating whether the featue is required
-# MIN_VERSION: minimum version number. empty string if unneeded
-# COMMENTS: More info you may want to provide. empty string if unnecessary
-#
-# MACRO_DISPLAY_FEATURE_LOG()
-# Call this to display the collected results.
-# Exits CMake with a FATAL error message if a required feature is missing
-#
-# Example:
-#
-# INCLUDE(MacroLogFeature)
-#
-# FIND_PACKAGE(JPEG)
-# MACRO_LOG_FEATURE(JPEG_FOUND "libjpeg" "Support JPEG images" "http://www.ijg.org" TRUE "3.2a" "")
-# ...
-# MACRO_DISPLAY_FEATURE_LOG()
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
-# Copyright (c) 2006, Allen Winter, <winter@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-IF (NOT _macroLogFeatureAlreadyIncluded)
- SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
- IF (EXISTS ${_file})
- FILE(REMOVE ${_file})
- ENDIF (EXISTS ${_file})
-
- SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
- IF (EXISTS ${_file})
- FILE(REMOVE ${_file})
- ENDIF (EXISTS ${_file})
-
- SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
- IF (EXISTS ${_file})
- FILE(REMOVE ${_file})
- ENDIF (EXISTS ${_file})
-
- SET(_macroLogFeatureAlreadyIncluded TRUE)
-ENDIF (NOT _macroLogFeatureAlreadyIncluded)
-
-
-MACRO(MACRO_LOG_FEATURE _var _package _description _url ) # _required _minvers _comments)
-
- SET(_required "${ARGV4}")
- SET(_minvers "${ARGV5}")
- SET(_comments "${ARGV6}")
-
- IF (${_var})
- SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
- ELSE (${_var})
- IF (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
- SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
- ELSE (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
- SET(_LOGFILENAME ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
- ENDIF (${_required} MATCHES "[Tt][Rr][Uu][Ee]")
- ENDIF (${_var})
-
- SET(_logtext "+ ${_package}")
-
- IF (NOT ${_var})
- IF (${_minvers} MATCHES ".*")
- SET(_logtext "${_logtext}, ${_minvers}")
- ENDIF (${_minvers} MATCHES ".*")
- SET(_logtext "${_logtext}: ${_description} <${_url}>")
- IF (${_comments} MATCHES ".*")
- SET(_logtext "${_logtext}\n${_comments}")
- ENDIF (${_comments} MATCHES ".*")
-# SET(_logtext "${_logtext}\n") #double-space missing features?
- ENDIF (NOT ${_var})
- FILE(APPEND "${_LOGFILENAME}" "${_logtext}\n")
-
-ENDMACRO(MACRO_LOG_FEATURE)
-
-
-MACRO(MACRO_DISPLAY_FEATURE_LOG)
-
- SET(_file ${CMAKE_BINARY_DIR}/MissingRequirements.txt)
- IF (EXISTS ${_file})
- FILE(READ ${_file} _requirements)
- MESSAGE(STATUS "\n-----------------------------------------------------------------------------\n-- The following REQUIRED packages could NOT be located on your system.\n-- Please install them before continuing this software installation.\n-----------------------------------------------------------------------------\n${_requirements}-----------------------------------------------------------------------------")
- FILE(REMOVE ${_file})
- MESSAGE(FATAL_ERROR "Exiting: Missing Requirements")
- ENDIF (EXISTS ${_file})
-
- SET(_summary "\n")
-
- SET(_elist 0)
- SET(_file ${CMAKE_BINARY_DIR}/EnabledFeatures.txt)
- IF (EXISTS ${_file})
- SET(_elist 1)
- FILE(READ ${_file} _enabled)
- FILE(REMOVE ${_file})
- SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following external packages were located on your system.\n-- This installation will have the extra features provided by these packages.\n${_enabled}")
- ENDIF (EXISTS ${_file})
-
- SET(_dlist 0)
- SET(_file ${CMAKE_BINARY_DIR}/DisabledFeatures.txt)
- IF (EXISTS ${_file})
- SET(_dlist 1)
- FILE(READ ${_file} _disabled)
- FILE(REMOVE ${_file})
- SET(_summary "${_summary}-----------------------------------------------------------------------------\n-- The following OPTIONAL packages could NOT be located on your system.\n-- Consider installing them to enable more features from this software.\n${_disabled}")
- ELSE (EXISTS ${_file})
- IF (${_elist})
- SET(_summary "${_summary}Congratulations! All external packages have been found.\n")
- ENDIF (${_elist})
- ENDIF (EXISTS ${_file})
-
- IF (${_elist} OR ${_dlist})
- SET(_summary "${_summary}-----------------------------------------------------------------------------\n")
- ENDIF (${_elist} OR ${_dlist})
- MESSAGE(STATUS "${_summary}")
-
-ENDMACRO(MACRO_DISPLAY_FEATURE_LOG)
+++ /dev/null
-# - MACRO_OPTIONAL_FIND_PACKAGE() combines FIND_PACKAGE() with an OPTION()
-# MACRO_OPTIONAL_FIND_PACKAGE( <name> [QUIT] )
-# This macro is a combination of OPTION() and FIND_PACKAGE(), it
-# works like FIND_PACKAGE(), but additionally it automatically creates
-# an option name WITH_<name>, which can be disabled via the cmake GUI.
-# or via -DWITH_<name>=OFF
-# The standard <name>_FOUND variables can be used in the same way
-# as when using the normal FIND_PACKAGE()
-
-# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-
-MACRO (MACRO_OPTIONAL_FIND_PACKAGE _name )
- OPTION(WITH_${_name} "Search for ${_name} package" ON)
- if (WITH_${_name})
- FIND_PACKAGE(${_name} ${ARGN})
- else (WITH_${_name})
- set(${_name}_FOUND)
- set(${_name}_INCLUDE_DIR)
- set(${_name}_INCLUDES)
- set(${_name}_LIBRARY)
- set(${_name}_LIBRARIES)
- endif (WITH_${_name})
-ENDMACRO (MACRO_OPTIONAL_FIND_PACKAGE)
-
+++ /dev/null
-
-# Phonon helper macros:
-#
-# macro (phonon_add_executable _target)
-# macro (PHONON_ADD_UNIT_TEST _test_NAME)
-# macro (PHONON_UPDATE_ICONCACHE)
-# macro (PHONON_UPDATE_ICONCACHE)
-# macro (_PHONON_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME _l10n_SUBDIR)
-# macro (PHONON_INSTALL_ICONS _defaultpath )
-
-set(_global_add_executable_param)
-if (Q_WS_MAC)
- set(_global_add_executable_param MACOSX_BUNDLE)
-endif (Q_WS_MAC)
-if (WIN32)
- # no WIN32 here - all executables are command line executables
- set(_global_add_executable_param)
-endif (WIN32)
-
-macro(phonon_add_executable _target)
- set(_srcs ${ARGN})
- automoc4_add_executable(${_target} ${_global_add_executable_param} ${_srcs})
-endmacro(phonon_add_executable _target)
-
-macro (PHONON_ADD_UNIT_TEST _test_NAME)
- set(_srcList ${ARGN})
- set(_nogui)
- list(GET ${_srcList} 0 first_PARAM)
- set(_add_executable_param ${_global_add_executable_param})
- if(${first_PARAM} STREQUAL "NOGUI")
- set(_nogui "NOGUI")
- set(_add_executable_param)
- endif(${first_PARAM} STREQUAL "NOGUI")
-
- if (NOT PHONON_BUILD_TESTS)
- set(_add_executable_param ${_add_executable_param} EXCLUDE_FROM_ALL)
- endif (NOT PHONON_BUILD_TESTS)
-
- automoc4_add_executable(${_test_NAME} ${_add_executable_param} ${_srcList})
-
- if(NOT PHONON_TEST_OUTPUT)
- set(PHONON_TEST_OUTPUT plaintext)
- endif(NOT PHONON_TEST_OUTPUT)
- set(PHONON_TEST_OUTPUT ${PHONON_TEST_OUTPUT} CACHE STRING "The output to generate when running the QTest unit tests")
-
- set(using_qtest "")
- foreach(_filename ${_srcList})
- if(NOT using_qtest)
- if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_filename}")
- file(READ ${_filename} file_CONTENT)
- string(REGEX MATCH "QTEST_(KDE)?MAIN" using_qtest "${file_CONTENT}")
- endif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${_filename}")
- endif(NOT using_qtest)
- endforeach(_filename)
-
- set(_executable ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME})
- if (Q_WS_MAC AND NOT _nogui)
- set(_executable ${EXECUTABLE_OUTPUT_PATH}/${_test_NAME}.app/Contents/MacOS/${_test_NAME})
- else (Q_WS_MAC AND NOT _nogui)
- # Use .shell wrapper where available, to use uninstalled libs.
- #if (UNIX)
- # set(_executable ${_executable}.shell)
- #endif (UNIX)
- endif (Q_WS_MAC AND NOT _nogui)
-
- if (using_qtest AND PHONON_TEST_OUTPUT STREQUAL "xml")
- add_test( ${_test_NAME} ${_executable} -xml -o ${_test_NAME}.tml)
- else (using_qtest AND PHONON_TEST_OUTPUT STREQUAL "xml")
- add_test( ${_test_NAME} ${_executable} )
- endif (using_qtest AND PHONON_TEST_OUTPUT STREQUAL "xml")
-
- if (NOT MSVC_IDE) #not needed for the ide
- # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
- if (NOT PHONON_BUILD_TESTS)
- get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
- if(NOT _buildtestsAdded)
- add_custom_target(buildtests)
- set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
- endif(NOT _buildtestsAdded)
- add_dependencies(buildtests ${_test_NAME})
- endif (NOT PHONON_BUILD_TESTS)
- endif (NOT MSVC_IDE)
-endmacro (PHONON_ADD_UNIT_TEST)
-
-macro (PHONON_UPDATE_ICONCACHE)
- # Update mtime of hicolor icon theme dir.
- # We don't always have touch command (e.g. on Windows), so instead create
- # and delete a temporary file in the theme dir.
- install(CODE "
- set(DESTDIR_VALUE \"\$ENV{DESTDIR}\")
- if (NOT DESTDIR_VALUE)
- file(WRITE \"${ICON_INSTALL_DIR}/hicolor/temp.txt\" \"update\")
- file(REMOVE \"${ICON_INSTALL_DIR}/hicolor/temp.txt\")
- endif (NOT DESTDIR_VALUE)
- ")
-endmacro (PHONON_UPDATE_ICONCACHE)
-
-# a "map" of short type names to the directories
-# unknown names should give empty results
-# KDE 3 compatibility
-set(_PHONON_ICON_GROUP_mime "mimetypes")
-set(_PHONON_ICON_GROUP_filesys "places")
-set(_PHONON_ICON_GROUP_device "devices")
-set(_PHONON_ICON_GROUP_app "apps")
-set(_PHONON_ICON_GROUP_action "actions")
-# KDE 4 / icon naming specification compatibility
-set(_PHONON_ICON_GROUP_mimetypes "mimetypes")
-set(_PHONON_ICON_GROUP_places "places")
-set(_PHONON_ICON_GROUP_devices "devices")
-set(_PHONON_ICON_GROUP_apps "apps")
-set(_PHONON_ICON_GROUP_actions "actions")
-set(_PHONON_ICON_GROUP_categories "categories")
-set(_PHONON_ICON_GROUP_status "status")
-set(_PHONON_ICON_GROUP_emblems "emblems")
-set(_PHONON_ICON_GROUP_emotes "emotes")
-set(_PHONON_ICON_GROUP_animations "animations")
-set(_PHONON_ICON_GROUP_intl "intl")
-
-# a "map" of short theme names to the theme directory
-set(_PHONON_ICON_THEME_ox "oxygen")
-set(_PHONON_ICON_THEME_cr "crystalsvg")
-set(_PHONON_ICON_THEME_lo "locolor")
-set(_PHONON_ICON_THEME_hi "hicolor")
-
-macro (_PHONON_ADD_ICON_INSTALL_RULE _install_SCRIPT _install_PATH _group _orig_NAME _install_NAME _l10n_SUBDIR)
-
- # if the string doesn't match the pattern, the result is the full string, so all three have the same content
- if (NOT ${_group} STREQUAL ${_install_NAME} )
- set(_icon_GROUP ${_PHONON_ICON_GROUP_${_group}})
- if(NOT _icon_GROUP)
- set(_icon_GROUP "actions")
- endif(NOT _icon_GROUP)
-# message(STATUS "icon: ${_current_ICON} size: ${_size} group: ${_group} name: ${_name} l10n: ${_l10n_SUBDIR}")
- install(FILES ${_orig_NAME} DESTINATION ${_install_PATH}/${_icon_GROUP}/${_l10n_SUBDIR}/ RENAME ${_install_NAME} )
- endif (NOT ${_group} STREQUAL ${_install_NAME} )
-
-endmacro (_PHONON_ADD_ICON_INSTALL_RULE)
-
-
-macro (PHONON_INSTALL_ICONS _defaultpath )
-
- # the l10n-subdir if language given as second argument (localized icon)
- set(_lang ${ARGV1})
- if(_lang)
- set(_l10n_SUBDIR l10n/${_lang})
- else(_lang)
- set(_l10n_SUBDIR ".")
- endif(_lang)
-
- # first the png icons
- file(GLOB _icons *.png)
- foreach (_current_ICON ${_icons} )
- # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty
- string(REGEX MATCH "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.png)$" _dummy "${_current_ICON}")
- set(_type "${CMAKE_MATCH_1}")
- set(_size "${CMAKE_MATCH_2}")
- set(_group "${CMAKE_MATCH_3}")
- set(_name "${CMAKE_MATCH_4}")
-
- set(_theme_GROUP ${_PHONON_ICON_THEME_${_type}})
- if( _theme_GROUP)
- _PHONON_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
- ${_defaultpath}/${_theme_GROUP}/${_size}x${_size}
- ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR})
- endif( _theme_GROUP)
- endforeach (_current_ICON)
-
- # mng icons
- file(GLOB _icons *.mng)
- foreach (_current_ICON ${_icons} )
- # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty
- string(REGEX MATCH "^.*/([a-zA-Z]+)([0-9]+)\\-([a-z]+)\\-(.+\\.mng)$" _dummy "${_current_ICON}")
- set(_type "${CMAKE_MATCH_1}")
- set(_size "${CMAKE_MATCH_2}")
- set(_group "${CMAKE_MATCH_3}")
- set(_name "${CMAKE_MATCH_4}")
-
- set(_theme_GROUP ${_PHONON_ICON_THEME_${_type}})
- if( _theme_GROUP)
- _PHONON_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
- ${_defaultpath}/${_theme_GROUP}/${_size}x${_size}
- ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR})
- endif( _theme_GROUP)
- endforeach (_current_ICON)
-
- # and now the svg icons
- file(GLOB _icons *.svgz)
- foreach (_current_ICON ${_icons} )
- # since CMake 2.6 regex matches are stored in special variables CMAKE_MATCH_x, if it didn't match, they are empty
- string(REGEX MATCH "^.*/([a-zA-Z]+)sc\\-([a-z]+)\\-(.+\\.svgz)$" _dummy "${_current_ICON}")
- set(_type "${CMAKE_MATCH_1}")
- set(_group "${CMAKE_MATCH_2}")
- set(_name "${CMAKE_MATCH_3}")
-
- set(_theme_GROUP ${_PHONON_ICON_THEME_${_type}})
- if( _theme_GROUP)
- _PHONON_ADD_ICON_INSTALL_RULE(${CMAKE_CURRENT_BINARY_DIR}/install_icons.cmake
- ${_defaultpath}/${_theme_GROUP}/scalable
- ${_group} ${_current_ICON} ${_name} ${_l10n_SUBDIR})
- endif( _theme_GROUP)
- endforeach (_current_ICON)
-
- phonon_update_iconcache()
-
-endmacro (PHONON_INSTALL_ICONS)
-
+++ /dev/null
-.svn
-Makefile
-moc_*
-phonon_vlc_*
+++ /dev/null
-Fathi Boudra <fabo@kde.org> (current maintainer)
-Lukas Durfina <lukas.durfina@gmail.com>
-Tanguy Krotoff <tkrotoff@gmail.com>
+++ /dev/null
-project(phonon-vlc)
-include_directories(${QT_INCLUDES}
- ${VLC_INCLUDE_DIRS}
- ${CMAKE_CURRENT_SOURCE_DIR})
-
-add_definitions(-D_PHONON_BACKEND_VERSION_4_2)
-
-set(phonon_vlc_SRCS
- audiooutput.cpp
- backend.cpp
- devicemanager.cpp
- effect.cpp
- effectmanager.cpp
- mediacontroller.cpp
- mediaobject.cpp
- seekstack.cpp
- sinknode.cpp
- videowidget.cpp
- vlcloader.cpp
- vlcmediacontroller.cpp
- vlcmediaobject.cpp
- vlcvideowidget.cpp
- widgetnopaintevent.cpp)
-
-automoc4(phonon_vlc phonon_vlc_SRCS)
-add_library(phonon_vlc MODULE ${phonon_vlc_SRCS})
-
-set_target_properties(phonon_vlc PROPERTIES PREFIX "")
-target_link_libraries(phonon_vlc ${PHONON_LIBS} ${VLC_LIBRARIES})
-
-if(WIN32)
- install(TARGETS phonon_vlc DESTINATION bin/phonon_backend)
-else(WIN32)
- install(TARGETS phonon_vlc DESTINATION ${PLUGIN_INSTALL_DIR}/plugins/phonon_backend)
-endif(WIN32)
-install(FILES vlc.desktop DESTINATION ${SERVICES_INSTALL_DIR}/phononbackends)
-
-if(BUILD_TESTS)
- add_subdirectory(tests)
-endif(BUILD_TESTS)
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "audiooutput.h"
-#include "devicemanager.h"
-#include "backend.h"
-
-#include "mediaobject.h"
-#include "vlcmediaobject.h"
-
-#include "vlcloader.h"
-
-#ifdef PHONON_PULSESUPPORT
-# include <phonon/pulsesupport.h>
-#endif
-
-namespace Phonon
-{
-namespace VLC {
-
-AudioOutput::AudioOutput(Backend *p_back, QObject * p_parent)
- : SinkNode(p_parent),
- f_volume(1.0),
- i_device(0),
- p_backend(p_back)
-{
- p_media_object = 0;
-}
-
-AudioOutput::~AudioOutput()
-{
-}
-
-qreal AudioOutput::volume() const
-{
- return f_volume;
-}
-
-void AudioOutput::setVolume(qreal volume)
-{
- if (vlc_instance) {
- libvlc_audio_set_volume(vlc_instance, (int)(f_volume * 100), vlc_exception);
- vlcExceptionRaised();
- f_volume = volume;
- emit volumeChanged(f_volume);
- }
-}
-
-int AudioOutput::outputDevice() const
-{
- return i_device;
-}
-
-bool AudioOutput::setOutputDevice(int device)
-{
- if (i_device == device)
- return true;
-
-#ifdef PHONON_PULSESUPPORT
- if (PulseSupport::getInstance()->isActive()) {
- i_device = device;
- libvlc_audio_output_set(vlc_instance, "pulse");
- qDebug() << "set aout " << "pulse";
- return true;
- }
-#endif
-
- const QList<AudioDevice> deviceList = p_backend->deviceManager()->audioOutputDevices();
- if (device >= 0 && device < deviceList.size()) {
-
- i_device = device;
- const QByteArray deviceName = deviceList.at(device).vlcId;
- libvlc_audio_output_set(vlc_instance, (char *) deviceList.at(device).vlcId.data());
- qDebug() << "set aout " << deviceList.at(device).vlcId.data();
-// if (deviceName == DEFAULT_ID) {
-// libvlc_audio_device_set(p_vlc_instance, DEFAULT, vlc_exception);
-// vlcExceptionRaised();
-// } else if (deviceName.startsWith(ALSA_ID)) {
-// qDebug() << "setting ALSA " << deviceList.at(device).hwId.data();
-// libvlc_audio_device_set(p_vlc_instance, ALSA, vlc_exception);
-// vlcExceptionRaised();
-// libvlc_audio_alsa_device_set(p_vlc_instance,
-// deviceList.at(device).hwId,
-// vlc_exception);
-// vlcExceptionRaised();
- }
-
- return true;
-}
-
-#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
-bool AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice & device)
-{
- return true;
-}
-#endif
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_AUDIOOUTPUT_H
-#define PHONON_VLC_AUDIOOUTPUT_H
-
-#include "sinknode.h"
-
-#include <phonon/audiooutputinterface.h>
-
-namespace Phonon
-{
-namespace VLC {
-class Backend;
-
-class AudioOutput : public SinkNode, public AudioOutputInterface
-{
- Q_OBJECT
- Q_INTERFACES(Phonon::AudioOutputInterface)
-
-public:
-
- AudioOutput(Backend *p_back, QObject * p_parent);
- ~AudioOutput();
-
- qreal volume() const;
- void setVolume(qreal volume);
-
- int outputDevice() const;
- bool setOutputDevice(int);
-#if (PHONON_VERSION >= PHONON_VERSION_CHECK(4, 2, 0))
- bool setOutputDevice(const AudioOutputDevice & device);
-#endif
-
-signals:
-
- void volumeChanged(qreal volume);
- void audioDeviceFailed();
-
-private:
-
- qreal f_volume;
- int i_device;
- Backend *p_backend;
-
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_AUDIOOUTPUT_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "backend.h"
-
-#include "audiooutput.h"
-#include "mediaobject.h"
-#include "videowidget.h"
-#include "devicemanager.h"
-#include "effectmanager.h"
-#include "effect.h"
-#include "sinknode.h"
-#include "vlcloader.h"
-#include "vlcmediaobject.h"
-
-#ifdef PHONON_PULSESUPPORT
-# include <phonon/pulsesupport.h>
-#endif
-
-#include <QtCore/QSet>
-#include <QtCore/QVariant>
-#include <QtCore/QtPlugin>
-
-Q_EXPORT_PLUGIN2(phonon_vlc, Phonon::VLC::Backend)
-
-namespace Phonon
-{
-namespace VLC {
-
-Backend::Backend(QObject *parent, const QVariantList &)
- : QObject(parent)
- , m_deviceManager(NULL)
- , m_effectManager(NULL)
- , m_debugLevel(Debug)
-{
-#ifdef PHONON_PULSESUPPORT
- // Initialise PulseAudio support
- PulseSupport *pulse = PulseSupport::getInstance();
- pulse->enable();
- connect(pulse, SIGNAL(objectDescriptionChanged(ObjectDescriptionType)), SIGNAL(objectDescriptionChanged(ObjectDescriptionType)));
-#endif
-
- bool wasInit = vlcInit();
-
- setProperty("identifier", QLatin1String("phonon_vlc"));
- setProperty("backendName", QLatin1String("VLC"));
- setProperty("backendComment", QLatin1String("VLC plugin for Phonon"));
- setProperty("backendVersion", QLatin1String("0.1"));
- setProperty("backendWebsite", QLatin1String("http://multimedia.kde.org/"));
-
- // Check if we should enable debug output
- QString debugLevelString = qgetenv("PHONON_VLC_DEBUG");
- int debugLevel = debugLevelString.toInt();
- if (debugLevel > 3) // 3 is maximum
- debugLevel = 3;
- m_debugLevel = (DebugLevel)debugLevel;
-
- if (wasInit) {
- logMessage(QString("Using VLC version %0").arg(libvlc_get_version()));
- } else {
- qWarning("Phonon::VLC::vlcInit: Failed to initialize VLC");
- }
-
- m_deviceManager = new DeviceManager(this);
- m_effectManager = new EffectManager(this);
-}
-
-Backend::~Backend()
-{
-// vlcRelease();
-}
-
-QObject *Backend::createObject(BackendInterface::Class c, QObject *parent, const QList<QVariant> &args)
-{
- switch (c) {
- case MediaObjectClass:
- return new VLCMediaObject(parent);
- case VolumeFaderEffectClass:
-// return new VolumeFaderEffect(parent);
- logMessage("createObject() : VolumeFaderEffect not implemented");
- break;
- case AudioOutputClass: {
- AudioOutput *ao = new AudioOutput(this, parent);
- m_audioOutputs.append(ao);
- return ao;
- }
- case AudioDataOutputClass:
-// return new AudioDataOutput(parent);
- logMessage("createObject() : AudioDataOutput not implemented");
- break;
- case VisualizationClass:
-// return new Visualization(parent);
- logMessage("createObject() : Visualization not implemented");
- break;
- case VideoDataOutputClass:
-// return new VideoDataOutput(parent);
- logMessage("createObject() : VideoDataOutput not implemented");
- break;
- case EffectClass:
- return new Effect(m_effectManager, args[0].toInt(), parent);
- case VideoWidgetClass:
- return new VideoWidget(qobject_cast<QWidget *>(parent));
- default:
- logMessage("createObject() : Backend object not available");
- }
- return 0;
-}
-
-bool Backend::supportsVideo() const
-{
- return true;
-}
-
-bool Backend::supportsOSD() const
-{
- return true;
-}
-
-bool Backend::supportsFourcc(quint32 fourcc) const
-{
- return true;
-}
-
-bool Backend::supportsSubtitles() const
-{
- return true;
-}
-
-QStringList Backend::availableMimeTypes() const
-{
- if (m_supportedMimeTypes.isEmpty()) {
- const_cast<Backend *>(this)->m_supportedMimeTypes
- << QLatin1String("application/ogg")
- << QLatin1String("application/vnd.rn-realmedia")
- << QLatin1String("application/x-annodex")
- << QLatin1String("application/x-flash-video")
- << QLatin1String("application/x-quicktimeplayer")
- << QLatin1String("audio/168sv")
- << QLatin1String("audio/8svx")
- << QLatin1String("audio/aiff")
- << QLatin1String("audio/basic")
- << QLatin1String("audio/mp3")
- << QLatin1String("audio/mp4")
- << QLatin1String("audio/mpeg")
- << QLatin1String("audio/mpeg2")
- << QLatin1String("audio/mpeg3")
- << QLatin1String("audio/vnd.rn-realaudio")
- << QLatin1String("audio/wav")
- << QLatin1String("audio/x-16sv")
- << QLatin1String("audio/x-8svx")
- << QLatin1String("audio/x-aiff")
- << QLatin1String("audio/x-basic")
- << QLatin1String("audio/x-m4a")
- << QLatin1String("audio/x-mp3")
- << QLatin1String("audio/x-mpeg")
- << QLatin1String("audio/x-mpeg2")
- << QLatin1String("audio/x-mpeg3")
- << QLatin1String("audio/x-mpegurl")
- << QLatin1String("audio/x-ms-wma")
- << QLatin1String("audio/x-ogg")
- << QLatin1String("audio/x-pn-aiff")
- << QLatin1String("audio/x-pn-au")
- << QLatin1String("audio/x-pn-realaudio-plugin")
- << QLatin1String("audio/x-pn-wav")
- << QLatin1String("audio/x-pn-windows-acm")
- << QLatin1String("audio/x-real-audio")
- << QLatin1String("audio/x-realaudio")
- << QLatin1String("audio/x-speex+ogg")
- << QLatin1String("audio/x-wav")
- << QLatin1String("image/ilbm")
- << QLatin1String("image/png")
- << QLatin1String("image/x-ilbm")
- << QLatin1String("image/x-png")
- << QLatin1String("video/anim")
- << QLatin1String("video/avi")
- << QLatin1String("video/mkv")
- << QLatin1String("video/mng")
- << QLatin1String("video/mp4")
- << QLatin1String("video/mpeg")
- << QLatin1String("video/mpg")
- << QLatin1String("video/msvideo")
- << QLatin1String("video/quicktime")
- << QLatin1String("video/x-anim")
- << QLatin1String("video/x-flic")
- << QLatin1String("video/x-mng")
- << QLatin1String("video/x-mpeg")
- << QLatin1String("video/x-ms-asf")
- << QLatin1String("video/x-ms-wmv")
- << QLatin1String("video/x-msvideo")
- << QLatin1String("video/x-quicktime");
- }
- return m_supportedMimeTypes;
-}
-
-QList<int> Backend::objectDescriptionIndexes(ObjectDescriptionType type) const
-{
- QList<int> list;
-
- switch (type) {
- case Phonon::AudioOutputDeviceType: {
- QList<AudioDevice> deviceList = deviceManager()->audioOutputDevices();
- for (int dev = 0 ; dev < deviceList.size() ; ++dev)
- list.append(deviceList[dev].id);
- break;
- }
- break;
- case Phonon::EffectType: {
- QList<EffectInfo*> effectList = effectManager()->effects();
- for (int eff = 0; eff < effectList.size(); ++eff)
- list.append(eff);
- break;
- }
- break;
- default:
- break;
- }
-
- return list;
-}
-
-QHash<QByteArray, QVariant> Backend::objectDescriptionProperties(ObjectDescriptionType type, int index) const
-{
- QHash<QByteArray, QVariant> ret;
-
- switch (type) {
- case Phonon::AudioOutputDeviceType: {
- QList<AudioDevice> audioDevices = deviceManager()->audioOutputDevices();
- if (index >= 0 && index < audioDevices.size()) {
- ret.insert("name", audioDevices[index].vlcId);
- ret.insert("description", audioDevices[index].description);
- ret.insert("icon", QLatin1String("audio-card"));
- }
- }
- break;
- case Phonon::EffectType: {
- QList<EffectInfo*> effectList = effectManager()->effects();
- if (index >= 0 && index <= effectList.size()) {
- const EffectInfo *effect = effectList[ index ];
- ret.insert("name", effect->name());
- ret.insert("description", effect->description());
- ret.insert("author", effect->author());
- } else {
- Q_ASSERT(1); // Since we use list position as ID, this should not happen
- }
- }
- break;
- default:
- break;
- }
-
- return ret;
-}
-
-bool Backend::startConnectionChange(QSet<QObject *> objects)
-{
- foreach(QObject *object, objects) {
- logMessage(QString("Object: %0").arg(object->metaObject()->className()));
- }
-
- // There is nothing we can do but hope the connection changes will not take too long
- // so that buffers would underrun
- // But we should be pretty safe the way xine works by not doing anything here.
- return true;
-}
-
-bool Backend::connectNodes(QObject *source, QObject *sink)
-{
- logMessage(QString("Backend connected %0 to %1")
- .arg(source->metaObject()->className())
- .arg(sink->metaObject()->className()));
-
- // Example:
- // source = Phonon::VLC_MPlayer::MediaObject
- // sink = Phonon::VLC_MPlayer::VideoWidget
-
- // Example:
- // source = Phonon::VLC_MPlayer::MediaObject
- // sink = Phonon::VLC_MPlayer::AudioOutput
-
- // Example:
- // source = Phonon::VLC_MPlayer::MediaObject
- // sink = Phonon::VLC_MPlayer::Effect
-
- // Example:
- // source = Phonon::VLC_MPlayer::Effect
- // sink = Phonon::VLC_MPlayer::AudioOutput
-
- SinkNode *sinkNode = qobject_cast<SinkNode *>(sink);
- if (sinkNode) {
- PrivateMediaObject *mediaObject = qobject_cast<PrivateMediaObject *>(source);
- if (mediaObject) {
- // Connect the SinkNode to a MediaObject
- sinkNode->connectToMediaObject(mediaObject);
- return true;
- } else {
- // FIXME try to find a better way...
-// Effect *effect = qobject_cast<Effect *>(source);
- return true;
- }
- }
-
- logMessage(QString("Linking %0 to %1 failed")
- .arg(source->metaObject()->className())
- .arg(sink->metaObject()->className()),
- Warning);
-
- return false;
-}
-
-bool Backend::disconnectNodes(QObject *source, QObject *sink)
-{
- SinkNode *sinkNode = qobject_cast<SinkNode *>(sink);
- if (sinkNode) {
- PrivateMediaObject *mediaObject = qobject_cast<PrivateMediaObject *>(source);
- if (mediaObject) {
- // Disconnect the SinkNode from a MediaObject
- sinkNode->disconnectFromMediaObject(mediaObject);
- return true;
- } else {
- // FIXME try to find a better way...
-// Effect *effect = qobject_cast<Effect *>(source);
- return true;
- }
- }
-
- return false;
-}
-
-bool Backend::endConnectionChange(QSet<QObject *> objects)
-{
- foreach(QObject *object, objects) {
- logMessage(QString("Object: %0").arg(object->metaObject()->className()));
- }
-
- return true;
-}
-
-DeviceManager* Backend::deviceManager() const
-{
- return m_deviceManager;
-}
-
-EffectManager* Backend::effectManager() const
-{
- return m_effectManager;
-}
-
-/**
- * Return a debuglevel that is determined by the
- * PHONON_VLC_DEBUG environment variable.
- *
- * Warning - important warnings
- * Info - general info
- * Debug - gives extra info
- */
-Backend::DebugLevel Backend::debugLevel() const
-{
- return m_debugLevel;
-}
-
-/**
- * Print a conditional debug message based on the current debug level
- * If obj is provided, classname and objectname will be printed as well
- *
- * see debugLevel()
- */
-void Backend::logMessage(const QString &message, int priority, QObject *obj) const
-{
- if (debugLevel() > 0) {
- QString output;
- if (obj) {
- // Strip away namespace from className
- QString className(obj->metaObject()->className());
- int nameLength = className.length() - className.lastIndexOf(':') - 1;
- className = className.right(nameLength);
- output.sprintf("%s %s (%s %p)", message.toLatin1().constData(),
- obj->objectName().toLatin1().constData(),
- className.toLatin1().constData(), obj);
- } else {
- output = message;
- }
- if (priority <= (int)debugLevel()) {
- qDebug() << QString("PVLC(%1): %2").arg(priority).arg(output);
- }
- }
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef Phonon_VLC_BACKEND_H
-#define Phonon_VLC_BACKEND_H
-
-#include "devicemanager.h"
-#include "audiooutput.h"
-
-#include <phonon/objectdescription.h>
-#include <phonon/backendinterface.h>
-
-#include <QtCore/QList>
-#include <QtCore/QPointer>
-#include <QtCore/QStringList>
-
-namespace Phonon
-{
-namespace VLC {
-class AudioOutput;
-class EffectManager;
-
-class Backend : public QObject, public BackendInterface
-{
- Q_OBJECT
- Q_INTERFACES(Phonon::BackendInterface)
-
-public:
-
- enum DebugLevel {NoDebug, Warning, Info, Debug};
- Backend(QObject *parent = 0, const QVariantList & = QVariantList());
- virtual ~Backend();
-
- DeviceManager* deviceManager() const;
- EffectManager* effectManager() const;
-
- QObject *createObject(BackendInterface::Class, QObject *parent, const QList<QVariant> &args);
-
- bool supportsVideo() const;
- bool supportsOSD() const;
- bool supportsFourcc(quint32 fourcc) const;
- bool supportsSubtitles() const;
- QStringList availableMimeTypes() const;
-
- QList<int> objectDescriptionIndexes(ObjectDescriptionType type) const;
- QHash<QByteArray, QVariant> objectDescriptionProperties(ObjectDescriptionType type, int index) const;
-
- bool startConnectionChange(QSet<QObject *>);
- bool connectNodes(QObject *, QObject *);
- bool disconnectNodes(QObject *, QObject *);
- bool endConnectionChange(QSet<QObject *>);
-
- DebugLevel debugLevel() const;
-
- void logMessage(const QString &message, int priority = 2, QObject *obj = 0) const;
-
-Q_SIGNALS:
- void objectDescriptionChanged(ObjectDescriptionType);
-
-private:
- mutable QStringList m_supportedMimeTypes;
- QList<QPointer<AudioOutput> > m_audioOutputs;
-
- DeviceManager *m_deviceManager;
- EffectManager *m_effectManager;
- DebugLevel m_debugLevel;
-};
-
-}
-} // namespace Phonon::VLC
-
-#endif // Phonon_VLC_BACKEND_H
+++ /dev/null
-/* This file is part of the KDE project.
-
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-
- This library is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 2.1 or 3 of the License.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#include "devicemanager.h"
-#include "backend.h"
-//#include "videowidget.h"
-//#include "widgetrenderer.h"
-#include "vlcloader.h"
-
-#ifdef PHONON_PULSESUPPORT
-# include <phonon/pulsesupport.h>
-#endif
-
-/**
- * This class manages the list of currently active output devices.
- */
-
-QT_BEGIN_NAMESPACE
-
-namespace Phonon
-{
-namespace VLC {
-
-AudioDevice::AudioDevice(DeviceManager *manager, const QByteArray &deviceId, const QByteArray &hw_id)
-{
- // Get an id
- static int counter = 0;
- id = counter++;
- // Get name from device
- if (vlcId == "default") {
- description = "Default audio device";
- } else {
- vlcId = deviceId;
- description = "";
- }
- hwId = hw_id;
-}
-
-DeviceManager::DeviceManager(Backend *parent)
- : QObject(parent)
- , m_backend(parent)
-{
- updateDeviceList();
-}
-
-DeviceManager::~DeviceManager()
-{
- m_audioDeviceList.clear();
-}
-
-bool DeviceManager::canOpenDevice() const
-{
- return true;
-}
-
-/**
- * Return a positive device id or -1 if device does not exist.
- */
-int DeviceManager::deviceId(const QByteArray &nameId) const
-{
- for (int i = 0 ; i < m_audioDeviceList.size() ; ++i) {
- if (m_audioDeviceList[i].vlcId == nameId)
- return m_audioDeviceList[i].id;
- }
- return -1;
-}
-
-/**
- * Get a human-readable description from a device id.
- */
-QByteArray DeviceManager::deviceDescription(int i_id) const
-{
- for (int i = 0 ; i < m_audioDeviceList.size() ; ++i) {
- if (m_audioDeviceList[i].id == i_id)
- return m_audioDeviceList[i].description;
- }
- return QByteArray();
-}
-
-/**
- * Update the current list of active devices.
- */
-void DeviceManager::updateDeviceList()
-{
- QList<QByteArray> list, list_hw;
- list.append("default");
- list_hw.append("");
-
- // Get the list of available audio outputs
- libvlc_audio_output_t *p_ao_list = libvlc_audio_output_list_get(
- vlc_instance, vlc_exception);
- vlcExceptionRaised();
- libvlc_audio_output_t *p_start = p_ao_list;
-
- bool checkpulse = false;
-#ifdef PHONON_PULSESUPPORT
- PulseSupport *pulse = PulseSupport::getInstance();
- checkpulse = pulse->isActive();
-#endif
- bool haspulse = false;
- while (p_ao_list) {
- if (checkpulse && 0 == strcmp(p_ao_list->psz_name, "pulse")) {
- haspulse = true;
- break;
- }
- list.append(p_ao_list->psz_name);
- list_hw.append("");
- p_ao_list = p_ao_list->p_next;
- }
- libvlc_audio_output_list_release(p_start);
-
-
-#ifdef PHONON_PULSESUPPORT
- if (haspulse)
- return;
- pulse->enable(false);
-#endif
-
- for (int i = 0 ; i < list.size() ; ++i) {
- QByteArray nameId = list.at(i);
- QByteArray hwId = list_hw.at(i);
- if (deviceId(nameId) == -1) {
- // This is a new device, add it
- qDebug() << "add aout " << nameId.data();
- m_audioDeviceList.append(AudioDevice(this, nameId, hwId));
- emit deviceAdded(deviceId(nameId));
- }
- }
- if (list.size() < m_audioDeviceList.size()) {
- // A device was removed
- for (int i = m_audioDeviceList.size() - 1 ; i >= 0 ; --i) {
- QByteArray currId = m_audioDeviceList[i].vlcId;
- bool b_found = false;
- for (int k = list.size() - 1 ; k >= 0 ; --k) {
- if (currId == list[k]) {
- b_found = true;
- break;
- }
- }
- if (!b_found) {
- emit deviceRemoved(deviceId(currId));
- m_audioDeviceList.removeAt(i);
- }
- }
- }
-}
-
-/**
- * Return a list of hardware id.
- */
-const QList<AudioDevice> DeviceManager::audioOutputDevices() const
-{
- return m_audioDeviceList;
-}
-
-}
-}
-
-QT_END_NAMESPACE
+++ /dev/null
-/* This file is part of the KDE project.
-
- Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
-
- This library is free software: you can redistribute it and/or modify
- it under the terms of the GNU Lesser General Public License as published by
- the Free Software Foundation, either version 2.1 or 3 of the License.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public License
- along with this library. If not, see <http://www.gnu.org/licenses/>.
-*/
-
-#ifndef Phonon_VLC_DEVICEMANAGER_H
-#define Phonon_VLC_DEVICEMANAGER_H
-
-#include <phonon/audiooutputinterface.h>
-
-#include <QtCore/QObject>
-
-QT_BEGIN_NAMESPACE
-
-namespace Phonon
-{
-namespace VLC {
-
-class Backend;
-class DeviceManager;
-class AbstractRenderer;
-class VideoWidget;
-
-class AudioDevice
-{
-public :
- AudioDevice(DeviceManager *s, const QByteArray &deviceId, const QByteArray &hw_id = "");
- int id;
- QByteArray vlcId;
- QByteArray description;
- QByteArray hwId;
-};
-
-class DeviceManager : public QObject
-{
- Q_OBJECT
-
-public:
- DeviceManager(Backend *parent);
- virtual ~DeviceManager();
- const QList<AudioDevice> audioOutputDevices() const;
- int deviceId(const QByteArray &vlcId) const;
- QByteArray deviceDescription(int id) const;
-
-signals:
- void deviceAdded(int);
- void deviceRemoved(int);
-
-public slots:
- void updateDeviceList();
-
-private:
- bool canOpenDevice() const;
- Backend *m_backend;
- QList <AudioDevice> m_audioDeviceList;
-};
-}
-} // namespace Phonon::VLC
-
-QT_END_NAMESPACE
-
-#endif // Phonon_VLC_DEVICEMANAGER_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "effect.h"
-
-#include "effectmanager.h"
-
-#include "mediaobject.h"
-
-namespace Phonon
-{
-namespace VLC {
-
-Effect::Effect(EffectManager *p_em, int i_effectId, QObject *p_parent)
- : SinkNode(p_parent)
-{
- p_effectManager = p_em;
- QList<EffectInfo *> effects = p_effectManager->effects();
-
- if (i_effectId >= 0 && i_effectId < effects.size()) {
- i_effect_filter = effects[ i_effectId ]->filter();
- effect_type = effects[ i_effectId ]->type();
- setupEffectParams();
- } else {
- // effect ID out of range
- Q_ASSERT(0);
- }
-}
-
-Effect::~Effect()
-{
- parameterList.clear();
-}
-
-void Effect::connectToMediaObject(PrivateMediaObject *p_media_object)
-{
- SinkNode::connectToMediaObject(p_media_object);
-
- switch (effect_type) {
- case EffectInfo::AudioEffect:
-// libvlc_audio_filter_add(p_vlc_instance, (libvlc_audio_filter_names_t)i_effect_filter, vlc_exception);
-// vlcExceptionRaised();
- break;
- case EffectInfo::VideoEffect:
-// libvlc_video_filter_add(p_vlc_current_media_player, (libvlc_video_filter_names_t)i_effect_filter, vlc_exception);
-// vlcExceptionRaised();
- break;
- }
-}
-
-void Effect::disconnectFromMediaObject(PrivateMediaObject *p_media_object)
-{
- SinkNode::disconnectFromMediaObject(p_media_object);
-
- switch (effect_type) {
- case EffectInfo::AudioEffect:
-// libvlc_audio_filter_remove(p_vlc_instance, (libvlc_audio_filter_names_t)i_effect_filter, vlc_exception);
-// vlcExceptionRaised();
- break;
- case EffectInfo::VideoEffect:
-// libvlc_video_filter_remove(p_vlc_current_media_player, (libvlc_video_filter_names_t)i_effect_filter, vlc_exception);
-// vlcExceptionRaised();
- break;
- }
-}
-
-void Effect::setupEffectParams()
-{
-// libvlc_filter_parameter_list_t *p_list;
- switch (effect_type) {
- case EffectInfo::AudioEffect:
-// p_list = libvlc_audio_filter_get_parameters(p_vlc_instance, (libvlc_audio_filter_names_t)i_effect_filter, vlc_exception );
-// vlcExceptionRaised();
- break;
- case EffectInfo::VideoEffect:
-// p_list = libvlc_video_filter_get_parameters(p_vlc_instance, (libvlc_video_filter_names_t)i_effect_filter, vlc_exception );
-// vlcExceptionRaised();
- break;
- }
-// if( !p_list )
-// return;
-
- int i_index = 0;
-// libvlc_filter_parameter_list_t *p_parameter_list = p_list;
-// while (p_parameter_list) {
-// switch (p_parameter_list->var_type) {
-// case LIBVLC_BOOL: {
-// const QString description = p_parameter_list->psz_description;
-// parameterList.append(Phonon::EffectParameter(
-// i_index,
-// QString(p_parameter_list->psz_parameter_name),
-// Phonon::EffectParameter::ToggledHint, // hints
-// QVariant((bool) p_parameter_list->default_value.b_bool),
-// QVariant((bool) false),
-// QVariant((bool) true),
-// QVariantList(),
-// description));
-// break;
-// }
-// case LIBVLC_INT: {
-// const QString description = p_parameter_list->psz_description;
-// parameterList.append(Phonon::EffectParameter(
-// i_index,
-// QString(p_parameter_list->psz_parameter_name),
-// EffectParameter::IntegerHint, // hints
-// QVariant((int) p_parameter_list->default_value.i_int),
-// QVariant((int) p_parameter_list->min_value.i_int),
-// QVariant((int) p_parameter_list->max_value.i_int),
-// QVariantList(),
-// description));
-// break;
-// }
-// case LIBVLC_FLOAT: {
-// const QString description = p_parameter_list->psz_description;
-// parameterList.append(Phonon::EffectParameter(
-// i_index,
-// QString(p_parameter_list->psz_parameter_name),
-// 0, // hints
-// QVariant((double) p_parameter_list->default_value.f_float),
-// QVariant((double) p_parameter_list->min_value.f_float),
-// QVariant((double) p_parameter_list->max_value.f_float),
-// QVariantList(),
-// description));
-// break;
-// }
-// case LIBVLC_STRING: {
-// const QString description = p_parameter_list->psz_description;
-// parameterList.append(Phonon::EffectParameter(
-// i_index,
-// QString(p_parameter_list->psz_parameter_name),
-// 0, // hints
-// QVariant((const char *) p_parameter_list->default_value.psz_string),
-// NULL,
-// NULL,
-// QVariantList(),
-// description));
-// break;
-// }
-// }
-// i_index++;
-// p_parameter_list = p_parameter_list->p_next;
-// }
-// libvlc_filter_parameters_release(p_list);
-}
-
-QList<EffectParameter> Effect::parameters() const
-{
- return parameterList;
-}
-
-QVariant Effect::parameterValue(const EffectParameter & param) const
-{
- return QVariant();
-}
-
-void Effect::setParameterValue(const EffectParameter & param, const QVariant & newValue)
-{
-// libvlc_value_t value;
-// libvlc_var_type_t type;
-// switch (param.type()) {
-// case QVariant::Bool:
-// value.b_bool = newValue.toBool();
-// type = LIBVLC_BOOL;
-// break;
-// case QVariant::Int:
-// value.i_int = newValue.toInt();
-// type = LIBVLC_INT;
-// break;
-// case QVariant::Double:
-// value.f_float = (float) newValue.toDouble();
-// type = LIBVLC_FLOAT;
-// break;
-// case QVariant::String:
-// value.psz_string = newValue.toString().toAscii().data();
-// type = LIBVLC_STRING;
-// break;
-// default:
-// break;
-// }
-// switch (effect_type) {
-// case EffectInfo::AudioEffect:
-// libvlc_audio_filter_set_parameter(
-// p_vlc_instance,
-// // (libvlc_audio_filter_names_t) i_effect_filter,
-// param.name().toAscii().data(),
-// type,
-// value,
-// vlc_exception);
-// vlcExceptionRaised();
-// break;
-// case EffectInfo::VideoEffect:
-// libvlc_video_filter_set_parameter(
-// p_vlc_current_media_player,
-// (libvlc_video_filter_names_t) i_effect_filter,
-// param.name().toAscii().data(),
-// type,
-// value,
-// vlc_exception);
-// vlcExceptionRaised();
-// break;
-// }
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_EFFECT_H
-#define PHONON_VLC_EFFECT_H
-
-#include "sinknode.h"
-#include "effectmanager.h"
-
-#include <phonon/effectinterface.h>
-#include <phonon/effectparameter.h>
-
-namespace Phonon
-{
-namespace VLC {
-
-class EffectManager;
-
-
-class Effect : public SinkNode, public EffectInterface
-{
- Q_OBJECT
- Q_INTERFACES(Phonon::EffectInterface)
-
-public:
-
- Effect(EffectManager *p_em, int i_effectId, QObject *p_parent);
- ~Effect();
-
- void setupEffectParams();
- QList<EffectParameter> parameters() const;
- QVariant parameterValue(const EffectParameter & param) const;
- void setParameterValue(const EffectParameter & param, const QVariant & newValue);
-
- void connectToMediaObject(PrivateMediaObject *p_media_object);
- void disconnectFromMediaObject(PrivateMediaObject *p_media_object);
-
-private:
-
- EffectManager *p_effectManager;
- int i_effect_filter;
- EffectInfo::Type effect_type;
- QList<Phonon::EffectParameter> parameterList;
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_EFFECT_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "effectmanager.h"
-#include "backend.h"
-
-namespace Phonon
-{
-namespace VLC {
-
-EffectInfo::EffectInfo(const QString &name, const QString &description, const QString &author, int filter, Type type)
- : m_name(name)
- , m_description(description)
- , m_author(author)
- , m_filter(filter)
- , m_type(type) {}
-
-EffectManager::EffectManager(Backend *backend)
- : QObject(backend)
- , m_backend(backend)
-{
-// m_equalizerEnabled = false;
-
- // Audio effects - equalizer
- // Only one of them can be used => last set
- // It is clever used with combobox
-
-// audioEffectList.append(new EffectInfo("(Audio) Equalizer", EQUALIZER, EffectInfo::AudioEffect));
-
-// audioEffectList.append(new EffectInfo("(Audio) Headphone spalization",
-// HEADPHONE_SPALIZATION, EffectInfo::AudioEffect,
-// "This effect gives you the feeling that you are standing in a room "
-// "with a complete 7.1 speaker set when using only a headphone, "
-// "providing a more realistic sound experience. It should also be "
-// "more comfortable and less tiring when listening to music for "
-// "long periods of time.\nIt works with any source format from mono "
-// "to 7.1."));
-
-// audioEffectList.append(new EffectInfo("(Audio) Parametric equalizer",
-// PARAMETRIC_EQUALIZER, EffectInfo::AudioEffect));
-
-// audioEffectList.append(new EffectInfo("(Audio) Scaletempo",
-// SCALETEMPO, EffectInfo::AudioEffect,
-// "Scale audio tempo in sync with playback rate"));
-
-// audioEffectList.append(new EffectInfo("(Audio) Spatializer",
-// SPATIALIZER, EffectInfo::AudioEffect));
-
-// audioEffectList.append(new EffectInfo("(Audio) Volume normalizer",
-// VOLUME_NORMALIZER, EffectInfo::AudioEffect));
-
-// audioEffectList.append(new EffectInfo("(Audio) Flat", FLAT, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Classical", CLASSICAL, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Club", CLUB, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Dance", DANCE, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Fullbass", FULLBASS, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Fullbasstreble", FULLBASSTREBLE, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Fulltreble", FULLTREBLE, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Headphones", HEADPHONES, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Large hall", LARGEHALL, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Live", LIVE, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Party", PARTY, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Pop", POP, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Reggae", REGGAE, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Rock", ROCK, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Ska", SKA, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Soft", SOFT, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Softrock", SOFTROCK, EffectInfo::AudioEffect));
-// audioEffectList.append(new EffectInfo("(Audio) Techno", TECHNO, EffectInfo::AudioEffect));
-
- // Video effects
- // More than one can be used simultaneously
- // It is clever used with checkbox
-
-// videoEffectList.append(new EffectInfo("(Video) Atmo light", ATMOLIGHT, EffectInfo::VideoEffect,
-// "AtmoLight Filter - "
-// "This module allows to control an so called AtmoLight device "
-// "connected to your computer.\n"
-// "AtmoLight is the homegrown version of what Philips calls AmbiLight.\n"
-// "If you need further information feel free to visit us at\n\n"
-// "http://www.vdr-wiki.de/wiki/index.php/Atmo-plugin\n "
-// "http://www.vdr-wiki.de/wiki/index.php/AtmoWin\n\n"
-// "You can find there detailed descriptions on how to build it for yourself "
-// "and where to get the required parts.\n"
-// "You can also have a look at pictures and some movies showing such a device "
-// "in live action.",
-// "André Weber (WeberAndre@gmx.de)"));
-
-// videoEffectList.append(new EffectInfo("(Video) Bluescreen", BLUESCREEN, EffectInfo::VideoEffect,
-// "Bluescreen video filter", "Antoine Cellerier <dionoea at videolan tod org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Color threshold", COLORTHRESHOLD, EffectInfo::VideoEffect,
-// "Color threshold filter", "Sigmund Augdal <dnumgis@videolan.org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Deinterlace", DEINTERLACE, EffectInfo::VideoEffect,
-// "Deinterlacing video filter", "Sam Hocevar <sam@zoy.org"));
-
-// videoEffectList.append(new EffectInfo("(Video) Erase", ERASE, EffectInfo::VideoEffect,
-// "Erase video filter", "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Extract", EXTRACT, EffectInfo::VideoEffect,
-// "Extract RGB component video filter",
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Gaussian blur", GAUSSIAN_BLUR, EffectInfo::VideoEffect,
-// "Erase video filter", "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Gradient", GRADIENT, EffectInfo::VideoEffect,
-// "Gradient video filter",
-// "Samuel Hocevar <sam@zoy.org>, "
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Grain", GRAIN, EffectInfo::VideoEffect,
-// "Grain video filter", "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Invert", INVERT, EffectInfo::VideoEffect,
-// "Invert video filter - color inversion",
-// "Samuel Hocevar <sam@zoy.org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Motion blur", MOTIONBLUR, EffectInfo::VideoEffect,
-// "Motion blur filter",
-// "Sigmund Augdal Helberg <dnumgis@videolan.org>, "
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Motion detect", MOTIONDETECT, EffectInfo::VideoEffect,
-// "Motion detect video filter",
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Noise", NOISE, EffectInfo::VideoEffect,
-// "Noise video filter - add noise to image",
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Postprocess", POSTPROCESS, EffectInfo::VideoEffect,
-// "Video post processing filter",
-// "Laurent Aimar <fenrir@via.ecp.fr>, "
-// "Gildas Bazin <gbazin@netcourrier.com>, "
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Psychedelic", PSYCHEDELIC, EffectInfo::VideoEffect,
-// "Psychedelic video filter",
-// "Samuel Hocevar <sam@zoy.org>, "
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Ripple", RIPPLE, EffectInfo::VideoEffect,
-// "Ripple video filter",
-// "Samuel Hocevar <sam@zoy.org>, "
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Rotate", ROTATE, EffectInfo::VideoEffect,
-// "Rotate video filter",
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Seam carving", SEAM_CARVING, EffectInfo::VideoEffect,
-// "Seam Carving for Content-Aware Image Resizing",
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Sharpen", SHARPEN, EffectInfo::VideoEffect,
-// "Sharpen video filter - Augment contrast between contours.",
-// "Jérémy DEMEULE <dj_mulder at djduron dot no-ip dot org>, "
-// "Jean-Baptiste Kempf <jb at videolan dot org>"));
-
-// videoEffectList.append(new EffectInfo("(Video) Wave", WAVE, EffectInfo::VideoEffect,
-// "Wave video filter",
-// "Samuel Hocevar <sam@zoy.org>, "
-// "Antoine Cellerier <dionoea at videolan dot org>"));
-
- updateEffects();
-}
-
-EffectManager::~EffectManager()
-{
- qDeleteAll(m_audioEffectList);
- m_audioEffectList.clear();
- qDeleteAll(m_videoEffectList);
- m_videoEffectList.clear();
- qDeleteAll(m_effectList);
- m_effectList.clear();
-}
-
-/**
- * Returns a list of available audio effects
- */
-const QList<EffectInfo *> EffectManager::audioEffects() const
-{
- return m_audioEffectList;
-}
-
-/**
- * Returns a list of available video effects
- */
-const QList<EffectInfo *> EffectManager::videoEffects() const
-{
- return m_videoEffectList;
-}
-
-/**
- * Returns a list of available effects
- */
-const QList<EffectInfo *> EffectManager::effects() const
-{
- return m_effectList;
-}
-
-void EffectManager::updateEffects()
-{
- m_effectList.clear();
- m_effectList += m_audioEffectList;
- m_effectList += m_videoEffectList;
-}
-
-}
-} // namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef Phonon_VLC_EFFECTMANAGER_H
-#define Phonon_VLC_EFFECTMANAGER_H
-
-#include <phonon/effectinterface.h>
-#include <phonon/effectparameter.h>
-
-#include <QtCore/QObject>
-
-namespace Phonon
-{
-namespace VLC {
-class Backend;
-class EffectManager;
-
-class EffectInfo
-{
-public:
-
- enum Type {AudioEffect, VideoEffect};
-
- EffectInfo(const QString &name,
- const QString &description,
- const QString &author,
- int filter,
- Type type);
-
- QString name() const {
- return m_name;
- }
-
- QString description() const {
- return m_description;
- }
-
- QString author() const {
- return m_author;
- }
-
- int filter() const {
- return m_filter;
- }
-
- Type type() const {
- return m_type;
- }
-
-private:
- QString m_name;
- QString m_description;
- QString m_author;
- int m_filter;
- Type m_type;
-};
-
-class EffectManager : public QObject
-{
- Q_OBJECT
-
-public:
- EffectManager(Backend *parent);
- virtual ~EffectManager();
-
- const QList<EffectInfo *> audioEffects() const;
- const QList<EffectInfo *> videoEffects() const;
- const QList<EffectInfo *> effects() const;
-
-private:
- void updateEffects();
-
- Backend *m_backend;
- QList<EffectInfo *> m_effectList;
- QList<EffectInfo *> m_audioEffectList;
- QList<EffectInfo *> m_videoEffectList;
- bool m_equalizerEnabled;
-};
-
-}
-} // namespace Phonon::VLC
-
-#endif // Phonon_VLC_EFFECTMANAGER_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "mediacontroller.h"
-
-namespace Phonon
-{
-namespace VLC {
-
-MediaController::MediaController()
-{
- clearMediaController();
-}
-
-MediaController::~MediaController()
-{
-}
-
-void MediaController::clearMediaController()
-{
- current_audio_channel = Phonon::AudioChannelDescription();
- available_audio_channels.clear();
-
- current_subtitle = Phonon::SubtitleDescription();
- available_subtitles.clear();
-
-// current_chapter = Phonon::ChapterDescription();
-// available_chapters.clear();
- current_chapter = 0;
- available_chapters = 0;
-
-// current_title = Phonon::TitleDescription();
-// available_titles.clear();
- current_title = 0;
- available_titles = 0;
-
- i_current_angle = 0;
- i_available_angles = 0;
-
- b_autoplay_titles = false;
-}
-
-bool MediaController::hasInterface(Interface iface) const
-{
- switch (iface) {
- case AddonInterface::NavigationInterface:
- return true;
- break;
- case AddonInterface::ChapterInterface:
- return true;
- break;
- case AddonInterface::AngleInterface:
- return true;
- break;
- case AddonInterface::TitleInterface:
- return true;
- break;
- case AddonInterface::SubtitleInterface:
- return true;
- break;
- case AddonInterface::AudioChannelInterface:
- return true;
- break;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::Interface"
- << iface;
- }
-
- return false;
-}
-
-QVariant MediaController::interfaceCall(Interface iface, int i_command, const QList<QVariant> & arguments)
-{
- switch (iface) {
- case AddonInterface::ChapterInterface:
- switch (static_cast<AddonInterface::ChapterCommand>(i_command)) {
-// case AddonInterface::availableChapters:
-// return QVariant::fromValue(availableChapters());
- case AddonInterface::availableChapters:
- return availableChapters();
-// case AddonInterface::currentChapter:
-// return QVariant::fromValue(currentChapter());
- case AddonInterface::chapter:
- return currentChapter();
-// case AddonInterface::setCurrentChapter:
-// if( arguments.isEmpty() || !arguments.first().canConvert<ChapterDescription>()) {
-// qCritical() << __FUNCTION__ << "Error: arguments invalid";
-// return false;
-// }
-// setCurrentChapter(arguments.first().value<ChapterDescription>());
-// return true;
- case AddonInterface::setChapter:
- if (arguments.isEmpty() || !arguments.first().canConvert(QVariant::Int)) {
- qCritical() << __FUNCTION__ << "Error: arguments invalid";
- return false;
- }
- setCurrentChapter(arguments.first().toInt());
- return true;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::ChapterInterface command:"
- << i_command;
- }
- break;
- case AddonInterface::TitleInterface:
- switch (static_cast<AddonInterface::TitleCommand>(i_command)) {
-// case AddonInterface::availableTitles:
-// return QVariant::fromValue(availableTitles());
- case AddonInterface::availableTitles:
- return availableTitles();
-// case AddonInterface::currentTitle:
-// return QVariant::fromValue(currentTitle());
- case AddonInterface::title:
- return currentTitle();
-// case AddonInterface::setCurrentTitle:
-// if( arguments.isEmpty() || !arguments.first().canConvert<TitleDescription>()) {
-// qCritical() << __FUNCTION__ << "Error: arguments invalid";
-// return false;
-// }
-// setCurrentTitle(arguments.first().value<TitleDescription>());
-// return true;
- case AddonInterface::setTitle:
- if (arguments.isEmpty() || !arguments.first().canConvert(QVariant::Int)) {
- qCritical() << __FUNCTION__ << "Error: arguments invalid";
- return false;
- }
- setCurrentTitle(arguments.first().toInt());
- return true;
- case AddonInterface::autoplayTitles:
- return autoplayTitles();
- case AddonInterface::setAutoplayTitles:
- if (arguments.isEmpty() || !arguments.first().canConvert(QVariant::Bool)) {
- qCritical() << __FUNCTION__ << "Error: arguments invalid";
- return false;
- }
- setAutoplayTitles(arguments.first().toBool());
- return true;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::TitleInterface command:"
- << i_command;
- }
- break;
- case AddonInterface::AngleInterface:
- switch (static_cast<AddonInterface::AngleCommand>(i_command)) {
- case AddonInterface::availableAngles:
- case AddonInterface::angle:
- case AddonInterface::setAngle:
- break;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::AngleInterface command:"
- << i_command;
- }
- break;
- case AddonInterface::SubtitleInterface:
- switch (static_cast<AddonInterface::SubtitleCommand>(i_command)) {
- case AddonInterface::availableSubtitles:
- return QVariant::fromValue(availableSubtitles());
- case AddonInterface::currentSubtitle:
- return QVariant::fromValue(currentSubtitle());
- case AddonInterface::setCurrentSubtitle:
- if (arguments.isEmpty() || !arguments.first().canConvert<SubtitleDescription>()) {
- qCritical() << __FUNCTION__ << "Error: arguments invalid";
- return false;
- }
- setCurrentSubtitle(arguments.first().value<SubtitleDescription>());
- return true;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::SubtitleInterface command:"
- << i_command;
- }
- break;
- case AddonInterface::AudioChannelInterface:
- switch (static_cast<AddonInterface::AudioChannelCommand>(i_command)) {
- case AddonInterface::availableAudioChannels:
- return QVariant::fromValue(availableAudioChannels());
- case AddonInterface::currentAudioChannel:
- return QVariant::fromValue(currentAudioChannel());
- case AddonInterface::setCurrentAudioChannel:
- if (arguments.isEmpty() || !arguments.first().canConvert<AudioChannelDescription>()) {
- qCritical() << __FUNCTION__ << "Error: arguments invalid";
- return false;
- }
- setCurrentAudioChannel(arguments.first().value<AudioChannelDescription>());
- return true;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::AudioChannelInterface command:"
- << i_command;
- }
- break;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported AddonInterface::Interface:"
- << iface;
- }
-
- return QVariant();
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_MEDIACONTROLLER_H
-#define PHONON_VLC_MEDIACONTROLLER_H
-
-#include <phonon/addoninterface.h>
-#include <phonon/objectdescription.h>
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * Interface for AddonInterface.
- *
- * This class cannot inherit from QObject has MediaObject already inherit from QObject.
- * This is a Qt limitation: there is no possibility to inherit virtual Qobject :/
- * See http://doc.trolltech.com/qq/qq15-academic.html
- * Phonon implementation got the same problem.
- *
- * @see VLCMediaController
- * @see VLCMediaObject
- * @see MediaObject
- */
-class MediaController : public AddonInterface
-{
-public:
-
- MediaController();
- virtual ~MediaController();
-
- bool hasInterface(Interface iface) const;
-
- QVariant interfaceCall(Interface iface, int i_command, const QList<QVariant> & arguments = QList<QVariant>());
-
- // MediaController signals
- virtual void availableSubtitlesChanged() = 0;
- virtual void availableAudioChannelsChanged() = 0;
-
-// virtual void availableChaptersChanged() = 0;
-// virtual void availableTitlesChanged() = 0;
- virtual void availableChaptersChanged(int) = 0;
- virtual void availableTitlesChanged(int) = 0;
-
- virtual void availableAnglesChanged(int i_available_angles) = 0;
- virtual void angleChanged(int i_angle_number) = 0;
- virtual void chapterChanged(int i_chapter_number) = 0;
- virtual void titleChanged(int i_title_number) = 0;
-
-protected:
-
- // AudioChannel
- virtual void setCurrentAudioChannel(const Phonon::AudioChannelDescription & audioChannel) = 0;
- virtual QList<Phonon::AudioChannelDescription> availableAudioChannels() const = 0;
- virtual Phonon::AudioChannelDescription currentAudioChannel() const = 0;
-
- // Subtitle
- virtual void setCurrentSubtitle(const Phonon::SubtitleDescription & subtitle) = 0;
- virtual QList<Phonon::SubtitleDescription> availableSubtitles() const = 0;
- virtual Phonon::SubtitleDescription currentSubtitle() const = 0;
-
- // Angle
- virtual void setCurrentAngle(int i_angle_number) = 0;
- virtual int availableAngles() const = 0;
- virtual int currentAngle() const = 0;
-
- // Chapter
-// virtual void setCurrentChapter( const Phonon::ChapterDescription & chapter ) = 0;
-// virtual QList<Phonon::ChapterDescription> availableChapters() const = 0;
-// virtual Phonon::ChapterDescription currentChapter() const = 0;
- virtual void setCurrentChapter(int chapterNumber) = 0;
- virtual int availableChapters() const = 0;
- virtual int currentChapter() const = 0;
-
- // Title
-// virtual void setCurrentTitle( const Phonon::TitleDescription & title ) = 0;
-// virtual QList<Phonon::TitleDescription> availableTitles() const = 0;
-// virtual Phonon::TitleDescription currentTitle() const = 0;
- virtual void setCurrentTitle(int titleNumber) = 0;
- virtual int availableTitles() const = 0;
- virtual int currentTitle() const = 0;
-
- virtual void setAutoplayTitles(bool b_autoplay) = 0;
- virtual bool autoplayTitles() const = 0;
-
- /**
- * Clear all (i.e availableSubtitles, availableChapters...).
- *
- * This is used each time we restart the video.
- */
- virtual void clearMediaController();
-
- Phonon::AudioChannelDescription current_audio_channel;
- QList<Phonon::AudioChannelDescription> available_audio_channels;
-
- Phonon::SubtitleDescription current_subtitle;
- QList<Phonon::SubtitleDescription> available_subtitles;
-
-// Phonon::ChapterDescription current_chapter;
-// QList<Phonon::ChapterDescription> available_chapters;
- int current_chapter;
- int available_chapters;
-
-// Phonon::TitleDescription current_title;
-// QList<Phonon::TitleDescription> available_titles;
- int current_title;
- int available_titles;
-
- int i_current_angle;
- int i_available_angles;
-
- bool b_autoplay_titles;
-
-private:
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_MEDIACONTROLLER_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "mediaobject.h"
-
-#include "seekstack.h"
-
-#include <QtCore/QUrl>
-#include <QtCore/QMetaType>
-#include <QtCore/QTimer>
-
-//Time in milliseconds before sending aboutToFinish() signal
-//2 seconds
-static const int ABOUT_TO_FINISH_TIME = 2000;
-
-namespace Phonon
-{
-namespace VLC {
-
-MediaObject::MediaObject(QObject *p_parent)
- : QObject(p_parent)
-{
- currentState = Phonon::LoadingState;
- i_video_widget_id = 0;
- b_prefinish_mark_reached_emitted = false;
- b_about_to_finish_emitted = false;
- i_transition_time = 0;
-
- // By default, no tick() signal
- // FIXME: Not implemented yet
- i_tick_interval = 0;
-
- qRegisterMetaType<QMultiMap<QString, QString> >("QMultiMap<QString, QString>");
-
- connect(this, SIGNAL(stateChanged(Phonon::State)),
- SLOT(stateChangedInternal(Phonon::State)));
-
- connect(this, SIGNAL(tickInternal(qint64)),
- SLOT(tickInternalSlot(qint64)));
-}
-
-MediaObject::~MediaObject()
-{
-}
-
-void MediaObject::setVideoWidgetId(WId i_widget_id)
-{
- i_video_widget_id = i_widget_id;
-}
-
-void MediaObject::play()
-{
- qDebug() << __FUNCTION__;
-
- if (currentState == Phonon::PausedState) {
- resume();
- } else {
- // Play the file
- playInternal();
- }
-}
-
-void MediaObject::seek(qint64 milliseconds)
-{
- static SeekStack *p_stack = new SeekStack(this);
-
- p_stack->pushSeek(milliseconds);
-
- qint64 currentTime = this->currentTime();
- qint64 totalTime = this->totalTime();
-
- if (currentTime < totalTime - i_prefinish_mark) {
- b_prefinish_mark_reached_emitted = false;
- }
- if (currentTime < totalTime - ABOUT_TO_FINISH_TIME) {
- b_about_to_finish_emitted = false;
- }
-}
-
-void MediaObject::tickInternalSlot(qint64 currentTime)
-{
- qint64 totalTime = this->totalTime();
-
- if (i_tick_interval > 0) {
- // If _tickInternal == 0 means tick() signal is disabled
- // Default is _tickInternal = 0
- emit tick(currentTime);
- }
-
- if (currentState == Phonon::PlayingState) {
- if (currentTime >= totalTime - i_prefinish_mark) {
- if (!b_prefinish_mark_reached_emitted) {
- b_prefinish_mark_reached_emitted = true;
- emit prefinishMarkReached(totalTime - currentTime);
- }
- }
- if (currentTime >= totalTime - ABOUT_TO_FINISH_TIME) {
- if (!b_about_to_finish_emitted) {
- // Track is about to finish
- b_about_to_finish_emitted = true;
- emit aboutToFinish();
- }
- }
- }
-}
-
-void MediaObject::loadMedia(const QString & filename)
-{
- // Default MediaObject state is Phonon::LoadingState
- currentState = Phonon::LoadingState;
-
- // Load the media
- loadMediaInternal(filename);
-}
-
-void MediaObject::resume()
-{
- pause();
-}
-
-qint32 MediaObject::tickInterval() const
-{
- return i_tick_interval;
-}
-
-void MediaObject::setTickInterval(qint32 tickInterval)
-{
- i_tick_interval = tickInterval;
-// if (_tickInterval <= 0) {
-// _tickTimer->setInterval(50);
-// } else {
-// _tickTimer->setInterval(_tickInterval);
-// }
-}
-
-qint64 MediaObject::currentTime() const
-{
- qint64 time = -1;
- Phonon::State st = state();
-
- switch (st) {
- case Phonon::PausedState:
- time = currentTimeInternal();
- break;
- case Phonon::BufferingState:
- time = currentTimeInternal();
- break;
- case Phonon::PlayingState:
- time = currentTimeInternal();
- break;
- case Phonon::StoppedState:
- time = 0;
- break;
- case Phonon::LoadingState:
- time = 0;
- break;
- case Phonon::ErrorState:
- time = -1;
- break;
- default:
- qCritical() << __FUNCTION__ << "Error: unsupported Phonon::State:" << st;
- }
-
- return time;
-}
-
-Phonon::State MediaObject::state() const
-{
- return currentState;
-}
-
-Phonon::ErrorType MediaObject::errorType() const
-{
- return Phonon::NormalError;
-}
-
-MediaSource MediaObject::source() const
-{
- return mediaSource;
-}
-
-void MediaObject::setSource(const MediaSource & source)
-{
- qDebug() << __FUNCTION__;
-
- mediaSource = source;
-
- switch (source.type()) {
- case MediaSource::Invalid:
- break;
- case MediaSource::LocalFile:
- loadMedia(mediaSource.fileName());
- break;
- case MediaSource::Url:
- loadMedia(mediaSource.url().toString());
- break;
- case MediaSource::Disc:
- switch (source.discType()) {
- case Phonon::NoDisc:
- qCritical() << __FUNCTION__
- << "Error: the MediaSource::Disc doesn't specify which one (Phonon::NoDisc)";
- return;
- case Phonon::Cd:
- loadMedia(mediaSource.deviceName());
- break;
- case Phonon::Dvd:
- loadMedia("dvd://" + mediaSource.deviceName());
- break;
- case Phonon::Vcd:
- loadMedia(mediaSource.deviceName());
- break;
- default:
- qCritical() << __FUNCTION__ << "Error: unsupported MediaSource::Disc:" << source.discType();
- break;
- }
- break;
- case MediaSource::Stream:
- break;
- default:
- qCritical() << __FUNCTION__
- << "Error: unsupported MediaSource:"
- << source.type();
- break;
- }
-
- emit currentSourceChanged(mediaSource);
-}
-
-void MediaObject::setNextSource(const MediaSource & source)
-{
- setSource(source);
-}
-
-qint32 MediaObject::prefinishMark() const
-{
- return i_prefinish_mark;
-}
-
-void MediaObject::setPrefinishMark(qint32 msecToEnd)
-{
- i_prefinish_mark = msecToEnd;
- if (currentTime() < totalTime() - i_prefinish_mark) {
- // Not about to finish
- b_prefinish_mark_reached_emitted = false;
- }
-}
-
-qint32 MediaObject::transitionTime() const
-{
- return i_transition_time;
-}
-
-void MediaObject::setTransitionTime(qint32 time)
-{
- i_transition_time = time;
-}
-
-void MediaObject::stateChangedInternal(Phonon::State newState)
-{
- qDebug() << __FUNCTION__ << "newState:" << newState
- << "previousState:" << currentState ;
-
- if (newState == currentState) {
- // State not changed
- return;
- }
-
- // State changed
- Phonon::State previousState = currentState;
- currentState = newState;
- emit stateChanged(currentState, previousState);
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_MEDIAOBJECT_H
-#define PHONON_VLC_MEDIAOBJECT_H
-
-#include <phonon/mediaobjectinterface.h>
-
-#include <QtCore/QObject>
-#include <QtGui/QWidget>
-
-namespace Phonon
-{
-namespace VLC {
-
-class SeekStack;
-
-class MediaObject : public QObject, public MediaObjectInterface
-{
- Q_OBJECT
- friend class SeekStack;
-
-public:
-
- MediaObject(QObject *p_parent);
- virtual ~MediaObject();
-
- /**
- * Widget Id where VLC will show the videos.
- */
- void setVideoWidgetId(WId i_widget_id);
-
- void play();
- void seek(qint64 milliseconds);
-
- qint32 tickInterval() const;
- void setTickInterval(qint32 tickInterval);
-
- qint64 currentTime() const;
- Phonon::State state() const;
- Phonon::ErrorType errorType() const;
- MediaSource source() const;
- void setSource(const MediaSource & source);
- void setNextSource(const MediaSource & source);
-
- qint32 prefinishMark() const;
- void setPrefinishMark(qint32 msecToEnd);
-
- qint32 transitionTime() const;
- void setTransitionTime(qint32);
-
-signals:
-
- void aboutToFinish();
- void bufferStatus( int i_percent_filled );
- void currentSourceChanged( const MediaSource & newSource );
- void finished();
- void hasVideoChanged(bool b_has_video);
- void metaDataChanged(const QMultiMap<QString, QString> & metaData);
- void prefinishMarkReached(qint32 msecToEnd);
- void seekableChanged(bool b_is_seekable);
- void stateChanged(Phonon::State newState, Phonon::State oldState);
- void tick(qint64 time);
- void totalTimeChanged(qint64 newTotalTime);
-
- // Signal from VLCMediaObject
- void stateChanged(Phonon::State newState);
-
- void tickInternal(qint64 time);
-
-protected:
-
- virtual void loadMediaInternal(const QString & filename) = 0;
- virtual void playInternal() = 0;
- virtual void seekInternal(qint64 milliseconds) = 0;
-
- virtual qint64 currentTimeInternal() const = 0;
-
- WId i_video_widget_id;
-
-private slots:
-
- void stateChangedInternal(Phonon::State newState);
-
- void tickInternalSlot(qint64 time);
-
-private:
-
- void loadMedia(const QString & filename);
-
- void resume();
-
- MediaSource mediaSource;
-
- Phonon::State currentState;
-
- qint32 i_prefinish_mark;
- bool b_prefinish_mark_reached_emitted;
-
- bool b_about_to_finish_emitted;
-
- qint32 i_tick_interval;
- qint32 i_transition_time;
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_MEDIAOBJECT_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "seekstack.h"
-
-#include <QtCore/QTimer>
-#include <QtCore/QDebug>
-
-namespace Phonon
-{
-namespace VLC {
-
-SeekStack::SeekStack(MediaObject *mediaObject)
- : QObject(mediaObject)
-{
- p_media_object = mediaObject;
-
- p_timer = new QTimer(this);
- connect(p_timer, SIGNAL(timeout()),
- SLOT(popSeek()));
- p_timer->setInterval(1000);
-}
-
-SeekStack::~SeekStack()
-{
-}
-
-void SeekStack::pushSeek(qint64 milliseconds)
-{
- qDebug() << __FUNCTION__ << "seek:" << milliseconds;
-
- disconnect(p_media_object, SIGNAL(tickInternal(qint64)),
- p_media_object, SLOT(tickInternalSlot(qint64)));
-
- stack.push(milliseconds);
-
- if (!p_timer->isActive()) {
- p_timer->start();
- popSeek();
- }
-}
-
-void SeekStack::popSeek()
-{
- if (stack.isEmpty()) {
- p_timer->stop();
- reconnectTickSignal();
- return;
- }
-
- int i_milliseconds = stack.pop();
- stack.clear();
-
- qDebug() << __FUNCTION__ << "real seek:" << i_milliseconds;
-
- p_media_object->seekInternal(i_milliseconds);
-
- reconnectTickSignal();
-}
-
-void SeekStack::reconnectTickSignal()
-{
- connect(p_media_object, SIGNAL(tickInternal(qint64)),
- p_media_object, SLOT(tickInternalSlot(qint64)));
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_SEEKSTACK_H
-#define PHONON_VLC_SEEKSTACK_H
-
-#include "mediaobject.h"
-
-#include <QtCore/QObject>
-#include <QtCore/QStack>
-
-class QTimer;
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * A queue of seek commands.
- */
-class SeekStack : public QObject
-{
- Q_OBJECT
-
-public:
-
- SeekStack(MediaObject *mediaObject);
- ~SeekStack();
-
- void pushSeek(qint64 milliseconds);
-
-signals:
-
-private slots:
-
- void popSeek();
-
- void reconnectTickSignal();
-
-private:
-
- MediaObject *p_media_object;
-
- QTimer *p_timer;
-
- QStack<qint64> stack;
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_SEEKSTACK_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "sinknode.h"
-
-#include "mediaobject.h"
-
-namespace Phonon
-{
-namespace VLC {
-
-SinkNode::SinkNode(QObject *p_parent)
- : QObject(p_parent)
-{
- p_media_object = 0;
-}
-
-SinkNode::~SinkNode()
-{
-}
-
-void SinkNode::connectToMediaObject(PrivateMediaObject * mediaObject)
-{
- if (p_media_object)
- qCritical() << __FUNCTION__ << "p_media_object already connected";
-
- p_media_object = mediaObject;
-}
-
-void SinkNode::disconnectFromMediaObject(PrivateMediaObject * mediaObject)
-{
- if (p_media_object != mediaObject)
- qCritical() << __FUNCTION__ << "SinkNode was not connected to mediaObject";
-}
-
-
-}
-} // Namespace Phonon::VLC_MPlayer
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_SINKNODE_H
-#define PHONON_VLC_SINKNODE_H
-
-#include <QtCore/QObject>
-#include <QtCore/QString>
-
-namespace Phonon
-{
-namespace VLC {
-
-class VLCMediaObject;
-typedef VLCMediaObject PrivateMediaObject;
-
-class SinkNode : public QObject
-{
- Q_OBJECT
-
-public:
-
- SinkNode(QObject *p_parent);
- virtual ~SinkNode();
-
- virtual void connectToMediaObject(PrivateMediaObject *mediaObject);
-
- virtual void disconnectFromMediaObject(PrivateMediaObject *mediaObject);
-
-protected:
-
- PrivateMediaObject *p_media_object;
-
-private:
-
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_SINKNODE_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "videowidget.h"
-
-#include "mediaobject.h"
-#include "vlcmediaobject.h"
-
-#include "vlcloader.h"
-
-#include <QtGui/QWidget>
-#include <QtGui/QApplication>
-#include <QtGui/QDesktopWidget>
-#include <QtCore/QtDebug>
-
-namespace Phonon
-{
-namespace VLC {
-
-VideoWidget::VideoWidget(QWidget *p_parent)
- : SinkNode(p_parent)
-{
- p_video_widget = new Widget(p_parent);
-
- aspect_ratio = Phonon::VideoWidget::AspectRatioAuto;
- scale_mode = Phonon::VideoWidget::FitInView;
-
- b_filter_adjust_activated = false;
- f_brightness = 0.0;
- f_contrast = 0.0;
- f_hue = 0.0;
- f_saturation = 0.0;
-}
-
-VideoWidget::~VideoWidget()
-{
-}
-
-void VideoWidget::connectToMediaObject(PrivateMediaObject *mediaObject)
-{
- SinkNode::connectToMediaObject(mediaObject);
-
- connect(mediaObject, SIGNAL(videoWidgetSizeChanged(int, int)),
- SLOT(videoWidgetSizeChanged(int, int)));
-
- mediaObject->setVideoWidgetId(p_video_widget->winId());
-}
-
-Phonon::VideoWidget::AspectRatio VideoWidget::aspectRatio() const
-{
- return aspect_ratio;
-}
-
-// VLC accepted formats are x:y (4:3, 16:9, etc...) expressing the global image aspect
-void VideoWidget::setAspectRatio(Phonon::VideoWidget::AspectRatio aspect)
-{
- // finish if no player
- if (!vlc_current_media_player)
- return;
-
- aspect_ratio = aspect;
-
- switch (aspect_ratio) {
- case Phonon::VideoWidget::AspectRatioAuto: // Let the decoder find the aspect ratio automatically from the media file (this is the default)
-// p_libvlc_video_set_aspect_ratio(p_vlc_current_media_player, "", vlc_exception);
- vlcExceptionRaised();
- break;
- case Phonon::VideoWidget::AspectRatioWidget: // Fit the video into the widget making the aspect ratio depend solely on the size of the widget
- // This way the aspect ratio is freely resizeable by the user
-// p_libvlc_video_set_aspect_ratio(p_vlc_current_media_player, "", vlc_exception);
- vlcExceptionRaised();
- break;
- case Phonon::VideoWidget::AspectRatio4_3:
-// p_libvlc_video_set_aspect_ratio(p_vlc_current_media_player, "4:3", vlc_exception);
- vlcExceptionRaised();
- break;
- case Phonon::VideoWidget::AspectRatio16_9:
-// p_libvlc_video_set_aspect_ratio(p_vlc_current_media_player, "16:9", vlc_exception);
- vlcExceptionRaised();
- break;
- default:
- qCritical() << __FUNCTION__ << "error: unsupported AspectRatio:" << (int) aspect_ratio;
- }
-}
-
-Phonon::VideoWidget::ScaleMode VideoWidget::scaleMode() const
-{
- return scale_mode;
-}
-
-// The ScaleMode enumeration describes how to treat aspect ratio during resizing of video
-void VideoWidget::setScaleMode(Phonon::VideoWidget::ScaleMode scale)
-{
- scale_mode = scale;
- switch (scale_mode) {
- case Phonon::VideoWidget::FitInView: // The video will be fitted to fill the view keeping aspect ratio
- break;
- case Phonon::VideoWidget::ScaleAndCrop: // The video is scaled
- break;
- default:
- qWarning() << __FUNCTION__ << "unknow Phonon::VideoWidget::ScaleMode:" << scale_mode;
- }
-}
-
-qreal VideoWidget::brightness() const
-{
- return f_brightness;
-}
-
-void VideoWidget::setBrightness(qreal brightness)
-{
- f_brightness = brightness;
-
- // vlc takes brightness in range 0.0 - 2.0
- if (vlc_current_media_player) {
- if (!b_filter_adjust_activated) {
-// p_libvlc_video_filter_add(p_vlc_current_media_player, ADJUST, vlc_exception);
-// vlcExceptionRaised();
- b_filter_adjust_activated = true;
- }
-// p_libvlc_video_set_brightness(p_vlc_current_media_player, f_brightness + 1.0, vlc_exception);
-// vlcExceptionRaised();
- }
-}
-
-qreal VideoWidget::contrast() const
-{
- return f_contrast;
-}
-
-void VideoWidget::setContrast(qreal contrast)
-{
- f_contrast = contrast;
-
- // vlc takes contrast in range 0.0 - 2.0
- float f_contrast = contrast;
- if (vlc_current_media_player) {
- if (!b_filter_adjust_activated) {
-// p_libvlc_video_filter_add(p_vlc_current_media_player, ADJUST, vlc_exception);
-// vlcExceptionRaised();
- b_filter_adjust_activated = true;
- }
-// p_libvlc_video_set_contrast(p_vlc_current_media_player, f_contrast + 1.0, vlc_exception);
-// vlcExceptionRaised();
- }
-}
-
-qreal VideoWidget::hue() const
-{
- return f_hue;
-}
-
-void VideoWidget::setHue(qreal hue)
-{
- f_hue = hue;
-
- // vlc takes hue in range 0 - 360 in integer
- int i_hue = (f_hue + 1.0) * 180;
- if (vlc_current_media_player) {
- if (!b_filter_adjust_activated) {
-// p_libvlc_video_filter_add(p_vlc_current_media_player, ADJUST, vlc_exception);
-// vlcExceptionRaised();
- b_filter_adjust_activated = true;
- }
-// p_libvlc_video_set_hue(p_vlc_current_media_player, i_hue, vlc_exception);
-// vlcExceptionRaised();
- }
-
-}
-
-qreal VideoWidget::saturation() const
-{
- return f_saturation;
-}
-
-void VideoWidget::setSaturation(qreal saturation)
-{
- f_saturation = saturation;
-
- // vlc takes brightness in range 0.0 - 3.0
- if (vlc_current_media_player) {
- if (!b_filter_adjust_activated) {
-// p_libvlc_video_filter_add(p_vlc_current_media_player, ADJUST, vlc_exception);
-// vlcExceptionRaised();
- b_filter_adjust_activated = true;
- }
-// p_libvlc_video_set_saturation(p_vlc_current_media_player, (f_saturation + 1.0) * 1.5, vlc_exception);
-// vlcExceptionRaised();
- }
-}
-
-Widget * VideoWidget::widget()
-{
- return p_video_widget;
-}
-
-void VideoWidget::videoWidgetSizeChanged(int i_width, int i_height)
-{
- qDebug() << __FUNCTION__ << "video width" << i_width << "height:" << i_height;
-
- // It resizes dynamically the widget and the main window
- // Note: I didn't find another way
-
- QSize videoSize(i_width, i_height);
- videoSize.boundedTo(QApplication::desktop()->availableGeometry().size());
-
- p_video_widget->hide();
- p_video_widget->setVideoSize(videoSize);
-#ifdef Q_OS_WIN
- QWidget *p_parent = qobject_cast<QWidget *>(this->parent());
- QSize previousSize = p_parent->minimumSize();
- p_parent->setMinimumSize(videoSize);
-#endif
- p_video_widget->show();
-#ifdef Q_OS_WIN
- p_parent->setMinimumSize(previousSize);
-#endif
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_VIDEOWIDGET_H
-#define PHONON_VLC_VIDEOWIDGET_H
-
-#include "sinknode.h"
-
-#include <phonon/videowidgetinterface.h>
-
-#include "vlcvideowidget.h"
-typedef Phonon::VLC::VLCVideoWidget Widget;
-
-
-namespace Phonon
-{
-namespace VLC {
-
-
-class VideoWidget : public SinkNode, public VideoWidgetInterface
-{
- Q_OBJECT
- Q_INTERFACES(Phonon::VideoWidgetInterface)
-public:
-
- VideoWidget(QWidget *p_parent);
- ~VideoWidget();
-
- void connectToMediaObject(PrivateMediaObject * mediaObject);
-
- Phonon::VideoWidget::AspectRatio aspectRatio() const;
- void setAspectRatio(Phonon::VideoWidget::AspectRatio aspect);
-
- Phonon::VideoWidget::ScaleMode scaleMode() const;
- void setScaleMode(Phonon::VideoWidget::ScaleMode scale);
-
- qreal brightness() const;
- void setBrightness(qreal brightness);
-
- qreal contrast() const;
- void setContrast(qreal contrast);
-
- qreal hue() const;
- void setHue(qreal hue);
-
- qreal saturation() const;
- void setSaturation(qreal saturation);
-
- Widget * widget();
-
-private slots:
-
- void videoWidgetSizeChanged(int width, int height);
-
-private:
-
- Widget *p_video_widget;
-
- Phonon::VideoWidget::AspectRatio aspect_ratio;
-
- Phonon::VideoWidget::ScaleMode scale_mode;
-
- bool b_filter_adjust_activated;
- qreal f_brightness;
- qreal f_contrast;
- qreal f_hue;
- qreal f_saturation;
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_VIDEOWIDGET_H
+++ /dev/null
-[Desktop Entry]
-Type=Service
-X-KDE-ServiceTypes=PhononBackend
-MimeType=application/x-annodex;video/quicktime;video/x-quicktime;audio/x-m4a;application/x-quicktimeplayer;video/mkv;video/msvideo;video/x-msvideo;video/x-flic;audio/x-aiff;audio/aiff;audio/x-pn-aiff;audio/x-realaudio;audio/basic;audio/x-basic;audio/x-pn-au;audio/x-8svx;audio/8svx;audio/x-16sv;audio/168sv;image/x-ilbm;image/ilbm;video/x-anim;video/anim;image/png;image/x-png;video/mng;video/x-mng;audio/x-ogg;audio/x-speex+ogg;application/ogg;application/ogg;audio/vnd.rn-realaudio;audio/x-pn-realaudio-plugin;audio/x-real-audio;application/vnd.rn-realmedia;video/mpeg;video/x-mpeg;audio/x-wav;audio/wav;audio/x-pn-wav;audio/x-pn-windows-acm;audio/mpeg2;audio/x-mpeg2;audio/mpeg3;audio/x-mpeg3;audio/mpeg;audio/x-mpeg;x-mpegurl;audio/x-mpegurl;audio/mp3;audio/mpeg;video/x-ms-asf;application/x-flash-video;
-X-KDE-Library=phonon_vlc
-X-KDE-PhononBackendInfo-InterfaceVersion=1
-X-KDE-PhononBackendInfo-Version=0.1
-X-KDE-PhononBackendInfo-Website=http://www.videolan.org/
-Icon=phonon-vlc
-InitialPreference=10
-
-Name=VLC
-Name[x-test]=xxVLCxx
-
-Comment=Phonon VLC backend
-Comment[el]=Σύστημα υποστήριξης Phonon του VLC
-Comment[et]=Phononi VLC taustaprogramm
-Comment[fr]=Système de gestion VLC pour Phonon
-Comment[ga]=Inneall VLC Phonon
-Comment[gl]=Infraestrutura de VLC para Phonon
-Comment[km]=កម្មវិធីខាងក្រោយរបស់ Phonon VLC
-Comment[nb]=Phonon VLC-motor
-Comment[nds]=Phonon-Hülpprogramm VLC
-Comment[nl]=VLC-backend (Phonon)
-Comment[pt]=Infra-estrutura do VLC para o Phonon
-Comment[pt_BR]=Infraestrutura Phonon VLC
-Comment[sv]=Phonon VLC-gränssnitt
-Comment[tr]=Phonon VLC arka ucu
-Comment[uk]=Сервер VLC Phonon
-Comment[x-test]=xxPhonon VLC backendxx
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "vlcloader.h"
-
-#include <QtCore/QDebug>
-#include <QtCore/QDir>
-#include <QtCore/QLibrary>
-#include <QtCore/QSettings>
-#include <QtCore/QString>
-#include <QtCore/QStringList>
-
-// Global variables
-libvlc_instance_t *vlc_instance = 0;
-libvlc_exception_t *vlc_exception = new libvlc_exception_t();
-libvlc_media_player_t *vlc_current_media_player = 0;
-
-namespace Phonon
-{
-namespace VLC {
-
-bool vlcInit()
-{
- // Global variables
- vlc_instance = 0;
- vlc_exception = new libvlc_exception_t();
-
- QString path = vlcPath();
- if (!path.isEmpty()) {
- QString pluginsPath = QString("--plugin-path=") + QDir::toNativeSeparators(QFileInfo(vlcPath()).dir().path());
-#if defined(Q_OS_UNIX)
- pluginsPath.append("/vlc");
-#elif defined(Q_OS_WIN)
- pluginsPath.append("\\plugins");
-#endif
- QByteArray p = path.toLatin1();
- QByteArray pp = pluginsPath.toLatin1();
- // VLC command line options. See vlc --full-help
- const char *vlcArgs[] = {
- p.constData(),
- pp.constData(),
- "--verbose=2",
- "--intf=dummy",
- "--extraintf=logger",
- "--ignore-config",
- "--reset-plugins-cache",
- "--no-media-library",
- "--no-one-instance",
- "--no-osd",
- "--no-stats",
- "--no-video-title-show"
- };
-
- libvlc_exception_init(vlc_exception);
-
- // Create and initialize a libvlc instance (it should be done only once)
- vlc_instance = libvlc_new(sizeof(vlcArgs) / sizeof(*vlcArgs),
- vlcArgs,
- vlc_exception);
- vlcExceptionRaised();
-
- return true;
- } else {
- return false;
- }
-}
-
-void vlcRelease()
-{
- libvlc_release(vlc_instance);
- vlcExceptionRaised();
- vlcUnload();
-}
-
-void vlcExceptionRaised()
-{
- if (libvlc_exception_raised(vlc_exception)) {
- qDebug() << "libvlc exception:" << libvlc_errmsg();
- libvlc_exception_clear(vlc_exception);
- }
-}
-
-#if defined(Q_OS_UNIX)
-static bool libGreaterThan(const QString &lhs, const QString &rhs)
-{
- QStringList lhsparts = lhs.split(QLatin1Char('.'));
- QStringList rhsparts = rhs.split(QLatin1Char('.'));
- Q_ASSERT(lhsparts.count() > 1 && rhsparts.count() > 1);
-
- for (int i = 1; i < rhsparts.count(); ++i) {
- if (lhsparts.count() <= i)
- // left hand side is shorter, so it's less than rhs
- return false;
-
- bool ok = false;
- int b = 0;
- int a = lhsparts.at(i).toInt(&ok);
- if (ok)
- b = rhsparts.at(i).toInt(&ok);
- if (ok) {
- // both toInt succeeded
- if (a == b)
- continue;
- return a > b;
- } else {
- // compare as strings;
- if (lhsparts.at(i) == rhsparts.at(i))
- continue;
- return lhsparts.at(i) > rhsparts.at(i);
- }
- }
-
- // they compared strictly equally so far
- // lhs cannot be less than rhs
- return true;
-}
-#endif
-
-static QStringList findAllLibVlc()
-{
- QStringList paths;
-#if defined(Q_OS_UNIX)
- paths = QString::fromLatin1(qgetenv("LD_LIBRARY_PATH"))
- .split(QLatin1Char(':'), QString::SkipEmptyParts);
- paths << QLatin1String(PHONON_LIB_INSTALL_DIR) << QLatin1String("/usr/lib") << QLatin1String("/usr/local/lib");
-
- QStringList foundVlcs;
- foreach (const QString &path, paths) {
- QDir dir = QDir(path);
- QStringList entryList = dir.entryList(QStringList() << QLatin1String("libvlc.*"), QDir::Files);
-
- qSort(entryList.begin(), entryList.end(), libGreaterThan);
- foreach (const QString &entry, entryList)
- foundVlcs << path + QLatin1Char('/') + entry;
- }
-
- return foundVlcs;
-#elif defined(Q_OS_WIN)
- // Read VLC version and installation directory from Windows registry
- QSettings settings(QSettings::SystemScope, "VideoLAN", "VLC");
- QString vlcVersion = settings.value("Version").toString();
- QString vlcInstallDir = settings.value("InstallDir").toString();
- if (vlcVersion.startsWith("1.0") && !vlcInstallDir.isEmpty()) {
- paths << vlcInstallDir + QLatin1Char('\\') + "libvlc.dll";
- return paths;
- } else {
- return QStringList();
- }
-#endif
-}
-
-static QLibrary *vlcLibrary = 0;
-
-QString vlcPath()
-{
- static QString path;
- if (!path.isEmpty()) {
- return path;
- }
-
- vlcLibrary = new QLibrary();
- QStringList paths = findAllLibVlc();
- foreach(path, paths) {
- vlcLibrary->setFileName(path);
-
- if (vlcLibrary->resolve("libvlc_exception_init")) {
- return path;
- } else {
- qDebug("Cannot resolve the symbol or load VLC library");
- }
- qWarning() << vlcLibrary->errorString();
- }
-
- vlcUnload();
-
- return QString();
-}
-
-void vlcUnload()
-{
- vlcLibrary->unload();
- delete vlcLibrary;
- vlcLibrary = 0;
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_VLC_LOADER_H
-#define PHONON_VLC_VLC_LOADER_H
-
-#include <vlc/vlc.h>
-
-class QString;
-
-/**
- * VLC library instance global variable.
- */
-extern libvlc_instance_t *vlc_instance;
-
-/**
- * VLC library exception handling global variable.
- */
-extern libvlc_exception_t *vlc_exception;
-
-/**
- * VLC library media player global variable.
- */
-extern libvlc_media_player_t *vlc_current_media_player;
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * Get VLC path.
- *
- * @return the VLC path
- */
-QString vlcPath();
-
-/**
- * Unload VLC library.
- */
-void vlcUnload();
-
-/**
- * Check for a VLC library exception.
- *
- * show an error message when an exception has been raised.
- */
-void vlcExceptionRaised();
-
-/**
- * Initialize and launch VLC library.
- *
- * instance and exception handling global variables are initialized.
- *
- * @return VLC initialization result
- */
-bool vlcInit();
-
-/**
- * Stop VLC library.
- */
-void vlcRelease();
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_VLC_LOADER_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "vlcmediacontroller.h"
-
-#include "vlcloader.h"
-
-namespace Phonon
-{
-namespace VLC {
-
-VLCMediaController::VLCMediaController()
- : MediaController()
-{
- p_vlc_media_player = 0;
-}
-
-VLCMediaController::~VLCMediaController()
-{
-}
-
-void VLCMediaController::clearMediaController()
-{
- current_audio_channel = Phonon::AudioChannelDescription();
- available_audio_channels.clear();
-
- current_subtitle = Phonon::SubtitleDescription();
- available_subtitles.clear();
-
- i_current_angle = 0;
- i_available_angles = 0;
-
-// current_chapter = Phonon::ChapterDescription();
-// available_chapters.clear();
- current_chapter = 0;
- available_chapters = 0;
-
-// current_title = Phonon::TitleDescription();
-// available_titles.clear();
- current_title = 0;
- available_titles = 0;
-
- b_autoplay_titles = false;
-
- emit availableAudioChannelsChanged();
- emit availableSubtitlesChanged();
- emit availableTitlesChanged(0);
- emit availableChaptersChanged(0);
-}
-
-// Add audio channel -> in libvlc it is track, it means audio in another language
-void VLCMediaController::audioChannelAdded(int id, const QString & lang)
-{
- QHash<QByteArray, QVariant> properties;
- properties.insert("name", lang);
- properties.insert("description", "");
-
- available_audio_channels << Phonon::AudioChannelDescription(id, properties);
- emit availableAudioChannelsChanged();
-}
-
-// Add subtitle
-void VLCMediaController::subtitleAdded(int id, const QString & lang, const QString & type)
-{
- QHash<QByteArray, QVariant> properties;
- properties.insert("name", lang);
- properties.insert("description", "");
- properties.insert("type", type);
-
- available_subtitles << Phonon::SubtitleDescription(id, properties);
- emit availableSubtitlesChanged();
-}
-
-// Add title
-void VLCMediaController::titleAdded(int id, const QString & name)
-{
-// QHash<QByteArray, QVariant> properties;
-// properties.insert("name", name);
-// properties.insert("description", "");
-
-// available_titles << Phonon::TitleDescription(id, properties);
- available_titles++;
- emit availableTitlesChanged(available_titles);
-}
-
-// Add chapter
-void VLCMediaController::chapterAdded(int titleId, const QString & name)
-{
-// QHash<QByteArray, QVariant> properties;
-// properties.insert("name", name);
-// properties.insert("description", "");
-
-// available_chapters << Phonon::ChapterDescription(titleId, properties);
- available_chapters++;
- emit availableChaptersChanged(available_chapters);
-}
-
-// Audio channel
-
-void VLCMediaController::setCurrentAudioChannel(const Phonon::AudioChannelDescription & audioChannel)
-{
- current_audio_channel = audioChannel;
- libvlc_audio_set_track(p_vlc_media_player, audioChannel.index(), vlc_exception);
- vlcExceptionRaised();
-}
-
-QList<Phonon::AudioChannelDescription> VLCMediaController::availableAudioChannels() const
-{
- return available_audio_channels;
-}
-
-Phonon::AudioChannelDescription VLCMediaController::currentAudioChannel() const
-{
- return current_audio_channel;
-}
-
-void VLCMediaController::refreshAudioChannels()
-{
- current_audio_channel = Phonon::AudioChannelDescription();
- available_audio_channels.clear();
-
- libvlc_track_description_t * p_info = libvlc_audio_get_track_description(
- p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
- while (p_info) {
- audioChannelAdded(p_info->i_id, p_info->psz_name);
- p_info = p_info->p_next;
- }
- libvlc_track_description_release(p_info);
-}
-
-// Subtitle
-
-void VLCMediaController::setCurrentSubtitle(const Phonon::SubtitleDescription & subtitle)
-{
- current_subtitle = subtitle;
-// int id = current_subtitle.index();
- QString type = current_subtitle.property("type").toString();
-
- if (type == "file") {
- QString filename = current_subtitle.property("name").toString();
- if (!filename.isEmpty()) {
- libvlc_video_set_subtitle_file(p_vlc_media_player,
- filename.toAscii().data(),
- vlc_exception);
- vlcExceptionRaised();
-
- // There is no subtitle event inside libvlc so let's send our own event...
- available_subtitles << current_subtitle;
- emit availableSubtitlesChanged();
- }
- } else {
- libvlc_video_set_spu(p_vlc_media_player, subtitle.index(), vlc_exception);
- vlcExceptionRaised();
- }
-}
-
-QList<Phonon::SubtitleDescription> VLCMediaController::availableSubtitles() const
-{
- return available_subtitles;
-}
-
-Phonon::SubtitleDescription VLCMediaController::currentSubtitle() const
-{
- return current_subtitle;
-}
-
-void VLCMediaController::refreshSubtitles()
-{
- current_subtitle = Phonon::SubtitleDescription();
- available_subtitles.clear();
-
- libvlc_track_description_t *p_info = libvlc_video_get_spu_description(
- p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
- while (p_info) {
- subtitleAdded(p_info->i_id, p_info->psz_name, "");
- p_info = p_info->p_next;
- }
- libvlc_track_description_release(p_info);
-}
-
-// Title
-
-//void VLCMediaController::setCurrentTitle( const Phonon::TitleDescription & title )
-void VLCMediaController::setCurrentTitle(int title)
-{
- current_title = title;
-
-// libvlc_media_player_set_title(p_vlc_media_player, title.index(), vlc_exception);
- libvlc_media_player_set_title(p_vlc_media_player, title, vlc_exception);
- vlcExceptionRaised();
-}
-
-//QList<Phonon::TitleDescription> VLCMediaController::availableTitles() const
-int VLCMediaController::availableTitles() const
-{
- return available_titles;
-}
-
-//Phonon::TitleDescription VLCMediaController::currentTitle() const
-int VLCMediaController::currentTitle() const
-{
- return current_title;
-}
-
-void VLCMediaController::setAutoplayTitles(bool autoplay)
-{
- b_autoplay_titles = autoplay;
-}
-
-bool VLCMediaController::autoplayTitles() const
-{
- return b_autoplay_titles;
-}
-
-// Chapter
-
-//void VLCMediaController::setCurrentChapter(const Phonon::ChapterDescription &chapter)
-void VLCMediaController::setCurrentChapter(int chapter)
-{
- current_chapter = chapter;
-// libvlc_media_player_set_chapter(p_vlc_media_player, chapter.index(), vlc_exception);
- libvlc_media_player_set_chapter(p_vlc_media_player, chapter, vlc_exception);
- vlcExceptionRaised();
-}
-
-//QList<Phonon::ChapterDescription> VLCMediaController::availableChapters() const
-int VLCMediaController::availableChapters() const
-{
- return available_chapters;
-}
-
-//Phonon::ChapterDescription VLCMediaController::currentChapter() const
-int VLCMediaController::currentChapter() const
-{
- return current_chapter;
-}
-
-// We need to rebuild available chapters when title is changed
-void VLCMediaController::refreshChapters(int i_title)
-{
-// current_chapter = Phonon::ChapterDescription();
-// available_chapters.clear();
- current_chapter = 0;
- available_chapters = 0;
-
- // Get the description of available chapters for specific title
- libvlc_track_description_t *p_info = libvlc_video_get_chapter_description(
- p_vlc_media_player, i_title, vlc_exception);
- vlcExceptionRaised();
- while (p_info) {
- chapterAdded(p_info->i_id, p_info->psz_name);
- p_info = p_info->p_next;
- }
- libvlc_track_description_release(p_info);
-}
-
-// Angle
-
-void VLCMediaController::setCurrentAngle(int angleNumber)
-{
- i_current_angle = angleNumber;
-}
-
-int VLCMediaController::availableAngles() const
-{
- return i_available_angles;
-}
-
-int VLCMediaController::currentAngle() const
-{
- return i_current_angle;
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_VLCMEDIA_CONTROLLER_H
-#define PHONON_VLC_VLCMEDIA_CONTROLLER_H
-
-#include "mediacontroller.h"
-#include "vlcloader.h"
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * MediaController specific code for VLC.
- */
-class VLCMediaController : public MediaController
-{
-public:
- VLCMediaController();
- virtual ~VLCMediaController();
-
- void audioChannelAdded(int id, const QString & lang);
- void subtitleAdded(int id, const QString & lang, const QString & type);
- void titleAdded(int id, const QString & name);
- void chapterAdded(int titleId, const QString & name);
-
-protected:
- virtual void clearMediaController();
-
- // AudioChannel
- void setCurrentAudioChannel(const Phonon::AudioChannelDescription & audioChannel);
- QList<Phonon::AudioChannelDescription> availableAudioChannels() const;
- Phonon::AudioChannelDescription currentAudioChannel() const;
- void refreshAudioChannels();
-
- // Subtitle
- void setCurrentSubtitle(const Phonon::SubtitleDescription & subtitle);
- QList<Phonon::SubtitleDescription> availableSubtitles() const;
- Phonon::SubtitleDescription currentSubtitle() const;
- void refreshSubtitles();
-
- // Angle
- void setCurrentAngle(int angleNumber);
- int availableAngles() const;
- int currentAngle() const;
-
- // Chapter
-// void setCurrentChapter( const Phonon::ChapterDescription & chapter );
-// QList<Phonon::ChapterDescription> availableChapters() const;
-// Phonon::ChapterDescription currentChapter() const;
- void setCurrentChapter(int chapterNumber);
- int availableChapters() const;
- int currentChapter() const;
- void refreshChapters(int i_title);
-
- // Title
-// void setCurrentTitle( const Phonon::TitleDescription & title );
-// QList<Phonon::TitleDescription> availableTitles() const;
-// Phonon::TitleDescription currentTitle() const;
- void setCurrentTitle(int titleNumber);
- int availableTitles() const;
- int currentTitle() const;
-
- void setAutoplayTitles(bool autoplay);
- bool autoplayTitles() const;
-
- // MediaPlayer
- libvlc_media_player_t *p_vlc_media_player;
-
-private:
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "vlcmediaobject.h"
-
-#include "videowidget.h"
-
-#include "vlcloader.h"
-
-#include <QtCore/QTimer>
-#include <QtCore/QtDebug>
-
-namespace Phonon
-{
-namespace VLC {
-
-VLCMediaObject::VLCMediaObject(QObject * parent)
- : MediaObject(parent), VLCMediaController()
-{
- // Create an empty Media Player object
- p_vlc_media_player = libvlc_media_player_new(vlc_instance, vlc_exception);
- vlcExceptionRaised();
- p_vlc_media_player_event_manager = 0;
-
- // Media
- p_vlc_media = 0;
- p_vlc_media_event_manager = 0;
-
- // Media Discoverer
- p_vlc_media_discoverer = 0;
- p_vlc_media_discoverer_event_manager = 0;
-
- i_total_time = 0;
- b_has_video = false;
- b_seekable = false;
-}
-
-VLCMediaObject::~VLCMediaObject()
-{
- unloadMedia();
-
- libvlc_media_player_stop(p_vlc_media_player); // ensure that we are stopped
- libvlc_media_player_release(p_vlc_media_player);
-}
-
-void VLCMediaObject::unloadMedia()
-{
-// if( p_vlc_media_player ) {
-// libvlc_media_player_release(p_vlc_media_player);
-// p_vlc_media_player = 0;
-// }
-
- if (p_vlc_media) {
- libvlc_media_release(p_vlc_media);
- p_vlc_media = 0;
- }
-}
-
-void VLCMediaObject::loadMediaInternal(const QString & filename)
-{
- qDebug() << __FUNCTION__ << filename;
-
- // Create a media with the given MRL
- p_vlc_media = libvlc_media_new(vlc_instance, filename.toAscii(), vlc_exception);
- vlcExceptionRaised();
-
- // Set the media that will be used by the media player
- libvlc_media_player_set_media(p_vlc_media_player, p_vlc_media);
-
- // No need to keep the media now
-// libvlc_media_release(p_vlc_media);
-
- // connectToAllVLCEvents() at the end since it needs p_vlc_media_player
- connectToAllVLCEvents();
-
- b_play_request_reached = false;
-
- // Get meta data (artist, title, etc...)
- updateMetaData();
-
- // Update available audio channels/subtitles/angles/chapters/etc...
- // i.e everything from MediaController
- // There is no audio channel/subtitle/angle/chapter events inside libvlc
- // so let's send our own events...
- // This will reset the GUI
- clearMediaController();
-
- // We need to do this, otherwise we never get any events with the real length
- libvlc_media_get_duration(p_vlc_media, vlc_exception);
-
- if (b_play_request_reached) {
- // The media is playing, no need to load it
- return;
- }
-
- emit stateChanged(Phonon::StoppedState);
-}
-
-void VLCMediaObject::setVLCWidgetId()
-{
- // Get our media player to use our window
-#if defined(Q_OS_UNIX)
- libvlc_media_player_set_xwindow(p_vlc_media_player, i_video_widget_id);
-#elif defined(Q_OS_WIN)
- libvlc_media_player_set_hwnd(p_vlc_media_player, i_video_widget_id);
-#elif defined(Q_OS_MAC)
- libvlc_media_player_set_agl(p_vlc_media_player, i_video_widget_id);
-#endif
-}
-
-void VLCMediaObject::playInternal()
-{
- b_play_request_reached = true;
-
- // Clear subtitles/chapters/etc...
- clearMediaController();
-
- vlc_current_media_player = p_vlc_media_player;
-
- setVLCWidgetId();
-
- // Play
- libvlc_media_player_play(p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
-}
-
-void VLCMediaObject::pause()
-{
- libvlc_media_player_pause(p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
-}
-
-void VLCMediaObject::stop()
-{
- libvlc_media_player_stop(p_vlc_media_player);
-// unloadMedia();
-}
-
-void VLCMediaObject::seekInternal(qint64 milliseconds)
-{
- qDebug() << __FUNCTION__ << milliseconds;
- libvlc_media_player_set_time(p_vlc_media_player, milliseconds, vlc_exception);
- vlcExceptionRaised();
-}
-
-QString VLCMediaObject::errorString() const
-{
- return libvlc_errmsg();
-}
-
-bool VLCMediaObject::hasVideo() const
-{
- return b_has_video;
-}
-
-bool VLCMediaObject::isSeekable() const
-{
- return b_seekable;
-}
-
-void VLCMediaObject::connectToAllVLCEvents()
-{
- // Get the event manager from which the media player send event
- p_vlc_media_player_event_manager = libvlc_media_player_event_manager(p_vlc_media_player);
- libvlc_event_type_t eventsMediaPlayer[] = {
- libvlc_MediaPlayerPlaying,
- libvlc_MediaPlayerPaused,
- libvlc_MediaPlayerEndReached,
- libvlc_MediaPlayerStopped,
- libvlc_MediaPlayerEncounteredError,
- libvlc_MediaPlayerTimeChanged,
- libvlc_MediaPlayerTitleChanged,
- libvlc_MediaPlayerPositionChanged,
- //libvlc_MediaPlayerSeekableChanged, //FIXME: doesn't work anymore? it asserts
- libvlc_MediaPlayerPausableChanged,
- };
- int i_nbEvents = sizeof(eventsMediaPlayer) / sizeof(*eventsMediaPlayer);
- for (int i = 0; i < i_nbEvents; i++) {
- libvlc_event_attach(p_vlc_media_player_event_manager, eventsMediaPlayer[i],
- libvlc_callback, this);
- }
-
-
- // Get event manager from media descriptor object
- p_vlc_media_event_manager = libvlc_media_event_manager(p_vlc_media);
- libvlc_event_type_t eventsMedia[] = {
- libvlc_MediaMetaChanged,
- libvlc_MediaSubItemAdded,
- libvlc_MediaDurationChanged,
- // FIXME libvlc does not know this event
-// libvlc_MediaPreparsedChanged,
- libvlc_MediaFreed,
- libvlc_MediaStateChanged,
- };
- i_nbEvents = sizeof(eventsMedia) / sizeof(*eventsMedia);
- for (int i = 0; i < i_nbEvents; i++) {
- libvlc_event_attach(p_vlc_media_event_manager, eventsMedia[i], libvlc_callback, this);
- }
-
- // Get event manager from media service discoverer object
- // FIXME why libvlc_media_discoverer_event_manager() does not take a libvlc_exception_t ?
-// p_vlc_media_discoverer_event_manager = libvlc_media_discoverer_event_manager(p_vlc_media_discoverer);
-// libvlc_event_type_t eventsMediaDiscoverer[] = {
-// libvlc_MediaDiscovererStarted,
-// libvlc_MediaDiscovererEnded
-// };
-// nbEvents = sizeof(eventsMediaDiscoverer) / sizeof(*eventsMediaDiscoverer);
-// for (int i = 0; i < nbEvents; i++) {
-// libvlc_event_attach(p_vlc_media_discoverer_event_manager, eventsMediaDiscoverer[i], libvlc_callback, this, vlc_exception);
-// }
-}
-
-void VLCMediaObject::libvlc_callback(const libvlc_event_t *p_event, void *p_user_data)
-{
- static int i_first_time_media_player_time_changed = 0;
- static bool b_media_player_title_changed = false;
-
- VLCMediaObject *p_vlc_mediaObject = (VLCMediaObject *) p_user_data;
-
-// qDebug() << (int)pp_vlc_mediaObject << "event:" << libvlc_event_type_name(event->type);
-
- // Media player events
- if (p_event->type == libvlc_MediaPlayerTimeChanged) {
-
- i_first_time_media_player_time_changed++;
-
- // FIXME It is ugly. It should be solved by some events in libvlc
- if (i_first_time_media_player_time_changed == 15) {
- // Update metadata
- p_vlc_mediaObject->updateMetaData();
-
- // Is this media player seekable
- bool b_seekable = libvlc_media_player_is_seekable(p_vlc_mediaObject->p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
- if (b_seekable != p_vlc_mediaObject->b_seekable) {
- qDebug() << "libvlc_callback(): isSeekable:" << b_seekable;
- p_vlc_mediaObject->b_seekable = b_seekable;
- emit p_vlc_mediaObject->seekableChanged(p_vlc_mediaObject->b_seekable);
- }
-
- // Get current video width
- int i_width = libvlc_video_get_width(p_vlc_mediaObject->p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
-
- // Get current video height
- int i_height = libvlc_video_get_height(p_vlc_mediaObject->p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
- emit p_vlc_mediaObject->videoWidgetSizeChanged(i_width, i_height);
-
- // Does this media player have a video output
- bool b_has_video = libvlc_media_player_has_vout(p_vlc_mediaObject->p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
- if (b_has_video != p_vlc_mediaObject->b_has_video) {
- p_vlc_mediaObject->b_has_video = b_has_video;
- emit p_vlc_mediaObject->hasVideoChanged(p_vlc_mediaObject->b_has_video);
- }
-
- if (b_has_video) {
- // Give info about audio tracks
- p_vlc_mediaObject->refreshAudioChannels();
- // Give info about subtitle tracks
- p_vlc_mediaObject->refreshSubtitles();
-
- // Get movie chapter count
- // It is not a title/chapter media if there is no chapter
- if (libvlc_media_player_get_chapter_count(
- p_vlc_mediaObject->p_vlc_media_player, vlc_exception) > 0) {
- vlcExceptionRaised();
- // Give info about title
- // only first time, no when title changed
- if (!b_media_player_title_changed) {
- libvlc_track_description_t *p_info = libvlc_video_get_title_description(
- p_vlc_mediaObject->p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
- while (p_info) {
- p_vlc_mediaObject->titleAdded(p_info->i_id, p_info->psz_name);
- p_info = p_info->p_next;
- }
- libvlc_track_description_release(p_info);
- }
-
- // Give info about chapters for actual title 0
- if (b_media_player_title_changed)
- p_vlc_mediaObject->refreshChapters(libvlc_media_player_get_title(
- p_vlc_mediaObject->p_vlc_media_player, vlc_exception));
- else
- p_vlc_mediaObject->refreshChapters(0);
- }
- if (b_media_player_title_changed)
- b_media_player_title_changed = false;
- }
-
- // Bugfix with Qt mediaplayer example
- // Now we are in playing state
- emit p_vlc_mediaObject->stateChanged(Phonon::PlayingState);
- }
-
- emit p_vlc_mediaObject->tickInternal(p_vlc_mediaObject->currentTime());
- }
-
- if (p_event->type == libvlc_MediaPlayerPlaying) {
- if (p_vlc_mediaObject->state() != Phonon::LoadingState) {
- // Bugfix with Qt mediaplayer example
- emit p_vlc_mediaObject->stateChanged(Phonon::PlayingState);
- }
- }
-
- if (p_event->type == libvlc_MediaPlayerPaused) {
- emit p_vlc_mediaObject->stateChanged(Phonon::PausedState);
- }
-
- if (p_event->type == libvlc_MediaPlayerEndReached) {
- i_first_time_media_player_time_changed = 0;
- p_vlc_mediaObject->clearMediaController();
- emit p_vlc_mediaObject->stateChanged(Phonon::StoppedState);
- emit p_vlc_mediaObject->finished();
- }
-
- if (p_event->type == libvlc_MediaPlayerStopped) {
- i_first_time_media_player_time_changed = 0;
- p_vlc_mediaObject->clearMediaController();
- emit p_vlc_mediaObject->stateChanged(Phonon::StoppedState);
- }
-
- if (p_event->type == libvlc_MediaPlayerTitleChanged) {
- i_first_time_media_player_time_changed = 0;
- b_media_player_title_changed = true;
- }
-
- // Media events
-
- if (p_event->type == libvlc_MediaDurationChanged) {
- // Get duration of media descriptor object item
- libvlc_time_t totalTime = libvlc_media_get_duration(p_vlc_mediaObject->p_vlc_media, vlc_exception);
- vlcExceptionRaised();
-
- if (totalTime != p_vlc_mediaObject->i_total_time) {
- p_vlc_mediaObject->i_total_time = totalTime;
- emit p_vlc_mediaObject->totalTimeChanged(p_vlc_mediaObject->i_total_time);
- }
- }
-
- if (p_event->type == libvlc_MediaMetaChanged) {
- }
-}
-
-void VLCMediaObject::updateMetaData()
-{
- QMultiMap<QString, QString> metaDataMap;
-
- metaDataMap.insert(QLatin1String("ARTIST"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_Artist)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("ALBUM"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_Album)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("TITLE"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_Title)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("DATE"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_Date)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("GENRE"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_Genre)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("TRACKNUMBER"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_TrackNumber)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("DESCRIPTION"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_Description)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("COPYRIGHT"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_TrackNumber)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("URL"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_URL)));
- vlcExceptionRaised();
- metaDataMap.insert(QLatin1String("ENCODEDBY"),
- QString::fromUtf8(libvlc_media_get_meta(p_vlc_media, libvlc_meta_EncodedBy)));
-
- qDebug() << "updateMetaData(): artist:"
- << libvlc_media_get_meta(p_vlc_media, libvlc_meta_Artist);
- vlcExceptionRaised();
- qDebug() << "updateMetaData(): title:"
- << libvlc_media_get_meta(p_vlc_media, libvlc_meta_Title);
- vlcExceptionRaised();
-
- emit metaDataChanged(metaDataMap);
-}
-
-qint64 VLCMediaObject::totalTime() const
-{
- return i_total_time;
-}
-
-qint64 VLCMediaObject::currentTimeInternal() const
-{
- libvlc_time_t time = libvlc_media_player_get_time(p_vlc_media_player, vlc_exception);
- vlcExceptionRaised();
-
- return time;
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_VLCMEDIAOBJECT_H
-#define PHONON_VLC_VLCMEDIAOBJECT_H
-
-#include "vlcmediacontroller.h"
-
-#include "mediaobject.h"
-
-#include <phonon/mediaobjectinterface.h>
-#include <phonon/addoninterface.h>
-
-#include <QtCore/QObject>
-#include <QtCore/QString>
-#include <QtCore/QMultiMap>
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * VLC MediaObject.
- *
- * This is the "brain" of the VLC backend.
- * VLCMediaObject uses libvlc in order to send commands and receive events from the VLC.
- *
- * Encapsulates VLC specific code.
- * Take care of libvlc events via libvlc_callback()
- *
- * @see MediaObject
- */
-class VLCMediaObject : public MediaObject, public VLCMediaController
-{
- Q_OBJECT
- Q_INTERFACES(Phonon::MediaObjectInterface Phonon::AddonInterface)
-
-public:
-
- VLCMediaObject(QObject * parent);
- ~VLCMediaObject();
-
- void pause();
- void stop();
-
- bool hasVideo() const;
- bool isSeekable() const;
-
- qint64 totalTime() const;
-
- QString errorString() const;
-
-signals:
-
- // MediaController signals
- void availableSubtitlesChanged();
- void availableAudioChannelsChanged();
-
-// void availableChaptersChanged();
-// void availableTitlesChanged();
- void availableChaptersChanged(int);
- void availableTitlesChanged(int);
-
- void availableAnglesChanged(int availableAngles);
- void angleChanged(int angleNumber);
- void chapterChanged(int chapterNumber);
- void titleChanged(int titleNumber);
-
- /**
- * New widget size computed by VLC.
- *
- * It should be applied to the widget that contains the VLC video.
- */
- void videoWidgetSizeChanged(int i_width, int i_height);
-
-protected:
-
- void loadMediaInternal(const QString & filename);
- void playInternal();
- void seekInternal(qint64 milliseconds);
-
- qint64 currentTimeInternal() const;
-
-private:
-
- /**
- * Connect libvlc_callback() to all vlc events.
- *
- * @see libvlc_callback()
- */
- void connectToAllVLCEvents();
-
- /**
- * Retrieve meta data of a file (i.e ARTIST, TITLE, ALBUM, etc...).
- */
- void updateMetaData();
-
- /**
- * Libvlc callback.
- *
- * Receive all vlc events.
- *
- * Warning: owned by libvlc thread.
- *
- * @see connectToAllVLCEvents()
- * @see libvlc_event_attach()
- */
- static void libvlc_callback(const libvlc_event_t *p_event, void *p_user_data);
-
- void unloadMedia();
-
- void setVLCWidgetId();
-
- // MediaPlayer
-// libvlc_media_player_t * p_vlc_media_player;
- libvlc_event_manager_t * p_vlc_media_player_event_manager;
-
- // Media
- libvlc_media_t * p_vlc_media;
- libvlc_event_manager_t * p_vlc_media_event_manager;
-
- // MediaDiscoverer
- libvlc_media_discoverer_t * p_vlc_media_discoverer;
- libvlc_event_manager_t * p_vlc_media_discoverer_event_manager;
-
- bool b_play_request_reached;
-
- qint64 i_total_time;
-
- bool b_has_video;
-
- bool b_seekable;
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "vlcvideowidget.h"
-
-#include <QtGui/QResizeEvent>
-#include <QtCore/QDebug>
-
-namespace Phonon
-{
-namespace VLC {
-
-VLCVideoWidget::VLCVideoWidget(QWidget *p_parent)
- : WidgetNoPaintEvent(p_parent)
-{
- // Set background color
- setBackgroundColor(Qt::black);
-}
-
-VLCVideoWidget::~VLCVideoWidget()
-{
-}
-
-void VLCVideoWidget::resizeEvent(QResizeEvent *p_event)
-{
- qDebug() << "resizeEvent" << p_event->size();
-}
-
-void VLCVideoWidget::setAspectRatio(double f_aspect_ratio)
-{
-}
-
-void VLCVideoWidget::setScaleAndCropMode(bool b_scale_and_crop)
-{
-}
-
-void VLCVideoWidget::setVideoSize(const QSize & size)
-{
- videoSize = size;
-}
-
-QSize VLCVideoWidget::sizeHint() const
-{
- return videoSize;
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_VLCVIDEOWIDGET_H
-#define PHONON_VLC_VLCVIDEOWIDGET_H
-
-#include "widgetnopaintevent.h"
-
-#include <QtGui/QWidget>
-
-class QResizeEvent;
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * Widget where to show VLC video.
- */
-class VLCVideoWidget : public WidgetNoPaintEvent
-{
- Q_OBJECT
-public:
-
- VLCVideoWidget(QWidget *p_parent);
- ~VLCVideoWidget();
-
- void setVideoSize(const QSize & videoSize);
- void setAspectRatio(double f_aspect_ratio);
- void setScaleAndCropMode(bool b_scale_and_crop);
-
- QSize sizeHint() const;
-
-private:
-
- void resizeEvent(QResizeEvent *p_event);
-
- /**
- * Original size of the video, needed for sizeHint().
- */
- QSize videoSize;
-};
-
-}
-} // Namespace Phonon::VLC_MPlayer
-
-#endif // PHONON_VLC_MPLAYER_VLCVIDEOWIDGET_H
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#include "widgetnopaintevent.h"
-
-#include <QtGui/QPainter>
-
-namespace Phonon
-{
-namespace VLC {
-
-WidgetNoPaintEvent::WidgetNoPaintEvent(QWidget *p_parent)
- : QWidget(p_parent)
-{
- // When resizing fill with black (backgroundRole color) the rest is done by paintEvent
- setAttribute(Qt::WA_OpaquePaintEvent);
-
- // Disable Qt composition management as MPlayer draws onto the widget directly
- setAttribute(Qt::WA_PaintOnScreen);
-
- // Indicates that the widget has no background,
- // i.e. when the widget receives paint events, the background is not automatically repainted.
- setAttribute(Qt::WA_NoSystemBackground);
-
- // Required for dvdnav
- setMouseTracking(true);
-}
-
-void WidgetNoPaintEvent::paintEvent(QPaintEvent *p_event)
-{
- // FIXME this makes the video flicker
- // Make everything backgroundRole color
- QPainter painter(this);
- painter.eraseRect(rect());
-}
-
-void WidgetNoPaintEvent::setBackgroundColor(const QColor & color)
-{
- QPalette p = palette();
- p.setColor(backgroundRole(), color);
- setPalette(p);
-}
-
-}
-} // Namespace Phonon::VLC
+++ /dev/null
-/*****************************************************************************
- * VLC backend for the Phonon library *
- * Copyright (C) 2007-2008 Tanguy Krotoff <tkrotoff@gmail.com> *
- * Copyright (C) 2008 Lukas Durfina <lukas.durfina@gmail.com> *
- * Copyright (C) 2009 Fathi Boudra <fabo@kde.org> *
- * *
- * This program is free software; you can redistribute it and/or *
- * modify it under the terms of the GNU Lesser General Public *
- * License as published by the Free Software Foundation; either *
- * version 3 of the License, or (at your option) any later version. *
- * *
- * This program is distributed in the hope that it will be useful, *
- * but WITHOUT ANY WARRANTY; without even the implied warranty of *
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
- * Lesser General Public License for more details. *
- * *
- * You should have received a copy of the GNU Lesser General Public *
- * License along with this package; if not, write to the Free Software *
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA *
- *****************************************************************************/
-
-#ifndef PHONON_VLC_WIDGETNOPAINTEVENT_H
-#define PHONON_VLC_WIDGETNOPAINTEVENT_H
-
-#include <QtGui/QWidget>
-
-namespace Phonon
-{
-namespace VLC {
-
-/**
- * Utility class: special widget for playing videos.
- *
- * Does not handle paintEvent()
- */
-class WidgetNoPaintEvent : public QWidget
-{
- Q_OBJECT
-public:
-
- WidgetNoPaintEvent(QWidget *p_parent);
-
- /**
- * Sets the background color.
- *
- * I don't know which one is best: 0x020202 or Qt::black...
- */
- void setBackgroundColor(const QColor & color);
-
-private:
-
- void paintEvent(QPaintEvent *p_event);
-};
-
-}
-} // Namespace Phonon::VLC
-
-#endif // PHONON_VLC_WIDGETNOPAINTEVENT_H
+++ /dev/null
-package org.videolan.jvlc.internal;
-
-import com.sun.jna.Callback;
-import com.sun.jna.Library;
-import com.sun.jna.Native;
-import com.sun.jna.NativeLong;
-import com.sun.jna.Platform;
-import com.sun.jna.Pointer;
-import com.sun.jna.PointerType;
-import com.sun.jna.Structure;
-import com.sun.jna.Union;
-
-
-public interface LibVlc extends Library
-{
- LibVlc INSTANCE = (LibVlc) Native.loadLibrary(Platform.isWindows()? "libvlc" : "vlc", LibVlc.class);
-
- LibVlc SYNC_INSTANCE = (LibVlc) Native.synchronizedLibrary(INSTANCE);
-
- public static class libvlc_exception_t extends Structure
- {
- public int b_raised;
- }
-
- public static class libvlc_log_message_t extends Structure
- {
-
- public int sizeof_msg; /* sizeof() of message structure, must be filled in by user */
-
- public int i_severity; /* 0=INFO, 1=ERR, 2=WARN, 3=DBG */
-
- public String psz_type; /* module type */
-
- public String psz_name; /* module name */
-
- public String psz_header; /* optional header */
-
- public String psz_message; /* message */
- }
-
- public static class libvlc_event_t extends Structure
- {
-
- public int type;
-
- public Pointer p_obj;
-
- public event_type_specific event_type_specific;
-
- }
-
- public class media_meta_changed extends Structure
- {
- // Enum !
- public Pointer meta_type;
- }
-
- public class media_subitem_added extends Structure
- {
-
- public LibVlcMedia new_child;
- }
-
- public class media_duration_changed extends Structure
- {
-
- public NativeLong new_duration;
- }
-
- public class media_preparsed_changed extends Structure
- {
-
- public int new_status;
- }
-
- public class media_freed extends Structure
- {
-
- public LibVlcMedia md;
- }
-
- public class media_state_changed extends Structure
- {
-
- // @todo: check this one
- public int new_state;
- }
-
- /* media instance */
-
- public class media_player_position_changed extends Structure
- {
-
- public float new_position;
- }
-
- public class media_player_time_changed extends Structure
- {
-
- // @todo: check this one
- public long new_time;
- }
-
- public class media_player_title_changed extends Structure
- {
- public int new_title;
- }
-
- public class media_player_seekable_changed extends Structure
- {
- public NativeLong new_seekable;
- }
-
- public class media_player_pausable_changed extends Structure
- {
- public NativeLong new_pausable;
- }
-
- /* media list */
- public class media_list_item_added extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_will_add_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_item_deleted extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_will_delete_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- /* media list view */
- public class media_list_view_item_added extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_view_will_add_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_view_item_deleted extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_view_will_delete_item extends Structure
- {
-
- public LibVlcMedia item;
-
- public int index;
- }
-
- public class media_list_player_next_item_set extends Structure
- {
- public LibVlcMedia item;
- }
-
- public class media_player_snapshot_taken extends Structure
- {
- public String psz_filename;
- }
-
- public class media_player_length_changed extends Structure
- {
- // @todo: check the type
- public long new_length;
- }
-
- public class vlm_media_event extends Structure
- {
- public String psz_media_name;
- public String psz_instance_name;
- }
-
- public class event_type_specific extends Union
- {
-
- public media_meta_changed media_meta_changed;
-
- public media_subitem_added media_subitem_added;
-
- public media_duration_changed media_duration_changed;
-
- public media_preparsed_changed media_preparsed_changed;
-
- public media_freed media_freed;
-
- public media_state_changed media_state_changed;
-
- public media_player_position_changed media_player_position_changed;
-
- public media_player_time_changed media_player_time_changed;
-
- public media_player_title_changed media_player_title_changed;
-
- public media_player_seekable_changed media_player_seekable_changed;
-
- public media_player_pausable_changed media_player_pausable_changed;
-
- public media_list_item_added media_list_item_added;
-
- public media_list_will_add_item media_list_will_add_item;
-
- public media_list_item_deleted media_list_item_deleted;
-
- public media_list_will_delete_item media_list_will_delete_item;
-
- public media_list_view_item_added media_list_view_item_added;
-
- public media_list_view_will_add_item media_list_view_will_add_item;
-
- public media_list_view_item_deleted media_list_view_item_deleted;
-
- public media_list_view_will_delete_item media_list_view_will_delete_item;
-
- public media_list_player_next_item_set media_list_player_next_item_set;
-
- public media_player_snapshot_taken media_player_snapshot_taken;
-
- public media_player_length_changed media_player_length_changed;
-
- public vlm_media_event vlm_media_event;
- }
+++ /dev/null
-MODULE_NAME=vlc.py
-
-all: $(MODULE_NAME)
-
-$(MODULE_NAME): generate.py header.py footer.py override.py ../../include/vlc/*.h
- python generate.py ../../include/vlc/*.h > $@
-
-doc: $(MODULE_NAME)
- -epydoc -v -o doc $<
-
-test: $(MODULE_NAME)
- python test.py
-
-check: $(MODULE_NAME)
- -pyflakes $<
- -pylint $<
-
-clean:
- -$(RM) $(MODULE_NAME)
+++ /dev/null
-* Python ctypes-based and java bindings
-
-The bindings use ctypes to directly call the libvlc dynamic lib, and
-the code is generated from the include files defining the public API.
-
-** Building
-
-To generate the vlc.py module and its documentation, use
-make
-
-Documentation building needs epydoc.
-
-** Layout
-
-The module offers two ways of accessing the API - a raw access to all
-exported methods, and more convenient wrapper classes :
-
-- Raw access: methods are available as attributes of the vlc
- module. Use their docstring (any introspective shell like ipython is
- your friends) to explore them.
-
-- Wrapper classes: most major structures of the libvlc API (Instance,
- Media, MediaPlayer, etc) are wrapped as classes, with shorter method
- names.
-
-** Using the module
-
-On win32, the simplest way is to put the vlc.py file in the same
-directory as the libvlc.dll file (standard location:
-c:\Program Files\VideoLAN\VLC ).
-
-
-- Using raw access:
-
->>> import vlc
->>> vlc.libvlc_get_version()
-'1.0.0 Goldeneye'
->>> e=vlc.VLCException()
->>> i=vlc.libvlc_new(0, [], e)
->>> i
-<vlc.Instance object at 0x8384a4c>
->>> vlc.libvlc_audio_get_volume(i,e)
-50
-
-- Using wrapper classes:
-
->>> import vlc
->>> i=vlc.Instance('--no-audio', '--fullscreen')
->>> i.audio_get_volume()
-50
->>> m=i.media_new('/tmp/foo.avi')
->>> m.get_mrl()
-'/tmp/foo.avi'
->>> p=i.media_player_new(m)
->>> p.play()
-
-or shorter:
->>> import vlc
->>> p=vlc.MediaPlayer('/tmp/foo.avi')
->>> p.play()
+++ /dev/null
-* Investigate memory management
-
-* Support multiple VLC versions: define a front-end module which will
- load the appropriate versionned module from a subdirectory.
+++ /dev/null
-/*****************************************************************************
- * VLC Java Bindings JNA Glue
- *****************************************************************************
- * Copyright (C) 1998-2009 the VideoLAN team
- *
- * Authors: Filippo Carone <filippo@carone.org>
- * VLC bindings generator
- *
- *
- * $Id $
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
- *****************************************************************************/
-
+++ /dev/null
-### Start of footer.py ###
-
-class MediaEvent(ctypes.Structure):
- _fields_ = [
- ('media_name', ctypes.c_char_p),
- ('instance_name', ctypes.c_char_p),
- ]
-
-class EventUnion(ctypes.Union):
- _fields_ = [
- ('meta_type', ctypes.c_uint),
- ('new_child', ctypes.c_uint),
- ('new_duration', ctypes.c_longlong),
- ('new_status', ctypes.c_int),
- ('media', ctypes.c_void_p),
- ('new_state', ctypes.c_uint),
- # Media instance
- ('new_position', ctypes.c_float),
- ('new_time', ctypes.c_longlong),
- ('new_title', ctypes.c_int),
- ('new_seekable', ctypes.c_longlong),
- ('new_pausable', ctypes.c_longlong),
- # FIXME: Skipped MediaList and MediaListView...
- ('filename', ctypes.c_char_p),
- ('new_length', ctypes.c_longlong),
- ('media_event', MediaEvent),
- ]
-
-class Event(ctypes.Structure):
- _fields_ = [
- ('type', EventType),
- ('object', ctypes.c_void_p),
- ('u', EventUnion),
- ]
-
-# Decorator for callback methods
-callbackmethod=ctypes.CFUNCTYPE(None, Event, ctypes.c_void_p)
-
-# Example callback method
-@callbackmethod
-def debug_callback(event, data):
- print "Debug callback method"
- print "Event:", event.type
- print "Data", data
-
-if __name__ == '__main__':
- try:
- from msvcrt import getch
- except ImportError:
- def getch():
- import tty
- import termios
- fd=sys.stdin.fileno()
- old_settings=termios.tcgetattr(fd)
- try:
- tty.setraw(fd)
- ch=sys.stdin.read(1)
- finally:
- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
- return ch
-
- @callbackmethod
- def end_callback(event, data):
- print "End of stream"
- sys.exit(0)
-
- if sys.argv[1:]:
- instance=Instance()
- media=instance.media_new(sys.argv[1])
- player=instance.media_player_new()
- player.set_media(media)
- player.play()
-
- event_manager=player.event_manager()
- event_manager.event_attach(EventType.MediaPlayerEndReached, end_callback, None)
-
- def print_info():
- """Print information about the media."""
- media=player.get_media()
- print "State:", player.get_state()
- print "Media:", media.get_mrl()
- try:
- print "Current time:", player.get_time(), "/", media.get_duration()
- print "Position:", player.get_position()
- print "FPS:", player.get_fps()
- print "Rate:", player.get_rate()
- print "Video size: (%d, %d)" % (player.video_get_width(), player.video_get_height())
- except Exception:
- pass
-
- def forward():
- """Go forward 1s"""
- player.set_time(player.get_time() + 1000)
-
- def one_frame_forward():
- """Go forward one frame"""
- player.set_time(player.get_time() + long(1000 / (player.get_fps() or 25)))
-
- def one_frame_backward():
- """Go backward one frame"""
- player.set_time(player.get_time() - long(1000 / (player.get_fps() or 25)))
-
- def backward():
- """Go backward 1s"""
- player.set_time(player.get_time() - 1000)
-
- def print_help():
- """Print help
- """
- print "Commands:"
- for k, m in keybindings.iteritems():
- print " %s: %s" % (k, (m.__doc__ or m.__name__).splitlines()[0])
- print " 1-9: go to the given fraction of the movie"
-
- def quit_app():
- """Exit."""
- sys.exit(0)
-
- keybindings={
- 'f': player.toggle_fullscreen,
- ' ': player.pause,
- '+': forward,
- '-': backward,
- '.': one_frame_forward,
- ',': one_frame_backward,
- '?': print_help,
- 'i': print_info,
- 'q': quit_app,
- }
-
- print "Press q to quit, ? to get help."
- while True:
- k=getch()
- o=ord(k)
- method=keybindings.get(k, None)
- if method is not None:
- method()
- elif o >= 49 and o <= 57:
- # Numeric value. Jump to a fraction of the movie.
- v=0.1*(o-48)
- player.set_position(v)
-
-
+++ /dev/null
-#! /usr/bin/python
-debug=False
-
-#
-# Code generator for python ctypes bindings for VLC
-# Copyright (C) 2009 the VideoLAN team
-# $Id: $
-#
-# Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-#
-
-"""This module parses VLC public API include files and generates
-corresponding python/ctypes code. Moreover, it generates class
-wrappers for most methods.
-"""
-
-import sys
-import os
-import re
-import time
-import operator
-import itertools
-from optparse import OptionParser
-
-# DefaultDict from ASPN python cookbook
-import copy
-class DefaultDict(dict):
- """Dictionary with a default value for unknown keys."""
- def __init__(self, default=None, **items):
- dict.__init__(self, **items)
- self.default = default
-
- def __getitem__(self, key):
- if key in self:
- return self.get(key)
- else:
- ## Need copy in case self.default is something like []
- return self.setdefault(key, copy.deepcopy(self.default))
-
- def __copy__(self):
- return DefaultDict(self.default, **self)
-
-# Methods not decorated/not referenced
-blacklist=[
- "libvlc_exception_raise",
- "libvlc_exception_raised",
- "libvlc_exception_get_message",
- "libvlc_get_vlc_instance",
-
- "libvlc_media_list_view_index_of_item",
- "libvlc_media_list_view_insert_at_index",
- "libvlc_media_list_view_remove_at_index",
- "libvlc_media_list_view_add_item",
-
- # In svn but not in current 1.0.0.
- #"libvlc_media_add_option_flag",
- #'libvlc_video_set_deinterlace',
- #'libvlc_video_get_marquee_int',
- #'libvlc_video_get_marquee_string',
- #'libvlc_video_set_marquee_int',
- #'libvlc_video_set_marquee_string',
- #'libvlc_vlm_get_event_manager',
- #"libvlc_media_list_player_event_manager",
- #'libvlc_media_player_next_frame',
-
- 'mediacontrol_PlaylistSeq__free',
- ]
-
-# Precompiled regexps
-api_re=re.compile('VLC_PUBLIC_API\s+(\S+\s+.+?)\s*\(\s*(.+?)\s*\)')
-param_re=re.compile('\s*(const\s*|unsigned\s*|struct\s*)?(\S+\s*\**)\s+(.+)')
-paramlist_re=re.compile('\s*,\s*')
-comment_re=re.compile('\\param\s+(\S+)')
-python_param_re=re.compile('(@param\s+\S+)(.+)')
-forward_re=re.compile('.+\(\s*(.+?)\s*\)(\s*\S+)')
-enum_re=re.compile('typedef\s+(enum)\s*(\S+\s*)?\{\s*(.+)\s*\}\s*(\S+);')
-special_enum_re=re.compile('^(enum)\s*(\S+\s*)?\{\s*(.+)\s*\};')
-event_def_re=re.compile('^DEF\(\s*(\w+)\s*\)')
-
-# Definition of parameter passing mode for types. This should not be
-# hardcoded this way, but works alright ATM.
-parameter_passing=DefaultDict(default=1)
-parameter_passing['libvlc_exception_t*']=3
-
-class Parser(object):
- def __init__(self, list_of_files):
- self.methods=[]
- self.enums=[]
-
- for name in list_of_files:
- self.enums.extend(self.parse_typedef(name))
- self.methods.extend(self.parse_include(name))
-
- def parse_param(self, s):
- """Parse a C parameter expression.
-
- It is used to parse both the type/name for methods, and type/name
- for their parameters.
-
- It returns a tuple (type, name).
- """
- s=s.strip()
- s=s.replace('const', '')
- if 'VLC_FORWARD' in s:
- m=forward_re.match(s)
- s=m.group(1)+m.group(2)
- m=param_re.search(s)
- if m:
- const, typ, name=m.groups()
- while name.startswith('*'):
- typ += '*'
- name=name[1:]
- if name == 'const*':
- # K&R definition: const char * const*
- name=''
- typ=typ.replace(' ', '')
- return typ, name
- else:
- # K&R definition: only type
- return s.replace(' ', ''), ''
-
- def parse_typedef(self, name):
- """Parse include file for typedef expressions.
-
- This generates a tuple for each typedef:
- (type, name, value_list, comment)
- with type == 'enum' (for the moment) and value_list being a list of (name, value)
- Note that values are string, since this is intended for code generation.
- """
- event_names=[]
-
- f=open(name, 'r')
- accumulator=''
- for l in f:
- # Note: lstrip() should not be necessary, but there is 1 badly
- # formatted comment in vlc1.0.0 includes
- if l.lstrip().startswith('/**'):
- comment=''
- continue
- elif l.startswith(' * '):
- comment = comment + l[3:]
- continue
-
- l=l.strip()
- if l.startswith('/*') or l.endswith('*/'):
- continue
-
- if (l.startswith('typedef enum') or l.startswith('enum')) and not l.endswith(';'):
- # Multiline definition. Accumulate until end of definition
- accumulator=l
- continue
- elif accumulator:
- accumulator=" ".join( (accumulator, l) )
- if l.endswith(';'):
- # End of definition
- l=accumulator
- accumulator=''
-
- m=enum_re.match(l)
- if m:
- values=[]
- (typ, dummy, data, name)=m.groups()
- for i, l in enumerate(paramlist_re.split(data)):
- l=l.strip()
- if l.startswith('/*'):
- continue
- if '=' in l:
- # A value was specified. Use it.
- values.append(re.split('\s*=\s*', l))
- else:
- if l:
- values.append( (l, str(i)) )
- comment=comment.replace('@{', '').replace('@see', 'See').replace('\ingroup', '')
- yield (typ, name.strip(), values, comment)
- comment=''
- continue
-
- # Special case, used only for libvlc_events.h
- # (version after 96a96f60bb0d1f2506e68b356897ceca6f6b586d)
- m=event_def_re.match(l)
- if m:
- # Event definition.
- event_names.append('libvlc_'+m.group(1))
- continue
-
- # Special case, used only for libvlc_events.h
- m=special_enum_re.match(l)
- if m:
- (typ, name, data)=m.groups()
- if event_names:
- # event_names were defined through DEF macro
- # (see 96a96f60bb0d1f2506e68b356897ceca6f6b586d)
- values=list( (n, str(i)) for i, n in enumerate(event_names))
- else:
- # Before 96a96f60bb0d1f2506e68b356897ceca6f6b586d
- values=[]
- for i, l in enumerate(paramlist_re.split(data)):
- l=l.strip()
- if l.startswith('/*') or l.startswith('#'):
- continue
- if '=' in l:
- # A value was specified. Use it.
- values.append(re.split('\s*=\s*', l))
- else:
- if l:
- values.append( (l, str(i)) )
- comment=comment.replace('@{', '').replace('@see', 'See').replace('\ingroup', '')
- yield (typ, name.strip(), values, comment)
- comment=''
- continue
-
- def parse_include(self, name):
- """Parse include file.
-
- This generates a tuple for each function:
- (return_type, method_name, parameter_list, comment)
- with parameter_list being a list of tuples (parameter_type, parameter_name).
- """
- f=open(name, 'r')
- accumulator=''
- comment=''
- for l in f:
- # Note: lstrip() should not be necessary, but there is 1 badly
- # formatted comment in vlc1.0.0 includes
- if l.lstrip().startswith('/**'):
- comment=''
- continue
- elif l.startswith(' * '):
- comment = comment + l[3:]
- continue
-
- l=l.strip()
-
- if accumulator:
- accumulator=" ".join( (accumulator, l) )
- if l.endswith(');'):
- # End of definition
- l=accumulator
- accumulator=''
- elif l.startswith('VLC_PUBLIC_API') and not l.endswith(');'):
- # Multiline definition. Accumulate until end of definition
- accumulator=l
- continue
-
- m=api_re.match(l)
- if m:
- (ret, param)=m.groups()
-
- rtype, method=self.parse_param(ret)
-
- params=[]
- for p in paramlist_re.split(param):
- params.append( self.parse_param(p) )
-
- if len(params) == 1 and params[0][0] == 'void':
- # Empty parameter list
- params=[]
-
- if list(p for p in params if not p[1]):
- # Empty parameter names. Have to poke into comment.
- names=comment_re.findall(comment)
- if len(names) < len(params):
- # Bad description: all parameters are not specified.
- # Generate default parameter names
- badnames=[ "param%d" % i for i in xrange(len(params)) ]
- # Put in the existing ones
- for (i, p) in enumerate(names):
- badnames[i]=names[i]
- names=badnames
- print "### Error ###"
- print "### Cannot get parameter names from comment for %s: %s" % (method, comment.replace("\n", ' '))
- # Note: this was previously
- # raise Exception("Cannot get parameter names from comment for %s: %s" % (method, comment))
- # but it prevented code generation for a minor detail (some bad descriptions).
- params=[ (p[0], names[i]) for (i, p) in enumerate(params) ]
-
- # Transform Doxygen syntax into epydoc syntax
- comment=comment.replace('\\param', '@param').replace('\\return', '@return')
-
- if debug:
- print '********************'
- print l
- print '-------->'
- print "%s (%s)" % (method, rtype)
- for typ, name in params:
- print " %s (%s)" % (name, typ)
- print '********************'
- yield (rtype,
- method,
- params,
- comment)
- comment=''
-
- def dump_methods(self):
- print "** Defined functions **"
- for (rtype, name, params, comment) in self.methods:
- print "%(name)s (%(rtype)s):" % locals()
- for t, n in params:
- print " %(n)s (%(t)s)" % locals()
-
- def dump_enums(self):
- print "** Defined enums **"
- for (typ, name, values, comment) in self.enums:
- print "%(name)s (%(typ)s):" % locals()
- for k, v in values:
- print " %(k)s=%(v)s" % locals()
-
-class PythonGenerator(object):
- # C-type to ctypes/python type conversion.
- # Note that enum types conversions are generated (cf convert_enum_names)
- type2class={
- 'libvlc_exception_t*': 'ctypes.POINTER(VLCException)',
-
- 'libvlc_media_player_t*': 'MediaPlayer',
- 'libvlc_instance_t*': 'Instance',
- 'libvlc_media_t*': 'Media',
- 'libvlc_log_t*': 'Log',
- 'libvlc_log_iterator_t*': 'LogIterator',
- 'libvlc_log_message_t*': 'ctypes.POINTER(LogMessage)',
- 'libvlc_event_type_t': 'ctypes.c_uint',
- 'libvlc_event_manager_t*': 'EventManager',
- 'libvlc_media_discoverer_t*': 'MediaDiscoverer',
- 'libvlc_media_library_t*': 'MediaLibrary',
- 'libvlc_media_list_t*': 'MediaList',
- 'libvlc_media_list_player_t*': 'MediaListPlayer',
- 'libvlc_media_list_view_t*': 'MediaListView',
- 'libvlc_track_description_t*': 'TrackDescription',
- 'libvlc_audio_output_t*': 'AudioOutput',
- 'libvlc_media_stats_t*': 'ctypes.POINTER(MediaStats)',
- 'libvlc_media_es_t**': 'ctypes.POINTER(ctypes.POINTER(MediaES))',
-
- 'mediacontrol_Instance*': 'MediaControl',
- 'mediacontrol_Exception*': 'MediaControlException',
- 'mediacontrol_RGBPicture*': 'ctypes.POINTER(RGBPicture)',
- 'mediacontrol_PlaylistSeq*': 'MediaControlPlaylistSeq',
- 'mediacontrol_Position*': 'ctypes.POINTER(MediaControlPosition)',
- 'mediacontrol_StreamInformation*': 'ctypes.POINTER(MediaControlStreamInformation)',
- 'WINDOWHANDLE': 'ctypes.c_ulong',
-
- 'void': 'None',
- 'void*': 'ctypes.c_void_p',
- 'short': 'ctypes.c_short',
- 'char*': 'ctypes.c_char_p',
- 'char**': 'ListPOINTER(ctypes.c_char_p)',
- 'uint32_t': 'ctypes.c_uint',
- 'float': 'ctypes.c_float',
- 'unsigned': 'ctypes.c_uint',
- 'int': 'ctypes.c_int',
- '...': 'FIXMEva_list',
- 'libvlc_callback_t': 'ctypes.c_void_p',
- 'libvlc_time_t': 'ctypes.c_longlong',
- }
-
- # Defined python classes, i.e. classes for which we want to generate
- # class wrappers around libvlc functions
- defined_classes=(
- 'MediaPlayer',
- 'Instance',
- 'Media',
- 'Log',
- 'LogIterator',
- 'EventManager',
- 'MediaDiscoverer',
- 'MediaLibrary',
- 'MediaList',
- 'MediaListPlayer',
- 'MediaListView',
- 'TrackDescription',
- 'AudioOutput',
- 'MediaControl',
- )
-
- def __init__(self, parser=None):
- self.parser=parser
-
- # Generate python names for enums
- self.type2class.update(self.convert_enum_names(parser.enums))
- self.check_types()
-
- # Definition of prefixes that we can strip from method names when
- # wrapping them into class methods
- self.prefixes=dict( (v, k[:-2])
- for (k, v) in self.type2class.iteritems()
- if v in self.defined_classes )
- self.prefixes['MediaControl']='mediacontrol_'
-
- def save(self, filename=None):
- if filename is None or filename == '-':
- self.fd=sys.stdout
- else:
- self.fd=open(filename, 'w')
-
- self.insert_code('header.py')
- wrapped_methods=self.generate_wrappers(self.parser.methods)
- for l in self.parser.methods:
- self.output_ctypes(*l)
- self.insert_code('footer.py')
-
- all_methods=set( t[1] for t in self.parser.methods )
- not_wrapped=all_methods.difference(wrapped_methods)
- self.output("# Not wrapped methods:")
- for m in not_wrapped:
- self.output("# ", m)
-
- if self.fd != sys.stdout:
- self.fd.close()
-
- def output(self, *p):
- self.fd.write(" ".join(p))
- self.fd.write("\n")
-
- def check_types(self):
- """Make sure that all types are properly translated.
-
- This method must be called *after* convert_enum_names, since
- the latter populates type2class with converted enum names.
- """
- for (rt, met, params, c) in self.parser.methods:
- for typ, name in params:
- if not typ in self.type2class:
- raise Exception("No conversion for %s (from %s:%s)" % (typ, met, name))
-
- def insert_code(self, filename):
- """Generate header/footer code.
- """
- f=open(filename, 'r')
- for l in f:
- if l.startswith('build_date'):
- self.output('build_date="%s"' % time.ctime())
- elif l.startswith('# GENERATED_ENUMS'):
- self.generate_enums(self.parser.enums)
- else:
- self.output(l.rstrip())
-
- f.close()
-
- def convert_enum_names(self, enums):
- res={}
- for (typ, name, values, comment) in enums:
- if typ != 'enum':
- raise Exception('This method only handles enums')
- pyname=re.findall('(libvlc|mediacontrol)_(.+?)(_t)?$', name)[0][1]
- if '_' in pyname:
- pyname=pyname.title().replace('_', '')
- elif not pyname[0].isupper():
- pyname=pyname.capitalize()
- res[name]=pyname
- return res
-
- def generate_enums(self, enums):
- for (typ, name, values, comment) in enums:
- if typ != 'enum':
- raise Exception('This method only handles enums')
- pyname=self.type2class[name]
-
- self.output("class %s(ctypes.c_ulong):" % pyname)
- self.output(' """%s\n """' % comment)
-
- conv={}
- # Convert symbol names
- for k, v in values:
- n=k.split('_')[-1]
- if len(n) == 1:
- # Single character. Some symbols use 1_1, 5_1, etc.
- n="_".join( k.split('_')[-2:] )
- if re.match('^[0-9]', n):
- # Cannot start an identifier with a number
- n='_'+n
- conv[k]=n
-
- self.output(" _names={")
- for k, v in values:
- self.output(" %s: '%s'," % (v, conv[k]))
- self.output(" }")
-
- self.output("""
- def __repr__(self):
- return ".".join((self.__class__.__module__, self.__class__.__name__, self._names[self.value]))
-
- def __eq__(self, other):
- return ( (isinstance(other, ctypes.c_ulong) and self.value == other.value)
- or (isinstance(other, (int, long)) and self.value == other ) )
-
- def __ne__(self, other):
- return not self.__eq__(other)
- """)
- for k, v in values:
- self.output("%(class)s.%(attribute)s=%(class)s(%(value)s)" % {
- 'class': pyname,
- 'attribute': conv[k],
- 'value': v
- })
- self.output("")
-
- def output_ctypes(self, rtype, method, params, comment):
- """Output ctypes decorator for the given method.
- """
- if method in blacklist:
- # FIXME
- return
-
- self.output("""if hasattr(dll, '%s'):""" % method)
- if params:
- self.output(" prototype=ctypes.CFUNCTYPE(%s, %s)" % (self.type2class.get(rtype, 'FIXME_%s' % rtype),
- ", ".join( self.type2class[p[0]] for p in params )))
- else:
- self.output(" prototype=ctypes.CFUNCTYPE(%s)" % self.type2class.get(rtype, 'FIXME_%s' % rtype))
-
-
- if not params:
- flags=' paramflags= tuple()'
- elif len(params) == 1:
- flags=" paramflags=( (%d, ), )" % parameter_passing[params[0][0]]
- else:
- flags=" paramflags=%s" % ", ".join( '(%d,)' % parameter_passing[p[0]] for p in params )
- self.output(flags)
- self.output(' %s = prototype( ("%s", dll), paramflags )' % (method, method))
- if '3' in flags:
- # A VLCException is present. Process it.
- self.output(" %s.errcheck = check_vlc_exception" % method)
- self.output(' %s.__doc__ = """%s"""' % (method, comment))
- self.output()
-
- def parse_override(self, name):
- """Parse override definitions file.
-
- It is possible to override methods definitions in classes.
-
- It returns a tuple
- (code, overriden_methods, docstring)
- """
- code={}
-
- data=[]
- current=None
- f=open(name, 'r')
- for l in f:
- m=re.match('class (\S+):', l)
- if m:
- # Dump old data
- if current is not None:
- code[current]="".join(data)
- current=m.group(1)
- data=[]
- continue
- data.append(l)
- code[current]="".join(data)
- f.close()
-
- docstring={}
- for k, v in code.iteritems():
- if v.lstrip().startswith('"""'):
- # Starting comment. Use it as docstring.
- dummy, docstring[k], code[k]=v.split('"""', 2)
-
- # Not robust wrt. internal methods, but this works for the moment.
- overridden_methods=dict( (k, re.findall('^\s+def\s+(\w+)', v, re.MULTILINE)) for (k, v) in code.iteritems() )
-
- return code, overridden_methods, docstring
-
- def fix_python_comment(self, c):
- """Fix comment by removing first and last parameters (self and exception)
- """
- data=c.replace('@{', '').replace('@see', 'See').splitlines()
- body=itertools.takewhile(lambda l: not '@param' in l and not '@return' in l, data)
- param=[ python_param_re.sub('\\1:\\2', l) for l in itertools.ifilter(lambda l: '@param' in l, data) ]
- ret=[ l.replace('@return', '@return:') for l in itertools.ifilter(lambda l: '@return' in l, data) ]
-
- if len(param) >= 2:
- param=param[1:-1]
- elif len(param) == 1:
- param=[]
-
- return "\n".join(itertools.chain(body, param, ret))
-
- def generate_wrappers(self, methods):
- """Generate class wrappers for all appropriate methods.
-
- @return: the set of wrapped method names
- """
- ret=set()
- # Sort methods against the element they apply to.
- elements=sorted( ( (self.type2class.get(params[0][0]), rt, met, params, c)
- for (rt, met, params, c) in methods
- if params and self.type2class.get(params[0][0], '_') in self.defined_classes
- ),
- key=operator.itemgetter(0))
-
- overrides, overriden_methods, docstring=self.parse_override('override.py')
-
- for classname, el in itertools.groupby(elements, key=operator.itemgetter(0)):
- self.output("""class %(name)s(object):""" % {'name': classname})
- if classname in docstring:
- self.output(' """%s\n """' % docstring[classname])
-
- if not 'def __new__' in overrides.get(classname, ''):
- self.output("""
- def __new__(cls, pointer=None):
- '''Internal method used for instanciating wrappers from ctypes.
- '''
- if pointer is None:
- raise Exception("Internal method. Surely this class cannot be instanciated by itself.")
- if pointer == 0:
- return None
- else:
- o=object.__new__(cls)
- o._as_parameter_=ctypes.c_void_p(pointer)
- return o
-""")
-
- self.output("""
- @staticmethod
- def from_param(arg):
- '''(INTERNAL) ctypes parameter conversion method.
- '''
- return arg._as_parameter_
-""")
-
- if classname in overrides:
- self.output(overrides[classname])
-
- prefix=self.prefixes.get(classname, '')
-
- for cl, rtype, method, params, comment in el:
- if method in blacklist:
- continue
- # Strip prefix
- name=method.replace(prefix, '').replace('libvlc_', '')
- ret.add(method)
- if name in overriden_methods.get(cl, []):
- # Method already defined in override.py
- continue
-
- if params:
- params[0]=(params[0][0], 'self')
- if params and params[-1][0] in ('libvlc_exception_t*', 'mediacontrol_Exception*'):
- args=", ".join( p[1] for p in params[:-1] )
- else:
- args=", ".join( p[1] for p in params )
-
- self.output(" if hasattr(dll, '%s'):" % method)
- self.output(" def %s(%s):" % (name, args))
- self.output(' """%s\n """' % self.fix_python_comment(comment))
- if params and params[-1][0] == 'libvlc_exception_t*':
- # Exception handling
- self.output(" e=VLCException()")
- self.output(" return %s(%s, e)" % (method, args))
- elif params and params[-1][0] == 'mediacontrol_Exception*':
- # Exception handling
- self.output(" e=MediaControlException()")
- self.output(" return %s(%s, e)" % (method, args))
- else:
- self.output(" return %s(%s)" % (method, args))
- self.output()
-
- # Check for standard methods
- if name == 'count':
- # There is a count method. Generate a __len__ one.
- if params and params[-1][0] == 'libvlc_exception_t*':
- self.output(""" def __len__(self):
- e=VLCException()
- return %s(self, e)
-""" % method)
- else:
- # No exception
- self.output(""" def __len__(self):
- return %s(self)
-""" % method)
- elif name.endswith('item_at_index'):
- # Indexable (and thus iterable)"
- self.output(""" def __getitem__(self, i):
- e=VLCException()
- return %s(self, i, e)
-
- def __iter__(self):
- e=VLCException()
- for i in xrange(len(self)):
- yield self[i]
-""" % method)
- return ret
-
-class JavaGenerator(object):
- # C-type to java/jna type conversion.
- # Note that enum types conversions are generated (cf convert_enum_names)
- type2class={
- 'libvlc_exception_t*': 'libvlc_exception_t',
- 'libvlc_media_player_t*': 'LibVlcMediaPlayer',
- 'libvlc_instance_t*': 'LibVlcInstance',
- 'libvlc_media_t*': 'LibVlcMedia',
- 'libvlc_log_t*': 'LibVlcLog',
- 'libvlc_log_iterator_t*': 'LibVlcLogIterator',
- 'libvlc_log_message_t*': 'libvlc_log_message_t',
- 'libvlc_event_type_t': 'int',
- 'libvlc_event_manager_t*': 'LibVlcEventManager',
- 'libvlc_media_discoverer_t*': 'LibVlcMediaDiscoverer',
- 'libvlc_media_library_t*': 'LibVlcMediaLibrary',
- 'libvlc_media_list_t*': 'LibVlcMediaList',
- 'libvlc_media_list_player_t*': 'LibVlcMediaListPlayer',
- 'libvlc_media_list_view_t*': 'LibVlcMediaListView',
- 'libvlc_media_stats_t*': 'LibVlcMediaStats',
-
- 'libvlc_track_description_t*': 'LibVlcTrackDescription',
- 'libvlc_audio_output_t*': 'LibVlcAudioOutput',
-
- 'void': 'void',
- 'void*': 'Pointer',
- 'short': 'short',
- 'char*': 'String',
- 'char**': 'String[]',
- 'uint32_t': 'uint32',
- 'float': 'float',
- 'unsigned': 'int',
- 'int': 'int',
- '...': 'FIXMEva_list',
- 'libvlc_callback_t': 'LibVlcCallback',
- 'libvlc_time_t': 'long',
-
- 'mediacontrol_RGBPicture*': 'Pointer',
- 'mediacontrol_PlaylistSeq*': 'Pointer',
- 'mediacontrol_StreamInformation*': 'Pointer',
- }
-
- def __init__(self, parser=None):
- self.parser=parser
-
- # Blacklist all mediacontrol methods
- for (rt, met, params, c) in self.parser.methods:
- if met.startswith('mediacontrol'):
- blacklist.append(met)
- # Generate Java names for enums
- self.type2class.update(self.convert_enum_names(parser.enums))
- self.check_types()
-
- def save(self, dirname=None):
- if dirname is None or dirname == '-':
- dirname='internal'
- if not os.path.isdir(dirname):
- os.mkdir(dirname)
-
- print "Generating java code in %s/" % dirname
-
- # Generate enum files
- self.generate_enums(dirname, self.parser.enums)
-
- # Generate LibVlc.java code
- self.generate_libvlc(dirname)
-
- def output(self, fd, *p):
- fd.write(" ".join(p))
- fd.write("\n")
-
- def check_types(self):
- """Make sure that all types are properly translated.
-
- This method must be called *after* convert_enum_names, since
- the latter populates type2class with converted enum names.
- """
- for (rt, met, params, c) in self.parser.methods:
- if met in blacklist:
- continue
- for typ, name in params:
- if not typ in self.type2class:
- raise Exception("No conversion for %s (from %s:%s)" % (typ, met, name))
-
- def convert_enum_names(self, enums):
- """Convert enum names into Java names.
- """
- res={}
- for (typ, name, values, comment) in enums:
- if typ != 'enum':
- raise Exception('This method only handles enums')
- pyname=re.findall('(libvlc|mediacontrol)_(.+?)(_t)?$', name)[0][1]
- if '_' in pyname:
- pyname=pyname.title().replace('_', '')
- elif not pyname[0].isupper():
- pyname=pyname.capitalize()
- res[name]=pyname
- return res
-
- def insert_code(self, fd, filename):
- """Generate header/footer code.
- """
- f=open(filename, 'r')
- for l in f:
- if l.startswith('build_date'):
- self.output(fd, 'build_date="%s";' % time.ctime())
- else:
- self.output(fd, l.rstrip())
- f.close()
-
- def generate_header(self, fd):
- """Generate LibVlc header.
- """
- for (c_type, jna_type) in self.type2class.iteritems():
- if c_type.endswith('*') and jna_type.startswith('LibVlc'):
- self.output(fd, ''' public class %s extends PointerType
- {
- }
-''' % jna_type)
-
- def generate_libvlc(self, dirname):
- """Generate LibVlc.java JNA glue code.
- """
- filename=os.path.join(dirname, 'LibVlc.java')
- fd=open(filename, 'w')
-
- self.insert_code(fd, 'boilerplate.java')
- self.insert_code(fd, 'LibVlc-header.java')
- #wrapped_methods=self.generate_wrappers(self.parser.methods)
- self.generate_header(fd)
- for (rtype, method, params, comment) in self.parser.methods:
- if method in blacklist:
- # FIXME
- continue
- self.output(fd, "%s %s(%s);\n" % (self.type2class.get(rtype, 'FIXME_%s' % rtype),
- method,
- ", ".join( ("%s %s" % (self.type2class[p[0]],
- p[1])) for p in params )))
- self.insert_code(fd, 'LibVlc-footer.java')
- fd.close()
-
- def generate_enums(self, dirname, enums):
- """Generate JNA glue code for enums
- """
- for (typ, name, values, comment) in enums:
- if typ != 'enum':
- raise Exception('This method only handles enums')
- javaname=self.type2class[name]
-
- filename=javaname+".java"
-
- fd=open(os.path.join(dirname, filename), 'w')
-
- self.insert_code(fd, 'boilerplate.java')
- self.output(fd, """package org.videolan.jvlc.internal;
-
-
-public enum %s
-{
-""" % javaname)
- # FIXME: write comment
-
- for k, v in values:
- self.output(fd, " %s (%s)," % (k, v))
- self.output(fd, "");
- self.output(fd, " private final int _value;");
- self.output(fd, " %s(int value) { this._value = value; }" % javaname);
- self.output(fd, " public int value() { return this._value; }");
- self.output(fd, "}")
- fd.close()
-
- def fix_python_comment(self, c):
- """Fix comment by removing first and last parameters (self and exception)
- """
- data=c.replace('@{', '').replace('@see', 'See').splitlines()
- body=itertools.takewhile(lambda l: not '@param' in l and not '@return' in l, data)
- param=[ python_param_re.sub('\\1:\\2', l) for l in itertools.ifilter(lambda l: '@param' in l, data) ]
- ret=[ l.replace('@return', '@return:') for l in itertools.ifilter(lambda l: '@return' in l, data) ]
-
- if len(param) >= 2:
- param=param[1:-1]
- elif len(param) == 1:
- param=[]
-
- return "\n".join(itertools.chain(body, param, ret))
-
-def process(output, list_of_includes):
- p=Parser(list_of_includes)
- g=PythonGenerator(p)
- g.save(output)
-
-if __name__ == '__main__':
- opt=OptionParser(usage="""Parse VLC include files and generate bindings code.
-%prog [options] include_file.h [...]""")
-
- opt.add_option("-d", "--debug", dest="debug", action="store_true",
- default=False,
- help="Debug mode")
-
- opt.add_option("-c", "--check", dest="check", action="store_true",
- default=False,
- help="Check mode")
-
- opt.add_option("-j", "--java", dest="java", action="store_true",
- default=False,
- help="Generate java bindings (default is python)")
-
- opt.add_option("-o", "--output", dest="output", action="store",
- type="str", default="-",
- help="Output filename(python)/dirname(java)")
-
- (options, args) = opt.parse_args()
-
- if not args:
- opt.print_help()
- sys.exit(1)
-
- p=Parser(args)
- if options.check:
- # Various consistency checks.
- for (rt, name, params, comment) in p.methods:
- if not comment.strip():
- print "No comment for %s" % name
- continue
- names=comment_re.findall(comment)
- if len(names) != len(params):
- print "Docstring comment parameters mismatch for %s" % name
-
- if options.debug:
- p.dump_methods()
- p.dump_enums()
-
- if options.check or options.debug:
- sys.exit(0)
-
- if options.java:
- g=JavaGenerator(p)
- else:
- g=PythonGenerator(p)
-
- g.save(options.output)
+++ /dev/null
-#! /usr/bin/python
-
-#
-# Python ctypes bindings for VLC
-# Copyright (C) 2009 the VideoLAN team
-# $Id: $
-#
-# Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-#
-
-"""This module provides bindings for the
-U{libvlc<http://wiki.videolan.org/ExternalAPI>} and
-U{MediaControl<http://wiki.videolan.org/MediaControlAPI>} APIs.
-
-You can find documentation at U{http://www.advene.org/download/python-ctypes/}.
-
-Basically, the most important class is L{Instance}, which is used to
-create a libvlc Instance. From this instance, you can then create
-L{MediaPlayer} and L{MediaListPlayer} instances.
-"""
-
-import logging
-import ctypes
-import sys
-
-build_date="This will be replaced by the build date"
-
-# Used for win32 and MacOS X
-detected_plugin_path=None
-
-if sys.platform == 'linux2':
- dll=ctypes.CDLL('libvlc.so')
-elif sys.platform == 'win32':
- import ctypes.util
- import os
- detected_plugin_path=None
- path=ctypes.util.find_library('libvlc.dll')
- if path is None:
- # Try to use registry settings
- import _winreg
- detected_plugin_path_found = None
- subkey, name = 'Software\\VideoLAN\\VLC','InstallDir'
- for hkey in _winreg.HKEY_LOCAL_MACHINE, _winreg.HKEY_CURRENT_USER:
- try:
- reg = _winreg.OpenKey(hkey, subkey)
- detected_plugin_path_found, type_id = _winreg.QueryValueEx(reg, name)
- _winreg.CloseKey(reg)
- break
- except _winreg.error:
- pass
- if detected_plugin_path_found:
- detected_plugin_path = detected_plugin_path_found
- else:
- # Try a standard location.
- p='c:\\Program Files\\VideoLAN\\VLC\\libvlc.dll'
- if os.path.exists(p):
- detected_plugin_path=os.path.dirname(p)
- os.chdir(detected_plugin_path)
- # If chdir failed, this will not work and raise an exception
- path='libvlc.dll'
- else:
- detected_plugin_path=os.path.dirname(path)
- dll=ctypes.CDLL(path)
-elif sys.platform == 'darwin':
- # FIXME: should find a means to configure path
- d='/Applications/VLC.app'
- import os
- if os.path.exists(d):
- dll=ctypes.CDLL(d+'/Contents/MacOS/lib/libvlc.2.dylib')
- detected_plugin_path=d+'/Contents/MacOS/modules'
- else:
- # Hope some default path is set...
- dll=ctypes.CDLL('libvlc.2.dylib')
-
-#
-# Generated enum types.
-#
-
-# GENERATED_ENUMS
-
-#
-# End of generated enum types.
-#
-
-class ListPOINTER(object):
- '''Just like a POINTER but accept a list of ctype as an argument.
- '''
- def __init__(self, etype):
- self.etype = etype
-
- def from_param(self, param):
- if isinstance(param, (list, tuple)):
- return (self.etype * len(param))(*param)
-
-class LibVLCException(Exception):
- """Python exception raised by libvlc methods.
- """
- pass
-
-# From libvlc_structures.h
-
-# This is version-dependent, depending on the presence of libvlc_errmsg
-
-if hasattr(dll, 'libvlc_errmsg'):
- # New-style message passing
- class VLCException(ctypes.Structure):
- """libvlc exception.
- """
- _fields_= [
- ('raised', ctypes.c_int),
- ]
-
- @property
- def message(self):
- return dll.libvlc_errmsg()
-
- def init(self):
- libvlc_exception_init(self)
-
- def clear(self):
- libvlc_exception_clear(self)
-else:
- # Old-style exceptions
- class VLCException(ctypes.Structure):
- """libvlc exception.
- """
- _fields_= [
- ('raised', ctypes.c_int),
- ('code', ctypes.c_int),
- ('message', ctypes.c_char_p),
- ]
- def init(self):
- libvlc_exception_init(self)
-
- def clear(self):
- libvlc_exception_clear(self)
-
-class MediaStats(ctypes.Structure):
- _fields_= [
- ('read_bytes', ctypes.c_int ),
- ('input_bitrate', ctypes.c_float),
- ('demux_read_bytes', ctypes.c_int ),
- ('demux_bitrate', ctypes.c_float),
- ('demux_corrupted', ctypes.c_int ),
- ('demux_discontinuity', ctypes.c_int ),
- ('decoded_video', ctypes.c_int ),
- ('decoded_audio', ctypes.c_int ),
- ('displayed_pictures', ctypes.c_int ),
- ('lost_pictures', ctypes.c_int ),
- ('played_abuffers', ctypes.c_int ),
- ('lost_abuffers', ctypes.c_int ),
- ('sent_packets', ctypes.c_int ),
- ('sent_bytes', ctypes.c_int ),
- ('send_bitrate', ctypes.c_float),
- ]
-
- def __str__(self):
- return "MediaStats\n%s" % "\n".join( "%s:\t%s" % (n, getattr(self, n)) for n in self._fields_ )
-
-class MediaES(ctypes.Structure):
- _fields_= [
- ('codec' , ctypes.c_uint32),
- ('type' , EsType),
- ('profile' , ctypes.c_int),
- ('level' , ctypes.c_int),
- ('channels', ctypes.c_uint),
- ('rate' , ctypes.c_uint),
- ('height' , ctypes.c_uint),
- ('width' , ctypes.c_uint),
- ]
-
- def __str__(self):
- return "MediaES \n%s" % "\n".join( "%s:\t%s" % (n, getattr(self, n)) for n in self._fields_ )
-
-class PlaylistItem(ctypes.Structure):
- _fields_= [
- ('id', ctypes.c_int),
- ('uri', ctypes.c_char_p),
- ('name', ctypes.c_char_p),
- ]
-
- def __str__(self):
- return "PlaylistItem #%d %s (%uri)" % (self.id, self.name, self.uri)
-
-class LogMessage(ctypes.Structure):
- _fields_= [
- ('size', ctypes.c_uint),
- ('severity', ctypes.c_int),
- ('type', ctypes.c_char_p),
- ('name', ctypes.c_char_p),
- ('header', ctypes.c_char_p),
- ('message', ctypes.c_char_p),
- ]
-
- def __init__(self):
- super(LogMessage, self).__init__()
- self.size=ctypes.sizeof(self)
-
- def __str__(self):
- return "vlc.LogMessage(%d:%s): %s" % (self.severity, self.type, self.message)
-
-class MediaControlPosition(ctypes.Structure):
- _fields_= [
- ('origin', PositionOrigin),
- ('key', PositionKey),
- ('value', ctypes.c_longlong),
- ]
-
- def __init__(self, value=0, origin=None, key=None):
- # We override the __init__ method so that instanciating the
- # class with an int as parameter will create the appropriate
- # default position (absolute position, media time, with the
- # int as value).
- super(MediaControlPosition, self).__init__()
- self.value=value
- if origin is None:
- origin=PositionOrigin.AbsolutePosition
- if key is None:
- key=PositionKey.MediaTime
- self.origin=origin
- self.key=key
-
- def __str__(self):
- return "MediaControlPosition %ld (%s, %s)" % (
- self.value,
- str(self.origin),
- str(self.key)
- )
-
- @staticmethod
- def from_param(arg):
- if isinstance(arg, (int, long)):
- return MediaControlPosition(arg)
- else:
- return arg
-
-class MediaControlException(ctypes.Structure):
- _fields_= [
- ('code', ctypes.c_int),
- ('message', ctypes.c_char_p),
- ]
- def init(self):
- mediacontrol_exception_init(self)
-
- def clear(self):
- mediacontrol_exception_free(self)
-
-class MediaControlStreamInformation(ctypes.Structure):
- _fields_= [
- ('status', PlayerStatus),
- ('url', ctypes.c_char_p),
- ('position', ctypes.c_longlong),
- ('length', ctypes.c_longlong),
- ]
-
- def __str__(self):
- return "%s (%s) : %ld / %ld" % (self.url or "<No defined URL>",
- str(self.status),
- self.position,
- self.length)
-
-class RGBPicture(ctypes.Structure):
- _fields_= [
- ('width', ctypes.c_int),
- ('height', ctypes.c_int),
- ('type', ctypes.c_uint32),
- ('date', ctypes.c_ulonglong),
- ('size', ctypes.c_int),
- ('data_pointer', ctypes.c_void_p),
- ]
-
- @property
- def data(self):
- return ctypes.string_at(self.data_pointer, self.size)
-
- def __str__(self):
- return "RGBPicture (%d, %d) - %ld ms - %d bytes" % (self.width, self.height, self.date, self.size)
-
- def free(self):
- mediacontrol_RGBPicture__free(self)
-
-def check_vlc_exception(result, func, args):
- """Error checking method for functions using an exception in/out parameter.
- """
- ex=args[-1]
- if not isinstance(ex, (VLCException, MediaControlException)):
- logging.warn("python-vlc: error when processing function %s. Please report this as a bug to vlc-devel@videolan.org" % str(func))
- return result
- # Take into account both VLCException and MediacontrolException:
- c=getattr(ex, 'raised', getattr(ex, 'code', 0))
- if c:
- raise LibVLCException(ex.message)
- return result
-
-### End of header.py ###
+++ /dev/null
-class Instance:
- """Create a new Instance instance.
-
- It may take as parameter either:
- - a string
- - a list of strings as first parameters
- - the parameters given as the constructor parameters (must be strings)
- - a MediaControl instance
- """
- def __new__(cls, *p):
- if p and p[0] == 0:
- return None
- elif p and isinstance(p[0], (int, long)):
- # instance creation from ctypes
- o=object.__new__(cls)
- o._as_parameter_=ctypes.c_void_p(p[0])
- return o
- elif len(p) == 1 and isinstance(p[0], basestring):
- # Only 1 string parameter: should be a parameter line
- p=p[0].split(' ')
- elif len(p) == 1 and isinstance(p[0], (tuple, list)):
- p=p[0]
-
- if p and isinstance(p[0], MediaControl):
- return p[0].get_instance()
- else:
- if not p and detected_plugin_path is not None:
- # No parameters passed. Under win32 and MacOS, specify
- # the detected_plugin_path if present.
- p=[ 'vlc', '--plugin-path='+ detected_plugin_path ]
- e=VLCException()
- return libvlc_new(len(p), p, e)
-
- def media_player_new(self, uri=None):
- """Create a new Media Player object.
-
- @param uri: an optional URI to play in the player.
- """
- e=VLCException()
- p=libvlc_media_player_new(self, e)
- if uri:
- p.set_media(self.media_new(uri))
- p._instance=self
- return p
-
- def media_list_player_new(self):
- """Create an empty Media Player object
- """
- e=VLCException()
- p=libvlc_media_list_player_new(self, e)
- p._instance=self
- return p
-
- def media_new(self, mrl, *options):
- """Create an empty Media Player object
-
- Options can be specified as supplementary string parameters, e.g.
- m=i.media_new('foo.avi', 'sub-filter=marq{marquee=Hello}', 'vout-filter=invert')
- """
- e=VLCException()
- m=libvlc_media_new(self, mrl, e)
- for o in options:
- libvlc_media_add_option(m, o, e)
- return m
-
-class MediaControl:
- """Create a new MediaControl instance
-
- It may take as parameter either:
- - a string
- - a list of strings as first parameters
- - the parameters given as the constructor parameters (must be strings)
- - a vlc.Instance
- """
- def __new__(cls, *p):
- if p and p[0] == 0:
- return None
- elif p and isinstance(p[0], (int, long)):
- # instance creation from ctypes
- o=object.__new__(cls)
- o._as_parameter_=ctypes.c_void_p(p[0])
- return o
- elif len(p) == 1 and isinstance(p[0], basestring):
- # Only 1 string parameter: should be a parameter line
- p=p[0].split(' ')
- elif len(p) == 1 and isinstance(p[0], (tuple, list)):
- p=p[0]
-
- if p and isinstance(p[0], Instance):
- e=MediaControlException()
- return mediacontrol_new_from_instance(p[0], e)
- else:
- if not p and detected_plugin_path is not None:
- # No parameters passed. Under win32 and MacOS, specify
- # the detected_plugin_path if present.
- p=[ 'vlc', '--plugin-path='+ detected_plugin_path ]
- e=MediaControlException()
- return mediacontrol_new(len(p), p, e)
-
- def get_media_position(self, origin=PositionOrigin.AbsolutePosition, key=PositionKey.MediaTime):
- e=MediaControlException()
- p=mediacontrol_get_media_position(self, origin, key, e)
- if p:
- return p.contents
- else:
- return None
-
- def set_media_position(self, pos):
- """Set the media position.
-
- @param pos: a MediaControlPosition or an integer (in ms)
- """
- if not isinstance(pos, MediaControlPosition):
- pos=MediaControlPosition(long(pos))
- e=MediaControlException()
- mediacontrol_set_media_position(self, pos, e)
-
- def start(self, pos=0):
- """Start the player at the given position.
-
- @param pos: a MediaControlPosition or an integer (in ms)
- """
- if not isinstance(pos, MediaControlPosition):
- pos=MediaControlPosition(long(pos))
- e=MediaControlException()
- mediacontrol_start(self, pos, e)
-
- def snapshot(self, pos=0):
- """Take a snapshot.
-
- Note: the position parameter is not properly implemented. For
- the moment, the only valid position is the 0-relative position
- (i.e. the current position).
-
- @param pos: a MediaControlPosition or an integer (in ms)
- """
- if not isinstance(pos, MediaControlPosition):
- pos=MediaControlPosition(long(pos))
- e=MediaControlException()
- p=mediacontrol_snapshot(self, pos, e)
- if p:
- snap=p.contents
- # FIXME: there is a bug in the current mediacontrol_snapshot
- # implementation, which sets an incorrect date.
- # Workaround here:
- snap.date=self.get_media_position().value
- return snap
- else:
- return None
-
- def display_text(self, message='', begin=0, end=1000):
- """Display a caption between begin and end positions.
-
- @param message: the caption to display
- @param begin: the begin position
- @param end: the end position
- """
- if not isinstance(begin, MediaControlPosition):
- begin=self.value2position(begin)
- if not isinstance(end, MediaControlPosition):
- end=self.value2position(end)
- e=MediaControlException()
- mediacontrol_display_text(self, message, begin, end, e)
-
- def get_stream_information(self, key=PositionKey.MediaTime):
- """Return information about the stream.
- """
- e=MediaControlException()
- return mediacontrol_get_stream_information(self, key, e).contents
-
-class Media:
- def add_options(self, *list_of_options):
- """Add a list of options to the media.
-
- Options must be written without the double-dash, e.g.:
- m.add_options('sub-filter=marq@test{marquee=Hello}', 'video-filter=invert')
-
- Note that you also can directly pass these options in the Instance.media_new method:
- m=instance.media_new( 'foo.avi', 'sub-filter=marq@test{marquee=Hello}', 'video-filter=invert')
- """
- for o in list_of_options:
- self.add_option(o)
-
-class MediaPlayer:
- """Create a new MediaPlayer instance.
-
- It may take as parameter either:
- - a string (media URI). In this case, a vlc.Instance will be created.
- - a vlc.Instance
- """
- def __new__(cls, *p):
- if p and p[0] == 0:
- return None
- elif p and isinstance(p[0], (int, long)):
- # instance creation from ctypes
- o=object.__new__(cls)
- o._as_parameter_=ctypes.c_void_p(p[0])
- return o
-
- if p and isinstance(p[0], Instance):
- return p[0].media_player_new()
- else:
- i=Instance()
- o=i.media_player_new()
- if p:
- o.set_media(i.media_new(p[0]))
- return o
-
- def get_instance(self):
- """Return the associated vlc.Instance.
- """
- return self._instance
-
-class MediaListPlayer:
- """Create a new MediaPlayer instance.
-
- It may take as parameter either:
- - a vlc.Instance
- - nothing
- """
- def __new__(cls, *p):
- if p and p[0] == 0:
- return None
- elif p and isinstance(p[0], (int, long)):
- # instance creation from ctypes
- o=object.__new__(cls)
- o._as_parameter_=ctypes.c_void_p(p[0])
- return o
- elif len(p) == 1 and isinstance(p[0], (tuple, list)):
- p=p[0]
-
- if p and isinstance(p[0], Instance):
- return p[0].media_list_player_new()
- else:
- i=Instance()
- o=i.media_list_player_new()
- return o
-
- def get_instance(self):
- """Return the associated vlc.Instance.
- """
- return self._instance
-
-class LogIterator:
- def __iter__(self):
- return self
-
- def next(self):
- if not self.has_next():
- raise StopIteration
- buf=LogMessage()
- e=VLCException()
- ret=libvlc_log_iterator_next(self, buf, e)
- return ret.contents
-
-class Log:
- def __iter__(self):
- return self.get_iterator()
-
- def dump(self):
- return [ str(m) for m in self ]
+++ /dev/null
-from distutils.core import setup
-import sys
-import os
-import generate
-
-vlc_include_path = os.path.join("..","..","include","vlc")
-if not os.path.exists(vlc_include_path):
- raise Exception("This script should be run from a VLC tree.")
-
-files = [ os.path.join(vlc_include_path, filename)
- for filename in os.listdir(vlc_include_path) ]
-
-generate.process('vlc.py', files)
-
-setup(name='python-vlc',
- version = '1.1.0',
- author='Olivier Aubert',
- author_email='olivier.aubert@liris.cnrs.fr',
- url='http://wiki.videolan.org/PythonBinding',
- py_modules=['vlc'],
- keywords = [ 'vlc', 'video' ],
- license = "GPL",
- description = "VLC bindings for python.",
- long_description = """VLC bindings for python.
-
-This module provides ctypes-based bindings for the native libvlc API
-(see http://wiki.videolan.org/ExternalAPI) and the MediaControl API
-(see http://wiki.videolan.org/PythonBinding) of the VLC video player.
-
-It is automatically generated from the include files.
-"""
- )
+++ /dev/null
-#! /usr/bin/python
-
-#
-# Code generator for python ctypes bindings for VLC
-# Copyright (C) 2009 the VideoLAN team
-# $Id: $
-#
-# Authors: Olivier Aubert <olivier.aubert at liris.cnrs.fr>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
-#
-
-"""Unittest module.
-"""
-
-import unittest
-import vlc
-
-class TestVLCAPI(unittest.TestCase):
- #def setUp(self):
- # self.seq = range(10)
- #self.assert_(element in self.seq)
-
- # We check enum definitions against hardcoded values. In case of
- # failure, check that the reason is not a change in the .h
- # definitions.
- def test_enum_event_type(self):
- self.assertEqual(vlc.EventType.MediaStateChanged.value, 5)
-
- def test_enum_meta(self):
- self.assertEqual(vlc.Meta.Description.value, 6)
-
- def test_enum_state(self):
- self.assertEqual(vlc.State.Playing.value, 3)
-
- def test_enum_media_option(self):
- self.assertEqual(vlc.MediaOption.unique.value, 256)
-
- def test_enum_playback_mode(self):
- self.assertEqual(vlc.PlaybackMode.repeat.value, 2)
-
- def test_enum_marquee_int_option(self):
- self.assertEqual(vlc.VideoMarqueeIntOption.Size.value, 5)
-
- def test_enum_output_device_type(self):
- self.assertEqual(vlc.AudioOutputDeviceTypes._2F2R.value, 4)
-
- def test_enum_output_channel(self):
- self.assertEqual(vlc.AudioOutputChannel.Dolbys.value, 5)
-
- def test_enum_position_origin(self):
- self.assertEqual(vlc.PositionOrigin.ModuloPosition.value, 2)
-
- def test_enum_position_key(self):
- self.assertEqual(vlc.PositionKey.MediaTime.value, 2)
-
- def test_enum_player_status(self):
- self.assertEqual(vlc.PlayerStatus.StopStatus.value, 5)
-
- # Basic MediaControl tests
- def test_mediacontrol_creation(self):
- mc=vlc.MediaControl()
- self.assert_(mc)
-
- def test_mediacontrol_initial_mrl(self):
- mc=vlc.MediaControl()
- self.assertEqual(mc.get_mrl(), '')
-
- def test_mediacontrol_set_mrl(self):
- mrl='/tmp/foo.avi'
- mc=vlc.MediaControl()
- mc.set_mrl(mrl)
- self.assertEqual(mc.get_mrl(), mrl)
-
- def test_mediacontrol_position(self):
- p=vlc.MediaControlPosition(value=2,
- origin=vlc.PositionOrigin.RelativePosition,
- key=vlc.PositionKey.MediaTime)
- self.assertEqual(p.value, 2)
-
- def test_mediacontrol_position_shortcut(self):
- p=vlc.MediaControlPosition(2)
- self.assertEqual(p.value, 2)
- self.assertEqual(p.key, vlc.PositionKey.MediaTime)
- self.assertEqual(p.origin, vlc.PositionOrigin.AbsolutePosition)
-
- def test_mediacontrol_get_media_position(self):
- mc=vlc.MediaControl()
- p=mc.get_media_position()
- self.assertEqual(p.value, -1)
-
- def test_mediacontrol_get_stream_information(self):
- mc=vlc.MediaControl()
- s=mc.get_stream_information()
- self.assertEqual(s.position, 0)
- self.assertEqual(s.length, 0)
-
- # Basic libvlc tests
- def test_instance_creation(self):
- i=vlc.Instance()
- self.assert_(i)
-
- def test_libvlc_media(self):
- mrl='/tmp/foo.avi'
- i=vlc.Instance()
- m=i.media_new(mrl)
- self.assertEqual(m.get_mrl(), mrl)
-
- def test_libvlc_player(self):
- mrl='/tmp/foo.avi'
- i=vlc.Instance()
- p=i.media_player_new(mrl)
- self.assertEqual(p.get_media().get_mrl(), mrl)
-
- def test_libvlc_player_state(self):
- mrl='/tmp/foo.avi'
- i=vlc.Instance()
- p=i.media_player_new(mrl)
- self.assertEqual(p.get_state(), vlc.State.Ended)
-
- def test_libvlc_logger(self):
- i=vlc.Instance()
- l=i.log_open()
- l.clear()
- self.assertEqual(l.count(), 0)
- l.close()
-
- def test_libvlc_logger_clear(self):
- i=vlc.Instance()
- l=i.log_open()
- l.clear()
- self.assertEqual(l.count(), 0)
- l.close()
-
- def test_libvlc_logger(self):
- i=vlc.Instance()
- i.set_log_verbosity(3)
- l=i.log_open()
- # This should generate a log message
- i.add_intf('dummy')
- self.assertNotEqual(l.count(), 0)
- for m in l:
- # Ensure that messages can be read.
- self.assertNotEqual(len(m.message), 0)
- l.close()
-
-if __name__ == '__main__':
- unittest.main()
+++ /dev/null
-#! /usr/bin/python
-
-"""VLC Widget classes.
-
-This module provides two helper classes, to ease the embedding of a
-VLC component inside a pygtk application.
-
-VLCWidget is a simple VLC widget.
-
-DecoratedVLCWidget provides simple player controls.
-
-$Id$
-"""
-
-import gtk
-import sys
-import vlc
-
-from gettext import gettext as _
-
-# Create a single vlc.Instance() to be share by (possible) multiple players.
-instance=vlc.Instance()
-
-class VLCWidget(gtk.DrawingArea):
- """Simple VLC widget.
-
- Its player can be controlled through the 'player' attribute, which
- is a vlc.MediaPlayer() instance.
- """
- def __init__(self, *p):
- gtk.DrawingArea.__init__(self)
- self.player=instance.media_player_new()
- def handle_embed(*args):
- if sys.platform == 'win32':
- self.player.set_hwnd(self.window.handle)
- else:
- self.player.set_xwindow(self.window.xid)
- return True
- self.connect("map-event", handle_embed)
- self.set_size_request(320, 200)
-
-class DecoratedVLCWidget(gtk.VBox):
- """Decorated VLC widget.
-
- VLC widget decorated with a player control toolbar.
-
- Its player can be controlled through the 'player' attribute, which
- is a MediaControl instance.
- """
- def __init__(self, *p):
- gtk.VBox.__init__(self)
- self._vlc_widget=VLCWidget(*p)
- self.player=self._vlc_widget.player
- self.pack_start(self._vlc_widget, expand=True)
- self._toolbar = self.get_player_control_toolbar()
- self.pack_start(self._toolbar, expand=False)
-
- def get_player_control_toolbar(self):
- """Return a player control toolbar
- """
- tb=gtk.Toolbar()
- tb.set_style(gtk.TOOLBAR_ICONS)
-
- tb_list = (
- (_("Play"), _("Play"), gtk.STOCK_MEDIA_PLAY, lambda b: self.player.play()),
- (_("Pause"), _("Pause"), gtk.STOCK_MEDIA_PAUSE, lambda b: self.player.pause()),
- (_("Stop"), _("Stop"), gtk.STOCK_MEDIA_STOP, lambda b: self.player.stop()),
- (_("Quit"), _("Quit"), gtk.STOCK_QUIT, lambda b: gtk.main_quit()),
- )
-
- for text, tooltip, stock, callback in tb_list:
- b=gtk.ToolButton(stock)
- b.connect("clicked", callback)
- tb.insert(b, -1)
- tb.show_all()
- return tb
-
-class VideoPlayer:
- """Example simple video player.
- """
- def __init__(self):
- self.vlc = DecoratedVLCWidget()
-
- def main(self, fname):
- self.vlc.player.set_media(instance.media_new(fname))
- self.popup()
- gtk.main()
-
- def popup(self):
- w=gtk.Window()
- w.add(self.vlc)
- w.show_all()
- w.connect("destroy", gtk.main_quit)
- return w
-
-class MultiVideoPlayer:
- """Example multi-video player.
-
- It plays multiple files side-by-side, with per-view and global controls.
- """
- def main(self, filenames):
- # Build main window
- window=gtk.Window()
- mainbox=gtk.VBox()
- videos=gtk.HBox()
-
- window.add(mainbox)
- mainbox.add(videos)
-
- # Create VLC widgets
- for fname in filenames:
- v=DecoratedVLCWidget()
- v.player.set_media(instance.media_new(fname))
- videos.add(v)
-
- # Create global toolbar
- tb=gtk.Toolbar()
- tb.set_style(gtk.TOOLBAR_ICONS)
-
- def execute(b, methodname):
- """Execute the given method on all VLC widgets.
- """
- for v in videos.get_children():
- getattr(v.player, methodname)()
- return True
-
- for text, tooltip, stock, callback, arg in (
- (_("Play"), _("Play"), gtk.STOCK_MEDIA_PLAY, execute, "play"),
- (_("Pause"), _("Pause"), gtk.STOCK_MEDIA_PAUSE, execute, "pause"),
- (_("Stop"), _("Stop"), gtk.STOCK_MEDIA_STOP, execute, "stop"),
- (_("Quit"), _("Quit"), gtk.STOCK_QUIT, lambda b, d: gtk.main_quit(), None),
- ):
- b=gtk.ToolButton(stock)
- b.connect("clicked", callback, arg)
- tb.insert(b, -1)
-
- mainbox.pack_start(tb, expand=False)
-
- window.show_all()
- window.connect("destroy", gtk.main_quit)
- gtk.main()
-
-if __name__ == '__main__':
- if not sys.argv[1:]:
- print "You must provide at least 1 movie filename"
- sys.exit(1)
- if len(sys.argv[1:]) == 1:
- # Only 1 file. Simple interface
- p=VideoPlayer()
- p.main(sys.argv[1])
- else:
- # Multiple files.
- p=MultiVideoPlayer()
- p.main(sys.argv[1:])