Merge commit 'b8df0b71c525e9fc9fbee790d093bae3aa62035c'
* commit 'b8df0b71c525e9fc9fbee790d093bae3aa62035c': rtp: h264: Move profile_level_id parsing to a function Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
						commit
						3773b6edea
					
				@ -64,6 +64,35 @@ struct PayloadContext {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
 | 
					static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void parse_profile_level_id(AVFormatContext *s,
 | 
				
			||||||
 | 
					                                   PayloadContext *h264_data,
 | 
				
			||||||
 | 
					                                   char *value)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    char buffer[3];
 | 
				
			||||||
 | 
					    // 6 characters=3 bytes, in hex.
 | 
				
			||||||
 | 
					    uint8_t profile_idc;
 | 
				
			||||||
 | 
					    uint8_t profile_iop;
 | 
				
			||||||
 | 
					    uint8_t level_idc;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    buffer[0]   = value[0];
 | 
				
			||||||
 | 
					    buffer[1]   = value[1];
 | 
				
			||||||
 | 
					    buffer[2]   = '\0';
 | 
				
			||||||
 | 
					    profile_idc = strtol(buffer, NULL, 16);
 | 
				
			||||||
 | 
					    buffer[0]   = value[2];
 | 
				
			||||||
 | 
					    buffer[1]   = value[3];
 | 
				
			||||||
 | 
					    profile_iop = strtol(buffer, NULL, 16);
 | 
				
			||||||
 | 
					    buffer[0]   = value[4];
 | 
				
			||||||
 | 
					    buffer[1]   = value[5];
 | 
				
			||||||
 | 
					    level_idc   = strtol(buffer, NULL, 16);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    av_log(s, AV_LOG_DEBUG,
 | 
				
			||||||
 | 
					           "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
 | 
				
			||||||
 | 
					           profile_idc, profile_iop, level_idc);
 | 
				
			||||||
 | 
					    h264_data->profile_idc = profile_idc;
 | 
				
			||||||
 | 
					    h264_data->profile_iop = profile_iop;
 | 
				
			||||||
 | 
					    h264_data->level_idc   = level_idc;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
 | 
					static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
 | 
				
			||||||
                                      AVStream *stream,
 | 
					                                      AVStream *stream,
 | 
				
			||||||
                                      PayloadContext *h264_data,
 | 
					                                      PayloadContext *h264_data,
 | 
				
			||||||
@ -87,31 +116,8 @@ static int sdp_parse_fmtp_config_h264(AVFormatContext *s,
 | 
				
			|||||||
            av_log(s, AV_LOG_ERROR,
 | 
					            av_log(s, AV_LOG_ERROR,
 | 
				
			||||||
                   "Interleaved RTP mode is not supported yet.\n");
 | 
					                   "Interleaved RTP mode is not supported yet.\n");
 | 
				
			||||||
    } else if (!strcmp(attr, "profile-level-id")) {
 | 
					    } else if (!strcmp(attr, "profile-level-id")) {
 | 
				
			||||||
        if (strlen(value) == 6) {
 | 
					        if (strlen(value) == 6)
 | 
				
			||||||
            char buffer[3];
 | 
					            parse_profile_level_id(s, h264_data, value);
 | 
				
			||||||
            // 6 characters=3 bytes, in hex.
 | 
					 | 
				
			||||||
            uint8_t profile_idc;
 | 
					 | 
				
			||||||
            uint8_t profile_iop;
 | 
					 | 
				
			||||||
            uint8_t level_idc;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            buffer[0]   = value[0];
 | 
					 | 
				
			||||||
            buffer[1]   = value[1];
 | 
					 | 
				
			||||||
            buffer[2]   = '\0';
 | 
					 | 
				
			||||||
            profile_idc = strtol(buffer, NULL, 16);
 | 
					 | 
				
			||||||
            buffer[0]   = value[2];
 | 
					 | 
				
			||||||
            buffer[1]   = value[3];
 | 
					 | 
				
			||||||
            profile_iop = strtol(buffer, NULL, 16);
 | 
					 | 
				
			||||||
            buffer[0]   = value[4];
 | 
					 | 
				
			||||||
            buffer[1]   = value[5];
 | 
					 | 
				
			||||||
            level_idc   = strtol(buffer, NULL, 16);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            av_log(s, AV_LOG_DEBUG,
 | 
					 | 
				
			||||||
                   "RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
 | 
					 | 
				
			||||||
                   profile_idc, profile_iop, level_idc);
 | 
					 | 
				
			||||||
            h264_data->profile_idc = profile_idc;
 | 
					 | 
				
			||||||
            h264_data->profile_iop = profile_iop;
 | 
					 | 
				
			||||||
            h264_data->level_idc   = level_idc;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    } else if (!strcmp(attr, "sprop-parameter-sets")) {
 | 
					    } else if (!strcmp(attr, "sprop-parameter-sets")) {
 | 
				
			||||||
        codec->extradata_size = 0;
 | 
					        codec->extradata_size = 0;
 | 
				
			||||||
        av_freep(&codec->extradata);
 | 
					        av_freep(&codec->extradata);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user