Beispiel #1
0
static void
gst_cmml_tag_head_value_from_string_value (const GValue * src, GValue * dest)
{
  GstCmmlParser *parser;
  const gchar *str;
  guint size;

  parser = gst_cmml_parser_new (GST_CMML_PARSER_DECODE);
  parser->user_data = dest;
  parser->head_callback = (GstCmmlParserHeadCallback) set_object_on_value;
  gst_cmml_parser_parse_chunk (parser,
      default_preamble, strlen (default_preamble), NULL);

  str = g_value_get_string (src);
  size = strlen (str);
  gst_cmml_parser_parse_chunk (parser, str, size, NULL);

  gst_cmml_parser_free (parser);
}
Beispiel #2
0
/* feeds data into the cmml parser.
 */
static void
gst_cmml_dec_parse_xml (GstCmmlDec * dec, guchar * data, guint size)
{
  GError *err = NULL;

  if (!gst_cmml_parser_parse_chunk (dec->parser, (gchar *) data, size, &err)) {
    GST_ELEMENT_ERROR (dec, STREAM, DECODE, (NULL), ("%s", err->message));
    g_error_free (err);
    dec->flow_return = GST_FLOW_ERROR;
  }
}
Beispiel #3
0
static GstFlowReturn
gst_cmml_enc_chain (GstPad * pad, GstBuffer * buffer)
{
  GError *err = NULL;
  GstCmmlEnc *enc = GST_CMML_ENC (GST_PAD_PARENT (pad));

  /* the CMML handlers registered with enc->parser will override this when
   * encoding/pushing the buffers downstream
   */
  enc->flow_return = GST_FLOW_OK;

  if (!gst_cmml_parser_parse_chunk (enc->parser,
          (gchar *) GST_BUFFER_DATA (buffer), GST_BUFFER_SIZE (buffer), &err)) {
    GST_ELEMENT_ERROR (enc, STREAM, ENCODE, (NULL), ("%s", err->message));
    g_error_free (err);
    enc->flow_return = GST_FLOW_ERROR;
  }

  gst_buffer_unref (buffer);
  return enc->flow_return;
}