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 594663 - Patch for multifilesink
Patch for multifilesink
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.16
Other Linux
: Normal normal
: 0.10.17
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-09-09 16:18 UTC by anthony
Modified: 2009-09-14 03:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
patch for multifilesink (2.92 KB, patch)
2009-09-09 16:18 UTC, anthony
rejected Details | Review
New patch multifilesink (3.94 KB, patch)
2009-09-10 12:35 UTC, anthony
rejected Details | Review

Description anthony 2009-09-09 16:18:20 UTC
Created attachment 142804 [details] [review]
patch for multifilesink

Adding features such as showing message (path of each file is saving and the
timestamp of buffer)
Comment 1 Sebastian Dröge (slomo) 2009-09-09 16:42:09 UTC
What would be a use case for this?
Comment 2 Wim Taymans 2009-09-09 16:50:14 UTC
Some comments:
 
 - Make the message name something more unique like "GstMultiFilesink" instead
   of "Info".
 - The message fields should be lowercase.
 - The timestamp of the buffer does not mean much without the preceeding
   newsegment. Better add  stream-time, running-time, duration (see also
   -good/gst/spectrum/gstspectrum.c)
 - use GST_TYPE_CLOCK_TIME for the timestamp values (not string)
 - You probably also want the buffer offsets because most file data is byte
   based.
Comment 3 anthony 2009-09-09 17:49:49 UTC
I needed to keep timestamp information for saving jpeg files, to pass it to another software module in real time.
Comment 4 Sebastian Dröge (slomo) 2009-09-10 06:04:42 UTC
Ok, update the patch to what Wim said and it can be included I guess :)
Comment 5 anthony 2009-09-10 09:59:36 UTC
I don't understand what is the buffer offsets can i have more explanation?
Comment 6 Wim Taymans 2009-09-10 10:04:41 UTC
it's GST_BUFFER_OFFSET().

Also passing around jpeg files using multifdsink and posting the metadata as messages and all this in real-time sounds like a crack idea.
Comment 7 anthony 2009-09-10 12:35:52 UTC
Created attachment 142910 [details] [review]
New patch multifilesink

This is the new patch for multifilesink to show message for each saving file and the comment of Wim Taymans that are respected normally. :)
Comment 8 Tim-Philipp Müller 2009-09-10 12:46:48 UTC
Any reason you are not using appsink or fakesink and doing the file writing yourself?
Comment 9 anthony 2009-09-10 13:02:08 UTC
yes i have reason because i think that multifilesink is more high-performance than saving file myself (and threading using queues is so easy).

Moreover, the application is in python, which has terrible performance with fakesink and appsink cannot be used (AFAIK).
Comment 10 Tim-Philipp Müller 2009-09-10 14:04:31 UTC
I don't know if your performance worries are warranted or not, but it doesn't sound like you've even tried. Appsink works fine with python as far as I know, it's just that the convenience library isn't wrapped (or is it now?), but you should still be able to use the methods via emitting GObject signals.

IMHO this looks all highly cracktastic/WONTFIXy to me and should be achieved differently, for example by writing a minimal passthrough element that goes before the sink and posts those messages (or by using identity+handoff or pad probes or whatever).

Casting GstMultiFileSink to GstBaseTransform also doesn't look entirely right btw, so I find it hard to believe that the patch even works right.
Comment 11 anthony 2009-09-10 14:44:17 UTC
Ok for the casting GstMultiFileSink to GstBaseTransform is not good, i will find a solution to get stream-time and running-time.
However i need multifilesink with the message to get path and name of file is saving.
Comment 12 Sebastian Dröge (slomo) 2009-09-11 05:43:21 UTC
I agree with Tim, this is not the solution for your problem. The solutions that Tim mentioned in comment #10 are better and will actually work reliable.

Also note that messages are asynchronous (usually).

I'm closing this as WONTFIX now.
Comment 13 Florent Thiéry 2009-09-11 09:14:05 UTC
The goal here is to keep some list of jpeg files with an associated timestamp. jpegenc provides a "frame-encoded" signal, but again, no way to get the final location on the local disk.

Problem with a passtrough element is that how is it supposed to "know" the path that the following multifilesink will use for storing the data ? It would need to mimic multifilesink's path incrementation and assume that all parameters will be default.

Other options could be:
* to embed the timestamping using EXIF, e.g. using metadatamux
* to use the file creation time (but it might be linked to disk flushing times, ...)

Do you see other alternatives ?
Comment 14 Wim Taymans 2009-09-11 09:19:59 UTC
Regardless of this particular use case, I think it makes sense to emit a message when multifilesink has written a file.

I'll commit a patch.
Comment 15 Tim-Philipp Müller 2009-09-11 09:30:35 UTC
> Do you see other alternatives ?

You could implement GST_QUERY_URI for multifilesink.
Comment 16 Florent Thiéry 2009-09-11 09:44:50 UTC
Thanks wim.

@Tim: just to understand, the software would then need to poll multifilesink for it's current URI every 500ms or so, and the moment the URI query result has changed could be used as timestamping reference ?
Comment 17 Tim-Philipp Müller 2009-09-11 10:02:10 UTC
It (an element before the sink) could do the query whenever a buffer comes through just before or after it would be pushed to the sink.

However, if Wim is going to make multifilesink post a message, it will probably have the name anyway, and any info it doesn't have you could add in a sync message handler if needed, so better wait for Wim's fix.
Comment 18 Wim Taymans 2009-09-11 10:18:30 UTC
commit f68cd7e7080a9221cae97d29289e6b8bb12f5fbc
Author: Wim Taymans <wim.taymans@collabora.co.uk>
Date:   Fri Sep 11 12:16:18 2009 +0200

    multifilesink: post messages for each buffer
    
    Add a silent property that can be set to FALSE to post messages on the bus for
    each written file.
    Do some more cleanups.
    Add some docs.
    
    Fixes #594663
Comment 19 David Schleef 2009-09-14 03:09:28 UTC
On a related note, I just added a property new-file for when a new file should be created.  This makes the posted message more ambiguous -- should it still be for every buffer, or for each file?  Should it be sent when the file is opened, or closed?  I assume that "each file" and "closed" is the behavior that makes the most sense.