Changeset 41345 for titan/titan/player.h


Ignore:
Timestamp:
12/03/17 18:10:53 (6 years ago)
Author:
obi
Message:

libeplayer3 / titan add internal subs support and srt listing

File:
1 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/player.h

    r40898 r41345  
    242242int subtitleflag = 0;
    243243char *subtext = NULL;
     244#else
     245struct stimerthread* subtitlethread = NULL;
     246uint32_t buf_pos_ms = 0;
     247uint32_t duration_ms = 0;
     248int subtitleflag = 0;
     249char *subtext = NULL;
    244250#endif
    245251
     
    906912
    907913#ifdef EPLAYER4
     914void 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
    908952void playersubtitle_thread()
    909953{
     
    12241268//                      if(ostrcmp(getconfig("av_ac3mode", NULL), "downmix") == 0)
    12251269#ifndef MIPSEL
     1270                        printf("status.downmix; %d\n", status.downmix);
     1271
     1272
     1273                        char* downmix = readfiletomem(getconfig("ac3dev", NULL), 1);
     1274printf("ac3dev: %s\n",getconfig("ac3dev", NULL));
     1275printf("downmix: %s\n",downmix);
     1276                        if(ostrcmp(downmix, "passthrough") == 0)
     1277                                status.downmix = 0;
     1278                        else
     1279                                status.downmix = 1;
     1280
     1281printf("status.downmix: %d\n",status.downmix);
     1282sleep(5);
    12261283                        if(status.downmix == 1)
    12271284                        {
     
    36083665#endif
    36093666
    3610 #endif
     3667char* 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
     3677char* duration = oregex(".*duration=(.*);pts=.*", tmpstr);
     3678printf("[TITAN/getsubtext] duration %s\n", duration);
     3679if(duration != NULL)
     3680{
     3681        printf("[TITAN/getsubtext] duration %d\n", atoi(duration));
     3682        duration_ms = atoi(duration);
     3683}
     3684
     3685char* pts = oregex(".*;pts=(.*);trackid=.*", tmpstr);
     3686printf("[TITAN/getsubtext] pts %s\n", pts);
     3687if(pts != NULL)
     3688        printf("[TITAN/getsubtext] pts %d\n", atoi(pts));
     3689
     3690char* trackid = oregex(".*;trackid=(.*);trackid=.*", tmpstr);
     3691printf("[TITAN/getsubtext] trackid %s\n", trackid);
     3692if(trackid != NULL)
     3693        printf("[TITAN/getsubtext] trackid %d\n", atoi(trackid));
     3694
     3695subtext = oregex(".*;subtext=(.*).*", tmpstr);
     3696printf("[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/*
     3703duration=
     3704duration=", ollutoa(tmpduration), 0, 1);
     3705tmpstr = ostrcat(tmpstr, ";pts=", 1, 0);;
     3706tmpstr = ostrcat(tmpstr, ollutoa(tmppts), 1, 0);;
     3707tmpstr = ostrcat(tmpstr, ";trackid=", 1, 0);;
     3708tmpstr = ostrcat(tmpstr, ollutoa(tmptrackId), 1, 0);
     3709tmpstr = ostrcat(tmpstr, ";subtext=", 1, 0);;
     3710tmpstr = 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;
     3721printf("[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;
     3728printf("[TITAN/getsubtext] 2\n");
     3729
     3730printf("data.data: %s\n", &data->data);
     3731
     3732printf("data.data: %s\n", data->data);
     3733printf("data.pts: %lld\n", data->pts);
     3734printf("data.duration: %lld\n", data->durationMS);
     3735
     3736SubtitleOut_t *data;
     3737printf("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
     3744printf("222222222222222\n");
     3745
     3746   if (data == NULL)
     3747        return NULL;
     3748printf("-------------------------------------\n");
     3749
     3750printf("titan &data.data %s\n", (char*)&data->data);
     3751
     3752SubtitleOut_t *out  = NULL;
     3753printf("333333333333333\n");
     3754
     3755out = (SubtitleOut_t*) data;
     3756printf("444444444444444\n");
     3757
     3758printf("out.duration: %lld\n", out->durationMS);
     3759printf("555555555555555\n");
     3760*/
     3761/*
     3762printf(out->pts);
     3763printf("444444444444444\n");
     3764
     3765printf(out->data);
     3766printf("444444444444444\n");
     3767
     3768
     3769printf("out.pts: %u\n", out->pts);
     3770printf("out1.data: %u\n", out->data);
     3771printf("out2.data: %d\n", out->data);
     3772
     3773
     3774char *Encoding      = NULL;
     3775printf("Encoding:%s Text:%s Len:%d\n", Encoding, (char*) out->data, out->len);
     3776printf("555555555555555\n");
     3777printf("-------------------------------------\n");
     3778
     3779printf("data.pts: %lld\n", data->pts);
     3780printf("data.durationMS: %lld\n", data->durationMS);
     3781printf("data1: %lld\n", data->data);
     3782printf("data2: %d\n", data->data);
     3783printf("data3: %s\n", data->data);
     3784printf("data4: %s\n", (char*)data->data);
     3785printf("data5: %s\n", (char*)data->data);
     3786printf("-------------------------------------\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.