Commit d2084402 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  lavc: fix type for thread_type option
  avconv: move format to options context
  avconv: move limit_filesize to options context
  avconv: move start_time, recording_time and input_ts_offset to options context
  avconv: add a context for options.
  cmdutils: allow storing per-stream/chapter/.... options in a generic way
  cmdutils: split per-option code out of parse_options().
  cmdutils: add support for caller-provided option context.
  cmdutils: declare only one pointer type in OptionDef
  cmdutils: move grow_array() from avconv to cmdutils.
  cmdutils: move exit_program() declaration to cmdutils from avconv
  http: Consider the stream as seekable if the reply contains Accept-Ranges: bytes
  nutenc: add namespace to the api facing functions

Conflicts:
	avconv.c
	cmdutils.c
	cmdutils.h
	ffmpeg.c
	ffplay.c
	ffprobe.c
	ffserver.c
	libavformat/http.c
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents b881a2e2 fb47997e
This diff is collapsed.
...@@ -92,7 +92,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do ...@@ -92,7 +92,8 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
else else
return d; return d;
fprintf(stderr, error, context, numstr, min, max); fprintf(stderr, error, context, numstr, min, max);
exit(1); exit_program(1);
return 0;
} }
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration) int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration)
...@@ -101,7 +102,7 @@ int64_t parse_time_or_die(const char *context, const char *timestr, int is_durat ...@@ -101,7 +102,7 @@ int64_t parse_time_or_die(const char *context, const char *timestr, int is_durat
if (av_parse_time(&us, timestr, is_duration) < 0) { if (av_parse_time(&us, timestr, is_duration) < 0) {
fprintf(stderr, "Invalid %s specification for %s: %s\n", fprintf(stderr, "Invalid %s specification for %s: %s\n",
is_duration ? "duration" : "date", context, timestr); is_duration ? "duration" : "date", context, timestr);
exit(1); exit_program(1);
} }
return us; return us;
} }
...@@ -202,12 +203,80 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr) ...@@ -202,12 +203,80 @@ static inline void prepare_app_arguments(int *argc_ptr, char ***argv_ptr)
} }
#endif /* WIN32 && !__MINGW32CE__ */ #endif /* WIN32 && !__MINGW32CE__ */
void parse_options(int argc, char **argv, const OptionDef *options,
int (* parse_arg_function)(const char *opt, const char *arg)) int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options)
{ {
const char *opt, *arg;
int optindex, handleoptions=1;
const OptionDef *po; const OptionDef *po;
int bool_val = 1;
int *dstcount;
void *dst;
po = find_option(options, opt);
if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
/* handle 'no' bool option */
po = find_option(options, opt + 2);
if (!(po->name && (po->flags & OPT_BOOL)))
goto unknown_opt;
bool_val = 0;
}
if (!po->name)
po = find_option(options, "default");
if (!po->name) {
unknown_opt:
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR(EINVAL);
}
if (po->flags & HAS_ARG && !arg) {
av_log(NULL, AV_LOG_ERROR, "Missing argument for option '%s'\n", opt);
return AVERROR(EINVAL);
}
/* new-style options contain an offset into optctx, old-style address of
* a global var*/
dst = po->flags & (OPT_OFFSET|OPT_SPEC) ? (uint8_t*)optctx + po->u.off : po->u.dst_ptr;
if (po->flags & OPT_SPEC) {
SpecifierOpt **so = dst;
char *p = strchr(opt, ':');
dstcount = (int*)(so + 1);
*so = grow_array(*so, sizeof(**so), dstcount, *dstcount + 1);
(*so)[*dstcount - 1].specifier = av_strdup(p ? p + 1 : "");
dst = &(*so)[*dstcount - 1].u;
}
if (po->flags & OPT_STRING) {
char *str;
str = av_strdup(arg);
*(char**)dst = str;
} else if (po->flags & OPT_BOOL) {
*(int*)dst = bool_val;
} else if (po->flags & OPT_INT) {
*(int*)dst = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
} else if (po->flags & OPT_INT64) {
*(int64_t*)dst = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
} else if (po->flags & OPT_TIME) {
*(int64_t*)dst = parse_time_or_die(opt, arg, 1);
} else if (po->flags & OPT_FLOAT) {
*(float*)dst = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
} else if (po->u.func_arg) {
int ret = po->flags & OPT_FUNC2 ? po->u.func2_arg(optctx, opt, arg) :
po->u.func_arg(opt, arg);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", arg, opt);
return ret;
}
}
if (po->flags & OPT_EXIT)
exit_program(0);
return !!(po->flags & HAS_ARG);
}
void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
void (* parse_arg_function)(void *, const char*))
{
const char *opt;
int optindex, handleoptions = 1, ret;
/* perform system-dependent conversions for arguments list */ /* perform system-dependent conversions for arguments list */
prepare_app_arguments(&argc, &argv); prepare_app_arguments(&argc, &argv);
...@@ -218,60 +287,18 @@ void parse_options(int argc, char **argv, const OptionDef *options, ...@@ -218,60 +287,18 @@ void parse_options(int argc, char **argv, const OptionDef *options,
opt = argv[optindex++]; opt = argv[optindex++];
if (handleoptions && opt[0] == '-' && opt[1] != '\0') { if (handleoptions && opt[0] == '-' && opt[1] != '\0') {
int bool_val = 1;
if (opt[1] == '-' && opt[2] == '\0') { if (opt[1] == '-' && opt[2] == '\0') {
handleoptions = 0; handleoptions = 0;
continue; continue;
} }
opt++; opt++;
po= find_option(options, opt);
if (!po->name && opt[0] == 'n' && opt[1] == 'o') { if ((ret = parse_option(optctx, opt, argv[optindex], options)) < 0)
/* handle 'no' bool option */ exit_program(1);
po = find_option(options, opt + 2); optindex += ret;
if (!(po->name && (po->flags & OPT_BOOL)))
goto unknown_opt;
bool_val = 0;
}
if (!po->name)
po= find_option(options, "default");
if (!po->name) {
unknown_opt:
fprintf(stderr, "%s: unrecognized option '%s'\n", argv[0], opt);
exit(1);
}
arg = NULL;
if (po->flags & HAS_ARG) {
arg = argv[optindex++];
if (!arg) {
fprintf(stderr, "%s: missing argument for option '%s'\n", argv[0], opt);
exit(1);
}
}
if (po->flags & OPT_STRING) {
char *str;
str = av_strdup(arg);
*po->u.str_arg = str;
} else if (po->flags & OPT_BOOL) {
*po->u.int_arg = bool_val;
} else if (po->flags & OPT_INT) {
*po->u.int_arg = parse_number_or_die(opt, arg, OPT_INT64, INT_MIN, INT_MAX);
} else if (po->flags & OPT_INT64) {
*po->u.int64_arg = parse_number_or_die(opt, arg, OPT_INT64, INT64_MIN, INT64_MAX);
} else if (po->flags & OPT_FLOAT) {
*po->u.float_arg = parse_number_or_die(opt, arg, OPT_FLOAT, -INFINITY, INFINITY);
} else if (po->u.func_arg) {
if (po->u.func_arg(opt, arg) < 0) {
fprintf(stderr, "%s: failed to set value '%s' for option '%s'\n", argv[0], arg ? arg : "[null]", opt);
exit(1);
}
}
if(po->flags & OPT_EXIT)
exit(0);
} else { } else {
if (parse_arg_function) { if (parse_arg_function)
if (parse_arg_function(NULL, opt) < 0) parse_arg_function(optctx, opt);
exit(1);
}
} }
} }
} }
...@@ -338,7 +365,7 @@ int opt_loglevel(const char *opt, const char *arg) ...@@ -338,7 +365,7 @@ int opt_loglevel(const char *opt, const char *arg)
"Possible levels are numbers or:\n", arg); "Possible levels are numbers or:\n", arg);
for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++) for (i = 0; i < FF_ARRAY_ELEMS(log_levels); i++)
fprintf(stderr, "\"%s\"\n", log_levels[i].name); fprintf(stderr, "\"%s\"\n", log_levels[i].name);
exit(1); exit_program(1);
} }
av_log_set_level(level); av_log_set_level(level);
return 0; return 0;
...@@ -872,3 +899,21 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *cod ...@@ -872,3 +899,21 @@ AVDictionary **setup_find_stream_info_opts(AVFormatContext *s, AVDictionary *cod
return opts; return opts;
} }
void *grow_array(void *array, int elem_size, int *size, int new_size)
{
if (new_size >= INT_MAX / elem_size) {
av_log(NULL, AV_LOG_ERROR, "Array too big.\n");
exit_program(1);
}
if (*size < new_size) {
uint8_t *tmp = av_realloc(array, new_size*elem_size);
if (!tmp) {
av_log(NULL, AV_LOG_ERROR, "Could not alloc buffer.\n");
exit_program(1);
}
memset(tmp + *size*elem_size, 0, (new_size-*size) * elem_size);
*size = new_size;
return tmp;
}
return array;
}
...@@ -112,6 +112,16 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do ...@@ -112,6 +112,16 @@ double parse_number_or_die(const char *context, const char *numstr, int type, do
*/ */
int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration); int64_t parse_time_or_die(const char *context, const char *timestr, int is_duration);
typedef struct SpecifierOpt {
char *specifier; /**< stream/chapter/program/... specifier */
union {
uint8_t *str;
int i;
int64_t i64;
float f;
} u;
} SpecifierOpt;
typedef struct { typedef struct {
const char *name; const char *name;
int flags; int flags;
...@@ -128,12 +138,17 @@ typedef struct { ...@@ -128,12 +138,17 @@ typedef struct {
#define OPT_INT64 0x0400 #define OPT_INT64 0x0400
#define OPT_EXIT 0x0800 #define OPT_EXIT 0x0800
#define OPT_DATA 0x1000 #define OPT_DATA 0x1000
#define OPT_FUNC2 0x2000
#define OPT_OFFSET 0x4000 /* option is specified as an offset in a passed optctx */
#define OPT_SPEC 0x8000 /* option is to be stored in an array of SpecifierOpt.
Implies OPT_OFFSET. Next element after the offset is
an int containing element count in the array. */
#define OPT_TIME 0x10000
union { union {
int *int_arg; void *dst_ptr;
char **str_arg;
float *float_arg;
int (*func_arg)(const char *, const char *); int (*func_arg)(const char *, const char *);
int64_t *int64_arg; int (*func2_arg)(void *, const char *, const char *);
size_t off;
} u; } u;
const char *help; const char *help;
const char *argname; const char *argname;
...@@ -143,14 +158,23 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int ...@@ -143,14 +158,23 @@ void show_help_options(const OptionDef *options, const char *msg, int mask, int
/** /**
* Parse the command line arguments. * Parse the command line arguments.
*
* @param optctx an opaque options context
* @param options Array with the definitions required to interpret every * @param options Array with the definitions required to interpret every
* option of the form: -option_name [argument] * option of the form: -option_name [argument]
* @param parse_arg_function Name of the function called to process every * @param parse_arg_function Name of the function called to process every
* argument without a leading option name flag. NULL if such arguments do * argument without a leading option name flag. NULL if such arguments do
* not have to be processed. * not have to be processed.
*/ */
void parse_options(int argc, char **argv, const OptionDef *options, void parse_options(void *optctx, int argc, char **argv, const OptionDef *options,
int (* parse_arg_function)(const char *opt, const char *arg)); void (* parse_arg_function)(void *optctx, const char*));
/**
* Parse one given option.
*
* @return on success 1 if arg was consumed, 0 otherwise; negative number on error
*/
int parse_option(void *optctx, const char *opt, const char *arg, const OptionDef *options);
/** /**
* Check if the given stream matches a stream specifier. * Check if the given stream matches a stream specifier.
...@@ -301,4 +325,20 @@ int read_file(const char *filename, char **bufptr, size_t *size); ...@@ -301,4 +325,20 @@ int read_file(const char *filename, char **bufptr, size_t *size);
FILE *get_preset_file(char *filename, size_t filename_size, FILE *get_preset_file(char *filename, size_t filename_size,
const char *preset_name, int is_path, const char *codec_name); const char *preset_name, int is_path, const char *codec_name);
#endif /* FFMPEG_CMDUTILS_H */ /**
* Do all the necessary cleanup and abort.
* This function is implemented in the avtools, not cmdutils.
*/
void exit_program(int ret);
/**
* Realloc array to hold new_size elements of elem_size.
* Calls exit_program() on failure.
*
* @param elem_size size in bytes of each element
* @param size new element count will be written here
* @return reallocated array
*/
void *grow_array(void *array, int elem_size, int *size, int new_size);
#endif /* LIBAV_CMDUTILS_H */
This diff is collapsed.
...@@ -277,6 +277,11 @@ static AVPacket flush_pkt; ...@@ -277,6 +277,11 @@ static AVPacket flush_pkt;
static SDL_Surface *screen; static SDL_Surface *screen;
void exit_program(int ret)
{
exit(ret);
}
static int packet_queue_put(PacketQueue *q, AVPacket *pkt) static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
{ {
AVPacketList *pkt1; AVPacketList *pkt1;
...@@ -2891,19 +2896,20 @@ static int opt_show_mode(const char *opt, const char *arg) ...@@ -2891,19 +2896,20 @@ static int opt_show_mode(const char *opt, const char *arg)
return 0; return 0;
} }
static int opt_input_file(const char *opt, const char *filename) static void opt_input_file(void *optctx, const char *filename)
{ {
if (input_filename) { if (input_filename) {
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n", fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
filename, input_filename); filename, input_filename);
exit(1); exit_program(1);
} }
if (!strcmp(filename, "-")) if (!strcmp(filename, "-"))
filename = "pipe:"; filename = "pipe:";
input_filename = filename; input_filename = filename;
return 0;
} }
static int dummy;
static const OptionDef options[] = { static const OptionDef options[] = {
#include "cmdutils_common_opts.h" #include "cmdutils_common_opts.h"
{ "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" }, { "x", HAS_ARG, {(void*)opt_width}, "force displayed width", "width" },
...@@ -2947,7 +2953,7 @@ static const OptionDef options[] = { ...@@ -2947,7 +2953,7 @@ static const OptionDef options[] = {
{ "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" }, { "rdftspeed", OPT_INT | HAS_ARG| OPT_AUDIO | OPT_EXPERT, {(void*)&rdftspeed}, "rdft speed", "msecs" },
{ "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" }, { "showmode", HAS_ARG, {(void*)opt_show_mode}, "select show mode (0 = video, 1 = waves, 2 = RDFT)", "mode" },
{ "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" }, { "default", HAS_ARG | OPT_AUDIO | OPT_VIDEO | OPT_EXPERT, {(void*)opt_default}, "generic catch all option", "" },
{ "i", HAS_ARG, {(void *)opt_input_file}, "read specified file", "input_file"}, { "i", OPT_BOOL, {(void *)&dummy}, "read specified file", "input_file"},
{ NULL, }, { NULL, },
}; };
...@@ -3038,7 +3044,7 @@ int main(int argc, char **argv) ...@@ -3038,7 +3044,7 @@ int main(int argc, char **argv)
show_banner(); show_banner();
parse_options(argc, argv, options, opt_input_file); parse_options(NULL, argc, argv, options, opt_input_file);
if (!input_filename) { if (!input_filename) {
show_usage(); show_usage();
......
...@@ -58,6 +58,11 @@ static const char *unit_hertz_str = "Hz" ; ...@@ -58,6 +58,11 @@ static const char *unit_hertz_str = "Hz" ;
static const char *unit_byte_str = "byte" ; static const char *unit_byte_str = "byte" ;
static const char *unit_bit_per_second_str = "bit/s"; static const char *unit_bit_per_second_str = "bit/s";
void exit_program(int ret)
{
exit(ret);
}
static char *value_string(char *buf, int buf_size, double val, const char *unit) static char *value_string(char *buf, int buf_size, double val, const char *unit)
{ {
if (unit == unit_second_str && use_value_sexagesimal_format) { if (unit == unit_second_str && use_value_sexagesimal_format) {
...@@ -455,7 +460,7 @@ static int opt_format(const char *opt, const char *arg) ...@@ -455,7 +460,7 @@ static int opt_format(const char *opt, const char *arg)
return 0; return 0;
} }
static int opt_input_file(const char *opt, const char *arg) static void opt_input_file(void *optctx, const char *arg)
{ {
if (input_filename) { if (input_filename) {
fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n", fprintf(stderr, "Argument '%s' provided as input filename, but '%s' was already specified.\n",
...@@ -465,7 +470,6 @@ static int opt_input_file(const char *opt, const char *arg) ...@@ -465,7 +470,6 @@ static int opt_input_file(const char *opt, const char *arg)
if (!strcmp(arg, "-")) if (!strcmp(arg, "-"))
arg = "pipe:"; arg = "pipe:";
input_filename = arg; input_filename = arg;
return 0;
} }
static int opt_help(const char *opt, const char *arg) static int opt_help(const char *opt, const char *arg)
...@@ -519,7 +523,7 @@ int main(int argc, char **argv) ...@@ -519,7 +523,7 @@ int main(int argc, char **argv)
#endif #endif
show_banner(); show_banner();
parse_options(argc, argv, options, opt_input_file); parse_options(NULL, argc, argv, options, opt_input_file);
if (!input_filename) { if (!input_filename) {
show_usage(); show_usage();
......
...@@ -321,6 +321,11 @@ static AVLFG random_state; ...@@ -321,6 +321,11 @@ static AVLFG random_state;
static FILE *logfile = NULL; static FILE *logfile = NULL;
/* FIXME: make ffserver work with IPv6 */ /* FIXME: make ffserver work with IPv6 */
void exit_program(int ret)
{
exit(ret);
}
/* resolve host with also IP address parsing */ /* resolve host with also IP address parsing */
static int resolve_host(struct in_addr *sin_addr, const char *hostname) static int resolve_host(struct in_addr *sin_addr, const char *hostname)
{ {
...@@ -4672,7 +4677,7 @@ int main(int argc, char **argv) ...@@ -4672,7 +4677,7 @@ int main(int argc, char **argv)
my_program_dir = getcwd(0, 0); my_program_dir = getcwd(0, 0);
ffserver_daemon = 1; ffserver_daemon = 1;
parse_options(argc, argv, options, NULL); parse_options(NULL, argc, argv, options, NULL);
unsetenv("http_proxy"); /* Kill the http_proxy */ unsetenv("http_proxy"); /* Kill the http_proxy */
......
...@@ -483,7 +483,7 @@ static const AVOption options[]={ ...@@ -483,7 +483,7 @@ static const AVOption options[]={
{"lpc_passes", "deprecated, use flac-specific options", OFFSET(lpc_passes), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E}, {"lpc_passes", "deprecated, use flac-specific options", OFFSET(lpc_passes), FF_OPT_TYPE_INT, {.dbl = -1 }, INT_MIN, INT_MAX, A|E},
#endif #endif
{"slices", "number of slices, used in parallelized decoding", OFFSET(slices), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E}, {"slices", "number of slices, used in parallelized decoding", OFFSET(slices), FF_OPT_TYPE_INT, {.dbl = 0 }, 0, INT_MAX, V|E},
{"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_INT, {.dbl = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|E|D, "thread_type"}, {"thread_type", "select multithreading type", OFFSET(thread_type), FF_OPT_TYPE_FLAGS, {.dbl = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|E|D, "thread_type"},
{"slice", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, {"slice", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_SLICE }, INT_MIN, INT_MAX, V|E|D, "thread_type"},
{"frame", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_FRAME }, INT_MIN, INT_MAX, V|E|D, "thread_type"}, {"frame", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_THREAD_FRAME }, INT_MIN, INT_MAX, V|E|D, "thread_type"},
{"audio_service_type", "audio service type", OFFSET(audio_service_type), FF_OPT_TYPE_INT, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"}, {"audio_service_type", "audio service type", OFFSET(audio_service_type), FF_OPT_TYPE_INT, {.dbl = AV_AUDIO_SERVICE_TYPE_MAIN }, 0, AV_AUDIO_SERVICE_TYPE_NB-1, A|E, "audio_service_type"},
......
...@@ -265,7 +265,7 @@ static int process_line(URLContext *h, char *line, int line_count, ...@@ -265,7 +265,7 @@ static int process_line(URLContext *h, char *line, int line_count,
s->filesize = atoll(slash+1); s->filesize = atoll(slash+1);
} }
h->is_streamed = 0; /* we _can_ in fact seek */ h->is_streamed = 0; /* we _can_ in fact seek */
} else if (!strcasecmp (tag, "Accept-Ranges") && !strncmp (p, "bytes", 5)) { } else if (!strcasecmp(tag, "Accept-Ranges") && !strncmp(p, "bytes", 5)) {
h->is_streamed = 0; h->is_streamed = 0;
} else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) { } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
s->filesize = -1; s->filesize = -1;
......
...@@ -580,7 +580,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){ ...@@ -580,7 +580,7 @@ static int write_headers(AVFormatContext *avctx, AVIOContext *bc){
return 0; return 0;
} }
static int write_header(AVFormatContext *s){ static int nut_write_header(AVFormatContext *s){
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
AVIOContext *bc = s->pb; AVIOContext *bc = s->pb;
int i, j, ret; int i, j, ret;
...@@ -692,7 +692,7 @@ static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){ ...@@ -692,7 +692,7 @@ static int find_best_header_idx(NUTContext *nut, AVPacket *pkt){
return best_i; return best_i;
} }
static int write_packet(AVFormatContext *s, AVPacket *pkt){ static int nut_write_packet(AVFormatContext *s, AVPacket *pkt){
NUTContext *nut = s->priv_data; NUTContext *nut = s->priv_data;
StreamContext *nus= &nut->stream[pkt->stream_index]; StreamContext *nus= &nut->stream[pkt->stream_index];
AVIOContext *bc = s->pb, *dyn_bc; AVIOContext *bc = s->pb, *dyn_bc;
...@@ -846,7 +846,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){ ...@@ -846,7 +846,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt){
return 0; return 0;
} }
static int write_trailer(AVFormatContext *s){ static int nut_write_trailer(AVFormatContext *s){
NUTContext *nut= s->priv_data; NUTContext *nut= s->priv_data;
AVIOContext *bc= s->pb; AVIOContext *bc= s->pb;
...@@ -875,9 +875,9 @@ AVOutputFormat ff_nut_muxer = { ...@@ -875,9 +875,9 @@ AVOutputFormat ff_nut_muxer = {
.audio_codec = CODEC_ID_MP2, .audio_codec = CODEC_ID_MP2,
#endif #endif
.video_codec = CODEC_ID_MPEG4, .video_codec = CODEC_ID_MPEG4,
.write_header = write_header, .write_header = nut_write_header,
.write_packet = write_packet, .write_packet = nut_write_packet,
.write_trailer = write_trailer, .write_trailer = nut_write_trailer,
.flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS, .flags = AVFMT_GLOBALHEADER | AVFMT_VARIABLE_FPS,
.codec_tag = (const AVCodecTag * const []){ ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 }, .codec_tag = (const AVCodecTag * const []){ ff_codec_bmp_tags, ff_nut_video_tags, ff_codec_wav_tags, ff_nut_subtitle_tags, 0 },
}; };
...@@ -35,7 +35,7 @@ fate-bink-demux-video: CMD = framecrc -i $(SAMPLES)/bink/hol2br.bik ...@@ -35,7 +35,7 @@ fate-bink-demux-video: CMD = framecrc -i $(SAMPLES)/bink/hol2br.bik
FATE_TESTS += fate-caf FATE_TESTS += fate-caf
fate-caf: CMD = crc -i $(SAMPLES)/caf/caf-pcm16.caf fate-caf: CMD = crc -i $(SAMPLES)/caf/caf-pcm16.caf
FATE_TESTS += fate-cdgraphics FATE_TESTS += fate-cdgraphics
fate-cdgraphics: CMD = framecrc -t 1 -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fmt rgb24 fate-cdgraphics: CMD = framecrc -i $(SAMPLES)/cdgraphics/BrotherJohn.cdg -pix_fmt rgb24 -t 1
FATE_TESTS += fate-cljr FATE_TESTS += fate-cljr
fate-cljr: CMD = framecrc -i $(SAMPLES)/cljr/testcljr-partial.avi fate-cljr: CMD = framecrc -i $(SAMPLES)/cljr/testcljr-partial.avi
FATE_TESTS += fate-corepng FATE_TESTS += fate-corepng
...@@ -129,7 +129,7 @@ fate-id-cin-video: CMD = framecrc -i $(SAMPLES)/idcin/idlog-2MB.cin -pix_fmt rg ...@@ -129,7 +129,7 @@ fate-id-cin-video: CMD = framecrc -i $(SAMPLES)/idcin/idlog-2MB.cin -pix_fmt rg
FATE_TESTS += fate-idroq-video-dpcm FATE_TESTS += fate-idroq-video-dpcm
fate-idroq-video-dpcm: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq fate-idroq-video-dpcm: CMD = framecrc -i $(SAMPLES)/idroq/idlogo.roq
FATE_TESTS += fate-idroq-video-encode FATE_TESTS += fate-idroq-video-encode
fate-idroq-video-encode: CMD = md5 -t 0.2 -f image2 -vcodec pgmyuv -i $(SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -vf pad=512:512:80:112 -f RoQ fate-idroq-video-encode: CMD = md5 -f image2 -vcodec pgmyuv -i $(SAMPLES)/ffmpeg-synthetic/vsynth1/%02d.pgm -sws_flags +bitexact -vf pad=512:512:80:112 -f RoQ -t 0.2
FATE_TESTS += fate-iff-byterun1 FATE_TESTS += fate-iff-byterun1
fate-iff-byterun1: CMD = framecrc -i $(SAMPLES)/iff/ASH.LBM -pix_fmt rgb24 fate-iff-byterun1: CMD = framecrc -i $(SAMPLES)/iff/ASH.LBM -pix_fmt rgb24
FATE_TESTS += fate-iff-fibonacci FATE_TESTS += fate-iff-fibonacci
......
...@@ -4,32 +4,32 @@ fate-mp3-float-conf-compl: CMP = stddev ...@@ -4,32 +4,32 @@ fate-mp3-float-conf-compl: CMP = stddev
fate-mp3-float-conf-compl: REF = $(SAMPLES)/mp3-conformance/compl.pcm fate-mp3-float-conf-compl: REF = $(SAMPLES)/mp3-conformance/compl.pcm
FATE_MP3 += fate-mp3-float-conf-he_32khz FATE_MP3 += fate-mp3-float-conf-he_32khz
fate-mp3-float-conf-he_32khz: CMD = pcm -acodec mp3float -fs 343296 -i $(SAMPLES)/mp3-conformance/he_32khz.bit fate-mp3-float-conf-he_32khz: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/he_32khz.bit -fs 343296
fate-mp3-float-conf-he_32khz: CMP = stddev fate-mp3-float-conf-he_32khz: CMP = stddev
fate-mp3-float-conf-he_32khz: REF = $(SAMPLES)/mp3-conformance/he_32khz.pcm fate-mp3-float-conf-he_32khz: REF = $(SAMPLES)/mp3-conformance/he_32khz.pcm
FATE_MP3 += fate-mp3-float-conf-he_44khz FATE_MP3 += fate-mp3-float-conf-he_44khz
fate-mp3-float-conf-he_44khz: CMD = pcm -acodec mp3float -fs 942336 -i $(SAMPLES)/mp3-conformance/he_44khz.bit fate-mp3-float-conf-he_44khz: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/he_44khz.bit -fs 942336
fate-mp3-float-conf-he_44khz: CMP = stddev fate-mp3-float-conf-he_44khz: CMP = stddev
fate-mp3-float-conf-he_44khz: REF = $(SAMPLES)/mp3-conformance/he_44khz.pcm fate-mp3-float-conf-he_44khz: REF = $(SAMPLES)/mp3-conformance/he_44khz.pcm
FATE_MP3 += fate-mp3-float-conf-he_48khz FATE_MP3 += fate-mp3-float-conf-he_48khz
fate-mp3-float-conf-he_48khz: CMD = pcm -acodec mp3float -fs 343296 -i $(SAMPLES)/mp3-conformance/he_48khz.bit fate-mp3-float-conf-he_48khz: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/he_48khz.bit -fs 343296
fate-mp3-float-conf-he_48khz: CMP = stddev fate-mp3-float-conf-he_48khz: CMP = stddev
fate-mp3-float-conf-he_48khz: REF = $(SAMPLES)/mp3-conformance/he_48khz.pcm fate-mp3-float-conf-he_48khz: REF = $(SAMPLES)/mp3-conformance/he_48khz.pcm
FATE_MP3 += fate-mp3-float-conf-hecommon FATE_MP3 += fate-mp3-float-conf-hecommon
fate-mp3-float-conf-hecommon: CMD = pcm -acodec mp3float -fs 133632 -i $(SAMPLES)/mp3-conformance/hecommon.bit fate-mp3-float-conf-hecommon: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/hecommon.bit -fs 133632
fate-mp3-float-conf-hecommon: CMP = stddev fate-mp3-float-conf-hecommon: CMP = stddev
fate-mp3-float-conf-hecommon: REF = $(SAMPLES)/mp3-conformance/hecommon.pcm fate-mp3-float-conf-hecommon: REF = $(SAMPLES)/mp3-conformance/hecommon.pcm
FATE_MP3 += fate-mp3-float-conf-si FATE_MP3 += fate-mp3-float-conf-si
fate-mp3-float-conf-si: CMD = pcm -acodec mp3float -fs 269568 -i $(SAMPLES)/mp3-conformance/si.bit fate-mp3-float-conf-si: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/si.bit -fs 269568
fate-mp3-float-conf-si: CMP = stddev fate-mp3-float-conf-si: CMP = stddev
fate-mp3-float-conf-si: REF = $(SAMPLES)/mp3-conformance/si.pcm fate-mp3-float-conf-si: REF = $(SAMPLES)/mp3-conformance/si.pcm
FATE_MP3 += fate-mp3-float-conf-si_block FATE_MP3 += fate-mp3-float-conf-si_block
fate-mp3-float-conf-si_block: CMD = pcm -acodec mp3float -fs 145152 -i $(SAMPLES)/mp3-conformance/si_block.bit fate-mp3-float-conf-si_block: CMD = pcm -acodec mp3float -i $(SAMPLES)/mp3-conformance/si_block.bit -fs 145152
fate-mp3-float-conf-si_block: CMP = stddev fate-mp3-float-conf-si_block: CMP = stddev
fate-mp3-float-conf-si_block: REF = $(SAMPLES)/mp3-conformance/si_block.pcm fate-mp3-float-conf-si_block: REF = $(SAMPLES)/mp3-conformance/si_block.pcm
......
...@@ -125,7 +125,7 @@ fate-atrac3-3: CMP = oneoff ...@@ -125,7 +125,7 @@ fate-atrac3-3: CMP = oneoff
fate-atrac3-3: REF = $(SAMPLES)/atrac3/mc_sich_at3_132_small.pcm fate-atrac3-3: REF = $(SAMPLES)/atrac3/mc_sich_at3_132_small.pcm
FATE_TESTS += fate-gsm FATE_TESTS += fate-gsm
fate-gsm: CMD = framecrc -t 10 -i $(SAMPLES)/gsm/sample-gsm-8000.mov fate-gsm: CMD = framecrc -i $(SAMPLES)/gsm/sample-gsm-8000.mov -t 10
FATE_TESTS += fate-gsm-ms FATE_TESTS += fate-gsm-ms
fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav fate-gsm-ms: CMD = framecrc -i $(SAMPLES)/gsm/ciao.wav
......
...@@ -227,8 +227,8 @@ conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \ ...@@ -227,8 +227,8 @@ conversions="yuv420p yuv422p yuv444p yuyv422 yuv410p yuv411p yuvj420p \
monob yuv440p yuvj440p" monob yuv440p yuvj440p"
for pix_fmt in $conversions ; do for pix_fmt in $conversions ; do
file=${outfile}${pix_fmt}.yuv file=${outfile}${pix_fmt}.yuv
run_avconv $DEC_OPTS -r 1 -t 1 -f image2 -vcodec pgmyuv -i $raw_src \ run_avconv $DEC_OPTS -r 1 -f image2 -vcodec pgmyuv -i $raw_src \
$ENC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst $ENC_OPTS -f rawvideo -t 1 -s 352x288 -pix_fmt $pix_fmt $target_path/$raw_dst
do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \ do_avconv $file $DEC_OPTS -f rawvideo -s 352x288 -pix_fmt $pix_fmt -i $target_path/$raw_dst \
$ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p $ENC_OPTS -f rawvideo -s 352x288 -pix_fmt yuv444p
done done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment