Bonjour,
En utilisant e17 de strectch j'ai remaqué que les vignettes vidéos et
pdf n'étaient pas générées.
mon patch s'applique sur le paquet evas-loaders-1.8.1-2 dont voici
l'adresse :
https://packages.debian.org/stretch/libevas-loaders
Cordialement
Thierry
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;
}
+