Skip to content

Commit

Permalink
Re #1758: Initial implementation of OpenH264 wrapper. Supports:
Browse files Browse the repository at this point in the history
 - library detection via autoconf
 - CBP
 - packetization modes: 0, 1
 - key frame request and indication
 - obey remote's fmtp

Also added video codec test in samples (similar to the one in pjmedia test though).
And there are some fixes here and there too (e.g. in vid_codec_util.c).


git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4815 74dad513-b988-da41-8d7b-12977e46ad98
  • Loading branch information
bennylp committed Apr 10, 2014
1 parent 84c4fc5 commit 5f23030
Show file tree
Hide file tree
Showing 16 changed files with 2,016 additions and 112 deletions.
301 changes: 195 additions & 106 deletions aconfigure

Large diffs are not rendered by default.

67 changes: 67 additions & 0 deletions aconfigure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -1095,6 +1095,73 @@ AC_ARG_ENABLE(v4l2,
)
])

dnl # OpenH264 alt prefix
AC_ARG_WITH(openh264,
AC_HELP_STRING([--with-openh264=DIR],
[Specify alternate OpenH264 prefix]),
[],
[with_openh264=no]
)

dnl # Do not use default OpenH264 installation if we are cross-compiling
if test "x$ac_cross_compile" != "x" -a "x$with_openh264" = "xno"; then
enable_openh264=no
fi

dnl # OpenH264
AC_SUBST(ac_openh264_cflags)
AC_SUBST(ac_openh264_ldflags)
AC_ARG_ENABLE(openh264,
AC_HELP_STRING([--disable-openh264],
[Disable OpenH264 (default: not disabled)]),
[
if test "$enable_openh264" = "no"; then
AC_MSG_RESULT([Checking if OpenH264 is disabled... yes])
fi
],
[
if test "x$with_openh264" != "xno" -a "x$with_openh264" != "x"; then
OPENH264_PREFIX=$with_openh264
OPENH264_CFLAGS="-I$OPENH264_PREFIX/include"
OPENH264_LDFLAGS="-L$OPENH264_PREFIX/lib"
AC_MSG_RESULT([Using OpenH264 prefix... $with_openh264])
else
OPENH264_CFLAGS=""
OPENH264_LDFLAGS=""
fi

AC_MSG_CHECKING([OpenH264 availability])

OPENH264_LIBS="-lwels"

SAVED_LIBS="$LIBS"
SAVED_LDFLAGS="$LDFLAGS"
SAVED_CFLAGS="$CFLAGS"

LIBS="$OPENH264_LIBS $LIBS"
LDFLAGS="$OPENH264_LDFLAGS $LDFLAGS"
CFLAGS="$OPENH264_CFLAGS $CFLAGS"

AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include <wels/codec_api.h>
#include <wels/codec_app_def.h>
]],
[int main() { CreateSVCEncoder(0); return 0; }]
)],
[ ac_openh264_cflags="-DPJMEDIA_HAS_OPENH264_CODEC=1 $OPENH264_CFLAGS"
ac_openh264_ldflags="$OPENH264_LDFLAGS $OPENH264_LIBS"
AC_MSG_RESULT(ok)
],
[
LIBS="$SAVED_LIBS"
LDFLAGS="$SAVED_LDFLAGS"
CFLAGS="$SAVED_CFLAGS"
AC_MSG_RESULT(failed)
])

])



dnl ########################################################
dnl # Intel IPP support
dnl #
Expand Down
11 changes: 8 additions & 3 deletions build.mak.in
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,18 @@ endif
SDL_CFLAGS = @ac_sdl_cflags@
SDL_LDFLAGS = @ac_sdl_ldflags@

# FFMPEG dlags
# FFMPEG flags
FFMPEG_CFLAGS = @ac_ffmpeg_cflags@
FFMPEG_LDFLAGS = @ac_ffmpeg_ldflags@

# Video4Linux2
V4L2_CFLAGS = @ac_v4l2_cflags@
V4L2_LDFLAGS = @ac_v4l2_ldflags@

# OPENH264 flags
OPENH264_CFLAGS = @ac_openh264_cflags@
OPENH264_LDFLAGS = @ac_openh264_ldflags@

