pesparse: Remove unused argument

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
This commit is contained in:
Edward Hervey 2013-08-14 10:33:14 +02:00
parent 0bd6f374c8
commit 5208b8a050
3 changed files with 5 additions and 14 deletions

View file

@ -37,8 +37,6 @@ GST_DEBUG_CATEGORY_STATIC (pes_parser_debug);
* @data: data to parse (starting from, and including, the sync code) * @data: data to parse (starting from, and including, the sync code)
* @length: size of @data in bytes * @length: size of @data in bytes
* @res: PESHeader to fill (only valid with #PES_PARSING_OK. * @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. * 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. * is needed to properly parse the header.
*/ */
PESParsingResult PESParsingResult
mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res, mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res)
gint * offset)
{ {
PESParsingResult ret = PES_PARSING_NEED_MORE; PESParsingResult ret = PES_PARSING_NEED_MORE;
gsize origlength = length; gsize origlength = length;
@ -57,11 +54,6 @@ mpegts_parse_pes_header (const guint8 * data, gsize length, PESHeader * res,
guint8 val8, flags; guint8 val8, flags;
g_return_val_if_fail (res != NULL, PES_PARSING_BAD); 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) */ /* The smallest valid PES header is 6 bytes (prefix + stream_id + length) */
if (G_UNLIKELY (length < 6)) if (G_UNLIKELY (length < 6))
@ -377,7 +369,6 @@ done_parsing:
origlength, length); origlength, length);
res->header_size = origlength - length; res->header_size = origlength - length;
*offset += res->header_size;
ret = PES_PARSING_OK; ret = PES_PARSING_OK;
return ret; return ret;

View file

@ -190,8 +190,9 @@ typedef struct {
const guint8* stream_id_extension_data; const guint8* stream_id_extension_data;
} PESHeader; } PESHeader;
G_GNUC_INTERNAL PESParsingResult mpegts_parse_pes_header (const guint8* data, gsize size, G_GNUC_INTERNAL PESParsingResult mpegts_parse_pes_header (const guint8* data,
PESHeader *res, gint *offset); gsize size,
PESHeader *res);
G_GNUC_INTERNAL void init_pes_parser (void); G_GNUC_INTERNAL void init_pes_parser (void);
G_END_DECLS G_END_DECLS

View file

@ -1254,12 +1254,11 @@ gst_ts_demux_parse_pes_header (GstTSDemux * demux, TSDemuxStream * stream,
guint8 * data, guint32 length, guint64 bufferoffset) guint8 * data, guint32 length, guint64 bufferoffset)
{ {
PESHeader header; PESHeader header;
gint offset = 0;
PESParsingResult parseres; PESParsingResult parseres;
GST_MEMDUMP ("Header buffer", data, MIN (length, 32)); 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)) if (G_UNLIKELY (parseres == PES_PARSING_NEED_MORE))
goto discont; goto discont;
if (G_UNLIKELY (parseres == PES_PARSING_BAD)) { if (G_UNLIKELY (parseres == PES_PARSING_BAD)) {