mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-12-28 11:32:05 +00:00
This commit is contained in:
parent
284830e5ef
commit
4922145621
@ -5351,6 +5351,7 @@ WINNT|Darwin|Android)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
MOZ_FFMPEG=1
|
||||||
MOZ_ARG_DISABLE_BOOL(ffmpeg,
|
MOZ_ARG_DISABLE_BOOL(ffmpeg,
|
||||||
[ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
|
[ --disable-ffmpeg Disable FFmpeg for fragmented H264/AAC decoding],
|
||||||
MOZ_FFMPEG=,
|
MOZ_FFMPEG=,
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include "prlink.h"
|
#include "prlink.h"
|
||||||
|
|
||||||
#ifdef XP_DARWIN
|
#ifdef XP_DARWIN
|
||||||
|
#include "prenv.h"
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <mach-o/dyld.h>
|
#include <mach-o/dyld.h>
|
||||||
@ -81,18 +82,43 @@ FFmpegRuntimeLinker::Link()
|
|||||||
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
|
for (size_t i = 0; i < ArrayLength(sLibs); i++) {
|
||||||
const char* lib = sLibs[i];
|
const char* lib = sLibs[i];
|
||||||
#ifdef XP_DARWIN
|
#ifdef XP_DARWIN
|
||||||
/* Loading FFMPEG on Mac OS X (macOS is a typo) fails because mozilla
|
/* OlgaTPark's ffmpeg loader hack.
|
||||||
searches for sybols defined in libavutil with a handle to libavcodec.
|
|
||||||
This is due to the fact that NSPR uses NSAddressOfSymbol & cie who limits
|
Loading ffmpeg on Darwin fails because by default Mozilla
|
||||||
its researches only to libavcodec and not its dependencies. We don't have
|
searches for symbols defined in libavutil with a handle to libavcodec.
|
||||||
this issue with dlsym(). */
|
This is due to the fact that NSPR uses NSAddressOfSymbol et al. that
|
||||||
|
limit search only to libavcodec and not its dependencies. We don't have
|
||||||
|
this issue with dlsym(). */
|
||||||
if (!(sLinkedLib = dlopen(lib, RTLD_NOW | RTLD_LOCAL))) {
|
if (!(sLinkedLib = dlopen(lib, RTLD_NOW | RTLD_LOCAL))) {
|
||||||
/* Bonus time: if we don't find libavcodec in standard locations, we look
|
/* Bonus time: if we don't find libavcodec in standard locations, we look
|
||||||
if our venerable FFMPEG's libraries are in the same folder as XUL. */
|
if our venerable ffmpeg's libraries are in the same folder as XUL. */
|
||||||
char *libFullPath = NULL;
|
char *libFullPath = NULL;
|
||||||
if (asprintf(&libFullPath, "%s/%s", execDir, lib) > 0 && libFullPath)
|
if (asprintf(&libFullPath, "%s/%s", execDir, lib) > 0 && libFullPath) {
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr, "TenFourFox looking for FFmpeg: %s\n", libFullPath);
|
||||||
|
#endif
|
||||||
sLinkedLib = dlopen(libFullPath, RTLD_NOW | RTLD_LOCAL);
|
sLinkedLib = dlopen(libFullPath, RTLD_NOW | RTLD_LOCAL);
|
||||||
free(libFullPath);
|
#if DEBUG
|
||||||
|
if (!sLinkedLib)
|
||||||
|
fprintf(stderr, "Failed to load %s: %s\n", libFullPath, dlerror());
|
||||||
|
#endif
|
||||||
|
free(libFullPath);
|
||||||
|
}
|
||||||
|
// Try also finding the library in ~/Library/ffmpeg.
|
||||||
|
if (!sLinkedLib &&
|
||||||
|
PR_GetEnv("HOME") &&
|
||||||
|
asprintf(&libFullPath, "%s/Library/ffmpeg/%s", PR_GetEnv("HOME"), lib)
|
||||||
|
> 0 && libFullPath) {
|
||||||
|
#if DEBUG
|
||||||
|
fprintf(stderr, "TenFourFox looking for FFmpeg: %s\n", libFullPath);
|
||||||
|
#endif
|
||||||
|
sLinkedLib = dlopen(libFullPath, RTLD_NOW | RTLD_LOCAL);
|
||||||
|
#if DEBUG
|
||||||
|
if (!sLinkedLib)
|
||||||
|
fprintf(stderr, "Failed to load %s: %s\n", libFullPath, dlerror());
|
||||||
|
#endif
|
||||||
|
free(libFullPath);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PRLibSpec lspec;
|
PRLibSpec lspec;
|
||||||
@ -104,6 +130,7 @@ FFmpegRuntimeLinker::Link()
|
|||||||
if (Bind(lib)) {
|
if (Bind(lib)) {
|
||||||
sLib = lib;
|
sLib = lib;
|
||||||
sLinkStatus = LinkStatus_SUCCEEDED;
|
sLinkStatus = LinkStatus_SUCCEEDED;
|
||||||
|
NS_WARNING("FFmpeg successfully linked to TenFourFox");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// Shouldn't happen but if it does then we try the next lib..
|
// Shouldn't happen but if it does then we try the next lib..
|
||||||
@ -119,6 +146,7 @@ FFmpegRuntimeLinker::Link()
|
|||||||
|
|
||||||
Unlink();
|
Unlink();
|
||||||
|
|
||||||
|
fprintf(stderr, "Warning: FFmpeg could not be linked into TenFourFox. H.264 video will not be available.\n");
|
||||||
sLinkStatus = LinkStatus_FAILED;
|
sLinkStatus = LinkStatus_FAILED;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -232,6 +260,7 @@ FFmpegRuntimeLinker::Unlink()
|
|||||||
{
|
{
|
||||||
if (sLinkedLib) {
|
if (sLinkedLib) {
|
||||||
#ifdef XP_DARWIN
|
#ifdef XP_DARWIN
|
||||||
|
NS_WARNING("FFmpeg Runtime unlinked");
|
||||||
dlclose(sLinkedLib);
|
dlclose(sLinkedLib);
|
||||||
#else
|
#else
|
||||||
PR_UnloadLibrary(sLinkedLib);
|
PR_UnloadLibrary(sLinkedLib);
|
||||||
|
@ -38,6 +38,7 @@
|
|||||||
|
|
||||||
#include "nsXPCOM.h"
|
#include "nsXPCOM.h"
|
||||||
#include "nsApplescriptService.h"
|
#include "nsApplescriptService.h"
|
||||||
|
#include "nsString.h"
|
||||||
|
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
#include "MacScripting.h"
|
#include "MacScripting.h"
|
||||||
@ -167,7 +168,7 @@ nsApplescriptService::RunScriptInTabAtIndexInWindow(uint32_t index,
|
|||||||
return tabCallback->RunScriptInTabAtIndexInWindow(index, window_index, script, result, ok);
|
return tabCallback->RunScriptInTabAtIndexInWindow(index, window_index, script, result, ok);
|
||||||
}
|
}
|
||||||
*ok = false;
|
*ok = false;
|
||||||
result = NULL;
|
result.Truncate();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user