Merge from HEAD into INCSCHED1 at 200105231.

Original commit message from CVS:
Merge from HEAD into INCSCHED1 at 200105231.
This commit is contained in:
Erik Walthinsen 2001-05-24 00:46:45 +00:00
parent 368f85114c
commit f5314d44b4
108 changed files with 3756 additions and 1644 deletions

View file

@ -3,7 +3,8 @@ Matt Howell <mhowell@users.sourceforge.net>
Brent Bradburn <bbradburn@users.sourceforge.net>
Wim Taymans <wim.taymans@tvd.be>
Richard Boulton <richard@tartarus.org>
Zaheer Merali <zaheer@grid9.net> (thread synchronization rework)
Zaheer Merali <zaheer@grid9.net>
- thread synchronization rework
David I. Lehn <dlehn@users.sourceforge.net>
- debian packaging
- various fixes
@ -14,3 +15,5 @@ Jens Thiele <karme@unforgettable.com>
- color conversion patches
Thomas Nyberg <thomas@codefactory.se>
- gstreamer.m4 macros
Bastien Nocera <hadess@hadess.net>
- gnomevfs sink and source

27
README
View file

@ -5,3 +5,30 @@ that will provide the various codec and other functionality. The
interface hopefully is generic enough for various companies (ahem, Apple)
to release binary codecs for Linux, until such time as they get a clue and
release the source.
Developer note: When building from CVS sources, you will need to run
autogen.sh to generate the build system files.
Unfortunately, there is a bug in automake which causes it to use a large
amount of memory when generating plugins/Makefile.in. The following patch,
which you may wish to apply to automake (version 1.4), fixes this problem.
Alternatively, ensure that you have at least 128Mb of memory on your system,
and be prepared to wait a little while when running automake (or autogen.sh).
@@ -2383,8 +2383,8 @@
# to all possible directories, and use it. If DIST_SUBDIRS is
# defined, just use it.
local ($dist_subdir_name);
- if (&variable_conditions ('SUBDIRS')
- || &variable_defined ('DIST_SUBDIRS'))
+ if (&variable_defined ('DIST_SUBDIRS')
+ || &variable_conditions ('SUBDIRS'))
{
$dist_subdir_name = 'DIST_SUBDIRS';
if (! &variable_defined ('DIST_SUBDIRS'))
The automake developers have been notified of this problem, and supplied with
an equivalent patch against CVS head.

View file

@ -19,6 +19,7 @@ Optional libraries:
gdk_pixbuf
libgnomeui (for gstplay, gsteditor, autoplug example, several tests)
libglade (for gstplay, gsteditor)
libHermes (for gstplay)
libghttp (for httpsrc)
libXv (for videosink)

View file

@ -21,16 +21,20 @@
#undef HAVE_CPU_ARM
#undef HAVE_CPU_SPARC
#undef HAVE_RDTSC
#undef HAVE_GDK_PIXBUF
#undef HAVE_LIBGHTTP
#undef HAVE_LIBMMX
#undef HAVE_LIBXV
#undef HAVE_LIBAUDIOFILE
#undef HAVE_OSS
#undef HAVE_XAUDIO
#undef HAVE_CSSAUTH
#undef HAVE_VORBIS
#undef HAVE_LIBMAD
#undef HAVE_LIBJPEG
#undef HAVE_LIBSDL
#undef HAVE_LIBHERMES
#undef HAVE_NASM
#undef HAVE_MPEG2DEC

View file

@ -54,23 +54,14 @@ if test -z "$*"; then
fi
libtoolize --copy --force
aclocal $ACLOCAL_FLAGS
aclocal $ACLOCAL_FLAGS || {
echo "aclocal failed - check that all needed development files are present on system"
exit 1
}
autoheader
autoconf
automake --add-missing
if [ "x$1" = "x--autogen-recurse" ];then
exit # the rest will happen later
fi
#for dir in `find * -name autogen.sh -print | grep -v '^autogen.sh$' | \
# sed 's/autogen.sh$//'`;do
# echo "Recursively running autogen.sh in $dir"
# pushd $dir > /dev/null
# ./autogen.sh --autogen-recurse "$@"
# popd > /dev/null
#done
# now remove the cache, because it can be considered dangerous in this case
rm -f config.cache

View file

@ -0,0 +1,44 @@
GOB_FILES = \
bonobo-media-gstreamer.gob bonobo-media-gstreamervideo.gob
GOB_SOURCE = \
bonobo-media-gstreamer.h bonobo-media-gstreamer-private.h bonobo-media-gstreamer.c \
bonobo-media-gstreamervideo.h bonobo-media-gstreamervideo.c bonobo-media-gstreamervideo-private.h
OAF_FILES = bonobo-media-gstreamer.oafinfo
INCLUDES = \
-I. \
-I$(srcdir) -I$(top_srcdir) -I$(top_builddir) \
-I$(top_srcdir)/bonobo-media \
-I$(includedir) \
-I$(GNOME_CFLAGS) $(GNOME_INCLUDEDIR) \
-I$(EXTRA_BONOBO_CFLAGS) $(EXTRA_WARNING_CFLAGS) \
$(GSTREAMER_CFLAGS)
if STREAM_PROVIDERS_GSTREAMER
bin_PROGRAMS = bonobo-media-gstreamer
endif
bonobo_media_gstreamer_SOURCES = \
$(GOB_FILES) $(GOB_SOURCE) \
bonobo-media-gstreamer-factory.c
bonobo_media_gstreamer_LDADD = \
$(EXTRA_GNOME_LIBS) $(EXTRA_BONOBO_LIBS) \
-lpthread \
-lgstmediaplay -lgst\
$(top_builddir)/bonobo-media/libbonobo-media.la
.c %.h %-private.h: $(srcdir)/%.gob
@GOB@ $<
oafdir = $(datadir)/oaf
oaf_DATA = $(OAF_FILES)
BUILT_SOURCES = $(GOB_SOURCE)
CLEANFILES += $(BUILT_SOURCES)
EXTRA_DIST = $(OAF_FILES)

View file

@ -0,0 +1,74 @@
/* bonobo-media-gstreamer-factry: Factory for GStreamer player using the
* Bonobo:Media interfaces
*
* Copyright (C) 2001 Ali Abdin <aliabdin@aucegypt.edu>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
*/
#include <gnome.h>
#include <glib.h>
#include <bonobo.h>
#include <liboaf/liboaf.h>
#include "bonobo-media-gstreamer.h"
#include <gst/gst.h>
#include <config.h>
static BonoboObject* gstreamer_factory (BonoboGenericFactory *factory,
gpointer user_data)
{
return BONOBO_OBJECT (bonobo_media_gstreamer_new ());
}
static void init_bonobo (int argc, char **argv)
{
CORBA_ORB orb;
gnome_init_with_popt_table ("bonobo-media-gstreamer", VERSION,
argc, argv,
oaf_popt_options, 0, NULL);
orb = oaf_init (argc, argv);
if (bonobo_init (orb, NULL, NULL) == FALSE)
g_error ("Could not initialize Bonobo");
}
static void last_unref_cb (BonoboObject *bonobo_object,
BonoboGenericFactory *factory)
{
bonobo_object_unref (BONOBO_OBJECT (factory));
gtk_main_quit ();
}
int main (int argc, char **argv)
{
BonoboGenericFactory *factory;
gst_init (&argc, &argv);
init_bonobo (argc, argv);
factory = bonobo_generic_factory_new (
"OAFIID:Bonobo_Media_GStreamer_Factory",
gstreamer_factory, NULL);
gtk_signal_connect (GTK_OBJECT (bonobo_context_running_get ()), "last_unref",
GTK_SIGNAL_FUNC (last_unref_cb), factory);
bonobo_main ();
return 0;
}

View file

@ -0,0 +1,251 @@
/* vim: set syntax=c: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*/
%at{
/* bonobo-media-gstreamer: GStreamer player using the Bonobo:Meida interfaces
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (c) 2001 Ali Abdin <aliabdin@aucegypt.edu> and
* ÉRDI Gergõ <cactus@cactus.rulez.org>
* Wim Taymans <wim.taymans@chello.be>
*/
%}
%header{
#include <bonobo/bonobo-persist-file.h>
#include "bonobo-media/bonobo-media-stream.h"
%}
%privateheader{
#include "bonobo-media-gstreamervideo.h"
#include "bonobo-media/bonobo-media-video.h"
#include <gstplay/gstplay.h>
%}
%{
#include <bonobo/bonobo-exception.h>
#include <bonobo-media/bonobo-media-stream-private.h>
%}
class Bonobo:Media:GStreamer from Bonobo:Media:Stream
{
private gint length;
private gint current_pos;
private GstPlay *play;
//private GtkWidget *play;
private guint timeout_id
destroy
{
if (VAR)
gtk_timeout_remove (VAR);
} = 0;
private gboolean update_position (self)
{
gint current_time = 0;
bonobo_media_stream_send_pos_notification (
BONOBO_MEDIA_STREAM (self),
current_time);
if (current_time == self->_priv->length)
bonobo_media_stream_send_end_notification (
BONOBO_MEDIA_STREAM (self));
return TRUE;
}
override (Bonobo:Media:Stream)
gfloat get_pos_per_sec (BonoboMediaStream *media_stream,
CORBA_Environment *ev)
{
gfloat ratio = 0;
/* Since position is in decoded values (to
avoid problems with variable bit-rate
streams), ratio is effectively the same as
the output sampling rate */
return ratio;
}
override (Bonobo:Media:Stream)
gint get_length (BonoboMediaStream *media_stream,
CORBA_Environment *ev)
{
return SELF (media_stream)->_priv->length;
}
override (Bonobo:Media:Stream)
void seek (BonoboMediaStream *media_stream,
gint pos,
CORBA_Environment *ev)
{
gint seek_success = TRUE;
BonoboMediaGStreamer *self = SELF (media_stream);
if (pos < 0 || pos > self->_priv->length) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Media_Stream_InvalidPosition,
NULL);
return;
}
if (!seek_success) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_Media_Stream_InvalidPosition,
NULL);
return;
}
update_position (self);
}
private gboolean playing = FALSE;
private void audio_init (self)
{
}
private void* player_func (self)
{
return NULL;
}
private void audio_cleanup (self)
{
}
override (Bonobo:Media:Stream)
void play (BonoboMediaStream *media_stream,
CORBA_Environment *ev)
{
BonoboMediaGStreamer *self = SELF (media_stream);
gst_play_play (self->_priv->play);
self->_priv->playing = TRUE;
if (!self->_priv->timeout_id)
self->_priv->timeout_id =
gtk_timeout_add (100, (GtkFunction)update_position, self);
}
override (Bonobo:Media:Stream)
void stop (BonoboMediaStream *media_stream,
CORBA_Environment *ev)
{
BonoboMediaGStreamer *self = SELF (media_stream);
self->_priv->playing = FALSE;
if (self->_priv->timeout_id)
gtk_timeout_remove (self->_priv->timeout_id);
self->_priv->timeout_id = 0;
}
private void volume_cb (GtkObject *obj, gfloat vol,
Bonobo:Media:GStreamer *self (check null type))
{
g_print ("Volume changed to %f\n", vol);
}
private void speaker_cb (GtkObject *obj,
Bonobo:Media:GStreamer *self (check null type))
{
audio_cleanup (self);
audio_init (self);
}
private void read_file_info (self)
{
}
public gint PersistFile_load (BonoboPersistFile *pf,
const CORBA_char *filename,
CORBA_Environment *ev,
Bonobo:Media:GStreamer *self (check null type))
{
load_file (self, filename);
return 0;
}
public gint PersistFile_save (BonoboPersistFile *pf,
const CORBA_char *filename,
CORBA_Environment *ev,
Bonobo:Media:GStreamer *self (check null type))
{
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_Bonobo_NotSupported, NULL);
return 0;
}
public void load_file (self, const gchar *filename)
{
gst_play_set_uri (self->_priv->play, filename);
}
private void construct (self)
{
Bonobo_Media_Stream corba_stream;
BonoboMediaVideo *gstreamer_video;
BonoboPersistFile *pf;
corba_stream = bonobo_media_stream_corba_object_create (BONOBO_OBJECT (self));
self->_priv->play = gst_play_new ();
//self->_priv->play = gtk_button_new ();
gstreamer_video = BONOBO_MEDIA_VIDEO (bonobo_media_gstreamervideo_new (self->_priv->play));
bonobo_object_add_interface (BONOBO_OBJECT (self), BONOBO_OBJECT (gstreamer_video));
pf = bonobo_persist_file_new
((BonoboPersistFileIOFn) PersistFile_load,
(BonoboPersistFileIOFn) PersistFile_save,
self);
bonobo_object_add_interface (BONOBO_OBJECT (self),
BONOBO_OBJECT (pf));
bonobo_media_stream_construct (BONOBO_MEDIA_STREAM (self), corba_stream);
}
public Bonobo:Media:GStreamer* new_from_file (const gchar *filename)
{
Self *self;
self = bonobo_media_gstreamer_new ();
construct (self);
load_file (self, filename);
return self;
}
public Bonobo:Media:GStreamer* new (void)
{
Self *self;
self = GET_NEW;
construct (self);
return self;
}
}

View file

@ -0,0 +1,30 @@
<oaf_info>
<oaf_server iid="OAFIID:Bonobo_Media_GStreamer_Factory" type="exe" location="bonobo-media-gstreamer">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Bonobo Media Ogg GStreamer player factory"/>
<oaf_attribute name="description" type="string" value="Bonobo Media Ogg GStreamer player factory"/>
</oaf_server>
<oaf_server iid="OAFIID:Bonobo_Media_GStreamer" type="factory" location="OAFIID:Bonobo_Media_GStreamer_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/Unknown:1.0"/>
<item value="IDL:Bonobo/Media/Stream:1.0"/>
<item value="IDL:Bonobo/EventSource:1.0"/>
<item value="IDL:Bonobo/Media/Audio:1.0"/>
<item value="IDL:Bonobo/Media/Video:1.0"/>
<item value="IDL:Bonobo/PersistFile:1.0"/>
<item value="IDL:Bonobo/Persist:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Bonobo Media Ogg GStreamer component"/>
<oaf_attribute name="description" type="string" value="Bonobo Media component for playing back Ogg
GStreamer files (uses libogg/libvorbis/libao as the backend)"/>
<oaf_attribute name="bonobo:editable" type="boolean" value="false"/>
<oaf_attribute name="bonobo:supported_mime_types" type="stringv">
<item value="video/mpeg"/>
<item value="audio/x-mp3"/>
</oaf_attribute>
</oaf_server>
</oaf_info>

View file

@ -0,0 +1,86 @@
/* vim: set syntax=c: -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
*/
%at{
/* bonobo-media-gstreamer: GStreamer player using the Bonobo:Meida interfaces
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Copyright (c) 2001 Ali Abdin <aliabdin@aucegypt.edu> and
* ÉRDI Gergõ <cactus@cactus.rulez.org>
* Wim Taymans <wim.taymans@chello.be>
*/
%}
%header{
#include <bonobo-media/Bonobo-Media.h>
#include <bonobo-media/bonobo-media-video.h>
#include <gstplay/gstplay.h>
%}
%privateheader{
%}
%{
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo-media/bonobo-media-video-private.h>
%}
class Bonobo:Media:GStreamervideo from Bonobo:Media:Video
{
private GstPlay *play;
//private GtkWidget *play;
override (Bonobo:Media:Video)
Bonobo_Control get_video_control (BonoboMediaVideo *video,
CORBA_Environment *ev)
{
BonoboControl *control;
Bonobo_Control bcontrol;
Self *self = SELF (video);
GtkWidget *button;
//button = gtk_button_new_with_label("test");
//gtk_widget_show (button);
//control = bonobo_control_new (button);
control = bonobo_control_new (GTK_WIDGET (self->_priv->play));
gtk_widget_realize (GTK_WIDGET (self->_priv->play));
bcontrol = bonobo_object_corba_objref (BONOBO_OBJECT (control));
return bcontrol;
}
public Bonobo:Media:GStreamervideo* new (GstPlay *play)
{
Self *self;
Bonobo_Media_Video corba_video;
BonoboMediaVideo *video;
self = GET_NEW;
corba_video = bonobo_media_video_corba_object_create (BONOBO_OBJECT (self));
self->_priv->play = play;
video = bonobo_media_video_construct (BONOBO_MEDIA_VIDEO (self), corba_video);
return self;
}
}

View file

@ -117,16 +117,22 @@ dnl ==============================================
dnl Determine CPU
case "x${target_cpu}" in
xi?86) HAVE_CPU_I386=yes ;
AC_DEFINE(HAVE_CPU_I386) ;;
xpowerpc) HAVE_CPU_PPC=yes ;
AC_DEFINE(HAVE_CPU_PPC) ;;
xalpha) HAVE_CPU_ALPHA=yes ;
AC_DEFINE(HAVE_CPU_ALPHA) ;;
xarm*) HAVE_CPU_ARM=yes ;
AC_DEFINE(HAVE_CPU_ARM) ;;
xsparc*) HAVE_CPU_SPARC=yes ;
AC_DEFINE(HAVE_CPU_SPARC) ;;
xi?86 | k?) HAVE_CPU_I386=yes
AC_DEFINE(HAVE_CPU_I386)
dnl FIXME could use some better detection
dnl (ie CPUID)
case "x${target_cpu}" in
xi386 | xi486) ;;
*) AC_DEFINE(HAVE_RDTSC) ;;
esac ;;
xpowerpc) HAVE_CPU_PPC=yes
AC_DEFINE(HAVE_CPU_PPC) ;;
xalpha) HAVE_CPU_ALPHA=yes
AC_DEFINE(HAVE_CPU_ALPHA) ;;
xarm*) HAVE_CPU_ARM=yes
AC_DEFINE(HAVE_CPU_ARM) ;;
xsparc*) HAVE_CPU_SPARC=yes
AC_DEFINE(HAVE_CPU_SPARC) ;;
esac
dnl Determine endianness
@ -219,7 +225,15 @@ if test x$ARTSC_CONFIG = xno; then
else
ARTSC_LIBS=`artsc-config --libs`
ARTSC_CFLAGS=`artsc-config --cflags`
HAVE_ARTSC=yes
dnl AC_CHECK_HEADER uses CPPFLAGS, but not CFLAGS.
dnl Assume only suitable flags result from artsc-config --cflags
artsc_save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$CPPFLAGS $ARTSC_CFLAGS"
AC_CHECK_HEADER(artsc.h,
HAVE_ARTSC=yes,
HAVE_ARTSC=no
)
CPPFLAGS=$artsc_save_CPPFLAGS
fi
AC_SUBST(ARTSC_LIBS)
AC_SUBST(ARTSC_CFLAGS)
@ -249,6 +263,34 @@ AC_ARG_ENABLE(alsasink,
esac],
[HAVE_LIBASOUND=$HAVE_LIBASOUND])
dnl Check for libaudiofile
AC_PATH_PROG(AUDIOFILE_CONFIG, audiofile-config, no)
if test x$AUDIOFILE_CONFIG = xno; then
AC_MSG_WARN(Couldn't find audiofile-config: can't build afsink)
AUDIOFILE_LIBS=
HAVE_LIBAUDIOFILE=no
else
AC_MSG_WARN(did find audiofile-config: delete this msg)
AUDIOFILE_LIBS=`audiofile-config --libs`
HAVE_LIBAUDIOFILE=yes
fi
AC_SUBST(AUDIOFILE_LIBS)
alsa_save_LIBS=$LIBS
alsa_save_CFLAGS=$CFLAGS
AM_PATH_ALSA(0.5.0, HAVE_LIBASOUND=yes, HAVE_LIBASOUND=no)
LIBS=$alsa_save_LIBS
CFLAGS=$alsa_save_CFLAGS
AC_ARG_ENABLE(alsasink,
[ --enable-alsasink enable the building of the alsasink],
[case "${enableval}" in
yes) HAVE_LIBASOUND=$HAVE_LIBASOUND ;;
no) HAVE_LIBASOUND=no ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-alsasink) ;;
esac],
[HAVE_LIBASOUND=$HAVE_LIBASOUND])
dnl Check for libgdk-pixbuf
AC_PATH_PROG(GDK_PIXBUF_CONFIG, gdk-pixbuf-config, no)
if test x$GDK_PIXBUF_CONFIG = xno; then
@ -323,6 +365,21 @@ fi
AC_SUBST(LIBGLADE_GNOME_LIBS)
AC_SUBST(LIBGLADE_GNOME_CFLAGS)
dnl Check for Gnome VFS
HAVE_GNOME_VFS="no"
AC_MSG_CHECKING(for Gnome VFS)
if gnome-config --libs vfs > /dev/null 2>&1; then
HAVE_GNOME_VFS="yes"
AC_MSG_RESULT(found)
else
AC_MSG_WARN(Did not find Gnome-VFS installed)
fi
VFS_LIBS="`gnome-config --libs vfs`"
VFS_CFLAGS="`gnome-config --cflags vfs`"
AC_SUBST(VFS_LIBS)
AC_SUBST(VFS_CFLAGS)
dnl Check for atomic.h
dnl Note: use AC_CHECK_HEADER not AC_CHECK_HEADERS, because the latter
@ -367,6 +424,8 @@ AC_CHECK_LIB(Xv, XvQueryExtension,
$X_LIBS $X_PRE_LIBS -lXext -lX11 $X_EXTRA_LIBS
)
LIBS=${xvsave_LIBS}
AC_CHECK_HEADER(X11/extensions/Xv.h, :, HAVE_LIBXV=no)
AC_CHECK_HEADER(X11/extensions/Xvlib.h, :, HAVE_LIBXV=no)
dnl Check for OSS audio
AC_CHECK_HEADER(sys/soundcard.h,
@ -427,6 +486,7 @@ AC_CHECK_LIB(Hermes, Hermes_ConverterInstance,
)
HAVE_LIBHERMES=no,
)
AC_CHECK_HEADER(Hermes/Hermes.h, :, HAVE_LIBHERMES=no)
dnl Check for cdparanoia
AC_MSG_CHECKING(CDparanoia library)
@ -454,6 +514,9 @@ AC_CHECK_HEADER(mpeg2dec/mpeg2.h, :, HAVE_MPEG2DEC=no)
dnl Check for librtp
AC_MSG_CHECKING(rtp library)
AC_CHECK_LIB(rtp, rtp_packet_new_take_data, HAVE_LIBRTP=yes, HAVE_LIBRTP=no, $GLIB_LIBS $GLIB_CFLAGS)
AC_CHECK_HEADER(rtp/rtp-packet.h, :, HAVE_LIBRTP=no)
AC_CHECK_HEADER(rtp/rtcp-packet.h, :, HAVE_LIBRTP=no)
AC_CHECK_HEADER(rtp/rtp-audio.h, :, HAVE_LIBRTP=no)
dnl Check for arts
AC_LANG_SAVE
@ -466,14 +529,17 @@ AC_LANG_RESTORE
dnl Check for libraw1394
AC_MSG_CHECKING(raw1394 library)
AC_CHECK_LIB(raw1394, raw1394_get_handle, HAVE_RAW1394=yes, HAVE_RAW1394=no, )
AC_CHECK_HEADER(libraw1394/raw1394.h, :, HAVE_RAW1394=no)
dnl Check for libdv
AC_MSG_CHECKING(libdv)
AC_CHECK_LIB(dv, dv_init, HAVE_LIBDV=yes, HAVE_LIBDV=no, -lm $GLIB_LIBS $GLIB_CFLAGS)
AC_CHECK_HEADER(libdv/dv.h, :, HAVE_LIBDV=no)
dnl Check for aalib
AC_MSG_CHECKING(aalib)
AC_CHECK_LIB(aa, aa_init, HAVE_LIBAA=yes, HAVE_LIBAA=no, )
AC_CHECK_HEADER(aalib.h, :, HAVE_LIBAA=no)
dnl check if css-auth.c exists (FIXME)
@ -482,21 +548,39 @@ if test -f plugins/dvdsrc/css-auth.c
then
AC_MSG_RESULT(yes)
HAVE_CSSAUTH="yes"
AC_DEFINE(HAVE_CSSAUTH)
else
AC_MSG_RESULT(no)
HAVE_CSSAUTH="no"
fi
dnl Check for SDLlib
AC_MSG_CHECKING(SDLlib)
AC_CHECK_LIB(SDL, SDL_Init, HAVE_LIBSDL=yes, HAVE_LIBSDL=no, -L/usr/lib -L/usr/local/lib -lpthread)
AC_CHECK_HEADER(SDL/SDL.h, :, HAVE_LIBSDL=no)
dnl Check for SDL
HAVE_LIBSDL="no"
AC_MSG_CHECKING(for SDL)
if sdl-config --libs > /dev/null 2>&1; then
HAVE_LIBSDL="yes"
AC_MSG_RESULT(found)
else
AC_MSG_RESULT(not found)
fi
SDL_LIBS="`sdl-config --libs`"
SDL_CFLAGS="`sdl-config --cflags`"
AC_SUBST(SDL_LIBS)
AC_SUBST(SDL_CFLAGS)
dnl Check for linux/cdrom.h
AC_CHECK_HEADER(linux/cdrom.h,
AC_DEFINE(HAVE_LINUX_CDROM)
HAVE_LINUX_CDROM=yes, []
)
dnl Check for linux/videodev.h
AC_CHECK_HEADER(linux/videodev.h,
AC_DEFINE(HAVE_LINUX_VIDEODEV)
HAVE_LINUX_VIDEODEV=yes, []
)
@ -706,6 +790,58 @@ else
FOMIT_FRAME_POINTER="-fomit-frame-pointer"
fi
if test "x$HAVE_LIBXV" = xyes; then
AC_DEFINE(HAVE_LIBXV)
fi
if test "x$HAVE_OSS" = xyes; then
AC_DEFINE(HAVE_OSS)
fi
if test "x$HAVE_XAUDIO" = xyes; then
AC_DEFINE(HAVE_XAUDIO)
fi
if test "x$HAVE_LIBMAD" = xyes; then
AC_DEFINE(HAVE_LIBMAD)
fi
if test "x$HAVE_VORBIS" = xyes; then
AC_DEFINE(HAVE_VORBIS)
fi
if test "x$HAVE_LIBJPEG" = xyes; then
AC_DEFINE(HAVE_LIBJPEG)
fi
if test "x$HAVE_LIBSDL" = xyes; then
AC_DEFINE(HAVE_LIBSDL)
fi
if test "x$HAVE_LIBHERMES" = "xyes"; then
AC_DEFINE(HAVE_LIBHERMES)
fi
if test "x$HAVE_CSSAUTH" = xyes; then
AC_DEFINE(HAVE_CSSAUTH)
fi
if test "x$HAVE_LINUX_CDROM" = xyes; then
AC_DEFINE(HAVE_LINUX_CDROM)
fi
if test "x$HAVE_LINUX_VIDEODEV" = xyes; then
AC_DEFINE(HAVE_LINUX_VIDEODEV)
fi
if test "x$HAVE_MPEG2DEC" = xyes; then
AC_DEFINE(HAVE_MPEG2DEC)
fi
if test "x$HAVE_LIBAUDIOFILE" = xyes; then
AC_DEFINE(HAVE_LIBAUDIOFILE)
fi
dnl #############################
dnl # Set automake conditionals #
dnl #############################
@ -719,6 +855,7 @@ AM_CONDITIONAL(HAVE_CPU_ARM, test "x$HAVE_CPU_ARM" = "xyes")
AM_CONDITIONAL(HAVE_CPU_SPARC, test "x$HAVE_CPU_SPARC" = "xyes")
AM_CONDITIONAL(HAVE_GDK_PIXBUF, test "x$USE_GDK_PIXBUF" = "xyes")
AM_CONDITIONAL(HAVE_LIBGHTTP, test "x$USE_LIBGHTTP" = "xyes")
AM_CONDITIONAL(HAVE_LIBAUDIOFILE, test "x$HAVE_LIBAUDIOFILE" = "xyes")
AM_CONDITIONAL(HAVE_LIBMMX, test "x$USE_LIBMMX" = "xyes")
AM_CONDITIONAL(HAVE_ATOMIC_H, test "x$USE_ATOMIC_H" = "xyes")
AM_CONDITIONAL(HAVE_OSS, test "x$HAVE_OSS" = "xyes")
@ -729,6 +866,7 @@ AM_CONDITIONAL(HAVE_LINUX_VIDEODEV, test "x$HAVE_LINUX_VIDEODEV" = "xyes")
AM_CONDITIONAL(HAVE_CSSAUTH, test "x$HAVE_CSSAUTH" = "xyes")
AM_CONDITIONAL(HAVE_VORBIS, test "x$HAVE_VORBIS" = "xyes")
AM_CONDITIONAL(HAVE_LIBJPEG, test "x$HAVE_LIBJPEG" = "xyes")
AM_CONDITIONAL(HAVE_LIBSDL, test "x$HAVE_LIBSDL" = "xyes")
AM_CONDITIONAL(HAVE_LIBHERMES, test "x$HAVE_LIBHERMES" = "xyes")
AM_CONDITIONAL(HAVE_NASM, test "x$HAVE_NASM" = "xyes")
AM_CONDITIONAL(HAVE_LIBGLADE_GNOME, test "x$HAVE_LIBGLADE_GNOME" = "xyes")
@ -755,6 +893,7 @@ AM_CONDITIONAL(HAVE_ARTS, test "x$HAVE_ARTS" = "xyes")
AM_CONDITIONAL(HAVE_RAW1394, test "x$HAVE_RAW1394" = "xyes")
AM_CONDITIONAL(HAVE_LIBDV, test "x$HAVE_LIBDV" = "xyes")
AM_CONDITIONAL(HAVE_LIBAA, test "x$HAVE_LIBAA" = "xyes")
AM_CONDITIONAL(HAVE_GNOME_VFS, test "x$HAVE_GNOME_VFS" = "xyes")
@ -856,6 +995,7 @@ plugins/Makefile
plugins/aasink/Makefile
plugins/alsa/Makefile
plugins/au/Makefile
plugins/audiofile/Makefile
plugins/audioscale/Makefile
plugins/avi/Makefile
plugins/avi/wincodec/Makefile
@ -898,11 +1038,14 @@ plugins/filters/smooth/Makefile
plugins/filters/median/Makefile
plugins/filters/ladspa/Makefile
plugins/filters/stereo2mono/Makefile
plugins/filters/mono2stereo/Makefile
plugins/filters/intfloatconvert/Makefile
plugins/filters/passthrough/Makefile
plugins/filters/adder/Makefile
plugins/filters/colorspace/Makefile
plugins/filters/volenv/Makefile
plugins/filters/adder/Makefile
plugins/filters/level/Makefile
plugins/gnomevfs/Makefile
plugins/icecast/Makefile
plugins/icecast/icecastsend/Makefile
plugins/effects/Makefile
@ -927,9 +1070,11 @@ plugins/cdparanoia/Makefile
plugins/esd/Makefile
plugins/esd/esdsink/Makefile
plugins/artsd/Makefile
plugins/quicktime/Makefile
plugins/xmms/Makefile
plugins/arts/Makefile
plugins/1394/Makefile
plugins/sdlsink/Makefile
plugins/dv/Makefile
gstplay/Makefile
dnl components/bonobo-gstmediaplay/Makefile

