Call avformat_network_init/deinit in the programs

Message ID 1320574554-38068-1-git-send-email-martin@martin.st
State Committed
Commit 776f2bb91a5e31a385ee0a200df907e9acb0de87
Headers show

Commit Message

Martin Storsjö Nov. 6, 2011, 10:15 a.m.
Calling the init function will become mandatory at some later
point. By calling it, more heavy network init (such as SSL/TLS
library init) can be done once at startup, instead of implicitly
when used (which could lead to it being done a number of times).
---
 avconv.c   |    2 ++
 avplay.c   |    2 ++
 avprobe.c  |    3 +++
 avserver.c |    1 +
 ffmpeg.c   |    2 ++
 5 files changed, 10 insertions(+), 0 deletions(-)

Comments

Anton Khirnov Nov. 6, 2011, 1:27 p.m. | #1
On Sun,  6 Nov 2011 12:15:54 +0200, Martin Storsjö <martin@martin.st> wrote:
> Calling the init function will become mandatory at some later
> point. By calling it, more heavy network init (such as SSL/TLS
> library init) can be done once at startup, instead of implicitly
> when used (which could lead to it being done a number of times).
> ---
>  avconv.c   |    2 ++
>  avplay.c   |    2 ++
>  avprobe.c  |    3 +++
>  avserver.c |    1 +
>  ffmpeg.c   |    2 ++
>  5 files changed, 10 insertions(+), 0 deletions(-)
> 

Ok.

Patch

diff --git a/avconv.c b/avconv.c
index 8f86c00..7c0e78a 100644
--- a/avconv.c
+++ b/avconv.c
@@ -542,6 +542,7 @@  void exit_program(int ret)
 #if CONFIG_AVFILTER
     avfilter_uninit();
 #endif
+    avformat_network_deinit();
 
     if (received_sigterm) {
         av_log(NULL, AV_LOG_INFO, "Received signal %d: terminating.\n",
@@ -4218,6 +4219,7 @@  int main(int argc, char **argv)
     avfilter_register_all();
 #endif
     av_register_all();
+    avformat_network_init();
 
     avio_set_interrupt_cb(decode_interrupt_cb);
 
diff --git a/avplay.c b/avplay.c
index 58db596..c67cc75 100644
--- a/avplay.c
+++ b/avplay.c
@@ -1259,6 +1259,7 @@  static void do_exit(void)
 #if CONFIG_AVFILTER
     avfilter_uninit();
 #endif
+    avformat_network_deinit();
     if (show_status)
         printf("\n");
     SDL_Quit();
@@ -3066,6 +3067,7 @@  int main(int argc, char **argv)
     avfilter_register_all();
 #endif
     av_register_all();
+    avformat_network_init();
 
     init_opts();
 
diff --git a/avprobe.c b/avprobe.c
index 99ec1aa..992f07c 100644
--- a/avprobe.c
+++ b/avprobe.c
@@ -399,6 +399,7 @@  int main(int argc, char **argv)
 
     parse_loglevel(argc, argv, options);
     av_register_all();
+    avformat_network_init();
     init_opts();
 #if CONFIG_AVDEVICE
     avdevice_register_all();
@@ -416,5 +417,7 @@  int main(int argc, char **argv)
 
     ret = probe_file(input_filename);
 
+    avformat_network_deinit();
+
     return ret;
 }
diff --git a/avserver.c b/avserver.c
index 5b9dcc9..ec5f2be 100644
--- a/avserver.c
+++ b/avserver.c
@@ -4670,6 +4670,7 @@  int main(int argc, char **argv)
 
     parse_loglevel(argc, argv, options);
     av_register_all();
+    avformat_network_init();
 
     show_banner();
 
diff --git a/ffmpeg.c b/ffmpeg.c
index 12d5517..c731cec 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -493,6 +493,7 @@  void exit_program(int ret)
 #if CONFIG_AVFILTER
     avfilter_uninit();
 #endif
+    avformat_network_deinit();
 
     if (received_sigterm) {
         fprintf(stderr,
@@ -4367,6 +4368,7 @@  int main(int argc, char **argv)
     avfilter_register_all();
 #endif
     av_register_all();
+    avformat_network_init();
 
     avio_set_interrupt_cb(decode_interrupt_cb);