Skip to content

Commit 14c54aa

Browse files
committed
improve: sketch-video and sketch-video-ffmpeg module supports automatic registration
1 parent 2aa0f2e commit 14c54aa

File tree

13 files changed

+103
-3
lines changed

13 files changed

+103
-3
lines changed

settings.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ include(":sketch-http-okhttp")
3131
include(":sketch-singleton")
3232
include(":sketch-svg")
3333
include(":sketch-video")
34+
include(":sketch-video-core")
3435
include(":sketch-video-ffmpeg")
3536
include(":sketch-view")
3637
include(":sketch-view-core")

sketch-video-core/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
id("com.android.library")
3+
id("org.jetbrains.kotlin.android")
4+
}
5+
6+
androidLibrary(nameSpace = "com.github.panpf.sketch.video.core")
7+
8+
dependencies {
9+
api(projects.sketchCore)
10+
11+
androidTestImplementation(projects.internal.test)
12+
androidTestImplementation(projects.internal.testSingleton)
13+
}

sketch-video-core/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
POM_ARTIFACT_ID=sketch-video-core

sketch-video-ffmpeg/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ plugins {
66
androidLibrary(nameSpace = "com.github.panpf.sketch.video.ffmpeg")
77

88
dependencies {
9-
api(projects.sketchCore)
10-
api(projects.sketchVideo)
9+
api(projects.sketchVideoCore)
1110
api(libs.ffmpegMediaMetadataRetriever.core)
1211
api(libs.ffmpegMediaMetadataRetriever.native)
1312

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package com.github.panpf.sketch.video.ffmpeg.test.decode.internal
2+
3+
class FFmpegVideoFrameDecoderComponentTest {
4+
// TODO test
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/*
2+
* Copyright (C) 2024 panpf <[email protected]>
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.github.panpf.sketch.decode.internal
18+
19+
import androidx.annotation.Keep
20+
import com.github.panpf.sketch.PlatformContext
21+
import com.github.panpf.sketch.decode.Decoder
22+
import com.github.panpf.sketch.decode.FFmpegVideoFrameDecoder
23+
import com.github.panpf.sketch.util.ComponentDetector
24+
import com.github.panpf.sketch.util.DecoderComponent
25+
26+
/**
27+
* Cooperate with [ComponentDetector] to achieve automatic registration [FFmpegVideoFrameDecoder]
28+
*
29+
* @see com.github.panpf.sketch.video.ffmpeg.test.decode.internal.FFmpegVideoFrameDecoderComponentTest
30+
*/
31+
@Keep
32+
class FFmpegVideoFrameDecoderComponent : DecoderComponent {
33+
34+
override fun factory(context: PlatformContext): Decoder.Factory {
35+
return FFmpegVideoFrameDecoder.Factory()
36+
}
37+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
com.github.panpf.sketch.decode.internal.FFmpegVideoFrameDecoderComponent

sketch-video/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
androidLibrary(nameSpace = "com.github.panpf.sketch.video")
77

88
dependencies {
9-
api(projects.sketchCore)
9+
api(projects.sketchVideoCore)
1010

1111
androidTestImplementation(projects.internal.test)
1212
androidTestImplementation(projects.internal.testSingleton)

0 commit comments

Comments
 (0)