diff options
author | Gijs Peskens <gijs@peskens.net> | 2021-09-28 11:22:39 +0300 |
---|---|---|
committer | Marton Balint <cus@passwd.hu> | 2021-10-10 18:25:23 +0300 |
commit | 5274f2f7f8c5e40d18b84055fbb232752bd24f2f (patch) | |
tree | 3ba47d82cdf8b7c7f0492131ba6ef4f32bd2e576 /libavformat | |
parent | 9420f7e09560d82ebdb96ddc6724a734f4fe0b95 (diff) |
avformat/librist: replace deprecated functions
This gets rid of of rist_receiver_data_read, rist_receiver_data_block_free and rist_parse_address
these functions have been deprecated since librist release v0.2.1 and are replaced with functions
suffixed with 2.
I added a version macro check at the top of the file to ensure ffmpeg can still be compiled against
older versions.
Signed-off-by: Gijs Peskens <gijs@peskens.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/librist.c | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/libavformat/librist.c b/libavformat/librist.c index 8f51050c3e..6eae90cc2f 100644 --- a/libavformat/librist.c +++ b/libavformat/librist.c @@ -34,10 +34,16 @@ #include "url.h" #include <librist/librist.h> +#include <librist/version.h> // RIST_MAX_PACKET_SIZE - 28 minimum protocol overhead #define MAX_PAYLOAD_SIZE (10000-28) +#define FF_LIBRIST_MAKE_VERSION(major, minor, patch) \ + ((patch) + ((minor)* 0x100) + ((major) *0x10000)) +#define FF_LIBRIST_VERSION FF_LIBRIST_MAKE_VERSION(LIBRIST_API_VERSION_MAJOR, LIBRIST_API_VERSION_MINOR, LIBRIST_API_VERSION_PATCH) +#define FF_LIBRIST_VERSION_41 FF_LIBRIST_MAKE_VERSION(4, 1, 0) + typedef struct RISTContext { const AVClass *class; @@ -146,7 +152,11 @@ static int librist_open(URLContext *h, const char *uri, int flags) if (ret < 0) goto err; +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 ret = rist_parse_address(uri, (const struct rist_peer_config **)&peer_config); +#else + ret = rist_parse_address2(uri, &peer_config); +#endif if (ret < 0) goto err; @@ -187,10 +197,16 @@ err: static int librist_read(URLContext *h, uint8_t *buf, int size) { RISTContext *s = h->priv_data; - const struct rist_data_block *data_block; int ret; +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 + const struct rist_data_block *data_block; ret = rist_receiver_data_read(s->ctx, &data_block, POLLING_TIME); +#else + struct rist_data_block *data_block; + ret = rist_receiver_data_read2(s->ctx, &data_block, POLLING_TIME); +#endif + if (ret < 0) return risterr2ret(ret); @@ -198,14 +214,21 @@ static int librist_read(URLContext *h, uint8_t *buf, int size) return AVERROR(EAGAIN); if (data_block->payload_len > MAX_PAYLOAD_SIZE) { +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 rist_receiver_data_block_free((struct rist_data_block**)&data_block); +#else + rist_receiver_data_block_free2(&data_block); +#endif return AVERROR_EXTERNAL; } size = data_block->payload_len; memcpy(buf, data_block->payload, size); +#if FF_LIBRIST_VERSION < FF_LIBRIST_VERSION_41 rist_receiver_data_block_free((struct rist_data_block**)&data_block); - +#else + rist_receiver_data_block_free2(&data_block); +#endif return size; } |