diff options
Diffstat (limited to 'mplayer.c')
-rw-r--r-- | mplayer.c | 182 |
1 files changed, 91 insertions, 91 deletions
@@ -251,8 +251,8 @@ int abs_seek_pos=0; // codecs: char **audio_codec_list=NULL; // override audio codec char **video_codec_list=NULL; // override video codec -char **audio_fm_list=NULL; // override audio codec family -char **video_fm_list=NULL; // override video codec family +char **audio_fm_list=NULL; // override audio codec family +char **video_fm_list=NULL; // override video codec family // demuxer: extern char *demuxer_name; // override demuxer @@ -472,7 +472,7 @@ char *get_metadata (metadata_t type) { { return strdup (mp_basename2 (filename)); } - + case META_VIDEO_CODEC: { if (sh_video->format == 0x10000001) @@ -495,14 +495,14 @@ char *get_metadata (metadata_t type) { } return meta; } - + case META_VIDEO_BITRATE: { meta = malloc (16); sprintf (meta, "%d kbps", (int) (sh_video->i_bps * 8 / 1024)); return meta; } - + case META_VIDEO_RESOLUTION: { meta = malloc (16); @@ -516,14 +516,14 @@ char *get_metadata (metadata_t type) { meta = strdup (sh_audio->codec->name); return meta; } - + case META_AUDIO_BITRATE: { meta = malloc (16); sprintf (meta, "%d kbps", (int) (sh_audio->i_bps * 8/1000)); return meta; } - + case META_AUDIO_SAMPLES: { meta = malloc (16); @@ -534,7 +534,7 @@ char *get_metadata (metadata_t type) { /* check for valid demuxer */ case META_INFO_TITLE: return get_demuxer_info ("Title"); - + case META_INFO_ARTIST: return get_demuxer_info ("Artist"); @@ -599,7 +599,7 @@ void uninit_player(unsigned int mask){ vf_menu=NULL; #endif } - + if(mask&INITIALIZED_DEMUXER){ initialized_flags&=~INITIALIZED_DEMUXER; current_module="free_demuxer"; @@ -654,7 +654,7 @@ void uninit_player(unsigned int mask){ if(mask&INITIALIZED_AO){ initialized_flags&=~INITIALIZED_AO; current_module="uninit_ao"; - if (mpctx->edl_muted) mixer_mute(&mpctx->mixer); + if (mpctx->edl_muted) mixer_mute(&mpctx->mixer); mpctx->audio_out->uninit(mpctx->eof?0:1); mpctx->audio_out=NULL; } @@ -681,7 +681,7 @@ void uninit_player(unsigned int mask){ void exit_player_with_rc(exit_reason_t how, int rc){ - if (mpctx->user_muted && !mpctx->edl_muted) mixer_mute(&mpctx->mixer); + if (mpctx->user_muted && !mpctx->edl_muted) mixer_mute(&mpctx->mixer); uninit_player(INITIALIZED_ALL); #if defined(__MINGW32__) || defined(__CYGWIN__) timeEndPeriod(1); @@ -712,7 +712,7 @@ void exit_player_with_rc(exit_reason_t how, int rc){ // free mplayer config if(mconfig) m_config_free(mconfig); - + if(mpctx->playtree) play_tree_free(mpctx->playtree, 1); @@ -744,7 +744,7 @@ void exit_player(exit_reason_t how){ } #ifndef __MINGW32__ -static void child_sighandler(int x){ +static void child_sighandler(int x){ pid_t pid; while((pid=waitpid(-1,NULL,WNOHANG)) > 0); } @@ -764,9 +764,9 @@ static void exit_sighandler(int x){ if(initialized_flags==0 && sig_count>1) exit(1); if(sig_count==5) { - /* We're crashing bad and can't uninit cleanly :( - * by popular request, we make one last (dirty) - * effort to restore the user's + /* We're crashing bad and can't uninit cleanly :( + * by popular request, we make one last (dirty) + * effort to restore the user's * terminal. */ getch2_disable(); exit(1); @@ -813,14 +813,14 @@ static void exit_sighandler(int x){ getch2_disable(); // allow terminal to work properly with gdb if (execlp("gdb", "gdb", prog_path, spid, "-ex", "bt", NULL) == -1) mp_msg(MSGT_CPLAYER, MSGL_ERR, "Couldn't start gdb\n"); - } else if (gdb_pid < 0) + } else if (gdb_pid < 0) mp_msg(MSGT_CPLAYER, MSGL_ERR, "Couldn't fork\n"); else { waitpid(gdb_pid, NULL, 0); } if (x == SIGTRAP) return; } -#endif +#endif } getch2_disable(); exit(1); @@ -869,7 +869,7 @@ static void load_per_protocol_config (m_config_t* conf, const char *const file) char *str; char protocol[strlen (PROFILE_CFG_PROTOCOL) + strlen (file) + 1]; m_profile_t *p; - + /* does filename actually uses a protocol ? */ str = strstr (file, "://"); if (!str) @@ -933,7 +933,7 @@ static void load_per_file_config (m_config_t* conf, const char *const file) char *name; sprintf (cfg, "%s.conf", file); - + if (use_filedir_conf && !stat (cfg, &st)) { mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_LoadingConfig, cfg); @@ -974,7 +974,7 @@ static int libmpdemux_was_interrupted(int eof) { } break; case MP_CMD_PLAY_TREE_UP_STEP: { eof = (cmd->args[0].v.i > 0) ? PT_UP_NEXT : PT_UP_PREV; - } break; + } break; case MP_CMD_PLAY_ALT_SRC_STEP: { eof = (cmd->args[0].v.i > 0) ? PT_NEXT_SRC : PT_PREV_SRC; } break; @@ -999,7 +999,7 @@ static int playtree_add_playlist(play_tree_t* entry) } else #endif { - if(!entry) { + if(!entry) { entry = mpctx->playtree_iter->tree; if(play_tree_iter_step(mpctx->playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { return PT_NEXT_ENTRY; @@ -1017,7 +1017,7 @@ static int playtree_add_playlist(play_tree_t* entry) entry = mpctx->playtree_iter->tree; if(play_tree_iter_step(mpctx->playtree_iter,1,0) != PLAY_TREE_ITER_ENTRY) { return PT_NEXT_ENTRY; - } + } play_tree_remove(entry,1,1); } return PT_NEXT_SRC; @@ -1047,11 +1047,11 @@ void add_subtitles(char *filename, float fps, int noerr) if (!asst && !subd) #else - if(!subd) + if(!subd) #endif mp_msg(MSGT_CPLAYER, noerr ? MSGL_WARN : MSGL_ERR, MSGTR_CantLoadSub, filename_recode(filename)); - + #ifdef CONFIG_ASS if (!asst && !subd) return; mpctx->set_of_ass_tracks[mpctx->set_of_sub_size] = asst; @@ -1133,7 +1133,7 @@ void init_vo_spudec(void) { /* * In Mac OS X the SDL-lib is built upon Cocoa. The easiest way to - * make it all work is to use the builtin SDL-bootstrap code, which + * make it all work is to use the builtin SDL-bootstrap code, which * will be done automatically by replacing our main() if we include SDL.h. */ #if defined(__APPLE__) && defined(CONFIG_SDL) @@ -1206,7 +1206,7 @@ static void print_status(float a_pos, float a_v, float corr) width--; #endif line = malloc(width + 1); // one additional char for the terminating null - + // Audio time if (mpctx->sh_audio) { saddf(line, &pos, width, "A:%6.1f ", a_pos); @@ -1252,7 +1252,7 @@ static void print_status(float a_pos, float a_v, float corr) } // VO stats - if (sh_video) + if (sh_video) saddf(line, &pos, width, "%d %d ", drop_frame_cnt, output_quality); #ifdef CONFIG_STREAM_CACHE @@ -1336,17 +1336,17 @@ static mp_osd_msg_t* osd_msg_stack = NULL; /** * \brief Add a message on the OSD message stack - * + * * If a message with the same id is already present in the stack * it is pulled on top of the stack, otherwise a new message is created. - * + * */ void set_osd_msg(int id, int level, int time, const char* fmt, ...) { mp_osd_msg_t *msg,*last=NULL; va_list va; int r; - + // look if the id is already in the stack for(msg = osd_msg_stack ; msg && msg->id != id ; last = msg, msg = msg->prev); @@ -1369,19 +1369,19 @@ void set_osd_msg(int id, int level, int time, const char* fmt, ...) { msg->id = id; msg->level = level; msg->time = time; - + } /** * \brief Remove a message from the OSD stack - * + * * This function can be used to get rid of a message right away. - * + * */ void rm_osd_msg(int id) { mp_osd_msg_t *msg,*last=NULL; - + // Search for the msg for(msg = osd_msg_stack ; msg && msg->id != id ; last = msg, msg = msg->prev); @@ -1397,7 +1397,7 @@ void rm_osd_msg(int id) { /** * \brief Remove all messages from the OSD stack - * + * */ static void clear_osd_msgs(void) { @@ -1412,10 +1412,10 @@ static void clear_osd_msgs(void) { /** * \brief Get the current message from the OSD stack. - * + * * This function decrements the message timer and destroys the old ones. * The message that should be displayed is returned (if any). - * + * */ static mp_osd_msg_t* get_osd_msg(void) { @@ -1439,9 +1439,9 @@ static mp_osd_msg_t* get_osd_msg(void) { if(!last_update) last_update = now; diff = now >= last_update ? now - last_update : 0; - + last_update = now; - + // Look for the first message in the stack with high enough level. for(msg = osd_msg_stack ; msg ; last = msg, msg = prev) { prev = msg->prev; @@ -1478,9 +1478,9 @@ static mp_osd_msg_t* get_osd_msg(void) { */ void set_osd_bar(int type,const char* name,double min,double max,double val) { - + if(osd_level < 1) return; - + if(mpctx->sh_video) { osd_visible = (GetTimerMS() + 1000) | 1; vo_osd_progbar_type = type; @@ -1488,7 +1488,7 @@ void set_osd_bar(int type,const char* name,double min,double max,double val) { vo_osd_changed(OSDTYPE_PROGBAR); return; } - + set_osd_msg(OSD_MSG_BAR,1,osd_duration,"%s: %d %%", name,ROUND(100*(val-min)/(max-min))); } @@ -1500,27 +1500,27 @@ void set_osd_bar(int type,const char* name,double min,double max,double val) { * This function displays the current message on the vo OSD or on the term. * If the stack is empty and the OSD level is high enough the timer * is displayed (only on the vo OSD). - * + * */ static void update_osd_msg(void) { mp_osd_msg_t *msg; static char osd_text[128] = ""; static char osd_text_timer[128]; - + // we need some mem for vo_osd_text vo_osd_text = (unsigned char*)osd_text; - + // Look if we have a msg if((msg = get_osd_msg())) { if(strcmp(osd_text,msg->msg)) { strncpy((char*)osd_text, msg->msg, 127); - if(mpctx->sh_video) vo_osd_changed(OSDTYPE_OSD); else + if(mpctx->sh_video) vo_osd_changed(OSDTYPE_OSD); else if(term_osd) mp_msg(MSGT_CPLAYER,MSGL_STATUS,"%s%s\n",term_osd_esc,msg->msg); } return; } - + if(mpctx->sh_video) { // fallback on the timer if(osd_level>=2) { @@ -1528,16 +1528,16 @@ static void update_osd_msg(void) { int percentage = -1; char percentage_text[10]; int pts = demuxer_get_current_time(mpctx->demuxer); - + if (mpctx->osd_show_percentage) percentage = demuxer_get_percent_pos(mpctx->demuxer); - + if (percentage >= 0) snprintf(percentage_text, 9, " (%d%%)", percentage); else percentage_text[0] = 0; - - if (osd_level == 3) + + if (osd_level == 3) snprintf(osd_text_timer, 63, "%c %02d:%02d:%02d / %02d:%02d:%02d%s", mpctx->osd_function,pts/3600,(pts/60)%60,pts%60, @@ -1548,18 +1548,18 @@ static void update_osd_msg(void) { pts%60,percentage_text); } else osd_text_timer[0]=0; - + // always decrement the percentage timer if(mpctx->osd_show_percentage) mpctx->osd_show_percentage--; - + if(strcmp(osd_text,osd_text_timer)) { strncpy(osd_text, osd_text_timer, 63); vo_osd_changed(OSDTYPE_OSD); } return; } - + // Clear the term osd line if(term_osd && osd_text[0]) { osd_text[0] = 0; @@ -1599,7 +1599,7 @@ if(mpctx->sh_audio){ mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_AudioFilterChainPreinitError); exit_player(EXIT_ERROR); } -#endif +#endif current_module="ao2_init"; if(!(mpctx->audio_out=init_best_audio_out(audio_driver_list, 0, // plugin flag @@ -1861,7 +1861,7 @@ static void mp_dvdnav_reset_stream (MPContext *ctx) { } if (ctx->d_sub) dvdsub_id = -2; - + audio_delay = 0.0f; /// clear all EOF related flags @@ -1900,7 +1900,7 @@ static mp_image_t *mp_dvdnav_restore_smpi(int *in_size, mp_dvdnav_skip_wait(mpctx->stream); } mpctx->sh_video->pts += 1 / mpctx->sh_video->fps; - + if (mpctx->nav_buffer) { *start = mpctx->nav_start; *in_size = mpctx->nav_in_size; @@ -1919,7 +1919,7 @@ static void mp_dvdnav_save_smpi(int in_size, { if (mpctx->stream->type != STREAMTYPE_DVDNAV) return; - + if (mpctx->nav_buffer) free(mpctx->nav_buffer); @@ -1989,10 +1989,10 @@ static void adjust_sync_and_print_status(int between_frames, float timing_error) if(!quiet) print_status(a_pts - audio_delay, AV_delay, c_total); } - + } else { // No audio: - + if (!quiet) print_status(0, 0, 0); } @@ -2053,7 +2053,7 @@ static int fill_audio_out_buffers(void) if (!playsize) break; - // play audio: + // play audio: current_module="play_audio"; // Is this pts value actually useful for the aos that access it? @@ -2420,7 +2420,7 @@ static void edl_update(MPContext *mpctx) if (!mpctx->sh_video) { mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlNOsh_video); free_edl(edl_records); - next_edl_record = NULL; + next_edl_record = NULL; edl_records = NULL; return; } @@ -2472,7 +2472,7 @@ static int seek(MPContext *mpctx, double amount, int style) update_subtitles(mpctx->sh_video, mpctx->d_sub, 1); update_teletext(mpctx->sh_video, mpctx->demuxer, 1); } - + if (mpctx->sh_audio) { current_module = "seek_audio_reset"; mpctx->audio_out->reset(); // stop audio, throwing away buffered data @@ -2517,7 +2517,7 @@ int gui_no_filename=0; InitTimer(); srand(GetTimerMS()); - + mp_msg_init(); // Create the config context and register the options @@ -2564,7 +2564,7 @@ int gui_no_filename=0; mpctx->playtree = play_tree_cleanup(mpctx->playtree); if(mpctx->playtree) { mpctx->playtree_iter = play_tree_iter_new(mpctx->playtree,mconfig); - if(mpctx->playtree_iter) { + if(mpctx->playtree_iter) { if(play_tree_iter_step(mpctx->playtree_iter,0,0) != PLAY_TREE_ITER_ENTRY) { play_tree_iter_free(mpctx->playtree_iter); mpctx->playtree_iter = NULL; @@ -2573,7 +2573,7 @@ int gui_no_filename=0; } } } - + print_version("MPlayer"); #if (defined(__MINGW32__) || defined(__CYGWIN__)) && defined(CONFIG_GUI) @@ -2596,7 +2596,7 @@ int gui_no_filename=0; SetErrorMode(0x8003); // request 1ms timer resolution timeBeginPeriod(1); -#endif +#endif #ifdef CONFIG_PRIORITY set_priority(); @@ -2619,13 +2619,13 @@ int gui_no_filename=0; // Free Playtree and Playtree-Iter as it's not used by the GUI. play_tree_iter_free(mpctx->playtree_iter); mpctx->playtree_iter=NULL; - + if (getcwd(cwd, PATH_MAX) != (char *)NULL) { strcat(cwd, "/"); // Prefix relative paths with current working directory play_tree_add_bpf(mpctx->playtree, cwd); - } + } // Import initital playtree into GUI. import_initial_playtree_into_gui(mpctx->playtree, mconfig, enqueue); } @@ -2843,7 +2843,7 @@ stream_set_interrupt_callback(mp_input_check_interrupt); } } #endif - + initialized_flags|=INITIALIZED_INPUT; current_module = NULL; @@ -2923,7 +2923,7 @@ if(!noconsolecontrols && !slave_mode){ guiGetEvent( guiSetDefaults,0 ); while ( guiIntfStruct.Playing != 1 ) { - mp_cmd_t* cmd; + mp_cmd_t* cmd; usec_sleep(20000); guiEventHandling(); guiGetEvent( guiReDraw,NULL ); @@ -2931,7 +2931,7 @@ if(!noconsolecontrols && !slave_mode){ guiGetEvent(guiIEvent, (char *)cmd->id); mp_cmd_free(cmd); } - } + } guiGetEvent( guiSetParameters,NULL ); if ( guiIntfStruct.StreamType == STREAMTYPE_STREAM ) { @@ -2953,7 +2953,7 @@ if(!noconsolecontrols && !slave_mode){ filename = play_tree_iter_get_file(mpctx->playtree_iter,1); } } - } + } } #endif /* CONFIG_GUI */ @@ -3061,7 +3061,7 @@ if (edl_output_filename) { psub = realloc(psub,l); strcat(psub,bname); vo_vobsub=vobsub_open(psub,spudec_ifo,0,&vo_spudec); - free(psub); + free(psub); } free(buf); } @@ -3201,15 +3201,15 @@ mpctx->demuxer=demux_open(mpctx->stream,mpctx->file_format,audio_id,video_id,dvd // HACK to get MOV Reference Files working if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST) -{ +{ unsigned char* playlist_entry; play_tree_t *list = NULL, *entry = NULL; current_module="handle_demux_playlist"; while (ds_get_packet(mpctx->demuxer->video,&playlist_entry)>0) - { + { char *temp, *bname; - + mp_msg(MSGT_CPLAYER,MSGL_V,"Adding file %s to element entry.\n", filename_recode(playlist_entry)); @@ -3221,7 +3221,7 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST) continue; entry = play_tree_new(); - + if (filename && !strcmp(mp_basename(playlist_entry),playlist_entry)) // add reference path of current file { temp=malloc((strlen(filename)-strlen(mp_basename(filename))+strlen(playlist_entry)+1)); @@ -3237,7 +3237,7 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST) } else play_tree_add_file(entry,playlist_entry); - + if(!list) list = entry; else @@ -3255,7 +3255,7 @@ if (mpctx->demuxer && mpctx->demuxer->type==DEMUXER_TYPE_PLAYLIST) } } -if(!mpctx->demuxer) +if(!mpctx->demuxer) goto goto_next_file; if(dvd_chapter>1) { float pts; @@ -3314,7 +3314,7 @@ if((stream_dump_type)&&(stream_dump_type<4)){ case 2: ds=mpctx->d_video;break; case 3: ds=mpctx->d_sub;break; } - if(!ds){ + if(!ds){ mp_msg(MSGT_CPLAYER,MSGL_FATAL,MSGTR_DumpSelectedStreamMissing); exit_player(EXIT_ERROR); } @@ -3386,11 +3386,11 @@ if(!mpctx->sh_video && !mpctx->sh_audio){ dir = DVB_CHANNEL_HIGHER; else dir = DVB_CHANNEL_LOWER; - + if(dvb_step_channel(mpctx->stream, dir)) mpctx->eof = mpctx->dvbin_reopen = 1; } -#endif +#endif goto goto_next_file; // exit_player(MSGTR_Exit_error); } @@ -3409,9 +3409,9 @@ if(mpctx->sh_video) { // check .sub current_module="read_subtitles_file"; if(sub_name){ - for (i = 0; sub_name[i] != NULL; ++i) - add_subtitles (sub_name[i], mpctx->sh_video->fps, 0); - } + for (i = 0; sub_name[i] != NULL; ++i) + add_subtitles (sub_name[i], mpctx->sh_video->fps, 0); + } if(sub_auto) { // auto load sub file ... char *psub = get_path( "sub/" ); char **tmp = sub_filenames((psub ? psub : ""), filename); @@ -3497,7 +3497,7 @@ if (mpctx->global_sub_size) { if (mpctx->demuxer->num_chapters == 0) stream_control(mpctx->demuxer->stream, STREAM_CTRL_GET_NUM_CHAPTERS, &mpctx->demuxer->num_chapters); mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_CHAPTERS=%d\n", mpctx->demuxer->num_chapters); - } + } if(!mpctx->sh_video) goto main; // audio-only @@ -3524,7 +3524,7 @@ current_module="main"; mp_msg(MSGT_CPLAYER,MSGL_INFO,"%s",msg); free(msg); } - + // Disable the term OSD in verbose mode if(verbose) term_osd = 0; @@ -3704,7 +3704,7 @@ if(!mpctx->sh_video) { } // ========================================================================== - + // current_module="draw_osd"; // if(vo_config_count) mpctx->video_out->draw_osd(); @@ -3796,7 +3796,7 @@ if(auto_quality>0){ } } #endif - + //============================ Handle PAUSE =============================== current_module="pause"; |