Skip to content
Permalink
Browse files

Busybox-like ff{mpeg,probe,server,play} multitool

Makefile changes are not implemented
  • Loading branch information
vi committed Mar 6, 2016
1 parent c78a726 commit a554d6451e041ec6cb3297830e94903d64368cad
Showing with 89 additions and 16 deletions.
  1. +4 −3 ffmpeg.c
  2. +2 −1 ffmpeg_opt.c
  3. +65 −0 ffmulti.c
  4. +6 −4 ffplay.c
  5. +6 −4 ffprobe.c
  6. +6 −4 ffserver.c
@@ -106,8 +106,8 @@

#include "libavutil/avassert.h"

const char program_name[] = "ffmpeg";
const int program_birth_year = 2000;
// const char program_name[] = "ffmpeg";
// const int program_birth_year = 2000;

static FILE *vstats_file;

@@ -4274,7 +4274,8 @@ static void log_callback_null(void *ptr, int level, const char *fmt, va_list vl)
{
}

int main(int argc, char **argv)
int main_ffmpeg(int argc, char **argv);
int main_ffmpeg(int argc, char **argv)
{
int ret;
int64_t ti;
@@ -2894,7 +2894,8 @@ static int opt_filter_complex_script(void *optctx, const char *opt, const char *
return 0;
}

void show_help_default(const char *opt, const char *arg)
void show_help_default_ffmpeg(const char *opt, const char *arg);
void show_help_default_ffmpeg(const char *opt, const char *arg)
{
/* per-file options have at least one of those set */
const int per_file = OPT_SPEC | OPT_OFFSET | OPT_PERFILE;
@@ -0,0 +1,65 @@
#include <string.h>

#include "config.h"

const char program_name[] = "ffmulti";
const int program_birth_year = 2016;

int main_ffmpeg(int argc, char **argv);
int main_ffprobe(int argc, char **argv);
int main_ffserver(int argc, char **argv);
int main_ffplay(int argc, char **argv);

void show_help_default_ffmpeg(const char *opt, const char *arg);
void show_help_default_ffserver(const char *opt, const char *arg);
void show_help_default_ffprobe(const char *opt, const char *arg);
void show_help_default_ffplay(const char *opt, const char *arg);
void show_help_default(const char *opt, const char *arg);

static char tool = '\0';

void show_help_default(const char *opt, const char *arg)
{
switch(tool) {
#if CONFIG_FFMPEG == 1
case 'm': show_help_default_ffmpeg (opt, arg); break;
#endif
#if CONFIG_FFSERVER == 1
case 's': show_help_default_ffserver(opt, arg); break;
#endif
#if CONFIG_FFPROBE == 1
case 'r': show_help_default_ffprobe (opt, arg); break;
#endif
#if CONFIG_FFPLAY == 1
case 'l': show_help_default_ffplay (opt, arg); break;
#endif
}
}

int main(int argc, char **argv) {
if (argc == 0 || !argv|| !argv[0]) return 127;
if (0) {
#if CONFIG_FFMPEG == 1
} else if (strstr(argv[0], "ffmpeg")) {
tool='m';
return main_ffmpeg(argc, argv);
#endif
#if CONFIG_FFPLAY == 1
} else if (strstr(argv[0], "ffplay")) {
tool='l';
return main_ffplay(argc, argv);
#endif
#if CONFIG_FFPROBE == 1
} else if (strstr(argv[0], "ffprobe")) {
tool='r';
return main_ffprobe(argc, argv);
#endif
#if CONFIG_FFSERVER == 1
} else if (strstr(argv[0], "ffserver")) {
tool='s';
return main_ffserver(argc, argv);
#endif
} else {
return main(argc-1, argv+1);
}
}
@@ -60,8 +60,8 @@

#include <assert.h>

const char program_name[] = "ffplay";
const int program_birth_year = 2003;
// const char program_name[] = "ffplay";
// const int program_birth_year = 2003;

#define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_FRAMES 25
@@ -3708,7 +3708,8 @@ static void show_usage(void)
av_log(NULL, AV_LOG_INFO, "\n");
}

void show_help_default(const char *opt, const char *arg)
void show_help_default_ffplay(const char *opt, const char *arg);
void show_help_default_ffplay(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
@@ -3765,7 +3766,8 @@ static int lockmgr(void **mtx, enum AVLockOp op)
}

/* Called from the main */
int main(int argc, char **argv)
int main_ffplay(int argc, char **argv);
int main_ffplay(int argc, char **argv)
{
int flags;
VideoState *is;
@@ -49,8 +49,8 @@
#include "libpostproc/postprocess.h"
#include "cmdutils.h"

const char program_name[] = "ffprobe";
const int program_birth_year = 2007;
// const char program_name[] = "ffprobe";
// const int program_birth_year = 2007;

static int do_bitexact = 0;
static int do_count_frames = 0;
@@ -2897,7 +2897,8 @@ static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
return 0;
}

void show_help_default(const char *opt, const char *arg)
void show_help_default_ffprobe(const char *opt, const char *arg);
void show_help_default_ffprobe(const char *opt, const char *arg)
{
av_log_set_callback(log_callback_help);
show_usage();
@@ -3170,7 +3171,8 @@ static inline int check_section_show_entries(int section_id)
do_show_##varname = 1; \
} while (0)

int main(int argc, char **argv)
int main_ffprobe(int argc, char **argv);
int main_ffprobe(int argc, char **argv)
{
const Writer *w;
WriterContext *wctx;
@@ -73,8 +73,8 @@

#define PATH_LENGTH 1024

const char program_name[] = "ffserver";
const int program_birth_year = 2000;
// const char program_name[] = "ffserver";
// const int program_birth_year = 2000;

static const OptionDef options[];

@@ -3951,7 +3951,8 @@ static void opt_debug(void)
snprintf(config.logfilename, sizeof(config.logfilename), "-");
}

void show_help_default(const char *opt, const char *arg)
void show_help_default_ffserver(const char *opt, const char *arg);
void show_help_default_ffserver(const char *opt, const char *arg)
{
printf("usage: ffserver [options]\n"
"Hyper fast multi format Audio/Video streaming server\n");
@@ -3967,7 +3968,8 @@ static const OptionDef options[] = {
{ NULL },
};

int main(int argc, char **argv)
int main_ffserver(int argc, char **argv);
int main_ffserver(int argc, char **argv)
{
struct sigaction sigact = { { 0 } };
int cfg_parsed;

0 comments on commit a554d64

Please sign in to comment.