Merge commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867'
authorMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Aug 2014 19:21:14 +0000 (21:21 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Fri, 15 Aug 2014 19:26:12 +0000 (21:26 +0200)
* commit '4b1f5e5090abed6c618c8ba380cd7d28d140f867':
  cosmetics: Write NULL pointer inequality checks more compactly

Conflicts:
libavcodec/dvdsubdec.c
libavcodec/h263dec.c
libavcodec/libxvid.c
libavcodec/rv10.c
libavcodec/utils.c
libavformat/format.c
libavformat/matroskadec.c
libavformat/segment.c
libavutil/opt.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
21 files changed:
1  2 
cmdutils.c
libavcodec/h263dec.c
libavcodec/h264_refs.c
libavcodec/libvpxenc.c
libavcodec/libxvid.c
libavcodec/mpeg12dec.c
libavcodec/qdm2.c
libavcodec/rv10.c
libavcodec/rv34.c
libavcodec/utils.c
libavcodec/vc1dec.c
libavformat/avio.c
libavformat/http.c
libavformat/matroskadec.c
libavformat/movenc.c
libavformat/rtmpproto.c
libavformat/tls.c
libavformat/url.c
libavutil/opt.c
tests/audiogen.c
tools/ismindex.c

diff --cc cmdutils.c
Simple merge
@@@ -656,35 -624,17 +656,35 @@@ frame_end
      if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
          if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
              return ret;
 -        ff_print_debug_info(s, s->current_picture_ptr);
 +        ff_print_debug_info(s, s->current_picture_ptr, pict);
 +        ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
-     } else if (s->last_picture_ptr != NULL) {
+     } else if (s->last_picture_ptr) {
          if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
              return ret;
 -        ff_print_debug_info(s, s->last_picture_ptr);
 +        ff_print_debug_info(s, s->last_picture_ptr, pict);
 +        ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
      }
  
 -    if (s->last_picture_ptr || s->low_delay)
 +    if (s->last_picture_ptr || s->low_delay) {
 +        if (   pict->format == AV_PIX_FMT_YUV420P
 +            && (s->codec_tag == AV_RL32("GEOV") || s->codec_tag == AV_RL32("GEOX"))) {
 +            int x, y, p;
 +            av_frame_make_writable(pict);
 +            for (p=0; p<3; p++) {
 +                int w = FF_CEIL_RSHIFT(pict-> width, !!p);
 +                int h = FF_CEIL_RSHIFT(pict->height, !!p);
 +                int linesize = pict->linesize[p];
 +                for (y=0; y<(h>>1); y++)
 +                    for (x=0; x<w; x++)
 +                        FFSWAP(int,
 +                               pict->data[p][x + y*linesize],
 +                               pict->data[p][x + (h-1-y)*linesize]);
 +            }
 +        }
          *got_frame = 1;
 +    }
  
 -    if (ret && (avctx->err_recognition & AV_EF_EXPLODE))
 +    if (slice_ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
          return ret;
      else
          return get_consumed_bytes(s, buf_size);
Simple merge
Simple merge
@@@ -784,24 -769,16 +784,24 @@@ static int xvid_encode_frame(AVCodecCon
  static av_cold int xvid_encode_close(AVCodecContext *avctx) {
      struct xvid_context *x = avctx->priv_data;
  
 -    xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
 +    if(x->encoder_handle)
 +        xvid_encore(x->encoder_handle, XVID_ENC_DESTROY, NULL, NULL);
 +    x->encoder_handle = NULL;
  
      av_freep(&avctx->extradata);
-     if( x->twopassbuffer != NULL ) {
+     if (x->twopassbuffer) {
 -        av_free(x->twopassbuffer);
 -        av_free(x->old_twopassbuffer);
 +        av_freep(&x->twopassbuffer);
 +        av_freep(&x->old_twopassbuffer);
 +        avctx->stats_out = NULL;
 +    }
 +    if (x->twopassfd>=0) {
 +        unlink(x->twopassfile);
 +        close(x->twopassfd);
 +        x->twopassfd = -1;
      }
 -    av_free(x->twopassfile);
 -    av_free(x->intra_matrix);
 -    av_free(x->inter_matrix);
 +    av_freep(&x->twopassfile);
 +    av_freep(&x->intra_matrix);
 +    av_freep(&x->inter_matrix);
  
      return 0;
  }
Simple merge
Simple merge
@@@ -767,13 -744,11 +767,13 @@@ static int rv10_decode_frame(AVCodecCon
          if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
              if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
                  return ret;
 -            ff_print_debug_info(s, s->current_picture_ptr);
 +            ff_print_debug_info(s, s->current_picture_ptr, pict);
 +            ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
-         } else if (s->last_picture_ptr != NULL) {
+         } else if (s->last_picture_ptr) {
              if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
                  return ret;
 -            ff_print_debug_info(s, s->last_picture_ptr);
 +            ff_print_debug_info(s, s->last_picture_ptr, pict);
 +            ff_mpv_export_qp_table(s, pict,s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
          }
  
          if (s->last_picture_ptr || s->low_delay) {
@@@ -1603,14 -1589,12 +1603,14 @@@ static int finish_frame(AVCodecContext 
      if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
          if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
              return ret;
 -        ff_print_debug_info(s, s->current_picture_ptr);
 +        ff_print_debug_info(s, s->current_picture_ptr, pict);
 +        ff_mpv_export_qp_table(s, pict, s->current_picture_ptr, FF_QSCALE_TYPE_MPEG1);
          got_picture = 1;
-     } else if (s->last_picture_ptr != NULL) {
+     } else if (s->last_picture_ptr) {
          if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
              return ret;
 -        ff_print_debug_info(s, s->last_picture_ptr);
 +        ff_print_debug_info(s, s->last_picture_ptr, pict);
 +        ff_mpv_export_qp_table(s, pict, s->last_picture_ptr, FF_QSCALE_TYPE_MPEG1);
          got_picture = 1;
      }
  
Simple merge
@@@ -6227,12 -6112,12 +6227,12 @@@ image
          if (s->pict_type == AV_PICTURE_TYPE_B || s->low_delay) {
              if ((ret = av_frame_ref(pict, s->current_picture_ptr->f)) < 0)
                  goto err;
 -            ff_print_debug_info(s, s->current_picture_ptr);
 +            ff_print_debug_info(s, s->current_picture_ptr, pict);
              *got_frame = 1;
-         } else if (s->last_picture_ptr != NULL) {
+         } else if (s->last_picture_ptr) {
              if ((ret = av_frame_ref(pict, s->last_picture_ptr->f)) < 0)
                  goto err;
 -            ff_print_debug_info(s, s->last_picture_ptr);
 +            ff_print_debug_info(s, s->last_picture_ptr, pict);
              *got_frame = 1;
          }
      }
Simple merge
Simple merge
@@@ -1735,28 -1578,16 +1735,28 @@@ static int matroska_parse_tracks(AVForm
          }
  
          st = track->stream = avformat_new_stream(s, NULL);
 -        if (!st)
 +        if (!st) {
 +            av_free(key_id_base64);
              return AVERROR(ENOMEM);
 +        }
 +
 +        if (key_id_base64) {
 +            /* export encryption key id as base64 metadata tag */
 +            av_dict_set(&st->metadata, "enc_key_id", key_id_base64, 0);
 +            av_freep(&key_id_base64);
 +        }
  
          if (!strcmp(track->codec_id, "V_MS/VFW/FOURCC") &&
 -            track->codec_priv.size >= 40                &&
 +             track->codec_priv.size >= 40               &&
-             track->codec_priv.data != NULL) {
+             track->codec_priv.data) {
              track->ms_compat    = 1;
 -            track->video.fourcc = AV_RL32(track->codec_priv.data + 16);
 +            bit_depth           = AV_RL16(track->codec_priv.data + 14);
 +            fourcc              = AV_RL32(track->codec_priv.data + 16);
              codec_id            = ff_codec_get_id(ff_codec_bmp_tags,
 -                                                  track->video.fourcc);
 +                                                  fourcc);
 +            if (!codec_id)
 +                codec_id        = ff_codec_get_id(ff_codec_movvideo_tags,
 +                                                  fourcc);
              extradata_offset    = 40;
          } else if (!strcmp(track->codec_id, "A_MS/ACM") &&
                     track->codec_priv.size >= 14         &&
                  return ret;
              codec_id         = st->codec->codec_id;
              extradata_offset = FFMIN(track->codec_priv.size, 18);
 +        } else if (!strcmp(track->codec_id, "A_QUICKTIME")
 +                   && (track->codec_priv.size >= 86)
 +                   && (track->codec_priv.data != NULL)) {
 +            fourcc = AV_RL32(track->codec_priv.data + 4);
 +            codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
 +            if (ff_codec_get_id(ff_codec_movaudio_tags, AV_RL32(track->codec_priv.data))) {
 +                fourcc = AV_RL32(track->codec_priv.data);
 +                codec_id = ff_codec_get_id(ff_codec_movaudio_tags, fourcc);
 +            }
          } else if (!strcmp(track->codec_id, "V_QUICKTIME") &&
 -                   (track->codec_priv.size >= 86)          &&
 +                   (track->codec_priv.size >= 21)          &&
-                    (track->codec_priv.data != NULL)) {
+                    (track->codec_priv.data)) {
 -            track->video.fourcc = AV_RL32(track->codec_priv.data);
 -            codec_id            = ff_codec_get_id(ff_codec_movvideo_tags,
 -                                                  track->video.fourcc);
 +            fourcc   = AV_RL32(track->codec_priv.data + 4);
 +            codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
 +            if (ff_codec_get_id(ff_codec_movvideo_tags, AV_RL32(track->codec_priv.data))) {
 +                fourcc   = AV_RL32(track->codec_priv.data);
 +                codec_id = ff_codec_get_id(ff_codec_movvideo_tags, fourcc);
 +            }
 +            if (codec_id == AV_CODEC_ID_NONE && AV_RL32(track->codec_priv.data+4) == AV_RL32("SMI "))
 +                codec_id = AV_CODEC_ID_SVQ3;
          } else if (codec_id == AV_CODEC_ID_PCM_S16BE) {
              switch (track->audio.bitdepth) {
              case  8:
Simple merge
Simple merge
Simple merge
Simple merge
diff --cc libavutil/opt.c
@@@ -1175,21 -543,8 +1175,21 @@@ int av_opt_show2(void *obj, void *av_lo
  
  void av_opt_set_defaults(void *s)
  {
 +#if FF_API_OLD_AVOPTIONS
 +    av_opt_set_defaults2(s, 0, 0);
 +}
 +
 +void av_opt_set_defaults2(void *s, int mask, int flags)
 +{
 +#endif
      const AVOption *opt = NULL;
-     while ((opt = av_opt_next(s, opt)) != NULL) {
+     while ((opt = av_opt_next(s, opt))) {
 +        void *dst = ((uint8_t*)s) + opt->offset;
 +#if FF_API_OLD_AVOPTIONS
 +        if ((opt->flags & mask) != flags)
 +            continue;
 +#endif
 +
          if (opt->flags & AV_OPT_FLAG_READONLY)
              continue;
  
Simple merge
Simple merge