From cdbc3babf6a30b056583b9c90b62ca09d9929c3c Mon Sep 17 00:00:00 2001 From: Maxim Lihachev Date: Fri, 12 Aug 2016 16:47:22 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=B4=D0=BE=D0=BA=D1=83=D0=BC=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D1=86=D0=B8=D1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/masterindex.html | 9 ++- doc/robo_files.html | 5 +- doc/robo_functions.html | 4 +- doc/robo_sourcefiles.html | 9 ++- doc/robo_variables.html | 2 +- doc/streamproxy.html | 152 ++++++++++++++++++++++++++++++++++ doc/streamsaver.html | 202 ++++++++++++++++++++++++---------------------- doc/tobo_toplevel.html | 5 +- doc/toc_index.html | 8 +- 9 files changed, 290 insertions(+), 106 deletions(-) create mode 100644 doc/streamproxy.html diff --git a/doc/masterindex.html b/doc/masterindex.html index d33b8f4..f985d99 100644 --- a/doc/masterindex.html +++ b/doc/masterindex.html @@ -30,17 +30,22 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

C

config

E

enableOption -

M

main +

M

main +main makeCMD +

P

proxyCMD

R

readOption +readXML readXML

S

SETTINGS +streamproxy +streamproxy streamsaver streamsaver

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/robo_files.html b/doc/robo_files.html index e0cbcb1..6b38509 100644 --- a/doc/robo_files.html +++ b/doc/robo_files.html @@ -28,11 +28,12 @@

Files

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

-

S

streamsaver +

S

streamproxy +streamsaver

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/robo_functions.html b/doc/robo_functions.html index 7d85459..bc47288 100644 --- a/doc/robo_functions.html +++ b/doc/robo_functions.html @@ -30,12 +30,14 @@

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

E

enableOption

M

makeCMD +

P

proxyCMD

R

readOption +readXML readXML

A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

