Merge commit '10e2d8b5562d8729e4eefbcec63a11eb8a0c502c'
authorMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Feb 2015 12:02:36 +0000 (13:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sat, 21 Feb 2015 12:02:42 +0000 (13:02 +0100)
* commit '10e2d8b5562d8729e4eefbcec63a11eb8a0c502c':
  rtpdec_hevc: Use a shared function for parsing parameter sets

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

  
  #include "avformat.h"
  #include "rtpdec.h"
+ #include "rtpdec_formats.h"
  
 -#define RTP_HEVC_PAYLOAD_HEADER_SIZE  2
 -#define RTP_HEVC_FU_HEADER_SIZE       1
 -#define RTP_HEVC_DONL_FIELD_SIZE      2
 -#define HEVC_SPECIFIED_NAL_UNIT_TYPES 48
 +#define RTP_HEVC_PAYLOAD_HEADER_SIZE       2
 +#define RTP_HEVC_FU_HEADER_SIZE            1
 +#define RTP_HEVC_DONL_FIELD_SIZE           2
 +#define RTP_HEVC_DOND_FIELD_SIZE           1
 +#define RTP_HEVC_AP_NALU_LENGTH_FIELD_SIZE 2
 +#define HEVC_SPECIFIED_NAL_UNIT_TYPES      48
  
  /* SDP out-of-band signaling data */
  struct PayloadContext {
@@@ -108,44 -105,10 +109,11 @@@ static av_cold int hevc_sdp_parse_fmtp_
          } else if (!strcmp(attr, "sprop-sei")) {
              data_ptr = &hevc_data->sei;
              size_ptr = &hevc_data->sei_size;
 -        }
 +        } else
 +            av_assert0(0);
  
-         while (*value) {
-             char base64packet[1024];
-             uint8_t decoded_packet[1024];
-             int decoded_packet_size;
-             char *dst = base64packet;
-             while (*value && *value != ',' &&
-                    (dst - base64packet) < sizeof(base64packet) - 1) {
-                 *dst++ = *value++;
-             }
-             *dst++ = '\0';
-             if (*value == ',')
-                 value++;
-             decoded_packet_size = av_base64_decode(decoded_packet, base64packet,
-                                                    sizeof(decoded_packet));
-             if (decoded_packet_size > 0) {
-                 uint8_t *tmp = av_realloc(*data_ptr, decoded_packet_size +
-                                           sizeof(start_sequence) + *size_ptr);
-                 if (!tmp) {
-                     av_log(s, AV_LOG_ERROR,
-                            "Unable to allocate memory for extradata!\n");
-                     return AVERROR(ENOMEM);
-                 }
-                 *data_ptr = tmp;
-                 memcpy(*data_ptr + *size_ptr, start_sequence,
-                        sizeof(start_sequence));
-                 memcpy(*data_ptr + *size_ptr + sizeof(start_sequence),
-                        decoded_packet, decoded_packet_size);
-                 *size_ptr += sizeof(start_sequence) + decoded_packet_size;
-             }
-         }
+         ff_h264_parse_sprop_parameter_sets(s, data_ptr,
+                                            size_ptr, value);
      }
  
      /* max-lsr, max-lps, max-cpb, max-dpb, max-br, max-tr, max-tc */