4
debian/Makefile.am vendored
View file

@ -10,13 +10,17 @@ EXTRA_DIST = \
gstmediaplay.files \
gstmediaplay.manpages \
gstmediaplay.menu \
gstreamer-aa.files \
gstreamer-alsa.files \
gstreamer-arts.files \
gstreamer-cdparanoia.files \
gstreamer-colorspace.files \
gstreamer-common.files \
gstreamer-doc.files \
gstreamer-elements.files \
gstreamer-esd.files \
gstreamer-lame.files \
gstreamer-mad.files \
gstreamer-mpeg2dec.files \
gstreamer-mpg123.files \
gstreamer-plugin-template.postinst \

21
debian/changelog vendored
View file

@ -1,3 +1,24 @@
gstreamer (0.1.1.20010504-1) unstable; urgency=low
* Latest CVS code
-- David I. Lehn <dlehn@vt.edu> Fri, 4 May 2001 21:48:45 -0400
gstreamer (0.1.1.20010430-2) unstable; urgency=low
* Added -colorspace package for Hermes dependent conversion
* Added -arts package for aRts sink
-- David I. Lehn <dlehn@vt.edu> Tue, 1 May 2001 19:46:08 -0400
gstreamer (0.1.1.20010430-1) unstable; urgency=low
* Latest CVS code
* Added -aa package for aasink output
* Added -mad package for mad mp3 decoder
-- David I. Lehn <dlehn@vt.edu> Mon, 30 Apr 2001 18:25:52 -0400
gstreamer (0.1.1.20010320-1) unstable; urgency=low
* Latest CVS code

50
debian/control vendored
View file

@ -2,8 +2,8 @@ Source: gstreamer
Section: x11
Priority: optional
Maintainer: David I. Lehn <dlehn@vt.edu>
Build-Depends: debhelper (>= 3.0.0), libxml-dev (>= 1.8.10), zlib1g-dev (>= 1:1.1.3), libghttp-dev (>= 1.0.6), libglib-dev (>= 1.2.8), libgtk1.2-dev (>= 1.2.8), libglade0-dev (>= 0.14), libglade-gnome0-dev (>= 0.14), libesd0-dev (>= 0.2.22), libcdparanoia0-dev (>= 3a9.7), libvorbis-dev (>= 1.0beta3), libgnome-dev (>= 1.2.11), libasound1-dev (>= 0.5.10), libghttp-dev (>= 1.0.9), libjpeg62-dev (>= 6b)
Build-Depends-Indep: debhelper (>= 3.0.0), gtk-doc-tools (>= 0.4.0), jade (>= 1.2.1), transfig (>= 3.2.3.c)
Build-Depends: debhelper (>= 3.0.0), libxml-dev (>= 1.8.10), zlib1g-dev (>= 1:1.1.3), libghttp-dev (>= 1.0.6), libglib1.2-dev (>= 1.2.8), libgtk1.2-dev (>= 1.2.8), libglade0-dev (>= 0.14), libglade-gnome0-dev (>= 0.14), libesd0-dev (>= 0.2.22), libcdparanoia0-dev (>= 3a9.7), libvorbis-dev (>= 1.0beta3), libgnome-dev (>= 1.2.11), libasound1-dev (>= 0.5.10), libghttp-dev (>= 1.0.9), libjpeg62-dev (>= 6b), aalib1-dev (>= 1.4p4), libmad0-dev (>= 0.13.0b), hermes1-dev (>= 1.3.1), libarts-dev (>= 2.1.2)
Build-Depends-Indep: debhelper (>= 3.0.0), gtk-doc-tools (>= 0.4), jade (>= 1.2.1), transfig (>= 3.2.3.c)
Standards-Version: 3.5.2.0
Package: libgst0
@ -91,24 +91,45 @@ Suggests: gstreamer-common
Description: GStreamer editor
GStreamer editor
Package: gstreamer-aa
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: AA-lib plugin for GStreamer
AA-lib plugin for GStreamer
Package: gstreamer-alsa
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: ALSA plugin for GStreamer
ALSA plugin for GStreamer
Package: gstreamer-arts
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: aRts plugin for GStreamer
aRts plugin for GStreamer
Package: gstreamer-cdparanoia
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: cdparanoia plugin for GStreamer
cdparanoia plugin for GStreamer
Package: gstreamer-colorspace
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: colorspace conversion plugin for GStreamer
colorspace conversion plugin for GStreamer
Package: gstreamer-common
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: Collection of GStreamer plugins
Collection of GStreamer plugins
.
@ -117,41 +138,48 @@ Description: Collection of GStreamer plugins
Package: gstreamer-elements
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: Core elements plugin for GStreamer
Core elements plugin for GStreamer
Package: gstreamer-esd
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: Enlightened Sound Daemon plugin for GStreamer
Enlightened Sound Daemon plugin for GStreamer
Package: gstreamer-lame
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: LAME plugin for GStreamer
LAME plugin for GStreamer
Package: gstreamer-mad
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: MAD MPEG audio decoder plugin for GStreamer
MAD MPEG audio decoder plugin for GStreamer
Package: gstreamer-mpeg2dec
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: mpeg2dec plugin for GStreamer
mpeg2dec plugin for GStreamer
Package: gstreamer-mpg123
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: mpg123 plugin for GStreamer
mpg123 plugin for GStreamer
Package: gstreamer-vorbis
Architecture: any
Section: libs
Depends: ${shlibs:Depends}, gstreamer-runtime
Depends: ${shlibs:Depends}, gstreamer-runtime (= ${Source-Version})
Description: Vorbis plugin for GStreamer
Vorbis plugin for GStreamer

1
debian/gstreamer-aa.files vendored Normal file
View file

@ -0,0 +1 @@
usr/lib/gst/libaasink.*

1
debian/gstreamer-arts.files vendored Normal file
View file

@ -0,0 +1 @@
usr/lib/gst/libartsdsink.*

1
debian/gstreamer-colorspace.files vendored Normal file
View file

@ -0,0 +1 @@
usr/lib/gst/libcolorspace.*

View file

@ -1,47 +1,58 @@
usr/lib/gst/libgstriff.*
usr/lib/gst/libgstcolorspace.*
usr/lib/gst/libgstgetbits.*
usr/lib/gst/libgstparsewav.*
usr/lib/gst/libgstputbits.*
usr/lib/gst/libgstidct.*
usr/lib/gst/libgsttypes.*
usr/lib/gst/libgstvideoscale.*
usr/lib/gst/libwinloader.*
usr/lib/gst/libgstparseau.*
usr/lib/gst/libmp3parse.*
usr/lib/gst/libmp3types.*
usr/lib/gst/libstereo.*
usr/lib/gst/libvolume.*
usr/lib/gst/libgstspectrum.*
usr/lib/gst/libvumeter.*
usr/lib/gst/libsynaesthesia.*
usr/lib/gst/libsmoothwave.*
usr/lib/gst/libmpeg2parse.*
usr/lib/gst/libac3dec.*
usr/lib/gst/libac3parse.*
usr/lib/gst/libmpeg2play.*
usr/lib/gst/libmpeg2enc.*
usr/lib/gst/libmpeg2subt.*
usr/lib/gst/libmp2videoparse.*
usr/lib/gst/libmpeg2types.*
usr/lib/gst/libmpeg1parse.*
usr/lib/gst/libmpeg_play.*
usr/lib/gst/libmpeg1encoder.*
usr/lib/gst/libsystem_encode.*
usr/lib/gst/libmpegaudio.*
usr/lib/gst/libmpeg1types.*
usr/lib/gst/libvcdsrc.*
usr/lib/gst/librtjpeg.*
usr/lib/gst/libvideosink.*
usr/lib/gst/libv4lsrc.*
usr/lib/gst/libjpeg.*
usr/lib/gst/libmp1videoparse.*
usr/lib/gst/libvideoscale.*
usr/lib/gst/libsmooth.*
usr/lib/gst/libmedian.*
usr/lib/gst/libgstladspa.*
usr/lib/gst/libadder.*
usr/lib/gst/libalaw.*
usr/lib/gst/libaudioscale.*
usr/lib/gst/libwincodec.*
usr/lib/gst/libaviencoder.*
usr/lib/gst/libavidecoder.*
usr/lib/gst/libaviencoder.*
usr/lib/gst/libdvdsrc.*
usr/lib/gst/libflxdec.*
usr/lib/gst/libgstcolorspace.*
usr/lib/gst/libgstgetbits.*
usr/lib/gst/libgstidct.*
usr/lib/gst/libgstladspa.*
usr/lib/gst/libgstossaudio.*
usr/lib/gst/libgstparseau.*
usr/lib/gst/libgstparsewav.*
usr/lib/gst/libgstputbits.*
usr/lib/gst/libgstriff.*
usr/lib/gst/libgstspectrum.*
usr/lib/gst/libgsttypes.*
usr/lib/gst/libgstvideoscale.*
usr/lib/gst/libintfloatconvert.*
usr/lib/gst/libjpeg.*
usr/lib/gst/libmedian.*
usr/lib/gst/libmono2stereo.*
usr/lib/gst/libmp1videoparse.*
usr/lib/gst/libmp2videoparse.*
usr/lib/gst/libmp3parse.*
usr/lib/gst/libmp3types.*
usr/lib/gst/libmpeg1encoder.*
usr/lib/gst/libmpeg1parse.*
usr/lib/gst/libmpeg1types.*
usr/lib/gst/libmpeg2enc.*
usr/lib/gst/libmpeg2parse.*
usr/lib/gst/libmpeg2play.*
usr/lib/gst/libmpeg2subt.*
usr/lib/gst/libmpeg2types.*
usr/lib/gst/libmpeg_play.*
usr/lib/gst/libmpegaudio.*
usr/lib/gst/libmulaw.*
usr/lib/gst/libpassthrough.*
usr/lib/gst/librtjpeg.*
usr/lib/gst/libsmooth.*
usr/lib/gst/libsmoothwave.*
usr/lib/gst/libstereo.*
usr/lib/gst/libstereo2mono.*
usr/lib/gst/libsynaesthesia.*
usr/lib/gst/libsystem_encode.*
usr/lib/gst/libv4lsrc.*
usr/lib/gst/libvcdsrc.*
usr/lib/gst/libvideoscale.*
usr/lib/gst/libvideosink.*
usr/lib/gst/libvolenv.*
usr/lib/gst/libvolume.*
usr/lib/gst/libvumeter.*
usr/lib/gst/libwincodec.*
usr/lib/gst/libwinloader.*
usr/lib/gst/libxvideosink.*

1
debian/gstreamer-mad.files vendored Normal file
View file

@ -0,0 +1 @@
usr/lib/gst/libgstmad.*

2
debian/rules vendored
View file

@ -16,7 +16,7 @@ export DH_OPTIONS
# Link special names to a template file.
# still need "*.files" to be done by hand
PLUGINS=alsa cdparanoia common elements esd lame mpeg2dec mpg123 vorbis
PLUGINS=aa alsa arts cdparanoia colorspace common elements esd lame mad mpeg2dec mpg123 vorbis
setup-links:
for i in $(PLUGINS); do \

View file

@ -254,43 +254,69 @@
<para>
<emphasis>audio/raw</emphasis>
- Unstructured and uncompressed raw audio data.
</para><para>
<emphasis>law</emphasis>
- The law used to describe the data. This is an integer for which
there are three valid values: 0 for linear, 1 for
mu law, 2 for A law.
</para><para>
<emphasis>endianness</emphasis>
- The order of bytes in a sample. This is a boolean:
0 means little-endian (ie, bytes are least significant first),
1 means big-endian (ie, most significant byte first).
</para><para>
<emphasis>signed</emphasis>
- Whether the samples are signed or not. This is a boolean:
0 means unsigned, 1 means signed.
</para><para>
<emphasis>width</emphasis>
- The number of bits per sample. This is extremely likely to be
a multiple of 8, but as ever this is up to each element supporting
this format to specify.
</para><para>
<emphasis>depth</emphasis>
- The number of bits used per sample. This must be less than or
equal to the width: if less than the width, the low bits are
assumed to be the ones used. For example, width=32, depth=24
means that each sample is stored in a 32 bit word, but only the
low 24 bits are actually used.
</para><para>
<emphasis>rate</emphasis>
- The sample rate of the data, in samples per second.
</para><para>
<emphasis>channels</emphasis>
- The number of channels of audio data.
</para><para>
<emphasis>format</emphasis>
- This describes the format in which the audio data is passed.
This is a string for which there are currently two valid values:
"int" for integer data and "float" for floating point data.
</para><para>
<emphasis>law</emphasis>
- Valid only if format=int. The law used to describe the data.
This is an integer for which there are three valid values: 0 for
linear, 1 for mu law, 2 for A law.
</para><para>
<emphasis>endianness</emphasis>
- Valid only if format=int. The order of bytes in a sample. This
is a boolean: 0 means little-endian (ie, bytes are least
significant first), 1 means big-endian (ie, most significant byte
first).
</para><para>
<emphasis>signed</emphasis>
- Valid only if format=int. Whether the samples are signed or not.
This is a boolean: 0 means unsigned, 1 means signed.
</para><para>
<emphasis>width</emphasis>
- Valid only if format=int. The number of bits per sample. This
is extremely likely to be a multiple of 8, but as ever this is up
to each element supporting this format to specify.
</para><para>
<emphasis>depth</emphasis>
- Valid only if format=int. The number of bits used per sample.
This must be less than or equal to the width: if less than the
width, the low bits are assumed to be the ones used. For example,
width=32, depth=24 means that each sample is stored in a 32 bit
word, but only the low 24 bits are actually used.
</para><para>
<emphasis>layout</emphasis>
- Valid only if format=float. A string representing the way in
which the floating point data is represented. For now, the only
valid value is gfloat, meaning that the data is passed as a series
of gfloat values.
</para><para>
<emphasis>intercept</emphasis>
- Valid only if format=float. A floating point value representing
the value that the signal "centres" on.
</para><para>
<emphasis>slope</emphasis>
- Valid only if format=float. A floating point value representing
how far the signal deviates from the intercept. So a slope of 1.0
and an intercept of 0.0 would mean an audio signal with minimum
and maximum values of -1.0 and 1.0. A slope of 0.5 and intercept
of 0.5 would represent values in the range 0.0 to 1.0.
</para>
<para>
For example: 16 bit, unsigned, linear, monophonic, big-endian,
For example: 16 bit integer, unsigned, linear, monophonic, big-endian,
44100KHz audio would be represented by
"law=0,endianness=1,signed=0,width=16,depth=16,rate=44100,channels=1"
"format=int,law=0,endianness=1,signed=0,width=16,depth=16,rate=44100,channels=1"
and floating point, using gfloat's, in the range -1.0 to 1.0,
8000KHz stereo audio would be represented by
"format=float,layout=gfloat,intercept=0.0,slope=1.0,rate=8000,channels=2"
</para>
</listitem>
</itemizedlist>

View file

@ -2,9 +2,6 @@
<SECTION>
<FILE>cothreads</FILE>
COTHREAD_STACKSIZE
COTHREAD_MAXTHREADS
STACK_SIZE
CURRENT_STACK_FRAME
cothread_state
cothread_context
@ -64,6 +61,8 @@ GST_DEBUG_FUNCPTR_NAME
GST_DEBUG_PAD_NAME
GST_ERROR
GST_ERROR_OBJECT
GST_DEBUG_CHAR_MODE
gst_default_error_handler
GstInfoHandler
GstErrorHandler
@ -147,6 +146,8 @@ GST_BUFFER_PARENT
GST_BUFFER_MAXAGE
GstBufferCopyFunc
GstBufferFreeFunc
GstBufferFlags
GstBuffer
gst_buffer_new
@ -158,10 +159,6 @@ gst_buffer_ref
gst_buffer_ref_by_count
gst_buffer_unref
gst_buffer_destroy
gst_buffer_add_meta
gst_buffer_get_first_meta
gst_buffer_get_metas
gst_buffer_remove_meta
<SUBSECTION Standard>
GST_BUFFER
</SECTION>
@ -598,6 +595,7 @@ GstTraceEntry
gst_trace_new
gst_trace_destroy
gst_trace_flush
gst_trace_text_flush
gst_trace_get_size
gst_trace_get_offset
gst_trace_get_remaining
@ -658,6 +656,8 @@ gst_caps_get_by_name
gst_caps_get_fourcc_int
gst_caps_get_int
gst_caps_get_string
gst_caps_get_float
gst_caps_save_thyself
gst_caps_load_thyself
@ -693,6 +693,7 @@ gst_props_get_boolean
gst_props_get_fourcc_int
gst_props_get_int
gst_props_get_string
gst_props_get_float
gst_props_save_thyself
gst_props_load_thyself
<SUBSECTION Standard>
@ -894,6 +895,7 @@ GST_IS_QUEUE_CLASS
GstSineSrc
GstSineSrcClass
gst_sinesrc_get_type
gst_sinesrc_factory_init
GST_TYPE_SINESRC
GST_SINESRC
GST_SINESRC_CLASS

View file

@ -1,4 +1,7 @@
GtkObject
GtkWidget
GtkRange
GtkContainer
GstObject
GstXML
GstElement

View file

@ -196,6 +196,23 @@ Get the maximun age of a buffer.
@buf: GstBuffer to get the maxage of.
<!-- ##### USER_FUNCTION GstBufferCopyFunc ##### -->
<para>
This function is used to copy the buffer contents.
</para>
@srcbuf: the src buffer
@dstbuf: the destination buffer
<!-- ##### USER_FUNCTION GstBufferFreeFunc ##### -->
<para>
The function called when the buffer data has to be freed
</para>
@buf: the buffer to clear the buffer data of.
<!-- ##### ENUM GstBufferFlags ##### -->
<para>

View file

@ -366,6 +366,15 @@ Get the value of the named property as a string.
@name: the name of the property to get
<!-- ##### MACRO gst_caps_get_float ##### -->
<para>
Get the value of the named property as a float.
</para>
@caps: the caps to query
@name: the name of the property to get
<!-- ##### FUNCTION gst_caps_save_thyself ##### -->
<para>

View file

@ -229,6 +229,7 @@ Print out debugging information.
</para>
@cat:
@format:
@args...:
@ -277,6 +278,13 @@ Print out an error condition and abort the application.
@args...: printf arguments
<!-- ##### MACRO GST_DEBUG_CHAR_MODE ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_default_error_handler ##### -->
<para>

View file

@ -726,7 +726,6 @@ Get the type of the region that is being pulled.
@regiontype:
@offset:
@len:
@sched:
@chainfunc:
@getfunc:
@getregionfunc:

View file

@ -259,6 +259,16 @@ Create a float range value.
@Returns:
<!-- ##### FUNCTION gst_props_get_float ##### -->
<para>
</para>
@props:
@name:
@Returns:
<!-- ##### FUNCTION gst_props_save_thyself ##### -->
<para>

View file

@ -651,14 +651,6 @@ Specify the current offset in the file.
</para>
<!-- ##### FUNCTION gst_element_get_manager ##### -->
<para>
</para>
@element:
@Returns:
<!-- ##### STRUCT MetaDGA ##### -->
<para>
@ -1712,14 +1704,6 @@ GstSrc
@props:
@Returns:
<!-- ##### FUNCTION gst_element_set_manager ##### -->
<para>
</para>
@element:
@manager:
<!-- ##### MACRO GST_TYPE_AUDIOSRC ##### -->
<para>

View file

@ -3,6 +3,7 @@ htmlname = index.html
sgml_files = gstreamer-manual.sgml \
advanced.sgml \
autoplugging.sgml \
bins.sgml \
buffers.sgml \
components.sgml \

View file

