pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/www/seamonkey



Module Name:    pkgsrc
Committed By:   nia
Date:           Thu May  7 19:36:53 UTC 2020

Modified Files:
        pkgsrc/www/seamonkey: Makefile distinfo options.mk
        pkgsrc/www/seamonkey/files: cubeb_sun.c
        pkgsrc/www/seamonkey/patches:
            patch-mozilla_media_libcubeb_src_cubeb__alsa.c
            patch-mozilla_old-configure.in
Added Files:
        pkgsrc/www/seamonkey/patches: patch-mozilla_media_libcubeb_src_cubeb.c
            patch-mozilla_media_libcubeb_src_moz.build
            patch-mozilla_media_libcubeb_update.sh

Log Message:
seamonkey: Restore lost sun audio patches.


To generate a diff of this commit:
cvs rdiff -u -r1.208 -r1.209 pkgsrc/www/seamonkey/Makefile
cvs rdiff -u -r1.162 -r1.163 pkgsrc/www/seamonkey/distinfo
cvs rdiff -u -r1.44 -r1.45 pkgsrc/www/seamonkey/options.mk
cvs rdiff -u -r1.3 -r1.4 pkgsrc/www/seamonkey/files/cubeb_sun.c
cvs rdiff -u -r0 -r1.6 \
    pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb.c
cvs rdiff -u -r1.11 -r1.12 \
    pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb__alsa.c
cvs rdiff -u -r0 -r1.10 \
    pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_moz.build
cvs rdiff -u -r0 -r1.4 \
    pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_update.sh
cvs rdiff -u -r1.6 -r1.7 \
    pkgsrc/www/seamonkey/patches/patch-mozilla_old-configure.in

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/www/seamonkey/Makefile
diff -u pkgsrc/www/seamonkey/Makefile:1.208 pkgsrc/www/seamonkey/Makefile:1.209
--- pkgsrc/www/seamonkey/Makefile:1.208 Wed May  6 14:34:52 2020
+++ pkgsrc/www/seamonkey/Makefile       Thu May  7 19:36:52 2020
@@ -1,7 +1,8 @@
-# $NetBSD: Makefile,v 1.208 2020/05/06 14:34:52 ryoon Exp $
+# $NetBSD: Makefile,v 1.209 2020/05/07 19:36:52 nia Exp $
 
 DISTNAME=      seamonkey-${SM_VER}.source
 PKGNAME=       seamonkey-${SM_VER:S/b/beta/}
+PKGREVISION=   1
 SM_VER=                2.53.2
 CATEGORIES=    www
 MASTER_SITES=  ${MASTER_SITE_MOZILLA:=seamonkey/releases/${SM_VER}/source/}

Index: pkgsrc/www/seamonkey/distinfo
diff -u pkgsrc/www/seamonkey/distinfo:1.162 pkgsrc/www/seamonkey/distinfo:1.163
--- pkgsrc/www/seamonkey/distinfo:1.162 Wed May  6 14:34:52 2020
+++ pkgsrc/www/seamonkey/distinfo       Thu May  7 19:36:52 2020
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.162 2020/05/06 14:34:52 ryoon Exp $
+$NetBSD: distinfo,v 1.163 2020/05/07 19:36:52 nia Exp $
 
 SHA1 (seamonkey-2.53.2.source.tar.xz) = 7c6e3295a751aa36c8325e20ef1367d0fb643120
 RMD160 (seamonkey-2.53.2.source.tar.xz) = 567c8bd64166e5854c712f2c2d6ca0dea182c75b
