Home | History | Annotate | Download | only in Tremolo

Lines Matching refs:vf

91 static long _get_data(OggVorbis_File *vf){
93 if(vf->datasource){
94 unsigned char *buffer=ogg_sync_bufferin(vf->oy,CHUNKSIZE);
95 long bytes=(vf->callbacks.read_func)(buffer,1,CHUNKSIZE,vf->datasource);
96 if(bytes>0)ogg_sync_wrote(vf->oy,bytes);
104 static void _seek_helper(OggVorbis_File *vf,ogg_int64_t offset){
105 if(vf->datasource){
106 (vf->callbacks.seek_func)(vf->datasource, offset, SEEK_SET);
107 vf->offset=offset;
108 ogg_sync_reset(vf->oy);
130 static ogg_int64_t _get_next_page(OggVorbis_File *vf,ogg_page *og,
132 if(boundary>0)boundary+=vf->offset;
136 if(boundary>0 && vf->offset>=boundary)return OV_FALSE;
137 more=ogg_sync_pageseek(vf->oy,og);
141 vf->offset-=more;
147 long ret=_get_data(vf);
154 ogg_int64_t ret=vf->offset;
155 vf->offset+=more;
169 static ogg_int64_t _get_prev_page(OggVorbis_File *vf,ogg_page *og){
170 ogg_int64_t begin=vf->offset;
179 _seek_helper(vf,begin);
180 while(vf->offset<end){
181 ret=_get_next_page(vf,og,end-vf->offset);
192 _seek_helper(vf,offset);
193 ret=_get_next_page(vf,og,CHUNKSIZE);
205 static int _bisect_forward_serialno(OggVorbis_File *vf,
227 _seek_helper(vf,bisect);
228 ret=_get_next_page(vf,&og,-1);
239 _seek_helper(vf,next);
240 ret=_get_next_page(vf,&og,-1);
245 vf->links=m+1;
246 vf->offsets=_ogg_malloc((vf->links+1)*sizeof(*vf->offsets));
247 vf->serialnos=_ogg_malloc(vf->links*sizeof(*vf->serialnos));
248 vf->offsets[m+1]=searched;
250 ret=_bisect_forward_serialno(vf,next,vf->offset,
256 vf->offsets[m]=begin;
257 vf->serialnos[m]=currentno;
261 static int _decode_clear(OggVorbis_File *vf){
262 if(vf->ready_state==INITSET){
263 vorbis_dsp_destroy(vf->vd);
264 vf->vd=0;
265 vf->ready_state=STREAMSET;
268 if(vf->ready_state>=STREAMSET){
269 vorbis_info_clear(&vf->vi);
270 vorbis_comment_clear(&vf->vc);
271 vf->ready_state=OPENED;
276 /* uses the local ogg_stream storage in vf; this is important for
281 static int _fetch_headers(OggVorbis_File *vf,
290 if(vf->ready_state>OPENED)_decode_clear(vf);
293 ogg_int64_t llret=_get_next_page(vf,&og,CHUNKSIZE);
299 ogg_stream_reset_serialno(vf->os,ogg_page_serialno(og_ptr));
300 if(serialno)*serialno=vf->os->serialno;
310 ogg_stream_pagein(vf->os,og_ptr);
312 int result=ogg_stream_packetout(vf->os,&op);
324 if(_get_next_page(vf,og_ptr,CHUNKSIZE)<0){
332 vf->ready_state=LINKSET;
340 vf->ready_state=OPENED;
348 static int _set_link_number(OggVorbis_File *vf,int link){
349 if(link != vf->current_link) _decode_clear(vf);
350 if(vf->ready_state<STREAMSET){
351 _seek_helper(vf,vf->offsets[link]);
352 ogg_stream_reset_serialno(vf->os,vf->serialnos[link]);
353 vf->current_serialno=vf->serialnos[link];
354 vf->current_link=link;
355 return _fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,NULL);
360 static int _set_link_number_preserve_pos(OggVorbis_File *vf,int link){
361 ogg_int64_t pos=vf->offset;
362 int ret=_set_link_number(vf,link);
364 _seek_helper(vf,pos);
365 if(pos<vf->offsets[link] || pos>=vf->offsets[link+1])
366 vf->ready_state=STREAMSET;
379 static void _prefetch_all_offsets(OggVorbis_File *vf, ogg_int64_t dataoffset){
384 vf->dataoffsets=_ogg_malloc(vf->links*sizeof(*vf->dataoffsets));
385 vf->pcmlengths=_ogg_malloc(vf->links*2*sizeof(*vf->pcmlengths));
387 for(i=0;i<vf->links;i++){
390 vf->dataoffsets[i]=dataoffset;
391 _seek_helper(vf,dataoffset);
397 _seek_helper(vf,vf->offsets[i]);
398 if(_fetch_headers(vf,&vf->vi,&vf->vc,NULL,NULL)<0){
399 vf->dataoffsets[i]=-1;
401 vf->dataoffsets[i]=vf->offset;
407 if(vf->dataoffsets[i]!=-1){
412 ogg_stream_reset_serialno(vf->os,vf->serialnos[i]);
417 ret=_get_next_page(vf,&og,-1);
423 if(ogg_page_serialno(&og)!=vf->serialnos[i])
429 ogg_stream_pagein(vf->os,&og);
430 while((result=ogg_stream_packetout(vf->os,&op))){
432 long thisblock=vorbis_packet_blocksize(&vf->vi,&op);
451 vf->pcmlengths[i*2]=accumulated;
457 ogg_int64_t end=vf->offsets[i+1];
458 _seek_helper(vf,end);
461 ret=_get_prev_page(vf,&og);
464 vorbis_info_clear(&vf->vi);
465 vorbis_comment_clear(&vf->vc);
469 vf->pcmlengths[i*2+1]=ogg_page_granulepos(&og)-vf->pcmlengths[i*2];
472 vf->offset=ret;
479 static int _make_decode_ready(OggVorbis_File *vf){
481 switch(vf->ready_state){
484 for(i=0;i<vf->links;i++)
485 if(vf->offsets[i+1]>=vf->offset)break;
486 if(i==vf->links)return -1;
487 i=_set_link_number_preserve_pos(vf,i);
491 vf->vd=vorbis_dsp_create(&vf->vi);
492 vf->ready_state=INITSET;
493 vf->bittrack=0;
494 vf->samptrack=0;
503 static int _open_seekable2(OggVorbis_File *vf){
504 ogg_uint32_t serialno=vf->current_serialno;
506 ogg_int64_t dataoffset=vf->offset, end;
510 storage in vf */
512 (vf->callbacks.seek_func)(vf->datasource,0,SEEK_END);
513 vf->offset=vf->end=(vf->callbacks.tell_func)(vf->datasource);
517 end=_get_prev_page(vf,&og);
528 if(_bisect_forward_serialno(vf,0,0,end+1,serialno,0)<0)return OV_EREAD;
533 if(_bisect_forward_serialno(vf,0,end,end+1,serialno,0))return OV_EREAD;
537 /* the initial header memory is referenced by vf after; don't free it */
538 _prefetch_all_offsets(vf,dataoffset);
539 return ov_raw_seek(vf,0);
553 static int _fetch_and_process_packet(OggVorbis_File *vf,
566 if(vf->ready_state==INITSET){
568 int result=ogg_stream_packetout(vf->os,&op);
578 if(!vorbis_dsp_synthesis(vf->vd,&op,1)){ /* lazy check for lazy
586 vf->samptrack+=vorbis_dsp_pcmout(vf->vd,NULL,0);
587 vf->bittrack+=op.bytes*8;
591 int link=(vf->seekable?vf->current_link:0);
607 if(vf->seekable && link>0)
608 granulepos-=vf->pcmlengths[link*2];
614 samples=vorbis_dsp_pcmout(vf->vd,NULL,0);
618 granulepos+=vf->pcmlengths[i*2+1];
619 vf->pcm_offset=granulepos;
630 if(vf->ready_state>=OPENED){
636 ret=(int)_get_next_page(vf,&og,-1);
644 vf->bittrack+=og.header_len*8;
647 if(vf->ready_state==INITSET){
648 if(vf->current_serialno!=ogg_page_serialno(&og)){
654 _decode_clear(vf);
671 if(vf->ready_state!=INITSET){
674 if(vf->ready_state<STREAMSET){
675 if(vf->seekable){
676 vf->current_serialno=ogg_page_serialno(&og);
681 for(link=0;link<vf->links;link++)
682 if(vf->serialnos[link]==vf->current_serialno)break;
683 if(link==vf->links){
689 vf->current_link=link;
690 ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,&og);
697 int ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,&og);
699 vf->current_link++;
703 if(_make_decode_ready(vf)) return OV_EBADLINK;
705 ogg_stream_pagein(vf->os,&og);
720 static int _ov_open1(void *f,OggVorbis_File *vf,char *initial,
725 memset(vf,0,sizeof(*vf));
731 vf->datasource=f;
732 vf->callbacks = callbacks;
735 vf->oy=ogg_sync_create();
742 unsigned char *buffer=ogg_sync_bufferin(vf->oy,ibytes);
744 ogg_sync_wrote(vf->oy,ibytes);
748 if(offsettest!=-1)vf->seekable=1;
752 vf->links=1;
753 vf->os=ogg_stream_create(-1); /* fill in the serialno later */
756 if((ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,NULL))<0){
757 vf->datasource=NULL;
758 ov_clear(vf);
759 }else if(vf->ready_state < PARTOPEN)
760 vf->ready_state=PARTOPEN;
764 static int _ov_open2(OggVorbis_File *vf){
765 if(vf->ready_state < OPENED)
766 vf->ready_state=OPENED;
767 if(vf->seekable){
768 int ret=_open_seekable2(vf);
770 vf->datasource=NULL;
771 ov_clear(vf);
780 int ov_clear(OggVorbis_File *vf){
781 if(vf){
782 vorbis_dsp_destroy(vf->vd);
783 vf->vd=0;
784 ogg_stream_destroy(vf->os);
785 vorbis_info_clear(&vf->vi);
786 vorbis_comment_clear(&vf->vc);
787 if(vf->dataoffsets)_ogg_free(vf->dataoffsets);
788 if(vf->pcmlengths)_ogg_free(vf->pcmlengths);
789 if(vf->serialnos)_ogg_free(vf->serialnos);
790 if(vf->offsets)_ogg_free(vf->offsets);
791 ogg_sync_destroy(vf->oy);
793 if(vf->datasource)(vf->callbacks.close_func)(vf->datasource);
794 memset(vf,0,sizeof(*vf));
810 int ov_open_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
812 int ret=_ov_open1(f,vf,initial,ibytes,callbacks);
814 return _ov_open2(vf);
817 int ov_open(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
825 return ov_open_callbacks((void *)f, vf, initial, ibytes, callbacks);
833 int ov_test_callbacks(void *f,OggVorbis_File *vf,char *initial,long ibytes,
836 return _ov_open1(f,vf,initial,ibytes,callbacks);
839 int ov_test(FILE *f,OggVorbis_File *vf,char *initial,long ibytes){
847 return ov_test_callbacks((void *)f, vf, initial, ibytes, callbacks);
850 int ov_test_open(OggVorbis_File *vf){
851 if(vf->ready_state!=PARTOPEN)return OV_EINVAL;
852 return _ov_open2(vf);
856 long ov_streams(OggVorbis_File *vf){
857 return vf->links;
860 /* Is the FILE * associated with vf seekable? */
861 long ov_seekable(OggVorbis_File *vf){
862 return vf->seekable;
874 long ov_bitrate(OggVorbis_File *vf,int i){
875 if(vf->ready_state<OPENED)return OV_EINVAL;
876 if(i>=vf->links)return OV_EINVAL;
877 if(!vf->seekable && i!=0)return ov_bitrate(vf,0);
881 for(i=0;i<vf->links;i++)
882 bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
883 /* This once read: return(rint(bits/ov_time_total(vf,-1)));
887 return (long)(bits*1000/ov_time_total(vf,-1));
889 if(vf->seekable){
891 return (long)((vf->offsets[i+1]-vf->dataoffsets[i])*8000/ov_time_total(vf,i));
894 if(vf->vi.bitrate_nominal>0){
895 return vf->vi.bitrate_nominal;
897 if(vf->vi.bitrate_upper>0){
898 if(vf->vi.bitrate_lower>0){
899 return (vf->vi.bitrate_upper+vf->vi.bitrate_lower)/2;
901 return vf->vi.bitrate_upper;
914 long ov_bitrate_instant(OggVorbis_File *vf){
916 if(vf->ready_state<OPENED)return OV_EINVAL;
917 if(vf->samptrack==0)return OV_FALSE;
918 ret=(long)(vf->bittrack/vf->samptrack*vf->vi.rate);
919 vf->bittrack=0;
920 vf->samptrack=0;
925 long ov_serialnumber(OggVorbis_File *vf,int i){
926 if(i>=vf->links)return ov_serialnumber(vf,vf->links-1);
927 if(!vf->seekable && i>=0)return ov_serialnumber(vf,-1);
929 return vf->current_serialno;
931 return vf->serialnos[i];
940 ogg_int64_t ov_raw_total(OggVorbis_File *vf,int i){
941 if(vf->ready_state<OPENED)return OV_EINVAL;
942 if(!vf->seekable || i>=vf->links)return OV_EINVAL;
946 for(i=0;i<vf->links;i++)
947 acc+=ov_raw_total(vf,i);
950 return vf->offsets[i+1]-vf->offsets[i];
959 ogg_int64_t ov_pcm_total(OggVorbis_File *vf,int i){
960 if(vf->ready_state<OPENED)return OV_EINVAL;
961 if(!vf->seekable || i>=vf->links)return OV_EINVAL;
965 for(i=0;i<vf->links;i++)
966 acc+=ov_pcm_total(vf,i);
969 return vf->pcmlengths[i*2+1];
978 ogg_int64_t ov_time_total(OggVorbis_File *vf,int i){
979 if(vf->ready_state<OPENED)return OV_EINVAL;
980 if(!vf->seekable || i>=vf->links)return OV_EINVAL;
984 for(i=0;i<vf->links;i++)
985 acc+=ov_time_total(vf,i);
988 return ((ogg_int64_t)vf->pcmlengths[i*2+1])*1000/vf->vi.rate;
999 int ov_raw_seek(OggVorbis_File *vf,ogg_int64_t pos){
1004 if(vf->ready_state<OPENED)return OV_EINVAL;
1005 if(!vf->seekable)
1008 if(pos<0 || pos>vf->end)return OV_EINVAL;
1014 vf->pcm_offset=-1;
1015 ogg_stream_reset_serialno(vf->os,
1016 vf->current_serialno); /* must set serialno */
1017 vorbis_dsp_restart(vf->vd);
1019 _seek_helper(vf,pos);
1027 the shared vf->os stream state. We use the local state to
1042 work_os=ogg_stream_create(vf->current_serialno); /* get the memory ready */
1044 if(vf->ready_state>=STREAMSET){
1050 if(vf->vi.codec_setup){
1051 thisblock=vorbis_packet_blocksize(&vf->vi,&op);
1053 ogg_stream_packetout(vf->os,NULL);
1058 ogg_stream_packetout(vf->os,NULL);
1064 int i,link=vf->current_link;
1065 ogg_int64_t granulepos=op.granulepos-vf->pcmlengths[link*2];
1069 granulepos+=vf->pcmlengths[i*2+1];
1070 vf->pcm_offset=granulepos-accblock;
1076 ogg_stream_packetout(vf->os,NULL);
1081 if(_get_next_page(vf,&og,-1)<0){
1082 vf->pcm_offset=ov_pcm_total(vf,-1);
1087 vf->pcm_offset=-1;
1092 if(vf->ready_state>=STREAMSET)
1093 if(vf->current_serialno!=ogg_page_serialno(&og)){
1094 _decode_clear(vf); /* clear out stream state */
1098 if(vf->ready_state<STREAMSET){
1101 vf->current_serialno=ogg_page_serialno(&og);
1102 for(link=0;link<vf->links;link++)
1103 if(vfvf->current_serialno)break;
1104 if(link==vf->links)
1110 int ret=_set_link_number_preserve_pos(vf,link);
1113 ogg_stream_reset_serialno(vf->os,vf->current_serialno);
1114 ogg_stream_reset_serialno(work_os,vf->current_serialno);
1123 ogg_stream_pagein(vf->os,&og);
1132 vf->bittrack=0;
1133 vf->samptrack=0;
1141 vf->pcm_offset=-1;
1143 _decode_clear(vf);
1153 int ov_pcm_seek_page(OggVorbis_File *vf,ogg_int64_t pos){
1156 ogg_int64_t total=ov_pcm_total(vf,-1);
1160 if(vf->ready_state<OPENED)return OV_EINVAL;
1161 if(!vf->seekable)return OV_ENOSEEK;
1165 for(link=vf->links-1;link>=0;link--){
1166 total-=vf->pcmlengths[link*2+1];
1171 if(link!=vf->current_link){
1172 int ret=_set_link_number(vf,link);
1175 vorbis_dsp_restart(vf->vd);
1178 ogg_stream_reset_serialno(vf->os,vf->serialnos[link]);
1188 ogg_int64_t end=vf->offsets[link+1];
1189 ogg_int64_t begin=vf->offsets[link];
1190 ogg_int64_t begintime = vf->pcmlengths[link*2];
1191 ogg_int64_t endtime = vf->pcmlengths[link*2+1]+begintime;
1208 _seek_helper(vf,bisect);
1211 result=_get_next_page(vf,&og,end-vf->offset);
1220 _seek_helper(vf,bisect);
1227 begin=vf->offset; /* raw offset of next page */
1236 if(end==vf->offset){ /* we're pretty close - we'd be stuck in */
1240 _seek_helper(vf,bisect);
1257 _seek_helper(vf,best);
1258 vf->pcm_offset=-1;
1260 if(_get_next_page(vf,&og,-1)<0){
1265 ogg_stream_pagein(vf->os,&og);
1269 result=ogg_stream_packetpeek(vf->os,&op);
1276 _seek_helper(vf,best);
1279 result=_get_prev_page(vf,&og);
1283 return ov_raw_seek(vf,result);
1285 vf->offset=result;
1293 vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
1294 if(vf->pcm_offset<0)vf->pcm_offset=0;
1295 vf->pcm_offset+=total;
1298 result=ogg_stream_packetout(vf->os,NULL);
1304 if(vf->pcm_offset>pos || pos>ov_pcm_total(vf,-1)){
1308 vf->bittrack=0;
1309 vf->samptrack=0;
1321 vf->pcm_offset=-1;
1322 _decode_clear(vf);
1329 int ov_pcm_seek(OggVorbis_File *vf,ogg_int64_t pos){
1333 int ret=ov_pcm_seek_page(vf,pos);
1335 if(_make_decode_ready(vf))return OV_EBADLINK;
1342 int ret=ogg_stream_packetpeek(vf->os,&op);
1344 thisblock=vorbis_packet_blocksize(&vf->vi,&op);
1346 ogg_stream_packetout(vf->os,NULL);
1349 if(lastblock)vf->pcm_offset+=(lastblock+thisblock)>>2;
1351 if(vf->pcm_offset+((thisblock+
1352 vorbis_info_blocksize(&vf->vi,1))>>2)>=pos)break;
1355 ogg_stream_packetout(vf->os,NULL);
1356 vorbis_dsp_synthesis(vf->vd,&op,0); /* set up a vb with
1366 vf->pcm_offset=op.granulepos-vf->pcmlengths[vf->current_link*2];
1367 if(vf->pcm_offset<0)vf->pcm_offset=0;
1368 for(i=0;i<vf->current_link;i++)
1369 vf->pcm_offset+=vf->pcmlengths[i*2+1];
1378 if(_get_next_page(vf,&og,-1)<0)break;
1379 if(vf->current_serialno!=ogg_page_serialno(&og))_decode_clear(vf);
1381 if(vf->ready_state<STREAMSET){
1384 vf->current_serialno=ogg_page_serialno(&og);
1385 for(link=0;link<vf->links;link++)
1386 if(vf->serialnos[link]==vf->current_serialno)break;
1387 if(link==vf->links){
1394 vf->current_link=link;
1395 ret=_fetch_headers(vf,&vf->vi,&vf->vc,&vf->current_serialno,&og);
1397 if(_make_decode_ready(vf))return OV_EBADLINK;
1401 ogg_stream_pagein(vf->os,&og);
1405 vf->bittrack=0;
1406 vf->samptrack=0;
1409 while(vf->pcm_offset<pos){
1410 ogg_int64_t target=pos-vf->pcm_offset;
1411 long samples=vorbis_dsp_pcmout(vf->vd,NULL,0);
1414 vorbis_dsp_read(vf->vd,samples);
1415 vf->pcm_offset+=samples;
1418 if(_fetch_and_process_packet(vf,1,1)<=0)
1419 vf->pcm_offset=ov_pcm_total(vf,-1); /* eof */
1429 int ov_time_seek(OggVorbis_File *vf,ogg_int64_t milliseconds){
1433 ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
1434 ogg_int64_t time_total=ov_time_total(vf,-1);
1436 if(vf->ready_state<OPENED)return OV_EINVAL;
1437 if(!vf->seekable)return OV_ENOSEEK;
1441 for(link=vf->links-1;link>=0;link--){
1442 pcm_total-=vf->pcmlengths[link*2+1];
1443 time_total-=ov_time_total(vf,link);
1449 int ret=_set_link_number(vf,link);
1452 ov_pcm_seek(vf,pcm_total+(milliseconds-time_total)*
1453 vf->vi.rate/1000);
1459 int ov_time_seek_page(OggVorbis_File *vf,ogg_int64_t milliseconds){
1463 ogg_int64_t pcm_total=ov_pcm_total(vf,-1);
1464 ogg_int64_t time_total=ov_time_total(vf,-1);
1466 if(vf->ready_state<OPENED)return OV_EINVAL;
1467 if(!vf->seekable)return OV_ENOSEEK;
1471 for(link=vf->links-1;link>=0;link--){
1472 pcm_total-=vf->pcmlengths[link*2+1];
1473 time_total-=ov_time_total(vf,link);
1479 int ret=_set_link_number(vf,link);
1482 ov_pcm_seek_page(vf,pcm_total+(milliseconds-time_total)*
1483 vf->vi.rate/1000);
1489 ogg_int64_t ov_raw_tell(OggVorbis_File *vf){
1490 if(vf->ready_state<OPENED)return OV_EINVAL;
1491 return vf->offset;
1495 ogg_int64_t ov_pcm_tell(OggVorbis_File *vf){
1496 if(vf->ready_state<OPENED)return OV_EINVAL;
1497 return vf->pcm_offset;
1501 ogg_int64_t ov_time_tell(OggVorbis_File *vf){
1506 if(vf->ready_state<OPENED)return OV_EINVAL;
1507 if(vf->seekable){
1508 pcm_total=ov_pcm_total(vf,-1);
1509 time_total=ov_time_total(vf,-1);
1512 for(link=vf->links-1;link>=0;link--){
1513 pcm_total-=vf->pcmlengths[link*2+1];
1514 time_total-=ov_time_total(vf,link);
1515 if(vf->pcm_offset>=pcm_total)break;
1519 return time_total+(1000*vf->pcm_offset-pcm_total)/vf->vi.rate;
1530 vorbis_info *ov_info(OggVorbis_File *vf,int link){
1531 if(vf->seekable){
1532 if(link>=vf->links)return NULL;
1534 int ret=_set_link_number_preserve_pos(vf,link);
1538 return &vf->vi;
1542 vorbis_comment *ov_comment(OggVorbis_File *vf,int link){
1543 if(vf->seekable){
1544 if(link>=vf->links)return NULL;
1546 int ret=_set_link_number_preserve_pos(vf,link);
1550 return &vf->vc;
1580 long ov_read(OggVorbis_File *vf,void *buffer,int bytes_req,int *bitstream){
1585 if(vf->ready_state<OPENED)return OV_EINVAL;
1588 if(vf->ready_state==INITSET){
1589 channels=vf->vi.channels;
1590 samples=vorbis_dsp_pcmout(vf->vd,buffer,(bytes_req>>1)/channels);
1593 vorbis_dsp_read(vf->vd,samples);
1594 vf->pcm_offset+=samples;
1595 if(bitstream)*bitstream=vf->current_link;
1604 int ret=_fetch_and_process_packet(vf,1,1);