[xiph-cvs] cvs commit: snatch snatchconvert.c
Monty
xiphmont at xiph.org
Fri Feb 22 07:16:02 PST 2002
xiphmont 02/02/22 07:16:02
Modified: . snatchconvert.c
Log:
more fixes to new framing
Revision Changes Path
1.8 +23 -17 snatch/snatchconvert.c
Index: snatchconvert.c
===================================================================
RCS file: /usr/local/cvsroot/snatch/snatchconvert.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- snatchconvert.c 2002/02/22 14:21:14 1.7
+++ snatchconvert.c 2002/02/22 15:16:01 1.8
@@ -322,6 +322,12 @@
#endif
}
+static void rebuffer_sample(long pos,int nofakep){
+ short v=0;
+ if(nofakep)v=audbuf[audbuf_head+pos];
+ buffer_sample(v,nofakep);
+}
+
static int convert_input(unsigned char *buf,int fmt,int *v){
switch(fmt){
case 4:
@@ -391,23 +397,23 @@
int read_snatch_frame_helper(FILE *f,long length,int verify){
long toread=length-buftemphead+buftemptail+5;
- if(toread+buftemphead+1>buftempsize){
- if(buftemp)
- buftemp=realloc(buftemp,(toread+buftemphead+1)*sizeof(*buftemp));
- else
- buftemp=malloc((toread+buftemphead+1)*sizeof(*buftemp));
- buftempsize+=toread+1;
+ if(toread>0){
+ if(toread+buftemphead>buftempsize){
+ if(buftemp)
+ buftemp=realloc(buftemp,(toread+buftemphead)*sizeof(*buftemp));
+ else
+ buftemp=malloc((toread+buftemphead)*sizeof(*buftemp));
+ buftempsize+=toread;
+ }
+
+ if((long)fread(buftemp+buftemphead,1,toread,f)!=toread)return(0);
+ buftemphead+=toread;
}
- if((long)fread(buftemp+buftemphead,1,toread,f)!=toread)return(0);
- buftemphead+=toread;
-
- buftemp[buftemphead]='\0';
-
if(verify){
- if(strstr(buftemp+buftemphead-5,"AUDIO"))return(1);
- if(strstr(buftemp+buftemphead-5,"VIDEO"))return(1);
- if(strstr(buftemp+buftemphead-5,"YUV12"))return(1);
+ if(!strncmp(buftemp+buftemptail+length,"AUDIO",5))return(1);
+ if(!strncmp(buftemp+buftemptail+length,"VIDEO",5))return(1);
+ if(!strncmp(buftemp+buftemptail+length,"YUV12",5))return(1);
return(0);
}else{
return(1);
@@ -469,14 +475,14 @@
roundoff error does *not* creep frame to frame) */
if(audbuf_channels>1){
for(i=actualpos-nextsamplepos-12;i>0;i-=2){
- buffer_sample(audbuf[audbuf_head-2],track_or_process);
- buffer_sample(audbuf[audbuf_head-2],track_or_process);
+ rebuffer_sample(-2,track_or_process);
+ rebuffer_sample(-2,track_or_process);
samplesmissing++;
//fprintf(stderr,".");
}
}else{
for(i=actualpos-nextsamplepos-12;i>0;i--){
- buffer_sample(audbuf[audbuf_head-1],track_or_process);
+ rebuffer_sample(-1,track_or_process);
samplesmissing++;
//fprintf(stderr,".");
}
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list