[Pkg-e-devel] Bug#868125: libevas-loaders: No thumbnails pdf and video

Thierry Ordissimo thierry at substantiel.fr
Wed Jul 12 07:43:48 UTC 2017


Package: libevas-loaders
Version: 1.8.1-2s1
Severity: normal

Dear Maintainer,

*** Reporter, please consider answering these questions, where appropriate ***

   * When compiling the package, the loaders pdf and gst are disabled.
   * I corrected the dependencies, rules and patched sources.



-- System Information:
Debian Release: 9.0
  APT prefers stable
  APT policy: (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8),
LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages libevas-loaders depends on:
ii  libc6               2.24-11+deb9u1
ii  libcairo2           1.14.8-1
ii  libeina1            1.8.6-2.5s1
ii  libgcc1             1:6.3.0-18
ii  libgdk-pixbuf2.0-0  2.36.5-2
ii  libglib2.0-0        2.50.3-2
ii  libgomp1            6.3.0-18
ii  libgstreamer1.0-0   1.10.4-1
ii  liblcms2-2          2.8-4
ii  libpoppler64        0.48.0-2
ii  libraw15            0.17.2-6+b1
ii  librsvg2-2          2.40.16-1+b1
ii  libspectre1         0.2.8-1
ii  libstdc++6          6.3.0-18
ii  zlib1g              1:1.2.8.dfsg-5

libevas-loaders recommends no packages.

libevas-loaders suggests no packages.

-- no debconf information

*** /home/ordissimo/control
Source: evas-loaders
Section: libs
Priority: optional
Maintainer: Debian Pkg-e Team <pkg-e-devel at lists.alioth.debian.org>
Uploaders: Albin Tonnerre <lutin at debian.org>
Build-Depends: debhelper (>= 9), dh-autoreconf, libeina-dev (>= 1.7.7),
 librsvg2-dev, libspectre-dev, libraw-dev, libpoppler-private-dev,
 libgstreamer-plugins-base1.0-dev, libgstreamer1.0-dev
Standards-Version: 3.9.5
Vcs-Git: git://anonscm.debian.org/pkg-e/libs/evas-loaders.git
Vcs-Browser: http://anonscm.debian.org/gitweb/?p=pkg-e/libs/evas-loaders.git
Homepage: http://www.enlightenment.org

Package: libevas-loaders
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
Depends: ${shlibs:Depends}, ${misc:Depends}
Replaces: libevas1 (<< 1.7.7-5)
Description: Additional file format loaders for libevas
 This package contains programs that allow libevas to load various images
 and documents formats for which it has no built-in support:
  - XCF
  - SVG




*** /home/ordissimo/rules
#!/usr/bin/make -f

%:
        dh $@ --with autoreconf




