static void gst_teletextdec_zvbi_init (GstTeletextDec * teletext);
static void gst_teletextdec_zvbi_clear (GstTeletextDec * teletext);
+static void gst_teletextdec_reset_frame (GstTeletextDec * teletext);
/* initialize the gstteletext's class */
static void
teletext->queue = NULL;
g_mutex_init (&teletext->queue_lock);
- teletext->frame = g_new0 (GstTeletextFrame, 1);
- teletext->frame->sliced_begin = g_new (vbi_sliced, MAX_SLICES);
- teletext->frame->current_slice = teletext->frame->sliced_begin;
- teletext->frame->sliced_end = teletext->frame->sliced_begin + MAX_SLICES;
+ gst_teletextdec_reset_frame (teletext);
teletext->last_ts = 0;
teletext->decoder = NULL;
}
if (teletext->frame != NULL) {
+ if (teletext->frame->sliced_begin)
+ g_free (teletext->frame->sliced_begin);
g_free (teletext->frame);
teletext->frame = NULL;
}
static void
gst_teletextdec_reset_frame (GstTeletextDec * teletext)
{
+ if (teletext->frame == NULL)
+ teletext->frame = g_new0 (GstTeletextFrame, 1);
+ if (teletext->frame->sliced_begin == NULL)
+ teletext->frame->sliced_begin = g_new (vbi_sliced, MAX_SLICES);
teletext->frame->current_slice = teletext->frame->sliced_begin;
teletext->frame->sliced_end = teletext->frame->sliced_begin + MAX_SLICES;
teletext->frame->last_field = 0;
teletext->in_timestamp = GST_BUFFER_TIMESTAMP (buf);
teletext->in_duration = GST_BUFFER_DURATION (buf);
- if (teletext->frame == NULL) {
+ if (teletext->frame == NULL)
gst_teletextdec_reset_frame (teletext);
- }
while (offset < buf_map.size) {
res =
return GST_FLOW_ERROR;
}
-alloc_failed:
- {
- GST_ERROR_OBJECT (teletext, "Error allocating output buffer, reason %s",
- gst_flow_get_name (ret));
- return ret;
- }
-
push_failed:
{
GST_ERROR_OBJECT (teletext, "Pushing buffer failed, reason %s",