mirror of
https://github.com/pikvm/ustreamer.git
synced 2026-02-27 12:16:31 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6304959f4 | ||
|
|
57bc6e160d | ||
|
|
03dd5dfebb | ||
|
|
00ef8928b3 |
@@ -1,7 +1,7 @@
|
|||||||
[bumpversion]
|
[bumpversion]
|
||||||
commit = True
|
commit = True
|
||||||
tag = True
|
tag = True
|
||||||
current_version = 1.7
|
current_version = 1.9
|
||||||
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
|
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
|
||||||
serialize =
|
serialize =
|
||||||
{major}.{minor}
|
{major}.{minor}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
|
|
||||||
|
|
||||||
pkgname=ustreamer
|
pkgname=ustreamer
|
||||||
pkgver=1.7
|
pkgver=1.9
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
|
||||||
url="https://github.com/pikvm/ustreamer"
|
url="https://github.com/pikvm/ustreamer"
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=ustreamer
|
PKG_NAME:=ustreamer
|
||||||
PKG_VERSION:=1.7
|
PKG_VERSION:=1.9
|
||||||
PKG_RELEASE:=1
|
PKG_RELEASE:=1
|
||||||
PKG_MAINTAINER:=Maxim Devaev <mdevaev@gmail.com>
|
PKG_MAINTAINER:=Maxim Devaev <mdevaev@gmail.com>
|
||||||
|
|
||||||
|
|||||||
@@ -23,5 +23,5 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#ifndef VERSION
|
#ifndef VERSION
|
||||||
# define VERSION "1.7"
|
# define VERSION "1.9"
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ static void _install_signal_handlers(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
struct options_t *options;
|
||||||
struct device_t *dev;
|
struct device_t *dev;
|
||||||
struct encoder_t *encoder;
|
struct encoder_t *encoder;
|
||||||
struct stream_t *stream;
|
struct stream_t *stream;
|
||||||
@@ -105,8 +106,8 @@ int main(int argc, char *argv[]) {
|
|||||||
int exit_code = 0;
|
int exit_code = 0;
|
||||||
|
|
||||||
LOGGING_INIT;
|
LOGGING_INIT;
|
||||||
|
|
||||||
A_THREAD_RENAME("main");
|
A_THREAD_RENAME("main");
|
||||||
|
options = options_init(argc, argv);
|
||||||
|
|
||||||
# ifdef WITH_GPIO
|
# ifdef WITH_GPIO
|
||||||
GPIO_INIT;
|
GPIO_INIT;
|
||||||
@@ -117,7 +118,7 @@ int main(int argc, char *argv[]) {
|
|||||||
stream = stream_init(dev, encoder);
|
stream = stream_init(dev, encoder);
|
||||||
server = http_server_init(stream);
|
server = http_server_init(stream);
|
||||||
|
|
||||||
if ((exit_code = parse_options(argc, argv, dev, encoder, server)) == 0) {
|
if ((exit_code = options_parse(options, dev, encoder, server)) == 0) {
|
||||||
# ifdef WITH_GPIO
|
# ifdef WITH_GPIO
|
||||||
GPIO_INIT_PINOUT;
|
GPIO_INIT_PINOUT;
|
||||||
# endif
|
# endif
|
||||||
@@ -153,6 +154,7 @@ int main(int argc, char *argv[]) {
|
|||||||
GPIO_SET_LOW(prog_running);
|
GPIO_SET_LOW(prog_running);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
options_destroy(options);
|
||||||
if (exit_code == 0) {
|
if (exit_code == 0) {
|
||||||
LOG_INFO("Bye-bye");
|
LOG_INFO("Bye-bye");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,9 +25,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#ifdef WITH_OMX
|
#include <string.h>
|
||||||
# include <string.h>
|
|
||||||
#endif
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <getopt.h>
|
#include <getopt.h>
|
||||||
@@ -212,7 +210,31 @@ static void _features(void);
|
|||||||
static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_server_t *server);
|
static void _help(struct device_t *dev, struct encoder_t *encoder, struct http_server_t *server);
|
||||||
|
|
||||||
|
|
||||||
int parse_options(int argc, char *argv[], struct device_t *dev, struct encoder_t *encoder, struct http_server_t *server) {
|
struct options_t *options_init(int argc, char *argv[]) {
|
||||||
|
struct options_t *options;
|
||||||
|
|
||||||
|
A_CALLOC(options, 1);
|
||||||
|
options->argc = argc;
|
||||||
|
options->argv = argv;
|
||||||
|
|
||||||
|
A_CALLOC(options->argv_copy, argc);
|
||||||
|
for (int index = 0; index < argc; ++index) {
|
||||||
|
assert(options->argv_copy[index] = strdup(argv[index]));
|
||||||
|
}
|
||||||
|
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
void options_destroy(struct options_t *options) {
|
||||||
|
for (int index = 0; index < options->argc; ++index) {
|
||||||
|
free(options->argv_copy[index]);
|
||||||
|
}
|
||||||
|
free(options->argv_copy);
|
||||||
|
free(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int options_parse(struct options_t *options, struct device_t *dev, struct encoder_t *encoder, struct http_server_t *server) {
|
||||||
# define OPT_SET(_dest, _value) { \
|
# define OPT_SET(_dest, _value) { \
|
||||||
_dest = _value; \
|
_dest = _value; \
|
||||||
break; \
|
break; \
|
||||||
@@ -285,7 +307,7 @@ int parse_options(int argc, char *argv[], struct device_t *dev, struct encoder_t
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while ((ch = getopt_long(argc, argv, short_opts, _LONG_OPTS, NULL)) >= 0) {
|
while ((ch = getopt_long(options->argc, options->argv_copy, short_opts, _LONG_OPTS, NULL)) >= 0) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case _O_DEVICE: OPT_SET(dev->path, optarg);
|
case _O_DEVICE: OPT_SET(dev->path, optarg);
|
||||||
case _O_INPUT: OPT_NUMBER("--input", dev->input, 0, 128, 0);
|
case _O_INPUT: OPT_NUMBER("--input", dev->input, 0, 128, 0);
|
||||||
@@ -378,7 +400,7 @@ int parse_options(int argc, char *argv[], struct device_t *dev, struct encoder_t
|
|||||||
|
|
||||||
# ifdef WITH_SETPROCTITLE
|
# ifdef WITH_SETPROCTITLE
|
||||||
if (process_name_prefix != NULL) {
|
if (process_name_prefix != NULL) {
|
||||||
process_set_name_prefix(argc, argv, process_name_prefix);
|
process_set_name_prefix(options->argc, options->argv, process_name_prefix);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
|||||||
@@ -27,4 +27,14 @@
|
|||||||
#include "http/server.h"
|
#include "http/server.h"
|
||||||
|
|
||||||
|
|
||||||
int parse_options(int argc, char *argv[], struct device_t *dev, struct encoder_t *encoder, struct http_server_t *server);
|
struct options_t {
|
||||||
|
int argc;
|
||||||
|
char **argv;
|
||||||
|
char **argv_copy;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct options_t *options_init(int argc, char *argv[]);
|
||||||
|
void options_destroy(struct options_t *options);
|
||||||
|
|
||||||
|
int options_parse(struct options_t *options, struct device_t *dev, struct encoder_t *encoder, struct http_server_t *server);
|
||||||
|
|||||||
Reference in New Issue
Block a user