$NetBSD: patch-ad,v 1.3 2012/02/15 23:05:28 hans Exp $ --- ogg123/ogg123.c.orig 2002-07-06 19:12:18.000000000 +0000 +++ ogg123/ogg123.c @@ -32,6 +32,17 @@ #include #include +#ifdef __sun +#include +#define LITTLE_ENDIAN 1234 +#define BIG_ENDIAN 4321 +#ifdef _BIG_ENDIAN +#define BYTE_ORDER BIG_ENDIAN +#else +#define BYTE_ORDER LITTLE_ENDIAN +#endif +#endif + #include "audio.h" #include "buffer.h" #include "callbacks.h" @@ -453,6 +464,16 @@ void play (char *source_string) return; } + if ((new_audio_fmt.big_endian != (BYTE_ORDER == BIG_ENDIAN)) || + new_audio_fmt.signed_sample != 1 || + new_audio_fmt.word_size != 2) + { + /* Tremor can only do big_endian, signed, 16 bit samples */ + status_error(_("Error, Tremor can only decode signed 16 bit PCM " + "host endian.\n")); + return; + } + /* Decide which statistics are valid */ select_stats(stat_format, &options, source, decoder, audio_buffer); @@ -580,7 +601,13 @@ void play (char *source_string) format->cleanup(decoder); transport->close(source); +#if 0 + /* + * XXX: should be done properly with pthread_cleanup_push instead, + * if at all. + */ status_reset_output_lock(); /* In case we were killed mid-output */ +#endif status_message(1, _("Done."));