- Timestamp:
- 12/06/20 20:24:01 (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/titan/player.h
r44947 r44948 1069 1069 void playersubtitle_thread(struct stimerthread* timernode, char* input, int flag) 1070 1070 { 1071 uint32_t sub_duration_ms = 0; 1072 uint32_t sub_pts_ms = 0; 1073 char *sub_text = NULL; 1074 int sub_sec = 0; 1071 uint32_t sub_duration_ms = 0; 1072 uint32_t sub_pts_ms = 0; 1073 char *sub_text = NULL; 1074 int sub_pts_sec = 0; 1075 int sub_duration_sec = 0; 1075 1076 1076 1077 char* sub_duration = oregex(".*duration=(.*);pts=.*", input); 1077 1078 1078 1079 if(sub_duration != NULL) 1080 { 1079 1081 sub_duration_ms = atoi(sub_duration); 1082 sub_duration_sec = sub_duration_ms / 1000 + 1; 1083 } 1080 1084 1081 1085 char* sub_pts = oregex(".*;pts=(.*);trackid=.*", input); … … 1083 1087 if(sub_pts != NULL) 1084 1088 { 1085 sub_pts_ms = atoi(sub_pts); 1086 sub_sec = sub_pts_ms / 90000; 1087 } 1089 sub_pts_ms = atoi(sub_pts); 1090 sub_pts_sec = sub_pts_ms / 90000; 1091 } 1092 1088 1093 1089 1094 char* sub_trackid = oregex(".*;trackid=(.*);subtext.*", input); 1090 1091 1095 sub_text = oregex(".*;subtext=(.*).*", input); 1092 1096 1093 // if(sub_text != NULL) 1094 // { 1095 struct skin* framebuffer = getscreen("framebuffer"); 1096 struct skin* subtitle = getscreen("gstsubtitle"); 1097 char* bg = NULL; 1098 int count = 0; 1099 1100 subtitle->bgcol = -1; 1101 1102 setnodeattr(subtitle, framebuffer, 0); 1103 bg = savescreen(subtitle); 1104 1105 while(subtitlethread->aktion != STOP) 1106 { 1107 if(sub_duration_ms != 0) 1108 { 1109 int64_t pts = 0; 1110 int sec = 0; 1111 1112 if(player && player->playback) 1113 { 1114 player->playback->Command(player, PLAYBACK_PTS, &pts); 1115 sec = pts / 90000; 1116 1117 } 1118 1119 while(sec < sub_sec && subtitlethread->aktion != STOP) 1120 { 1121 sleep(1); 1122 sec++; 1123 } 1124 1125 count = 0; 1126 changetext(subtitle, sub_text); 1127 printf("send sub_text: %s\n", sub_text); 1128 // count = duration_ms / 100; 1129 count = sub_duration_ms; 1130 drawscreen(subtitle, 0, 0); 1131 1132 while(count > 0 && subtitlethread->aktion != STOP) 1133 { 1134 usleep(100000); 1135 count = count - 1; 1136 } 1137 changetext(subtitle, " "); 1138 drawscreen(subtitle, 0, 0); 1139 sub_duration_ms = 0; 1140 } 1141 else 1142 usleep(100000); 1143 1144 } 1145 restorescreen(bg, subtitle); 1146 blitfb(0); 1147 free(sub_text); sub_text = NULL; 1148 // } 1149 subtitlethread = NULL; 1150 } 1097 struct skin* framebuffer = getscreen("framebuffer"); 1098 struct skin* subtitle = getscreen("gstsubtitle"); 1099 char* bg = NULL; 1100 int count = 0; 1101 1102 subtitle->bgcol = -1; 1103 1104 setnodeattr(subtitle, framebuffer, 0); 1105 bg = savescreen(subtitle); 1106 1107 while(subtitlethread->aktion != STOP) 1108 { 1109 if(sub_duration_ms != 0) 1110 { 1111 int64_t pts = 0; 1112 int sec = 0; 1113 1114 if(player && player->playback) 1115 { 1116 player->playback->Command(player, PLAYBACK_PTS, &pts); 1117 sec = pts / 90000; 1118 } 1119 1120 while(sec < sub_pts_sec && subtitlethread->aktion != STOP) 1121 { 1122 sleep(1); 1123 sec++; 1124 } 1125 1126 count = 0; 1127 changetext(subtitle, sub_text); 1128 printf("send sub_duration_ms=%d sub_duration_sec=%d sub_text: %s\n",sub_duration_ms, sub_duration_sec , sub_text); 1129 1130 // count = sub_duration_ms / 100; 1131 count = sub_duration_ms; 1132 drawscreen(subtitle, 0, 0); 1133 1134 while(count > 0 && subtitlethread->aktion != STOP) 1135 { 1136 usleep(100000); 1137 count = count - 1; 1138 } 1139 changetext(subtitle, " "); 1140 drawscreen(subtitle, 0, 0); 1141 sub_duration_ms = 0; 1142 } 1143 else 1144 usleep(100000); 1145 1146 } 1147 restorescreen(bg, subtitle); 1148 blitfb(0); 1149 free(sub_text); sub_text = NULL; 1150 subtitlethread = NULL; 1151 } 1151 1152 #endif 1152 1153
Note: See TracChangeset
for help on using the changeset viewer.