Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Sebechlebsky <sebechlebskyjan@gmail.com>2016-04-12 20:46:27 +0300
committerMarton Balint <cus@passwd.hu>2016-04-14 01:49:11 +0300
commit2ea5ab6fc6b1b453791eb3c62e7205a66d339299 (patch)
tree874613ee74c7a51f3dd8f2ec245ef73f02d852b8 /libavformat/tee.c
parent949444348b752664243681625f9f1d2c55b6dfaa (diff)
avformat/tee: Refactor close_slaves function in tee muxer
Closing single slave operation is pulled out into separate function close_slave(TeeSlave*). Both close_slave and close_slaves function are moved before open_slave function. Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Jan Sebechlebsky <sebechlebskyjan@gmail.com> Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat/tee.c')
-rw-r--r--libavformat/tee.c58
1 files changed, 32 insertions, 26 deletions
diff --git a/libavformat/tee.c b/libavformat/tee.c
index bb344e6231..ab6cd32c3b 100644
--- a/libavformat/tee.c
+++ b/libavformat/tee.c
@@ -135,6 +135,38 @@ end:
return ret;
}
+static void close_slave(TeeSlave *tee_slave)
+{
+ AVFormatContext *avf;
+ unsigned i;
+
+ avf = tee_slave->avf;
+ for (i = 0; i < avf->nb_streams; ++i) {
+ AVBitStreamFilterContext *bsf_next, *bsf = tee_slave->bsfs[i];
+ while (bsf) {
+ bsf_next = bsf->next;
+ av_bitstream_filter_close(bsf);
+ bsf = bsf_next;
+ }
+ }
+ av_freep(&tee_slave->stream_map);
+ av_freep(&tee_slave->bsfs);
+
+ ff_format_io_close(avf, &avf->pb);
+ avformat_free_context(avf);
+ tee_slave->avf = NULL;
+}
+
+static void close_slaves(AVFormatContext *avf)
+{
+ TeeContext *tee = avf->priv_data;
+ unsigned i;
+
+ for (i = 0; i < tee->nb_slaves; i++) {
+ close_slave(&tee->slaves[i]);
+ }
+}
+
static int open_slave(AVFormatContext *avf, char *slave, TeeSlave *tee_slave)
{
int i, ret;
@@ -311,32 +343,6 @@ end:
return ret;
}
-static void close_slaves(AVFormatContext *avf)
-{
- TeeContext *tee = avf->priv_data;
- AVFormatContext *avf2;
- unsigned i, j;
-
- for (i = 0; i < tee->nb_slaves; i++) {
- avf2 = tee->slaves[i].avf;
-
- for (j = 0; j < avf2->nb_streams; j++) {
- AVBitStreamFilterContext *bsf_next, *bsf = tee->slaves[i].bsfs[j];
- while (bsf) {
- bsf_next = bsf->next;
- av_bitstream_filter_close(bsf);
- bsf = bsf_next;
- }
- }
- av_freep(&tee->slaves[i].stream_map);
- av_freep(&tee->slaves[i].bsfs);
-
- ff_format_io_close(avf2, &avf2->pb);
- avformat_free_context(avf2);
- tee->slaves[i].avf = NULL;
- }
-}
-
static void log_slave(TeeSlave *slave, void *log_ctx, int log_level)
{
int i;