Commit a797b4a2 authored by Petri Hintukainen's avatar Petri Hintukainen

disc: do not use empty pseudo id

parent 49169d8d
Pipeline #4774 passed with stage
in 3 minutes and 28 seconds
...@@ -591,11 +591,6 @@ static char *_properties_file(BD_DISC *p) ...@@ -591,11 +591,6 @@ static char *_properties_file(BD_DISC *p)
char *cache_home; char *cache_home;
char *properties_file; char *properties_file;
cache_home = file_get_cache_home();
if (!cache_home) {
return NULL;
}
/* get disc ID */ /* get disc ID */
if (p->dec) { if (p->dec) {
id_type = 'A'; id_type = 'A';
...@@ -603,9 +598,18 @@ static char *_properties_file(BD_DISC *p) ...@@ -603,9 +598,18 @@ static char *_properties_file(BD_DISC *p)
} }
if (!disc_id) { if (!disc_id) {
id_type = 'P'; id_type = 'P';
disc_pseudo_id(p, pseudo_id); if (disc_pseudo_id(p, pseudo_id) > 0) {
disc_id = pseudo_id; disc_id = pseudo_id;
} }
}
if (!disc_id) {
return NULL;
}
cache_home = file_get_cache_home();
if (!cache_home) {
return NULL;
}
properties_file = str_printf("%s" DIR_SEP "bluray" DIR_SEP "properties" DIR_SEP "%c%s", properties_file = str_printf("%s" DIR_SEP "bluray" DIR_SEP "properties" DIR_SEP "%c%s",
cache_home, id_type, cache_home, id_type,
...@@ -784,16 +788,18 @@ static int _hash_file(BD_DISC *p, const char *dir, const char *file, void *hash) ...@@ -784,16 +788,18 @@ static int _hash_file(BD_DISC *p, const char *dir, const char *file, void *hash)
return sz > 16; return sz > 16;
} }
void disc_pseudo_id(BD_DISC *p, uint8_t *id/*[20]*/) int disc_pseudo_id(BD_DISC *p, uint8_t *id/*[20]*/)
{ {
uint8_t h[2][20]; uint8_t h[2][20];
int i; int i, r = 0;
memset(h, 0, sizeof(h)); memset(h, 0, sizeof(h));
_hash_file(p, "BDMV", "MovieObject.bdmv", h[0]); r += _hash_file(p, "BDMV", "MovieObject.bdmv", h[0]);
_hash_file(p, "BDMV", "index.bdmv", h[1]); r += _hash_file(p, "BDMV", "index.bdmv", h[1]);
for (i = 0; i < 20; i++) { for (i = 0; i < 20; i++) {
id[i] = h[0][i] ^ h[1][i]; id[i] = h[0][i] ^ h[1][i];
} }
return r > 0;
} }
...@@ -64,7 +64,7 @@ BD_PRIVATE const char *disc_root(BD_DISC *disc); ...@@ -64,7 +64,7 @@ BD_PRIVATE const char *disc_root(BD_DISC *disc);
BD_PRIVATE const char *disc_volume_id(BD_DISC *); BD_PRIVATE const char *disc_volume_id(BD_DISC *);
/* Generate pseudo disc ID */ /* Generate pseudo disc ID */
BD_PRIVATE void disc_pseudo_id(BD_DISC *, uint8_t *id/*[20]*/); BD_PRIVATE int disc_pseudo_id(BD_DISC *, uint8_t *id/*[20]*/);
/* Open VFS file (relative to disc root) */ /* Open VFS file (relative to disc root) */
BD_PRIVATE struct bd_file_s *disc_open_file(BD_DISC *disc, const char *dir, const char *file); BD_PRIVATE struct bd_file_s *disc_open_file(BD_DISC *disc, const char *dir, const char *file);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment