diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-01-25 13:22:43 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2012-01-25 13:22:43 +0100 |
commit | a2a430024136fd947637ff56a4fea6a2689ca59d (patch) | |
tree | 8cab3177242814f02b1e49a51d81b5f2f1660621 /ext/kate | |
parent | 071c6e8f15f2afff7ca4ce5934c3bae1d76aea95 (diff) | |
parent | 8fb0beaf00aeae2ef6081d08f0d74d6e655a53da (diff) | |
download | gstreamer-plugins-bad-a2a430024136fd947637ff56a4fea6a2689ca59d.tar.gz |
Merge branch 'master' into 0.11
Conflicts:
configure.ac
ext/kate/gstkateenc.c
gst/colorspace/colorspace.c
gst/mpegvideoparse/mpegvideoparse.c
Diffstat (limited to 'ext/kate')
-rw-r--r-- | ext/kate/gstkateenc.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/ext/kate/gstkateenc.c b/ext/kate/gstkateenc.c index 8ee8b69df..450e8e61e 100644 --- a/ext/kate/gstkateenc.c +++ b/ext/kate/gstkateenc.c @@ -924,33 +924,32 @@ gst_kate_enc_chain_text (GstKateEnc * ke, GstBuffer * buf, ("kate_encode_set_markup_type: %d", ret)); rflow = GST_FLOW_ERROR; } else { - char *text; - gsize text_len; + const char *text; + size_t text_len; + gboolean need_unmap = TRUE; + kate_float t0 = start / (double) GST_SECOND; + kate_float t1 = stop / (double) GST_SECOND; text = gst_buffer_map (buf, &text_len, NULL, GST_MAP_READ); - if (text) { - kate_float t0 = start / (double) GST_SECOND; - kate_float t1 = stop / (double) GST_SECOND; - GST_LOG_OBJECT (ke, "Encoding text: %*.*s (%u bytes) from %f to %f", - (int) text_len, (int) text_len, text, text_len, t0, t1); - - ret = kate_encode_text (&ke->k, t0, t1, text, text_len, &kp); + if (text == NULL) { + text = ""; + text_len = 0; + need_unmap = FALSE; + } - if (G_UNLIKELY (ret < 0)) { - GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL), - ("Failed to encode text: %d", ret)); - rflow = GST_FLOW_ERROR; - } else { - rflow = - gst_kate_enc_chain_push_packet (ke, &kp, start, stop - start + 1); - } - } else { - /* FIXME: this should not be an error, we should ignore it and move on */ + GST_LOG_OBJECT (ke, "Encoding text: %*.*s (%u bytes) from %f to %f", + (int) text_len, (int) text_len, GST_BUFFER_DATA (buf), + GST_BUFFER_SIZE (buf), t0, t1); + ret = kate_encode_text (&ke->k, t0, t1, text, text_len, &kp); + if (G_UNLIKELY (ret < 0)) { GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL), - ("no text in text packet")); + ("Failed to encode text: %d", ret)); rflow = GST_FLOW_ERROR; + } else { + rflow = gst_kate_enc_chain_push_packet (ke, &kp, start, stop - start + 1); } - gst_buffer_unmap (buf, text, text_len); + if (need_unmap) + gst_buffer_unmap (buf, text, text_len); } return rflow; |