Skip to content
Open
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
62 changes: 62 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: format + publishable

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
format_dart:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Format
run: |
flutter format --set-exit-if-changed .

format_java:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2 # v2 minimum required
- uses: axel-op/googlejavaformat-action@v3
with:
args: "--skip-sorting-imports"
# Recommended if you use MacOS:
# githubToken: ${{ secrets.GITHUB_TOKEN }}

format_kotlin:
runs-on: ubuntu-latest

steps:
- name: "checkout"
uses: actions/checkout@v2

- name: "ktlint"
uses: "vroy/gha-kotlin-linter@v1"

format_swift:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: GitHub Action for SwiftLint
uses: norio-nomura/action-swiftlint@3.2.1

publishable:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- uses: subosito/flutter-action@v1
with:
channel: 'stable'

- name: publish checks
run: |
flutter pub get
flutter pub publish -n
pub global activate tuneup
pub global run tuneup check
78 changes: 78 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: test

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2

- uses: subosito/flutter-action@v1
with:
channel: 'stable'

- name: Test
run: |
flutter pub get
flutter test

drive_ios:
strategy:
matrix:
device:
# - "iPhone 8 (14.4)"
- "iPhone 11 Pro (14.4)"
fail-fast: false
runs-on: macos-latest
needs: test
steps:
- name: List all simulators
run: xcrun instruments -s
# get UUID simulator and boot a simulator on mac from command line
- name: Start Simulator
run: |
UDID=$(
xcrun instruments -s |
awk \
-F ' *[][]' \
-v 'device=${{ matrix.device }}' \
'$1 == device { print $2 }'
)
xcrun simctl boot "${UDID:?No Simulator with this name found}"
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
# Run flutter integrate tests
- name: Run Flutter integration tests
run: cd example && flutter test integration_test/h264_integration_test.dart


drive_android:
runs-on: macos-latest
#creates a build matrix for your jobs
strategy:
#set of different configurations of the virtual environment.
matrix:
api-level: [29]
# api-level: [21, 29]
target: [default]
needs: test
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v1
with:
channel: 'stable'
- name: Run Flutter Driver tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: ${{ matrix.api-level }}
target: ${{ matrix.target }}
arch: x86_64
profile: Nexus 6
script: cd example && flutter test integration_test/h264_integration_test.dart
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.4.0

* Android: Removes support for V1 embedding
* Android: Use latest AGP toolchain

## 0.3.0

* Adds null-safety, built the project using Flutter 2.1.0-12.2.pre
Expand Down
6 changes: 3 additions & 3 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,18 @@ version '1.0-SNAPSHOT'
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:7.0.0'
}
}

rootProject.allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
10 changes: 1 addition & 9 deletions android/src/main/java/asia/ivity/h264/H264Plugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,12 @@
import io.flutter.embedding.engine.plugins.FlutterPlugin;
import io.flutter.plugin.common.BinaryMessenger;
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.PluginRegistry.Registrar;

/**
* H264Plugin
*/
/** H264Plugin */
public class H264Plugin implements FlutterPlugin {

private MethodChannel channel;

public static void registerWith(Registrar registrar) {
H264Plugin instance = new H264Plugin();
instance.startListening(registrar.messenger());
}

@Override
public void onAttachedToEngine(@NonNull FlutterPluginBinding binding) {
startListening(binding.getBinaryMessenger());
Expand Down
4 changes: 2 additions & 2 deletions android/src/main/java/asia/ivity/h264/util/H264Reader.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,16 @@ public static synchronized Bitmap decode(InputStream is, long length, int width,

byte[] buffer = new byte[(int) length];
int read;

if ((read = is.read(buffer)) != -1) {
Log.d(TAG, "Data put into buffer: " + read + " bytes");
inputBuffer.put(buffer, 0, read);

codec.queueInputBuffer(inputBufferId, 0, read, 0, MediaCodec.BUFFER_FLAG_END_OF_STREAM);
break;
} else {
Log.d(TAG, "Reached the end");
break;
}
break;
}
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package asia.ivity.h264;

import androidx.test.rule.ActivityTestRule;
import dev.flutter.plugins.e2e.FlutterTestRunner;
import dev.flutter.plugins.integration_test.FlutterTestRunner;
import org.junit.Rule;
import org.junit.runner.RunWith;

Expand Down
7 changes: 0 additions & 7 deletions example/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@
</intent-filter>
</activity>

<activity
android:name=".EmbeddingV1Activity"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale"
android:hardwareAccelerated="true"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize" />

<meta-data
android:name="flutterEmbedding"
android:value="2" />
Expand Down

This file was deleted.

6 changes: 3 additions & 3 deletions example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:3.6.1'
classpath 'com.android.tools.build:gradle:7.0.0'
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand Down
1 change: 0 additions & 1 deletion example/android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-Xmx1536M
android.enableR8=true
3 changes: 1 addition & 2 deletions example/android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Sat Mar 28 19:48:49 GMT 2020
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
47 changes: 47 additions & 0 deletions example/integration_test/h264_integration_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import 'dart:io';

import 'package:flutter/services.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:h264/h264.dart';
import 'package:integration_test/integration_test.dart';
import 'package:path_provider/path_provider.dart';

class Sample {
final String name;
final int width;
final int height;

Sample(this.name, this.width, this.height);
}

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

for (Sample asset in [
Sample("180206_120601_001_LO.MP4.thumbnail.h264", 768, 432),
Sample("180304_163039_357.mov.thumbnail.h264", 1920, 1080),
]) {
testWidgets('convert ${asset.name}', (WidgetTester tester) async {
final loaded = await rootBundle.load("assets/samples/${asset.name}");

final tmp = await getTemporaryDirectory();
final tmpAsset = File("${tmp.path}/cached-${asset.name}");
tmpAsset.writeAsBytesSync(loaded.buffer.asUint8List());

final tmpOut = File("${tmp.path}/decoded-${asset.name}.jpg");

try {
tmpOut.deleteSync();
} catch (_) {}

await H264().decodeFrame(
tmpAsset.path,
tmpOut.path,
asset.width,
asset.height,
);

expect(tmpOut.lengthSync(), isNonZero);
});
}
}
10 changes: 0 additions & 10 deletions example/integration_test/h264_test.dart

This file was deleted.

2 changes: 1 addition & 1 deletion example/ios/Flutter/AppFrameworkInfo.plist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<key>CFBundleVersion</key>
<string>1.0</string>
<key>MinimumOSVersion</key>
<string>8.0</string>
<string>9.0</string>
</dict>
</plist>
4 changes: 2 additions & 2 deletions example/ios/Runner.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@
isa = PBXProject;
attributes = {
DefaultBuildSystemTypeForWorkspace = Latest;
LastUpgradeCheck = 1240;
LastUpgradeCheck = 1250;
ORGANIZATIONNAME = "The Chromium Authors";
TargetAttributes = {
34C9F96024308AA100ECE361 = {
Expand Down Expand Up @@ -319,7 +319,7 @@
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build\n";
};
/* End PBXShellScriptBuildPhase section */

Expand Down
Loading