Author: Dennis Filder <d.filder@web.de>
Last-Update: 2022-06-28
Bug-Debian: https://bugs.debian.org/1004819
---- a/src/utils/ffmpeg-priv.h
-+++ b/src/utils/ffmpeg-priv.h
-@@ -66,6 +66,7 @@
-
- #if defined(HAVE_LIBAVCODEC_AVCODEC_H)
- #if LIBAVCODEC_VERSION_INT <= AV_VERSION_INT(52,24,0)
-+#if 0
- /*should work as long as nobody uses avformat.h*/
- typedef struct AVPacket{
- uint8_t *data;
-@@ -81,6 +82,7 @@
- return avcodec_decode_video(avctx,picture, got_picture_ptr,avpkt->data,avpkt->size);
- }
- #endif
-+#endif
- #if HAVE_AVCODEC_OLD_CODEC_IDS
- #include <libavcodec/old_codec_ids.h>
- #endif
-@@ -117,13 +119,17 @@
+--- mediastreamer2-5.3.29/cmake/FindFFMpeg.cmake.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/cmake/FindFFMpeg.cmake 2024-03-09 15:46:23.298516579 +0100
+@@ -71,8 +71,11 @@ endif()
+ set(_FFMpeg_CACHE_VARS ${_FFMpeg_REQUIRED_VARS}
+ HAVE_LIBAVCODEC_AVCODEC_H
+ HAVE_LIBSWSCALE_SWSCALE_H
++ HAVE_FUN_avcodec_alloc_context3
++ HAVE_FUN_avcodec_get_context_defaults
+ HAVE_FUN_avcodec_get_context_defaults3
+ HAVE_FUN_avcodec_open2
++ HAVE_FUN_avcodec_encode_video
+ HAVE_FUN_avcodec_encode_video2
+ HAVE_FUN_av_frame_alloc
+ HAVE_FUN_av_frame_free
+@@ -145,8 +148,11 @@ else()
+ if(LIBM)
+ list(APPEND CMAKE_REQUIRED_LIBRARIES ${LIBM})
+ endif()
++ check_symbol_exists(avcodec_alloc_context3 "libavcodec/avcodec.h" HAVE_FUN_avcodec_alloc_context3)
++ check_symbol_exists(avcodec_get_context_defaults "libavcodec/avcodec.h" HAVE_FUN_avcodec_get_context_defaults)
+ check_symbol_exists(avcodec_get_context_defaults3 "libavcodec/avcodec.h" HAVE_FUN_avcodec_get_context_defaults3)
+ check_symbol_exists(avcodec_open2 "libavcodec/avcodec.h" HAVE_FUN_avcodec_open2)
++ check_symbol_exists(avcodec_encode_video "libavcodec/avcodec.h" HAVE_FUN_avcodec_encode_video)
+ check_symbol_exists(avcodec_encode_video2 "libavcodec/avcodec.h" HAVE_FUN_avcodec_encode_video2)
+ check_symbol_exists(av_frame_alloc "libavutil/avutil.h;libavutil/frame.h" HAVE_FUN_av_frame_alloc)
+ check_symbol_exists(av_frame_free "libavutil/avutil.h;libavutil/frame.h" HAVE_FUN_av_frame_free)
+--- mediastreamer2-5.3.29/mediastreamer-config.h.cmake.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/mediastreamer-config.h.cmake 2024-03-09 17:07:32.915468933 +0100
+@@ -60,8 +60,11 @@
+ #cmakedefine HAVE_LIBAVCODEC_AVCODEC_H 1
+ #cmakedefine HAVE_LIBSWSCALE_SWSCALE_H 1
+ #cmakedefine HAVE_LIBYUV_H 1
++#cmakedefine HAVE_FUN_avcodec_alloc_context3
++#cmakedefine HAVE_FUN_avcodec_get_context_defaults 1
+ #cmakedefine HAVE_FUN_avcodec_get_context_defaults3 1
+ #cmakedefine HAVE_FUN_avcodec_open2 1
++#cmakedefine HAVE_FUN_avcodec_encode_video 1
+ #cmakedefine HAVE_FUN_avcodec_encode_video2 1
+ #cmakedefine HAVE_FUN_av_frame_alloc 1
+ #cmakedefine HAVE_FUN_av_frame_free 1
+--- mediastreamer2-5.3.29/src/utils/ffmpeg-priv.h.orig 2024-03-09 15:55:58.335401336 +0100
++++ mediastreamer2-5.3.29/src/utils/ffmpeg-priv.h 2024-03-09 15:56:01.452051119 +0100
+@@ -112,12 +112,14 @@ extern "C" {
+ extern "C" {
#endif
- #ifndef HAVE_FUN_avcodec_encode_video2
-+#if 0
- int avcodec_encode_video2 (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr);
+-#ifndef HAVE_FUN_avcodec_encode_video2
++#if defined(HAVE_FUN_avcodec_encode_video) && !defined(HAVE_FUN_avcodec_encode_video2)
+ int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr);
#endif
-+#endif
- #ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/
-+#if 0
- int avcodec_get_context_defaults3 (AVCodecContext *s, AVCodec *codec);
+-#ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/
++#if defined(HAVE_FUN_avcodec_get_context_defaults) && !defined(HAVE_FUN_avcodec_get_context_defaults3) /**/
+ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec);
++#endif
++#ifndef HAVE_FUN_avcodec_alloc_context3
AVCodecContext *avcodec_alloc_context3(AVCodec *codec);
#endif
-+#endif
- #ifndef HAVE_FUN_avcodec_open2 /**/
- int avcodec_open2 (AVCodecContext *avctx, AVCodec *codec, AVDictionary **options);
---- a/src/utils/ffmpeg-priv.c
-+++ b/src/utils/ffmpeg-priv.c
-@@ -23,6 +23,7 @@
+--- mediastreamer2-5.3.29/src/utils/ffmpeg-priv.c.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/src/utils/ffmpeg-priv.c 2024-03-09 15:56:57.378414806 +0100
+@@ -21,7 +21,7 @@
+ #include "ffmpeg-priv.h"
- #ifndef HAVE_FUN_avcodec_encode_video2
-+#if 0
- int avcodec_encode_video2 (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) {
- int error=avcodec_encode_video(avctx, avpkt->data, avpkt->size,frame);
- if (error<0){
-@@ -36,10 +37,12 @@
- return 0;
+-#ifndef HAVE_FUN_avcodec_encode_video2
++#if defined(HAVE_FUN_avcodec_encode_video) && !defined(HAVE_FUN_avcodec_encode_video2)
+ int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr) {
+ int error = avcodec_encode_video(avctx, avpkt->data, avpkt->size, frame);
+ if (error < 0) {
+@@ -36,12 +36,14 @@ int avcodec_encode_video2(AVCodecContext
}
#endif
-+#endif
-
-
- #ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/
-+#if 0
- int avcodec_get_context_defaults3 (AVCodecContext *s, AVCodec *codec) {
+-#ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/
++#if defined(HAVE_FUN_avcodec_get_context_defaults) && !defined(HAVE_FUN_avcodec_get_context_defaults3) /**/
+ int avcodec_get_context_defaults3(AVCodecContext *s, AVCodec *codec) {
avcodec_get_context_defaults(s);
return 0;
-@@ -48,6 +51,7 @@
- AVCodecContext *avcodec_alloc_context3(AVCodec *codec){
- return avcodec_alloc_context();
}
+#endif
- #endif
-
---- a/src/videofilters/videodec.c
-+++ b/src/videofilters/videodec.c
-@@ -49,8 +49,8 @@
-
++#ifndef HAVE_FUN_avcodec_alloc_context3 /**/
+ AVCodecContext *avcodec_alloc_context3(AVCodec *codec) {
+ return avcodec_alloc_context();
+ }
+--- mediastreamer2-5.3.29/src/videofilters/videodec.c.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/src/videofilters/videodec.c 2024-03-09 16:15:27.685733089 +0100
+@@ -47,8 +47,8 @@
+ extern void ms_ffmpeg_check_init(void);
- typedef struct DecState{
+ typedef struct DecState {
- AVCodecContext av_context;
- AVCodec *av_codec;
+ AVCodecContext *av_contextp;
enum CodecID codec;
mblk_t *input;
YuvBuf outbuf;
-@@ -66,11 +66,14 @@
- }DecState;
-
+@@ -63,11 +63,14 @@ typedef struct DecState {
+ bool_t first_image_decoded;
+ } DecState;
+/*
+ * FIXME: With the ffmpeg 5.0 API this ought to return an error when
+ * allocation fails.
+ */
- static void dec_init(MSFilter *f, enum CodecID cid){
- DecState *s=(DecState *)ms_new0(DecState,1);
+ static void dec_init(MSFilter *f, enum CodecID cid) {
+ DecState *s = (DecState *)ms_new0(DecState, 1);
ms_ffmpeg_check_init();
- avcodec_get_context_defaults3(&s->av_context, NULL);
s->allocator = ms_yuv_buf_allocator_new();
- s->av_codec=NULL;
- s->codec=cid;
-@@ -86,6 +89,10 @@
- if (s->av_codec==NULL){
- ms_error("Could not find decoder %i!",s->codec);
+ s->av_codec = NULL;
+ s->codec = cid;
+@@ -83,6 +86,10 @@ static void dec_init(MSFilter *f, enum C
+ if (s->av_codec == NULL) {
+ ms_error("Could not find decoder %i!", s->codec);
}
+ s->av_contextp = avcodec_alloc_context3(s->av_codec);
+ if (s->av_contextp==NULL){
s->orig = av_frame_alloc();
if (!s->orig) {
ms_error("Could not allocate frame");
-@@ -119,9 +126,8 @@
+@@ -118,9 +125,8 @@ static void dec_uninit(MSFilter *f) {
av_frame_free(&s->orig);
s->orig = NULL;
}
-- if (s->av_context.codec!=NULL){
+- if (s->av_context.codec != NULL) {
- avcodec_close(&s->av_context);
-- s->av_context.codec=NULL;
-+ if (s->av_contextp && s->av_contextp->codec!=NULL){
+- s->av_context.codec = NULL;
++ if (s->av_contextp != NULL && s->av_contextp->codec != NULL) {
+ avcodec_free_context(&s->av_contextp);
}
ms_yuv_buf_allocator_free(s->allocator);
- if (s->input!=NULL) freemsg(s->input);
-@@ -160,16 +166,16 @@
+ if (s->input != NULL) freemsg(s->input);
+@@ -159,16 +165,16 @@ static void dec_preprocess(MSFilter *f)
s->first_image_decoded = FALSE;
ms_average_fps_init(&s->fps, "Video decoder: FPS: %f");
-- if (s->av_context.codec==NULL){
-+ if (s->av_contextp && s->av_contextp->codec==NULL){
+- if (s->av_context.codec == NULL) {
++ if (s->av_contextp != NULL && s->av_contextp->codec == NULL) {
/* we must know picture size before initializing snow decoder*/
#if HAVE_AVCODEC_SNOW
- if (s->codec!=CODEC_ID_SNOW){
+ if (s->codec != CODEC_ID_SNOW) {
#endif
-- error=avcodec_open2(&s->av_context, s->av_codec, NULL);
-+ error=avcodec_open2(s->av_contextp, s->av_codec, NULL);
- if (error!=0) ms_error("avcodec_open() failed: %i",error);
- if (s->codec==CODEC_ID_MPEG4 && s->dci_size>0){
-- s->av_context.extradata=s->dci;
-- s->av_context.extradata_size=s->dci_size;
-+ s->av_contextp->extradata=s->dci;
-+ s->av_contextp->extradata_size=s->dci_size;
+- error = avcodec_open2(&s->av_context, s->av_codec, NULL);
++ error = avcodec_open2(s->av_contextp, s->av_codec, NULL);
+ if (error != 0) ms_error("avcodec_open() failed: %i", error);
+ if (s->codec == CODEC_ID_MPEG4 && s->dci_size > 0) {
+- s->av_context.extradata = s->dci;
+- s->av_context.extradata_size = s->dci_size;
++ s->av_contextp->extradata = s->dci;
++ s->av_contextp->extradata_size = s->dci_size;
}
#if HAVE_AVCODEC_SNOW
}
-@@ -256,15 +262,15 @@
- uint32_t h = ntohl(*(uint32_t*)inm->b_rptr);
- if (!s->snow_initialized){
+@@ -258,13 +264,13 @@ static mblk_t *parse_snow_header(DecStat
+ uint32_t h = ntohl(*(uint32_t *)inm->b_rptr);
+ if (!s->snow_initialized) {
int error;
-- s->av_context.width=h>>16;
-- s->av_context.height=h&0xffff;
-- error=avcodec_open2(&s->av_context, s->av_codec, NULL);
-+ s->av_contextp->width=h>>16;
-+ s->av_contextp->height=h&0xffff;
-+ error=avcodec_open2(s->av_contextp, s->av_codec, NULL);
- if (error!=0) ms_error("avcodec_open() failed for snow: %i",error);
+- s->av_context.width = h >> 16;
+- s->av_context.height = h & 0xffff;
+- error = avcodec_open2(&s->av_context, s->av_codec, NULL);
++ s->av_contextp->width = h >> 16;
++ s->av_contextp->height = h & 0xffff;
++ error = avcodec_open2(s->av_contextp, s->av_codec, NULL);
+ if (error != 0) ms_error("avcodec_open() failed for snow: %i", error);
else {
- s->snow_initialized=TRUE;
- ms_message("Snow decoder initialized,size=%ix%i",
-- s->av_context.width,
-- s->av_context.height);
-+ s->av_contextp->width,
-+ s->av_contextp->height);
+ s->snow_initialized = TRUE;
+- ms_message("Snow decoder initialized,size=%ix%i", s->av_context.width, s->av_context.height);
++ ms_message("Snow decoder initialized,size=%ix%i", s->av_contextp->width, s->av_contextp->height);
}
}
- inm->b_rptr+=4;
-@@ -628,7 +634,7 @@
+ inm->b_rptr += 4;
+@@ -558,7 +564,7 @@ static mblk_t *read_rfc2435_header(DecSt
}
- static mblk_t *get_as_yuvmsg(MSFilter *f, DecState *s, AVFrame *orig){
-- AVCodecContext *ctx=&s->av_context;
-+ AVCodecContext *ctx=s->av_contextp;
+ static mblk_t *get_as_yuvmsg(MSFilter *f, DecState *s, AVFrame *orig) {
+- AVCodecContext *ctx = &s->av_context;
++ AVCodecContext *ctx = s->av_contextp;
mblk_t *yuv_msg;
- if (ctx->width==0 || ctx->height==0){
-@@ -662,7 +668,7 @@
+ if (ctx->width == 0 || ctx->height == 0) {
+@@ -591,7 +597,7 @@ static mblk_t *get_as_yuvmsg(MSFilter *f
#endif
- ms_error("%s: error in ms_sws_scale().",f->desc->name);
+ ms_error("%s: error in ms_sws_scale().", f->desc->name);
}
- mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pkt_pts);
+ mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pts);
return yuv_msg;
}
/* Bitmasks to select bits of a byte from low side */
-@@ -671,7 +677,7 @@
- static void dec_process_frame(MSFilter *f, mblk_t *inm){
- DecState *s=(DecState*)f->data;
+@@ -600,7 +606,7 @@ static unsigned char smasks[7] = {0x7f,
+ static void dec_process_frame(MSFilter *f, mblk_t *inm) {
+ DecState *s = (DecState *)f->data;
- int got_picture;
+ int got_picture = 0;
/* get a picture from the input queue */
- if (f->desc->id==MS_H263_DEC_ID) inm=skip_rfc2429_header(inm);
-@@ -720,12 +726,27 @@
+ if (f->desc->id == MS_H263_DEC_ID) inm = skip_rfc2429_header(inm);
+@@ -649,12 +655,27 @@ static void dec_process_frame(MSFilter *
pkt.data = frame->b_rptr;
pkt.size = remain;
pkt.pts = frame_ts;
-- len=avcodec_decode_video2(&s->av_context, s->orig, &got_picture,&pkt);
+- len = avcodec_decode_video2(&s->av_context, s->orig, &got_picture, &pkt);
-
-- if (len<=0) {
-- ms_warning("ms_AVdecoder_process: error %i.",len);
-- ms_filter_notify_no_arg(f,MS_VIDEO_DECODER_DECODING_ERRORS);
+- if (len <= 0) {
+- ms_warning("ms_AVdecoder_process: error %i.", len);
+- ms_filter_notify_no_arg(f, MS_VIDEO_DECODER_DECODING_ERRORS);
- break;
+ {
+ int ret1 = avcodec_send_packet(s->av_contextp, &pkt), ret2;
+ }
}
if (got_picture) {
- mblk_t *om = get_as_yuvmsg(f,s,s->orig);
---- a/src/videofilters/videoenc.c
-+++ b/src/videofilters/videoenc.c
-@@ -37,6 +37,8 @@
+ mblk_t *om = get_as_yuvmsg(f, s, s->orig);
+--- mediastreamer2-5.3.29/src/videofilters/videoenc.c.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/src/videofilters/videoenc.c 2024-03-09 16:23:29.366456934 +0100
+@@ -37,6 +37,9 @@
#include "rfc2429.h"
+#include <libavutil/imgutils.h>
+#include <libavutil/opt.h>
-
++
#if LIBAVCODEC_VERSION_MAJOR >= 57
-@@ -129,7 +131,6 @@
+ #ifdef _MSC_VER
+@@ -109,7 +112,6 @@ void ms_ffmpeg_log_callback(void *ptr, i
- void ms_ffmpeg_check_init(){
- if(!avcodec_initialized){
+ void ms_ffmpeg_check_init() {
+ if (!avcodec_initialized) {
- avcodec_register_all();
- avcodec_initialized=TRUE;
+ avcodec_initialized = TRUE;
#ifdef ENABLE_LOG_FFMPEG
av_log_set_level(AV_LOG_WARNING);
-@@ -139,8 +140,8 @@
+@@ -119,8 +121,8 @@ void ms_ffmpeg_check_init() {
}
- typedef struct EncState{
+ typedef struct EncState {
- AVCodecContext av_context;
- AVCodec *av_codec;
+ AVCodecContext *av_contextp;
+ const AVCodec *av_codec;
- AVFrame* pict;
+ AVFrame *pict;
enum CodecID codec;
mblk_t *comp_buf;
-@@ -243,7 +244,7 @@
- s->qmin=2;
- s->req_vfu=FALSE;
- s->framenum=0;
-- s->av_context.codec=NULL;
-+ s->av_contextp->codec=NULL;
+@@ -223,7 +225,7 @@ static void enc_init(MSFilter *f, enum C
+ s->qmin = 2;
+ s->req_vfu = FALSE;
+ s->framenum = 0;
+- s->av_context.codec = NULL;
++ s->av_contextp->codec = NULL;
s->vconf_list = get_vconf_list(s);
- s->vconf = ms_video_find_best_configuration_for_bitrate(s->vconf_list, 500000,ms_factory_get_cpu_count(f->factory));
- s->pict = av_frame_alloc();
-@@ -265,11 +266,21 @@
- enc_init(f,CODEC_ID_MJPEG);
+ s->vconf =
+ ms_video_find_best_configuration_for_bitrate(s->vconf_list, 500000, ms_factory_get_cpu_count(f->factory));
+@@ -246,11 +248,21 @@ static void enc_mjpeg_init(MSFilter *f)
+ enc_init(f, CODEC_ID_MJPEG);
}
+/*
+ * FIXME: With the ffmpeg 5.0 API this ought to return an error when
+ * allocation fails.
+ */
- static void prepare(EncState *s){
-- AVCodecContext *c=&s->av_context;
-+ AVCodecContext *c=s->av_contextp;
- const int max_br_vbv=128000;
+ static void prepare(EncState *s) {
+- AVCodecContext *c = &s->av_context;
++ AVCodecContext *c = s->av_contextp;
+ const int max_br_vbv = 128000;
- avcodec_get_context_defaults3(c, NULL);
+ if (s->av_contextp != NULL)
+ ms_error("Could not allocate AVCodecContext.");
+ return;
+ }
- if (s->codec==CODEC_ID_MJPEG)
- {
- ms_message("Codec bitrate set to %i",(int)c->bit_rate);
-@@ -327,13 +338,13 @@
+ if (s->codec == CODEC_ID_MJPEG) {
+ ms_message("Codec bitrate set to %i", (int)c->bit_rate);
+ c->width = s->vconf.vsize.width;
+@@ -306,13 +318,13 @@ static void prepare(EncState *s) {
}
- static void prepare_h263(EncState *s){
-- AVCodecContext *c=&s->av_context;
-+ AVCodecContext *c=s->av_contextp;
+ static void prepare_h263(EncState *s) {
+- AVCodecContext *c = &s->av_context;
++ AVCodecContext *c = s->av_contextp;
/* we don't use the rtp_callback but use rtp_mode that forces ffmpeg to insert
Start Codes as much as possible in the bitstream */
- #if LIBAVCODEC_VERSION_INT < ((52<<16)+(0<<8)+0)
- c->rtp_mode = 1;
+ #if LIBAVCODEC_VERSION_INT < ((52 << 16) + (0 << 8) + 0)
+ c->rtp_mode = 1;
#endif
-- c->rtp_payload_size = s->mtu/2;
+- c->rtp_payload_size = s->mtu / 2;
+ av_opt_set_int((struct MpegEncContext *) c->priv_data, "ps", s->mtu/2, 0);
- if (s->profile==0){
- s->codec=CODEC_ID_H263;
- }else{
-@@ -349,7 +360,7 @@
+ if (s->profile == 0) {
+ s->codec = CODEC_ID_H263;
+ } else {
+@@ -328,7 +340,7 @@ static void prepare_h263(EncState *s) {
}
- static void prepare_mpeg4(EncState *s){
-- AVCodecContext *c=&s->av_context;
-+ AVCodecContext *c=s->av_contextp;
- c->max_b_frames=0; /*don't use b frames*/
+ static void prepare_mpeg4(EncState *s) {
+- AVCodecContext *c = &s->av_context;
++ AVCodecContext *c = s->av_contextp;
+ c->max_b_frames = 0; /*don't use b frames*/
}
-@@ -383,22 +394,21 @@
- ms_error("could not find encoder for codec id %i",s->codec);
+@@ -360,22 +372,21 @@ static void enc_preprocess(MSFilter *f)
+ ms_error("could not find encoder for codec id %i", s->codec);
return;
}
-- error=avcodec_open2(&s->av_context, s->av_codec, NULL);
-+ error=avcodec_open2(s->av_contextp, s->av_codec, NULL);
- if (error!=0) {
- ms_error("avcodec_open() failed: %i",error);
+- error = avcodec_open2(&s->av_context, s->av_codec, NULL);
++ error = avcodec_open2(s->av_contextp, s->av_codec, NULL);
+ if (error != 0) {
+ ms_error("avcodec_open() failed: %i", error);
return;
}
ms_video_starter_init(&s->starter);
-- ms_debug("image format is %i.",s->av_context.pix_fmt);
-- ms_message("qmin=%i qmax=%i",s->av_context.qmin,s->av_context.qmax);
-+ ms_debug("image format is %i.",s->av_contextp->pix_fmt);
-+ ms_message("qmin=%i qmax=%i",s->av_contextp->qmin,s->av_contextp->qmax);
- s->framenum=0;
+- ms_debug("image format is %i.", s->av_context.pix_fmt);
+- ms_message("qmin=%i qmax=%i", s->av_context.qmin, s->av_context.qmax);
++ ms_debug("image format is %i.", s->av_contextp->pix_fmt);
++ ms_message("qmin=%i qmax=%i", s->av_contextp->qmin, s->av_contextp->qmax);
+ s->framenum = 0;
}
- static void enc_postprocess(MSFilter *f){
- EncState *s=(EncState*)f->data;
-- if (s->av_context.codec!=NULL){
+ static void enc_postprocess(MSFilter *f) {
+ EncState *s = (EncState *)f->data;
+- if (s->av_context.codec != NULL) {
- avcodec_close(&s->av_context);
-- s->av_context.codec=NULL;
-+ if (s->av_contextp->codec!=NULL){
+- s->av_context.codec = NULL;
++ if (s->av_contextp->codec != NULL) {
+ avcodec_free_context(&s->av_contextp);
}
- if (s->comp_buf!=NULL) {
+ if (s->comp_buf != NULL) {
freemsg(s->comp_buf);
-@@ -469,7 +479,7 @@
- /*frame->b_rptr=packet->b_wptr=packet->b_rptr+get_gbsc(packet->b_rptr, MIN(packet->b_rptr+s->mtu,frame->b_wptr));*/
+@@ -445,7 +456,7 @@ static void rfc2190_generate_packets(MSF
+ * MIN(packet->b_rptr+s->mtu,frame->b_wptr));*/
frame->b_rptr = packet->b_wptr =
- packet->b_rptr + get_gbsc_bytealigned(packet->b_rptr, MIN(packet->b_rptr+s->mtu,frame->b_wptr));
-- add_rfc2190_header(&packet, &s->av_context ,is_iframe);
-+ add_rfc2190_header(&packet, s->av_contextp ,is_iframe);
- mblk_set_timestamp_info(packet,timestamp);
- ms_queue_put(f->outputs[0],packet);
+ packet->b_rptr + get_gbsc_bytealigned(packet->b_rptr, MIN(packet->b_rptr + s->mtu, frame->b_wptr));
+- add_rfc2190_header(&packet, &s->av_context, is_iframe);
++ add_rfc2190_header(&packet, s->av_contextp, is_iframe);
+ mblk_set_timestamp_info(packet, timestamp);
+ ms_queue_put(f->outputs[0], packet);
}
-@@ -805,8 +815,8 @@
- static void process_frame(MSFilter *f, mblk_t *inm){
- EncState *s=(EncState*)f->data;
-
-- AVCodecContext *c=&s->av_context;
-- int error,got_packet;
-+ AVCodecContext *c=s->av_contextp;
-+ int got_packet=0;
- mblk_t *comp_buf=s->comp_buf;
- int comp_buf_sz= (int) (dblk_lim(comp_buf->b_datap)-dblk_base(comp_buf->b_datap));
+@@ -776,8 +787,8 @@ static void split_and_send(MSFilter *f,
+ static void process_frame(MSFilter *f, mblk_t *inm) {
+ EncState *s = (EncState *)f->data;
+
+- AVCodecContext *c = &s->av_context;
+- int error, got_packet;
++ AVCodecContext *c = s->av_contextp;
++ int got_packet = 0;
+ mblk_t *comp_buf = s->comp_buf;
+ int comp_buf_sz = (int)(dblk_lim(comp_buf->b_datap) - dblk_base(comp_buf->b_datap));
YuvBuf yuv;
-@@ -816,7 +826,7 @@
+@@ -787,7 +798,7 @@ static void process_frame(MSFilter *f, m
ms_yuv_buf_init_from_mblk(&yuv, inm);
/* convert image if necessary */
av_frame_unref(s->pict);
-- avpicture_fill((AVPicture*)s->pict,yuv.planes[0],c->pix_fmt,c->width,c->height);
+- avpicture_fill((AVPicture *)s->pict, yuv.planes[0], c->pix_fmt, c->width, c->height);
+ av_image_fill_arrays(s->pict->data, s->pict->linesize, yuv.planes[0],c->pix_fmt,c->width,c->height, 32);
/* timestamp used by ffmpeg, unset here */
- s->pict->pts=AV_NOPTS_VALUE;
-@@ -841,10 +851,21 @@
+ s->pict->pts = AV_NOPTS_VALUE;
+@@ -812,10 +823,21 @@ static void process_frame(MSFilter *f, m
#endif
- packet.data=comp_buf->b_wptr;
- packet.size=comp_buf_sz;
-- error=avcodec_encode_video2(c, &packet, s->pict, &got_packet);
+ packet.data = comp_buf->b_wptr;
+ packet.size = comp_buf_sz;
+- error = avcodec_encode_video2(c, &packet, s->pict, &got_packet);
-
-- if (error<0) ms_warning("ms_AVencoder_process: error %i.",error);
-- else if (got_packet){
+- if (error < 0) ms_warning("ms_AVencoder_process: error %i.", error);
+- else if (got_packet) {
+ {
+ int ret1 = avcodec_send_frame(c, s->pict), ret2;
+ char errmsg[AV_ERROR_MAX_STRING_SIZE];
+ if (got_packet){
bool_t is_iframe = FALSE;
s->framenum++;
- if (s->framenum==1){
-@@ -867,7 +888,7 @@
- static void enc_process(MSFilter *f){
+ if (s->framenum == 1) {
+@@ -838,7 +860,7 @@ static void process_frame(MSFilter *f, m
+ static void enc_process(MSFilter *f) {
mblk_t *inm;
- EncState *s=(EncState*)f->data;
-- if (s->av_context.codec==NULL) {
-+ if (s->av_contextp && s->av_contextp->codec==NULL) {
+ EncState *s = (EncState *)f->data;
+- if (s->av_context.codec == NULL) {
++ if (s->av_contextp != NULL && s->av_contextp->codec == NULL) {
ms_queue_flush(f->inputs[0]);
return;
}
-@@ -894,7 +915,7 @@
+@@ -864,7 +886,7 @@ static int enc_set_configuration(MSFilte
+ if (vconf != &s->vconf) memcpy(&s->vconf, vconf, sizeof(MSVideoConfiguration));
- if (s->vconf.required_bitrate > s->vconf.bitrate_limit)
- s->vconf.required_bitrate = s->vconf.bitrate_limit;
+ if (s->vconf.required_bitrate > s->vconf.bitrate_limit) s->vconf.required_bitrate = s->vconf.bitrate_limit;
- if (s->av_context.codec != NULL) {
-+ if (s->av_contextp && s->av_contextp->codec != NULL) {
++ if (s->av_contextp != NULL && s->av_contextp->codec != NULL) {
/* Do not change video size if encoder is running */
if (!ms_video_size_equal(s->vconf.vsize, vsize)) {
- ms_warning("Video configuration: cannot change video size when encoder is running, actual=%dx%d, wanted=%dx%d", vsize.width, vsize.height, s->vconf.vsize.width, s->vconf.vsize.height);
---- a/src/videofilters/h264dec.cpp
-+++ b/src/videofilters/h264dec.cpp
-@@ -54,7 +54,7 @@
+ ms_warning(
+--- mediastreamer2-5.3.29/src/videofilters/h264dec.cpp.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/src/videofilters/h264dec.cpp 2024-03-09 16:44:34.179604853 +0100
+@@ -53,7 +53,7 @@ typedef struct _DecData {
MSVideoSize vsize;
struct SwsContext *sws_ctx;
MSAverageFPS fps;
unsigned int packet_num;
uint8_t *bitstream;
int bitstream_size;
-@@ -67,18 +67,19 @@
- static void ffmpeg_init(void){
- static bool_t done=FALSE;
- if (!done){
+@@ -66,18 +66,19 @@ typedef struct _DecData {
+ static void ffmpeg_init(void) {
+ static bool_t done = FALSE;
+ if (!done) {
- avcodec_register_all();
- done=TRUE;
+ done = TRUE;
}
}
- static void dec_open(DecData *d){
+ static void dec_open(DecData *d) {
- AVCodec *codec;
-+ const AVCodec *codec=avcodec_find_decoder(CODEC_ID_H264);
int error;
-- codec=avcodec_find_decoder(CODEC_ID_H264);
- if (codec==NULL) ms_fatal("Could not find H264 decoder in ffmpeg.");
+- codec = avcodec_find_decoder(CODEC_ID_H264);
++ const AVCodec *codec = avcodec_find_decoder(CODEC_ID_H264);
+ if (codec == NULL) ms_fatal("Could not find H264 decoder in ffmpeg.");
- avcodec_get_context_defaults3(&d->av_context, NULL);
-- error=avcodec_open2(&d->av_context,codec, NULL);
+- error = avcodec_open2(&d->av_context, codec, NULL);
+ d->av_contextp = avcodec_alloc_context3(codec);
+ if (!d->av_contextp) {
+ ms_fatal("Could not allocate AVCodecContext!");
+ }
+ error=avcodec_open2(d->av_contextp,codec, NULL);
- if (error!=0){
+ if (error != 0) {
ms_fatal("avcodec_open() failed.");
}
-@@ -114,7 +115,7 @@
+@@ -113,7 +114,7 @@ static void dec_preprocess(MSFilter *f)
}
- static void dec_reinit(DecData *d){
+ static void dec_reinit(DecData *d) {
- avcodec_close(&d->av_context);
+ avcodec_free_context(&d->av_contextp);
dec_open(d);
}
-@@ -126,7 +127,7 @@
- static void dec_uninit(MSFilter *f){
- DecData *d=(DecData*)f->data;
+@@ -125,7 +126,7 @@ static void dec_postprocess(MSFilter *f)
+ static void dec_uninit(MSFilter *f) {
+ DecData *d = (DecData *)f->data;
delete d->unpacker;
- avcodec_close(&d->av_context);
+ avcodec_free_context(&d->av_contextp);
if (d->sps) freemsg(d->sps);
if (d->pps) freemsg(d->pps);
if (d->orig) av_frame_free(&d->orig);
-@@ -137,7 +138,7 @@
+@@ -136,7 +137,7 @@ static void dec_uninit(MSFilter *f) {
}
- static mblk_t *get_as_yuvmsg(MSFilter *f, DecData *s, AVFrame *orig){
-- AVCodecContext *ctx=&s->av_context;
-+ AVCodecContext *ctx=s->av_contextp;
+ static mblk_t *get_as_yuvmsg(MSFilter *f, DecData *s, AVFrame *orig) {
+- AVCodecContext *ctx = &s->av_context;
++ AVCodecContext *ctx = s->av_contextp;
MSPicture pic = {0};
mblk_t *yuv_msg;
-@@ -165,7 +166,7 @@
- ms_error("%s: error in sws_scale().",f->desc->name);
+@@ -162,7 +163,7 @@ static mblk_t *get_as_yuvmsg(MSFilter *f
+ ms_error("%s: error in sws_scale().", f->desc->name);
}
- #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50,43,0) // backward compatibility with Debian Squeeze (6.0)
+ #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50, 43, 0) // backward compatibility with Debian Squeeze (6.0)
- mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pkt_pts);
+ mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pts);
#endif
return yuv_msg;
}
-@@ -326,9 +327,25 @@
- #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50,43,0) // backward compatibility with Debian Squeeze (6.0)
+@@ -316,9 +317,25 @@ static void dec_process(MSFilter *f) {
+ #if LIBAVUTIL_VERSION_INT >= AV_VERSION_INT(50, 43, 0) // backward compatibility with Debian Squeeze (6.0)
pkt.pts = frame_ts;
#endif
-- len=avcodec_decode_video2(&d->av_context,d->orig,&got_picture,&pkt);
+- len = avcodec_decode_video2(&d->av_context, d->orig, &got_picture, &pkt);
+ {
+ len = -1;
+ char errmsg[AV_ERROR_MAX_STRING_SIZE];
+ }
+ }
+ }
- if (len<=0) {
-- ms_warning("ms_AVdecoder_process: error %i.",len);
- ms_filter_notify_no_arg(f,MS_VIDEO_DECODER_DECODING_ERRORS);
+ if (len <= 0) {
+- ms_warning("ms_AVdecoder_process: error %i.", len);
+ ms_filter_notify_no_arg(f, MS_VIDEO_DECODER_DECODING_ERRORS);
requestPLI = TRUE;
break;
---- a/src/utils/jpgloader-ffmpeg.c
-+++ b/src/utils/jpgloader-ffmpeg.c
+--- mediastreamer2-5.3.29/src/utils/jpgloader-ffmpeg.c.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/src/utils/jpgloader-ffmpeg.c 2024-03-09 16:51:07.297475151 +0100
@@ -62,7 +62,7 @@
- mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize){
+ mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bufsize, MSVideoSize *reqsize) {
#if !defined(NO_FFMPEG) && !TARGET_OS_IPHONE /* this code must never be used for iOS */
- AVCodecContext av_context;
+ AVCodecContext *av_contextp;
- int got_picture=0;
+ int got_picture = 0;
mblk_t *ret;
struct SwsContext *sws_ctx;
-@@ -71,52 +71,77 @@
- AVCodec *codec=avcodec_find_decoder(CODEC_ID_MJPEG);
- AVFrame* orig = av_frame_alloc();
+@@ -71,53 +71,78 @@ mblk_t *jpeg2yuv(uint8_t *jpgbuf, int bu
+ AVCodec *codec = avcodec_find_decoder(CODEC_ID_MJPEG);
+ AVFrame *orig = av_frame_alloc();
+ if (orig==NULL){
+ ms_error("Could not allocate AVFrame.");
+ return NULL;
+ }
+
- if (codec==NULL){
+ if (codec == NULL) {
ms_error("Could not find MJPEG decoder in ffmpeg.");
+ av_frame_free(&orig);
return NULL;
}
-- avcodec_get_context_defaults3(&av_context,NULL);
-- if (avcodec_open2(&av_context,codec,NULL)<0){
+- avcodec_get_context_defaults3(&av_context, NULL);
+- if (avcodec_open2(&av_context, codec, NULL) < 0) {
+ av_contextp = avcodec_alloc_context3(codec);
+ if (!av_contextp) {
+ ms_error("jpeg2yuv: avcodec_alloc_context3 failed");
return NULL;
}
av_init_packet(&pkt);
- pkt.data=jpgbuf;
- pkt.size=bufsize;
+ pkt.data = jpgbuf;
+ pkt.size = bufsize;
-- if (avcodec_decode_video2(&av_context,orig,&got_picture,&pkt) < 0) {
+- if (avcodec_decode_video2(&av_context, orig, &got_picture, &pkt) < 0) {
- ms_error("jpeg2yuv: avcodec_decode_video failed");
- avcodec_close(&av_context);
+ int ret1 = avcodec_send_packet(av_contextp, &pkt), ret2;
+ return NULL;
+ }
}
- ret=ms_yuv_buf_alloc(&dest, reqsize->width,reqsize->height);
+ ret = ms_yuv_buf_alloc(&dest, reqsize->width, reqsize->height);
/* not using SWS_FAST_BILINEAR because it doesn't play well with
* av_context.pix_fmt set to AV_PIX_FMT_YUVJ420P by jpeg decoder */
-- sws_ctx=sws_getContext(av_context.width,av_context.height,av_context.pix_fmt,
-+ sws_ctx=sws_getContext(av_contextp->width,av_contextp->height,av_contextp->pix_fmt,
- reqsize->width,reqsize->height,AV_PIX_FMT_YUV420P,SWS_BILINEAR,
- NULL, NULL, NULL);
- if (sws_ctx==NULL) {
+- sws_ctx = sws_getContext(av_context.width, av_context.height, av_context.pix_fmt, reqsize->width, reqsize->height,
++ sws_ctx = sws_getContext(av_contextp->width, av_contextp->height, av_contextp->pix_fmt, reqsize->width, reqsize->height,
+ AV_PIX_FMT_YUV420P, SWS_BILINEAR, NULL, NULL, NULL);
+ if (sws_ctx == NULL) {
ms_error("jpeg2yuv: ms_sws_getContext() failed.");
- avcodec_close(&av_context);
+ av_frame_free(&orig);
return NULL;
}
- #if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0,9,0)
-- if (sws_scale(sws_ctx,(const uint8_t* const *)orig->data,orig->linesize,0,av_context.height,dest.planes,dest.strides)<0){
-+ if (sws_scale(sws_ctx,(const uint8_t* const *)orig->data,orig->linesize,0,av_contextp->height,dest.planes,dest.strides)<0){
+ #if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0, 9, 0)
+- if (sws_scale(sws_ctx, (const uint8_t *const *)orig->data, orig->linesize, 0, av_context.height, dest.planes,
++ if (sws_scale(sws_ctx, (const uint8_t *const *)orig->data, orig->linesize, 0, av_contextp->height, dest.planes,
+ dest.strides) < 0) {
#else
-- if (sws_scale(sws_ctx,(uint8_t**)orig->data,orig->linesize,0,av_context.height,dest.planes,dest.strides)<0){
-+ if (sws_scale(sws_ctx,(uint8_t**)orig->data,orig->linesize,0,av_contextp->height,dest.planes,dest.strides)<0){
+- if (sws_scale(sws_ctx, (uint8_t **)orig->data, orig->linesize, 0, av_context.height, dest.planes, dest.strides) <
++ if (sws_scale(sws_ctx, (uint8_t **)orig->data, orig->linesize, 0, av_contextp->height, dest.planes, dest.strides) <
+ 0) {
#endif
ms_error("jpeg2yuv: ms_sws_scale() failed.");
sws_freeContext(sws_ctx);
---- mediastreamer2-4.4.2/src/upnp/upnp_igd.c.orig 2020-09-24 11:44:00.000000000 +0200
-+++ mediastreamer2-4.4.2/src/upnp/upnp_igd.c 2020-09-27 09:49:46.143972883 +0200
-@@ -395,7 +395,7 @@
+--- mediastreamer2-5.3.29/src/upnp/upnp_igd.c.orig 2024-02-21 12:02:03.000000000 +0100
++++ mediastreamer2-5.3.29/src/upnp/upnp_igd.c 2024-03-08 19:56:59.058463144 +0100
+@@ -377,7 +377,7 @@ int upnp_igd_send_action(upnp_igd_contex
* d_event -- event associated with the new device
*
********************************************************************************/
upnp_igd_device_node *deviceNode, *tmpdevnode;
int found = 0;
int ret;
-@@ -423,7 +423,7 @@
+@@ -405,7 +405,7 @@ void upnp_igd_add_device(upnp_igd_contex
baseURL = upnp_igd_get_first_document_item(igd_ctxt, desc_doc, "URLBase");
relURL = upnp_igd_get_first_document_item(igd_ctxt, desc_doc, "presentationURL");
if (UPNP_E_SUCCESS != ret) {
upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error generating presURL from %s + %s", baseURL, relURL);
-@@ -444,7 +444,7 @@
- if (found) {
- /* The device is already there, so just update */
- /* the advertisement timeout field */
-- tmpdevnode->device.advr_time_out = d_event->Expires;
-+ tmpdevnode->device.advr_time_out = UpnpDiscovery_get_Expires(d_event);
- upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "IGD device: %s[%s] | Update expires(%d)", friendlyName, UDN, tmpdevnode->device.advr_time_out);
- } else {
- upnp_igd_print(igd_ctxt, UPNP_IGD_MESSAGE, "Add IGD device: %s[%s]", friendlyName, UDN);
-@@ -453,12 +453,12 @@
- deviceNode = (upnp_igd_device_node *) malloc(sizeof(upnp_igd_device_node));
- memset(deviceNode->device.services, '\0', sizeof(upnp_igd_service) * IGD_SERVICE_SERVCOUNT);
- strncpy(deviceNode->device.udn, UDN, sizeof(deviceNode->device.udn));
-- strncpy(deviceNode->device.desc_doc_url, d_event->Location, sizeof(deviceNode->device.desc_doc_url));
-+ strncpy(deviceNode->device.desc_doc_url, UpnpDiscovery_get_Location_cstr(d_event), sizeof(deviceNode->device.desc_doc_url));
- strncpy(deviceNode->device.friendly_name, friendlyName, sizeof(deviceNode->device.friendly_name));
- strncpy(deviceNode->device.model_name, modelName, sizeof(deviceNode->device.model_name));
- strncpy(deviceNode->device.model_number, modelNumber, sizeof(deviceNode->device.model_number));
- strncpy(deviceNode->device.pres_url, presURL, sizeof(deviceNode->device.pres_url));
-- deviceNode->device.advr_time_out = d_event->Expires;
-+ deviceNode->device.advr_time_out = UpnpDiscovery_get_Expires(d_event);
-
- // Reset values
- serviceId = NULL;
-@@ -468,7 +468,7 @@
-
- for (service = 0; service < IGD_SERVICE_SERVCOUNT;
- service++) {
-- if (upnp_igd_get_find_and_parse_service(igd_ctxt, desc_doc, d_event->Location,
-+ if (upnp_igd_get_find_and_parse_service(igd_ctxt, desc_doc, UpnpDiscovery_get_Location_cstr(d_event),
- IGDServiceType[service], &serviceId, &event_url, &controlURL)) {
- upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Subscribing to EventURL %s...",event_url);
- ret =
-@@ -883,7 +883,7 @@
+@@ -426,7 +426,7 @@ void upnp_igd_add_device(upnp_igd_contex
+ if (found) {
+ /* The device is already there, so just update */
+ /* the advertisement timeout field */
+- tmpdevnode->device.advr_time_out = d_event->Expires;
++ tmpdevnode->device.advr_time_out = UpnpDiscovery_get_Expires(d_event);
+ upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "IGD device: %s[%s] | Update expires(%d)", friendlyName, UDN,
+ tmpdevnode->device.advr_time_out);
+ } else {
+@@ -436,12 +436,12 @@ void upnp_igd_add_device(upnp_igd_contex
+ deviceNode = (upnp_igd_device_node *)malloc(sizeof(upnp_igd_device_node));
+ memset(deviceNode->device.services, '\0', sizeof(upnp_igd_service) * IGD_SERVICE_SERVCOUNT);
+ strncpy(deviceNode->device.udn, UDN, sizeof(deviceNode->device.udn));
+- strncpy(deviceNode->device.desc_doc_url, d_event->Location, sizeof(deviceNode->device.desc_doc_url));
++ strncpy(deviceNode->device.desc_doc_url, UpnpDiscovery_get_Location_cstr(d_event), sizeof(deviceNode->device.desc_doc_url));
+ strncpy(deviceNode->device.friendly_name, friendlyName, sizeof(deviceNode->device.friendly_name));
+ strncpy(deviceNode->device.model_name, modelName, sizeof(deviceNode->device.model_name));
+ strncpy(deviceNode->device.model_number, modelNumber, sizeof(deviceNode->device.model_number));
+ strncpy(deviceNode->device.pres_url, presURL, sizeof(deviceNode->device.pres_url));
+- deviceNode->device.advr_time_out = d_event->Expires;
++ deviceNode->device.advr_time_out = UpnpDiscovery_get_Expires(d_event);
+
+ // Reset values
+ serviceId = NULL;
+@@ -450,7 +450,7 @@ void upnp_igd_add_device(upnp_igd_contex
+ eventSID[0] = '\0';
+
+ for (service = 0; service < IGD_SERVICE_SERVCOUNT; service++) {
+- if (upnp_igd_get_find_and_parse_service(igd_ctxt, desc_doc, d_event->Location, IGDServiceType[service],
++ if (upnp_igd_get_find_and_parse_service(igd_ctxt, desc_doc, UpnpDiscovery_get_Location_cstr(d_event), IGDServiceType[service],
+ &serviceId, &event_url, &controlURL)) {
+ upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Subscribing to EventURL %s...", event_url);
+ ret = UpnpSubscribe(igd_ctxt->upnp_handle, event_url, &IGDTimeOut[service], eventSID);
+@@ -878,7 +878,7 @@ void upnp_igd_handle_subscribe_update(up
* cookie -- Optional data specified during callback registration
*
********************************************************************************/
--int upnp_igd_callback(Upnp_EventType event_type, void* event, void *cookie) {
-+int upnp_igd_callback(Upnp_EventType event_type, const void* event, void *cookie) {
+-int upnp_igd_callback(Upnp_EventType event_type, void *event, void *cookie) {
++int upnp_igd_callback(Upnp_EventType event_type, const void *event, void *cookie) {
int ret = 1;
- upnp_igd_context *igd_ctxt = (upnp_igd_context*)cookie;
+ upnp_igd_context *igd_ctxt = (upnp_igd_context *)cookie;
upnp_context_add_client(igd_ctxt);
-@@ -891,16 +891,16 @@
- switch(event_type) {
- case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
- case UPNP_DISCOVERY_SEARCH_RESULT: {
-- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
-+ UpnpDiscovery *d_event = (UpnpDiscovery *)event;
- IXML_Document *desc_doc = NULL;
- int ret;
-
-- if (d_event->ErrCode != UPNP_E_SUCCESS) {
-- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery Callback -- %d", d_event->ErrCode);
-+ if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery Callback -- %d", UpnpDiscovery_get_ErrCode(d_event));
- }
-- ret = UpnpDownloadXmlDoc(d_event->Location, &desc_doc);
-+ ret = UpnpDownloadXmlDoc(UpnpDiscovery_get_Location_cstr(d_event), &desc_doc);
- if (ret != UPNP_E_SUCCESS) {
-- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error obtaining device description from %s -- error = %d", d_event->Location, ret);
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error obtaining device description from %s -- error = %d", UpnpDiscovery_get_Location_cstr(d_event), ret);
- } else {
- upnp_igd_add_device(igd_ctxt, desc_doc, d_event);
- }
-@@ -910,64 +910,64 @@
- }
- break;
- case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
-- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
-- if (d_event->ErrCode != UPNP_E_SUCCESS) {
-- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
-+ UpnpDiscovery *d_event = (UpnpDiscovery *)event;
-+ if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery ByeBye Callback -- %d", UpnpDiscovery_get_ErrCode(d_event));
- }
-- upnp_igd_remove_device(igd_ctxt, d_event->DeviceId);
-+ upnp_igd_remove_device(igd_ctxt, UpnpDiscovery_get_DeviceID_cstr(d_event));
- }
- break;
- /* SOAP Stuff */
- case UPNP_CONTROL_ACTION_COMPLETE: {
-- struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)event;
-+ UpnpActionComplete *a_event = (UpnpActionComplete *)event;
-
-- if (a_event->ErrCode != UPNP_E_SUCCESS) {
-- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Action Complete Callback -- %d", a_event->ErrCode);
-+ if (UpnpActionComplete_get_ErrCode(a_event) != UPNP_E_SUCCESS) {
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Action Complete Callback -- %d", UpnpActionComplete_get_ErrCode(a_event));
- } else {
-- upnp_igd_handle_send_action(igd_ctxt, UPNP_STRING(a_event->CtrlUrl), a_event->ActionRequest, a_event->ActionResult);
-+ upnp_igd_handle_send_action(igd_ctxt, UpnpActionComplete_get_CtrlUrl_cstr(a_event), UpnpActionComplete_get_ActionRequest(a_event), UpnpActionComplete_get_ActionResult(a_event));
- }
- }
- break;
- case UPNP_CONTROL_GET_VAR_COMPLETE: {
-- struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)event;
-+ UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)event;
-
-- if (sv_event->ErrCode != UPNP_E_SUCCESS) {
-- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Get Var Complete Callback -- %d", sv_event->ErrCode);
-+ if (UpnpStateVarComplete_get_ErrCode(sv_event) != UPNP_E_SUCCESS) {
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Get Var Complete Callback -- %d", UpnpStateVarComplete_get_ErrCode(sv_event));
- } else {
-- upnp_igd_handle_get_var(igd_ctxt, UPNP_STRING(sv_event->CtrlUrl), sv_event->StateVarName, sv_event->CurrentVal);
-+ upnp_igd_handle_get_var(igd_ctxt, UpnpStateVarComplete_get_CtrlUrl_cstr(sv_event), UpnpStateVarComplete_get_StateVarName_cstr(sv_event), UpnpStateVarComplete_get_CurrentVal(sv_event));
- }
- }
- break;
- /* GENA Stuff */
- case UPNP_EVENT_RECEIVED: {
-- struct Upnp_Event *e_event = (struct Upnp_Event *)event;
-+ UpnpEvent *e_event = (UpnpEvent *)event;
-
-- upnp_igd_handle_event(igd_ctxt, e_event->Sid, e_event->EventKey, e_event->ChangedVariables);
-+ upnp_igd_handle_event(igd_ctxt, UpnpEvent_get_SID_cstr(e_event), UpnpEvent_get_EventKey(e_event), UpnpEvent_get_ChangedVariables(e_event));
- }
- break;
- case UPNP_EVENT_SUBSCRIBE_COMPLETE:
- case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
- case UPNP_EVENT_RENEWAL_COMPLETE: {
-- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)event;
-+ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)event;
-
-- if (es_event->ErrCode != UPNP_E_SUCCESS) {
-- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Event Subscribe Callback -- %d", es_event->ErrCode);
-+ if (UpnpEventSubscribe_get_ErrCode(es_event) != UPNP_E_SUCCESS) {
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Event Subscribe Callback -- %d", UpnpEventSubscribe_get_ErrCode(es_event));
- } else {
-- upnp_igd_handle_subscribe_update(igd_ctxt, UPNP_STRING(es_event->PublisherUrl), es_event->Sid, es_event->TimeOut);
-+ upnp_igd_handle_subscribe_update(igd_ctxt, UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), UpnpEventSubscribe_get_SID_cstr(es_event), UpnpEventSubscribe_get_TimeOut(es_event));
- }
- }
- break;
- case UPNP_EVENT_AUTORENEWAL_FAILED:
- case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
-- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)event;
-+ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)event;
- int TimeOut = 1801;
- Upnp_SID newSID;
- int ret;
+@@ -886,17 +886,17 @@ int upnp_igd_callback(Upnp_EventType eve
+ switch (event_type) {
+ case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
+ case UPNP_DISCOVERY_SEARCH_RESULT: {
+- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
++ Upnp_Discovery *d_event = (Upnp_Discovery *)event;
+ IXML_Document *desc_doc = NULL;
+ int ret;
+
+- if (d_event->ErrCode != UPNP_E_SUCCESS) {
+- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery Callback -- %d", d_event->ErrCode);
++ if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
++ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery Callback -- %d", UpnpDiscovery_get_ErrCode(d_event));
+ }
+- ret = UpnpDownloadXmlDoc(d_event->Location, &desc_doc);
++ ret = UpnpDownloadXmlDoc(UpnpDiscovery_get_Location_cstr(d_event), &desc_doc);
+ if (ret != UPNP_E_SUCCESS) {
+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error obtaining device description from %s -- error = %d",
+- d_event->Location, ret);
++ UpnpDiscovery_get_Location_cstr(d_event), ret);
+ } else {
+ upnp_igd_add_device(igd_ctxt, desc_doc, d_event);
+ }
+@@ -905,62 +905,62 @@ int upnp_igd_callback(Upnp_EventType eve
+ }
+ } break;
+ case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
+- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
+- if (d_event->ErrCode != UPNP_E_SUCCESS) {
+- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
++ Upnp_Discovery *d_event = (Upnp_Discovery *)event;
++ if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
++ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery ByeBye Callback -- %d", UpnpDiscovery_get_ErrCode(d_event));
+ }
+- upnp_igd_remove_device(igd_ctxt, d_event->DeviceId);
++ upnp_igd_remove_device(igd_ctxt, UpnpDiscovery_get_DeviceID_cstr(d_event));
+ } break;
+ /* SOAP Stuff */
+ case UPNP_CONTROL_ACTION_COMPLETE: {
+- struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)event;
++ Upnp_Action_Complete *a_event = (Upnp_Action_Complete *)event;
-- ret = UpnpSubscribe(igd_ctxt->upnp_handle, UPNP_STRING(es_event->PublisherUrl), &TimeOut, newSID);
-+ ret = UpnpSubscribe(igd_ctxt->upnp_handle, UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), &TimeOut, newSID);
- if (ret == UPNP_E_SUCCESS) {
- upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Subscribed to EventURL with SID=%s", newSID);
-- upnp_igd_handle_subscribe_update(igd_ctxt, UPNP_STRING(es_event->PublisherUrl), newSID, TimeOut);
-+ upnp_igd_handle_subscribe_update(igd_ctxt, UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), newSID, TimeOut);
- } else {
- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error Subscribing to EventURL -- %d", ret);
- }
-@@ -996,10 +996,10 @@
- * cookie -- The cookie pass in cb_fct or print_fct
- *
+- if (a_event->ErrCode != UPNP_E_SUCCESS) {
+- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Action Complete Callback -- %d", a_event->ErrCode);
++ if (UpnpActionComplete_get_ErrCode(a_event) != UPNP_E_SUCCESS) {
++ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Action Complete Callback -- %d", UpnpActionComplete_get_ErrCode(a_event));
+ } else {
+- upnp_igd_handle_send_action(igd_ctxt, UPNP_STRING(a_event->CtrlUrl), a_event->ActionRequest,
+- a_event->ActionResult);
++ upnp_igd_handle_send_action(igd_ctxt, UpnpActionComplete_get_CtrlUrl_cstr(a_event), UpnpActionComplete_get_ActionRequest(a_event),
++ UpnpActionComplete_get_ActionResult(a_event));
+ }
+ } break;
+ case UPNP_CONTROL_GET_VAR_COMPLETE: {
+- struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)event;
++ Upnp_State_Var_Complete *sv_event = (Upnp_State_Var_Complete *)event;
+
+- if (sv_event->ErrCode != UPNP_E_SUCCESS) {
+- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Get Var Complete Callback -- %d", sv_event->ErrCode);
++ if (UpnpStateVarComplete_get_ErrCode(sv_event) != UPNP_E_SUCCESS) {
++ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Get Var Complete Callback -- %d", UpnpStateVarComplete_get_ErrCode(sv_event));
+ } else {
+- upnp_igd_handle_get_var(igd_ctxt, UPNP_STRING(sv_event->CtrlUrl), sv_event->StateVarName,
+- sv_event->CurrentVal);
++ upnp_igd_handle_get_var(igd_ctxt, UpnpStateVarComplete_get_CtrlUrl_cstr(sv_event), UpnpStateVarComplete_get_StateVarName_cstr(sv_event),
++ UpnpStateVarComplete_get_CurrentVal(sv_event));
+ }
+ } break;
+ /* GENA Stuff */
+ case UPNP_EVENT_RECEIVED: {
+- struct Upnp_Event *e_event = (struct Upnp_Event *)event;
++ Upnp_Event *e_event = (Upnp_Event *)event;
+
+- upnp_igd_handle_event(igd_ctxt, e_event->Sid, e_event->EventKey, e_event->ChangedVariables);
++ upnp_igd_handle_event(igd_ctxt, UpnpEvent_get_SID_cstr(e_event), UpnpEvent_get_EventKey(e_event), UpnpEvent_get_ChangedVariables(e_event));
+ } break;
+ case UPNP_EVENT_SUBSCRIBE_COMPLETE:
+ case UPNP_EVENT_UNSUBSCRIBE_COMPLETE:
+ case UPNP_EVENT_RENEWAL_COMPLETE: {
+- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)event;
++ Upnp_Event_Subscribe *es_event = (Upnp_Event_Subscribe *)event;
+
+- if (es_event->ErrCode != UPNP_E_SUCCESS) {
+- upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Event Subscribe Callback -- %d", es_event->ErrCode);
++ if (UpnpEventSubscribe_get_ErrCode(es_event) != UPNP_E_SUCCESS) {
++ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Event Subscribe Callback -- %d", UpnpEventSubscribe_get_ErrCode(es_event));
+ } else {
+- upnp_igd_handle_subscribe_update(igd_ctxt, UPNP_STRING(es_event->PublisherUrl), es_event->Sid,
+- es_event->TimeOut);
++ upnp_igd_handle_subscribe_update(igd_ctxt, UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), UpnpEventSubscribe_get_SID_cstr(es_event),
++ UpnpEventSubscribe_get_TimeOut(es_event));
+ }
+ } break;
+ case UPNP_EVENT_AUTORENEWAL_FAILED:
+ case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
+- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)event;
++ Upnp_Event_Subscribe *es_event = (Upnp_Event_Subscribe *)event;
+ int TimeOut = 1801;
+ Upnp_SID newSID;
+ int ret;
+
+- ret = UpnpSubscribe(igd_ctxt->upnp_handle, UPNP_STRING(es_event->PublisherUrl), &TimeOut, newSID);
++ ret = UpnpSubscribe(igd_ctxt->upnp_handle, UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), &TimeOut, newSID);
+ if (ret == UPNP_E_SUCCESS) {
+ upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Subscribed to EventURL with SID=%s", newSID);
+- upnp_igd_handle_subscribe_update(igd_ctxt, UPNP_STRING(es_event->PublisherUrl), newSID, TimeOut);
++ upnp_igd_handle_subscribe_update(igd_ctxt, UpnpEventSubscribe_get_PublisherUrl_cstr(es_event), newSID, TimeOut);
+ } else {
+ upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error Subscribing to EventURL -- %d", ret);
+ }
+@@ -989,11 +989,11 @@ int upnp_igd_callback(Upnp_EventType eve
********************************************************************************/
--upnp_igd_context* upnp_igd_create(upnp_igd_callback_function cb_fct, upnp_igd_print_function print_fct, const char *address, void *cookie) {
-+upnp_igd_context* upnp_igd_create(upnp_igd_callback_function cb_fct, upnp_igd_print_function print_fct, const char *interface, void *cookie) {
+ upnp_igd_context *upnp_igd_create(upnp_igd_callback_function cb_fct,
+ upnp_igd_print_function print_fct,
+- const char *address,
++ const char *interface,
+ void *cookie) {
int ret;
unsigned short port = 0;
- const char *ip_address = address;
+ const char *ip_address = NULL;
- upnp_igd_context *igd_ctxt = (upnp_igd_context*)malloc(sizeof(upnp_igd_context));
+ upnp_igd_context *igd_ctxt = (upnp_igd_context *)malloc(sizeof(upnp_igd_context));
igd_ctxt->devices = NULL;
igd_ctxt->callback_fct = cb_fct;
-@@ -1068,9 +1068,9 @@
- ithread_cond_init(&igd_ctxt->client_cond, NULL);
+@@ -1063,9 +1063,9 @@ upnp_igd_context *upnp_igd_create(upnp_i
}
-- upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Initializing uPnP IGD with ipaddress:%s port:%u", ip_address ? ip_address : "{NULL}", port);
-+ upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Initializing uPnP IGD with interface:%s port:%u", interface ? interface : "{NULL}", port);
+ upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Initializing uPnP IGD with ipaddress:%s port:%u",
+- ip_address ? ip_address : "{NULL}", port);
++ interface ? interface : "{NULL}", port);
- ret = UpnpInit(ip_address, port);
+ ret = UpnpInit2(interface, port);
if (ret != UPNP_E_SUCCESS) {
upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "UpnpInit() Error: %d", ret);
UpnpFinish();
-@@ -1085,9 +1085,7 @@
+@@ -1080,9 +1080,7 @@ upnp_igd_context *upnp_igd_create(upnp_i
free(igd_ctxt);
return NULL;
}
if (!port) {
port = UpnpGetServerPort();
}
---- mediastreamer2-4.4.2/src/upnp/upnp_igd_cmd.c.orig 2020-09-24 11:44:00.000000000 +0200
-+++ mediastreamer2-4.4.2/src/upnp/upnp_igd_cmd.c 2020-09-27 10:01:04.473631389 +0200
-@@ -95,7 +95,7 @@
+--- mediastreamer2-5.3.29/src/upnp/upnp_igd_cmd.c.orig 2024-03-08 20:00:36.550618221 +0100
++++ mediastreamer2-5.3.29/src/upnp/upnp_igd_cmd.c 2024-03-08 21:25:55.456220065 +0100
+@@ -104,7 +104,7 @@ int upnp_igd_port_mapping_handle_action(
return 0;
}
--int upnp_igd_port_mapping_callback(Upnp_EventType event_type, void* event, void *cookie) {
-+int upnp_igd_port_mapping_callback(Upnp_EventType event_type, const void* event, void *cookie) {
+-int upnp_igd_port_mapping_callback(Upnp_EventType event_type, void *event, void *cookie) {
++int upnp_igd_port_mapping_callback(Upnp_EventType event_type, const void *event, void *cookie) {
int ret = 1;
- upnp_igd_port_mapping_context *igd_port_mapping_ctxt = (upnp_igd_port_mapping_context*)cookie;
+ upnp_igd_port_mapping_context *igd_port_mapping_ctxt = (upnp_igd_port_mapping_context *)cookie;
upnp_context_add_client(igd_port_mapping_ctxt->igd_ctxt);
-@@ -103,8 +103,8 @@
+@@ -112,9 +112,9 @@ int upnp_igd_port_mapping_callback(Upnp_
- switch(event_type) {
+ switch (event_type) {
case UPNP_CONTROL_ACTION_COMPLETE: {
-- struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)event;
-- upnp_igd_port_mapping_handle_action(igd_port_mapping_ctxt, a_event->ErrCode, UPNP_STRING(a_event->CtrlUrl), a_event->ActionRequest, a_event->ActionResult);
-+ UpnpActionComplete *a_event = (UpnpActionComplete *)event;
-+ upnp_igd_port_mapping_handle_action(igd_port_mapping_ctxt, UpnpActionComplete_get_ErrCode(a_event), UpnpActionComplete_get_CtrlUrl_cstr(a_event), UpnpActionComplete_get_ActionRequest(a_event), UpnpActionComplete_get_ActionResult(a_event));
- }
- break;
-
---- mediastreamer2-4.4.2/include/mediastreamer2/upnp_igd.h.orig 2020-09-24 11:44:00.000000000 +0200
-+++ mediastreamer2-4.4.2/include/mediastreamer2/upnp_igd.h 2020-09-27 09:50:51.076954444 +0200
-@@ -72,7 +72,7 @@
-
- typedef struct _upnp_igd_context upnp_igd_context;
-
--MS2_PUBLIC upnp_igd_context* upnp_igd_create(upnp_igd_callback_function cb_fct, upnp_igd_print_function print_fct, const char* address, void *cookie);
-+MS2_PUBLIC upnp_igd_context* upnp_igd_create(upnp_igd_callback_function cb_fct, upnp_igd_print_function print_fct, const char* interface, void *cookie);
- MS2_PUBLIC int upnp_igd_start(upnp_igd_context*igd_ctxt);
+- struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)event;
+- upnp_igd_port_mapping_handle_action(igd_port_mapping_ctxt, a_event->ErrCode, UPNP_STRING(a_event->CtrlUrl),
+- a_event->ActionRequest, a_event->ActionResult);
++ Upnp_Action_Complete *a_event = (Upnp_Action_Complete *)event;
++ upnp_igd_port_mapping_handle_action(igd_port_mapping_ctxt, UpnpActionComplete_get_ErrCode(a_event), UpnpActionComplete_get_CtrlUrl_cstr(a_event),
++ UpnpActionComplete_get_ActionRequest(a_event), UpnpActionComplete_get_ActionResult(a_event);
+ } break;
+
+ default:
+--- mediastreamer2-5.3.29/include/mediastreamer2/upnp_igd.h.orig 2024-03-08 21:44:02.873662353 +0100
++++ mediastreamer2-5.3.29/include/mediastreamer2/upnp_igd.h 2024-03-08 21:50:16.351639049 +0100
+@@ -72,7 +72,7 @@ typedef struct _upnp_igd_context upnp_ig
+
+ MS2_PUBLIC upnp_igd_context *upnp_igd_create(upnp_igd_callback_function cb_fct,
+ upnp_igd_print_function print_fct,
+- const char *address,
++ const char *interface,
+ void *cookie);
+ MS2_PUBLIC int upnp_igd_start(upnp_igd_context *igd_ctxt);
int upnp_igd_is_started(upnp_igd_context *igd_ctxt);
- int upnp_igd_stop(upnp_igd_context*igd_ctxt);
---- mediastreamer2-4.4.2/src/upnp/upnp_igd_private.h.orig 2020-09-24 11:44:00.000000000 +0200
-+++ mediastreamer2-4.4.2/src/upnp/upnp_igd_private.h 2020-09-27 09:42:32.032991330 +0200
-@@ -144,7 +144,7 @@
+--- mediastreamer2-5.3.29/src/upnp/upnp_igd_private.h.orig 2024-03-08 21:50:41.568169106 +0100
++++ mediastreamer2-5.3.29/src/upnp/upnp_igd_private.h 2024-03-08 21:56:05.019750152 +0100
+@@ -140,7 +140,7 @@ void upnp_context_add_callback(upnp_igd_
void upnp_context_handle_callbacks(upnp_igd_context *igd_ctx);
void upnp_context_free_callbacks(upnp_igd_context *igd_ctx);
--int upnp_igd_callback(Upnp_EventType event_type, void* event, void *cookie);
-+int upnp_igd_callback(Upnp_EventType event_type, const void* event, void *cookie);
- int upnp_igd_send_action(upnp_igd_context* igd_ctxt, upnp_igd_device_node *device_node, int service,
- const char *actionname, const char **param_name, const char **param_val, int param_count,
- Upnp_FunPtr fun, const void *cookie);
---- mediastreamer2-4.4.2/src/upnp/upnp_igd_utils.c.orig 2020-09-24 11:44:00.000000000 +0200
-+++ mediastreamer2-4.4.2/src/upnp/upnp_igd_utils.c 2020-09-27 10:57:56.005149537 +0200
-@@ -178,7 +178,7 @@
- }
- }
-
--void upnp_igd_print_event(upnp_igd_context *igd_ctxt, upnp_igd_print_level level, Upnp_EventType EventType, void *Event) {
-+void upnp_igd_print_event(upnp_igd_context *igd_ctxt, upnp_igd_print_level level, Upnp_EventType EventType, const void *Event) {
+-int upnp_igd_callback(Upnp_EventType event_type, void *event, void *cookie);
++int upnp_igd_callback(Upnp_EventType event_type, const void *event, void *cookie);
+ int upnp_igd_send_action(upnp_igd_context *igd_ctxt,
+ upnp_igd_device_node *device_node,
+ int service,
+--- mediastreamer2-5.3.29/src/upnp/upnp_igd_utils.c.orig 2024-03-08 21:56:32.842932754 +0100
++++ mediastreamer2-5.3.29/src/upnp/upnp_igd_utils.c 2024-03-09 07:20:10.043062611 +0100
+@@ -182,7 +182,7 @@ void upnp_igd_print_event_type(upnp_igd_
+ void upnp_igd_print_event(upnp_igd_context *igd_ctxt,
+ upnp_igd_print_level level,
+ Upnp_EventType EventType,
+- void *Event) {
++ const void *Event) {
ithread_mutex_lock(&igd_ctxt->print_mutex);
upnp_igd_print(igd_ctxt, level, "======================================================================");
-@@ -188,18 +188,18 @@
- case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
- case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
- case UPNP_DISCOVERY_SEARCH_RESULT: {
-- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
-+ UpnpDiscovery *d_event = (UpnpDiscovery *)Event;
-
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(d_event->ErrCode), d_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "Expires = %d", d_event->Expires);
-- upnp_igd_print(igd_ctxt, level, "DeviceId = %s", d_event->DeviceId);
-- upnp_igd_print(igd_ctxt, level, "DeviceType = %s", d_event->DeviceType);
-- upnp_igd_print(igd_ctxt, level, "ServiceType = %s", d_event->ServiceType);
-- upnp_igd_print(igd_ctxt, level, "ServiceVer = %s", d_event->ServiceVer);
-- upnp_igd_print(igd_ctxt, level, "Location = %s", d_event->Location);
-- upnp_igd_print(igd_ctxt, level, "OS = %s", d_event->Os);
-- upnp_igd_print(igd_ctxt, level, "Ext = %s", d_event->Ext);
-+ UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(d_event)), UpnpDiscovery_get_ErrCode(d_event));
-+ upnp_igd_print(igd_ctxt, level, "Expires = %d", UpnpDiscovery_get_Expires(d_event));
-+ upnp_igd_print(igd_ctxt, level, "DeviceId = %s", UpnpDiscovery_get_DeviceID_cstr(d_event));
-+ upnp_igd_print(igd_ctxt, level, "DeviceType = %s", UpnpDiscovery_get_DeviceType_cstr(d_event));
-+ upnp_igd_print(igd_ctxt, level, "ServiceType = %s", UpnpDiscovery_get_ServiceType_cstr(d_event));
-+ upnp_igd_print(igd_ctxt, level, "ServiceVer = %s", UpnpDiscovery_get_ServiceVer_cstr(d_event));
-+ upnp_igd_print(igd_ctxt, level, "Location = %s", UpnpDiscovery_get_Location_cstr(d_event));
-+ upnp_igd_print(igd_ctxt, level, "OS = %s", UpnpDiscovery_get_Os_cstr(d_event));
-+ upnp_igd_print(igd_ctxt, level, "Ext = %s", UpnpDiscovery_get_Ext_cstr(d_event));
- break;
- }
- case UPNP_DISCOVERY_SEARCH_TIMEOUT:
-@@ -207,18 +207,17 @@
- break;
- /* SOAP */
- case UPNP_CONTROL_ACTION_REQUEST: {
-- struct Upnp_Action_Request *a_event =
-- (struct Upnp_Action_Request *)Event;
-+ UpnpActionRequest *a_event = (UpnpActionRequest *)Event;
- char *xmlbuff = NULL;
-
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(a_event->ErrCode), a_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "ErrStr = %s", a_event->ErrStr);
-- upnp_igd_print(igd_ctxt, level, "ActionName = %s", a_event->ActionName);
-- upnp_igd_print(igd_ctxt, level, "UDN = %s", a_event->DevUDN);
-- upnp_igd_print(igd_ctxt, level, "ServiceID = %s", a_event->ServiceID);
-- if (a_event->ActionRequest) {
-- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
-+ UpnpGetErrorMessage(UpnpActionRequest_get_ErrCode(a_event)), UpnpActionRequest_get_ErrCode(a_event));
-+ upnp_igd_print(igd_ctxt, level, "ErrStr = %s", UpnpActionRequest_get_ErrStr_cstr(a_event));
-+ upnp_igd_print(igd_ctxt, level, "ActionName = %s", UpnpActionRequest_get_ActionName_cstr(a_event));
-+ upnp_igd_print(igd_ctxt, level, "UDN = %s", UpnpActionRequest_get_DevUDN_cstr(a_event));
-+ upnp_igd_print(igd_ctxt, level, "ServiceID = %s", UpnpActionRequest_get_ServiceID_cstr(a_event));
-+ if (UpnpActionRequest_get_ActionRequest(a_event)) {
-+ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionRequest_get_ActionRequest(a_event));
- if (xmlbuff) {
- upnp_igd_print(igd_ctxt, level, "ActRequest = %s", xmlbuff);
- ixmlFreeDOMString(xmlbuff);
-@@ -227,8 +226,8 @@
- } else {
- upnp_igd_print(igd_ctxt, level, "ActRequest = (null)");
+@@ -192,18 +192,18 @@ void upnp_igd_print_event(upnp_igd_conte
+ case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
+ case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE:
+ case UPNP_DISCOVERY_SEARCH_RESULT: {
+- struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)Event;
++ Upnp_Discovery *d_event = (Upnp_Discovery *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(d_event->ErrCode),
+- d_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "Expires = %d", d_event->Expires);
+- upnp_igd_print(igd_ctxt, level, "DeviceId = %s", d_event->DeviceId);
+- upnp_igd_print(igd_ctxt, level, "DeviceType = %s", d_event->DeviceType);
+- upnp_igd_print(igd_ctxt, level, "ServiceType = %s", d_event->ServiceType);
+- upnp_igd_print(igd_ctxt, level, "ServiceVer = %s", d_event->ServiceVer);
+- upnp_igd_print(igd_ctxt, level, "Location = %s", d_event->Location);
+- upnp_igd_print(igd_ctxt, level, "OS = %s", d_event->Os);
+- upnp_igd_print(igd_ctxt, level, "Ext = %s", d_event->Ext);
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpDiscovery_get_ErrCode(d_event)),
++ UpnpDiscovery_get_ErrCode(d_event));
++ upnp_igd_print(igd_ctxt, level, "Expires = %d", UpnpDiscovery_get_Expires(d_event));
++ upnp_igd_print(igd_ctxt, level, "DeviceId = %s", UpnpDiscovery_get_DeviceID_cstr(d_event));
++ upnp_igd_print(igd_ctxt, level, "DeviceType = %s", UpnpDiscovery_get_DeviceType_cstr(d_event));
++ upnp_igd_print(igd_ctxt, level, "ServiceType = %s", UpnpDiscovery_get_ServiceType_cstr(d_event));
++ upnp_igd_print(igd_ctxt, level, "ServiceVer = %s", UpnpDiscovery_get_ServiceVer_cstr(d_event));
++ upnp_igd_print(igd_ctxt, level, "Location = %s", UpnpDiscovery_get_Location_cstr(d_event));
++ upnp_igd_print(igd_ctxt, level, "OS = %s", UpnpDiscovery_get_Os_cstr(d_event));
++ upnp_igd_print(igd_ctxt, level, "Ext = %s", UpnpDiscovery_get_Ext_cstr(d_event));
+ break;
}
-- if (a_event->ActionResult) {
-- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
-+ if (UpnpActionRequest_get_ActionResult(a_event)) {
-+ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionRequest_get_ActionResult(a_event));
- if (xmlbuff) {
- upnp_igd_print(igd_ctxt, level, "ActResult = %s", xmlbuff);
- ixmlFreeDOMString(xmlbuff);
-@@ -240,15 +239,14 @@
- break;
- }
- case UPNP_CONTROL_ACTION_COMPLETE: {
-- struct Upnp_Action_Complete *a_event =
-- (struct Upnp_Action_Complete *)Event;
-+ UpnpActionComplete *a_event = (UpnpActionComplete *)Event;
- char *xmlbuff = NULL;
-
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(a_event->ErrCode), a_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", a_event->CtrlUrl);
-- if (a_event->ActionRequest) {
-- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
-+ UpnpGetErrorMessage(UpnpActionComplete_get_ErrCode(a_event)), UpnpActionComplete_get_ErrCode(a_event));
-+ upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", UpnpActionComplete_get_CtrlUrl_cstr(a_event));
-+ if (UpnpActionComplete_get_ActionRequest(a_event)) {
-+ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionComplete_get_ActionRequest(a_event));
- if (xmlbuff) {
- upnp_igd_print(igd_ctxt, level, "ActRequest = %s", xmlbuff);
- ixmlFreeDOMString(xmlbuff);
-@@ -257,8 +255,8 @@
- } else {
- upnp_igd_print(igd_ctxt, level, "ActRequest = (null)");
+ case UPNP_DISCOVERY_SEARCH_TIMEOUT:
+@@ -211,17 +211,17 @@ void upnp_igd_print_event(upnp_igd_conte
+ break;
+ /* SOAP */
+ case UPNP_CONTROL_ACTION_REQUEST: {
+- struct Upnp_Action_Request *a_event = (struct Upnp_Action_Request *)Event;
++ Upnp_Action_Request *a_event = (Upnp_Action_Request *)Event;
+ char *xmlbuff = NULL;
+
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(a_event->ErrCode),
+- a_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "ErrStr = %s", a_event->ErrStr);
+- upnp_igd_print(igd_ctxt, level, "ActionName = %s", a_event->ActionName);
+- upnp_igd_print(igd_ctxt, level, "UDN = %s", a_event->DevUDN);
+- upnp_igd_print(igd_ctxt, level, "ServiceID = %s", a_event->ServiceID);
+- if (a_event->ActionRequest) {
+- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpActionRequest_get_ErrCode(a_event)),
++ UpnpActionRequest_get_ErrCode(a_event));
++ upnp_igd_print(igd_ctxt, level, "ErrStr = %s", UpnpActionRequest_get_ErrStr_cstr(a_event));
++ upnp_igd_print(igd_ctxt, level, "ActionName = %s", UpnpActionRequest_get_ActionName_cstr(a_event));
++ upnp_igd_print(igd_ctxt, level, "UDN = %s", UpnpActionRequest_get_DevUDN_cstr(a_event));
++ upnp_igd_print(igd_ctxt, level, "ServiceID = %s", UpnpActionRequest_get_ServiceID_cstr(a_event));
++ if (UpnpActionRequest_get_ActionRequest(a_event)) {
++ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionRequest_get_ActionRequest(a_event));
+ if (xmlbuff) {
+ upnp_igd_print(igd_ctxt, level, "ActRequest = %s", xmlbuff);
+ ixmlFreeDOMString(xmlbuff);
+@@ -230,8 +230,8 @@ void upnp_igd_print_event(upnp_igd_conte
+ } else {
+ upnp_igd_print(igd_ctxt, level, "ActRequest = (null)");
+ }
+- if (a_event->ActionResult) {
+- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
++ if (UpnpActionRequest_get_ActionResult(a_event)) {
++ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionRequest_get_ActionResult(a_event));
+ if (xmlbuff) {
+ upnp_igd_print(igd_ctxt, level, "ActResult = %s", xmlbuff);
+ ixmlFreeDOMString(xmlbuff);
+@@ -243,14 +243,14 @@ void upnp_igd_print_event(upnp_igd_conte
+ break;
+ }
+ case UPNP_CONTROL_ACTION_COMPLETE: {
+- struct Upnp_Action_Complete *a_event = (struct Upnp_Action_Complete *)Event;
++ Upnp_Action_Complete *a_event = (Upnp_Action_Complete *)Event;
+ char *xmlbuff = NULL;
+
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(a_event->ErrCode),
+- a_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", a_event->CtrlUrl);
+- if (a_event->ActionRequest) {
+- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionRequest);
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpActionComplete_get_ErrCode(a_event)),
++ UpnpActionComplete_get_ErrCode(a_event));
++ upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", UpnpActionComplete_get_CtrlUrl_cstr(a_event));
++ if (UpnpActionComplete_get_ActionRequest(a_event)) {
++ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionComplete_get_ActionRequest(a_event));
+ if (xmlbuff) {
+ upnp_igd_print(igd_ctxt, level, "ActRequest = %s", xmlbuff);
+ ixmlFreeDOMString(xmlbuff);
+@@ -259,8 +259,8 @@ void upnp_igd_print_event(upnp_igd_conte
+ } else {
+ upnp_igd_print(igd_ctxt, level, "ActRequest = (null)");
+ }
+- if (a_event->ActionResult) {
+- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
++ if (UpnpActionComplete_get_ActionResult(a_event)) {
++ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionComplete_get_ActionResult(a_event));
+ if (xmlbuff) {
+ upnp_igd_print(igd_ctxt, level, "ActResult = %s", xmlbuff);
+ ixmlFreeDOMString(xmlbuff);
+@@ -272,77 +272,77 @@ void upnp_igd_print_event(upnp_igd_conte
+ break;
+ }
+ case UPNP_CONTROL_GET_VAR_REQUEST: {
+- struct Upnp_State_Var_Request *sv_event = (struct Upnp_State_Var_Request *)Event;
++ Upnp_State_Var_Request *sv_event = (Upnp_State_Var_Request *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(sv_event->ErrCode),
+- sv_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "ErrStr = %s", sv_event->ErrStr);
+- upnp_igd_print(igd_ctxt, level, "UDN = %s", sv_event->DevUDN);
+- upnp_igd_print(igd_ctxt, level, "ServiceID = %s", sv_event->ServiceID);
+- upnp_igd_print(igd_ctxt, level, "StateVarName= %s", sv_event->StateVarName);
+- upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", sv_event->CurrentVal);
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpStateVarRequest_get_ErrCode(sv_event)),
++ UpnpStateVarRequest_get_ErrCode(sv_event));
++ upnp_igd_print(igd_ctxt, level, "ErrStr = %s", UpnpStateVarRequest_get_ErrStr_cstr(sv_event));
++ upnp_igd_print(igd_ctxt, level, "UDN = %s", UpnpStateVarRequest_get_DevUDN_cstr(sv_event));
++ upnp_igd_print(igd_ctxt, level, "ServiceID = %s", UpnpStateVarRequest_get_ServiceID_cstr(sv_event));
++ upnp_igd_print(igd_ctxt, level, "StateVarName= %s", UpnpStateVarRequest_get_StateVarName_cstr(sv_event));
++ upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", UpnpStateVarRequest_get_CurrentVal_cstr(sv_event));
+ break;
+ }
+ case UPNP_CONTROL_GET_VAR_COMPLETE: {
+- struct Upnp_State_Var_Complete *sv_event = (struct Upnp_State_Var_Complete *)Event;
++ Upnp_State_Var_Complete *sv_event = (Upnp_State_Var_Complete *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(sv_event->ErrCode),
+- sv_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", sv_event->CtrlUrl);
+- upnp_igd_print(igd_ctxt, level, "StateVarName= %s", sv_event->StateVarName);
+- upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", sv_event->CurrentVal);
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpStateVarComplete_get_ErrCode(sv_event)),
++ UpnpStateVarComplete_get_ErrCode(sv_event));
++ upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", UpnpStateVarComplete_get_CtrlUrl_cstr(sv_event));
++ upnp_igd_print(igd_ctxt, level, "StateVarName= %s", UpnpStateVarComplete_get_StateVarName_cstr(sv_event));
++ upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", UpnpStateVarComplete_get_CurrentVal_cstr(sv_event));
+ break;
+ }
+ /* GENA */
+ case UPNP_EVENT_SUBSCRIPTION_REQUEST: {
+- struct Upnp_Subscription_Request *sr_event = (struct Upnp_Subscription_Request *)Event;
++ Upnp_Subscription_Request *sr_event = (Upnp_Subscription_Request *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "ServiceID = %s", sr_event->ServiceId);
+- upnp_igd_print(igd_ctxt, level, "UDN = %s", sr_event->UDN);
+- upnp_igd_print(igd_ctxt, level, "SID = %s", sr_event->Sid);
++ upnp_igd_print(igd_ctxt, level, "ServiceID = %s", UpnpSubscriptionRequest_get_ServiceId_cstr(sr_event));
++ upnp_igd_print(igd_ctxt, level, "UDN = %s", UpnpSubscriptionRequest_get_UDN_cstr(sr_event));
++ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpSubscriptionRequest_get_SID_cstr(sr_event));
+ break;
+ }
+ case UPNP_EVENT_RECEIVED: {
+- struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
++ Upnp_Event *e_event = (Upnp_Event *)Event;
+ char *xmlbuff = NULL;
+
+- upnp_igd_print(igd_ctxt, level, "SID = %s", e_event->Sid);
+- upnp_igd_print(igd_ctxt, level, "EventKey = %d", e_event->EventKey);
+- xmlbuff = ixmlPrintNode((IXML_Node *)e_event->ChangedVariables);
++ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEvent_get_SID_cstr(e_event));
++ upnp_igd_print(igd_ctxt, level, "EventKey = %d", UpnpEvent_get_EventKey(e_event));
++ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpEvent_get_ChangedVariables(e_event));
+ upnp_igd_print(igd_ctxt, level, "ChangedVars = %s", xmlbuff);
+ ixmlFreeDOMString(xmlbuff);
+ xmlbuff = NULL;
+ break;
+ }
+ case UPNP_EVENT_RENEWAL_COMPLETE: {
+- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
++ Upnp_Event_Subscribe *es_event = (Upnp_Event_Subscribe *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "SID = %s", es_event->Sid);
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(es_event->ErrCode),
+- es_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "TimeOut = %d", es_event->TimeOut);
++ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEventSubscribe_get_SID_cstr(es_event));
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpEventSubscribe_get_ErrCode(es_event)),
++ UpnpEventSubscribe_get_ErrCode(es_event));
++ upnp_igd_print(igd_ctxt, level, "TimeOut = %d", UpnpEventSubscribe_get_TimeOut(es_event));
+ break;
+ }
+ case UPNP_EVENT_SUBSCRIBE_COMPLETE:
+ case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: {
+- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
++ Upnp_Event_Subscribe *es_event = (Upnp_Event_Subscribe *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "SID = %s", es_event->Sid);
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(es_event->ErrCode),
+- es_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", es_event->PublisherUrl);
+- upnp_igd_print(igd_ctxt, level, "TimeOut = %d", es_event->TimeOut);
++ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEventSubscribe_get_SID_cstr(es_event));
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpEventSubscribe_get_ErrCode(es_event)),
++ UpnpEventSubscribe_get_ErrCode(es_event));
++ upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", UpnpEventSubscribe_get_PublisherUrl_cstr(es_event));
++ upnp_igd_print(igd_ctxt, level, "TimeOut = %d", UpnpEventSubscribe_get_TimeOut(es_event));
+ break;
+ }
+ case UPNP_EVENT_AUTORENEWAL_FAILED:
+ case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
+- struct Upnp_Event_Subscribe *es_event = (struct Upnp_Event_Subscribe *)Event;
++ Upnp_Event_Subscribe *es_event = (Upnp_Event_Subscribe *)Event;
+
+- upnp_igd_print(igd_ctxt, level, "SID = %s", es_event->Sid);
+- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(es_event->ErrCode),
+- es_event->ErrCode);
+- upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", es_event->PublisherUrl);
+- upnp_igd_print(igd_ctxt, level, "TimeOut = %d", es_event->TimeOut);
++ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEventSubscribe_get_SID_cstr(es_event));
++ upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)", UpnpGetErrorMessage(UpnpEventSubscribe_get_ErrCode(es_event)),
++ UpnpEventSubscribe_get_ErrCode(es_event));
++ upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", UpnpEventSubscribe_get_PublisherUrl_cstr(es_event));
++ upnp_igd_print(igd_ctxt, level, "TimeOut = %d", UpnpEventSubscribe_get_TimeOut(es_event));
+ break;
}
-- if (a_event->ActionResult) {
-- xmlbuff = ixmlPrintNode((IXML_Node *)a_event->ActionResult);
-+ if (UpnpActionComplete_get_ActionResult(a_event)) {
-+ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpActionComplete_get_ActionResult(a_event));
- if (xmlbuff) {
- upnp_igd_print(igd_ctxt, level, "ActResult = %s", xmlbuff);
- ixmlFreeDOMString(xmlbuff);
-@@ -270,83 +268,77 @@
- break;
- }
- case UPNP_CONTROL_GET_VAR_REQUEST: {
-- struct Upnp_State_Var_Request *sv_event =
-- (struct Upnp_State_Var_Request *)Event;
-+ UpnpStateVarRequest *sv_event = (UpnpStateVarRequest *)Event;
-
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(sv_event->ErrCode), sv_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "ErrStr = %s", sv_event->ErrStr);
-- upnp_igd_print(igd_ctxt, level, "UDN = %s", sv_event->DevUDN);
-- upnp_igd_print(igd_ctxt, level, "ServiceID = %s", sv_event->ServiceID);
-- upnp_igd_print(igd_ctxt, level, "StateVarName= %s", sv_event->StateVarName);
-- upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", sv_event->CurrentVal);
-+ UpnpGetErrorMessage(UpnpStateVarRequest_get_ErrCode(sv_event)), UpnpStateVarRequest_get_ErrCode(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "ErrStr = %s", UpnpStateVarRequest_get_ErrStr_cstr(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "UDN = %s", UpnpStateVarRequest_get_DevUDN_cstr(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "ServiceID = %s", UpnpStateVarRequest_get_ServiceID_cstr(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "StateVarName= %s", UpnpStateVarRequest_get_StateVarName_cstr(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", UpnpStateVarRequest_get_CurrentVal_cstr(sv_event));
- break;
- }
- case UPNP_CONTROL_GET_VAR_COMPLETE: {
-- struct Upnp_State_Var_Complete *sv_event =
-- (struct Upnp_State_Var_Complete *)Event;
-+ UpnpStateVarComplete *sv_event = (UpnpStateVarComplete *)Event;
-
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(sv_event->ErrCode), sv_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", sv_event->CtrlUrl);
-- upnp_igd_print(igd_ctxt, level, "StateVarName= %s", sv_event->StateVarName);
-- upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", sv_event->CurrentVal);
-+ UpnpGetErrorMessage(UpnpStateVarComplete_get_ErrCode(sv_event)), UpnpStateVarComplete_get_ErrCode(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "CtrlUrl = %s", UpnpStateVarComplete_get_CtrlUrl_cstr(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "StateVarName= %s", UpnpStateVarComplete_get_StateVarName_cstr(sv_event));
-+ upnp_igd_print(igd_ctxt, level, "CurrentVal = %s", UpnpStateVarComplete_get_CurrentVal_cstr(sv_event));
- break;
- }
- /* GENA */
- case UPNP_EVENT_SUBSCRIPTION_REQUEST: {
-- struct Upnp_Subscription_Request *sr_event =
-- (struct Upnp_Subscription_Request *)Event;
-+ UpnpSubscriptionRequest *sr_event = (UpnpSubscriptionRequest *)Event;
-
-- upnp_igd_print(igd_ctxt, level, "ServiceID = %s", sr_event->ServiceId);
-- upnp_igd_print(igd_ctxt, level, "UDN = %s", sr_event->UDN);
-- upnp_igd_print(igd_ctxt, level, "SID = %s", sr_event->Sid);
-+ upnp_igd_print(igd_ctxt, level, "ServiceID = %s", UpnpSubscriptionRequest_get_ServiceId_cstr(sr_event));
-+ upnp_igd_print(igd_ctxt, level, "UDN = %s", UpnpSubscriptionRequest_get_UDN_cstr(sr_event));
-+ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpSubscriptionRequest_get_SID_cstr(sr_event));
- break;
- }
- case UPNP_EVENT_RECEIVED: {
-- struct Upnp_Event *e_event = (struct Upnp_Event *)Event;
-+ UpnpEvent *e_event = (UpnpEvent *)Event;
- char *xmlbuff = NULL;
-
-- upnp_igd_print(igd_ctxt, level, "SID = %s", e_event->Sid);
-- upnp_igd_print(igd_ctxt, level, "EventKey = %d", e_event->EventKey);
-- xmlbuff = ixmlPrintNode((IXML_Node *)e_event->ChangedVariables);
-+ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEvent_get_SID_cstr(e_event));
-+ upnp_igd_print(igd_ctxt, level, "EventKey = %d", UpnpEvent_get_EventKey(e_event));
-+ xmlbuff = ixmlPrintNode((IXML_Node *)UpnpEvent_get_ChangedVariables(e_event));
- upnp_igd_print(igd_ctxt, level, "ChangedVars = %s", xmlbuff);
- ixmlFreeDOMString(xmlbuff);
- xmlbuff = NULL;
- break;
- }
- case UPNP_EVENT_RENEWAL_COMPLETE: {
-- struct Upnp_Event_Subscribe *es_event =
-- (struct Upnp_Event_Subscribe *)Event;
-+ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
-
-- upnp_igd_print(igd_ctxt, level, "SID = %s", es_event->Sid);
-+ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEventSubscribe_get_SID_cstr(es_event));
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "TimeOut = %d", es_event->TimeOut);
-+ UpnpGetErrorMessage(UpnpEventSubscribe_get_ErrCode(es_event)), UpnpEventSubscribe_get_ErrCode(es_event));
-+ upnp_igd_print(igd_ctxt, level, "TimeOut = %d", UpnpEventSubscribe_get_TimeOut(es_event));
- break;
- }
- case UPNP_EVENT_SUBSCRIBE_COMPLETE:
- case UPNP_EVENT_UNSUBSCRIBE_COMPLETE: {
-- struct Upnp_Event_Subscribe *es_event =
-- (struct Upnp_Event_Subscribe *)Event;
-+ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
-
-- upnp_igd_print(igd_ctxt, level, "SID = %s", es_event->Sid);
-+ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEventSubscribe_get_SID_cstr(es_event));
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", es_event->PublisherUrl);
-- upnp_igd_print(igd_ctxt, level, "TimeOut = %d", es_event->TimeOut);
-+ UpnpGetErrorMessage(UpnpEventSubscribe_get_ErrCode(es_event)), UpnpEventSubscribe_get_ErrCode(es_event));
-+ upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", UpnpEventSubscribe_get_PublisherUrl_cstr(es_event));
-+ upnp_igd_print(igd_ctxt, level, "TimeOut = %d", UpnpEventSubscribe_get_TimeOut(es_event));
- break;
- }
- case UPNP_EVENT_AUTORENEWAL_FAILED:
- case UPNP_EVENT_SUBSCRIPTION_EXPIRED: {
-- struct Upnp_Event_Subscribe *es_event =
-- (struct Upnp_Event_Subscribe *)Event;
-+ UpnpEventSubscribe *es_event = (UpnpEventSubscribe *)Event;
-
-- upnp_igd_print(igd_ctxt, level, "SID = %s", es_event->Sid);
-+ upnp_igd_print(igd_ctxt, level, "SID = %s", UpnpEventSubscribe_get_SID_cstr(es_event));
- upnp_igd_print(igd_ctxt, level, "ErrCode = %s(%d)",
-- UpnpGetErrorMessage(es_event->ErrCode), es_event->ErrCode);
-- upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", es_event->PublisherUrl);
-- upnp_igd_print(igd_ctxt, level, "TimeOut = %d", es_event->TimeOut);
-+ UpnpGetErrorMessage(UpnpEventSubscribe_get_ErrCode(es_event)), UpnpEventSubscribe_get_ErrCode(es_event));
-+ upnp_igd_print(igd_ctxt, level, "PublisherURL= %s", UpnpEventSubscribe_get_PublisherUrl_cstr(es_event));
-+ upnp_igd_print(igd_ctxt, level, "TimeOut = %d", UpnpEventSubscribe_get_TimeOut(es_event));
- break;
- }
}
---- mediastreamer2-4.4.2/src/upnp/upnp_igd_utils.h.orig 2020-09-24 11:44:00.000000000 +0200
-+++ mediastreamer2-4.4.2/src/upnp/upnp_igd_utils.h 2020-09-27 09:51:21.930120631 +0200
-@@ -39,7 +39,7 @@
+--- mediastreamer2-5.3.29/src/upnp/upnp_igd_utils.h.orig 2024-03-09 07:20:50.729508861 +0100
++++ mediastreamer2-5.3.29/src/upnp/upnp_igd_utils.h 2024-03-09 07:21:11.766061563 +0100
+@@ -39,7 +39,7 @@ char *upnp_igd_strncpy(char *destination
void upnp_igd_print(upnp_igd_context *uIGD, upnp_igd_print_level level, const char *fmt, ...);
void upnp_igd_print_event_type(upnp_igd_context *uIGD, upnp_igd_print_level level, Upnp_EventType S);
+void upnp_igd_print_event(upnp_igd_context *uIGD, upnp_igd_print_level level, Upnp_EventType EventType, const void *Event);
char *upnp_igd_get_first_document_item(upnp_igd_context *uIGD, IXML_Document *doc, const char *item);
char *upnp_igd_get_element_value(upnp_igd_context *uIGD, IXML_Element *element);
- char *upnp_igd_get_first_element_item(upnp_igd_context *uIGD,IXML_Element *element, const char *item);
+ char *upnp_igd_get_first_element_item(upnp_igd_context *uIGD, IXML_Element *element, const char *item);
--- mediastreamer2-4.4.2/configure.ac.orig 2021-07-05 06:50:46.295451589 +0200
+++ mediastreamer2-4.4.2/configure.ac 2021-07-05 17:16:33.665373367 +0200
@@ -717,7 +717,7 @@ AC_ARG_ENABLE(upnp,