summaryrefslogtreecommitdiffstats
path: root/gst/flx
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2002-01-19 18:46:23 +0000
committerWim Taymans <wim.taymans@gmail.com>2002-01-19 18:46:23 +0000
commit2cde2cdd8d0ac60d146af330ee0daffc5124cfec (patch)
tree4f2c117236764bc54635946540cc41f5587b80b9 /gst/flx
parent6391a023a668e63788b299546fa9d4d67d96a484 (diff)
downloadgst-plugins-bad-2cde2cdd8d0ac60d146af330ee0daffc5124cfec.tar.gz
gst-plugins-bad-2cde2cdd8d0ac60d146af330ee0daffc5124cfec.tar.bz2
gst-plugins-bad-2cde2cdd8d0ac60d146af330ee0daffc5124cfec.zip
Drop the bytstream correctly.
Original commit message from CVS: Drop the bytstream correctly.
Diffstat (limited to 'gst/flx')
-rw-r--r--gst/flx/gstflxdec.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/gst/flx/gstflxdec.c b/gst/flx/gstflxdec.c
index d04a3110..871e8ab7 100644
--- a/gst/flx/gstflxdec.c
+++ b/gst/flx/gstflxdec.c
@@ -472,6 +472,11 @@ gst_flxdec_loop (GstElement *element)
if (flxdec->state == GST_FLXDEC_READ_HEADER) {
databuf = flx_get_data(flxdec, FlxHeaderSize);
+ if (!databuf) {
+ g_print ("empty buffer\n");
+ return;
+ }
+
data = GST_BUFFER_DATA(databuf);
memcpy((char *) &flxdec->hdr, data, sizeof(FlxHeader));
@@ -483,8 +488,10 @@ gst_flxdec_loop (GstElement *element)
/* check header */
if (flxh->type != FLX_MAGICHDR_FLI &&
flxh->type != FLX_MAGICHDR_FLC &&
- flxh->type != FLX_MAGICHDR_FLX)
+ flxh->type != FLX_MAGICHDR_FLX) {
+ gst_element_error (element, "not a flx file (type %d)\n", flxh->type);
return;
+ }
g_print("GstFlxDec: size : %d\n", flxh->size);
@@ -607,9 +614,9 @@ gst_flxdec_change_state (GstElement *element)
switch (GST_STATE_TRANSITION (element)) {
case GST_STATE_NULL_TO_READY:
- flxdec->bs = gst_bytestream_new (flxdec->sinkpad);
break;
case GST_STATE_READY_TO_PAUSED:
+ flxdec->bs = gst_bytestream_new (flxdec->sinkpad);
flxdec->state = GST_FLXDEC_READ_HEADER;
break;
case GST_STATE_PAUSED_TO_PLAYING:
@@ -621,9 +628,9 @@ gst_flxdec_change_state (GstElement *element)
flxdec->frame = NULL;
gst_buffer_unref (flxdec->delta);
flxdec->delta = NULL;
+ gst_bytestream_destroy (flxdec->bs);
break;
case GST_STATE_READY_TO_NULL:
- gst_bytestream_destroy (flxdec->bs);
break;
}