static GstBuffer *
gst_flv_mux_create_number_script_value (const gchar * name, gdouble value)
{
- GstBuffer *tmp = gst_buffer_new_and_alloc (2 + strlen (name) + 1 + 8);
- guint8 *data = GST_BUFFER_DATA (tmp);
+ GstBuffer *tmp;
+ guint8 *data;
+ gsize len = strlen (name);
- _gst_buffer_new_and_alloc (2 + strlen (name) + 1 + 8, &tmp, &data);
++ _gst_buffer_new_and_alloc (2 + len + 1 + 8, &tmp, &data);
+
- GST_WRITE_UINT16_BE (data, strlen (name)); /* name length */
- memcpy (&data[2], name, strlen (name));
- data[2 + strlen (name)] = 0; /* double */
- GST_WRITE_DOUBLE_BE (data + 2 + strlen (name) + 1, value);
+ GST_WRITE_UINT16_BE (data, len);
+ data += 2; /* name length */
+ memcpy (data, name, len);
+ data += len;
+ *data++ = AMF0_NUMBER_MARKER; /* double type */
+ GST_WRITE_DOUBLE_BE (data, value);
return tmp;
}
/* Stream ID */
data[8] = data[9] = data[10] = 0;
- tmp = gst_buffer_new_and_alloc (13);
- data = GST_BUFFER_DATA (tmp);
+ _gst_buffer_new_and_alloc (13, &tmp, &data);
- data[0] = 2; /* string */
+ data[0] = AMF0_STRING_MARKER; /* string */
data[1] = 0;
data[2] = 10; /* length 10 */
memcpy (&data[3], "onMetaData", 10);