mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
jpegparse: add gst_jpeg_parse_skip_marker ()
https://bugzilla.gnome.org/show_bug.cgi?id=626618
This commit is contained in:
parent
285c32e01f
commit
e5728ebcb1
1 changed files with 19 additions and 10 deletions
|
@ -499,6 +499,23 @@ gst_jpeg_parse_sof (GstJpegParse * parse, GstByteReader * reader)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static inline gboolean
|
||||
gst_jpeg_parse_skip_marker (GstJpegParse * parse,
|
||||
GstByteReader * reader, guint8 marker)
|
||||
{
|
||||
guint16 size;
|
||||
|
||||
if (!gst_byte_reader_get_uint16_be (reader, &size))
|
||||
return FALSE;
|
||||
|
||||
if (!gst_byte_reader_skip (reader, size - 2))
|
||||
return FALSE;
|
||||
|
||||
GST_LOG_OBJECT (parse, "unhandled marker %x skiping %u bytes", marker, size);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer)
|
||||
{
|
||||
|
@ -629,12 +646,8 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer)
|
|||
case DHT:
|
||||
case DQT:
|
||||
/* Ignore these codes */
|
||||
if (!gst_byte_reader_get_uint16_be (&reader, &size))
|
||||
if (!gst_jpeg_parse_skip_marker (parse, &reader, marker))
|
||||
goto error;
|
||||
if (!gst_byte_reader_skip (&reader, size - 2))
|
||||
goto error;
|
||||
GST_LOG_OBJECT (parse, "unhandled marker %x skiping %u bytes", marker,
|
||||
size - 2);
|
||||
break;
|
||||
|
||||
case SOF2:
|
||||
|
@ -670,12 +683,8 @@ gst_jpeg_parse_read_header (GstJpegParse * parse, GstBuffer * buffer)
|
|||
if (!gst_byte_reader_set_pos (&reader, pos - size))
|
||||
goto error;
|
||||
#else
|
||||
if (!gst_byte_reader_get_uint16_be (&reader, &size))
|
||||
if (!gst_jpeg_parse_skip_marker (parse, &reader, marker))
|
||||
goto error;
|
||||
if (!gst_byte_reader_skip (&reader, size - 2))
|
||||
goto error;
|
||||
GST_LOG_OBJECT (parse, "unhandled marker %x skiping %u bytes", marker,
|
||||
size - 2);
|
||||
#endif
|
||||
} else {
|
||||
GST_WARNING_OBJECT (parse, "unhandled marker %x, leaving", marker);
|
||||
|
|
Loading…
Reference in a new issue