Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
# Conflicts:
#	LICENSE.txt
  • Loading branch information
Javernaut committed Nov 12, 2023
2 parents 784a669 + 5de34cb commit b1a4d5d
Show file tree
Hide file tree
Showing 23 changed files with 103 additions and 124 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,32 +4,32 @@ on:
types: [ released ]
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up JDK 11
uses: actions/setup-java@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
distribution: temurin
java-version: 17

- name: Setup the environment
run: |
sudo pip3 install meson==0.58.2
sudo pip3 install meson==1.2.2
sudo apt-get install nasm ninja-build
- name: Assembling the ffmpeg-android-maker
run: |
export ANDROID_SDK_HOME=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME
./ffmpeg-android-maker/ffmpeg-android-maker.sh -dav1d -android=16
./ffmpeg-android-maker/ffmpeg-android-maker.sh -dav1d
- name: Building the library, preparing sources and docs
run: ./gradlew assembleRelease androidSourcesJar javadocJar
- name: Building the library
run: ./gradlew assembleRelease

- name: Pushing the library to Maven Central
run: ./gradlew publishReleasePublicationToSonatypeRepository closeAndReleaseSonatypeStagingRepository --max-workers 1
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/publish-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,32 +5,32 @@ on:
- develop
jobs:
build:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up JDK 11
uses: actions/setup-java@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: adopt
java-version: 11
distribution: temurin
java-version: 17

- name: Setup the environment
run: |
sudo pip3 install meson==0.58.2
sudo pip3 install meson==1.2.2
sudo apt-get install nasm ninja-build
- name: Assembling the ffmpeg-android-maker
run: |
export ANDROID_SDK_HOME=$ANDROID_HOME
export ANDROID_NDK_HOME=$ANDROID_NDK_LATEST_HOME
./ffmpeg-android-maker/ffmpeg-android-maker.sh -dav1d -android=16
./ffmpeg-android-maker/ffmpeg-android-maker.sh -dav1d
- name: Building the library, preparing sources and docs
run: ./gradlew assembleRelease androidSourcesJar javadocJar
- name: Building the library
run: ./gradlew assembleRelease

- name: Pushing the library to Maven Central (SNAPSHOT)
run: ./gradlew publishReleasePublicationToSonatypeRepository --max-workers 1
Expand Down
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Oleksandr Berezhnyi
Copyright (c) 2023 Oleksandr Berezhnyi

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MediaFile

