mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
mpeg4videoparse: also set short configuration data in codec_data
That is, header configuration may start at Video Object (startcode), rather than at Visual Object Sequence, which is catered for and parsed, so let's also take it as codec_data if no more available. Fixes (remainder of) #572551.
This commit is contained in:
parent
c4aaab2d59
commit
00148e3736
1 changed files with 25 additions and 9 deletions
|
@ -210,10 +210,26 @@ static gint aspect_ratio_table[6][2] = { {-1, -1}, {1, 1}, {12, 11},
|
||||||
{10, 11}, {16, 11}, {40, 33}
|
{10, 11}, {16, 11}, {40, 33}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_mpeg4vparse_set_config (GstMpeg4VParse * parse, const guint8 * data,
|
||||||
|
gsize size)
|
||||||
|
{
|
||||||
|
/* limit possible caps noise */
|
||||||
|
if (parse->config && size == GST_BUFFER_SIZE (parse->config) &&
|
||||||
|
memcmp (GST_BUFFER_DATA (parse->config), data, size) == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (parse->config != NULL)
|
||||||
|
gst_buffer_unref (parse->config);
|
||||||
|
|
||||||
|
parse->config = gst_buffer_new_and_alloc (size);
|
||||||
|
memcpy (GST_BUFFER_DATA (parse->config), data, size);
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle parsing a video object */
|
/* Handle parsing a video object */
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_mpeg4vparse_handle_vo (GstMpeg4VParse * parse, const guint8 * data,
|
gst_mpeg4vparse_handle_vo (GstMpeg4VParse * parse, const guint8 * data,
|
||||||
gsize size)
|
gsize size, gboolean set_codec_data)
|
||||||
{
|
{
|
||||||
guint32 bits;
|
guint32 bits;
|
||||||
bitstream_t bs = { data, 0, 0, size };
|
bitstream_t bs = { data, 0, 0, size };
|
||||||
|
@ -222,6 +238,9 @@ gst_mpeg4vparse_handle_vo (GstMpeg4VParse * parse, const guint8 * data,
|
||||||
gint aspect_ratio_width = -1, aspect_ratio_height = -1;
|
gint aspect_ratio_width = -1, aspect_ratio_height = -1;
|
||||||
gint height = -1, width = -1;
|
gint height = -1, width = -1;
|
||||||
|
|
||||||
|
if (set_codec_data)
|
||||||
|
gst_mpeg4vparse_set_config (parse, data, size);
|
||||||
|
|
||||||
/* expecting a video object startcode */
|
/* expecting a video object startcode */
|
||||||
GET_BITS (&bs, 32, &bits);
|
GET_BITS (&bs, 32, &bits);
|
||||||
if (bits > 0x11F)
|
if (bits > 0x11F)
|
||||||
|
@ -384,11 +403,7 @@ gst_mpeg4vparse_handle_vos (GstMpeg4VParse * parse, const guint8 * data,
|
||||||
/* Even if we fail to parse, then some other element might succeed, so always
|
/* Even if we fail to parse, then some other element might succeed, so always
|
||||||
* put the VOS in the config */
|
* put the VOS in the config */
|
||||||
parse->profile = profile;
|
parse->profile = profile;
|
||||||
if (parse->config != NULL)
|
gst_mpeg4vparse_set_config (parse, data, size);
|
||||||
gst_buffer_unref (parse->config);
|
|
||||||
|
|
||||||
parse->config = gst_buffer_new_and_alloc (size);
|
|
||||||
memcpy (GST_BUFFER_DATA (parse->config), data, size);
|
|
||||||
|
|
||||||
parse->have_config = TRUE;
|
parse->have_config = TRUE;
|
||||||
|
|
||||||
|
@ -440,7 +455,7 @@ gst_mpeg4vparse_handle_vos (GstMpeg4VParse * parse, const guint8 * data,
|
||||||
data = &bs.data[bs.offset];
|
data = &bs.data[bs.offset];
|
||||||
size -= bs.offset;
|
size -= bs.offset;
|
||||||
|
|
||||||
return gst_mpeg4vparse_handle_vo (parse, data, size);
|
return gst_mpeg4vparse_handle_vo (parse, data, size, FALSE);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
return gst_mpeg4vparse_set_new_caps (parse, 0, 0, -1, -1, -1, -1);
|
return gst_mpeg4vparse_set_new_caps (parse, 0, 0, -1, -1, -1, -1);
|
||||||
|
@ -577,7 +592,7 @@ gst_mpeg4vparse_drain (GstMpeg4VParse * parse, GstBuffer * last_buffer)
|
||||||
/* end of VOS found, interpret the config data and restart the
|
/* end of VOS found, interpret the config data and restart the
|
||||||
* search for the VOP */
|
* search for the VOP */
|
||||||
gst_mpeg4vparse_handle_vo (parse, data + parse->vos_offset,
|
gst_mpeg4vparse_handle_vo (parse, data + parse->vos_offset,
|
||||||
parse->offset - parse->vos_offset);
|
parse->offset - parse->vos_offset, TRUE);
|
||||||
parse->state = PARSE_START_FOUND;
|
parse->state = PARSE_START_FOUND;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -685,7 +700,8 @@ gst_mpeg4vparse_sink_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
/* Sometimes, instead, it'll just have the video object/video object
|
/* Sometimes, instead, it'll just have the video object/video object
|
||||||
layer data. We can parse that too, though it'll give us slightly
|
layer data. We can parse that too, though it'll give us slightly
|
||||||
less information. */
|
less information. */
|
||||||
res = gst_mpeg4vparse_handle_vo (parse, data, GST_BUFFER_SIZE (buf));
|
res = gst_mpeg4vparse_handle_vo (parse, data, GST_BUFFER_SIZE (buf),
|
||||||
|
FALSE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (parse,
|
GST_WARNING_OBJECT (parse,
|
||||||
|
|
Loading…
Reference in a new issue