Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify the compilation error, add ffavc for android #139

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
514 changes: 513 additions & 1 deletion LICENSE.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,18 @@ buildscript {
junitVersion="4.12"
}
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}

google()
mavenCentral()
mavenLocal()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.4.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.github.kezong:fat-aar:1.3.7'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -22,6 +27,10 @@ buildscript {

allprojects {
repositories {
flatDir {
dirs 'libs'
}

google()
mavenCentral()
}
Expand Down
72 changes: 68 additions & 4 deletions android/libpag/build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
apply plugin: 'com.android.library'
apply plugin: 'maven-publish'
apply plugin: 'com.github.panpf.bintray-publish'
apply plugin: 'signing'
apply plugin: 'com.kezong.fat-aar'

version = '4.0.0.0'
project.ext.artifactId = 'libpag'
Expand All @@ -22,7 +24,7 @@ android {
externalNativeBuild {
cmake {
arguments "-DANDROID_STL=c++_static",
"-DPAG_USE_LIBAVC=ON"
"-DPAG_USE_LIBAVC=OFF"
}
}

Expand All @@ -47,20 +49,82 @@ android {

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
embed(name: 'ffavc', ext: 'aar')
androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
exclude group: 'com.android.support', module: 'support-annotations'
})
testImplementation 'junit:junit:4.12'
}

// 发布到Jcenter配置
task androidSourcesJar(type: Jar) {
archiveClassifier.set("sources")
from android.sourceSets.main.java.source
exclude "**/R.class"
exclude "**/BuildConfig.class"
}

publish {
userOrg = 'libpag'
groupId = 'com.tencent.tav'
artifactId = 'libpag'
publishVersion = project.version
desc = ' '
website = 'https://github.com/libpag/libpag.github.io'
desc = 'A real-time rendering library for PAG (Portable Animated Graphics) files that renders After Effects animations natively across multiple platforms.'
website = 'https://github.com/Tencent/libpag'
}

publishing {
publications {
mavenAar(MavenPublication) {
// group id,发布后引用的依赖的 group id
groupId 'com.tencent.tav'
// 发布后引用的依赖的 artifact id
artifactId 'libpag'
println version
// 发布的 arr 的文件和源码文件
artifact("$buildDir/outputs/aar/libpag-release.aar")
artifact androidSourcesJar
pom {
// 构件名称,可以自定义
name = 'libpag'
// 构件描述
description = 'A real-time rendering library for PAG (Portable Animated Graphics) files that renders After Effects animations natively across multiple platforms.'
// 构件主页
url = 'https://github.com/Tencent/libpag'
// 许可证名称和地址
licenses {
license {
name = 'The Apache License, Version 2.0'
url = 'https://github.com/Tencent/libpag/blob/main/LICENSE.txt'
}
}
// 开发者信息
developers {
developer {
name = 'libpag'
email = '[email protected]'
}
}
// 版本控制仓库地址
scm {
url = 'https://github.com/Tencent/libpag'
connection = 'scm:git:github.com/Tencent/libpag.git'
developerConnection = 'scm:git:ssh://[email protected]/Tencent/libpag.git'
}
}
}
}
repositories {
maven {
// 发布的位置,这里根据发布的版本区分了 SNAPSHOT 和最终版本两种情况
def releasesRepoUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
def snapshotsRepoUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
url = version.endsWith('SNAPSHOT') ? snapshotsRepoUrl : releasesRepoUrl
}
}
}

signing {
sign publishing.publications
}

project.afterEvaluate {
Expand Down
Binary file added android/libpag/libs/ffavc.aar
Binary file not shown.
2 changes: 2 additions & 0 deletions android/libpag/src/main/java/org/libpag/PAGSurface.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import android.view.Surface;

import org.extra.tools.LibraryLoadUtils;
import org.ffavc.DecoderFactory;

public class PAGSurface {
public static PAGSurface FromSurfaceTexture(SurfaceTexture surfaceTexture) {
Expand Down Expand Up @@ -177,6 +178,7 @@ protected void finalize() {
static {
LibraryLoadUtils.loadLibrary("pag");
nativeInit();
VideoDecoder.RegisterSoftwareDecoderFactory(DecoderFactory.GetHandle());
}

long nativeSurface = 0;
Expand Down
3 changes: 2 additions & 1 deletion libpag.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ Pod::Spec.new do |s|
s.ios.frameworks = ['UIKit', 'CoreFoundation', 'QuartzCore', 'CoreGraphics', 'CoreText', 'OpenGLES', 'VideoToolbox', 'CoreMedia']
s.ios.libraries = ["iconv"]

armv7CFlags = commonCFlags + ["-fno-aligned-allocation"]
s.xcconfig = {'CLANG_CXX_LANGUAGE_STANDARD' => 'c++17','CLANG_CXX_LIBRARY' => 'libc++',"HEADER_SEARCH_PATHS" => "#{PAG_ROOT}/src #{PAG_ROOT}/include #{PAG_ROOT}/tgfx/src #{PAG_ROOT}/tgfx/include #{PAG_ROOT}/third_party/pathkit #{PAG_ROOT}/third_party/skcms #{PAG_ROOT}/third_party/freetype/include #{PAG_ROOT}/third_party/libwebp/src #{PAG_ROOT}/third_party/libavc/common #{PAG_ROOT}/third_party/libavc/decoder"}
s.ios.xcconfig = {"OTHER_CFLAGS" => commonCFlags.join(" "),"EXPORTED_SYMBOLS_FILE" => "${PODS_ROOT}/../libpag.lds","OTHER_LDFLAGS" => "-w","VALIDATE_WORKSPACE_SKIPPED_SDK_FRAMEWORKS" => "OpenGLES"}
s.ios.xcconfig = {"OTHER_CFLAGS" => commonCFlags.join(" "),"OTHER_CFLAGS[sdk=iphoneos*][arch=armv7]" => armv7CFlags.join(" "),"EXPORTED_SYMBOLS_FILE" => "${PODS_ROOT}/../libpag.lds","OTHER_LDFLAGS" => "-w","VALIDATE_WORKSPACE_SKIPPED_SDK_FRAMEWORKS" => "OpenGLES"}
s.osx.xcconfig = {"OTHER_CFLAGS" => commonCFlags.join(" ")}
s.ios.vendored_frameworks = 'ios/Pods/pag-vendor/libpag-vendor.xcframework'
s.osx.vendored_frameworks = 'mac/Pods/pag-vendor/libpag-vendor.xcframework'
Expand Down