[gnac/devel] Fixed trac ticket #42: Extract and convert audio from video
- From: Benoît Dupasquier <bdupasqu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnac/devel] Fixed trac ticket #42: Extract and convert audio from video
- Date: Mon, 5 Jul 2010 16:37:09 +0000 (UTC)
commit 239941b7585a986499d6fa4e4720abb8b2d9b3cd
Author: Benoît Dupasquier <bdupasqu src gnome org>
Date: Mon Jul 5 17:36:51 2010 +0100
Fixed trac ticket #42: Extract and convert audio from video
NEWS | 4 ++++
data/gnac.desktop.in.in | 2 +-
libgnac/libgnac-converter.c | 30 +++++++++++++++---------------
libgnac/libgnac-gst-utils.c | 27 +++++++++++++--------------
libgnac/libgnac-gst.c | 8 +++++---
libgnac/libgnac-media-item.c | 1 +
libgnac/libgnac-media-item.h | 1 +
src/gnac-ui.c | 42 ++++++++++++++++++++++++++++++++++++++++++
8 files changed, 82 insertions(+), 33 deletions(-)
---
diff --git a/NEWS b/NEWS
index a0ad53d..e2ce79b 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,10 @@ Gnac -- History of visible changes.
Copyright (C) 2007 - 2010, Gnac
See the end for copying conditions.
+Version 0.2.3
+
+* Extract and convert audio from video
+
Version 0.2.2 (June 2010)
* File chooser specially designed to ease the use of file filters
diff --git a/data/gnac.desktop.in.in b/data/gnac.desktop.in.in
index 82a4447..496bd0d 100644
--- a/data/gnac.desktop.in.in
+++ b/data/gnac.desktop.in.in
@@ -4,7 +4,7 @@ GenericName=Gnac
_Comment=An audio converter for GNOME
Exec=gnac %F
Icon=gnac
-MimeType=application/ogg;application/xspf+xml;audio/mpeg;audio/mp4;audio/x-flac;audio/x-mpegurl;audio/x-musepack;audio/x-scpls;audio/vnd.rn-realaudio;audio/x-speex;audio/x-wav;audio/x-wma;
+MimeType=audio/mpeg;audio/mp4;audio/x-musepack;audio/ogg;audio/vnd.rn-realaudio;audio/x-speex;audio/x-ms-wma;audio/x-flac;audio/x-wav;audio/x-wavpack;audio/x-mpegurl;audio/x-scpls;application/xspf+xml;video/x-ms-asf;video/x-msvideo;video/x-flv;video/x-matroska;video/mpeg;video/mp4;video/ogg;video/quicktime;video/x-ms-wmv;
StartupNotify=true
Terminal=false
Type=Application
diff --git a/libgnac/libgnac-converter.c b/libgnac/libgnac-converter.c
index 0e9d164..c3512b7 100644
--- a/libgnac/libgnac-converter.c
+++ b/libgnac/libgnac-converter.c
@@ -74,22 +74,22 @@ static guint signals[LAST_SIGNAL] = { 0 };
struct LibgnacConverterPrivate
{
- GHashTable *file_table;
- GQueue *queue;
- GQueue *queue_copy;
- //GHashTableIter iter;
- LibgnacMediaItem *current;
- gint n_converted;
- guint64 elapsed_duration;
- guint64 total_duration;
-
- gboolean strip_special;
- LibgnacProfile *profile;
- gchar *rename_pattern;
- gint folder_type;
- gchar *folder_hierarchy;
- gchar *folder_path;
- gchar *extension;
+ GHashTable *file_table;
+ GQueue *queue;
+ GQueue *queue_copy;
+ //GHashTableIter iter;
+ LibgnacMediaItem *current;
+ gint n_converted;
+ guint64 elapsed_duration;
+ guint64 total_duration;
+
+ gboolean strip_special;
+ LibgnacProfile *profile;
+ gchar *rename_pattern;
+ gint folder_type;
+ gchar *folder_hierarchy;
+ gchar *folder_path;
+ gchar *extension;
};
G_DEFINE_TYPE(LibgnacConverter, libgnac_converter, G_TYPE_OBJECT);
diff --git a/libgnac/libgnac-gst-utils.c b/libgnac/libgnac-gst-utils.c
index 8141d42..ce4e020 100644
--- a/libgnac/libgnac-gst-utils.c
+++ b/libgnac/libgnac-gst-utils.c
@@ -36,9 +36,9 @@
GstElement *
libgnac_gstu_make_pipeline_element(GstElement *bin,
- const gchar *element,
- const gchar *name,
- GError **error)
+ const gchar *element,
+ const gchar *name,
+ GError **error)
{
GstElement *elem;
@@ -87,8 +87,8 @@ libgnac_gstu_pipeline_new(GError **error)
gboolean
libgnac_gstu_bin_add(GstElement *bin,
- GstElement *elem,
- GError **error)
+ GstElement *elem,
+ GError **error)
{
gchar *name;
@@ -110,8 +110,8 @@ libgnac_gstu_bin_add(GstElement *bin,
gboolean
libgnac_gstu_element_link(GstElement *src,
- GstElement *dst,
- GError **error)
+ GstElement *dst,
+ GError **error)
{
gboolean ret;
ret = gst_element_link(src, dst);
@@ -131,8 +131,8 @@ libgnac_gstu_element_link(GstElement *src,
GstPadLinkReturn
libgnac_gstu_pad_link(GstPad *src,
- GstPad *sink,
- GError **error)
+ GstPad *sink,
+ GError **error)
{
GstPadLinkReturn ret;
ret = gst_pad_link(src, sink);
@@ -151,10 +151,10 @@ libgnac_gstu_pad_link(GstPad *src,
gboolean
-libgnac_gstu_get_compatible_pad(GstElement *element,
- GstPad *pad,
- GstCaps *caps,
- const gchar *type)
+libgnac_gstu_get_compatible_pad(GstElement *element,
+ GstPad *pad,
+ GstCaps *caps,
+ const gchar *type)
{
GstPad *sink_pad;
sink_pad = gst_element_get_compatible_pad(element, pad, caps);
@@ -184,4 +184,3 @@ libgnac_gstu_get_compatible_pad(GstElement *element,
return TRUE;
}
-
diff --git a/libgnac/libgnac-gst.c b/libgnac/libgnac-gst.c
index 4c695e8..2a1f2c8 100644
--- a/libgnac/libgnac-gst.c
+++ b/libgnac/libgnac-gst.c
@@ -203,7 +203,7 @@ void
libgnac_gst_build_pipeline(LibgnacMediaItem *item,
LibgnacProfile *profile,
gboolean has_video,
- GError **error)
+ GError **error)
{
gboolean linked;
GError *encoder_error = NULL;
@@ -275,7 +275,7 @@ libgnac_gst_build_pipeline(LibgnacMediaItem *item,
}
g_object_set(G_OBJECT(sink), "file", item->destination, NULL);
- if (has_video)
+ if (has_video && item->video_channel != -1)
{
GstElement *audio_queue;
GstElement *mux;
@@ -418,7 +418,9 @@ libgnac_gst_newpad_cb(GstElement *decodebin,
{
return;
}
- } else if (g_str_has_prefix(mimetype, "video/")) {
+ } else if (g_str_has_prefix(mimetype, "video/")
+ && item->video_channel != -1)
+ {
if (!libgnac_gstu_get_compatible_pad(item->video_encoder, pad,
caps, "video"))
{
diff --git a/libgnac/libgnac-media-item.c b/libgnac/libgnac-media-item.c
index 81fabb4..ee6239d 100644
--- a/libgnac/libgnac-media-item.c
+++ b/libgnac/libgnac-media-item.c
@@ -55,6 +55,7 @@ libgnac_item_new(GFile *source,
item->pipeline = NULL;
item->audio_encoder = NULL;
item->bus = NULL;
+ item->video_channel = -1;
item->timeout_id = 0;
item->pos = 0;
diff --git a/libgnac/libgnac-media-item.h b/libgnac/libgnac-media-item.h
index 4769612..7dba75e 100644
--- a/libgnac/libgnac-media-item.h
+++ b/libgnac/libgnac-media-item.h
@@ -47,6 +47,7 @@ typedef struct
GstElement *muxer;
GstElement *video_encoder;
GstBus *bus;
+ gint video_channel;
guint timeout_id;
gint64 pos;
} LibgnacMediaItem;
diff --git a/src/gnac-ui.c b/src/gnac-ui.c
index 5194ee2..4f95328 100644
--- a/src/gnac-ui.c
+++ b/src/gnac-ui.c
@@ -174,6 +174,19 @@ gnac_ui_file_chooser_get_filters_model(void)
{ NULL, NULL }
};
+ const gchar *video_mime[][2] = {
+ { "video/x-ms-asf" , _("ASF video") },
+ { "video/x-msvideo" , _("AVI video") },
+ { "video/x-flv" , _("Flash video") },
+ { "video/x-matroska", _("Matroska video") },
+ { "video/mpeg" , _("MPEG video") },
+ { "video/mp4" , _("MPEG-4 video") },
+ { "video/ogg" , _("Ogg video") },
+ { "video/quicktime" , _("QuickTime video") },
+ { "video/x-ms-wmv" , _("Windows Media video") },
+ { NULL, NULL }
+ };
+
filters = NULL;
store = gtk_tree_store_new(1, G_TYPE_POINTER);
@@ -203,6 +216,11 @@ gnac_ui_file_chooser_get_filters_model(void)
gtk_file_filter_add_mime_type(filter, playlists_mime[i][0]);
i++;
}
+ i = 0;
+ while (video_mime[i][0]) {
+ gtk_file_filter_add_mime_type(filter, video_mime[i][0]);
+ i++;
+ }
gtk_tree_store_append(store, &iter1, NULL);
gtk_tree_store_set(store, &iter1, 0, filter, -1);
filters = g_slist_append(filters, (gpointer)filter);
@@ -302,6 +320,30 @@ gnac_ui_file_chooser_get_filters_model(void)
i++;
}
+ /* Video files */
+ filter = gtk_file_filter_new();
+ gtk_file_filter_set_name(filter, _("Video files"));
+ i = 0;
+ while (video_mime[i][0]) {
+ gtk_file_filter_add_mime_type(filter, video_mime[i][0]);
+ i++;
+ }
+ gtk_tree_store_append(store, &iter1, NULL);
+ gtk_tree_store_set(store, &iter1, 0, filter, -1);
+ filters = g_slist_append(filters, (gpointer)filter);
+
+ /* Individual video files */
+ i = 0;
+ while (video_mime[i][0]) {
+ filter = gtk_file_filter_new();
+ gtk_file_filter_add_mime_type(filter, video_mime[i][0]);
+ gtk_file_filter_set_name(filter, video_mime[i][1]);
+ gtk_tree_store_append(store, &iter2, &iter1);
+ gtk_tree_store_set(store, &iter2, 0, filter, -1);
+ filters = g_slist_append(filters, (gpointer)filter);
+ i++;
+ }
+
for (f = filters; f; f = f->next) {
g_object_ref(G_OBJECT(f->data));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]