pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/www/firefox52 firefox52: This gets a sun audio too.
details: https://anonhg.NetBSD.org/pkgsrc/rev/10e0daf7d061
branches: trunk
changeset: 335159:10e0daf7d061
user: nia <nia%pkgsrc.org@localhost>
date: Fri Jun 14 08:11:34 2019 +0000
description:
firefox52: This gets a sun audio too.
Like seamonkey, this uses an older API for it, so device detection for
microphones (etc) is currently disabled.
diffstat:
www/firefox52/Makefile | 5 +-
www/firefox52/distinfo | 10 +-
www/firefox52/files/cubeb_sun.c | 767 +++++++++++++++
www/firefox52/patches/patch-aa | 17 +-
www/firefox52/patches/patch-media_libcubeb_src_cubeb.c | 28 +-
www/firefox52/patches/patch-media_libcubeb_src_moz.build | 15 +-
www/firefox52/patches/patch-media_libcubeb_update.sh | 7 +-
7 files changed, 825 insertions(+), 24 deletions(-)
diffs (truncated from 992 to 300 lines):
diff -r 625a61ebbb9e -r 10e0daf7d061 www/firefox52/Makefile
--- a/www/firefox52/Makefile Fri Jun 14 08:02:23 2019 +0000
+++ b/www/firefox52/Makefile Fri Jun 14 08:11:34 2019 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.42 2019/06/01 19:11:28 maya Exp $
+# $NetBSD: Makefile,v 1.43 2019/06/14 08:11:34 nia Exp $
FIREFOX_VER= ${MOZ_BRANCH}${MOZ_BRANCH_MINOR}
MOZ_BRANCH= 52.9
@@ -6,7 +6,7 @@
DISTNAME= firefox-${FIREFOX_VER}.source
PKGNAME= firefox${MOZ_BRANCH:C/\..*$//}-${MOZ_BRANCH}${MOZ_BRANCH_MINOR:S/b/beta/:S/esr//}
-PKGREVISION= 15
+PKGREVISION= 16
CATEGORIES= www
MASTER_SITES+= ${MASTER_SITE_MOZILLA:=firefox/releases/${FIREFOX_VER}/source/}
MASTER_SITES+= ${MASTER_SITE_MOZILLA_ALL:=firefox/releases/${FIREFOX_VER}/source/}
@@ -74,6 +74,7 @@
post-extract:
mv ${WRKSRC}/gfx/ycbcr/yuv_row_arm.s ${WRKSRC}/gfx/ycbcr/yuv_row_arm.S
+ ${CP} ${FILESDIR}/cubeb_sun.c ${WRKSRC}/media/libcubeb/src
pre-configure:
cd ${WRKSRC} && autoconf
diff -r 625a61ebbb9e -r 10e0daf7d061 www/firefox52/distinfo
--- a/www/firefox52/distinfo Fri Jun 14 08:02:23 2019 +0000
+++ b/www/firefox52/distinfo Fri Jun 14 08:11:34 2019 +0000
@@ -1,10 +1,10 @@
-$NetBSD: distinfo,v 1.20 2019/06/13 19:02:37 rjs Exp $
+$NetBSD: distinfo,v 1.21 2019/06/14 08:11:34 nia Exp $
SHA1 (firefox-52.9.0esr.source.tar.xz) = df3d47518b380fe934e32a288515c25435fd82a7
RMD160 (firefox-52.9.0esr.source.tar.xz) = 8940269f0a515c0066b6ab2eea1da8963d27617b
SHA512 (firefox-52.9.0esr.source.tar.xz) = bfca42668ca78a12a9fb56368f4aae5334b1f7a71966fbba4c32b9c5e6597aac79a6e340ac3966779d2d5563eb47c054ab33cc40bfb7306172138ccbd3adb2b9
Size (firefox-52.9.0esr.source.tar.xz) = 214087304 bytes
-SHA1 (patch-aa) = eb9368360208ba294d3d17e0c69815531aed1abf
+SHA1 (patch-aa) = 0ca132012a7005a506cdecc0167d4c7782aee244
SHA1 (patch-ao) = 8b7125ef3b193fca4d03386142887b2f8d5015c5
SHA1 (patch-as) = b596132c7b6902c4f7ddb901e28e1437b99bb428
SHA1 (patch-build_gyp.mozbuild) = 481270e6703e556fb87a3440cb3cfb3d4fcc4c86
@@ -62,12 +62,12 @@
SHA1 (patch-js_src_vm_StructuredClone.cpp) = 7e992825e996c43419318893b704a2aa380b0d2a
SHA1 (patch-js_xpconnect_src_XPCConvert.cpp) = 915777e9bb5366be41866cdb6ea0ad2b1c006dde
SHA1 (patch-js_xpconnect_src_xpcprivate.h) = e09e37819961bae40a9f276ae1ee510d2956c23e
-SHA1 (patch-media_libcubeb_src_cubeb.c) = 3be0bf511cbd3b1c691fadb081acaf38838c36f4
+SHA1 (patch-media_libcubeb_src_cubeb.c) = 24075714155e5c95fddf95ae8865a71db6006c15
SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = c59eaf40973193885f32819b465b401c1ba45fce
SHA1 (patch-media_libcubeb_src_cubeb__oss.c) = e15cc2d0c220738ccfd57f79eec242095c8ea536
-SHA1 (patch-media_libcubeb_src_moz.build) = 2b6d7e3bb265220decf9629b1d4b980cadb363fb
+SHA1 (patch-media_libcubeb_src_moz.build) = b81696b0160e151b7f52621eb7ec69c704d93507
SHA1 (patch-media_libcubeb_tests_moz.build) = 63d8b749a6ebbe8fd662ce1e2bde6aa9cb0b807d
-SHA1 (patch-media_libcubeb_update.sh) = 333e1e2898f1703a298ba2a3f731ffc63f09a184
+SHA1 (patch-media_libcubeb_update.sh) = d8f35f994f48119e20a79484e10a15ba13989936
SHA1 (patch-media_libsoundtouch_src_cpu__detect__x86.cpp) = db61737afa7773e8cbd82976de3a02c917174696
SHA1 (patch-media_libsoundtouch_src_soundtouch__perms.h) = 2d08a3b4176c155c57b458cb78043318b68d8fe2
SHA1 (patch-media_libtheora_lib_arm_armcpu.c) = 4b215277f9c81154377d401166023c1bf78a3718
diff -r 625a61ebbb9e -r 10e0daf7d061 www/firefox52/files/cubeb_sun.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/www/firefox52/files/cubeb_sun.c Fri Jun 14 08:11:34 2019 +0000
@@ -0,0 +1,767 @@
+/*
+ * Copyright © 2019 Nia Alarie
+ *
+ * This program is made available under an ISC-style license. See the
+ * accompanying file LICENSE for details.
+ */
+#include <sys/audioio.h>
+#include <sys/ioctl.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <pthread.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include "cubeb/cubeb.h"
+#include "cubeb-internal.h"
+
+#define CUBEB_OLD_API /* seamonkey and older firefox */
+
+#define BYTES_TO_FRAMES(bytes, channels) \
+ (bytes / (channels * sizeof(int16_t)))
+
+#define FRAMES_TO_BYTES(frames, channels) \
+ (frames * (channels * sizeof(int16_t)))
+
+/* Default to 4 + 1 for the default device. */
+#ifndef SUN_DEVICE_COUNT
+#define SUN_DEVICE_COUNT (5)
+#endif
+
+/* Supported well by most hardware. */
+#ifndef SUN_PREFER_RATE
+#define SUN_PREFER_RATE (48000)
+#endif
+
+/* Standard acceptable minimum. */
+#ifndef SUN_LATENCY_MS
+#define SUN_LATENCY_MS (40)
+#endif
+
+#ifndef SUN_DEFAULT_DEVICE
+#define SUN_DEFAULT_DEVICE "/dev/audio"
+#endif
+
+#ifndef SUN_POLL_TIMEOUT
+#define SUN_POLL_TIMEOUT (1000)
+#endif
+
+#ifndef SUN_BUFFER_FRAMES
+#define SUN_BUFFER_FRAMES (32)
+#endif
+
+/*
+ * Supported on NetBSD regardless of hardware.
+ */
+
+#ifndef SUN_MAX_CHANNELS
+# ifdef __NetBSD__
+# define SUN_MAX_CHANNELS (12)
+# else
+# define SUN_MAX_CHANNELS (2)
+# endif
+#endif
+
+#ifndef SUN_MIN_RATE
+#define SUN_MIN_RATE (1000)
+#endif
+
+#ifndef SUN_MAX_RATE
+#define SUN_MAX_RATE (192000)
+#endif
+
+static struct cubeb_ops const sun_ops;
+
+struct cubeb {
+ struct cubeb_ops const * ops;
+};
+
+struct cubeb_stream {
+ struct cubeb * context;
+ void * user_ptr;
+ pthread_t thread;
+ pthread_mutex_t mutex; /* protects running, volume, frames_written */
+ int floating;
+ int running;
+ int play_fd;
+ int record_fd;
+ float volume;
+ struct audio_info p_info; /* info for the play fd */
+ struct audio_info r_info; /* info for the record fd */
+ cubeb_data_callback data_cb;
+ cubeb_state_callback state_cb;
+ int16_t * play_buf;
+ int16_t * record_buf;
+ float * f_play_buf;
+ float * f_record_buf;
+ char input_name[32];
+ char output_name[32];
+ uint64_t frames_written;
+ uint64_t blocks_written;
+};
+
+int
+sun_init(cubeb ** context, char const * context_name)
+{
+ cubeb * c;
+
+ (void)context_name;
+ if ((c = calloc(1, sizeof(cubeb))) == NULL) {
+ return CUBEB_ERROR;
+ }
+ c->ops = &sun_ops;
+ *context = c;
+ return CUBEB_OK;
+}
+
+static void
+sun_destroy(cubeb * context)
+{
+ free(context);
+}
+
+static char const *
+sun_get_backend_id(cubeb * context)
+{
+ return "sun";
+}
+
+static int
+sun_get_preferred_sample_rate(cubeb * context, uint32_t * rate)
+{
+ (void)context;
+
+ *rate = SUN_PREFER_RATE;
+ return CUBEB_OK;
+}
+
+static int
+sun_get_max_channel_count(cubeb * context, uint32_t * max_channels)
+{
+ (void)context;
+
+ *max_channels = SUN_MAX_CHANNELS;
+ return CUBEB_OK;
+}
+
+static int
+sun_get_min_latency(cubeb * context, cubeb_stream_params params,
+ uint32_t * latency_frames)
+{
+ (void)context;
+
+ *latency_frames = SUN_LATENCY_MS * params.rate / 1000;
+ return CUBEB_OK;
+}
+
+static int
+sun_get_hwinfo(const char * device, struct audio_info * format,
+ int * props, struct audio_device * dev)
+{
+ int fd = -1;
+
+ if ((fd = open(device, O_RDONLY)) == -1) {
+ goto error;
+ }
+#ifdef AUDIO_GETFORMAT
+ if (ioctl(fd, AUDIO_GETFORMAT, format) != 0) {
+ goto error;
+ }
+#endif
+#ifdef AUDIO_GETPROPS
+ if (ioctl(fd, AUDIO_GETPROPS, props) != 0) {
+ goto error;
+ }
+#endif
+ if (ioctl(fd, AUDIO_GETDEV, dev) != 0) {
+ goto error;
+ }
+ close(fd);
+ return CUBEB_OK;
+error:
+ if (fd != -1) {
+ close(fd);
+ }
+ return CUBEB_ERROR;
+}
+
+/*
+ * XXX: PR kern/54264
+ */
+static int
+sun_prinfo_verify_sanity(struct audio_prinfo * prinfo)
+{
+ return prinfo->precision >= 8 && prinfo->precision <= 32 &&
+ prinfo->channels >= 1 && prinfo->channels < SUN_MAX_CHANNELS &&
+ prinfo->sample_rate < SUN_MAX_RATE && prinfo->sample_rate > SUN_MIN_RATE;
+}
+
+#ifndef CUBEB_OLD_API
+static int
+sun_enumerate_devices(cubeb * context, cubeb_device_type type,
+ cubeb_device_collection * collection)
+{
+ unsigned i;
+ cubeb_device_info device = {0};
+ char dev[16] = SUN_DEFAULT_DEVICE;
+ char dev_friendly[64];
+ struct audio_info hwfmt;
+ struct audio_device hwname;
+ struct audio_prinfo *prinfo = NULL;
+ int hwprops;
+
+ collection->device = calloc(SUN_DEVICE_COUNT, sizeof(cubeb_device_info));
+ if (collection->device == NULL) {
+ return CUBEB_ERROR;
+ }
+ collection->count = 0;
+
+ for (i = 0; i < SUN_DEVICE_COUNT; ++i) {
+ if (i > 0) {
+ (void)snprintf(dev, sizeof(dev), "/dev/audio%u", i - 1);
+ }
+ if (sun_get_hwinfo(dev, &hwfmt, &hwprops, &hwname) != CUBEB_OK) {
+ continue;
+ }
+#ifdef AUDIO_GETPROPS
+ device.type = 0;
+ if ((hwprops & AUDIO_PROP_CAPTURE) != 0 &&
+ sun_prinfo_verify_sanity(&hwfmt.record)) {
+ /* the device supports recording, probably */
+ device.type |= CUBEB_DEVICE_TYPE_INPUT;
+ }
+ if ((hwprops & AUDIO_PROP_PLAYBACK) != 0 &&
+ sun_prinfo_verify_sanity(&hwfmt.play)) {
+ /* the device supports playback, probably */
+ device.type |= CUBEB_DEVICE_TYPE_OUTPUT;
+ }
Home |
Main Index |
Thread Index |
Old Index