guint8 mo_number_len_type;
guint8 mo_offset_type;
*/
- GstByteReader *reader;
+ GstByteReader reader;
gboolean ret = TRUE;
guint8 first = 0;
guint8 err_length = 0; /* length of the error fields */
return FALSE;
}
- reader = gst_byte_reader_new (data, size);
+ gst_byte_reader_init (&reader, data, size);
GST_LOG ("Starting packet parsing, size: %" G_GSIZE_FORMAT, size);
- if (!gst_byte_reader_get_uint8 (reader, &first))
+ if (!gst_byte_reader_get_uint8 (&reader, &first))
goto error;
if (first & 0x80) { /* error correction present */
err_cor_len = (first & 0x0F);
err_length += err_cor_len;
GST_DEBUG ("Error correction data length: %d", (gint) err_cor_len);
- if (!gst_byte_reader_skip (reader, err_cor_len))
+ if (!gst_byte_reader_skip (&reader, err_cor_len))
goto error;
/* put payload parsing info first byte in aux var */
- if (!gst_byte_reader_get_uint8 (reader, &aux))
+ if (!gst_byte_reader_get_uint8 (&reader, &aux))
goto error;
} else {
aux = first;
GST_DEBUG ("Packet contains multiple payloads");
}
- if (!gst_byte_reader_get_uint8 (reader, &aux))
+ if (!gst_byte_reader_get_uint8 (&reader, &aux))
goto error;
/*
/* gets the fields lengths */
GST_LOG ("Getting packet and padding length");
- if (!gst_byte_reader_get_asf_var_size_field (reader,
+ if (!gst_byte_reader_get_asf_var_size_field (&reader,
packet_len_type, &packet_len))
goto error;
- if (!gst_byte_reader_skip (reader,
+ if (!gst_byte_reader_skip (&reader,
gst_asf_get_var_size_field_len (seq_len_type)))
goto error;
- if (!gst_byte_reader_get_asf_var_size_field (reader,
+ if (!gst_byte_reader_get_asf_var_size_field (&reader,
padding_len_type, &padd_len))
goto error;
}
GST_LOG ("Getting send time and duration");
- if (!gst_byte_reader_get_uint32_le (reader, &send_time))
+ if (!gst_byte_reader_get_uint32_le (&reader, &send_time))
goto error;
- if (!gst_byte_reader_get_uint16_le (reader, &duration))
+ if (!gst_byte_reader_get_uint16_le (&reader, &duration))
goto error;
has_keyframe = FALSE;
has_keyframe = GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT);
} else {
if (mult_payloads) {
- ret = gst_asf_parse_mult_payload (reader, &has_keyframe);
+ ret = gst_asf_parse_mult_payload (&reader, &has_keyframe);
} else {
- ret = gst_asf_parse_single_payload (reader, &has_keyframe);
+ ret = gst_asf_parse_single_payload (&reader, &has_keyframe);
}
}
packet->seq_field_type = seq_len_type;
packet->err_cor_len = err_length;
- gst_byte_reader_free (reader);
return ret;
error:
ret = FALSE;
GST_WARNING ("Error while parsing data packet");
end:
- gst_byte_reader_free (reader);
return ret;
}
gboolean ret = TRUE;
guint32 header_objects = 0;
guint32 i;
- GstByteReader *reader;
+ GstByteReader reader;
guint64 object_size;
object_size = gst_asf_match_and_peek_obj_size (data,
return FALSE;
}
- reader = gst_byte_reader_new (data, size);
+ gst_byte_reader_init (&reader, data, size);
- if (!gst_byte_reader_skip (reader, ASF_GUID_OBJSIZE_SIZE))
+ if (!gst_byte_reader_skip (&reader, ASF_GUID_OBJSIZE_SIZE))
goto error;
- if (!gst_byte_reader_get_uint32_le (reader, &header_objects))
+ if (!gst_byte_reader_get_uint32_le (&reader, &header_objects))
goto error;
GST_DEBUG ("ASF: Header has %" G_GUINT32_FORMAT " child"
" objects", header_objects);
/* skip reserved bytes */
- if (!gst_byte_reader_skip (reader, 2))
+ if (!gst_byte_reader_skip (&reader, 2))
goto error;
/* iterate through childs of header object */
for (i = 0; i < header_objects; i++) {
const guint8 *guid = NULL;
guint64 obj_size = 0;
- if (!gst_byte_reader_get_data (reader, ASF_GUID_SIZE, &guid))
+
+ if (!gst_byte_reader_get_data (&reader, ASF_GUID_SIZE, &guid))
goto error;
- if (!gst_byte_reader_get_uint64_le (reader, &obj_size))
+ if (!gst_byte_reader_get_uint64_le (&reader, &obj_size))
goto error;
if (gst_asf_match_guid (guid, &guids[ASF_FILE_PROPERTIES_OBJECT_INDEX])) {
- ret = gst_asf_parse_file_properties_obj (reader, file_info);
+ ret = gst_asf_parse_file_properties_obj (&reader, file_info);
} else {
/* we don't know/care about this object */
- if (!gst_byte_reader_skip (reader, obj_size - ASF_GUID_OBJSIZE_SIZE))
+ if (!gst_byte_reader_skip (&reader, obj_size - ASF_GUID_OBJSIZE_SIZE))
goto error;
}
ret = FALSE;
GST_WARNING ("ASF: Error while parsing headers");
end:
- gst_byte_reader_free (reader);
return ret;
}
gst_asf_parse_parse_data_object (GstAsfParse * asfparse, guint8 * data,
gsize size)
{
- GstByteReader *reader;
+ GstByteReader reader;
GstFlowReturn ret = GST_FLOW_OK;
guint64 packet_count = 0;
GST_DEBUG_OBJECT (asfparse, "Parsing data object");
- reader = gst_byte_reader_new (data, size);
+ gst_byte_reader_init (&reader, data, size);
/* skip to packet count */
- if (!gst_byte_reader_skip (reader, 40))
+ if (!gst_byte_reader_skip (&reader, 40))
goto error;
- if (!gst_byte_reader_get_uint64_le (reader, &packet_count))
+ if (!gst_byte_reader_get_uint64_le (&reader, &packet_count))
goto error;
if (asfparse->asfinfo->packets_count != packet_count) {
packet_count);
}
- gst_byte_reader_free (reader);
return GST_FLOW_OK;
error:
ret = GST_FLOW_ERROR;
GST_ERROR_OBJECT (asfparse, "Error while parsing data object headers");
- gst_byte_reader_free (reader);
return ret;
}