mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 06:58:56 +00:00
Small cleanups, break the loop if the buffer is null
Original commit message from CVS: Small cleanups, break the loop if the buffer is null
This commit is contained in:
parent
8e098a3c6b
commit
1f450bc6d8
2 changed files with 12 additions and 9 deletions
|
@ -180,7 +180,6 @@ gst_flxdec_init(GstFlxDec *flxdec)
|
||||||
GST_PADTEMPLATE_GET (src_video_factory), "src");
|
GST_PADTEMPLATE_GET (src_video_factory), "src");
|
||||||
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
|
gst_element_add_pad(GST_ELEMENT(flxdec),flxdec->srcpad);
|
||||||
|
|
||||||
flxdec->buf = NULL;
|
|
||||||
flxdec->bs = NULL;
|
flxdec->bs = NULL;
|
||||||
flxdec->frame = NULL;
|
flxdec->frame = NULL;
|
||||||
flxdec->delta = NULL;
|
flxdec->delta = NULL;
|
||||||
|
@ -545,8 +544,11 @@ gst_flxdec_loop (GstElement *element)
|
||||||
flxdec->state = GST_FLXDEC_PLAYING;
|
flxdec->state = GST_FLXDEC_PLAYING;
|
||||||
}
|
}
|
||||||
else if (flxdec->state == GST_FLXDEC_PLAYING) {
|
else if (flxdec->state == GST_FLXDEC_PLAYING) {
|
||||||
|
GstBuffer *out;
|
||||||
|
|
||||||
databuf = flx_get_data(flxdec, FlxFrameChunkSize);
|
databuf = flx_get_data(flxdec, FlxFrameChunkSize);
|
||||||
|
if (!databuf)
|
||||||
|
return;
|
||||||
|
|
||||||
flxfh = (FlxFrameChunk *) GST_BUFFER_DATA(databuf);
|
flxfh = (FlxFrameChunk *) GST_BUFFER_DATA(databuf);
|
||||||
|
|
||||||
|
@ -560,10 +562,9 @@ gst_flxdec_loop (GstElement *element)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* create 32 bits output frame */
|
/* create 32 bits output frame */
|
||||||
flxdec->out = gst_buffer_new();
|
out = gst_buffer_new();
|
||||||
GST_BUFFER_DATA(flxdec->out) = g_malloc(flxdec->size * 4);
|
GST_BUFFER_DATA(out) = g_malloc(flxdec->size * 4);
|
||||||
GST_BUFFER_SIZE(flxdec->out) = flxdec->size * 4;
|
GST_BUFFER_SIZE(out) = flxdec->size * 4;
|
||||||
|
|
||||||
|
|
||||||
/* decode chunks */
|
/* decode chunks */
|
||||||
flx_decode_chunks(flxdec,
|
flx_decode_chunks(flxdec,
|
||||||
|
@ -582,12 +583,12 @@ gst_flxdec_loop (GstElement *element)
|
||||||
/* convert current frame. */
|
/* convert current frame. */
|
||||||
flx_colorspace_convert(flxdec->converter,
|
flx_colorspace_convert(flxdec->converter,
|
||||||
GST_BUFFER_DATA(flxdec->frame),
|
GST_BUFFER_DATA(flxdec->frame),
|
||||||
GST_BUFFER_DATA(flxdec->out));
|
GST_BUFFER_DATA(out));
|
||||||
|
|
||||||
GST_BUFFER_TIMESTAMP (flxdec->out) = flxdec->next_time;
|
GST_BUFFER_TIMESTAMP (out) = flxdec->next_time;
|
||||||
flxdec->next_time += flxdec->frame_time;
|
flxdec->next_time += flxdec->frame_time;
|
||||||
|
|
||||||
gst_pad_push(flxdec->srcpad, flxdec->out);
|
gst_pad_push(flxdec->srcpad, out);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -617,7 +618,9 @@ gst_flxdec_change_state (GstElement *element)
|
||||||
break;
|
break;
|
||||||
case GST_STATE_PAUSED_TO_READY:
|
case GST_STATE_PAUSED_TO_READY:
|
||||||
gst_buffer_unref (flxdec->frame);
|
gst_buffer_unref (flxdec->frame);
|
||||||
|
flxdec->frame = NULL;
|
||||||
gst_buffer_unref (flxdec->delta);
|
gst_buffer_unref (flxdec->delta);
|
||||||
|
flxdec->delta = NULL;
|
||||||
break;
|
break;
|
||||||
case GST_STATE_READY_TO_NULL:
|
case GST_STATE_READY_TO_NULL:
|
||||||
gst_bytestream_destroy (flxdec->bs);
|
gst_bytestream_destroy (flxdec->bs);
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct _GstFlxDec {
|
||||||
|
|
||||||
gboolean active, new_meta;
|
gboolean active, new_meta;
|
||||||
|
|
||||||
GstBuffer *buf, *out, *delta, *frame;
|
GstBuffer *delta, *frame;
|
||||||
GstByteStream *bs;
|
GstByteStream *bs;
|
||||||
gulong size;
|
gulong size;
|
||||||
GstFlxDecState state;
|
GstFlxDecState state;
|
||||||
|
|
Loading…
Reference in a new issue