Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Mar 2012 01:04:18 +0000 (02:04 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 14 Mar 2012 01:10:11 +0000 (02:10 +0100)
* qatar/master:
  doc/general: update supported devices table.
  doc/general: add missing @tab to codecs table.
  h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction.
  avconv: reindent
  avconv: link '-passlogfile' option to libx264 'stats' AVOption.
  libx264: add 'stats' private option for setting 2pass stats filename.
  libx264: fix help text for slice-max-size option.
  http: Clear the auth state on redirects
  http: Retry auth if it failed due to being stale
  rtsp: Resend new keepalive commands if they used stale auth
  rtsp: Retry authentication if failed due to being stale
  httpauth: Parse the stale field in digest auth
  dxva2_vc1: pass the overlap flag to the decoder
  dxva2_vc1: fix decoding of BI frames
  FATE: add shorthand to wavpack test
  dfa: convert to bytestream2 API
  anm decoder: move buffer allocation from decode_init() to decode_frame()
  h264: improve parsing of broken AVC SPS

Conflicts:
ffmpeg.c
libavcodec/anm.c
libavcodec/dfa.c
libavcodec/h264.c
libavcodec/h264_direct.c
libavcodec/h264_ps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
12 files changed:
1  2 
doc/general.texi
ffmpeg.c
libavcodec/dfa.c
libavcodec/h264.c
libavcodec/h264_direct.c
libavcodec/h264_ps.c
libavcodec/libx264.c
libavformat/http.c
libavformat/httpauth.c
libavformat/httpauth.h
libavformat/rtsp.c
libavformat/rtspdec.c

Simple merge
diff --cc ffmpeg.c
+++ b/ffmpeg.c
@@@ -2651,32 -2490,34 +2651,35 @@@ static int transcode_init(OutputFile *o
                  break;
              }
              /* two pass mode */
-             if (codec->codec_id != CODEC_ID_H264 &&
-                 (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
 -            if ((codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2))) {
++            if (codec->flags & (CODEC_FLAG_PASS1 | CODEC_FLAG_PASS2)) {
                  char logfilename[1024];
                  FILE *f;
  
                  snprintf(logfilename, sizeof(logfilename), "%s-%d.log",
                           pass_logfilename_prefix ? pass_logfilename_prefix : DEFAULT_PASS_LOGFILENAME_PREFIX,
                           i);
-                 if (codec->flags & CODEC_FLAG_PASS2) {
-                     char  *logbuffer;
-                     size_t logbuffer_size;
-                     if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
-                         av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
-                                logfilename);
-                         exit_program(1);
+                 if (!strcmp(ost->enc->name, "libx264")) {
+                     av_dict_set(&ost->opts, "stats", logfilename, AV_DICT_DONT_OVERWRITE);
+                 } else {
 -                    if (codec->flags & CODEC_FLAG_PASS1) {
 -                        f = fopen(logfilename, "wb");
 -                        if (!f) {
 -                            av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
 -                                   logfilename, strerror(errno));
 -                            exit_program(1);
 -                        }
 -                        ost->logfile = f;
 -                    } else {
++                    if (codec->flags & CODEC_FLAG_PASS2) {
+                         char  *logbuffer;
+                         size_t logbuffer_size;
+                         if (cmdutils_read_file(logfilename, &logbuffer, &logbuffer_size) < 0) {
+                             av_log(NULL, AV_LOG_FATAL, "Error reading log file '%s' for pass-2 encoding\n",
 -                                   logfilename);
++                                logfilename);
+                             exit_program(1);
+                         }
+                         codec->stats_in = logbuffer;
                      }
-                     codec->stats_in = logbuffer;
-                 }
-                 if (codec->flags & CODEC_FLAG_PASS1) {
-                     f = fopen(logfilename, "wb");
-                     if (!f) {
-                         av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
-                                logfilename, strerror(errno));
-                         exit_program(1);
++                    if (codec->flags & CODEC_FLAG_PASS1) {
++                        f = fopen(logfilename, "wb");
++                        if (!f) {
++                            av_log(NULL, AV_LOG_FATAL, "Cannot write log file '%s' for pass-1 encoding: %s\n",
++                                logfilename, strerror(errno));
++                            exit_program(1);
++                        }
++                        ost->logfile = f;
 +                    }
-                     ost->logfile = f;
                  }
              }
          }
@@@ -65,10 -61,8 +61,10 @@@ static int decode_tsw1(GetByteContext *
      int v, count, segments;
      unsigned offset;
  
-     segments = bytestream_get_le32(&src);
-     offset   = bytestream_get_le32(&src);
+     segments = bytestream2_get_le32(gb);
+     offset   = bytestream2_get_le32(gb);
 +    if (segments == 0 && offset == frame_end - frame)
 +        return 0; // skip frame
      if (frame_end - frame <= offset)
          return -1;
      frame += offset;
@@@ -338,10 -323,9 +325,9 @@@ static int dfa_decode_frame(AVCodecCont
              break;
          if (chunk_type == 1) {
              pal_elems = FFMIN(chunk_size / 3, 256);
-             tmp_buf = buf;
              for (i = 0; i < pal_elems; i++) {
-                 s->pal[i] = bytestream_get_be24(&tmp_buf) << 2;
+                 s->pal[i] = bytestream2_get_be24(&gb) << 2;
 -                s->pal[i] |= (s->pal[i] >> 6) & 0x333;
 +                s->pal[i] |= 0xFF << 24 | (s->pal[i] >> 6) & 0x30303;
              }
              s->pic.palette_has_changed = 1;
          } else if (chunk_type <= 9) {
@@@ -3967,10 -3925,12 +3967,10 @@@ static int decode_nal_units(H264Contex
              break;
          case NAL_SPS:
              init_get_bits(&s->gb, ptr, bit_length);
-             if(ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? (nalsize != consumed) && nalsize : 1)){
 -            if (ff_h264_decode_seq_parameter_set(h) < 0 &&
 -                h->is_avc && (nalsize != consumed) && nalsize) {
 -                av_log(h->s.avctx, AV_LOG_DEBUG, "SPS decoding failure, "
 -                       "try parsing the coomplete NAL\n");
 -                init_get_bits(&s->gb, buf + buf_index + 1 - consumed,
 -                              8 * (nalsize - 1));
++            if (ff_h264_decode_seq_parameter_set(h) < 0 && (h->is_avc ? (nalsize != consumed) && nalsize : 1)){
 +                av_log(h->s.avctx, AV_LOG_DEBUG, "SPS decoding failure, trying alternative mode\n");
 +                if(h->is_avc) av_assert0(next_avc - buf_index + consumed == nalsize);
-                 init_get_bits(&s->gb, &buf[buf_index + 1 - consumed], 8*(next_avc - buf_index + consumed));
++                init_get_bits(&s->gb, &buf[buf_index + 1 - consumed], 8*(next_avc - buf_index + consumed - 1));
                  ff_h264_decode_seq_parameter_set(h);
              }
  
Simple merge
@@@ -251,9 -237,9 +251,10 @@@ static inline int decode_vui_parameters
              return -1;
          }
      }
-     if(get_bits_left(&s->gb) < 0){
++
+     if (get_bits_left(&s->gb) < 0) {
          av_log(h->s.avctx, AV_LOG_ERROR, "Overread VUI by %d bits\n", -get_bits_left(&s->gb));
-         return -1;
+         return AVERROR_INVALIDDATA;
      }
  
      return 0;
@@@ -41,11 -41,7 +41,10 @@@ typedef struct X264Context 
      char *preset;
      char *tune;
      char *profile;
 +    char *level;
      int fastfirstpass;
-     char *stats;
 +    char *wpredp;
 +    char *x264opts;
      float crf;
      float crf_max;
      int cqp;
Simple merge
Simple merge
Simple merge
Simple merge
Simple merge