]> git.sesse.net Git - vlc/blobdiff - modules/codec/quicktime.c
Use var_Inherit* instead of var_CreateGet*.
[vlc] / modules / codec / quicktime.c
index a417fdd628d2f45e4d5243037e1ce9fbc9c201fd..ae154fa3c04a46d93b586335652d760544c32e1f 100644 (file)
@@ -1,11 +1,11 @@
 /*****************************************************************************
  * quicktime.c: a quicktime decoder that uses the QT library/dll
  *****************************************************************************
- * Copyright (C) 2003 the VideoLAN team
+ * Copyright (C) 2003, 2008 - 2009 the VideoLAN team
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir at via.ecp.fr>
- *          Derk-Jan Hartman <thedj at users.sf.net>
+ *          Derk-Jan Hartman <hartman at videolan.org>>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -33,7 +33,6 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
-#include <vlc_vout.h>
 #include <vlc_codec.h>
 
 #if !defined (__APPLE__) && !defined(WIN32)
@@ -64,14 +63,14 @@ int       WINAPI FreeLibrary(HMODULE);
 static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
-vlc_module_begin();
-    set_description( N_("QuickTime library decoder") );
-    set_capability( "decoder", 100 );
-    set_category( CAT_INPUT );
-    set_subcategory( SUBCAT_INPUT_VCODEC );
-    set_callbacks( Open, Close );
+vlc_module_begin ()
+    set_description( N_("QuickTime library decoder") )
+    set_capability( "decoder", 0 )
+    set_category( CAT_INPUT )
+    set_subcategory( SUBCAT_INPUT_VCODEC )
+    set_callbacks( Open, Close )
 
-vlc_module_end();
+vlc_module_end ()
 
 
 /*****************************************************************************
@@ -81,7 +80,9 @@ static int           OpenAudio( decoder_t * );
 static int           OpenVideo( decoder_t * );
 
 static aout_buffer_t *DecodeAudio( decoder_t *, block_t ** );
+#ifndef WIN32
 static picture_t     *DecodeVideo( decoder_t *, block_t ** );
+#endif
 
 #define FCC( a, b , c, d ) \
     ((uint32_t)( ((a)<<24)|((b)<<16)|((c)<<8)|(d)))
@@ -188,7 +189,7 @@ struct decoder_sys_t
     /* Output properties */
     uint8_t *           plane;
     mtime_t             pts;
-    audio_date_t        date;
+    date_t              date;
 
     int                 i_late; /* video */
 
@@ -203,7 +204,7 @@ struct decoder_sys_t
     int                 i_out;
 };
 
-static int pi_channels_maps[6] =
+static const int pi_channels_maps[6] =
 {
     0,
     AOUT_CHAN_CENTER,
@@ -215,7 +216,9 @@ static int pi_channels_maps[6] =
 };
 
 static int QTAudioInit( decoder_t * );
+#ifndef WIN32
 static int QTVideoInit( decoder_t * );
