comparison mplayer.c @ 22002:ebd2d5efb11b

filename double-conversion, especially usefull for CJK users :-) Patch by Zuxy Meng <zuxy.meng@gmail.com> date: Oct 25, 2006 2:20 AM subject: [MPlayer-dev-eng] [PATCH] Filename double-conversion
author gpoirier
date Fri, 26 Jan 2007 09:57:09 +0000
parents 6af0d674aa53
children 3d415b28e5e4
comparison
equal deleted inserted replaced
22001:2934974c366a 22002:ebd2d5efb11b
993 993
994 if (!asst && !subd && !silent) 994 if (!asst && !subd && !silent)
995 #else 995 #else
996 if(!subd && !silent) 996 if(!subd && !silent)
997 #endif 997 #endif
998 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_CantLoadSub, filename); 998 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_CantLoadSub,
999 filename_recode(filename));
999 1000
1000 #ifdef USE_ASS 1001 #ifdef USE_ASS
1001 if (!asst && !subd) return; 1002 if (!asst && !subd) return;
1002 set_of_ass_tracks[set_of_sub_size] = asst; 1003 set_of_ass_tracks[set_of_sub_size] = asst;
1003 #else 1004 #else
1004 if (!subd) return; 1005 if (!subd) return;
1005 #endif 1006 #endif
1006 set_of_subtitles[set_of_sub_size] = subd; 1007 set_of_subtitles[set_of_sub_size] = subd;
1007 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_ID=%d\n", set_of_sub_size); 1008 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_ID=%d\n", set_of_sub_size);
1008 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_FILENAME=%s\n", filename); 1009 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_FILE_SUB_FILENAME=%s\n",
1010 filename_recode(filename));
1009 ++set_of_sub_size; 1011 ++set_of_sub_size;
1010 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AddedSubtitleFile, set_of_sub_size, filename); 1012 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_AddedSubtitleFile, set_of_sub_size,
1013 filename_recode(filename));
1011 } 1014 }
1012 1015
1013 // FIXME: if/when the GUI calls this, global sub numbering gets (potentially) broken. 1016 // FIXME: if/when the GUI calls this, global sub numbering gets (potentially) broken.
1014 void update_set_of_subtitles(void) 1017 void update_set_of_subtitles(void)
1015 // subdata was changed, set_of_sub... have to be updated. 1018 // subdata was changed, set_of_sub... have to be updated.
3822 { 3825 {
3823 #endif 3826 #endif
3824 #ifdef HAVE_BITMAP_FONT 3827 #ifdef HAVE_BITMAP_FONT
3825 if(font_name){ 3828 if(font_name){
3826 vo_font=read_font_desc(font_name,font_factor,verbose>1); 3829 vo_font=read_font_desc(font_name,font_factor,verbose>1);
3827 if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,font_name); 3830 if(!vo_font) mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadFont,
3831 filename_recode(font_name));
3828 } else { 3832 } else {
3829 // try default: 3833 // try default:
3830 vo_font=read_font_desc( mem_ptr=get_path("font/font.desc"),font_factor,verbose>1); 3834 vo_font=read_font_desc( mem_ptr=get_path("font/font.desc"),font_factor,verbose>1);
3831 free(mem_ptr); // release the buffer created by get_path() 3835 free(mem_ptr); // release the buffer created by get_path()
3832 if(!vo_font) 3836 if(!vo_font)
4074 filename = play_tree_iter_get_file(playtree_iter, 1); 4078 filename = play_tree_iter_get_file(playtree_iter, 1);
4075 } 4079 }
4076 } 4080 }
4077 //--------------------------------------------------------------------------- 4081 //---------------------------------------------------------------------------
4078 4082
4079 if(filename) mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing, filename); 4083 if(filename)
4084 mp_msg(MSGT_CPLAYER,MSGL_INFO,MSGTR_Playing,
4085 filename_recode(filename));
4080 4086
4081 if (edl_filename) { 4087 if (edl_filename) {
4082 if (edl_records) free_edl(edl_records); 4088 if (edl_records) free_edl(edl_records);
4083 next_edl_record = edl_records = edl_parse_file(); 4089 next_edl_record = edl_records = edl_parse_file();
4084 } 4090 }
4085 if (edl_output_filename) { 4091 if (edl_output_filename) {
4086 if (edl_fd) fclose(edl_fd); 4092 if (edl_fd) fclose(edl_fd);
4087 if ((edl_fd = fopen(edl_output_filename, "w")) == NULL) 4093 if ((edl_fd = fopen(edl_output_filename, "w")) == NULL)
4088 { 4094 {
4089 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlCantOpenForWrite, 4095 mp_msg(MSGT_CPLAYER, MSGL_ERR, MSGTR_EdlCantOpenForWrite,
4090 edl_output_filename); 4096 filename_recode(edl_output_filename));
4091 } 4097 }
4092 } 4098 }
4093 4099
4094 //==================== Open VOB-Sub ============================ 4100 //==================== Open VOB-Sub ============================
4095 4101
4096 current_module="vobsub"; 4102 current_module="vobsub";
4097 if (vobsub_name){ 4103 if (vobsub_name){
4098 vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec); 4104 vo_vobsub=vobsub_open(vobsub_name,spudec_ifo,1,&vo_spudec);
4099 if(vo_vobsub==NULL) 4105 if(vo_vobsub==NULL)
4100 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,vobsub_name); 4106 mp_msg(MSGT_CPLAYER,MSGL_ERR,MSGTR_CantLoadSub,
4107 filename_recode(vobsub_name));
4101 }else if(sub_auto && filename && (strlen(filename)>=5)){ 4108 }else if(sub_auto && filename && (strlen(filename)>=5)){
4102 /* try to autodetect vobsub from movie filename ::atmos */ 4109 /* try to autodetect vobsub from movie filename ::atmos */
4103 char *buf = malloc((strlen(filename)-3)),*psub; 4110 char *buf = malloc((strlen(filename)-3)),*psub;
4104 memset(buf,0,strlen(filename)-3); // make sure string is terminated 4111 memset(buf,0,strlen(filename)-3); // make sure string is terminated
4105 strncpy(buf, filename, strlen(filename)-4); 4112 strncpy(buf, filename, strlen(filename)-4);
4162 4169
4163 if(file_format == DEMUXER_TYPE_PLAYLIST) { 4170 if(file_format == DEMUXER_TYPE_PLAYLIST) {
4164 play_tree_t* entry; 4171 play_tree_t* entry;
4165 // Handle playlist 4172 // Handle playlist
4166 current_module="handle_playlist"; 4173 current_module="handle_playlist";
4167 mp_msg(MSGT_CPLAYER,MSGL_V,"Parsing playlist %s...\n",filename); 4174 mp_msg(MSGT_CPLAYER,MSGL_V,"Parsing playlist %s...\n",
4175 filename_recode(filename));
4168 entry = parse_playtree(stream,0); 4176 entry = parse_playtree(stream,0);
4169 eof=playtree_add_playlist(entry); 4177 eof=playtree_add_playlist(entry);
4170 goto goto_next_file; 4178 goto goto_next_file;
4171 } 4179 }
4172 stream->start_pos+=seek_to_byte; 4180 stream->start_pos+=seek_to_byte;
4255 current_module="handle_demux_playlist"; 4263 current_module="handle_demux_playlist";
4256 while (ds_get_packet(demuxer->video,&playlist_entry)>0) 4264 while (ds_get_packet(demuxer->video,&playlist_entry)>0)
4257 { 4265 {
4258 char *temp, *bname; 4266 char *temp, *bname;
4259 4267
4260 mp_msg(MSGT_CPLAYER,MSGL_V,"Adding file %s to element entry.\n",playlist_entry); 4268 mp_msg(MSGT_CPLAYER,MSGL_V,"Adding file %s to element entry.\n",
4269 filename_recode(playlist_entry));
4261 4270
4262 bname=mp_basename(playlist_entry); 4271 bname=mp_basename(playlist_entry);
4263 if ((strlen(bname)>10) && !strncmp(bname,"qt",2) && !strncmp(bname+3,"gateQT",6)) 4272 if ((strlen(bname)>10) && !strncmp(bname,"qt",2) && !strncmp(bname+3,"gateQT",6))
4264 continue; 4273 continue;
4265 4274
4509 case 8: dump_jacosub(subdata, sh_video->fps); break; 4518 case 8: dump_jacosub(subdata, sh_video->fps); break;
4510 case 9: dump_sami(subdata, sh_video->fps); break; 4519 case 9: dump_sami(subdata, sh_video->fps); break;
4511 } 4520 }
4512 } 4521 }
4513 4522
4514 mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_FILENAME=%s\n", filename); 4523 mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_FILENAME=%s\n",
4524 filename_recode(filename));
4515 mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_DEMUXER=%s\n", demuxer->desc->name); 4525 mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_DEMUXER=%s\n", demuxer->desc->name);
4516 if (sh_video) { 4526 if (sh_video) {
4517 /* Assume FOURCC if all bytes >= 0x20 (' ') */ 4527 /* Assume FOURCC if all bytes >= 0x20 (' ') */
4518 if (sh_video->format >= 0x20202020) 4528 if (sh_video->format >= 0x20202020)
4519 mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_VIDEO_FORMAT=%.4s\n", (char *)&sh_video->format); 4529 mp_msg(MSGT_IDENTIFY,MSGL_INFO,"ID_VIDEO_FORMAT=%.4s\n", (char *)&sh_video->format);
5251 int v = cmd->args[0].v.i; 5261 int v = cmd->args[0].v.i;
5252 sub_data *subd; 5262 sub_data *subd;
5253 if (v < 0) { 5263 if (v < 0) {
5254 for (v = 0; v < set_of_sub_size; ++v) { 5264 for (v = 0; v < set_of_sub_size; ++v) {
5255 subd = set_of_subtitles[v]; 5265 subd = set_of_subtitles[v];
5256 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1, subd->filename); 5266 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1,
5267 filename_recode(subd->filename));
5257 sub_free(subd); 5268 sub_free(subd);
5258 set_of_subtitles[v] = NULL; 5269 set_of_subtitles[v] = NULL;
5259 } 5270 }
5260 global_sub_indices[SUB_SOURCE_SUBS] = -1; 5271 global_sub_indices[SUB_SOURCE_SUBS] = -1;
5261 global_sub_size -= set_of_sub_size; 5272 global_sub_size -= set_of_sub_size;
5268 mp_input_queue_cmd(mp_input_parse_cmd("sub_select")); 5279 mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
5269 } 5280 }
5270 } 5281 }
5271 else if (v < set_of_sub_size) { 5282 else if (v < set_of_sub_size) {
5272 subd = set_of_subtitles[v]; 5283 subd = set_of_subtitles[v];
5273 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1, subd->filename); 5284 mp_msg(MSGT_CPLAYER, MSGL_STATUS, MSGTR_RemovedSubtitleFile, v + 1,
5285 filename_recode(subd->filename));
5274 sub_free(subd); 5286 sub_free(subd);
5275 if (set_of_sub_pos == v) { 5287 if (set_of_sub_pos == v) {
5276 global_sub_pos = -2; 5288 global_sub_pos = -2;
5277 vo_sub_last = vo_sub = NULL; 5289 vo_sub_last = vo_sub = NULL;
5278 vo_osd_changed(OSDTYPE_SUBTITLE); 5290 vo_osd_changed(OSDTYPE_SUBTITLE);