SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
ENDFOREACH(flag)
-SET(CMAKE_C_FLAGS "-I./include -I./include/headers ${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS} -fPIC -Wall")
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g")
IF("${ARCH}" STREQUAL "arm")
ENDIF("${ARCH}" STREQUAL "arm")
ADD_DEFINITIONS("-DPREFIX=\"${CMAKE_INSTALL_PREFIX}\"")
-ADD_DEFINITIONS("-DTIZEN_DEBUG")
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--as-needed -Wl,--rpath=${LIB_INSTALL_DIR}")
--- /dev/null
+[general]
+; generating dot file representing pipeline state
+generate dot = no
+use decodebin = yes
+dot dir = /tmp
+
+
+[sources]
+
+audio_source = pulsesrc
+camera_source = v4l2src
+video_source = ximagesrc
+udp_source = udpsrc
+
+
+[sinks]
+audio_sink = pulsesink
+video_sink = waylandsink
+evas_sink = evaspixmapsink
+udp_sink = udpsink
+
+
+[h263]
+encoder = avenc_h263
+decoder = avdec_h263
+rtppay = rtph263pay
+rtpdepay = rtph263depay
+parser = h263parse
+
+
+[h264]
+encoder = avenc_h264
+decoder = avdec_h264
+rtppay = rtph264pay
+rtpdepay = rtph264depay
+parser = h264parse
+
+
+[audio-raw]
+rtppay = rtpL16pay
+rtpdepay = rtpL16depay
#define MS_TIME_NONE ((int)-1)
/* Ini Utils */
-#define MEDIA_STREAMER_INI_DEFAULT_PATH "/usr/etc/media_streamer.ini"
+#ifndef MEDIA_STREAMER_INI_PATH
+ #define MEDIA_STREAMER_INI_PATH "/etc/media_streamer.ini"
+#endif
+
#define MEDIA_STREAMER_INI_MAX_STRLEN 100
/**
}
#define MEDIA_STREAMER_DEFAULT_DOT_DIR "/tmp"
-#define MEDIA_STREAMER_DEFAULT_INI "\
-[general] \n\
-; generating dot file representing pipeline state \n\
-generate dot = no \n\
-use decodebin = yes \n\
-dot dir = /tmp \n\
-\n\
-\n\
-[sources] \n\
-\n\
-audio_source = "DEFAULT_AUDIO_SOURCE" \n\
-camera_source = "DEFAULT_CAMERA_SOURCE" \n\
-video_source = "DEFAULT_VIDEO_SOURCE" \n\
-udp_source = "DEFAULT_UDP_SOURCE" \n\
-\n\
-\n\
-[sinks] \n\
-\n\
-audio_sink = "DEFAULT_AUDIO_SINK" \n\
-video_sink = "DEFAULT_VIDEO_SINK" \n\
-evas_sink = "DEFAULT_EVAS_SINK" \n\
-udp_sink = "DEFAULT_UDP_SINK" \n\
-\n\
-\n\
-[h263] \n\
-\n\
-encoder = avenc_h263 \n\
-decoder = avdec_h263 \n\
-rtppay = rtph263pay \n\
-rtpdepay = rtph263depay \n\
-parser = h263parse \n\
-\n\
-\n\
-[h264] \n\
-\n\
-encoder = omxh264enc \n\
-decoder = avdec_h264 \n\
-rtppay = rtph264pay \n\
-rtpdepay = rtph264depay \n\
-parser = h264parse \n\
-\n\
-\n\
-[audio-raw] \n\
-\n\
-encoder = \n\
-decoder = \n\
-rtppay = rtpL16pay \n\
-rtpdepay = rtpL16depay \n\
-\n\
-"
/**
* @brief Loads media streamer settings from ini file.
%setup -q
cp %{SOURCE1001} .
+%define ini_path /usr/etc/media_streamer.ini
+
%build
+flags="-DMEDIA_STREAMER_INI_PATH=\\\"%{ini_path}\\\""
+
%if 0%{?sec_build_binary_debug_enable}
-export CFLAGS="$CFLAGS -DTIZEN_DEBUG_ENABLE"
-export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
-export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
+flags="$flags -DTIZEN_DEBUG_ENABLE"
%endif
+
+export CFLAGS="$CFLAGS $flags"
+export CXXFLAGS="$CXXFLAGS $flags"
+export FFLAGS="$FFLAGS $flags"
+
MAJORVER=`echo %{version} | awk 'BEGIN {FS="."}{print $1}'`
%cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
cp LICENSE.APLv2 %{buildroot}%{_datadir}/license/%{name}
cp test/media_streamer_test %{buildroot}/usr/bin
+mkdir -p %{buildroot}/usr/etc
+cp -rf config/media_streamer.ini %{buildroot}%{ini_path}
+
%make_install
%post
/sbin/ldconfig
+chsmack -a "_" %{ini_path}
%postun -p /sbin/ldconfig
%{_libdir}/libcapi-media-streamer.so.*
%{_datadir}/license/%{name}
%{_bindir}/*
+%config %{ini_path}
%files devel
%manifest %{name}.manifest
%{_libdir}/pkgconfig/*.pc
%{_libdir}/libcapi-media-streamer.so
-
#include <media_streamer.h>
#include <media_streamer_util.h>
-#ifdef MEDIA_STREAMER_DEFAULT_INI
-static gboolean __ms_generate_default_ini(void);
-#endif
-
static void __ms_check_ini_status(void);
gchar *__ms_ini_get_string(dictionary * dict, const char *ini_path, char *default_str)
dictionary *ms_dict = NULL;
/* loading existing ini file */
- ms_dict = iniparser_load(MEDIA_STREAMER_INI_DEFAULT_PATH);
+ ms_dict = iniparser_load(MEDIA_STREAMER_INI_PATH);
/* if no file exists. create one with set of default values */
if (!ms_dict) {
-#ifdef MEDIA_STREAMER_DEFAULT_INI
- ms_debug("No inifile found. Media streamer will create default inifile.");
- if (FALSE == __ms_generate_default_ini()) {
- ms_debug("Creating default .ini file failed. Media-streamer will use default values.");
- } else {
- /* load default ini */
- ms_dict = iniparser_load(MEDIA_STREAMER_INI_DEFAULT_PATH);
- }
-#else
- ms_debug("No ini file found.");
+ ms_debug("Could not open ini [%s]. Media-streamer will use default values.", MEDIA_STREAMER_INI_PATH);
return FALSE;
-#endif
+ } else {
+ ms_debug("Open ini file [%s].", MEDIA_STREAMER_INI_PATH);
}
*dict = ms_dict;
ini->use_decodebin = iniparser_getboolean(dict, "general:use decodebin", DEFAULT_USE_DECODEBIN);
} else {
/* if dict is not available just fill the structure with default values */
- ms_debug("failed to load ini. using hardcoded default");
-
- /* general settings */
ini->generate_dot = DEFAULT_GENERATE_DOT;
ini->use_decodebin = DEFAULT_USE_DECODEBIN;
}
static void __ms_check_ini_status(void)
{
- FILE *fp = fopen(MEDIA_STREAMER_INI_DEFAULT_PATH, "r");
+ FILE *fp = fopen(MEDIA_STREAMER_INI_PATH, "r");
int file_size = 0;
int status = 0;
fclose(fp);
if (file_size < 5) {
ms_debug("media_streamer.ini file size=%d, Corrupted! Removed", file_size);
- status = g_remove(MEDIA_STREAMER_INI_DEFAULT_PATH);
+ status = g_remove(MEDIA_STREAMER_INI_PATH);
if (status == -1)
ms_error("failed to delete corrupted ini");
}
}
}
-#ifdef MEDIA_STREAMER_DEFAULT_INI
-static gboolean __ms_generate_default_ini(void)
-{
- FILE *fp = NULL;
- gchar *default_ini = MEDIA_STREAMER_DEFAULT_INI;
-
- /* create new file */
- fp = fopen(MEDIA_STREAMER_INI_DEFAULT_PATH, "wt");
-
- if (!fp)
- return FALSE;
-
- /* writing default ini file */
- if (strlen(default_ini) != fwrite(default_ini, 1, strlen(default_ini), fp)) {
- fclose(fp);
- return FALSE;
- }
-
- fclose(fp);
- return TRUE;
-}
-#endif
-
const gchar *__ms_convert_mime_to_string(media_format_mimetype_e mime)
{
switch (mime) {