mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
Fixes to make it compile without GNOME, and with a modern (>= 0.3) version of GStreamer. Now that I got it compiled,...
Original commit message from CVS: Fixes to make it compile without GNOME, and with a modern (>= 0.3) version of GStreamer. Now that I got it compiled, I want to delete it.
This commit is contained in:
parent
6f06c87c12
commit
eac642da85
2 changed files with 28 additions and 24 deletions
|
@ -1,4 +1,4 @@
|
||||||
#include <gnome.h>
|
#include <gtk/gtk.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
|
||||||
extern gboolean _gst_plugin_spew;
|
extern gboolean _gst_plugin_spew;
|
||||||
|
@ -13,36 +13,35 @@ int main(int argc,char *argv[]) {
|
||||||
GstElement *src;
|
GstElement *src;
|
||||||
GstElementFactory *wavefactory;
|
GstElementFactory *wavefactory;
|
||||||
GstElement *wave;
|
GstElement *wave;
|
||||||
|
GtkWidget *wave_widget;
|
||||||
GtkWidget *appwindow;
|
GtkWidget *appwindow;
|
||||||
|
|
||||||
_gst_plugin_spew = TRUE;
|
|
||||||
|
|
||||||
gst_init(&argc,&argv);
|
gst_init(&argc,&argv);
|
||||||
gst_plugin_load("libsmoothwave.so");
|
gst_plugin_load("libsmoothwave.so");
|
||||||
gnome_init("Wave","0.0.1",argc,argv);
|
gtk_init(&argc,&argv);
|
||||||
|
|
||||||
bin = gst_bin_new("bin");
|
bin = gst_pipeline_new("bin");
|
||||||
|
|
||||||
srcfactory = gst_element_factory_find("audiosrc");
|
srcfactory = gst_element_factory_find("sinesrc");
|
||||||
g_return_val_if_fail(srcfactory != NULL, -1);
|
g_return_val_if_fail(srcfactory != NULL, -1);
|
||||||
wavefactory = gst_element_factory_find("smoothwave");
|
wavefactory = gst_element_factory_find("smoothwave");
|
||||||
g_return_val_if_fail(wavefactory != NULL, -1);
|
g_return_val_if_fail(wavefactory != NULL, -1);
|
||||||
|
|
||||||
src = gst_element_factory_create(srcfactory,"src");
|
src = gst_element_factory_create(srcfactory,"src");
|
||||||
gtk_object_set(GTK_OBJECT(src),"bytes_per_read",(gulong)2048,NULL);
|
//g_object_set(G_OBJECT(src),"bytes_per_read",(gulong)2048,NULL);
|
||||||
wave = gst_element_factory_create(wavefactory,"wave");
|
wave = gst_element_factory_create(wavefactory,"wave");
|
||||||
gtk_object_set(GTK_OBJECT(wave),"width",256,"height",100,NULL);
|
g_object_set(G_OBJECT(wave),"width",256,"height",100,NULL);
|
||||||
|
|
||||||
|
|
||||||
gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(src));
|
||||||
gst_bin_add(GST_BIN(bin),GST_ELEMENT(wave));
|
gst_bin_add(GST_BIN(bin),GST_ELEMENT(wave));
|
||||||
|
|
||||||
gst_pad_connect(gst_element_get_pad(src,"src"),
|
gst_pad_link(gst_element_get_pad(src,"src"),
|
||||||
gst_element_get_pad(wave,"sink"));
|
gst_element_get_pad(wave,"sink"));
|
||||||
|
|
||||||
appwindow = gnome_app_new("wave","Wave");
|
appwindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||||
gnome_app_set_contents(GNOME_APP(appwindow),gst_util_get_pointer_arg(GTK_OBJECT(wave),"widget"));
|
g_object_get(G_OBJECT(wave),"widget",&wave_widget,NULL);
|
||||||
|
gtk_container_add(GTK_CONTAINER(appwindow), wave_widget);
|
||||||
gtk_widget_show_all(appwindow);
|
gtk_widget_show_all(appwindow);
|
||||||
|
|
||||||
gst_element_set_state(GST_ELEMENT(bin),GST_STATE_READY);
|
gst_element_set_state(GST_ELEMENT(bin),GST_STATE_READY);
|
||||||
|
@ -55,7 +54,8 @@ int main(int argc,char *argv[]) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean idle_func(gpointer data) {
|
gboolean idle_func(gpointer data)
|
||||||
|
{
|
||||||
gst_bin_iterate(GST_BIN(data));
|
gst_bin_iterate(GST_BIN(data));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,14 +162,16 @@ gst_smoothwave_chain (GstPad *pad, GstBuffer *buf)
|
||||||
smoothwave = GST_SMOOTHWAVE(GST_OBJECT_PARENT (pad));
|
smoothwave = GST_SMOOTHWAVE(GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
/* first deal with audio metadata */
|
/* first deal with audio metadata */
|
||||||
/* if (buf->meta) { */
|
#if 0
|
||||||
/* if (smoothwave->meta != NULL) { */
|
if (buf->meta) {
|
||||||
/* /* FIXME: need to unref the old metadata so it goes away */ */
|
if (smoothwave->meta != NULL) {
|
||||||
/* } */
|
/* FIXME: need to unref the old metadata so it goes away */
|
||||||
/* /* we just make a copy of the pointer */ */
|
}
|
||||||
/* smoothwave->meta = (MetaAudioRaw *)(buf->meta); */
|
/* we just make a copy of the pointer */
|
||||||
/* /* FIXME: now we have to ref the metadata so it doesn't go away */ */
|
smoothwave->meta = (MetaAudioRaw *)(buf->meta);
|
||||||
/* } */
|
/* FIXME: now we have to ref the metadata so it doesn't go away */
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* g_return_if_fail(smoothwave->meta != NULL); */
|
/* g_return_if_fail(smoothwave->meta != NULL); */
|
||||||
|
|
||||||
|
@ -192,10 +194,12 @@ gst_smoothwave_chain (GstPad *pad, GstBuffer *buf)
|
||||||
|
|
||||||
ptr = (guint32 *)smoothwave->imagebuffer;
|
ptr = (guint32 *)smoothwave->imagebuffer;
|
||||||
for (i=0;i<(smoothwave->width*smoothwave->height)/4;i++) {
|
for (i=0;i<(smoothwave->width*smoothwave->height)/4;i++) {
|
||||||
if (*ptr)
|
if (*ptr){
|
||||||
*(ptr++) -= ((*ptr & 0xf0f0f0f0ul) >> 4) + ((*ptr & 0xe0e0e0e0ul) >> 5);
|
*ptr -= ((*ptr & 0xf0f0f0f0ul) >> 4) + ((*ptr & 0xe0e0e0e0ul) >> 5);
|
||||||
else
|
|
||||||
ptr++;
|
ptr++;
|
||||||
|
}else{
|
||||||
|
ptr++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* GST_DEBUG ("drawing"); */
|
/* GST_DEBUG ("drawing"); */
|
||||||
|
|
Loading…
Reference in a new issue