@ -0,0 +1,99 @@
<chapter id="cha-autoplug">
<title>Autoplugging</title>
<para>
<application>GStreamer</application> provides an API to automatically
construct complex pipelinebased on source and destination capabilities.
This feature is very usefull if you want to convert type X to type Y but
don't care about the plugins needed to accomplish this task. The
autoplugger will consult the plugin repository, select and connect the
elements needed for the conversion.
</para>
<para>
The autoplugger API is implemented in an abstract class. Autoplugger implementations
reside in plugins and are therefore optional and can be optimized for a specific
task. Two types of autopluggers exist: renderer ones and non
renderer ones. the renderer autopluggers will not have any src pads while the
non renderer ones do. The renderer autopluggers are mainly used for media
playback while the non renderer ones are used for arbitrary format conversion.
</para>
<sect1>
<title>Using autoplugging</title>
<para>
You first need to create a suitable autoplugger with gst_autoplugfactory_make().
The name of the autoplugger must be one of the registered autopluggers..
</para>
<para>
A list of all available autopluggers can be obtained with gst_autoplugfactory_get_list().
</para>
<para>
If the autoplugger supports the RENDERER API, use gst_autoplug_to_renderers() call to
create a bin that connectes the src caps to the specified render elements. You can
then add the bin to a pipeline and run it.
<programlisting>
GstAutoplug *autoplug;
GstElement *element;
GstElement *sink;
/* create a static autoplugger */
autoplug = gst_autoplugfactory_make ("staticrender");
/* create an osssink */
sink = gst_elementfactory_make ("osssink", "our_sink");
/* create an element that can play audio/mp3 through osssink */
element = gst_autoplug_to_renderers (autoplug,
gst_caps_new (
"sink_audio_caps",
"audio/mp3",
NULL
),
sink,
NULL);
/* add the element to a bin and connect the sink pad */
...
</programlisting>
</para>
<para>
If the autoplugger supports the CAPS API, use the gst_autoplug_to_caps() function to
connect the src caps to the destination caps. The created bin will have src and sink
pads compatible with the provided caps.
<programlisting>
GstAutoplug *autoplug;
GstElement *element;
/* create a static autoplugger */
autoplug = gst_autoplugfactory_make ("static");
/* create an element that converts audio/mp3 to audio/raw */
element = gst_autoplug_to_caps (autoplug,
gst_caps_new (
"sink_audio_caps",
"audio/mp3",
NULL
),
gst_caps_new (
"src_audio_caps",
"audio/raw",
NULL
),
NULL);
/* add the element to a bin and connect the src/sink pads */
...
</programlisting>
</para>
</sect1>
<sect1>
<title>A complete autoplugging example</title>
<para>
We will create and explain how a complete media player can be built with the
autoplugger.
</para>
</sect1>
</chapter>

View file

@ -34,7 +34,7 @@
<listitem>
<para>
A thread (<classname>GstThread</classname>). All the elements in the thread bin will
run in a separate thread. You will haver to use this bin if you carfully have to
run in a separate thread. You will have to use this bin if you carfully have to
synchronize audio and video for example. You will learn more about threads in.. <!-- FIXME -->
</para>
</listitem>

View file

@ -27,17 +27,6 @@
will be used to destroy the buffer when no element is having a reference to it.
</para>
</listitem>
<listitem>
<para>
A list of metadata that describes the context of the buffers memory. In the case
of audio data, for example, it would provide the samplerate, depth and channel
count.
</para>
<para>
GStreamer provides a registry where different metadata types can be registered
so that everybody is talking about the same data.
</para>
</listitem>
</itemizedlist>
</para>
@ -67,11 +56,4 @@
situation.
</para>
<para>
Before an element can operate on the buffers memory, is has to check the metadata
attached to it (if any). An MPEG audio decoder has to ignore a buffer with video
metadata (in which case the pipeline is probably constructed by connecting the
wrong elements, anyway).
</para>
</chapter>

View file

@ -1,8 +1,8 @@
<chapter id="cha-elements">
<title>GstElement</title>
<para>
The most important object in GStreamer for the application programmer is
the GstElement object.
The most important object in <application>GStreamer</application> for the
application programmer is the <classname>GstElement</classname> object.
</para>
<sect1 id="sec-elements-design">

View file

@ -12,6 +12,7 @@
<!ENTITY HELLOWORLD SYSTEM "helloworld.sgml">
<!ENTITY FACTORIES SYSTEM "factories.sgml">
<!ENTITY AUTOPLUGGING SYSTEM "autoplugging.sgml">
<!ENTITY HELLOWORLD2 SYSTEM "helloworld2.sgml">
<!ENTITY THREADS SYSTEM "threads.sgml">
@ -130,6 +131,8 @@
&FACTORIES;
&AUTOPLUGGING;
&HELLOWORLD2;
</part>

View file

@ -19,17 +19,6 @@
#include &lt;gst/gst.h&gt;
gboolean playing;
/* eos will be called when the src element has an end of stream */
void
eos (GstSrc *src)
{
g_print ("have eos, quitting\n");
playing = FALSE;
}
int
main (int argc, char *argv[])
{
@ -48,8 +37,6 @@ main (int argc, char *argv[])
/* create a disk reader */
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
gtk_object_set (GTK_OBJECT (disksrc),"location", argv[1], NULL);
gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
GTK_SIGNAL_FUNC (eos), NULL);
/* now it's time to get the parser */
parse = gst_elementfactory_make ("mp3parse", "parse");
@ -75,11 +62,7 @@ main (int argc, char *argv[])
/* start playing */
gst_element_set_state (bin, GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate (GST_BIN (bin));
}
while (gst_bin_iterate (GST_BIN (bin)));
/* stop the bin */
gst_element_set_state (bin, GST_STATE_NULL);
@ -150,14 +133,7 @@ main (int argc, char *argv[])
/* create a disk reader */
disksrc = gst_elementfactory_make ("disksrc", "disk_source");
gtk_object_set (GTK_OBJECT (disksrc),"location", argv[1], NULL);
gtk_signal_connect (GTK_OBJECT (disksrc), "eos",
GTK_SIGNAL_FUNC (eos), NULL);
</programlisting>
<para>
We also connected the eos signal to our function. When the
disk source has reached an end-of-stream, this function will be called.
We will use it to set a gboolean value to FALSE;
</para>
<note>
<para>
You can check if the disksrc != NULL to verify the creation of the
@ -165,20 +141,6 @@ main (int argc, char *argv[])
</para>
</note>
<programlisting>
gboolean playing;
...
/* eos will be called when the src element has an end of stream */
void
eos (GstSrc *src)
{
g_print ("have eos, quitting\n");
playing = FALSE;
}
</programlisting>
<para>
We now create the MP3 decoder element. <application>GStreamer</application> requires you
to put a parser in front of the decoder. This parser will
@ -249,7 +211,6 @@ eos (GstSrc *src)
/* start playing */
gst_element_set_state (bin, GST_STATE_PLAYING);
playing = TRUE;
</programlisting>
<note>
<para>
@ -263,14 +224,12 @@ eos (GstSrc *src)
call gst_bin_iterate() to execute one iteration of the bin.
</para>
<programlisting>
while (playing) {
gst_bin_iterate (GST_BIN (bin));
}
while (gst_bin_iterate (GST_BIN (bin)));
</programlisting>
<para>
Remember that the variable playing will become false if the disk source
has reached an end-of-file. When that happens, the follwing code takes
care of the cleanup:
The gst_bin_iterate() function will return TRUE as long as something interesting
happended inside the bin. When the end-of-file has been reached the _iterate
function will return FALSE and we can end the loop.
</para>
<programlisting>
/* stop the bin */

View file

@ -276,6 +276,21 @@ Pads:
A list value: the property can take any value from a list.
</para>
</listitem>
<listitem>
<para>
A float value: the property has this exact floating point value.
</para>
</listitem>
<listitem>
<para>
A float range value: denotes a range of possible floating point values.
</para>
</listitem>
<listitem>
<para>
A string value.
</para>
</listitem>
</itemizedlist>
</sect2>

View file

@ -149,8 +149,6 @@ main(int argc, char *argv[])
gst_element_set_state (bin, GST_STATE_PLAYING);
playing = TRUE;
while (gst_bin_iterate(GST_BIN(bin)));
gst_element_set_state (bin, GST_STATE_NULL);

289
docs/random/autoplug2 Normal file
View file

@ -0,0 +1,289 @@
1) The Autoplugger API
----------------------
We'll first describe how to use the autoplugger. We will provide
a use case: autoplug an mpeg1 system stream for audio/video playback.
a) creating an autoplugger
--------------------------
Before any autoplugging can be done, you'll have to create an
autoplugger object. Autoplugger objects (autopluggers) are
provided by plugins and are created with gst_autoplugfactor_make().
GStreamer has provisions for two types of autopluggers:
- regular autopluggers, which act as a complex element construction
mechanism. They usually don't create threads and operate solely on
GstCaps* for the source and destination. The complex elements
created by regular autopluggers have src and sink pad compatible
with the requested GstCaps*.
- renderer autopluggers, which are designed to create a complex
object that can be used to playback media. Renderer autoplugged
complex elements have no src pads, only one sink pad.
We'll create a renderer autoplugger like this:
!
! GstAutoplug *autoplug;
!
! autoplug = gst_autoplugfactory_make ("staticrender");
!
b) finding out the source media type.
-------------------------------------
Before we can start the autoplugger, we have to find out the
source media type. This can be done using the typefind functions
provided by various plugins.
We will create a little pipeline to detect the media type by connecting
a disksrc element to a typefind element. The typefind element will
repeadedly call all registered typefind functions with the buffer it
receives on its sink pad. when a typefind function returns a non NULL
GstCaps*, that caps is set to the sink pad of the typefind element and
a signal is emitted to notify the app.
Due to caps negotiation, the disksrc will have the detected GstCaps*
set on its src pad.
We typically use a function like below to detect the type of a media stream
on an element (typically a disksrc). The function accepts a pipeline and the
element inside the pipeline on which the typefind should be performed (passing
a GstPad* is probably a better option FIXME).
!
! static GstCaps*
! gst_play_typefind (GstBin *bin, GstElement *element)
! {
! GstElement *typefind;
! GstCaps *caps = NULL;
!
! typefind = gst_elementfactory_make ("typefind", "typefind");
! g_return_val_if_fail (typefind != NULL, FALSE);
!
! gst_pad_connect (gst_element_get_pad (element, "src"),
! gst_element_get_pad (typefind, "sink"));
!
! gst_bin_add (bin, typefind);
!
! gst_element_set_state (GST_ELEMENT (bin), GST_STATE_PLAYING);
!
! // push a buffer... the have_type signal handler will set the found flag
! gst_bin_iterate (bin);
!
! gst_element_set_state (GST_ELEMENT (bin), GST_STATE_NULL);
!
! caps = gst_pad_get_caps (gst_element_get_pad (element, "src"));
!
! gst_pad_disconnect (gst_element_get_pad (element, "src"),
! gst_element_get_pad (typefind, "sink"));
! gst_bin_remove (bin, typefind);
! gst_object_unref (GST_OBJECT (typefind));
!
! return caps;
! }
!
Also note that the disksrc was added to the pipeline before calling this
typefind function.
When the function returns a non-NULL pointer, the media type has been
determined and autoplugging can commence.
Assume that in our mpeg1 use case the above function returns a GstCaps*
like:
!
! srccaps = GST_CAPS_NEW ("mpeg1system_typefind",
! "video/mpeg",
! "mpegversion", GST_PROPS_INT (1),
! "systemstream", GST_PROPS_BOOLEAN (TRUE)
! );
!
c) Performing the autoplugging
------------------------------
Since we use the renderer API, we have to create the output elements
that are going to be used as the final sink elements.
!
! osssink = gst_elementfactory_make("osssink", "play_audio");
! videosink = gst_elementfactory_make("xvideosink", "play_video");
!
We then create a complex element using the following code.
!
! new_element = gst_autoplug_to_renderers (autoplug,
! srccaps,
! videosink,
! osssink,
! NULL);
!
! if (!new_element) {
! g_print ("could not autoplug, no suitable codecs found...\n");
! exit (-1);
! }
!
2) Autoplugging internals
-------------------------
We will now describe the internals of the above gst_autoplug_to_renderers()
function call. This code is implemented in a plugin found in:
gst/autoplug/gststaticautoplugrender.c
a) phase1: create lists of factories.
---------------------------------------
The autoplugger will start with executing the following piece of
code:
!
! i = 0;
!
! for each sink:
! {
! sinkpad = take the first sinkpad of the sink (HACK)
!
! list[i] = gst_autoplug_caps (srccaps, sinkpad->caps);
!
! i++;
! }
!
gst_autoplug_caps will figure out (based on the padtemplates)
which elementfactories are needed to connect srccaps to sinkpad->caps
and will return them in a list.
The element list is created by using a modified shortest path algorithm
by Dijkstra (http://www.orie.cornell.edu/~or115/handouts/handout3/handout3.html).
The nodes of the graph are the elementfactories and the weight of the
arcs is based on the pad compatibility of the padtemplates of the
elementfactory. For incompatible elementfactories, we use a weight of
MAX_COST (999999) and for compatible padtemplates we use 1.
ex. we have two sinks with following caps:
!
! video/raw audio/raw
! "...." "...."
!
gst_autoplug_caps will figure out that for the first sink the following
elements are needed:
!
! mpeg1parse, mp1videoparse, mpeg_play
!
for the second sink the following is needed:
!
! mpeg1parse, mad
!
Note that for the audio connection the element list "mpeg1parse, mp3parse,
mpg123" would also connect the srccaps to the audiosink caps. Since the
"mpeg1parse, mad" list is shorter, it it always prefered by the autoplugger.
We now have two lists of elementfactories.
b) phase2: collect common elements from the lists and add them to a bin.
------------------------------------------------------------------------
The rationale is that from the lists we have created in phase1, there
must be some element that is a splitter and that it has to come first (HACK)
We try to find that element by comparing the lists until an element differs.
We start by creating a toplevel bin that is going to be our complex element.
In our use-case we find that mpeg1parse is an element common to both lists,
so we add it to the bin. We then try to find a good ghostpad for the resulting
complex element. This is done by looping over the sink pads of the first common
element and taking the pad that is compatible with the srcaps.
We end up with a bin like this:
!
! (----------------------)
! ! autoplug_bin !
! ! !
! ! (------------) !
! ! ! mpeg1parse ! !
! ! - sink ! !
! ! / (------------) !
! sink !
! (----------------------)
!
c) phase3: add remaining elements
---------------------------------
now we loop over all the list and try to add the remaining elements
(HACK) we always use a new thread for the elements when there is a common
element found.
if a new thread is needed (either becuase the previous element is a common
element or the object flag of the next element is set to GST_SUGGEST_THREAD)
we add a queue to the bin and we add a new thread. We add the elements to
the bin and connect them using gst_pipeline_pads_autoplug.
we finally arrive at the sink element and we're done.
ex.
we have just found our mpeg1parse common element, so we start a thread.
We add a queue to the bin and a new thread, we add the elements
mp1videoparse and mpeg_play to the thread. We arrive at the videosink, we
see that the SUGGEST_THREAD flag is set, we add a queue and a thread and
add the videosink in the thread.
the same procedure happens for the audio part. We are now left with the
following pipeline:
We will also have set a signal "new_pad" on the mpeg1parse element because
the element mp1videoparse could not be connected to the element just yet.
(---------------------------------------------------------------------------------------------)
!autoplug_bin !
! !
! (----------------------------------------) (------------) !
! !thread ! ! thread ! !
! (-----) ! (-------------) (---------) (-----) ! ! (---------)! !
! !queue! ! !mp1videoparse! !mpeg_play! !queue! ! ! !videosink!! !
! sink src-sink src-sink src-sink src-sink !! !
! (-----------) (-----) ! (-------------) (---------) (-----) ! ! (---------)! !
! ! mpeg1parse! (----------------------------------------) (------------) !
! - sink ! !
! / (-----------) !
sink (----------------------------------------) (------------) !
! !thread ! ! thread ! !
! (-----) ! (-------------) (-----) ! ! (---------)! !
! !queue! ! !mad ! !queue! ! ! !videosink!! !
! sink src-sink src ------------ sink src-sink !! !
! (-----) ! (-------------) (-----) ! ! (---------)! !
! (----------------------------------------) (------------) !
(---------------------------------------------------------------------------------------------)
The autoplugger will return the autoplug_bin. the app will then connect the
disksrc to the sinkpad of the autoplugged bin.
Then we play, create_plan happens, data is flowing and the "new_pad" signal is called
from mpeg1parse, gst_pipeline_pad_autoplug is called and the connection between
mpeg1parse and the videoqueue is made. same for audio.
Et voila. same procedure for mp3/vorbis/avi/qt/mpeg2 etc...

View file

@ -254,6 +254,12 @@ gst_editor_props_show_func (GstPropsEntry *entry)
case GST_PROPS_INT_RANGE_ID:
return g_strdup_printf ("%d-%d", entry->data.int_range_data.min, entry->data.int_range_data.max);
break;
case GST_PROPS_FLOAT_ID:
return g_strdup_printf ("%f", entry->data.float_data);
break;
case GST_PROPS_FLOAT_RANGE_ID:
return g_strdup_printf ("%f-%f", entry->data.float_range_data.min, entry->data.float_range_data.max);
break;
case GST_PROPS_FOURCC_ID:
return g_strdup_printf ("%4.4s", (gchar *)&entry->data.fourcc_data);
break;

View file

@ -33,7 +33,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline)
gst_bin_remove (GST_BIN (autobin), typefind);
/* and an audio sink */
osssink = gst_elementfactory_make("esdsink", "play_audio");
osssink = gst_elementfactory_make("osssink", "play_audio");
g_assert(osssink != NULL);
/* and an video sink */

View file

@ -266,6 +266,10 @@ gst_example_chain (GstPad *pad, GstBuffer *buf)
/* Then copy the data in the incoming buffer into the new buffer. */
memcpy (GST_BUFFER_DATA (outbuf), GST_BUFFER_DATA (buf), GST_BUFFER_SIZE (outbuf));
/* we don't need the incomming buffer anymore so we unref it. When we are
* the last plugin with a handle to the buffer, its memory will be freed */
gst_buffer_unref (buf);
/* When we're done with the buffer, we push it on to the next element
* in the pipeline, through the element's source pad, which is stored
* in the element's structure.

View file

@ -17,5 +17,4 @@ libgststaticautoplugrender_la_LDFLAGS = -version-info $(GST_LIBVERSION)
libgstautoplugcache_la_LDFLAGS = -version-info $(GST_LIBVERSION)
noinst_PROGRAMS = autoplugtest
autoplugtest_LDADD = $(GST_LIBS)
autoplugtest_LDADD = $(GST_LIBS)

View file

@ -36,6 +36,19 @@
#include "gstarch.h"
#define COTHREAD_STACKSIZE 16384
#define COTHREAD_MAXTHREADS 128
#define STACK_SIZE 0x200000
struct _cothread_context {
cothread_state *threads[COTHREAD_MAXTHREADS];
int nthreads;
int current;
GHashTable *data;
};
pthread_key_t _cothread_key = -1;
/* Disablig this define allows you to shut off a few checks in
@ -78,7 +91,7 @@ cothread_init (void)
ctx->threads[0]->argc = 0;
ctx->threads[0]->argv = NULL;
ctx->threads[0]->flags = COTHREAD_STARTED;
ctx->threads[0]->sp = (int *)CURRENT_STACK_FRAME;
ctx->threads[0]->sp = (void *)CURRENT_STACK_FRAME;
ctx->threads[0]->pc = 0;
// initialize the lock
@ -99,26 +112,32 @@ cothread_init (void)
*
* Create a new cothread state in the given context
*
* Returns: the new cothread state
* Returns: the new cothread state or NULL on error
*/
cothread_state*
cothread_create (cothread_context *ctx)
{
cothread_state *s;
if (ctx->nthreads == COTHREAD_MAXTHREADS) {
GST_DEBUG (0, "attempt to create > COTHREAD_MAXTHREADS\n");
return NULL;
}
GST_DEBUG (0,"pthread_self() %ld\n",pthread_self());
//if (0) {
if (pthread_self() == 0) { // FIXME uh, what does this test really do?
s = (cothread_state *)malloc(sizeof(int) * COTHREAD_STACKSIZE);
s = (cothread_state *)malloc(COTHREAD_STACKSIZE);
GST_DEBUG (0,"new stack (case 1) at %p\n",s);
} else {
char *sp = CURRENT_STACK_FRAME;
unsigned long *stack_end = (unsigned long *)((unsigned long)sp &
~(STACK_SIZE - 1));
void *sp = CURRENT_STACK_FRAME;
// FIXME this may not be 64bit clean
// could use casts to uintptr_t from inttypes.h
// if only all platforms had inttypes.h
void *stack_end = (void *)((unsigned long)sp & ~(STACK_SIZE - 1));
s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) *
COTHREAD_STACKSIZE));
GST_DEBUG (0,"new stack (case 2) at %p\n",s);
if (mmap((char *)s,COTHREAD_STACKSIZE*(sizeof(int)),
if (mmap((void *)s,COTHREAD_STACKSIZE,
PROT_READ|PROT_WRITE|PROT_EXEC,MAP_FIXED|MAP_PRIVATE|MAP_ANON,
-1,0) < 0) {
perror("mmap'ing cothread stack space");
@ -129,7 +148,7 @@ cothread_create (cothread_context *ctx)
s->ctx = ctx;
s->threadnum = ctx->nthreads;
s->flags = 0;
s->sp = ((int *)s + COTHREAD_STACKSIZE);
s->sp = ((void *)s + COTHREAD_STACKSIZE);
// is this needed anymore?
s->top_sp = s->sp;
@ -165,7 +184,7 @@ cothread_setfunc (cothread_state *thread,
thread->func = func;
thread->argc = argc;
thread->argv = argv;
thread->pc = (int *)func;
thread->pc = (void *)func;
}
/**

View file

@ -32,10 +32,6 @@
#undef COTHREAD_ATOMIC
#define COTHREAD_STACKSIZE 32768
#define COTHREAD_MAXTHREADS 64
#define STACK_SIZE 0x200000
#ifndef CURRENT_STACK_FRAME
#define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
#endif /* CURRENT_STACK_FRAME */
@ -69,12 +65,6 @@ struct _cothread_state {
#endif
};
struct _cothread_context {
cothread_state *threads[COTHREAD_MAXTHREADS];
int nthreads;
int current;
GHashTable *data;
};
cothread_context* cothread_init();
cothread_state* cothread_create (cothread_context *ctx);

View file

@ -67,6 +67,8 @@ static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint6
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
static void gst_disksrc_close_file (GstDiskSrc *src);
static GstElementClass *parent_class = NULL;
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
@ -151,8 +153,9 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
switch(id) {
case ARG_LOCATION:
/* the element must be stopped in order to do this */
g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
/* the element must be stopped or paused in order to do this */
g_return_if_fail ((GST_STATE (src) < GST_STATE_PLAYING)
|| (GST_STATE (src) == GST_STATE_PAUSED));
if (src->filename) g_free (src->filename);
/* clear the filename if we get a NULL (is that possible?) */
@ -163,6 +166,11 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
} else {
src->filename = g_strdup (GTK_VALUE_STRING (*arg));
}
if ((GST_STATE (src) == GST_STATE_PAUSED) && (src->filename != NULL))
{
gst_disksrc_close_file(src);
gst_disksrc_open_file(src);
}
break;
case ARG_BYTESPERREAD:
src->bytes_per_read = GTK_VALUE_INT (*arg);

View file

@ -57,7 +57,7 @@ static struct _elements_entry _elements[] = {
{ "fdsrc", gst_fdsrc_get_type, &gst_fdsrc_details, NULL },
{ "multidisksrc", gst_multidisksrc_get_type, &gst_multidisksrc_details, NULL },
{ "pipefilter", gst_pipefilter_get_type, &gst_pipefilter_details, NULL },
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, NULL },
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, gst_sinesrc_factory_init },
{ "tee", gst_tee_get_type, &gst_tee_details, gst_tee_factory_init },
#if HAVE_LIBGHTTP

View file

@ -97,7 +97,8 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
gst_fakesink_signals[SIGNAL_HANDOFF] =
gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstFakeSinkClass, handoff),
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (gtkobject_class, gst_fakesink_signals,
LAST_SIGNAL);
@ -194,9 +195,8 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
if (!fakesink->silent)
g_print("fakesink: ******* (%s:%s)< (%d bytes) \n",GST_DEBUG_PAD_NAME(pad),GST_BUFFER_SIZE(buf));
gst_buffer_unref (buf);
gtk_signal_emit (GTK_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF],
fakesink);
buf);
gst_buffer_unref (buf);
}

View file

