Index: head/mail/thunderbird/files/patch-bug826985 =================================================================== --- head/mail/thunderbird/files/patch-bug826985 (revision 380800) +++ head/mail/thunderbird/files/patch-bug826985 (revision 380801) @@ -1,166 +1,179 @@ commit 8024d93 Author: Henrik Gulbrandsen Date: Fri Jan 4 13:49:22 2013 +0100 Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux. --- + config/system-headers | 1 + configure.in | 7 +++++++ media/webrtc/signaling/test/Makefile.in | 1 + .../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++ .../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++- .../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++ toolkit/library/Makefile.in | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) +diff --git config/system-headers config/system-headers +index 55e4cd1..76567b3 100644 +--- mozilla/config/system-headers ++++ mozilla/config/system-headers +@@ -635,6 +635,7 @@ libgnomevfs/gnome-vfs-mime-handlers.h + libgnomevfs/gnome-vfs-mime-utils.h + libgnomevfs/gnome-vfs-ops.h + libgnomevfs/gnome-vfs-standard-callbacks.h ++libv4l2.h + lib$routines.h + limits + limits.h diff --git configure.in configure.in index 55e4cd1..76567b3 100644 --- mozilla/configure.in +++ mozilla/configure.in @@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then MOZ_VP8_ENCODER=1 MOZ_VP8_ERROR_CONCEALMENT=1 + dnl with libv4l2 we can support more cameras + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2) + dnl enable once Signaling lands MOZ_WEBRTC_SIGNALING=1 AC_DEFINE(MOZ_WEBRTC_SIGNALING) diff --git build/gyp.mozbuild build/gyp.mozbuild index b483cd1..f1dd1f0 100644 --- mozilla/build/gyp.mozbuild +++ mozilla/build/gyp.mozbuild @@ -11,6 +11,7 @@ gyp_vars = { 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0, 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0, 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0, + 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0, # basic stuff for everything 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in index b483cd1..f1dd1f0 100644 --- mozilla/media/webrtc/signaling/test/Makefile.in +++ mozilla/media/webrtc/signaling/test/Makefile.in @@ -7,6 +7,7 @@ LIBS = \ $(NSPR_LIBS) \ $(NSS_LIBS) \ $(REALTIME_LIBS) \ + $(MOZ_LIBV4L2_LIBS) \ $(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \ diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc index 239a292..bab496c 100644 --- mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc +++ mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -25,10 +25,21 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include "webrtc/system_wrappers/interface/ref_count.h" #include "webrtc/system_wrappers/interface/trace.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif namespace webrtc { @@ -130,6 +142,11 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName( memset(deviceNameUTF8, 0, deviceNameLength); memcpy(cameraName, cap.card, sizeof(cap.card)); + if (cameraName[0] == '\0') + { + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber); + } + if (deviceNameLength >= strlen(cameraName)) { memcpy(deviceNameUTF8, cameraName, strlen(cameraName)); diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc index 12df1b3..e9863ba 100644 --- mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -25,6 +25,9 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include @@ -26,6 +31,15 @@ #include "critical_section_wrapper.h" #include "video_capture_linux.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi index d46b5aa..e452223 100644 --- mozilla/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi +++ mozilla/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi @@ -7,6 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. { + 'variables': { + 'use_libv4l2%': 0, + }, 'targets': [ { 'target_name': 'video_capture_module', @@ -49,6 +52,16 @@ }, { # include_internal_video_capture == 1 'conditions': [ ['include_v4l2_video_capture==1', { + 'conditions': [ + ['use_libv4l2==1', { + 'defines': [ + 'HAVE_LIBV4L2', + ], + 'libraries': [ + '-lv4l2', + ], + }], + ], 'include_dirs': [ 'linux', ], diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in index 9c16ffa..1db3794 100644 --- mozilla/toolkit/library/libxul.mk +++ mozilla/toolkit/library/libxul.mk @@ -182,6 +182,10 @@ endif EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib) +ifdef MOZ_LIBV4L2_LIBS +EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS) +endif + ifdef MOZ_WEBRTC ifeq (WINNT,$(OS_TARGET)) EXTRA_DSO_LDOPTS += \ Index: head/www/firefox/files/patch-bug826985 =================================================================== --- head/www/firefox/files/patch-bug826985 (revision 380800) +++ head/www/firefox/files/patch-bug826985 (revision 380801) @@ -1,166 +1,179 @@ commit 8024d93 Author: Henrik Gulbrandsen Date: Fri Jan 4 13:49:22 2013 +0100 Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux. --- + config/system-headers | 1 + configure.in | 7 +++++++ media/webrtc/signaling/test/Makefile.in | 1 + .../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++ .../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++- .../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++ toolkit/library/Makefile.in | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) +diff --git config/system-headers config/system-headers +index 55e4cd1..76567b3 100644 +--- config/system-headers ++++ config/system-headers +@@ -635,6 +635,7 @@ libgnomevfs/gnome-vfs-mime-handlers.h + libgnomevfs/gnome-vfs-mime-utils.h + libgnomevfs/gnome-vfs-ops.h + libgnomevfs/gnome-vfs-standard-callbacks.h ++libv4l2.h + lib$routines.h + limits + limits.h diff --git configure.in configure.in index 55e4cd1..76567b3 100644 --- configure.in +++ configure.in @@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then MOZ_VP8_ENCODER=1 MOZ_VP8_ERROR_CONCEALMENT=1 + dnl with libv4l2 we can support more cameras + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2) + dnl enable once Signaling lands MOZ_WEBRTC_SIGNALING=1 AC_DEFINE(MOZ_WEBRTC_SIGNALING) diff --git build/gyp.mozbuild build/gyp.mozbuild index b483cd1..f1dd1f0 100644 --- build/gyp.mozbuild +++ build/gyp.mozbuild @@ -11,6 +11,7 @@ gyp_vars = { 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0, 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0, 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0, + 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0, # basic stuff for everything 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, diff --git media/webrtc/signaling/test/moz.build media/webrtc/signaling/test/moz.build index b483cd1..f1dd1f0 100644 --- media/webrtc/signaling/test/moz.build +++ media/webrtc/signaling/test/moz.build @@ -122,6 +122,7 @@ if CONFIG['JS_SHARED_LIBRARY']: 'js', ] +OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS'] OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] OS_LIBS += CONFIG['REALTIME_LIBS'] diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc index 239a292..bab496c 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -25,10 +25,21 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include "webrtc/system_wrappers/interface/ref_count.h" #include "webrtc/system_wrappers/interface/trace.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif namespace webrtc { @@ -130,6 +142,11 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName( memset(deviceNameUTF8, 0, deviceNameLength); memcpy(cameraName, cap.card, sizeof(cap.card)); + if (cameraName[0] == '\0') + { + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber); + } + if (deviceNameLength >= strlen(cameraName)) { memcpy(deviceNameUTF8, cameraName, strlen(cameraName)); diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc index 12df1b3..e9863ba 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -25,6 +25,9 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include @@ -26,6 +31,15 @@ #include "critical_section_wrapper.h" #include "video_capture_linux.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi index d46b5aa..e452223 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi +++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi @@ -7,6 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. { + 'variables': { + 'use_libv4l2%': 0, + }, 'targets': [ { 'target_name': 'video_capture_module', @@ -46,6 +49,19 @@ 'linux/video_capture_linux.cc', 'linux/video_capture_linux.h', ], + 'conditions': [ + ['use_libv4l2==1', { + 'defines': [ + 'HAVE_LIBV4L2', + ], + 'cflags_mozilla': [ + '$(MOZ_LIBV4L2_CFLAGS)', + ], + 'libraries': [ + '-lv4l2', + ], + }], + ], }], # linux ['OS=="mac"', { 'sources': [ diff --git toolkit/library/moz.build toolkit/library/moz.build index 9c16ffa..1db3794 100644 --- toolkit/library/moz.build +++ toolkit/library/moz.build @@ -163,6 +163,7 @@ if CONFIG['OS_ARCH'] == 'Linux' and CONF ] OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS'] +OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS'] OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] OS_LIBS += CONFIG['MOZ_APP_EXTRA_LIBS'] Index: head/www/firefox-esr/files/patch-bug826985 =================================================================== --- head/www/firefox-esr/files/patch-bug826985 (revision 380800) +++ head/www/firefox-esr/files/patch-bug826985 (revision 380801) @@ -1,166 +1,179 @@ commit 8024d93 Author: Henrik Gulbrandsen Date: Fri Jan 4 13:49:22 2013 +0100 Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux. --- + config/system-headers | 1 + configure.in | 7 +++++++ media/webrtc/signaling/test/Makefile.in | 1 + .../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++ .../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++- .../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++ toolkit/library/Makefile.in | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) +diff --git config/system-headers config/system-headers +index 55e4cd1..76567b3 100644 +--- config/system-headers ++++ config/system-headers +@@ -635,6 +635,7 @@ libgnomevfs/gnome-vfs-mime-handlers.h + libgnomevfs/gnome-vfs-mime-utils.h + libgnomevfs/gnome-vfs-ops.h + libgnomevfs/gnome-vfs-standard-callbacks.h ++libv4l2.h + lib$routines.h + limits + limits.h diff --git configure.in configure.in index 55e4cd1..76567b3 100644 --- configure.in +++ configure.in @@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then MOZ_VP8_ENCODER=1 MOZ_VP8_ERROR_CONCEALMENT=1 + dnl with libv4l2 we can support more cameras + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2) + dnl enable once Signaling lands MOZ_WEBRTC_SIGNALING=1 AC_DEFINE(MOZ_WEBRTC_SIGNALING) diff --git build/gyp.mozbuild build/gyp.mozbuild index b483cd1..f1dd1f0 100644 --- build/gyp.mozbuild +++ build/gyp.mozbuild @@ -11,6 +11,7 @@ gyp_vars = { 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0, 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0, 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0, + 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0, # basic stuff for everything 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in index b483cd1..f1dd1f0 100644 --- media/webrtc/signaling/test/Makefile.in +++ media/webrtc/signaling/test/Makefile.in @@ -7,6 +7,7 @@ LIBS = \ $(NSPR_LIBS) \ $(NSS_LIBS) \ $(REALTIME_LIBS) \ + $(MOZ_LIBV4L2_LIBS) \ $(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \ diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc index 239a292..bab496c 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -25,10 +25,21 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include "webrtc/system_wrappers/interface/ref_count.h" #include "webrtc/system_wrappers/interface/trace.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif namespace webrtc { @@ -130,6 +142,11 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName( memset(deviceNameUTF8, 0, deviceNameLength); memcpy(cameraName, cap.card, sizeof(cap.card)); + if (cameraName[0] == '\0') + { + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber); + } + if (deviceNameLength >= strlen(cameraName)) { memcpy(deviceNameUTF8, cameraName, strlen(cameraName)); diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc index 12df1b3..e9863ba 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -25,6 +25,9 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include @@ -26,6 +31,15 @@ #include "critical_section_wrapper.h" #include "video_capture_linux.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi index d46b5aa..e452223 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi +++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi @@ -7,6 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. { + 'variables': { + 'use_libv4l2%': 0, + }, 'targets': [ { 'target_name': 'video_capture_module', @@ -49,6 +52,16 @@ }, { # include_internal_video_capture == 1 'conditions': [ ['include_v4l2_video_capture==1', { + 'conditions': [ + ['use_libv4l2==1', { + 'defines': [ + 'HAVE_LIBV4L2', + ], + 'libraries': [ + '-lv4l2', + ], + }], + ], 'include_dirs': [ 'linux', ], diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in index 9c16ffa..1db3794 100644 --- toolkit/library/libxul.mk +++ toolkit/library/libxul.mk @@ -182,6 +182,10 @@ endif EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib) +ifdef MOZ_LIBV4L2_LIBS +EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS) +endif + ifdef MOZ_WEBRTC ifeq (WINNT,$(OS_TARGET)) EXTRA_DSO_LDOPTS += \ Index: head/www/libxul/files/patch-bug826985 =================================================================== --- head/www/libxul/files/patch-bug826985 (revision 380800) +++ head/www/libxul/files/patch-bug826985 (revision 380801) @@ -1,166 +1,179 @@ commit 8024d93 Author: Henrik Gulbrandsen Date: Fri Jan 4 13:49:22 2013 +0100 Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux. --- + config/system-headers | 1 + configure.in | 7 +++++++ media/webrtc/signaling/test/Makefile.in | 1 + .../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++ .../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++- .../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++ toolkit/library/Makefile.in | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) +diff --git config/system-headers config/system-headers +index 55e4cd1..76567b3 100644 +--- config/system-headers ++++ config/system-headers +@@ -635,6 +635,7 @@ libgnomevfs/gnome-vfs-mime-handlers.h + libgnomevfs/gnome-vfs-mime-utils.h + libgnomevfs/gnome-vfs-ops.h + libgnomevfs/gnome-vfs-standard-callbacks.h ++libv4l2.h + lib$routines.h + limits + limits.h diff --git configure.in configure.in index 55e4cd1..76567b3 100644 --- configure.in +++ configure.in @@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then MOZ_VP8_ENCODER=1 MOZ_VP8_ERROR_CONCEALMENT=1 + dnl with libv4l2 we can support more cameras + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2) + dnl enable once Signaling lands MOZ_WEBRTC_SIGNALING=1 AC_DEFINE(MOZ_WEBRTC_SIGNALING) diff --git build/gyp.mozbuild build/gyp.mozbuild index b483cd1..f1dd1f0 100644 --- build/gyp.mozbuild +++ build/gyp.mozbuild @@ -11,6 +11,7 @@ gyp_vars = { 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0, 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0, 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0, + 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0, # basic stuff for everything 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, diff --git media/webrtc/signaling/test/Makefile.in media/webrtc/signaling/test/Makefile.in index b483cd1..f1dd1f0 100644 --- media/webrtc/signaling/test/Makefile.in +++ media/webrtc/signaling/test/Makefile.in @@ -7,6 +7,7 @@ LIBS = \ $(NSPR_LIBS) \ $(NSS_LIBS) \ $(REALTIME_LIBS) \ + $(MOZ_LIBV4L2_LIBS) \ $(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \ diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc index 239a292..bab496c 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -25,10 +25,21 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include "webrtc/system_wrappers/interface/ref_count.h" #include "webrtc/system_wrappers/interface/trace.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif namespace webrtc { @@ -130,6 +142,11 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName( memset(deviceNameUTF8, 0, deviceNameLength); memcpy(cameraName, cap.card, sizeof(cap.card)); + if (cameraName[0] == '\0') + { + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber); + } + if (deviceNameLength >= strlen(cameraName)) { memcpy(deviceNameUTF8, cameraName, strlen(cameraName)); diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc index 12df1b3..e9863ba 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -25,6 +25,9 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include @@ -26,6 +31,15 @@ #include "critical_section_wrapper.h" #include "video_capture_linux.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi index d46b5aa..e452223 100644 --- media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi +++ media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi @@ -7,6 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. { + 'variables': { + 'use_libv4l2%': 0, + }, 'targets': [ { 'target_name': 'video_capture_module', @@ -49,6 +52,16 @@ }, { # include_internal_video_capture == 1 'conditions': [ ['include_v4l2_video_capture==1', { + 'conditions': [ + ['use_libv4l2==1', { + 'defines': [ + 'HAVE_LIBV4L2', + ], + 'libraries': [ + '-lv4l2', + ], + }], + ], 'include_dirs': [ 'linux', ], diff --git toolkit/library/Makefile.in toolkit/library/Makefile.in index 9c16ffa..1db3794 100644 --- toolkit/library/libxul.mk +++ toolkit/library/libxul.mk @@ -182,6 +182,10 @@ endif EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib) +ifdef MOZ_LIBV4L2_LIBS +EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS) +endif + ifdef MOZ_WEBRTC ifeq (WINNT,$(OS_TARGET)) EXTRA_DSO_LDOPTS += \ Index: head/www/seamonkey/files/patch-bug826985 =================================================================== --- head/www/seamonkey/files/patch-bug826985 (revision 380800) +++ head/www/seamonkey/files/patch-bug826985 (revision 380801) @@ -1,166 +1,179 @@ commit 8024d93 Author: Henrik Gulbrandsen Date: Fri Jan 4 13:49:22 2013 +0100 Bug 826985 - Support more video formats for WebRTC via libv4l2 on Linux. --- + config/system-headers | 1 + configure.in | 7 +++++++ media/webrtc/signaling/test/Makefile.in | 1 + .../modules/video_capture/linux/device_info_linux.cc | 17 +++++++++++++++++ .../modules/video_capture/linux/video_capture_linux.cc | 16 +++++++++++++++- .../webrtc/modules/video_capture/video_capture.gypi | 11 +++++++++++ toolkit/library/Makefile.in | 1 + 6 files changed, 52 insertions(+), 1 deletion(-) +diff --git config/system-headers config/system-headers +index 55e4cd1..76567b3 100644 +--- mozilla/config/system-headers ++++ mozilla/config/system-headers +@@ -635,6 +635,7 @@ libgnomevfs/gnome-vfs-mime-handlers.h + libgnomevfs/gnome-vfs-mime-utils.h + libgnomevfs/gnome-vfs-ops.h + libgnomevfs/gnome-vfs-standard-callbacks.h ++libv4l2.h + lib$routines.h + limits + limits.h diff --git configure.in configure.in index 55e4cd1..76567b3 100644 --- mozilla/configure.in +++ mozilla/configure.in @@ -5309,6 +5309,9 @@ if test -n "$MOZ_WEBRTC"; then MOZ_VP8_ENCODER=1 MOZ_VP8_ERROR_CONCEALMENT=1 + dnl with libv4l2 we can support more cameras + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2) + dnl enable once Signaling lands MOZ_WEBRTC_SIGNALING=1 AC_DEFINE(MOZ_WEBRTC_SIGNALING) diff --git build/gyp.mozbuild build/gyp.mozbuild index b483cd1..f1dd1f0 100644 --- mozilla/build/gyp.mozbuild +++ mozilla/build/gyp.mozbuild @@ -11,6 +11,7 @@ gyp_vars = { 'have_ethtool_cmd_speed_hi': 1 if CONFIG['MOZ_WEBRTC_HAVE_ETHTOOL_SPEED_HI'] else 0, 'include_alsa_audio': 1 if CONFIG['MOZ_ALSA'] else 0, 'include_pulse_audio': 1 if CONFIG['MOZ_PULSEAUDIO'] else 0, + 'use_libv4l2': 1 if CONFIG['MOZ_LIBV4L2_LIBS'] else 0, # basic stuff for everything 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, diff --git media/webrtc/signaling/test/moz.build media/webrtc/signaling/test/moz.build index b483cd1..f1dd1f0 100644 --- mozilla/media/webrtc/signaling/test/moz.build +++ mozilla/media/webrtc/signaling/test/moz.build @@ -122,6 +122,7 @@ if CONFIG['JS_SHARED_LIBRARY']: 'js', ] +OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS'] OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] OS_LIBS += CONFIG['REALTIME_LIBS'] diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc index 239a292..bab496c 100644 --- mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc +++ mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -25,10 +25,21 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include "webrtc/system_wrappers/interface/ref_count.h" #include "webrtc/system_wrappers/interface/trace.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif namespace webrtc { @@ -130,6 +142,11 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName( memset(deviceNameUTF8, 0, deviceNameLength); memcpy(cameraName, cap.card, sizeof(cap.card)); + if (cameraName[0] == '\0') + { + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber); + } + if (deviceNameLength >= strlen(cameraName)) { memcpy(deviceNameUTF8, cameraName, strlen(cameraName)); diff --git media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc index 12df1b3..e9863ba 100644 --- mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ mozilla/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -25,6 +25,9 @@ #else #include #endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include @@ -26,6 +31,15 @@ #include "critical_section_wrapper.h" #include "video_capture_linux.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule diff --git media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi index d46b5aa..e452223 100644 --- mozilla/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi +++ mozilla/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi @@ -7,6 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. { + 'variables': { + 'use_libv4l2%': 0, + }, 'targets': [ { 'target_name': 'video_capture_module', @@ -46,6 +49,19 @@ 'linux/video_capture_linux.cc', 'linux/video_capture_linux.h', ], + 'conditions': [ + ['use_libv4l2==1', { + 'defines': [ + 'HAVE_LIBV4L2', + ], + 'cflags_mozilla': [ + '$(MOZ_LIBV4L2_CFLAGS)', + ], + 'libraries': [ + '-lv4l2', + ], + }], + ], }], # linux ['OS=="mac"', { 'sources': [ diff --git toolkit/library/moz.build toolkit/library/moz.build index 9c16ffa..1db3794 100644 --- mozilla/toolkit/library/moz.build +++ mozilla/toolkit/library/moz.build @@ -163,6 +163,7 @@ if CONFIG['OS_ARCH'] == 'Linux' and CONF ] OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS'] +OS_LIBS += CONFIG['MOZ_LIBV4L2_LIBS'] OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS'] OS_LIBS += CONFIG['MOZ_APP_EXTRA_LIBS']