marlin r1307 - trunk/marlin
- From: iain svn gnome org
- To: svn-commits-list gnome org
- Subject: marlin r1307 - trunk/marlin
- Date: Sat, 11 Oct 2008 14:02:44 +0000 (UTC)
Author: iain
Date: Sat Oct 11 14:02:43 2008
New Revision: 1307
URL: http://svn.gnome.org/viewvc/marlin?rev=1307&view=rev
Log:
Show preview if file isn't a dir
Don't use gnome-vfs
Modified:
trunk/marlin/ChangeLog
trunk/marlin/marlin-channel-sink.c
trunk/marlin/marlin-file-chooser.c
trunk/marlin/marlin-gst-extras.c
trunk/marlin/marlin-gst-extras.h
trunk/marlin/marlin-load-pipeline.c
Modified: trunk/marlin/marlin-channel-sink.c
==============================================================================
--- trunk/marlin/marlin-channel-sink.c (original)
+++ trunk/marlin/marlin-channel-sink.c Sat Oct 11 14:02:43 2008
@@ -2,7 +2,7 @@
/*
* Authors: Iain Holmes <iain gnome org>
*
- * Copyright 2002-2006 Iain Holmes
+ * Copyright 2002-2008 Iain Holmes
*
* This file is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU Library General Public
@@ -28,8 +28,6 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
#include <gst/audio/multichannel.h>
@@ -270,8 +268,8 @@
((sink->frame_count / 128) * (sizeof (float) * 4));
bytes_have = sink->no_space_frames * sizeof (float);
- need = gnome_vfs_format_file_size_for_display (bytes_needed);
- have = gnome_vfs_format_file_size_for_display (bytes_have);
+ need = g_format_size_for_display (bytes_needed);
+ have = g_format_size_for_display (bytes_have);
GST_ELEMENT_ERROR (GST_ELEMENT (sink), RESOURCE, WRITE,
("Marlin ran out of temporary space.\n%s of free space is needed on '%s' but only %s is available", need,
Modified: trunk/marlin/marlin-file-chooser.c
==============================================================================
--- trunk/marlin/marlin-file-chooser.c (original)
+++ trunk/marlin/marlin-file-chooser.c Sat Oct 11 14:02:43 2008
@@ -30,12 +30,10 @@
#include <gtk/gtkvbox.h>
#include <gtk/gtklabel.h>
-#include <libgnomevfs/gnome-vfs-mime-utils.h>
-#include <libgnomevfs/gnome-vfs-mime-handlers.h>
-
#include <gst/gst.h>
#include <marlin/marlin-stock.h>
+#include <marlin/marlin-gst-extras.h>
#include <marlin/marlin-file-chooser.h>
#include <marlin/marlin-x-utils.h>
#include <marlin/marlin-utils.h>
@@ -43,7 +41,7 @@
struct _ChooserOpenData {
GtkWidget *chooser;
-
+
GtkWidget *options_frame;
GtkWidget *info_frame;
@@ -53,7 +51,7 @@
GtkWidget *name;
GtkWidget *channels;
GtkWidget *mimetype;
-
+
/* Transport controls */
GtkWidget *play;
GtkWidget *stop;
@@ -61,7 +59,7 @@
/* Filesel hooks */
GtkTreeSelection *selection;
guint32 change_id;
-
+
/* Preview */
GstElement *player;
GstElement *md_pipeline;
@@ -111,7 +109,7 @@
char *string;
builder = g_string_new ("");
-
+
count = gst_tag_list_get_tag_size (tags, tag);
if (count == 0) {
g_string_free (builder, TRUE);
@@ -126,7 +124,7 @@
}
if (gst_tag_get_type (tag) == G_TYPE_STRING) {
- if (gst_tag_list_get_string_index (tags, tag,
+ if (gst_tag_list_get_string_index (tags, tag,
i, &str)) {
g_string_append (builder, str);
g_free (str);
@@ -144,7 +142,7 @@
return string;
}
-
+
static void
set_info (struct _ChooserOpenData *od,
GstTagList *tags)
@@ -155,7 +153,7 @@
if (str) {
char *title;
- title = g_strdup_printf ("<span weight=\"bold\">%s</span>",
+ title = g_strdup_printf ("<span weight=\"bold\">%s</span>",
str);
g_free (str);
gtk_label_set_markup (GTK_LABEL (od->name), title);
@@ -167,7 +165,7 @@
filename = g_path_get_basename (fullpath);
g_free (fullpath);
- title = g_strdup_printf ("<span weight=\"bold\">%s</span>",
+ title = g_strdup_printf ("<span weight=\"bold\">%s</span>",
filename);
g_free (filename);
gtk_label_set_markup (GTK_LABEL (od->name), title);
@@ -182,7 +180,7 @@
{
struct _ChooserOpenData *od = data;
GstTagList *tags;
-
+
switch (GST_MESSAGE_TYPE (message)) {
case GST_MESSAGE_EOS:
clear_info (od);
@@ -226,7 +224,7 @@
type = gst_caps_to_string (caps);
- name = gnome_vfs_mime_get_description (type);
+ name = g_content_type_get_description (type);
if (name) {
gtk_label_set_text (GTK_LABEL (od->mimetype), name);
} else {
@@ -244,7 +242,7 @@
od->decode_pad = pad;
}
-static void
+static void
get_stream_info (struct _ChooserOpenData *od)
{
GstCaps *caps;
@@ -254,7 +252,7 @@
if (od->decode_pad == NULL) {
return;
- }
+ }
caps = gst_pad_get_caps (od->decode_pad);
st = gst_caps_get_structure (caps, 0);
@@ -300,7 +298,7 @@
gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (od->md_pipeline)),
md_message_cb, od);
- source = gst_element_factory_make ("gnomevfssrc", "source");
+ source = marlin_make_gst_source ("source");
decodebin = gst_element_factory_make ("decodebin", "decodebin");
g_signal_connect (G_OBJECT (decodebin), "unknown-type",
G_CALLBACK (unknown_type_cb), od);
@@ -314,19 +312,19 @@
gst_bin_add_many (GST_BIN (od->md_pipeline), source, decodebin, NULL);
gst_element_link (source, decodebin);
-
+
g_object_set (G_OBJECT (source),
"location", filename,
NULL);
-
+
sret = gst_element_set_state (od->md_pipeline, GST_STATE_PAUSED);
-
+
if (sret == GST_STATE_CHANGE_ASYNC) {
if (gst_element_get_state (od->md_pipeline, &state, NULL,
5 * GST_SECOND) != GST_STATE_CHANGE_SUCCESS) {
clear_info (od);
} else {
- /* Need to wait til the state has gone to PAUSED
+ /* Need to wait til the state has gone to PAUSED
before we get the stream info */
get_stream_info (od);
}
@@ -355,10 +353,12 @@
}
if (filename != NULL) {
+ gtk_file_chooser_set_preview_widget_active (GTK_FILE_CHOOSER (od->chooser), TRUE);
gtk_widget_set_sensitive (od->play, TRUE);
get_metadata (od, filename);
g_free (filename);
} else {
+ gtk_file_chooser_set_preview_widget_active (GTK_FILE_CHOOSER (od->chooser), FALSE);
gtk_widget_set_sensitive (od->play, FALSE);
clear_info (od);
}
@@ -396,10 +396,10 @@
g_object_unref (G_OBJECT (od->player));
od->player = NULL;
}
-
+
/* Build it up */
uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (od->chooser));
-
+
od->player = gst_element_factory_make ("playbin", "player");
gst_bus_add_watch (gst_pipeline_get_bus (GST_PIPELINE (od->player)),
bus_message_cb, od);
Modified: trunk/marlin/marlin-gst-extras.c
==============================================================================
--- trunk/marlin/marlin-gst-extras.c (original)
+++ trunk/marlin/marlin-gst-extras.c Sat Oct 11 14:02:43 2008
@@ -470,6 +470,24 @@
return FALSE;
}
+GstElement *
+marlin_make_gst_source (const char *name)
+{
+ char *srcs[] = { "giosrc", "gnomevfssrc", "filesrc", NULL };
+ int i;
+
+ for (i = 0; srcs[i]; i++) {
+ GstElement *src;
+
+ src = gst_element_factory_make (srcs[i], name);
+ if (src) {
+ return src;
+ }
+ }
+
+ return NULL;
+}
+
static void
register_element (GstPlugin *plugin,
const char *name,
Modified: trunk/marlin/marlin-gst-extras.h
==============================================================================
--- trunk/marlin/marlin-gst-extras.h (original)
+++ trunk/marlin/marlin-gst-extras.h Sat Oct 11 14:02:43 2008
@@ -37,6 +37,7 @@
int get_int_from_caps (GstCaps *caps,
const char *key);
gboolean marlin_gst_can_encode (const char *mimetype);
+GstElement *marlin_make_gst_source (const char *name);
GList *get_mime_types (void);
Modified: trunk/marlin/marlin-load-pipeline.c
==============================================================================
--- trunk/marlin/marlin-load-pipeline.c (original)
+++ trunk/marlin/marlin-load-pipeline.c Sat Oct 11 14:02:43 2008
@@ -31,6 +31,7 @@
#include <gst/gst.h>
#include <marlin-load-pipeline.h>
+#include <marlin-gst-extras.h>
#include <marlin-sample.h>
enum {
@@ -491,24 +492,6 @@
return TRUE;
}
-static GstElement *
-make_source (void)
-{
- char *srcs[] = { "giosrc", "gnomevfssrc", "filesrc", NULL };
- int i;
-
- for (i = 0; srcs[i]; i++) {
- GstElement *src;
-
- src = gst_element_factory_make (srcs[i], "src");
- if (src) {
- return src;
- }
- }
-
- return NULL;
-}
-
static void
marlin_load_pipeline_init (MarlinLoadPipeline *pipeline)
{
@@ -520,7 +503,7 @@
priv->sinks = g_ptr_array_new ();
- priv->src = make_source();
+ priv->src = marlin_make_gst_source ("src");
if (priv->src == NULL) {
g_warning ("No source available for load pipeline.");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]