case MKIND_FILE: {
mkind_file_properties *mkfp = NULL;
const char *file = NULL;
- int file_len = 0;
+ int file_len __attribute__((unused)) = 0;
/* open the file */
mkfp = media_stream_kind_properties(ms).fprops;
}
/* retrieve the signal information */
-#if defined HAVE_STRUCT_SOX_FORMAT
+#if defined HAVE_STRUCT_SOX_FORMAT_T
stinfo = &ft->signal;
-#elif defined MEMBER_STRUCT_ST_SOUNDSTREAM_SIGNAL
- stinfo = &ft->signal;
-#elif defined MEMBER_STRUCT_ST_SOUNDSTREAM_INFO
- stinfo = &ft->info;
#else
# error "What's the matter with you?! How did you reach this?"
#endif
sxe_sox_t ft = arg;
sxe_sox_close(ft);
- SOX_DEBUG("closing SoX handle: 0x%x\n",
- (unsigned int)ft);
+ SOX_DEBUG("closing SoX handle: 0x%lx\n",
+ (unsigned long int)ft);
return;
}
/* stream stuff */
Lisp_Media_Stream *ms = mss->up;
mtype_audio_properties *mtap;
- /* libst stuff */
+ /* libsox stuff */
sxe_sox_t ft;
sxe_sox_ssize_t samples;
sxe_sox_sample_t *bptr;
- uint16_t framesize;
+ uint16_t framesize __attribute__((unused));
media_sample_format_t *fmt;
/* check the integrity of the media stream */
bptr = (sxe_sox_sample_t*)outbuf;
samples = sxe_sox_read(ft, bptr, mtap->channels*length);
- SOX_DEBUG_S("read %d samples\n", samples);
+ SOX_DEBUG_S("SoX handle: 0x%lx read %zd samples\n",
+ (unsigned long int)ft, samples);
if (samples < 0)
return 0;
static void
media_sox_rewind(media_substream *mss)
{
-/* rewind the stream to the first frame */
+ /* rewind the stream to the first frame */
Lisp_Media_Stream *ms = mss->up;
- /* libst stuff */
+ /* libsox stuff */
sxe_sox_t ft;
/* check the integrity of the media stream */
if (!(ft = media_stream_data(ms)))
return;
- SOX_DEBUG_S("rewind stream 0x%x\n", (unsigned int)ft);
- sxe_sox_seek(ft, 0, SEEK_SET);
+ SOX_DEBUG_S("rewind stream 0x%lx\n", (unsigned long int)ft);
+
+ /* Unfortunately it seems sex_sox_seek is broken, so we are
+ closing and reopening the stream,
+ */
+#ifdef SXE_SOX_CAN_SEEK
+ if( sxe_sox_seek(ft, 0, SOX_SEEK_SET) == 0 ) {
+ return;
+ }
+ SOX_DEBUG_S("rewind stream 0x%lx failed, trying reopen\n",
+ (unsigned long int)ft);
+#endif
+ sxe_sox_close(ft);
+ ft = NULL;
+ {
+ mkind_file_properties *mkfp = NULL;
+ const char *file = NULL;
+ int file_len __attribute__((unused)) = 0;
+
+ /* open the file */
+ mkfp = media_stream_kind_properties(ms).fprops;
+ TO_EXTERNAL_FORMAT(LISP_STRING, mkfp->filename,
+ ALLOCA, (file, file_len), Qnil);
+ if( file != NULL ) {
+#if defined HAVE_SOX_OPEN_READ_3ARGS
+ ft = sxe_sox_open_read(file, NULL, NULL);
+#elif defined HAVE_SOX_OPEN_READ_4ARGS
+ ft = sxe_sox_open_read(file, NULL, NULL, NULL);
+#else
+# error You shouldnt be here. Wake up before you try to compile me.
+#endif
+ }
+ }
+ if (!ft) {
+ media_stream_set_meths(ms, NULL);
+ media_stream_driver(ms) = MDRIVER_UNKNOWN;
+ SOX_DEBUG_S("could not reopen stream");
+ return;
+ }
+ media_stream_data(ms) = ft;
+ media_substream_data(mss) = ft;
}
#undef MYSELF