-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Video: GStreamer Plugin Improvements
- Loading branch information
Showing
40 changed files
with
1,733 additions
and
1,375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,7 +65,6 @@ jobs: | |
for package in *.pkg ; | ||
do sudo installer -verbose -pkg "$package" -target / | ||
done | ||
echo "PKG_CONFIG_PATH=/Library/Frameworks/GStreamer.framework/lib/pkgconfig:${{ env.PKG_CONFIG_PATH }}" >> "$GITHUB_ENV" | ||
- name: Set Up Cache | ||
uses: hendrikmuhs/[email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
#include <gst/gst.h> | ||
#include <gio/gio.h> | ||
|
||
#define GST_G_IO_MODULE_DECLARE(name) \ | ||
extern void G_PASTE(g_io_, G_PASTE(name, _load)) (gpointer data) | ||
|
||
#define GST_G_IO_MODULE_LOAD(name) \ | ||
G_PASTE(g_io_, G_PASTE(name, _load)) (NULL) | ||
|
||
/* Declaration of static plugins */ | ||
@PLUGINS_DECLARATION@ | ||
|
||
/* Declaration of static gio modules */ | ||
@G_IO_MODULES_DECLARE@ | ||
|
||
/* Call this function to load GIO modules */ | ||
static void | ||
gst_android_load_gio_modules (void) | ||
{ | ||
GTlsBackend *backend; | ||
const gchar *ca_certs; | ||
|
||
@G_IO_MODULES_LOAD@ | ||
|
||
ca_certs = g_getenv ("CA_CERTIFICATES"); | ||
|
||
backend = g_tls_backend_get_default (); | ||
if (backend && ca_certs) { | ||
GTlsDatabase *db; | ||
GError *error = NULL; | ||
|
||
db = g_tls_file_database_new (ca_certs, &error); | ||
if (db) { | ||
g_tls_backend_set_default_database (backend, db); | ||
g_object_unref (db); | ||
} else { | ||
g_warning ("Failed to create a database from file: %s", | ||
error ? error->message : "Unknown"); | ||
} | ||
} | ||
} | ||
|
||
/* This is called by gst_init() */ | ||
void | ||
gst_init_static_plugins (void) | ||
{ | ||
@PLUGINS_REGISTRATION@ | ||
gst_android_load_gio_modules (); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/** | ||
* Copy this file into your Android project and call init(). If your project | ||
* contains fonts and/or certificates in assets, uncomment copyFonts() and/or | ||
* copyCaCertificates() lines in init(). | ||
*/ | ||
package org.freedesktop.gstreamer; | ||
|
||
import java.io.File; | ||
import java.io.FileOutputStream; | ||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.io.OutputStream; | ||
|
||
import android.content.Context; | ||
import android.content.res.AssetManager; | ||
import android.system.Os; | ||
|
||
public class GStreamer { | ||
private static native void nativeInit(Context context) throws Exception; | ||
|
||
public static void init(Context context) throws Exception { | ||
//copyFonts(context); | ||
//copyCaCertificates(context); | ||
nativeInit(context); | ||
} | ||
|
||
private static void copyFonts(Context context) { | ||
AssetManager assetManager = context.getAssets(); | ||
File filesDir = context.getFilesDir(); | ||
File fontsFCDir = new File (filesDir, "fontconfig"); | ||
File fontsDir = new File (fontsFCDir, "fonts"); | ||
File fontsCfg = new File (fontsFCDir, "fonts.conf"); | ||
|
||
fontsDir.mkdirs(); | ||
|
||
try { | ||
/* Copy the config file */ | ||
copyFile (assetManager, "fontconfig/fonts.conf", fontsCfg); | ||
/* Copy the fonts */ | ||
for(String filename : assetManager.list("fontconfig/fonts/truetype")) { | ||
File font = new File(fontsDir, filename); | ||
copyFile (assetManager, "fontconfig/fonts/truetype/" + filename, font); | ||
} | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private static void copyCaCertificates(Context context) { | ||
AssetManager assetManager = context.getAssets(); | ||
File filesDir = context.getFilesDir(); | ||
File sslDir = new File (filesDir, "ssl"); | ||
File certsDir = new File (sslDir, "certs"); | ||
File certs = new File (certsDir, "ca-certificates.crt"); | ||
|
||
certsDir.mkdirs(); | ||
|
||
try { | ||
/* Copy the certificates file */ | ||
copyFile (assetManager, "ssl/certs/ca-certificates.crt", certs); | ||
} catch (IOException e) { | ||
e.printStackTrace(); | ||
} | ||
} | ||
|
||
private static void copyFile(AssetManager assetManager, String assetPath, File outFile) throws IOException { | ||
InputStream in = null; | ||
OutputStream out = null; | ||
IOException exception = null; | ||
|
||
if (outFile.exists()) | ||
outFile.delete(); | ||
|
||
try { | ||
in = assetManager.open(assetPath); | ||
out = new FileOutputStream(outFile); | ||
|
||
byte[] buffer = new byte[1024]; | ||
int read; | ||
while ((read = in.read(buffer)) != -1) { | ||
out.write(buffer, 0, read); | ||
} | ||
out.flush(); | ||
} catch (IOException e) { | ||
exception = e; | ||
} finally { | ||
if (in != null) | ||
try { | ||
in.close(); | ||
} catch (IOException e) { | ||
if (exception == null) | ||
exception = e; | ||
} | ||
if (out != null) | ||
try { | ||
out.close(); | ||
} catch (IOException e) { | ||
if (exception == null) | ||
exception = e; | ||
} | ||
if (exception != null) | ||
throw exception; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.