sound-jack.c sound-nas.c sound-oss.c sound-pulse.c \
dgif_lib.c gif_io.c
libmm_a_CFLAGS = $(AM_CFLAGS) -Wall
-libmm_a_CPPFLAGS = $(AM_CPPFLAGS) $(c_switch_general) $(MM_CPPFLAGS) $(X_CFLAGS)
+libmm_a_CPPFLAGS = $(AM_CPPFLAGS) $(c_switch_general) $(MM_CPPFLAGS) $(X_CFLAGS)
libmm_a_LIBADD = $(libmm_objs)
libmm_a_DEPENDENCIES = $(libmm_a_LIBADD)
libmm_a_ldflags = $(MM_LIBS)
noinst_LIBRARIES=libmm.a
-#
+#
# Help the SXEmacs developers get nice post-processed source files
## Create preprocessor output (debugging purposes only)
/******************************************************************************
* Open a new gif file for read, given by its name. *
* Returns GifFileType pointer dynamically allocated which serves as the gif *
-* info record. *
+* info record. *
******************************************************************************/
void DGifOpenFileName(GifFileType * GifFile, const char *FileName)
{
******************************************************************************/
int DGifCloseFile(GifFileType * GifFile)
{
- GifFilePrivateType *Private;
+ GifFilePrivateType *Private;
if (GifFile == NULL)
return -1;
******************************************************************************/
SavedImage *MakeSavedImage(GifFileType * GifFile, SavedImage * CopyFrom)
/*
- * Append an image block to the SavedImages array
+ * Append an image block to the SavedImages array
*/
{
SavedImage *sp;
/*
* For the moment, the actual blocks can take their
- * chances with free(). We'll fix this later.
+ * chances with free(). We'll fix this later.
*/
}
}
Object->Colors =
(GifColorType *) calloc(ColorCount, sizeof(GifColorType));
if (Object->Colors == (GifColorType *) NULL) {
- free(Object);
+ free(Object);
return ((ColorMapObject *) NULL);
- }
+ }
Object->ColorCount = ColorCount;
Object->BitsPerPixel = BitSize(ColorCount);
}
/******************************
-* These are called internally *
+* These are called internally *
******************************/
void GifError(GifFileType * GifFile, const char *err_str)
{
{
int bitrate;
- /* for PCM codecs, compute bitrate directly */
- switch ((unsigned int)enc->codec_id) {
- case CODEC_ID_PCM_S32LE:
- case CODEC_ID_PCM_S32BE:
- case CODEC_ID_PCM_U32LE:
- case CODEC_ID_PCM_U32BE:
+ /* for PCM codecs, compute bitrate directly */
+ switch ((unsigned int)enc->codec_id) {
+ case CODEC_ID_PCM_S32LE:
+ case CODEC_ID_PCM_S32BE:
+ case CODEC_ID_PCM_U32LE:
+ case CODEC_ID_PCM_U32BE:
bitrate = enc->sample_rate * enc->channels * 32;
break;
- case CODEC_ID_PCM_S24LE:
- case CODEC_ID_PCM_S24BE:
- case CODEC_ID_PCM_U24LE:
- case CODEC_ID_PCM_U24BE:
- case CODEC_ID_PCM_S24DAUD:
+ case CODEC_ID_PCM_S24LE:
+ case CODEC_ID_PCM_S24BE:
+ case CODEC_ID_PCM_U24LE:
+ case CODEC_ID_PCM_U24BE:
+ case CODEC_ID_PCM_S24DAUD:
bitrate = enc->sample_rate * enc->channels * 24;
break;
- case CODEC_ID_PCM_S16LE:
- case CODEC_ID_PCM_S16BE:
- case CODEC_ID_PCM_U16LE:
- case CODEC_ID_PCM_U16BE:
+ case CODEC_ID_PCM_S16LE:
+ case CODEC_ID_PCM_S16BE:
+ case CODEC_ID_PCM_U16LE:
+ case CODEC_ID_PCM_U16BE:
bitrate = enc->sample_rate * enc->channels * 16;
break;
- case CODEC_ID_PCM_S8:
- case CODEC_ID_PCM_U8:
- case CODEC_ID_PCM_ALAW:
- case CODEC_ID_PCM_MULAW:
+ case CODEC_ID_PCM_S8:
+ case CODEC_ID_PCM_U8:
+ case CODEC_ID_PCM_ALAW:
+ case CODEC_ID_PCM_MULAW:
bitrate = enc->sample_rate * enc->channels * 8;
break;
- default:
+ default:
bitrate = enc->bit_rate;
break;
- }
+ }
return bitrate;
}
chars_left -= 10;
strncat(out, avfc->author, chars_left);
chars_left -= strlen(avfc->author);
- strncat(out, "\"", chars_left--);
+ strncat(out, "\"", chars_left--);
}
if (avfc->title && *avfc->title) {
strncat(out, " :title: \"", chars_left);
media_ffmpeg_vio_seek(URLContext *h, int64_t pos, int whence)
{
media_data *sd = (media_data*)h->priv_data;
-
+
FFMPEG_DEBUG_AVS("seeking to %ld via %d\n", (long int)pos, whence);
switch (whence) {
/* take a probe */
pd = xnew_and_zero(AVProbeData);
- pd->filename = file;
- pd->buf = NULL;
- pd->buf_size = 0;
+ pd->filename = file;
+ pd->buf = NULL;
+ pd->buf_size = 0;
pd->buf = (void*)sd->data;
pd->buf_size = PROBE_BUF_MIN;
AVStream *avst = NULL;
AVCodecContext *avcc = NULL;
AVCodec *avc = NULL;
-
+
/* initialise */
av_register_all();
avcc->codec_type != CODEC_TYPE_DATA &&
(avc = avcodec_find_decoder(avcc->codec_id)) &&
(avc && (avcodec_open(avcc, avc) >= 0))) {
-
+
/* create a substream */
mss = make_media_substream_append(ms);
-
+
switch ((unsigned int)avcc->codec_type) {
case CODEC_TYPE_VIDEO:
/* assign substream props */
}
}
}
-
+
/* keep the format context */
media_stream_data(ms) = avfc;
memset(ap, 0, sizeof(*ap));
/* we force a pause when starting an RTSP stream */
- ap->initial_pause = 1;
+ ap->initial_pause = 1;
ap->width = 0; /* frame_width; */
ap->height= 0; /* frame_height; */
mkind_file_properties *mkfp = NULL;
char *file;
int file_len = 0;
-
+
/* initialise */
av_register_all();
functioning of the sndcnv... routines */
if(waverequire(data, sz, rq) != 0)
return (count);
- else
+ else
return 0;
}
}
/* create a substream */
mss = make_media_substream_append(ms);
-
+
media_substream_type(mss) = MTYPE_AUDIO;
mtap = xnew_and_zero(mtype_audio_properties);
right_ch = pcm->samples[1];
size += nframes;
-
+
MAD_DEBUG_S("frames: %d, samples: %d, size:%d\n",
nframes, nframes*nchannels, size);
typedef struct mad_decoder_s {
- struct mad_synth *synth;
+ struct mad_synth *synth;
struct mad_stream *stream;
struct mad_frame *frame;
-
+
int have_frame;
int output_sampling_rate;
* Copyright (C) 2007 Sebastian Freundt
*
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* Copyright (C) 2007 Sebastian Freundt
*
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
/* try to find a read function */
switch (sfinfo->format & 0xFF) {
- case SF_FORMAT_ULAW:
- case SF_FORMAT_ALAW:
- case SF_FORMAT_PCM_U8:
+ case SF_FORMAT_ULAW:
+ case SF_FORMAT_ALAW:
+ case SF_FORMAT_PCM_U8:
case SF_FORMAT_PCM_S8:
mtap->samplewidth = 8;
mtap->framesize = mtap->channels;
/* stuff is read in as S16 values anyway */
mtap->msf = sxe_msf_S16;
break;
- case SF_FORMAT_PCM_16:
+ case SF_FORMAT_PCM_16:
mtap->samplewidth = 16;
mtap->framesize = mtap->channels * 2;
mtap->msf = sxe_msf_S16;
mtap->framesize = mtap->channels * 4;
mtap->msf = sxe_msf_S32;
break;
- case SF_FORMAT_FLOAT:
+ case SF_FORMAT_FLOAT:
mtap->samplewidth = 32;
mtap->framesize = mtap->channels * 4;
mtap->msf = sxe_msf_FLT;
break;
- default:
+ default:
xfree(sfinfo);
xfree(mtap);
media_stream_set_meths(ms, NULL);
fmt = mtap->msf;
switch (sfd->sfinfo->format & 0xFF) {
- case SF_FORMAT_ULAW:
- case SF_FORMAT_ALAW:
- case SF_FORMAT_PCM_U8:
+ case SF_FORMAT_ULAW:
+ case SF_FORMAT_ALAW:
+ case SF_FORMAT_PCM_U8:
case SF_FORMAT_PCM_S8:
- case SF_FORMAT_PCM_16:
+ case SF_FORMAT_PCM_16:
_read = sf_readf_short(sf, outbuf, length);
break;
case SF_FORMAT_PCM_24:
case SF_FORMAT_PCM_32:
_read = sf_readf_int(sf, outbuf, length);
break;
- case SF_FORMAT_FLOAT:
+ case SF_FORMAT_FLOAT:
_read = sf_readf_float(sf, outbuf, length);
break;
default:
#include <errno.h>
#include <string.h>
-/*
+/*
lisp.h defined UNUSED which also gets defined in some versions of SoX
in an incompatible fashion. We don't need that macro here...
*/
-#undef UNUSED
+#undef UNUSED
#include "media-sox.h"
#define MYSELF MDRIVER_SOX
\f
/* called from util.c::st_fail() */
-void cleanup(void)
+void cleanup(void)
{
}
mtap->samplewidth = 64;
mtap->framesize = mtap->channels * 8;
break;
- default:
+ default:
mtap->samplewidth = 32;
mtap->framesize = mtap->channels * 4;
break;
\f
/*****************************************************************/
-/* media streams */
+/* media streams */
/*****************************************************************/
static Lisp_Object media_stream_mark(Lisp_Object obj)
{
}
static const struct lrecord_description media_stream_description[] = {
- { XD_LISP_OBJECT, offsetof(Lisp_Media_Stream, first) },
- { XD_LISP_OBJECT, offsetof(Lisp_Media_Stream, last) },
+ { XD_LISP_OBJECT, offsetof(Lisp_Media_Stream, first) },
+ { XD_LISP_OBJECT, offsetof(Lisp_Media_Stream, last) },
{ XD_INT, offsetof(Lisp_Media_Stream, kind) },
{ XD_INT, offsetof(Lisp_Media_Stream, driver) },
- { XD_OPAQUE_PTR, offsetof(Lisp_Media_Stream, kind_properties) },
- { XD_OPAQUE_PTR, offsetof(Lisp_Media_Stream, stream_data) },
+ { XD_OPAQUE_PTR, offsetof(Lisp_Media_Stream, kind_properties) },
+ { XD_OPAQUE_PTR, offsetof(Lisp_Media_Stream, stream_data) },
{ XD_END }
};
\f
/*****************************************************************/
-/* media substreams */
+/* media substreams */
/*****************************************************************/
static void
break;
}
- if (mtap->samplerate)
+ if (mtap->samplerate)
write_fmt_str(printcharfun, ", %d Hz, %d Bit",
mtap->samplerate,
mtap->samplewidth);
temp = media_ffmpeg_available_formats();
#endif
formats = recons(formats, temp);
-
+
#ifdef HAVE_SNDFILE
temp = Qnil;
#endif
num = mtvp->width;
den = mtvp->height;
}
-
+
if (LIKELY(NILP(quotientp))) {
tmp = make_float((fpfloat)num / (fpfloat)den);
- }
+ }
#if defined HAVE_MPQ && defined WITH_GMP
else {
tmp = make_bigq(num, den);
Lisp_Media_Stream *up;
/* data and handling issues */
- media_type type;
+ media_type type;
union {
mtype_audio_properties *aprops;
media_substream *first; /* pointer to first substream */
media_substream *last; /* pointer to last substream */
- media_kind kind;
+ media_kind kind;
media_driver driver;
union {
/* now that we are here, mark AO device as dead */
XAUDIO_DEVICE_STATE(device) = ASTATE_DEAD;
return;
- }
+ }
/* info about the connected output plugin */
write_c_string(" :driver \"", pcfun);
if ((curvol = aj->volume) != sjsd->volume) {
sjsd->fvol = (float)curvol / MEDIA_SAMPLE_VOLUME_NORM;
sjsd->volume = curvol;
- }
+ }
if (aj->ratetrafo != sjsd->ratetrafo) {
sjsd->ratetrafo = aj->ratetrafo;
* that the above copyright notice appear in all copies and that both that
* copyright notice and this permission notice appear in supporting
* documentation, and that the name Network Computing Devices, Inc. not be
- * used in advertising or publicity pertaining to distribution of this
+ * used in advertising or publicity pertaining to distribution of this
* software without specific, written prior permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED 'AS-IS'. NETWORK COMPUTING DEVICES, INC.,
* DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING WITHOUT
* LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
write_c_string(" :server-handle ", pcfun);
if (snd->aud == NULL)
write_c_string("#b0rked", pcfun);
- else
+ else
write_fmt_str(pcfun, "0x%x", (unsigned int)snd->aud);
return;
nas_state(event->cur_state),
nas_reason(event->reason),
(uint32_t)event->num_bytes);
-
+
if (event->num_bytes > INT_MAX) {
NAS_CRITICAL("num_bytes > 2GB, server buggy?\n");
}
{
AuEvent ev;
int result = 0;
-
+
while (AuScanForTypedEvent(
snsd->snd->aud, AuEventsQueuedAfterFlush,
AuTrue, AuEventTypeElementNotify, &ev)) {
/* find physical output device */
snsd->dev = nas_find_device(snd->aud, snsd->mtap->channels);
- if (snsd->dev == AuNone ||
+ if (snsd->dev == AuNone ||
!(snsd->flow = AuCreateFlow(snd->aud, NULL))) {
/* No physical output device found or flow creation failed. */
NAS_DEBUG_C("no physical devices for this stream\n");
sosd->msf = sxe_msf_U8;
sosd->framesize = sosd->channels * sizeof(uint8_t);
break;
- case AFMT_S16_LE:
+ case AFMT_S16_LE:
case AFMT_S16_BE:
OSS_DEBUG_HW("Using S16.\n");
sosd->msf = sxe_msf_S16;
sosd->framesize = sosd->channels * sizeof(int16_t);
- break;
+ break;
default:
OSS_DEBUG_HW(".oO{ I must not be here }\n");
sosd->framesize = 0;
return -1;
- break;
+ break;
}
/* The PCSP driver does not support reading of the sampling rate via the
Author: Sebastian Freundt <hroptatyr@sxemacs.org>
* This file is part of SXEmacs.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
st = pa_context_get_state(spd->ctx);
switch ((unsigned int)st) {
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
+ case PA_CONTEXT_CONNECTING:
+ case PA_CONTEXT_AUTHORIZING:
+ case PA_CONTEXT_SETTING_NAME:
write_c_string("#busy", pcfun);
break;
- case PA_CONTEXT_READY:
+ case PA_CONTEXT_READY:
write_c_string("#connected", pcfun);
break;
-
- case PA_CONTEXT_TERMINATED:
+
+ case PA_CONTEXT_TERMINATED:
write_c_string("#terminated", pcfun);
break;
- case PA_CONTEXT_FAILED:
- default:
+ case PA_CONTEXT_FAILED:
+ default:
write_c_string("#failed", pcfun);
break;
}
sound_pulse_aj_data_t spsd;
sound_pulse_data_t spd;
pa_stream *stream;
- struct timeval tv;
+ struct timeval tv;
SXE_MUTEX_LOCK(&aj->mtx);
spd = get_audio_device_data(aj->device);
static void
time_ev_cb(pa_mainloop_api *m, pa_time_event *e,
- const struct timeval *tv, void *userdata)
+ const struct timeval *tv, void *userdata)
{
/* check an audio-job's queue for incoming events */
struct timeval next; /* for rescheduling this construction */
if (aj->volume != spsd->volume) {
spsd->volume = _sound_pulse_change_volume(
&spsd->chanvol, ctx, stream, (pa_volume_t)aj->volume);
- }
+ }
#endif /* !EF_USE_ASYNEQ */
mtp = aj->play_state;
st = pa_stream_get_state(s);
switch ((unsigned int)st) {
- case PA_STREAM_CREATING:
+ case PA_STREAM_CREATING:
PULSE_DEBUG_S("CREATING.\n");
break;
- case PA_STREAM_TERMINATED:
+ case PA_STREAM_TERMINATED:
PULSE_DEBUG_S("TERMINATED.\n");
PULSE_DEBUG_PT("trigger local semaphore\n");
SXE_SEMAPH_TRIGGER(sem);
break;
- case PA_STREAM_READY:
+ case PA_STREAM_READY:
PULSE_DEBUG_S("READY.\n");
break;
-
- case PA_STREAM_FAILED:
- default:
+
+ case PA_STREAM_FAILED:
+ default:
PULSE_DEBUG_S("FAILED.\n");
PULSE_DEBUG_PT("trigger local semaphore\n");
SXE_SEMAPH_TRIGGER(sem);
{
sound_pulse_data_t spd = data;
- if (eol < 0) {
+ if (eol < 0) {
PULSE_DEBUG_CTX("No sink info\n");
spd->sink_info = NULL;
} else if (i == NULL) {
/* This is called whenever the context status changes */
static void
-context_state_callback(pa_context *c, void *userdata)
+context_state_callback(pa_context *c, void *userdata)
{
sound_pulse_data_t spd = userdata;
pa_operation *o;
assert(c);
switch (pa_context_get_state(c)) {
- case PA_CONTEXT_UNCONNECTED:
- case PA_CONTEXT_CONNECTING:
- case PA_CONTEXT_AUTHORIZING:
- case PA_CONTEXT_SETTING_NAME:
+ case PA_CONTEXT_UNCONNECTED:
+ case PA_CONTEXT_CONNECTING:
+ case PA_CONTEXT_AUTHORIZING:
+ case PA_CONTEXT_SETTING_NAME:
PULSE_DEBUG_CTX("CONN/AUTH.\n");
spd->ml_running_p = 0;
break;
-
- case PA_CONTEXT_READY:
+
+ case PA_CONTEXT_READY:
PULSE_DEBUG_CTX("ESTA.\n");
sink_name = (NILP(spd->sink) ? NULL :
(char*)XSTRING_DATA(spd->sink));
pa_threaded_mainloop_signal(spd->tml, 0);
break;
- case PA_CONTEXT_TERMINATED:
+ case PA_CONTEXT_TERMINATED:
PULSE_DEBUG_CTX("DEAD.\n");
spd->ml_running_p = 0;
pa_threaded_mainloop_signal(spd->tml, 0);
break;
- case PA_CONTEXT_FAILED:
- default:
+ case PA_CONTEXT_FAILED:
+ default:
PULSE_DEBUG_CTX("FAIL.\n");
spd->ml_running_p = 0;
PULSE_DEBUG_CTX("triggering semaphore.\n");
/* device stuff */
sound_pulse_data_t spd = (sound_pulse_data_t)devdata;
/* some predeclarations to avoid ugly trigraphs */
- const char *client =
+ const char *client =
(NILP(spd->client) ? "SXEmacs" :
(const char*)XSTRING_DATA(spd->client));
const char *server =
#include "events/worker-asyneq.h"
/*****************************************************************/
-/* Audio Jobs */
+/* Audio Jobs */
/*****************************************************************/
/* sound-mst handler */
\f
Give JOB the sentinel SENTINEL; `nil' for none.
The sentinel is called as a function whenever the stream state changes.
-The function should take three (optional four) arguments
+The function should take three (optional four) arguments
(JOB STREAM STATE &optional OLD-STATE)
where
- JOB is the worker job object currently coping with the stream,
Optional third argument SENTINEL specifies a lisp function to be
called whenever the stream state changes. The function should
-take three (optional four) arguments
+take three (optional four) arguments
(JOB STREAM STATE &optional OLD-STATE)
where
- JOB is the worker job object currently coping with the stream,
\f
/*****************************************************************/
-/* audio device hack */
+/* audio device hack */
/*****************************************************************/
/* Indeed the console->device->frame->window structure is not what I'd call
* applicable to audio devices. That is why this seamless fake here exists :)
SOUND_DEBUG_DEV("GCor asked me to finalise: 0x%lx\n",
(long unsigned int)ad);
- if ( ad == NULL )
+ if ( ad == NULL )
return;
if (audio_device_data(ad) &&
static const struct lrecord_description audio_device_description[] = {
{ XD_INT, offsetof(Lisp_Audio_Device, driver) },
{ XD_INT, offsetof(Lisp_Audio_Device, state) },
- { XD_OPAQUE_PTR, offsetof(Lisp_Audio_Device, device_data) },
+ { XD_OPAQUE_PTR, offsetof(Lisp_Audio_Device, device_data) },
{ XD_END }
};
Keyword: Value:
------- -----
sound A string of raw sound data (deprecated), or the name of another
- sound to play. The symbol `t' here means use the default X beep.
+ sound to play. The symbol `t' here means use the default X beep.
volume An integer from 0-100, defaulting to `bell-volume'
pitch If using the default X beep, the pitch (Hz) to generate.
duration If using the default X beep, the duration (milliseconds).
load-sound-file.
Note: SXEmacs must be built with sound support for your system. Not all
-systems support sound.
+systems support sound.
Note: The pitch, duration, and volume options are available everywhere,
but many X servers ignore the `pitch' option.
#define SOUND_MAX_AUDIO_FRAME_SIZE \
SOUND_MAX_SAMPLE_FREQ * SOUND_MAX_SAMPLE_WIDTH * SOUND_MAX_CHANNELS
-/*
+/*
* Threads are the containers for the streams. Streams are stored
* (along with devices) inside threads, while substreams are stored inside
* subthreads. In source/sink language, a thread is the cable to plug a source
* (stream) to a sink (device).
- *
+ *
* This brings us to:
- *
+ *
* up +========+ up
* ,-----> | Thread | <-----,
* / +--------+ \
* |pthread_t1| |pthread_t2| |pthread_t3|
* |privdata1 | |privdata2 | |privdata3 |
* +==========+ +==========+ +==========+
- *
+ *
* Note: It is yet _not_ possible to specify different devices for each
* subthread. This will require another split of the device structure into
* a device+subdevice tree.