/* parse a SDP line and save stream attributes */ static void sdp_parse_fmtp(AVStream *st, const char *p) { char attr[256]; char value[4096]; int i; RTSPStream *rtsp_st = st->priv_data; AVCodecContext *codec = st->codec; rtp_payload_data_t *rtp_payload_data = &rtsp_st->rtp_payload_data; /* loop on each attribute */ for(;;) { skip_spaces(&p); if (*p == '\0') break; get_word_sep(attr, sizeof(attr), "=", &p); if (*p == '=') p++; get_word_sep(value, sizeof(value), ";", &p); if (*p == ';') p++; /* grab the codec extra_data from the config parameter of the fmtp line */ sdp_parse_fmtp_config(codec, attr, value); /* Looking for a known attribute */ for (i = 0; attr_names[i].str; ++i) { if (!strcasecmp(attr, attr_names[i].str)) { if (attr_names[i].type == ATTR_NAME_TYPE_INT) *(int *)((char *)rtp_payload_data + attr_names[i].offset) = atoi(value); else if (attr_names[i].type == ATTR_NAME_TYPE_STR) *(char **)((char *)rtp_payload_data + attr_names[i].offset) = av_strdup(value); } } } }
/* parse a SDP line and save stream attributes */ static void sdp_parse_fmtp(AVStream *st, const char *p) { char attr[256]; char value[4096]; int i; RTSPStream *rtsp_st = st->priv_data; AVCodecContext *codec = st->codec; rtp_payload_data_t *rtp_payload_data = &rtsp_st->rtp_payload_data; /* loop on each attribute */ while(rtsp_next_attr_and_value(&p, attr, sizeof(attr), value, sizeof(value))) { /* grab the codec extra_data from the config parameter of the fmtp line */ sdp_parse_fmtp_config(codec, attr, value); /* Looking for a known attribute */ for (i = 0; attr_names[i].str; ++i) { if (!strcasecmp(attr, attr_names[i].str)) { if (attr_names[i].type == ATTR_NAME_TYPE_INT) *(int *)((char *)rtp_payload_data + attr_names[i].offset) = atoi(value); else if (attr_names[i].type == ATTR_NAME_TYPE_STR) *(char **)((char *)rtp_payload_data + attr_names[i].offset) = av_strdup(value); } } } }