summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 00:13:11 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-03-10 00:13:11 +0200
commit13221a716588dc88c1151e0a0f8eb7cce41d461c (patch)
tree3184184f1e984d248e2570ffa05c79589d2c9a1c /libmpcodecs
parentc4f7b9666f753b320157e6497f9114523878885f (diff)
parentbb54613ac1211c73a3614db6b7326d7cd9be39da (diff)
downloadmpv-13221a716588dc88c1151e0a0f8eb7cce41d461c.tar.bz2
mpv-13221a716588dc88c1151e0a0f8eb7cce41d461c.tar.xz
Merge svn changes up to r30663
Conflicts: gui/cfg.c libmpcodecs/vd_dmo.c mplayer.c
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/ad_qtaudio.c9
-rw-r--r--libmpcodecs/vd_dmo.c54
-rw-r--r--libmpcodecs/vd_dshow.c7
-rw-r--r--libmpcodecs/vd_qtvideo.c4
-rw-r--r--libmpcodecs/vf_zrmjpeg.c1
5 files changed, 57 insertions, 18 deletions
diff --git a/libmpcodecs/ad_qtaudio.c b/libmpcodecs/ad_qtaudio.c
index 0021d42ec1..fb308c2d2c 100644
--- a/libmpcodecs/ad_qtaudio.c
+++ b/libmpcodecs/ad_qtaudio.c
@@ -277,6 +277,11 @@ static void uninit(sh_audio_t *sh){
int error;
unsigned long ConvertedFrames=0;
unsigned long ConvertedBytes=0;
+
+#ifdef WIN32_LOADER
+ Setup_FS_Segment();
+#endif
+
error=SoundConverterEndConversion(myConverter,NULL,&ConvertedFrames,&ConvertedBytes);
mp_msg(MSGT_DECAUDIO,MSGL_DBG2,"SoundConverterEndConversion:%i\n",error);
error = SoundConverterClose(myConverter);
@@ -300,6 +305,10 @@ static int decode_audio(sh_audio_t *sh,unsigned char *buf,int minlen,int maxlen)
unsigned long ConvertedFrames=0;
unsigned long ConvertedBytes=0;
+#ifdef WIN32_LOADER
+ Setup_FS_Segment();
+#endif
+
FramesToGet=minlen/OutFrameSize;
if(FramesToGet*OutFrameSize<minlen &&
(FramesToGet+1)*OutFrameSize<=maxlen) ++FramesToGet;
diff --git a/libmpcodecs/vd_dmo.c b/libmpcodecs/vd_dmo.c
index 217fd05725..42630d7c7e 100644
--- a/libmpcodecs/vd_dmo.c
+++ b/libmpcodecs/vd_dmo.c
@@ -39,6 +39,12 @@ static const vd_info_t info = {
LIBVD_EXTERN(dmo)
+struct context {
+ void *decoder;
+ uint8_t *buffer;
+ int stride;
+};
+
// to set/get/query special features/parameters
static int control(sh_video_t *sh,int cmd,void* arg,...){
return CONTROL_UNKNOWN;
@@ -46,59 +52,81 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
// init driver
static int init(sh_video_t *sh){
- unsigned int out_fmt;
- if(!(sh->context=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
+ unsigned int out_fmt=sh->codec->outfmt[sh->outfmtidx];
+ struct context *ctx;
+ void *decoder;
+ if(!(decoder=DMO_VideoDecoder_Open(sh->codec->dll,&sh->codec->guid, sh->bih, 0, 0))){
mp_tmsg(MSGT_DECVIDEO,MSGL_ERR,"ERROR: Could not open required DirectShow codec %s.\n",sh->codec->dll);
mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
return 0;
}
- if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
- out_fmt=sh->codec->outfmt[sh->outfmtidx];
+ if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0;
+ sh->context = ctx = calloc(1, sizeof(*ctx));
+ ctx->decoder = decoder;
switch(out_fmt){
case IMGFMT_YUY2:
case IMGFMT_UYVY:
- DMO_VideoDecoder_SetDestFmt(sh->context,16,out_fmt);break; // packed YUV
+ DMO_VideoDecoder_SetDestFmt(ctx->decoder,16,out_fmt);break; // packed YUV
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
- DMO_VideoDecoder_SetDestFmt(sh->context,12,out_fmt);break; // planar YUV
+ DMO_VideoDecoder_SetDestFmt(ctx->decoder,12,out_fmt);break; // planar YUV
case IMGFMT_YVU9:
- DMO_VideoDecoder_SetDestFmt(sh->context,9,out_fmt);break;
+ DMO_VideoDecoder_SetDestFmt(ctx->decoder,9,out_fmt);break;
+ case IMGFMT_RGB24:
+ case IMGFMT_BGR24:
+ if (sh->disp_w & 3)
+ {
+ ctx->stride = ((sh->disp_w * 3) + 3) & ~3;
+ ctx->buffer = memalign(64, ctx->stride * sh->disp_h);
+ }
default:
- DMO_VideoDecoder_SetDestFmt(sh->context,out_fmt&255,0); // RGB/BGR
+ DMO_VideoDecoder_SetDestFmt(ctx->decoder,out_fmt&255,0); // RGB/BGR
}
- DMO_VideoDecoder_StartInternal(sh->context);
+ DMO_VideoDecoder_StartInternal(ctx->decoder);
mp_tmsg(MSGT_DECVIDEO,MSGL_V,"INFO: Win32/DMO video codec init OK.\n");
return 1;
}
// uninit driver
static void uninit(sh_video_t *sh){
- DMO_VideoDecoder_Destroy(sh->context);
+ struct context *ctx = sh->context;
+ DMO_VideoDecoder_Destroy(ctx->decoder);
+ free(ctx);
+ sh->context = NULL;
}
//mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h);
// decode a frame
static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
+ struct context *ctx = sh->context;
+ uint8_t *buffer = ctx->buffer;
+ int type = ctx->buffer ? MP_IMGTYPE_EXPORT : MP_IMGTYPE_TEMP;
mp_image_t* mpi;
if(len<=0) return NULL; // skipped frame
if(flags&3){
// framedrop:
- DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 0, 0);
+ DMO_VideoDecoder_DecodeInternal(ctx->decoder, data, len, 0, 0);
return NULL;
}
- mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
+ mpi=mpcodecs_get_image(sh, type, MP_IMGFLAG_COMMON_PLANE,
sh->disp_w, sh->disp_h);
+ if (buffer) {
+ mpi->planes[0] = buffer;
+ mpi->stride[0] = ctx->stride;
+ } else {
+ buffer = mpi->planes[0];
+ }
if(!mpi){ // temporary!
mp_tmsg(MSGT_DECVIDEO,MSGL_WARN,"[VD_DMO] Couldn't allocate image for cinepak codec.\n");
return NULL;
}
- DMO_VideoDecoder_DecodeInternal(sh->context, data, len, 1, mpi->planes[0]);
+ DMO_VideoDecoder_DecodeInternal(ctx->decoder, data, len, 1, buffer);
return mpi;
}
diff --git a/libmpcodecs/vd_dshow.c b/libmpcodecs/vd_dshow.c
index f75294eecc..a960f5dffe 100644
--- a/libmpcodecs/vd_dshow.c
+++ b/libmpcodecs/vd_dshow.c
@@ -66,7 +66,7 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
// init driver
static int init(sh_video_t *sh){
- unsigned int out_fmt;
+ unsigned int out_fmt=sh->codec->outfmt[sh->outfmtidx];
/* Hack for VSSH codec: new dll can't decode old files
* In my samples old files have no extradata, so use that info
@@ -80,8 +80,7 @@ static int init(sh_video_t *sh){
mp_tmsg(MSGT_DECVIDEO,MSGL_HINT,"You need to upgrade/install the binary codecs package.\nGo to http://www.mplayerhq.hu/dload.html\n");
return 0;
}
- if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,IMGFMT_YUY2)) return 0;
- out_fmt=sh->codec->outfmt[sh->outfmtidx];
+ if(!mpcodecs_config_vo(sh,sh->disp_w,sh->disp_h,out_fmt)) return 0;
switch(out_fmt){
case IMGFMT_YUY2:
case IMGFMT_UYVY:
@@ -119,7 +118,7 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
return NULL;
}
- mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, 0 /*MP_IMGFLAG_ACCEPT_STRIDE*/,
+ mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_COMMON_PLANE,
sh->disp_w, sh->disp_h);
if(!mpi){ // temporary!
diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c
index 5120f612b5..8e73c84753 100644
--- a/libmpcodecs/vd_qtvideo.c
+++ b/libmpcodecs/vd_qtvideo.c
@@ -316,6 +316,10 @@ static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){
sh->disp_w, sh->disp_h);
if(!mpi) return NULL;
+#ifdef WIN32_LOADER
+ Setup_FS_Segment();
+#endif
+
decpar.data = (char*)data;
decpar.bufferSize = len;
(**framedescHandle).dataSize=len;
diff --git a/libmpcodecs/vf_zrmjpeg.c b/libmpcodecs/vf_zrmjpeg.c
index 87c50351d9..31f51e7765 100644
--- a/libmpcodecs/vf_zrmjpeg.c
+++ b/libmpcodecs/vf_zrmjpeg.c
@@ -50,7 +50,6 @@
#define HAVE_AV_CONFIG_H
#include "libavcodec/avcodec.h"
#include "libavcodec/mjpegenc.h"
-//#include "jpeg_enc.h" /* this file is not present yet */
#undef malloc
#undef free