((AVDMGenericAudioStream *) NULL, AudioNone,NULL);
changeAudioStream((AVDMGenericAudioStream *) NULL, AudioNone,NULL);
void HandleAction (Action action){  static int recursive = 0;  uint32_t nf = 0;  uint32_t old;  // handle out of band actions  // independant load not loaded//------------------------------------------------  switch (action)    {      case ACT_Ocr:                ADM_ocr_engine( );                return;      case ACT_AudioConfigure:    		audioCodecSelect();		return;	case ACT_VideoConfigure:    		videoCodecSelect();		return;    case ACT_VideoCodecChanged:    		    		videoCodecChanged(UI_getCurrentVCodec());		return;   case ACT_AudioCodecChanged:   		audioCodecChanged(UI_getCurrentACodec());    				return;        case ACT_RunScript:    			 GUI_FileSelRead ("Select script to load ",(SELFILE_CB *) parseScript);    		return;		    case ACT_RecentFiles:    	char *file;		if(		DIA_RecentFiles(&file))		{			A_openAvi2 (file, 0);		}		return;    case ACT_About :    		 DIA_about( );		 return;    case ACT_VideoCodec:      //videoCodecSelect ();      videoCodecConfigureUI();      return;    case ACT_AudioCodec:      //audioCodecSelect ();      audioCodecConfigure();      return;    case ACT_AudioFilters:      audioFilter_configureFilters ();      return;    case ACT_Pref:    	if(DIA_Preferences())	{	saveEncoderConfig (); 	#ifdef HAVE_AUDIO           		AVDM_audioSave(); 	#endif           	prefs->save ();		}      	return;    case ACT_SavePref:      saveEncoderConfig (); #ifdef HAVE_AUDIO           AVDM_audioSave(); #endif           prefs->save ();      return;    case ACT_SetLogFile://      GUI_FileSelWrite ("Select log File to use", encoderSetLogFile);	GUI_Alert("Obsolete!");      return;      break;    case ACT_SetMuxParam:      ADM_aviUISetMuxer();      return;      break;    case ACT_OuputToggle:      guiOutputDisplay ^= 1;      return;    case ACT_MpegIndex:      A_mpegIndexer ();      return;      break;#ifdef HAVE_AUDIO          	case ACT_SelectDevOSS:				   AVDM_switch (DEVICE_OSS);				   return;break;    	case ACT_SelectDevDummy:				   AVDM_switch (DEVICE_DUMMY);				   return;break;    	case ACT_SelectDevArts:				   AVDM_switch (DEVICE_ARTS);				   return;break;	case ACT_SelectDevALSA:				   AVDM_switch (DEVICE_ALSA);				   return;break;#endif                                      case ACT_Fast:      ADM_assert(0);      break;    case ACT_Exit:      { uint8_t saveprefsonexit;         prefs->get(FEATURE_SAVEPREFSONEXIT,&saveprefsonexit);         if( saveprefsonexit )            prefs->save ();      }      cleanUp ();      delete prefs;      prefs=NULL;      exit (0);    case ACT_AudioModeToggle:      if( !recursive )      {        audioProcessMode ^= 1;        recursive = 1;        UI_setAProcessToggleStatus(audioProcessMode);        recursive = 0;        printf ("\n audio is now : %d\n", audioProcessMode);      }      return;    case ACT_VideoModeToggle:      if( !recursive )      {        videoProcessMode ^= 1;        recursive = 1;        UI_setVProcessToggleStatus(videoProcessMode);        recursive = 0;        printf ("\n video is now : %d\n", videoProcessMode);      }      return;    case ACT_AudioModeProcess:      if( !recursive )      {        audioProcessMode = 1;        recursive = 1;        UI_setAProcessToggleStatus(audioProcessMode);        recursive = 0;        printf ("\n audio is now : %d\n", audioProcessMode);      }      return;      break;    case ACT_AudioModeCopy:      if( !recursive )      {        audioProcessMode = 0;        recursive = 1;        UI_setAProcessToggleStatus(audioProcessMode);        recursive = 0;        printf ("\n audio is now : %d\n", audioProcessMode);      }      return;      break;    case ACT_VideoModeCopy:      if( !recursive )      {        videoProcessMode = 0;        recursive = 1;        UI_setVProcessToggleStatus(videoProcessMode);        recursive = 0;        printf ("\n video is now : %d\n", videoProcessMode);      }      return;      break;    case ACT_VideoModeProcess:      if( !recursive )      {        videoProcessMode = 1;        recursive = 1;        UI_setVProcessToggleStatus(videoProcessMode);        recursive = 0;        printf ("\n video is now : %d\n", videoProcessMode);      }      return;      break;/*			case ACT_SelectEncoder:										A_selectEncoder();  	  			return;						break;*/    case ACT_SelectEncoder:      GUI_Alert ("Obsolete !");      break;    default:      break;    }//------------------------------------------------                                        if (playing)			// only allow some action    {      switch (action)	{	case ACT_PlayAvi:	case ACT_StopAvi:	  A_playAvi ();	  break;	default:	  return;	}    }  // not playing  // allow all actions  // restict disabled uncoded actions  if ((int) action > 160)    {      GUI_Alert ("Not coded on this version");      return;    }  // allow only if avi loaded  if (!avifileinfo)    {      switch (action)	{	case ACT_OpenAvi:          GUI_FileSelRead ("Select AVI file...", (SELFILE_CB *)A_openAvi);	  break;	case ACT_BrokenAvi:	  printf ("\n Opening in broken mode...\n");	  GUI_FileSelRead ("Select AVI file...", A_openBrokenAvi);	  break;	default:	  ;	}      return;    }//#define TEST_UNPACK      // we have an AVI loaded  switch (action)    {    case ACT_Bitrate:    			{				uint32_t a,b;				DIA_Calculator(&a,&b );			}    			break;    case ACT_SaveUnpackedMpeg4:    			if(GUI_Question("This is to be used to undo packed vop on mpeg4.\nContinue ?"))			{ 				GUI_FileSelWrite ("Select Avi file to write", (SELFILE_CB *)A_SaveUnpackedVop);							}    			break;#ifdef TEST_UNPACK    case ACT_Requant:    			video_body->unpackPacked();			break;#else        case ACT_Requant:    			A_requantize();			break;#endif			    case ACT_SaveDVDPS:    			A_saveDVDPS(NULL);    			break;    case ACT_SaveOGM:    			 GUI_FileSelWrite ("Select OGM file to write", (SELFILE_CB *)ogmSave);    			break;				    case ACT_FrameChanged:    			printf("FrameChanged\n");			break;  	case ACT_TimeChanged:			printf("TimeChanged\n");      			break;			#if 0    case ACT_Pipe2Lame:		 A_Pipe(P_TOOLAME);    	break; case ACT_PipeLame:		 A_Pipe(P_LAME);    	break;case ACT_Pipe2Other:		 A_Pipe(P_OTHER);    	break;#endif    case ACT_SaveWork:      GUI_FileSelWrite ("Select workbench to save ", A_saveWorkbench);      break;    case ACT_SaveCurrentWork:      if( actual_workbench_file ){        char *tmp = ADM_strdup(actual_workbench_file);         A_saveWorkbench( tmp ); // will write "actual_workbench_file" itself         ADM_dealloc(tmp);      }else{         GUI_FileSelWrite ("Select workbench to save ", A_saveWorkbench);      }      break;	case ACT_JumpToFrame: 		// read value				printf("Jump!\n");	 			nf=UI_readCurFrame();			if(nf>0 && nf< avifileinfo->nb_frames)			{				GUI_GoToFrame(nf);			}			UI_JumpDone();		break;	    case ACT_SaveRaw:      GUI_FileSelWrite ("Select raw file to save ", (SELFILE_CB *)ADM_saveRaw);      break;    case ACT_CutWizard:      ADM_cutWizard ();      break;    case ACT_SecondAudioAC3:	      A_handleSecondTrack (2);      break;    case ACT_SecondAudioMP3:      A_handleSecondTrack (1);      break;    case ACT_SecondAudioNONE:      A_handleSecondTrack (0);      break;    case ACT_OpenAvi:      GUI_FileSelRead ("Select AVI file...",(SELFILE_CB *) A_openAvi);      break;    case ACT_BrokenAvi:      GUI_FileSelRead ("Select AVI file...", A_openBrokenAvi);      break;    case ACT_AppendAvi:      GUI_FileSelRead ("Select AVI file to append...",(SELFILE_CB *) A_appendAvi);      break;    case ACT_SaveWave:      	{	GUI_FileSelWrite ("Select file to save audio",(SELFILE_CB *)A_audioSave);		}      break;    case ACT_AviInfo:      DIA_properties ();      break;    case ACT_Begin:      GUI_GoToFrame (0);      break;	case ACT_BitRate:		 GUI_displayBitrate(  );	break;    case ACT_End:      nf = avifileinfo->nb_frames;      GUI_GoToFrame (nf - 1);      break;    case ACT_PlayAvi:      GUI_PlayAvi ();      break;    case ACT_SaveDualAudio:      //GUI_FileSelWrite ("Select AVI to save ",      A_SaveAudioDualAudio(NULL);      break;    case ACT_SaveBunchJPG:    	GUI_FileSelWrite ("Select Jpeg sequence to save ", A_saveBunchJpg);          	break;    case ACT_SaveImg:      GUI_FileSelWrite ("Select BMP to save ", A_saveImg);      //GUI_FileSelWrite ("Select Jpg to save ", A_saveJpg);      break;    case ACT_SaveJPG :    	GUI_FileSelWrite ("Select Jpeg to save ", (SELFILE_CB *)A_saveJpg);      	//GUI_FileSelWrite ("Select Jpg to save ", A_saveJpg);      	break;        case ACT_Scale:      if (!ignore_change)	{	  ignore_change++;	  nf = GUI_GetScale ();	  GUI_GoToKFrame (nf);	  ignore_change--;	}//        printf("\n new frame : %lu",nf);      break;    case ACT_PreviewToggle:      mode_preview = UI_getPreviewToggleStatus ();      printf ("\n Preview is now : %d", mode_preview);      if (mode_preview)	{	  editorReignitPreview ();	  video_body->activateCache();	  editorUpdatePreview (curframe);	}      else      {	editorKillPreview ();	//video_body->desactivateCache();      }      break;    case ACT_StopAvi:      if (playing)	GUI_PlayAvi ();      break;    case ACT_SetPostProcessing:      A_setPostproc();      break;    case ACT_NextFrame:      GUI_NextFrame ();      break;    case ACT_NextKFrame:      GUI_NextKeyFrame ();      break;    case ACT_NextBlackFrame:      GUI_NextPrevBlackFrame(1);      break;    case ACT_PrevBlackFrame:      GUI_NextPrevBlackFrame(-1);      break;    case ACT_AllBlackFrames:           GUI_FileSelWrite ("Select file to save", (SELFILE_CB *)A_ListAllBlackFrames);        break;                                case ACT_PreviousFrame:      if (curframe)	{	  DIA_StartBusy ();	  GUI_GoToFrame (curframe - 1);	  DIA_StopBusy ();	  	}      break;    case ACT_Forward50Frames:      GUI_GoToFrame (curframe + 50);      break;    case ACT_Forward25Frames:      GUI_GoToFrame (curframe + 25);      break;    case ACT_Back50Frames:      if (curframe >= 50)	{	  DIA_StartBusy ();	  GUI_GoToFrame (curframe - 50);	  DIA_StopBusy ();	}      break;    case ACT_Back25Frames:      if (curframe >= 25)	{	  DIA_StartBusy ();	  GUI_GoToFrame (curframe - 25);	  DIA_StopBusy ();	}      break;    case ACT_PreviousKFrame:      GUI_PreviousKeyFrame ();      break;    case ACT_AudioSourceAvi:      //currentaudiostream=aviaudiostream;      changeAudioStream (aviaudiostream, AudioAvi,NULL);      //wavinfo= currentaudiostream->getInfo();      break;    case ACT_AudioSourceMP3:      GUI_FileSelRead ("Select MP3 to load ", (SELFILE_CB *)A_loadMP3);      break;    case ACT_AudioSourceAC3:      GUI_FileSelRead ("Select AC3 to load ", (SELFILE_CB *)A_loadAC3);      break;    case ACT_AudioSourceWAV:      GUI_FileSelRead ("Select WAV to load ",(SELFILE_CB *) A_loadWave);      break;    case ACT_AudioSourceNone:      //currentaudiostream=(AVDMGenericAudioStream *)NULL;       ((AVDMGenericAudioStream *) NULL, AudioNone,NULL);      break;      case ACT_MarkA:    case ACT_MarkB:      uint8_t swapit;      if( prefs->get(FEATURE_SWAP_IF_A_GREATER_THAN_B, &swapit) != RC_OK )         swapit = 1;      if (action == ACT_MarkA)	frameStart = curframe;      else	frameEnd = curframe;      if (frameStart > frameEnd && swapit )	// auto swap	{	  uint32_t y;	  y = frameStart;	  frameStart = frameEnd;	  frameEnd = y;	}      UI_setMarkers (frameStart, frameEnd);      break;    case ACT_GotoMarkA:    case ACT_GotoMarkB:      if (action == ACT_GotoMarkA)	nf = frameStart;      else	nf = frameEnd;      GUI_GoToFrame (nf);      break;    case ACT_Goto:      uint32_t fn;      fn=curframe;      if (DIA_GetIntegerValue ((int *)&fn,0,avifileinfo->nb_frames,"Go to Frame","Enter new frame number"))	{	  if (fn)	    {			// 0 probably means garbage	      if (fn < avifileinfo->nb_frames)		{		  curframe = fn;		  GUI_GoToFrame (curframe);		}	      else		GUI_Alert ("Out of bounds!");	    }	}      break;//----------------------test-----------------------    case ACT_SaveAvi:      GUI_FileSelWrite ("Select  file to save ",(SELFILE_CB *)A_Save); // A_SaveAudioNVideo);      break;//---------------------------------------------------    case ACT_Copy:      		if( frameEnd < frameStart ){      		   GUI_Alert("Marker A < B: can't copy");      		}else{    		   video_body->copyToClipBoard (frameStart,frameEnd);      		}		break;    case ACT_Paste:      		video_body->pasteFromClipBoard(curframe);		 old=curframe;      		ReSync ();	  	if (!video_body->updateVideoInfo (avifileinfo))		{	  		GUI_Alert ("Something bad happened (II)...");		}     		 rebuild_status_bar ();      		UI_setMarkers (frameStart, frameEnd); 		curframe=old;        	GUI_GoToFrame (curframe);		break;      break;    case ACT_VideoCheck:    		A_videoCheck();		break;    case ACT_ResetSegments:       if(avifileinfo)	if(GUI_Question("Are you sure ?"))	{		video_body->resetSeg();  		video_body->getVideoInfo (avifileinfo);		frameEnd=avifileinfo->nb_frames-1;      		frameStart=0;      		rebuild_status_bar ();      		UI_setMarkers (frameStart, frameEnd);      		ReSync ();		// forget last project file		if( actual_workbench_file ){			ADM_dealloc(actual_workbench_file);			actual_workbench_file = NULL;		}	}	break;    case ACT_Delete:    case ACT_Cut:               old=frameStart;      if( A_delete(frameStart,frameEnd))      {      	if (old >= avifileinfo->nb_frames)	{			// we removed too much	  old = avifileinfo->nb_frames - 1;	}      	curframe=old;	       	GUI_GoToFrame (old);            }                  break;    case ACT_AudioMap:      printf ("\n making audio timeline\n");      if (currentaudiostream)	{	  currentaudiostream->buildAudioTimeLine ();	}      break;    case ACT_ChangeFPS:    	{      	float  fps;	 aviInfo info;	 video_body->getVideoInfo (&info);       	fps=info.fps1000;	fps/=1000.;      	if (DIA_GetFloatValue (&fps, 1., 60., "Change Frame per Second","New FPS ?"))	{		  info.fps1000 = (uint32_t) (floor (fps * 1000.+0.49));	  video_body->updateVideoInfo (&info);	  // update display	  video_body->getVideoInfo (avifileinfo);	 }	}      break;      // set decoder option (post processing ...)    case ACT_DecoderOption:      video_body->setDecodeParam ( curframe);      break;    case ACT_VideoParameter:      // first remove current viewer      if (mode_preview)	editorKillPreview ();      GUI_handleFilter ();      if (mode_preview)	editorUpdatePreview (curframe);      break;    case ACT_RebuildKF:      if (GUI_Question ("Rebuild all Keyframes?"))	{	  A_rebuildKeyFrame ();	  GUI_Alert ("Save your file and restart Avidemux!");	}      break;    default:      printf ("\n unhandled action %d\n", action);      ADM_assert (0);      return;    }  // gtk_widget_grab_focus(sb_frame);}