Merge remote-tracking branch 'qatar/master'
authorMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Apr 2012 20:08:28 +0000 (22:08 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Wed, 18 Apr 2012 20:08:28 +0000 (22:08 +0200)
* qatar/master:
  ppc: drop unused function dct_quantize_altivec()
  mpegaudiodec: Do not discard mp_decode_frame() return value.
  matroska: do not set invalid default duration if frame rate is zero
  mkv: use av_reduce instead of av_d2q for framerate estimation
  mkv: report average framerate as minimal as well
  avcodec_string: Favor AVCodecContext.codec over the default codec.
  cook: Make constants passed to AV_BE2NE32C() unsigned to avoid signed overflow.

Conflicts:
libavcodec/cook.c
libavcodec/ppc/mpegvideo_altivec.c
libavcodec/utils.c
libavformat/matroskadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/cook.c
libavcodec/dsputil.c
libavcodec/dsputil.h
libavcodec/mpegaudiodec.c
libavcodec/ppc/mpegvideo_altivec.c
libavcodec/utils.c
libavformat/matroskadec.c

Simple merge
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -1752,30 -1497,39 +1752,33 @@@ void avcodec_string(char *buf, int buf_
      int bitrate;
      AVRational display_aspect_ratio;
  
 -    if (enc->codec)
 -        p = enc->codec;
 -    else if (encode)
 -        p = avcodec_find_encoder(enc->codec_id);
 -    else
 -        p = avcodec_find_decoder(enc->codec_id);
 -
 -    if (p) {
 -        codec_name = p->name;
 -        profile = av_get_profile_name(p, enc->profile);
 -    } else if (enc->codec_id == CODEC_ID_MPEG2TS) {
 -        /* fake mpeg2 transport stream codec (currently not
 -           registered) */
 -        codec_name = "mpeg2ts";
 -    } else if (enc->codec_name[0] != '\0') {
 -        codec_name = enc->codec_name;
 -    } else {
 -        /* output avi tags */
 +    if (!buf || buf_size <= 0)
 +        return;
 +    codec_type = av_get_media_type_string(enc->codec_type);
 +    codec_name = avcodec_get_name(enc->codec_id);
 +    if (enc->profile != FF_PROFILE_UNKNOWN) {
-         p = encode ? avcodec_find_encoder(enc->codec_id) :
-                      avcodec_find_decoder(enc->codec_id);
++        if (enc->codec)
++            p = enc->codec;
++        else
++            p = encode ? avcodec_find_encoder(enc->codec_id) :
++                        avcodec_find_decoder(enc->codec_id);
 +        if (p)
 +            profile = av_get_profile_name(p, enc->profile);
 +    }
 +
 +    snprintf(buf, buf_size, "%s: %s%s", codec_type ? codec_type : "unknown",
 +             codec_name, enc->mb_decision ? " (hq)" : "");
 +    buf[0] ^= 'a' ^ 'A'; /* first letter in uppercase */
 +    if (profile)
 +        snprintf(buf + strlen(buf), buf_size - strlen(buf), " (%s)", profile);
 +    if (enc->codec_tag) {
          char tag_buf[32];
          av_get_codec_tag_string(tag_buf, sizeof(tag_buf), enc->codec_tag);
 -        snprintf(buf1, sizeof(buf1), "%s / 0x%04X", tag_buf, enc->codec_tag);
 -        codec_name = buf1;
 +        snprintf(buf + strlen(buf), buf_size - strlen(buf),
 +                 " (%s / 0x%04X)", tag_buf, enc->codec_tag);
      }
 -
      switch(enc->codec_type) {
      case AVMEDIA_TYPE_VIDEO:
 -        snprintf(buf, buf_size,
 -                 "Video: %s%s",
 -                 codec_name, enc->mb_decision ? " (hq)" : "");
 -        if (profile)
 -            snprintf(buf + strlen(buf), buf_size - strlen(buf),
 -                     " (%s)", profile);
          if (enc->pix_fmt != PIX_FMT_NONE) {
              snprintf(buf + strlen(buf), buf_size - strlen(buf),
                       ", %s",
@@@ -1660,28 -1548,13 +1660,31 @@@ static int matroska_read_header(AVForma
                        st->codec->height * track->video.display_width,
                        st->codec-> width * track->video.display_height,
                        255);
 -            if (st->codec->codec_id != CODEC_ID_H264)
              st->need_parsing = AVSTREAM_PARSE_HEADERS;
-             if (track->default_duration)
-                 st->avg_frame_rate = av_d2q(1000000000.0/track->default_duration, INT_MAX);
+             if (track->default_duration) {
+                 av_reduce(&st->r_frame_rate.num, &st->r_frame_rate.den,
+                           1000000000, track->default_duration, 30000);
+                 st->avg_frame_rate = st->r_frame_rate;
+             }
 +
 +            /* export stereo mode flag as metadata tag */
 +            if (track->video.stereo_mode && track->video.stereo_mode < MATROSKA_VIDEO_STEREO_MODE_COUNT)
 +                av_dict_set(&st->metadata, "stereo_mode", matroska_video_stereo_mode[track->video.stereo_mode], 0);
 +
 +            /* if we have virtual track, mark the real tracks */
 +            for (j=0; j < track->operation.combine_planes.nb_elem; j++) {
 +                char buf[32];
 +                if (planes[j].type >= MATROSKA_VIDEO_STEREO_PLANE_COUNT)
 +                    continue;
 +                snprintf(buf, sizeof(buf), "%s_%d",
 +                         matroska_video_stereo_plane[planes[j].type], i);
 +                for (k=0; k < matroska->tracks.nb_elem; k++)
 +                    if (planes[j].uid == tracks[k].uid) {
 +                        av_dict_set(&s->streams[k]->metadata,
 +                                    "stereo_mode", buf, 0);
 +                        break;
 +                    }
 +            }
          } else if (track->type == MATROSKA_TRACK_TYPE_AUDIO) {
              st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
              st->codec->sample_rate = track->audio.out_samplerate;