lavf/webvttdec: factorize identifier and settings side data code.
This commit is contained in:
		
							parent
							
								
									8f75ba9926
								
							
						
					
					
						commit
						07f6a66bf5
					
				@ -142,27 +142,19 @@ static int webvtt_read_header(AVFormatContext *s)
 | 
				
			|||||||
        sub->pts = ts_start;
 | 
					        sub->pts = ts_start;
 | 
				
			||||||
        sub->duration = ts_end - ts_start;
 | 
					        sub->duration = ts_end - ts_start;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (identifier_len) {
 | 
					#define SET_SIDE_DATA(name, type) do {                                  \
 | 
				
			||||||
            uint8_t *buf = av_packet_new_side_data(sub,
 | 
					    if (name##_len) {                                                   \
 | 
				
			||||||
                                                   AV_PKT_DATA_WEBVTT_IDENTIFIER,
 | 
					        uint8_t *buf = av_packet_new_side_data(sub, type, name##_len);  \
 | 
				
			||||||
                                                   identifier_len);
 | 
					        if (!buf) {                                                     \
 | 
				
			||||||
            if (!buf) {
 | 
					            res = AVERROR(ENOMEM);                                      \
 | 
				
			||||||
                res = AVERROR(ENOMEM);
 | 
					            goto end;                                                   \
 | 
				
			||||||
                goto end;
 | 
					        }                                                               \
 | 
				
			||||||
            }
 | 
					        memcpy(buf, name, name##_len);                                  \
 | 
				
			||||||
            memcpy(buf, identifier, identifier_len);
 | 
					    }                                                                   \
 | 
				
			||||||
        }
 | 
					} while (0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (settings_len) {
 | 
					        SET_SIDE_DATA(identifier, AV_PKT_DATA_WEBVTT_IDENTIFIER);
 | 
				
			||||||
            uint8_t *buf = av_packet_new_side_data(sub,
 | 
					        SET_SIDE_DATA(settings,   AV_PKT_DATA_WEBVTT_SETTINGS);
 | 
				
			||||||
                                                   AV_PKT_DATA_WEBVTT_SETTINGS,
 | 
					 | 
				
			||||||
                                                   settings_len);
 | 
					 | 
				
			||||||
            if (!buf) {
 | 
					 | 
				
			||||||
                res = AVERROR(ENOMEM);
 | 
					 | 
				
			||||||
                goto end;
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
            memcpy(buf, settings, settings_len);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    ff_subtitles_queue_finalize(&webvtt->q);
 | 
					    ff_subtitles_queue_finalize(&webvtt->q);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user