├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── build-aux ├── git-version-gen ├── gst-autogen.sh ├── release.mak └── update-common ├── configure.ac ├── example.conf ├── m4 ├── Makefile.am ├── as-ac-expand.m4 ├── as-compiler-flag.m4 ├── gst-args.m4 ├── gst-check.m4 ├── gst-error.m4 ├── gst-plugindir.m4 ├── gst.m4 └── shave.m4 ├── omx ├── Makefile.am ├── gstomx.c ├── gstomx.conf ├── gstomx.h ├── gstomx_aacdec.c ├── gstomx_aacdec.h ├── gstomx_aacenc.c ├── gstomx_aacenc.h ├── gstomx_adpcmdec.c ├── gstomx_adpcmdec.h ├── gstomx_adpcmenc.c ├── gstomx_adpcmenc.h ├── gstomx_amrnbdec.c ├── gstomx_amrnbdec.h ├── gstomx_amrnbenc.c ├── gstomx_amrnbenc.h ├── gstomx_amrwbdec.c ├── gstomx_amrwbdec.h ├── gstomx_amrwbenc.c ├── gstomx_amrwbenc.h ├── gstomx_audiosink.c ├── gstomx_audiosink.h ├── gstomx_base_audiodec.c ├── gstomx_base_audiodec.h ├── gstomx_base_filter.c ├── gstomx_base_filter.h ├── gstomx_base_sink.c ├── gstomx_base_sink.h ├── gstomx_base_src.c ├── gstomx_base_src.h ├── gstomx_base_videodec.c ├── gstomx_base_videodec.h ├── gstomx_base_videoenc.c ├── gstomx_base_videoenc.h ├── gstomx_dummy.c ├── gstomx_dummy.h ├── gstomx_filereadersrc.c ├── gstomx_filereadersrc.h ├── gstomx_g711dec.c ├── gstomx_g711dec.h ├── gstomx_g711enc.c ├── gstomx_g711enc.h ├── gstomx_g729dec.c ├── gstomx_g729dec.h ├── gstomx_g729enc.c ├── gstomx_g729enc.h ├── gstomx_h263dec.c ├── gstomx_h263dec.h ├── gstomx_h263enc.c ├── gstomx_h263enc.h ├── gstomx_h264dec.c ├── gstomx_h264dec.h ├── gstomx_h264enc.c ├── gstomx_h264enc.h ├── gstomx_ilbcdec.c ├── gstomx_ilbcdec.h ├── gstomx_ilbcenc.c ├── gstomx_ilbcenc.h ├── gstomx_interface.c ├── gstomx_interface.h ├── gstomx_jpegenc.c ├── gstomx_jpegenc.h ├── gstomx_mp2dec.c ├── gstomx_mp2dec.h ├── gstomx_mp3dec.c ├── gstomx_mp3dec.h ├── gstomx_mpeg4dec.c ├── gstomx_mpeg4dec.h ├── gstomx_mpeg4enc.c ├── gstomx_mpeg4enc.h ├── gstomx_util.c ├── gstomx_util.h ├── gstomx_videosink.c ├── gstomx_videosink.h ├── gstomx_volume.c ├── gstomx_volume.h ├── gstomx_vorbisdec.c ├── gstomx_vorbisdec.h ├── gstomx_wmvdec.c ├── gstomx_wmvdec.h └── headers │ ├── OMX_Audio.h │ ├── OMX_Component.h │ ├── OMX_ContentPipe.h │ ├── OMX_Core.h │ ├── OMX_IVCommon.h │ ├── OMX_Image.h │ ├── OMX_Index.h │ ├── OMX_Other.h │ ├── OMX_Types.h │ └── OMX_Video.h ├── shave-libtool.in ├── shave.in ├── tests ├── .gitignore ├── Makefile.am ├── check_async_queue.c ├── check_gstomx.c ├── check_libomxil.c ├── gst-openmax.conf └── standalone │ ├── Makefile.in │ └── core.c └── util ├── Makefile.am ├── async_queue.c ├── async_queue.h ├── sem.c └── sem.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.[oa] 2 | *.l[oa] 3 | .deps 4 | .libs 5 | Makefile.in 6 | 7 | INSTALL 8 | Makefile 9 | aclocal.m4 10 | autom4te.cache 11 | autoregen.sh 12 | config.* 13 | configure 14 | libtool 15 | stamp-h1 16 | stamp-h.in 17 | shave 18 | shave-libtool 19 | 20 | build-aux/compile 21 | build-aux/depcomp 22 | build-aux/install-sh 23 | build-aux/ltmain.sh 24 | build-aux/missing 25 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Felipe Contreras 2 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = util omx tests m4 2 | 3 | include $(top_srcdir)/build-aux/release.mak 4 | 5 | EXTRA_DIST = autogen.sh \ 6 | build-aux/git-version-gen \ 7 | build-aux/gst-autogen.sh \ 8 | build-aux/release.mak 9 | 10 | ACLOCAL_AMFLAGS = -I m4 11 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipec/gst-openmax/fd710ad66dbc3fc07c24485c75e64302a44cbc6d/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | 'gst-openmax' is a GStreamer plug-in that allows communication with OpenMAX IL 2 | components. 3 | 4 | OpenMAX IL is an industry standard that provides an abstraction layer for 5 | computer graphics, video, and sound routines. 6 | 7 | This project is a collaboration between Nokia, NXP, Collabora, 8 | STMicroelectronics, Texas Instruments, and the open source community. 9 | 10 | == What's the status? == 11 | 12 | Many component wrappers have been developed for different OpenMAX IL 13 | implemenatations. 14 | 15 | === ti (OMAP-3430) === 16 | 17 | Hardware-accelerated through DSP. 18 | 19 | * H.264 video encoder/decoder 20 | * H.263 video encoder/decoder 21 | * MPEG4 video encoder/decoder 22 | * WMV video decoder 23 | * JPEG image encoder 24 | 25 | === Maemo === 26 | 27 | Uses bellagio. 28 | 29 | * MP3 audio decoder 30 | * AAC audio encoder/decoder 31 | * G.711 audio encoder/decoder 32 | * G.719 audio encoder/decoder 33 | * iLBC audio encoder/decoder 34 | * AMR-NB audio encoder/decoder 35 | * AMR-WB audio encoder/decoder 36 | 37 | === bellagio === 38 | 39 | * MP3 audio decoder (libmad) 40 | * Vorbis audio decoder 41 | * MPEG4 video decoder (FFmpeg) 42 | * H.263 video decoder (FFmpeg) 43 | * Audio sink (ALSA... not maintained) 44 | 45 | 46 | We are missing: 47 | 48 | * OpenMAX IL facilities (tunneling, clock) 49 | 50 | == How to try it == 51 | 52 | It depends on your platform, but if want to try on x86 you can use Bellagio's 53 | implementation: 54 | 55 | === omxil === 56 | 57 | So, first install Bellagio's omxil from http://omxil.sourceforge.net/, or 58 | http://downloads.sourceforge.net/omxil/libomxil-bellagio-0.9.1.tar.gz. Version 59 | 0.9.1 is recommended. 60 | 61 | Install as usual: 62 | 63 | ./configure --prefix="$HOME/omx" 64 | make 65 | make install 66 | 67 | Register the components: 68 | 69 | $HOME/omx/bin/omxregister-bellagio -v 70 | 71 | You'll get an output like this: 72 | 73 | Scanning directory /home/felipec/omx/lib/bellagio/ 74 | 75 | Scanning openMAX libary /home/felipec/omx/lib/bellagio/libomxvorbis.so 76 | Component OMX.st.audio_decoder.ogg.single registered 77 | Specific role OMX.st.audio_decoder.ogg.single registered 78 | 79 | 1 OpenMAX IL ST static components with 1 roles succesfully scanned 80 | 81 | Make sure you have: 82 | * "OMX.st.audio_decoder.mp3.mad" for MP3 decoding 83 | * "OMX.st.audio_decoder.ogg.single" for Vorbis decoding 84 | * "OMX.st.video_decoder.mpeg4" for MPEG4 video decoding 85 | 86 | === omap === 87 | 88 | In order to use gst-openmax on Texas Instruments' OMAP platform you first need 89 | to apply the patches in 'patches/omap'. 90 | 91 | === gst-openmax === 92 | 93 | ./autogen.sh --noconfigure 94 | ./configure --prefix="$HOME/omx" 95 | make install 96 | 97 | === Running === 98 | 99 | To actually use the plug-in: 100 | 101 | export GST_PLUGIN_PATH=$HOME/omx/lib/gstreamer-0.10 102 | export LD_LIBRARY_PATH=$HOME/omx/lib 103 | 104 | You'll be able to play audio and video with MP3, Vorbis, MPEG4, H.264, or H.263 105 | content using Bellagio's components. 106 | 107 | For MP3 you'll also need the mp3parse element, otherwise you'll get: 108 | 109 | GStreamer-CRITICAL **: gst_segment_clip: assertion `segment->format == format' failed 110 | 111 | If you want to see what's happening: 112 | 113 | export GST_DEBUG=omx:4 114 | 115 | == How to contribute == 116 | 117 | Suscribe to the mailing list, or send a direct e-mail to gstreamer-openmax@lists.sourceforge.net. 118 | * mailing list: https://lists.sourceforge.net/lists/listinfo/gstreamer-openmax 119 | 120 | If you find any issues please fill a bug report: 121 | * http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer&component=gst-openmax 122 | 123 | == Roadmap == 124 | 125 | * Merge tunneling branch 126 | * Documentation 127 | * More unit tests 128 | * First real release 129 | 130 | == External Links == 131 | 132 | * OpenMAX's homepage: http://www.khronos.org/openmax/ 133 | * Bellagio's homepage: http://omxil.sourceforge.net/ 134 | -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | package=gst-openmax 5 | 6 | . build-aux/gst-autogen.sh 7 | 8 | touch ChangeLog 9 | 10 | CONFIGURE_DEF_OPT='--enable-maintainer-mode' 11 | 12 | autogen_options $@ 13 | 14 | echo -n "+ check for build tools" 15 | if test ! -z "$NOCHECK"; then echo " skipped"; else echo; fi 16 | version_check "autoconf" "$AUTOCONF autoconf autoconf-2.54 autoconf-2.53 autoconf-2.52" \ 17 | "ftp://ftp.gnu.org/pub/gnu/autoconf/" 2 52 || DIE=1 18 | version_check "automake" "$AUTOMAKE automake automake-1.9 automake-1.7 automake-1.6 automake-1.5" \ 19 | "ftp://ftp.gnu.org/pub/gnu/automake/" 1 7 || DIE=1 20 | version_check "libtoolize" "$LIBTOOLIZE libtoolize glibtoolize" \ 21 | "ftp://ftp.gnu.org/pub/gnu/libtool/" 1 5 0 || DIE=1 22 | version_check "pkg-config" "" \ 23 | "http://www.freedesktop.org/software/pkgconfig" 0 8 0 || DIE=1 24 | 25 | die_check $DIE 26 | 27 | autoconf_2_52d_check || DIE=1 28 | aclocal_check || DIE=1 29 | autoheader_check || DIE=1 30 | 31 | die_check $DIE 32 | 33 | # if no arguments specified then this will be printed 34 | if test -z "$*"; then 35 | echo "+ checking for autogen.sh options" 36 | echo " This autogen script will automatically run ./configure as:" 37 | echo " ./configure $CONFIGURE_DEF_OPT" 38 | echo " To pass any additional options, please specify them on the $0" 39 | echo " command line." 40 | fi 41 | 42 | toplevel_check $srcfile 43 | 44 | tool_run "$aclocal" "-I m4 $ACLOCAL_FLAGS" 45 | tool_run "$libtoolize" "--copy --force" 46 | tool_run "$autoheader" 47 | 48 | # touch the stamp-h.in build stamp so we don't re-run autoheader in maintainer mode -- wingo 49 | echo timestamp > stamp-h.in 2> /dev/null 50 | 51 | tool_run "$autoconf" 52 | tool_run "$automake" "-a -c" 53 | 54 | # if enable exists, add an -enable option for each of the lines in that file 55 | if test -f enable; then 56 | for a in `cat enable`; do 57 | CONFIGURE_FILE_OPT="--enable-$a" 58 | done 59 | fi 60 | 61 | # if disable exists, add an -disable option for each of the lines in that file 62 | if test -f disable; then 63 | for a in `cat disable`; do 64 | CONFIGURE_FILE_OPT="$CONFIGURE_FILE_OPT --disable-$a" 65 | done 66 | fi 67 | 68 | test -n "$NOCONFIGURE" && { 69 | echo "+ skipping configure stage for package $package, as requested." 70 | echo "+ autogen.sh done." 71 | exit 0 72 | } 73 | 74 | echo "+ running configure ... " 75 | test ! -z "$CONFIGURE_DEF_OPT" && echo " ./configure default flags: $CONFIGURE_DEF_OPT" 76 | test ! -z "$CONFIGURE_EXT_OPT" && echo " ./configure external flags: $CONFIGURE_EXT_OPT" 77 | test ! -z "$CONFIGURE_FILE_OPT" && echo " ./configure enable/disable flags: $CONFIGURE_FILE_OPT" 78 | echo 79 | 80 | ./configure $CONFIGURE_DEF_OPT $CONFIGURE_EXT_OPT $CONFIGURE_FILE_OPT || { 81 | echo " configure failed" 82 | exit 1 83 | } 84 | 85 | echo "Now type 'make' to compile $package." 86 | -------------------------------------------------------------------------------- /build-aux/git-version-gen: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | if test -f .version; then 4 | v=`cat .version` 5 | else 6 | v=`git describe --tags | sed 's/^v//'` 7 | fi 8 | 9 | # for m4_esyscmd 10 | echo "$v" | tr -d '\012' 11 | -------------------------------------------------------------------------------- /build-aux/release.mak: -------------------------------------------------------------------------------- 1 | # include this snippet to add a common release: target by using 2 | # include $(top_srcdir)/build-aux/release.mak 3 | 4 | # make bz2 as well 5 | AUTOMAKE_OPTIONS = dist-bzip2 6 | 7 | release: dist 8 | $(MAKE) $(PACKAGE)-$(VERSION).tar.gz.md5 9 | $(MAKE) $(PACKAGE)-$(VERSION).tar.bz2.md5 10 | 11 | # generate md5 sum files 12 | %.md5: % 13 | md5sum $< > $@ 14 | 15 | # check that no marshal or enumtypes files are included 16 | # this in turn ensures that distcheck fails for missing .list files which is currently 17 | # shadowed when the corresponding .c and .h files are included. 18 | distcheck-hook: 19 | @test "x" = "x`find $(distdir) -name \*-enumtypes.[ch] | grep -v win32`" && \ 20 | test "x" = "x`find $(distdir) -name \*-marshal.[ch]`" || \ 21 | ( $(ECHO) "*** Leftover enumtypes or marshal files in the tarball." && \ 22 | $(ECHO) "*** Make sure the following files are not disted:" && \ 23 | find $(distdir) -name \*-enumtypes.[ch] | grep -v win32 && \ 24 | find $(distdir) -name \*-marshal.[ch] && \ 25 | false ) 26 | 27 | dist-hook: 28 | echo $(VERSION) > $(distdir)/.version 29 | -------------------------------------------------------------------------------- /build-aux/update-common: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Don't rely blindly on this command, further cleanup is needed after running 4 | # this script. 5 | 6 | orig=${1:-"../common"} 7 | 8 | cp $orig/gst-autogen.sh build-aux/gst-autogen.sh 9 | cp $orig/release.mak build-aux/release.mak 10 | cp $orig/m4/as-ac-expand.m4 m4/as-ac-expand.m4 11 | cp $orig/m4/as-compiler-flag.m4 m4/as-compiler-flag.m4 12 | cp $orig/m4/gst-args.m4 m4/gst-args.m4 13 | cp $orig/m4/gst-check.m4 m4/gst-check.m4 14 | cp $orig/m4/gst-error.m4 m4/gst-error.m4 15 | cp $orig/m4/gst-plugindir.m4 m4/gst-plugindir.m4 16 | cp $orig/m4/gst.m4 m4/gst.m4 17 | cp $orig/m4/shave.m4 m4/shave.m4 18 | cp $orig/shave-libtool.in shave-libtool.in 19 | cp $orig/shave.in shave.in 20 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | AC_PREREQ([2.52]) 2 | 3 | AC_INIT([gst-openmax], m4_esyscmd([build-aux/git-version-gen]), 4 | [http://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer&component=gst-openmax]) 5 | 6 | AC_CONFIG_AUX_DIR([build-aux]) 7 | AM_INIT_AUTOMAKE([-Wall -Wno-portability]) 8 | AC_CONFIG_HEADERS([config.h]) 9 | 10 | dnl versions of GStreamer 11 | GST_MAJORMINOR=0.10 12 | GST_REQUIRED=0.10.0 13 | 14 | dnl AM_MAINTAINER_MODE provides the option to enable maintainer mode 15 | AM_MAINTAINER_MODE 16 | 17 | dnl check for tools 18 | AC_PROG_CC 19 | AM_PROG_CC_C_O 20 | AC_PROG_INSTALL 21 | AC_PROG_LIBTOOL 22 | 23 | PKG_CHECK_MODULES([CHECK], [check], HAVE_CHECK=yes, HAVE_CHECK=no) 24 | 25 | dnl Keep correct libtool macros in-tree. 26 | AC_CONFIG_MACRO_DIR([m4]) 27 | 28 | dnl initialize GStreamer macros 29 | AG_GST_INIT 30 | 31 | dnl define an ERROR_CFLAGS Makefile variable 32 | AG_GST_SET_ERROR_CFLAGS($GST_CVS) 33 | 34 | dnl add GStreamer arguments 35 | AG_GST_ARG_DEBUG 36 | AG_GST_ARG_PROFILING 37 | AG_GST_ARG_VALGRIND 38 | AG_GST_ARG_GCOV 39 | 40 | AG_GST_ARG_WITH_PKG_CONFIG_PATH 41 | AG_GST_ARG_WITH_PACKAGE_NAME 42 | AG_GST_ARG_WITH_PACKAGE_ORIGIN 43 | 44 | AC_ARG_ENABLE([experimental], AC_HELP_STRING([--enable-experimental]), [EXPERIMENTAL=$enableval], [EXPERIMENTAL=no]) 45 | AM_CONDITIONAL([EXPERIMENTAL], [test x$EXPERIMENTAL = xyes]) 46 | if test x$EXPERIMENTAL = xyes; then 47 | AC_DEFINE([EXPERIMENTAL], , [Enable experimental elements]) 48 | fi 49 | 50 | dnl ** checks ** 51 | 52 | dnl Check for GLib 53 | PKG_CHECK_MODULES([GTHREAD], [gthread-2.0]) 54 | 55 | dnl Check for GStreamer 56 | AG_GST_CHECK_GST($GST_MAJORMINOR, [$GST_REQUIRED]) 57 | AG_GST_CHECK_GST_BASE($GST_MAJORMINOR, [$GST_REQUIRED]) 58 | AG_GST_CHECK_GST_CHECK($GST_MAJORMINOR, [$GST_REQUIRED], [no]) 59 | 60 | dnl ** finalize *** 61 | 62 | dnl set license and copyright notice 63 | GST_LICENSE="LGPL" 64 | AC_DEFINE_UNQUOTED(GST_LICENSE, "$GST_LICENSE", [GStreamer license]) 65 | AC_SUBST(GST_LICENSE) 66 | 67 | dnl set GStreamer plug-in dir 68 | AG_GST_SET_PLUGINDIR 69 | 70 | dnl GST_OPTION_CFLAGS 71 | if test "x$USE_DEBUG" = xyes; then 72 | PROFILE_CFLAGS="-g" 73 | fi 74 | AC_SUBST(PROFILE_CFLAGS) 75 | 76 | DEPRECATED_CFLAGS="-DGST_DISABLE_DEPRECATED" 77 | AC_SUBST(DEPRECATED_CFLAGS) 78 | 79 | dnl every flag in GST_OPTION_CFLAGS can be overridden at make time 80 | GST_OPTION_CFLAGS="\$(ERROR_CFLAGS) \$(DEBUG_CFLAGS) \$(PROFILE_CFLAGS) \$(GCOV_CFLAGS) \$(OPT_CFLAGS) \$(DEPRECATED_CFLAGS)" 81 | AC_SUBST(GST_OPTION_CFLAGS) 82 | 83 | dnl our libraries need to be versioned correctly 84 | AC_SUBST(GST_LT_LDFLAGS) 85 | 86 | dnl FIXME: do we want to rename to GST_ALL_* ? 87 | dnl prefer internal headers to already installed ones 88 | dnl also add builddir include for enumtypes and marshal 89 | dnl add GST_OPTION_CFLAGS, but overridable 90 | GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS \$(GST_OPTION_CFLAGS)" 91 | AC_SUBST(GST_CFLAGS) 92 | AC_SUBST(GST_LIBS) 93 | 94 | dnl LDFLAGS really should only contain flags, not libs - they get added before 95 | dnl whatevertarget_LIBS and -L flags here affect the rest of the linking 96 | GST_ALL_LDFLAGS="-no-undefined" 97 | AC_SUBST(GST_ALL_LDFLAGS) 98 | 99 | dnl this really should only contain flags, not libs - they get added before 100 | dnl whatevertarget_LIBS and -L flags here affect the rest of the linking 101 | GST_PLUGIN_LDFLAGS="-module -avoid-version -export-symbols-regex '^[_]*gst_plugin_desc\$\$' $GST_ALL_LDFLAGS" 102 | AC_SUBST(GST_PLUGIN_LDFLAGS) 103 | 104 | SHAVE_INIT 105 | AC_CONFIG_FILES([shave shave-libtool]) 106 | 107 | AC_CONFIG_FILES([Makefile \ 108 | omx/Makefile \ 109 | util/Makefile \ 110 | tests/Makefile \ 111 | tests/standalone/Makefile \ 112 | m4/Makefile]) 113 | 114 | AC_OUTPUT 115 | -------------------------------------------------------------------------------- /example.conf: -------------------------------------------------------------------------------- 1 | omx_mpeg4dec, 2 | type=GstOmxMpeg4Dec, 3 | library-name=libomxil-bellagio.so.0, 4 | component-name=OMX.st.video_decoder.mpeg4, 5 | rank=256; 6 | 7 | omx_h264dec, 8 | type=GstOmxH264Dec, 9 | library-name=libomxil-bellagio.so.0, 10 | component-name=OMX.st.video_decoder.avc, 11 | rank=256; 12 | 13 | omx_h263dec, 14 | type=GstOmxH263Dec, 15 | library-name=libomxil-bellagio.so.0, 16 | component-name=OMX.st.video_decoder.h263, 17 | rank=256; 18 | 19 | omx_wmvdec, 20 | type=GstOmxWmvDec, 21 | library-name=libomxil-bellagio.so.0, 22 | component-name=OMX.st.video_decoder.wmv, 23 | rank=256; 24 | 25 | omx_mpeg4enc, 26 | type=GstOmxMpeg4Enc, 27 | library-name=libomxil-bellagio.so.0, 28 | component-name=OMX.st.video_encoder.mpeg4, 29 | rank=256; 30 | 31 | omx_h264enc, 32 | type=GstOmxH264Enc, 33 | library-name=libomxil-bellagio.so.0, 34 | component-name=OMX.st.video_encoder.avc, 35 | rank=256; 36 | 37 | omx_h263enc, 38 | type=GstOmxH263Enc, 39 | library-name=libomxil-bellagio.so.0, 40 | component-name=OMX.st.video_encoder.h263, 41 | rank=256; 42 | 43 | omx_vorbisdec, 44 | type=GstOmxVorbisDec, 45 | library-name=libomxil-bellagio.so.0, 46 | component-name=OMX.st.audio_decoder.ogg.single, 47 | rank=128; 48 | 49 | omx_mp3dec, 50 | type=GstOmxMp3Dec, 51 | library-name=libomxil-bellagio.so.0, 52 | component-name=OMX.st.audio_decoder.mp3.mad, 53 | rank=256; 54 | 55 | omx_audiosink, 56 | type=GstOmxAudioSink, 57 | library-name=libomxil-bellagio.so.0, 58 | component-name=OMX.st.alsa.alsasink, 59 | rank=0; 60 | -------------------------------------------------------------------------------- /m4/Makefile.am: -------------------------------------------------------------------------------- 1 | EXTRA_DIST = as-ac-expand.m4 \ 2 | as-compiler-flag.m4 \ 3 | gst.m4 \ 4 | gst-args.m4 \ 5 | gst-check.m4 \ 6 | gst-error.m4 \ 7 | gst-plugindir.m4 8 | -------------------------------------------------------------------------------- /m4/as-ac-expand.m4: -------------------------------------------------------------------------------- 1 | dnl as-ac-expand.m4 0.2.0 2 | dnl autostars m4 macro for expanding directories using configure's prefix 3 | dnl thomas@apestaart.org 4 | 5 | dnl AS_AC_EXPAND(VAR, CONFIGURE_VAR) 6 | dnl example 7 | dnl AS_AC_EXPAND(SYSCONFDIR, $sysconfdir) 8 | dnl will set SYSCONFDIR to /usr/local/etc if prefix=/usr/local 9 | 10 | AC_DEFUN([AS_AC_EXPAND], 11 | [ 12 | EXP_VAR=[$1] 13 | FROM_VAR=[$2] 14 | 15 | dnl first expand prefix and exec_prefix if necessary 16 | prefix_save=$prefix 17 | exec_prefix_save=$exec_prefix 18 | 19 | dnl if no prefix given, then use /usr/local, the default prefix 20 | if test "x$prefix" = "xNONE"; then 21 | prefix="$ac_default_prefix" 22 | fi 23 | dnl if no exec_prefix given, then use prefix 24 | if test "x$exec_prefix" = "xNONE"; then 25 | exec_prefix=$prefix 26 | fi 27 | 28 | full_var="$FROM_VAR" 29 | dnl loop until it doesn't change anymore 30 | while true; do 31 | new_full_var="`eval echo $full_var`" 32 | if test "x$new_full_var" = "x$full_var"; then break; fi 33 | full_var=$new_full_var 34 | done 35 | 36 | dnl clean up 37 | full_var=$new_full_var 38 | AC_SUBST([$1], "$full_var") 39 | 40 | dnl restore prefix and exec_prefix 41 | prefix=$prefix_save 42 | exec_prefix=$exec_prefix_save 43 | ]) 44 | -------------------------------------------------------------------------------- /m4/as-compiler-flag.m4: -------------------------------------------------------------------------------- 1 | dnl as-compiler-flag.m4 0.1.0 2 | 3 | dnl autostars m4 macro for detection of compiler flags 4 | 5 | dnl David Schleef 6 | dnl Tim-Philipp Müller 7 | 8 | dnl AS_COMPILER_FLAG(CFLAGS, ACTION-IF-ACCEPTED, [ACTION-IF-NOT-ACCEPTED]) 9 | dnl Tries to compile with the given CFLAGS. 10 | dnl Runs ACTION-IF-ACCEPTED if the compiler can compile with the flags, 11 | dnl and ACTION-IF-NOT-ACCEPTED otherwise. 12 | 13 | AC_DEFUN([AS_COMPILER_FLAG], 14 | [ 15 | AC_MSG_CHECKING([to see if compiler understands $1]) 16 | 17 | save_CFLAGS="$CFLAGS" 18 | CFLAGS="$CFLAGS $1" 19 | 20 | AC_TRY_COMPILE([ ], [], [flag_ok=yes], [flag_ok=no]) 21 | CFLAGS="$save_CFLAGS" 22 | 23 | if test "X$flag_ok" = Xyes ; then 24 | $2 25 | true 26 | else 27 | $3 28 | true 29 | fi 30 | AC_MSG_RESULT([$flag_ok]) 31 | ]) 32 | -------------------------------------------------------------------------------- /m4/gst-check.m4: -------------------------------------------------------------------------------- 1 | dnl pkg-config-based checks for GStreamer modules and dependency modules 2 | 3 | dnl generic: 4 | dnl AG_GST_PKG_CHECK_MODULES([PREFIX], [WHICH], [REQUIRED]) 5 | dnl sets HAVE_[$PREFIX], [$PREFIX]_* 6 | dnl AG_GST_CHECK_MODULES([PREFIX], [MODULE], [MINVER], [NAME], [REQUIRED]) 7 | dnl sets HAVE_[$PREFIX], [$PREFIX]_* 8 | 9 | dnl specific: 10 | dnl AG_GST_CHECK_GST([MAJMIN], [MINVER], [REQUIRED]) 11 | dnl also sets/ACSUBSTs GST_TOOLS_DIR and GST_PLUGINS_DIR 12 | dnl AG_GST_CHECK_GST_BASE([MAJMIN], [MINVER], [REQUIRED]) 13 | dnl AG_GST_CHECK_GST_GDP([MAJMIN], [MINVER], [REQUIRED]) 14 | dnl AG_GST_CHECK_GST_CONTROLLER([MAJMIN], [MINVER], [REQUIRED]) 15 | dnl AG_GST_CHECK_GST_CHECK([MAJMIN], [MINVER], [REQUIRED]) 16 | dnl AG_GST_CHECK_GST_PLUGINS_BASE([MAJMIN], [MINVER], [REQUIRED]) 17 | dnl also sets/ACSUBSTs GSTPB_PLUGINS_DIR 18 | 19 | AC_DEFUN([AG_GST_PKG_CHECK_MODULES], 20 | [ 21 | which="[$2]" 22 | dnl not required by default, since we use this mostly for plugin deps 23 | required=ifelse([$3], , "no", [$3]) 24 | 25 | PKG_CHECK_MODULES([$1], $which, 26 | [ 27 | HAVE_[$1]="yes" 28 | ], 29 | [ 30 | HAVE_[$1]="no" 31 | AC_MSG_RESULT(no) 32 | if test "x$required" = "xyes"; then 33 | AC_MSG_ERROR($[$1]_PKG_ERRORS) 34 | else 35 | AC_MSG_NOTICE($[$1]_PKG_ERRORS) 36 | fi 37 | ]) 38 | 39 | dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7 40 | dnl It gets done automatically in automake >= 1.7, which we now require 41 | ])) 42 | 43 | AC_DEFUN([AG_GST_CHECK_MODULES], 44 | [ 45 | module=[$2] 46 | minver=[$3] 47 | name="[$4]" 48 | required=ifelse([$5], , "yes", [$5]) dnl required by default 49 | 50 | PKG_CHECK_MODULES([$1], $module >= $minver, 51 | [ 52 | HAVE_[$1]="yes" 53 | ], 54 | [ 55 | HAVE_[$1]="no" 56 | AC_MSG_RESULT(no) 57 | AC_MSG_NOTICE($[$1]_PKG_ERRORS) 58 | if test "x$required" = "xyes"; then 59 | AC_MSG_ERROR([no $module >= $minver ($name) found]) 60 | else 61 | AC_MSG_NOTICE([no $module >= $minver ($name) found]) 62 | fi 63 | ]) 64 | 65 | dnl AC_SUBST of CFLAGS and LIBS was not done before automake 1.7 66 | dnl It gets done automatically in automake >= 1.7, which we now require 67 | ])) 68 | 69 | AC_DEFUN([AG_GST_CHECK_GST], 70 | [ 71 | AG_GST_CHECK_MODULES(GST, gstreamer-[$1], [$2], [GStreamer], [$3]) 72 | dnl allow setting before calling this macro to override 73 | if test -z $GST_TOOLS_DIR; then 74 | GST_TOOLS_DIR=`$PKG_CONFIG --variable=toolsdir gstreamer-[$1]` 75 | if test -z $GST_TOOLS_DIR; then 76 | AC_MSG_ERROR( 77 | [no tools dir set in GStreamer pkg-config file, core upgrade needed.]) 78 | fi 79 | fi 80 | AC_MSG_NOTICE([using GStreamer tools in $GST_TOOLS_DIR]) 81 | AC_SUBST(GST_TOOLS_DIR) 82 | 83 | dnl check for where core plug-ins got installed 84 | dnl this is used for unit tests 85 | dnl allow setting before calling this macro to override 86 | if test -z $GST_PLUGINS_DIR; then 87 | GST_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-[$1]` 88 | if test -z $GST_PLUGINS_DIR; then 89 | AC_MSG_ERROR( 90 | [no pluginsdir set in GStreamer pkg-config file, core upgrade needed.]) 91 | fi 92 | fi 93 | AC_MSG_NOTICE([using GStreamer plug-ins in $GST_PLUGINS_DIR]) 94 | AC_SUBST(GST_PLUGINS_DIR) 95 | ]) 96 | 97 | AC_DEFUN([AG_GST_CHECK_GST_BASE], 98 | [ 99 | AG_GST_CHECK_MODULES(GST_BASE, gstreamer-base-[$1], [$2], 100 | [GStreamer Base Libraries], [$3]) 101 | ]) 102 | 103 | AC_DEFUN([AG_GST_CHECK_GST_GDP], 104 | [ 105 | AG_GST_CHECK_MODULES(GST_GDP, gstreamer-dataprotocol-[$1], [$2], 106 | [GStreamer Data Protocol Library], [$3]) 107 | ]) 108 | 109 | AC_DEFUN([AG_GST_CHECK_GST_CONTROLLER], 110 | [ 111 | AG_GST_CHECK_MODULES(GST_CONTROLLER, gstreamer-controller-[$1], [$2], 112 | [GStreamer Controller Library], [$3]) 113 | ]) 114 | 115 | AC_DEFUN([AG_GST_CHECK_GST_CHECK], 116 | [ 117 | AG_GST_CHECK_MODULES(GST_CHECK, gstreamer-check-[$1], [$2], 118 | [GStreamer Check unittest Library], [$3]) 119 | ]) 120 | 121 | AC_DEFUN([AG_GST_CHECK_GST_PLUGINS_BASE], 122 | [ 123 | AG_GST_CHECK_MODULES(GST_PLUGINS_BASE, gstreamer-plugins-base-[$1], [$2], 124 | [GStreamer Base Plug-ins Library], [$3]) 125 | 126 | dnl check for where base plug-ins got installed 127 | dnl this is used for unit tests 128 | dnl allow setting before calling this macro to override 129 | if test -z $GSTPB_PLUGINS_DIR; then 130 | GSTPB_PLUGINS_DIR=`$PKG_CONFIG --variable=pluginsdir gstreamer-plugins-base-[$1]` 131 | if test -z $GSTPB_PLUGINS_DIR; then 132 | AC_MSG_ERROR( 133 | [no pluginsdir set in GStreamer Base Plug-ins pkg-config file]) 134 | fi 135 | fi 136 | AC_MSG_NOTICE([using GStreamer Base Plug-ins in $GSTPB_PLUGINS_DIR]) 137 | AC_SUBST(GSTPB_PLUGINS_DIR) 138 | ]) 139 | -------------------------------------------------------------------------------- /m4/gst-error.m4: -------------------------------------------------------------------------------- 1 | Dnl handle various error-related things 2 | 3 | dnl Thomas Vander Stichele 4 | dnl Tim-Philipp Müller 5 | 6 | dnl Last modification: 2008-02-18 7 | 8 | dnl AG_GST_SET_ERROR_CFLAGS([ADD-WERROR]) 9 | dnl AG_GST_SET_ERROR_CXXFLAGS([ADD-WERROR]) 10 | dnl AG_GST_SET_LEVEL_DEFAULT([IS-GIT-VERSION]) 11 | 12 | 13 | dnl Sets ERROR_CFLAGS to something the compiler will accept. 14 | dnl AC_SUBST them so they are available in Makefile 15 | 16 | dnl -Wall is added if it is supported 17 | dnl -Werror is added if ADD-WERROR is not "no" 18 | 19 | dnl These flags can be overridden at make time: 20 | dnl make ERROR_CFLAGS= 21 | AC_DEFUN([AG_GST_SET_ERROR_CFLAGS], 22 | [ 23 | AC_REQUIRE([AC_PROG_CC]) 24 | AC_REQUIRE([AS_COMPILER_FLAG]) 25 | 26 | 27 | dnl if we support -Wall, set it unconditionally 28 | AS_COMPILER_FLAG(-Wall, 29 | ERROR_CFLAGS="-Wall", 30 | ERROR_CFLAGS="") 31 | 32 | dnl Warn if declarations after statements are used (C99 extension) 33 | AS_COMPILER_FLAG(-Wdeclaration-after-statement, 34 | ERROR_CFLAGS="$ERROR_CFLAGS -Wdeclaration-after-statement") 35 | 36 | dnl Warn if variable length arrays are used (C99 extension) 37 | AS_COMPILER_FLAG(-Wvla, 38 | ERROR_CFLAGS="$ERROR_CFLAGS -Wvla") 39 | 40 | dnl Warn for invalid pointer arithmetic 41 | AS_COMPILER_FLAG(-Wpointer-arith, 42 | ERROR_CFLAGS="$ERROR_CFLAGS -Wpointer-arith") 43 | 44 | dnl if asked for, add -Werror if supported 45 | if test "x$1" != "xno" 46 | then 47 | AS_COMPILER_FLAG(-Werror, ERROR_CFLAGS="$ERROR_CFLAGS -Werror") 48 | 49 | dnl if -Werror isn't suported, try -errwarn=%all (Sun Forte case) 50 | if test "x$ERROR_CFLAGS" == "x" 51 | then 52 | AS_COMPILER_FLAG([-errwarn=%all], [ 53 | ERROR_CFLAGS="-errwarn=%all" 54 | dnl try -errwarn=%all,no%E_EMPTY_DECLARATION, 55 | dnl no%E_STATEMENT_NOT_REACHED,no%E_ARGUEMENT_MISMATCH, 56 | dnl no%E_MACRO_REDEFINED (Sun Forte case) 57 | dnl For Forte we need disable "empty declaration" warning produced by un-needed semicolon 58 | dnl "statement not reached" disabled because there is g_assert_not_reached () in some places 59 | dnl "macro redefined" because of gst/gettext.h 60 | dnl FIXME: is it really supposed to be 'ARGUEMENT' and not 'ARGUMENT'? 61 | for f in 'no%E_EMPTY_DECLARATION' \ 62 | 'no%E_STATEMENT_NOT_REACHED' \ 63 | 'no%E_ARGUEMENT_MISMATCH' \ 64 | 'no%E_MACRO_REDEFINED' \ 65 | 'no%E_LOOP_NOT_ENTERED_AT_TOP' 66 | do 67 | AS_COMPILER_FLAG([-errwarn=%all,$f], [ 68 | ERROR_CFLAGS="$ERROR_CFLAGS,$f" 69 | ]) 70 | done 71 | ]) 72 | else 73 | dnl Add -fno-strict-aliasing for GLib versions before 2.19.8 74 | dnl as before G_LOCK and friends caused strict aliasing compiler 75 | dnl warnings. 76 | PKG_CHECK_EXISTS([glib-2.0 < 2.19.8], [ 77 | AS_COMPILER_FLAG(-fno-strict-aliasing, 78 | ERROR_CFLAGS="$ERROR_CFLAGS -fno-strict-aliasing") 79 | ]) 80 | fi 81 | fi 82 | 83 | AC_SUBST(ERROR_CFLAGS) 84 | AC_MSG_NOTICE([set ERROR_CFLAGS to $ERROR_CFLAGS]) 85 | ]) 86 | -------------------------------------------------------------------------------- /m4/gst-plugindir.m4: -------------------------------------------------------------------------------- 1 | dnl AG_GST_SET_PLUGINDIR 2 | 3 | dnl AC_DEFINE PLUGINDIR to the full location where plug-ins will be installed 4 | dnl AC_SUBST plugindir, to be used in Makefile.am's 5 | 6 | AC_DEFUN([AG_GST_SET_PLUGINDIR], 7 | [ 8 | dnl define location of plugin directory 9 | AS_AC_EXPAND(PLUGINDIR, ${libdir}/gstreamer-$GST_MAJORMINOR) 10 | AC_DEFINE_UNQUOTED(PLUGINDIR, "$PLUGINDIR", 11 | [directory where plugins are located]) 12 | AC_MSG_NOTICE([Using $PLUGINDIR as the plugin install location]) 13 | 14 | dnl plugin directory configure-time variable for use in Makefile.am 15 | plugindir="\$(libdir)/gstreamer-$GST_MAJORMINOR" 16 | AC_SUBST(plugindir) 17 | ]) 18 | -------------------------------------------------------------------------------- /m4/gst.m4: -------------------------------------------------------------------------------- 1 | dnl AG_GST_INIT 2 | dnl sets up use of GStreamer configure.ac macros 3 | dnl all GStreamer autoconf macros are prefixed 4 | dnl with AG_GST_ for public macros 5 | dnl with _AG_GST_ for private macros 6 | 7 | AC_DEFUN([AG_GST_INIT], 8 | [ 9 | m4_pattern_forbid(^_?AG_GST_) 10 | ]) 11 | -------------------------------------------------------------------------------- /m4/shave.m4: -------------------------------------------------------------------------------- 1 | dnl Make automake/libtool output more friendly to humans 2 | dnl 3 | dnl SHAVE_INIT([shavedir],[default_mode]) 4 | dnl 5 | dnl shavedir: the directory where the shave scripts are, it defaults to 6 | dnl $(top_builddir) 7 | dnl default_mode: (enable|disable) default shave mode. This parameter 8 | dnl controls shave's behaviour when no option has been 9 | dnl given to configure. It defaults to disable. 10 | dnl 11 | dnl * SHAVE_INIT should be called late in your configure.(ac|in) file (just 12 | dnl before AC_CONFIG_FILE/AC_OUTPUT is perfect. This macro rewrites CC and 13 | dnl LIBTOOL, you don't want the configure tests to have these variables 14 | dnl re-defined. 15 | dnl * This macro requires GNU make's -s option. 16 | 17 | AC_DEFUN([_SHAVE_ARG_ENABLE], 18 | [ 19 | AC_ARG_ENABLE([shave], 20 | AS_HELP_STRING( 21 | [--enable-shave], 22 | [use shave to make the build pretty [[default=$1]]]),, 23 | [enable_shave=$1] 24 | ) 25 | ]) 26 | 27 | AC_DEFUN([SHAVE_INIT], 28 | [ 29 | dnl you can tweak the default value of enable_shave 30 | m4_if([$2], [enable], [_SHAVE_ARG_ENABLE(yes)], [_SHAVE_ARG_ENABLE(no)]) 31 | 32 | if test x"$enable_shave" = xyes; then 33 | dnl where can we find the shave scripts? 34 | m4_if([$1],, 35 | [shavedir="$ac_pwd"], 36 | [shavedir="$ac_pwd/$1"]) 37 | AC_SUBST(shavedir) 38 | 39 | dnl make is now quiet 40 | AC_SUBST([MAKEFLAGS], [-s]) 41 | AC_SUBST([AM_MAKEFLAGS], ['`test -z $V && echo -s`']) 42 | 43 | dnl we need sed 44 | AC_CHECK_PROG(SED,sed,sed,false) 45 | 46 | dnl substitute libtool 47 | SHAVE_SAVED_LIBTOOL=$LIBTOOL 48 | LIBTOOL="${SHELL} ${shavedir}/shave-libtool '${SHAVE_SAVED_LIBTOOL}'" 49 | AC_SUBST(LIBTOOL) 50 | 51 | dnl substitute cc/cxx 52 | SHAVE_SAVED_CC=$CC 53 | SHAVE_SAVED_CXX=$CXX 54 | SHAVE_SAVED_FC=$FC 55 | SHAVE_SAVED_F77=$F77 56 | SHAVE_SAVED_OBJC=$OBJC 57 | CC="${SHELL} ${shavedir}/shave cc ${SHAVE_SAVED_CC}" 58 | CXX="${SHELL} ${shavedir}/shave cxx ${SHAVE_SAVED_CXX}" 59 | FC="${SHELL} ${shavedir}/shave fc ${SHAVE_SAVED_FC}" 60 | F77="${SHELL} ${shavedir}/shave f77 ${SHAVE_SAVED_F77}" 61 | OBJC="${SHELL} ${shavedir}/shave objc ${SHAVE_SAVED_OBJC}" 62 | AC_SUBST(CC) 63 | AC_SUBST(CXX) 64 | AC_SUBST(FC) 65 | AC_SUBST(F77) 66 | AC_SUBST(OBJC) 67 | 68 | V=@ 69 | else 70 | V=1 71 | fi 72 | Q='$(V:1=)' 73 | AC_SUBST(V) 74 | AC_SUBST(Q) 75 | ]) 76 | 77 | -------------------------------------------------------------------------------- /omx/Makefile.am: -------------------------------------------------------------------------------- 1 | plugin_LTLIBRARIES = libgstomx.la 2 | 3 | libgstomx_la_SOURCES = gstomx.c gstomx.h \ 4 | gstomx_util.c gstomx_util.h \ 5 | gstomx_interface.c gstomx_interface.h \ 6 | gstomx_base_filter.c gstomx_base_filter.h \ 7 | gstomx_base_videodec.c gstomx_base_videodec.h \ 8 | gstomx_base_videoenc.c gstomx_base_videoenc.h \ 9 | gstomx_base_audiodec.c gstomx_base_audiodec.h \ 10 | gstomx_dummy.c gstomx_dummy.h \ 11 | gstomx_volume.c gstomx_volume.h \ 12 | gstomx_mpeg4dec.c gstomx_mpeg4dec.h \ 13 | gstomx_h263dec.c gstomx_h263dec.h \ 14 | gstomx_h264dec.c gstomx_h264dec.h \ 15 | gstomx_wmvdec.c gstomx_wmvdec.h \ 16 | gstomx_mpeg4enc.c gstomx_mpeg4enc.h \ 17 | gstomx_h264enc.c gstomx_h264enc.h \ 18 | gstomx_h263enc.c gstomx_h263enc.h \ 19 | gstomx_vorbisdec.c gstomx_vorbisdec.h \ 20 | gstomx_mp3dec.c gstomx_mp3dec.h \ 21 | gstomx_base_sink.c gstomx_base_sink.h \ 22 | gstomx_audiosink.c gstomx_audiosink.h \ 23 | gstomx_conf.c 24 | 25 | if EXPERIMENTAL 26 | libgstomx_la_SOURCES += gstomx_amrnbdec.c gstomx_amrnbdec.h \ 27 | gstomx_amrnbenc.c gstomx_amrnbenc.h \ 28 | gstomx_amrwbdec.c gstomx_amrwbdec.h \ 29 | gstomx_amrwbenc.c gstomx_amrwbenc.h \ 30 | gstomx_aacdec.c gstomx_aacdec.h \ 31 | gstomx_aacenc.c gstomx_aacenc.h \ 32 | gstomx_mp2dec.c gstomx_mp2dec.h \ 33 | gstomx_adpcmdec.c gstomx_adpcmdec.h \ 34 | gstomx_adpcmenc.c gstomx_adpcmenc.h \ 35 | gstomx_g711dec.c gstomx_g711dec.h \ 36 | gstomx_g711enc.c gstomx_g711enc.h \ 37 | gstomx_g729dec.c gstomx_g729dec.h \ 38 | gstomx_g729enc.c gstomx_g729enc.h \ 39 | gstomx_ilbcdec.c gstomx_ilbcdec.h \ 40 | gstomx_ilbcenc.c gstomx_ilbcenc.h \ 41 | gstomx_jpegenc.c gstomx_jpegenc.h \ 42 | gstomx_videosink.c gstomx_videosink.h \ 43 | gstomx_base_src.c gstomx_base_src.h \ 44 | gstomx_filereadersrc.c gstomx_filereadersrc.h 45 | endif 46 | 47 | libgstomx_la_CFLAGS = -I$(srcdir)/headers $(GST_CFLAGS) $(GST_BASE_CFLAGS) -I$(top_srcdir)/util 48 | libgstomx_la_LIBADD = $(GST_LIBS) $(GST_BASE_LIBS) $(top_builddir)/util/libutil.la 49 | libgstomx_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) 50 | 51 | EXTRA_DIST = headers gstomx.conf 52 | 53 | gstomx_conf.c: gstomx.conf 54 | echo "const char *default_config =" > $@ 55 | cat $^ | $(CPP) $(CFLAGS) $(libgstomx_la_CFLAGS) $(DEFAULT_INCLUDES) $(INCLUDES) - | grep -v "^#" | sed 's/^.*/\"&\\\n"/' >> $@ 56 | echo ";" >> $@ 57 | -------------------------------------------------------------------------------- /omx/gstomx.conf: -------------------------------------------------------------------------------- 1 | #include "config.h" 2 | 3 | /* in case of multiple OMX components mapping to a single gst-openmax element 4 | * class, a dynamic subclass can be created by specifying the gst-openmax 5 | * type as the 'parent-type' and specifying a new unique type name as the 6 | * 'type' parameter: 7 | */ 8 | omx_dummy, 9 | parent-type=GstOmxDummy, 10 | type=GstOmxDummyOne, 11 | library-name=libomxil-bellagio.so.0, 12 | component-name=OMX.bellagio.dummy, 13 | rank=0; 14 | 15 | /* for testing: */ 16 | omx_dummy_2, 17 | parent-type=GstOmxDummy, 18 | type=GstOmxDummyTwo, 19 | library-name=libomxil-bellagio.so.0, 20 | component-name=OMX.st.dummy2, 21 | rank=256; 22 | 23 | omx_mpeg4dec, 24 | type=GstOmxMpeg4Dec, 25 | library-name=libomxil-bellagio.so.0, 26 | component-name=OMX.st.video_decoder.mpeg4, 27 | rank=256; 28 | 29 | omx_h264dec, 30 | type=GstOmxH264Dec, 31 | library-name=libomxil-bellagio.so.0, 32 | component-name=OMX.st.video_decoder.avc, 33 | rank=256; 34 | 35 | omx_h263dec, 36 | type=GstOmxH263Dec, 37 | library-name=libomxil-bellagio.so.0, 38 | component-name=OMX.st.video_decoder.h263, 39 | rank=256; 40 | 41 | omx_wmvdec, 42 | type=GstOmxWmvDec, 43 | library-name=libomxil-bellagio.so.0, 44 | component-name=OMX.st.video_decoder.wmv, 45 | rank=256; 46 | 47 | omx_mpeg4enc, 48 | type=GstOmxMpeg4Enc, 49 | library-name=libomxil-bellagio.so.0, 50 | component-name=OMX.st.video_encoder.mpeg4, 51 | rank=256; 52 | 53 | omx_h264enc, 54 | type=GstOmxH264Enc, 55 | library-name=libomxil-bellagio.so.0, 56 | component-name=OMX.st.video_encoder.avc, 57 | rank=256; 58 | 59 | omx_h263enc, 60 | type=GstOmxH263Enc, 61 | library-name=libomxil-bellagio.so.0, 62 | component-name=OMX.st.video_encoder.h263, 63 | rank=256; 64 | 65 | omx_vorbisdec, 66 | type=GstOmxVorbisDec, 67 | library-name=libomxil-bellagio.so.0, 68 | component-name=OMX.st.audio_decoder.ogg.single, 69 | rank=128; 70 | 71 | omx_mp3dec, 72 | type=GstOmxMp3Dec, 73 | library-name=libomxil-bellagio.so.0, 74 | component-name=OMX.st.audio_decoder.mp3.mad, 75 | rank=256; 76 | 77 | #ifdef EXPERIMENTAL 78 | 79 | omx_mp2dec, 80 | type=GstOmxMp2Dec, 81 | library-name=libomxil-bellagio.so.0, 82 | component-name=OMX.st.audio_decoder.mp3.mad, 83 | rank=256; 84 | 85 | omx_amrnbdec, 86 | type=GstOmxAmrNbDec, 87 | library-name=libomxil-bellagio.so.0, 88 | component-name=OMX.st.audio_decoder.amrnb, 89 | rank=256; 90 | 91 | omx_amrnbenc, 92 | type=GstOmxAmrNbEnc, 93 | library-name=libomxil-bellagio.so.0, 94 | component-name=OMX.st.audio_encoder.amrnb, 95 | rank=256; 96 | 97 | omx_amrwbdec, 98 | type=GstOmxAmrWbDec, 99 | library-name=libomxil-bellagio.so.0, 100 | component-name=OMX.st.audio_decoder.amrwb, 101 | rank=256; 102 | 103 | omx_amrwbenc, 104 | type=GstOmxAmrWbEnc, 105 | library-name=libomxil-bellagio.so.0, 106 | component-name=OMX.st.audio_encoder.amrwb, 107 | rank=256; 108 | 109 | omx_aacdec, 110 | type=GstOmxAacDec, 111 | library-name=libomxil-bellagio.so.0, 112 | component-name=OMX.st.audio_decoder.aac, 113 | rank=256; 114 | 115 | omx_aacenc, 116 | type=GstOmxAacEnc, 117 | library-name=libomxil-bellagio.so.0, 118 | component-name=OMX.st.audio_encoder.aac, 119 | rank=256; 120 | 121 | omx_adpcmdec, 122 | type=GstOmxAdpcmDec, 123 | library-name=libomxil-bellagio.so.0, 124 | component-name=OMX.st.audio_decoder.adpcm, 125 | rank=256; 126 | 127 | omx_adpcmenc, 128 | type=GstOmxAdpcmEnc, 129 | library-name=libomxil-bellagio.so.0, 130 | component-name=OMX.st.audio_encoder.adpcm, 131 | rank=256; 132 | 133 | omx_g711dec, 134 | type=GstOmxG711Dec, 135 | library-name=libomxil-bellagio.so.0, 136 | component-name=OMX.st.audio_decoder.g711, 137 | rank=256; 138 | 139 | omx_g711enc, 140 | type=GstOmxG711Enc, 141 | library-name=libomxil-bellagio.so.0, 142 | component-name=OMX.st.audio_encoder.g711, 143 | rank=256; 144 | 145 | omx_g729dec, 146 | type=GstOmxG729Dec, 147 | library-name=libomxil-bellagio.so.0, 148 | component-name=OMX.st.audio_decoder.g729, 149 | rank=256; 150 | 151 | omx_g729enc, 152 | type=GstOmxG729Enc, 153 | library-name=libomxil-bellagio.so.0, 154 | component-name=OMX.st.audio_encoder.g729, 155 | rank=256; 156 | 157 | omx_ilbcdec, 158 | type=GstOmxIlbcDec, 159 | library-name=libomxil-bellagio.so.0, 160 | component-name=OMX.st.audio_decoder.ilbc, 161 | rank=256; 162 | 163 | omx_ilbcenc, 164 | type=GstOmxIlbcEnc, 165 | library-name=libomxil-bellagio.so.0, 166 | component-name=OMX.st.audio_encoder.ilbc, 167 | rank=256; 168 | 169 | omx_jpegenc, 170 | type=GstOmxJpegEnc, 171 | library-name=libomxil-bellagio.so.0, 172 | component-name=OMX.st.image_encoder.jpeg, 173 | rank=256; 174 | 175 | #endif /* EXPERIMENTAL */ 176 | 177 | omx_audiosink, 178 | type=GstOmxAudioSink, 179 | library-name=libomxil-bellagio.so.0, 180 | component-name=OMX.st.alsa.alsasink, 181 | rank=0; 182 | 183 | #ifdef EXPERIMENTAL 184 | 185 | omx_videosink, 186 | type=GstOmxVideoSink, 187 | library-name=libomxil-bellagio.so.0, 188 | component-name=OMX.st.videosink, 189 | rank=0; 190 | 191 | omx_filereadersrc, 192 | type=GstOmxFilereaderSrc, 193 | library-name=libomxil-bellagio.so.0, 194 | component-name=OMX.st.audio_filereader, 195 | rank=0; 196 | 197 | #endif /* EXPERIMENTAL */ 198 | 199 | omx_volume, 200 | type=GstOmxVolume, 201 | library-name=libomxil-bellagio.so.0, 202 | component-name=OMX.st.volume.component, 203 | rank=0; 204 | -------------------------------------------------------------------------------- /omx/gstomx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_H 23 | #define GSTOMX_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS GST_DEBUG_CATEGORY_EXTERN (gstomx_debug); 28 | GST_DEBUG_CATEGORY_EXTERN (gstomx_util_debug); 29 | #define GST_CAT_DEFAULT gstomx_debug 30 | 31 | enum 32 | { 33 | GSTOMX_ARG_0, 34 | ARG_COMPONENT_NAME, 35 | ARG_COMPONENT_ROLE, 36 | ARG_LIBRARY_NAME, 37 | GSTOMX_NUM_COMMON_PROP 38 | }; 39 | 40 | gboolean gstomx_get_component_info (void *core, GType type); 41 | 42 | void *gstomx_core_new (void *object, GType type); 43 | void gstomx_install_property_helper (GObjectClass * gobject_class); 44 | gboolean gstomx_get_property_helper (void *core, guint prop_id, GValue * value); 45 | 46 | G_END_DECLS 47 | #endif /* GSTOMX_H */ 48 | -------------------------------------------------------------------------------- /omx/gstomx_aacdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_aacdec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxAacDec, gst_omx_aacdec, GstOmxBaseAudioDec, 26 | GST_OMX_BASE_AUDIODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 35 | "width", G_TYPE_INT, 16, 36 | "depth", G_TYPE_INT, 16, 37 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 38 | "signed", G_TYPE_BOOLEAN, TRUE, 39 | "channels", GST_TYPE_INT_RANGE, 1, 6, NULL); 40 | 41 | return caps; 42 | } 43 | 44 | static GstCaps * 45 | generate_sink_template (void) 46 | { 47 | GstCaps *caps; 48 | GstStructure *struc; 49 | 50 | caps = gst_caps_new_empty (); 51 | 52 | struc = gst_structure_new ("audio/mpeg", 53 | "mpegversion", G_TYPE_INT, 4, 54 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 55 | "channels", GST_TYPE_INT_RANGE, 1, 6, NULL); 56 | 57 | { 58 | GValue list; 59 | GValue val; 60 | 61 | list.g_type = val.g_type = 0; 62 | 63 | g_value_init (&list, GST_TYPE_LIST); 64 | g_value_init (&val, G_TYPE_INT); 65 | 66 | g_value_set_int (&val, 2); 67 | gst_value_list_append_value (&list, &val); 68 | 69 | g_value_set_int (&val, 4); 70 | gst_value_list_append_value (&list, &val); 71 | 72 | gst_structure_set_value (struc, "mpegversion", &list); 73 | 74 | g_value_unset (&val); 75 | g_value_unset (&list); 76 | } 77 | 78 | gst_caps_append_structure (caps, struc); 79 | 80 | return caps; 81 | } 82 | 83 | static void 84 | type_base_init (gpointer g_class) 85 | { 86 | GstElementClass *element_class; 87 | 88 | element_class = GST_ELEMENT_CLASS (g_class); 89 | 90 | gst_element_class_set_details_simple (element_class, 91 | "OpenMAX IL AAC audio decoder", 92 | "Codec/Decoder/Audio", 93 | "Decodes audio in AAC format with OpenMAX IL", "Felipe Contreras"); 94 | 95 | { 96 | GstPadTemplate *template; 97 | 98 | template = gst_pad_template_new ("src", GST_PAD_SRC, 99 | GST_PAD_ALWAYS, generate_src_template ()); 100 | 101 | gst_element_class_add_pad_template (element_class, template); 102 | } 103 | 104 | { 105 | GstPadTemplate *template; 106 | 107 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 108 | GST_PAD_ALWAYS, generate_sink_template ()); 109 | 110 | gst_element_class_add_pad_template (element_class, template); 111 | } 112 | } 113 | 114 | static void 115 | type_class_init (gpointer g_class, gpointer class_data) 116 | { 117 | } 118 | 119 | static gboolean 120 | sink_setcaps (GstPad * pad, GstCaps * caps) 121 | { 122 | GstStructure *structure; 123 | GstOmxBaseFilter *omx_base; 124 | 125 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 126 | 127 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 128 | 129 | structure = gst_caps_get_structure (caps, 0); 130 | 131 | { 132 | const GValue *codec_data; 133 | GstBuffer *buffer; 134 | 135 | codec_data = gst_structure_get_value (structure, "codec_data"); 136 | if (codec_data) { 137 | buffer = gst_value_get_buffer (codec_data); 138 | omx_base->codec_data = buffer; 139 | gst_buffer_ref (buffer); 140 | } 141 | } 142 | 143 | return gst_pad_set_caps (pad, caps); 144 | } 145 | 146 | static void 147 | type_instance_init (GTypeInstance * instance, gpointer g_class) 148 | { 149 | GstOmxBaseFilter *omx_base; 150 | 151 | omx_base = GST_OMX_BASE_FILTER (instance); 152 | 153 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 154 | } 155 | -------------------------------------------------------------------------------- /omx/gstomx_aacdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AACDEC_H 23 | #define GSTOMX_AACDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AACDEC(obj) (GstOmxAacDec *) (obj) 29 | #define GST_OMX_AACDEC_TYPE (gst_omx_aacdec_get_type ()) 30 | typedef struct GstOmxAacDec GstOmxAacDec; 31 | typedef struct GstOmxAacDecClass GstOmxAacDecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxAacDec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxAacDecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_aacdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_AACDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_aacenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AACENC_H 23 | #define GSTOMX_AACENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AACENC(obj) (GstOmxAacEnc *) (obj) 29 | #define GST_OMX_AACENC_TYPE (gst_omx_aacenc_get_type ()) 30 | typedef struct GstOmxAacEnc GstOmxAacEnc; 31 | typedef struct GstOmxAacEncClass GstOmxAacEncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxAacEnc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | guint bitrate; 39 | gint profile; 40 | gint output_format; 41 | }; 42 | 43 | struct GstOmxAacEncClass 44 | { 45 | GstOmxBaseFilterClass parent_class; 46 | }; 47 | 48 | GType gst_omx_aacenc_get_type (void); 49 | 50 | G_END_DECLS 51 | #endif /* GSTOMX_AACENC_H */ 52 | -------------------------------------------------------------------------------- /omx/gstomx_adpcmdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_adpcmdec.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | /* should this class extend GstOmxBaseAudioDec? */ 27 | GSTOMX_BOILERPLATE (GstOmxAdpcmDec, gst_omx_adpcmdec, GstOmxBaseFilter, 28 | GST_OMX_BASE_FILTER_TYPE); 29 | 30 | static GstCaps * 31 | generate_src_template (void) 32 | { 33 | GstCaps *caps; 34 | 35 | caps = gst_caps_new_simple ("audio/x-raw-int", 36 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 37 | "width", G_TYPE_INT, 16, 38 | "depth", G_TYPE_INT, 16, 39 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 40 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 41 | 42 | return caps; 43 | } 44 | 45 | static GstCaps * 46 | generate_sink_template (void) 47 | { 48 | GstCaps *caps; 49 | 50 | caps = gst_caps_new_simple ("audio/x-adpcm", 51 | "layout", G_TYPE_STRING, "dvi", 52 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, "channels", G_TYPE_INT, 1, NULL); 53 | 54 | return caps; 55 | } 56 | 57 | static void 58 | type_base_init (gpointer g_class) 59 | { 60 | GstElementClass *element_class; 61 | 62 | element_class = GST_ELEMENT_CLASS (g_class); 63 | 64 | gst_element_class_set_details_simple (element_class, 65 | "OpenMAX IL ADPCM audio decoder", 66 | "Codec/Decoder/Audio", 67 | "Decodes audio in ADPCM format with OpenMAX IL", "Felipe Contreras"); 68 | 69 | { 70 | GstPadTemplate *template; 71 | 72 | template = gst_pad_template_new ("src", GST_PAD_SRC, 73 | GST_PAD_ALWAYS, generate_src_template ()); 74 | 75 | gst_element_class_add_pad_template (element_class, template); 76 | } 77 | 78 | { 79 | GstPadTemplate *template; 80 | 81 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 82 | GST_PAD_ALWAYS, generate_sink_template ()); 83 | 84 | gst_element_class_add_pad_template (element_class, template); 85 | } 86 | } 87 | 88 | static void 89 | type_class_init (gpointer g_class, gpointer class_data) 90 | { 91 | } 92 | 93 | static gboolean 94 | sink_setcaps (GstPad * pad, GstCaps * caps) 95 | { 96 | GstStructure *structure; 97 | GstOmxBaseFilter *omx_base; 98 | GOmxCore *gomx; 99 | gint rate = 0; 100 | 101 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 102 | gomx = (GOmxCore *) omx_base->gomx; 103 | 104 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 105 | 106 | structure = gst_caps_get_structure (caps, 0); 107 | 108 | gst_structure_get_int (structure, "rate", &rate); 109 | 110 | /* Input port configuration. */ 111 | { 112 | OMX_AUDIO_PARAM_PCMMODETYPE param; 113 | 114 | G_OMX_INIT_PARAM (param); 115 | 116 | param.nPortIndex = omx_base->out_port->port_index; 117 | OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 118 | 119 | param.nSamplingRate = rate; 120 | 121 | OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 122 | } 123 | 124 | /* set caps on the srcpad */ 125 | { 126 | GstCaps *tmp_caps; 127 | 128 | tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); 129 | tmp_caps = gst_caps_make_writable (tmp_caps); 130 | gst_caps_truncate (tmp_caps); 131 | 132 | gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); 133 | 134 | if (gst_caps_is_fixed (tmp_caps)) { 135 | GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); 136 | gst_pad_set_caps (omx_base->srcpad, tmp_caps); 137 | } 138 | 139 | gst_caps_unref (tmp_caps); 140 | } 141 | 142 | return gst_pad_set_caps (pad, caps); 143 | } 144 | 145 | static void 146 | type_instance_init (GTypeInstance * instance, gpointer g_class) 147 | { 148 | GstOmxBaseFilter *omx_base; 149 | 150 | omx_base = GST_OMX_BASE_FILTER (instance); 151 | 152 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 153 | } 154 | -------------------------------------------------------------------------------- /omx/gstomx_adpcmdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_ADPCMDEC_H 23 | #define GSTOMX_ADPCMDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_ADPCMDEC(obj) (GstOmxAdpcmDec *) (obj) 29 | #define GST_OMX_ADPCMDEC_TYPE (gst_omx_adpcmdec_get_type ()) 30 | typedef struct GstOmxAdpcmDec GstOmxAdpcmDec; 31 | typedef struct GstOmxAdpcmDecClass GstOmxAdpcmDecClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxAdpcmDec 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxAdpcmDecClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_adpcmdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_ADPCMDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_adpcmenc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_adpcmenc.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | GSTOMX_BOILERPLATE (GstOmxAdpcmEnc, gst_omx_adpcmenc, GstOmxBaseFilter, 27 | GST_OMX_BASE_FILTER_TYPE); 28 | 29 | static GstCaps * 30 | generate_src_template (void) 31 | { 32 | GstCaps *caps; 33 | 34 | caps = gst_caps_new_simple ("audio/x-adpcm", 35 | "layout", G_TYPE_STRING, "dvi", 36 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, "channels", G_TYPE_INT, 1, NULL); 37 | 38 | return caps; 39 | } 40 | 41 | static GstCaps * 42 | generate_sink_template (void) 43 | { 44 | GstCaps *caps; 45 | 46 | caps = gst_caps_new_simple ("audio/x-raw-int", 47 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 48 | "width", G_TYPE_INT, 16, 49 | "depth", G_TYPE_INT, 16, 50 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 51 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 52 | 53 | return caps; 54 | } 55 | 56 | static void 57 | type_base_init (gpointer g_class) 58 | { 59 | GstElementClass *element_class; 60 | 61 | element_class = GST_ELEMENT_CLASS (g_class); 62 | 63 | gst_element_class_set_details_simple (element_class, 64 | "OpenMAX IL ADPCM audio encoder", 65 | "Codec/Encoder/Audio", 66 | "Encodes audio in ADPCM format with OpenMAX IL", "Felipe Contreras"); 67 | 68 | { 69 | GstPadTemplate *template; 70 | 71 | template = gst_pad_template_new ("src", GST_PAD_SRC, 72 | GST_PAD_ALWAYS, generate_src_template ()); 73 | 74 | gst_element_class_add_pad_template (element_class, template); 75 | } 76 | 77 | { 78 | GstPadTemplate *template; 79 | 80 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 81 | GST_PAD_ALWAYS, generate_sink_template ()); 82 | 83 | gst_element_class_add_pad_template (element_class, template); 84 | } 85 | } 86 | 87 | static void 88 | type_class_init (gpointer g_class, gpointer class_data) 89 | { 90 | } 91 | 92 | static void 93 | settings_changed_cb (GOmxCore * core) 94 | { 95 | GstOmxBaseFilter *omx_base; 96 | guint rate; 97 | 98 | omx_base = core->object; 99 | 100 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 101 | 102 | { 103 | OMX_AUDIO_PARAM_ADPCMTYPE param; 104 | 105 | G_OMX_INIT_PARAM (param); 106 | 107 | param.nPortIndex = omx_base->out_port->port_index; 108 | OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioAdpcm, 109 | ¶m); 110 | 111 | rate = param.nSampleRate; 112 | } 113 | 114 | { 115 | GstCaps *new_caps; 116 | 117 | new_caps = gst_caps_new_simple ("audio/x-adpcm", 118 | "layout", G_TYPE_STRING, "dvi", 119 | "rate", G_TYPE_INT, rate, "channels", G_TYPE_INT, 1, NULL); 120 | 121 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 122 | gst_pad_set_caps (omx_base->srcpad, new_caps); 123 | } 124 | } 125 | 126 | static gboolean 127 | sink_setcaps (GstPad * pad, GstCaps * caps) 128 | { 129 | GstCaps *peer_caps; 130 | GstStructure *structure; 131 | GstOmxBaseFilter *omx_base; 132 | GOmxCore *gomx; 133 | gint rate = 0; 134 | gboolean ret = TRUE; 135 | 136 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 137 | gomx = (GOmxCore *) omx_base->gomx; 138 | 139 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 140 | 141 | peer_caps = gst_pad_peer_get_caps (omx_base->srcpad); 142 | 143 | g_return_val_if_fail (peer_caps, FALSE); 144 | 145 | GST_INFO_OBJECT (omx_base, "setcaps (sink): peercaps: %" GST_PTR_FORMAT, 146 | peer_caps); 147 | 148 | if (gst_caps_get_size (peer_caps) >= 1) { 149 | structure = gst_caps_get_structure (peer_caps, 0); 150 | 151 | gst_structure_get_int (structure, "rate", &rate); 152 | } else { 153 | structure = gst_caps_get_structure (caps, 0); 154 | 155 | gst_structure_get_int (structure, "rate", &rate); 156 | } 157 | 158 | /* Input port configuration. */ 159 | { 160 | OMX_AUDIO_PARAM_PCMMODETYPE param; 161 | 162 | G_OMX_INIT_PARAM (param); 163 | 164 | param.nPortIndex = omx_base->in_port->port_index; 165 | OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 166 | 167 | param.nSamplingRate = rate; 168 | 169 | OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 170 | } 171 | 172 | /* set caps on the srcpad */ 173 | { 174 | GstCaps *tmp_caps; 175 | GstStructure *tmp_structure; 176 | 177 | tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); 178 | tmp_caps = gst_caps_make_writable (tmp_caps); 179 | gst_caps_truncate (tmp_caps); 180 | 181 | tmp_structure = gst_caps_get_structure (tmp_caps, 0); 182 | gst_structure_fixate_field_nearest_int (tmp_structure, "rate", rate); 183 | gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); 184 | 185 | if (gst_caps_is_fixed (tmp_caps)) { 186 | GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); 187 | gst_pad_set_caps (omx_base->srcpad, tmp_caps); 188 | } 189 | 190 | gst_caps_unref (tmp_caps); 191 | } 192 | 193 | ret = gst_pad_set_caps (pad, caps); 194 | 195 | gst_caps_unref (peer_caps); 196 | 197 | return ret; 198 | } 199 | 200 | static void 201 | type_instance_init (GTypeInstance * instance, gpointer g_class) 202 | { 203 | GstOmxBaseFilter *omx_base; 204 | 205 | omx_base = GST_OMX_BASE_FILTER (instance); 206 | 207 | omx_base->gomx->settings_changed_cb = settings_changed_cb; 208 | 209 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 210 | } 211 | -------------------------------------------------------------------------------- /omx/gstomx_adpcmenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_ADPCMENC_H 23 | #define GSTOMX_ADPCMENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_ADPCMENC(obj) (GstOmxAdpcmEnc *) (obj) 29 | #define GST_OMX_ADPCMENC_TYPE (gst_omx_adpcmenc_get_type ()) 30 | typedef struct GstOmxAdpcmEnc GstOmxAdpcmEnc; 31 | typedef struct GstOmxAdpcmEncClass GstOmxAdpcmEncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxAdpcmEnc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxAdpcmEncClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_adpcmenc_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_ADPCMENC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_amrnbdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_amrnbdec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxAmrNbDec, gst_omx_amrnbdec, GstOmxBaseAudioDec, 26 | GST_OMX_BASE_AUDIODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 35 | "width", G_TYPE_INT, 16, 36 | "depth", G_TYPE_INT, 16, 37 | "rate", G_TYPE_INT, 8000, 38 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 39 | 40 | return caps; 41 | } 42 | 43 | static GstCaps * 44 | generate_sink_template (void) 45 | { 46 | GstCaps *caps; 47 | 48 | caps = gst_caps_new_simple ("audio/AMR", 49 | "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); 50 | 51 | return caps; 52 | } 53 | 54 | static void 55 | type_base_init (gpointer g_class) 56 | { 57 | GstElementClass *element_class; 58 | 59 | element_class = GST_ELEMENT_CLASS (g_class); 60 | 61 | gst_element_class_set_details_simple (element_class, 62 | "OpenMAX IL AMR-NB audio decoder", 63 | "Codec/Decoder/Audio", 64 | "Decodes audio in AMR-NB format with OpenMAX IL", "Felipe Contreras"); 65 | 66 | { 67 | GstPadTemplate *template; 68 | 69 | template = gst_pad_template_new ("src", GST_PAD_SRC, 70 | GST_PAD_ALWAYS, generate_src_template ()); 71 | 72 | gst_element_class_add_pad_template (element_class, template); 73 | } 74 | 75 | { 76 | GstPadTemplate *template; 77 | 78 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 79 | GST_PAD_ALWAYS, generate_sink_template ()); 80 | 81 | gst_element_class_add_pad_template (element_class, template); 82 | } 83 | } 84 | 85 | static void 86 | type_class_init (gpointer g_class, gpointer class_data) 87 | { 88 | } 89 | 90 | static void 91 | type_instance_init (GTypeInstance * instance, gpointer g_class) 92 | { 93 | } 94 | -------------------------------------------------------------------------------- /omx/gstomx_amrnbdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AMRNBDEC_H 23 | #define GSTOMX_AMRNBDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AMRNBDEC(obj) (GstOmxAmrNbDec *) (obj) 29 | #define GST_OMX_AMRNBDEC_TYPE (gst_omx_amrnbdec_get_type ()) 30 | typedef struct GstOmxAmrNbDec GstOmxAmrNbDec; 31 | typedef struct GstOmxAmrNbDecClass GstOmxAmrNbDecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxAmrNbDec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxAmrNbDecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_amrnbdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_AMRNBDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_amrnbenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AMRNBENC_H 23 | #define GSTOMX_AMRNBENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AMRNBENC(obj) (GstOmxAmrNbEnc *) (obj) 29 | #define GST_OMX_AMRNBENC_TYPE (gst_omx_amrnbenc_get_type ()) 30 | typedef struct GstOmxAmrNbEnc GstOmxAmrNbEnc; 31 | typedef struct GstOmxAmrNbEncClass GstOmxAmrNbEncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxAmrNbEnc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | guint bitrate; 39 | }; 40 | 41 | struct GstOmxAmrNbEncClass 42 | { 43 | GstOmxBaseFilterClass parent_class; 44 | }; 45 | 46 | GType gst_omx_amrnbenc_get_type (void); 47 | 48 | G_END_DECLS 49 | #endif /* GSTOMX_AMRNBENC_H */ 50 | -------------------------------------------------------------------------------- /omx/gstomx_amrwbdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_amrwbdec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxAmrWbDec, gst_omx_amrwbdec, GstOmxBaseAudioDec, 26 | GST_OMX_BASE_AUDIODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 35 | "width", G_TYPE_INT, 16, 36 | "depth", G_TYPE_INT, 16, 37 | "rate", G_TYPE_INT, 16000, 38 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 39 | 40 | return caps; 41 | } 42 | 43 | static GstCaps * 44 | generate_sink_template (void) 45 | { 46 | GstCaps *caps; 47 | 48 | caps = gst_caps_new_simple ("audio/AMR-WB", 49 | "rate", G_TYPE_INT, 16000, "channels", G_TYPE_INT, 1, NULL); 50 | 51 | return caps; 52 | } 53 | 54 | static void 55 | type_base_init (gpointer g_class) 56 | { 57 | GstElementClass *element_class; 58 | 59 | element_class = GST_ELEMENT_CLASS (g_class); 60 | 61 | gst_element_class_set_details_simple (element_class, 62 | "OpenMAX IL AMR-WB audio decoder", 63 | "Codec/Decoder/Audio", 64 | "Decodes audio in AMR-WB format with OpenMAX IL", "Felipe Contreras"); 65 | 66 | { 67 | GstPadTemplate *template; 68 | 69 | template = gst_pad_template_new ("src", GST_PAD_SRC, 70 | GST_PAD_ALWAYS, generate_src_template ()); 71 | 72 | gst_element_class_add_pad_template (element_class, template); 73 | } 74 | 75 | { 76 | GstPadTemplate *template; 77 | 78 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 79 | GST_PAD_ALWAYS, generate_sink_template ()); 80 | 81 | gst_element_class_add_pad_template (element_class, template); 82 | } 83 | } 84 | 85 | static void 86 | type_class_init (gpointer g_class, gpointer class_data) 87 | { 88 | } 89 | 90 | static void 91 | type_instance_init (GTypeInstance * instance, gpointer g_class) 92 | { 93 | } 94 | -------------------------------------------------------------------------------- /omx/gstomx_amrwbdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AMRWBDEC_H 23 | #define GSTOMX_AMRWBDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AMRWBDEC(obj) (GstOmxAmrWbDec *) (obj) 29 | #define GST_OMX_AMRWBDEC_TYPE (gst_omx_amrwbdec_get_type ()) 30 | typedef struct GstOmxAmrWbDec GstOmxAmrWbDec; 31 | typedef struct GstOmxAmrWbDecClass GstOmxAmrWbDecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxAmrWbDec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxAmrWbDecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_amrwbdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_AMRWBDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_amrwbenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AMRWBENC_H 23 | #define GSTOMX_AMRWBENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AMRWBENC(obj) (GstOmxAmrWbEnc *) (obj) 29 | #define GST_OMX_AMRWBENC_TYPE (gst_omx_amrwbenc_get_type ()) 30 | typedef struct GstOmxAmrWbEnc GstOmxAmrWbEnc; 31 | typedef struct GstOmxAmrWbEncClass GstOmxAmrWbEncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxAmrWbEnc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | guint bitrate; 39 | }; 40 | 41 | struct GstOmxAmrWbEncClass 42 | { 43 | GstOmxBaseFilterClass parent_class; 44 | }; 45 | 46 | GType gst_omx_amrwbenc_get_type (void); 47 | 48 | G_END_DECLS 49 | #endif /* GSTOMX_AMRWBENC_H */ 50 | -------------------------------------------------------------------------------- /omx/gstomx_audiosink.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_audiosink.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxAudioSink, gst_omx_audiosink, GstOmxBaseSink, 26 | GST_OMX_BASE_SINK_TYPE); 27 | 28 | static GstCaps * 29 | generate_sink_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 35 | "width", GST_TYPE_INT_RANGE, 8, 32, 36 | "depth", GST_TYPE_INT_RANGE, 8, 32, 37 | "rate", GST_TYPE_INT_RANGE, 8000, 48000, 38 | "signed", G_TYPE_BOOLEAN, TRUE, 39 | "channels", GST_TYPE_INT_RANGE, 1, 8, NULL); 40 | 41 | return caps; 42 | } 43 | 44 | static void 45 | type_base_init (gpointer g_class) 46 | { 47 | GstElementClass *element_class; 48 | 49 | element_class = GST_ELEMENT_CLASS (g_class); 50 | 51 | gst_element_class_set_details_simple (element_class, 52 | "OpenMAX IL audiosink element", 53 | "Sink/Audio", "Renders audio", "Felipe Contreras"); 54 | 55 | { 56 | GstPadTemplate *template; 57 | 58 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 59 | GST_PAD_ALWAYS, generate_sink_template ()); 60 | 61 | gst_element_class_add_pad_template (element_class, template); 62 | } 63 | } 64 | 65 | static gboolean 66 | setcaps (GstBaseSink * gst_sink, GstCaps * caps) 67 | { 68 | GstOmxBaseSink *self; 69 | GOmxCore *gomx; 70 | 71 | self = GST_OMX_BASE_SINK (gst_sink); 72 | gomx = (GOmxCore *) self->gomx; 73 | 74 | GST_INFO_OBJECT (self, "setcaps (sink): %" GST_PTR_FORMAT, caps); 75 | 76 | g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); 77 | 78 | { 79 | GstStructure *structure; 80 | gint channels; 81 | gint width; 82 | gint rate; 83 | gboolean is_signed; 84 | gboolean is_bigendian; 85 | 86 | structure = gst_caps_get_structure (caps, 0); 87 | 88 | gst_structure_get_int (structure, "channels", &channels); 89 | gst_structure_get_int (structure, "width", &width); 90 | gst_structure_get_int (structure, "rate", &rate); 91 | gst_structure_get_boolean (structure, "signed", &is_signed); 92 | { 93 | gint endianness; 94 | gst_structure_get_int (structure, "endianness", &endianness); 95 | is_bigendian = (endianness == 1234) ? FALSE : TRUE; 96 | } 97 | 98 | { 99 | OMX_AUDIO_PARAM_PCMMODETYPE param; 100 | 101 | G_OMX_INIT_PARAM (param); 102 | 103 | param.nPortIndex = self->in_port->port_index; 104 | OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 105 | 106 | param.nChannels = channels; 107 | param.eNumData = 108 | is_signed ? OMX_NumericalDataSigned : OMX_NumericalDataUnsigned; 109 | param.eEndian = is_bigendian ? OMX_EndianBig : OMX_EndianLittle; 110 | param.nBitPerSample = width; 111 | param.nSamplingRate = rate; 112 | 113 | OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 114 | } 115 | } 116 | 117 | return TRUE; 118 | } 119 | 120 | static void 121 | type_class_init (gpointer g_class, gpointer class_data) 122 | { 123 | GstBaseSinkClass *gst_base_sink_class; 124 | 125 | gst_base_sink_class = GST_BASE_SINK_CLASS (g_class); 126 | 127 | gst_base_sink_class->set_caps = setcaps; 128 | } 129 | 130 | static void 131 | type_instance_init (GTypeInstance * instance, gpointer g_class) 132 | { 133 | GstOmxBaseSink *omx_base; 134 | 135 | omx_base = GST_OMX_BASE_SINK (instance); 136 | 137 | GST_DEBUG_OBJECT (omx_base, "start"); 138 | } 139 | -------------------------------------------------------------------------------- /omx/gstomx_audiosink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_AUDIOSINK_H 23 | #define GSTOMX_AUDIOSINK_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_AUDIOSINK(obj) (GstOmxAudioSink *) (obj) 29 | #define GST_OMX_AUDIOSINK_TYPE (gst_omx_audiosink_get_type ()) 30 | typedef struct GstOmxAudioSink GstOmxAudioSink; 31 | typedef struct GstOmxAudioSinkClass GstOmxAudioSinkClass; 32 | 33 | #include "gstomx_base_sink.h" 34 | 35 | struct GstOmxAudioSink 36 | { 37 | GstOmxBaseSink omx_base; 38 | }; 39 | 40 | struct GstOmxAudioSinkClass 41 | { 42 | GstOmxBaseSinkClass parent_class; 43 | }; 44 | 45 | GType gst_omx_audiosink_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_AUDIOSINK_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_base_audiodec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 Texas Instruments, Inc. 3 | * 4 | * Author: Rob Clark 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_base_audiodec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxBaseAudioDec, gst_omx_base_audiodec, GstOmxBaseFilter, 26 | GST_OMX_BASE_FILTER_TYPE); 27 | 28 | static void 29 | type_base_init (gpointer g_class) 30 | { 31 | } 32 | 33 | static void 34 | type_class_init (gpointer g_class, gpointer class_data) 35 | { 36 | } 37 | 38 | static void 39 | settings_changed_cb (GOmxCore * core) 40 | { 41 | GstOmxBaseFilter *omx_base; 42 | guint rate; 43 | guint channels; 44 | 45 | omx_base = core->object; 46 | 47 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 48 | 49 | { 50 | OMX_AUDIO_PARAM_PCMMODETYPE param; 51 | 52 | G_OMX_INIT_PARAM (param); 53 | 54 | param.nPortIndex = omx_base->out_port->port_index; 55 | OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, 56 | ¶m); 57 | 58 | rate = param.nSamplingRate; 59 | channels = param.nChannels; 60 | if (rate == 0) { 61 | /** @todo: this shouldn't happen. */ 62 | GST_WARNING_OBJECT (omx_base, "Bad samplerate"); 63 | rate = 44100; 64 | } 65 | } 66 | 67 | { 68 | GstCaps *new_caps; 69 | 70 | new_caps = gst_caps_new_simple ("audio/x-raw-int", 71 | "width", G_TYPE_INT, 16, 72 | "depth", G_TYPE_INT, 16, 73 | "rate", G_TYPE_INT, rate, 74 | "signed", G_TYPE_BOOLEAN, TRUE, 75 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 76 | "channels", G_TYPE_INT, channels, NULL); 77 | 78 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 79 | gst_pad_set_caps (omx_base->srcpad, new_caps); 80 | } 81 | } 82 | 83 | static void 84 | type_instance_init (GTypeInstance * instance, gpointer g_class) 85 | { 86 | GstOmxBaseFilter *omx_base; 87 | 88 | omx_base = GST_OMX_BASE_FILTER (instance); 89 | 90 | GST_DEBUG_OBJECT (omx_base, "start"); 91 | 92 | omx_base->gomx->settings_changed_cb = settings_changed_cb; 93 | } 94 | -------------------------------------------------------------------------------- /omx/gstomx_base_audiodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2009 Texas Instruments, Inc. 3 | * 4 | * Author: Rob Clark 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_BASE_AUDIODEC_H 23 | #define GSTOMX_BASE_AUDIODEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_BASE_AUDIODEC(obj) (GstOmxBaseAudioDec *) (obj) 29 | #define GST_OMX_BASE_AUDIODEC_TYPE (gst_omx_base_audiodec_get_type ()) 30 | typedef struct GstOmxBaseAudioDec GstOmxBaseAudioDec; 31 | typedef struct GstOmxBaseAudioDecClass GstOmxBaseAudioDecClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxBaseAudioDec 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxBaseAudioDecClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_base_audiodec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_BASE_AUDIODEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_base_filter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_BASE_FILTER_H 23 | #define GSTOMX_BASE_FILTER_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_BASE_FILTER(obj) (GstOmxBaseFilter *) (obj) 29 | #define GST_OMX_BASE_FILTER_TYPE (gst_omx_base_filter_get_type ()) 30 | #define GST_OMX_BASE_FILTER_CLASS(obj) (GstOmxBaseFilterClass *) (obj) 31 | typedef struct GstOmxBaseFilter GstOmxBaseFilter; 32 | typedef struct GstOmxBaseFilterClass GstOmxBaseFilterClass; 33 | typedef void (*GstOmxBaseFilterCb) (GstOmxBaseFilter * self); 34 | 35 | #include "gstomx_util.h" 36 | #include 37 | 38 | struct GstOmxBaseFilter 39 | { 40 | GstElement element; 41 | 42 | GstPad *sinkpad; 43 | GstPad *srcpad; 44 | 45 | GOmxCore *gomx; 46 | GOmxPort *in_port; 47 | GOmxPort *out_port; 48 | 49 | gboolean use_timestamps; /** @todo remove; timestamps should always be used */ 50 | gboolean ready; 51 | GMutex *ready_lock; 52 | 53 | GstOmxBaseFilterCb omx_setup; 54 | GstFlowReturn last_pad_push_return; 55 | GstBuffer *codec_data; 56 | 57 | /** @todo these are hacks, OpenMAX IL spec should be revised. */ 58 | gboolean share_input_buffer; 59 | gboolean share_output_buffer; 60 | }; 61 | 62 | struct GstOmxBaseFilterClass 63 | { 64 | GstElementClass parent_class; 65 | }; 66 | 67 | GType gst_omx_base_filter_get_type (void); 68 | 69 | G_END_DECLS 70 | #endif /* GSTOMX_BASE_FILTER_H */ 71 | -------------------------------------------------------------------------------- /omx/gstomx_base_sink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_BASE_SINK_H 23 | #define GSTOMX_BASE_SINK_H 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | #define GST_OMX_BASE_SINK(obj) (GstOmxBaseSink *) (obj) 30 | #define GST_OMX_BASE_SINK_TYPE (gst_omx_base_sink_get_type ()) 31 | #define GST_OMX_BASE_SINK_CLASS(obj) (GstOmxBaseSinkClass *) (obj) 32 | typedef struct GstOmxBaseSink GstOmxBaseSink; 33 | typedef struct GstOmxBaseSinkClass GstOmxBaseSinkClass; 34 | typedef void (*GstOmxBaseSinkCb) (GstOmxBaseSink * self); 35 | 36 | #include 37 | 38 | struct GstOmxBaseSink 39 | { 40 | GstBaseSink element; 41 | 42 | GstPad *sinkpad; 43 | 44 | GOmxCore *gomx; 45 | GOmxPort *in_port; 46 | 47 | gboolean ready; 48 | GstPadActivateModeFunction base_activatepush; 49 | gboolean initialized; 50 | }; 51 | 52 | struct GstOmxBaseSinkClass 53 | { 54 | GstBaseSinkClass parent_class; 55 | }; 56 | 57 | GType gst_omx_base_sink_get_type (void); 58 | 59 | G_END_DECLS 60 | #endif /* GSTOMX_BASE_SINK_H */ 61 | -------------------------------------------------------------------------------- /omx/gstomx_base_src.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_BASE_SRC_H 23 | #define GSTOMX_BASE_SRC_H 24 | 25 | #include 26 | #include 27 | 28 | G_BEGIN_DECLS 29 | #define GST_OMX_BASE_SRC(obj) (GstOmxBaseSrc *) (obj) 30 | #define GST_OMX_BASE_SRC_TYPE (gst_omx_base_src_get_type ()) 31 | #define GST_OMX_BASE_SRC_CLASS(obj) (GstOmxBaseSrcClass *) (obj) 32 | typedef struct GstOmxBaseSrc GstOmxBaseSrc; 33 | typedef struct GstOmxBaseSrcClass GstOmxBaseSrcClass; 34 | typedef void (*GstOmxBaseSrcCb) (GstOmxBaseSrc * self); 35 | 36 | #include 37 | 38 | struct GstOmxBaseSrc 39 | { 40 | GstBaseSrc element; 41 | 42 | GOmxCore *gomx; 43 | GOmxPort *out_port; 44 | 45 | GstOmxBaseSrcCb setup_ports; 46 | }; 47 | 48 | struct GstOmxBaseSrcClass 49 | { 50 | GstBaseSrcClass parent_class; 51 | }; 52 | 53 | GType gst_omx_base_src_get_type (void); 54 | 55 | G_END_DECLS 56 | #endif /* GSTOMX_BASE_SRC_H */ 57 | -------------------------------------------------------------------------------- /omx/gstomx_base_videodec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_BASE_VIDEODEC_H 23 | #define GSTOMX_BASE_VIDEODEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_BASE_VIDEODEC(obj) (GstOmxBaseVideoDec *) (obj) 29 | #define GST_OMX_BASE_VIDEODEC_TYPE (gst_omx_base_videodec_get_type ()) 30 | #define GST_OMX_BASE_VIDEODEC_CLASS(c) (G_TYPE_CHECK_CLASS_CAST ((c), GST_OMX_BASE_VIDEODEC_TYPE, GstOmxBaseVideoDecClass)) 31 | typedef struct GstOmxBaseVideoDec GstOmxBaseVideoDec; 32 | typedef struct GstOmxBaseVideoDecClass GstOmxBaseVideoDecClass; 33 | 34 | #include "gstomx_base_filter.h" 35 | 36 | struct GstOmxBaseVideoDec 37 | { 38 | GstOmxBaseFilter omx_base; 39 | 40 | OMX_VIDEO_CODINGTYPE compression_format; 41 | gint framerate_num; 42 | gint framerate_denom; 43 | }; 44 | 45 | struct GstOmxBaseVideoDecClass 46 | { 47 | GstOmxBaseFilterClass parent_class; 48 | }; 49 | 50 | GType gst_omx_base_videodec_get_type (void); 51 | 52 | G_END_DECLS 53 | #endif /* GSTOMX_BASE_VIDEODEC_H */ 54 | -------------------------------------------------------------------------------- /omx/gstomx_base_videoenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_BASE_VIDEOENC_H 23 | #define GSTOMX_BASE_VIDEOENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_BASE_VIDEOENC(obj) (GstOmxBaseVideoEnc *) (obj) 29 | #define GST_OMX_BASE_VIDEOENC_TYPE (gst_omx_base_videoenc_get_type ()) 30 | typedef struct GstOmxBaseVideoEnc GstOmxBaseVideoEnc; 31 | typedef struct GstOmxBaseVideoEncClass GstOmxBaseVideoEncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxBaseVideoEnc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | 39 | OMX_VIDEO_CODINGTYPE compression_format; 40 | guint bitrate; 41 | gint framerate_num; 42 | gint framerate_denom; 43 | }; 44 | 45 | struct GstOmxBaseVideoEncClass 46 | { 47 | GstOmxBaseFilterClass parent_class; 48 | }; 49 | 50 | GType gst_omx_base_videoenc_get_type (void); 51 | 52 | G_END_DECLS 53 | #endif /* GSTOMX_BASE_VIDEOENC_H */ 54 | -------------------------------------------------------------------------------- /omx/gstomx_dummy.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_dummy.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | GSTOMX_BOILERPLATE (GstOmxDummy, gst_omx_dummy, GstOmxBaseFilter, 27 | GST_OMX_BASE_FILTER_TYPE); 28 | 29 | static GstCaps * 30 | generate_src_template (void) 31 | { 32 | GstCaps *caps; 33 | 34 | caps = gst_caps_new_any (); 35 | 36 | return caps; 37 | } 38 | 39 | static GstCaps * 40 | generate_sink_template (void) 41 | { 42 | GstCaps *caps; 43 | 44 | caps = gst_caps_new_any (); 45 | 46 | return caps; 47 | } 48 | 49 | static void 50 | type_base_init (gpointer g_class) 51 | { 52 | GstElementClass *element_class; 53 | 54 | element_class = GST_ELEMENT_CLASS (g_class); 55 | 56 | gst_element_class_set_details_simple (element_class, 57 | "OpenMAX IL dummy element", "None", "Does nothing", "Felipe Contreras"); 58 | 59 | { 60 | GstPadTemplate *template; 61 | 62 | template = gst_pad_template_new ("src", GST_PAD_SRC, 63 | GST_PAD_ALWAYS, generate_src_template ()); 64 | 65 | gst_element_class_add_pad_template (element_class, template); 66 | } 67 | 68 | { 69 | GstPadTemplate *template; 70 | 71 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 72 | GST_PAD_ALWAYS, generate_sink_template ()); 73 | 74 | gst_element_class_add_pad_template (element_class, template); 75 | } 76 | } 77 | 78 | static void 79 | type_class_init (gpointer g_class, gpointer class_data) 80 | { 81 | } 82 | 83 | static void 84 | type_instance_init (GTypeInstance * instance, gpointer g_class) 85 | { 86 | GstOmxBaseFilter *omx_base; 87 | 88 | omx_base = GST_OMX_BASE_FILTER (instance); 89 | 90 | GST_DEBUG_OBJECT (omx_base, "start"); 91 | } 92 | -------------------------------------------------------------------------------- /omx/gstomx_dummy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_DUMMY_H 23 | #define GSTOMX_DUMMY_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_DUMMY(obj) (GstOmxDummy *) (obj) 29 | #define GST_OMX_DUMMY_TYPE (gst_omx_dummy_get_type ()) 30 | typedef struct GstOmxDummy GstOmxDummy; 31 | typedef struct GstOmxDummyClass GstOmxDummyClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxDummy 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxDummyClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_dummy_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_DUMMY_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_filereadersrc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_filereadersrc.h" 23 | #include "gstomx_base_src.h" 24 | #include "gstomx.h" 25 | 26 | enum 27 | { 28 | ARG_0, 29 | ARG_FILE_NAME, 30 | }; 31 | 32 | GSTOMX_BOILERPLATE (GstOmxFilereaderSrc, gst_omx_filereadersrc, GstOmxBaseSrc, 33 | GST_OMX_BASE_SRC_TYPE); 34 | 35 | static GstCaps * 36 | generate_src_template (void) 37 | { 38 | GstCaps *caps; 39 | 40 | caps = gst_caps_new_any (); 41 | 42 | return caps; 43 | } 44 | 45 | static void 46 | type_base_init (gpointer g_class) 47 | { 48 | GstElementClass *element_class; 49 | 50 | element_class = GST_ELEMENT_CLASS (g_class); 51 | 52 | gst_element_class_set_details_simple (element_class, 53 | "OpenMAX IL filereader src element", 54 | "None", "Does nothing", "Felipe Contreras"); 55 | 56 | { 57 | GstPadTemplate *template; 58 | 59 | template = gst_pad_template_new ("src", GST_PAD_SRC, 60 | GST_PAD_ALWAYS, generate_src_template ()); 61 | 62 | gst_element_class_add_pad_template (element_class, template); 63 | } 64 | } 65 | 66 | static gboolean 67 | setcaps (GstBaseSrc * gst_src, GstCaps * caps) 68 | { 69 | GstOmxBaseSrc *self; 70 | 71 | self = GST_OMX_BASE_SRC (gst_src); 72 | 73 | GST_INFO_OBJECT (self, "setcaps (src): %" GST_PTR_FORMAT, caps); 74 | 75 | g_return_val_if_fail (gst_caps_get_size (caps) == 1, FALSE); 76 | 77 | return TRUE; 78 | } 79 | 80 | static void 81 | settings_changed_cb (GOmxCore * core) 82 | { 83 | GstOmxBaseSrc *omx_base; 84 | 85 | omx_base = core->object; 86 | 87 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 88 | 89 | /** @todo properly set the capabilities */ 90 | } 91 | 92 | static void 93 | setup_ports (GstOmxBaseSrc * base_src) 94 | { 95 | GOmxCore *gomx; 96 | GstOmxFilereaderSrc *self; 97 | 98 | self = GST_OMX_FILEREADERSRC (base_src); 99 | gomx = base_src->gomx; 100 | 101 | /* This is specific for Bellagio. */ 102 | { 103 | OMX_INDEXTYPE index; 104 | OMX_GetExtensionIndex (gomx->omx_handle, 105 | "OMX.ST.index.param.filereader.inputfilename", &index); 106 | OMX_SetParameter (gomx->omx_handle, index, self->file_name); 107 | } 108 | } 109 | 110 | static void 111 | set_property (GObject * obj, 112 | guint prop_id, const GValue * value, GParamSpec * pspec) 113 | { 114 | GstOmxFilereaderSrc *self; 115 | 116 | self = GST_OMX_FILEREADERSRC (obj); 117 | 118 | switch (prop_id) { 119 | case ARG_FILE_NAME: 120 | if (self->file_name) { 121 | g_free (self->file_name); 122 | } 123 | self->file_name = g_value_dup_string (value); 124 | break; 125 | default: 126 | G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); 127 | break; 128 | } 129 | } 130 | 131 | static void 132 | get_property (GObject * obj, guint prop_id, GValue * value, GParamSpec * pspec) 133 | { 134 | GstOmxFilereaderSrc *self; 135 | 136 | self = GST_OMX_FILEREADERSRC (obj); 137 | 138 | switch (prop_id) { 139 | case ARG_FILE_NAME: 140 | g_value_set_string (value, self->file_name); 141 | break; 142 | default: 143 | G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec); 144 | break; 145 | } 146 | } 147 | 148 | static void 149 | type_class_init (gpointer g_class, gpointer class_data) 150 | { 151 | GstBaseSrcClass *gst_base_src_class; 152 | GObjectClass *gobject_class; 153 | 154 | gst_base_src_class = GST_BASE_SRC_CLASS (g_class); 155 | gobject_class = G_OBJECT_CLASS (g_class); 156 | 157 | gst_base_src_class->set_caps = setcaps; 158 | 159 | /* Properties stuff */ 160 | { 161 | gobject_class->set_property = set_property; 162 | gobject_class->get_property = get_property; 163 | 164 | g_object_class_install_property (gobject_class, ARG_FILE_NAME, 165 | g_param_spec_string ("file-name", "File name", 166 | "The input filename to use", 167 | NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); 168 | } 169 | } 170 | 171 | static void 172 | type_instance_init (GTypeInstance * instance, gpointer g_class) 173 | { 174 | GstOmxBaseSrc *omx_base; 175 | 176 | omx_base = GST_OMX_BASE_SRC (instance); 177 | 178 | GST_DEBUG_OBJECT (omx_base, "begin"); 179 | 180 | omx_base->setup_ports = setup_ports; 181 | 182 | omx_base->gomx->settings_changed_cb = settings_changed_cb; 183 | 184 | GST_DEBUG_OBJECT (omx_base, "end"); 185 | } 186 | -------------------------------------------------------------------------------- /omx/gstomx_filereadersrc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_FILEREADERSRC_H 23 | #define GSTOMX_FILEREADERSRC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_FILEREADERSRC(obj) (GstOmxFilereaderSrc *) (obj) 29 | #define GST_OMX_FILEREADERSRC_TYPE (gst_omx_filereadersrc_get_type ()) 30 | typedef struct GstOmxFilereaderSrc GstOmxFilereaderSrc; 31 | typedef struct GstOmxFilereaderSrcClass GstOmxFilereaderSrcClass; 32 | 33 | #include "gstomx_base_src.h" 34 | 35 | struct GstOmxFilereaderSrc 36 | { 37 | GstOmxBaseSrc omx_base; 38 | 39 | char *file_name; /**< The input file name. */ 40 | }; 41 | 42 | struct GstOmxFilereaderSrcClass 43 | { 44 | GstOmxBaseSrcClass parent_class; 45 | }; 46 | 47 | GType gst_omx_filereadersrc_get_type (void); 48 | 49 | G_END_DECLS 50 | #endif /* GSTOMX_FILEREADERSRC_H */ 51 | -------------------------------------------------------------------------------- /omx/gstomx_g711dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_g711dec.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | #include /* for strcmp */ 27 | 28 | /* should this class extend GstOmxBaseAudioDec? */ 29 | GSTOMX_BOILERPLATE (GstOmxG711Dec, gst_omx_g711dec, GstOmxBaseFilter, 30 | GST_OMX_BASE_FILTER_TYPE); 31 | 32 | static GstCaps * 33 | generate_src_template (void) 34 | { 35 | GstCaps *caps; 36 | 37 | caps = gst_caps_new_simple ("audio/x-raw-int", 38 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 39 | "width", G_TYPE_INT, 16, 40 | "depth", G_TYPE_INT, 16, 41 | "rate", G_TYPE_INT, 8000, 42 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 43 | 44 | return caps; 45 | } 46 | 47 | static GstCaps * 48 | generate_sink_template (void) 49 | { 50 | GstCaps *caps; 51 | GstStructure *struc; 52 | 53 | caps = gst_caps_new_empty (); 54 | 55 | struc = gst_structure_new ("audio/x-alaw", 56 | "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); 57 | 58 | gst_caps_append_structure (caps, struc); 59 | 60 | struc = gst_structure_new ("audio/x-mulaw", 61 | "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); 62 | 63 | gst_caps_append_structure (caps, struc); 64 | 65 | return caps; 66 | } 67 | 68 | static void 69 | type_base_init (gpointer g_class) 70 | { 71 | GstElementClass *element_class; 72 | 73 | element_class = GST_ELEMENT_CLASS (g_class); 74 | 75 | gst_element_class_set_details_simple (element_class, 76 | "OpenMAX IL G.711 audio decoder", 77 | "Codec/Decoder/Audio", 78 | "Decodes audio in G.711 format with OpenMAX IL", "Felipe Contreras"); 79 | 80 | { 81 | GstPadTemplate *template; 82 | 83 | template = gst_pad_template_new ("src", GST_PAD_SRC, 84 | GST_PAD_ALWAYS, generate_src_template ()); 85 | 86 | gst_element_class_add_pad_template (element_class, template); 87 | } 88 | 89 | { 90 | GstPadTemplate *template; 91 | 92 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 93 | GST_PAD_ALWAYS, generate_sink_template ()); 94 | 95 | gst_element_class_add_pad_template (element_class, template); 96 | } 97 | } 98 | 99 | static void 100 | type_class_init (gpointer g_class, gpointer class_data) 101 | { 102 | } 103 | 104 | static gboolean 105 | sink_setcaps (GstPad * pad, GstCaps * caps) 106 | { 107 | GstStructure *structure; 108 | GstOmxBaseFilter *omx_base; 109 | GOmxCore *gomx; 110 | const gchar *mode; 111 | gboolean ret = TRUE; 112 | 113 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 114 | gomx = (GOmxCore *) omx_base->gomx; 115 | 116 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 117 | 118 | structure = gst_caps_get_structure (caps, 0); 119 | 120 | mode = gst_structure_get_name (structure); 121 | 122 | /* Output port configuration. */ 123 | { 124 | OMX_AUDIO_PARAM_PCMMODETYPE param; 125 | 126 | G_OMX_INIT_PARAM (param); 127 | 128 | param.nPortIndex = omx_base->in_port->port_index; 129 | OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 130 | 131 | if (strcmp (mode, "audio/x-alaw") == 0) 132 | param.ePCMMode = OMX_AUDIO_PCMModeALaw; 133 | else if (strcmp (mode, "audio/x-mulaw") == 0) 134 | param.ePCMMode = OMX_AUDIO_PCMModeMULaw; 135 | 136 | OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 137 | } 138 | 139 | /* set caps on the srcpad */ 140 | { 141 | GstCaps *tmp_caps; 142 | 143 | tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); 144 | tmp_caps = gst_caps_make_writable (tmp_caps); 145 | gst_caps_truncate (tmp_caps); 146 | 147 | gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); 148 | 149 | if (gst_caps_is_fixed (tmp_caps)) { 150 | GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); 151 | gst_pad_set_caps (omx_base->srcpad, tmp_caps); 152 | } 153 | 154 | gst_caps_unref (tmp_caps); 155 | } 156 | 157 | ret = gst_pad_set_caps (pad, caps); 158 | 159 | return ret; 160 | } 161 | 162 | static void 163 | type_instance_init (GTypeInstance * instance, gpointer g_class) 164 | { 165 | GstOmxBaseFilter *omx_base; 166 | 167 | omx_base = GST_OMX_BASE_FILTER (instance); 168 | 169 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 170 | } 171 | -------------------------------------------------------------------------------- /omx/gstomx_g711dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_G711DEC_H 23 | #define GSTOMX_G711DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_G711DEC(obj) (GstOmxG711Dec *) (obj) 29 | #define GST_OMX_G711DEC_TYPE (gst_omx_g711dec_get_type ()) 30 | typedef struct GstOmxG711Dec GstOmxG711Dec; 31 | typedef struct GstOmxG711DecClass GstOmxG711DecClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxG711Dec 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxG711DecClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_g711dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_G711DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_g711enc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_g711enc.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | #include /* for strcmp */ 27 | 28 | GSTOMX_BOILERPLATE (GstOmxG711Enc, gst_omx_g711enc, GstOmxBaseFilter, 29 | GST_OMX_BASE_FILTER_TYPE); 30 | 31 | static GstCaps * 32 | generate_src_template (void) 33 | { 34 | GstCaps *caps; 35 | GstStructure *struc; 36 | 37 | caps = gst_caps_new_empty (); 38 | 39 | struc = gst_structure_new ("audio/x-alaw", 40 | "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); 41 | 42 | gst_caps_append_structure (caps, struc); 43 | 44 | struc = gst_structure_new ("audio/x-mulaw", 45 | "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); 46 | 47 | gst_caps_append_structure (caps, struc); 48 | 49 | return caps; 50 | } 51 | 52 | static GstCaps * 53 | generate_sink_template (void) 54 | { 55 | GstCaps *caps; 56 | 57 | caps = gst_caps_new_simple ("audio/x-raw-int", 58 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 59 | "width", G_TYPE_INT, 16, 60 | "depth", G_TYPE_INT, 16, 61 | "rate", G_TYPE_INT, 8000, 62 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 63 | 64 | return caps; 65 | } 66 | 67 | static void 68 | type_base_init (gpointer g_class) 69 | { 70 | GstElementClass *element_class; 71 | 72 | element_class = GST_ELEMENT_CLASS (g_class); 73 | 74 | gst_element_class_set_details_simple (element_class, 75 | "OpenMAX IL G.711 audio encoder", 76 | "Codec/Encoder/Audio", 77 | "Encodes audio in G.711 format with OpenMAX IL", "Felipe Contreras"); 78 | 79 | { 80 | GstPadTemplate *template; 81 | 82 | template = gst_pad_template_new ("src", GST_PAD_SRC, 83 | GST_PAD_ALWAYS, generate_src_template ()); 84 | 85 | gst_element_class_add_pad_template (element_class, template); 86 | } 87 | 88 | { 89 | GstPadTemplate *template; 90 | 91 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 92 | GST_PAD_ALWAYS, generate_sink_template ()); 93 | 94 | gst_element_class_add_pad_template (element_class, template); 95 | } 96 | } 97 | 98 | static void 99 | type_class_init (gpointer g_class, gpointer class_data) 100 | { 101 | } 102 | 103 | static gboolean 104 | sink_setcaps (GstPad * pad, GstCaps * caps) 105 | { 106 | GstCaps *peer_caps; 107 | GstStructure *structure; 108 | GstOmxBaseFilter *omx_base; 109 | GOmxCore *gomx; 110 | const gchar *mode; 111 | gboolean ret = TRUE; 112 | 113 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 114 | gomx = (GOmxCore *) omx_base->gomx; 115 | 116 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 117 | 118 | peer_caps = gst_pad_peer_get_caps (omx_base->srcpad); 119 | 120 | g_return_val_if_fail (peer_caps, FALSE); 121 | 122 | GST_INFO_OBJECT (omx_base, "setcaps (sink): peercaps: %" GST_PTR_FORMAT, 123 | peer_caps); 124 | 125 | if (gst_caps_get_size (peer_caps) == 0) 126 | goto leave; 127 | 128 | structure = gst_caps_get_structure (peer_caps, 0); 129 | 130 | mode = gst_structure_get_name (structure); 131 | 132 | /* Output port configuration. */ 133 | { 134 | OMX_AUDIO_PARAM_PCMMODETYPE param; 135 | 136 | G_OMX_INIT_PARAM (param); 137 | 138 | param.nPortIndex = omx_base->out_port->port_index; 139 | OMX_GetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 140 | 141 | if (strcmp (mode, "audio/x-alaw") == 0) 142 | param.ePCMMode = OMX_AUDIO_PCMModeALaw; 143 | else if (strcmp (mode, "audio/x-mulaw") == 0) 144 | param.ePCMMode = OMX_AUDIO_PCMModeMULaw; 145 | 146 | OMX_SetParameter (gomx->omx_handle, OMX_IndexParamAudioPcm, ¶m); 147 | } 148 | 149 | leave: 150 | 151 | /* set caps on the srcpad */ 152 | { 153 | GstCaps *tmp_caps; 154 | 155 | tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); 156 | tmp_caps = gst_caps_make_writable (tmp_caps); 157 | gst_caps_truncate (tmp_caps); 158 | 159 | gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); 160 | 161 | if (gst_caps_is_fixed (tmp_caps)) { 162 | GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); 163 | gst_pad_set_caps (omx_base->srcpad, tmp_caps); 164 | } 165 | 166 | gst_caps_unref (tmp_caps); 167 | } 168 | 169 | ret = gst_pad_set_caps (pad, caps); 170 | 171 | gst_caps_unref (peer_caps); 172 | 173 | return ret; 174 | } 175 | 176 | static void 177 | type_instance_init (GTypeInstance * instance, gpointer g_class) 178 | { 179 | GstOmxBaseFilter *omx_base; 180 | 181 | omx_base = GST_OMX_BASE_FILTER (instance); 182 | 183 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 184 | } 185 | -------------------------------------------------------------------------------- /omx/gstomx_g711enc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_G711ENC_H 23 | #define GSTOMX_G711ENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_G711ENC(obj) (GstOmxG711Enc *) (obj) 29 | #define GST_OMX_G711ENC_TYPE (gst_omx_g711enc_get_type ()) 30 | typedef struct GstOmxG711Enc GstOmxG711Enc; 31 | typedef struct GstOmxG711EncClass GstOmxG711EncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxG711Enc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxG711EncClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_g711enc_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_G711ENC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_g729dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_g729dec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxG729Dec, gst_omx_g729dec, GstOmxBaseAudioDec, 26 | GST_OMX_BASE_AUDIODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 35 | "width", G_TYPE_INT, 16, 36 | "depth", G_TYPE_INT, 16, 37 | "rate", G_TYPE_INT, 8000, 38 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 39 | 40 | return caps; 41 | } 42 | 43 | static GstCaps * 44 | generate_sink_template (void) 45 | { 46 | GstCaps *caps; 47 | GstStructure *struc; 48 | 49 | caps = gst_caps_new_empty (); 50 | 51 | struc = gst_structure_new ("audio/G729", 52 | "rate", G_TYPE_INT, 8000, "channels", G_TYPE_INT, 1, NULL); 53 | 54 | gst_caps_append_structure (caps, struc); 55 | 56 | return caps; 57 | } 58 | 59 | static void 60 | type_base_init (gpointer g_class) 61 | { 62 | GstElementClass *element_class; 63 | 64 | element_class = GST_ELEMENT_CLASS (g_class); 65 | 66 | gst_element_class_set_details_simple (element_class, 67 | "OpenMAX IL G.729 audio decoder", 68 | "Codec/Decoder/Audio", 69 | "Decodes audio in G.729 format with OpenMAX IL", "Felipe Contreras"); 70 | 71 | { 72 | GstPadTemplate *template; 73 | 74 | template = gst_pad_template_new ("src", GST_PAD_SRC, 75 | GST_PAD_ALWAYS, generate_src_template ()); 76 | 77 | gst_element_class_add_pad_template (element_class, template); 78 | } 79 | 80 | { 81 | GstPadTemplate *template; 82 | 83 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 84 | GST_PAD_ALWAYS, generate_sink_template ()); 85 | 86 | gst_element_class_add_pad_template (element_class, template); 87 | } 88 | } 89 | 90 | static void 91 | type_class_init (gpointer g_class, gpointer class_data) 92 | { 93 | } 94 | 95 | /* should we be overriding the settings_changed_cb from parent class like this?? */ 96 | static void 97 | settings_changed_cb (GOmxCore * core) 98 | { 99 | GstOmxBaseFilter *omx_base; 100 | 101 | omx_base = core->object; 102 | 103 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 104 | 105 | { 106 | GstCaps *new_caps; 107 | 108 | new_caps = gst_caps_new_simple ("audio/x-raw-int", 109 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 110 | "width", G_TYPE_INT, 16, 111 | "depth", G_TYPE_INT, 16, 112 | "rate", G_TYPE_INT, 8000, 113 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 114 | 115 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 116 | gst_pad_set_caps (omx_base->srcpad, new_caps); 117 | } 118 | } 119 | 120 | static void 121 | type_instance_init (GTypeInstance * instance, gpointer g_class) 122 | { 123 | GstOmxBaseFilter *omx_base; 124 | 125 | omx_base = GST_OMX_BASE_FILTER (instance); 126 | 127 | omx_base->gomx->settings_changed_cb = settings_changed_cb; 128 | } 129 | -------------------------------------------------------------------------------- /omx/gstomx_g729dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_G729DEC_H 23 | #define GSTOMX_G729DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_G729DEC(obj) (GstOmxG729Dec *) (obj) 29 | #define GST_OMX_G729DEC_TYPE (gst_omx_g729dec_get_type ()) 30 | typedef struct GstOmxG729Dec GstOmxG729Dec; 31 | typedef struct GstOmxG729DecClass GstOmxG729DecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxG729Dec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxG729DecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_g729dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_G729DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_g729enc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_G729ENC_H 23 | #define GSTOMX_G729ENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_G729ENC(obj) (GstOmxG729Enc *) (obj) 29 | #define GST_OMX_G729ENC_TYPE (gst_omx_g729enc_get_type ()) 30 | typedef struct GstOmxG729Enc GstOmxG729Enc; 31 | typedef struct GstOmxG729EncClass GstOmxG729EncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxG729Enc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | gboolean dtx; 39 | }; 40 | 41 | struct GstOmxG729EncClass 42 | { 43 | GstOmxBaseFilterClass parent_class; 44 | }; 45 | 46 | GType gst_omx_g729enc_get_type (void); 47 | 48 | G_END_DECLS 49 | #endif /* GSTOMX_G729ENC_H */ 50 | -------------------------------------------------------------------------------- /omx/gstomx_h263dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_h263dec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxH263Dec, gst_omx_h263dec, GstOmxBaseVideoDec, 26 | GST_OMX_BASE_VIDEODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_sink_template (void) 30 | { 31 | GstCaps *caps; 32 | GstStructure *struc; 33 | 34 | caps = gst_caps_new_empty (); 35 | 36 | struc = gst_structure_new ("video/x-h263", 37 | "variant", G_TYPE_STRING, "itu", 38 | "width", GST_TYPE_INT_RANGE, 16, 4096, 39 | "height", GST_TYPE_INT_RANGE, 16, 4096, 40 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 41 | 42 | gst_caps_append_structure (caps, struc); 43 | 44 | return caps; 45 | } 46 | 47 | static void 48 | type_base_init (gpointer g_class) 49 | { 50 | GstElementClass *element_class; 51 | 52 | element_class = GST_ELEMENT_CLASS (g_class); 53 | 54 | gst_element_class_set_details_simple (element_class, 55 | "OpenMAX IL H.263 video decoder", 56 | "Codec/Decoder/Video", 57 | "Decodes video in H.263 format with OpenMAX IL", "Felipe Contreras"); 58 | 59 | { 60 | GstPadTemplate *template; 61 | 62 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 63 | GST_PAD_ALWAYS, generate_sink_template ()); 64 | 65 | gst_element_class_add_pad_template (element_class, template); 66 | } 67 | } 68 | 69 | static void 70 | type_class_init (gpointer g_class, gpointer class_data) 71 | { 72 | } 73 | 74 | static void 75 | type_instance_init (GTypeInstance * instance, gpointer g_class) 76 | { 77 | GstOmxBaseVideoDec *omx_base; 78 | 79 | omx_base = GST_OMX_BASE_VIDEODEC (instance); 80 | 81 | omx_base->compression_format = OMX_VIDEO_CodingH263; 82 | } 83 | -------------------------------------------------------------------------------- /omx/gstomx_h263dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_H263DEC_H 23 | #define GSTOMX_H263DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_H263DEC(obj) (GstOmxH263Dec *) (obj) 29 | #define GST_OMX_H263DEC_TYPE (gst_omx_h263dec_get_type ()) 30 | typedef struct GstOmxH263Dec GstOmxH263Dec; 31 | typedef struct GstOmxH263DecClass GstOmxH263DecClass; 32 | 33 | #include "gstomx_base_videodec.h" 34 | 35 | struct GstOmxH263Dec 36 | { 37 | GstOmxBaseVideoDec omx_base; 38 | }; 39 | 40 | struct GstOmxH263DecClass 41 | { 42 | GstOmxBaseVideoDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_h263dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_H263DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_h263enc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_h263enc.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxH263Enc, gst_omx_h263enc, GstOmxBaseVideoEnc, 26 | GST_OMX_BASE_VIDEOENC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("video/x-h263", 34 | "variant", G_TYPE_STRING, "itu", 35 | "width", GST_TYPE_INT_RANGE, 16, 4096, 36 | "height", GST_TYPE_INT_RANGE, 16, 4096, 37 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 38 | 39 | return caps; 40 | } 41 | 42 | static void 43 | type_base_init (gpointer g_class) 44 | { 45 | GstElementClass *element_class; 46 | 47 | element_class = GST_ELEMENT_CLASS (g_class); 48 | 49 | gst_element_class_set_details_simple (element_class, 50 | "OpenMAX IL H.263 video encoder", 51 | "Codec/Encoder/Video", 52 | "Encodes video in H.263 format with OpenMAX IL", "Felipe Contreras"); 53 | 54 | { 55 | GstPadTemplate *template; 56 | 57 | template = gst_pad_template_new ("src", GST_PAD_SRC, 58 | GST_PAD_ALWAYS, generate_src_template ()); 59 | 60 | gst_element_class_add_pad_template (element_class, template); 61 | } 62 | } 63 | 64 | static void 65 | type_class_init (gpointer g_class, gpointer class_data) 66 | { 67 | } 68 | 69 | static void 70 | settings_changed_cb (GOmxCore * core) 71 | { 72 | GstOmxBaseVideoEnc *omx_base; 73 | GstOmxBaseFilter *omx_base_filter; 74 | guint width; 75 | guint height; 76 | 77 | omx_base_filter = core->object; 78 | omx_base = GST_OMX_BASE_VIDEOENC (omx_base_filter); 79 | 80 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 81 | 82 | { 83 | OMX_PARAM_PORTDEFINITIONTYPE param; 84 | 85 | G_OMX_INIT_PARAM (param); 86 | 87 | param.nPortIndex = omx_base_filter->out_port->port_index; 88 | OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); 89 | 90 | width = param.format.video.nFrameWidth; 91 | height = param.format.video.nFrameHeight; 92 | } 93 | 94 | { 95 | GstCaps *new_caps; 96 | 97 | new_caps = gst_caps_new_simple ("video/x-h263", 98 | "variant", G_TYPE_STRING, "itu", 99 | "width", G_TYPE_INT, width, 100 | "height", G_TYPE_INT, height, 101 | "framerate", GST_TYPE_FRACTION, 102 | omx_base->framerate_num, omx_base->framerate_denom, NULL); 103 | 104 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 105 | gst_pad_set_caps (omx_base_filter->srcpad, new_caps); 106 | } 107 | } 108 | 109 | static void 110 | type_instance_init (GTypeInstance * instance, gpointer g_class) 111 | { 112 | GstOmxBaseFilter *omx_base_filter; 113 | GstOmxBaseVideoEnc *omx_base; 114 | 115 | omx_base_filter = GST_OMX_BASE_FILTER (instance); 116 | omx_base = GST_OMX_BASE_VIDEOENC (instance); 117 | 118 | omx_base->compression_format = OMX_VIDEO_CodingH263; 119 | 120 | omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; 121 | } 122 | -------------------------------------------------------------------------------- /omx/gstomx_h263enc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_H263ENC_H 23 | #define GSTOMX_H263ENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_H263ENC(obj) (GstOmxH263Enc *) (obj) 29 | #define GST_OMX_H263ENC_TYPE (gst_omx_h263enc_get_type ()) 30 | typedef struct GstOmxH263Enc GstOmxH263Enc; 31 | typedef struct GstOmxH263EncClass GstOmxH263EncClass; 32 | 33 | #include "gstomx_base_videoenc.h" 34 | 35 | struct GstOmxH263Enc 36 | { 37 | GstOmxBaseVideoEnc omx_base; 38 | }; 39 | 40 | struct GstOmxH263EncClass 41 | { 42 | GstOmxBaseVideoEncClass parent_class; 43 | }; 44 | 45 | GType gst_omx_h263enc_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_H263ENC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_h264dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_h264dec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxH264Dec, gst_omx_h264dec, GstOmxBaseVideoDec, 26 | GST_OMX_BASE_VIDEODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_sink_template (void) 30 | { 31 | GstCaps *caps; 32 | GstStructure *struc; 33 | 34 | caps = gst_caps_new_empty (); 35 | 36 | struc = gst_structure_new ("video/x-h264", 37 | "width", GST_TYPE_INT_RANGE, 16, 4096, 38 | "height", GST_TYPE_INT_RANGE, 16, 4096, 39 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 40 | 41 | gst_caps_append_structure (caps, struc); 42 | 43 | return caps; 44 | } 45 | 46 | static void 47 | type_base_init (gpointer g_class) 48 | { 49 | GstElementClass *element_class; 50 | 51 | element_class = GST_ELEMENT_CLASS (g_class); 52 | 53 | gst_element_class_set_details_simple (element_class, 54 | "OpenMAX IL H.264/AVC video decoder", 55 | "Codec/Decoder/Video", 56 | "Decodes video in H.264/AVC format with OpenMAX IL", "Felipe Contreras"); 57 | 58 | { 59 | GstPadTemplate *template; 60 | 61 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 62 | GST_PAD_ALWAYS, generate_sink_template ()); 63 | 64 | gst_element_class_add_pad_template (element_class, template); 65 | } 66 | } 67 | 68 | static void 69 | type_class_init (gpointer g_class, gpointer class_data) 70 | { 71 | } 72 | 73 | static void 74 | type_instance_init (GTypeInstance * instance, gpointer g_class) 75 | { 76 | GstOmxBaseVideoDec *omx_base; 77 | 78 | omx_base = GST_OMX_BASE_VIDEODEC (instance); 79 | 80 | omx_base->compression_format = OMX_VIDEO_CodingAVC; 81 | } 82 | -------------------------------------------------------------------------------- /omx/gstomx_h264dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_H264DEC_H 23 | #define GSTOMX_H264DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_H264DEC(obj) (GstOmxH264Dec *) (obj) 29 | #define GST_OMX_H264DEC_TYPE (gst_omx_h264dec_get_type ()) 30 | typedef struct GstOmxH264Dec GstOmxH264Dec; 31 | typedef struct GstOmxH264DecClass GstOmxH264DecClass; 32 | 33 | #include "gstomx_base_videodec.h" 34 | 35 | struct GstOmxH264Dec 36 | { 37 | GstOmxBaseVideoDec omx_base; 38 | }; 39 | 40 | struct GstOmxH264DecClass 41 | { 42 | GstOmxBaseVideoDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_h264dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_H264DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_h264enc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_h264enc.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxH264Enc, gst_omx_h264enc, GstOmxBaseVideoEnc, 26 | GST_OMX_BASE_VIDEOENC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("video/x-h264", 34 | "width", GST_TYPE_INT_RANGE, 16, 4096, 35 | "height", GST_TYPE_INT_RANGE, 16, 4096, 36 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 37 | 38 | return caps; 39 | } 40 | 41 | static void 42 | type_base_init (gpointer g_class) 43 | { 44 | GstElementClass *element_class; 45 | 46 | element_class = GST_ELEMENT_CLASS (g_class); 47 | 48 | gst_element_class_set_details_simple (element_class, 49 | "OpenMAX IL H.264/AVC video encoder", 50 | "Codec/Encoder/Video", 51 | "Encodes video in H.264/AVC format with OpenMAX IL", "Felipe Contreras"); 52 | 53 | { 54 | GstPadTemplate *template; 55 | 56 | template = gst_pad_template_new ("src", GST_PAD_SRC, 57 | GST_PAD_ALWAYS, generate_src_template ()); 58 | 59 | gst_element_class_add_pad_template (element_class, template); 60 | } 61 | } 62 | 63 | static void 64 | type_class_init (gpointer g_class, gpointer class_data) 65 | { 66 | } 67 | 68 | static void 69 | settings_changed_cb (GOmxCore * core) 70 | { 71 | GstOmxBaseVideoEnc *omx_base; 72 | GstOmxBaseFilter *omx_base_filter; 73 | guint width; 74 | guint height; 75 | 76 | omx_base_filter = core->object; 77 | omx_base = GST_OMX_BASE_VIDEOENC (omx_base_filter); 78 | 79 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 80 | 81 | { 82 | OMX_PARAM_PORTDEFINITIONTYPE param; 83 | 84 | G_OMX_INIT_PARAM (param); 85 | 86 | param.nPortIndex = omx_base_filter->out_port->port_index; 87 | OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); 88 | 89 | width = param.format.video.nFrameWidth; 90 | height = param.format.video.nFrameHeight; 91 | } 92 | 93 | { 94 | GstCaps *new_caps; 95 | 96 | new_caps = gst_caps_new_simple ("video/x-h264", 97 | "width", G_TYPE_INT, width, 98 | "height", G_TYPE_INT, height, 99 | "framerate", GST_TYPE_FRACTION, 100 | omx_base->framerate_num, omx_base->framerate_denom, NULL); 101 | 102 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 103 | gst_pad_set_caps (omx_base_filter->srcpad, new_caps); 104 | } 105 | } 106 | 107 | static void 108 | type_instance_init (GTypeInstance * instance, gpointer g_class) 109 | { 110 | GstOmxBaseFilter *omx_base_filter; 111 | GstOmxBaseVideoEnc *omx_base; 112 | 113 | omx_base_filter = GST_OMX_BASE_FILTER (instance); 114 | omx_base = GST_OMX_BASE_VIDEOENC (instance); 115 | 116 | omx_base->compression_format = OMX_VIDEO_CodingAVC; 117 | 118 | omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; 119 | } 120 | -------------------------------------------------------------------------------- /omx/gstomx_h264enc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_H264ENC_H 23 | #define GSTOMX_H264ENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_H264ENC(obj) (GstOmxH264Enc *) (obj) 29 | #define GST_OMX_H264ENC_TYPE (gst_omx_h264enc_get_type ()) 30 | typedef struct GstOmxH264Enc GstOmxH264Enc; 31 | typedef struct GstOmxH264EncClass GstOmxH264EncClass; 32 | 33 | #include "gstomx_base_videoenc.h" 34 | 35 | struct GstOmxH264Enc 36 | { 37 | GstOmxBaseVideoEnc omx_base; 38 | }; 39 | 40 | struct GstOmxH264EncClass 41 | { 42 | GstOmxBaseVideoEncClass parent_class; 43 | }; 44 | 45 | GType gst_omx_h264enc_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_H264ENC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_ilbcdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_ilbcdec.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | /* should this class extend GstOmxBaseAudioDec? */ 27 | GSTOMX_BOILERPLATE (GstOmxIlbcDec, gst_omx_ilbcdec, GstOmxBaseFilter, 28 | GST_OMX_BASE_FILTER_TYPE); 29 | 30 | static GstCaps * 31 | generate_src_template (void) 32 | { 33 | GstCaps *caps; 34 | 35 | caps = gst_caps_new_simple ("audio/x-raw-int", 36 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 37 | "width", G_TYPE_INT, 16, 38 | "depth", G_TYPE_INT, 16, 39 | "rate", G_TYPE_INT, 8000, 40 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 41 | 42 | return caps; 43 | } 44 | 45 | static GstCaps * 46 | generate_sink_template (void) 47 | { 48 | GstCaps *caps; 49 | GstStructure *struc; 50 | 51 | caps = gst_caps_new_empty (); 52 | 53 | struc = gst_structure_new ("audio/x-iLBC", NULL); 54 | 55 | { 56 | GValue list; 57 | GValue val; 58 | 59 | list.g_type = val.g_type = 0; 60 | 61 | g_value_init (&list, GST_TYPE_LIST); 62 | g_value_init (&val, G_TYPE_INT); 63 | 64 | g_value_set_int (&val, 20); 65 | gst_value_list_append_value (&list, &val); 66 | 67 | g_value_set_int (&val, 30); 68 | gst_value_list_append_value (&list, &val); 69 | 70 | gst_structure_set_value (struc, "mode", &list); 71 | 72 | g_value_unset (&val); 73 | g_value_unset (&list); 74 | } 75 | 76 | gst_caps_append_structure (caps, struc); 77 | 78 | return caps; 79 | } 80 | 81 | static void 82 | type_base_init (gpointer g_class) 83 | { 84 | GstElementClass *element_class; 85 | 86 | element_class = GST_ELEMENT_CLASS (g_class); 87 | 88 | gst_element_class_set_details_simple (element_class, 89 | "OpenMAX IL iLBC audio decoder", 90 | "Codec/Decoder/Audio", 91 | "Decodes audio in iLBC format with OpenMAX IL", "Felipe Contreras"); 92 | 93 | { 94 | GstPadTemplate *template; 95 | 96 | template = gst_pad_template_new ("src", GST_PAD_SRC, 97 | GST_PAD_ALWAYS, generate_src_template ()); 98 | 99 | gst_element_class_add_pad_template (element_class, template); 100 | } 101 | 102 | { 103 | GstPadTemplate *template; 104 | 105 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 106 | GST_PAD_ALWAYS, generate_sink_template ()); 107 | 108 | gst_element_class_add_pad_template (element_class, template); 109 | } 110 | } 111 | 112 | static void 113 | type_class_init (gpointer g_class, gpointer class_data) 114 | { 115 | } 116 | 117 | static gboolean 118 | sink_setcaps (GstPad * pad, GstCaps * caps) 119 | { 120 | GstOmxBaseFilter *omx_base; 121 | 122 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 123 | 124 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 125 | 126 | /* set caps on the srcpad */ 127 | { 128 | GstCaps *tmp_caps; 129 | 130 | tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); 131 | tmp_caps = gst_caps_make_writable (tmp_caps); 132 | gst_caps_truncate (tmp_caps); 133 | 134 | gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); 135 | 136 | if (gst_caps_is_fixed (tmp_caps)) { 137 | GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); 138 | gst_pad_set_caps (omx_base->srcpad, tmp_caps); 139 | } 140 | 141 | gst_caps_unref (tmp_caps); 142 | } 143 | 144 | return gst_pad_set_caps (pad, caps); 145 | } 146 | 147 | static void 148 | type_instance_init (GTypeInstance * instance, gpointer g_class) 149 | { 150 | GstOmxBaseFilter *omx_base; 151 | 152 | omx_base = GST_OMX_BASE_FILTER (instance); 153 | 154 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 155 | } 156 | -------------------------------------------------------------------------------- /omx/gstomx_ilbcdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_ILBCDEC_H 23 | #define GSTOMX_ILBCDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_ILBCDEC(obj) (GstOmxIlbcDec *) (obj) 29 | #define GST_OMX_ILBCDEC_TYPE (gst_omx_ilbcdec_get_type ()) 30 | typedef struct GstOmxIlbcDec GstOmxIlbcDec; 31 | typedef struct GstOmxIlbcDecClass GstOmxIlbcDecClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxIlbcDec 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxIlbcDecClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_ilbcdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_ILBCDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_ilbcenc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_ilbcenc.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | GSTOMX_BOILERPLATE (GstOmxIlbcEnc, gst_omx_ilbcenc, GstOmxBaseFilter, 27 | GST_OMX_BASE_FILTER_TYPE); 28 | 29 | static GstCaps * 30 | generate_src_template (void) 31 | { 32 | GstCaps *caps; 33 | GstStructure *struc; 34 | 35 | caps = gst_caps_new_empty (); 36 | 37 | struc = gst_structure_new ("audio/x-iLBC", NULL); 38 | 39 | { 40 | GValue list; 41 | GValue val; 42 | 43 | list.g_type = val.g_type = 0; 44 | 45 | g_value_init (&list, GST_TYPE_LIST); 46 | g_value_init (&val, G_TYPE_INT); 47 | 48 | g_value_set_int (&val, 20); 49 | gst_value_list_append_value (&list, &val); 50 | 51 | g_value_set_int (&val, 30); 52 | gst_value_list_append_value (&list, &val); 53 | 54 | gst_structure_set_value (struc, "mode", &list); 55 | 56 | g_value_unset (&val); 57 | g_value_unset (&list); 58 | } 59 | 60 | gst_caps_append_structure (caps, struc); 61 | 62 | return caps; 63 | } 64 | 65 | static GstCaps * 66 | generate_sink_template (void) 67 | { 68 | GstCaps *caps; 69 | 70 | caps = gst_caps_new_simple ("audio/x-raw-int", 71 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 72 | "width", G_TYPE_INT, 16, 73 | "depth", G_TYPE_INT, 16, 74 | "rate", G_TYPE_INT, 8000, 75 | "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL); 76 | 77 | return caps; 78 | } 79 | 80 | static void 81 | type_base_init (gpointer g_class) 82 | { 83 | GstElementClass *element_class; 84 | 85 | element_class = GST_ELEMENT_CLASS (g_class); 86 | 87 | gst_element_class_set_details_simple (element_class, 88 | "OpenMAX IL iLBC audio encoder", 89 | "Codec/Encoder/Audio", 90 | "Encodes audio in iLBC format with OpenMAX IL", "Felipe Contreras"); 91 | 92 | { 93 | GstPadTemplate *template; 94 | 95 | template = gst_pad_template_new ("src", GST_PAD_SRC, 96 | GST_PAD_ALWAYS, generate_src_template ()); 97 | 98 | gst_element_class_add_pad_template (element_class, template); 99 | } 100 | 101 | { 102 | GstPadTemplate *template; 103 | 104 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 105 | GST_PAD_ALWAYS, generate_sink_template ()); 106 | 107 | gst_element_class_add_pad_template (element_class, template); 108 | } 109 | } 110 | 111 | static void 112 | type_class_init (gpointer g_class, gpointer class_data) 113 | { 114 | } 115 | 116 | static gboolean 117 | sink_setcaps (GstPad * pad, GstCaps * caps) 118 | { 119 | GstOmxBaseFilter *omx_base; 120 | 121 | omx_base = GST_OMX_BASE_FILTER (GST_PAD_PARENT (pad)); 122 | 123 | GST_INFO_OBJECT (omx_base, "setcaps (sink): %" GST_PTR_FORMAT, caps); 124 | 125 | /* set caps on the srcpad */ 126 | { 127 | GstCaps *tmp_caps; 128 | 129 | tmp_caps = gst_pad_get_allowed_caps (omx_base->srcpad); 130 | tmp_caps = gst_caps_make_writable (tmp_caps); 131 | gst_caps_truncate (tmp_caps); 132 | 133 | gst_pad_fixate_caps (omx_base->srcpad, tmp_caps); 134 | 135 | if (gst_caps_is_fixed (tmp_caps)) { 136 | GST_INFO_OBJECT (omx_base, "fixated to: %" GST_PTR_FORMAT, tmp_caps); 137 | gst_pad_set_caps (omx_base->srcpad, tmp_caps); 138 | } 139 | 140 | gst_caps_unref (tmp_caps); 141 | } 142 | 143 | return gst_pad_set_caps (pad, caps); 144 | } 145 | 146 | static void 147 | type_instance_init (GTypeInstance * instance, gpointer g_class) 148 | { 149 | GstOmxBaseFilter *omx_base; 150 | 151 | omx_base = GST_OMX_BASE_FILTER (instance); 152 | 153 | gst_pad_set_setcaps_function (omx_base->sinkpad, sink_setcaps); 154 | } 155 | -------------------------------------------------------------------------------- /omx/gstomx_ilbcenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_ILBCENC_H 23 | #define GSTOMX_ILBCENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_ILBCENC(obj) (GstOmxIlbcEnc *) (obj) 29 | #define GST_OMX_ILBCENC_TYPE (gst_omx_ilbcenc_get_type ()) 30 | typedef struct GstOmxIlbcEnc GstOmxIlbcEnc; 31 | typedef struct GstOmxIlbcEncClass GstOmxIlbcEncClass; 32 | 33 | #include "gstomx_base_filter.h" 34 | 35 | struct GstOmxIlbcEnc 36 | { 37 | GstOmxBaseFilter omx_base; 38 | }; 39 | 40 | struct GstOmxIlbcEncClass 41 | { 42 | GstOmxBaseFilterClass parent_class; 43 | }; 44 | 45 | GType gst_omx_ilbcenc_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_ILBCENC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_interface.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_interface.h" 23 | 24 | GType 25 | gst_omx_get_type (void) 26 | { 27 | static GType type = 0; 28 | 29 | if (G_UNLIKELY (type == 0)) { 30 | GTypeInfo *type_info; 31 | 32 | type_info = g_new0 (GTypeInfo, 1); 33 | 34 | type_info->class_size = sizeof (GstOmxClass); 35 | 36 | type = g_type_register_static (G_TYPE_INTERFACE, "GstOmx", type_info, 0); 37 | g_type_interface_add_prerequisite (type, GST_TYPE_IMPLEMENTS_INTERFACE); 38 | } 39 | 40 | return type; 41 | } 42 | -------------------------------------------------------------------------------- /omx/gstomx_interface.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_INTERFACE_H 23 | #define GSTOMX_INTERFACE_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_TYPE_OMX (gst_omx_get_type ()) 29 | #define GST_OMX(obj) (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_OMX, GstOmx)) 30 | #define GST_IS_OMX(obj) (GST_IMPLEMENTS_INTERFACE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_OMX)) 31 | typedef struct GstOmx GstOmx; 32 | 33 | typedef struct GstOmxClass 34 | { 35 | GTypeInterface klass; 36 | 37 | } GstOmxClass; 38 | 39 | GType gst_omx_get_type (void); 40 | 41 | G_END_DECLS 42 | #endif /* GSTOMX_INTERFACE_H */ 43 | -------------------------------------------------------------------------------- /omx/gstomx_jpegenc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_JPEGENC_H 23 | #define GSTOMX_JPEGENC_H 24 | 25 | #include 26 | 27 | #include 28 | 29 | G_BEGIN_DECLS 30 | #define GST_OMX_JPEGENC(obj) (GstOmxJpegEnc *) (obj) 31 | #define GST_OMX_JPEGENC_TYPE (gst_omx_jpegenc_get_type ()) 32 | typedef struct GstOmxJpegEnc GstOmxJpegEnc; 33 | typedef struct GstOmxJpegEncClass GstOmxJpegEncClass; 34 | 35 | #include "gstomx_base_filter.h" 36 | 37 | struct GstOmxJpegEnc 38 | { 39 | GstOmxBaseFilter omx_base; 40 | 41 | gint framerate_num; 42 | gint framerate_denom; 43 | guint quality; 44 | }; 45 | 46 | struct GstOmxJpegEncClass 47 | { 48 | GstOmxBaseFilterClass parent_class; 49 | }; 50 | 51 | GType gst_omx_jpegenc_get_type (void); 52 | 53 | G_END_DECLS 54 | #endif /* GSTOMX_JPEGENC_H */ 55 | -------------------------------------------------------------------------------- /omx/gstomx_mp2dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_mp2dec.h" 23 | #include "gstomx_base_filter.h" 24 | #include "gstomx.h" 25 | 26 | GSTOMX_BOILERPLATE (GstOmxMp2Dec, gst_omx_mp2dec, GstOmxBaseAudioDec, 27 | GST_OMX_BASE_AUDIODEC_TYPE); 28 | 29 | static GstCaps * 30 | generate_src_template (void) 31 | { 32 | GstCaps *caps; 33 | 34 | caps = gst_caps_new_simple ("audio/x-raw-int", 35 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 36 | "width", G_TYPE_INT, 16, 37 | "depth", G_TYPE_INT, 16, 38 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 39 | "signed", G_TYPE_BOOLEAN, TRUE, 40 | "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); 41 | 42 | return caps; 43 | } 44 | 45 | static GstCaps * 46 | generate_sink_template (void) 47 | { 48 | GstCaps *caps; 49 | 50 | caps = gst_caps_new_simple ("audio/mpeg", 51 | "mpegversion", G_TYPE_INT, 1, 52 | "layer", G_TYPE_INT, 2, 53 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 54 | "channels", GST_TYPE_INT_RANGE, 1, 2, 55 | "parsed", G_TYPE_BOOLEAN, TRUE, NULL); 56 | 57 | return caps; 58 | } 59 | 60 | static void 61 | type_base_init (gpointer g_class) 62 | { 63 | GstElementClass *element_class; 64 | 65 | element_class = GST_ELEMENT_CLASS (g_class); 66 | 67 | gst_element_class_set_details_simple (element_class, 68 | "OpenMAX IL MP2 audio decoder", 69 | "Codec/Decoder/Audio", 70 | "Decodes audio in MP2 format with OpenMAX IL", "Felipe Contreras"); 71 | 72 | { 73 | GstPadTemplate *template; 74 | 75 | template = gst_pad_template_new ("src", GST_PAD_SRC, 76 | GST_PAD_ALWAYS, generate_src_template ()); 77 | 78 | gst_element_class_add_pad_template (element_class, template); 79 | } 80 | 81 | { 82 | GstPadTemplate *template; 83 | 84 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 85 | GST_PAD_ALWAYS, generate_sink_template ()); 86 | 87 | gst_element_class_add_pad_template (element_class, template); 88 | } 89 | } 90 | 91 | static void 92 | type_class_init (gpointer g_class, gpointer class_data) 93 | { 94 | } 95 | 96 | static void 97 | type_instance_init (GTypeInstance * instance, gpointer g_class) 98 | { 99 | } 100 | -------------------------------------------------------------------------------- /omx/gstomx_mp2dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_MP2DEC_H 23 | #define GSTOMX_MP2DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_MP2DEC(obj) (GstOmxMp2Dec *) (obj) 29 | #define GST_OMX_MP2DEC_TYPE (gst_omx_mp2dec_get_type ()) 30 | typedef struct GstOmxMp2Dec GstOmxMp2Dec; 31 | typedef struct GstOmxMp2DecClass GstOmxMp2DecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxMp2Dec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxMp2DecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_mp2dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_MP2DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_mp3dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_mp3dec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxMp3Dec, gst_omx_mp3dec, GstOmxBaseAudioDec, 26 | GST_OMX_BASE_AUDIODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 35 | "width", G_TYPE_INT, 16, 36 | "depth", G_TYPE_INT, 16, 37 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 38 | "signed", G_TYPE_BOOLEAN, TRUE, 39 | "channels", GST_TYPE_INT_RANGE, 1, 2, NULL); 40 | 41 | return caps; 42 | } 43 | 44 | static GstCaps * 45 | generate_sink_template (void) 46 | { 47 | GstCaps *caps; 48 | 49 | caps = gst_caps_new_simple ("audio/mpeg", 50 | "mpegversion", G_TYPE_INT, 1, 51 | "layer", G_TYPE_INT, 3, 52 | "rate", GST_TYPE_INT_RANGE, 8000, 48000, 53 | "channels", GST_TYPE_INT_RANGE, 1, 8, 54 | "parsed", G_TYPE_BOOLEAN, TRUE, NULL); 55 | 56 | return caps; 57 | } 58 | 59 | static void 60 | type_base_init (gpointer g_class) 61 | { 62 | GstElementClass *element_class; 63 | 64 | element_class = GST_ELEMENT_CLASS (g_class); 65 | 66 | gst_element_class_set_details_simple (element_class, 67 | "OpenMAX IL MP3 audio decoder", 68 | "Codec/Decoder/Audio", 69 | "Decodes audio in MP3 format with OpenMAX IL", "Felipe Contreras"); 70 | 71 | { 72 | GstPadTemplate *template; 73 | 74 | template = gst_pad_template_new ("src", GST_PAD_SRC, 75 | GST_PAD_ALWAYS, generate_src_template ()); 76 | 77 | gst_element_class_add_pad_template (element_class, template); 78 | } 79 | 80 | { 81 | GstPadTemplate *template; 82 | 83 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 84 | GST_PAD_ALWAYS, generate_sink_template ()); 85 | 86 | gst_element_class_add_pad_template (element_class, template); 87 | } 88 | } 89 | 90 | static void 91 | type_class_init (gpointer g_class, gpointer class_data) 92 | { 93 | } 94 | 95 | static void 96 | type_instance_init (GTypeInstance * instance, gpointer g_class) 97 | { 98 | } 99 | -------------------------------------------------------------------------------- /omx/gstomx_mp3dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_MP3DEC_H 23 | #define GSTOMX_MP3DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_MP3DEC(obj) (GstOmxMp3Dec *) (obj) 29 | #define GST_OMX_MP3DEC_TYPE (gst_omx_mp3dec_get_type ()) 30 | typedef struct GstOmxMp3Dec GstOmxMp3Dec; 31 | typedef struct GstOmxMp3DecClass GstOmxMp3DecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxMp3Dec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxMp3DecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_mp3dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_MP3DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_mpeg4dec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_mpeg4dec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxMpeg4Dec, gst_omx_mpeg4dec, GstOmxBaseVideoDec, 26 | GST_OMX_BASE_VIDEODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_sink_template (void) 30 | { 31 | GstCaps *caps; 32 | GstStructure *struc; 33 | 34 | caps = gst_caps_new_empty (); 35 | 36 | struc = gst_structure_new ("video/mpeg", 37 | "mpegversion", G_TYPE_INT, 4, 38 | "systemstream", G_TYPE_BOOLEAN, FALSE, 39 | "width", GST_TYPE_INT_RANGE, 16, 4096, 40 | "height", GST_TYPE_INT_RANGE, 16, 4096, 41 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 42 | 43 | gst_caps_append_structure (caps, struc); 44 | 45 | struc = gst_structure_new ("video/x-divx", 46 | "divxversion", GST_TYPE_INT_RANGE, 4, 5, 47 | "width", GST_TYPE_INT_RANGE, 16, 4096, 48 | "height", GST_TYPE_INT_RANGE, 16, 4096, 49 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 50 | 51 | gst_caps_append_structure (caps, struc); 52 | 53 | struc = gst_structure_new ("video/x-xvid", 54 | "width", GST_TYPE_INT_RANGE, 16, 4096, 55 | "height", GST_TYPE_INT_RANGE, 16, 4096, 56 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 57 | 58 | gst_caps_append_structure (caps, struc); 59 | 60 | struc = gst_structure_new ("video/x-3ivx", 61 | "width", GST_TYPE_INT_RANGE, 16, 4096, 62 | "height", GST_TYPE_INT_RANGE, 16, 4096, 63 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 64 | 65 | gst_caps_append_structure (caps, struc); 66 | 67 | return caps; 68 | } 69 | 70 | static void 71 | type_base_init (gpointer g_class) 72 | { 73 | GstElementClass *element_class; 74 | 75 | element_class = GST_ELEMENT_CLASS (g_class); 76 | 77 | gst_element_class_set_details_simple (element_class, 78 | "OpenMAX IL MPEG-4 video decoder", 79 | "Codec/Decoder/Video", 80 | "Decodes video in MPEG-4 format with OpenMAX IL", "Felipe Contreras"); 81 | 82 | { 83 | GstPadTemplate *template; 84 | 85 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 86 | GST_PAD_ALWAYS, generate_sink_template ()); 87 | 88 | gst_element_class_add_pad_template (element_class, template); 89 | } 90 | } 91 | 92 | static void 93 | type_class_init (gpointer g_class, gpointer class_data) 94 | { 95 | } 96 | 97 | static void 98 | type_instance_init (GTypeInstance * instance, gpointer g_class) 99 | { 100 | GstOmxBaseVideoDec *omx_base; 101 | 102 | omx_base = GST_OMX_BASE_VIDEODEC (instance); 103 | 104 | omx_base->compression_format = OMX_VIDEO_CodingMPEG4; 105 | } 106 | -------------------------------------------------------------------------------- /omx/gstomx_mpeg4dec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_MPEG4DEC_H 23 | #define GSTOMX_MPEG4DEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_MPEG4DEC(obj) (GstOmxMpeg4Dec *) (obj) 29 | #define GST_OMX_MPEG4DEC_TYPE (gst_omx_mpeg4dec_get_type ()) 30 | typedef struct GstOmxMpeg4Dec GstOmxMpeg4Dec; 31 | typedef struct GstOmxMpeg4DecClass GstOmxMpeg4DecClass; 32 | 33 | #include "gstomx_base_videodec.h" 34 | 35 | struct GstOmxMpeg4Dec 36 | { 37 | GstOmxBaseVideoDec omx_base; 38 | }; 39 | 40 | struct GstOmxMpeg4DecClass 41 | { 42 | GstOmxBaseVideoDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_mpeg4dec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_MPEG4DEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_mpeg4enc.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_mpeg4enc.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxMpeg4Enc, gst_omx_mpeg4enc, GstOmxBaseVideoEnc, 26 | GST_OMX_BASE_VIDEOENC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps; 32 | 33 | caps = gst_caps_new_simple ("video/mpeg", 34 | "width", GST_TYPE_INT_RANGE, 16, 4096, 35 | "height", GST_TYPE_INT_RANGE, 16, 4096, 36 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, 37 | "mpegversion", G_TYPE_INT, 4, 38 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); 39 | 40 | return caps; 41 | } 42 | 43 | static void 44 | type_base_init (gpointer g_class) 45 | { 46 | GstElementClass *element_class; 47 | 48 | element_class = GST_ELEMENT_CLASS (g_class); 49 | 50 | gst_element_class_set_details_simple (element_class, 51 | "OpenMAX IL MPEG-4 video encoder", 52 | "Codec/Encoder/Video", 53 | "Encodes video in MPEG-4 format with OpenMAX IL", "Felipe Contreras"); 54 | 55 | { 56 | GstPadTemplate *template; 57 | 58 | template = gst_pad_template_new ("src", GST_PAD_SRC, 59 | GST_PAD_ALWAYS, generate_src_template ()); 60 | 61 | gst_element_class_add_pad_template (element_class, template); 62 | } 63 | } 64 | 65 | static void 66 | type_class_init (gpointer g_class, gpointer class_data) 67 | { 68 | } 69 | 70 | static void 71 | settings_changed_cb (GOmxCore * core) 72 | { 73 | GstOmxBaseVideoEnc *omx_base; 74 | GstOmxBaseFilter *omx_base_filter; 75 | guint width; 76 | guint height; 77 | 78 | omx_base_filter = core->object; 79 | omx_base = GST_OMX_BASE_VIDEOENC (omx_base_filter); 80 | 81 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 82 | 83 | { 84 | OMX_PARAM_PORTDEFINITIONTYPE param; 85 | 86 | G_OMX_INIT_PARAM (param); 87 | 88 | param.nPortIndex = omx_base_filter->out_port->port_index; 89 | OMX_GetParameter (core->omx_handle, OMX_IndexParamPortDefinition, ¶m); 90 | 91 | width = param.format.video.nFrameWidth; 92 | height = param.format.video.nFrameHeight; 93 | } 94 | 95 | { 96 | GstCaps *new_caps; 97 | 98 | new_caps = gst_caps_new_simple ("video/mpeg", 99 | "mpegversion", G_TYPE_INT, 4, 100 | "width", G_TYPE_INT, width, 101 | "height", G_TYPE_INT, height, 102 | "framerate", GST_TYPE_FRACTION, 103 | omx_base->framerate_num, omx_base->framerate_denom, 104 | "systemstream", G_TYPE_BOOLEAN, FALSE, NULL); 105 | 106 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 107 | gst_pad_set_caps (omx_base_filter->srcpad, new_caps); 108 | } 109 | } 110 | 111 | static void 112 | type_instance_init (GTypeInstance * instance, gpointer g_class) 113 | { 114 | GstOmxBaseFilter *omx_base_filter; 115 | GstOmxBaseVideoEnc *omx_base; 116 | 117 | omx_base_filter = GST_OMX_BASE_FILTER (instance); 118 | omx_base = GST_OMX_BASE_VIDEOENC (instance); 119 | 120 | omx_base->compression_format = OMX_VIDEO_CodingMPEG4; 121 | 122 | omx_base_filter->gomx->settings_changed_cb = settings_changed_cb; 123 | } 124 | -------------------------------------------------------------------------------- /omx/gstomx_mpeg4enc.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_MPEG4ENC_H 23 | #define GSTOMX_MPEG4ENC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_MPEG4ENC(obj) (GstOmxMpeg4Enc *) (obj) 29 | #define GST_OMX_MPEG4ENC_TYPE (gst_omx_mpeg4enc_get_type ()) 30 | typedef struct GstOmxMpeg4Enc GstOmxMpeg4Enc; 31 | typedef struct GstOmxMpeg4EncClass GstOmxMpeg4EncClass; 32 | 33 | #include "gstomx_base_videoenc.h" 34 | 35 | struct GstOmxMpeg4Enc 36 | { 37 | GstOmxBaseVideoEnc omx_base; 38 | }; 39 | 40 | struct GstOmxMpeg4EncClass 41 | { 42 | GstOmxBaseVideoEncClass parent_class; 43 | }; 44 | 45 | GType gst_omx_mpeg4enc_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_MPEG4ENC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_videosink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_VIDEOSINK_H 23 | #define GSTOMX_VIDEOSINK_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_VIDEOSINK(obj) (GstOmxVideoSink *) (obj) 29 | #define GST_OMX_VIDEOSINK_TYPE (gst_omx_videosink_get_type ()) 30 | typedef struct GstOmxVideoSink GstOmxVideoSink; 31 | typedef struct GstOmxVideoSinkClass GstOmxVideoSinkClass; 32 | 33 | #include "gstomx_base_sink.h" 34 | 35 | struct GstOmxVideoSink 36 | { 37 | GstOmxBaseSink omx_base; 38 | guint x_scale; 39 | guint y_scale; 40 | guint rotation; 41 | }; 42 | 43 | struct GstOmxVideoSinkClass 44 | { 45 | GstOmxBaseSinkClass parent_class; 46 | }; 47 | 48 | GType gst_omx_videosink_get_type (void); 49 | 50 | G_END_DECLS 51 | #endif /* GSTOMX_VIDEOSINK_H */ 52 | -------------------------------------------------------------------------------- /omx/gstomx_volume.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * Copyright (C) 2008 NXP. 4 | * 5 | * Author: Frederik Vernelen 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation 10 | * version 2.1 of the License. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #include "gstomx_volume.h" 24 | #include "gstomx_base_filter.h" 25 | #include "gstomx.h" 26 | 27 | GSTOMX_BOILERPLATE (GstOmxVolume, gst_omx_volume, GstOmxBaseFilter, 28 | GST_OMX_BASE_FILTER_TYPE); 29 | 30 | static GstCaps * 31 | generate_src_template (void) 32 | { 33 | GstCaps *caps; 34 | 35 | caps = gst_caps_new_simple ("audio/x-raw-int", 36 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 37 | "width", G_TYPE_INT, 16, 38 | "depth", G_TYPE_INT, 16, 39 | "rate", GST_TYPE_INT_RANGE, 8000, 48000, 40 | "signed", G_TYPE_BOOLEAN, TRUE, 41 | "channels", GST_TYPE_INT_RANGE, 1, 8, NULL); 42 | 43 | return caps; 44 | } 45 | 46 | static GstCaps * 47 | generate_sink_template (void) 48 | { 49 | GstCaps *caps; 50 | 51 | caps = gst_caps_new_simple ("audio/x-raw-int", 52 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 53 | "width", G_TYPE_INT, 16, 54 | "depth", G_TYPE_INT, 16, 55 | "rate", GST_TYPE_INT_RANGE, 8000, 48000, 56 | "signed", G_TYPE_BOOLEAN, TRUE, 57 | "channels", GST_TYPE_INT_RANGE, 1, 8, NULL); 58 | 59 | return caps; 60 | } 61 | 62 | static void 63 | type_base_init (gpointer g_class) 64 | { 65 | GstElementClass *element_class; 66 | 67 | element_class = GST_ELEMENT_CLASS (g_class); 68 | 69 | gst_element_class_set_details_simple (element_class, 70 | "OpenMAX IL Volume component", 71 | "Filter/Effect/Audio", 72 | "Changes the volume with OpenMAX IL", "Frederik Vernelen"); 73 | 74 | { 75 | GstPadTemplate *template; 76 | 77 | template = gst_pad_template_new ("src", GST_PAD_SRC, 78 | GST_PAD_ALWAYS, generate_src_template ()); 79 | 80 | gst_element_class_add_pad_template (element_class, template); 81 | } 82 | 83 | { 84 | GstPadTemplate *template; 85 | 86 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 87 | GST_PAD_ALWAYS, generate_sink_template ()); 88 | 89 | gst_element_class_add_pad_template (element_class, template); 90 | } 91 | } 92 | 93 | static void 94 | type_class_init (gpointer g_class, gpointer class_data) 95 | { 96 | } 97 | 98 | static void 99 | settings_changed_cb (GOmxCore * core) 100 | { 101 | GstOmxBaseFilter *omx_base; 102 | guint rate; 103 | guint channels; 104 | 105 | omx_base = core->object; 106 | 107 | GST_DEBUG_OBJECT (omx_base, "settings changed"); 108 | 109 | { 110 | OMX_AUDIO_PARAM_PCMMODETYPE param; 111 | 112 | G_OMX_INIT_PARAM (param); 113 | 114 | param.nPortIndex = omx_base->out_port->port_index; 115 | OMX_GetParameter (omx_base->gomx->omx_handle, OMX_IndexParamAudioPcm, 116 | ¶m); 117 | 118 | rate = param.nSamplingRate; 119 | channels = param.nChannels; 120 | if (rate == 0) { 121 | /** @todo: this shouldn't happen. */ 122 | GST_WARNING_OBJECT (omx_base, "Bad samplerate"); 123 | rate = 44100; 124 | } 125 | } 126 | 127 | { 128 | GstCaps *new_caps; 129 | 130 | new_caps = gst_caps_new_simple ("audio/x-raw-int", 131 | "width", G_TYPE_INT, 16, 132 | "depth", G_TYPE_INT, 16, 133 | "rate", G_TYPE_INT, rate, 134 | "signed", G_TYPE_BOOLEAN, TRUE, 135 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 136 | "channels", G_TYPE_INT, channels, NULL); 137 | 138 | GST_INFO_OBJECT (omx_base, "caps are: %" GST_PTR_FORMAT, new_caps); 139 | gst_pad_set_caps (omx_base->srcpad, new_caps); 140 | } 141 | } 142 | 143 | static void 144 | type_instance_init (GTypeInstance * instance, gpointer g_class) 145 | { 146 | GstOmxBaseFilter *omx_base; 147 | 148 | omx_base = GST_OMX_BASE_FILTER (instance); 149 | 150 | GST_DEBUG_OBJECT (omx_base, "start"); 151 | 152 | omx_base->gomx->settings_changed_cb = settings_changed_cb; 153 | } 154 | -------------------------------------------------------------------------------- /omx/gstomx_volume.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * Copyright (C) 2008 NXP. 4 | * 5 | * Author: Frederik Vernelen 6 | * 7 | * This library is free software; you can redistribute it and/or 8 | * modify it under the terms of the GNU Lesser General Public 9 | * License as published by the Free Software Foundation 10 | * version 2.1 of the License. 11 | * 12 | * This library is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 | * Lesser General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU Lesser General Public 18 | * License along with this library; if not, write to the Free Software 19 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 | * 21 | */ 22 | 23 | #ifndef GSTOMX_VOLUME_H 24 | #define GSTOMX_VOLUME_H 25 | 26 | #include 27 | 28 | #include 29 | 30 | G_BEGIN_DECLS 31 | #define GST_OMX_VOLUME(obj) (GstOmxVolume *) (obj) 32 | #define GST_OMX_VOLUME_TYPE (gst_omx_volume_get_type ()) 33 | typedef struct GstOmxVolume GstOmxVolume; 34 | typedef struct GstOmxVolumeClass GstOmxVolumeClass; 35 | 36 | #include "gstomx_base_filter.h" 37 | 38 | struct GstOmxVolume 39 | { 40 | GstOmxBaseFilter omx_base; 41 | }; 42 | 43 | struct GstOmxVolumeClass 44 | { 45 | GstOmxBaseFilterClass parent_class; 46 | }; 47 | 48 | GType gst_omx_volume_get_type (void); 49 | 50 | G_END_DECLS 51 | #endif /* GSTOMX_VOLUME_H */ 52 | -------------------------------------------------------------------------------- /omx/gstomx_vorbisdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_vorbisdec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxVorbisDec, gst_omx_vorbisdec, GstOmxBaseAudioDec, 26 | GST_OMX_BASE_AUDIODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_src_template (void) 30 | { 31 | GstCaps *caps = NULL; 32 | 33 | caps = gst_caps_new_simple ("audio/x-raw-int", 34 | "rate", GST_TYPE_INT_RANGE, 8000, 96000, 35 | "signed", G_TYPE_BOOLEAN, TRUE, 36 | "endianness", G_TYPE_INT, G_BYTE_ORDER, 37 | "width", G_TYPE_INT, 16, 38 | "depth", G_TYPE_INT, 16, "channels", GST_TYPE_INT_RANGE, 1, 256, NULL); 39 | 40 | return caps; 41 | } 42 | 43 | static GstCaps * 44 | generate_sink_template (void) 45 | { 46 | GstCaps *caps = NULL; 47 | 48 | caps = gst_caps_new_simple ("application/ogg", NULL); 49 | 50 | return caps; 51 | } 52 | 53 | static void 54 | type_base_init (gpointer g_class) 55 | { 56 | GstElementClass *element_class; 57 | 58 | element_class = GST_ELEMENT_CLASS (g_class); 59 | 60 | gst_element_class_set_details_simple (element_class, 61 | "OpenMAX IL Vorbis audio decoder", 62 | "Codec/Decoder/Audio", 63 | "Decodes audio in Vorbis format with OpenMAX IL", "Felipe Contreras"); 64 | 65 | { 66 | GstPadTemplate *template; 67 | 68 | template = gst_pad_template_new ("src", GST_PAD_SRC, 69 | GST_PAD_ALWAYS, generate_src_template ()); 70 | 71 | gst_element_class_add_pad_template (element_class, template); 72 | } 73 | 74 | { 75 | GstPadTemplate *template; 76 | 77 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 78 | GST_PAD_ALWAYS, generate_sink_template ()); 79 | 80 | gst_element_class_add_pad_template (element_class, template); 81 | } 82 | } 83 | 84 | static void 85 | type_class_init (gpointer g_class, gpointer class_data) 86 | { 87 | } 88 | 89 | static void 90 | type_instance_init (GTypeInstance * instance, gpointer g_class) 91 | { 92 | GstOmxBaseFilter *omx_base; 93 | 94 | omx_base = GST_OMX_BASE_FILTER (instance); 95 | 96 | GST_DEBUG_OBJECT (omx_base, "start"); 97 | 98 | omx_base->use_timestamps = FALSE; 99 | } 100 | -------------------------------------------------------------------------------- /omx/gstomx_vorbisdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_VORBISDEC_H 23 | #define GSTOMX_VORBISDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_VORBISDEC(obj) (GstOmxVorbisDec *) (obj) 29 | #define GST_OMX_VORBISDEC_TYPE (gst_omx_vorbisdec_get_type ()) 30 | typedef struct GstOmxVorbisDec GstOmxVorbisDec; 31 | typedef struct GstOmxVorbisDecClass GstOmxVorbisDecClass; 32 | 33 | #include "gstomx_base_audiodec.h" 34 | 35 | struct GstOmxVorbisDec 36 | { 37 | GstOmxBaseAudioDec omx_base; 38 | }; 39 | 40 | struct GstOmxVorbisDecClass 41 | { 42 | GstOmxBaseAudioDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_vorbisdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_VORBISDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/gstomx_wmvdec.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include "gstomx_wmvdec.h" 23 | #include "gstomx.h" 24 | 25 | GSTOMX_BOILERPLATE (GstOmxWmvDec, gst_omx_wmvdec, GstOmxBaseVideoDec, 26 | GST_OMX_BASE_VIDEODEC_TYPE); 27 | 28 | static GstCaps * 29 | generate_sink_template (void) 30 | { 31 | GstCaps *caps; 32 | GstStructure *struc; 33 | 34 | caps = gst_caps_new_empty (); 35 | 36 | struc = gst_structure_new ("video/x-wmv", 37 | "width", GST_TYPE_INT_RANGE, 16, 4096, 38 | "height", GST_TYPE_INT_RANGE, 16, 4096, 39 | "framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL); 40 | 41 | gst_caps_append_structure (caps, struc); 42 | 43 | return caps; 44 | } 45 | 46 | static void 47 | type_base_init (gpointer g_class) 48 | { 49 | GstElementClass *element_class; 50 | 51 | element_class = GST_ELEMENT_CLASS (g_class); 52 | 53 | gst_element_class_set_details_simple (element_class, 54 | "OpenMAX IL WMV video decoder", 55 | "Codec/Decoder/Video", 56 | "Decodes video in WMV format with OpenMAX IL", "Felipe Contreras"); 57 | 58 | { 59 | GstPadTemplate *template; 60 | 61 | template = gst_pad_template_new ("sink", GST_PAD_SINK, 62 | GST_PAD_ALWAYS, generate_sink_template ()); 63 | 64 | gst_element_class_add_pad_template (element_class, template); 65 | } 66 | } 67 | 68 | static void 69 | type_class_init (gpointer g_class, gpointer class_data) 70 | { 71 | } 72 | 73 | static void 74 | type_instance_init (GTypeInstance * instance, gpointer g_class) 75 | { 76 | GstOmxBaseVideoDec *omx_base; 77 | 78 | omx_base = GST_OMX_BASE_VIDEODEC (instance); 79 | 80 | omx_base->compression_format = OMX_VIDEO_CodingWMV; 81 | } 82 | -------------------------------------------------------------------------------- /omx/gstomx_wmvdec.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef GSTOMX_WMVDEC_H 23 | #define GSTOMX_WMVDEC_H 24 | 25 | #include 26 | 27 | G_BEGIN_DECLS 28 | #define GST_OMX_WMVDEC(obj) (GstOmxWmvDec *) (obj) 29 | #define GST_OMX_WMVDEC_TYPE (gst_omx_wmvdec_get_type ()) 30 | typedef struct GstOmxWmvDec GstOmxWmvDec; 31 | typedef struct GstOmxWmvDecClass GstOmxWmvDecClass; 32 | 33 | #include "gstomx_base_videodec.h" 34 | 35 | struct GstOmxWmvDec 36 | { 37 | GstOmxBaseVideoDec omx_base; 38 | }; 39 | 40 | struct GstOmxWmvDecClass 41 | { 42 | GstOmxBaseVideoDecClass parent_class; 43 | }; 44 | 45 | GType gst_omx_wmvdec_get_type (void); 46 | 47 | G_END_DECLS 48 | #endif /* GSTOMX_WMVDEC_H */ 49 | -------------------------------------------------------------------------------- /omx/headers/OMX_Other.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/felipec/gst-openmax/fd710ad66dbc3fc07c24485c75e64302a44cbc6d/omx/headers/OMX_Other.h -------------------------------------------------------------------------------- /shave-libtool.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # we need sed 4 | SED=@SED@ 5 | if test -z "$SED" ; then 6 | SED=sed 7 | fi 8 | 9 | lt_unmangle () 10 | { 11 | last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` 12 | } 13 | 14 | # the real libtool to use 15 | LIBTOOL="$1" 16 | shift 17 | 18 | # if 1, don't print anything, the underlaying wrapper will do it 19 | pass_though=0 20 | 21 | # scan the arguments, keep the right ones for libtool, and discover the mode 22 | preserved_args= 23 | while test "$#" -gt 0; do 24 | opt="$1" 25 | shift 26 | 27 | case $opt in 28 | --mode=*) 29 | mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` 30 | preserved_args="$preserved_args $opt" 31 | ;; 32 | -o) 33 | lt_output="$1" 34 | preserved_args="$preserved_args $opt" 35 | ;; 36 | *) 37 | preserved_args="$preserved_args $opt" 38 | ;; 39 | esac 40 | done 41 | 42 | case "$mode" in 43 | compile) 44 | # shave will be called and print the actual CC/CXX/LINK line 45 | preserved_args="$preserved_args --shave-mode=$mode" 46 | pass_though=1 47 | ;; 48 | link) 49 | preserved_args="$preserved_args --shave-mode=$mode" 50 | Q=" LINK " 51 | ;; 52 | *) 53 | # let's u 54 | # echo "*** libtool: Unimplemented mode: $mode, fill a bug report" 55 | ;; 56 | esac 57 | 58 | lt_unmangle "$lt_output" 59 | output=$last_result 60 | 61 | if test -z $V; then 62 | if test $pass_though -eq 0; then 63 | echo "$Q$output" 64 | fi 65 | $LIBTOOL --silent $preserved_args 66 | else 67 | echo $LIBTOOL $preserved_args 68 | $LIBTOOL $preserved_args 69 | fi 70 | -------------------------------------------------------------------------------- /shave.in: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # we need sed 4 | SED=@SED@ 5 | if test -z "$SED" ; then 6 | SED=sed 7 | fi 8 | 9 | lt_unmangle () 10 | { 11 | last_result=`echo $1 | $SED -e 's#.libs/##' -e 's#[0-9a-zA-Z_\-\.]*_la-##'` 12 | } 13 | 14 | # the tool to wrap (cc, cxx, ar, ranlib, ..) 15 | tool="$1" 16 | shift 17 | 18 | # the reel tool (to call) 19 | REEL_TOOL="$1" 20 | shift 21 | 22 | pass_through=0 23 | preserved_args= 24 | while test "$#" -gt 0; do 25 | opt="$1" 26 | shift 27 | 28 | case $opt in 29 | --shave-mode=*) 30 | mode=`echo $opt | $SED -e 's/[-_a-zA-Z0-9]*=//'` 31 | ;; 32 | -o) 33 | lt_output="$1" 34 | preserved_args="$preserved_args $opt" 35 | ;; 36 | *) 37 | preserved_args="$preserved_args $opt" 38 | ;; 39 | esac 40 | done 41 | 42 | # mode=link is handled in the libtool wrapper 43 | case "$mode,$tool" in 44 | link,*) 45 | pass_through=1 46 | ;; 47 | *,cxx) 48 | Q=" CXX " 49 | ;; 50 | *,cc) 51 | Q=" CC " 52 | ;; 53 | *,fc) 54 | Q=" FC " 55 | ;; 56 | *,f77) 57 | Q=" F77 " 58 | ;; 59 | *,objc) 60 | Q=" OBJC " 61 | ;; 62 | *,*) 63 | # should not happen 64 | Q=" CC " 65 | ;; 66 | esac 67 | 68 | lt_unmangle "$lt_output" 69 | output=$last_result 70 | 71 | if test -z $V; then 72 | if test $pass_through -eq 0; then 73 | echo "$Q$output" 74 | fi 75 | $REEL_TOOL $preserved_args 76 | else 77 | echo $REEL_TOOL $preserved_args 78 | $REEL_TOOL $preserved_args 79 | fi 80 | -------------------------------------------------------------------------------- /tests/.gitignore: -------------------------------------------------------------------------------- 1 | check_async_queue 2 | check_gstomx 3 | check_libomxil 4 | standalone/libomxil-foo.so 5 | test-registry.reg 6 | -------------------------------------------------------------------------------- /tests/Makefile.am: -------------------------------------------------------------------------------- 1 | SUBDIRS = standalone 2 | 3 | TESTS = check_async_queue \ 4 | check_libomxil \ 5 | check_gstomx 6 | 7 | CHECK_REGISTRY = $(top_builddir)/tests/test-registry.reg 8 | 9 | TESTS_ENVIRONMENT = GST_REGISTRY=$(CHECK_REGISTRY) \ 10 | LD_LIBRARY_PATH=$(builddir)/standalone \ 11 | GST_PLUGIN_PATH=$(top_builddir)/omx \ 12 | OMX_CONFIG=$(srcdir)/gst-openmax.conf 13 | 14 | check_PROGRAMS = 15 | 16 | check_PROGRAMS += check_async_queue 17 | check_async_queue_SOURCES = check_async_queue.c 18 | check_async_queue_CFLAGS = $(CHECK_CFLAGS) $(GTHREAD_CFLAGS) -I$(top_srcdir)/util 19 | check_async_queue_LDADD = $(CHECK_LIBS) $(GTHREAD_LIBS) $(top_builddir)/util/libutil.la 20 | 21 | check_PROGRAMS += check_libomxil 22 | check_libomxil_SOURCES = check_libomxil.c 23 | check_libomxil_CFLAGS = $(CHECK_CFLAGS) $(GTHREAD_CFLAGS) -I$(top_srcdir)/omx/headers 24 | check_libomxil_LDADD = $(CHECK_LIBS) $(GTHREAD_LIBS) -ldl 25 | 26 | check_PROGRAMS += check_gstomx 27 | check_gstomx_SOURCES = check_gstomx.c 28 | check_gstomx_CFLAGS = $(GST_CHECK_CFLAGS) 29 | check_gstomx_LDADD = $(GST_CHECK_LIBS) 30 | -------------------------------------------------------------------------------- /tests/check_gstomx.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2007-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #define BUFFER_SIZE 0x1000 25 | #define BUFFER_COUNT 0x100 26 | #define FLUSH_AT 0x10 27 | 28 | static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink", 29 | GST_PAD_SINK, 30 | GST_PAD_ALWAYS, 31 | GST_STATIC_CAPS_ANY); 32 | 33 | static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src", 34 | GST_PAD_SRC, 35 | GST_PAD_ALWAYS, 36 | GST_STATIC_CAPS_ANY); 37 | 38 | /* some global vars, makes it easy as for the ones above */ 39 | static GMutex *eos_mutex; 40 | static GCond *eos_cond; 41 | static gboolean eos_arrived; 42 | 43 | static gboolean 44 | test_sink_event (GstPad * pad, GstEvent * event) 45 | { 46 | 47 | switch (GST_EVENT_TYPE (event)) { 48 | case GST_EVENT_EOS: 49 | g_mutex_lock (eos_mutex); 50 | eos_arrived = TRUE; 51 | g_cond_signal (eos_cond); 52 | g_mutex_unlock (eos_mutex); 53 | break; 54 | default: 55 | break; 56 | } 57 | 58 | return gst_pad_event_default (pad, event); 59 | } 60 | 61 | static void 62 | helper (gboolean flush) 63 | { 64 | GstElement *filter; 65 | GstBus *bus; 66 | GstPad *mysrcpad; 67 | GstPad *mysinkpad; 68 | 69 | /* init */ 70 | filter = gst_check_setup_element ("omx_dummy"); 71 | mysrcpad = gst_check_setup_src_pad (filter, &srctemplate, NULL); 72 | mysinkpad = gst_check_setup_sink_pad (filter, &sinktemplate, NULL); 73 | 74 | gst_pad_set_active (mysrcpad, TRUE); 75 | gst_pad_set_active (mysinkpad, TRUE); 76 | 77 | /* need to know when we are eos */ 78 | gst_pad_set_event_function (mysinkpad, test_sink_event); 79 | 80 | /* and notify the test run */ 81 | eos_mutex = g_mutex_new (); 82 | eos_cond = g_cond_new (); 83 | eos_arrived = FALSE; 84 | 85 | /* start */ 86 | 87 | fail_unless_equals_int (gst_element_set_state (filter, GST_STATE_PLAYING), 88 | GST_STATE_CHANGE_SUCCESS); 89 | 90 | bus = gst_bus_new (); 91 | 92 | gst_element_set_bus (filter, bus); 93 | 94 | /* send buffers in order */ 95 | { 96 | guint i; 97 | for (i = 0; i < BUFFER_COUNT; i++) { 98 | GstBuffer *inbuffer; 99 | inbuffer = gst_buffer_new_and_alloc (BUFFER_SIZE); 100 | GST_BUFFER_DATA (inbuffer)[0] = i; 101 | ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1); 102 | 103 | fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK); 104 | 105 | if (flush && i % FLUSH_AT == 0) { 106 | gst_pad_push_event (mysrcpad, gst_event_new_flush_start ()); 107 | gst_pad_push_event (mysrcpad, gst_event_new_flush_stop ()); 108 | i += FLUSH_AT; 109 | } 110 | } 111 | } 112 | 113 | { 114 | GstMessage *message; 115 | 116 | /* make sure there's no error on the bus */ 117 | message = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0); 118 | fail_if (message); 119 | } 120 | 121 | gst_pad_push_event (mysrcpad, gst_event_new_eos ()); 122 | /* need to wait a bit to make sure src pad task digested all and sent eos */ 123 | g_mutex_lock (eos_mutex); 124 | while (!eos_arrived) 125 | g_cond_wait (eos_cond, eos_mutex); 126 | g_mutex_unlock (eos_mutex); 127 | 128 | /* check the order of the buffers */ 129 | if (!flush) { 130 | GList *cur; 131 | guint i; 132 | for (cur = buffers, i = 0; cur; cur = g_list_next (cur), i++) { 133 | GstBuffer *buffer; 134 | buffer = cur->data; 135 | fail_unless (GST_BUFFER_DATA (buffer)[0] == i); 136 | } 137 | fail_unless (i == BUFFER_COUNT); 138 | } 139 | 140 | /* cleanup */ 141 | gst_bus_set_flushing (bus, TRUE); 142 | gst_element_set_bus (filter, NULL); 143 | gst_object_unref (GST_OBJECT (bus)); 144 | gst_check_drop_buffers (); 145 | 146 | /* deinit */ 147 | gst_element_set_state (filter, GST_STATE_NULL); 148 | 149 | gst_pad_set_active (mysrcpad, FALSE); 150 | gst_pad_set_active (mysinkpad, FALSE); 151 | gst_check_teardown_src_pad (filter); 152 | gst_check_teardown_sink_pad (filter); 153 | gst_check_teardown_element (filter); 154 | 155 | g_mutex_free (eos_mutex); 156 | g_cond_free (eos_cond); 157 | } 158 | 159 | GST_START_TEST (test_flush) 160 | { 161 | helper (TRUE); 162 | } 163 | 164 | GST_END_TEST 165 | GST_START_TEST (test_basic) 166 | { 167 | helper (FALSE); 168 | } 169 | 170 | GST_END_TEST static Suite * 171 | gstomx_suite (void) 172 | { 173 | Suite *s = suite_create ("gstomx"); 174 | TCase *tc_chain = tcase_create ("general"); 175 | 176 | tcase_set_timeout (tc_chain, 10); 177 | tcase_add_test (tc_chain, test_basic); 178 | tcase_add_test (tc_chain, test_flush); 179 | suite_add_tcase (s, tc_chain); 180 | 181 | return s; 182 | } 183 | 184 | GST_CHECK_MAIN (gstomx); 185 | -------------------------------------------------------------------------------- /tests/gst-openmax.conf: -------------------------------------------------------------------------------- 1 | omx_dummy, 2 | type=GstOmxDummy, 3 | library-name=libomxil-foo.so, 4 | component-name=OMX.bellagio.dummy, 5 | rank=0; 6 | -------------------------------------------------------------------------------- /tests/standalone/Makefile.in: -------------------------------------------------------------------------------- 1 | VPATH = @srcdir@ 2 | 3 | noinst_LIBRARIES = libomxil-foo.so 4 | 5 | libomxil_foo_so_SOURCES = core.c 6 | libomxil_foo_so_CFLAGS = -I$(top_srcdir)/omx/headers $(GTHREAD_CFLAGS) -I$(top_srcdir)/util 7 | libomxil_foo_so_LIBADD = $(GTHREAD_LIBS) ../../util/.libs/libutil.a 8 | 9 | # Manual stuff 10 | 11 | CFLAGS = -ggdb 12 | top_srcdir = @srcdir@/../.. 13 | srcdir = @srcdir@ 14 | CC = gcc 15 | LIBRARIES = $(noinst_LIBRARIES) 16 | GTHREAD_CFLAGS=`pkg-config --cflags gthread-2.0` 17 | GTHREAD_LIBS=`pkg-config --libs gthread-2.0` 18 | 19 | all: 20 | check: $(LIBRARIES) 21 | 22 | libomxil-foo.so: $(patsubst %.c,%.o,$(libomxil_foo_so_SOURCES)) 23 | libomxil-foo.so: CFLAGS := $(CFLAGS) -fPIC $(libomxil_foo_so_CFLAGS) 24 | libomxil-foo.so: LIBS := $(libomxil_foo_so_LIBADD) 25 | 26 | %.so:: 27 | $(CC) $(LDFLAGS) -shared -o $@ $^ $(LIBS) 28 | 29 | .PHONY: clean distclean install 30 | 31 | clean: 32 | rm -rf *.o $(LIBRARIES) 33 | 34 | install: 35 | distdir: 36 | cp -pR $(srcdir)/core.c $(distdir) 37 | cp -pR $(srcdir)/Makefile $(distdir) 38 | distclean: clean 39 | -------------------------------------------------------------------------------- /util/Makefile.am: -------------------------------------------------------------------------------- 1 | noinst_LTLIBRARIES = libutil.la 2 | 3 | libutil_la_SOURCES = async_queue.c async_queue.h \ 4 | sem.c sem.h 5 | 6 | libutil_la_CFLAGS = $(GTHREAD_CFLAGS) 7 | libutil_la_LIBADD = $(GTHREAD_LIBS) 8 | -------------------------------------------------------------------------------- /util/async_queue.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include "async_queue.h" 25 | 26 | AsyncQueue * 27 | async_queue_new (void) 28 | { 29 | AsyncQueue *queue; 30 | 31 | queue = g_slice_new0 (AsyncQueue); 32 | 33 | queue->condition = g_cond_new (); 34 | queue->mutex = g_mutex_new (); 35 | queue->enabled = TRUE; 36 | 37 | return queue; 38 | } 39 | 40 | void 41 | async_queue_free (AsyncQueue * queue) 42 | { 43 | g_cond_free (queue->condition); 44 | g_mutex_free (queue->mutex); 45 | 46 | g_list_free (queue->head); 47 | g_slice_free (AsyncQueue, queue); 48 | } 49 | 50 | void 51 | async_queue_push (AsyncQueue * queue, gpointer data) 52 | { 53 | g_mutex_lock (queue->mutex); 54 | 55 | queue->head = g_list_prepend (queue->head, data); 56 | if (!queue->tail) 57 | queue->tail = queue->head; 58 | queue->length++; 59 | 60 | g_cond_signal (queue->condition); 61 | 62 | g_mutex_unlock (queue->mutex); 63 | } 64 | 65 | gpointer 66 | async_queue_pop (AsyncQueue * queue) 67 | { 68 | gpointer data = NULL; 69 | 70 | g_mutex_lock (queue->mutex); 71 | 72 | if (!queue->enabled) { 73 | /* g_warning ("not enabled!"); */ 74 | goto leave; 75 | } 76 | 77 | if (!queue->tail) { 78 | g_cond_wait (queue->condition, queue->mutex); 79 | } 80 | 81 | if (queue->tail) { 82 | GList *node = queue->tail; 83 | data = node->data; 84 | 85 | queue->tail = node->prev; 86 | if (queue->tail) 87 | queue->tail->next = NULL; 88 | else 89 | queue->head = NULL; 90 | queue->length--; 91 | g_list_free_1 (node); 92 | } 93 | 94 | leave: 95 | g_mutex_unlock (queue->mutex); 96 | 97 | return data; 98 | } 99 | 100 | gpointer 101 | async_queue_pop_forced (AsyncQueue * queue) 102 | { 103 | gpointer data = NULL; 104 | 105 | g_mutex_lock (queue->mutex); 106 | 107 | if (queue->tail) { 108 | GList *node = queue->tail; 109 | data = node->data; 110 | 111 | queue->tail = node->prev; 112 | if (queue->tail) 113 | queue->tail->next = NULL; 114 | else 115 | queue->head = NULL; 116 | queue->length--; 117 | g_list_free_1 (node); 118 | } 119 | 120 | g_mutex_unlock (queue->mutex); 121 | 122 | return data; 123 | } 124 | 125 | void 126 | async_queue_disable (AsyncQueue * queue) 127 | { 128 | g_mutex_lock (queue->mutex); 129 | queue->enabled = FALSE; 130 | g_cond_broadcast (queue->condition); 131 | g_mutex_unlock (queue->mutex); 132 | } 133 | 134 | void 135 | async_queue_enable (AsyncQueue * queue) 136 | { 137 | g_mutex_lock (queue->mutex); 138 | queue->enabled = TRUE; 139 | g_mutex_unlock (queue->mutex); 140 | } 141 | 142 | void 143 | async_queue_flush (AsyncQueue * queue) 144 | { 145 | g_mutex_lock (queue->mutex); 146 | g_list_free (queue->head); 147 | queue->head = queue->tail = NULL; 148 | queue->length = 0; 149 | g_mutex_unlock (queue->mutex); 150 | } 151 | -------------------------------------------------------------------------------- /util/async_queue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef ASYNC_QUEUE_H 23 | #define ASYNC_QUEUE_H 24 | 25 | #include 26 | 27 | typedef struct AsyncQueue AsyncQueue; 28 | 29 | struct AsyncQueue 30 | { 31 | GMutex *mutex; 32 | GCond *condition; 33 | GList *head; 34 | GList *tail; 35 | guint length; 36 | gboolean enabled; 37 | }; 38 | 39 | AsyncQueue *async_queue_new (void); 40 | void async_queue_free (AsyncQueue * queue); 41 | void async_queue_push (AsyncQueue * queue, gpointer data); 42 | gpointer async_queue_pop (AsyncQueue * queue); 43 | gpointer async_queue_pop_forced (AsyncQueue * queue); 44 | void async_queue_disable (AsyncQueue * queue); 45 | void async_queue_enable (AsyncQueue * queue); 46 | void async_queue_flush (AsyncQueue * queue); 47 | 48 | #endif /* ASYNC_QUEUE_H */ 49 | -------------------------------------------------------------------------------- /util/sem.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #include 23 | 24 | #include "sem.h" 25 | 26 | GSem * 27 | g_sem_new (void) 28 | { 29 | GSem *sem; 30 | 31 | sem = g_new (GSem, 1); 32 | sem->condition = g_cond_new (); 33 | sem->mutex = g_mutex_new (); 34 | sem->counter = 0; 35 | 36 | return sem; 37 | } 38 | 39 | void 40 | g_sem_free (GSem * sem) 41 | { 42 | g_cond_free (sem->condition); 43 | g_mutex_free (sem->mutex); 44 | g_free (sem); 45 | } 46 | 47 | void 48 | g_sem_down (GSem * sem) 49 | { 50 | g_mutex_lock (sem->mutex); 51 | 52 | while (sem->counter == 0) { 53 | g_cond_wait (sem->condition, sem->mutex); 54 | } 55 | 56 | sem->counter--; 57 | 58 | g_mutex_unlock (sem->mutex); 59 | } 60 | 61 | void 62 | g_sem_up (GSem * sem) 63 | { 64 | g_mutex_lock (sem->mutex); 65 | 66 | sem->counter++; 67 | g_cond_signal (sem->condition); 68 | 69 | g_mutex_unlock (sem->mutex); 70 | } 71 | -------------------------------------------------------------------------------- /util/sem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2008-2009 Nokia Corporation. 3 | * 4 | * Author: Felipe Contreras 5 | * 6 | * This library is free software; you can redistribute it and/or 7 | * modify it under the terms of the GNU Lesser General Public 8 | * License as published by the Free Software Foundation 9 | * version 2.1 of the License. 10 | * 11 | * This library is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14 | * Lesser General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU Lesser General Public 17 | * License along with this library; if not, write to the Free Software 18 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 | * 20 | */ 21 | 22 | #ifndef SEM_H 23 | #define SEM_H 24 | 25 | #include 26 | 27 | typedef struct GSem GSem; 28 | 29 | struct GSem 30 | { 31 | GCond *condition; 32 | GMutex *mutex; 33 | gint counter; 34 | }; 35 | 36 | GSem *g_sem_new (void); 37 | void g_sem_free (GSem * sem); 38 | void g_sem_down (GSem * sem); 39 | void g_sem_up (GSem * sem); 40 | 41 | #endif /* SEM_H */ 42 | --------------------------------------------------------------------------------