[libbluray-devel] [Git][videolan/libbluray][master] 2 commits: Split disc_open_stream()
Petri Hintukainen (@hpi)
gitlab at videolan.org
Sun Dec 21 16:34:12 UTC 2025
Petri Hintukainen pushed to branch master at VideoLAN / libbluray
Commits:
5eb9a151 by Petri Hintukainen at 2025-12-21T01:20:36+02:00
Split disc_open_stream()
- - - - -
68d40fb5 by Petri Hintukainen at 2025-12-21T18:28:44+02:00
Detect .ssif files in bd_open_file_dec()
Fixes #44.
- - - - -
1 changed file:
- src/libbluray/disc/disc.c
Changes:
=====================================
src/libbluray/disc/disc.c
=====================================
@@ -592,26 +592,6 @@ int disc_cache_bdrom_file(BD_DISC *p, const char *rel_path, const char *cache_pa
return 0;
}
-BD_FILE_H *disc_open_path_dec(BD_DISC *p, const char *rel_path)
-{
- size_t size = strlen(rel_path);
- const char *suf = (size > 5) ? rel_path + (size - 5) : rel_path;
-
- /* check if it's a stream */
- if (strncmp(rel_path, "BDMV" DIR_SEP "STREAM", 11)) { // not equal
- return disc_open_path(p, rel_path);
- } else if (!strcmp(suf, ".m2ts")) { // equal
- return disc_open_stream(p, suf - 5);
- } else if (!strcmp(suf+1, ".MTS")) { // equal
- return disc_open_stream(p, suf - 4);
- } else if (!strcmp(suf, ".ssif")) { // equal
- BD_DEBUG(DBG_FILE | DBG_CRIT, "error opening file %s, ssif is not yet supported.\n", rel_path);
- } else {
- BD_DEBUG(DBG_FILE | DBG_CRIT, "error opening file %s\n", rel_path);
- }
- return NULL;
-}
-
/*
* persistent properties storage
*/
@@ -698,23 +678,55 @@ char *disc_property_get(BD_DISC *p, const char *property)
* streams
*/
+static BD_FILE_H *_open_stream(BD_DISC *disc, BD_FILE_H *fp, const char *file)
+{
+ if (disc->dec) {
+ BD_FILE_H *st = dec_open_stream(disc->dec, fp, atoi(file));
+ if (st) {
+ return st;
+ }
+ }
+
+ return fp;
+}
+
BD_FILE_H *disc_open_stream(BD_DISC *disc, const char *file)
{
BD_FILE_H *fp = disc_open_file(disc, "BDMV" DIR_SEP "STREAM", file);
+
+ return fp ? _open_stream(disc, fp, file) : fp;
+}
+
+BD_FILE_H *disc_open_path_dec(BD_DISC *p, const char *rel_path)
+{
+ BD_FILE_H *fp = disc_open_path(p, rel_path);
if (!fp) {
return NULL;
}
- if (disc->dec) {
- BD_FILE_H *st = dec_open_stream(disc->dec, fp, atoi(file));
- if (st) {
- return st;
+ for (; *rel_path == DIR_SEP_CHAR; rel_path++) ;
+
+ /* check if it's a stream */
+ if (!strncmp(rel_path, "BDMV" DIR_SEP "STREAM", 11)) {
+ const char *suf = rel_path + (strlen(rel_path) - 5);
+ if (!strcmp(suf, ".m2ts")) { // equal
+ fp = _open_stream(p, fp, suf - 5);
+ } else if (!strcmp(suf+1, ".MTS")) { // equal
+ fp = _open_stream(p, fp, suf - 4);
+ } else if (!strcmp(suf, ".ssif")) { // equal
+ fp = _open_stream(p, fp, suf - 5);
+ } else {
+ BD_DEBUG(DBG_FILE | DBG_CRIT, "unsupported stream file extension in %s\n", rel_path);
}
}
return fp;
}
+/*
+ *
+ */
+
const uint8_t *disc_get_data(BD_DISC *disc, int type)
{
if (disc->dec) {
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/6bfbde531531616ce0903372c9de03be0f9c8eee...68d40fb57db837d41f0f1b7a8e7cb3c23a7ba9b1
--
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/6bfbde531531616ce0903372c9de03be0f9c8eee...68d40fb57db837d41f0f1b7a8e7cb3c23a7ba9b1
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the libbluray-devel
mailing list