summaryrefslogtreecommitdiffstats
path: root/ext/kate/gstkateenc.c
diff options
context:
space:
mode:
authorVincent Penquerc'h <ogg.k.ogg.k@googlemail.com>2009-07-24 21:54:59 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-07-25 12:13:40 +0100
commitaaed93e1265959bb06c4759e68537788c9446681 (patch)
tree595d14cfb6e37b07f94ddf3eb903bb10739c262f /ext/kate/gstkateenc.c
parent2641cd9d94433820796c613d17c9a6227c2a8f27 (diff)
downloadgst-plugins-bad-aaed93e1265959bb06c4759e68537788c9446681.tar.gz
gst-plugins-bad-aaed93e1265959bb06c4759e68537788c9446681.tar.bz2
gst-plugins-bad-aaed93e1265959bb06c4759e68537788c9446681.zip
kate: use GST_ELEMENT_ERROR for error reporting
See #525743.
Diffstat (limited to 'ext/kate/gstkateenc.c')
-rw-r--r--ext/kate/gstkateenc.c40
1 files changed, 26 insertions, 14 deletions
diff --git a/ext/kate/gstkateenc.c b/ext/kate/gstkateenc.c
index 80709eb3..fd412d34 100644
--- a/ext/kate/gstkateenc.c
+++ b/ext/kate/gstkateenc.c
@@ -68,7 +68,6 @@
* </refsect2>
*/
-/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
/* FIXME: should we automatically pick up the language code from the
* upstream event tags if none was set via the property? */
@@ -457,7 +456,8 @@ gst_kate_enc_push_and_free_kate_packet (GstKateEnc * ke, kate_packet * kp,
buffer =
gst_kate_enc_create_buffer (ke, kp, granpos, timestamp, duration, header);
if (G_UNLIKELY (!buffer)) {
- GST_WARNING_OBJECT (ke, "Failed to create buffer, %u bytes", kp->nbytes);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("Failed to create buffer, %u bytes", kp->nbytes));
kate_packet_clear (kp);
return GST_FLOW_ERROR;
}
@@ -561,7 +561,8 @@ gst_kate_enc_send_headers (GstKateEnc * ke)
GST_LOG_OBJECT (ke, "Last header encoded");
break;
} else {
- GST_LOG_OBJECT (ke, "Error encoding header: %d", ret);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("kate_encode_headers: %d", ret));
rflow = GST_FLOW_ERROR;
break;
}
@@ -634,7 +635,8 @@ gst_kate_enc_chain_push_packet (GstKateEnc * ke, kate_packet * kp,
granpos = kate_encode_get_granule (&ke->k);
if (G_UNLIKELY (granpos < 0)) {
- GST_WARNING_OBJECT (ke, "Negative granpos for packet");
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("Negative granpos for packet"));
kate_packet_clear (kp);
return GST_FLOW_ERROR;
}
@@ -685,6 +687,8 @@ gst_kate_enc_flush_waiting (GstKateEnc * ke, GstClockTime now)
ret = kate_encode_text (&ke->k, t0, t1, "", 0, &kp);
if (G_UNLIKELY (ret < 0)) {
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("kate_encode_text: %d", ret));
rflow = GST_FLOW_ERROR;
} else {
rflow =
@@ -747,7 +751,7 @@ gst_kate_enc_chain_spu (GstKateEnc * ke, GstBuffer * buf)
g_free (kbitmap);
if (kpalette)
g_free (kpalette);
- GST_ERROR_OBJECT (ke, "Out of memory");
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL), ("Out of memory"));
return GST_FLOW_ERROR;
}
@@ -802,17 +806,20 @@ gst_kate_enc_chain_spu (GstKateEnc * ke, GstBuffer * buf)
kbitmap->width, kbitmap->height, GST_BUFFER_SIZE (buf), t0, t1);
ret = kate_encode_set_region (&ke->k, kregion);
if (G_UNLIKELY (ret < 0)) {
- GST_WARNING_OBJECT (ke, "Failed to set event region (%d)", ret);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("kate_encode_set_region: %d", ret));
rflow = GST_FLOW_ERROR;
} else {
ret = kate_encode_set_palette (&ke->k, kpalette);
if (G_UNLIKELY (ret < 0)) {
- GST_WARNING_OBJECT (ke, "Failed to set event palette (%d)", ret);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("kate_encode_set_palette: %d", ret));
rflow = GST_FLOW_ERROR;
} else {
ret = kate_encode_set_bitmap (&ke->k, kbitmap);
if (G_UNLIKELY (ret < 0)) {
- GST_WARNING_OBJECT (ke, "Failed to set event bitmap (%d)", ret);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("kate_encode_set_bitmap: %d", ret));
rflow = GST_FLOW_ERROR;
} else {
/* Some SPUs have no hide time - so I'm going to delay the encoding of the packet
@@ -833,8 +840,8 @@ gst_kate_enc_chain_spu (GstKateEnc * ke, GstBuffer * buf)
} else {
ret = kate_encode_text (&ke->k, t0, t1, "", 0, &kp);
if (G_UNLIKELY (ret < 0)) {
- GST_WARNING_OBJECT (ke,
- "Failed to encode empty text for SPU buffer (%d)", ret);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("Failed to encode empty text for SPU buffer: %d", ret));
rflow = GST_FLOW_ERROR;
} else {
rflow =
@@ -875,7 +882,8 @@ gst_kate_enc_chain_text (GstKateEnc * ke, GstBuffer * buf,
}
if (G_UNLIKELY (ret < 0)) {
- GST_WARNING_OBJECT (ke, "Failed to set markup type (%d)", ret);
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("kate_encode_set_markup_type: %d", ret));
rflow = GST_FLOW_ERROR;
} else {
const char *text = (const char *) GST_BUFFER_DATA (buf);
@@ -888,13 +896,17 @@ gst_kate_enc_chain_text (GstKateEnc * ke, GstBuffer * 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),
+ ("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 {
- GST_WARNING_OBJECT (ke, "No text in text packet");
+ /* FIXME: this should not be an error, we should ignore it and move on */
+ GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
+ ("no text in text packet"));
rflow = GST_FLOW_ERROR;
}
}
@@ -918,8 +930,8 @@ gst_kate_enc_chain (GstPad * pad, GstBuffer * buf)
/* get the type of the data we're being sent */
caps = GST_PAD_CAPS (pad);
if (G_UNLIKELY (caps == NULL)) {
- GST_ERROR_OBJECT (ke, ": Could not get caps of pad");
- rflow = GST_FLOW_ERROR;
+ GST_WARNING_OBJECT (ke, "No input caps set");
+ rflow = GST_FLOW_NOT_NEGOTIATED;
} else {
const GstStructure *structure = gst_caps_get_structure (caps, 0);
if (structure)