OSDN Git Service

Added hb_init_express - makes the binary smaller. Still need to strip
authortiter <titer@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 16 Mar 2006 08:08:36 +0000 (08:08 +0000)
committertiter <titer@b64f7644-9d1e-0410-96f1-a4d463321fa5>
Thu, 16 Mar 2006 08:08:36 +0000 (08:08 +0000)
the unused avi and ogm muxers.

git-svn-id: svn://localhost/HandBrake/trunk@36 b64f7644-9d1e-0410-96f1-a4d463321fa5

libhb/common.h
libhb/encavcodec.c
libhb/hb.c
libhb/hb.h
libhb/internal.h
libhb/ports.h
libhb/work.c
macosx/ExpressController.m

index 7bc4894..61864e9 100644 (file)
@@ -36,6 +36,12 @@ typedef struct hb_chapter_s hb_chapter_t;
 typedef struct hb_audio_s hb_audio_t;
 typedef struct hb_subtitle_s hb_subtitle_t;
 typedef struct hb_state_s hb_state_t;
+typedef union  hb_esconfig_u     hb_esconfig_t;
+typedef struct hb_work_private_s hb_work_private_t;
+typedef struct hb_work_object_s  hb_work_object_t;
+typedef struct hb_buffer_s hb_buffer_t;
+typedef struct hb_fifo_s hb_fifo_t;
+typedef struct hb_lock_s hb_lock_t;
 
 #include "ports.h"
 #ifdef __LIBHB__
@@ -311,4 +317,41 @@ struct hb_state_s
     } param;
 };
 
+struct hb_work_object_s
+{
+    int                 id;
+    char              * name;
+
+    int              (* init)  ( hb_work_object_t *, hb_job_t * );
+    int              (* work)  ( hb_work_object_t *, hb_buffer_t **,
+                                 hb_buffer_t ** );
+    void             (* close) ( hb_work_object_t * );
+
+    hb_fifo_t         * fifo_in;
+    hb_fifo_t         * fifo_out;
+    hb_esconfig_t     * config;
+
+    hb_work_private_t * private_data;
+
+    hb_lock_t         * lock;
+    int                 used;
+    uint64_t            time;
+
+    hb_work_object_t  * next;
+};
+
+extern hb_work_object_t hb_sync;
+extern hb_work_object_t hb_decmpeg2;
+extern hb_work_object_t hb_decsub;
+extern hb_work_object_t hb_render;
+extern hb_work_object_t hb_encavcodec;
+extern hb_work_object_t hb_encxvid;
+extern hb_work_object_t hb_encx264;
+extern hb_work_object_t hb_deca52;
+extern hb_work_object_t hb_decavcodec;
+extern hb_work_object_t hb_declpcm;
+extern hb_work_object_t hb_encfaac;
+extern hb_work_object_t hb_enclame;
+extern hb_work_object_t hb_encvorbis;
+
 #endif
index 45c79fd..155ff9b 100644 (file)
@@ -21,7 +21,7 @@ void encavcodecClose( hb_work_object_t * );
 
 hb_work_object_t hb_encavcodec =
 {   
-    WORK_DECSUB,
+    WORK_ENCAVCODEC,
     "MPEG-4 encoder (libavcodec)",
     encavcodecInit,
     encavcodecWork,
index f27a353..0e78b1e 100644 (file)
@@ -42,9 +42,17 @@ struct hb_handle_s
     hb_lock_t    * pause_lock;
 };
 
+hb_work_object_t * hb_objects = NULL;
+
 static void thread_func( void * );
 