@@ -20,12 +20,15 @@ SHA1 (patch-mozilla_ipc_glue_CrossProces
 SHA1 (patch-mozilla_ipc_glue_GeckoChildProcessHost.cpp) = 7ab1c1701344adab8d7ee0332476a864fa2446bb
 SHA1 (patch-mozilla_js_src_gc_Memory.cpp) = 0850c9d57794c037ee5ab6b3d52319f4ec34c72c
 SHA1 (patch-mozilla_js_src_threading_posix_Thread.cpp) = a22611b1329d38c1a56988be2f84aba71c431506
-SHA1 (patch-mozilla_media_libcubeb_src_cubeb__alsa.c) = 38da2528c83553a43676d300547db060ec25be25
+SHA1 (patch-mozilla_media_libcubeb_src_cubeb.c) = 85e03895737f47dfb373a46bb2992e36fc78728f
+SHA1 (patch-mozilla_media_libcubeb_src_cubeb__alsa.c) = 5931c3293ec6130776f146a6a962ebe86aba39a4
+SHA1 (patch-mozilla_media_libcubeb_src_moz.build) = ca2c76fc54a62323db0e66386a99a996cd7aaef0
+SHA1 (patch-mozilla_media_libcubeb_update.sh) = a1632da23a4752e6cc805f2af9243d152896cc3f
 SHA1 (patch-mozilla_media_libpng_pngpriv.h) = 731061bf32caa61e586a7a7fe86f1393a6520731
 SHA1 (patch-mozilla_modules_pdfium_update.sh) = a09e806625e97c623697667b4c086d309da40dac
 SHA1 (patch-mozilla_netwerk_srtp_src_crypto_hash_hmac.c) = eb07566cd98d4bbab3fd020815e72b17fbed324a
 SHA1 (patch-mozilla_netwerk_srtp_src_crypto_kernel_crypto__kernel.c) = e3974859577a7437e32e37995149c938be8d9ff3
-SHA1 (patch-mozilla_old-configure.in) = e0b626092fae9fcdd021e08bc6363888e047ca2c
+SHA1 (patch-mozilla_old-configure.in) = 5c711b031a2acee9ab4cf803769179de4fff0ea7
 SHA1 (patch-mozilla_servo_components_style_build__gecko.rs) = 473e823fa0cd819dfee1040d360eda543d5557f0
 SHA1 (patch-mozilla_toolkit_components_terminator_nsTerminator.cpp) = 0d975e4b7e3d2a8550c16a9a87c2f7011917cddd
 SHA1 (patch-mozilla_toolkit_library_moz.build) = 51d4b94077a12b136ddc4bd6093336de98f3219e

Index: pkgsrc/www/seamonkey/options.mk
diff -u pkgsrc/www/seamonkey/options.mk:1.44 pkgsrc/www/seamonkey/options.mk:1.45
--- pkgsrc/www/seamonkey/options.mk:1.44        Wed May  6 14:34:52 2020
+++ pkgsrc/www/seamonkey/options.mk     Thu May  7 19:36:52 2020
@@ -1,4 +1,4 @@
-# $NetBSD: options.mk,v 1.44 2020/05/06 14:34:52 ryoon Exp $
+# $NetBSD: options.mk,v 1.45 2020/05/07 19:36:52 nia Exp $
 
 PKG_OPTIONS_VAR=       PKG_OPTIONS.seamonkey
 
@@ -6,12 +6,12 @@ PKG_SUPPORTED_OPTIONS=        official-mozilla-
 PKG_SUPPORTED_OPTIONS+=        debug debug-info mozilla-jemalloc webrtc
 PKG_SUPPORTED_OPTIONS+=        alsa pulseaudio dbus
 PKG_SUPPORTED_OPTIONS+=        widevinecdm
-PLIST_VARS+=           gnome jemalloc debug
+PLIST_VARS+=           jemalloc debug
 
 .if ${OPSYS} == "Linux"
-PKG_SUGGESTED_OPTIONS+=        pulseaudio mozilla-jemalloc dbus
+PKG_SUGGESTED_OPTIONS+=        alsa pulseaudio mozilla-jemalloc dbus
 .else
-PKG_SUGGESTED_OPTIONS+=        alsa dbus
+PKG_SUGGESTED_OPTIONS+=        dbus
 .endif
 
 PKG_SUGGESTED_OPTIONS.Linux+=  webrtc

Index: pkgsrc/www/seamonkey/files/cubeb_sun.c
diff -u pkgsrc/www/seamonkey/files/cubeb_sun.c:1.3 pkgsrc/www/seamonkey/files/cubeb_sun.c:1.4
--- pkgsrc/www/seamonkey/files/cubeb_sun.c:1.3  Fri Jun 14 13:26:18 2019
+++ pkgsrc/www/seamonkey/files/cubeb_sun.c      Thu May  7 19:36:53 2020
@@ -1,5 +1,5 @@
 /*
- * Copyright © 2019 Nia Alarie
+ * Copyright © 2019-2020 Nia Alarie <nia%NetBSD.org@localhost>
  *
  * This program is made available under an ISC-style license.  See the
  * accompanying file LICENSE for details.
@@ -9,21 +9,14 @@
 #include <fcntl.h>
 #include <unistd.h>
 #include <pthread.h>
+#include <stdbool.h>
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <math.h>
+#include <limits.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)
@@ -43,10 +36,6 @@
 #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
@@ -77,26 +66,26 @@ struct cubeb {
   struct cubeb_ops const * ops;
 };
 
+struct sun_stream {
+  char name[32];
+  int fd;
+  void * buf;
+  struct audio_info info;
+  unsigned frame_size; /* precision in bytes * channels */
+  bool floating;
+};
+
 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;
+  bool running;
   float volume;
-  struct audio_info p_info; /* info for the play fd */
-  struct audio_info r_info; /* info for the record fd */
+  struct sun_stream play;
+  struct sun_stream record;
   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;
 };
@@ -197,7 +186,6 @@ sun_prinfo_verify_sanity(struct audio_pr
      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)
@@ -292,9 +280,7 @@ sun_enumerate_devices(cubeb * context, c
   }
   return CUBEB_OK;
 }
