summaryrefslogtreecommitdiffstats
path: root/libmpcodecs
diff options
context:
space:
mode:
authorreimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-07-24 16:33:22 +0000
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-11-02 04:14:45 +0200
commit56599fe4a44553f726b3b524086c35dc558bf521 (patch)
treea39ec42339999e2745acd8990e95b0b93493188a /libmpcodecs
parent15365874f9cbe2316ae8f32395e04d36832e7281 (diff)
downloadmpv-56599fe4a44553f726b3b524086c35dc558bf521.tar.bz2
mpv-56599fe4a44553f726b3b524086c35dc558bf521.tar.xz
vd_qtvideo: generate a ImageDescription if not given
Generate a ImageDescription if none is passed neither via ImageDesc nor extradata. Makes the ProRes decoder work with -demuxer lavf. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31784 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpcodecs')
-rw-r--r--libmpcodecs/vd_qtvideo.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/libmpcodecs/vd_qtvideo.c b/libmpcodecs/vd_qtvideo.c
index 6032a57f8d..b336984a0e 100644
--- a/libmpcodecs/vd_qtvideo.c
+++ b/libmpcodecs/vd_qtvideo.c
@@ -98,11 +98,11 @@ static int control(sh_video_t *sh,int cmd,void* arg,...){
// init driver
static int init(sh_video_t *sh){
OSErr result = 1;
+ int extradata_size = sh->bih ? sh->bih->biSize - sizeof(BITMAPINFOHEADER) : 0;
+ void *extradata = sh->bih + 1;
- if (sh->ImageDesc == NULL) {
- mp_msg(MSGT_DECVIDEO,MSGL_ERR,"sh->ImageDesc not set, cannot use binary QuickTime codecs (try -demuxer mov?)\n");
- return 0;
- }
+ if (!sh->ImageDesc)
+ mp_msg(MSGT_DECVIDEO,MSGL_ERR,"sh->ImageDesc not set, try -demuxer mov if this fails.\n");
#ifndef CONFIG_QUICKTIME
#ifdef WIN32_LOADER
@@ -156,10 +156,25 @@ static int init(sh_video_t *sh){
//Fill the imagedescription for our SVQ3 frame
//we can probably get this from Demuxer
- if(!sh->ImageDesc) sh->ImageDesc=(sh->bih+1); // hack for SVQ3-in-AVI
+ if (!sh->ImageDesc && extradata_size >= sizeof(ImageDescription) &&
+ ((ImageDescription *)extradata)->idSize <= extradata_size)
+ sh->ImageDesc = extradata;
+ if (sh->ImageDesc) {
mp_msg(MSGT_DECVIDEO,MSGL_DBG2,"ImageDescription size: %d\n",((ImageDescription*)(sh->ImageDesc))->idSize);
framedescHandle=(ImageDescriptionHandle)NewHandleClear(((ImageDescription*)(sh->ImageDesc))->idSize);
memcpy(*framedescHandle,sh->ImageDesc,((ImageDescription*)(sh->ImageDesc))->idSize);
+ } else {
+ // assume extradata consists only of the atoms, build the other parts
+ ImageDescription *idesc;
+ int size = sizeof(*idesc) + extradata_size;
+ mp_msg(MSGT_DECVIDEO, MSGL_V, "Generating a ImageDescription\n");
+ framedescHandle=(ImageDescriptionHandle)NewHandleClear(size);
+ idesc = *framedescHandle;
+ memcpy(idesc + 1, extradata, extradata_size);
+ idesc->idSize = size;
+ idesc->width = sh->disp_w;
+ idesc->height = sh->disp_h;
+ }
dump_ImageDescription(*framedescHandle);
(**framedescHandle).cType = bswap_32(sh->format);