Changeset 26547


Ignore:
Timestamp:
02/28/14 15:04:07 (10 years ago)
Author:
obi
Message:

mipsel add minitv support

Location:
titan/titan
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • titan/titan/global.h

    r25939 r26547  
    32003200}
    32013201
    3202 int setvmpeg(struct dvbdev* node, int posx, int posy, int width, int height)
    3203 {
    3204         if(status.tvpic == 1 && (posx != 0 || posy != 0 || width != 0 || height != 0))
    3205                 return 0;
    3206 
    3207         if(getconfigint("minitv", NULL) == 1)
    3208                 return 0;
    3209        
    3210         char* vmpegdev = NULL, *tmpstr = NULL, *buf = NULL;
    3211         int ret = 0;
    3212 
    3213         if(node == NULL) return 1;
    3214         vmpegdev = getconfig("vmpegalldev", NULL);
    3215 
    3216         if(vmpegdev != NULL)
    3217         {
    3218                 buf = malloc(MINMALLOC);
    3219                 if(buf == NULL)
    3220                 {
    3221                         err("no mem");
    3222                         return 1;
    3223                 }
    3224                
    3225                 tmpstr = malloc(MINMALLOC);
    3226                 if(tmpstr == NULL)
    3227                 {
    3228                         err("no mem");
    3229                         free(buf);
    3230                         return 1;
    3231                 }
    3232                
    3233                 snprintf(buf, MINMALLOC, vmpegdev, node->devnr);
    3234                 snprintf(tmpstr, MINMALLOC, "%x %x %x %x", posx, posy, width, height);
    3235                 debug(100, "set %s to %s", buf, tmpstr);
    3236 
    3237                 status.tvpic = 1;
    3238                 ret = writesys(buf, tmpstr, 1);
    3239 
    3240                 //reset
    3241                 if(posx == 0 && posy == 0 && width == 0 && height == 0)
    3242                         status.tvpic = 0;
    3243                
    3244                 free(tmpstr);
    3245                 free(buf);
    3246                 return ret;
    3247         }
    3248 
    3249         return 0;
    3250 }
    3251 
    3252 //flag 0: wh = width
    3253 //flag 1: wh = height
    3254 int setvmpegrect(struct dvbdev* node, int posx, int posy, int wh, int flag)
    3255 {
    3256         int ret = 0;
    3257         int leftoffset = status.leftoffset;
    3258         int rightoffset = status.rightoffset;
    3259         int topoffset = status.topoffset;
    3260         int bottomoffset = status.bottomoffset;
    3261 
    3262         float rx = (float)fb->width / 720;
    3263         float ry = (float)fb->height / 576;
    3264 
    3265         leftoffset = (float)leftoffset / rx;
    3266         rightoffset = (float)rightoffset / rx;
    3267         topoffset = (float)topoffset / ry;
    3268         bottomoffset = (float)bottomoffset / ry;
    3269 
    3270         rx = (float)720 / (float)(720 - leftoffset - rightoffset);
    3271         ry = (float)576 / (float)(576 - topoffset - bottomoffset);
    3272 
    3273         posx = (float)posx / rx;
    3274         posx += leftoffset;
    3275 
    3276         posy = (float)posy / ry;
    3277         posy += topoffset;
    3278 
    3279         if(flag == 0)
    3280         {
    3281                 wh = ((float)wh / rx);
    3282                 ret = setvmpeg(node, posx, posy, wh, (int)((float)wh / 1.2));
    3283         }
    3284 
    3285         if(flag == 1)
    3286         {
    3287                 wh = ((float)wh / ry);
    3288                 ret = setvmpeg(node, posx, posy, (int)((float)wh * 1.2), wh);
    3289         }
    3290 
    3291         return ret;
    3292 }
    3293 
    3294 int resettvpic()
    3295 {
    3296         int ret = 0;
    3297 
    3298         if(status.tvpic > 0 && status.aktservice != NULL)
    3299                 ret = setvmpeg(status.aktservice->videodev, 0, 0, 0, 0);
    3300 
    3301         return ret;
    3302 }
    3303 
    33043202/*
    33053203int checkdev(char* dev)
  • titan/titan/mipselport.h

    r26471 r26547  
    870870}
    871871
     872int setvmpeg(struct dvbdev* node, int value, int flag)
     873{
     874        debug(1000, "in");
     875        char* vmpegdev = NULL, *tmpstr = NULL, *buf = NULL;
     876        int ret = 0;
     877
     878        if(node == NULL) return 1;
     879        if(flag == 0) vmpegdev = getconfig("vmpegleftdev", NULL);
     880        if(flag == 1) vmpegdev = getconfig("vmpegtopdev", NULL);
     881        if(flag == 2) vmpegdev = getconfig("vmpegwidthdev", NULL);
     882        if(flag == 3) vmpegdev = getconfig("vmpegheightdev", NULL);
     883
     884        if(vmpegdev != NULL)
     885        {
     886                buf = malloc(MINMALLOC);
     887                if(buf == NULL)
     888                {
     889                        err("no mem");
     890                        return 1;
     891                }
     892               
     893                tmpstr = malloc(10);
     894                if(tmpstr == NULL)
     895                {
     896                        err("no mem");
     897                        free(buf);
     898                        return 1;
     899                }
     900               
     901                snprintf(buf, MINMALLOC, vmpegdev, node->devnr);
     902                snprintf(tmpstr, 10, "%x", value);
     903                debug(100, "set %s to %s", buf, tmpstr);
     904                status.tvpic = 1;
     905                ret = writesys(buf, tmpstr, 1);
     906               
     907                free(tmpstr);
     908                free(buf);
     909                return ret;
     910        }
     911
     912        debug(1000, "out");
     913        return 0;
     914}
     915
     916//flag 0: wh = width
     917//flag 1: wh = height
     918int setvmpegrect(struct dvbdev* node, int left, int top, int wh, int flag)
     919{
     920        int ret = 0;
     921       
     922        if(flag == 0)
     923        {
     924                ret = setvmpeg(node, wh, 2);
     925                ret = setvmpeg(node, wh / 1.4, 3);
     926        }
     927        if(flag == 1)
     928        {
     929                ret = setvmpeg(node, wh, 3);
     930                ret = setvmpeg(node, wh * 1.3, 2);
     931        }
     932               
     933        ret = setvmpeg(node, left, 0);
     934        ret = setvmpeg(node, top, 1);
     935       
     936        return ret;
     937}
     938
     939int resetvmpeg(struct dvbdev* node)
     940{
     941        int ret = 0;
     942
     943        ret = setvmpeg(node, 0, 0);
     944        ret = setvmpeg(node, 0, 1);
     945        ret = setvmpeg(node, 0, 2);
     946        ret = setvmpeg(node, 0, 3);
     947       
     948        return ret;
     949}
     950
     951int resettvpic()
     952{
     953/*
     954        if(status.tvpic == 1 && status.aktservice != NULL)
     955        {
     956                status.tvpic = 0;
     957                resetvmpeg(status.aktservice->videodev);
     958        }
     959*/
     960        int ret = 0;
     961
     962        if(status.tvpic > 0 && status.aktservice != NULL)
     963        {
     964                status.tvpic = 0;
     965                ret = resetvmpeg(status.aktservice->videodev);
     966        }
     967
     968        return ret;
     969}
     970
    872971#endif
  • titan/titan/sh4port.h

    r24767 r26547  
    741741}
    742742
     743int setvmpeg(struct dvbdev* node, int posx, int posy, int width, int height)
     744{
     745        if(status.tvpic == 1 && (posx != 0 || posy != 0 || width != 0 || height != 0))
     746                return 0;
     747
     748        if(getconfigint("minitv", NULL) == 1)
     749                return 0;
     750       
     751        char* vmpegdev = NULL, *tmpstr = NULL, *buf = NULL;
     752        int ret = 0;
     753
     754        if(node == NULL) return 1;
     755        vmpegdev = getconfig("vmpegalldev", NULL);
     756
     757        if(vmpegdev != NULL)
     758        {
     759                buf = malloc(MINMALLOC);
     760                if(buf == NULL)
     761                {
     762                        err("no mem");
     763                        return 1;
     764                }
     765               
     766                tmpstr = malloc(MINMALLOC);
     767                if(tmpstr == NULL)
     768                {
     769                        err("no mem");
     770                        free(buf);
     771                        return 1;
     772                }
     773               
     774                snprintf(buf, MINMALLOC, vmpegdev, node->devnr);
     775                snprintf(tmpstr, MINMALLOC, "%x %x %x %x", posx, posy, width, height);
     776                debug(100, "set %s to %s", buf, tmpstr);
     777
     778                status.tvpic = 1;
     779                ret = writesys(buf, tmpstr, 1);
     780
     781                //reset
     782                if(posx == 0 && posy == 0 && width == 0 && height == 0)
     783                        status.tvpic = 0;
     784               
     785                free(tmpstr);
     786                free(buf);
     787                return ret;
     788        }
     789
     790        return 0;
     791}
     792
     793//flag 0: wh = width
     794//flag 1: wh = height
     795int setvmpegrect(struct dvbdev* node, int posx, int posy, int wh, int flag)
     796{
     797        int ret = 0;
     798        int leftoffset = status.leftoffset;
     799        int rightoffset = status.rightoffset;
     800        int topoffset = status.topoffset;
     801        int bottomoffset = status.bottomoffset;
     802
     803        float rx = (float)fb->width / 720;
     804        float ry = (float)fb->height / 576;
     805
     806        leftoffset = (float)leftoffset / rx;
     807        rightoffset = (float)rightoffset / rx;
     808        topoffset = (float)topoffset / ry;
     809        bottomoffset = (float)bottomoffset / ry;
     810
     811        rx = (float)720 / (float)(720 - leftoffset - rightoffset);
     812        ry = (float)576 / (float)(576 - topoffset - bottomoffset);
     813
     814        posx = (float)posx / rx;
     815        posx += leftoffset;
     816
     817        posy = (float)posy / ry;
     818        posy += topoffset;
     819
     820        if(flag == 0)
     821        {
     822                wh = ((float)wh / rx);
     823                ret = setvmpeg(node, posx, posy, wh, (int)((float)wh / 1.2));
     824        }
     825
     826        if(flag == 1)
     827        {
     828                wh = ((float)wh / ry);
     829                ret = setvmpeg(node, posx, posy, (int)((float)wh * 1.2), wh);
     830        }
     831
     832        return ret;
     833}
     834
     835int resettvpic()
     836{
     837        int ret = 0;
     838
     839        if(status.tvpic > 0 && status.aktservice != NULL)
     840                ret = setvmpeg(status.aktservice->videodev, 0, 0, 0, 0);
     841
     842        return ret;
     843}
     844
    743845#endif
Note: See TracChangeset for help on using the changeset viewer.