Mercurial > libdvdnav.hg
annotate vm/vm.h @ 438:04cb2d6e4f93 src tip
In vm_new_vm(), use the proper calloc() argument order
.. and don't derive 1 from the unrelated sizeof(char).
Fixes the scan-anaylzer "API violation" warning:
Result of 'calloc' is converted to a pointer of type 'vm_t', which is incompatible with sizeof operand type 'char'
Patch by Fabian Keil <fk AT fabiankeil DOT de>
| author | rathann |
|---|---|
| date | Wed, 04 Dec 2013 23:02:01 +0000 |
| parents | 9b8bfc56a7fe |
| children |
| rev | line source |
|---|---|
| 225 | 1 /* |
| 390 | 2 * Copyright (C) 2000, 2001 HÃ¥kan Hjort |
| 225 | 3 * Copyright (C) 2001 Rich Wareham <richwareham@users.sourceforge.net> |
| 388 | 4 * |
| 225 | 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. | |
| 388 | 7 * |
| 225 | 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. | |
| 388 | 12 * |
| 225 | 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. | |
| 388 | 17 * |
|
389
d3c273ced49c
Use consistent license headers everywhere: Fix wrong FSF address.
diego
parents:
388
diff
changeset
|
18 * You should have received a copy of the GNU General Public License along |
|
d3c273ced49c
Use consistent license headers everywhere: Fix wrong FSF address.
diego
parents:
388
diff
changeset
|
19 * with libdvdnav; if not, write to the Free Software Foundation, Inc., |
|
d3c273ced49c
Use consistent license headers everywhere: Fix wrong FSF address.
diego
parents:
388
diff
changeset
|
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 225 | 21 */ |
| 22 | |
| 391 | 23 #ifndef LIBDVDNAV_VM_H |
| 24 #define LIBDVDNAV_VM_H | |
| 225 | 25 |
| 26 /* DOMAIN enum */ | |
| 27 | |
| 28 typedef enum { | |
| 29 FP_DOMAIN = 1, | |
| 30 VTS_DOMAIN = 2, | |
| 31 VMGM_DOMAIN = 4, | |
| 32 VTSM_DOMAIN = 8 | |
| 388 | 33 } domain_t; |
| 225 | 34 |
| 35 /** | |
| 36 * State: SPRM, GPRM, Domain, pgc, pgN, cellN, ? | |
| 37 */ | |
| 38 typedef struct { | |
| 39 registers_t registers; | |
| 388 | 40 |
| 225 | 41 domain_t domain; |
| 42 int vtsN; /* 0 is vmgm? */ | |
| 43 pgc_t *pgc; /* either this or 'int pgcN' is enough? */ | |
| 44 int pgcN; /* but provide pgcN for quick lookup */ | |
| 45 int pgN; /* is this needed? can allways fid pgN from cellN? */ | |
| 46 int cellN; | |
| 47 int32_t cell_restart; /* get cell to restart */ | |
| 48 int blockN; | |
| 388 | 49 |
| 225 | 50 /* Resume info */ |
| 51 int rsm_vtsN; | |
| 52 int rsm_blockN; /* of nav_packet */ | |
| 53 uint16_t rsm_regs[5]; /* system registers 4-8 */ | |
| 54 int rsm_pgcN; | |
| 55 int rsm_cellN; | |
| 56 } dvd_state_t; | |
| 57 | |
| 58 typedef struct vm_position_s { | |
| 59 int16_t button; /* Button highlighted */ | |
| 60 int32_t vts; /* vts number to use */ | |
| 61 domain_t domain; /* domain to use */ | |
| 62 int32_t spu_channel; /* spu channel to use */ | |
| 63 int32_t angle_channel; /* angle channel to use */ | |
| 64 int32_t audio_channel; /* audio channel to use */ | |
| 65 int32_t hop_channel; /* channel hopping. E.g menu button pressed */ | |
| 66 #if 0 | |
| 67 /* currently unused */ | |
| 68 int32_t title; /* title number */ | |
| 69 int32_t chapter; /* chapter number */ | |
| 70 #endif | |
| 71 int32_t cell; /* cell number */ | |
| 72 int32_t cell_restart; /* get cell to restart */ | |
| 73 int32_t cell_start; /* sector number of start of current cell in use */ | |
| 74 int32_t still; /* is cell still */ | |
| 75 int32_t block; /* block number within cell in use */ | |
| 76 } vm_position_t; | |
| 77 | |
| 78 typedef struct { | |
| 79 dvd_reader_t *dvd; | |
| 80 ifo_handle_t *vmgi; | |
| 81 ifo_handle_t *vtsi; | |
| 82 dvd_state_t state; | |
| 83 int32_t hop_channel; | |
| 84 char dvd_name[50]; | |
|
397
a70f79850e5f
implement and export dvdnav_get_serial_string(); patch by Matthew Wire devel - mrwire - co - uk. Fixed by Erik
nicodvb
parents:
392
diff
changeset
|
85 char dvd_serial[15]; |
| 225 | 86 remap_t *map; |
| 87 int stopped; | |
| 88 } vm_t; | |
| 89 | |
| 90 /* magic number for seeking hops */ | |
| 91 #define HOP_SEEK 0x1000 | |
| 92 | |
| 93 | |
| 94 /* Audio stream number */ | |
| 95 #define AST_REG registers.SPRM[1] | |
| 96 /* Subpicture stream number */ | |
| 97 #define SPST_REG registers.SPRM[2] | |
| 98 /* Angle number */ | |
| 99 #define AGL_REG registers.SPRM[3] | |
| 100 /* Title Track Number */ | |
| 101 #define TTN_REG registers.SPRM[4] | |
| 102 /* VTS Title Track Number */ | |
| 103 #define VTS_TTN_REG registers.SPRM[5] | |
| 104 /* PGC Number for this Title Track */ | |
| 105 #define TT_PGCN_REG registers.SPRM[6] | |
| 106 /* Current Part of Title (PTT) number for (One_Sequential_PGC_Title) */ | |
| 107 #define PTTN_REG registers.SPRM[7] | |
| 108 /* Highlighted Button Number (btn nr 1 == value 1024) */ | |
| 109 #define HL_BTNN_REG registers.SPRM[8] | |
| 110 /* Parental Level */ | |
| 111 #define PTL_REG registers.SPRM[13] | |
| 112 | |
| 113 /* Initialisation & destruction */ | |
| 114 vm_t *vm_new_vm(void); | |
| 115 void vm_free_vm(vm_t *vm); | |
| 116 | |
| 117 /* IFO access */ | |
| 118 ifo_handle_t *vm_get_vmgi(vm_t *vm); | |
| 119 ifo_handle_t *vm_get_vtsi(vm_t *vm); | |
| 120 | |
| 121 /* Reader Access */ | |
| 122 dvd_reader_t *vm_get_dvd_reader(vm_t *vm); | |
| 123 | |
| 124 /* Basic Handling */ | |
|
256
6299ccea8a38
killing a lot of asserts and turning them into forced executions of Exit,
mroi
parents:
225
diff
changeset
|
125 int vm_start(vm_t *vm); |
| 225 | 126 void vm_stop(vm_t *vm); |
| 127 int vm_reset(vm_t *vm, const char *dvdroot); | |
| 128 | |
| 129 /* copying and merging - useful for try-running an operation */ | |
| 130 vm_t *vm_new_copy(vm_t *vm); | |
| 131 void vm_merge(vm_t *target, vm_t *source); | |
| 132 void vm_free_copy(vm_t *vm); | |
| 133 | |
| 134 /* regular playback */ | |
| 135 void vm_position_get(vm_t *vm, vm_position_t *position); | |
| 136 void vm_get_next_cell(vm_t *vm); | |
| 137 | |
| 138 /* Jumping - all these return 1, if a hop has been performed */ | |
| 139 int vm_jump_pg(vm_t *vm, int pg); | |
| 140 int vm_jump_cell_block(vm_t *vm, int cell, int block); | |
| 141 int vm_jump_title_part(vm_t *vm, int title, int part); | |
|
409
9b8bfc56a7fe
Add dvdnav_program_play & dvdnav_current_title_program
erik
parents:
401
diff
changeset
|
142 int vm_jump_title_program(vm_t *vm, int title, int pgcn, int pgn); |
| 225 | 143 int vm_jump_top_pg(vm_t *vm); |
| 144 int vm_jump_next_pg(vm_t *vm); | |
| 145 int vm_jump_prev_pg(vm_t *vm); | |
| 146 int vm_jump_up(vm_t *vm); | |
| 147 int vm_jump_menu(vm_t *vm, DVDMenuID_t menuid); | |
| 148 int vm_jump_resume(vm_t *vm); | |
| 149 int vm_exec_cmd(vm_t *vm, vm_cmd_t *cmd); | |
| 150 | |
| 151 /* getting information */ | |
| 152 int vm_get_current_menu(vm_t *vm, int *menuid); | |
| 153 int vm_get_current_title_part(vm_t *vm, int *title_result, int *part_result); | |
| 154 int vm_get_audio_stream(vm_t *vm, int audioN); | |
| 155 int vm_get_subp_stream(vm_t *vm, int subpN, int mode); | |
| 156 int vm_get_audio_active_stream(vm_t *vm); | |
| 157 int vm_get_subp_active_stream(vm_t *vm, int mode); | |
| 158 void vm_get_angle_info(vm_t *vm, int *current, int *num_avail); | |
| 159 #if 0 | |
| 160 /* currently unused */ | |
| 161 void vm_get_audio_info(vm_t *vm, int *current, int *num_avail); | |
| 162 void vm_get_subp_info(vm_t *vm, int *current, int *num_avail); | |
| 401 | 163 #endif |
| 225 | 164 void vm_get_video_res(vm_t *vm, int *width, int *height); |
| 165 int vm_get_video_aspect(vm_t *vm); | |
| 166 int vm_get_video_scale_permission(vm_t *vm); | |
| 167 video_attr_t vm_get_video_attr(vm_t *vm); | |
| 168 audio_attr_t vm_get_audio_attr(vm_t *vm, int streamN); | |
| 169 subp_attr_t vm_get_subp_attr(vm_t *vm, int streamN); | |
|
312
fdbfb58d2735
added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents:
285
diff
changeset
|
170 ifo_handle_t *vm_get_title_ifo(vm_t *vm, uint32_t title); |
|
fdbfb58d2735
added utility functions vm_get_title_ifo() and vm_ifo_close()
nicodvb
parents:
285
diff
changeset
|
171 void vm_ifo_close(ifo_handle_t *ifo); |
| 225 | 172 |
|
285
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
256
diff
changeset
|
173 /* Uncomment for VM command tracing */ |
|
52877d182e96
moved all header inclusions from .h to .c files; my word, I've never seen such a horrible entanglement as in this mess
nicodvb
parents:
256
diff
changeset
|
174 /* #define TRACE */ |
| 225 | 175 #ifdef TRACE |
| 176 /* Debug */ | |
| 177 void vm_position_print(vm_t *vm, vm_position_t *position); | |
| 178 #endif | |
| 179 | |
| 180 | |
| 391 | 181 #endif /* LIBDVDNAV_VM_H */ |
