Skip to content

Commit 5d52401

Browse files
committed
wip
1 parent 04a975c commit 5d52401

File tree

3 files changed

+16
-16
lines changed

3 files changed

+16
-16
lines changed

android-ffmpeg-transcoder/src/main/java/net/kibotu/androidffmpegtranscoder/mcvideoeditor/MediaCodecExtractImages.kt

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,14 +95,14 @@ class MediaCodecExtractImages {
9595
}
9696

9797
extractor = MediaExtractor()
98-
extractor!!.setDataSource(inputFile.toString())
99-
val trackIndex = selectTrack(extractor!!)
98+
extractor.setDataSource(inputFile.toString())
99+
val trackIndex = selectTrack(extractor)
100100
if (trackIndex < 0) {
101101
emitter.onError(RuntimeException("No video track found in $inputFile"))
102102
}
103-
extractor!!.selectTrack(trackIndex)
103+
extractor.selectTrack(trackIndex)
104104

105-
val format = extractor!!.getTrackFormat(trackIndex)
105+
val format = extractor.getTrackFormat(trackIndex)
106106

107107
saveWidth = format.getInteger(MediaFormat.KEY_WIDTH)
108108
saveHeight = format.getInteger(MediaFormat.KEY_HEIGHT)
@@ -135,14 +135,14 @@ class MediaCodecExtractImages {
135135
// it contains a copy of the CSD-0/CSD-1 codec-specific data chunks.
136136
val mime = format.getString(MediaFormat.KEY_MIME)
137137
decoder = MediaCodec.createDecoderByType(mime!!)
138-
decoder?.configure(format, outputSurface!!.surface, null, 0)
139-
decoder?.start()
138+
decoder.configure(format, outputSurface.surface, null, 0)
139+
decoder.start()
140140

141141
doExtract(
142-
extractor!!,
142+
extractor,
143143
trackIndex,
144-
decoder!!,
145-
outputSurface!!,
144+
decoder,
145+
outputSurface,
146146
desiredFrames,
147147
outputPath,
148148
photoQuality,

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
<activity
1414
android:name=".FFmpegActivity"
1515
android:exported="true">
16-
<intent-filter>
17-
<action android:name="android.intent.action.MAIN" />
18-
19-
<category android:name="android.intent.category.LAUNCHER" />
20-
</intent-filter>
2116
</activity>
2217

2318
<activity
2419
android:name=".DemoActivity"
2520
android:exported="true">
21+
<intent-filter>
22+
<action android:name="android.intent.action.MAIN" />
23+
24+
<category android:name="android.intent.category.LAUNCHER" />
25+
</intent-filter>
2626
</activity>
2727

2828
</application>

app/src/main/java/net/kibotu/androidffmpegtranscoder/demo/DemoActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ class DemoActivity : FragmentActivity() {
2525
binding = ActivityDemoBinding.inflate(layoutInflater)
2626
setContentView(binding.root)
2727

28-
val frameFolder = "transcoding/process/".parseInternalStorageFile(this)
29-
val inputVideo = "example/source_video.mp4".parseInternalStorageFile(this)
28+
val frameFolder = "transcoding/process".parseInternalStorageFile(this)
29+
val inputVideo = "transcoding/input/source_video.mp4".parseInternalStorageFile(this)
3030
val outputVideo = "transcoding/output/output_${System.currentTimeMillis()}.mp4".parseInternalStorageFile(this)
3131

3232
val increment = 63f / 120f

0 commit comments

Comments
 (0)