Skip to content

Commit

Permalink
copied from sunlubo#41
Browse files Browse the repository at this point in the history
  • Loading branch information
thieso2 committed Aug 19, 2020
1 parent ba04b1f commit dbb32b3
Show file tree
Hide file tree
Showing 91 changed files with 2,043 additions and 23,867 deletions.
125 changes: 95 additions & 30 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,36 +1,101 @@
// swift-tools-version:5.1
// swift-tools-version:5.3
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "SwiftFFmpeg",
products: [
.library(
name: "SwiftFFmpeg",
targets: ["SwiftFFmpeg"]
)
],
targets: [
.target(
name: "CFFmpeg",
dependencies: [],
linkerSettings: [
LinkerSetting.unsafeFlags(["-Llibs/ffmpeg"])
]
),
.target(
name: "SwiftFFmpeg",
dependencies: ["CFFmpeg"]
),
.target(
name: "SwiftFFmpegExamples",
dependencies: ["SwiftFFmpeg"],
path: "Sources/Examples"
),
.testTarget(
name: "SwiftFFmpegTests",
dependencies: ["SwiftFFmpeg"]
)
]
name: "SwiftFFmpeg",
platforms: [.iOS(.v9), .macOS(.v10_10), .tvOS(.v10)],
products: [
.library(
name: "SwiftFFmpeg",
targets: ["SwiftFFmpeg"]
)
],
targets: [
.target(
name: "SwiftFFmpeg",
dependencies: ["CFFmpeg"]
),
.target(
name: "CFFmpeg",
dependencies: [
"libavcodec",
"libavdevice",
"libavfilter",
"libavformat",
"libavutil",
"libpostproc",
"libswresample",
"libswscale",
],
linkerSettings: [
.linkedLibrary("z"),
.linkedLibrary("bz2"),
.linkedLibrary("iconv"),
.linkedLibrary("lzma"),
.linkedFramework("Security"),
.linkedFramework("CoreMedia"),
.linkedFramework("CoreVideo"),
.linkedFramework("AudioToolbox"),
.linkedFramework("VideoToolbox"),
.linkedFramework("OpenGL"),
.linkedFramework("CoreImage"),
.linkedFramework("AppKit"),
]
),
.binaryTarget(
name: "libavcodec",
url: "https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavcodec.zip?raw=true",
checksum: "fd7134a138765bc9c80cc991e032a0229512c5bf0a18c151a9dcec4afa4fad0b"
),
.binaryTarget(
name: "libavdevice",
url:
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavdevice.zip?raw=true",
checksum: "91787692e329cdf60a80d96a42022bc9bd94b42e5c0ba79537313132886e9091"
),
.binaryTarget(
name: "libavfilter",
url:
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavfilter.zip?raw=true",
checksum: "8f87a588508ca40990905e0a6ce904ddc850ab2bc1069802f01e78a87fda8867"
),
.binaryTarget(
name: "libavformat",
url:
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavformat.zip?raw=true",
checksum: "d22e1ebb8c4f1ffc4975c9f3effabea6cde30ebd74dcd8fd1f55fca33d25c0b6"
),
.binaryTarget(
name: "libavutil",
url: "https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libavutil.zip?raw=true",
checksum: "46e9c2d1e78272ae349081c8a3f49a357224ef789a9fd954e4e6d3e662eeffd1"
),
.binaryTarget(
name: "libpostproc",
url:
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libpostproc.zip?raw=true",
checksum: "e1d3c5f4bef331a3bb0b57762b833faff851917733f42edbf25497983de037a9"
),
.binaryTarget(
name: "libswresample",
url:
"https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libswresample.zip?raw=true",
checksum: "b22f6e1754766dc9691755a9c17a800f63eb7299cba7649091bb26ad982b0c8c"
),
.binaryTarget(
name: "libswscale",
url: "https://github.com/sunlubo/SwiftFFmpeg/blob/master/xcframework/libswscale.zip?raw=true",
checksum: "a6b9201886e8aab5022b557cf0da2d8c5b1f085355d63f15665c4f48e9667a7b"
),
.target(
name: "SwiftFFmpegExamples",
dependencies: ["SwiftFFmpeg"]
),
.testTarget(
name: "SwiftFFmpegTests",
dependencies: ["SwiftFFmpeg"]
),
]
)
88 changes: 0 additions & 88 deletions Sources/CFFmpeg/README.md

This file was deleted.

1 change: 0 additions & 1 deletion Sources/CFFmpeg/dummy.c

This file was deleted.

6 changes: 5 additions & 1 deletion Sources/CFFmpeg/include/avcodec_shim.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#pragma once
#ifndef AVCODEC_SHIM_H
#define AVCODEC_SHIM_H

#include <libavcodec/avcodec.h>

#endif /* AVCODEC_SHIM_H */
6 changes: 5 additions & 1 deletion Sources/CFFmpeg/include/avdevice_shim.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
#pragma once
#ifndef AVDEVICE_SHIM_H
#define AVDEVICE_SHIM_H

#include <libavdevice/avdevice.h>

#endif /* AVDEVICE_SHIM_H */
6 changes: 5 additions & 1 deletion Sources/CFFmpeg/include/avfilter_shim.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
#pragma once
#ifndef AVFILTER_SHIM_H
#define AVFILTER_SHIM_H

#include <libavfilter/avfilter.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>

#endif /* AVFILTER_SHIM_H */
6 changes: 5 additions & 1 deletion Sources/CFFmpeg/include/avformat_shim.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#pragma once
#ifndef AVFORMAT_SHIM_H
#define AVFORMAT_SHIM_H

#include <libavformat/avformat.h>
#include <libavformat/avio.h>

#endif /* AVFORMAT_SHIM_H */
12 changes: 8 additions & 4 deletions Sources/CFFmpeg/include/avutil_shim.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#pragma once
#ifndef AVUTIL_SHIM_H
#define AVUTIL_SHIM_H

#include <errno.h>
#include <stddef.h>
#include <libavutil/avutil.h>
Expand Down Expand Up @@ -48,11 +50,11 @@ static const uint64_t swift_AV_CH_LAYOUT_STEREO_DOWNMIX = AV_CH_LAYOUT_STEREO

/* error handling */
static inline int swift_AVERROR(int errnum) {
return AVERROR(errnum);
return AVERROR(errnum);
}

static inline int swift_AVUNERROR(int errnum) {
return AVUNERROR(errnum);
return AVUNERROR(errnum);
}

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

static inline void swift_log(void *avcl, int level, const char *msg) {
av_log(avcl, level, msg);
av_log(avcl, level, msg);
}

#endif /* AVUTIL_SHIM_H */
Loading

0 comments on commit dbb32b3

Please sign in to comment.