Merge remote-tracking branch 'qatar/master'

* qatar/master:
  mpegvideo_enc: don't use deprecated avcodec_encode_video().
  cmdutils: refactor -codecs option.
  avconv: make -shortest a per-output file option.
  lavc: add avcodec_descriptor_get_by_name().
  lavc: add const to AVCodec* function parameters.
  swf(dec): replace CODEC_ID with AV_CODEC_ID
  dvenc: don't use deprecated AVCODEC_MAX_AUDIO_FRAME_SIZE
  rtmpdh: Do not generate the same private key every time when using libnettle
  rtp: remove ff_rtp_get_rtcp_file_handle().
  rtsp.c: use ffurl_get_multi_file_handle() instead of ff_rtp_get_rtcp_file_handle()
  avio: add (ff)url_get_multi_file_handle() for getting more than one fd
  h264: vdpau: fix crash with unsupported colorspace
  amrwbdec: Decode the fr_quality bit properly

Conflicts:
	Changelog
	cmdutils.c
	cmdutils_common_opts.h
	doc/ffmpeg.texi
	ffmpeg.c
	ffmpeg.h
	ffmpeg_opt.c
	libavcodec/h264.c
	libavcodec/options.c
	libavcodec/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer
2012-08-18 15:10:13 +02:00
24 changed files with 299 additions and 154 deletions

View File

