Commit 8f00d7f4 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit 'a9a0b8d6'

* commit 'a9a0b8d6':
  rtp: h264: Move parse_sprop_parameter_sets parsing to a function
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 3773b6ed a9a0b8d6
......@@ -93,39 +93,15 @@ static void parse_profile_level_id(AVFormatContext *s,
h264_data->level_idc = level_idc;
}
static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
AVStream *stream,
PayloadContext *h264_data,
char *attr, char *value)
static int parse_sprop_parameter_sets(AVFormatContext *s,
AVCodecContext *codec,
char *value)
{
AVCodecContext *codec = stream->codec;
assert(codec->codec_id == AV_CODEC_ID_H264);
assert(h264_data);
if (!strcmp(attr, "packetization-mode")) {
av_log(s, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));
h264_data->packetization_mode = atoi(value);
/*
* Packetization Mode:
* 0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
* 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
* 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A),
* and 29 (FU-B) are allowed.
*/
if (h264_data->packetization_mode > 1)
av_log(s, AV_LOG_ERROR,
"Interleaved RTP mode is not supported yet.\n");
} else if (!strcmp(attr, "profile-level-id")) {
if (strlen(value) == 6)
parse_profile_level_id(s, h264_data, value);
} else if (!strcmp(attr, "sprop-parameter-sets")) {
codec->extradata_size = 0;
av_freep(&codec->extradata);
while (*value) {
char base64packet[1024];
uint8_t decoded_packet[1024];
int packet_size;
while (*value) {
char *dst = base64packet;
while (*value && *value != ','
......@@ -164,8 +140,42 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
codec->extradata_size += sizeof(start_sequence) + packet_size;
}
}
av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)!\n",
av_log(s, AV_LOG_DEBUG, "Extradata set to %p (size: %d)\n",
codec->extradata, codec->extradata_size);
return 0;
}
static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
AVStream *stream,
PayloadContext *h264_data,
char *attr, char *value)
{
AVCodecContext *codec = stream->codec;
assert(codec->codec_id == AV_CODEC_ID_H264);
assert(h264_data);
if (!strcmp(attr, "packetization-mode")) {
av_log(s, AV_LOG_DEBUG, "RTP Packetization Mode: %d\n", atoi(value));
h264_data->packetization_mode = atoi(value);
/*
* Packetization Mode:
* 0 or not present: Single NAL mode (Only nals from 1-23 are allowed)
* 1: Non-interleaved Mode: 1-23, 24 (STAP-A), 28 (FU-A) are allowed.
* 2: Interleaved Mode: 25 (STAP-B), 26 (MTAP16), 27 (MTAP24), 28 (FU-A),
* and 29 (FU-B) are allowed.
*/
if (h264_data->packetization_mode > 1)
av_log(s, AV_LOG_ERROR,
"Interleaved RTP mode is not supported yet.\n");
} else if (!strcmp(attr, "profile-level-id")) {
if (strlen(value) == 6)
parse_profile_level_id(s, h264_data, value);
} else if (!strcmp(attr, "sprop-parameter-sets")) {
codec->extradata_size = 0;
av_freep(&codec->extradata);
return parse_sprop_parameter_sets(s, codec, value);
}
return 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment