Add beginning of gstreamer stuff
This commit is contained in:
parent
7bb3ae3f18
commit
b6f0335e2a
@ -1,6 +1,6 @@
|
|||||||
## Process this file with automake to produce Makefile.in
|
## Process this file with automake to produce Makefile.in
|
||||||
|
|
||||||
SUBDIRS = src
|
SUBDIRS = src tools
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
README AUTHORS COPYING
|
README AUTHORS COPYING
|
||||||
|
@ -10,6 +10,7 @@ AM_CONFIG_HEADER(src/config.h)
|
|||||||
AC_ISC_POSIX
|
AC_ISC_POSIX
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AM_PROG_CC_STDC
|
AM_PROG_CC_STDC
|
||||||
|
AM_PROG_CC_C_O
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AM_ENABLE_SHARED
|
AM_ENABLE_SHARED
|
||||||
@ -76,6 +77,17 @@ GST_MAJORMINOR=0.10
|
|||||||
GST_REQS=0.10.2
|
GST_REQS=0.10.2
|
||||||
GSTPLUG_REQS=0.10.1
|
GSTPLUG_REQS=0.10.1
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(GSTREAMER, [
|
||||||
|
gstreamer-$GST_MAJORMINOR >= $GST_REQS
|
||||||
|
gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPLUG_REQS],
|
||||||
|
[
|
||||||
|
have_gstreamer="yes"
|
||||||
|
AC_DEFINE(BUILD_GSTREAMER_SUPPORT, 1, [Enable Gstreamer Support for Ecdb])
|
||||||
|
],
|
||||||
|
[have_gstreamer="false"])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(GSTREAMER_BUILD_SUPPORT, test "x$have_gstreamer" = "xyes")
|
||||||
|
|
||||||
dnl Make gstreamer an optional dependancy at some point
|
dnl Make gstreamer an optional dependancy at some point
|
||||||
PKG_CHECK_MODULES(ECDB, [
|
PKG_CHECK_MODULES(ECDB, [
|
||||||
ecore
|
ecore
|
||||||
@ -84,12 +96,19 @@ PKG_CHECK_MODULES(ECDB, [
|
|||||||
efreet-mime
|
efreet-mime
|
||||||
libburn-1 >= $LIBBURN_REQUIRED
|
libburn-1 >= $LIBBURN_REQUIRED
|
||||||
libisofs-1 >= $LIBISOFS_REQUIRED
|
libisofs-1 >= $LIBISOFS_REQUIRED
|
||||||
gstreamer-$GST_MAJORMINOR >= $GST_REQS
|
|
||||||
gstreamer-plugins-base-$GST_MAJORMINOR >= $GSTPLUG_REQS
|
|
||||||
])
|
])
|
||||||
|
|
||||||
AC_OUTPUT([
|
AC_OUTPUT([
|
||||||
Makefile
|
Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
tools/Makefile
|
||||||
|
tools/ecdb_transcode_helper/Makefile
|
||||||
])
|
])
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo "ECDB"
|
||||||
|
echo
|
||||||
|
echo "Optional Components:"
|
||||||
|
echo "Gstreamer Support............................: $have_gstreamer"
|
||||||
|
echo
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
#include <libburn/libburn.h>
|
#include <libburn/libburn.h>
|
||||||
#include <libisofs/libisofs.h>
|
#include <libisofs/libisofs.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#undef FREE
|
#undef FREE
|
||||||
#define FREE(dat) \
|
#define FREE(dat) \
|
||||||
|
3
ecdb/trunk/tools/Makefile.am
Normal file
3
ecdb/trunk/tools/Makefile.am
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
MAINTAINERCLEANFILES = Makefile.in
|
||||||
|
|
||||||
|
SUBDIRS = ecdb_transcode_helper
|
12
ecdb/trunk/tools/ecdb_transcode_helper/Makefile.am
Normal file
12
ecdb/trunk/tools/ecdb_transcode_helper/Makefile.am
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
if GSTREAMER_BUILD_SUPPORT
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES = Makefile.im
|
||||||
|
|
||||||
|
bin_PROGRAMS = ecdb_transcode_helper
|
||||||
|
|
||||||
|
ecdb_transcode_helper_SOURCES = ecdb_transcode_helper.c
|
||||||
|
|
||||||
|
ecdb_transcode_helper_CFLAGS = @GSTREAMER_CFLAGS@
|
||||||
|
ecdb_transcode_helper_LDADD = @GSTREAMER_LIBS@
|
||||||
|
|
||||||
|
endif
|
132
ecdb/trunk/tools/ecdb_transcode_helper/ecdb_transcode_helpter.c
Normal file
132
ecdb/trunk/tools/ecdb_transcode_helper/ecdb_transcode_helpter.c
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
|
GstElement *pipeline, *audio;
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
bus_call(GstBus *bus, GstMessage *msg, gpointer data)
|
||||||
|
{
|
||||||
|
GMainLoop *loop = (GMainLoop *) data;
|
||||||
|
|
||||||
|
switch (GST_MESSAGE_TYPE(msg))
|
||||||
|
{
|
||||||
|
case GST_MESSAGE_EOS:
|
||||||
|
{
|
||||||
|
g_print("End of stream\n");
|
||||||
|
g_print("Send data back to main program\n");
|
||||||
|
g_main_loop_quit(loop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case GST_MESSAGE_ERROR:
|
||||||
|
{
|
||||||
|
gchar *debug;
|
||||||
|
GError *err;
|
||||||
|
|
||||||
|
gst_message_parse_error(msg, &err, &debug);
|
||||||
|
g_free(debug);
|
||||||
|
|
||||||
|
g_print("Error: %s\n", err->message);
|
||||||
|
g_print("Send error back to main program\n");
|
||||||
|
g_error_free(err);
|
||||||
|
|
||||||
|
g_main_loop_quit(loop);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
cb_newpad (GstElement *decodebin, GstPad *pad, gboolean last, gpointer data)
|
||||||
|
{
|
||||||
|
GstCaps *caps;
|
||||||
|
GstStructure *str;
|
||||||
|
GstPad *audiopad;
|
||||||
|
|
||||||
|
audiopad = gst_element_get_static_pad (audio, "sink");
|
||||||
|
if (GST_PAD_IS_LINKED (audiopad))
|
||||||
|
{
|
||||||
|
g_object_unref (audiopad);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
caps = gst_pad_get_caps (pad);
|
||||||
|
str = gst_caps_get_structure (caps, 0);
|
||||||
|
if (!g_strrstr (gst_structure_get_name (str), "audio"))
|
||||||
|
{
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
gst_object_unref (audiopad);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
gst_pad_link (pad, audiopad);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main (int argc, char ** argv)
|
||||||
|
{
|
||||||
|
GMainLoop *loop;
|
||||||
|
GstElement *src, *dec, *conv, *resample, *filter, *sink;
|
||||||
|
GstCaps *filtercaps;
|
||||||
|
GstPad *audiopad;
|
||||||
|
GstBus *bus;
|
||||||
|
|
||||||
|
gst_init (&argc, &argv);
|
||||||
|
loop = g_main_loop_new (NULL, FALSE);
|
||||||
|
|
||||||
|
if (argc != 2)
|
||||||
|
{
|
||||||
|
g_print ("Error: no supplied file!\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
pipeline = gst_pipeline_new ("pipeline");
|
||||||
|
|
||||||
|
bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
|
||||||
|
gst_bus_add_watch (bus, bus_call, loop);
|
||||||
|
gst_object_unref (bus);
|
||||||
|
|
||||||
|
src = gst_element_factory_make ("filesrc", NULL);
|
||||||
|
g_object_set (G_OBJECT (src), "location", argv[1], NULL);
|
||||||
|
dec = gst_element_factory_make ("decodebin", NULL);
|
||||||
|
g_signal_connect (dec, "new-decoded-pad", G_CALLBACK (cb_newpad), NULL);
|
||||||
|
gst_bin_add_many (GST_BIN (pipeline), src, dec, NULL);
|
||||||
|
gst_element_link (src, dec);
|
||||||
|
|
||||||
|
audio = gst_bin_new ("audiobin");
|
||||||
|
conv = gst_element_factory_make ("audioconvert", NULL);
|
||||||
|
|
||||||
|
/* Here's the bit of magic */
|
||||||
|
resample = gst_element_factory_make("audioresample", NULL);
|
||||||
|
filter = gst_element_factory_make("capsfilter", NULL);
|
||||||
|
filtercaps = gst_caps_new_full(gst_structure_new("audio/x-raw-int",
|
||||||
|
"channels", G_TYPE_INT, 2,
|
||||||
|
"width", G_TYPE_INT, 16,
|
||||||
|
"depth", G_TYPE_INT, 16,
|
||||||
|
"endianness", G_TYPE_INT, 1234,
|
||||||
|
"rate", G_TYPE_INT, 44100,
|
||||||
|
"signed", G_TYPE_BOOLEAN, TRUE,
|
||||||
|
NULL), NULL);
|
||||||
|
g_object_set(GST_OBJECT(filter), "caps", filtercaps, NULL);
|
||||||
|
gst_caps_unref(filtercaps);
|
||||||
|
|
||||||
|
audiopad = gst_element_get_static_pad(conv, "sink");
|
||||||
|
sink = gst_element_factory_make ("filesink", NULL);
|
||||||
|
g_object_set(G_OBJECT(sink), "location", "/home/jaime/test.wav", NULL);
|
||||||
|
gst_bin_add_many(GST_BIN (audio), conv, resample, filter, sink, NULL);
|
||||||
|
gst_element_link_many(conv, resample, filter, sink, NULL);
|
||||||
|
gst_element_add_pad (audio, gst_ghost_pad_new ("sink", audiopad));
|
||||||
|
gst_object_unref (audiopad);
|
||||||
|
gst_bin_add (GST_BIN (pipeline), audio);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
||||||
|
g_main_loop_run (loop);
|
||||||
|
|
||||||
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
||||||
|
gst_object_unref (GST_OBJECT (pipeline));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user