gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-dev] [PATCH] Make defineBitsJPEG2 load all headers before JPEG da


From: Timothy Lee
Subject: [Gnash-dev] [PATCH] Make defineBitsJPEG2 load all headers before JPEG data
Date: Mon, 24 Apr 2006 17:51:20 +0800
User-agent: Thunderbird 3.0a1 (X11/20060423)

Dear all,

This is a patch to make defineBitsJPEG2 support tags data that contain more than one headers. The now obsolete function read_swf_jpeg2() is removed, and comments for read_swf_jpeg2_with_tables() is updated.

Also attached is an example file that needs the patch to play properly.

Regards
Timothy Lee

Attachment: ceiva.swf
Description: application/shockwave-flash

Index: libbase/image.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/image.cpp,v
retrieving revision 1.5
diff -u -r1.5 image.cpp
--- libbase/image.cpp   26 Feb 2006 15:49:29 -0000      1.5
+++ libbase/image.cpp   24 Apr 2006 09:47:18 -0000
@@ -282,26 +282,10 @@
        }
 
 
-       rgb*    read_swf_jpeg2(tu_file* in)
-       // Create and read a new image from the stream.  Image is in
-       // SWF JPEG2-style format (the encoding tables come first in a
-       // separate "stream" -- otherwise it's just normal JPEG).  The
-       // IJG documentation describes this as "abbreviated" format.
-       {
-               jpeg::input*    j_in = 
jpeg::input::create_swf_jpeg2_header_only(in);
-               if (j_in == NULL) return NULL;
-               
-               rgb* im = read_swf_jpeg2_with_tables(j_in);
-
-               delete j_in;
-
-               return im;              
-       }
-
-
        rgb*    read_swf_jpeg2_with_tables(jpeg::input* j_in)
        // Create and read a new image, using a input object that
-       // already has tables loaded.
+       // already has tables loaded.  The IJG documentation describes
+       // this as "abbreviated" format.
        {
                assert(j_in);
 
Index: libbase/jpeg.cpp
===================================================================
RCS file: /sources/gnash/gnash/libbase/jpeg.cpp,v
retrieving revision 1.4
diff -u -r1.4 jpeg.cpp
--- libbase/jpeg.cpp    26 Feb 2006 15:49:30 -0000      1.4
+++ libbase/jpeg.cpp    24 Apr 2006 09:47:18 -0000
@@ -372,7 +372,13 @@
                        assert(m_compressor_opened == false);
 
                        // Now, read the image header.
-                       jpeg_read_header(&m_cinfo, TRUE);
+                       int result;
+                       do
+                       {
+                               // Read all available headers
+                               result = jpeg_read_header(&m_cinfo, FALSE);
+                       } while (result == JPEG_HEADER_TABLES_ONLY);
+                       assert(result == JPEG_HEADER_OK);
 
                        jpeg_start_decompress(&m_cinfo);
                        m_compressor_opened = true;
Index: server/impl.cpp
===================================================================
RCS file: /sources/gnash/gnash/server/impl.cpp,v
retrieving revision 1.24
diff -u -r1.24 impl.cpp
--- server/impl.cpp     12 Mar 2006 00:35:15 -0000      1.24
+++ server/impl.cpp     24 Apr 2006 09:47:19 -0000
@@ -928,7 +928,7 @@
     if (m->get_create_bitmaps() == DO_LOAD_BITMAPS)
        {
 #if TU_CONFIG_LINK_TO_JPEGLIB
-               image::rgb* im = 
image::read_swf_jpeg2(in->get_underlying_stream());
+           image::rgb* im = image::read_jpeg(in->get_underlying_stream());
            bi = render::create_bitmap_info_rgb(im);
            delete im;
 #else

reply via email to

[Prev in Thread] Current Thread [Next in Thread]