@ -50,6 +50,7 @@ enum {
ARG_PATTERN,
ARG_NUM_BUFFERS,
ARG_EOS,
ARG_SILENT
};
#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type())
@ -127,6 +128,8 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
GTK_ARG_READWRITE, ARG_NUM_BUFFERS);
gtk_object_add_arg_type ("GstFakeSrc::eos", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_EOS);
gtk_object_add_arg_type ("GstFakeSrc::silent", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_SILENT);
gtkobject_class->set_arg = gst_fakesrc_set_arg;
gtkobject_class->get_arg = gst_fakesrc_get_arg;
@ -134,7 +137,8 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
gst_fakesrc_signals[SIGNAL_HANDOFF] =
gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstFakeSrcClass, handoff),
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (gtkobject_class, gst_fakesrc_signals,
LAST_SIGNAL);
@ -161,6 +165,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
gst_pad_set_get_function(pad,gst_fakesrc_get);
fakesrc->num_buffers = -1;
fakesrc->silent = FALSE;
// we're ready right away, since we don't have any args...
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
}
@ -224,6 +229,9 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
src->eos = GTK_VALUE_BOOL (*arg);
GST_INFO (0, "will EOS on next buffer");
break;
case ARG_SILENT:
src->silent = GTK_VALUE_BOOL (*arg);
break;
default:
break;
}
@ -257,6 +265,9 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
break;
case ARG_EOS:
GTK_VALUE_BOOL (*arg) = src->eos;
case ARG_SILENT:
GTK_VALUE_BOOL (*arg) = src->silent;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@ -299,11 +310,12 @@ gst_fakesrc_get(GstPad *pad)
return NULL;
}
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
if (!src->silent)
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
buf = gst_buffer_new();
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
src);
buf);
return buf;
}
@ -349,10 +361,11 @@ gst_fakesrc_loop(GstElement *element)
}
buf = gst_buffer_new();
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
if (!src->silent)
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
src);
buf);
gst_pad_push (pad, buf);
pads = g_slist_next (pads);

View file

@ -72,6 +72,7 @@ struct _GstFakeSrc {
gchar *pattern;
GList *patternlist;
gint num_buffers;
gboolean silent;
};
struct _GstFakeSrcClass {

View file

@ -38,7 +38,8 @@ GstElementDetails gst_pipefilter_details = {
"Filter",
"Pass data without modification",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>",
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@chello.be>",
"(C) 1999",
};
@ -55,20 +56,24 @@ enum {
};
static void gst_pipefilter_class_init(GstPipefilterClass *klass);
static void gst_pipefilter_init(GstPipefilter *pipefilter);
static void gst_pipefilter_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_pipefilter_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_pipefilter_class_init (GstPipefilterClass *klass);
static void gst_pipefilter_init (GstPipefilter *pipefilter);
void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf);
static void gst_pipefilter_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_pipefilter_get_arg (GtkObject *object, GtkArg *arg, guint id);
static GstElementStateReturn gst_pipefilter_change_state(GstElement *element);
static GstBuffer* gst_pipefilter_get (GstPad *pad);
static void gst_pipefilter_chain (GstPad *pad, GstBuffer *buf);
static gboolean gst_pipefilter_handle_eos (GstPad *pad);
static GstElementStateReturn gst_pipefilter_change_state (GstElement *element);
static GstElementClass *parent_class = NULL;
//static guint gst_pipefilter_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_pipefilter_get_type(void) {
gst_pipefilter_get_type (void)
{
static GtkType pipefilter_type = 0;
if (!pipefilter_type) {
@ -87,7 +92,9 @@ gst_pipefilter_get_type(void) {
return pipefilter_type;
}
static void gst_pipefilter_class_init(GstPipefilterClass *klass) {
static void
gst_pipefilter_class_init (GstPipefilterClass *klass)
{
GtkObjectClass *gtkobject_class;
GstElementClass *gstelement_class;
@ -105,12 +112,19 @@ static void gst_pipefilter_class_init(GstPipefilterClass *klass) {
gtkobject_class->get_arg = gst_pipefilter_get_arg;
}
static void gst_pipefilter_init(GstPipefilter *pipefilter) {
pipefilter->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
gst_element_add_pad(GST_ELEMENT(pipefilter),pipefilter->sinkpad);
gst_pad_set_chain_function(pipefilter->sinkpad,gst_pipefilter_chain);
pipefilter->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_element_add_pad(GST_ELEMENT(pipefilter),pipefilter->srcpad);
static void
gst_pipefilter_init (GstPipefilter *pipefilter)
{
GST_FLAG_SET (pipefilter, GST_ELEMENT_DECOUPLED);
pipefilter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad);
gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain);
gst_pad_set_eos_function (pipefilter->sinkpad, gst_pipefilter_handle_eos);
pipefilter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad);
gst_pad_set_get_function (pipefilter->srcpad, gst_pipefilter_get);
pipefilter->command = NULL;
pipefilter->curoffset = 0;
@ -118,51 +132,67 @@ static void gst_pipefilter_init(GstPipefilter *pipefilter) {
pipefilter->seq = 0;
}
static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
static gboolean
gst_pipefilter_handle_eos (GstPad *pad)
{
GstPipefilter *pipefilter;
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
GST_DEBUG (0,"pipefilter: %s received eos\n", GST_ELEMENT_NAME (pipefilter));
if (close (pipefilter->fdin[1]) < 0)
perror("close");
if (close (pipefilter->fdout[0]) < 0)
perror("close");
GST_FLAG_SET (pad, GST_PAD_EOS);
return TRUE;
}
static GstBuffer*
gst_pipefilter_get (GstPad *pad)
{
GstPipefilter *pipefilter;
GstBuffer *newbuf;
glong readbytes;
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
newbuf = gst_buffer_new();
g_return_val_if_fail(newbuf, FALSE);
g_return_val_if_fail(newbuf, NULL);
/* allocate the space for the buffer data */
GST_BUFFER_DATA(newbuf) = g_malloc(pipefilter->bytes_per_read);
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE);
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, NULL);
/* read it in from the file */
GST_DEBUG (0,"attemting to read %ld bytes\n", pipefilter->bytes_per_read);
readbytes = read(pipefilter->fdout[0],GST_BUFFER_DATA(newbuf),pipefilter->bytes_per_read);
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
GST_DEBUG (0,"read %ld bytes\n", readbytes);
if (readbytes < 0) {
if (errno == EAGAIN) {
GST_DEBUG (0,"no input yet\n");
gst_buffer_unref(newbuf);
return FALSE;
}
else {
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
return FALSE;
}
}
if (readbytes == 0) {
gst_buffer_unref(newbuf);
return FALSE;
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
return NULL;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < pipefilter->bytes_per_read)
GST_BUFFER_FLAG_SET(newbuf,GST_BUFFER_EOS);
if (readbytes == 0) {
gst_pad_set_eos (pad);
return NULL;
}
GST_BUFFER_OFFSET(newbuf) = pipefilter->curoffset;
GST_BUFFER_SIZE(newbuf) = readbytes;
pipefilter->curoffset += readbytes;
/* we're done, push the buffer off now */
gst_pad_push(pipefilter->srcpad,newbuf);
return TRUE;
return newbuf;
}
void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
static void
gst_pipefilter_chain (GstPad *pad,GstBuffer *buf)
{
GstPipefilter *pipefilter;
glong writebytes;
guchar *data;
@ -174,8 +204,6 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
while (gst_pipefilter_read_and_push(pipefilter));
data = GST_BUFFER_DATA(buf);
size = GST_BUFFER_SIZE(buf);
@ -188,11 +216,11 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
return;
}
gst_buffer_unref(buf);
while (gst_pipefilter_read_and_push(pipefilter));
}
static void gst_pipefilter_set_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_pipefilter_set_arg (GtkObject *object,GtkArg *arg,guint id)
{
GstPipefilter *pipefilter;
/* it's not null if we got it, but it might not be ours */
@ -209,7 +237,9 @@ static void gst_pipefilter_set_arg(GtkObject *object,GtkArg *arg,guint id) {
}
}
static void gst_pipefilter_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_pipefilter_get_arg (GtkObject *object,GtkArg *arg,guint id)
{
GstPipefilter *pipefilter;
/* it's not null if we got it, but it might not be ours */
@ -227,18 +257,14 @@ static void gst_pipefilter_get_arg(GtkObject *object,GtkArg *arg,guint id) {
}
/* open the file, necessary to go to RUNNING state */
static gboolean gst_pipefilter_open_file(GstPipefilter *src) {
static gboolean
gst_pipefilter_open_file (GstPipefilter *src)
{
g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_PIPEFILTER_OPEN), FALSE);
pipe(src->fdin);
pipe(src->fdout);
if (fcntl(src->fdout[0], F_SETFL, O_NONBLOCK) < 0) {
perror("fcntl");
gst_element_error(GST_ELEMENT(src),"fcntl");
return FALSE;
}
if((src->childpid = fork()) == -1)
{
perror("fork");
@ -248,6 +274,8 @@ static gboolean gst_pipefilter_open_file(GstPipefilter *src) {
if(src->childpid == 0)
{
close(src->fdin[1]);
close(src->fdout[0]);
// child
dup2(src->fdin[0], STDIN_FILENO); /* set the childs input stream */
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
@ -258,13 +286,19 @@ static gboolean gst_pipefilter_open_file(GstPipefilter *src) {
return FALSE;
}
else {
close(src->fdin[0]);
close(src->fdout[1]);
}
GST_FLAG_SET(src,GST_PIPEFILTER_OPEN);
return TRUE;
}
/* close the file */
static void gst_pipefilter_close_file(GstPipefilter *src) {
static void
gst_pipefilter_close_file (GstPipefilter *src)
{
g_return_if_fail(GST_FLAG_IS_SET(src,GST_PIPEFILTER_OPEN));
/* close the file */
@ -280,7 +314,9 @@ static void gst_pipefilter_close_file(GstPipefilter *src) {
GST_FLAG_UNSET(src,GST_PIPEFILTER_OPEN);
}
static GstElementStateReturn gst_pipefilter_change_state(GstElement *element) {
static GstElementStateReturn
gst_pipefilter_change_state (GstElement *element)
{
g_return_val_if_fail(GST_IS_PIPEFILTER(element), FALSE);
/* if going down into NULL state, close the file if it's open */

View file

@ -54,9 +54,35 @@ enum {
ARG_BUFFER_SIZE,
};
static GstPadTemplate*
sinesrc_src_factory (void)
{
return
gst_padtemplate_new (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new (
"sinesrc_src",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT (1),
NULL)),
NULL);
}
static GstPadTemplate *src_temp;
static void gst_sinesrc_class_init(GstSineSrcClass *klass);
static void gst_sinesrc_init(GstSineSrc *src);
static GstPadNegotiateReturn gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data);
static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
//static gboolean gst_sinesrc_change_state(GstElement *element,
@ -66,7 +92,7 @@ static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_sinesrc_populate_sinetable(GstSineSrc *src);
static inline void gst_sinesrc_update_table_inc(GstSineSrc *src);
static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src);
void gst_sinesrc_sync_parms(GstSineSrc *src);
void gst_sinesrc_force_caps(GstSineSrc *src);
static GstBuffer * gst_sinesrc_get(GstPad *pad);
@ -122,31 +148,50 @@ gst_sinesrc_class_init(GstSineSrcClass *klass) {
// gstelement_class->change_state = gst_sinesrc_change_state;
}
static void gst_sinesrc_init(GstSineSrc *src) {
src->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_pad_set_get_function(src->srcpad, gst_sinesrc_get);
static void
gst_sinesrc_init(GstSineSrc *src) {
src->srcpad = gst_pad_new_from_template (src_temp, "src");
gst_element_add_pad(GST_ELEMENT(src), src->srcpad);
gst_pad_set_negotiate_function (src->srcpad, gst_sinesrc_negotiate);
gst_pad_set_get_function(src->srcpad, gst_sinesrc_get);
src->volume = 1.0;
gst_sinesrc_update_vol_scale(src);
src->format = 16;
src->samplerate = 44100;
src->freq = 100.0;
src->newcaps = FALSE;
src->freq = 440.0;
src->newcaps = TRUE;
src->table_pos = 0.0;
src->table_size = 1024;
gst_sinesrc_populate_sinetable(src);
gst_sinesrc_update_table_inc(src);
gst_sinesrc_sync_parms(src);
src->buffer_size=1024;
src->seq = 0;
}
static GstPadNegotiateReturn
gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data)
{
GstSineSrc *src;
if (*caps) {
g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
src = GST_SINESRC(gst_pad_get_parent (pad));
src->samplerate = gst_caps_get_int (*caps, "rate");
gst_sinesrc_update_table_inc(src);
return GST_PAD_NEGOTIATE_AGREE;
}
return GST_PAD_NEGOTIATE_FAIL;
}
static GstBuffer *
gst_sinesrc_get(GstPad *pad)
{
@ -194,14 +239,14 @@ gst_sinesrc_get(GstPad *pad)
}
if (src->newcaps) {
src->newcaps = FALSE;
gst_sinesrc_force_caps(src);
}
//g_print(">");
return buf;
}
static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
GstSineSrc *src;
/* it's not null if we got it, but it might not be ours */
@ -217,11 +262,11 @@ static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
break;
case ARG_FORMAT:
src->format = GTK_VALUE_INT(*arg);
gst_sinesrc_sync_parms(src);
src->newcaps=TRUE;
break;
case ARG_SAMPLERATE:
src->samplerate = GTK_VALUE_INT(*arg);
gst_sinesrc_sync_parms(src);
src->newcaps=TRUE;
gst_sinesrc_update_table_inc(src);
break;
case ARG_FREQ: {
@ -244,7 +289,8 @@ static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
}
}
static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
GstSineSrc *src;
/* it's not null if we got it, but it might not be ours */
@ -299,7 +345,8 @@ static gboolean gst_sinesrc_change_state(GstElement *element,
}
*/
static void gst_sinesrc_populate_sinetable(GstSineSrc *src)
static void
gst_sinesrc_populate_sinetable(GstSineSrc *src)
{
gint i;
gdouble pi2scaled = M_PI * 2 / src->table_size;
@ -313,16 +360,51 @@ static void gst_sinesrc_populate_sinetable(GstSineSrc *src)
src->table_data = table;
}
static inline void gst_sinesrc_update_table_inc(GstSineSrc *src)
static inline void
gst_sinesrc_update_table_inc(GstSineSrc *src)
{
src->table_inc = src->table_size * src->freq / src->samplerate;
}
static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src)
static inline void
gst_sinesrc_update_vol_scale(GstSineSrc *src)
{
src->vol_scale = 32767 * src->volume;
}
void gst_sinesrc_sync_parms(GstSineSrc *src) {
src->newcaps = TRUE;
void
gst_sinesrc_force_caps(GstSineSrc *src) {
GstCaps *caps;
if (!src->newcaps)
return;
src->newcaps=FALSE;
caps = gst_caps_new (
"sinesrc_src_caps",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (src->samplerate),
"channels", GST_PROPS_INT (1),
NULL
)
);
gst_pad_set_caps (src->srcpad, caps);
}
gboolean
gst_sinesrc_factory_init (GstElementFactory *factory)
{
src_temp = sinesrc_src_factory();
gst_elementfactory_add_padtemplate (factory, src_temp);
return TRUE;
}

View file

@ -86,6 +86,7 @@ struct _GstSineSrcClass {
};
GtkType gst_sinesrc_get_type(void);
gboolean gst_sinesrc_factory_init (GstElementFactory *factory);
#ifdef __cplusplus
}

View file

@ -28,6 +28,7 @@
#include <gst/gstversion.h>
#include <gst/gsttypes.h>
#include <gst/gstinfo.h>
#include <gst/gstobject.h>
#include <gst/gstpad.h>

View file

@ -352,6 +352,7 @@ gst_bin_change_state (GstElement *element)
GstBin *bin;
GList *children;
GstElement *child;
GstElementStateReturn ret;
GST_DEBUG_ENTER("(\"%s\")",GST_ELEMENT_NAME (element));
@ -415,8 +416,9 @@ gst_bin_change_state (GstElement *element)
GST_INFO_ELEMENT (GST_CAT_STATES, element, "done changing bin's state from %s to %s",
gst_element_statename (GST_STATE (element)),
gst_element_statename (GST_STATE_PENDING (element)));
ret = gst_bin_change_state_norecurse (bin);
return gst_bin_change_state_norecurse (bin);
return ret;
}

View file

