#include "hb.h"
#include "hbffmpeg.h"
+#if defined( SYS_MINGW ) && defined( PTW32_STATIC_LIB )
+#include <pthread.h>
+#endif
+
struct hb_handle_s
{
int id;
return ret;
}
+int hb_ff_layout_xlat(int64_t ff_channel_layout, int channels)
+{
+ int hb_layout;
+
+ switch (ff_channel_layout)
+ {
+ case CH_LAYOUT_MONO:
+ hb_layout = HB_INPUT_CH_LAYOUT_MONO;
+ break;
+ case CH_LAYOUT_STEREO:
+ hb_layout = HB_INPUT_CH_LAYOUT_STEREO;
+ break;
+ case CH_LAYOUT_SURROUND:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F;
+ break;
+ case CH_LAYOUT_4POINT0:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F1R;
+ break;
+ case CH_LAYOUT_2_2:
+ hb_layout = HB_INPUT_CH_LAYOUT_2F2R;
+ break;
+ case CH_LAYOUT_QUAD:
+ hb_layout = HB_INPUT_CH_LAYOUT_2F2R;
+ break;
+ case CH_LAYOUT_5POINT0:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F2R;
+ break;
+ case CH_LAYOUT_5POINT1:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F2R|HB_INPUT_CH_LAYOUT_HAS_LFE;
+ break;
+ case CH_LAYOUT_5POINT0_BACK:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F2R;
+ break;
+ case CH_LAYOUT_5POINT1_BACK:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F2R|HB_INPUT_CH_LAYOUT_HAS_LFE;
+ break;
+ case CH_LAYOUT_7POINT0:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F4R;
+ break;
+ case CH_LAYOUT_7POINT1:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F4R|HB_INPUT_CH_LAYOUT_HAS_LFE;
+ break;
+ case CH_LAYOUT_STEREO_DOWNMIX:
+ hb_layout = HB_INPUT_CH_LAYOUT_STEREO;
+ break;
+ default:
+ hb_layout = HB_INPUT_CH_LAYOUT_STEREO;
+ break;
+ }
+ // Now make sure the chosen layout agrees with the number of channels
+ // ffmpeg tells us there are. It seems ffmpeg is sometimes confused
+ // about this. So we will make a best guess based on the number
+ // of channels.
+ int chans = HB_INPUT_CH_LAYOUT_GET_DISCRETE_COUNT( hb_layout );
+ if ( chans == channels )
+ {
+ return hb_layout;
+ }
+ hb_log( "Channels reported by ffmpeg (%d) != computed layout channels (%d).", channels, chans );
+ switch (channels)
+ {
+ case 1:
+ hb_layout = HB_INPUT_CH_LAYOUT_MONO;
+ break;
+ case 2:
+ hb_layout = HB_INPUT_CH_LAYOUT_STEREO;
+ break;
+ case 3:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F;
+ break;
+ case 4:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F1R;
+ break;
+ case 5:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F2R;
+ break;
+ case 6:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F2R|HB_INPUT_CH_LAYOUT_HAS_LFE;
+ break;
+ case 7:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F4R;
+ break;
+ case 8:
+ hb_layout = HB_INPUT_CH_LAYOUT_3F4R|HB_INPUT_CH_LAYOUT_HAS_LFE;
+ break;
+ default:
+ hb_log("Unsupported number of audio channels (%d).\n", channels);
+ hb_layout = 0;
+ break;
+ }
+ return hb_layout;
+}
+
/**
* Registers work objects, by adding the work object to a liked list.
* @param w Handle to hb_work_object_t to register.
{
if (!hb_process_initialized)
{
-#ifdef USE_PTHREAD
-#if defined( _WIN32 ) || defined( __MINGW32__ )
+#if defined( SYS_MINGW ) && defined( PTW32_STATIC_LIB )
pthread_win32_process_attach_np();
#endif
-#endif
hb_process_initialized =1;
}
hb_register( &hb_encvobsub );
hb_register( &hb_deccc608 );
hb_register( &hb_decsrtsub );
+ hb_register( &hb_decutf8sub );
+ hb_register( &hb_dectx3gsub );
hb_register( &hb_render );
hb_register( &hb_encavcodec );
hb_register( &hb_encx264 );
hb_register( &hb_encvobsub );
hb_register( &hb_deccc608 );
hb_register( &hb_decsrtsub );
+ hb_register( &hb_decutf8sub );
+ hb_register( &hb_dectx3gsub );
hb_register( &hb_render );
hb_register( &hb_encavcodec );
hb_register( &hb_encx264 );
if( average_cc > threshold )
{
#if 0
- hb_log("Average %i combed (Threshold %i) %i/%i/%i | PTS: %lld (%fs) %s", average_cc, threshold, cc[0], cc[1], cc[2], buf->start, (float)buf->start / 90000, (buf->flags & 16) ? "Film" : "Video" );
+ hb_log("Average %i combed (Threshold %i) %i/%i/%i | PTS: %"PRId64" (%fs) %s", average_cc, threshold, cc[0], cc[1], cc[2], buf->start, (float)buf->start / 90000, (buf->flags & 16) ? "Film" : "Video" );
#endif
return 1;
}
#if 0
- hb_log("SKIPPED Average %i combed (Threshold %i) %i/%i/%i | PTS: %lld (%fs) %s", average_cc, threshold, cc[0], cc[1], cc[2], buf->start, (float)buf->start / 90000, (buf->flags & 16) ? "Film" : "Video" );
+ hb_log("SKIPPED Average %i combed (Threshold %i) %i/%i/%i | PTS: %"PRId64" (%fs) %s", average_cc, threshold, cc[0], cc[1], cc[2], buf->start, (float)buf->start / 90000, (buf->flags & 16) ? "Film" : "Video" );
#endif
/* Reaching this point means no combing detected. */