Changes in / [3773b6ed:8f00d7f4] in ffmpeg
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libavformat/rtpdec_h264.c
r3773b6ed r8f00d7f4 94 94 } 95 95 96 static int parse_sprop_parameter_sets(AVFormatContext *s, 97 AVCodecContext *codec, 98 char *value) 99 { 100 char base64packet[1024]; 101 uint8_t decoded_packet[1024]; 102 int packet_size; 103 104 while (*value) { 105 char *dst = base64packet; 106 107 while (*value && *value != ',' 108 && (dst - base64packet) < sizeof(base64packet) - 1) { 109 *dst++ = *value++; 110 } 111 *dst++ = '\0'; 112 113 if (*value == ',') 114 value++; 115 116 packet_size = av_base64_decode(decoded_packet, base64packet, 117 sizeof(decoded_packet)); 118 if (packet_size > 0) { 119 uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + 120 codec->extradata_size + 121 FF_INPUT_BUFFER_PADDING_SIZE); 122 if (!dest) { 123 av_log(s, AV_LOG_ERROR, 124 "Unable to allocate memory for extradata!\n"); 125 return AVERROR(ENOMEM); 126 } 127 if (codec->extradata_size) { 128 memcpy(dest, codec->extradata, codec->extradata_size); 129 av_free(codec->extradata); 130 } 131 132 memcpy(dest + codec->extradata_size, start_sequence, 133 sizeof(start_sequence)); 134 memcpy(dest + codec->extradata_size + sizeof(start_sequence), 135 decoded_packet, packet_size); 136 memset(dest + codec->extradata_size + sizeof(start_sequence) + 137 packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 138 139 codec->extradata = dest; 140 codec->extradata_size += sizeof(start_sequence) + packet_size; 141 } 142 } 143 144 av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n", 145 codec->extradata, codec->extradata_size); 146 147 return 0; 148 } 149 96 150 static int sdp_parse_fmtp_config_h264(AVFormatContext *s, 97 151 AVStream *stream, … … 122 176 codec->extradata_size = 0; 123 177 av_freep(&codec->extradata); 124 125 while (*value) { 126 char base64packet[1024]; 127 uint8_t decoded_packet[1024]; 128 int packet_size; 129 char *dst = base64packet; 130 131 while (*value && *value != ',' 132 && (dst - base64packet) < sizeof(base64packet) - 1) { 133 *dst++ = *value++; 134 } 135 *dst++ = '\0'; 136 137 if (*value == ',') 138 value++; 139 140 packet_size = av_base64_decode(decoded_packet, base64packet, 141 sizeof(decoded_packet)); 142 if (packet_size > 0) { 143 uint8_t *dest = av_malloc(packet_size + sizeof(start_sequence) + 144 codec->extradata_size + 145 FF_INPUT_BUFFER_PADDING_SIZE); 146 if (!dest) { 147 av_log(s, AV_LOG_ERROR, 148 "Unable to allocate memory for extradata!\n"); 149 return AVERROR(ENOMEM); 150 } 151 if (codec->extradata_size) { 152 memcpy(dest, codec->extradata, codec->extradata_size); 153 av_free(codec->extradata); 154 } 155 156 memcpy(dest + codec->extradata_size, start_sequence, 157 sizeof(start_sequence)); 158 memcpy(dest + codec->extradata_size + sizeof(start_sequence), 159 decoded_packet, packet_size); 160 memset(dest + codec->extradata_size + sizeof(start_sequence) + 161 packet_size, 0, FF_INPUT_BUFFER_PADDING_SIZE); 162 163 codec->extradata = dest; 164 codec->extradata_size += sizeof(start_sequence) + packet_size; 165 } 166 } 167 av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!\n", 168 codec->extradata, codec->extradata_size); 178 return parse_sprop_parameter_sets(s, codec, value); 169 179 } 170 180 return 0;
Note:
See TracChangeset
for help on using the changeset viewer.