+#endif
 
 /*****************************************************************************
  * Open: probe the decoder and return score
@@ -230,41 +233,40 @@ static int Open( vlc_object_t *p_this )
 #ifdef __APPLE__
     OSErr err;
     SInt32 qtVersion, macosversion;
-    
+
     err = Gestalt(gestaltQuickTimeVersion, &qtVersion);
     err = Gestalt(gestaltSystemVersion, &macosversion);
 #ifndef NDEBUG
-    msg_Dbg( p_this, "mac os version is %#lx", macosversion );
-    msg_Dbg( p_this, "quicktime version is %#lx", qtVersion );
+    msg_Dbg( p_this, "Mac OS version is %#lx", macosversion );
+    msg_Dbg( p_this, "Quicktime version is %#lx", qtVersion );
 #endif
+
+    /* bail out. This plugin is soo Carbon, that it can't be used on 10.5 at all */
+    msg_Info( p_dec, "Your Mac OS version is to new to use this plugin for anything." );
+    return VLC_EGENERIC;
 #endif
 
     switch( p_dec->fmt_in.i_codec )
     {
-        case VLC_FOURCC('h','2','6','4'): /* H.264 */
-        case VLC_FOURCC('c','v','i','d'): /* Cinepak */
+        case VLC_CODEC_H264:
+        case VLC_CODEC_CINEPAK:
         case VLC_FOURCC('I','V','4','1'): /* Indeo Video IV */
         case VLC_FOURCC('i','v','4','1'): /* dto. */
 #ifdef __APPLE__
         case VLC_FOURCC('p','x','l','t'): /* Pixlet */
 #endif
-        case VLC_FOURCC('d','v','1','n'): /* DVC Pro 100 NTSC */
-        case VLC_FOURCC('d','v','1','p'): /* DVC Pro 100 PAL */
-        case VLC_FOURCC('d','v','h','p'): /* DVC PRO HD 720p */
-        case VLC_FOURCC('d','v','h','6'): /* DVC PRO HD 1080i 60 */
-        case VLC_FOURCC('d','v','h','5'): /* DVC PRO HD 1080i 50 */
-
-        case VLC_FOURCC('S','V','Q','3'): /* Sorenson v3 */
-    /*    case VLC_FOURCC('S','V','Q','1'):  Sorenson v1
+        case VLC_CODEC_DV:
+        case VLC_CODEC_SVQ3: /* Sorenson v3 */
+    /*    case VLC_CODEC_SVQ1:  Sorenson v1
         case VLC_FOURCC('Z','y','G','o'):
         case VLC_FOURCC('V','P','3','1'):
         case VLC_FOURCC('3','I','V','1'): */
-        case VLC_FOURCC('r','l','e',' '): /* QuickTime animation (RLE) */
-        case VLC_FOURCC('r','p','z','a'): /* QuickTime Apple Video */
-        case VLC_FOURCC('a','z','p','r'): /* QuickTime animation (RLE) */
+        case VLC_CODEC_QTRLE:
+        case VLC_CODEC_RPZA:
 #ifdef LOADER
         p_dec->p_sys = NULL;
         p_dec->pf_decode_video = DecodeVideo;
+        p_dec->fmt_out.i_cat = VIDEO_ES;
         return VLC_SUCCESS;
 #else
         return OpenVideo( p_dec );
@@ -278,23 +280,23 @@ static int Open( vlc_object_t *p_this )
             if ((err != noErr) || (qtVersion < 0x07500000)) 
                 return VLC_EGENERIC;
 #endif
-        case VLC_FOURCC('s','a','m','r'): /* 3GPP AMR audio */
+        case VLC_CODEC_AMR_NB: /* 3GPP AMR audio */
         case VLC_FOURCC('s','a','m','b'): /* 3GPP AMR-WB audio */
-        case VLC_FOURCC('m','p','4','a'): /* MPEG-4 audio */
+        case VLC_CODEC_MP4A: /* MPEG-4 audio */
         case VLC_FOURCC('Q','D','M','C'): /* QDesign */
-        case VLC_FOURCC('Q','D','M','2'): /* QDesign* 2 */
-        case VLC_FOURCC('Q','c','l','p'): /* Qualcomm Purevoice Codec */
+        case VLC_CODEC_QDM2: /* QDesign* 2 */
+        case VLC_CODEC_QCELP: /* Qualcomm Purevoice Codec */
         case VLC_FOURCC('Q','C','L','P'): /* Qualcomm Purevoice Codec */
-        case VLC_FOURCC('M','A','C','3'): /* MACE3 audio decoder */
-        case VLC_FOURCC('M','A','C','6'): /* MACE6 audio decoder */
+        case VLC_CODEC_MACE3: /* MACE3 audio decoder */
+        case VLC_CODEC_MACE6: /* MACE6 audio decoder */
         case VLC_FOURCC('d','v','c','a'): /* DV Audio */
         case VLC_FOURCC('s','o','w','t'): /* 16-bit Little Endian */
         case VLC_FOURCC('t','w','o','s'): /* 16-bit Big Endian */
-        case VLC_FOURCC('a','l','a','w'): /* ALaw 2:1 */
+        case VLC_CODEC_ALAW: /* ALaw 2:1 */
         case VLC_FOURCC('u','l','a','w'): /* mu-Law 2:1 */
         case VLC_FOURCC('r','a','w',' '): /* 8-bit offset binaries */
-        case VLC_FOURCC('f','l','3','2'): /* 32-bit Floating Point */
-        case VLC_FOURCC('f','l','6','4'): /* 64-bit Floating Point */
+        case VLC_CODEC_FL32: /* 32-bit Floating Point */
+        case VLC_CODEC_FL64: /* 64-bit Floating Point */
         case VLC_FOURCC('i','n','2','4'): /* 24-bit Interger */
         case VLC_FOURCC('i','n','3','2'): /* 32-bit Integer */
         case 0x0011:                            /* DVI IMA */
@@ -303,21 +305,9 @@ static int Open( vlc_object_t *p_this )
 #ifdef LOADER
         p_dec->p_sys = NULL;
         p_dec->pf_decode_audio = DecodeAudio;
+        p_dec->fmt_out.i_cat = AUDIO_ES;
         return VLC_SUCCESS;
 #else
-
-#ifdef __APPLE__
-        /* FIXME: right now, we don't support audio decoding on 10.5 and later
-         because we are still using the hardcore-outdated SoundManager API,
-         which was removed after 10.4 */
-
-        if( macosversion >= 0x1050 || err != noErr )
-        {
-            msg_Warn( p_dec, "Your Mac OS version doesn't have SoundManager anymore. "
-                     "You can't use this plugin for audio." );
-            return VLC_EGENERIC;
-        }
-#endif
         return OpenAudio( p_dec );
 #endif
 
@@ -326,6 +316,8 @@ static int Open( vlc_object_t *p_this )
     }
 }
 
