Mercurial > mplayer.hg
comparison libmpcodecs/vd_ffmpeg.c @ 10161:a339c588ddcd
removed obsolete (and currently non-working) scaling functions, after that it works correctly with YV12,422P and 444P mjpegs
author | alex |
---|---|
date | Fri, 23 May 2003 13:10:20 +0000 |
parents | 4385101cc89c |
children | ee2fabf561ed |
comparison
equal
deleted
inserted
replaced
10160:ad75409ed15e | 10161:a339c588ddcd |
---|---|
20 "A'rpi, Michael, Alex", | 20 "A'rpi, Michael, Alex", |
21 "native codecs (http://ffmpeg.sf.net/)" | 21 "native codecs (http://ffmpeg.sf.net/)" |
22 }; | 22 }; |
23 | 23 |
24 LIBVD_EXTERN(ffmpeg) | 24 LIBVD_EXTERN(ffmpeg) |
25 | |
26 #include "../postproc/rgb2rgb.h" | |
27 | |
28 | 25 |
29 #ifdef USE_LIBAVCODEC_SO | 26 #ifdef USE_LIBAVCODEC_SO |
30 #include <ffmpeg/avcodec.h> | 27 #include <ffmpeg/avcodec.h> |
31 #else | 28 #else |
32 #include "libavcodec/avcodec.h" | 29 #include "libavcodec/avcodec.h" |
118 case IMGFMT_I420: | 115 case IMGFMT_I420: |
119 // "converted" using pointer/stride modification | 116 // "converted" using pointer/stride modification |
120 if(avctx->pix_fmt==PIX_FMT_YUV420P) return CONTROL_TRUE;// u/v swap | 117 if(avctx->pix_fmt==PIX_FMT_YUV420P) return CONTROL_TRUE;// u/v swap |
121 if(avctx->pix_fmt==PIX_FMT_YUV422P) return CONTROL_TRUE;// half stride | 118 if(avctx->pix_fmt==PIX_FMT_YUV422P) return CONTROL_TRUE;// half stride |
122 break; | 119 break; |
123 #if 1 | |
124 case IMGFMT_YUY2: | |
125 // converted using yuv422ptoyuy2() | |
126 if(avctx->pix_fmt==PIX_FMT_YUV422P) return CONTROL_TRUE; | |
127 break; | |
128 } | 120 } |
129 #endif | |
130 return CONTROL_FALSE; | 121 return CONTROL_FALSE; |
131 } | 122 } |
132 return CONTROL_UNKNOWN; | 123 return CONTROL_UNKNOWN; |
133 } | 124 } |
134 | 125 |
372 default: | 363 default: |
373 ctx->best_csp=0; | 364 ctx->best_csp=0; |
374 } | 365 } |
375 if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h, ctx->best_csp)) | 366 if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h, ctx->best_csp)) |
376 return -1; | 367 return -1; |
377 ctx->convert=(sh->codec->outfmt[sh->outfmtidx]==IMGFMT_YUY2 | |
378 && ctx->best_csp!=IMGFMT_YUY2); // yuv422p->yuy2 conversion | |
379 } | 368 } |
380 return 0; | 369 return 0; |
381 } | 370 } |
382 | 371 |
383 static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ | 372 static int get_buffer(AVCodecContext *avctx, AVFrame *pic){ |
539 | 528 |
540 if(len<=0) return NULL; // skipped frame | 529 if(len<=0) return NULL; // skipped frame |
541 | 530 |
542 avctx->draw_horiz_band=NULL; | 531 avctx->draw_horiz_band=NULL; |
543 avctx->opaque=sh; | 532 avctx->opaque=sh; |
544 if(ctx->vo_inited && !ctx->convert && !(flags&3) && !dr1){ | 533 if(ctx->vo_inited && !(flags&3) && !dr1){ |
545 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | | 534 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | |
546 (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0), | 535 (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0), |
547 sh->disp_w, sh->disp_h); | 536 sh->disp_w, sh->disp_h); |
548 if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ | 537 if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ |
549 // vd core likes slices! | 538 // vd core likes slices! |
659 | 648 |
660 if(dr1 && pic->opaque){ | 649 if(dr1 && pic->opaque){ |
661 mpi= (mp_image_t*)pic->opaque; | 650 mpi= (mp_image_t*)pic->opaque; |
662 } | 651 } |
663 | 652 |
664 if(!mpi && ctx->convert){ | |
665 // do yuv422p -> yuy2 conversion: | |
666 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, | |
667 avctx->width, avctx->height); | |
668 if(!mpi) return NULL; | |
669 yuv422ptoyuy2(pic->data[0],pic->data[1],pic->data[2], | |
670 mpi->planes[0],avctx->width,avctx->height, | |
671 pic->linesize[0],pic->linesize[1],mpi->stride[0]); | |
672 return mpi; | |
673 } | |
674 | |
675 if(!mpi) | 653 if(!mpi) |
676 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, | 654 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, |
677 avctx->width, avctx->height); | 655 avctx->width, avctx->height); |
678 if(!mpi){ // temporary! | 656 if(!mpi){ // temporary! |
679 printf("couldn't allocate image for codec\n"); | 657 printf("couldn't allocate image for codec\n"); |
705 | 683 |
706 return mpi; | 684 return mpi; |
707 } | 685 } |
708 | 686 |
709 #endif | 687 #endif |
710 |