diff options
author | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-10 14:40:32 +0000 |
---|---|---|
committer | Derek Buitenhuis <derek.buitenhuis@gmail.com> | 2016-02-10 14:42:41 +0000 |
commit | bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce (patch) | |
tree | 7011642746984633573c9a2d993d58dfd12ee44b /libavformat/hdsenc.c | |
parent | d94b11a721385aa406187da8f49380f29be0fa7e (diff) | |
parent | 9f61abc8111c7c43f49ca012e957a108b9cc7610 (diff) | |
download | ffmpeg-bc9a5965c815cf7fd998d8ce14a18b8e861dd9ce.tar.gz |
Merge commit '9f61abc8111c7c43f49ca012e957a108b9cc7610'
This also deprecates our old duplicated callbacks.
* commit '9f61abc8111c7c43f49ca012e957a108b9cc7610':
lavf: allow custom IO for all files
Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Diffstat (limited to 'libavformat/hdsenc.c')
-rw-r--r-- | libavformat/hdsenc.c | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/libavformat/hdsenc.c b/libavformat/hdsenc.c index 93fa27f8b5..3e6e821a82 100644 --- a/libavformat/hdsenc.c +++ b/libavformat/hdsenc.c @@ -140,7 +140,8 @@ static void hds_free(AVFormatContext *s) return; for (i = 0; i < s->nb_streams; i++) { OutputStream *os = &c->streams[i]; - avio_closep(&os->out); + if (os->out) + ff_format_io_close(s, &os->out); if (os->ctx && os->ctx_inited) av_write_trailer(os->ctx); if (os->ctx) @@ -170,8 +171,7 @@ static int write_manifest(AVFormatContext *s, int final) snprintf(filename, sizeof(filename), "%s/index.f4m", s->filename); snprintf(temp_filename, sizeof(temp_filename), "%s/index.f4m.tmp", s->filename); - ret = ffio_open_whitelist(&out, temp_filename, AVIO_FLAG_WRITE, - &s->interrupt_callback, NULL, s->protocol_whitelist); + ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; @@ -189,7 +189,7 @@ static int write_manifest(AVFormatContext *s, int final) int b64_size = AV_BASE64_SIZE(os->metadata_size); char *base64 = av_malloc(b64_size); if (!base64) { - avio_close(out); + ff_format_io_close(s, &out); return AVERROR(ENOMEM); } av_base64_encode(base64, b64_size, os->metadata, os->metadata_size); @@ -202,7 +202,7 @@ static int write_manifest(AVFormatContext *s, int final) } avio_printf(out, "</manifest>\n"); avio_flush(out); - avio_close(out); + ff_format_io_close(s, &out); return ff_rename(temp_filename, filename, s); } @@ -239,8 +239,7 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final) "%s/stream%d.abst", s->filename, index); snprintf(temp_filename, sizeof(temp_filename), "%s/stream%d.abst.tmp", s->filename, index); - ret = ffio_open_whitelist(&out, temp_filename, AVIO_FLAG_WRITE, - &s->interrupt_callback, NULL, s->protocol_whitelist); + ret = s->io_open(s, &out, temp_filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) { av_log(s, AV_LOG_ERROR, "Unable to open %s for writing\n", temp_filename); return ret; @@ -283,15 +282,14 @@ static int write_abst(AVFormatContext *s, OutputStream *os, int final) } update_size(out, afrt_pos); update_size(out, 0); - avio_close(out); + ff_format_io_close(s, &out); return ff_rename(temp_filename, filename, s); } static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts) { int ret, i; - ret = ffio_open_whitelist(&os->out, os->temp_filename, AVIO_FLAG_WRITE, - &s->interrupt_callback, NULL, s->protocol_whitelist); + ret = s->io_open(s, &os->out, os->temp_filename, AVIO_FLAG_WRITE, NULL); if (ret < 0) return ret; avio_wb32(os->out, 0); @@ -304,13 +302,13 @@ static int init_file(AVFormatContext *s, OutputStream *os, int64_t start_ts) return 0; } -static void close_file(OutputStream *os) +static void close_file(AVFormatContext *s, OutputStream *os) { int64_t pos = avio_tell(os->out); avio_seek(os->out, 0, SEEK_SET); avio_wb32(os->out, pos); avio_flush(os->out); - avio_closep(&os->out); + ff_format_io_close(s, &os->out); } static int hds_write_header(AVFormatContext *s) @@ -475,7 +473,7 @@ static int hds_flush(AVFormatContext *s, OutputStream *os, int final, avio_flush(os->ctx->pb); os->packets_written = 0; - close_file(os); + close_file(s, os); snprintf(target_filename, sizeof(target_filename), "%s/stream%dSeg1-Frag%d", s->filename, index, os->fragment_index); |