Skip to content

Commit

Permalink
Merge branch 'master' of github.com:MythTV/mythtv
Browse files Browse the repository at this point in the history
  • Loading branch information
kormoc committed Feb 21, 2011
2 parents 7a7003c + 37ab29c commit 1ba3ff6
Show file tree
Hide file tree
Showing 16 changed files with 220 additions and 415 deletions.
3 changes: 2 additions & 1 deletion mythplugins/mythgame/mythgame/gamehandler.h
Expand Up @@ -63,7 +63,8 @@ class GameHandler : public QObject
commandline(QString::null), workingpath(QString::null),
screenshots(QString::null), gameplayerid(0),
gametype(QString::null),
m_RemoveAll(false), m_KeepAll(false) {}
m_RemoveAll(false), m_KeepAll(false),
m_progressDlg(NULL) {}

static void updateSettings(GameHandler*);
static GameHandler *getHandler(uint i);
Expand Down
11 changes: 11 additions & 0 deletions mythtv/libs/libmyth/mythmediamonitor.cpp
Expand Up @@ -518,6 +518,17 @@ QString MediaMonitor::GetMountPath(const QString& devPath)
mountPath = pMedia->getMountPath();
c_monitor->Unlock(pMedia);
}
// The media monitor could be inactive.
// Create a fake media device just to lookup mount map:
else
{
pMedia = MythCDROM::get(NULL, devPath.toAscii(), true, false);
if (pMedia && pMedia->findMountPath())
mountPath = pMedia->getMountPath();
else
VERBOSE(VB_MEDIA, "MediaMonitor::GetMountPath() - failed");
// need some way to delete the media device.
}
}

return mountPath;
Expand Down
26 changes: 23 additions & 3 deletions mythtv/libs/libmythbase/mythmedia.cpp
Expand Up @@ -28,10 +28,18 @@ using namespace std;

static const QString PATHTO_PMOUNT("/usr/bin/pmount");
static const QString PATHTO_PUMOUNT("/usr/bin/pumount");
static const QString PATHTO_MOUNT("/bin/mount");
#if CONFIG_DARWIN
static const QString PATHTO_MOUNT("/sbin/mount");
#else
static const QString PATHTO_MOUNT("/bin/mount");
#endif
static const QString PATHTO_UNMOUNT("/bin/umount");
static const QString PATHTO_MOUNTS("/proc/mounts");

#if CONFIG_DARWIN
# define USE_MOUNT_COMMAND
#endif

const char* MythMediaDevice::MediaStatusStrings[] =
{
"MEDIASTAT_ERROR",
Expand Down Expand Up @@ -349,9 +357,9 @@ bool MythMediaDevice::findMountPath()
return false;
}

#if CONFIG_DARWIN
#ifdef USE_MOUNT_COMMAND
// HACK. TODO: replace with something using popen()?
if (myth_system("/sbin/mount > /tmp/mounts") != GENERIC_EXIT_OK)
if (myth_system(PATHTO_MOUNT + " > /tmp/mounts") != GENERIC_EXIT_OK)
return false;
QFile mountFile("/tmp/mounts");
#else
Expand All @@ -372,7 +380,13 @@ bool MythMediaDevice::findMountPath()


// Extract the mount point and device name.
#ifdef USE_MOUNT_COMMAND
stream >> deviceName;
stream >> mountPoint; // throw away the "on" between path and mount
stream >> mountPoint;
#else
stream >> deviceName >> mountPoint;
#endif
stream.readLine(); // skip the rest of the line

if (deviceName.isNull())
Expand All @@ -387,6 +401,12 @@ bool MythMediaDevice::findMountPath()
QStringList deviceNames;
getSymlinkTarget(deviceName, &deviceNames);

#if CONFIG_DARWIN
// match short-style BSD node names:
if (m_DevicePath.startsWith("disk"))
deviceNames << deviceName.mid(5); // remove 5 chars - /dev/
#endif

