Commit 411cc5c4 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master: (31 commits)
  audioconvert: add explanatory comments to channel_names array
  audioconvert: K&R whitespace cosmetics
  avconv: use correct index when selecting metadata to write to.
  avconv: fix inverted variable
  doc/avconv: document option types (input/output/per-stream/...)
  doc/avtools-common-opts: write a section about stream specifiers.
  doc/avconv: remove two pointless paragraphs.
  doc/avconv: document that global options should be specified first.
  doc/avconv: remove entries for nonexistent options
  doc/avconv: remove documentation for removed 'timestamp' option
  doc: cosmetics, rename fftools-common-opts to avtools-....
  avconv: move streamid_map to options context.
  avconv: extend -vf syntax
  avconv: move top_field_first to options context.
  avconv: move inter/intra matrix to options context.
  avconv: remove -psnr option.
  avconv: remove me_threshold option.
  avconv: move video_rc_override_string to options context.
  avconv: move frame pixel format to the options context.
  avconv: move frame aspect ratio to the options context.
  ...

Conflicts:
	avconv.c
	cmdutils_common_opts.h
	doc/avconv.texi
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 5a6f4a13 6cfed112
This diff is collapsed.
......@@ -730,6 +730,15 @@ int opt_pix_fmts(const char *opt, const char *arg)
return 0;
}
int show_sample_fmts(const char *opt, const char *arg)
{
int i;
char fmt_str[128];
for (i = -1; i < AV_SAMPLE_FMT_NB; i++)
printf("%s\n", av_get_sample_fmt_string(fmt_str, sizeof(fmt_str), i));
return 0;
}
int read_yesno(void)
{
int c = getchar();
......@@ -836,6 +845,26 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
return 0;
}
return 1;
} else if (*spec == 'p' && *(spec + 1) == ':') {
int prog_id, i, j;
char *endptr;
spec += 2;
prog_id = strtol(spec, &endptr, 0);
for (i = 0; i < s->nb_programs; i++) {
if (s->programs[i]->id != prog_id)
continue;
if (*endptr++ == ':') {
int stream_idx = strtol(endptr, NULL, 0);
return (stream_idx >= 0 && stream_idx < s->programs[i]->nb_stream_indexes &&
st->index == s->programs[i]->stream_index[stream_idx]);
}
for (j = 0; j < s->programs[i]->nb_stream_indexes; j++)
if (st->index == s->programs[i]->stream_index[j])
return 1;
}
return 0;
} else if (!*spec) /* empty specifier, matches everything */
return 1;
......
......@@ -289,6 +289,12 @@ int opt_protocols(const char *opt, const char *arg);
*/
int opt_pix_fmts(const char *opt, const char *arg);
/**
* Print a listing containing all the sample formats supported by the
* program.
*/
int show_sample_fmts(const char *opt, const char *arg);
/**
* Return a positive value if a line read from standard input
* starts with [yY], otherwise return 0.
......
......@@ -10,4 +10,5 @@
{ "protocols", OPT_EXIT, {(void*)opt_protocols}, "show available protocols" },
{ "filters", OPT_EXIT, {(void*)opt_filters }, "show available filters" },
{ "pix_fmts" , OPT_EXIT, {(void*)opt_pix_fmts }, "show available pixel formats" },
{ "sample_fmts", OPT_EXIT, {.func_arg = show_sample_fmts }, "show available audio sample formats" },
{ "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
This diff is collapsed.
......@@ -11,9 +11,38 @@ corresponding value to true. They can be set to false by prefixing
with "no" the option name, for example using "-nofoo" in the
commandline will set to false the boolean option with name "foo".
@section Stream specifiers
Some options are applied per-stream, e.g. bitrate or codec. Stream specifiers
are used to precisely specify which stream(s) does a given option belong to.
A stream specifier is a string generally appended to the option name and
separated from it by a colon. E.g. @code{-codec:a:1 ac3} option contains
@code{a:1} stream specifer, which matches the second audio stream. Therefore it
would select the ac3 codec for the second audio stream.
A stream specifier can match several stream, the option is then applied to all
of them. E.g. the stream specifier in @code{-b:a 128k} matches all audio
streams.
An empty stream specifier matches all streams, for example @code{-codec copy}
or @code{-codec: copy} would copy all the streams without reencoding.
Possible forms of stream specifiers are:
@table @option
@item @var{stream_index}
Matches the stream with this index. E.g. @code{-threads:1 4} would set the
thread count for the second stream to 4.
@item @var{stream_type}[:@var{stream_index}]
@var{stream_type} is one of: 'v' for video, 'a' for audio, 's' for subtitle and
'd' for data. If @var{stream_index} is given, then matches stream number
@var{stream_index} of this type. Otherwise matches all streams of this type.
@item @var{program_id}[:@var{stream_index}]
If @var{stream_index} is given, then matches stream number @var{stream_index} in
program with id @var{program_id}. Otherwise matches all streams in this program.
@end table
@section Generic options
These options are shared amongst the ff* tools.
These options are shared amongst the av* tools.
@table @option
......@@ -68,6 +97,9 @@ Show available libavfilter filters.
@item -pix_fmts
Show available pixel formats.
@item -sample_fmts
Show available sample formats.
@item -loglevel @var{loglevel}
Set the logging level used by the library.
@var{loglevel} is a number or a string containing one of the following values:
......@@ -114,19 +146,8 @@ muxer:
ffmpeg -i input.flac -id3v2_version 3 out.mp3
@end example
You can precisely specify which stream(s) should the codec AVOption apply to by
appending a stream specifier of the form
@option{[:@var{stream_type}][:@var{stream_index}]} to the option name.
@var{stream_type} is 'v' for video, 'a' for audio and 's' for subtitle streams.
@var{stream_index} is a global stream index when @var{stream_type} isn't
given, otherwise it counts streams of the given type only. As always, the index
is zero-based. For example
@example
-foo -- applies to all applicable streams
-foo:v -- applies to all video streams
-foo:a:2 -- applies to the third audio stream
-foo:0 -- applies to the first stream
@end example
All codec AVOptions are obviously per-stream, so the chapter on stream
specifiers applies to them
Note -nooption syntax cannot be used for boolean AVOptions, use -option
0/-option 1.
......
......@@ -449,6 +449,11 @@ encompassing your FFmpeg includes using @code{extern "C"}.
See @url{http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html#faq-32.3}
@section I'm using libavutil from within my C++ application but the compiler complains about 'UINT64_C' was not declared in this scope
Libav is a pure C project using C99 math features, in order to enable C++
to use them you have to append -D__STDC_CONSTANT_MACROS to your CXXFLAGS
@section I have a file in memory / a API different from *open/*read/ libc how do I use it with libavformat?
You have to implement a URLProtocol, see @file{libavformat/file.c} in
......
......@@ -68,7 +68,7 @@ specified for the inputs.
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
@include avtools-common-opts.texi
@section Main options
......
......@@ -28,7 +28,7 @@ various FFmpeg APIs.
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
@include avtools-common-opts.texi
@section Main options
......
......@@ -60,7 +60,7 @@ are prefixed by the string "TAG:".
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
@include avtools-common-opts.texi
@section Main options
......
......@@ -240,7 +240,7 @@ For example: @samp{http://localhost:8080/test.asf?date=2002-07-26T23:05:00}.
@chapter Options
@c man begin OPTIONS
@include fftools-common-opts.texi
@include avtools-common-opts.texi
@section Main options
......
This diff is collapsed.
......@@ -352,7 +352,7 @@ static const AVOption options[]={
#endif
{"qns", "quantizer noise shaping", OFFSET(quantizer_noise_shaping), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"threads", NULL, OFFSET(thread_count), FF_OPT_TYPE_INT, {.dbl = 1 }, INT_MIN, INT_MAX, V|E|D},
{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX},
{"me_threshold", "motion estimaton threshold", OFFSET(me_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"mb_threshold", "macroblock threshold", OFFSET(mb_threshold), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, INT_MIN, INT_MAX, V|E},
{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), FF_OPT_TYPE_INT, {.dbl = 0 }, INT_MIN, INT_MAX, V|E},
{"nssew", "nsse weight", OFFSET(nsse_weight), FF_OPT_TYPE_INT, {.dbl = 8 }, INT_MIN, INT_MAX, V|E},
......
......@@ -1321,7 +1321,9 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
tss->last_cc = cc;
if (!cc_ok) {
av_log(ts->stream, AV_LOG_WARNING, "Continuity Check Failed\n");
av_log(ts->stream, AV_LOG_WARNING,
"Continuity check failed for pid %d expected %d got %d\n",
pid, expected_cc, cc);
if(tss->type == MPEGTS_PES) {
PESContext *pc = tss->u.pes_filter.opaque;
pc->flags |= AV_PKT_FLAG_CORRUPT;
......@@ -1439,12 +1441,14 @@ static int handle_packets(MpegTSContext *ts, int nb_packets)
// av_dlog("Skipping after seek\n");
/* seek detected, flush pes buffer */
for (i = 0; i < NB_PID_MAX; i++) {
if (ts->pids[i] && ts->pids[i]->type == MPEGTS_PES) {
PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
av_freep(&pes->buffer);
if (ts->pids[i]) {
if (ts->pids[i]->type == MPEGTS_PES) {
PESContext *pes = ts->pids[i]->u.pes_filter.opaque;
av_freep(&pes->buffer);
pes->data_index = 0;
pes->state = MPEGTS_SKIP; /* skip until pes header */
}
ts->pids[i]->last_cc = -1;
pes->data_index = 0;
pes->state = MPEGTS_SKIP; /* skip until pes header */
}
}
}
......
......@@ -2320,8 +2320,15 @@ int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options)
//try to just open decoders, in case this is enough to get parameters
if(!has_codec_parameters(st->codec)){
if (codec && !st->codec->codec)
avcodec_open2(st->codec, codec, options ? &options[i] : NULL);
if (codec && !st->codec->codec){
AVDictionary *tmp = NULL;
if (options){
av_dict_copy(&tmp, options[i], 0);
av_dict_set(&tmp, "threads", 0, 0);
}
avcodec_open2(st->codec, codec, options ? &tmp : NULL);
av_dict_free(&tmp);
}
}
}
......
......@@ -28,11 +28,26 @@
#include "audioconvert.h"
static const char * const channel_names[] = {
"FL", "FR", "FC", "LFE", "BL", "BR", "FLC", "FRC",
"BC", "SL", "SR", "TC", "TFL", "TFC", "TFR", "TBL",
"TBC", "TBR",
[29] = "DL",
[30] = "DR",
[0] = "FL", /* front left */
[1] = "FR", /* front right */
[2] = "FC", /* front center */
[3] = "LFE", /* low frequency */
[4] = "BL", /* back left */
[5] = "BR", /* back right */
[6] = "FLC", /* front left-of-center */
[7] = "FRC", /* front right-of-center */
[8] = "BC", /* back-center */
[9] = "SL", /* side left */
[10] = "SR", /* side right */
[11] = "TC", /* top center */
[12] = "TFL", /* top front left */
[13] = "TFC", /* top front center */
[14] = "TFR", /* top front right */
[15] = "TBL", /* top back left */
[16] = "TBC", /* top back center */
[17] = "TBR", /* top back right */
[29] = "DL", /* downmix left */
[30] = "DR", /* downmix right */
};
static const char *get_channel_name(int channel_id)
......@@ -91,13 +106,14 @@ void av_get_channel_layout_string(char *buf, int buf_size,
snprintf(buf, buf_size, "%d channels", nb_channels);
if (channel_layout) {
int i,ch;
int i, ch;
av_strlcat(buf, " (", buf_size);
for(i=0,ch=0; i<64; i++) {
if ((channel_layout & (1L<<i))) {
for (i = 0, ch = 0; i < 64; i++) {
if ((channel_layout & (1L << i))) {
const char *name = get_channel_name(i);
if (name) {
if (ch>0) av_strlcat(buf, "|", buf_size);
if (ch > 0)
av_strlcat(buf, "|", buf_size);
av_strlcat(buf, name, buf_size);
}
ch++;
......
......@@ -14,7 +14,7 @@ eval do_$test=y
do_lavf()
{
file=${outfile}lavf.$1
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale 10 $2
do_avconv $file $DEC_OPTS -f image2 -vcodec pgmyuv -i $raw_src $DEC_OPTS -ar 44100 -f s16le -i $pcm_src $ENC_OPTS -b:a 64k -t 1 -qscale:v 10 $2
do_avconv_crc $file $DEC_OPTS -i $target_path/$file $3
}
......
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