diff options
author | Benjamin Otte <otte@gnome.org> | 2003-04-26 01:55:53 +0000 |
---|---|---|
committer | Benjamin Otte <otte@gnome.org> | 2003-04-26 01:55:53 +0000 |
commit | 4f40d61f7cb0f12b31117218d73cd07986a1ec94 (patch) | |
tree | 1ff433cf6913e66ec5c301dc15cfa77456a654f0 | |
parent | 422fd7c1f307d330eeaf2c920a59ba38f2024d8a (diff) |
fixes:
Original commit message from CVS:
fixes:
- wrong type of 0
- only write data into buffer if buffer is big enough
- write data into a buffer which we actually may write
-rw-r--r-- | ext/flac/gstflacenc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index fec7d609..02668762 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -402,16 +402,17 @@ gst_flacenc_metadata_callback (const FLAC__StreamEncoder *encoder, if (flacenc->stopped) return; - event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, 0, NULL); + event = gst_event_new_discontinuous (FALSE, GST_FORMAT_BYTES, (gint64) 0, GST_FORMAT_UNDEFINED); gst_pad_push (flacenc->srcpad, GST_BUFFER (event)); - if (flacenc->first_buf) { + /* FIXME: the first buffer seems to be 4 bytes only, so this'll never be true */ + if (flacenc->first_buf && GST_BUFFER_SIZE (flacenc->first_buf) >= 42) { const FLAC__uint64 samples = metadata->data.stream_info.total_samples; const unsigned min_framesize = metadata->data.stream_info.min_framesize; const unsigned max_framesize = metadata->data.stream_info.max_framesize; - guint8 *data = GST_BUFFER_DATA (flacenc->first_buf); - GstBuffer *outbuf = flacenc->first_buf; + GstBuffer *outbuf = gst_buffer_copy_on_write (flacenc->first_buf); + guint8 *data = GST_BUFFER_DATA (outbuf); /* this looks evil but is actually how one is supposed to write * the stream stats according to the FLAC examples */ @@ -690,4 +691,3 @@ gst_flacenc_change_state (GstElement *element) return GST_STATE_SUCCESS; } - |