mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 10:11:08 +00:00
parent
2641cd9d94
commit
aaed93e126
7 changed files with 55 additions and 39 deletions
|
@ -74,8 +74,6 @@
|
|||
* </refsect2>
|
||||
*/
|
||||
|
||||
/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
@ -298,7 +296,8 @@ gst_kate_dec_chain (GstPad * pad, GstBuffer * buf)
|
|||
gst_flow_get_name (rflow));
|
||||
}
|
||||
} else {
|
||||
GST_WARNING_OBJECT (kd, "failed to create buffer");
|
||||
GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
|
||||
("Failed to create buffer"));
|
||||
rflow = GST_FLOW_ERROR;
|
||||
}
|
||||
} else {
|
||||
|
@ -307,7 +306,8 @@ gst_kate_dec_chain (GstPad * pad, GstBuffer * buf)
|
|||
}
|
||||
g_free (escaped);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (kd, "failed to allocate string");
|
||||
GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
|
||||
("Failed to allocate string"));
|
||||
rflow = GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -329,7 +329,8 @@ gst_kate_dec_chain (GstPad * pad, GstBuffer * buf)
|
|||
gst_flow_get_name (rflow));
|
||||
}
|
||||
} else {
|
||||
GST_WARNING_OBJECT (kd, "failed to create SPU from paletted bitmap");
|
||||
GST_ELEMENT_ERROR (kd, STREAM, DECODE, (NULL),
|
||||
("failed to create SPU from paletted bitmap"));
|
||||
rflow = GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -58,8 +58,6 @@
|
|||
*
|
||||
*/
|
||||
|
||||
/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
@ -174,7 +172,8 @@ gst_kate_parse_push_headers (GstKateParse * parse)
|
|||
gst_pad_get_negotiated_caps (parse->sinkpad), parse->streamheader);
|
||||
|
||||
if (G_UNLIKELY (!caps)) {
|
||||
GST_ERROR_OBJECT (parse, "Failed to set headers on caps");
|
||||
GST_ELEMENT_ERROR (parse, STREAM, DECODE, (NULL),
|
||||
("Failed to set headers on caps"));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -182,8 +181,8 @@ gst_kate_parse_push_headers (GstKateParse * parse)
|
|||
res = gst_pad_set_caps (parse->srcpad, caps);
|
||||
gst_caps_unref (caps);
|
||||
if (G_UNLIKELY (!res)) {
|
||||
GST_WARNING_OBJECT (parse, "Failed to set pad caps");
|
||||
return GST_FLOW_ERROR;
|
||||
GST_WARNING_OBJECT (parse->srcpad, "Failed to set caps on source pad");
|
||||
return GST_FLOW_NOT_NEGOTIATED;
|
||||
}
|
||||
|
||||
headers = parse->streamheader;
|
||||
|
@ -343,7 +342,8 @@ gst_kate_parse_queue_buffer (GstKateParse * parse, GstBuffer * buf)
|
|||
if (granpos >= 0) {
|
||||
ret = gst_kate_parse_drain_queue (parse, granpos);
|
||||
} else {
|
||||
GST_WARNING_OBJECT (parse, "granulepos < 0 (%lld)", granpos);
|
||||
GST_ELEMENT_ERROR (parse, STREAM, DECODE, (NULL),
|
||||
("Bad granulepos %" G_GINT64_FORMAT, granpos));
|
||||
ret = GST_FLOW_ERROR;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -253,7 +253,8 @@ gst_kate_spu_crop_bitmap (GstKateEnc * ke, kate_bitmap * kb, guint16 * dx,
|
|||
kb->height = h;
|
||||
}
|
||||
|
||||
#define CHECK(x) do { guint16 _ = (x); if (G_UNLIKELY((_) > sz)) { GST_WARNING_OBJECT (ke, "SPU overflow"); return GST_FLOW_ERROR; } } while (0)
|
||||
/* FIXME: fix macros */
|
||||
#define CHECK(x) do { guint16 _ = (x); if (G_UNLIKELY((_) > sz)) { GST_ELEMENT_ERROR (ke, STREAM, ENCODE, ("Attempt to read outide buffer"), (NULL)); return GST_FLOW_ERROR; } } while (0)
|
||||
#define ADVANCE(x) do { guint16 _ = (x); ptr += (_); sz -= (_); } while (0)
|
||||
#define IGNORE(x) do { guint16 __ = (x); CHECK (__); ADVANCE (__); } while (0)
|
||||
|
||||
|
@ -267,8 +268,9 @@ gst_kate_spu_decode_command_sequence (GstKateEnc * ke, GstBuffer * buf,
|
|||
guint16 sz;
|
||||
|
||||
if (command_sequence_offset >= GST_BUFFER_SIZE (buf)) {
|
||||
GST_WARNING_OBJECT (ke, "Command sequence offset %u is out of range %u",
|
||||
command_sequence_offset, GST_BUFFER_SIZE (buf));
|
||||
GST_ELEMENT_ERROR (ke, STREAM, DECODE, (NULL),
|
||||
("Command sequence offset %u is out of range %u",
|
||||
command_sequence_offset, GST_BUFFER_SIZE (buf)));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -348,10 +350,12 @@ gst_kate_spu_decode_command_sequence (GstKateEnc * ke, GstBuffer * buf,
|
|||
}
|
||||
break;
|
||||
default:
|
||||
GST_WARNING_OBJECT (ke, "invalid SPU command: %u", cmd);
|
||||
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
|
||||
("Invalid SPU command: %u", cmd));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
}
|
||||
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL), ("Error parsing SPU"));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -395,9 +399,10 @@ gst_kate_spu_create_spu_palette (GstKateEnc * ke, kate_palette * kp)
|
|||
kate_palette_init (kp);
|
||||
kp->ncolors = 4;
|
||||
kp->colors = (kate_color *) g_malloc (kp->ncolors * sizeof (kate_color));
|
||||
if (G_UNLIKELY (!kp->colors))
|
||||
if (G_UNLIKELY (!kp->colors)) {
|
||||
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL), ("Out of memory"));
|
||||
return GST_FLOW_ERROR;
|
||||
|
||||
}
|
||||
#if 1
|
||||
for (n = 0; n < kp->ncolors; ++n) {
|
||||
int idx = ke->spu_colormap[n];
|
||||
|
@ -478,7 +483,8 @@ gst_kate_spu_decode_spu (GstKateEnc * ke, GstBuffer * buf, kate_region * kr,
|
|||
if (G_UNLIKELY (ke->spu_right - ke->spu_left < 0
|
||||
|| ke->spu_bottom - ke->spu_top < 0 || ke->spu_pix_data[0] == 0
|
||||
|| ke->spu_pix_data[1] == 0)) {
|
||||
GST_WARNING_OBJECT (ke, "SPU area is empty, nothing to encode");
|
||||
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
|
||||
("SPU area is empty, nothing to encode"));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
@ -495,7 +501,8 @@ gst_kate_spu_decode_spu (GstKateEnc * ke, GstBuffer * buf, kate_region * kr,
|
|||
kb->type = kate_bitmap_type_paletted;
|
||||
kb->pixels = (unsigned char *) g_malloc (kb->width * kb->height);
|
||||
if (G_UNLIKELY (!kb->pixels)) {
|
||||
GST_WARNING_OBJECT (ke, "Failed to allocate memory for pixel data");
|
||||
GST_ELEMENT_ERROR (ke, STREAM, ENCODE, (NULL),
|
||||
("Failed to allocate memory for pixel data"));
|
||||
return GST_FLOW_ERROR;
|
||||
}
|
||||
|
||||
|
|
|
@ -63,8 +63,6 @@
|
|||
* </refsect2>
|
||||
*/
|
||||
|
||||
/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
|
|
@ -73,8 +73,6 @@
|
|||
* </refsect2>
|
||||
*/
|
||||
|
||||
/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
|
||||
/* FIXME: post appropriate GST_ELEMENT_ERROR when returning FLOW_ERROR */
|
||||
/* FIXME: shouldn't all this GstKateDecoderBase stuff really be a base class? */
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
|
@ -165,7 +164,8 @@ gst_kate_util_decoder_base_chain_kate_packet (GstKateDecoderBase * decoder,
|
|||
kate_packet_wrap (&kp, GST_BUFFER_SIZE (buf), GST_BUFFER_DATA (buf));
|
||||
ret = kate_high_decode_packetin (&decoder->k, &kp, ev);
|
||||
if (G_UNLIKELY (ret < 0)) {
|
||||
GST_WARNING_OBJECT (element, "kate_high_decode_packetin failed (%d)", ret);
|
||||
GST_ELEMENT_ERROR (element, STREAM, DECODE, (NULL),
|
||||
("Failed to decode Kate packet: %d", ret));
|
||||
return GST_FLOW_ERROR;
|
||||
} else if (G_UNLIKELY (ret > 0)) {
|
||||
GST_DEBUG_OBJECT (element,
|
||||
|
|
Loading…
Reference in a new issue