summaryrefslogtreecommitdiffstats
path: root/libhb
diff options
context:
space:
mode:
authortiter <[email protected]>2006-03-16 08:08:36 +0000
committertiter <[email protected]>2006-03-16 08:08:36 +0000
commit0531e628d2bf701202857411035c05a2b2544c58 (patch)
tree1f254e6ac34761aa89667f633618eae296753c7f /libhb
parenta40bc8fa76c2e510498944b0de222cd843c6672a (diff)
Added hb_init_express - makes the binary smaller. Still need to strip
the unused avi and ogm muxers. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@36 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb')
-rw-r--r--libhb/common.h43
-rw-r--r--libhb/encavcodec.c2
-rw-r--r--libhb/hb.c10
-rw-r--r--libhb/hb.h32
-rw-r--r--libhb/internal.h41
-rw-r--r--libhb/ports.h1
-rw-r--r--libhb/work.c20
7 files changed, 92 insertions, 57 deletions
diff --git a/libhb/common.h b/libhb/common.h
index 7bc48940b..61864e9c0 100644
--- a/libhb/common.h
+++ b/libhb/common.h
@@ -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
diff --git a/libhb/encavcodec.c b/libhb/encavcodec.c
index 45c79fddc..155ff9b3e 100644
--- a/libhb/encavcodec.c
+++ b/libhb/encavcodec.c
@@ -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,
diff --git a/libhb/hb.c b/libhb/hb.c
index f27a353bc..0e78b1e2c 100644
--- a/libhb/hb.c
+++ b/libhb/hb.c
@@ -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;
diff --git a/libhb/hb.h b/libhb/hb.h
index 4a64c9047..7a1ab7ea8 100644
--- a/libhb/hb.h
+++ b/libhb/hb.h
@@ -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 * );
diff --git a/libhb/internal.h b/libhb/internal.h
index d241ae5c1..7a6caad4a 100644
--- a/libhb/internal.h
+++ b/libhb/internal.h
@@ -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
diff --git a/libhb/ports.h b/libhb/ports.h
index 4639c6b93..47df1ce5e 100644
--- a/libhb/ports.h
+++ b/libhb/ports.h
@@ -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 ** );
diff --git a/libhb/work.c b/libhb/work.c
index c22585313..3b1b4dce5 100644
--- a/libhb/work.c
+++ b/libhb/work.c
@@ -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;
}