⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 interface.c

📁 君正早期ucos系统(只有早期的才不没有打包成库),MPLAYER,文件系统,图片解码,浏览,电子书,录音,想学ucos,识货的人就下吧 russblock fmradio explore set
💻 C
📖 第 1 页 / 共 3 页
字号:
	 }#endif// -- subtitle	//subdata->filename=gstrdup( guiIntfStruct.Subtitlename );	stream_dump_type=0;	if ( gtkSubDumpMPSub ) stream_dump_type=4;	if ( gtkSubDumpSrt ) stream_dump_type=6;	gtkSubDumpMPSub=gtkSubDumpSrt=0;        guiLoadFont();// --- misc		    	if ( gtkCacheOn ) stream_cache_size=gtkCacheSize;	if ( gtkAutoSyncOn ) autosync=gtkAutoSync;        if ( guiIntfStruct.AudioFile ) audio_stream=gstrdup( guiIntfStruct.AudioFile );	  else if ( guiIntfStruct.FilenameChanged ) gfree( (void**)&audio_stream );	  //audio_stream=NULL;	        guiIntfStruct.DiskChanged=0;        guiIntfStruct.FilenameChanged=0;        guiIntfStruct.NewPlay=0;#ifdef USE_ASS        ass_enabled = gtkASS.enabled;        ass_use_margins = gtkASS.use_margins;        ass_top_margin = gtkASS.top_margin;        ass_bottom_margin = gtkASS.bottom_margin;#endif	break;  } return False;}void guiEventHandling( void ){ if ( !guiIntfStruct.Playing || guiIntfStruct.NoWindow ) wsHandleEvents(); gtkEventHandling();}// --- float gtkEquChannels[6][10];plItem * plCurrent = NULL;plItem * plList = NULL;plItem * plLastPlayed = NULL;URLItem *URLList = NULL;char    *fsHistory[fsPersistant_MaxPos] = { NULL,NULL,NULL,NULL,NULL };#if defined( MP_DEBUG ) && 0void list( void ){ plItem * next = plList; printf( "--- list ---\n" ); while( next || next->next )  {   printf( "item: %s/%s\n",next->path,next->name );   if ( next->next ) next=next->next; else break;  } printf( "--- end of list ---\n" );}#else#define list();#endifvoid * gtkSet( int cmd,float fparam, void * vparam ){ equalizer_t * eq = (equalizer_t *)vparam; plItem      * item = (plItem *)vparam;  URLItem     * url_item = (URLItem *)vparam; int           is_added = True; switch ( cmd )  {// --- handle playlist   case gtkAddPlItem: // add item to playlist	if ( plList )	 {	  plItem * next = plList;	  while ( next->next ) { /*printf( "%s\n",next->name );*/ next=next->next; }	  next->next=item; item->prev=next;	 } else { item->prev=item->next=NULL; plCurrent=plList=item; }        list();        return NULL;   case gtkInsertPlItem: // add item into playlist after current	if ( plCurrent )	 {	  plItem * curr = plCurrent;	  item->next=curr->next;	  if (item->next)	    item->next->prev=item;	  item->prev=curr;	  curr->next=item;	  plCurrent=plCurrent->next;	  return plCurrent;	 }	 else	   return gtkSet(gtkAddPlItem,0,(void*)item);        return NULL;   case gtkGetNextPlItem: // get current item from playlist	if ( plCurrent && plCurrent->next)	 {	  plCurrent=plCurrent->next;	  /*if ( !plCurrent && plList ) 	   {	    plItem * next = plList;	    while ( next->next ) { if ( !next->next ) break; next=next->next; }	    plCurrent=next;	   }*/	  return plCurrent;	 }        return NULL;   case gtkGetPrevPlItem:	if ( plCurrent && plCurrent->prev)	 {	  plCurrent=plCurrent->prev;	  //if ( !plCurrent && plList ) plCurrent=plList;	  return plCurrent;	 }	return NULL;   case gtkSetCurrPlItem: // set current item	plCurrent=item;        return plCurrent;   case gtkGetCurrPlItem: // get current item        return plCurrent;   case gtkDelCurrPlItem: // delete current item	{	 plItem * curr = plCurrent;	 if (!curr)	   return NULL;	 if (curr->prev)	   curr->prev->next=curr->next;	 if (curr->next)	   curr->next->prev=curr->prev;	 if (curr==plList)	   plList=curr->next;	 plCurrent=curr->next;	 // Free it	 if ( curr->path ) free( curr->path );	 if ( curr->name ) free( curr->name );	 free( curr );         }	mplCurr(); // Instead of using mplNext && mplPrev	return plCurrent;   case gtkDelPl: // delete list        {	 plItem * curr = plList;	 plItem * next;	 if ( !plList ) return NULL;	 if ( !curr->next )	  {	   if ( curr->path ) free( curr->path );	   if ( curr->name ) free( curr->name );	   free( curr ); 	  }	  else	   {	    while ( curr->next )	     {	      next=curr->next;	      if ( curr->path ) free( curr->path );	      if ( curr->name ) free( curr->name );	      free( curr ); 	      curr=next;	     }	   }	  plList=NULL; plCurrent=NULL;	}        return NULL;   // ----- Handle url   case gtkAddURLItem:        if ( URLList )	 {          URLItem * next_url = URLList;          is_added = False;          while ( next_url->next )           {            if ( !gstrcmp( next_url->url,url_item->url ) )             {              is_added=True;              break;             }            next_url=next_url->next;           }          if ( ( !is_added )&&( gstrcmp( next_url->url,url_item->url ) ) ) next_url->next=url_item;         } else { url_item->next=NULL; URLList=url_item; }        return NULL;// --- subtitle#ifndef HAVE_FREETYPE   case gtkSetFontFactor:        font_factor=fparam;	guiLoadFont();	return NULL;#else   case gtkSetFontOutLine:        subtitle_font_thickness=( 8.0f / 100.0f ) * fparam;	guiLoadFont();	return NULL;   case gtkSetFontBlur:	subtitle_font_radius=( 8.0f / 100.0f ) * fparam;	guiLoadFont();	return NULL;   case gtkSetFontTextScale:	text_font_scale_factor=fparam;	guiLoadFont();	return NULL;   case gtkSetFontOSDScale:	osd_font_scale_factor=fparam;	guiLoadFont();	return NULL;   case gtkSetFontEncoding:	gfree( (void **)&subtitle_font_encoding );	subtitle_font_encoding=gstrdup( (char *)vparam );	guiLoadFont();	return NULL;   case gtkSetFontAutoScale:	subtitle_autoscale=(int)fparam;	guiLoadFont();	return NULL;#endif#ifdef USE_ICONV   case gtkSetSubEncoding:	gfree( (void **)&sub_cp );	sub_cp=gstrdup( (char *)vparam );	break;#endif// --- misc   case gtkClearStruct:        if ( (unsigned int)vparam & guiFilenames )	 {	  gfree( (void **)&guiIntfStruct.Filename );	  gfree( (void **)&guiIntfStruct.Subtitlename );	  gfree( (void **)&guiIntfStruct.AudioFile );	  gtkSet( gtkDelPl,0,NULL );	 }#ifdef USE_DVDREAD	if ( (unsigned int)vparam & guiDVD ) memset( &guiIntfStruct.DVD,0,sizeof( guiDVDStruct ) );#endif#ifdef HAVE_VCD	if ( (unsigned int)vparam & guiVCD ) guiIntfStruct.VCDTracks=0;#endif	return NULL;   case gtkSetExtraStereo:        gtkAOExtraStereoMul=fparam;        if (guiIntfStruct.afilter)          af_control_any_rev(guiIntfStruct.afilter,             AF_CONTROL_ES_MUL | AF_CONTROL_SET, &gtkAOExtraStereoMul);        return NULL;   case gtkSetPanscan:        {	 mp_cmd_t * mp_cmd;         mp_cmd=calloc( 1,sizeof( *mp_cmd ) );         mp_cmd->id=MP_CMD_PANSCAN;    mp_cmd->name=strdup( "panscan" );	 mp_cmd->args[0].v.f=fparam;   mp_cmd->args[1].v.i=1;	 mp_input_queue_cmd( mp_cmd );	}        return NULL;   case gtkSetAutoq:	auto_quality=(int)fparam;	return NULL;// --- set equalizers   case gtkSetContrast:        if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"contrast",(int)fparam );	return NULL;   case gtkSetBrightness:        if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"brightness",(int)fparam );	return NULL;   case gtkSetHue:        if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"hue",(int)fparam );	return NULL;   case gtkSetSaturation:        if ( guiIntfStruct.sh_video ) set_video_colors( guiIntfStruct.sh_video,"saturation",(int)fparam );	return NULL;   case gtkSetEqualizer:     {        af_control_ext_t tmp;        if ( eq )	 {          gtkEquChannels[eq->channel][eq->band]=eq->gain;          tmp.ch = eq->channel;          tmp.arg = gtkEquChannels[eq->channel];          if (guiIntfStruct.afilter)            af_control_any_rev(guiIntfStruct.afilter,               AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);	 }	 else	  {	   int i;	   memset( gtkEquChannels,0,sizeof( gtkEquChannels ) );	   if (guiIntfStruct.afilter)	   for ( i=0;i<6;i++ )	    {	     tmp.ch = i;	     tmp.arg = gtkEquChannels[i];	     af_control_any_rev(guiIntfStruct.afilter,	        AF_CONTROL_EQUALIZER_GAIN | AF_CONTROL_SET, &tmp);	    }	  }	return NULL;     }  } return NULL;}#define mp_basename(s) (strrchr(s,'/')==NULL?(char*)s:(strrchr(s,'/')+1))#include "playtree.h"//This function adds/inserts one file into the gui playlistint import_file_into_gui(char* temp, int insert){  char *filename, *pathname;  plItem * item;	  filename = strdup(mp_basename(temp));  pathname = strdup(temp);  if (strlen(pathname)-strlen(filename)>0)    pathname[strlen(pathname)-strlen(filename)-1]='\0'; // We have some path so remove / at end  else    pathname[strlen(pathname)-strlen(filename)]='\0';  mp_msg(MSGT_PLAYTREE,MSGL_V, "Adding filename %s && pathname %s\n",filename,pathname); //FIXME: Change to MSGL_DBG2 ?  item=calloc( 1,sizeof( plItem ) );  if (!item)     return 0;  item->name=filename;  item->path=pathname;  if (insert)    gtkSet( gtkInsertPlItem,0,(void*)item ); // Inserts the item after current, and makes current=item  else    gtkSet( gtkAddPlItem,0,(void*)item );  return 1;}// This function imports the initial playtree (based on cmd-line files) into the gui playlist// by either://   - overwriting gui pl (enqueue=0)//   - appending it to gui pl (enqueue=1)int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue){  play_tree_iter_t* my_pt_iter=NULL;  int result=0;    if (!enqueue) // Delete playlist before "appending"    gtkSet(gtkDelPl,0,0);    if((my_pt_iter=pt_iter_create(&my_playtree,config)))  {    while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)    {      if (import_file_into_gui(filename, 0)) // Add it to end of list        result=1;    }  }  mplCurr(); // Update filename  mplGotoTheNext=1;  if (!enqueue)    filename=guiIntfStruct.Filename; // Backward compatibility; if file is specified on commandline,  				     // gmplayer does directly start in Play-Mode.  else     filename=NULL;  return result;}// This function imports and inserts an playtree, that is created "on the fly", for example by// parsing some MOV-Reference-File; or by loading an playlist with "File Open"//// The file which contained the playlist is thereby replaced with it's contents.int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config){   play_tree_iter_t* my_pt_iter=NULL;  int result=0;  plItem * save=(plItem*)gtkSet( gtkGetCurrPlItem, 0, 0); // Save current item  if((my_pt_iter=pt_iter_create(&my_playtree,config)))  {    while ((filename=pt_iter_get_next_file(my_pt_iter))!=NULL)    {      if (import_file_into_gui(filename, 1)) // insert it into the list and set plCurrent=new item         result=1;    }    pt_iter_destroy(&my_pt_iter);  }  if (save)     gtkSet(gtkSetCurrPlItem, 0, (void*)save);  else    gtkSet(gtkSetCurrPlItem, 0, (void*)plList); // go to head, if plList was empty before  if (save && result)    gtkSet(gtkDelCurrPlItem, 0, 0);    mplCurr();  // Update filename  filename=NULL;    return result;}// wrapper function for mp_msg to display a message box for errors and warnings.void guiMessageBox(int level, char * str) {	switch(level) {		case MSGL_FATAL:			gtkMessageBox(GTK_MB_FATAL|GTK_MB_SIMPLE, str);			break;		case MSGL_ERR:			gtkMessageBox(GTK_MB_ERROR|GTK_MB_SIMPLE, str);			break;#if 0// WARNING! Do NOT enable this! There are too many non-critical messages with// MSGL_WARN, for example: broken SPU packets, codec's bit error messages,// etc etc, they should not raise up a new window every time.		case MSGL_WARN:			gtkMessageBox(GTK_MB_WARNING|GTK_MB_SIMPLE, str);			break;#endif	}}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -