~jpakkane/thumbnailer/manual-orient

« back to all changes in this revision

Viewing changes to src/vs-thumb.cpp

  • Committer: Tarmac
  • Author(s): Jussi Pakkanen
  • Date: 2013-11-04 18:21:55 UTC
  • mfrom: (58.2.29 thumbnailer)
  • Revision ID: tarmac-20131104182155-vgqcl10k07p7zqgu
Created a unique_gobj class for managing gobject based resources.

Approved by PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 * Authored by: Jussi Pakkanen <jussi.pakkanen@canonical.com>
17
17
 */
18
18
 
 
19
#include<internal/gobj_memory.h>
19
20
#include<cstdio>
20
21
#include<memory>
21
22
#include<stdexcept>
78
79
        }
79
80
        GstMapInfo mi;
80
81
        gst_buffer_map(buf, &mi, GST_MAP_READ);
81
 
        unique_ptr<GdkPixbuf, void(*)(GdkPixbuf *t)> img(
 
82
        unique_gobj<GdkPixbuf> img(
82
83
                gdk_pixbuf_new_from_data(mi.data, GDK_COLORSPACE_RGB,
83
84
                        false, 8, width, height,
84
85
                        (((width * 3)+3)&~3),
85
 
                        nullptr, nullptr),
86
 
                        [](GdkPixbuf *t) {g_object_unref(G_OBJECT(t));});
 
86
                        nullptr, nullptr));
87
87
        gst_buffer_unmap(buf, &mi);
88
88
        GError *err = nullptr;
89
89
        if(!gdk_pixbuf_save(img.get(), ofname.c_str(), "jpeg", &err, NULL)) {