1
- From a399d951e3cbebc74d50e7541098bd7d69726270 Mon Sep 17 00:00:00 2001
1
+ From 78b23ccfadff2e4af94406663a54c9f0ea5f92ad Mon Sep 17 00:00:00 2001
2
2
From: qianlongxu <qianlongxu@gmail.com>
3
- Date: Mon, 30 Sep 2024 16:36:03 +0800
3
+ Date: Mon, 30 Sep 2024 18:09:41 +0800
4
4
Subject: [PATCH 22] public ff_is_bluray_video func
5
5
6
6
---
7
7
libavformat/Makefile | 1 +
8
- libavformat/bluray.c | 30 +++ +++++++++++++++++++++++++++
8
+ libavformat/bluray.c | 27 +++++++++++++++++++++++++++
9
9
libavformat/bluray_util.h | 27 +++++++++++++++++++++++++++
10
- 3 files changed, 58 insertions(+)
10
+ 3 files changed, 55 insertions(+)
11
11
create mode 100644 libavformat/bluray_util.h
12
12
13
13
diff --git a/libavformat/Makefile b/libavformat/Makefile
@@ -23,7 +23,7 @@ index 5abe34c..29c42ee 100644
23
23
OBJS = allformats.o \
24
24
avformat.o \
25
25
diff --git a/libavformat/bluray.c b/libavformat/bluray.c
26
- index 4b00c99..08649b6 100644
26
+ index 4b07fb1..edeceb5 100644
27
27
--- a/libavformat/bluray.c
28
28
+++ b/libavformat/bluray.c
29
29
@@ -28,6 +28,7 @@
@@ -32,31 +32,29 @@ index 4b00c99..08649b6 100644
32
32
#include "bluray_custom_fs.h"
33
33
+ #include "bluray_util.h"
34
34
35
- #define BLURAY_PROTO_PREFIX "bluray:"
35
+ #define BLURAY_PROTO_PREFIX "bluray:// "
36
36
#define MIN_PLAYLIST_LENGTH 180 /* 3 min */
37
- @@ -127,6 +128,35 @@ static void bluray_DebugHandler(const char *psz)
38
- }
39
- #endif
40
-
37
+ @@ -338,3 +339,29 @@ const URLProtocol ff_bluray_protocol = {
38
+ .priv_data_size = sizeof(BlurayContext),
39
+ .priv_data_class = &bluray_context_class,
40
+ };
41
+ +
41
42
+ int ff_is_bluray_video(const char *path, AVDictionary **options)
42
43
+ {
43
44
+ #ifdef DEBUG_BLURAY
44
45
+ bd_set_debug_mask(BLURAY_DEBUG_MASK);
45
46
+ bd_set_debug_handler(bluray_DebugHandler);
46
47
+ #endif
47
- + const char *diskname = path;
48
- +
49
- + av_strstart(path, BLURAY_PROTO_PREFIX, &diskname);
50
- +
48
+ +
51
49
+ fs_access *access = NULL;
52
50
+
53
- + if (av_strstart(diskname , "file://", NULL) || av_strstart(diskname , "/", NULL)) {
51
+ + if (av_strstart(path , "file://", NULL) || av_strstart(path , "/", NULL)) {
54
52
+ access = NULL;
55
53
+ } else {
56
- + access = create_bluray_custom_access(diskname , options);
54
+ + access = create_bluray_custom_access(path , options);
57
55
+ }
58
56
+
59
- + BLURAY *bd = bd_open_fs(diskname , NULL, access);
57
+ + BLURAY *bd = bd_open_fs(path , NULL, access);
60
58
+ if (!bd) {
61
59
+ destroy_bluray_custom_access(&access);
62
60
+ av_log(NULL, AV_LOG_ERROR, "bd_open() failed\n");
@@ -66,10 +64,6 @@ index 4b00c99..08649b6 100644
66
64
+ destroy_bluray_custom_access(&access);
67
65
+ return 1;
68
66
+ }
69
- +
70
- static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options)
71
- {
72
- #ifdef DEBUG_BLURAY
73
67
diff --git a/libavformat/bluray_util.h b/libavformat/bluray_util.h
74
68
new file mode 100644
75
69
index 0000000..62301b2
0 commit comments