Merge remote-tracking branch 'qatar/master'

* qatar/master:
  log: Only include unistd.h if configure found it
  ape: create audio stream before reading tags.
  mov: make a length variable larger.
  image2: Add "start_number" private option to the demuxer
  image2: Add "start_number" private option to the muxer
  avconv: remove a forgotten debugging printf.
  avconv: use more descriptive names for hardcoded filters.
  avconv: remove redundant handling of async.
  doc/filters: fix typo.
  h264: use asm cabac reader under a generic condition

Conflicts:
	ffmpeg.c
	libavformat/img2dec.c
	libavformat/img2enc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-06-24 21:34:54 +02:00
commit 244682dd08
9 changed files with 52 additions and 42 deletions

View File

@ -698,7 +698,7 @@ Desired output channel layout. Defaults to stereo.
Map channels from inputs to output. The argument is a comma-separated list of
mappings, each in the @code{@var{input_idx}.@var{in_channel}-@var{out_channel}}
form. @var{input_idx} is the 0-based index of the input stream. @var{in_channel}
can be either the name of the input channel (e.g. FR for front left) or its
can be either the name of the input channel (e.g. FL for front left) or its
index in the specified input stream. @var{out_channel} is the name of the output
channel.
@end table

View File

@ -783,17 +783,13 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
AVFilterContext *last_filter = out->filter_ctx;
int pad_idx = out->pad_idx;
int ret;
char name[255];
AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
#if FF_API_OLD_VSINK_API
snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("buffersink"),
"ffmpeg_buffersink", NULL, NULL, fg->graph);
#else
ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("buffersink"),
"ffmpeg_buffersink", NULL, NULL/*buffersink_params*/, fg->graph);
#endif
name, NULL, NULL/*buffersink_params*/, fg->graph);
av_freep(&buffersink_params);
if (ret < 0)
@ -807,8 +803,10 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
codec->width,
codec->height,
(unsigned)ost->sws_flags);
snprintf(name, sizeof(name), "scaler for output stream %d:%d",
ost->file_index, ost->index);
if ((ret = avfilter_graph_create_filter(&filter, avfilter_get_by_name("scale"),
NULL, args, NULL, fg->graph)) < 0)
name, args, NULL, fg->graph)) < 0)
return ret;
if ((ret = avfilter_link(last_filter, pad_idx, filter, 0)) < 0)
return ret;
@ -819,6 +817,8 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
if ((pix_fmts = choose_pix_fmts(ost))) {
AVFilterContext *filter;
snprintf(name, sizeof(name), "pixel format for output stream %d:%d",
ost->file_index, ost->index);
if ((ret = avfilter_graph_create_filter(&filter,
avfilter_get_by_name("format"),
"format", pix_fmts, NULL,
@ -838,8 +838,10 @@ static int configure_output_video_filter(FilterGraph *fg, OutputFilter *ofilter,
snprintf(args, sizeof(args), "fps=%d/%d", ost->frame_rate.num,
ost->frame_rate.den);
snprintf(name, sizeof(name), "fps for output stream %d:%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&fps, avfilter_get_by_name("fps"),
"fps", args, NULL, fg->graph);
name, args, NULL, fg->graph);
if (ret < 0)
return ret;
@ -863,11 +865,14 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
AVFilterContext *last_filter = out->filter_ctx;
int pad_idx = out->pad_idx;
char *sample_fmts, *sample_rates, *channel_layouts;
char name[255];
int ret;
snprintf(name, sizeof(name), "output stream %d:%d", ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&ofilter->filter,
avfilter_get_by_name("abuffersink_old"),
"ffmpeg_abuffersink_old", NULL, NULL, fg->graph);
name, NULL, NULL, fg->graph);
if (ret < 0)
return ret;
@ -930,9 +935,11 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
av_freep(&sample_rates);
av_freep(&channel_layouts);
snprintf(name, sizeof(name), "audio format for output stream %d:%d",
ost->file_index, ost->index);
ret = avfilter_graph_create_filter(&format,
avfilter_get_by_name("aformat"),
"aformat", args, NULL, fg->graph);
name, args, NULL, fg->graph);
if (ret < 0)
return ret;
@ -944,15 +951,6 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter,
pad_idx = 0;
}
if (audio_sync_method > 0 && 0) {
char args[256] = {0};
av_strlcatf(args, sizeof(args), "min_comp=0.001:min_hard_comp=%f", audio_drift_threshold);
if (audio_sync_method > 1)
av_strlcatf(args, sizeof(args), ":max_soft_comp=%d", -audio_sync_method);
AUTO_INSERT_FILTER("-async", "aresample", args);
}
if (audio_volume != 256 && 0) {
char args[256];
@ -1008,6 +1006,7 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
ist->st->r_frame_rate;
AVRational sar;
AVBPrint args;
char name[255];
int pad_idx = in->pad_idx;
int ret;
@ -1025,17 +1024,21 @@ static int configure_input_video_filter(FilterGraph *fg, InputFilter *ifilter,
SWS_BILINEAR + ((ist->st->codec->flags&CODEC_FLAG_BITEXACT) ? SWS_BITEXACT:0));
if (fr.num && fr.den)
av_bprintf(&args, ":frame_rate=%d/%d", fr.num, fr.den);
snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&ifilter->filter, filter, in->name,
if ((ret = avfilter_graph_create_filter(&ifilter->filter, filter, name,
args.str, NULL, fg->graph)) < 0)
return ret;
if (ist->framerate.num) {
AVFilterContext *setpts;
snprintf(name, sizeof(name), "force CFR for input from stream %d:%d",
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&setpts,
avfilter_get_by_name("setpts"),
"setpts", "N", NULL,
name, "N", NULL,
fg->graph)) < 0)
return ret;
@ -1058,7 +1061,7 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
AVFilter *filter = avfilter_get_by_name("abuffer");
InputStream *ist = ifilter->ist;
int pad_idx = in->pad_idx;
char args[255];
char args[255], name[255];
int ret;
snprintf(args, sizeof(args), "time_base=%d/%d:sample_rate=%d:sample_fmt=%s"
@ -1067,9 +1070,11 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
ist->st->codec->sample_rate,
av_get_sample_fmt_name(ist->st->codec->sample_fmt),
ist->st->codec->channel_layout);
snprintf(name, sizeof(name), "graph %d input from stream %d:%d", fg->index,
ist->file_index, ist->st->index);
if ((ret = avfilter_graph_create_filter(&ifilter->filter, filter,
in->name, args, NULL,
name, args, NULL,
fg->graph)) < 0)
return ret;
@ -1079,9 +1084,11 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter,
av_log(NULL, AV_LOG_INFO, opt_name " is forwarded to lavfi " \
"similarly to -af " filter_name "=%s.\n", arg); \
\
snprintf(name, sizeof(name), "graph %d %s for input stream %d:%d", \
fg->index, filter_name, ist->file_index, ist->st->index); \
ret = avfilter_graph_create_filter(&filt_ctx, \
avfilter_get_by_name(filter_name), \
filter_name, arg, NULL, fg->graph); \
name, arg, NULL, fg->graph); \
if (ret < 0) \
return ret; \
\
@ -5260,7 +5267,6 @@ loop_end:
} else if (ret < 0)
exit_program(1);
}
printf("ret %d, stream_spec %s\n", ret, stream_spec);
}
else {
switch (type) {

View File

@ -1652,14 +1652,14 @@ decode_cabac_residual_internal(H264Context *h, DCTELEM *block,
index[coeff_count++] = last;\
}
const uint8_t *sig_off = significant_coeff_flag_offset_8x8[MB_FIELD];
#if ARCH_X86 && HAVE_7REGS
coeff_count= decode_significance_8x8_x86(CC, significant_coeff_ctx_base, index,
#ifdef decode_significance
coeff_count = decode_significance_8x8(CC, significant_coeff_ctx_base, index,
last_coeff_ctx_base, sig_off);
} else {
if (is_dc && chroma422) { // dc 422
DECODE_SIGNIFICANCE(7, sig_coeff_offset_dc[last], sig_coeff_offset_dc[last]);
} else {
coeff_count= decode_significance_x86(CC, max_coeff, significant_coeff_ctx_base, index,
coeff_count = decode_significance(CC, max_coeff, significant_coeff_ctx_base, index,
last_coeff_ctx_base-significant_coeff_ctx_base);
}
#else

View File

@ -37,6 +37,7 @@
//FIXME use some macros to avoid duplicating get_cabac (cannot be done yet
//as that would make optimization work hard)
#if HAVE_7REGS
#define decode_significance decode_significance_x86
static int decode_significance_x86(CABACContext *c, int max_coeff,
uint8_t *significant_coeff_ctx_base,
int *index, x86_reg last_off){
@ -105,6 +106,7 @@ static int decode_significance_x86(CABACContext *c, int max_coeff,
return coeff_count;
}
#define decode_significance_8x8 decode_significance_8x8_x86
static int decode_significance_8x8_x86(CABACContext *c,
uint8_t *significant_coeff_ctx_base,
int *index, uint8_t *last_coeff_ctx_base, const uint8_t *sig_off){

View File

@ -315,12 +315,6 @@ static int ape_read_header(AVFormatContext * s)
ape_dumpinfo(s, ape);
/* try to read APE tags */
if (pb->seekable) {
ff_ape_parse_tag(s);
avio_seek(pb, 0, SEEK_SET);
}
av_log(s, AV_LOG_DEBUG, "Decoding file - v%d.%02d, compression level %"PRIu16"\n",
ape->fileversion / 1000, (ape->fileversion % 1000) / 10,
ape->compressiontype);
@ -357,6 +351,12 @@ static int ape_read_header(AVFormatContext * s)
pts += ape->blocksperframe / MAC_SUBFRAME_SIZE;
}
/* try to read APE tags */
if (pb->seekable) {
ff_ape_parse_tag(s);
avio_seek(pb, 0, SEEK_SET);
}
return 0;
}

View File

@ -116,7 +116,7 @@ static int find_image_range(int *pfirst_index, int *plast_index,
int range, last_index, range1, first_index;
/* find the first image */
for(first_index = max_start; first_index < max_start + 5; first_index++) {
for (first_index = max_start; first_index < max_start + 5; first_index++) {
if (av_get_frame_filename(buf, sizeof(buf), path, first_index) < 0){
*pfirst_index =
*plast_index = 1;
@ -252,7 +252,8 @@ static int read_header(AVFormatContext *s1)
last_index = s->globstate.gl_pathc - 1;
#endif
} else {
if (find_image_range(&first_index, &last_index, s->path, s->start_number - 1) < 0)
if (find_image_range(&first_index, &last_index, s->path,
s->start_number - 1) < 0)
return AVERROR(ENOENT);
}
s->img_first = first_index;

View File

@ -27,6 +27,7 @@
#include "avformat.h"
#include "avio_internal.h"
#include "internal.h"
#include "libavutil/opt.h"
typedef struct {
const AVClass *class; /**< Class for private options. */
@ -140,7 +141,6 @@ static const AVOption muxoptions[] = {
{ NULL },
};
#if CONFIG_IMAGE2_MUXER
static const AVClass img2mux_class = {
.class_name = "image2 muxer",
@ -148,6 +148,7 @@ static const AVClass img2mux_class = {
.option = muxoptions,
.version = LIBAVUTIL_VERSION_INT,
};
AVOutputFormat ff_image2_muxer = {
.name = "image2",
.long_name = NULL_IF_CONFIG_SMALL("image2 sequence"),

View File

@ -175,8 +175,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
#endif
char str[1024], key2[16], language[4] = {0};
const char *key = NULL;
uint16_t str_size, langcode = 0;
uint32_t data_type = 0;
uint16_t langcode = 0;
uint32_t data_type = 0, str_size;
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
switch (atom.type) {

View File

@ -26,7 +26,7 @@
#include "config.h"
#if HAVE_ISATTY
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <stdlib.h>