changeset 25203:36b9262aaa0f

Use a loop instead of doing the same thing three times
author reimar
date Sat, 01 Dec 2007 14:58:00 +0000
parents 57a3258ec1fc
children dbad71c68ed6
files libmpdemux/demux_ogg.c
diffstat 1 files changed, 7 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_ogg.c	Sat Dec 01 14:55:58 2007 +0000
+++ b/libmpdemux/demux_ogg.c	Sat Dec 01 14:58:00 2007 +0000
@@ -1243,6 +1243,7 @@
   sh_audio_t *sh_audio = demuxer->audio->sh;
   int np;
   uint8_t *extradata = sh_audio->wf + 1;
+  int i;
   unsigned char *p = NULL,*buf;
   int plen;
 
@@ -1296,20 +1297,12 @@
   od = new_demuxer(s,DEMUXER_TYPE_OGG,0,-2,-2,NULL);
 
   /// Add the header packets in the ogg demuxer audio stream
-  // Initial header
-  dp = new_demux_packet(hdrsizes[0]);
-  memcpy(dp->buffer,extradata,hdrsizes[0]);
-  ds_add_packet(od->audio,dp);
-  extradata += hdrsizes[0];
-  /// Comments
-  dp = new_demux_packet(hdrsizes[1]);
-  memcpy(dp->buffer,extradata,hdrsizes[1]);
-  ds_add_packet(od->audio,dp);
-  extradata += hdrsizes[1];
-  /// Code book
-  dp = new_demux_packet(hdrsizes[2]);
-  memcpy(dp->buffer,extradata,hdrsizes[2]);
-  ds_add_packet(od->audio,dp);
+  for (i = 0; i < 3; i++) {
+    dp = new_demux_packet(hdrsizes[i]);
+    memcpy(dp->buffer,extradata,hdrsizes[i]);
+    ds_add_packet(od->audio,dp);
+    extradata += hdrsizes[i];
+  }
 
   // Finish setting up the ogg demuxer
   od->priv = ogg_d;