mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
theora: port to new memory API
This commit is contained in:
parent
f379a5dacb
commit
eba165191f
1 changed files with 23 additions and 14 deletions
|
@ -302,18 +302,20 @@ theora_parse_set_streamheader (GstTheoraParse * parse)
|
||||||
ogg_packet packet;
|
ogg_packet packet;
|
||||||
GstBuffer *buf;
|
GstBuffer *buf;
|
||||||
int ret;
|
int ret;
|
||||||
|
gsize size;
|
||||||
|
|
||||||
buf = parse->streamheader[i];
|
buf = parse->streamheader[i];
|
||||||
if (buf == NULL)
|
if (buf == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
packet.packet = GST_BUFFER_DATA (buf);
|
packet.packet = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
|
||||||
packet.bytes = GST_BUFFER_SIZE (buf);
|
packet.bytes = size;
|
||||||
packet.granulepos = GST_BUFFER_OFFSET_END (buf);
|
packet.granulepos = GST_BUFFER_OFFSET_END (buf);
|
||||||
packet.packetno = i + 1;
|
packet.packetno = i + 1;
|
||||||
packet.e_o_s = 0;
|
packet.e_o_s = 0;
|
||||||
packet.b_o_s = (i == 0);
|
packet.b_o_s = (i == 0);
|
||||||
ret = th_decode_headerin (&parse->info, &parse->comment, &setup, &packet);
|
ret = th_decode_headerin (&parse->info, &parse->comment, &setup, &packet);
|
||||||
|
gst_buffer_unmap (buf, packet.packet, size);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
GST_WARNING_OBJECT (parse, "Failed to decode Theora header %d: %d\n",
|
GST_WARNING_OBJECT (parse, "Failed to decode Theora header %d: %d\n",
|
||||||
i + 1, ret);
|
i + 1, ret);
|
||||||
|
@ -435,11 +437,16 @@ parse_granulepos (GstTheoraParse * parse, gint64 granulepos,
|
||||||
static gboolean
|
static gboolean
|
||||||
is_keyframe (GstBuffer * buf)
|
is_keyframe (GstBuffer * buf)
|
||||||
{
|
{
|
||||||
if (!GST_BUFFER_DATA (buf))
|
gsize size;
|
||||||
|
guint8 data[1];
|
||||||
|
|
||||||
|
size = gst_buffer_get_size (buf);
|
||||||
|
if (size == 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
if (!GST_BUFFER_SIZE (buf))
|
|
||||||
return FALSE;
|
gst_buffer_extract (buf, 0, data, 1);
|
||||||
return ((GST_BUFFER_DATA (buf)[0] & 0x40) == 0);
|
|
||||||
|
return ((data[0] & 0x40) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -644,18 +651,20 @@ theora_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
GstTheoraParse *parse;
|
GstTheoraParse *parse;
|
||||||
guint8 *data;
|
guint8 *data, header;
|
||||||
guint size;
|
gsize size;
|
||||||
gboolean have_header;
|
gboolean have_header;
|
||||||
|
|
||||||
parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
|
parse = GST_THEORA_PARSE (gst_pad_get_parent (pad));
|
||||||
|
|
||||||
data = GST_BUFFER_DATA (buffer);
|
|
||||||
size = GST_BUFFER_SIZE (buffer);
|
|
||||||
|
|
||||||
have_header = FALSE;
|
have_header = FALSE;
|
||||||
|
|
||||||
|
data = gst_buffer_map (buffer, &size, NULL, GST_MAP_READ);
|
||||||
|
header = data[0];
|
||||||
|
gst_buffer_unmap (buffer, data, size);
|
||||||
|
|
||||||
if (size >= 1) {
|
if (size >= 1) {
|
||||||
if (data[0] & 0x80)
|
if (header & 0x80)
|
||||||
have_header = TRUE;
|
have_header = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -663,8 +672,8 @@ theora_parse_chain (GstPad * pad, GstBuffer * buffer)
|
||||||
if (parse->send_streamheader) {
|
if (parse->send_streamheader) {
|
||||||
/* we need to collect the headers still */
|
/* we need to collect the headers still */
|
||||||
/* so put it on the streamheader list and return */
|
/* so put it on the streamheader list and return */
|
||||||
if (data[0] >= 0x80 && data[0] <= 0x82)
|
if (header >= 0x80 && header <= 0x82)
|
||||||
parse->streamheader[data[0] - 0x80] = buffer;
|
parse->streamheader[header - 0x80] = buffer;
|
||||||
}
|
}
|
||||||
ret = GST_FLOW_OK;
|
ret = GST_FLOW_OK;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue