Hi,
the attached patch fixed the build for me.
I did not have the opportunity to test that it actually works yet, so it'd be
nice if someone could do that.

-- 
Anton Khirnov
Index: jitsi-2.4.4997/lib/src/libjitsi/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c
===================================================================
--- jitsi-2.4.4997.orig/lib/src/libjitsi/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c	2014-02-27 05:10:28.000000000 +0000
+++ jitsi-2.4.4997/lib/src/libjitsi/src/native/ffmpeg/org_jitsi_impl_neomedia_codec_FFmpeg.c	2014-02-27 16:45:02.128964921 +0000
@@ -163,14 +163,28 @@
                 = (*env)->GetByteArrayElements (env, samples, NULL);
 
             if (samples_ptr) {
-                ret = (jint) avcodec_encode_audio(
-                        (AVCodecContext *) (intptr_t) ctx,
-                        (uint8_t *) (buf_ptr + buf_offset), (int) buf_size,
-                        (const short *) (samples_ptr + samples_offset));
+		AVCodecContext *avctx = (AVCodecContext*)(intptr_t)ctx;
+                AVPacket pkt;
+		AVFrame *frame = av_frame_alloc();
+		int got_output;
+
+		if (!frame)
+		    return AVERROR(ENOMEM);
+		frame->data[0] = (uint8_t*)(samples_ptr + samples_offset);
+		frame->linesize[0] = avctx->frame_size * av_get_bytes_per_sample(avctx->sample_fmt) *
+			avctx->channels;
+
+		pkt.data = (uint8_t*)(buf_ptr + buf_offset);
+		pkt.size = buf_size;
+                ret = (jint) avcodec_encode_audio2(
+                        avctx, &pkt, frame, &got_output);
                 (*env)->ReleaseByteArrayElements(
                         env,
                         samples, samples_ptr,
                         JNI_ABORT);
+		av_frame_free(&frame);
+		if (ret >= 0)
+		    ret = got_output ? pkt.size : 0;
             } else
                 ret = -1;
             (*env)->ReleaseByteArrayElements (env, buf, buf_ptr, 0);
@@ -192,12 +206,18 @@
         jbyte *buf_ptr = (*env)->GetByteArrayElements (env, buf, NULL);
 
         if (buf_ptr) {
+	    int got_output;
+	    AVPacket pkt;
+	    pkt.data = (uint8_t*)buf_ptr;
+	    pkt.size = (int)buf_size;
             ret
                 = (jint)
-                    avcodec_encode_video(
+                    avcodec_encode_video2(
                             (AVCodecContext *) (intptr_t) ctx,
-                            (uint8_t *) buf_ptr, (int) buf_size,
-                            (const AVFrame *) (intptr_t) frame);
+                            &pkt, (const AVFrame *) (intptr_t) frame,
+			    &got_output);
+	    if (ret >= 0)
+	        ret = got_output ? pkt.size : 0;
             (*env)->ReleaseByteArrayElements (env, buf, buf_ptr, 0);
         } else
             ret = -1;
@@ -210,14 +230,14 @@
 Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodec_1find_1decoder
     (JNIEnv *env, jclass clazz, jint id)
 {
-    return (jlong) (intptr_t) avcodec_find_decoder((enum CodecID) id);
+    return (jlong) (intptr_t) avcodec_find_decoder((enum AVCodecID) id);
 }
 
 JNIEXPORT jlong JNICALL
 Java_org_jitsi_impl_neomedia_codec_FFmpeg_avcodec_1find_1encoder
     (JNIEnv *env, jclass clazz, jint id)
 {
-    return (jlong) (intptr_t) avcodec_find_encoder((enum CodecID) id);
+    return (jlong) (intptr_t) avcodec_find_encoder((enum AVCodecID) id);
 }
 
 JNIEXPORT jint JNICALL

Reply via email to