[MPlayer-users] Vobsub split Question

Olaf Zielke olaf.zielke at berlin.de
Fri Nov 15 23:21:02 CET 2002


On Fri, Nov 15, 2002 at 03:24:28PM -0600, Green, Shaun wrote:
> [Automatic answer: RTFM (read DOCS, FAQ), also read DOCS/bugreports.html]
> 
> And how do you split the binary .sub file? What program?
> 
 

bool
SplitFiles(const std::string altfile,const std::string neufile,
const int von,int bis) {

  FILE *orginal=fopen(altfile.c_str(),"r+b"); 
  if (orginal==0)  return false;
  struct stat fileinfo;
  fstat(fileno(orginal),&fileinfo); 
  if (bis==-1) bis=fileinfo.st_size;
 
  FILE *neu=fopen(neufile.c_str(),"w+b"); 
  if (neu==0)  {return false;}    
  int diff=bis-von;
  fseek(orginal,von,SEEK_SET);
  char *index=0;
  index=new char[diff+1];
  memset(index,0,diff);
  fread(index,diff,1,orginal); 
  fwrite(index,diff,1,neu);              
  free (index);	  
  fclose(neu);
	          
  fclose(orginal);
  return true;
}

Just a quick hack:-)
 
 SplitFiles(idxfile+".sub",idxfile+"-1.sub",0,<idxposition>);
 SplitFiles(idxfile+".sub",idxfile+"-2.sub",<idxposition>,-1); 
  
 -1 mean the end of file;
 
Take it as an idea.
Bye
 
 




More information about the MPlayer-users mailing list