author | terytkon |
Wed, 02 Jun 2010 10:50:41 +0300 | |
changeset 1 | fe41c66bacc7 |
parent 0 | 30eb2d538f02 |
permissions | -rw-r--r-- |
0
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
1 |
/* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
2 |
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
3 |
* All rights reserved. |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
4 |
* This component and the accompanying materials are made available |
1 | 5 |
* under the terms of the License "Eclipse Public License v1.0" |
0
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
6 |
* which accompanies this distribution, and is available |
1 | 7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html". |
0
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
8 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
9 |
* Initial Contributors: |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
10 |
* Nokia Corporation - Initial contribution |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
11 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
12 |
* Contributors: |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
13 |
* |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
14 |
* Description: This file is part of com.nokia.tools.variant.media.ui component. |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
15 |
*/ |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
16 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
17 |
package com.nokia.tools.variant.internal.media.ui; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
18 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
19 |
import java.awt.Dimension; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
20 |
import java.io.File; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
21 |
import java.io.FileInputStream; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
22 |
import java.io.FileOutputStream; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
23 |
import java.io.IOException; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
24 |
import java.io.InputStream; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
25 |
import java.nio.channels.FileChannel; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
26 |
import java.util.Map; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
27 |
import java.util.concurrent.Semaphore; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
28 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
29 |
import javax.media.ControllerEvent; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
30 |
import javax.media.ControllerListener; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
31 |
import javax.media.Format; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
32 |
import javax.media.Manager; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
33 |
import javax.media.NoProcessorException; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
34 |
import javax.media.PrefetchCompleteEvent; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
35 |
import javax.media.Processor; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
36 |
import javax.media.StopEvent; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
37 |
import javax.media.Time; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
38 |
import javax.media.control.TrackControl; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
39 |
import javax.media.format.AudioFormat; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
40 |
import javax.media.format.VideoFormat; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
41 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
42 |
import org.eclipse.core.runtime.CoreException; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
43 |
import org.eclipse.core.runtime.IConfigurationElement; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
44 |
import org.eclipse.core.runtime.IExecutableExtension; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
45 |
import org.eclipse.core.runtime.QualifiedName; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
46 |
import org.eclipse.core.runtime.content.IContentDescriber; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
47 |
import org.eclipse.core.runtime.content.IContentDescription; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
48 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
49 |
import com.nokia.tools.variant.common.core.utils.FileUtils; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
50 |
import com.nokia.tools.variant.media.ui.MediaUIPlugin; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
51 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
52 |
public class MediaDescriber implements IContentDescriber, IExecutableExtension { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
53 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
54 |
private String ext; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
55 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
56 |
public MediaDescriber() { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
57 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
58 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
59 |
public void setInitializationData(IConfigurationElement config, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
60 |
String propertyName, Object data) throws CoreException { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
61 |
if ("describer".equals(propertyName) && data instanceof Map) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
62 |
Map<?, ?> map = (Map<?, ?>) data; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
63 |
Object value = map.get("extension"); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
64 |
ext = (String) value; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
65 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
66 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
67 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
68 |
private File createTempFile(InputStream contents, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
69 |
IContentDescription description) throws Exception { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
70 |
File tempFile = File.createTempFile("temp", "." |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
71 |
+ (ext == null ? "wav" : ext)); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
72 |
FileOutputStream fos = new FileOutputStream(tempFile); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
73 |
try { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
74 |
long length = FileUtils.copyStream(contents, fos); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
75 |
if (description != null) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
76 |
description.setProperty(MediaUIPlugin.SIZE, length); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
77 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
78 |
} finally { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
79 |
FileUtils.closeStream(fos); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
80 |
tempFile.deleteOnExit(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
81 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
82 |
return tempFile; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
83 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
84 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
85 |
public static void copyFile(File in, File out) throws IOException { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
86 |
FileChannel inChannel = new FileInputStream(in).getChannel(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
87 |
FileChannel outChannel = new FileOutputStream(out).getChannel(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
88 |
try { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
89 |
inChannel.transferTo(0, inChannel.size(), outChannel); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
90 |
} catch (IOException e) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
91 |
throw e; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
92 |
} finally { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
93 |
if (inChannel != null) |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
94 |
inChannel.close(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
95 |
if (outChannel != null) |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
96 |
outChannel.close(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
97 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
98 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
99 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
100 |
public int describe(InputStream contents, IContentDescription description) |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
101 |
throws IOException { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
102 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
103 |
if (description == null) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
104 |
return INDETERMINATE; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
105 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
106 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
107 |
File tempFile = null; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
108 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
109 |
try { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
110 |
tempFile = createTempFile(contents, description); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
111 |
final Semaphore sem = new Semaphore(0); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
112 |
Processor p = null; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
113 |
try { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
114 |
// force get info - bug 5979, 8812 |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
115 |
String ext = FileUtils.getExtension(tempFile); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
116 |
if (ext.equalsIgnoreCase("mpeg")) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
117 |
String path = tempFile.getAbsolutePath(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
118 |
String substring = path.substring(0, path |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
119 |
.lastIndexOf(".mpeg")); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
120 |
File file = new File(substring + ".mpg"); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
121 |
copyFile(tempFile, file); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
122 |
p = Manager.createProcessor(file.toURL()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
123 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
124 |
file.deleteOnExit(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
125 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
126 |
if (p == null) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
127 |
return INDETERMINATE; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
128 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
129 |
}else{ |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
130 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
131 |
if (tempFile.length() != 0) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
132 |
p = Manager.createProcessor(tempFile.toURL()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
133 |
} else { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
134 |
return INDETERMINATE; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
135 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
136 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
137 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
138 |
} catch (NoProcessorException e) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
139 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
140 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
141 |
p.addControllerListener(new ControllerListener() { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
142 |
public void controllerUpdate(ControllerEvent arg0) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
143 |
if (arg0 instanceof PrefetchCompleteEvent) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
144 |
sem.release(1); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
145 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
146 |
if (arg0 instanceof StopEvent) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
147 |
sem.release(3); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
148 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
149 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
150 |
}); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
151 |
p.prefetch(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
152 |
sem.acquire(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
153 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
154 |
Time duration = p.getDuration(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
155 |
description.setProperty(MediaUIPlugin.DURATION, duration |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
156 |
.getSeconds()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
157 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
158 |
for (TrackControl tc : p.getTrackControls()) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
159 |
Format f = tc.getFormat(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
160 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
161 |
if (f instanceof VideoFormat) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
162 |
VideoFormat vf = (VideoFormat) f; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
163 |
description.setProperty(MediaUIPlugin.VIDEO_CODEC, vf |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
164 |
.getEncoding()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
165 |
description.setProperty(MediaUIPlugin.VIDEO_FRAMERATE, vf |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
166 |
.getFrameRate()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
167 |
Dimension d = vf.getSize(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
168 |
description.setProperty(MediaUIPlugin.VIDEO_WIDTH, d.width); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
169 |
description.setProperty(MediaUIPlugin.VIDEO_HEIGHT, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
170 |
d.height); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
171 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
172 |
if (f instanceof AudioFormat) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
173 |
AudioFormat af = (AudioFormat) f; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
174 |
description.setProperty(MediaUIPlugin.AUDIO_CODEC, af |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
175 |
.getEncoding()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
176 |
description.setProperty(MediaUIPlugin.AUDIO_CHANNELS, af |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
177 |
.getChannels()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
178 |
description.setProperty(MediaUIPlugin.AUDIO_FRAMERATE, af |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
179 |
.getFrameRate()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
180 |
description.setProperty(MediaUIPlugin.AUDIO_SAMPLERATE, af |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
181 |
.getSampleRate()); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
182 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
183 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
184 |
p.deallocate(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
185 |
} catch (Exception ex) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
186 |
ex.printStackTrace(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
187 |
} finally { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
188 |
if (tempFile != null) { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
189 |
tempFile.delete(); |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
190 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
191 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
192 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
193 |
return INDETERMINATE; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
194 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
195 |
|
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
196 |
public QualifiedName[] getSupportedOptions() { |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
197 |
return new QualifiedName[] { MediaUIPlugin.SIZE, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
198 |
MediaUIPlugin.DURATION, MediaUIPlugin.VIDEO_CODEC, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
199 |
MediaUIPlugin.VIDEO_FRAMERATE, MediaUIPlugin.VIDEO_WIDTH, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
200 |
MediaUIPlugin.VIDEO_HEIGHT, MediaUIPlugin.AUDIO_CODEC, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
201 |
MediaUIPlugin.AUDIO_CHANNELS, MediaUIPlugin.AUDIO_FRAMERATE, |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
202 |
MediaUIPlugin.AUDIO_SAMPLERATE }; |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
203 |
} |
30eb2d538f02
Moved all configtools under oss repository and under epl licence.
terytkon
parents:
diff
changeset
|
204 |
} |