From 57d444a2d48050940f3a3b29db85a0257c3eb92f Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 6 Jan 2024 07:02:44 +0100 Subject: [PATCH] update to 5.2.111 [release 5.2.111-1mamba;Thu Nov 23 2023] --- ...reamer-5.2.111-cmake-config-location.patch | 13 + mediastreamer-5.2.111-ffmpeg-5.0.patch | 234 ++++++++++++++++++ ...astreamer-5.2.111-fix-opengl-include.patch | 18 ++ mediastreamer.spec | 94 +++---- 4 files changed, 317 insertions(+), 42 deletions(-) create mode 100644 mediastreamer-5.2.111-cmake-config-location.patch create mode 100644 mediastreamer-5.2.111-ffmpeg-5.0.patch create mode 100644 mediastreamer-5.2.111-fix-opengl-include.patch diff --git a/mediastreamer-5.2.111-cmake-config-location.patch b/mediastreamer-5.2.111-cmake-config-location.patch new file mode 100644 index 0000000..8aba55a --- /dev/null +++ b/mediastreamer-5.2.111-cmake-config-location.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0c45a13..96c8303 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -680,7 +680,7 @@ if(ENABLE_TOOLS AND NOT ANDROID) + ) + + include(CMakePackageConfigHelpers) +-set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Mediastreamer2/cmake") ++set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_LIBDIR}/cmake/${EXPORT_TARGETS_NAME}") + + write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/Mediastreamer2ConfigVersion.cmake" diff --git a/mediastreamer-5.2.111-ffmpeg-5.0.patch b/mediastreamer-5.2.111-ffmpeg-5.0.patch new file mode 100644 index 0000000..71e549e --- /dev/null +++ b/mediastreamer-5.2.111-ffmpeg-5.0.patch @@ -0,0 +1,234 @@ +diff -up mediastreamer2-5.0.66/src/utils/ffmpeg-priv.c.omv~ mediastreamer2-5.0.66/src/utils/ffmpeg-priv.c +--- mediastreamer2-5.0.66/src/utils/ffmpeg-priv.c.omv~ 2022-01-22 18:04:13.828766304 +0100 ++++ mediastreamer2-5.0.66/src/utils/ffmpeg-priv.c 2022-01-22 18:10:35.546776805 +0100 +@@ -21,7 +21,7 @@ + #include "ffmpeg-priv.h" + + +-#ifndef HAVE_FUN_avcodec_encode_video2 ++#if 0 //ndef 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){ +@@ -40,13 +40,17 @@ int avcodec_encode_video2 (AVCodecContex + + #ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/ + int avcodec_get_context_defaults3 (AVCodecContext *s, AVCodec *codec) { ++#if LIBAVCODEC_VERSION_MAJOR < 59 + avcodec_get_context_defaults(s); ++#endif + return 0; + } + ++#if LIBAVCODEC_VERSION_MAJOR < 59 + AVCodecContext *avcodec_alloc_context3(AVCodec *codec){ + return avcodec_alloc_context(); + } ++#endif + + #endif + +diff -up mediastreamer2-5.0.66/src/utils/ffmpeg-priv.h.omv~ mediastreamer2-5.0.66/src/utils/ffmpeg-priv.h +--- mediastreamer2-5.0.66/src/utils/ffmpeg-priv.h.omv~ 2022-01-22 15:50:17.384618144 +0100 ++++ mediastreamer2-5.0.66/src/utils/ffmpeg-priv.h 2022-01-22 15:52:41.082908875 +0100 +@@ -121,8 +121,10 @@ int avcodec_encode_video2 (AVCodecContex + + #ifndef HAVE_FUN_avcodec_get_context_defaults3 /**/ + int avcodec_get_context_defaults3 (AVCodecContext *s, AVCodec *codec); ++#if LIBAVCODEC_VERSION_MAJOR < 59 + AVCodecContext *avcodec_alloc_context3(AVCodec *codec); + #endif ++#endif + + #ifndef HAVE_FUN_avcodec_open2 /**/ + int avcodec_open2 (AVCodecContext *avctx, AVCodec *codec, AVDictionary **options); +@@ -173,5 +175,4 @@ void av_frame_unref (AVFrame *frame); + #ifdef _MSC_VER + #pragma warning(pop) + #endif +- + #endif /* FFMPEG_PRIV_H */ +diff -up mediastreamer2-5.0.66/src/videofilters/h264dec.cpp.omv~ mediastreamer2-5.0.66/src/videofilters/h264dec.cpp +--- mediastreamer2-5.0.66/src/videofilters/h264dec.cpp.omv~ 2022-01-22 15:51:09.157728192 +0100 ++++ mediastreamer2-5.0.66/src/videofilters/h264dec.cpp 2022-01-22 17:47:44.517795632 +0100 +@@ -66,13 +66,15 @@ typedef struct _DecData{ + static void ffmpeg_init(void){ + static bool_t done=FALSE; + if (!done){ ++#if LIBAVCODEC_VERSION_MAJOR < 59 + avcodec_register_all(); ++#endif + done=TRUE; + } + } + + static void dec_open(DecData *d){ +- AVCodec *codec; ++ const AVCodec *codec; + int error; + codec=avcodec_find_decoder(CODEC_ID_H264); + if (codec==NULL) ms_fatal("Could not find H264 decoder in ffmpeg."); +@@ -164,7 +166,11 @@ 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_MAJOR < 57 + mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pkt_pts); ++#else ++ mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pts); ++#endif + #endif + return yuv_msg; + } +@@ -325,7 +331,17 @@ 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 ++#if LIBAVCODEC_VERSION_MAJOR < 59 + len=avcodec_decode_video2(&d->av_context,d->orig,&got_picture,&pkt); ++#else ++ int ret = avcodec_receive_frame(&d->av_context, d->orig); ++ got_picture = (ret == 0); ++ ret = avcodec_send_packet(&d->av_context, &pkt); ++ if(ret < 0) ++ len = ret; ++ else ++ len = pkt.size; ++#endif + if (len<=0) { + ms_warning("ms_AVdecoder_process: error %i.",len); + ms_filter_notify_no_arg(f,MS_VIDEO_DECODER_DECODING_ERRORS); +diff -up mediastreamer2-5.0.66/src/videofilters/videodec.c.omv~ mediastreamer2-5.0.66/src/videofilters/videodec.c +--- mediastreamer2-5.0.66/src/videofilters/videodec.c.omv~ 2022-01-22 18:01:04.246313380 +0100 ++++ mediastreamer2-5.0.66/src/videofilters/videodec.c 2022-01-22 18:03:31.666661981 +0100 +@@ -49,7 +49,7 @@ extern void ms_ffmpeg_check_init(void); + + typedef struct DecState{ + AVCodecContext av_context; +- AVCodec *av_codec; ++ const AVCodec *av_codec; + enum CodecID codec; + mblk_t *input; + YuvBuf outbuf; +@@ -661,7 +661,11 @@ static mblk_t *get_as_yuvmsg(MSFilter *f + #endif + ms_error("%s: error in ms_sws_scale().",f->desc->name); + } ++#if LIBAVCODEC_VERSION_MAJOR < 59 + mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pkt_pts); ++#else ++ mblk_set_timestamp_info(yuv_msg, (uint32_t)orig->pts); ++#endif + return yuv_msg; + } + /* Bitmasks to select bits of a byte from low side */ +@@ -719,7 +723,17 @@ static void dec_process_frame(MSFilter * + pkt.data = frame->b_rptr; + pkt.size = remain; + pkt.pts = frame_ts; ++#if LIBAVCODEC_VERSION_MAJOR < 59 + len=avcodec_decode_video2(&s->av_context, s->orig, &got_picture,&pkt); ++#else ++ int ret = avcodec_receive_frame(&s->av_context, s->orig); ++ got_picture = (ret == 0); ++ ret = avcodec_send_packet(&s->av_context, &pkt); ++ if (ret < 0) ++ len = ret; ++ else ++ len = pkt.size; ++#endif + + if (len<=0) { + ms_warning("ms_AVdecoder_process: error %i.",len); +diff -up mediastreamer2-5.0.66/src/videofilters/videoenc.c.omv~ mediastreamer2-5.0.66/src/videofilters/videoenc.c +--- mediastreamer2-5.0.66/src/videofilters/videoenc.c.omv~ 2022-01-22 17:47:56.230833130 +0100 ++++ mediastreamer2-5.0.66/src/videofilters/videoenc.c 2022-01-22 18:13:41.544298347 +0100 +@@ -34,6 +34,10 @@ + #include /* ntohl(3) */ + #endif + ++#if LIBAVCODEC_VERSION_MAJOR >= 59 ++#include ++#endif ++ + #include "rfc2429.h" + + +@@ -128,7 +132,9 @@ void ms_ffmpeg_log_callback(void* ptr, i + + void ms_ffmpeg_check_init(){ + if(!avcodec_initialized){ ++#if LIBAVCODEC_VERSION_MAJOR < 59 + avcodec_register_all(); ++#endif + avcodec_initialized=TRUE; + #ifdef ENABLE_LOG_FFMPEG + av_log_set_level(AV_LOG_WARNING); +@@ -139,7 +145,7 @@ void ms_ffmpeg_check_init(){ + + typedef struct EncState{ + AVCodecContext av_context; +- AVCodec *av_codec; ++ const AVCodec *av_codec; + AVFrame* pict; + enum CodecID codec; + mblk_t *comp_buf; +@@ -325,14 +331,20 @@ static void prepare(EncState *s){ + + } + ++static AVDictionary **codecopts = NULL; ++ + static void prepare_h263(EncState *s){ ++#if LIBAVCODEC_VERSION_MAJOR < 59 + AVCodecContext *c=&s->av_context; ++ c->rtp_payload_size = s->mtu/2; ++#else ++ av_dict_set_int(codecopts, "ps", s->mtu/2, 0); ++#endif + /* 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; + #endif +- c->rtp_payload_size = s->mtu/2; + if (s->profile==0){ + s->codec=CODEC_ID_H263; + }else{ +@@ -382,7 +394,7 @@ 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_context, s->av_codec, codecopts); + if (error!=0) { + ms_error("avcodec_open() failed: %i",error); + return; +@@ -815,7 +827,11 @@ static void process_frame(MSFilter *f, m + ms_yuv_buf_init_from_mblk(&yuv, inm); + /* convert image if necessary */ + av_frame_unref(s->pict); ++#if LIBAVCODEC_VERSION_MAJOR < 59 + avpicture_fill((AVPicture*)s->pict,yuv.planes[0],c->pix_fmt,c->width,c->height); ++#else ++ av_image_fill_arrays(s->pict->data, s->pict->linesize, yuv.planes[0], c->pix_fmt, c->width, c->height, 1); ++#endif + + /* timestamp used by ffmpeg, unset here */ + s->pict->pts=AV_NOPTS_VALUE; +@@ -840,7 +856,15 @@ static void process_frame(MSFilter *f, m + #endif + packet.data=comp_buf->b_wptr; + packet.size=comp_buf_sz; ++#if LIBAVCODEC_VERSION_MAJOR < 59 + error=avcodec_encode_video2(c, &packet, s->pict, &got_packet); ++#else ++ error=avcodec_send_frame(c, s->pict); ++ if(!error) { ++ got_packet = 1; ++ error=avcodec_receive_packet(c, &packet); ++ } ++#endif + + if (error<0) ms_warning("ms_AVencoder_process: error %i.",error); + else if (got_packet){ diff --git a/mediastreamer-5.2.111-fix-opengl-include.patch b/mediastreamer-5.2.111-fix-opengl-include.patch new file mode 100644 index 0000000..94a8af3 --- /dev/null +++ b/mediastreamer-5.2.111-fix-opengl-include.patch @@ -0,0 +1,18 @@ +--- a/include/CMakeLists.txt ++++ b/include/CMakeLists.txt +@@ -94,9 +94,9 @@ if(ENABLE_TOOLS AND NOT ANDROID) + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/mediastreamer2 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ + ) +-if(ENABLE_VIDEO) +- install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OpenGL +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +- ) +- +-endif() ++#if(ENABLE_VIDEO) ++# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OpenGL ++# DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++# ) ++# ++#endif() diff --git a/mediastreamer.spec b/mediastreamer.spec index 2521c9b..48a72f3 100644 --- a/mediastreamer.spec +++ b/mediastreamer.spec @@ -1,55 +1,50 @@ ### AUTOUPDATE-OFF: 8 Name: mediastreamer -Version: 2.16.1 +Version: 5.2.111 Release: 1mamba Summary: A GPL licensed library to make audio and video real-time streaming and processing Group: Applications/Multimedia Vendor: openmamba Distribution: openmamba Packager: Silvan Calarco -URL: http://www.linphone.org/eng/documentation/dev/mediastreamer2.html +URL: https://www.linphone.org/technical-corner/mediastreamer2 Source: https://github.com/BelledonneCommunications/mediastreamer2.git/%{version}/mediastreamer2-%{version}.tar.bz2 Patch0: mediastreamer-2.16.1-x86-fix-conversion-error.patch Patch1: mediastreamer-2.16.1-x86-fix-conversion-error-2.patch -#Source: http://download.savannah.gnu.org/releases/linphone/mediastreamer/mediastreamer-%{version}.tar.gz +Patch2: mediastreamer-5.2.111-ffmpeg-5.0.patch +Patch3: mediastreamer-5.2.111-fix-opengl-include.patch +Patch4: mediastreamer-5.2.111-cmake-config-location.patch License: GPL ## AUTOBUILDREQ-BEGIN BuildRequires: glibc-devel -BuildRequires: libGL-devel -BuildRequires: libGLU-devel BuildRequires: libX11-devel -BuildRequires: libXau-devel -BuildRequires: libXdmcp-devel -BuildRequires: libXext-devel BuildRequires: libXv-devel BuildRequires: libalsa-devel BuildRequires: libavcodec-ffmpeg-devel BuildRequires: libavutil-ffmpeg-devel BuildRequires: libbctoolbox-devel -BuildRequires: libbsd-devel +BuildRequires: libbzrtp-devel BuildRequires: libgcc BuildRequires: libglew-devel +BuildRequires: libglvnd-devel BuildRequires: libgsm-devel BuildRequires: libjpeg-devel -BuildRequires: libogg-devel BuildRequires: libopus-devel BuildRequires: libortp-devel -BuildRequires: libpcap-devel -BuildRequires: libpolarssl-devel BuildRequires: libpulseaudio-devel BuildRequires: libspeex-devel +BuildRequires: libspeexdsp-devel +BuildRequires: libsrtp-devel BuildRequires: libstdc++6-devel BuildRequires: libswscale-ffmpeg-devel BuildRequires: libtheora-devel -BuildRequires: libupnp-devel BuildRequires: libv4l-devel BuildRequires: libvpx-devel -BuildRequires: libxcb-devel +BuildRequires: libyuv-devel +BuildRequires: libzxing-cpp-devel ## AUTOBUILDREQ-END -BuildRequires: libpulseaudio-devel >= 9.0-1mamba -BuildRequires: libortp-devel >= 0.22 +BuildRequires: libortp-devel >= 5.2.111 Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} -BuildRoot: %{_tmppath}/%{name}-%{version}-root %description Mediastreamer2 is a GPL licensed library to make audio and video real-time streaming and processing. Written in pure C, it is based upon the oRTP library. @@ -58,7 +53,8 @@ Mediastreamer2 is a GPL licensed library to make audio and video real-time strea Group: System/Libraries Summary: Shared libraries for %{name} Provides: libmediastreamer2 -Obsoletes: libmediastreamer2 +Obsoletes: libmediastreamer2 < 3 +Obsoletes: mediastreamer-plugin-msilbc <= 2.1.2-4mamba %description -n lib%{name} Mediastreamer2 is a GPL licensed library to make audio and video real-time streaming and processing. Written in pure C, it is based upon the oRTP library. @@ -69,7 +65,7 @@ Group: Development/Libraries Summary: Development files for %{name} Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release} Provides: libmediastreamer2-devel -Obsoletes: libmediastreamer2-devel +Obsoletes: libmediastreamer2-devel < 3 %description -n lib%{name}-devel Mediastreamer2 is a GPL licensed library to make audio and video real-time streaming and processing. Written in pure C, it is based upon the oRTP library. @@ -79,21 +75,33 @@ This package contains libraries and header files for developing applications tha %prep %setup -q -n mediastreamer2-%{version} -%patch0 -p1 -%patch1 -p1 +#%patch0 -p1 +%patch 1 -p1 +%patch 2 -p1 +%patch 3 -p1 -b .fix-opengl-include +%patch 4 -p1 -b .cmake-config-location + +#./autogen.sh + +# use system OpenGL headers +rm -fr include/OpenGL %build -./autogen.sh -%configure \ - CFLAGS="%{optflags} -DMS2_GIT_VERSION=\"\\\"unknown\\\"\"" +%cmake -d build \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DENABLE_STATIC=OFF \ + -DENABLE_STRICT=OFF \ + -DENABLE_UNIT_TESTS=OFF \ + -DENABLE_MKV=ON + +#% configure \ +# CFLAGS="%{optflags} -DMS2_GIT_VERSION=\"\\\"unknown\\\"\"" %make %install [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" -%makeinstall - -%find_lang %{name} || touch %{name}.lang +%makeinstall -C build %clean [ "%{buildroot}" != / ] && rm -rf "%{buildroot}" @@ -101,34 +109,36 @@ This package contains libraries and header files for developing applications tha %post -n lib%{name} -p /sbin/ldconfig %postun -n lib%{name} -p /sbin/ldconfig -%files -f %{name}.lang +%files %defattr(-,root,root) %{_bindir}/mediastream -%{_bindir}/msaudiocmp -%{_bindir}/pcap_playback +%{_bindir}/mkvstream %{_datadir}/images/nowebcamCIF.jpg %files -n lib%{name} %defattr(-,root,root) -%{_libdir}/libmediastreamer_base.so.* -%{_libdir}/libmediastreamer_voip.so.* -%doc AUTHORS COPYING +%{_libdir}/libmediastreamer.so.* +%doc LICENSE.txt %files -n lib%{name}-devel %defattr(-,root,root) %dir %{_includedir}/mediastreamer2 %{_includedir}/mediastreamer2/*.h -%{_libdir}/libmediastreamer_base.la -%{_libdir}/libmediastreamer_base.so -%{_libdir}/libmediastreamer_voip.la -%{_libdir}/libmediastreamer_voip.so -%{_libdir}/pkgconfig/mediastreamer.pc -%dir %{_datadir}/doc/mediastreamer-* -%dir %{_datadir}/doc/mediastreamer-*/html -%{_datadir}/doc/mediastreamer-*/html/* -#%doc ChangeLog NEWS README +%{_libdir}/libmediastreamer.so +%dir %{_libdir}/cmake/Mediastreamer2 +%{_libdir}/cmake/Mediastreamer2/Mediastreamer2*.cmake +%dir %{_docdir}/mediastreamer2-* +%dir %{_docdir}/mediastreamer2-*/html +%{_docdir}/mediastreamer2-*/html/* +%doc CHANGELOG.md %changelog +* Thu Nov 23 2023 Silvan Calarco 5.2.111-1mamba +- update to 5.2.111 + +* Tue Jun 01 2021 Silvan Calarco 4.5.16-1mamba +- update to 4.5.16 + * Mon Nov 13 2017 Silvan Calarco 2.16.1-1mamba - update to 2.16.1