MediaInfoを使用して動画サイズを取得するライブラリ
Révision | 21e8a3c67d52419599448a5150b151646cffb596 (tree) |
---|---|
l'heure | 2011-08-02 02:50:42 |
Auteur | yukihane <yukihane.feather@gmai...> |
Commiter | yukihane |
MediaInfoを使用してサイズを取得する
@@ -0,0 +1,74 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- You may freely edit this file. See commented blocks below for --> | |
3 | +<!-- some examples of how to customize the build. --> | |
4 | +<!-- (If you delete it and reopen the project it will be recreated.) --> | |
5 | +<!-- By default, only the Clean and Build commands use this build script. --> | |
6 | +<!-- Commands such as Run, Debug, and Test only use this build script if --> | |
7 | +<!-- the Compile on Save feature is turned off for the project. --> | |
8 | +<!-- You can turn off the Compile on Save (or Deploy on Save) setting --> | |
9 | +<!-- in the project's Project Properties dialog box.--> | |
10 | +<project name="MediaInfoWrapper" default="default" basedir="."> | |
11 | + <description>Builds, tests, and runs the project MediaInfoWrapper.</description> | |
12 | + <import file="nbproject/build-impl.xml"/> | |
13 | + <!-- | |
14 | + | |
15 | + There exist several targets which are by default empty and which can be | |
16 | + used for execution of your tasks. These targets are usually executed | |
17 | + before and after some main targets. They are: | |
18 | + | |
19 | + -pre-init: called before initialization of project properties | |
20 | + -post-init: called after initialization of project properties | |
21 | + -pre-compile: called before javac compilation | |
22 | + -post-compile: called after javac compilation | |
23 | + -pre-compile-single: called before javac compilation of single file | |
24 | + -post-compile-single: called after javac compilation of single file | |
25 | + -pre-compile-test: called before javac compilation of JUnit tests | |
26 | + -post-compile-test: called after javac compilation of JUnit tests | |
27 | + -pre-compile-test-single: called before javac compilation of single JUnit test | |
28 | + -post-compile-test-single: called after javac compilation of single JUunit test | |
29 | + -pre-jar: called before JAR building | |
30 | + -post-jar: called after JAR building | |
31 | + -post-clean: called after cleaning build products | |
32 | + | |
33 | + (Targets beginning with '-' are not intended to be called on their own.) | |
34 | + | |
35 | + Example of inserting an obfuscator after compilation could look like this: | |
36 | + | |
37 | + <target name="-post-compile"> | |
38 | + <obfuscate> | |
39 | + <fileset dir="${build.classes.dir}"/> | |
40 | + </obfuscate> | |
41 | + </target> | |
42 | + | |
43 | + For list of available properties check the imported | |
44 | + nbproject/build-impl.xml file. | |
45 | + | |
46 | + | |
47 | + Another way to customize the build is by overriding existing main targets. | |
48 | + The targets of interest are: | |
49 | + | |
50 | + -init-macrodef-javac: defines macro for javac compilation | |
51 | + -init-macrodef-junit: defines macro for junit execution | |
52 | + -init-macrodef-debug: defines macro for class debugging | |
53 | + -init-macrodef-java: defines macro for class execution | |
54 | + -do-jar-with-manifest: JAR building (if you are using a manifest) | |
55 | + -do-jar-without-manifest: JAR building (if you are not using a manifest) | |
56 | + run: execution of project | |
57 | + -javadoc-build: Javadoc generation | |
58 | + test-report: JUnit report generation | |
59 | + | |
60 | + An example of overriding the target for project execution could look like this: | |
61 | + | |
62 | + <target name="run" depends="MediaInfoWrapper-impl.jar"> | |
63 | + <exec dir="bin" executable="launcher.exe"> | |
64 | + <arg file="${dist.jar}"/> | |
65 | + </exec> | |
66 | + </target> | |
67 | + | |
68 | + Notice that the overridden target depends on the jar target and not only on | |
69 | + the compile target as the regular run target does. Again, for a list of available | |
70 | + properties which you can use, check the target you are overriding in the | |
71 | + nbproject/build-impl.xml file. | |
72 | + | |
73 | + --> | |
74 | +</project> |
@@ -0,0 +1,3 @@ | ||
1 | +Manifest-Version: 1.0 | |
2 | +X-COMMENT: Main-Class will be added automatically by build | |
3 | + |
@@ -0,0 +1,1041 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<!-- | |
3 | +*** GENERATED FROM project.xml - DO NOT EDIT *** | |
4 | +*** EDIT ../build.xml INSTEAD *** | |
5 | + | |
6 | +For the purpose of easier reading the script | |
7 | +is divided into following sections: | |
8 | + | |
9 | + - initialization | |
10 | + - compilation | |
11 | + - jar | |
12 | + - execution | |
13 | + - debugging | |
14 | + - javadoc | |
15 | + - junit compilation | |
16 | + - junit execution | |
17 | + - junit debugging | |
18 | + - applet | |
19 | + - cleanup | |
20 | + | |
21 | + --> | |
22 | +<project xmlns:j2seproject1="http://www.netbeans.org/ns/j2se-project/1" xmlns:j2seproject3="http://www.netbeans.org/ns/j2se-project/3" xmlns:jaxrpc="http://www.netbeans.org/ns/j2se-project/jax-rpc" basedir=".." default="default" name="MediaInfoWrapper-impl"> | |
23 | + <fail message="Please build using Ant 1.7.1 or higher."> | |
24 | + <condition> | |
25 | + <not> | |
26 | + <antversion atleast="1.7.1"/> | |
27 | + </not> | |
28 | + </condition> | |
29 | + </fail> | |
30 | + <target depends="test,jar,javadoc" description="Build and test whole project." name="default"/> | |
31 | + <!-- | |
32 | + ====================== | |
33 | + INITIALIZATION SECTION | |
34 | + ====================== | |
35 | + --> | |
36 | + <target name="-pre-init"> | |
37 | + <!-- Empty placeholder for easier customization. --> | |
38 | + <!-- You can override this target in the ../build.xml file. --> | |
39 | + </target> | |
40 | + <target depends="-pre-init" name="-init-private"> | |
41 | + <property file="nbproject/private/config.properties"/> | |
42 | + <property file="nbproject/private/configs/${config}.properties"/> | |
43 | + <property file="nbproject/private/private.properties"/> | |
44 | + </target> | |
45 | + <target depends="-pre-init,-init-private" name="-init-user"> | |
46 | + <property file="${user.properties.file}"/> | |
47 | + <!-- The two properties below are usually overridden --> | |
48 | + <!-- by the active platform. Just a fallback. --> | |
49 | + <property name="default.javac.source" value="1.4"/> | |
50 | + <property name="default.javac.target" value="1.4"/> | |
51 | + </target> | |
52 | + <target depends="-pre-init,-init-private,-init-user" name="-init-project"> | |
53 | + <property file="nbproject/configs/${config}.properties"/> | |
54 | + <property file="nbproject/project.properties"/> | |
55 | + </target> | |
56 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init"> | |
57 | + <available file="${manifest.file}" property="manifest.available"/> | |
58 | + <condition property="splashscreen.available"> | |
59 | + <and> | |
60 | + <not> | |
61 | + <equals arg1="${application.splash}" arg2="" trim="true"/> | |
62 | + </not> | |
63 | + <available file="${application.splash}"/> | |
64 | + </and> | |
65 | + </condition> | |
66 | + <condition property="main.class.available"> | |
67 | + <and> | |
68 | + <isset property="main.class"/> | |
69 | + <not> | |
70 | + <equals arg1="${main.class}" arg2="" trim="true"/> | |
71 | + </not> | |
72 | + </and> | |
73 | + </condition> | |
74 | + <condition property="manifest.available+main.class"> | |
75 | + <and> | |
76 | + <isset property="manifest.available"/> | |
77 | + <isset property="main.class.available"/> | |
78 | + </and> | |
79 | + </condition> | |
80 | + <condition property="do.archive"> | |
81 | + <not> | |
82 | + <istrue value="${jar.archive.disabled}"/> | |
83 | + </not> | |
84 | + </condition> | |
85 | + <condition property="do.mkdist"> | |
86 | + <and> | |
87 | + <isset property="do.archive"/> | |
88 | + <isset property="libs.CopyLibs.classpath"/> | |
89 | + <not> | |
90 | + <istrue value="${mkdist.disabled}"/> | |
91 | + </not> | |
92 | + </and> | |
93 | + </condition> | |
94 | + <condition property="manifest.available+main.class+mkdist.available"> | |
95 | + <and> | |
96 | + <istrue value="${manifest.available+main.class}"/> | |
97 | + <isset property="do.mkdist"/> | |
98 | + </and> | |
99 | + </condition> | |
100 | + <condition property="do.archive+manifest.available"> | |
101 | + <and> | |
102 | + <isset property="manifest.available"/> | |
103 | + <istrue value="${do.archive}"/> | |
104 | + </and> | |
105 | + </condition> | |
106 | + <condition property="do.archive+main.class.available"> | |
107 | + <and> | |
108 | + <isset property="main.class.available"/> | |
109 | + <istrue value="${do.archive}"/> | |
110 | + </and> | |
111 | + </condition> | |
112 | + <condition property="do.archive+splashscreen.available"> | |
113 | + <and> | |
114 | + <isset property="splashscreen.available"/> | |
115 | + <istrue value="${do.archive}"/> | |
116 | + </and> | |
117 | + </condition> | |
118 | + <condition property="do.archive+manifest.available+main.class"> | |
119 | + <and> | |
120 | + <istrue value="${manifest.available+main.class}"/> | |
121 | + <istrue value="${do.archive}"/> | |
122 | + </and> | |
123 | + </condition> | |
124 | + <condition property="manifest.available-mkdist.available"> | |
125 | + <or> | |
126 | + <istrue value="${manifest.available}"/> | |
127 | + <isset property="do.mkdist"/> | |
128 | + </or> | |
129 | + </condition> | |
130 | + <condition property="manifest.available+main.class-mkdist.available"> | |
131 | + <or> | |
132 | + <istrue value="${manifest.available+main.class}"/> | |
133 | + <isset property="do.mkdist"/> | |
134 | + </or> | |
135 | + </condition> | |
136 | + <condition property="have.tests"> | |
137 | + <or> | |
138 | + <available file="${test.src.dir}"/> | |
139 | + </or> | |
140 | + </condition> | |
141 | + <condition property="have.sources"> | |
142 | + <or> | |
143 | + <available file="${src.dir}"/> | |
144 | + </or> | |
145 | + </condition> | |
146 | + <condition property="netbeans.home+have.tests"> | |
147 | + <and> | |
148 | + <isset property="netbeans.home"/> | |
149 | + <isset property="have.tests"/> | |
150 | + </and> | |
151 | + </condition> | |
152 | + <condition property="no.javadoc.preview"> | |
153 | + <and> | |
154 | + <isset property="javadoc.preview"/> | |
155 | + <isfalse value="${javadoc.preview}"/> | |
156 | + </and> | |
157 | + </condition> | |
158 | + <property name="run.jvmargs" value=""/> | |
159 | + <property name="javac.compilerargs" value=""/> | |
160 | + <property name="work.dir" value="${basedir}"/> | |
161 | + <condition property="no.deps"> | |
162 | + <and> | |
163 | + <istrue value="${no.dependencies}"/> | |
164 | + </and> | |
165 | + </condition> | |
166 | + <property name="javac.debug" value="true"/> | |
167 | + <property name="javadoc.preview" value="true"/> | |
168 | + <property name="application.args" value=""/> | |
169 | + <property name="source.encoding" value="${file.encoding}"/> | |
170 | + <property name="runtime.encoding" value="${source.encoding}"/> | |
171 | + <condition property="javadoc.encoding.used" value="${javadoc.encoding}"> | |
172 | + <and> | |
173 | + <isset property="javadoc.encoding"/> | |
174 | + <not> | |
175 | + <equals arg1="${javadoc.encoding}" arg2=""/> | |
176 | + </not> | |
177 | + </and> | |
178 | + </condition> | |
179 | + <property name="javadoc.encoding.used" value="${source.encoding}"/> | |
180 | + <property name="includes" value="**"/> | |
181 | + <property name="excludes" value=""/> | |
182 | + <property name="do.depend" value="false"/> | |
183 | + <condition property="do.depend.true"> | |
184 | + <istrue value="${do.depend}"/> | |
185 | + </condition> | |
186 | + <path id="endorsed.classpath.path" path="${endorsed.classpath}"/> | |
187 | + <condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'"> | |
188 | + <length length="0" string="${endorsed.classpath}" when="greater"/> | |
189 | + </condition> | |
190 | + <condition else="false" property="jdkBug6558476"> | |
191 | + <and> | |
192 | + <matches pattern="1\.[56]" string="${java.specification.version}"/> | |
193 | + <not> | |
194 | + <os family="unix"/> | |
195 | + </not> | |
196 | + </and> | |
197 | + </condition> | |
198 | + <property name="javac.fork" value="${jdkBug6558476}"/> | |
199 | + <property name="jar.index" value="false"/> | |
200 | + <property name="jar.index.metainf" value="${jar.index}"/> | |
201 | + <available file="${meta.inf.dir}/persistence.xml" property="has.persistence.xml"/> | |
202 | + </target> | |
203 | + <target name="-post-init"> | |
204 | + <!-- Empty placeholder for easier customization. --> | |
205 | + <!-- You can override this target in the ../build.xml file. --> | |
206 | + </target> | |
207 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check"> | |
208 | + <fail unless="src.dir">Must set src.dir</fail> | |
209 | + <fail unless="test.src.dir">Must set test.src.dir</fail> | |
210 | + <fail unless="build.dir">Must set build.dir</fail> | |
211 | + <fail unless="dist.dir">Must set dist.dir</fail> | |
212 | + <fail unless="build.classes.dir">Must set build.classes.dir</fail> | |
213 | + <fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail> | |
214 | + <fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail> | |
215 | + <fail unless="build.test.results.dir">Must set build.test.results.dir</fail> | |
216 | + <fail unless="build.classes.excludes">Must set build.classes.excludes</fail> | |
217 | + <fail unless="dist.jar">Must set dist.jar</fail> | |
218 | + </target> | |
219 | + <target name="-init-macrodef-property"> | |
220 | + <macrodef name="property" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
221 | + <attribute name="name"/> | |
222 | + <attribute name="value"/> | |
223 | + <sequential> | |
224 | + <property name="@{name}" value="${@{value}}"/> | |
225 | + </sequential> | |
226 | + </macrodef> | |
227 | + </target> | |
228 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors"> | |
229 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
230 | + <attribute default="${src.dir}" name="srcdir"/> | |
231 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
232 | + <attribute default="${javac.classpath}" name="classpath"/> | |
233 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
234 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
235 | + <attribute default="${includes}" name="includes"/> | |
236 | + <attribute default="${excludes}" name="excludes"/> | |
237 | + <attribute default="${javac.debug}" name="debug"/> | |
238 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
239 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
240 | + <element name="customize" optional="true"/> | |
241 | + <sequential> | |
242 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
243 | + <mkdir dir="${empty.dir}"/> | |
244 | + <mkdir dir="@{apgeneratedsrcdir}"/> | |
245 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
246 | + <src> | |
247 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
248 | + <include name="*"/> | |
249 | + </dirset> | |
250 | + </src> | |
251 | + <classpath> | |
252 | + <path path="@{classpath}"/> | |
253 | + </classpath> | |
254 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
255 | + <compilerarg line="${javac.compilerargs}"/> | |
256 | + <compilerarg value="-processorpath"/> | |
257 | + <compilerarg path="@{processorpath}:${empty.dir}"/> | |
258 | + <compilerarg line="${ap.processors.internal}"/> | |
259 | + <compilerarg line="${annotation.processing.processor.options}"/> | |
260 | + <compilerarg value="-s"/> | |
261 | + <compilerarg path="@{apgeneratedsrcdir}"/> | |
262 | + <compilerarg line="${ap.proc.none.internal}"/> | |
263 | + <customize/> | |
264 | + </javac> | |
265 | + </sequential> | |
266 | + </macrodef> | |
267 | + </target> | |
268 | + <target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal"> | |
269 | + <macrodef name="javac" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
270 | + <attribute default="${src.dir}" name="srcdir"/> | |
271 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
272 | + <attribute default="${javac.classpath}" name="classpath"/> | |
273 | + <attribute default="${javac.processorpath}" name="processorpath"/> | |
274 | + <attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/> | |
275 | + <attribute default="${includes}" name="includes"/> | |
276 | + <attribute default="${excludes}" name="excludes"/> | |
277 | + <attribute default="${javac.debug}" name="debug"/> | |
278 | + <attribute default="${empty.dir}" name="sourcepath"/> | |
279 | + <attribute default="${empty.dir}" name="gensrcdir"/> | |
280 | + <element name="customize" optional="true"/> | |
281 | + <sequential> | |
282 | + <property location="${build.dir}/empty" name="empty.dir"/> | |
283 | + <mkdir dir="${empty.dir}"/> | |
284 | + <javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" fork="${javac.fork}" includeantruntime="false" includes="@{includes}" source="${javac.source}" sourcepath="@{sourcepath}" srcdir="@{srcdir}" target="${javac.target}" tempdir="${java.io.tmpdir}"> | |
285 | + <src> | |
286 | + <dirset dir="@{gensrcdir}" erroronmissingdir="false"> | |
287 | + <include name="*"/> | |
288 | + </dirset> | |
289 | + </src> | |
290 | + <classpath> | |
291 | + <path path="@{classpath}"/> | |
292 | + </classpath> | |
293 | + <compilerarg line="${endorsed.classpath.cmd.line.arg}"/> | |
294 | + <compilerarg line="${javac.compilerargs}"/> | |
295 | + <customize/> | |
296 | + </javac> | |
297 | + </sequential> | |
298 | + </macrodef> | |
299 | + </target> | |
300 | + <target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac"> | |
301 | + <macrodef name="depend" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
302 | + <attribute default="${src.dir}" name="srcdir"/> | |
303 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
304 | + <attribute default="${javac.classpath}" name="classpath"/> | |
305 | + <sequential> | |
306 | + <depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}"> | |
307 | + <classpath> | |
308 | + <path path="@{classpath}"/> | |
309 | + </classpath> | |
310 | + </depend> | |
311 | + </sequential> | |
312 | + </macrodef> | |
313 | + <macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
314 | + <attribute default="${build.classes.dir}" name="destdir"/> | |
315 | + <sequential> | |
316 | + <fail unless="javac.includes">Must set javac.includes</fail> | |
317 | + <pathconvert pathsep="${line.separator}" property="javac.includes.binary"> | |
318 | + <path> | |
319 | + <filelist dir="@{destdir}" files="${javac.includes}"/> | |
320 | + </path> | |
321 | + <globmapper from="*.java" to="*.class"/> | |
322 | + </pathconvert> | |
323 | + <tempfile deleteonexit="true" property="javac.includesfile.binary"/> | |
324 | + <echo file="${javac.includesfile.binary}" message="${javac.includes.binary}"/> | |
325 | + <delete> | |
326 | + <files includesfile="${javac.includesfile.binary}"/> | |
327 | + </delete> | |
328 | + <delete> | |
329 | + <fileset file="${javac.includesfile.binary}"/> | |
330 | + </delete> | |
331 | + </sequential> | |
332 | + </macrodef> | |
333 | + </target> | |
334 | + <target name="-init-macrodef-junit"> | |
335 | + <macrodef name="junit" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
336 | + <attribute default="${includes}" name="includes"/> | |
337 | + <attribute default="${excludes}" name="excludes"/> | |
338 | + <attribute default="**" name="testincludes"/> | |
339 | + <sequential> | |
340 | + <property name="junit.forkmode" value="perTest"/> | |
341 | + <junit dir="${work.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" forkmode="${junit.forkmode}" showoutput="true" tempdir="${build.dir}"> | |
342 | + <batchtest todir="${build.test.results.dir}"> | |
343 | + <fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}"> | |
344 | + <filename name="@{testincludes}"/> | |
345 | + </fileset> | |
346 | + </batchtest> | |
347 | + <classpath> | |
348 | + <path path="${run.test.classpath}"/> | |
349 | + </classpath> | |
350 | + <syspropertyset> | |
351 | + <propertyref prefix="test-sys-prop."/> | |
352 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
353 | + </syspropertyset> | |
354 | + <formatter type="brief" usefile="false"/> | |
355 | + <formatter type="xml"/> | |
356 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
357 | + <jvmarg value="-ea"/> | |
358 | + <jvmarg line="${run.jvmargs}"/> | |
359 | + </junit> | |
360 | + </sequential> | |
361 | + </macrodef> | |
362 | + </target> | |
363 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check" name="profile-init"/> | |
364 | + <target name="-profile-pre-init"> | |
365 | + <!-- Empty placeholder for easier customization. --> | |
366 | + <!-- You can override this target in the ../build.xml file. --> | |
367 | + </target> | |
368 | + <target name="-profile-post-init"> | |
369 | + <!-- Empty placeholder for easier customization. --> | |
370 | + <!-- You can override this target in the ../build.xml file. --> | |
371 | + </target> | |
372 | + <target name="-profile-init-macrodef-profile"> | |
373 | + <macrodef name="resolve"> | |
374 | + <attribute name="name"/> | |
375 | + <attribute name="value"/> | |
376 | + <sequential> | |
377 | + <property name="@{name}" value="${env.@{value}}"/> | |
378 | + </sequential> | |
379 | + </macrodef> | |
380 | + <macrodef name="profile"> | |
381 | + <attribute default="${main.class}" name="classname"/> | |
382 | + <element name="customize" optional="true"/> | |
383 | + <sequential> | |
384 | + <property environment="env"/> | |
385 | + <resolve name="profiler.current.path" value="${profiler.info.pathvar}"/> | |
386 | + <java classname="@{classname}" dir="${profiler.info.dir}" fork="true" jvm="${profiler.info.jvm}"> | |
387 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
388 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
389 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
390 | + <arg line="${application.args}"/> | |
391 | + <classpath> | |
392 | + <path path="${run.classpath}"/> | |
393 | + </classpath> | |
394 | + <syspropertyset> | |
395 | + <propertyref prefix="run-sys-prop."/> | |
396 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
397 | + </syspropertyset> | |
398 | + <customize/> | |
399 | + </java> | |
400 | + </sequential> | |
401 | + </macrodef> | |
402 | + </target> | |
403 | + <target depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile" name="-profile-init-check"> | |
404 | + <fail unless="profiler.info.jvm">Must set JVM to use for profiling in profiler.info.jvm</fail> | |
405 | + <fail unless="profiler.info.jvmargs.agent">Must set profiler agent JVM arguments in profiler.info.jvmargs.agent</fail> | |
406 | + </target> | |
407 | + <target depends="-init-debug-args" name="-init-macrodef-nbjpda"> | |
408 | + <macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
409 | + <attribute default="${main.class}" name="name"/> | |
410 | + <attribute default="${debug.classpath}" name="classpath"/> | |
411 | + <attribute default="" name="stopclassname"/> | |
412 | + <sequential> | |
413 | + <nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}"> | |
414 | + <classpath> | |
415 | + <path path="@{classpath}"/> | |
416 | + </classpath> | |
417 | + </nbjpdastart> | |
418 | + </sequential> | |
419 | + </macrodef> | |
420 | + <macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
421 | + <attribute default="${build.classes.dir}" name="dir"/> | |
422 | + <sequential> | |
423 | + <nbjpdareload> | |
424 | + <fileset dir="@{dir}" includes="${fix.classes}"> | |
425 | + <include name="${fix.includes}*.class"/> | |
426 | + </fileset> | |
427 | + </nbjpdareload> | |
428 | + </sequential> | |
429 | + </macrodef> | |
430 | + </target> | |
431 | + <target name="-init-debug-args"> | |
432 | + <property name="version-output" value="java version "${ant.java.version}"/> | |
433 | + <condition property="have-jdk-older-than-1.4"> | |
434 | + <or> | |
435 | + <contains string="${version-output}" substring="java version "1.0"/> | |
436 | + <contains string="${version-output}" substring="java version "1.1"/> | |
437 | + <contains string="${version-output}" substring="java version "1.2"/> | |
438 | + <contains string="${version-output}" substring="java version "1.3"/> | |
439 | + </or> | |
440 | + </condition> | |
441 | + <condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none"> | |
442 | + <istrue value="${have-jdk-older-than-1.4}"/> | |
443 | + </condition> | |
444 | + <condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem"> | |
445 | + <os family="windows"/> | |
446 | + </condition> | |
447 | + <condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}"> | |
448 | + <isset property="debug.transport"/> | |
449 | + </condition> | |
450 | + </target> | |
451 | + <target depends="-init-debug-args" name="-init-macrodef-debug"> | |
452 | + <macrodef name="debug" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
453 | + <attribute default="${main.class}" name="classname"/> | |
454 | + <attribute default="${debug.classpath}" name="classpath"/> | |
455 | + <element name="customize" optional="true"/> | |
456 | + <sequential> | |
457 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
458 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
459 | + <jvmarg line="${debug-args-line}"/> | |
460 | + <jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/> | |
461 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
462 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
463 | + <jvmarg line="${run.jvmargs}"/> | |
464 | + <classpath> | |
465 | + <path path="@{classpath}"/> | |
466 | + </classpath> | |
467 | + <syspropertyset> | |
468 | + <propertyref prefix="run-sys-prop."/> | |
469 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
470 | + </syspropertyset> | |
471 | + <customize/> | |
472 | + </java> | |
473 | + </sequential> | |
474 | + </macrodef> | |
475 | + </target> | |
476 | + <target name="-init-macrodef-java"> | |
477 | + <macrodef name="java" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
478 | + <attribute default="${main.class}" name="classname"/> | |
479 | + <attribute default="${run.classpath}" name="classpath"/> | |
480 | + <element name="customize" optional="true"/> | |
481 | + <sequential> | |
482 | + <java classname="@{classname}" dir="${work.dir}" fork="true"> | |
483 | + <jvmarg line="${endorsed.classpath.cmd.line.arg}"/> | |
484 | + <jvmarg value="-Dfile.encoding=${runtime.encoding}"/> | |
485 | + <redirector errorencoding="${runtime.encoding}" inputencoding="${runtime.encoding}" outputencoding="${runtime.encoding}"/> | |
486 | + <jvmarg line="${run.jvmargs}"/> | |
487 | + <classpath> | |
488 | + <path path="@{classpath}"/> | |
489 | + </classpath> | |
490 | + <syspropertyset> | |
491 | + <propertyref prefix="run-sys-prop."/> | |
492 | + <mapper from="run-sys-prop.*" to="*" type="glob"/> | |
493 | + </syspropertyset> | |
494 | + <customize/> | |
495 | + </java> | |
496 | + </sequential> | |
497 | + </macrodef> | |
498 | + </target> | |
499 | + <target name="-init-macrodef-copylibs"> | |
500 | + <macrodef name="copylibs" uri="http://www.netbeans.org/ns/j2se-project/3"> | |
501 | + <attribute default="${manifest.file}" name="manifest"/> | |
502 | + <element name="customize" optional="true"/> | |
503 | + <sequential> | |
504 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
505 | + <pathconvert property="run.classpath.without.build.classes.dir"> | |
506 | + <path path="${run.classpath}"/> | |
507 | + <map from="${build.classes.dir.resolved}" to=""/> | |
508 | + </pathconvert> | |
509 | + <pathconvert pathsep=" " property="jar.classpath"> | |
510 | + <path path="${run.classpath.without.build.classes.dir}"/> | |
511 | + <chainedmapper> | |
512 | + <flattenmapper/> | |
513 | + <globmapper from="*" to="lib/*"/> | |
514 | + </chainedmapper> | |
515 | + </pathconvert> | |
516 | + <taskdef classname="org.netbeans.modules.java.j2seproject.copylibstask.CopyLibs" classpath="${libs.CopyLibs.classpath}" name="copylibs"/> | |
517 | + <copylibs compress="${jar.compress}" index="${jar.index}" indexMetaInf="${jar.index.metainf}" jarfile="${dist.jar}" manifest="@{manifest}" runtimeclasspath="${run.classpath.without.build.classes.dir}"> | |
518 | + <fileset dir="${build.classes.dir}"/> | |
519 | + <manifest> | |
520 | + <attribute name="Class-Path" value="${jar.classpath}"/> | |
521 | + <customize/> | |
522 | + </manifest> | |
523 | + </copylibs> | |
524 | + </sequential> | |
525 | + </macrodef> | |
526 | + </target> | |
527 | + <target name="-init-presetdef-jar"> | |
528 | + <presetdef name="jar" uri="http://www.netbeans.org/ns/j2se-project/1"> | |
529 | + <jar compress="${jar.compress}" index="${jar.index}" jarfile="${dist.jar}"> | |
530 | + <j2seproject1:fileset dir="${build.classes.dir}"/> | |
531 | + </jar> | |
532 | + </presetdef> | |
533 | + </target> | |
534 | + <target name="-init-ap-cmdline-properties"> | |
535 | + <property name="annotation.processing.enabled" value="true"/> | |
536 | + <property name="annotation.processing.processors.list" value=""/> | |
537 | + <property name="annotation.processing.processor.options" value=""/> | |
538 | + <property name="annotation.processing.run.all.processors" value="true"/> | |
539 | + <property name="javac.processorpath" value="${javac.classpath}"/> | |
540 | + <property name="javac.test.processorpath" value="${javac.test.classpath}"/> | |
541 | + <condition property="ap.supported.internal" value="true"> | |
542 | + <not> | |
543 | + <matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/> | |
544 | + </not> | |
545 | + </condition> | |
546 | + </target> | |
547 | + <target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported"> | |
548 | + <condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}"> | |
549 | + <isfalse value="${annotation.processing.run.all.processors}"/> | |
550 | + </condition> | |
551 | + <condition else="" property="ap.proc.none.internal" value="-proc:none"> | |
552 | + <isfalse value="${annotation.processing.enabled}"/> | |
553 | + </condition> | |
554 | + </target> | |
555 | + <target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline"> | |
556 | + <property name="ap.cmd.line.internal" value=""/> | |
557 | + </target> | |
558 | + <target depends="-pre-init,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline" name="init"/> | |
559 | + <!-- | |
560 | + =================== | |
561 | + COMPILATION SECTION | |
562 | + =================== | |
563 | + --> | |
564 | + <target name="-deps-jar-init" unless="built-jar.properties"> | |
565 | + <property location="${build.dir}/built-jar.properties" name="built-jar.properties"/> | |
566 | + <delete file="${built-jar.properties}" quiet="true"/> | |
567 | + </target> | |
568 | + <target if="already.built.jar.${basedir}" name="-warn-already-built-jar"> | |
569 | + <echo level="warn" message="Cycle detected: MediaInfoWrapper was already built"/> | |
570 | + </target> | |
571 | + <target depends="init,-deps-jar-init" name="deps-jar" unless="no.deps"> | |
572 | + <mkdir dir="${build.dir}"/> | |
573 | + <touch file="${built-jar.properties}" verbose="false"/> | |
574 | + <property file="${built-jar.properties}" prefix="already.built.jar."/> | |
575 | + <antcall target="-warn-already-built-jar"/> | |
576 | + <propertyfile file="${built-jar.properties}"> | |
577 | + <entry key="${basedir}" value=""/> | |
578 | + </propertyfile> | |
579 | + </target> | |
580 | + <target depends="init,-check-automatic-build,-clean-after-automatic-build" name="-verify-automatic-build"/> | |
581 | + <target depends="init" name="-check-automatic-build"> | |
582 | + <available file="${build.classes.dir}/.netbeans_automatic_build" property="netbeans.automatic.build"/> | |
583 | + </target> | |
584 | + <target depends="init" if="netbeans.automatic.build" name="-clean-after-automatic-build"> | |
585 | + <antcall target="clean"/> | |
586 | + </target> | |
587 | + <target depends="init,deps-jar" name="-pre-pre-compile"> | |
588 | + <mkdir dir="${build.classes.dir}"/> | |
589 | + </target> | |
590 | + <target name="-pre-compile"> | |
591 | + <!-- Empty placeholder for easier customization. --> | |
592 | + <!-- You can override this target in the ../build.xml file. --> | |
593 | + </target> | |
594 | + <target if="do.depend.true" name="-compile-depend"> | |
595 | + <pathconvert property="build.generated.subdirs"> | |
596 | + <dirset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
597 | + <include name="*"/> | |
598 | + </dirset> | |
599 | + </pathconvert> | |
600 | + <j2seproject3:depend srcdir="${src.dir}:${build.generated.subdirs}"/> | |
601 | + </target> | |
602 | + <target depends="init,deps-jar,-pre-pre-compile,-pre-compile, -copy-persistence-xml,-compile-depend" if="have.sources" name="-do-compile"> | |
603 | + <j2seproject3:javac gensrcdir="${build.generated.sources.dir}"/> | |
604 | + <copy todir="${build.classes.dir}"> | |
605 | + <fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
606 | + </copy> | |
607 | + </target> | |
608 | + <target if="has.persistence.xml" name="-copy-persistence-xml"> | |
609 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
610 | + <copy todir="${build.classes.dir}/META-INF"> | |
611 | + <fileset dir="${meta.inf.dir}" includes="persistence.xml"/> | |
612 | + </copy> | |
613 | + </target> | |
614 | + <target name="-post-compile"> | |
615 | + <!-- Empty placeholder for easier customization. --> | |
616 | + <!-- You can override this target in the ../build.xml file. --> | |
617 | + </target> | |
618 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/> | |
619 | + <target name="-pre-compile-single"> | |
620 | + <!-- Empty placeholder for easier customization. --> | |
621 | + <!-- You can override this target in the ../build.xml file. --> | |
622 | + </target> | |
623 | + <target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single"> | |
624 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
625 | + <j2seproject3:force-recompile/> | |
626 | + <j2seproject3:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}" sourcepath="${src.dir}"/> | |
627 | + </target> | |
628 | + <target name="-post-compile-single"> | |
629 | + <!-- Empty placeholder for easier customization. --> | |
630 | + <!-- You can override this target in the ../build.xml file. --> | |
631 | + </target> | |
632 | + <target depends="init,deps-jar,-verify-automatic-build,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/> | |
633 | + <!-- | |
634 | + ==================== | |
635 | + JAR BUILDING SECTION | |
636 | + ==================== | |
637 | + --> | |
638 | + <target depends="init" name="-pre-pre-jar"> | |
639 | + <dirname file="${dist.jar}" property="dist.jar.dir"/> | |
640 | + <mkdir dir="${dist.jar.dir}"/> | |
641 | + </target> | |
642 | + <target name="-pre-jar"> | |
643 | + <!-- Empty placeholder for easier customization. --> | |
644 | + <!-- You can override this target in the ../build.xml file. --> | |
645 | + </target> | |
646 | + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive" name="-do-jar-without-manifest" unless="manifest.available-mkdist.available"> | |
647 | + <j2seproject1:jar/> | |
648 | + </target> | |
649 | + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available" name="-do-jar-with-manifest" unless="manifest.available+main.class-mkdist.available"> | |
650 | + <j2seproject1:jar manifest="${manifest.file}"/> | |
651 | + </target> | |
652 | + <target depends="init,compile,-pre-pre-jar,-pre-jar" if="do.archive+manifest.available+main.class" name="-do-jar-with-mainclass" unless="manifest.available+main.class+mkdist.available"> | |
653 | + <j2seproject1:jar manifest="${manifest.file}"> | |
654 | + <j2seproject1:manifest> | |
655 | + <j2seproject1:attribute name="Main-Class" value="${main.class}"/> | |
656 | + </j2seproject1:manifest> | |
657 | + </j2seproject1:jar> | |
658 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
659 | + <property location="${build.classes.dir}" name="build.classes.dir.resolved"/> | |
660 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
661 | + <pathconvert property="run.classpath.with.dist.jar"> | |
662 | + <path path="${run.classpath}"/> | |
663 | + <map from="${build.classes.dir.resolved}" to="${dist.jar.resolved}"/> | |
664 | + </pathconvert> | |
665 | + <echo level="info">java -cp "${run.classpath.with.dist.jar}" ${main.class}</echo> | |
666 | + </target> | |
667 | + <target depends="init" if="do.archive" name="-do-jar-with-libraries-create-manifest" unless="manifest.available"> | |
668 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
669 | + <touch file="${tmp.manifest.file}" verbose="false"/> | |
670 | + </target> | |
671 | + <target depends="init" if="do.archive+manifest.available" name="-do-jar-with-libraries-copy-manifest"> | |
672 | + <tempfile deleteonexit="true" destdir="${build.dir}" property="tmp.manifest.file"/> | |
673 | + <copy file="${manifest.file}" tofile="${tmp.manifest.file}"/> | |
674 | + </target> | |
675 | + <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+main.class.available" name="-do-jar-with-libraries-set-main"> | |
676 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
677 | + <attribute name="Main-Class" value="${main.class}"/> | |
678 | + </manifest> | |
679 | + </target> | |
680 | + <target depends="init,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest" if="do.archive+splashscreen.available" name="-do-jar-with-libraries-set-splashscreen"> | |
681 | + <basename file="${application.splash}" property="splashscreen.basename"/> | |
682 | + <mkdir dir="${build.classes.dir}/META-INF"/> | |
683 | + <copy failonerror="false" file="${application.splash}" todir="${build.classes.dir}/META-INF"/> | |
684 | + <manifest file="${tmp.manifest.file}" mode="update"> | |
685 | + <attribute name="SplashScreen-Image" value="META-INF/${splashscreen.basename}"/> | |
686 | + </manifest> | |
687 | + </target> | |
688 | + <target depends="init,-init-macrodef-copylibs,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen" if="do.mkdist" name="-do-jar-with-libraries-pack"> | |
689 | + <j2seproject3:copylibs manifest="${tmp.manifest.file}"/> | |
690 | + <echo level="info">To run this application from the command line without Ant, try:</echo> | |
691 | + <property location="${dist.jar}" name="dist.jar.resolved"/> | |
692 | + <echo level="info">java -jar "${dist.jar.resolved}"</echo> | |
693 | + </target> | |
694 | + <target depends="-do-jar-with-libraries-pack" if="do.archive" name="-do-jar-with-libraries-delete-manifest"> | |
695 | + <delete> | |
696 | + <fileset file="${tmp.manifest.file}"/> | |
697 | + </delete> | |
698 | + </target> | |
699 | + <target depends="init,compile,-pre-pre-jar,-pre-jar,-do-jar-with-libraries-create-manifest,-do-jar-with-libraries-copy-manifest,-do-jar-with-libraries-set-main,-do-jar-with-libraries-set-splashscreen,-do-jar-with-libraries-pack,-do-jar-with-libraries-delete-manifest" name="-do-jar-with-libraries"/> | |
700 | + <target name="-post-jar"> | |
701 | + <!-- Empty placeholder for easier customization. --> | |
702 | + <!-- You can override this target in the ../build.xml file. --> | |
703 | + </target> | |
704 | + <target depends="init,compile,-pre-jar,-do-jar-with-manifest,-do-jar-without-manifest,-do-jar-with-mainclass,-do-jar-with-libraries,-post-jar" description="Build JAR." name="jar"/> | |
705 | + <!-- | |
706 | + ================= | |
707 | + EXECUTION SECTION | |
708 | + ================= | |
709 | + --> | |
710 | + <target depends="init,compile" description="Run a main class." name="run"> | |
711 | + <j2seproject1:java> | |
712 | + <customize> | |
713 | + <arg line="${application.args}"/> | |
714 | + </customize> | |
715 | + </j2seproject1:java> | |
716 | + </target> | |
717 | + <target name="-do-not-recompile"> | |
718 | + <property name="javac.includes.binary" value=""/> | |
719 | + </target> | |
720 | + <target depends="init,compile-single" name="run-single"> | |
721 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
722 | + <j2seproject1:java classname="${run.class}"/> | |
723 | + </target> | |
724 | + <target depends="init,compile-test-single" name="run-test-with-main"> | |
725 | + <fail unless="run.class">Must select one file in the IDE or set run.class</fail> | |
726 | + <j2seproject1:java classname="${run.class}" classpath="${run.test.classpath}"/> | |
727 | + </target> | |
728 | + <!-- | |
729 | + ================= | |
730 | + DEBUGGING SECTION | |
731 | + ================= | |
732 | + --> | |
733 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger"> | |
734 | + <j2seproject1:nbjpdastart name="${debug.class}"/> | |
735 | + </target> | |
736 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-main-test"> | |
737 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${debug.class}"/> | |
738 | + </target> | |
739 | + <target depends="init,compile" name="-debug-start-debuggee"> | |
740 | + <j2seproject3:debug> | |
741 | + <customize> | |
742 | + <arg line="${application.args}"/> | |
743 | + </customize> | |
744 | + </j2seproject3:debug> | |
745 | + </target> | |
746 | + <target depends="init,compile,-debug-start-debugger,-debug-start-debuggee" description="Debug project in IDE." if="netbeans.home" name="debug"/> | |
747 | + <target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto"> | |
748 | + <j2seproject1:nbjpdastart stopclassname="${main.class}"/> | |
749 | + </target> | |
750 | + <target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/> | |
751 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single"> | |
752 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
753 | + <j2seproject3:debug classname="${debug.class}"/> | |
754 | + </target> | |
755 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/> | |
756 | + <target depends="init,compile-test-single" if="netbeans.home" name="-debug-start-debuggee-main-test"> | |
757 | + <fail unless="debug.class">Must select one file in the IDE or set debug.class</fail> | |
758 | + <j2seproject3:debug classname="${debug.class}" classpath="${debug.test.classpath}"/> | |
759 | + </target> | |
760 | + <target depends="init,compile-test-single,-debug-start-debugger-main-test,-debug-start-debuggee-main-test" if="netbeans.home" name="debug-test-with-main"/> | |
761 | + <target depends="init" name="-pre-debug-fix"> | |
762 | + <fail unless="fix.includes">Must set fix.includes</fail> | |
763 | + <property name="javac.includes" value="${fix.includes}.java"/> | |
764 | + </target> | |
765 | + <target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix"> | |
766 | + <j2seproject1:nbjpdareload/> | |
767 | + </target> | |
768 | + <target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/> | |
769 | + <!-- | |
770 | + ================= | |
771 | + PROFILING SECTION | |
772 | + ================= | |
773 | + --> | |
774 | + <target depends="profile-init,compile" description="Profile a project in the IDE." if="netbeans.home" name="profile"> | |
775 | + <nbprofiledirect> | |
776 | + <classpath> | |
777 | + <path path="${run.classpath}"/> | |
778 | + </classpath> | |
779 | + </nbprofiledirect> | |
780 | + <profile/> | |
781 | + </target> | |
782 | + <target depends="profile-init,compile-single" description="Profile a selected class in the IDE." if="netbeans.home" name="profile-single"> | |
783 | + <fail unless="profile.class">Must select one file in the IDE or set profile.class</fail> | |
784 | + <nbprofiledirect> | |
785 | + <classpath> | |
786 | + <path path="${run.classpath}"/> | |
787 | + </classpath> | |
788 | + </nbprofiledirect> | |
789 | + <profile classname="${profile.class}"/> | |
790 | + </target> | |
791 | + <!-- | |
792 | + ========================= | |
793 | + APPLET PROFILING SECTION | |
794 | + ========================= | |
795 | + --> | |
796 | + <target depends="profile-init,compile-single" if="netbeans.home" name="profile-applet"> | |
797 | + <nbprofiledirect> | |
798 | + <classpath> | |
799 | + <path path="${run.classpath}"/> | |
800 | + </classpath> | |
801 | + </nbprofiledirect> | |
802 | + <profile classname="sun.applet.AppletViewer"> | |
803 | + <customize> | |
804 | + <arg value="${applet.url}"/> | |
805 | + </customize> | |
806 | + </profile> | |
807 | + </target> | |
808 | + <!-- | |
809 | + ========================= | |
810 | + TESTS PROFILING SECTION | |
811 | + ========================= | |
812 | + --> | |
813 | + <target depends="profile-init,compile-test-single" if="netbeans.home" name="profile-test-single"> | |
814 | + <nbprofiledirect> | |
815 | + <classpath> | |
816 | + <path path="${run.test.classpath}"/> | |
817 | + </classpath> | |
818 | + </nbprofiledirect> | |
819 | + <junit dir="${profiler.info.dir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" jvm="${profiler.info.jvm}" showoutput="true"> | |
820 | + <env key="${profiler.info.pathvar}" path="${profiler.info.agentpath}:${profiler.current.path}"/> | |
821 | + <jvmarg value="${profiler.info.jvmargs.agent}"/> | |
822 | + <jvmarg line="${profiler.info.jvmargs}"/> | |
823 | + <test name="${profile.class}"/> | |
824 | + <classpath> | |
825 | + <path path="${run.test.classpath}"/> | |
826 | + </classpath> | |
827 | + <syspropertyset> | |
828 | + <propertyref prefix="test-sys-prop."/> | |
829 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
830 | + </syspropertyset> | |
831 | + <formatter type="brief" usefile="false"/> | |
832 | + <formatter type="xml"/> | |
833 | + </junit> | |
834 | + </target> | |
835 | + <!-- | |
836 | + =============== | |
837 | + JAVADOC SECTION | |
838 | + =============== | |
839 | + --> | |
840 | + <target depends="init" if="have.sources" name="-javadoc-build"> | |
841 | + <mkdir dir="${dist.javadoc.dir}"/> | |
842 | + <javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}"> | |
843 | + <classpath> | |
844 | + <path path="${javac.classpath}"/> | |
845 | + </classpath> | |
846 | + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> | |
847 | + <filename name="**/*.java"/> | |
848 | + </fileset> | |
849 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
850 | + <include name="**/*.java"/> | |
851 | + </fileset> | |
852 | + </javadoc> | |
853 | + <copy todir="${dist.javadoc.dir}"> | |
854 | + <fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}"> | |
855 | + <filename name="**/doc-files/**"/> | |
856 | + </fileset> | |
857 | + <fileset dir="${build.generated.sources.dir}" erroronmissingdir="false"> | |
858 | + <include name="**/doc-files/**"/> | |
859 | + </fileset> | |
860 | + </copy> | |
861 | + </target> | |
862 | + <target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview"> | |
863 | + <nbbrowse file="${dist.javadoc.dir}/index.html"/> | |
864 | + </target> | |
865 | + <target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/> | |
866 | + <!-- | |
867 | + ========================= | |
868 | + JUNIT COMPILATION SECTION | |
869 | + ========================= | |
870 | + --> | |
871 | + <target depends="init,compile" if="have.tests" name="-pre-pre-compile-test"> | |
872 | + <mkdir dir="${build.test.classes.dir}"/> | |
873 | + </target> | |
874 | + <target name="-pre-compile-test"> | |
875 | + <!-- Empty placeholder for easier customization. --> | |
876 | + <!-- You can override this target in the ../build.xml file. --> | |
877 | + </target> | |
878 | + <target if="do.depend.true" name="-compile-test-depend"> | |
879 | + <j2seproject3:depend classpath="${javac.test.classpath}" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/> | |
880 | + </target> | |
881 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test,-compile-test-depend" if="have.tests" name="-do-compile-test"> | |
882 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" processorpath="${javac.test.processorpath}" srcdir="${test.src.dir}"/> | |
883 | + <copy todir="${build.test.classes.dir}"> | |
884 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
885 | + </copy> | |
886 | + </target> | |
887 | + <target name="-post-compile-test"> | |
888 | + <!-- Empty placeholder for easier customization. --> | |
889 | + <!-- You can override this target in the ../build.xml file. --> | |
890 | + </target> | |
891 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/> | |
892 | + <target name="-pre-compile-test-single"> | |
893 | + <!-- Empty placeholder for easier customization. --> | |
894 | + <!-- You can override this target in the ../build.xml file. --> | |
895 | + </target> | |
896 | + <target depends="init,deps-jar,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single"> | |
897 | + <fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail> | |
898 | + <j2seproject3:force-recompile destdir="${build.test.classes.dir}"/> | |
899 | + <j2seproject3:javac apgeneratedsrcdir="${build.test.classes.dir}" classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" processorpath="${javac.test.processorpath}" sourcepath="${test.src.dir}" srcdir="${test.src.dir}"/> | |
900 | + <copy todir="${build.test.classes.dir}"> | |
901 | + <fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/> | |
902 | + </copy> | |
903 | + </target> | |
904 | + <target name="-post-compile-test-single"> | |
905 | + <!-- Empty placeholder for easier customization. --> | |
906 | + <!-- You can override this target in the ../build.xml file. --> | |
907 | + </target> | |
908 | + <target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/> | |
909 | + <!-- | |
910 | + ======================= | |
911 | + JUNIT EXECUTION SECTION | |
912 | + ======================= | |
913 | + --> | |
914 | + <target depends="init" if="have.tests" name="-pre-test-run"> | |
915 | + <mkdir dir="${build.test.results.dir}"/> | |
916 | + </target> | |
917 | + <target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run"> | |
918 | + <j2seproject3:junit testincludes="**/*Test.java"/> | |
919 | + </target> | |
920 | + <target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run"> | |
921 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
922 | + </target> | |
923 | + <target depends="init" if="have.tests" name="test-report"/> | |
924 | + <target depends="init" if="netbeans.home+have.tests" name="-test-browse"/> | |
925 | + <target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/> | |
926 | + <target depends="init" if="have.tests" name="-pre-test-run-single"> | |
927 | + <mkdir dir="${build.test.results.dir}"/> | |
928 | + </target> | |
929 | + <target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single"> | |
930 | + <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail> | |
931 | + <j2seproject3:junit excludes="" includes="${test.includes}"/> | |
932 | + </target> | |
933 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single"> | |
934 | + <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail> | |
935 | + </target> | |
936 | + <target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/> | |
937 | + <!-- | |
938 | + ======================= | |
939 | + JUNIT DEBUGGING SECTION | |
940 | + ======================= | |
941 | + --> | |
942 | + <target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test"> | |
943 | + <fail unless="test.class">Must select one file in the IDE or set test.class</fail> | |
944 | + <property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/> | |
945 | + <delete file="${test.report.file}"/> | |
946 | + <mkdir dir="${build.test.results.dir}"/> | |
947 | + <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}"> | |
948 | + <customize> | |
949 | + <syspropertyset> | |
950 | + <propertyref prefix="test-sys-prop."/> | |
951 | + <mapper from="test-sys-prop.*" to="*" type="glob"/> | |
952 | + </syspropertyset> | |
953 | + <arg value="${test.class}"/> | |
954 | + <arg value="showoutput=true"/> | |
955 | + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/> | |
956 | + <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/> | |
957 | + </customize> | |
958 | + </j2seproject3:debug> | |
959 | + </target> | |
960 | + <target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test"> | |
961 | + <j2seproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/> | |
962 | + </target> | |
963 | + <target depends="init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/> | |
964 | + <target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test"> | |
965 | + <j2seproject1:nbjpdareload dir="${build.test.classes.dir}"/> | |
966 | + </target> | |
967 | + <target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/> | |
968 | + <!-- | |
969 | + ========================= | |
970 | + APPLET EXECUTION SECTION | |
971 | + ========================= | |
972 | + --> | |
973 | + <target depends="init,compile-single" name="run-applet"> | |
974 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
975 | + <j2seproject1:java classname="sun.applet.AppletViewer"> | |
976 | + <customize> | |
977 | + <arg value="${applet.url}"/> | |
978 | + </customize> | |
979 | + </j2seproject1:java> | |
980 | + </target> | |
981 | + <!-- | |
982 | + ========================= | |
983 | + APPLET DEBUGGING SECTION | |
984 | + ========================= | |
985 | + --> | |
986 | + <target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet"> | |
987 | + <fail unless="applet.url">Must select one file in the IDE or set applet.url</fail> | |
988 | + <j2seproject3:debug classname="sun.applet.AppletViewer"> | |
989 | + <customize> | |
990 | + <arg value="${applet.url}"/> | |
991 | + </customize> | |
992 | + </j2seproject3:debug> | |
993 | + </target> | |
994 | + <target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/> | |
995 | + <!-- | |
996 | + =============== | |
997 | + CLEANUP SECTION | |
998 | + =============== | |
999 | + --> | |
1000 | + <target name="-deps-clean-init" unless="built-clean.properties"> | |
1001 | + <property location="${build.dir}/built-clean.properties" name="built-clean.properties"/> | |
1002 | + <delete file="${built-clean.properties}" quiet="true"/> | |
1003 | + </target> | |
1004 | + <target if="already.built.clean.${basedir}" name="-warn-already-built-clean"> | |
1005 | + <echo level="warn" message="Cycle detected: MediaInfoWrapper was already built"/> | |
1006 | + </target> | |
1007 | + <target depends="init,-deps-clean-init" name="deps-clean" unless="no.deps"> | |
1008 | + <mkdir dir="${build.dir}"/> | |
1009 | + <touch file="${built-clean.properties}" verbose="false"/> | |
1010 | + <property file="${built-clean.properties}" prefix="already.built.clean."/> | |
1011 | + <antcall target="-warn-already-built-clean"/> | |
1012 | + <propertyfile file="${built-clean.properties}"> | |
1013 | + <entry key="${basedir}" value=""/> | |
1014 | + </propertyfile> | |
1015 | + </target> | |
1016 | + <target depends="init" name="-do-clean"> | |
1017 | + <delete dir="${build.dir}"/> | |
1018 | + <delete dir="${dist.dir}" followsymlinks="false" includeemptydirs="true"/> | |
1019 | + </target> | |
1020 | + <target name="-post-clean"> | |
1021 | + <!-- Empty placeholder for easier customization. --> | |
1022 | + <!-- You can override this target in the ../build.xml file. --> | |
1023 | + </target> | |
1024 | + <target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/> | |
1025 | + <target name="-check-call-dep"> | |
1026 | + <property file="${call.built.properties}" prefix="already.built."/> | |
1027 | + <condition property="should.call.dep"> | |
1028 | + <not> | |
1029 | + <isset property="already.built.${call.subproject}"/> | |
1030 | + </not> | |
1031 | + </condition> | |
1032 | + </target> | |
1033 | + <target depends="-check-call-dep" if="should.call.dep" name="-maybe-call-dep"> | |
1034 | + <ant antfile="${call.script}" inheritall="false" target="${call.target}"> | |
1035 | + <propertyset> | |
1036 | + <propertyref prefix="transfer."/> | |
1037 | + <mapper from="transfer.*" to="*" type="glob"/> | |
1038 | + </propertyset> | |
1039 | + </ant> | |
1040 | + </target> | |
1041 | +</project> |
@@ -0,0 +1,8 @@ | ||
1 | +build.xml.data.CRC32=d35cfe9e | |
2 | +build.xml.script.CRC32=31e56aca | |
3 | +build.xml.stylesheet.CRC32=28e38971@1.43.1.45 | |
4 | +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. | |
5 | +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. | |
6 | +nbproject/build-impl.xml.data.CRC32=d35cfe9e | |
7 | +nbproject/build-impl.xml.script.CRC32=16d6a9fc | |
8 | +nbproject/build-impl.xml.stylesheet.CRC32=0c01fd8e@1.43.1.45 |
@@ -0,0 +1,72 @@ | ||
1 | +annotation.processing.enabled=true | |
2 | +annotation.processing.enabled.in.editor=false | |
3 | +annotation.processing.run.all.processors=true | |
4 | +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output | |
5 | +application.title=MediaInfoWrapper | |
6 | +application.vendor=yuki | |
7 | +build.classes.dir=${build.dir}/classes | |
8 | +build.classes.excludes=**/*.java,**/*.form | |
9 | +# This directory is removed when the project is cleaned: | |
10 | +build.dir=build | |
11 | +build.generated.dir=${build.dir}/generated | |
12 | +build.generated.sources.dir=${build.dir}/generated-sources | |
13 | +# Only compile against the classpath explicitly listed here: | |
14 | +build.sysclasspath=ignore | |
15 | +build.test.classes.dir=${build.dir}/test/classes | |
16 | +build.test.results.dir=${build.dir}/test/results | |
17 | +# Uncomment to specify the preferred debugger connection transport: | |
18 | +#debug.transport=dt_socket | |
19 | +debug.classpath=\ | |
20 | + ${run.classpath} | |
21 | +debug.test.classpath=\ | |
22 | + ${run.test.classpath} | |
23 | +# This directory is removed when the project is cleaned: | |
24 | +dist.dir=dist | |
25 | +dist.jar=${dist.dir}/MediaInfoWrapper.jar | |
26 | +dist.javadoc.dir=${dist.dir}/javadoc | |
27 | +endorsed.classpath= | |
28 | +excludes= | |
29 | +includes=** | |
30 | +jar.compress=false | |
31 | +javac.classpath= | |
32 | +# Space-separated list of extra javac options | |
33 | +javac.compilerargs= | |
34 | +javac.deprecation=false | |
35 | +javac.processorpath=\ | |
36 | + ${javac.classpath} | |
37 | +javac.source=1.6 | |
38 | +javac.target=1.6 | |
39 | +javac.test.classpath=\ | |
40 | + ${javac.classpath}:\ | |
41 | + ${build.classes.dir} | |
42 | +javac.test.processorpath=\ | |
43 | + ${javac.test.classpath} | |
44 | +javadoc.additionalparam= | |
45 | +javadoc.author=false | |
46 | +javadoc.encoding=${source.encoding} | |
47 | +javadoc.noindex=false | |
48 | +javadoc.nonavbar=false | |
49 | +javadoc.notree=false | |
50 | +javadoc.private=false | |
51 | +javadoc.splitindex=true | |
52 | +javadoc.use=true | |
53 | +javadoc.version=false | |
54 | +javadoc.windowtitle= | |
55 | +main.class=mediainfowrapper.MediaInfoWrapper | |
56 | +manifest.file=manifest.mf | |
57 | +meta.inf.dir=${src.dir}/META-INF | |
58 | +mkdist.disabled=false | |
59 | +platform.active=default_platform | |
60 | +run.classpath=\ | |
61 | + ${javac.classpath}:\ | |
62 | + ${build.classes.dir} | |
63 | +# Space-separated list of JVM arguments used when running the project | |
64 | +# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value | |
65 | +# or test-sys-prop.name=value to set system properties for unit tests): | |
66 | +run.jvmargs= | |
67 | +run.test.classpath=\ | |
68 | + ${javac.test.classpath}:\ | |
69 | + ${build.test.classes.dir} | |
70 | +source.encoding=UTF-8 | |
71 | +src.dir=src | |
72 | +test.src.dir=test |
@@ -0,0 +1,15 @@ | ||
1 | +<?xml version="1.0" encoding="UTF-8"?> | |
2 | +<project xmlns="http://www.netbeans.org/ns/project/1"> | |
3 | + <type>org.netbeans.modules.java.j2seproject</type> | |
4 | + <configuration> | |
5 | + <data xmlns="http://www.netbeans.org/ns/j2se-project/3"> | |
6 | + <name>MediaInfoWrapper</name> | |
7 | + <source-roots> | |
8 | + <root id="src.dir"/> | |
9 | + </source-roots> | |
10 | + <test-roots> | |
11 | + <root id="test.src.dir"/> | |
12 | + </test-roots> | |
13 | + </data> | |
14 | + </configuration> | |
15 | +</project> |
@@ -0,0 +1,26 @@ | ||
1 | +/* $Id: Info.java 44 2010-02-03 09:51:57Z yuki $ */ | |
2 | +package yukihane.mediainfowrapper; | |
3 | + | |
4 | +public class Info { | |
5 | + | |
6 | + private final int width; | |
7 | + private final int height; | |
8 | + | |
9 | + public Info(int width, int height) { | |
10 | + this.width = width; | |
11 | + this.height = height; | |
12 | + } | |
13 | + | |
14 | + public int getHeight() { | |
15 | + return height; | |
16 | + } | |
17 | + | |
18 | + public int getWidth() { | |
19 | + return width; | |
20 | + } | |
21 | + | |
22 | + @Override | |
23 | + public String toString() { | |
24 | + return "Width:" + width + ", Height:" + height; | |
25 | + } | |
26 | +} |
@@ -0,0 +1,69 @@ | ||
1 | +/* $Id: MediaInfo.java 57 2010-02-04 04:43:44Z yuki $ */ | |
2 | +package yukihane.mediainfowrapper; | |
3 | + | |
4 | +import java.io.BufferedReader; | |
5 | +import java.io.File; | |
6 | +import java.io.IOException; | |
7 | +import java.io.InputStreamReader; | |
8 | +import java.util.regex.Matcher; | |
9 | +import java.util.regex.Pattern; | |
10 | + | |
11 | +public class MediaInfo { | |
12 | + | |
13 | + public static Info getInfo(File mediaInfoBin, File videoFile) throws IOException { | |
14 | + String[] command = new String[]{mediaInfoBin.getPath(), videoFile.getPath()}; | |
15 | + Process process = Runtime.getRuntime().exec(command); | |
16 | + BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); | |
17 | + String line; | |
18 | + Pattern widthPattern = Pattern.compile("Width +:(.+)pixels"); | |
19 | + Pattern heightPattern = Pattern.compile("Height +:(.+)pixels"); | |
20 | + int width = -1; | |
21 | + int height = -1; | |
22 | + while ((line = reader.readLine()) != null) { | |
23 | + Matcher widthMatcher = widthPattern.matcher(line); | |
24 | + if (widthMatcher.find()) { | |
25 | + String str = widthMatcher.group(1).replaceAll(" ", ""); | |
26 | + width = Integer.parseInt(str); | |
27 | + continue; | |
28 | + } | |
29 | + | |
30 | + Matcher heightMatcher = heightPattern.matcher(line); | |
31 | + if (heightMatcher.find()) { | |
32 | + String str = heightMatcher.group(1).replaceAll(" ", ""); | |
33 | + height = Integer.parseInt(str); | |
34 | + continue; | |
35 | + } | |
36 | + } | |
37 | + return new Info(width, height); | |
38 | + } | |
39 | + | |
40 | + public static Size adjustSize(Info info, int maxWidth, int maxHeight) { | |
41 | + int nowWidth = info.getWidth(); | |
42 | + int nowHeight = info.getHeight(); | |
43 | + | |
44 | + if (nowWidth <= maxWidth && nowHeight <= maxHeight) { | |
45 | + return new Size(nowWidth, nowHeight); | |
46 | + } | |
47 | + | |
48 | + double widthRatio = calcRatio(nowWidth, maxWidth); | |
49 | + double heightRatio = calcRatio(nowHeight, maxHeight); | |
50 | + | |
51 | + if (widthRatio >= heightRatio) { | |
52 | + int adjustedWidth = adjust(nowWidth, widthRatio); | |
53 | + int adjustedHeight = adjust(nowHeight, widthRatio); | |
54 | + return new Size(adjustedWidth, adjustedHeight); | |
55 | + } else { | |
56 | + int adjustedWidth = adjust(nowWidth, heightRatio); | |
57 | + int adjustedHeight = adjust(nowHeight, heightRatio); | |
58 | + return new Size(adjustedWidth, adjustedHeight); | |
59 | + } | |
60 | + } | |
61 | + | |
62 | + private static double calcRatio(int now, int max) { | |
63 | + return (double) now / (double) max; | |
64 | + } | |
65 | + | |
66 | + private static int adjust(int size, double ratio) { | |
67 | + return (int) (size / ratio); | |
68 | + } | |
69 | +} |
@@ -0,0 +1,26 @@ | ||
1 | +/* $Id: Size.java 44 2010-02-03 09:51:57Z yuki $ */ | |
2 | + | |
3 | +package yukihane.mediainfowrapper; | |
4 | + | |
5 | +public class Size { | |
6 | + private final int width; | |
7 | + private final int height; | |
8 | + | |
9 | + public Size(int width, int height) { | |
10 | + this.width = width; | |
11 | + this.height = height; | |
12 | + } | |
13 | + | |
14 | + public int getHeight() { | |
15 | + return height; | |
16 | + } | |
17 | + | |
18 | + public int getWidth() { | |
19 | + return width; | |
20 | + } | |
21 | + | |
22 | + @Override | |
23 | + public String toString() { | |
24 | + return "Width:" + width + ", Height:" + height; | |
25 | + } | |
26 | +} |