-#endif
 
-#ifndef CUBEB_OLD_API
 static int
 sun_device_collection_destroy(cubeb * context,
                               cubeb_device_collection * collection)
@@ -310,7 +296,6 @@ sun_device_collection_destroy(cubeb * co
   free(collection->device);
   return CUBEB_OK;
 }
-#endif
 
 static int
 sun_copy_params(int fd, cubeb_stream * stream, cubeb_stream_params * params,
@@ -318,18 +303,19 @@ sun_copy_params(int fd, cubeb_stream * s
 {
   prinfo->channels = params->channels;
   prinfo->sample_rate = params->rate;
-  prinfo->precision = 16;
 #ifdef AUDIO_ENCODING_SLINEAR_LE
   switch (params->format) {
   case CUBEB_SAMPLE_S16LE:
     prinfo->encoding = AUDIO_ENCODING_SLINEAR_LE;
+    prinfo->precision = 16;
     break;
   case CUBEB_SAMPLE_S16BE:
     prinfo->encoding = AUDIO_ENCODING_SLINEAR_BE;
+    prinfo->precision = 16;
     break;
   case CUBEB_SAMPLE_FLOAT32NE:
-    stream->floating = 1;
     prinfo->encoding = AUDIO_ENCODING_SLINEAR;
+    prinfo->precision = 32;
     break;
   default:
     LOG("Unsupported format");
@@ -339,10 +325,11 @@ sun_copy_params(int fd, cubeb_stream * s
   switch (params->format) {
   case CUBEB_SAMPLE_S16NE:
     prinfo->encoding = AUDIO_ENCODING_LINEAR;
+    prinfo->precision = 16;
     break;
   case CUBEB_SAMPLE_FLOAT32NE:
-    stream->floating = 1;
     prinfo->encoding = AUDIO_ENCODING_LINEAR;
+    prinfo->precision = 32;
     break;
   default:
     LOG("Unsupported format");
@@ -363,7 +350,7 @@ sun_stream_stop(cubeb_stream * s)
 {
   pthread_mutex_lock(&s->mutex);
   if (s->running) {
-    s->running = 0;
+    s->running = false;
     pthread_mutex_unlock(&s->mutex);
     pthread_join(s->thread, NULL);
   } else {
@@ -377,53 +364,50 @@ sun_stream_destroy(cubeb_stream * s)
 {
   pthread_mutex_destroy(&s->mutex);
   sun_stream_stop(s);
-  if (s->play_fd != -1) {
-    close(s->play_fd);
+  if (s->play.fd != -1) {
+    close(s->play.fd);
   }
-  if (s->record_fd != -1) {
-    close(s->record_fd);
+  if (s->record.fd != -1) {
+    close(s->record.fd);
   }
-  free(s->f_play_buf);
-  free(s->f_record_buf);
-  free(s->play_buf);
-  free(s->record_buf);
+  free(s->play.buf);
+  free(s->record.buf);
   free(s);
 }
 
 static void
-sun_float_to_linear(float * in, int16_t * out,
-                    unsigned channels, long frames, float vol)
+sun_float_to_linear32(void * buf, unsigned sample_count, float vol)
 {
-  unsigned i, sample_count = frames * channels;
-  float multiplier = vol * 0x8000;
-
-  for (i = 0; i < sample_count; ++i) {
-    int32_t sample = lrintf(in[i] * multiplier);
-    if (sample < -0x8000) {
-      out[i] = -0x8000;
-    } else if (sample > 0x7fff) {
-      out[i] = 0x7fff;
-    } else {
-      out[i] = sample;
-    }
+  float * in = buf;
+  int32_t * out = buf;
+  int32_t * tail = out + sample_count;
+
+  while (out < tail) {
+    float f = *(in++) * vol;
+    if (f < -1.0)
+      f = -1.0;
+    else if (f > 1.0)
+      f = 1.0;
+    *(out++) = f * (float)INT32_MAX;
   }
 }
 
 static void
-sun_linear_to_float(int16_t * in, float * out,
-                    unsigned channels, long frames)
+sun_linear32_to_float(void * buf, unsigned sample_count) 
 {
-  unsigned i, sample_count = frames * channels;
+  int32_t * in = buf;
+  float * out = buf;
+  float * tail = out + sample_count;
 
-  for (i = 0; i < sample_count; ++i) {
-    out[i] = (1.0 / 0x8000) * in[i];
+  while (out < tail) {
+    *(out++) = (1.0 / 0x80000000) * *(in++);
   }
 }
 
 static void
-sun_linear_set_vol(int16_t * buf, unsigned channels, long frames, float vol)
+sun_linear16_set_vol(int16_t * buf, unsigned sample_count, float vol)
 {
-  unsigned i, sample_count = frames * channels;
+  unsigned i;
   int32_t multiplier = vol * 0x8000;
 
   for (i = 0; i < sample_count; ++i) {
@@ -451,41 +435,36 @@ sun_io_routine(void * arg)
       break;
     }
     pthread_mutex_unlock(&s->mutex);
-    if (s->floating) {
-      if (s->record_fd != -1) {
-        sun_linear_to_float(s->record_buf, s->f_record_buf,
-                            s->r_info.record.channels, SUN_BUFFER_FRAMES);
-      }
-      to_write = s->data_cb(s, s->user_ptr,
-                            s->f_record_buf, s->f_play_buf, SUN_BUFFER_FRAMES);
-      if (to_write == CUBEB_ERROR) {
-        state = CUBEB_STATE_ERROR;
-        break;
-      }
-      if (s->play_fd != -1) {
-        pthread_mutex_lock(&s->mutex);
-        sun_float_to_linear(s->f_play_buf, s->play_buf,
-                            s->p_info.play.channels, to_write, s->volume);
-        pthread_mutex_unlock(&s->mutex);
-      }
-    } else {
-      to_write = s->data_cb(s, s->user_ptr,
-                            s->record_buf, s->play_buf, SUN_BUFFER_FRAMES);
-      if (to_write == CUBEB_ERROR) {
-        state = CUBEB_STATE_ERROR;
-        break;
-      }
-      if (s->play_fd != -1) {
-        pthread_mutex_lock(&s->mutex);
-        sun_linear_set_vol(s->play_buf, s->p_info.play.channels, to_write, s->volume);
-        pthread_mutex_unlock(&s->mutex);
+    if (s->record.fd != -1 && s->record.floating) {
+      sun_linear32_to_float(s->record.buf,
+                            s->record.info.record.channels * SUN_BUFFER_FRAMES);
+    }
+    to_write = s->data_cb(s, s->user_ptr,
+                          s->record.buf, s->play.buf, SUN_BUFFER_FRAMES);
+    if (to_write == CUBEB_ERROR) {
+      state = CUBEB_STATE_ERROR;
+      break;
+    }
+    if (s->play.fd != -1) {
+      float vol;
+
+      pthread_mutex_lock(&s->mutex);
+      vol = s->volume;
+      pthread_mutex_unlock(&s->mutex);
+
+      if (s->play.floating) {
+        sun_float_to_linear32(s->play.buf,
+                              s->play.info.play.channels * to_write, vol);
+      } else {
+        sun_linear16_set_vol(s->play.buf,
+                             s->play.info.play.channels * to_write, vol);
       }
     }
     if (to_write < SUN_BUFFER_FRAMES) {
       drain = 1;
     }
-    to_write = s->play_fd != -1 ? to_write : 0;
-    to_read = s->record_fd != -1 ? SUN_BUFFER_FRAMES : 0;
+    to_write = s->play.fd != -1 ? to_write : 0;
+    to_read = s->record.fd != -1 ? SUN_BUFFER_FRAMES : 0;
     write_ofs = 0;
     read_ofs = 0;
     while (to_write > 0 || to_read > 0) {
@@ -493,27 +472,27 @@ sun_io_routine(void * arg)
       ssize_t n, frames;
 
       if (to_write > 0) {
-        bytes = FRAMES_TO_BYTES(to_write, s->p_info.play.channels);
-        if ((n = write(s->play_fd, s->play_buf + write_ofs, bytes)) < 0) {
+        bytes = to_write * s->play.frame_size;
+        if ((n = write(s->play.fd, (uint8_t *)s->play.buf + write_ofs, bytes)) < 0) {
           state = CUBEB_STATE_ERROR;
           break;
         }
-        frames = BYTES_TO_FRAMES(n, s->p_info.play.channels);
+        frames = n / s->play.frame_size;
         pthread_mutex_lock(&s->mutex);
         s->frames_written += frames;
         pthread_mutex_unlock(&s->mutex);
         to_write -= frames;
-        write_ofs += frames;
+        write_ofs += n;
       }
       if (to_read > 0) {
-        bytes = FRAMES_TO_BYTES(to_read, s->r_info.record.channels);
-        if ((n = read(s->record_fd, s->record_buf + read_ofs, bytes)) < 0) {
+        bytes = to_read * s->record.frame_size;
+        if ((n = read(s->record.fd, (uint8_t *)s->record.buf + read_ofs, bytes)) < 0) {
           state = CUBEB_STATE_ERROR;
           break;
         }
-        frames = BYTES_TO_FRAMES(n, s->r_info.record.channels);
+        frames = n / s->record.frame_size;
         to_read -= frames;
-        read_ofs += frames;
+        read_ofs += n;
       }
     }
     if (drain && state != CUBEB_STATE_ERROR) {
@@ -547,69 +526,71 @@ sun_stream_init(cubeb * context,
     ret = CUBEB_ERROR;
     goto error;
   }
-  s->record_fd = -1;
-  s->play_fd = -1;
+  s->record.fd = -1;
+  s->play.fd = -1;
   if (input_device != 0) {
-    snprintf(s->input_name, sizeof(s->input_name),
+    snprintf(s->record.name, sizeof(s->record.name),
       "/dev/audio%zu", (uintptr_t)input_device - 1);
   } else {
-    snprintf(s->input_name, sizeof(s->input_name), "%s", SUN_DEFAULT_DEVICE);
+    snprintf(s->record.name, sizeof(s->record.name), "%s", SUN_DEFAULT_DEVICE);
   }
   if (output_device != 0) {
-    snprintf(s->output_name, sizeof(s->output_name),
+    snprintf(s->play.name, sizeof(s->play.name),
       "/dev/audio%zu", (uintptr_t)output_device - 1);
   } else {
-    snprintf(s->output_name, sizeof(s->output_name), "%s", SUN_DEFAULT_DEVICE);
+    snprintf(s->play.name, sizeof(s->play.name), "%s", SUN_DEFAULT_DEVICE);
   }
   if (input_stream_params != NULL) {
-#ifndef CUBEB_OLD_API
+#ifdef CUBEB_STREAM_PREF_LOOPBACK
     if (input_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK) {
       LOG("Loopback not supported");
       ret = CUBEB_ERROR_NOT_SUPPORTED;
       goto error;
     }
 #endif
-    if (s->record_fd == -1) {
-      if ((s->record_fd = open(s->input_name, O_RDONLY)) == -1) {
-        LOG("Audio device cannot be opened as read-only");
+    if (s->record.fd == -1) {
+      if ((s->record.fd = open(s->record.name, O_RDONLY)) == -1) {
+        LOG("Audio device could not be opened as read-only");
         ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
         goto error;
       }
     }
-    AUDIO_INITINFO(&s->r_info);
+    AUDIO_INITINFO(&s->record.info);
 #ifdef AUMODE_RECORD
-    s->r_info.mode = AUMODE_RECORD;
+    s->record.info.mode = AUMODE_RECORD;
 #endif
-    if ((ret = sun_copy_params(s->record_fd, s, input_stream_params,
-                               &s->r_info, &s->r_info.record)) != CUBEB_OK) {
+    if ((ret = sun_copy_params(s->record.fd, s, input_stream_params,
+                               &s->record.info, &s->record.info.record)) != CUBEB_OK) {
       LOG("Setting record params failed");
       goto error;
     }
+    s->record.floating = (input_stream_params->format == CUBEB_SAMPLE_FLOAT32NE);
   }
   if (output_stream_params != NULL) {
-#ifndef CUBEB_OLD_API
+#ifdef CUBEB_STREAM_PREF_LOOPBACK
     if (output_stream_params->prefs & CUBEB_STREAM_PREF_LOOPBACK) {
       LOG("Loopback not supported");
       ret = CUBEB_ERROR_NOT_SUPPORTED;
       goto error;
     }
 #endif
-    if (s->play_fd == -1) {
-      if ((s->play_fd = open(s->output_name, O_WRONLY)) == -1) {
-        LOG("Audio device cannot be opened as write-only");
+    if (s->play.fd == -1) {
+      if ((s->play.fd = open(s->play.name, O_WRONLY)) == -1) {
+        LOG("Audio device could not be opened as write-only");
         ret = CUBEB_ERROR_DEVICE_UNAVAILABLE;
         goto error;
       }
     }
-    AUDIO_INITINFO(&s->p_info);
+    AUDIO_INITINFO(&s->play.info);
 #ifdef AUMODE_PLAY
-    s->p_info.mode = AUMODE_PLAY;
+    s->play.info.mode = AUMODE_PLAY;
 #endif
-    if ((ret = sun_copy_params(s->play_fd, s, output_stream_params,
-                               &s->p_info, &s->p_info.play)) != CUBEB_OK) {
+    if ((ret = sun_copy_params(s->play.fd, s, output_stream_params,
+                               &s->play.info, &s->play.info.play)) != CUBEB_OK) {
       LOG("Setting play params failed");
       goto error;
     }
+    s->play.floating = (output_stream_params->format == CUBEB_SAMPLE_FLOAT32NE);
   }
   s->context = context;
   s->volume = 1.0;
@@ -620,28 +601,20 @@ sun_stream_init(cubeb * context,
     LOG("Failed to create mutex");
     goto error;
   }
-  if (s->play_fd != -1 && (s->play_buf = calloc(SUN_BUFFER_FRAMES,
-      s->p_info.play.channels * sizeof(int16_t))) == NULL) {
+  s->play.frame_size = s->play.info.play.channels *
+                      (s->play.info.play.precision / 8);
+  if (s->play.fd != -1 &&
+     (s->play.buf = calloc(SUN_BUFFER_FRAMES, s->play.frame_size)) == NULL) {
     ret = CUBEB_ERROR;
     goto error;
   }
-  if (s->record_fd != -1 && (s->record_buf = calloc(SUN_BUFFER_FRAMES,
-      s->r_info.record.channels * sizeof(int16_t))) == NULL) {
+  s->record.frame_size = s->record.info.record.channels *
+                        (s->record.info.record.precision / 8);
+  if (s->record.fd != -1 &&
+     (s->record.buf = calloc(SUN_BUFFER_FRAMES, s->record.frame_size)) == NULL) {
     ret = CUBEB_ERROR;
     goto error;
   }
-  if (s->floating) {
-    if (s->play_fd != -1 && (s->f_play_buf = calloc(SUN_BUFFER_FRAMES,
-        s->p_info.play.channels * sizeof(float))) == NULL) {
-      ret = CUBEB_ERROR;
-      goto error;
-    }
-    if (s->record_fd != -1 && (s->f_record_buf = calloc(SUN_BUFFER_FRAMES,
-        s->r_info.record.channels * sizeof(float))) == NULL) {
-      ret = CUBEB_ERROR;
-      goto error;
-    }
-  }
   *stream = s;
   return CUBEB_OK;
 error:
@@ -654,7 +627,7 @@ error:
 static int
 sun_stream_start(cubeb_stream * s)
 {
-  s->running = 1;
+  s->running = true;
   if (pthread_create(&s->thread, NULL, sun_io_routine, s) != 0) {
     LOG("Couldn't create thread");
     return CUBEB_ERROR;
@@ -668,12 +641,11 @@ sun_stream_get_position(cubeb_stream * s
 #ifdef AUDIO_GETOOFFS
   struct audio_offset offset;
 
-  if (ioctl(s->play_fd, AUDIO_GETOOFFS, &offset) == -1) {
+  if (ioctl(s->play.fd, AUDIO_GETOOFFS, &offset) == -1) {
     return CUBEB_ERROR;
   }
   s->blocks_written += offset.deltablks;
-  *position = BYTES_TO_FRAMES(s->blocks_written * s->p_info.blocksize,
-                              s->p_info.play.channels);
+  *position = (s->blocks_written * s->play.info.blocksize) / s->play.frame_size;
   return CUBEB_OK;
 #else
   pthread_mutex_lock(&s->mutex);
@@ -684,22 +656,21 @@ sun_stream_get_position(cubeb_stream * s
 }
 
 static int
-sun_stream_get_latency(cubeb_stream * stream, uint32_t * latency)
+sun_stream_get_latency(cubeb_stream * s, uint32_t * latency)
 {
 #ifdef AUDIO_GETBUFINFO
   struct audio_info info;
 
-  if (ioctl(stream->play_fd, AUDIO_GETBUFINFO, &info) == -1) {
+  if (ioctl(s->play.fd, AUDIO_GETBUFINFO, &info) == -1) {
     return CUBEB_ERROR;
   }
 
-  *latency = BYTES_TO_FRAMES(info.play.seek + info.blocksize,
-                             info.play.channels);
+  *latency = (info.play.seek + info.blocksize) / s->play.frame_size;
   return CUBEB_OK;
 #else
   cubeb_stream_params params;
 
-  params.rate = stream->p_info.play.sample_rate;
+  params.rate = stream->play.info.play.sample_rate;
 
   return sun_get_min_latency(NULL, params, latency);
 #endif
@@ -721,10 +692,10 @@ sun_get_current_device(cubeb_stream * st
   if (*device == NULL) {
     return CUBEB_ERROR;
   }
-  (*device)->input_name = stream->record_fd != -1 ?
-    strdup(stream->input_name) : NULL;
-  (*device)->output_name = stream->play_fd != -1 ?
-    strdup(stream->output_name) : NULL;
+  (*device)->input_name = stream->record.fd != -1 ?
+    strdup(stream->record.name) : NULL;
+  (*device)->output_name = stream->play.fd != -1 ?
+    strdup(stream->play.name) : NULL;
   return CUBEB_OK;
 }
 
@@ -744,22 +715,17 @@ static struct cubeb_ops const sun_ops = 
   .get_max_channel_count = sun_get_max_channel_count,
   .get_min_latency = sun_get_min_latency,
   .get_preferred_sample_rate = sun_get_preferred_sample_rate,
-#ifndef CUBEB_OLD_API
   .enumerate_devices = sun_enumerate_devices,
   .device_collection_destroy = sun_device_collection_destroy,
-#endif
   .destroy = sun_destroy,
   .stream_init = sun_stream_init,
   .stream_destroy = sun_stream_destroy,
   .stream_start = sun_stream_start,
   .stream_stop = sun_stream_stop,
-#ifndef CUBEB_OLD_API
   .stream_reset_default_device = NULL,
-#endif
   .stream_get_position = sun_stream_get_position,
   .stream_get_latency = sun_stream_get_latency,
   .stream_set_volume = sun_stream_set_volume,
-  .stream_set_panning = NULL,
   .stream_get_current_device = sun_get_current_device,
   .stream_device_destroy = sun_stream_device_destroy,
   .stream_register_device_changed_callback = NULL,

Index: pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb__alsa.c
diff -u pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb__alsa.c:1.11 pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb__alsa.c:1.12
--- pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb__alsa.c:1.11    Wed May  6 14:34:53 2020
+++ pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb__alsa.c Thu May  7 19:36:53 2020
@@ -1,4 +1,6 @@
-$NetBSD: patch-mozilla_media_libcubeb_src_cubeb__alsa.c,v 1.11 2020/05/06 14:34:53 ryoon Exp $
+$NetBSD: patch-mozilla_media_libcubeb_src_cubeb__alsa.c,v 1.12 2020/05/07 19:36:53 nia Exp $
+
+- Sun Audio support.
 
 --- mozilla/media/libcubeb/src/cubeb_alsa.c.orig       2020-04-01 11:01:50.000000000 +0000
 +++ mozilla/media/libcubeb/src/cubeb_alsa.c

Index: pkgsrc/www/seamonkey/patches/patch-mozilla_old-configure.in
diff -u pkgsrc/www/seamonkey/patches/patch-mozilla_old-configure.in:1.6 pkgsrc/www/seamonkey/patches/patch-mozilla_old-configure.in:1.7
--- pkgsrc/www/seamonkey/patches/patch-mozilla_old-configure.in:1.6     Wed May  6 14:34:53 2020
+++ pkgsrc/www/seamonkey/patches/patch-mozilla_old-configure.in Thu May  7 19:36:53 2020
@@ -1,72 +1,24 @@
-$NetBSD: patch-mozilla_old-configure.in,v 1.6 2020/05/06 14:34:53 ryoon Exp $
+$NetBSD: patch-mozilla_old-configure.in,v 1.7 2020/05/07 19:36:53 nia Exp $
 
 --- mozilla/old-configure.in.orig      2020-04-01 11:01:50.000000000 +0000
 +++ mozilla/old-configure.in
-@@ -2472,6 +2472,67 @@ fi
+@@ -2646,6 +2646,19 @@ AC_DEFINE(MOZ_WEBM_ENCODER)
+ AC_SUBST(MOZ_WEBM_ENCODER)
  
- AC_SUBST(MOZ_RAW)
- 
-+dnl ==================================
-+dnl = Check OSS availability
+ dnl ==================================
++dnl = Check sunaudio availability
 +dnl ==================================
 +
-+dnl If using Linux, Solaris or BSDs, ensure that OSS is available
++dnl If using Solaris or NetBSD, ensure that sunaudio is available
 +case "$OS_TARGET" in
-+Linux|SunOS|DragonFly|FreeBSD|NetBSD|GNU/kFreeBSD)
-+    MOZ_OSS=1
++SunOS|NetBSD)
++    MOZ_SUN=1
 +    ;;
 +esac
 +
-+MOZ_ARG_WITH_STRING(oss,
-+[  --with-oss[=PFX]        Enable OpenSoundSystem support [installed at prefix PFX]],
-+   OSSPREFIX=$withval)
-+
-+if test -n "$OSSPREFIX"; then
-+    if test "$OSSPREFIX" != "no"; then
-+        MOZ_OSS=1
-+    else
-+        MOZ_OSS=
-+    fi
-+fi
-+
-+_SAVE_CFLAGS=$CFLAGS
-+_SAVE_LIBS=$LIBS
-+if test -n "$MOZ_OSS"; then
-+    dnl Prefer 4Front implementation
-+    AC_MSG_CHECKING([MOZ_OSS_CFLAGS])
-+    if test "$OSSPREFIX" != "yes"; then
-+        oss_conf=${OSSPREFIX%/usr}/etc/oss.conf
-+        if test -f "$oss_conf"; then
-+            . "$oss_conf"
-+        else
-+            OSSLIBDIR=$OSSPREFIX/lib/oss
-+        fi
-+        if test -d "$OSSLIBDIR"; then
-+            MOZ_OSS_CFLAGS="$MOZ_OSS_CFLAGS -I$OSSLIBDIR/include"
-+        fi
-+    fi
-+    AC_MSG_RESULT([$MOZ_OSS_CFLAGS])
-+
-+    CFLAGS="$CFLAGS $MOZ_OSS_CFLAGS"
-+    MOZ_CHECK_HEADERS(sys/soundcard.h soundcard.h)
++AC_SUBST(MOZ_SUN)
 +
-+    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
-+            "$ac_cv_header_soundcard_h" != "yes"; then
-+        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
-+    fi
-+
-+    dnl Assume NetBSD implementation over SunAudio
-+    AC_CHECK_LIB(ossaudio, _oss_ioctl,
-+        [AC_DEFINE_UNQUOTED(CUBEB_OSS_DEFAULT_OUTPUT, "/dev/sound")
-+         MOZ_OSS_LIBS="$MOZ_OSS_LIBS -lossaudio"])
-+fi
-+CFLAGS=$_SAVE_CFLAGS
-+LIBS=$_SAVE_LIBS
-+
-+AC_SUBST(MOZ_OSS)
-+AC_SUBST_LIST(MOZ_OSS_CFLAGS)
-+AC_SUBST_LIST(MOZ_OSS_LIBS)
-+
- dnl ========================================================
- dnl = Apple platform decoder support
- dnl ========================================================
++dnl ==================================
+ dnl = Check alsa availability on Linux
+ dnl ==================================
+ 

Added files:

Index: pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb.c
diff -u /dev/null pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb.c:1.6
--- /dev/null   Thu May  7 19:36:53 2020
+++ pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_cubeb.c       Thu May  7 19:36:53 2020
@@ -0,0 +1,37 @@
+$NetBSD: patch-mozilla_media_libcubeb_src_cubeb.c,v 1.6 2020/05/07 19:36:53 nia Exp $
+
+- Sun Audio support.
+
+--- mozilla/media/libcubeb/src/cubeb.c.orig    2020-02-17 23:37:58.000000000 +0000
++++ mozilla/media/libcubeb/src/cubeb.c
+@@ -46,6 +46,9 @@ int wasapi_init(cubeb ** context, char c
+ #if defined(USE_SNDIO)
+ int sndio_init(cubeb ** context, char const * context_name);
+ #endif
++#if defined(USE_SUN)
++int sun_init(cubeb ** context, char const * context_name);
++#endif
+ #if defined(USE_OPENSL)
+ int opensl_init(cubeb ** context, char const * context_name);
+ #endif
+@@ -143,6 +146,10 @@ cubeb_init(cubeb ** context, char const 
+ #if defined(USE_SNDIO)
+       init_oneshot = sndio_init;
+ #endif
++    } else if (!strcmp(backend_name, "sun")) {
++#if defined(USE_SUN)
++      init_oneshot = sun_init;
++#endif
+     } else if (!strcmp(backend_name, "opensl")) {
+ #if defined(USE_OPENSL)
+       init_oneshot = opensl_init;
+@@ -190,6 +197,9 @@ cubeb_init(cubeb ** context, char const 
+ #if defined(USE_SNDIO)
+     sndio_init,
+ #endif
++#if defined(USE_SUN)
++    sun_init,
++#endif
+ #if defined(USE_OPENSL)
+     opensl_init,
+ #endif

Index: pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_moz.build
diff -u /dev/null pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_moz.build:1.10
--- /dev/null   Thu May  7 19:36:53 2020
+++ pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_src_moz.build     Thu May  7 19:36:53 2020
@@ -0,0 +1,19 @@
+$NetBSD: patch-mozilla_media_libcubeb_src_moz.build,v 1.10 2020/05/07 19:36:53 nia Exp $
+
+- Sun Audio support.
+
+--- mozilla/media/libcubeb/src/moz.build.orig  2020-04-01 11:01:50.000000000 +0000
++++ mozilla/media/libcubeb/src/moz.build
+@@ -43,6 +43,12 @@ if CONFIG['MOZ_JACK']:
+     ]
+     DEFINES['USE_JACK'] = True
+ 
++if CONFIG['MOZ_SUN']:
++    SOURCES += [
++        'cubeb_sun.c',
++    ]
++    DEFINES['USE_SUN'] = True
++
+ if CONFIG['OS_ARCH'] == 'OpenBSD':
+     SOURCES += [
+         'cubeb_sndio.c',

Index: pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_update.sh
diff -u /dev/null pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_update.sh:1.4
--- /dev/null   Thu May  7 19:36:53 2020
+++ pkgsrc/www/seamonkey/patches/patch-mozilla_media_libcubeb_update.sh Thu May  7 19:36:53 2020
@@ -0,0 +1,14 @@
+$NetBSD: patch-mozilla_media_libcubeb_update.sh,v 1.4 2020/05/07 19:36:53 nia Exp $
+
+- Sun Audio support.
+
+--- mozilla/media/libcubeb/update.sh.orig      2020-04-01 11:01:50.000000000 +0000
++++ mozilla/media/libcubeb/update.sh
+@@ -32,6 +32,7 @@ cp $1/src/cubeb_ringbuffer.h src
+ cp $1/src/cubeb_sndio.c src
+ cp $1/src/cubeb_strings.c src
+ cp $1/src/cubeb_strings.h src
++cp $1/src/cubeb_sun.c src
+ cp $1/src/cubeb_utils.h src
+ cp $1/src/cubeb_utils_unix.h src
+ cp $1/src/cubeb_utils_win.h src



Home | Main Index | Thread Index | Old Index