// Deal with escaped spaces
if (mountPoint.contains("\\040"))
mountPoint.replace("\\040", " ");
Expand Down
156 changes: 92 additions & 64 deletions mythtv/libs/libmythbluray/decoders/graphics_controller.c
Expand Up @@ -167,6 +167,69 @@ static BD_PG_OBJECT *_find_object_for_button(PG_DISPLAY_SET *s,
* util
*/

static int _is_button_enabled(GRAPHICS_CONTROLLER *gc, BD_IG_PAGE *page, unsigned button_id)
{
unsigned ii;
for (ii = 0; ii < page->num_bogs; ii++) {
if (gc->enabled_button[ii] == button_id) {
return 1;
}
}
return 0;
}

static int _find_selected_button_id(GRAPHICS_CONTROLLER *gc)
{
/* executed when playback condition changes (ex. new page, popup-on, ...) */
PG_DISPLAY_SET *s = gc->igs;
BD_IG_PAGE *page = NULL;
unsigned page_id = bd_psr_read(gc->regs, PSR_MENU_PAGE_ID);
unsigned button_id = bd_psr_read(gc->regs, PSR_SELECTED_BUTTON_ID);
unsigned ii;

page = _find_page(&s->ics->interactive_composition, page_id);
if (!page) {
TRACE("_find_selected_button_id(): unknown page #%d (have %d pages)\n",
page_id, s->ics->interactive_composition.num_pages);
return 0xffff;
}

/* run 5.9.8.3 */

/* 1) always use page->default_selected_button_id_ref if it is valid */
if (_find_button_page(page, page->default_selected_button_id_ref, NULL) &&
_is_button_enabled(gc, page, page->default_selected_button_id_ref)) {

TRACE("_find_selected_button_id() -> default #%d\n", page->default_selected_button_id_ref);
return page->default_selected_button_id_ref;
}

/* 2) fallback to current PSR10 value if it is valid */
for (ii = 0; ii < page->num_bogs; ii++) {
BD_IG_BOG *bog = &page->bog[ii];

if (button_id == gc->enabled_button[ii]) {
if (_find_button_bog(bog, gc->enabled_button[ii])) {
TRACE("_find_selected_button_id() -> PSR10 #%d\n", gc->enabled_button[ii]);
return gc->enabled_button[ii];
}
}
}

/* 3) fallback to find first valid_button_id_ref from page */
for (ii = 0; ii < page->num_bogs; ii++) {
BD_IG_BOG *bog = &page->bog[ii];

if (_find_button_bog(bog, gc->enabled_button[ii])) {
TRACE("_find_selected_button_id() -> first valid #%d\n", gc->enabled_button[ii]);
return gc->enabled_button[ii];
}
}

TRACE("_find_selected_button_id(): not found -> 0xffff\n");
return 0xffff;
}

static void _reset_enabled_button(GRAPHICS_CONTROLLER *gc)
{
PG_DISPLAY_SET *s = gc->igs;
Expand Down Expand Up @@ -214,6 +277,13 @@ static void _gc_clear_osd(GRAPHICS_CONTROLLER *gc, int plane)
}
}

static void _select_page(GRAPHICS_CONTROLLER *gc, uint16_t page_id)
{
bd_psr_write(gc->regs, PSR_MENU_PAGE_ID, page_id);
_gc_clear_osd(gc, 1);
_reset_enabled_button(gc);
}

static void _gc_reset(GRAPHICS_CONTROLLER *gc)
{
_gc_clear_osd(gc, 0);
Expand Down Expand Up @@ -292,13 +362,9 @@ void gc_decode_ts(GRAPHICS_CONTROLLER *gc, uint16_t pid, uint8_t *block, unsigne
return;
}

bd_psr_write(gc->regs, PSR_MENU_PAGE_ID, 0);

gc->ig_drawn = 0;
gc->popup_visible = 0;

_gc_clear_osd(gc, 1);
_reset_enabled_button(gc);
_select_page(gc, 0);

bd_mutex_unlock(&gc->mutex);
}
Expand Down Expand Up @@ -347,6 +413,7 @@ static void _render_button(GRAPHICS_CONTROLLER *gc, BD_IG_BUTTON *button, BD_PG_

if (gc->overlay_proc) {
gc->overlay_proc(gc->overlay_proc_handle, &ov);
gc->ig_drawn = 1;
}
}

Expand Down Expand Up @@ -442,6 +509,10 @@ static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cm
TRACE("_user_input(): popup menu not visible\n");
return -1;
}
if (!gc->ig_drawn) {
ERROR("_user_input(): menu not visible\n");
return -1;
}

TRACE("_user_input(%d)\n", key);

Expand Down Expand Up @@ -504,7 +575,7 @@ static int _user_input(GRAPHICS_CONTROLLER *gc, bd_vk_key_e key, GC_NAV_CMDS *cm
}

