uint32_t pcm,audiolen;
uint32_t audiolen;
void mpeg_passthrough(  char *name ){  uint32_t len, flags;  AVDMGenericAudioStream *audio=NULL;  uint32_t pcm,audiolen;  uint8_t *buffer = new uint8_t[avifileinfo->width * avifileinfo->height * 3];    DIA_working *work;  MpegMuxer *muxer=NULL;    	printf("Saving as mpg PS to file %s\n",name);    	// First we check it is mpeg  	if(!fourCC::check(avifileinfo->fcc,(uint8_t *)"MPEG"))  	{  		GUI_Alert("This is not a mpeg.\nSwitch to process mode.");		return ;  	}  	if(!currentaudiostream)  	{  		GUI_Alert("There is no audio track.");		return ;  	}    	audio=mpt_getAudioStream(&pcm);	if(!audio)	{		GUI_Alert("Audio track is not suitable!\n");		return;	}			if(!pcm)	{		GUI_Alert("Audio track is not suitable(2)!\n");		return;	}	  	muxer=new MpegMuxer();	if(!muxer->open(name,MUX_MPEG_VRATE,avifileinfo->fps1000,audio->getInfo()))	{		delete muxer;		muxer=NULL;		printf("Muxer init failed\n");		return ;			}    ///____________________________  work=new DIA_working("Saving MpegPS stream");  // preamble  video_body->getRawStart (frameStart, buffer, &len);  muxer->writeVideoPacket (len,buffer);  for (uint32_t i = frameStart; i < frameEnd; i++)    {      work->update (i - frameStart, frameEnd - frameStart);      if(!work->isAlive()) goto _abt;      assert (video_body->getFlags (i, &flags));      if (flags & AVI_B_FRAME)	// oops	{	  // se search for the next i /p	  uint32_t found = 0;	for (uint32_t j = i + 1; j < frameEnd; j++)	{		assert (video_body->getFlags (j, &flags));		if (!(flags & AVI_B_FRAME))		{			found = j;			break;		}	}	if (!found)	    goto _abt;	  // Write the found frame	video_body->getRaw (found, buffer, &len);	muxer->writeVideoPacket (len,buffer);	audiolen=pcm;	audiolen = audio->read (audiolen,buffer);	if(audiolen)		muxer->writeAudioPacket(audiolen,buffer);	  	  // and the B frames	for (uint32_t j = i; j < found; j++)	    {		video_body->getRaw (j, buffer, &len);		muxer->writeVideoPacket (len,buffer);		audiolen=pcm;		audiolen = audio->read (audiolen,buffer);		if(audiolen)			muxer->writeAudioPacket(audiolen,buffer);	    }	  i = found;		// Will be plussed by for	}      else			// P or I frame	{	  	video_body->getRaw (i, buffer, &len);		muxer->writeVideoPacket (len,buffer);		audiolen=pcm;		audiolen = audio->read (audiolen,buffer);		if(audiolen)			muxer->writeAudioPacket(audiolen,buffer);	}    }_abt:  delete work;  muxer->close();  delete muxer;  delete buffer;  deleteAudioFilter();}