Mercurial > mplayer.hg
comparison libmpcodecs/vd_realvid.c @ 21563:c08b8066a1c6
Only increase buffer size to avoid crashes when seeking in
multi-resolution video files.
author | reimar |
---|---|
date | Sun, 10 Dec 2006 18:59:28 +0000 |
parents | de2a96f41195 |
children | a033e5519802 |
comparison
equal
deleted
inserted
replaced
21562:e655e64087d3 | 21563:c08b8066a1c6 |
---|---|
58 #endif | 58 #endif |
59 | 59 |
60 static void *rv_handle=NULL; | 60 static void *rv_handle=NULL; |
61 static int inited=0; | 61 static int inited=0; |
62 static uint8_t *buffer = NULL; | 62 static uint8_t *buffer = NULL; |
63 static int bufsz = 0; | |
63 #ifdef USE_WIN32DLL | 64 #ifdef USE_WIN32DLL |
64 static int dll_type = 0; /* 0 = unix dlopen, 1 = win32 dll */ | 65 static int dll_type = 0; /* 0 = unix dlopen, 1 = win32 dll */ |
65 #endif | 66 #endif |
66 | 67 |
67 void *__builtin_vec_new(unsigned long size) { | 68 void *__builtin_vec_new(unsigned long size) { |
298 rv_handle=NULL; | 299 rv_handle=NULL; |
299 inited = 0; | 300 inited = 0; |
300 if (buffer) | 301 if (buffer) |
301 free(buffer); | 302 free(buffer); |
302 buffer = NULL; | 303 buffer = NULL; |
304 bufsz = 0; | |
303 } | 305 } |
304 | 306 |
305 // copypaste from demux_real.c - it should match to get it working! | 307 // copypaste from demux_real.c - it should match to get it working! |
306 typedef struct dp_hdr_s { | 308 typedef struct dp_hdr_s { |
307 uint32_t chunks; // number of chunks | 309 uint32_t chunks; // number of chunks |
328 dp_hdr->timestamp,// timestamp (the integer value from the stream) | 330 dp_hdr->timestamp,// timestamp (the integer value from the stream) |
329 }; | 331 }; |
330 | 332 |
331 if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop | 333 if(len<=0 || flags&2) return NULL; // skipped frame || hardframedrop |
332 | 334 |
333 if (!inited) { | 335 if (bufsz < sh->disp_w*sh->disp_h*3/2) { |
334 if (buffer) free(buffer); | 336 if (buffer) free(buffer); |
335 buffer=malloc(sh->disp_w*sh->disp_h*3/2); | 337 bufsz = sh->disp_w*sh->disp_h*3/2; |
338 buffer=malloc(bufsz); | |
336 if (!buffer) return 0; | 339 if (!buffer) return 0; |
337 } | 340 } |
338 | 341 |
339 #ifdef USE_WIN32DLL | 342 #ifdef USE_WIN32DLL |
340 if (dll_type == 1) | 343 if (dll_type == 1) |