Hi,
the attached patch should fix this bug.
--
Anton Khirnov
Index: qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-avcodec-wrapper.c
===================================================================
--- qutecom-2.2.1+dfsg1.orig/wifo/phapi/phcodec-avcodec-wrapper.c 2014-02-27 20:42:31.000000000 +0000
+++ qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-avcodec-wrapper.c 2014-02-28 21:07:43.059658912 +0000
@@ -81,12 +81,18 @@
int srcsize, void *dst, int dstsize) {
ph_avcodec_encoder_ctx_t * encoder_t = (ph_avcodec_encoder_ctx_t *) ctx;
- int enc_len;
+ AVPacket pkt;
+ int ret, got_output;
- enc_len = avcodec_encode_video(encoder_t->context,
- dst, dstsize, (AVFrame *)src);
+ pkt.data = dst;
+ pkt.size = dstsize;
- return enc_len;
+ ret = avcodec_encode_video2(encoder_t->context,
+ &pkt, (AVFrame *)src, &got_output);
+ if (ret < 0)
+ return ret;
+
+ return got_output ? pkt.size : 0;
}
int phcodec_avcodec_encoder_init(ph_avcodec_encoder_ctx_t *encoder_t, void *ctx, void *opaque) {
Index: qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h263.c
===================================================================
--- qutecom-2.2.1+dfsg1.orig/wifo/phapi/phcodec-h263.c 2014-02-27 20:42:31.000000000 +0000
+++ qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h263.c 2014-02-27 21:03:25.662117161 +0000
@@ -24,6 +24,7 @@
*/
#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
#include <ortp.h>
#include <osip2/osip_mt.h>
#include <osipparser2/osip_list.h>
@@ -51,8 +52,8 @@
ph_avcodec_meta_ctx_t * _h263_meta_init(ph_avcodec_meta_ctx_t * meta, phvstream_t *s) {
- meta->avcodec_encoder_id = CODEC_ID_H263;
- meta->avcodec_decoder_id = CODEC_ID_H263;
+ meta->avcodec_encoder_id = AV_CODEC_ID_H263;
+ meta->avcodec_decoder_id = AV_CODEC_ID_H263;
meta->frame_rate = 10;
meta->frame_width = PHMEDIA_VIDEO_FRAME_WIDTH;
meta->frame_height = PHMEDIA_VIDEO_FRAME_HEIGHT;
@@ -75,12 +76,12 @@
return 0;
}
- h263t->encoder_ctx.context->flags |= CODEC_FLAG_QP_RD;
#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
h263t->encoder_ctx.context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
#else
av_opt_set_int(h263t->encoder_ctx.context->priv_data, "structured_slices", 1, 0);
#endif
+ av_opt_set(h263t->encoder_ctx.context, "mpv_flags", "+qp_rd", AV_OPT_SEARCH_CHILDREN);
h263t->encoder_ctx.context->flags |= CODEC_FLAG_QSCALE;
//h263t->encoder_ctx.context->flags |= CODEC_FLAG_INPUT_PRESERVED;
Index: qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h263flv1.c
===================================================================
--- qutecom-2.2.1+dfsg1.orig/wifo/phapi/phcodec-h263flv1.c 2014-02-27 20:42:31.000000000 +0000
+++ qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h263flv1.c 2014-02-27 21:04:51.788279543 +0000
@@ -24,6 +24,7 @@
*/
#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
#include <ortp.h>
#include <osip2/osip_mt.h>
#include <osipparser2/osip_list.h>
@@ -51,8 +52,8 @@
ph_avcodec_meta_ctx_t * _h263flv1_meta_init(ph_avcodec_meta_ctx_t * meta, phvstream_t *s) {
- meta->avcodec_encoder_id = CODEC_ID_FLV1;
- meta->avcodec_decoder_id = CODEC_ID_FLV1;
+ meta->avcodec_encoder_id = AV_CODEC_ID_FLV1;
+ meta->avcodec_decoder_id = AV_CODEC_ID_FLV1;
meta->frame_rate = 10;
meta->frame_width = PHMEDIA_VIDEO_FRAME_WIDTH;
meta->frame_height = PHMEDIA_VIDEO_FRAME_HEIGHT;
@@ -75,12 +76,12 @@
return 0;
}
- h263t->encoder_ctx.context->flags |= CODEC_FLAG_QP_RD;
#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
h263t->encoder_ctx.context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
#else
av_opt_set_int(h263t->encoder_ctx.context->priv_data, "structured_slices", 1, 0);
#endif
+ av_opt_set(h263t->encoder_ctx.context, "mpv_flags", "+qp_rd", AV_OPT_SEARCH_CHILDREN);
h263t->encoder_ctx.context->flags |= CODEC_FLAG_QSCALE;
//h263t->encoder_ctx.context->flags |= CODEC_FLAG_INPUT_PRESERVED;
Index: qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h263plus.c
===================================================================
--- qutecom-2.2.1+dfsg1.orig/wifo/phapi/phcodec-h263plus.c 2014-02-27 20:42:31.000000000 +0000
+++ qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h263plus.c 2014-02-27 21:03:14.396834288 +0000
@@ -17,6 +17,7 @@
*/
#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
#include <ortp.h>
#include <osip2/osip_mt.h>
#include <osipparser2/osip_list.h>
@@ -44,8 +45,8 @@
ph_avcodec_meta_ctx_t * _h263p_meta_init(ph_avcodec_meta_ctx_t * meta, phvstream_t *s) {
- meta->avcodec_encoder_id = CODEC_ID_H263P;
- meta->avcodec_decoder_id = CODEC_ID_H263;
+ meta->avcodec_encoder_id = AV_CODEC_ID_H263P;
+ meta->avcodec_decoder_id = AV_CODEC_ID_H263;
meta->frame_rate = 10;
meta->frame_width = PHMEDIA_VIDEO_FRAME_WIDTH;
meta->frame_height = PHMEDIA_VIDEO_FRAME_HEIGHT;
@@ -68,12 +69,12 @@
return 0;
}
- h263t->encoder_ctx.context->flags |= CODEC_FLAG_QP_RD;
#ifdef CODEC_FLAG_H263P_SLICE_STRUCT
h263t->encoder_ctx.context->flags |= CODEC_FLAG_H263P_SLICE_STRUCT;
#else
av_opt_set_int(h263t->encoder_ctx.context->priv_data, "structured_slices", 1, 0);
#endif
+ av_opt_set(h263t->encoder_ctx.context, "mpv_flags", "+qp_rd", AV_OPT_SEARCH_CHILDREN);
h263t->encoder_ctx.context->flags |= CODEC_FLAG_QSCALE;
//h263t->encoder_ctx.context->flags |= CODEC_FLAG_INPUT_PRESERVED;
Index: qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h264.c
===================================================================
--- qutecom-2.2.1+dfsg1.orig/wifo/phapi/phcodec-h264.c 2014-02-27 20:42:31.000000000 +0000
+++ qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-h264.c 2014-02-27 21:05:37.740433092 +0000
@@ -53,8 +53,8 @@
phConfig_t *cfg;
cfg = phGetConfig();
- meta->avcodec_encoder_id = CODEC_ID_H264;
- meta->avcodec_decoder_id = CODEC_ID_H264;
+ meta->avcodec_encoder_id = AV_CODEC_ID_H264;
+ meta->avcodec_decoder_id = AV_CODEC_ID_H264;
meta->frame_width = PHMEDIA_VIDEO_FRAME_WIDTH;
meta->frame_height = PHMEDIA_VIDEO_FRAME_HEIGHT;
Index: qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-mpeg4.c
===================================================================
--- qutecom-2.2.1+dfsg1.orig/wifo/phapi/phcodec-mpeg4.c 2014-02-27 20:42:31.000000000 +0000
+++ qutecom-2.2.1+dfsg1/wifo/phapi/phcodec-mpeg4.c 2014-02-27 21:06:50.929271937 +0000
@@ -25,6 +25,7 @@
#include <libavcodec/avcodec.h>
+#include <libavutil/opt.h>
#include <ortp.h>
#include <osip2/osip_mt.h>
#include <osipparser2/osip_list.h>
@@ -56,8 +57,8 @@
}
ph_avcodec_meta_ctx_t * _mpeg4_meta_init(ph_avcodec_meta_ctx_t * meta, phvstream_t *s) {
- meta->avcodec_encoder_id = CODEC_ID_MPEG4;
- meta->avcodec_decoder_id = CODEC_ID_MPEG4;
+ meta->avcodec_encoder_id = AV_CODEC_ID_MPEG4;
+ meta->avcodec_decoder_id = AV_CODEC_ID_MPEG4;
meta->frame_width = webcam_get_width(s->wt);
meta->frame_height = webcam_get_height(s->wt);
@@ -80,7 +81,7 @@
return 0;
}
- mpeg4t->encoder_ctx.context->flags |= CODEC_FLAG_QP_RD;
+ av_opt_set(mpeg4t->encoder_ctx.context, "mpv_flags", "+qp_rd", AV_OPT_SEARCH_CHILDREN);
//mpeg4t->encoder_ctx.context->flags |= CODEC_FLAG_H263P_UMV;
//mpeg4t->encoder_ctx.context->flags |= CODEC_FLAG_4MV;
//mpeg4t->encoder_ctx.context->flags |= CODEC_FLAG_AC_PRED;