Merge commit 'a536a4e4bc52d05f59869761337452fb1f1977f6'
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 27 Jan 2015 17:49:50 +0000 (18:49 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 27 Jan 2015 17:50:47 +0000 (18:50 +0100)
* commit 'a536a4e4bc52d05f59869761337452fb1f1977f6':
  lavc: support extracting audio service type from side data

Merged-by: Michael Niedermayer <michaelni@gmx.at>
1  2 
libavcodec/utils.c

@@@ -1848,15 -1392,18 +1848,22 @@@ int attribute_align_arg avcodec_encode_
          }
          av_log(avctx, AV_LOG_WARNING, "extended_data is not set.\n");
  
 -        tmp = *frame;
 -        tmp.extended_data = tmp.data;
 -        frame = &tmp;
 +        extended_frame = av_frame_alloc();
 +        if (!extended_frame)
 +            return AVERROR(ENOMEM);
 +
 +        memcpy(extended_frame, frame, sizeof(AVFrame));
 +        extended_frame->extended_data = extended_frame->data;
 +        frame = extended_frame;
      }
  
+     /* extract audio service type metadata */
+     if (frame) {
+         AVFrameSideData *sd = av_frame_get_side_data(frame, AV_FRAME_DATA_AUDIO_SERVICE_TYPE);
+         if (sd && sd->size >= sizeof(enum AVAudioServiceType))
+             avctx->audio_service_type = *(enum AVAudioServiceType*)sd->data;
+     }
      /* check for valid frame size */
      if (frame) {
          if (avctx->codec->capabilities & CODEC_CAP_SMALL_LAST_FRAME) {