pesparse: Remove unused argument
authorEdward Hervey <edward@collabora.com>
Wed, 14 Aug 2013 08:33:14 +0000 (10:33 +0200)
committerEdward Hervey <edward@collabora.com>
Wed, 14 Aug 2013 08:33:14 +0000 (10:33 +0200)
We always provided 0 as the offset and never used the returned value.

Based on feedback from Stas Sergeev <stsp@list.ru>

https://bugzilla.gnome.org/show_bug.cgi?id=657343

gst/mpegtsdemux/pesparse.c
gst/mpegtsdemux/pesparse.h
gst/mpegtsdemux/tsdemux.c

index 28150a1..258badc 100644 (file)
@@ -37,8 +37,6 @@ GST_DEBUG_CATEGORY_STATIC (pes_parser_debug);
  * @data: data to parse (starting from, and including, the sync code)
  * @length: size of @data in bytes
  * @res: PESHeader to fill (only valid with #PES_PARSING_OK.
- * @offset: Offset in @data to the data to parse. If #PES_PARSING_OK, offset to
- *         first byte of data after the header.
  *
  * Parses the mpeg-ts PES header located in @data into the @res.
  *
@@ -47,8 +45,7 @@ GST_DEBUG_CATEGORY_STATIC (pes_parser_debug);
  * is needed to properly parse the header.
  */
 PESParsingResult
-mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res,
-    gint * offset)
+mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res)
 {
   PESParsingResult ret = PES_PARSING_NEED_MORE;
   gsize origlength = length;
@@ -57,11 +54,6 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res,
   guint8 val8, flags;
 
   g_return_val_if_fail (res != NULL, PES_PARSING_BAD);
-  g_return_val_if_fail (offset != NULL, PES_PARSING_BAD);
-  g_return_val_if_fail (*offset < length, PES_PARSING_BAD);
-
-  data += *offset;
-  length -= *offset;
 
   /* The smallest valid PES header is 6 bytes (prefix + stream_id + length) */
   if (G_UNLIKELY (length < 6))
@@ -377,7 +369,6 @@ done_parsing:
       origlength, length);
 
   res->header_size = origlength - length;
-  *offset += res->header_size;
   ret = PES_PARSING_OK;
 
   return ret;
index 54417cf..694e802 100644 (file)
@@ -190,8 +190,9 @@ typedef struct {
   const guint8*        stream_id_extension_data;
 } PESHeader;
 
-G_GNUC_INTERNAL PESParsingResult mpegts_parse_pes_header (const guint8* data, gsize size,
-                                         PESHeader *res, gint *offset);
+G_GNUC_INTERNAL PESParsingResult mpegts_parse_pes_header (const guint8* data,
+                                                         gsize size,
+                                                         PESHeader *res);
 G_GNUC_INTERNAL void init_pes_parser (void);
 
 G_END_DECLS
index 6089276..5f94af7 100644 (file)
@@ -1254,12 +1254,11 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream,
     guint8 * data, guint32 length, guint64 bufferoffset)
 {
   PESHeader header;
-  gint offset = 0;
   PESParsingResult parseres;
 
   GST_MEMDUMP ("Header buffer", data, MIN (length, 32));
 
-  parseres = mpegts_parse_pes_header (data, length, &header, &offset);
+  parseres = mpegts_parse_pes_header (data, length, &header);
   if (G_UNLIKELY (parseres == PES_PARSING_NEED_MORE))
     goto discont;
   if (G_UNLIKELY (parseres == PES_PARSING_BAD)) {