Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 18 May 2012 22:38:21 +0000 (00:38 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 18 May 2012 22:52:25 +0000 (00:52 +0200)
* qatar/master:
  doc: Replace some @file tags by more suitable markup.
  fate: Set FUZZ factor of vorbis-13 test to 2.
  fate: Set FUZZ factor of (e)ac3-encode test to 3.
  fate: remove unused code from regressions-funcs.sh
  rtmp: Don't assume path points to a string of nonzero length
  avconv: fix behavior with -ss as an output option.

Conflicts:
doc/platform.texi
doc/protocols.texi
ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
doc/general.texi
doc/platform.texi
ffmpeg.c
libavformat/rtmpproto.c

  
  @chapter External libraries
  
 -Libav can be hooked up with a number of external libraries to add support
 +FFmpeg can be hooked up with a number of external libraries to add support
  for more formats. None of them are used by default, their use has to be
- explicitly requested by passing the appropriate flags to @file{./configure}.
+ explicitly requested by passing the appropriate flags to
+ @command{./configure}.
  
 +@section OpenJPEG
 +
 +FFmpeg can use the OpenJPEG libraries for encoding/decoding J2K videos.  Go to
 +@url{http://www.openjpeg.org/} to get the libraries and follow the installation
 +instructions.  To enable using OpenJPEG in FFmpeg, pass @code{--enable-libopenjpeg} to
 +@file{./configure}.
 +
 +
  @section OpenCORE and VisualOn libraries
  
  Spun off Google Android sources, OpenCore and VisualOn libraries provide
@@@ -26,12 -26,12 +26,12 @@@ to configure
  
  @section BSD
  
 -BSD make will not build Libav, you need to install and use GNU Make
 +BSD make will not build FFmpeg, you need to install and use GNU Make
- (@file{gmake}).
+ (@command{gmake}).
  
  @section (Open)Solaris
  
- GNU Make is required to build FFmpeg, so you have to invoke (@file{gmake}),
 -GNU Make is required to build Libav, so you have to invoke (@command{gmake}),
++GNU Make is required to build FFmpeg, so you have to invoke (@command{gmake}),
  standard Solaris Make will not work. When building with a non-c99 front-end
  (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
  or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
diff --cc ffmpeg.c
+++ b/ffmpeg.c
@@@ -1974,111 -1664,77 +1974,113 @@@ static int poll_filters(void
  {
      AVFilterBufferRef *picref;
      AVFrame *filtered_frame = NULL;
 -    int i, frame_size;
 +    int i, ret, ret_all;
 +    unsigned nb_success, nb_eof;
 +    int64_t frame_pts;
  
 -    for (i = 0; i < nb_output_streams; i++) {
 -        OutputStream *ost = output_streams[i];
 -        OutputFile    *of = output_files[ost->file_index];
 -        int ret = 0;
 +    while (1) {
 +        /* Reap all buffers present in the buffer sinks */
 +        for (i = 0; i < nb_output_streams; i++) {
 +            OutputStream *ost = output_streams[i];
 +            OutputFile    *of = output_files[ost->file_index];
 +            int ret = 0;
  
 -        if (!ost->filter || ost->is_past_recording_time)
 -            continue;
 +            if (!ost->filter || ost->is_past_recording_time)
 +                continue;
  
 -        if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
 -            return AVERROR(ENOMEM);
 -        } else
 -            avcodec_get_frame_defaults(ost->filtered_frame);
 -        filtered_frame = ost->filtered_frame;
 -
 -        while (ret >= 0) {
 -            if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
 -                !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
 -                ret = av_buffersink_read_samples(ost->filter->filter, &picref,
 -                                                 ost->st->codec->frame_size);
 -            else
 -                ret = av_buffersink_read(ost->filter->filter, &picref);
 +            if (!ost->filtered_frame && !(ost->filtered_frame = avcodec_alloc_frame())) {
 +                return AVERROR(ENOMEM);
 +            } else
 +                avcodec_get_frame_defaults(ost->filtered_frame);
 +            filtered_frame = ost->filtered_frame;
 +
 +            while (1) {
 +                AVRational ist_pts_tb = ost->filter->filter->inputs[0]->time_base;
 +                if (ost->enc->type == AVMEDIA_TYPE_AUDIO &&
 +                    !(ost->enc->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE))
 +                    ret = av_buffersink_read_samples(ost->filter->filter, &picref,
 +                                                    ost->st->codec->frame_size);
 +                else
 +#ifdef SINKA
 +                    ret = av_buffersink_read(ost->filter->filter, &picref);
 +#else
 +                    ret = av_buffersink_get_buffer_ref(ost->filter->filter, &picref,
 +                                                       AV_BUFFERSINK_FLAG_NO_REQUEST);
 +#endif
 +                if (ret < 0) {
 +                    if (ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
 +                        char buf[256];
 +                        av_strerror(ret, buf, sizeof(buf));
 +                        av_log(NULL, AV_LOG_WARNING,
 +                               "Error in av_buffersink_get_buffer_ref(): %s\n", buf);
 +                    }
 +                    break;
 +                }
 +                if (ost->enc->type == AVMEDIA_TYPE_VIDEO)
 +                    filtered_frame->pts = frame_pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
 +                else if (picref->pts != AV_NOPTS_VALUE)
 +                    filtered_frame->pts = frame_pts = av_rescale_q(picref->pts,
 +                                                    ost->filter->filter->inputs[0]->time_base,
 +                                                    ost->st->codec->time_base) -
 +                                        av_rescale_q(of->start_time,
 +                                                    AV_TIME_BASE_Q,
 +                                                    ost->st->codec->time_base);
 +                //if (ost->source_index >= 0)
 +                //    *filtered_frame= *input_streams[ost->source_index]->decoded_frame; //for me_threshold
 +
-                 if (of->start_time && filtered_frame->pts < of->start_time)
-                     return 0;
++                if (of->start_time && filtered_frame->pts < of->start_time) {
++                    avfilter_unref_buffer(picref);
++                    continue;
++                }
  
 -            if (ret < 0)
 -                break;
 +                switch (ost->filter->filter->inputs[0]->type) {
 +                case AVMEDIA_TYPE_VIDEO:
 +                    avfilter_fill_frame_from_video_buffer_ref(filtered_frame, picref);
 +                    filtered_frame->pts = frame_pts;
 +                    if (!ost->frame_aspect_ratio)
 +                        ost->st->codec->sample_aspect_ratio = picref->video->sample_aspect_ratio;
 +
 +                    do_video_out(of->ctx, ost, filtered_frame,
 +                                 same_quant ? ost->last_quality :
 +                                              ost->st->codec->global_quality);
 +                    break;
 +                case AVMEDIA_TYPE_AUDIO:
 +                    avfilter_copy_buf_props(filtered_frame, picref);
 +                    filtered_frame->pts = frame_pts;
 +                    do_audio_out(of->ctx, ost, filtered_frame);
 +                    break;
 +                default:
 +                    // TODO support subtitle filters
 +                    av_assert0(0);
 +                }
  
 -            avfilter_copy_buf_props(filtered_frame, picref);
 -            if (ost->enc->type == AVMEDIA_TYPE_VIDEO)
 -                filtered_frame->pts = av_rescale_q(picref->pts,
 -                                                   ost->filter->filter->inputs[0]->time_base,
 -                                                   AV_TIME_BASE_Q);
 -            else if (picref->pts != AV_NOPTS_VALUE)
 -                filtered_frame->pts = av_rescale_q(picref->pts,
 -                                                   ost->filter->filter->inputs[0]->time_base,
 -                                                   ost->st->codec->time_base) -
 -                                      av_rescale_q(of->start_time,
 -                                                   AV_TIME_BASE_Q,
 -                                                   ost->st->codec->time_base);
 -
 -            if (of->start_time && filtered_frame->pts < of->start_time) {
                  avfilter_unref_buffer(picref);
 -                continue;
              }
 -
 -            switch (ost->filter->filter->inputs[0]->type) {
 -            case AVMEDIA_TYPE_VIDEO:
 -                if (!ost->frame_aspect_ratio)
 -                    ost->st->codec->sample_aspect_ratio = picref->video->pixel_aspect;
 -
 -                do_video_out(of->ctx, ost, filtered_frame, &frame_size,
 -                             same_quant ? ost->last_quality :
 -                                          ost->st->codec->global_quality);
 -                if (vstats_filename && frame_size)
 -                    do_video_stats(of->ctx, ost, frame_size);
 -                break;
 -            case AVMEDIA_TYPE_AUDIO:
 -                do_audio_out(of->ctx, ost, filtered_frame);
 -                break;
 -            default:
 -                // TODO support subtitle filters
 -                av_assert0(0);
 +        }
 +        /* Request frames through all the graphs */
 +        ret_all = nb_success = nb_eof = 0;
 +        for (i = 0; i < nb_filtergraphs; i++) {
 +            ret = avfilter_graph_request_oldest(filtergraphs[i]->graph);
 +            if (!ret) {
 +                nb_success++;
 +            } else if (ret == AVERROR_EOF) {
 +                nb_eof++;
 +            } else if (ret != AVERROR(EAGAIN)) {
 +                char buf[256];
 +                av_strerror(ret, buf, sizeof(buf));
 +                av_log(NULL, AV_LOG_WARNING,
 +                       "Error in request_frame(): %s\n", buf);
 +                ret_all = ret;
              }
 -
 -            avfilter_unref_buffer(picref);
          }
 +        if (!nb_success)
 +            break;
 +        /* Try again if anything succeeded */
      }
 -    return 0;
 +    return nb_eof == nb_filtergraphs ? AVERROR_EOF : ret_all;
  }
  
 -static void print_report(int is_last_report, int64_t timer_start)
 +static void print_report(int is_last_report, int64_t timer_start, int64_t cur_time)
  {
      char buf[1024];
      OutputStream *ost;
Simple merge