PageRenderTime 53ms CodeModel.GetById 17ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/cores/dvdplayer/DVDInputStreams/dvdnav/vm.h

http://github.com/xbmc/xbmc
C++ Header | 186 lines | 113 code | 24 blank | 49 comment | 0 complexity | c6471d2c09703bcd1d5d0c39829168de MD5 | raw file
  1/*
  2 * Copyright (C) 2000, 2001 H?kan Hjort
  3 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net>
  4 * 
  5 * This file is part of libdvdnav, a DVD navigation library. It is modified
  6 * from a file originally part of the Ogle DVD player.
  7 * 
  8 * libdvdnav is free software; you can redistribute it and/or modify
  9 * it under the terms of the GNU General Public License as published by
 10 * the Free Software Foundation; either version 2 of the License, or
 11 * (at your option) any later version.
 12 * 
 13 * libdvdnav is distributed in the hope that it will be useful,
 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 16 * GNU General Public License for more details.
 17 * 
 18 * You should have received a copy of the GNU General Public License along
 19 * with libdvdnav; if not, write to the Free Software Foundation, Inc.,
 20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 21 */
 22
 23#ifndef LIBDVDNAV_VM_H
 24#define LIBDVDNAV_VM_H
 25
 26#include "remap.h"
 27#include "dvdnav_internal.h"
 28
 29/* DOMAIN enum */
 30
 31typedef enum {
 32  FP_DOMAIN   = 1,
 33  VTS_DOMAIN  = 2,
 34  VMGM_DOMAIN = 4,
 35  VTSM_DOMAIN = 8
 36} domain_t;  
 37
 38/**
 39 * State: SPRM, GPRM, Domain, pgc, pgN, cellN, ?
 40 */
 41typedef struct {
 42  registers_t registers;
 43  
 44  domain_t  domain;
 45  int       vtsN;         /* 0 is vmgm? */
 46  pgc_t    *pgc;          /* either this or 'int pgcN' is enough? */
 47  int       pgcN;         /* but provide pgcN for quick lookup */
 48  int       pgN;          /* is this needed? can allways fid pgN from cellN? */
 49  int       cellN;
 50  int32_t   cell_restart; /* get cell to restart */
 51  int       blockN;
 52  
 53  /* Resume info */
 54  int      rsm_vtsN;
 55  int      rsm_blockN;    /* of nav_packet */
 56  uint16_t rsm_regs[5];   /* system registers 4-8 */
 57  int      rsm_pgcN;
 58  int      rsm_cellN;
 59} dvd_state_t;
 60
 61typedef struct vm_position_s {
 62  int16_t  button;        /* Button highlighted */
 63  int32_t  vts;           /* vts number to use */
 64  domain_t domain;        /* domain to use */
 65  int32_t  spu_channel;   /* spu channel to use */
 66  int32_t  angle_channel; /* angle channel to use */
 67  int32_t  audio_channel; /* audio channel to use */
 68  int32_t  hop_channel;   /* channel hopping. E.g menu button pressed */
 69#if 0
 70  /* currently unused */
 71  int32_t  title;         /* title number */
 72  int32_t  chapter;       /* chapter number */
 73#endif
 74  int32_t  cell;          /* cell number */
 75  int32_t  cell_restart;  /* get cell to restart */
 76  int32_t  cell_start;    /* sector number of start of current cell in use */
 77  int32_t  still;         /* is cell still */
 78  int32_t  block;         /* block number within cell in use */
 79} vm_position_t;
 80
 81typedef struct {
 82  dvd_reader_t *dvd;
 83  ifo_handle_t *vmgi;
 84  ifo_handle_t *vtsi;
 85  dvd_state_t   state;
 86  int32_t       hop_channel;
 87  char          dvd_name[50];
 88  char          dvd_serial[15];
 89  remap_t      *map;
 90  int           stopped;
 91} vm_t;
 92
 93/* magic number for seeking hops */
 94#define HOP_SEEK 0x1000
 95
 96
 97/*  Audio stream number */
 98#define AST_REG      registers.SPRM[1]
 99/*  Subpicture stream number */
