]> git.sesse.net Git - vlc/blobdiff - modules/codec/quicktime.c
Add support for Cinepak, Indeo Video IV, DVC Pro 100, DVC Pro HD and Pixlet (the...
[vlc] / modules / codec / quicktime.c
index 8a85ea7b1a7c0c39774d9213a919707088056c67..18d0a8e1c858f80dbd8f074cde0e796b496d340d 100644 (file)
@@ -30,7 +30,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_aout.h>
 #include <vlc_vout.h>
 #include <vlc_codec.h>
@@ -64,8 +65,8 @@ static int  Open ( vlc_object_t * );
 static void Close( vlc_object_t * );
 
 vlc_module_begin();
-    set_description( _("QuickTime library decoder") );
-    set_capability( "decoder", 10 );
+    set_description( N_("QuickTime library decoder") );
+    set_capability( "decoder", 100 );
     set_category( CAT_INPUT );
     set_subcategory( SUBCAT_INPUT_VCODEC );
     set_callbacks( Open, Close );
@@ -226,8 +227,29 @@ static int Open( vlc_object_t *p_this )
 {
     decoder_t *p_dec = (decoder_t*)p_this;
 
+#ifdef __APPLE__
+    OSErr err;
+    SInt32 qtVersion;
+    
+    err = Gestalt(gestaltQuickTimeVersion, &qtVersion);
+#endif
+
     switch( p_dec->fmt_in.i_codec )
     {
+        case VLC_FOURCC('h','2','6','4'): /* H.264 */
+        case VLC_FOURCC('a','v','c','1'): /* dto. */
+        case VLC_FOURCC('c','v','i','d'): /* 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_FOURCC('Z','y','G','o'):
@@ -244,7 +266,16 @@ static int Open( vlc_object_t *p_this )
             return OpenVideo( p_dec );
 #endif
 
+#ifdef __APPLE__
+        case VLC_FOURCC('I','L','B','C'): /* iLBC */
+            if ((err == noErr) || (qtVersion < 0x07500000)) 
+                return VLC_EGENERIC;
+        case VLC_FOURCC('i','l','b','c'): /* iLBC */
+            if ((err == noErr) || (qtVersion < 0x07500000)) 
+                return VLC_EGENERIC;
+#endif
         case VLC_FOURCC('s','a','m','r'): /* 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_FOURCC('Q','D','M','C'): /* QDesign */
         case VLC_FOURCC('Q','D','M','2'): /* QDesign* 2 */
@@ -461,6 +492,8 @@ static int OpenAudio( decoder_t *p_dec )
     p_sys->i_buffer      = 0;
     p_sys->i_buffer_size = 100*1000;
     p_sys->p_buffer      = malloc( p_sys->i_buffer_size );
+    if( !p_sys->p_buffer )
+        goto exit_error;
 
     p_sys->i_out = 0;
     p_sys->i_out_frames = 0;
@@ -497,7 +530,7 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
         if( OpenAudio( p_dec ) )
         {
             /* Fatal */
-            p_dec->b_error = VLC_TRUE;
+            p_dec->b_error = true;
             return NULL;
         }
 
@@ -620,6 +653,8 @@ static aout_buffer_t *DecodeAudio( decoder_t *p_dec, block_t **pp_block )
 static int OpenVideo( decoder_t *p_dec )
 {
     decoder_sys_t *p_sys = malloc( sizeof( decoder_sys_t ) );
+    if( !p_sys )
+        return VLC_ENOMEM;
 
 #ifndef WIN32
     vlc_mutex_t                        *lock;
@@ -715,6 +750,8 @@ static int OpenVideo( decoder_t *p_dec )
     /* codec data FIXME use codec not SVQ3 */
     msg_Dbg( p_dec, "vide = %d", i_vide  );
     id = malloc( sizeof( ImageDescription ) + ( i_vide - 70 ) );
+    if( !id )
+        goto exit_error;
     id->idSize          = sizeof( ImageDescription ) + ( i_vide - 70 );
     id->cType           = FCC( fcc[0], fcc[1], fcc[2], fcc[3] );
     id->version         = GetWBE ( p_vide +  0 );
@@ -751,6 +788,8 @@ static int OpenVideo( decoder_t *p_dec )
     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_sys->plane )
+        goto exit_error;
 
     i_result = p_sys->QTNewGWorldFromPtr( &p_sys->OutBufferGWorld,
                                           /*pixel format of new GWorld==YUY2 */
@@ -824,7 +863,7 @@ static picture_t *DecodeVideo( decoder_t *p_dec, block_t **pp_block )
         if( OpenVideo( p_dec ) )
         {
             /* Fatal */
-            p_dec->b_error = VLC_TRUE;
+            p_dec->b_error = true;
             return NULL;
         }
         p_sys = p_dec->p_sys;