# QT
AC_PJMEDIA_VIDEO_HAS_QT = @ac_pjmedia_video_has_qt@
QT_CFLAGS = @ac_qt_cflags@
Expand All @@ -150,8 +154,9 @@ IOS_CFLAGS = @ac_ios_cflags@

# PJMEDIA features exclusion
PJ_VIDEO_CFLAGS += $(SDL_CFLAGS) $(FFMPEG_CFLAGS) $(V4L2_CFLAGS) $(QT_CFLAGS) \
$(IOS_CFLAGS)
PJ_VIDEO_LDFLAGS += $(SDL_LDFLAGS) $(FFMPEG_LDFLAGS) $(V4L2_LDFLAGS)
$(OPENH264_CFLAGS) $(IOS_CFLAGS)
PJ_VIDEO_LDFLAGS += $(SDL_LDFLAGS) $(FFMPEG_LDFLAGS) $(V4L2_LDFLAGS) \
$(OPENH264_LDFLAGS)


# CFLAGS, LDFLAGS, and LIBS to be used by applications
Expand Down
2 changes: 1 addition & 1 deletion pjmedia/build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export PJSDP_LDFLAGS += $(PJMEDIA_LDLIB) \
# Defines for building PJMEDIA-Codec library
#
export PJMEDIA_CODEC_SRCDIR = ../src/pjmedia-codec
export PJMEDIA_CODEC_OBJS += audio_codecs.o ffmpeg_vid_codecs.o \
export PJMEDIA_CODEC_OBJS += audio_codecs.o ffmpeg_vid_codecs.o openh264.o \
h263_packetizer.o h264_packetizer.o \
$(OS_OBJS) $(M_OBJS) $(CC_OBJS) $(HOST_OBJS) \
ipp_codecs.o opencore_amr.o silk.o $(CODEC_OBJS) \
Expand Down
1 change: 1 addition & 0 deletions pjmedia/include/pjmedia-codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <pjmedia-codec/g7221.h>
#include <pjmedia-codec/ipp_codecs.h>
#include <pjmedia-codec/opencore_amr.h>
#include <pjmedia-codec/openh264.h>
#include <pjmedia-codec/passthrough.h>
#include <pjmedia-codec/silk.h>

Expand Down
69 changes: 69 additions & 0 deletions pjmedia/include/pjmedia-codec/openh264.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/* $Id$ */
/*
* Copyright (C) 2014 Teluu Inc. (http://www.teluu.com)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef __PJMEDIA_CODEC_OPENH264_H__
#define __PJMEDIA_CODEC_OPENH264_H__

#include <pjmedia-codec/types.h>
#include <pjmedia/vid_codec.h>

/**
* @file pjmedia-codec/openh264.h
* @brief Open H.264 codec
*/


PJ_BEGIN_DECL

/**
* @defgroup PJMEDIA_CODEC_OPENH264 Open H.264 Codec
* @ingroup PJMEDIA_CODEC_VID_CODECS
* @{
*/

/**
* Initialize and register OpenH264 codec factory.
*
* @param mgr The video codec manager instance where this codec will
* be registered to. Specify NULL to use default instance
* (in that case, an instance of video codec manager must
* have been created beforehand).
* @param pf Pool factory.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_openh264_vid_init(pjmedia_vid_codec_mgr *mgr,
pj_pool_factory *pf);

/**
* Unregister OpenH264 video codecs factory from the video codec manager and
* deinitialize the codec library.
*
* @return PJ_SUCCESS on success.
*/
PJ_DECL(pj_status_t) pjmedia_codec_openh264_vid_deinit(void);


/**
* @} PJMEDIA_CODEC_OPENH264
*/


PJ_END_DECL

#endif /* __PJMEDIA_CODEC_OPENH264_H__ */
5 changes: 5 additions & 0 deletions pjmedia/include/pjmedia/event.h
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,11 @@ typedef pj_status_t pjmedia_event_cb(pjmedia_event *event,
*/
typedef enum pjmedia_event_publish_flag
{
/**
* Default flag.
*/
PJMEDIA_EVENT_PUBLISH_DEFAULT,

/**
* Publisher will only post the event to the event manager. It is the
* event manager that will later notify all the publisher's subscribers.
Expand Down
Loading

0 comments on commit 5f23030

Please sign in to comment.