diff options
-rw-r--r-- | Changelog | 1 | ||||
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | etc/codecs.conf | 1 | ||||
-rw-r--r-- | libmpcodecs/vd_theora.c | 4 | ||||
-rw-r--r-- | libvo/vo_gl.c | 17 | ||||
-rw-r--r-- | libvo/vo_md5sum.c | 2 | ||||
-rw-r--r-- | mplayer.c | 2 | ||||
-rw-r--r-- | stream/cache2.c | 123 |
8 files changed, 102 insertions, 59 deletions
@@ -25,6 +25,7 @@ MPlayer (1.0) * support ISDB-Tb DVB streams Drivers: + * -vo md5sum md5 calculation changed so output matches FFmpeg's -f framemd5 * Support for more formats in OpenGL video output drivers (different YUV subsampling, 16 bit per component) * Selectable YUV to RGB conversion standard for -vo gl @@ -462,7 +462,6 @@ Use these options if autodetection fails: --with-xvmclib=NAME adapter-specific library name (e.g. XvMCNVIDIA) --with-freetype-config=PATH path to freetype-config - --with-fribidi-config=PATH path to fribidi-config --with-glib-config=PATH path to glib*-config --with-gtk-config=PATH path to gtk*-config --with-sdl-config=PATH path to sdl*-config @@ -681,7 +680,6 @@ _macosx_bundle=auto _sortsub=yes _freetypeconfig='freetype-config' _fribidi=auto -_fribidiconfig='fribidi-config' _enca=auto _inet6=auto _gethostbyname2=auto @@ -743,9 +741,6 @@ for ac_option do --with-freetype-config=*) _freetypeconfig=$(echo $ac_option | cut -d '=' -f 2) ;; - --with-fribidi-config=*) - _fribidiconfig=$(echo $ac_option | cut -d '=' -f 2) - ;; --with-gtk-config=*) _gtkconfig=$(echo $ac_option | cut -d '=' -f 2) ;; @@ -6171,10 +6166,10 @@ EOF _inc_tmp="" _ld_tmp="-lfribidi" cc_check $_inc_tmp $_ld_tmp && _fribidi=yes - if $_fribidiconfig --version > /dev/null 2>&1 && + if $_pkg_config --exists fribidi > /dev/null 2>&1 && test "$_fribidi" = no ; then - _inc_tmp="$($_fribidiconfig --cflags)" - _ld_tmp="$($_fribidiconfig --libs)" + _inc_tmp="$($_pkg_config --cflags)" + _ld_tmp="$($_pkg_config --libs)" cc_check $_inc_tmp $_ld_tmp && _fribidi=yes fi fi diff --git a/etc/codecs.conf b/etc/codecs.conf index cbd8e58233..aabe527647 100644 --- a/etc/codecs.conf +++ b/etc/codecs.conf @@ -1003,6 +1003,7 @@ videocodec ffodivx fourcc M4T3,DMK2,DIGI,INMC fourcc EPHV,SN40 fourcc uldx,ULDX,VSPX + fourcc SIPP ; Samsung SHR-6040 driver ffmpeg dll mpeg4 ;opendivx out YV12,I420,IYUV diff --git a/libmpcodecs/vd_theora.c b/libmpcodecs/vd_theora.c index 70a5e1d525..86fb5dc0dd 100644 --- a/libmpcodecs/vd_theora.c +++ b/libmpcodecs/vd_theora.c @@ -167,6 +167,10 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags) yuv_buffer yuv; mp_image_t* mpi; + // no delayed frames + if (!data || !len) + return NULL; + memset (&op, 0, sizeof (op)); op.bytes = len; op.packet = data; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index efec18564b..c52ceabb5d 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -503,12 +503,19 @@ static void autodetectGlExtensions(void) { ati_broken_pbo = ver && ver < 8395; } if (ati_hack == -1) ati_hack = ati_broken_pbo; - if (force_pbo == -1 && extensions && strstr(extensions, "_pixel_buffer_object")) - force_pbo = is_ati; - if (use_rectangle == -1 && extensions && strstr(extensions, "_texture_non_power_of_two")) + if (force_pbo == -1) { + force_pbo = 0; + if (extensions && strstr(extensions, "_pixel_buffer_object")) + force_pbo = is_ati; + } + if (use_rectangle == -1) { use_rectangle = 0; - if (use_rectangle == -1 && extensions && strstr(extensions, "_texture_rectangle")) - use_rectangle = renderer && strstr(renderer, "Mesa DRI R200") ? 1 : 0; + if (extensions) { +// if (strstr(extensions, "_texture_non_power_of_two")) + if (strstr(extensions, "_texture_rectangle")) + use_rectangle = renderer && strstr(renderer, "Mesa DRI R200") ? 1 : 0; + } + } if (use_osd == -1) use_osd = mpglBindTexture != NULL; if (use_yuv == -1) diff --git a/libvo/vo_md5sum.c b/libvo/vo_md5sum.c index 572f643a46..43703997b8 100644 --- a/libvo/vo_md5sum.c +++ b/libvo/vo_md5sum.c @@ -218,6 +218,8 @@ static uint32_t draw_image(mp_image_t *mpi) h = h / 2; for (i=0; i<h; i++) { av_md5_update(md5_context, planeU + i * strideU, w); + } + for (i=0; i<h; i++) { av_md5_update(md5_context, planeV + i * strideV, w); } av_md5_final(md5_context, md5sum); @@ -2468,7 +2468,7 @@ static double update_video(struct MPContext *mpctx) if (in_size < 0) { // try to extract last frames in case of decoder lag in_size = 0; - pts = 1e300; + pts = MP_NOPTS_VALUE; hit_eof = true; } if (in_size > max_framesize) diff --git a/stream/cache2.c b/stream/cache2.c index 7afcbf1b5b..2558adbb91 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -23,6 +23,10 @@ // TODO: seeking, data consistency checking #define READ_USLEEP_TIME 10000 +// These defines are used to reduce the cost of many succesive +// seeks (e.g. when a file has no index) by spinning quickly at first. +#define INITIAL_FILL_USLEEP_TIME 1000 +#define INITIAL_FILL_USLEEP_COUNT 10 #define FILL_USLEEP_TIME 50000 #define PREFILL_SLEEP_TIME 200 #define CONTROL_SLEEP_TIME 0 @@ -49,6 +53,10 @@ static void ThreadProc( void *s ); static void *ThreadProc(void *s); #else #include <sys/wait.h> +#define FORKED_CACHE 1 +#endif +#ifndef FORKED_CACHE +#define FORKED_CACHE 0 #endif #include "mp_msg.h" @@ -88,6 +96,14 @@ static int min_fill=0; int cache_fill_status=0; +static void cache_wakeup(stream_t *s) +{ +#if FORKED_CACHE + // signal process to wake up immediately + kill(s->cache_pid, SIGUSR1); +#endif +} + static void cache_stats(cache_vars_t *s) { int newb=s->max_filepos-s->read_filepos; // new bytes in the buffer @@ -261,13 +277,25 @@ static int cache_execute_control(cache_vars_t *s) { return 1; } -static cache_vars_t* cache_init(int size,int sector){ - int num; -#if !defined(__MINGW32__) && !defined(PTHREAD_CACHE) && !defined(__OS2__) - cache_vars_t* s=shmem_alloc(sizeof(cache_vars_t)); +static void *shared_alloc(int size) { +#if FORKED_CACHE + return shmem_alloc(size); #else - cache_vars_t* s=malloc(sizeof(cache_vars_t)); + return malloc(size); #endif +} + +static void shared_free(void *ptr, int size) { +#if FORKED_CACHE + shmem_free(ptr, size); +#else + free(ptr); +#endif +} + +static cache_vars_t* cache_init(int size,int sector){ + int num; + cache_vars_t* s=shared_alloc(sizeof(cache_vars_t)); if(s==NULL) return NULL; memset(s,0,sizeof(cache_vars_t)); @@ -277,18 +305,10 @@ static cache_vars_t* cache_init(int size,int sector){ }//32kb min_size s->buffer_size=num*sector; s->sector_size=sector; -#if !defined(__MINGW32__) && !defined(PTHREAD_CACHE) && !defined(__OS2__) - s->buffer=shmem_alloc(s->buffer_size); -#else - s->buffer=malloc(s->buffer_size); -#endif + s->buffer=shared_alloc(s->buffer_size); if(s->buffer == NULL){ -#if !defined(__MINGW32__) && !defined(PTHREAD_CACHE) && !defined(__OS2__) - shmem_free(s,sizeof(cache_vars_t)); -#else - free(s); -#endif + shared_free(s, sizeof(cache_vars_t)); return NULL; } @@ -300,7 +320,7 @@ static cache_vars_t* cache_init(int size,int sector){ void cache_uninit(stream_t *s) { cache_vars_t* c = s->cache_data; if(s->cache_pid) { -#if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) +#if !FORKED_CACHE cache_do_control(s, -2, NULL); #else kill(s->cache_pid,SIGKILL); @@ -309,16 +329,10 @@ void cache_uninit(stream_t *s) { s->cache_pid = 0; } if(!c) return; -#if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) - free(c->buffer); + shared_free(c->buffer, c->buffer_size); c->buffer = NULL; c->stream = NULL; - free(s->cache_data); -#else - shmem_free(c->buffer,c->buffer_size); - c->buffer = NULL; - shmem_free(s->cache_data,sizeof(cache_vars_t)); -#endif + shared_free(s->cache_data, sizeof(cache_vars_t)); s->cache_data = NULL; } @@ -327,6 +341,27 @@ static void exit_sighandler(int x){ exit(0); } +static void dummy_sighandler(int x) { +} + +/** + * Main loop of the cache process or thread. + */ +static void cache_mainloop(cache_vars_t *s) { + int sleep_count = 0; + do { + if (!cache_fill(s)) { + if (sleep_count < INITIAL_FILL_USLEEP_COUNT) { + sleep_count++; + usec_sleep(INITIAL_FILL_USLEEP_TIME); + } else + usec_sleep(FILL_USLEEP_TIME); // idle + } else + sleep_count = 0; +// cache_stats(s->cache_data); + } while (cache_execute_control(s)); +} + /** * \return 1 on success, 0 if the function was interrupted and -1 on error */ @@ -356,7 +391,7 @@ int stream_enable_cache(stream_t *stream,int size,int min,int seek_limit){ min = s->buffer_size - s->fill_limit; } -#if !defined(__MINGW32__) && !defined(PTHREAD_CACHE) && !defined(__OS2__) +#if FORKED_CACHE if((stream->cache_pid=fork())){ if ((pid_t)stream->cache_pid == -1) stream->cache_pid = 0; @@ -404,32 +439,28 @@ err_out: return res; } -#if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) -} -#ifdef PTHREAD_CACHE -static void *ThreadProc( void *s ){ -#else -static void ThreadProc( void *s ){ -#endif +#if FORKED_CACHE + signal(SIGTERM,exit_sighandler); // kill + signal(SIGUSR1, dummy_sighandler); // wakeup + cache_mainloop(s); + // make sure forked code never leaves this function + exit(0); #endif +} -// cache thread mainloop: - signal(SIGTERM,exit_sighandler); // kill - do { - if(!cache_fill(s)){ - usec_sleep(FILL_USLEEP_TIME); // idle - } -// cache_stats(s->cache_data); - } while (cache_execute_control(s)); +#if !FORKED_CACHE #if defined(__MINGW32__) || defined(__OS2__) +static void ThreadProc( void *s ){ + cache_mainloop(s); _endthread(); -#elif defined(PTHREAD_CACHE) - return NULL; +} #else - // make sure forked code never leaves this function - exit(0); -#endif +static void *ThreadProc( void *s ){ + cache_mainloop(s); + return NULL; } +#endif +#endif int cache_stream_fill_buffer(stream_t *s){ int len; @@ -465,6 +496,7 @@ int cache_stream_seek_long(stream_t *stream,off_t pos){ newpos=pos/s->sector_size; newpos*=s->sector_size; // align stream->pos=s->read_filepos=newpos; s->eof=0; // !!!!!!! + cache_wakeup(stream); cache_stream_fill_buffer(stream); @@ -509,6 +541,7 @@ int cache_do_control(stream_t *stream, int cmd, void *arg) { default: return STREAM_UNSUPPORTED; } + cache_wakeup(stream); while (s->control != -1) usec_sleep(CONTROL_SLEEP_TIME); switch (cmd) { |