@ -471,7 +471,7 @@ gst_caps_get_by_name (GstCaps *caps, const gchar *name)
return NULL;
}
static gboolean
gst_caps_check_compatibility_func (GstCaps *fromcaps, GstCaps *tocaps)
{

View file

@ -105,6 +105,7 @@ GstProps* gst_caps_get_props (GstCaps *caps);
#define gst_caps_set(caps, name, args...) gst_props_set ((caps)->properties, name, args)
#define gst_caps_get_int(caps, name) gst_props_get_int ((caps)->properties, name)
#define gst_caps_get_float(caps, name) gst_props_get_float ((caps)->properties, name)
#define gst_caps_get_fourcc_int(caps, name) gst_props_get_fourcc_int ((caps)->properties, name)
#define gst_caps_get_boolean(caps, name) gst_props_get_boolean ((caps)->properties, name)
#define gst_caps_get_string(caps, name) gst_props_get_string ((caps)->properties, name)

View file

@ -145,7 +145,7 @@ G_GNUC_UNUSED static gchar *_debug_string = NULL;
_gst_debug_handler(cat,_GST_DEBUG_INCORE,__FILE__,__PRETTY_FUNCTION__,__LINE__,_debug_string, \
element,g_strdup_printf( format , ## args )); \
}G_STMT_END
#else
#define GST_DEBUG(cat,format,args...)
#define GST_DEBUG_ELEMENT(cat,element,format,args...)

View file

@ -608,6 +608,7 @@ gst_pad_connect (GstPad *srcpad,
GstPad *sinkpad)
{
GstRealPad *realsrc, *realsink;
GstRealPad *temppad;
gboolean negotiated = FALSE;
/* generic checks */

View file

@ -345,7 +345,8 @@ GstPadNegotiateReturn gst_pad_negotiate_proxy (GstPad *srcpad, GstPad *destpad,
void gst_pad_push (GstPad *pad, GstBuffer *buf);
#else
#define gst_pad_push(pad,buf) G_STMT_START{ \
if ((pad)->peer->pushfunc) ((pad)->peer->pushfunc)((pad)->peer,(buf)); \
if (((GstRealPad *)(pad))->peer->pushfunc) \
(((GstRealPad *)(pad))->peer->pushfunc)((GstPad *)(((GstRealPad *)(pad))->peer),(buf)); \
}G_STMT_END
#endif
#if 1
@ -353,9 +354,13 @@ GstBuffer* gst_pad_pull (GstPad *pad);
GstBuffer* gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset, guint64 len);
#else
#define gst_pad_pull(pad) \
(((pad)->peer->pullfunc) ? ((pad)->peer->pullfunc)((pad)->peer) : NULL)
( (((GstRealPad *)(pad))->peer->pullfunc) ? \
(((GstRealPad *)(pad))->peer->pullfunc)((GstPad *)(((GstRealPad *)(pad))->peer)) : \
NULL )
#define gst_pad_pullregion(pad,type,offset,len) \
(((pad)->peer->pullregionfunc) ? ((pad)->peer->pullregionfunc)((pad)->peer,(type),(offset),(len)) : NULL)
( (((GstRealPad *)(pad))->peer->pullregionfunc) ? \
(((GstRealPad *)(pad))->peer->pullregionfunc)((GstPad *)(((GstRealPad *)(pad))->peer),(type),(offset),(len)) : \
NULL )
#endif
#define gst_pad_eos(pad) (GST_RPAD_EOSFUNC(GST_RPAD_PEER(pad))(GST_PAD(GST_RPAD_PEER(pad))))

View file

@ -62,6 +62,21 @@ gst_parse_newpad(GstElement *element,GstPad *pad,launch_delayed_pad *peer)
}
*/
typedef struct {
gchar *srcpadname;
GstPad *target;
} dyn_connect;
static void
dynamic_connect (GstElement *element, GstPad *newpad, gpointer data)
{
dyn_connect *connect = (dyn_connect *)data;
if (!strcmp (gst_pad_get_name (newpad), connect->srcpadname)) {
gst_pad_connect (newpad, connect->target);
}
}
static gchar *
gst_parse_unique_name(gchar *type,gst_parse_priv *priv)
{
@ -148,11 +163,11 @@ gst_parse_launch_cmdline(int argc,char *argv[],GstBin *parent,gst_parse_priv *pr
if (!srcpadname || !strchr(srcpadname,',')) {
if (srcpadname != NULL) {
srcpad = gst_element_get_pad(previous,srcpadname);
if (!srcpad)
if (!srcpad) {
GST_DEBUG(0,"NO SUCH pad %s in element %s\n",srcpadname,GST_ELEMENT_NAME(previous));
}
}
if (srcpad == NULL) {
else if (srcpad == NULL) {
// check through the list to find the first sink pad
GST_DEBUG(0,"CHECKING through element %s for pad named %s\n",GST_ELEMENT_NAME(previous),srcpadname);
pads = gst_element_get_pad_list(previous);
@ -164,10 +179,9 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
if (gst_pad_get_direction (srcpad) == GST_PAD_SRC) break;
srcpad = NULL;
}
if (!srcpad) GST_DEBUG(0,"error, can't find a src pad!!!\n");
else GST_DEBUG(0,"have src pad %s:%s\n",GST_DEBUG_PAD_NAME(srcpad));
}
if (!srcpad) GST_DEBUG(0,"error, can't find a src pad!!!\n");
else GST_DEBUG(0,"have src pad %s:%s\n",GST_DEBUG_PAD_NAME(srcpad));
}
// argument with = in it
@ -217,8 +231,8 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
element = gst_elementfactory_make(arg,ptr);
g_free(ptr);
if (!element) {
fprintf(stderr,"Couldn't create a '%s', no such element or need to run gstraemer-register?\n",arg);
// exit(-1);
fprintf(stderr,"Couldn't create a '%s', no such element or need to run gstreamer-register?\n",arg);
exit(-1);
}
GST_DEBUG(0,"CREATED element %s\n",GST_ELEMENT_NAME(element));
}
@ -226,8 +240,9 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
gst_bin_add (GST_BIN (parent), element);
elementcount++;
if (srcpad != NULL) {
DEBUG("need to connect to sinkpad %s:%s\n",GST_DEBUG_PAD_NAME(srcpad));
if (srcpad != NULL || srcpadname != NULL) {
if (srcpad)
DEBUG("need to connect to srcpad %s:%s\n",GST_DEBUG_PAD_NAME(srcpad));
sinkpad = NULL;
@ -248,12 +263,26 @@ if (GST_IS_GHOST_PAD(srcpad)) GST_DEBUG(0,"it's a ghost pad\n");
if (!sinkpad) DEBUG("error, can't find a sink pad!!!\n");
else DEBUG("have sink pad %s:%s\n",GST_DEBUG_PAD_NAME(sinkpad));
GST_DEBUG(0,"CONNECTING %s:%s and %s:%s\n",GST_DEBUG_PAD_NAME(srcpad),GST_DEBUG_PAD_NAME(sinkpad));
gst_pad_connect(srcpad,sinkpad);
if (!srcpad) {
dyn_connect *connect = g_malloc (sizeof (dyn_connect));
connect->srcpadname = srcpadname;
connect->target = sinkpad;
GST_DEBUG(0,"SETTING UP dynamic connection %s:%s and %s:%s\n",gst_element_get_name (previous),
srcpadname,GST_DEBUG_PAD_NAME(sinkpad));
gtk_signal_connect (GTK_OBJECT (previous), "new_pad", dynamic_connect, connect);
}
else {
GST_DEBUG(0,"CONNECTING %s:%s and %s:%s\n",GST_DEBUG_PAD_NAME(srcpad),GST_DEBUG_PAD_NAME(sinkpad));
gst_pad_connect(srcpad,sinkpad);
}
sinkpad = NULL;
srcpad = NULL;
}
// if we're the first element, ghost all the sinkpads
if (elementcount == 1) {
@ -325,6 +354,7 @@ gst_parse_launch(const gchar *cmdline,GstBin *parent)
gint newargc;
gint i;
const gchar *cp, *start, *end;
gchar *temp;
GSList *string_list = NULL, *slist;
priv.bincount = 0;
@ -337,20 +367,32 @@ gst_parse_launch(const gchar *cmdline,GstBin *parent)
end = cmdline + strlen(cmdline);
newargc = 0;
temp = "";
// Extract the arguments to a gslist in reverse order
for (cp = cmdline; cp < end; ) {
i = strcspn(cp, "([{}]) \"");
i = strcspn(cp, "([{}]) \"\\");
if (i > 0) {
// normal argument - copy and add to the list
string_list = g_slist_prepend(string_list, g_strndup(cp, i));
newargc++;
temp = g_strconcat (temp, g_strndup (cp, i), NULL);
// see if we have an escape char
if (cp[i] != '\\') {
// normal argument - copy and add to the list
string_list = g_slist_prepend(string_list, temp);
newargc++;
temp = "";
}
else {
temp = g_strconcat (temp, g_strndup (&cp[++i], 1), NULL);
}
cp += i;
}
// skip spaces
while (cp < end && *cp == ' ')
while (cp < end && *cp == ' ') {
cp++;
}
// handle quoted arguments
if (*cp == '"') {

View file

@ -52,12 +52,13 @@ enum {
};
static void gst_pipeline_class_init (GstPipelineClass *klass);
static void gst_pipeline_init (GstPipeline *pipeline);
static void gst_pipeline_class_init (GstPipelineClass *klass);
static void gst_pipeline_init (GstPipeline *pipeline);
static GstElementStateReturn gst_pipeline_change_state (GstElement *element);
static GstElementStateReturn gst_pipeline_change_state (GstElement *element);
static void gst_pipeline_prepare (GstPipeline *pipeline);
static void gst_pipeline_prepare (GstPipeline *pipeline);
static GstBinClass *parent_class = NULL;
//static guint gst_pipeline_signals[LAST_SIGNAL] = { 0 };
@ -83,7 +84,7 @@ gst_pipeline_get_type (void) {
}
static void
gst_pipeline_class_init (GstPipelineClass *klass)
gst_pipeline_class_init (GstPipelineClass *klass)
{
GstElementClass *gstelement_class;
@ -94,8 +95,8 @@ gst_pipeline_class_init (GstPipelineClass *klass)
gstelement_class->change_state = gst_pipeline_change_state;
}
static void
gst_pipeline_init (GstPipeline *pipeline)
static void
gst_pipeline_init (GstPipeline *pipeline)
{
// we're a manager by default
GST_FLAG_SET (pipeline, GST_BIN_FLAG_MANAGER);
@ -123,17 +124,17 @@ gst_pipeline_new (const guchar *name)
static void
gst_pipeline_prepare (GstPipeline *pipeline)
{
GST_DEBUG (GST_CAT_PIPELINE,"preparing pipeline \"%s\" for playing (DEPRACATED!!)\n",
GST_ELEMENT_NAME(GST_ELEMENT(pipeline)));
GST_DEBUG (GST_CAT_PIPELINE,"preparing pipeline \"%s\" for playing (DEPRACATED!!)\n",
GST_ELEMENT_NAME(GST_ELEMENT(pipeline)));
}
static GstElementStateReturn
gst_pipeline_change_state (GstElement *element)
static GstElementStateReturn
gst_pipeline_change_state (GstElement *element)
{
GstPipeline *pipeline;
g_return_val_if_fail (GST_IS_PIPELINE (element), FALSE);
pipeline = GST_PIPELINE (element);
switch (GST_STATE_TRANSITION (pipeline)) {
@ -144,22 +145,21 @@ gst_pipeline_change_state (GstElement *element)
default:
break;
}
if (GST_ELEMENT_CLASS (parent_class)->change_state)
return GST_ELEMENT_CLASS (parent_class)->change_state (element);
return GST_STATE_SUCCESS;
}
/**
* gst_pipeline_iterate:
* @pipeline: #GstPipeline to iterate
*
* Cause the pipeline's contents to be run through one full 'iteration'.
*/
void
gst_pipeline_iterate (GstPipeline *pipeline)
void
gst_pipeline_iterate (GstPipeline *pipeline)
{
g_return_if_fail (pipeline != NULL);
g_return_if_fail (GST_IS_PIPELINE(pipeline));

View file

@ -368,6 +368,7 @@ gst_plugin_load_absolute (const gchar *name)
GST_INFO (GST_CAT_PLUGIN_LOADING,"loading plugin \"%s\"...", name);
plugin = gst_plugin_new(desc->name, desc->major_version, desc->minor_version);
if (plugin != NULL) {
plugin->filename = g_strdup(name);
if (!((desc->plugin_init)(module, plugin))) {
GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" failed to initialise",
plugin->name);
@ -379,7 +380,6 @@ gst_plugin_load_absolute (const gchar *name)
if (plugin != NULL) {
GST_INFO (GST_CAT_PLUGIN_LOADING,"plugin \"%s\" loaded: %d elements, %d types",
plugin->name,plugin->numelements,plugin->numtypes);
plugin->filename = g_strdup(name);
plugin->loaded = TRUE;
_gst_modules = g_list_prepend(_gst_modules,module);
_gst_modules_seqno++;

View file

@ -93,39 +93,41 @@ props_find_func (gconstpointer a,
return (entry1 - entry2->propid);
}
static void
gst_props_entry_fill (GstPropsEntry *entry, va_list *var_args)
{
entry->propstype = va_arg (*var_args, GstPropsId);
switch (entry->propstype) {
case GST_PROPS_INT_ID:
entry->data.int_data = va_arg (*var_args, gint);
break;
case GST_PROPS_INT_RANGE_ID:
entry->data.int_range_data.min = va_arg (*var_args, gint);
entry->data.int_range_data.max = va_arg (*var_args, gint);
break;
case GST_PROPS_FLOAT_ID:
entry->data.float_data = va_arg (*var_args, gdouble);
break;
case GST_PROPS_FLOAT_RANGE_ID:
entry->data.float_range_data.min = va_arg (*var_args, gdouble);
entry->data.float_range_data.max = va_arg (*var_args, gdouble);
break;
case GST_PROPS_FOURCC_ID:
entry->data.fourcc_data = va_arg (*var_args, gulong);
break;
case GST_PROPS_BOOL_ID:
entry->data.bool_data = va_arg (*var_args, gboolean);
break;
case GST_PROPS_STRING_ID:
entry->data.string_data.string = g_strdup (va_arg (*var_args, gchar*));
break;
default:
break;
}
}
/* This is implemented as a huge macro because we cannot pass
* va_list variables by reference on some architectures.
*/
#define GST_PROPS_ENTRY_FILL(entry, var_args) \
G_STMT_START { \
entry->propstype = va_arg (var_args, GstPropsId); \
\
switch (entry->propstype) { \
case GST_PROPS_INT_ID: \
entry->data.int_data = va_arg (var_args, gint); \
break; \
case GST_PROPS_INT_RANGE_ID: \
entry->data.int_range_data.min = va_arg (var_args, gint); \
entry->data.int_range_data.max = va_arg (var_args, gint); \
break; \
case GST_PROPS_FLOAT_ID: \
entry->data.float_data = va_arg (var_args, gdouble); \
break; \
case GST_PROPS_FLOAT_RANGE_ID: \
entry->data.float_range_data.min = va_arg (var_args, gdouble); \
entry->data.float_range_data.max = va_arg (var_args, gdouble); \
break; \
case GST_PROPS_FOURCC_ID: \
entry->data.fourcc_data = va_arg (var_args, gulong); \
break; \
case GST_PROPS_BOOL_ID: \
entry->data.bool_data = va_arg (var_args, gboolean); \
break; \
case GST_PROPS_STRING_ID: \
entry->data.string_data.string = g_strdup (va_arg (var_args, gchar*)); \
break; \
default: \
break; \
} \
} G_STMT_END
/**
* gst_props_new:
@ -186,7 +188,7 @@ gst_props_newv (const gchar *firstname, va_list var_args)
g_mutex_unlock (_gst_props_entries_chunk_lock);
entry->propid = g_quark_from_string (prop_name);
gst_props_entry_fill (entry, &var_args);
GST_PROPS_ENTRY_FILL (entry, var_args);
switch (entry->propstype) {
case GST_PROPS_INT_ID:
@ -210,10 +212,10 @@ gst_props_newv (const gchar *firstname, va_list var_args)
prop_name = va_arg (var_args, gchar*);
continue;
default:
g_warning ("unknown property type found %d for '%s'\n", entry->propstype, prop_name);
g_mutex_lock (_gst_props_entries_chunk_lock);
g_mem_chunk_free (_gst_props_entries_chunk, entry);
g_mutex_unlock (_gst_props_entries_chunk_lock);
g_assert_not_reached ();
break;
}
@ -258,7 +260,7 @@ gst_props_set (GstProps *props, const gchar *name, ...)
va_start (var_args, name);
gst_props_entry_fill (entry, &var_args);
GST_PROPS_ENTRY_FILL (entry, var_args);
va_end (var_args);
}
@ -432,6 +434,36 @@ gst_props_get_int (GstProps *props, const gchar *name)
return 0;
}
/**
* gst_props_get_float:
* @props: the props to get the float value from
* @name: the name of the props entry to get.
*
* Get the named entry as a float.
*
* Returns: the float value of the named entry, 0.0 if not found.
*/
gfloat
gst_props_get_float (GstProps *props, const gchar *name)
{
GList *lentry;
GQuark quark;
quark = g_quark_from_string (name);
lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func);
if (lentry) {
GstPropsEntry *thisentry;
thisentry = (GstPropsEntry *)lentry->data;
return thisentry->data.float_data;
}
return 0.0F;
}
/**
* gst_props_get_fourcc_int:
* @props: the props to get the fourcc value from

View file

@ -90,6 +90,7 @@ gboolean gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops
GstProps* gst_props_set (GstProps *props, const gchar *name, ...);
gint gst_props_get_int (GstProps *props, const gchar *name);
gfloat gst_props_get_float (GstProps *props, const gchar *name);
gulong gst_props_get_fourcc_int (GstProps *props, const gchar *name);
gboolean gst_props_get_boolean (GstProps *props, const gchar *name);
const gchar* gst_props_get_string (GstProps *props, const gchar *name);

View file

@ -303,6 +303,7 @@ gst_schedule_cothreaded_chain (GstBin *bin, GstScheduleChain *chain) {
// need to set up the cothread now
if (wrapper_function != NULL) {
if (element->threadstate == NULL) {
// FIXME handle cothread_create returning NULL
element->threadstate = cothread_create (bin->threadcontext);
GST_DEBUG (GST_CAT_SCHEDULING,"created cothread %p for '%s'\n",element->threadstate,GST_ELEMENT_NAME(element));
}

View file

@ -267,6 +267,7 @@ gst_thread_change_state (GstElement *element)
g_mutex_lock(thread->lock);
g_mutex_lock (thread->lock);
// create the thread
pthread_create (&thread->thread_id, NULL,
gst_thread_main_loop, thread);

View file

@ -33,18 +33,15 @@
#include "gsttrace.h"
#ifdef HAVE_RDTS
__inline__ void read_tsc(guint64 *dst) {
__asm__ __volatile__
("rdtsc"
: "=a" (*(guint32 *)dst), "=d" (*(((guint32 *)dst) + 1))
:
: "eax", "edx");
}
#ifdef HAVE_RDTSC
guint64 tsc;
__asm__ __volatile__ ("rdtsc" : "=A" (tsc));
*dst = tsc;
#else
__inline__ void read_tsc(guint64 *dst) {
}
*dst = 0;
#endif
}
void gst_trace_read_tsc(guint64 *dst) {
read_tsc(dst);
@ -91,6 +88,27 @@ void gst_trace_flush(GstTrace *trace) {
trace->bufoffset = 0;
}
void gst_trace_text_flush(GstTrace *trace) {
int i;
const int strsize = 20+1 + 10+1 + 10+1 + 112+1 + 1;
char str[strsize];
if (!trace) {
trace = _gst_trace_default;
if (!trace ) return;
}
for (i=0; i<trace->bufoffset; i++) {
snprintf(str, strsize, "%20lld %10d %10d %s\n",
trace->buf[i].timestamp,
trace->buf[i].sequence,
trace->buf[i].data,
trace->buf[i].message);
write(trace->fd,str,strlen(str));
}
trace->bufoffset = 0;
}
void gst_trace_set_default(GstTrace *trace) {
g_return_if_fail(trace != NULL);
_gst_trace_default = trace;

View file

@ -52,6 +52,7 @@ GstTrace* gst_trace_new (guchar *filename, gint size);
void gst_trace_destroy (GstTrace *trace);
void gst_trace_flush (GstTrace *trace);
void gst_trace_text_flush (GstTrace *trace);
#define gst_trace_get_size(trace) ((trace)->bufsize)
#define gst_trace_get_offset(trace) ((trace)->bufoffset)
#define gst_trace_get_remaining(trace) ((trace)->bufsize - (trace)->bufoffset)

View file

@ -186,7 +186,7 @@ gst_typefind_chain (GstPad *pad, GstBuffer *buf)
gst_pad_set_caps (pad, caps);
{
{ /* FIXME: this should all be in an _emit() wrapper eventually */
int oldstate = GST_STATE(typefind);
gst_object_ref (GST_OBJECT (typefind));
gtk_signal_emit (GTK_OBJECT (typefind), gst_typefind_signals[HAVE_TYPE],
@ -198,6 +198,7 @@ gst_typefind_chain (GstPad *pad, GstBuffer *buf)
}
gst_object_unref (GST_OBJECT (typefind));
}
goto end;
}
funcs = g_slist_next (funcs);

View file

@ -235,7 +235,7 @@ gst_util_set_object_arg (GtkObject *object, guchar *name, gchar *value)
case GTK_TYPE_STRING:
gtk_object_set (GTK_OBJECT (object), name, value, NULL);
break;
case GTK_TYPE_ENUM:
case GTK_TYPE_ENUM:
case GTK_TYPE_INT: {
gint i;
sscanf (value, "%d", &i);

1
gstplay/AUTHORS Normal file
View file

@ -0,0 +1 @@
arik devens <arik@gnome.org>

20
gstplay/ChangeLog Normal file
View file

@ -0,0 +1,20 @@
2001-05-20 Arik Devens <arik@gnome.org>
General code cleanup and moving bits around as well.
* gstplay.c (gst_play_have_size): Added saving of the source_width
and source_height so that changing the size is possible.
(gst_play_set_display_size): New function to change the displayed
size.
* callbacks.c (on_original_size_activate): Added a new function to
restore the size of the media to it's default.
(on_double_size_activate): Added a new function to double the size
of the media.
(on_full_screen_activate): Added a new function to (theoretically)
do full-screen action baby!
* full-screen.h: New file for full-screen action baby!
* full-screen.c: New file for full-screen action baby!

View file

@ -20,7 +20,8 @@ libgstmediaplay_la_SOURCES = \
gstplay.c \
gstmediaplay.c \
gststatusarea.c \
callbacks.c
callbacks.c \
full-screen.c
gstmediaplay_SOURCES = \
main.c
@ -33,7 +34,8 @@ noinst_HEADERS = \
gstmediaplay.h \
gststatusarea.h \
callbacks.h \
gstplayprivate.h
gstplayprivate.h \
full-screen.h
libgstmediaplay_la_LDFLAGS = -rdynamic

View file

@ -1,68 +1,95 @@
#ifdef HAVE_CONFIG_H
# include <config.h>
#include <config.h>
#endif
#include <gnome.h>
#include <glade/glade.h>
#include <gst/gst.h>
#include <sys/stat.h>
#include <unistd.h>
#include "gstmediaplay.h"
#include "gstplay.h"
#include "callbacks.h"
GtkFileSelection *open_file_selection;
void
on_save1_activate (GtkMenuItem *menuitem,
gpointer user_data)
on_save1_activate (GtkMenuItem *menuitem, gpointer user_data)
{
printf("file1 activate\n");
printf ("file1 activate\n");
}
void
on_save_as1_activate (GtkMenuItem *menuitem,
gpointer user_data)
on_save_as1_activate (GtkMenuItem *menuitem, gpointer user_data)
{
printf("file1 activate\n");
printf ("file1 activate\n");
}
void
on_media2_activate (GtkMenuItem *menuitem,
gpointer user_data)
on_media2_activate (GtkMenuItem *menuitem, gpointer user_data)
{
printf("file1 activate\n");
printf ("file1 activate\n");
}
void
on_preferences1_activate (GtkMenuItem *menuitem,
gpointer user_data)
on_original_size_activate (GtkMenuItem *menuitem, gpointer user_data)
{
printf("file1 activate\n");
GstMediaPlay *mplay;
GstPlay *play;
mplay = GST_MEDIA_PLAY (user_data);
play = mplay->play;
gst_play_set_display_size (play, 0);
}
void on_about_activate(GtkWidget *widget, gpointer data)
void
on_double_size_activate (GtkMenuItem *menuitem, gpointer user_data)
{
GladeXML *xml;
struct stat statbuf;
GstMediaPlay *mplay;
GstPlay *play;
mplay = GST_MEDIA_PLAY (user_data);
play = mplay->play;
if (stat(DATADIR"gstmediaplay.glade", &statbuf) == 0) {
xml = glade_xml_new (DATADIR"gstmediaplay.glade", "about");
}
else {
xml = glade_xml_new ("gstmediaplay.glade", "about");
}
/* connect the signals in the interface */
glade_xml_signal_autoconnect(xml);
gst_play_set_display_size (play, 1);
}
void on_gstplay_destroy(GtkWidget *widget, gpointer data)
void
on_full_screen_activate (GtkMenuItem *menuitem, gpointer user_data)
{
gst_main_quit();
GstMediaPlay *mplay;
GstPlay *play;
mplay = GST_MEDIA_PLAY (user_data);
play = mplay->play;
gst_play_set_display_size (play, 2);
}
void
on_preferences1_activate (GtkMenuItem *menuitem, gpointer user_data)
{
printf ("file1 activate\n");
}
void on_about_activate (GtkWidget *widget, gpointer data)
{
GladeXML *xml;
struct stat statbuf;
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
xml = glade_xml_new (DATADIR"gstmediaplay.glade", "about");
}
else
xml = glade_xml_new ("gstmediaplay.glade", "about");
/* connect the signals in the interface */
glade_xml_signal_autoconnect (xml);
}
void on_gstplay_destroy (GtkWidget *widget, gpointer data)
{
gst_main_quit();
}

View file

@ -1,42 +1,35 @@
#include <gnome.h>
void
on_file1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_open1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_close1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_media1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_play2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_pause1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_stop1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_file1_activate (GtkMenuItem *menuitem,
gpointer user_data);
on_about1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_open1_activate (GtkMenuItem *menuitem,
gpointer user_data);
on_hscale1_value_changed (GtkAdjustment *adj,
gpointer user_data);
void
on_close1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_media1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_play2_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_pause1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_stop1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_about1_activate (GtkMenuItem *menuitem,
gpointer user_data);
void
on_hscale1_value_changed (GtkAdjustment *adj,
gpointer user_data);
void
on_drawingarea1_configure_event (GtkWidget *widget, GdkEventConfigure *event,
gpointer user_data);
on_drawingarea1_configure_event (GtkWidget *widget,
GdkEventConfigure *event,
gpointer user_data);

247
gstplay/full-screen.c Normal file
View file

@ -0,0 +1,247 @@
#include <config.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtkmain.h>
#include "full-screen.h"
#include "gstplay.h"
/* Private part of the FullScreen structure */
struct _FullScreenPrivate {
GstPlay *play;
/* Whether we have a keyboard grab */
guint have_grab : 1;
};
static void full_screen_class_init (FullScreenClass *class);
static void full_screen_init (FullScreen *fs);
static void full_screen_finalize (GtkObject *object);
static void full_screen_show (GtkWidget *widget);
static void full_screen_hide (GtkWidget *widget);
static gint full_screen_key_press (GtkWidget *widget, GdkEventKey *event);
static GtkWindowClass *parent_class;
/**
* @void:
*
* Registers the #FullScreen class if necessary, and returns the type ID
* associated to it.
*
* Return value: The type ID of the #FullScreen class.
**/
GtkType
full_screen_get_type (void)
{
static GtkType full_screen_type = 0;
if (!full_screen_type) {
static GtkTypeInfo full_screen_info = {
"FullScreen",
sizeof (FullScreen),
sizeof (FullScreenClass),
(GtkClassInitFunc) full_screen_class_init,
(GtkObjectInitFunc) full_screen_init,
NULL, /* reserved_1 */
NULL, /* reserved_2 */
(GtkClassInitFunc) NULL
};
full_screen_type = gtk_type_unique (GTK_TYPE_WINDOW, &full_screen_info);
}
return full_screen_type;
}
/* Class initialization function for the full screen mode */
static void
full_screen_class_init (FullScreenClass *class)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
object_class = (GtkObjectClass *) class;
widget_class = (GtkWidgetClass *) class;
parent_class = gtk_type_class (GTK_TYPE_WINDOW);
object_class->finalize = full_screen_finalize;
widget_class->show = full_screen_show;
widget_class->hide = full_screen_hide;
widget_class->key_press_event = full_screen_key_press;
}
/* Object initialization function for the full screen view */
static void
full_screen_init (FullScreen *fs)
{
FullScreenPrivate *priv;
priv = g_new0 (FullScreenPrivate, 1);
fs->priv = priv;
GTK_WINDOW (fs)->type = GTK_WINDOW_POPUP;
g_assert (fs != NULL);
gtk_widget_set_usize (GTK_WIDGET (fs), gdk_screen_width (), gdk_screen_height ());
gtk_widget_set_uposition (GTK_WIDGET (fs), 0, 0);
priv->play = gst_play_new();
gtk_container_add (GTK_CONTAINER (fs), GTK_WIDGET (priv->play));
gtk_widget_show (priv->play);
}
/* Finalize handler for the full screen view */
static void
full_screen_finalize (GtkObject *object)
{
FullScreen *fs;
FullScreenPrivate *priv;
g_return_if_fail (object != NULL);
g_return_if_fail (IS_FULL_SCREEN (object));
fs = FULL_SCREEN (object);
priv = fs->priv;
g_free (priv);
fs->priv = NULL;
if (GTK_OBJECT_CLASS (parent_class)->finalize)
(* GTK_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* Widget methods */
/* Show handler for the full screen view */
static void
full_screen_show (GtkWidget *widget)
{
FullScreen *fs;
FullScreenPrivate *priv;
fs = FULL_SCREEN (widget);
priv = fs->priv;
if (GTK_WIDGET_CLASS (parent_class)->show)
(* GTK_WIDGET_CLASS (parent_class)->show) (widget);
priv->have_grab = gdk_keyboard_grab (widget->window, TRUE, GDK_CURRENT_TIME) == 0;
gtk_grab_add (widget);
//gtk_widget_grab_focus (ui_image_get_image_view (UI_IMAGE (priv->ui)));
}
/* Hide handler for the full screen view */
static void
full_screen_hide (GtkWidget *widget)
{
FullScreen *fs;
FullScreenPrivate *priv;
fs = FULL_SCREEN (widget);
priv = fs->priv;
if (priv->have_grab) {
priv->have_grab = FALSE;
gdk_keyboard_ungrab (GDK_CURRENT_TIME);
}
if (GTK_WIDGET_CLASS (parent_class)->show)
(* GTK_WIDGET_CLASS (parent_class)->show) (widget);
gtk_widget_destroy (widget);
}
/* Key press handler for the full screen view */
static gint
full_screen_key_press (GtkWidget *widget, GdkEventKey *event)
{
gint result;
gboolean do_hide;
result = FALSE;
if (GTK_WIDGET_CLASS (parent_class)->key_press_event)
result = (* GTK_WIDGET_CLASS (parent_class)->key_press_event) (widget, event);
if (result)
return result;
do_hide = FALSE;
switch (event->keyval) {
case GDK_Escape:
do_hide = TRUE;
break;
case GDK_W:
case GDK_w:
if (event->state & GDK_CONTROL_MASK)
do_hide = TRUE;
break;
case GDK_Q:
case GDK_q:
do_hide = TRUE;
break;
default:
return FALSE;
}
if (do_hide)
gtk_widget_hide (widget);
return TRUE;
}
/**
* full_screen_new:
* @void:
*
* Creates a new empty full screen image viewer.
*
* Return value: A newly-created full screen image viewer.
**/
GtkWidget *
full_screen_new (void)
{
return GTK_WIDGET (gtk_type_new (TYPE_FULL_SCREEN));
}
void
full_screen_set_uri (FullScreen *fs,
GstPlay *play,
const guchar *uri)
{
g_return_if_fail (fs != NULL);
g_return_if_fail (play != NULL);
g_return_if_fail (uri != NULL);
g_return_if_fail (IS_FULL_SCREEN (fs));
g_return_if_fail (GST_IS_PLAY (play));
gst_play_set_uri (play, uri);
gst_play_play (play);
}
GstPlay *
full_screen_get_gst_play (FullScreen *fs)
{
FullScreenPrivate *priv;
g_return_val_if_fail (fs != NULL, 0);
priv = fs->priv;
return priv->play;
}

44
gstplay/full-screen.h Normal file
View file

@ -0,0 +1,44 @@
#ifndef FULL_SCREEN_H
#define FULL_SCREEN_H
#include <libgnome/gnome-defs.h>
#include <gtk/gtkwindow.h>
#include "gstplay.h"
BEGIN_GNOME_DECLS
#define TYPE_FULL_SCREEN (full_screen_get_type ())
#define FULL_SCREEN(obj) (GTK_CHECK_CAST ((obj), TYPE_FULL_SCREEN, FullScreen))
#define FULL_SCREEN_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), TYPE_FULL_SCREEN, \
FullScreenClass))
#define IS_FULL_SCREEN(obj) (GTK_CHECK_TYPE ((obj), TYPE_FULL_SCREEN))
#define IS_FULL_SCREEN_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), TYPE_FULL_SCREEN))
typedef struct _FullScreen FullScreen;
typedef struct _FullScreenClass FullScreenClass;
typedef struct _FullScreenPrivate FullScreenPrivate;
struct _FullScreen {
GtkWindow window;
/* Private data */
FullScreenPrivate *priv;
};
struct _FullScreenClass {
GtkWindowClass parent_class;
};
GtkType full_screen_get_type (void);
GtkWidget *full_screen_new (void);
void full_screen_set_uri (FullScreen *fs, GstPlay *play, const guchar *uri);
GstPlay * full_screen_get_gst_play (FullScreen *fs);
END_GNOME_DECLS
#endif

View file

@ -1,8 +1,3 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h>
#include <sys/stat.h>
@ -12,26 +7,26 @@
#include "gstmediaplay.h"
#include "callbacks.h"
static void gst_media_play_class_init (GstMediaPlayClass *klass);
static void gst_media_play_init (GstMediaPlay *play);
static void gst_media_play_class_init (GstMediaPlayClass *klass);
static void gst_media_play_init (GstMediaPlay *play);
static void gst_media_play_set_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_media_play_get_arg (GtkObject *object,GtkArg *arg,guint id);
static void gst_media_play_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_media_play_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay);
static void gst_media_play_state_changed (GstPlay *play, GstPlayState state, GstMediaPlay *mplay);
static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay);
static void gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay);
static void gst_media_play_state_changed (GstPlay *play, GstPlayState state, GstMediaPlay *mplay);
static void gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay);
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
static void update_buttons (GstMediaPlay *mplay, GstPlayState state);
static void update_slider (GstMediaPlay *mplay, GtkAdjustment *adjustment, gfloat value);
/* signals and args */
enum {
LAST_SIGNAL
LAST_SIGNAL
};
enum {
ARG_0,
ARG_0,
};
static void
@ -44,58 +39,58 @@ target_drag_data_received (GtkWidget *widget,
guint time,
GstMediaPlay *play)
{
if (strstr (data->data, "file:")) {
g_print ("Got: %s\n",&data->data[5]);
gdk_threads_leave ();
gst_media_play_start_uri (play, g_strchomp(&data->data[5]));
gdk_threads_enter ();
}
if (strstr (data->data, "file:")) {
g_print ("Got: %s\n", &data->data[5]);
gdk_threads_leave ();
gst_media_play_start_uri (play, g_strchomp (&data->data[5]));
gdk_threads_enter ();
}
}
static GtkTargetEntry target_table[] = {
{ "text/plain", 0, 0 }
{ "text/plain", 0, 0 }
};
static GtkObject *parent_class = NULL;
//static guint gst_media_play_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_media_play_get_type(void)
gst_media_play_get_type (void)
{
static GtkType play_type = 0;
static GtkType play_type = 0;
if (!play_type) {
static const GtkTypeInfo play_info = {
"GstMediaPlay",
sizeof(GstMediaPlay),
sizeof(GstMediaPlayClass),
(GtkClassInitFunc)gst_media_play_class_init,
(GtkObjectInitFunc)gst_media_play_init,
NULL,
NULL,
(GtkClassInitFunc)NULL,
};
play_type = gtk_type_unique(gtk_object_get_type(),&play_info);
}
return play_type;
if (!play_type) {
static const GtkTypeInfo play_info = {
"GstMediaPlay",
sizeof (GstMediaPlay),
sizeof (GstMediaPlayClass),
(GtkClassInitFunc) gst_media_play_class_init,
(GtkObjectInitFunc) gst_media_play_init,
NULL,
NULL,
(GtkClassInitFunc) NULL,
};
play_type = gtk_type_unique (gtk_object_get_type(), &play_info);
}
return play_type;
}
static void
gst_media_play_class_init (GstMediaPlayClass *klass)
{
GtkObjectClass *object_class;
GtkObjectClass *object_class;
parent_class = gtk_type_class (gtk_object_get_type ());
parent_class = gtk_type_class (gtk_object_get_type ());
object_class = (GtkObjectClass*)klass;
object_class = (GtkObjectClass*) klass;
object_class->set_arg = gst_media_play_set_arg;
object_class->get_arg = gst_media_play_get_arg;
object_class->set_arg = gst_media_play_set_arg;
object_class->get_arg = gst_media_play_get_arg;
}
typedef struct {
GstMediaPlay *play;
GModule *symbols;
GstMediaPlay *play;
GModule *symbols;
} connect_struct;
/* we need more control here so... */
@ -108,107 +103,107 @@ gst_media_play_connect_func (const gchar *handler_name,
gboolean after,
gpointer user_data)
{
GtkSignalFunc func;
connect_struct *data = (connect_struct *)user_data;
GtkSignalFunc func;
connect_struct *data = (connect_struct *) user_data;
if (!g_module_symbol (data->symbols, handler_name, (gpointer *)&func))
g_warning("gsteditorproperty: could not find signal handler '%s'.", handler_name);
else {
if (after)
gtk_signal_connect_after (object, signal_name, func, (gpointer) data->play);
else
gtk_signal_connect (object, signal_name, func, (gpointer) data->play);
}
if (!g_module_symbol (data->symbols, handler_name, (gpointer *)&func))
g_warning ("gsteditorproperty: could not find signal handler '%s'.", handler_name);
else {
if (after)
gtk_signal_connect_after (object, signal_name, func, (gpointer) data->play);
else
gtk_signal_connect (object, signal_name, func, (gpointer) data->play);
}
}
static void
gst_media_play_init(GstMediaPlay *mplay)
gst_media_play_init (GstMediaPlay *mplay)
{
GModule *symbols;
connect_struct data;
struct stat statbuf;
GModule *symbols;
connect_struct data;
struct stat statbuf;
/* load the interface */
if (stat(DATADIR"gstmediaplay.glade", &statbuf) == 0) {
mplay->xml = glade_xml_new (DATADIR"gstmediaplay.glade", "gstplay");
}
else {
mplay->xml = glade_xml_new ("gstmediaplay.glade", "gstplay");
}
g_assert (mplay->xml != NULL);
/* load the interface */
if (stat (DATADIR"gstmediaplay.glade", &statbuf) == 0) {
mplay->xml = glade_xml_new (DATADIR"gstmediaplay.glade", "gstplay");
}
else {
mplay->xml = glade_xml_new ("gstmediaplay.glade", "gstplay");
}
g_assert (mplay->xml != NULL);
mplay->slider = glade_xml_get_widget(mplay->xml, "slider");
g_assert (mplay->slider != NULL);
{
GtkArg arg;
GtkRange *range;
mplay->slider = glade_xml_get_widget (mplay->xml, "slider");
g_assert (mplay->slider != NULL);
{
GtkArg arg;
GtkRange *range;
arg.name = "adjustment";
gtk_object_getv (GTK_OBJECT (mplay->slider), 1, &arg);
range = GTK_RANGE (GTK_VALUE_POINTER (arg));
mplay->adjustment = gtk_range_get_adjustment (range);
arg.name = "adjustment";
gtk_object_getv (GTK_OBJECT (mplay->slider), 1, &arg);
range = GTK_RANGE (GTK_VALUE_POINTER (arg));
mplay->adjustment = gtk_range_get_adjustment (range);
gtk_signal_connect (GTK_OBJECT (mplay->adjustment), "value_changed",
GTK_SIGNAL_FUNC (gst_media_play_slider_changed), mplay);
}
gtk_signal_connect (GTK_OBJECT (mplay->adjustment), "value_changed",
GTK_SIGNAL_FUNC (gst_media_play_slider_changed), mplay);
}
mplay->play_button = glade_xml_get_widget (mplay->xml, "toggle_play");
g_assert (mplay->play_button != NULL);
mplay->pause_button = glade_xml_get_widget (mplay->xml, "toggle_pause");
g_assert (mplay->pause_button != NULL);
mplay->stop_button = glade_xml_get_widget (mplay->xml, "toggle_stop");
g_assert (mplay->stop_button != NULL);
mplay->play_button = glade_xml_get_widget (mplay->xml, "toggle_play");
g_assert (mplay->play_button != NULL);
mplay->pause_button = glade_xml_get_widget (mplay->xml, "toggle_pause");
g_assert (mplay->pause_button != NULL);
mplay->stop_button = glade_xml_get_widget (mplay->xml, "toggle_stop");
g_assert (mplay->stop_button != NULL);
mplay->window = glade_xml_get_widget (mplay->xml, "gstplay");
g_assert (mplay->window != NULL);
mplay->window = glade_xml_get_widget (mplay->xml, "gstplay");
g_assert (mplay->window != NULL);
gtk_drag_dest_set (mplay->window,
GTK_DEST_DEFAULT_ALL,
target_table, 1,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (mplay->window), "drag_data_received",
GTK_SIGNAL_FUNC (target_drag_data_received),
mplay);
gtk_drag_dest_set (mplay->window,
GTK_DEST_DEFAULT_ALL,
target_table, 1,
GDK_ACTION_COPY);
gtk_signal_connect (GTK_OBJECT (mplay->window), "drag_data_received",
GTK_SIGNAL_FUNC (target_drag_data_received),
mplay);
mplay->play = gst_play_new();
mplay->play = gst_play_new();
gtk_signal_connect (GTK_OBJECT (mplay->play), "frame_displayed",
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
mplay);
gtk_signal_connect (GTK_OBJECT (mplay->play), "frame_displayed",
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
mplay);
gtk_signal_connect (GTK_OBJECT (mplay->play), "audio_played",
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
mplay);
gtk_signal_connect (GTK_OBJECT (mplay->play), "audio_played",
GTK_SIGNAL_FUNC (gst_media_play_frame_displayed),
mplay);
gtk_signal_connect (GTK_OBJECT (mplay->play), "playing_state_changed",
GTK_SIGNAL_FUNC (gst_media_play_state_changed),
mplay);
gtk_signal_connect (GTK_OBJECT (mplay->play), "playing_state_changed",
GTK_SIGNAL_FUNC (gst_media_play_state_changed),
mplay);
gnome_dock_set_client_area (GNOME_DOCK (glade_xml_get_widget(mplay->xml, "dock1")),
GTK_WIDGET (mplay->play));
gnome_dock_set_client_area (GNOME_DOCK (glade_xml_get_widget(mplay->xml, "dock1")),
GTK_WIDGET (mplay->play));
gtk_widget_show (GTK_WIDGET (mplay->play));
gtk_widget_show (GTK_WIDGET (mplay->play));
mplay->status = (GstStatusArea *)glade_xml_get_widget (mplay->xml, "status_area");
gst_status_area_set_state (mplay->status, GST_STATUS_AREA_STATE_INIT);
gst_status_area_set_playtime (mplay->status, "00:00 / 00:00");
mplay->status = (GstStatusArea *) glade_xml_get_widget (mplay->xml, "status_area");
gst_status_area_set_state (mplay->status, GST_STATUS_AREA_STATE_INIT);
gst_status_area_set_playtime (mplay->status, "00:00 / 00:00");
symbols = g_module_open (NULL, 0);
symbols = g_module_open (NULL, 0);
data.play = mplay;
data.symbols = symbols;
data.play = mplay;
data.symbols = symbols;
glade_xml_signal_autoconnect_full (mplay->xml, gst_media_play_connect_func, &data);
glade_xml_signal_autoconnect_full (mplay->xml, gst_media_play_connect_func, &data);
mplay->last_time = 0;
mplay->last_time = 0;
}
GstMediaPlay *
gst_media_play_new ()
{
return GST_MEDIA_PLAY (gtk_type_new (GST_TYPE_MEDIA_PLAY));
return GST_MEDIA_PLAY (gtk_type_new (GST_TYPE_MEDIA_PLAY));
}
static void
@ -216,84 +211,84 @@ gst_media_play_update_status_area (GstMediaPlay *play,
gulong current_time,
gulong total_time)
{
gchar time[14];
gchar time[14];
sprintf(time, "%02lu:%02lu / %02lu:%02lu",
current_time/60, current_time%60,
total_time/60, total_time%60);
sprintf (time, "%02lu:%02lu / %02lu:%02lu",
current_time / 60, current_time % 60,
total_time / 60, total_time % 60);
gst_status_area_set_playtime (play->status, time);
gst_status_area_set_playtime (play->status, time);
}
void
gst_media_play_start_uri (GstMediaPlay *play,
const guchar *uri)
{
GstPlayReturn ret;
GstPlayReturn ret;
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_MEDIA_PLAY (play));
g_return_if_fail (play != NULL);
g_return_if_fail (GST_IS_MEDIA_PLAY (play));
if (uri != NULL) {
ret = gst_play_set_uri (play->play, uri);
if (uri != NULL) {
ret = gst_play_set_uri (play->play, uri);
if (!gst_play_media_can_seek (play->play)) {
gtk_widget_set_sensitive (play->slider, FALSE);
}
if (!gst_play_media_can_seek (play->play)) {
gtk_widget_set_sensitive (play->slider, FALSE);
}
gtk_window_set_title (GTK_WINDOW (play->window),
g_strconcat ( "Gstplay - ", uri, NULL));
gtk_window_set_title (GTK_WINDOW (play->window),
g_strconcat ( "Gstplay - ", uri, NULL));
gst_play_play (play->play);
}
gst_play_play (play->play);
}
}
typedef struct {
GtkWidget *selection;
GstMediaPlay *play;
GtkWidget *selection;
GstMediaPlay *play;
} file_select;
static void
on_load_file_selected (GtkWidget *button,
file_select *data)
{
GtkWidget *selector = data->selection;
GstMediaPlay *play = data->play;
GtkWidget *selector = data->selection;
GstMediaPlay *play = data->play;
gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION(selector));
gdk_threads_leave();
gst_media_play_start_uri (play, file_name);
gdk_threads_enter();
gchar *file_name = gtk_file_selection_get_filename (GTK_FILE_SELECTION (selector));
gdk_threads_leave();
gst_media_play_start_uri (play, file_name);
gdk_threads_enter();
g_free (data);
g_free (data);
}
void
on_open2_activate (GtkWidget *widget,
GstMediaPlay *play)
{
GtkWidget *file_selector;
file_select *file_data = g_new0 (file_select, 1);
GtkWidget *file_selector;
file_select *file_data = g_new0 (file_select, 1);
file_selector = gtk_file_selection_new("Please select a file to load.");
file_selector = gtk_file_selection_new ("Please select a file to load.");
file_data->selection = file_selector;
file_data->play = play;
file_data->selection = file_selector;
file_data->play = play;
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (on_load_file_selected),
file_data);
gtk_signal_connect (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (on_load_file_selected),
file_data);
/* Ensure that the dialog box is destroyed when the user clicks a button. */
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION(file_selector)->cancel_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
/* Ensure that the dialog box is destroyed when the user clicks a button. */
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->ok_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
gtk_signal_connect_object (GTK_OBJECT (GTK_FILE_SELECTION (file_selector)->cancel_button),
"clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
(gpointer) file_selector);
/* Display that dialog */
gtk_widget_show (file_selector);
/* Display that dialog */
gtk_widget_show (file_selector);
}
@ -302,14 +297,14 @@ gst_media_play_set_arg (GtkObject *object,
GtkArg *arg,
guint id)
{
GstMediaPlay *play;
play = GST_MEDIA_PLAY (object);
GstMediaPlay *play;
play = GST_MEDIA_PLAY (object);
switch (id) {
default:
g_warning("GstMediaPlay: unknown arg!");
break;
}
switch (id) {
default:
g_warning ("GstMediaPlay: unknown arg!");
break;
}
}
static void
@ -317,63 +312,61 @@ gst_media_play_get_arg (GtkObject *object,
GtkArg *arg,
guint id)
{
GstMediaPlay *play;
GstMediaPlay *play;
play = GST_MEDIA_PLAY (object);
play = GST_MEDIA_PLAY (object);
switch (id) {
default:
arg->type = GTK_TYPE_INVALID;
break;
}
switch (id) {
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
static void
gst_media_play_state_changed (GstPlay *play,
GstPlayState state,
GstMediaPlay *mplay)
gst_media_play_state_changed (GstPlay *play,
GstPlayState state,
GstMediaPlay *mplay)
{
GstStatusAreaState area_state;
GstStatusAreaState area_state;
g_return_if_fail (GST_IS_PLAY (play));
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
g_return_if_fail (GST_IS_PLAY (play));
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
gdk_threads_enter ();
update_buttons (mplay, state);
gdk_threads_enter ();
update_buttons (mplay, state);
switch (state) {
case GST_PLAY_STOPPED:
area_state = GST_STATUS_AREA_STATE_STOPPED;
break;
case GST_PLAY_PLAYING:
area_state = GST_STATUS_AREA_STATE_PLAYING;
break;
case GST_PLAY_PAUSED:
area_state = GST_STATUS_AREA_STATE_PAUSED;
break;
default:
area_state = GST_STATUS_AREA_STATE_INIT;
}
gst_status_area_set_state (mplay->status, area_state);
gdk_threads_leave ();
switch (state) {
case GST_PLAY_STOPPED:
area_state = GST_STATUS_AREA_STATE_STOPPED;
break;
case GST_PLAY_PLAYING:
area_state = GST_STATUS_AREA_STATE_PLAYING;
break;
case GST_PLAY_PAUSED:
area_state = GST_STATUS_AREA_STATE_PAUSED;
break;
default:
area_state = GST_STATUS_AREA_STATE_INIT;
}
gst_status_area_set_state (mplay->status, area_state);
gdk_threads_leave ();
}
void
on_gst_media_play_destroy (GtkWidget *widget,
GstMediaPlay *mplay)
on_gst_media_play_destroy (GtkWidget *widget, GstMediaPlay *mplay)
{
gst_main_quit ();
gst_main_quit ();
}
void
on_exit_menu_activate (GtkWidget *widget,
GstMediaPlay *mplay)
on_exit_menu_activate (GtkWidget *widget, GstMediaPlay *mplay)
{
gdk_threads_leave ();
gst_play_stop (mplay->play);
gdk_threads_enter ();
gst_main_quit ();
gdk_threads_leave ();
gst_play_stop (mplay->play);
gdk_threads_enter ();
gst_main_quit ();
}
gint
@ -381,128 +374,121 @@ on_gst_media_play_delete_event (GtkWidget *widget,
GdkEvent *event,
GstMediaPlay *mplay)
{
gdk_threads_leave ();
gst_play_stop (mplay->play);
gdk_threads_enter ();
return FALSE;
gdk_threads_leave ();
gst_play_stop (mplay->play);
gdk_threads_enter ();
return FALSE;
}
void
on_extended1_activate (GtkCheckMenuItem *item,
GstMediaPlay *mplay)
on_extended1_activate (GtkCheckMenuItem *item, GstMediaPlay *mplay)
{
gdk_threads_leave ();
gst_status_area_show_extended (mplay->status, item->active);
gdk_threads_enter ();
gdk_threads_leave ();
gst_status_area_show_extended (mplay->status, item->active);
gdk_threads_enter ();
}
static void
gst_media_play_frame_displayed (GstPlay *play,
GstMediaPlay *mplay)
gst_media_play_frame_displayed (GstPlay *play, GstMediaPlay *mplay)
{
gulong current_time;
gulong total_time;
gulong size, current_offset;
gulong current_time;
gulong total_time;
gulong size, current_offset;
g_return_if_fail (GST_IS_PLAY (play));
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
g_return_if_fail (GST_IS_PLAY (play));
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
current_time = gst_play_get_media_current_time (play);
total_time = gst_play_get_media_total_time (play);
size = gst_play_get_media_size (play);
current_offset = gst_play_get_media_offset (play);
current_time = gst_play_get_media_current_time (play);
total_time = gst_play_get_media_total_time (play);
size = gst_play_get_media_size (play);
current_offset = gst_play_get_media_offset (play);
//g_print ("%lu %lu %lu %lu\n", current_time, total_time, size, current_offset);
//g_print ("%lu %lu %lu %lu\n", current_time, total_time, size, current_offset);
if (current_time != mplay->last_time) {
gdk_threads_enter ();
gst_media_play_update_status_area (mplay, current_time, total_time);
update_slider (mplay, mplay->adjustment, current_offset*100.0/size);
mplay->last_time = current_time;
gdk_threads_leave ();
}
if (current_time != mplay->last_time) {
gdk_threads_enter ();
gst_media_play_update_status_area (mplay, current_time, total_time);
update_slider (mplay, mplay->adjustment, current_offset*100.0/size);
mplay->last_time = current_time;
gdk_threads_leave ();
}
}
static void
gst_media_play_slider_changed (GtkAdjustment *adj,
GstMediaPlay *mplay)
gst_media_play_slider_changed (GtkAdjustment *adj, GstMediaPlay *mplay)
{
gulong size;
gulong size;
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
g_return_if_fail (GST_IS_MEDIA_PLAY (mplay));
size = gst_play_get_media_size (mplay->play);
size = gst_play_get_media_size (mplay->play);
gst_play_media_seek(mplay->play, (int)(adj->value*size/100.0));
gst_play_media_seek (mplay->play, (int)(adj->value*size/100.0));
}
void
on_toggle_play_toggled (GtkToggleButton *togglebutton,
GstMediaPlay *play)
on_toggle_play_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play)
{
gdk_threads_leave ();
gst_play_play (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play));
gdk_threads_leave ();
gst_play_play (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play));
}
void
on_toggle_pause_toggled (GtkToggleButton *togglebutton,
GstMediaPlay *play)
on_toggle_pause_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play)
{
gdk_threads_leave ();
gst_play_pause (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play));
gdk_threads_leave ();
gst_play_pause (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play));
}
void
on_toggle_stop_toggled (GtkToggleButton *togglebutton,
GstMediaPlay *play)
on_toggle_stop_toggled (GtkToggleButton *togglebutton, GstMediaPlay *play)
{
gdk_threads_leave ();
gst_play_stop (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play));
gdk_threads_leave ();
gst_play_stop (play->play);
gdk_threads_enter ();
update_buttons (play, GST_PLAY_STATE(play->play));
}
static void
update_buttons (GstMediaPlay *mplay,
GstPlayState state)
update_buttons (GstMediaPlay *mplay, GstPlayState state)
{
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->play_button),
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
mplay);
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->pause_button),
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
mplay);
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->stop_button),
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
mplay);
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->play_button),
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
mplay);
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->pause_button),
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
mplay);
gtk_signal_handler_block_by_func (GTK_OBJECT (mplay->stop_button),
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
mplay);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), FALSE);
if (state == GST_PLAY_PLAYING) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), TRUE);
}
else if (state == GST_PLAY_PAUSED) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), TRUE);
}
else if (state == GST_PLAY_STOPPED) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), TRUE);
}
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->play_button),
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
mplay);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->pause_button),
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
mplay);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->stop_button),
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
mplay);
if (state == GST_PLAY_PLAYING) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->play_button), TRUE);
}
else if (state == GST_PLAY_PAUSED) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->pause_button), TRUE);
}
else if (state == GST_PLAY_STOPPED) {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mplay->stop_button), TRUE);
}
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->play_button),
GTK_SIGNAL_FUNC (on_toggle_play_toggled),
mplay);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->pause_button),
GTK_SIGNAL_FUNC (on_toggle_pause_toggled),
mplay);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (mplay->stop_button),
GTK_SIGNAL_FUNC (on_toggle_stop_toggled),
mplay);
}
static void
@ -510,12 +496,11 @@ update_slider (GstMediaPlay *mplay,
GtkAdjustment *adjustment,
gfloat value)
{
gtk_signal_handler_block_by_func (GTK_OBJECT (adjustment),
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
mplay);
gtk_adjustment_set_value (adjustment, value);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (adjustment),
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
mplay);
gtk_signal_handler_block_by_func (GTK_OBJECT (adjustment),
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
mplay);
gtk_adjustment_set_value (adjustment, value);
gtk_signal_handler_unblock_by_func (GTK_OBJECT (adjustment),
GTK_SIGNAL_FUNC (gst_media_play_slider_changed),
mplay);
}

