summaryrefslogtreecommitdiffstats
path: root/gst/qtdemux
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim.muller@collabora.co.uk>2009-08-15 20:38:40 +0100
committerTim-Philipp Müller <tim.muller@collabora.co.uk>2009-09-23 16:54:42 +0100
commit5875e2016a0437b2127be00f0c95060b95aab668 (patch)
tree937ed3f6a214eb1a0b4d06ccc1c075722da39557 /gst/qtdemux
parent410ebb7eb3d6c216c977d5562b20020f4138b7bd (diff)
qtdemux: add qt_atom_parser_get_offset() and optimise _peek_sub()
Diffstat (limited to 'gst/qtdemux')
-rw-r--r--gst/qtdemux/qtatomparser.h30
1 files changed, 28 insertions, 2 deletions
diff --git a/gst/qtdemux/qtatomparser.h b/gst/qtdemux/qtatomparser.h
index 44f40c2a..dbd6b820 100644
--- a/gst/qtdemux/qtatomparser.h
+++ b/gst/qtdemux/qtatomparser.h
@@ -104,10 +104,10 @@ qt_atom_parser_peek_sub (QtAtomParser * parser, guint offset, guint size,
{
*sub = *parser;
- if (G_UNLIKELY (!gst_byte_reader_skip (sub, offset)))
+ if (G_UNLIKELY (!qt_atom_parser_skip (sub, offset)))
return FALSE;
- return (gst_byte_reader_get_remaining (sub) >= size);
+ return (qt_atom_parser_get_remaining (sub) >= size);
}
static inline gboolean
@@ -122,4 +122,30 @@ qt_atom_parser_skipn_and_get_uint32 (QtAtomParser * parser,
return TRUE;
}
+/* off_size must be either 4 or 8 */
+static inline gboolean
+qt_atom_parser_get_offset (QtAtomParser * parser, guint off_size, guint64 * val)
+{
+ if (G_UNLIKELY (qt_atom_parser_get_remaining (parser) < off_size))
+ return FALSE;
+
+ if (off_size == sizeof (guint64)) {
+ *val = qt_atom_parser_get_uint64_unchecked (parser);
+ } else {
+ *val = qt_atom_parser_get_uint32_unchecked (parser);
+ }
+ return TRUE;
+}
+
+/* off_size must be either 4 or 8 */
+static inline guint64
+qt_atom_parser_get_offset_unchecked (QtAtomParser * parser, guint off_size)
+{
+ if (off_size == sizeof (guint64)) {
+ return qt_atom_parser_get_uint64_unchecked (parser);
+ } else {
+ return qt_atom_parser_get_uint32_unchecked (parser);
+ }
+}
+
#endif /* QT_ATOM_PARSER_H */