From f35ff97f2e572a6b02180b248f929541962ffdd3 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 8 Apr 2011 07:41:47 +0200 Subject: [PATCH] lavf: use designated initializers for all protocols This is more readable and makes it easier to reorder URLProtocol members. --- libavformat/applehttpproto.c | 12 ++--- libavformat/concat.c | 11 ++--- libavformat/file.c | 20 ++++---- libavformat/gopher.c | 11 ++--- libavformat/http.c | 16 +++---- libavformat/librtmp.c | 90 ++++++++++++++++-------------------- libavformat/mmst.c | 10 ++-- libavformat/rtmpproto.c | 11 ++--- libavformat/rtpproto.c | 11 ++--- libavformat/tcp.c | 11 ++--- libavformat/udp.c | 11 ++--- 11 files changed, 97 insertions(+), 117 deletions(-) diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c index 52645f7494..8842bd4dcf 100644 --- a/libavformat/applehttpproto.c +++ b/libavformat/applehttpproto.c @@ -298,11 +298,9 @@ static int applehttp_close(URLContext *h) } URLProtocol ff_applehttp_protocol = { - "applehttp", - applehttp_open, - applehttp_read, - NULL, /* write */ - NULL, /* seek */ - applehttp_close, - .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, + .name = "applehttp", + .url_open = applehttp_open, + .url_read = applehttp_read, + .url_close = applehttp_close, + .flags = URL_PROTOCOL_FLAG_NESTED_SCHEME, }; diff --git a/libavformat/concat.c b/libavformat/concat.c index dbacc6987a..da9bee2cc4 100644 --- a/libavformat/concat.c +++ b/libavformat/concat.c @@ -190,10 +190,9 @@ static int64_t concat_seek(URLContext *h, int64_t pos, int whence) } URLProtocol ff_concat_protocol = { - "concat", - concat_open, - concat_read, - NULL, - concat_seek, - concat_close, + .name = "concat", + .url_open = concat_open, + .url_read = concat_read, + .url_seek = concat_seek, + .url_close = concat_close, }; diff --git a/libavformat/file.c b/libavformat/file.c index 729061a4e5..3293a5369b 100644 --- a/libavformat/file.c +++ b/libavformat/file.c @@ -95,12 +95,12 @@ static int file_close(URLContext *h) } URLProtocol ff_file_protocol = { - "file", - file_open, - file_read, - file_write, - file_seek, - file_close, + .name = "file", + .url_open = file_open, + .url_read = file_read, + .url_write = file_write, + .url_seek = file_seek, + .url_close = file_close, .url_get_file_handle = file_get_handle, }; @@ -131,10 +131,10 @@ static int pipe_open(URLContext *h, const char *filename, int flags) } URLProtocol ff_pipe_protocol = { - "pipe", - pipe_open, - file_read, - file_write, + .name = "pipe", + .url_open = pipe_open, + .url_read = file_read, + .url_write = file_write, .url_get_file_handle = file_get_handle, }; diff --git a/libavformat/gopher.c b/libavformat/gopher.c index cfc4424ef1..cfc07e79cf 100644 --- a/libavformat/gopher.c +++ b/libavformat/gopher.c @@ -121,10 +121,9 @@ static int gopher_read(URLContext *h, uint8_t *buf, int size) URLProtocol ff_gopher_protocol = { - "gopher", - gopher_open, - gopher_read, - gopher_write, - NULL, /*seek*/ - gopher_close, + .name = "gopher", + .url_open = gopher_open, + .url_read = gopher_read, + .url_write = gopher_write, + .url_close = gopher_close, }; diff --git a/libavformat/http.c b/libavformat/http.c index 8d20527feb..bcfce80bff 100644 --- a/libavformat/http.c +++ b/libavformat/http.c @@ -505,13 +505,13 @@ http_get_file_handle(URLContext *h) } URLProtocol ff_http_protocol = { - "http", - http_open, - http_read, - http_write, - http_seek, - http_close, + .name = "http", + .url_open = http_open, + .url_read = http_read, + .url_write = http_write, + .url_seek = http_seek, + .url_close = http_close, .url_get_file_handle = http_get_file_handle, - .priv_data_size = sizeof(HTTPContext), - .priv_data_class = &httpcontext_class, + .priv_data_size = sizeof(HTTPContext), + .priv_data_class = &httpcontext_class, }; diff --git a/libavformat/librtmp.c b/libavformat/librtmp.c index f98040297c..5770e59e7a 100644 --- a/libavformat/librtmp.c +++ b/libavformat/librtmp.c @@ -158,66 +158,56 @@ static int rtmp_get_file_handle(URLContext *s) } URLProtocol ff_rtmp_protocol = { - "rtmp", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmp", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmpt_protocol = { - "rtmpt", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmpt", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmpe_protocol = { - "rtmpe", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmpe", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmpte_protocol = { - "rtmpte", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmpte", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; URLProtocol ff_rtmps_protocol = { - "rtmps", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, - NULL, /* next */ - rtmp_read_pause, - rtmp_read_seek, - rtmp_get_file_handle + .name = "rtmps", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, + .url_read_pause = rtmp_read_pause, + .url_read_seek = rtmp_read_seek, + .url_get_file_handle = rtmp_get_file_handle }; diff --git a/libavformat/mmst.c b/libavformat/mmst.c index 30219dcecb..a3f260939d 100644 --- a/libavformat/mmst.c +++ b/libavformat/mmst.c @@ -623,10 +623,8 @@ static int mms_read(URLContext *h, uint8_t *buf, int size) } URLProtocol ff_mmst_protocol = { - "mmst", - mms_open, - mms_read, - NULL, // write - NULL, // seek - mms_close, + .name = "mmst", + .url_open = mms_open, + .url_read = mms_read, + .url_close = mms_close, }; diff --git a/libavformat/rtmpproto.c b/libavformat/rtmpproto.c index f1519845f1..9fc5196b2c 100644 --- a/libavformat/rtmpproto.c +++ b/libavformat/rtmpproto.c @@ -991,10 +991,9 @@ static int rtmp_write(URLContext *s, const uint8_t *buf, int size) } URLProtocol ff_rtmp_protocol = { - "rtmp", - rtmp_open, - rtmp_read, - rtmp_write, - NULL, /* seek */ - rtmp_close, + .name = "rtmp", + .url_open = rtmp_open, + .url_read = rtmp_read, + .url_write = rtmp_write, + .url_close = rtmp_close, }; diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c index 5ac0e1b428..b92b2e7ace 100644 --- a/libavformat/rtpproto.c +++ b/libavformat/rtpproto.c @@ -355,11 +355,10 @@ int rtp_get_rtcp_file_handle(URLContext *h) { } URLProtocol ff_rtp_protocol = { - "rtp", - rtp_open, - rtp_read, - rtp_write, - NULL, /* seek */ - rtp_close, + .name = "rtp", + .url_open = rtp_open, + .url_read = rtp_read, + .url_write = rtp_write, + .url_close = rtp_close, .url_get_file_handle = rtp_get_file_handle, }; diff --git a/libavformat/tcp.c b/libavformat/tcp.c index 8e380ac374..0cb3ae3262 100644 --- a/libavformat/tcp.c +++ b/libavformat/tcp.c @@ -195,11 +195,10 @@ static int tcp_get_file_handle(URLContext *h) } URLProtocol ff_tcp_protocol = { - "tcp", - tcp_open, - tcp_read, - tcp_write, - NULL, /* seek */ - tcp_close, + .name = "tcp", + .url_open = tcp_open, + .url_read = tcp_read, + .url_write = tcp_write, + .url_close = tcp_close, .url_get_file_handle = tcp_get_file_handle, }; diff --git a/libavformat/udp.c b/libavformat/udp.c index 07d1775e96..b881ff95fd 100644 --- a/libavformat/udp.c +++ b/libavformat/udp.c @@ -489,11 +489,10 @@ static int udp_close(URLContext *h) } URLProtocol ff_udp_protocol = { - "udp", - udp_open, - udp_read, - udp_write, - NULL, /* seek */ - udp_close, + .name = "udp", + .url_open = udp_open, + .url_read = udp_read, + .url_write = udp_write, + .url_close = udp_close, .url_get_file_handle = udp_get_file_handle, };