├── AUTHORS
├── NEWS
├── README
├── ChangeLog
├── .gitignore
├── src
├── dbus
│ ├── audio-source-introspect.xml
│ ├── audio-encoder-introspect.xml
│ ├── live-streamer.conf
│ ├── video-osd-introspect.xml
│ ├── video-encoder-introspect.xml
│ ├── Makefile.am
│ ├── dbus-video-osd.h
│ ├── dbus-audio-source.h
│ ├── dbus-audio-encoder.h
│ ├── dbus-ipcam-base.h
│ ├── dbus-video-source.h
│ ├── dbus-video-encoder.h
│ ├── dbus-audio-source.cpp
│ ├── dbusxx-libev-integration.h
│ ├── dbus-audio-encoder.cpp
│ ├── video-source-introspect.xml
│ └── dbusxx-libev-integration.cpp
├── platform
│ ├── Makefile.am
│ ├── hi3516cv300
│ │ ├── Makefile.am
│ │ ├── himpp-base.cpp
│ │ ├── himpp-common.h
│ │ ├── himpp-base.h
│ │ ├── himpp-video-sensor.h
│ │ ├── himpp-sysctl.h
│ │ ├── himpp-media.h
│ │ ├── himpp-video-region.h
│ │ ├── himpp-sysctl.cpp
│ │ ├── himpp-ircut.h
│ │ ├── himpp-video-venc.h
│ │ ├── himpp-video-vpss.h
│ │ └── himpp-video-viu.h
│ ├── hi3516ev200
│ │ ├── Makefile.am
│ │ ├── himpp-common.h
│ │ ├── himpp-base.cpp
│ │ ├── himpp-base.h
│ │ ├── himpp-video-sensor.h
│ │ ├── himpp-sysctl.h
│ │ ├── himpp-media.h
│ │ ├── himpp-video-region.h
│ │ ├── himpp-sysctl.cpp
│ │ ├── himpp-ircut.h
│ │ ├── himpp-video-venc.h
│ │ ├── himpp-video-vpss.h
│ │ └── himpp-video-viu.h
│ └── hi3518v200
│ │ ├── Makefile.am
│ │ ├── himpp-base.cpp
│ │ ├── himpp-common.h
│ │ ├── himpp-base.h
│ │ ├── himpp-video-sensor.h
│ │ ├── himpp-media.h
│ │ ├── himpp-sysctl.h
│ │ ├── himpp-video-region.h
│ │ ├── himpp-sysctl.cpp
│ │ ├── himpp-ircut.h
│ │ ├── himpp-video-venc.h
│ │ ├── himpp-video-vpss.h
│ │ └── himpp-video-viu.h
├── common
│ ├── Makefile.am
│ ├── audio-source.cpp
│ ├── audio-source.h
│ ├── audio-encoder.h
│ ├── audio-encoder.cpp
│ ├── media-common.h
│ ├── media-element.h
│ ├── media-common.cpp
│ ├── media-stream.cpp
│ ├── media-element.cpp
│ ├── video-encoder.h
│ ├── video-osd.h
│ ├── media-stream.h
│ └── video-encoder.cpp
├── rtsp-server
│ ├── Makefile.am
│ ├── LiveStreamOutput.hh
│ ├── DynamicRTSPServer.cpp
│ ├── DynamicRTSPServer.hh
│ ├── AACAudioEncoder.hh
│ ├── EvUsageEnvironment.h
│ └── LiveStreamOutput.cpp
├── Makefile.am
└── ipcam-runtime.h
├── Makefile.am
├── m4
├── ltversion.m4
├── ltsugar.m4
└── lt~obsolete.m4
└── config.h.in
/AUTHORS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/NEWS:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ChangeLog:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *~
2 | *.swp
3 | *.bak
4 | *.anjuta
5 | .anjuta*
6 | autom4te.cache/*
7 |
--------------------------------------------------------------------------------
/src/dbus/audio-source-introspect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/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 |
--------------------------------------------------------------------------------
/src/dbus/audio-encoder-introspect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/platform/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 |
4 | SUBDIRS =
5 |
6 | if ENABLE_HI3518V100
7 | endif
8 |
9 | if ENABLE_HI3518V200
10 | SUBDIRS += hi3518v200
11 | endif
12 |
13 | if ENABLE_HI3516CV300
14 | SUBDIRS += hi3516cv300
15 | endif
16 |
17 | if ENABLE_HI3516EV200
18 | SUBDIRS += hi3516ev200
19 | endif
20 |
21 | if ENABLE_HI3520V100
22 | endif
23 |
24 | if ENABLE_HI3520DV200
25 | endif
26 |
--------------------------------------------------------------------------------
/src/dbus/live-streamer.conf:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/common/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 |
4 | AM_CPPFLAGS = \
5 | -I$(top_srcdir)/src -I$(srcdir) -I$(builddir) \
6 | $(DBUSXX_CFLAGS) \
7 | $(FREETYPE_CFLAGS) \
8 | $(FONTCONFIG_CFLAGS) \
9 | $(SDL_CFLAGS)
10 |
11 | AM_CFLAGS = -Wall
12 | AM_CXXFLAGS = -Wall
13 |
14 |
15 | noinst_LTLIBRARIES = \
16 | libcommon.la
17 |
18 | libcommon_la_SOURCES = \
19 | media-common.cpp \
20 | media-common.h \
21 | media-element.cpp \
22 | media-element.h \
23 | media-stream.cpp \
24 | media-stream.h \
25 | video-source.cpp \
26 | video-source.h \
27 | video-encoder.cpp \
28 | video-encoder.h \
29 | audio-source.cpp \
30 | audio-source.h \
31 | audio-encoder.cpp \
32 | audio-encoder.h \
33 | video-osd.cpp \
34 | video-osd.h
35 |
--------------------------------------------------------------------------------
/m4/ltversion.m4:
--------------------------------------------------------------------------------
1 | # ltversion.m4 -- version numbers -*- Autoconf -*-
2 | #
3 | # Copyright (C) 2004 Free Software Foundation, Inc.
4 | # Written by Scott James Remnant, 2004
5 | #
6 | # This file is free software; the Free Software Foundation gives
7 | # unlimited permission to copy and/or distribute it, with or without
8 | # modifications, as long as this notice is preserved.
9 |
10 | # @configure_input@
11 |
12 | # serial 3337 ltversion.m4
13 | # This file is part of GNU Libtool
14 |
15 | m4_define([LT_PACKAGE_VERSION], [2.4.2])
16 | m4_define([LT_PACKAGE_REVISION], [1.3337])
17 |
18 | AC_DEFUN([LTVERSION_VERSION],
19 | [macro_version='2.4.2'
20 | macro_revision='1.3337'
21 | _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
22 | _LT_DECL(, macro_revision, 0)
23 | ])
24 |
--------------------------------------------------------------------------------
/src/rtsp-server/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 | AM_CPPFLAGS = \
4 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
5 | -DPACKAGE_SRC_DIR=\""$(srcdir)"\" \
6 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
7 | -I$(top_srcdir)/src -I$(top_srcdir)/src/common -I$(srcdir) \
8 | $(LIVE555_CPPFLAGS) \
9 | $(DBUSXX_CFLAGS)
10 |
11 | AM_CFLAGS = -Wall
12 | AM_CXXFLAGS = -Wall
13 |
14 | noinst_LTLIBRARIES = \
15 | librtsp-server.la
16 |
17 | librtsp_server_la_SOURCES = \
18 | EvUsageEnvironment.cpp \
19 | EvUsageEnvironment.h \
20 | DynamicRTSPServer.cpp \
21 | DynamicRTSPServer.hh \
22 | LiveStreamInput.cpp \
23 | LiveStreamInput.hh \
24 | LiveStreamOutput.cpp \
25 | LiveStreamOutput.hh
26 |
27 | if ENABLE_VO_AACENC
28 | librtsp_server_la_SOURCES += \
29 | AACAudioEncoder.cpp \
30 | AACAudioEncoder.hh
31 | endif
32 |
--------------------------------------------------------------------------------
/src/dbus/video-osd-introspect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/src/common/audio-source.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * audio-source.cpp
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include "audio-source.h"
21 |
22 |
23 | namespace Ipcam {
24 | namespace Media {
25 |
26 | AudioSource::AudioSource()
27 | {
28 | }
29 |
30 | AudioSource::~AudioSource()
31 | {
32 | }
33 |
34 | uint32_t AudioSource::getChannels()
35 | {
36 | throw IpcamError(property_not_implemented);
37 | }
38 |
39 | } //namespace Media
40 | } //namespace Ipcam
41 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 |
4 | AM_CPPFLAGS = \
5 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
6 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
7 | -I. -I$(top_srcdir)/src -I$(top_srcdir)/src/common \
8 | -I$(top_srcdir)/src/rtsp-server -I$(top_srcdir)/src/dbus \
9 | -I$(top_builddir)/src/dbus \
10 | $(LIVE555_CPPFLAGS) \
11 | $(DBUSXX_CFLAGS) \
12 | $(SDL_CFLAGS) \
13 | $(HI3516CV300_CPPFLAGS)
14 |
15 | AM_CFLAGS = -Wall
16 | AM_CXXFLAGS = -Wall
17 |
18 | noinst_LTLIBRARIES = \
19 | libhi3516cv300.la
20 |
21 | libhi3516cv300_la_SOURCES = \
22 | himpp-common.h \
23 | himpp-base.cpp \
24 | himpp-base.h \
25 | himpp-sysctl.cpp \
26 | himpp-sysctl.h \
27 | himpp-audio.cpp \
28 | himpp-audio.h \
29 | himpp-video-sensor.cpp \
30 | himpp-video-sensor.h \
31 | himpp-video-isp.cpp \
32 | himpp-video-isp.h \
33 | himpp-video-viu.cpp \
34 | himpp-video-viu.h \
35 | himpp-video-vpss.cpp \
36 | himpp-video-vpss.h \
37 | himpp-video-venc.cpp \
38 | himpp-video-venc.h \
39 | himpp-video-region.cpp \
40 | himpp-video-region.h \
41 | himpp-media.cpp \
42 | himpp-media.h \
43 | himpp-ircut.cpp \
44 | himpp-ircut.h
45 |
46 | libhi3516cv300_la_LIBADD = \
47 | $(top_builddir)/src/common/libcommon.la
48 |
49 | EXTRA_DIST =
50 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 |
4 | AM_CPPFLAGS = \
5 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
6 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
7 | -I. -I$(top_srcdir)/src -I$(top_srcdir)/src/common \
8 | -I$(top_srcdir)/src/rtsp-server -I$(top_srcdir)/src/dbus \
9 | -I$(top_builddir)/src/dbus \
10 | $(LIVE555_CPPFLAGS) \
11 | $(DBUSXX_CFLAGS) \
12 | $(SDL_CFLAGS) \
13 | $(HI3516EV200_CPPFLAGS)
14 |
15 | AM_CFLAGS = -Wall
16 | AM_CXXFLAGS = -Wall
17 |
18 | noinst_LTLIBRARIES = \
19 | libhi3516ev200.la
20 |
21 | libhi3516ev200_la_SOURCES = \
22 | himpp-common.h \
23 | himpp-base.cpp \
24 | himpp-base.h \
25 | himpp-sysctl.cpp \
26 | himpp-sysctl.h \
27 | himpp-audio.cpp \
28 | himpp-audio.h \
29 | himpp-video-sensor.cpp \
30 | himpp-video-sensor.h \
31 | himpp-video-isp.cpp \
32 | himpp-video-isp.h \
33 | himpp-video-viu.cpp \
34 | himpp-video-viu.h \
35 | himpp-video-vpss.cpp \
36 | himpp-video-vpss.h \
37 | himpp-video-venc.cpp \
38 | himpp-video-venc.h \
39 | himpp-video-region.cpp \
40 | himpp-video-region.h \
41 | himpp-media.cpp \
42 | himpp-media.h \
43 | himpp-ircut.cpp \
44 | himpp-ircut.h
45 |
46 | libhi3516ev200_la_LIBADD = \
47 | $(top_builddir)/src/common/libcommon.la
48 |
49 | EXTRA_DIST =
50 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 |
4 | AM_CPPFLAGS = \
5 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
6 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
7 | -I. -I$(top_srcdir)/src -I$(top_srcdir)/src/common \
8 | -I$(top_srcdir)/src/rtsp-server -I$(top_srcdir)/src/dbus \
9 | -I$(top_builddir)/src/dbus \
10 | $(LIVE555_CPPFLAGS) \
11 | $(DBUSXX_CFLAGS) \
12 | $(SDL_CFLAGS) \
13 | $(HI3518V200_CPPFLAGS)
14 |
15 | AM_CFLAGS = -Wall
16 | AM_CXXFLAGS = -Wall
17 |
18 | noinst_LTLIBRARIES = \
19 | libhi3518v200.la
20 |
21 | libhi3518v200_la_SOURCES = \
22 | himpp-common.h \
23 | himpp-base.cpp \
24 | himpp-base.h \
25 | himpp-sysctl.cpp \
26 | himpp-sysctl.h \
27 | himpp-audio.cpp \
28 | himpp-audio.h \
29 | himpp-video-sensor.cpp \
30 | himpp-video-sensor.h \
31 | himpp-video-isp.cpp \
32 | himpp-video-isp.h \
33 | himpp-video-viu.cpp \
34 | himpp-video-viu.h \
35 | himpp-video-vpss.cpp \
36 | himpp-video-vpss.h \
37 | himpp-video-venc.cpp \
38 | himpp-video-venc.h \
39 | himpp-video-region.cpp \
40 | himpp-video-region.h \
41 | himpp-media.cpp \
42 | himpp-media.h \
43 | himpp-ircut.cpp \
44 | himpp-ircut.h
45 |
46 | libhi3518v200_la_LIBADD = \
47 | $(top_builddir)/src/common/libcommon.la
48 |
49 | EXTRA_DIST =
50 |
51 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-base.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-element.cc
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "himpp-base.h"
23 |
24 | HimppVideoElement::HimppVideoElement(HimppVideoElement* source)
25 | : VideoElement(VIDEO_ELEMENT(source))
26 | {
27 | }
28 |
29 | MPP_CHN_S* HimppVideoElement::bindSource()
30 | {
31 | return NULL;
32 | }
33 |
34 | HimppAudioElement::HimppAudioElement(HimppAudioElement* source)
35 | : AudioElement(AUDIO_ELEMENT(source))
36 | {
37 | }
38 |
39 | MPP_CHN_S* HimppAudioElement::bindSource()
40 | {
41 | return NULL;
42 | }
43 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-base.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-element.cc
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "himpp-base.h"
23 |
24 | HimppVideoElement::HimppVideoElement(HimppVideoElement* source)
25 | : VideoElement(VIDEO_ELEMENT(source))
26 | {
27 | }
28 |
29 | MPP_CHN_S* HimppVideoElement::bindSource()
30 | {
31 | return NULL;
32 | }
33 |
34 | HimppAudioElement::HimppAudioElement(HimppAudioElement* source)
35 | : AudioElement(AUDIO_ELEMENT(source))
36 | {
37 | }
38 |
39 | MPP_CHN_S* HimppAudioElement::bindSource()
40 | {
41 | return NULL;
42 | }
43 |
--------------------------------------------------------------------------------
/src/common/audio-source.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * audio-source.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _AUDIO_SOURCE_H_
21 | #define _AUDIO_SOURCE_H_
22 |
23 | #include
24 |
25 | namespace Ipcam {
26 | namespace Media {
27 |
28 | class AudioSource;
29 |
30 | #define AUDIO_SOURCE(o) dynamic_cast(o)
31 |
32 | class AudioSource
33 | {
34 | public:
35 | virtual ~AudioSource();
36 |
37 | virtual uint32_t getChannels() = 0;
38 |
39 | protected:
40 | AudioSource();
41 | };
42 |
43 | } //namespace Media
44 | } //namespace Ipcam
45 |
46 | #endif // _AUDIO_SOURCE_H_
47 |
48 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-common.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-common.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_COMMON_H_
21 | #define _HIMPP_COMMON_H_
22 |
23 | #define HIMPP_SYS_ALIGN_WIDTH 16
24 | #define HIMPP_PIXEL_FORMAT PIXEL_FORMAT_YUV_SEMIPLANAR_420
25 |
26 | #define ROUNDUP(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
27 | #define ROUNDUP16(x) ROUNDUP(x, 16)
28 | #define ROUNDUP64(x) ROUNDUP(x, 64)
29 |
30 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
31 |
32 | #define HIMPP_PRINT(fmt, ...) \
33 | printf("[%s:%d]:" fmt, __FILE__, __LINE__, ##__VA_ARGS__)
34 |
35 | #endif // _HIMPP_COMMON_H_
36 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-common.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-common.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_COMMON_H_
21 | #define _HIMPP_COMMON_H_
22 |
23 | #define HIMPP_SYS_ALIGN_WIDTH 16
24 | #define HIMPP_PIXEL_FORMAT PIXEL_FORMAT_YUV_SEMIPLANAR_420
25 |
26 | #define ROUNDUP(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
27 | #define ROUNDUP16(x) ROUNDUP(x, 16)
28 | #define ROUNDUP64(x) ROUNDUP(x, 64)
29 |
30 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
31 |
32 | #define HIMPP_PRINT(fmt, ...) \
33 | printf("[%s:%d]:" fmt, __FILE__, __LINE__, ##__VA_ARGS__)
34 |
35 | #endif // _HIMPP_COMMON_H_
36 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-common.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-common.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_COMMON_H_
21 | #define _HIMPP_COMMON_H_
22 |
23 | #define HIMPP_SYS_ALIGN_WIDTH 16
24 | #define HIMPP_PIXEL_FORMAT PIXEL_FORMAT_YVU_SEMIPLANAR_420
25 |
26 | #define ROUNDUP(x, a) (((x) + ((a) - 1)) & ~((a) - 1))
27 | #define ROUNDUP16(x) ROUNDUP(x, 16)
28 | #define ROUNDUP64(x) ROUNDUP(x, 64)
29 |
30 | #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]))
31 |
32 | #define HIMPP_PRINT(fmt, ...) \
33 | printf("[%s:%d]:" fmt, __FILE__, __LINE__, ##__VA_ARGS__)
34 |
35 | #endif // _HIMPP_COMMON_H_
36 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-base.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-element.cc
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "himpp-base.h"
23 |
24 | HimppVideoElement::HimppVideoElement(HimppVideoElement* source)
25 | : VideoElement(VIDEO_ELEMENT(source))
26 | {
27 | }
28 |
29 | MPP_CHN_S* HimppVideoElement::bindSource()
30 | {
31 | HimppVideoElement *el = dynamic_cast(source());
32 | return el ? el->bindSource() : NULL;
33 | }
34 |
35 | HimppAudioElement::HimppAudioElement(HimppAudioElement* source)
36 | : AudioElement(AUDIO_ELEMENT(source))
37 | {
38 | }
39 |
40 | MPP_CHN_S* HimppAudioElement::bindSource()
41 | {
42 | return NULL;
43 | }
44 |
--------------------------------------------------------------------------------
/src/dbus/video-encoder-introspect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
--------------------------------------------------------------------------------
/src/common/audio-encoder.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * audio-encoder.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _AUDIO_ENCODER_H_
21 | #define _AUDIO_ENCODER_H_
22 |
23 | #include
24 |
25 | namespace Ipcam {
26 | namespace Media {
27 |
28 | class AudioEncoder;
29 |
30 | #define AUDIO_ENCODER(o) dynamic_cast(o)
31 |
32 | class AudioEncoder
33 | {
34 | public:
35 | virtual ~AudioEncoder();
36 |
37 | virtual AudioEncodingType getEncoding();
38 | virtual uint32_t getBitrate();
39 | virtual void setBitrate(uint32_t value);
40 | virtual uint32_t getSampleRate();
41 | virtual void setSampleRate(uint32_t value);
42 | };
43 |
44 | } //namespace Media
45 | } //namespace Ipcam
46 |
47 | #endif // _AUDIO_ENCODER_H_
48 |
49 |
--------------------------------------------------------------------------------
/src/dbus/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 | AM_CPPFLAGS = \
4 | -I$(top_srcdir)/src -I$(top_srcdir)/src/common \
5 | -I$(srcdir) -I$(builddir) \
6 | $(DBUSXX_CFLAGS)
7 |
8 | AM_CFLAGS = -Wall
9 | AM_CXXFLAGS = -Wall
10 |
11 | noinst_LTLIBRARIES = \
12 | libdbus-iface.la
13 |
14 | BUILT_SOURCES = \
15 | audio-source-server-glue.h \
16 | audio-encoder-server-glue.h \
17 | video-source-server-glue.h \
18 | video-encoder-server-glue.h \
19 | video-osd-server-glue.h
20 |
21 | libdbus_iface_la_SOURCES = \
22 | dbusxx-libev-integration.cpp \
23 | dbusxx-libev-integration.h \
24 | $(BUILT_SOURCES) \
25 | dbus-ipcam-base.cpp \
26 | dbus-ipcam-base.h \
27 | dbus-audio-source.cpp \
28 | dbus-audio-source.h \
29 | dbus-audio-encoder.cpp \
30 | dbus-audio-encoder.h \
31 | dbus-video-osd.cpp \
32 | dbus-video-osd.h \
33 | dbus-video-source.cpp \
34 | dbus-video-source.h \
35 | dbus-video-encoder.cpp \
36 | dbus-video-encoder.h
37 |
38 | libdbus_iface_la_LIBADD = \
39 | $(top_builddir)/src/common/libcommon.la
40 |
41 | %-server-glue.h: %-introspect.xml
42 | dbusxx-xml2cpp $^ --adaptor=$@
43 |
44 | CLEANFILES = $(BUILT_SOURCES)
45 |
46 | dist-hook:
47 | cd $(distdir); rm -f $(BUILT_SOURCES)
48 |
49 | dbuspolicydir=$(sysconfdir)/dbus-1/system.d
50 | dbuspolicy_DATA = \
51 | live-streamer.conf
52 |
53 | EXTRA_DIST = \
54 | video-source-introspect.xml \
55 | video-encoder-introspect.xml \
56 | video-osd-introspect.xml \
57 | audio-source-introspect.xml \
58 | audio-encoder-introspect.xml \
59 | live-streamer.conf
60 |
--------------------------------------------------------------------------------
/src/rtsp-server/LiveStreamOutput.hh:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * LiveStreamOutput.h
4 | * Copyright (C) 2019 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _LIVESTREAMOUTPUT_H_
21 | #define _LIVESTREAMOUTPUT_H_
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | using namespace Ipcam::Media;
28 |
29 | class LiveAudioSink;
30 |
31 | class AudioOutputStream
32 | {
33 | public:
34 | AudioOutputStream(UsageEnvironment& env, AudioStreamSink& sink,
35 | struct in_addr &addr, portNumBits num);
36 | ~AudioOutputStream();
37 |
38 | void play();
39 | void stop();
40 |
41 | private:
42 | AudioStreamSink& streamSink;
43 | bool streamStarted;
44 | Groupsock rtpGroupsock;
45 | RTPSource* rtpSource;
46 | LiveAudioSink* rtpSink;
47 | };
48 |
49 | #endif // _LIVESTREAMOUTPUT_H_
50 |
51 |
--------------------------------------------------------------------------------
/src/common/audio-encoder.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * audio-encoder.cpp
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include "audio-encoder.h"
21 |
22 |
23 | namespace Ipcam {
24 | namespace Media {
25 |
26 | AudioEncoder::~AudioEncoder()
27 | {
28 | }
29 |
30 | AudioEncodingType AudioEncoder::getEncoding()
31 | {
32 | throw IpcamError(property_not_implemented);
33 | }
34 |
35 | uint32_t AudioEncoder::getBitrate()
36 | {
37 | throw IpcamError(property_not_implemented);
38 | }
39 |
40 | void AudioEncoder::setBitrate(uint32_t value)
41 | {
42 | throw IpcamError(property_not_implemented);
43 | }
44 |
45 | uint32_t AudioEncoder::getSampleRate()
46 | {
47 | throw IpcamError(property_not_implemented);
48 | }
49 |
50 | void AudioEncoder::setSampleRate(uint32_t value)
51 | {
52 | throw IpcamError(property_not_implemented);
53 | }
54 |
55 | } //namespace Media
56 | } //namespace Ipcam
57 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-base.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-base.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_ELEMENT_H_
21 | #define _HIMPP_ELEMENT_H_
22 |
23 | #include
24 | #include
25 |
26 | using namespace Ipcam::Media;
27 |
28 | class HimppVideoElement;
29 | class HimppAudioElement;
30 |
31 | #define HIMPP_VIDEO_ELEMENT(e) dynamic_cast(e)
32 | #define HIMPP_AUDIO_ELEMENT(e) dynamic_cast(e)
33 |
34 | class HimppVideoElement : virtual public VideoElement
35 | {
36 | public:
37 | HimppVideoElement(HimppVideoElement* source);
38 | virtual MPP_CHN_S* bindSource();
39 | };
40 |
41 | class HimppAudioElement : virtual public AudioElement
42 | {
43 | public:
44 | HimppAudioElement(HimppAudioElement* source);
45 | virtual MPP_CHN_S* bindSource();
46 | };
47 |
48 | #endif // _HIMPP_ELEMENT_H_
49 |
50 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-base.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-base.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_ELEMENT_H_
21 | #define _HIMPP_ELEMENT_H_
22 |
23 | #include
24 | #include
25 |
26 | using namespace Ipcam::Media;
27 |
28 | class HimppVideoElement;
29 | class HimppAudioElement;
30 |
31 | #define HIMPP_VIDEO_ELEMENT(e) dynamic_cast(e)
32 | #define HIMPP_AUDIO_ELEMENT(e) dynamic_cast(e)
33 |
34 | class HimppVideoElement : virtual public VideoElement
35 | {
36 | public:
37 | HimppVideoElement(HimppVideoElement* source);
38 | virtual MPP_CHN_S* bindSource();
39 | };
40 |
41 | class HimppAudioElement : virtual public AudioElement
42 | {
43 | public:
44 | HimppAudioElement(HimppAudioElement* source);
45 | virtual MPP_CHN_S* bindSource();
46 | };
47 |
48 | #endif // _HIMPP_ELEMENT_H_
49 |
50 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-base.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-base.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_ELEMENT_H_
21 | #define _HIMPP_ELEMENT_H_
22 |
23 | #include
24 | #include
25 |
26 | using namespace Ipcam::Media;
27 |
28 | class HimppVideoElement;
29 | class HimppAudioElement;
30 |
31 | #define HIMPP_VIDEO_ELEMENT(e) dynamic_cast(e)
32 | #define HIMPP_AUDIO_ELEMENT(e) dynamic_cast(e)
33 |
34 | class HimppVideoElement : virtual public VideoElement
35 | {
36 | public:
37 | HimppVideoElement(HimppVideoElement* source);
38 | virtual MPP_CHN_S* bindSource();
39 | };
40 |
41 | class HimppAudioElement : virtual public AudioElement
42 | {
43 | public:
44 | HimppAudioElement(HimppAudioElement* source);
45 | virtual MPP_CHN_S* bindSource();
46 | };
47 |
48 | #endif // _HIMPP_ELEMENT_H_
49 |
50 |
--------------------------------------------------------------------------------
/src/dbus/dbus-video-osd.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-video-osd.h
4 | * Copyright (C) 2016 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _DBUS_VIDEO_OSD_H_
21 | #define _DBUS_VIDEO_OSD_H_
22 |
23 | #include "video-osd.h"
24 | #include "dbus-ipcam-base.h"
25 | #include "video-osd-server-glue.h"
26 |
27 | using namespace Ipcam::Media;
28 |
29 | namespace DBus {
30 |
31 | class VideoOSD:
32 | public ipcam::Media::OSD_adaptor,
33 | public IpcamBase
34 | {
35 | public:
36 | VideoOSD(IpcamRuntime& runtime, std::string obj_path, Ipcam::Media::VideoOSD* video_osd);
37 | void do_property_get
38 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value);
39 | void do_property_set
40 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
41 | protected:
42 | Ipcam::Media::VideoOSD* _video_osd;
43 | };
44 |
45 | } // namespace DBus
46 |
47 | #endif // _DBUS_VIDEO_OSD_H_
48 |
49 |
--------------------------------------------------------------------------------
/src/dbus/dbus-audio-source.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-audio-source.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _DBUS_AUDIO_SOURCE_H_
21 | #define _DBUS_AUDIO_SOURCE_H_
22 |
23 | #include "dbus-ipcam-base.h"
24 | #include "audio-source-server-glue.h"
25 |
26 | using namespace Ipcam::Media;
27 |
28 | namespace DBus {
29 |
30 | class AudioSource :
31 | public ipcam::Media::AudioSource_adaptor,
32 | public IpcamBase
33 | {
34 | public:
35 | AudioSource(IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::AudioSource* source);
36 | void do_property_get
37 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value);
38 | void do_property_set
39 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
40 | protected:
41 | Ipcam::Media::AudioSource* _audio_source;
42 | };
43 |
44 | } // namespace DBus
45 |
46 | #endif // _DBUS_AUDIO_SOURCE_H_
47 |
48 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-video-sensor.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-sensor.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_VIDEO_SENSOR_H_
21 | #define _HIMPP_VIDEO_SENSOR_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | struct HIMPP_SENSOR_CONFIG;
30 |
31 | class HimppVideoSensor
32 | {
33 | public:
34 | HimppVideoSensor(HIMPP_SENSOR_CONFIG *config);
35 | ~HimppVideoSensor();
36 |
37 | std::string getSensorName();
38 | std::string getModulePath();
39 |
40 | operator combo_dev_attr_t* ();
41 | operator ISP_PUB_ATTR_S* ();
42 | operator VI_DEV_ATTR_S* ();
43 | private:
44 | HIMPP_SENSOR_CONFIG *sensor_config;
45 | };
46 |
47 | typedef std::unordered_map HimppVideoSensorMap;
48 |
49 | extern HimppVideoSensorMap himpp_video_sensor_map;
50 |
51 | #endif // _HIMPP_VIDEO_SENSOR_H_
52 |
53 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-video-sensor.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-sensor.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_VIDEO_SENSOR_H_
21 | #define _HIMPP_VIDEO_SENSOR_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | struct HIMPP_SENSOR_CONFIG;
30 |
31 | class HimppVideoSensor
32 | {
33 | public:
34 | HimppVideoSensor(HIMPP_SENSOR_CONFIG *config);
35 | ~HimppVideoSensor();
36 |
37 | std::string getSensorName();
38 | std::string getModulePath();
39 |
40 | operator combo_dev_attr_t* ();
41 | operator ISP_PUB_ATTR_S* ();
42 | operator VI_DEV_ATTR_S* ();
43 | private:
44 | HIMPP_SENSOR_CONFIG *sensor_config;
45 | };
46 |
47 | typedef std::unordered_map HimppVideoSensorMap;
48 |
49 | extern HimppVideoSensorMap himpp_video_sensor_map;
50 |
51 | #endif // _HIMPP_VIDEO_SENSOR_H_
52 |
53 |
--------------------------------------------------------------------------------
/src/dbus/dbus-audio-encoder.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-audio-encoder.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _DBUS_AUDIO_ENCODER_H_
21 | #define _DBUS_AUDIO_ENCODER_H_
22 |
23 | #include "dbus-ipcam-base.h"
24 | #include "audio-encoder-server-glue.h"
25 |
26 | using namespace Ipcam::Media;
27 |
28 | namespace DBus {
29 |
30 | class AudioEncoder :
31 | public ipcam::Media::AudioEncoder_adaptor,
32 | public IpcamBase
33 | {
34 | public:
35 | AudioEncoder(IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::AudioEncoder* encoder);
36 | void do_property_get
37 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value);
38 | void do_property_set
39 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
40 | protected:
41 | Ipcam::Media::AudioEncoder* _audio_encoder;
42 | };
43 |
44 | } // namespace DBus
45 |
46 | #endif // _DBUS_AUDIO_ENCODER_H_
47 |
48 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-video-sensor.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-sensor.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_VIDEO_SENSOR_H_
21 | #define _HIMPP_VIDEO_SENSOR_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | struct HIMPP_SENSOR_CONFIG;
30 |
31 | class HimppVideoSensor
32 | {
33 | public:
34 | HimppVideoSensor(HIMPP_SENSOR_CONFIG *config);
35 | ~HimppVideoSensor();
36 |
37 | const char* getSensorName();
38 | const char* getModulePath();
39 | const char* getObjectName();
40 |
41 | operator combo_dev_attr_t* ();
42 | operator ISP_PUB_ATTR_S* ();
43 | operator VI_DEV_ATTR_S* ();
44 | operator VI_PIPE_ATTR_S* ();
45 | private:
46 | HIMPP_SENSOR_CONFIG *sensor_config;
47 | };
48 |
49 | typedef std::unordered_map HimppVideoSensorMap;
50 |
51 | extern HimppVideoSensorMap himpp_video_sensor_map;
52 |
53 | #endif // _HIMPP_VIDEO_SENSOR_H_
54 |
55 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-sysctl.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-sysctl.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_SYSCTL_H_
21 | #define _HIMPP_SYSCTL_H_
22 |
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 |
30 | class HimppSysctl: public MediaElement
31 | {
32 | public:
33 | HimppSysctl(HI_U32 align_width = HIMPP_SYS_ALIGN_WIDTH, HI_U32 max_pool_cnt = VB_MAX_COMM_POOLS);
34 | ~HimppSysctl();
35 |
36 | void addVideoBuffer(HI_U32 blksiz, HI_U32 blkcnt);
37 | void setAlignWidth(HI_U32 value);
38 | void setMaxPoolCount(HI_U32 value);
39 |
40 | protected:
41 | void doEnableElement();
42 | void doDisableElement();
43 |
44 | private:
45 | struct VideoBuffer
46 | {
47 | VideoBuffer(HI_U32 blksiz, HI_U32 blkcnt)
48 | : blksiz(blksiz), blkcnt(blkcnt) {}
49 | HI_U32 blksiz;
50 | HI_U32 blkcnt;
51 | };
52 | HI_U32 alignWidth;
53 | HI_U32 maxPoolCount;
54 | std::list buffers;
55 | };
56 |
57 | #endif // _HIMPP_SYSCTL_H_
58 |
59 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-sysctl.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-sysctl.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_SYSCTL_H_
21 | #define _HIMPP_SYSCTL_H_
22 |
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 |
30 | class HimppSysctl: public MediaElement
31 | {
32 | public:
33 | HimppSysctl(HI_U32 align_width = HIMPP_SYS_ALIGN_WIDTH, HI_U32 max_pool_cnt = VB_MAX_COMM_POOLS);
34 | ~HimppSysctl();
35 |
36 | void addVideoBuffer(HI_U32 blksiz, HI_U32 blkcnt);
37 | void setAlignWidth(HI_U32 value);
38 | void setMaxPoolCount(HI_U32 value);
39 |
40 | protected:
41 | void doEnableElement();
42 | void doDisableElement();
43 |
44 | private:
45 | struct VideoBuffer
46 | {
47 | VideoBuffer(HI_U32 blksiz, HI_U32 blkcnt)
48 | : blksiz(blksiz), blkcnt(blkcnt) {}
49 | HI_U32 blksiz;
50 | HI_U32 blkcnt;
51 | };
52 | HI_U32 alignWidth;
53 | HI_U32 maxPoolCount;
54 | std::list buffers;
55 | };
56 |
57 | #endif // _HIMPP_SYSCTL_H_
58 |
59 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-media.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-media.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_MEDIA_H_
21 | #define _HIMPP_MEDIA_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | using namespace Ipcam::Media;
30 |
31 | class HimppMedia;
32 |
33 | typedef std::vector> PlatformArguments;
34 |
35 | class HimppMedia
36 | {
37 | public:
38 | HimppMedia(IpcamRuntime* runtime, PlatformArguments& args);
39 | ~HimppMedia();
40 |
41 | private:
42 | typedef std::unique_ptr MediaElementUPtr;
43 | typedef std::unordered_map MediaElementMap;
44 | typedef std::list AudioStreamSinkList;
45 | MediaElementMap _elements;
46 | AudioStreamSinkList _audiosinks;
47 | IpcamRuntime* _runtime;
48 | HimppSysctl _sysctl;
49 |
50 | MediaElement* buildElementPipe(const std::string& description);
51 | };
52 |
53 | #endif // _HIMPP_MEDIA_H_
54 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-sysctl.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-sysctl.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_SYSCTL_H_
21 | #define _HIMPP_SYSCTL_H_
22 |
23 | #include
24 | #include
25 |
26 | #include
27 | #include
28 | #include
29 |
30 | class HimppSysctl: public MediaElement
31 | {
32 | public:
33 | HimppSysctl(HI_U32 align_width = HIMPP_SYS_ALIGN_WIDTH, HI_U32 max_pool_cnt = VB_MAX_COMM_POOLS);
34 | ~HimppSysctl();
35 |
36 | void addVideoBuffer(HI_U32 blksiz, HI_U32 blkcnt);
37 | void setAlignWidth(HI_U32 value);
38 | void setMaxPoolCount(HI_U32 value);
39 |
40 | protected:
41 | void doEnableElement();
42 | void doDisableElement();
43 |
44 | private:
45 | struct VideoBuffer
46 | {
47 | VideoBuffer(HI_U32 blksiz, HI_U32 blkcnt)
48 | : blksiz(blksiz), blkcnt(blkcnt) {}
49 | HI_U32 blksiz;
50 | HI_U32 blkcnt;
51 | };
52 | HI_U32 alignWidth;
53 | HI_U32 maxPoolCount;
54 | std::list buffers;
55 | };
56 |
57 | #endif // _HIMPP_SYSCTL_H_
58 |
59 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-media.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-media.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_MEDIA_H_
21 | #define _HIMPP_MEDIA_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | using namespace Ipcam::Media;
30 |
31 | class HimppMedia;
32 |
33 | typedef std::vector> PlatformArguments;
34 |
35 | class HimppMedia
36 | {
37 | public:
38 | HimppMedia(IpcamRuntime* runtime, PlatformArguments& args);
39 | ~HimppMedia();
40 |
41 | private:
42 | typedef std::unique_ptr MediaElementUPtr;
43 | typedef std::unordered_map MediaElementMap;
44 | typedef std::list AudioStreamSinkList;
45 | MediaElementMap _elements;
46 | AudioStreamSinkList _audiosinks;
47 | IpcamRuntime* _runtime;
48 | HimppSysctl _sysctl;
49 |
50 | MediaElement* buildElementPipe(const std::string& description);
51 | };
52 |
53 | #endif // _HIMPP_MEDIA_H_
54 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-media.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-media.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_MEDIA_H_
21 | #define _HIMPP_MEDIA_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
29 | using namespace Ipcam::Media;
30 |
31 | class HimppMedia;
32 |
33 | typedef std::vector> PlatformArguments;
34 |
35 | class HimppMedia
36 | {
37 | public:
38 | HimppMedia(IpcamRuntime* runtime, PlatformArguments& args);
39 | ~HimppMedia();
40 |
41 | private:
42 | typedef std::unique_ptr MediaElementUPtr;
43 | typedef std::unordered_map MediaElementMap;
44 | typedef std::list AudioStreamSinkList;
45 | MediaElementMap _elements;
46 | AudioStreamSinkList _audiosinks;
47 | IpcamRuntime* _runtime;
48 | HimppSysctl _sysctl;
49 |
50 | MediaElement* buildElementPipe(const std::string& description);
51 | };
52 |
53 | #endif // _HIMPP_MEDIA_H_
54 |
--------------------------------------------------------------------------------
/src/common/media-common.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * media-common.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _MEDIA_COMMON_H_
21 | #define _MEDIA_COMMON_H_
22 |
23 | #include
24 | #include
25 |
26 | typedef DBus::ErrorFailed IpcamError;
27 |
28 | namespace Ipcam {
29 | namespace Media {
30 |
31 | extern const char *property_not_implemented;
32 | extern const char *interface_not_implemented;
33 |
34 | class Resolution
35 | {
36 | public:
37 | Resolution(uint32_t w, uint32_t h);
38 | Resolution(std::string dimension);
39 |
40 | operator std::string ();
41 |
42 | uint32_t width() const { return _width; }
43 | uint32_t height() const { return _height; }
44 | bool valid() const { return (_width > 0) && (_height > 0); }
45 | bool operator == (const Resolution& r) const {
46 | return (r._width == _width) && (r._height == _height);
47 | }
48 | bool operator != (const Resolution& r) const {
49 | return (r._width != _width) || (r._height != _height);
50 | }
51 |
52 | private:
53 | uint32_t _width;
54 | uint32_t _height;
55 | };
56 |
57 | struct Position {
58 | int x;
59 | int y;
60 | Position(int x, int y) : x(x), y(y) {}
61 | };
62 |
63 | struct Size {
64 | uint32_t w;
65 | uint32_t h;
66 | Size(uint32_t w, uint32_t h) : w(w), h(h) {}
67 | };
68 |
69 | } // namespace Media
70 | } // namespace Ipcam
71 |
72 | #endif // _MEDIA_COMMON_H_
73 |
74 |
--------------------------------------------------------------------------------
/src/rtsp-server/DynamicRTSPServer.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /**********
3 | This library is free software; you can redistribute it and/or modify it under
4 | the terms of the GNU Lesser General Public License as published by the
5 | Free Software Foundation; either version 2.1 of the License, or (at your
6 | option) any later version. (See .)
7 |
8 | This library is distributed in the hope that it will be useful, but WITHOUT
9 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
11 | more details.
12 |
13 | You should have received a copy of the GNU Lesser General Public License
14 | along with this library; if not, write to the Free Software Foundation, Inc.,
15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 | **********/
17 | // Copyright (c) 1996-2015, Live Networks, Inc. All rights reserved
18 | // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand,
19 | // based on whether or not the specified stream name exists as a file
20 | // Implementation
21 |
22 | #include "DynamicRTSPServer.hh"
23 | #include
24 | #include
25 |
26 | DynamicRTSPServer*
27 | DynamicRTSPServer::createNew(UsageEnvironment& env, Port ourPort,
28 | UserAuthenticationDatabase* authDatabase,
29 | unsigned reclamationTestSeconds) {
30 | int ourSocket = setUpOurSocket(env, ourPort);
31 | if (ourSocket == -1) return NULL;
32 |
33 | return new DynamicRTSPServer(env, ourSocket, ourPort, authDatabase, reclamationTestSeconds);
34 | }
35 |
36 | DynamicRTSPServer::DynamicRTSPServer(UsageEnvironment& env, int ourSocket, Port ourPort,
37 | UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds)
38 | : RTSPServerSupportingHTTPStreaming(env, ourSocket, ourPort, authDatabase, reclamationTestSeconds) {
39 | }
40 |
41 | DynamicRTSPServer::~DynamicRTSPServer() {
42 | }
43 |
44 | ServerMediaSession* DynamicRTSPServer
45 | ::lookupServerMediaSession(char const* streamName, Boolean isFirstLookupInSession)
46 | {
47 | return RTSPServer::lookupServerMediaSession(streamName);
48 | }
49 |
--------------------------------------------------------------------------------
/src/rtsp-server/DynamicRTSPServer.hh:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /**********
3 | This library is free software; you can redistribute it and/or modify it under
4 | the terms of the GNU Lesser General Public License as published by the
5 | Free Software Foundation; either version 2.1 of the License, or (at your
6 | option) any later version. (See .)
7 |
8 | This library is distributed in the hope that it will be useful, but WITHOUT
9 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
10 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for
11 | more details.
12 |
13 | You should have received a copy of the GNU Lesser General Public License
14 | along with this library; if not, write to the Free Software Foundation, Inc.,
15 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 | **********/
17 | // Copyright (c) 1996-2015, Live Networks, Inc. All rights reserved
18 | // A subclass of "RTSPServer" that creates "ServerMediaSession"s on demand,
19 | // based on whether or not the specified stream name exists as a file
20 | // Header file
21 |
22 | #ifndef _DYNAMIC_RTSP_SERVER_HH
23 | #define _DYNAMIC_RTSP_SERVER_HH
24 |
25 | #ifndef _RTSP_SERVER_SUPPORTING_HTTP_STREAMING_HH
26 | #include "RTSPServerSupportingHTTPStreaming.hh"
27 | #endif
28 | #include
29 | #include
30 |
31 | class DynamicRTSPServer: public RTSPServerSupportingHTTPStreaming
32 | {
33 | public:
34 | static DynamicRTSPServer* createNew(UsageEnvironment& env, Port ourPort,
35 | UserAuthenticationDatabase* authDatabase,
36 | unsigned reclamationTestSeconds = 65);
37 |
38 | void addStreamPath(const std::string &path, const std::string &location);
39 |
40 | protected:
41 | DynamicRTSPServer(UsageEnvironment& env, int ourSocket, Port ourPort,
42 | UserAuthenticationDatabase* authDatabase, unsigned reclamationTestSeconds);
43 | // called only by createNew();
44 | virtual ~DynamicRTSPServer();
45 |
46 | protected: // redefined virtual functions
47 | virtual ServerMediaSession*
48 | lookupServerMediaSession(char const* streamName, Boolean isFirstLookupInSession);
49 | };
50 |
51 | #endif
52 |
--------------------------------------------------------------------------------
/src/dbus/dbus-ipcam-base.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-ipcam-base.h
4 | * Copyright (C) 2016 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _DBUS_IPCAM_BASE_H_
21 | #define _DBUS_IPCAM_BASE_H_
22 |
23 | #include
24 | #include
25 |
26 | namespace DBus
27 | {
28 |
29 | class IpcamBase :
30 | public IntrospectableAdaptor,
31 | public PropertiesAdaptor,
32 | public ObjectAdaptor
33 | {
34 | public:
35 | IpcamBase(IpcamRuntime &runtime, const Path &path);
36 | virtual ~IpcamBase();
37 |
38 | #ifdef HAVE_JSONCPP_SUPPORT
39 | virtual void LoadConfig();
40 | #endif
41 |
42 | protected:
43 | virtual void do_property_get(InterfaceAdaptor &interface, const std::string &property, Variant &value) = 0;
44 | virtual void do_property_set(InterfaceAdaptor &interface, const std::string &property, const Variant &value) = 0;
45 |
46 | protected:
47 | IpcamRuntime& _runtime;
48 | typedef std::function PropertyGet;
49 | typedef std::function PropertySet;
50 | class PropertyHandler {
51 | public:
52 | PropertyHandler(PropertyGet get, PropertySet set)
53 | : Get(get), Set(set) {}
54 | PropertyGet Get;
55 | PropertySet Set;
56 | };
57 | std::unordered_map _prop_handler;
58 |
59 | private:
60 | void on_get_property(DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value);
61 | void on_set_property(DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
62 | };
63 |
64 | } /* namespace DBus */
65 |
66 | #endif // _DBUS_IPCAM_BASE_H_
67 |
68 |
--------------------------------------------------------------------------------
/src/dbus/dbus-video-source.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-video-source.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _DBUS_VIDEO_SOURCE_H_
21 | #define _DBUS_VIDEO_SOURCE_H_
22 |
23 | #include "dbus-ipcam-base.h"
24 | #include "video-source-server-glue.h"
25 |
26 | using namespace Ipcam::Media;
27 |
28 | namespace DBus {
29 |
30 | class VideoSource :
31 | public ipcam::Media::VideoSource_adaptor,
32 | public ipcam::Media::VideoSource::Imaging_adaptor,
33 | public ipcam::Media::VideoSource::Imaging::AntiFlicker_adaptor,
34 | public ipcam::Media::VideoSource::Imaging::BacklightCompensation_adaptor,
35 | public ipcam::Media::VideoSource::Imaging::Focus_adaptor,
36 | public ipcam::Media::VideoSource::Imaging::Exposure_adaptor,
37 | public ipcam::Media::VideoSource::Imaging::WhiteBalance_adaptor,
38 | public ipcam::Media::VideoSource::Imaging::WideDynamicRange_adaptor,
39 | public ipcam::Media::VideoSource::Imaging::LDC_adaptor,
40 | public ipcam::Media::VideoSource::Imaging::Gamma_adaptor,
41 | public ipcam::Media::VideoSource::Imaging::NoiseReduction_adaptor,
42 | public ipcam::Media::VideoSource::Imaging::IrCutFilter_adaptor,
43 | public IpcamBase
44 | {
45 | public:
46 | VideoSource(IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::VideoSource* video_source);
47 |
48 | void do_property_get
49 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value);
50 | void do_property_set
51 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
52 | protected:
53 | Ipcam::Media::VideoSource* _video_source;
54 | };
55 |
56 | } // namespace DBus
57 |
58 | #endif // _DBUS_VIDEO_SOURCE_H_
59 |
--------------------------------------------------------------------------------
/src/dbus/dbus-video-encoder.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-video-encoder.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _DBUS_VIDEO_ENCODER_H_
21 | #define _DBUS_VIDEO_ENCODER_H_
22 |
23 | #include "dbus-ipcam-base.h"
24 | #include "dbus-video-osd.h"
25 | #include "video-encoder-server-glue.h"
26 |
27 | using namespace Ipcam::Media;
28 |
29 | namespace DBus {
30 |
31 | typedef std::unordered_map VideoOSDTable;
32 |
33 | class VideoEncoder :
34 | public ipcam::Media::VideoEncoder_adaptor,
35 | public ipcam::Media::VideoEncoder::RateControl_adaptor,
36 | public ipcam::Media::VideoEncoder::OSD_adaptor,
37 | public DBus::IpcamBase
38 | {
39 | public:
40 | VideoEncoder(IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::VideoEncoder* encoder);
41 |
42 | void do_property_get
43 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value);
44 | void do_property_set
45 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value);
46 |
47 | #ifdef HAVE_JSONCPP_SUPPORT
48 | void LoadConfig();
49 | #endif
50 |
51 | uint32_t CreateOSD();
52 | void DeleteOSD(const uint32_t& index);
53 | std::map GetOSDs();
54 | protected:
55 | Ipcam::Media::VideoEncoder* _video_encoder;
56 | private:
57 | VideoOSDTable _osds;
58 | VideoOSD& NewOSD(const uint32_t index);
59 | };
60 |
61 | class H264VideoEncoder :
62 | public VideoEncoder,
63 | public ipcam::Media::VideoEncoder::H264_adaptor
64 | {
65 | public:
66 | H264VideoEncoder(IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::H264VideoEncoder* encoder);
67 | };
68 |
69 | } // namespace DBus
70 |
71 | #endif // _DBUS_VIDEO_ENCODER_H_
72 |
73 |
--------------------------------------------------------------------------------
/src/rtsp-server/AACAudioEncoder.hh:
--------------------------------------------------------------------------------
1 | /*
2 | * AACAudioEncoder.hh
3 | * Copyright (C) 2015 Watson Xu
4 | *
5 | * live-streamer is free software: you can redistribute it and/or modify it
6 | * under the terms of the GNU General Public License as published by the
7 | * Free Software Foundation, either version 3 of the License, or
8 | * (at your option) any later version.
9 | *
10 | * live-streamer is distributed in the hope that it will be useful, but
11 | * WITHOUT ANY WARRANTY; without even the implied warranty of
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 | * See the GNU General Public License for more details.
14 | *
15 | * You should have received a copy of the GNU General Public License along
16 | * with this program. If not, see .
17 | */
18 | // "LIVE555 Streaming Media" interface to an AAC audio encoder.
19 | // C++ header
20 |
21 | #ifndef _AAC_AUDIO_ENCODER_HH
22 | #define _AAC_AUDIO_ENCODER_HH
23 |
24 | #include "FramedFilter.hh"
25 |
26 | class AACAudioEncoder: public FramedFilter {
27 | public:
28 | static AACAudioEncoder* createNew(UsageEnvironment& env,
29 | FramedSource* inputPCMSource,
30 | unsigned numChannels, unsigned samplingRate,
31 | unsigned outputKbps);
32 |
33 | protected:
34 | AACAudioEncoder(UsageEnvironment& env, FramedSource* inputPCMSource,
35 | unsigned numChannels, unsigned samplingRate, unsigned outputKbps);
36 | // called only by createNew()
37 | virtual ~AACAudioEncoder();
38 |
39 | private:
40 | // redefined virtual functions:
41 | virtual void doGetNextFrame();
42 |
43 | private:
44 | static void afterGettingFrame(void* clientData, unsigned frameSize,
45 | unsigned numTruncatedBytes,
46 | struct timeval presentationTime,
47 | unsigned durationInMicroseconds);
48 | void afterGettingFrame1(unsigned frameSize,
49 | unsigned numTruncatedBytes,
50 | struct timeval presentationTime,
51 | unsigned durationInMicroseconds);
52 |
53 | private:
54 | void* fEncoderHandle;
55 | unsigned long fNumSamplesPerFrame;
56 | unsigned fMicrosecondsPerFrame;
57 | double fMicrosecondsPerByte;
58 | unsigned char* fInputSampleBuffer;
59 | unsigned fInputSampleBufferSize;
60 | unsigned fInputSampleBufferBytesDesired;
61 | unsigned fInputSampleBufferBytesUsed;
62 | struct timeval fLastInputDataPresentationTime;
63 | };
64 |
65 | #endif
66 |
--------------------------------------------------------------------------------
/src/common/media-element.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * media-element.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _MEDIA_ELEMENT_H_
21 | #define _MEDIA_ELEMENT_H_
22 |
23 | #include
24 | #include
25 |
26 | namespace Ipcam {
27 | namespace Media {
28 |
29 | class MediaElement;
30 | class VideoElement;
31 | class AudioElement;
32 |
33 | #define MEDIA_ELEMENT(o) dynamic_cast(o)
34 | #define VIDEO_ELEMENT(o) dynamic_cast(o)
35 | #define AUDIO_ELEMENT(o) dynamic_cast(o)
36 |
37 | #define MEFLAGS_INITIAL_ENABLED (1 << 0)
38 |
39 | // Base for A/V componments
40 | class MediaElement
41 | {
42 | public:
43 | virtual ~MediaElement();
44 |
45 | virtual void enable(); // enable streaming
46 | virtual void disable(); // disable streaming
47 |
48 | uint32_t& flags() { return _flags; }
49 |
50 | bool is_enabled() { return (_enable_count > 0); }
51 | inline MediaElement* source() { return _source; }
52 |
53 | protected:
54 | MediaElement(MediaElement* source);
55 |
56 | virtual void doEnableElement() = 0;
57 | virtual void doDisableElement() = 0;
58 |
59 | private:
60 | MediaElement* _source;
61 | std::atomic _enable_count;
62 | uint32_t _flags;
63 | };
64 |
65 | // Base for video compoments
66 | class VideoElement : public MediaElement
67 | {
68 | public:
69 | virtual ~VideoElement();
70 |
71 | virtual Resolution resolution();
72 | virtual uint32_t framerate();
73 |
74 | protected:
75 | VideoElement(VideoElement* upstream);
76 | };
77 |
78 | // Base for audio componments
79 | class AudioElement : public MediaElement
80 | {
81 | public:
82 | virtual ~AudioElement();
83 |
84 | virtual uint32_t samplerate();
85 | virtual uint32_t channels();
86 |
87 | protected:
88 | AudioElement(AudioElement* upstream);
89 | };
90 |
91 | } // namespace Media
92 | } // namespace Ipcam
93 |
94 | #endif // _MEDIA_ELEMENT_H_
95 |
96 |
--------------------------------------------------------------------------------
/src/Makefile.am:
--------------------------------------------------------------------------------
1 | ## Process this file with automake to produce Makefile.in
2 |
3 | AM_CPPFLAGS = \
4 | -DPACKAGE_LOCALE_DIR=\""$(localedir)"\" \
5 | -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
6 | $(LIVE555_CPPFLAGS) \
7 | $(DBUSXX_CFLAGS) \
8 | $(FREETYPE_CFLAGS) \
9 | $(FONTCONFIG_CFLAGS) \
10 | $(SDL_CFLAGS) \
11 | -I$(srcdir) -I$(srcdir)/common \
12 | -I$(srcdir)/rtsp-server \
13 | -I$(srcdir)/dbus -I$(builddir)/dbus
14 |
15 | AM_CFLAGS = -Wall
16 | AM_CXXFLAGS = -Wall
17 |
18 | SUBDIRS = \
19 | common \
20 | rtsp-server \
21 | dbus \
22 | platform
23 |
24 | bin_PROGRAMS = live-streamer
25 |
26 | live_streamer_SOURCES = \
27 | main.cpp \
28 | ipcam-runtime.cpp \
29 | ipcam-runtime.h
30 |
31 | live_streamer_LDFLAGS = $(LIVE555_LDFLAGS) \
32 | $(DBUSXX_LIBS) \
33 | $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(SDL_LIBS) \
34 | $(LIBEV_LDFLAGS) -ldl
35 |
36 | live_streamer_CPPFLAGS = $(AM_CPPFLAGS)
37 | live_streamer_LDADD = \
38 | $(builddir)/common/libcommon.la \
39 | $(builddir)/dbus/libdbus-iface.la \
40 | $(builddir)/rtsp-server/librtsp-server.la
41 |
42 | if ENABLE_JSONCPP
43 | live_streamer_CPPFLAGS += $(JSONCPP_CPPFLAGS)
44 | live_streamer_LDFLAGS += $(JSONCPP_LIBS)
45 | endif
46 |
47 | if ENABLE_VO_AACENC
48 | live_streamer_CPPFLAGS += $(VO_AACENC_CPPFLAGS)
49 | live_streamer_LDFLAGS += $(VO_AACENC_LIBS)
50 | endif
51 |
52 | if ENABLE_HI3518V100
53 | live_streamer_CPPFLAGS += $(HI3518V100_CPPFLAGS) -I$(srcdir)/platform/hi3518v100
54 | live_streamer_LDFLAGS += $(HI3518V100_LDFLAGS)
55 | live_streamer_LDADD += $(builddir)/platform/hi3518v100/libhi3518v100.la
56 | endif
57 |
58 | if ENABLE_HI3518V200
59 | live_streamer_CPPFLAGS += $(HI3518V200_CPPFLAGS) -I$(srcdir)/platform/hi3518v200
60 | live_streamer_LDFLAGS += $(HI3518V200_LDFLAGS)
61 | live_streamer_LDADD += $(builddir)/platform/hi3518v200/libhi3518v200.la
62 | endif
63 |
64 | if ENABLE_HI3516CV300
65 | live_streamer_CPPFLAGS += $(HI3516CV300_CPPFLAGS) -I$(srcdir)/platform/hi3516cv300
66 | live_streamer_LDFLAGS += $(HI3516CV300_LDFLAGS)
67 | live_streamer_LDADD += $(builddir)/platform/hi3516cv300/libhi3516cv300.la
68 | endif
69 |
70 | if ENABLE_HI3516EV200
71 | live_streamer_CPPFLAGS += $(HI3516EV200_CPPFLAGS) -I$(srcdir)/platform/hi3516ev200
72 | live_streamer_LDFLAGS += $(HI3516EV200_LDFLAGS)
73 | live_streamer_LDADD += $(builddir)/platform/hi3516ev200/libhi3516ev200.la
74 | endif
75 |
76 | if ENABLE_HI3520V100
77 | live_streamer_CPPFLAGS += $(HI3520V100_CPPFLAGS) -I$(srcdir)/platform/hi3520v100
78 | live_streamer_LDFLAGS += $(HI3520V100_LDFLAGS)
79 | live_streamer_LDADD += $(builddir)/platform/hi3520v100/libhi3520v100.la
80 | endif
81 |
82 | if ENABLE_HI3520DV200
83 | live_streamer_CPPFLAGS += $(HI3520DV200_CPPFLAGS) -I$(srcdir)/platform/hi3520v100
84 | live_streamer_LDFLAGS += $(HI3520DV200_LDFLAGS)
85 | live_streamer_LDADD += $(builddir)/platform/hi3520v100/libhi3520v100.la
86 | endif
87 |
--------------------------------------------------------------------------------
/src/dbus/dbus-audio-source.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-audio-source.cpp
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 |
24 | #include
25 | #include
26 |
27 | #include "dbus-audio-source.h"
28 |
29 | namespace DBus {
30 |
31 | #define AUDIOSOURCE_INTERFACE "ipcam.Media.AudioSource"
32 |
33 | #define DEFINE_PROP(prop, get, set) \
34 | _prop_handler.emplace(std::piecewise_construct, \
35 | std::forward_as_tuple(prop), \
36 | std::forward_as_tuple(get, set))
37 |
38 | AudioSource::AudioSource
39 | (IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::AudioSource* source)
40 | : IpcamBase(runtime, obj_path),
41 | _audio_source(source)
42 | {
43 | assert(source != NULL);
44 |
45 | // Handler of ipcam.Media.Source
46 | DEFINE_PROP(AUDIOSOURCE_INTERFACE ".Channels",
47 | [this](DBus::InterfaceAdaptor &interface,
48 | const std::string &property, DBus::Variant &value)
49 | {
50 | value.writer().append_uint32(_audio_source->getChannels());
51 | },
52 | [this](DBus::InterfaceAdaptor &interface,
53 | const std::string &property, const DBus::Variant &value)
54 | {
55 | throw DBus::ErrorFailed("Readonly property");
56 | });
57 | }
58 |
59 | void AudioSource::do_property_get
60 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value)
61 | {
62 | value.clear();
63 |
64 | auto iter = _prop_handler.find(interface.name() + "." + property);
65 | if (iter == _prop_handler.end())
66 | throw DBus::ErrorFailed("Requested interface or property not found");
67 | iter->second.Get(interface, property, value);
68 | }
69 |
70 | void AudioSource::do_property_set
71 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value)
72 | {
73 | auto iter = _prop_handler.find(interface.name() + "." + property);
74 | if (iter == _prop_handler.end())
75 | throw DBus::ErrorFailed("Requested interface or property not found");
76 | iter->second.Set(interface, property, value);
77 | }
78 |
79 | } // namespace DBus
80 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-video-region.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-region.h
4 | * Copyright (C) 2016 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_VIDEO_REGION_H_
21 | #define _HIMPP_VIDEO_REGION_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | using namespace Ipcam::Media;
29 |
30 | class HimppVideoRegion;
31 |
32 | #define HIMPP_VIDEO_REGION(o) dynamic_cast(o)
33 |
34 | class HimppRegionAllocator
35 | {
36 | public:
37 | HimppRegionAllocator();
38 | ~HimppRegionAllocator();
39 |
40 | RGN_HANDLE allocHandle();
41 | void freeHandle(RGN_HANDLE handle);
42 | private:
43 | std::bitset _region_bmp;
44 | };
45 |
46 | class HimppVideoRegion : public SoftRenderVideoOSD
47 | {
48 | public:
49 | HimppVideoRegion(HimppVideoElement* container, RGN_HANDLE handle);
50 | ~HimppVideoRegion();
51 |
52 | void doEnableElement();
53 | void doDisableElement();
54 |
55 | uint32_t regionId() { return (uint32_t)_rgn_handle; }
56 |
57 | bool getVisible();
58 | void setVisible(bool value);
59 | Size getSize();
60 | void setSize(Size value);
61 | uint32_t getForegroundColor();
62 | void setForegroundColor(uint32_t value);
63 | uint32_t getBackgroundColor();
64 | void setBackgroundColor(uint32_t value);
65 |
66 | Position getPosition();
67 | void setPosition(Position value);
68 | uint32_t getForegroundAlpha();
69 | void setForegroundAlpha(uint32_t value);
70 | uint32_t getBackgroundAlpha();
71 | void setBackgroundAlpha(uint32_t value);
72 | bool getInvertColor();
73 | void setInvertColor(bool value);
74 |
75 | void updateDisplay(SDL_Surface* surface);
76 |
77 | private:
78 | RGN_HANDLE _rgn_handle;
79 | bool _visible;
80 | Position _position;
81 | Size _size;
82 | uint32_t _fgcolor;
83 | uint32_t _bgcolor;
84 | uint32_t _fgalpha;
85 | uint32_t _bgalpha;
86 | uint32_t _layer;
87 | bool _invert_color;
88 | BITMAP_S _bitmap;
89 | SDL_Surface* _surface;
90 | };
91 |
92 | extern HimppRegionAllocator himpp_region_allocator;
93 |
94 | #endif // _HIMPP_VIDEO_REGION_H_
95 |
96 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-video-region.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-region.h
4 | * Copyright (C) 2016 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_VIDEO_REGION_H_
21 | #define _HIMPP_VIDEO_REGION_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | using namespace Ipcam::Media;
29 |
30 | class HimppVideoRegion;
31 |
32 | #define HIMPP_VIDEO_REGION(o) dynamic_cast(o)
33 |
34 | class HimppRegionAllocator
35 | {
36 | public:
37 | HimppRegionAllocator();
38 | ~HimppRegionAllocator();
39 |
40 | RGN_HANDLE allocHandle();
41 | void freeHandle(RGN_HANDLE handle);
42 | private:
43 | std::bitset _region_bmp;
44 | };
45 |
46 | class HimppVideoRegion : public SoftRenderVideoOSD
47 | {
48 | public:
49 | HimppVideoRegion(HimppVideoElement* container, RGN_HANDLE handle);
50 | ~HimppVideoRegion();
51 |
52 | void doEnableElement();
53 | void doDisableElement();
54 |
55 | uint32_t regionId() { return (uint32_t)_rgn_handle; }
56 |
57 | bool getVisible();
58 | void setVisible(bool value);
59 | Size getSize();
60 | void setSize(Size value);
61 | uint32_t getForegroundColor();
62 | void setForegroundColor(uint32_t value);
63 | uint32_t getBackgroundColor();
64 | void setBackgroundColor(uint32_t value);
65 |
66 | Position getPosition();
67 | void setPosition(Position value);
68 | uint32_t getForegroundAlpha();
69 | void setForegroundAlpha(uint32_t value);
70 | uint32_t getBackgroundAlpha();
71 | void setBackgroundAlpha(uint32_t value);
72 | bool getInvertColor();
73 | void setInvertColor(bool value);
74 |
75 | void updateDisplay(SDL_Surface* surface);
76 |
77 | private:
78 | RGN_HANDLE _rgn_handle;
79 | bool _visible;
80 | Position _position;
81 | Size _size;
82 | uint32_t _fgcolor;
83 | uint32_t _bgcolor;
84 | uint32_t _fgalpha;
85 | uint32_t _bgalpha;
86 | uint32_t _layer;
87 | bool _invert_color;
88 | BITMAP_S _bitmap;
89 | SDL_Surface* _surface;
90 | };
91 |
92 | extern HimppRegionAllocator himpp_region_allocator;
93 |
94 | #endif // _HIMPP_VIDEO_REGION_H_
95 |
96 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-video-region.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-video-region.h
4 | * Copyright (C) 2016 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_VIDEO_REGION_H_
21 | #define _HIMPP_VIDEO_REGION_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | using namespace Ipcam::Media;
29 |
30 | class HimppVideoRegion;
31 |
32 | #define HIMPP_VIDEO_REGION(o) dynamic_cast(o)
33 |
34 | class HimppRegionAllocator
35 | {
36 | public:
37 | HimppRegionAllocator();
38 | ~HimppRegionAllocator();
39 |
40 | RGN_HANDLE allocHandle();
41 | void freeHandle(RGN_HANDLE handle);
42 | private:
43 | std::bitset _region_bmp;
44 | };
45 |
46 | class HimppVideoRegion : public SoftRenderVideoOSD
47 | {
48 | public:
49 | HimppVideoRegion(HimppVideoElement* container, RGN_HANDLE handle);
50 | ~HimppVideoRegion();
51 |
52 | void doEnableElement();
53 | void doDisableElement();
54 |
55 | uint32_t regionId() { return (uint32_t)_rgn_handle; }
56 |
57 | bool getVisible();
58 | void setVisible(bool value);
59 | Size getSize();
60 | void setSize(Size value);
61 | uint32_t getForegroundColor();
62 | void setForegroundColor(uint32_t value);
63 | uint32_t getBackgroundColor();
64 | void setBackgroundColor(uint32_t value);
65 |
66 | Position getPosition();
67 | void setPosition(Position value);
68 | uint32_t getForegroundAlpha();
69 | void setForegroundAlpha(uint32_t value);
70 | uint32_t getBackgroundAlpha();
71 | void setBackgroundAlpha(uint32_t value);
72 | bool getInvertColor();
73 | void setInvertColor(bool value);
74 |
75 | void updateDisplay(SDL_Surface* surface);
76 |
77 | private:
78 | RGN_HANDLE _rgn_handle;
79 | bool _visible;
80 | Position _position;
81 | Size _size;
82 | uint32_t _fgcolor;
83 | uint32_t _bgcolor;
84 | uint32_t _fgalpha;
85 | uint32_t _bgalpha;
86 | uint32_t _layer;
87 | bool _invert_color;
88 | BITMAP_S _bitmap;
89 | SDL_Surface* _surface;
90 | };
91 |
92 | extern HimppRegionAllocator himpp_region_allocator;
93 |
94 | #endif // _HIMPP_VIDEO_REGION_H_
95 |
96 |
--------------------------------------------------------------------------------
/src/dbus/dbusxx-libev-integration.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | *
4 | * D-Bus++ - C++ bindings for D-Bus
5 | *
6 | * Copyright (C) 2015 Watson Xu
7 | *
8 | *
9 | * This library is free software; you can redistribute it and/or
10 | * modify it under the terms of the GNU Lesser General Public
11 | * License as published by the Free Software Foundation; either
12 | * version 2.1 of the License, or (at your option) any later version.
13 | *
14 | * This library is distributed in the hope that it will be useful,
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 | * Lesser General Public License for more details.
18 | *
19 | * You should have received a copy of the GNU Lesser General Public
20 | * License along with this library; if not, write to the Free Software
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 | *
23 | */
24 |
25 |
26 | #ifndef __DBUSXX_LIBEV_INTEGRATION_H
27 | #define __DBUSXX_LIBEV_INTEGRATION_H
28 |
29 | #include
30 |
31 | #include
32 | #include
33 |
34 | namespace DBus
35 | {
36 |
37 | namespace Ev
38 | {
39 |
40 | class BusDispatcher;
41 |
42 | class DXXAPI BusTimeout : public Timeout
43 | {
44 | private:
45 |
46 | BusTimeout(Timeout::Internal *, ev::loop_ref &, int);
47 |
48 | ~BusTimeout();
49 |
50 | void toggle();
51 |
52 | void timeout_handler(ev::timer &, int);
53 |
54 | void _enable();
55 |
56 | void _disable();
57 |
58 | private:
59 |
60 | ev::loop_ref &_loop;
61 | int _priority;
62 | ev::timer _timer;
63 |
64 | friend class BusDispatcher;
65 | };
66 |
67 | class DXXAPI BusWatch : public Watch
68 | {
69 | private:
70 |
71 | BusWatch(Watch::Internal *, ev::loop_ref &, int);
72 |
73 | ~BusWatch();
74 |
75 | void toggle();
76 |
77 | void watch_handler(ev::io &, int);
78 |
79 | void _enable();
80 |
81 | void _disable();
82 |
83 | private:
84 |
85 | ev::loop_ref &_loop;
86 | int _priority;
87 | ev::io _io;
88 |
89 | friend class BusDispatcher;
90 | };
91 |
92 | class DXXAPI BusDispatcher : public Dispatcher
93 | {
94 | public:
95 |
96 | BusDispatcher();
97 | ~BusDispatcher();
98 |
99 | void attach(ev::loop_ref *);
100 |
101 | void enter() {}
102 |
103 | void leave() {}
104 |
105 | Timeout *add_timeout(Timeout::Internal *);
106 |
107 | void rem_timeout(Timeout *);
108 |
109 | Watch *add_watch(Watch::Internal *);
110 |
111 | void rem_watch(Watch *);
112 |
113 | void set_priority(int priority);
114 |
115 | void prepare_handler(ev::prepare &, int);
116 | void check_handler(ev::check &, int);
117 |
118 | private:
119 |
120 | ev::loop_ref _loop;
121 | int _priority;
122 | ev::check _check;
123 | ev::prepare _prepare;
124 | };
125 |
126 | } /* namespace Ev */
127 |
128 | } /* namespace DBus */
129 |
130 | #endif//__DBUSXX_LIBEV_INTEGRATION_H
131 |
--------------------------------------------------------------------------------
/src/common/media-common.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * media-common.cpp
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "media-common.h"
23 |
24 | namespace Ipcam {
25 | namespace Media {
26 |
27 | struct ResolutionEntry
28 | {
29 | const char *name;
30 | uint16_t width;
31 | uint16_t height;
32 | };
33 |
34 | static ResolutionEntry _resolution_table[] = {
35 | { .name = "QCIF", .width = 176, .height = 144 },
36 | { .name = "CIF", .width = 352, .height = 288 },
37 | { .name = "D1", .width = 720, .height = 576 },
38 | { .name = "960H", .width = 960, .height = 576 },
39 | { .name = "2CIF", .width = 360, .height = 576 },
40 | { .name = "QVGA", .width = 320, .height = 240 },
41 | { .name = "VGA", .width = 640, .height = 480 },
42 | { .name = "XGA", .width = 1024, .height = 760 },
43 | { .name = "SXGA", .width = 1400, .height = 1050 },
44 | { .name = "UXGA", .width = 1600, .height = 1200 },
45 | { .name = "QXGA", .width = 2048, .height = 1536 },
46 | { .name = "WVGA", .width = 800, .height = 480 },
47 | { .name = "WSXGA", .width = 1680, .height = 1050 },
48 | { .name = "720P", .width = 1280, .height = 720 },
49 | { .name = "1080P", .width = 1920, .height = 1080 },
50 | { .name = NULL, .width = 0, .height = 0 }
51 | };
52 |
53 | const char *property_not_implemented = "Requested property not implemented";
54 | const char *interface_not_implemented = "Requested interface not implemented";
55 |
56 | Resolution::Resolution(uint32_t w, uint32_t h)
57 | : _width(w), _height(h)
58 | {
59 | }
60 |
61 | Resolution::Resolution(std::string resolution)
62 | : _width(0), _height(0)
63 | {
64 | ResolutionEntry *ent = _resolution_table;
65 |
66 | while (ent->name) {
67 | if (strcasecmp(resolution.c_str(), ent->name) == 0) {
68 | _width = ent->width;
69 | _height = ent->height;
70 | return;
71 | }
72 | ent++;
73 | }
74 |
75 | static std::regex re("([0-9]+)[xX]([0-9]+)");
76 | std::cmatch cm;
77 | if (std::regex_match(resolution.c_str(), cm, re)) {
78 | _width = std::stoul(cm[1]);
79 | _height = std::stoul(cm[2]);
80 | }
81 | }
82 |
83 | Resolution::operator std::string ()
84 | {
85 | ResolutionEntry *ent = _resolution_table;
86 |
87 | while (ent->name) {
88 | if (ent->width == _width && ent->height == _height)
89 | return std::string(ent->name);
90 | ent++;
91 | }
92 |
93 | return std::to_string(_width) + "x" + std::to_string(_height);
94 | }
95 |
96 | } // namespace Media
97 | } // namespace Ipcam
98 |
--------------------------------------------------------------------------------
/src/common/media-stream.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * media-stream.cpp
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include "media-stream.h"
21 |
22 | namespace Ipcam {
23 | namespace Media {
24 |
25 |
26 | //////////////////////////////////////////////////////////////////////////////
27 | // StreamSource
28 | //////////////////////////////////////////////////////////////////////////////
29 |
30 | StreamSource::~StreamSource()
31 | {
32 | }
33 |
34 | void StreamSource::attach(StreamSink* sink)
35 | {
36 | if (!dynamic_cast(sink)) return; // Sanity check
37 |
38 | _sinks.insert(sink);
39 | }
40 |
41 | void StreamSource::detach(StreamSink* sink)
42 | {
43 | if (!dynamic_cast(sink)) return; // Sanity check
44 |
45 | _sinks.erase(sink);
46 | }
47 |
48 | void StreamSource::streamData(StreamBuffer* buffer)
49 | {
50 | for (auto sink : _sinks) {
51 | sink->streamData(buffer);
52 | }
53 | }
54 |
55 |
56 | //////////////////////////////////////////////////////////////////////////////
57 | // StreamSink
58 | //////////////////////////////////////////////////////////////////////////////
59 |
60 | void StreamSink::play()
61 | {
62 | }
63 |
64 | void StreamSink::stop()
65 | {
66 | }
67 |
68 | void StreamSink::pause()
69 | {
70 | }
71 |
72 | void StreamSink::resume()
73 | {
74 | }
75 |
76 |
77 | //////////////////////////////////////////////////////////////////////////////
78 | // VideoStreamSource
79 | //////////////////////////////////////////////////////////////////////////////
80 |
81 | VideoStreamSource::~VideoStreamSource()
82 | {
83 | }
84 |
85 | //////////////////////////////////////////////////////////////////////////////
86 | // H264VideoStreamSource
87 | //////////////////////////////////////////////////////////////////////////////
88 |
89 | H264VideoStreamSource::~H264VideoStreamSource()
90 | {
91 | }
92 |
93 | //////////////////////////////////////////////////////////////////////////////
94 | // JPEGVideoStreamSource
95 | //////////////////////////////////////////////////////////////////////////////
96 |
97 | JPEGVideoStreamSource::~JPEGVideoStreamSource()
98 | {
99 | }
100 |
101 | //////////////////////////////////////////////////////////////////////////////
102 | // AudioStreamSource
103 | //////////////////////////////////////////////////////////////////////////////
104 |
105 | AudioStreamSource::~AudioStreamSource()
106 | {
107 | }
108 |
109 | } //namespace Media
110 | } //namespace Ipcam
111 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-sysctl.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-sysctl.cpp
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include "himpp-sysctl.h"
24 |
25 | HimppSysctl::HimppSysctl(HI_U32 align_width, HI_U32 max_pool_cnt)
26 | : MediaElement(NULL), alignWidth(align_width), maxPoolCount(max_pool_cnt)
27 | {
28 | }
29 |
30 | HimppSysctl::~HimppSysctl()
31 | {
32 | }
33 |
34 | void HimppSysctl::addVideoBuffer(HI_U32 blksiz, HI_U32 blkcnt)
35 | {
36 | buffers.emplace(buffers.end(), blksiz, blkcnt);
37 | }
38 |
39 | void HimppSysctl::setAlignWidth(HI_U32 value)
40 | {
41 | alignWidth = value;
42 | }
43 |
44 | void HimppSysctl::setMaxPoolCount(HI_U32 value)
45 | {
46 | maxPoolCount = value;
47 | }
48 |
49 | void HimppSysctl::doEnableElement()
50 | {
51 | HI_S32 s32Ret = HI_FAILURE;
52 |
53 | VB_CONF_S vbconf;
54 | memset(&vbconf, 0, sizeof(vbconf));
55 | vbconf.u32MaxPoolCnt = maxPoolCount;
56 | int i = 0;
57 | for (auto &b : buffers) {
58 | vbconf.astCommPool[i].u32BlkSize = b.blksiz;
59 | vbconf.astCommPool[i].u32BlkCnt = b.blkcnt;
60 | i++;
61 | }
62 |
63 | HI_MPI_SYS_Exit();
64 | HI_MPI_VB_Exit();
65 |
66 | s32Ret = HI_MPI_VB_SetConf(&vbconf);
67 | if (s32Ret != HI_SUCCESS) {
68 | HIMPP_PRINT("HI_MPI_VB_SetConf failed [%#x]\n", s32Ret);
69 | throw IpcamError("Failed to set vb config");
70 | }
71 |
72 | s32Ret = HI_MPI_VB_Init();
73 | if (s32Ret != HI_SUCCESS) {
74 | HIMPP_PRINT("HI_MPI_VB_Init failed [%#x]\n", s32Ret);
75 | throw IpcamError("Failed to init vb");
76 | }
77 |
78 | MPP_SYS_CONF_S sysconf = {
79 | .u32AlignWidth = alignWidth
80 | };
81 | s32Ret = HI_MPI_SYS_SetConf(&sysconf);
82 | if (s32Ret != HI_SUCCESS) {
83 | HIMPP_PRINT("HI_MPI_SYS_SetConf failed [%#x]\n", s32Ret);
84 | goto err_vb_cleanup;
85 | }
86 |
87 | s32Ret = HI_MPI_SYS_Init();
88 | if (s32Ret != HI_SUCCESS) {
89 | HIMPP_PRINT("HI_MPI_SYS_Init failed [%#x]\n", s32Ret);
90 | goto err_vb_cleanup;
91 | }
92 |
93 | return;
94 |
95 | err_vb_cleanup:
96 | HI_MPI_VB_Exit();
97 | throw IpcamError("Failed to init sys");
98 | }
99 |
100 | void HimppSysctl::doDisableElement()
101 | {
102 | HI_S32 s32Ret;
103 |
104 | if ((s32Ret = HI_MPI_SYS_Exit()) != HI_SUCCESS) {
105 | HIMPP_PRINT("HI_MPI_SYS_Exit failed [%#x]\n", s32Ret);
106 | }
107 | if ((s32Ret = HI_MPI_VB_Exit()) != HI_SUCCESS) {
108 | HIMPP_PRINT("HI_MPI_VB_Exit failed [%#x]\n", s32Ret);
109 | }
110 | if ((s32Ret = HI_MPI_SYS_CloseFd()) != HI_SUCCESS) {
111 | HIMPP_PRINT("HI_MPI_SYS_CloseFd failed [%#x]\n", s32Ret);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-sysctl.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-sysctl.cpp
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include "himpp-sysctl.h"
24 |
25 | HimppSysctl::HimppSysctl(HI_U32 align_width, HI_U32 max_pool_cnt)
26 | : MediaElement(NULL), alignWidth(align_width), maxPoolCount(max_pool_cnt)
27 | {
28 | }
29 |
30 | HimppSysctl::~HimppSysctl()
31 | {
32 | }
33 |
34 | void HimppSysctl::addVideoBuffer(HI_U32 blksiz, HI_U32 blkcnt)
35 | {
36 | buffers.emplace(buffers.end(), blksiz, blkcnt);
37 | }
38 |
39 | void HimppSysctl::setAlignWidth(HI_U32 value)
40 | {
41 | alignWidth = value;
42 | }
43 |
44 | void HimppSysctl::setMaxPoolCount(HI_U32 value)
45 | {
46 | maxPoolCount = value;
47 | }
48 |
49 | void HimppSysctl::doEnableElement()
50 | {
51 | HI_S32 s32Ret = HI_FAILURE;
52 |
53 | VB_CONF_S vbconf;
54 | memset(&vbconf, 0, sizeof(vbconf));
55 | vbconf.u32MaxPoolCnt = maxPoolCount;
56 | int i = 0;
57 | for (auto &b : buffers) {
58 | vbconf.astCommPool[i].u32BlkSize = b.blksiz;
59 | vbconf.astCommPool[i].u32BlkCnt = b.blkcnt;
60 | i++;
61 | }
62 |
63 | HI_MPI_SYS_Exit();
64 | HI_MPI_VB_Exit();
65 |
66 | s32Ret = HI_MPI_VB_SetConf(&vbconf);
67 | if (s32Ret != HI_SUCCESS) {
68 | HIMPP_PRINT("HI_MPI_VB_SetConf failed [%#x]\n", s32Ret);
69 | throw IpcamError("Failed to set vb config");
70 | }
71 |
72 | s32Ret = HI_MPI_VB_Init();
73 | if (s32Ret != HI_SUCCESS) {
74 | HIMPP_PRINT("HI_MPI_VB_Init failed [%#x]\n", s32Ret);
75 | throw IpcamError("Failed to init vb");
76 | }
77 |
78 | MPP_SYS_CONF_S sysconf = {
79 | .u32AlignWidth = alignWidth
80 | };
81 | s32Ret = HI_MPI_SYS_SetConf(&sysconf);
82 | if (s32Ret != HI_SUCCESS) {
83 | HIMPP_PRINT("HI_MPI_SYS_SetConf failed [%#x]\n", s32Ret);
84 | goto err_vb_cleanup;
85 | }
86 |
87 | s32Ret = HI_MPI_SYS_Init();
88 | if (s32Ret != HI_SUCCESS) {
89 | HIMPP_PRINT("HI_MPI_SYS_Init failed [%#x]\n", s32Ret);
90 | goto err_vb_cleanup;
91 | }
92 |
93 | return;
94 |
95 | err_vb_cleanup:
96 | HI_MPI_VB_Exit();
97 | throw IpcamError("Failed to init sys");
98 | }
99 |
100 | void HimppSysctl::doDisableElement()
101 | {
102 | HI_S32 s32Ret;
103 |
104 | if ((s32Ret = HI_MPI_SYS_Exit()) != HI_SUCCESS) {
105 | HIMPP_PRINT("HI_MPI_SYS_Exit failed [%#x]\n", s32Ret);
106 | }
107 | if ((s32Ret = HI_MPI_VB_Exit()) != HI_SUCCESS) {
108 | HIMPP_PRINT("HI_MPI_VB_Exit failed [%#x]\n", s32Ret);
109 | }
110 | if ((s32Ret = HI_MPI_SYS_CloseFd()) != HI_SUCCESS) {
111 | HIMPP_PRINT("HI_MPI_SYS_CloseFd failed [%#x]\n", s32Ret);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-sysctl.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-sysctl.cpp
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 | #include
22 | #include
23 | #include "himpp-sysctl.h"
24 |
25 | HimppSysctl::HimppSysctl(HI_U32 align_width, HI_U32 max_pool_cnt)
26 | : MediaElement(NULL), alignWidth(align_width), maxPoolCount(max_pool_cnt)
27 | {
28 | }
29 |
30 | HimppSysctl::~HimppSysctl()
31 | {
32 | }
33 |
34 | void HimppSysctl::addVideoBuffer(HI_U32 blksiz, HI_U32 blkcnt)
35 | {
36 | buffers.emplace(buffers.end(), blksiz, blkcnt);
37 | }
38 |
39 | void HimppSysctl::setAlignWidth(HI_U32 value)
40 | {
41 | alignWidth = value;
42 | }
43 |
44 | void HimppSysctl::setMaxPoolCount(HI_U32 value)
45 | {
46 | maxPoolCount = value;
47 | }
48 |
49 | void HimppSysctl::doEnableElement()
50 | {
51 | HI_S32 s32Ret = HI_FAILURE;
52 |
53 | VB_CONFIG_S vbconf;
54 | memset(&vbconf, 0, sizeof(vbconf));
55 | vbconf.u32MaxPoolCnt = maxPoolCount;
56 | int i = 0;
57 | for (auto &b : buffers) {
58 | vbconf.astCommPool[i].u64BlkSize = b.blksiz;
59 | vbconf.astCommPool[i].u32BlkCnt = b.blkcnt;
60 | i++;
61 | }
62 |
63 | HI_MPI_SYS_Exit();
64 | HI_MPI_VB_Exit();
65 |
66 | s32Ret = HI_MPI_VB_SetConfig(&vbconf);
67 | if (s32Ret != HI_SUCCESS) {
68 | HIMPP_PRINT("HI_MPI_VB_SetConfig failed [%#x]\n", s32Ret);
69 | throw IpcamError("Failed to set vb config");
70 | }
71 |
72 | s32Ret = HI_MPI_VB_Init();
73 | if (s32Ret != HI_SUCCESS) {
74 | HIMPP_PRINT("HI_MPI_VB_Init failed [%#x]\n", s32Ret);
75 | throw IpcamError("Failed to init vb");
76 | }
77 |
78 | MPP_SYS_CONFIG_S sysconf = {
79 | .u32Align = alignWidth
80 | };
81 | s32Ret = HI_MPI_SYS_SetConfig(&sysconf);
82 | if (s32Ret != HI_SUCCESS) {
83 | HIMPP_PRINT("HI_MPI_SYS_SetConf failed [%#x]\n", s32Ret);
84 | goto err_vb_cleanup;
85 | }
86 |
87 | s32Ret = HI_MPI_SYS_Init();
88 | if (s32Ret != HI_SUCCESS) {
89 | HIMPP_PRINT("HI_MPI_SYS_Init failed [%#x]\n", s32Ret);
90 | goto err_vb_cleanup;
91 | }
92 |
93 | return;
94 |
95 | err_vb_cleanup:
96 | HI_MPI_VB_Exit();
97 | throw IpcamError("Failed to init sys");
98 | }
99 |
100 | void HimppSysctl::doDisableElement()
101 | {
102 | HI_S32 s32Ret;
103 |
104 | if ((s32Ret = HI_MPI_SYS_Exit()) != HI_SUCCESS) {
105 | HIMPP_PRINT("HI_MPI_SYS_Exit failed [%#x]\n", s32Ret);
106 | }
107 | if ((s32Ret = HI_MPI_VB_Exit()) != HI_SUCCESS) {
108 | HIMPP_PRINT("HI_MPI_VB_Exit failed [%#x]\n", s32Ret);
109 | }
110 | if ((s32Ret = HI_MPI_SYS_CloseFd()) != HI_SUCCESS) {
111 | HIMPP_PRINT("HI_MPI_SYS_CloseFd failed [%#x]\n", s32Ret);
112 | }
113 | }
114 |
--------------------------------------------------------------------------------
/config.h.in:
--------------------------------------------------------------------------------
1 | /* config.h.in. Generated from configure.ac by autoheader. */
2 |
3 | /* define if the compiler supports basic C++11 syntax */
4 | #undef HAVE_CXX11
5 |
6 | /* Define to 1 if you have the header file. */
7 | #undef HAVE_DLFCN_H
8 |
9 | /* Define to 1 if you have the header file. */
10 | #undef HAVE_EV_H
11 |
12 | /* support Hi3516cv300 MPP */
13 | #undef HAVE_HI3516CV300_SUPPORT
14 |
15 | /* support Hi3516ev200 MPP */
16 | #undef HAVE_HI3516EV200_SUPPORT
17 |
18 | /* support Hi3518v100 MPP */
19 | #undef HAVE_HI3518V100_SUPPORT
20 |
21 | /* support Hi3518v200 MPP */
22 | #undef HAVE_HI3518V200_SUPPORT
23 |
24 | /* support Hi3520dv200 MPP */
25 | #undef HAVE_HI3520DV200_SUPPORT
26 |
27 | /* support Hi3520 MPP */
28 | #undef HAVE_HI3520V100_SUPPORT
29 |
30 | /* Define to 1 if you have the header file. */
31 | #undef HAVE_INTTYPES_H
32 |
33 | /* jsoncpp support */
34 | #undef HAVE_JSONCPP_SUPPORT
35 |
36 | /* Define to 1 if you have the header file. */
37 | #undef HAVE_MEMORY_H
38 |
39 | /* Define to 1 if you have the header file. */
40 | #undef HAVE_STDINT_H
41 |
42 | /* Define to 1 if you have the header file. */
43 | #undef HAVE_STDLIB_H
44 |
45 | /* Define to 1 if you have the header file. */
46 | #undef HAVE_STRINGS_H
47 |
48 | /* Define to 1 if you have the header file. */
49 | #undef HAVE_STRING_H
50 |
51 | /* Define to 1 if you have the header file. */
52 | #undef HAVE_SYS_STAT_H
53 |
54 | /* Define to 1 if you have the header file. */
55 | #undef HAVE_SYS_TYPES_H
56 |
57 | /* Define to 1 if you have the header file. */
58 | #undef HAVE_UNISTD_H
59 |
60 | /* vo-aacenc support */
61 | #undef HAVE_VO_AACENC_SUPPORT
62 |
63 | /* Define to the sub-directory in which libtool stores uninstalled libraries.
64 | */
65 | #undef LT_OBJDIR
66 |
67 | /* Name of package */
68 | #undef PACKAGE
69 |
70 | /* Define to the address where bug reports for this package should be sent. */
71 | #undef PACKAGE_BUGREPORT
72 |
73 | /* Define to the full name of this package. */
74 | #undef PACKAGE_NAME
75 |
76 | /* Define to the full name and version of this package. */
77 | #undef PACKAGE_STRING
78 |
79 | /* Define to the one symbol short name of this package. */
80 | #undef PACKAGE_TARNAME
81 |
82 | /* Define to the home page for this package. */
83 | #undef PACKAGE_URL
84 |
85 | /* Define to the version of this package. */
86 | #undef PACKAGE_VERSION
87 |
88 | /* Define to 1 if you have the ANSI C header files. */
89 | #undef STDC_HEADERS
90 |
91 | /* Enable extensions on AIX 3, Interix. */
92 | #ifndef _ALL_SOURCE
93 | # undef _ALL_SOURCE
94 | #endif
95 | /* Enable GNU extensions on systems that have them. */
96 | #ifndef _GNU_SOURCE
97 | # undef _GNU_SOURCE
98 | #endif
99 | /* Enable threading extensions on Solaris. */
100 | #ifndef _POSIX_PTHREAD_SEMANTICS
101 | # undef _POSIX_PTHREAD_SEMANTICS
102 | #endif
103 | /* Enable extensions on HP NonStop. */
104 | #ifndef _TANDEM_SOURCE
105 | # undef _TANDEM_SOURCE
106 | #endif
107 | /* Enable general extensions on Solaris. */
108 | #ifndef __EXTENSIONS__
109 | # undef __EXTENSIONS__
110 | #endif
111 |
112 |
113 | /* Version number of package */
114 | #undef VERSION
115 |
116 | /* Define to 1 if on MINIX. */
117 | #undef _MINIX
118 |
119 | /* Define to 2 if the system does not provide POSIX.1 features except with
120 | this defined. */
121 | #undef _POSIX_1_SOURCE
122 |
123 | /* Define to 1 if you need to in order for `stat' and other things to work. */
124 | #undef _POSIX_SOURCE
125 |
--------------------------------------------------------------------------------
/src/ipcam-runtime.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * ipcam-runtime.h
4 | * Copyright (C) 2016 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _IPCAM_RUNTIME_H_
21 | #define _IPCAM_RUNTIME_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 |
33 | #ifdef HAVE_JSONCPP_SUPPORT
34 | #include
35 | #endif
36 |
37 | using namespace Ipcam::Media;
38 |
39 | class RTSPServer;
40 |
41 | class ServerMediaSession;
42 | class ServerMediaSubsession;
43 | class AudioOutputStream;
44 |
45 | namespace DBus
46 | {
47 | class Connection;
48 | class AudioSource;
49 | class AudioEncoder;
50 | class VideoSource;
51 | class VideoEncoder;
52 | }
53 |
54 | typedef ServerMediaSession* RTSPStream;
55 | typedef ServerMediaSubsession* RTSPSubstream;
56 |
57 | class IpcamRuntime
58 | {
59 | public:
60 | IpcamRuntime(std::string config_file, ev::default_loop &loop, RTSPServer *rtspServer, DBus::Connection *conn);
61 | ~IpcamRuntime();
62 |
63 | RTSPStream addRTSPStream(const std::string& path, VideoStreamSource* video, AudioStreamSource* audio);
64 | void addAudioSource(AudioSource* audio_source);
65 | void addAudioEncoder(AudioEncoder* audio_encoder);
66 | void addVideoSource(VideoSource* video_source);
67 | void addVideoEncoder(VideoEncoder* video_encoder);
68 |
69 | void addAudioOutputStream(in_addr addr, uint16_t portNum, AudioStreamSink* sink);
70 |
71 | ev::default_loop &mainloop() { return _loop; }
72 | DBus::Connection &dbus_conn() { return *_dbus_connection; }
73 | #ifdef HAVE_JSONCPP_SUPPORT
74 | Json::Value &config_root() { return _config_root; }
75 | void LoadConfig();
76 | void SaveConfig();
77 | #endif
78 |
79 | private:
80 | ev::default_loop& _loop;
81 | RTSPServer* _rtsp_server;
82 | DBus::Connection* _dbus_connection;
83 | #ifdef HAVE_JSONCPP_SUPPORT
84 | Json::Value _config_root;
85 | std::string _config_name;
86 | bool _config_dirty;
87 | ev::timer _config_timer;
88 | void config_timer_handler(ev::timer& w, int revents);
89 | #endif
90 |
91 | typedef std::list IpcamStreamList;
92 | typedef std::list> IpcamAudioSourceList;
93 | typedef std::list> IpcamAudioEncoderList;
94 | typedef std::list> IpcamVideoSourceList;
95 | typedef std::list> IpcamVideoEncoderList;
96 | typedef std::list> IpcamAudioOutStreamList;
97 |
98 | IpcamStreamList _stream_list;
99 | IpcamAudioSourceList _audio_source_list;
100 | IpcamAudioEncoderList _audio_encoder_list;
101 | IpcamVideoSourceList _video_source_list;
102 | IpcamVideoEncoderList _video_encoder_list;
103 | IpcamAudioOutStreamList _aout_stream_list;
104 | };
105 |
106 | #endif // _IPCAM_RUNTIME_H_
107 |
108 |
--------------------------------------------------------------------------------
/src/dbus/dbus-audio-encoder.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * dbus-audio-encoder.cpp
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifdef HAVE_CONFIG_H
21 | #include
22 | #endif
23 |
24 | #include
25 | #include
26 |
27 | #include "dbus-audio-encoder.h"
28 |
29 | namespace DBus {
30 |
31 | #define AUDIOENCODER_INTERFACE "ipcam.Media.AudioEncoder"
32 |
33 | #define DEFINE_PROP(prop, get, set) \
34 | _prop_handler.emplace(std::piecewise_construct, \
35 | std::forward_as_tuple(prop), \
36 | std::forward_as_tuple(get, set))
37 |
38 | AudioEncoder::AudioEncoder
39 | (IpcamRuntime &runtime, std::string obj_path, Ipcam::Media::AudioEncoder* encoder)
40 | : IpcamBase(runtime, obj_path),
41 | _audio_encoder(encoder)
42 | {
43 | assert(encoder != NULL);
44 |
45 | // Handler of ipcam.Media.AudioEncoder
46 | DEFINE_PROP(AUDIOENCODER_INTERFACE ".Encoding",
47 | [this](DBus::InterfaceAdaptor &interface,
48 | const std::string &property, DBus::Variant &value)
49 | {
50 | value.writer().append_uint32((uint32_t)_audio_encoder->getEncoding());
51 | },
52 | [this](DBus::InterfaceAdaptor &interface,
53 | const std::string &property, const DBus::Variant &value)
54 | {
55 | throw IpcamError("Readonly property");
56 | });
57 | DEFINE_PROP(AUDIOENCODER_INTERFACE ".Bitrate",
58 | [this](DBus::InterfaceAdaptor &interface,
59 | const std::string &property, DBus::Variant &value)
60 | {
61 | value.writer().append_uint32((uint32_t)_audio_encoder->getBitrate());
62 | },
63 | [this](DBus::InterfaceAdaptor &interface,
64 | const std::string &property, const DBus::Variant &value)
65 | {
66 | _audio_encoder->setBitrate((uint32_t)value);
67 | });
68 | DEFINE_PROP(AUDIOENCODER_INTERFACE ".SampleRate",
69 | [this](DBus::InterfaceAdaptor &interface,
70 | const std::string &property, DBus::Variant &value)
71 | {
72 | value.writer().append_uint32((uint32_t)_audio_encoder->getSampleRate());
73 | },
74 | [this](DBus::InterfaceAdaptor &interface,
75 | const std::string &property, const DBus::Variant &value)
76 | {
77 | _audio_encoder->setSampleRate((uint32_t)value);
78 | });
79 | }
80 |
81 | void AudioEncoder::do_property_get
82 | (DBus::InterfaceAdaptor &interface, const std::string &property, DBus::Variant &value)
83 | {
84 | value.clear();
85 |
86 | auto iter = _prop_handler.find(interface.name() + "." + property);
87 | if (iter == _prop_handler.end())
88 | throw DBus::ErrorFailed("Requested interface or property not found");
89 | iter->second.Get(interface, property, value);
90 | }
91 |
92 | void AudioEncoder::do_property_set
93 | (DBus::InterfaceAdaptor &interface, const std::string &property, const DBus::Variant &value)
94 | {
95 | auto iter = _prop_handler.find(interface.name() + "." + property);
96 | if (iter == _prop_handler.end())
97 | throw DBus::ErrorFailed("Requested interface or property not found");
98 | iter->second.Set(interface, property, value);
99 | }
100 |
101 | } //namespace DBus
102 |
--------------------------------------------------------------------------------
/src/common/media-element.cpp:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * media-element.cpp
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #include
21 |
22 | #include "media-element.h"
23 |
24 | namespace Ipcam {
25 | namespace Media {
26 |
27 |
28 | //////////////////////////////////////////////////////////////////////////////
29 | // MediaElement
30 | //////////////////////////////////////////////////////////////////////////////
31 |
32 | MediaElement::MediaElement(MediaElement* source)
33 | : _source(source), _enable_count(0), _flags(0)
34 | {
35 | }
36 |
37 | MediaElement::~MediaElement()
38 | {
39 | }
40 |
41 | void MediaElement::enable()
42 | {
43 | assert(_enable_count >= 0);
44 |
45 | if (_enable_count++ == 0) {
46 | if (_source) {
47 | try {
48 | _source->enable();
49 | }
50 | catch (IpcamError &e) {
51 | _enable_count--;
52 | throw e;
53 | }
54 | }
55 |
56 | try {
57 | doEnableElement();
58 | }
59 | catch (IpcamError &e) {
60 | if (_source) _source->disable();
61 |
62 | _enable_count--;
63 |
64 | throw e;
65 | }
66 | }
67 | }
68 |
69 | void MediaElement::disable()
70 | {
71 | assert(_enable_count > 0);
72 |
73 | if (_enable_count-- == 1) {
74 | doDisableElement();
75 |
76 | if (_source) _source->disable();
77 | }
78 | }
79 |
80 |
81 | //////////////////////////////////////////////////////////////////////////////
82 | // VideoElement
83 | //////////////////////////////////////////////////////////////////////////////
84 |
85 | VideoElement::VideoElement(VideoElement* upstream)
86 | : MediaElement(MEDIA_ELEMENT(upstream))
87 | {
88 | }
89 |
90 | VideoElement::~VideoElement()
91 | {
92 | }
93 |
94 | Resolution VideoElement::resolution()
95 | {
96 | VideoElement* upstream = VIDEO_ELEMENT(source());
97 |
98 | if (upstream == NULL)
99 | throw IpcamError("Not implemented");
100 |
101 | return upstream->resolution();
102 | }
103 |
104 | uint32_t VideoElement::framerate()
105 | {
106 | VideoElement* upstream = VIDEO_ELEMENT(source());
107 |
108 | if (upstream == NULL)
109 | throw IpcamError("Not implemented");
110 |
111 | return upstream->framerate();
112 | }
113 |
114 |
115 | //////////////////////////////////////////////////////////////////////////////
116 | // AudioElement
117 | //////////////////////////////////////////////////////////////////////////////
118 |
119 | AudioElement::AudioElement(AudioElement* source)
120 | : MediaElement(MEDIA_ELEMENT(source))
121 | {
122 | }
123 |
124 | AudioElement::~AudioElement()
125 | {
126 | }
127 |
128 | uint32_t AudioElement::samplerate()
129 | {
130 | AudioElement* upstream = AUDIO_ELEMENT(source());
131 |
132 | if (!upstream)
133 | throw IpcamError("Not implemented");
134 |
135 | return upstream->samplerate();
136 | }
137 |
138 | uint32_t AudioElement::channels()
139 | {
140 | AudioElement* upstream = AUDIO_ELEMENT(source());
141 |
142 | if (!upstream)
143 | throw IpcamError("Not implemented");
144 |
145 | return upstream->channels();
146 | }
147 |
148 | } // namespace Media
149 | } // namespace Ipcam
150 |
--------------------------------------------------------------------------------
/src/platform/hi3516cv300/himpp-ircut.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-ircut.h
4 | * Copyright (C) 2018 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_IRCUT_H_
21 | #define _HIMPP_IRCUT_H_
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | class HimppIrCut;
28 |
29 | #define HIMPP_IRCUT(o) dynamic_cast(o)
30 |
31 | class IODevice
32 | {
33 | public:
34 | enum DIR { IN, OUT };
35 |
36 | IODevice();
37 | IODevice(const char* name, DIR dir);
38 | virtual ~IODevice();
39 |
40 | bool is_open() { return filedesc >= 0; }
41 | int initialize(const char* name, DIR dir);
42 | int setValue(int value);
43 | int getValue(int& value);
44 |
45 | private:
46 | int filedesc;
47 | };
48 |
49 | class HimppIrCut: public HimppVideoElement, public DefaultVideoSource
50 | {
51 | public:
52 | class Imaging : public DefaultVideoSource::Imaging
53 | {
54 | public:
55 | class IrCutFilter : public DefaultVideoSource::Imaging::IrCutFilter
56 | {
57 | public:
58 | IrCutFilter(Imaging& imaging);
59 | virtual ~IrCutFilter();
60 |
61 | IrCutFilterMode getMode();
62 | void setMode(IrCutFilterMode value);
63 | int32_t getThreshold();
64 | void setThreshold(int32_t value);
65 | uint32_t getHysteresis();
66 | void setHysteresis(uint32_t value);
67 | uint32_t getBrightness();
68 | void setBrightness(uint32_t value);
69 | };
70 | public:
71 | Imaging(HimppIrCut& ircut);
72 | ~Imaging();
73 |
74 | // implementation of VideoSource::Imaging
75 | VideoSource::Imaging::IrCutFilter& ircutfilter();
76 | public:
77 | IrCutFilter _ircutfilter;
78 | };
79 | public:
80 | HimppIrCut(HimppVideoElement* source, std::unordered_map params);
81 | virtual ~HimppIrCut();
82 |
83 | // implementation of HimppVideoElement
84 | MPP_CHN_S* bindSource();
85 |
86 | // implementation of VideoSource
87 | VideoSource::Imaging& imaging();
88 |
89 | IrCutFilterMode getMode();
90 | void setMode(IrCutFilterMode value);
91 | int32_t getThreshold();
92 | void setThreshold(int32_t value);
93 | uint32_t getHysteresis();
94 | void setHysteresis(uint32_t value);
95 | uint32_t getBrightness();
96 | void setBrightness(uint32_t value);
97 |
98 | protected:
99 | void doEnableElement();
100 | void doDisableElement();
101 |
102 | private:
103 | void sensor_timer_handler(ev::timer& w, int revents);
104 | void ircut_timer_handler(ev::timer& w, int revents);
105 | void ircut_on();
106 | void ircut_off();
107 |
108 | private:
109 | Imaging _imaging;
110 |
111 | IrCutFilterMode _mode;
112 | int32_t _threshold;
113 | uint32_t _hysteresis;
114 | uint32_t _brightness;
115 | int _debounce_count;
116 | IrCutFilterMode _status;
117 | IODevice _sensor_dev; // Sensor ADC input
118 | IODevice _ircutp_dev; // IRCUT+
119 | IODevice _ircutn_dev; // IRCUT-
120 | IODevice _irleden_dev; // IRLED enable
121 | IODevice _irledbr_dev; // IRLED brightness
122 | ev::timer _sensor_timer;
123 | ev::timer _ircut_timer;
124 | };
125 |
126 | #endif // _HIMPP_IRCUT_H_
127 |
128 |
--------------------------------------------------------------------------------
/src/platform/hi3516ev200/himpp-ircut.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-ircut.h
4 | * Copyright (C) 2018 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_IRCUT_H_
21 | #define _HIMPP_IRCUT_H_
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | class HimppIrCut;
28 |
29 | #define HIMPP_IRCUT(o) dynamic_cast(o)
30 |
31 | class IODevice
32 | {
33 | public:
34 | enum DIR { IN, OUT };
35 |
36 | IODevice();
37 | IODevice(const char* name, DIR dir);
38 | virtual ~IODevice();
39 |
40 | bool is_open() { return filedesc >= 0; }
41 | int initialize(const char* name, DIR dir);
42 | int setValue(int value);
43 | int getValue(int& value);
44 |
45 | private:
46 | int filedesc;
47 | };
48 |
49 | class HimppIrCut: public HimppVideoElement, public DefaultVideoSource
50 | {
51 | public:
52 | class Imaging : public DefaultVideoSource::Imaging
53 | {
54 | public:
55 | class IrCutFilter : public DefaultVideoSource::Imaging::IrCutFilter
56 | {
57 | public:
58 | IrCutFilter(Imaging& imaging);
59 | virtual ~IrCutFilter();
60 |
61 | IrCutFilterMode getMode();
62 | void setMode(IrCutFilterMode value);
63 | int32_t getThreshold();
64 | void setThreshold(int32_t value);
65 | uint32_t getHysteresis();
66 | void setHysteresis(uint32_t value);
67 | uint32_t getBrightness();
68 | void setBrightness(uint32_t value);
69 | };
70 | public:
71 | Imaging(HimppIrCut& ircut);
72 | ~Imaging();
73 |
74 | // implementation of VideoSource::Imaging
75 | VideoSource::Imaging::IrCutFilter& ircutfilter();
76 | public:
77 | IrCutFilter _ircutfilter;
78 | };
79 | public:
80 | HimppIrCut(HimppVideoElement* source, std::unordered_map params);
81 | virtual ~HimppIrCut();
82 |
83 | // implementation of HimppVideoElement
84 | MPP_CHN_S* bindSource();
85 |
86 | // implementation of VideoSource
87 | VideoSource::Imaging& imaging();
88 |
89 | IrCutFilterMode getMode();
90 | void setMode(IrCutFilterMode value);
91 | int32_t getThreshold();
92 | void setThreshold(int32_t value);
93 | uint32_t getHysteresis();
94 | void setHysteresis(uint32_t value);
95 | uint32_t getBrightness();
96 | void setBrightness(uint32_t value);
97 |
98 | protected:
99 | void doEnableElement();
100 | void doDisableElement();
101 |
102 | private:
103 | void sensor_timer_handler(ev::timer& w, int revents);
104 | void ircut_timer_handler(ev::timer& w, int revents);
105 | void ircut_on();
106 | void ircut_off();
107 |
108 | private:
109 | Imaging _imaging;
110 |
111 | IrCutFilterMode _mode;
112 | int32_t _threshold;
113 | uint32_t _hysteresis;
114 | uint32_t _brightness;
115 | int _debounce_count;
116 | IrCutFilterMode _status;
117 | IODevice _sensor_dev; // Sensor ADC input
118 | IODevice _ircutp_dev; // IRCUT+
119 | IODevice _ircutn_dev; // IRCUT-
120 | IODevice _irleden_dev; // IRLED enable
121 | IODevice _irledbr_dev; // IRLED brightness
122 | ev::timer _sensor_timer;
123 | ev::timer _ircut_timer;
124 | };
125 |
126 | #endif // _HIMPP_IRCUT_H_
127 |
128 |
--------------------------------------------------------------------------------
/src/platform/hi3518v200/himpp-ircut.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * himpp-ircut.h
4 | * Copyright (C) 2018 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _HIMPP_IRCUT_H_
21 | #define _HIMPP_IRCUT_H_
22 |
23 | #include
24 | #include
25 | #include
26 |
27 | class HimppIrCut;
28 |
29 | #define HIMPP_IRCUT(o) dynamic_cast(o)
30 |
31 | class IODevice
32 | {
33 | public:
34 | enum DIR { IN, OUT };
35 |
36 | IODevice();
37 | IODevice(const char* name, DIR dir);
38 | virtual ~IODevice();
39 |
40 | bool is_open() { return filedesc >= 0; }
41 | int initialize(const char* name, DIR dir);
42 | int setValue(int value);
43 | int getValue(int& value);
44 |
45 | private:
46 | int filedesc;
47 | };
48 |
49 | class HimppIrCut: public HimppVideoElement, public DefaultVideoSource
50 | {
51 | public:
52 | class Imaging : public DefaultVideoSource::Imaging
53 | {
54 | public:
55 | class IrCutFilter : public DefaultVideoSource::Imaging::IrCutFilter
56 | {
57 | public:
58 | IrCutFilter(Imaging& imaging);
59 | virtual ~IrCutFilter();
60 |
61 | IrCutFilterMode getMode();
62 | void setMode(IrCutFilterMode value);
63 | int32_t getThreshold();
64 | void setThreshold(int32_t value);
65 | uint32_t getHysteresis();
66 | void setHysteresis(uint32_t value);
67 | uint32_t getBrightness();
68 | void setBrightness(uint32_t value);
69 | };
70 | public:
71 | Imaging(HimppIrCut& ircut);
72 | ~Imaging();
73 |
74 | // implementation of VideoSource::Imaging
75 | VideoSource::Imaging::IrCutFilter& ircutfilter();
76 | public:
77 | IrCutFilter _ircutfilter;
78 | };
79 | public:
80 | HimppIrCut(HimppVideoElement* source, std::unordered_map params);
81 | virtual ~HimppIrCut();
82 |
83 | // implementation of HimppVideoElement
84 | MPP_CHN_S* bindSource();
85 |
86 | // implementation of VideoSource
87 | VideoSource::Imaging& imaging();
88 |
89 | IrCutFilterMode getMode();
90 | void setMode(IrCutFilterMode value);
91 | int32_t getThreshold();
92 | void setThreshold(int32_t value);
93 | uint32_t getHysteresis();
94 | void setHysteresis(uint32_t value);
95 | uint32_t getBrightness();
96 | void setBrightness(uint32_t value);
97 |
98 | protected:
99 | void doEnableElement();
100 | void doDisableElement();
101 |
102 | private:
103 | void sensor_timer_handler(ev::timer& w, int revents);
104 | void ircut_timer_handler(ev::timer& w, int revents);
105 | void ircut_on();
106 | void ircut_off();
107 |
108 | private:
109 | Imaging _imaging;
110 |
111 | IrCutFilterMode _mode;
112 | int32_t _threshold;
113 | uint32_t _hysteresis;
114 | uint32_t _brightness;
115 | int _debounce_count;
116 | IrCutFilterMode _status;
117 | IODevice _sensor_dev; // Sensor ADC input
118 | IODevice _ircutp_dev; // IRCUT+
119 | IODevice _ircutn_dev; // IRCUT-
120 | IODevice _irleden_dev; // IRLED enable
121 | IODevice _irledbr_dev; // IRLED brightness
122 | ev::timer _sensor_timer;
123 | ev::timer _ircut_timer;
124 | };
125 |
126 | #endif // _HIMPP_IRCUT_H_
127 |
128 |
--------------------------------------------------------------------------------
/src/common/video-encoder.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * video-encoder.h
4 | * Copyright (C) 2017 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef _VIDEO_ENCODER_H_
21 | #define _VIDEO_ENCODER_H_
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | namespace Ipcam {
29 | namespace Media {
30 |
31 | enum RateCtrlMode { CBR, VBR, FIXQP };
32 | enum H264Profile { BASELINE, MAIN, HIGH, SVC_T };
33 |
34 | class VideoEncoder;
35 | class H264VideoEncoder;
36 | class JPEGVideoEncoder;
37 |
38 | #define VIDEO_ENCODER(o) dynamic_cast(o)
39 | #define H264_VIDEO_ENCODER(o) dynamic_cast(o)
40 | #define JPEG_VIDEO_ENCODER(o) dynamic_cast(o)
41 |
42 | // control interface for video encoder
43 | class VideoEncoder
44 | {
45 | public:
46 | virtual ~VideoEncoder();
47 |
48 | virtual VideoEncodingType getEncoding();
49 | virtual Resolution getResolution();
50 | virtual void setResolution(Resolution value);
51 | virtual uint32_t getFramerate();
52 | virtual void setFramerate(uint32_t value);
53 | virtual RateCtrlMode getRcMode();
54 | virtual void setRcMode(RateCtrlMode value);
55 | virtual uint32_t getBitrate();
56 | virtual void setBitrate(uint32_t value);
57 |
58 | virtual VideoOSD* CreateOSD();
59 | virtual void DeleteOSD(VideoOSD* osd);
60 |
61 | protected:
62 | VideoEncoder();
63 | };
64 |
65 | class H264VideoEncoder : public virtual VideoEncoder
66 | {
67 | public:
68 | struct FrameRefMode {
69 | uint32_t Base;
70 | uint32_t Enhanced;
71 | bool EnablePred;
72 | FrameRefMode(uint32_t base, uint32_t enhanced, bool enablepred)
73 | : Base(base), Enhanced(enhanced), EnablePred(enablepred) {}
74 | };
75 | struct IntraRefreshParam {
76 | bool EnableRefresh;
77 | bool EnableISlice;
78 | uint32_t RefreshLineNum;
79 | uint32_t ReqIQp;
80 | IntraRefreshParam(bool refresh_en, bool islice_en, uint32_t linenum, uint32_t reqiqp)
81 | : EnableRefresh(refresh_en), EnableISlice(islice_en), RefreshLineNum(linenum), ReqIQp(reqiqp) {}
82 | };
83 | public:
84 | virtual ~H264VideoEncoder();
85 |
86 | virtual H264Profile getH264Profile();
87 | virtual void setH264Profile(H264Profile value);
88 | virtual uint32_t getGovLength();
89 | virtual void setGovLength(uint32_t value);
90 | virtual uint32_t getMinQP();
91 | virtual void setMinQP(uint32_t value);
92 | virtual uint32_t getMaxQP();
93 | virtual void setMaxQP(uint32_t value);
94 |
95 | virtual void setFrameRefMode(FrameRefMode value);
96 | virtual FrameRefMode getFrameRefMode();
97 | virtual void setIntraRefresh(IntraRefreshParam value);
98 | virtual IntraRefreshParam getIntraRefresh();
99 |
100 | protected:
101 | H264VideoEncoder();
102 | };
103 |
104 | class JPEGVideoEncoder : virtual public VideoEncoder
105 | {
106 | public:
107 | virtual ~JPEGVideoEncoder();
108 |
109 | protected:
110 | JPEGVideoEncoder();
111 | };
112 |
113 | } // namespace Media
114 | } // namespace Ipcam
115 |
116 | #endif // _VIDEO_ENCODER_H_
117 |
118 |
--------------------------------------------------------------------------------
/src/dbus/video-source-introspect.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/src/rtsp-server/EvUsageEnvironment.h:
--------------------------------------------------------------------------------
1 | /* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 4; tab-width: 4 -*- */
2 | /*
3 | * EvUsageEnvironment.h
4 | * Copyright (C) 2015 Watson Xu
5 | *
6 | * live-streamer is free software: you can redistribute it and/or modify it
7 | * under the terms of the GNU General Public License as published by the
8 | * Free Software Foundation, either version 3 of the License, or
9 | * (at your option) any later version.
10 | *
11 | * live-streamer is distributed in the hope that it will be useful, but
12 | * WITHOUT ANY WARRANTY; without even the implied warranty of
13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14 | * See the GNU General Public License for more details.
15 | *
16 | * You should have received a copy of the GNU General Public License along
17 | * with this program. If not, see .
18 | */
19 |
20 | #ifndef __EV_USAGE_ENVIRONMENT_H__
21 | #define __EV_USAGE_ENVIRONMENT_H__
22 |
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 | #include
29 |
30 | class EvTaskScheduler: public TaskScheduler
31 | {
32 | public:
33 | static EvTaskScheduler* createNew(ev::default_loop& loop);
34 | virtual ~EvTaskScheduler();
35 | virtual TaskToken scheduleDelayedTask(int64_t microseconds, TaskFunc* proc,
36 | void* clientData);
37 | virtual void unscheduleDelayedTask(TaskToken& prevTask);
38 | virtual void setBackgroundHandling(int socketNum, int conditionSet,
39 | BackgroundHandlerProc* handlerProc,
40 | void* clientData);
41 | virtual void moveSocketHandling(int oldSocketNum, int newSocketNum);
42 | virtual void doEventLoop(char volatile* watchVariable = NULL);
43 | virtual EventTriggerId createEventTrigger(TaskFunc* eventHandlerProc);
44 | virtual void deleteEventTrigger(EventTriggerId eventTriggerId);
45 | virtual void triggerEvent(EventTriggerId eventTriggerId, void* clientData = NULL);
46 | virtual void internalError();
47 |
48 | protected:
49 | EvTaskScheduler(ev::default_loop& loop);
50 |
51 | private:
52 | struct DelayedTask : public ev::timer
53 | {
54 | DelayedTask(ev::loop_ref& loop, uint64_t usec, TaskFunc* proc, void* data);
55 | TaskToken token() { return (TaskToken)fToken; }
56 |
57 | TaskFunc* fCallback;
58 | void* fData;
59 | long fToken;
60 | static long tokenCounter;
61 | };
62 | struct BackgroundHandling : public ev::io
63 | {
64 | BackgroundHandling(ev::loop_ref& loop, int fd, int events,
65 | BackgroundHandlerProc* proc, void* data);
66 |
67 | BackgroundHandlerProc* fCallback;
68 | void* fData;
69 | };
70 | struct EventTrigger : public ev::async
71 | {
72 | EventTrigger(ev::loop_ref& loop, TaskFunc* proc);
73 |
74 | void setClientData(void* clientData) { fData = clientData; }
75 | EventTriggerId triggerId() { return (EventTriggerId)fTriggerId; }
76 |
77 | TaskFunc* fCallback;
78 | void* fData;
79 | uint32_t fTriggerId;
80 | static uint32_t triggerCounter;
81 | };
82 |
83 | void delayed_task_thunk(ev::timer& w, int revents);
84 | void background_handling_thunk(ev::io& w, int revents);
85 | void event_trigger_thunk(ev::async& w, int revents);
86 |
87 | typedef std::unique_ptr DelayedTaskPtr;
88 | typedef std::unique_ptr BackgroundHandlingPtr;
89 | typedef std::unique_ptr