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

📄 mode.c

📁 Zoran VP2K731 DVD源代码,极具参考价值!
💻 C
字号:
/***********************************************************************/
/* File:															   */
/*	  Copyright (c) 2000 ZORAN Corporation, All Rights Reserved		   */
/*	  THIS IS PROPRIETARY SOURCE CODE OF ZORAN CORPORATION             */
/*																	   */
/* ===========                                                         */
/* Descripton:                                                         */
/* ===========                                                         */
/*                                                                     */
/* Log:                                                                */
/* ===                                                                 */
/* $Name: V_1_16 V_1_15 V_1_14 V_1_13 V_1_12 NV_1_00 V_1_11 $                                                            
/* $Header: v:/dsg/rcs/dsg/vp2k/Customer/menu/zoran/mode.c 1.20 2001/06/06 06:15:09 dingming Exp $                                                          
/* $Log: mode.c $										                       
/* Revision 1.20  2001/06/06 06:15:09  dingming										                       
/* font 32X24 complile										                       
/* Revision 1.19  2001/01/10 01:19:31  charlie										                       
/* Don't stop when switching to Shuffle or Program mode.										                       
/* Revision 1.18  2000/12/13 03:25:36  charlie										                       
/* Fixed local table names ( iNoVcd... -> iVcd ) where appropriate										                       
/* Revision 1.17  2000/12/08 23:33:53  charlie										                       
/* Don't send play command if program size is 0										                       
/* Revision 1.16  2000/12/02 00:19:25  tia										                       
/* Only perform STOP/RESTART for CDDA not DVD when playmode changes.										                       
/* Revision 1.15  2000/11/19 00:05:44  charlie										                       
/* Checked for mode_action re Shuffle										                       
/* Revision 1.14  2000/11/17 18:54:15  charlie										                       
/* Use C_FOCUSED										                       
/* Revision 1.13  2000/11/14 05:29:07  charlie										                       
/* Added g_b_mode_pending for detection of play mode after static										                       
/* mode menu is closed										                       
/* Revision 1.12  2000/11/09 04:07:32  cliff										                       
/***********************************************************************/
#include <stdio.h>
#include <string.h>
#include "sysdefs.h"
#include "..\..\..\ui\menu_sys\ms_wdgt.h"
#include "..\..\..\ui\menu_sys\ms_lib.h"
#include "..\..\..\ui\menu_sys\osd_drv.h"
#include "..\..\..\decoder\osdrendr.h"
#include "..\..\..\decoder\osdlayou.h"
#ifdef FONT32X24  //DM0605
#include "..\..\..\customer\dragon\strings\strings.h"
#else
#include "..\..\..\ui\strings\strings.h"
#endif
#include "menu_var.h"
#include "..\..\..\playcore\ps\ps.h"
#include "..\..\..\playcore\coremain\coregdef.h"
#include "..\..\..\kernel\eventdef.h"

// REMINDER This is not needed if we don't use oHWLimit
#include "..\..\..\Decoder\decoder.h"
#include "..\..\..\playcore\PlayMode\playmode.h"
#include "mode.h"

#include "zmenu.h"

WORD g_w_private_program_size = 0;

BYTE g_b_mode_pending = PM_PLAYBACK_NORMAL;

/*

//
// Choice labels which should be defined and added to the parent by the caller
//

const MS_STATIC mssMode = {
	{
	0,
	ALIGN_LEFT,
	I_COLOR,
	{MODE_X, MODE_Y, 200, MS_LINE_HEIGHT},
	NO_PARENT,
	static_user_op,
	},
	(void *)S_MODE
};

const MS_STATIC mssRepeat = {
	{
	0,
	ALIGN_LEFT,
	I_COLOR,
	{REPEAT_X, REPEAT_Y, 200, MS_LINE_HEIGHT},
	NO_PARENT,
	static_user_op,
	},
	(void *)S_REPEAT
};

*/

//
// Non_VCD, no program list Mode item information
//

const OSD_MESSAGES novcd_noprog_mode_list_c[] = {
	S_OFF,
	S_SHUFFLE
};

const MS_TEXT_LIST novcd_noprog_mode_list = {
	2,(int *)novcd_noprog_mode_list_c
};

//
// VCD, no program list Mode item information
//

const OSD_MESSAGES vcd_noprog_mode_list_c[] = {
	S_OFF,
	S_SHUFFLE,
	S_PBC
};

const MS_TEXT_LIST vcd_noprog_mode_list = {
	3,(int *) vcd_noprog_mode_list_c
};

//
// Non_VCD Mode item information
//

