Changeset 14954
- Timestamp:
- 03/28/12 18:18:13 (11 years ago)
- Location:
- titan
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
titan/plugins/dvdplayer/dvdplay.h
r14907 r14954 22 22 23 23 status.playspeed = 0, status.play = 0, status.pause = 0; 24 int playinfobarcount = 0, playinfobarstatus = 1;24 int playinfobarcount = 0, playinfobarstatus = 0; 25 25 26 26 tmpstr = ostrcat(file, "", 1, 0); file = NULL; … … 56 56 } 57 57 #endif 58 screenplayinfobar(file, 0, playertype, flag); 58 59 //screenplayinfobar(file, 0, playertype, flag); 59 60 60 61 //change codec if ac3default and video has ac3 … … 83 84 } 84 85 85 if(rcret == RCTIMEOUT) continue;86 87 if(rcret == getrcconfigint("rcyellow", NULL))88 playrcyellow(file, playinfobarstatus, playertype, flag);89 90 if(rcret == getrcconfigint("rctext", NULL) || rcret == getrcconfigint("rcsubtitel", NULL))91 playrctext(file, playinfobarstatus, playertype, flag);92 93 if(rcret == getrcconfigint("rcgreen", NULL))94 playrcgreen(file, playinfobarstatus, playertype, flag);95 96 if(rcret == getrcconfigint("rcblue", NULL))97 playrcblue(file, playinfobarstatus, playertype, flag);98 99 //if(rcret == getrcconfigint("rcok", NULL))100 // playrcok(file, playinfobarstatus, playertype, flag);101 102 if(rcret == getrcconfigint("rcred", NULL))103 playrcred(file, playinfobarstatus, playertype, flag);104 105 if(rcret == getrcconfigint("rcinfo", NULL))106 playrcinfo(file, &playinfobarstatus, &playinfobarcount, playertype, flag);107 108 86 if(rcret == getrcconfigint("rcstop", NULL)) 109 87 { … … 113 91 } 114 92 93 if(dvdmenuopen() == 1) 94 { 95 if(playinfobarstatus == 1) 96 { 97 screenplayinfobar(NULL, 1, playertype, flag); 98 playinfobarstatus = 0; 99 } 100 continue; 101 } 102 103 if(rcret == RCTIMEOUT) continue; 104 105 //if(rcret == getrcconfigint("rcyellow", NULL)) 106 // playrcyellow(file, playinfobarstatus, playertype, flag); 107 108 //if(rcret == getrcconfigint("rctext", NULL) || rcret == getrcconfigint("rcsubtitel", NULL)) 109 // playrctext(file, playinfobarstatus, playertype, flag); 110 111 if(rcret == getrcconfigint("rcgreen", NULL)) 112 { 113 playrcgreen(file, playinfobarstatus, playertype, flag); 114 dvdchangevideo(); 115 } 116 117 if(rcret == getrcconfigint("rcred", NULL)) 118 playrcred(file, playinfobarstatus, playertype, flag); 119 120 if(rcret == getrcconfigint("rcinfo", NULL)) 121 playrcinfo(file, &playinfobarstatus, &playinfobarcount, playertype, flag); 122 115 123 if(rcret == getrcconfigint("rcff", NULL)) 116 124 playrcff(file, &playinfobarstatus, &playinfobarcount, playertype, flag); … … 146 154 //the player stops to fast, and a last seek can 147 155 //produce a segfault 148 playerend:149 156 sleep(1); 150 157 dvdafterend(); -
titan/titan/dvdplayer.h
r14913 r14954 7 7 struct stimerthread* dvdtimerthread = NULL; 8 8 struct fb* dvdskinfb = NULL; 9 #endif 10 11 void dvdthread() 12 { 13 debug(333, "dvd thread start"); 14 15 #ifdef DVDPLAYER 16 if(ddvdconfig != NULL) 17 { 18 ddvd_run(ddvdconfig); 19 ddvd_close(ddvdconfig); 20 } 9 int tv_aspect = DDVD_16_9; 10 int tv_policy = DDVD_PAN_SCAN; 11 int tv_policy2 = DDVD_PAN_SCAN; 12 char* tv_videomode = NULL; 13 int dvdmenu = 0; 14 #endif 15 16 int dvd_calc_y_fbscreen() 17 { 18 int y_offset = 0; 19 int dvd_aspect = 0; 20 21 #ifdef DVDPLAYER 22 //0=4:3 2=16:9 23 //dvd_aspect = ddvd_get_dvd_aspect(ddvdconfig); 24 25 if(dvd_aspect == 0 && tv_policy == DDVD_PAN_SCAN) 26 { 27 switch(tv_aspect) 28 { 29 case DDVD_16_10: 30 y_offset = -(dvdskinfb->height * 15 / 12 - dvdskinfb->height) / 2; 31 break; 32 case DDVD_16_9: 33 y_offset = (dvdskinfb->height * 3 / 4 - dvdskinfb->height) / 2; 34 break; 35 } 36 } 37 38 if(dvd_aspect >= 2 && tv_aspect == DDVD_4_3 && tv_policy == DDVD_LETTERBOX) 39 y_offset = (fb->height - fb->height * 3 / 4) / 2; 40 41 if(dvd_aspect >= 2 && tv_aspect == DDVD_16_10 && tv_policy2 == DDVD_LETTERBOX) 42 y_offset = (fb->height - fb->height * 15 / 16) / 2; 43 44 45 #endif 46 return y_offset; 47 } 48 49 int dvd_calc_x_fbscreen() 50 { 51 int x_offset = 0; 52 int dvd_aspect = 0; 53 54 #ifdef DVDPLAYER 55 //0=4:3 2=16:9 56 //dvd_aspect = ddvd_get_dvd_aspect(ddvdconfig); 57 58 if(dvd_aspect == 0 && tv_policy == DDVD_LETTERBOX) 59 { 60 switch(tv_aspect) 61 { 62 case DDVD_16_10: 63 x_offset = (fb->width - fb->width * 12 / 15) / 2; 64 break; 65 case DDVD_16_9: 66 x_offset = (fb->width - fb->width * 3 / 4) / 2; 67 break; 68 } 69 } 70 71 if(dvd_aspect >= 2 && tv_aspect == DDVD_4_3 && tv_policy == DDVD_PAN_SCAN) 72 x_offset = -(dvdskinfb->width * 4 / 3 - dvdskinfb->width) / 2; 73 74 if(dvd_aspect >= 2 && tv_aspect == DDVD_16_10 && tv_policy2 == DDVD_PAN_SCAN) 75 x_offset = -(dvdskinfb->width * 16 / 15 - dvdskinfb->width) / 2; 76 77 78 #endif 79 return x_offset; 80 } 81 82 int dvdblit() 83 { 84 #ifdef DVDPLAYER 85 int x_offset = dvd_calc_x_fbscreen(); 86 int y_offset = dvd_calc_y_fbscreen(); 87 88 m_lock(&status.drawingmutex, 0); 89 90 int leftoffset = getconfigint("fbleftoffset", NULL); 91 int rightoffset = getconfigint("fbrightoffset", NULL); 92 int topoffset = getconfigint("fbtopoffset", NULL); 93 int bottomoffset = getconfigint("fbbottomoffset", NULL); 94 95 if(leftoffset != 0) addconfigint("fbleftoffset", 0); 96 if(rightoffset != 0) addconfigint("fbrightoffset", 0); 97 if(topoffset != 0) addconfigint("fbtopoffset", 0); 98 if(bottomoffset != 0) addconfigint("fbbottomoffset", 0); 99 100 unsigned char* fb = dvdskinfb->fb; 101 int width = dvdskinfb->width; 102 int height = dvdskinfb->height; 103 104 if(x_offset > 0) 105 { 106 addconfigint("fbleftoffset", x_offset); 107 addconfigint("fbrightoffset", x_offset); 108 } 109 if(x_offset < 0) 110 { 111 dvdskinfb->fb -= x_offset * dvdskinfb->colbytes; 112 dvdskinfb->width += (x_offset * 2); 113 } 114 if(y_offset > 0) 115 { 116 addconfigint("fbtopoffset", y_offset); 117 addconfigint("fbbottomoffset", y_offset); 118 } 119 if(y_offset < 0) 120 { 121 dvdskinfb->fb -= y_offset * dvdskinfb->pitch; 122 dvdskinfb->height += (y_offset * 2); 123 } 124 125 blitfb2(dvdskinfb, 0); 126 127 if(x_offset < 0) 128 { 129 dvdskinfb->fb = fb; 130 dvdskinfb->width = width; 131 } 132 if(y_offset < 0) 133 { 134 dvdskinfb->fb = fb; 135 dvdskinfb->height = height; 136 } 137 138 addconfigint("fbleftoffset", leftoffset); 139 addconfigint("fbrightoffset", rightoffset); 140 addconfigint("fbtopoffset", topoffset); 141 addconfigint("fbbottomoffset", bottomoffset); 142 143 m_unlock(&status.drawingmutex, 0); 144 #endif 145 146 return 0; 147 } 148 149 void dvdchangevideo() 150 { 151 char* tmpstr = NULL; 152 153 tmpstr = getaspect(); 154 if(ostrncmp(tmpstr, "4:3", 3) == 0) 155 tv_aspect = DDVD_4_3; 156 else if(ostrncmp(tmpstr, "16:10", 5) == 0) 157 tv_aspect = DDVD_16_10; 158 else 159 tv_aspect = DDVD_16_9; 160 free(tmpstr); tmpstr = NULL; 21 161 162 tmpstr = getpolicy(); 163 if(ostrncmp(tmpstr, "bestfit", 7) == 0) 164 tv_policy = DDVD_JUSTSCALE; 165 else if(ostrncmp(tmpstr, "letterbox", 9) == 0) 166 tv_policy = DDVD_LETTERBOX; 167 else 168 tv_policy = DDVD_PAN_SCAN; 169 free(tmpstr); tmpstr = NULL; 170 171 //TODO: 172 //tmpstr = getpolicy2(); 173 //if(ostrncmp(tmpstr, "bestfit", 7) == 0) 174 // tv_policy2 = DDVD_JUSTSCALE; 175 //else if(ostrncmp(tmpstr, "letterbox", 9) == 0) 176 // tv_policy2 = DDVD_LETTERBOX; 177 //else 178 // tv_policy2 = DDVD_PANSCAN; 179 //free(tmpstr); tmpstr = NULL; 180 tv_policy2 = tv_policy; 181 } 182 183 void dvdcleanup() 184 { 185 #ifdef DVDPLAYER 22 186 ddvdconfig = NULL; 23 187 dvdtimerthread = NULL; 24 188 delfb("dvdskinfb"); 25 189 dvdskinfb = NULL; 190 if(tv_videomode != NULL) 191 { 192 setvideomode(tv_videomode, 0); 193 changefbresolution(tv_videomode); 194 free(tv_videomode); tv_videomode = NULL; 195 } 196 #endif 197 } 198 199 void dvdthread() 200 { 201 debug(333, "dvd thread start"); 202 203 #ifdef DVDPLAYER 204 if(ddvdconfig != NULL) 205 { 206 ddvd_run(ddvdconfig); 207 ddvd_close(ddvdconfig); 208 } 209 210 dvdcleanup(); 26 211 #endif 27 212 … … 32 217 { 33 218 #ifdef DVDPLAYER 34 int aspect = DDVD_16_9;35 int policy = DDVD_PAN_SCAN;36 int policy2 = DDVD_PAN_SCAN;37 219 char* tmpstr = NULL; 38 220 … … 62 244 free(tmpstr); tmpstr = NULL; 63 245 64 tmpstr = getaspect(); 65 if(ostrncmp(tmpstr, "4:3", 3) == 0) 66 aspect = DDVD_4_3; 67 else if(ostrncmp(tmpstr, "16:10", 5) == 0) 68 aspect = DDVD_16_10; 69 free(tmpstr); tmpstr = NULL; 70 71 tmpstr = getpolicy(); 72 if(ostrncmp(tmpstr, "bestfit", 7) == 0) 73 policy = DDVD_JUSTSCALE; 74 else if(ostrncmp(tmpstr, "letterbox", 9) == 0) 75 policy = DDVD_LETTERBOX; 76 free(tmpstr); tmpstr = NULL; 246 dvdchangevideo(); 77 247 78 248 #ifdef DDVD_SUPPORTS_16_10_SCALING 79 //TODO: tmpstr = getpolicy2(); 80 if(ostrncmp(tmpstr, "bestfit", 7) == 0) 81 policy2 = DDVD_JUSTSCALE; 82 else if(ostrncmp(tmpstr, "letterbox", 9) == 0) 83 policy2 = DDVD_LETTERBOX; 84 free(tmpstr); tmpstr = NULL; 85 86 ddvd_set_video_ex(ddvdconfig, aspect, policy, policy2, DDVD_PAL); 249 ddvd_set_video_ex(ddvdconfig, tv_aspect, tv_policy, tv_policy2, DDVD_PAL); 87 250 #else 88 ddvd_set_video(ddvdconfig, aspect,policy, DDVD_PAL);251 ddvd_set_video(ddvdconfig, tv_aspect, tv_policy, DDVD_PAL); 89 252 #warning please update libdreamdvd for 16:10 scaling support! 90 253 #endif 91 ddvd_set_spu(ddvdconfig, -1);92 254 if(dvdsetfb() != 0) 93 255 { … … 98 260 } 99 261 262 free(tv_videomode); tv_videomode = NULL; 263 tv_videomode = getvideomode(); 264 265 //change videomode if greater 720 266 if(ostrncmp("1080", tv_videomode, 4) == 0) 267 { 268 setvideomode("720p", 0); 269 changefbresolution("720p"); 270 } 271 else 272 { 273 free(tv_videomode); 274 tv_videomode = NULL; 275 } 276 277 ddvd_set_spu(ddvdconfig, -1); 100 278 dvdtimerthread = addtimer(&dvdthread, START, 1000, 1, NULL, NULL, NULL); 101 279 sleep(1); 102 280 if(dvdtimerthread != NULL) 103 281 return 0; 104 else105 return 1;282 283 dvdcleanup(); 106 284 #endif 107 285 return 1; 286 } 287 288 int dvdmenuopen() 289 { 290 return dvdmenu; 108 291 } 109 292 … … 145 328 { 146 329 int x1 = 0, x2 = 0, y1 = 0, y2 = 0; 147 int x_offset = 0, y_offset = 0, width = dvdskinfb->width, height = dvdskinfb->height;148 330 ddvd_get_last_blit_area(ddvdconfig, &x1, &x2, &y1, &y2); 149 150 #ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION 151 //ddvd_get_blit_destination(ddvdconfig, &x_offset, &y_offset, &width, &height); 152 debug(333, "values got from ddvd: %d %d %d %d", x_offset, y_offset, width, height); 153 154 y_offset = -y_offset; 155 width -= x_offset * 2; 156 height -= y_offset * 2; 157 #endif 158 blitfb2(dvdskinfb, 0); 159 //eRect dest(x_offset, y_offset, width, height); 160 161 //if (dest.width() && dest.height()) 162 // m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, (x2-x1)+1, (y2-y1)+1), dest); 331 debug(333, "ddvd blit area: %d %d %d %d", x1, y1, x2, y2); 332 if(x1 != 0 || x2 != 0 || y1 != 0 || y2 != 0) 333 dvdblit(); 163 334 } 164 335 break; … … 257 428 { 258 429 debug(333, "DVD_MENU_OPENED"); 259 /* 260 m_state = stMenu; 261 m_event(this, evSeekableStatusChanged); 262 m_event(this, evUser+11); 263 */ 430 dvdmenu = 1; 264 431 break; 265 432 } … … 267 434 { 268 435 debug(333, "DVD_MENU_CLOSED"); 269 /* 270 m_state = stRunning; 271 m_event(this, evSeekableStatusChanged); 272 m_event(this, evUser+12); 273 */ 436 dvdmenu = 0; 274 437 break; 275 438 } … … 595 758 596 759 if(dvdskinfb == NULL) 597 dvdskinfb = addfb("dvdskinfb", 1001, width, height, colbytes, -1, skinfb->fb, width * height * colbytes);760 dvdskinfb = addfb("dvdskinfb", 1001, width, height, colbytes, -1, fb->fb + (fb->width * fb->height * fb->colbytes), width * height * colbytes); 598 761 599 762 if(dvdskinfb == NULL) return 1; 600 763 if(ddvdconfig == NULL) return 1; 601 #ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION764 //#ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION 602 765 ddvd_set_lfb_ex(ddvdconfig, dvdskinfb->fb, dvdskinfb->width, dvdskinfb->height, dvdskinfb->colbytes, dvdskinfb->pitch, 1); 603 #else 604 ddvd_set_lfb(ddvdconfig, dvdskinfb->fb, dvdskinfb->width, dvdskinfb->height, dvdskinfb->colbytes, dvdskinfb->pitch); 605 #warning please update libdreamdvd for fast scaling 606 #endif 607 #endif 608 return 0; 609 } 610 611 /* 612 RESULT eServiceDVD::enableSubtitles(eWidget *parent, ePyObject tuple) 613 { 614 eSize size = eSize(720, 576); 615 616 int pid = -1; 617 618 if ( tuple != Py_None ) 619 { 620 ePyObject entry; 621 int tuplesize = PyTuple_Size(tuple); 622 if (!PyTuple_Check(tuple)) 623 goto error_out; 624 if (tuplesize < 1) 625 goto error_out; 626 entry = PyTuple_GET_ITEM(tuple, 1); 627 if (!PyInt_Check(entry)) 628 goto error_out; 629 pid = PyInt_AsLong(entry)-1; 630 631 ddvd_set_spu(m_ddvdconfig, pid); 632 m_event(this, evUser+7); 633 } 634 eDebug("eServiceDVD::enableSubtitles %i", pid); 635 636 if (!m_pixmap) 637 { 638 run(); // start the thread 639 } 640 641 } 642 */ 766 //#else 767 // ddvd_set_lfb(ddvdconfig, dvdskinfb->fb, dvdskinfb->width, dvdskinfb->height, dvdskinfb->colbytes, dvdskinfb->pitch); 768 //#warning please update libdreamdvd for fast scaling 769 //#endif 770 #endif 771 return 0; 772 } 643 773 644 774 unsigned long long int dvdgetlength() … … 759 889 if(key == getrcconfigint("rcok", NULL)) 760 890 ddvd_send_key(ddvdconfig, DDVD_KEY_OK); 761 if(key == getrcconfigint("rc blue", NULL))891 if(key == getrcconfigint("rcyellow", NULL)) 762 892 ddvd_send_key(ddvdconfig, DDVD_KEY_AUDIO); 763 if(key == getrcconfigint("rc yellow", NULL))893 if(key == getrcconfigint("rctext", NULL) || key == getrcconfigint("rcsubtitel", NULL)) 764 894 ddvd_send_key(ddvdconfig, DDVD_KEY_SUBTITLE); 765 895 if(key == getrcconfigint("rcyellow", NULL)) 766 896 ddvd_send_key(ddvdconfig, DDVD_KEY_AUDIOMENU); 767 if(key == getrcconfigint("rc yellow", NULL))897 if(key == getrcconfigint("rcnext", NULL)) 768 898 ddvd_send_key(ddvdconfig, DDVD_KEY_NEXT_CHAPTER); 769 if(key == getrcconfigint("rc yellow", NULL))899 if(key == getrcconfigint("rcprev", NULL)) 770 900 ddvd_send_key(ddvdconfig, DDVD_KEY_PREV_CHAPTER); 771 if(key == getrcconfigint("rc yellow", NULL))901 if(key == getrcconfigint("rcchup", NULL)) 772 902 ddvd_send_key(ddvdconfig, DDVD_KEY_NEXT_TITLE); 773 if(key == getrcconfigint("rc yellow", NULL))903 if(key == getrcconfigint("rcchdown", NULL)) 774 904 ddvd_send_key(ddvdconfig, DDVD_KEY_PREV_TITLE); 775 905 if(key == getrcconfigint("rcmenu", NULL)) 776 906 ddvd_send_key(ddvdconfig, DDVD_KEY_MENU); 777 if(key == getrcconfigint("rc menu", NULL))907 if(key == getrcconfigint("rcblue", NULL)) 778 908 ddvd_send_key(ddvdconfig, DDVD_KEY_ANGLE); 779 909 #endif
Note: See TracChangeset
for help on using the changeset viewer.