Skip to content

Commit dbb32b3

Browse files
committed
copied from sunlubo#41
1 parent ba04b1f commit dbb32b3

91 files changed

Lines changed: 2043 additions & 23867 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Package.swift

Lines changed: 95 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,101 @@
1-
// swift-tools-version:5.1
1+
// swift-tools-version:5.3
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

66
let package = Package(
7-
name: "SwiftFFmpeg",
8-
products: [
9-
.library(
10-
name: "SwiftFFmpeg",
11-
targets: ["SwiftFFmpeg"]
12-
)
13-
],
14-
targets: [
15-
.target(
16-
name: "CFFmpeg",
17-
dependencies: [],
18-
linkerSettings: [
19-
LinkerSetting.unsafeFlags(["-Llibs/ffmpeg"])
20-
]
21-
),
22-
.target(
23-
name: "SwiftFFmpeg",
24-
dependencies: ["CFFmpeg"]
25-
),
26-
.target(
27-
name: "SwiftFFmpegExamples",
28-
dependencies: ["SwiftFFmpeg"],
29-
path: "Sources/Examples"
30-
),
31-
.testTarget(
32-
name: "SwiftFFmpegTests",
33-
dependencies: ["SwiftFFmpeg"]
34-
)
35-
]
7+
name: "SwiftFFmpeg",
8+
platforms: [.iOS(.v9), .macOS(.v10_10), .tvOS(.v10)],
9+
products: [
10+
.library(
11+
name: "SwiftFFmpeg",
12+
targets: ["SwiftFFmpeg"]
13+
)
14+
],
15+
targets: [
16+
.target(
17+
name: "SwiftFFmpeg",
18+
dependencies: ["CFFmpeg"]
19+
),
20+
.target(
21+
name: "CFFmpeg",
22+
dependencies: [
23+
"libavcodec",
24+
"libavdevice",
25+
"libavfilter",
26+
"libavformat",
27+
"libavutil",
28+
"libpostproc",
29+
"libswresample",
30+
"libswscale",
31+
],
32+
linkerSettings: [
33+
.linkedLibrary("z"),
34+
.linkedLibrary("bz2"),
35+
.linkedLibrary("iconv"),
36+
.linkedLibrary("lzma"),
37+
.linkedFramework("Security"),
38+
.linkedFramework("CoreMedia"),
39+
.linkedFramework("CoreVideo"),
40+
.linkedFramework("AudioToolbox"),
41+
.linkedFramework("VideoToolbox"),
42+
.linkedFramework("OpenGL"),
43+
.linkedFramework("CoreImage"),
44+
.linkedFramework("AppKit"),
45+
]
46+
),
47+
.binaryTarget(
48+
name: "libavcodec",
49+
url: "https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavcodec.zip?raw=true",
50+
checksum: "fd7134a138765bc9c80cc991e032a0229512c5bf0a18c151a9dcec4afa4fad0b"
51+
),
52+
.binaryTarget(
53+
name: "libavdevice",
54+
url:
55+
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavdevice.zip?raw=true",
56+
checksum: "91787692e329cdf60a80d96a42022bc9bd94b42e5c0ba79537313132886e9091"
57+
),
58+
.binaryTarget(
59+
name: "libavfilter",
60+
url:
61+
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavfilter.zip?raw=true",
62+
checksum: "8f87a588508ca40990905e0a6ce904ddc850ab2bc1069802f01e78a87fda8867"
63+
),
64+
.binaryTarget(
65+
name: "libavformat",
66+
url:
67+
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavformat.zip?raw=true",
68+
checksum: "d22e1ebb8c4f1ffc4975c9f3effabea6cde30ebd74dcd8fd1f55fca33d25c0b6"
69+
),
70+
.binaryTarget(
71+
name: "libavutil",
72+
url: "https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavutil.zip?raw=true",
73+
checksum: "46e9c2d1e78272ae349081c8a3f49a357224ef789a9fd954e4e6d3e662eeffd1"
74+
),
75+
.binaryTarget(
76+
name: "libpostproc",
77+
url:
78+
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libpostproc.zip?raw=true",
79+
checksum: "e1d3c5f4bef331a3bb0b57762b833faff851917733f42edbf25497983de037a9"
80+
),
81+
.binaryTarget(
82+
name: "libswresample",
83+
url:
84+
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libswresample.zip?raw=true",
85+
checksum: "b22f6e1754766dc9691755a9c17a800f63eb7299cba7649091bb26ad982b0c8c"
86+
),
87+
.binaryTarget(
88+
name: "libswscale",
89+
url: "https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libswscale.zip?raw=true",
90+
checksum: "a6b9201886e8aab5022b557cf0da2d8c5b1f085355d63f15665c4f48e9667a7b"
91+
),
92+
.target(
93+
name: "SwiftFFmpegExamples",
94+
dependencies: ["SwiftFFmpeg"]
95+
),
96+
.testTarget(
97+
name: "SwiftFFmpegTests",
98+
dependencies: ["SwiftFFmpeg"]
99+
),
100+
]
36101
)

