After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 719373 - Add multifilesrc support to GES
Add multifilesrc support to GES
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-editing-services
git master
Other All
: Normal enhancement
: 1.3.90
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks: 415360
 
 
Reported: 2013-11-26 18:01 UTC by Lubosz Sarnecki
Modified: 2014-09-23 09:17 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch that provides multifile support (20.16 KB, patch)
2013-11-26 18:01 UTC, Lubosz Sarnecki
none Details | Review
new patch after review (22.62 KB, patch)
2013-12-01 23:44 UTC, Lubosz Sarnecki
none Details | Review
new patch after review 2 (22.60 KB, patch)
2013-12-01 23:56 UTC, Lubosz Sarnecki
reviewed Details | Review
new patch with unrefd caps (22.63 KB, patch)
2013-12-02 18:11 UTC, Lubosz Sarnecki
accepted-commit_now Details | Review

Description Lubosz Sarnecki 2013-11-26 18:01:03 UTC
Created attachment 262889 [details] [review]
Patch that provides multifile support

* Add GESMultiFileSource class
* Add multifilesrc example
* Support multifile:// urls in uri asset
Comment 1 Mathieu Duponchelle 2013-11-26 18:22:16 UTC
Review of attachment 262889 [details] [review]:

That's awesome !

I only have 2-3 little nitpicks around but it really looks nice.
A general remark would be that some tests would be very welcome :)

Can't wait to be able to use that in pitivi !