/* render page ? */
if (new_btn_id != cur_btn_id || activated_btn_id >= 0 || !gc->ig_drawn) {
if (new_btn_id != cur_btn_id || activated_btn_id >= 0) {

bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, new_btn_id);

Expand Down Expand Up @@ -557,11 +628,7 @@ static void _set_button_page(GRAPHICS_CONTROLLER *gc, uint32_t param, GC_NAV_CMD

/* page changes */

bd_psr_write(gc->regs, PSR_MENU_PAGE_ID, page_id);

_reset_enabled_button(gc);
_gc_clear_osd(gc, 1);

_select_page(gc, page_id);

} else {
/* page does not change */
Expand Down Expand Up @@ -648,64 +715,24 @@ static void _enable_button(GRAPHICS_CONTROLLER *gc, uint32_t button_id, unsigned
}
}

static int _is_button_enabled(GRAPHICS_CONTROLLER *gc, BD_IG_PAGE *page, unsigned button_id)
{
unsigned ii;
for (ii = 0; ii < page->num_bogs; ii++) {
if (gc->enabled_button[ii] == button_id) {
return 1;
}
}
return 0;
}

static void _update_selected_button(GRAPHICS_CONTROLLER *gc)
{
/* executed after IG command sequence terminates */
unsigned button_id = bd_psr_read(gc->regs, PSR_SELECTED_BUTTON_ID);

TRACE("_update_enabled_button(): currently enabled button is #%d\n", button_id);
TRACE("_update_selected_button(): currently enabled button is #%d\n", button_id);

// special case: triggered only after enable button disables selected button
/* special case: triggered only after enable button disables selected button */
if (button_id & 0x10000) {
button_id &= 0xffff;
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
TRACE("_update_enabled_button() -> #%d [last enabled]\n", button_id);
TRACE("_update_selected_button() -> #%d [last enabled]\n", button_id);
return;
}

if (button_id == 0xffff) {
PG_DISPLAY_SET *s = gc->igs;
BD_IG_PAGE *page = NULL;
unsigned page_id = bd_psr_read(gc->regs, PSR_MENU_PAGE_ID);

page = _find_page(&s->ics->interactive_composition, page_id);
if (!page) {
TRACE("_update_enabled_button(): unknown page #%d (have %d pages)\n",
page_id, s->ics->interactive_composition.num_pages);
return;
}

// run 5.9.8.3

if (_find_button_page(page, page->default_selected_button_id_ref, NULL) &&
_is_button_enabled(gc, page, page->default_selected_button_id_ref)) {

button_id = page->default_selected_button_id_ref;

} else {
unsigned ii;
for (ii = 0; ii < page->num_bogs; ii++) {

BD_IG_BOG *bog = &page->bog[ii];
if (_find_button_bog(bog, gc->enabled_button[ii])) {
button_id = gc->enabled_button[ii];
break;
}
}
}

if (button_id == 0xffff) {
button_id = _find_selected_button_id(gc);
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, button_id);
TRACE("_update_enabled_button() -> #%d\n", button_id);
}
}

Expand All @@ -720,6 +747,11 @@ static int _mouse_move(GRAPHICS_CONTROLLER *gc, unsigned x, unsigned y, GC_NAV_C

gc->valid_mouse_position = 0;

if (!gc->ig_drawn) {
ERROR("_mouse_move(): menu not visible\n");
return -1;
}

page = _find_page(&s->ics->interactive_composition, page_id);
if (!page) {
ERROR("_mouse_move(): unknown page #%d (have %d pages)\n",
Expand Down Expand Up @@ -747,10 +779,10 @@ static int _mouse_move(GRAPHICS_CONTROLLER *gc, unsigned x, unsigned y, GC_NAV_C
continue;

/* mouse is over button */
gc->valid_mouse_position = 1;

/* is button already selected? */
if (button->id == cur_btn_id) {
gc->valid_mouse_position = 1;
return 0;
}

Expand All @@ -762,11 +794,9 @@ static int _mouse_move(GRAPHICS_CONTROLLER *gc, unsigned x, unsigned y, GC_NAV_C
bd_psr_write(gc->regs, PSR_SELECTED_BUTTON_ID, new_btn_id);

_render_page(gc, -1, cmds);

gc->valid_mouse_position = 1;
}

return gc->valid_mouse_position;
return gc->valid_mouse_position;
}

int gc_run(GRAPHICS_CONTROLLER *gc, gc_ctrl_e ctrl, uint32_t param, GC_NAV_CMDS *cmds)
Expand Down Expand Up @@ -826,9 +856,7 @@ int gc_run(GRAPHICS_CONTROLLER *gc, gc_ctrl_e ctrl, uint32_t param, GC_NAV_CMDS
gc->popup_visible = !!param;

if (gc->popup_visible) {
bd_psr_write(gc->regs, PSR_MENU_PAGE_ID, 0);
_reset_enabled_button(gc);
_gc_clear_osd(gc, 1);
_select_page(gc, 0);
}

/* fall thru */
Expand Down

0 comments on commit 1ba3ff6

Please sign in to comment.