diff --git a/doc/robo_sourcefiles.html b/doc/robo_sourcefiles.html index 914f22c..e7505b2 100644 --- a/doc/robo_sourcefiles.html +++ b/doc/robo_sourcefiles.html @@ -30,10 +30,17 @@
  • ./ @@ -41,7 +48,7 @@ streamsaver
  • diff --git a/doc/robo_variables.html b/doc/robo_variables.html index a2c730e..b4035b9 100644 --- a/doc/robo_variables.html +++ b/doc/robo_variables.html @@ -33,7 +33,7 @@

    A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

    diff --git a/doc/streamproxy.html b/doc/streamproxy.html new file mode 100644 index 0000000..48877bd --- /dev/null +++ b/doc/streamproxy.html @@ -0,0 +1,152 @@ + + + + + + + +./streamproxy + + + + + + +
    +
    + +

    ffmpeg/streamproxy [ Files ]

    + +

    [ Top ] [ Files ]

    +

    NAME

    +
        streamproxy - проксирование аудиопотока на Icecast
    +
    +

    VERSION

    +
        1.0
    +
    +

    DESCRIPTION

    +

    Сценарий принимает аудиопоток с оборудования, по UDP или TCP, + и ретранслирует поток на сервер радиовещания icecast для + получения сигнала другими программами и прослушивания аудио конечным + пользователем. +

    + +

    Проксирование будет доступно только при задании в файле настроек опции + <proxy>1</proxy> +

    + +

    +

    USAGE

    +
        streamproxy <файл настроек>
    +
    +

    ARGUMENTS

    + +

    + +
    + +

    streamproxy/readXML [ Functions ]

    + +

    [ Top ] [ streamproxy ] [ Functions ]

    +

    NAME

    +
        readXML - получение значения опции из файла настроек
    +
    +

    USAGE

    +
        readXML <опция> <файл>
    +
    +

    ARGUMENTS

    + +

    +

    RESULT

    +
        Значение параметра при наличии искомой опции в xml-файле или значение по
    +    умолчанию, которое задаётся при инициализации переменной config.
    +
    +

    SOURCE

    +
    72 readXML() {
    +73         \grep -oPm1 "(?<=<$1>)[^<]+" "$2"
    +74 }
    +
    + +
    + +

    streamproxy/proxyCMD [ Functions ]

    + +

    [ Top ] [ streamproxy ] [ Functions ]

    +

    NAME

    +
        proxyCMD - создание команды для передачи аудиопотока
    +
    +

    DESCRIPTION

    +

    Процедура составляет команду ffmpeg на основе конфигурационного файла +

    +

    RESULT

    +
        Команда ffmpeg, которую можно передать на выполнение.
    +
    +

    SOURCE

    +
     90 proxyCMD() {
    + 91         STREAM=$(readXML stream "$XML")
    + 92         ICECAST="$(readXML icecast $XML)/$(readXML mountpoint $XML)"
    + 93         ICENAME="$(readXML channel_name $XML)"
    + 94         ICEDESC="$(readXML channel_descr $XML)"
    + 95         FORMAT="$(readXML input_format $XML)"
    + 96 
    + 97         echo ffmpeg -i "$STREAM" \
    + 98                 -fi "$FORMAT" \
    + 99                 -legacy_icecast 1 \
    +100                 -content_type audio/mpeg \
    +101                 -ice_name "$ICENAME" \
    +102                 -ice_description "$ICEDESC" \
    +103                 icecast://source:$ICECAST
    +104 }
    +
    + +
    + +

    streamproxy/main [ Toplevel ]

    + +

    [ Top ] [ streamproxy ] [ Toplevel ]

    +

    NAME

    +
        streamproxy
    +
    +

    SOURCE

    +
    115 #Проверка аргументов
    +116 if [ -z $1 ]; then
    +117         echo "USAGE: $0 <xml>"
    +118         exit 1
    +119 fi
    +120 
    +121 #Файл настроек
    +122 XML="$1"
    +123 
    +124 #Проверка использования прокси
    +125 PROXY=$(readXML proxy "$XML")
    +126 
    +127 if [ "$PROXY" == 1 ]; then
    +128         proxyCMD
    +129 fi
    +
    + +
    + + + diff --git a/doc/streamsaver.html b/doc/streamsaver.html index 6055e8d..fa13ec6 100644 --- a/doc/streamsaver.html +++ b/doc/streamsaver.html @@ -229,55 +229,57 @@ 181 # enableOption output_format -c %% 182 183 #ICECAST -184 enableOption input_channel -map %% -185 enableOption audio_bitrate -ab %% -186 enableOption channel_name \ -187 -legacy_icecast 1 \ -188 -content_type audio/mpeg \ -189 -ice_name %% -190 -191 enableOption channel_descr \ -192 -ice_description %% -193 -194 enableOption icecast \ -195 icecast://source:${config[password]}@${config[icecast]}/${config[mountpoint]} -196 -197 # АРХИВ -198 enableOption input_channel -map %% -199 enableOption archive_log \ -200 -segment_list %% \ -201 -segment_list_entry_prefix "${config[archive_dir]}" \ -202 -segment_list_type csv \ -203 -segment_list_flags live -204 -205 # +СЕГМЕНТИРОВАНИЕ -206 enableOption archive_dir \ -207 -segment_atclocktime 1 \ -208 -acodec "${config[output_format]}" \ -209 -fi segment \ -210 -segment_time "${config[archive_time]}" \ -211 -segment_format "${config[output_format]}" \ -212 -strftime 1 "${config[archive_dir]}/$FILE_NAME" -213 -214 # АНАЛИЗ -215 enableOption input_channel -map %% -216 enableOption slices_log \ -217 -segment_list %% \ -218 -segment_list_entry_prefix "${config[slices_dir]}" \ -219 -segment_list_type csv \ -220 -segment_list_flags live -221 -222 # +СЕГМЕНТИРОВАНИЕ -223 enableOption slices_dir \ -224 -segment_atclocktime 1 \ -225 -acodec "${config[output_format]}" \ -226 -fi segment \ -227 -segment_time "${config[slices_time]}" \ -228 -segment_format "${config[output_format]}" \ -229 -strftime 1 "${config[slices_dir]}/$FILE_NAME" -230 -231 echo "$CMD" -232 } +184 if [ ! -z ${config[icecast]} ]; then +185 enableOption input_channel -map %% +186 enableOption audio_bitrate -ab %% +187 enableOption channel_name \ +188 -legacy_icecast 1 \ +189 -content_type audio/mpeg \ +190 -ice_name %% +191 +192 enableOption channel_descr \ +193 -ice_description %% +194 +195 enableOption icecast \ +196 icecast://source:${config[password]}@${config[icecast]}/${config[mountpoint]} +197 fi +198 +199 # АРХИВ +200 enableOption input_channel -map %% +201 enableOption archive_log \ +202 -segment_list %% \ +203 -segment_list_entry_prefix "${config[archive_dir]}" \ +204 -segment_list_type csv \ +205 -segment_list_flags live +206 +207 # +СЕГМЕНТИРОВАНИЕ +208 enableOption archive_dir \ +209 -segment_atclocktime 1 \ +210 -acodec "${config[output_format]}" \ +211 -fi segment \ +212 -segment_time "${config[archive_time]}" \ +213 -segment_format "${config[output_format]}" \ +214 -strftime 1 "${config[archive_dir]}/$FILE_NAME" +215 +216 # АНАЛИЗ +217 enableOption input_channel -map %% +218 enableOption slices_log \ +219 -segment_list %% \ +220 -segment_list_entry_prefix "${config[slices_dir]}" \ +221 -segment_list_type csv \ +222 -segment_list_flags live +223 +224 # +СЕГМЕНТИРОВАНИЕ +225 enableOption slices_dir \ +226 -segment_atclocktime 1 \ +227 -acodec "${config[output_format]}" \ +228 -fi segment \ +229 -segment_time "${config[slices_time]}" \ +230 -segment_format "${config[output_format]}" \ +231 -strftime 1 "${config[slices_dir]}/$FILE_NAME" +232 +233 echo "$CMD" +234 }
    @@ -290,33 +292,34 @@ Настройки описаны в секции SETTINGS.

    USED BY

    -
        enableOption, readOption, readXML, makeCMD
    +
        enableOption, readOption, readXML, makeCMD
     

    SOURCE

    -
    248 typeset -A config
    -249 
    -250 config=(
    -251         [stream]=""
    -252         [icecast]=""
    -253         [password]=""
    -254         [channel_name]=""
    -255         [channel_number]=""
    -256         [channel_descr]=""
    -257         [mountpoint]=""
    -258         [cmd]="ffmpeg"
    -259         [input_format]="mpegts"
    -260         [input_channel]=""
    -261         [archive_dir]=""
    -262         [archive_time]=""
    -263         [archive_log]=""
    -264         [slices_dir]=""
    -265         [slices_time]=""
    -266         [slices_log]=""
    -267         [filename_prefix]="%Y-%m-%d_%H:%M:%S"
    -268         [filename_suffix]="mp2"
    -269         [output_format]="mp2"
    -270         [audio_bitrate]="256k"
    -271 )
    +
    250 typeset -A config
    +251 
    +252 config=(
    +253         [proxy]="0"
    +254         [stream]=""
    +255         [icecast]=""
    +256         [password]=""
    +257         [channel_name]=""
    +258         [channel_number]=""
    +259         [channel_descr]=""
    +260         [mountpoint]=""
    +261         [cmd]="ffmpeg"
    +262         [input_format]=""
    +263         [input_channel]=""
    +264         [archive_dir]=""
    +265         [archive_time]=""
    +266         [archive_log]=""
    +267         [slices_dir]=""
    +268         [slices_time]=""
    +269         [slices_log]=""
    +270         [filename_prefix]="%Y-%m-%d_%H:%M:%S"
    +271         [filename_suffix]="mp3"
    +272         [output_format]="mp3"
    +273         [audio_bitrate]="256k"
    +274 )
     

    @@ -395,11 +398,13 @@ <output_format>mp2</output_format> <!-- Битрейт аудиофайлов --> <audio_bitrate>256k</audio_bitrate> + <!-- Использование streamproxy --> + <proxy>1</proxy> </xml>

    SOURCE

    -
    337 SETTINGS="$1"
    +
    342 SETTINGS="$1"
     

    @@ -408,33 +413,38 @@

    [ Top ] [ streamsaver ] [ Toplevel ]

    NAME

    -
        streamsaver
    +
        streamsaver
     

    SOURCE

    -
    348 #Проверка на наличие файла настроек
    -349 if [ -z "$SETTINGS" ]; then
    -350         echo "USAGE: $(basename $0) <settings.xml>" >&2
    -351         exit 1
    -352 elif [ ! -r "$SETTINGS" ]; then
    -353         echo "Unable open file $1." >&2
    -354         echo "USAGE: $(basename $0) <settings.xml>" >&2
    -355         exit 1
    -356 fi
    -357 
    -358 #Чтение настроек
    -359 readXML "$SETTINGS"
    -360 
    -361 #Создание директорий хранения файлов, если требуется
    -362 mkdir -p ${config[archive_dir]}
    -363 mkdir -p ${config[slices_dir]}
    -364 
    -365 #Создание команды оцифровки сигнала
    -366 makeCMD
    +
    353 #Проверка на наличие файла настроек
    +354 if [ -z "$SETTINGS" ]; then
    +355         echo "USAGE: $(basename $0) <settings.xml>" >&2
    +356         exit 1
    +357 elif [ ! -r "$SETTINGS" ]; then
    +358         echo "Unable open file $1." >&2
    +359         echo "USAGE: $(basename $0) <settings.xml>" >&2
    +360         exit 1
    +361 fi
    +362 
    +363 #Чтение настроек
    +364 readXML "$SETTINGS"
    +365 
    +366 #Создание директорий хранения файлов, если требуется
    +367 mkdir -p ${config[archive_dir]}
    +368 mkdir -p ${config[slices_dir]}
    +369 
    +370 if [ ${config[proxy]} == 1 ]; then
    +371         config[stream]="${config[icecast]}/${config[mountpoint]}"
    +372         config[icecast]=""
    +373 fi
    +374 
    +375 #Создание команды оцифровки сигнала
    +376 makeCMD | sh
     
    diff --git a/doc/tobo_toplevel.html b/doc/tobo_toplevel.html index 4666c5d..d909784 100644 --- a/doc/tobo_toplevel.html +++ b/doc/tobo_toplevel.html @@ -28,11 +28,12 @@

    Toplevel

    A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

    -

    M

    main +

    M

    main +main

    A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z - 0 - 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 - 9

    diff --git a/doc/toc_index.html b/doc/toc_index.html index b924b5c..86d80c6 100644 --- a/doc/toc_index.html +++ b/doc/toc_index.html @@ -38,10 +38,16 @@
  • 1.6. streamsaver/SETTINGS
  • 1.7. streamsaver/main
  • +
  • 2. ffmpeg/streamproxy
  • +