+static vlc_mutex_t qt_mutex = VLC_STATIC_MUTEX;
+
 /*****************************************************************************
  * Close:
  *****************************************************************************/
@@ -333,10 +325,9 @@ static void Close( vlc_object_t *p_this )
 {
     decoder_t     *p_dec = (decoder_t*)p_this;
     decoder_sys_t *p_sys = p_dec->p_sys;
-    vlc_mutex_t   *lock;
 
     /* get lock, avoid segfault */
-    lock = var_AcquireMutex( "qt_mutex" );
+    vlc_mutex_lock( &qt_mutex );
 
     if( p_dec->fmt_out.i_cat == AUDIO_ES )
     {
@@ -375,7 +366,7 @@ static void Close( vlc_object_t *p_this )
 #endif
 #endif
 
-    vlc_mutex_unlock( lock );
+    vlc_mutex_unlock( &qt_mutex );
 
     free( p_sys );
 }
@@ -394,15 +385,16 @@ static int OpenAudio( decoder_t *p_dec )
     unsigned long   OutputBufferSize = 0;
 
     /* get lock, avoid segfault */
-    vlc_mutex_t    *lock = var_AcquireMutex( "qt_mutex" );
-    if( lock == NULL )
-        return VLC_EGENERIC;
+    vlc_mutex_lock( &qt_mutex );
 
-    p_sys = calloc( sizeof( decoder_sys_t ), 1 );
+    p_sys = calloc( 1, sizeof( decoder_sys_t ) );
     p_dec->p_sys = p_sys;
     p_dec->pf_decode_audio = DecodeAudio;
 
-    memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
+    if( p_dec->fmt_in.i_original_fourcc )
+        memcpy( fcc, &p_dec->fmt_in.i_original_fourcc, 4 );
+    else
+        memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
 
 #ifdef __APPLE__
     EnterMovies();
@@ -497,14 +489,14 @@ static int OpenAudio( decoder_t *p_dec )
     }
 
 
-    es_format_Init( &p_dec->fmt_out, AUDIO_ES, AOUT_FMT_S16_NE );
+    es_format_Init( &p_dec->fmt_out, AUDIO_ES, VLC_CODEC_S16N );
     p_dec->fmt_out.audio.i_rate = p_sys->OutputFormatInfo.sampleRate;
     p_dec->fmt_out.audio.i_channels = p_sys->OutputFormatInfo.numChannels;
     p_dec->fmt_out.audio.i_physical_channels =
     p_dec->fmt_out.audio.i_original_channels =
         pi_channels_maps[p_sys->OutputFormatInfo.numChannels];
 