View file

@ -138,6 +138,70 @@
<class>GtkMenu</class>
<name>view1_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>present_movie</name>
<label>P_resent Movie</label>
<right_justify>False</right_justify>
<widget>
<class>GtkMenu</class>
<name>present_movie_menu</name>
<widget>
<class>GtkMenuItem</class>
<name>original_size</name>
<accelerator>
<modifiers>GDK_MOD1_MASK</modifiers>
<key>GDK_1</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_original_size_activate</handler>
<data>mplay</data>
<last_modification_time>Sun, 06 May 2001 01:58:18 GMT</last_modification_time>
</signal>
<label>Original Size</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>double_size</name>
<accelerator>
<modifiers>GDK_MOD1_MASK</modifiers>
<key>GDK_2</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_double_size_activate</handler>
<last_modification_time>Sun, 06 May 2001 01:34:06 GMT</last_modification_time>
</signal>
<label>Double Size</label>
<right_justify>False</right_justify>
</widget>
<widget>
<class>GtkMenuItem</class>
<name>full_screen</name>
<accelerator>
<modifiers>GDK_MOD1_MASK</modifiers>
<key>GDK_3</key>
<signal>activate</signal>
</accelerator>
<signal>
<name>activate</name>
<handler>on_full_screen_activate</handler>
<last_modification_time>Sun, 06 May 2001 01:34:06 GMT</last_modification_time>
</signal>
<label>Full Screen</label>
<right_justify>False</right_justify>
</widget>
</widget>
</widget>
<widget>
<class>GtkCheckMenuItem</class>
<name>extended1</name>
@ -406,7 +470,8 @@
Wim Taymans &lt;wim.taymans@tvd.be&gt;,
Richard Boulton &lt;richard@tartarus.org&gt;,
Chris Emerson (PPC port),
Ronald Bultje &lt;rbultje@ronald.bitfreak.net&gt;
Ronald Bultje &lt;rbultje@ronald.bitfreak.net&gt;,
Arik Devens &lt;arik@gnome.org&gt;
</authors>
<comments>A generic media player for the gstreamer streaming media framework.</comments>
</widget>

View file

