1 7 8 package org.jboss.media.engine; 9 10 import java.util.Vector ; 11 12 import javax.media.Buffer; 13 import javax.media.Control; 14 import javax.media.Effect; 15 import javax.media.Format; 16 import javax.media.ResourceUnavailableException; 17 18 22 public abstract class JmfAbstractMediaPlugin implements Effect 23 { 24 25 Vector m_mediaPlugins = new Vector (); 26 27 30 public Format[] getSupportedInputFormats() 31 { 32 return getSupportedFormats(); 33 } 34 35 38 public Format[] getSupportedOutputFormats(Format in) 39 { 40 if (in == null) 41 return getSupportedFormats(); 42 else 43 { 44 Format outs[] = new Format[1]; 45 outs[0] = in; 46 return outs; 47 48 } 49 } 50 51 54 public int process(Buffer input, Buffer output) 55 { 56 58 output.setData(input.getData()); 59 60 output.setFormat(input.getFormat()); 62 output.setLength(input.getLength()); 63 output.setOffset(input.getOffset()); 64 65 67 for (int i = 0; i < m_mediaPlugins.size(); i++) 68 { 69 ((MediaPlugin) m_mediaPlugins.elementAt(i)).process(output); 71 } 72 73 return BUFFER_PROCESSED_OK; 74 } 75 76 79 public Format setInputFormat(Format format) 80 { 81 return format; 82 } 83 84 87 public Format setOutputFormat(Format format) 88 { 89 return format; 90 } 91 92 95 public void close() 96 { 97 } 98 99 102 public String getName() 103 { 104 return getClass().getName(); 105 } 106 107 110 public void open() throws ResourceUnavailableException 111 { 112 } 113 114 117 public void reset() 118 { 119 } 120 121 124 public Object getControl(String arg0) 125 { 126 return null; 127 } 128 129 132 public Object [] getControls() 133 { 134 return (Object []) (new Control[0]); 135 } 136 137 142 public abstract Format[] getSupportedFormats(); 143 144 public void setPluginGraph(MediaPluginGraph graph) 145 { 146 m_mediaPlugins = graph.getPluginVector(); 147 } 148 149 public Vector getPluginGraph() 150 { 151 return m_mediaPlugins; 152 } 153 } 154 | Popular Tags |