-hb_handle_t * hb_init( int verbose, int update_check )
+void hb_register( hb_work_object_t * w )
+{
+    w->next    = hb_objects;
+    hb_objects = w;
+}
+
+hb_handle_t * hb_init_real( int verbose, int update_check )
 {
     hb_handle_t * h = calloc( sizeof( hb_handle_t ), 1 );
     uint64_t      date;
index 4a64c90..7a1ab7e 100644 (file)
@@ -18,7 +18,37 @@ extern "C" {
    etc) */
 #define HB_DEBUG_NONE 0
 #define HB_DEBUG_ALL  1
-hb_handle_t * hb_init( int verbose, int update_check );
+void          hb_register( hb_work_object_t * );
+hb_handle_t * hb_init_real( int verbose, int update_check );
+
+#define hb_init(v,u) \
+hb_init_real( v, u ); \
+hb_register( &hb_sync ); \
+hb_register( &hb_decmpeg2 ); \
+hb_register( &hb_decsub ); \
+hb_register( &hb_render ); \
+hb_register( &hb_encavcodec ); \
+hb_register( &hb_encxvid ); \
+hb_register( &hb_encx264 ); \
+hb_register( &hb_deca52 ); \
+hb_register( &hb_decavcodec ); \
+hb_register( &hb_declpcm ); \
+hb_register( &hb_encfaac ); \
+hb_register( &hb_enclame ); \
+hb_register( &hb_encvorbis ); \
+
+#define hb_init_express(v,u) \
+hb_init_real( v, u ); \
+hb_register( &hb_sync ); \
+hb_register( &hb_decmpeg2 ); \
+hb_register( &hb_decsub ); \
+hb_register( &hb_render ); \
+hb_register( &hb_encavcodec ); \
+hb_register( &hb_encx264 ); \
+hb_register( &hb_deca52 ); \
+hb_register( &hb_decavcodec ); \
+hb_register( &hb_declpcm ); \
+hb_register( &hb_encfaac ); \
 
 /* hb_get_version() */
 char        * hb_get_version( hb_handle_t * );
index d241ae5..7a6caad 100644 (file)
@@ -27,7 +27,6 @@ void hb_set_state( hb_handle_t *, hb_state_t * );
 /***********************************************************************
  * fifo.c
  **********************************************************************/
-typedef struct hb_buffer_s hb_buffer_t;
 struct hb_buffer_s
 {
     int           size;
@@ -54,7 +53,6 @@ hb_buffer_t * hb_buffer_init( int size );
 void          hb_buffer_realloc( hb_buffer_t *, int size );
 void          hb_buffer_close( hb_buffer_t ** );
 
-typedef struct hb_fifo_s hb_fifo_t;
 
 hb_fifo_t   * hb_fifo_init();
 int           hb_fifo_size( hb_fifo_t * );
@@ -115,7 +113,7 @@ void         hb_dvd_close( hb_dvd_t ** );
  * Work objects
  **********************************************************************/
 #define HB_CONFIG_MAX_SIZE 8192
-typedef union hb_esconfig_u
+union hb_esconfig_u
 {
     struct
     {
@@ -141,29 +139,6 @@ typedef union hb_esconfig_u
     {
         uint8_t headers[3][HB_CONFIG_MAX_SIZE];
     } vorbis;
-} hb_esconfig_t;
-
-typedef struct hb_work_private_s hb_work_private_t;
-typedef struct hb_work_object_s  hb_work_object_t;
-struct hb_work_object_s
-{
-    int                 id;
-    char              * name;
-
-    int              (* init)  ( hb_work_object_t *, hb_job_t * );
-    int              (* work)  ( hb_work_object_t *, hb_buffer_t **,
-                                 hb_buffer_t ** );
-    void             (* close) ( hb_work_object_t * );
-
-    hb_fifo_t         * fifo_in;
-    hb_fifo_t         * fifo_out;
-    hb_esconfig_t     * config;
-
-    hb_work_private_t * private_data;
-
-    hb_lock_t         * lock;
-    int                 used;
-    uint64_t            time;
 };
 
 enum
@@ -183,19 +158,7 @@ enum
     WORK_ENCVORBIS
 };
 
-extern hb_work_object_t hb_sync;
-extern hb_work_object_t hb_decmpeg2;
-extern hb_work_object_t hb_decsub;
-extern hb_work_object_t hb_render;
-extern hb_work_object_t hb_encavcodec;
-extern hb_work_object_t hb_encxvid;
-extern hb_work_object_t hb_encx264;
-extern hb_work_object_t hb_deca52;
-extern hb_work_object_t hb_decavcodec;
-extern hb_work_object_t hb_declpcm;
-extern hb_work_object_t hb_encfaac;
-extern hb_work_object_t hb_enclame;
-extern hb_work_object_t hb_encvorbis;
+extern hb_work_object_t * hb_objects;
 
 #define HB_WORK_IDLE     0
 #define HB_WORK_OK       1
index 4639c6b..47df1ce 100644 (file)
@@ -53,7 +53,6 @@ int           hb_thread_has_exited( hb_thread_t * );
 /************************************************************************
  * Mutexes
  ***********************************************************************/
-typedef struct hb_lock_s hb_lock_t;
 
 hb_lock_t * hb_lock_init();
 void        hb_lock_close( hb_lock_t ** );
index c225853..3b1b4dc 100644 (file)
@@ -53,21 +53,13 @@ static void work_func( void * _work )
 
 static hb_work_object_t * getWork( int id )
 {
-    switch( id )
+    hb_work_object_t * w;
+    for( w = hb_objects; w; w = w->next )
     {
-        case WORK_SYNC:       return &hb_sync;
-        case WORK_DECMPEG2:   return &hb_decmpeg2;
-        case WORK_DECSUB:     return &hb_decsub;
-        case WORK_RENDER:     return &hb_render;
-        case WORK_ENCAVCODEC: return &hb_encavcodec;
-        case WORK_ENCXVID:    return &hb_encxvid;
-        case WORK_ENCX264:    return &hb_encx264;
-        case WORK_DECA52:     return &hb_deca52;
-        case WORK_DECAVCODEC: return &hb_decavcodec;
-        case WORK_DECLPCM:    return &hb_declpcm;
-        case WORK_ENCFAAC:    return &hb_encfaac;
-        case WORK_ENCLAME:    return &hb_enclame;
-        case WORK_ENCVORBIS:  return &hb_encvorbis;
+        if( w->id == id )
+        {
+            return w;
+        }
     }
     return NULL;
 }
index 6a56072..cad3308 100644 (file)
@@ -42,7 +42,7 @@
 
 - (void) applicationWillFinishLaunching: (NSNotification *) n
 {
-    fHandle = hb_init( HB_DEBUG_NONE, 0 );
+    fHandle = hb_init_express( HB_DEBUG_NONE, 0 );
     fList   = hb_get_titles( fHandle );
 }