hdmv_vm.h 3.17 KB
Newer Older
hpi1's avatar
hpi1 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/*
 * This file is part of libbluray
 * Copyright (C) 2010  hpi1
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library. If not, see
 * <http://www.gnu.org/licenses/>.
 */

#if !defined(_HDMV_VM_H_)
#define _HDMV_VM_H_

#include <util/attributes.h>

#include <stdint.h>

/*
 * events from hdmv_run()
 */

typedef enum {
    HDMV_EVENT_NONE = 0,       /* no events */
hpi1's avatar
hpi1 committed
33 34
    HDMV_EVENT_END,            /* end of program (movie object) */
    HDMV_EVENT_IG_END,         /* end of program (interactive) */
hpi1's avatar
hpi1 committed
35 36 37 38 39 40 41

    HDMV_EVENT_TITLE,          /* play title (from disc index) */
    HDMV_EVENT_PLAY_PL,        /* select playlist */
    HDMV_EVENT_PLAY_PI,        /* seek to playitem */
    HDMV_EVENT_PLAY_PM,        /* seek to playmark */
    HDMV_EVENT_PLAY_STOP,      /* stop playing playlist */

hpi1's avatar
hpi1 committed
42 43
    HDMV_EVENT_STILL,          /* param: boolean */

44
    HDMV_EVENT_SET_BUTTON_PAGE,
hpi1's avatar
hpi1 committed
45 46 47 48
    HDMV_EVENT_ENABLE_BUTTON,
    HDMV_EVENT_DISABLE_BUTTON,
    HDMV_EVENT_POPUP_OFF,

hpi1's avatar
hpi1 committed
49 50 51 52 53 54 55 56 57 58 59 60
} hdmv_event_e;

typedef struct hdmv_vm_event_s {
    hdmv_event_e event;
    uint32_t     param;
} HDMV_EVENT;

/*
 *
 */

struct bd_registers_s;
61
struct indx_root_s;
hpi1's avatar
hpi1 committed
62 63 64 65 66 67 68

/*
 *
 */

typedef struct hdmv_vm_s HDMV_VM;

69
BD_PRIVATE HDMV_VM *hdmv_vm_init(const char *disc_root, struct bd_registers_s *regs, struct indx_root_s *indx);
70
BD_PRIVATE void     hdmv_vm_free(HDMV_VM **p);
hpi1's avatar
hpi1 committed
71

hpi1's avatar
hpi1 committed
72 73
BD_PRIVATE int      hdmv_vm_select_object(HDMV_VM *p, int object);
BD_PRIVATE int      hdmv_vm_set_object(HDMV_VM *p, int num_nav_cmds, void *nav_cmds);
hpi1's avatar
hpi1 committed
74
BD_PRIVATE int      hdmv_vm_run(HDMV_VM *p, HDMV_EVENT *ev);
hpi1's avatar
hpi1 committed
75
BD_PRIVATE int      hdmv_vm_get_event(HDMV_VM *p, HDMV_EVENT *ev);
hpi1's avatar
hpi1 committed
76

hpi1's avatar
hpi1 committed
77
BD_PRIVATE int      hdmv_vm_running(HDMV_VM *p);
78 79 80 81 82

#define HDMV_MENU_CALL_MASK     0x01
#define HDMV_TITLE_SEARCH_MASK  0x02
BD_PRIVATE uint32_t hdmv_vm_get_uo_mask(HDMV_VM *p);

83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
/**
 *
 *  Suspend playlist playback
 *
 *  This function assumes playlist is currently playing and
 *  movie object execution is suspended at PLAY_PL instruction.
 *
 *  If resume_intention_flag of current movie object is 1:
 *    Copy playback position PSRs to backup registers
 *    (suspend playlist playback at current position)
 *  If resume_intention_flag of current movie object is 0:
 *    Discard current movie object
 *
 * @param p  HDMV_VM object
 * @return 0 on success, -1 if error
 */
BD_PRIVATE int      hdmv_vm_suspend_pl(HDMV_VM *p);

/**
 *
 *  Resume HDMV execution
 *
 *  Continue execution of movie object after playlist playback.
 *  Do not restore backup PSRs.
 *  This function is called when playlist playback ends.
 *
 * @param p  HDMV_VM object
 * @return 0 on success, -1 if error
 */
hpi1's avatar
hpi1 committed
112 113
BD_PRIVATE int      hdmv_vm_resume(HDMV_VM *p);

hpi1's avatar
hpi1 committed
114
#endif // _HDMV_VM_H_