mediastream: add VP8 (libvpx) support

parent f7480a4f
......@@ -193,6 +193,25 @@ AC_DEFUN([MS_CHECK_VIDEO],[
[have_theora=no])
fi
AC_ARG_ENABLE(vp8,
[ --disable-vp8 Disable vp8 support],
[case "${enableval}" in
yes) vp8=true ;;
no) vp8=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for --disable-vp8) ;;
esac],[vp8=true])
if test x$vp8 = xtrue; then
PKG_CHECK_MODULES(VP8, [vpx >= 0.9.6 ], [have_vp8=yes],
[have_vp8=no])
PKG_CHECK_MODULES(SWSCALE, [libswscale >= 0.7.0 ],[have_vp8=$have_vp8] , have_vp8=no)
fi
if test "$have_vp8" = "true" ; then
VIDEO_CFLAGS=" $VIDEO_CFLAGS $SWSCALE_CFLAGS"
VIDEO_LIBS=" $VIDEO_LIBS $SWSCALE_LIBS"
fi
if test "$ffmpeg" = "false"; then
FFMPEG_CFLAGS=" $FFMPEG_CFLAGS -DNO_FFMPEG"
fi
......
......@@ -546,6 +546,7 @@ AM_CONDITIONAL(BUILD_GSM, test x$build_gsm = xyes )
MS_CHECK_VIDEO
AM_CONDITIONAL(BUILD_VIDEO, test "$video" = "true")
AM_CONDITIONAL(BUILD_THEORA, test "$have_theora" = "yes")
AM_CONDITIONAL(BUILD_VP8, test "$have_vp8" = "yes")
AM_CONDITIONAL(BUILD_WIN32, test "$mingw_found" = "yes")
AM_CONDITIONAL(BUILD_WIN32_WCE, test "$mingw32ce_found" = "yes")
AM_CONDITIONAL(BUILD_FFMPEG, test "$ffmpeg" = "true")
......
......@@ -133,6 +133,10 @@ if BUILD_THEORA
libmediastreamer_la_SOURCES+=theora.c
endif
if BUILD_VP8
libmediastreamer_la_SOURCES+=vp8.c
endif
if BUILD_FFMPEG
libmediastreamer_la_SOURCES+= videoenc.c \
videodec.c \
......
......@@ -91,10 +91,6 @@ static void dec_snow_init(MSFilter *f){
dec_init(f,CODEC_ID_SNOW);
}
static void dec_vp8_init(MSFilter *f){
dec_init(f,CODEC_ID_VP8);
}
static void dec_uninit(MSFilter *f){
DecState *s=(DecState*)f->data;
if (s->av_context.codec!=NULL){
......@@ -220,24 +216,6 @@ static mblk_t * skip_rfc2429_header(mblk_t *inm){
return NULL;
}
static mblk_t * skip_draft_vp8_header(mblk_t *inm){
if (msgdsize(inm) >= 2){
unsigned char vp8_payload_desc = *(inm->b_rptr);
int payload_desc_size = 1;
/* has picture id ? */
if (vp8_payload_desc & 0x10) {
/* extended picture id ? */
if (inm->b_rptr[1] & 0x80)
payload_desc_size = 3;
else
payload_desc_size = 2;
}
inm->b_rptr += payload_desc_size;
return inm;
}else freemsg(inm);
return NULL;
}
static mblk_t * parse_snow_header(DecState *s,mblk_t *inm){
if (msgdsize(inm) >= 4){
uint32_t h = ntohl(*(uint32_t*)inm->b_rptr);
......@@ -660,7 +638,6 @@ static void dec_process_frame(MSFilter *f, mblk_t *inm){
else if (f->desc->id==MS_H263_OLD_DEC_ID) inm=skip_rfc2190_header(inm);
else if (s->codec==CODEC_ID_SNOW && s->input==NULL) inm=parse_snow_header(s,inm);
else if (s->codec==CODEC_ID_MJPEG && f->desc->id==MS_JPEG_DEC_ID) inm=read_rfc2435_header(s,inm);
else if (f->desc->id==MS_VP8_DEC_ID) inm=skip_draft_vp8_header(inm);
if (inm){
/* accumulate the video packet until we have the rtp markbit*/
......@@ -926,29 +903,12 @@ MSFilterDesc ms_snow_dec_desc={
.methods= methods
};
MSFilterDesc ms_vp8_dec_desc={
.id=MS_VP8_DEC_ID,
.name="MSVp8Dec",
.text="A VP8 decoder using ffmpeg library",
.category=MS_FILTER_DECODER,
.enc_fmt="VP8-DRAFT-0-3-2",
.ninputs=1,
.noutputs=1,
.init=dec_vp8_init,
.preprocess=dec_preprocess,
.process=dec_process,
.postprocess=dec_postprocess,
.uninit=dec_uninit,
.methods= methods
};
#endif
MS_FILTER_DESC_EXPORT(ms_mpeg4_dec_desc)
MS_FILTER_DESC_EXPORT(ms_h263_dec_desc)
MS_FILTER_DESC_EXPORT(ms_h263_old_dec_desc)
MS_FILTER_DESC_EXPORT(ms_snow_dec_desc)
MS_FILTER_DESC_EXPORT(ms_vp8_dec_desc)
/* decode JPEG image with RTP/jpeg headers */
MS_FILTER_DESC_EXPORT(ms_jpeg_dec_desc)
......
......@@ -1139,22 +1139,6 @@ MSFilterDesc ms_mjpeg_enc_desc={
.methods=methods
};
MSFilterDesc ms_vp8_enc_desc={
.id=MS_VP8_ENC_ID,
.name="MSVp8Enc",
.text=N_("A video VP8 encoder using ffmpeg library."),
.category=MS_FILTER_ENCODER,
.enc_fmt="VP8-DRAFT-0-3-2",
.ninputs=1, /*MS_YUV420P is assumed on this input */
.noutputs=1,
.init=enc_vp8_init,
.preprocess=enc_preprocess,
.process=enc_process,
.postprocess=enc_postprocess,
.uninit=enc_uninit,
.methods=methods
};
#endif
void __register_ffmpeg_encoders_if_possible(void){
......@@ -1171,9 +1155,5 @@ void __register_ffmpeg_encoders_if_possible(void){
{
ms_filter_register(&ms_mjpeg_enc_desc);
}
if (avcodec_find_encoder(CODEC_ID_VP8))
{
ms_filter_register(&ms_vp8_enc_desc);
}
}
This diff is collapsed.
......@@ -30,6 +30,7 @@ LDADD= $(top_builddir)/src/libmediastreamer.la \
$(SPEEX_LIBS) \
$(GSM_LIBS) \
$(THEORA_LIBS) \
$(VP8_LIBS) \
$(VIDEO_LIBS)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment