summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-12-11 10:01:46 +0100
committerAnton Khirnov <anton@khirnov.net>2011-12-12 20:21:47 +0100
commit3a7f7678eb3be1f9a28414c9908ed8d34b1b9846 (patch)
tree4f74061acc8f586c6273ceea7bdaab77cd9c6e2a /libavformat
parent59826cab8ad9f64bf5fd752f52c6acc16815dbb0 (diff)
lavf: deprecate av_close_input_stream().
And remove all its uses.
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/anm.c11
-rw-r--r--libavformat/avformat.h4
-rw-r--r--libavformat/mpegts.c2
-rw-r--r--libavformat/rtsp.c2
-rw-r--r--libavformat/utils.c7
5 files changed, 17 insertions, 9 deletions
diff --git a/libavformat/anm.c b/libavformat/anm.c
index 00a36abebe..7ceb2d8918 100644
--- a/libavformat/anm.c
+++ b/libavformat/anm.c
@@ -137,16 +137,16 @@ static int read_header(AVFormatContext *s,
st->codec->extradata = av_mallocz(st->codec->extradata_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!st->codec->extradata) {
ret = AVERROR(ENOMEM);
- goto close_and_return;
+ goto fail;
}
ret = avio_read(pb, st->codec->extradata, st->codec->extradata_size);
if (ret < 0)
- goto close_and_return;
+ goto fail;
/* read page table */
ret = avio_seek(pb, anm->page_table_offset, SEEK_SET);
if (ret < 0)
- goto close_and_return;
+ goto fail;
for (i = 0; i < MAX_PAGES; i++) {
Page *p = &anm->pt[i];
@@ -159,7 +159,7 @@ static int read_header(AVFormatContext *s,
anm->page = find_record(anm, 0);
if (anm->page < 0) {
ret = anm->page;
- goto close_and_return;
+ goto fail;
}
anm->record = -1;
@@ -169,8 +169,7 @@ invalid:
av_log_ask_for_sample(s, NULL);
ret = AVERROR_INVALIDDATA;
-close_and_return:
- av_close_input_stream(s);
+fail:
return ret;
}
diff --git a/libavformat/avformat.h b/libavformat/avformat.h
index faef47483d..548bc186fb 100644
--- a/libavformat/avformat.h
+++ b/libavformat/avformat.h
@@ -1560,11 +1560,15 @@ int av_read_play(AVFormatContext *s);
*/
int av_read_pause(AVFormatContext *s);
+#if FF_API_FORMAT_PARAMETERS
/**
* Free a AVFormatContext allocated by av_open_input_stream.
* @param s context to free
+ * @deprecated use av_close_input_file()
*/
+attribute_deprecated
void av_close_input_stream(AVFormatContext *s);
+#endif
/**
* Close a media file (but not its codecs).
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 37ffae9f66..0d25e3f254 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -368,7 +368,7 @@ static void mpegts_close_filter(MpegTSContext *ts, MpegTSFilter *filter)
PESContext *pes = filter->u.pes_filter.opaque;
av_freep(&pes->buffer);
/* referenced private data will be freed later in
- * av_close_input_stream */
+ * av_close_input_file */
if (!((PESContext *)filter->u.pes_filter.opaque)->st) {
av_freep(&filter->u.pes_filter.opaque);
}
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b63f9f68cf..52821545ff 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -580,7 +580,7 @@ void ff_rtsp_close_streams(AVFormatContext *s)
}
av_free(rt->rtsp_streams);
if (rt->asf_ctx) {
- av_close_input_stream (rt->asf_ctx);
+ av_close_input_file(rt->asf_ctx);
rt->asf_ctx = NULL;
}
av_free(rt->p);
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 8b749ad7fc..8a76cb815e 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -2632,6 +2632,7 @@ int av_read_pause(AVFormatContext *s)
return AVERROR(ENOSYS);
}
+#if FF_API_FORMAT_PARAMETERS
void av_close_input_stream(AVFormatContext *s)
{
flush_packet_queue(s);
@@ -2639,6 +2640,7 @@ void av_close_input_stream(AVFormatContext *s)
s->iformat->read_close(s);
avformat_free_context(s);
}
+#endif
void avformat_free_context(AVFormatContext *s)
{
@@ -2686,7 +2688,10 @@ void av_close_input_file(AVFormatContext *s)
{
AVIOContext *pb = (s->iformat->flags & AVFMT_NOFILE) || (s->flags & AVFMT_FLAG_CUSTOM_IO) ?
NULL : s->pb;
- av_close_input_stream(s);
+ flush_packet_queue(s);
+ if (s->iformat->read_close)
+ s->iformat->read_close(s);
+ avformat_free_context(s);
if (pb)
avio_close(pb);
}