# HG changeset patch # User reimar # Date 1196520958 0 # Node ID 57a3258ec1fc1119374b5ca4e15e7c5821e2f984 # Parent f2036002cac34601fd611f0d50df7d26cc44949d Use a pointer variable for extradata to simplify init_avi_with_ogg diff -r f2036002cac3 -r 57a3258ec1fc libmpdemux/demux_ogg.c --- a/libmpdemux/demux_ogg.c Sat Dec 01 14:29:53 2007 +0000 +++ b/libmpdemux/demux_ogg.c Sat Dec 01 14:55:58 2007 +0000 @@ -1242,6 +1242,7 @@ demux_packet_t *dp; sh_audio_t *sh_audio = demuxer->audio->sh; int np; + uint8_t *extradata = sh_audio->wf + 1; unsigned char *p = NULL,*buf; int plen; @@ -1251,7 +1252,9 @@ goto fallback; } /// Get the size of the 3 header packet - memcpy(hdrsizes, ((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX), 3*sizeof(uint32_t)); + extradata += 22; + memcpy(hdrsizes, extradata, 3*sizeof(uint32_t)); + extradata += 3*sizeof(uint32_t); // printf("\n!!!!!! hdr sizes: %d %d %d \n",hdrsizes[0],hdrsizes[1],hdrsizes[2]); /// Check the size @@ -1295,15 +1298,17 @@ /// Add the header packets in the ogg demuxer audio stream // Initial header dp = new_demux_packet(hdrsizes[0]); - memcpy(dp->buffer,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t),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,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0],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,((unsigned char*)sh_audio->wf)+22+sizeof(WAVEFORMATEX)+3*sizeof(uint32_t)+hdrsizes[0]+hdrsizes[1],hdrsizes[2]); + memcpy(dp->buffer,extradata,hdrsizes[2]); ds_add_packet(od->audio,dp); // Finish setting up the ogg demuxer