Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Simple modified gst-template to use BaseCameraSrc
Incorporate Broadcom mmal headers
  • Loading branch information
thaytan committed Oct 11, 2013
0 parents commit 28d08d6
Show file tree
Hide file tree
Showing 55 changed files with 8,264 additions and 0 deletions.
20 changes: 20 additions & 0 deletions .gitignore
@@ -0,0 +1,20 @@
aclocal.m4
autom4te.cache
autoregen.sh
.deps/
.libs/
*.la
*.lo
config.*
configure
libtool
INSTALL
Makefile.in
Makefile
depcomp
install-sh
ltmain.sh
missing
stamp-*
gstrpicamsrc-*.tar.*
*~
1 change: 1 addition & 0 deletions AUTHORS
@@ -0,0 +1 @@
Jan Schmidt <jan@centricular.com>
29 changes: 29 additions & 0 deletions COPYING
@@ -0,0 +1,29 @@
This package is primarily LGPL (See COPYING.LGPL) except the mmal/ subdir.

The mmal headers in the mmal/ dir are copyright:

Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

481 changes: 481 additions & 0 deletions COPYING.LGPL

Large diffs are not rendered by default.

Empty file added ChangeLog
Empty file.
3 changes: 3 additions & 0 deletions Makefile.am
@@ -0,0 +1,3 @@
SUBDIRS = src

EXTRA_DIST = autogen.sh COPYING.LGPL
1 change: 1 addition & 0 deletions NEWS
@@ -0,0 +1 @@
Initial release - working camera capture
3 changes: 3 additions & 0 deletions README
@@ -0,0 +1,3 @@
This is a GStreamer wrapper around the raspivid/raspistill
functionality of the RaspberryPi, providing a GStreamer
source element capturing from the Rpi camera.
18 changes: 18 additions & 0 deletions autogen.sh
@@ -0,0 +1,18 @@
#!/bin/sh
# you can either set the environment variables AUTOCONF, AUTOHEADER, AUTOMAKE,
# ACLOCAL, AUTOPOINT and/or LIBTOOLIZE to the right versions, or leave them
# unset and get the defaults

autoreconf --verbose --force --install --make || {
echo 'autogen.sh failed';
exit 1;
}

./configure || {
echo 'configure failed';
exit 1;
}

echo
echo "Now type 'make' to compile this module."
echo
84 changes: 84 additions & 0 deletions configure.ac
@@ -0,0 +1,84 @@
dnl required version of autoconf
AC_PREREQ([2.53])

AC_INIT([gstrpicamsrc],[1.0.0])

dnl required versions of gstreamer and plugins-base
GST_REQUIRED=1.0.0
GSTPB_REQUIRED=1.0.0
GSTPB_BAD_REQUIRED=1.0.0

AC_CONFIG_SRCDIR([src/gstrpicamsrc.c])
AC_CONFIG_HEADERS([config.h])

dnl required version of automake
AM_INIT_AUTOMAKE([1.10])

dnl enable mainainer mode by default
AM_MAINTAINER_MODE([enable])

dnl check for tools (compiler etc.)
AC_PROG_CC

dnl required version of libtool
LT_PREREQ([2.2.6])
LT_INIT

dnl give error and exit if we don't have pkgconfig
AC_CHECK_PROG(HAVE_PKGCONFIG, pkg-config, [ ], [
AC_MSG_ERROR([You need to have pkg-config installed!])
])

dnl Ensure we have basic Raspberry Pi headers and libs
dnl we need.
oldCFLAGS="$CFLAGS"
RPI_INCLUDEPATH="-I/opt/vc/include -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux"
CFLAGS="$CFLAGS $RPI_INCLUDEPATH"
AC_CHECK_HEADER([bcm_host.h], [], [AC_MSG_ERROR([Raspberry Pi files not found in /opt/vc])], [AC_INCLUDES_DEFAULT])
AC_SUBST(RPI_INCLUDEPATH)
CFLAGS="$oldCFLAGS"

PKG_CHECK_MODULES(GST, [
gstreamer-1.0 >= $GST_REQUIRED
gstreamer-base-1.0 >= $GST_REQUIRED
gstreamer-video-1.0 >= $GSTPB_REQUIRED
gstreamer-plugins-bad-1.0 >= GSTPB_BAD_REQUIRED
], [
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
], [
AC_MSG_ERROR([
You need to install or upgrade the GStreamer development
packages on your system. On debian-based systems these are
libgstreamer1.0-dev and libgstreamer-plugins-base1.0-dev.
on RPM-based systems gstreamer1.0-devel, libgstreamer1.0-devel
or similar. The minimum version required is $GST_REQUIRED.
])
])

