Fix oss option build

Based on PR pkg/51125.
This commit is contained in:
ryoon 2016-05-15 07:25:50 +00:00
parent c84886985a
commit 9bcddb2e88
2 changed files with 22 additions and 12 deletions

View file

@ -1,4 +1,4 @@
$NetBSD: distinfo,v 1.245 2016/05/05 11:46:15 ryoon Exp $
$NetBSD: distinfo,v 1.246 2016/05/15 07:25:50 ryoon Exp $
SHA1 (firefox-46.0.1.source.tar.xz) = 6705d7d1561dfa156ddd3277dc4a901c4c982d82
RMD160 (firefox-46.0.1.source.tar.xz) = 4550b03bad6e101bb129645222a8dd3adc8a9646
@ -75,7 +75,7 @@ SHA1 (patch-js_xpconnect_src_XPCConvert.cpp) = 915777e9bb5366be41866cdb6ea0ad2b1
SHA1 (patch-js_xpconnect_src_xpcprivate.h) = 8a15ff542c9d3fce448d9ec63706f7dfb411d926
SHA1 (patch-media_libcubeb_src_cubeb.c) = e55e26dae70ddb51d5668a3f60be37b668299ed3
SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 361942835850eee0a6e77574c380704f8f8ad89b
SHA1 (patch-media_libcubeb_src_cubeb__oss.c) = 54e2a210411c7083bc395033fbf519d581bc4a62
SHA1 (patch-media_libcubeb_src_cubeb__oss.c) = 927a7be37289bb2765966d042de4be711be0d144
SHA1 (patch-media_libcubeb_src_moz.build) = 9d99f250c78ff39dc0f3039fcf3622f7404f0f33
SHA1 (patch-media_libpng_pngpriv.h) = c9cefd1b5dd85fbd0c875c3f9bc108975398fe3a
SHA1 (patch-media_libsoundtouch_src_cpu__detect__x86.cpp) = db61737afa7773e8cbd82976de3a02c917174696

View file

@ -1,10 +1,10 @@
$NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.3 2015/02/28 04:30:55 ryoon Exp $
$NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.4 2016/05/15 07:25:50 ryoon Exp $
--- media/libcubeb/src/cubeb_oss.c.orig 2015-02-20 05:47:26.000000000 +0000
--- media/libcubeb/src/cubeb_oss.c.orig 2016-05-15 03:58:16.955259529 +0000
+++ media/libcubeb/src/cubeb_oss.c
@@ -0,0 +1,402 @@
@@ -0,0 +1,412 @@
+/*
+ * Copyright © 2014 Mozilla Foundation
+ * Copyright © 2014 Mozilla Foundation
+ *
+ * This program is made available under an ISC-style license. See the
+ * accompanying file LICENSE for details.
@ -23,6 +23,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.3 2015/02/28 04:30:55 ryoon E
+#include <errno.h>
+#include <pthread.h>
+#include <stdio.h>
+#include <assert.h>
+
+#include "cubeb/cubeb.h"
+#include "cubeb-internal.h"
@ -121,7 +122,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.3 2015/02/28 04:30:55 ryoon E
+ pthread_mutex_lock(&stream->state_mutex);
+ if (stream->data_callback && stream->running && !stream->stopped) {
+ pthread_mutex_unlock(&stream->state_mutex);
+ got = stream->data_callback(stream, stream->user_ptr, buffer, nframes);
+ got = stream->data_callback(stream, stream->user_ptr, NULL, buffer, nframes);
+ } else {
+ pthread_mutex_unlock(&stream->state_mutex);
+ }
@ -221,7 +222,10 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.3 2015/02/28 04:30:55 ryoon E
+
+static int oss_stream_init(cubeb * context, cubeb_stream ** stm,
+ char const * stream_name,
+ cubeb_stream_params stream_params,
+ cubeb_devid input_device,
+ cubeb_stream_params * input_stream_params,
+ cubeb_devid output_device,
+ cubeb_stream_params * output_stream_params,
+ unsigned int latency,
+ cubeb_data_callback data_callback,
+ cubeb_state_callback state_callback, void * user_ptr)
@ -232,6 +236,12 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.3 2015/02/28 04:30:55 ryoon E
+ stream->state_callback = state_callback;
+ stream->user_ptr = user_ptr;
+
+ assert(!input_stream_params && "not supported.");
+ if (input_device || output_device) {
+ /* Device selection not yet implemented. */
+ return CUBEB_ERROR_DEVICE_UNAVAILABLE;
+ }
+
+ if ((stream->fd = open(CUBEB_OSS_DEFAULT_OUTPUT, O_WRONLY)) == -1) {
+ free(stream);
+ return CUBEB_ERROR;
@ -243,16 +253,16 @@ $NetBSD: patch-media_libcubeb_src_cubeb__oss.c,v 1.3 2015/02/28 04:30:55 ryoon E
+ free(stream); \
+ return CUBEB_ERROR_INVALID_FORMAT; } } while (0)
+
+ stream->params = stream_params;
+ stream->params = *output_stream_params;
+ stream->volume = 1.0;
+ stream->panning = 0.0;
+
+ oss_try_set_latency(stream, latency);
+
+ stream->floating = 0;
+ SET(SNDCTL_DSP_CHANNELS, stream_params.channels);
+ SET(SNDCTL_DSP_SPEED, stream_params.rate);
+ switch (stream_params.format) {
+ SET(SNDCTL_DSP_CHANNELS, output_stream_params->channels);
+ SET(SNDCTL_DSP_SPEED, output_stream_params->rate);
+ switch (output_stream_params->format) {
+ case CUBEB_SAMPLE_S16LE:
+ SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
+ break;