Gentoo Archives: gentoo-commits

From: "Serkan Kaba (serkan)" <serkan@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in media-video/jubler/files: jubler-3.9.6.patch jubler-3.9.6-ffmpegfix.patch
Date: Wed, 29 Oct 2008 20:22:24
Message-Id: E1KvHYb-000330-8H@stork.gentoo.org
1 serkan 08/10/29 20:22:21
2
3 Added: jubler-3.9.6.patch jubler-3.9.6-ffmpegfix.patch
4 Log:
5 Version bump that works with newer ffmpeg. Fixes bug #218091, #242946. Thanks to Luca Barbato <lu_zero@g.o>, Alexis Ballier <aballier@g.o> for help.
6 (Portage version: 2.2_rc12/cvs/Linux 2.6.25-gentoo-r7 x86_64)
7
8 Revision Changes Path
9 1.1 media-video/jubler/files/jubler-3.9.6.patch
10
11 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/jubler/files/jubler-3.9.6.patch?rev=1.1&view=markup
12 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/jubler/files/jubler-3.9.6.patch?rev=1.1&content-type=text/plain
13
14 Index: jubler-3.9.6.patch
15 ===================================================================
16 diff -Nur Jubler-3.9.6/build.xml Jubler-3.9.6_patched/build.xml
17 --- Jubler-3.9.6/build.xml 2008-09-07 02:05:23.000000000 +0300
18 +++ Jubler-3.9.6_patched/build.xml 2008-09-22 19:40:36.000000000 +0300
19 @@ -69,22 +69,6 @@
20
21
22
23 - <!-- Define new ant tasks -->
24 -
25 - <taskdef name="izpack"
26 - onerror="report"
27 - classpath="../../Tools/IzPack/standalone-compiler.jar"
28 - classname="com.izforge.izpack.ant.IzPackTask"/>
29 -
30 - <taskdef name="launch4j"
31 - onerror="report"
32 - classpath="../../Tools/launch4j/launch4j.jar:../TOOLS/launch4j/lib/xstream.jar"
33 - classname="net.sf.launch4j.ant.Launch4jTask"/>
34 -
35 - <taskdef name="jarbundler"
36 - onerror="report"
37 - classpath="../../Tools/jarbundler/jarbundler-1.9.jar"
38 - classname="net.sourceforge.jarbundler.JarBundler" />
39
40
41
42 @@ -397,9 +381,6 @@
43
44
45
46 - <target name="-pre-compile">
47 - <copy todir="src/com"> <fileset dir="resources/system/no_mac"/> </copy>
48 - </target>
49 <target name="-post-compile">
50 <delete dir="build/classes/com/apple" failonerror="false"/>
51 <delete dir="src/com/apple" failonerror="false"/>
52 diff -Nur Jubler-3.9.6/resources/ffdecode/Makefile Jubler-3.9.6_patched/resources/ffdecode/Makefile
53 --- Jubler-3.9.6/resources/ffdecode/Makefile 2008-09-22 11:01:58.000000000 +0300
54 +++ Jubler-3.9.6_patched/resources/ffdecode/Makefile 2008-09-22 19:41:30.000000000 +0300
55 @@ -12,9 +12,6 @@
56 # Name of the produced library
57 PROJ=ffdecode
58
59 -# Paths of include files
60 -JAVA_HOME=${shell /bin/sh ../system/findjava.sh -j}
61 -
62 # Current Path
63 CPATH=${shell pwd}
64
65 @@ -106,7 +103,6 @@
66 CCPREF_NOS=${shell echo ${CCPREF} | sed -e 's/-$$//g' }
67 DCONFIG=--with-mp4v2 --host=${CCPREF_NOS}
68
69 -CC=${CCPREF}gcc
70 RANLIB=${CCPREF}ranlib
71
72 ifeq (${NOSTRIP},)
73 @@ -121,7 +117,7 @@
74 .SUFFIXES:.o .c
75
76 .c.o:
77 - ${CC} ${CFLAGS} ${GCCOPTS} -std=c99 -pedantic -O3 -Wall ${INCS} -I${JAVA_HOME}/include -I${JAVA_HOME}/include/${SYSTEM} -c -o $@ $?
78 + ${CC} ${CFLAGS} ${GCCOPTS} -std=c99 -pedantic -Wall ${INCS} -I${JAVA_HOME}/include -I${JAVA_HOME}/include/${SYSTEM} -c -o $@ $?
79
80
81 develop:javacheck
82 diff -Nur Jubler-3.9.6/src/com/panayotis/jubler/information/HelpBrowser.java Jubler-3.9.6_patched/src/com/panayotis/jubler/information/HelpBrowser.java
83 --- Jubler-3.9.6/src/com/panayotis/jubler/information/HelpBrowser.java 2008-09-08 18:22:32.000000000 +0300
84 +++ Jubler-3.9.6_patched/src/com/panayotis/jubler/information/HelpBrowser.java 2008-09-22 19:42:04.000000000 +0300
85 @@ -47,7 +47,7 @@
86
87 history = new ArrayList<String>();
88
89 - String initpage = "file:"+SystemFileFinder.getJublerAppPath()+"/help/jubler-faq.html";
90 + String initpage = "file:"+SystemFileFinder.getJublerAppPath()+"/../help/jubler-faq.html";
91 setPage(initpage);
92 history.add(initpage);
93
94 diff -Nur Jubler-3.9.6/src/com/panayotis/jubler/Main.java Jubler-3.9.6_patched/src/com/panayotis/jubler/Main.java
95 --- Jubler-3.9.6/src/com/panayotis/jubler/Main.java 2008-09-16 12:51:40.000000000 +0300
96 +++ Jubler-3.9.6_patched/src/com/panayotis/jubler/Main.java 2008-09-22 19:42:48.000000000 +0300
97 @@ -105,17 +105,9 @@
98 /* Load arguments, in a mac way */
99 SystemDependent.initApplication();
100
101 - /* Check current version in a new thread */
102 - Thread versioncheck = new Thread() {
103 - public void run() {
104 - StaticJubler.initVersion();
105 - }
106 - };
107 -
108 new Jubler(); // Display initial Jubler window
109 splash.dispose(); // Hide splash screen
110 loader.start(); // initialize loader
111 - versioncheck.start();
112 }
113
114 static private MainSplash splash;
115 diff -Nur Jubler-3.9.6/src/com/panayotis/jubler/os/SystemDependent.java Jubler-3.9.6_patched/src/com/panayotis/jubler/os/SystemDependent.java
116 --- Jubler-3.9.6/src/com/panayotis/jubler/os/SystemDependent.java 2008-09-20 23:59:27.000000000 +0300
117 +++ Jubler-3.9.6_patched/src/com/panayotis/jubler/os/SystemDependent.java 2008-09-22 19:43:40.000000000 +0300
118 @@ -25,10 +25,6 @@
119
120 import static com.panayotis.jubler.i18n.I18N._;
121
122 -import com.apple.eawt.Application;
123 -import com.apple.eawt.ApplicationAdapter;
124 -import com.apple.eawt.ApplicationEvent;
125 -
126 import com.panayotis.jubler.Jubler;
127 import com.panayotis.jubler.Main;
128 import com.panayotis.jubler.StaticJubler;
129 @@ -113,10 +109,6 @@
130
131
132 public static void initApplication() {
133 - /* In Linux this is a dummy function */
134 - if (isMacOSX()) {
135 - JublerApp japp = new JublerApp();
136 - }
137 }
138
139
140 @@ -342,35 +334,3 @@
141 }
142 }
143
144 -
145 -
146 -class JublerApp extends Application {
147 - public JublerApp() {
148 - setEnabledPreferencesMenu(true);
149 - addApplicationListener(new ApplicationHandler());
150 - }
151 -}
152 -
153 -class ApplicationHandler extends ApplicationAdapter {
154 -
155 - public ApplicationHandler() {}
156 -
157 - public void handleAbout(ApplicationEvent event) {
158 - StaticJubler.showAbout();
159 - event.setHandled(true);
160 - }
161 -
162 - public void handlePreferences(ApplicationEvent event) {
163 - Jubler.prefs.showPreferencesDialog();
164 - event.setHandled(true);
165 - }
166 -
167 - public void handleQuit(ApplicationEvent event) {
168 - StaticJubler.prepareQuitAll();
169 - event.setHandled(false);
170 - }
171 -
172 - public void handleOpenFile(ApplicationEvent event) {
173 - Main.asyncAddSubtitle(event.getFilename());
174 - }
175 -}
176 diff -Nur Jubler-3.9.6/src/com/panayotis/jubler/os/SystemFileFinder.java Jubler-3.9.6_patched/src/com/panayotis/jubler/os/SystemFileFinder.java
177 --- Jubler-3.9.6/src/com/panayotis/jubler/os/SystemFileFinder.java 2008-09-08 18:22:32.000000000 +0300
178 +++ Jubler-3.9.6_patched/src/com/panayotis/jubler/os/SystemFileFinder.java 2008-09-22 19:44:30.000000000 +0300
179 @@ -58,15 +58,12 @@
180 }
181
182 public static boolean loadLibrary(String name) {
183 - File libfile = findFile("lib"+pathseparator+System.mapLibraryName(name));
184 - if (libfile!=null) {
185 try {
186 - System.load(libfile.getAbsolutePath());
187 + System.loadLibrary(name);
188 return true;
189 } catch (UnsatisfiedLinkError e) {
190 e.printStackTrace();
191 }
192 - }
193 return false;
194 }
195
196
197
198
199 1.1 media-video/jubler/files/jubler-3.9.6-ffmpegfix.patch
200
201 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/jubler/files/jubler-3.9.6-ffmpegfix.patch?rev=1.1&view=markup
202 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/media-video/jubler/files/jubler-3.9.6-ffmpegfix.patch?rev=1.1&content-type=text/plain
203
204 Index: jubler-3.9.6-ffmpegfix.patch
205 ===================================================================
206 --- Jubler-3.9.6/resources/ffdecode/decodeframe.c 2008-08-10 20:15:55.000000000 +0300
207 +++ jubler/resources/ffdecode/decodeframe.c 2008-10-29 06:46:11.000000000 +0200
208 @@ -39,19 +39,23 @@
209 #include "defaults.h"
210 #include "utilities.h"
211
212 +#define MAXSIZE 16383
213 +
214 +
215 AVPicture *decodeFrame(JNIEnv * env, jobject this, const char *input_filename, jlong timepos, jint *width, jint *height, jfloat resize);
216 int file_info(JNIEnv * env, jobject this, char *input_filename);
217 +void storenumb (jbyte * data, int number);
218
219 static int sws_flags = SWS_BICUBIC;
220
221
222 -JNIEXPORT jintArray JNICALL Java_com_panayotis_jubler_media_preview_decoders_FFMPEG_grabFrame(JNIEnv * env, jobject this, jstring video, jlong time, jfloat resize) {
223 +JNIEXPORT jbyteArray JNICALL Java_com_panayotis_jubler_media_preview_decoders_FFMPEG_grabFrame(JNIEnv * env, jobject this, jstring video, jlong time, jfloat resize) {
224 /* Pointers for c-like strings */
225 const char *video_c;
226
227 /* Here we'll store the frame for java */
228 - jintArray matrix = NULL;
229 - jint* matrixdata = NULL;
230 + jbyteArray matrix = NULL;
231 + jbyte* matrixdata = NULL;
232
233 /* Frame raw data */
234 AVPicture* pict;
235 @@ -65,18 +69,20 @@
236 if (pict) {
237
238 // make array
239 - matrix = (*env)->NewIntArray(env, width*height+2); // 4 bytes per pixel (int) plus picture information
240 + matrix = (*env)->NewByteArray(env, width*height*3+4); // 3 bytes per pixel + picture width information (2*2)
241
242 if (matrix) {
243 /* Find pointer for matrix size */
244 - matrixdata = (*env)->GetIntArrayElements(env, matrix, 0);
245 + matrixdata = (*env)->GetByteArrayElements(env, matrix, 0);
246
247 - /* This is a trick: the first 2 elements are not video data but the size of the video */
248 - matrixdata[0] = width;
249 - matrixdata[1] = height;
250 - memcpy(matrixdata+2, pict->data[0], 4*width*height);
251 + /* This is a trick: the first 4 bytes are not video data but the size of the video */
252 + storenumb(matrixdata, width);
253 + storenumb(matrixdata+2, height);
254 +
255 + /* Copy the actual color map to picture buffer */
256 + memcpy(matrixdata+4, pict->data[0], 3*width*height);
257 /* Release the matrix data pointer */
258 - (*env)->ReleaseIntArrayElements(env, matrix, matrixdata, 0);
259 + (*env)->ReleaseByteArrayElements(env, matrix, matrixdata, 0);
260 } else {
261 DEBUG(env, this, "grabFrame", "Can not create array into memory.");
262 }
263 @@ -206,14 +212,24 @@
264 av_free_packet(&pkt);
265 }
266 if (retflag != FALSE) {
267 - *width = (ccx->width) * resize;
268 - *height = (ccx->height) * resize;
269 + /* Calculating new picture size and keep aspect ratio */
270 + *width = (ccx->width) * resize;
271 + *height = (ccx->height) * resize;
272 + if (*width > MAXSIZE ) {
273 + *height = ( (*height) * MAXSIZE) / (*width);
274 + *width = MAXSIZE;
275 + }
276 + if (*height > MAXSIZE) {
277 + *width = ( (*width) * MAXSIZE) / (*height);
278 + *height = MAXSIZE;
279 + }
280 +
281 DEBUG(env, this, "decodeFrame", "Resampling from (%i,%i) with resize factor %f to (%i,%i)",ccx->width, ccx->height, resize,*width, *height);
282 // Allocate an AVPicture
283 - avpicture_alloc(pict, PIX_FMT_RGBA32, *width, *height);
284 + avpicture_alloc(pict, PIX_FMT_RGB24, *width, *height);
285 swsContext = sws_getCachedContext(swsContext,
286 ccx->width, ccx->height, ccx->pix_fmt,
287 - *width, *height, PIX_FMT_RGBA32,
288 + *width, *height, PIX_FMT_RGB24,
289 sws_flags, NULL, NULL, NULL);
290 if (swsContext == NULL) {
291 DEBUG(env, this, "decodeFrame", "swscale context initialization failed.");
292 @@ -264,5 +280,8 @@
293 return 0;
294 }
295
296 -
297 +void storenumb (jbyte * data, int number) {
298 + data[0] = number/128;
299 + data[1] = number % 128;
300 +}
301
302 --- Jubler-3.9.6/src/com/panayotis/jubler/media/preview/decoders/FFMPEG.java 2008-09-08 18:22:10.000000000 +0300
303 +++ jubler/src/com/panayotis/jubler/media/preview/decoders/FFMPEG.java 2008-10-29 06:46:03.000000000 +0200
304 @@ -56,23 +56,8 @@
305 public final class FFMPEG extends NativeDecoder {
306 private static boolean library_is_present = false;
307
308 - private static final int[] bitmasks;
309 - private static final ColorModel cmodel;
310 -
311 -
312 static {
313 library_is_present = SystemFileFinder.loadLibrary("ffdecode");
314 -
315 - int[] LE_BITMASKS = {0xff0000, 0xff00, 0xff, 0xff000000};
316 - int[] BE_BITMASKS = {0xff00, 0xff0000, 0xff000000, 0xff};
317 -
318 - if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
319 - bitmasks = LE_BITMASKS;
320 - cmodel = ColorModel.getRGBdefault();
321 - } else {
322 - bitmasks = BE_BITMASKS;
323 - cmodel = new DirectColorModel(32, bitmasks[0], bitmasks[1], bitmasks[2], bitmasks[3]);
324 - }
325 }
326
327 /** Creates a new instance of FFMPEG */
328 @@ -82,13 +67,16 @@
329 if ( vfile==null || (!isDecoderValid()) ) return null;
330
331 time *= 1000000;
332 - int[] frame = grabFrame(vfile.getPath(), (long)time, resize);
333 - if (frame==null) return null;
334 -
335 - SinglePixelPackedSampleModel model = new SinglePixelPackedSampleModel(DataBuffer.TYPE_INT,frame[0], frame[1], bitmasks);
336 - DataBufferInt buffer = new DataBufferInt(frame, frame[0]*frame[1], 2);
337 - WritableRaster ras = Raster.createWritableRaster(model, buffer, null);
338 - BufferedImage image = new BufferedImage(cmodel, ras, true, null);
339 + byte[] data = grabFrame(vfile.getPath(), (long)time, resize);
340 + if (data==null) return null;
341 +
342 + byte[] frame = new byte[data.length-4];
343 + int X = data[0] * 128 + data[1];
344 + int Y = data[2] * 128 + data[3];
345 + System.arraycopy(data, 4, frame, 0, frame.length);
346 + BufferedImage image = new BufferedImage(X, Y, BufferedImage.TYPE_3BYTE_BGR);
347 + WritableRaster raster = image.getRaster();
348 + raster.setDataElements(0, 0, X, Y, frame);
349 return image;
350 }
351
352 @@ -152,7 +140,7 @@
353 }
354
355 /* Get the image for this timestamp */
356 - private native int[] grabFrame(String video, long time, float resize);
357 + private native byte[] grabFrame(String video, long time, float resize);
358
359 /* Create a wav file from the specified time stamps */
360 private native boolean createClip(String audio, String wav, long from, long to);