mirror of
https://github.com/mpv-player/mpv
synced 2025-04-09 19:22:05 +00:00
We should know size of out buffer
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@4876 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
parent
a92a572f24
commit
afb0fd5ea1
34
dec_video.c
34
dec_video.c
@ -455,6 +455,7 @@ unsigned int out_fmt=sh_video->codec->outfmt[sh_video->outfmtidx];
|
|||||||
pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */
|
pitches[0] = pitches[1] =pitches[2] = 0; /* fake unknown */
|
||||||
|
|
||||||
sh_video->our_out_buffer=NULL;
|
sh_video->our_out_buffer=NULL;
|
||||||
|
sh_video->our_out_buffer_size=0U;
|
||||||
|
|
||||||
sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h);
|
sh_video->image=new_mp_image(sh_video->disp_w,sh_video->disp_h);
|
||||||
mp_image_setfmt(sh_video->image,out_fmt);
|
mp_image_setfmt(sh_video->image,out_fmt);
|
||||||
@ -464,8 +465,8 @@ switch(sh_video->codec->driver){
|
|||||||
#ifdef USE_MP_IMAGE
|
#ifdef USE_MP_IMAGE
|
||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
sh_video->our_out_buffer =
|
sh_video->our_out_buffer_size = sh_video->disp_w * sh_video->disp_h * 1.5;
|
||||||
(char*)memalign(64, sh_video->disp_w * sh_video->disp_h * 1.5);
|
sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
sh_video->context = roq_decode_video_init();
|
sh_video->context = roq_decode_video_init();
|
||||||
break;
|
break;
|
||||||
@ -474,8 +475,8 @@ switch(sh_video->codec->driver){
|
|||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
int bpp=((out_fmt&255)+7)/8;
|
int bpp=((out_fmt&255)+7)/8;
|
||||||
sh_video->our_out_buffer =
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp;
|
||||||
(char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp);
|
sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
sh_video->context = decode_cinepak_init();
|
sh_video->context = decode_cinepak_init();
|
||||||
break;
|
break;
|
||||||
@ -548,8 +549,8 @@ switch(sh_video->codec->driver){
|
|||||||
bpp=((out_fmt&255)+7)&(~7);
|
bpp=((out_fmt&255)+7)&(~7);
|
||||||
DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR
|
DS_VideoDecoder_SetDestFmt(ds_vdec,out_fmt&255,0); // RGB/BGR
|
||||||
}
|
}
|
||||||
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp/8; // FIXME!!!
|
||||||
sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp/8); // FIXME!!!
|
sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
/* Warning: these pitches tested only with YUY2 fourcc */
|
/* Warning: these pitches tested only with YUY2 fourcc */
|
||||||
pitches[0] = 16; pitches[1] = pitches[2] = 8;
|
pitches[0] = 16; pitches[1] = pitches[2] = 8;
|
||||||
@ -625,7 +626,8 @@ switch(sh_video->codec->driver){
|
|||||||
#ifdef USE_MP_IMAGE
|
#ifdef USE_MP_IMAGE
|
||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
sh_video->our_out_buffer = (char*)memalign(64,((bits*dec_param.x_dim+7)/8)*dec_param.y_dim);
|
sh_video->our_out_buffer_size = ((bits*dec_param.x_dim+7)/8)*dec_param.y_dim;
|
||||||
|
sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
|
||||||
// sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5);
|
// sh_video->our_out_buffer = shmem_alloc(dec_param.x_dim*dec_param.y_dim*5);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -699,7 +701,8 @@ switch(sh_video->codec->driver){
|
|||||||
#ifdef USE_MP_IMAGE
|
#ifdef USE_MP_IMAGE
|
||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
sh_video->our_out_buffer = (char*)memalign(64,sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!!
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp; // FIXME!!!
|
||||||
|
sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
if(bpp==2){ // 15 or 16 bpp ==> palette conversion!
|
if(bpp==2){ // 15 or 16 bpp ==> palette conversion!
|
||||||
unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40);
|
unsigned int* pal=(unsigned int*)(((char*)sh_video->bih)+40);
|
||||||
@ -734,8 +737,8 @@ switch(sh_video->codec->driver){
|
|||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
int bpp=((out_fmt&255)+7)/8; // RGB only
|
int bpp=((out_fmt&255)+7)/8; // RGB only
|
||||||
sh_video->our_out_buffer =
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp; // FIXME!!!
|
||||||
(char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!!
|
sh_video->our_out_buffer = (char*)memalign(64,sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24))
|
if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24))
|
||||||
printf (
|
printf (
|
||||||
@ -754,8 +757,8 @@ if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24))
|
|||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
int bpp=((out_fmt&255)+7)/8; // RGB only
|
int bpp=((out_fmt&255)+7)/8; // RGB only
|
||||||
sh_video->our_out_buffer =
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*bpp; // FIXME!!!
|
||||||
(char*)memalign(64, sh_video->disp_w*sh_video->disp_h*bpp); // FIXME!!!
|
sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -763,7 +766,8 @@ if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24))
|
|||||||
#ifdef USE_MP_IMAGE
|
#ifdef USE_MP_IMAGE
|
||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
sh_video->our_out_buffer = (char *)memalign(64, sh_video->disp_w*sh_video->disp_h*3/2);
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*3/2;
|
||||||
|
sh_video->our_out_buffer = (char *)memalign(64,sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
case VFM_CYUV: {
|
case VFM_CYUV: {
|
||||||
@ -771,8 +775,8 @@ if ((sh_video->codec->driver == VFM_QTRLE) && (sh_video->bih->biBitCount != 24))
|
|||||||
#ifdef USE_MP_IMAGE
|
#ifdef USE_MP_IMAGE
|
||||||
sh_video->image->type=MP_IMGTYPE_STATIC;
|
sh_video->image->type=MP_IMGTYPE_STATIC;
|
||||||
#else
|
#else
|
||||||
sh_video->our_out_buffer =
|
sh_video->our_out_buffer_size = sh_video->disp_w*sh_video->disp_h*3;
|
||||||
(char*)memalign(64, sh_video->disp_w*sh_video->disp_h*3);
|
sh_video->our_out_buffer = (char*)memalign(64, sh_video->our_out_buffer_size);
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -63,6 +63,7 @@ typedef struct {
|
|||||||
// buffers:
|
// buffers:
|
||||||
float num_frames; // number of frames played
|
float num_frames; // number of frames played
|
||||||
int num_frames_decoded; // number of frames decoded
|
int num_frames_decoded; // number of frames decoded
|
||||||
|
unsigned our_out_buffer_size;
|
||||||
char *our_out_buffer;
|
char *our_out_buffer;
|
||||||
mp_image_t *image;
|
mp_image_t *image;
|
||||||
// win32 codec stuff:
|
// win32 codec stuff:
|
||||||
|
Loading…
Reference in New Issue
Block a user