@ -1,54 +1,41 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifndef __GST_MEDIA_PLAY_H__
#define __GST_MEDIA_PLAY_H__
#include <glade/glade.h>
#include "gstplay.h"
#include "gststatusarea.h"
#define GST_TYPE_MEDIA_PLAY (gst_media_play_get_type())
#define GST_MEDIA_PLAY(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_MEDIA_PLAY, GstMediaPlay))
#define GST_MEDIA_PLAY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_MEDIA_PLAY, GstMediaPlayClass))
#define GST_IS_MEDIA_PLAY(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_MEDIA_PLAY))
#define GST_IS_MEDIA_PLAY_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_MEDIA_PLAY))
typedef struct _GstMediaPlay GstMediaPlay;
typedef struct _GstMediaPlayClass GstMediaPlayClass;
#define GST_TYPE_MEDIA_PLAY \
(gst_media_play_get_type())
#define GST_MEDIA_PLAY(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_MEDIA_PLAY,GstMediaPlay))
#define GST_MEDIA_PLAY_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_MEDIA_PLAY,GstMediaPlayClass))
#define GST_IS_MEDIA_PLAY(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_MEDIA_PLAY))
#define GST_IS_MEDIA_PLAY_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_MEDIA_PLAY))
struct _GstMediaPlay {
GtkObject parent;
GtkObject parent;
GladeXML *xml;
GstPlay *play;
GtkWidget *play_button;
GtkWidget *pause_button;
GtkWidget *stop_button;
GtkWidget *window;
GstStatusArea *status;
// the slider
GtkAdjustment *adjustment;
GtkWidget *slider;
gulong last_time;
GladeXML *xml;
GstPlay *play;
GtkWidget *play_button;
GtkWidget *pause_button;
GtkWidget *stop_button;
GtkWidget *window;
GstStatusArea *status;
// the slider
GtkAdjustment *adjustment;
GtkWidget *slider;
gulong last_time;
};
struct _GstMediaPlayClass {
GtkObjectClass parent_class;
GtkObjectClass parent_class;
};

File diff suppressed because it is too large Load diff

View file

@ -1,31 +1,21 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifndef __GSTPLAY_H__
#define __GSTPLAY_H__
#include <gst/gst.h>
#define GST_TYPE_PLAY (gst_play_get_type ())
#define GST_PLAY(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_PLAY, GstPlay))
#define GST_PLAY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_PLAY, GstPlayClass))
#define GST_IS_PLAY(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_PLAY))
#define GST_IS_PLAY_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_PLAY))
typedef struct _GstPlay GstPlay;
typedef struct _GstPlayClass GstPlayClass;
#define GST_TYPE_PLAY \
(gst_play_get_type())
#define GST_PLAY(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_PLAY,GstPlay))
#define GST_PLAY_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_PLAY,GstPlayClass))
#define GST_IS_PLAY(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_PLAY))
#define GST_IS_PLAY_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_PLAY))
typedef enum {
GST_PLAY_STOPPED,
GST_PLAY_PLAYING,
GST_PLAY_PAUSED,
GST_PLAY_STOPPED,
GST_PLAY_PLAYING,
GST_PLAY_PAUSED,
} GstPlayState;
typedef enum {
@ -36,30 +26,30 @@ typedef enum {
} GstPlayReturn;
typedef enum {
GST_PLAY_TYPE_AUDIO = (1 << 0),
GST_PLAY_TYPE_VIDEO = (1 << 1),
GST_PLAY_TYPE_AUDIO = (1 << 0),
GST_PLAY_TYPE_VIDEO = (1 << 1),
} GstPlayMediaTypeFlags;
struct _GstPlay {
GtkHBox parent;
GstPlayState state;
GstPlayMediaTypeFlags flags;
gpointer priv;
GtkHBox parent;
GstPlayState state;
GstPlayMediaTypeFlags flags;
gpointer priv;
};
#define GST_PLAY_STATE(play) ((play)->state)
#define GST_PLAY_MEDIA_TYPE(play) ((play)->flags)
#define GST_PLAY_STATE(play) ((play)->state)
#define GST_PLAY_MEDIA_TYPE(play) ((play)->flags)
#define GST_PLAY_IS_AUDIO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_AUDIO)
#define GST_PLAY_IS_VIDEO_TYPE(play) ((play)->flags & GST_PLAY_TYPE_VIDEO)
struct _GstPlayClass {
GtkHBoxClass parent_class;
GtkHBoxClass parent_class;
void (*state_changed) (GstPlay *play, GstPlayState state);
void (*frame_displayed) (GstPlay *play);
void (*audio_played) (GstPlay *play);
void (*state_changed) (GstPlay *play, GstPlayState state);
void (*frame_displayed) (GstPlay *play);
void (*audio_played) (GstPlay *play);
};
@ -85,6 +75,9 @@ void gst_play_media_seek (GstPlay *play, gulong offset);
gulong gst_play_get_media_total_time (GstPlay *play);
gulong gst_play_get_media_current_time (GstPlay *play);
/* set display stuff */
void gst_play_set_display_size ();
/* the autoplugged pipeline */
GstElement* gst_play_get_pipeline (GstPlay *play);

View file

@ -1,8 +1,3 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#ifndef __GSTPLAY_PRIVATE_H__
#define __GSTPLAY_PRIVATE_H__
@ -11,20 +6,24 @@
typedef struct _GstPlayPrivate GstPlayPrivate;
struct _GstPlayPrivate {
GstElement *bin;
GstElement *video_element, *audio_element;
GstElement *video_show;
GtkWidget *video_widget;
GstElement *src;
GstElement *thread;
GstElement *bin;
GstElement *video_element, *audio_element;
GstElement *video_show;
GtkWidget *video_widget;
GstElement *src;
guchar *uri;
gboolean muted;
gboolean can_seek;
GstElement *offset_element;
GstElement *bit_rate_element;
GstElement *media_time_element;
GstElement *current_time_element;
guchar *uri;
gboolean muted;
gboolean can_seek;
GstElement *offset_element;
GstElement *bit_rate_element;
GstElement *media_time_element;
GstElement *current_time_element;
guint source_width;
guint source_height;
};
#endif /* __GSTPLAY_PRIVATE_H__ */

View file

@ -1,31 +1,25 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h>
#include "gststatusarea.h"
static void gst_status_area_class_init(GstStatusAreaClass *klass);
static void gst_status_area_init(GstStatusArea *status_area);
static void gst_status_area_class_init (GstStatusAreaClass *klass);
static void gst_status_area_init (GstStatusArea *status_area);
static void gst_status_area_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_status_area_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_status_area_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_status_area_get_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_status_area_realize(GtkWidget *status_area);
static gint gst_status_area_expose(GtkWidget *widget, GdkEventExpose *event);
static void gst_status_area_realize (GtkWidget *status_area);
static gint gst_status_area_expose (GtkWidget *widget, GdkEventExpose *event);
#define DEFAULT_HEIGHT 20
#define DEFAULT_EXPANDED_HEIGHT 100
/* signals and args */
enum {
LAST_SIGNAL
LAST_SIGNAL
};
enum {
ARG_0,
ARG_0,
};
static GtkDrawingArea *parent_class = NULL;
@ -34,277 +28,267 @@ static GtkDrawingArea *parent_class = NULL;
GtkType
gst_status_area_get_type (void)
{
static GtkType status_area_type = 0;
static GtkType status_area_type = 0;
if (!status_area_type) {
static const GtkTypeInfo status_area_info = {
"GstStatusArea",
sizeof(GstStatusArea),
sizeof(GstStatusAreaClass),
(GtkClassInitFunc)gst_status_area_class_init,
(GtkObjectInitFunc)gst_status_area_init,
NULL,
NULL,
(GtkClassInitFunc)NULL,
};
status_area_type = gtk_type_unique (gtk_widget_get_type (),&status_area_info);
}
return status_area_type;
if (!status_area_type) {
static const GtkTypeInfo status_area_info = {
"GstStatusArea",
sizeof(GstStatusArea),
sizeof(GstStatusAreaClass),
(GtkClassInitFunc)gst_status_area_class_init,
(GtkObjectInitFunc)gst_status_area_init,
NULL,
NULL,
(GtkClassInitFunc)NULL,
};
status_area_type = gtk_type_unique (gtk_widget_get_type (),&status_area_info);
}
return status_area_type;
}
static void
gst_status_area_class_init (GstStatusAreaClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
parent_class = gtk_type_class (gtk_widget_get_type ());
parent_class = gtk_type_class (gtk_widget_get_type ());
object_class = (GtkObjectClass*)klass;
widget_class = (GtkWidgetClass*)klass;
object_class = (GtkObjectClass*)klass;
widget_class = (GtkWidgetClass*)klass;
object_class->set_arg = gst_status_area_set_arg;
object_class->get_arg = gst_status_area_get_arg;
object_class->set_arg = gst_status_area_set_arg;
object_class->get_arg = gst_status_area_get_arg;
widget_class->realize = gst_status_area_realize;
widget_class->expose_event = gst_status_area_expose;
widget_class->realize = gst_status_area_realize;
widget_class->expose_event = gst_status_area_expose;
}
static void
gst_status_area_init (GstStatusArea *status_area)
{
GTK_WIDGET(status_area)->requisition.height = DEFAULT_HEIGHT;
GTK_WIDGET(status_area)->requisition.height = DEFAULT_HEIGHT;
status_area->state = GST_STATUS_AREA_STATE_INIT;
status_area->expanded = FALSE;
status_area->state = GST_STATUS_AREA_STATE_INIT;
status_area->expanded = FALSE;
}
GstStatusArea *
gst_status_area_new (void)
{
return GST_STATUS_AREA (gtk_type_new (GST_TYPE_STATUS_AREA));
return GST_STATUS_AREA (gtk_type_new (GST_TYPE_STATUS_AREA));
}
static void
gst_status_area_realize (GtkWidget *widget)
{
GdkWindowAttr attributes;
gint attributes_mask;
GstStatusArea *status_area;
GdkWindowAttr attributes;
gint attributes_mask;
GstStatusArea *status_area;
g_return_if_fail (widget != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(widget));
g_return_if_fail (widget != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(widget));
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
status_area = GST_STATUS_AREA(widget);
GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
status_area = GST_STATUS_AREA(widget);
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
attributes.x = widget->allocation.x;
attributes.y = widget->allocation.y;
attributes.width = widget->allocation.width;
attributes.height = widget->allocation.height;
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
| GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
widget->window = gdk_window_new (widget->parent->window, &attributes, attributes_mask);
widget->style = gtk_style_attach (widget->style, widget->window);
widget->style = gtk_style_attach (widget->style, widget->window);
}
static gint
gst_status_area_expose(GtkWidget *widget,
GdkEventExpose *event)
gst_status_area_expose(GtkWidget *widget, GdkEventExpose *event)
{
GstStatusArea *status_area;
guchar *statustext;
GstStatusArea *status_area;
guchar *statustext;
g_return_val_if_fail (GST_IS_STATUS_AREA (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
g_return_val_if_fail (GST_IS_STATUS_AREA (widget), FALSE);
g_return_val_if_fail (event != NULL, FALSE);
status_area = GST_STATUS_AREA (widget);
status_area = GST_STATUS_AREA (widget);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) {
gdk_draw_rectangle (widget->window,
widget->style->black_gc,
TRUE,
0, 0,
widget->allocation.width,
widget->allocation.height);
if (GTK_WIDGET_VISIBLE (widget) && GTK_WIDGET_MAPPED (widget)) {
gdk_draw_rectangle (widget->window,
widget->style->black_gc,
TRUE,
0, 0,
widget->allocation.width,
widget->allocation.height);
if (status_area->expanded) {
gint width;
if (status_area->expanded) {
gint width;
gdk_draw_line (widget->window,
widget->style->dark_gc[0],
0, widget->allocation.height - 20,
widget->allocation.width, widget->allocation.height - 20);
gdk_draw_line (widget->window,
widget->style->dark_gc[0],
0, widget->allocation.height - 20,
widget->allocation.width, widget->allocation.height - 20);
width = gdk_string_width (widget->style->font, "Show:");
width = gdk_string_width (widget->style->font, "Show:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 15,
"Show:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 15,
"Show:");
width = gdk_string_width (widget->style->font, "Clip:");
width = gdk_string_width (widget->style->font, "Clip:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 40,
"Clip:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 40,
"Clip:");
width = gdk_string_width (widget->style->font, "Author:");
width = gdk_string_width (widget->style->font, "Author:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 55,
"Author:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 55,
"Author:");
width = gdk_string_width (widget->style->font, "Copyright:");
width = gdk_string_width (widget->style->font, "Copyright:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 70,
"Copyright:");
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
80-width, 70,
"Copyright:");
gdk_draw_line (widget->window,
widget->style->dark_gc[0],
0, widget->allocation.height - 80,
widget->allocation.width, widget->allocation.height - 80);
gdk_draw_line (widget->window,
widget->style->dark_gc[0],
0, widget->allocation.height - 80,
widget->allocation.width, widget->allocation.height - 80);
}
}
switch (status_area->state) {
case GST_STATUS_AREA_STATE_INIT:
statustext = "Initializing";
break;
case GST_STATUS_AREA_STATE_PLAYING:
statustext = "Playing";
break;
case GST_STATUS_AREA_STATE_PAUSED:
statustext = "Paused";
break;
case GST_STATUS_AREA_STATE_STOPPED:
statustext = "Stopped";
break;
default:
statustext = "";
break;
}
switch (status_area->state) {
case GST_STATUS_AREA_STATE_INIT:
statustext = "Initializing";
break;
case GST_STATUS_AREA_STATE_PLAYING:
statustext = "Playing";
break;
case GST_STATUS_AREA_STATE_PAUSED:
statustext = "Paused";
break;
case GST_STATUS_AREA_STATE_STOPPED:
statustext = "Stopped";
break;
default:
statustext = "";
break;
}
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
8, widget->allocation.height-5,
statustext);
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
8, widget->allocation.height-5,
statustext);
if (status_area->playtime) {
gint width = gdk_string_width (widget->style->font, status_area->playtime);
if (status_area->playtime) {
gint width = gdk_string_width (widget->style->font, status_area->playtime);
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
widget->allocation.width-width-20,
widget->allocation.height-5,
status_area->playtime);
}
}
gdk_draw_string (widget->window,
widget->style->font,
widget->style->white_gc,
widget->allocation.width-width-20,
widget->allocation.height-5,
status_area->playtime);
}
}
return FALSE;
return FALSE;
}
void
gst_status_area_set_state (GstStatusArea *area,
GstStatusAreaState state)
gst_status_area_set_state (GstStatusArea *area, GstStatusAreaState state)
{
g_return_if_fail(area != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(area));
g_return_if_fail(area != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(area));
area->state = state;
area->state = state;
if (GTK_WIDGET_VISIBLE(area))
gtk_widget_queue_draw(GTK_WIDGET(area));
if (GTK_WIDGET_VISIBLE(area))
gtk_widget_queue_draw(GTK_WIDGET(area));
}
void
gst_status_area_set_playtime (GstStatusArea *area,
const guchar *time)
gst_status_area_set_playtime (GstStatusArea *area, const guchar *time)
{
g_return_if_fail(area != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(area));
g_return_if_fail(time != NULL);
g_return_if_fail(area != NULL);
g_return_if_fail(GST_IS_STATUS_AREA(area));
g_return_if_fail(time != NULL);
if (area->playtime) g_free (area->playtime);
if (area->playtime) g_free (area->playtime);
area->playtime = g_strdup (time);
area->playtime = g_strdup (time);
if (GTK_WIDGET_VISIBLE(area))
gtk_widget_queue_draw(GTK_WIDGET(area));
if (GTK_WIDGET_VISIBLE(area))
gtk_widget_queue_draw(GTK_WIDGET(area));
}
void
gst_status_area_set_streamtype (GstStatusArea *area,
const guchar *type)
gst_status_area_set_streamtype (GstStatusArea *area, const guchar *type)
{
}
void
gst_status_area_show_extended (GstStatusArea *area,
gboolean show)
gst_status_area_show_extended (GstStatusArea *area, gboolean show)
{
area->expanded = show;
area->expanded = show;
if (show) {
GTK_WIDGET(area)->requisition.height = DEFAULT_EXPANDED_HEIGHT;
}
else {
GTK_WIDGET(area)->requisition.height = DEFAULT_HEIGHT;
}
gtk_widget_queue_resize (GTK_WIDGET (area));
if (show) {
GTK_WIDGET(area)->requisition.height = DEFAULT_EXPANDED_HEIGHT;
}
else {
GTK_WIDGET(area)->requisition.height = DEFAULT_HEIGHT;
}
gtk_widget_queue_resize (GTK_WIDGET (area));
}
static void
gst_status_area_set_arg(GtkObject *object,
GtkArg *arg,
guint id)
gst_status_area_set_arg(GtkObject *object, GtkArg *arg, guint id)
{
GstStatusArea *status_area;
GstStatusArea *status_area;
status_area = GST_STATUS_AREA(object);
status_area = GST_STATUS_AREA(object);
switch (id) {
default:
g_warning("GstStatusArea: unknown arg!");
break;
}
switch (id) {
default:
g_warning("GstStatusArea: unknown arg!");
break;
}
}
static void
gst_status_area_get_arg(GtkObject *object,
GtkArg *arg,
guint id)
gst_status_area_get_arg(GtkObject *object, GtkArg *arg, guint id)
{
GstStatusArea *status_area;
GstStatusArea *status_area;
status_area = GST_STATUS_AREA(object);
status_area = GST_STATUS_AREA(object);
switch (id) {
default:
arg->type = GTK_TYPE_INVALID;
break;
}
switch (id) {
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}

View file

@ -4,38 +4,32 @@
#include <gst/gst.h>
#include <gtk/gtk.h>
#define GST_TYPE_STATUS_AREA (gst_status_area_get_type ())
#define GST_STATUS_AREA(obj) (GTK_CHECK_CAST ((obj), GST_TYPE_STATUS_AREA, GstStatusArea))
#define GST_STATUS_AREA_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GST_TYPE_STATUS_AREA, GstStatusAreaClass))
#define GST_IS_STATUS_AREA(obj) (GTK_CHECK_TYPE ((obj), GST_TYPE_STATUS_AREA))
#define GST_IS_STATUS_AREA_CLASS(obj) (GTK_CHECK_CLASS_TYPE ((klass), GST_TYPE_STATUS_AREA))
typedef struct _GstStatusArea GstStatusArea;
typedef struct _GstStatusAreaClass GstStatusAreaClass;
#define GST_TYPE_STATUS_AREA \
(gst_status_area_get_type())
#define GST_STATUS_AREA(obj) \
(GTK_CHECK_CAST((obj),GST_TYPE_STATUS_AREA,GstStatusArea))
#define GST_STATUS_AREA_CLASS(klass) \
(GTK_CHECK_CLASS_CAST((klass),GST_TYPE_STATUS_AREA,GstStatusAreaClass))
#define GST_IS_STATUS_AREA(obj) \
(GTK_CHECK_TYPE((obj),GST_TYPE_STATUS_AREA))
#define GST_IS_STATUS_AREA_CLASS(obj) \
(GTK_CHECK_CLASS_TYPE((klass),GST_TYPE_STATUS_AREA))
typedef enum {
GST_STATUS_AREA_STATE_INIT,
GST_STATUS_AREA_STATE_PLAYING,
GST_STATUS_AREA_STATE_PAUSED,
GST_STATUS_AREA_STATE_STOPPED,
GST_STATUS_AREA_STATE_INIT,
GST_STATUS_AREA_STATE_PLAYING,
GST_STATUS_AREA_STATE_PAUSED,
GST_STATUS_AREA_STATE_STOPPED,
} GstStatusAreaState;
struct _GstStatusArea {
GtkWidget parent;
GstStatusAreaState state;
guchar *playtime;
gboolean expanded;
GtkWidget parent;
GstStatusAreaState state;
guchar *playtime;
gboolean expanded;
};
struct _GstStatusAreaClass {
GtkWidgetClass parent_class;
GtkWidgetClass parent_class;
};

View file

@ -1,35 +1,28 @@
/*
* Initial main.c file generated by Glade. Edit as required.
* Glade will not overwrite this file.
*/
#include <config.h>
#include <gnome.h>
#include "gstmediaplay.h"
int
main (int argc, char *argv[])
{
GstMediaPlay *play;
GstMediaPlay *play;
gst_init (&argc,&argv);
gnome_init ("gstreamer", VERSION, argc, argv);
glade_init();
glade_gnome_init();
play = gst_media_play_new ();
if (argc > 1) {
gst_media_play_start_uri (play, argv[1]);
}
xmlSaveFile("gstmediaplay.gst", gst_xml_write(gst_play_get_pipeline(play->play)));
gdk_threads_enter ();
gst_main ();
gdk_threads_leave ();
return 0;
gst_init (&argc,&argv);
gnome_init ("gstreamer", VERSION, argc, argv);
glade_init();
glade_gnome_init();
play = gst_media_play_new ();
if (argc > 1) {
gst_media_play_start_uri (play, argv[1]);
}
xmlSaveFile ("gstmediaplay.gst", gst_xml_write (gst_play_get_pipeline (play->play)));
gdk_threads_enter();
gst_main();
gdk_threads_leave();
return 0;
}

View file

@ -39,20 +39,6 @@ char * meets (double val, double limit)
return ((fabs(val) <= limit) ? "meets" : "FAILS");
}
#ifdef HAVE_RDTS
__inline__ void read_tsc(guint64 *dst) {
__asm__ __volatile__
("rdtsc"
: "=a" (*(guint32 *)dst), "=d" (*(((guint32 *)dst) + 1))
:
: "eax", "edx");
}
#else
__inline__ void read_tsc(guint64 *dst) {
}
#endif
int
main(int argc, char **argv)
{
@ -128,9 +114,9 @@ main(int argc, char **argv)
memcpy(testout, refcoefs, sizeof(DCTELEM)*DCTSIZE2);
}
read_tsc(&tscstart);
gst_trace_read_tsc(&tscstart);
gst_idct_convert(idct, testout);
read_tsc(&tscstop);
gst_trace_read_tsc(&tscstop);
//printf("time %llu, %llu %lld\n", tscstart, tscstop, tscstop-tscstart);
if (tscstop - tscstart < tscmin) tscmin = tscstop-tscstart;
if (tscstop - tscstart > tscmax) tscmax = tscstop-tscstart;

View file

@ -67,6 +67,8 @@ static GstBuffer * gst_disksrc_get_region (GstPad *pad,GstRegionType type,guint6
static GstElementStateReturn gst_disksrc_change_state (GstElement *element);
static gboolean gst_disksrc_open_file (GstDiskSrc *src);
static void gst_disksrc_close_file (GstDiskSrc *src);
static GstElementClass *parent_class = NULL;
//static guint gst_disksrc_signals[LAST_SIGNAL] = { 0 };
@ -151,8 +153,9 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
switch(id) {
case ARG_LOCATION:
/* the element must be stopped in order to do this */
g_return_if_fail (GST_STATE (src) < GST_STATE_PLAYING);
/* the element must be stopped or paused in order to do this */
g_return_if_fail ((GST_STATE (src) < GST_STATE_PLAYING)
|| (GST_STATE (src) == GST_STATE_PAUSED));
if (src->filename) g_free (src->filename);
/* clear the filename if we get a NULL (is that possible?) */
@ -163,6 +166,11 @@ gst_disksrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
} else {
src->filename = g_strdup (GTK_VALUE_STRING (*arg));
}
if ((GST_STATE (src) == GST_STATE_PAUSED) && (src->filename != NULL))
{
gst_disksrc_close_file(src);
gst_disksrc_open_file(src);
}
break;
case ARG_BYTESPERREAD:
src->bytes_per_read = GTK_VALUE_INT (*arg);

View file

@ -57,7 +57,7 @@ static struct _elements_entry _elements[] = {
{ "fdsrc", gst_fdsrc_get_type, &gst_fdsrc_details, NULL },
{ "multidisksrc", gst_multidisksrc_get_type, &gst_multidisksrc_details, NULL },
{ "pipefilter", gst_pipefilter_get_type, &gst_pipefilter_details, NULL },
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, NULL },
{ "sinesrc", gst_sinesrc_get_type, &gst_sinesrc_details, gst_sinesrc_factory_init },
{ "tee", gst_tee_get_type, &gst_tee_details, gst_tee_factory_init },
#if HAVE_LIBGHTTP

View file

@ -97,7 +97,8 @@ gst_fakesink_class_init (GstFakeSinkClass *klass)
gst_fakesink_signals[SIGNAL_HANDOFF] =
gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstFakeSinkClass, handoff),
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (gtkobject_class, gst_fakesink_signals,
LAST_SIGNAL);
@ -194,9 +195,8 @@ gst_fakesink_chain (GstPad *pad, GstBuffer *buf)
if (!fakesink->silent)
g_print("fakesink: ******* (%s:%s)< (%d bytes) \n",GST_DEBUG_PAD_NAME(pad),GST_BUFFER_SIZE(buf));
gst_buffer_unref (buf);
gtk_signal_emit (GTK_OBJECT (fakesink), gst_fakesink_signals[SIGNAL_HANDOFF],
fakesink);
buf);
gst_buffer_unref (buf);
}

View file

