Skip to content

Instantly share code, notes, and snippets.

#include <stdio.h>
#include <stdlib.h>
#include <glib-unix.h>
#include <gst/gst.h>
typedef struct {
GstElement *audioin;
GstElement *audiodecode;
GstElement *audiobin;
GstElement *audiosource;
/*
* compile: gcc -O0 -g $(pkg-config --cflags --libs glib-2.0 gobject-2.0 gstreamer-1.0) -o gstextractor gstextractor.c
* pipeline: gnlcomposition. ( gnlsource. ( bin. ( filesrc ! decodebin ) ), gnlsource. ( bin. ( filesrc ! decodebin ) ) ... ) ! \
* audioconvert ! faac ! qtmux ! filesink
* gnlcomposition. ( gnlsource. ( bin. ( filesrc ! decodebin ) ), gnlsource. ( bin. ( filesrc ! decodebin ) ) ... ) ! \
* videoconvert ! x264enc ! qtmux0.
*/
#include <stdio.h>
#include <stdlib.h>
#!/usr/bin/env gjs
const Lang = imports.lang;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
let Helloworld = Lang.Class({
Name: "Helloworld",
Extends: GObject.Object,
_init: function() {
#!/usr/bin/env gjs
const Lang = imports.lang;
const GLib = imports.gi.GLib;
const GObject = imports.gi.GObject;
const Gst = imports.gi.Gst;
const Mainloop = imports.mainloop;
let TestAV = new Lang.Class({
Name: "Helloworld",
#!/usr/bin/env vala
[DBus (name = "org.testdbus.Server")]
interface TestDBus.Client : GLib.Object {
public signal void finalized();
public abstract string say(string sentence) throws Error;
public abstract void quit() throws Error;
}
[DBus (name = "org.testdbus.Server")]
#!/usr/bin/env gjs
// run : gjs dbus-list-current-services.js 2>/dev/null | sort -t, -k2,3r | column -s, -t
const Lang = imports.lang;
const Gio = imports.gi.Gio;
const Format = imports.format;
const cmdline = "dbus-send --%s --dest=%s --type=method_call --print-reply %s org.freedesktop.DBus.Introspectable.Introspect";
const Subprocess = new Lang.Class({
Name: "Subprocess",
@mohan43u
mohan43u / testbin.c
Created January 3, 2015 10:17
test gstreamer bin
#include <stdio.h>
#include <stdlib.h>
#include <glib-unix.h>
#include <gst/gst.h>
typedef struct {
GstElement *bin;
GstElement *in;
GstElement *decodebin;
GstElement *aout;
@mohan43u
mohan43u / mediacat.c
Created June 21, 2015 04:51
example for howto use gstreamer editing services
#include <string.h>
#include <glib-unix.h>
#include <gst/gst.h>
#include <ges/ges.h>
/* interval to query pipeline position (currently 600 seconds or 10 mins) */
#define QUERY_POSITION_INTERVAL 10 * 60 * 1000
typedef struct {
GESPipeline *pipeline;
@mohan43u
mohan43u / timediff.py
Created June 21, 2015 04:51
snip to calculate timedifference
#!/usr/bin/env python
import time
import datetime
import sys
datetime0 = datetime.datetime.fromtimestamp(time.mktime(time.strptime(sys.argv[2], '%H:%M:%S')))
datetime1 = datetime.datetime.fromtimestamp(time.mktime(time.strptime(sys.argv[1], '%H:%M:%S')))
print(datetime0 - datetime1)
@mohan43u
mohan43u / testgioasync.c
Created June 21, 2015 04:51
howto create async functions using gio async api
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <glib-object.h>
#include <gio/gio.h>
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define TEST_TYPE_GIO_ASYNC (test_gio_async_get_type())
#define TEST_GIO_ASYNC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), TEST_TYPE_GIO_ASYNC, TestGioAsync))