const OSD_MESSAGES novcd_mode_list_c[] = {
	S_OFF,
	S_SHUFFLE,
	S_PROGRAM
};

const MS_TEXT_LIST novcd_mode_list = {
	3,(int *)novcd_mode_list_c
};

//
// VCD Mode item information
//

const OSD_MESSAGES vcd_mode_list_c[] = {
	S_OFF,
	S_SHUFFLE,
	S_PBC,
	S_PROGRAM
};

const MS_TEXT_LIST vcd_mode_list = {
	4,(int *) vcd_mode_list_c
};

//
// Repeat item information
//

const OSD_MESSAGES repeat_list_c[] = {
	S_OFF,
	S_SINGLE,
	S_ALL
};

const MS_TEXT_LIST repeat_list = {
	3,(int *)repeat_list_c
};

#ifdef D_PICTURE_CD_ENABLED	//DM1114 disable repeat one for jpg
const OSD_MESSAGES repeat_list_jpg_c[] = {
	S_OFF,
	S_ALL
};

const MS_TEXT_LIST repeat_list_jpg = {
	2,(int *)repeat_list_jpg_c
};
#endif
const OSD_MESSAGES repeat_list_dvd_c[] = {
	S_OFF,
	S_CHAPTER,
	S_TITLE
};

const MS_TEXT_LIST repeat_list_dvd = {
	3,(int *)repeat_list_dvd_c
};


//
// Non-VCD Mode handling
//

void novcd_noprog_mode_choice(MS_CHOICE *msChoice)
{
  int iChoice = ITEMNUM_NOVCD_NOPROG_OFF;
  
  BYTE playbackMode = PM_GetPlaybackMode();
  
  if ( PM_IsPlaybackShuffle(playbackMode) )
	iChoice = ITEMNUM_NOVCD_NOPROG_SHUFFLE;
  msChoice->current_choice = iChoice;
}

void novcd_mode_choice(MS_CHOICE *msChoice)
{
  int iChoice = ITEMNUM_NOVCD_OFF;
  
  BYTE playbackMode = PM_GetPlaybackMode();
  
  if ( PM_IsPlaybackShuffle(playbackMode) )
	iChoice = ITEMNUM_NOVCD_SHUFFLE;
  else
  if ( PM_IsPlaybackProgram(playbackMode) )
	iChoice = ITEMNUM_NOVCD_PROGRAM;
#ifdef SUPERFLUOUS
  else
  if ( PM_IsPlaybackNormal(playbackMode) )
	iChoice = ITEMNUM_NOVCD_OFF;
#endif // SUPERFLUOUS
  msChoice->current_choice = iChoice;
}

void handle_play_command( int iPlaybackMode )
{
  if ( g_ui_active_menu_id == MODE_RUN_TIME_MENU_ID )
  {
	if ( iPlaybackMode != PM_PLAYBACK_NORMAL )
	{
// <<< ZORAN CDE0109 : Don't stop playback when changing to Shuffle or Program modes
#ifdef DISABLE
	  ie_send(IE_CORE_STOP);
	  ie_send(IE_CORE_RESTART);
#endif // DISABLE
// ZORAN CDE0109 >>>
	}
  }
  else
	g_b_mode_pending = iPlaybackMode;
}

void handle_send_program( int iPlaybackMode )
{
  if ( g_ui_active_menu_id == MODE_RUN_TIME_MENU_ID )
  {
	mode_send_program();
	if ( mode_get_private_program_size() > 0 )
	  handle_play_command( iPlaybackMode );
  }
  else
	g_b_mode_pending = iPlaybackMode;
}

void novcd_noprog_mode_action(int num)
{
  int iNovcdPlayback[] = { PM_PLAYBACK_NORMAL, PM_PLAYBACK_SHUFFLE };

  dbouts("\nMode is ");
  dbouti( num );

  num = iNovcdPlayback[ num ];
  PM_SetPlaybackMode((BYTE) num);
  ie_send(IE_CORE_SEAMLESS_MODE_CHANGE);

  if (g_disc_type == DEC_DISC_TYPE_CDDA)
	handle_play_command( num );
}

void novcd_mode_action(int num)
{
  int iNovcdPlayback[] = { PM_PLAYBACK_NORMAL, PM_PLAYBACK_SHUFFLE, PM_PLAYBACK_PROGRAM };

#ifdef NO_C_STDLIB
  dbouts("\nMode is ");
  dbouti( num );
#endif

  num = iNovcdPlayback[ num ];
  if ( num != PM_PLAYBACK_PROGRAM )
  {
	PM_SetPlaybackMode((BYTE) num);
	ie_send(IE_CORE_SEAMLESS_MODE_CHANGE);

	handle_play_command( num );
  }
  else
  {
	handle_send_program( num );
  }
}

