From 09cf021307f6f8114af6dbaa81eb0a087275967c Mon Sep 17 00:00:00 2001 From: reimar Date: Fri, 26 Feb 2010 21:41:42 +0000 Subject: Port yuv=... auto-detection from gl to gl2. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30753 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl2.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/libvo/vo_gl2.c b/libvo/vo_gl2.c index 9d1bd533d1..1607649a5f 100644 --- a/libvo/vo_gl2.c +++ b/libvo/vo_gl2.c @@ -865,7 +865,7 @@ static int preinit(const char *arg) #ifdef CONFIG_GL_WIN32 gltype = GLTYPE_W32; #endif - use_yuv = 0; + use_yuv = -1; use_glFinish = 1; if (subopt_parse(arg, subopts) != 0) { mp_msg(MSGT_VO, MSGL_FATAL, @@ -884,8 +884,25 @@ static int preinit(const char *arg) "\n" ); return -1; } - if(!init_mpglcontext(&glctx, gltype)) return -1; + if(!init_mpglcontext(&glctx, gltype)) goto err_out; + if (use_yuv == -1) { + const char *extensions; +#ifdef CONFIG_GL_WIN32 + if (config_w32(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1) +#else + if (config_glx(320, 200, 320, 200, VOFLAG_HIDDEN, "", 0) == -1) +#endif + goto err_out; + if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) + goto err_out; + extensions = GetString(GL_EXTENSIONS); + use_yuv = strstr(extensions, "GL_ARB_fragment_program") ? 2 : 0; + } return 0; + +err_out: + uninit(); + return -1; } static int control(uint32_t request, void *data, ...) -- cgit v1.2.3 From 50fed7d1f91dbfacd73b0a6292990626a0d4f236 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 06:17:14 +0000 Subject: Restructure #ifs to be clearer, also ensures that we return from the thread proc instead of calling exit() on __MINGW32__. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30754 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stream/cache2.c b/stream/cache2.c index 7e42c6b60e..1a7942d098 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -430,12 +430,12 @@ static void ThreadProc( void *s ){ } while (cache_execute_control(s)); #if defined(__MINGW32__) || defined(__OS2__) _endthread(); -#endif -#ifdef PTHREAD_CACHE +#elif defined(PTHREAD_CACHE) return NULL; -#endif +#else // make sure forked code never leaves this function exit(0); +#endif } int cache_stream_fill_buffer(stream_t *s){ -- cgit v1.2.3 From 3a43f13fcec1d804a04687cfd9d5030f80bbf575 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 11:32:48 +0000 Subject: Fix compilation of C++ source files (partly reverts r30744). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30755 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demuxer.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h index 4be7e5a5a0..699e5a56b9 100644 --- a/libmpdemux/demuxer.h +++ b/libmpdemux/demuxer.h @@ -261,7 +261,7 @@ typedef struct { } demux_program_t; static inline demux_packet_t* new_demux_packet(int len){ - demux_packet_t* dp = malloc(sizeof(demux_packet_t)); + demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); dp->len=len; dp->next=NULL; dp->pts=MP_NOPTS_VALUE; @@ -272,7 +272,7 @@ static inline demux_packet_t* new_demux_packet(int len){ dp->refcount=1; dp->master=NULL; dp->buffer=NULL; - if (len > 0 && (dp->buffer = malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) + if (len > 0 && (dp->buffer = (unsigned char *)malloc(len + MP_INPUT_BUFFER_PADDING_SIZE))) memset(dp->buffer + len, 0, 8); else dp->len = 0; @@ -283,7 +283,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) { if(len > 0) { - dp->buffer = realloc(dp->buffer, len + 8); + dp->buffer=(unsigned char *)realloc(dp->buffer,len+8); } else { @@ -298,7 +298,7 @@ static inline void resize_demux_packet(demux_packet_t* dp, int len) } static inline demux_packet_t* clone_demux_packet(demux_packet_t* pack){ - demux_packet_t* dp = malloc(sizeof(demux_packet_t)); + demux_packet_t* dp=(demux_packet_t*)malloc(sizeof(demux_packet_t)); while(pack->master) pack=pack->master; // find the master memcpy(dp,pack,sizeof(demux_packet_t)); dp->next=NULL; -- cgit v1.2.3 From 26cab7638fa5aab4f52fabce143ee1e9158c05bc Mon Sep 17 00:00:00 2001 From: zuxy Date: Sat, 27 Feb 2010 12:10:34 +0000 Subject: Replace =A with =a and =d; make frequency calculation correct under x86-64 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30756 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpuinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cpuinfo.c b/cpuinfo.c index 1610cb3092..a1bd4f621b 100644 --- a/cpuinfo.c +++ b/cpuinfo.c @@ -77,10 +77,10 @@ cpuid(int func) { static int64_t rdtsc(void) { - uint64_t i; + uint64_t hi, lo; #define RDTSC ".byte 0x0f, 0x31; " - __asm__ volatile (RDTSC : "=A"(i) : ); - return i; + __asm__ volatile (RDTSC : "=a"(lo), "=d"(hi) : ); + return hi << 32 | lo; } static const char* -- cgit v1.2.3 From a7b58b6d7a12a9dd091555c9f9d29ed2ad32e54b Mon Sep 17 00:00:00 2001 From: zuxy Date: Sat, 27 Feb 2010 12:15:02 +0000 Subject: 10l correct type for =a and =d constraints under x86-32 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30757 b3059339-0415-0410-9bf9-f77b7e298cf2 --- cpuinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpuinfo.c b/cpuinfo.c index a1bd4f621b..2010efd8be 100644 --- a/cpuinfo.c +++ b/cpuinfo.c @@ -77,10 +77,10 @@ cpuid(int func) { static int64_t rdtsc(void) { - uint64_t hi, lo; + uint32_t hi, lo; #define RDTSC ".byte 0x0f, 0x31; " __asm__ volatile (RDTSC : "=a"(lo), "=d"(hi) : ); - return hi << 32 | lo; + return (uint64_t) hi << 32 | lo; } static const char* -- cgit v1.2.3 From 664e5bb9b8519f0474c40db472c06a7c5d5f4245 Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 27 Feb 2010 12:45:12 +0000 Subject: Remove unnecessary stream.h #includes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30758 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_rtp.h | 3 --- libmpdemux/demux_rtp_internal.h | 3 --- 2 files changed, 6 deletions(-) diff --git a/libmpdemux/demux_rtp.h b/libmpdemux/demux_rtp.h index 0e2c665ae8..7273afc3be 100644 --- a/libmpdemux/demux_rtp.h +++ b/libmpdemux/demux_rtp.h @@ -22,9 +22,6 @@ #include #include -#ifndef STREAM_H -#include "stream/stream.h" -#endif #ifndef DEMUXER_H #include "demuxer.h" #endif diff --git a/libmpdemux/demux_rtp_internal.h b/libmpdemux/demux_rtp_internal.h index 77f0364918..88b1f7e98b 100644 --- a/libmpdemux/demux_rtp_internal.h +++ b/libmpdemux/demux_rtp_internal.h @@ -22,9 +22,6 @@ #include extern "C" { -#ifndef STREAM_H -#include "stream/stream.h" -#endif #ifndef DEMUXER_H #include "demuxer.h" #endif -- cgit v1.2.3 From 01c5a73c5359fb71c1d394194969b1eeb55575b0 Mon Sep 17 00:00:00 2001 From: diego Date: Sat, 27 Feb 2010 12:48:11 +0000 Subject: Remove pointless #ifdef checks for DEMUXER_H, which is never set. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30759 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/demux_rtp.h | 3 --- libmpdemux/demux_rtp_internal.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/libmpdemux/demux_rtp.h b/libmpdemux/demux_rtp.h index 7273afc3be..6d3462d856 100644 --- a/libmpdemux/demux_rtp.h +++ b/libmpdemux/demux_rtp.h @@ -21,10 +21,7 @@ #include #include - -#ifndef DEMUXER_H #include "demuxer.h" -#endif // Open a RTP demuxer (which was initiated either from a SDP file, // or from a RTSP URL): diff --git a/libmpdemux/demux_rtp_internal.h b/libmpdemux/demux_rtp_internal.h index 88b1f7e98b..fb8f582b53 100644 --- a/libmpdemux/demux_rtp_internal.h +++ b/libmpdemux/demux_rtp_internal.h @@ -22,9 +22,7 @@ #include extern "C" { -#ifndef DEMUXER_H #include "demuxer.h" -#endif #ifdef CONFIG_LIBAVCODEC #include "libavcodec/avcodec.h" #endif -- cgit v1.2.3 From 05c24134de2923762a718b4e1c31c60131d46124 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 17:55:57 +0000 Subject: Enable StructureNotifyMask before waiting for a DestroyNotify event. Fixes hangs if OpenGL initialization fails in vo gl preinit and we call uninit while the window is still hidden. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30760 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/x11_common.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index c0278caa42..5c21fee975 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -788,6 +788,7 @@ void vo_x11_uninit(void) XEvent xev; XUnmapWindow(mDisplay, vo_window); + XSelectInput(mDisplay, vo_window, StructureNotifyMask); XDestroyWindow(mDisplay, vo_window); do { -- cgit v1.2.3 From e92eaa0fd82d5824eb6a29acd7886b4331ad3087 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 18:16:41 +0000 Subject: Only prefer -vo gl over -vo x11 if hardware acceleration is available. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30761 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/video_out.c | 6 ++++-- libvo/vo_gl.c | 38 ++++++++++++++++++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/libvo/video_out.c b/libvo/video_out.c index d721e0a526..8fca2b85c2 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -94,6 +94,7 @@ extern vo_functions_t video_out_xover; extern vo_functions_t video_out_xvmc; extern vo_functions_t video_out_vdpau; extern vo_functions_t video_out_xv; +extern vo_functions_t video_out_gl_nosw; extern vo_functions_t video_out_gl; extern vo_functions_t video_out_gl2; extern vo_functions_t video_out_matrixview; @@ -186,14 +187,15 @@ const vo_functions_t* const video_out_drivers[] = #ifdef CONFIG_XV &video_out_xv, #endif +#ifdef CONFIG_X11 #ifdef CONFIG_GL - &video_out_gl, + &video_out_gl_nosw, #endif -#ifdef CONFIG_X11 &video_out_x11, &video_out_xover, #endif #ifdef CONFIG_GL + &video_out_gl, &video_out_gl2, #endif #ifdef CONFIG_DGA diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index acf7e96891..502058ace6 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -47,6 +47,21 @@ static const vo_info_t info = const LIBVO_EXTERN(gl) + +static const vo_info_t info_nosw = +{ + "X11 (OpenGL) no software rendering", + "gl_nosw", + "Arpad Gereoffy ", + "" +}; +static int preinit_nosw(const char *arg); +#define info info_nosw +#define preinit preinit_nosw +const LIBVO_EXTERN(gl_nosw) +#undef info +#undef preinit + #ifdef CONFIG_GL_X11 static int wsGLXAttrib[] = { GLX_RGBA, GLX_RED_SIZE,1, @@ -444,6 +459,13 @@ static void uninitGl(void) { err_shown = 0; } +static int isSoftwareGl(void) +{ + const char *renderer = GetString(GL_RENDERER); +renderer = "Software Rasterizer"; + return strcmp(renderer, "Software Rasterizer") == 0; +} + static void autodetectGlExtensions(void) { const char *extensions = GetString(GL_EXTENSIONS); const char *vendor = GetString(GL_VENDOR); @@ -1052,7 +1074,7 @@ static const opt_t subopts[] = { {NULL} }; -static int preinit(const char *arg) +static int preinit_internal(const char *arg, int allow_sw) { enum MPGLType gltype = GLTYPE_X11; // set defaults @@ -1161,11 +1183,13 @@ static int preinit(const char *arg) } if (!init_mpglcontext(&glctx, gltype)) goto err_out; - if (use_yuv == -1) { + if (use_yuv == -1 || !allow_sw) { if (create_window(320, 200, VOFLAG_HIDDEN, NULL) < 0) goto err_out; if (glctx.setGlWindow(&glctx) == SET_WINDOW_FAILED) goto err_out; + if (!allow_sw && isSoftwareGl()) + goto err_out; autodetectGlExtensions(); } if (many_fmts) @@ -1181,6 +1205,16 @@ err_out: return -1; } +static int preinit(const char *arg) +{ + return preinit_internal(arg, 1); +} + +static int preinit_nosw(const char *arg) +{ + return preinit_internal(arg, 0); +} + static const struct { const char *name; int *value; -- cgit v1.2.3 From 5f32754c143017e1a52f18a82f28f47026e8c27b Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 18:17:33 +0000 Subject: 100l, remove forgotten debugging code. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30762 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index 502058ace6..a2e832e2ed 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -462,7 +462,6 @@ static void uninitGl(void) { static int isSoftwareGl(void) { const char *renderer = GetString(GL_RENDERER); -renderer = "Software Rasterizer"; return strcmp(renderer, "Software Rasterizer") == 0; } -- cgit v1.2.3 From 84a962ebea8e695de1a9af41ccd100a969cec1a0 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 18:20:22 +0000 Subject: Update -vo gl info structs, it isn't X11-only since ages and there's basically no code left from Arpi and it's unlikely the email address is still working anyway. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30763 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_gl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index a2e832e2ed..4fd8efb671 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -39,9 +39,9 @@ static const vo_info_t info = { - "X11 (OpenGL)", + "OpenGL", "gl", - "Arpad Gereoffy ", + "Reimar Doeffinger ", "" }; @@ -50,9 +50,9 @@ const LIBVO_EXTERN(gl) static const vo_info_t info_nosw = { - "X11 (OpenGL) no software rendering", + "OpenGL no software rendering", "gl_nosw", - "Arpad Gereoffy ", + "Reimar Doeffinger ", "" }; static int preinit_nosw(const char *arg); -- cgit v1.2.3 From 186bff568efa4ba64f293bb157677f415fce5e7d Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 19:53:25 +0000 Subject: Fix windows Gui compilation and remove some related typecasts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30764 b3059339-0415-0410-9bf9-f77b7e298cf2 --- gui/win32/interface.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/gui/win32/interface.c b/gui/win32/interface.c index d74c76a356..5fbaa1ed64 100644 --- a/gui/win32/interface.c +++ b/gui/win32/interface.c @@ -519,11 +519,11 @@ void guiDone(void) } /* this function gets called by mplayer to update the gui */ -int guiGetEvent(int type, char *arg) +int guiGetEvent(int type, void *arg) { - stream_t *stream = (stream_t *) arg; + stream_t *stream = arg; #ifdef CONFIG_DVDREAD - dvd_priv_t *dvdp = (dvd_priv_t *) arg; + dvd_priv_t *dvdp = arg; #endif if(!mygui || !mygui->skin) return 0; @@ -577,17 +577,17 @@ int guiGetEvent(int type, char *arg) break; } case guiSetContext: - guiIntfStruct.mpcontext = (void *) arg; + guiIntfStruct.mpcontext = arg; break; case guiSetDemuxer: - guiIntfStruct.demuxer = (void *) arg; + guiIntfStruct.demuxer = arg; break; case guiSetValues: { guiIntfStruct.sh_video = arg; if (arg) { - sh_video_t *sh = (sh_video_t *)arg; + sh_video_t *sh = arg; codecname = sh->codec->name; guiIntfStruct.FPS = sh->fps; @@ -644,7 +644,7 @@ int guiGetEvent(int type, char *arg) mygui->updatedisplay(mygui, mygui->mainwindow); break; case guiSetAfilter: - guiIntfStruct.afilter = (void *) arg; + guiIntfStruct.afilter = arg; break; case guiCEvent: { @@ -719,7 +719,7 @@ int guiGetEvent(int type, char *arg) break; } case guiSetFileName: - if (arg) guiIntfStruct.Filename = (char *) arg; + if (arg) guiIntfStruct.Filename = arg; break; case guiSetDefaults: { -- cgit v1.2.3 From f47d90850d34cd9baeed005d96b1673fb1351702 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:13:21 +0000 Subject: Remove unused static function streaming_stop(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30765 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/network.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/stream/network.c b/stream/network.c index 25d4cf3533..9750d28478 100644 --- a/stream/network.c +++ b/stream/network.c @@ -470,9 +470,3 @@ void fixup_network_stream_cache(stream_t *stream) { } } - -static int -streaming_stop( stream_t *stream ) { - stream->streaming_ctrl->status = streaming_stopped_e; - return 0; -} -- cgit v1.2.3 From 8271fc722b86853e6da929c0d3ffc5c4ee5b4766 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:22:30 +0000 Subject: Remove unused static function send_lpcm_packet(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30766 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libvo/vo_mpegpes.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/libvo/vo_mpegpes.c b/libvo/vo_mpegpes.c index 4813916fbd..f9f02c7654 100644 --- a/libvo/vo_mpegpes.c +++ b/libvo/vo_mpegpes.c @@ -225,13 +225,6 @@ static void send_pes_packet(unsigned char* data, int len, int id, int timestamp) send_mpeg_pes_packet (data, len, id, timestamp, 1, my_write); } -static void send_lpcm_packet(unsigned char* data, int len, int id, - unsigned int timestamp, int freq_id) -{ - send_mpeg_lpcm_packet(data, len, id, timestamp, freq_id, my_write); -} - - static int draw_frame(uint8_t * src[]) { vo_mpegpes_t *p=(vo_mpegpes_t *)src[0]; -- cgit v1.2.3 From 7529306884a8a1fa49bbd7679fe501fbbacb8d9f Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:32:55 +0000 Subject: Include lirc.h in lirc.c to add missing prototypes. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30767 b3059339-0415-0410-9bf9-f77b7e298cf2 --- input/lirc.c | 1 + 1 file changed, 1 insertion(+) diff --git a/input/lirc.c b/input/lirc.c index d7fb95d7f8..d926988b82 100644 --- a/input/lirc.c +++ b/input/lirc.c @@ -29,6 +29,7 @@ #include "mp_msg.h" #include "help_mp.h" #include "input.h" +#include "lirc.h" static struct lirc_config *lirc_config; char *lirc_configfile; -- cgit v1.2.3 From f05e7aa4b984c907eb7bf090b766ea4392724fbe Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:38:21 +0000 Subject: Remove unused static function vdlPlaybackCopyFrame(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30768 b3059339-0415-0410-9bf9-f77b7e298cf2 --- vidix/vidix.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/vidix/vidix.c b/vidix/vidix.c index 8fe02e4836..ad0cfe13d2 100644 --- a/vidix/vidix.c +++ b/vidix/vidix.c @@ -153,11 +153,6 @@ int vdlPlaybackSetEq (VDXContext *ctx, const vidix_video_eq_t *e) return ctx->drv->set_eq ? ctx->drv->set_eq (e) : ENOSYS; } -static int vdlPlaybackCopyFrame(VDXContext *ctx, const vidix_dma_t *f) -{ - return ctx->drv->copy_frame ? ctx->drv->copy_frame (f) : ENOSYS; -} - int vdlGetGrKeys (VDXContext *ctx, vidix_grkey_t *k) { return ctx->drv->get_gkey ? ctx->drv->get_gkey (k) : ENOSYS; -- cgit v1.2.3 From e2a81b9be1dcc84c33dab25078f65da02a3bc972 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:50:20 +0000 Subject: Remove unused static functions asx_list_add() and asx_list_remove(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30769 b3059339-0415-0410-9bf9-f77b7e298cf2 --- asxparser.c | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/asxparser.c b/asxparser.c index 9ea11435ae..6787759805 100644 --- a/asxparser.c +++ b/asxparser.c @@ -36,53 +36,6 @@ extern m_config_t* mconfig; ////// List utils -static void -asx_list_add(void* list_ptr,void* entry){ - void** list = *(void***)list_ptr; - int c = 0; - - if(list != NULL) - for( ; list[c] != NULL; c++) ; - - list = realloc(list, sizeof(void*) * (c + 2)); - - list[c] = entry; - list[c+1] = NULL; - - *(void***)list_ptr = list; -} - - -static void -asx_list_remove(void* list_ptr,void* entry,ASX_FreeFunc free_func) { - void** list = *(void***)list_ptr; - int c,e = -1; - - if(list == NULL) return; - - for(c = 0 ; list[c] != NULL; c++){ - if(list[c] == entry) e = c; - } - - if(e == -1) return; // Not found - - if(free_func != NULL) free_func(list[e]); - - if(c == 1) { // Only one entry, we drop all - free(list); - *(void**)list_ptr = NULL; - return; - } - - if(c > e) // If c==e the memmove is not needed - memmove(list+e,list+e+1,(c-e)*sizeof(void*)); - - list = realloc(list, (c - 1) * sizeof(void*)); - list[c-1] = NULL; - - *(void***)list_ptr = list; -} - void asx_list_free(void* list_ptr,ASX_FreeFunc free_func) { void** ptr = *(void***)list_ptr; -- cgit v1.2.3 From b3db1152bba3513fd36e742b6cec75a78e1d0329 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:52:06 +0000 Subject: Remove unused static function m_config_get_option_ptr(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30770 b3059339-0415-0410-9bf9-f77b7e298cf2 --- m_config.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/m_config.c b/m_config.c index 2c2ca0fc08..6214a5635c 100644 --- a/m_config.c +++ b/m_config.c @@ -415,19 +415,6 @@ m_config_get_option(m_config_t *config, char* arg) { return NULL; } -static const void* -m_config_get_option_ptr(m_config_t *config, char* arg) { - const m_option_t* conf; - -#ifdef MP_DEBUG - assert(config != NULL); - assert(arg != NULL); -#endif - - conf = m_config_get_option(config,arg); - if(!conf) return NULL; - return conf->p; -} void m_config_print_option_list(m_config_t *config) { -- cgit v1.2.3 From 49d31b325b5a10443ced55ae61e15856817201ae Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 20:55:41 +0000 Subject: Remove unused static function play_tree_set_flag(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30771 b3059339-0415-0410-9bf9-f77b7e298cf2 --- playtree.c | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/playtree.c b/playtree.c index 4ff88f241e..112cb7f1e4 100644 --- a/playtree.c +++ b/playtree.c @@ -414,20 +414,6 @@ play_tree_set_params_from(play_tree_t* dest,play_tree_t* src) { } -// all children if deep < 0 -static void -play_tree_set_flag(play_tree_t* pt, int flags , int deep) { - play_tree_t* i; - - pt->flags |= flags; - - if(deep && pt->child) { - if(deep > 0) deep--; - for(i = pt->child ; i ; i = i->next) - play_tree_set_flag(i,flags,deep); - } -} - static void play_tree_unset_flag(play_tree_t* pt, int flags , int deep) { play_tree_t* i; -- cgit v1.2.3 From f21d2dcc7e1d0832584b7bec500b690c3f351678 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 21:02:14 +0000 Subject: Make function Gsm_Long_Term_Synthesis_Filtering() static, only used in xa_gsm.c. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30772 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/native/xa_gsm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/native/xa_gsm.c b/libmpcodecs/native/xa_gsm.c index 73bf31c3d8..2fc2357c13 100644 --- a/libmpcodecs/native/xa_gsm.c +++ b/libmpcodecs/native/xa_gsm.c @@ -258,7 +258,7 @@ register word * s; } /**** 4.3.2 */ -void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp) +static void Gsm_Long_Term_Synthesis_Filtering (S,Ncr,bcr,erp,drp) XA_GSM_STATE * S; word Ncr; word bcr; -- cgit v1.2.3 From 827df51f1db5ab8ae774396c5d7fa955908e306e Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 21:02:44 +0000 Subject: Threaded cache fixes: do not free the stream_t struct twice on windows and make sure the cache thread quits also for streams without a control function (e.g. http). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30773 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cache2.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/stream/cache2.c b/stream/cache2.c index 1a7942d098..2e2aadc3fe 100644 --- a/stream/cache2.c +++ b/stream/cache2.c @@ -222,14 +222,14 @@ static int cache_fill(cache_vars_t *s) } static int cache_execute_control(cache_vars_t *s) { - int res = 1; static unsigned last; - if (!s->stream->control) { + int quit = s->control == -2; + if (quit || !s->stream->control) { s->stream_time_length = 0; s->control_new_pos = 0; s->control_res = STREAM_UNSUPPORTED; s->control = -1; - return res; + return !quit; } if (GetTimerMS() - last > 99) { double len; @@ -239,7 +239,7 @@ static int cache_execute_control(cache_vars_t *s) { s->stream_time_length = 0; last = GetTimerMS(); } - if (s->control == -1) return res; + if (s->control == -1) return 1; switch (s->control) { case STREAM_CTRL_GET_CURRENT_TIME: case STREAM_CTRL_SEEK_TO_TIME: @@ -254,15 +254,13 @@ static int cache_execute_control(cache_vars_t *s) { case STREAM_CTRL_SET_ANGLE: s->control_res = s->stream->control(s->stream, s->control, &s->control_uint_arg); break; - case -2: - res = 0; default: s->control_res = STREAM_UNSUPPORTED; break; } s->control_new_pos = s->stream->pos; s->control = -1; - return res; + return 1; } static cache_vars_t* cache_init(int size,int sector){ @@ -314,9 +312,9 @@ void cache_uninit(stream_t *s) { } if(!c) return; #if defined(__MINGW32__) || defined(PTHREAD_CACHE) || defined(__OS2__) - free(c->stream); free(c->buffer); c->buffer = NULL; + c->stream = NULL; free(s->cache_data); #else shmem_free(c->buffer,c->buffer_size); -- cgit v1.2.3 From c44915814cc211b5527dadc6f56956ec4df68968 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 21:29:06 +0000 Subject: Remove unused static function mp_mp3_get_lsf(). git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30774 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpdemux/mp3_hdr.c | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/libmpdemux/mp3_hdr.c b/libmpdemux/mp3_hdr.c index 1e70c17976..fc4bf6d7f7 100644 --- a/libmpdemux/mp3_hdr.c +++ b/libmpdemux/mp3_hdr.c @@ -38,18 +38,6 @@ static long freqs[9] = { 44100, 48000, 32000, // MPEG 1.0 22050, 24000, 16000, // MPEG 2.0 11025, 12000, 8000}; // MPEG 2.5 -static int mp_mp3_get_lsf(unsigned char* hbuf){ - unsigned long newhead = - hbuf[0] << 24 | - hbuf[1] << 16 | - hbuf[2] << 8 | - hbuf[3]; - if( newhead & ((long)1<<20) ) { - return (newhead & ((long)1<<19)) ? 0x0 : 0x1; - } - return 1; -} - /* * return frame size or -1 (bad frame) */ -- cgit v1.2.3 From d1b81c6c1c8e7079dc7aa51c8afc6167e4b712c2 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 21:32:33 +0000 Subject: Fix cd_info_new() prototype. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30775 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/cdd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stream/cdd.h b/stream/cdd.h index 9f2ae2fbb6..c6d6e9d92b 100644 --- a/stream/cdd.h +++ b/stream/cdd.h @@ -86,7 +86,7 @@ typedef struct { cd_info_t *cd_info; } cdda_priv; -cd_info_t* cd_info_new(); +cd_info_t* cd_info_new(void); void cd_info_free(cd_info_t *cd_info); cd_track_t* cd_info_add_track(cd_info_t *cd_info, char *track_name, unsigned int track_nb, unsigned int min, unsigned int sec, unsigned int msec, unsigned long frame_begin, unsigned long frame_length); cd_track_t* cd_info_get_track(cd_info_t *cd_info, unsigned int track_nb); -- cgit v1.2.3 From 27306a18db00afb3e5e4aced936e4d9ad9ddfdf5 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 21:47:45 +0000 Subject: Include getch2.h to get rid of some warnings. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30776 b3059339-0415-0410-9bf9-f77b7e298cf2 --- osdep/getch2-win.c | 1 + 1 file changed, 1 insertion(+) diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index 3c428834ff..5528680cd8 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -30,6 +30,7 @@ #include "keycodes.h" #include "input/input.h" #include "mp_fifo.h" +#include "getch2.h" // HACK, stdin is used as something else below #undef stdin -- cgit v1.2.3 From 5f25eaf3d2011cfb92d4553b1421c13d98090906 Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 21:50:59 +0000 Subject: Do not misuse the stdin name. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30777 b3059339-0415-0410-9bf9-f77b7e298cf2 --- osdep/getch2-win.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index 5528680cd8..45f68e8196 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -31,17 +31,15 @@ #include "input/input.h" #include "mp_fifo.h" #include "getch2.h" -// HACK, stdin is used as something else below -#undef stdin int mp_input_slave_cmd_func(int fd,char* dest,int size){ DWORD retval; - HANDLE stdin = GetStdHandle(STD_INPUT_HANDLE); - if(!PeekNamedPipe(stdin, NULL, size, &retval, NULL, NULL) || !retval){ + HANDLE in = GetStdHandle(STD_INPUT_HANDLE); + if(!PeekNamedPipe(in, NULL, size, &retval, NULL, NULL) || !retval){ return MP_INPUT_NOTHING; } if(retval>size)retval=size; - ReadFile(stdin, dest, retval, &retval, NULL); + ReadFile(in, dest, retval, &retval, NULL); if(retval)return retval; return MP_INPUT_NOTHING; } @@ -53,7 +51,7 @@ char * erase_to_end_of_line = NULL; void get_screen_size(void){ } -static HANDLE stdin; +static HANDLE in; static int getch2_status=0; static int getch2_internal(void) @@ -63,7 +61,7 @@ static int getch2_internal(void) int i=0; if(!getch2_status)return -1; /*check if there are input events*/ - if(!GetNumberOfConsoleInputEvents(stdin,&retval)) + if(!GetNumberOfConsoleInputEvents(in,&retval)) { printf("getch2: can't get number of input events: %i\n",GetLastError()); return -1; @@ -71,7 +69,7 @@ static int getch2_internal(void) if(retval<=0)return -1; /*read all events*/ - if(!ReadConsoleInput(stdin,eventbuffer,128,&retval)) + if(!ReadConsoleInput(in,eventbuffer,128,&retval)) { printf("getch: can't read input events\n"); return -1; @@ -150,8 +148,8 @@ void getch2(void) void getch2_enable(void) { DWORD retval; - stdin = GetStdHandle(STD_INPUT_HANDLE); - if(!GetNumberOfConsoleInputEvents(stdin,&retval)) + in = GetStdHandle(STD_INPUT_HANDLE); + if(!GetNumberOfConsoleInputEvents(in,&retval)) { printf("getch2: %i can't get number of input events [disabling console input]\n",GetLastError()); getch2_status = 0; -- cgit v1.2.3 From 5a1eca395cc4b6e6b4436c71d4b32405d25a9bbb Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 22:32:25 +0000 Subject: Actually use existing uninit() function in remove_logo filter. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30778 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_remove_logo.c | 38 ++++++++++++++++++++------------------ 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c index 69cca75596..72408fbea8 100644 --- a/libmpcodecs/vf_remove_logo.c +++ b/libmpcodecs/vf_remove_logo.c @@ -819,6 +819,25 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) return 0; } +/** + * \brief Frees memory that our filter allocated. + * + * This is called at exit-time. + */ +static void uninit(vf_instance_t *vf) +{ + vf_priv_s *ctx = (vf_priv_s *)vf->priv; + /* Destroy our masks and images. */ + destroy_pgm(ctx->filter); + destroy_pgm(ctx->half_size_filter); + destroy_masks(vf); + + /* Destroy our private structure that had been used to store those masks and images. */ + free(vf->priv); + + return; +} + /** * \brief Initializes our filter. * @@ -831,6 +850,7 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) static int vf_open(vf_instance_t *vf, char *args) { vf->priv = safe_malloc(sizeof(vf_priv_s)); + vf->uninit = uninit; /* Load our filter image. */ if (args) @@ -872,24 +892,6 @@ static int vf_open(vf_instance_t *vf, char *args) return 1; } -/** - * \brief Frees memory that our filter allocated. - * - * This is called at exit-time. - */ -static void uninit(vf_instance_t * vf) -{ - /* Destroy our masks and images. */ - destroy_pgm(((vf_priv_s *)vf->priv)->filter); - destroy_pgm(((vf_priv_s *)vf->priv)->half_size_filter); - destroy_masks(vf); - - /* Destroy our private structure that had been used to store those masks and images. */ - free(vf->priv); - - return; -} - /** * \brief Meta data about our filter. */ -- cgit v1.2.3 From 67f9e11d9336028e374b4c03b5632a8e28a54f7d Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 23:09:15 +0000 Subject: Support all line ending types in mp_input_read_cmd. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30779 b3059339-0415-0410-9bf9-f77b7e298cf2 --- input/input.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/input/input.c b/input/input.c index baf0723a16..59afa23501 100644 --- a/input/input.c +++ b/input/input.c @@ -957,6 +957,8 @@ mp_input_read_cmd(mp_input_fd_t* mp_fd, char** ret) { int l = 0; // Find the cmd end mp_fd->buffer[mp_fd->pos] = '\0'; + end = strchr(mp_fd->buffer,'\r'); + if (end) *end = '\n'; end = strchr(mp_fd->buffer,'\n'); // No cmd end ? if(!end) { -- cgit v1.2.3 From 490a015043f105f3c80bdbde187166c469f3d63f Mon Sep 17 00:00:00 2001 From: reimar Date: Sat, 27 Feb 2010 23:12:34 +0000 Subject: Make -slave also work with the normal console on Windows. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30780 b3059339-0415-0410-9bf9-f77b7e298cf2 --- osdep/getch2-win.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index 45f68e8196..dd6268b06a 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -35,11 +35,16 @@ int mp_input_slave_cmd_func(int fd,char* dest,int size){ DWORD retval; HANDLE in = GetStdHandle(STD_INPUT_HANDLE); - if(!PeekNamedPipe(in, NULL, size, &retval, NULL, NULL) || !retval){ + if(PeekNamedPipe(in, NULL, size, &retval, NULL, NULL)){ + if (size > retval) size = retval; + } else { + if (WaitForSingleObject(in, 0)) + size = 0; + } + if(!size){ return MP_INPUT_NOTHING; } - if(retval>size)retval=size; - ReadFile(in, dest, retval, &retval, NULL); + ReadFile(in, dest, size, &retval, NULL); if(retval)return retval; return MP_INPUT_NOTHING; } -- cgit v1.2.3 From 70b070baa2b81f2204723e18d815b2bc3c763efa Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 23:14:44 +0000 Subject: Remove unused functions. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30781 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/freesdp/parser.c | 60 ------------------------------------------------- 1 file changed, 60 deletions(-) diff --git a/stream/freesdp/parser.c b/stream/freesdp/parser.c index 34e6737a05..6d806a6e80 100644 --- a/stream/freesdp/parser.c +++ b/stream/freesdp/parser.c @@ -1440,50 +1440,6 @@ fsdp_get_encryption_content (const fsdp_description_t * dsc) return dsc->k_encryption_content; } -unsigned int -fsdp_get_rtpmap_count (const fsdp_description_t * dsc) -{ - if (!dsc) - return 0; - return dsc->a_rtpmaps_count; -} - -const char * -fsdp_get_rtpmap_payload_type (const fsdp_description_t * dsc, - unsigned int index) -{ - if ((!dsc) || (index >= dsc->a_rtpmaps_count)) - return NULL; - return dsc->a_rtpmaps[index]->pt; -} - -const char * -fsdp_get_rtpmap_encoding_name (const fsdp_description_t * dsc, - unsigned int index) -{ - if ((!dsc) || (index >= dsc->a_rtpmaps_count)) - return NULL; - return dsc->a_rtpmaps[index]->encoding_name; -} - -unsigned int -fsdp_get_rtpmap_clock_rate (const fsdp_description_t * dsc, - unsigned int index) -{ - if ((!dsc) || (index >= dsc->a_rtpmaps_count)) - return 0; - return dsc->a_rtpmaps[index]->clock_rate; -} - -const char * -fsdp_get_rtpmap_encoding_parameters (const fsdp_description_t * dsc, - unsigned int index) -{ - if ((!dsc) || (index >= dsc->a_rtpmaps_count)) - return NULL; - return dsc->a_rtpmaps[index]->parameters; -} - const char * fsdp_get_str_att (const fsdp_description_t * dsc, fsdp_session_str_att_t att) { @@ -1530,22 +1486,6 @@ fsdp_get_sdplang (const fsdp_description_t * dsc, unsigned int index) return dsc->a_sdplangs[index]; } -unsigned int -fsdp_get_lang_count (const fsdp_description_t * dsc) -{ - if (!dsc) - return 0; - return dsc->a_langs_count; -} - -const char * -fsdp_get_lang (const fsdp_description_t * dsc, unsigned int index) -{ - if ((!dsc) || (index >= dsc->a_langs_count)) - return NULL; - return dsc->a_langs[index]; -} - unsigned int fsdp_get_control_count (const fsdp_description_t * dsc) { -- cgit v1.2.3 From d59123f10d133a4dd600e2896b8ee365c6f67e4a Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sat, 27 Feb 2010 23:23:34 +0000 Subject: Fix warning "missing braces around initializer". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30782 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/stream_tv.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stream/stream_tv.c b/stream/stream_tv.c index 3db6195dcf..fb2090fd09 100644 --- a/stream/stream_tv.c +++ b/stream/stream_tv.c @@ -70,10 +70,12 @@ tv_param_t stream_tv_defaults = { 0, //hue 0, //saturation -1, //gain + { NULL, //tdevice 0, //tformat 100, //tpage 0, //tlang + }, 0, //scan_autostart 50, //scan_threshold 0.5, //scan_period -- cgit v1.2.3 From aa4388fea4da75c798523fa55392ed7b5a0210a2 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sun, 28 Feb 2010 00:23:58 +0000 Subject: Make close_twolame() static, only used in ae_twolame.c. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30783 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ae_twolame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/ae_twolame.c b/libmpcodecs/ae_twolame.c index 7aa0398586..e15206dee6 100644 --- a/libmpcodecs/ae_twolame.c +++ b/libmpcodecs/ae_twolame.c @@ -113,7 +113,7 @@ static int encode_twolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in return ret_size; } -int close_twolame(audio_encoder_t *encoder) +static int close_twolame(audio_encoder_t *encoder) { free(encoder->priv); return 1; -- cgit v1.2.3 From 6961b9ef7098440a7e1e31dc9908e3b3b30c23fb Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 28 Feb 2010 00:24:01 +0000 Subject: Add support for reading key events from MinGW xterm. Unfortunately keys only arrive after enter was pressed and SetNamedPipeHandleState does not seem to help. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30784 b3059339-0415-0410-9bf9-f77b7e298cf2 --- osdep/getch2-win.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/osdep/getch2-win.c b/osdep/getch2-win.c index dd6268b06a..7218e81a5a 100644 --- a/osdep/getch2-win.c +++ b/osdep/getch2-win.c @@ -25,6 +25,7 @@ #include "config.h" #include +#include #include #include #include "keycodes.h" @@ -64,7 +65,15 @@ static int getch2_internal(void) INPUT_RECORD eventbuffer[128]; DWORD retval; int i=0; - if(!getch2_status)return -1; + if(!getch2_status){ + // supports e.g. MinGW xterm, unfortunately keys are only received after + // enter was pressed. + uint8_t c; + if (!PeekNamedPipe(in, NULL, 1, &retval, NULL, NULL) || !retval) + return -1; + ReadFile(in, &c, 1, &retval, NULL); + return retval == 1 ? c : -1; + } /*check if there are input events*/ if(!GetNumberOfConsoleInputEvents(in,&retval)) { -- cgit v1.2.3 From fd21cdeb473a983745d8dc75827dadd46c1ce1cd Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sun, 28 Feb 2010 00:28:14 +0000 Subject: Make close_toolame() static, only used in ae_toolame.c. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30785 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ae_toolame.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmpcodecs/ae_toolame.c b/libmpcodecs/ae_toolame.c index 2a0e9f7941..851fa845f9 100644 --- a/libmpcodecs/ae_toolame.c +++ b/libmpcodecs/ae_toolame.c @@ -121,7 +121,7 @@ static int encode_toolame(audio_encoder_t *encoder, uint8_t *dest, void *src, in return ret_size; } -int close_toolame(audio_encoder_t *encoder) +static int close_toolame(audio_encoder_t *encoder) { free(encoder->priv); return 1; -- cgit v1.2.3 From 6c0da216d7a7f7dc995dfda353390f859cf41294 Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sun, 28 Feb 2010 01:06:09 +0000 Subject: Get rid of many ugly casts. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30786 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/vf_remove_logo.c | 77 ++++++++++++++++++++++---------------------- 1 file changed, 38 insertions(+), 39 deletions(-) diff --git a/libmpcodecs/vf_remove_logo.c b/libmpcodecs/vf_remove_logo.c index 72408fbea8..da90d3c066 100644 --- a/libmpcodecs/vf_remove_logo.c +++ b/libmpcodecs/vf_remove_logo.c @@ -141,7 +141,7 @@ typedef struct * Variables stored here are kept from frame to frame, and separate instances of * the filter will get their own separate copies. */ -typedef struct +struct vf_priv_s { unsigned int fmt; /* Not exactly sure of the use for this. It came with the example filter I used as a basis for this, and it looks like a lot of stuff will break if I remove it. */ int max_mask_size; /* The largest possible mask size that will be needed with the given filter and corresponding half_size_filter. The half_size_filter can have a larger requirment in some rare (but not degenerate) cases. */ @@ -264,8 +264,8 @@ static void destroy_masks(vf_instance_t * vf) int a, b; /* Load values from the vf->priv struct for faster dereferencing. */ - int * * * mask = ((vf_priv_s *)vf->priv)->mask; - int max_mask_size = ((vf_priv_s *)vf->priv)->max_mask_size; + int * * * mask = vf->priv->mask; + int max_mask_size = vf->priv->max_mask_size; if (mask == NULL) return; /* Nothing allocated, so return before we segfault. */ @@ -282,7 +282,7 @@ static void destroy_masks(vf_instance_t * vf) free(mask); /* Free the array of pointers pointing to the masks. */ /* Set the pointer to NULL, so that any duplicate calls to this function will not cause a crash. */ - ((vf_priv_s *)vf->priv)->mask = NULL; + vf->priv->mask = NULL; return; } @@ -301,8 +301,8 @@ static void initialize_masks(vf_instance_t * vf) int a, b, c; /* Load values from the vf->priv struct for faster dereferencing. */ - int * * * mask = ((vf_priv_s *)vf->priv)->mask; - int max_mask_size = ((vf_priv_s *)vf->priv)->max_mask_size; /* This tells us how many masks we'll need to generate. */ + int * * * mask = vf->priv->mask; + int max_mask_size = vf->priv->max_mask_size; /* This tells us how many masks we'll need to generate. */ /* Create a circular mask for each size up to max_mask_size. When the filter is applied, the mask size is determined on a pixel by pixel basis, with pixels nearer the edge of the logo getting smaller mask sizes. */ @@ -324,7 +324,7 @@ static void initialize_masks(vf_instance_t * vf) } /* Store values back to vf->priv so they aren't lost after the function returns. */ - ((vf_priv_s *)vf->priv)->mask = mask; + vf->priv->mask = mask; return; } @@ -404,7 +404,7 @@ static void convert_mask_to_strength_mask(vf_instance_t * vf, pgm_structure * ma max_mask_size = current_pass + 1; /* As a side-effect, we now know the maximum mask size, which we'll use to generate our masks. */ max_mask_size = apply_mask_fudge_factor(max_mask_size); /* Apply the fudge factor to this number too, since we must ensure that enough masks are generated. */ - ((vf_priv_s *)vf->priv)->max_mask_size = max_mask_size; /* Commit the newly calculated max_mask_size to the vf->priv struct. */ + vf->priv->max_mask_size = max_mask_size; /* Commit the newly calculated max_mask_size to the vf->priv struct. */ return; } @@ -430,7 +430,7 @@ static void get_blur(const vf_instance_t * const vf, unsigned int * const value_ { int mask_size; /* Mask size tells how large a circle to use. The radius is about (slightly larger than) mask size. */ /* Get values from vf->priv for faster dereferencing. */ - int * * * mask = ((vf_priv_s *)vf->priv)->mask; + int * * * mask = vf->priv->mask; int start_posx, start_posy, end_posx, end_posy; int i, j; @@ -662,7 +662,7 @@ static pgm_structure * generate_half_size_image(vf_instance_t * vf, pgm_structur max_mask_size = current_pass + 1; /* As a side-effect, we now know the maximum mask size, which we'll use to generate our masks. */ max_mask_size = apply_mask_fudge_factor(max_mask_size); /* Commit the newly calculated max_mask_size to the vf->priv struct. */ - ((vf_priv_s *)vf->priv)->max_mask_size = max(max_mask_size, ((vf_priv_s *)vf->priv)->max_mask_size); + vf->priv->max_mask_size = max(max_mask_size, vf->priv->max_mask_size); return new_pgm; } @@ -685,10 +685,10 @@ static unsigned int find_best(struct vf_instance *vf){ */ static int config(struct vf_instance *vf, int width, int height, int d_width, int d_height, unsigned int flags, unsigned int outfmt) { - if(!(((vf_priv_s *)vf->priv)->fmt=find_best(vf))) + if(!(vf->priv->fmt=find_best(vf))) return 0; else - return vf_next_config(vf,width,height,d_width,d_height,flags,((vf_priv_s *)vf->priv)->fmt); + return vf_next_config(vf,width,height,d_width,d_height,flags,vf->priv->fmt); } /** @@ -767,15 +767,15 @@ static void convert_yv12(const vf_instance_t * const vf, const char * const sour static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ mp_image_t *dmpi; - dmpi=vf_get_image(vf->next,((vf_priv_s *)vf->priv)->fmt, + dmpi=vf_get_image(vf->next,vf->priv->fmt, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, mpi->w, mpi->h); /* Check to make sure that the filter image and the video stream are the same size. */ - if ((((vf_priv_s *)vf->priv)->filter->width != mpi->w) || (((vf_priv_s *)vf->priv)->filter->height != mpi->h)) + if (vf->priv->filter->width != mpi->w || vf->priv->filter->height != mpi->h) { mp_msg(MSGT_VFILTER,MSGL_ERR, "Filter image and video stream are not of the same size. (Filter: %d x %d, Stream: %d x %d)\n", - ((vf_priv_s *)vf->priv)->filter->width, ((vf_priv_s *)vf->priv)->filter->height, mpi->w, mpi->h); + vf->priv->filter->width, vf->priv->filter->height, mpi->w, mpi->h); return 0; } @@ -783,19 +783,19 @@ static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts){ case IMGFMT_YV12: convert_yv12(vf, mpi->planes[0], mpi->stride[0], mpi, mpi->w, mpi->h, dmpi->planes[0], dmpi->stride[0], - mpi->flags & MP_IMGFLAG_DIRECT, ((vf_priv_s *)vf->priv)->filter, 0, - ((vf_priv_s *)vf->priv)->bounding_rectangle_posx1, ((vf_priv_s *)vf->priv)->bounding_rectangle_posy1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_posx2, ((vf_priv_s *)vf->priv)->bounding_rectangle_posy2); + mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->filter, 0, + vf->priv->bounding_rectangle_posx1, vf->priv->bounding_rectangle_posy1, + vf->priv->bounding_rectangle_posx2, vf->priv->bounding_rectangle_posy2); convert_yv12(vf, mpi->planes[1], mpi->stride[1], mpi, mpi->w / 2, mpi->h / 2, dmpi->planes[1], dmpi->stride[1], - mpi->flags & MP_IMGFLAG_DIRECT, ((vf_priv_s *)vf->priv)->half_size_filter, 1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx1, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx2, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy2); + mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->half_size_filter, 1, + vf->priv->bounding_rectangle_half_size_posx1, vf->priv->bounding_rectangle_half_size_posy1, + vf->priv->bounding_rectangle_half_size_posx2, vf->priv->bounding_rectangle_half_size_posy2); convert_yv12(vf, mpi->planes[2], mpi->stride[2], mpi, mpi->w / 2, mpi->h / 2, dmpi->planes[2], dmpi->stride[2], - mpi->flags & MP_IMGFLAG_DIRECT, ((vf_priv_s *)vf->priv)->half_size_filter, 2, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx1, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy1, - ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx2, ((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy2); + mpi->flags & MP_IMGFLAG_DIRECT, vf->priv->half_size_filter, 2, + vf->priv->bounding_rectangle_half_size_posx1, vf->priv->bounding_rectangle_half_size_posy1, + vf->priv->bounding_rectangle_half_size_posx2, vf->priv->bounding_rectangle_half_size_posy2); break; default: @@ -826,10 +826,9 @@ static int query_format(struct vf_instance *vf, unsigned int fmt) */ static void uninit(vf_instance_t *vf) { - vf_priv_s *ctx = (vf_priv_s *)vf->priv; /* Destroy our masks and images. */ - destroy_pgm(ctx->filter); - destroy_pgm(ctx->half_size_filter); + destroy_pgm(vf->priv->filter); + destroy_pgm(vf->priv->half_size_filter); destroy_masks(vf); /* Destroy our private structure that had been used to store those masks and images. */ @@ -854,7 +853,7 @@ static int vf_open(vf_instance_t *vf, char *args) /* Load our filter image. */ if (args) - ((vf_priv_s *)vf->priv)->filter = load_pgm(args); + vf->priv->filter = load_pgm(args); else { mp_msg(MSGT_VFILTER, MSGL_ERR, "[vf]remove_logo usage: remove_logo=/path/to/filter_image_file.pgm\n"); @@ -862,7 +861,7 @@ static int vf_open(vf_instance_t *vf, char *args) return 0; } - if (((vf_priv_s *)vf->priv)->filter == NULL) + if (vf->priv->filter == NULL) { /* Error message was displayed by load_pgm(). */ free(vf->priv); @@ -870,21 +869,21 @@ static int vf_open(vf_instance_t *vf, char *args) } /* Create the scaled down filter image for the chroma planes. */ - convert_mask_to_strength_mask(vf, ((vf_priv_s *)vf->priv)->filter); - ((vf_priv_s *)vf->priv)->half_size_filter = generate_half_size_image(vf, ((vf_priv_s *)vf->priv)->filter); + convert_mask_to_strength_mask(vf, vf->priv->filter); + vf->priv->half_size_filter = generate_half_size_image(vf, vf->priv->filter); /* Now that we know how many masks we need (the info is in vf), we can generate the masks. */ initialize_masks(vf); /* Calculate our bounding rectangles, which determine in what region the logo resides for faster processing. */ - calculate_bounding_rectangle(&((vf_priv_s *)vf->priv)->bounding_rectangle_posx1, &((vf_priv_s *)vf->priv)->bounding_rectangle_posy1, - &((vf_priv_s *)vf->priv)->bounding_rectangle_posx2, &((vf_priv_s *)vf->priv)->bounding_rectangle_posy2, - ((vf_priv_s *)vf->priv)->filter); - calculate_bounding_rectangle(&((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx1, - &((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy1, - &((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posx2, - &((vf_priv_s *)vf->priv)->bounding_rectangle_half_size_posy2, - ((vf_priv_s *)vf->priv)->half_size_filter); + calculate_bounding_rectangle(&vf->priv->bounding_rectangle_posx1, &vf->priv->bounding_rectangle_posy1, + &vf->priv->bounding_rectangle_posx2, &vf->priv->bounding_rectangle_posy2, + vf->priv->filter); + calculate_bounding_rectangle(&vf->priv->bounding_rectangle_half_size_posx1, + &vf->priv->bounding_rectangle_half_size_posy1, + &vf->priv->bounding_rectangle_half_size_posx2, + &vf->priv->bounding_rectangle_half_size_posy2, + vf->priv->half_size_filter); vf->config=config; vf->put_image=put_image; -- cgit v1.2.3 From ba66200023a0fd1d623e80632dc8f33d486a4fbf Mon Sep 17 00:00:00 2001 From: cehoyos Date: Sun, 28 Feb 2010 02:18:16 +0000 Subject: Make sws_dcVec static: It is only used inside libswscale/utils.c. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30787 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libswscale/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libswscale/utils.c b/libswscale/utils.c index 22141544b9..fbd44bcc3c 100644 --- a/libswscale/utils.c +++ b/libswscale/utils.c @@ -1311,7 +1311,7 @@ SwsVector *sws_getIdentityVec(void) return sws_getConstVec(1.0, 1); } -double sws_dcVec(SwsVector *a) +static double sws_dcVec(SwsVector *a) { int i; double sum=0; -- cgit v1.2.3 From 35fbd55c0fbe9c4beb65963c034ea85082cec6e5 Mon Sep 17 00:00:00 2001 From: komh Date: Sun, 28 Feb 2010 03:26:18 +0000 Subject: Add cddb:// support for OS/2 git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30788 b3059339-0415-0410-9bf9-f77b7e298cf2 --- osdep/osdep.h | 33 +++++++++++++++++++++++ stream/stream_cddb.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 osdep/osdep.h diff --git a/osdep/osdep.h b/osdep/osdep.h new file mode 100644 index 0000000000..0a64c31120 --- /dev/null +++ b/osdep/osdep.h @@ -0,0 +1,33 @@ +/* + * Header in order to include OS-specific headers, macros, types and so on + * + * Copyright (c) 2010 by KO Myung-Hun (komh@chollian.net) + * + * This file is part of MPlayer. + * + * MPlayer 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. + * + * MPlayer 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 MPlayer; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +#ifndef MPLAYER_OSDEP_H +#define MPLAYER_OSDEP_H + +#ifdef __OS2__ +#define INCL_DOS +#define INCL_DOSDEVIOCTL +#include +#endif + +#endif /* MPLAYER_OSDEP_H */ + diff --git a/stream/stream_cddb.c b/stream/stream_cddb.c index 3ecad98183..47a0321e01 100644 --- a/stream/stream_cddb.c +++ b/stream/stream_cddb.c @@ -68,6 +68,8 @@ #include "mpbswap.h" #endif +#include "osdep/osdep.h" + #include "cdd.h" #include "version.h" #include "stream.h" @@ -112,6 +114,78 @@ static int read_toc(const char *dev) } CloseHandle(drive); +#elif defined(__OS2__) + UCHAR auchParamDisk[4] = {'C', 'D', '0', '1'}; + + struct { + BYTE bFirstTrack; + BYTE bLastTrack; + BYTE bLeadOutF; + BYTE bLeadOutS; + BYTE bLeadOutM; + BYTE bLeadOutReserved; + } __attribute__((packed)) sDataDisk; + + struct { + UCHAR auchSign[4]; + BYTE bTrack; + } __attribute__((packed)) sParamTrack = {{'C', 'D', '0', '1'},}; + + struct { + BYTE bStartF; + BYTE bStartS; + BYTE bStartM; + BYTE bStartReserved; + BYTE bControlInfo; + } __attribute__((packed)) sDataTrack; + + HFILE hcd; + ULONG ulAction; + ULONG ulParamLen; + ULONG ulDataLen; + ULONG rc; + + rc = DosOpen(dev, &hcd, &ulAction, 0, FILE_NORMAL, + OPEN_ACTION_OPEN_IF_EXISTS | OPEN_ACTION_FAIL_IF_NEW, + OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | OPEN_FLAGS_DASD, + NULL); + if (rc) { + mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToReadTOC); + return -1; + } + + rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIODISK, + auchParamDisk, sizeof(auchParamDisk), &ulParamLen, + &sDataDisk, sizeof(sDataDisk), &ulDataLen); + if (!rc) { + first = sDataDisk.bFirstTrack - 1; + last = sDataDisk.bLastTrack; + for (i = first; i <= last; i++) { + if (i == last) { + sDataTrack.bStartM = sDataDisk.bLeadOutM; + sDataTrack.bStartS = sDataDisk.bLeadOutS; + sDataTrack.bStartF = sDataDisk.bLeadOutF; + } else { + sParamTrack.bTrack = i + 1; + rc = DosDevIOCtl(hcd, IOCTL_CDROMAUDIO, CDROMAUDIO_GETAUDIOTRACK, + &sParamTrack, sizeof(sParamTrack), &ulParamLen, + &sDataTrack, sizeof(sDataTrack), &ulDataLen); + if (rc) + break; + } + + cdtoc[i].min = sDataTrack.bStartM; + cdtoc[i].sec = sDataTrack.bStartS; + cdtoc[i].frame = sDataTrack.bStartF; + } + } + + DosClose(hcd); + + if (rc) { + mp_msg(MSGT_OPEN, MSGL_ERR, MSGTR_MPDEMUX_CDDB_FailedToReadTOC); + return -1; + } #else int drive; drive = open(dev, O_RDONLY | O_NONBLOCK); -- cgit v1.2.3 From 4d08f30d253511bd82db88a9666db6f6cc0de861 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 28 Feb 2010 07:45:23 +0000 Subject: Use the KEYFRAME define instead of some magic number. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30789 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ve_x264.c | 2 +- mencoder.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 43cac95237..8674cd8d9e 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -263,7 +263,7 @@ static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in) && param.i_frame_reference == 1 && !param.i_bframe); memcpy(mod->mux->buffer, nal->p_payload, i_size); - muxer_write_chunk(mod->mux, i_size, keyframe?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + muxer_write_chunk(mod->mux, i_size, keyframe?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); } else ++mod->mux->encoder_delay; diff --git a/mencoder.c b/mencoder.c index 558e3f5e4b..ce0a6c360c 100644 --- a/mencoder.c +++ b/mencoder.c @@ -1222,7 +1222,7 @@ if(sh_audio){ } } if(len<=0) break; // EOF? - muxer_write_chunk(mux_a,len,0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + muxer_write_chunk(mux_a,len,AVIIF_KEYFRAME, MP_NOPTS_VALUE, MP_NOPTS_VALUE); if(!mux_a->h.dwSampleSize && mux_a->timer>0) mux_a->wf->nAvgBytesPerSec=0.5f+(double)mux_a->size/mux_a->timer; // avg bps (VBR) if(mux_a->buffer_len>=len){ @@ -1308,11 +1308,11 @@ ptimer_start = GetTimerMS(); switch(mux_v->codec){ case VCODEC_COPY: mux_v->buffer=frame_data.start; - if(skip_flag<=0) muxer_write_chunk(mux_v,frame_data.in_size,(sh_video->ds->flags&1)?0x10:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + if(skip_flag<=0) muxer_write_chunk(mux_v,frame_data.in_size,(sh_video->ds->flags&1)?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); break; case VCODEC_FRAMENO: mux_v->buffer=(unsigned char *)&decoded_frameno; // tricky - if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),0x10, MP_NOPTS_VALUE, MP_NOPTS_VALUE); + if(skip_flag<=0) muxer_write_chunk(mux_v,sizeof(int),AVIIF_KEYFRAME, MP_NOPTS_VALUE, MP_NOPTS_VALUE); break; default: // decode_video will callback down to ve_*.c encoders, through the video filters -- cgit v1.2.3 From e86ecdac038fe0aef5ef2dc58296307e1f00184b Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 28 Feb 2010 07:52:34 +0000 Subject: Reuse the keyframe flag from x264 instead of trying to derive it on our own. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30790 b3059339-0415-0410-9bf9-f77b7e298cf2 --- libmpcodecs/ve_x264.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/libmpcodecs/ve_x264.c b/libmpcodecs/ve_x264.c index 8674cd8d9e..3f149f6de6 100644 --- a/libmpcodecs/ve_x264.c +++ b/libmpcodecs/ve_x264.c @@ -258,10 +258,7 @@ static int encode_frame(struct vf_instance *vf, x264_picture_t *pic_in) return -1; } if(i_size>0) { - int keyframe = (pic_out.i_type == X264_TYPE_IDR) || - (pic_out.i_type == X264_TYPE_I - && param.i_frame_reference == 1 - && !param.i_bframe); + int keyframe = pic_out.b_keyframe; memcpy(mod->mux->buffer, nal->p_payload, i_size); muxer_write_chunk(mod->mux, i_size, keyframe?AVIIF_KEYFRAME:0, MP_NOPTS_VALUE, MP_NOPTS_VALUE); } -- cgit v1.2.3 From 4a432dc1ee1d6294870ce9c8fbfa333ef6cab787 Mon Sep 17 00:00:00 2001 From: reimar Date: Sun, 28 Feb 2010 09:37:35 +0000 Subject: Improve integer overflow and realloc error handling in playlist parser. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30791 b3059339-0415-0410-9bf9-f77b7e298cf2 --- playtreeparser.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/playtreeparser.c b/playtreeparser.c index c9a6695b86..596d7f8d78 100644 --- a/playtreeparser.c +++ b/playtreeparser.c @@ -30,6 +30,7 @@ #include #include #include +#include #include "asxparser.h" #include "m_config.h" #include "playtree.h" @@ -80,8 +81,15 @@ play_tree_parser_get_line(play_tree_parser_t* p) { while(1) { if(resize) { + char *tmp; r = p->iter - p->buffer; - p->buffer = realloc(p->buffer, p->buffer_size + BUF_STEP); + end = p->buffer + p->buffer_end; + if (p->buffer_size > INT_MAX - BUF_STEP) + break; + tmp = realloc(p->buffer, p->buffer_size + BUF_STEP); + if (!tmp) + break; + p-