@ -801,90 +801,127 @@ int opt_formats(const char *opt, const char *arg)
static char get_media_type_char(enum AVMediaType type)
{
static const char map[AVMEDIA_TYPE_NB] = {
[AVMEDIA_TYPE_VIDEO] = 'V',
[AVMEDIA_TYPE_AUDIO] = 'A',
[AVMEDIA_TYPE_DATA] = 'D',
[AVMEDIA_TYPE_SUBTITLE] = 'S',
[AVMEDIA_TYPE_ATTACHMENT] = 'T',
};
return type >= 0 && type < AVMEDIA_TYPE_NB && map[type] ? map[type] : '?';
switch (type) {
case AVMEDIA_TYPE_VIDEO: return 'V';
case AVMEDIA_TYPE_AUDIO: return 'A';
case AVMEDIA_TYPE_DATA: return 'D';
case AVMEDIA_TYPE_SUBTITLE: return 'S';
case AVMEDIA_TYPE_ATTACHMENT:return 'T';
default: return '?';
}
}
int opt_codecs(const char *opt, const char *arg)
static const AVCodec *next_codec_for_id(enum AVCodecID id, const AVCodec *prev,
int encoder)
{
AVCodec *p = NULL, *p2;
const char *last_name;
printf("Codecs:\n"
" D....... = Decoding supported\n"
" .E...... = Encoding supported\n"
" ..V..... = Video codec\n"
" ..A..... = Audio codec\n"
" ..S..... = Subtitle codec\n"
" ...S.... = Supports draw_horiz_band\n"
" ....D... = Supports direct rendering method 1\n"
" .....T.. = Supports weird frame truncation\n"
" ......F. = Supports frame-based multi-threaded decoding\n"
" ......S. = Supports slice-based multi-threaded decoding\n"
" ......B. = Supports both frame-based and slice-based multi-threaded decoding\n"
" .......F = Supports frame-based multi-threaded encoding\n"
" .......S = Supports slice-based multi-threaded encoding\n"
" .......B = Supports both frame-based and slice-based multi-threaded encoding\n"
" --------\n");
last_name= "000";
for (;;) {
int decode = 0;
int encode = 0;
int cap = 0;
while ((prev = av_codec_next(prev))) {
if (prev->id == id &&
(encoder ? av_codec_is_encoder(prev) : av_codec_is_decoder(prev)))
return prev;
}
return NULL;
}
p2 = NULL;
while ((p = av_codec_next(p))) {
if ((p2 == NULL || strcmp(p->name, p2->name) < 0) &&
strcmp(p->name, last_name) > 0) {
p2 = p;
decode = encode = cap = 0;
}
if (p2 && strcmp(p->name, p2->name) == 0) {
if (av_codec_is_decoder(p))
decode = 1;
if (av_codec_is_encoder(p))
encode = 1;
cap |= p->capabilities;
static void print_codecs_for_id(enum AVCodecID id, int encoder)
{
const AVCodec *codec = NULL;
printf(" (%s: ", encoder ? "encoders" : "decoders");
while ((codec = next_codec_for_id(id, codec, encoder)))
printf("%s ", codec->name);
printf(")");
}
int show_codecs(const char *opt, const char *arg)
{
const AVCodecDescriptor *desc = NULL;
printf("Codecs:\n"
" D... = Decoding supported\n"
" .E.. = Encoding supported\n"
" ..V. = Video codec\n"
" ..A. = Audio codec\n"
" ..S. = Subtitle codec\n"
" ...I = Intra frame-only codec\n"
" -----\n");
while ((desc = avcodec_descriptor_next(desc))) {
const AVCodec *codec = NULL;
printf(avcodec_find_decoder(desc->id) ? "D" : ".");
printf(avcodec_find_encoder(desc->id) ? "E" : ".");
printf("%c", get_media_type_char(desc->type));
printf((desc->props & AV_CODEC_PROP_INTRA_ONLY) ? "I" : ".");
printf(" %-20s %s", desc->name, desc->long_name ? desc->long_name : "");
/* print decoders/encoders when there's more than one or their
* names are different from codec name */
while ((codec = next_codec_for_id(desc->id, codec, 0))) {
if (strcmp(codec->name, desc->name)) {
print_codecs_for_id(desc->id, 0);
break;
}
}
codec = NULL;
while ((codec = next_codec_for_id(desc->id, codec, 1))) {
if (strcmp(codec->name, desc->name)) {
print_codecs_for_id(desc->id, 1);
break;
}
}
if (p2 == NULL)
break;
last_name = p2->name;
printf(" %s%s%c%s%s%s%s%s %-15s %s",
decode ? "D" : (/* p2->decoder ? "d" : */ " "),
encode ? "E" : " ",
get_media_type_char(p2->type),
cap & CODEC_CAP_DRAW_HORIZ_BAND ? "S" : " ",
cap & CODEC_CAP_DR1 ? "D" : " ",
cap & CODEC_CAP_TRUNCATED ? "T" : " ",
decode ?
cap & CODEC_CAP_FRAME_THREADS ? cap & CODEC_CAP_SLICE_THREADS ? "B" : "F" :
cap & CODEC_CAP_SLICE_THREADS ? "S" : " "
: " ",
encode ?
cap & CODEC_CAP_FRAME_THREADS ? cap & CODEC_CAP_SLICE_THREADS ? "B" : "F" :
cap & CODEC_CAP_SLICE_THREADS ? "S" : " "
: " ",
p2->name,
p2->long_name ? p2->long_name : "");
#if 0
if (p2->decoder && decode == 0)
printf(" use %s for decoding", p2->decoder->name);
#endif
printf("\n");
}
printf("\n");
printf("Note, the names of encoders and decoders do not always match, so there are\n"
"several cases where the above table shows encoder only or decoder only entries\n"
"even though both encoding and decoding are supported. For example, the h263\n"
"decoder corresponds to the h263 and h263p encoders, for file formats it is even\n"
"worse.\n");
return 0;
}
static void print_codecs(int encoder)
{
const AVCodecDescriptor *desc = NULL;
printf("%s:\n"
" V..... = Video\n"
" A..... = Audio\n"
" S..... = Subtitle\n"
" .F.... = Frame-level multithreading\n"
" ..S... = Slice-level multithreading\n"
" ...X.. = Codec is experimental\n"
" ....B. = Supports draw_horiz_band\n"
" .....D = Supports direct rendering method 1\n"
" ------\n",
encoder ? "Encoders" : "Decoders");
while ((desc = avcodec_descriptor_next(desc))) {
const AVCodec *codec = NULL;
while ((codec = next_codec_for_id(desc->id, codec, encoder))) {
printf("%c", get_media_type_char(desc->type));
printf((codec->capabilities & CODEC_CAP_FRAME_THREADS) ? "F" : ".");
printf((codec->capabilities & CODEC_CAP_SLICE_THREADS) ? "S" : ".");
printf((codec->capabilities & CODEC_CAP_EXPERIMENTAL) ? "X" : ".");
printf((codec->capabilities & CODEC_CAP_DRAW_HORIZ_BAND)?"B" : ".");
printf((codec->capabilities & CODEC_CAP_DR1) ? "D" : ".");
printf(" %-20s %s", codec->name, codec->long_name ? codec->long_name : "");
if (strcmp(codec->name, desc->name))
printf(" (codec %s)", desc->name);
printf("\n");
}
}
}
int show_decoders(const char *opt, const char *arg)
{
print_codecs(0);
return 0;
}
int show_encoders(const char *opt, const char *arg)
{
print_codecs(1);
return 0;
}