| 
																	
																	
																		
																	
																	
																 | 
																@@ -65,6 +65,11 @@ static int chunk_mux_init(AVFormatContext *s) | 
															
														
														
													
														
															
																 | 
																 | 
																    AVDictionary *dict = NULL; | 
																 | 
																 | 
																    AVDictionary *dict = NULL; | 
															
														
														
													
														
															
																 | 
																 | 
																    int ret; | 
																 | 
																 | 
																    int ret; | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    if (!wc->header_filename) { | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        av_log(s, AV_LOG_ERROR, "No header filename provided\n"); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																        return AVERROR(EINVAL); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    } | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																    oformat = av_guess_format("webm", s->url, "video/webm"); | 
																 | 
																 | 
																    oformat = av_guess_format("webm", s->url, "video/webm"); | 
															
														
														
													
														
															
																 | 
																 | 
																    if (!oformat) | 
																 | 
																 | 
																    if (!oformat) | 
															
														
														
													
														
															
																 | 
																 | 
																        return AVERROR_MUXER_NOT_FOUND; | 
																 | 
																 | 
																        return AVERROR_MUXER_NOT_FOUND; | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -74,6 +79,9 @@ static int chunk_mux_init(AVFormatContext *s) | 
															
														
														
													
														
															
																 | 
																 | 
																        return ret; | 
																 | 
																 | 
																        return ret; | 
															
														
														
													
														
															
																 | 
																 | 
																    oc = wc->avf; | 
																 | 
																 | 
																    oc = wc->avf; | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    ff_format_set_url(oc, wc->header_filename); | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    wc->header_filename = NULL; | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																    oc->interrupt_callback = s->interrupt_callback; | 
																 | 
																 | 
																    oc->interrupt_callback = s->interrupt_callback; | 
															
														
														
													
														
															
																 | 
																 | 
																    oc->max_delay          = s->max_delay; | 
																 | 
																 | 
																    oc->max_delay          = s->max_delay; | 
															
														
														
													
														
															
																 | 
																 | 
																    oc->flags                 = s->flags & ~AVFMT_FLAG_FLUSH_PACKETS; | 
																 | 
																 | 
																    oc->flags                 = s->flags & ~AVFMT_FLAG_FLUSH_PACKETS; | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -120,30 +128,17 @@ static int chunk_mux_init(AVFormatContext *s) | 
															
														
														
													
														
															
																 | 
																 | 
																    return 0; | 
																 | 
																 | 
																    return 0; | 
															
														
														
													
														
															
																 | 
																 | 
																} | 
																 | 
																 | 
																} | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																static int get_chunk_filename(AVFormatContext *s, int is_header, char filename[MAX_FILENAME_SIZE]) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																static int get_chunk_filename(AVFormatContext *s, char filename[MAX_FILENAME_SIZE]) | 
															
														
														
													
														
															
																 | 
																 | 
																{ | 
																 | 
																 | 
																{ | 
															
														
														
													
														
															
																 | 
																 | 
																    WebMChunkContext *wc = s->priv_data; | 
																 | 
																 | 
																    WebMChunkContext *wc = s->priv_data; | 
															
														
														
													
														
															
																 | 
																 | 
																    if (!filename) { | 
																 | 
																 | 
																    if (!filename) { | 
															
														
														
													
														
															
																 | 
																 | 
																        return AVERROR(EINVAL); | 
																 | 
																 | 
																        return AVERROR(EINVAL); | 
															
														
														
													
														
															
																 | 
																 | 
																    } | 
																 | 
																 | 
																    } | 
															
														
														
													
														
															
																 | 
																 | 
																    if (is_header) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        int len; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        if (!wc->header_filename) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            av_log(s, AV_LOG_ERROR, "No header filename provided\n"); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            return AVERROR(EINVAL); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        len = av_strlcpy(filename, wc->header_filename, MAX_FILENAME_SIZE); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        if (len >= MAX_FILENAME_SIZE) { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            av_log(s, AV_LOG_ERROR, "Header filename too long\n"); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																            return AVERROR(EINVAL); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    } else { | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        if (av_get_frame_filename(filename, MAX_FILENAME_SIZE, | 
																 | 
																 | 
																        if (av_get_frame_filename(filename, MAX_FILENAME_SIZE, | 
															
														
														
													
														
															
																 | 
																 | 
																                                  s->url, wc->chunk_index - 1) < 0) { | 
																 | 
																 | 
																                                  s->url, wc->chunk_index - 1) < 0) { | 
															
														
														
													
														
															
																 | 
																 | 
																            av_log(s, AV_LOG_ERROR, "Invalid chunk filename template '%s'\n", s->url); | 
																 | 
																 | 
																            av_log(s, AV_LOG_ERROR, "Invalid chunk filename template '%s'\n", s->url); | 
															
														
														
													
														
															
																 | 
																 | 
																            return AVERROR(EINVAL); | 
																 | 
																 | 
																            return AVERROR(EINVAL); | 
															
														
														
													
														
															
																 | 
																 | 
																        } | 
																 | 
																 | 
																        } | 
															
														
														
													
														
															
																 | 
																 | 
																    } | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    return 0; | 
																 | 
																 | 
																    return 0; | 
															
														
														
													
														
															
																 | 
																 | 
																} | 
																 | 
																 | 
																} | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -153,8 +148,6 @@ static int webm_chunk_write_header(AVFormatContext *s) | 
															
														
														
													
														
															
																 | 
																 | 
																    AVFormatContext *oc = NULL; | 
																 | 
																 | 
																    AVFormatContext *oc = NULL; | 
															
														
														
													
														
															
																 | 
																 | 
																    int ret; | 
																 | 
																 | 
																    int ret; | 
															
														
														
													
														
															
																 | 
																 | 
																    AVDictionary *options = NULL; | 
																 | 
																 | 
																    AVDictionary *options = NULL; | 
															
														
														
													
														
															
																 | 
																 | 
																    char oc_filename[MAX_FILENAME_SIZE]; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    char *oc_url; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																
  | 
																 | 
																 | 
																
  | 
															
														
														
													
														
															
																 | 
																 | 
																    // DASH Streams can only have either one track per file. | 
																 | 
																 | 
																    // DASH Streams can only have either one track per file. | 
															
														
														
													
														
															
																 | 
																 | 
																    if (s->nb_streams != 1) { return AVERROR_INVALIDDATA; } | 
																 | 
																 | 
																    if (s->nb_streams != 1) { return AVERROR_INVALIDDATA; } | 
															
														
														
													
												
													
														
															
																| 
																	
																	
																	
																		
																	
																 | 
																@@ -166,13 +159,6 @@ static int webm_chunk_write_header(AVFormatContext *s) | 
															
														
														
													
														
															
																 | 
																 | 
																    if (ret < 0) | 
																 | 
																 | 
																    if (ret < 0) | 
															
														
														
													
														
															
																 | 
																 | 
																        return ret; | 
																 | 
																 | 
																        return ret; | 
															
														
														
													
														
															
																 | 
																 | 
																    oc = wc->avf; | 
																 | 
																 | 
																    oc = wc->avf; | 
															
														
														
													
														
															
																 | 
																 | 
																    ret = get_chunk_filename(s, 1, oc_filename); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    if (ret < 0) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        return ret; | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    oc_url = av_strdup(oc_filename); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    if (!oc_url) | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																        return AVERROR(ENOMEM); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    ff_format_set_url(oc, oc_url); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																    if (wc->http_method) | 
																 | 
																 | 
																    if (wc->http_method) | 
															
														
														
													
														
															
																 | 
																 | 
																        av_dict_set(&options, "method", wc->http_method, 0); | 
																 | 
																 | 
																        av_dict_set(&options, "method", wc->http_method, 0); | 
															
														
														
													
														
															
																 | 
																 | 
																    ret = s->io_open(s, &oc->pb, oc->url, AVIO_FLAG_WRITE, &options); | 
																 | 
																 | 
																    ret = s->io_open(s, &oc->pb, oc->url, AVIO_FLAG_WRITE, &options); | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																		
																	
																	
																 | 
																@@ -220,7 +206,7 @@ static int chunk_end(AVFormatContext *s, int flush) | 
															
														
														
													
														
															
																 | 
																 | 
																        av_write_frame(oc, NULL); | 
																 | 
																 | 
																        av_write_frame(oc, NULL); | 
															
														
														
													
														
															
																 | 
																 | 
																    buffer_size = avio_close_dyn_buf(oc->pb, &buffer); | 
																 | 
																 | 
																    buffer_size = avio_close_dyn_buf(oc->pb, &buffer); | 
															
														
														
													
														
															
																 | 
																 | 
																    oc->pb = NULL; | 
																 | 
																 | 
																    oc->pb = NULL; | 
															
														
														
													
														
															
																 | 
																 | 
																    ret = get_chunk_filename(s, 0, filename); | 
																 | 
																 | 
																 | 
															
														
														
													
														
															
																 | 
																 | 
																 | 
																 | 
																 | 
																    ret = get_chunk_filename(s, filename); | 
															
														
														
													
														
															
																 | 
																 | 
																    if (ret < 0) | 
																 | 
																 | 
																    if (ret < 0) | 
															
														
														
													
														
															
																 | 
																 | 
																        goto fail; | 
																 | 
																 | 
																        goto fail; | 
															
														
														
													
														
															
																 | 
																 | 
																    if (wc->http_method) | 
																 | 
																 | 
																    if (wc->http_method) | 
															
														
														
													
												
													
														
															
																| 
																	
																		
																	
																	
																	
																 | 
																
  |