Mercurial > mplayer.hg
comparison libmpcodecs/vd_ffmpeg.c @ 7928:5d1c1d73e8f3
handle direct rendering buffer allocation failure
author | michael |
---|---|
date | Sun, 27 Oct 2002 00:37:51 +0000 |
parents | 4bb38736c381 |
children | 48075855804b |
comparison
equal
deleted
inserted
replaced
7927:b1767137b278 | 7928:5d1c1d73e8f3 |
---|---|
52 //unsigned int lavc_pp=0; | 52 //unsigned int lavc_pp=0; |
53 //#endif | 53 //#endif |
54 | 54 |
55 #include "cfgparser.h" | 55 #include "cfgparser.h" |
56 | 56 |
57 #if LIBAVCODEC_BUILD >= 4632 | |
58 static int get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type); | |
59 #else | |
57 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type); | 60 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type); |
61 #endif | |
58 | 62 |
59 #ifdef FF_BUG_AUTODETECT | 63 #ifdef FF_BUG_AUTODETECT |
60 static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT; | 64 static int lavc_param_workaround_bugs= FF_BUG_AUTODETECT; |
61 #else | 65 #else |
62 static int lavc_param_workaround_bugs= 0; | 66 static int lavc_param_workaround_bugs= 0; |
229 | 233 |
230 // printf("%X %X %d %d\n", extrahdr[0], extrahdr[1]); | 234 // printf("%X %X %d %d\n", extrahdr[0], extrahdr[1]); |
231 } | 235 } |
232 if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && | 236 if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && |
233 (sh->format == mmioFOURCC('M','4','S','2') || | 237 (sh->format == mmioFOURCC('M','4','S','2') || |
234 sh->format == mmioFOURCC('M','P','4','S'))) | 238 sh->format == mmioFOURCC('M','P','4','S') || |
239 sh->format == mmioFOURCC('W','M','V','2') | |
240 )) | |
235 { | 241 { |
236 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); | 242 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); |
237 avctx->extradata = malloc(avctx->extradata_size); | 243 avctx->extradata = malloc(avctx->extradata_size); |
238 memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size); | 244 memcpy(avctx->extradata, sh->bih+1, avctx->extradata_size); |
239 } | 245 } |
371 } | 377 } |
372 return 0; | 378 return 0; |
373 } | 379 } |
374 | 380 |
375 #if LIBAVCODEC_BUILD > 4615 | 381 #if LIBAVCODEC_BUILD > 4615 |
382 #if LIBAVCODEC_BUILD >= 4632 | |
383 static int get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type){ | |
384 #else | |
376 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type){ | 385 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type){ |
386 #endif | |
377 sh_video_t * sh = avctx->opaque; | 387 sh_video_t * sh = avctx->opaque; |
378 vd_ffmpeg_ctx *ctx = sh->context; | 388 vd_ffmpeg_ctx *ctx = sh->context; |
379 mp_image_t* mpi=NULL; | 389 mp_image_t* mpi=NULL; |
380 int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE; | 390 int flags= MP_IMGFLAG_ACCEPT_STRIDE | MP_IMGFLAG_PREFER_ALIGNED_STRIDE; |
381 int type= MP_IMGTYPE_IPB; | 391 int type= MP_IMGTYPE_IPB; |
453 printf("D"); | 463 printf("D"); |
454 else if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) | 464 else if(mpi->flags&MP_IMGFLAG_DRAW_CALLBACK) |
455 printf("S"); | 465 printf("S"); |
456 else | 466 else |
457 printf("."); | 467 printf("."); |
468 #endif | |
469 #if LIBAVCODEC_BUILD >= 4632 | |
470 return 0; | |
458 #endif | 471 #endif |
459 } | 472 } |
460 #endif | 473 #endif |
461 | 474 |
462 // copypaste from demux_real.c - it should match to get it working! | 475 // copypaste from demux_real.c - it should match to get it working! |