100#define SPST_REG     registers.SPRM[2]
101/*  Angle number */
102#define AGL_REG      registers.SPRM[3]
103/*  Title Track Number */
104#define TTN_REG      registers.SPRM[4]
105/*  VTS Title Track Number */
106#define VTS_TTN_REG  registers.SPRM[5]
107/*  PGC Number for this Title Track */
108#define TT_PGCN_REG  registers.SPRM[6]
109/*  Current Part of Title (PTT) number for (One_Sequential_PGC_Title) */
110#define PTTN_REG     registers.SPRM[7]
111/*  Highlighted Button Number (btn nr 1 == value 1024) */
112#define HL_BTNN_REG  registers.SPRM[8]
113/*  Parental Level */
114#define PTL_REG      registers.SPRM[13]
115
116/* Initialisation & destruction */
117vm_t *vm_new_vm(void);
118void  vm_free_vm(vm_t *vm);
119
120/* IFO access */
121ifo_handle_t *vm_get_vmgi(vm_t *vm);
122ifo_handle_t *vm_get_vtsi(vm_t *vm);
123
124/* Reader Access */
125dvd_reader_t *vm_get_dvd_reader(vm_t *vm);
126
127/* Basic Handling */
128int  vm_start(vm_t *vm);
129void vm_stop(vm_t *vm);
130int  vm_reset(vm_t *vm, const char *dvdroot);
131
132/* copying and merging  - useful for try-running an operation */
133vm_t *vm_new_copy(vm_t *vm);
134void  vm_merge(vm_t *target, vm_t *source);
135void  vm_free_copy(vm_t *vm);
136
137/* regular playback */
138void vm_position_get(vm_t *vm, vm_position_t *position);
139void vm_get_next_cell(vm_t *vm);
140
141/* Jumping - all these return 1, if a hop has been performed */
142int vm_jump_pg(vm_t *vm, int pg);
143int vm_jump_cell_block(vm_t *vm, int cell, int block);
144int vm_jump_title_part(vm_t *vm, int title, int part);
145int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn);
146int vm_jump_top_pg(vm_t *vm);
147int vm_jump_next_pg(vm_t *vm);
148int vm_jump_prev_pg(vm_t *vm);
149int vm_jump_up(vm_t *vm);
150int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid);
151int vm_jump_resume(vm_t *vm);
152int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd);
153
154/* getting information */
155int vm_get_current_menu(vm_t *vm, int *menuid);
156int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result);
157int vm_get_audio_stream(vm_t *vm, int audioN);
158int vm_get_subp_stream(vm_t *vm, int subpN, int mode);
159int vm_get_audio_active_stream(vm_t *vm);
160int vm_get_subp_active_stream(vm_t *vm, int mode);
161void vm_get_angle_info(vm_t *vm, int *current, int *num_avail);
162void vm_get_audio_info(vm_t *vm, int *current, int *num_avail);
163void vm_get_subp_info(vm_t *vm, int *current, int *num_avail);
164void vm_get_video_res(vm_t *vm, int *width, int *height);
165int  vm_get_video_aspect(vm_t *vm);
166int  vm_get_video_scale_permission(vm_t *vm);
167video_attr_t vm_get_video_attr(vm_t *vm);
168audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN);
169subp_attr_t  vm_get_subp_attr(vm_t *vm, int streamN);
170ifo_handle_t *vm_get_title_ifo(vm_t *vm, uint32_t title);
171void vm_ifo_close(ifo_handle_t *ifo);
172
173int vm_get_state(vm_t *vm, dvd_state_t *save_state);
174int vm_set_state(vm_t *vm, dvd_state_t *save_state);
175
176/* Uncomment for VM command tracing */
177/* #define TRACE */
178#ifdef TRACE
179/* Debug */
180void vm_position_print(vm_t *vm, vm_position_t *position);
181#endif
182
183/* XBMC added functions */
184vm_t* dvdnav_get_vm(dvdnav_t *self);
185
186#endif /* LIBDVDNAV_VM_H */