summaryrefslogtreecommitdiffstats
path: root/libhb/ports.c
diff options
context:
space:
mode:
authorRodeo <[email protected]>2013-06-03 15:37:38 +0000
committerRodeo <[email protected]>2013-06-03 15:37:38 +0000
commit16deb214281cd72ffaf2a11d3a5556c5b950a966 (patch)
treef673787fe7a92a894ec2ccace325af298831ef92 /libhb/ports.c
parent812134ffba931aa603e67f541e7a2f0f03215fbb (diff)
libhb/common: improve fallback mechanism.
API changes: - added hb_global_init(), must be called before any other libhb function - removed (somewhat pointless) hb_mixdown_t.internal_name - some hb_*_get_from_name() functions now return 0 instead of -1. Instead of hardcoded fallbacks, list items now have a specific fallback, and a generic ID for when the specific fallback is unavailable. Encoder availability is checked at runtime (hb_global_init calling hb_common_global_init) and the item's value/fallback is sanity-checked and updated if necessary. See https://reviews.handbrake.fr/r/506/ for more detailed information. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5547 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'libhb/ports.c')
-rw-r--r--libhb/ports.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/libhb/ports.c b/libhb/ports.c
index 98945fec0..64b68bcb4 100644
--- a/libhb/ports.c
+++ b/libhb/ports.c
@@ -231,6 +231,41 @@ int hb_get_cpu_count()
return cpu_count;
}
+int hb_platform_init()
+{
+ int result = 0;
+
+#if defined(SYS_MINGW) && defined(PTW32_STATIC_LIB)
+ result = !pthread_win32_process_attach_np();
+ if (result)
+ {
+ hb_error("pthread_win32_process_attach_np() failed!");
+ return -1;
+ }
+#endif
+
+#if defined(_WIN32) || defined(__MINGW32__)
+ /*
+ * win32 _IOLBF (line-buffering) is the same as _IOFBF (full-buffering).
+ * force it to unbuffered otherwise informative output is not easily parsed.
+ */
+ result = setvbuf(stdout, NULL, _IONBF, 0);
+ if (result)
+ {
+ hb_error("setvbuf(stdout, NULL, _IONBF, 0) failed!");
+ return -1;
+ }
+ result = setvbuf(stderr, NULL, _IONBF, 0);
+ if (result)
+ {
+ hb_error("setvbuf(stderr, NULL, _IONBF, 0) failed!");
+ return -1;
+ }
+#endif
+
+ return result;
+}
+
/************************************************************************
* Get a temporary directory for HB
***********************************************************************/