1 /*
2  * This file is part of libbdplus
3  * Copyright (C) 2008-2010  Accident
4  * Copyright (C) 2013       VideoLAN
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library. If not, see
18  * <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef BDPLUS_DATA_H_INCLUDED
22 #define BDPLUS_DATA_H_INCLUDED
23 
24 #include "util/attributes.h"
25 #include "util/mutex.h"
26 
27 #include "internal.h"
28 
29 #include "bdsvm/slot_data.h"
30 
31 #include <stdint.h>
32 
33 /*
34  *
35  */
36 
37 struct conv_table_s;
38 struct bdplus_config_s;
39 struct VM_s;
40 
41 struct bdplus_s {
42     char *device_path;
43 
44     struct VM_s *vm;
45 
46     slot_t   slots[BDPLUS_NUM_SLOTS];
47     uint32_t attached_slot;
48     uint32_t free_slot;
49     uint8_t  attachedStatus[2];
50 
51     uint8_t  volumeID[BLURAY_VOLUMEID_LEN]; // This should probably be moved out,API?
52     uint8_t  mediaKey[BLURAY_VOLUMEID_LEN]; // This should probably be moved out,API?
53 
54     struct conv_table_s *conv_tab;
55 
56     struct bdplus_config_s *config;
57 
58     BD_MUTEX *mutex;
59 
60     uint8_t   loaded;
61     uint8_t   started;
62 
63     /* BD+ content code version */
64     int gen;
65     int date;
66 };
67 
68 
69 BD_PRIVATE int      crypto_init( void );
70 
71 BD_PRIVATE int32_t  bdplus_load_svm   ( bdplus_t *plus, const char *fname );
72 BD_PRIVATE int32_t  bdplus_load_slots ( bdplus_t *plus, const char *fname );
73 BD_PRIVATE int32_t  bdplus_save_slots ( bdplus_t *plus, const char *fname );
74 
75 BD_PRIVATE int32_t  bdplus_run_init   ( struct VM_s *vm );
76 BD_PRIVATE int32_t  bdplus_run_idle   ( struct VM_s *vm );
77 BD_PRIVATE int32_t  bdplus_run_convtab( bdplus_t *plus, uint32_t num_titles );
78 BD_PRIVATE int32_t  bdplus_run_title  ( bdplus_t *plus, uint32_t title );
79 BD_PRIVATE int32_t  bdplus_run_m2ts   ( bdplus_t *plus, uint32_t m2ts );
80 BD_PRIVATE int32_t  bdplus_run_shutdown(bdplus_t *plus );
81 
82 BD_PRIVATE int32_t  bdplus_run_event210(struct VM_s *vm, uint32_t param);
83 
84 #endif
85