1 /*
2  * This file is part of libbluray
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library. If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18 
19 package org.videolan.media.content.video.dvb.mpeg.drip;
20 
21 import java.awt.Component;
22 import java.io.IOException;
23 import java.util.ArrayList;
24 
25 import javax.media.ClockStartedError;
26 import javax.media.ClockStoppedException;
27 import javax.media.ConnectionErrorEvent;
28 import javax.media.Control;
29 import javax.media.Controller;
30 import javax.media.ControllerErrorEvent;
31 import javax.media.ControllerListener;
32 import javax.media.GainControl;
33 import javax.media.IncompatibleSourceException;
34 import javax.media.IncompatibleTimeBaseException;
35 import javax.media.Player;
36 import javax.media.Time;
37 import javax.media.TimeBase;
38 import javax.media.protocol.DataSource;
39 
40 //import org.videolan.media.content.playlist.BackgroundVideoPresentationControlImpl;
41 
42 public class Handler implements Player {
Handler()43     public Handler() {
44         controls = new Control[1];
45         controls[0] = new BackgroundVideoPresentationControlImpl(this);
46     }
47 
setSource(DataSource source)48     public void setSource(DataSource source) throws IOException, IncompatibleSourceException {
49         this.source = new org.videolan.media.protocol.dripfeed.DataSource(source.getLocator());
50         if (source.getLocator() == null)
51             throw new IncompatibleSourceException();
52     }
53 
getState()54     public int getState() {
55         synchronized (this) {
56             return state;
57         }
58     }
59 
getTargetState()60     public int getTargetState() {
61         synchronized (this) {
62             return targetState;
63         }
64     }
65 
getStartLatency()66     public Time getStartLatency() {
67         return null;
68     }
69 
getControls()70     public Control[] getControls() {
71         return controls;
72     }
73 
getControl(String forName)74     public Control getControl(String forName) {
75         try {
76             Class cls = Class.forName(forName);
77             for (int i = 0; i < controls.length; i++) {
78                 if (cls.isInstance(controls[i]))
79                     return controls[i];
80             }
81             return null;
82         } catch (ClassNotFoundException e) {
83             return null;
84         }
85     }
86 
addControllerListener(ControllerListener listener)87     public void addControllerListener(ControllerListener listener) {
88         synchronized (listeners) {
89             listeners.add(listener);
90         }
91     }
92 
removeControllerListener(ControllerListener listener)93     public void removeControllerListener(ControllerListener listener) {
94         synchronized (listeners) {
95             listeners.remove(listener);
96         }
97     }
98 
setTimeBase(TimeBase master)99     public void setTimeBase(TimeBase master)
100         throws IncompatibleTimeBaseException {
101         throw new IncompatibleTimeBaseException();
102     }
103 
realize()104     public void realize() {
105         // TODO Auto-generated method stub
106     }
107 
prefetch()108     public void prefetch() {
109         // TODO Auto-generated method stub
110     }
111 
start()112     public void start() {
113         // TODO Auto-generated method stub
114     }
115 
syncStart(Time at)116     public void syncStart(Time at) {
117         // TODO Auto-generated method stub
118     }
119 
deallocate()120     public void deallocate() {
121         // TODO Auto-generated method stub
122     }
123 
close()124     public void close() {
125         // TODO Auto-generated method stub
126     }
127 
stop()128     public void stop() {
129         // TODO Auto-generated method stub
130     }
131 
setStopTime(Time stopTime)132     public void setStopTime(Time stopTime) {
133     }
134 
getStopTime()135     public Time getStopTime() {
136         return null;
137     }
138 
setMediaTime(Time now)139     public void setMediaTime(Time now) {
140     }
141 
getMediaTime()142     public Time getMediaTime() {
143         return new Time(0);
144     }
145 
getMediaNanoseconds()146     public long getMediaNanoseconds() {
147         return 0;
148     }
149 
getSyncTime()150     public Time getSyncTime() {
151         return null;
152     }
153 
getTimeBase()154     public TimeBase getTimeBase() {
155         return null;
156     }
157 
mapToTimeBase(Time t)158     public Time mapToTimeBase(Time t) throws ClockStoppedException {
159         return null;
160     }
161 
getRate()162     public float getRate() {
163         return 1.0f;
164     }
165 
setRate(float factor)166     public float setRate(float factor) {
167         return 1.0f;
168     }
169 
getVisualComponent()170     public Component getVisualComponent() {
171         return null;
172     }
173 
getGainControl()174     public GainControl getGainControl() {
175         return null;
176     }
177 
getControlPanelComponent()178     public Component getControlPanelComponent() {
179         return null;
180     }
181 
addController(Controller newController)182     public void addController(Controller newController)
183         throws IncompatibleTimeBaseException {
184     }
185 
removeController(Controller oldController)186     public void removeController(Controller oldController) {
187     }
188 
getDuration()189     public Time getDuration() {
190         return null;
191     }
192 
193     protected int state = Unrealized;
194     protected int targetState = Unrealized;
195     protected Control[] controls = null;
196     private org.videolan.media.protocol.dripfeed.DataSource source = null;
197     private ArrayList listeners = new ArrayList();
198 }
199