[libbluray-devel] Add dummy player for audio (org/videolan/media/content/audio)
hpi1
git at videolan.org
Thu Oct 9 10:36:55 CEST 2014
libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Oct 9 11:35:07 2014 +0300| [e6a435b016536117e74254cce7f9954a13af2346] | committer: hpi1
Add dummy player for audio (org/videolan/media/content/audio)
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=e6a435b016536117e74254cce7f9954a13af2346
---
.../org/videolan/media/content/audio/Handler.java | 83 ++++++++++++++++++++
.../audio/MediaTimePositionControlImpl.java | 47 +++++++++++
2 files changed, 130 insertions(+)
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java
new file mode 100644
index 0000000..92055ab
--- /dev/null
+++ b/src/libbluray/bdj/java/org/videolan/media/content/audio/Handler.java
@@ -0,0 +1,83 @@
+/*
+ * This file is part of libbluray
+ *
+ * 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 of the License, or (at your option) any later version.
+ *
+ * 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/>.
+ */
+
+package org.videolan.media.content.audio;
+
+import java.awt.Component;
+import java.io.IOException;
+import java.util.ArrayList;
+
+import javax.media.Control;
+import javax.media.ControllerErrorEvent;
+import javax.media.IncompatibleSourceException;
+import javax.media.Time;
+import javax.media.protocol.DataSource;
+
+import org.bluray.net.BDLocator;
+
+import org.videolan.media.content.playlist.OverallGainControlImpl;
+import org.videolan.media.content.playlist.PanningControlImpl;
+
+import org.videolan.media.content.BDHandler;
+
+
+public class Handler extends BDHandler {
+ public Handler() {
+ controls = new Control[3];
+ controls[0] = new MediaTimePositionControlImpl(this);
+ controls[1] = new OverallGainControlImpl();
+ controls[2] = new PanningControlImpl();
+ }
+
+ public void setSource(DataSource source) throws IOException, IncompatibleSourceException {
+ this.source = new org.videolan.media.protocol.dripfeed.DataSource(source.getLocator());
+ if (source.getLocator() == null)
+ throw new IncompatibleSourceException();
+
+ try {
+ locator = new BDLocator(source.getLocator().toExternalForm());
+ } catch (org.davic.net.InvalidLocatorException e) {
+ throw new IncompatibleSourceException();
+ }
+ }
+
+ public Time getDuration() {
+ org.videolan.Logger.unimplemented("Handler", "getDuration");
+ long duration = 1; // pi.getDuration() ;
+ return new Time(duration * TO_SECONDS);
+ }
+
+ protected ControllerErrorEvent doPrefetch() {
+ return super.doPrefetch();
+ }
+
+ protected ControllerErrorEvent doStart(Time at) {
+ return super.doStart(at);
+ }
+
+ protected ControllerErrorEvent doStop() {
+ return super.doStop();
+ }
+
+ protected BDLocator getLocator() {
+ return locator;
+ }
+
+ private BDLocator locator;
+ private org.videolan.media.protocol.dripfeed.DataSource source = null;
+}
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/audio/MediaTimePositionControlImpl.java b/src/libbluray/bdj/java/org/videolan/media/content/audio/MediaTimePositionControlImpl.java
new file mode 100644
index 0000000..f841ce6
--- /dev/null
+++ b/src/libbluray/bdj/java/org/videolan/media/content/audio/MediaTimePositionControlImpl.java
@@ -0,0 +1,47 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2010 William Hahne
+ *
+ * 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 of the License, or (at your option) any later version.
+ *
+ * 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/>.
+ */
+
+package org.videolan.media.content.audio;
+
+import java.awt.Component;
+
+import javax.media.Time;
+
+import org.davic.media.MediaTimePositionControl;
+
+public class MediaTimePositionControlImpl implements MediaTimePositionControl {
+ protected MediaTimePositionControlImpl(Handler player) {
+ this.player = player;
+ }
+
+ public Component getControlComponent() {
+ return null;
+ }
+
+ public Time setMediaTimePosition(Time mediaTime) {
+ player.setMediaTime(mediaTime);
+ return player.getMediaTime();
+ }
+
+ public Time getMediaTimePosition() {
+ return player.getMediaTime();
+ }
+
+ private Handler player;
+}
More information about the libbluray-devel
mailing list