GNOME Bugzilla – Bug 578908
[fdsink] implement seeking on seekable fds
Last modified: 2009-06-18 08:56:48 UTC
I find that fdsink doesn't support GST_EVENT_NEWSEGMENT event. So that fdsink don't work normally after push one gstbuffer(we specify gstbuffer->offset) to fdsink.
The plugin filesink can compute new offset by call gst_file_sink_do_seek after received one GST_EVENT_NEWSEGMENT event. Why does fdsink do like filesink ?
because fdsink is not supposed to be used with seekable file descriptors. It can be changed, though.
(In reply to comment #2) > because fdsink is not supposed to be used with seekable file descriptors. It > can be changed, though. > Hi Wim, I don't know why fdsink is not supposed to be used with seekable file descriptors. Can you explain it ? And I think that we frequently need use fdsink by seekable file descriptors. For example: alsasrc ! 'audio/x-raw-int, rate=(int)8000, channels=(int)1, endianness=(int)1234, width=(int)16, depth=(int)16, signed=(boolean)true' ! wavenc ! fdsink fd=xx The plugin wavenc will use the last buffer to update the file header of wav. If fdsink don't support seekable file descriptors, the wav will have one wrong header in this pipeline. Thanks, lei.wang
> I don't know why fdsink is not supposed to be used with seekable file > descriptors. > Can you explain it ? Because the author of the element did not implement this feature. Possibly because the use case was to only use fdsink on sockets or pipes, not on seekable files. Possibly because filesink existed for dealing with files...
(In reply to comment #4) > > I don't know why fdsink is not supposed to be used with seekable file > > descriptors. > > Can you explain it ? > > Because the author of the element did not implement this feature. Possibly > because the use case was to only use fdsink on sockets or pipes, not on > seekable files. Possibly because filesink existed for dealing with files... > Hi Wim, I think that seekable file descriptors is important feature.And it is impossible that forbid user to use fdsink as one seekable file descriptors. The gstreamer core include fdsink, but it lack this feature. Do you plan to implement this feature? schedule? Thanks, lei.wang
> Do you plan to implement this feature? schedule? I have no plans or schedule for this feature. patches are welcome.
Created attachment 136842 [details] [review] patch to make fdsink seekable
To test the patch I have replace all g_print in gst-launch.c by PRINT macro. So I can test seek with fdsink with this command: gst-launch -q videotestsrc num-buffers=10 ! ffenc_h263 ! gppmux ! fdsink fd=1 > test_fdsink.3gp I use gppmux because it make a seek at the end of encoding to write 3gp header at beginning of the file.
commit 1a6f82f4b01c4f71baf9416c6544426c432dbb9b Author: Benjamin Gaignard <benjamin at gaignard.net> Date: Thu Jun 18 10:55:39 2009 +0200 fdsink: make fdsink seekable Implement the same logic as filesink to implement seeking. Fixes #578908