Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build NeutrinoRDP under Ubuntu 16.04 #7

Open
risi70 opened this issue Jun 3, 2016 · 0 comments · May be fixed by #11
Open

Can't build NeutrinoRDP under Ubuntu 16.04 #7

risi70 opened this issue Jun 3, 2016 · 0 comments · May be fixed by #11

Comments

@risi70
Copy link

risi70 commented Jun 3, 2016

Compatibility issues with ffmpeg-libraries cause compilation to fail under Ubuntu 16.04. Fixes are well known and implemented in the included patch:

diff -u -r -x .git NeutrinoRDP/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c NeutrinoRDP-patched/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c
--- NeutrinoRDP/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c  2016-05-20 05:02:13.719006000 +0200
+++ NeutrinoRDP-patched/channels/drdynvc/tsmf/ffmpeg/tsmf_ffmpeg.c  2016-05-20 05:12:43.087006000 +0200
@@ -35,12 +35,22 @@
 #define AVMEDIA_TYPE_AUDIO 1
 #endif

+/* New Distros */
+#if LIBAVUTIL_VERSION_MAJOR >= 54
+#define DISTRO_UBUNTU1604
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
+#endif
+
 typedef struct _TSMFFFmpegDecoder
 {
    ITSMFDecoder iface;

    int media_type;
+#ifdef DISTRO_UBUNTU1604
+        enum AVCodecID codec_id;
+#else
    enum CodecID codec_id;
+#endif
    AVCodecContext* codec_context;
    AVCodec* codec;
    AVFrame* frame;
@@ -75,7 +85,11 @@
    mdecoder->codec_context->time_base.den = media_type->SamplesPerSecond.Numerator;
    mdecoder->codec_context->time_base.num = media_type->SamplesPerSecond.Denominator;

-   mdecoder->frame = avcodec_alloc_frame();
+#ifdef DISTRO_UBUNTU1604
+        mdecoder->frame = av_frame_alloc();
+#else
+        mdecoder->frame = avcodec_alloc_frame();
+#endif

    return true;
 }
@@ -89,8 +103,12 @@
    mdecoder->codec_context->channels = media_type->Channels;
    mdecoder->codec_context->block_align = media_type->BlockAlign;

+/* Quite inelegant ifdef construct, but keeps compatibility with older distros */
+#ifdef DISTRO_UBUNTU1604
+    av_force_cpu_flags(AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2);
+#else
 #ifdef AV_CPU_FLAG_SSE2
-   mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
+    mdecoder->codec_context->dsp_mask = AV_CPU_FLAG_SSE2 | AV_CPU_FLAG_MMX2;
 #else
 #if LIBAVCODEC_VERSION_MAJOR < 53
    mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMXEXT;
@@ -98,6 +116,7 @@
    mdecoder->codec_context->dsp_mask = FF_MM_SSE2 | FF_MM_MMX2;
 #endif
 #endif
+#endif

    return true;
 }
@@ -345,7 +364,13 @@
        mdecoder->decoded_size = avpicture_get_size(mdecoder->codec_context->pix_fmt,
            mdecoder->codec_context->width, mdecoder->codec_context->height);
        mdecoder->decoded_data = xzalloc(mdecoder->decoded_size);
-       frame = avcodec_alloc_frame();
+
+#ifdef DISTRO_UBUNTU1604
+                frame = av_frame_alloc();
+#else
+                frame = avcodec_alloc_frame();
+#endif
+
        avpicture_fill((AVPicture *) frame, mdecoder->decoded_data,
            mdecoder->codec_context->pix_fmt,
            mdecoder->codec_context->width, mdecoder->codec_context->height);
@@ -418,7 +443,13 @@
            (int16_t*) dst, &frame_size, src, src_size);
 #else
        {
-            AVFrame* decoded_frame = avcodec_alloc_frame();
+
+#ifdef DISTRO_UBUNTU1604
+                        AVFrame* decoded_frame = av_frame_alloc();
+#else
+                        AVFrame* decoded_frame = avcodec_alloc_frame();
+#endif
+
            int got_frame = 0;
            AVPacket pkt;
            av_init_packet(&pkt);
diff -u -r -x .git NeutrinoRDP/channels/xrdpvr/xrdpvr_player.c NeutrinoRDP-patched/channels/xrdpvr/xrdpvr_player.c
--- NeutrinoRDP/channels/xrdpvr/xrdpvr_player.c 2016-05-20 05:02:13.731006000 +0200
+++ NeutrinoRDP-patched/channels/xrdpvr/xrdpvr_player.c 2016-05-16 18:35:06.261905406 +0200
@@ -107,7 +107,7 @@
 #define DISTRO_UBUNTU1404
 #endif

-#if LIBAVCODEC_VERSION_MAJOR == 56 && LIBAVCODEC_VERSION_MINOR == 26
+#if LIBAVCODEC_VERSION_MAJOR == 56 && LIBAVCODEC_VERSION_MINOR >= 13 
 #define DISTRO_DEBIAN8
 #endif
@cocoon cocoon linked a pull request Sep 15, 2017 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant