diff --git a/examples/seeking_example.c b/examples/seeking_example.c index 7b30d8e4c46fac99e095554b8907a63448a2444c..1418cb17f8160569861dec3e9cc4f4ab7fbe6858 100644 --- a/examples/seeking_example.c +++ b/examples/seeking_example.c @@ -158,6 +158,7 @@ static void verify_seek(OggOpusFile *_of,opus_int64 _byte_offset, if(nsamples<0){ fprintf(stderr,"\nFailed to read PCM data after seek: %i\n",nsamples); nfailures++; + li=op_current_link(_of); } for(lj=0;lj
.*/ - if(*path_end=='#'){ - uri_end=fragment_end=path_end+1+strspn(path_end+1,OP_URL_QUERY_FRAG); - } + if(*path_end=='#')uri_end=path_end+1+strspn(path_end+1,OP_URL_QUERY_FRAG); else uri_end=path_end; /*If there's anything left, this was not a valid URL.*/ - if(OP_UNLIKELY(*path_end!='\0'))return OP_EINVAL; + if(OP_UNLIKELY(*uri_end!='\0'))return OP_EINVAL; _dst->scheme=op_string_range_dup(_src,scheme_end); if(OP_UNLIKELY(_dst->scheme==NULL))return OP_EFAULT; op_string_tolower(_dst->scheme); diff --git a/src/opusfile.c b/src/opusfile.c index 4579cebb2aadad88788c4cb370b0057497e8023d..293b87c144106d641a4285d6d9cada514e4ae675 100644 --- a/src/opusfile.c +++ b/src/opusfile.c @@ -1353,7 +1353,6 @@ static int op_open1(OggOpusFile *_of, _of->seekable=seekable; /*Don't seek yet. Set up a 'single' (current) logical bitstream entry for partial open.*/ - _of->nlinks=1; _of->links=(OggOpusLink *)_ogg_malloc(sizeof(*_of->links)); /*The serialno gets filled in later by op_fetch_headers().*/ ogg_stream_init(&_of->os,-1); @@ -1364,6 +1363,7 @@ static int op_open1(OggOpusFile *_of, ret=op_fetch_headers(_of,&_of->links[0].head,&_of->links[0].tags, &_of->serialnos,&_of->nserialnos,&_of->cserialnos,pog); if(OP_UNLIKELY(ret<0))break; + _of->nlinks=1; _of->links[0].offset=0; _of->links[0].data_offset=_of->offset; _of->links[0].pcm_end=-1; @@ -1374,8 +1374,10 @@ static int op_open1(OggOpusFile *_of, /*This link was empty, but we already have the BOS page for the next one in og. We can't seek, so start processing the next link right now.*/ + opus_tags_clear(&_of->links[0].tags); + _of->nlinks=0; + if(!seekable)_of->cur_link++; pog=&og; - _of->cur_link++; } if(OP_UNLIKELY(ret<0)){ /*Don't auto-close the stream on failure.*/