[Xfce4-commits] <tumbler:master> Make a few tiny whitespace/coding style adjustment.
Jannis Pohlmann
noreply at xfce.org
Fri May 20 01:30:01 CEST 2011
Updating branch refs/heads/master
to 3f496d6483500102f14a8df1f444f63547916441 (commit)
from 88a5e9692fcc2f2b64c152f25a98721d631b2ad7 (commit)
commit 3f496d6483500102f14a8df1f444f63547916441
Author: Jannis Pohlmann <jannis at xfce.org>
Date: Fri May 20 01:27:53 2011 +0200
Make a few tiny whitespace/coding style adjustment.
plugins/gst-thumbnailer/gst-thumbnailer-provider.c | 18 ++++--
plugins/gst-thumbnailer/gst-thumbnailer-provider.h | 4 +-
plugins/gst-thumbnailer/gst-thumbnailer.c | 63 +++++++++++++------
plugins/gst-thumbnailer/gst-thumbnailer.h | 4 +-
4 files changed, 58 insertions(+), 31 deletions(-)
diff --git a/plugins/gst-thumbnailer/gst-thumbnailer-provider.c b/plugins/gst-thumbnailer/gst-thumbnailer-provider.c
index 44285f8..4f9634e 100644
--- a/plugins/gst-thumbnailer/gst-thumbnailer-provider.c
+++ b/plugins/gst-thumbnailer/gst-thumbnailer-provider.c
@@ -34,10 +34,12 @@
#include <gst-thumbnailer/gst-thumbnailer.h>
+
static void gst_thumbnailer_provider_thumbnailer_provider_init (TumblerThumbnailerProviderIface *iface);
static GList *gst_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider);
+
struct _GstThumbnailerProviderClass
{
GObjectClass __parent__;
@@ -94,12 +96,14 @@ gst_thumbnailer_provider_init (GstThumbnailerProvider *provider)
{
}
+
+
static GList *
gst_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
{
+ /* This list is mainly from Totem. Generating a list from
+ * GStreamer isn't realistic, so we have to hardcode it. */
static const char *mime_types[] = {
- /* This list is mainly from Totem. Generating a list from GStreamer isn't
- realistic, so we have to hardcode it. */
"application/asx",
"application/ogg",
"application/x-flash-video",
@@ -127,14 +131,14 @@ gst_thumbnailer_provider_get_thumbnailers (TumblerThumbnailerProvider *provider)
"video/x-wmv",
NULL
};
-
- GstThumbnailer *thumbnailer;
- GStrv uri_schemes;
- GError *error = NULL;
+ GstThumbnailer *thumbnailer;
+ GError *error = NULL;
+ GStrv uri_schemes;
if (!gst_init_check (0, NULL, &error))
{
- g_warning ("Cannot initialize GStreamer, thumbnailer not loaded: %s", error->message);
+ g_warning ("Cannot initialize GStreamer, thumbnailer not loaded: %s",
+ error->message);
return NULL;
}
diff --git a/plugins/gst-thumbnailer/gst-thumbnailer-provider.h b/plugins/gst-thumbnailer/gst-thumbnailer-provider.h
index 44ce46e..5171b93 100644
--- a/plugins/gst-thumbnailer/gst-thumbnailer-provider.h
+++ b/plugins/gst-thumbnailer/gst-thumbnailer-provider.h
@@ -25,7 +25,7 @@
#include <glib-object.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
#define TYPE_GST_THUMBNAILER_PROVIDER (gst_thumbnailer_provider_get_type ())
#define GST_THUMBNAILER_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GST_THUMBNAILER_PROVIDER, GstThumbnailerProvider))
@@ -40,6 +40,6 @@ typedef struct _GstThumbnailerProvider GstThumbnailerProvider;
GType gst_thumbnailer_provider_get_type (void) G_GNUC_CONST;
void gst_thumbnailer_provider_register (TumblerProviderPlugin *plugin);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__GST_THUMBNAILER_PROVIDER_H__ */
diff --git a/plugins/gst-thumbnailer/gst-thumbnailer.c b/plugins/gst-thumbnailer/gst-thumbnailer.c
index 4f95694..5dcef19 100644
--- a/plugins/gst-thumbnailer/gst-thumbnailer.c
+++ b/plugins/gst-thumbnailer/gst-thumbnailer.c
@@ -36,16 +36,22 @@
#include "gst-thumbnailer.h"
#include "gst-helper.h"
+
+
#ifdef DEBUG
#define LOG(...) g_message (__VA_ARGS__)
#else
#define LOG(...)
#endif
+
+
static void gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
GCancellable *cancellable,
TumblerFileInfo *info);
+
+
struct _GstThumbnailerClass
{
TumblerAbstractThumbnailerClass __parent__;
@@ -57,17 +63,21 @@ struct _GstThumbnailer
};
+
G_DEFINE_DYNAMIC_TYPE (GstThumbnailer,
gst_thumbnailer,
TUMBLER_TYPE_ABSTRACT_THUMBNAILER);
+
void
gst_thumbnailer_register (TumblerProviderPlugin *plugin)
{
gst_thumbnailer_register_type (G_TYPE_MODULE (plugin));
}
+
+
static void
gst_thumbnailer_class_init (GstThumbnailerClass *klass)
{
@@ -77,17 +87,22 @@ gst_thumbnailer_class_init (GstThumbnailerClass *klass)
abstractthumbnailer_class->create = gst_thumbnailer_create;
}
+
+
static void
gst_thumbnailer_class_finalize (GstThumbnailerClass *klass)
{
}
+
+
static void
gst_thumbnailer_init (GstThumbnailer *thumbnailer)
{
}
+
/*
* Determine if the image is "interesting" or not. This implementation reduces
* the RGB from 24 to 12 bits and examines the distribution of colours.
@@ -161,6 +176,8 @@ is_interesting (GdkPixbuf *pixbuf)
return count > 1;
}
+
+
/*
* Construct a pipline for a given @info, cancelling during initialisation on
* @cancellable. This function will either return a #GstElement that has been
@@ -168,18 +185,24 @@ is_interesting (GdkPixbuf *pixbuf)
* cancelled or an error occurs.
*/
static GstElement *
-make_pipeline (TumblerFileInfo *info, GCancellable *cancellable)
+make_pipeline (TumblerFileInfo *info,
+ GCancellable *cancellable)
{
- GstElement *playbin, *audio_sink, *video_sink;
- int count = 0, n_video = 0;
GstStateChangeReturn state;
+ GstElement *audio_sink;
+ GstElement *playbin;
+ GstElement *video_sink;
+ gint count = 0;
+ gint n_video = 0;
g_assert (info);
playbin = gst_element_factory_make ("playbin2", "playbin");
g_assert (playbin);
+
audio_sink = gst_element_factory_make ("fakesink", "audiosink");
g_assert (audio_sink);
+
video_sink = gst_element_factory_make ("fakesink", "videosink");
g_assert (video_sink);
@@ -225,6 +248,8 @@ make_pipeline (TumblerFileInfo *info, GCancellable *cancellable)
return playbin;
}
+
+
/*
* Get the total duration in nanoseconds of the stream.
*/
@@ -241,6 +266,8 @@ get_duration (GstElement *playbin)
return duration;
}
+
+
/*
* Generate a thumbnail for @info.
*/
@@ -249,8 +276,11 @@ gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
GCancellable *cancellable,
TumblerFileInfo *info)
{
+ TumblerThumbnailFlavor *flavour;
+ TumblerThumbnail *thumbnail;
+ TumblerImageData data;
/* These positions are taken from Totem */
- const double positions[] = {
+ const gdouble positions[] = {
1.0 / 3.0,
2.0 / 3.0,
0.1,
@@ -258,14 +288,11 @@ gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
0.5
};
GstElement *playbin;
- gint64 duration;
- unsigned int i;
- GstBuffer *frame;
GdkPixbuf *shot;
- TumblerThumbnail *thumbnail;
- TumblerThumbnailFlavor *flavour;
- TumblerImageData data;
+ GstBuffer *frame;
GError *error = NULL;
+ gint64 duration;
+ guint i;
g_return_if_fail (IS_GST_THUMBNAILER (thumbnailer));
g_return_if_fail (cancellable == NULL || G_IS_CANCELLABLE (cancellable));
@@ -285,8 +312,8 @@ gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
duration = get_duration (playbin);
/* Now we have a pipeline that we know has video and is paused, ready for
- seeking. Try to find an interesting frame at each of the positions in
- order. */
+ * seeking. Try to find an interesting frame at each of the positions in
+ * order. */
for (i = 0; i < G_N_ELEMENTS (positions); i++)
{
/* Check if we've been cancelled */
@@ -329,7 +356,7 @@ gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
shot = gst_helper_convert_buffer_to_pixbuf (frame, cancellable, flavour);
g_object_unref (flavour);
- /* If it's not interesting, throw it away and try again*/
+ /* If it's not interesting, throw it away and try again */
if (is_interesting (shot))
{
/* Got an interesting image, break out */
@@ -337,10 +364,8 @@ gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
break;
}
- /*
- * If we've still got positions to try, free the current uninteresting
- * shot. Otherwise we'll make do with what we have.
- */
+ /* If we've still got positions to try, free the current uninteresting
+ * shot. Otherwise we'll make do with what we have. */
if (i + 1 < G_N_ELEMENTS (positions) && shot)
{
g_object_unref (shot);
@@ -349,9 +374,7 @@ gst_thumbnailer_create (TumblerAbstractThumbnailer *thumbnailer,
/* Spin mainloop so we can pick up the cancels */
while (g_main_context_pending (NULL))
- {
- g_main_context_iteration (NULL, FALSE);
- }
+ g_main_context_iteration (NULL, FALSE);
}
gst_element_set_state (playbin, GST_STATE_NULL);
diff --git a/plugins/gst-thumbnailer/gst-thumbnailer.h b/plugins/gst-thumbnailer/gst-thumbnailer.h
index c587f63..eabf31f 100644
--- a/plugins/gst-thumbnailer/gst-thumbnailer.h
+++ b/plugins/gst-thumbnailer/gst-thumbnailer.h
@@ -25,7 +25,7 @@
#include <glib-object.h>
-G_BEGIN_DECLS;
+G_BEGIN_DECLS
#define TYPE_GST_THUMBNAILER (gst_thumbnailer_get_type ())
#define GST_THUMBNAILER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_GST_THUMBNAILER, GstThumbnailer))
@@ -40,6 +40,6 @@ typedef struct _GstThumbnailer GstThumbnailer;
GType gst_thumbnailer_get_type (void) G_GNUC_CONST;
void gst_thumbnailer_register (TumblerProviderPlugin *plugin);
-G_END_DECLS;
+G_END_DECLS
#endif /* !__GST_THUMBNAILER_H__ */
More information about the Xfce4-commits
mailing list