[Xfce4-commits] [apps/parole] 01/01: More cleanup
noreply at xfce.org
noreply at xfce.org
Fri Jun 20 03:58:37 CEST 2014
This is an automated email from the git hooks/post-receive script.
bluesabre pushed a commit to branch master
in repository apps/parole.
commit 007647198dff650dbbf0e88184c56e96c7684c38
Author: Sean Davis <smd.seandavis at gmail.com>
Date: Thu Jun 19 21:58:31 2014 -0400
More cleanup
---
src/gst/parole-gst.c | 76 -------------
src/gst/parole-gst.h | 7 --
src/misc/parole-stream.c | 272 +++++++++++++++++++++++-----------------------
src/parole-clutter.c | 47 +++++++-
src/parole-clutter.h | 21 ++++
src/parole-player.c | 5 +-
6 files changed, 201 insertions(+), 227 deletions(-)
diff --git a/src/gst/parole-gst.c b/src/gst/parole-gst.c
index 9097058..ba6fbe1 100644
--- a/src/gst/parole-gst.c
+++ b/src/gst/parole-gst.c
@@ -279,82 +279,6 @@ parole_gst_show (GtkWidget *widget)
GTK_WIDGET_CLASS (parole_gst_parent_class)->show (widget);
}
-void
-parole_gst_get_video_output_size_from_dimensions (ParoleGst *gst, gint w, gint h, gint *ret_w, gint *ret_h)
-{
- *ret_w = w;
- *ret_h = w;
-
- if ( gst->priv->state >= GST_STATE_PAUSED )
- {
- gboolean has_video;
- guint video_w, video_h;
- guint video_par_n, video_par_d;
- guint dar_n, dar_d;
- guint disp_par_n, disp_par_d;
-
- g_object_get (G_OBJECT (gst->priv->stream),
- "has-video", &has_video,
- "video-width", &video_w,
- "video-height", &video_h,
- "disp-par-n", &disp_par_n,
- "disp-par-d", &disp_par_d,
- NULL);
-
- if ( has_video )
- {
- if ( video_w != 0 && video_h != 0 )
- {
- switch ( gst->priv->aspect_ratio )
- {
- case PAROLE_ASPECT_RATIO_NONE:
- return;
- case PAROLE_ASPECT_RATIO_AUTO:
- *ret_w = video_w;
- *ret_h = video_h;
- return;
- case PAROLE_ASPECT_RATIO_SQUARE:
- video_par_n = 1;
- video_par_d = 1;
- break;
- case PAROLE_ASPECT_RATIO_16_9:
- video_par_n = 16 * video_h;
- video_par_d = 9 * video_w;
- break;
- case PAROLE_ASPECT_RATIO_4_3:
- video_par_n = 4 * video_h;
- video_par_d = 3 * video_w;
- break;
- case PAROLE_ASPECT_RATIO_DVB:
- video_par_n = 20 * video_h;
- video_par_d = 9 * video_w;
- break;
- default:
- return;
- }
-
- if ( gst_video_calculate_display_ratio (&dar_n, &dar_d,
- video_w, video_h,
- video_par_n, video_par_d,
- disp_par_n, disp_par_d) )
- {
- if (video_w % dar_n == 0)
- {
- *ret_w = video_w;
- *ret_h = (guint) gst_util_uint64_scale (video_w, dar_d, dar_n);
- }
- else
- {
- *ret_w = (guint) gst_util_uint64_scale (video_h, dar_n, dar_d);
- *ret_h = video_h;
- }
- g_print ("Got best video size %dx%d fraction, %d/%d\n", *ret_w, *ret_h, disp_par_n, disp_par_d);
- }
- }
- }
- }
-}
-
static void
parole_gst_get_video_output_size (ParoleGst *gst, gint *ret_w, gint *ret_h)
{
diff --git a/src/gst/parole-gst.h b/src/gst/parole-gst.h
index f70efe9..75a7605 100644
--- a/src/gst/parole-gst.h
+++ b/src/gst/parole-gst.h
@@ -178,13 +178,6 @@ void gst_set_current_audio_track (ParoleGst *gst,
void gst_set_current_subtitle_track (ParoleGst *gst,
gint track_no);
-void
-parole_gst_get_video_output_size_from_dimensions (ParoleGst *gst,
- gint w,
- gint h,
- gint *ret_w,
- gint *ret_h);
-
const ParoleStream
*parole_gst_get_stream (ParoleGst *gst);
diff --git a/src/misc/parole-stream.c b/src/misc/parole-stream.c
index 2fe9109..74f6280 100644
--- a/src/misc/parole-stream.c
+++ b/src/misc/parole-stream.c
@@ -75,8 +75,8 @@ struct _ParoleStreamPrivate
guint bitrate;
GdkPixbuf *image;
gchar *image_uri, *previous_image;
-
- ParoleMediaType media_type;
+
+ ParoleMediaType media_type;
};
enum
@@ -114,9 +114,9 @@ static void
parole_stream_get_media_type_from_uri (ParoleStream *stream, const gchar *uri)
{
GValue val = { 0, };
-
+
ParoleMediaType type = PAROLE_MEDIA_TYPE_UNKNOWN;
-
+
if ( g_str_has_prefix (uri, "file:/") )
type = PAROLE_MEDIA_TYPE_LOCAL_FILE;
else if ( g_str_has_prefix (uri, "dvd:/") )
@@ -129,9 +129,9 @@ parole_stream_get_media_type_from_uri (ParoleStream *stream, const gchar *uri)
type = PAROLE_MEDIA_TYPE_CDDA;
else if ( g_str_has_prefix (uri, "dvb:/") )
type = PAROLE_MEDIA_TYPE_DVB;
- else
+ else
type = PAROLE_MEDIA_TYPE_UNKNOWN;
-
+
g_value_init (&val, PAROLE_ENUM_TYPE_MEDIA_TYPE);
g_value_set_enum (&val, type);
g_object_set_property (G_OBJECT (stream), "media-type", &val);
@@ -168,7 +168,7 @@ static void parole_stream_set_property (GObject *object,
{
ParoleStreamPrivate *priv;
gboolean maybe_remote;
-
+
priv = PAROLE_STREAM_GET_PRIVATE (stream);
maybe_remote = priv->media_type == PAROLE_MEDIA_TYPE_REMOTE ||
priv->media_type == PAROLE_MEDIA_TYPE_UNKNOWN;
@@ -335,7 +335,7 @@ parole_stream_finalize (GObject *object)
ParoleStream *stream;
stream = PAROLE_STREAM (object);
-
+
parole_stream_init_properties (stream);
G_OBJECT_CLASS (parole_stream_parent_class)->finalize (object);
@@ -345,33 +345,33 @@ parole_stream_finalize (GObject *object)
* parole_stream_set_image:
* @object: a #ParoleStream object.
* @pixbuf: a #GdkPixbuf to set as the stream image.
- *
+ *
* Set the ParoleStream image to a new pixbuf.
- *
- *
+ *
+ *
* Since: 0.6
**/
-void
+void
parole_stream_set_image (GObject *object, GdkPixbuf *pixbuf)
{
ParoleStream *stream;
gchar *filename = NULL;
gint fid;
-
+
stream = PAROLE_STREAM (object);
-
+
if ( PAROLE_STREAM_GET_PRIVATE (stream)->image )
g_object_unref(G_OBJECT(PAROLE_STREAM_GET_PRIVATE (stream)->image));
-
+
if (pixbuf)
{
PAROLE_STREAM_GET_PRIVATE (stream)->image = gdk_pixbuf_copy(pixbuf);
-
+
/* Create a jpeg of the artwork for other components to easily access */
fid = g_file_open_tmp ("parole-art-XXXXXX.jpg", &filename, NULL);
close(fid);
gdk_pixbuf_save (pixbuf, filename, "jpeg", NULL, "quality", "100", NULL);
-
+
PAROLE_STREAM_GET_PRIVATE (stream)->previous_image = g_strdup(filename);
PAROLE_STREAM_GET_PRIVATE (stream)->image_uri = g_strdup_printf("file://%s", filename);
g_free(filename);
@@ -389,14 +389,14 @@ parole_stream_get_image (GObject *object)
{
ParoleStream *stream;
GdkPixbuf *pixbuf;
-
+
stream = PAROLE_STREAM (object);
-
+
if (PAROLE_STREAM_GET_PRIVATE (stream)->image)
pixbuf = gdk_pixbuf_copy(GDK_PIXBUF(PAROLE_STREAM_GET_PRIVATE (stream)->image));
else
pixbuf = NULL;
-
+
return pixbuf;
}
@@ -412,41 +412,41 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:uri:
- *
+ *
* Currently loaded uri.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_URI,
g_param_spec_string ("uri",
- "Uri",
+ "Uri",
"Uri",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:subtitles:
- *
+ *
* Subtitles path, this is only valid if the property
* "media-type" has the value PAROLE_MEDIA_TYPE_LOCAL_FILE.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_SUBTITLES,
g_param_spec_string ("subtitles",
- "Subtitles",
+ "Subtitles",
"Subtitle file",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:has-audio:
- *
+ *
* Whether the stream has audio.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_HAS_AUDIO,
@@ -457,45 +457,45 @@ parole_stream_class_init (ParoleStreamClass *klass)
G_PARAM_READWRITE));
/**
* ParoleStream:has-video:
- *
+ *
* Whether the stream has video.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_HAS_VIDEO,
g_param_spec_boolean ("has-video",
- "Has video",
+ "Has video",
"Has video",
FALSE,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:live:
- *
+ *
* Whether the stream is a live stream.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_LIVE,
g_param_spec_boolean ("live",
- "Live",
+ "Live",
"Live",
FALSE,
G_PARAM_READWRITE));
/**
* ParoleStream:media-type:
- *
+ *
* The media type.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_MEDIA_TYPE,
g_param_spec_enum ("media-type",
- "Media type",
+ "Media type",
"Media type",
PAROLE_ENUM_TYPE_MEDIA_TYPE,
PAROLE_MEDIA_TYPE_UNKNOWN,
@@ -503,31 +503,31 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:seekable:
- *
- * Whether the stream is seekable, for example live
+ *
+ * Whether the stream is seekable, for example live
* streams are not seekable.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_SEEKABLE,
g_param_spec_boolean ("seekable",
- "Seekable",
+ "Seekable",
"Seekable",
FALSE,
G_PARAM_READWRITE));
/**
* ParoleStream:duration:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_DURATION,
g_param_spec_int64 ("duration",
- "Duration",
+ "Duration",
"Duration",
0, G_MAXINT64,
0,
@@ -535,10 +535,10 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:tag-available:
- *
+ *
* Whether tags information are available on the current stream.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_TAG_AVAILABLE,
@@ -550,10 +550,10 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:absolute-duration:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_ABSOLUTE_DURATION,
@@ -566,10 +566,10 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:disp-par-n:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_DISP_PAR_N,
@@ -579,13 +579,13 @@ parole_stream_class_init (ParoleStreamClass *klass)
1, G_MAXUINT,
1,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:disp-par-n:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_DISP_PAR_D,
@@ -595,13 +595,13 @@ parole_stream_class_init (ParoleStreamClass *klass)
1, G_MAXUINT,
1,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:video-width:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_VIDEO_WIDTH,
@@ -611,13 +611,13 @@ parole_stream_class_init (ParoleStreamClass *klass)
0, G_MAXINT,
0,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:video-height:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_VIDEO_HEIGHT,
@@ -627,14 +627,14 @@ parole_stream_class_init (ParoleStreamClass *klass)
0, G_MAXINT,
0,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:num-tracks:
- *
+ *
* Number of tracks in the cdda source, only valid if
* ParoleStream:media-type: is PAROLE_MEDIA_TYPE_CDDA.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_TRACKS,
@@ -644,35 +644,35 @@ parole_stream_class_init (ParoleStreamClass *klass)
1, 99,
1,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:track:
- *
+ *
* Currently playing track, this is only valid if
- * #ParoleStream:media-type: is PAROLE_MEDIA_TYPE_CDDA
+ * #ParoleStream:media-type: is PAROLE_MEDIA_TYPE_CDDA
* or PAROLE_MEDIA_TYPE_DVD.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_TRACK,
g_param_spec_uint ("track",
- "Track",
+ "Track",
"Track",
0, 99,
1,
G_PARAM_READWRITE));
/**
* ParoleStream:title:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_TITLE,
g_param_spec_string ("title",
- "Title",
+ "Title",
"Title",
NULL,
G_PARAM_READWRITE));
@@ -680,110 +680,110 @@ parole_stream_class_init (ParoleStreamClass *klass)
/**
* ParoleStream:artist:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_ARTIST,
g_param_spec_string ("artist",
- "Artist",
+ "Artist",
"Artist",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:year:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_YEAR,
g_param_spec_string ("year",
- "Year",
+ "Year",
"Year",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:album:
- *
- *
- *
- * Since: 0.2
+ *
+ *
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_ALBUM,
g_param_spec_string ("album",
- "Album",
+ "Album",
"Album",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:comment:
- *
+ *
* Extra comment block.
- *
- * Since: 0.2
+ *
+ * Since: 0.2
**/
g_object_class_install_property (object_class,
PROP_COMMENT,
g_param_spec_string ("comment",
- "Comment",
+ "Comment",
"Comment",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:genre:
- *
+ *
* Genre.
- *
+ *
* Since: 0.6
**/
g_object_class_install_property (object_class,
PROP_GENRE,
g_param_spec_string ("genre",
- "Genre",
+ "Genre",
"Genre",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:image_uri:
- *
+ *
* URI for the currently playing album's artwork.
- *
+ *
* Since: 0.6
**/
g_object_class_install_property (object_class,
PROP_IMAGE_URI,
g_param_spec_string ("image_uri",
- "Image URI",
+ "Image URI",
"URI for the album artwork",
NULL,
G_PARAM_READWRITE));
-
+
/**
* ParoleStream:bitrate:
- *
+ *
* Current bitrate in bits/s.
- *
+ *
* Since: 0.6
**/
g_object_class_install_property (object_class,
PROP_BITRATE,
g_param_spec_uint ("bitrate",
- "Bitrate",
+ "Bitrate",
"Bitrate",
0, 2147483647,
0,
G_PARAM_READWRITE));
-
+
g_type_class_add_private (klass, sizeof (ParoleStreamPrivate));
}
@@ -804,9 +804,9 @@ parole_stream_new (void)
void parole_stream_init_properties (ParoleStream *stream)
{
ParoleStreamPrivate *priv;
-
+
priv = PAROLE_STREAM_GET_PRIVATE (stream);
-
+
priv->live = FALSE;
priv->seekable = FALSE;
priv->has_audio = FALSE;
@@ -822,7 +822,7 @@ void parole_stream_init_properties (ParoleStream *stream)
priv->disp_par_n = 1;
priv->disp_par_d = 1;
priv->bitrate = 0;
-
+
PAROLE_STREAM_FREE_STR_PROP (priv->title);
PAROLE_STREAM_FREE_STR_PROP (priv->uri);
PAROLE_STREAM_FREE_STR_PROP (priv->subtitles);
@@ -832,7 +832,7 @@ void parole_stream_init_properties (ParoleStream *stream)
PAROLE_STREAM_FREE_STR_PROP (priv->comment);
PAROLE_STREAM_FREE_STR_PROP (priv->genre);
PAROLE_STREAM_FREE_STR_PROP (priv->image_uri);
-
+
/* Remove the previous image if it exists */
if ( PAROLE_STREAM_GET_PRIVATE (stream)->previous_image )
{
diff --git a/src/parole-clutter.c b/src/parole-clutter.c
index 07813d1..24f2a55 100644
--- a/src/parole-clutter.c
+++ b/src/parole-clutter.c
@@ -1,3 +1,25 @@
+/*
+ * * Copyright (C) 2009-2011 Ali <aliov at xfce.org>
+ * * Copyright (C) 2012-2014 Sean Davis <smd.seandavis at gmail.com>
+ * * Copyright (C) 2012-2014 Simon Steinbeiß <ochosi at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
#include <gtk/gtk.h>
#include <glib.h>
#include <gdk/gdkx.h>
@@ -56,11 +78,27 @@ parole_clutter_finalize (GObject *object)
static void
parole_clutter_show (GtkWidget *widget)
{
- if ( gtk_widget_get_window(widget) )
- gdk_window_show (gtk_widget_get_window(widget));
+ ParoleClutter *clutter = PAROLE_CLUTTER(parole_clutter_get());
+ GtkWidget *embed_window = clutter->priv->embed;
+
+ if ( gtk_widget_get_window(embed_window) )
+ gdk_window_show (gtk_widget_get_window(embed_window));
if ( GTK_WIDGET_CLASS (parole_clutter_parent_class)->show )
- GTK_WIDGET_CLASS (parole_clutter_parent_class)->show (widget);
+ GTK_WIDGET_CLASS (parole_clutter_parent_class)->show (embed_window);
+}
+
+static void
+parole_clutter_hide (GtkWidget *widget)
+{
+ ParoleClutter *clutter = PAROLE_CLUTTER(parole_clutter_get());
+ GtkWidget *embed_window = clutter->priv->embed;
+
+ if ( gtk_widget_get_window(embed_window) )
+ gdk_window_hide (gtk_widget_get_window(embed_window));
+
+ if ( GTK_WIDGET_CLASS (parole_clutter_parent_class)->hide )
+ GTK_WIDGET_CLASS (parole_clutter_parent_class)->hide (embed_window);
}
static void
@@ -262,7 +300,8 @@ parole_clutter_class_init (ParoleClutterClass *klass)
object_class->get_property = parole_clutter_get_property;
widget_class->show = parole_clutter_show;
-
+ widget_class->hide = parole_clutter_hide;
+
g_object_class_install_property (object_class,
PROP_CONF_OBJ,
g_param_spec_pointer ("conf-object",
diff --git a/src/parole-clutter.h b/src/parole-clutter.h
index 30fe92e..2887e64 100644
--- a/src/parole-clutter.h
+++ b/src/parole-clutter.h
@@ -1,3 +1,24 @@
+/*
+ * * Copyright (C) 2009-2011 Ali <aliov at xfce.org>
+ * * Copyright (C) 2012-2014 Sean Davis <smd.seandavis at gmail.com>
+ * * Copyright (C) 2012-2014 Simon Steinbeiß <ochosi at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
#ifndef __PAROLE_CLUTTER_H
#define __PAROLE_CLUTTER_H
diff --git a/src/parole-player.c b/src/parole-player.c
index a151a1c..2be9506 100644
--- a/src/parole-player.c
+++ b/src/parole-player.c
@@ -46,9 +46,6 @@
#include <dbus/dbus-glib.h>
-#include <clutter/clutter.h>
-#include <clutter-gtk/clutter-gtk.h>
-
#include <src/misc/parole-file.h>
#include "parole-builder.h"
@@ -3561,7 +3558,7 @@ parole_player_init (ParolePlayer *player)
video_sink = parole_gst_video_sink (PAROLE_GST(player->priv->gst));
parole_clutter_apply_texture (PAROLE_CLUTTER(player->priv->clutter), &video_sink);
- gtk_widget_show (clutterbox);
+ gtk_widget_show (player->priv->clutter);
}
else
{
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list