*** /home/ordissimo/compatibility_with_poppler_and_gstreamer.patch
Index: evas-loaders-1.8.1+ordissimo/src/bin/pdf/main.cpp
===================================================================
--- evas-loaders-1.8.1+ordissimo.orig/src/bin/pdf/main.cpp
+++ evas-loaders-1.8.1+ordissimo/src/bin/pdf/main.cpp
@@ -62,11 +62,6 @@ Eina_Bool poppler_init(const char *file,
    if (!eina_init())
      goto del_global_param;

-   if (globalParams->getAntialias())
-     globalParams->setAntialias((char *)"yes");
-   if (globalParams->getVectorAntialias())
-     globalParams->setVectorAntialias((char *)"yes");
-
    pdfdoc = new PDFDoc(new GooString(file), NULL);
    if (!pdfdoc)
      goto del_global_param;
@@ -202,8 +197,8 @@ void poppler_load_image(int size_w, int
 int
 main(int argc, char **argv)
 {
-   Eina_Tmpstr *tmpdir = NULL;
-   Eina_Tmpstr *generated = NULL;
+   char tmpdir[PATH_MAX];
+   char generated[PATH_MAX];
    char *extension;
    char *dir;
    char *file;
@@ -253,49 +248,51 @@ main(int argc, char **argv)
    extension = strrchr(file, '.');
    dir = dirname(argv[0]);
    if (extension && dir && strcmp(extension, ".pdf"))
+   {
+     strcpy(tmpdir, "evas_generic_pdf_loaderXXXXXX");
+     mktemp(tmpdir);
+     if (*tmpdir != 0)
      {
-        if (eina_file_mkdtemp("evas_generic_pdf_loaderXXXXXX", &tmpdir))
-          {
-             Eina_Strbuf *tmp;
-             FILE *cmd;
+       Eina_Strbuf *tmp;
+       FILE *cmd;

-             tmp = eina_strbuf_new();
-             eina_strbuf_append_printf(tmp, "%s/evas_generic_pdf_loader.%s
'%s' %s", dir, extension + 1, file, tmpdir);
+       tmp = eina_strbuf_new();
+       eina_strbuf_append_printf(tmp, "%s/evas_generic_pdf_loader.%s '%s' %s",
dir, extension + 1, file, tmpdir);

-             cmd = popen(eina_strbuf_string_get(tmp), "r");
-             D("running preprocessing process '%s'...\n",
eina_strbuf_string_get(tmp));
-             eina_strbuf_reset(tmp);
-
-             if (cmd)
-               {
-                  struct stat st;
-                  const char *filename;
-                  char buf[1024];
-
-                  while (fgets(buf, sizeof (buf), cmd))
-                    ;
-                  pclose(cmd);
-
-                  filename = basename(file);
-                  generated = eina_tmpstr_add_length(filename,
strlen(filename) - strlen(extension));
-
-                  eina_strbuf_append_printf(tmp, "%s/%s.pdf", tmpdir,
generated);
-
-                  eina_tmpstr_del(generated);
-                  generated = NULL;
-
-                  if (stat(eina_strbuf_string_get(tmp), &st) == 0)
-                    {
-                       generated =
eina_tmpstr_add_length(eina_strbuf_string_get(tmp),
-
eina_strbuf_length_get(tmp));
-                       file = (char*) generated;
-                    }
-               }
+       cmd = popen(eina_strbuf_string_get(tmp), "r");
+       D("running preprocessing process '%s'...\n",
eina_strbuf_string_get(tmp));
+       eina_strbuf_reset(tmp);
+
+       if (cmd)
+       {
+         struct stat st;
+         const char *filename;
+         char buf[1024];
+
+         while (fgets(buf, sizeof (buf), cmd))
+           ;
+         pclose(cmd);
+
+         filename = basename(file);
+         snprintf (generated, sizeof (generated) , "%s", filename);
+         generated[strlen(filename) - strlen(extension) - 1] = 0;
+
+         eina_strbuf_append_printf(tmp, "%s/%s.pdf", tmpdir, generated);
+
+         *generated = 0;
+
+         if (stat(eina_strbuf_string_get(tmp), &st) == 0)
+         {
+           snprintf (generated, sizeof (generated) , "%s",
eina_strbuf_string_get(tmp));
+           generated[eina_strbuf_length_get(tmp) - 1] = 0;
+           file = strdup (generated);
+         }
+       }

-             D("generated file: '%s'\n", generated);
-             eina_strbuf_free(tmp);
-          }
+       D("generated file: '%s'\n", generated);
+       eina_strbuf_free(tmp);
      }
+   }

    // Let's force a timeout if things go wrong
    timeout_init(10);
@@ -303,7 +300,13 @@ main(int argc, char **argv)
    // Now process the pdf (or the generated pdf)
    D("poppler_file_init\n");
    if (!poppler_init(file, page, size_w, size_h))
+   {
+     if (file)
+       free (file);
      return -1;
+   }
+   if (file)
+     free (file);
    D("poppler_file_init done\n");

    D("dpi2...: %f\n", dpi);
@@ -340,9 +343,6 @@ main(int argc, char **argv)
      {
         if (generated) unlink(generated);
         rmdir(tmpdir);
-
-        eina_tmpstr_del(tmpdir);
-        eina_tmpstr_del(generated);
      }

    return 0;
Index: evas-loaders-1.8.1+ordissimo/configure.ac
===================================================================
--- evas-loaders-1.8.1+ordissimo.orig/configure.ac
+++ evas-loaders-1.8.1+ordissimo/configure.ac
@@ -82,6 +82,26 @@ if test "x${want_poppler}" = "xyes" ; th
          [have_poppler="no"])
    fi

+   if test "x${have_poppler}" = "xno" ; then
+      PKG_CHECK_EXISTS([poppler >= 0.31 poppler < 0.38],
+         [
+          poppler_pc="poppler >= 0.31"
+          AC_DEFINE(HAVE_POPPLER_031, 1, [Have poppler 0.31])
+          have_poppler="yes"
+         ],
+         [have_poppler="no"])
+   fi
+
+   if test "x${have_poppler}" = "xno" ; then
+      PKG_CHECK_EXISTS([poppler >= 0.38 poppler < 0.49],
+         [
+          poppler_pc="poppler >= 0.38"
+          AC_DEFINE(HAVE_POPPLER_038, 1, [Have poppler 0.38])
+          have_poppler="yes"
+         ],
+         [have_poppler="no"])
+   fi
+
    if test "x${have_poppler}" = "xyes" ; then
       PKG_CHECK_MODULES([POPPLER], [${poppler_pc}],
          [have_poppler="yes"],
@@ -147,9 +167,9 @@ if test "x$want_svg" = "xyes" ; then
 else
    have_svg=no
 fi
-GST_REQS=0.10.13
-GSTPLUG_REQS=0.10.13
-GST_MAJORMINOR=0.10
+GST_REQS=1.10.4
+GSTPLUG_REQS=1.10.4
+GST_MAJORMINOR=1.0

 AC_ARG_ENABLE([gstreamer],
    [AC_HELP_STRING([--disable-gstreamer], [disable gstreamer support
@<:@default==enabled@:>@])],
Index: evas-
loaders-1.8.1+ordissimo/src/bin/pdf/evas_generic_pdf_loader.libreoffice
===================================================================
--- evas-
loaders-1.8.1+ordissimo.orig/src/bin/pdf/evas_generic_pdf_loader.libreoffice
+++ evas-
loaders-1.8.1+ordissimo/src/bin/pdf/evas_generic_pdf_loader.libreoffice
@@ -1,2 +1,10 @@
 #!/bin/sh
-/usr/lib/libreoffice/program/soffice.bin --headless --convert-to pdf --outdir
"$2" "$1"
+LOBIN=soffice
+if [ -x /usr/lib/libreoffice/program/soffice.bin ]; then
+       LOBIN=/usr/lib/libreoffice/program/soffice.bin
+elif [ -x /usr/lib64/libreoffice/program/soffice.bin ]; then
+       LOBIN=/usr/lib64/libreoffice/program/soffice.bin
+elif [ -x /opt/libreoffice4.4/program/soffice.bin ]; then
+       LOBIN=/opt/libreoffice4.4/program/soffice.bin
+fi
+$LOBIN --headless --convert-to pdf --outdir "$2" "$1"
Index: evas-loaders-1.8.1+ordissimo/src/bin/gst/main.c
===================================================================
--- evas-loaders-1.8.1+ordissimo.orig/src/bin/gst/main.c
+++ evas-loaders-1.8.1+ordissimo/src/bin/gst/main.c
@@ -23,7 +23,11 @@
 #define D(fmt, args...)
 #endif

-#define CAPS "video/x-raw-
rgb,bpp=(int)32,depth=(int)32,endianness=(int)4321,red_mask=(int)0x0000ff00,
green_mask=(int)0x00ff0000, blue_mask=(int)0xff000000"
+#ifdef WORDS_BIGENDIAN
+# define CAPS "video/x-raw,format=ARGB"
+#else
+# define CAPS "video/x-raw,format=BGRA"
+#endif

 static GstElement *pipeline = NULL;
 static GstElement *sink = NULL;
@@ -45,7 +49,7 @@ _gst_init(const char *filename)
    GError              *error = NULL;
    GstFormat            format;
    GstStateChangeReturn ret;
-   int                  vidstr = 0;
+//   int                  vidstr = 0;

    if (!filename || !*filename)
      return EINA_FALSE;
@@ -67,7 +71,7 @@ _gst_init(const char *filename)

    D("Setting file %s\n", uri);

-   descr = g_strdup_printf("uridecodebin uri=%s ! typefind ! ffmpegcolorspace
! "
+   descr = g_strdup_printf("uridecodebin uri=%s ! typefind ! videoconvert ! "
       " appsink name=sink caps=\"" CAPS "\"", uri);
    pipeline = gst_parse_launch(descr, &error);
    free(uri);
@@ -79,6 +83,7 @@ _gst_init(const char *filename)
         goto gst_shutdown;
      }
 /* needs gst 1.0+
+ * also only works on playbin objects!!! this is a uridecodebin!
    g_object_get(G_OBJECT(pipeline),
                 "n-video", &vidstr,
                 NULL);
@@ -106,26 +111,27 @@ _gst_init(const char *filename)
    ret = gst_element_get_state((pipeline), NULL, NULL, GST_CLOCK_TIME_NONE);
    if (ret == GST_STATE_CHANGE_FAILURE)
      {
-       D("could not complete pause\n");
+        D("could not complete pause\n");
         goto unref_pipeline;
      }

    format = GST_FORMAT_TIME;
-   gst_element_query_duration (pipeline, &format, &duration);
+   gst_element_query_duration (pipeline, format, &duration);
    if (duration == -1)
      {
-       D("could not retrieve the duration, set it to 1s\n");
+        fprintf(stderr, "duration fetch err\n");
+        D("could not retrieve the duration, set it to 1s\n");
         duration = 1 * GST_SECOND;
      }

    pad = gst_element_get_static_pad(sink, "sink");
    if (!pad)
      {
-       D("could not retrieve the sink pad\n");
+        D("could not retrieve the sink pad\n");
         goto unref_pipeline;
      }

-   caps = gst_pad_get_negotiated_caps(pad);
+   caps = gst_pad_get_current_caps(pad);
    if (!caps)
      goto unref_pad;

@@ -163,31 +169,42 @@ _gst_shutdown()
 }

 static void
-_gst_load_image(int size_w EINA_UNUSED, int size_h EINA_UNUSED)
+_gst_load_image(int size_w EINA_UNUSED, int size_h EINA_UNUSED, double pos)
 {
    GstBuffer *buffer;
+   GstMapInfo info;
+   GstSample *sample;

    D("load image\n");
-   gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
-                           duration / 2);
-   g_signal_emit_by_name(sink, "pull-preroll", &buffer, NULL);
-   D("load image : %p %d\n", GST_BUFFER_DATA(buffer),
GST_BUFFER_SIZE(buffer));
+   if (pos >= 0.0)
+     gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
+                             pos);
+   else
+     gst_element_seek_simple(pipeline, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH,
+                             duration / 2);
+   g_signal_emit_by_name(sink, "pull-preroll", &sample, NULL);

    shm_alloc(width * height * sizeof(DATA32));
    if (!shm_addr) return;
    data = shm_addr;

-   memcpy(data, GST_BUFFER_DATA(buffer), GST_BUFFER_SIZE(buffer));
+   buffer = gst_sample_get_buffer (sample);
+   gst_buffer_map (buffer, &info, GST_MAP_READ);
+   D("load image: %p %d\n", info.data, info.size);
+
+   memcpy(data, info.data, info.size);
+
+   gst_buffer_unmap(buffer, &info);
 }

 int
 main(int argc, char **argv)
 {
-   char *file;
-   int i;
+   char *file, *p;
+   int i, numonly;
    int size_w = 0, size_h = 0;
    int head_only = 0;
-   int page = 0;
+   long long pos = -1.0;

    if (argc < 2) return -1;
    // file is ALWAYS first arg, other options come after
@@ -200,7 +217,16 @@ main(int argc, char **argv)
         else if (!strcmp(argv[i], "-key"))
           {
              i++;
-             page = atoi(argv[i]);
+             numonly = 1;
+             for (p = argv[i]; *p; p++)
+               {
+                  if ((*p < '0') || (*p > '9'))
+                    {
+                       numonly = 0;
+                       break;
+                    }
+               }
+             if (numonly) pos = atoll(argv[i]) * 1000000;
              i++;
           }
         else if (!strcmp(argv[i], "-opt-scale-down-by"))
@@ -222,16 +248,18 @@ main(int argc, char **argv)
      }

    timeout_init(10);
-
+
    D("_gst_init_file\n");

    if (!_gst_init(file))
      return -1;
    D("_gst_init done\n");

+   if ((pos >= 0) && (pos > duration)) return -1;
+
    if (!head_only)
      {
-        _gst_load_image(size_w, size_h);
+        _gst_load_image(size_w, size_h, pos);
      }

    D("size...: %ix%i\n", width, height);
@@ -259,6 +287,7 @@ main(int argc, char **argv)
      printf("done\n");

    _gst_shutdown();
-
+   fflush(stdout);
    return 0;



More information about the Pkg-e-devel mailing list