[xiph-commits] r13215 - trunk/vorbis/lib

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Tue Jul 3 16:53:43 PDT 2007


Author: xiphmont
Date: 2007-07-03 16:53:43 -0700 (Tue, 03 Jul 2007)
New Revision: 13215

Modified:
   trunk/vorbis/lib/vorbisfile.c
Log:
New vorbisfile multiplexing support passes built-in playback and seeking 
tests.



Modified: trunk/vorbis/lib/vorbisfile.c
===================================================================
--- trunk/vorbis/lib/vorbisfile.c	2007-07-03 21:31:52 UTC (rev 13214)
+++ trunk/vorbis/lib/vorbisfile.c	2007-07-03 23:53:43 UTC (rev 13215)
@@ -1330,8 +1330,14 @@
 	    if(result) goto seek_error;
 	  }
 	}else{
-	  ogg_int64_t granulepos=ogg_page_granulepos(&og);
+	  ogg_int64_t granulepos;
+
+	  if(ogg_page_serialno(&og)!=vf->serialnos[link])
+	    continue;
+
+	  granulepos=ogg_page_granulepos(&og);
 	  if(granulepos==-1)continue;
+	  
 	  if(granulepos<target){
 	    best=result;  /* raw offset of packet with granulepos */ 
 	    begin=vf->offset; /* raw offset of next page */
@@ -1378,7 +1384,7 @@
 	_decode_clear(vf);  
 	
 	vf->current_link=link;
-	vf->current_serialno=ogg_page_serialno(&og);
+	vf->current_serialno=vf->serialnos[link];
 	vf->ready_state=STREAMSET;
 	
       }else{
@@ -1403,8 +1409,9 @@
 	  while(1){
 	    result=_get_prev_page(vf,&og);
 	    if(result<0) goto seek_error;
-	    if(ogg_page_granulepos(&og)>-1 ||
-	       !ogg_page_continued(&og)){
+	    if(ogg_page_serialno(&og)==vf->current_serialno &&
+	       (ogg_page_granulepos(&og)>-1 ||
+		!ogg_page_continued(&og))){
 	      return ov_raw_seek(vf,result);
 	    }
 	    vf->offset=result;
@@ -1495,19 +1502,20 @@
       
       /* suck in a new page */
       if(_get_next_page(vf,&og,-1)<0)break;
-      if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
+      if(ogg_page_bos(&og))_decode_clear(vf);
       
       if(vf->ready_state<STREAMSET){
+	long serialno=ogg_page_serialno(&og);
 	int link;
 	
-	vf->current_serialno=ogg_page_serialno(&og);
 	for(link=0;link<vf->links;link++)
-	  if(vf->serialnos[link]==vf->current_serialno)break;
-	if(link==vf->links)return(OV_EBADLINK);
+	  if(vf->serialnos[link]==serialno)break;
+	if(link==vf->links) continue; 
 	vf->current_link=link;
 	
-	ogg_stream_reset_serialno(&vf->os,vf->current_serialno); 
 	vf->ready_state=STREAMSET;      
+	vf->current_serialno=ogg_page_serialno(&og);
+	ogg_stream_reset_serialno(&vf->os,serialno); 
 	ret=_make_decode_ready(vf);
 	if(ret)return ret;
 	lastblock=0;



More information about the commits mailing list