void eServiceDVD::gotMessage(int /*what*/) { switch(ddvd_get_next_message(m_ddvdconfig,1)) { case DDVD_COLORTABLE_UPDATE: { /* struct ddvd_color ctmp[4]; ddvd_get_last_colortable(ddvdconfig, ctmp); int i=0; while (i < 4) { rd1[252+i]=ctmp[i].red; bl1[252+i]=ctmp[i].blue; gn1[252+i]=ctmp[i].green; tr1[252+i]=ctmp[i].trans; i++; } if(ioctl(fb, FBIOPUTCMAP, &colormap) == -1) { printf("Framebuffer: <FBIOPUTCMAP failed>\n"); return 1; } */ eDebug("no support for 8bpp framebuffer in dvdplayer yet!"); break; } case DDVD_SCREEN_UPDATE: eDebug("DVD_SCREEN_UPDATE!"); if (m_subtitle_widget) { int x1,x2,y1,y2; ddvd_get_last_blit_area(m_ddvdconfig, &x1, &x2, &y1, &y2); int x_offset = 0, y_offset = 0, width = 720, height = 576; #ifdef DDVD_SUPPORTS_GET_BLIT_DESTINATION ddvd_get_blit_destination(m_ddvdconfig, &x_offset, &y_offset, &width, &height); eDebug("values got from ddvd: %d %d %d %d", x_offset, y_offset, width, height); y_offset = -y_offset; width -= x_offset * 2; height -= y_offset * 2; #endif eRect dest(x_offset, y_offset, width, height); if (dest.width() && dest.height()) m_subtitle_widget->setPixmap(m_pixmap, eRect(x1, y1, (x2-x1)+1, (y2-y1)+1), dest); } break; case DDVD_SHOWOSD_STATE_PLAY: { eDebug("DVD_SHOWOSD_STATE_PLAY!"); m_current_trick = 0; m_event(this, evUser+1); break; } case DDVD_SHOWOSD_STATE_PAUSE: { eDebug("DVD_SHOWOSD_STATE_PAUSE!"); m_event(this, evUser+2); break; } case DDVD_SHOWOSD_STATE_FFWD: { eDebug("DVD_SHOWOSD_STATE_FFWD!"); m_event(this, evUser+3); break; } case DDVD_SHOWOSD_STATE_FBWD: { eDebug("DVD_SHOWOSD_STATE_FBWD!"); m_event(this, evUser+4); break; } case DDVD_SHOWOSD_STRING: { eDebug("DVD_SHOWOSD_STRING!"); m_event(this, evUser+5); break; } case DDVD_SHOWOSD_AUDIO: { eDebug("DVD_SHOWOSD_STRING!"); m_event(this, evUser+6); break; } case DDVD_SHOWOSD_SUBTITLE: { eDebug("DVD_SHOWOSD_SUBTITLE!"); m_event((iPlayableService*)this, evUpdatedInfo); m_event(this, evUser+7); break; } case DDVD_EOF_REACHED: eDebug("DVD_EOF_REACHED!"); m_event(this, evEOF); break; case DDVD_SOF_REACHED: eDebug("DVD_SOF_REACHED!"); m_event(this, evSOF); break; case DDVD_SHOWOSD_ANGLE: { int current, num; ddvd_get_angle_info(m_ddvdconfig, ¤t, &num); eDebug("DVD_ANGLE_INFO: %d / %d", current, num); m_event(this, evUser+13); break; } case DDVD_SHOWOSD_TIME: { static struct ddvd_time last_info; struct ddvd_time info; // eDebug("DVD_SHOWOSD_TIME!"); ddvd_get_last_time(m_ddvdconfig, &info); if ( info.pos_chapter != last_info.pos_chapter ) m_event(this, evUser+8); // chapterUpdated if ( info.pos_title != last_info.pos_title ) m_event(this, evUser+9); // titleUpdated memcpy(&last_info, &info, sizeof(struct ddvd_time)); break; } case DDVD_SHOWOSD_TITLESTRING: { ddvd_get_title_string(m_ddvdconfig, m_ddvd_titlestring); eDebug("DDVD_SHOWOSD_TITLESTRING: %s",m_ddvd_titlestring); loadCuesheet(); if (!m_cue_pts) unpause(); m_event(this, evStart); break; } case DDVD_MENU_OPENED: eDebug("DVD_MENU_OPENED!"); m_state = stMenu; m_event(this, evSeekableStatusChanged); m_event(this, evUser+11); break; case DDVD_MENU_CLOSED: eDebug("DVD_MENU_CLOSED!"); m_state = stRunning; m_event(this, evSeekableStatusChanged); m_event(this, evUser+12); break; #ifdef DDVD_SUPPORTS_PICTURE_INFO case DDVD_SIZE_CHANGED: { int changed = m_width != -1 && m_height != -1 && m_aspect != -1; ddvd_get_last_size(m_ddvdconfig, &m_width, &m_height, &m_aspect); if (changed) m_event((iPlayableService*)this, evVideoSizeChanged); break; } case DDVD_PROGRESSIVE_CHANGED: { int changed = m_progressive != -1; ddvd_get_last_progressive(m_ddvdconfig, &m_progressive); if (changed) m_event((iPlayableService*)this, evVideoProgressiveChanged); break; } case DDVD_FRAMERATE_CHANGED: { int changed = m_framerate != -1; ddvd_get_last_framerate(m_ddvdconfig, &m_framerate); if (changed) m_event((iPlayableService*)this, evVideoFramerateChanged); break; } #endif default: break; } }
PyObject *eServiceDVD::getInfoObject(int w) { switch(w) { case sUser+6: { ePyObject tuple = PyTuple_New(3); int audio_id,audio_type; uint16_t audio_lang; ddvd_get_last_audio(m_ddvdconfig, &audio_id, &audio_lang, &audio_type); char audio_string[3]={audio_lang >> 8, audio_lang, 0}; PyTuple_SetItem(tuple, 0, PyInt_FromLong(audio_id+1)); PyTuple_SetItem(tuple, 1, PyString_FromString(audio_string)); switch(audio_type) { case DDVD_MPEG: PyTuple_SetItem(tuple, 2, PyString_FromString("MPEG")); break; case DDVD_AC3: PyTuple_SetItem(tuple, 2, PyString_FromString("AC3")); break; case DDVD_DTS: PyTuple_SetItem(tuple, 2, PyString_FromString("DTS")); break; case DDVD_LPCM: PyTuple_SetItem(tuple, 2, PyString_FromString("LPCM")); break; default: PyTuple_SetItem(tuple, 2, PyString_FromString("")); } return tuple; } case sUser+7: { ePyObject tuple = PyTuple_New(2); int spu_id; uint16_t spu_lang; ddvd_get_last_spu(m_ddvdconfig, &spu_id, &spu_lang); char spu_string[3]={spu_lang >> 8, spu_lang, 0}; if (spu_id == -1) { PyTuple_SetItem(tuple, 0, PyInt_FromLong(0)); PyTuple_SetItem(tuple, 1, PyString_FromString("")); } else { PyTuple_SetItem(tuple, 0, PyInt_FromLong(spu_id+1)); PyTuple_SetItem(tuple, 1, PyString_FromString(spu_string)); } return tuple; } case sUser+8: { ePyObject tuple = PyTuple_New(2); int current, num; ddvd_get_angle_info(m_ddvdconfig, ¤t, &num); PyTuple_SetItem(tuple, 0, PyInt_FromLong(current)); PyTuple_SetItem(tuple, 1, PyInt_FromLong(num)); return tuple; } default: eDebug("unhandled getInfoObject(%d)", w); } Py_RETURN_NONE; }
ePtr<iServiceInfoContainer> eServiceDVD::getInfoObject(int w) { eServiceDVDInfoContainer *container = new eServiceDVDInfoContainer; ePtr<iServiceInfoContainer> retval = container; switch (w) { case sUser + 6: { int audio_id,audio_type; uint16_t audio_lang; ddvd_get_last_audio(m_ddvdconfig, &audio_id, &audio_lang, &audio_type); char audio_string[3] = {audio_lang >> 8, audio_lang, 0}; eDebug("[eServiceDVD] getInfoObject sUser+6: audio_id=%d lang=%X type=%d", audio_id, audio_lang, audio_type); container->addInteger(audio_id + 1); container->addString(audio_string); switch (audio_type) { case DDVD_MPEG: container->addString("MPEG"); break; case DDVD_AC3: container->addString("AC3"); break; case DDVD_DTS: container->addString("DTS"); break; case DDVD_LPCM: container->addString("LPCM"); break; } break; } case sUser + 7: { int spu_id; uint16_t spu_lang; ddvd_get_last_spu(m_ddvdconfig, &spu_id, &spu_lang); eDebug("[eServiceDVD] getInfoObject sUser+7: spu_id=%d lang=%X", spu_id, spu_lang); char spu_string[3] = {spu_lang >> 8, spu_lang, 0}; if (spu_id == -1) { container->addInteger(0); container->addString(""); } else { container->addInteger(spu_id + 1); container->addString(spu_string); } break; } case sUser + 8: { int current, num; ddvd_get_angle_info(m_ddvdconfig, ¤t, &num); eDebug("[eServiceDVD] getInfoObject sUser+8: angle=%d num=%X", current, num); container->addInteger(current); container->addInteger(num); break; } default: eDebug("[eServiceDVD] getInfoObject %d unsupported", w); } return retval; }