[FFmpeg-cvslog] examples/avio_list_dir: init/deinit network
Lukasz Marek
git at videolan.org
Mon Apr 6 17:22:24 CEST 2015
ffmpeg | branch: master | Lukasz Marek <lukasz.m.luki2 at gmail.com> | Fri Apr 3 23:55:21 2015 +0200| [f79cd98caf362988e6c30fbd14da26231cd2341c] | committer: Lukasz Marek
examples/avio_list_dir: init/deinit network
Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f79cd98caf362988e6c30fbd14da26231cd2341c
---
doc/examples/avio_list_dir.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/doc/examples/avio_list_dir.c b/doc/examples/avio_list_dir.c
index 281b5af..4060ba6 100644
--- a/doc/examples/avio_list_dir.c
+++ b/doc/examples/avio_list_dir.c
@@ -74,17 +74,18 @@ int main(int argc, char *argv[])
/* register codecs and formats and other lavf/lavc components*/
av_register_all();
+ avformat_network_init();
if ((ret = avio_open_dir(&ctx, input_dir, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open directory: %s.\n", av_err2str(ret));
- return 1;
+ goto fail;
}
cnt = 0;
for (;;) {
if ((ret = avio_read_dir(ctx, &entry)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot list directory: %s.\n", av_err2str(ret));
- return 1;
+ goto fail;
}
if (!entry)
break;
@@ -111,7 +112,9 @@ int main(int argc, char *argv[])
cnt++;
};
+ fail:
avio_close_dir(&ctx);
+ avformat_network_deinit();
- return 0;
+ return ret < 0 ? 1 : 0;
}
More information about the ffmpeg-cvslog
mailing list