├── .gitignore ├── AUTHORS ├── COPYING ├── ChangeLog ├── Makefile.am ├── NEWS ├── README ├── autogen.sh ├── config.log ├── configure.ac └── src ├── Makefile.am ├── config ├── Makefile.am └── app.yml ├── hi3518 ├── isp.c ├── isp.h ├── media_audio.c ├── media_audio.h ├── media_osd.c ├── media_osd.h ├── media_sys_ctrl.c ├── media_sys_ctrl.h ├── media_video.c ├── media_video.h ├── mpp2 │ ├── include │ │ ├── acodec.h │ │ ├── hi_ae_comm.h │ │ ├── hi_af_comm.h │ │ ├── hi_awb_comm.h │ │ ├── hi_comm_3a.h │ │ ├── hi_comm_adec.h │ │ ├── hi_comm_aenc.h │ │ ├── hi_comm_ai.h │ │ ├── hi_comm_aio.h │ │ ├── hi_comm_ao.h │ │ ├── hi_comm_isp.h │ │ ├── hi_comm_ive.h │ │ ├── hi_comm_pciv.h │ │ ├── hi_comm_rc.h │ │ ├── hi_comm_region.h │ │ ├── hi_comm_sns.h │ │ ├── hi_comm_sys.h │ │ ├── hi_comm_vb.h │ │ ├── hi_comm_vda.h │ │ ├── hi_comm_vdec.h │ │ ├── hi_comm_venc.h │ │ ├── hi_comm_vi.h │ │ ├── hi_comm_video.h │ │ ├── hi_comm_vo.h │ │ ├── hi_comm_vpss.h │ │ ├── hi_common.h │ │ ├── hi_debug.h │ │ ├── hi_defines.h │ │ ├── hi_errno.h │ │ ├── hi_io.h │ │ ├── hi_isp_debug.h │ │ ├── hi_math.h │ │ ├── hi_mem.h │ │ ├── hi_sns_ctrl.h │ │ ├── hi_tde_api.h │ │ ├── hi_tde_errcode.h │ │ ├── hi_tde_type.h │ │ ├── hi_type.h │ │ ├── hi_vreg.h │ │ ├── hifb.h │ │ ├── list.h │ │ ├── mkp │ │ │ └── mod_ext.h │ │ ├── mpi_adec.h │ │ ├── mpi_ae.h │ │ ├── mpi_aenc.h │ │ ├── mpi_af.h │ │ ├── mpi_ai.h │ │ ├── mpi_ao.h │ │ ├── mpi_awb.h │ │ ├── mpi_isp.h │ │ ├── mpi_ive.h │ │ ├── mpi_pciv.h │ │ ├── mpi_region.h │ │ ├── mpi_sys.h │ │ ├── mpi_vb.h │ │ ├── mpi_vda.h │ │ ├── mpi_vdec.h │ │ ├── mpi_venc.h │ │ ├── mpi_vi.h │ │ ├── mpi_vo.h │ │ └── mpi_vpss.h │ └── lib │ │ ├── libVoiceEngine.a │ │ ├── libaec.a │ │ ├── libanr.a │ │ ├── libresampler.a │ │ └── libvqev2.a ├── sensor │ ├── Makefile.am │ └── sony_imx122 │ │ ├── Makefile.am │ │ ├── imx122_cmos.c │ │ └── imx122_sensor_ctl.c ├── video_detect.c ├── video_detect.h ├── video_encode.c ├── video_encode.h ├── video_input.c ├── video_input.h ├── video_process_subsystem.c └── video_process_subsystem.h ├── imedia.c ├── imedia.h ├── main.c ├── media-ircut.c ├── media-ircut.h ├── rtsp ├── live │ ├── LiveStreamInput.cpp │ ├── LiveStreamInput.hh │ ├── LiveStreamRTSPServer.cpp │ ├── LiveStreamRTSPServer.hh │ ├── LiveStreamServerMediaSession.cpp │ ├── LiveStreamServerMediaSession.hh │ ├── LiveStreamServerMediaSubsession.cpp │ ├── LiveStreamServerMediaSubsession.hh │ ├── LiveStreamSource.cpp │ └── LiveStreamSource.hh ├── rtsp.cpp └── rtsp.h ├── stream_descriptor.h ├── video_param_change_handler.c └── video_param_change_handler.h /.gitignore: -------------------------------------------------------------------------------- 1 | *.anjuta* 2 | build* 3 | *.*~ 4 | *.in 5 | *.cache 6 | INSTALL 7 | aclocal.m4 8 | compile 9 | config.guess 10 | config.sub 11 | configure 12 | depcomp 13 | install-sh 14 | ltmain.sh 15 | missing 16 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/AUTHORS -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/COPYING -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | ## Created by Anjuta 3 | 4 | SUBDIRS = src 5 | 6 | dist_doc_DATA = \ 7 | README \ 8 | COPYING \ 9 | AUTHORS \ 10 | ChangeLog \ 11 | INSTALL \ 12 | NEWS 13 | 14 | 15 | 16 | # Remove doc directory on uninstall 17 | uninstall-local: 18 | -rm -r $(docdir) 19 | -------------------------------------------------------------------------------- /NEWS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/NEWS -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/README -------------------------------------------------------------------------------- /autogen.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Run this to generate all the initial makefiles, etc. 3 | 4 | srcdir=`dirname $0` 5 | test -z "$srcdir" && srcdir=. 6 | 7 | DIE=0 8 | 9 | if [ -n "$GNOME2_DIR" ]; then 10 | ACLOCAL_FLAGS="-I $GNOME2_DIR/share/aclocal $ACLOCAL_FLAGS" 11 | LD_LIBRARY_PATH="$GNOME2_DIR/lib:$LD_LIBRARY_PATH" 12 | PATH="$GNOME2_DIR/bin:$PATH" 13 | export PATH 14 | export LD_LIBRARY_PATH 15 | fi 16 | 17 | (test -f $srcdir/configure.ac) || { 18 | echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" 19 | echo " top-level package directory" 20 | exit 1 21 | } 22 | 23 | (autoconf --version) < /dev/null > /dev/null 2>&1 || { 24 | echo 25 | echo "**Error**: You must have \`autoconf' installed." 26 | echo "Download the appropriate package for your distribution," 27 | echo "or get the source tarball at ftp://ftp.gnu.org/pub/gnu/" 28 | DIE=1 29 | } 30 | 31 | (grep "^IT_PROG_INTLTOOL" $srcdir/configure.ac >/dev/null) && { 32 | (intltoolize --version) < /dev/null > /dev/null 2>&1 || { 33 | echo 34 | echo "**Error**: You must have \`intltool' installed." 35 | echo "You can get it from:" 36 | echo " ftp://ftp.gnome.org/pub/GNOME/" 37 | DIE=1 38 | } 39 | } 40 | 41 | (grep "^AM_PROG_XML_I18N_TOOLS" $srcdir/configure.ac >/dev/null) && { 42 | (xml-i18n-toolize --version) < /dev/null > /dev/null 2>&1 || { 43 | echo 44 | echo "**Error**: You must have \`xml-i18n-toolize' installed." 45 | echo "You can get it from:" 46 | echo " ftp://ftp.gnome.org/pub/GNOME/" 47 | DIE=1 48 | } 49 | } 50 | 51 | (grep "^LT_INIT" $srcdir/configure.ac >/dev/null) && { 52 | (libtool --version) < /dev/null > /dev/null 2>&1 || { 53 | echo 54 | echo "**Error**: You must have \`libtool' installed." 55 | echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" 56 | DIE=1 57 | } 58 | } 59 | 60 | (grep "^AM_GLIB_GNU_GETTEXT" $srcdir/configure.ac >/dev/null) && { 61 | (grep "sed.*POTFILES" $srcdir/configure.ac) > /dev/null || \ 62 | (glib-gettextize --version) < /dev/null > /dev/null 2>&1 || { 63 | echo 64 | echo "**Error**: You must have \`glib' installed." 65 | echo "You can get it from: ftp://ftp.gtk.org/pub/gtk" 66 | DIE=1 67 | } 68 | } 69 | 70 | (automake --version) < /dev/null > /dev/null 2>&1 || { 71 | echo 72 | echo "**Error**: You must have \`automake' installed." 73 | echo "You can get it from: ftp://ftp.gnu.org/pub/gnu/" 74 | DIE=1 75 | NO_AUTOMAKE=yes 76 | } 77 | 78 | 79 | # if no automake, don't bother testing for aclocal 80 | test -n "$NO_AUTOMAKE" || (aclocal --version) < /dev/null > /dev/null 2>&1 || { 81 | echo 82 | echo "**Error**: Missing \`aclocal'. The version of \`automake'" 83 | echo "installed doesn't appear recent enough." 84 | echo "You can get automake from ftp://ftp.gnu.org/pub/gnu/" 85 | DIE=1 86 | } 87 | 88 | if test "$DIE" -eq 1; then 89 | exit 1 90 | fi 91 | 92 | if test -z "$*"; then 93 | echo "**Warning**: I am going to run \`configure' with no arguments." 94 | echo "If you wish to pass any to it, please specify them on the" 95 | echo \`$0\'" command line." 96 | echo 97 | fi 98 | 99 | case $CC in 100 | xlc ) 101 | am_opt=--include-deps;; 102 | esac 103 | 104 | for coin in `find $srcdir -path $srcdir/CVS -prune -o -name configure.ac -print` 105 | do 106 | dr=`dirname $coin` 107 | if test -f $dr/NO-AUTO-GEN; then 108 | echo skipping $dr -- flagged as no auto-gen 109 | else 110 | echo processing $dr 111 | ( cd $dr 112 | 113 | aclocalinclude="$ACLOCAL_FLAGS" 114 | 115 | if grep "^AM_GLIB_GNU_GETTEXT" configure.ac >/dev/null; then 116 | echo "Creating $dr/aclocal.m4 ..." 117 | test -r $dr/aclocal.m4 || touch $dr/aclocal.m4 118 | echo "Running glib-gettextize... Ignore non-fatal messages." 119 | echo "no" | glib-gettextize --force --copy 120 | echo "Making $dr/aclocal.m4 writable ..." 121 | test -r $dr/aclocal.m4 && chmod u+w $dr/aclocal.m4 122 | fi 123 | if grep "^IT_PROG_INTLTOOL" configure.ac >/dev/null; then 124 | echo "Running intltoolize..." 125 | intltoolize --copy --force --automake 126 | fi 127 | if grep "^AM_PROG_XML_I18N_TOOLS" configure.ac >/dev/null; then 128 | echo "Running xml-i18n-toolize..." 129 | xml-i18n-toolize --copy --force --automake 130 | fi 131 | if grep "^LT_INIT" configure.ac >/dev/null; then 132 | if test -z "$NO_LIBTOOLIZE" ; then 133 | echo "Running libtoolize..." 134 | libtoolize --force --copy 135 | fi 136 | fi 137 | echo "Running aclocal $aclocalinclude ..." 138 | aclocal $aclocalinclude 139 | if grep "^A[CM]_CONFIG_HEADER" configure.ac >/dev/null; then 140 | echo "Running autoheader..." 141 | autoheader 142 | fi 143 | echo "Running automake --gnu $am_opt ..." 144 | automake --add-missing --copy --gnu $am_opt 145 | echo "Running autoconf ..." 146 | autoconf 147 | ) 148 | fi 149 | done 150 | 151 | if test x$NOCONFIGURE = x; then 152 | echo Running $srcdir/configure "$@" ... 153 | $srcdir/configure "$@" \ 154 | && echo Now type \`make\' to compile. || exit 1 155 | else 156 | echo Skipping configure process. 157 | fi 158 | -------------------------------------------------------------------------------- /configure.ac: -------------------------------------------------------------------------------- 1 | dnl Process this file with autoconf to produce a configure script. 2 | dnl Created by Anjuta application wizard. 3 | 4 | AC_INIT(imedia_rtsp, 0.1.00) 5 | 6 | AC_CONFIG_HEADERS([config.h]) 7 | 8 | AM_INIT_AUTOMAKE([1.11]) 9 | 10 | AM_SILENT_RULES([yes]) 11 | 12 | AC_PROG_CC 13 | 14 | AM_PROG_CC_C_O 15 | 16 | AC_PROG_CXX 17 | 18 | 19 | LT_INIT 20 | 21 | 22 | PKG_CHECK_MODULES(IMEDIA_RTSP, [libzmq json-glib-1.0 glib-2.0 gobject-2.0 libipcam_base-0.1.0 freetype2 SDL2_ttf]) 23 | 24 | AC_PATH_PROG(PCRECONFIG, pcre-config) 25 | if test x"$PCRECONFIG" != x; then 26 | PCRE_LIBS=`$PCRECONFIG --libs` 27 | PCRE_LIBS_CPP=`$PCRECONFIG --libs-cpp` 28 | PCRE_CPPFLAGS="$CPPFLAGS `$PCRECONFIG --cflags`" 29 | AC_SUBST(PCRE_LIBS) 30 | AC_SUBST(PCRE_LIBS_CPP) 31 | AC_SUBST(PCRE_CPPFLAGS) 32 | else 33 | AC_MSG_ERROR([pcre-config not found, install the pcre-devel package]) 34 | fi 35 | 36 | AC_ARG_ENABLE([hi3518], 37 | AS_HELP_STRING([--enable-hi3518],[Build with hi3518 support (default: disabled)]), 38 | [enable_hi3518=$enableval], 39 | [enable_hi3518=no]) 40 | 41 | AC_ARG_ENABLE([hi3516], 42 | AS_HELP_STRING([--enable-hi3516],[Build with hi3516 support (default: disabled)]), 43 | [enable_hi3516=$enableval], 44 | [enable_hi3516=no]) 45 | 46 | if test "x$enable_hi3518" = "xyes" && test "x$enable_hi3516" = "xyes"; then 47 | AC_MSG_ERROR([Can not enable hi3518 and hi3516 at same time.]) 48 | fi 49 | 50 | if test "x$enable_hi3518" = "xno" && test "x$enable_hi3516" = "xno"; then 51 | AC_MSG_ERROR([Can not continue if there is not select any chip.]) 52 | fi 53 | 54 | AM_CONDITIONAL([HI3518], [test x"$enable_hi3518" = "xyes"]) 55 | AM_CONDITIONAL([HI3516], [test x"$enable_hi3516" = "xyes"]) 56 | 57 | if test "x$enable_hi3518" = "xyes" || test "x$enable_hi3516" = "xyes"; then 58 | trymppdir="" 59 | AC_ARG_WITH(hisimpp, 60 | [ --with-hisimpp=PATH Specify path to hisi mpp installation ], 61 | [ 62 | if test "x$withval" != "xno" ; then 63 | trymppdir=$withval 64 | fi 65 | ] 66 | ) 67 | 68 | 69 | dnl ------------------------------------------------------ 70 | dnl hisimpp detection. swiped from Tor. modified a bit. 71 | 72 | AC_CACHE_CHECK([for hisimpp directory], ac_cv_hisimpp_dir, [ 73 | saved_LIBS="$LIBS" 74 | saved_LDFLAGS="$LDFLAGS" 75 | saved_CFLAGS="$CFLAGS" 76 | mpp_found=no 77 | for mppdir in $trymppdir "" $prefix /usr/local ; do 78 | LDFLAGS="$saved_LDFLAGS" 79 | LIBS="$saved_LIBS $mppdir/lib/libmpi.a $mppdir/lib/lib_hiae.a $mppdir/lib/libanr.a $mppdir/lib/libaec.a $mppdir/lib/lib_hiaf.a $mppdir/lib/lib_hiawb.a $mppdir/lib/libmem.a $mppdir/lib/libtde.a $mppdir/lib/libVoiceEngine.a $mppdir/lib/libresampler.a $mppdir/lib/libisp.a $mppdir/lib/libvqev2.a -lpthread" 80 | 81 | # Skip the directory if it isn't there. 82 | if test ! -z "$mppdir" -a ! -d "$mppdir" ; then 83 | continue; 84 | fi 85 | if test ! -z "$mppdir" ; then 86 | if test -d "$mppdir/lib" ; then 87 | LDFLAGS="-L$mppdir/lib $LDFLAGS" 88 | else 89 | LDFLAGS="-L$mppdir $LDFLAGS" 90 | fi 91 | if test -d "$mppdir/include" ; then 92 | CFLAGS="-I$mppdir/include $CFLAGS" 93 | else 94 | CFLAGS="-I$mppdir $CFLAGS" 95 | fi 96 | fi 97 | # Can I compile and link it? 98 | AC_TRY_LINK([#include 99 | #include ], [ HI_MPI_SYS_Exit(); ], 100 | [ hisimpp_linked=yes ], [ hisimpp_linked=no ]) 101 | if test $hisimpp_linked = yes; then 102 | if test ! -z "$mppdir" ; then 103 | ac_cv_hisimpp_dir=$mppdir 104 | else 105 | ac_cv_hisimpp_dir="(system)" 106 | fi 107 | mpp_found=yes 108 | break 109 | fi 110 | done 111 | LIBS="$saved_LIBS" 112 | LDFLAGS="$saved_LDFLAGS" 113 | CFLAGS="$saved_CFLAGS" 114 | dnl if test $mpp_found = no ; then 115 | dnl AC_MSG_ERROR([hisimpp is required. 116 | 117 | dnl If it's already installed, specify its path using --with-hisimpp=/dir/ 118 | dnl ]) 119 | dnl fi 120 | ]) 121 | dnl LIBS="$LIBS" 122 | if test $mpp_found = yes ; then 123 | if test $ac_cv_hisimpp_dir != "(system)"; then 124 | MPPDIR="$ac_cv_hisimpp_dir" 125 | AC_SUBST(MPPDIR) 126 | if test -d "$ac_cv_hisimpp_dir/lib" ; then 127 | dnl LDFLAGS="-L$ac_cv_hisimpp_dir/lib $LDFLAGS" 128 | MPPLIBDIR="$ac_cv_hisimpp_dir/lib" 129 | else 130 | dnl LDFLAGS="-L$ac_cv_hisimpp_dir $LDFLAGS" 131 | MPPLIBDIR="$ac_cv_hisimpp_dir" 132 | fi 133 | AC_SUBST(MPPLIBDIR) 134 | if test -d "$ac_cv_hisimpp_dir/include" ; then 135 | MPPCFLAGS="-I$ac_cv_hisimpp_dir/include" 136 | else 137 | MPPCFLAGS="-I$ac_cv_hisimpp_dir" 138 | fi 139 | AC_SUBST(MPPCFLAGS) 140 | fi 141 | fi 142 | AM_CONDITIONAL([INTERNAL_MPP], [test $mpp_found = no]) 143 | 144 | if test "x$enable_hi3518" = "xyes"; then 145 | CFLAGS="-DHI3518 $CFLAGS" 146 | CXXFLAGS="-DHI3518 $CXXFLAGS" 147 | fi 148 | 149 | if test "x$enable_hi3516" = "xyes"; then 150 | CFLAGS="-DHI3516 $CFLAGS" 151 | CXXFLAGS="-DHI3516 $CXXFLAGS" 152 | fi 153 | 154 | fi 155 | 156 | AC_OUTPUT([ 157 | Makefile 158 | src/Makefile 159 | src/config/Makefile 160 | src/hi3518/sensor/Makefile 161 | src/hi3518/sensor/sony_imx122/Makefile 162 | 163 | ]) 164 | -------------------------------------------------------------------------------- /src/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | ## Created by Anjuta 4 | 5 | AUTOMAKE_OPTIONS = subdir-objects 6 | 7 | if INTERNAL_MPP 8 | if HI3518 9 | MPP_CFLAGS = -I$(top_srcdir)/src/hi3518/mpp2/include 10 | MPP_LIBDIR = $(top_srcdir)/src/hi3518/mpp2/lib 11 | endif 12 | if HI3516 13 | MPP_CFLAGS = -I$(top_srcdir)/src/hi3518/mpp2/include 14 | MPP_LIBDIR = $(top_srcdir)/src/hi3518/mpp2/lib 15 | endif 16 | else 17 | MPP_CFLAGS = $(MPPCFLAGS) 18 | MPP_LIBDIR = $(MPPLIBDIR) 19 | endif 20 | 21 | AM_CPPFLAGS = \ 22 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ 23 | -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \ 24 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \ 25 | $(IMEDIA_RTSP_CFLAGS) \ 26 | $(PCRE_CPPFLAGS) \ 27 | $(MPP_CFLAGS) 28 | 29 | AM_CFLAGS =\ 30 | -rdynamic\ 31 | -Wall\ 32 | -g 33 | 34 | bindir = $(prefix)/imedia_rtsp 35 | bin_PROGRAMS = imedia_rtsp 36 | 37 | imedia_rtsp_SOURCES = \ 38 | rtsp/rtsp.cpp \ 39 | rtsp/live/LiveStreamRTSPServer.cpp \ 40 | rtsp/live/LiveStreamSource.cpp \ 41 | rtsp/live/LiveStreamInput.cpp \ 42 | rtsp/live/LiveStreamServerMediaSubsession.cpp \ 43 | video_param_change_handler.c \ 44 | imedia.c \ 45 | main.c 46 | 47 | if HI3518 48 | imedia_rtsp_SOURCES += \ 49 | hi3518/media_sys_ctrl.c \ 50 | hi3518/media_video.c \ 51 | hi3518/media_osd.c \ 52 | hi3518/isp.c \ 53 | hi3518/video_encode.c \ 54 | hi3518/video_input.c \ 55 | hi3518/video_process_subsystem.c \ 56 | hi3518/video_detect.c \ 57 | hi3518/media_audio.c \ 58 | hi3518/media_audio.h \ 59 | media-ircut.c \ 60 | media-ircut.h 61 | endif 62 | 63 | if HI3516 64 | imedia_rtsp_SOURCES += \ 65 | hi3518/media_sys_ctrl.c \ 66 | hi3518/media_video.c \ 67 | hi3518/media_osd.c \ 68 | hi3518/isp.c \ 69 | hi3518/video_encode.c \ 70 | hi3518/video_input.c \ 71 | hi3518/video_process_subsystem.c \ 72 | hi3518/video_detect.c \ 73 | hi3518/media_audio.c \ 74 | hi3518/media_audio.h \ 75 | media-ircut.c \ 76 | media-ircut.h 77 | endif 78 | 79 | imedia_rtsp_LDFLAGS = 80 | 81 | imedia_rtsp_LDADD = $(IMEDIA_RTSP_LIBS) $(PCRE_LIBS_CPP) -ldl -L$(MPP_LIBDIR) -lmpi -lmem -lisp -l_hiae -l_hiaf -l_hiawb -ltde $(MPP_LIBDIR)/libanr.a $(MPP_LIBDIR)/libaec.a $(MPP_LIBDIR)/libVoiceEngine.a $(MPP_LIBDIR)/libresampler.a $(MPP_LIBDIR)/libvqev2.a -lliveMedia -lBasicUsageEnvironment -lUsageEnvironment -lgroupsock 82 | 83 | SUBDIRS = \ 84 | config \ 85 | hi3518/sensor 86 | -------------------------------------------------------------------------------- /src/config/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | ## Created by Anjuta 4 | 5 | AM_CPPFLAGS = \ 6 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \ 7 | -DPACKAGE_SRC_DIR=\""$(srcdir)."\" \ 8 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \ 9 | $(IMEDIA_RTSP_CFLAGS) 10 | 11 | AM_CFLAGS =\ 12 | -Wall\ 13 | -g 14 | 15 | 16 | conf_datadir = $(prefix)/imedia_rtsp/config 17 | conf_data_DATA = \ 18 | app.yml 19 | -------------------------------------------------------------------------------- /src/config/app.yml: -------------------------------------------------------------------------------- 1 | token: imedia_rtsp_token 2 | connect: 3 | iconfig: tcp://127.0.0.1:65400 4 | subscribe: 5 | iconfig_pub: tcp://127.0.0.1:65401 6 | itrain_pub: tcp://127.0.0.1:65403 7 | publish: 8 | imedia_rtsp_pub: tcp://127.0.0.1:65402 9 | imedia_rtsp: 10 | image_setting_range: 255 11 | -------------------------------------------------------------------------------- /src/hi3518/isp.h: -------------------------------------------------------------------------------- 1 | #ifndef __ISP_H__ 2 | #define __ISP_H__ 3 | 4 | #include 5 | #include 6 | #include "stream_descriptor.h" 7 | 8 | #define IPCAM_ISP_TYPE (ipcam_isp_get_type()) 9 | #define IPCAM_ISP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_ISP_TYPE, IpcamIsp)) 10 | #define IPCAM_ISP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_ISP_TYPE, IpcamIspClass)) 11 | #define IPCAM_IS_ISP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_ISP_TYPE)) 12 | #define IPCAM_IS_ISP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_ISP_TYPE)) 13 | #define IPCAM_ISP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_ISP_TYPE, IpcamIspClass)) 14 | 15 | typedef struct _IpcamIsp IpcamIsp; 16 | typedef struct _IpcamIspClass IpcamIspClass; 17 | 18 | struct _IpcamIsp 19 | { 20 | GObject parent; 21 | }; 22 | 23 | struct _IpcamIspClass 24 | { 25 | GObjectClass parent_class; 26 | }; 27 | 28 | GType ipcam_isp_get_type(void); 29 | gint32 ipcam_isp_start(IpcamIsp *self, StreamDescriptor desc[]); 30 | void ipcam_isp_stop(IpcamIsp *self); 31 | void ipcam_isp_param_change(IpcamIsp *self, StreamDescriptor desc[]); 32 | void ipcam_isp_set_antiflicker(IpcamIsp *isp, HI_BOOL enable, HI_U8 freq); 33 | 34 | #endif /* __ISP_H__ */ 35 | -------------------------------------------------------------------------------- /src/hi3518/media_audio.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEDIA_AUDIO_H__ 2 | #define __MEDIA_AUDIO_H__ 3 | 4 | #include "stream_descriptor.h" 5 | 6 | struct IpcamMediaAudio; 7 | typedef struct IpcamMediaAudio IpcamMediaAudio; 8 | 9 | IpcamMediaAudio *ipcam_media_audio_new(void); 10 | void ipcam_media_audio_free(IpcamMediaAudio *audio); 11 | 12 | gint32 ipcam_media_audio_start(IpcamMediaAudio *audio, StreamDescriptor *desc); 13 | gint32 ipcam_media_audio_stop(IpcamMediaAudio *audio); 14 | void ipcam_media_audio_param_change(IpcamMediaAudio *audio, StreamDescriptor *desc); 15 | 16 | #endif /* __MEDIA_AUDIO_H__ */ 17 | -------------------------------------------------------------------------------- /src/hi3518/media_osd.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEDIA_OSD_H__ 2 | #define __MEDIA_OSD_H__ 3 | 4 | #include 5 | #include 6 | 7 | struct _IpcamOSDItem; 8 | typedef struct _IpcamOSDItem IpcamOSDItem; 9 | 10 | struct _IpcamOSDStream; 11 | typedef struct _IpcamOSDStream IpcamOSDStream; 12 | 13 | struct _IpcamOSD; 14 | typedef struct _IpcamOSD IpcamOSD; 15 | 16 | /* IpcamOSDItem member functions */ 17 | gboolean ipcam_osd_item_is_enabled(IpcamOSDItem *item); 18 | void ipcam_osd_item_enable(IpcamOSDItem *item); 19 | void ipcam_osd_item_disable(IpcamOSDItem *item); 20 | void ipcam_osd_item_set_text(IpcamOSDItem *item, char const *text); 21 | void ipcam_osd_item_set_layer(IpcamOSDItem *item, int layer); 22 | void ipcam_osd_item_set_font_size(IpcamOSDItem *item, int font_size); 23 | void ipcam_osd_item_set_fgcolor(IpcamOSDItem *item, SDL_Color *color); 24 | void ipcam_osd_item_set_bgcolor(IpcamOSDItem *item, SDL_Color *color); 25 | void ipcam_osd_item_set_position(IpcamOSDItem *item, int left, int top); 26 | void ipcam_osd_item_set_effect(IpcamOSDItem *item, HI_BOOL invert_color, 27 | HI_U32 bg_alpha, HI_U32 fg_alpha); 28 | void ipcam_osd_item_draw_text(IpcamOSDItem *item); 29 | 30 | /* IpcamOSDStream member functions */ 31 | IpcamOSDItem* ipcam_osd_stream_add_item(IpcamOSDStream *stream, char const *name); 32 | void ipcam_osd_stream_delete_item(IpcamOSDStream *stream, IpcamOSDItem *item); 33 | void ipcam_osd_stream_set_image_size(IpcamOSDStream *stream, int width, int height); 34 | IpcamOSDItem* ipcam_osd_stream_lookup_item(IpcamOSDStream *stream, char const *name); 35 | 36 | /* IpcamOSD member functions */ 37 | IpcamOSD* ipcam_osd_new(char const *font_file); 38 | void ipcam_osd_destroy(IpcamOSD *osd); 39 | IpcamOSDStream* ipcam_osd_add_stream(IpcamOSD *osd, VENC_GRP venc_grp); 40 | void ipcam_osd_delete_stream(IpcamOSD *osd, VENC_GRP venc_grp); 41 | void ipcam_osd_set_font_file(IpcamOSD *osd, char const *font_file); 42 | IpcamOSDStream* ipcam_osd_lookup_stream(IpcamOSD *osd, VENC_GRP venc_grp); 43 | IpcamOSDItem* ipcam_osd_lookup_item(IpcamOSD *osd, VENC_GRP venc_grp, char const *name); 44 | 45 | void ipcam_osd_set_item_text(IpcamOSD *osd, VENC_GRP venc_grp, char const *name, char const *text); 46 | 47 | #endif /* __MEDIA_OSD_H__ */ 48 | -------------------------------------------------------------------------------- /src/hi3518/media_sys_ctrl.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include "media_sys_ctrl.h" 8 | #include "stream_descriptor.h" 9 | 10 | G_DEFINE_TYPE(IpcamMediaSysCtrl, ipcam_media_sys_ctrl, G_TYPE_OBJECT); 11 | 12 | #define SYS_ALIGN_WIDTH 16 13 | 14 | static void ipcam_media_sys_ctrl_finalize(GObject *object) 15 | { 16 | ipcam_media_sys_ctrl_uninit_media_system(IPCAM_MEDIA_SYS_CTRL(object)); 17 | G_OBJECT_CLASS(ipcam_media_sys_ctrl_parent_class)->finalize(object); 18 | } 19 | static void ipcam_media_sys_ctrl_init(IpcamMediaSysCtrl *self) 20 | { 21 | } 22 | static void ipcam_media_sys_ctrl_class_init(IpcamMediaSysCtrlClass *klass) 23 | { 24 | GObjectClass *object_class = G_OBJECT_CLASS(klass); 25 | object_class->finalize = &ipcam_media_sys_ctrl_finalize; 26 | } 27 | 28 | void ipcam_media_sys_ctrl_init_media_system(IpcamMediaSysCtrl *self) 29 | { 30 | VB_CONF_S stVbConf; 31 | MPP_SYS_CONF_S stSysConf = {0}; 32 | HI_S32 s32Ret = HI_FAILURE; 33 | 34 | memset(&stVbConf, 0, sizeof(VB_CONF_S)); 35 | stVbConf.u32MaxPoolCnt = VB_MAX_POOLS; 36 | stVbConf.astCommPool[0].u32BlkSize = (CEILING_2_POWER(IMAGE_MAX_WIDTH, SYS_ALIGN_WIDTH) * \ 37 | CEILING_2_POWER(IMAGE_MAX_HEIGHT, SYS_ALIGN_WIDTH) * \ 38 | 2); 39 | stVbConf.astCommPool[0].u32BlkCnt = 12; 40 | memset(stVbConf.astCommPool[0].acMmzName, 0, sizeof(stVbConf.astCommPool[0].acMmzName)); 41 | 42 | HI_MPI_SYS_Exit(); 43 | HI_MPI_VB_Exit(); 44 | 45 | s32Ret = HI_MPI_VB_SetConf(&stVbConf); 46 | if (HI_SUCCESS != s32Ret) 47 | { 48 | g_critical("HI_MPI_VB_SetConf failed with %#x!\n", s32Ret); 49 | return; 50 | } 51 | 52 | s32Ret = HI_MPI_VB_Init(); 53 | if (HI_SUCCESS != s32Ret) 54 | { 55 | g_critical("HI_MPI_VB_Init failed with %#x!\n", s32Ret); 56 | return; 57 | } 58 | 59 | stSysConf.u32AlignWidth = SYS_ALIGN_WIDTH; 60 | s32Ret = HI_MPI_SYS_SetConf(&stSysConf); 61 | if (HI_SUCCESS != s32Ret) 62 | { 63 | g_critical("HI_MPI_SYS_SetConf failed with %#x!\n", s32Ret); 64 | return; 65 | } 66 | 67 | s32Ret = HI_MPI_SYS_Init(); 68 | if (HI_SUCCESS != s32Ret) 69 | { 70 | g_critical("HI_MPI_SYS_Init failed with %#x!\n", s32Ret); 71 | return; 72 | } 73 | } 74 | 75 | void ipcam_media_sys_ctrl_uninit_media_system(IpcamMediaSysCtrl *self) 76 | { 77 | HI_MPI_SYS_Exit(); 78 | HI_MPI_VB_Exit(); 79 | } 80 | -------------------------------------------------------------------------------- /src/hi3518/media_sys_ctrl.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEDIA_SYS_CTRL_H__ 2 | #define __MEDIA_SYS_CTRL_H__ 3 | 4 | #include 5 | #include 6 | 7 | #define IPCAM_MEDIA_SYS_CTRL_TYPE (ipcam_media_sys_ctrl_get_type()) 8 | #define IPCAM_MEDIA_SYS_CTRL(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_MEDIA_SYS_CTRL_TYPE, IpcamMediaSysCtrl)) 9 | #define IPCAM_MEDIA_SYS_CTRL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_MEDIA_SYS_CTRL_TYPE, IpcamMediaSysCtrlClass)) 10 | #define IPCAM_IS_MEDIA_SYS_CTRL(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_MEDIA_SYS_CTRL_TYPE)) 11 | #define IPCAM_IS_MEDIA_SYS_CTRL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_MEDIA_SYS_CTRL_TYPE)) 12 | #define IPCAM_MEDIA_SYS_CTRL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_MEDIA_SYS_CTRL_TYPE, IpcamMediaSysCtrlClass)) 13 | 14 | typedef struct _IpcamMediaSysCtrl IpcamMediaSysCtrl; 15 | typedef struct _IpcamMediaSysCtrlClass IpcamMediaSysCtrlClass; 16 | 17 | struct _IpcamMediaSysCtrl 18 | { 19 | GObject parent; 20 | }; 21 | 22 | struct _IpcamMediaSysCtrlClass 23 | { 24 | GObjectClass parent_class; 25 | }; 26 | 27 | GType ipcam_media_sys_ctrl_get_type(void); 28 | 29 | void ipcam_media_sys_ctrl_init_media_system(IpcamMediaSysCtrl *self); 30 | void ipcam_media_sys_ctrl_uninit_media_system(IpcamMediaSysCtrl *self); 31 | 32 | #endif /* __MEDIA_SYS_CTRL_H__ */ 33 | -------------------------------------------------------------------------------- /src/hi3518/media_video.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEDIA_VIDEO_H__ 2 | #define __MEDIA_VIDEO_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include "video_detect.h" 11 | 12 | #define IPCAM_MEDIA_VIDEO_TYPE (ipcam_media_video_get_type()) 13 | #define IPCAM_MEDIA_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_MEDIA_VIDEO_TYPE, IpcamMediaVideo)) 14 | #define IPCAM_MEDIA_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_MEDIA_VIDEO_TYPE, IpcamMediaVideoClass)) 15 | #define IPCAM_IS_MEDIA_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_MEDIA_VIDEO_TYPE)) 16 | #define IPCAM_IS_MEDIA_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_MEDIA_VIDEO_TYPE)) 17 | #define IPCAM_MEDIA_VIDEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_MEDIA_VIDEO_TYPE, IpcamMediaVideoClass)) 18 | #define IPCAM_MEDIA_VIDEO_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), IPCAM_MEDIA_VIDEO_TYPE, IpcamMediaVideoPrivate)) 19 | 20 | typedef struct _IpcamMediaVideo IpcamMediaVideo; 21 | typedef struct _IpcamMediaVideoClass IpcamMediaVideoClass; 22 | 23 | struct _IpcamMediaVideo 24 | { 25 | GObject parent; 26 | }; 27 | 28 | struct _IpcamMediaVideoClass 29 | { 30 | GObjectClass parent_class; 31 | }; 32 | 33 | GType ipcam_media_video_get_type(void); 34 | 35 | gint32 ipcam_media_video_start_livestream(IpcamMediaVideo *self, 36 | StreamDescriptor desc[], 37 | OD_REGION_INFO od_reg_info[]); 38 | gint32 ipcam_media_video_stop_livestream(IpcamMediaVideo *self); 39 | gint32 ipcam_media_video_query_vi_stat(IpcamMediaVideo *self, VI_CHN_STAT_S *stat); 40 | void ipcam_media_video_param_change(IpcamMediaVideo *self, 41 | StreamDescriptor desc[], 42 | OD_REGION_INFO od_reg_info[]); 43 | 44 | void ipcam_media_video_set_image_parameter(IpcamMediaVideo *self, IpcamMediaImageAttr *attr); 45 | void ipcam_media_video_set_color2grey(IpcamMediaVideo *self, gboolean enabled); 46 | void ipcam_media_video_set_antiflicker(IpcamMediaVideo *self, gboolean enable, guint8 freq); 47 | 48 | #endif /* __MEDIA_VIDEO_H__ */ 49 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_ae_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_ae_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/18 10 | Description : 11 | History : 12 | 1.Date : 2012/12/18 13 | Author : n00168968 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AE_COMM_H__ 18 | #define __HI_AE_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C"{ 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AE_LIB_NAME "hisi_ae_lib" 29 | 30 | /************************** ae ctrl cmd **************************************/ 31 | typedef enum hiAE_CTRL_CMD_E 32 | { 33 | AE_DEBUG_ATTR_SET, 34 | AE_DEBUG_ATTR_GET, 35 | 36 | AE_CTRL_BUTT, 37 | } AE_CTRL_CMD_E; 38 | 39 | typedef struct hiAE_DBG_ATTR_S 40 | { 41 | HI_BOOL bAeBypass; 42 | HI_BOOL bFrameEndUpdateMode; 43 | HI_U32 u32MaxAgain; 44 | HI_U32 u32MinAgin; 45 | HI_U32 u32MaxDgain; 46 | HI_U32 u32MinDgain; 47 | HI_U32 u32MaxIspDgain; 48 | HI_U32 u32MinIspDgain; 49 | HI_U32 u32MaxIntTime; 50 | HI_U32 u32MinIntTime; 51 | HI_U32 u32Compensation; 52 | #if 0 53 | HI_U32 BlackLevel_R; 54 | HI_U32 BlackLevel_Gr; 55 | HI_U32 BlackLevel_Gb; 56 | HI_U32 BlackLevel_B; 57 | #endif 58 | HI_U32 u32Hist01; 59 | HI_U32 u32Hist12; 60 | HI_U32 u32Hist34; 61 | HI_U32 u32Hist45; 62 | HI_BOOL bManualExposureEn; 63 | HI_BOOL bManualAgainEn; 64 | HI_BOOL bManualDgainEn; 65 | HI_BOOL bManualIspDgainEn; 66 | HI_U32 u32ManualExposureLines; 67 | HI_U32 u32ManualAgain; 68 | HI_U32 u32ManualDgain; 69 | HI_U32 u32ManualIspDgain; 70 | HI_U32 au32AeWeights[255]; 71 | }AE_DBG_ATTR_S; 72 | 73 | typedef struct hiAE_DBG_STATUS_S 74 | { 75 | HI_U32 u32FrmNumBgn; 76 | HI_U32 u32FullLines; 77 | HI_U32 u32IntTime; 78 | HI_U32 u32Again; 79 | HI_U32 u32AgainShift; 80 | HI_U32 u32Dgain; 81 | HI_U32 u32DgainShift; 82 | HI_U32 u32IspDgain; 83 | HI_U32 u32IspDgainShift; 84 | HI_U32 u32Exposure; 85 | HI_U32 u32Increment; 86 | HI_U32 u32HistBalance; 87 | HI_S32 u32HistError; 88 | HI_U32 u32ExpoureStep; 89 | HI_U32 u32FrmNumEnd; 90 | }AE_DBG_STATUS_S; 91 | 92 | /************************** sensor's interface to ae *********************/ 93 | 94 | /* eg: 0.35db, enAccuType=AE_ACCURACY_DB, f32Accuracy=0.35 95 | * and the multiply of 0.35db is power(10, (0.35/20)) 96 | * eg: 1/16, 2/16, 3/16 multiplies, enAccuType=AE_ACCURACY_LINEAR, f32Accuracy=0.0625 97 | * eg: 1,2,4,8,16 multiplies, enAccuType=AE_ACCURACY_DB, f32Accuracy=6 98 | */ 99 | typedef enum hiAE_ACCURACY_E 100 | { 101 | AE_ACCURACY_DB = 0, 102 | AE_ACCURACY_LINEAR, 103 | AE_ACCURACY_TABLE, 104 | 105 | AE_ACCURACY_BUTT, 106 | } AE_ACCURACY_E; 107 | 108 | typedef struct hiAE_ACCURACY_S 109 | { 110 | AE_ACCURACY_E enAccuType; 111 | float f32Accuracy; 112 | } AE_ACCURACY_S; 113 | 114 | typedef struct hiAE_SENSOR_DEFAULT_S 115 | { 116 | HI_U8 au8HistThresh[4]; 117 | HI_U8 u8AeCompensation; 118 | 119 | HI_U32 u32LinesPer500ms; 120 | HI_U32 u32FlickerFreq; 121 | 122 | HI_U32 u32FullLinesStd; 123 | HI_U32 u32MaxIntTime; /* unit is line */ 124 | HI_U32 u32MinIntTime; 125 | HI_U32 u32MaxIntTimeTarget; 126 | HI_U32 u32MinIntTimeTarget; 127 | AE_ACCURACY_S stIntTimeAccu; 128 | 129 | HI_U32 u32MaxAgain; 130 | HI_U32 u32MinAgain; 131 | HI_U32 u32MaxAgainTarget; 132 | HI_U32 u32MinAgainTarget; 133 | AE_ACCURACY_S stAgainAccu; 134 | 135 | HI_U32 u32MaxDgain; 136 | HI_U32 u32MinDgain; 137 | HI_U32 u32MaxDgainTarget; 138 | HI_U32 u32MinDgainTarget; 139 | AE_ACCURACY_S stDgainAccu; 140 | 141 | HI_U32 u32MaxISPDgainTarget; 142 | HI_U32 u32MinISPDgainTarget; 143 | HI_U32 u32ISPDgainShift; 144 | } AE_SENSOR_DEFAULT_S; 145 | 146 | typedef struct hiAE_SENSOR_GAININFO_S 147 | { 148 | HI_U32 u32SnsTimes; //10bit precision 149 | HI_U32 u32GainDb; // gain step in db 150 | 151 | } AE_SENSOR_GAININFO_S; 152 | 153 | 154 | typedef struct hiAE_SENSOR_EXP_FUNC_S 155 | { 156 | HI_S32(*pfn_cmos_get_ae_default)(AE_SENSOR_DEFAULT_S *pstAeSnsDft); 157 | 158 | /* the function of sensor set fps */ 159 | HI_VOID(*pfn_cmos_fps_set)(HI_U8 u8Fps, AE_SENSOR_DEFAULT_S *pstAeSnsDft); 160 | HI_VOID(*pfn_cmos_slow_framerate_set)(HI_U16 u16FullLines, AE_SENSOR_DEFAULT_S *pstAeSnsDft); 161 | 162 | /* while isp notify ae to update sensor regs, ae call these funcs. */ 163 | HI_VOID(*pfn_cmos_inttime_update)(HI_U32 u32IntTime); 164 | HI_VOID(*pfn_cmos_gains_update)(HI_U32 u32Again, HI_U32 u32Dgain); 165 | 166 | HI_VOID (*pfn_cmos_again_calc_table)(HI_U32 u32InTimes, AE_SENSOR_GAININFO_S *pstAeSnsGainInfo); 167 | HI_VOID (*pfn_cmos_dgain_calc_table)(HI_U32 u32InTimes, AE_SENSOR_GAININFO_S *pstAeSnsGainInfo); 168 | 169 | } AE_SENSOR_EXP_FUNC_S; 170 | 171 | typedef struct hiAE_SENSOR_REGISTER_S 172 | { 173 | AE_SENSOR_EXP_FUNC_S stSnsExp; 174 | } AE_SENSOR_REGISTER_S; 175 | 176 | #if 0 177 | /************************** lens's interface to ae ********************/ 178 | typedef enum hiAE_MOTOR_IRIS_E 179 | { 180 | AE_DC_MOTOR_IRIS = 0, 181 | AE_STEP_MOTOR_IRIS, 182 | 183 | AE_MOTOR_IRIS_BUTT, 184 | } AE_MOTOR_IRIS_E; 185 | 186 | typedef struct hiAE_DC_MOTOR_IRIS_PARAM_S 187 | { 188 | HI_U32 u32MinPwmValue; 189 | HI_U32 u32MaxPwmValue; 190 | HI_U32 u32PwmOpenValue; 191 | HI_U32 u32PwmCloseValue; 192 | HI_U32 u32PwmHoldValue; 193 | } AE_DC_MOTOR_IRIS_S; 194 | 195 | typedef struct hiAE_STEP_MOTOR_IRIS_PARAM_S 196 | { 197 | HI_S32 s32Rsv; 198 | } AE_STEP_MOTOR_IRIS_S; 199 | 200 | typedef struct hiAE_IRIS_DEFAULT_S 201 | { 202 | HI_BOOL bUpdate; 203 | 204 | AE_MOTOR_IRIS_E enMotorIrisType; 205 | union 206 | { 207 | AE_DC_MOTOR_IRIS_S stDcMotorIris; 208 | AE_STEP_MOTOR_IRIS_S stStepMotorIris; 209 | }; 210 | } AE_IRIS_DEFAULT_S; 211 | 212 | typedef struct hiAE_LENS_EXP_FUNC_S 213 | { 214 | HI_U32(*pfn_lens_get_iris_default)(AE_IRIS_DEFAULT_S *pstIrisDft); 215 | } AE_LENS_EXP_FUNC_S; 216 | 217 | typedef struct hiAE_LENS_REGISTER_S 218 | { 219 | AE_LENS_EXP_FUNC_S stLensExpFunc; 220 | } AE_LENS_REGISTER_S; 221 | 222 | HI_S32 AE_RegisterLens(SENSOR_ID SensorId, 223 | AE_LENS_REGISTER_S *pstRegister); 224 | #endif 225 | 226 | #ifdef __cplusplus 227 | #if __cplusplus 228 | } 229 | #endif 230 | #endif /* End of #ifdef __cplusplus */ 231 | 232 | #endif 233 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_af_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_af_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/20 10 | Description : 11 | History : 12 | 1.Date : 2012/12/20 13 | Author : n00168968 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AF_COMM_H__ 18 | #define __HI_AF_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C"{ 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AF_LIB_NAME "hisi_af_lib" 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_awb_comm.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_awb_comm.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/19 10 | Description : 11 | History : 12 | 1.Date : 2012/12/19 13 | Author : n00168968 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __HI_AWB_COMM_H__ 18 | #define __HI_AWB_COMM_H__ 19 | 20 | #include "hi_type.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C"{ 25 | #endif 26 | #endif /* End of #ifdef __cplusplus */ 27 | 28 | #define HI_AWB_LIB_NAME "hisi_awb_lib" 29 | 30 | /************************** isp ctrl cmd *************************************/ 31 | typedef enum hiAWB_CTRL_CMD_E 32 | { 33 | AWB_SATURATION_SET, 34 | AWB_SATURATION_GET, 35 | 36 | AWB_DEBUG_ATTR_SET, 37 | AWB_DEBUG_ATTR_GET, 38 | 39 | AWB_CTRL_BUTT, 40 | } AWB_CTRL_CMD_E; 41 | 42 | typedef struct hiAWB_DBG_ATTR_S 43 | { 44 | HI_U16 u16Enable; 45 | HI_U16 u16ManualEnable; 46 | HI_U32 u32HighTemp; 47 | HI_U32 u32LowTemp; 48 | HI_U32 u32RefTemp; 49 | HI_U32 u32Zone; 50 | HI_U32 u32DevEnable; 51 | HI_U32 u32ShiftLimit; 52 | HI_U32 u32WhiteLevel; 53 | HI_U32 u32BlackLevel; 54 | HI_U32 u32CrMax; 55 | HI_U32 u32CrMin; 56 | HI_U32 u32CbMax; 57 | HI_U32 u32CbMin; 58 | HI_U32 u32RgainBase; 59 | HI_U32 u32GgainBase; 60 | HI_U32 u32BgainBase; 61 | HI_S32 s32p1; 62 | HI_S32 s32p2; 63 | HI_S32 s32q; 64 | HI_S32 s32a; 65 | HI_S32 s32c; 66 | 67 | HI_U16 u16ManSatEnable; 68 | HI_U16 u16SatTarget; 69 | } AWB_DBG_ATTR_S; 70 | 71 | typedef struct hiAWB_ZONE_DBG_S 72 | { 73 | HI_U16 u16Num; 74 | HI_U32 u32Sum; 75 | HI_U16 u16Rg; 76 | HI_U16 u16Bg; 77 | HI_U32 u32TK; 78 | HI_S32 s32Shift; 79 | HI_U32 u32Weight; 80 | HI_S32 s32Dev; 81 | }AWB_ZONE_DBG_S; 82 | 83 | typedef struct hiAWB_DBG_STATUS_S 84 | { 85 | HI_U32 u32FrmNumBgn; 86 | HI_U32 u32GlobalSum; 87 | HI_U32 u32GlobalRgSta; 88 | HI_U32 u32GlobalBgSta; 89 | HI_U32 u32TK; 90 | HI_U16 u16Rgain; 91 | HI_U16 u16Ggain; 92 | HI_U16 u16Bgain; 93 | HI_U16 au16CCM[9]; 94 | 95 | AWB_ZONE_DBG_S astZoneDebug[255]; 96 | 97 | HI_U32 u32FrmNumEnd; 98 | } AWB_DBG_STATUS_S; 99 | 100 | /************************** sensor's interface to awb *********************/ 101 | typedef struct hiAWB_CCM_S 102 | { 103 | HI_U16 u16HighColorTemp; /* D50 lighting source is recommended */ 104 | HI_U16 au16HighCCM[9]; 105 | HI_U16 u16MidColorTemp; /* D32 lighting source is recommended */ 106 | HI_U16 au16MidCCM[9]; 107 | HI_U16 u16LowColorTemp; /* A lighting source is recommended */ 108 | HI_U16 au16LowCCM[9]; 109 | }AWB_CCM_S; 110 | 111 | typedef struct hiAWB_AGC_TABLE_S 112 | { 113 | HI_BOOL bValid; 114 | 115 | HI_U8 au8Saturation[8]; /* adjust saturation, different iso with different saturation */ 116 | } AWB_AGC_TABLE_S; 117 | 118 | typedef struct hiAWB_SENSOR_DEFAULT_S 119 | { 120 | HI_U16 u16WbRefTemp; /* reference color temperature for WB */ 121 | HI_U16 au16GainOffset[4]; /* gain offset for white balance */ 122 | HI_S32 as32WbPara[6]; /* parameter for wb curve,p2,p1,q1,a1,b1,c1 */ 123 | 124 | AWB_AGC_TABLE_S stAgcTbl; 125 | AWB_CCM_S stCcm; 126 | } AWB_SENSOR_DEFAULT_S; 127 | 128 | typedef struct hiAWB_SENSOR_EXP_FUNC_S 129 | { 130 | HI_S32(*pfn_cmos_get_awb_default)(AWB_SENSOR_DEFAULT_S *pstAwbSnsDft); 131 | } AWB_SENSOR_EXP_FUNC_S; 132 | 133 | typedef struct hiAWB_SENSOR_REGISTER_S 134 | { 135 | AWB_SENSOR_EXP_FUNC_S stSnsExp; 136 | } AWB_SENSOR_REGISTER_S; 137 | 138 | #ifdef __cplusplus 139 | #if __cplusplus 140 | } 141 | #endif 142 | #endif /* End of #ifdef __cplusplus */ 143 | 144 | #endif 145 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_comm_adec.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_adec.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2006/12/15 10 | Last Modified : 11 | Description : 12 | Function List : 13 | History : 14 | 1.Date : 2006/12/15 15 | Author : z50825 16 | Modification : Created file 17 | 2.Date : 2007/5/10 18 | Author : z50825 19 | Modification : add err code 20 | ******************************************************************************/ 21 | 22 | 23 | #ifndef __HI_COMM_ADEC_H__ 24 | #define __HI_COMM_ADEC_H__ 25 | 26 | 27 | #include "hi_type.h" 28 | #include "hi_common.h" 29 | #include "hi_comm_aio.h" 30 | 31 | #ifdef __cplusplus 32 | #if __cplusplus 33 | extern "C"{ 34 | #endif 35 | #endif /* End of #ifdef __cplusplus */ 36 | 37 | typedef struct hiADEC_ATTR_G711_S 38 | { 39 | HI_U32 resv; 40 | }ADEC_ATTR_G711_S; 41 | 42 | typedef struct hiADEC_ATTR_G726_S 43 | { 44 | G726_BPS_E enG726bps; 45 | }ADEC_ATTR_G726_S; 46 | 47 | typedef struct hiADEC_ATTR_ADPCM_S 48 | { 49 | ADPCM_TYPE_E enADPCMType; 50 | }ADEC_ATTR_ADPCM_S; 51 | 52 | typedef struct hiADEC_ATTR_LPCM_S 53 | { 54 | HI_U32 resv; 55 | }ADEC_ATTR_LPCM_S; 56 | 57 | typedef enum hiADEC_MODE_E 58 | { 59 | ADEC_MODE_PACK = 0,/*require input is valid dec pack(a 60 | complete frame encode result), 61 | e.g.the stream get from AENC is a 62 | valid dec pack, the stream know actually 63 | pack len from file is also a dec pack. 64 | this mode is high-performative*/ 65 | ADEC_MODE_STREAM ,/*input is stream,low-performative, 66 | if you couldn't find out whether a stream is 67 | vaild dec pack,you could use 68 | this mode*/ 69 | ADEC_MODE_BUTT 70 | }ADEC_MODE_E; 71 | 72 | typedef struct hiADEC_CH_ATTR_S 73 | { 74 | PAYLOAD_TYPE_E enType; 75 | HI_U32 u32BufSize; /*buf size[2~MAX_AUDIO_FRAME_NUM]*/ 76 | ADEC_MODE_E enMode; /*decode mode*/ 77 | HI_VOID *pValue; 78 | }ADEC_CHN_ATTR_S; 79 | 80 | typedef struct hiADEC_DECODER_S 81 | { 82 | PAYLOAD_TYPE_E enType; 83 | HI_CHAR aszName[16]; 84 | HI_S32 (*pfnOpenDecoder)(HI_VOID *pDecoderAttr, HI_VOID **ppDecoder); /*struct ppDecoder is packed by user,user malloc and free memory for this struct */ 85 | HI_S32 (*pfnDecodeFrm)(HI_VOID *pDecoder, HI_U8 **pu8Inbuf,HI_S32 *ps32LeftByte, 86 | HI_U16 *pu16Outbuf,HI_U32 *pu32OutLen,HI_U32 *pu32Chns); 87 | HI_S32 (*pfnGetFrmInfo)(HI_VOID *pDecoder, HI_VOID *pInfo); 88 | HI_S32 (*pfnCloseDecoder)(HI_VOID *pDecoder); 89 | } ADEC_DECODER_S; 90 | 91 | typedef enum hiEN_ADEC_ERR_CODE_E 92 | { 93 | ADEC_ERR_DECODER_ERR = 64, 94 | ADEC_ERR_BUF_LACK, 95 | ADEC_ERR_VOICE_DEC_TYPE, 96 | ADEC_ERR_VOICE_DEC_FRAMESIZE, 97 | ADEC_ERR_VOICE_DEC_FRAMETYPE, 98 | ADEC_ERR_VOICE_INVALID_DEVICE, 99 | ADEC_ERR_VOICE_INVALID_INBUF, 100 | ADEC_ERR_VOICE_INVALID_OUTBUF, 101 | ADEC_ERR_VOICE_TRANS_DEVICE, 102 | ADEC_ERR_VOICE_TRANS_TYPE, 103 | 104 | } EN_ADEC_ERR_CODE_E; 105 | 106 | 107 | typedef enum hi_ADEC_OUTPUT_MODE_E 108 | { 109 | ADEC_OUTPUT_MODE_BIND = 0, 110 | ADEC_OUTPUT_MODE_MANUAL, 111 | ADEC_OUTPUT_MODE_BUTTL 112 | } ADEC_OUTPUT_MODE_E; 113 | 114 | 115 | 116 | /* invlalid device ID */ 117 | #define HI_ERR_ADEC_INVALID_DEVID HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID) 118 | /* invlalid channel ID */ 119 | #define HI_ERR_ADEC_INVALID_CHNID HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID) 120 | /* at lease one parameter is illagal ,eg, an illegal enumeration value */ 121 | #define HI_ERR_ADEC_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM) 122 | /* channel exists */ 123 | #define HI_ERR_ADEC_EXIST HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST) 124 | /* channel unexists */ 125 | #define HI_ERR_ADEC_UNEXIST HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST) 126 | /* using a NULL point */ 127 | #define HI_ERR_ADEC_NULL_PTR HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR) 128 | /* try to enable or initialize system,device or channel, before configing attribute */ 129 | #define HI_ERR_ADEC_NOT_CONFIG HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG) 130 | /* operation is not supported by NOW */ 131 | #define HI_ERR_ADEC_NOT_SUPPORT HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT) 132 | /* operation is not permitted ,eg, try to change stati attribute */ 133 | #define HI_ERR_ADEC_NOT_PERM HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM) 134 | /* failure caused by malloc memory */ 135 | #define HI_ERR_ADEC_NOMEM HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM) 136 | /* failure caused by malloc buffer */ 137 | #define HI_ERR_ADEC_NOBUF HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF) 138 | /* no data in buffer */ 139 | #define HI_ERR_ADEC_BUF_EMPTY HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY) 140 | /* no buffer for new data */ 141 | #define HI_ERR_ADEC_BUF_FULL HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL) 142 | /* system is not ready,had not initialed or loaded*/ 143 | #define HI_ERR_ADEC_SYS_NOTREADY HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY) 144 | /* decoder internal err */ 145 | #define HI_ERR_ADEC_DECODER_ERR HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_DECODER_ERR) 146 | /* input buffer not enough to decode one frame */ 147 | #define HI_ERR_ADEC_BUF_LACK HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_BUF_LACK) 148 | 149 | 150 | 151 | #define HI_ERR_ADEC_DEC_TYPE HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_DEC_TYPE) 152 | #define HI_ERR_ADEC_DEC_FRAMESIZE HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_DEC_FRAMESIZE) 153 | #define HI_ERR_ADEC_DEC_FRAMETYPE HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_DEC_FRAMETYPE) 154 | #define HI_ERR_ADEC_INVALID_DEVICE HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_INVALID_DEVICE) 155 | #define HI_ERR_ADEC_INVALID_INBUF HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_INVALID_INBUF) 156 | #define HI_ERR_ADEC_INVALID_OUTBUF HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_INVALID_OUTBUF) 157 | #define HI_ERR_ADEC_TRANS_DEVICE HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_TRANS_DEVICE) 158 | #define HI_ERR_ADEC_TRANS_TYPE HI_DEF_ERR(HI_ID_ADEC, EN_ERR_LEVEL_ERROR, ADEC_ERR_VOICE_TRANS_TYPE) 159 | 160 | 161 | 162 | 163 | #ifdef __cplusplus 164 | #if __cplusplus 165 | } 166 | #endif 167 | #endif /* End of #ifdef __cplusplus */ 168 | 169 | #endif/* End of #ifndef __HI_COMM_ADEC_H__*/ 170 | 171 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_comm_aenc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_aenc.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2006/12/15 10 | Last Modified : 11 | Description : 12 | Function List : 13 | History : 14 | 1.Date : 2006/12/15 15 | Author : z50825 16 | Modification : Created file 17 | 2.Date : 2007/5/10 18 | Author : z50825 19 | Modification : add err code 20 | ******************************************************************************/ 21 | 22 | 23 | #ifndef __HI_COMM_AENC_H__ 24 | #define __HI_COMM_AENC_H__ 25 | 26 | #include "hi_type.h" 27 | #include "hi_common.h" 28 | #include "hi_comm_aio.h" 29 | 30 | 31 | #ifdef __cplusplus 32 | #if __cplusplus 33 | extern "C"{ 34 | #endif 35 | #endif /* End of #ifdef __cplusplus */ 36 | 37 | typedef struct hiAENC_ATTR_G711_S 38 | { 39 | HI_U32 resv; /*reserve item*/ 40 | }AENC_ATTR_G711_S; 41 | 42 | typedef struct hiAENC_ATTR_G726_S 43 | { 44 | G726_BPS_E enG726bps; 45 | }AENC_ATTR_G726_S; 46 | 47 | typedef struct hiAENC_ATTR_ADPCM_S 48 | { 49 | ADPCM_TYPE_E enADPCMType; 50 | }AENC_ATTR_ADPCM_S; 51 | 52 | typedef struct hiAENC_ATTR_LPCM_S 53 | { 54 | HI_U32 resv; /*reserve item*/ 55 | }AENC_ATTR_LPCM_S; 56 | 57 | typedef struct hiAENC_ENCODER_S 58 | { 59 | PAYLOAD_TYPE_E enType; 60 | HI_U32 u32MaxFrmLen; 61 | HI_CHAR aszName[16]; /* encoder type,be used to print proc information */ 62 | HI_S32 (*pfnOpenEncoder)(HI_VOID *pEncoderAttr, HI_VOID **ppEncoder); /* pEncoder is the handle to control the encoder */ 63 | HI_S32 (*pfnEncodeFrm)(HI_VOID *pEncoder, const AUDIO_FRAME_S *pstData, 64 | HI_U8 *pu8Outbuf,HI_U32 *pu32OutLen); 65 | HI_S32 (*pfnCloseEncoder)(HI_VOID *pEncoder); 66 | } AENC_ENCODER_S; 67 | 68 | typedef struct hiAENC_CHN_ATTR_S 69 | { 70 | PAYLOAD_TYPE_E enType; /*payload type ()*/ 71 | HI_U32 u32BufSize; /*buf size [2~MAX_AUDIO_FRAME_NUM]*/ 72 | HI_VOID *pValue; /*point to attribute of definite audio encoder*/ 73 | }AENC_CHN_ATTR_S; 74 | 75 | typedef enum hiEN_AENC_ERR_CODE_E 76 | { 77 | ADEC_ERR_ENCODER_ERR = 64 , 78 | 79 | } EN_AENC_ERR_CODE_E; 80 | 81 | /* invlalid device ID */ 82 | #define HI_ERR_AENC_INVALID_DEVID HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_DEVID) 83 | /* invlalid channel ID */ 84 | #define HI_ERR_AENC_INVALID_CHNID HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID) 85 | /* at lease one parameter is illagal ,eg, an illegal enumeration value */ 86 | #define HI_ERR_AENC_ILLEGAL_PARAM HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_ILLEGAL_PARAM) 87 | /* channel exists */ 88 | #define HI_ERR_AENC_EXIST HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_EXIST) 89 | /* channel unexists */ 90 | #define HI_ERR_AENC_UNEXIST HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_UNEXIST) 91 | /* using a NULL point */ 92 | #define HI_ERR_AENC_NULL_PTR HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_NULL_PTR) 93 | /* try to enable or initialize system,device or channel, before configing attribute */ 94 | #define HI_ERR_AENC_NOT_CONFIG HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_CONFIG) 95 | /* operation is not supported by NOW */ 96 | #define HI_ERR_AENC_NOT_SUPPORT HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_SUPPORT) 97 | /* operation is not permitted ,eg, try to change static attribute */ 98 | #define HI_ERR_AENC_NOT_PERM HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOT_PERM) 99 | /* failure caused by malloc memory */ 100 | #define HI_ERR_AENC_NOMEM HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOMEM) 101 | /* failure caused by malloc buffer */ 102 | #define HI_ERR_AENC_NOBUF HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_NOBUF) 103 | /* no data in buffer */ 104 | #define HI_ERR_AENC_BUF_EMPTY HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_EMPTY) 105 | /* no buffer for new data */ 106 | #define HI_ERR_AENC_BUF_FULL HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_BUF_FULL) 107 | /* system is not ready,had not initialed or loaded*/ 108 | #define HI_ERR_AENC_SYS_NOTREADY HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, EN_ERR_SYS_NOTREADY) 109 | /* encoder internal err */ 110 | #define HI_ERR_AENC_ENCODER_ERR HI_DEF_ERR(HI_ID_AENC, EN_ERR_LEVEL_ERROR, ADEC_ERR_ENCODER_ERR) 111 | 112 | 113 | #ifdef __cplusplus 114 | #if __cplusplus 115 | } 116 | #endif 117 | #endif /* End of #ifdef __cplusplus */ 118 | 119 | #endif/* End of #ifndef __HI_COMM_AENC_H__*/ 120 | 121 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_comm_ai.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ai.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AI_H__ 19 | #define __HI_COMM_AI_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | #ifdef __cplusplus 30 | #if __cplusplus 31 | } 32 | #endif 33 | #endif /* End of #ifdef __cplusplus */ 34 | 35 | #endif /* End of #ifndef __HI_COMM_AI_H__ */ 36 | 37 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_comm_aio.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/include/hi_comm_aio.h -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_comm_ao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_ao.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef __HI_COMM_AO_H__ 19 | #define __HI_COMM_AO_H__ 20 | 21 | #ifdef __cplusplus 22 | #if __cplusplus 23 | extern "C"{ 24 | #endif 25 | #endif /* End of #ifdef __cplusplus */ 26 | 27 | 28 | 29 | 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | } 33 | #endif 34 | #endif /* End of #ifdef __cplusplus */ 35 | 36 | #endif /* End of #ifndef __HI_COMM_AO_H__ */ 37 | 38 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_comm_sns.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi_comm_sns.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2011/01/05 10 | Description : 11 | History : 12 | 1.Date : 2011/01/05 13 | Author : x00100808 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __HI_COMM_SNS_H__ 19 | #define __HI_COMM_SNS_H__ 20 | 21 | #include "hi_type.h" 22 | #include "hi_common.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | typedef struct hiISP_CMOS_BLACK_LEVEL_S 31 | { 32 | HI_BOOL bUpdate; 33 | 34 | HI_U16 au16BlackLevel[4]; 35 | } ISP_CMOS_BLACK_LEVEL_S; 36 | 37 | typedef struct hiISP_CMOS_AGC_TABLE_S 38 | { 39 | HI_BOOL bValid; 40 | 41 | HI_U8 au8SharpenAltD[8]; /* adjust image edge,different iso with different sharp strength */ 42 | HI_U8 au8SharpenAltUd[8]; /* adjust image texture, different iso with different strength */ 43 | HI_U8 au8SnrThresh[8]; /* adjust denoise strength, different iso with different strength */ 44 | HI_U8 au8DemosaicLumThresh[8]; 45 | HI_U8 au8DemosaicNpOffset[8]; 46 | HI_U8 au8GeStrength[8]; 47 | } ISP_CMOS_AGC_TABLE_S; 48 | 49 | typedef struct hiISP_CMOS_NOISE_TABLE_S 50 | { 51 | HI_BOOL bValid; 52 | 53 | HI_U8 au8NoiseProfileWeightLut[128]; 54 | HI_U8 au8DemosaicWeightLut[128]; 55 | } ISP_CMOS_NOISE_TABLE_S; 56 | 57 | typedef struct hiISP_CMOS_DEMOSAIC_S 58 | { 59 | HI_BOOL bValid; 60 | 61 | HI_U8 u8VhSlope; 62 | HI_U8 u8AaSlope; 63 | HI_U8 u8VaSlope; 64 | HI_U8 u8UuSlope; 65 | HI_U8 u8SatSlope; 66 | HI_U8 u8AcSlope; 67 | HI_U16 u16VhThresh; 68 | HI_U16 u16AaThresh; 69 | HI_U16 u16VaThresh; 70 | HI_U16 u16UuThresh; 71 | HI_U16 u16SatThresh; 72 | HI_U16 u16AcThresh; 73 | } ISP_CMOS_DEMOSAIC_S; 74 | 75 | typedef struct hiISP_CMOS_DRC_S 76 | { 77 | HI_U8 u8DrcBlack; 78 | HI_U8 u8DrcVs; /* variance space */ 79 | HI_U8 u8DrcVi; /* variance intensity */ 80 | HI_U8 u8DrcSm; /* slope max */ 81 | HI_U16 u16DrcWl; /* white level */ 82 | } ISP_CMOS_DRC_S; 83 | 84 | #define LUT_FACTOR (8) 85 | #define GAMMA_FE_LUT_SIZE ((1< 41 | #endif 42 | 43 | #include "hi_type.h" 44 | #include "hi_common.h" 45 | 46 | #ifdef __cplusplus 47 | #if __cplusplus 48 | extern "C"{ 49 | #endif 50 | #endif /* __cplusplus */ 51 | 52 | #define _EX__FILE_LINE(fxx,lxx) "[File]:"fxx"\n[Line]:"#lxx"\n[Info]:" 53 | #define EX__FILE_LINE(fxx,lxx) _EX__FILE_LINE(fxx,lxx) 54 | #define __FILE_LINE__ EX__FILE_LINE(__FILE__, __LINE__) 55 | 56 | #define HI_DBG_EMERG 0 /* system is unusable */ 57 | #define HI_DBG_ALERT 1 /* action must be taken immediately */ 58 | #define HI_DBG_CRIT 2 /* critical conditions */ 59 | #define HI_DBG_ERR 3 /* error conditions */ 60 | #define HI_DBG_WARN 4 /* warning conditions */ 61 | #define HI_DBG_NOTICE 5 /* normal but significant condition */ 62 | #define HI_DBG_INFO 6 /* informational */ 63 | #define HI_DBG_DEBUG 7 /* debug-level messages */ 64 | 65 | typedef struct hiLOG_LEVEL_CONF_S 66 | { 67 | MOD_ID_E enModId; 68 | HI_S32 s32Level; 69 | HI_CHAR cModName[16]; 70 | } LOG_LEVEL_CONF_S; 71 | 72 | #ifndef __KERNEL__ 73 | /****************************************************************************** 74 | ** For User Mode : HI_PRINT, HI_ASSERT, HI_TRACE 75 | ******************************************************************************/ 76 | 77 | #define HI_PRINT printf 78 | 79 | #ifdef HI_DEBUG 80 | /* Using samples: HI_ASSERT(x>y); */ 81 | #define HI_ASSERT(expr) \ 82 | do{ \ 83 | if (!(expr)) { \ 84 | printf("\nASSERT failed at:\n"\ 85 | " >File name: %s\n" \ 86 | " >Function : %s\n" \ 87 | " >Line No. : %d\n" \ 88 | " >Condition: %s\n", \ 89 | __FILE__,__FUNCTION__, __LINE__, #expr);\ 90 | _exit(-1);\ 91 | } \ 92 | }while(0) 93 | 94 | /* Using samples: 95 | ** HI_TRACE(HI_DBG_DEBUG, HI_ID_CMPI, "Test %d, %s\n", 12, "Test"); 96 | **/ 97 | #define HI_TRACE(level, enModId, fmt...) fprintf(stderr,##fmt) 98 | #else 99 | #define HI_ASSERT(expr) 100 | #define HI_TRACE(level, enModId, fmt...) 101 | #endif 102 | 103 | #else 104 | /****************************************************************************** 105 | ** For Linux Kernel : HI_PRINT, HI_ASSERT, HI_TRACE 106 | ******************************************************************************/ 107 | 108 | #define HI_PRINT printk 109 | 110 | extern HI_S32 HI_ChkLogLevel(HI_S32 s32Levle, MOD_ID_E enModId); 111 | asmlinkage int HI_LOG(HI_S32 level, MOD_ID_E enModId,const char *fmt, ...); 112 | 113 | #ifdef HI_DEBUG 114 | /* Using samples: HI_ASSERT(x>y); */ 115 | #define HI_ASSERT(expr) \ 116 | do{ \ 117 | if (!(expr)) { \ 118 | panic("\nASSERT failed at:\n" \ 119 | " >File name: %s\n" \ 120 | " >Function : %s\n" \ 121 | " >Line No. : %d\n" \ 122 | " >Condition: %s\n", \ 123 | __FILE__,__FUNCTION__, __LINE__, #expr);\ 124 | } \ 125 | }while(0) 126 | 127 | /* Using samples: 128 | ** HI_TRACE(HI_DBG_DEBUG, HI_ID_CMPI, "Test %d, %s\n", 12, "Test"); 129 | **/ 130 | #define HI_TRACE HI_LOG 131 | #else 132 | #define HI_ASSERT(expr) 133 | #define HI_TRACE(level, enModId, fmt...) 134 | #endif 135 | 136 | #endif /* end of __KERNEL__ */ 137 | 138 | #ifdef __cplusplus 139 | #if __cplusplus 140 | } 141 | #endif 142 | #endif /* __cplusplus */ 143 | 144 | #endif /* __HI_DEBUG_H__ */ 145 | 146 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_defines.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/include/hi_defines.h -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_errno.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 3 | ****************************************************************************** 4 | File Name : hi_common.h 5 | Version : Initial Draft 6 | Author : Hi3511 MPP Team 7 | Created : 2006/11/09 8 | Last Modified : 9 | Description : define the format of error code 10 | Function List : 11 | History : 12 | 1.Date : 2007/02/14 13 | Author : c42025 14 | Modification: Created file 15 | 16 | 2.Date : 2007/12/11 17 | Author : c42025 18 | Modification: add some MOD_ID for several modules 19 | 20 | 3.Date : 2008/02/03 21 | Author : c42025 22 | Modification: reoorder MOD_ID to cleanup modules at specified order 23 | 24 | 4.Date : 2008/03/01 25 | Author : c42025 26 | Modification: move LOG_ERRLEVEL_E to hi_debug.h, and add new definion 27 | ERR_LEVLE_E, we should use this enumeration in our error code. 28 | 29 | 5.Date : 2008/04/30 30 | Author : c42025 31 | Modification: delete two error code "EN_ERR_NOCHN" and "EN_ERR_NODEV". 32 | 33 | ******************************************************************************/ 34 | #ifndef __HI_ERRNO_H__ 35 | #define __HI_ERRNO_H__ 36 | 37 | #include "hi_debug.h" 38 | 39 | #ifdef __cplusplus 40 | #if __cplusplus 41 | extern "C"{ 42 | #endif 43 | #endif /* End of #ifdef __cplusplus */ 44 | 45 | 46 | /* 1010 0000b 47 | * VTOP use APPID from 0~31 48 | * so, hisilicon use APPID based on 32 49 | */ 50 | #define HI_ERR_APPID (0x80000000L + 0x20000000L) 51 | 52 | typedef enum hiERR_LEVEL_E 53 | { 54 | EN_ERR_LEVEL_DEBUG = 0, /* debug-level */ 55 | EN_ERR_LEVEL_INFO, /* informational */ 56 | EN_ERR_LEVEL_NOTICE, /* normal but significant condition */ 57 | EN_ERR_LEVEL_WARNING, /* warning conditions */ 58 | EN_ERR_LEVEL_ERROR, /* error conditions */ 59 | EN_ERR_LEVEL_CRIT, /* critical conditions */ 60 | EN_ERR_LEVEL_ALERT, /* action must be taken immediately */ 61 | EN_ERR_LEVEL_FATAL, /* just for compatibility with previous version */ 62 | EN_ERR_LEVEL_BUTT 63 | }ERR_LEVEL_E; 64 | 65 | 66 | /****************************************************************************** 67 | |----------------------------------------------------------------| 68 | | 1 | APP_ID | MOD_ID | ERR_LEVEL | ERR_ID | 69 | |----------------------------------------------------------------| 70 | |<--><--7bits----><----8bits---><--3bits---><------13bits------->| 71 | ******************************************************************************/ 72 | 73 | #define HI_DEF_ERR( module, level, errid) \ 74 | ((HI_S32)( (HI_ERR_APPID) | ((module) << 16 ) | ((level)<<13) | (errid) )) 75 | 76 | /* NOTE! the following defined all common error code, 77 | ** all module must reserved 0~63 for their common error code 78 | */ 79 | typedef enum hiEN_ERR_CODE_E 80 | { 81 | EN_ERR_INVALID_DEVID = 1, /* invlalid device ID */ 82 | EN_ERR_INVALID_CHNID = 2, /* invlalid channel ID */ 83 | EN_ERR_ILLEGAL_PARAM = 3, /* at lease one parameter is illagal 84 | * eg, an illegal enumeration value */ 85 | EN_ERR_EXIST = 4, /* resource exists */ 86 | EN_ERR_UNEXIST = 5, /* resource unexists */ 87 | 88 | EN_ERR_NULL_PTR = 6, /* using a NULL point */ 89 | 90 | EN_ERR_NOT_CONFIG = 7, /* try to enable or initialize system, device 91 | ** or channel, before configing attribute */ 92 | 93 | EN_ERR_NOT_SUPPORT = 8, /* operation or type is not supported by NOW */ 94 | EN_ERR_NOT_PERM = 9, /* operation is not permitted 95 | ** eg, try to change static attribute */ 96 | 97 | EN_ERR_NOMEM = 12,/* failure caused by malloc memory */ 98 | EN_ERR_NOBUF = 13,/* failure caused by malloc buffer */ 99 | 100 | EN_ERR_BUF_EMPTY = 14,/* no data in buffer */ 101 | EN_ERR_BUF_FULL = 15,/* no buffer for new data */ 102 | 103 | EN_ERR_SYS_NOTREADY = 16,/* System is not ready,maybe not initialed or 104 | ** loaded. Returning the error code when opening 105 | ** a device file failed. */ 106 | 107 | EN_ERR_BADADDR = 17,/* bad address, 108 | ** eg. used for copy_from_user & copy_to_user */ 109 | 110 | EN_ERR_BUSY = 18,/* resource is busy, 111 | ** eg. destroy a venc chn without unregister it */ 112 | 113 | EN_ERR_BUTT = 63,/* maxium code, private error code of all modules 114 | ** must be greater than it */ 115 | }EN_ERR_CODE_E; 116 | 117 | 118 | /* 119 | ** following is an example for defining error code of VDA module 120 | ** #define HI_ERR_MD_INVALID_CHNID HI_DEF_ERR(HI_ID_VDA, EN_ERR_LEVEL_ERROR, EN_ERR_INVALID_CHNID) 121 | ** 122 | */ 123 | 124 | #ifdef __cplusplus 125 | #if __cplusplus 126 | } 127 | #endif 128 | #endif /* __cplusplus */ 129 | 130 | #endif /* __HI_ERRNO_H__ */ 131 | 132 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/hi_io.h: -------------------------------------------------------------------------------- 1 | #ifndef __HI_IO_H__ 2 | #define __HI_IO_H__ 3 | 4 | #include "hi_type.h" 5 | 6 | #ifdef __cplusplus 7 | extern "C" 8 | { 9 | #endif /* __cplusplus */ 10 | 11 | /* user and kernel are different. */ 12 | HI_U8 IO_READ8(HI_U32 u32Addr); 13 | HI_S32 IO_WRITE8(HI_U32 u32Addr, HI_U32 u32Value); 14 | HI_U16 IO_READ16(HI_U32 u32Addr); 15 | HI_S32 IO_WRITE16(HI_U32 u32Addr, HI_U32 u32Value); 16 | HI_U32 IO_READ32(HI_U32 u32Addr); 17 | HI_S32 IO_WRITE32(HI_U32 u32Addr, HI_U32 u32Value); 18 | HI_U32 ISP_Mmap(void); 19 | HI_U32 ISP_Munmap(void); 20 | HI_U32 ISP_GetExtRegAddr(void); 21 | 22 | #define REG_ACCESS_WIDTH 0 // 1: 16bit 2: 8bit 23 | #define EXT_REG_BASE 0x10200 24 | #define ISP_REG_BASE_ADDR 0x205a0000 25 | 26 | #define EXT_REG_BASE_ISP 0x8000 27 | #define EXT_REG_BASE_VIU 0x8400 28 | #define EXT_REG_BASE_VPP 0x8600 29 | #define EXT_REG_BASE_VEDU 0x8800 30 | #define EXT_REG_BASE_VOU 0x8A00 31 | 32 | /* Dynamic bus access functions, 4 byte align access */ 33 | //TODO: allocate dev addr (such as ISP_REG_BASE_ADDR) according to devId. 34 | #define __IO_CALC_ADDRESS_DYNAMIC(BASE, OFFSET) ((HI_U32)(((BASE >= EXT_REG_BASE)? 0 : ISP_REG_BASE_ADDR) + ((((BASE >= EXT_REG_BASE)? (BASE - EXT_REG_BASE) : BASE) + OFFSET)<= EXT_REG_BASE) ? 0 : ISP_REG_BASE) + (BASE)) 80 | 81 | #define IORD_32DIRECT(BASE) IO_READ32(__IO_CALC_ADDRESS_DYNAMIC(BASE)) 82 | #define IORD_16DIRECT(BASE) IO_READ16(__IO_CALC_ADDRESS_DYNAMIC(BASE)) 83 | #define IORD_8DIRECT(BASE) IO_READ8(__IO_CALC_ADDRESS_DYNAMIC(BASE)) 84 | 85 | #define IOWR_32DIRECT(BASE, DATA) IO_WRITE32(__IO_CALC_ADDRESS_DYNAMIC(BASE), (DATA)) 86 | #define IOWR_16DIRECT(BASE, DATA) IO_WRITE16(__IO_CALC_ADDRESS_DYNAMIC(BASE), (DATA)) 87 | #define IOWR_8DIRECT(BASE, DATA) IO_WRITE8(__IO_CALC_ADDRESS_DYNAMIC(BASE), (DATA)) 88 | 89 | 90 | #ifdef __cplusplus 91 | #if __cplusplus 92 | } 93 | #endif 94 | #endif /* End of #ifdef __cplusplus */ 95 | 96 | #endif 97 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/list.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) HighPoint Technologies, Inc. 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 1. Redistributions of source code must retain the above copyright 9 | * notice, this list of conditions and the following disclaimer. 10 | * 2. Redistributions in binary form must reproduce the above copyright 11 | * notice, this list of conditions and the following disclaimer in the 12 | * documentation and/or other materials provided with the distribution. 13 | * 14 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 | * SUCH DAMAGE. 25 | * 26 | * $FreeBSD: src/sys/dev/hptrr/list.h,v 1.2.2.1.4.1 2010/06/14 02:09:06 kensmith Exp $ 27 | */ 28 | /* 29 | * $Id: list.h,v 1.6 2006/10/31 06:25:28 gmm Exp $ 30 | * Copyright (C) 2004-2005 HighPoint Technologies, Inc. All rights reserved. 31 | */ 32 | #ifndef _HPT_LIST_H_ 33 | #define _HPT_LIST_H_ 34 | 35 | #ifndef _LINUX_LIST_H 36 | 37 | #ifndef HPT_INLINE 38 | #define HPT_INLINE __inline 39 | #endif 40 | 41 | typedef unsigned long HPT_UPTR; 42 | 43 | struct list_head { 44 | struct list_head *next, *prev; 45 | }; 46 | 47 | #define LIST_HEAD_INIT(name) { &(name), &(name) } 48 | 49 | #define INIT_LIST_HEAD(ptr) do { (ptr)->next = (ptr); (ptr)->prev = (ptr); } while (0) 50 | 51 | static HPT_INLINE void __list_add(struct list_head * _new, struct list_head * prev, struct list_head * next) 52 | { 53 | next->prev = _new; 54 | _new->next = next; 55 | _new->prev = prev; 56 | prev->next = _new; 57 | } 58 | 59 | static HPT_INLINE void list_add(struct list_head *_new, struct list_head *head) 60 | { 61 | __list_add(_new, head, head->next); 62 | } 63 | 64 | static HPT_INLINE void list_add_tail(struct list_head *_new, struct list_head *head) 65 | { 66 | __list_add(_new, head->prev, head); 67 | } 68 | 69 | static HPT_INLINE void __list_del(struct list_head * prev, struct list_head * next) 70 | { 71 | next->prev = prev; 72 | prev->next = next; 73 | } 74 | 75 | static HPT_INLINE void list_del(struct list_head *entry) 76 | { 77 | __list_del(entry->prev, entry->next); 78 | } 79 | 80 | static HPT_INLINE void list_del_init(struct list_head *entry) 81 | { 82 | __list_del(entry->prev, entry->next); 83 | INIT_LIST_HEAD(entry); 84 | } 85 | 86 | static inline void list_move(struct list_head *list, struct list_head *head) 87 | { 88 | __list_del(list->prev, list->next); 89 | list_add(list, head); 90 | } 91 | 92 | static inline void list_move_tail(struct list_head *list, 93 | struct list_head *head) 94 | { 95 | __list_del(list->prev, list->next); 96 | list_add_tail(list, head); 97 | } 98 | 99 | static HPT_INLINE int list_empty(struct list_head *head) 100 | { 101 | return head->next == head; 102 | } 103 | 104 | static HPT_INLINE void __list_splice(struct list_head *list, 105 | struct list_head *head) 106 | { 107 | struct list_head *first = list->next; 108 | struct list_head *last = list->prev; 109 | struct list_head *at = head->next; 110 | 111 | first->prev = head; 112 | head->next = first; 113 | 114 | last->next = at; 115 | at->prev = last; 116 | } 117 | 118 | static HPT_INLINE void list_splice(struct list_head *list, struct list_head *head) 119 | { 120 | if (!list_empty(list)) 121 | __list_splice(list, head); 122 | } 123 | 124 | static HPT_INLINE void list_splice_init(struct list_head *list, struct list_head *head) 125 | { 126 | if (!list_empty(list)) { 127 | __list_splice(list, head); 128 | INIT_LIST_HEAD(list); 129 | } 130 | } 131 | 132 | /*#define list_entry(ptr, type, member) \ 133 | ((type *)((char *)(ptr)-(HPT_UPTR)(&((type *)0)->member))) */ 134 | #define list_entry(ptr, type, member) \ 135 | ((type *)((unsigned long)(ptr)-((unsigned long)(&((type *)1)->member) - 1))) 136 | 137 | #define list_for_each(pos, head) \ 138 | for (pos = (head)->next; pos != (head); pos = pos->next) 139 | 140 | #define list_for_each_safe(pos, n, head) \ 141 | for (pos = (head)->next, n = pos->next; pos != (head); \ 142 | pos = n, n = pos->next) 143 | 144 | #define get_first_item(attached, type, member) \ 145 | ((type *)((char *)((attached)->next)-(HPT_UPTR)(&((type *)0)->member))) 146 | 147 | #endif 148 | 149 | #endif 150 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mkp/mod_ext.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : hi3511_ext.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2006/12/22 10 | Description : 11 | History : 12 | 1.Date : 2006/12/22 13 | Author : c42025 14 | Modification: Created file 15 | 16 | 2.Date : 2008/02/21 17 | Author : c42025 18 | Modification: add function CMPI_QueryModules, for solving AE6D02922 19 | 20 | 3.Date : 2008/02/26 21 | Author : c42025 22 | Modification: Defect Form : AE6D02922, add two functions "FN_MOD_Notify" 23 | and "FN_MOD_QueryState" . 24 | 25 | 4.Date : 2008/03/03 26 | Author : c42025 27 | Modification: add structure definition "MOD_NAME_S" 28 | 29 | ******************************************************************************/ 30 | #include 31 | #include 32 | #include 33 | 34 | #include "hi_type.h" 35 | #include "hi_errno.h" 36 | 37 | 38 | #ifndef __MOD_EXT_H__ 39 | #define __MOD_EXT_H__ 40 | 41 | #define MAX_MPP_MODULES HI_ID_BUTT 42 | 43 | #define VERSION_MAGIC 20130304 44 | 45 | typedef struct hiMOD_NAME_S 46 | { 47 | MOD_ID_E enModId; 48 | HI_CHAR aModName[16]; 49 | }MOD_NAME_S; 50 | 51 | typedef enum hiMOD_NOTICE_ID_E 52 | { 53 | MOD_NOTICE_STOP = 0x11, 54 | }MOD_NOTICE_ID_E; 55 | 56 | typedef enum hiMOD_STATE_E 57 | { 58 | MOD_STATE_FREE = 0x11, 59 | MOD_STATE_BUSY = 0X22, 60 | }MOD_STATE_E; 61 | 62 | typedef HI_S32 FN_MOD_Init(HI_VOID *); 63 | typedef HI_VOID FN_MOD_Exit(HI_VOID); 64 | typedef HI_VOID FN_MOD_Notify(MOD_NOTICE_ID_E enNoticeId); 65 | typedef HI_VOID FN_MOD_QueryState(MOD_STATE_E *pstState); 66 | typedef HI_U32 FN_MOD_VerChecker(HI_VOID); 67 | 68 | typedef struct hiMPP_MODULE_S 69 | { 70 | struct module *pstOwner; 71 | MOD_ID_E enModId; 72 | 73 | FN_MOD_Init *pfnInit; 74 | FN_MOD_Exit *pfnExit; 75 | FN_MOD_QueryState *pfnQueryState; 76 | FN_MOD_Notify *pfnNotify; 77 | FN_MOD_VerChecker *pfnVerChecker; 78 | 79 | HI_VOID *pstExportFuncs; 80 | HI_VOID *pData; 81 | 82 | HI_CHAR *pVersion; 83 | }UMAP_MODULE_S; 84 | 85 | extern UMAP_MODULE_S g_astModules[MAX_MPP_MODULES]; 86 | extern MOD_NAME_S g_aModName[MAX_MPP_MODULES]; 87 | 88 | extern HI_VOID CMPI_StopModules(HI_VOID); 89 | extern HI_S32 CMPI_QueryModules(HI_VOID); 90 | extern HI_S32 CMPI_InitModules(HI_VOID); 91 | extern HI_VOID CMPI_ExitModules(HI_VOID); 92 | extern HI_S32 CMPI_RegisterMod(UMAP_MODULE_S *pstModules); 93 | extern HI_VOID CMPI_UnRegisterMod(MOD_ID_E enModId); 94 | 95 | 96 | 97 | #define CHECK_FUNC_ENTRY(id) (NULL != (g_astModules[id].pstExportFuncs)) 98 | #define FUNC_ENTRY(type,id) ((type*)(g_astModules[id].pstExportFuncs)) 99 | 100 | #endif /* __MOD_EXT_H__ */ 101 | 102 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_adec.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : ai.c 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/6/15 10 | Description : 11 | History : 12 | 1.Date : 2009/6/19 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef _MPI_ADEC_H__ 19 | #define _MPI_ADEC_H__ 20 | 21 | #include "hi_common.h" 22 | #include "hi_comm_aio.h" 23 | #include "hi_comm_adec.h" 24 | 25 | #ifdef __cplusplus 26 | #if __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | #endif /* __cplusplus */ 31 | 32 | HI_S32 HI_MPI_ADEC_CreateChn(ADEC_CHN AdChn, ADEC_CHN_ATTR_S *pstAttr); 33 | HI_S32 HI_MPI_ADEC_DestroyChn(ADEC_CHN AdChn); 34 | 35 | HI_S32 HI_MPI_ADEC_SendStream(ADEC_CHN AdChn, const AUDIO_STREAM_S *pstStream, HI_BOOL bBlock); 36 | 37 | HI_S32 HI_MPI_ADEC_ClearChnBuf(ADEC_CHN AdChn); 38 | 39 | HI_S32 HI_MPI_ADEC_RegeisterDecoder(HI_S32 *ps32Handle, ADEC_DECODER_S *pstDecoder); 40 | HI_S32 HI_MPI_ADEC_UnRegisterDecoder(HI_S32 s32Handle); 41 | 42 | 43 | #ifdef __cplusplus 44 | #if __cplusplus 45 | } 46 | #endif 47 | #endif /* __cplusplus */ 48 | 49 | #endif 50 | 51 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_ae.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_ae.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/19 10 | Description : 11 | History : 12 | 1.Date : 2012/12/19 13 | Author : n00168968 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __MPI_AE_H__ 18 | #define __MPI_AE_H__ 19 | 20 | #include "hi_comm_isp.h" 21 | #include "hi_comm_3a.h" 22 | #include "hi_ae_comm.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | /* The interface of ae lib register to isp. */ 31 | HI_S32 HI_MPI_AE_Register(ALG_LIB_S *pstAeLib); 32 | HI_S32 HI_MPI_AE_UnRegister(ALG_LIB_S *pstAeLib); 33 | 34 | /* The callback function of sensor register to ae lib. */ 35 | HI_S32 HI_MPI_AE_SensorRegCallBack(ALG_LIB_S *pstAeLib, SENSOR_ID SensorId, 36 | AE_SENSOR_REGISTER_S *pstRegister); 37 | HI_S32 HI_MPI_AE_SensorUnRegCallBack(ALG_LIB_S *pstAeLib, SENSOR_ID SensorId); 38 | 39 | /* The new ae lib is compatible with the old mpi interface. */ 40 | HI_S32 HI_MPI_ISP_SetExposureType(ISP_OP_TYPE_E enExpType); 41 | HI_S32 HI_MPI_ISP_GetExposureType(ISP_OP_TYPE_E *penExpType); 42 | 43 | HI_S32 HI_MPI_ISP_SetAEAttr(const ISP_AE_ATTR_S *pstAEAttr); 44 | HI_S32 HI_MPI_ISP_GetAEAttr(ISP_AE_ATTR_S *pstAEAttr); 45 | 46 | HI_S32 HI_MPI_ISP_SetAEAttrEx(const ISP_AE_ATTR_EX_S *pstAEAttrEx); 47 | HI_S32 HI_MPI_ISP_GetAEAttrEx(ISP_AE_ATTR_EX_S *pstAEAttrEx); 48 | 49 | HI_S32 HI_MPI_ISP_SetExpStaInfo(ISP_EXP_STA_INFO_S *pstExpStatistic); 50 | HI_S32 HI_MPI_ISP_GetExpStaInfo(ISP_EXP_STA_INFO_S *pstExpStatistic); 51 | 52 | HI_S32 HI_MPI_ISP_SetMEAttr(const ISP_ME_ATTR_S *pstMEAttr); 53 | HI_S32 HI_MPI_ISP_GetMEAttr(ISP_ME_ATTR_S *pstMEAttr); 54 | 55 | HI_S32 HI_MPI_ISP_SetMEAttrEx(const ISP_ME_ATTR_EX_S *pstMEAttrEx); 56 | HI_S32 HI_MPI_ISP_GetMEAttrEx(ISP_ME_ATTR_EX_S *pstMEAttrEx); 57 | 58 | HI_S32 HI_MPI_ISP_SetSlowFrameRate(HI_U8 u8Value); 59 | HI_S32 HI_MPI_ISP_GetSlowFrameRate(HI_U8 *pu8Value); 60 | 61 | HI_S32 HI_MPI_ISP_SetAntiFlickerAttr(const ISP_ANTIFLICKER_S *pstAntiflicker); 62 | HI_S32 HI_MPI_ISP_GetAntiFlickerAttr(ISP_ANTIFLICKER_S *pstAntiflicker); 63 | 64 | HI_S32 HI_MPI_ISP_QueryInnerStateInfo(ISP_INNER_STATE_INFO_S *pstInnerStateInfo); 65 | HI_S32 HI_MPI_ISP_QueryInnerStateInfoEx(ISP_INNER_STATE_INFO_EX_S *pstInnerStateInfoEx); 66 | 67 | HI_S32 HI_MPI_ISP_SetIrisType(ISP_OP_TYPE_E enIrisType); //not support yet 68 | HI_S32 HI_MPI_ISP_GetIrisType(ISP_OP_TYPE_E *penIrisType); //not support yet 69 | 70 | HI_S32 HI_MPI_ISP_SetAIAttr(const ISP_AI_ATTR_S *pstAIAttr); 71 | HI_S32 HI_MPI_ISP_GetAIAttr(ISP_AI_ATTR_S *pstAIAttr); 72 | 73 | HI_S32 HI_MPI_ISP_SetMIAttr(const ISP_MI_ATTR_S *pstMIAttr); //not support yet 74 | HI_S32 HI_MPI_ISP_GetMIAttr(ISP_MI_ATTR_S *pstMIAttr); //not support yet 75 | 76 | HI_S32 HI_MPI_ISP_SetAERouteAttr(const ISP_AE_ROUTE_S *pstAERouteAttr); 77 | HI_S32 HI_MPI_ISP_GetAERouteAttr(ISP_AE_ROUTE_S *pstAERouteAttr); 78 | 79 | HI_S32 HI_MPI_ISP_SetAEDelayAttr(const ISP_AE_DELAY_S *pstAEDelayAttr); 80 | HI_S32 HI_MPI_ISP_GetAEDelayAttr(ISP_AE_DELAY_S *pstAEDelayAttr); 81 | 82 | 83 | 84 | #ifdef __cplusplus 85 | #if __cplusplus 86 | } 87 | #endif 88 | #endif /* End of #ifdef __cplusplus */ 89 | 90 | #endif 91 | 92 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_aenc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : ai.c 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/6/15 10 | Description : 11 | History : 12 | 1.Date : 2009/6/15 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef _MPI_AENC_H__ 19 | #define _MPI_AENC_H__ 20 | 21 | #include "hi_common.h" 22 | #include "hi_comm_aio.h" 23 | #include "hi_comm_aenc.h" 24 | 25 | #ifdef __cplusplus 26 | #if __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | #endif /* __cplusplus */ 31 | 32 | #define AENC_ADAPT_MAGIC 0Xfcfcfcfc 33 | 34 | HI_S32 HI_MPI_AENC_CreateChn(AENC_CHN AeChn, const AENC_CHN_ATTR_S *pstAttr); 35 | HI_S32 HI_MPI_AENC_DestroyChn(AENC_CHN AeChn); 36 | 37 | HI_S32 HI_MPI_AENC_SendFrame(AENC_CHN AeChn, 38 | const AUDIO_FRAME_S *pstFrm, const AEC_FRAME_S *pstAecFrm); 39 | 40 | HI_S32 HI_MPI_AENC_GetStream(AENC_CHN AeChn, AUDIO_STREAM_S *pstStream, HI_BOOL bBlock); 41 | HI_S32 HI_MPI_AENC_ReleaseStream(AENC_CHN AeChn, const AUDIO_STREAM_S *pstStream); 42 | 43 | HI_S32 HI_MPI_AENC_GetFd(AENC_CHN AeChn); 44 | 45 | HI_S32 HI_MPI_AENC_Save_File(AENC_CHN AeChn, AUDIO_SAVE_FILE_INFO_S *pstSaveFileInfo); 46 | 47 | HI_S32 HI_MPI_AENC_RegeisterEncoder(HI_S32 *ps32Handle, AENC_ENCODER_S *pstEncoder); 48 | HI_S32 HI_MPI_AENC_UnRegisterEncoder(HI_S32 s32Handle); 49 | 50 | 51 | #ifdef __cplusplus 52 | #if __cplusplus 53 | } 54 | #endif 55 | #endif /* __cplusplus */ 56 | 57 | #endif 58 | 59 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_af.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_af.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/19 10 | Description : 11 | History : 12 | 1.Date : 2012/12/19 13 | Author : n00168968 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __MPI_AF_H__ 18 | #define __MPI_AF_H__ 19 | 20 | #include "hi_comm_isp.h" 21 | #include "hi_comm_3a.h" 22 | #include "hi_af_comm.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | /* The interface of af lib register to isp. */ 31 | HI_S32 HI_MPI_AF_Register(ALG_LIB_S *pstAfLib); 32 | HI_S32 HI_MPI_AF_UnRegister(ALG_LIB_S *pstAfLib); 33 | 34 | #if 0 35 | /* The callback function of sensor register to af lib. */ 36 | HI_S32 hi_af_sensor_register_cb(ALG_LIB_S *pstAfLib, SENSOR_ID SensorId, 37 | CMOS_ISP_AF_DEFAULT_S *pstSnsDft, SENSOR_AF_EXP_FUNC_S *pstSnsExp); 38 | #endif 39 | 40 | /* The new awb lib is compatible with the old mpi interface. */ 41 | HI_S32 HI_MPI_ISP_SetFocusType(ISP_OP_TYPE_E enFocusType); //not support yet 42 | HI_S32 HI_MPI_ISP_GetFocusType(ISP_OP_TYPE_E *penFocusType); //not support yet 43 | 44 | HI_S32 HI_MPI_ISP_SetAFAttr(const ISP_AF_ATTR_S *pstAFAttr); //not support yet 45 | HI_S32 HI_MPI_ISP_GetAFAttr(ISP_AF_ATTR_S *pstAFAttr); //not support yet 46 | 47 | HI_S32 HI_MPI_ISP_SetMFAttr(const ISP_MF_ATTR_S *pstMFAttr); //not support yet 48 | HI_S32 HI_MPI_ISP_GetMFAttr(ISP_MF_ATTR_S *pstMFAttr); //not support yet 49 | 50 | HI_S32 HI_MPI_ISP_ManualFocusMove(HI_S32 s32MoveSteps); //not support yet 51 | 52 | HI_S32 HI_MPI_ISP_SetFocusStaInfo(const ISP_FOCUS_STA_INFO_S *pstFocusStatistic); 53 | HI_S32 HI_MPI_ISP_GetFocusStaInfo(ISP_FOCUS_STA_INFO_S *pstFocusStatistic); 54 | 55 | #ifdef __cplusplus 56 | #if __cplusplus 57 | } 58 | #endif 59 | #endif /* End of #ifdef __cplusplus */ 60 | 61 | #endif 62 | 63 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_ai.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : sio.c 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef _MPI_AI_H__ 19 | #define _MPI_AI_H__ 20 | 21 | #include "hi_type.h" 22 | #include "hi_common.h" 23 | #include "hi_comm_aio.h" 24 | 25 | #ifdef __cplusplus 26 | #if __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | #endif /* __cplusplus */ 31 | 32 | HI_S32 HI_MPI_AI_SetPubAttr(AUDIO_DEV AudioDevId, const AIO_ATTR_S *pstAttr); 33 | HI_S32 HI_MPI_AI_GetPubAttr(AUDIO_DEV AudioDevId, AIO_ATTR_S *pstAttr); 34 | 35 | HI_S32 HI_MPI_AI_Enable(AUDIO_DEV AudioDevId); 36 | HI_S32 HI_MPI_AI_Disable(AUDIO_DEV AudioDevId); 37 | 38 | HI_S32 HI_MPI_AI_EnableChn(AUDIO_DEV AudioDevId, AI_CHN AiChn); 39 | HI_S32 HI_MPI_AI_DisableChn(AUDIO_DEV AudioDevId, AI_CHN AiChn); 40 | 41 | HI_S32 HI_MPI_AI_GetFrame(AUDIO_DEV AudioDevId, AI_CHN AiChn, 42 | AUDIO_FRAME_S *pstFrm, AEC_FRAME_S *pstAecFrm, HI_BOOL bBlock); 43 | HI_S32 HI_MPI_AI_ReleaseFrame(AUDIO_DEV AudioDevId, AI_CHN AiChn, 44 | AUDIO_FRAME_S *pstFrm, AEC_FRAME_S *pstAecFrm); 45 | HI_S32 HI_MPI_AI_SetChnParam(AUDIO_DEV AudioDevId, AI_CHN AiChn, AI_CHN_PARAM_S *pstChnParam); 46 | HI_S32 HI_MPI_AI_GetChnParam(AUDIO_DEV AudioDevId, AI_CHN AiChn, AI_CHN_PARAM_S *pstChnParam); 47 | 48 | HI_S32 HI_MPI_AI_EnableAec(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_DEV AoDevId, AO_CHN AoChn); 49 | HI_S32 HI_MPI_AI_DisableAec(AUDIO_DEV AiDevId, AI_CHN AiChn); 50 | 51 | HI_S32 HI_MPI_AI_EnableReSmp(AUDIO_DEV AudioDevId, AI_CHN AiChn, AUDIO_RESAMPLE_ATTR_S *pstAttr); 52 | HI_S32 HI_MPI_AI_DisableReSmp(AUDIO_DEV AudioDevId, AI_CHN AiChn); 53 | 54 | HI_S32 HI_MPI_AI_EnableAnr(AUDIO_DEV AudioDevId, AI_CHN AiChn); 55 | HI_S32 HI_MPI_AI_DisableAnr(AUDIO_DEV AudioDevId, AI_CHN AiChn); 56 | 57 | HI_S32 HI_MPI_AI_GetFd(AUDIO_DEV AudioDevId, AI_CHN AiChn); 58 | 59 | HI_S32 HI_MPI_AI_SetVqeAttr(AUDIO_DEV AiDevId, AI_CHN AiChn, AUDIO_DEV AoDevId, AO_CHN AoChn, AI_VQE_CONFIG_S *pstVqeConfig); 60 | HI_S32 HI_MPI_AI_GetVqeAttr(AUDIO_DEV AiDevId, AI_CHN AiChn, AI_VQE_CONFIG_S *pstVqeConfig); 61 | HI_S32 HI_MPI_AI_EnableVqe(AUDIO_DEV AiDevId, AI_CHN AiChn); 62 | HI_S32 HI_MPI_AI_DisableVqe(AUDIO_DEV AiDevId, AI_CHN AiChn); 63 | 64 | HI_S32 HI_MPI_AI_EnableReSmpEx(AUDIO_DEV AudioDevId, AI_CHN AiChn, AUDIO_RESAMPLE_ATTR_EX_S *pstAttr); 65 | HI_S32 HI_MPI_AI_DisableReSmpEx(AUDIO_DEV AudioDevId, AI_CHN AiChn); 66 | 67 | HI_S32 HI_MPI_AI_Save_File(AUDIO_DEV AudioDevId, AI_CHN AiChn,AUDIO_SAVE_FILE_INFO_S *pstSaveFileInfo); 68 | 69 | HI_S32 HI_MPI_AI_ClrPubAttr(AUDIO_DEV AudioDevId); 70 | 71 | #ifdef __cplusplus 72 | #if __cplusplus 73 | } 74 | #endif 75 | #endif /* __cplusplus */ 76 | 77 | #endif 78 | 79 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_ao.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_ao.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2009/5/5 10 | Description : 11 | History : 12 | 1.Date : 2009/5/5 13 | Author : p00123320 14 | Modification: Created file 15 | ******************************************************************************/ 16 | 17 | 18 | #ifndef _MPI_AO_H__ 19 | #define _MPI_AO_H__ 20 | 21 | #include "hi_type.h" 22 | #include "hi_common.h" 23 | #include "hi_comm_aio.h" 24 | 25 | #ifdef __cplusplus 26 | #if __cplusplus 27 | extern "C" 28 | { 29 | #endif 30 | #endif /* __cplusplus */ 31 | 32 | 33 | HI_S32 HI_MPI_AO_SetPubAttr(AUDIO_DEV AudioDevId, const AIO_ATTR_S *pstAttr); 34 | HI_S32 HI_MPI_AO_GetPubAttr(AUDIO_DEV AudioDevId, AIO_ATTR_S *pstAttr); 35 | 36 | HI_S32 HI_MPI_AO_Enable(AUDIO_DEV AudioDevId); 37 | HI_S32 HI_MPI_AO_Disable(AUDIO_DEV AudioDevId); 38 | 39 | HI_S32 HI_MPI_AO_EnableChn(AUDIO_DEV AudioDevId, AO_CHN AoChn); 40 | HI_S32 HI_MPI_AO_DisableChn(AUDIO_DEV AudioDevId, AO_CHN AoChn); 41 | 42 | HI_S32 HI_MPI_AO_SendFrame(AUDIO_DEV AudioDevId, AO_CHN AoChn, 43 | const AUDIO_FRAME_S *pstData, HI_BOOL bBlock); 44 | 45 | HI_S32 HI_MPI_AO_EnableReSmp(AUDIO_DEV AudioDevId, AO_CHN AoChn, AUDIO_RESAMPLE_ATTR_S *pstAttr); 46 | HI_S32 HI_MPI_AO_DisableReSmp(AUDIO_DEV AudioDevId, AO_CHN AoChn); 47 | 48 | HI_S32 HI_MPI_AO_EnableReSmpEx(AUDIO_DEV AudioDevId, AO_CHN AoChn, AUDIO_RESAMPLE_ATTR_EX_S *pstAttr); 49 | HI_S32 HI_MPI_AO_DisableReSmpEx(AUDIO_DEV AudioDevId, AO_CHN AoChn); 50 | 51 | HI_S32 HI_MPI_AO_ClearChnBuf(AUDIO_DEV AudioDevId ,AO_CHN AoChn); 52 | HI_S32 HI_MPI_AO_QueryChnStat(AUDIO_DEV AudioDevId ,AO_CHN AoChn, AO_CHN_STATE_S *pstStatus); 53 | 54 | HI_S32 HI_MPI_AO_PauseChn(AUDIO_DEV AudioDevId, AO_CHN AoChn); 55 | HI_S32 HI_MPI_AO_ResumeChn(AUDIO_DEV AudioDevId, AO_CHN AoChn); 56 | 57 | HI_S32 HI_MPI_AO_SetVolume(AUDIO_DEV AudioDevId, AO_CHN AoChn, HI_S32 s32VolumeDb); 58 | HI_S32 HI_MPI_AO_GetVolume(AUDIO_DEV AudioDevId, AO_CHN AoChn, HI_S32 *ps32VolumeDb); 59 | 60 | HI_S32 HI_MPI_AO_GetFd(AUDIO_DEV AudioDevId, AO_CHN AoChn); 61 | 62 | HI_S32 HI_MPI_AO_ClrPubAttr(AUDIO_DEV AudioDevId); 63 | 64 | #ifdef __cplusplus 65 | #if __cplusplus 66 | } 67 | #endif 68 | #endif /* __cplusplus */ 69 | 70 | #endif 71 | 72 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_awb.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_awb.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2012/12/19 10 | Description : 11 | History : 12 | 1.Date : 2012/12/19 13 | Author : n00168968 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | #ifndef __MPI_AWB_H__ 18 | #define __MPI_AWB_H__ 19 | 20 | #include "hi_comm_isp.h" 21 | #include "hi_comm_3a.h" 22 | #include "hi_awb_comm.h" 23 | 24 | #ifdef __cplusplus 25 | #if __cplusplus 26 | extern "C"{ 27 | #endif 28 | #endif /* End of #ifdef __cplusplus */ 29 | 30 | /* The interface of awb lib register to isp. */ 31 | HI_S32 HI_MPI_AWB_Register(ALG_LIB_S *pstAwbLib); 32 | HI_S32 HI_MPI_AWB_UnRegister(ALG_LIB_S *pstAwbLib); 33 | 34 | /* The callback function of sensor register to awb lib. */ 35 | HI_S32 HI_MPI_AWB_SensorRegCallBack(ALG_LIB_S *pstAwbLib, SENSOR_ID SensorId, 36 | AWB_SENSOR_REGISTER_S *pstRegister); 37 | HI_S32 HI_MPI_AWB_SensorUnRegCallBack(ALG_LIB_S *pstAwbLib, SENSOR_ID SensorId); 38 | 39 | /* The new awb lib is compatible with the old mpi interface. */ 40 | HI_S32 HI_MPI_ISP_SetWBType(ISP_OP_TYPE_E enWBType); 41 | HI_S32 HI_MPI_ISP_GetWBType(ISP_OP_TYPE_E *penWBType); 42 | 43 | HI_S32 HI_MPI_ISP_SetAWBAttr(const ISP_AWB_ATTR_S *pstAWBAttr); 44 | HI_S32 HI_MPI_ISP_GetAWBAttr(ISP_AWB_ATTR_S *pstAWBAttr); 45 | 46 | HI_S32 HI_MPI_ISP_SetAWBAlgType(ISP_AWB_ALG_TYPE_E enALGType); 47 | HI_S32 HI_MPI_ISP_GetAWBAlgType(ISP_AWB_ALG_TYPE_E *penALGType); 48 | 49 | HI_S32 HI_MPI_ISP_SetAdvAWBAttr(ISP_ADV_AWB_ATTR_S *pstAdvAWBAttr); 50 | HI_S32 HI_MPI_ISP_GetAdvAWBAttr(ISP_ADV_AWB_ATTR_S *pstAdvAWBAttr); 51 | 52 | HI_S32 HI_MPI_ISP_SetLightSource(const ISP_AWB_ADD_LIGHTSOURCE_S *pstLightSource); 53 | HI_S32 HI_MPI_ISP_GetLightSource(ISP_AWB_ADD_LIGHTSOURCE_S *pstLightSource); 54 | 55 | HI_S32 HI_MPI_ISP_SetMWBAttr(const ISP_MWB_ATTR_S *pstMWBAttr); 56 | HI_S32 HI_MPI_ISP_GetMWBAttr(ISP_MWB_ATTR_S *pstMWBAttr); 57 | 58 | HI_S32 HI_MPI_ISP_SetColorTemp(const HI_U16 u16ColorTemp); //not support yet 59 | HI_S32 HI_MPI_ISP_GetColorTemp(HI_U16 *pu16ColorTemp); 60 | 61 | HI_S32 HI_MPI_ISP_SetColorTone(ISP_COLORTONE_S *pstColorTone); 62 | HI_S32 HI_MPI_ISP_GetColorTone(ISP_COLORTONE_S *pstColorTone); 63 | HI_S32 HI_MPI_ISP_SetWBStaInfo(ISP_WB_STA_INFO_S *pstWBStatistic); 64 | HI_S32 HI_MPI_ISP_GetWBStaInfo(ISP_WB_STA_INFO_S *pstWBStatistic); 65 | 66 | HI_S32 HI_MPI_ISP_SetCCM(const ISP_COLORMATRIX_S *pstColorMatrix); 67 | HI_S32 HI_MPI_ISP_GetCCM(ISP_COLORMATRIX_S *pstColorMatrix); 68 | 69 | HI_S32 HI_MPI_ISP_SetSaturation(HI_U32 u32Value); 70 | HI_S32 HI_MPI_ISP_GetSaturation(HI_U32 *pu32Value); 71 | 72 | HI_S32 HI_MPI_ISP_SetSaturationAttr(const ISP_SATURATION_ATTR_S *pstSatAttr); 73 | HI_S32 HI_MPI_ISP_GetSaturationAttr(ISP_SATURATION_ATTR_S *pstSatAttr); 74 | 75 | #ifdef __cplusplus 76 | #if __cplusplus 77 | } 78 | #endif 79 | #endif /* End of #ifdef __cplusplus */ 80 | 81 | #endif 82 | 83 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_isp.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_isp.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2010/12/20 10 | Description : 11 | History : 12 | 1.Date : 2010/12/20 13 | Author : x00100808 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __MPI_ISP_H__ 19 | #define __MPI_ISP_H__ 20 | 21 | #include "hi_comm_isp.h" 22 | #include "hi_comm_sns.h" 23 | #include "hi_comm_3a.h" 24 | 25 | #ifdef __cplusplus 26 | #if __cplusplus 27 | extern "C"{ 28 | #endif 29 | #endif /* End of #ifdef __cplusplus */ 30 | 31 | /* Firmware Main Operation */ 32 | HI_S32 HI_MPI_ISP_Init(HI_VOID); 33 | HI_S32 HI_MPI_ISP_Run(HI_VOID); 34 | HI_S32 HI_MPI_ISP_Exit(HI_VOID); 35 | HI_S32 HI_MPI_ISP_SensorRegCallBack(SENSOR_ID SensorId, ISP_SENSOR_REGISTER_S *pstRegister); 36 | HI_S32 HI_MPI_ISP_SensorUnRegCallBack(SENSOR_ID SensorId); 37 | 38 | /* if have registered multy libs, set bind attr to appoint the active lib. */ 39 | HI_S32 HI_MPI_ISP_SetBindAttr(const ISP_BIND_ATTR_S *pstBindAttr); 40 | HI_S32 HI_MPI_ISP_GetBindAttr(ISP_BIND_ATTR_S *pstBindAttr); 41 | HI_S32 HI_MPI_ISP_AeLibRegCallBack(ALG_LIB_S *pstAeLib, 42 | ISP_AE_REGISTER_S *pstRegister); 43 | HI_S32 HI_MPI_ISP_AwbLibRegCallBack(ALG_LIB_S *pstAwbLib, 44 | ISP_AWB_REGISTER_S *pstRegister); 45 | HI_S32 HI_MPI_ISP_AfLibRegCallBack(ALG_LIB_S *pstAfLib, 46 | ISP_AF_REGISTER_S *pstRegister); 47 | HI_S32 HI_MPI_ISP_AeLibUnRegCallBack(ALG_LIB_S *pstAeLib); 48 | HI_S32 HI_MPI_ISP_AwbLibUnRegCallBack(ALG_LIB_S *pstAwbLib); 49 | HI_S32 HI_MPI_ISP_AfLibUnRegCallBack(ALG_LIB_S *pstAfLib); 50 | 51 | HI_S32 HI_MPI_ISP_SetInputTiming(const ISP_INPUT_TIMING_S *pstInputTiming); 52 | HI_S32 HI_MPI_ISP_GetInputTiming(ISP_INPUT_TIMING_S *pstInputTiming); 53 | 54 | HI_S32 HI_MPI_ISP_SetImageAttr(const ISP_IMAGE_ATTR_S *pstImageAttr); 55 | HI_S32 HI_MPI_ISP_GetImageAttr(ISP_IMAGE_ATTR_S *pstImageAttr); 56 | 57 | HI_S32 HI_MPI_ISP_SetWdrAttr(const ISP_WDR_ATTR_S *pstWdrAttr); 58 | HI_S32 HI_MPI_ISP_GetWdrAttr(ISP_WDR_ATTR_S *pstWdrAttr); 59 | 60 | HI_S32 HI_MPI_ISP_SetDebug(const ISP_DEBUG_INFO_S * pstIspDebug); 61 | HI_S32 HI_MPI_ISP_GetDebug(ISP_DEBUG_INFO_S * pstIspDebug); 62 | HI_S32 HI_MPI_ISP_FreezeFmw(HI_BOOL bFreeze); 63 | 64 | HI_S32 HI_MPI_ISP_SetModuleControl(HI_U32 u32ModFlag); 65 | HI_S32 HI_MPI_ISP_GetModuleControl(HI_U32 *pu32ModFlag); 66 | 67 | /* General Function Settings */ 68 | HI_S32 HI_MPI_ISP_SetDRCAttr(const ISP_DRC_ATTR_S *pstDRC); 69 | HI_S32 HI_MPI_ISP_GetDRCAttr(ISP_DRC_ATTR_S *pstDRC); 70 | 71 | HI_S32 HI_MPI_ISP_SetDefectPixelAttr(const ISP_DP_ATTR_S *pstDPAttr); 72 | HI_S32 HI_MPI_ISP_GetDefectPixelAttr(ISP_DP_ATTR_S *pstDPAttr); 73 | 74 | HI_S32 HI_MPI_ISP_SetDISAttr(const ISP_DIS_ATTR_S *pstDISAttr); 75 | HI_S32 HI_MPI_ISP_GetDISAttr(ISP_DIS_ATTR_S *pstDISAttr); 76 | HI_S32 HI_MPI_ISP_GetDISInfo(ISP_DIS_INFO_S *pstDISInfo); 77 | 78 | HI_S32 HI_MPI_ISP_SetShadingAttr(const ISP_SHADING_ATTR_S *pstShadingAttr); 79 | HI_S32 HI_MPI_ISP_GetShadingAttr(ISP_SHADING_ATTR_S *pstShadingAttr); 80 | 81 | HI_S32 HI_MPI_ISP_SetShadingTable(const ISP_SHADINGTAB_S *pstShadingTab); 82 | HI_S32 HI_MPI_ISP_GetShadingTable(ISP_SHADINGTAB_S *pstShadingTab); 83 | 84 | HI_S32 HI_MPI_ISP_SetDenoiseAttr(const ISP_DENOISE_ATTR_S *pstDenoiseAttr); 85 | HI_S32 HI_MPI_ISP_GetDenoiseAttr(ISP_DENOISE_ATTR_S *pstDenoiseAttr); 86 | 87 | HI_S32 HI_MPI_ISP_SetGammaAttr(const ISP_GAMMA_ATTR_S* pstGammaAttr); 88 | HI_S32 HI_MPI_ISP_GetGammaAttr(ISP_GAMMA_ATTR_S* pstGammaAttr); 89 | 90 | HI_S32 HI_MPI_ISP_SetGammaTable(const ISP_GAMMA_TABLE_S* pstGammaAttr); 91 | HI_S32 HI_MPI_ISP_GetGammaTable(ISP_GAMMA_TABLE_S* pstGammaAttr); 92 | 93 | HI_S32 HI_MPI_ISP_SetGammaFETable(const ISP_GAMMA_TABLE_S* pstGammaAttr); 94 | HI_S32 HI_MPI_ISP_GetGammaFETable(ISP_GAMMA_TABLE_S* pstGammaAttr); 95 | 96 | HI_S32 HI_MPI_ISP_SetSharpenAttr(const ISP_SHARPEN_ATTR_S *pstSharpenAttr); 97 | HI_S32 HI_MPI_ISP_GetSharpenAttr(ISP_SHARPEN_ATTR_S *pstSharpenAttr); 98 | 99 | HI_S32 HI_MPI_ISP_SetCfg(HI_U32 u32Addr, HI_U32 u32Value); 100 | HI_S32 HI_MPI_ISP_GetCfg(HI_U32 u32Addr, HI_U32 *pu32Value); 101 | 102 | HI_S32 HI_MPI_ISP_SetCrosstalkAttr(const ISP_CR_ATTR_S *pstCRAttr); 103 | HI_S32 HI_MPI_ISP_GetCrosstalkAttr(ISP_CR_ATTR_S *pstCRAttr); 104 | 105 | // TODO: 106 | HI_S32 HI_MPI_ISP_SetAntiFogAttr(const ISP_ANTIFOG_S *pstAntiFog); 107 | HI_S32 HI_MPI_ISP_GetAntiFogAttr(ISP_ANTIFOG_S *pstAntiFog); 108 | 109 | /* ANTI_FALSECOLOR */ 110 | // TODO: 111 | HI_S32 HI_MPI_ISP_SetAntiFalseColorAttr(const ISP_ANTI_FALSECOLOR_S *pstAntiFC); 112 | HI_S32 HI_MPI_ISP_GetAntiFalseColorAttr(ISP_ANTI_FALSECOLOR_S *pstAntiFC); 113 | 114 | HI_S32 HI_MPI_ISP_SetDemosaicAttr(const ISP_DEMOSAIC_ATTR_S *pstDemosaicAttr); 115 | HI_S32 HI_MPI_ISP_GetDemosaicAttr(ISP_DEMOSAIC_ATTR_S *pstDemosaicAttr); 116 | 117 | HI_S32 HI_MPI_ISP_SetBlackLevelAttr(const ISP_BLACK_LEVEL_S *pstBlackLevel); 118 | HI_S32 HI_MPI_ISP_GetBlackLevelAttr(ISP_BLACK_LEVEL_S *pstBlackLevel); 119 | 120 | HI_S32 HI_MPI_ISP_SnsRegsCfg(const ISP_SNS_REGS_INFO_S *pstSnsRegsInfo); 121 | 122 | HI_S32 HI_MPI_ISP_GetVDTimeOut(ISP_VD_INFO_S *pstIspVdInfo, HI_U32 u32MilliSec); 123 | 124 | HI_S32 HI_MPI_ISP_GetISPRegAttr(ISP_REG_ATTR_S * pstIspRegAttr); 125 | #ifdef __cplusplus 126 | #if __cplusplus 127 | } 128 | #endif 129 | #endif /* End of #ifdef __cplusplus */ 130 | 131 | #endif /*__MPI_ISP_H__ */ 132 | 133 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_region.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * 3 | * Copyright (C), 2001-2011, Huawei Tech. Co., Ltd. 4 | * 5 | ******************************************************************************* 6 | * File Name : mpi_region.h 7 | * Version : Initial Draft 8 | * Author : j00169368 9 | * Created : 2010/12/13 10 | * Last Modified : 11 | * Description : REGION MPI 12 | * Function List : 13 | * 14 | * 15 | * History: 16 | * 17 | * 1. Date : 2010/12/13 18 | * Author : j00169368 19 | * Modification : Created file 20 | * 21 | ******************************************************************************/ 22 | 23 | #ifndef __MPI_REGION_H__ 24 | #define __MPI_REGION_H__ 25 | 26 | #ifdef __cplusplus 27 | #if __cplusplus 28 | extern "C"{ 29 | #endif 30 | #endif /* End of #ifdef __cplusplus */ 31 | 32 | 33 | #include "hi_comm_region.h" 34 | 35 | 36 | HI_S32 HI_MPI_RGN_Create(RGN_HANDLE Handle,const RGN_ATTR_S *pstRegion); 37 | HI_S32 HI_MPI_RGN_Destroy(RGN_HANDLE Handle); 38 | 39 | HI_S32 HI_MPI_RGN_GetAttr(RGN_HANDLE Handle,RGN_ATTR_S *pstRegion); 40 | HI_S32 HI_MPI_RGN_SetAttr(RGN_HANDLE Handle,const RGN_ATTR_S *pstRegion); 41 | 42 | HI_S32 HI_MPI_RGN_SetBitMap(RGN_HANDLE Handle,const BITMAP_S *pstBitmap); 43 | 44 | HI_S32 HI_MPI_RGN_SetAttachField(RGN_HANDLE Handle, RGN_ATTACH_FIELD_E enAttachField); 45 | HI_S32 HI_MPI_RGN_GetAttachField(RGN_HANDLE Handle, RGN_ATTACH_FIELD_E *penAttachField); 46 | 47 | HI_S32 HI_MPI_RGN_AttachToChn(RGN_HANDLE Handle,const MPP_CHN_S *pstChn,const RGN_CHN_ATTR_S *pstChnAttr); 48 | HI_S32 HI_MPI_RGN_DetachFrmChn(RGN_HANDLE Handle,const MPP_CHN_S *pstChn); 49 | 50 | HI_S32 HI_MPI_RGN_SetDisplayAttr(RGN_HANDLE Handle,const MPP_CHN_S *pstChn,const RGN_CHN_ATTR_S *pstChnAttr); 51 | HI_S32 HI_MPI_RGN_GetDisplayAttr(RGN_HANDLE Handle,const MPP_CHN_S *pstChn,RGN_CHN_ATTR_S *pstChnAttr); 52 | 53 | 54 | #ifdef __cplusplus 55 | #if __cplusplus 56 | } 57 | #endif 58 | #endif /* End of #ifdef __cplusplus */ 59 | 60 | #endif /* End of #ifndef __MPI_REGION_H__ */ 61 | 62 | 63 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_sys.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_sys.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2007/1/31 10 | Description : 11 | History : 12 | 1.Date : 2006/1/31 13 | Author : c42025 14 | Modification: Created file 15 | 16 | 2.Date : 2008/03/03 17 | Author : c42025 18 | Modification: add a new funtion "HI_MPI_SYS_GetVersion" 19 | 20 | ******************************************************************************/ 21 | 22 | #include "hi_type.h" 23 | #include "hi_common.h" 24 | #include "hi_comm_sys.h" 25 | 26 | #ifndef __MPI_SYS_H__ 27 | #define __MPI_SYS_H__ 28 | 29 | /******************************************/ 30 | #ifdef __cplusplus 31 | #if __cplusplus 32 | extern "C" 33 | { 34 | #endif 35 | #endif /* __cplusplus */ 36 | /******************************************/ 37 | 38 | HI_S32 HI_MPI_SYS_Init(); 39 | HI_S32 HI_MPI_SYS_Exit(); 40 | 41 | HI_S32 HI_MPI_SYS_SetConf(const MPP_SYS_CONF_S *pstSysConf); 42 | HI_S32 HI_MPI_SYS_GetConf(MPP_SYS_CONF_S *pstSysConf); 43 | 44 | HI_S32 HI_MPI_SYS_Bind(MPP_CHN_S *pstSrcChn, MPP_CHN_S *pstDestChn); 45 | 46 | HI_S32 HI_MPI_SYS_UnBind(MPP_CHN_S *pstSrcChn, MPP_CHN_S *pstDestChn); 47 | 48 | HI_S32 HI_MPI_SYS_GetBindbyDest(MPP_CHN_S *pstDestChn, MPP_CHN_S *pstSrcChn); 49 | 50 | 51 | HI_S32 HI_MPI_SYS_GetVersion(MPP_VERSION_S *pstVersion); 52 | 53 | /* Get the current PTS of this system */ 54 | HI_S32 HI_MPI_SYS_GetCurPts(HI_U64 *pu64CurPts); 55 | 56 | /* 57 | ** u64Base is the global PTS of the system. 58 | ** ADVICE: 59 | ** 1. Bester to call HI_MPI_SYS_GetCurPts on the host board to get the u64Base. 60 | ** 2. When the linux start up, call HI_MPI_SYS_InitPtsBase to set the init pts. 61 | ** 3. When media bussines is running, synchronize the PTS one time per minute. 62 | ** And should call HI_MPI_SYS_SyncPts. 63 | */ 64 | HI_S32 HI_MPI_SYS_InitPtsBase(HI_U64 u64PtsBase); 65 | HI_S32 HI_MPI_SYS_SyncPts(HI_U64 u64PtsBase); 66 | 67 | /* alloc mmz memory in user context */ 68 | HI_S32 HI_MPI_SYS_MmzAlloc(HI_U32 *pu32PhyAddr, HI_VOID **ppVirtAddr, 69 | const HI_CHAR *strMmb, const HI_CHAR *strZone, HI_U32 u32Len); 70 | 71 | /* alloc mmz memory with cache */ 72 | HI_S32 HI_MPI_SYS_MmzAlloc_Cached(HI_U32 *pu32PhyAddr, HI_VOID **ppVitAddr, 73 | const HI_CHAR *pstrMmb, const HI_CHAR *pstrZone, HI_U32 u32Len); 74 | 75 | /* free mmz memory in user context */ 76 | HI_S32 HI_MPI_SYS_MmzFree(HI_U32 u32PhyAddr, HI_VOID *pVirtAddr); 77 | 78 | /* fulsh cache */ 79 | HI_S32 HI_MPI_SYS_MmzFlushCache(HI_U32 u32PhyAddr, HI_VOID *pVitAddr, HI_U32 u32Size); 80 | 81 | /* 82 | ** Call the mmap function to map physical address to virtual address 83 | ** The system function mmap is too complicated, so we packge it. 84 | */ 85 | HI_VOID * HI_MPI_SYS_Mmap(HI_U32 u32PhyAddr, HI_U32 u32Size); 86 | HI_S32 HI_MPI_SYS_Munmap(HI_VOID* pVirAddr, HI_U32 u32Size); 87 | 88 | /* 89 | ** Access the physical address. 90 | ** You can use this function to access memory address or register address. 91 | */ 92 | HI_S32 HI_MPI_SYS_SetReg(HI_U32 u32Addr, HI_U32 u32Value); 93 | HI_S32 HI_MPI_SYS_GetReg(HI_U32 u32Addr, HI_U32 *pu32Value); 94 | 95 | 96 | HI_S32 HI_MPI_SYS_SetMemConf(MPP_CHN_S *pstMppChn,const HI_CHAR *pcMmzName); 97 | HI_S32 HI_MPI_SYS_GetMemConf(MPP_CHN_S *pstMppChn,HI_CHAR *pcMmzName); 98 | 99 | /* Get address of virtual register */ 100 | HI_S32 HI_MPI_SYS_GetVRegAddr(HI_U32 *pu32Addr); 101 | 102 | 103 | /* Close all the FD which is used by sys module */ 104 | HI_S32 HI_MPI_SYS_CloseFd(HI_VOID); 105 | 106 | 107 | /******************************************/ 108 | #ifdef __cplusplus 109 | #if __cplusplus 110 | } 111 | #endif 112 | #endif /* __cplusplus */ 113 | /******************************************/ 114 | #endif /*__MPI_SYS_H__ */ 115 | 116 | 117 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_vb.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vb.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2007/10/15 10 | Description : 11 | History : 12 | 1.Date : 2007/10/15 13 | Author : c42025 14 | Modification: Created file 15 | ******************************************************************************/ 16 | #ifndef __MPI_VB_H__ 17 | #define __MPI_VB_H__ 18 | 19 | #include "hi_comm_vb.h" 20 | 21 | /******************************************/ 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C" 25 | { 26 | #endif 27 | #endif /* __cplusplus */ 28 | /******************************************/ 29 | 30 | 31 | VB_POOL HI_MPI_VB_CreatePool(HI_U32 u32BlkSize,HI_U32 u32BlkCnt,const HI_CHAR *pcMmzName); 32 | 33 | HI_S32 HI_MPI_VB_DestroyPool(VB_POOL Pool); 34 | VB_BLK HI_MPI_VB_GetBlock(VB_POOL Pool, HI_U32 u32BlkSize,const HI_CHAR *pcMmzName); 35 | HI_S32 HI_MPI_VB_ReleaseBlock(VB_BLK Block); 36 | 37 | HI_U32 HI_MPI_VB_Handle2PhysAddr(VB_BLK Block); 38 | VB_POOL HI_MPI_VB_Handle2PoolId(VB_BLK Block); 39 | 40 | HI_S32 HI_MPI_VB_Init (HI_VOID); 41 | HI_S32 HI_MPI_VB_Exit (HI_VOID); 42 | HI_S32 HI_MPI_VB_SetConf (const VB_CONF_S *pstVbConf); 43 | HI_S32 HI_MPI_VB_GetConf (VB_CONF_S *pstVbConf); 44 | 45 | HI_S32 HI_MPI_VB_MmapPool(VB_POOL Pool); 46 | HI_S32 HI_MPI_VB_MunmapPool(VB_POOL Pool); 47 | HI_S32 HI_MPI_VB_GetBlkVirAddr(VB_POOL Pool, HI_U32 u32PhyAddr, HI_VOID **ppVirAddr); 48 | 49 | 50 | /******************************************/ 51 | #ifdef __cplusplus 52 | #if __cplusplus 53 | } 54 | #endif 55 | #endif /* __cplusplus */ 56 | /******************************************/ 57 | #endif /*__MPI_VI_H__ */ 58 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_vdec.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/include/mpi_vdec.h -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_venc.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2012, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_venc.h 7 | Version : Initial Draft 8 | Author : Hisilicon Hi35xx MPP Team 9 | Created : 2006/11/22 10 | Last Modified : 11 | Description : mpi functions declaration 12 | Function List : 13 | History : 14 | ******************************************************************************/ 15 | #ifndef __MPI_VENC_H__ 16 | #define __MPI_VENC_H__ 17 | 18 | #include "hi_common.h" 19 | #include "hi_comm_video.h" 20 | #include "hi_comm_venc.h" 21 | 22 | #ifdef __cplusplus 23 | #if __cplusplus 24 | extern "C"{ 25 | #endif 26 | #endif /* __cplusplus */ 27 | 28 | HI_S32 HI_MPI_VENC_CreateGroup(VENC_GRP VeGroup); 29 | HI_S32 HI_MPI_VENC_DestroyGroup(VENC_GRP VeGroup); 30 | 31 | HI_S32 HI_MPI_VENC_CreateChn(VENC_CHN VeChn, const VENC_CHN_ATTR_S *pstAttr); 32 | HI_S32 HI_MPI_VENC_DestroyChn(VENC_CHN VeChn); 33 | 34 | HI_S32 HI_MPI_VENC_RegisterChn(VENC_GRP VeGroup, VENC_CHN VeChn ); 35 | HI_S32 HI_MPI_VENC_UnRegisterChn(VENC_CHN VeChn); 36 | 37 | HI_S32 HI_MPI_VENC_StartRecvPic(VENC_CHN VeChn); 38 | HI_S32 HI_MPI_VENC_StartRecvPicEx(VENC_CHN VeChn, VENC_RECV_PIC_PARAM_S *pstRecvParam); 39 | HI_S32 HI_MPI_VENC_StopRecvPic(VENC_CHN VeChn); 40 | 41 | HI_S32 HI_MPI_VENC_Query(VENC_CHN VeChn, VENC_CHN_STAT_S *pstStat); 42 | 43 | HI_S32 HI_MPI_VENC_SetChnAttr( VENC_CHN VeChn, const VENC_CHN_ATTR_S *pstAttr); 44 | HI_S32 HI_MPI_VENC_GetChnAttr( VENC_CHN VeChn, VENC_CHN_ATTR_S *pstAttr); 45 | 46 | HI_S32 HI_MPI_VENC_GetStream(VENC_CHN VeChn, VENC_STREAM_S *pstStream, HI_BOOL bBlockFlag); 47 | HI_S32 HI_MPI_VENC_ReleaseStream(VENC_CHN VeChn, VENC_STREAM_S *pstStream); 48 | 49 | HI_S32 HI_MPI_VENC_InsertUserData(VENC_CHN VeChn, HI_U8 *pu8Data, HI_U32 u32Len); 50 | 51 | HI_S32 HI_MPI_VENC_SendFrame(VENC_GRP VeGroup, VIDEO_FRAME_INFO_S *pstFrame); 52 | 53 | HI_S32 HI_MPI_VENC_SetMaxStreamCnt(VENC_CHN VeChn, HI_U32 u32MaxStrmCnt); 54 | HI_S32 HI_MPI_VENC_GetMaxStreamCnt(VENC_CHN VeChn, HI_U32 *pu32MaxStrmCnt); 55 | 56 | HI_S32 HI_MPI_VENC_RequestIDR(VENC_CHN VeChn); 57 | HI_S32 HI_MPI_VENC_RequestIDRInst(VENC_CHN VeChn); 58 | 59 | HI_S32 HI_MPI_VENC_GetFd(VENC_CHN VeChn); 60 | 61 | HI_S32 HI_MPI_VENC_SetRoiCfg(VENC_CHN VeChn, VENC_ROI_CFG_S *pstVencRoiCfg); 62 | HI_S32 HI_MPI_VENC_GetRoiCfg(VENC_CHN VeChn, HI_U32 u32Index, VENC_ROI_CFG_S *pstVencRoiCfg); 63 | 64 | HI_S32 HI_MPI_VENC_SetH264SliceSplit(VENC_CHN VeChn, const VENC_PARAM_H264_SLICE_SPLIT_S *pstSliceSplit); 65 | HI_S32 HI_MPI_VENC_GetH264SliceSplit(VENC_CHN VeChn, VENC_PARAM_H264_SLICE_SPLIT_S *pstSliceSplit); 66 | 67 | HI_S32 HI_MPI_VENC_SetH264InterPred(VENC_CHN VeChn, const VENC_PARAM_H264_INTER_PRED_S *pstH264InterPred); 68 | HI_S32 HI_MPI_VENC_GetH264InterPred(VENC_CHN VeChn, VENC_PARAM_H264_INTER_PRED_S *pstH264InterPred); 69 | 70 | HI_S32 HI_MPI_VENC_SetH264IntraPred(VENC_CHN VeChn, const VENC_PARAM_H264_INTRA_PRED_S *pstH264InterPred); 71 | HI_S32 HI_MPI_VENC_GetH264IntraPred(VENC_CHN VeChn, VENC_PARAM_H264_INTRA_PRED_S *pstH264InterPred); 72 | 73 | HI_S32 HI_MPI_VENC_SetH264Trans(VENC_CHN VeChn, const VENC_PARAM_H264_TRANS_S *pstH264Trans); 74 | HI_S32 HI_MPI_VENC_GetH264Trans(VENC_CHN VeChn, VENC_PARAM_H264_TRANS_S *pstH264Trans); 75 | 76 | HI_S32 HI_MPI_VENC_SetH264Entropy(VENC_CHN VeChn, const VENC_PARAM_H264_ENTROPY_S *pstH264EntropyEnc); 77 | HI_S32 HI_MPI_VENC_GetH264Entropy(VENC_CHN VeChn, VENC_PARAM_H264_ENTROPY_S *pstH264EntropyEnc); 78 | 79 | HI_S32 HI_MPI_VENC_SetH264Poc(VENC_CHN VeChn, const VENC_PARAM_H264_POC_S *pstH264Poc); 80 | HI_S32 HI_MPI_VENC_GetH264Poc(VENC_CHN VeChn, VENC_PARAM_H264_POC_S *pstH264Poc); 81 | 82 | HI_S32 HI_MPI_VENC_SetH264Dblk(VENC_CHN VeChn, const VENC_PARAM_H264_DBLK_S *pstH264Dblk); 83 | HI_S32 HI_MPI_VENC_GetH264Dblk(VENC_CHN VeChn, VENC_PARAM_H264_DBLK_S *pstH264Dblk); 84 | 85 | HI_S32 HI_MPI_VENC_SetH264Vui(VENC_CHN VeChn, const VENC_PARAM_H264_VUI_S *pstH264Vui); 86 | HI_S32 HI_MPI_VENC_GetH264Vui(VENC_CHN VeChn, VENC_PARAM_H264_VUI_S *pstH264Vui); 87 | 88 | HI_S32 HI_MPI_VENC_SetJpegParam(VENC_CHN VeChn, const VENC_PARAM_JPEG_S *pstJpegParam); 89 | HI_S32 HI_MPI_VENC_GetJpegParam(VENC_CHN VeChn, VENC_PARAM_JPEG_S *pstJpegParam); 90 | 91 | HI_S32 HI_MPI_VENC_SetMpeg4Param(VENC_CHN VeChn, const VENC_PARAM_MPEG4_S *pstMpeg4Param); 92 | HI_S32 HI_MPI_VENC_GetMpeg4Param(VENC_CHN VeChn, VENC_PARAM_MPEG4_S *pstMpeg4Param); 93 | 94 | HI_S32 HI_MPI_VENC_SetMjpegParam(VENC_CHN VeChn, const VENC_PARAM_MJPEG_S *pstMjpegParam); 95 | HI_S32 HI_MPI_VENC_GetMjpegParam(VENC_CHN VeChn, VENC_PARAM_MJPEG_S *pstMjpegParam); 96 | 97 | HI_S32 HI_MPI_VENC_SetGrpFrmRate(VENC_GRP VeGroup, const GROUP_FRAME_RATE_S *pstGrpFrmRate); 98 | HI_S32 HI_MPI_VENC_GetGrpFrmRate(VENC_GRP VeGroup, GROUP_FRAME_RATE_S *pstGrpFrmRate); 99 | 100 | HI_S32 HI_MPI_VENC_GetRcPara(VENC_CHN VeChn, VENC_RC_PARAM_S *pstRcPara); 101 | HI_S32 HI_MPI_VENC_SetRcPara(VENC_CHN VeChn, VENC_RC_PARAM_S *pstRcPara); 102 | 103 | HI_S32 HI_MPI_VENC_SetH264eRefMode(VENC_CHN VeChn, VENC_ATTR_H264_REF_MODE_E enRefMode); 104 | HI_S32 HI_MPI_VENC_GetH264eRefMode(VENC_CHN VeChn, VENC_ATTR_H264_REF_MODE_E *penRefMode); 105 | 106 | HI_S32 HI_MPI_VENC_SetH264eRefParam( VENC_CHN VeChn, VENC_ATTR_H264_REF_PARAM_S* pstRefParam ); 107 | HI_S32 HI_MPI_VENC_GetH264eRefParam( VENC_CHN VeChn, VENC_ATTR_H264_REF_PARAM_S* pstRefParam ); 108 | 109 | HI_S32 HI_MPI_VENC_EnableIDR( VENC_CHN VeChn, HI_BOOL bEnableIDR ); 110 | 111 | HI_S32 HI_MPI_VENC_SetGrpColor2Grey(VENC_GRP VeGroup, const GROUP_COLOR2GREY_S *pstGrpColor2Grey); 112 | HI_S32 HI_MPI_VENC_GetGrpColor2Grey(VENC_GRP VeGroup, GROUP_COLOR2GREY_S *pstGrpColor2Grey); 113 | 114 | HI_S32 HI_MPI_VENC_SetColor2GreyConf(const GROUP_COLOR2GREY_CONF_S *pstGrpColor2GreyConf); 115 | HI_S32 HI_MPI_VENC_GetColor2GreyConf(GROUP_COLOR2GREY_CONF_S *pstGrpColor2GreyConf); 116 | 117 | HI_S32 HI_MPI_VENC_SetGrpCrop(VENC_GRP VeGroup, const GROUP_CROP_CFG_S *pstGrpCropCfg); 118 | HI_S32 HI_MPI_VENC_GetGrpCrop(VENC_GRP VeGroup, GROUP_CROP_CFG_S *pstGrpCropCfg); 119 | 120 | HI_S32 HI_MPI_VENC_SetJpegSnapMode(VENC_CHN VeChn, VENC_JPEG_SNAP_MODE_E enJpegSnapMode); 121 | HI_S32 HI_MPI_VENC_GetJpegSnapMode(VENC_CHN VeChn, VENC_JPEG_SNAP_MODE_E *penJpegSnapMode); 122 | 123 | HI_S32 HI_MPI_VENC_SetRcPriority(VENC_CHN VeChn, VENC_RC_PRIORITY_E enRcPriority); 124 | HI_S32 HI_MPI_VENC_GetRcPriority(VENC_CHN VeChn, VENC_RC_PRIORITY_E *penRcPriority); 125 | 126 | HI_S32 HI_MPI_VENC_SetLostFrameStrategy(VENC_CHN VeChn, VENC_PARAM_LOSTFRM_S *pstLostFrmParam); 127 | HI_S32 HI_MPI_VENC_GetLostFrameStrategy(VENC_CHN VeChn, VENC_PARAM_LOSTFRM_S *pstLostFrmParam); 128 | #ifdef __cplusplus 129 | #if __cplusplus 130 | } 131 | #endif 132 | #endif /* __cplusplus */ 133 | 134 | #endif /* __MPI_VENC_H__ */ -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_vi.h: -------------------------------------------------------------------------------- 1 | #ifndef __MPI_VI_H__ 2 | #define __MPI_VI_H__ 3 | 4 | 5 | #ifdef __cplusplus 6 | #if __cplusplus 7 | extern "C" 8 | { 9 | #endif 10 | #endif /* __cplusplus */ 11 | 12 | #include "hi_comm_vi.h" 13 | 14 | HI_S32 HI_MPI_VI_SetDevAttr(VI_DEV ViDev, const VI_DEV_ATTR_S *pstDevAttr); 15 | HI_S32 HI_MPI_VI_GetDevAttr(VI_DEV ViDev, VI_DEV_ATTR_S *pstDevAttr); 16 | 17 | HI_S32 HI_MPI_VI_EnableDev(VI_DEV ViDev); 18 | HI_S32 HI_MPI_VI_DisableDev(VI_DEV ViDev); 19 | 20 | HI_S32 HI_MPI_VI_SetChnAttr(VI_CHN ViChn, const VI_CHN_ATTR_S *pstAttr); 21 | HI_S32 HI_MPI_VI_GetChnAttr(VI_CHN ViChn, VI_CHN_ATTR_S *pstAttr); 22 | 23 | /* The following 3 functions are only for vichn minor attributes */ 24 | HI_S32 HI_MPI_VI_SetChnMinorAttr(VI_CHN ViChn,const VI_CHN_ATTR_S *pstAttr); 25 | HI_S32 HI_MPI_VI_GetChnMinorAttr(VI_CHN ViChn,VI_CHN_ATTR_S *pstAttr); 26 | HI_S32 HI_MPI_VI_ClearChnMinorAttr(VI_CHN ViChn); 27 | 28 | HI_S32 HI_MPI_VI_EnableChn(VI_CHN ViChn); 29 | HI_S32 HI_MPI_VI_DisableChn(VI_CHN ViChn); 30 | 31 | HI_S32 HI_MPI_VI_GetFrame(VI_CHN ViChn, VIDEO_FRAME_INFO_S *pstFrameInfo); 32 | HI_S32 HI_MPI_VI_GetFrameTimeOut(VI_CHN ViChn, VIDEO_FRAME_INFO_S *pstFrameInfo, HI_U32 u32MilliSec); 33 | HI_S32 HI_MPI_VI_ReleaseFrame(VI_CHN ViChn, VIDEO_FRAME_INFO_S *pstFrameInfo); 34 | HI_S32 HI_MPI_VI_SetFrameDepth(VI_CHN ViChn, HI_U32 u32Depth); 35 | HI_S32 HI_MPI_VI_GetFrameDepth(VI_CHN ViChn, HI_U32 *pu32Depth); 36 | 37 | HI_S32 HI_MPI_VI_SetUserPic(VI_CHN ViChn, VI_USERPIC_ATTR_S *pstUsrPic); 38 | HI_S32 HI_MPI_VI_EnableUserPic(VI_CHN ViChn); 39 | HI_S32 HI_MPI_VI_DisableUserPic(VI_CHN ViChn); 40 | 41 | /* These functions are used to start the cascade mode. VI cascade mode can work normally Only when they have been called */ 42 | HI_S32 HI_MPI_VI_EnableCascade(VI_DEV ViDev); 43 | HI_S32 HI_MPI_VI_DisableCascade(VI_DEV ViDev); 44 | HI_S32 HI_MPI_VI_EnableCascadeChn(VI_CHN ViChn); 45 | HI_S32 HI_MPI_VI_DisableCascadeChn(VI_CHN ViChn); 46 | 47 | /* Normally, these functions are not necessary in typical business */ 48 | HI_S32 HI_MPI_VI_ChnBind(VI_CHN ViChn, const VI_CHN_BIND_ATTR_S *pstChnBindAttr); 49 | HI_S32 HI_MPI_VI_ChnUnBind(VI_CHN ViChn); 50 | HI_S32 HI_MPI_VI_GetChnBind(VI_CHN ViChn, VI_CHN_BIND_ATTR_S *pstChnBindAttr); 51 | 52 | HI_S32 HI_MPI_VI_SetDevAttrEx(VI_DEV ViDev, const VI_DEV_ATTR_EX_S *pstDevAttrEx); 53 | HI_S32 HI_MPI_VI_GetDevAttrEx(VI_DEV ViDev, VI_DEV_ATTR_EX_S *pstDevAttrEx); 54 | 55 | HI_S32 HI_MPI_VI_GetFd(VI_CHN ViChn); 56 | 57 | HI_S32 HI_MPI_VI_Query(VI_CHN ViChn, VI_CHN_STAT_S *pstStat); 58 | 59 | HI_S32 HI_MPI_VI_EnableChnInterrupt(VI_CHN ViChn); 60 | HI_S32 HI_MPI_VI_DisableChnInterrupt(VI_CHN ViChn); 61 | 62 | HI_S32 HI_MPI_VI_SetFlashConfig(VI_DEV ViDev, const VI_FLASH_CONFIG_S *pstFlashConfig); 63 | HI_S32 HI_MPI_VI_GetFlashConfig(VI_DEV ViDev, VI_FLASH_CONFIG_S *pstFlashConfig); 64 | HI_S32 HI_MPI_VI_FlashTrigger(VI_DEV ViDev, HI_BOOL bEnable); 65 | 66 | HI_S32 HI_MPI_VI_SetExtChnAttr(VI_CHN ViChn, const VI_EXT_CHN_ATTR_S *pstExtChnAttr); 67 | HI_S32 HI_MPI_VI_GetExtChnAttr(VI_CHN ViChn, VI_EXT_CHN_ATTR_S *pstExtChnAttr); 68 | 69 | HI_S32 HI_MPI_VI_SetLDCAttr(VI_CHN ViChn, const VI_LDC_ATTR_S *pstLDCAttr); 70 | HI_S32 HI_MPI_VI_GetLDCAttr(VI_CHN ViChn, VI_LDC_ATTR_S *pstLDCAttr); 71 | 72 | HI_S32 HI_MPI_VI_SetCSCAttr(VI_DEV ViDev, const VI_CSC_ATTR_S *pstCSCAttr); 73 | HI_S32 HI_MPI_VI_GetCSCAttr(VI_DEV ViDev, VI_CSC_ATTR_S *pstCSCAttr); 74 | 75 | HI_S32 HI_MPI_VI_SetRotate(VI_CHN ViChn, const ROTATE_E enRotate); 76 | HI_S32 HI_MPI_VI_GetRotate(VI_CHN ViChn, ROTATE_E *penRotate); 77 | 78 | HI_S32 HI_MPI_VI_GetChnLuma(VI_CHN ViChn, VI_CHN_LUM_S *pstLuma); 79 | 80 | #ifdef __cplusplus 81 | #if __cplusplus 82 | } 83 | #endif 84 | #endif /* __cplusplus */ 85 | 86 | #endif /*__MPI_VI_H__ */ 87 | 88 | 89 | 90 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_vo.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vo.h 7 | Version : Initial Draft 8 | Author : Hisilicon multimedia software group 9 | Created : 2011/06/28 10 | Description : Vou API 11 | History : 12 | 1.Date : 2011/06/28 13 | Author : z00185248 14 | Modification: Created file 15 | 16 | ******************************************************************************/ 17 | 18 | #ifndef __MPI_VO_H__ 19 | #define __MPI_VO_H__ 20 | 21 | #include "hi_comm_vo.h" 22 | 23 | #ifdef __cplusplus 24 | #if __cplusplus 25 | extern "C" 26 | { 27 | #endif 28 | #endif /* __cplusplus */ 29 | 30 | 31 | /* Device Settings */ 32 | 33 | HI_S32 HI_MPI_VO_Enable (VO_DEV VoDev); 34 | HI_S32 HI_MPI_VO_Disable(VO_DEV VoDev); 35 | 36 | HI_S32 HI_MPI_VO_SetPubAttr(VO_DEV VoDev, const VO_PUB_ATTR_S *pstPubAttr); 37 | HI_S32 HI_MPI_VO_GetPubAttr(VO_DEV VoDev, VO_PUB_ATTR_S *pstPubAttr); 38 | 39 | HI_S32 HI_MPI_VO_CloseFd(HI_VOID); 40 | 41 | 42 | /* Video Settings */ 43 | HI_S32 HI_MPI_VO_EnableVideoLayer (VO_DEV VoDev); 44 | HI_S32 HI_MPI_VO_DisableVideoLayer(VO_DEV VoDev); 45 | 46 | HI_S32 HI_MPI_VO_SetVideoLayerAttr(VO_DEV VoDev, const VO_VIDEO_LAYER_ATTR_S *pstLayerAttr); 47 | HI_S32 HI_MPI_VO_GetVideoLayerAttr(VO_DEV VoDev, VO_VIDEO_LAYER_ATTR_S *pstLayerAttr); 48 | 49 | /* PIP LAYER Setting */ 50 | 51 | HI_S32 HI_MPI_VO_PipLayerBindDev(VO_DEV VoTargetDev); 52 | HI_S32 HI_MPI_VO_PipLayerUnBindDev(VO_DEV VoTargetDev); 53 | 54 | HI_S32 HI_MPI_VO_SetPipLayerAttr(const VO_VIDEO_LAYER_ATTR_S *pstLayerAttr); 55 | HI_S32 HI_MPI_VO_GetPipLayerAttr(VO_VIDEO_LAYER_ATTR_S *pstLayerAttr); 56 | 57 | HI_S32 HI_MPI_VO_EnablePipLayer (HI_VOID); 58 | HI_S32 HI_MPI_VO_DisablePipLayer(HI_VOID); 59 | 60 | /* General Operation of Channel */ 61 | 62 | HI_S32 HI_MPI_VO_EnableChn (VO_DEV VoDev, VO_CHN VoChn); 63 | HI_S32 HI_MPI_VO_DisableChn(VO_DEV VoDev, VO_CHN VoChn); 64 | 65 | 66 | /* These two interfaces only support for Hi3518 */ 67 | HI_S32 HI_MPI_VO_EnableSdTdeBypass (VO_DEV VoDev); 68 | HI_S32 HI_MPI_VO_DisableSdTdeBypass(VO_DEV VoDev); 69 | 70 | 71 | HI_S32 HI_MPI_VO_SetChnAttr(VO_DEV VoDev, VO_CHN VoChn, const VO_CHN_ATTR_S *pstChnAttr); 72 | HI_S32 HI_MPI_VO_GetChnAttr(VO_DEV VoDev, VO_CHN VoChn, VO_CHN_ATTR_S *pstChnAttr); 73 | 74 | HI_S32 HI_MPI_VO_SetChnDispPos(VO_DEV VoDev, VO_CHN VoChn, const POINT_S *pstDispPos); 75 | HI_S32 HI_MPI_VO_GetChnDispPos(VO_DEV VoDev, VO_CHN VoChn, POINT_S *pstDispPos); 76 | 77 | HI_S32 HI_MPI_VO_SetChnField(VO_DEV VoDev, VO_CHN VoChn, const VO_DISPLAY_FIELD_E enField); 78 | HI_S32 HI_MPI_VO_GetChnField(VO_DEV VoDev, VO_CHN VoChn, VO_DISPLAY_FIELD_E *pField); 79 | 80 | HI_S32 HI_MPI_VO_SetChnFrameRate(VO_DEV VoDev, VO_CHN VoChn, HI_S32 s32ChnFrmRate); 81 | HI_S32 HI_MPI_VO_GetChnFrameRate(VO_DEV VoDev, VO_CHN VoChn, HI_S32 *ps32ChnFrmRate); 82 | 83 | HI_S32 HI_MPI_VO_GetChnFrame (VO_DEV VoDev, VO_CHN VoChn, VIDEO_FRAME_INFO_S *pstFrame); 84 | HI_S32 HI_MPI_VO_ReleaseChnFrame(VO_DEV VoDev, VO_CHN VoChn, VIDEO_FRAME_INFO_S *pstFrame); 85 | 86 | HI_S32 HI_MPI_VO_ChnPause (VO_DEV VoDev, VO_CHN VoChn); 87 | HI_S32 HI_MPI_VO_ChnResume(VO_DEV VoDev, VO_CHN VoChn); 88 | HI_S32 HI_MPI_VO_ChnStep (VO_DEV VoDev, VO_CHN VoChn); 89 | HI_S32 HI_MPI_VO_ChnRefresh(VO_DEV VoDev, VO_CHN VoChn); 90 | 91 | HI_S32 HI_MPI_VO_ChnShow(VO_DEV VoDev, VO_CHN VoChn); 92 | HI_S32 HI_MPI_VO_ChnHide(VO_DEV VoDev, VO_CHN VoChn); 93 | 94 | HI_S32 HI_MPI_VO_SetZoomInWindow(VO_DEV VoDev, VO_CHN VoChn, const VO_ZOOM_ATTR_S *pstZoomAttr); 95 | HI_S32 HI_MPI_VO_GetZoomInWindow(VO_DEV VoDev, VO_CHN VoChn, VO_ZOOM_ATTR_S *pstZoomAttr); 96 | 97 | HI_S32 HI_MPI_VO_GetChnPts (VO_DEV VoDev, VO_CHN VoChn, HI_U64 *pu64ChnPts); 98 | HI_S32 HI_MPI_VO_QueryChnStat(VO_DEV VoDev, VO_CHN VoChn, VO_QUERY_STATUS_S *pstStatus); 99 | 100 | HI_S32 HI_MPI_VO_SendFrame(VO_DEV VoDev, VO_CHN VoChn, VIDEO_FRAME_INFO_S *pstVFrame); 101 | HI_S32 HI_MPI_VO_SendFrameTimeOut(VO_DEV VoDev, VO_CHN VoChn, VIDEO_FRAME_INFO_S *pstVFrame, HI_U32 u32MilliSec); 102 | 103 | HI_S32 HI_MPI_VO_ClearChnBuffer(VO_DEV VoDev, VO_CHN VoChn, HI_BOOL bClrAll); 104 | 105 | 106 | HI_S32 HI_MPI_VO_SetChnDispThreshold(VO_DEV VoDev, VO_CHN VoChn, HI_U32 u32Threshold); 107 | HI_S32 HI_MPI_VO_GetChnDispThreshold(VO_DEV VoDev, VO_CHN VoChn, HI_U32 *pu32Threshold); 108 | 109 | HI_S32 HI_MPI_VO_EnableChnDoubleFrame(VO_DEV VoDev, VO_CHN VoChn); 110 | HI_S32 HI_MPI_VO_DisableChnDoubleFrame(VO_DEV VoDev, VO_CHN VoChn); 111 | 112 | HI_S32 HI_MPI_VO_SetAttrBegin(VO_DEV VoDev); 113 | HI_S32 HI_MPI_VO_SetAttrEnd (VO_DEV VoDev); 114 | 115 | HI_S32 HI_MPI_VO_SetPlayToleration(VO_DEV VoDev, HI_U32 u32Toleration); 116 | HI_S32 HI_MPI_VO_GetPlayToleration(VO_DEV VoDev, HI_U32 *pu32Toleration); 117 | 118 | HI_S32 HI_MPI_VO_GetScreenFrame (VO_DEV VoDev, VIDEO_FRAME_INFO_S *pstVFrame); 119 | HI_S32 HI_MPI_VO_ReleaseScreenFrame(VO_DEV VoDev, VIDEO_FRAME_INFO_S *pstVFrame); 120 | 121 | HI_S32 HI_MPI_VO_SetDispBufLen(VO_DEV VoDev, HI_U32 u32BufLen); 122 | HI_S32 HI_MPI_VO_GetDispBufLen(VO_DEV VoDev, HI_U32 *pu32BufLen); 123 | 124 | HI_S32 HI_MPI_VO_EnableWbc(VO_DEV VoDev); 125 | HI_S32 HI_MPI_VO_DisableWbc(VO_DEV VoDev); 126 | 127 | HI_S32 HI_MPI_VO_SetWbcAttr(VO_DEV VoDev, const VO_WBC_ATTR_S *pstWbcAttr); 128 | HI_S32 HI_MPI_VO_GetWbcAttr(VO_DEV VoDev, VO_WBC_ATTR_S *pstWbcAttr); 129 | 130 | HI_S32 HI_MPI_VO_SetWbcMode(VO_DEV VoDev, VO_WBC_MODE_E enWbcMode); 131 | HI_S32 HI_MPI_VO_GetWbcMode(VO_DEV VoDev, VO_WBC_MODE_E *penWbcMode); 132 | 133 | HI_S32 HI_MPI_VO_SetWbcDepth(VO_DEV VoDev, HI_U32 u32Depth); 134 | HI_S32 HI_MPI_VO_GetWbcDepth(VO_DEV VoDev, HI_U32 *pu32Depth); 135 | HI_S32 HI_MPI_VO_WbcGetScreenFrame(VO_DEV VoDev, VIDEO_FRAME_INFO_S *pstVFrame); 136 | HI_S32 HI_MPI_VO_WbcReleaseScreenFrame(VO_DEV VoDev, VIDEO_FRAME_INFO_S *pstVFrame); 137 | 138 | HI_S32 HI_MPI_VO_GfxLayerBindDev(VOU_GFX_BIND_LAYER_E enGfxLayer, VO_DEV VoTargetDev); 139 | HI_S32 HI_MPI_VO_GfxLayerUnBindDev(VOU_GFX_BIND_LAYER_E enGfxLayer, VO_DEV VoTargetDev); 140 | 141 | HI_S32 HI_MPI_VO_SetGfxLayerCSC(HI_U32 u32Layer, const VO_CSC_S *pstCSC); 142 | HI_S32 HI_MPI_VO_GetGfxLayerCSC(HI_U32 u32Layer, VO_CSC_S *pstCSC); 143 | 144 | HI_S32 HI_MPI_VO_SetCascadeAttr(const VO_CAS_ATTR_S *pstCasAttr); 145 | HI_S32 HI_MPI_VO_GetCascadeAttr(VO_CAS_ATTR_S *pstCasAttr); 146 | 147 | HI_S32 HI_MPI_VO_EnableCascadeDev (VO_DEV VoCasDev); 148 | HI_S32 HI_MPI_VO_DisableCascadeDev(VO_DEV VoCasDev); 149 | 150 | HI_S32 HI_MPI_VO_SetCascadePattern(VO_DEV VoCasDev, HI_U32 u32Pattern); 151 | HI_S32 HI_MPI_VO_GetCascadePattern(VO_DEV VoCasDev, HI_U32 *pu32Pattern); 152 | 153 | HI_S32 HI_MPI_VO_CascadePosBindChn (HI_U32 u32Pos, VO_DEV VoCasDev, VO_CHN VoChn); 154 | HI_S32 HI_MPI_VO_CascadePosUnBindChn(HI_U32 u32Pos, VO_DEV VoCasDev, VO_CHN VoChn); 155 | 156 | HI_S32 HI_MPI_VO_EnableCascade (HI_VOID); 157 | HI_S32 HI_MPI_VO_DisableCascade(HI_VOID); 158 | 159 | HI_S32 HI_MPI_VO_GetDevCSC(VO_DEV VoDev, VO_CSC_S *pstDevCSC); 160 | HI_S32 HI_MPI_VO_SetDevCSC(VO_DEV VoDev, VO_CSC_S *pstDevCSC); 161 | 162 | HI_S32 HI_MPI_VO_GetVgaParam(VO_DEV VoDev, VO_VGA_PARAM_S *pstVgaParam); 163 | HI_S32 HI_MPI_VO_SetVgaParam(VO_DEV VoDev, VO_VGA_PARAM_S *pstVgaParam); 164 | 165 | HI_S32 HI_MPI_VO_SetVtth(VO_DEV VoDev, HI_U32 u32Vtth); 166 | HI_S32 HI_MPI_VO_GetVtth(VO_DEV VoDev, HI_U32 *pu32Vtth); 167 | 168 | HI_S32 HI_MPI_VO_SetDevFramerate(VO_DEV VoDev, HI_U32 u32Framerate); 169 | HI_S32 HI_MPI_VO_GetDevFramerate(VO_DEV VoDev, HI_U32 *pu32Framerate); 170 | 171 | 172 | HI_S32 HI_MPI_VO_EnableRecvFrameRateMatch (VO_DEV VoDev, VO_CHN VoChn); 173 | HI_S32 HI_MPI_VO_DisableRecvFrameRateMatch (VO_DEV VoDev, VO_CHN VoChn); 174 | 175 | #ifdef __cplusplus 176 | #if __cplusplus 177 | } 178 | #endif 179 | #endif /* __cplusplus */ 180 | #endif /*__MPI_VO_H__ */ 181 | 182 | 183 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/include/mpi_vpss.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | 3 | Copyright (C), 2001-2011, Hisilicon Tech. Co., Ltd. 4 | 5 | ****************************************************************************** 6 | File Name : mpi_vpss.h 7 | Version : Initial Draft 8 | Author : 9 | Created : 10 | Last Modified : 11 | Description : mpi functions declaration 12 | Function List : 13 | History : 14 | 1.Date : 20110616 15 | Author : l00183122 16 | Modification: Create 17 | ******************************************************************************/ 18 | #ifndef __MPI_VPSS_H__ 19 | #define __MPI_VPSS_H__ 20 | 21 | #include "hi_common.h" 22 | #include "hi_comm_video.h" 23 | #include "hi_comm_vpss.h" 24 | 25 | #ifdef __cplusplus 26 | #if __cplusplus 27 | extern "C"{ 28 | #endif 29 | #endif /* __cplusplus */ 30 | 31 | 32 | HI_S32 HI_MPI_VPSS_CreateGrp(VPSS_GRP VpssGrp, VPSS_GRP_ATTR_S *pstGrpAttr); 33 | HI_S32 HI_MPI_VPSS_DestroyGrp(VPSS_GRP VpssGrp); 34 | 35 | HI_S32 HI_MPI_VPSS_StartGrp(VPSS_GRP VpssGrp); 36 | HI_S32 HI_MPI_VPSS_StopGrp(VPSS_GRP VpssGrp); 37 | 38 | HI_S32 HI_MPI_VPSS_ResetGrp(VPSS_GRP VpssGrp); 39 | 40 | HI_S32 HI_MPI_VPSS_EnableChn(VPSS_GRP VpssGrp, VPSS_CHN s32VpssChnl); 41 | HI_S32 HI_MPI_VPSS_DisableChn(VPSS_GRP VpssGrp, VPSS_CHN s32VpssChnl); 42 | 43 | HI_S32 HI_MPI_VPSS_GetGrpAttr(VPSS_GRP VpssGrp, VPSS_GRP_ATTR_S *pstGrpAttr); 44 | HI_S32 HI_MPI_VPSS_SetGrpAttr(VPSS_GRP VpssGrp, VPSS_GRP_ATTR_S *pstGrpAttr); 45 | 46 | HI_S32 HI_MPI_VPSS_EnableBackupFrame(VPSS_GRP VpssGrp); 47 | HI_S32 HI_MPI_VPSS_DisableBackupFrame(VPSS_GRP VpssGrp); 48 | 49 | HI_S32 HI_MPI_VPSS_GetChnAttr(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_ATTR_S *pstChnAttr); 50 | HI_S32 HI_MPI_VPSS_SetChnAttr(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_ATTR_S *pstChnAttr); 51 | 52 | HI_S32 HI_MPI_VPSS_SetGrpParam(VPSS_GRP VpssGrp, VPSS_GRP_PARAM_S *pstVpssParam); 53 | HI_S32 HI_MPI_VPSS_GetGrpParam(VPSS_GRP VpssGrp, VPSS_GRP_PARAM_S *pstVpssParam); 54 | 55 | HI_S32 HI_MPI_VPSS_SetCropCfg(VPSS_GRP VpssGrp, VPSS_CROP_INFO_S *pstCropInfo); 56 | HI_S32 HI_MPI_VPSS_GetCropCfg(VPSS_GRP VpssGrp, VPSS_CROP_INFO_S *pstCropInfo); 57 | 58 | HI_S32 HI_MPI_VPSS_SetChnMode(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_MODE_S *pstVpssMode); 59 | HI_S32 HI_MPI_VPSS_GetChnMode(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_MODE_S *pstVpssMode); 60 | 61 | HI_S32 HI_MPI_VPSS_SetDepth(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, HI_U32 u32Depth); 62 | HI_S32 HI_MPI_VPSS_GetDepth(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, HI_U32 *pu32Depth); 63 | 64 | HI_S32 HI_MPI_VPSS_UserSendFrame(VPSS_GRP VpssGrp, VIDEO_FRAME_INFO_S *pstVideoFrame); 65 | HI_S32 HI_MPI_VPSS_UserSendFrameTimeout(VPSS_GRP VpssGrp, VIDEO_FRAME_INFO_S *pstVideoFrame, HI_U32 u32MilliSec); 66 | 67 | HI_S32 HI_MPI_VPSS_UserGetFrame(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VIDEO_FRAME_INFO_S *pstVideoFrame); 68 | HI_S32 HI_MPI_VPSS_UserReleaseFrame(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VIDEO_FRAME_INFO_S *pstVideoFrame); 69 | 70 | HI_S32 HI_MPI_VPSS_UserGetGrpFrame(VPSS_GRP VpssGrp, VIDEO_FRAME_INFO_S *pstVideoFrame, HI_U32 u32FrameIndex); 71 | HI_S32 HI_MPI_VPSS_UserReleaseGrpFrame(VPSS_GRP VpssGrp, VIDEO_FRAME_INFO_S *pstVideoFrame); 72 | /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 73 | /*set&get vpss group prescale information.*/ 74 | HI_S32 HI_MPI_VPSS_SetPreScale(VPSS_GRP VpssGrp,VPSS_PRESCALE_INFO_S *pstPreScaleInfo); 75 | HI_S32 HI_MPI_VPSS_GetPreScale(VPSS_GRP VpssGrp,VPSS_PRESCALE_INFO_S *pstPreScaleInfo); 76 | 77 | /*set&get vpss group picture size filter information*/ 78 | HI_S32 HI_MPI_VPSS_SetGrpSizer(VPSS_GRP VpssGrp, VPSS_SIZER_INFO_S *pstVpssSizerInfo); 79 | HI_S32 HI_MPI_VPSS_GetGrpSizer(VPSS_GRP VpssGrp, VPSS_SIZER_INFO_S *pstVpssSizerInfo); 80 | 81 | HI_S32 HI_MPI_VPSS_SetDelay(VPSS_GRP VpssGrp, HI_U32 u32Delay); 82 | HI_S32 HI_MPI_VPSS_GetDelay(VPSS_GRP VpssGrp, HI_U32 *pu32Delay); 83 | 84 | /*set&get vpss group source picture framerate ctrl information*/ 85 | HI_S32 HI_MPI_VPSS_SetGrpFrameRate(VPSS_GRP VpssGrp, VPSS_FRAME_RATE_S *pstVpssFrameRate); 86 | HI_S32 HI_MPI_VPSS_GetGrpFrameRate(VPSS_GRP VpssGrp, VPSS_FRAME_RATE_S *pstVpssFrameRate); 87 | 88 | /*set&get vpss channel Nr(Noise Reduction) parameters.*/ 89 | HI_S32 HI_MPI_VPSS_SetChnNrParam(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_NR_PARAM_S *pstChnNrParam); 90 | HI_S32 HI_MPI_VPSS_GetChnNrParam(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_NR_PARAM_S *pstChnNrParam); 91 | 92 | /*set&get vpss channel sharpen parameters.*/ 93 | HI_S32 HI_MPI_VPSS_SetChnSpParam(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_SP_PARAM_S *pstChnSpParam); 94 | HI_S32 HI_MPI_VPSS_GetChnSpParam(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CHN_SP_PARAM_S *pstChnSpParam); 95 | 96 | /*set&get vpss channel field information.*/ 97 | HI_S32 HI_MPI_VPSS_SetChnField(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CAPSEL_E enCapSel); 98 | HI_S32 HI_MPI_VPSS_GetChnField(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_CAPSEL_E *enCapSel); 99 | 100 | /*set&get vpss group field information.*/ 101 | HI_S32 HI_MPI_VPSS_SetGrpField(VPSS_GRP VpssGrp, VPSS_CAPSEL_E enCapSel); 102 | HI_S32 HI_MPI_VPSS_GetGrpField(VPSS_GRP VpssGrp, VPSS_CAPSEL_E *penCapSel); 103 | 104 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 105 | /*set&get vpss extend channel attributes*/ 106 | HI_S32 HI_MPI_VPSS_SetExtChnAttr(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_EXT_CHN_ATTR_S *pstExtChnAttr); 107 | HI_S32 HI_MPI_VPSS_GetExtChnAttr(VPSS_GRP VpssGrp, VPSS_CHN VpssChn, VPSS_EXT_CHN_ATTR_S *pstExtChnAttr); 108 | 109 | /*set&get vpss group picture rotate information*/ 110 | //HI_S32 HI_MPI_VPSS_SetRotate(VPSS_GRP VpssGrp, ROTATE_E enRotate); 111 | //HI_S32 HI_MPI_VPSS_GetRotate(VPSS_GRP VpssGrp, ROTATE_E *penRotate); 112 | 113 | #ifdef __cplusplus 114 | #if __cplusplus 115 | } 116 | #endif 117 | #endif /* __cplusplus */ 118 | 119 | #endif /* __MPI_VPSS_H__ */ 120 | 121 | -------------------------------------------------------------------------------- /src/hi3518/mpp2/lib/libVoiceEngine.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/lib/libVoiceEngine.a -------------------------------------------------------------------------------- /src/hi3518/mpp2/lib/libaec.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/lib/libaec.a -------------------------------------------------------------------------------- /src/hi3518/mpp2/lib/libanr.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/lib/libanr.a -------------------------------------------------------------------------------- /src/hi3518/mpp2/lib/libresampler.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/lib/libresampler.a -------------------------------------------------------------------------------- /src/hi3518/mpp2/lib/libvqev2.a: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/TangCheng/imedia_rtsp/55a9881fc925f4b6879f45c13dbc81cc63b0ad45/src/hi3518/mpp2/lib/libvqev2.a -------------------------------------------------------------------------------- /src/hi3518/sensor/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | 4 | SUBDIRS = \ 5 | sony_imx122 6 | -------------------------------------------------------------------------------- /src/hi3518/sensor/sony_imx122/Makefile.am: -------------------------------------------------------------------------------- 1 | ## Process this file with automake to produce Makefile.in 2 | 3 | 4 | if INTERNAL_MPP 5 | if HI3518 6 | MPP_DIR = $(top_srcdir)/src/hi3518/mpp2 7 | endif 8 | if HI3516 9 | MPP_DIR = $(top_srcdir)/src/hi3518/mpp2 10 | endif 11 | else 12 | MPP_DIR = $(MPPDIR) 13 | endif 14 | 15 | AM_CPPFLAGS = \ 16 | -I$(MPP_DIR)/include \ 17 | -I$(MPP_DIR)/extdrv/ssp-sony 18 | 19 | lib_LTLIBRARIES = libsns_imx122_uxga.la 20 | libsns_imx122_uxga_la_SOURCES = imx122_cmos.c imx122_sensor_ctl.c 21 | libsns_imx122_uxga_la_LDFLAGS = -module -export-dynamic -avoid-version 22 | -------------------------------------------------------------------------------- /src/hi3518/video_detect.h: -------------------------------------------------------------------------------- 1 | #ifndef __VIDEO_DETECT_H__ 2 | #define __VIDEO_DETECT_H__ 3 | 4 | #include 5 | #include 6 | #include "stream_descriptor.h" 7 | 8 | #define IPCAM_VIDEO_DETECT_TYPE (ipcam_video_detect_get_type()) 9 | #define IPCAM_VIDEO_DETECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_VIDEO_DETECT_TYPE, IpcamVideoDetect)) 10 | #define IPCAM_VIDEO_DETECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_VIDEO_DETECT_TYPE, IpcamVideoDetectClass)) 11 | #define IPCAM_IS_VIDEO_DETECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_VIDEO_DETECT_TYPE)) 12 | #define IPCAM_IS_VIDEO_DETECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_VIDEO_DETECT_TYPE)) 13 | #define IPCAM_VIDEO_DETECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_VIDEO_DETECT_TYPE, IpcamVideoDetectClass)) 14 | 15 | typedef struct _IpcamVideoDetect IpcamVideoDetect; 16 | typedef struct _IpcamVideoDetectClass IpcamVideoDetectClass; 17 | 18 | struct _IpcamVideoDetect 19 | { 20 | GObject parent; 21 | }; 22 | 23 | struct _IpcamVideoDetectClass 24 | { 25 | GObjectClass parent_class; 26 | }; 27 | 28 | typedef struct OD_REGION_INFO 29 | { 30 | gboolean enable; 31 | guint32 sensitivity; 32 | struct { 33 | int left; 34 | int top; 35 | int width; 36 | int height; 37 | } rect; 38 | } OD_REGION_INFO; 39 | 40 | GType ipcam_video_detect_get_type(void); 41 | gint32 ipcam_video_detect_start(IpcamVideoDetect *self, OD_REGION_INFO reg_info[]); 42 | gint32 ipcam_video_detect_stop(IpcamVideoDetect *self); 43 | void ipcam_video_detect_param_change(IpcamVideoDetect *self, OD_REGION_INFO reg_info[]); 44 | 45 | #endif /* __VIDEO_DETECT_H__ */ 46 | -------------------------------------------------------------------------------- /src/hi3518/video_encode.h: -------------------------------------------------------------------------------- 1 | #ifndef __VIDEO_ENCODE_H__ 2 | #define __VIDEO_ENCODE_H__ 3 | 4 | #include 5 | #include 6 | #include "stream_descriptor.h" 7 | 8 | #define IPCAM_VIDEO_ENCODE_TYPE (ipcam_video_encode_get_type()) 9 | #define IPCAM_VIDEO_ENCODE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_VIDEO_ENCODE_TYPE, IpcamVideoEncode)) 10 | #define IPCAM_VIDEO_ENCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_VIDEO_ENCODE_TYPE, IpcamVideoEncodeClass)) 11 | #define IPCAM_IS_VIDEO_ENCODE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_VIDEO_ENCODE_TYPE)) 12 | #define IPCAM_IS_VIDEO_ENCODE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_VIDEO_ENCODE_TYPE)) 13 | #define IPCAM_VIDEO_ENCODE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_VIDEO_ENCODE_TYPE, IpcamVideoEncodeClass)) 14 | 15 | typedef struct _IpcamVideoEncode IpcamVideoEncode; 16 | typedef struct _IpcamVideoEncodeClass IpcamVideoEncodeClass; 17 | 18 | struct _IpcamVideoEncode 19 | { 20 | GObject parent; 21 | }; 22 | 23 | struct _IpcamVideoEncodeClass 24 | { 25 | GObjectClass parent_class; 26 | }; 27 | 28 | GType ipcam_video_encode_get_type(void); 29 | gint32 ipcam_video_encode_start(IpcamVideoEncode *self, StreamDescriptor desc[]); 30 | gint32 ipcam_video_encode_stop(IpcamVideoEncode *self); 31 | gint32 ipcam_video_encode_enable_color2grey(IpcamVideoEncode *self); 32 | gint32 ipcam_video_encode_disable_color2grey(IpcamVideoEncode *self); 33 | void ipcam_video_encode_param_change(IpcamVideoEncode *self, StreamDescriptor desc[]); 34 | 35 | #endif /* __VIDEO_ENCODE_H__ */ 36 | -------------------------------------------------------------------------------- /src/hi3518/video_input.h: -------------------------------------------------------------------------------- 1 | #ifndef __VIDEO_INPUT_H__ 2 | #define __VIDEO_INPUT_H__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include "stream_descriptor.h" 11 | 12 | #define IPCAM_VIDEO_INPUT_TYPE (ipcam_video_input_get_type()) 13 | #define IPCAM_VIDEO_INPUT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_VIDEO_INPUT_TYPE, IpcamVideoInput)) 14 | #define IPCAM_VIDEO_INPUT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_VIDEO_INPUT_TYPE, IpcamVideoInputClass)) 15 | #define IPCAM_IS_VIDEO_INPUT(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_VIDEO_INPUT_TYPE)) 16 | #define IPCAM_IS_VIDEO_INPUT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_VIDEO_INPUT_TYPE)) 17 | #define IPCAM_VIDEO_INPUT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_VIDEO_INPUT_TYPE, IpcamVideoInputClass)) 18 | 19 | typedef struct _IpcamVideoInput IpcamVideoInput; 20 | typedef struct _IpcamVideoInputClass IpcamVideoInputClass; 21 | 22 | struct _IpcamVideoInput 23 | { 24 | GObject parent; 25 | }; 26 | 27 | struct _IpcamVideoInputClass 28 | { 29 | GObjectClass parent_class; 30 | }; 31 | 32 | GType ipcam_video_input_get_type(void); 33 | gint32 ipcam_video_input_start(IpcamVideoInput *self, StreamDescriptor desc[]); 34 | gint32 ipcam_video_input_stop(IpcamVideoInput *self); 35 | gint32 ipcam_video_input_query(IpcamVideoInput *self, VI_CHN_STAT_S *stat); 36 | void ipcam_video_input_param_change(IpcamVideoInput *self, StreamDescriptor desc[]); 37 | void ipcam_video_input_set_image_parameter(IpcamVideoInput *self, IpcamMediaImageAttr *attr); 38 | 39 | #endif /* __VIDEO_INPUT_H__ */ 40 | -------------------------------------------------------------------------------- /src/hi3518/video_process_subsystem.h: -------------------------------------------------------------------------------- 1 | #ifndef __VIDEO_PROCESS_SUBSYSTEM_H__ 2 | #define __VIDEO_PROCESS_SUBSYSTEM_H__ 3 | 4 | #include 5 | #include 6 | #include "stream_descriptor.h" 7 | 8 | #define IPCAM_VIDEO_PROCESS_SUBSYSTEM_TYPE (ipcam_video_process_subsystem_get_type()) 9 | #define IPCAM_VIDEO_PROCESS_SUBSYSTEM(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_VIDEO_PROCESS_SUBSYSTEM_TYPE, IpcamVideoProcessSubsystem)) 10 | #define IPCAM_VIDEO_PROCESS_SUBSYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_VIDEO_PROCESS_SUBSYSTEM_TYPE, IpcamVideoProcessSubsystemClass)) 11 | #define IPCAM_IS_VIDEO_PROCESS_SUBSYSTEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_VIDEO_PROCESS_SUBSYSTEM_TYPE)) 12 | #define IPCAM_IS_VIDEO_PROCESS_SUBSYSTEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_VIDEO_PROCESS_SUBSYSTEM_TYPE)) 13 | #define IPCAM_VIDEO_PROCESS_SUBSYSTEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_VIDEO_PROCESS_SUBSYSTEM_TYPE, IpcamVideoProcessSubsystemClass)) 14 | 15 | typedef struct _IpcamVideoProcessSubsystem IpcamVideoProcessSubsystem; 16 | typedef struct _IpcamVideoProcessSubsystemClass IpcamVideoProcessSubsystemClass; 17 | 18 | struct _IpcamVideoProcessSubsystem 19 | { 20 | GObject parent; 21 | }; 22 | 23 | struct _IpcamVideoProcessSubsystemClass 24 | { 25 | GObjectClass parent_class; 26 | }; 27 | 28 | GType ipcam_video_process_subsystem_get_type(void); 29 | gint32 ipcam_video_process_subsystem_start(IpcamVideoProcessSubsystem *self, StreamDescriptor desc[]); 30 | gint32 ipcam_video_process_subsystem_stop(IpcamVideoProcessSubsystem *self); 31 | void ipcam_video_process_subsystem_param_change(IpcamVideoProcessSubsystem *self, StreamDescriptor desc[]); 32 | 33 | #endif /* __VIDEO_PROCESS_SUBSYSTEM_H__ */ 34 | -------------------------------------------------------------------------------- /src/imedia.h: -------------------------------------------------------------------------------- 1 | #ifndef __IMEDIA_H__ 2 | #define __IMEDIA_H__ 3 | 4 | #include 5 | #include 6 | #include "stream_descriptor.h" 7 | 8 | #ifdef __cplusplus 9 | extern "C" 10 | { 11 | #endif 12 | 13 | #define IPCAM_IMEDIA_TYPE (ipcam_imedia_get_type()) 14 | #define IPCAM_IMEDIA(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_IMEDIA_TYPE, IpcamIMedia)) 15 | #define IPCAM_IMEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_IMEDIA_TYPE, IpcamIMediaClass)) 16 | #define IPCAM_IS_IMEDIA(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_IMEDIA_TYPE)) 17 | #define IPCAM_IS_IMEDIA_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_IMEDIA_TYPE)) 18 | #define IPCAM_IMEDIA_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_IMEDIA_TYPE, IpcamIMediaClass)) 19 | 20 | typedef struct _IpcamIMedia IpcamIMedia; 21 | typedef struct _IpcamIMediaClass IpcamIMediaClass; 22 | 23 | struct _IpcamIMedia 24 | { 25 | IpcamBaseApp parent; 26 | }; 27 | 28 | struct _IpcamIMediaClass 29 | { 30 | IpcamBaseAppClass parent_class; 31 | }; 32 | 33 | GType ipcam_imedia_get_type(void); 34 | void ipcam_imedia_got_od_param(IpcamIMedia *imedia, JsonNode *body, gboolean is_notice); 35 | void ipcam_imedia_got_video_param(IpcamIMedia *imedia, JsonNode *body, gboolean is_notice); 36 | void ipcam_imedia_got_image_parameter(IpcamIMedia *imedia, JsonNode *body); 37 | void ipcam_imedia_got_baseinfo_parameter(IpcamIMedia *imedia, JsonNode *body); 38 | void ipcam_imedia_got_osd_parameter(IpcamIMedia *imedia, JsonNode *body); 39 | void ipcam_imedia_got_szyc_parameter(IpcamIMedia *imedia, JsonNode *body); 40 | void ipcam_imedia_got_day_night_mode_param(IpcamIMedia *imedia, JsonNode *body); 41 | void ipcam_imedia_got_misc_parameter(IpcamIMedia *imedia, JsonNode *body); 42 | void ipcam_imedia_got_set_users_parameter(IpcamIMedia *imedia, JsonNode *body); 43 | void ipcam_imedia_got_del_users_parameter(IpcamIMedia *imedia, JsonNode *body); 44 | void ipcam_imedia_got_day_night_mode_parameter(IpcamIMedia *imedia, JsonNode *body); 45 | StreamDescriptor *ipcam_imedia_get_stream_info(IpcamIMedia *imedia, StreamChannel chn); 46 | 47 | 48 | #ifdef __cplusplus 49 | } 50 | #endif 51 | 52 | #endif /* __IMEDIA_H__ */ 53 | -------------------------------------------------------------------------------- /src/main.c: -------------------------------------------------------------------------------- 1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */ 2 | /* 3 | * main.c 4 | * Copyright (C) 2014 TangCheng 5 | * 6 | */ 7 | 8 | #include "imedia.h" 9 | 10 | int main(int argc, char **argv) 11 | { 12 | IpcamIMedia *imedia = g_object_new(IPCAM_IMEDIA_TYPE, "name", "imedia_rtsp", NULL); 13 | ipcam_base_service_start(IPCAM_BASE_SERVICE(imedia)); 14 | return (0); 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/media-ircut.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | #include "media-ircut.h" 7 | 8 | typedef struct HI35XX_ADC_REG 9 | { 10 | HI_U32 status; 11 | HI_U32 ctrl; 12 | HI_U32 powerdown; 13 | HI_U32 int_status; 14 | HI_U32 int_mask; 15 | HI_U32 int_clr; 16 | HI_U32 int_raw; 17 | HI_U32 result; 18 | } HI35XX_ADC_REG; 19 | 20 | typedef struct HI35XX_GPIO_REG 21 | { 22 | HI_U32 data[0x100]; 23 | HI_U32 dir; 24 | HI_U32 is; 25 | HI_U32 ibe; 26 | HI_U32 iev; 27 | HI_U32 ie; 28 | HI_U32 ris; 29 | HI_U32 mis; 30 | HI_U32 ic; 31 | } HI35XX_GPIO_REG; 32 | 33 | typedef struct HI35XX_PWM_REG 34 | { 35 | HI_U32 pwm0_cfg0; 36 | HI_U32 pwm0_cfg1; 37 | HI_U32 pwm0_cfg2; 38 | HI_U32 pwm0_ctrl; 39 | HI_U32 pwm0_state0; 40 | HI_U32 pwm0_state1; 41 | HI_U32 pwm0_state2; 42 | HI_U32 pwm0_dummy; 43 | HI_U32 pwm1_cfg0; 44 | HI_U32 pwm1_cfg1; 45 | HI_U32 pwm1_cfg2; 46 | HI_U32 pwm1_ctrl; 47 | HI_U32 pwm1_state0; 48 | HI_U32 pwm1_state1; 49 | HI_U32 pwm1_state2; 50 | } HI35XX_PWM_REG; 51 | 52 | struct MediaIrCut 53 | { 54 | gboolean status; 55 | gboolean hw_found; 56 | guint16 sensitivity; 57 | guint16 hysteresis; 58 | guint pwm_duty; 59 | guint32 count; 60 | volatile HI35XX_ADC_REG *adc_base; 61 | volatile HI35XX_GPIO_REG *gpio8_base; 62 | volatile HI35XX_PWM_REG *pwm_base; 63 | }; 64 | 65 | static gboolean media_ircut_hw_detect(void); 66 | static void media_ircut_initialize(MediaIrCut *ircut); 67 | 68 | MediaIrCut *media_ircut_new(guint16 sensitivity, guint16 hysteresis) 69 | { 70 | MediaIrCut *ircut = NULL; 71 | 72 | if (!media_ircut_hw_detect()) 73 | return NULL; 74 | 75 | ircut = g_malloc0(sizeof(MediaIrCut)); 76 | 77 | g_return_val_if_fail(ircut != NULL, NULL); 78 | 79 | ircut->status = FALSE; 80 | ircut->sensitivity = sensitivity; 81 | ircut->hysteresis = hysteresis; 82 | ircut->pwm_duty = 100; 83 | ircut->count = 0; 84 | 85 | ircut->adc_base = HI_MPI_SYS_Mmap(0x200B0000, 0x1000); 86 | ircut->gpio8_base = HI_MPI_SYS_Mmap(0x201C0000, 0x1000); 87 | ircut->pwm_base = HI_MPI_SYS_Mmap(0x20130000, 0x1000); 88 | 89 | media_ircut_initialize(ircut); 90 | 91 | return ircut; 92 | } 93 | 94 | void media_ircut_free(MediaIrCut *ircut) 95 | { 96 | g_return_if_fail(ircut != NULL); 97 | 98 | HI_MPI_SYS_Munmap((HI_VOID*)ircut->adc_base, 0x1000); 99 | HI_MPI_SYS_Munmap((HI_VOID*)ircut->gpio8_base, 0x1000); 100 | HI_MPI_SYS_Munmap((HI_VOID*)ircut->pwm_base, 0x1000); 101 | 102 | g_free(ircut); 103 | } 104 | 105 | static gboolean media_ircut_hw_detect(void) 106 | { 107 | #if 0 108 | gboolean result; 109 | volatile HI35XX_GPIO_REG *gpio1; 110 | 111 | gpio1 = HI_MPI_SYS_Mmap(0x20150000, 0x1000); 112 | if (!gpio1) 113 | return FALSE; 114 | 115 | gpio1->dir &= ~(1 << 0); 116 | 117 | result = gpio1->data[1 << 0] ? TRUE : FALSE; 118 | 119 | HI_MPI_SYS_Munmap((void*)gpio1, 0x1000); 120 | 121 | return result; 122 | #endif 123 | char *env_str = getenv("IRCUT"); 124 | if (env_str && !strcasecmp(env_str, "TRUE")) 125 | return TRUE; 126 | 127 | return FALSE; 128 | } 129 | 130 | static void media_ircut_enable_color_filter(MediaIrCut *ircut) 131 | { 132 | g_return_if_fail(ircut != NULL); 133 | 134 | ircut->gpio8_base->data[0x60] = 0x40; 135 | } 136 | 137 | static void media_ircut_disable_color_filter(MediaIrCut *ircut) 138 | { 139 | g_return_if_fail(ircut != NULL); 140 | 141 | ircut->gpio8_base->data[0x60] = 0x20; 142 | } 143 | 144 | static void media_ircut_enable_pwm_output(MediaIrCut *ircut) 145 | { 146 | int cycles = 3000000 / 3000; 147 | 148 | ircut->pwm_base->pwm1_ctrl = 0; 149 | ircut->pwm_base->pwm1_cfg0 = cycles; 150 | ircut->pwm_base->pwm1_cfg1 = cycles * ircut->pwm_duty / 100; 151 | ircut->pwm_base->pwm1_cfg2 = 1023; 152 | ircut->pwm_base->pwm1_ctrl = 5; /* keep outout & start */ 153 | 154 | ircut->gpio8_base->data[0x02] = 0x02; 155 | } 156 | 157 | static void media_ircut_disable_pwm_output(MediaIrCut *ircut) 158 | { 159 | ircut->gpio8_base->data[0x02] = 0x00; 160 | } 161 | 162 | static guint16 media_ircut_get_adc_value(MediaIrCut *ircut) 163 | { 164 | int cnt; 165 | guint16 result = 0; 166 | 167 | ircut->adc_base->ctrl = 0x00010001; /* start covert */ 168 | /* wait for interrupt */ 169 | for (cnt = 0; !(ircut->adc_base->int_status & 0x1) && cnt < 10; cnt++) { 170 | usleep(100); 171 | } 172 | 173 | result = ircut->adc_base->result; /* get result */ 174 | ircut->adc_base->int_clr = 1; /* clear interrupt */ 175 | 176 | return result & 0x3ff; 177 | } 178 | 179 | static void media_ircut_initialize(MediaIrCut *ircut) 180 | { 181 | g_return_if_fail(ircut != NULL); 182 | 183 | /* SAR_ADC initialize */ 184 | ircut->adc_base->powerdown = 0; /* power on */ 185 | ircut->adc_base->ctrl = 0x00010000; /* select ADC1 */ 186 | ircut->adc_base->int_mask = 0; /* enable ADC interrupt */ 187 | 188 | /* IrCut optical filter initialize */ 189 | /* GPIO8_1/GPIO8_5/GPIO8_6 */ 190 | ircut->gpio8_base->dir |= (1 << 1) | (1 << 5) | (1 << 6); 191 | /* Enable color filter default */ 192 | media_ircut_enable_color_filter(ircut); 193 | /* Ir Output enable */ 194 | ircut->gpio8_base->data[0x02] = 0x02; 195 | 196 | /* PWM initialize */ 197 | media_ircut_disable_pwm_output(ircut); 198 | } 199 | 200 | #define IRCUT_TRIGGER_COUNT 10 201 | 202 | gboolean media_ircut_poll(MediaIrCut *ircut) 203 | { 204 | gboolean triggered = FALSE; 205 | 206 | g_return_val_if_fail(ircut != NULL, FALSE); 207 | 208 | guint16 value = media_ircut_get_adc_value(ircut); 209 | 210 | if (!ircut->status) { /* IrCut not enabled */ 211 | guint16 threshold = ircut->sensitivity < ircut->hysteresis ? 0 : 212 | ircut->sensitivity - ircut->hysteresis; 213 | if (value < threshold) { 214 | if (ircut->count > IRCUT_TRIGGER_COUNT) { 215 | media_ircut_disable_color_filter(ircut); 216 | media_ircut_enable_pwm_output(ircut); 217 | ircut->status = TRUE; 218 | ircut->count = 0; 219 | 220 | triggered = TRUE; 221 | } 222 | else { 223 | ircut->count++; 224 | } 225 | } 226 | else { 227 | ircut->count = 0; 228 | } 229 | } 230 | else { /* IrCut already enabled */ 231 | guint16 threshold = ircut->sensitivity; 232 | if (value > threshold) { 233 | if (ircut->count > IRCUT_TRIGGER_COUNT) { 234 | media_ircut_enable_color_filter(ircut); 235 | media_ircut_disable_pwm_output(ircut); 236 | ircut->status = FALSE; 237 | ircut->count = 0; 238 | 239 | triggered = TRUE; 240 | } 241 | else { 242 | ircut->count++; 243 | } 244 | } 245 | else { 246 | ircut->count = 0; 247 | } 248 | } 249 | 250 | return triggered; 251 | } 252 | 253 | void media_ircut_set_sensitivity(MediaIrCut *ircut, guint16 value) 254 | { 255 | g_return_if_fail(ircut != NULL); 256 | 257 | ircut->sensitivity = value * 1024 / 100; 258 | } 259 | 260 | void media_ircut_set_ir_intensity(MediaIrCut *ircut, guint16 value) 261 | { 262 | g_return_if_fail(ircut != NULL); 263 | 264 | ircut->pwm_duty = value; 265 | 266 | if (ircut->status) 267 | media_ircut_enable_pwm_output(ircut); 268 | } 269 | 270 | gboolean media_ircut_get_status(MediaIrCut *ircut) 271 | { 272 | g_return_val_if_fail(ircut != NULL, FALSE); 273 | 274 | return ircut->status; 275 | } 276 | -------------------------------------------------------------------------------- /src/media-ircut.h: -------------------------------------------------------------------------------- 1 | #ifndef __MEDIA_IRCUT_H_ 2 | #define __MEDIA_IRCUT_H_ 3 | 4 | struct MediaIrCut; 5 | typedef struct MediaIrCut MediaIrCut; 6 | 7 | MediaIrCut *media_ircut_new(guint16 sensitivity, guint16 hysteresis); 8 | void media_ircut_free(MediaIrCut *ircut); 9 | gboolean media_ircut_poll(MediaIrCut *ircut); 10 | void media_ircut_set_sensitivity(MediaIrCut *ircut, guint16 value); 11 | void media_ircut_set_ir_intensity(MediaIrCut *ircut, guint16 value); 12 | gboolean media_ircut_get_status(MediaIrCut *ircut); 13 | 14 | #endif /* __MEDIA_IRCUT_H_ */ -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamInput.cpp: -------------------------------------------------------------------------------- 1 | //==============================================================================// 2 | // Notes: This C++ program is designed to simplify taking with the FFMPEG // 3 | // and Live555 library. It provides some basic functions to encode a video from // 4 | // your code and restream it over rtsp. // 5 | // // 6 | // Usage: Use this project as a template for your own program, and play the // 7 | // RTSP stream using rtsp://127.0.0.1 from VLC. // 8 | //==============================================================================// 9 | 10 | #include "stream_descriptor.h" 11 | #include "LiveStreamInput.hh" 12 | 13 | LiveStreamInput* LiveStreamInput::createNew(UsageEnvironment& env, StreamChannel chn, StreamDescriptor *desc) { 14 | return new LiveStreamInput(env, chn, desc); 15 | } 16 | 17 | FramedSource* LiveStreamInput::audioSource() { 18 | if (1/*fOurAudioSource == NULL*/) { 19 | fOurAudioSource = LiveAudioStreamSource::createNew(envir(), fChannelNo); 20 | } 21 | return fOurAudioSource; 22 | } 23 | 24 | FramedSource* LiveStreamInput::videoSource() { 25 | if (1/*fOurVideoSource == NULL*/) { 26 | fOurVideoSource = LiveVideoStreamSource::createNew(envir(), fChannelNo); 27 | } 28 | return fOurVideoSource; 29 | } 30 | 31 | LiveStreamInput::LiveStreamInput(UsageEnvironment& env, StreamChannel chn, StreamDescriptor *desc) 32 | : Medium(env), fOurVideoSource(NULL), fChannelNo(chn), fStreamDesc(desc) 33 | { 34 | } 35 | 36 | LiveStreamInput::~LiveStreamInput() { 37 | if (fOurVideoSource != NULL) { 38 | LiveVideoStreamSource::handleClosure(fOurVideoSource); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamInput.hh: -------------------------------------------------------------------------------- 1 | #ifndef __LIVE_STREAM_INPUT_HH 2 | #define __LIVE_STREAM_INPUT_HH 3 | 4 | #include 5 | #include "LiveStreamSource.hh" 6 | 7 | class LiveStreamInput: public Medium { 8 | public: 9 | static LiveStreamInput* createNew(UsageEnvironment& env, StreamChannel chn, StreamDescriptor *desc); 10 | 11 | FramedSource* audioSource(); 12 | FramedSource* videoSource(); 13 | 14 | StreamChannel channelNo() const { return fChannelNo; } 15 | StreamDescriptor* streamDesc() const { return fStreamDesc; } 16 | 17 | private: 18 | LiveStreamInput(UsageEnvironment& env, StreamChannel chn, StreamDescriptor *desc); // called only by createNew() 19 | virtual ~LiveStreamInput(); 20 | 21 | private: 22 | FramedSource* fOurVideoSource; 23 | FramedSource* fOurAudioSource; 24 | StreamChannel fChannelNo; 25 | StreamDescriptor *fStreamDesc; 26 | }; 27 | 28 | #endif 29 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamRTSPServer.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2015, Live Networks, Inc. All rights reserved 17 | // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand, 18 | // based on whether or not the specified stream name exists as a file 19 | // Implementation 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include "LiveStreamServerMediaSubsession.hh" 26 | #include "LiveStreamInput.hh" 27 | #include "LiveStreamRTSPServer.hh" 28 | 29 | LiveStreamRTSPServer* 30 | LiveStreamRTSPServer::createNew(UsageEnvironment& env, Port ourPort, 31 | UserAuthenticationDatabase* authDatabase, 32 | unsigned reclamationTestSeconds) { 33 | int ourSocket = setUpOurSocket(env, ourPort); 34 | if (ourSocket == -1) return NULL; 35 | 36 | return new LiveStreamRTSPServer(env, ourSocket, ourPort, authDatabase, reclamationTestSeconds); 37 | } 38 | 39 | LiveStreamRTSPServer::LiveStreamRTSPServer(UsageEnvironment& env, 40 | int ourSocket, Port ourPort, 41 | UserAuthenticationDatabase* authDatabase, 42 | unsigned reclamationTestSeconds) 43 | : RTSPServer(env, ourSocket, ourPort, authDatabase, reclamationTestSeconds), 44 | fStreamInputHash(HashTable::create(ONE_WORD_HASH_KEYS)), 45 | fResolutionRE(""), 46 | fChannelRE("") { 47 | } 48 | 49 | LiveStreamRTSPServer::~LiveStreamRTSPServer() { 50 | // Delete all server media sessions 51 | LiveStreamInput* streamInput; 52 | while ((streamInput = (LiveStreamInput*)fStreamInputHash->getFirst()) != NULL) { 53 | //removeServerMediaSession(serverMediaSession); // will delete it, because it no longer has any 'client session' objects using it 54 | } 55 | delete fStreamInputHash; 56 | } 57 | 58 | void LiveStreamRTSPServer::addStreamInput(LiveStreamInput *streamInput) 59 | { 60 | StreamChannel chn = streamInput->channelNo(); 61 | removeStreamInput(chn); // in case an existing 'LiveStreamInput' with this channel already exists 62 | fStreamInputHash->Add((char const*)chn, (void*)streamInput); 63 | } 64 | 65 | void LiveStreamRTSPServer::removeStreamInput(LiveStreamInput *streamInput) 66 | { 67 | if (streamInput == NULL) return; 68 | 69 | fStreamInputHash->Remove((char const*)streamInput->channelNo()); 70 | Medium::close(streamInput); 71 | } 72 | 73 | void LiveStreamRTSPServer::removeStreamInput(StreamChannel chn) 74 | { 75 | removeStreamInput((LiveStreamInput*)(fStreamInputHash->Lookup((char const*)chn))); 76 | } 77 | 78 | ServerMediaSession* LiveStreamRTSPServer 79 | ::lookupServerMediaSession(char const* streamName, Boolean isFirstLookupInSession) { 80 | ServerMediaSession *sms = NULL; 81 | HashTable::Iterator *iter; 82 | LiveStreamInput *streamInput; 83 | char const* key; 84 | 85 | std::string strName = streamName; 86 | std::transform(strName.begin(), strName.end(), strName.begin(), ::toupper); 87 | 88 | iter = HashTable::Iterator::create(*fStreamInputHash); 89 | while ((streamInput = (LiveStreamInput*)(iter->next(key))) != NULL) { 90 | StreamDescriptor *desc = streamInput->streamDesc(); 91 | if (desc && desc->v_desc.path) { 92 | if (strcasecmp(strName.c_str(), desc->v_desc.path) == 0) { 93 | sms = RTSPServer::lookupServerMediaSession(strName.c_str()); 94 | if (sms == NULL) { 95 | char const* descriptionString = "Session streamed by \"iRTSP\""; 96 | sms = ServerMediaSession::createNew(envir(), 97 | strName.c_str(), 98 | strName.c_str(), 99 | descriptionString); 100 | if (sms) { 101 | sms->addSubsession(LiveVideoStreamServerMediaSubsession::createNew(envir(), *streamInput)); 102 | sms->addSubsession(LiveAudioStreamServerMediaSubsession::createNew(envir(), *streamInput)); 103 | addServerMediaSession(sms); 104 | } 105 | } 106 | break; 107 | } 108 | } 109 | } 110 | delete iter; 111 | 112 | return sms; 113 | } 114 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamRTSPServer.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // Copyright (c) 1996-2015, Live Networks, Inc. All rights reserved 17 | // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand, 18 | // based on whether or not the specified stream name exists as a file 19 | // Header file 20 | 21 | #ifndef _LIVE_STREAM_RTSP_SERVER_HH 22 | #define _LIVE_STREAM_RTSP_SERVER_HH 23 | 24 | #include 25 | 26 | class LiveStreamRTSPServer: public RTSPServer { 27 | public: 28 | static LiveStreamRTSPServer* createNew(UsageEnvironment& env, Port ourPort = 554, 29 | UserAuthenticationDatabase* authDatabase = NULL, 30 | unsigned reclamationTestSeconds = 65); 31 | 32 | void addStreamInput(LiveStreamInput *streamInput); 33 | void removeStreamInput(StreamChannel chn); 34 | void removeStreamInput(LiveStreamInput *streamInput); 35 | 36 | protected: 37 | LiveStreamRTSPServer(UsageEnvironment& env, 38 | int ourSocket, Port ourPort, 39 | UserAuthenticationDatabase* authDatabase, 40 | unsigned reclamationTestSeconds); 41 | // called only by createNew(); 42 | virtual ~LiveStreamRTSPServer(); 43 | 44 | protected: // redefined virtual functions 45 | virtual ServerMediaSession* 46 | lookupServerMediaSession(char const* streamName, Boolean isFirstLookupInSession); 47 | 48 | private: 49 | HashTable* fStreamInputHash; 50 | pcrecpp::RE fResolutionRE; 51 | pcrecpp::RE fChannelRE; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamServerMediaSession.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H264 video file. 20 | // Implementation 21 | 22 | #include 23 | #include 24 | #include "imedia.h" 25 | #include "H264LiveStreamSource.hh" 26 | #include "LiveStreamServerMediaSession.hh" 27 | 28 | H264LiveStreamServerMediaSubsession* 29 | H264LiveStreamServerMediaSubsession::createNew(UsageEnvironment& env, StreamChannel chn) { 30 | return new H264LiveStreamServerMediaSubsession(env, chn); 31 | } 32 | 33 | H264LiveStreamServerMediaSubsession:: 34 | H264LiveStreamServerMediaSubsession(UsageEnvironment& env, 35 | H264LiveStreamInput& input) 36 | : OnDemandServerMediaSubsession(env, True /* always reuse the first source */), 37 | fAuxSDPLine(NULL), fDoneFlag(0), fDummyRTPSink(NULL), 38 | fChannelNo(chn) { 39 | } 40 | 41 | H264LiveStreamServerMediaSubsession::~H264LiveStreamServerMediaSubsession() { 42 | delete[] fAuxSDPLine; 43 | } 44 | 45 | static void afterPlayingDummy(void* clientData) { 46 | H264LiveStreamServerMediaSubsession* subsess = (H264LiveStreamServerMediaSubsession*)clientData; 47 | subsess->afterPlayingDummy1(); 48 | } 49 | 50 | void H264LiveStreamServerMediaSubsession::afterPlayingDummy1() { 51 | // Unschedule any pending 'checking' task: 52 | envir().taskScheduler().unscheduleDelayedTask(nextTask()); 53 | // Signal the event loop that we're done: 54 | setDoneFlag(); 55 | } 56 | 57 | static void checkForAuxSDPLine(void* clientData) { 58 | H264LiveStreamServerMediaSubsession* subsess = (H264LiveStreamServerMediaSubsession*)clientData; 59 | subsess->checkForAuxSDPLine1(); 60 | } 61 | 62 | void H264LiveStreamServerMediaSubsession::checkForAuxSDPLine1() { 63 | char const* dasl; 64 | 65 | if (fAuxSDPLine != NULL) { 66 | // Signal the event loop that we're done: 67 | setDoneFlag(); 68 | } else if (fDummyRTPSink != NULL && (dasl = fDummyRTPSink->auxSDPLine()) != NULL) { 69 | fAuxSDPLine = strDup(dasl); 70 | fDummyRTPSink = NULL; 71 | 72 | // Signal the event loop that we're done: 73 | setDoneFlag(); 74 | } else { 75 | // try again after a brief delay: 76 | int uSecsToDelay = 100000; // 100 ms 77 | nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecsToDelay, 78 | (TaskFunc*)checkForAuxSDPLine, this); 79 | } 80 | } 81 | 82 | char const* H264LiveStreamServerMediaSubsession::getAuxSDPLine(RTPSink* rtpSink, FramedSource* inputSource) { 83 | if (fAuxSDPLine != NULL) return fAuxSDPLine; // it's already been set up (for a previous client) 84 | 85 | if (fDummyRTPSink == NULL) { // we're not already setting it up for another, concurrent stream 86 | // Note: For H264 video files, the 'config' information ("profile-level-id" and "sprop-parameter-sets") isn't known 87 | // until we start reading the file. This means that "rtpSink"s "auxSDPLine()" will be NULL initially, 88 | // and we need to start reading data from our file until this changes. 89 | fDummyRTPSink = rtpSink; 90 | 91 | // Start reading the file: 92 | fDummyRTPSink->startPlaying(*inputSource, afterPlayingDummy, this); 93 | 94 | // Check whether the sink's 'auxSDPLine()' is ready: 95 | checkForAuxSDPLine(this); 96 | } 97 | 98 | envir().taskScheduler().doEventLoop(&fDoneFlag); 99 | 100 | return fAuxSDPLine; 101 | } 102 | 103 | FramedSource* H264LiveStreamServerMediaSubsession::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) { 104 | estBitrate = 5000; // kbps, estimate 105 | 106 | // Create the video source: 107 | H264LiveStreamSource *video_source = H264LiveStreamSource::createNew(envir(), fChannelNo); 108 | 109 | // Create a framer for the Video Elementary Stream: 110 | return H264VideoStreamDiscreteFramer::createNew(envir(), video_source); 111 | } 112 | 113 | RTPSink* H264LiveStreamServerMediaSubsession 114 | ::createNewRTPSink(Groupsock* rtpGroupsock, 115 | unsigned char rtpPayloadTypeIfDynamic, 116 | FramedSource* /*inputSource*/) { 117 | H264VideoRTPSink *rtp_sink = H264VideoRTPSink::createNew(envir(), rtpGroupsock, rtpPayloadTypeIfDynamic); 118 | rtp_sink->setPacketSizes(1000, 1456 * 10); 119 | return rtp_sink; 120 | } 121 | 122 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamServerMediaSession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H264 Elementary Stream video file. 20 | // C++ header 21 | 22 | #ifndef _H264_LIVE_STREAM_SERVER_MEDIA_SUBSESSION_HH 23 | #define _H264_LIVE_STREAM_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #ifndef _ON_DEMAND_SERVER_MEDIA_SUBSESSION_HH 26 | #include 27 | #endif 28 | #include "stream_descriptor.h" 29 | 30 | class H264LiveStreamServerMediaSubsession: public OnDemandServerMediaSubsession { 31 | public: 32 | static H264LiveStreamServerMediaSubsession* 33 | createNew(UsageEnvironment& env, H264LiveStreamInput& streamInput); 34 | 35 | // Used to implement "getAuxSDPLine()": 36 | void checkForAuxSDPLine1(); 37 | void afterPlayingDummy1(); 38 | 39 | protected: 40 | H264LiveStreamServerMediaSubsession(UsageEnvironment& env, StreamChannel chn); 41 | // called only by createNew(); 42 | virtual ~H264LiveStreamServerMediaSubsession(); 43 | 44 | void setDoneFlag() { fDoneFlag = ~0; } 45 | 46 | protected: // redefined virtual functions 47 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, 48 | FramedSource* inputSource); 49 | 50 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 51 | unsigned& estBitrate); 52 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 53 | unsigned char rtpPayloadTypeIfDynamic, 54 | FramedSource* inputSource); 55 | 56 | private: 57 | StreamChannel fChannelNo; 58 | char* fAuxSDPLine; 59 | char fDoneFlag; // used when setting up "fAuxSDPLine" 60 | RTPSink* fDummyRTPSink; // ditto 61 | }; 62 | 63 | #endif 64 | 65 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamServerMediaSubsession.cpp: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H264 video file. 20 | // Implementation 21 | 22 | #include "stream_descriptor.h" 23 | #include "LiveStreamServerMediaSubsession.hh" 24 | #include "LiveStreamSource.hh" 25 | #include 26 | #include 27 | #include 28 | 29 | LiveVideoStreamServerMediaSubsession* 30 | LiveVideoStreamServerMediaSubsession::createNew(UsageEnvironment& env, 31 | LiveStreamInput& streamInput) { 32 | return new LiveVideoStreamServerMediaSubsession(env, streamInput); 33 | } 34 | 35 | LiveVideoStreamServerMediaSubsession::LiveVideoStreamServerMediaSubsession(UsageEnvironment& env, 36 | LiveStreamInput& streamInput) 37 | : OnDemandServerMediaSubsession(env, True /* always reuse the first source */), 38 | fStreamSource(NULL), fAuxSDPLine(NULL), fDoneFlag(0), fDummyRTPSink(NULL), 39 | fLiveStreamInput(streamInput) { 40 | } 41 | 42 | LiveVideoStreamServerMediaSubsession::~LiveVideoStreamServerMediaSubsession() { 43 | delete[] fAuxSDPLine; 44 | } 45 | 46 | static void afterPlayingDummy(void* clientData) { 47 | LiveVideoStreamServerMediaSubsession* subsess = (LiveVideoStreamServerMediaSubsession*)clientData; 48 | subsess->afterPlayingDummy1(); 49 | } 50 | 51 | void LiveVideoStreamServerMediaSubsession::afterPlayingDummy1() { 52 | // Unschedule any pending 'checking' task: 53 | envir().taskScheduler().unscheduleDelayedTask(nextTask()); 54 | // Signal the event loop that we're done: 55 | setDoneFlag(); 56 | } 57 | 58 | static void checkForAuxSDPLine(void* clientData) { 59 | LiveVideoStreamServerMediaSubsession* subsess = (LiveVideoStreamServerMediaSubsession*)clientData; 60 | subsess->checkForAuxSDPLine1(); 61 | } 62 | 63 | void LiveVideoStreamServerMediaSubsession::checkForAuxSDPLine1() { 64 | char const* dasl; 65 | 66 | if (fAuxSDPLine != NULL) { 67 | // Signal the event loop that we're done: 68 | setDoneFlag(); 69 | } else if (fDummyRTPSink != NULL && (dasl = fDummyRTPSink->auxSDPLine()) != NULL) { 70 | fAuxSDPLine = strDup(dasl); 71 | fDummyRTPSink = NULL; 72 | 73 | // Signal the event loop that we're done: 74 | setDoneFlag(); 75 | } else { 76 | // try again after a brief delay: 77 | int uSecsToDelay = 100000; // 100 ms 78 | nextTask() = envir().taskScheduler().scheduleDelayedTask(uSecsToDelay, 79 | (TaskFunc*)checkForAuxSDPLine, this); 80 | } 81 | } 82 | 83 | char const* LiveVideoStreamServerMediaSubsession::getAuxSDPLine(RTPSink* rtpSink, FramedSource* inputSource) { 84 | if (fAuxSDPLine != NULL) return fAuxSDPLine; // it's already been set up (for a previous client) 85 | 86 | if (fDummyRTPSink == NULL) { // we're not already setting it up for another, concurrent stream 87 | // Note: For H264 video files, the 'config' information ("profile-level-id" and "sprop-parameter-sets") isn't known 88 | // until we start reading the file. This means that "rtpSink"s "auxSDPLine()" will be NULL initially, 89 | // and we need to start reading data from our file until this changes. 90 | fDummyRTPSink = rtpSink; 91 | 92 | // Start reading the file: 93 | fDummyRTPSink->startPlaying(*inputSource, afterPlayingDummy, this); 94 | 95 | // Check whether the sink's 'auxSDPLine()' is ready: 96 | checkForAuxSDPLine(this); 97 | } 98 | 99 | envir().taskScheduler().doEventLoop(&fDoneFlag); 100 | 101 | return fAuxSDPLine; 102 | } 103 | 104 | FramedSource* LiveVideoStreamServerMediaSubsession::createNewStreamSource(unsigned /*clientSessionId*/, unsigned& estBitrate) { 105 | estBitrate = 5000; // kbps, estimate 106 | 107 | // StreamSource has already been created 108 | if (fStreamSource) { 109 | LiveVideoStreamSource *liveSource = 110 | dynamic_cast(fStreamSource->inputSource()); 111 | liveSource->referenceCount()++; 112 | return fStreamSource; 113 | } 114 | 115 | // Create a framer for the Video Elementary Stream: 116 | fStreamSource = H264VideoStreamDiscreteFramer::createNew(envir(), fLiveStreamInput.videoSource()); 117 | return fStreamSource; 118 | } 119 | 120 | void LiveVideoStreamServerMediaSubsession:: 121 | closeStreamSource(FramedSource *inputSource) 122 | { 123 | // Sanity check, should not happend 124 | if (fStreamSource != inputSource) { 125 | Medium::close(inputSource); 126 | return; 127 | } 128 | 129 | LiveVideoStreamSource *liveSource = 130 | dynamic_cast(fStreamSource->inputSource()); 131 | if (--liveSource->referenceCount() == 0) { 132 | Medium::close(fStreamSource); 133 | fStreamSource = NULL; 134 | } 135 | } 136 | 137 | RTPSink* LiveVideoStreamServerMediaSubsession 138 | ::createNewRTPSink(Groupsock* rtpGroupsock, 139 | unsigned char rtpPayloadTypeIfDynamic, 140 | FramedSource* /*inputSource*/) { 141 | H264VideoRTPSink *rtp_sink = H264VideoRTPSink::createNew(envir(), rtpGroupsock, rtpPayloadTypeIfDynamic); 142 | rtp_sink->setPacketSizes(1000, 1456 * 10); 143 | return rtp_sink; 144 | } 145 | 146 | 147 | //////////////////////////////////////////////////////////////////////////////// 148 | // Audio 149 | //////////////////////////////////////////////////////////////////////////////// 150 | 151 | LiveAudioStreamServerMediaSubsession* LiveAudioStreamServerMediaSubsession 152 | ::createNew(UsageEnvironment& env, LiveStreamInput& streamInput) 153 | { 154 | return new LiveAudioStreamServerMediaSubsession(env, streamInput); 155 | } 156 | 157 | LiveAudioStreamServerMediaSubsession 158 | ::LiveAudioStreamServerMediaSubsession(UsageEnvironment& env, LiveStreamInput& streamInput) 159 | : OnDemandServerMediaSubsession(env, True /* always reuse the first source */), 160 | fLiveStreamInput(streamInput) 161 | { 162 | } 163 | 164 | LiveAudioStreamServerMediaSubsession::~LiveAudioStreamServerMediaSubsession() 165 | { 166 | } 167 | 168 | FramedSource* LiveAudioStreamServerMediaSubsession 169 | ::createNewStreamSource(unsigned clientSessionId, unsigned& estBitrate) 170 | { 171 | estBitrate = 64; // kbps, estimate 172 | 173 | // Create the audio source: 174 | return fLiveStreamInput.audioSource(); 175 | } 176 | 177 | RTPSink* LiveAudioStreamServerMediaSubsession 178 | ::createNewRTPSink(Groupsock* rtpGroupsock, 179 | unsigned char rtpPayloadTypeIfDynamic, 180 | FramedSource* inputSource) 181 | { 182 | uint32_t samplerate = 8000;//fAudioStream.getSampleRate(); 183 | uint32_t nr_chans = 1; 184 | const char *mimeType = "PCMU"; 185 | unsigned char payloadFormatCode = rtpPayloadTypeIfDynamic; 186 | 187 | #if 0 188 | IAudioEncoder::EncodingType encoding; 189 | encoding = fAudioStream.getEncoding(); 190 | switch (encoding) { 191 | case IAudioEncoder::ADPCM: 192 | mimeType = "DVI4"; 193 | break; 194 | case IAudioEncoder::LPCM: 195 | mimeType = "L16"; 196 | break; 197 | case IAudioEncoder::G711A: 198 | mimeType = "PCMA"; 199 | break; 200 | case IAudioEncoder::G711U: 201 | mimeType = "PCMU"; 202 | break; 203 | case IAudioEncoder::G726: 204 | mimeType = "G726-40"; 205 | break; 206 | } 207 | #endif 208 | 209 | RTPSink *rtp_sink 210 | = SimpleRTPSink::createNew(envir(), rtpGroupsock, 211 | payloadFormatCode, samplerate, 212 | "audio", mimeType, nr_chans); 213 | return rtp_sink; 214 | } 215 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamServerMediaSubsession.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // A 'ServerMediaSubsession' object that creates new, unicast, "RTPSink"s 19 | // on demand, from a H264 Elementary Stream video file. 20 | // C++ header 21 | 22 | #ifndef _LIVE_STREAM_SERVER_MEDIA_SUBSESSION_HH 23 | #define _LIVE_STREAM_SERVER_MEDIA_SUBSESSION_HH 24 | 25 | #include 26 | #include 27 | #include "LiveStreamInput.hh" 28 | 29 | class LiveVideoStreamServerMediaSubsession: public OnDemandServerMediaSubsession { 30 | public: 31 | static LiveVideoStreamServerMediaSubsession* 32 | createNew(UsageEnvironment& env, LiveStreamInput& streamInput); 33 | 34 | // Used to implement "getAuxSDPLine()": 35 | void checkForAuxSDPLine1(); 36 | void afterPlayingDummy1(); 37 | 38 | protected: 39 | LiveStreamInput &fLiveStreamInput; 40 | LiveVideoStreamServerMediaSubsession(UsageEnvironment& env, LiveStreamInput& streamInput); 41 | // called only by createNew(); 42 | virtual ~LiveVideoStreamServerMediaSubsession(); 43 | 44 | void setDoneFlag() { fDoneFlag = ~0; } 45 | 46 | protected: // redefined virtual functions 47 | virtual char const* getAuxSDPLine(RTPSink* rtpSink, 48 | FramedSource* inputSource); 49 | 50 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 51 | unsigned& estBitrate); 52 | virtual void closeStreamSource(FramedSource *inputSource); 53 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 54 | unsigned char rtpPayloadTypeIfDynamic, 55 | FramedSource* inputSource); 56 | 57 | private: 58 | FramedFilter *fStreamSource; 59 | char* fAuxSDPLine; 60 | char fDoneFlag; // used when setting up "fAuxSDPLine" 61 | RTPSink* fDummyRTPSink; // ditto 62 | }; 63 | 64 | 65 | //////////////////////////////////////////////////////////////////////////////// 66 | // Audio 67 | //////////////////////////////////////////////////////////////////////////////// 68 | 69 | class LiveAudioStreamServerMediaSubsession: public OnDemandServerMediaSubsession { 70 | public: 71 | static LiveAudioStreamServerMediaSubsession* 72 | createNew(UsageEnvironment& env, LiveStreamInput& streamInput); 73 | 74 | protected: 75 | LiveAudioStreamServerMediaSubsession(UsageEnvironment& env, LiveStreamInput& streamInput); 76 | virtual ~LiveAudioStreamServerMediaSubsession(); 77 | 78 | protected: // redefined virtual functions 79 | virtual FramedSource* createNewStreamSource(unsigned clientSessionId, 80 | unsigned& estBitrate); 81 | virtual RTPSink* createNewRTPSink(Groupsock* rtpGroupsock, 82 | unsigned char rtpPayloadTypeIfDynamic, 83 | FramedSource* inputSource); 84 | 85 | private: 86 | LiveStreamInput &fLiveStreamInput; 87 | }; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /src/rtsp/live/LiveStreamSource.hh: -------------------------------------------------------------------------------- 1 | /********** 2 | This library is free software; you can redistribute it and/or modify it under 3 | the terms of the GNU Lesser General Public License as published by the 4 | Free Software Foundation; either version 2.1 of the License, or (at your 5 | option) any later version. (See .) 6 | 7 | This library is distributed in the hope that it will be useful, but WITHOUT 8 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for 10 | more details. 11 | 12 | You should have received a copy of the GNU Lesser General Public License 13 | along with this library; if not, write to the Free Software Foundation, Inc., 14 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 15 | **********/ 16 | // "liveMedia" 17 | // Copyright (c) 1996-2013 Live Networks, Inc. All rights reserved. 18 | // a MediaSource get h264 live stream from hardware 19 | // 20 | // NOTE: Sections of this code labeled "%%% TO BE WRITTEN %%%" are incomplete, and needto be written by the programmer 21 | // (depending on the features of the particulardevice). 22 | // C++ header 23 | 24 | #ifndef _LIVE_STREAME_SOURCE_HH 25 | #define _LIVE_STREAME_SOURCE_HH 26 | 27 | #include "stream_descriptor.h" 28 | 29 | #ifndef _FRAMED_SOURCE_HH 30 | #include 31 | #endif 32 | 33 | class LiveVideoStreamSource: public FramedSource 34 | { 35 | public: 36 | static LiveVideoStreamSource* createNew(UsageEnvironment& env, StreamChannel chn); 37 | 38 | int &referenceCount() { return fReferenceCount; } 39 | protected: 40 | LiveVideoStreamSource(UsageEnvironment& env, StreamChannel chn); 41 | // called only by createNew(), or by subclass constructors 42 | virtual ~LiveVideoStreamSource(); 43 | 44 | private: 45 | // redefined virtual functions: 46 | virtual void doGetNextFrame(); 47 | virtual void doStopGettingFrames(); 48 | static void deliverFrame0(void *clientData, int mask); 49 | void deliverFrame(); 50 | 51 | private: 52 | StreamChannel fChannelNo; 53 | int vencFd; 54 | int fReferenceCount; 55 | }; 56 | 57 | class LiveAudioStreamSource: public FramedSource 58 | { 59 | public: 60 | static LiveAudioStreamSource* createNew(UsageEnvironment& env, StreamChannel chn); 61 | 62 | protected: 63 | LiveAudioStreamSource(UsageEnvironment& env, StreamChannel chn); 64 | // called only by createNew(), or by subclass constructors 65 | virtual ~LiveAudioStreamSource(); 66 | 67 | private: 68 | // redefined virtual functions: 69 | virtual void doGetNextFrame(); 70 | //virtual void doStopGettingFrames(); // optional 71 | static void deliverFrame0(void* clientData, int mask); 72 | void deliverFrame(); 73 | 74 | private: 75 | StreamChannel fChannelNo; 76 | int aencFd; 77 | }; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /src/rtsp/rtsp.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "messages.h" 6 | #include "imedia.h" 7 | #include "live/LiveStreamInput.hh" 8 | #include "live/LiveStreamRTSPServer.hh" 9 | #include "rtsp.h" 10 | 11 | typedef struct _IpcamRtspPrivate 12 | { 13 | guint port; 14 | GThread *live555_thread; 15 | gchar watch_variable; 16 | StreamDescriptor *stream_desc[STREAM_CHN_LAST]; 17 | gpointer user_data; 18 | gboolean enable_auth; 19 | UserAuthenticationDatabase *auth_db; 20 | LiveStreamRTSPServer *rtsp_server; 21 | TaskScheduler* m_scheduler; 22 | UsageEnvironment* m_env; 23 | } IpcamRtspPrivate; 24 | 25 | G_DEFINE_TYPE_WITH_PRIVATE(IpcamRtsp, ipcam_rtsp, G_TYPE_OBJECT) 26 | 27 | static gpointer 28 | live555_thread_proc(gpointer data) 29 | { 30 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)data; 31 | UserAuthenticationDatabase *auth_db; 32 | 33 | OutPacketBuffer::increaseMaxSizeTo(2 * 1024 * 1024); 34 | 35 | auth_db = priv->enable_auth ? priv->auth_db : NULL; 36 | priv->rtsp_server = LiveStreamRTSPServer::createNew(*priv->m_env, priv->port, auth_db); 37 | if (priv->rtsp_server == NULL) { 38 | *priv->m_env << "Failed to create RTSP server: " 39 | << priv->m_env->getResultMsg() << "\n"; 40 | return NULL; 41 | } 42 | 43 | for (int i = 0; i < STREAM_CHN_LAST; i++) 44 | { 45 | LiveStreamInput *streamInput; 46 | 47 | streamInput = LiveStreamInput::createNew(*priv->m_env, (StreamChannel)i, priv->stream_desc[i]); 48 | 49 | priv->rtsp_server->addStreamInput(streamInput); 50 | } 51 | 52 | priv->m_env->taskScheduler().doEventLoop(&priv->watch_variable); // does not return 53 | 54 | RTSPServer::close(priv->rtsp_server); 55 | priv->rtsp_server = NULL; 56 | 57 | return NULL; 58 | } 59 | 60 | static void 61 | ipcam_rtsp_finalize(GObject *self) 62 | { 63 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(IPCAM_RTSP(self)); 64 | ipcam_rtsp_stop_server(IPCAM_RTSP(self)); 65 | 66 | delete priv->auth_db; 67 | 68 | if (priv->m_env) 69 | { 70 | priv->m_env->reclaim(); 71 | priv->m_env = NULL; 72 | } 73 | if (priv->m_scheduler) 74 | { 75 | delete priv->m_scheduler; 76 | priv->m_scheduler = NULL; 77 | } 78 | G_OBJECT_CLASS(ipcam_rtsp_parent_class)->finalize(self); 79 | } 80 | 81 | static void 82 | ipcam_rtsp_init(IpcamRtsp *self) 83 | { 84 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(self); 85 | 86 | priv->port = 554; 87 | priv->stream_desc[MASTER] = NULL; 88 | priv->stream_desc[SLAVE] = NULL; 89 | priv->user_data = NULL; 90 | 91 | priv->auth_db = new UserAuthenticationDatabase; 92 | 93 | priv->m_scheduler = BasicTaskScheduler::createNew(); 94 | priv->m_env = BasicUsageEnvironment::createNew(*priv->m_scheduler); 95 | } 96 | 97 | static void 98 | ipcam_rtsp_class_init(IpcamRtspClass *klass) 99 | { 100 | 101 | GObjectClass *object_class = G_OBJECT_CLASS(klass); 102 | object_class->finalize = &ipcam_rtsp_finalize; 103 | } 104 | 105 | void ipcam_rtsp_set_port(IpcamRtsp *rtsp, guint port) 106 | { 107 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 108 | priv->port = port; 109 | } 110 | 111 | void ipcam_rtsp_insert_user(IpcamRtsp *rtsp, const gchar *username, const gchar *password) 112 | { 113 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 114 | 115 | if (priv->auth_db->lookupPassword(username)) 116 | priv->auth_db->removeUserRecord(username); 117 | 118 | priv->auth_db->addUserRecord(username, password); 119 | } 120 | 121 | void ipcam_rtsp_delete_user(IpcamRtsp *rtsp, const gchar *username) 122 | { 123 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 124 | 125 | priv->auth_db->removeUserRecord(username); 126 | } 127 | 128 | void ipcam_rtsp_set_auth(IpcamRtsp *rtsp, gboolean auth) 129 | { 130 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 131 | priv->enable_auth = auth; 132 | 133 | if (priv->rtsp_server) { 134 | UserAuthenticationDatabase *auth_db; 135 | 136 | auth_db = priv->enable_auth ? priv->auth_db : NULL; 137 | 138 | priv->rtsp_server->setAuthenticationDatabase(auth_db); 139 | } 140 | } 141 | 142 | void ipcam_rtsp_set_stream_desc(IpcamRtsp *rtsp, StreamChannel chn, StreamDescriptor *desc) 143 | { 144 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 145 | priv->stream_desc[chn] = desc; 146 | } 147 | 148 | void ipcam_rtsp_set_user_data(IpcamRtsp *rtsp, gpointer user_data) 149 | { 150 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 151 | priv->user_data = user_data; 152 | } 153 | 154 | void ipcam_rtsp_start_server(IpcamRtsp *rtsp) 155 | { 156 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 157 | priv->watch_variable = 0; 158 | priv->live555_thread = g_thread_new("live555", live555_thread_proc, priv); 159 | } 160 | 161 | void ipcam_rtsp_stop_server(IpcamRtsp *rtsp) 162 | { 163 | IpcamRtspPrivate *priv = (IpcamRtspPrivate *)ipcam_rtsp_get_instance_private(rtsp); 164 | priv->watch_variable = 1; 165 | g_thread_join(priv->live555_thread); 166 | } 167 | -------------------------------------------------------------------------------- /src/rtsp/rtsp.h: -------------------------------------------------------------------------------- 1 | #ifndef __RTSP_H__ 2 | #define __RTSP_H__ 3 | 4 | #ifdef __cplusplus 5 | extern "C" 6 | { 7 | #endif 8 | 9 | #include 10 | #include "stream_descriptor.h" 11 | 12 | #define IPCAM_TYPE_RTSP (ipcam_rtsp_get_type()) 13 | #define IPCAM_RTSP(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_TYPE_RTSP, IpcamRtsp)) 14 | #define IPCAM_RTSP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_TYPE_RTSP, IpcamRtspClass)) 15 | #define IPCAM_IS_RTSP(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_TYPE_RTSP)) 16 | #define IPCAM_IS_RTSP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_TYPE_RTSP)) 17 | #define IPCAM_RTSP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_TYPE_RTSP, IpcamRtspClass)) 18 | 19 | typedef struct _IpcamRtsp IpcamRtsp; 20 | typedef struct _IpcamRtspClass IpcamRtspClass; 21 | 22 | struct _IpcamRtsp 23 | { 24 | GObject parent; 25 | }; 26 | 27 | struct _IpcamRtspClass 28 | { 29 | GObjectClass parent_class; 30 | }; 31 | 32 | GType ipcam_rtsp_get_type(void); 33 | void ipcam_rtsp_set_port(IpcamRtsp *rtsp, guint port); 34 | void ipcam_rtsp_insert_user(IpcamRtsp *rtsp, const gchar *username, const gchar *password); 35 | void ipcam_rtsp_delete_user(IpcamRtsp *rtsp, const gchar *username); 36 | void ipcam_rtsp_set_auth(IpcamRtsp *rtsp, gboolean auth); 37 | void ipcam_rtsp_set_stream_desc(IpcamRtsp *rtsp, StreamChannel chn, StreamDescriptor *desc); 38 | void ipcam_rtsp_set_user_data(IpcamRtsp *rtsp, gpointer user_data); 39 | void ipcam_rtsp_start_server(IpcamRtsp *rtsp); 40 | void ipcam_rtsp_stop_server(IpcamRtsp *rtsp); 41 | 42 | #ifdef __cplusplus 43 | } 44 | #endif 45 | 46 | #endif /* __RTSP_H__ */ 47 | -------------------------------------------------------------------------------- /src/stream_descriptor.h: -------------------------------------------------------------------------------- 1 | #ifndef __STREAM_DESCRIPTOR_H__ 2 | #define __STREAM_DESCRIPTOR_H__ 3 | 4 | #include 5 | #include 6 | 7 | #if defined(HI3516) 8 | #define IMAGE_MAX_WIDTH 1920 9 | #define IMAGE_MAX_HEIGHT 1200 10 | #elif defined(HI3518) 11 | #define IMAGE_MAX_WIDTH 1280 12 | #define IMAGE_MAX_HEIGHT 960 13 | #else 14 | #error "NO chip selected!" 15 | #endif 16 | 17 | #define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0])) 18 | 19 | typedef struct _IpcamMediaImageAttr 20 | { 21 | gint32 brightness; 22 | gint32 chrominance; 23 | gint32 contrast; 24 | gint32 saturation; 25 | gint32 b3ddnr; 26 | guint32 watermark; 27 | } IpcamMediaImageAttr; 28 | 29 | enum StreamChannel 30 | { 31 | MASTER_CHN = 0, 32 | SLAVE_CHN = 1, 33 | STREAM_CHN_LAST 34 | }; 35 | typedef enum StreamChannel StreamChannel; 36 | 37 | #define MASTER MASTER_CHN 38 | #define SLAVE SLAVE_CHN 39 | 40 | enum StreamType 41 | { 42 | AUDIO_STREAM = 0, 43 | VIDEO_STREAM = 1, 44 | INVALIDE_STREAM_TYPE, 45 | }; 46 | 47 | enum VideoFormat 48 | { 49 | VIDEO_FORMAT_MPEG4 = 0, 50 | VIDEO_FORMAT_H264 = 1, 51 | VIDEO_FORMAT_MJPEG = 2, 52 | VIDEO_FORMAT_LAST, 53 | }; 54 | 55 | enum H264Profile 56 | { 57 | BASELINE_PROFILE = 0, 58 | MAIN_PROFILE = 1, 59 | HIGH_PROFILE = 2, 60 | H264_PROFILE_LAST, 61 | }; 62 | 63 | enum BitRateType 64 | { 65 | CONSTANT_BIT_RATE = 0, 66 | VARIABLE_BIT_RATE = 1, 67 | BIT_RATE_TYPE_LAST, 68 | }; 69 | 70 | typedef struct _VideoStreamDescriptor 71 | { 72 | enum VideoFormat format; 73 | enum H264Profile profile; 74 | const gchar *resolution; 75 | guint image_width; 76 | guint image_height; 77 | guint frame_rate; 78 | guint iframe_ratio; 79 | enum BitRateType bit_rate_type; 80 | guint bit_rate; 81 | gboolean flip; 82 | gboolean mirror; 83 | IpcamMediaImageAttr img_attr; 84 | const gchar *path; 85 | } VideoStreamDescriptor; 86 | 87 | enum AudioFormat 88 | { 89 | AUDIO_FORMAT_G_711 = 0, 90 | AUDIO_FORMAT_G_726 = 1, 91 | AUDIO_FORMAT_LAST, 92 | }; 93 | 94 | typedef struct _AudioStreamDescriptor 95 | { 96 | enum AudioFormat format; 97 | } AudioStreamDescriptor; 98 | 99 | typedef struct _StreamDescriptor 100 | { 101 | enum StreamType type; 102 | union 103 | { 104 | VideoStreamDescriptor v_desc; 105 | AudioStreamDescriptor a_desc; 106 | }; 107 | } StreamDescriptor; 108 | 109 | #endif /* __STREAM_DESCRIPTOR_H__ */ 110 | -------------------------------------------------------------------------------- /src/video_param_change_handler.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include "imedia.h" 3 | #include "video_param_change_handler.h" 4 | #include "messages.h" 5 | 6 | 7 | G_DEFINE_TYPE(IpcamVideoParamChangeHandler, ipcam_video_param_change_handler, IPCAM_EVENT_HANDLER_TYPE); 8 | 9 | static void ipcam_video_param_change_handler_run_impl(IpcamEventHandler *event_handler, 10 | IpcamMessage *message); 11 | 12 | static void ipcam_video_param_change_handler_init(IpcamVideoParamChangeHandler *self) 13 | { 14 | } 15 | 16 | static void ipcam_video_param_change_handler_class_init(IpcamVideoParamChangeHandlerClass *klass) 17 | { 18 | IpcamEventHandlerClass *event_handler_class = IPCAM_EVENT_HANDLER_CLASS(klass); 19 | event_handler_class->run = &ipcam_video_param_change_handler_run_impl; 20 | } 21 | 22 | static void ipcam_video_param_change_handler_run_impl(IpcamEventHandler *event_handler, 23 | IpcamMessage *message) 24 | { 25 | IpcamVideoParamChangeHandler *video_param_change_handler = IPCAM_VIDEO_PARAM_CHANGE_HANDLER(event_handler); 26 | gpointer service; 27 | const char *event; 28 | JsonNode *body; 29 | 30 | g_object_get(G_OBJECT(video_param_change_handler), "service", &service, NULL); 31 | g_object_get(G_OBJECT(message), "event", &event, "body", &body, NULL); 32 | 33 | /* Debug */ 34 | #if 0 35 | { 36 | JsonGenerator *generator = json_generator_new(); 37 | json_generator_set_root(generator, body); 38 | json_generator_set_pretty (generator, TRUE); 39 | gchar *str = json_generator_to_data (generator, NULL); 40 | g_printf("receive notice, body=\n%s\n", str); 41 | g_free(str); 42 | g_object_unref(generator); 43 | } 44 | #endif 45 | 46 | g_print("%s: event=%s\n", __func__, event); 47 | 48 | if (g_str_equal (event, "set_base_info")) { 49 | ipcam_imedia_got_baseinfo_parameter(IPCAM_IMEDIA(service), body); 50 | } 51 | else if (g_str_equal (event, "set_misc")) { 52 | ipcam_imedia_got_misc_parameter(IPCAM_IMEDIA(service), body); 53 | } 54 | else if (g_str_equal (event, "add_users")) { 55 | ipcam_imedia_got_set_users_parameter(IPCAM_IMEDIA(service), body); 56 | } 57 | else if (g_str_equal (event, "set_users")) { 58 | ipcam_imedia_got_set_users_parameter(IPCAM_IMEDIA(service), body); 59 | } 60 | else if (g_str_equal (event, "del_users")) { 61 | ipcam_imedia_got_del_users_parameter(IPCAM_IMEDIA(service), body); 62 | } 63 | else if (g_str_equal (event, "set_event_cover")) { 64 | ipcam_imedia_got_od_param(IPCAM_IMEDIA(service), body, TRUE); 65 | } 66 | else if (g_str_equal (event, "set_video")) { 67 | ipcam_imedia_got_video_param(IPCAM_IMEDIA(service), body, TRUE); 68 | } 69 | else if (g_str_equal (event, "set_image")) { 70 | ipcam_imedia_got_image_parameter(IPCAM_IMEDIA(service), body); 71 | } 72 | else if (g_str_equal (event, "set_osd")) { 73 | ipcam_imedia_got_osd_parameter(IPCAM_IMEDIA(service), body); 74 | } 75 | else if (g_str_equal (event, "set_szyc")) { 76 | ipcam_imedia_got_szyc_parameter(IPCAM_IMEDIA(service), body); 77 | } 78 | else if (g_str_equal (event, "set_day_night_mode")) { 79 | ipcam_imedia_got_day_night_mode_parameter(IPCAM_IMEDIA(service), body); 80 | } 81 | else { 82 | g_warning ("unhandled event \"%s\"\n", event); 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /src/video_param_change_handler.h: -------------------------------------------------------------------------------- 1 | #ifndef __VIDEO_PARAM_CHANGE_HANDLER_H__ 2 | #define __VIDEO_PARAM_CHANGE_HANDLER_H__ 3 | 4 | #include "event_handler.h" 5 | 6 | #define IPCAM_VIDEO_PARAM_CHANGE_HANDLER_TYPE (ipcam_video_param_change_handler_get_type()) 7 | #define IPCAM_VIDEO_PARAM_CHANGE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), IPCAM_VIDEO_PARAM_CHANGE_HANDLER_TYPE, IpcamVideoParamChangeHandler)) 8 | #define IPCAM_VIDEO_PARAM_CHANGE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), IPCAM_VIDEO_PARAM_CHANGE_HANDLER_TYPE, IpcamVideoParamChangeHandlerClass)) 9 | #define IPCAM_IS_VIDEO_PARAM_CHANGE_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), IPCAM_VIDEO_PARAM_CHANGE_HANDLER_TYPE)) 10 | #define IPCAM_IS_VIDEO_PARAM_CHANGE_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), IPCAM_VIDEO_PARAM_CHANGE_HANDLER_TYPE)) 11 | #define IPCAM_VIDEO_PARAM_CHANGE_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), IPCAM_VIDEO_PARAM_CHANGE_HANDLER_TYPE, IpcamVideoParamChangeHandlerClass)) 12 | 13 | typedef struct _IpcamVideoParamChangeHandler IpcamVideoParamChangeHandler; 14 | typedef struct _IpcamVideoParamChangeHandlerClass IpcamVideoParamChangeHandlerClass; 15 | 16 | struct _IpcamVideoParamChangeHandler 17 | { 18 | IpcamEventHandler parent; 19 | }; 20 | 21 | struct _IpcamVideoParamChangeHandlerClass 22 | { 23 | IpcamEventHandlerClass parent_class; 24 | }; 25 | 26 | GType ipcam_video_param_change_handler_get_type(void); 27 | 28 | #endif /* __VIDEO_PARAM_CHANGE_HANDLER_H__ */ 29 | --------------------------------------------------------------------------------