::: ges/ges-multi-file-source.c
@@ +1,2 @@
+/* GStreamer Editing Services
+ * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>

Copyright lubosz sarnecki :)

@@ +133,3 @@
+  if (asset != NULL) {
+    stream_info = ges_uri_source_asset_get_stream_info (asset);
+    disc_caps = gst_discoverer_stream_info_get_caps (stream_info);

You need to unref them after usage.

::: ges/ges-uri-asset.c
@@ -470,3 +471,4 @@
       "extractable-type", GES_TYPE_URI_CLIP, NULL);
   discoverer = GES_URI_CLIP_ASSET_GET_CLASS (asset)->sync_discoverer;
-  info = gst_discoverer_discover_uri (discoverer, uri, &lerror);
+
+  if (g_str_has_prefix (uri, "multifile://")) {

It would be extra nice to document that new protocol somewhere :)

@@ -471,2 +472,4 @@
   discoverer = GES_URI_CLIP_ASSET_GET_CLASS (asset)->sync_discoverer;
-  info = gst_discoverer_discover_uri (discoverer, uri, &lerror);
+
+  if (g_str_has_prefix (uri, "multifile://")) {
+    first_file = g_strdup_printf (&uri[12], 1);

I know the name is just above but it might be better to strlen "multifile://" and have a define somewhere for that string so that we can change it easily, really a minor nitpick though.

@@ -472,1 +473,4 @@
-  info = gst_discoverer_discover_uri (discoverer, uri, &lerror);
+
+  if (g_str_has_prefix (uri, "multifile://")) {
+    first_file = g_strdup_printf (&uri[12], 1);
+    first_file_uri = gst_filename_to_uri (first_file, &lerror);

Shouldn't you free that ?
Comment 2 Nicolas Dufresne (ndufresne) 2013-11-26 18:43:42 UTC
(In reply to comment #1)
> @@ -472,1 +473,4 @@
> -  info = gst_discoverer_discover_uri (discoverer, uri, &lerror);
> +
> +  if (g_str_has_prefix (uri, "multifile://")) {
> +    first_file = g_strdup_printf (&uri[12], 1);
> +    first_file_uri = gst_filename_to_uri (first_file, &lerror);

my nit pick would be tahat instead of using g_strdup_printf, you can simply set

  first_file = uri + 12

This way you save an allocation, still need to free the URI as Mathieu said ;-P
Comment 3 Thibault Saunier 2013-11-26 18:59:50 UTC
Review of attachment 262889 [details] [review]:

::: ges/ges-multi-file-source.c
@@ +1,3 @@
+/* GStreamer Editing Services
+ * Copyright (C) 2009 Edward Hervey <edward.hervey@collabora.co.uk>
+ *               2009 Nokia Corporation

2013

::: ges/ges-uri-asset.c
@@ +473,3 @@
+
+  if (g_str_has_prefix (uri, "multifile://")) {
+    first_file = g_strdup_printf (&uri[12], 1);

Not sure we want 1 rather than 0, and I feel we should actually give the possibility to the user to set the first index, one way or another, it might need to be in the ID itself. we might actually be able to extract the pattern from the first ID?
Comment 4 Lubosz Sarnecki 2013-11-27 04:00:57 UTC
@Mathieu:

Where should I document this uri? In the doc of UriClipAsset?

@Nicolas:

I need g_strdup_printf for making 0001.jpg out of a strings like %04d.jpg.
I guess uri + 12 is the same as uri[12].

@Thibault:

multifilesrc has start-index and stop-index.
Where should the ability to set this be implemented?
I chose 1 because there might be a possibility that there is no frame 0 and I need the frame only for discovery. So it should be there.
Comment 5 Thibault Saunier 2013-11-27 12:33:02 UTC
(In reply to comment #4)
> @Thibault:
> 
> multifilesrc has start-index and stop-index.
> Where should the ability to set this be implemented?
> I chose 1 because there might be a possibility that there is no frame 0 and I
> need the frame only for discovery. So it should be there.

We might set the ID in the form of:

  multifile://startindex:stopindex@pattern

if no startindex:stopindex is specified then it should 0, -1.
Comment 6 Mathieu Duponchelle 2013-11-27 12:57:58 UTC
@Mathieu:

Where should I document this uri? In the doc of UriClipAsset?

I would think there yes, seems like the place where I'd like to get this information if I were a user.
Comment 7 Lubosz Sarnecki 2013-12-01 23:44:42 UTC
Created attachment 263263 [details] [review]
new patch after review
Comment 8 Lubosz Sarnecki 2013-12-01 23:56:38 UTC
Created attachment 263264 [details] [review]
new patch after review 2

sorry i just saw i forgot to change stuff in uri clip
Comment 9 Mathieu Duponchelle 2013-12-02 11:23:39 UTC
Review of attachment 263264 [details] [review]:

Apart from my last comment, I think we're good to go :)

::: ges/ges-multi-file-source.c
@@ +181,3 @@
+    stream_info = ges_uri_source_asset_get_stream_info (asset);
+    g_assert (stream_info);
+    disc_caps = gst_discoverer_stream_info_get_caps (stream_info);

You still need to unref these caps, as you copy them after, the doc of stream_info_get_caps says "unref after usage". Alternatively, you might also just do :
caps = gst_discoverer_stream_info_get_caps (stream_info); I think :)
Comment 10 Lubosz Sarnecki 2013-12-02 13:34:33 UTC
@Mathieu:

disc_caps is gone after I unref stream_info. I get following warning when I gst_object_unref (disc_caps):

(lt-multifilesrc:15203): GLib-GObject-CRITICAL **: g_object_unref: assertion 'G_IS_OBJECT (object)' failed


I can't use:
caps = gst_discoverer_stream_info_get_caps (stream_info);

Because I need to write to the caps. This way they are read only. I need to copy them.
Comment 11 Nicolas Dufresne (ndufresne) 2013-12-02 16:22:33 UTC
(In reply to comment #10)
> @Mathieu:
> 
> disc_caps is gone after I unref stream_info. I get following warning when I
> gst_object_unref (disc_caps):
> 

gst_caps_unref(), GstCaps are GstMinObject, not GObject ;-P
Comment 12 Lubosz Sarnecki 2013-12-02 18:11:09 UTC
Created attachment 263320 [details] [review]
new patch with unrefd caps
Comment 13 Mathieu Duponchelle 2013-12-04 18:43:27 UTC
Review of attachment 263320 [details] [review]:

Everything good for me
Comment 14 Thibault Saunier 2014-03-21 17:57:06 UTC
commit 46c65aaaafbe7ea96602d3a54327e5dc1ad748e8
Author: Lubosz Sarnecki <lubosz@gmail.com>
Date:   Tue Nov 12 12:13:31 2013 +0100

    ges: multifilesrc support
    
    * GESMultiFileSource class
    * multifilesrc example
    * Support multifile:// urls in uri asset
    * start/stop index modification
    * Doc
    
    https://bugzilla.gnome.org/show_bug.cgi?id=719373