@ -50,6 +50,7 @@ enum {
ARG_PATTERN,
ARG_NUM_BUFFERS,
ARG_EOS,
ARG_SILENT
};
#define GST_TYPE_FAKESRC_OUTPUT (gst_fakesrc_output_get_type())
@ -127,6 +128,8 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
GTK_ARG_READWRITE, ARG_NUM_BUFFERS);
gtk_object_add_arg_type ("GstFakeSrc::eos", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_EOS);
gtk_object_add_arg_type ("GstFakeSrc::silent", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_SILENT);
gtkobject_class->set_arg = gst_fakesrc_set_arg;
gtkobject_class->get_arg = gst_fakesrc_get_arg;
@ -134,7 +137,8 @@ gst_fakesrc_class_init (GstFakeSrcClass *klass)
gst_fakesrc_signals[SIGNAL_HANDOFF] =
gtk_signal_new ("handoff", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstFakeSrcClass, handoff),
gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0);
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GTK_TYPE_POINTER);
gtk_object_class_add_signals (gtkobject_class, gst_fakesrc_signals,
LAST_SIGNAL);
@ -161,6 +165,7 @@ gst_fakesrc_init (GstFakeSrc *fakesrc)
gst_pad_set_get_function(pad,gst_fakesrc_get);
fakesrc->num_buffers = -1;
fakesrc->silent = FALSE;
// we're ready right away, since we don't have any args...
// gst_element_set_state(GST_ELEMENT(fakesrc),GST_STATE_READY);
}
@ -224,6 +229,9 @@ gst_fakesrc_set_arg (GtkObject *object, GtkArg *arg, guint id)
src->eos = GTK_VALUE_BOOL (*arg);
GST_INFO (0, "will EOS on next buffer");
break;
case ARG_SILENT:
src->silent = GTK_VALUE_BOOL (*arg);
break;
default:
break;
}
@ -257,6 +265,9 @@ gst_fakesrc_get_arg (GtkObject *object, GtkArg *arg, guint id)
break;
case ARG_EOS:
GTK_VALUE_BOOL (*arg) = src->eos;
case ARG_SILENT:
GTK_VALUE_BOOL (*arg) = src->silent;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@ -299,11 +310,12 @@ gst_fakesrc_get(GstPad *pad)
return NULL;
}
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
if (!src->silent)
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
buf = gst_buffer_new();
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
src);
buf);
return buf;
}
@ -349,10 +361,11 @@ gst_fakesrc_loop(GstElement *element)
}
buf = gst_buffer_new();
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
if (!src->silent)
g_print("fakesrc: ******* (%s:%s)> \n",GST_DEBUG_PAD_NAME(pad));
gtk_signal_emit (GTK_OBJECT (src), gst_fakesrc_signals[SIGNAL_HANDOFF],
src);
buf);
gst_pad_push (pad, buf);
pads = g_slist_next (pads);

View file

@ -72,6 +72,7 @@ struct _GstFakeSrc {
gchar *pattern;
GList *patternlist;
gint num_buffers;
gboolean silent;
};
struct _GstFakeSrcClass {

View file

@ -38,7 +38,8 @@ GstElementDetails gst_pipefilter_details = {
"Filter",
"Pass data without modification",
VERSION,
"Erik Walthinsen <omega@cse.ogi.edu>",
"Erik Walthinsen <omega@cse.ogi.edu>\n"
"Wim Taymans <wim.taymans@chello.be>",
"(C) 1999",
};
@ -55,20 +56,24 @@ enum {
};
static void gst_pipefilter_class_init(GstPipefilterClass *klass);
static void gst_pipefilter_init(GstPipefilter *pipefilter);
static void gst_pipefilter_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_pipefilter_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_pipefilter_class_init (GstPipefilterClass *klass);
static void gst_pipefilter_init (GstPipefilter *pipefilter);
void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf);
static void gst_pipefilter_set_arg (GtkObject *object, GtkArg *arg, guint id);
static void gst_pipefilter_get_arg (GtkObject *object, GtkArg *arg, guint id);
static GstElementStateReturn gst_pipefilter_change_state(GstElement *element);
static GstBuffer* gst_pipefilter_get (GstPad *pad);
static void gst_pipefilter_chain (GstPad *pad, GstBuffer *buf);
static gboolean gst_pipefilter_handle_eos (GstPad *pad);
static GstElementStateReturn gst_pipefilter_change_state (GstElement *element);
static GstElementClass *parent_class = NULL;
//static guint gst_pipefilter_signals[LAST_SIGNAL] = { 0 };
GtkType
gst_pipefilter_get_type(void) {
gst_pipefilter_get_type (void)
{
static GtkType pipefilter_type = 0;
if (!pipefilter_type) {
@ -87,7 +92,9 @@ gst_pipefilter_get_type(void) {
return pipefilter_type;
}
static void gst_pipefilter_class_init(GstPipefilterClass *klass) {
static void
gst_pipefilter_class_init (GstPipefilterClass *klass)
{
GtkObjectClass *gtkobject_class;
GstElementClass *gstelement_class;
@ -105,12 +112,19 @@ static void gst_pipefilter_class_init(GstPipefilterClass *klass) {
gtkobject_class->get_arg = gst_pipefilter_get_arg;
}
static void gst_pipefilter_init(GstPipefilter *pipefilter) {
pipefilter->sinkpad = gst_pad_new("sink",GST_PAD_SINK);
gst_element_add_pad(GST_ELEMENT(pipefilter),pipefilter->sinkpad);
gst_pad_set_chain_function(pipefilter->sinkpad,gst_pipefilter_chain);
pipefilter->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_element_add_pad(GST_ELEMENT(pipefilter),pipefilter->srcpad);
static void
gst_pipefilter_init (GstPipefilter *pipefilter)
{
GST_FLAG_SET (pipefilter, GST_ELEMENT_DECOUPLED);
pipefilter->sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->sinkpad);
gst_pad_set_chain_function (pipefilter->sinkpad, gst_pipefilter_chain);
gst_pad_set_eos_function (pipefilter->sinkpad, gst_pipefilter_handle_eos);
pipefilter->srcpad = gst_pad_new ("src", GST_PAD_SRC);
gst_element_add_pad (GST_ELEMENT (pipefilter), pipefilter->srcpad);
gst_pad_set_get_function (pipefilter->srcpad, gst_pipefilter_get);
pipefilter->command = NULL;
pipefilter->curoffset = 0;
@ -118,51 +132,67 @@ static void gst_pipefilter_init(GstPipefilter *pipefilter) {
pipefilter->seq = 0;
}
static gboolean gst_pipefilter_read_and_push(GstPipefilter *pipefilter) {
static gboolean
gst_pipefilter_handle_eos (GstPad *pad)
{
GstPipefilter *pipefilter;
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
GST_DEBUG (0,"pipefilter: %s received eos\n", GST_ELEMENT_NAME (pipefilter));
if (close (pipefilter->fdin[1]) < 0)
perror("close");
if (close (pipefilter->fdout[0]) < 0)
perror("close");
GST_FLAG_SET (pad, GST_PAD_EOS);
return TRUE;
}
static GstBuffer*
gst_pipefilter_get (GstPad *pad)
{
GstPipefilter *pipefilter;
GstBuffer *newbuf;
glong readbytes;
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
/* create the buffer */
// FIXME: should eventually use a bufferpool for this
newbuf = gst_buffer_new();
g_return_val_if_fail(newbuf, FALSE);
g_return_val_if_fail(newbuf, NULL);
/* allocate the space for the buffer data */
GST_BUFFER_DATA(newbuf) = g_malloc(pipefilter->bytes_per_read);
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, FALSE);
g_return_val_if_fail(GST_BUFFER_DATA(newbuf) != NULL, NULL);
/* read it in from the file */
GST_DEBUG (0,"attemting to read %ld bytes\n", pipefilter->bytes_per_read);
readbytes = read(pipefilter->fdout[0],GST_BUFFER_DATA(newbuf),pipefilter->bytes_per_read);
readbytes = read(pipefilter->fdout[0], GST_BUFFER_DATA(newbuf), pipefilter->bytes_per_read);
GST_DEBUG (0,"read %ld bytes\n", readbytes);
if (readbytes < 0) {
if (errno == EAGAIN) {
GST_DEBUG (0,"no input yet\n");
gst_buffer_unref(newbuf);
return FALSE;
}
else {
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
return FALSE;
}
}
if (readbytes == 0) {
gst_buffer_unref(newbuf);
return FALSE;
perror("read");
gst_element_error(GST_ELEMENT(pipefilter),"reading");
return NULL;
}
/* if we didn't get as many bytes as we asked for, we're at EOF */
if (readbytes < pipefilter->bytes_per_read)
GST_BUFFER_FLAG_SET(newbuf,GST_BUFFER_EOS);
if (readbytes == 0) {
gst_pad_set_eos (pad);
return NULL;
}
GST_BUFFER_OFFSET(newbuf) = pipefilter->curoffset;
GST_BUFFER_SIZE(newbuf) = readbytes;
pipefilter->curoffset += readbytes;
/* we're done, push the buffer off now */
gst_pad_push(pipefilter->srcpad,newbuf);
return TRUE;
return newbuf;
}
void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
static void
gst_pipefilter_chain (GstPad *pad,GstBuffer *buf)
{
GstPipefilter *pipefilter;
glong writebytes;
guchar *data;
@ -174,8 +204,6 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
pipefilter = GST_PIPEFILTER (gst_pad_get_parent (pad));
while (gst_pipefilter_read_and_push(pipefilter));
data = GST_BUFFER_DATA(buf);
size = GST_BUFFER_SIZE(buf);
@ -188,11 +216,11 @@ void gst_pipefilter_chain(GstPad *pad,GstBuffer *buf) {
return;
}
gst_buffer_unref(buf);
while (gst_pipefilter_read_and_push(pipefilter));
}
static void gst_pipefilter_set_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_pipefilter_set_arg (GtkObject *object,GtkArg *arg,guint id)
{
GstPipefilter *pipefilter;
/* it's not null if we got it, but it might not be ours */
@ -209,7 +237,9 @@ static void gst_pipefilter_set_arg(GtkObject *object,GtkArg *arg,guint id) {
}
}
static void gst_pipefilter_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_pipefilter_get_arg (GtkObject *object,GtkArg *arg,guint id)
{
GstPipefilter *pipefilter;
/* it's not null if we got it, but it might not be ours */
@ -227,18 +257,14 @@ static void gst_pipefilter_get_arg(GtkObject *object,GtkArg *arg,guint id) {
}
/* open the file, necessary to go to RUNNING state */
static gboolean gst_pipefilter_open_file(GstPipefilter *src) {
static gboolean
gst_pipefilter_open_file (GstPipefilter *src)
{
g_return_val_if_fail(!GST_FLAG_IS_SET(src,GST_PIPEFILTER_OPEN), FALSE);
pipe(src->fdin);
pipe(src->fdout);
if (fcntl(src->fdout[0], F_SETFL, O_NONBLOCK) < 0) {
perror("fcntl");
gst_element_error(GST_ELEMENT(src),"fcntl");
return FALSE;
}
if((src->childpid = fork()) == -1)
{
perror("fork");
@ -248,6 +274,8 @@ static gboolean gst_pipefilter_open_file(GstPipefilter *src) {
if(src->childpid == 0)
{
close(src->fdin[1]);
close(src->fdout[0]);
// child
dup2(src->fdin[0], STDIN_FILENO); /* set the childs input stream */
dup2(src->fdout[1], STDOUT_FILENO); /* set the childs output stream */
@ -258,13 +286,19 @@ static gboolean gst_pipefilter_open_file(GstPipefilter *src) {
return FALSE;
}
else {
close(src->fdin[0]);
close(src->fdout[1]);
}
GST_FLAG_SET(src,GST_PIPEFILTER_OPEN);
return TRUE;
}
/* close the file */
static void gst_pipefilter_close_file(GstPipefilter *src) {
static void
gst_pipefilter_close_file (GstPipefilter *src)
{
g_return_if_fail(GST_FLAG_IS_SET(src,GST_PIPEFILTER_OPEN));
/* close the file */
@ -280,7 +314,9 @@ static void gst_pipefilter_close_file(GstPipefilter *src) {
GST_FLAG_UNSET(src,GST_PIPEFILTER_OPEN);
}
static GstElementStateReturn gst_pipefilter_change_state(GstElement *element) {
static GstElementStateReturn
gst_pipefilter_change_state (GstElement *element)
{
g_return_val_if_fail(GST_IS_PIPEFILTER(element), FALSE);
/* if going down into NULL state, close the file if it's open */

View file

@ -54,9 +54,35 @@ enum {
ARG_BUFFER_SIZE,
};
static GstPadTemplate*
sinesrc_src_factory (void)
{
return
gst_padtemplate_new (
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
gst_caps_new (
"sinesrc_src",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT_RANGE (8000, 48000),
"channels", GST_PROPS_INT (1),
NULL)),
NULL);
}
static GstPadTemplate *src_temp;
static void gst_sinesrc_class_init(GstSineSrcClass *klass);
static void gst_sinesrc_init(GstSineSrc *src);
static GstPadNegotiateReturn gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data);
static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
//static gboolean gst_sinesrc_change_state(GstElement *element,
@ -66,7 +92,7 @@ static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id);
static void gst_sinesrc_populate_sinetable(GstSineSrc *src);
static inline void gst_sinesrc_update_table_inc(GstSineSrc *src);
static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src);
void gst_sinesrc_sync_parms(GstSineSrc *src);
void gst_sinesrc_force_caps(GstSineSrc *src);
static GstBuffer * gst_sinesrc_get(GstPad *pad);
@ -122,31 +148,50 @@ gst_sinesrc_class_init(GstSineSrcClass *klass) {
// gstelement_class->change_state = gst_sinesrc_change_state;
}
static void gst_sinesrc_init(GstSineSrc *src) {
src->srcpad = gst_pad_new("src",GST_PAD_SRC);
gst_pad_set_get_function(src->srcpad, gst_sinesrc_get);
static void
gst_sinesrc_init(GstSineSrc *src) {
src->srcpad = gst_pad_new_from_template (src_temp, "src");
gst_element_add_pad(GST_ELEMENT(src), src->srcpad);
gst_pad_set_negotiate_function (src->srcpad, gst_sinesrc_negotiate);
gst_pad_set_get_function(src->srcpad, gst_sinesrc_get);
src->volume = 1.0;
gst_sinesrc_update_vol_scale(src);
src->format = 16;
src->samplerate = 44100;
src->freq = 100.0;
src->newcaps = FALSE;
src->freq = 440.0;
src->newcaps = TRUE;
src->table_pos = 0.0;
src->table_size = 1024;
gst_sinesrc_populate_sinetable(src);
gst_sinesrc_update_table_inc(src);
gst_sinesrc_sync_parms(src);
src->buffer_size=1024;
src->seq = 0;
}
static GstPadNegotiateReturn
gst_sinesrc_negotiate (GstPad *pad, GstCaps **caps, gpointer *data)
{
GstSineSrc *src;
if (*caps) {
g_return_val_if_fail (pad != NULL, GST_PAD_NEGOTIATE_FAIL);
src = GST_SINESRC(gst_pad_get_parent (pad));
src->samplerate = gst_caps_get_int (*caps, "rate");
gst_sinesrc_update_table_inc(src);
return GST_PAD_NEGOTIATE_AGREE;
}
return GST_PAD_NEGOTIATE_FAIL;
}
static GstBuffer *
gst_sinesrc_get(GstPad *pad)
{
@ -194,14 +239,14 @@ gst_sinesrc_get(GstPad *pad)
}
if (src->newcaps) {
src->newcaps = FALSE;
gst_sinesrc_force_caps(src);
}
//g_print(">");
return buf;
}
static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
GstSineSrc *src;
/* it's not null if we got it, but it might not be ours */
@ -217,11 +262,11 @@ static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
break;
case ARG_FORMAT:
src->format = GTK_VALUE_INT(*arg);
gst_sinesrc_sync_parms(src);
src->newcaps=TRUE;
break;
case ARG_SAMPLERATE:
src->samplerate = GTK_VALUE_INT(*arg);
gst_sinesrc_sync_parms(src);
src->newcaps=TRUE;
gst_sinesrc_update_table_inc(src);
break;
case ARG_FREQ: {
@ -244,7 +289,8 @@ static void gst_sinesrc_set_arg(GtkObject *object,GtkArg *arg,guint id) {
}
}
static void gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
static void
gst_sinesrc_get_arg(GtkObject *object,GtkArg *arg,guint id) {
GstSineSrc *src;
/* it's not null if we got it, but it might not be ours */
@ -299,7 +345,8 @@ static gboolean gst_sinesrc_change_state(GstElement *element,
}
*/
static void gst_sinesrc_populate_sinetable(GstSineSrc *src)
static void
gst_sinesrc_populate_sinetable(GstSineSrc *src)
{
gint i;
gdouble pi2scaled = M_PI * 2 / src->table_size;
@ -313,16 +360,51 @@ static void gst_sinesrc_populate_sinetable(GstSineSrc *src)
src->table_data = table;
}
static inline void gst_sinesrc_update_table_inc(GstSineSrc *src)
static inline void
gst_sinesrc_update_table_inc(GstSineSrc *src)
{
src->table_inc = src->table_size * src->freq / src->samplerate;
}
static inline void gst_sinesrc_update_vol_scale(GstSineSrc *src)
static inline void
gst_sinesrc_update_vol_scale(GstSineSrc *src)
{
src->vol_scale = 32767 * src->volume;
}
void gst_sinesrc_sync_parms(GstSineSrc *src) {
src->newcaps = TRUE;
void
gst_sinesrc_force_caps(GstSineSrc *src) {
GstCaps *caps;
if (!src->newcaps)
return;
src->newcaps=FALSE;
caps = gst_caps_new (
"sinesrc_src_caps",
"audio/raw",
gst_props_new (
"format", GST_PROPS_STRING ("int"),
"law", GST_PROPS_INT (0),
"endianness", GST_PROPS_INT (G_BYTE_ORDER),
"signed", GST_PROPS_BOOLEAN (TRUE),
"width", GST_PROPS_INT (16),
"depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (src->samplerate),
"channels", GST_PROPS_INT (1),
NULL
)
);
gst_pad_set_caps (src->srcpad, caps);
}
gboolean
gst_sinesrc_factory_init (GstElementFactory *factory)
{
src_temp = sinesrc_src_factory();
gst_elementfactory_add_padtemplate (factory, src_temp);
return TRUE;
}

View file

@ -86,6 +86,7 @@ struct _GstSineSrcClass {
};
GtkType gst_sinesrc_get_type(void);
gboolean gst_sinesrc_factory_init (GstElementFactory *factory);
#ifdef __cplusplus
}

2
test/.gitignore vendored
View file

@ -53,4 +53,4 @@ dvshow
video2mp1
mp3mad
videotest2
lat

View file

@ -1,8 +1,9 @@
# FIXME FIXME
if HAVE_GNOME
GNOME_PROGS = spectrum wave mpeg2parse mp1parse videotest aviparse \
mpeg2parse2 videotest2 video2mp1 dvshow dv2mp1 mpeg2parse3 mpeg2parse4
GNOME_PROGS = spectrum wave mp1parse videotest aviparse \
videotest2 video2mp1 dvshow dv2mp1 \
mpeg2parse mpeg2parse2 mpeg2parse3
else
GNOME_PROGS =
endif
@ -11,7 +12,7 @@ noinst_PROGRAMS = qtest $(GNOME_PROGS) record mp3 teardown buffer mp3parse \
mp3play ac3parse ac3play dvdcat fake cobin \
vidcapture avi2mpg mp2tomp1 mp1tomp1 pipetest \
vidcapture2 mp2toavi mp3tovorbis xmmstest \
mp3mad
mp3mad lat
SUBDIRS = xml bindings

204
test/lat.c Normal file
View file

@ -0,0 +1,204 @@
#include <gst/gst.h>
#include <stdlib.h>
static guint64 max = 0, min = -1, total = 0;
static guint count = 0;
static guint print_del = 1;
static guint iterations = 0;
static guint mhz = 0;
void handoff_src(GstElement *src, GstBuffer *buf, gpointer user_data) {
gst_trace_read_tsc(&GST_BUFFER_TIMESTAMP(buf));
}
void handoff_sink(GstElement *sink, GstBuffer *buf, gpointer user_data) {
guint64 end, d, avg;
guint avg_ns;
gst_trace_read_tsc(&end);
d = end - GST_BUFFER_TIMESTAMP(buf);
if (d > max) max = d;
if (d < min) min = d;
total += d;
count++;
avg = total/count;
avg_ns = (guint)(1000.0*(double)avg/(double)mhz);
if ((count % print_del) == 0) {
g_print("%07d:%08lld min:%08lld max:%08lld avg:%08lld avg-s:0.%09d\r",
count, d, min, max, avg, avg_ns);
}
}
GstElement *identity_add(GstPipeline *pipeline, GstElement *first, int count) {
GstElement *last, *ident;
int i;
last = first;
for (i=0; i<count; i++) {
ident = gst_elementfactory_make("identity","identity");
g_return_val_if_fail(ident != NULL,NULL);
gtk_object_set(GTK_OBJECT(ident),"silent",TRUE,NULL);
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(ident));
gst_pad_connect(gst_element_get_pad(last,"src"),
gst_element_get_pad(ident,"sink"));
last = ident;
}
return last;
}
GstElement *fakesrc() {
GstElement *src;
src = gst_elementfactory_make("fakesrc","src");
g_return_val_if_fail(src != NULL,NULL);
gtk_object_set(GTK_OBJECT(src),"silent",TRUE,NULL);
gtk_object_set(GTK_OBJECT(src),"num_buffers",iterations,NULL);
gtk_signal_connect(GTK_OBJECT(src),
"handoff",GTK_SIGNAL_FUNC(handoff_src),NULL);
return src;
}
GstElement *fakesink() {
GstElement *sink;
sink = gst_elementfactory_make("fakesink","fakesink");
g_return_val_if_fail(sink != NULL,NULL);
gtk_object_set(GTK_OBJECT(sink),"silent",TRUE,NULL);
gtk_signal_connect(GTK_OBJECT(sink),
"handoff",GTK_SIGNAL_FUNC(handoff_sink),NULL);
return sink;
}
GstPipeline *simple(int argc, int argi, char *argv[]) {
GstPipeline *pipeline;
GstElement *last, *src, *sink;
int idents;
if ((argc - argi) < 1) {
fprintf(stderr, "bad params");
return NULL;
}
idents = atoi(argv[argi]);
pipeline = GST_PIPELINE(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL,NULL);
src = fakesrc();
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
last = identity_add(pipeline, src, idents);
sink = fakesink();
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(sink));
gst_pad_connect(gst_element_get_pad(last,"src"),
gst_element_get_pad(sink,"sink"));
return pipeline;
}
GstPipeline *queue(int argc, int argi, char *argv[]) {
GstPipeline *pipeline;
GstElement *last, *src, *sink, *src_thr, *src_q, *sink_q, *sink_thr;
int idents;
if ((argc - argi) < 1) {
fprintf(stderr, "bad params");
return NULL;
}
idents = atoi(argv[argi]);
pipeline = GST_PIPELINE(gst_pipeline_new("pipeline"));
g_return_val_if_fail(pipeline != NULL,NULL);
src_thr = GST_ELEMENT(gst_thread_new("src_thread"));
g_return_val_if_fail(src_thr != NULL,NULL);
src = fakesrc();
g_return_val_if_fail(src != NULL,NULL);
gst_bin_add(GST_BIN(src_thr),GST_ELEMENT(src));
src_q = gst_elementfactory_make("queue","src_q");
g_return_val_if_fail(src_q != NULL,NULL);
gst_bin_add(GST_BIN(src_thr),GST_ELEMENT(src_q));
gst_pad_connect(gst_element_get_pad(src,"src"),
gst_element_get_pad(src_q,"sink"));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src_thr));
last = identity_add(pipeline, src_q, idents);
sink_q = gst_elementfactory_make("queue","sink_q");
g_return_val_if_fail(sink_q != NULL,NULL);
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(sink_q));
gst_pad_connect(gst_element_get_pad(last,"src"),
gst_element_get_pad(sink_q,"sink"));
sink_thr = GST_ELEMENT(gst_thread_new("sink_thread"));
g_return_val_if_fail(sink_thr != NULL,NULL);
sink = fakesink();
g_return_val_if_fail(sink != NULL,NULL);
gst_bin_add(GST_BIN(sink_thr),GST_ELEMENT(sink));
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(sink_thr));
gst_pad_connect(gst_element_get_pad(sink_q,"src"),
gst_element_get_pad(sink,"sink"));
return pipeline;
}
struct test {
char *name;
char *params;
GstPipeline *(*func)(int argc, int argi, char *argv[]);
};
static struct test tests[] = {
{"simple", "ident_count", simple},
{"queue", "ident_count", queue},
{NULL, NULL, NULL}
};
int main(int argc,char *argv[]) {
GstPipeline *pipeline;
int i;
char *name;
gst_init(&argc,&argv);
if (argc < 3) {
fprintf(stderr, "usage: %s iterations print_del mhz test_name [test_params...]\n",
argv[0]);
for (i=0; tests[i].name; i++) {
fprintf(stderr, " %s %s\n", tests[i].name, tests[i].params);
}
exit(1);
} else {
iterations = atoi(argv[1]);
print_del = atoi(argv[2]);
mhz = atoi(argv[3]);
name = argv[4];
}
pipeline = NULL;
for (i=0; tests[i].name && !pipeline; i++) {
if (!strcmp(name, tests[i].name)) {
pipeline = tests[i].func(argc,5,argv);
}
}
g_return_val_if_fail(pipeline != NULL, -1);
//xmlSaveFile("lat.gst", gst_xml_write(GST_ELEMENT(pipeline)));
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
while (count < iterations) {
gst_bin_iterate(GST_BIN(pipeline));
}
g_print("\n");
return 0;
}

View file

@ -2,7 +2,7 @@
int main(int argc,char *argv[]) {
GstElementFactory *srcfactory, *parsefactory, *decodefactory, *playfactory;
GstElementFactory *srcfactory, *decodefactory, *playfactory;
GstElement *pipeline, *src, *decode, *play;
GstPad *infopad;

Some files were not shown because too many files have changed in this diff Show more