diff mbox series

[FFmpeg-devel] avformat: AMQP: add option delivery_mode

Message ID 20200614131237.21188-1-levis.florian@gmail.com
State Superseded
Headers show
Series [FFmpeg-devel] avformat: AMQP: add option delivery_mode
Related show

Checks

Context Check Description
andriy/default pending
andriy/make success Make finished
andriy/make_fate success Make fate finished

Commit Message

Florian Levis June 14, 2020, 1:12 p.m. UTC
Signed-off-by: Levis Florian <levis.florian@gmail.com>
---
 libavformat/libamqp.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Marton Balint June 14, 2020, 2:39 p.m. UTC | #1
On Sun, 14 Jun 2020, Levis Florian wrote:

> Signed-off-by: Levis Florian <levis.florian@gmail.com>
> ---
> libavformat/libamqp.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libavformat/libamqp.c b/libavformat/libamqp.c
> index aaf0e51152..485c0ccc49 100644
> --- a/libavformat/libamqp.c
> +++ b/libavformat/libamqp.c
> @@ -39,6 +39,7 @@ typedef struct AMQPContext {
>     int pkt_size;
>     int64_t connection_timeout;
>     int pkt_size_overflow;
> +    int delivery_mode;
> } AMQPContext;
> 
> #define STR_LEN           1024
> @@ -52,6 +53,7 @@ static const AVOption options[] = {
>     { "exchange", "Exchange to send/read packets", OFFSET(exchange), AV_OPT_TYPE_STRING, { .str = "amq.direct" }, 0, 0, .flags = D | E },
>     { "routing_key", "Key to filter streams", OFFSET(routing_key), AV_OPT_TYPE_STRING, { .str = "amqp" }, 0, 0, .flags = D | E },
>     { "connection_timeout", "Initial connection timeout", OFFSET(connection_timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT64_MAX, .flags = D | E},
> +    { "delivery_mode", "Delivery more (non-persistent: 1/persistent: 2)", OFFSET(delivery_mode), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, 2, .flags = D | E},

Missing docs from protocols.texi and AV_OPT_TYPE_CONSTs should be added 
for the two modes.

Regards,
Marton

>     { NULL }
> };
> 
> @@ -222,7 +224,7 @@ static int amqp_proto_write(URLContext *h, const unsigned char *buf, int size)
>
>     props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;
>     props.content_type = amqp_cstring_bytes("octet/stream");
> -    props.delivery_mode = 2; /* persistent delivery mode */
> +    props.delivery_mode = s->delivery_mode;
>
>     ret = amqp_basic_publish(s->conn, DEFAULT_CHANNEL, amqp_cstring_bytes(s->exchange),
>                              amqp_cstring_bytes(s->routing_key), 0, 0,
> -- 
> 2.27.0
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
Florian Levis June 14, 2020, 5:03 p.m. UTC | #2
Hi,

To Marton Balint that reviewed my patch:

I tried to send fixed patch specify the --in-reply-to option, but I 
guess it's not the good way to do it, cause I see a new thread on the 
patchwork (20200614165606.36659-1-levis.florian@gmail.com)

git format-patch -M origin/master -o outgoing/
git send-email outgoing/* 
--in-reply-to=20200614131237.21188-1-levis.florian@gmail.com

Sorry aboutt that =/
I will dig on other mailing list / doc to find the right way to do it.

Le 14/06/2020 à 16:39, Marton Balint a écrit :
>
>
> On Sun, 14 Jun 2020, Levis Florian wrote:
>
>> Signed-off-by: Levis Florian <levis.florian@gmail.com>
>> ---
>> libavformat/libamqp.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/libamqp.c b/libavformat/libamqp.c
>> index aaf0e51152..485c0ccc49 100644
>> --- a/libavformat/libamqp.c
>> +++ b/libavformat/libamqp.c
>> @@ -39,6 +39,7 @@ typedef struct AMQPContext {
>>     int pkt_size;
>>     int64_t connection_timeout;
>>     int pkt_size_overflow;
>> +    int delivery_mode;
>> } AMQPContext;
>>
>> #define STR_LEN           1024
>> @@ -52,6 +53,7 @@ static const AVOption options[] = {
>>     { "exchange", "Exchange to send/read packets", OFFSET(exchange), 
>> AV_OPT_TYPE_STRING, { .str = "amq.direct" }, 0, 0, .flags = D | E },
>>     { "routing_key", "Key to filter streams", OFFSET(routing_key), 
>> AV_OPT_TYPE_STRING, { .str = "amqp" }, 0, 0, .flags = D | E },
>>     { "connection_timeout", "Initial connection timeout", 
>> OFFSET(connection_timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, 
>> INT64_MAX, .flags = D | E},
>> +    { "delivery_mode", "Delivery more (non-persistent: 1/persistent: 
>> 2)", OFFSET(delivery_mode), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, 2, 
>> .flags = D | E},
>
> Missing docs from protocols.texi and AV_OPT_TYPE_CONSTs should be 
> added for the two modes.
>
> Regards,
> Marton
>
>>     { NULL }
>> };
>>
>> @@ -222,7 +224,7 @@ static int amqp_proto_write(URLContext *h, const 
>> unsigned char *buf, int size)
>>
>>     props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | 
>> AMQP_BASIC_DELIVERY_MODE_FLAG;
>>     props.content_type = amqp_cstring_bytes("octet/stream");
>> -    props.delivery_mode = 2; /* persistent delivery mode */
>> +    props.delivery_mode = s->delivery_mode;
>>
>>     ret = amqp_basic_publish(s->conn, DEFAULT_CHANNEL, 
>> amqp_cstring_bytes(s->exchange),
>> amqp_cstring_bytes(s->routing_key), 0, 0,
>> -- 
>> 2.27.0
>>
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
>> To unsubscribe, visit link above, or email
>> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/libavformat/libamqp.c b/libavformat/libamqp.c
index aaf0e51152..485c0ccc49 100644
--- a/libavformat/libamqp.c
+++ b/libavformat/libamqp.c
@@ -39,6 +39,7 @@  typedef struct AMQPContext {
     int pkt_size;
     int64_t connection_timeout;
     int pkt_size_overflow;
+    int delivery_mode;
 } AMQPContext;
 
 #define STR_LEN           1024
@@ -52,6 +53,7 @@  static const AVOption options[] = {
     { "exchange", "Exchange to send/read packets", OFFSET(exchange), AV_OPT_TYPE_STRING, { .str = "amq.direct" }, 0, 0, .flags = D | E },
     { "routing_key", "Key to filter streams", OFFSET(routing_key), AV_OPT_TYPE_STRING, { .str = "amqp" }, 0, 0, .flags = D | E },
     { "connection_timeout", "Initial connection timeout", OFFSET(connection_timeout), AV_OPT_TYPE_DURATION, { .i64 = -1 }, -1, INT64_MAX, .flags = D | E},
+    { "delivery_mode", "Delivery more (non-persistent: 1/persistent: 2)", OFFSET(delivery_mode), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, 2, .flags = D | E},
     { NULL }
 };
 
@@ -222,7 +224,7 @@  static int amqp_proto_write(URLContext *h, const unsigned char *buf, int size)
 
     props._flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_DELIVERY_MODE_FLAG;
     props.content_type = amqp_cstring_bytes("octet/stream");
-    props.delivery_mode = 2; /* persistent delivery mode */
+    props.delivery_mode = s->delivery_mode;
 
     ret = amqp_basic_publish(s->conn, DEFAULT_CHANNEL, amqp_cstring_bytes(s->exchange),
                              amqp_cstring_bytes(s->routing_key), 0, 0,