diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-29 15:41:03 +0000 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-29 15:41:03 +0000 |
commit | 48847ee3577f4a978b40fbe9949e689554d74b3d (patch) | |
tree | 7a2bcbd97cafa10a773e32b626c54918961f3a93 | |
parent | 04747c5a73af4a83574dde878688d2f8406034b4 (diff) | |
parent | d082078a88da3b3e926197d0d2aa9fa322123b76 (diff) | |
download | ffmpeg-48847ee3577f4a978b40fbe9949e689554d74b3d.tar.gz |
Merge commit 'd082078a88da3b3e926197d0d2aa9fa322123b76'
* commit 'd082078a88da3b3e926197d0d2aa9fa322123b76':
dashenc: eliminate ffurl_* usage
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
-rw-r--r-- | libavformat/dashenc.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index fbccbd16aa..931d32d145 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -63,7 +63,7 @@ typedef struct OutputStream { AVFormatContext *ctx; int ctx_inited; uint8_t iobuf[32768]; - URLContext *out; + AVIOContext *out; int packets_written; char initfile[1024]; int64_t init_start_pos; @@ -104,7 +104,7 @@ static int dash_write(void *opaque, uint8_t *buf, int buf_size) { OutputStream *os = opaque; if (os->out) - ffurl_write(os->out, buf, buf_size); + avio_write(os->out, buf, buf_size); return buf_size; } @@ -186,8 +186,7 @@ static void dash_free(AVFormatContext *s) av_write_trailer(os->ctx); if (os->ctx && os->ctx->pb) av_free(os->ctx->pb); - ffurl_close(os->out); - os->out = NULL; + ff_format_io_close(s, &os->out); if (os->ctx) avformat_free_context(os->ctx); for (j = 0; j < os->nb_segments; j++) @@ -651,7 +650,7 @@ static int dash_write_header(AVFormatContext *s) dash_fill_tmpl_params(os->initfile, sizeof(os->initfile), c->init_seg_name, i, 0, os->bit_rate, 0); } snprintf(filename, sizeof(filename), "%s%s", c->dirname, os->initfile); - ret = ffurl_open_whitelist(&os->out, filename, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL, s->protocol_whitelist); + ret = s->io_open(s, &os->out, filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) goto fail; os->init_start_pos = 0; @@ -755,18 +754,18 @@ static void find_index_range(AVFormatContext *s, const char *full_path, int64_t pos, int *index_length) { uint8_t buf[8]; - URLContext *fd; + AVIOContext *pb; int ret; - ret = ffurl_open_whitelist(&fd, full_path, AVIO_FLAG_READ, &s->interrupt_callback, NULL, s->protocol_whitelist); + ret = s->io_open(s, &pb, full_path, AVIO_FLAG_READ, NULL); if (ret < 0) return; - if (ffurl_seek(fd, pos, SEEK_SET) != pos) { - ffurl_close(fd); + if (avio_seek(pb, pos, SEEK_SET) != pos) { + ff_format_io_close(s, &pb); return; } - ret = ffurl_read(fd, buf, 8); - ffurl_close(fd); + ret = avio_read(pb, buf, 8); + ff_format_io_close(s, &pb); if (ret < 8) return; if (AV_RL32(&buf[4]) != MKTAG('s', 'i', 'd', 'x')) @@ -829,10 +828,8 @@ static int dash_flush(AVFormatContext *s, int final, int stream) if (!os->init_range_length) { av_write_frame(os->ctx, NULL); os->init_range_length = avio_tell(os->ctx->pb); - if (!c->single_file) { - ffurl_close(os->out); - os->out = NULL; - } + if (!c->single_file) + ff_format_io_close(s, &os->out); } start_pos = avio_tell(os->ctx->pb); @@ -841,7 +838,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) dash_fill_tmpl_params(filename, sizeof(filename), c->media_seg_name, i, os->segment_index, os->bit_rate, os->start_pts); snprintf(full_path, sizeof(full_path), "%s%s", c->dirname, filename); snprintf(temp_path, sizeof(temp_path), "%s.tmp", full_path); - ret = ffurl_open_whitelist(&os->out, temp_path, AVIO_FLAG_WRITE, &s->interrupt_callback, NULL, s->protocol_whitelist); + ret = s->io_open(s, &os->out, temp_path, AVIO_FLAG_WRITE, NULL); if (ret < 0) break; write_styp(os->ctx->pb); @@ -857,8 +854,7 @@ static int dash_flush(AVFormatContext *s, int final, int stream) if (c->single_file) { find_index_range(s, full_path, start_pos, &index_length); } else { - ffurl_close(os->out); - os->out = NULL; + ff_format_io_close(s, &os->out); ret = avpriv_io_move(temp_path, full_path); if (ret < 0) break; |