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

📄 init.cxx

📁 很不错的播放代玛
💻 CXX
📖 第 1 页 / 共 5 页
字号:
/// \file/// \ingroup Properties Command2Property OSDMsgStack#include <stdio.h>#include <stdlib.h>#include "config.h"#ifdef WIN32#define _UWIN 1  /*disable Non-underscored versions of non-ANSI functions as otherwise int eof would conflict with eof()*/#include <windows.h>#endif#include <string.h>#include <unistd.h>// #include <sys/mman.h>#include <sys/types.h>#ifndef __MINGW32__#include <sys/ioctl.h>#include <sys/wait.h>#else#define	SIGHUP	1	/* hangup */#define	SIGQUIT	3	/* quit */#define	SIGKILL	9	/* kill (cannot be caught or ignored) */#define	SIGBUS	10	/* bus error */#define	SIGPIPE	13	/* broken pipe */extern int mp_input_win32_slave_cmd_func(int fd,char* dest,int size);#endif#include <sys/time.h>#include <sys/stat.h>#include <signal.h>#include <time.h>#include <fcntl.h>#include <limits.h>#include <errno.h>#include "version.h"#include "mp_msg.h"#define HELP_MP_DEFINE_STATIC#include "help_mp.h"#include "m_option.h"#include "m_config.h"#include "m_property.h"#include "cfg-mplayer-def.h"#ifdef USE_SUB#include "subreader.h"#endif#include "libvo/video_out.h"#include "libvo/font_load.h"#include "libvo/sub.h"#ifdef HAVE_X11#include "libvo/x11_common.h"#endif#include "libao2/audio_out.h"#include "codec-cfg.h"#ifdef USE_DVDNAV#include <dvdnav.h>#endif#include "edl.h"#include "spudec.h"#include "vobsub.h"#include "osdep/getch2.h"#include "osdep/timer.h"#include "cpudetect.h"#ifdef HAVE_NEW_GUI#include "Gui/interface.h"#endif#include "input/input.h"int slave_mode=0;int player_idle_mode=0;extern int verbose;int quiet=0;#ifdef WIN32char * proc_priority=NULL;#endif#define ABS(x) (((x)>=0)?(x):(-(x)))#define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))#ifdef HAVE_RTC#ifdef __linux__#include <linux/rtc.h>#else#include <rtc.h>#define RTC_IRQP_SET RTCIO_IRQP_SET#define RTC_PIE_ON   RTCIO_PIE_ON#endif /* __linux__ */#endif /* HAVE_RTC */#ifdef USE_TV#include "libmpdemux/tv.h"#endif#ifdef HAS_DVBIN_SUPPORT#include "libmpdemux/dvbin.h"static int last_dvb_step = 1;static int dvbin_reopen = 0;extern void cache_uninit(stream_t *s);#endif//**************************************************************************////             Playtree//**************************************************************************//#include "playtree.h"#include "playtreeparser.h"#ifdef HAVE_NEW_GUIextern int import_playtree_playlist_into_gui(play_tree_t* my_playtree, m_config_t* config);extern int import_initial_playtree_into_gui(play_tree_t* my_playtree, m_config_t* config, int enqueue);#endifplay_tree_t* playtree;play_tree_iter_t* playtree_iter = NULL;static int play_tree_step = 1;#define PT_NEXT_ENTRY 1#define PT_PREV_ENTRY -1#define PT_NEXT_SRC 2#define PT_PREV_SRC -2#define PT_UP_NEXT 3#define PT_UP_PREV -3//**************************************************************************////             Config//**************************************************************************//m_config_t* mconfig;extern play_tree_t*m_config_parse_mp_command_line(m_config_t *config, int argc, char **argv);extern intm_config_parse_config_file(m_config_t* config, char *conffile);//**************************************************************************////             Config file//**************************************************************************//static int cfg_inc_verbose(m_option_t *conf){ ++verbose; return 0;}static int cfg_include(m_option_t *conf, char *filename){	return m_config_parse_config_file(mconfig, filename);}#include "get_path.c"//**************************************************************************////             XScreensaver//**************************************************************************//#ifdef HAVE_X11void xscreensaver_heartbeat(void);#endif//**************************************************************************////**************************************************************************////             Input media streaming & demultiplexer://**************************************************************************//static int max_framesize=0;#include "libmpdemux/stream.h"#include "libmpdemux/demuxer.h"#include "libmpdemux/stheader.h"//#include "parse_es.h"#include "libmpdemux/matroska.h"#include "libmpcodecs/dec_audio.h"#include "libmpcodecs/dec_video.h"#include "libmpcodecs/mp_image.h"#include "libmpcodecs/vf.h"#include "libmpcodecs/vd.h"extern void vf_list_plugins(void);//**************************************************************************////**************************************************************************//// Common FIFO functions, and keyboard/event FIFO code#include "fifo.c"int noconsolecontrols=0;//**************************************************************************//vo_functions_t *video_out=NULL;ao_functions_t *audio_out=NULL;int fixed_vo=0;int eof=0;// benchmark:double video_time_usage=0;double vout_time_usage=0;static double audio_time_usage=0;static int total_time_usage_start=0;static int total_frame_cnt=0;static int drop_frame_cnt=0; // total number of dropped framesint benchmark=0;// options:       int auto_quality=0;static int output_quality=0;float playback_speed=1.0;int use_gui=0;#ifdef HAVE_NEW_GUIint enqueue=0;#endifstatic int list_properties = 0;#define MAX_OSD_LEVEL 3#define MAX_TERM_OSD_LEVEL 1int osd_level=1;int osd_level_saved=-1;// if nonzero, hide current OSD contents when GetTimerMS() reaches thisunsigned int osd_visible;static int osd_function=OSD_PLAY;static int osd_show_percentage = 0;static int osd_duration = 1000;static int term_osd = 1;static char* term_osd_esc = "\x1b[A\r\x1b[K";static char* playing_msg = NULL;// seek:static char *seek_to_sec=NULL;static off_t seek_to_byte=0;static off_t step_sec=0;static int loop_times=-1;static int loop_seek=0;// A/V sync:       int autosync=0; // 30 might be a good default value.// may be changed by GUI:  (FIXME!)float rel_seek_secs=0;int abs_seek_pos=0;// codecs:char **audio_codec_list=NULL; // override audio codecchar **video_codec_list=NULL; // override video codecchar **audio_fm_list=NULL;    // override audio codec family char **video_fm_list=NULL;    // override video codec family // demuxer:extern char *demuxer_name; // override demuxerextern char *audio_demuxer_name; // override audio demuxerextern char *sub_demuxer_name; // override sub demuxer// streaming:int audio_id=-1;int video_id=-1;int dvdsub_id=-2;int vobsub_id=-1;char* audio_lang=NULL;char* dvdsub_lang=NULL;static char* spudec_ifo=NULL;char* filename=NULL; //"MI2-Trailer.avi";int forced_subs_only=0;// cache2:       int stream_cache_size=-1;#ifdef USE_STREAM_CACHEextern int cache_fill_status;float stream_cache_min_percent=20.0;float stream_cache_seek_min_percent=50.0;#else#define cache_fill_status 0#endif// dump:static char *stream_dump_name="stream.dump";       int stream_dump_type=0;// A-V sync:static float default_max_pts_correction=-1;//0.01f;static float max_pts_correction=0;//default_max_pts_correction;static float c_total=0;       float audio_delay=0;static int ignore_start=0;static int softsleep=0;       float force_fps=0;static int force_srate=0;static int audio_output_format=0;       int frame_dropping=0; // option  0=no drop  1= drop vo  2= drop decodestatic int play_n_frames=-1;static int play_n_frames_mf=-1;// screen info:char** video_driver_list=NULL;char** audio_driver_list=NULL;extern char *vo_subdevice;extern char *ao_subdevice;// codec outfmt flags (defined in libmpcodecs/vd.c)extern int vo_flags;// sub:char *font_name=NULL;#ifdef HAVE_FONTCONFIGextern int font_fontconfig;#endiffloat font_factor=0.75;char **sub_name=NULL;float sub_delay=0;float sub_fps=0;int   sub_auto = 1;char *vobsub_name=NULL;/*DSP!!char *dsp=NULL;*/int   subcc_enabled=0;int suboverlap_enabled = 1;#ifdef USE_SUBsub_data* set_of_subtitles[MAX_SUBTITLE_FILES];int set_of_sub_size = 0;int set_of_sub_pos = -1;float sub_last_pts = -303;#endifint global_sub_size = 0; // this encompasses all subtitle sourcesint global_sub_pos = -1; // this encompasses all subtitle sources#define SUB_SOURCE_SUBS 0#define SUB_SOURCE_VOBSUB 1#define SUB_SOURCE_DEMUX 2#define SUB_SOURCES 3int global_sub_indices[SUB_SOURCES];extern int mp_msg_levels[MSGT_MAX];extern int mp_msg_level_all;static stream_t* stream=NULL;static demuxer_t *demuxer=NULL;static sh_audio_t *sh_audio=NULL;static sh_video_t *sh_video=NULL;static demux_stream_t *d_audio=NULL;static demux_stream_t *d_video=NULL;static demux_stream_t *d_dvdsub=NULL;char* current_module=NULL; // for debuggingextern int vo_gamma_gamma;extern int vo_gamma_brightness;extern int vo_gamma_contrast;extern int vo_gamma_saturation;extern int vo_gamma_hue;// ---#ifdef HAVE_MENU#include "m_struct.h"#include "libmenu/menu.h"extern void vf_menu_pause_update(struct vf_instance_s* vf);extern vf_info_t vf_info_menu;static vf_info_t* libmenu_vfs[] = {  &vf_info_menu,  NULL};static vf_instance_t* vf_menu = NULL;static int use_menu = 0;static char* menu_cfg = NULL;static char* menu_root = "main";#endif#ifdef HAVE_RTCstatic int nortc;static char* rtc_device;#endifedl_record_ptr edl_records = NULL; ///< EDL entries memory areaedl_record_ptr next_edl_record = NULL; ///< only for traversing edl_recordsshort user_muted = 0; ///< Stores whether user wanted muted mode.short edl_muted  = 0; ///< Stores whether EDL is currently in muted mode.short edl_decision = 0; ///< 1 when an EDL operation has been made.FILE* edl_fd = NULL; ///< fd to write to when in -edlout mode.static unsigned int inited_flags=0;#define INITED_VO 1#define INITED_AO 2#define INITED_GUI 4#define INITED_GETCH2 8#define INITED_SPUDEC 32#define INITED_STREAM 64#define INITED_INPUT    128#define INITED_VOBSUB  256#define INITED_DEMUXER 512#define INITED_ACODEC  1024#define INITED_VCODEC  2048#define INITED_ALL 0xFFFFstatic void uninit_player(unsigned int mask){  mask=inited_flags&mask;  mp_msg(MSGT_CPLAYER,MSGL_DBG2,"\n*** uninit(0x%X)\n",mask);  if(mask&INITED_ACODEC){    inited_flags&=~INITED_ACODEC;    current_module="uninit_acodec";    if(sh_audio) uninit_audio(sh_audio);#ifdef HAVE_NEW_GUI    guiGetEvent(guiSetAfilter, (char *)NULL);#endif    sh_audio=NULL;  }  if(mask&INITED_VCODEC){    inited_flags&=~INITED_VCODEC;    current_module="uninit_vcodec";    if(sh_video) uninit_video(sh_video);    sh_video=NULL;#ifdef HAVE_MENU    vf_menu=NULL;#endif  }   if(mask&INITED_DEMUXER){    inited_flags&=~INITED_DEMUXER;    current_module="free_demuxer";    if(demuxer){	stream=demuxer->stream;	free_demuxer(demuxer);    }    demuxer=NULL;  }  // kill the cache process:  if(mask&INITED_STREAM){    inited_flags&=~INITED_STREAM;    current_module="uninit_stream";    if(stream) free_stream(stream);    stream=NULL;  }

⌨️ 快捷键说明

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