//
// VCD Mode handling
//

void vcd_noprog_mode_choice(MS_CHOICE *msChoice)
{
  int iChoice = ITEMNUM_VCD_NOPROG_OFF;
  
  BYTE playbackMode = PM_GetPlaybackMode();
  
  if ( PM_IsPlaybackShuffle(playbackMode) )
	iChoice = ITEMNUM_VCD_NOPROG_SHUFFLE;
  else
  if ( PM_IsPBC(playbackMode) )
	iChoice = ITEMNUM_VCD_NOPROG_PBC;
  msChoice->current_choice = iChoice;
}

void vcd_mode_choice(MS_CHOICE *msChoice)
{
  int iChoice = ITEMNUM_VCD_OFF;
  
  BYTE playbackMode = PM_GetPlaybackMode();
  
  if ( PM_IsPlaybackShuffle(playbackMode) )
	iChoice = ITEMNUM_VCD_SHUFFLE;
  else
  if ( PM_IsPlaybackProgram(playbackMode) )
	iChoice = ITEMNUM_VCD_PROGRAM;
  else
  if ( PM_IsPBC(playbackMode) )
	iChoice = ITEMNUM_VCD_PBC;
#ifdef SUPERFLUOUS
  else
  if ( PM_IsPlaybackNormal(playbackMode);
	iChoice = ITEMNUM_NOVCD_OFF;
#endif // SUPERFLUOUS
  msChoice->current_choice = iChoice;
}

void vcd_mode_action(int num)
{
  int iVcdPlayback[] = { PM_PLAYBACK_NORMAL, PM_PLAYBACK_SHUFFLE, PM_PBC_MASK, PM_PLAYBACK_PROGRAM };

  dbouts("\nMode is ");
  dbouti( num );

  num = iVcdPlayback[ num ];
  if ( num == PM_PLAYBACK_PROGRAM )
  {
	handle_send_program( num );
  }
  else
  {
	if ( num == PM_PBC_MASK )
	{
	  PM_SetPBC(TRUE);
	}
	else
	{
	  PM_SetPBC(FALSE);
	  PM_SetPlaybackMode((BYTE) num);
	}
	ie_send(IE_CORE_SEAMLESS_MODE_CHANGE);

	handle_play_command( num );
  }
}

void vcd_noprog_mode_action(int num)
{
  int iVcdPlayback[] = { PM_PLAYBACK_NORMAL, PM_PLAYBACK_SHUFFLE, PM_PBC_MASK };

  dbouts("\nMode is ");
  dbouti( num );

  num = iVcdPlayback[ num ];
  if ( num == PM_PBC_MASK )
	PM_SetPBC(TRUE);
  else
  {
	PM_SetPBC(FALSE);
	PM_SetPlaybackMode((BYTE) num);
  }
  ie_send(IE_CORE_SEAMLESS_MODE_CHANGE);

  handle_play_command( num );
}

//
// Repeat handling
//

void repeat_choice(MS_CHOICE *msChoice)
{
  int iChoice = ITEMNUM_REPEAT_OFF;

  if ( PM_IsRepeatSingle() )
	iChoice = ITEMNUM_REPEAT_SINGLE;
  else
  if ( PM_IsRepeatAll() )
#ifdef D_PICTURE_CD_ENABLED	//DM1114 disable repeat one for jpg
  {
	if ( g_disc_type == DEC_DISC_TYPE_JPG )
		iChoice = ITEMNUM_REPEAT_SINGLE;	//DM1120 in fact it is repeat all,but since jpg we don't have single,so the index max should be 1 not 2
	else
		iChoice = ITEMNUM_REPEAT_ALL;
  }
#else
		iChoice = ITEMNUM_REPEAT_ALL;
#endif
#ifdef SUPERFLUOUS
else
  iChoice = ITEMNUM_REPEAT_OFF;
#endif // SUPERFLUOUS

  msChoice->current_choice = iChoice;
}

void repeat_action(int num)
{
  dbouts("\nRepeat is ");
  dbouti( num );

  if ( num == ITEMNUM_REPEAT_SINGLE )
	PM_SetRepeatSingle(TRUE);
  else
  if ( num == ITEMNUM_REPEAT_ALL )
	PM_SetRepeatAll(TRUE);
  else
#ifdef SUPERFLUOUS
  if ( num == ITEMNUM_REPEAT_OFF ) 
#endif // SUPERFLUOUS
  {
	PM_SetRepeatSingle(FALSE);
	PM_SetRepeatAll(FALSE);
  }
  
}

#ifdef D_PICTURE_CD_ENABLED	//DM1114 disable repeat one for jpg
void repeat_action_jpg(int num)
{
  dbouts("\nRepeat is ");
  dbouti( num );

  if ( num == ITEMNUM_REPEAT_SINGLE )	//DM1114 Because ITEMNUM_REPEAT_SINGLE is still 1
	PM_SetRepeatAll(TRUE);
  else
#ifdef SUPERFLUOUS
  if ( num == ITEMNUM_REPEAT_OFF ) 
#endif // SUPERFLUOUS
  {
	PM_SetRepeatSingle(FALSE);
	PM_SetRepeatAll(FALSE);
  }
  
}
#endif

/*

//
// These must be done in the caller's close function for the container menu
//

static void on_mode_run_time_close(void) {
	printf("Mode Runtime screen closed\n");
	if (MODE_CHOICE) {
		MS_delete((MS_WIDGET *)MODE_CHOICE);
		MODE_CHOICE = 0;
	}

	if (REPEAT_CHOICE) {
		MS_delete((MS_WIDGET *)REPEAT_CHOICE);
		REPEAT_CHOICE = 0;
	}
	
}
*/


void mode_set_private_program_size(WORD wSize)
{
  g_w_private_program_size = wSize;
}

void mode_increment_private_program_size(void)
{
  g_w_private_program_size++;
}

WORD mode_get_private_program_size(void)
{
  return g_w_private_program_size;
}

MS_CHOICE *open_mode_choice( const MS_POS *pItemPos, MS_COLOR msColor, const MS_POS *pChoicePos )
{
	MS_CHOICE *pChoice;
	WORD wProgramListSize;

	wProgramListSize = mode_get_private_program_size();

	if ( (g_disc_type == DEC_DISC_TYPE_VCD) || (g_disc_type == DEC_DISC_TYPE_SVCD) )
	{
	  if ( (wProgramListSize < 1) && (g_ui_active_menu_id == MODE_RUN_TIME_MENU_ID) )
	  {
		pChoice = MS_create_choice(pItemPos,msColor,&vcd_noprog_mode_list,pChoicePos,vcd_noprog_mode_action,MS_HOT_SPOT);
		vcd_noprog_mode_choice(pChoice);
	  }
	  else
	  {
		pChoice = MS_create_choice(pItemPos,msColor,&vcd_mode_list,pChoicePos,vcd_mode_action,MS_HOT_SPOT);
		vcd_mode_choice(pChoice);
	  }
	}
	else
	{
	  if ( (wProgramListSize < 1) && (g_ui_active_menu_id == MODE_RUN_TIME_MENU_ID) )
	  {
		pChoice = MS_create_choice(pItemPos,msColor,&novcd_noprog_mode_list,pChoicePos,novcd_noprog_mode_action,MS_HOT_SPOT);
		novcd_noprog_mode_choice(pChoice);
	  }
	  else
	  {
		pChoice = MS_create_choice(pItemPos,msColor,&novcd_mode_list,pChoicePos,novcd_mode_action,MS_HOT_SPOT);
		novcd_mode_choice(pChoice);
	  }
	}

	return pChoice;
}

/*

//
// These must be done in the caller's open function for the container menu
//

void open_mode_run_time(void)
{
	screen = MS_create_screen((MS_POS *)&screen_pos,screen_color,0,on_mode_runtime_close,layout);

	MODE_CHOICE = open_mode_choice( &MODE_ITEM_POS, i_color, &dont_care_pos );
	
	REPEAT_CHOICE = MS_create_choice(&REPEAT_ITEM_POS, i_color, &repeat_list, &dont_care_pos, repeat_action, MS_HOT_SPOT);
	repeat_choice(REPEAT_CHOICE);

	MS_add_item((MS_DIALOG*)screen,(MS_WIDGET*)MODE_CHOICE, C_FOCUSED);
	MS_add_item((MS_DIALOG*)screen,(MS_WIDGET*)REPEAT_CHOICE, !C_FOCUSED);

	MS_add_item((MS_DIALOG*)screen,(MS_WIDGET*)&mssTitle, !C_FOCUSED);

	MS_add_item((MS_DIALOG*)screen,(MS_WIDGET*)&mssMode, !C_FOCUSED);
	MS_add_item((MS_DIALOG*)screen,(MS_WIDGET*)&mssRepeat, !C_FOCUSED);

	MS_dialog_display((MS_DIALOG*)screen);
}

*/

⌨️ 快捷键说明

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