Mercurial > mplayer.hg
annotate libmpcodecs/vd_ffmpeg.c @ 6833:a709a7662cd1
Add type= and fix a minor typing difference from ffmpeg
(now encoding (ffmpeg) and playback (mplayer) differ just on one of 1438lines - 0.1error in rounding ;)
| author | atmos4 |
|---|---|
| date | Sun, 28 Jul 2002 21:56:18 +0000 |
| parents | 010be15e48ad |
| children | 2d7dfcc79651 |
| rev | line source |
|---|---|
| 4952 | 1 #include <stdio.h> |
| 2 #include <stdlib.h> | |
| 3 #include <assert.h> | |
|
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
4 #include <time.h> |
| 4952 | 5 |
| 6 #include "config.h" | |
| 7 #include "mp_msg.h" | |
| 8 #include "help_mp.h" | |
| 9 | |
| 10 #ifdef USE_LIBAVCODEC | |
| 11 | |
| 12 #include "bswap.h" | |
| 13 | |
| 14 #include "vd_internal.h" | |
| 15 | |
| 16 static vd_info_t info = { | |
| 17 "FFmpeg's libavcodec codec family", | |
| 18 "ffmpeg", | |
| 19 VFM_FFMPEG, | |
| 20 "A'rpi", | |
| 21 "http://ffmpeg.sf.net", | |
| 22 "native codecs" | |
| 23 }; | |
| 24 | |
| 25 LIBVD_EXTERN(ffmpeg) | |
| 26 | |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
27 #include "../postproc/rgb2rgb.h" |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
28 |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
29 |
| 4952 | 30 #ifdef USE_LIBAVCODEC_SO |
| 31 #include <libffmpeg/avcodec.h> | |
| 32 #else | |
| 33 #include "libavcodec/avcodec.h" | |
| 34 #endif | |
| 35 | |
| 36 int avcodec_inited=0; | |
| 37 | |
| 5517 | 38 #ifdef FF_POSTPROCESS |
| 39 int quant_store[MBR+1][MBC+1]; | |
| 40 #endif | |
| 41 | |
| 5280 | 42 typedef struct { |
| 43 AVCodecContext *avctx; | |
| 5482 | 44 int last_aspect; |
| 45 int do_slices; | |
| 6734 | 46 int do_dr1; |
| 5482 | 47 int vo_inited; |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
48 int convert; |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
49 int yuy2_support; |
| 6681 | 50 #if LIBAVCODEC_BUILD >= 4615 |
| 51 int yvu9_support; | |
| 52 #endif | |
| 5280 | 53 } vd_ffmpeg_ctx; |
| 54 | |
| 4952 | 55 //#ifdef FF_POSTPROCESS |
| 56 //unsigned int lavc_pp=0; | |
| 57 //#endif | |
| 58 | |
|
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
59 #include "cfgparser.h" |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
60 |
| 6739 | 61 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type); |
| 62 | |
|
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
63 static int lavc_param_workaround_bugs=0; |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
64 static int lavc_param_error_resilience=0; |
| 6355 | 65 static int lavc_param_gray=0; |
|
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
66 static int lavc_param_vstats=0; |
|
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
67 |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
68 struct config lavc_decode_opts_conf[]={ |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
69 #if LIBAVCODEC_BUILD >= 4611 |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
70 {"bug", &lavc_param_workaround_bugs, CONF_TYPE_INT, CONF_RANGE, 0, 99, NULL}, |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
71 {"ver", &lavc_param_error_resilience, CONF_TYPE_INT, CONF_RANGE, -1, 99, NULL}, |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
72 #endif |
| 6355 | 73 #if LIBAVCODEC_BUILD >= 4614 |
| 74 {"gray", &lavc_param_gray, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, | |
| 75 #endif | |
|
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
76 {"vstats", &lavc_param_vstats, CONF_TYPE_FLAG, 0, 0, CODEC_FLAG_PART, NULL}, |
|
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
77 {NULL, NULL, 0, 0, 0, 0, NULL} |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
78 }; |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
79 |
| 4952 | 80 // to set/get/query special features/parameters |
| 81 static int control(sh_video_t *sh,int cmd,void* arg,...){ | |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
82 vd_ffmpeg_ctx *ctx = sh->context; |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
83 switch(cmd){ |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
84 case VDCTRL_QUERY_FORMAT: |
| 6739 | 85 switch(*((int*)arg)){ |
| 86 case IMGFMT_YV12: | |
| 87 case IMGFMT_IYUV: | |
| 88 case IMGFMT_I420: | |
| 6740 | 89 if(ctx->yvu9_support) return CONTROL_FALSE; |
| 90 else return CONTROL_TRUE; | |
| 6739 | 91 case IMGFMT_YUY2: |
| 92 if(ctx->yuy2_support) return CONTROL_TRUE; | |
| 93 return CONTROL_FALSE; | |
| 6681 | 94 #if LIBAVCODEC_BUILD >= 4615 |
| 6739 | 95 case IMGFMT_YVU9: |
| 96 if(ctx->yvu9_support) return CONTROL_TRUE; | |
| 97 return CONTROL_FALSE; | |
| 6681 | 98 #endif |
| 6739 | 99 default: |
| 100 return CONTROL_FALSE; | |
| 101 | |
| 102 } | |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
103 } |
| 4952 | 104 return CONTROL_UNKNOWN; |
| 105 } | |
| 106 | |
| 107 // init driver | |
| 108 static int init(sh_video_t *sh){ | |
| 5280 | 109 AVCodecContext *avctx; |
| 110 vd_ffmpeg_ctx *ctx; | |
|
5457
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
111 AVCodec *lavc_codec; |
| 4952 | 112 |
| 113 if(!avcodec_inited){ | |
| 114 avcodec_init(); | |
| 115 avcodec_register_all(); | |
| 116 avcodec_inited=1; | |
| 117 } | |
| 5280 | 118 |
| 119 ctx = sh->context = malloc(sizeof(vd_ffmpeg_ctx)); | |
| 120 if (!ctx) | |
| 121 return(0); | |
| 122 memset(ctx, 0, sizeof(vd_ffmpeg_ctx)); | |
| 4952 | 123 |
|
5457
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
124 lavc_codec = (AVCodec *)avcodec_find_decoder_by_name(sh->codec->dll); |
|
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
125 if(!lavc_codec){ |
| 4952 | 126 mp_msg(MSGT_DECVIDEO,MSGL_ERR,MSGTR_MissingLAVCcodec,sh->codec->dll); |
| 127 return 0; | |
| 128 } | |
| 5482 | 129 |
|
5494
1c45b1484ffb
i just fixed b-frames & slices in libavcodec :) ... iam too tired for benchmarks now ...
michael
parents:
5482
diff
changeset
|
130 if(vd_use_slices && lavc_codec->capabilities&CODEC_CAP_DRAW_HORIZ_BAND) |
|
1c45b1484ffb
i just fixed b-frames & slices in libavcodec :) ... iam too tired for benchmarks now ...
michael
parents:
5482
diff
changeset
|
131 ctx->do_slices=1; |
| 6734 | 132 |
| 6736 | 133 #if LIBAVCODEC_BUILD > 4615 |
| 6735 | 134 if(lavc_codec->capabilities&CODEC_CAP_DR1) |
| 6734 | 135 ctx->do_dr1=1; |
| 6736 | 136 #endif |
| 137 | |
| 5280 | 138 ctx->avctx = malloc(sizeof(AVCodecContext)); |
| 139 memset(ctx->avctx, 0, sizeof(AVCodecContext)); | |
| 140 avctx = ctx->avctx; | |
| 6739 | 141 |
| 142 #if LIBAVCODEC_BUILD > 4615 | |
| 143 if(ctx->do_dr1){ | |
| 144 avctx->flags|= CODEC_FLAG_EMU_EDGE | CODEC_FLAG_DR1; | |
| 145 avctx->get_buffer_callback= get_buffer; | |
| 146 } | |
| 147 #endif | |
| 4952 | 148 |
| 5280 | 149 avctx->width = sh->disp_w; |
| 150 avctx->height= sh->disp_h; | |
|
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
151 #if LIBAVCODEC_BUILD >= 4611 |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
152 avctx->workaround_bugs= lavc_param_workaround_bugs; |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
153 avctx->error_resilience= lavc_param_error_resilience; |
|
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
154 #endif |
| 6355 | 155 #if LIBAVCODEC_BUILD >= 4614 |
| 156 if(lavc_param_gray) avctx->flags|= CODEC_FLAG_GRAY; | |
| 157 #endif | |
|
6265
f49ec39ab0c6
workaround bugs & error resilience ffmpeg decoder options
michael
parents:
5940
diff
changeset
|
158 |
| 5280 | 159 mp_dbg(MSGT_DECVIDEO,MSGL_DBG2,"libavcodec.size: %d x %d\n",avctx->width,avctx->height); |
| 4952 | 160 if (sh->format == mmioFOURCC('R', 'V', '1', '3')) |
| 5280 | 161 avctx->sub_id = 3; |
| 5939 | 162 #if LIBAVCODEC_BUILD >= 4605 |
| 163 /* AVRn stores huffman table in AVI header */ | |
| 164 /* Pegasus MJPEG stores it also in AVI header, but it uses the common | |
| 165 MJPG fourcc :( */ | |
| 5940 | 166 if (sh->bih && (sh->bih->biSize != sizeof(BITMAPINFOHEADER)) && |
| 5939 | 167 (sh->format == mmioFOURCC('A','V','R','n') || |
| 168 sh->format == mmioFOURCC('M','J','P','G'))) | |
| 169 { | |
| 170 avctx->flags |= CODEC_FLAG_EXTERN_HUFF; | |
| 171 avctx->extradata_size = sh->bih->biSize-sizeof(BITMAPINFOHEADER); | |
| 172 avctx->extradata = malloc(avctx->extradata_size); | |
| 173 memcpy(avctx->extradata, sh->bih+sizeof(BITMAPINFOHEADER), | |
| 174 avctx->extradata_size); | |
| 175 | |
| 176 #if 0 | |
| 177 { | |
| 178 int x; | |
| 179 uint8_t *p = avctx->extradata; | |
| 180 | |
| 181 for (x=0; x<avctx->extradata_size; x++) | |
| 182 printf("[%x] ", p[x]); | |
| 183 printf("\n"); | |
| 184 } | |
| 185 #endif | |
| 186 } | |
| 187 #endif | |
| 4952 | 188 /* open it */ |
|
5457
f248c9e86423
config vo only if aspect really changed and width&&height isn't changed (if w||h changes, we set it later)
alex
parents:
5331
diff
changeset
|
189 if (avcodec_open(avctx, lavc_codec) < 0) { |
| 4952 | 190 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantOpenCodec); |
| 191 return 0; | |
| 192 } | |
| 193 mp_msg(MSGT_DECVIDEO,MSGL_V,"INFO: libavcodec init OK!\n"); | |
| 5482 | 194 ctx->last_aspect=-3; |
| 5510 | 195 return 1; //mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YV12); |
| 4952 | 196 } |
| 197 | |
| 198 // uninit driver | |
| 199 static void uninit(sh_video_t *sh){ | |
| 5280 | 200 vd_ffmpeg_ctx *ctx = sh->context; |
| 201 AVCodecContext *avctx = ctx->avctx; | |
| 202 | |
| 203 if (avcodec_close(avctx) < 0) | |
| 4952 | 204 mp_msg(MSGT_DECVIDEO,MSGL_ERR, MSGTR_CantCloseCodec); |
| 5939 | 205 |
| 206 #if LIBAVCODEC_BUILD >= 4605 | |
| 207 if (avctx->extradata_size) | |
| 208 free(avctx->extradata); | |
| 209 #endif | |
| 210 | |
| 5280 | 211 if (avctx) |
| 212 free(avctx); | |
| 213 if (ctx) | |
| 214 free(ctx); | |
| 4952 | 215 } |
| 216 | |
| 5482 | 217 static void draw_slice(struct AVCodecContext *s, |
| 218 UINT8 **src, int linesize, | |
| 219 int y, int width, int height){ | |
| 6710 | 220 sh_video_t * sh = s->opaque; |
| 5482 | 221 int stride[3]; |
| 6740 | 222 int start=0, i; |
| 223 int skip_stride= (s->width+15)>>4; | |
| 224 UINT8 *skip= &s->mbskip_table[(y>>4)*skip_stride]; | |
| 225 #if LIBAVCODEC_BUILD > 4615 | |
| 226 int threshold= s->pict_type==B_TYPE ? -99 : s->dr_ip_buffer_count; | |
| 227 #endif | |
| 5482 | 228 |
| 229 stride[0]=linesize; | |
| 6740 | 230 #if LIBAVCODEC_BUILD > 4615 |
| 231 if(s->dr_uvstride) | |
| 232 stride[1]=stride[2]= s->dr_uvstride; | |
| 233 else | |
| 234 #endif | |
| 235 stride[1]=stride[2]=stride[0]/2; | |
| 236 #if 0 | |
| 237 if(s->pict_type!=B_TYPE){ | |
| 238 for(i=0; i*16<width+16; i++){ | |
| 239 if(i*16>=width || skip[i]>=threshold){ | |
| 240 if(start==i) start++; | |
| 241 else{ | |
| 242 UINT8 *src2[3]= {src[0] + start*16, | |
| 243 src[1] + start*8, | |
| 244 src[2] + start*8}; | |
| 245 //printf("%2d-%2d x %d\n", start, i, y); | |
| 246 mpcodecs_draw_slice (sh,src2, stride, (i-start)*16, height, start*16, y); | |
| 247 start= i+1; | |
| 248 } | |
| 249 } | |
| 250 } | |
| 251 }else | |
| 252 #endif | |
| 253 mpcodecs_draw_slice (sh,src, stride, width, height, 0, y); | |
| 5482 | 254 } |
| 4952 | 255 |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
256 static int init_vo(sh_video_t *sh){ |
| 5280 | 257 vd_ffmpeg_ctx *ctx = sh->context; |
| 258 AVCodecContext *avctx = ctx->avctx; | |
| 4952 | 259 |
| 5482 | 260 if (avctx->aspect_ratio_info != ctx->last_aspect || |
| 261 avctx->width != sh->disp_w || | |
| 262 avctx->height != sh->disp_h || | |
| 263 !ctx->vo_inited) | |
| 5280 | 264 { |
| 265 ctx->last_aspect = avctx->aspect_ratio_info; | |
| 266 switch(avctx->aspect_ratio_info) | |
| 267 { | |
| 268 case FF_ASPECT_4_3_625: | |
| 269 case FF_ASPECT_4_3_525: | |
| 270 sh->aspect = 4.0/3.0; | |
| 271 break; | |
| 272 case FF_ASPECT_16_9_625: | |
| 273 case FF_ASPECT_16_9_525: | |
| 274 sh->aspect = 16.0/9.0; | |
| 275 break; | |
| 276 case FF_ASPECT_SQUARE: | |
| 277 sh->aspect = 0.0; | |
| 278 break; | |
| 279 } | |
| 5482 | 280 sh->disp_w = avctx->width; |
| 281 sh->disp_h = avctx->height; | |
| 282 ctx->vo_inited=1; | |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
283 ctx->yuy2_support=(avctx->pix_fmt==PIX_FMT_YUV422P); |
| 6681 | 284 #if LIBAVCODEC_BUILD >= 4615 |
| 285 ctx->yvu9_support=(avctx->pix_fmt==PIX_FMT_YUV410P); | |
| 286 #endif | |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
287 if (!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h, |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
288 ctx->yuy2_support ? IMGFMT_YUY2 : IMGFMT_YV12)) |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
289 return -1; |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
290 ctx->convert=(sh->codec->outfmt[sh->outfmtidx]==IMGFMT_YUY2); |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
291 } |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
292 return 0; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
293 } |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
294 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
295 #if LIBAVCODEC_BUILD > 4615 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
296 static void get_buffer(struct AVCodecContext *avctx, int width, int height, int pict_type){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
297 sh_video_t * sh = avctx->opaque; |
| 6734 | 298 vd_ffmpeg_ctx *ctx = sh->context; |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
299 mp_image_t* mpi=NULL; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
300 // int flags= MP_IMGFLAG_ALIGNED_STRIDE; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
301 int flags= MP_IMGFLAG_ACCEPT_STRIDE; |
| 6737 | 302 int type= MP_IMGTYPE_IPB; |
| 6738 | 303 int align=15; |
| 304 | |
| 305 if(avctx->pix_fmt == PIX_FMT_YUV410P) | |
| 306 align=63; //yes seriously, its really needed (16x16 chroma blocks in SVQ1 -> 64x64) | |
| 307 | |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
308 if(init_vo(sh)<0){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
309 printf("init_vo failed\n"); |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
310 return; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
311 } |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
312 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
313 if(pict_type==B_TYPE) |
| 6734 | 314 flags|=(!avctx->hurry_up && ctx->do_slices) ? |
| 315 MP_IMGFLAG_DRAW_CALLBACK:0; | |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
316 else |
|
6742
93bce3460e2a
fallback to slices, if dr1 fails (bug found by kabi)
michael
parents:
6740
diff
changeset
|
317 flags|= MP_IMGFLAG_PRESERVE|MP_IMGFLAG_READABLE |
|
93bce3460e2a
fallback to slices, if dr1 fails (bug found by kabi)
michael
parents:
6740
diff
changeset
|
318 | (ctx->do_slices ? MP_IMGFLAG_DRAW_CALLBACK : 0); |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
319 |
| 6737 | 320 #if LIBAVCODEC_BUILD > 4616 |
| 321 if(avctx->has_b_frames){ | |
| 322 type= MP_IMGTYPE_IPB; | |
| 323 }else{ | |
| 324 type= MP_IMGTYPE_IP; | |
| 325 } | |
| 326 #endif | |
| 327 mp_msg(MSGT_DECVIDEO,MSGL_DBG2, type== MP_IMGTYPE_IPB ? "using IPB\n" : "using IP\n"); | |
| 328 | |
| 329 mpi= mpcodecs_get_image(sh,type, flags, | |
| 6738 | 330 (width+align)&(~align), (height+align)&(~align)); |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
331 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
332 // ok, lets see what did we get: |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
333 if( mpi->flags&MP_IMGFLAG_DRAW_CALLBACK && |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
334 !(mpi->flags&MP_IMGFLAG_DIRECT)){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
335 // nice, filter/vo likes draw_callback :) |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
336 avctx->draw_horiz_band= draw_slice; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
337 } else |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
338 avctx->draw_horiz_band= NULL; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
339 avctx->dr_buffer[0]= mpi->planes[0]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
340 avctx->dr_buffer[1]= mpi->planes[1]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
341 avctx->dr_buffer[2]= mpi->planes[2]; |
| 6734 | 342 |
| 343 if(avctx->dr_stride && avctx->dr_stride !=mpi->stride[0]){ | |
| 344 mp_msg(MSGT_DECVIDEO,MSGL_ERR, "Error: stride changed\n"); | |
| 345 } | |
| 346 | |
| 347 avctx->dr_stride = mpi->stride[0]; | |
| 6737 | 348 avctx->dr_uvstride = mpi->stride[1]; |
| 6734 | 349 |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
350 avctx->dr_opaque_frame = mpi; |
| 6737 | 351 avctx->dr_ip_buffer_count=2; //FIXME |
|
6742
93bce3460e2a
fallback to slices, if dr1 fails (bug found by kabi)
michael
parents:
6740
diff
changeset
|
352 //printf("%X\n", (int)mpi->planes[0]); |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
353 } |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
354 #endif |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
355 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
356 // decode a frame |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
357 static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
358 int got_picture=0; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
359 int ret; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
360 AVPicture lavc_picture; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
361 vd_ffmpeg_ctx *ctx = sh->context; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
362 AVCodecContext *avctx = ctx->avctx; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
363 mp_image_t* mpi=NULL; |
| 6737 | 364 int dr1= ctx->do_dr1; |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
365 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
366 if(len<=0) return NULL; // skipped frame |
| 6734 | 367 |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
368 avctx->draw_horiz_band=NULL; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
369 avctx->opaque=sh; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
370 if(ctx->vo_inited && !ctx->convert && !(flags&3) && !dr1){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
371 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE | |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
372 (ctx->do_slices?MP_IMGFLAG_DRAW_CALLBACK:0), |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
373 sh->disp_w, sh->disp_h); |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
374 if(mpi && mpi->flags&MP_IMGFLAG_DRAW_CALLBACK){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
375 // vd core likes slices! |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
376 avctx->draw_horiz_band=draw_slice; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
377 } |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
378 } |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
379 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
380 #if LIBAVCODEC_BUILD > 4603 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
381 avctx->hurry_up=(flags&3)?((flags&2)?2:1):0; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
382 #endif |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
383 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
384 ret = avcodec_decode_video(avctx, &lavc_picture, |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
385 &got_picture, data, len); |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
386 if(ret<0) mp_msg(MSGT_DECVIDEO,MSGL_WARN, "Error while decoding frame!\n"); |
|
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
387 |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
388 //-- vstats generation |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
389 while(lavc_param_vstats){ // always one time loop |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
390 static FILE *fvstats=NULL; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
391 char filename[20]; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
392 static int all_len=0; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
393 static int frame_number=0; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
394 static double all_frametime=0.0; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
395 |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
396 if(!fvstats) { |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
397 time_t today2; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
398 struct tm *today; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
399 today2 = time(NULL); |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
400 today = localtime(&today2); |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
401 sprintf(filename, "vstats_%02d%02d%02d.log", today->tm_hour, |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
402 today->tm_min, today->tm_sec); |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
403 fvstats = fopen(filename,"w"); |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
404 if(!fvstats) { |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
405 perror("fopen"); |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
406 lavc_param_vstats=0; // disable block |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
407 break; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
408 /*exit(1);*/ |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
409 } |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
410 } |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
411 |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
412 all_len+=len; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
413 all_frametime+=sh->frametime; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
414 fprintf(fvstats, "frame= %5d q= %2d f_size= %6d s_size= %8.0fkB ", |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
415 ++frame_number, avctx->quality, len, (double)all_len/1024); |
|
6833
a709a7662cd1
Add type= and fix a minor typing difference from ffmpeg
atmos4
parents:
6828
diff
changeset
|
416 fprintf(fvstats, "time= %0.3f br= %7.1fkbits/s avg_br= %7.1fkbits/s ", |
|
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
417 all_frametime, (double)(len*8)/sh->frametime/1000.0, |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
418 (double)(all_len*8)/all_frametime/1000.0); |
|
6833
a709a7662cd1
Add type= and fix a minor typing difference from ffmpeg
atmos4
parents:
6828
diff
changeset
|
419 fprintf(fvstats, "type= %c\n", sh->ds->flags&1 ? 'I' : 'P'); |
|
6828
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
420 break; |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
421 } |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
422 //-- |
|
010be15e48ad
Generate ffmpeg compatible vstats_<time>.log, when -lavdopts vstats is specified.
atmos4
parents:
6771
diff
changeset
|
423 |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
424 if(!got_picture) return NULL; // skipped image |
| 6738 | 425 |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
426 if(init_vo(sh)<0) return NULL; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
427 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
428 #if LIBAVCODEC_BUILD > 4615 |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
429 if(dr1 && avctx->dr_opaque_frame){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
430 mpi= (mp_image_t*)avctx->dr_opaque_frame; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
431 } |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
432 #endif |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
433 |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
434 if(!mpi && ctx->convert){ |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
435 // do yuv422p -> yuy2 conversion: |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
436 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
437 avctx->width, avctx->height); |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
438 if(!mpi) return NULL; |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
439 yuv422ptoyuy2(lavc_picture.data[0],lavc_picture.data[1],lavc_picture.data[2], |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
440 mpi->planes[0],avctx->width,avctx->height, |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
441 lavc_picture.linesize[0],lavc_picture.linesize[1],mpi->stride[0]); |
|
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
442 return mpi; |
| 5280 | 443 } |
| 4952 | 444 |
| 5482 | 445 if(!mpi) |
| 4952 | 446 mpi=mpcodecs_get_image(sh, MP_IMGTYPE_EXPORT, MP_IMGFLAG_PRESERVE, |
| 5280 | 447 avctx->width, avctx->height); |
| 4952 | 448 if(!mpi){ // temporary! |
|
5207
d337cc4ab0ee
config vo if resolution changed (after decoded image read the dimensions out of lavc context)
alex
parents:
5124
diff
changeset
|
449 printf("couldn't allocate image for codec\n"); |
| 4952 | 450 return NULL; |
| 451 } | |
| 452 | |
|
6733
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
453 if(!dr1){ |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
454 mpi->planes[0]=lavc_picture.data[0]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
455 mpi->planes[1]=lavc_picture.data[1]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
456 mpi->planes[2]=lavc_picture.data[2]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
457 mpi->stride[0]=lavc_picture.linesize[0]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
458 mpi->stride[1]=lavc_picture.linesize[1]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
459 mpi->stride[2]=lavc_picture.linesize[2]; |
|
3b1f37fc0693
direct rendering method 1 (disabled currently as its not bugfree / finished yet, just set dr1=1 if u want to try it)
michael
parents:
6710
diff
changeset
|
460 } |
| 4952 | 461 |
| 5280 | 462 if(avctx->pix_fmt==PIX_FMT_YUV422P){ |
|
5592
b545d56314d2
yuy2 support, fixed bug of dropping frame after config_vo calls
arpi
parents:
5517
diff
changeset
|
463 // we have 422p but user wants yv12 (420p) |
| 4952 | 464 mpi->stride[1]*=2; |
| 465 mpi->stride[2]*=2; | |
| 466 } | |
| 467 | |
| 6665 | 468 /* to comfirm with newer lavc style */ |
| 469 #if !defined(FF_POSTPROCESS) && (LIBAVCODEC_BUILD > 4612) | |
| 470 mpi->qscale=avctx->quant_store; | |
| 471 #if LIBAVCODEC_BUILD > 4613 | |
| 472 mpi->qstride=avctx->qstride; | |
| 473 #else | |
| 474 mpi->qstride=MBC+1; | |
| 475 #endif | |
| 6771 | 476 #elif defined(FF_POSTPROCESS) |
| 5517 | 477 mpi->qscale=&quant_store[0][0]; |
| 478 mpi->qstride=MBC+1; | |
| 479 #endif | |
| 480 | |
| 4952 | 481 return mpi; |
| 482 } | |
| 483 | |
| 484 #endif | |
| 485 |
