Index: libmpcodecs/vf_screenshot.c =================================================================== --- libmpcodecs/vf_screenshot.c (revision 30845) +++ libmpcodecs/vf_screenshot.c (working copy) @@ -18,6 +18,11 @@ #include "config.h" +#include +#include +#include +#include +#include #include #include #if HAVE_MALLOC_H @@ -41,8 +46,7 @@ #include "libavcodec/avcodec.h" struct vf_priv_s { - int frameno; - char fname[102]; + char fname[256]; /// shot stores current screenshot mode: /// 0: don't take screenshots /// 1: take single screenshot, reset to 0 afterwards @@ -54,6 +58,7 @@ AVCodecContext *avctx; uint8_t *outbuffer; int outbuffer_size; + FILE *fp; }; //===========================================================================// @@ -83,45 +88,49 @@ static void write_png(struct vf_priv_s *priv) { - char *fname = priv->fname; - FILE * fp; AVFrame pic; int size; - fp = fopen (fname, "wb"); - if (fp == NULL) { - mp_msg(MSGT_VFILTER,MSGL_ERR,"\nPNG Error opening %s for writing!\n", fname); - return; - } - pic.data[0] = priv->buffer; pic.linesize[0] = priv->stride; size = avcodec_encode_video(priv->avctx, priv->outbuffer, priv->outbuffer_size, &pic); - if (size > 0) - fwrite(priv->outbuffer, size, 1, fp); - - fclose (fp); + if (size > 0) { + fwrite(priv->outbuffer, size, 1, priv->fp); + fflush(priv->fp); + if (ferror(priv->fp)) { + mp_msg(MSGT_VFILTER,MSGL_ERR,"\nError writing screenshot: %s\n", + strerror(errno)); + } + } + fclose (priv->fp); + priv->fp = NULL; } -static int fexists(char *fname) +static int gen_fname(struct vf_priv_s* priv) { - struct stat dummy; - if (stat(fname, &dummy) == 0) return 1; - else return 0; -} + unsigned int ctr = 0; + int fd; -static void gen_fname(struct vf_priv_s* priv) -{ - do { - snprintf (priv->fname, 100, "shot%04d.png", ++priv->frameno); - } while (fexists(priv->fname) && priv->frameno < 100000); - if (fexists(priv->fname)) { - priv->fname[0] = '\0'; - return; + while(42) { + snprintf (priv->fname, sizeof(priv->fname), "shot-%lu-%03u.png", + (unsigned long)time(NULL), ctr++); + fd = open(priv->fname, O_RDWR | O_CREAT | O_TRUNC | O_EXCL, S_IRUSR | S_IWUSR); + if (fd != -1) { + priv->fp = fdopen(fd, "wb"); + if (priv->fp == NULL) { + mp_msg(MSGT_VFILTER,MSGL_INFO,"Error opening file for screenshot: %s\n", + strerror(errno)); + return 0; + } + mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n", priv->fname); + return 1; + } + if (errno != EEXIST) { + mp_msg(MSGT_VFILTER,MSGL_INFO,"Error creating file for screenshot: %s\n", + strerror(errno)); + return 0; + } } - - mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname); - } static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi) @@ -210,8 +219,7 @@ if(vf->priv->shot) { if (vf->priv->shot==1) vf->priv->shot=0; - gen_fname(vf->priv); - if (vf->priv->fname[0]) { + if (gen_fname(vf->priv)) { if (!vf->priv->store_slices) scale_image(vf->priv, dmpi); write_png(vf->priv); @@ -293,13 +301,13 @@ vf->get_image=get_image; vf->uninit=uninit; vf->priv=malloc(sizeof(struct vf_priv_s)); - vf->priv->frameno=0; vf->priv->shot=0; vf->priv->store_slices=0; vf->priv->buffer=0; vf->priv->outbuffer=0; vf->priv->ctx=0; vf->priv->avctx = avcodec_alloc_context(); + vf->priv->fp = NULL; avcodec_register_all(); if (avcodec_open(vf->priv->avctx, avcodec_find_encoder(CODEC_ID_PNG))) { mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not open libavcodec PNG encoder\n"); Index: codec-cfg.c =================================================================== --- codec-cfg.c (revision 30845) +++ codec-cfg.c (working copy) @@ -1053,8 +1053,8 @@ nr[1] = nr_acodecs; printf("/* GENERATED FROM %s, DO NOT EDIT! */\n\n",argv[1]); - printf("#include \n",argv[1]); - printf("#include \"codec-cfg.h\"\n\n",argv[1]); + printf("#include \n"); + printf("#include \"codec-cfg.h\"\n\n"); for (i=0; i<2; i++) { printf("const codecs_t %s[] = {\n", nm[i]); Index: stream/stream_file.c =================================================================== --- stream/stream_file.c (revision 30845) +++ stream/stream_file.c (working copy) @@ -23,6 +23,7 @@ #include #include #include +#include #include "mp_msg.h" #include "stream.h" @@ -162,7 +163,7 @@ #endif f=open(filename,m, openmode); if(f<0) { - mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename); + mp_msg(MSGT_OPEN,MSGL_ERR,MSGTR_FileNotFound,filename,": %s",strerror(errno)); m_struct_free(&stream_opts,opts); return STREAM_ERROR; } Index: Makefile =================================================================== --- Makefile (revision 30845) +++ Makefile (working copy) @@ -719,7 +719,7 @@ libmpdemux/muxer_rawvideo.c \ $(SRCS_MENCODER-yes) - +COMMON_LIBS += -lliveMedia -lgroupsock -lUsageEnvironment -lBasicUsageEnvironment COMMON_LIBS-$(LIBAVFORMAT_A) += libavformat/libavformat.a COMMON_LIBS-$(LIBAVCODEC_A) += libavcodec/libavcodec.a COMMON_LIBS-$(LIBAVUTIL_A) += libavutil/libavutil.a @@ -744,6 +744,12 @@ INSTALL_TARGETS-$(MENCODER) += install-mencoder install-mencoder-man INSTALL_TARGETS-$(MPLAYER) += install-mplayer install-mplayer-man +ifdef ARCH_X86 +ifndef ARCH_X86_64 +PARTS += loader +endif +endif + DIRS = . \ gui \ gui/mplayer \ @@ -1049,8 +1055,10 @@ TOOLS = $(addprefix TOOLS/,alaw-gen asfinfo avi-fix avisubdump compare dump_mp4 movinfo netstream subrip vivodump) ifdef ARCH_X86 +ifndef ARCH_X86_64 TOOLS += TOOLS/fastmemcpybench TOOLS/modify_reg endif +endif ALLTOOLS = $(TOOLS) TOOLS/bmovl-test TOOLS/vfw2menc Index: cpuinfo.c =================================================================== --- cpuinfo.c (revision 30845) +++ cpuinfo.c (working copy) @@ -25,6 +25,7 @@ #include #include #include +#include #ifdef __MINGW32__ #define MISSING_USLEEP @@ -77,10 +78,18 @@ static int64_t rdtsc(void) { - uint32_t hi, lo; -#define RDTSC ".byte 0x0f, 0x31; " - __asm__ volatile (RDTSC : "=a"(lo), "=d"(hi) : ); - return (uint64_t) hi << 32 | lo; + uint64_t val; + uint32_t valhigh, vallow; + +#if defined(__i386__) + __asm__ volatile ( "rdtsc" : "=A" (val)); +#elif defined(__x86_64__) + asm volatile("rdtsc" : "=a" (valhigh), "=d" (vallow)); + val = ((unsigned long)valhigh) | (((unsigned long)vallow)<<32); +#else + val = 0; +#endif + return val; } static const char* @@ -334,7 +343,7 @@ if (regs.edx & (1 << 4)) { int64_t tsc_start, tsc_end; struct timeval tv_start, tv_end; - int usec_delay; + uint64_t usec_delay; tsc_start = rdtsc(); gettimeofday(&tv_start, NULL); @@ -346,7 +355,7 @@ tsc_end = rdtsc(); gettimeofday(&tv_end, NULL); - usec_delay = 1000000 * (tv_end.tv_sec - tv_start.tv_sec) + usec_delay = 1000000UL * (tv_end.tv_sec - tv_start.tv_sec) + (tv_end.tv_usec - tv_start.tv_usec); printf("cpu MHz\t\t: %.3f\n", Index: libdvdcss/ioctl.c =================================================================== --- libdvdcss/ioctl.c (revision 30845) +++ libdvdcss/ioctl.c (working copy) @@ -145,7 +145,7 @@ int ioctl_ReadCopyright( int i_fd, int i_layer, int *pi_copyright ) { int i_ret; - +#define HAVE_LINUX_DVD_STRUCT #if defined( HAVE_LINUX_DVD_STRUCT ) dvd_struct dvd; Index: configure =================================================================== --- configure (revision 30845) +++ configure (working copy) @@ -4549,7 +4549,7 @@ return 0; } EOF for _ld_tmp in $_xvmclib XvMCNVIDIA XvMCW I810XvMC ; do - cc_check -lXvMC -l$_ld_tmp && _xvmc=yes && _xvmclib="$_ld_tmp" && break + cc_check -lXvMC -l$_ld_tmp -lpthread && _xvmc=yes && _xvmclib="$_ld_tmp" && break done fi if test "$_xvmc" = yes ; then @@ -7178,10 +7178,7 @@ for I in $extra_cflags "-I$_libdir/live" "-I/usr/lib/live" "-I/usr/lib64/live" "-I/usr/local/live" "-I/usr/local/lib/live" ; do cxx_check $I/liveMedia/include $I/UsageEnvironment/include \ $I/groupsock/include && _livelibdir=$(echo $I| sed s/-I//) && \ - extra_ldflags="$_livelibdir/liveMedia/libliveMedia.a \ - $_livelibdir/groupsock/libgroupsock.a \ - $_livelibdir/UsageEnvironment/libUsageEnvironment.a \ - $_livelibdir/BasicUsageEnvironment/libBasicUsageEnvironment.a \ + _extra_ldflags="-lliveMedia -lgroupsock -lUsageEnvironment -lBasicUsageEnvironment \ $extra_ldflags -lstdc++" \ extra_cxxflags="-I$_livelibdir/liveMedia/include \ -I$_livelibdir/UsageEnvironment/include \ Index: mplayer.c =================================================================== --- mplayer.c (revision 30845) +++ mplayer.c (working copy) @@ -2608,7 +2608,7 @@ int gui_no_filename=0; InitTimer(); - srand(GetTimerMS()); + srand(GetTimerMS() * getpid()); mp_msg_init();