Sources/CFFmpeg/README.md

Lines changed: 0 additions & 88 deletions
This file was deleted.

Sources/CFFmpeg/dummy.c

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
#pragma once
1+
#ifndef AVCODEC_SHIM_H
2+
#define AVCODEC_SHIM_H
3+
24
#include <libavcodec/avcodec.h>
5+
6+
#endif /* AVCODEC_SHIM_H */
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,6 @@
1-
#pragma once
1+
#ifndef AVDEVICE_SHIM_H
2+
#define AVDEVICE_SHIM_H
3+
24
#include <libavdevice/avdevice.h>
5+
6+
#endif /* AVDEVICE_SHIM_H */
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
#pragma once
1+
#ifndef AVFILTER_SHIM_H
2+
#define AVFILTER_SHIM_H
3+
24
#include <libavfilter/avfilter.h>
35
#include <libavfilter/buffersink.h>
46
#include <libavfilter/buffersrc.h>
7+
8+
#endif /* AVFILTER_SHIM_H */
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1-
#pragma once
1+
#ifndef AVFORMAT_SHIM_H
2+
#define AVFORMAT_SHIM_H
3+
24
#include <libavformat/avformat.h>
35
#include <libavformat/avio.h>
6+
7+
#endif /* AVFORMAT_SHIM_H */

Sources/CFFmpeg/include/avutil_shim.h

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#pragma once
1+
#ifndef AVUTIL_SHIM_H
2+
#define AVUTIL_SHIM_H
3+
24
#include <errno.h>
35
#include <stddef.h>
46
#include <libavutil/avutil.h>
@@ -48,11 +50,11 @@ static const uint64_t swift_AV_CH_LAYOUT_STEREO_DOWNMIX = AV_CH_LAYOUT_STEREO
4850

4951
/* error handling */
5052
static inline int swift_AVERROR(int errnum) {
51-
return AVERROR(errnum);
53+
return AVERROR(errnum);
5254
}
5355

5456
static inline int swift_AVUNERROR(int errnum) {
55-
return AVUNERROR(errnum);
57+
return AVUNERROR(errnum);
5658
}
5759

5860
static const int swift_AVERROR_BSF_NOT_FOUND = AVERROR_BSF_NOT_FOUND; ///< Bitstream filter not found
@@ -90,5 +92,7 @@ static const int swift_AVERROR_HTTP_OTHER_4XX = AVERROR_HTTP_OTHER_4XX;
9092
static const int swift_AVERROR_HTTP_SERVER_ERROR = AVERROR_HTTP_SERVER_ERROR;
9193

9294
static inline void swift_log(void *avcl, int level, const char *msg) {
93-
av_log(avcl, level, msg);
95+
av_log(avcl, level, msg);
9496
}
97+
98+
#endif /* AVUTIL_SHIM_H */

0 commit comments

Comments
 (0)