comparison mplayer.c @ 16992:58e526a6a8dc

Big OSD cleanup. Replace the mess with 100's of counter vars with a clean and simple interface. As a bonus osd messages can now be displayed on the console if there is no vo (or osd is disabled in libvo).
author albeu
date Wed, 16 Nov 2005 16:51:48 +0000
parents e9d849bf8050
children ded1cc937221
comparison
equal deleted inserted replaced
16991:4beb036cd4fc 16992:58e526a6a8dc
227 #define MAX_OSD_LEVEL 3 227 #define MAX_OSD_LEVEL 3
228 228
229 int osd_level=1; 229 int osd_level=1;
230 int osd_level_saved=-1; 230 int osd_level_saved=-1;
231 int osd_visible=100; 231 int osd_visible=100;
232 232 static int osd_function=OSD_PLAY;
233 static int osd_show_percentage = 0;
234 static int osd_duration = 1000;
235
236 static int term_osd = 1;
237 static char* term_osd_esc = "\x1b[A\r\x1b[K";
233 // seek: 238 // seek:
234 static char *seek_to_sec=NULL; 239 static char *seek_to_sec=NULL;
235 static off_t seek_to_byte=0; 240 static off_t seek_to_byte=0;
236 static off_t step_sec=0; 241 static off_t step_sec=0;
237 static int loop_times=-1; 242 static int loop_times=-1;
1030 } 1035 }
1031 fclose(f); 1036 fclose(f);
1032 } 1037 }
1033 #endif /* USE_SUB */ 1038 #endif /* USE_SUB */
1034 1039
1040 #define OSD_MSG_TV_CHANNEL 0
1041 #define OSD_MSG_TEXT 1
1042 #define OSD_MSG_SUB_DELAY 2
1043 #define OSD_MSG_SPEED 3
1044 #define OSD_MSG_OSD_STATUS 4
1045 #define OSD_MSG_BAR 5
1046 #define OSD_MSG_PAUSE 6
1047
1048 // These will later be implemented via properties and removed
1049 #define OSD_MSG_AV_DELAY 100
1050 #define OSD_MSG_FRAMEDROPPING 101
1051 #define OSD_MSG_ONTOP 102
1052 #define OSD_MSG_ROOTWIN 103
1053 #define OSD_MSG_BORDER 104
1054 #define OSD_MSG_SUB_POS 105
1055 #define OSD_MSG_SUB_ALIGN 106
1056 #define OSD_MSG_SUB_VISIBLE 107
1057 #define OSD_MSG_SUB_CHANGED 108
1058
1059 typedef struct mp_osd_msg mp_osd_msg_t;
1060 struct mp_osd_msg {
1061 mp_osd_msg_t* prev;
1062 char msg[64];
1063 int id,level,started;
1064 unsigned time; // Display duration in ms
1065 };
1066
1067 static mp_osd_msg_t* osd_msg_stack = NULL;
1068
1069 /**
1070 * \brief Add a message on the OSD message stack
1071 *
1072 * If a message with the same id is already present in the stack
1073 * it is pulled on top of the stack, otherwise a new message is created.
1074 *
1075 */
1076
1077 static void set_osd_msg(int id, int level, int time, char* fmt, ...) {
1078 mp_osd_msg_t *msg,*last=NULL;
1079 va_list va;
1080
1081 // look if the id is already in the stack
1082 for(msg = osd_msg_stack ; msg && msg->id != id ;
1083 last = msg, msg = msg->prev);
1084 // not found: alloc it
1085 if(!msg) {
1086 msg = calloc(1,sizeof(mp_osd_msg_t));
1087 msg->prev = osd_msg_stack;
1088 osd_msg_stack = msg;
1089 } else if(last) { // found, but it's not on top of the stack
1090 last->prev = msg->prev;
1091 msg->prev = osd_msg_stack;
1092 osd_msg_stack = msg;
1093 }
1094 // write the msg
1095 va_start(va,fmt);
1096 vsnprintf(msg->msg, 63, fmt, va);
1097 va_end(va);
1098 // set id and time
1099 msg->id = id;
1100 msg->level = level;
1101 msg->time = time;
1102
1103 }
1104
1105 /**
1106 * \brief Get the current message fron the OSD stack
1107 *
1108 * This function decrement the message timer and destroy the old ones.
1109 * The message that should be displayed is returned (if any).
1110 *
1111 */
1112
1113 static mp_osd_msg_t* get_osd_msg(void) {
1114 mp_osd_msg_t *msg,*prev,*last = NULL;
1115 static unsigned last_update = 0;
1116 unsigned now = GetTimerMS();
1117 unsigned diff;
1118 char hidden_dec_done = 0;
1119
1120 if(!last_update) last_update = now;
1121 diff = now >= last_update ? now - last_update : 0;
1122
1123 last_update = now;
1124
1125 // look for the first message in the stack with high enouth level
1126 for(msg = osd_msg_stack ; msg ; last = msg, msg = prev) {
1127 prev = msg->prev;
1128 if(msg->level > osd_level && hidden_dec_done) continue;
1129 // The message have an high enouth level or it is the first hidden one
1130 // in both case we decrement the timer or kill it
1131 if(!msg->started || msg->time > diff) {
1132 if(msg->started) msg->time -= diff;
1133 else msg->started = 1;
1134 // display it
1135 if(msg->level <= osd_level) return msg;
1136 hidden_dec_done = 1;
1137 continue;
1138 }
1139 // kill the message
1140 free(msg);
1141 if(last) {
1142 last->prev = prev;
1143 msg = last;
1144 } else {
1145 osd_msg_stack = prev;
1146 msg = NULL;
1147 }
1148 }
1149 // Nothing found
1150 return NULL;
1151 }
1152
1153 /**
1154 * \brief Display the OSD bar.
1155 *
1156 * Display the osd bar or fallback on a simple message.
1157 *
1158 */
1159
1160 void set_osd_bar(int type,char* name,double min,double max,double val) {
1161
1162 if(osd_level < 1) return;
1163
1164 #ifdef USE_OSD
1165 if(sh_video) {
1166 osd_visible = sh_video->fps;
1167 vo_osd_progbar_type = type;
1168 vo_osd_progbar_value = 256*(val-min)/(max-min);
1169 vo_osd_changed(OSDTYPE_PROGBAR);
1170 return;
1171 }
1172 #endif
1173
1174 set_osd_msg(OSD_MSG_BAR,1,osd_duration,"%s: %d %%",
1175 name,ROUND(100*(val-min)/(max-min)));
1176 }
1177
1178
1179 /**
1180 * \brief Update the OSD message line.
1181 *
1182 * This function display the current message on the vo osd or on the term.
1183 * If the stack is empty and the osd level is high enouth the timer
1184 * is displayed (only on the vo osd).
1185 *
1186 */
1187
1188 static void update_osd_msg(void) {
1189 mp_osd_msg_t *msg;
1190 static char osd_text[64] = "";
1191 static char osd_text_timer[64];
1192
1193 #ifdef USE_OSD
1194 // we need some mem for vo_osd_text
1195 vo_osd_text = (unsigned char*)osd_text;
1196 #endif
1197
1198 // Look if we have a msg
1199 if((msg = get_osd_msg())) {
1200 if(strcmp(osd_text,msg->msg)) {
1201 strncpy((char*)osd_text, msg->msg, 63);
1202 #ifdef USE_OSD
1203 if(sh_video) vo_osd_changed(OSDTYPE_OSD); else
1204 #endif
1205 if(term_osd) printf("%s%s\n",term_osd_esc,msg->msg);
1206 }
1207 return;
1208 }
1209
1210 #ifdef USE_OSD
1211 if(sh_video) {
1212 // fallback on the timer
1213 if(osd_level>=2) {
1214 int len = demuxer_get_time_length(demuxer);
1215 int percentage = -1;
1216 char percentage_text[10];
1217 static int last_pts = -303;
1218 int pts = sh_video->pts;
1219 if(pts==last_pts-1) ++pts; else last_pts=pts;
1220
1221 if (osd_show_percentage)
1222 percentage = demuxer_get_percent_pos(demuxer);
1223
1224 if (percentage >= 0)
1225 snprintf(percentage_text, 9, " (%d%%)", percentage);
1226 else
1227 percentage_text[0] = 0;
1228
1229 if (osd_level == 3)
1230 snprintf(osd_text_timer, 63,
1231 "%c %02d:%02d:%02d / %02d:%02d:%02d%s",
1232 osd_function,pts/3600,(pts/60)%60,pts%60,
1233 len/3600,(len/60)%60,len%60,percentage_text);
1234 else
1235 snprintf(osd_text_timer, 63, "%c %02d:%02d:%02d%s",
1236 osd_function,pts/3600,(pts/60)%60,
1237 pts%60,percentage_text);
1238 } else
1239 osd_text_timer[0]=0;
1240
1241 // always decrement the percentage timer
1242 if(osd_show_percentage)
1243 osd_show_percentage--;
1244
1245 if(strcmp(osd_text,osd_text_timer)) {
1246 strncpy(osd_text, osd_text_timer, 63);
1247 vo_osd_changed(OSDTYPE_OSD);
1248 }
1249 return;
1250 }
1251 #endif
1252
1253 // Clear the term osd line
1254 if(term_osd && osd_text[0]) {
1255 osd_text[0] = 0;
1256 printf("%s\n",term_osd_esc);
1257 }
1258 }
1259
1260
1035 int main(int argc,char* argv[]){ 1261 int main(int argc,char* argv[]){
1036 1262
1037 1263
1038 char * mem_ptr; 1264 char * mem_ptr;
1039 1265
1045 1271
1046 int delay_corrected=1; 1272 int delay_corrected=1;
1047 1273
1048 // movie info: 1274 // movie info:
1049 1275
1050 int osd_function=OSD_PLAY; 1276 // still needed for the subtitles mess
1051 int osd_last_pts=-303;
1052 int osd_show_av_delay = 0;
1053 int osd_show_text = 0;
1054 int osd_show_speed = 0;
1055 int osd_show_sub_delay = 0;
1056 int osd_show_sub_pos = 0;
1057 int osd_show_sub_visibility = 0;
1058 int osd_show_sub_alignment = 0;
1059 int osd_show_vobsub_changed = 0; 1277 int osd_show_vobsub_changed = 0;
1060 int osd_show_sub_changed = 0; 1278 int osd_show_sub_changed = 0;
1061 int osd_show_percentage = 0;
1062 int osd_show_tv_channel = 25;
1063 int osd_show_ontop = 0;
1064 int osd_show_rootwin = 0;
1065 int osd_show_border = 0;
1066 int osd_show_framedropping = 0;
1067 int osd_show_status = 0;
1068 1279
1069 int rtc_fd=-1; 1280 int rtc_fd=-1;
1070 1281
1071 int opt_exit = 0; // flag indicating whether mplayer should exit without playing anything 1282 int opt_exit = 0; // flag indicating whether mplayer should exit without playing anything
1072 1283
2171 2382
2172 //================== MAIN: ========================== 2383 //================== MAIN: ==========================
2173 main: 2384 main:
2174 current_module="main"; 2385 current_module="main";
2175 2386
2176 // If there is no video OSD has to be disabled. 2387 // Disable the term osd in verbose mode
2177 // In case of playing a playtree we have to restore the 2388 if(verbose) term_osd = 0;
2178 // old OSD level after playing one or more audio-only files.
2179 if(!sh_video && osd_level >= 0) { // save OSD level only once
2180 osd_level_saved = osd_level;
2181 osd_level = 0;
2182 } else if (osd_level_saved > -1) { // if there is a saved OSD level, restore it
2183 osd_level = osd_level_saved;
2184 osd_level_saved = -1;
2185 }
2186
2187 fflush(stdout); 2389 fflush(stdout);
2188 2390
2189 #ifdef HAVE_NEW_GUI 2391 #ifdef HAVE_NEW_GUI
2190 if ( use_gui ) 2392 if ( use_gui )
2191 { 2393 {
2759 #endif 2961 #endif
2760 2962
2761 if(osd_function==OSD_PAUSE){ 2963 if(osd_function==OSD_PAUSE){
2762 mp_cmd_t* cmd; 2964 mp_cmd_t* cmd;
2763 if(!quiet) { 2965 if(!quiet) {
2764 mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused); 2966 // small hack to display the pause message in the osd line
2967 // The pause string is: "\n == PAUSE == \r" so we need to
2968 // take the first and the last char out
2969 #ifdef USE_OSD
2970 if(term_osd && !sh_video) {
2971 #else
2972 if(term_osd) {
2973 #endif
2974 char msg[128] = MSGTR_Paused;
2975 int mlen = strlen(msg);
2976 msg[mlen-1] = '\0';
2977 set_osd_msg(OSD_MSG_PAUSE,1,0,"%s",msg+1);
2978 update_osd_msg();
2979 } else
2980 mp_msg(MSGT_CPLAYER,MSGL_STATUS,MSGTR_Paused);
2765 if (identify) 2981 if (identify)
2766 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_PAUSED\n"); 2982 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ID_PAUSED\n");
2767 fflush(stdout); 2983 fflush(stdout);
2768 } 2984 }
2769 #ifdef HAVE_NEW_GUI 2985 #ifdef HAVE_NEW_GUI
2898 mpcodecs_config_vo (sh_video, sh_video->disp_w, sh_video->disp_h, 0); 3114 mpcodecs_config_vo (sh_video, sh_video->disp_w, sh_video->disp_h, 0);
2899 } break; 3115 } break;
2900 case MP_CMD_AUDIO_DELAY : { 3116 case MP_CMD_AUDIO_DELAY : {
2901 float v = cmd->args[0].v.f; 3117 float v = cmd->args[0].v.f;
2902 audio_delay += v; 3118 audio_delay += v;
2903 osd_show_av_delay = sh_video->fps/2; 3119 set_osd_msg(OSD_MSG_AV_DELAY,1,osd_duration,MSGTR_OSDAVDelay,
3120 ROUND(audio_delay*1000));
2904 if(sh_audio) sh_audio->delay+= v; 3121 if(sh_audio) sh_audio->delay+= v;
2905 } break; 3122 } break;
2906 case MP_CMD_SPEED_INCR : { 3123 case MP_CMD_SPEED_INCR : {
2907 float v = cmd->args[0].v.f; 3124 float v = cmd->args[0].v.f;
2908 playback_speed += v; 3125 playback_speed += v;
2909 if (sh_video) 3126 set_osd_msg(OSD_MSG_SPEED,1,osd_duration,MSGTR_OSDSpeed, playback_speed);
2910 osd_show_speed = sh_video->fps;
2911 build_afilter_chain(sh_audio, &ao_data); 3127 build_afilter_chain(sh_audio, &ao_data);
2912 } break; 3128 } break;
2913 case MP_CMD_SPEED_MULT : { 3129 case MP_CMD_SPEED_MULT : {
2914 float v = cmd->args[0].v.f; 3130 float v = cmd->args[0].v.f;
2915 playback_speed *= v; 3131 playback_speed *= v;
2916 if (sh_video) 3132 set_osd_msg(OSD_MSG_SPEED,1,osd_duration,MSGTR_OSDSpeed, playback_speed);
2917 osd_show_speed = sh_video->fps;
2918 build_afilter_chain(sh_audio, &ao_data); 3133 build_afilter_chain(sh_audio, &ao_data);
2919 } break; 3134 } break;
2920 case MP_CMD_SPEED_SET : { 3135 case MP_CMD_SPEED_SET : {
2921 float v = cmd->args[0].v.f; 3136 float v = cmd->args[0].v.f;
2922 playback_speed = v; 3137 playback_speed = v;
2923 if (sh_video) 3138 set_osd_msg(OSD_MSG_SPEED,1,osd_duration,MSGTR_OSDSpeed, playback_speed);
2924 osd_show_speed = sh_video->fps;
2925 build_afilter_chain(sh_audio, &ao_data); 3139 build_afilter_chain(sh_audio, &ao_data);
2926 } break; 3140 } break;
2927 case MP_CMD_FRAME_STEP : 3141 case MP_CMD_FRAME_STEP :
2928 case MP_CMD_PAUSE : { 3142 case MP_CMD_PAUSE : {
2929 cmd->pausing = 1; 3143 cmd->pausing = 1;
2994 float v = cmd->args[0].v.f; 3208 float v = cmd->args[0].v.f;
2995 if(abs) 3209 if(abs)
2996 sub_delay = v; 3210 sub_delay = v;
2997 else 3211 else
2998 sub_delay += v; 3212 sub_delay += v;
2999 osd_show_sub_delay = sh_video->fps/2; // show the subdelay in OSD 3213 set_osd_msg(OSD_MSG_SUB_DELAY,1,osd_duration,
3214 MSGTR_OSDSubDelay, ROUND(sub_delay*1000));
3000 } 3215 }
3001 #endif 3216 #endif
3002 } break; 3217 } break;
3003 case MP_CMD_SUB_STEP : { 3218 case MP_CMD_SUB_STEP : {
3004 #ifdef USE_SUB 3219 #ifdef USE_SUB
3005 if (sh_video) { 3220 if (sh_video) {
3006 int movement = cmd->args[0].v.i; 3221 int movement = cmd->args[0].v.i;
3007 step_sub(subdata, sh_video->pts, movement); 3222 step_sub(subdata, sh_video->pts, movement);
3008 osd_show_sub_delay = sh_video->fps/2; // show the subdelay in OSD 3223 set_osd_msg(OSD_MSG_SUB_DELAY,1,osd_duration,
3224 MSGTR_OSDSubDelay, ROUND(sub_delay*1000));
3009 } 3225 }
3010 #endif 3226 #endif
3011 } break; 3227 } break;
3012 case MP_CMD_SUB_LOG : { 3228 case MP_CMD_SUB_LOG : {
3013 #ifdef USE_SUB 3229 #ifdef USE_SUB
3014 log_sub(); 3230 log_sub();
3015 #endif 3231 #endif
3016 } break; 3232 } break;
3017 case MP_CMD_OSD : { 3233 case MP_CMD_OSD : {
3018 #ifdef USE_OSD
3019 if(sh_video) {
3020 int v = cmd->args[0].v.i; 3234 int v = cmd->args[0].v.i;
3021 if(v < 0) 3235 if(v < 0)
3022 osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1); 3236 osd_level=(osd_level+1)%(MAX_OSD_LEVEL+1);
3023 else 3237 else
3024 osd_level= v > MAX_OSD_LEVEL ? MAX_OSD_LEVEL : v; 3238 osd_level= v > MAX_OSD_LEVEL ? MAX_OSD_LEVEL : v;
3025 /* Show OSD state when disabled, but not when an explicit 3239 /* Show OSD state when disabled, but not when an explicit
3026 argument is given to the osd command, i.e. in slave mode. */ 3240 argument is given to the osd command, i.e. in slave mode. */
3027 if (v == -1 && osd_level <= 1) 3241 if (v == -1 && osd_level <= 1)
3028 osd_show_status = sh_video->fps/2; 3242 set_osd_msg(OSD_MSG_OSD_STATUS,0,osd_duration,
3029 } 3243 MSGTR_OSDosd, osd_level ? MSGTR_OSDenabled : MSGTR_OSDdisabled);
3030 #endif
3031 } break; 3244 } break;
3032 case MP_CMD_OSD_SHOW_TEXT : { 3245 case MP_CMD_OSD_SHOW_TEXT : {
3033 #ifdef USE_OSD 3246 set_osd_msg(OSD_MSG_TEXT,1,osd_duration,"%64s",cmd->args[0].v.s);
3034 if(osd_level && sh_video){
3035 osd_show_text=sh_video->fps; // 1 sec
3036 strncpy(osd_show_text_buffer, cmd->args[0].v.s, 64);
3037 }
3038 #endif
3039 } break; 3247 } break;
3040 case MP_CMD_VOLUME : { 3248 case MP_CMD_VOLUME : {
3041 int v = cmd->args[0].v.i; 3249 int v = cmd->args[0].v.i;
3042 3250
3043 // start change for absolute volume value 3251 // start change for absolute volume value
3055 mixer_incvolume(&mixer); 3263 mixer_incvolume(&mixer);
3056 else 3264 else
3057 mixer_decvolume(&mixer); 3265 mixer_decvolume(&mixer);
3058 } 3266 }
3059 3267
3060 #ifdef USE_OSD 3268 if(1){
3061 if(osd_level && sh_video){
3062 float vol; 3269 float vol;
3063 osd_visible=sh_video->fps; // 1 sec
3064 vo_osd_progbar_type=OSD_VOLUME;
3065 mixer_getbothvolume(&mixer, &vol); 3270 mixer_getbothvolume(&mixer, &vol);
3066 vo_osd_progbar_value=(vol*256.0)/100.0; 3271 set_osd_bar(OSD_VOLUME,"Volume",0,100,vol);
3067 vo_osd_changed(OSDTYPE_PROGBAR); 3272 }
3068 }
3069 #endif
3070 } break; 3273 } break;
3071 case MP_CMD_MUTE: 3274 case MP_CMD_MUTE:
3072 #ifdef USE_EDL 3275 #ifdef USE_EDL
3073 user_muted = !user_muted; 3276 user_muted = !user_muted;
3074 if ((edl_muted | user_muted) != mixer.muted) 3277 if ((edl_muted | user_muted) != mixer.muted)
3130 3333
3131 if (vo_gamma_gamma > 100) 3334 if (vo_gamma_gamma > 100)
3132 vo_gamma_gamma = 100; 3335 vo_gamma_gamma = 100;
3133 else if (vo_gamma_gamma < -100) 3336 else if (vo_gamma_gamma < -100)
3134 vo_gamma_gamma = -100; 3337 vo_gamma_gamma = -100;
3135 if (set_video_colors(sh_video, "gamma", vo_gamma_gamma)){ 3338 if (set_video_colors(sh_video, "gamma", vo_gamma_gamma))
3136 #ifdef USE_OSD 3339 set_osd_bar(OSD_BRIGHTNESS,"Gamma",-100,100,vo_gamma_gamma);
3137 if(osd_level){
3138 osd_visible=sh_video->fps; // 1 sec
3139 vo_osd_progbar_type=OSD_BRIGHTNESS;
3140 vo_osd_progbar_value=(vo_gamma_gamma<<7)/100 + 128;
3141 vo_osd_changed(OSDTYPE_PROGBAR);
3142 }
3143 #endif // USE_OSD
3144 }
3145 } break; 3340 } break;
3146 case MP_CMD_BRIGHTNESS : { 3341 case MP_CMD_BRIGHTNESS : {
3147 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; 3342 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i;
3148 3343
3149 if (!sh_video) 3344 if (!sh_video)
3162 3357
3163 if (vo_gamma_brightness > 100) 3358 if (vo_gamma_brightness > 100)
3164 vo_gamma_brightness = 100; 3359 vo_gamma_brightness = 100;
3165 else if (vo_gamma_brightness < -100) 3360 else if (vo_gamma_brightness < -100)
3166 vo_gamma_brightness = -100; 3361 vo_gamma_brightness = -100;
3167 if(set_video_colors(sh_video, "brightness", vo_gamma_brightness)){ 3362 if(set_video_colors(sh_video, "brightness", vo_gamma_brightness))
3168 #ifdef USE_OSD 3363 set_osd_bar(OSD_BRIGHTNESS,"Brightness",-100,100,vo_gamma_brightness);
3169 if(osd_level){
3170 osd_visible=sh_video->fps; // 1 sec
3171 vo_osd_progbar_type=OSD_BRIGHTNESS;
3172 vo_osd_progbar_value=(vo_gamma_brightness<<7)/100 + 128;
3173 vo_osd_changed(OSDTYPE_PROGBAR);
3174 }
3175 #endif // USE_OSD
3176 }
3177 } break; 3364 } break;
3178 case MP_CMD_CONTRAST : { 3365 case MP_CMD_CONTRAST : {
3179 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; 3366 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i;
3180 3367
3181 if (!sh_video) 3368 if (!sh_video)
3194 3381
3195 if (vo_gamma_contrast > 100) 3382 if (vo_gamma_contrast > 100)
3196 vo_gamma_contrast = 100; 3383 vo_gamma_contrast = 100;
3197 else if (vo_gamma_contrast < -100) 3384 else if (vo_gamma_contrast < -100)
3198 vo_gamma_contrast = -100; 3385 vo_gamma_contrast = -100;
3199 if(set_video_colors(sh_video, "contrast", vo_gamma_contrast)){ 3386 if(set_video_colors(sh_video, "contrast", vo_gamma_contrast))
3200 #ifdef USE_OSD 3387 set_osd_bar(OSD_CONTRAST,"Contrast",-100,100,vo_gamma_contrast);
3201 if(osd_level){
3202 osd_visible=sh_video->fps; // 1 sec
3203 vo_osd_progbar_type=OSD_CONTRAST;
3204 vo_osd_progbar_value=(vo_gamma_contrast<<7)/100 + 128;
3205 vo_osd_changed(OSDTYPE_PROGBAR);
3206 }
3207 #endif // USE_OSD
3208 }
3209 } break; 3388 } break;
3210 case MP_CMD_SATURATION : { 3389 case MP_CMD_SATURATION : {
3211 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; 3390 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i;
3212 3391
3213 if (!sh_video) 3392 if (!sh_video)
3226 3405
3227 if (vo_gamma_saturation > 100) 3406 if (vo_gamma_saturation > 100)
3228 vo_gamma_saturation = 100; 3407 vo_gamma_saturation = 100;
3229 else if (vo_gamma_saturation < -100) 3408 else if (vo_gamma_saturation < -100)
3230 vo_gamma_saturation = -100; 3409 vo_gamma_saturation = -100;
3231 if(set_video_colors(sh_video, "saturation", vo_gamma_saturation)){ 3410 if(set_video_colors(sh_video, "saturation", vo_gamma_saturation))
3232 #ifdef USE_OSD 3411 set_osd_bar(OSD_SATURATION,"Saturation",-100,100,vo_gamma_saturation);
3233 if(osd_level){
3234 osd_visible=sh_video->fps; // 1 sec
3235 vo_osd_progbar_type=OSD_SATURATION;
3236 vo_osd_progbar_value=(vo_gamma_saturation<<7)/100 + 128;
3237 vo_osd_changed(OSDTYPE_PROGBAR);
3238 }
3239 #endif // USE_OSD
3240 }
3241 } break; 3412 } break;
3242 case MP_CMD_HUE : { 3413 case MP_CMD_HUE : {
3243 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i; 3414 int v = cmd->args[0].v.i, abs = cmd->args[1].v.i;
3244 3415
3245 if (!sh_video) 3416 if (!sh_video)
3258 3429
3259 if (vo_gamma_hue > 100) 3430 if (vo_gamma_hue > 100)
3260 vo_gamma_hue = 100; 3431 vo_gamma_hue = 100;
3261 else if (vo_gamma_hue < -100) 3432 else if (vo_gamma_hue < -100)
3262 vo_gamma_hue = -100; 3433 vo_gamma_hue = -100;
3263 if(set_video_colors(sh_video, "hue", vo_gamma_hue)){ 3434 if(set_video_colors(sh_video, "hue", vo_gamma_hue))
3264 #ifdef USE_OSD 3435 set_osd_bar(OSD_HUE,"Hue",-100,100,vo_gamma_hue);
3265 if(osd_level){
3266 osd_visible=sh_video->fps; // 1 sec
3267 vo_osd_progbar_type=OSD_HUE;
3268 vo_osd_progbar_value=(vo_gamma_hue<<7)/100 + 128;
3269 vo_osd_changed(OSDTYPE_PROGBAR);
3270 }
3271 #endif // USE_OSD
3272 }
3273 } break; 3436 } break;
3274 case MP_CMD_FRAMEDROPPING : { 3437 case MP_CMD_FRAMEDROPPING : {
3275 int v = cmd->args[0].v.i; 3438 int v = cmd->args[0].v.i;
3276 if(v < 0){ 3439 if(v < 0)
3277 frame_dropping = (frame_dropping+1)%3; 3440 frame_dropping = (frame_dropping+1)%3;
3278 #ifdef USE_OSD
3279 osd_show_framedropping=sh_video->fps/2;
3280 vo_osd_changed(OSDTYPE_SUBTITLE);
3281 #endif
3282 }
3283 else 3441 else
3284 frame_dropping = v > 2 ? 2 : v; 3442 frame_dropping = v > 2 ? 2 : v;
3443 set_osd_msg(OSD_MSG_FRAMEDROPPING,1,osd_duration,
3444 MSGTR_OSDFramedrop,(frame_dropping == 1 ? MSGTR_OSDFramedropOn :
3445 (frame_dropping == 2 ? MSGTR_OSDFramedropHard :
3446 MSGTR_OSDFramedropOff)));
3447 //vo_osd_changed(OSDTYPE_SUBTITLE);
3285 } break; 3448 } break;
3286 #ifdef USE_TV 3449 #ifdef USE_TV
3287 case MP_CMD_TV_SET_FREQ : { 3450 case MP_CMD_TV_SET_FREQ : {
3288 if (file_format == DEMUXER_TYPE_TV) 3451 if (file_format == DEMUXER_TYPE_TV)
3289 tv_set_freq((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.f * 16.0); 3452 tv_set_freq((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.f * 16.0);
3311 case MP_CMD_TV_STEP_CHANNEL : { 3474 case MP_CMD_TV_STEP_CHANNEL : {
3312 if (file_format == DEMUXER_TYPE_TV) { 3475 if (file_format == DEMUXER_TYPE_TV) {
3313 int v = cmd->args[0].v.i; 3476 int v = cmd->args[0].v.i;
3314 if(v > 0){ 3477 if(v > 0){
3315 tv_step_channel((tvi_handle_t*)(demuxer->priv), TV_CHANNEL_HIGHER); 3478 tv_step_channel((tvi_handle_t*)(demuxer->priv), TV_CHANNEL_HIGHER);
3316 #ifdef USE_OSD
3317 if (tv_channel_list) {
3318 osd_show_tv_channel = sh_video->fps;
3319 vo_osd_changed(OSDTYPE_SUBTITLE);
3320 }
3321 #endif
3322 } else { 3479 } else {
3323 tv_step_channel((tvi_handle_t*)(demuxer->priv), TV_CHANNEL_LOWER); 3480 tv_step_channel((tvi_handle_t*)(demuxer->priv), TV_CHANNEL_LOWER);
3324 #ifdef USE_OSD
3325 if (tv_channel_list) {
3326 osd_show_tv_channel = sh_video->fps;
3327 vo_osd_changed(OSDTYPE_SUBTITLE);
3328 }
3329 #endif
3330 } 3481 }
3482 if (tv_channel_list) {
3483 set_osd_msg(OSD_MSG_TV_CHANNEL,1,osd_duration,
3484 MSGTR_OSDChannel, tv_channel_current->name);
3485 //vo_osd_changed(OSDTYPE_SUBTITLE);
3486 }
3331 } 3487 }
3332 } 3488 }
3333 #ifdef HAS_DVBIN_SUPPORT 3489 #ifdef HAS_DVBIN_SUPPORT
3334 if((stream->type == STREAMTYPE_DVB) && stream->priv) 3490 if((stream->type == STREAMTYPE_DVB) && stream->priv)
3335 { 3491 {
3357 #endif /* HAS_DVBIN_SUPPORT */ 3513 #endif /* HAS_DVBIN_SUPPORT */
3358 break; 3514 break;
3359 case MP_CMD_TV_SET_CHANNEL : { 3515 case MP_CMD_TV_SET_CHANNEL : {
3360 if (file_format == DEMUXER_TYPE_TV) { 3516 if (file_format == DEMUXER_TYPE_TV) {
3361 tv_set_channel((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.s); 3517 tv_set_channel((tvi_handle_t*)(demuxer->priv), cmd->args[0].v.s);
3362 #ifdef USE_OSD
3363 if (tv_channel_list) { 3518 if (tv_channel_list) {
3364 osd_show_tv_channel = sh_video->fps; 3519 set_osd_msg(OSD_MSG_TV_CHANNEL,1,osd_duration,
3365 vo_osd_changed(OSDTYPE_SUBTITLE); 3520 MSGTR_OSDChannel, tv_channel_current->name);
3521 //vo_osd_changed(OSDTYPE_SUBTITLE);
3366 } 3522 }
3367 #endif
3368 } 3523 }
3369 } break; 3524 } break;
3370 #ifdef HAS_DVBIN_SUPPORT 3525 #ifdef HAS_DVBIN_SUPPORT
3371 case MP_CMD_DVB_SET_CHANNEL: 3526 case MP_CMD_DVB_SET_CHANNEL:
3372 { 3527 {
3391 } 3546 }
3392 #endif /* HAS_DVBIN_SUPPORT */ 3547 #endif /* HAS_DVBIN_SUPPORT */
3393 case MP_CMD_TV_LAST_CHANNEL : { 3548 case MP_CMD_TV_LAST_CHANNEL : {
3394 if (file_format == DEMUXER_TYPE_TV) { 3549 if (file_format == DEMUXER_TYPE_TV) {
3395 tv_last_channel((tvi_handle_t*)(demuxer->priv)); 3550 tv_last_channel((tvi_handle_t*)(demuxer->priv));
3396 #ifdef USE_OSD
3397 if (tv_channel_list) { 3551 if (tv_channel_list) {
3398 osd_show_tv_channel = sh_video->fps; 3552 set_osd_msg(OSD_MSG_TV_CHANNEL,1,osd_duration,
3399 vo_osd_changed(OSDTYPE_SUBTITLE); 3553 MSGTR_OSDChannel, tv_channel_current->name);
3554 //vo_osd_changed(OSDTYPE_SUBTITLE);
3400 } 3555 }
3401 #endif
3402 } 3556 }
3403 } break; 3557 } break;
3404 case MP_CMD_TV_STEP_NORM : { 3558 case MP_CMD_TV_STEP_NORM : {
3405 if (file_format == DEMUXER_TYPE_TV) 3559 if (file_format == DEMUXER_TYPE_TV)
3406 tv_step_norm((tvi_handle_t*)(demuxer->priv)); 3560 tv_step_norm((tvi_handle_t*)(demuxer->priv));
3423 } break; 3577 } break;
3424 case MP_CMD_VO_ONTOP: 3578 case MP_CMD_VO_ONTOP:
3425 { 3579 {
3426 if(video_out && vo_config_count) { 3580 if(video_out && vo_config_count) {
3427 video_out->control(VOCTRL_ONTOP, 0); 3581 video_out->control(VOCTRL_ONTOP, 0);
3428 #ifdef USE_OSD 3582 set_osd_msg(OSD_MSG_ONTOP,1,osd_duration,
3429 osd_show_ontop=sh_video->fps/2; 3583 MSGTR_OSDStayOnTop, vo_ontop? MSGTR_OSDenabled : MSGTR_OSDdisabled);
3430 vo_osd_changed(OSDTYPE_SUBTITLE); 3584 //vo_osd_changed(OSDTYPE_SUBTITLE);
3431 #endif
3432 } 3585 }
3433 3586
3434 } break; 3587 } break;
3435 case MP_CMD_VO_ROOTWIN: 3588 case MP_CMD_VO_ROOTWIN:
3436 { 3589 {
3437 if(video_out && vo_config_count) { 3590 if(video_out && vo_config_count) {
3438 video_out->control(VOCTRL_ROOTWIN, 0); 3591 video_out->control(VOCTRL_ROOTWIN, 0);
3439 #ifdef USE_OSD 3592 set_osd_msg(OSD_MSG_ROOTWIN,1,osd_duration,
3440 osd_show_rootwin=sh_video->fps/2; 3593 MSGTR_OSDRootwin, vo_rootwin? MSGTR_OSDenabled : MSGTR_OSDdisabled);
3441 vo_osd_changed(OSDTYPE_SUBTITLE); 3594 //vo_osd_changed(OSDTYPE_SUBTITLE);
3442 #endif
3443 } 3595 }
3444 3596
3445 } break; 3597 } break;
3446 case MP_CMD_VO_BORDER: 3598 case MP_CMD_VO_BORDER:
3447 { 3599 {
3448 if(video_out && vo_config_count) { 3600 if(video_out && vo_config_count) {
3449 video_out->control(VOCTRL_BORDER, 0); 3601 video_out->control(VOCTRL_BORDER, 0);
3450 #ifdef USE_OSD 3602 set_osd_msg(OSD_MSG_BORDER,1,osd_duration,
3451 osd_show_border=10; 3603 MSGTR_OSDBorder, vo_border? MSGTR_OSDenabled : MSGTR_OSDdisabled);
3452 vo_osd_changed(OSDTYPE_SUBTITLE); 3604 //vo_osd_changed(OSDTYPE_SUBTITLE);
3453 #endif
3454 } 3605 }
3455 3606
3456 } break; 3607 } break;
3457 case MP_CMD_PANSCAN : { 3608 case MP_CMD_PANSCAN : {
3458 if ( !video_out ) break; 3609 if ( !video_out ) break;
3463 float res; 3614 float res;
3464 if(abs) res = v; 3615 if(abs) res = v;
3465 else res = vo_panscan+v; 3616 else res = vo_panscan+v;
3466 vo_panscan = res > 1 ? 1 : res < 0 ? 0 : res; 3617 vo_panscan = res > 1 ? 1 : res < 0 ? 0 : res;
3467 video_out->control( VOCTRL_SET_PANSCAN,NULL ); 3618 video_out->control( VOCTRL_SET_PANSCAN,NULL );
3468 #ifdef USE_OSD 3619 set_osd_bar(OSD_PANSCAN,"Panscan",0,1,vo_panscan);
3469 if(osd_level && sh_video){
3470 osd_visible=sh_video->fps; // 1 sec
3471 vo_osd_progbar_type=OSD_PANSCAN;
3472 vo_osd_progbar_value=vo_panscan*256;
3473 vo_osd_changed(OSDTYPE_PROGBAR);
3474 }
3475 #endif
3476 } 3620 }
3477 } break; 3621 } break;
3478 case MP_CMD_SUB_POS: 3622 case MP_CMD_SUB_POS:
3479 { 3623 {
3480 #ifdef USE_SUB 3624 #ifdef USE_SUB
3483 v = cmd->args[0].v.i; 3627 v = cmd->args[0].v.i;
3484 3628
3485 sub_pos+=v; 3629 sub_pos+=v;
3486 if(sub_pos >100) sub_pos=100; 3630 if(sub_pos >100) sub_pos=100;
3487 if(sub_pos <0) sub_pos=0; 3631 if(sub_pos <0) sub_pos=0;
3632 set_osd_msg(OSD_MSG_SUB_POS,1,osd_duration,
3633 MSGTR_OSDSubPosition, sub_pos);
3488 vo_osd_changed(OSDTYPE_SUBTITLE); 3634 vo_osd_changed(OSDTYPE_SUBTITLE);
3489 osd_show_sub_pos = sh_video->fps/2;
3490 } 3635 }
3491 #endif 3636 #endif
3492 } break; 3637 } break;
3493 case MP_CMD_SUB_ALIGNMENT: 3638 case MP_CMD_SUB_ALIGNMENT:
3494 { 3639 {
3496 if (sh_video) { 3641 if (sh_video) {
3497 if (cmd->nargs >= 1) 3642 if (cmd->nargs >= 1)
3498 sub_alignment = cmd->args[0].v.i; 3643 sub_alignment = cmd->args[0].v.i;
3499 else 3644 else
3500 sub_alignment = (sub_alignment+1) % 3; 3645 sub_alignment = (sub_alignment+1) % 3;
3501 osd_show_sub_alignment = sh_video->fps/2; 3646 set_osd_msg(OSD_MSG_SUB_ALIGN,1,osd_duration,
3647 MSGTR_OSDSubAlignment,(sub_alignment == 2 ? MSGTR_OSDSubBottom :
3648 (sub_alignment == 1 ? MSGTR_OSDSubCenter : MSGTR_OSDSubTop)));
3502 vo_osd_changed(OSDTYPE_SUBTITLE); 3649 vo_osd_changed(OSDTYPE_SUBTITLE);
3503 } 3650 }
3504 #endif 3651 #endif
3505 } break; 3652 } break;
3506 case MP_CMD_SUB_VISIBILITY: 3653 case MP_CMD_SUB_VISIBILITY:
3507 { 3654 {
3508 #ifdef USE_SUB 3655 #ifdef USE_SUB
3509 if (sh_video) { 3656 if (sh_video) {
3510 sub_visibility=1-sub_visibility; 3657 sub_visibility=1-sub_visibility;
3511 osd_show_sub_visibility = sh_video->fps/2; // show state of subtitle visibility in OSD 3658 set_osd_msg(OSD_MSG_SUB_VISIBLE,1,osd_duration,
3659 MSGTR_OSDSubtitles, sub_visibility?MSGTR_OSDenabled:MSGTR_OSDdisabled);
3512 vo_osd_changed(OSDTYPE_SUBTITLE); 3660 vo_osd_changed(OSDTYPE_SUBTITLE);
3513 } 3661 }
3514 #endif 3662 #endif
3515 } break; 3663 } break;
3516 case MP_CMD_SUB_LOAD: 3664 case MP_CMD_SUB_LOAD:
4022 4170
4023 if(sh_audio){ 4171 if(sh_audio){
4024 current_module="seek_audio_reset"; 4172 current_module="seek_audio_reset";
4025 audio_out->reset(); // stop audio, throwing away buffered data 4173 audio_out->reset(); // stop audio, throwing away buffered data
4026 } 4174 }
4027 #ifdef USE_OSD
4028 // Set OSD: 4175 // Set OSD:
4029 if(osd_level && !loop_seek){ 4176 if(!loop_seek){
4030 #ifdef USE_EDL 4177 #ifdef USE_EDL
4031 if( !edl_decision ) { 4178 if( !edl_decision )
4032 #else 4179 #endif
4033 if( 1 ) { // Let the compiler optimize this out 4180 set_osd_bar(0,"Position",0,100,demuxer_get_percent_pos(demuxer));
4034 #endif 4181 }
4035 if (sh_video) { 4182
4036 osd_visible=sh_video->fps; // 1 sec
4037 vo_osd_progbar_type=0;
4038 vo_osd_progbar_value=demuxer_get_percent_pos(demuxer) * 256 / 100;
4039 vo_osd_changed(OSDTYPE_PROGBAR);
4040 }
4041 }
4042 }
4043 #endif /* USE_OSD */
4044 if(sh_video) { 4183 if(sh_video) {
4045 c_total=0; 4184 c_total=0;
4046 max_pts_correction=0.1; 4185 max_pts_correction=0.1;
4047 osd_visible=sh_video->fps; // to rewert to PLAY pointer after 1 sec 4186 osd_visible=sh_video->fps; // to rewert to PLAY pointer after 1 sec
4048 audio_time_usage=0; video_time_usage=0; vout_time_usage=0; 4187 audio_time_usage=0; video_time_usage=0; vout_time_usage=0;
4114 #endif /* HAVE_NEW_GUI */ 4253 #endif /* HAVE_NEW_GUI */
4115 4254
4116 4255
4117 //================= Update OSD ==================== 4256 //================= Update OSD ====================
4118 #ifdef USE_OSD 4257 #ifdef USE_OSD
4119 if(osd_level>=1 && sh_video){ 4258 if(sh_video){
4120 int pts=sh_video->pts;
4121 char osd_text_tmp[64]; 4259 char osd_text_tmp[64];
4122 if(pts==osd_last_pts-1) ++pts; else osd_last_pts=pts; 4260 // The subtitles stuff is particulary messy. Keep the mess for now it will be
4123 vo_osd_text=osd_text_buffer; 4261 // cleaned up when properties get implemented.
4124 #ifdef USE_DVDNAV
4125 if (osd_show_dvd_nav_delay) {
4126 snprintf(osd_text_tmp, 63, MSGTR_OSDDVDNAV, dvd_nav_text);
4127 osd_show_dvd_nav_delay--;
4128 } else
4129 #endif
4130 #ifdef USE_TV
4131 if (osd_show_tv_channel && tv_channel_list) {
4132 snprintf(osd_text_tmp, 63, MSGTR_OSDChannel, tv_channel_current->name);
4133 osd_show_tv_channel--;
4134 } else
4135 #endif
4136 if (osd_show_text) {
4137 snprintf(osd_text_tmp, 63, "%s", osd_show_text_buffer);
4138 osd_show_text--;
4139 } else
4140 if (osd_show_sub_visibility) {
4141 snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitles, sub_visibility? MSGTR_OSDenabled : MSGTR_OSDdisabled);
4142 osd_show_sub_visibility--;
4143 } else
4144 if (osd_show_vobsub_changed) { 4262 if (osd_show_vobsub_changed) {
4145 snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesOff); 4263 snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesOff);
4146 switch (demuxer->type) { 4264 switch (demuxer->type) {
4147 #ifdef HAVE_MATROSKA 4265 #ifdef HAVE_MATROSKA
4148 case DEMUXER_TYPE_MATROSKA: 4266 case DEMUXER_TYPE_MATROSKA:
4180 snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesLanguage, dvdsub_id, code ? lang : MSGTR_OSDnone); 4298 snprintf(osd_text_tmp, 63, MSGTR_OSDSubtitlesLanguage, dvdsub_id, code ? lang : MSGTR_OSDnone);
4181 } 4299 }
4182 #endif 4300 #endif
4183 break; 4301 break;
4184 } 4302 }
4185 osd_show_vobsub_changed--; 4303 osd_show_vobsub_changed = 0;
4304 set_osd_msg(OSD_MSG_SUB_CHANGED,1,osd_duration,
4305 "%s",osd_text_tmp);
4186 } else 4306 } else
4187 #ifdef USE_SUB 4307 #ifdef USE_SUB
4188 if (osd_show_sub_changed) { 4308 if (osd_show_sub_changed) {
4189 char *tmp2; 4309 char *tmp2;
4190 tmp = subdata->filename; 4310 tmp = subdata->filename;
4191 if ((tmp2 = strrchr(tmp, '/'))) { 4311 if ((tmp2 = strrchr(tmp, '/'))) {
4192 tmp = tmp2+1; 4312 tmp = tmp2+1;
4193 } 4313 }
4194 snprintf(osd_text_tmp, 63, MSGTR_OSDSub, 4314 set_osd_msg(OSD_MSG_SUB_CHANGED,1,osd_duration,
4195 set_of_sub_pos + 1, 4315 MSGTR_OSDSub, set_of_sub_pos + 1,
4196 strlen(tmp) < 20 ? "" : "...", 4316 strlen(tmp) < 20 ? "" : "...",
4197 strlen(tmp) < 20 ? tmp : tmp+strlen(tmp)-19); 4317 strlen(tmp) < 20 ? tmp : tmp+strlen(tmp)-19);
4198 osd_show_sub_changed--; 4318 osd_show_sub_changed = 0;
4199 } else 4319 }
4200 #endif 4320 #endif
4201 if (osd_show_sub_delay) {
4202 snprintf(osd_text_tmp, 63, MSGTR_OSDSubDelay, ROUND(sub_delay*1000));
4203 osd_show_sub_delay--;
4204 } else
4205 if (osd_show_sub_pos) {
4206 snprintf(osd_text_tmp, 63, MSGTR_OSDSubPosition, sub_pos);
4207 osd_show_sub_pos--;
4208 } else
4209 if (osd_show_sub_alignment) {
4210 snprintf(osd_text_tmp, 63, MSGTR_OSDSubAlignment,
4211 (sub_alignment == 2 ? MSGTR_OSDSubBottom :
4212 (sub_alignment == 1 ? MSGTR_OSDSubCenter : MSGTR_OSDSubTop)));
4213 osd_show_sub_alignment--;
4214 } else
4215 if (osd_show_av_delay) {
4216 snprintf(osd_text_tmp, 63, MSGTR_OSDAVDelay, ROUND(audio_delay*1000));
4217 osd_show_av_delay--;
4218 } else if (osd_show_speed) {
4219 snprintf(osd_text_tmp, 63, MSGTR_OSDSpeed, playback_speed);
4220 osd_show_speed--;
4221 } else if (osd_show_ontop) {
4222 snprintf(osd_text_tmp, 63, MSGTR_OSDStayOnTop, vo_ontop? MSGTR_OSDenabled : MSGTR_OSDdisabled);
4223 osd_show_ontop--;
4224 } else if (osd_show_rootwin) {
4225 snprintf(osd_text_tmp, 63, MSGTR_OSDRootwin, vo_rootwin? MSGTR_OSDenabled : MSGTR_OSDdisabled);
4226 osd_show_rootwin--;
4227 } else if (osd_show_border) {
4228 snprintf(osd_text_tmp, 63, MSGTR_OSDBorder, vo_border? MSGTR_OSDenabled : MSGTR_OSDdisabled);
4229 osd_show_border--;
4230 } else if (osd_show_framedropping) {
4231 snprintf(osd_text_tmp, 63, MSGTR_OSDFramedrop,
4232 (frame_dropping == 1 ? MSGTR_OSDFramedropOn :
4233 (frame_dropping == 2 ? MSGTR_OSDFramedropHard : MSGTR_OSDFramedropOff)));
4234 osd_show_framedropping--;
4235 } else if(osd_level>=2) {
4236 int len = demuxer_get_time_length(demuxer);
4237 int percentage = -1;
4238 char percentage_text[10];
4239 if (osd_show_percentage) {
4240 percentage = demuxer_get_percent_pos(demuxer);
4241 osd_show_percentage--;
4242 }
4243 if (percentage >= 0)
4244 snprintf(percentage_text, 9, " (%d%%)", percentage);
4245 else
4246 percentage_text[0] = 0;
4247 if (osd_level == 3)
4248 snprintf(osd_text_tmp, 63, "%c %02d:%02d:%02d / %02d:%02d:%02d%s",osd_function,pts/3600,(pts/60)%60,pts%60,len/3600,(len/60)%60,len%60,percentage_text);
4249 else
4250 snprintf(osd_text_tmp, 63, "%c %02d:%02d:%02d%s",osd_function,pts/3600,(pts/60)%60,pts%60,percentage_text);
4251 } else osd_text_tmp[0]=0;
4252
4253 if(strcmp(vo_osd_text, osd_text_tmp)) {
4254 strncpy(vo_osd_text, osd_text_tmp, 63);
4255 vo_osd_changed(OSDTYPE_OSD);
4256 }
4257 } else {
4258 if(vo_osd_text) {
4259 vo_osd_text=NULL;
4260 vo_osd_changed(OSDTYPE_OSD);
4261 }
4262 }
4263 if (osd_level <= 1 && osd_show_status > 0 && sh_video) {
4264 vo_osd_text = osd_text_buffer;
4265 snprintf(vo_osd_text, 63, MSGTR_OSDosd, osd_level ? MSGTR_OSDenabled : MSGTR_OSDdisabled);
4266 vo_osd_changed(OSDTYPE_OSD);
4267 osd_show_status--;
4268 } 4321 }
4269 // for(i=1;i<=11;i++) osd_text_buffer[10+i]=i;osd_text_buffer[10+i]=0; 4322 // for(i=1;i<=11;i++) osd_text_buffer[10+i]=i;osd_text_buffer[10+i]=0;
4270 // vo_osd_text=osd_text_buffer; 4323 // vo_osd_text=osd_text_buffer;
4271 #endif /* USE_OSD */ 4324 #endif /* USE_OSD */
4272 4325
4326 update_osd_msg();
4327
4273 #ifdef USE_SUB 4328 #ifdef USE_SUB
4274 // find sub 4329 // find sub
4275 if(subdata && sh_video && sh_video->pts>0){ 4330 if(subdata && sh_video && sh_video->pts>0){
4276 float pts=sh_video->pts; 4331 float pts=sh_video->pts;
4277 if(sub_fps==0) sub_fps=sh_video->fps; 4332 if(sub_fps==0) sub_fps=sh_video->fps;