Commit 1762dfbf authored by Erik Walthinsen's avatar Erik Walthinsen

initial checkin

Original commit message from CVS:
initial checkin
parents
Erik Walthinsen <omega@cse.ogi.edu>
This diff is collapsed.
This diff is collapsed.
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
SUBDIRS = gst plugins test editor tools docs
This is gnome-streamer, a framework for streaming media in GNOME. The
fundamental design comes from the video pipeline at Oregon Graduate
Institute, as well as some ideas from DirectX. It's based on plug-ins
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.
#undef PLUGINS_DIR
#undef PLUGINS_SRCDIR
#undef PLUGINS_USE_SRCDIR
#undef HAVE_LIBGHTTP
#undef HAVE_LIBXML
#undef HAVE_LIBMMX
#undef HAVE_ATOMIC_H
#undef DEBUG_ENABLED
#!/bin/sh
# Run this to generate all the initial makefiles, etc.
DIE=0
package=gstreamer
srcfile=gst/gstobject.h
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile $package."
echo "Download the appropriate package for your distribution,"
echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/"
DIE=1
}
(libtool --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have libtool installed to compile $package."
echo "Get ftp://alpha.gnu.org/gnu/libtool-1.2.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have automake installed to compile $package."
echo "Get ftp://ftp.cygnus.com/pub/home/tromey/automake-1.2d.tar.gz"
echo "(or a newer version if it is available)"
DIE=1
}
if test "$DIE" -eq 1; then
exit 1
fi
test -f $srcfile || {
echo "You must run this script in the top-level $package directory"
exit 1
}
if test -z "$*"; then
echo "I am going to run ./configure with no arguments - if you wish "
echo "to pass any to it, please specify them on the $0 command line."
fi
libtoolize --copy --force
aclocal $ACLOCAL_FLAGS
automake --add-missing
autoconf
autoheader
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
./configure --enable-maintainer-mode "$@"
echo
echo "Now type 'make' to compile $package."
/* config.h.in. Generated automatically from configure.in by autoheader. */
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
#undef PLUGINS_DIR
#undef PLUGINS_SRCDIR
#undef PLUGINS_USE_SRCDIR
#undef HAVE_LIBGHTTP
#undef HAVE_LIBXML
#undef HAVE_LIBMMX
#undef HAVE_ATOMIC_H
#undef DEBUG_ENABLED
/* Define if you have the <asm/atomic.h> header file. */
#undef HAVE_ASM_ATOMIC_H
/* Name of package */
#undef PACKAGE
/* Version number of package */
#undef VERSION
AC_INIT(gst/gstobject.h)
AM_CONFIG_HEADER(config.h)
STREAMER_MAJOR_VERSION=0
STREAMER_MINOR_VERSION=0
STREAMER_MICRO_VERSION=9.2
STREAMER_VERSION=$STREAMER_MAJOR_VERSION.$STREAMER_MINOR_VERSION.$STREAMER_MICRO_VERSION
dnl libtool
STREAMER_CURRENT=0
STREAMER_REVISION=0
STREAMER_AGE=0
AM_INIT_AUTOMAKE(gstreamer, $STREAMER_VERSION)
AC_SUBST(STREAMER_MAJOR_VERSION)
AC_SUBST(STREAMER_MINOR_VERSION)
AC_SUBST(STREAMER_MICRO_VERSION)
AC_SUBST(STREAMER_VERSION)
AC_SUBST(STREAMER_CURRENT)
AC_SUBST(STREAMER_REVISION)
AC_SUBST(STREAMER_AGE)
AM_MAINTAINER_MODE
AC_ISC_POSIX
AC_PROG_CC
AC_STDC_HEADERS
AC_ARG_PROGRAM
AM_DISABLE_STATIC
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL
AM_PATH_GLIB(1.2.0,
[LIBS="$LIBS $GLIB_LIBS" CFLAGS="$CFLAGS $GLIB_CFLAGS"],
AC_MSG_ERROR(Cannot find glib: Is glib-config in path?),
glib gmodule gthread)
AM_PATH_GTK(1.2.0)
dnl Check for libghttp
AC_CHECK_LIB(ghttp,ghttp_request_new,
[LIBS="$LIBS -lghttp" HAVE_LIBGHTTP="yes"],
AC_MSG_WARN(Cannot find libghttp: can't build gsthttpsrc),
$LIBS)
AC_DEFINE(HAVE_LIBGHTTP)
AM_CONDITIONAL(HAVE_LIBGHTTP, test "x$HAVE_LIBGHTTP" = "xyes")
AC_CHECK_HEADERS(asm/atomic.h, AC_DEFINE(HAVE_ATOMIC_H))
AC_PATH_PROG(XML_CONFIG,xml-config,no)
if test x$XML_CONFIG = xno;then
AC_MSG_ERROR(Couldn't find xml-config)
fi
XML_LIBS=`xml-config --libs`
XML_CFLAGS=`xml-config --cflags`
AC_SUBST(XML_LIBS)
AC_SUBST(XML_CFLAGS)
AC_DEFINE(HAVE_LIBXML)
AM_CONDITIONAL(HAVE_LIBXML, test "x$HAVE_LIBXML" = "xyes")
AC_CHECK_HEADER(mmx.h,[HAVE_LIBMMX=yes],)
AC_DEFINE(HAVE_LIBMMX)
AM_CONDITIONAL(HAVE_LIBMMX, test "x$HAVE_LIBMMX" = "xyes")
PLUGINS_DIR=${libdir}/plugins
AC_DEFINE_UNQUOTED(PLUGINS_DIR,"$PLUGINS_DIR")
AC_SUBST(PLUGINS_DIR)
PLUGINS_SRCDIR=`pwd`/$srcdir
AC_DEFINE_UNQUOTED(PLUGINS_SRCDIR,"$PLUGINS_SRCDIR")
AC_SUBST(PLUGINS_SRCDIR)
AC_ARG_ENABLE(plugin-srcdir,
[ --enable-plugin-srcdir allow tests/demos to use non-installed plugins ],
[AC_DEFINE(PLUGINS_USE_SRCDIR)])
AC_DEFINE(PLUGINS_USE_SRCDIR)
AC_ARG_ENABLE(debug,
[ --enable-debug spews lots of useless info at runtime],
[AC_DEFINE(DEBUG_ENABLED)])
AC_ARG_ENABLE(profiling,
[ --enable-profiling adds -pg to compiler commandline, for profiling],
[CFLAGS="$CFLAGS -pg"])
AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
AC_CHECK_PROG(GTKDOC, gtkdoc-mkdb, true, false)
AM_CONDITIONAL(HAVE_GTK_DOC, $GTKDOC)
AC_CONFIG_SUBDIRS(gist)
AC_CONFIG_SUBDIRS(plugins/mp3decode/xing/libxing)
AC_OUTPUT([Makefile
gst/Makefile
gst/types/Makefile
gst/meta/Makefile
gst/elements/Makefile
gst/xml/Makefile
plugins/Makefile
plugins/au/Makefile
plugins/wav/Makefile
plugins/mp3decode/Makefile
plugins/mp3decode/xa/Makefile
plugins/mp3decode/xing/Makefile
plugins/mp3decode/mpg123/Makefile
plugins/mp3decode/parse/Makefile
plugins/mpeg2/Makefile
plugins/mpeg2/parse/Makefile
plugins/mpeg2/ac3parse/Makefile
plugins/mpeg2/ac3dec/Makefile
plugins/mpeg1/Makefile
plugins/mpeg1/parse/Makefile
plugins/effects/Makefile
plugins/effects/stereo/Makefile
plugins/effects/volume/Makefile
plugins/visualization/Makefile
plugins/visualization/spectrum/Makefile
plugins/visualization/vumeter/Makefile
plugins/visualization/synaesthesia/Makefile
plugins/visualization/smoothwave/Makefile
plugins/dvdsrc/Makefile
plugins/vcdsrc/Makefile
plugins/cobin/Makefile
test/Makefile
test/xml/Makefile
test/bindings/Makefile
test/cothreads/Makefile
editor/Makefile
tools/Makefile
docs/Makefile
stamp.h])
# cheap trick to build . first...
SUBDIRS = . types meta elements xml
lib_LTLIBRARIES = libgst.la
GSTOBJECT_SRCS = \
gstobject.c
GSTOBJECT_INCLUDES = \
gstobject.h
libgst_la_SOURCES = \
gst.c \
$(GSTOBJECT_SRCS) \
gstpad.c \
gstbuffer.c \
gstelement.c \
gstelementfactory.c \
gstbin.c \
gstpipeline.c \
gstthread.c \
gstsrc.c \
gstfilter.c \
gstsink.c \
gstconnection.c \
gsttype.c \
gstplugin.c \
gstutils.c \
gsttrace.c \
gstmeta.c \
gsttee.c \
gstxml.c \
cothreads.c
libgstincludedir = $(includedir)/gst
libgstinclude_HEADERS = \
gst.h \
gstlog.h \
$(GSTOBJECT_INCLUDES) \
gstpad.h \
gstbuffer.h \
gstelement.h \
gstbin.h \
gstpipeline.h \
gstthread.h \
gstsrc.h \
gstfilter.h \
gstsink.h \
gstconnection.h \
gsttype.h \
gstplugin.h \
gstutils.h \
gsttrace.h \
gstmeta.h \
gsttee.h \
gstxml.h \
cothreads.h
libgst_la_LIBADD = $(GLIB_LIBS) $(GTK_LIBS) $(XML_LIBS)
libgst_la_LDFLAGS = -version-info $(STREAMER_CURRENT):$(STREAMER_REVISION):$(STREAMER_AGE)
EXTRA_DIST = ROADMAP
#include <sys/time.h>
#include <linux/linkage.h>
#include <stdio.h>
#include <stdlib.h>
#include <signal.h>
#include <setjmp.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/mman.h>
#include "cothreads.h"
pthread_key_t _cothread_key = -1;
cothread_state *cothread_create(cothread_context *ctx) {
cothread_state *s;
if (pthread_self() == 0) {
s = (cothread_state *)malloc(sizeof(int) * COTHREAD_STACKSIZE);
} else {
char *sp = CURRENT_STACK_FRAME;
unsigned long *stack_end = (unsigned long *)((unsigned long)sp &
~(STACK_SIZE - 1));
s = (cothread_state *)(stack_end + ((ctx->nthreads - 1) *
COTHREAD_STACKSIZE));
if (mmap((char *)s,COTHREAD_STACKSIZE*(sizeof(int)),
PROT_READ|PROT_WRITE|PROT_EXEC,MAP_PRIVATE|MAP_ANONYMOUS,
-1,0) < 0) {
perror("mmap'ing cothread stack space");
return NULL;
}
}
s->ctx = ctx;
s->threadnum = ctx->nthreads;
s->flags = 0;
s->sp = (int *)(s + COTHREAD_STACKSIZE);
ctx->threads[ctx->nthreads++] = s;
// printf("created cothread at %p\n",s);
return s;
}
void cothread_setfunc(cothread_state *thread,cothread_func func,int argc,char **argv) {
thread->func = func;
thread->argc = argc;
thread->argv = argv;
thread->pc = (int *)func;
}
cothread_context *cothread_init() {
cothread_context *ctx = (cothread_context *)malloc(sizeof(cothread_context));
if (_cothread_key == -1) {
if (pthread_key_create(&_cothread_key,NULL) != 0) {
perror("pthread_key_create");
return;
}
}
pthread_setspecific(_cothread_key,ctx);
memset(ctx->threads,0,sizeof(ctx->threads));
ctx->threads[0] = (cothread_state *)malloc(sizeof(cothread_state));
ctx->threads[0]->ctx = ctx;
ctx->threads[0]->threadnum = 0;
ctx->threads[0]->func = NULL;
ctx->threads[0]->argc = 0;
ctx->threads[0]->argv = NULL;
ctx->threads[0]->flags = COTHREAD_STARTED;
ctx->threads[0]->sp = CURRENT_STACK_FRAME;
ctx->threads[0]->pc = 0;
// fprintf(stderr,"0th thread is at %p\n",ctx->threads[0]);
// we consider the initiating process to be cothread 0
ctx->nthreads = 1;
ctx->current = 0;
return ctx;
}
cothread_state *cothread_main(cothread_context *ctx) {
// fprintf(stderr,"returning %p, the 0th cothread\n",ctx->threads[0]);
return ctx->threads[0];
}
void cothread_stub() {
cothread_context *ctx = pthread_getspecific(_cothread_key);
register cothread_state *thread = ctx->threads[ctx->current];
thread->flags |= COTHREAD_STARTED;
thread->func(thread->argc,thread->argv);
thread->flags &= ~COTHREAD_STARTED;
thread->pc = 0;
// printf("uh, yeah, we shouldn't be here, but we should deal anyway\n");
}
void cothread_switch(cothread_state *thread) {
cothread_context *ctx;
cothread_state *current;
int enter = 0;
// int i;
if (thread == NULL)
return;
ctx = thread->ctx;
current = ctx->threads[ctx->current];
if (current == NULL) {
fprintf(stderr,"there's no current thread, help!\n");
exit(2);
}
if (current == thread) {
fprintf(stderr,"trying to switch to same thread, legal but not necessary\n");
return;
}
// find the number of the thread to switch to
ctx->current = thread->threadnum;
// fprintf(stderr,"about to switch to thread #%d\n",ctx->current);
/* save the current stack pointer, frame pointer, and pc */
__asm__("movl %%esp, %0" : "=m"(current->sp) : : "esp", "ebp");
enter = setjmp(current->jmp);
if (enter != 0)
return;
enter = 1;
/* restore stack pointer and other stuff of new cothread */
__asm__("movl %0, %%esp\n" : "=m"(thread->sp));
if (thread->flags & COTHREAD_STARTED) {
// switch to it
longjmp(thread->jmp,1);
} else {
// start it
__asm__("jmp " SYMBOL_NAME_STR(cothread_stub));
}
}
#ifndef __COTHREADS_H__
#define __COTHREADS_H__
#include <setjmp.h>
#include <pthread.h>
#define COTHREAD_STACKSIZE 8192
#define COTHREAD_MAXTHREADS 16
#define STACK_SIZE 0x200000
#ifndef CURRENT_STACK_FRAME
#define CURRENT_STACK_FRAME ({ char __csf; &__csf; })
#endif /* CURRENT_STACK_FRAME */
typedef struct _cothread_state cothread_state;
typedef struct _cothread_context cothread_context;
typedef int (*cothread_func)(int argc,char **argv);
#define COTHREAD_STARTED 0x01
struct _cothread_state {
cothread_context *ctx;
int threadnum;
cothread_func func;
int argc;
char **argv;
int flags;
int *sp;
int *pc;
jmp_buf jmp;
};
struct _cothread_context {
cothread_state *threads[COTHREAD_MAXTHREADS];
int nthreads;
int current;
};
cothread_context *cothread_init();
cothread_state *cothread_create(cothread_context *ctx);
void cothread_setfunc(cothread_state *thread,cothread_func func,int argc,char **argv);
void cothread_switch(cothread_state *thread);
cothread_state *cothread_main(cothread_context *ctx);
#endif /* __COTHREAD_H__ */