[![API](https://img.shields.io/badge/API-16%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=16)
[![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21)
[![MIT license](http://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/Javernaut/WhatTheCodec/blob/master/LICENSE.txt)
[![Android Weekly #378](https://androidweekly.net/issues/issue-378/badge)](https://androidweekly.net/issues/issue-378)
[![Android Weekly #396](https://androidweekly.net/issues/issue-396/badge)](https://androidweekly.net/issues/issue-396)
Expand Down
9 changes: 4 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ buildscript {
}
}
dependencies {
classpath "com.android.tools.build:gradle:7.1.2"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:1.5.0"
classpath 'io.github.gradle-nexus:publish-plugin:1.1.0'
classpath "com.android.tools.build:gradle:8.1.3"
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
classpath 'io.github.gradle-nexus:publish-plugin:1.3.0'
}
}

task clean(type: Delete) {
tasks.register('clean', Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
android.enableJetifier=false
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Aug 01 14:10:35 EEST 2021
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
1 change: 1 addition & 0 deletions media-file/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
cmake_minimum_required(VERSION 3.4.1)
project(MediaFile)

set(ffmpeg_dir ${CMAKE_SOURCE_DIR}/../ffmpeg-android-maker/output)
set(ffmpeg_libs ${ffmpeg_dir}/lib/${ANDROID_ABI})
Expand Down
17 changes: 9 additions & 8 deletions media-file/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@ ext {
apply from: "${rootDir}/scripts/publish-module.gradle"

android {
compileSdk 30
namespace = 'io.github.javernaut.mediafile'
compileSdk 34

defaultConfig {
minSdk 16
targetSdk 30
minSdk 21
targetSdk 34
versionCode 1
versionName "1.0"

Expand All @@ -39,7 +40,7 @@ android {
kotlinOptions {
jvmTarget = '1.8'
}
ndkVersion "23.0.7599858"
ndkVersion "26.1.10909125"
externalNativeBuild {
cmake {
path "CMakeLists.txt"
Expand All @@ -48,18 +49,18 @@ android {
}

dependencies {
implementation 'androidx.annotation:annotation:1.2.0'
implementation 'androidx.annotation:annotation:1.7.0'

def testLibsVersion = "1.4.0"
def testLibsVersion = "1.5.0"

// Core library
androidTestImplementation "androidx.test:core:$testLibsVersion"

// AndroidJUnitRunner and JUnit Rules
androidTestImplementation "androidx.test:runner:$testLibsVersion"
androidTestImplementation "androidx.test:runner:1.5.2"
androidTestImplementation "androidx.test:rules:$testLibsVersion"

// Assertions
androidTestImplementation "androidx.test.ext:junit:1.1.3"
androidTestImplementation "androidx.test.ext:junit:1.1.5"
androidTestImplementation "androidx.test.ext:truth:$testLibsVersion"
}
3 changes: 1 addition & 2 deletions media-file/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="io.github.javernaut.mediafile">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

</manifest>
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/frame_extractor.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 12/07/19.
// Created by Oleksandr Berezhnyi on 12/07/19.
//

#include "frame_extractor.h"
Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/frame_extractor.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 12/07/19.
// Created by Oleksandr Berezhnyi on 12/07/19.
//

#ifndef WHATTHECODEC_FRAME_EXTRACTOR_H
Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/frame_loader_context.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 14/10/19.
// Created by Oleksandr Berezhnyi on 14/10/19.
//

#include "frame_loader_context.h"
Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/frame_loader_context.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 14/10/19.
// Created by Oleksandr Berezhnyi on 14/10/19.
//

#ifndef WHATTHECODEC_FRAME_LOADER_CONTEXT_H
Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/log.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 25/03/19.
// Created by Oleksandr Berezhnyi on 25/03/19.
//

#ifndef WHATTHECODEC_LOG_H
Expand Down
15 changes: 7 additions & 8 deletions media-file/src/main/cpp/media_file_builder.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 24/03/19.
// Created by Oleksandr Berezhnyi on 24/03/19.
//

#include "media_file_builder.h"
Expand Down Expand Up @@ -122,22 +122,21 @@ static void onAudioStreamFound(jobject jMediaFileBuilder,
auto jSampleFormat = toJString(av_get_sample_fmt_name(avSampleFormat));

jstring jChannelLayout = nullptr;
if (parameters->channel_layout) {
AVBPrint printBuffer;
av_bprint_init(&printBuffer, 1, AV_BPRINT_SIZE_UNLIMITED);
av_bprint_clear(&printBuffer);
av_bprint_channel_layout(&printBuffer, parameters->channels, parameters->channel_layout);
AVBPrint printBuffer;
av_bprint_init(&printBuffer, 1, AV_BPRINT_SIZE_UNLIMITED);
av_bprint_clear(&printBuffer);
if (!av_channel_layout_describe_bprint(&parameters->ch_layout, &printBuffer)) {
jChannelLayout = toJString(printBuffer.str);
av_bprint_finalize(&printBuffer, nullptr);
}
av_bprint_finalize(&printBuffer, nullptr);

utils_call_instance_method_void(jMediaFileBuilder,
fields.MediaFileBuilder.onAudioStreamFoundID,
jBasicStreamInfo,
parameters->bit_rate,
jSampleFormat,
parameters->sample_rate,
parameters->channels,
parameters->ch_layout.nb_channels,
jChannelLayout);
}

Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/media_file_builder.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 14/10/19.
// Created by Oleksandr Berezhnyi on 14/10/19.
//

#ifndef WHATTHECODEC_MEDIA_FILE_BUILDER_H
Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 25/03/19.
// Created by Oleksandr Berezhnyi on 25/03/19.
//

#include "utils.h"
Expand Down
2 changes: 1 addition & 1 deletion media-file/src/main/cpp/utils.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Created by Alexander Berezhnoi on 25/03/19.
// Created by Oleksandr Berezhnyi on 25/03/19.
//

#ifndef WHATTHECODEC_UTILS_H
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ class MediaFileBuilder(private val mediaType: MediaType) {
/**
* Tries reading all metadata for a [MediaFile] object from a file path.
*/
fun from(filePath: String) = apply {
fun from(filePath: String): MediaFileBuilder = apply {
nativeCreateFromPath(filePath, mediaType.mediaStreamsMask)
}

/**
* Tries reading all metadata for a [MediaFile] object from a file descriptor. The file descriptor is saved and
* closed when [MediaFile.release] method is called.
*/
fun from(descriptor: ParcelFileDescriptor) = apply {
fun from(descriptor: ParcelFileDescriptor): MediaFileBuilder = apply {
this.parcelFileDescriptor = descriptor
nativeCreateFromFD(descriptor.fd, mediaType.mediaStreamsMask)
}
Expand All @@ -51,16 +51,17 @@ class MediaFileBuilder(private val mediaType: MediaType) {
* If a file comes from assets catalog, then its format should be known to a developer.
* All default formats are listed here: https://ffmpeg.org/ffmpeg-formats.html
*/
fun from(assetFileDescriptor: AssetFileDescriptor, shortFormatName: String) = apply {
val descriptor = assetFileDescriptor.parcelFileDescriptor
this.parcelFileDescriptor = descriptor
nativeCreateFromAssetFD(
descriptor.fd,
assetFileDescriptor.startOffset,
shortFormatName,
mediaType.mediaStreamsMask
)
}
fun from(assetFileDescriptor: AssetFileDescriptor, shortFormatName: String): MediaFileBuilder =
apply {
val descriptor = assetFileDescriptor.parcelFileDescriptor
this.parcelFileDescriptor = descriptor
nativeCreateFromAssetFD(
descriptor.fd,
assetFileDescriptor.startOffset,
shortFormatName,
mediaType.mediaStreamsMask
)
}

/**
* Combines all data read from FFmpeg into a [MediaFile] object. If there was error during
Expand Down
Loading

0 comments on commit b1a4d5d

Please sign in to comment.