From: Christophe Massiot Date: Mon, 12 Aug 2002 22:12:51 +0000 (+0000) Subject: * Fixed a variable overflow bug in the audio output. X-Git-Tag: 0.5.0~1094 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=8d5c85f26f79ef0853bb5f23ff33809a8999716c;p=vlc * Fixed a variable overflow bug in the audio output. * Prepared for some advances in the aout3 clock management. * Added the first stone of the forthcoming stream output. --- diff --git a/Makefile b/Makefile index bef5e835a6..3c36462e7b 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,7 @@ PLAYLIST := playlist INPUT := input input_ext-plugins input_ext-dec input_ext-intf input_dec input_programs input_clock input_info VIDEO_OUTPUT := video_output video_text vout_pictures vout_subpictures AUDIO_OUTPUT := audio_output filters input mixer output +STREAM_OUTPUT := stream_output MISC := mtime modules threads cpu configuration netutils iso_lang messages objects extras LIBVLC_OBJ := $(LIBVLC:%=src/%.o) \ @@ -31,6 +32,7 @@ LIBVLC_OBJ := $(LIBVLC:%=src/%.o) \ $(INPUT:%=src/input/%.o) \ $(VIDEO_OUTPUT:%=src/video_output/%.o) \ $(AUDIO_OUTPUT:%=src/audio_output/%.o) \ + $(STREAM_OUTPUT:%=src/stream_output/%.o) \ $(MISC:%=src/misc/%.o) VLC_OBJ := $(VLC:%=src/%.o) diff --git a/include/aout_internal.h b/include/aout_internal.h index bda41d08b2..a36733210d 100644 --- a/include/aout_internal.h +++ b/include/aout_internal.h @@ -2,7 +2,7 @@ * aout_internal.h : internal defines for audio output ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: aout_internal.h,v 1.2 2002/08/08 00:35:10 sam Exp $ + * $Id: aout_internal.h,v 1.3 2002/08/12 22:12:50 massiot Exp $ * * Authors: Christophe Massiot * @@ -45,27 +45,32 @@ typedef struct aout_alloc_t if ( (p_alloc)->i_alloc_type == AOUT_ALLOC_STACK ) \ { \ (p_new_buffer) = alloca( (u64)(p_alloc)->i_bytes_per_sec \ - * i_nb_usec \ + * (i_nb_usec) \ / 1000000 + 1 + sizeof(aout_buffer_t) ); \ } \ else \ { \ (p_new_buffer) = malloc( (u64)(p_alloc)->i_bytes_per_sec \ - * i_nb_usec \ + * (i_nb_usec) \ / 1000000 + 1 + sizeof(aout_buffer_t) ); \ } \ - (p_new_buffer)->i_alloc_type = (p_alloc)->i_alloc_type; \ - (p_new_buffer)->i_size = (u64)(p_alloc)->i_bytes_per_sec \ - * i_nb_usec / 1000000 + 1; \ - (p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer) \ - + sizeof(aout_buffer_t); \ - if ( (p_previous_buffer) != NULL ) \ + if ( p_new_buffer != NULL ) \ { \ - (p_new_buffer)->start_date = \ - ((aout_buffer_t *)p_previous_buffer)->start_date; \ - (p_new_buffer)->end_date = \ - ((aout_buffer_t *)p_previous_buffer)->end_date; \ + (p_new_buffer)->i_alloc_type = (p_alloc)->i_alloc_type; \ + (p_new_buffer)->i_size = (u64)(p_alloc)->i_bytes_per_sec \ + * (i_nb_usec) / 1000000 + 1; \ + (p_new_buffer)->p_buffer = (byte_t *)(p_new_buffer) \ + + sizeof(aout_buffer_t); \ + if ( (p_previous_buffer) != NULL ) \ + { \ + (p_new_buffer)->start_date = \ + ((aout_buffer_t *)p_previous_buffer)->start_date;\ + (p_new_buffer)->end_date = \ + ((aout_buffer_t *)p_previous_buffer)->end_date; \ + } \ } \ + /* we'll keep that for a while --Meuuh */ \ + /* else printf("%s:%d\n", __FILE__, __LINE__); */ \ } #define aout_BufferFree( p_buffer ) \ @@ -184,6 +189,7 @@ struct aout_input_t aout_fifo_t fifo; + mtime_t next_packet_date; byte_t * p_first_byte_to_mix; }; diff --git a/include/defs.h.in b/include/defs.h.in index d963a95f9f..248fe6e5f8 100644 --- a/include/defs.h.in +++ b/include/defs.h.in @@ -1,378 +1,407 @@ -/* include/defs.h.in. Generated automatically from configure.in by autoheader 2.13. */ +/* include/defs.h.in. Generated from configure.in by autoheader. */ -/* Define if using alloca.c. */ -#undef C_ALLOCA +/* Maximum supported data alignment */ +#undef ATTRIBUTE_ALIGNED_MAX -/* Define to empty if the keyword does not work. */ -#undef const +/* Define if $CC groks 3D Now! inline assembly. */ +#undef CAN_COMPILE_3DNOW + +/* Define if $CC groks AltiVec inline assembly. */ +#undef CAN_COMPILE_ALTIVEC + +/* Define if your compiler groks C AltiVec extensions. */ +#undef CAN_COMPILE_C_ALTIVEC + +/* Define if $CC groks SSE inline assembly. */ +#undef CAN_COMPILE_SSE + +/* The ./configure command line */ +#undef CONFIGURE_LINE + +/* Copyright string */ +#undef COPYRIGHT_MESSAGE -/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems. - This function is required for alloca.c support on those systems. */ +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ #undef CRAY_STACKSEG_END -/* Define if you have alloca, as a function or macro. */ +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define if defines DPMSInfo. */ +#undef DPMSINFO_IN_DPMS_H + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +#undef ENABLE_NLS + +/* Define to 1 if you have the header file. */ +#undef HAVE_A52DEC_A52_H + +/* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA -/* Define if you have and it should be used (not on Ultrix). */ +/* Define to 1 if you have and it should be used (not on Ultrix). + */ #undef HAVE_ALLOCA_H -/* Define if you have a working `mmap' system call. */ -#undef HAVE_MMAP +/* Define to 1 if you have the header file. */ +#undef HAVE_ARGZ_H -/* Define as __inline if that's what the C compiler calls it. */ -#undef inline +/* Define to 1 if you have the header file. */ +#undef HAVE_ARPA_INET_H -/* Define to `long' if doesn't define. */ -#undef off_t +/* Define to 1 if you have the `atoll' function. */ +#undef HAVE_ATOLL -/* Define as the return type of signal handlers (int or void). */ -#undef RETSIGTYPE +/* Define to 1 if you have the header file. */ +#undef HAVE_COCOA_COCOA_H -/* Define to `unsigned' if doesn't define. */ -#undef size_t +/* Define to 1 if you have the header file. */ +#undef HAVE_CTHREADS_H -/* If using the C implementation of alloca, define if you know the - direction of stack growth for your system; otherwise it will be - automatically deduced at run-time. - STACK_DIRECTION > 0 => grows toward higher addresses - STACK_DIRECTION < 0 => grows toward lower addresses - STACK_DIRECTION = 0 => direction of growth unknown - */ -#undef STACK_DIRECTION +/* Define to 1 if you have the `dcgettext' function. */ +#undef HAVE_DCGETTEXT -/* Define if you have the ANSI C header files. */ -#undef STDC_HEADERS +/* Define to 1 if you have the header file. */ +#undef HAVE_DDRAW_H -/* Define if you can safely include both and . */ -#undef TIME_WITH_SYS_TIME +/* Define if defines nanosleep. */ +#undef HAVE_DECL_NANOSLEEP -/* Define if you have the __argz_count function. */ -#undef HAVE___ARGZ_COUNT +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H -/* Define if you have the __argz_next function. */ -#undef HAVE___ARGZ_NEXT +/* Define to 1 if you have the header file. */ +#undef HAVE_DVBPSI_DR_H -/* Define if you have the __argz_stringify function. */ -#undef HAVE___ARGZ_STRINGIFY +/* Define to 1 if you have the header file. */ +#undef HAVE_DVDCSS_DVDCSS_H -/* Define if you have the atoll function. */ -#undef HAVE_ATOLL +/* Define to 1 if you have the header file. */ +#undef HAVE_DVDPLAY_DVDPLAY_H -/* Define if you have the dcgettext function. */ -#undef HAVE_DCGETTEXT +/* Define to 1 if you have the header file. */ +#undef HAVE_DVDREAD_DVD_READER_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FAAD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_FCNTL_H -/* Define if you have the feof_unlocked function. */ +/* Define to 1 if you have the `feof_unlocked' function. */ #undef HAVE_FEOF_UNLOCKED -/* Define if you have the fgets_unlocked function. */ +/* Define to 1 if you have the `fgets_unlocked' function. */ #undef HAVE_FGETS_UNLOCKED -/* Define if you have the getcwd function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_GDK_GDK_H + +/* Define to 1 if you have the `getcwd' function. */ #undef HAVE_GETCWD -/* Define if you have the getegid function. */ +/* Define to 1 if you have the `getegid' function. */ #undef HAVE_GETEGID -/* Define if you have the geteuid function. */ +/* Define to 1 if you have the `geteuid' function. */ #undef HAVE_GETEUID -/* Define if you have the getgid function. */ +/* Define to 1 if you have the `getgid' function. */ #undef HAVE_GETGID -/* Define if you have the gethostbyname2 function. */ +/* Define to 1 if you have the `gethostbyname2' function. */ #undef HAVE_GETHOSTBYNAME2 -/* Define if you have the getpagesize function. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_GETOPT_H + +/* getopt support */ +#undef HAVE_GETOPT_LONG + +/* Define to 1 if you have the `getpagesize' function. */ #undef HAVE_GETPAGESIZE -/* Define if you have the getpwuid function. */ +/* Define to 1 if you have the `getpwuid' function. */ #undef HAVE_GETPWUID -/* Define if you have the gettimeofday function. */ +/* Define if the GNU gettext() function is already present or preinstalled. */ +#undef HAVE_GETTEXT + +/* Define to 1 if you have the `gettimeofday' function. */ #undef HAVE_GETTIMEOFDAY -/* Define if you have the getuid function. */ +/* Define to 1 if you have the `getuid' function. */ #undef HAVE_GETUID -/* Define if you have the isatty function. */ -#undef HAVE_ISATTY - -/* Define if you have the memalign function. */ -#undef HAVE_MEMALIGN - -/* Define if you have the mempcpy function. */ -#undef HAVE_MEMPCPY - -/* Define if you have the munmap function. */ -#undef HAVE_MUNMAP - -/* Define if you have the posix_memalign function. */ -#undef HAVE_POSIX_MEMALIGN - -/* Define if you have the putenv function. */ -#undef HAVE_PUTENV - -/* Define if you have the select function. */ -#undef HAVE_SELECT - -/* Define if you have the setenv function. */ -#undef HAVE_SETENV - -/* Define if you have the setlocale function. */ -#undef HAVE_SETLOCALE - -/* Define if you have the sigrelse function. */ -#undef HAVE_SIGRELSE - -/* Define if you have the stpcpy function. */ -#undef HAVE_STPCPY +/* Define to 1 if you have the header file. */ +#undef HAVE_GLIB_H -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP +/* Define to 1 if you have the header file. */ +#undef HAVE_GNOME_H -/* Define if you have the strchr function. */ -#undef HAVE_STRCHR +/* Define to 1 if you have the header file. */ +#undef HAVE_GTK_GTK_H -/* Define if you have the strdup function. */ -#undef HAVE_STRDUP +/* Define if you have the iconv() function. */ +#undef HAVE_ICONV -/* Define if you have the strerror function. */ -#undef HAVE_STRERROR +/* Define to 1 if you have the header file. */ +#undef HAVE_IMAGE_H -/* Define if you have the strndup function. */ -#undef HAVE_STRNDUP +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H -/* Define if you have the strtod function. */ -#undef HAVE_STRTOD +/* For FreeBSD VCD support */ +#undef HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H -/* Define if you have the strtol function. */ -#undef HAVE_STRTOL +/* Define to 1 if you have the `isatty' function. */ +#undef HAVE_ISATTY -/* Define if you have the strtoul function. */ -#undef HAVE_STRTOUL +/* Define to 1 if you have the header file. */ +#undef HAVE_KERNEL_OS_H -/* Define if you have the swab function. */ -#undef HAVE_SWAB +/* Define to 1 if you have the header file. */ +#undef HAVE_KERNEL_SCHEDULER_H -/* Define if you have the tsearch function. */ -#undef HAVE_TSEARCH +/* Define if you have and nl_langinfo(CODESET). */ +#undef HAVE_LANGINFO_CODESET -/* Define if you have the vasprintf function. */ -#undef HAVE_VASPRINTF +/* Define if your file defines LC_MESSAGES. */ +#undef HAVE_LC_MESSAGES -/* Define if you have the header file. */ -#undef HAVE_COCOA_COCOA_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBDV_DV_H -/* Define if you have the header file. */ -#undef HAVE_PH_H +/* Define to 1 if you have the `pth' library (-lpth). */ +#undef HAVE_LIBPTH -/* Define if you have the header file. */ -#undef HAVE_X11_XLIB_H +/* Define to 1 if you have the `st' library (-lst). */ +#undef HAVE_LIBST -/* Define if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_XV_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIBV4L_V4L_H -/* Define if you have the header file. */ -#undef HAVE_X11_EXTENSIONS_DPMS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LIMITS_H -/* Define if you have the header file. */ -#undef HAVE_A52DEC_A52_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_FB_H -/* Define if you have the header file. */ -#undef HAVE_ARGZ_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LINUX_VERSION_H -/* Define if you have the header file. */ -#undef HAVE_ARPA_INET_H +/* Define to 1 if you have the header file. */ +#undef HAVE_LOCALE_H -/* Define if you have the header file. */ -#undef HAVE_CTHREADS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_PARAM_H -/* Define if you have the header file. */ -#undef HAVE_DDRAW_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MACHINE_SOUNDCARD_H -/* Define if you have the header file. */ -#undef HAVE_DLFCN_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MAD_H -/* Define if you have the header file. */ -#undef HAVE_DVBPSI_DR_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MALLOC_H -/* Define if you have the header file. */ -#undef HAVE_DVDCSS_DVDCSS_H +/* Define to 1 if you have the `memalign' function. */ +#undef HAVE_MEMALIGN -/* Define if you have the header file. */ -#undef HAVE_DVDPLAY_DVDPLAY_H +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H -/* Define if you have the header file. */ -#undef HAVE_DVDREAD_DVD_READER_H +/* Define to 1 if you have the `mempcpy' function. */ +#undef HAVE_MEMPCPY -/* Define if you have the header file. */ -#undef HAVE_FAAD_H +/* Define to 1 if you have a working `mmap' system call. */ +#undef HAVE_MMAP -/* Define if you have the header file. */ -#undef HAVE_FCNTL_H +/* Define to 1 if you have the `munmap' function. */ +#undef HAVE_MUNMAP -/* Define if you have the header file. */ -#undef HAVE_GDK_GDK_H +/* Define if nanosleep is available. */ +#undef HAVE_NANOSLEEP -/* Define if you have the header file. */ -#undef HAVE_GETOPT_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NETINET_IN_H -/* Define if you have the header file. */ -#undef HAVE_GLIB_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NET_IF_H -/* Define if you have the header file. */ -#undef HAVE_GNOME_H +/* Define to 1 if you have the header file. */ +#undef HAVE_NL_TYPES_H -/* Define if you have the header file. */ -#undef HAVE_GTK_GTK_H +/* Define to 1 if you have the header file. */ +#undef HAVE_OGG_OGG_H -/* Define if you have the header file. */ -#undef HAVE_IMAGE_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PH_H -/* Define if you have the header file. */ -#undef HAVE_INTTYPES_H +/* Define to 1 if you have the `posix_memalign' function. */ +#undef HAVE_POSIX_MEMALIGN -/* Define if you have the header file. */ -#undef HAVE_KERNEL_OS_H +/* Define to 1 if you have the header file. */ +#undef HAVE_PTHREAD_H -/* Define if you have the header file. */ -#undef HAVE_KERNEL_SCHEDULER_H +/* Define to 1 if you have the `putenv' function. */ +#undef HAVE_PUTENV -/* Define if you have the header file. */ -#undef HAVE_LIBDV_DV_H +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT -/* Define if you have the header file. */ -#undef HAVE_LIBV4L_V4L_H +/* Define to 1 if you have the `setenv' function. */ +#undef HAVE_SETENV -/* Define if you have the header file. */ -#undef HAVE_LIMITS_H +/* Define to 1 if you have the `setlocale' function. */ +#undef HAVE_SETLOCALE -/* Define if you have the header file. */ -#undef HAVE_LINUX_FB_H +/* Define to 1 if you have the `sigrelse' function. */ +#undef HAVE_SIGRELSE -/* Define if you have the header file. */ -#undef HAVE_LINUX_VERSION_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SOUNDCARD_H -/* Define if you have the header file. */ -#undef HAVE_LOCALE_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDDEF_H -/* Define if you have the header file. */ -#undef HAVE_MACHINE_PARAM_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H -/* Define if you have the header file. */ -#undef HAVE_MACHINE_SOUNDCARD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H -/* Define if you have the header file. */ -#undef HAVE_MAD_H +/* Define to 1 if you have the `stpcpy' function. */ +#undef HAVE_STPCPY -/* Define if you have the header file. */ -#undef HAVE_MALLOC_H +/* Define to 1 if you have the `strcasecmp' function. */ +#undef HAVE_STRCASECMP -/* Define if you have the header file. */ -#undef HAVE_NET_IF_H +/* Define to 1 if you have the `strchr' function. */ +#undef HAVE_STRCHR -/* Define if you have the header file. */ -#undef HAVE_NETINET_IN_H +/* Define to 1 if you have the `strdup' function. */ +#undef HAVE_STRDUP -/* Define if you have the header file. */ -#undef HAVE_NL_TYPES_H +/* Define to 1 if you have the `strerror' function. */ +#undef HAVE_STRERROR -/* Define if you have the header file. */ -#undef HAVE_OGG_OGG_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H -/* Define if you have the header file. */ -#undef HAVE_PTHREAD_H +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H -/* Define if you have the header file. */ -#undef HAVE_SOUNDCARD_H +/* Define to 1 if you have the `strndup' function. */ +#undef HAVE_STRNDUP -/* Define if you have the header file. */ -#undef HAVE_STDDEF_H +/* Define to 1 if you have the `strtod' function. */ +#undef HAVE_STRTOD -/* Define if you have the header file. */ -#undef HAVE_STDINT_H +/* Define to 1 if you have the `strtol' function. */ +#undef HAVE_STRTOL -/* Define if you have the header file. */ -#undef HAVE_STDLIB_H +/* Define to 1 if you have the `strtoul' function. */ +#undef HAVE_STRTOUL -/* Define if you have the header file. */ -#undef HAVE_STRING_H +/* Define if defines struct timespec. */ +#undef HAVE_STRUCT_TIMESPEC -/* Define if you have the header file. */ -#undef HAVE_STRINGS_H +/* Define to 1 if you have the `swab' function. */ +#undef HAVE_SWAB -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_INT_TYPES_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_PARAM_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SHM_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKET_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOCKIO_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_SOUNDCARD_H -/* Define if you have the header file. */ -#undef HAVE_SYS_TIME_H +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIMES_H -/* Define if you have the header file. */ +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TIME_H + +/* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H -/* Define if you have the header file. */ +/* Define to 1 if you have the `tsearch' function. */ +#undef HAVE_TSEARCH + +/* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H -/* Define if you have the header file. */ -#undef HAVE_ZLIB_H +/* Support for variadic macros */ +#undef HAVE_VARIADIC_MACROS -/* Define if you have the pth library (-lpth). */ -#undef HAVE_LIBPTH +/* Define to 1 if you have the `vasprintf' function. */ +#undef HAVE_VASPRINTF -/* Define if you have the st library (-lst). */ -#undef HAVE_LIBST +/* Define to 1 if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_DPMS_H -/* Package name */ -#undef VLC_PACKAGE +/* Define to 1 if you have the header file. */ +#undef HAVE_X11_EXTENSIONS_XV_H -/* Package version */ -#undef VLC_VERSION +/* Define to 1 if you have the header file. */ +#undef HAVE_X11_XLIB_H -/* Define if you have the iconv() function. */ -#undef HAVE_ICONV +/* Define to 1 if you have the header file. */ +#undef HAVE_ZLIB_H + +/* Define to 1 if you have the `__argz_count' function. */ +#undef HAVE___ARGZ_COUNT + +/* Define to 1 if you have the `__argz_next' function. */ +#undef HAVE___ARGZ_NEXT + +/* Define to 1 if you have the `__argz_stringify' function. */ +#undef HAVE___ARGZ_STRINGIFY /* Define as const if the declaration of iconv() needs const. */ #undef ICONV_CONST -/* Define if you have and nl_langinfo(CODESET). */ -#undef HAVE_LANGINFO_CODESET +/* String suffix for module functions */ +#undef MODULE_SUFFIX -/* Define if your file defines LC_MESSAGES. */ -#undef HAVE_LC_MESSAGES +/* Symbol suffix for module functions */ +#undef MODULE_SYMBOL -/* Define to 1 if translation of program messages to the user's native language - is requested. */ -#undef ENABLE_NLS +/* Define if defines ntohl. */ +#undef NTOHL_IN_SYS_PARAM_H -/* Define if the GNU gettext() function is already present or preinstalled. */ -#undef HAVE_GETTEXT +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT -/* Define if nanosleep is available. */ -#undef HAVE_NANOSLEEP +/* Define to the full name of this package. */ +#undef PACKAGE_NAME -/* long getopt support */ -#undef HAVE_GETOPT_LONG +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING -/* getopt support */ -#undef HAVE_GETOPT_LONG +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION /* Define if defines pthread_cond_t. */ #undef PTHREAD_COND_T_IN_PTHREAD_H @@ -380,66 +409,56 @@ /* Define if defines pthread_once. */ #undef PTHREAD_ONCE_IN_PTHREAD_H -/* Define if defines strncasecmp. */ -#undef STRNCASECMP_IN_STRINGS_H - -/* Define if defines nanosleep. */ -#undef HAVE_DECL_NANOSLEEP - -/* Define if defines struct timespec. */ -#undef HAVE_STRUCT_TIMESPEC - -/* Define if defines DPMSInfo. */ -#undef DPMSINFO_IN_DPMS_H - -/* Define if defines ntohl. */ -#undef NTOHL_IN_SYS_PARAM_H - -/* Support for variadic macros */ -#undef HAVE_VARIADIC_MACROS - -/* Maximum supported data alignment */ -#undef ATTRIBUTE_ALIGNED_MAX - -/* Define if $CC groks 3D Now! inline assembly. */ -#undef CAN_COMPILE_3DNOW - -/* Define if $CC groks SSE inline assembly. */ -#undef CAN_COMPILE_SSE - -/* Define if $CC groks AltiVec inline assembly. */ -#undef CAN_COMPILE_ALTIVEC - -/* Define if your compiler groks C AltiVec extensions. */ -#undef CAN_COMPILE_C_ALTIVEC +/* Define if defines pth_init */ +#undef PTH_INIT_IN_PTH_H -/* For FreeBSD VCD support */ -#undef HAVE_IOC_TOC_HEADER_IN_SYS_CDIO_H +/* Define as the return type of signal handlers (`int' or `void'). */ +#undef RETSIGTYPE /* Indicate whether we should use SDL/SDL.h or SDL11/SDL.h */ #undef SDL_INCLUDE_FILE -/* big endian system */ -#undef WORDS_BIGENDIAN +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at run-time. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION -/* Define if defines pth_init */ -#undef PTH_INIT_IN_PTH_H +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if defines strncasecmp. */ +#undef STRNCASECMP_IN_STRINGS_H /* Define if defines st_init */ #undef ST_INIT_IN_ST_H +/* Define to 1 if you can safely include both and . */ +#undef TIME_WITH_SYS_TIME + /* Simple version string */ #undef VERSION_MESSAGE -/* Copyright string */ -#undef COPYRIGHT_MESSAGE +/* Package name */ +#undef VLC_PACKAGE -/* The ./configure command line */ -#undef CONFIGURE_LINE +/* Package version */ +#undef VLC_VERSION -/* String suffix for module functions */ -#undef MODULE_SUFFIX +/* big endian system */ +#undef WORDS_BIGENDIAN -/* Symbol suffix for module functions */ -#undef MODULE_SYMBOL +/* Define to empty if `const' does not conform to ANSI C. */ +#undef const +/* Define as `__inline' if that's what the C compiler calls it, or to nothing + if it is not supported. */ +#undef inline + +/* Define to `long' if does not define. */ +#undef off_t + +/* Define to `unsigned' if does not define. */ +#undef size_t diff --git a/include/input_ext-dec.h b/include/input_ext-dec.h index 2d43e785e3..839ee9af38 100644 --- a/include/input_ext-dec.h +++ b/include/input_ext-dec.h @@ -2,7 +2,7 @@ * input_ext-dec.h: structures exported to the VideoLAN decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_ext-dec.h,v 1.68 2002/08/08 00:35:10 sam Exp $ + * $Id: input_ext-dec.h,v 1.69 2002/08/12 22:12:50 massiot Exp $ * * Authors: Christophe Massiot * Michel Kaempf @@ -118,6 +118,7 @@ struct decoder_fifo_t vlc_fourcc_t i_fourcc; es_sys_t * p_demux_data; stream_ctrl_t * p_stream_ctrl; + sout_instance_t * p_sout; /* Module properties */ module_t * p_module; diff --git a/include/input_ext-intf.h b/include/input_ext-intf.h index 063dc3b8bf..5bf53a237a 100644 --- a/include/input_ext-intf.h +++ b/include/input_ext-intf.h @@ -4,7 +4,7 @@ * control the pace of reading. ***************************************************************************** * Copyright (C) 1999, 2000 VideoLAN - * $Id: input_ext-intf.h,v 1.75 2002/08/07 00:29:36 sam Exp $ + * $Id: input_ext-intf.h,v 1.76 2002/08/12 22:12:50 massiot Exp $ * * Authors: Christophe Massiot * @@ -233,6 +233,9 @@ struct stream_descriptor_t /* Stream control */ stream_ctrl_t control; + /* Optional stream output */ + sout_instance_t * p_sout; + /* Input info */ input_info_category_t * p_info; diff --git a/include/stream_output.h b/include/stream_output.h new file mode 100644 index 0000000000..64c707671a --- /dev/null +++ b/include/stream_output.h @@ -0,0 +1,50 @@ +/***************************************************************************** + * stream_output.h : stream output module + ***************************************************************************** + * Copyright (C) 2002 VideoLAN + * $Id: stream_output.h,v 1.1 2002/08/12 22:12:50 massiot Exp $ + * + * Authors: Christophe Massiot + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/***************************************************************************** + * sout_instance_t: stream output thread descriptor + *****************************************************************************/ +struct sout_instance_t +{ + VLC_COMMON_MEMBERS + + char * psz_dest; + char * psz_access; + char * psz_mux; + char * psz_name; + + module_t * p_access; + module_t * p_mux; +}; + +/***************************************************************************** + * Prototypes + *****************************************************************************/ +#define sout_NewInstance(a,b) __sout_NewInstance(VLC_OBJECT(a),b) +VLC_EXPORT( sout_instance_t *, __sout_NewInstance, ( vlc_object_t *, char * ) ); +VLC_EXPORT( void, sout_DeleteInstance, ( sout_instance_t * ) ); + +sout_fifo_t * sout_CreateFifo ( void ); +void sout_DestroyFifo ( sout_fifo_t * ); +void sout_FreeFifo ( sout_fifo_t * ); + diff --git a/include/vlc/sout.h b/include/vlc/sout.h new file mode 100644 index 0000000000..c067fe4ed2 --- /dev/null +++ b/include/vlc/sout.h @@ -0,0 +1,43 @@ +/***************************************************************************** + * sout.h: video output header for vlc + ***************************************************************************** + * Copyright (C) 2002 VideoLAN + * $Id: sout.h,v 1.1 2002/08/12 22:12:50 massiot Exp $ + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +#ifndef _VLC_SOUT_H +#define _VLC_SOUT_H 1 + +# ifdef __cplusplus +extern "C" { +# endif + +/***************************************************************************** + * Required public headers + *****************************************************************************/ +#include + +/***************************************************************************** + * Required internal headers + *****************************************************************************/ +#include "stream_output.h" + +# ifdef __cplusplus +} +# endif + +#endif /* */ diff --git a/include/vlc_common.h b/include/vlc_common.h index 91af23ecaa..19d19b92a3 100644 --- a/include/vlc_common.h +++ b/include/vlc_common.h @@ -3,7 +3,7 @@ * Collection of useful common types and macros definitions ***************************************************************************** * Copyright (C) 1998, 1999, 2000 VideoLAN - * $Id: vlc_common.h,v 1.18 2002/08/12 09:34:15 sam Exp $ + * $Id: vlc_common.h,v 1.19 2002/08/12 22:12:50 massiot Exp $ * * Authors: Samuel Hocevar * Vincent Seguin @@ -190,6 +190,10 @@ typedef struct picture_heap_t picture_heap_t; typedef struct subpicture_t subpicture_t; typedef struct subpicture_sys_t subpicture_sys_t; +/* Stream output */ +typedef struct sout_instance_t sout_instance_t; +typedef struct sout_fifo_t sout_fifo_t; + /* Decoders */ typedef struct decoder_fifo_t decoder_fifo_t; diff --git a/include/vlc_objects.h b/include/vlc_objects.h index be7b5eb924..62d3e66921 100644 --- a/include/vlc_objects.h +++ b/include/vlc_objects.h @@ -2,7 +2,7 @@ * vlc_objects.h: vlc_object_t definition. ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: vlc_objects.h,v 1.6 2002/08/12 09:34:15 sam Exp $ + * $Id: vlc_objects.h,v 1.7 2002/08/12 22:12:50 massiot Exp $ * * Authors: Samuel Hocevar * @@ -31,6 +31,7 @@ #define VLC_OBJECT_DECODER (-7) #define VLC_OBJECT_VOUT (-8) #define VLC_OBJECT_AOUT (-9) +#define VLC_OBJECT_SOUT (-10) #define VLC_OBJECT_GENERIC (-666) /* Object search mode */ diff --git a/include/vlc_symbols.h b/include/vlc_symbols.h index 35c75e99ac..5d06d0c969 100644 --- a/include/vlc_symbols.h +++ b/include/vlc_symbols.h @@ -60,6 +60,7 @@ struct module_symbols_t pgrm_descriptor_t * (* input_AddProgram_inner) ( input_thread_t *, u16, size_t ) ; pgrm_descriptor_t * (* input_FindProgram_inner) ( input_thread_t *, u16 ) ; picture_t * (* vout_CreatePicture_inner) ( vout_thread_t *, vlc_bool_t, vlc_bool_t, vlc_bool_t ) ; + sout_instance_t * (* __sout_NewInstance_inner) ( vlc_object_t *, char * ) ; ssize_t (* input_FDNetworkRead_inner) ( input_thread_t *, byte_t *, size_t ) ; ssize_t (* input_FDRead_inner) ( input_thread_t *, byte_t *, size_t ) ; ssize_t (* input_FillBuffer_inner) ( input_thread_t * ) ; @@ -124,6 +125,7 @@ struct module_symbols_t void (* msleep_inner) ( mtime_t delay ) ; void (* mwait_inner) ( mtime_t date ) ; void (* playlist_Command_inner) ( playlist_t *, int, int ) ; + void (* sout_DeleteInstance_inner) ( sout_instance_t * ) ; void (* vout_AllocatePicture_inner) ( vout_thread_t *, picture_t *, int, int, u32 ) ; void (* vout_DatePicture_inner) ( vout_thread_t *, picture_t *, mtime_t ) ; void (* vout_DestroyPicture_inner) ( vout_thread_t *, picture_t * ) ; @@ -181,6 +183,7 @@ struct module_symbols_t # define __msg_Warn p_symbols->__msg_Warn_inner # define __network_ChannelCreate p_symbols->__network_ChannelCreate_inner # define __network_ChannelJoin p_symbols->__network_ChannelJoin_inner +# define __sout_NewInstance p_symbols->__sout_NewInstance_inner # define __vlc_cond_destroy p_symbols->__vlc_cond_destroy_inner # define __vlc_cond_init p_symbols->__vlc_cond_init_inner # define __vlc_dumpstructure p_symbols->__vlc_dumpstructure_inner @@ -262,6 +265,7 @@ struct module_symbols_t # define playlist_Add p_symbols->playlist_Add_inner # define playlist_Command p_symbols->playlist_Command_inner # define playlist_Delete p_symbols->playlist_Delete_inner +# define sout_DeleteInstance p_symbols->sout_DeleteInstance_inner # define vout_AllocatePicture p_symbols->vout_AllocatePicture_inner # define vout_ChromaCmp p_symbols->vout_ChromaCmp_inner # define vout_CreatePicture p_symbols->vout_CreatePicture_inner diff --git a/modules/audio_filter/resampler/trivial.c b/modules/audio_filter/resampler/trivial.c index b96b11446b..d3264c1d3c 100644 --- a/modules/audio_filter/resampler/trivial.c +++ b/modules/audio_filter/resampler/trivial.c @@ -2,7 +2,7 @@ * trivial.c : trivial resampler (skips samples or pads with zeroes) ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: trivial.c,v 1.2 2002/08/10 20:01:00 massiot Exp $ + * $Id: trivial.c,v 1.3 2002/08/12 22:12:50 massiot Exp $ * * Authors: Christophe Massiot * @@ -50,7 +50,7 @@ vlc_module_begin(); vlc_module_end(); /***************************************************************************** - * Create: allocate trivial mixer + * Create: allocate trivial resampler ***************************************************************************** * This function allocates and initializes a Crop vout method. *****************************************************************************/ diff --git a/modules/audio_mixer/trivial.c b/modules/audio_mixer/trivial.c index 0b119c8f24..e534793597 100644 --- a/modules/audio_mixer/trivial.c +++ b/modules/audio_mixer/trivial.c @@ -2,7 +2,7 @@ * trivial.c : trivial mixer plug-in (1 input, no downmixing) ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: trivial.c,v 1.3 2002/08/11 22:36:35 massiot Exp $ + * $Id: trivial.c,v 1.4 2002/08/12 22:12:50 massiot Exp $ * * Authors: Christophe Massiot * @@ -146,7 +146,6 @@ static void DoWork( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) (u32 *)p_input->p_first_byte_to_mix; u32 * p_out = (u32 *)p_buffer->p_buffer; - if ( p_input->input.i_channels < p_aout->mixer.output.i_channels ) { /* Zero out the destination buffer, to avoid static on unavailable diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c index 4b3d3c6fba..4ec06747e1 100644 --- a/modules/audio_output/file.c +++ b/modules/audio_output/file.c @@ -2,7 +2,7 @@ * file.c : audio output which writes the samples to a file ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: file.c,v 1.3 2002/08/09 23:47:23 massiot Exp $ + * $Id: file.c,v 1.4 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -33,6 +33,8 @@ #include "aout_internal.h" +#define FRAME_SIZE 2048 + /***************************************************************************** * Local prototypes. *****************************************************************************/ @@ -126,7 +128,7 @@ static int SetFormat( aout_instance_t * p_aout ) } p_aout->output.output.i_format = format_int[i]; - p_aout->output.i_nb_samples = 2048; + p_aout->output.i_nb_samples = FRAME_SIZE; return 0; } diff --git a/modules/codec/spdif.c b/modules/codec/spdif.c index fdf3ccc94e..433f6635e4 100644 --- a/modules/codec/spdif.c +++ b/modules/codec/spdif.c @@ -2,7 +2,7 @@ * spdif.c: A52 pass-through to external decoder with enabled soundcard ***************************************************************************** * Copyright (C) 2001-2002 VideoLAN - * $Id: spdif.c,v 1.3 2002/08/11 23:26:28 massiot Exp $ + * $Id: spdif.c,v 1.4 2002/08/12 22:12:51 massiot Exp $ * * Authors: Stéphane Borel * Juha Yrjola @@ -217,8 +217,8 @@ static int RunDecoder( decoder_fifo_t *p_fifo ) p_buffer->end_date = last_date; /* Get the whole frame. */ - memcpy( p_buffer->p_buffer + sizeof(u16), p_header, 7 ); - GetChunk( &p_dec->bit_stream, p_buffer->p_buffer + 7 + sizeof(u16), + memcpy( p_buffer->p_buffer, p_header, 7 ); + GetChunk( &p_dec->bit_stream, p_buffer->p_buffer + 7, i_frame_size - 7 ); if( p_dec->p_fifo->b_die ) break; diff --git a/modules/misc/dummy/aout.c b/modules/misc/dummy/aout.c index abbfa7c262..09b67bf073 100644 --- a/modules/misc/dummy/aout.c +++ b/modules/misc/dummy/aout.c @@ -2,7 +2,7 @@ * aout_dummy.c : dummy audio output plugin ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: aout.c,v 1.2 2002/08/07 21:36:56 massiot Exp $ + * $Id: aout.c,v 1.3 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -32,6 +32,8 @@ #include "aout_internal.h" +#define FRAME_SIZE 2048 + /***************************************************************************** * Local prototypes. *****************************************************************************/ @@ -56,7 +58,7 @@ int E_(OpenAudio) ( vlc_object_t * p_this ) *****************************************************************************/ static int SetFormat( aout_instance_t * p_aout ) { - p_aout->output.i_nb_samples = 2048; + p_aout->output.i_nb_samples = FRAME_SIZE; return 0; } diff --git a/modules/video_output/sdl/aout.c b/modules/video_output/sdl/aout.c index bc21b82cf9..d9501f19a8 100644 --- a/modules/video_output/sdl/aout.c +++ b/modules/video_output/sdl/aout.c @@ -2,7 +2,7 @@ * aout_sdl.c : audio sdl functions library ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: aout.c,v 1.3 2002/08/12 09:34:15 sam Exp $ + * $Id: aout.c,v 1.4 2002/08/12 22:12:51 massiot Exp $ * * Authors: Michel Kaempf * Samuel Hocevar @@ -38,7 +38,7 @@ #include SDL_INCLUDE_FILE -#define DEFAULT_FRAME_SIZE 2048 +#define FRAME_SIZE 2048 /***************************************************************************** * Local prototypes @@ -94,9 +94,9 @@ static int SetFormat( aout_instance_t *p_aout ) desired.channels = p_aout->output.output.i_channels; desired.callback = SDLCallback; desired.userdata = p_aout; - desired.samples = DEFAULT_FRAME_SIZE; + desired.samples = FRAME_SIZE; - /* Open the sound device - FIXME : get the "natural" paramaters */ + /* Open the sound device - FIXME : get the "natural" parameters */ if( SDL_OpenAudio( &desired, NULL ) < 0 ) { return -1; @@ -143,7 +143,7 @@ static void SDLCallback( void * _p_aout, byte_t * p_stream, int i_len ) /* FIXME : take into account SDL latency instead of mdate() */ aout_buffer_t * p_buffer = aout_OutputNextBuffer( p_aout, mdate() ); - if ( i_len != DEFAULT_FRAME_SIZE * sizeof(s16) + if ( i_len != FRAME_SIZE * sizeof(s16) * p_aout->output.output.i_channels ) { msg_Err( p_aout, "SDL doesn't know its buffer size (%d)", i_len ); diff --git a/src/audio_output/input.c b/src/audio_output/input.c index 5cdd79b4d1..b1ce100d96 100644 --- a/src/audio_output/input.c +++ b/src/audio_output/input.c @@ -2,7 +2,7 @@ * input.c : internal management of input streams for the audio output ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: input.c,v 1.2 2002/08/09 23:47:23 massiot Exp $ + * $Id: input.c,v 1.3 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -68,6 +68,7 @@ static aout_input_t * InputNew( aout_instance_t * p_aout, /* Prepare FIFO. */ aout_FifoInit( p_aout, &p_input->fifo ); p_input->p_first_byte_to_mix = NULL; + p_input->next_packet_date = 0; /* Create filters. */ if ( aout_FiltersCreatePipeline( p_aout, p_input->pp_filters, diff --git a/src/audio_output/mixer.c b/src/audio_output/mixer.c index 8f9c7c3829..040c7d6254 100644 --- a/src/audio_output/mixer.c +++ b/src/audio_output/mixer.c @@ -2,7 +2,7 @@ * mixer.c : audio output mixing operations ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: mixer.c,v 1.2 2002/08/11 22:36:35 massiot Exp $ + * $Id: mixer.c,v 1.3 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -110,7 +110,7 @@ void aout_MixerRun( aout_instance_t * p_aout ) /* Run the mixer. */ aout_BufferAlloc( &p_aout->mixer.output_alloc, - (u64)(p_aout->output.i_nb_samples * 1000000) + ((u64)p_aout->output.i_nb_samples * 1000000) / p_aout->output.output.i_rate, /* This is a bit kludgy, but is actually only used * for the S/PDIF dummy mixer : */ diff --git a/src/audio_output/output.c b/src/audio_output/output.c index 791070756a..48e61e6122 100644 --- a/src/audio_output/output.c +++ b/src/audio_output/output.c @@ -2,7 +2,7 @@ * output.c : internal management of output streams for the audio output ***************************************************************************** * Copyright (C) 2002 VideoLAN - * $Id: output.c,v 1.3 2002/08/11 22:36:35 massiot Exp $ + * $Id: output.c,v 1.4 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -155,9 +155,14 @@ void aout_OutputPlay( aout_instance_t * p_aout, aout_buffer_t * p_buffer ) /***************************************************************************** * aout_OutputNextBuffer : give the audio output plug-in the right buffer + ***************************************************************************** + * If b_can_sleek is 1, the aout core functions won't try to resample + * new buffers to catch up - that is we suppose that the output plug-in can + * do it by itself. S/PDIF outputs should always set b_can_sleek = 1. *****************************************************************************/ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, - mtime_t start_date ) + mtime_t start_date /*, + vlc_bool_t b_can_sleek */ ) { aout_buffer_t * p_buffer; @@ -180,9 +185,10 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, return NULL; } + /* Here we suppose that all buffers have the same duration - this is + * generally true, and anyway if it's wrong it won't be a disaster. */ if ( p_buffer->start_date > start_date - + (mtime_t)p_aout->output.i_nb_samples - * 1000000 / p_aout->output.output.i_rate ) + + (p_buffer->end_date - p_buffer->start_date) ) { vlc_mutex_unlock( &p_aout->output.fifo.lock ); msg_Dbg( p_aout, "audio output is starving (%lld)", @@ -190,8 +196,22 @@ aout_buffer_t * aout_OutputNextBuffer( aout_instance_t * p_aout, return NULL; } - /* FIXME : there we should handle the case where start_date is not - * completely equal to p_buffer->start_date. */ +#if 0 + if ( !b_can_sleek ) + { + /* Try to compensate the drift by doing some resampling. */ + int i; + + /* Take the mixer lock because no input can be removed when the + * the mixer lock is taken. */ + vlc_mutex_lock( &p_aout->mixer_lock ); + for ( i = 0; i < p_input->i_nb_inputs; i++ ) + { + aout_input_t * p_input = p_aout->pp_inputs[i]; + } + vlc_mutex_lock( &p_aout->mixer_lock ); + } +#endif p_aout->output.fifo.p_first = p_buffer->p_next; if ( p_buffer->p_next == NULL ) diff --git a/src/input/input.c b/src/input/input.c index a75faf3ed8..4b0add2e1b 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -3,8 +3,8 @@ * Read an MPEG2 stream, demultiplex and parse it before sending it to * decoders. ***************************************************************************** - * Copyright (C) 1998-2001 VideoLAN - * $Id: input.c,v 1.209 2002/07/31 20:56:52 sam Exp $ + * Copyright (C) 1998-2002 VideoLAN + * $Id: input.c,v 1.210 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -48,6 +48,8 @@ #include "input_ext-dec.h" #include "input_ext-plugins.h" +#include "stream_output.h" + #include "interface.h" /***************************************************************************** @@ -114,6 +116,7 @@ input_thread_t *__input_CreateThread( vlc_object_t *p_parent, p_input->stream.b_new_mute = MUTE_NO_CHANGE; p_input->stream.i_mux_rate = 0; p_input->stream.b_seekable = 0; + p_input->stream.p_sout = NULL; /* no stream, no program, no area, no es */ p_input->stream.p_new_program = NULL; @@ -497,6 +500,23 @@ static int InitThread( input_thread_t * p_input ) return -1; } + /* Initialize optional stream output. */ + psz_parser = config_GetPsz( p_input, "sout" ); + if ( psz_parser != NULL ) + { + if ( (p_input->stream.p_sout = sout_NewInstance( p_input, psz_parser )) + == NULL ) + { + msg_Err( p_input, "cannot start stream output instance, aborting" ); + free( psz_parser ); + module_Unneed( p_input, p_input->p_access ); + module_Unneed( p_input, p_input->p_demux ); + return -1; + } + + free( psz_parser ); + } + return 0; } @@ -539,6 +559,12 @@ static void EndThread( input_thread_t * p_input ) /* Free all ES and destroy all decoder threads */ input_EndStream( p_input ); + /* Close optional stream output instance */ + if ( p_input->stream.p_sout != NULL ) + { + sout_DeleteInstance( p_input->stream.p_sout ); + } + /* Free demultiplexer's data */ module_Unneed( p_input, p_input->p_demux ); diff --git a/src/input/input_dec.c b/src/input/input_dec.c index b8f2000576..215d7259f5 100644 --- a/src/input/input_dec.c +++ b/src/input/input_dec.c @@ -2,7 +2,7 @@ * input_dec.c: Functions for the management of decoders ***************************************************************************** * Copyright (C) 1999-2001 VideoLAN - * $Id: input_dec.c,v 1.44 2002/08/12 09:34:15 sam Exp $ + * $Id: input_dec.c,v 1.45 2002/08/12 22:12:51 massiot Exp $ * * Authors: Christophe Massiot * @@ -228,6 +228,7 @@ static decoder_fifo_t * CreateDecoderFifo( input_thread_t * p_input, p_fifo->p_demux_data = p_es->p_demux_data; p_fifo->p_stream_ctrl = &p_input->stream.control; + p_fifo->p_sout = p_input->stream.p_sout; p_fifo->p_first = NULL; p_fifo->pp_last = &p_fifo->p_first; diff --git a/src/libvlc.h b/src/libvlc.h index 5011f38ae9..a6519d0a43 100644 --- a/src/libvlc.h +++ b/src/libvlc.h @@ -2,7 +2,7 @@ * libvlc.h: main libvlc header ***************************************************************************** * Copyright (C) 1998-2002 VideoLAN - * $Id: libvlc.h,v 1.12 2002/08/08 00:35:11 sam Exp $ + * $Id: libvlc.h,v 1.13 2002/08/12 22:12:51 massiot Exp $ * * Authors: Vincent Seguin * Samuel Hocevar @@ -234,6 +234,10 @@ "'any' at the end of the list to make sure there is a fallback for the " \ "types you didn't specify.") +#define SOUT_TEXT N_("choose a stream output") +#define SOUT_LONGTEXT N_( \ + "Empty if no stream output.") + #define MMX_TEXT N_("enable CPU MMX support") #define MMX_LONGTEXT N_( \ "If your processor supports the MMX instructions set, vlc can take " \ @@ -426,6 +430,7 @@ vlc_module_begin(); add_module( "memcpy", "memcpy", NULL, NULL, MEMCPY_TEXT, MEMCPY_LONGTEXT ); add_module( "access", "access", NULL, NULL, ACCESS_TEXT, ACCESS_LONGTEXT ); add_module( "demux", "demux", NULL, NULL, DEMUX_TEXT, DEMUX_LONGTEXT ); + add_string( "sout", NULL, NULL, SOUT_TEXT, SOUT_LONGTEXT ); #if defined(WIN32) add_bool( "fast-mutex", 0, NULL, FAST_MUTEX_TEXT, FAST_MUTEX_LONGTEXT ); diff --git a/src/misc/modules.c b/src/misc/modules.c index edf4ea5abf..e1ce87047f 100644 --- a/src/misc/modules.c +++ b/src/misc/modules.c @@ -2,7 +2,7 @@ * modules.c : Builtin and plugin modules management functions ***************************************************************************** * Copyright (C) 2001 VideoLAN - * $Id: modules.c,v 1.83 2002/08/12 09:34:15 sam Exp $ + * $Id: modules.c,v 1.84 2002/08/12 22:12:51 massiot Exp $ * * Authors: Samuel Hocevar * Ethan C. Baldridge @@ -71,6 +71,8 @@ #include "audio_output.h" +#include "stream_output.h" + #include "iso_lang.h" #ifdef HAVE_DYNAMIC_PLUGINS diff --git a/src/misc/modules_plugin.h b/src/misc/modules_plugin.h index 2114ba5106..442c46116d 100644 --- a/src/misc/modules_plugin.h +++ b/src/misc/modules_plugin.h @@ -273,6 +273,8 @@ static const char * module_error( char *psz_buffer ) (p_symbols)->msleep_inner = msleep; \ (p_symbols)->__network_ChannelJoin_inner = __network_ChannelJoin; \ (p_symbols)->__network_ChannelCreate_inner = __network_ChannelCreate; \ + (p_symbols)->__sout_NewInstance_inner = __sout_NewInstance; \ + (p_symbols)->sout_DeleteInstance_inner = sout_DeleteInstance; \ (p_symbols)->__vout_CreateThread_inner = __vout_CreateThread; \ (p_symbols)->vout_DestroyThread_inner = vout_DestroyThread; \ (p_symbols)->vout_ChromaCmp_inner = vout_ChromaCmp; \ diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c new file mode 100644 index 0000000000..38a807751a --- /dev/null +++ b/src/stream_output/stream_output.c @@ -0,0 +1,187 @@ +/***************************************************************************** + * stream_output.c : stream output module + ***************************************************************************** + * Copyright (C) 2002 VideoLAN + * $Id: stream_output.c,v 1.1 2002/08/12 22:12:51 massiot Exp $ + * + * Authors: Christophe Massiot + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. + *****************************************************************************/ + +/***************************************************************************** + * Preamble + *****************************************************************************/ +#include /* ENOMEM */ +#include /* free() */ +#include /* sprintf() */ +#include /* strerror() */ + +#include + +#include + +/***************************************************************************** + * Local prototypes + *****************************************************************************/ +static int InitInstance ( sout_instance_t * ); + +/***************************************************************************** + * sout_NewInstance: creates a new stream output instance + *****************************************************************************/ +sout_instance_t * __sout_NewInstance ( vlc_object_t *p_parent, + char * psz_dest ) +{ + sout_instance_t * p_sout; + + /* Allocate descriptor */ + p_sout = vlc_object_create( p_parent, VLC_OBJECT_SOUT ); + if( p_sout == NULL ) + { + msg_Err( p_parent, "out of memory" ); + return NULL; + } + + p_sout->psz_dest = psz_dest; + if ( InitInstance( p_sout ) == -1 ) + { + vlc_object_destroy( p_sout ); + return NULL; + } + + return p_sout; +} + +/***************************************************************************** + * InitInstance: opens appropriate modules + *****************************************************************************/ +static int InitInstance( sout_instance_t * p_sout ) +{ + /* Parse dest string. Syntax : [[][/]:][] */ + /* This code is identical to input.c:InitThread. FIXME : factorize it ? */ + char * psz_parser = p_sout->psz_dest; + + /* Skip the plug-in names */ + while( *psz_parser && *psz_parser != ':' ) + { + psz_parser++; + } +#ifdef WIN32 + if( psz_parser - psz_dest == 1 ) + { + msg_Warn( p_sout, "drive letter %c: found in source string", + p_sout->psz_dest ) ; + psz_parser = ""; + } +#endif + + if( !*psz_parser ) + { + p_sout->psz_access = p_sout->psz_mux = ""; + p_sout->psz_name = p_sout->psz_dest; + } + else + { + *psz_parser++ = '\0'; + + /* let's skip '//' */ + if( psz_parser[0] == '/' && psz_parser[1] == '/' ) + { + psz_parser += 2 ; + } + + p_sout->psz_name = psz_parser ; + + /* Come back to parse the access and mux plug-ins */ + psz_parser = p_sout->psz_dest; + + if( !*psz_parser ) + { + /* No access */ + p_sout->psz_access = ""; + } + else if( *psz_parser == '/' ) + { + /* No access */ + p_sout->psz_access = ""; + psz_parser++; + } + else + { + p_sout->psz_access = psz_parser; + + while( *psz_parser && *psz_parser != '/' ) + { + psz_parser++; + } + + if( *psz_parser == '/' ) + { + *psz_parser++ = '\0'; + } + } + + if( !*psz_parser ) + { + /* No mux */ + p_sout->psz_mux = ""; + } + else + { + p_sout->psz_mux = psz_parser; + } + } + + msg_Dbg( p_sout, "access `%s', mux `%s', name `%s'", + p_sout->psz_access, p_sout->psz_mux, p_sout->psz_name ); + + + /* Find and open appropriate access module */ + p_sout->p_access = + module_Need( p_sout, "sout access", p_sout->psz_access ); + + if( p_sout->p_access == NULL ) + { + msg_Err( p_sout, "no suitable sout access module for `%s/%s://%s'", + p_sout->psz_access, p_sout->psz_mux, p_sout->psz_name ); + return -1; + } + + /* Find and open appropriate mux module */ + p_sout->p_mux = + module_Need( p_sout, "sout mux", p_sout->psz_mux ); + + if( p_sout->p_mux == NULL ) + { + msg_Err( p_sout, "no suitable mux module for `%s/%s://%s'", + p_sout->psz_access, p_sout->psz_mux, p_sout->psz_name ); + module_Unneed( p_sout, p_sout->p_access ); + return -1; + } +} + + +/***************************************************************************** + * sout_DeleteInstance: delete a previously allocated instance + *****************************************************************************/ +void sout_DeleteInstance( sout_instance_t * p_sout ) +{ + /* Unlink object */ + vlc_object_detach( p_sout ); + + /* Free structure */ + vlc_object_destroy( p_sout ); +} +