Changeset 41345
- Timestamp:
- 12/03/17 18:10:53 (6 years ago)
- Location:
- titan
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/libeplayer3/Makefile.am
r40363 r41345 1 1 AUTOMAKE_OPTIONS = subdir-objects 2 AM_CFLAGS = -Wall - D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE2 AM_CFLAGS = -Wall -Wno-parentheses -Wno-format -Wno-deprecated-declarations -Wno-unused-but-set-variable -Wno-unused-variable -Wno-unused-function -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE 3 3 4 4 CXXFLAGS = -Wall -
titan/libeplayer3/container/container_ffmpeg.c
r41314 r41345 210 210 /* MISC Functions */ 211 211 /* ***************************** */ 212 213 //extern void dvbsub_ass_write(AVCodecContext *c, AVSubtitle *sub, int pid); 214 215 //SubtitleOut_t subOut; 216 //SubtitleOut_t *subOut = NULL; 217 218 uint32_t tmptrackId; 219 // uint8_t *tmpdata; 220 char *tmpdata; 221 222 uint32_t tmplen; 223 int64_t tmppts; 224 int64_t tmpduration; // duration in miliseconds 225 char *tmptype; 226 int enablesub = 0; 227 228 void dvbsub_ass_write(Context_t *context, AVCodecContext *c, AVSubtitle *sub, int pid, AVPacket *packet) 229 { 230 unsigned int i; 231 232 ffmpeg_printf(0, "format %d\n", sub->format); 233 ffmpeg_printf(0, "start_display_time %d\n", sub->start_display_time); 234 ffmpeg_printf(0, "end_display_time %d\n", sub->end_display_time); 235 ffmpeg_printf(0, "num_rects %d\n", sub->num_rects); 236 //ffmpeg_printf(0, "pts %lld\n", sub->pts); 237 238 for (i = 0; i < sub->num_rects; i++) 239 { 240 241 ffmpeg_printf(0, "x %d\n", sub->rects[i]->x); 242 ffmpeg_printf(0, "y %d\n", sub->rects[i]->y); 243 ffmpeg_printf(0, "w %d\n", sub->rects[i]->w); 244 ffmpeg_printf(0, "h %d\n", sub->rects[i]->h); 245 ffmpeg_printf(0, "nb_colors %d\n", sub->rects[i]->nb_colors); 246 ffmpeg_printf(0, "type %d\n", sub->rects[i]->type); 247 ffmpeg_printf(0, "text %s\n", sub->rects[i]->text); 248 ffmpeg_printf(0, "ass %s\n", sub->rects[i]->ass); 249 250 251 ffmpeg_printf(0, "packet->data %s\n", packet->data); 252 ffmpeg_printf(0, "packet->data[0] %x\n", packet->data[0]); 253 ffmpeg_printf(0, "packet->data[1] %x\n", packet->data[1]); 254 255 subtext = ostrcat(subtext, (char *)sub->rects[i]->ass, 1, 0); 256 257 int ret, horIni, minIni, secIni, milIni, horFim, minFim, secFim, milFim; 258 double Duration = 0; 259 unsigned long long int Pts = 0; 260 261 ret = sscanf((char *)sub->rects[i]->ass, "Dialogue: 0,%d:%d:%d.%d,%d:%d:%d.%d,", &horIni, &minIni, &secIni, &milIni, &horFim, &minFim, &secFim, &milFim); 262 263 if (ret!=8) continue; /* Data is not in correct format */ 264 ffmpeg_printf(0, "ret %d\n", ret); 265 266 ffmpeg_printf(0, "horIni %d\n", horIni); 267 ffmpeg_printf(0, "minIni %d\n", minIni); 268 ffmpeg_printf(0, "secIni %d\n", secIni); 269 ffmpeg_printf(0, "milIni %d\n", milIni); 270 271 ffmpeg_printf(0, "horFim %d\n", horFim); 272 ffmpeg_printf(0, "minFim %d\n", minFim); 273 ffmpeg_printf(0, "secFim %d\n", secFim); 274 ffmpeg_printf(0, "milFim %d\n", milFim); 275 /* 276 Pts = (horIni*3600 + minIni*60 + secIni)*1000 + milIni; 277 Duration = ((horFim*3600 + minFim*60 + secFim) * 1000 + milFim - Pts) / 1000.0; 278 ffmpeg_printf(0, "new Pts %llu\n", Pts); 279 ffmpeg_printf(0, "new Duration %f\n", Duration); 280 281 */ 282 tmppts = (horIni*3600 + minIni*60 + secIni)*1000 + milIni; 283 tmpduration = ((horFim*3600 + minFim*60 + secFim) * 1000 + milFim - Pts) / 1000.0; 284 tmpdata = packet->data; 285 286 ffmpeg_printf(0, "new Pts %llu\n", tmppts); 287 ffmpeg_printf(0, "new Duration %d\n", tmpduration); 288 ffmpeg_printf(0, "new Data %s\n", tmpdata); 289 290 // pict ->AVPicture 291 } 292 } 293 294 //int ReadSubtitle(Context_t *context, const char *filename, const char *format, int pid) 295 int ReadSubtitle(Context_t *context, const char *filename, char *format, int pid) 296 { 297 int ret = 0; 298 const char *lastDot = strrchr(filename, '.'); 299 if (!lastDot) 300 return ret; 301 char subfile[strlen(filename) + strlen(format)]; 302 strcpy(subfile, filename); 303 strcpy(subfile + (lastDot + 1 - filename), format); 304 305 if (access(subfile, R_OK)) 306 return ret; 307 308 AVFormatContext *subavfc = avformat_alloc_context(); 309 int err = avformat_open_input(&subavfc, subfile, av_find_input_format(format), 0); 310 // if (averror(err, avformat_open_input)) { 311 if (err != 0) 312 { 313 avformat_free_context(subavfc); 314 return ret; 315 } 316 317 avformat_find_stream_info(subavfc, NULL); 318 if (subavfc->nb_streams != 1) { 319 avformat_free_context(subavfc); 320 return ret; 321 } 322 323 AVCodecContext *c = subavfc->streams[0]->codec; 324 AVCodec *codec = avcodec_find_decoder(c->codec_id); 325 if (!codec) { 326 avformat_free_context(subavfc); 327 return ret; 328 } 329 330 err = avcodec_open2(c, codec, NULL); 331 // if (averror(err, avcodec_open2)) { 332 if (err != 0) 333 { 334 avformat_free_context(subavfc); 335 return ret; 336 } 337 338 AVPacket packet; 339 av_init_packet(&packet); 340 341 free(subtext), subtext = NULL; 342 343 while (av_read_frame(subavfc, &packet) > -1) { 344 AVSubtitle sub; 345 memset(&sub, 0, sizeof(sub)); 346 int got_sub = 0; 347 avcodec_decode_subtitle2(c, &sub, &got_sub, &packet); 348 if (got_sub) 349 { 350 dvbsub_ass_write(context, c, &sub, pid, &packet); 351 352 char* tmpstr = NULL; 353 tmpstr = ostrcat(tmpstr, "duration=", 1, 0); 354 tmpstr = ostrcat(tmpstr, ollutoa(tmpduration), 1, 1); 355 tmpstr = ostrcat(tmpstr, ";pts=", 1, 0);; 356 tmpstr = ostrcat(tmpstr, ollutoa(tmppts), 1, 0);; 357 tmpstr = ostrcat(tmpstr, ";trackid=", 1, 0);; 358 tmpstr = ostrcat(tmpstr, oitoa(tmptrackId), 1, 0); 359 tmpstr = ostrcat(tmpstr, ";subtext=", 1, 0);; 360 tmpstr = ostrcat(tmpstr, tmpdata, 1, 0);; 361 tmpstr = ostrcat(tmpstr, "\n", 1, 0);; 362 363 subtext = ostrcat(subtext, tmpstr, 1, 0); 364 free(tmpstr), tmpstr = NULL; 365 366 tmpduration = 0; 367 tmppts = 0; 368 tmptrackId = 0; 369 370 371 } 372 av_free_packet(&packet); 373 } 374 375 // free(subtext), subtext = NULL; 376 377 avcodec_close(c); 378 avformat_close_input(&subavfc); 379 avformat_free_context(subavfc); 380 381 ffmpeg_printf(1, "format=%s\n", format); 382 ffmpeg_printf(1, "pid=%d\n", pid); 383 384 if(pid != -1) 385 { 386 Track_t Subtitle; 387 memset(&Subtitle, 0, sizeof(Subtitle)); 388 Subtitle.Name = ostrcat("External Sub: ", format, 0, 0); 389 if(ostrstr(format, "srt") != NULL) 390 Subtitle.Encoding = "S_TEXT/SRT"; 391 else if(ostrstr(format, "ass") != NULL) 392 Subtitle.Encoding = "S_TEXT/ASS"; 393 else if(ostrstr(format, "ssa") != NULL) 394 Subtitle.Encoding = "S_TEXT/SSA"; 395 else if(ostrstr(format, "sub") != NULL) 396 Subtitle.Encoding = "S_TEXT/SUBRIP"; 397 else if(ostrstr(format, "idx") != NULL) 398 Subtitle.Encoding = "S_TEXT/SUBRIP"; 399 Subtitle.File = strdup(subfile); 400 Subtitle.Id = pid, 401 context->manager->subtitle->Command(context, MANAGER_ADD, &Subtitle); 402 } 403 404 // Track track; 405 // track.title = format; 406 // track.is_static = 1; 407 // track.pid = pid; 408 // player->manager.addSubtitleTrack(track); 409 return 1; 410 } 411 412 int ReadSubtitles(Context_t *context, const char *filename) 413 { 414 int ret = 0; 415 if (strncmp(filename, "file://", 7)) 416 return ret; 417 filename += 7; 418 ret |= ReadSubtitle(context, filename, "srt", 0xFFFF); 419 ret |= ReadSubtitle(context, filename, "ass", 0xFFFE); 420 ret |= ReadSubtitle(context, filename, "ssa", 0xFFFD); 421 ret |= ReadSubtitle(context, filename, "sub", 0xFFFC); 422 ret |= ReadSubtitle(context, filename, "idx", 0xFFFB); 423 return ret; 424 } 425 212 426 213 427 static void ffmpeg_silen_callback(void * avcl, int level, const char * fmt, va_list vl) … … 1164 1378 if (duration > 0) 1165 1379 { 1380 printf("[LIBEPLAYER3/FFMPEGThread] start\n"); 1381 1166 1382 SubtitleOut_t subOut; 1167 1383 memset(&subOut, 0, sizeof(subOut)); … … 1170 1386 subOut.pts = pts; 1171 1387 subOut.durationMS = duration; 1388 1389 tmptrackId = pid; 1390 tmpdata = (uint8_t *)packet.data; 1391 // tmpdata = (uint8_t *)&packet.data; 1392 //tmplen; 1393 tmppts = pts; 1394 tmpduration = duration; 1395 tmpdata = ostrcat(subOut.data, NULL, 0, 0); 1396 1397 //*tmptype; 1398 printf("[LIBEPLAYER3/FFMPEGThread] set tmpdata=%s\n", tmpdata); 1399 printf("[LIBEPLAYER3/FFMPEGThread] set tmppts=%lld\n", tmppts); 1400 printf("[LIBEPLAYER3/FFMPEGThread] set tmpduration=%lld\n", tmpduration); 1401 1402 1172 1403 if (context->output->subtitle->Write(context, &subOut) < 0) 1173 1404 { 1174 1405 ffmpeg_err("writing data to teletext fifo failed\n"); 1175 1406 } 1407 1408 char* tmpstr = NULL; 1409 tmpstr = ostrcat(tmpstr, "duration=", 1, 0); 1410 tmpstr = ostrcat(tmpstr, ollutoa(tmpduration), 1, 1); 1411 tmpstr = ostrcat(tmpstr, ";pts=", 1, 0);; 1412 tmpstr = ostrcat(tmpstr, ollutoa(tmppts), 1, 0);; 1413 tmpstr = ostrcat(tmpstr, ";trackid=", 1, 0);; 1414 tmpstr = ostrcat(tmpstr, oitoa(tmptrackId), 1, 0); 1415 tmpstr = ostrcat(tmpstr, ";subtext=", 1, 0);; 1416 tmpstr = ostrcat(tmpstr, tmpdata, 1, 0);; 1417 1418 free(subtext), subtext = NULL; 1419 subtext = ostrcat(subtext, tmpstr, 1, 0); 1420 free(tmpstr), tmpstr = NULL; 1421 1422 // tmpduration = 0; 1423 tmppts = 0; 1424 tmptrackId = 0; 1425 1426 1427 printf("[LIBEPLAYER3/FFMPEGThread] set subtext: %s\n", subtext); 1428 1176 1429 } 1177 1430 } … … 1924 2177 isContainerRunning = 1; 1925 2178 res = container_ffmpeg_update_tracks(context, playFilesNames->szFirstFile, 1); 2179 2180 ffmpeg_printf(1, "aaaaaaaaaaaaa\n"); 2181 ReadSubtitles(context, playFilesNames->szFirstFile); 2182 ffmpeg_printf(1, "bbbbbbbbbbbbbbb\n"); 1926 2183 return res; 1927 2184 } … … 2997 3254 int64_t sec = -5; 2998 3255 context->playback->Command(context, PLAYBACK_SEEK, (void*)&sec); 3256 enablesub = 1; 3257 return cERR_CONTAINER_FFMPEG_NO_ERROR; 3258 } 3259 3260 static int32_t container_ffmpeg_get_subtext(Context_t* context, char ** data) 3261 //static int32_t container_ffmpeg_get_subtext(Context_t* context, SubtitleOut_t input) 3262 //static int32_t container_ffmpeg_get_subtext(Context_t* context, void **data) 3263 //static int32_t container_ffmpeg_get_subtext(Context_t* context, SubtitleOut_t **data) 3264 //static int32_t container_ffmpeg_get_subtext(Context_t* context, SubtitleOut_t *data) 3265 //static int32_t container_ffmpeg_get_subtext(Context_t* context, SubtitleOut_t ** data) 3266 { 3267 3268 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start\n"); 3269 3270 //if(tmpduration != 0 && subtext != NULL) 3271 if(enablesub == 1 && subtext != NULL) 3272 { 3273 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] set data\n"); 3274 /* 3275 char* tmpstr = NULL; 3276 tmpstr = ostrcat("duration=", NULL, 0, 0); 3277 tmpstr = ostrcat(tmpstr, ollutoa(tmpduration), 1, 1); 3278 tmpstr = ostrcat(tmpstr, ";pts=", 1, 0);; 3279 tmpstr = ostrcat(tmpstr, ollutoa(tmppts), 1, 0);; 3280 tmpstr = ostrcat(tmpstr, ";trackid=", 1, 0);; 3281 tmpstr = ostrcat(tmpstr, oitoa(tmptrackId), 1, 0); 3282 tmpstr = ostrcat(tmpstr, ";subtext=", 1, 0);; 3283 tmpstr = ostrcat(tmpstr, subtext, 1, 0);; 3284 *data = ostrcat(tmpstr, NULL, 0, 0); 3285 free(tmpstr), tmpstr = NULL; 3286 free(subtext), subtext = NULL; 3287 tmpduration = 0; 3288 tmppts = 0; 3289 tmptrackId = 0; 3290 */ 3291 *data = ostrcat(subtext, NULL, 0, 0); 3292 free(subtext), subtext = NULL; 3293 3294 } 3295 3296 3297 3298 //*data = ostrcat("duration=", olutoa(tmpduration), 0, 1); 3299 //*data = ostrcat(data, ";subtext=", 1, 0); 3300 //*data = ostrcat(data, "subtext", 1, 0); 3301 3302 //*data = ostrcat(subtext, NULL, 0, 0); 3303 3304 3305 3306 3307 /* 3308 SubtitleOut_t subOut; 3309 memset(&subOut, 0, sizeof(subOut)); 3310 subOut.trackId = tmptrackId; 3311 subOut.data = (uint8_t *)subtext; 3312 subOut.pts = tmppts; 3313 subOut.durationMS = tmpduration; 3314 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start1\n"); 3315 memset(&data, 0, sizeof(data)); 3316 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start1a\n"); 3317 3318 *data = subOut; 3319 3320 // 3321 3322 // SubtitleOut_t subOut; 3323 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start2\n"); 3324 3325 memset(&data, 0, sizeof(data)); 3326 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start3\n"); 3327 3328 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] tmptrackId=%d\n", tmptrackId); 3329 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] data.trackId=%d\n", data->trackId); 3330 data->trackId = tmptrackId; 3331 // subOut.data = (uint8_t *)packet.data; 3332 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start3\n"); 3333 3334 data->data = (uint8_t *)subtext; 3335 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start4\n"); 3336 3337 data->pts = tmppts; 3338 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] start5\n"); 3339 3340 data->durationMS = tmpduration; 3341 3342 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check subtext=%s\n", subtext); 3343 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check tmpdata=%s\n", tmpdata); 3344 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check data->data=%s\n", data->data); 3345 3346 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check tmppts=%lld\n", tmppts); 3347 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check data->pts=%lld\n", data->pts); 3348 3349 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check tmpduration=%lld\n", tmpduration); 3350 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] check data->durationMS=%lld\n", data->durationMS); 3351 */ 3352 printf("[LIBEPLAYER3/container_ffmpeg_get_subtext] end\n"); 3353 3354 /* 3355 SubtitleOut_t *out = NULL; 3356 out = (SubtitleOut_t*) data; 3357 3358 printf("##########################\n"); 3359 printf("void *data.data: %s\n", out->data); 3360 //printf("void *data.pts: %lld\n", &data->pts); 3361 //printf("void *data.duration: %lld\n", &data->durationMS); 3362 printf("##########################\n"); 3363 */ 3364 // *data = (char *)packet->data; 3365 // char* subtext = NULL; 3366 // *data = ostrcat(subtext, NULL, 0, 0); 3367 // SubtitleOut_t subOut = input; 3368 // subOut1 = subOut; 3369 // SubtitleOut_t *out = NULL; 3370 // SubtitleOut_t subOut = (SubtitleOut_t*) data; 3371 3372 // SubtitleOut_t *subOut = NULL; 3373 // *subOut; 3374 // SubtitleOut_t *subOut = (SubtitleOut_t*) data; 3375 // SubtitleOut_t *subOut = (SubtitleOut_t*) data; 3376 //SubtitleOut_t* 3377 3378 3379 //data = &subOut; 3380 3381 //printf("555 data: %s\n", (char*)data->data); 3382 3383 3384 // SubtitleOut_t *subOut; 3385 // subOut = (SubtitleOut_t*) data; 3386 3387 // SubtitleOutputDef_t* out = (SubtitleOutputDef_t*)argument; 3388 3389 // printf("333subOut.data: %s\n", subOut.data); 3390 /* 3391 3392 printf("##########################\n"); 3393 3394 printf("data: %s\n", tmpdata); 3395 printf("pts: %lld\n", tmppts); 3396 printf("duration: %lld\n", tmpduration); 3397 3398 printf("subtext1: %s\n", subtext); 3399 printf("subtext2: %d\n", subtext); 3400 printf("##########################\n"); 3401 printf("subOut.data: %s\n", *data->data); 3402 printf("subOut.pts: %lld\n", data.pts); 3403 printf("subOut.durationMS: %lld\n", data.durationMS); 3404 printf("##########################\n"); 3405 3406 3407 SubtitleOut_t subOut; 3408 memset(&subOut, 0, sizeof(subOut)); 3409 subOut.trackId = tmptrackId; 3410 // subOut.data = (uint8_t *)packet.data; 3411 subOut.data = (uint8_t *)subtext; 3412 3413 subOut.pts = tmppts; 3414 subOut.durationMS = tmpduration; 3415 3416 printf("subOut.data: %s\n", subOut.data); 3417 printf("subOut.pts: %lld\n", subOut.pts); 3418 printf("subOut.durationMS: %lld\n", subOut.durationMS); 3419 3420 3421 *data = (SubtitleOut_t*)&subOut; 3422 data = &subOut; 3423 3424 printf("data.durationMS: %lld\n", (void*)data->durationMS); 3425 3426 3427 //printf("data.data: %s\n", data->data); 3428 3429 printf("##########################\n"); 3430 3431 //printf("22subOut2.data: %s\n", subOut2.data); 3432 //printf("22ubOut2.data: %d\n", subOut2.data); 3433 */ 2999 3434 return cERR_CONTAINER_FFMPEG_NO_ERROR; 3000 3435 } … … 3074 3509 command != CONTAINER_GET_BUFFER_SIZE && 3075 3510 command != CONTAINER_GET_BUFFER_STATUS && 3076 command != CONTAINER_STOP_BUFFER && 3511 command != CONTAINER_STOP_BUFFER && 3512 command != CONTAINER_GET_SUBTEXT && 3077 3513 command != CONTAINER_INIT && !avContextTab[0]) 3078 3514 { … … 3172 3608 ret = container_stop_buffer(); 3173 3609 break; 3610 } 3611 case CONTAINER_GET_SUBTEXT: 3612 { 3613 printf("[LIBEPLAYER3/Command] start\n"); 3614 3615 ret = container_ffmpeg_get_subtext(context, (char **)argument); 3616 3617 // ret = container_ffmpeg_get_subtext(context, (SubtitleOut_t **)argument); 3618 3619 // (SubtitleOut_t *)argument; 3620 // memset(&argument, 0, sizeof(argument)); 3621 3622 // ret = container_ffmpeg_get_subtext(context, SubtitleOut_t ** argument); 3623 3624 printf("[LIBEPLAYER3/Command] end\n"); 3625 // data = ostrcat(subtext, NULL, 0, 0); 3626 // (char **)argument = subtext; 3627 //argument = (void**)&subOut; 3628 3629 /* 3630 // SubtitleOutputDef_t* out = (SubtitleOutputDef_t*)argument; 3631 3632 //printf("333subOut.data: %s\n", subOut.dat 3633 3634 3635 // ret = container_ffmpeg_get_subtext(context, (SubtitleOut_t)argument); 3636 3637 SubtitleOut_t subOut; 3638 memset(&subOut, 0, sizeof(subOut)); 3639 subOut.trackId = tmptrackId; 3640 // subOut.data = (uint8_t *)packet.data; 3641 subOut.data = (uint8_t *)subtext; 3642 3643 subOut.pts = tmppts; 3644 subOut.durationMS = tmpduration; 3645 printf("##########################\n"); 3646 printf("subOut.data: %s\n", subOut.data); 3647 printf("subOut.pts: %lld\n", subOut.pts); 3648 printf("subOut.duration: %lld\n", subOut.durationMS); 3649 printf("##########################\n"); 3650 3651 ret = container_ffmpeg_get_subtext(context, (void*)&subOut); 3652 // *((SubtitleOut_t*)argument) = subOut; 3653 argument = (void*)&subOut; 3654 3655 3656 SubtitleOut_t argument; 3657 memset(&argument, 0, sizeof(argument)); 3658 argument.trackId = tmptrackId; 3659 // subOut.data = (uint8_t *)packet.data; 3660 argument.data = (uint8_t *)subtext; 3661 3662 argument.pts = tmppts; 3663 argument.durationMS = tmpduration; 3664 printf("##########################\n"); 3665 printf("argument.data: %s\n", argument.data); 3666 printf("argument.pts: %lld\n", argument.pts); 3667 printf("argument.duration: %lld\n", argument.durationMS); 3668 printf("##########################\n"); 3669 3670 ret = container_ffmpeg_get_subtext(context, (void**)&argument); 3671 // *((SubtitleOut_t*)argument) = subOut; 3672 //argument = (void**)&subOut; 3673 */ 3674 3675 break; 3174 3676 } 3175 3677 //obi (end) -
titan/titan/play.h
r40446 r41345 1717 1717 } 1718 1718 #else 1719 getsubtext(); 1719 1720 playinfobarcount++; 1720 1721 if(playinfobarstatus > 0) … … 1750 1751 } 1751 1752 } 1752 1753 1754 if(rcret == getrcconfigint("rchelp", NULL)) 1755 printf("getsubtext: %s\n", getsubtext()); 1756 1757 1753 1758 if(rcret == getrcconfigint("rcpip", NULL)) 1754 1759 { -
titan/titan/player.h
r40898 r41345 242 242 int subtitleflag = 0; 243 243 char *subtext = NULL; 244 #else 245 struct stimerthread* subtitlethread = NULL; 246 uint32_t buf_pos_ms = 0; 247 uint32_t duration_ms = 0; 248 int subtitleflag = 0; 249 char *subtext = NULL; 244 250 #endif 245 251 … … 906 912 907 913 #ifdef EPLAYER4 914 void playersubtitle_thread() 915 { 916 struct skin* framebuffer = getscreen("framebuffer"); 917 struct skin* subtitle = getscreen("gstsubtitle"); 918 char* bg = NULL; 919 int count = 0; 920 921 subtitle->bgcol = -1; 922 923 setnodeattr(subtitle, framebuffer, 0); 924 bg = savescreen(subtitle); 925 926 while(subtitlethread->aktion != STOP) 927 { 928 if(duration_ms != 0) 929 { 930 count = 0; 931 changetext(subtitle, subtext); 932 count = duration_ms / 100; 933 drawscreen(subtitle, 0, 0); 934 while(count > 0 && subtitlethread->aktion != STOP) 935 { 936 usleep(100000); 937 count = count - 1; 938 } 939 changetext(subtitle, " "); 940 drawscreen(subtitle, 0, 0); 941 duration_ms = 0; 942 } 943 else 944 usleep(100000); 945 } 946 free(subtext); subtext = NULL; 947 restorescreen(bg, subtitle); 948 blitfb(0); 949 subtitlethread = NULL; 950 } 951 #else 908 952 void playersubtitle_thread() 909 953 { … … 1224 1268 // if(ostrcmp(getconfig("av_ac3mode", NULL), "downmix") == 0) 1225 1269 #ifndef MIPSEL 1270 printf("status.downmix; %d\n", status.downmix); 1271 1272 1273 char* downmix = readfiletomem(getconfig("ac3dev", NULL), 1); 1274 printf("ac3dev: %s\n",getconfig("ac3dev", NULL)); 1275 printf("downmix: %s\n",downmix); 1276 if(ostrcmp(downmix, "passthrough") == 0) 1277 status.downmix = 0; 1278 else 1279 status.downmix = 1; 1280 1281 printf("status.downmix: %d\n",status.downmix); 1282 sleep(5); 1226 1283 if(status.downmix == 1) 1227 1284 { … … 3608 3665 #endif 3609 3666 3610 #endif 3667 char* getsubtext() 3668 { 3669 char* tmpstr = NULL; 3670 if(player && player->container && player->container->selectedContainer) 3671 player->container->selectedContainer->Command(player, CONTAINER_GET_SUBTEXT, (void*)&tmpstr); 3672 3673 3674 //duration = oregex(".*([0-9]{8,8}.*[0-9]{4,4}).*", subtext); 3675 //duration = oregex(".*duration=(.*);.*", subtext); 3676 3677 char* duration = oregex(".*duration=(.*);pts=.*", tmpstr); 3678 printf("[TITAN/getsubtext] duration %s\n", duration); 3679 if(duration != NULL) 3680 { 3681 printf("[TITAN/getsubtext] duration %d\n", atoi(duration)); 3682 duration_ms = atoi(duration); 3683 } 3684 3685 char* pts = oregex(".*;pts=(.*);trackid=.*", tmpstr); 3686 printf("[TITAN/getsubtext] pts %s\n", pts); 3687 if(pts != NULL) 3688 printf("[TITAN/getsubtext] pts %d\n", atoi(pts)); 3689 3690 char* trackid = oregex(".*;trackid=(.*);trackid=.*", tmpstr); 3691 printf("[TITAN/getsubtext] trackid %s\n", trackid); 3692 if(trackid != NULL) 3693 printf("[TITAN/getsubtext] trackid %d\n", atoi(trackid)); 3694 3695 subtext = oregex(".*;subtext=(.*).*", tmpstr); 3696 printf("[TITAN/getsubtext] subtext %s\n", subtext); 3697 3698 if(subtitlethread == NULL) 3699 subtitlethread = addtimer(&playersubtitle_thread, START, 10000, 1, NULL, NULL, NULL); 3700 3701 3702 /* 3703 duration= 3704 duration=", ollutoa(tmpduration), 0, 1); 3705 tmpstr = ostrcat(tmpstr, ";pts=", 1, 0);; 3706 tmpstr = ostrcat(tmpstr, ollutoa(tmppts), 1, 0);; 3707 tmpstr = ostrcat(tmpstr, ";trackid=", 1, 0);; 3708 tmpstr = ostrcat(tmpstr, ollutoa(tmptrackId), 1, 0); 3709 tmpstr = ostrcat(tmpstr, ";subtext=", 1, 0);; 3710 tmpstr = ostrcat(tmpstr, subtext, 1, 0); 3711 3712 running_pts = pos / 11111LL; 3713 decoder_ms = running_pts / 90; 3714 3715 if(subtitlethread == NULL) 3716 subtitlethread = addtimer(&playersubtitle_thread, START, 10000, 1, NULL, NULL, NULL); 3717 3718 */ 3719 /* 3720 SubtitleOut_t *data; 3721 printf("[TITAN/getsubtext start]\n"); 3722 if(player && player->container && player->container->selectedContainer) 3723 // player->container->selectedContainer->Command(player, CONTAINER_GET_SUBTEXT, (void*)&data); 3724 player->container->selectedContainer->Command(player, CONTAINER_GET_SUBTEXT, (void*)data); 3725 3726 if (data == NULL) 3727 return NULL; 3728 printf("[TITAN/getsubtext] 2\n"); 3729 3730 printf("data.data: %s\n", &data->data); 3731 3732 printf("data.data: %s\n", data->data); 3733 printf("data.pts: %lld\n", data->pts); 3734 printf("data.duration: %lld\n", data->durationMS); 3735 3736 SubtitleOut_t *data; 3737 printf("111111111111111\n"); 3738 3739 3740 if(player && player->container && player->container->selectedContainer) 3741 player->container->selectedContainer->Command(player, CONTAINER_GET_SUBTEXT, (void*)data); 3742 // player->container->selectedContainer->Command(player, CONTAINER_GET_SUBTEXT, (void*)data); 3743 3744 printf("222222222222222\n"); 3745 3746 if (data == NULL) 3747 return NULL; 3748 printf("-------------------------------------\n"); 3749 3750 printf("titan &data.data %s\n", (char*)&data->data); 3751 3752 SubtitleOut_t *out = NULL; 3753 printf("333333333333333\n"); 3754 3755 out = (SubtitleOut_t*) data; 3756 printf("444444444444444\n"); 3757 3758 printf("out.duration: %lld\n", out->durationMS); 3759 printf("555555555555555\n"); 3760 */ 3761 /* 3762 printf(out->pts); 3763 printf("444444444444444\n"); 3764 3765 printf(out->data); 3766 printf("444444444444444\n"); 3767 3768 3769 printf("out.pts: %u\n", out->pts); 3770 printf("out1.data: %u\n", out->data); 3771 printf("out2.data: %d\n", out->data); 3772 3773 3774 char *Encoding = NULL; 3775 printf("Encoding:%s Text:%s Len:%d\n", Encoding, (char*) out->data, out->len); 3776 printf("555555555555555\n"); 3777 printf("-------------------------------------\n"); 3778 3779 printf("data.pts: %lld\n", data->pts); 3780 printf("data.durationMS: %lld\n", data->durationMS); 3781 printf("data1: %lld\n", data->data); 3782 printf("data2: %d\n", data->data); 3783 printf("data3: %s\n", data->data); 3784 printf("data4: %s\n", (char*)data->data); 3785 printf("data5: %s\n", (char*)data->data); 3786 printf("-------------------------------------\n"); 3787 3788 */ 3789 /* 3790 struct skin* framebuffer = getscreen("framebuffer"); 3791 struct skin* subtitle = getscreen("gstsubtitle"); 3792 3793 // changetext(subtitle, (char*) data->data); 3794 changetext(subtitle, subtext); 3795 drawscreen(subtitle, 0, 0); 3796 */ 3797 return subtext; 3798 } 3799
Note: See TracChangeset
for help on using the changeset viewer.