diff -Nru mjpegtools-1.4.1/Makefile.am mjpegtools-1.4.1-patched/Makefile.am --- mjpegtools-1.4.1/Makefile.am Tue Jun 5 12:13:13 2001 +++ mjpegtools-1.4.1-patched/Makefile.am Tue Aug 28 15:47:28 2001 @@ -1,6 +1,6 @@ # Process with automake to produce Makefile.in -SUBDIRS = utils mjpeg lavtools aenc mplex mpeg2enc scripts docs +SUBDIRS = utils lavtools aenc mplex mpeg2enc scripts docs # # Add any non autoconf'd files here, extra readmes and other misc diff -Nru mjpegtools-1.4.1/Makefile.in mjpegtools-1.4.1-patched/Makefile.in --- mjpegtools-1.4.1/Makefile.in Mon Jun 25 02:18:03 2001 +++ mjpegtools-1.4.1-patched/Makefile.in Tue Aug 28 15:47:28 2001 @@ -94,7 +94,7 @@ X_PRE_LIBS = @X_PRE_LIBS@ x_libraries = @x_libraries@ -SUBDIRS = utils mjpeg lavtools aenc mplex mpeg2enc scripts docs +SUBDIRS = utils lavtools aenc mplex mpeg2enc scripts docs # # Add any non autoconf'd files here, extra readmes and other misc diff -Nru mjpegtools-1.4.1/aenc/Makefile.am mjpegtools-1.4.1-patched/aenc/Makefile.am --- mjpegtools-1.4.1/aenc/Makefile.am Sat May 12 03:08:29 2001 +++ mjpegtools-1.4.1-patched/aenc/Makefile.am Tue Aug 28 15:47:26 2001 @@ -8,5 +8,5 @@ common.h table_absthr.h table_cb.h table_th.h \ encoder.h table_alloc.h table_enwindow.h wav_io.h -mp2enc_LDADD = -L$(top_srcdir)/utils -lutils -lm +mp2enc_LDADD = $(top_srcdir)/utils/libutils.a -lm diff -Nru mjpegtools-1.4.1/aenc/Makefile.in mjpegtools-1.4.1-patched/aenc/Makefile.in --- mjpegtools-1.4.1/aenc/Makefile.in Mon Jun 25 02:18:07 2001 +++ mjpegtools-1.4.1-patched/aenc/Makefile.in Tue Aug 28 15:47:26 2001 @@ -100,7 +100,7 @@ mp2enc_SOURCES = musicin.c common.c encode.c subs.c psy.c tonal.c tables.c wav_io.c fft.c common.h table_absthr.h table_cb.h table_th.h encoder.h table_alloc.h table_enwindow.h wav_io.h -mp2enc_LDADD = -L$(top_srcdir)/utils -lutils -lm +mp2enc_LDADD = $(top_srcdir)/utils/libutils.a -lm mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = diff -Nru mjpegtools-1.4.1/bs.h mjpegtools-1.4.1-patched/bs.h --- mjpegtools-1.4.1/bs.h Wed Dec 31 18:00:00 1969 +++ mjpegtools-1.4.1-patched/bs.h Tue Aug 28 15:47:28 2001 @@ -0,0 +1,12 @@ + #if defined(WORDS_BIGENDIAN) + #define bswap_16(x) \ + ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) + #define bswap_32(x) \ + ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | + \ + (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) + #else + #define bswap_16(x) (x) + #define bswap_32(x) (x) + #endif + diff -Nru mjpegtools-1.4.1/confdefs.h mjpegtools-1.4.1-patched/confdefs.h --- mjpegtools-1.4.1/confdefs.h Wed Dec 31 18:00:00 1969 +++ mjpegtools-1.4.1-patched/confdefs.h Tue Aug 28 15:47:28 2001 @@ -0,0 +1 @@ +#define VERSION ${VERSION} diff -Nru mjpegtools-1.4.1/config.h.in mjpegtools-1.4.1-patched/config.h.in --- mjpegtools-1.4.1/config.h.in Tue Jun 5 14:23:43 2001 +++ mjpegtools-1.4.1-patched/config.h.in Tue Aug 28 15:47:28 2001 @@ -64,3 +64,11 @@ /* Version number of package */ #undef VERSION +#if defined(WORDS_BIGENDIAN) +#define bswap_16(x) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)) +#define bswap_32(x) ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >> 8) | (((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24)) +#else +#define bswap_16(x) (x) +#define bswap_32(x) (x) +#endif + diff -Nru mjpegtools-1.4.1/configure mjpegtools-1.4.1-patched/configure --- mjpegtools-1.4.1/configure Sun Jun 10 08:22:57 2001 +++ mjpegtools-1.4.1-patched/configure Tue Aug 28 17:24:09 2001 @@ -2364,7 +2364,7 @@ if test x$have_pthread = xtrue ; then EXTRA_LIBS=" $GLIB_LIBS $PTHREAD_LIBS -lpng -ldl" else - EXTRA_LIBS="-L$with_quicktime$GLIB_LIBS -lpng -ldl" + EXTRA_LIBS="$GLIB_LIBS -lpng -ldl" fi echo $ac_n "checking for quicktime_open in -lquicktime""... $ac_c" 1>&6 @@ -2374,7 +2374,7 @@ echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lquicktime -L$with_quicktime $EXTRA_LIBS $JPEG_LIBS $LIBS" +LIBS="-lquicktime $EXTRA_LIBS $JPEG_LIBS $LIBS" cat > conftest.$ac_ext <&6 - QUICKTIME_LIBS="-L$with_quicktime -lquicktime $EXTRA_LIBS" - QUICKTIME_CFLAGS="-I $with_quicktime" + QUICKTIME_LIBS="-lquicktime $EXTRA_LIBS" + QUICKTIME_CFLAGS=" " cat >> confdefs.h <<\EOF #define HAVE_LIBQUICKTIME 1 EOF diff -Nru mjpegtools-1.4.1/lavtools/Makefile.am mjpegtools-1.4.1-patched/lavtools/Makefile.am --- mjpegtools-1.4.1/lavtools/Makefile.am Sat May 12 03:11:38 2001 +++ mjpegtools-1.4.1-patched/lavtools/Makefile.am Tue Aug 28 15:47:26 2001 @@ -22,63 +22,63 @@ lav_headers = lav_io.h editlist.h xlav.h avilib.h yuv4mpeg.h jpegutils.h yuvscaler.h ypipe_SOURCES = ypipe.c yuv4mpeg.c $(lav_headers) -ypipe_LDADD = -L$(top_srcdir)/utils -lutils +ypipe_LDADD = $(top_srcdir)/utils/libutils.a yuv2lav_SOURCES = yuv2lav.c jpegutils.c yuv4mpeg.c $(lav_headers) -yuv2lav_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) \ - $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +yuv2lav_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) \ + $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a transist_flt_SOURCES = transist.flt.c yuv4mpeg.c ${lav_headers} -transist_flt_LDADD = -L$(top_srcdir)/utils -lutils +transist_flt_LDADD = $(top_srcdir)/utils/libutils.a matteblend_flt_SOURCES = matteblend.flt.c yuv4mpeg.c ${lav_headers} -matteblend_flt_LDADD = -L$(top_srcdir)/utils -lutils +matteblend_flt_LDADD = $(top_srcdir)/utils/libutils.a lavplay_SOURCES = lavplay.c avilib.c audiolib.c lav_io.c editlist.c $(lav_headers) -lavplay_LDADD = -L$(top_builddir)/mjpeg -lmjpeg $(PTHREAD_LIBS) \ +lavplay_LDADD = $(top_builddir)/mjpeg/libmjpeg.a $(PTHREAD_LIBS) \ $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(SDL_LIBS) $(JPEG_LIBS) \ - -L$(top_srcdir)/utils -lutils + $(top_srcdir)/utils/libutils.a lavrec_SOURCES = lavrec.c avilib.c audiolib.c lav_io.c frequencies.c \ frequencies.h $(lav_headers) -lavrec_LDADD = -L$(top_builddir)/mjpeg -lmjpeg $(PTHREAD_LIBS) \ +lavrec_LDADD = $(top_builddir)/mjpeg/libmjpeg.a $(PTHREAD_LIBS) \ $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(JPEG_LIBS) \ - -L$(top_srcdir)/utils -lutils + $(top_srcdir)/utils/libutils.a testrec_SOURCES = testrec.c audiolib.c $(lav_headers) -testrec_LDADD = $(PTHREAD_LIBS) -L$(top_srcdir)/utils -lutils +testrec_LDADD = $(PTHREAD_LIBS) $(top_srcdir)/utils/libutils.a lav2yuv_SOURCES = lav2yuv.c jpegutils.c yuv4mpeg.c $(lav_headers) -lav2yuv_LDADD = -L$(top_builddir)/lavtools -lavio $(QUICKTIME_LIBS) \ - $(MOVTAR_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lav2yuv_LDADD = $(top_builddir)/lavtools/libavio.a $(QUICKTIME_LIBS) \ + $(MOVTAR_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavpipe_SOURCES = lavpipe.c yuv4mpeg.c pipelist.c pipelist.h $(lav_headers) -lavpipe_LDADD = -L$(top_srcdir)/utils -lutils +lavpipe_LDADD = $(top_srcdir)/utils/libutils.a yuvmedianfilter_SOURCES = yuvmedianfilter.c $(lav_headers) -yuvmedianfilter_LDFLAGS = -L$(top_builddir)/lavtools -yuvmedianfilter_LDADD = -L$(top_srcdir)/utils -lutils +yuvmedianfilter_LDFLAGS = $(top_builddir)/lavtools/libavio.a +yuvmedianfilter_LDADD = $(top_srcdir)/utils/libutils.a lav2wav_SOURCES = lav2wav.c $(lav_headers) -lav2wav_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) \ - $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lav2wav_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) \ + $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavtrans_SOURCES = lavtrans.c $(lav_headers) -lavtrans_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) \ - $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lavtrans_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) \ + $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavaddwav_SOURCES = lavaddwav.c $(lav_headers) -lavaddwav_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) \ - $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lavaddwav_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) \ + $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a xlav_SOURCES = xlav.c xlav_main.c $(lav_headers) -xlav_LDADD = $(X_LIBS) -lX11 $(FORMS_LIBS) $(X_EXTRA_LIBS) -L$(top_srcdir)/utils -lutils +xlav_LDADD = $(X_LIBS) -lX11 $(FORMS_LIBS) $(X_EXTRA_LIBS) $(top_srcdir)/utils/libutils.a lavvideo_SOURCES = lavvideo.c yuvscaler_SOURCES = yuvscaler.c editlist.c lav_io.c $(lav_headers) -yuvscaler_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) \ - $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +yuvscaler_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) \ + $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a yuvplay_SOURCES = yuvplay.c yuv4mpeg.h yuv4mpeg.c -yuvplay_LDADD = $(SDL_LIBS) $(PTHREAD_LIBS) -L$(top_srcdir)/utils -lutils +yuvplay_LDADD = $(SDL_LIBS) $(PTHREAD_LIBS) $(top_srcdir)/utils/libutils.a diff -Nru mjpegtools-1.4.1/lavtools/Makefile.in mjpegtools-1.4.1-patched/lavtools/Makefile.in --- mjpegtools-1.4.1/lavtools/Makefile.in Mon Jun 25 02:18:06 2001 +++ mjpegtools-1.4.1-patched/lavtools/Makefile.in Tue Aug 28 15:47:26 2001 @@ -106,70 +106,70 @@ # ********************************************************************* # The tools themselves -bin_PROGRAMS = lavplay lavrec lav2wav lav2yuv yuvmedianfilter lavaddwav lavvideo lavtrans xlav ypipe yuv2lav testrec transist.flt matteblend.flt lavpipe yuvscaler yuvplay +bin_PROGRAMS = lav2wav lav2yuv yuvmedianfilter lavaddwav lavtrans ypipe yuv2lav transist.flt matteblend.flt lavpipe yuvscaler yuvplay lav_headers = lav_io.h editlist.h xlav.h avilib.h yuv4mpeg.h jpegutils.h yuvscaler.h ypipe_SOURCES = ypipe.c yuv4mpeg.c $(lav_headers) -ypipe_LDADD = -L$(top_srcdir)/utils -lutils +ypipe_LDADD = $(top_srcdir)/utils/libutils.a yuv2lav_SOURCES = yuv2lav.c jpegutils.c yuv4mpeg.c $(lav_headers) -yuv2lav_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +yuv2lav_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a transist_flt_SOURCES = transist.flt.c yuv4mpeg.c ${lav_headers} -transist_flt_LDADD = -L$(top_srcdir)/utils -lutils +transist_flt_LDADD = $(top_srcdir)/utils/libutils.a matteblend_flt_SOURCES = matteblend.flt.c yuv4mpeg.c ${lav_headers} -matteblend_flt_LDADD = -L$(top_srcdir)/utils -lutils +matteblend_flt_LDADD = $(top_srcdir)/utils/libutils.a lavplay_SOURCES = lavplay.c avilib.c audiolib.c lav_io.c editlist.c $(lav_headers) -lavplay_LDADD = -L$(top_builddir)/mjpeg -lmjpeg $(PTHREAD_LIBS) $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(SDL_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lavplay_LDADD = $(top_builddir)/mjpeg/libmjpeg.a $(PTHREAD_LIBS) $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(SDL_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavrec_SOURCES = lavrec.c avilib.c audiolib.c lav_io.c frequencies.c frequencies.h $(lav_headers) -lavrec_LDADD = -L$(top_builddir)/mjpeg -lmjpeg $(PTHREAD_LIBS) $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lavrec_LDADD = $(top_builddir)/mjpeg/libmjpeg.a $(PTHREAD_LIBS) $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a testrec_SOURCES = testrec.c audiolib.c $(lav_headers) -testrec_LDADD = $(PTHREAD_LIBS) -L$(top_srcdir)/utils -lutils +testrec_LDADD = $(PTHREAD_LIBS) $(top_srcdir)/utils/libutils.a lav2yuv_SOURCES = lav2yuv.c jpegutils.c yuv4mpeg.c $(lav_headers) -lav2yuv_LDADD = -L$(top_builddir)/lavtools -lavio $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lav2yuv_LDADD = $(top_builddir)/lavtools/libavio.a $(QUICKTIME_LIBS) $(MOVTAR_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavpipe_SOURCES = lavpipe.c yuv4mpeg.c pipelist.c pipelist.h $(lav_headers) -lavpipe_LDADD = -L$(top_srcdir)/utils -lutils +lavpipe_LDADD = $(top_srcdir)/utils/libutils.a yuvmedianfilter_SOURCES = yuvmedianfilter.c $(lav_headers) yuvmedianfilter_LDFLAGS = -L$(top_builddir)/lavtools -yuvmedianfilter_LDADD = -L$(top_srcdir)/utils -lutils +yuvmedianfilter_LDADD = $(top_srcdir)/utils/libutils.a lav2wav_SOURCES = lav2wav.c $(lav_headers) -lav2wav_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lav2wav_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavtrans_SOURCES = lavtrans.c $(lav_headers) -lavtrans_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lavtrans_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a lavaddwav_SOURCES = lavaddwav.c $(lav_headers) -lavaddwav_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +lavaddwav_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a xlav_SOURCES = xlav.c xlav_main.c $(lav_headers) -xlav_LDADD = $(X_LIBS) -lX11 $(FORMS_LIBS) $(X_EXTRA_LIBS) -L$(top_srcdir)/utils -lutils +xlav_LDADD = $(X_LIBS) -lX11 $(FORMS_LIBS) $(X_EXTRA_LIBS) $(top_srcdir)/utils/libutils.a lavvideo_SOURCES = lavvideo.c yuvscaler_SOURCES = yuvscaler.c editlist.c lav_io.c $(lav_headers) -yuvscaler_LDADD = -L$(top_builddir)/lavtools -lavio $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) -L$(top_srcdir)/utils -lutils +yuvscaler_LDADD = $(top_builddir)/lavtools/libavio.a $(MOVTAR_LIBS) $(QUICKTIME_LIBS) $(JPEG_LIBS) $(top_srcdir)/utils/libutils.a yuvplay_SOURCES = yuvplay.c yuv4mpeg.h yuv4mpeg.c -yuvplay_LDADD = $(SDL_LIBS) $(PTHREAD_LIBS) -L$(top_srcdir)/utils -lutils +yuvplay_LDADD = $(SDL_LIBS) $(top_srcdir)/utils/libutils.a mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = @@ -408,7 +408,7 @@ yuvplay: $(yuvplay_OBJECTS) $(yuvplay_DEPENDENCIES) @rm -f yuvplay - $(LINK) $(yuvplay_LDFLAGS) $(yuvplay_OBJECTS) $(yuvplay_LDADD) $(LIBS) + $(LINK) $(yuvplay_LDFLAGS) $(yuvplay_OBJECTS) $(yuvplay_LDADD) tags: TAGS diff -Nru mjpegtools-1.4.1/lavtools/audiolib.c mjpegtools-1.4.1-patched/lavtools/audiolib.c --- mjpegtools-1.4.1/lavtools/audiolib.c Sat Apr 28 08:24:05 2001 +++ mjpegtools-1.4.1-patched/lavtools/audiolib.c Tue Aug 28 15:47:26 2001 @@ -34,13 +34,15 @@ #include #include #include +#if !defined(__APPLE__) #include +#endif +#include #include #include #include #include #include -#include #include "mjpeg_logging.h" @@ -210,6 +212,7 @@ if(initialized) { audio_errno = AUDIO_ERR_INIT2; return -1; } +#if !defined(__APPLE__) /* Checks of parameters */ if (a_size != 8 && a_size != 16) { audio_errno = AUDIO_ERR_ASIZE; return -1; } @@ -348,6 +351,7 @@ usleep(10000); } +#endif initialized = 1; return 0; } @@ -366,6 +370,7 @@ { if(!initialized) return; +#if !defined(__APPLE__) /* show the child we want to exit */ shmemptr->exit_flag = 1; @@ -374,6 +379,7 @@ #else pthread_join( capture_thread, NULL ); #endif +#endif initialized = 0; } @@ -468,6 +474,7 @@ { if(!initialized) { audio_errno = AUDIO_ERR_INIT; return -1; } +#if !defined(__APPLE__) /* Is audio task still ok ? */ if(shmemptr->audio_status < 0) { audio_errno = AUDIO_ERR_ATASK; return -1; } @@ -501,11 +508,13 @@ return audio_buffer_size; } +#endif return 0; } static void update_output_status() { +#if !defined(__APPLE__) while(shmemptr->status[NBUF(n_buffs_output)]) { if(shmemptr->status[NBUF(n_buffs_output)] < 0) n_buffs_error++; @@ -513,6 +522,7 @@ shmemptr->status[NBUF(n_buffs_output)] = 0; n_buffs_output++; } +#endif } void audio_get_output_status(struct timeval *tmstmp, int *nb_out, int *nb_err) @@ -545,6 +555,7 @@ if(!initialized) { audio_errno = AUDIO_ERR_INIT; return -1; } +#if !defined(__APPLE__) /* Is audio task still ok ? */ if(shmemptr->audio_status < 0) { audio_errno = AUDIO_ERR_ATASK; return -1; } @@ -618,6 +629,7 @@ memcpy(audio_left_buf,buf+nb,audio_bytes_left); } +#endif return size; } @@ -627,6 +639,7 @@ static void system_error(char *str, int use_strerror) { +#if !defined(__APPLE__) if(use_strerror) sprintf((char*)shmemptr->error_string,"Error %s - %s",str,strerror(errno)); else @@ -638,10 +651,12 @@ #else pthread_exit(NULL); #endif +#endif } void do_audio(void) { +#if !defined(__APPLE__) int fd, tmp, ret, caps, afmt, frag; int nbdone, nbque, ndiff, nbpend, nbset, maxdiff; @@ -1036,7 +1051,7 @@ } } } +#endif } - diff -Nru mjpegtools-1.4.1/lavtools/lav2wav.c mjpegtools-1.4.1-patched/lavtools/lav2wav.c --- mjpegtools-1.4.1/lavtools/lav2wav.c Thu May 3 01:43:30 2001 +++ mjpegtools-1.4.1-patched/lavtools/lav2wav.c Tue Aug 28 15:47:26 2001 @@ -109,15 +109,15 @@ strncpy(wave.riff.id, "RIFF", 4); strncpy(wave.riff.wave_id, "WAVE",4); strncpy(wave.format.id, "fmt ",4); - wave.format.len = sizeof(struct common_struct); + wave.format.len = bswap_32(sizeof(struct common_struct)); /* Store information */ - wave.common.wFormatTag = WAVE_FORMAT_PCM; - wave.common.wChannels = channels; - wave.common.dwSamplesPerSec = rate; - wave.common.dwAvgBytesPerSec = channels*rate*bits/8; - wave.common.wBlockAlign = channels*bits/8; - wave.common.wBitsPerSample = bits; + wave.common.wFormatTag = bswap_16(WAVE_FORMAT_PCM); + wave.common.wChannels = bswap_16(channels); + wave.common.dwSamplesPerSec = bswap_32(rate); + wave.common.dwAvgBytesPerSec = bswap_32(channels*rate*bits/8); + wave.common.wBlockAlign = bswap_16(channels*bits/8); + wave.common.wBitsPerSample = bswap_16(bits); strncpy(wave.data.id, "data",4); if (do_write(fd, &wave, sizeof(wave)) != sizeof(wave)) @@ -156,9 +156,9 @@ // Fill out our wav-header with some information. size -= 8; - wave.riff.len = size; + wave.riff.len = bswap_32(size); size -= 20+sizeof(struct common_struct); - wave.data.len = size; + wave.data.len = bswap_32(size); if (do_write(fd, &wave, sizeof(wave)) < sizeof(wave)) { diff -Nru mjpegtools-1.4.1/lavtools/lav2yuv.c mjpegtools-1.4.1-patched/lavtools/lav2yuv.c --- mjpegtools-1.4.1/lavtools/lav2yuv.c Wed Jun 13 12:33:11 2001 +++ mjpegtools-1.4.1-patched/lavtools/lav2yuv.c Tue Aug 28 15:47:26 2001 @@ -174,7 +174,7 @@ char *buf = malloc(size + BUFFER_ALIGN); int adjust; if (buf == NULL) { - error("malloc failed\n"); + mjpeg_error_exit1("malloc failed\n"); } adjust = BUFFER_ALIGN - ((int) buf) % BUFFER_ALIGN; if (adjust == BUFFER_ALIGN) diff -Nru mjpegtools-1.4.1/lavtools/lavplay.c mjpegtools-1.4.1-patched/lavtools/lavplay.c --- mjpegtools-1.4.1/lavtools/lavplay.c Sun May 27 09:12:01 2001 +++ mjpegtools-1.4.1-patched/lavtools/lavplay.c Tue Aug 28 15:47:26 2001 @@ -139,7 +139,7 @@ #define LAVPLAY_VSTR "lavplay" LAVPLAY_VERSION /* Expected version info */ char *audio_strerror(void); -void malloc_error(void); +static void malloc_error(void); void sig_cont(int sig); int queue_next_frame(char *vbuff, int skip_video, int skip_audio, int skip_incr); void Usage(char *progname); @@ -252,7 +252,7 @@ /* Since we use malloc often, here the error handling */ -void malloc_error(void) +static void malloc_error(void) { mjpeg_error_exit1("Out of memory - malloc failed\n"); } @@ -616,7 +616,9 @@ struct mjpeg_params bp; struct mjpeg_sync bs; struct sigaction action, old_action; +#if !defined(__APPLE__) struct video_capability vc; +#endif /* Output Version information - Used by xlav to check for consistency. @@ -702,7 +704,7 @@ case 'Z': soft_fullscreen = 1; break; - +#if !defined(__APPLE__) case 'H': mjpeg_info("Choosing hardware MJPEG playback (on-screen)\n"); screen_output = 1; @@ -713,6 +715,7 @@ screen_output = 0; soft_play = 0; break; +#endif } } @@ -722,6 +725,12 @@ mjpeg_default_handler_verbosity(verbose); +#if defined(__APPLE__) + soft_play = 1; + screen_output = 0; + audio_enable = 0; +#endif + /* Get and open input files */ read_video_files(argv + optind, argc - optind, &el); @@ -759,11 +768,13 @@ if (soft_play) mjpeg = mjpeg_open(MJPEG_OUTPUT_SOFTWARE, MJPG_nbufs, el.max_frame_size); +#if !defined(__APPLE__) else if (screen_output) mjpeg = mjpeg_open(MJPEG_OUTPUT_HARDWARE_SCREEN, MJPG_nbufs, el.max_frame_size); else mjpeg = mjpeg_open(MJPEG_OUTPUT_HARDWARE_VIDEO, MJPG_nbufs, el.max_frame_size); +#endif buff = mjpeg_get_io_buffer(mjpeg); @@ -865,14 +876,17 @@ bp.input = 0; +#if !defined(__APPLE__) /* Set norm */ bp.norm = (el.video_norm == 'n') ? VIDEO_MODE_NTSC : VIDEO_MODE_PAL; mjpeg_info("Output norm: %s\n",bp.norm?"NTSC":"PAL"); hn = bp.norm ? 480 : 576; /* Height of norm */ +#endif bp.decimation = 0; /* we will set proper params ourselves */ +#if !defined(__APPLE__) /* Check dimensions of video, select decimation factors */ if (!soft_play && !screen_output) { @@ -891,6 +905,7 @@ el.video_width,el.video_height); } } +#endif /* if zoom_to_fit is set, HorDcm is independent of interlacing */ @@ -932,6 +947,7 @@ bp.field_per_buff = 1; bp.TmpDcm = 2; +#if !defined(__APPLE__) if (!soft_play && !screen_output && ( el.video_height > hn/2 || (!zoom_to_fit && el.video_width>playback_width/2) )) { @@ -942,6 +958,7 @@ mjpeg_error("Try -z option !!!!\n"); exit(1); } +#endif if(zoom_to_fit) { diff -Nru mjpegtools-1.4.1/lavtools/lavtrans.c mjpegtools-1.4.1-patched/lavtools/lavtrans.c --- mjpegtools-1.4.1/lavtools/lavtrans.c Sat May 5 08:59:29 2001 +++ mjpegtools-1.4.1-patched/lavtools/lavtrans.c Tue Aug 28 15:47:26 2001 @@ -53,6 +53,7 @@ */ +#include #include #include #include @@ -70,7 +71,11 @@ static int process_image_frame = -1; /* All, >-1 means not all */ +#ifdef WORDS_BIGENDIAN +#define FOURCC(a,b,c,d) ( (a<<24) | ((b&0xff)<<16) | ((c&0xff)<<8) | (d&0xff) ) +#else #define FOURCC(a,b,c,d) ( (d<<24) | ((c&0xff)<<16) | ((b&0xff)<<8) | (a&0xff) ) +#endif #define FOURCC_RIFF FOURCC ('R', 'I', 'F', 'F') #define FOURCC_WAVE FOURCC ('W', 'A', 'V', 'E') @@ -217,13 +222,13 @@ wave_hdr.rifflen = 0; /* to be filled later */ wave_hdr.wavetag = FOURCC_WAVE; wave_hdr.fmt_tag = FOURCC_FMT; - wave_hdr.fmt_len = 16; - wave_hdr.wFormatTag = 1; /* PCM */ - wave_hdr.nChannels = forcestereo ? 2 : el.audio_chans; - wave_hdr.nSamplesPerSec = el.audio_rate; - wave_hdr.nAvgBytesPerSec = el.audio_rate*el.audio_bps; - wave_hdr.nBlockAlign = el.audio_bps; - wave_hdr.wBitsPerSample = el.audio_bits; + wave_hdr.fmt_len = bswap_32(16); + wave_hdr.wFormatTag = bswap_16(1); /* PCM */ + wave_hdr.nChannels = bswap_16(forcestereo ? 2 : el.audio_chans); + wave_hdr.nSamplesPerSec = bswap_32(el.audio_rate); + wave_hdr.nAvgBytesPerSec = bswap_32(el.audio_rate*el.audio_bps); + wave_hdr.nBlockAlign = bswap_16(el.audio_bps); + wave_hdr.wBitsPerSample = bswap_16(el.audio_bits); wave_hdr.datatag = FOURCC_DATA; wave_hdr.datalen = 0; /* to be filled later */ @@ -316,8 +321,8 @@ if(format == 'w' || format == 'W') { - wave_hdr.rifflen = sizeof(wave_hdr) - 8 + audio_bytes_out; - wave_hdr.datalen = audio_bytes_out; + wave_hdr.rifflen = bswap_32(sizeof(wave_hdr) - 8 + audio_bytes_out); + wave_hdr.datalen = bswap_32(audio_bytes_out); res = fseek(wavfd,0,SEEK_SET); if(res) system_error("writing WAV file","fseek"); res = fwrite(&wave_hdr,sizeof(wave_hdr),1,wavfd); diff -Nru mjpegtools-1.4.1/lavtools/yuvmedianfilter.c mjpegtools-1.4.1-patched/lavtools/yuvmedianfilter.c --- mjpegtools-1.4.1/lavtools/yuvmedianfilter.c Sat May 5 09:03:13 2001 +++ mjpegtools-1.4.1-patched/lavtools/yuvmedianfilter.c Tue Aug 28 15:47:26 2001 @@ -27,6 +27,10 @@ #include "mjpeg_logging.h" +#ifdef __APPLE__ +#define alloca malloc +#endif + #define CHROMA420 1 #define CHROMA422 2 #define CHROMA444 3 diff -Nru mjpegtools-1.4.1/lavtools/yuvplay.c mjpegtools-1.4.1-patched/lavtools/yuvplay.c --- mjpegtools-1.4.1/lavtools/yuvplay.c Sun May 6 14:39:58 2001 +++ mjpegtools-1.4.1-patched/lavtools/yuvplay.c Tue Aug 28 15:47:26 2001 @@ -126,6 +126,7 @@ mjpeg_log(LOG_ERROR, "Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } + atexit(SDL_Quit); /* yuv params */ yuv[0] = malloc(width * height * sizeof(unsigned char)); diff -Nru mjpegtools-1.4.1/lavtools/yuvscaler.c mjpegtools-1.4.1-patched/lavtools/yuvscaler.c --- mjpegtools-1.4.1/lavtools/yuvscaler.c Sun Jun 10 08:21:14 2001 +++ mjpegtools-1.4.1-patched/lavtools/yuvscaler.c Tue Aug 28 15:47:26 2001 @@ -25,6 +25,9 @@ #include "inttypes.h" #include "yuvscaler.h" +#if defined __APPLE__ +#define alloca malloc +#endif // For input unsigned int input_width; diff -Nru mjpegtools-1.4.1/mjpeg/jpeg_dec.c mjpegtools-1.4.1-patched/mjpeg/jpeg_dec.c --- mjpegtools-1.4.1/mjpeg/jpeg_dec.c Wed Apr 11 05:50:35 2001 +++ mjpegtools-1.4.1-patched/mjpeg/jpeg_dec.c Tue Aug 28 15:47:27 2001 @@ -167,6 +167,7 @@ } } +#if defined(HAVE_MMX_INTEL_MNEMONICS) GLOBAL(void) ycc_rgb32_convert_mmx (j_decompress_ptr cinfo, JSAMPIMAGE input_buf, JDIMENSION input_row, @@ -284,6 +285,7 @@ asm ("emms"); } +#endif int64 rb16mask = 0x00f800f800f800f8; // just red and blue remain int64 rb16mult = 0x2000000820000008; // mult/Add factor (see intel appnote 553) @@ -358,6 +360,7 @@ //printf("rb16mult = 0x%llx\n", rb16mult); } +#if HAVE_MMX_INTEL_MNEMONICS /* RGB, 15/16 bits, 5-6bits each: (Junk), R, G, B */ GLOBAL(void) ycc_rgb16_convert_mmx (j_decompress_ptr cinfo, @@ -531,6 +534,7 @@ asm ("emms"); } +#endif /* end of custom color deconverter */ /* MMX detection routine */ diff -Nru mjpegtools-1.4.1/mjpeg/mjpeg.c mjpegtools-1.4.1-patched/mjpeg/mjpeg.c --- mjpegtools-1.4.1/mjpeg/mjpeg.c Sat Apr 28 11:25:01 2001 +++ mjpegtools-1.4.1-patched/mjpeg/mjpeg.c Tue Aug 28 15:47:27 2001 @@ -47,12 +47,14 @@ switch ( mjpeg->bp.norm ) { +#if defined(MJPEG_OUTPUT_HARDWARE_SCREEN) || defined(MJPEG_OUTPUT_HARDWARE_VIDEO) case VIDEO_MODE_PAL : norm_usec_per_frame = 1000000/25; /* 25Hz */ break; case VIDEO_MODE_NTSC : norm_usec_per_frame = 1001000/30; /* 30ish Hz */ break; +#endif default : if( mjpeg->output_mode != MJPEG_OUTPUT_SOFTWARE ) mjpeg_error("Hardware playback impossible: unknown video norm!\n"); @@ -170,11 +172,19 @@ { case 4: cconvert = cinfo.cconvert; +#if defined(HAVE_MMX_INTEL_MNEMONICS) cconvert->color_convert = (mjpeg->MMX_CPU) ? ycc_rgb32_convert_mmx : ycc_rgb32_convert_orig; +#else + cconvert->color_convert = ycc_rgb32_convert_orig; +#endif break; case 2: cconvert = cinfo.cconvert; +#if defined(HAVE_MMX_INTEL_MNEMONICS) cconvert->color_convert = (mjpeg->MMX_CPU) ? ycc_rgb16_convert_mmx : ycc_rgb16_convert_orig; +#else + cconvert->color_convert = ycc_rgb16_convert_orig; +#endif break; default: break; /* 24 bit modes are officially not supported, but they exist down in libjpeg */ } @@ -253,6 +263,7 @@ switch (output_mode) { +#if defined(MJPEG_OUTPUT_HARDWARE_SCREEN) || defined(MJPEG_OUTPUT_HARDWARE_VIDEO) case MJPEG_OUTPUT_HARDWARE_SCREEN: case MJPEG_OUTPUT_HARDWARE_VIDEO: /* open video device */ @@ -275,6 +286,7 @@ if (mjpeg->buff == MAP_FAILED) mjpeg_system_error("mapping video buffers","mmap"); break; +#endif case MJPEG_OUTPUT_SOFTWARE: /* Just allocate MJPG_nbuf buffers */ @@ -448,6 +460,7 @@ { int res, i; +#if defined(MJPEG_OUTPUT_HARDWARE) if (mjpeg->output_mode & MJPEG_OUTPUT_HARDWARE) { /* do a MJPIOC_G_PARAMS ioctl to get proper default values */ @@ -459,6 +472,7 @@ bp->img_width, bp->img_height, bp->quality); } else +#endif { /* Set necessary params and call buz_check_params to set the defaults */ @@ -486,8 +500,9 @@ void mjpeg_set_params(struct mjpeg_handle *mjpeg, struct mjpeg_params *bp) { int res; - struct video_window vw; +#if defined(MJPEG_OUTPUT_HARDWARE_SCREEN) + struct video_window vw; if (mjpeg->output_mode == MJPEG_OUTPUT_HARDWARE_SCREEN) { int n; @@ -519,7 +534,9 @@ bp->VFIFO_FB = 1; mjpeg->bp.VFIFO_FB = 1; } +#endif +#if defined(MJPEG_OUTPUT_HARDWARE) if (mjpeg->output_mode & MJPEG_OUTPUT_HARDWARE) { /* All should be set up now, set the parameters */ @@ -534,6 +551,7 @@ memcpy(&mjpeg->bp, bp, sizeof(struct mjpeg_params)); } else +#endif { mjpeg->show_odd = (bp->odd_even) ? 1 : 0; /* odd_even = 1: show even first */ /* Assume that the params are correct, later I will introduce mjpeg_check_params */ @@ -546,12 +564,14 @@ { int res; +#if defined(MJPEG_OUTPUT_HARDWARE) if (mjpeg->output_mode & MJPEG_OUTPUT_HARDWARE) { res = ioctl(mjpeg->dev, MJPIOC_QBUF_PLAY, &frame); if (res < 0) mjpeg_system_error("queueing buffer","ioctl MJPIOC_QBUF_PLAY"); } else +#endif { /* mark this buffer as playable and tell the software playback thread to wake up if it sleeps */ pthread_mutex_lock(&mjpeg->valid_mutex); @@ -566,6 +586,7 @@ static int frame = 0; /* This is AWFUL and needs to be FIXED !! */ int res; +#if defined(MJPEG_OUTPUT_HARDWARE) if (mjpeg->output_mode & MJPEG_OUTPUT_HARDWARE) { res = ioctl(mjpeg->dev, MJPIOC_SYNC, bs); @@ -576,6 +597,7 @@ mjpeg_debug("frame=%ld, length=%ld, seq=%ld\n", bs->frame, bs->length, bs->seq); } else +#endif { /* Wait until this buffer has been played */ pthread_mutex_lock(&mjpeg->valid_mutex); @@ -606,6 +628,7 @@ mjpeg_debug("Closing MJPEG library for handle %p\n", mjpeg); +#if defined(MJPEG_OUTPUT_HARDWARE) if (mjpeg->output_mode & MJPEG_OUTPUT_HARDWARE) { n = -1; @@ -624,6 +647,7 @@ } } else +#endif { mjpeg_debug( "Now deleting software playback thread\n"); mjpeg->exit_playback = 1; diff -Nru mjpegtools-1.4.1/mjpeg/mjpeg.h mjpegtools-1.4.1-patched/mjpeg/mjpeg.h --- mjpegtools-1.4.1/mjpeg/mjpeg.h Wed Feb 21 06:58:17 2001 +++ mjpegtools-1.4.1-patched/mjpeg/mjpeg.h Tue Aug 28 15:47:27 2001 @@ -8,19 +8,25 @@ #include +#if !defined(__APPLE__) #include #include +#else +#define HZ 60 +#endif #include "videodev_mjpeg.h" /* defines which output mode this handle uses (e g: hardware or software playback) */ /* use software to decompress & playback */ #define MJPEG_OUTPUT_SOFTWARE 0x10 +#if !defined(__APPLE__) #define MJPEG_OUTPUT_HARDWARE 0x20 /* on the TV output */ #define MJPEG_OUTPUT_HARDWARE_VIDEO 0x20 /* use hardware, but output on the computer screen */ #define MJPEG_OUTPUT_HARDWARE_SCREEN 0x21 +#endif #define MJPEG_MAX_BUF 64 diff -Nru mjpegtools-1.4.1/mjpeg/videodev_mjpeg.h mjpegtools-1.4.1-patched/mjpeg/videodev_mjpeg.h --- mjpegtools-1.4.1/mjpeg/videodev_mjpeg.h Sun Feb 11 19:40:12 2001 +++ mjpegtools-1.4.1-patched/mjpeg/videodev_mjpeg.h Tue Aug 28 15:47:27 2001 @@ -104,6 +104,7 @@ int color; /* Returned: 1 if color signal detected */ }; +#if !defined(__APPLE__) /* Private IOCTL to set up for displaying MJPEG */ @@ -114,3 +115,4 @@ #define MJPIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOCPRIVATE+4, int) #define MJPIOC_SYNC _IOR ('v', BASE_VIDIOCPRIVATE+5, struct mjpeg_sync) #define MJPIOC_G_STATUS _IOWR('v', BASE_VIDIOCPRIVATE+6, struct mjpeg_status) +#endif diff -Nru mjpegtools-1.4.1/mpeg2enc/Makefile.am mjpegtools-1.4.1-patched/mpeg2enc/Makefile.am --- mjpegtools-1.4.1/mpeg2enc/Makefile.am Fri Jun 8 12:25:11 2001 +++ mjpegtools-1.4.1-patched/mpeg2enc/Makefile.am Tue Aug 28 15:47:26 2001 @@ -30,7 +30,7 @@ mpeg2enc_DEPENDENCIES = $(top_srcdir)/utils/libutils.a -mpeg2enc_LDADD=-L$(top_srcdir)/utils -lutils @PTHREAD_LIBS@ -lm +mpeg2enc_LDADD=$(top_srcdir)/utils/libutils.a @PTHREAD_LIBS@ -lm ASM = nasm diff -Nru mjpegtools-1.4.1/mpeg2enc/Makefile.in mjpegtools-1.4.1-patched/mpeg2enc/Makefile.in --- mjpegtools-1.4.1/mpeg2enc/Makefile.in Mon Jun 25 02:18:10 2001 +++ mjpegtools-1.4.1-patched/mpeg2enc/Makefile.in Tue Aug 28 15:47:26 2001 @@ -111,7 +111,7 @@ mpeg2enc_DEPENDENCIES = $(top_srcdir)/utils/libutils.a -mpeg2enc_LDADD = -L$(top_srcdir)/utils -lutils @PTHREAD_LIBS@ -lm +mpeg2enc_LDADD = $(top_srcdir)/utils/libutils.a @PTHREAD_LIBS@ -lm ASM = nasm mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs diff -Nru mjpegtools-1.4.1/mpeg2enc/mpeg2enc.c mjpegtools-1.4.1-patched/mpeg2enc/mpeg2enc.c --- mjpegtools-1.4.1/mpeg2enc/mpeg2enc.c Sat Jun 16 03:50:49 2001 +++ mjpegtools-1.4.1-patched/mpeg2enc/mpeg2enc.c Tue Aug 28 15:47:26 2001 @@ -641,7 +641,7 @@ if( buf == NULL ) { - error("malloc failed\n"); + mjpeg_error_exit1("malloc failed\n"); } adjust = BUFFER_ALIGN-((int)buf)%BUFFER_ALIGN; if( adjust == BUFFER_ALIGN ) @@ -716,7 +716,7 @@ /* clip table */ if (!(clp = (uint8_t *)malloc(1024))) - error("malloc failed\n"); + mjpeg_error_exit1("malloc failed\n"); clp+= 384; for (i=-384; i<640; i++) clp[i] = (i<0) ? 0 : ((i>255) ? 255 : i); diff -Nru mjpegtools-1.4.1/mpeg2enc/putseq.c mjpegtools-1.4.1-patched/mpeg2enc/putseq.c --- mjpegtools-1.4.1/mpeg2enc/putseq.c Sun Jun 3 03:24:10 2001 +++ mjpegtools-1.4.1-patched/mpeg2enc/putseq.c Tue Aug 28 15:47:26 2001 @@ -642,9 +642,9 @@ #endif } -semaphore_t worker_available = SEMAPHORE_INITIALIZER; -semaphore_t picture_available = SEMAPHORE_INITIALIZER; -semaphore_t picture_started = SEMAPHORE_INITIALIZER; +mp_semaphore_t worker_available = SEMAPHORE_INITIALIZER; +mp_semaphore_t picture_available = SEMAPHORE_INITIALIZER; +mp_semaphore_t picture_started = SEMAPHORE_INITIALIZER; #ifdef SINGLE_THREADED static void stencodeworker(pict_data_s *picture) diff -Nru mjpegtools-1.4.1/mpeg2enc/synchrolib.c mjpegtools-1.4.1-patched/mpeg2enc/synchrolib.c --- mjpegtools-1.4.1/mpeg2enc/synchrolib.c Wed Apr 25 14:55:36 2001 +++ mjpegtools-1.4.1-patched/mpeg2enc/synchrolib.c Tue Aug 28 15:47:26 2001 @@ -60,14 +60,14 @@ } -void mp_semaphore_init( semaphore_t *sema, int init_count ) +void mp_semaphore_init( mp_semaphore_t *sema, int init_count ) { pthread_mutex_init( &sema->mutex, NULL ); pthread_cond_init( &sema->raised, NULL ); sema->count = init_count; } -void mp_semaphore_wait( semaphore_t *sema) +void mp_semaphore_wait( mp_semaphore_t *sema) { pthread_mutex_lock( &sema->mutex ); while( sema->count == 0 ) @@ -78,7 +78,7 @@ pthread_mutex_unlock( &sema->mutex ); } -void mp_semaphore_signal( semaphore_t *sema, int count ) +void mp_semaphore_signal( mp_semaphore_t *sema, int count ) { pthread_mutex_lock( &sema->mutex ); sema->count += count; diff -Nru mjpegtools-1.4.1/mpeg2enc/synchrolib.h mjpegtools-1.4.1-patched/mpeg2enc/synchrolib.h --- mjpegtools-1.4.1/mpeg2enc/synchrolib.h Wed Apr 25 14:55:15 2001 +++ mjpegtools-1.4.1-patched/mpeg2enc/synchrolib.h Tue Aug 28 15:47:26 2001 @@ -44,7 +44,7 @@ pthread_mutex_t mutex; pthread_cond_t raised; volatile int count; -} semaphore_t; +} mp_semaphore_t; @@ -61,11 +61,11 @@ void sync_guard_update( sync_guard_t *guard, int predicate ); -void mp_semaphore_init( semaphore_t *sema, int init_count ); +void mp_semaphore_init( mp_semaphore_t *sema, int init_count ); -void mp_semaphore_wait( semaphore_t *sema); +void mp_semaphore_wait( mp_semaphore_t *sema); -void mp_semaphore_signal( semaphore_t *sema, int count ); +void mp_semaphore_signal( mp_semaphore_t *sema, int count ); #endif diff -Nru mjpegtools-1.4.1/mplex/Makefile.am mjpegtools-1.4.1-patched/mplex/Makefile.am --- mjpegtools-1.4.1/mplex/Makefile.am Tue Jun 5 12:20:31 2001 +++ mjpegtools-1.4.1-patched/mplex/Makefile.am Tue Aug 28 15:47:27 2001 @@ -18,6 +18,6 @@ systems.c \ vector.c vector.h -mplex_LDADD = -L$(top_srcdir)/utils -lutils -lm +mplex_LDADD = $(top_srcdir)/utils/libutils.a -lm diff -Nru mjpegtools-1.4.1/mplex/Makefile.in mjpegtools-1.4.1-patched/mplex/Makefile.in --- mjpegtools-1.4.1/mplex/Makefile.in Mon Jun 25 02:18:09 2001 +++ mjpegtools-1.4.1-patched/mplex/Makefile.in Tue Aug 28 15:47:27 2001 @@ -104,7 +104,7 @@ mplex_SOURCES = main.c main.h bits.c bits.h buffer.c inits.c inptstrm.c interact.c multplex.c systems.c vector.c vector.h -mplex_LDADD = -L$(top_srcdir)/utils -lutils -lm +mplex_LDADD = $(top_srcdir)/utils/libutils.a -lm mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs CONFIG_HEADER = ../config.h CONFIG_CLEAN_FILES = diff -Nru mjpegtools-1.4.1/scripts/lav2mpeg mjpegtools-1.4.1-patched/scripts/lav2mpeg --- mjpegtools-1.4.1/scripts/lav2mpeg Tue Jun 5 11:21:25 2001 +++ mjpegtools-1.4.1-patched/scripts/lav2mpeg Tue Aug 28 15:47:27 2001 @@ -32,8 +32,12 @@ bitdrop="" test="0" hires="" -MPEGENC=mpeg2enc -MPLEX=mplex +BIN=/usr/local/bin +MPEGENC=${BIN}/mpeg2enc +MPLEX=${BIN}/mplex +LAV2YUV=${BIN}/lav2yuv +LAV2WAV=${BIN}/lav2wav +MP2ENC=${BIN}/mp2enc dst="" conc="0" mplexflags="" @@ -73,9 +77,10 @@ S) echo SVCD mode: generate SVCD compliant output. quality="-m 2 -F 3 -q 12 -b 2500 -B 246 -V 230 -s -g 6 -G 15" - mplexflags="-f 4" + mplexflags="-V -f 4" mpv="m2v" scale="2" + quality="-h -4 1 -2 1 -m 2 -F 3 -q 12 -b 2500 -B 246 -V 230 -s -g 6 -G 15" ;; X) echo "Xtreme software mode: optimise for sware playback" @@ -136,19 +141,7 @@ trap tidy_exit SIGINT trap tidy_exit SIGHUP -# Get the number of available CPU's -cpus=`grep processor /proc/cpuinfo | wc --lines` - -if [ "x$cpus" = "x" ] -then cpus=1 -fi - -if [ $cpus = "0" ] -then -cpus=1 -fi -cpus=$[$cpus] echo CPUS = "$cpus" # An optimisation for wall-clock time not efficiency @@ -180,8 +173,9 @@ tidyfile=${r}.${mpv} fi # If you have "buffer" and an SMP machine use the commented out version... - lav2yuv -v 1 ${geometry} -s ${scale} ${noise} $f | buffer -b 4M | ${MPEGENC} -v 1 -M $cpus ${quality} -S 670 ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv} -# lav2yuv -s ${scale} ${noise} $f | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv} + #lav2yuv -v 1 ${geometry} -s ${scale} ${noise} $f | buffer -b 4M | ${MPEGENC} -v 1 -M $cpus ${quality} -S 670 ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv} + echo "${LAV2YUV} -s ${scale} ${noise} $f | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv}" + ${LAV2YUV} -s ${scale} ${noise} $f | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv} if [ ! $? = 0 ] then exit $? @@ -202,7 +196,8 @@ # See "transcode" for suitable flags if [ $test = 0 ] then - lav2wav $f | nice -n 15 mp2enc -V -o ${r}.mp2 + echo "${LAV2WAV} $f | nice -n 15 ${MP2ENC} -V -o ${r}.mp2" + ${LAV2WAV} $f | nice -n 15 ${MP2ENC} -V -o ${r}.mp2 fi fi # Don't mux / aenc two at once - screws up NFS... @@ -211,7 +206,8 @@ sleep 30 done echo > ${r%%.*}.mux - nice -n 15 ${MPLEX} -v 1 -S 0 -q ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 + echo "nice -n 15 ${MPLEX} -v 1 -S 0 ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 " + nice -n 15 ${MPLEX} -v 1 -S 0 ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 rm -f ${r%%.*}.mux # Uncomment this if you want the raw files deleted # rm -f ${r}.${mpv} ${r}.mp2 diff -Nru mjpegtools-1.4.1/scripts/mksvcd mjpegtools-1.4.1-patched/scripts/mksvcd --- mjpegtools-1.4.1/scripts/mksvcd Wed Dec 31 18:00:00 1969 +++ mjpegtools-1.4.1-patched/scripts/mksvcd Tue Aug 28 15:47:27 2001 @@ -0,0 +1,158 @@ +#!/bin/bash + +# +# A convenient front-end for making SVCDs +# Allows "1 command" production of a video stream... +# + +function usage () +{ + echo "Usage: $0 [-S] [-h] [-s radius] [-o dstdir] srcfile ..." + echo "S - SVCD mode - generates SVCD compiliant stream" + echo "h - Activate hi-res quantisation matrix" + echo "s - Set search radius" + echo "o - Set output directory" + echo "SVCD images can be burnt to CD using vcdimager" +exit 1 +} + +function tidy_exit () +{ + rm -f $tidyfile + exit 0 +} + +scale=0 +kind=avi +stereo=1 +quality="" +search=16 +bitdrop="" +test="0" +hires="" +BIN=/usr/local/bin +MPEGENC=${BIN}/mpeg2enc +MPLEX=${BIN}/mplex +LAV2YUV=${BIN}/lav2yuv +LAV2WAV=${BIN}/lav2wav +MP2ENC=${BIN}/mp2enc +YUVSCALER=${BIN}/yuvscaler +YUVMEDIANFILTER=${BIN}/yuvmedianfilter +dst="" +conc="0" +mplexflags="" +mpv="m1v" + +while getopts ":q:s:o:Sh" opt +do +case $opt in +S) + echo SVCD mode: generate SVCD compliant output. + quality="-a 2 -n n -4 1 -2 1 -m 2 -F 3 -q 6 -b 2500 -B 246 -V 230 -s -g 9 -G 18" + mplexflags="-V -f 4" + mpv="m2v" + scale="SVCD" +;; +h) echo "Activating hi-res quantisation matrix" +hires="-h" +;; +s) echo "Setting search radius to $OPTARG" +search=$OPTARG +;; +o) echo "Setting destination directory to $OPTARG" +dst=$OPTARG +;; +?) + usage +;; +esac +done + +if [ $stereo = 1 ] +then + aencbpr=224 +else + aencbpr=112 +fi + +shift $[$OPTIND-1] + +if [ x$1 = x ] +then + usage +fi + +trap tidy_exit SIGINT +trap tidy_exit SIGHUP + +cpus=1 +echo CPUS = "$cpus" + +# An optimisation for wall-clock time not efficiency +if [ $cpus = 2 ] +then +cpus=3 +fi + +echo -n "Encoding commences " +date + + +for f in $* +do + fname=${f%.*} + kind=${f##${fname}.} + if [ ! x${dst} = "x" ] + then + fname=${f##*/} + r=${dst}/${fname%%.${kind}} + else + r=${fname} + fi + mpgfile=${r}.%d.mpg + if [ ! ${conc} = 1 -o ! -f ${r}.${mpv} ] + then + if [ ${conc} = 1 ] + then + tidyfile=${r}.${mpv} + fi + echo "${YUVSCALER} -O ${scale} -n n $f | ${YUVMEDIANFILTER} | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv}" + ${YUVSCALER} -O ${scale} -n n $f | ${YUVMEDIANFILTER} | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv} + if [ ! $? = 0 ] + then + exit $? + fi + + if [ ! ${conc} = 1 -o ! -f ${r}.mp2 ] + then + if [ $conc = 1 ] + then + tidyfile=${r}.mp2 + fi + # Don't mux / aenc two at once - screws up NFS... + while [ -r ${r%%.*}.mux ] + do + sleep 30 + done + # You probably want to replace this with toolame + # See "transcode" for suitable flags + if [ $test = 0 ] + then + echo "${LAV2WAV} $f | nice -n 15 ${MP2ENC} -V -o ${r}.mp2" + ${LAV2WAV} $f | nice -n 15 ${MP2ENC} -V -o ${r}.mp2 + fi + fi + # Don't mux / aenc two at once - screws up NFS... + while [ -r ${r%%.*}.mux ] + do + sleep 30 + done + echo > ${r%%.*}.mux + echo "nice -n 15 ${MPLEX} -v 1 -S 0 ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 " + nice -n 15 ${MPLEX} -v 1 -S 0 ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 + rm -f ${r%%.*}.mux +# Uncomment this if you want the raw files deleted +# rm -f ${r}.${mpv} ${r}.mp2 + fi +done + diff -Nru mjpegtools-1.4.1/scripts/mkvcd mjpegtools-1.4.1-patched/scripts/mkvcd --- mjpegtools-1.4.1/scripts/mkvcd Wed Dec 31 18:00:00 1969 +++ mjpegtools-1.4.1-patched/scripts/mkvcd Tue Aug 28 15:47:27 2001 @@ -0,0 +1,165 @@ +#!/bin/bash + +# +# A convenient front-end for making VCDs +# Allows "1 command" production of a video stream... +# + +function usage () +{ + echo "Usage: $0 [-V] [-X] [-h] [-s radius] [-o dstdir] srcfile ..." + echo "V - VCD mode - generates VCD compiliant stream" + echo "X - XVCD mode - generates XVCD compiliant stream" + echo "h - Activate hi-res quantisation matrix" + echo "s - Set search radius" + echo "o - Set output directory" + echo "(X)VCD images can be burnt to CD using vcdimager" +exit 1 +} + +function tidy_exit () +{ + rm -f $tidyfile + exit 0 +} + +scale=0 +kind=avi +stereo=1 +quality="" +search=16 +bitdrop="" +test="0" +hires="" +BIN=/usr/local/bin +MPEGENC=${BIN}/mpeg2enc +MPLEX=${BIN}/mplex +LAV2YUV=${BIN}/lav2yuv +LAV2WAV=${BIN}/lav2wav +MP2ENC=${BIN}/mp2enc +YUVSCALER=${BIN}/yuvscaler +dst="" +conc="0" +mplexflags="" +mpv="m1v" + +while getopts ":q:s:o:VXh" opt +do +case $opt in +V) + echo VCD mode: generate VCD compliant output. + quality="-a 12 -n n -4 1 -2 1 -B 300 -s -g 9 -G 15" + mplexflags="-f 2 -b 50" + mpv="m1v" + scale="VCD" +;; +X) + echo XVCD mode: generate XVCD output. + quality="-a 12 -n n -4 1 -2 1 -b 2200 -B 300 -s -g 9 -G 15" + mplexflags="-f 2 -b 55 -r 2500" + mpv="m1v" + scale="VCD" +;; +h) echo "Activating hi-res quantisation matrix" +hires="-h" +;; +s) echo "Setting search radius to $OPTARG" +search=$OPTARG +;; +o) echo "Setting destination directory to $OPTARG" +dst=$OPTARG +;; +?) + usage +;; +esac +done + +if [ $stereo = 1 ] +then + aencbpr=224 +else + aencbpr=112 +fi + +shift $[$OPTIND-1] + +if [ x$1 = x ] +then + usage +fi + +trap tidy_exit SIGINT +trap tidy_exit SIGHUP + +cpus=1 +echo CPUS = "$cpus" + +# An optimisation for wall-clock time not efficiency +if [ $cpus = 2 ] +then +cpus=3 +fi + +echo -n "Encoding commences " +date + + +for f in $* +do + fname=${f%.*} + kind=${f##${fname}.} + if [ ! x${dst} = "x" ] + then + fname=${f##*/} + r=${dst}/${fname%%.${kind}} + else + r=${fname} + fi + mpgfile=${r}.%d.mpg + if [ ! ${conc} = 1 -o ! -f ${r}.${mpv} ] + then + if [ ${conc} = 1 ] + then + tidyfile=${r}.${mpv} + fi + echo "${YUVSCALER} -O ${scale} -n n $f | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv}" + ${YUVSCALER} -O ${scale} -n n $f | ${MPEGENC} -S 670 ${quality} ${hires} -r ${search} ${testmpeg} -o ${r}.${mpv} + if [ ! $? = 0 ] + then + exit $? + fi + + if [ ! ${conc} = 1 -o ! -f ${r}.mp2 ] + then + if [ $conc = 1 ] + then + tidyfile=${r}.mp2 + fi + # Don't mux / aenc two at once - screws up NFS... + while [ -r ${r%%.*}.mux ] + do + sleep 30 + done + # You probably want to replace this with toolame + # See "transcode" for suitable flags + if [ $test = 0 ] + then + echo "${LAV2WAV} $f | nice -n 15 ${MP2ENC} -V -o ${r}.mp2" + ${LAV2WAV} $f | nice -n 15 ${MP2ENC} -V -o ${r}.mp2 + fi + fi + # Don't mux / aenc two at once - screws up NFS... + while [ -r ${r%%.*}.mux ] + do + sleep 30 + done + echo > ${r%%.*}.mux + echo "nice -n 15 ${MPLEX} -v 1 -S 0 ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 " + nice -n 15 ${MPLEX} -v 1 -S 0 ${mplexflags} ${testmplex} -o ${mpgfile} ${r}.${mpv} ${r}.mp2 + rm -f ${r%%.*}.mux +# Uncomment this if you want the raw files deleted +# rm -f ${r}.${mpv} ${r}.mp2 + fi +done +