diff options
author | Luca Galli <jimbo@debian.ciccio.org> | 2014-05-27 17:48:22 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2014-05-27 17:48:22 +0900 |
commit | e5974d21d42e1082c3bd769f570fcb6c62e44d84 (patch) | |
tree | 30c0955bfbd515c8ee376fcf617021f09c854e3e | |
parent | ed93671f1a24777c8afd15d19e084c6851842c50 (diff) | |
download | evas_generic_loaders-e5974d21d42e1082c3bd769f570fcb6c62e44d84.tar.gz |
Trying to port evas_generic_loaders to gstreamer1.0
Summary: Resulting video files thumbnail are grey and glitched
Reviewers: raster, cedric
CC: cedric
Differential Revision: https://phab.enlightenment.org/D819
-rw-r--r-- | configure.ac | 19 | ||||
-rw-r--r-- | src/bin/gst/main.c | 21 |
2 files changed, 30 insertions, 10 deletions
diff --git a/configure.ac b/configure.ac index ee7f965..c7aaf50 100644 --- a/configure.ac +++ b/configure.ac @@ -147,9 +147,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.0 +GSTPLUG_REQS=1.0 +GST_MAJORMINOR=1.0 AC_ARG_ENABLE([gstreamer], [AC_HELP_STRING([--disable-gstreamer], [disable gstreamer support @<:@default==enabled@:>@])], @@ -163,6 +163,19 @@ if test "x$want_gstreamer" = "xyes" ; then ], [have_gst="yes"], [have_gst="no"]) + if test "x$have_gst" = "xno" ; then + GST_REQS=0.10.13 + GSTPLUG_REQS=0.10.13 + GST_MAJORMINOR=0.10 + PKG_CHECK_MODULES([GSTREAMER], + [gstreamer-$GST_MAJORMINOR >= $GST_REQS + gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPLUG_REQS + ], + [have_gst="yes" + AC_DEFINE_UNQUOTED([USE_OLD_GST], [1], [using older gstreamer]) + ], + [have_gst="no"]) + fi else have_gst=no fi diff --git a/src/bin/gst/main.c b/src/bin/gst/main.c index c6e4dd0..526e1a6 100644 --- a/src/bin/gst/main.c +++ b/src/bin/gst/main.c @@ -23,7 +23,7 @@ #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" +#define CAPS "video/x-raw,format=RGB" static GstElement *pipeline = NULL; static GstElement *sink = NULL; @@ -67,7 +67,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); @@ -112,7 +112,7 @@ _gst_init(const char *filename) } 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"); @@ -126,7 +126,7 @@ _gst_init(const char *filename) goto unref_pipeline; } - caps = gst_pad_get_negotiated_caps(pad); + caps = gst_pad_get_current_caps(pad); if (!caps) goto unref_pad; @@ -167,6 +167,8 @@ static void _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"); if (pos >= 0.0) @@ -175,14 +177,19 @@ _gst_load_image(int size_w EINA_UNUSED, int size_h EINA_UNUSED, double pos) else 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)); + 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 |