Skip to content

Commit b07ed58

Browse files
committed
public ff_is_bluray_video func
1 parent e2633cf commit b07ed58

File tree

1 file changed

+109
-0
lines changed

1 file changed

+109
-0
lines changed
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
From a399d951e3cbebc74d50e7541098bd7d69726270 Mon Sep 17 00:00:00 2001
2+
From: qianlongxu <qianlongxu@gmail.com>
3+
Date: Mon, 30 Sep 2024 16:36:03 +0800
4+
Subject: [PATCH 22] public ff_is_bluray_video func
5+
6+
---
7+
libavformat/Makefile | 1 +
8+
libavformat/bluray.c | 30 ++++++++++++++++++++++++++++++
9+
libavformat/bluray_util.h | 27 +++++++++++++++++++++++++++
10+
3 files changed, 58 insertions(+)
11+
create mode 100644 libavformat/bluray_util.h
12+
13+
diff --git a/libavformat/Makefile b/libavformat/Makefile
14+
index 5abe34c..29c42ee 100644
15+
--- a/libavformat/Makefile
16+
+++ b/libavformat/Makefile
17+
@@ -13,6 +13,7 @@ HEADERS = avformat.h \
18+
id3v2.h \
19+
os_support.h \
20+
metadata.h \
21+
+ bluray_util.h
22+
23+
OBJS = allformats.o \
24+
avformat.o \
25+
diff --git a/libavformat/bluray.c b/libavformat/bluray.c
26+
index 4b00c99..08649b6 100644
27+
--- a/libavformat/bluray.c
28+
+++ b/libavformat/bluray.c
29+
@@ -28,6 +28,7 @@
30+
#include "libavutil/dict.h"
31+
#include "libavformat/avformat.h"
32+
#include "bluray_custom_fs.h"
33+
+#include "bluray_util.h"
34+
35+
#define BLURAY_PROTO_PREFIX "bluray:"
36+
#define MIN_PLAYLIST_LENGTH 180 /* 3 min */
37+
@@ -127,6 +128,35 @@ static void bluray_DebugHandler(const char *psz)
38+
}
39+
#endif
40+
41+
+int ff_is_bluray_video(const char *path, AVDictionary **options)
42+
+{
43+
+#ifdef DEBUG_BLURAY
44+
+ bd_set_debug_mask(BLURAY_DEBUG_MASK);
45+
+ bd_set_debug_handler(bluray_DebugHandler);
46+
+#endif
47+
+ const char *diskname = path;
48+
+
49+
+ av_strstart(path, BLURAY_PROTO_PREFIX, &diskname);
50+
+
51+
+ fs_access *access = NULL;
52+
+
53+
+ if (av_strstart(diskname, "file://", NULL) || av_strstart(diskname, "/", NULL)) {
54+
+ access = NULL;
55+
+ } else {
56+
+ access = create_bluray_custom_access(diskname, options);
57+
+ }
58+
+
59+
+ BLURAY *bd = bd_open_fs(diskname, NULL, access);
60+
+ if (!bd) {
61+
+ destroy_bluray_custom_access(&access);
62+
+ av_log(NULL, AV_LOG_ERROR, "bd_open() failed\n");
63+
+ return 0;
64+
+ }
65+
+ bd_close(bd);
66+
+ destroy_bluray_custom_access(&access);
67+
+ return 1;
68+
+}
69+
+
70+
static int bluray_open(URLContext *h, const char *path, int flags, AVDictionary **options)
71+
{
72+
#ifdef DEBUG_BLURAY
73+
diff --git a/libavformat/bluray_util.h b/libavformat/bluray_util.h
74+
new file mode 100644
75+
index 0000000..62301b2
76+
--- /dev/null
77+
+++ b/libavformat/bluray_util.h
78+
@@ -0,0 +1,27 @@
79+
+//
80+
+// bluray_custom_fs.h
81+
+//
82+
+// Created by Reach Matt on 2024/9/13.
83+
+//
84+
+//
85+
+// Copyright (C) 2021 Matt Reach<qianlongxu@gmail.com>//
86+
+// Licensed under the Apache License, Version 2.0 (the "License");
87+
+// you may not use this file except in compliance with the License.
88+
+// You may obtain a copy of the License at
89+
+//
90+
+// http://www.apache.org/licenses/LICENSE-2.0
91+
+//
92+
+// Unless required by applicable law or agreed to in writing, software
93+
+// distributed under the License is distributed on an "AS IS" BASIS,
94+
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
95+
+// See the License for the specific language governing permissions and
96+
+// limitations under the License.
97+
+
98+
+#ifndef bluray_util_h
99+
+#define bluray_util_h
100+
+
101+
+typedef struct AVDictionary AVDictionary;
102+
+
103+
+int ff_is_bluray_video(const char *path, AVDictionary **options);
104+
+
105+
+#endif
106+
\ No newline at end of file
107+
--
108+
2.39.3 (Apple Git-146)
109+

0 commit comments

Comments
 (0)