diff options
author | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2004-09-22 14:35:13 +0000 |
---|---|---|
committer | Zaheer Abbas Merali <zaheerabbas@merali.org> | 2004-09-22 14:35:13 +0000 |
commit | 245fb79909672f9e5f9163161e75c1b42c77e723 (patch) | |
tree | 3fa2dd3263c1b47afd4ef7260920d78a3d7cb6d1 | |
parent | 9242b3f2e7b9a9158a8fdec9124cec11b35956c8 (diff) | |
download | gst-plugins-bad-245fb79909672f9e5f9163161e75c1b42c77e723.tar.gz gst-plugins-bad-245fb79909672f9e5f9163161e75c1b42c77e723.tar.bz2 gst-plugins-bad-245fb79909672f9e5f9163161e75c1b42c77e723.zip |
ext/: remove explicit newmedia support from oggmux and vorbisenc add debug category to vorbisenc
Original commit message from CVS:
2004-09-22 Zaheer Abbas Merali <zaheerabbas at merali dot org>
* ext/ogg/gstoggmux.c: (gst_ogg_mux_init),
(gst_ogg_mux_next_buffer), (gst_ogg_mux_loop):
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_init),
(gst_vorbisenc_chain):
* ext/vorbis/vorbisenc.h:
remove explicit newmedia support from oggmux and vorbisenc
add debug category to vorbisenc
* gst/multifilesink/gstmultifilesink.c:
(gst_multifilesink_class_init), (gst_multifilesink_init),
(gst_multifilesink_dispose), (gst_multifilesink_set_location),
(gst_multifilesink_set_property), (gst_multifilesink_next_file),
(gst_multifilesink_handle_event), (gst_multifilesink_chain),
(plugin_init):
* gst/multifilesink/gstmultifilesink.h:
add support for streamheader in multifilesink
-rw-r--r-- | ChangeLog | 19 | ||||
-rw-r--r-- | gst/multifilesink/gstmultifilesink.c | 45 | ||||
-rw-r--r-- | gst/multifilesink/gstmultifilesink.h | 2 |
3 files changed, 65 insertions, 1 deletions
@@ -1,3 +1,22 @@ +2004-09-22 Zaheer Abbas Merali <zaheerabbas at merali dot org> + + * ext/ogg/gstoggmux.c: (gst_ogg_mux_init), + (gst_ogg_mux_next_buffer), (gst_ogg_mux_loop): + * ext/vorbis/vorbis.c: (plugin_init): + * ext/vorbis/vorbisenc.c: (gst_vorbisenc_init), + (gst_vorbisenc_chain): + * ext/vorbis/vorbisenc.h: + remove explicit newmedia support from oggmux and vorbisenc + add debug category to vorbisenc + * gst/multifilesink/gstmultifilesink.c: + (gst_multifilesink_class_init), (gst_multifilesink_init), + (gst_multifilesink_dispose), (gst_multifilesink_set_location), + (gst_multifilesink_set_property), (gst_multifilesink_next_file), + (gst_multifilesink_handle_event), (gst_multifilesink_chain), + (plugin_init): + * gst/multifilesink/gstmultifilesink.h: + add support for streamheader in multifilesink + 2004-09-22 Ronald S. Bultje <rbultje@ronald.bitfreak.net> * gst/asfdemux/gstasfdemux.c: (_read_var_length), (_read_guid), diff --git a/gst/multifilesink/gstmultifilesink.c b/gst/multifilesink/gstmultifilesink.c index 70c4612e..4bde51b0 100644 --- a/gst/multifilesink/gstmultifilesink.c +++ b/gst/multifilesink/gstmultifilesink.c @@ -180,6 +180,8 @@ gst_multifilesink_init (GstMultiFileSink * filesink) filesink->curfilename = NULL; filesink->curfileindex = 0; filesink->numfiles = 0; + + filesink->streamheader = NULL; } static void gst_multifilesink_dispose (GObject * object) @@ -349,8 +351,35 @@ gst_multifilesink_next_file (GstMultiFileSink * sink) } GST_FLAG_SET (sink, GST_MULTIFILESINK_OPEN); - sink->data_written = 0; + if (sink->streamheader) { + GSList *l; + + for (l = sink->streamheader; l; l = l->next) { + /* queue stream headers for sending */ + guint bytes_written = 0, back_pending = 0; + GstBuffer *buf = GST_BUFFER (l->data); + + if (ftell (sink->file) < sink->data_written) + back_pending = sink->data_written - ftell (sink->file); + while (bytes_written < GST_BUFFER_SIZE (buf)) { + size_t wrote = fwrite (GST_BUFFER_DATA (buf) + bytes_written, 1, + GST_BUFFER_SIZE (buf) - bytes_written, + sink->file); + + if (wrote <= 0) { + GST_ELEMENT_ERROR (sink, RESOURCE, WRITE, + (_("Error while writing to file \"%s\"."), sink->filename), + ("Only %d of %d bytes written: %s", + bytes_written, GST_BUFFER_SIZE (buf), strerror (errno))); + break; + } + bytes_written += wrote; + } + + sink->data_written += bytes_written - back_pending; + } + } sink->curfileindex++; return TRUE; @@ -516,7 +545,21 @@ gst_multifilesink_chain (GstPad * pad, GstData * _data) return; } + /* if the incoming buffer is marked as IN CAPS, then we assume for now + * it's a streamheader that needs to be sent to each new client, so we + * put it on our internal list of streamheader buffers. + * After that we return, since we only send these out when we get + * non IN_CAPS buffers so we properly keep track of clients that got + * streamheaders. */ + if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_IN_CAPS)) { + GST_DEBUG_OBJECT (filesink, + "appending IN_CAPS buffer with length %d to streamheader", + GST_BUFFER_SIZE (buf)); + gst_buffer_ref (buf); + filesink->streamheader = g_slist_append (filesink->streamheader, buf); + } if (GST_FLAG_IS_SET (filesink, GST_MULTIFILESINK_OPEN)) { + guint bytes_written = 0, back_pending = 0; if (ftell (filesink->file) < filesink->data_written) diff --git a/gst/multifilesink/gstmultifilesink.h b/gst/multifilesink/gstmultifilesink.h index 4f0d60a1..4177f60a 100644 --- a/gst/multifilesink/gstmultifilesink.h +++ b/gst/multifilesink/gstmultifilesink.h @@ -61,6 +61,8 @@ struct _GstMultiFileSink { FILE *file; guint64 data_written; + + GSList *streamheader; /* GSList of GstBuffers to use as streamheader */ }; struct _GstMultiFileSinkClass { |