-    aout_DateInit( &p_sys->date, p_dec->fmt_out.audio.i_rate );
+    date_Init( &p_sys->date, p_dec->fmt_out.audio.i_rate, 1 );
 
     p_sys->i_buffer      = 0;
     p_sys->i_buffer_size = 100*1000;
@@ -515,7 +507,7 @@ static int OpenAudio( decoder_t *p_dec )
     p_sys->i_out = 0;
     p_sys->i_out_frames = 0;
 
-    vlc_mutex_unlock( lock );
+    vlc_mutex_unlock( &qt_mutex );
     return VLC_SUCCESS;
 
 exit_error:
@@ -523,7 +515,7 @@ exit_error:
 #ifdef LOADER
     Restore_LDT_Keeper( p_sys->ldt_fs );
 #endif
-    vlc_mutex_unlock( lock );
+    vlc_mutex_unlock( &qt_mutex );
 
     free( p_sys );
     return VLC_EGENERIC;
@@ -574,7 +566,12 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
     if( p_sys->i_out_frames <= 0 )
     {
         p_sys->pts = p_block->i_pts;
-        if( decoder_GetDisplayDate( p_dec, p_block->i_pts ) < mdate() )
+
+        mtime_t i_display_date = 0;
+        if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+            i_display_date = decoder_GetDisplayDate( p_dec, p_block->i_pts );
+
+        if( i_display_date > 0 && i_display_date < mdate() )
         {
             block_Release( p_block );
             *pp_block = NULL;
@@ -585,7 +582,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         if( p_sys->i_buffer_size < p_sys->i_buffer + p_block->i_buffer )
         {
             p_sys->i_buffer_size = p_sys->i_buffer + p_block->i_buffer + 1024;
-            p_sys->p_buffer = realloc( p_sys->p_buffer, p_sys->i_buffer_size );
+            p_sys->p_buffer = xrealloc( p_sys->p_buffer, p_sys->i_buffer_size );
         }
         memcpy( &p_sys->p_buffer[p_sys->i_buffer], p_block->p_buffer,
                 p_block->i_buffer );
@@ -595,7 +592,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         {
             int i_frames = p_sys->i_buffer / p_sys->InFrameSize;
             unsigned long i_out_frames, i_out_bytes;
-            vlc_mutex_t *lock = var_AcquireMutex( "qt_mutex ");
+            vlc_mutex_lock( &qt_mutex );
 
             i_error = p_sys->SoundConverterConvertBuffer( p_sys->myConverter,
                                                           p_sys->p_buffer,
@@ -603,7 +600,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
                                                           p_sys->out_buffer,
                                                           &i_out_frames,
                                                           &i_out_bytes );
-            vlc_mutex_unlock( lock );
+            vlc_mutex_unlock( &qt_mutex );
 
             /*
             msg_Dbg( p_dec, "decoded %d frames -> %ld frames (error=%d)",
@@ -621,12 +618,12 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
                          p_sys->i_buffer );
             }
 
-            if( p_sys->pts != 0 &&
-                p_sys->pts != aout_DateGet( &p_sys->date ) )
+            if( p_sys->pts > VLC_TS_INVALID &&
+                p_sys->pts != date_Get( &p_sys->date ) )
             {
-                aout_DateSet( &p_sys->date, p_sys->pts );
+                date_Set( &p_sys->date, p_sys->pts );
             }
-            else if( !aout_DateGet( &p_sys->date ) )
+            else if( !date_Get( &p_sys->date ) )
             {
                 return NULL;
             }
@@ -645,16 +642,17 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         aout_buffer_t *p_out;
         int  i_frames = __MIN( p_sys->i_out_frames - p_sys->i_out, 1000 );
 
-        p_out = p_dec->pf_aout_buffer_new( p_dec, i_frames );
+        p_out = decoder_NewAudioBuffer( p_dec, i_frames );
 
         if( p_out )
         {
-            p_out->start_date = aout_DateGet( &p_sys->date );
-            p_out->end_date = aout_DateIncrement( &p_sys->date, i_frames );
+            p_out->i_pts = date_Get( &p_sys->date );
+            p_out->i_length = date_Increment( &p_sys->date, i_frames )
+                              - p_out->i_pts;
 
             memcpy( p_out->p_buffer,
                     &p_sys->out_buffer[2 * p_sys->i_out * p_dec->fmt_out.audio.i_channels],
-                    p_out->i_nb_bytes );
+                    p_out->i_buffer );
 
             p_sys->i_out += i_frames;
         }
@@ -669,12 +667,11 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
  *****************************************************************************/
 static int OpenVideo( decoder_t *p_dec )
 {
+#ifndef WIN32
     decoder_sys_t *p_sys = malloc( sizeof( decoder_sys_t ) );
     if( !p_sys )
         return VLC_ENOMEM;
 
-#ifndef WIN32
-    vlc_mutex_t                        *lock;
     long                                i_result;
     ComponentDescription                desc;
     Component                           prev;
@@ -698,12 +695,16 @@ static int OpenVideo( decoder_t *p_dec )
         return VLC_EGENERIC;
     }
 
-    memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
+    if( p_dec->fmt_in.i_original_fourcc )
+        memcpy( fcc, &p_dec->fmt_in.i_original_fourcc, 4 );
+    else
+        memcpy( fcc, &p_dec->fmt_in.i_codec, 4 );
+
     msg_Dbg( p_dec, "quicktime_video %4.4s %dx%d",
              fcc, p_dec->fmt_in.video.i_width, p_dec->fmt_in.video.i_height );
 
     /* get lock, avoid segfault */
-    lock = var_AcquireMutex( "qt_mutex" );
+    vlc_mutex_lock( &qt_mutex );
 
 #ifdef __APPLE__
     EnterMovies();
@@ -743,17 +744,17 @@ static int OpenVideo( decoder_t *p_dec )
 
     memset( &icap, 0, sizeof( ImageSubCodecDecompressCapabilities ) );
     cres =  p_sys->ImageCodecInitialize( p_sys->ci, &icap );
-    msg_Dbg( p_dec, "ImageCodecInitialize->0x%X size=%d (%d)\n",
+    msg_Dbg( p_dec, "ImageCodecInitialize->0x%X size=%d (%d)",
              (int)cres, (int)icap.recordSize, (int)icap.decompressRecordSize);
 
     memset( &cinfo, 0, sizeof( CodecInfo ) );
     cres =  p_sys->ImageCodecGetCodecInfo( p_sys->ci, &cinfo );
     msg_Dbg( p_dec,
-             "Flags: compr: 0x%x decomp: 0x%x format: 0x%x\n",
+             "Flags: compr: 0x%x decomp: 0x%x format: 0x%x",
              (unsigned int)cinfo.compressFlags,
              (unsigned int)cinfo.decompressFlags,
              (unsigned int)cinfo.formatFlags );
-    msg_Dbg( p_dec, "quicktime_video: Codec name: %.*s\n",
+    msg_Dbg( p_dec, "quicktime_video: Codec name: %.*s",
              ((unsigned char*)&cinfo.typeName)[0],
              ((unsigned char*)&cinfo.typeName)+1 );
 
@@ -804,7 +805,8 @@ static int OpenVideo( decoder_t *p_dec )
     p_sys->framedescHandle = (ImageDescriptionHandle) NewHandleClear( id->idSize );
     memcpy( *p_sys->framedescHandle, id, id->idSize );
 
-    p_sys->plane = malloc( p_dec->fmt_in.video.i_width * p_dec->fmt_in.video.i_height * 3 );
+    if( p_dec->fmt_in.video.i_width != 0 && p_dec->fmt_in.video.i_height != 0) 
+        p_sys->plane = malloc( p_dec->fmt_in.video.i_width * p_dec->fmt_in.video.i_height * 3 );
     if( !p_sys->plane )
         goto exit_error;
 
@@ -818,7 +820,7 @@ static int OpenVideo( decoder_t *p_dec )
                                           p_sys->plane,
                                           p_dec->fmt_in.video.i_width * 2 );
 
-    msg_Dbg( p_dec, "NewGWorldFromPtr returned:%ld\n",
+    msg_Dbg( p_dec, "NewGWorldFromPtr returned:%ld",
              65536 - ( i_result&0xffff ) );
 
     memset( &p_sys->decpar, 0, sizeof( CodecDecompressParams ) );
@@ -836,23 +838,26 @@ static int OpenVideo( decoder_t *p_dec )
     p_sys->decpar.dstPixMap        = **p_sys->GetGWorldPixMap( p_sys->OutBufferGWorld );/*destPixmap;  */
 
     cres =  p_sys->ImageCodecPreDecompress( p_sys->ci, &p_sys->decpar );
-    msg_Dbg( p_dec, "quicktime_video: ImageCodecPreDecompress cres=0x%X\n",
+    msg_Dbg( p_dec, "quicktime_video: ImageCodecPreDecompress cres=0x%X",
              (int)cres );
 
-    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_FOURCC( 'Y', 'U', 'Y', '2' ));
+    es_format_Init( &p_dec->fmt_out, VIDEO_ES, VLC_CODEC_YUYV);
     p_dec->fmt_out.video.i_width = p_dec->fmt_in.video.i_width;
     p_dec->fmt_out.video.i_height= p_dec->fmt_in.video.i_height;
-    p_dec->fmt_out.video.i_aspect = VOUT_ASPECT_FACTOR * p_dec->fmt_in.video.i_width / p_dec->fmt_in.video.i_height;
-    vlc_mutex_unlock( lock );
+    p_dec->fmt_out.video.i_sar_num = 1;
+    p_dec->fmt_out.video.i_sar_den = 1;
+
+    vlc_mutex_unlock( &qt_mutex );
     return VLC_SUCCESS;
 
 exit_error:
 #ifdef LOADER
     Restore_LDT_Keeper( p_sys->ldt_fs );
 #endif
-    vlc_mutex_unlock( lock );
+    vlc_mutex_unlock( &qt_mutex );
 
+#else
+    VLC_UNUSED( p_dec );
 #endif /* !WIN32 */
 
     return VLC_EGENERIC;
@@ -865,7 +870,6 @@ exit_error:
 static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
 {
     decoder_sys_t *p_sys = p_dec->p_sys;
-    vlc_mutex_t   *lock;
     block_t       *p_block;
     picture_t     *p_pic;
     mtime_t       i_pts;
@@ -894,9 +898,13 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
     p_block = *pp_block;
     *pp_block = NULL;
  
-    i_pts = p_block->i_pts ? p_block->i_pts : p_block->i_dts;
+    i_pts = p_block->i_pts > VLC_TS_INVALID ? p_block->i_pts : p_block->i_dts;
+
+    mtime_t i_display_date = 0;
+    if( !(p_block->i_flags & BLOCK_FLAG_PREROLL) )
+        i_display_date = decoder_GetDisplayDate( p_dec, i_pts );
 
-    if( decoder_GetDisplayDate( p_dec, i_pts ) < mdate() )
+    if( i_display_date > 0 && i_display_date < mdate() )
     {
         p_sys->i_late++;
     }
@@ -910,14 +918,14 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
 
     if( p_sys->i_late > 10 )
     {
-        msg_Dbg( p_dec, "late buffer dropped (%i)", i_pts );
+        msg_Dbg( p_dec, "late buffer dropped (%"PRId64")", i_pts );
         block_Release( p_block );
         return NULL;
     }
  
-    lock = var_AcquireMutex( "qt_mutex" );
+    vlc_mutex_lock( &qt_mutex );
 
-    if( ( p_pic = p_dec->pf_vout_buffer_new( p_dec ) ) )
+    if( ( p_pic = decoder_NewPicture( p_dec ) ) )
     {
         p_sys->decpar.data                  = (Ptr)p_block->p_buffer;
         p_sys->decpar.bufferSize            = p_block->i_buffer;
@@ -930,7 +938,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         if( cres &0xFFFF )
         {
             msg_Dbg( p_dec, "quicktime_video: ImageCodecBandDecompress"
-                     " cres=0x%X (-0x%X) %d :(\n",
+                     " cres=0x%X (-0x%X) %d :(",
                      (int)cres,(int)-cres, (int)cres );
         }
 
@@ -939,7 +947,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         p_pic->date = i_pts;
     }
  
-    vlc_mutex_unlock( lock );
+    vlc_mutex_unlock( &qt_mutex );
 
     block_Release( p_block );
     return p_pic;