dnl check if compiler understands -Wall (if yes, add -Wall to GST_CFLAGS)
AC_MSG_CHECKING([to see if compiler understands -Wall])
save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -Wall"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [
GST_CFLAGS="$GST_CFLAGS -Wall"
AC_MSG_RESULT([yes])
], [
AC_MSG_RESULT([no])
])

dnl set the plugindir where plugins should be installed (for src/Makefile.am)
if test "x${prefix}" = "x$HOME"; then
plugindir="$HOME/.gstreamer-1.0/plugins"
else
plugindir="\$(libdir)/gstreamer-1.0"
fi
AC_SUBST(plugindir)

dnl set proper LDFLAGS for plugins
GST_PLUGIN_LDFLAGS='-module -avoid-version -export-symbols-regex [_]*\(gst_\|Gst\|GST_\).*'
AC_SUBST(GST_PLUGIN_LDFLAGS)

AC_CONFIG_FILES([Makefile src/Makefile])
AC_OUTPUT

86 changes: 86 additions & 0 deletions interface/mmal/core/mmal_buffer_private.h
@@ -0,0 +1,86 @@
/*
Copyright (c) 2012, Broadcom Europe Ltd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#ifndef MMAL_BUFFER_PRIVATE_H
#define MMAL_BUFFER_PRIVATE_H

/** Typedef for the private area the framework reserves for the driver / communication layer */
typedef struct MMAL_DRIVER_BUFFER_T MMAL_DRIVER_BUFFER_T;

/** Size of the private area the framework reserves for the driver / communication layer */
#define MMAL_DRIVER_BUFFER_SIZE 32

/** Typedef for the framework's private area in the buffer header */
typedef struct MMAL_BUFFER_HEADER_PRIVATE_T
{
/** Callback invoked just prior to actually releasing the buffer header. Returns TRUE if
* release should be delayed. */
MMAL_BH_PRE_RELEASE_CB_T pf_pre_release;
void *pre_release_userdata;

/** Callback used to release / recycle the buffer header. This needs to be set by
* whoever allocates the buffer header. */
void (*pf_release)(struct MMAL_BUFFER_HEADER_T *header);
void *owner; /**< Context set by the allocator of the buffer header and passed
during the release callback */

int32_t refcount; /**< Reference count of the buffer header. When it reaches 0,
the release callback will be called. */

MMAL_BUFFER_HEADER_T *reference; /**< Reference to another acquired buffer header. */

/** Callback used to free the payload associated with this buffer header. This is only
* used if the buffer header was created by MMAL with a payload associated with it. */
void (*pf_payload_free)(void *payload_context, void *payload);
void *payload; /**< Pointer / handle to the allocated payload buffer */
void *payload_context; /**< Pointer to the context of the payload allocator */
uint32_t payload_size; /**< Allocated size in bytes of payload buffer */

void *component_data; /**< Field reserved for use by the component */
void *payload_handle; /**< Field reserved for mmal_buffer_header_mem_lock */

uint8_t driver_area[MMAL_DRIVER_BUFFER_SIZE];

} MMAL_BUFFER_HEADER_PRIVATE_T;

/** Get the size in bytes of a fully initialised MMAL_BUFFER_HEADER_T */
unsigned int mmal_buffer_header_size(MMAL_BUFFER_HEADER_T *header);

/** Initialise a MMAL_BUFFER_HEADER_T */
MMAL_BUFFER_HEADER_T *mmal_buffer_header_initialise(void *mem, unsigned int length);

/** Return a pointer to the area reserved for the driver.
*/
MMAL_DRIVER_BUFFER_T *mmal_buffer_header_driver_data(MMAL_BUFFER_HEADER_T *);

/** Return a pointer to a referenced buffer header.
* It is the caller's responsibility to ensure that the reference is still
* valid when using it.
*/
MMAL_BUFFER_HEADER_T *mmal_buffer_header_reference(MMAL_BUFFER_HEADER_T *header);

#endif /* MMAL_BUFFER_PRIVATE_H */

0 comments on commit 28d08d6

Please sign in to comment.