From 9e1742f3c36fe26e623f10cb492b8024763e00f4 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 2 Jul 2014 11:02:11 -0700 Subject: [PATCH 01/94] Bug 1033253 - Null-check the result of JS_GetFunctionId. r=bz --- js/xpconnect/tests/unit/test_bug1033253.js | 6 ++++++ js/xpconnect/tests/unit/xpcshell.ini | 1 + js/xpconnect/wrappers/XrayWrapper.cpp | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 js/xpconnect/tests/unit/test_bug1033253.js diff --git a/js/xpconnect/tests/unit/test_bug1033253.js b/js/xpconnect/tests/unit/test_bug1033253.js new file mode 100644 index 000000000000..9bae251ba95d --- /dev/null +++ b/js/xpconnect/tests/unit/test_bug1033253.js @@ -0,0 +1,6 @@ +const Cu = Components.utils; +function run_test() { + var sb = Cu.Sandbox('http://www.example.com'); + var f = Cu.evalInSandbox('var f = function() {}; f;', sb); + do_check_eq(f.name, ""); +} diff --git a/js/xpconnect/tests/unit/xpcshell.ini b/js/xpconnect/tests/unit/xpcshell.ini index 422d58c5d17f..4131ca31820e 100644 --- a/js/xpconnect/tests/unit/xpcshell.ini +++ b/js/xpconnect/tests/unit/xpcshell.ini @@ -43,6 +43,7 @@ support-files = [test_bug976151.js] [test_bug1001094.js] [test_bug1021312.js] +[test_bug1033253.js] [test_bug_442086.js] [test_file.js] [test_blob.js] diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 68d660f6669b..304508156ccf 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -575,8 +575,9 @@ JSXrayTraits::resolveOwnProperty(JSContext *cx, const Wrapper &jsWrapper, NumberValue(JS_GetFunctionArity(JS_GetObjectFunction(target)))); return true; } else if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_NAME)) { + RootedString fname(cx, JS_GetFunctionId(JS_GetObjectFunction(target))); FillPropertyDescriptor(desc, wrapper, JSPROP_PERMANENT | JSPROP_READONLY, - StringValue(JS_GetFunctionId(JS_GetObjectFunction(target)))); + fname ? StringValue(fname) : JS_GetEmptyStringValue(cx)); } else if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_PROTOTYPE)) { // Handle the 'prototype' property to make xrayedGlobal.StandardClass.prototype work. JSProtoKey standardConstructor = constructorFor(holder); From 80e2e520b33382e820dedff3086a9654b59e78ed Mon Sep 17 00:00:00 2001 From: David Keeler Date: Wed, 2 Jul 2014 10:04:31 -0700 Subject: [PATCH 02/94] bug 1019770 - follow-up to remove unused const GENERALIZED_TIME_LENGTH r=briansmith --- security/pkix/test/gtest/pkixder_universal_types_tests.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/security/pkix/test/gtest/pkixder_universal_types_tests.cpp b/security/pkix/test/gtest/pkixder_universal_types_tests.cpp index 7f6d4bce7b79..e7c9ddf178b1 100644 --- a/security/pkix/test/gtest/pkixder_universal_types_tests.cpp +++ b/security/pkix/test/gtest/pkixder_universal_types_tests.cpp @@ -356,8 +356,6 @@ static const uint16_t GT_VALUE_OFFSET = 2; // and the first two digits of the year. static const uint16_t UTC_VALUE_OFFSET = 4; -static const uint16_t GENERALIZED_TIME_LENGTH = 17; // tvYYYYMMDDHHMMSSZ - template void ExpectGoodTime(PRTime expectedValue, From e10417743efdaebfa16871fa7d5a6c8d6cd50e0d Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Wed, 2 Jul 2014 11:22:40 -0700 Subject: [PATCH 03/94] Bug 956961 - FileDescriptorToFILE should always use its input. r=bent --HG-- extra : amend_source : 60d5d0ca9a9dd57c66e7a250f6f8604820357131 --- ipc/glue/FileDescriptorUtils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipc/glue/FileDescriptorUtils.cpp b/ipc/glue/FileDescriptorUtils.cpp index 590b91e658e2..409ca73230e3 100644 --- a/ipc/glue/FileDescriptorUtils.cpp +++ b/ipc/glue/FileDescriptorUtils.cpp @@ -91,11 +91,13 @@ FILE* FileDescriptorToFILE(const FileDescriptor& aDesc, const char* aOpenMode) { + // Debug builds check whether the handle was "used", even if it's + // invalid, so that needs to happen first. + FileDescriptor::PlatformHandleType handle = aDesc.PlatformHandle(); if (!aDesc.IsValid()) { errno = EBADF; return nullptr; } - FileDescriptor::PlatformHandleType handle = aDesc.PlatformHandle(); #ifdef XP_WIN int fd = _open_osfhandle(reinterpret_cast(handle), 0); if (fd == -1) { From adc6a05bd136b3145757db609266e91b9820252e Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Wed, 2 Jul 2014 11:27:48 -0700 Subject: [PATCH 04/94] Bug 956961 - Open content processes' DMD log files in the parent process. r=njn --- dom/ipc/ContentChild.cpp | 17 ++++++----- dom/ipc/ContentChild.h | 4 +-- dom/ipc/ContentParent.cpp | 20 +++++++++++-- dom/ipc/ContentParent.h | 2 +- dom/ipc/PContent.ipdl | 2 +- xpcom/base/nsGZFileWriter.cpp | 9 ++++-- xpcom/base/nsIGZFileWriter.idl | 10 ++++++- xpcom/base/nsIMemoryReporter.idl | 13 ++++---- xpcom/base/nsMemoryInfoDumper.cpp | 41 ++++++++++++++++++++------ xpcom/base/nsMemoryInfoDumper.h | 8 +++++ xpcom/base/nsMemoryReporterManager.cpp | 23 +++++++++++---- 11 files changed, 111 insertions(+), 38 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index e01be71c85dc..29b40df5f774 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -59,6 +59,7 @@ #include "nsIMutable.h" #include "nsIObserverService.h" #include "nsIScriptSecurityManager.h" +#include "nsMemoryInfoDumper.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" #include "nsXULAppAPI.h" @@ -192,22 +193,22 @@ public: NS_DECL_ISUPPORTS MemoryReportRequestChild(uint32_t aGeneration, bool aAnonymize, - const nsAString& aDMDDumpIdent); + const FileDescriptor& aDMDFile); NS_IMETHOD Run(); private: virtual ~MemoryReportRequestChild(); uint32_t mGeneration; bool mAnonymize; - nsString mDMDDumpIdent; + FileDescriptor mDMDFile; }; NS_IMPL_ISUPPORTS(MemoryReportRequestChild, nsIRunnable) MemoryReportRequestChild::MemoryReportRequestChild( - uint32_t aGeneration, bool aAnonymize, const nsAString& aDMDDumpIdent) + uint32_t aGeneration, bool aAnonymize, const FileDescriptor& aDMDFile) : mGeneration(aGeneration), mAnonymize(aAnonymize), - mDMDDumpIdent(aDMDDumpIdent) + mDMDFile(aDMDFile) { MOZ_COUNT_CTOR(MemoryReportRequestChild); } @@ -692,10 +693,10 @@ PMemoryReportRequestChild* ContentChild::AllocPMemoryReportRequestChild(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString& aDMDDumpIdent) + const FileDescriptor& aDMDFile) { MemoryReportRequestChild *actor = - new MemoryReportRequestChild(aGeneration, aAnonymize, aDMDDumpIdent); + new MemoryReportRequestChild(aGeneration, aAnonymize, aDMDFile); actor->AddRef(); return actor; } @@ -750,7 +751,7 @@ ContentChild::RecvPMemoryReportRequestConstructor( const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, - const nsString& aDMDDumpIdent) + const FileDescriptor& aDMDFile) { MemoryReportRequestChild *actor = static_cast(aChild); @@ -784,7 +785,7 @@ NS_IMETHODIMP MemoryReportRequestChild::Run() new MemoryReportsWrapper(&reports); nsRefPtr cb = new MemoryReportCallback(process); mgr->GetReportsForThisProcessExtended(cb, wrappedReports, mAnonymize, - mDMDDumpIdent); + FileDescriptorToFILE(mDMDFile, "wb")); bool sent = Send__delete__(this, mGeneration, reports); return sent ? NS_OK : NS_ERROR_FAILURE; diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index a97e1dc11ac6..3db0d5983668 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -155,7 +155,7 @@ public: AllocPMemoryReportRequestChild(const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, - const nsString& aDMDDumpIdent) MOZ_OVERRIDE; + const FileDescriptor& aDMDFile) MOZ_OVERRIDE; virtual bool DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor) MOZ_OVERRIDE; @@ -164,7 +164,7 @@ public: const uint32_t& aGeneration, const bool& aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString &aDMDDumpIdent) MOZ_OVERRIDE; + const FileDescriptor &aDMDFile) MOZ_OVERRIDE; virtual PCycleCollectWithLogsChild* AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces, diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 822f1f9e1cd2..136e326444fb 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -103,6 +103,7 @@ #include "nsIURIFixup.h" #include "nsIWindowWatcher.h" #include "nsIXULRuntime.h" +#include "nsMemoryInfoDumper.h" #include "nsMemoryReporterManager.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" @@ -2457,9 +2458,22 @@ ContentParent::Observe(nsISupports* aSubject, // The pre-%n part of the string should be all ASCII, so the byte // offset in identOffset should be correct as a char offset. MOZ_ASSERT(cmsg[identOffset - 1] == '='); + FileDescriptor dmdFileDesc; +#ifdef MOZ_DMD + FILE *dmdFile; + nsAutoString dmdIdent(Substring(msg, identOffset)); + nsresult rv = nsMemoryInfoDumper::OpenDMDFile(dmdIdent, Pid(), &dmdFile); + if (NS_WARN_IF(NS_FAILED(rv))) { + // Proceed with the memory report as if DMD were disabled. + dmdFile = nullptr; + } + if (dmdFile) { + dmdFileDesc = FILEToFileDescriptor(dmdFile); + fclose(dmdFile); + } +#endif unused << SendPMemoryReportRequestConstructor( - generation, anonymize, minimize, - nsString(Substring(msg, identOffset))); + generation, anonymize, minimize, dmdFileDesc); } } else if (!strcmp(aTopic, "child-gc-request")){ @@ -2804,7 +2818,7 @@ PMemoryReportRequestParent* ContentParent::AllocPMemoryReportRequestParent(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString &aDMDDumpIdent) + const FileDescriptor &aDMDFile) { MemoryReportRequestParent* parent = new MemoryReportRequestParent(); return parent; diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 6c08a5787b61..c074f9191e35 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -422,7 +422,7 @@ private: AllocPMemoryReportRequestParent(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString &aDMDDumpIdent) MOZ_OVERRIDE; + const FileDescriptor &aDMDFile) MOZ_OVERRIDE; virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) MOZ_OVERRIDE; virtual PCycleCollectWithLogsParent* diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index c073b68c72e4..bd85b0986b77 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -352,7 +352,7 @@ child: async SetProcessSandbox(); PMemoryReportRequest(uint32_t generation, bool anonymize, - bool minimizeMemoryUsage, nsString DMDDumpIdent); + bool minimizeMemoryUsage, FileDescriptor DMDFile); /** * Notify the AudioChannelService in the child processes. diff --git a/xpcom/base/nsGZFileWriter.cpp b/xpcom/base/nsGZFileWriter.cpp index 92a02535c5c1..29bc8608a435 100644 --- a/xpcom/base/nsGZFileWriter.cpp +++ b/xpcom/base/nsGZFileWriter.cpp @@ -47,9 +47,14 @@ nsGZFileWriter::Init(nsIFile* aFile) if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } + return InitANSIFileDesc(file); +} - mGZFile = gzdopen(dup(fileno(file)), "wb"); - fclose(file); +NS_IMETHODIMP +nsGZFileWriter::InitANSIFileDesc(FILE* aFile) +{ + mGZFile = gzdopen(dup(fileno(aFile)), "wb"); + fclose(aFile); // gzdopen returns nullptr on error. if (NS_WARN_IF(!mGZFile)) { diff --git a/xpcom/base/nsIGZFileWriter.idl b/xpcom/base/nsIGZFileWriter.idl index cff1fe949fd1..70898e9e2897 100644 --- a/xpcom/base/nsIGZFileWriter.idl +++ b/xpcom/base/nsIGZFileWriter.idl @@ -8,9 +8,11 @@ %{C++ #include "nsDependentString.h" +#include %} interface nsIFile; +[ptr] native FILE(FILE); /** * A simple interface for writing to a .gz file. @@ -22,7 +24,7 @@ interface nsIFile; * The standard gunzip tool cannot decompress a raw gzip stream, but can handle * the files produced by this interface. */ -[scriptable, uuid(a256f26a-c603-459e-b5a4-53b4877f2cd8)] +[scriptable, uuid(6bd5642c-1b90-4499-ba4b-199f27efaba5)] interface nsIGZFileWriter : nsISupports { /** @@ -34,6 +36,12 @@ interface nsIGZFileWriter : nsISupports */ void init(in nsIFile file); + /** + * Alternate version of init() for use when the file is already opened; + * e.g., with a FileDescriptor passed over IPC. + */ + [noscript] void initANSIFileDesc(in FILE file); + /** * Write the given string to the file. */ diff --git a/xpcom/base/nsIMemoryReporter.idl b/xpcom/base/nsIMemoryReporter.idl index c9bfbd6aba18..2c40fac11c5e 100644 --- a/xpcom/base/nsIMemoryReporter.idl +++ b/xpcom/base/nsIMemoryReporter.idl @@ -5,10 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" +%{C++ +#include +%} interface nsIDOMWindow; interface nsIRunnable; interface nsISimpleEnumerator; +[ptr] native FILE(FILE); /* * Memory reporters measure Firefox's memory usage. They are primarily used to @@ -201,7 +205,7 @@ interface nsIFinishReportingCallback : nsISupports void callback(in nsISupports data); }; -[scriptable, builtinclass, uuid(c27f8662-a0b7-45b3-8207-14d66b02b9c5)] +[scriptable, builtinclass, uuid(51e17609-e98a-47cc-9f95-095ef3c3823e)] interface nsIMemoryReporterManager : nsISupports { /* @@ -294,15 +298,14 @@ interface nsIMemoryReporterManager : nsISupports in boolean anonymize); /* - * As above, but if DMD is enabled and |DMDDumpIdent| is non-empty - * then write a DMD report to a file in the usual temporary directory (see - * |dumpMemoryInfoToTempDir| in |nsIMemoryInfoDumper|.) + * As above, but if DMD is enabled and |DMDFile| is non-null then + * write a DMD report to that file and close it. */ [noscript] void getReportsForThisProcessExtended(in nsIMemoryReporterCallback handleReport, in nsISupports handleReportData, in boolean anonymize, - in AString DMDDumpIdent); + in FILE DMDFile); /* * The memory reporter manager, for the most part, treats reporters diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 0491e50a4137..0eacc7dbc9ae 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -508,12 +508,12 @@ NS_IMPL_ISUPPORTS(DumpReportCallback, nsIHandleReportCallback) static void MakeFilename(const char* aPrefix, const nsAString& aIdentifier, - const char* aSuffix, nsACString& aResult) + int aPid, const char* aSuffix, nsACString& aResult) { aResult = nsPrintfCString("%s-%s-%d.%s", aPrefix, NS_ConvertUTF16toUTF8(aIdentifier).get(), - getpid(), aSuffix); + aPid, aSuffix); } #ifdef MOZ_DMD @@ -633,7 +633,8 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, // each process as was the case before bug 946407. This is so that // the get_about_memory.py script in the B2G repository can // determine when it's done waiting for files to appear. - MakeFilename("unified-memory-report", identifier, "json.gz", mrFilename); + MakeFilename("unified-memory-report", identifier, getpid(), "json.gz", + mrFilename); nsCOMPtr mrTmpFile; nsresult rv; @@ -676,24 +677,25 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, #ifdef MOZ_DMD nsresult -nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) +nsMemoryInfoDumper::OpenDMDFile(const nsAString& aIdentifier, int aPid, + FILE** aOutFile) { if (!dmd::IsRunning()) { + *aOutFile = nullptr; return NS_OK; } - nsresult rv; - // Create a filename like dmd--.txt.gz, which will be used // if DMD is enabled. nsCString dmdFilename; - MakeFilename("dmd", aIdentifier, "txt.gz", dmdFilename); + MakeFilename("dmd", aIdentifier, aPid, "txt.gz", dmdFilename); // Open a new DMD file named |dmdFilename| in NS_OS_TEMP_DIR for writing, // and dump DMD output to it. This must occur after the memory reporters // have been run (above), but before the memory-reports file has been // renamed (so scripts can detect the DMD file, if present). + nsresult rv; nsCOMPtr dmdFile; rv = nsDumpUtils::OpenTempFile(dmdFilename, getter_AddRefs(dmdFile), @@ -701,15 +703,21 @@ nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } + rv = dmdFile->OpenANSIFileDesc("wb", aOutFile); + NS_WARN_IF(NS_FAILED(rv)); + return rv; +} +nsresult +nsMemoryInfoDumper::DumpDMDToFile(FILE* aFile) +{ nsRefPtr dmdWriter = new nsGZFileWriter(); - rv = dmdWriter->Init(dmdFile); + nsresult rv = dmdWriter->InitANSIFileDesc(aFile); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } // Dump DMD output to the file. - DMDWriteState state(dmdWriter); dmd::Writer w(DMDWrite, &state); dmd::Dump(w); @@ -718,6 +726,21 @@ nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) NS_WARN_IF(NS_FAILED(rv)); return rv; } + +nsresult +nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) +{ + nsresult rv; + FILE* dmdFile; + rv = OpenDMDFile(aIdentifier, getpid(), &dmdFile); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + if (!dmdFile) { + return NS_OK; + } + return DumpDMDToFile(dmdFile); +} #endif // MOZ_DMD NS_IMETHODIMP diff --git a/xpcom/base/nsMemoryInfoDumper.h b/xpcom/base/nsMemoryInfoDumper.h index ad6b0394ff9f..b77602df5699 100644 --- a/xpcom/base/nsMemoryInfoDumper.h +++ b/xpcom/base/nsMemoryInfoDumper.h @@ -8,6 +8,7 @@ #define mozilla_nsMemoryInfoDumper_h #include "nsIMemoryInfoDumper.h" +#include class nsACString; @@ -31,7 +32,14 @@ public: static void Initialize(); #ifdef MOZ_DMD + // Write a DMD report. static nsresult DumpDMD(const nsAString& aIdentifier); + // Open an appropriately named file for a DMD report. If DMD is + // disabled, return a null FILE* instead. + static nsresult OpenDMDFile(const nsAString& aIdentifier, int aPid, + FILE** aOutFile); + // Write a DMD report to the given file and close it. + static nsresult DumpDMDToFile(FILE* aFile); #endif }; diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 63cd7da1fb7a..ef09084f7430 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1104,8 +1104,17 @@ nsMemoryReporterManager::StartGettingReports() GetReportsState* s = mGetReportsState; // Get reports for this process. + FILE *parentDMDFile = nullptr; +#ifdef MOZ_DMD + nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(), + &parentDMDFile); + if (NS_WARN_IF(NS_FAILED(rv))) { + // Proceed with the memory report as if DMD were disabled. + parentDMDFile = nullptr; + } +#endif GetReportsForThisProcessExtended(s->mHandleReport, s->mHandleReportData, - s->mAnonymize, s->mDMDDumpIdent); + s->mAnonymize, parentDMDFile); s->mParentDone = true; // If there are no remaining child processes, we can finish up immediately. @@ -1138,13 +1147,13 @@ nsMemoryReporterManager::GetReportsForThisProcess( nsISupports* aHandleReportData, bool aAnonymize) { return GetReportsForThisProcessExtended(aHandleReport, aHandleReportData, - aAnonymize, nsString()); + aAnonymize, nullptr); } NS_IMETHODIMP nsMemoryReporterManager::GetReportsForThisProcessExtended( nsIHandleReportCallback* aHandleReport, nsISupports* aHandleReportData, - bool aAnonymize, const nsAString& aDMDDumpIdent) + bool aAnonymize, FILE* aDMDFile) { // Memory reporters are not necessarily threadsafe, so this function must // be called from the main thread. @@ -1153,11 +1162,13 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( } #ifdef MOZ_DMD - if (!aDMDDumpIdent.IsEmpty()) { + if (aDMDFile) { // Clear DMD's reportedness state before running the memory // reporters, to avoid spurious twice-reported warnings. dmd::ClearReports(); } +#else + MOZ_ASSERT(!aDMDFile); #endif MemoryReporterArray allReporters; @@ -1172,8 +1183,8 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( } #ifdef MOZ_DMD - if (!aDMDDumpIdent.IsEmpty()) { - return nsMemoryInfoDumper::DumpDMD(aDMDDumpIdent); + if (aDMDFile) { + return nsMemoryInfoDumper::DumpDMDToFile(aDMDFile); } #endif From 1ef012aafb8a7c4fdec53fedff8f985cab29d144 Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Wed, 2 Jul 2014 11:28:48 -0700 Subject: [PATCH 05/94] Bug 956961 - Stop disabling sandboxing when DMD is enabled. r=kang --HG-- extra : amend_source : 66f2453794e6a8a581e1564e786cfc8cac1f6bbd --- security/sandbox/linux/Sandbox.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/security/sandbox/linux/Sandbox.cpp b/security/sandbox/linux/Sandbox.cpp index 1b60e549362c..bde6268f38eb 100644 --- a/security/sandbox/linux/Sandbox.cpp +++ b/security/sandbox/linux/Sandbox.cpp @@ -211,15 +211,6 @@ InstallSyscallReporter(void) static int InstallSyscallFilter(const sock_fprog *prog) { -#ifdef MOZ_DMD - char* e = PR_GetEnv("DMD"); - if (e && strcmp(e, "") != 0 && strcmp(e, "0") != 0) { - LOG_ERROR("SANDBOX DISABLED FOR DMD! See bug 956961."); - // Must treat this as "failure" in order to prevent infinite loop; - // cf. the PR_GET_SECCOMP check below. - return 1; - } -#endif if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { return 1; } From a11c39b680b28df36e68c245de4cdb1f4f8bf37b Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 2 Jul 2014 14:34:58 -0400 Subject: [PATCH 06/94] Bug 1033457 - Use HAVE_SEH_EXCEPTIONS in order to use SEH exceptions in libjar; r=bsmedberg --- modules/libjar/nsZipArchive.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/libjar/nsZipArchive.h b/modules/libjar/nsZipArchive.h index dcccbc242d62..3e2a829b68a5 100644 --- a/modules/libjar/nsZipArchive.h +++ b/modules/libjar/nsZipArchive.h @@ -20,7 +20,7 @@ #include "mozilla/FileUtils.h" #include "mozilla/FileLocation.h" -#if defined(XP_WIN) && defined(_MSC_VER) +#ifdef HAVE_SEH_EXCEPTIONS #define MOZ_WIN_MEM_TRY_BEGIN __try { #define MOZ_WIN_MEM_TRY_CATCH(cmd) } \ __except(GetExceptionCode()==EXCEPTION_IN_PAGE_ERROR ? \ From cf5830570741e75ec85589eeca13eff78b05873a Mon Sep 17 00:00:00 2001 From: Monica Chew Date: Wed, 2 Jul 2014 11:34:04 -0700 Subject: [PATCH 07/94] Bug 1012875: Expire pins in 8 weeks once they reach stable (r=keeler) --- security/manager/boot/src/StaticHPKPins.h | 2 +- security/manager/tools/genHPKPStaticPins.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/security/manager/boot/src/StaticHPKPins.h b/security/manager/boot/src/StaticHPKPins.h index 7179b25b655a..425abf1917d5 100644 --- a/security/manager/boot/src/StaticHPKPins.h +++ b/security/manager/boot/src/StaticHPKPins.h @@ -998,4 +998,4 @@ static const int kPublicKeyPinningPreloadListLength = 322; static const int32_t kUnknownId = -1; -static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1414009276397000); +static const PRTime kPreloadPKPinsExpirationTime = INT64_C(1412793196147000); diff --git a/security/manager/tools/genHPKPStaticPins.js b/security/manager/tools/genHPKPStaticPins.js index 583c117ac726..04625e4f41b3 100644 --- a/security/manager/tools/genHPKPStaticPins.js +++ b/security/manager/tools/genHPKPStaticPins.js @@ -33,8 +33,8 @@ const SHA1_PREFIX = "sha1/"; const SHA256_PREFIX = "sha256/"; const GOOGLE_PIN_PREFIX = "GOOGLE_PIN_"; -// Pins expire in 18 weeks -const PINNING_MINIMUM_REQUIRED_MAX_AGE = 60 * 60 * 24 * 7 * 18; +// Pins expire in 14 weeks (6 weeks on Beta + 8 weeks on stable) +const PINNING_MINIMUM_REQUIRED_MAX_AGE = 60 * 60 * 24 * 7 * 14; const FILE_HEADER = "/* This Source Code Form is subject to the terms of the Mozilla Public\n" + " * License, v. 2.0. If a copy of the MPL was not distributed with this\n" + From 01347cdb2b7f0951b7c5699bbd49eebd05cd0f68 Mon Sep 17 00:00:00 2001 From: Daniel Holbert Date: Wed, 2 Jul 2014 11:37:44 -0700 Subject: [PATCH 08/94] Bug 1033539: Move GK_ATOM line for 'onstart' out of #ifdeffed section, to fix build error in --disable-webspeech builds. r=khuey --- content/base/src/nsGkAtomList.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index af0601eb039b..7260db9f9cc3 100644 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -1974,6 +1974,7 @@ GK_ATOM(durationchange, "durationchange") GK_ATOM(volumechange, "volumechange") GK_ATOM(ondataavailable, "ondataavailable") GK_ATOM(onwarning, "onwarning") +GK_ATOM(onstart, "onstart") GK_ATOM(onstop, "onstop") #ifdef MOZ_GAMEPAD GK_ATOM(ongamepadbuttondown, "ongamepadbuttondown") @@ -2261,7 +2262,6 @@ GK_ATOM(onspeechstart, "onspeechstart") GK_ATOM(onspeechend, "onspeechend") GK_ATOM(onresult, "onresult") GK_ATOM(onnomatch, "onnomatch") -GK_ATOM(onstart, "onstart") GK_ATOM(onresume, "onresume") GK_ATOM(onmark, "onmark") GK_ATOM(onboundary, "onboundary") From 799cac35546ea2ec17757e12a66ba20c12cef50f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 2 Jul 2014 15:16:42 -0400 Subject: [PATCH 09/94] Bug 1033157. Move the setup of the JSRuntime DOM callbacks into the CycleCollectedJSRuntime constructor, so we don't have to separatedly do it for workers, windows, and xpcshell. r=khuey --- dom/base/nsJSEnvironment.cpp | 5 ----- dom/workers/RuntimeService.cpp | 6 ------ xpcom/base/CycleCollectedJSRuntime.cpp | 5 +++++ 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 214e2cce69e1..bfbf58bcb141 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -2951,11 +2951,6 @@ nsJSContext::EnsureStatics() }; JS_SetStructuredCloneCallbacks(sRuntime, &cloneCallbacks); - static js::DOMCallbacks DOMcallbacks = { - InstanceClassHasProtoAtDepth - }; - SetDOMCallbacks(sRuntime, &DOMcallbacks); - // Set up the asm.js cache callbacks static JS::AsmJSCacheOps asmJSCacheOps = { AsmJSCacheOpenEntryForRead, diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index b4071518ef9e..ee4a52dadf72 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -802,12 +802,6 @@ CreateJSContextForWorker(WorkerPrivate* aWorkerPrivate, JSRuntime* aRuntime) }; JS_SetSecurityCallbacks(aRuntime, &securityCallbacks); - // DOM helpers: - static js::DOMCallbacks DOMCallbacks = { - InstanceClassHasProtoAtDepth - }; - SetDOMCallbacks(aRuntime, &DOMCallbacks); - // Set up the asm.js cache callbacks static JS::AsmJSCacheOps asmJSCacheOps = { AsmJSCacheOpenEntryForRead, diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 7d5f60bc8abb..18d7fc1f85b3 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -492,6 +492,11 @@ CycleCollectedJSRuntime::CycleCollectedJSRuntime(JSRuntime* aParentRuntime, JS_SetDestroyZoneCallback(mJSRuntime, XPCStringConvert::FreeZoneCache); JS_SetSweepZoneCallback(mJSRuntime, XPCStringConvert::ClearZoneCache); + static js::DOMCallbacks DOMcallbacks = { + InstanceClassHasProtoAtDepth + }; + SetDOMCallbacks(mJSRuntime, &DOMcallbacks); + nsCycleCollector_registerJSRuntime(this); } From a5a20896ce80ffebb7f8780c01ac5abf8b2d0b30 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Wed, 2 Jul 2014 15:16:43 -0400 Subject: [PATCH 10/94] Bug 1033100. Fix event codegen to compile when an event has a sequence-of-non-null-interface-type member. r=smaug --- dom/bindings/Codegen.py | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index b0be05870109..dd360cd5fe1e 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -13799,7 +13799,27 @@ class CGEventMethod(CGNativeMember): cgClass.descriptor.interface).identifier.name == "Event": continue name = CGDictionary.makeMemberName(m.identifier.name) - members += "e->%s = %s.%s;\n" % (name, self.args[1].name, name) + if m.type.isSequence(): + # For sequences we may not be able to do a simple + # assignment because the underlying types may not match. + # For example, the argument can be a + # Sequence> while our + # member is an nsTArray>. So + # use AppendElements, which is actually a template on + # the incoming type on nsTArray and does the right thing + # for this case. + target = name; + source = "%s.%s" % (self.args[1].name, name) + sequenceCopy = "e->%s.AppendElements(%s);\n" + if m.type.nullable(): + sequenceCopy = CGIfWrapper( + CGGeneric(sequenceCopy), + "!%s.IsNull()" % source).define() + target += ".SetValue()" + source += ".Value()" + members += sequenceCopy % (target, source) + else: + members += "e->%s = %s.%s;\n" % (name, self.args[1].name, name) if m.type.isAny() or m.type.isObject() or m.type.isSpiderMonkeyInterface(): holdJS = "mozilla::HoldJSObjects(e.get());\n" iface = iface.parent From 2bd55130fadae8fefac889a5a279f63673704060 Mon Sep 17 00:00:00 2001 From: Chris Pearce Date: Thu, 3 Jul 2014 07:40:38 +1200 Subject: [PATCH 11/94] Bug 1023771 - Use fastSeek() in videocontrols only on B2G, not on all touch controls. r=blassey --- toolkit/content/widgets/videocontrols.xml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/toolkit/content/widgets/videocontrols.xml b/toolkit/content/widgets/videocontrols.xml index fd6993758eeb..a9567ca1dc95 100644 --- a/toolkit/content/widgets/videocontrols.xml +++ b/toolkit/content/widgets/videocontrols.xml @@ -796,11 +796,14 @@ seekToPosition : function(newPosition) { newPosition /= 1000; // convert from ms this.log("+++ seeking to " + newPosition); - if (isTouchControl) { - this.video.fastSeek(newPosition); - } else { - this.video.currentTime = newPosition; - } +#ifdef MOZ_WIDGET_GONK + // We use fastSeek() on B2G, and an accurate (but slower) + // seek on other platforms (that are likely to be higher + // perf). + this.video.fastSeek(newPosition); +#else + this.video.currentTime = newPosition; +#endif }, setVolume : function(newVolume) { From 1ce06a339916ec30cda7789f45bf3abafa6cc33d Mon Sep 17 00:00:00 2001 From: Monica Chew Date: Wed, 2 Jul 2014 12:41:00 -0700 Subject: [PATCH 12/94] Bug 1024610: Register tracking protection list and hook it up in nsChannelClassifier (r=gcp) --- .../safebrowsing/content/test/head.js | 4 +- modules/libpref/src/init/all.js | 14 +++- .../url-classifier/SafeBrowsing.jsm | 24 ++++++- .../nsUrlClassifierDBService.cpp | 64 +++++++++++++------ .../url-classifier/nsUrlClassifierDBService.h | 4 ++ .../tests/mochitest/test_classifier.html | 4 +- .../mochitest/test_classifier_worker.html | 4 +- xpcom/base/ErrorList.h | 1 + 8 files changed, 89 insertions(+), 30 deletions(-) diff --git a/browser/components/safebrowsing/content/test/head.js b/browser/components/safebrowsing/content/test/head.js index b3e288ae397f..886eff5ab245 100644 --- a/browser/components/safebrowsing/content/test/head.js +++ b/browser/components/safebrowsing/content/test/head.js @@ -1,5 +1,5 @@ // Force SafeBrowsing to be initialized for the tests -Services.prefs.setCharPref("urlclassifier.malware_table", "test-malware-simple"); -Services.prefs.setCharPref("urlclassifier.phish_table", "test-phish-simple"); +Services.prefs.setCharPref("urlclassifier.malwareTable", "test-malware-simple"); +Services.prefs.setCharPref("urlclassifier.phishTable", "test-phish-simple"); SafeBrowsing.init(); diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 19360688d010..cbb017a34691 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -819,6 +819,8 @@ pref("privacy.donottrackheader.enabled", false); // 0 = tracking is acceptable // 1 = tracking is unacceptable pref("privacy.donottrackheader.value", 1); +// Enforce tracking protection +pref("privacy.trackingprotection.enabled", false); pref("dom.event.contextmenu.enabled", true); pref("dom.event.clipboardevents.enabled", true); @@ -4187,11 +4189,17 @@ pref("dom.voicemail.defaultServiceId", 0); pref("dom.inter-app-communication-api.enabled", false); // The tables used for Safebrowsing phishing and malware checks. -pref("urlclassifier.malware_table", "goog-malware-shavar,test-malware-simple"); -pref("urlclassifier.phish_table", "goog-phish-shavar,test-phish-simple"); +pref("urlclassifier.malwareTable", "goog-malware-shavar,test-malware-simple"); +pref("urlclassifier.phishTable", "goog-phish-shavar,test-phish-simple"); pref("urlclassifier.downloadBlockTable", ""); pref("urlclassifier.downloadAllowTable", ""); -pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,goog-downloadwhite-digest256"); +pref("urlclassifier.disallow_completions", "test-malware-simple,test-phish-simple,goog-downloadwhite-digest256,mozpub-track-digest256"); + +// The table and update/gethash URLs for Safebrowsing phishing and malware +// checks. +pref("urlclassifier.trackingTable", "mozpub-track-digest256"); +pref("browser.trackingprotection.updateURL", "https://tracking.services.mozilla.com/update?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2"); +pref("browser.trackingprotection.gethashURL", "https://tracking.services.mozilla.com/gethash?client=SAFEBROWSING_ID&appver=%VERSION%&pver=2.2"); // Turn off Spatial navigation by default. pref("snav.enabled", false); diff --git a/toolkit/components/url-classifier/SafeBrowsing.jsm b/toolkit/components/url-classifier/SafeBrowsing.jsm index eb4f7a53a0c1..998e22116634 100644 --- a/toolkit/components/url-classifier/SafeBrowsing.jsm +++ b/toolkit/components/url-classifier/SafeBrowsing.jsm @@ -24,10 +24,11 @@ function getLists(prefName) { } // These may be a comma-separated lists of tables. -const phishingLists = getLists("urlclassifier.phish_table"); -const malwareLists = getLists("urlclassifier.malware_table"); +const phishingLists = getLists("urlclassifier.phishTable"); +const malwareLists = getLists("urlclassifier.malwareTable"); const downloadBlockLists = getLists("urlclassifier.downloadBlockTable"); const downloadAllowLists = getLists("urlclassifier.downloadAllowTable"); +const trackingProtectionLists = getLists("urlclassifier.trackingTable"); var debug = false; function log(...stuff) { @@ -65,6 +66,11 @@ this.SafeBrowsing = { for (let i = 0; i < downloadAllowLists.length; ++i) { listManager.registerTable(downloadAllowLists[i], this.updateURL, this.gethashURL); } + for (let i = 0; i < trackingProtectionLists.length; ++i) { + listManager.registerTable(trackingProtectionLists[i], + this.trackingUpdateURL, + this.trackingGethashURL); + } this.addMozEntries(); this.controlUpdateChecking(); @@ -99,7 +105,8 @@ this.SafeBrowsing = { debug = Services.prefs.getBoolPref("browser.safebrowsing.debug"); this.phishingEnabled = Services.prefs.getBoolPref("browser.safebrowsing.enabled"); - this.malwareEnabled = Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled"); + this.malwareEnabled = Services.prefs.getBoolPref("browser.safebrowsing.malware.enabled"); + this.trackingEnabled = Services.prefs.getBoolPref("privacy.trackingprotection.enabled"); this.updateProviderURLs(); // XXX The listManager backend gets confused if this is called before the @@ -134,6 +141,10 @@ this.SafeBrowsing = { this.updateURL = this.updateURL.replace("SAFEBROWSING_ID", clientID); this.gethashURL = this.gethashURL.replace("SAFEBROWSING_ID", clientID); + this.trackingUpdateURL = Services.urlFormatter.formatURLPref( + "browser.trackingprotection.updateURL"); + this.trackingGethashURL = Services.urlFormatter.formatURLPref( + "browser.trackingprotection.gethashURL"); }, controlUpdateChecking: function() { @@ -170,6 +181,13 @@ this.SafeBrowsing = { listManager.disableUpdate(downloadAllowLists[i]); } } + for (let i = 0; i < trackingProtectionLists.length; ++i) { + if (this.trackingEnabled) { + listManager.enableUpdate(trackingProtectionLists[i]); + } else { + listManager.disableUpdate(trackingProtectionLists[i]); + } + } }, diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp index fd720fb0972f..11f17ba15060 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.cpp @@ -67,12 +67,16 @@ PRLogModuleInfo *gUrlClassifierDbServiceLog = nullptr; #define CHECK_PHISHING_PREF "browser.safebrowsing.enabled" #define CHECK_PHISHING_DEFAULT false +#define CHECK_TRACKING_PREF "privacy.trackingprotection.enabled" +#define CHECK_TRACKING_DEFAULT false + #define GETHASH_NOISE_PREF "urlclassifier.gethashnoise" #define GETHASH_NOISE_DEFAULT 4 // Comma-separated lists -#define MALWARE_TABLE_PREF "urlclassifier.malware_table" -#define PHISH_TABLE_PREF "urlclassifier.phish_table" +#define MALWARE_TABLE_PREF "urlclassifier.malwareTable" +#define PHISH_TABLE_PREF "urlclassifier.phishTable" +#define TRACKING_TABLE_PREF "urlclassifier.trackingTable" #define DOWNLOAD_BLOCK_TABLE_PREF "urlclassifier.downloadBlockTable" #define DOWNLOAD_ALLOW_TABLE_PREF "urlclassifier.downloadAllowTable" #define DISALLOW_COMPLETION_TABLE_PREF "urlclassifier.disallow_completions" @@ -850,7 +854,8 @@ nsUrlClassifierLookupCallback::LookupComplete(nsTArray* results) } } else { // For tables with no hash completer, a complete hash match is - // good enough, we'll consider it fresh. + // good enough, we'll consider it fresh, even if it hasn't been updated + // in 45 minutes. if (result.Complete()) { result.mFresh = true; } else { @@ -996,10 +1001,12 @@ public: nsUrlClassifierClassifyCallback(nsIURIClassifierCallback *c, bool checkMalware, - bool checkPhishing) + bool checkPhishing, + bool checkTracking) : mCallback(c) , mCheckMalware(checkMalware) , mCheckPhishing(checkPhishing) + , mCheckTracking(checkTracking) {} private: @@ -1008,6 +1015,7 @@ private: nsCOMPtr mCallback; bool mCheckMalware; bool mCheckPhishing; + bool mCheckTracking; }; NS_IMPL_ISUPPORTS(nsUrlClassifierClassifyCallback, @@ -1021,21 +1029,16 @@ nsUrlClassifierClassifyCallback::HandleEvent(const nsACString& tables) // enough information. nsresult response = NS_OK; - nsACString::const_iterator begin, end; - - tables.BeginReading(begin); - tables.EndReading(end); if (mCheckMalware && - FindInReadable(NS_LITERAL_CSTRING("-malware-"), begin, end)) { + FindInReadable(NS_LITERAL_CSTRING("-malware-"), tables)) { response = NS_ERROR_MALWARE_URI; - } else { - // Reset begin before checking phishing table - tables.BeginReading(begin); - - if (mCheckPhishing && - FindInReadable(NS_LITERAL_CSTRING("-phish-"), begin, end)) { - response = NS_ERROR_PHISHING_URI; - } + } else if (mCheckPhishing && + FindInReadable(NS_LITERAL_CSTRING("-phish-"), tables)) { + response = NS_ERROR_PHISHING_URI; + } else if (mCheckTracking && + FindInReadable(NS_LITERAL_CSTRING("-track-"), tables)) { + LOG(("Blocking tracking uri [this=%p]", this)); + response = NS_ERROR_TRACKING_URI; } mCallback->OnClassifyComplete(response); @@ -1081,6 +1084,7 @@ nsUrlClassifierDBService::GetInstance(nsresult *result) nsUrlClassifierDBService::nsUrlClassifierDBService() : mCheckMalware(CHECK_MALWARE_DEFAULT) , mCheckPhishing(CHECK_PHISHING_DEFAULT) + , mCheckTracking(CHECK_TRACKING_DEFAULT) , mInUpdate(false) { } @@ -1115,6 +1119,12 @@ nsUrlClassifierDBService::ReadTablesFromPrefs() allTables.Append(tables); } + Preferences::GetCString(TRACKING_TABLE_PREF, &tables); + if (!tables.IsEmpty()) { + allTables.Append(','); + allTables.Append(tables); + } + Classifier::SplitTables(allTables, mGethashTables); Preferences::GetCString(DISALLOW_COMPLETION_TABLE_PREF, &tables); @@ -1136,6 +1146,8 @@ nsUrlClassifierDBService::Init() CHECK_MALWARE_DEFAULT); mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF, CHECK_PHISHING_DEFAULT); + mCheckTracking = Preferences::GetBool(CHECK_TRACKING_PREF, + CHECK_TRACKING_DEFAULT); uint32_t gethashNoise = Preferences::GetUint(GETHASH_NOISE_PREF, GETHASH_NOISE_DEFAULT); gFreshnessGuarantee = Preferences::GetInt(CONFIRM_AGE_PREF, @@ -1145,10 +1157,12 @@ nsUrlClassifierDBService::Init() // Do we *really* need to be able to change all of these at runtime? Preferences::AddStrongObserver(this, CHECK_MALWARE_PREF); Preferences::AddStrongObserver(this, CHECK_PHISHING_PREF); + Preferences::AddStrongObserver(this, CHECK_TRACKING_PREF); Preferences::AddStrongObserver(this, GETHASH_NOISE_PREF); Preferences::AddStrongObserver(this, CONFIRM_AGE_PREF); Preferences::AddStrongObserver(this, PHISH_TABLE_PREF); Preferences::AddStrongObserver(this, MALWARE_TABLE_PREF); + Preferences::AddStrongObserver(this, TRACKING_TABLE_PREF); Preferences::AddStrongObserver(this, DOWNLOAD_BLOCK_TABLE_PREF); Preferences::AddStrongObserver(this, DOWNLOAD_ALLOW_TABLE_PREF); Preferences::AddStrongObserver(this, DISALLOW_COMPLETION_TABLE_PREF); @@ -1212,7 +1226,8 @@ nsUrlClassifierDBService::Classify(nsIPrincipal* aPrincipal, } nsRefPtr callback = - new nsUrlClassifierClassifyCallback(c, mCheckMalware, mCheckPhishing); + new nsUrlClassifierClassifyCallback(c, mCheckMalware, mCheckPhishing, + mCheckTracking); if (!callback) return NS_ERROR_OUT_OF_MEMORY; nsAutoCString tables; @@ -1228,6 +1243,13 @@ nsUrlClassifierDBService::Classify(nsIPrincipal* aPrincipal, tables.Append(','); tables.Append(phishing); } + nsAutoCString tracking; + Preferences::GetCString(TRACKING_TABLE_PREF, &tracking); + if (!tracking.IsEmpty()) { + LOG(("Looking up in tracking table, [cb=%p]", callback.get())); + tables.Append(','); + tables.Append(tracking); + } nsresult rv = LookupURI(aPrincipal, tables, callback, false, result); if (rv == NS_ERROR_MALFORMED_URI) { *result = false; @@ -1480,9 +1502,13 @@ nsUrlClassifierDBService::Observe(nsISupports *aSubject, const char *aTopic, } else if (NS_LITERAL_STRING(CHECK_PHISHING_PREF).Equals(aData)) { mCheckPhishing = Preferences::GetBool(CHECK_PHISHING_PREF, CHECK_PHISHING_DEFAULT); + } else if (NS_LITERAL_STRING(CHECK_TRACKING_PREF).Equals(aData)) { + mCheckTracking = Preferences::GetBool(CHECK_TRACKING_PREF, + CHECK_TRACKING_DEFAULT); } else if ( NS_LITERAL_STRING(PHISH_TABLE_PREF).Equals(aData) || NS_LITERAL_STRING(MALWARE_TABLE_PREF).Equals(aData) || + NS_LITERAL_STRING(TRACKING_TABLE_PREF).Equals(aData) || NS_LITERAL_STRING(DOWNLOAD_BLOCK_TABLE_PREF).Equals(aData) || NS_LITERAL_STRING(DOWNLOAD_ALLOW_TABLE_PREF).Equals(aData) || NS_LITERAL_STRING(DISALLOW_COMPLETION_TABLE_PREF).Equals(aData)) { @@ -1517,8 +1543,10 @@ nsUrlClassifierDBService::Shutdown() if (prefs) { prefs->RemoveObserver(CHECK_MALWARE_PREF, this); prefs->RemoveObserver(CHECK_PHISHING_PREF, this); + prefs->RemoveObserver(CHECK_TRACKING_PREF, this); prefs->RemoveObserver(PHISH_TABLE_PREF, this); prefs->RemoveObserver(MALWARE_TABLE_PREF, this); + prefs->RemoveObserver(TRACKING_TABLE_PREF, this); prefs->RemoveObserver(DOWNLOAD_BLOCK_TABLE_PREF, this); prefs->RemoveObserver(DOWNLOAD_ALLOW_TABLE_PREF, this); prefs->RemoveObserver(DISALLOW_COMPLETION_TABLE_PREF, this); diff --git a/toolkit/components/url-classifier/nsUrlClassifierDBService.h b/toolkit/components/url-classifier/nsUrlClassifierDBService.h index 6fe2d82ae690..06be18acb74e 100644 --- a/toolkit/components/url-classifier/nsUrlClassifierDBService.h +++ b/toolkit/components/url-classifier/nsUrlClassifierDBService.h @@ -99,6 +99,10 @@ private: // uris on document loads. bool mCheckPhishing; + // TRUE if the nsURIClassifier implementation should check for tracking + // uris on document loads. + bool mCheckTracking; + // TRUE if a BeginUpdate() has been called without an accompanying // CancelUpdate()/FinishUpdate(). This is used to prevent competing // updates, not to determine whether an update is still being diff --git a/toolkit/components/url-classifier/tests/mochitest/test_classifier.html b/toolkit/components/url-classifier/tests/mochitest/test_classifier.html index 13955903a1f6..ecc3359af984 100644 --- a/toolkit/components/url-classifier/tests/mochitest/test_classifier.html +++ b/toolkit/components/url-classifier/tests/mochitest/test_classifier.html @@ -61,8 +61,8 @@ function doUpdate(update) { } SpecialPowers.pushPrefEnv( - {"set" : [["urlclassifier.malware_table", "test-malware-simple"], - ["urlclassifier.phish_table", "test-phish-simple"]]}, + {"set" : [["urlclassifier.malwareTable", "test-malware-simple"], + ["urlclassifier.phishTable", "test-phish-simple"]]}, function() { doUpdate(testUpdate); }); // Expected finish() call is in "classifierFrame.html". diff --git a/toolkit/components/url-classifier/tests/mochitest/test_classifier_worker.html b/toolkit/components/url-classifier/tests/mochitest/test_classifier_worker.html index 2b20fe040d72..22fbc01fc744 100644 --- a/toolkit/components/url-classifier/tests/mochitest/test_classifier_worker.html +++ b/toolkit/components/url-classifier/tests/mochitest/test_classifier_worker.html @@ -73,8 +73,8 @@ function onmessage(event) } SpecialPowers.pushPrefEnv( - {"set" : [["urlclassifier.malware_table", "test-malware-simple"], - ["urlclassifier.phish_table", "test-phish-simple"]]}, + {"set" : [["urlclassifier.malwareTable", "test-malware-simple"], + ["urlclassifier.phishTable", "test-phish-simple"]]}, function() { doUpdate(testUpdate); }); window.addEventListener("message", onmessage, false); diff --git a/xpcom/base/ErrorList.h b/xpcom/base/ErrorList.h index 8df77f218642..7a8ff6a898f0 100644 --- a/xpcom/base/ErrorList.h +++ b/xpcom/base/ErrorList.h @@ -664,6 +664,7 @@ * blacklist. */ ERROR(NS_ERROR_MALWARE_URI, FAILURE(30)), ERROR(NS_ERROR_PHISHING_URI, FAILURE(31)), + ERROR(NS_ERROR_TRACKING_URI, FAILURE(34)), /* Used when "Save Link As..." doesn't see the headers quickly enough to * choose a filename. See nsContextMenu.js. */ ERROR(NS_ERROR_SAVE_LINK_AS_TIMEOUT, FAILURE(32)), From 758f71cb116765907e3b4b75d58b04128e39f1ad Mon Sep 17 00:00:00 2001 From: Bill McCloskey Date: Wed, 2 Jul 2014 13:23:04 -0700 Subject: [PATCH 13/94] Bug 1031608 - Enable CompartmentPerAddon when e10s is enabled at startup (r=bholley) --- js/xpconnect/src/XPCWrappedNativeScope.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/xpconnect/src/XPCWrappedNativeScope.cpp b/js/xpconnect/src/XPCWrappedNativeScope.cpp index e8109ae94beb..1ddd63937fdd 100644 --- a/js/xpconnect/src/XPCWrappedNativeScope.cpp +++ b/js/xpconnect/src/XPCWrappedNativeScope.cpp @@ -193,7 +193,8 @@ CompartmentPerAddon() static bool pref = false; if (!initialized) { - pref = Preferences::GetBool("dom.compartment_per_addon", false); + pref = Preferences::GetBool("dom.compartment_per_addon", false) || + Preferences::GetBool("browser.tabs.remote.autostart", false); initialized = true; } From a250a888b37b52445fe74d3f5d589b4e487578c0 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Wed, 2 Jul 2014 16:38:40 -0400 Subject: [PATCH 14/94] Bug 1027362 - Remove the old basic frame counter. r=jrmuizel --- gfx/layers/basic/BasicLayerManager.cpp | 30 -------------------------- gfx/layers/basic/BasicLayers.h | 2 -- 2 files changed, 32 deletions(-) diff --git a/gfx/layers/basic/BasicLayerManager.cpp b/gfx/layers/basic/BasicLayerManager.cpp index 657b0373a451..dd2919ad8f35 100644 --- a/gfx/layers/basic/BasicLayerManager.cpp +++ b/gfx/layers/basic/BasicLayerManager.cpp @@ -536,35 +536,6 @@ BasicLayerManager::AbortTransaction() mInTransaction = false; } -static uint16_t sFrameCount = 0; -void -BasicLayerManager::RenderDebugOverlay() -{ - if (!gfxPrefs::DrawFrameCounter()) { - return; - } - - profiler_set_frame_number(sFrameCount); - - uint16_t frameNumber = sFrameCount; - const uint16_t bitWidth = 3; - for (size_t i = 0; i < 16; i++) { - - gfxRGBA bitColor; - if ((frameNumber >> i) & 0x1) { - bitColor = gfxRGBA(0, 0, 0, 1.0); - } else { - bitColor = gfxRGBA(1.0, 1.0, 1.0, 1.0); - } - mTarget->NewPath(); - mTarget->SetColor(bitColor); - mTarget->Rectangle(gfxRect(bitWidth*i, 0, bitWidth, bitWidth)); - mTarget->Fill(); - } - // We intentionally overflow at 2^16. - sFrameCount++; -} - bool BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, void* aCallbackData, @@ -637,7 +608,6 @@ BasicLayerManager::EndTransactionInternal(DrawThebesLayerCallback aCallback, if (mWidget) { FlashWidgetUpdateArea(mTarget); } - RenderDebugOverlay(); RecordFrame(); PostPresent(); diff --git a/gfx/layers/basic/BasicLayers.h b/gfx/layers/basic/BasicLayers.h index 0aed5c48e574..b2d789cbb45c 100644 --- a/gfx/layers/basic/BasicLayers.h +++ b/gfx/layers/basic/BasicLayers.h @@ -176,8 +176,6 @@ protected: void FlashWidgetUpdateArea(gfxContext* aContext); - void RenderDebugOverlay(); - // Widget whose surface should be used as the basis for ThebesLayer // buffers. nsIWidget* mWidget; From 875ebd67cabea76a60c6f613757bb014622efdea Mon Sep 17 00:00:00 2001 From: Benoit Jacob Date: Wed, 2 Jul 2014 16:40:29 -0400 Subject: [PATCH 15/94] Bug 1008254 - Allow Nuwa's global sAllThreads list to be non-empty on exit, to green a near-permanent orange on B2G mochitest-9 - r=khuey --- mozglue/build/Nuwa.cpp | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/mozglue/build/Nuwa.cpp b/mozglue/build/Nuwa.cpp index 0f35cd261296..a5996868a694 100644 --- a/mozglue/build/Nuwa.cpp +++ b/mozglue/build/Nuwa.cpp @@ -199,9 +199,47 @@ static TLSKeySet sTLSKeys; static pthread_mutex_t sThreadFreezeLock = PTHREAD_MUTEX_INITIALIZER; static thread_info_t sMainThread; -static LinkedList sAllThreads; static int sThreadCount = 0; static int sThreadFreezeCount = 0; + +// Bug 1008254: LinkedList's destructor asserts that the list is empty. +// But here, on exit, when the global sAllThreads list +// is destroyed, it may or may be empty. Bug 1008254 comment 395 has a log +// when there were 8 threads remaining on exit. So this assertion was +// intermittently (almost every second time) failing. +// As a work-around to avoid this intermittent failure, we clear the list on +// exit just before it gets destroyed. This is the only purpose of that +// AllThreadsListType subclass. +struct AllThreadsListType : public LinkedList +{ + ~AllThreadsListType() + { + if (!isEmpty()) { + __android_log_print(ANDROID_LOG_WARN, "Nuwa", + "Threads remaining at exit:\n"); + int n = 0; + for (const thread_info_t* t = getFirst(); t; t = t->getNext()) { + __android_log_print(ANDROID_LOG_WARN, "Nuwa", + " %.*s (origNativeThreadID=%d recreatedNativeThreadID=%d)\n", + NATIVE_THREAD_NAME_LENGTH, + t->nativeThreadName, + t->origNativeThreadID, + t->recreatedNativeThreadID); + n++; + } + __android_log_print(ANDROID_LOG_WARN, "Nuwa", + "total: %d outstanding threads. " + "Please fix them so they're destroyed before this point!\n", n); + __android_log_print(ANDROID_LOG_WARN, "Nuwa", + "note: sThreadCount=%d, sThreadFreezeCount=%d\n", + sThreadCount, + sThreadFreezeCount); + } + clear(); + } +}; +static AllThreadsListType sAllThreads; + /** * This mutex protects the access to thread info: * sAllThreads, sThreadCount, sThreadFreezeCount, sRecreateVIPCount. From 233eb2e9e38061b03c1e04e4ae5120a476b39623 Mon Sep 17 00:00:00 2001 From: Susanna Bowen Date: Wed, 2 Jul 2014 13:54:49 -0700 Subject: [PATCH 16/94] Bug 1033052 - Call SetRect in ReflowFrame since the old rect does not need to be preserved. r=dbaron --- layout/generic/nsLineLayout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/generic/nsLineLayout.cpp b/layout/generic/nsLineLayout.cpp index a7500e31d536..3194b8e57163 100644 --- a/layout/generic/nsLineLayout.cpp +++ b/layout/generic/nsLineLayout.cpp @@ -965,7 +965,7 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame, pfd->mBounds.BSize(lineWM) = metrics.BSize(lineWM); // Size the frame, but |RelativePositionFrames| will size the view. - aFrame->SetSize(nsSize(metrics.Width(), metrics.Height())); + aFrame->SetRect(lineWM, pfd->mBounds, mContainerWidth); // Tell the frame that we're done reflowing it aFrame->DidReflow(mPresContext, From c5c3855cbb0cc01d6e5d53c0e43326575caf8d7d Mon Sep 17 00:00:00 2001 From: Martin Thomson Date: Wed, 2 Jul 2014 13:56:10 -0700 Subject: [PATCH 17/94] Bug 1032525 - Making isolation dependent on peerIdentity property r=abr --- .../src/peerconnection/PeerConnectionImpl.cpp | 8 +------- .../peerconnection/PeerConnectionMedia.cpp | 19 ++++++++----------- .../src/peerconnection/PeerConnectionMedia.h | 5 ++--- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 596ac8082d23..51219f6cc373 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -1226,13 +1226,7 @@ PeerConnectionImpl::SetLocalDescription(int32_t aAction, const char* aSDP) STAMP_TIMECARD(tc, "Set Local Description"); #ifdef MOZILLA_INTERNAL_API - nsIDocument* doc = GetWindow()->GetExtantDoc(); - bool isolated = true; - if (doc) { - isolated = mMedia->AnyLocalStreamIsolated(doc->NodePrincipal()); - } else { - CSFLogInfo(logTag, "%s - no document, failing safe", __FUNCTION__); - } + bool isolated = mMedia->AnyLocalStreamHasPeerIdentity(); mPrivacyRequested = mPrivacyRequested || isolated; #endif diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp index e7bd35137ff8..2282a0843904 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.cpp @@ -572,26 +572,23 @@ PeerConnectionMedia::ConnectDtlsListener_s(const RefPtr& aFlow) #ifdef MOZILLA_INTERNAL_API /** - * Tells you if any local streams is isolated. Obviously, we want all the - * streams to be isolated equally so that they can all be sent or not. But we - * can't make that determination for certain, because stream principals change. - * Therefore, we check once when we are setting a local description and that - * determines if we flip the "privacy requested" bit on. If a stream cannot be - * sent, then we'll be sending black/silence later; maybe this will correct - * itself and we can send actual content. + * Tells you if any local streams is isolated to a specific peer identity. + * Obviously, we want all the streams to be isolated equally so that they can + * all be sent or not. We check once when we are setting a local description + * and that determines if we flip the "privacy requested" bit on. Once the bit + * is on, all media originating from this peer connection is isolated. * - * @param scriptPrincipal the principal - * @returns true if any stream is isolated + * @returns true if any stream has a peerIdentity set on it */ bool -PeerConnectionMedia::AnyLocalStreamIsolated(nsIPrincipal *scriptPrincipal) const +PeerConnectionMedia::AnyLocalStreamHasPeerIdentity() const { ASSERT_ON_THREAD(mMainThread); for (uint32_t u = 0; u < mLocalSourceStreams.Length(); u++) { // check if we should be asking for a private call for this stream DOMMediaStream* stream = mLocalSourceStreams[u]->GetMediaStream(); - if (!scriptPrincipal->Subsumes(stream->GetPrincipal())) { + if (stream->GetPeerIdentity()) { return true; } } diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h index 9a783bf759e5..d613ffed6d35 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h @@ -330,9 +330,8 @@ class PeerConnectionMedia : public sigslot::has_slots<> { // the stream, that would potentially affect others), so that it sends // black/silence. Once the peer is identified, re-enable those streams. void UpdateSinkIdentity_m(nsIPrincipal* aPrincipal, const PeerIdentity* aSinkIdentity); - // this determines if any stream is isolated, given the current - // document (or script) principal - bool AnyLocalStreamIsolated(nsIPrincipal *scriptPrincipal) const; + // this determines if any stream is peerIdentity constrained + bool AnyLocalStreamHasPeerIdentity() const; // When we finally learn who is on the other end, we need to change the ownership // on streams void UpdateRemoteStreamPrincipals_m(nsIPrincipal* aPrincipal); From 315c7d2229507bed673c8ed012d69c7f134d3c83 Mon Sep 17 00:00:00 2001 From: Vincent St-Amour Date: Tue, 17 Jun 2014 17:06:19 -0700 Subject: [PATCH 18/94] Bug 1028421 - Have xpcshell set compile-and-go. r=bz From 7574b690a54b731b149f5df05dfaf7c229a98f4a Mon Sep 17 00:00:00 2001 This allows scripts to be compiled with Ion. --- js/xpconnect/src/XPCShellImpl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) --- js/xpconnect/src/XPCShellImpl.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/js/xpconnect/src/XPCShellImpl.cpp b/js/xpconnect/src/XPCShellImpl.cpp index 50dc5f19db4a..0b88ba137d35 100644 --- a/js/xpconnect/src/XPCShellImpl.cpp +++ b/js/xpconnect/src/XPCShellImpl.cpp @@ -339,7 +339,8 @@ Load(JSContext *cx, unsigned argc, jsval *vp) } JS::CompileOptions options(cx); options.setUTF8(true) - .setFileAndLine(filename.ptr(), 1); + .setFileAndLine(filename.ptr(), 1) + .setCompileAndGo(true); JS::Rooted script(cx); JS::Compile(cx, obj, options, file, &script); fclose(file); @@ -924,7 +925,8 @@ ProcessFile(JSContext *cx, JS::Handle obj, const char *filename, FILE JS::CompileOptions options(cx); options.setUTF8(true) - .setFileAndLine(filename, 1); + .setFileAndLine(filename, 1) + .setCompileAndGo(true); if (JS::Compile(cx, obj, options, file, &script) && !compileOnly) (void)JS_ExecuteScript(cx, obj, script, &result); DoEndRequest(cx); @@ -959,7 +961,8 @@ ProcessFile(JSContext *cx, JS::Handle obj, const char *filename, FILE /* Clear any pending exception from previous failed compiles. */ JS_ClearPendingException(cx); JS::CompileOptions options(cx); - options.setFileAndLine("typein", startline); + options.setFileAndLine("typein", startline) + .setCompileAndGo(true); if (JS_CompileScript(cx, obj, buffer, strlen(buffer), options, &script)) { JSErrorReporter older; From 49cfbee73e2569238fadebf62d3a041c2caed7bd Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 14:45:31 -0700 Subject: [PATCH 19/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0f621a32f21b Author: Eitan Isaacson Desc: Merge pull request #20038 from eeejay/bug-1020656 Bug 1020656 - Hide contacts quickscroll and search when no contacts scre... r=francisco ======== https://hg.mozilla.org/integration/gaia-central/rev/f9078cfc611b Author: Eitan Isaacson Desc: Bug 1020656 - Hide contacts quickscroll and search when no contacts screen is shown. --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 7a57e3aaf7d8..764a8a73f250 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "4e3596b10de8df9202d9c0a7f64b7913bdfaaead", + "revision": "0f621a32f21b636ea7a5ef3a94c1346a4fb9c52e", "repo_path": "/integration/gaia-central" } From 341205084f0c1399ea82242e68673f1b0c39ac84 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 14:46:57 -0700 Subject: [PATCH 20/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index c73fb03b675c..9695eb734989 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ab6600118ad6..281c885450fd 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 25d9fc2cbaa1..e1e310d64a2f 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index c73fb03b675c..9695eb734989 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 7bbc867d6e90..f41e4dad097e 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 7c3cc3ae4d6b..62aaa576f9e0 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index d4b3a04102c3..f6aab30b31fe 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 352bcb2c8ed5..639b35a513ba 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 845844a35d1c..1ee00b4dd844 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From e58cbf4054bbbe5dafa98ef7279c945923a9d121 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 15:15:31 -0700 Subject: [PATCH 21/94] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/c5f56356f98e Author: Kevin Grandon Desc: Merge pull request #21270 from Cwiiis/bug1031094-squashed Bug 1031094 - Don't remove bookmarks from collections when uninstalling. r=kgrandon ======== https://hg.mozilla.org/integration/gaia-central/rev/22cf4fb531f1 Author: Chris Lord Desc: Bug 1031094 - Don't remove bookmarks from collections when uninstalling. r=kgrandon ======== https://hg.mozilla.org/integration/gaia-central/rev/2756678c2f6c Author: Ghislain 'Aus' Lacroix Desc: Merge pull request #21246 from nullaus/bug1013509 bug 1013509 - Dismiss Permission Request when requesting app is terminat... ======== https://hg.mozilla.org/integration/gaia-central/rev/93af9e968e19 Author: Ghislain 'Aus' Lacroix Desc: bug 1013509 - Dismiss Permission Request when requesting app is terminated. r=alive --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 764a8a73f250..69cb3ea981fc 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "0f621a32f21b636ea7a5ef3a94c1346a4fb9c52e", + "revision": "c5f56356f98e41aa0d1086cf49f2212816626691", "repo_path": "/integration/gaia-central" } From 97deb7fdc6507f173005359dd01a5cd7f0070a32 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 15:21:16 -0700 Subject: [PATCH 22/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9695eb734989..d0466c561f4a 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 281c885450fd..b035e6891a69 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index e1e310d64a2f..fd17050dec13 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 9695eb734989..d0466c561f4a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index f41e4dad097e..aa0c7ef4e90c 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 62aaa576f9e0..d803783bcf08 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index f6aab30b31fe..a5d69b213b48 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 639b35a513ba..136f231dcd4d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 1ee00b4dd844..594a3bba7c65 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From c74a66f472eabc4b350fe3d04ba9de883eb7fe61 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 15:30:28 -0700 Subject: [PATCH 23/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/1efffa083a8e Author: Aleh Zasypkin Desc: Merge pull request #21232 from azasypkin/bug-1008912-mms-label Bug 1008912 - "MMS" in sms app does not translate into other language. r=julien ======== https://hg.mozilla.org/integration/gaia-central/rev/a3bca8c56a9d Author: Aleh Zasypkin Desc: Bug 1008912 - "MMS" in sms app does not translate into other language. r=julien --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 69cb3ea981fc..d1b8a96b6d8d 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "c5f56356f98e41aa0d1086cf49f2212816626691", + "revision": "1efffa083a8e54448be40bd6942494fc373cce75", "repo_path": "/integration/gaia-central" } From 1d08ceceda1fba6f32a22e55f7d6c6df1792b089 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 15:36:12 -0700 Subject: [PATCH 24/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index d0466c561f4a..401e73168f90 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index b035e6891a69..6652b3f08dc2 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index fd17050dec13..5e5f4af47554 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index d0466c561f4a..401e73168f90 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index aa0c7ef4e90c..90af769bd6e5 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index d803783bcf08..8d4d1cd72989 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index a5d69b213b48..3652bbb7e12d 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 136f231dcd4d..97a8ca91415a 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 594a3bba7c65..21c05b71e8cf 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 484c8ff35c928150219d7903fa7f1d72eb5d6dcc Mon Sep 17 00:00:00 2001 From: Mike Habicher Date: Wed, 2 Jul 2014 18:49:54 -0400 Subject: [PATCH 25/94] Bug 1029367 - handle ISO modes without "ISO" prefixes, r=dhylands --- dom/camera/GonkCameraControl.cpp | 11 +++--- dom/camera/GonkCameraParameters.cpp | 39 +++++++++++-------- dom/camera/GonkCameraParameters.h | 2 + .../test/test_camera_fake_parameters.html | 24 ++++++++++-- 4 files changed, 51 insertions(+), 25 deletions(-) diff --git a/dom/camera/GonkCameraControl.cpp b/dom/camera/GonkCameraControl.cpp index 876892e56ac9..f94620879ac3 100644 --- a/dom/camera/GonkCameraControl.cpp +++ b/dom/camera/GonkCameraControl.cpp @@ -230,16 +230,17 @@ nsGonkCameraControl::SetConfigurationInternal(const Configuration& aConfig) break; } - nsresult rv = Set(CAMERA_PARAM_RECORDINGHINT, - aConfig.mMode == kVideoMode); + DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + rv = Set(CAMERA_PARAM_RECORDINGHINT, aConfig.mMode == kVideoMode); if (NS_FAILED(rv)) { DOM_CAMERA_LOGE("Failed to set recording hint (0x%x)\n", rv); } } - DOM_CAMERA_LOGT("%s:%d\n", __func__, __LINE__); - NS_ENSURE_SUCCESS(rv, rv); - mCurrentConfiguration.mMode = aConfig.mMode; mCurrentConfiguration.mRecorderProfile = aConfig.mRecorderProfile; if (aConfig.mMode == kVideoMode) { diff --git a/dom/camera/GonkCameraParameters.cpp b/dom/camera/GonkCameraParameters.cpp index 502da7de2c4a..dfc4593fe346 100644 --- a/dom/camera/GonkCameraParameters.cpp +++ b/dom/camera/GonkCameraParameters.cpp @@ -149,6 +149,7 @@ GonkCameraParameters::GonkCameraParameters() GonkCameraParameters::~GonkCameraParameters() { MOZ_COUNT_DTOR(GonkCameraParameters); + mIsoModeMap.Clear(); MOZ_ASSERT(mLock, "mLock missing in ~GonkCameraParameters()"); if (mLock) { PR_DestroyRWLock(mLock); @@ -159,20 +160,19 @@ GonkCameraParameters::~GonkCameraParameters() nsresult GonkCameraParameters::MapIsoToGonk(const nsAString& aIso, nsACString& aIsoOut) { - if (aIso.EqualsASCII("hjr")) { - aIsoOut = "ISO_HJR"; - } else if (aIso.EqualsASCII("auto")) { - aIsoOut = "auto"; - } else { - nsAutoCString v = NS_LossyConvertUTF16toASCII(aIso); - unsigned int iso; - if (sscanf(v.get(), "%u", &iso) != 1) { - return NS_ERROR_INVALID_ARG; + nsCString* s; + if (mIsoModeMap.Get(aIso, &s)) { + if (!s) { + DOM_CAMERA_LOGE("ISO mode '%s' maps to null Gonk ISO value\n", + NS_LossyConvertUTF16toASCII(aIso).get()); + return NS_ERROR_FAILURE; } - aIsoOut = nsPrintfCString("ISO%u", iso); + + aIsoOut = *s; + return NS_OK; } - return NS_OK; + return NS_ERROR_INVALID_ARG; } nsresult @@ -184,9 +184,13 @@ GonkCameraParameters::MapIsoFromGonk(const char* aIso, nsAString& aIsoOut) aIsoOut.AssignASCII("auto"); } else { unsigned int iso; - if (sscanf(aIso, "ISO%u", &iso) != 1) { + char ignored; + // Some camera libraries return ISO modes as "ISO100", others as "100". + if (sscanf(aIso, "ISO%u%c", &iso, &ignored) != 1 && + sscanf(aIso, "%u%c", &iso, &ignored) != 1) { return NS_ERROR_INVALID_ARG; } + aIsoOut.Truncate(0); aIsoOut.AppendInt(iso); } @@ -239,14 +243,17 @@ GonkCameraParameters::Initialize() // The return code from GetListAsArray() doesn't matter. If it fails, // the isoModes array will be empty, and the subsequent loop won't // execute. + nsString s; nsTArray isoModes; GetListAsArray(CAMERA_PARAM_SUPPORTED_ISOMODES, isoModes); for (uint32_t i = 0; i < isoModes.Length(); ++i) { - nsString v; - rv = MapIsoFromGonk(isoModes[i].get(), v); - if (NS_SUCCEEDED(rv)) { - *mIsoModes.AppendElement() = v; + rv = MapIsoFromGonk(isoModes[i].get(), s); + if (NS_FAILED(rv)) { + DOM_CAMERA_LOGW("Unrecognized ISO mode value '%s'\n", isoModes[i].get()); + continue; } + *mIsoModes.AppendElement() = s; + mIsoModeMap.Put(s, new nsCString(isoModes[i])); } mInitialized = true; diff --git a/dom/camera/GonkCameraParameters.h b/dom/camera/GonkCameraParameters.h index bda980c7b422..e8193da9fcee 100644 --- a/dom/camera/GonkCameraParameters.h +++ b/dom/camera/GonkCameraParameters.h @@ -23,6 +23,7 @@ #include "nsString.h" #include "AutoRwLock.h" #include "nsPrintfCString.h" +#include "nsClassHashtable.h" #include "ICameraControl.h" namespace mozilla { @@ -100,6 +101,7 @@ protected: int32_t mExposureCompensationMaxIndex; nsTArray mZoomRatios; nsTArray mIsoModes; + nsClassHashtable mIsoModeMap; // This subclass of android::CameraParameters just gives // all of the AOSP getters and setters the same signature. diff --git a/dom/camera/test/test_camera_fake_parameters.html b/dom/camera/test/test_camera_fake_parameters.html index 56648820c5c1..b1b6dfdc2cc6 100644 --- a/dom/camera/test/test_camera_fake_parameters.html +++ b/dom/camera/test/test_camera_fake_parameters.html @@ -120,19 +120,36 @@ var tests = [ // we should recognize 'auto', 'hjr', and numeric modes; anything else // from the driver is ignored, which this test also verifies. test.setFakeParameters( - "iso=auto;iso-values=auto,ISO_HJR,ISO100,foo,ISObar,ISO200,ISO400,ISO800,ISO1600", + "iso=auto;iso-values=auto,ISO_HJR,ISO100,foo,ISObar,ISO150moz,ISO200,400,ISO800,1600", function () { run(); }); }, test: function testFakeIso(cam, cap) { - // values 'foo' and 'ISObar' should not be included in isoModes ok(cap.isoModes.length == 7, "ISO modes length = " + cap.isoModes.length); + + // make sure we're not leaking any unexpected values formats + ok(cap.isoModes.indexOf("ISO_HJR") == -1, "ISO mode 'ISO_HJR' does not appear"); + ok(cap.isoModes.indexOf("_HJR") == -1, "ISO mode '_HJR' does not appear"); + ok(cap.isoModes.indexOf("HJR") == -1, "ISO mode 'HJR' does not appear"); + ok(cap.isoModes.indexOf("ISO100") == -1, "ISO mode 'ISO100' does not appear"); + ok(cap.isoModes.indexOf("ISO200") == -1, "ISO mode 'ISO200' does not appear"); + ok(cap.isoModes.indexOf("ISO800") == -1, "ISO mode 'ISO800' does not appear"); + + // make sure any weird values are dropped entirely ok(cap.isoModes.indexOf("foo") == -1, "Unknown ISO mode 'foo' is ignored"); ok(cap.isoModes.indexOf("ISObar") == -1, "Unknown ISO mode 'ISObar' is ignored"); ok(cap.isoModes.indexOf("bar") == -1, "Unknown ISO mode 'bar' is ignored"); + ok(cap.isoModes.indexOf("ISO150moz") == -1, "Unknown ISO mode 'ISO150moz' is ignored"); + ok(cap.isoModes.indexOf("150moz") == -1, "Unknown ISO mode '150moz' is ignored"); + ok(cap.isoModes.indexOf("150") == -1, "Unknown ISO mode '150' is ignored"); - // test individual ISO modes + // make sure expected values are present + [ "auto", "hjr", "100", "200", "400", "800", "1600" ].forEach(function(iso) { + ok(cap.isoModes.indexOf(iso) != -1, "ISO mode '" + iso + "' is present"); + }); + + // test setters/getters for individual ISO modes cap.isoModes.forEach(function(iso, index) { cam.iso = iso; ok(cam.iso === iso, @@ -251,7 +268,6 @@ var tests = [ cam.exposureCompensation = -1.25; ok(cam.exposureCompensation == -1.5, "exposureCompensation(-1.25) = " + cam.exposureCompensation); - // Check out-of-bounds values cam.exposureCompensation = cap.minExposureCompensation - 1.0; ok(cam.exposureCompensation == cap.minExposureCompensation, From 7f49c9f4eded25af26b50e39708682312a67bc1f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 16:00:31 -0700 Subject: [PATCH 26/94] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/780902e6d615 Author: Eitan Isaacson Desc: Merge pull request #20245 from eeejay/bug-970658 Bug 970658 - Cache downloaded extensions in build_stage. r=ochameau ======== https://hg.mozilla.org/integration/gaia-central/rev/c5329cb90efb Author: Eitan Isaacson Desc: fix build integration tests ======== https://hg.mozilla.org/integration/gaia-central/rev/89cbd0c9a999 Author: Eitan Isaacson Desc: change to http from https ======== https://hg.mozilla.org/integration/gaia-central/rev/67b7ac58951e Author: Eitan Isaacson Desc: Bug 970658 - Cache downloaded extensions in build_stage --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index d1b8a96b6d8d..188ffb362941 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "1efffa083a8e54448be40bd6942494fc373cce75", + "revision": "780902e6d615e6bac44a00db27fd52aeffa6854c", "repo_path": "/integration/gaia-central" } From d160b4b36a9d90e180f1c94c139f394862bfa61b Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 16:06:18 -0700 Subject: [PATCH 27/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 401e73168f90..d2a79183b175 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 6652b3f08dc2..a299fb102dc0 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 5e5f4af47554..5034d82a5c9f 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 401e73168f90..d2a79183b175 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 90af769bd6e5..7b07e7644275 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 8d4d1cd72989..c02022109dd0 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 3652bbb7e12d..a20e22576651 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 97a8ca91415a..e3a17b462508 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 21c05b71e8cf..71d5087f2773 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From d0cb737921fff3b39711eb8b3db85376e5da5e23 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 16:40:26 -0700 Subject: [PATCH 28/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/33148ca93b3f Author: Kevin Grandon Desc: Merge pull request #21308 from KevinGrandon/bug_1033632_collection_user_select Bug 1033632 - [Collections] Highlight on all app title occurs when tapping on a title of an app ======== https://hg.mozilla.org/integration/gaia-central/rev/c2dab302e191 Author: Kevin Grandon Desc: Bug 1033632 - [Collections] Highlight on all app title occurs when tapping on a title of an app --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 188ffb362941..69f5f0f86022 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "780902e6d615e6bac44a00db27fd52aeffa6854c", + "revision": "33148ca93b3f60995800f2b8a64af0603b84f84c", "repo_path": "/integration/gaia-central" } From bda15aa4d468c2ed7d88d17ee5da37c074914e43 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 16:46:43 -0700 Subject: [PATCH 29/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index d2a79183b175..9011e5483d01 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index a299fb102dc0..810795e59d4a 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 5034d82a5c9f..a36c939ae63c 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index d2a79183b175..9011e5483d01 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 7b07e7644275..f5ab312b290a 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index c02022109dd0..21ebfc78bb58 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index a20e22576651..056825c9c90c 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index e3a17b462508..67510191324a 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 71d5087f2773..b4e849fdbd07 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From d29687918df5419cafc557d50bd510be2cca8b82 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 19:30:23 -0700 Subject: [PATCH 30/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/3fdf71c424e9 Author: Yuren Ju Desc: Merge pull request #20970 from yurenju/settings-remove-makefile Bug 1029966 - rewrite settings build script in javascript r=@ochameau ======== https://hg.mozilla.org/integration/gaia-central/rev/ed879763d781 Author: Yuren Ju Desc: Bug 1029966 - rewrite settings build script in javascript --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 69f5f0f86022..f81f26f4d29b 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "33148ca93b3f60995800f2b8a64af0603b84f84c", + "revision": "3fdf71c424e97a968d37dec429deb537778f4ef1", "repo_path": "/integration/gaia-central" } From 580e3e8b8c3e867be9444cfc80baa68436df9e1c Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 19:36:37 -0700 Subject: [PATCH 31/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 9011e5483d01..7b7f993f125d 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 810795e59d4a..2510964e36d0 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index a36c939ae63c..039fdb8bf053 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 9011e5483d01..7b7f993f125d 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index f5ab312b290a..532a3a7ce178 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 21ebfc78bb58..37ec31ef27cc 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 056825c9c90c..e0e41f2d3c9c 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 67510191324a..6a33eb8814d9 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index b4e849fdbd07..baa21e319e7c 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From f00ed48e48e9c24958159c610c50827512ca975e Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 20:40:27 -0700 Subject: [PATCH 32/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/dcd24331f985 Author: russnicoletti Desc: Merge pull request #20817 from russnicoletti/handleScreenLayoutChange_unit_tests Support for handleScreenLayoutChange unit testing r=johu ======== https://hg.mozilla.org/integration/gaia-central/rev/2746778cd9fc Author: Russ Nicoletti Desc: Support for handleScreenLayoutChange unit testing --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index f81f26f4d29b..dfbccfbc2e05 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "3fdf71c424e97a968d37dec429deb537778f4ef1", + "revision": "dcd24331f985e1a7c96800d3c9b74c08f0e72521", "repo_path": "/integration/gaia-central" } From 050673d0f9b6f9c742b2698637e9db1995b1ae63 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 20:46:17 -0700 Subject: [PATCH 33/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 7b7f993f125d..4264e087f65f 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 2510964e36d0..fa6bbdab7a2a 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 039fdb8bf053..e7a6c7d6bded 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 7b7f993f125d..4264e087f65f 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 532a3a7ce178..ac4f328682fa 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 37ec31ef27cc..2c5fc0c07499 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index e0e41f2d3c9c..443e8dde6a9a 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 6a33eb8814d9..7a5a31bf0117 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index baa21e319e7c..11f80e9bbc26 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 7b5cf46bda2b1f19fa203161c6aaa3de452ffb69 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 20:55:30 -0700 Subject: [PATCH 34/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/d48fa23f94b5 Author: Greg Weng Desc: Merge pull request #21171 from snowmantw/issue1024951 Bug 1024951 - [NFC] Dialer screenshot shows on shrink UI ... ======== https://hg.mozilla.org/integration/gaia-central/rev/9c728d4c9054 Author: Greg Weng Desc: Bug 1024951 - [NFC] Dialer screenshot shows on shrink UI when try to share contact if dialer is running on the background --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index dfbccfbc2e05..87ab550fc5ce 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "dcd24331f985e1a7c96800d3c9b74c08f0e72521", + "revision": "d48fa23f94b57e69740a4e61fa2ef11d69ae9e68", "repo_path": "/integration/gaia-central" } From a9157b0c30165ab91688454dc2e5fd87932f27c7 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 21:01:12 -0700 Subject: [PATCH 35/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 4264e087f65f..930178961abb 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index fa6bbdab7a2a..01dcc5cf5b22 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index e7a6c7d6bded..0e809f15104c 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 4264e087f65f..930178961abb 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index ac4f328682fa..5233b654fcc7 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 2c5fc0c07499..778cf0543315 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 443e8dde6a9a..8f92e432440f 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 7a5a31bf0117..99d1788228c5 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 11f80e9bbc26..0f52d6390f29 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 6fbedd29355953a026a66cc1003f31254b0615f8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 21:25:28 -0700 Subject: [PATCH 36/94] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/c8176900e040 Author: Yuren Ju Desc: Merge pull request #21260 from yurenju/jshint-webapp-zip Bug 1032050 - Fix jshint error for build/webapp-zip.js r=@cctuan ======== https://hg.mozilla.org/integration/gaia-central/rev/440d56105b6d Author: Yuren Ju Desc: Bug 1032050 - Fix jshint error for build/webapp-zip.js --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 87ab550fc5ce..738644cb46ce 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "d48fa23f94b57e69740a4e61fa2ef11d69ae9e68", + "revision": "c8176900e040a8caf1ef0bf42608aaf70a13add7", "repo_path": "/integration/gaia-central" } From 42d4280ff412e0c1b7185f73092375329955c1dc Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 21:31:18 -0700 Subject: [PATCH 37/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 930178961abb..915df95d383a 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 01dcc5cf5b22..aeb9815f7caa 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 0e809f15104c..d8e1505578b3 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 930178961abb..915df95d383a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 5233b654fcc7..86ccaf4ecf46 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 778cf0543315..37dbf8f91b17 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index 8f92e432440f..d15f855987e7 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 99d1788228c5..3aa173bd4710 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 0f52d6390f29..6b7533adc293 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 5123629fd5944ff2c3fa9a26713ca809271242ef Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 22:20:29 -0700 Subject: [PATCH 38/94] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ======== https://hg.mozilla.org/integration/gaia-central/rev/c560e79619f1 Author: Fernando Rodríguez Sela Desc: Merge pull request #20781 from frsela/STK/Bug1026377 Bug 1026377 - [Sora]There is no highlight stripe when selecting some option in STK menu, r=jaoo ======== https://hg.mozilla.org/integration/gaia-central/rev/33917e963157 Author: Fernando Rodriguez Sela Desc: Bug 1026377 - [Sora]There is no highlight stripe when selecting some option in STK menu ======== https://hg.mozilla.org/integration/gaia-central/rev/8c9c36741908 Author: Timothy Guan-tin Chien Desc: Merge pull request #21251 from timdream/keyboard-cancel-contextmenu Bug 1028700 - Prevent all contextmenu event on keyboard, r=rudyl ======== https://hg.mozilla.org/integration/gaia-central/rev/85092f092798 Author: Timothy Guan-tin Chien Desc: Bug 1028700 - Prevent all contextmenu event on keyboard --- b2g/config/gaia.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 738644cb46ce..dcc3af0bbabc 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -4,6 +4,6 @@ "remote": "", "branch": "" }, - "revision": "c8176900e040a8caf1ef0bf42608aaf70a13add7", + "revision": "c560e79619f1e741655d2e1447cb92469a0419c0", "repo_path": "/integration/gaia-central" } From 49e4f7e12517b5314c29a9a314b74e10731f37e1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Wed, 2 Jul 2014 22:21:49 -0700 Subject: [PATCH 39/94] Bumping manifests a=b2g-bump --- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/hamachi/sources.xml | 2 +- b2g/config/helix/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/wasabi/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 915df95d383a..0f34c6ae1e2a 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index aeb9815f7caa..12f0dc733bfd 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d8e1505578b3..c59ad9244a46 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 915df95d383a..0f34c6ae1e2a 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 86ccaf4ecf46..374f313c7cd8 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/hamachi/sources.xml b/b2g/config/hamachi/sources.xml index 37dbf8f91b17..d7d73af9592d 100644 --- a/b2g/config/hamachi/sources.xml +++ b/b2g/config/hamachi/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/helix/sources.xml b/b2g/config/helix/sources.xml index d15f855987e7..7555358b0f2b 100644 --- a/b2g/config/helix/sources.xml +++ b/b2g/config/helix/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 3aa173bd4710..4d2fab8e5d4d 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/wasabi/sources.xml b/b2g/config/wasabi/sources.xml index 6b7533adc293..3229ee8c3bc2 100644 --- a/b2g/config/wasabi/sources.xml +++ b/b2g/config/wasabi/sources.xml @@ -17,7 +17,7 @@ - + From 472e86122f51472496992b10c8d944fb38b2e03c Mon Sep 17 00:00:00 2001 From: Hsin-Yi Tsai Date: Tue, 24 Jun 2014 18:36:59 +0800 Subject: [PATCH 40/94] Bug 1023141 - query ril.ecclist per dial request - part 0 - rename. r=aknow --- dom/telephony/test/marionette/head.js | 22 +++++++++---------- .../test/marionette/test_crash_emulator.js | 2 +- .../test_dsds_connection_conflict.js | 2 +- .../test/marionette/test_dsds_normal_call.js | 2 +- .../test/marionette/test_emergency.js | 10 ++++----- .../marionette/test_emergency_badNumber.js | 2 +- .../test_incoming_already_connected.js | 16 +++++++------- .../marionette/test_incoming_already_held.js | 18 +++++++-------- .../marionette/test_incoming_answer_hangup.js | 8 +++---- ...t_incoming_answer_hangup_oncallschanged.js | 8 +++---- .../test_incoming_answer_remote_hangup.js | 10 ++++----- .../test_incoming_connecting_hangup.js | 6 ++--- .../test_incoming_connecting_remote_hangup.js | 8 +++---- .../marionette/test_incoming_hangup_held.js | 10 ++++----- .../marionette/test_incoming_hold_resume.js | 12 +++++----- .../marionette/test_incoming_onstatechange.js | 12 +++++----- .../test/marionette/test_incoming_reject.js | 6 ++--- .../marionette/test_incoming_remote_cancel.js | 8 +++---- .../test_incoming_remote_hangup_held.js | 12 +++++----- .../test/marionette/test_multiple_hold.js | 20 ++++++++--------- .../marionette/test_outgoing_already_held.js | 18 +++++++-------- .../marionette/test_outgoing_answer_hangup.js | 10 ++++----- ...t_outgoing_answer_hangup_oncallschanged.js | 8 +++---- .../test_outgoing_answer_local_hangup.js | 8 +++---- .../test_outgoing_answer_radio_off.js | 2 +- .../marionette/test_outgoing_badNumber.js | 2 +- .../test/marionette/test_outgoing_busy.js | 6 ++--- .../test_outgoing_hangup_alerting.js | 4 ++-- .../marionette/test_outgoing_hangup_held.js | 10 ++++----- .../marionette/test_outgoing_hold_resume.js | 12 +++++----- .../marionette/test_outgoing_onstatechange.js | 12 +++++----- .../marionette/test_outgoing_radio_off.js | 2 +- .../test/marionette/test_outgoing_reject.js | 6 ++--- .../test_outgoing_remote_hangup_held.js | 12 +++++----- .../marionette/test_redundant_operations.js | 12 +++++----- .../marionette/test_swap_held_and_active.js | 20 ++++++++--------- 36 files changed, 169 insertions(+), 169 deletions(-) diff --git a/dom/telephony/test/marionette/head.js b/dom/telephony/test/marionette/head.js index 2232abba2d5c..dbf02e7053e4 100644 --- a/dom/telephony/test/marionette/head.js +++ b/dom/telephony/test/marionette/head.js @@ -16,10 +16,10 @@ let emulator = (function() { // Overwritten it so people could not call this function directly. runEmulatorCmd = function() { - throw "Use emulator.runWithCallback(cmd, callback) instead of runEmulatorCmd"; + throw "Use emulator.runCmdWithCallback(cmd, callback) instead of runEmulatorCmd"; }; - function run(cmd) { + function runCmd(cmd) { let deferred = Promise.defer(); pendingCmdCount++; @@ -36,8 +36,8 @@ let emulator = (function() { return deferred.promise; } - function runWithCallback(cmd, callback) { - run(cmd).then(result => { + function runCmdWithCallback(cmd, callback) { + runCmd(cmd).then(result => { if (callback && typeof callback === "function") { callback(result); } @@ -60,8 +60,8 @@ let emulator = (function() { } return { - run: run, - runWithCallback: runWithCallback, + runCmd: runCmd, + runCmdWithCallback: runCmdWithCallback, waitFinish: waitFinish }; }()); @@ -123,7 +123,7 @@ let emulator = (function() { return Promise.all(hangUpPromises) .then(() => { - return emulator.run("gsm clear"); + return emulator.runCmd("gsm clear").then(waitForNoCall); }) .then(waitForNoCall); } @@ -361,7 +361,7 @@ let emulator = (function() { * @return A deferred promise. */ function checkEmulatorCallList(expectedCallList) { - return emulator.run("gsm list").then(result => { + return emulator.runCmd("gsm list").then(result => { log("Call list is now: " + result); for (let i = 0; i < expectedCallList.length; ++i) { is(result[i], expectedCallList[i], "emulator calllist"); @@ -611,7 +611,7 @@ let emulator = (function() { numberPresentation = numberPresentation || ""; name = name || ""; namePresentation = namePresentation || ""; - emulator.run("gsm call " + number + "," + numberPresentation + "," + name + + emulator.runCmd("gsm call " + number + "," + numberPresentation + "," + name + "," + namePresentation); return deferred.promise; } @@ -634,7 +634,7 @@ let emulator = (function() { checkEventCallState(event, call, "connected"); deferred.resolve(call); }; - emulator.run("gsm accept " + call.id.number); + emulator.runCmd("gsm accept " + call.id.number); return deferred.promise; } @@ -657,7 +657,7 @@ let emulator = (function() { checkEventCallState(event, call, "disconnected"); deferred.resolve(call); }; - emulator.run("gsm cancel " + call.id.number); + emulator.runCmd("gsm cancel " + call.id.number); return deferred.promise; } diff --git a/dom/telephony/test/marionette/test_crash_emulator.js b/dom/telephony/test/marionette/test_crash_emulator.js index e66a248bff3c..29b29761f778 100644 --- a/dom/telephony/test/marionette/test_crash_emulator.js +++ b/dom/telephony/test/marionette/test_crash_emulator.js @@ -31,7 +31,7 @@ function answer() { return(callDuration >= 2000); }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } function cleanUp(){ diff --git a/dom/telephony/test/marionette/test_dsds_connection_conflict.js b/dom/telephony/test/marionette/test_dsds_connection_conflict.js index fa6a79bdad0c..5ada8e48d74e 100644 --- a/dom/telephony/test/marionette/test_dsds_connection_conflict.js +++ b/dom/telephony/test/marionette/test_dsds_connection_conflict.js @@ -7,7 +7,7 @@ MARIONETTE_HEAD_JS = 'head.js'; function muxModem(id) { let deferred = Promise.defer(); - emulator.runWithCallback("mux modem " + id, function() { + emulator.runCmdWithCallback("mux modem " + id, function() { deferred.resolve(); }); diff --git a/dom/telephony/test/marionette/test_dsds_normal_call.js b/dom/telephony/test/marionette/test_dsds_normal_call.js index 4aea2d179b35..ece526920ae7 100644 --- a/dom/telephony/test/marionette/test_dsds_normal_call.js +++ b/dom/telephony/test/marionette/test_dsds_normal_call.js @@ -7,7 +7,7 @@ MARIONETTE_HEAD_JS = 'head.js'; function muxModem(id) { let deferred = Promise.defer(); - emulator.runWithCallback("mux modem " + id, function() { + emulator.runCmdWithCallback("mux modem " + id, function() { deferred.resolve(); }); diff --git a/dom/telephony/test/marionette/test_emergency.js b/dom/telephony/test/marionette/test_emergency.js index 009db2fbddbe..9dd70776f7d3 100644 --- a/dom/telephony/test/marionette/test_emergency.js +++ b/dom/telephony/test/marionette/test_emergency.js @@ -28,7 +28,7 @@ function dial() { is(outgoing.state, "alerting"); is(outgoing.emergency, true); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); answer(); @@ -49,13 +49,13 @@ function answer() { is(outgoing, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : active"); hangUp(); }); }; - emulator.runWithCallback("gsm accept " + number); + emulator.runCmdWithCallback("gsm accept " + number); } function hangUp() { @@ -71,12 +71,12 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + number); + emulator.runCmdWithCallback("gsm cancel " + number); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_emergency_badNumber.js b/dom/telephony/test/marionette/test_emergency_badNumber.js index c33e8e02b942..84afb568f438 100644 --- a/dom/telephony/test/marionette/test_emergency_badNumber.js +++ b/dom/telephony/test/marionette/test_emergency_badNumber.js @@ -16,7 +16,7 @@ function dial() { is(telephony.calls.length, 0); is(cause, "BadNumberError"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Initial call list: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_already_connected.js b/dom/telephony/test/marionette/test_incoming_already_connected.js index 0867813f46a6..d7c3205989bf 100644 --- a/dom/telephony/test/marionette/test_incoming_already_connected.js +++ b/dom/telephony/test/marionette/test_incoming_already_connected.js @@ -27,7 +27,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : ringing"); answer(); @@ -47,7 +47,7 @@ function answer() { is(outgoingCall.state, "connected"); is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); @@ -61,7 +61,7 @@ function answer() { } }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } // With one connected call already, simulate an incoming call @@ -80,14 +80,14 @@ function simulateIncoming() { is(telephony.calls[0], outgoingCall); is(telephony.calls[1], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); is(result[1], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } // Answer incoming call; original outgoing call should be held @@ -111,7 +111,7 @@ function answerIncoming() { is(incomingCall, telephony.active); is(outgoingCall.state, "held"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); is(result[1], "inbound from " + inNumber + " : active"); @@ -143,7 +143,7 @@ function hangUpOutgoing() { is(telephony.calls.length, 1); is(incomingCall.state, "connected"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); hangUpIncoming(); @@ -174,7 +174,7 @@ function hangUpIncoming() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_already_held.js b/dom/telephony/test/marionette/test_incoming_already_held.js index 601f8b1a499b..6e37614c6fde 100644 --- a/dom/telephony/test/marionette/test_incoming_already_held.js +++ b/dom/telephony/test/marionette/test_incoming_already_held.js @@ -27,7 +27,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : ringing"); answer(); @@ -47,7 +47,7 @@ function answer() { is(outgoingCall.state, "connected"); is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); @@ -61,7 +61,7 @@ function answer() { } }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } function holdCall() { @@ -85,7 +85,7 @@ function holdCall() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); simulateIncoming(); @@ -110,14 +110,14 @@ function simulateIncoming() { is(telephony.calls[0], outgoingCall); is(telephony.calls[1], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); is(result[1], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } // Answer incoming call; original outgoing call should be held @@ -141,7 +141,7 @@ function answerIncoming() { is(incomingCall, telephony.active); is(outgoingCall.state, "held"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); is(result[1], "inbound from " + inNumber + " : active"); @@ -173,7 +173,7 @@ function hangUpOutgoing() { is(telephony.calls.length, 1); is(incomingCall.state, "connected"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); hangUpIncoming(); @@ -204,7 +204,7 @@ function hangUpIncoming() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_answer_hangup.js b/dom/telephony/test/marionette/test_incoming_answer_hangup.js index c5699786f5ad..38c9c118ef40 100644 --- a/dom/telephony/test/marionette/test_incoming_answer_hangup.js +++ b/dom/telephony/test/marionette/test_incoming_answer_hangup.js @@ -22,13 +22,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incoming); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : incoming"); answer(); }); }; - emulator.runWithCallback("gsm call " + number); + emulator.runCmdWithCallback("gsm call " + number); } function answer() { @@ -50,7 +50,7 @@ function answer() { is(incoming, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : active"); hangUp(); @@ -79,7 +79,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js b/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js index 045554396d43..7dae153f5a97 100644 --- a/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js +++ b/dom/telephony/test/marionette/test_incoming_answer_hangup_oncallschanged.js @@ -28,14 +28,14 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incoming); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : incoming"); answer(); }); }; - emulator.runWithCallback("gsm call " + number); + emulator.runCmdWithCallback("gsm call " + number); } function answer() { @@ -60,7 +60,7 @@ function answer() { is(incoming, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : active"); hangUp(); @@ -109,7 +109,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js b/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js index 917884eba9a7..86a3a1dd79a3 100644 --- a/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js +++ b/dom/telephony/test/marionette/test_incoming_answer_remote_hangup.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -48,7 +48,7 @@ function answerIncoming() { is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); remoteHangUp(); @@ -70,12 +70,12 @@ function remoteHangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + inNumber); + emulator.runCmdWithCallback("gsm cancel " + inNumber); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_incoming_connecting_hangup.js b/dom/telephony/test/marionette/test_incoming_connecting_hangup.js index 2b283e4dbae0..4df52b854bc0 100644 --- a/dom/telephony/test/marionette/test_incoming_connecting_hangup.js +++ b/dom/telephony/test/marionette/test_incoming_connecting_hangup.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -77,7 +77,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js b/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js index 91426625c475..75ebe1f3b8ea 100644 --- a/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js +++ b/dom/telephony/test/marionette/test_incoming_connecting_remote_hangup.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -59,12 +59,12 @@ function remoteHangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + inNumber); + emulator.runCmdWithCallback("gsm cancel " + inNumber); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_incoming_hangup_held.js b/dom/telephony/test/marionette/test_incoming_hangup_held.js index e2edf605b2a8..436614ec01b5 100644 --- a/dom/telephony/test/marionette/test_incoming_hangup_held.js +++ b/dom/telephony/test/marionette/test_incoming_hangup_held.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -48,7 +48,7 @@ function answerIncoming() { is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); hold(); @@ -78,7 +78,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); hangUp(); @@ -107,7 +107,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_hold_resume.js b/dom/telephony/test/marionette/test_incoming_hold_resume.js index 723be17e4255..f7ce52d31fbd 100644 --- a/dom/telephony/test/marionette/test_incoming_hold_resume.js +++ b/dom/telephony/test/marionette/test_incoming_hold_resume.js @@ -21,13 +21,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : incoming"); answer(); }); }; - emulator.runWithCallback("gsm call " + number); + emulator.runCmdWithCallback("gsm call " + number); } function answer() { @@ -49,7 +49,7 @@ function answer() { is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : active"); hold(); @@ -79,7 +79,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : held"); // Wait on hold for a couple of seconds @@ -111,7 +111,7 @@ function resume() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : active"); hangUp(); @@ -140,7 +140,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_onstatechange.js b/dom/telephony/test/marionette/test_incoming_onstatechange.js index 1f6218670626..6316bd85a1d1 100644 --- a/dom/telephony/test/marionette/test_incoming_onstatechange.js +++ b/dom/telephony/test/marionette/test_incoming_onstatechange.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -45,7 +45,7 @@ function answerIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); hold(); @@ -71,7 +71,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); resume(); @@ -97,7 +97,7 @@ function resume() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); hangUp(); @@ -122,7 +122,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_reject.js b/dom/telephony/test/marionette/test_incoming_reject.js index 618f351e889b..c3c2c20dc962 100644 --- a/dom/telephony/test/marionette/test_incoming_reject.js +++ b/dom/telephony/test/marionette/test_incoming_reject.js @@ -22,13 +22,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incoming); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + number + " : incoming"); reject(); }); }; - emulator.runWithCallback("gsm call " + number); + emulator.runCmdWithCallback("gsm call " + number); } function reject() { @@ -51,7 +51,7 @@ function reject() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_incoming_remote_cancel.js b/dom/telephony/test/marionette/test_incoming_remote_cancel.js index 90887d96842b..269dd08cd576 100644 --- a/dom/telephony/test/marionette/test_incoming_remote_cancel.js +++ b/dom/telephony/test/marionette/test_incoming_remote_cancel.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); cancelIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function cancelIncoming(){ @@ -42,12 +42,12 @@ function cancelIncoming(){ is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + inNumber); + emulator.runCmdWithCallback("gsm cancel " + inNumber); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js b/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js index 6df36a52531f..5d3fa235401e 100644 --- a/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js +++ b/dom/telephony/test/marionette/test_incoming_remote_hangup_held.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -48,7 +48,7 @@ function answerIncoming() { is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); hold(); @@ -78,7 +78,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); hangUp(); @@ -100,12 +100,12 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + inNumber); + emulator.runCmdWithCallback("gsm cancel " + inNumber); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_multiple_hold.js b/dom/telephony/test/marionette/test_multiple_hold.js index fffaf8deb785..063760f2e639 100644 --- a/dom/telephony/test/marionette/test_multiple_hold.js +++ b/dom/telephony/test/marionette/test_multiple_hold.js @@ -22,13 +22,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -49,7 +49,7 @@ function answerIncoming() { ok(gotConnecting); is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); holdCall(); @@ -80,7 +80,7 @@ function holdCall() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); dial(); @@ -108,7 +108,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); is(result[1], "outbound to " + outNumber + " : ringing"); @@ -129,14 +129,14 @@ function answerOutgoing() { is(outgoingCall.state, "connected"); is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); is(result[1], "outbound to " + outNumber + " : active"); holdSecondCall(); }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } // With one held call and one active, hold the active one; expect the first @@ -187,7 +187,7 @@ function verifyCalls() { is(telephony.calls[0], incomingCall); is(telephony.calls[1], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); is(result[1], "outbound to " + outNumber + " : held"); @@ -218,7 +218,7 @@ function hangUpIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); hangUpOutgoing(); @@ -249,7 +249,7 @@ function hangUpOutgoing() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_already_held.js b/dom/telephony/test/marionette/test_outgoing_already_held.js index 2708f8cc31b4..e1d45a9c71cb 100644 --- a/dom/telephony/test/marionette/test_outgoing_already_held.js +++ b/dom/telephony/test/marionette/test_outgoing_already_held.js @@ -29,13 +29,13 @@ function simulateIncoming() { }; let rcvdEmulatorCallback = false; - emulator.runWithCallback("gsm call " + inNumber, function(result) { + emulator.runCmdWithCallback("gsm call " + inNumber, function(result) { rcvdEmulatorCallback = true; }); } function verifyCallList(){ - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); @@ -61,7 +61,7 @@ function answerIncoming() { is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); holdCall(); @@ -92,7 +92,7 @@ function holdCall(){ is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); dial(); @@ -121,7 +121,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); is(result[1], "outbound to " + outNumber + " : ringing"); @@ -150,13 +150,13 @@ function answerOutgoing() { }; let rcvdEmulatorCallback = false; - emulator.runWithCallback("gsm accept " + outNumber, function(result) { + emulator.runCmdWithCallback("gsm accept " + outNumber, function(result) { rcvdEmulatorCallback = true; }); } function checkCallList(){ - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); is(result[1], "outbound to " + outNumber + " : active"); @@ -187,7 +187,7 @@ function hangUpIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); hangUpOutgoing(); @@ -218,7 +218,7 @@ function hangUpOutgoing() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_answer_hangup.js b/dom/telephony/test/marionette/test_outgoing_answer_hangup.js index 839761459671..38907ac5cc51 100644 --- a/dom/telephony/test/marionette/test_outgoing_answer_hangup.js +++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup.js @@ -27,7 +27,7 @@ function dial() { is(outgoing, event.call); is(outgoing.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); answer(); @@ -48,13 +48,13 @@ function answer() { is(outgoing, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : active"); hangUp(); }); }; - emulator.runWithCallback("gsm accept " + number); + emulator.runCmdWithCallback("gsm accept " + number); } function hangUp() { @@ -70,12 +70,12 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + number); + emulator.runCmdWithCallback("gsm cancel " + number); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js b/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js index 2a19b6598def..7a79472232c4 100644 --- a/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js +++ b/dom/telephony/test/marionette/test_outgoing_answer_hangup_oncallschanged.js @@ -46,7 +46,7 @@ function dial() { } function checkCallList() { - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); if (((result[0] == "outbound to " + number + " : unknown") || (result[0] == "outbound to " + number + " : dialing"))) { @@ -69,19 +69,19 @@ function answer() { is(outgoing, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list (after 'connected' event) is now: " + result); is(result[0], "outbound to " + number + " : active"); hangUp(); }); }; - emulator.runWithCallback("gsm accept " + number); + emulator.runCmdWithCallback("gsm accept " + number); } function hangUp() { log("Hanging up the outgoing call."); - emulator.runWithCallback("gsm cancel " + number); + emulator.runCmdWithCallback("gsm cancel " + number); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js b/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js index aec488255ec7..766ebe9330aa 100644 --- a/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js +++ b/dom/telephony/test/marionette/test_outgoing_answer_local_hangup.js @@ -26,7 +26,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : ringing"); answer(); @@ -47,13 +47,13 @@ function answer() { is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); hangUp(); }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } function hangUp() { @@ -76,7 +76,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js b/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js index 78fd30d3c4f3..437d30c0f85b 100644 --- a/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js +++ b/dom/telephony/test/marionette/test_outgoing_answer_radio_off.js @@ -59,7 +59,7 @@ function remoteAnswer(call) { is(call.state, "connected"); deferred.resolve(call); }; - emulator.runWithCallback("gsm accept " + call.id.number); + emulator.runCmdWithCallback("gsm accept " + call.id.number); return deferred.promise; } diff --git a/dom/telephony/test/marionette/test_outgoing_badNumber.js b/dom/telephony/test/marionette/test_outgoing_badNumber.js index 26fda57300eb..6bd0c198daef 100644 --- a/dom/telephony/test/marionette/test_outgoing_badNumber.js +++ b/dom/telephony/test/marionette/test_outgoing_badNumber.js @@ -30,7 +30,7 @@ function dial() { ok(event.call.error); is(event.call.error.name, "BadNumberError"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Initial call list: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_busy.js b/dom/telephony/test/marionette/test_outgoing_busy.js index 7886a8968bf0..853a390f99b1 100644 --- a/dom/telephony/test/marionette/test_outgoing_busy.js +++ b/dom/telephony/test/marionette/test_outgoing_busy.js @@ -25,7 +25,7 @@ function dial() { is(outgoing, event.call); is(outgoing.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); busy(); @@ -42,13 +42,13 @@ function busy() { is(outgoing, event.call); is(event.call.error.name, "BusyError"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm busy " + number); + emulator.runCmdWithCallback("gsm busy " + number); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js b/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js index cf03e822bc0b..bf75e3833def 100644 --- a/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js +++ b/dom/telephony/test/marionette/test_outgoing_hangup_alerting.js @@ -24,7 +24,7 @@ function dial() { outgoing.onalerting = function onalerting(event) { log("Received 'alerting' call event."); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); hangUp(); @@ -54,7 +54,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_hangup_held.js b/dom/telephony/test/marionette/test_outgoing_hangup_held.js index 5f8855ec044d..87a5ecf9f44a 100644 --- a/dom/telephony/test/marionette/test_outgoing_hangup_held.js +++ b/dom/telephony/test/marionette/test_outgoing_hangup_held.js @@ -26,7 +26,7 @@ function dial() { is(outgoing, event.call); is(outgoing.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); answer(); @@ -47,13 +47,13 @@ function answer() { is(outgoing, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : active"); hold(); }); }; - emulator.runWithCallback("gsm accept " + number); + emulator.runCmdWithCallback("gsm accept " + number); } function hold() { @@ -75,7 +75,7 @@ function hold() { is(telephony.active, null); is(telephony.calls.length, 1); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : held"); hangUp(); @@ -104,7 +104,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_hold_resume.js b/dom/telephony/test/marionette/test_outgoing_hold_resume.js index ad2b7e0e9989..182580753776 100644 --- a/dom/telephony/test/marionette/test_outgoing_hold_resume.js +++ b/dom/telephony/test/marionette/test_outgoing_hold_resume.js @@ -26,7 +26,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); answer(); @@ -47,13 +47,13 @@ function answer() { is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : active"); hold(); }); }; - emulator.runWithCallback("gsm accept " + number); + emulator.runCmdWithCallback("gsm accept " + number); } function hold() { @@ -77,7 +77,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : held"); // Bug 781604: emulator assertion if outgoing call kept on hold @@ -111,7 +111,7 @@ function resume() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : active"); hangUp(); @@ -140,7 +140,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_onstatechange.js b/dom/telephony/test/marionette/test_outgoing_onstatechange.js index 8aa850b2ea89..a0c984d30d2b 100644 --- a/dom/telephony/test/marionette/test_outgoing_onstatechange.js +++ b/dom/telephony/test/marionette/test_outgoing_onstatechange.js @@ -28,7 +28,7 @@ function dial() { ok(expectedStates.indexOf(event.call.state) != -1); if (event.call.state == "alerting") { - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : ringing"); answer(); @@ -49,13 +49,13 @@ function answer() { is(outgoingCall.state, "connected"); is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); hold(); }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } function hold() { @@ -74,7 +74,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); resume(); @@ -100,7 +100,7 @@ function resume() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); hangUp(); @@ -125,7 +125,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_radio_off.js b/dom/telephony/test/marionette/test_outgoing_radio_off.js index 17334beb5553..92de9015567f 100644 --- a/dom/telephony/test/marionette/test_outgoing_radio_off.js +++ b/dom/telephony/test/marionette/test_outgoing_radio_off.js @@ -47,7 +47,7 @@ function dial(number) { is(telephony.calls.length, 0); is(cause, "RadioNotAvailable"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Initial call list: " + result); setRadioEnabled(true, cleanUp); diff --git a/dom/telephony/test/marionette/test_outgoing_reject.js b/dom/telephony/test/marionette/test_outgoing_reject.js index 1dfe738065d3..fe5ab199f69e 100644 --- a/dom/telephony/test/marionette/test_outgoing_reject.js +++ b/dom/telephony/test/marionette/test_outgoing_reject.js @@ -25,7 +25,7 @@ function dial() { is(outgoing, event.call); is(outgoing.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + number + " : ringing"); reject(); @@ -53,13 +53,13 @@ function reject() { }; let rcvdEmulatorCallback = false; - emulator.runWithCallback("gsm cancel " + number, function(result) { + emulator.runCmdWithCallback("gsm cancel " + number, function(result) { rcvdEmulatorCallback = true; }); } function verifyCallList(){ - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); diff --git a/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js b/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js index c4ed18e9e76b..b8fc026a66c4 100644 --- a/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js +++ b/dom/telephony/test/marionette/test_outgoing_remote_hangup_held.js @@ -25,7 +25,7 @@ function dial() { is(outgoingCall, event.call); is(outgoingCall.state, "alerting"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : ringing"); answer(); @@ -46,13 +46,13 @@ function answer() { is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); hold(); }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } function hold() { @@ -75,7 +75,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); hangUp(); @@ -97,12 +97,12 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); }; - emulator.runWithCallback("gsm cancel " + outNumber); + emulator.runCmdWithCallback("gsm cancel " + outNumber); } function cleanUp() { diff --git a/dom/telephony/test/marionette/test_redundant_operations.js b/dom/telephony/test/marionette/test_redundant_operations.js index 6a607894f213..671fee935dfe 100644 --- a/dom/telephony/test/marionette/test_redundant_operations.js +++ b/dom/telephony/test/marionette/test_redundant_operations.js @@ -20,13 +20,13 @@ function simulateIncoming() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } function answerIncoming() { @@ -48,7 +48,7 @@ function answerIncoming() { is(incomingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); answerAlreadyConnected(); @@ -100,7 +100,7 @@ function hold() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); holdAlreadyHeld(); @@ -176,7 +176,7 @@ function resume() { is(telephony.calls.length, 1); is(telephony.calls[0], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : active"); resumeNonHeld(); @@ -227,7 +227,7 @@ function hangUp() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); answerDisconnected(); }); diff --git a/dom/telephony/test/marionette/test_swap_held_and_active.js b/dom/telephony/test/marionette/test_swap_held_and_active.js index 7233141b7dd9..946c59cfb7da 100644 --- a/dom/telephony/test/marionette/test_swap_held_and_active.js +++ b/dom/telephony/test/marionette/test_swap_held_and_active.js @@ -29,7 +29,7 @@ function dial() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : ringing"); answer(); @@ -49,7 +49,7 @@ function answer() { is(outgoingCall.state, "connected"); is(outgoingCall, telephony.active); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); @@ -63,7 +63,7 @@ function answer() { } }); }; - emulator.runWithCallback("gsm accept " + outNumber); + emulator.runCmdWithCallback("gsm accept " + outNumber); } function holdCall() { @@ -87,7 +87,7 @@ function holdCall() { is(telephony.calls.length, 1); is(telephony.calls[0], outgoingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); simulateIncoming(); @@ -112,14 +112,14 @@ function simulateIncoming() { is(telephony.calls[0], outgoingCall); is(telephony.calls[1], incomingCall); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); is(result[1], "inbound from " + inNumber + " : incoming"); answerIncoming(); }); }; - emulator.runWithCallback("gsm call " + inNumber); + emulator.runCmdWithCallback("gsm call " + inNumber); } // Answer incoming call; original outgoing call should be held @@ -145,7 +145,7 @@ function answerIncoming() { is(outgoingCall.state, "held"); is(incomingCall.state, "connected"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : held"); is(result[1], "inbound from " + inNumber + " : active"); @@ -198,7 +198,7 @@ function verifySwap() { is(outgoingCall.state, "connected"); is(incomingCall.state, "held"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "outbound to " + outNumber + " : active"); is(result[1], "inbound from " + inNumber + " : held"); @@ -230,7 +230,7 @@ function hangUpOutgoing() { is(telephony.calls.length, 1); is(incomingCall.state, "held"); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); is(result[0], "inbound from " + inNumber + " : held"); hangUpIncoming(); @@ -261,7 +261,7 @@ function hangUpIncoming() { is(telephony.active, null); is(telephony.calls.length, 0); - emulator.runWithCallback("gsm list", function(result) { + emulator.runCmdWithCallback("gsm list", function(result) { log("Call list is now: " + result); cleanUp(); }); From 96a6b442854a28c69be7a3af79aa48a13c3a0608 Mon Sep 17 00:00:00 2001 From: Hsin-Yi Tsai Date: Tue, 24 Jun 2014 18:32:41 +0800 Subject: [PATCH 41/94] Bug 1023141 - query ril.ecclist per dial request - part 1 - fix. r=aknow --- dom/system/gonk/RadioInterfaceLayer.js | 4 +- dom/system/gonk/ril_worker.js | 133 +++++++++++-------------- dom/telephony/gonk/TelephonyService.js | 30 +++++- 3 files changed, 86 insertions(+), 81 deletions(-) diff --git a/dom/system/gonk/RadioInterfaceLayer.js b/dom/system/gonk/RadioInterfaceLayer.js index d51fea6e29b2..5fbebcabe24b 100644 --- a/dom/system/gonk/RadioInterfaceLayer.js +++ b/dom/system/gonk/RadioInterfaceLayer.js @@ -1641,9 +1641,7 @@ WorkerMessenger.prototype = { libcutils.property_get("ro.moz.ril.send_stk_profile_dl", "false") == "true", dataRegistrationOnDemand: RILQUIRKS_DATA_REGISTRATION_ON_DEMAND, subscriptionControl: RILQUIRKS_SUBSCRIPTION_CONTROL - }, - rilEmergencyNumbers: libcutils.property_get("ril.ecclist") || - libcutils.property_get("ro.ril.ecclist") + } }; this.send(null, "setInitialOptions", options); diff --git a/dom/system/gonk/ril_worker.js b/dom/system/gonk/ril_worker.js index 9d4ab1fdfaa3..c95fedc67d44 100644 --- a/dom/system/gonk/ril_worker.js +++ b/dom/system/gonk/ril_worker.js @@ -52,9 +52,6 @@ if (!this.debug) { }; } -let RIL_EMERGENCY_NUMBERS; -const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"]; - // Timeout value for emergency callback mode. const EMERGENCY_CB_MODE_TIMEOUT_MS = 300000; // 5 mins = 300000 ms. @@ -1555,7 +1552,7 @@ RilObject.prototype = { cachedDialRequest : null, /** - * Dial the phone. + * Dial a non-emergency number. * * @param number * String containing the number to dial. @@ -1564,34 +1561,13 @@ RilObject.prototype = { * @param uusInfo * Integer doing something XXX TODO */ - dial: function(options) { + dialNonEmergencyNumber: function(options) { let onerror = (function onerror(options, errorMsg) { options.success = false; options.errorMsg = errorMsg; this.sendChromeMessage(options); }).bind(this, options); - if (this._isEmergencyNumber(options.number)) { - this.dialEmergencyNumber(options, onerror); - } else { - if (!this._isCdma) { - // TODO: Both dial() and sendMMI() functions should be unified at some - // point in the future. In the mean time we handle temporary CLIR MMI - // commands through the dial() function. Please see bug 889737. - let mmi = this._parseMMI(options.number); - if (mmi && this._isTemporaryModeCLIR(mmi)) { - options.number = mmi.dialNumber; - // In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI - // presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B. - options.clirMode = mmi.procedure == MMI_PROCEDURE_ACTIVATION ? - CLIR_SUPPRESSION : CLIR_INVOCATION; - } - } - this.dialNonEmergencyNumber(options, onerror); - } - }, - - dialNonEmergencyNumber: function(options, onerror) { if (this.radioState == GECKO_RADIOSTATE_OFF) { // Notify error in establishing the call without radio. onerror(GECKO_ERROR_RADIO_NOT_AVAILABLE); @@ -1609,17 +1585,41 @@ RilObject.prototype = { this.exitEmergencyCbMode(); } - if (this._isCdma && Object.keys(this.currentCalls).length == 1) { - // Make a Cdma 3way call. - options.featureStr = options.number; - this.sendCdmaFlashCommand(options); - } else { - options.request = REQUEST_DIAL; - this.sendDialRequest(options); + if (!this._isCdma) { + // TODO: Both dial() and sendMMI() functions should be unified at some + // point in the future. In the mean time we handle temporary CLIR MMI + // commands through the dial() function. Please see bug 889737. + let mmi = this._parseMMI(options.number); + if (mmi && this._isTemporaryModeCLIR(mmi)) { + options.number = mmi.dialNumber; + // In temporary mode, MMI_PROCEDURE_ACTIVATION means allowing CLI + // presentation, i.e. CLIR_SUPPRESSION. See TS 22.030, Annex B. + options.clirMode = mmi.procedure == MMI_PROCEDURE_ACTIVATION ? + CLIR_SUPPRESSION : CLIR_INVOCATION; + } } + + options.request = REQUEST_DIAL; + this.sendDialRequest(options); }, - dialEmergencyNumber: function(options, onerror) { + /** + * Dial an emergency number. + * + * @param number + * String containing the number to dial. + * @param clirMode + * Integer for showing/hidding the caller Id to the called party. + * @param uusInfo + * Integer doing something XXX TODO + */ + dialEmergencyNumber: function(options) { + let onerror = (function onerror(options, errorMsg) { + options.success = false; + options.errorMsg = errorMsg; + this.sendChromeMessage(options); + }).bind(this, options); + options.request = RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL ? REQUEST_DIAL_EMERGENCY_CALL : REQUEST_DIAL; if (this.radioState == GECKO_RADIOSTATE_OFF) { @@ -1636,20 +1636,20 @@ RilObject.prototype = { return; } + this.sendDialRequest(options); + }, + + sendDialRequest: function(options) { if (this._isCdma && Object.keys(this.currentCalls).length == 1) { // Make a Cdma 3way call. options.featureStr = options.number; this.sendCdmaFlashCommand(options); } else { - this.sendDialRequest(options); + this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial, + options); } }, - sendDialRequest: function(options) { - this.telephonyRequestQueue.push(options.request, this.sendRilRequestDial, - options); - }, - sendRilRequestDial: function(options) { let Buf = this.context.Buf; Buf.newParcel(options.request, options); @@ -2417,9 +2417,8 @@ RilObject.prototype = { return false; } - if (this._isEmergencyNumber(mmiString)) { - return false; - } + // TODO: Should take care of checking if the string is an emergency number + // in Bug 889737. See Bug 1023141 for more background. // In a call case. if (Object.getOwnPropertyNames(this.currentCalls).length > 0) { @@ -3309,38 +3308,18 @@ RilObject.prototype = { }, /** - * Check a given number against the list of emergency numbers provided by the RIL. + * Checks whether to temporarily suppress caller id for the call. * - * @param number - * The number to look up. + * @param mmi + * MMI full object. */ - _isEmergencyNumber: function(number) { - // Check ril provided numbers first. - let numbers = RIL_EMERGENCY_NUMBERS; - - if (numbers) { - numbers = numbers.split(","); - } else { - // No ecclist system property, so use our own list. - numbers = DEFAULT_EMERGENCY_NUMBERS; - } - - return numbers.indexOf(number) != -1; - }, - - /** - * Checks whether to temporarily suppress caller id for the call. - * - * @param mmi - * MMI full object. - */ - _isTemporaryModeCLIR: function(mmi) { - return (mmi && - mmi.serviceCode == MMI_SC_CLIR && - mmi.dialNumber && - (mmi.procedure == MMI_PROCEDURE_ACTIVATION || - mmi.procedure == MMI_PROCEDURE_DEACTIVATION)); - }, + _isTemporaryModeCLIR: function(mmi) { + return (mmi && + mmi.serviceCode == MMI_SC_CLIR && + mmi.dialNumber && + (mmi.procedure == MMI_PROCEDURE_ACTIVATION || + mmi.procedure == MMI_PROCEDURE_DEACTIVATION)); + }, /** * Report STK Service is running. @@ -4055,6 +4034,7 @@ RilObject.prototype = { for (let i in newCalls) { if (newCalls[i].state !== CALL_STATE_INCOMING) { callIndex = newCalls[i].callIndex; + newCalls[i].isEmergency = options.isEmergency; break; } } @@ -4105,9 +4085,9 @@ RilObject.prototype = { newCall.isOutgoing = true; } - // Set flag for outgoing emergency call. - newCall.isEmergency = newCall.isOutgoing && - this._isEmergencyNumber(newCall.number); + if (newCall.isEmergency === undefined) { + newCall.isEmergency = false; + } // Set flag for conference. newCall.isConference = newCall.isMpty ? true : false; @@ -14968,7 +14948,6 @@ let ContextPool = { setInitialOptions: function(aOptions) { DEBUG = DEBUG_WORKER || aOptions.debug; - RIL_EMERGENCY_NUMBERS = aOptions.rilEmergencyNumbers; let quirks = aOptions.quirks; RILQUIRKS_CALLSTATE_EXTRA_UINT32 = quirks.callstateExtraUint32; diff --git a/dom/telephony/gonk/TelephonyService.js b/dom/telephony/gonk/TelephonyService.js index 18a84015824e..ec8aebe94069 100644 --- a/dom/telephony/gonk/TelephonyService.js +++ b/dom/telephony/gonk/TelephonyService.js @@ -10,6 +10,7 @@ const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Promise.jsm"); +Cu.import("resource://gre/modules/systemlibs.js"); XPCOMUtils.defineLazyGetter(this, "RIL", function () { let obj = {}; @@ -50,6 +51,8 @@ const AUDIO_STATE_NAME = [ "PHONE_STATE_IN_CALL" ]; +const DEFAULT_EMERGENCY_NUMBERS = ["112", "911"]; + let DEBUG; function debug(s) { dump("TelephonyService: " + s + "\n"); @@ -330,6 +333,26 @@ TelephonyService.prototype = { }).bind(this)); }, + /** + * Check a given number against the list of emergency numbers provided by the + * RIL. + * + * @param aNumber + * The number to look up. + */ + _isEmergencyNumber: function(aNumber) { + // Check ril provided numbers first. + let numbers = libcutils.property_get("ril.ecclist") || + libcutils.property_get("ro.ril.ecclist"); + if (numbers) { + numbers = numbers.split(","); + } else { + // No ecclist system property, so use our own list. + numbers = DEFAULT_EMERGENCY_NUMBERS; + } + return numbers.indexOf(aNumber) != -1; + }, + /** * nsITelephonyService interface. */ @@ -488,9 +511,14 @@ TelephonyService.prototype = { this.notifyCallStateChanged(aClientId, parentCall); }; + let isEmergencyNumber = this._isEmergencyNumber(aNumber); + let msg = isEmergencyNumber ? + "dialEmergencyNumber" : + "dialNonEmergencyNumber"; this.isDialing = true; - this._getClient(aClientId).sendWorkerMessage("dial", { + this._getClient(aClientId).sendWorkerMessage(msg, { number: aNumber, + isEmergency: isEmergencyNumber, isDialEmergency: aIsEmergency }, (function(response) { this.isDialing = false; From 766ffaa6893c09ae9f89f21d3740ae037842db46 Mon Sep 17 00:00:00 2001 From: Hsin-Yi Tsai Date: Tue, 24 Jun 2014 18:47:12 +0800 Subject: [PATCH 42/94] Bug 1023141 - query ril.ecclist per dial request - part 2 - test case. r=aknow --- dom/telephony/test/marionette/head.js | 26 +++++++- .../test/marionette/test_emergency_label.js | 65 +++++++++++++++++-- 2 files changed, 83 insertions(+), 8 deletions(-) diff --git a/dom/telephony/test/marionette/head.js b/dom/telephony/test/marionette/head.js index dbf02e7053e4..14edaa2e3187 100644 --- a/dom/telephony/test/marionette/head.js +++ b/dom/telephony/test/marionette/head.js @@ -14,11 +14,19 @@ let emulator = (function() { let pendingCmdCount = 0; let originalRunEmulatorCmd = runEmulatorCmd; + let pendingShellCount = 0; + let originalRunEmulatorShell = runEmulatorShell; + // Overwritten it so people could not call this function directly. runEmulatorCmd = function() { throw "Use emulator.runCmdWithCallback(cmd, callback) instead of runEmulatorCmd"; }; + // Overwritten it so people could not call this function directly. + runEmulatorShell = function() { + throw "Use emulator.runShellCmd(cmd, callback) instead of runEmulatorShell"; + }; + function runCmd(cmd) { let deferred = Promise.defer(); @@ -44,6 +52,21 @@ let emulator = (function() { }); } + /** + * @return Promise + */ + function runShellCmd(aCommands) { + let deferred = Promise.defer(); + + ++pendingShellCount; + originalRunEmulatorShell(aCommands, function(aResult) { + --pendingShellCount; + deferred.resolve(aResult); + }); + + return deferred.promise; + } + /** * @return Promise */ @@ -53,7 +76,7 @@ let emulator = (function() { waitFor(function() { deferred.resolve(); }, function() { - return pendingCmdCount === 0; + return pendingCmdCount === 0 && pendingShellCount === 0; }); return deferred.promise; @@ -62,6 +85,7 @@ let emulator = (function() { return { runCmd: runCmd, runCmdWithCallback: runCmdWithCallback, + runShellCmd: runShellCmd, waitFinish: waitFinish }; }()); diff --git a/dom/telephony/test/marionette/test_emergency_label.js b/dom/telephony/test/marionette/test_emergency_label.js index caa929196321..41854468acdb 100644 --- a/dom/telephony/test/marionette/test_emergency_label.js +++ b/dom/telephony/test/marionette/test_emergency_label.js @@ -4,7 +4,43 @@ MARIONETTE_TIMEOUT = 60000; MARIONETTE_HEAD_JS = 'head.js'; -function testEmergencyLabel(number, emergency) { +const DEFAULT_ECC_LIST = "112,911"; + +function setEccListProperty(list) { + log("Set property ril.ecclist: " + list); + + let deferred = Promise.defer(); + try { + emulator.runShellCmd(["setprop","ril.ecclist", list]).then(function() { + deferred.resolve(list); + }); + } catch (e) { + deferred.reject(e); + } + return deferred.promise; +} + +function getEccListProperty() { + log("Get property ril.ecclist."); + + let deferred = Promise.defer(); + try { + emulator.runShellCmd(["getprop","ril.ecclist"]).then(function(aResult) { + let list = !aResult.length ? "" : aResult[0]; + deferred.resolve(list); + }); + } catch (e) { + deferred.reject(e); + } + return deferred.promise; +} + +function testEmergencyLabel(number, list) { + if (!list) { + list = DEFAULT_ECC_LIST; + } + let index = list.split(",").indexOf(number); + let emergency = index != -1; log("= testEmergencyLabel = " + number + " should be " + (emergency ? "emergency" : "normal") + " call"); @@ -23,12 +59,27 @@ function testEmergencyLabel(number, emergency) { } startTest(function() { - testEmergencyLabel("112", true) - .then(() => testEmergencyLabel("911", true)) - .then(() => testEmergencyLabel("0912345678", false)) - .then(() => testEmergencyLabel("777", false)) - .then(null, () => { - ok(false, 'promise rejects during test.'); + let origEccList; + let eccList; + + getEccListProperty() + .then(list => { + origEccList = eccList = list; + }) + .then(() => testEmergencyLabel("112", eccList)) + .then(() => testEmergencyLabel("911", eccList)) + .then(() => testEmergencyLabel("0912345678", eccList)) + .then(() => testEmergencyLabel("777", eccList)) + .then(() => { + eccList = "777,119"; + return setEccListProperty(eccList); + }) + .then(() => testEmergencyLabel("777", eccList)) + .then(() => testEmergencyLabel("119", eccList)) + .then(() => testEmergencyLabel("112", eccList)) + .then(() => setEccListProperty(origEccList)) + .then(null, error => { + ok(false, 'promise rejects during test: ' + error); }) .then(finish); }); From 62a5a3ddf4a6e1d4965f8ac372f49aa64792df79 Mon Sep 17 00:00:00 2001 From: Walter Litwinczyk Date: Tue, 24 Jun 2014 15:35:07 -0700 Subject: [PATCH 43/94] Bug 1004375 - Removed use of legacy skia compatible device API - r=gw280 --- gfx/2d/DrawTargetSkia.cpp | 15 ++++++++++++--- gfx/skia/trunk/include/config/SkUserConfig.h | 1 - 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gfx/2d/DrawTargetSkia.cpp b/gfx/2d/DrawTargetSkia.cpp index 7a8ba66636bd..f95f4ed156dc 100644 --- a/gfx/2d/DrawTargetSkia.cpp +++ b/gfx/2d/DrawTargetSkia.cpp @@ -721,9 +721,18 @@ DrawTargetSkia::CopySurface(SourceSurface *aSurface, bool DrawTargetSkia::Init(const IntSize &aSize, SurfaceFormat aFormat) { - SkAutoTUnref device(new SkBitmapDevice(GfxFormatToSkiaConfig(aFormat), - aSize.width, aSize.height, - aFormat == SurfaceFormat::B8G8R8X8)); + SkAlphaType alphaType = (aFormat == SurfaceFormat::B8G8R8X8) ? + kOpaque_SkAlphaType : kPremul_SkAlphaType; + + SkImageInfo skiInfo = SkImageInfo::Make( + aSize.width, aSize.height, + GfxFormatToSkiaColorType(aFormat), + alphaType); + + SkAutoTUnref device(SkBitmapDevice::Create(skiInfo)); + if (!device) { + return false; + } SkBitmap bitmap = device->accessBitmap(true); if (!bitmap.allocPixels()) { diff --git a/gfx/skia/trunk/include/config/SkUserConfig.h b/gfx/skia/trunk/include/config/SkUserConfig.h index 89f61b6031ec..84b925ee8848 100644 --- a/gfx/skia/trunk/include/config/SkUserConfig.h +++ b/gfx/skia/trunk/include/config/SkUserConfig.h @@ -204,4 +204,3 @@ #endif #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 -#define SK_SUPPORT_LEGACY_COMPATIBLEDEVICE_CONFIG 1 From f141d7eb5d82c19cdd38aa578af9eb85faa35591 Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 2 Jul 2014 22:20:52 +0100 Subject: [PATCH 44/94] Bug 1032136 - Make mozrunner 6 work for on-device B2G testing, r=ahal. --- .../mozrunner/mozrunner/application.py | 31 +++++--- .../mozrunner/mozrunner/base/device.py | 18 ++++- .../mozrunner/mozrunner/devices/base.py | 77 ++++++++++++++++++- .../mozrunner/mozrunner/devices/emulator.py | 73 ++++++------------ .../mozbase/mozrunner/mozrunner/runners.py | 30 +++++++- 5 files changed, 167 insertions(+), 62 deletions(-) diff --git a/testing/mozbase/mozrunner/mozrunner/application.py b/testing/mozbase/mozrunner/mozrunner/application.py index 95e309c6f4f8..ac0e89fc4502 100644 --- a/testing/mozbase/mozrunner/mozrunner/application.py +++ b/testing/mozbase/mozrunner/mozrunner/application.py @@ -6,7 +6,6 @@ from distutils.spawn import find_executable import glob import os import posixpath -import sys from mozdevice import DeviceManagerADB from mozprofile import ( @@ -41,15 +40,13 @@ class B2GContext(object): def __init__(self, b2g_home=None, adb_path=None): self.homedir = b2g_home or os.environ.get('B2G_HOME') - if not self.homedir: - raise EnvironmentError('Must define B2G_HOME or pass the b2g_home parameter') - if not os.path.isdir(self.homedir): + if self.homedir is not None and not os.path.isdir(self.homedir): raise OSError('Homedir \'%s\' does not exist!' % self.homedir) self._adb = adb_path - self.update_tools = os.path.join(self.homedir, 'tools', 'update-tools') - self.fastboot = self.which('fastboot') + self._update_tools = None + self._fastboot = None self.remote_binary = '/system/bin/b2g.sh' self.remote_process = '/system/b2g/b2g' @@ -58,6 +55,18 @@ class B2GContext(object): self.remote_profiles_ini = '/data/b2g/mozilla/profiles.ini' self.remote_test_root = '/data/local/tests' + @property + def fastboot(self): + if self._fastboot is None: + self._fastboot = self.which('fastboot') + return self._fastboot + + @property + def update_tools(self): + if self._update_tools is None: + self._update_tools = os.path.join(self.homedir, 'tools', 'update-tools') + return self._update_tools + @property def adb(self): if not self._adb: @@ -73,7 +82,7 @@ class B2GContext(object): @property def bindir(self): - if not self._bindir: + if self._bindir is None and self.homedir is not None: # TODO get this via build configuration path = os.path.join(self.homedir, 'out', 'host', '*', 'bin') self._bindir = glob.glob(path)[0] @@ -93,10 +102,12 @@ class B2GContext(object): def which(self, binary): - if self.bindir not in sys.path: - sys.path.insert(0, self.bindir) + paths = os.environ.get('PATH', {}).split(os.pathsep) + if self.bindir is not None and os.path.abspath(self.bindir) not in paths: + paths.insert(0, os.path.abspath(self.bindir)) + os.environ['PATH'] = os.pathsep.join(paths) - return find_executable(binary, os.pathsep.join(sys.path)) + return find_executable(binary) def stop_application(self): self.dm.shellCheckOutput(['stop', 'b2g']) diff --git a/testing/mozbase/mozrunner/mozrunner/base/device.py b/testing/mozbase/mozrunner/mozrunner/base/device.py index 6904fb8a5a42..0fb4658f293f 100644 --- a/testing/mozbase/mozrunner/mozrunner/base/device.py +++ b/testing/mozbase/mozrunner/mozrunner/base/device.py @@ -12,6 +12,7 @@ import tempfile import time from .runner import BaseRunner +from ..devices import Emulator class DeviceRunner(BaseRunner): """ @@ -60,9 +61,21 @@ class DeviceRunner(BaseRunner): return cmd def start(self, *args, **kwargs): - if not self.device.proc: + if isinstance(self.device, Emulator) and not self.device.connected: self.device.start() + self.device.connect() self.device.setup_profile(self.profile) + + # TODO: this doesn't work well when the device is running but dropped + # wifi for some reason. It would be good to probe the state of the device + # to see if we have the homescreen running, or something, before waiting here + self.device.wait_for_net() + + if not isinstance(self.device, Emulator): + self.device.reboot() + + if not self.device.wait_for_net(): + raise Exception("Network did not come up when starting device") self.app_ctx.stop_application() BaseRunner.start(self, *args, **kwargs) @@ -76,6 +89,9 @@ class DeviceRunner(BaseRunner): else: print("timed out waiting for '%s' process to start" % self.app_ctx.remote_process) + if not self.device.wait_for_net(): + raise Exception("Failed to get a network connection") + def on_output(self, line): match = re.findall(r"TEST-START \| ([^\s]*)", line) if match: diff --git a/testing/mozbase/mozrunner/mozrunner/devices/base.py b/testing/mozbase/mozrunner/mozrunner/devices/base.py index 750c1dc9669e..1e5204ef0793 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/base.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/base.py @@ -5,6 +5,8 @@ from ConfigParser import ( import datetime import os import posixpath +import re +import shutil import socket import subprocess import tempfile @@ -12,12 +14,17 @@ import time import traceback from mozdevice import DMError +from mozprocess import ProcessHandler class Device(object): - def __init__(self, app_ctx, restore=True): + connected = False + + def __init__(self, app_ctx, logdir=None, serial=None, restore=True): self.app_ctx = app_ctx self.dm = self.app_ctx.dm self.restore = restore + self.serial = serial + self.logdir = logdir self.added_files = set() self.backup_files = set() @@ -106,6 +113,38 @@ class Device(object): self.backup_file(self.app_ctx.remote_profiles_ini) self.dm.pushFile(new_profiles_ini.name, self.app_ctx.remote_profiles_ini) + def _get_online_devices(self): + return [d[0] for d in self.dm.devices() if d[1] != 'offline' if not d[0].startswith('emulator')] + + def connect(self): + """ + Connects to a running device. If no serial was specified in the + constructor, defaults to the first entry in `adb devices`. + """ + if self.connected: + return + + serial = self.serial or self._get_online_devices()[0] + self.dm._deviceSerial = serial + self.dm.connect() + self.connected = True + + if self.logdir: + # save logcat + logcat_log = os.path.join(self.logdir, '%s.log' % serial) + if os.path.isfile(logcat_log): + self._rotate_log(logcat_log) + logcat_args = [self.app_ctx.adb, '-s', '%s' % serial, + 'logcat', '-v', 'threadtime'] + self.logcat_proc = ProcessHandler(logcat_args, logfile=logcat_log) + self.logcat_proc.run() + + def reboot(self): + """ + Reboots the device via adb. + """ + self.dm.reboot(wait=True) + def install_busybox(self, busybox): """ Installs busybox on the device. @@ -139,6 +178,22 @@ class Device(object): self.dm.forward('tcp:%d' % local_port, 'tcp:%d' % remote_port) return local_port + def wait_for_net(self): + active = False + time_out = 0 + while not active and time_out < 40: + proc = subprocess.Popen([self.dm._adbPath, 'shell', '/system/bin/netcfg'], stdout=subprocess.PIPE) + proc.stdout.readline() # ignore first line + line = proc.stdout.readline() + while line != "": + if (re.search(r'UP\s+[1-9]\d{0,2}\.\d{1,3}\.\d{1,3}\.\d{1,3}', line)): + active = True + break + line = proc.stdout.readline() + time_out += 1 + time.sleep(1) + return active + def wait_for_port(self, port, timeout=300): starttime = datetime.datetime.now() while datetime.datetime.now() - starttime < datetime.timedelta(seconds=timeout): @@ -196,6 +251,26 @@ class Device(object): # Remove the test profile self.dm.removeDir(self.app_ctx.remote_profile) + def _rotate_log(self, srclog, index=1): + """ + Rotate a logfile, by recursively rotating logs further in the sequence, + deleting the last file if necessary. + """ + basename = os.path.basename(srclog) + basename = basename[:-len('.log')] + if index > 1: + basename = basename[:-len('.1')] + basename = '%s.%d.log' % (basename, index) + + destlog = os.path.join(self.logdir, basename) + if os.path.isfile(destlog): + if index == 3: + os.remove(destlog) + else: + self._rotate_log(destlog, index+1) + shutil.move(srclog, destlog) + + class ProfileConfigParser(RawConfigParser): """ diff --git a/testing/mozbase/mozrunner/mozrunner/devices/emulator.py b/testing/mozbase/mozrunner/mozrunner/devices/emulator.py index a678befb2c26..f2a3018dfa9e 100644 --- a/testing/mozbase/mozrunner/mozrunner/devices/emulator.py +++ b/testing/mozbase/mozrunner/mozrunner/devices/emulator.py @@ -46,8 +46,8 @@ class Emulator(Device): telnet = None def __init__(self, app_ctx, arch, resolution=None, sdcard=None, userdata=None, - logdir=None, no_window=None, binary=None): - Device.__init__(self, app_ctx) + no_window=None, binary=None, **kwargs): + Device.__init__(self, app_ctx, **kwargs) self.arch = ArchContext(arch, self.app_ctx, binary=binary) self.resolution = resolution or '320x480' @@ -58,7 +58,6 @@ class Emulator(Device): if userdata: self.userdata = tempfile.NamedTemporaryFile(prefix='qemu-userdata') shutil.copyfile(userdata, self.userdata) - self.logdir = logdir self.no_window = no_window self.battery = EmulatorBattery(self) @@ -86,14 +85,14 @@ class Emulator(Device): '-qemu'] + self.arch.extra_args) return qemu_args - def _get_online_devices(self): - return set([d[0] for d in self.dm.devices() if d[1] != 'offline']) - def start(self): """ Starts a new emulator. """ - original_devices = self._get_online_devices() + if self.proc: + return + + original_devices = set(self._get_online_devices()) qemu_log = None qemu_proc_args = {} @@ -108,39 +107,34 @@ class Emulator(Device): self.proc = ProcessHandler(self.args, **qemu_proc_args) self.proc.run() - devices = self._get_online_devices() + devices = set(self._get_online_devices()) now = datetime.datetime.now() while (devices - original_devices) == set([]): time.sleep(1) if datetime.datetime.now() - now > datetime.timedelta(seconds=60): raise TimeoutException('timed out waiting for emulator to start') - devices = self._get_online_devices() - self.connect(devices - original_devices) + devices = set(self._get_online_devices()) + devices = devices - original_devices + self.serial = devices.pop() + self.connect() - def connect(self, devices=None): - """ - Connects to an already running emulator. - """ - devices = list(devices or self._get_online_devices()) - serial = [d for d in devices if d.startswith('emulator')][0] - self.dm._deviceSerial = serial - self.dm.connect() - self.port = int(serial[serial.rindex('-')+1:]) + def _get_online_devices(self): + return set([d[0] for d in self.dm.devices() if d[1] != 'offline' if d[0].startswith('emulator')]) + def connect(self): + """ + Connects to a running device. If no serial was specified in the + constructor, defaults to the first entry in `adb devices`. + """ + if self.connected: + return + + Device.connect(self) + + self.port = int(self.serial[self.serial.rindex('-')+1:]) self.geo.set_default_location() self.screen.initialize() - print self.logdir - if self.logdir: - # save logcat - logcat_log = os.path.join(self.logdir, '%s.log' % serial) - if os.path.isfile(logcat_log): - self._rotate_log(logcat_log) - logcat_args = [self.app_ctx.adb, '-s', '%s' % serial, - 'logcat', '-v', 'threadtime'] - self.logcat_proc = ProcessHandler(logcat_args, logfile=logcat_log) - self.logcat_proc.run() - # setup DNS fix for networking self.app_ctx.dm.shellCheckOutput(['setprop', 'net.dns1', '10.0.2.3']) @@ -173,25 +167,6 @@ class Emulator(Device): if self.sdcard and os.path.isfile(self.sdcard): os.remove(self.sdcard) - def _rotate_log(self, srclog, index=1): - """ - Rotate a logfile, by recursively rotating logs further in the sequence, - deleting the last file if necessary. - """ - basename = os.path.basename(srclog) - basename = basename[:-len('.log')] - if index > 1: - basename = basename[:-len('.1')] - basename = '%s.%d.log' % (basename, index) - - destlog = os.path.join(self.logdir, basename) - if os.path.isfile(destlog): - if index == 3: - os.remove(destlog) - else: - self._rotate_log(destlog, index+1) - shutil.move(srclog, destlog) - # TODO this function is B2G specific and shouldn't live here @uses_marionette def wait_for_system_message(self, marionette): diff --git a/testing/mozbase/mozrunner/mozrunner/runners.py b/testing/mozbase/mozrunner/mozrunner/runners.py index a2cd82deb266..379d6a4dbbac 100644 --- a/testing/mozbase/mozrunner/mozrunner/runners.py +++ b/testing/mozbase/mozrunner/mozrunner/runners.py @@ -9,7 +9,7 @@ used Mozilla applications, such as Firefox or B2G emulator. from .application import get_app_context from .base import DeviceRunner, GeckoRuntimeRunner -from .devices import Emulator +from .devices import Emulator, Device def Runner(*args, **kwargs): @@ -143,11 +143,39 @@ def B2GEmulatorRunner(arch='arm', device_args=device_args, **kwargs) +def B2GDeviceRunner(b2g_home=None, + adb_path=None, + logdir=None, + serial=None, + **kwargs): + """ + Create a B2G device runner. + + :param b2g_home: Path to root B2G repository. + :param logdir: Path to save logfiles such as logcat. + :param serial: Serial of device to connect to as seen in `adb devices`. + :param profile: Profile object to use. + :param env: Environment variables to pass into the b2g.sh process. + :param clean_profile: If True, restores profile back to original state. + :param process_class: Class used to launch the b2g.sh process. + :param process_args: Arguments to pass into the b2g.sh process. + :param symbols_path: Path to symbol files used for crash analysis. + :returns: A DeviceRunner for B2G devices. + """ + kwargs['app_ctx'] = get_app_context('b2g')(b2g_home, adb_path=adb_path) + device_args = { 'app_ctx': kwargs['app_ctx'], + 'logdir': logdir, + 'serial': serial } + return DeviceRunner(device_class=Device, + device_args=device_args, + **kwargs) + runners = { 'default': Runner, 'b2g_desktop': B2GDesktopRunner, 'b2g_emulator': B2GEmulatorRunner, + 'b2g_device': B2GDeviceRunner, 'firefox': FirefoxRunner, 'metro': MetroRunner, 'thunderbird': ThunderbirdRunner, From a573f1de39c162a6f71dd0418bcaf7c2136f6a20 Mon Sep 17 00:00:00 2001 From: James Graham Date: Wed, 2 Jul 2014 22:20:53 +0100 Subject: [PATCH 45/94] Bug 1033458 - Update mozrunner version, r=ahal. --- testing/mozbase/mozrunner/setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mozbase/mozrunner/setup.py b/testing/mozbase/mozrunner/setup.py index 4c317821ce29..8cd987e098eb 100644 --- a/testing/mozbase/mozrunner/setup.py +++ b/testing/mozbase/mozrunner/setup.py @@ -6,7 +6,7 @@ import sys from setuptools import setup, find_packages PACKAGE_NAME = 'mozrunner' -PACKAGE_VERSION = '6.0' +PACKAGE_VERSION = '6.1' desc = """Reliable start/stop/configuration of Mozilla Applications (Firefox, Thunderbird, etc.)""" From 72193be0b011f3c5f7f198e5b98620063e2cee01 Mon Sep 17 00:00:00 2001 From: Sid Stamm Date: Wed, 2 Jul 2014 14:39:27 -0700 Subject: [PATCH 46/94] Bug 991972 - Catch and compensate for expected extra test successes in test_CSP_frameancestors.html. (r=grobinson) --- .../test/csp/test_CSP_frameancestors.html | 57 ++++++++++++++----- 1 file changed, 44 insertions(+), 13 deletions(-) diff --git a/content/base/test/csp/test_CSP_frameancestors.html b/content/base/test/csp/test_CSP_frameancestors.html index abac701afd12..59d4f5270a54 100644 --- a/content/base/test/csp/test_CSP_frameancestors.html +++ b/content/base/test/csp/test_CSP_frameancestors.html @@ -27,7 +27,29 @@ var framesThatShouldLoad = { //abb2_block: -1, /* innermost frame denies a */ }; -var expectedViolationsLeft = 6; +// we normally expect _6_ violations (6 test cases that cause blocks), but many +// of the cases cause violations due to the // origin of the test harness (same +// as 'a'). When the violation is cross-origin, the URI passed to the observers +// is null (see bug 846978). This means we can't tell if it's part of the test +// case or if it is the test harness frame (also origin 'a'). +// As a result, we'll get an extra violation for the following cases: +// ab_block "frame-ancestors 'none'" (outer frame and test harness) +// aba2_block "frame-ancestors b" (outer frame and test harness) +// abb2_block "frame-ancestors b" (outer frame and test harness) +// +// and while we can detect the test harness check for this one case since +// the violations are not cross-origin and we get the URI: +// aba2_block "frame-ancestors b" (outer frame and test harness) +// +// we can't for these other ones: +// ab_block "frame-ancestors 'none'" (outer frame and test harness) +// abb2_block "frame-ancestors b" (outer frame and test harness) +// +// so that results in 2 extra violation notifications due to the test harness. +// expected = 6, total = 8 +// +// Number of tests that pass for this file should be 12 (8 violations 4 loads) +var expectedViolationsLeft = 8; // This is used to watch the blocked data bounce off CSP and allowed data // get sent out to the wire. @@ -36,22 +58,31 @@ function examiner() { } examiner.prototype = { observe: function(subject, topic, data) { - // subject should be an nsURI, and should be either allowed or blocked. - if (!SpecialPowers.can_QI(subject)) + // subject should be an nsURI... though could be null since CSP + // prohibits cross-origin URI reporting during frame ancestors checks. + if (subject && !SpecialPowers.can_QI(subject)) return; + var asciiSpec = subject; + + try { + asciiSpec = SpecialPowers.getPrivilegedProps( + SpecialPowers.do_QueryInterface(subject, "nsIURI"), + "asciiSpec"); + + // skip checks on the test harness -- can't do this skipping for + // cross-origin blocking since the observer doesn't get the URI. This + // can cause this test to over-succeed (but only in specific cases). + if (asciiSpec.contains("test_CSP_frameancestors.html")) { + return; + } + } catch (ex) { + // was not an nsIURI, so it was probably a cross-origin report. + } + + if (topic === "csp-on-violate-policy") { //these were blocked... record that they were blocked - var asciiSpec = subject; - - // Except CSP prohibits cross-origin URI reporting during frame ancestors - // checks so this URI could be null. - try { - asciiSpec = SpecialPowers.getPrivilegedProps(SpecialPowers.do_QueryInterface(subject, "nsIURI"), "asciiSpec"); - } catch (ex) { - // was not an nsIURI, so it was probably a cross-origin report. - } - window.frameBlocked(asciiSpec, data); } }, From 35050325e5cdb5eb73899c6ef3d292e0f72783b2 Mon Sep 17 00:00:00 2001 From: Sid Stamm Date: Wed, 2 Jul 2014 14:39:38 -0700 Subject: [PATCH 47/94] Bug 1031658 - [CSP] Fix userpass removal in PermitsAncestry() and properly handle PermitsAncestry() failures. (r=bz) --- content/base/src/nsCSPContext.cpp | 26 +++++++++++--------------- content/base/src/nsDocument.cpp | 3 +-- 2 files changed, 12 insertions(+), 17 deletions(-) diff --git a/content/base/src/nsCSPContext.cpp b/content/base/src/nsCSPContext.cpp index 1fe8527b7140..f4d4a856633f 100644 --- a/content/base/src/nsCSPContext.cpp +++ b/content/base/src/nsCSPContext.cpp @@ -971,13 +971,9 @@ nsCSPContext::AsyncReportViolation(nsISupports* aBlockedContentSource, * In order to determine the URI of the parent document (one causing the load * of this protected document), this function obtains the docShellTreeItem, * then walks up the hierarchy until it finds a privileged (chrome) tree item. - * Getting the parent's URI looks like this in pseudocode: + * Getting the a tree item's URI looks like this in pseudocode: * - * nsIDocShell->QI(nsIInterfaceRequestor) - * ->GI(nsIDocShellTreeItem) - * ->QI(nsIInterfaceRequestor) - * ->GI(nsIWebNavigation) - * ->GetCurrentURI(); + * nsIDocShellTreeItem->GetDocument()->GetDocumentURI(); * * aDocShell is the docShell for the protected document. */ @@ -999,21 +995,18 @@ nsCSPContext::PermitsAncestry(nsIDocShell* aDocShell, bool* outPermitsAncestry) nsCOMPtr ir(do_QueryInterface(aDocShell)); nsCOMPtr treeItem(do_GetInterface(ir)); nsCOMPtr parentTreeItem; - nsCOMPtr webNav; nsCOMPtr currentURI; nsCOMPtr uriClone; // iterate through each docShell parent item while (NS_SUCCEEDED(treeItem->GetParent(getter_AddRefs(parentTreeItem))) && parentTreeItem != nullptr) { - ir = do_QueryInterface(parentTreeItem); - NS_ASSERTION(ir, "Could not QI docShellTreeItem to nsIInterfaceRequestor"); - webNav = do_GetInterface(ir); - NS_ENSURE_TRUE(webNav, NS_ERROR_FAILURE); + nsIDocument* doc = parentTreeItem->GetDocument(); + NS_ASSERTION(doc, "Could not get nsIDocument from nsIDocShellTreeItem in nsCSPContext::PermitsAncestry"); + NS_ENSURE_TRUE(doc, NS_ERROR_FAILURE); - rv = webNav->GetCurrentURI(getter_AddRefs(currentURI)); - NS_ENSURE_SUCCESS(rv, rv); + currentURI = doc->GetDocumentURI(); if (currentURI) { // stop when reaching chrome @@ -1025,8 +1018,11 @@ nsCSPContext::PermitsAncestry(nsIDocShell* aDocShell, bool* outPermitsAncestry) // delete the userpass from the URI. rv = currentURI->CloneIgnoringRef(getter_AddRefs(uriClone)); NS_ENSURE_SUCCESS(rv, rv); - rv = uriClone->SetUserPass(EmptyCString()); - NS_ENSURE_SUCCESS(rv, rv); + + // We don't care if this succeeds, just want to delete a userpass if + // there was one. + uriClone->SetUserPass(EmptyCString()); + #ifdef PR_LOGGING { nsAutoCString spec; diff --git a/content/base/src/nsDocument.cpp b/content/base/src/nsDocument.cpp index cae261986e7c..5aef6ac19298 100644 --- a/content/base/src/nsDocument.cpp +++ b/content/base/src/nsDocument.cpp @@ -2826,9 +2826,8 @@ nsDocument::InitCSP(nsIChannel* aChannel) // PermitsAncestry sends violation reports when necessary rv = csp->PermitsAncestry(docShell, &safeAncestry); - NS_ENSURE_SUCCESS(rv, rv); - if (!safeAncestry) { + if (NS_FAILED(rv) || !safeAncestry) { #ifdef PR_LOGGING PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("CSP doesn't like frame's ancestry, not loading.")); From f87d6957804ba0dbc0a1da187e26cfca00f51c68 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Wed, 2 Jul 2014 14:45:59 -0700 Subject: [PATCH 48/94] Bug 1032364 - Change gralloc buffer's key to 64bit r=jmuizelaar --- gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp | 12 ++++++------ gfx/layers/ipc/ShadowLayerUtilsGralloc.h | 2 +- gfx/layers/ipc/SharedBufferManagerChild.cpp | 4 ++-- gfx/layers/ipc/SharedBufferManagerChild.h | 4 ++-- gfx/layers/ipc/SharedBufferManagerParent.cpp | 10 +++++----- gfx/layers/ipc/SharedBufferManagerParent.h | 6 +++--- 6 files changed, 19 insertions(+), 19 deletions(-) diff --git a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp index 62ba5a5e6ac8..e5d297ea6adb 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.cpp @@ -44,7 +44,7 @@ ParamTraits::Write(Message* aMsg, const paramType& aParam) { aMsg->WriteInt(aParam.mOwner); - aMsg->WriteInt32(aParam.mKey); + aMsg->WriteInt64(aParam.mKey); } bool @@ -52,9 +52,9 @@ ParamTraits::Read(const Message* aMsg, void** aIter, paramType* aParam) { int owner; - int index; + int64_t index; if (!aMsg->ReadInt(aIter, &owner) || - !aMsg->ReadInt32(aIter, &index)) { + !aMsg->ReadInt64(aIter, &index)) { printf_stderr("ParamTraits::Read() failed to read a message\n"); return false; } @@ -95,7 +95,7 @@ ParamTraits::Write(Message* aMsg, flattenable->flatten(data, nbytes, fds, nfds); #endif aMsg->WriteInt(aParam.mRef.mOwner); - aMsg->WriteInt32(aParam.mRef.mKey); + aMsg->WriteInt64(aParam.mRef.mKey); aMsg->WriteSize(nbytes); aMsg->WriteSize(nfds); @@ -116,10 +116,10 @@ ParamTraits::Read(const Message* aMsg, size_t nfds; const char* data; int owner; - int index; + int64_t index; if (!aMsg->ReadInt(aIter, &owner) || - !aMsg->ReadInt32(aIter, &index) || + !aMsg->ReadInt64(aIter, &index) || !aMsg->ReadSize(aIter, &nbytes) || !aMsg->ReadSize(aIter, &nfds) || !aMsg->ReadBytes(aIter, &data, nbytes)) { diff --git a/gfx/layers/ipc/ShadowLayerUtilsGralloc.h b/gfx/layers/ipc/ShadowLayerUtilsGralloc.h index 99b664f08873..0200af9e86f3 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsGralloc.h +++ b/gfx/layers/ipc/ShadowLayerUtilsGralloc.h @@ -26,7 +26,7 @@ class TextureHost; struct GrallocBufferRef { base::ProcessId mOwner; - int mKey; + int64_t mKey; GrallocBufferRef() : mOwner(0) diff --git a/gfx/layers/ipc/SharedBufferManagerChild.cpp b/gfx/layers/ipc/SharedBufferManagerChild.cpp index 348505b71b35..fda8517d9631 100644 --- a/gfx/layers/ipc/SharedBufferManagerChild.cpp +++ b/gfx/layers/ipc/SharedBufferManagerChild.cpp @@ -321,7 +321,7 @@ bool SharedBufferManagerChild::RecvDropGrallocBuffer(const mozilla::layers::Mayb { #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC NS_ASSERTION(handle.type() == mozilla::layers::MaybeMagicGrallocBufferHandle::TGrallocBufferRef, "shouldn't go this way"); - int bufferKey = handle.get_GrallocBufferRef().mKey; + int64_t bufferKey = handle.get_GrallocBufferRef().mKey; { MutexAutoLock lock(mBufferMutex); @@ -334,7 +334,7 @@ bool SharedBufferManagerChild::RecvDropGrallocBuffer(const mozilla::layers::Mayb #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC android::sp -SharedBufferManagerChild::GetGraphicBuffer(int key) +SharedBufferManagerChild::GetGraphicBuffer(int64_t key) { MutexAutoLock lock(mBufferMutex); if (mBuffers.count(key) == 0) diff --git a/gfx/layers/ipc/SharedBufferManagerChild.h b/gfx/layers/ipc/SharedBufferManagerChild.h index 681101e4d6b5..30900ba99ea4 100644 --- a/gfx/layers/ipc/SharedBufferManagerChild.h +++ b/gfx/layers/ipc/SharedBufferManagerChild.h @@ -107,7 +107,7 @@ public: virtual bool RecvDropGrallocBuffer(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle); #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC - android::sp GetGraphicBuffer(int index); + android::sp GetGraphicBuffer(int64_t index); #endif base::Thread* GetThread() const; @@ -155,7 +155,7 @@ protected: DeallocGrallocBufferSync(const mozilla::layers::MaybeMagicGrallocBufferHandle& handle); #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC - std::map > mBuffers; + std::map > mBuffers; Mutex mBufferMutex; #endif }; diff --git a/gfx/layers/ipc/SharedBufferManagerParent.cpp b/gfx/layers/ipc/SharedBufferManagerParent.cpp index 0a72bb66b765..53df354c535a 100644 --- a/gfx/layers/ipc/SharedBufferManagerParent.cpp +++ b/gfx/layers/ipc/SharedBufferManagerParent.cpp @@ -32,7 +32,7 @@ namespace layers { map SharedBufferManagerParent::sManagers; StaticAutoPtr SharedBufferManagerParent::sManagerMonitor; -Atomic SharedBufferManagerParent::sBufferKey(0); +uint64_t SharedBufferManagerParent::sBufferKey(0); #ifdef MOZ_WIDGET_GONK class GrallocReporter MOZ_FINAL : public nsIMemoryReporter @@ -48,7 +48,7 @@ public: base::ProcessId pid = it->first; SharedBufferManagerParent *mgr = it->second; - std::map >::iterator buf_it; + std::map >::iterator buf_it; for (buf_it = mgr->mBuffers.begin(); buf_it != mgr->mBuffers.end(); buf_it++) { nsresult rv; android::sp gb = buf_it->second; @@ -204,7 +204,7 @@ bool SharedBufferManagerParent::RecvDropGrallocBuffer(const mozilla::layers::May { #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC NS_ASSERTION(handle.type() == MaybeMagicGrallocBufferHandle::TGrallocBufferRef, "We shouldn't interact with the real buffer!"); - int bufferKey = handle.get_GrallocBufferRef().mKey; + int64_t bufferKey = handle.get_GrallocBufferRef().mKey; sp buf = GetGraphicBuffer(bufferKey); MOZ_ASSERT(buf.get()); MutexAutoLock lock(mBuffersMutex); @@ -243,7 +243,7 @@ void SharedBufferManagerParent::DropGrallocBufferImpl(mozilla::layers::SurfaceDe { #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC MutexAutoLock lock(mBuffersMutex); - int key = -1; + int64_t key = -1; MaybeMagicGrallocBufferHandle handle; if (aDesc.type() == SurfaceDescriptor::TNewSurfaceDescriptorGralloc) handle = aDesc.get_NewSurfaceDescriptorGralloc().buffer(); @@ -276,7 +276,7 @@ SharedBufferManagerParent* SharedBufferManagerParent::GetInstance(ProcessId id) #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC android::sp -SharedBufferManagerParent::GetGraphicBuffer(int key) +SharedBufferManagerParent::GetGraphicBuffer(int64_t key) { MutexAutoLock lock(mBuffersMutex); if (mBuffers.count(key) == 1) { diff --git a/gfx/layers/ipc/SharedBufferManagerParent.h b/gfx/layers/ipc/SharedBufferManagerParent.h index eeb94be0d14d..033b04279d4f 100644 --- a/gfx/layers/ipc/SharedBufferManagerParent.h +++ b/gfx/layers/ipc/SharedBufferManagerParent.h @@ -46,7 +46,7 @@ public: */ static SharedBufferManagerParent* GetInstance(ProcessId id); #ifdef MOZ_HAVE_SURFACEDESCRIPTORGRALLOC - android::sp GetGraphicBuffer(int key); + android::sp GetGraphicBuffer(int64_t key); static android::sp GetGraphicBuffer(GrallocBufferRef aRef); #endif /** @@ -95,14 +95,14 @@ protected: /** * Buffers owned by this SharedBufferManager pair */ - std::map > mBuffers; + std::map > mBuffers; Mutex mBuffersMutex; #endif Transport* mTransport; base::ProcessId mOwner; base::Thread* mThread; - static mozilla::Atomic sBufferKey; + static uint64_t sBufferKey; static StaticAutoPtr sManagerMonitor; }; From 03cdc19fec3a87983b119adfcde43ad4b7f0498a Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 2 Jul 2014 15:03:29 -0700 Subject: [PATCH 49/94] Backed out 3 changesets (bug 956961) for non-unified build bustage Backed out changeset f1be89cb58b9 (bug 956961) Backed out changeset 272b01e4f856 (bug 956961) Backed out changeset 56907af18c66 (bug 956961) --- dom/ipc/ContentChild.cpp | 17 +++++------ dom/ipc/ContentChild.h | 4 +-- dom/ipc/ContentParent.cpp | 20 ++----------- dom/ipc/ContentParent.h | 2 +- dom/ipc/PContent.ipdl | 2 +- ipc/glue/FileDescriptorUtils.cpp | 4 +-- security/sandbox/linux/Sandbox.cpp | 9 ++++++ xpcom/base/nsGZFileWriter.cpp | 9 ++---- xpcom/base/nsIGZFileWriter.idl | 10 +------ xpcom/base/nsIMemoryReporter.idl | 13 ++++---- xpcom/base/nsMemoryInfoDumper.cpp | 41 ++++++-------------------- xpcom/base/nsMemoryInfoDumper.h | 8 ----- xpcom/base/nsMemoryReporterManager.cpp | 23 ++++----------- 13 files changed, 48 insertions(+), 114 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 29b40df5f774..e01be71c85dc 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -59,7 +59,6 @@ #include "nsIMutable.h" #include "nsIObserverService.h" #include "nsIScriptSecurityManager.h" -#include "nsMemoryInfoDumper.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" #include "nsXULAppAPI.h" @@ -193,22 +192,22 @@ public: NS_DECL_ISUPPORTS MemoryReportRequestChild(uint32_t aGeneration, bool aAnonymize, - const FileDescriptor& aDMDFile); + const nsAString& aDMDDumpIdent); NS_IMETHOD Run(); private: virtual ~MemoryReportRequestChild(); uint32_t mGeneration; bool mAnonymize; - FileDescriptor mDMDFile; + nsString mDMDDumpIdent; }; NS_IMPL_ISUPPORTS(MemoryReportRequestChild, nsIRunnable) MemoryReportRequestChild::MemoryReportRequestChild( - uint32_t aGeneration, bool aAnonymize, const FileDescriptor& aDMDFile) + uint32_t aGeneration, bool aAnonymize, const nsAString& aDMDDumpIdent) : mGeneration(aGeneration), mAnonymize(aAnonymize), - mDMDFile(aDMDFile) + mDMDDumpIdent(aDMDDumpIdent) { MOZ_COUNT_CTOR(MemoryReportRequestChild); } @@ -693,10 +692,10 @@ PMemoryReportRequestChild* ContentChild::AllocPMemoryReportRequestChild(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const FileDescriptor& aDMDFile) + const nsString& aDMDDumpIdent) { MemoryReportRequestChild *actor = - new MemoryReportRequestChild(aGeneration, aAnonymize, aDMDFile); + new MemoryReportRequestChild(aGeneration, aAnonymize, aDMDDumpIdent); actor->AddRef(); return actor; } @@ -751,7 +750,7 @@ ContentChild::RecvPMemoryReportRequestConstructor( const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, - const FileDescriptor& aDMDFile) + const nsString& aDMDDumpIdent) { MemoryReportRequestChild *actor = static_cast(aChild); @@ -785,7 +784,7 @@ NS_IMETHODIMP MemoryReportRequestChild::Run() new MemoryReportsWrapper(&reports); nsRefPtr cb = new MemoryReportCallback(process); mgr->GetReportsForThisProcessExtended(cb, wrappedReports, mAnonymize, - FileDescriptorToFILE(mDMDFile, "wb")); + mDMDDumpIdent); bool sent = Send__delete__(this, mGeneration, reports); return sent ? NS_OK : NS_ERROR_FAILURE; diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 3db0d5983668..a97e1dc11ac6 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -155,7 +155,7 @@ public: AllocPMemoryReportRequestChild(const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, - const FileDescriptor& aDMDFile) MOZ_OVERRIDE; + const nsString& aDMDDumpIdent) MOZ_OVERRIDE; virtual bool DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor) MOZ_OVERRIDE; @@ -164,7 +164,7 @@ public: const uint32_t& aGeneration, const bool& aAnonymize, const bool &aMinimizeMemoryUsage, - const FileDescriptor &aDMDFile) MOZ_OVERRIDE; + const nsString &aDMDDumpIdent) MOZ_OVERRIDE; virtual PCycleCollectWithLogsChild* AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces, diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 136e326444fb..822f1f9e1cd2 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -103,7 +103,6 @@ #include "nsIURIFixup.h" #include "nsIWindowWatcher.h" #include "nsIXULRuntime.h" -#include "nsMemoryInfoDumper.h" #include "nsMemoryReporterManager.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" @@ -2458,22 +2457,9 @@ ContentParent::Observe(nsISupports* aSubject, // The pre-%n part of the string should be all ASCII, so the byte // offset in identOffset should be correct as a char offset. MOZ_ASSERT(cmsg[identOffset - 1] == '='); - FileDescriptor dmdFileDesc; -#ifdef MOZ_DMD - FILE *dmdFile; - nsAutoString dmdIdent(Substring(msg, identOffset)); - nsresult rv = nsMemoryInfoDumper::OpenDMDFile(dmdIdent, Pid(), &dmdFile); - if (NS_WARN_IF(NS_FAILED(rv))) { - // Proceed with the memory report as if DMD were disabled. - dmdFile = nullptr; - } - if (dmdFile) { - dmdFileDesc = FILEToFileDescriptor(dmdFile); - fclose(dmdFile); - } -#endif unused << SendPMemoryReportRequestConstructor( - generation, anonymize, minimize, dmdFileDesc); + generation, anonymize, minimize, + nsString(Substring(msg, identOffset))); } } else if (!strcmp(aTopic, "child-gc-request")){ @@ -2818,7 +2804,7 @@ PMemoryReportRequestParent* ContentParent::AllocPMemoryReportRequestParent(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const FileDescriptor &aDMDFile) + const nsString &aDMDDumpIdent) { MemoryReportRequestParent* parent = new MemoryReportRequestParent(); return parent; diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index c074f9191e35..6c08a5787b61 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -422,7 +422,7 @@ private: AllocPMemoryReportRequestParent(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const FileDescriptor &aDMDFile) MOZ_OVERRIDE; + const nsString &aDMDDumpIdent) MOZ_OVERRIDE; virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) MOZ_OVERRIDE; virtual PCycleCollectWithLogsParent* diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index bd85b0986b77..c073b68c72e4 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -352,7 +352,7 @@ child: async SetProcessSandbox(); PMemoryReportRequest(uint32_t generation, bool anonymize, - bool minimizeMemoryUsage, FileDescriptor DMDFile); + bool minimizeMemoryUsage, nsString DMDDumpIdent); /** * Notify the AudioChannelService in the child processes. diff --git a/ipc/glue/FileDescriptorUtils.cpp b/ipc/glue/FileDescriptorUtils.cpp index 409ca73230e3..590b91e658e2 100644 --- a/ipc/glue/FileDescriptorUtils.cpp +++ b/ipc/glue/FileDescriptorUtils.cpp @@ -91,13 +91,11 @@ FILE* FileDescriptorToFILE(const FileDescriptor& aDesc, const char* aOpenMode) { - // Debug builds check whether the handle was "used", even if it's - // invalid, so that needs to happen first. - FileDescriptor::PlatformHandleType handle = aDesc.PlatformHandle(); if (!aDesc.IsValid()) { errno = EBADF; return nullptr; } + FileDescriptor::PlatformHandleType handle = aDesc.PlatformHandle(); #ifdef XP_WIN int fd = _open_osfhandle(reinterpret_cast(handle), 0); if (fd == -1) { diff --git a/security/sandbox/linux/Sandbox.cpp b/security/sandbox/linux/Sandbox.cpp index bde6268f38eb..1b60e549362c 100644 --- a/security/sandbox/linux/Sandbox.cpp +++ b/security/sandbox/linux/Sandbox.cpp @@ -211,6 +211,15 @@ InstallSyscallReporter(void) static int InstallSyscallFilter(const sock_fprog *prog) { +#ifdef MOZ_DMD + char* e = PR_GetEnv("DMD"); + if (e && strcmp(e, "") != 0 && strcmp(e, "0") != 0) { + LOG_ERROR("SANDBOX DISABLED FOR DMD! See bug 956961."); + // Must treat this as "failure" in order to prevent infinite loop; + // cf. the PR_GET_SECCOMP check below. + return 1; + } +#endif if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { return 1; } diff --git a/xpcom/base/nsGZFileWriter.cpp b/xpcom/base/nsGZFileWriter.cpp index 29bc8608a435..92a02535c5c1 100644 --- a/xpcom/base/nsGZFileWriter.cpp +++ b/xpcom/base/nsGZFileWriter.cpp @@ -47,14 +47,9 @@ nsGZFileWriter::Init(nsIFile* aFile) if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - return InitANSIFileDesc(file); -} -NS_IMETHODIMP -nsGZFileWriter::InitANSIFileDesc(FILE* aFile) -{ - mGZFile = gzdopen(dup(fileno(aFile)), "wb"); - fclose(aFile); + mGZFile = gzdopen(dup(fileno(file)), "wb"); + fclose(file); // gzdopen returns nullptr on error. if (NS_WARN_IF(!mGZFile)) { diff --git a/xpcom/base/nsIGZFileWriter.idl b/xpcom/base/nsIGZFileWriter.idl index 70898e9e2897..cff1fe949fd1 100644 --- a/xpcom/base/nsIGZFileWriter.idl +++ b/xpcom/base/nsIGZFileWriter.idl @@ -8,11 +8,9 @@ %{C++ #include "nsDependentString.h" -#include %} interface nsIFile; -[ptr] native FILE(FILE); /** * A simple interface for writing to a .gz file. @@ -24,7 +22,7 @@ interface nsIFile; * The standard gunzip tool cannot decompress a raw gzip stream, but can handle * the files produced by this interface. */ -[scriptable, uuid(6bd5642c-1b90-4499-ba4b-199f27efaba5)] +[scriptable, uuid(a256f26a-c603-459e-b5a4-53b4877f2cd8)] interface nsIGZFileWriter : nsISupports { /** @@ -36,12 +34,6 @@ interface nsIGZFileWriter : nsISupports */ void init(in nsIFile file); - /** - * Alternate version of init() for use when the file is already opened; - * e.g., with a FileDescriptor passed over IPC. - */ - [noscript] void initANSIFileDesc(in FILE file); - /** * Write the given string to the file. */ diff --git a/xpcom/base/nsIMemoryReporter.idl b/xpcom/base/nsIMemoryReporter.idl index 2c40fac11c5e..c9bfbd6aba18 100644 --- a/xpcom/base/nsIMemoryReporter.idl +++ b/xpcom/base/nsIMemoryReporter.idl @@ -5,14 +5,10 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" -%{C++ -#include -%} interface nsIDOMWindow; interface nsIRunnable; interface nsISimpleEnumerator; -[ptr] native FILE(FILE); /* * Memory reporters measure Firefox's memory usage. They are primarily used to @@ -205,7 +201,7 @@ interface nsIFinishReportingCallback : nsISupports void callback(in nsISupports data); }; -[scriptable, builtinclass, uuid(51e17609-e98a-47cc-9f95-095ef3c3823e)] +[scriptable, builtinclass, uuid(c27f8662-a0b7-45b3-8207-14d66b02b9c5)] interface nsIMemoryReporterManager : nsISupports { /* @@ -298,14 +294,15 @@ interface nsIMemoryReporterManager : nsISupports in boolean anonymize); /* - * As above, but if DMD is enabled and |DMDFile| is non-null then - * write a DMD report to that file and close it. + * As above, but if DMD is enabled and |DMDDumpIdent| is non-empty + * then write a DMD report to a file in the usual temporary directory (see + * |dumpMemoryInfoToTempDir| in |nsIMemoryInfoDumper|.) */ [noscript] void getReportsForThisProcessExtended(in nsIMemoryReporterCallback handleReport, in nsISupports handleReportData, in boolean anonymize, - in FILE DMDFile); + in AString DMDDumpIdent); /* * The memory reporter manager, for the most part, treats reporters diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 0eacc7dbc9ae..0491e50a4137 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -508,12 +508,12 @@ NS_IMPL_ISUPPORTS(DumpReportCallback, nsIHandleReportCallback) static void MakeFilename(const char* aPrefix, const nsAString& aIdentifier, - int aPid, const char* aSuffix, nsACString& aResult) + const char* aSuffix, nsACString& aResult) { aResult = nsPrintfCString("%s-%s-%d.%s", aPrefix, NS_ConvertUTF16toUTF8(aIdentifier).get(), - aPid, aSuffix); + getpid(), aSuffix); } #ifdef MOZ_DMD @@ -633,8 +633,7 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, // each process as was the case before bug 946407. This is so that // the get_about_memory.py script in the B2G repository can // determine when it's done waiting for files to appear. - MakeFilename("unified-memory-report", identifier, getpid(), "json.gz", - mrFilename); + MakeFilename("unified-memory-report", identifier, "json.gz", mrFilename); nsCOMPtr mrTmpFile; nsresult rv; @@ -677,25 +676,24 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, #ifdef MOZ_DMD nsresult -nsMemoryInfoDumper::OpenDMDFile(const nsAString& aIdentifier, int aPid, - FILE** aOutFile) +nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) { if (!dmd::IsRunning()) { - *aOutFile = nullptr; return NS_OK; } + nsresult rv; + // Create a filename like dmd--.txt.gz, which will be used // if DMD is enabled. nsCString dmdFilename; - MakeFilename("dmd", aIdentifier, aPid, "txt.gz", dmdFilename); + MakeFilename("dmd", aIdentifier, "txt.gz", dmdFilename); // Open a new DMD file named |dmdFilename| in NS_OS_TEMP_DIR for writing, // and dump DMD output to it. This must occur after the memory reporters // have been run (above), but before the memory-reports file has been // renamed (so scripts can detect the DMD file, if present). - nsresult rv; nsCOMPtr dmdFile; rv = nsDumpUtils::OpenTempFile(dmdFilename, getter_AddRefs(dmdFile), @@ -703,21 +701,15 @@ nsMemoryInfoDumper::OpenDMDFile(const nsAString& aIdentifier, int aPid, if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } - rv = dmdFile->OpenANSIFileDesc("wb", aOutFile); - NS_WARN_IF(NS_FAILED(rv)); - return rv; -} -nsresult -nsMemoryInfoDumper::DumpDMDToFile(FILE* aFile) -{ nsRefPtr dmdWriter = new nsGZFileWriter(); - nsresult rv = dmdWriter->InitANSIFileDesc(aFile); + rv = dmdWriter->Init(dmdFile); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } // Dump DMD output to the file. + DMDWriteState state(dmdWriter); dmd::Writer w(DMDWrite, &state); dmd::Dump(w); @@ -726,21 +718,6 @@ nsMemoryInfoDumper::DumpDMDToFile(FILE* aFile) NS_WARN_IF(NS_FAILED(rv)); return rv; } - -nsresult -nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) -{ - nsresult rv; - FILE* dmdFile; - rv = OpenDMDFile(aIdentifier, getpid(), &dmdFile); - if (NS_WARN_IF(NS_FAILED(rv))) { - return rv; - } - if (!dmdFile) { - return NS_OK; - } - return DumpDMDToFile(dmdFile); -} #endif // MOZ_DMD NS_IMETHODIMP diff --git a/xpcom/base/nsMemoryInfoDumper.h b/xpcom/base/nsMemoryInfoDumper.h index b77602df5699..ad6b0394ff9f 100644 --- a/xpcom/base/nsMemoryInfoDumper.h +++ b/xpcom/base/nsMemoryInfoDumper.h @@ -8,7 +8,6 @@ #define mozilla_nsMemoryInfoDumper_h #include "nsIMemoryInfoDumper.h" -#include class nsACString; @@ -32,14 +31,7 @@ public: static void Initialize(); #ifdef MOZ_DMD - // Write a DMD report. static nsresult DumpDMD(const nsAString& aIdentifier); - // Open an appropriately named file for a DMD report. If DMD is - // disabled, return a null FILE* instead. - static nsresult OpenDMDFile(const nsAString& aIdentifier, int aPid, - FILE** aOutFile); - // Write a DMD report to the given file and close it. - static nsresult DumpDMDToFile(FILE* aFile); #endif }; diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index ef09084f7430..63cd7da1fb7a 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -1104,17 +1104,8 @@ nsMemoryReporterManager::StartGettingReports() GetReportsState* s = mGetReportsState; // Get reports for this process. - FILE *parentDMDFile = nullptr; -#ifdef MOZ_DMD - nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(), - &parentDMDFile); - if (NS_WARN_IF(NS_FAILED(rv))) { - // Proceed with the memory report as if DMD were disabled. - parentDMDFile = nullptr; - } -#endif GetReportsForThisProcessExtended(s->mHandleReport, s->mHandleReportData, - s->mAnonymize, parentDMDFile); + s->mAnonymize, s->mDMDDumpIdent); s->mParentDone = true; // If there are no remaining child processes, we can finish up immediately. @@ -1147,13 +1138,13 @@ nsMemoryReporterManager::GetReportsForThisProcess( nsISupports* aHandleReportData, bool aAnonymize) { return GetReportsForThisProcessExtended(aHandleReport, aHandleReportData, - aAnonymize, nullptr); + aAnonymize, nsString()); } NS_IMETHODIMP nsMemoryReporterManager::GetReportsForThisProcessExtended( nsIHandleReportCallback* aHandleReport, nsISupports* aHandleReportData, - bool aAnonymize, FILE* aDMDFile) + bool aAnonymize, const nsAString& aDMDDumpIdent) { // Memory reporters are not necessarily threadsafe, so this function must // be called from the main thread. @@ -1162,13 +1153,11 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( } #ifdef MOZ_DMD - if (aDMDFile) { + if (!aDMDDumpIdent.IsEmpty()) { // Clear DMD's reportedness state before running the memory // reporters, to avoid spurious twice-reported warnings. dmd::ClearReports(); } -#else - MOZ_ASSERT(!aDMDFile); #endif MemoryReporterArray allReporters; @@ -1183,8 +1172,8 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( } #ifdef MOZ_DMD - if (aDMDFile) { - return nsMemoryInfoDumper::DumpDMDToFile(aDMDFile); + if (!aDMDDumpIdent.IsEmpty()) { + return nsMemoryInfoDumper::DumpDMD(aDMDDumpIdent); } #endif From ffb39250a552e77213c467588bf56fa98e7f04d9 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 07:15:30 +0900 Subject: [PATCH 50/94] Bug 1031129 - Fix ObjdirMismatchException logic to throw properly on m-c. r=gps --- python/mozbuild/mozbuild/base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 51e98f3674fd..29c18404d04f 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -174,7 +174,7 @@ class MozbuildObject(ProcessExecutionMixin): if topobjdir and config_topobjdir: mozilla_dir = os.path.join(config_topobjdir, 'mozilla') if not samepath(topobjdir, config_topobjdir) \ - and (os.path.exists(mozilla_dir) and not samepath(topobjdir, + and (not os.path.exists(mozilla_dir) or not samepath(topobjdir, mozilla_dir)): raise ObjdirMismatchException(topobjdir, config_topobjdir) From 4474b717c2d3ca0a27cac47340f72563985870b2 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 07:15:31 +0900 Subject: [PATCH 51/94] Bug 1030717 - Don't try to create the mach state directory until it's actually needed. r=gps --- build/mach_bootstrap.py | 65 ++++++++++++----------- python/mach/mach/main.py | 36 +++++++++++-- python/mach/mach/test/test_conditions.py | 11 ++-- python/mozbuild/mozbuild/mach_commands.py | 3 +- 4 files changed, 77 insertions(+), 38 deletions(-) diff --git a/build/mach_bootstrap.py b/build/mach_bootstrap.py index 3fe3e4da7450..b19401ee4e3c 100644 --- a/build/mach_bootstrap.py +++ b/build/mach_bootstrap.py @@ -145,42 +145,47 @@ def bootstrap(topsrcdir, mozilla_dir=None): # case. For default behavior, we educate users and give them an opportunity # to react. We always exit after creating the directory because users don't # like surprises. - state_user_dir = os.path.expanduser('~/.mozbuild') - state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None) - if state_env_dir: - if not os.path.exists(state_env_dir): - print('Creating global state directory from environment variable: %s' - % state_env_dir) - os.makedirs(state_env_dir, mode=0o770) - print('Please re-run mach.') - sys.exit(1) - state_dir = state_env_dir - else: - if not os.path.exists(state_user_dir): - print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir)) - try: - for i in range(20, -1, -1): - time.sleep(1) - sys.stdout.write('%d ' % i) - sys.stdout.flush() - except KeyboardInterrupt: - sys.exit(1) - - print('\nCreating default state directory: %s' % state_user_dir) - os.mkdir(state_user_dir) - print('Please re-run mach.') - sys.exit(1) - state_dir = state_user_dir - try: import mach.main except ImportError: sys.path[0:0] = [os.path.join(mozilla_dir, path) for path in SEARCH_PATHS] import mach.main - def populate_context(context): - context.state_dir = state_dir - context.topdir = topsrcdir + def populate_context(context, key=None): + if key is None: + return + if key == 'state_dir': + state_user_dir = os.path.expanduser('~/.mozbuild') + state_env_dir = os.environ.get('MOZBUILD_STATE_PATH', None) + if state_env_dir: + if not os.path.exists(state_env_dir): + print('Creating global state directory from environment variable: %s' + % state_env_dir) + os.makedirs(state_env_dir, mode=0o770) + print('Please re-run mach.') + sys.exit(1) + state_dir = state_env_dir + else: + if not os.path.exists(state_user_dir): + print(STATE_DIR_FIRST_RUN.format(userdir=state_user_dir)) + try: + for i in range(20, -1, -1): + time.sleep(1) + sys.stdout.write('%d ' % i) + sys.stdout.flush() + except KeyboardInterrupt: + sys.exit(1) + + print('\nCreating default state directory: %s' % state_user_dir) + os.mkdir(state_user_dir) + print('Please re-run mach.') + sys.exit(1) + state_dir = state_user_dir + + return state_dir + if key == 'topdir': + return topsrcdir + raise AttributeError(key) mach = mach.main.Mach(os.getcwd()) mach.populate_context_handler = populate_context diff --git a/python/mach/mach/main.py b/python/mach/mach/main.py index 8ee0ef5e2922..97ebdeb31379 100644 --- a/python/mach/mach/main.py +++ b/python/mach/mach/main.py @@ -143,6 +143,28 @@ class ArgumentParser(argparse.ArgumentParser): return text +class ContextWrapper(object): + def __init__(self, context, handler): + object.__setattr__(self, '_context', context) + object.__setattr__(self, '_handler', handler) + + def __getattribute__(self, key): + try: + return getattr(object.__getattribute__(self, '_context'), key) + except AttributeError as e: + try: + ret = object.__getattribute__(self, '_handler')(self, key) + except AttributeError, TypeError: + # TypeError is in case the handler comes from old code not + # taking a key argument. + raise e + setattr(self, key, ret) + return ret + + def __setattr__(self, key, value): + setattr(object.__getattribute__(self, '_context'), key, value) + + @CommandProvider class Mach(object): """Main mach driver type. @@ -154,10 +176,15 @@ class Mach(object): behavior: populate_context_handler -- If defined, it must be a callable. The - callable will be called with the mach.base.CommandContext instance - as its single argument right before command dispatch. This allows - modification of the context instance and thus passing of - arbitrary data to command handlers. + callable signature is the following: + populate_context_handler(context, key=None) + It acts as a fallback getter for the mach.base.CommandContext + instance. + This allows to augment the context instance with arbitrary data + for use in command handlers. + For backwards compatibility, it is also called before command + dispatch without a key, allowing the context handler to add + attributes to the context instance. require_conditions -- If True, commands that do not have any condition functions applied will be skipped. Defaults to False. @@ -343,6 +370,7 @@ To see more help for a specific command, run: if self.populate_context_handler: self.populate_context_handler(context) + context = ContextWrapper(context, self.populate_context_handler) parser = self.get_argument_parser(context) diff --git a/python/mach/mach/test/test_conditions.py b/python/mach/mach/test/test_conditions.py index 888537d2edbb..532a8316062e 100644 --- a/python/mach/mach/test/test_conditions.py +++ b/python/mach/mach/test/test_conditions.py @@ -13,9 +13,14 @@ from mach.test.common import TestBase from mozunit import main -def _populate_context(context): - context.foo = True - context.bar = False +def _populate_context(context, key=None): + if key is None: + return + if key == 'foo': + return True + if key == 'bar': + return False + raise AttributeError(key) class TestConditions(TestBase): """Tests for conditionally filtering commands.""" diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index f22a6b8048c1..19483322df33 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -922,6 +922,7 @@ class MachDebug(MachCommandBase): @CommandArgument('--verbose', '-v', action='store_true', help='Print verbose output.') def environment(self, verbose=False): + state_dir = self._mach_context.state_dir import platform print('platform:\n\t%s' % platform.platform()) print('python version:\n\t%s' % sys.version) @@ -929,7 +930,7 @@ class MachDebug(MachCommandBase): print('mach cwd:\n\t%s' % self._mach_context.cwd) print('os cwd:\n\t%s' % os.getcwd()) print('mach directory:\n\t%s' % self._mach_context.topdir) - print('state directory:\n\t%s' % self._mach_context.state_dir) + print('state directory:\n\t%s' % state_dir) try: mb = MozbuildObject.from_environment(cwd=self._mach_context.cwd) From 1aa2402b871e5cd52a23fbcdbc6e6dc67bbbb79b Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 07:15:31 +0900 Subject: [PATCH 52/94] Bug 1031132 - Refactor mach environment to use logic from MachCommandBase instead of its own. r=gps Also don't print section titles when there is nothing under them, and move move the ObjdirMismatchException handling to MachCommandBase. --- python/mozbuild/mozbuild/base.py | 9 ++++ python/mozbuild/mozbuild/mach_commands.py | 57 ++++++----------------- 2 files changed, 22 insertions(+), 44 deletions(-) diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index 29c18404d04f..d56a14aa0ff6 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -555,6 +555,15 @@ class MachCommandBase(MozbuildObject): topobjdir = dummy._topobjdir except BuildEnvironmentNotFoundException: pass + except ObjdirMismatchException as e: + print('Ambiguous object directory detected. We detected that ' + 'both %s and %s could be object directories. This is ' + 'typically caused by having a mozconfig pointing to a ' + 'different object directory from the current working ' + 'directory. To solve this problem, ensure you do not have a ' + 'default mozconfig in searched paths.' % (e.objdir1, + e.objdir2)) + sys.exit(1) MozbuildObject.__init__(self, topsrcdir, context.settings, context.log_manager, topobjdir=topobjdir) diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 19483322df33..848711b4d343 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -932,60 +932,29 @@ class MachDebug(MachCommandBase): print('mach directory:\n\t%s' % self._mach_context.topdir) print('state directory:\n\t%s' % state_dir) - try: - mb = MozbuildObject.from_environment(cwd=self._mach_context.cwd) - except ObjdirMismatchException as e: - print('Ambiguous object directory detected. We detected that ' - 'both %s and %s could be object directories. This is ' - 'typically caused by having a mozconfig pointing to a ' - 'different object directory from the current working ' - 'directory. To solve this problem, ensure you do not have a ' - 'default mozconfig in searched paths.' % (e.objdir1, - e.objdir2)) - return 1 + print('object directory:\n\t%s' % self.topobjdir) - mozconfig = None - - try: - mozconfig = mb.mozconfig - print('mozconfig path:\n\t%s' % mozconfig['path']) - except MozconfigFindException as e: - print('Unable to find mozconfig: %s' % e.message) - return 1 - - except MozconfigLoadException as e: - print('Error loading mozconfig: %s' % e.path) - print(e.message) - - if e.output: - print('mozconfig evaluation output:') - for line in e.output: - print(line) - - return 1 - - print('object directory:\n\t%s' % mb.topobjdir) - - if mozconfig: - print('mozconfig configure args:') - if mozconfig['configure_args']: - for arg in mozconfig['configure_args']: + if self.mozconfig['path']: + print('mozconfig path:\n\t%s' % self.mozconfig['path']) + if self.mozconfig['configure_args']: + print('mozconfig configure args:') + for arg in self.mozconfig['configure_args']: print('\t%s' % arg) - print('mozconfig extra make args:') - if mozconfig['make_extra']: - for arg in mozconfig['make_extra']: + if self.mozconfig['make_extra']: + print('mozconfig extra make args:') + for arg in self.mozconfig['make_extra']: print('\t%s' % arg) - print('mozconfig make flags:') - if mozconfig['make_flags']: - for arg in mozconfig['make_flags']: + if self.mozconfig['make_flags']: + print('mozconfig make flags:') + for arg in self.mozconfig['make_flags']: print('\t%s' % arg) config = None try: - config = mb.config_environment + config = self.config_environment except Exception: pass From fbc231db84cc74182775f61df9dcef2bd6ef037e Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 07:15:31 +0900 Subject: [PATCH 53/94] Bug 1031180 - Fallback to checking whether the directory mach lives in contains mach_bootstrap.py. r=gps --- mach | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/mach b/mach index e95a1c0ac0cf..dab614634f61 100755 --- a/mach +++ b/mach @@ -26,6 +26,15 @@ def load_mach(topsrcdir): import mach_bootstrap return mach_bootstrap.bootstrap(topsrcdir) + +def check_and_run_mach(dir_path, args): + # If we find the mach bootstrap module, we are in the srcdir. + mach_path = os.path.join(dir_path, 'build/mach_bootstrap.py') + if os.path.isfile(mach_path): + mach = load_mach(dir_path) + sys.exit(mach.run(args)) + + def main(args): # Check whether the current directory is within a mach src or obj dir. for dir_path in ancestors(os.getcwd()): @@ -47,11 +56,11 @@ def main(args): # Continue searching for mach_bootstrap in the source directory. dir_path = info['topsrcdir'] - # If we find the mach bootstrap module, we are in the srcdir. - mach_path = os.path.join(dir_path, 'build/mach_bootstrap.py') - if os.path.isfile(mach_path): - mach = load_mach(dir_path) - sys.exit(mach.run(args[1:])) + check_and_run_mach(dir_path, args) + + # If we didn't find a source path by scanning for a mozinfo.json, check + # whether the directory containing this script is a source directory. + check_and_run_mach(os.path.dirname(__file__), args) print('Could not run mach: No mach source directory found.') sys.exit(1) @@ -105,4 +114,4 @@ if __name__ == '__main__': orig_command_line = forking.get_command_line forking.get_command_line = my_get_command_line - main(sys.argv) + main(sys.argv[1:]) From bc0709dc9e66aee79e18db3c32800ccc07cef94d Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 07:15:31 +0900 Subject: [PATCH 54/94] Bug 762358 - Re-run configure when mozconfig changed in a significant way. r=gps This adds a format option to mach environment and uses it in client.mk to create a .mozconfig.json in the objdir, containing all the relevant data from mozconfig. If the mozconfig doesn't change in a way that alters that data, we still skip configure. At the same time, use mach environment in place of mozconfig2configure and mozconfig2client-mk, which makes us now have only one mozconfig reader. Also, in the mozconfig reader, keep track of environment variables (as opposed to shell variables), so that changes such as a variable that was exported not being exported anymore is spotted. At the opposite, in order for irrelevant environment variable changes not to incur in re-running configure, only a set of environment variables are stored when they are unmodified. Otherwise, changes such as using a different terminal window, or even rebooting, would trigger reconfigures. Finally, make mach environment emit both MOZ_OBJDIR and OBJDIR for client.mk, and cleanup some objdir-related things in client.mk.. At the same time, make the mozconfig reader take MOZ_OBJDIR from the environment if it is defined there and not in the mozconfig. --- build/autoconf/altoptions.m4 | 43 ++++++- build/autoconf/mozconfig-find | 76 ----------- build/autoconf/mozconfig2client-mk | 76 ----------- build/autoconf/mozconfig2configure | 103 --------------- client.mk | 44 +++---- python/mozbuild/mozbuild/base.py | 36 +++++- python/mozbuild/mozbuild/mach_commands.py | 118 ++++++++++++++---- python/mozbuild/mozbuild/mozconfig.py | 89 ++++++++----- python/mozbuild/mozbuild/mozconfig_loader | 8 ++ .../mozbuild/mozbuild/test/backend/common.py | 8 ++ .../mozbuild/test/frontend/test_emitter.py | 8 ++ python/mozbuild/mozbuild/test/test_base.py | 75 ++++++++--- .../mozbuild/mozbuild/test/test_mozconfig.py | 56 ++++++++- testing/xpcshell/selftest.py | 1 + 14 files changed, 373 insertions(+), 368 deletions(-) delete mode 100755 build/autoconf/mozconfig-find delete mode 100755 build/autoconf/mozconfig2client-mk delete mode 100755 build/autoconf/mozconfig2configure diff --git a/build/autoconf/altoptions.m4 b/build/autoconf/altoptions.m4 index 9e1636a103f1..f8c8ba96fe26 100644 --- a/build/autoconf/altoptions.m4 +++ b/build/autoconf/altoptions.m4 @@ -82,7 +82,42 @@ define(MOZ_ARG_HEADER, [# $1]) dnl MOZ_READ_MYCONFIG() - Read in 'myconfig.sh' file AC_DEFUN([MOZ_READ_MOZCONFIG], [AC_REQUIRE([AC_INIT_BINSH])dnl -# Read in '.mozconfig' script to set the initial options. -# See the mozconfig2configure script for more details. -_AUTOCONF_TOOLS_DIR=`dirname [$]0`/[$1]/build/autoconf -. $_AUTOCONF_TOOLS_DIR/mozconfig2configure]) +inserted= +dnl Shell is hard, so here is what the following does: +dnl - Reset $@ (command line arguments) +dnl - Add the configure options from mozconfig to $@ one by one +dnl - Add the original command line arguments after that, one by one +dnl +dnl There are several tricks involved: +dnl - It is not possible to preserve the whitespaces in $@ by assigning to +dnl another variable, so the two first steps above need to happen in the first +dnl iteration of the third step. +dnl - We always want the configure options to be added, so the loop must be +dnl iterated at least once, so we add a dummy argument first, and discard it. +dnl - something | while read line ... makes the while run in a subshell, meaning +dnl that anything it does is not propagated to the main shell, so we can't do +dnl set -- foo there. As a consequence, what the while loop reading mach +dnl environment output does is output a set of shell commands for the main shell +dnl to eval. +dnl - Extra care is due when lines from mach environment output contain special +dnl shell characters, so we use ' for quoting and ensure no ' end up in between +dnl the quoting mark unescaped. +dnl Some of the above is directly done in mach environment --format=configure. +failed_eval() { + echo "Failed eval'ing the following:" + $(dirname [$]0)/[$1]/mach environment --format=configure + exit 1 +} + +set -- dummy "[$]@" +for ac_option +do + if test -z "$inserted"; then + set -- + eval "$($(dirname [$]0)/[$1]/mach environment --format=configure)" || failed_eval + inserted=1 + else + set -- "[$]@" "$ac_option" + fi +done +]) diff --git a/build/autoconf/mozconfig-find b/build/autoconf/mozconfig-find deleted file mode 100755 index 97dd90c358ba..000000000000 --- a/build/autoconf/mozconfig-find +++ /dev/null @@ -1,76 +0,0 @@ -#! /bin/sh -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# mozconfigfind - Loads options from .mozconfig onto configure's -# command-line. The .mozconfig file is searched for in the -# order: -# If $MOZCONFIG is set, use that. -# If one of $TOPSRCDIR/.mozconfig or $TOPSRCDIR/mozconfig exists, use it. -# If both exist, or if various legacy locations contain a mozconfig, error. -# Otherwise, use the default build options. -# -topsrcdir=$1 - -abspath() { - if uname -s | grep -q MINGW; then - # We have no way to figure out whether we're in gmake or pymake right - # now. gmake gives us Unix-style paths while pymake gives us Windows-style - # paths, so attempt to handle both. - regexes='^\([A-Za-z]:\|\\\\\|\/\) ^\/' - else - regexes='^\/' - fi - - for regex in $regexes; do - if echo $1 | grep -q $regex; then - echo $1 - return - fi - done - - # If we're at this point, we have a relative path - echo `pwd`/$1 -} - -if [ -n "$MOZCONFIG" ] && ! [ -f "$MOZCONFIG" ]; then - echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!" 1>&2 - exit 1 -fi - -if [ -n "$MOZ_MYCONFIG" ]; then - echo "Your environment currently has the MOZ_MYCONFIG variable set to \"$MOZ_MYCONFIG\". MOZ_MYCONFIG is no longer supported. Please use MOZCONFIG instead." 1>&2 - exit 1 -fi - -if [ -z "$MOZCONFIG" ] && [ -f "$topsrcdir/.mozconfig" ] && [ -f "$topsrcdir/mozconfig" ]; then - echo "Both \$topsrcdir/.mozconfig and \$topsrcdir/mozconfig are supported, but you must choose only one. Please remove the other." 1>&2 - exit 1 -fi - -for _config in "$MOZCONFIG" \ - "$topsrcdir/.mozconfig" \ - "$topsrcdir/mozconfig" -do - if test -f "$_config"; then - abspath $_config - exit 0 - fi -done - -# We used to support a number of other implicit .mozconfig locations. We now -# detect if we were about to use any of these locations and issue an error if we -# find any. -for _config in "$topsrcdir/mozconfig.sh" \ - "$topsrcdir/myconfig.sh" \ - "$HOME/.mozconfig" \ - "$HOME/.mozconfig.sh" \ - "$HOME/.mozmyconfig.sh" -do - if test -f "$_config"; then - echo "You currently have a mozconfig at \"$_config\". This implicit location is no longer supported. Please move it to $topsrcdir/.mozconfig or specify it explicitly via \$MOZCONFIG." 1>&2 - exit 1 - fi -done diff --git a/build/autoconf/mozconfig2client-mk b/build/autoconf/mozconfig2client-mk deleted file mode 100755 index aaf8de185932..000000000000 --- a/build/autoconf/mozconfig2client-mk +++ /dev/null @@ -1,76 +0,0 @@ -#! /bin/sh -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# mozconfig2client-mk - Translates .mozconfig into options for client.mk. -# Prints defines to stdout. -# -# See mozconfig2configure for more details - -print_header() { - cat <@' with '$()'. - _opt=`echo "$_opt" | sed -e 's/\([\"\\]\)/\\\\\1/g; s/@\([^@]*\)@/\$(\1)/g;'` - echo $_opt; - done -} - -# Main -#-------------------------------------------------- - -scriptdir=`dirname $0` -topsrcdir=$1 - -# If the path changes, configure should be rerun -echo "# PATH=$PATH" - -# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out -isfoundset=${FOUND_MOZCONFIG+yes} -if [ -z $isfoundset ]; then - FOUND_MOZCONFIG=`$scriptdir/mozconfig-find $topsrcdir` - if [ $? -ne 0 ]; then - echo '$(error Fix above errors before continuing.)' - else - isfoundset=yes - fi -fi - -if [ -n $isfoundset ]; then - if [ "$FOUND_MOZCONFIG" ] - then - print_header - . "$FOUND_MOZCONFIG" - echo "FOUND_MOZCONFIG := $FOUND_MOZCONFIG" - fi -fi diff --git a/build/autoconf/mozconfig2configure b/build/autoconf/mozconfig2configure deleted file mode 100755 index 99623b6338e3..000000000000 --- a/build/autoconf/mozconfig2configure +++ /dev/null @@ -1,103 +0,0 @@ -#! /bin/sh -# -# This Source Code Form is subject to the terms of the Mozilla Public -# License, v. 2.0. If a copy of the MPL was not distributed with this -# file, You can obtain one at http://mozilla.org/MPL/2.0/. - -# mozconfig2configure - Loads options from .mozconfig onto configure's -# command-line. See mozconfig-find for how the config file is -# found -# -# The options from .mozconfig are inserted into the command-line -# before the real command-line options. This way the real options -# will override any .mozconfig options. -# -# .mozconfig is a shell script. To add an option to configure's -# command-line use the pre-defined function, ac_add_options, -# -# ac_add_options [ ... ] -# -# For example, -# -# ac_add_options --with-pthreads --enable-debug -# -# ac_add_options can be called multiple times in .mozconfig. -# Each call adds more options to configure's command-line. - -# Note: $_AUTOCONF_TOOLS_DIR must be defined in the script that includes this. - -ac_add_options() { - for _opt - do - # Escape shell characters, space, tab, dollar, quote, backslash, parentheses. - _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\\(\)]\)/\\\\\1/g;s/@\([^@]*\)@/\$\1/g;'` - _opt=`echo $_opt | sed -e 's/@\([^@]*\)@/\$(\1)/g'` - - # Avoid adding duplicates - case "$ac_options" in - # Note that all options in $ac_options are enclosed in quotes, - # so there will always be a last character to match [^-A-Za-z0-9_] - *"\"$_opt[^-A-Za-z0-9_]"* ) ;; - * ) mozconfig_ac_options="$mozconfig_ac_options $_opt" ;; - esac - done -} - -ac_add_app_options() { - APP=$1 - shift; - if [ "$APP" = "$MOZ_BUILD_APP" ]; then - ac_add_options "$*"; - fi -} - -mk_add_options() { - # These options are for client.mk - # configure can safely ignore them. - : -} - -ac_echo_options() { - echo "Adding configure options from $FOUND_MOZCONFIG:" - eval "set -- $mozconfig_ac_options" - for _opt - do - echo " $_opt" - done -} - -# Main -#-------------------------------------------------- -topsrcdir=$(cd `dirname $0`; pwd -W 2>/dev/null || pwd) -ac_options= -mozconfig_ac_options= - -# Save the real command-line options -for _opt -do - # Escape shell characters, space, tab, dollar, quote, backslash. - _opt=`echo $_opt | sed -e 's/\([\ \ \$\"\\]\)/\\\\\1/g;'` - ac_options="$ac_options \"$_opt\"" -done - - -# If FOUND_MOZCONFIG isn't set, look for it and make sure the script doesn't error out -isfoundset=${FOUND_MOZCONFIG+yes} -if [ -z $isfoundset ]; then - FOUND_MOZCONFIG=`$_AUTOCONF_TOOLS_DIR/mozconfig-find $topsrcdir` - if [ $? -ne 0 ]; then - echo "Fix above errors before continuing." 1>&2 - exit 1 - fi -fi - -if [ "$FOUND_MOZCONFIG" ]; then - . "$FOUND_MOZCONFIG" -fi -export FOUND_MOZCONFIG - -if [ "$mozconfig_ac_options" ]; then - ac_echo_options 1>&2 -fi - -eval "set -- $mozconfig_ac_options $ac_options" diff --git a/client.mk b/client.mk index 7fd04c5d5db9..5cbaf6ba614e 100644 --- a/client.mk +++ b/client.mk @@ -50,7 +50,6 @@ endif ifndef TOPSRCDIR ifeq (,$(wildcard client.mk)) TOPSRCDIR := $(patsubst %/,%,$(dir $(MAKEFILE_LIST))) -MOZ_OBJDIR = . else TOPSRCDIR := $(CWD) endif @@ -99,8 +98,6 @@ endif # See build pages, http://www.mozilla.org/build/ for how to set up mozconfig. -MOZCONFIG_LOADER := build/autoconf/mozconfig2client-mk - define CR @@ -112,7 +109,8 @@ endef # followed by a space (since sed doesn't remove newlines), except on the # last line, so replace both '|| ' and '||'. # Also, make MOZ_PGO available to mozconfig when passed on make command line. -MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell MOZ_PGO=$(MOZ_PGO) $(TOPSRCDIR)/$(MOZCONFIG_LOADER) $(TOPSRCDIR) | sed 's/$$/||/'))) +# Likewise for MOZ_CURRENT_PROJECT. +MOZCONFIG_CONTENT := $(subst ||,$(CR),$(subst || ,$(CR),$(shell $(addprefix MOZ_CURRENT_PROJECT=,$(MOZ_CURRENT_PROJECT)) MOZ_PGO=$(MOZ_PGO) $(TOPSRCDIR)/mach environment --format=client.mk | sed 's/$$/||/'))) $(eval $(MOZCONFIG_CONTENT)) export FOUND_MOZCONFIG @@ -143,28 +141,18 @@ ifeq (,$(findstring -j,$(MOZ_MAKE_FLAGS))) endif -ifndef MOZ_OBJDIR - MOZ_OBJDIR = obj-$(CONFIG_GUESS) -endif - ifdef MOZ_BUILD_PROJECTS ifdef MOZ_CURRENT_PROJECT - OBJDIR = $(MOZ_OBJDIR)/$(MOZ_CURRENT_PROJECT) - MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR) BUILD_PROJECT_ARG = MOZ_BUILD_APP=$(MOZ_CURRENT_PROJECT) + export MOZ_CURRENT_PROJECT else - OBJDIR = $(error Cannot find the OBJDIR when MOZ_CURRENT_PROJECT is not set.) MOZ_MAKE = $(error Cannot build in the OBJDIR when MOZ_CURRENT_PROJECT is not set.) endif - -else # MOZ_BUILD_PROJECTS - -OBJDIR = $(MOZ_OBJDIR) -MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR) - endif # MOZ_BUILD_PROJECTS +MOZ_MAKE = $(MAKE) $(MOZ_MAKE_FLAGS) -C $(OBJDIR) + # 'configure' scripts generated by autoconf. CONFIGURES := $(TOPSRCDIR)/configure CONFIGURES += $(TOPSRCDIR)/js/src/configure @@ -196,7 +184,7 @@ WANT_MOZCONFIG_MK = 1 endif ifdef WANT_MOZCONFIG_MK -# For now, only output "export" lines from mozconfig2client-mk output. +# For now, only output "export" lines from mach environment --format=client.mk output. MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES)) $(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR)) $(OBJDIR)/CLOBBER $(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@ @@ -229,17 +217,11 @@ everything: clean build # This is up here, outside of the MOZ_CURRENT_PROJECT logic so that this # is usable in multi-pass builds, where you might not have a runnable # application until all the build passes and postflight scripts have run. -ifdef MOZ_OBJDIR - PGO_OBJDIR = $(MOZ_OBJDIR) -else - PGO_OBJDIR := $(TOPSRCDIR) -endif - profiledbuild:: $(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_GENERATE=1 MOZ_PGO_INSTRUMENTED=1 - $(MAKE) -C $(PGO_OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT= - rm -f ${PGO_OBJDIR}/jarlog/en-US.log - MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(PGO_OBJDIR) pgo-profile-run + $(MAKE) -C $(OBJDIR) package MOZ_PGO_INSTRUMENTED=1 MOZ_INTERNAL_SIGNING_FORMAT= MOZ_EXTERNAL_SIGNING_FORMAT= + rm -f $(OBJDIR)/jarlog/en-US.log + MOZ_PGO_INSTRUMENTED=1 JARLOG_FILE=jarlog/en-US.log EXTRA_TEST_ARGS=10 $(MAKE) -C $(OBJDIR) pgo-profile-run $(MAKE) -f $(TOPSRCDIR)/client.mk maybe_clobber_profiledbuild $(MAKE) -f $(TOPSRCDIR)/client.mk realbuild MOZ_PROFILE_USE=1 @@ -320,6 +302,7 @@ CONFIG_STATUS_DEPS := \ $(TOPSRCDIR)/build/virtualenv_packages.txt \ $(TOPSRCDIR)/python/mozbuild/mozbuild/virtualenv.py \ $(TOPSRCDIR)/testing/mozbase/packages.txt \ + $(OBJDIR)/.mozconfig.json \ $(NULL) CONFIGURE_ENV_ARGS += \ @@ -347,8 +330,13 @@ configure-preqs = \ $(call mkdir_deps,$(OBJDIR)) \ $(if $(MOZ_BUILD_PROJECTS),$(call mkdir_deps,$(MOZ_OBJDIR))) \ save-mozconfig \ + $(OBJDIR)/.mozconfig.json \ $(NULL) +CREATE_MOZCONFIG_JSON := $(shell $(TOPSRCDIR)/mach environment --format=json -o $(OBJDIR)/.mozconfig.json) +$(OBJDIR)/.mozconfig.json: $(call mkdir_deps,$(OBJDIR)) + @$(TOPSRCDIR)/mach environment --format=json -o $@ + save-mozconfig: $(FOUND_MOZCONFIG) -cp $(FOUND_MOZCONFIG) $(OBJDIR)/.mozconfig @@ -367,7 +355,7 @@ $(OBJDIR)/config.status: $(CONFIG_STATUS_DEPS) else $(OBJDIR)/Makefile: $(CONFIG_STATUS_DEPS) endif - @$(MAKE) -f $(TOPSRCDIR)/client.mk configure + @$(MAKE) -f $(TOPSRCDIR)/client.mk configure CREATE_MOZCONFIG_JSON= ifneq (,$(CONFIG_STATUS)) $(OBJDIR)/config/autoconf.mk: $(TOPSRCDIR)/config/autoconf.mk.in diff --git a/python/mozbuild/mozbuild/base.py b/python/mozbuild/mozbuild/base.py index d56a14aa0ff6..53b39c259f17 100644 --- a/python/mozbuild/mozbuild/base.py +++ b/python/mozbuild/mozbuild/base.py @@ -161,7 +161,8 @@ class MozbuildObject(ProcessExecutionMixin): # environment. If no mozconfig is present, the config will not have # much defined. loader = MozconfigLoader(topsrcdir) - config = loader.read_mozconfig(mozconfig) + current_project = os.environ.get('MOZ_CURRENT_PROJECT') + config = loader.read_mozconfig(mozconfig, moz_build_app=current_project) config_topobjdir = MozbuildObject.resolve_mozconfig_topobjdir( topsrcdir, config) @@ -171,13 +172,30 @@ class MozbuildObject(ProcessExecutionMixin): # inside an objdir you probably want to perform actions on that objdir, # not another one. This prevents accidental usage of the wrong objdir # when the current objdir is ambiguous. + # However, if the found mozconfig resolves to another objdir that + # doesn't exist, we may be in a subtree like when building mozilla/ + # under c-c, and the objdir was defined as a relative path. Try again + # adjusting for that. + if topobjdir and config_topobjdir: - mozilla_dir = os.path.join(config_topobjdir, 'mozilla') - if not samepath(topobjdir, config_topobjdir) \ + if not os.path.exists(config_topobjdir): + config_topobjdir = MozbuildObject.resolve_mozconfig_topobjdir( + os.path.dirname(topsrcdir), config) + if current_project: + config_topobjdir = os.path.join(config_topobjdir, + current_project) + config_topobjdir = os.path.join(config_topobjdir, + os.path.basename(topsrcdir)) + elif current_project: + config_topobjdir = os.path.join(config_topobjdir, current_project) + + _config_topobjdir = config_topobjdir + mozilla_dir = os.path.join(_config_topobjdir, 'mozilla') + if not samepath(topobjdir, _config_topobjdir) \ and (not os.path.exists(mozilla_dir) or not samepath(topobjdir, mozilla_dir)): - raise ObjdirMismatchException(topobjdir, config_topobjdir) + raise ObjdirMismatchException(topobjdir, _config_topobjdir) topobjdir = topobjdir or config_topobjdir if topobjdir: @@ -233,7 +251,8 @@ class MozbuildObject(ProcessExecutionMixin): """ if self._mozconfig is None: loader = MozconfigLoader(self.topsrcdir) - self._mozconfig = loader.read_mozconfig() + self._mozconfig = loader.read_mozconfig( + moz_build_app=os.environ.get('MOZ_CURRENT_PROJECT')) return self._mozconfig @@ -549,8 +568,13 @@ class MachCommandBase(MozbuildObject): # more reliable than mozconfig when cwd is inside an objdir. topsrcdir = context.topdir topobjdir = None + detect_virtualenv_mozinfo = True + if hasattr(context, 'detect_virtualenv_mozinfo'): + detect_virtualenv_mozinfo = getattr(context, + 'detect_virtualenv_mozinfo') try: - dummy = MozbuildObject.from_environment(cwd=context.cwd) + dummy = MozbuildObject.from_environment(cwd=context.cwd, + detect_virtualenv_mozinfo=detect_virtualenv_mozinfo) topsrcdir = dummy.topsrcdir topobjdir = dummy._topobjdir except BuildEnvironmentNotFoundException: diff --git a/python/mozbuild/mozbuild/mach_commands.py b/python/mozbuild/mozbuild/mach_commands.py index 848711b4d343..d3e223cfbee0 100644 --- a/python/mozbuild/mozbuild/mach_commands.py +++ b/python/mozbuild/mozbuild/mach_commands.py @@ -10,6 +10,8 @@ import operator import os import sys +import mozpack.path as mozpath + from mach.decorators import ( CommandArgument, CommandProvider, @@ -919,37 +921,53 @@ class Makefiles(MachCommandBase): class MachDebug(MachCommandBase): @Command('environment', category='build-dev', description='Show info about the mach and build environment.') + @CommandArgument('--format', default='pretty', + choices=['pretty', 'client.mk', 'configure', 'json'], + help='Print data in the given format.') + @CommandArgument('--output', '-o', type=str, + help='Output to the given file.') @CommandArgument('--verbose', '-v', action='store_true', help='Print verbose output.') - def environment(self, verbose=False): + def environment(self, format, output=None, verbose=False): + func = getattr(self, '_environment_%s' % format.replace('.', '_')) + + if output: + # We want to preserve mtimes if the output file already exists + # and the content hasn't changed. + from mozbuild.util import FileAvoidWrite + with FileAvoidWrite(output) as out: + return func(out, verbose) + return func(sys.stdout, verbose) + + def _environment_pretty(self, out, verbose): state_dir = self._mach_context.state_dir import platform - print('platform:\n\t%s' % platform.platform()) - print('python version:\n\t%s' % sys.version) - print('python prefix:\n\t%s' % sys.prefix) - print('mach cwd:\n\t%s' % self._mach_context.cwd) - print('os cwd:\n\t%s' % os.getcwd()) - print('mach directory:\n\t%s' % self._mach_context.topdir) - print('state directory:\n\t%s' % state_dir) + print('platform:\n\t%s' % platform.platform(), file=out) + print('python version:\n\t%s' % sys.version, file=out) + print('python prefix:\n\t%s' % sys.prefix, file=out) + print('mach cwd:\n\t%s' % self._mach_context.cwd, file=out) + print('os cwd:\n\t%s' % os.getcwd(), file=out) + print('mach directory:\n\t%s' % self._mach_context.topdir, file=out) + print('state directory:\n\t%s' % state_dir, file=out) - print('object directory:\n\t%s' % self.topobjdir) + print('object directory:\n\t%s' % self.topobjdir, file=out) if self.mozconfig['path']: - print('mozconfig path:\n\t%s' % self.mozconfig['path']) + print('mozconfig path:\n\t%s' % self.mozconfig['path'], file=out) if self.mozconfig['configure_args']: - print('mozconfig configure args:') + print('mozconfig configure args:', file=out) for arg in self.mozconfig['configure_args']: - print('\t%s' % arg) + print('\t%s' % arg, file=out) if self.mozconfig['make_extra']: - print('mozconfig extra make args:') + print('mozconfig extra make args:', file=out) for arg in self.mozconfig['make_extra']: - print('\t%s' % arg) + print('\t%s' % arg, file=out) if self.mozconfig['make_flags']: - print('mozconfig make flags:') + print('mozconfig make flags:', file=out) for arg in self.mozconfig['make_flags']: - print('\t%s' % arg) + print('\t%s' % arg, file=out) config = None @@ -960,14 +978,70 @@ class MachDebug(MachCommandBase): pass if config: - print('config topsrcdir:\n\t%s' % config.topsrcdir) - print('config topobjdir:\n\t%s' % config.topobjdir) + print('config topsrcdir:\n\t%s' % config.topsrcdir, file=out) + print('config topobjdir:\n\t%s' % config.topobjdir, file=out) if verbose: - print('config substitutions:') + print('config substitutions:', file=out) for k in sorted(config.substs): - print('\t%s: %s' % (k, config.substs[k])) + print('\t%s: %s' % (k, config.substs[k]), file=out) - print('config defines:') + print('config defines:', file=out) for k in sorted(config.defines): - print('\t%s' % k) + print('\t%s' % k, file=out) + + def _environment_client_mk(self, out, verbose): + if self.mozconfig['make_extra']: + for arg in self.mozconfig['make_extra']: + print(arg, file=out) + objdir = mozpath.normsep(self.topobjdir) + print('MOZ_OBJDIR=%s' % objdir, file=out) + if 'MOZ_CURRENT_PROJECT' in os.environ: + objdir = mozpath.join(objdir, os.environ['MOZ_CURRENT_PROJECT']) + print('OBJDIR=%s' % objdir, file=out) + if self.mozconfig['path']: + print('FOUND_MOZCONFIG=%s' % mozpath.normsep(self.mozconfig['path']), + file=out) + + def _environment_configure(self, out, verbose): + if self.mozconfig['path']: + # Replace ' with '"'"', so that shell quoting e.g. + # a'b becomes 'a'"'"'b'. + quote = lambda s: s.replace("'", """'"'"'""") + print('echo Adding configure options from %s' % + mozpath.normsep(self.mozconfig['path']), file=out) + if self.mozconfig['configure_args']: + for arg in self.mozconfig['configure_args']: + quoted_arg = quote(arg) + print("echo ' %s'" % quoted_arg, file=out) + print("""set -- "$@" '%s'""" % quoted_arg, file=out) + for key, value in self.mozconfig['env']['added'].items(): + print("export %s='%s'" % (key, quote(value)), file=out) + for key, (old, value) in self.mozconfig['env']['modified'].items(): + print("export %s='%s'" % (key, quote(value)), file=out) + for key, value in self.mozconfig['vars']['added'].items(): + print("%s='%s'" % (key, quote(value)), file=out) + for key, (old, value) in self.mozconfig['vars']['modified'].items(): + print("%s='%s'" % (key, quote(value)), file=out) + for key in self.mozconfig['env']['removed'].keys() + \ + self.mozconfig['vars']['removed'].keys(): + print("unset %s" % key, file=out) + + def _environment_json(self, out, verbose): + import json + class EnvironmentEncoder(json.JSONEncoder): + def default(self, obj): + if isinstance(obj, MozbuildObject): + result = { + 'topsrcdir': obj.topsrcdir, + 'topobjdir': obj.topobjdir, + 'mozconfig': obj.mozconfig, + } + if verbose: + result['substs'] = obj.substs + result['defines'] = obj.defines + return result + elif isinstance(obj, set): + return list(obj) + return json.JSONEncoder.default(self, obj) + json.dump(self, cls=EnvironmentEncoder, sort_keys=True, fp=out) diff --git a/python/mozbuild/mozbuild/mozconfig.py b/python/mozbuild/mozbuild/mozconfig.py index 3c1e3ebbb796..9feca701b238 100644 --- a/python/mozbuild/mozbuild/mozconfig.py +++ b/python/mozbuild/mozbuild/mozconfig.py @@ -65,7 +65,11 @@ class MozconfigLoader(ProcessExecutionMixin): DEPRECATED_TOPSRCDIR_PATHS = ('mozconfig.sh', 'myconfig.sh') DEPRECATED_HOME_PATHS = ('.mozconfig', '.mozconfig.sh', '.mozmyconfig.sh') - IGNORE_SHELL_VARIABLES = ('_') + IGNORE_SHELL_VARIABLES = {'_'} + + ENVIRONMENT_VARIABLES = { + 'CC', 'CXX', 'CFLAGS', 'CXXFLAGS', 'LDFLAGS', 'MOZ_OBJDIR', + } def __init__(self, topsrcdir): self.topsrcdir = topsrcdir @@ -196,6 +200,7 @@ class MozconfigLoader(ProcessExecutionMixin): 'make_flags': None, 'make_extra': None, 'env': None, + 'vars': None, } if path is None: @@ -231,36 +236,49 @@ class MozconfigLoader(ProcessExecutionMixin): parsed = self._parse_loader_output(output) - all_variables = set(parsed['vars_before'].keys()) - all_variables |= set(parsed['vars_after'].keys()) + def diff_vars(vars_before, vars_after): + set1 = set(vars_before.keys()) - self.IGNORE_SHELL_VARIABLES + set2 = set(vars_after.keys()) - self.IGNORE_SHELL_VARIABLES + added = set2 - set1 + removed = set1 - set2 + maybe_modified = set1 & set2 + changed = { + 'added': {}, + 'removed': {}, + 'modified': {}, + 'unmodified': {}, + } - changed = { - 'added': {}, - 'removed': {}, - 'modified': {}, - 'unmodified': {}, - } + for key in added: + changed['added'][key] = vars_after[key] - for key in all_variables: - if key in self.IGNORE_SHELL_VARIABLES: - continue + for key in removed: + changed['removed'][key] = vars_before[key] - if key not in parsed['vars_before']: - changed['added'][key] = parsed['vars_after'][key] - continue + for key in maybe_modified: + if vars_before[key] != vars_after[key]: + changed['modified'][key] = ( + vars_before[key], vars_after[key]) + elif key in self.ENVIRONMENT_VARIABLES: + # In order for irrelevant environment variable changes not + # to incur in re-running configure, only a set of + # environment variables are stored when they are + # unmodified. Otherwise, changes such as using a different + # terminal window, or even rebooting, would trigger + # reconfigures. + changed['unmodified'][key] = vars_after[key] - if key not in parsed['vars_after']: - changed['removed'][key] = parsed['vars_before'][key] - continue + return changed - if parsed['vars_before'][key] != parsed['vars_after'][key]: - changed['modified'][key] = ( - parsed['vars_before'][key], parsed['vars_after'][key]) - continue + result['env'] = diff_vars(parsed['env_before'], parsed['env_after']) - changed['unmodified'][key] = parsed['vars_after'][key] - - result['env'] = changed + # Environment variables also appear as shell variables, but that's + # uninteresting duplication of information. Filter them out. + filt = lambda x, y: {k: v for k, v in x.items() if k not in y} + result['vars'] = diff_vars( + filt(parsed['vars_before'], parsed['env_before']), + filt(parsed['vars_after'], parsed['env_after']) + ) result['configure_args'] = [self._expand(o) for o in parsed['ac']] @@ -268,6 +286,9 @@ class MozconfigLoader(ProcessExecutionMixin): result['configure_args'].extend(self._expand(o) for o in parsed['ac_app'][moz_build_app]) + if 'MOZ_OBJDIR' in parsed['env_before']: + result['topobjdir'] = parsed['env_before']['MOZ_OBJDIR'] + mk = [self._expand(o) for o in parsed['mk']] for o in mk: @@ -297,6 +318,8 @@ class MozconfigLoader(ProcessExecutionMixin): ac_app_options = defaultdict(list) before_source = {} after_source = {} + env_before_source = {} + env_after_source = {} current = None current_type = None @@ -339,7 +362,14 @@ class MozconfigLoader(ProcessExecutionMixin): assert current_type is not None - if current_type in ('BEFORE_SOURCE', 'AFTER_SOURCE'): + vars_mapping = { + 'BEFORE_SOURCE': before_source, + 'AFTER_SOURCE': after_source, + 'ENV_BEFORE_SOURCE': env_before_source, + 'ENV_AFTER_SOURCE': env_after_source, + } + + if current_type in vars_mapping: # mozconfigs are sourced using the Bourne shell (or at least # in Bourne shell mode). This means |set| simply lists # variables from the current shell (not functions). (Note that @@ -400,10 +430,7 @@ class MozconfigLoader(ProcessExecutionMixin): assert name is not None - if current_type == 'BEFORE_SOURCE': - before_source[name] = value - else: - after_source[name] = value + vars_mapping[current_type][name] = value current = [] @@ -417,6 +444,8 @@ class MozconfigLoader(ProcessExecutionMixin): 'ac_app': ac_app_options, 'vars_before': before_source, 'vars_after': after_source, + 'env_before': env_before_source, + 'env_after': env_after_source, } def _expand(self, s): diff --git a/python/mozbuild/mozbuild/mozconfig_loader b/python/mozbuild/mozbuild/mozconfig_loader index d12c7fa0c0f6..569c69030719 100755 --- a/python/mozbuild/mozbuild/mozconfig_loader +++ b/python/mozbuild/mozbuild/mozconfig_loader @@ -44,6 +44,10 @@ mk_add_options() { done } +echo "------BEGIN_ENV_BEFORE_SOURCE" +env +echo "------END_ENV_BEFORE_SOURCE" + echo "------BEGIN_BEFORE_SOURCE" set echo "------END_BEFORE_SOURCE" @@ -58,3 +62,7 @@ echo "------BEGIN_AFTER_SOURCE" set echo "------END_AFTER_SOURCE" +echo "------BEGIN_ENV_AFTER_SOURCE" +env +echo "------END_ENV_AFTER_SOURCE" + diff --git a/python/mozbuild/mozbuild/test/backend/common.py b/python/mozbuild/mozbuild/test/backend/common.py index 7cfec3c76096..b6e156614810 100644 --- a/python/mozbuild/mozbuild/test/backend/common.py +++ b/python/mozbuild/mozbuild/test/backend/common.py @@ -83,6 +83,14 @@ CONFIGS = DefaultOnReadDict({ class BackendTester(unittest.TestCase): + def setUp(self): + self._old_env = dict(os.environ) + os.environ.pop('MOZ_OBJDIR', None) + + def tearDown(self): + os.environ.clear() + os.environ.update(self._old_env) + def _get_environment(self, name): """Obtain a new instance of a ConfigEnvironment for a known profile. diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index 35fe462324f0..76afab24586d 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -41,6 +41,14 @@ data_path = mozpath.join(data_path, 'data') class TestEmitterBasic(unittest.TestCase): + def setUp(self): + self._old_env = dict(os.environ) + os.environ.pop('MOZ_OBJDIR', None) + + def tearDown(self): + os.environ.clear() + os.environ.update(self._old_env) + def reader(self, name): config = MockConfig(mozpath.join(data_path, name), extra_substs=dict( ENABLE_TESTS='1', diff --git a/python/mozbuild/mozbuild/test/test_base.py b/python/mozbuild/mozbuild/test/test_base.py index 2b2b53a301d1..f7822ff16783 100644 --- a/python/mozbuild/mozbuild/test/test_base.py +++ b/python/mozbuild/mozbuild/test/test_base.py @@ -21,14 +21,15 @@ from mozbuild.base import ( BadEnvironmentException, MachCommandBase, MozbuildObject, + ObjdirMismatchException, PathArgument, ) from mozbuild.backend.configenvironment import ConfigEnvironment +from buildconfig import topsrcdir, topobjdir curdir = os.path.dirname(__file__) -topsrcdir = os.path.abspath(os.path.join(curdir, '..', '..', '..', '..')) log_manager = LoggingManager() @@ -37,14 +38,15 @@ class TestMozbuildObject(unittest.TestCase): self._old_cwd = os.getcwd() self._old_env = dict(os.environ) os.environ.pop('MOZCONFIG', None) + os.environ.pop('MOZ_OBJDIR', None) def tearDown(self): os.chdir(self._old_cwd) os.environ.clear() os.environ.update(self._old_env) - def get_base(self): - return MozbuildObject(topsrcdir, None, log_manager) + def get_base(self, topobjdir=None): + return MozbuildObject(topsrcdir, None, log_manager, topobjdir=topobjdir) def test_objdir_config_guess(self): base = self.get_base() @@ -71,7 +73,6 @@ class TestMozbuildObject(unittest.TestCase): 'foo')) self.assertTrue(base.topobjdir.endswith('foo')) - @unittest.skip('Failing on buildbot.') def test_objdir_config_status(self): """Ensure @CONFIG_GUESS@ is handled when loading mozconfig.""" base = self.get_base() @@ -102,16 +103,17 @@ class TestMozbuildObject(unittest.TestCase): mozconfig=mozconfig, ), fh) - os.environ[b'MOZCONFIG'] = mozconfig + os.environ[b'MOZCONFIG'] = mozconfig.encode('utf-8') os.chdir(topobjdir) - obj = MozbuildObject.from_environment() + obj = MozbuildObject.from_environment( + detect_virtualenv_mozinfo=False) self.assertEqual(obj.topobjdir, topobjdir) finally: + os.chdir(self._old_cwd) shutil.rmtree(d) - @unittest.skip('Failing on buildbot.') def test_relative_objdir(self): """Relative defined objdirs are loaded properly.""" d = os.path.realpath(tempfile.mkdtemp()) @@ -130,16 +132,18 @@ class TestMozbuildObject(unittest.TestCase): mozconfig=mozconfig, ), fh) - os.environ[b'MOZCONFIG'] = mozconfig + os.environ[b'MOZCONFIG'] = mozconfig.encode('utf-8') child = os.path.join(topobjdir, 'foo', 'bar') os.makedirs(child) os.chdir(child) - obj = MozbuildObject.from_environment() + obj = MozbuildObject.from_environment( + detect_virtualenv_mozinfo=False) self.assertEqual(obj.topobjdir, topobjdir) finally: + os.chdir(self._old_cwd) shutil.rmtree(d) @unittest.skipIf(not hasattr(os, 'symlink'), 'symlinks not available.') @@ -173,9 +177,9 @@ class TestMozbuildObject(unittest.TestCase): self.assertEqual(obj.topobjdir, topobjdir_real) finally: + os.chdir(self._old_cwd) shutil.rmtree(d) - @unittest.skip('Failed on buildbot (bug 853954)') def test_mach_command_base_inside_objdir(self): """Ensure a MachCommandBase constructed from inside the objdir works.""" @@ -204,6 +208,7 @@ class TestMozbuildObject(unittest.TestCase): context.topdir = topsrcdir context.settings = None context.log_manager = None + context.detect_virtualenv_mozinfo=False o = MachCommandBase(context) @@ -211,9 +216,9 @@ class TestMozbuildObject(unittest.TestCase): self.assertEqual(o.topsrcdir, topsrcdir) finally: + os.chdir(self._old_cwd) shutil.rmtree(d) - @unittest.skip('Failing on buildbot.') def test_objdir_is_srcdir_rejected(self): """Ensure the srcdir configurations are rejected.""" d = os.path.realpath(tempfile.mkdtemp()) @@ -231,6 +236,41 @@ class TestMozbuildObject(unittest.TestCase): MozbuildObject.from_environment(detect_virtualenv_mozinfo=False) finally: + os.chdir(self._old_cwd) + shutil.rmtree(d) + + def test_objdir_mismatch(self): + """Ensure MachCommandBase throwing on objdir mismatch.""" + d = os.path.realpath(tempfile.mkdtemp()) + + try: + real_topobjdir = os.path.join(d, 'real-objdir') + os.makedirs(real_topobjdir) + + topobjdir = os.path.join(d, 'objdir') + os.makedirs(topobjdir) + + topsrcdir = os.path.join(d, 'srcdir') + os.makedirs(topsrcdir) + + mozconfig = os.path.join(d, 'mozconfig') + with open(mozconfig, 'wt') as fh: + fh.write('mk_add_options MOZ_OBJDIR=%s' % real_topobjdir) + + mozinfo = os.path.join(topobjdir, 'mozinfo.json') + with open(mozinfo, 'wt') as fh: + json.dump(dict( + topsrcdir=topsrcdir, + mozconfig=mozconfig, + ), fh) + + os.chdir(topobjdir) + + with self.assertRaises(ObjdirMismatchException): + MozbuildObject.from_environment(detect_virtualenv_mozinfo=False) + + finally: + os.chdir(self._old_cwd) shutil.rmtree(d) def test_config_guess(self): @@ -242,9 +282,8 @@ class TestMozbuildObject(unittest.TestCase): self.assertIsNotNone(result) self.assertGreater(len(result), 0) - @unittest.skip('Failing on buildbot (bug 853954).') def test_config_environment(self): - base = self.get_base() + base = self.get_base(topobjdir=topobjdir) ce = base.config_environment self.assertIsInstance(ce, ConfigEnvironment) @@ -255,15 +294,17 @@ class TestMozbuildObject(unittest.TestCase): self.assertIsInstance(base.defines, dict) self.assertIsInstance(base.substs, dict) - @unittest.skip('Failing on buildbot (bug 853954).') def test_get_binary_path(self): - base = self.get_base() + base = self.get_base(topobjdir=topobjdir) platform = sys.platform # We should ideally use the config.status from the build. Let's install # a fake one. - substs = [('MOZ_APP_NAME', 'awesomeapp')] + substs = [ + ('MOZ_APP_NAME', 'awesomeapp'), + ('MOZ_BUILD_APP', 'awesomeapp'), + ] if sys.platform.startswith('darwin'): substs.append(('OS_ARCH', 'Darwin')) substs.append(('BIN_SUFFIX', '')) @@ -298,7 +339,7 @@ class TestMozbuildObject(unittest.TestCase): if platform.startswith('darwin'): self.assertTrue(p.endswith('awesomeapp/Nightly.app/Contents/MacOS/awesomeapp')) elif platform.startswith(('win32', 'cygwin')): - self.assertTrue(p.endswith('awesomeapp/awesomeapp.exe')) + self.assertTrue(p.endswith('awesomeapp\\awesomeapp.exe')) else: self.assertTrue(p.endswith('awesomeapp/awesomeapp')) diff --git a/python/mozbuild/mozbuild/test/test_mozconfig.py b/python/mozbuild/mozbuild/test/test_mozconfig.py index 429523d04e68..744424ee04fd 100644 --- a/python/mozbuild/mozbuild/test/test_mozconfig.py +++ b/python/mozbuild/mozbuild/test/test_mozconfig.py @@ -29,6 +29,7 @@ class TestMozconfigLoader(unittest.TestCase): def setUp(self): self._old_env = dict(os.environ) os.environ.pop('MOZCONFIG', None) + os.environ.pop('MOZ_OBJDIR', None) os.environ.pop('CC', None) os.environ.pop('CXX', None) self._temp_dirs = set() @@ -243,6 +244,7 @@ class TestMozconfigLoader(unittest.TestCase): 'make_flags': None, 'make_extra': None, 'env': None, + 'vars': None, }) def test_read_empty_mozconfig(self): @@ -256,9 +258,10 @@ class TestMozconfigLoader(unittest.TestCase): self.assertEqual(result['make_extra'], []) for f in ('added', 'removed', 'modified'): + self.assertEqual(len(result['vars'][f]), 0) self.assertEqual(len(result['env'][f]), 0) - self.assertGreater(len(result['env']['unmodified']), 0) + self.assertEqual(result['env']['unmodified'], {}) def test_read_capture_ac_options(self): """Ensures ac_add_options calls are captured.""" @@ -316,6 +319,22 @@ class TestMozconfigLoader(unittest.TestCase): self.assertEqual(result['make_flags'], '-j8') self.assertEqual(result['make_extra'], ['FOO=BAR BAZ', 'BIZ=1']) + def test_read_empty_mozconfig_objdir_environ(self): + os.environ[b'MOZ_OBJDIR'] = b'obj-firefox' + with NamedTemporaryFile(mode='w') as mozconfig: + result = self.get_loader().read_mozconfig(mozconfig.name) + self.assertEqual(result['topobjdir'], 'obj-firefox') + + def test_read_capture_mk_options_objdir_environ(self): + """Ensures mk_add_options calls are captured and override the environ.""" + os.environ[b'MOZ_OBJDIR'] = b'obj-firefox' + with NamedTemporaryFile(mode='w') as mozconfig: + mozconfig.write('mk_add_options MOZ_OBJDIR=/foo/bar\n') + mozconfig.flush() + + result = self.get_loader().read_mozconfig(mozconfig.name) + self.assertEqual(result['topobjdir'], '/foo/bar') + def test_read_moz_objdir_substitution(self): """Ensure @TOPSRCDIR@ substitution is recognized in MOZ_OBJDIR.""" with NamedTemporaryFile(mode='w') as mozconfig: @@ -337,9 +356,10 @@ class TestMozconfigLoader(unittest.TestCase): result = self.get_loader().read_mozconfig(mozconfig.name) - self.assertEqual(result['env']['added'], { + self.assertEqual(result['vars']['added'], { 'CC': '/usr/local/bin/clang', 'CXX': '/usr/local/bin/clang++'}) + self.assertEqual(result['env']['added'], {}) def test_read_exported_variables(self): """Exported variables are caught as new variables.""" @@ -349,6 +369,7 @@ class TestMozconfigLoader(unittest.TestCase): result = self.get_loader().read_mozconfig(mozconfig.name) + self.assertEqual(result['vars']['added'], {}) self.assertEqual(result['env']['added'], { 'MY_EXPORTED': 'woot'}) @@ -362,10 +383,25 @@ class TestMozconfigLoader(unittest.TestCase): result = self.get_loader().read_mozconfig(mozconfig.name) + self.assertEqual(result['vars']['modified'], {}) self.assertEqual(result['env']['modified'], { 'CC': ('/usr/bin/gcc', '/usr/local/bin/clang') }) + def test_read_unmodified_variables(self): + """Variables modified by mozconfig are detected.""" + os.environ[b'CC'] = b'/usr/bin/gcc' + + with NamedTemporaryFile(mode='w') as mozconfig: + mozconfig.flush() + + result = self.get_loader().read_mozconfig(mozconfig.name) + + self.assertEqual(result['vars']['unmodified'], {}) + self.assertEqual(result['env']['unmodified'], { + 'CC': '/usr/bin/gcc' + }) + def test_read_removed_variables(self): """Variables unset by the mozconfig are detected.""" os.environ[b'CC'] = b'/usr/bin/clang' @@ -376,6 +412,7 @@ class TestMozconfigLoader(unittest.TestCase): result = self.get_loader().read_mozconfig(mozconfig.name) + self.assertEqual(result['vars']['removed'], {}) self.assertEqual(result['env']['removed'], { 'CC': '/usr/bin/clang'}) @@ -388,10 +425,11 @@ class TestMozconfigLoader(unittest.TestCase): result = self.get_loader().read_mozconfig(mozconfig.name) - self.assertEqual(result['env']['added'], { + self.assertEqual(result['vars']['added'], { 'multi': 'foo\nbar', 'single': '1' }) + self.assertEqual(result['env']['added'], {}) def test_read_topsrcdir_defined(self): """Ensure $topsrcdir references work as expected.""" @@ -402,19 +440,25 @@ class TestMozconfigLoader(unittest.TestCase): loader = self.get_loader() result = loader.read_mozconfig(mozconfig.name) - self.assertEqual(result['env']['added']['TEST'], + self.assertEqual(result['vars']['added']['TEST'], loader.topsrcdir.replace(os.sep, '/')) + self.assertEqual(result['env']['added'], {}) def test_read_empty_variable_value(self): """Ensure empty variable values are parsed properly.""" with NamedTemporaryFile(mode='w') as mozconfig: mozconfig.write('EMPTY=\n') + mozconfig.write('export EXPORT_EMPTY=\n') mozconfig.flush() result = self.get_loader().read_mozconfig(mozconfig.name) - self.assertIn('EMPTY', result['env']['added']) - self.assertEqual(result['env']['added']['EMPTY'], '') + self.assertEqual(result['vars']['added'], { + 'EMPTY': '', + }) + self.assertEqual(result['env']['added'], { + 'EXPORT_EMPTY': '' + }) def test_read_load_exception(self): """Ensure non-0 exit codes in mozconfigs are handled properly.""" diff --git a/testing/xpcshell/selftest.py b/testing/xpcshell/selftest.py index 60530bc58874..64c6207a5805 100644 --- a/testing/xpcshell/selftest.py +++ b/testing/xpcshell/selftest.py @@ -12,6 +12,7 @@ from StringIO import StringIO from xml.etree.ElementTree import ElementTree from mozbuild.base import MozbuildObject +os.environ.pop('MOZ_OBJDIR') build_obj = MozbuildObject.from_environment() from runxpcshelltests import XPCShellTests From 0a192b7fe6b55039383c0d831316ed9dcdc0d1db Mon Sep 17 00:00:00 2001 From: Jonathan Griffin Date: Wed, 2 Jul 2014 15:23:10 -0700 Subject: [PATCH 55/94] Bug 1033033 - Don't access the device_manager during __init__, r=mdas --- .../client/marionette/runner/mixins/endurance.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/testing/marionette/client/marionette/runner/mixins/endurance.py b/testing/marionette/client/marionette/runner/mixins/endurance.py index a618bb930c60..3d5ce1f9b090 100644 --- a/testing/marionette/client/marionette/runner/mixins/endurance.py +++ b/testing/marionette/client/marionette/runner/mixins/endurance.py @@ -133,11 +133,13 @@ class MemoryEnduranceTestCaseMixin(object): def __init__(self, *args, **kwargs): # TODO: add desktop support - if self.device_manager: - self.add_checkpoint_function(self.memory_b2g_checkpoint) - self.add_process_checkpoint_function(self.memory_b2g_process_checkpoint) + self.add_checkpoint_function(self.memory_b2g_checkpoint) + self.add_process_checkpoint_function(self.memory_b2g_process_checkpoint) def memory_b2g_checkpoint(self): + if not self.device_manager: + return + # Sleep to give device idle time (for gc) idle_time = 30 self.marionette.log("sleeping %d seconds to give the device some idle time" % idle_time) @@ -150,6 +152,9 @@ class MemoryEnduranceTestCaseMixin(object): log_file.write('%s\n' % output_str) def memory_b2g_process_checkpoint(self): + if not self.device_manager: + return + # Process checkpoint data into .json self.marionette.log("processing checkpoint data from %s" % self.log_name) From 2818af017f76368f8297076a6e64f6b2d34e3dac Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Sat, 28 Jun 2014 11:56:06 +0200 Subject: [PATCH 56/94] Bug 1028187 - Enable IndexedDB for about:looppanel and about:loopconversation, sharing an origin r=bz --- browser/components/about/AboutRedirector.cpp | 37 ++++++++++++-- docshell/base/nsAboutRedirector.cpp | 7 +++ dom/base/nsGlobalWindow.cpp | 52 +++++++++++++++++--- netwerk/protocol/about/nsAboutBlank.cpp | 8 +++ netwerk/protocol/about/nsAboutBloat.cpp | 8 +++ netwerk/protocol/about/nsAboutCache.cpp | 8 +++ netwerk/protocol/about/nsAboutCacheEntry.cpp | 8 +++ netwerk/protocol/about/nsIAboutModule.idl | 14 +++++- 8 files changed, 132 insertions(+), 10 deletions(-) diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp index f1f65e8a25ad..5ccb7018b2e0 100644 --- a/browser/components/about/AboutRedirector.cpp +++ b/browser/components/about/AboutRedirector.cpp @@ -9,6 +9,7 @@ #include "nsNetUtil.h" #include "nsIScriptSecurityManager.h" #include "mozilla/ArrayUtils.h" +#include "nsDOMString.h" namespace mozilla { namespace browser { @@ -19,6 +20,7 @@ struct RedirEntry { const char* id; const char* url; uint32_t flags; + const char* idbOriginPostfix; }; /* @@ -78,7 +80,9 @@ static RedirEntry kRedirMap[] = { #endif { "home", "chrome://browser/content/abouthome/aboutHome.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::ALLOW_SCRIPT }, + nsIAboutModule::ALLOW_SCRIPT | + nsIAboutModule::ENABLE_INDEXED_DB, + "home" }, { "newtab", "chrome://browser/content/newtab/newTab.xul", nsIAboutModule::ALLOW_SCRIPT }, { "permissions", "chrome://browser/content/preferences/aboutPermissions.xul", @@ -101,11 +105,15 @@ static RedirEntry kRedirMap[] = { { "loopconversation", "chrome://browser/content/loop/conversation.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, + nsIAboutModule::HIDE_FROM_ABOUTABOUT | + nsIAboutModule::ENABLE_INDEXED_DB }, { "looppanel", "chrome://browser/content/loop/panel.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT }, + nsIAboutModule::HIDE_FROM_ABOUTABOUT | + nsIAboutModule::ENABLE_INDEXED_DB, + // Shares an IndexedDB origin with about:loopconversation. + "loopconversation" }, #endif }; static const int kRedirTotal = ArrayLength(kRedirMap); @@ -174,6 +182,29 @@ AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_ERROR_ILLEGAL_VALUE; } +NS_IMETHODIMP +AboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) +{ + NS_ENSURE_ARG_POINTER(aURI); + + nsAutoCString name = GetAboutModuleName(aURI); + + for (int i = 0; i < kRedirTotal; i++) { + if (name.Equals(kRedirMap[i].id)) { + const char* postfix = kRedirMap[i].idbOriginPostfix; + if (!postfix) { + break; + } + + result.AssignASCII(postfix); + return NS_OK; + } + } + + SetDOMStringToNull(result); + return NS_ERROR_ILLEGAL_VALUE; +} + nsresult AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result) { diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index ff233ee1c11b..d25dfa2a777e 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -136,6 +136,13 @@ nsAboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_ERROR_ILLEGAL_VALUE; } +NS_IMETHODIMP +nsAboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) +{ + SetDOMStringToNull(result); + return NS_ERROR_NOT_IMPLEMENTED; +} + nsresult nsAboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 868dce3b88b5..d1600de2dcfa 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -68,6 +68,7 @@ #include "mozilla/MouseEvents.h" #include "AudioChannelService.h" #include "MessageEvent.h" +#include "nsAboutProtocolUtils.h" // Interfaces Needed #include "nsIFrame.h" @@ -10511,6 +10512,39 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage) return rv.ErrorCode(); } +static nsAutoCString +GetIndexedDBOriginPostfixForAboutURI(nsIURI *aURI) +{ + nsAutoCString result; + + nsCOMPtr module; + nsresult rv = NS_GetAboutModule(aURI, getter_AddRefs(module)); + NS_ENSURE_SUCCESS(rv, result); + + uint32_t flags; + rv = module->GetURIFlags(aURI, &flags); + if (NS_FAILED(rv) || !(flags & nsIAboutModule::ENABLE_INDEXED_DB)) { + return result; + } + + nsAutoString postfix; + rv = module->GetIndexedDBOriginPostfix(aURI, postfix); + if (NS_FAILED(rv) || DOMStringIsNull(postfix)) { + return result; + } + + nsCOMPtr origin = NS_GetInnermostURI(aURI); + NS_ENSURE_TRUE(origin, result); + + nsAutoCString scheme; + rv = origin->GetScheme(scheme); + NS_ENSURE_SUCCESS(rv, result); + + result = scheme + NS_LITERAL_CSTRING(":") + NS_ConvertUTF16toUTF8(postfix); + ToLowerCase(result); + return result; +} + indexedDB::IDBFactory* nsGlobalWindow::GetIndexedDB(ErrorResult& aError) { @@ -10522,6 +10556,8 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError) return nullptr; } + nsCString origin; + if (!IsChromeWindow()) { // Whitelist about:home, since it doesn't have a base domain it would not // pass the thirdPartyUtil check, though it should be able to use @@ -10531,11 +10567,15 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError) if (principal) { nsCOMPtr uri; principal->GetURI(getter_AddRefs(uri)); - bool isAbout = false; - if (uri && NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)) && isAbout) { - nsAutoCString path; - skipThirdPartyCheck = NS_SUCCEEDED(uri->GetPath(path)) && - path.EqualsLiteral("home"); + + if (uri) { + bool isAbout = false; + nsresult rv = uri->SchemeIs("about", &isAbout); + + if (NS_SUCCEEDED(rv) && isAbout) { + origin = GetIndexedDBOriginPostfixForAboutURI(uri); + skipThirdPartyCheck = !origin.IsEmpty(); + } } } @@ -10559,7 +10599,7 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError) } // This may be null if being created from a file. - aError = indexedDB::IDBFactory::Create(this, nullptr, + aError = indexedDB::IDBFactory::Create(this, origin, origin, nullptr, getter_AddRefs(mIndexedDB)); } diff --git a/netwerk/protocol/about/nsAboutBlank.cpp b/netwerk/protocol/about/nsAboutBlank.cpp index 85d1fb92b736..95cb51862d81 100644 --- a/netwerk/protocol/about/nsAboutBlank.cpp +++ b/netwerk/protocol/about/nsAboutBlank.cpp @@ -5,6 +5,7 @@ #include "nsAboutBlank.h" #include "nsStringStream.h" +#include "nsDOMString.h" #include "nsNetUtil.h" NS_IMPL_ISUPPORTS(nsAboutBlank, nsIAboutModule) @@ -36,6 +37,13 @@ nsAboutBlank::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } +NS_IMETHODIMP +nsAboutBlank::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) +{ + SetDOMStringToNull(result); + return NS_ERROR_NOT_IMPLEMENTED; +} + nsresult nsAboutBlank::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/netwerk/protocol/about/nsAboutBloat.cpp b/netwerk/protocol/about/nsAboutBloat.cpp index b997853ac404..ba1a95d53b1b 100644 --- a/netwerk/protocol/about/nsAboutBloat.cpp +++ b/netwerk/protocol/about/nsAboutBloat.cpp @@ -10,6 +10,7 @@ #include "nsAboutBloat.h" #include "nsStringStream.h" +#include "nsDOMString.h" #include "nsIURI.h" #include "nsCOMPtr.h" #include "nsNetUtil.h" @@ -124,6 +125,13 @@ nsAboutBloat::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } +NS_IMETHODIMP +nsAboutBloat::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) +{ + SetDOMStringToNull(result); + return NS_ERROR_NOT_IMPLEMENTED; +} + nsresult nsAboutBloat::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/netwerk/protocol/about/nsAboutCache.cpp b/netwerk/protocol/about/nsAboutCache.cpp index 2e5df23acb6c..7f1ca35f0b2f 100644 --- a/netwerk/protocol/about/nsAboutCache.cpp +++ b/netwerk/protocol/about/nsAboutCache.cpp @@ -12,6 +12,7 @@ #include "nsEscape.h" #include "nsAboutProtocolUtils.h" #include "nsPrintfCString.h" +#include "nsDOMString.h" #include "nsICacheStorageService.h" #include "nsICacheStorage.h" @@ -485,6 +486,13 @@ nsAboutCache::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } +NS_IMETHODIMP +nsAboutCache::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) +{ + SetDOMStringToNull(result); + return NS_ERROR_NOT_IMPLEMENTED; +} + // static nsresult nsAboutCache::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) diff --git a/netwerk/protocol/about/nsAboutCacheEntry.cpp b/netwerk/protocol/about/nsAboutCacheEntry.cpp index c8c88c89fd86..74ae0f291579 100644 --- a/netwerk/protocol/about/nsAboutCacheEntry.cpp +++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp @@ -7,6 +7,7 @@ #include "nsAboutCache.h" #include "nsICacheStorage.h" #include "CacheObserver.h" +#include "nsDOMString.h" #include "nsNetUtil.h" #include "prprf.h" #include "nsEscape.h" @@ -108,6 +109,13 @@ nsAboutCacheEntry::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } +NS_IMETHODIMP +nsAboutCacheEntry::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) +{ + SetDOMStringToNull(result); + return NS_ERROR_NOT_IMPLEMENTED; +} + //----------------------------------------------------------------------------- // nsAboutCacheEntry diff --git a/netwerk/protocol/about/nsIAboutModule.idl b/netwerk/protocol/about/nsIAboutModule.idl index 7213ed32ffac..744dfbed567a 100644 --- a/netwerk/protocol/about/nsIAboutModule.idl +++ b/netwerk/protocol/about/nsIAboutModule.idl @@ -8,7 +8,7 @@ interface nsIURI; interface nsIChannel; -[scriptable, uuid(9575693c-60d9-4332-b6b8-6c29289339cb)] +[scriptable, uuid(1d5992c3-28b0-4ec1-9dbb-f5fde7f72199)] interface nsIAboutModule : nsISupports { /** @@ -41,12 +41,24 @@ interface nsIAboutModule : nsISupports */ const unsigned long HIDE_FROM_ABOUTABOUT = (1 << 2); + /** + * A flag that indicates whether this about: URI wants Indexed DB enabled. + */ + const unsigned long ENABLE_INDEXED_DB = (1 << 3); + /** * A method to get the flags that apply to a given about: URI. The URI * passed in is guaranteed to be one of the URIs that this module * registered to deal with. */ unsigned long getURIFlags(in nsIURI aURI); + + /** + * Returns the Indexed DB origin's postfix used for the given about: URI. + * If the postfix returned is null then the URI's path (e.g. "home" for + * about:home) will be used to construct the origin. + */ + DOMString getIndexedDBOriginPostfix(in nsIURI aURI); }; %{C++ From 09f2a945bafd431891326e39c0be0de9c8f318cb Mon Sep 17 00:00:00 2001 From: Hsin-Yi Tsai Date: Mon, 30 Jun 2014 14:48:41 +0800 Subject: [PATCH 57/94] Bug 1023141 - query ril.ecclist per dial request - part 3 - fix xpcshell. r=aknow --- dom/system/gonk/tests/test_ril_worker_ecm.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/dom/system/gonk/tests/test_ril_worker_ecm.js b/dom/system/gonk/tests/test_ril_worker_ecm.js index 97627fa36002..2c6c88cf8434 100644 --- a/dom/system/gonk/tests/test_ril_worker_ecm.js +++ b/dom/system/gonk/tests/test_ril_worker_ecm.js @@ -122,8 +122,9 @@ add_test(function test_request_exit_emergencyCbMode_when_dial() { }; // Dial non-emergency call. - context.RIL.dial({number: "0912345678", - isDialEmergency: false}); + context.RIL.dialNonEmergencyNumber({number: "0912345678", + isEmergency: false, + isDialEmergency: false}); // Should clear timeout event. do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null); From d9847e64c6d130962b8b63f9794d1b537beb9a50 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 1 Jul 2014 19:38:56 -0700 Subject: [PATCH 58/94] Bug 925530 - Disable WebGL antialiasing on Mobile by default. - r=kamidphish,vlad --- content/canvas/src/WebGLContext.cpp | 5 +++++ modules/libpref/src/init/all.js | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp index 6c9993a6d54f..025b4107c485 100644 --- a/content/canvas/src/WebGLContext.cpp +++ b/content/canvas/src/WebGLContext.cpp @@ -437,6 +437,11 @@ WebGLContext::SetContextOptions(JSContext* aCx, JS::Handle aOptions) // enforce that if stencil is specified, we also give back depth newOpts.depth |= newOpts.stencil; + // Don't do antialiasing if we've disabled MSAA. + if (!gfxPrefs::MSAALevel()) { + newOpts.antialias = false; + } + #if 0 GenerateWarning("aaHint: %d stencil: %d depth: %d alpha: %d premult: %d preserve: %d\n", newOpts.antialias ? 1 : 0, diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index cbb017a34691..746036e86df0 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -3701,7 +3701,12 @@ pref("canvas.image.cache.limit", 0); pref("image.onload.decode.limit", 0); // WebGL prefs +#ifdef ANDROID +// Disable MSAA on mobile. +pref("gl.msaa-level", 0); +#else pref("gl.msaa-level", 2); +#endif pref("webgl.force-enabled", false); pref("webgl.disabled", false); pref("webgl.shader_validator", true); From 5020aab826db5d33ef0d66fa70b2356e5dfe3162 Mon Sep 17 00:00:00 2001 From: Tim Taubert Date: Wed, 2 Jul 2014 16:08:11 -0700 Subject: [PATCH 59/94] Bug 1028187 - Follow-up to fix build bustage r=bustage --- docshell/base/nsAboutRedirector.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index d25dfa2a777e..bc62441bf5b7 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -8,6 +8,7 @@ #include "nsNetUtil.h" #include "nsAboutProtocolUtils.h" #include "mozilla/ArrayUtils.h" +#include "nsDOMString.h" NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule) From deb90eaf9753d05bacf7e7673e91cf666d3e8475 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 08:33:14 +0900 Subject: [PATCH 60/94] Bug 762358 - Fixup test_objdir_config_status to use config.guess output as base. r=gps --- python/mozbuild/mozbuild/test/test_base.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/python/mozbuild/mozbuild/test/test_base.py b/python/mozbuild/mozbuild/test/test_base.py index f7822ff16783..46bb6021fa19 100644 --- a/python/mozbuild/mozbuild/test/test_base.py +++ b/python/mozbuild/mozbuild/test/test_base.py @@ -7,6 +7,7 @@ from __future__ import unicode_literals import json import os import shutil +import subprocess import sys import tempfile import unittest @@ -76,7 +77,9 @@ class TestMozbuildObject(unittest.TestCase): def test_objdir_config_status(self): """Ensure @CONFIG_GUESS@ is handled when loading mozconfig.""" base = self.get_base() - guess = base._config_guess + guess = subprocess.check_output( + [os.path.join(topsrcdir, 'build', 'autoconf', 'config.guess')], + cwd=topsrcdir).strip() # There may be symlinks involved, so we use real paths to ensure # path consistency. From 0f5b0bc3459cb72dfc2c53951d29c3684e4b80b8 Mon Sep 17 00:00:00 2001 From: David Keeler Date: Wed, 2 Jul 2014 11:15:26 -0700 Subject: [PATCH 61/94] bug 940506 - remove nsIRecentBadCerts and implementation r=briansmith --- security/manager/ssl/public/moz.build | 1 - .../ssl/public/nsIRecentBadCertsService.idl | 50 ------ security/manager/ssl/public/nsIX509CertDB.idl | 13 +- .../ssl/src/SSLServerCertVerification.cpp | 14 -- security/manager/ssl/src/SharedSSLState.cpp | 21 --- security/manager/ssl/src/SharedSSLState.h | 1 - security/manager/ssl/src/moz.build | 1 - .../manager/ssl/src/nsNSSCertificateDB.cpp | 30 ---- security/manager/ssl/src/nsNSSCertificateDB.h | 7 - security/manager/ssl/src/nsRecentBadCerts.cpp | 156 ------------------ security/manager/ssl/src/nsRecentBadCerts.h | 84 ---------- 11 files changed, 1 insertion(+), 377 deletions(-) delete mode 100644 security/manager/ssl/public/nsIRecentBadCertsService.idl delete mode 100644 security/manager/ssl/src/nsRecentBadCerts.cpp delete mode 100644 security/manager/ssl/src/nsRecentBadCerts.h diff --git a/security/manager/ssl/public/moz.build b/security/manager/ssl/public/moz.build index f3fd5dacf19e..6b9fee093979 100644 --- a/security/manager/ssl/public/moz.build +++ b/security/manager/ssl/public/moz.build @@ -31,7 +31,6 @@ XPIDL_SOURCES += [ 'nsIPKCS11ModuleDB.idl', 'nsIPKCS11Slot.idl', 'nsIProtectedAuthThread.idl', - 'nsIRecentBadCertsService.idl', 'nsISSLErrorListener.idl', 'nsISSLStatus.idl', 'nsIStreamCipher.idl', diff --git a/security/manager/ssl/public/nsIRecentBadCertsService.idl b/security/manager/ssl/public/nsIRecentBadCertsService.idl deleted file mode 100644 index c221aa1dbd93..000000000000 --- a/security/manager/ssl/public/nsIRecentBadCertsService.idl +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsISupports.idl" - -interface nsIArray; -interface nsIX509Cert; -interface nsISSLStatus; - -%{C++ -#define NS_RECENTBADCERTS_CONTRACTID "@mozilla.org/security/recentbadcerts;1" -%} - -/** - * This represents a global list of recently seen bad ssl status - * including the bad cert. - * The implementation will decide how many entries it will hold, - * the number is expected to be small. - */ -[scriptable, uuid(0fed7784-d152-44d6-95a7-67a59024de0f)] -interface nsIRecentBadCerts : nsISupports { - /** - * Retrieve the recently seen bad ssl status for the given hostname:port. - * If no SSL cert was recently seen for the given hostname:port, return null. - * If a good cert was seen for the given hostname:port, return null. - * - * @param aHostNameWithPort The host:port whose entry should be tested - * @return null or a recently seen bad ssl status with cert - */ - nsISSLStatus getRecentBadCert(in AString aHostNameWithPort); - - /** - * A bad certificate that should be remembered by the service. - * Will be added as the most recently seen cert. - * The service may forget older entries to make room for the new one. - * - * @param aHostNameWithPort The host:port whose entry should be tested - * @param aCert The bad ssl status with certificate - */ - void addBadCert(in AString aHostNameWithPort, - in nsISSLStatus aStatus); - - /** - * Clear all stored cert data. - */ - void resetStoredCerts(); -}; diff --git a/security/manager/ssl/public/nsIX509CertDB.idl b/security/manager/ssl/public/nsIX509CertDB.idl index 1fbf2a33129f..82d1e96af5be 100644 --- a/security/manager/ssl/public/nsIX509CertDB.idl +++ b/security/manager/ssl/public/nsIX509CertDB.idl @@ -12,7 +12,6 @@ interface nsIX509Cert3; interface nsIFile; interface nsIInterfaceRequestor; interface nsIZipReader; -interface nsIRecentBadCerts; interface nsIX509CertList; %{C++ @@ -33,7 +32,7 @@ interface nsIOpenSignedAppFileCallback : nsISupports * This represents a service to access and manipulate * X.509 certificates stored in a database. */ -[scriptable, uuid(7446a5b1-84ca-491f-a2fe-0bc60a71ffa5)] +[scriptable, uuid(dd6e4af8-23bb-41d9-a1e3-9ce925429f2f)] interface nsIX509CertDB : nsISupports { /** @@ -281,16 +280,6 @@ interface nsIX509CertDB : nsISupports { */ nsIX509Cert constructX509(in string certDER, in unsigned long length); - /* - * Obtain a reference to the appropriate service for recent - * bad certificates. May only be called on the main thread. - * - * @param isPrivate True if the service for certs for private connections - * is desired, false otherwise. - * @return The requested service. - */ - nsIRecentBadCerts getRecentBadCerts(in boolean isPrivate); - /** * Verifies the signature on the given JAR file to verify that it has a * valid signature. To be considered valid, there must be exactly one diff --git a/security/manager/ssl/src/SSLServerCertVerification.cpp b/security/manager/ssl/src/SSLServerCertVerification.cpp index abf2f510c870..f0eb67adae78 100644 --- a/security/manager/ssl/src/SSLServerCertVerification.cpp +++ b/security/manager/ssl/src/SSLServerCertVerification.cpp @@ -105,7 +105,6 @@ #include "nsICertOverrideService.h" #include "nsISiteSecurityService.h" #include "nsNSSComponent.h" -#include "nsRecentBadCerts.h" #include "nsNSSIOLayer.h" #include "nsNSSShutDown.h" @@ -499,19 +498,6 @@ CertErrorRunnable::CheckCertOverrides() } } - nsCOMPtr certdb = do_GetService(NS_X509CERTDB_CONTRACTID); - nsCOMPtr recentBadCertsService; - if (certdb) { - bool isPrivate = mProviderFlags & nsISocketProvider::NO_PERMANENT_STORAGE; - certdb->GetRecentBadCerts(isPrivate, getter_AddRefs(recentBadCertsService)); - } - - if (recentBadCertsService) { - NS_ConvertUTF8toUTF16 hostWithPortStringUTF16(hostWithPortString); - recentBadCertsService->AddBadCert(hostWithPortStringUTF16, - mInfoObject->SSLStatus()); - } - // pick the error code to report by priority PRErrorCode errorCodeToReport = mErrorCodeTrust ? mErrorCodeTrust : mErrorCodeMismatch ? mErrorCodeMismatch diff --git a/security/manager/ssl/src/SharedSSLState.cpp b/security/manager/ssl/src/SharedSSLState.cpp index 7e70d4a693c1..3c71c67a6f14 100644 --- a/security/manager/ssl/src/SharedSSLState.cpp +++ b/security/manager/ssl/src/SharedSSLState.cpp @@ -13,7 +13,6 @@ #include "nsThreadUtils.h" #include "nsCRT.h" #include "nsServiceManagerUtils.h" -#include "nsRecentBadCerts.h" #include "PSMRunnable.h" #include "PublicSSL.h" #include "ssl.h" @@ -28,7 +27,6 @@ using mozilla::unused; namespace { static Atomic sCertOverrideSvcExists(false); -static Atomic sCertDBExists(false); class MainThreadClearer : public SyncRunnableBase { @@ -51,19 +49,6 @@ public: } } - bool certDBExists = sCertDBExists.exchange(false); - if (certDBExists) { - sCertDBExists = true; - nsCOMPtr certdb = do_GetService(NS_X509CERTDB_CONTRACTID); - if (certdb) { - nsCOMPtr badCerts; - certdb->GetRecentBadCerts(true, getter_AddRefs(badCerts)); - if (badCerts) { - badCerts->ResetStoredCerts(); - } - } - } - // This needs to be checked on the main thread to avoid racing with NSS // initialization. mShouldClearSessionCache = mozilla::psm::PrivateSSLState() && @@ -210,12 +195,6 @@ SharedSSLState::NoteCertOverrideServiceInstantiated() sCertOverrideSvcExists = true; } -/*static*/ void -SharedSSLState::NoteCertDBServiceInstantiated() -{ - sCertDBExists = true; -} - void SharedSSLState::Cleanup() { diff --git a/security/manager/ssl/src/SharedSSLState.h b/security/manager/ssl/src/SharedSSLState.h index 4d2db8c0efd4..396f5fef6984 100644 --- a/security/manager/ssl/src/SharedSSLState.h +++ b/security/manager/ssl/src/SharedSSLState.h @@ -44,7 +44,6 @@ public: bool SocketCreated(); void NoteSocketCreated(); static void NoteCertOverrideServiceInstantiated(); - static void NoteCertDBServiceInstantiated(); bool IsOCSPStaplingEnabled() const { return mOCSPStaplingEnabled; } private: diff --git a/security/manager/ssl/src/moz.build b/security/manager/ssl/src/moz.build index 67bd2f889a7e..d315523479d3 100644 --- a/security/manager/ssl/src/moz.build +++ b/security/manager/ssl/src/moz.build @@ -49,7 +49,6 @@ SOURCES += [ 'nsProtectedAuthThread.cpp', 'nsPSMBackgroundThread.cpp', 'nsRandomGenerator.cpp', - 'nsRecentBadCerts.cpp', 'nsSDR.cpp', 'NSSErrorsService.cpp', 'nsSSLSocketProvider.cpp', diff --git a/security/manager/ssl/src/nsNSSCertificateDB.cpp b/security/manager/ssl/src/nsNSSCertificateDB.cpp index a4f048976cf2..257c61491ab2 100644 --- a/security/manager/ssl/src/nsNSSCertificateDB.cpp +++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp @@ -37,7 +37,6 @@ #include "nsIPrompt.h" #include "nsThreadUtils.h" #include "nsIObserverService.h" -#include "nsRecentBadCerts.h" #include "SharedSSLState.h" #include "nspr.h" @@ -84,12 +83,6 @@ attemptToLogInWithDefaultPassword() NS_IMPL_ISUPPORTS(nsNSSCertificateDB, nsIX509CertDB, nsIX509CertDB2) -nsNSSCertificateDB::nsNSSCertificateDB() -: mBadCertsLock("nsNSSCertificateDB::mBadCertsLock") -{ - SharedSSLState::NoteCertDBServiceInstantiated(); -} - nsNSSCertificateDB::~nsNSSCertificateDB() { nsNSSShutDownPreventionLock locker; @@ -1712,29 +1705,6 @@ nsNSSCertificateDB::GetCerts(nsIX509CertList **_retval) return NS_OK; } -NS_IMETHODIMP -nsNSSCertificateDB::GetRecentBadCerts(bool isPrivate, nsIRecentBadCerts** result) -{ - nsNSSShutDownPreventionLock locker; - if (isAlreadyShutDown()) { - return NS_ERROR_NOT_AVAILABLE; - } - - MutexAutoLock lock(mBadCertsLock); - if (isPrivate) { - if (!mPrivateRecentBadCerts) { - mPrivateRecentBadCerts = new nsRecentBadCerts; - } - NS_ADDREF(*result = mPrivateRecentBadCerts); - } else { - if (!mPublicRecentBadCerts) { - mPublicRecentBadCerts = new nsRecentBadCerts; - } - NS_ADDREF(*result = mPublicRecentBadCerts); - } - return NS_OK; -} - NS_IMETHODIMP nsNSSCertificateDB::VerifyCertNow(nsIX509Cert* aCert, int64_t /*SECCertificateUsage*/ aUsage, diff --git a/security/manager/ssl/src/nsNSSCertificateDB.h b/security/manager/ssl/src/nsNSSCertificateDB.h index 1fe5c745c6e9..8f15f32d9365 100644 --- a/security/manager/ssl/src/nsNSSCertificateDB.h +++ b/security/manager/ssl/src/nsNSSCertificateDB.h @@ -14,7 +14,6 @@ class nsCString; class nsIArray; -class nsRecentBadCerts; class nsNSSCertificateDB : public nsIX509CertDB , public nsIX509CertDB2 @@ -26,8 +25,6 @@ public: NS_DECL_NSIX509CERTDB NS_DECL_NSIX509CERTDB2 - nsNSSCertificateDB(); - // Use this function to generate a default nickname for a user // certificate that is to be imported onto a token. static void @@ -65,10 +62,6 @@ private: nsIInterfaceRequestor *ctx, const nsNSSShutDownPreventionLock &proofOfLock); - mozilla::Mutex mBadCertsLock; - mozilla::RefPtr mPublicRecentBadCerts; - mozilla::RefPtr mPrivateRecentBadCerts; - // We don't own any NSS objects here, so no need to clean up virtual void virtualDestroyNSSReference() { }; }; diff --git a/security/manager/ssl/src/nsRecentBadCerts.cpp b/security/manager/ssl/src/nsRecentBadCerts.cpp deleted file mode 100644 index 4420fceacdb5..000000000000 --- a/security/manager/ssl/src/nsRecentBadCerts.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#include "nsRecentBadCerts.h" - -#include "pkix/pkixtypes.h" -#include "nsIX509Cert.h" -#include "nsIObserverService.h" -#include "mozilla/RefPtr.h" -#include "mozilla/Services.h" -#include "nsSSLStatus.h" -#include "nsCOMPtr.h" -#include "nsNSSCertificate.h" -#include "nsCRT.h" -#include "nsPromiseFlatString.h" -#include "nsStringBuffer.h" -#include "nspr.h" -#include "pk11pub.h" -#include "certdb.h" -#include "sechash.h" - -using namespace mozilla; - -NS_IMPL_ISUPPORTS(nsRecentBadCerts, nsIRecentBadCerts) - -nsRecentBadCerts::nsRecentBadCerts() -:monitor("nsRecentBadCerts.monitor") -,mNextStorePosition(0) -{ -} - -nsRecentBadCerts::~nsRecentBadCerts() -{ -} - -NS_IMETHODIMP -nsRecentBadCerts::GetRecentBadCert(const nsAString & aHostNameWithPort, - nsISSLStatus **aStatus) -{ - NS_ENSURE_ARG_POINTER(aStatus); - if (!aHostNameWithPort.Length()) - return NS_ERROR_INVALID_ARG; - - *aStatus = nullptr; - RefPtr status(new nsSSLStatus()); - - SECItem foundDER; - foundDER.len = 0; - foundDER.data = nullptr; - - bool isDomainMismatch = false; - bool isNotValidAtThisTime = false; - bool isUntrusted = false; - - { - ReentrantMonitorAutoEnter lock(monitor); - for (size_t i=0; imServerCert = nsNSSCertificate::Create(nssCert.get()); - status->mHaveCertErrorBits = true; - status->mIsDomainMismatch = isDomainMismatch; - status->mIsNotValidAtThisTime = isNotValidAtThisTime; - status->mIsUntrusted = isUntrusted; - - *aStatus = status; - NS_IF_ADDREF(*aStatus); - } - - return NS_OK; -} - -NS_IMETHODIMP -nsRecentBadCerts::AddBadCert(const nsAString &hostWithPort, - nsISSLStatus *aStatus) -{ - NS_ENSURE_ARG(aStatus); - - nsCOMPtr cert; - nsresult rv; - rv = aStatus->GetServerCert(getter_AddRefs(cert)); - NS_ENSURE_SUCCESS(rv, rv); - - bool isDomainMismatch; - bool isNotValidAtThisTime; - bool isUntrusted; - - rv = aStatus->GetIsDomainMismatch(&isDomainMismatch); - NS_ENSURE_SUCCESS(rv, rv); - - rv = aStatus->GetIsNotValidAtThisTime(&isNotValidAtThisTime); - NS_ENSURE_SUCCESS(rv, rv); - - rv = aStatus->GetIsUntrusted(&isUntrusted); - NS_ENSURE_SUCCESS(rv, rv); - - SECItem tempItem; - rv = cert->GetRawDER(&tempItem.len, (uint8_t **)&tempItem.data); - NS_ENSURE_SUCCESS(rv, rv); - - { - ReentrantMonitorAutoEnter lock(monitor); - RecentBadCert &updatedEntry = mCerts[mNextStorePosition]; - - ++mNextStorePosition; - if (mNextStorePosition == const_recently_seen_list_size) - mNextStorePosition = 0; - - updatedEntry.Clear(); - updatedEntry.mHostWithPort = hostWithPort; - updatedEntry.mDERCert = tempItem; // consume - updatedEntry.isDomainMismatch = isDomainMismatch; - updatedEntry.isNotValidAtThisTime = isNotValidAtThisTime; - updatedEntry.isUntrusted = isUntrusted; - } - - return NS_OK; -} - -NS_IMETHODIMP -nsRecentBadCerts::ResetStoredCerts() -{ - for (size_t i = 0; i < const_recently_seen_list_size; ++i) { - RecentBadCert &entry = mCerts[i]; - entry.Clear(); - } - return NS_OK; -} diff --git a/security/manager/ssl/src/nsRecentBadCerts.h b/security/manager/ssl/src/nsRecentBadCerts.h deleted file mode 100644 index d96427dd1b03..000000000000 --- a/security/manager/ssl/src/nsRecentBadCerts.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ - -#ifndef __RECENTBADCERTS_H__ -#define __RECENTBADCERTS_H__ - -#include "mozilla/Attributes.h" -#include "mozilla/ReentrantMonitor.h" - -#include "nsIRecentBadCertsService.h" -#include "nsTHashtable.h" -#include "nsString.h" -#include "cert.h" -#include "secitem.h" - -class RecentBadCert -{ -public: - - RecentBadCert() - { - mDERCert.len = 0; - mDERCert.data = nullptr; - isDomainMismatch = false; - isNotValidAtThisTime = false; - isUntrusted = false; - } - - ~RecentBadCert() - { - Clear(); - } - - void Clear() - { - mHostWithPort.Truncate(); - if (mDERCert.len) - nsMemory::Free(mDERCert.data); - mDERCert.len = 0; - mDERCert.data = nullptr; - } - - nsString mHostWithPort; - SECItem mDERCert; - bool isDomainMismatch; - bool isNotValidAtThisTime; - bool isUntrusted; - -private: - RecentBadCert(const RecentBadCert &other) MOZ_DELETE; - RecentBadCert &operator=(const RecentBadCert &other) MOZ_DELETE; -}; - -class nsRecentBadCerts MOZ_FINAL : public nsIRecentBadCerts -{ -public: - NS_DECL_THREADSAFE_ISUPPORTS - NS_DECL_NSIRECENTBADCERTS - - nsRecentBadCerts(); - -protected: - ~nsRecentBadCerts(); - - mozilla::ReentrantMonitor monitor; - - enum {const_recently_seen_list_size = 5}; - RecentBadCert mCerts[const_recently_seen_list_size]; - - // will be in the range of 0 to list_size-1 - uint32_t mNextStorePosition; -}; - -#define NS_RECENTBADCERTS_CID { /* e7caf8c0-3570-47fe-aa1b-da47539b5d07 */ \ - 0xe7caf8c0, \ - 0x3570, \ - 0x47fe, \ - {0xaa, 0x1b, 0xda, 0x47, 0x53, 0x9b, 0x5d, 0x07} \ - } - -#endif From a28f62b5cea3a66ab5a9250e0ffb4788b99ed59f Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 3 Jul 2014 09:02:48 +0900 Subject: [PATCH 62/94] Bug 1032014 - Remove extra call to AppendElement when generating animations; r=dbaron --- layout/style/nsAnimationManager.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index ad2cea06f51c..feeb3335cfee 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -562,8 +562,6 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, dest->mProperties.RemoveElementAt(dest->mProperties.Length() - 1); } } - - aAnimations.AppendElement(dest); } } From a2d236894b64938288533777014fa1bfe0a24cda Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 3 Jul 2014 09:04:16 +0900 Subject: [PATCH 63/94] Bug 1031319 part 1 - Don't generate element animations when animation-name is "none"; r=dbaron This patch causes animations whose corresponding animation-name is "none" to be dropped from the list of generated ElementAnimation objects. This means we avoid generating events for these animations. --- layout/style/AnimationCommon.h | 2 +- layout/style/nsAnimationManager.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/layout/style/AnimationCommon.h b/layout/style/AnimationCommon.h index d3072bb5e303..5f4ba99a4900 100644 --- a/layout/style/AnimationCommon.h +++ b/layout/style/AnimationCommon.h @@ -375,7 +375,7 @@ public: // Return the duration of the active interval for the given timing parameters. static mozilla::TimeDuration ActiveDuration(const AnimationTiming& aTiming); - nsString mName; // empty string for 'none' + nsString mName; AnimationTiming mTiming; // The beginning of the delay period. This is also set to a null // timestamp to mark transitions that have finished and are due to diff --git a/layout/style/nsAnimationManager.cpp b/layout/style/nsAnimationManager.cpp index feeb3335cfee..7626319ede2c 100644 --- a/layout/style/nsAnimationManager.cpp +++ b/layout/style/nsAnimationManager.cpp @@ -394,6 +394,15 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext, for (uint32_t animIdx = 0, animEnd = disp->mAnimationNameCount; animIdx != animEnd; ++animIdx) { const StyleAnimation& src = disp->mAnimations[animIdx]; + + // CSS Animations with an animation-name of "none" are represented + // by StyleAnimations with an empty name. Unlike animations with an empty + // keyframes rule, these "none" animations should not generate events + // at all so we drop them here. + if (src.GetName().IsEmpty()) { + continue; + } + nsRefPtr dest = *aAnimations.AppendElement(new ElementAnimation()); From a71e7fd445576b9fc29e061b40beabfcee223717 Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 3 Jul 2014 09:04:31 +0900 Subject: [PATCH 64/94] Bug 1031319 part 2 - Add tests for animation-name:none handling; r=dbaron --- layout/style/test/test_animations.html | 81 ++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) diff --git a/layout/style/test/test_animations.html b/layout/style/test/test_animations.html index 85c601acbe7b..dfe8dc66e3ce 100644 --- a/layout/style/test/test_animations.html +++ b/layout/style/test/test_animations.html @@ -1853,7 +1853,88 @@ check_events([{ type: 'animationstart', target: div, pseudoElement: "" }], "events at start of animation updated to use " + "empty keyframes rule"); +done_div(); +/* + * Bug 1031319 - 'none' animations + * + * The code under test here is run entirely on the main thread so there is no + * OMTA version of these tests in test_animations_omta.html. + */ + +// Setting "animation: none" after animations have finished should not trigger +// animation events +new_div("animation: always_fifty 1s"); +listen(); +advance_clock(0); +advance_clock(1000); +check_events([{ type: 'animationstart', target: div, + animationName: 'always_fifty', elapsedTime: 0, + pseudoElement: '' }, + { type: 'animationend', target: div, + animationName: 'always_fifty', elapsedTime: 1, + pseudoElement: '' }], + "events after running initial animation"); +div.style.animation = "none"; +div.clientTop; // Trigger events +check_events([], "events after setting animation to 'none'"); +done_div(); + +// Setting "animation: " after animations have finished should not trigger +// animation events +new_div("animation: always_fifty 1s"); +listen(); +advance_clock(0); +advance_clock(1000); +check_events([{ type: 'animationstart', target: div, + animationName: 'always_fifty', elapsedTime: 0, + pseudoElement: '' }, + { type: 'animationend', target: div, + animationName: 'always_fifty', elapsedTime: 1, + pseudoElement: '' }], + "events after running initial animation"); +div.style.animation = ""; +div.clientTop; // Trigger events +check_events([], "events after setting animation to ''"); +done_div(); + +// Setting "animation: none 1s" should not trigger events +new_div("animation: none 1s"); +listen(); +advance_clock(0); +advance_clock(1000); +check_events([], "events after setting animation to 'none 1s'"); +done_div(); + +// Setting "animation: 1s" should not trigger events +new_div("animation: 1s"); +listen(); +advance_clock(0); +advance_clock(1000); +check_events([], "events after setting animation to '1s'"); +done_div(); + +// Setting animation-name: none among other animations should cause only that +// animation to be skipped +new_div("animation-name: always_fifty, none, always_fifty;" + + " animation-duration: 1s"); +listen(); +advance_clock(0); +advance_clock(500); +advance_clock(500); +check_events([{ type: 'animationstart', target: div, + animationName: 'always_fifty', elapsedTime: 0, + pseudoElement: '' }, + { type: 'animationstart', target: div, + animationName: 'always_fifty', elapsedTime: 0, + pseudoElement: '' }, + { type: 'animationend', target: div, + animationName: 'always_fifty', elapsedTime: 1, + pseudoElement: '' }, + { type: 'animationend', target: div, + animationName: 'always_fifty', elapsedTime: 1, + pseudoElement: '' }], + "events for animation-name: a, none, a"); done_div(); SpecialPowers.DOMWindowUtils.restoreNormalRefresh(); From ea77abec714fccbdc37c7f778a1d3032bb60833f Mon Sep 17 00:00:00 2001 From: Brian Birtles Date: Thu, 3 Jul 2014 09:04:35 +0900 Subject: [PATCH 65/94] Bug 1010067 - Whitespace fix to nsTransitionManager::FlushTransitions. No review. This change was suggested in bug 1010067 comment 22 but somehow ended up in the wrong patch when pushing. --- layout/style/nsTransitionManager.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/layout/style/nsTransitionManager.cpp b/layout/style/nsTransitionManager.cpp index ef65a9e11ba9..f59e3ad35aac 100644 --- a/layout/style/nsTransitionManager.cpp +++ b/layout/style/nsTransitionManager.cpp @@ -858,12 +858,13 @@ nsTransitionManager::FlushTransitions(FlushFlags aFlags) // We need to restyle even if the transition rule no longer // applies (in which case we just made it not apply). - MOZ_ASSERT( - collection->mElementProperty == nsGkAtoms::transitionsProperty || - collection->mElementProperty == - nsGkAtoms::transitionsOfBeforeProperty || - collection->mElementProperty == nsGkAtoms::transitionsOfAfterProperty, - "Unexpected element property; might restyle too much"); + MOZ_ASSERT(collection->mElementProperty == + nsGkAtoms::transitionsProperty || + collection->mElementProperty == + nsGkAtoms::transitionsOfBeforeProperty || + collection->mElementProperty == + nsGkAtoms::transitionsOfAfterProperty, + "Unexpected element property; might restyle too much"); if (!canThrottleTick || transitionStartedOrEnded) { collection->PostRestyleForAnimation(mPresContext); } else { From e62864656cbf5ac8a396a5a0576ec9faeb690d6a Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Wed, 2 Jul 2014 17:29:33 -0700 Subject: [PATCH 66/94] Backed out 2 changesets (bug 1028187) for mochitest-oth orange Backed out changeset 01cba8ff52dd (bug 1028187) Backed out changeset caf43baf3306 (bug 1028187) --- browser/components/about/AboutRedirector.cpp | 37 ++------------ docshell/base/nsAboutRedirector.cpp | 8 --- dom/base/nsGlobalWindow.cpp | 52 +++----------------- netwerk/protocol/about/nsAboutBlank.cpp | 8 --- netwerk/protocol/about/nsAboutBloat.cpp | 8 --- netwerk/protocol/about/nsAboutCache.cpp | 8 --- netwerk/protocol/about/nsAboutCacheEntry.cpp | 8 --- netwerk/protocol/about/nsIAboutModule.idl | 14 +----- 8 files changed, 10 insertions(+), 133 deletions(-) diff --git a/browser/components/about/AboutRedirector.cpp b/browser/components/about/AboutRedirector.cpp index 5ccb7018b2e0..f1f65e8a25ad 100644 --- a/browser/components/about/AboutRedirector.cpp +++ b/browser/components/about/AboutRedirector.cpp @@ -9,7 +9,6 @@ #include "nsNetUtil.h" #include "nsIScriptSecurityManager.h" #include "mozilla/ArrayUtils.h" -#include "nsDOMString.h" namespace mozilla { namespace browser { @@ -20,7 +19,6 @@ struct RedirEntry { const char* id; const char* url; uint32_t flags; - const char* idbOriginPostfix; }; /* @@ -80,9 +78,7 @@ static RedirEntry kRedirMap[] = { #endif { "home", "chrome://browser/content/abouthome/aboutHome.xhtml", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | - nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::ENABLE_INDEXED_DB, - "home" }, + nsIAboutModule::ALLOW_SCRIPT }, { "newtab", "chrome://browser/content/newtab/newTab.xul", nsIAboutModule::ALLOW_SCRIPT }, { "permissions", "chrome://browser/content/preferences/aboutPermissions.xul", @@ -105,15 +101,11 @@ static RedirEntry kRedirMap[] = { { "loopconversation", "chrome://browser/content/loop/conversation.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT | - nsIAboutModule::ENABLE_INDEXED_DB }, + nsIAboutModule::HIDE_FROM_ABOUTABOUT }, { "looppanel", "chrome://browser/content/loop/panel.html", nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT | nsIAboutModule::ALLOW_SCRIPT | - nsIAboutModule::HIDE_FROM_ABOUTABOUT | - nsIAboutModule::ENABLE_INDEXED_DB, - // Shares an IndexedDB origin with about:loopconversation. - "loopconversation" }, + nsIAboutModule::HIDE_FROM_ABOUTABOUT }, #endif }; static const int kRedirTotal = ArrayLength(kRedirMap); @@ -182,29 +174,6 @@ AboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_ERROR_ILLEGAL_VALUE; } -NS_IMETHODIMP -AboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) -{ - NS_ENSURE_ARG_POINTER(aURI); - - nsAutoCString name = GetAboutModuleName(aURI); - - for (int i = 0; i < kRedirTotal; i++) { - if (name.Equals(kRedirMap[i].id)) { - const char* postfix = kRedirMap[i].idbOriginPostfix; - if (!postfix) { - break; - } - - result.AssignASCII(postfix); - return NS_OK; - } - } - - SetDOMStringToNull(result); - return NS_ERROR_ILLEGAL_VALUE; -} - nsresult AboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **result) { diff --git a/docshell/base/nsAboutRedirector.cpp b/docshell/base/nsAboutRedirector.cpp index bc62441bf5b7..ff233ee1c11b 100644 --- a/docshell/base/nsAboutRedirector.cpp +++ b/docshell/base/nsAboutRedirector.cpp @@ -8,7 +8,6 @@ #include "nsNetUtil.h" #include "nsAboutProtocolUtils.h" #include "mozilla/ArrayUtils.h" -#include "nsDOMString.h" NS_IMPL_ISUPPORTS(nsAboutRedirector, nsIAboutModule) @@ -137,13 +136,6 @@ nsAboutRedirector::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_ERROR_ILLEGAL_VALUE; } -NS_IMETHODIMP -nsAboutRedirector::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) -{ - SetDOMStringToNull(result); - return NS_ERROR_NOT_IMPLEMENTED; -} - nsresult nsAboutRedirector::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index d1600de2dcfa..868dce3b88b5 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -68,7 +68,6 @@ #include "mozilla/MouseEvents.h" #include "AudioChannelService.h" #include "MessageEvent.h" -#include "nsAboutProtocolUtils.h" // Interfaces Needed #include "nsIFrame.h" @@ -10512,39 +10511,6 @@ nsGlobalWindow::GetLocalStorage(nsIDOMStorage ** aLocalStorage) return rv.ErrorCode(); } -static nsAutoCString -GetIndexedDBOriginPostfixForAboutURI(nsIURI *aURI) -{ - nsAutoCString result; - - nsCOMPtr module; - nsresult rv = NS_GetAboutModule(aURI, getter_AddRefs(module)); - NS_ENSURE_SUCCESS(rv, result); - - uint32_t flags; - rv = module->GetURIFlags(aURI, &flags); - if (NS_FAILED(rv) || !(flags & nsIAboutModule::ENABLE_INDEXED_DB)) { - return result; - } - - nsAutoString postfix; - rv = module->GetIndexedDBOriginPostfix(aURI, postfix); - if (NS_FAILED(rv) || DOMStringIsNull(postfix)) { - return result; - } - - nsCOMPtr origin = NS_GetInnermostURI(aURI); - NS_ENSURE_TRUE(origin, result); - - nsAutoCString scheme; - rv = origin->GetScheme(scheme); - NS_ENSURE_SUCCESS(rv, result); - - result = scheme + NS_LITERAL_CSTRING(":") + NS_ConvertUTF16toUTF8(postfix); - ToLowerCase(result); - return result; -} - indexedDB::IDBFactory* nsGlobalWindow::GetIndexedDB(ErrorResult& aError) { @@ -10556,8 +10522,6 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError) return nullptr; } - nsCString origin; - if (!IsChromeWindow()) { // Whitelist about:home, since it doesn't have a base domain it would not // pass the thirdPartyUtil check, though it should be able to use @@ -10567,15 +10531,11 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError) if (principal) { nsCOMPtr uri; principal->GetURI(getter_AddRefs(uri)); - - if (uri) { - bool isAbout = false; - nsresult rv = uri->SchemeIs("about", &isAbout); - - if (NS_SUCCEEDED(rv) && isAbout) { - origin = GetIndexedDBOriginPostfixForAboutURI(uri); - skipThirdPartyCheck = !origin.IsEmpty(); - } + bool isAbout = false; + if (uri && NS_SUCCEEDED(uri->SchemeIs("about", &isAbout)) && isAbout) { + nsAutoCString path; + skipThirdPartyCheck = NS_SUCCEEDED(uri->GetPath(path)) && + path.EqualsLiteral("home"); } } @@ -10599,7 +10559,7 @@ nsGlobalWindow::GetIndexedDB(ErrorResult& aError) } // This may be null if being created from a file. - aError = indexedDB::IDBFactory::Create(this, origin, origin, nullptr, + aError = indexedDB::IDBFactory::Create(this, nullptr, getter_AddRefs(mIndexedDB)); } diff --git a/netwerk/protocol/about/nsAboutBlank.cpp b/netwerk/protocol/about/nsAboutBlank.cpp index 95cb51862d81..85d1fb92b736 100644 --- a/netwerk/protocol/about/nsAboutBlank.cpp +++ b/netwerk/protocol/about/nsAboutBlank.cpp @@ -5,7 +5,6 @@ #include "nsAboutBlank.h" #include "nsStringStream.h" -#include "nsDOMString.h" #include "nsNetUtil.h" NS_IMPL_ISUPPORTS(nsAboutBlank, nsIAboutModule) @@ -37,13 +36,6 @@ nsAboutBlank::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } -NS_IMETHODIMP -nsAboutBlank::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) -{ - SetDOMStringToNull(result); - return NS_ERROR_NOT_IMPLEMENTED; -} - nsresult nsAboutBlank::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/netwerk/protocol/about/nsAboutBloat.cpp b/netwerk/protocol/about/nsAboutBloat.cpp index ba1a95d53b1b..b997853ac404 100644 --- a/netwerk/protocol/about/nsAboutBloat.cpp +++ b/netwerk/protocol/about/nsAboutBloat.cpp @@ -10,7 +10,6 @@ #include "nsAboutBloat.h" #include "nsStringStream.h" -#include "nsDOMString.h" #include "nsIURI.h" #include "nsCOMPtr.h" #include "nsNetUtil.h" @@ -125,13 +124,6 @@ nsAboutBloat::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } -NS_IMETHODIMP -nsAboutBloat::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) -{ - SetDOMStringToNull(result); - return NS_ERROR_NOT_IMPLEMENTED; -} - nsresult nsAboutBloat::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) { diff --git a/netwerk/protocol/about/nsAboutCache.cpp b/netwerk/protocol/about/nsAboutCache.cpp index 7f1ca35f0b2f..2e5df23acb6c 100644 --- a/netwerk/protocol/about/nsAboutCache.cpp +++ b/netwerk/protocol/about/nsAboutCache.cpp @@ -12,7 +12,6 @@ #include "nsEscape.h" #include "nsAboutProtocolUtils.h" #include "nsPrintfCString.h" -#include "nsDOMString.h" #include "nsICacheStorageService.h" #include "nsICacheStorage.h" @@ -486,13 +485,6 @@ nsAboutCache::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } -NS_IMETHODIMP -nsAboutCache::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) -{ - SetDOMStringToNull(result); - return NS_ERROR_NOT_IMPLEMENTED; -} - // static nsresult nsAboutCache::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult) diff --git a/netwerk/protocol/about/nsAboutCacheEntry.cpp b/netwerk/protocol/about/nsAboutCacheEntry.cpp index 74ae0f291579..c8c88c89fd86 100644 --- a/netwerk/protocol/about/nsAboutCacheEntry.cpp +++ b/netwerk/protocol/about/nsAboutCacheEntry.cpp @@ -7,7 +7,6 @@ #include "nsAboutCache.h" #include "nsICacheStorage.h" #include "CacheObserver.h" -#include "nsDOMString.h" #include "nsNetUtil.h" #include "prprf.h" #include "nsEscape.h" @@ -109,13 +108,6 @@ nsAboutCacheEntry::GetURIFlags(nsIURI *aURI, uint32_t *result) return NS_OK; } -NS_IMETHODIMP -nsAboutCacheEntry::GetIndexedDBOriginPostfix(nsIURI *aURI, nsAString &result) -{ - SetDOMStringToNull(result); - return NS_ERROR_NOT_IMPLEMENTED; -} - //----------------------------------------------------------------------------- // nsAboutCacheEntry diff --git a/netwerk/protocol/about/nsIAboutModule.idl b/netwerk/protocol/about/nsIAboutModule.idl index 744dfbed567a..7213ed32ffac 100644 --- a/netwerk/protocol/about/nsIAboutModule.idl +++ b/netwerk/protocol/about/nsIAboutModule.idl @@ -8,7 +8,7 @@ interface nsIURI; interface nsIChannel; -[scriptable, uuid(1d5992c3-28b0-4ec1-9dbb-f5fde7f72199)] +[scriptable, uuid(9575693c-60d9-4332-b6b8-6c29289339cb)] interface nsIAboutModule : nsISupports { /** @@ -41,24 +41,12 @@ interface nsIAboutModule : nsISupports */ const unsigned long HIDE_FROM_ABOUTABOUT = (1 << 2); - /** - * A flag that indicates whether this about: URI wants Indexed DB enabled. - */ - const unsigned long ENABLE_INDEXED_DB = (1 << 3); - /** * A method to get the flags that apply to a given about: URI. The URI * passed in is guaranteed to be one of the URIs that this module * registered to deal with. */ unsigned long getURIFlags(in nsIURI aURI); - - /** - * Returns the Indexed DB origin's postfix used for the given about: URI. - * If the postfix returned is null then the URI's path (e.g. "home" for - * about:home) will be used to construct the origin. - */ - DOMString getIndexedDBOriginPostfix(in nsIURI aURI); }; %{C++ From dc7f9d39e103447f6aaaa0efc8dc4eb888648398 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Thu, 3 Jul 2014 09:38:47 +0900 Subject: [PATCH 67/94] Bug 762358 - Fixup the fixup not to break on windows. r=me --- python/mozbuild/mozbuild/test/test_base.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/mozbuild/mozbuild/test/test_base.py b/python/mozbuild/mozbuild/test/test_base.py index 46bb6021fa19..3735213bdb49 100644 --- a/python/mozbuild/mozbuild/test/test_base.py +++ b/python/mozbuild/mozbuild/test/test_base.py @@ -77,9 +77,10 @@ class TestMozbuildObject(unittest.TestCase): def test_objdir_config_status(self): """Ensure @CONFIG_GUESS@ is handled when loading mozconfig.""" base = self.get_base() - guess = subprocess.check_output( + cmd = base._normalize_command( [os.path.join(topsrcdir, 'build', 'autoconf', 'config.guess')], - cwd=topsrcdir).strip() + True) + guess = subprocess.check_output(cmd, cwd=topsrcdir).strip() # There may be symlinks involved, so we use real paths to ensure # path consistency. From 208810135e8b44b8428fb84ffbd38bae339b0554 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Wed, 2 Jul 2014 18:43:40 -0600 Subject: [PATCH 68/94] Bug 981898 - Enable content/media/test mochitests on Android 2.3; no review --- testing/mochitest/android23.json | 1 - 1 file changed, 1 deletion(-) diff --git a/testing/mochitest/android23.json b/testing/mochitest/android23.json index e265616ce32d..5a886f3a5c96 100644 --- a/testing/mochitest/android23.json +++ b/testing/mochitest/android23.json @@ -5,7 +5,6 @@ "content/canvas/test/webgl-conformance": "bug 865443 - separate suite -- mochitest-gl", "content/canvas/test/webgl-mochitest/test_no_arr_points.html": "Android 2.3 aws only; bug 1030942", "content/html/content/test/test_bug659743.xml": "Android 2.3 aws only; bug 1031103", - "content/media/test": "Android 2.3 only; bug 981898", "content/media/webaudio/test": "Android 2.3 only; bug 981889", "docshell/test/navigation/test_reserved.html": "too slow on Android 2.3 aws only; bug 1030403", "dom/media/tests/mochitest": "Android 2.3 only; bug 981881", From eabebaa57cbd2c1da8356e23aa93816f4990970c Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Wed, 2 Jul 2014 18:43:41 -0600 Subject: [PATCH 69/94] Bug 981889 - Enable content/media/webaudio/test mochitests on Android 2.3; no review --- content/media/webaudio/test/mochitest.ini | 2 +- testing/mochitest/android23.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/content/media/webaudio/test/mochitest.ini b/content/media/webaudio/test/mochitest.ini index 37d304422a10..989332667326 100644 --- a/content/media/webaudio/test/mochitest.ini +++ b/content/media/webaudio/test/mochitest.ini @@ -35,7 +35,7 @@ support-files = [test_audioBufferSourceNodeNoStart.html] [test_audioBufferSourceNodeNullBuffer.html] [test_audioBufferSourceNodeOffset.html] -skip-if = (toolkit == 'gonk' && !debug) #bug 906752 +skip-if = (toolkit == 'gonk' && !debug) || (toolkit == 'android') #bug 906752 [test_AudioContext.html] [test_audioDestinationNode.html] [test_AudioListener.html] diff --git a/testing/mochitest/android23.json b/testing/mochitest/android23.json index 5a886f3a5c96..72973f050dd4 100644 --- a/testing/mochitest/android23.json +++ b/testing/mochitest/android23.json @@ -5,7 +5,6 @@ "content/canvas/test/webgl-conformance": "bug 865443 - separate suite -- mochitest-gl", "content/canvas/test/webgl-mochitest/test_no_arr_points.html": "Android 2.3 aws only; bug 1030942", "content/html/content/test/test_bug659743.xml": "Android 2.3 aws only; bug 1031103", - "content/media/webaudio/test": "Android 2.3 only; bug 981889", "docshell/test/navigation/test_reserved.html": "too slow on Android 2.3 aws only; bug 1030403", "dom/media/tests/mochitest": "Android 2.3 only; bug 981881", "layout/style/test/test_media_queries.html": "Android 2.3 aws only; bug 1030419", From 4c1235d4645fbd29627ed98604ffab1489ad1bd3 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Wed, 2 Jul 2014 17:48:18 -0700 Subject: [PATCH 70/94] Bug 1033124 - Use correct and more precise coeffs for YCbCr->RGB conversion. - r=mattwoodrow,r=bas --- gfx/layers/d3d10/LayerManagerD3D10.fx | 27 +- gfx/layers/d3d10/LayerManagerD3D10Effect.h | 1492 +++++++++--------- gfx/layers/d3d11/CompositorD3D11.fx | 22 +- gfx/layers/d3d11/CompositorD3D11Shaders.h | 628 ++++---- gfx/layers/d3d11/genshaders.sh | 1 + gfx/layers/d3d9/LayerManagerD3D9Shaders.h | 942 ++++++----- gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl | 52 +- gfx/layers/opengl/OGLShaderProgram.cpp | 23 +- 8 files changed, 1556 insertions(+), 1631 deletions(-) diff --git a/gfx/layers/d3d10/LayerManagerD3D10.fx b/gfx/layers/d3d10/LayerManagerD3D10.fx index 0e7e57d2d114..e051a4c60384 100644 --- a/gfx/layers/d3d10/LayerManagerD3D10.fx +++ b/gfx/layers/d3d10/LayerManagerD3D10.fx @@ -136,7 +136,7 @@ float4 TransformedPostion(float2 aInPosition) { // the current vertex's position on the quad float4 position = float4(0, 0, 0, 1); - + // We use 4 component floats to uniquely describe a rectangle, by the structure // of x, y, width, height. This allows us to easily generate the 4 corners // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the @@ -159,7 +159,7 @@ float4 VertexPosition(float4 aTransformedPosition) result.xyz = aTransformedPosition.xyz / aTransformedPosition.w; result -= vRenderTargetOffset; result.xyz *= result.w; - + result = mul(mProjection, result); return result; @@ -244,18 +244,29 @@ float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex, uniform sampler aSampler) : S return result * mask; } +/* From Rec601: +[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16] +[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128] +[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128] + +For [0,1] instead of [0,255], and to 5 places: +[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275] +[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196] +[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196] +*/ + float4 CalculateYCbCrColor(const float2 aTexCoords) { float4 yuv; float4 color; - yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; - yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.0625; - yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.5; + yuv.r = tCr.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.50196; + yuv.g = tY.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.06275; + yuv.b = tCb.Sample(LayerTextureSamplerLinear, aTexCoords).a - 0.50196; - color.r = yuv.g * 1.164 + yuv.r * 1.596; - color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; - color.b = yuv.g * 1.164 + yuv.b * 2.018; + color.r = yuv.g * 1.16438 + yuv.r * 1.59603; + color.g = yuv.g * 1.16438 - 0.81297 * yuv.r - 0.39176 * yuv.b; + color.b = yuv.g * 1.16438 + yuv.b * 2.01723; color.a = 1.0f; return color; diff --git a/gfx/layers/d3d10/LayerManagerD3D10Effect.h b/gfx/layers/d3d10/LayerManagerD3D10Effect.h index eeaabb2d04b4..fa8de1cb7ad8 100644 --- a/gfx/layers/d3d10/LayerManagerD3D10Effect.h +++ b/gfx/layers/d3d10/LayerManagerD3D10Effect.h @@ -109,7 +109,7 @@ technique10 RenderRGBLayerPremul BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -153,17 +153,17 @@ technique10 RenderRGBLayerPremul // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -232,7 +232,7 @@ technique10 RenderRGBLayerPremul GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -261,17 +261,17 @@ technique10 RenderRGBLayerPremul // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -327,7 +327,7 @@ technique10 RenderRGBLayerPremulPoint BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -371,17 +371,17 @@ technique10 RenderRGBLayerPremulPoint // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -450,7 +450,7 @@ technique10 RenderRGBLayerPremulPoint GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -479,17 +479,17 @@ technique10 RenderRGBLayerPremulPoint // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -545,7 +545,7 @@ technique10 RenderRGBALayerPremul BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -589,17 +589,17 @@ technique10 RenderRGBALayerPremul // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -668,7 +668,7 @@ technique10 RenderRGBALayerPremul GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -697,17 +697,17 @@ technique10 RenderRGBALayerPremul // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -761,7 +761,7 @@ technique10 RenderRGBALayerNonPremul BlendState = NonPremul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -805,17 +805,17 @@ technique10 RenderRGBALayerNonPremul // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -884,7 +884,7 @@ technique10 RenderRGBALayerNonPremul GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -913,17 +913,17 @@ technique10 RenderRGBALayerNonPremul // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -977,7 +977,7 @@ technique10 RenderRGBALayerPremulPoint BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1021,17 +1021,17 @@ technique10 RenderRGBALayerPremulPoint // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -1100,7 +1100,7 @@ technique10 RenderRGBALayerPremulPoint GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1129,17 +1129,17 @@ technique10 RenderRGBALayerPremulPoint // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1193,7 +1193,7 @@ technique10 RenderRGBALayerNonPremulPoint BlendState = NonPremul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1237,17 +1237,17 @@ technique10 RenderRGBALayerNonPremulPoint // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -1316,7 +1316,7 @@ technique10 RenderRGBALayerNonPremulPoint GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1345,17 +1345,17 @@ technique10 RenderRGBALayerNonPremulPoint // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1409,7 +1409,7 @@ technique10 RenderYCbCrLayer BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1453,17 +1453,17 @@ technique10 RenderYCbCrLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -1532,7 +1532,7 @@ technique10 RenderYCbCrLayer GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1563,17 +1563,17 @@ technique10 RenderYCbCrLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1595,8 +1595,8 @@ technique10 RenderYCbCrLayer // Level9 shader bytecode: // ps_2_x - def c1, -0.5, -0.0625, 1.59599996, 0.813000023 - def c2, 1.16400003, 2.01799989, 0.391000003, 1 + def c1, -0.50195998, -0.0627499968, 1.59603, 0.812969983 + def c2, 1.16437995, 2.01723003, 0.391759992, 1 dcl t0.xy dcl_2d s0 dcl_2d s1 @@ -1628,17 +1628,17 @@ technique10 RenderYCbCrLayer dcl_output o0.xyzw dcl_temps 3 sample r0.xyzw, v1.xyxx, t2.xyzw, s0 - add r0.x, r0.w, l(-0.500000) - mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000) + add r0.x, r0.w, l(-0.501960) + mul r0.xy, r0.xxxx, l(1.596030, 0.812970, 0.000000, 0.000000) sample r1.xyzw, v1.xyxx, t0.xyzw, s0 - add r0.z, r1.w, l(-0.062500) - mad r0.y, r0.z, l(1.164000), -r0.y - mad r1.x, r0.z, l(1.164000), r0.x + add r0.z, r1.w, l(-0.062750) + mad r0.y, r0.z, l(1.164380), -r0.y + mad r1.x, r0.z, l(1.164380), r0.x sample r2.xyzw, v1.xyxx, t1.xyzw, s0 - add r0.x, r2.w, l(-0.500000) - mad r1.y, -r0.x, l(0.391000), r0.y - mul r0.x, r0.x, l(2.018000) - mad r1.z, r0.z, l(1.164000), r0.x + add r0.x, r2.w, l(-0.501960) + mad r1.y, -r0.x, l(0.391760), r0.y + mul r0.x, r0.x, l(2.017230) + mad r1.z, r0.z, l(1.164380), r0.x mov r1.w, l(1.000000) mul o0.xyzw, r1.xyzw, cb0[3].xxxx ret @@ -1659,7 +1659,7 @@ technique10 RenderComponentAlphaLayer BlendState = ComponentAlphaBlend; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1703,17 +1703,17 @@ technique10 RenderComponentAlphaLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -1782,7 +1782,7 @@ technique10 RenderComponentAlphaLayer GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1812,18 +1812,18 @@ technique10 RenderComponentAlphaLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw - // SV_Target 1 xyzw 1 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw + // SV_Target 1 xyzw 1 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1893,7 +1893,7 @@ technique10 RenderSolidColorLayer BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1937,17 +1937,17 @@ technique10 RenderSolidColorLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -2016,7 +2016,7 @@ technique10 RenderSolidColorLayer GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2040,17 +2040,17 @@ technique10 RenderSolidColorLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -2088,7 +2088,7 @@ technique10 RenderClearLayer BlendState = NoBlendDual; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2132,17 +2132,17 @@ technique10 RenderClearLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -2211,7 +2211,7 @@ technique10 RenderClearLayer GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2235,17 +2235,17 @@ technique10 RenderClearLayer // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -2283,7 +2283,7 @@ technique10 PrepareAlphaExtractionTextures BlendState = NoBlendDual; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2327,17 +2327,17 @@ technique10 PrepareAlphaExtractionTextures // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -2406,24 +2406,24 @@ technique10 PrepareAlphaExtractionTextures GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw - // SV_Target 1 xyzw 1 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw + // SV_Target 1 xyzw 1 TARGET float xyzw // // // Level9 shader bytecode: @@ -2458,7 +2458,7 @@ technique10 RenderRGBLayerPremulMask BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2502,18 +2502,18 @@ technique10 RenderRGBLayerPremulMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -2591,7 +2591,7 @@ technique10 RenderRGBLayerPremulMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2621,18 +2621,18 @@ technique10 RenderRGBLayerPremulMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -2697,7 +2697,7 @@ technique10 RenderRGBLayerPremulPointMask BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2741,18 +2741,18 @@ technique10 RenderRGBLayerPremulPointMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -2830,7 +2830,7 @@ technique10 RenderRGBLayerPremulPointMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2861,18 +2861,18 @@ technique10 RenderRGBLayerPremulPointMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -2938,7 +2938,7 @@ technique10 RenderRGBALayerPremulMask BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2982,18 +2982,18 @@ technique10 RenderRGBALayerPremulMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -3071,7 +3071,7 @@ technique10 RenderRGBALayerPremulMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3101,18 +3101,18 @@ technique10 RenderRGBALayerPremulMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3175,7 +3175,7 @@ technique10 RenderRGBALayerPremulMask3D BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3219,18 +3219,18 @@ technique10 RenderRGBALayerPremulMask3D // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 xyz 2 NONE float xyz + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 xyz 2 NONE float xyz // // // Constant buffer to DX9 shader constant mappings: @@ -3312,7 +3312,7 @@ technique10 RenderRGBALayerPremulMask3D GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3342,18 +3342,18 @@ technique10 RenderRGBALayerPremulMask3D // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 xyz 2 NONE float xyz + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 xyz 2 NONE float xyz // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3419,7 +3419,7 @@ technique10 RenderRGBALayerNonPremulMask BlendState = NonPremul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3463,18 +3463,18 @@ technique10 RenderRGBALayerNonPremulMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -3552,7 +3552,7 @@ technique10 RenderRGBALayerNonPremulMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3582,18 +3582,18 @@ technique10 RenderRGBALayerNonPremulMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3656,7 +3656,7 @@ technique10 RenderRGBALayerPremulPointMask BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3700,18 +3700,18 @@ technique10 RenderRGBALayerPremulPointMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -3789,7 +3789,7 @@ technique10 RenderRGBALayerPremulPointMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3820,18 +3820,18 @@ technique10 RenderRGBALayerPremulPointMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3895,7 +3895,7 @@ technique10 RenderRGBALayerNonPremulPointMask BlendState = NonPremul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3939,18 +3939,18 @@ technique10 RenderRGBALayerNonPremulPointMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -4028,7 +4028,7 @@ technique10 RenderRGBALayerNonPremulPointMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4059,18 +4059,18 @@ technique10 RenderRGBALayerNonPremulPointMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4134,7 +4134,7 @@ technique10 RenderYCbCrLayerMask BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4178,18 +4178,18 @@ technique10 RenderYCbCrLayerMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -4267,7 +4267,7 @@ technique10 RenderYCbCrLayerMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4299,18 +4299,18 @@ technique10 RenderYCbCrLayerMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4333,8 +4333,8 @@ technique10 RenderYCbCrLayerMask // Level9 shader bytecode: // ps_2_x - def c1, -0.5, -0.0625, 1.59599996, 0.813000023 - def c2, 1.16400003, 2.01799989, 0.391000003, 1 + def c1, -0.50195998, -0.0627499968, 1.59603, 0.812969983 + def c2, 1.16437995, 2.01723003, 0.391759992, 1 dcl t0 dcl_2d s0 dcl_2d s1 @@ -4372,17 +4372,17 @@ technique10 RenderYCbCrLayerMask dcl_output o0.xyzw dcl_temps 3 sample r0.xyzw, v1.xyxx, t2.xyzw, s0 - add r0.x, r0.w, l(-0.500000) - mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000) + add r0.x, r0.w, l(-0.501960) + mul r0.xy, r0.xxxx, l(1.596030, 0.812970, 0.000000, 0.000000) sample r1.xyzw, v1.xyxx, t0.xyzw, s0 - add r0.z, r1.w, l(-0.062500) - mad r0.y, r0.z, l(1.164000), -r0.y - mad r1.x, r0.z, l(1.164000), r0.x + add r0.z, r1.w, l(-0.062750) + mad r0.y, r0.z, l(1.164380), -r0.y + mad r1.x, r0.z, l(1.164380), r0.x sample r2.xyzw, v1.xyxx, t1.xyzw, s0 - add r0.x, r2.w, l(-0.500000) - mad r1.y, -r0.x, l(0.391000), r0.y - mul r0.x, r0.x, l(2.018000) - mad r1.z, r0.z, l(1.164000), r0.x + add r0.x, r2.w, l(-0.501960) + mad r1.y, -r0.x, l(0.391760), r0.y + mul r0.x, r0.x, l(2.017230) + mad r1.z, r0.z, l(1.164380), r0.x mov r1.w, l(1.000000) mul r0.xyzw, r1.xyzw, cb0[3].xxxx sample r1.xyzw, v1.zwzz, t3.xyzw, s0 @@ -4405,7 +4405,7 @@ technique10 RenderComponentAlphaLayerMask BlendState = ComponentAlphaBlend; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4449,18 +4449,18 @@ technique10 RenderComponentAlphaLayerMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -4538,7 +4538,7 @@ technique10 RenderComponentAlphaLayerMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4569,19 +4569,19 @@ technique10 RenderComponentAlphaLayerMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw - // SV_Target 1 xyzw 1 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw + // SV_Target 1 xyzw 1 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4660,7 +4660,7 @@ technique10 RenderSolidColorLayerMask BlendState = Premul; VertexShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4704,18 +4704,18 @@ technique10 RenderSolidColorLayerMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // POSITION 0 xy 0 NONE float xy + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // POSITION 0 xy 0 NONE float xy // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float xyzw - // TEXCOORD 0 xy 1 NONE float xy - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float xyzw + // TEXCOORD 0 xy 1 NONE float xy + // TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -4793,7 +4793,7 @@ technique10 RenderSolidColorLayerMask GeometryShader = NULL; PixelShader = asm { // - // Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 + // Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4819,18 +4819,18 @@ technique10 RenderSolidColorLayerMask // // Input signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Position 0 xyzw 0 POS float - // TEXCOORD 0 xy 1 NONE float - // TEXCOORD 1 zw 1 NONE float zw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Position 0 xyzw 0 POS float + // TEXCOORD 0 xy 1 NONE float + // TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // - // Name Index Mask Register SysValue Format Used - // -------------------- ----- ------ -------- -------- ------ ------ - // SV_Target 0 xyzw 0 TARGET float xyzw + // Name Index Mask Register SysValue Format Used + // -------------------- ----- ------ -------- -------- ------- ------ + // SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4879,10 +4879,10 @@ technique10 RenderSolidColorLayerMask const BYTE g_main[] = { - 68, 88, 66, 67, 238, 59, - 90, 147, 223, 50, 250, 186, - 190, 133, 137, 53, 139, 30, - 68, 141, 1, 0, 0, 0, + 68, 88, 66, 67, 173, 229, + 104, 135, 246, 30, 133, 190, + 80, 1, 18, 239, 172, 11, + 34, 194, 1, 0, 0, 0, 107, 43, 1, 0, 1, 0, 0, 0, 36, 0, 0, 0, 70, 88, 49, 48, 63, 43, @@ -5087,9 +5087,9 @@ const BYTE g_main[] = 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, 88, 66, 67, - 249, 28, 197, 252, 166, 119, - 59, 228, 111, 222, 205, 192, - 170, 128, 255, 70, 1, 0, + 134, 58, 181, 81, 234, 180, + 23, 54, 140, 98, 159, 162, + 74, 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, @@ -5256,7 +5256,7 @@ const BYTE g_main[] = 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 6, 0, 0, 0, + 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -5266,7 +5266,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -5381,9 +5381,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, @@ -5412,9 +5412,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 116, 4, 0, 0, 68, 88, - 66, 67, 60, 190, 218, 131, - 56, 248, 150, 40, 4, 89, - 139, 209, 145, 77, 221, 194, + 66, 67, 139, 125, 209, 68, + 164, 105, 119, 76, 10, 245, + 168, 227, 98, 190, 98, 86, 1, 0, 0, 0, 116, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 204, 0, @@ -5575,9 +5575,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, @@ -5616,10 +5616,10 @@ const BYTE g_main[] = 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, - 68, 88, 66, 67, 249, 28, - 197, 252, 166, 119, 59, 228, - 111, 222, 205, 192, 170, 128, - 255, 70, 1, 0, 0, 0, + 68, 88, 66, 67, 134, 58, + 181, 81, 234, 180, 23, 54, + 140, 98, 159, 162, 74, 150, + 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, 228, 3, @@ -5786,7 +5786,7 @@ const BYTE g_main[] = 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -5796,7 +5796,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -5911,9 +5911,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, @@ -5942,9 +5942,9 @@ const BYTE g_main[] = 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 116, 4, 0, 0, 68, 88, 66, 67, - 114, 153, 75, 42, 28, 72, - 202, 184, 148, 86, 142, 53, - 63, 89, 88, 179, 1, 0, + 168, 126, 222, 160, 23, 76, + 232, 98, 152, 133, 227, 163, + 37, 248, 175, 170, 1, 0, 0, 0, 116, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 204, 0, 0, 0, @@ -6105,9 +6105,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -6145,10 +6145,10 @@ const BYTE g_main[] = 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, - 68, 88, 66, 67, 249, 28, - 197, 252, 166, 119, 59, 228, - 111, 222, 205, 192, 170, 128, - 255, 70, 1, 0, 0, 0, + 68, 88, 66, 67, 134, 58, + 181, 81, 234, 180, 23, 54, + 140, 98, 159, 162, 74, 150, + 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, 228, 3, @@ -6315,7 +6315,7 @@ const BYTE g_main[] = 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, - 6, 0, 0, 0, 0, 0, + 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6325,7 +6325,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6440,9 +6440,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, @@ -6471,9 +6471,9 @@ const BYTE g_main[] = 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 80, 4, 0, 0, 68, 88, 66, 67, - 174, 145, 230, 170, 138, 104, - 76, 211, 23, 250, 143, 33, - 103, 45, 235, 101, 1, 0, + 197, 240, 201, 103, 219, 157, + 229, 76, 76, 196, 241, 175, + 193, 131, 135, 238, 1, 0, 0, 0, 80, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 192, 0, 0, 0, @@ -6628,9 +6628,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -6669,9 +6669,9 @@ const BYTE g_main[] = 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, 88, 66, - 67, 249, 28, 197, 252, 166, - 119, 59, 228, 111, 222, 205, - 192, 170, 128, 255, 70, 1, + 67, 134, 58, 181, 81, 234, + 180, 23, 54, 140, 98, 159, + 162, 74, 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, @@ -6838,7 +6838,7 @@ const BYTE g_main[] = 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 6, 0, 0, + 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6848,7 +6848,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -6963,10 +6963,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, @@ -6994,10 +6994,10 @@ const BYTE g_main[] = 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 80, 4, 0, 0, 68, - 88, 66, 67, 174, 145, 230, - 170, 138, 104, 76, 211, 23, - 250, 143, 33, 103, 45, 235, - 101, 1, 0, 0, 0, 80, + 88, 66, 67, 197, 240, 201, + 103, 219, 157, 229, 76, 76, + 196, 241, 175, 193, 131, 135, + 238, 1, 0, 0, 0, 80, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 192, 0, 0, 0, 100, 1, 0, @@ -7151,10 +7151,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, @@ -7193,9 +7193,9 @@ const BYTE g_main[] = 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, 88, 66, 67, - 249, 28, 197, 252, 166, 119, - 59, 228, 111, 222, 205, 192, - 170, 128, 255, 70, 1, 0, + 134, 58, 181, 81, 234, 180, + 23, 54, 140, 98, 159, 162, + 74, 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, @@ -7362,7 +7362,7 @@ const BYTE g_main[] = 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 6, 0, 0, 0, + 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -7372,7 +7372,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -7487,9 +7487,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, @@ -7518,9 +7518,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 80, 4, 0, 0, 68, 88, - 66, 67, 185, 211, 180, 91, - 76, 198, 234, 150, 34, 32, - 101, 196, 211, 153, 225, 227, + 66, 67, 151, 150, 8, 20, + 71, 31, 33, 136, 86, 87, + 200, 101, 153, 133, 218, 4, 1, 0, 0, 0, 80, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 192, 0, @@ -7675,9 +7675,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, @@ -7717,9 +7717,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, 88, - 66, 67, 249, 28, 197, 252, - 166, 119, 59, 228, 111, 222, - 205, 192, 170, 128, 255, 70, + 66, 67, 134, 58, 181, 81, + 234, 180, 23, 54, 140, 98, + 159, 162, 74, 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, @@ -7886,7 +7886,7 @@ const BYTE g_main[] = 65, 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 6, 0, + 3, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, @@ -7896,7 +7896,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -8011,10 +8011,10 @@ const BYTE g_main[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, @@ -8042,10 +8042,10 @@ const BYTE g_main[] = 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 80, 4, 0, 0, - 68, 88, 66, 67, 185, 211, - 180, 91, 76, 198, 234, 150, - 34, 32, 101, 196, 211, 153, - 225, 227, 1, 0, 0, 0, + 68, 88, 66, 67, 151, 150, + 8, 20, 71, 31, 33, 136, + 86, 87, 200, 101, 153, 133, + 218, 4, 1, 0, 0, 0, 80, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 192, 0, 0, 0, 100, 1, @@ -8199,10 +8199,10 @@ const BYTE g_main[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, @@ -8239,10 +8239,10 @@ const BYTE g_main[] = 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, - 88, 66, 67, 249, 28, 197, - 252, 166, 119, 59, 228, 111, - 222, 205, 192, 170, 128, 255, - 70, 1, 0, 0, 0, 136, + 88, 66, 67, 134, 58, 181, + 81, 234, 180, 23, 54, 140, + 98, 159, 162, 74, 150, 11, + 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, 228, 3, 0, @@ -8408,7 +8408,7 @@ const BYTE g_main[] = 84, 65, 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 6, + 0, 3, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -8418,7 +8418,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -8534,9 +8534,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, @@ -8564,10 +8564,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 96, 7, 0, - 0, 68, 88, 66, 67, 248, - 27, 107, 126, 143, 194, 255, - 95, 146, 68, 72, 180, 162, - 134, 32, 4, 1, 0, 0, + 0, 68, 88, 66, 67, 1, + 118, 228, 119, 234, 238, 25, + 215, 211, 69, 59, 5, 242, + 177, 6, 183, 1, 0, 0, 0, 96, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 220, 1, 0, 0, 44, @@ -8586,13 +8586,13 @@ const BYTE g_main[] = 0, 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, - 5, 1, 0, 15, 160, 0, - 0, 0, 191, 0, 0, 128, - 189, 186, 73, 204, 63, 197, - 32, 80, 63, 81, 0, 0, - 5, 2, 0, 15, 160, 244, - 253, 148, 63, 233, 38, 1, - 64, 39, 49, 200, 62, 0, + 5, 1, 0, 15, 160, 115, + 128, 0, 191, 18, 131, 128, + 189, 182, 74, 204, 63, 205, + 30, 80, 63, 81, 0, 0, + 5, 2, 0, 15, 160, 103, + 10, 149, 63, 76, 26, 1, + 64, 196, 148, 200, 62, 0, 0, 128, 63, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, @@ -8674,12 +8674,12 @@ const BYTE g_main[] = 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, - 0, 0, 0, 0, 191, 56, + 0, 115, 128, 0, 191, 56, 0, 0, 10, 50, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, - 0, 2, 64, 0, 0, 186, - 73, 204, 63, 197, 32, 80, + 0, 2, 64, 0, 0, 182, + 74, 204, 63, 205, 30, 80, 63, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 1, @@ -8691,19 +8691,19 @@ const BYTE g_main[] = 7, 66, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 1, - 64, 0, 0, 0, 0, 128, + 64, 0, 0, 18, 131, 128, 189, 50, 0, 0, 10, 34, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, - 0, 244, 253, 148, 63, 26, + 0, 103, 10, 149, 63, 26, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 9, 18, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 244, - 253, 148, 63, 10, 0, 16, + 0, 1, 64, 0, 0, 103, + 10, 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 2, 0, 0, 0, 70, @@ -8714,24 +8714,24 @@ const BYTE g_main[] = 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 2, 0, 0, - 0, 1, 64, 0, 0, 0, - 0, 0, 191, 50, 0, 0, + 0, 1, 64, 0, 0, 115, + 128, 0, 191, 50, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 1, 64, 0, - 0, 39, 49, 200, 62, 26, + 0, 196, 148, 200, 62, 26, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, - 0, 233, 38, 1, 64, 50, + 0, 76, 26, 1, 64, 50, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 244, - 253, 148, 63, 10, 0, 16, + 0, 1, 64, 0, 0, 103, + 10, 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, 0, 0, 1, @@ -8746,7 +8746,7 @@ const BYTE g_main[] = 0, 0, 0, 15, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, - 0, 6, 0, 0, 0, 0, + 0, 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -8852,10 +8852,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, @@ -8893,10 +8893,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, - 0, 68, 88, 66, 67, 249, - 28, 197, 252, 166, 119, 59, - 228, 111, 222, 205, 192, 170, - 128, 255, 70, 1, 0, 0, + 0, 68, 88, 66, 67, 134, + 58, 181, 81, 234, 180, 23, + 54, 140, 98, 159, 162, 74, + 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, 228, @@ -9063,7 +9063,7 @@ const BYTE g_main[] = 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, - 0, 6, 0, 0, 0, 0, + 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -9073,7 +9073,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -9188,9 +9188,9 @@ const BYTE g_main[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, @@ -9219,9 +9219,9 @@ const BYTE g_main[] = 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 208, 5, 0, 0, 68, 88, 66, - 67, 188, 170, 18, 58, 186, - 80, 199, 169, 56, 17, 5, - 177, 135, 21, 172, 165, 1, + 67, 221, 34, 215, 183, 71, + 137, 39, 113, 128, 157, 241, + 55, 153, 55, 174, 108, 1, 0, 0, 0, 208, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 64, 1, 0, @@ -9344,7 +9344,7 @@ const BYTE g_main[] = 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 2, 0, 0, + 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -9436,9 +9436,9 @@ const BYTE g_main[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, @@ -9480,10 +9480,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, - 0, 68, 88, 66, 67, 249, - 28, 197, 252, 166, 119, 59, - 228, 111, 222, 205, 192, 170, - 128, 255, 70, 1, 0, 0, + 0, 68, 88, 66, 67, 134, + 58, 181, 81, 234, 180, 23, + 54, 140, 98, 159, 162, 74, + 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, 0, 228, @@ -9650,7 +9650,7 @@ const BYTE g_main[] = 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, - 0, 6, 0, 0, 0, 0, + 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -9660,7 +9660,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -9775,9 +9775,9 @@ const BYTE g_main[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, @@ -9806,9 +9806,9 @@ const BYTE g_main[] = 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 216, 2, 0, 0, 68, 88, 66, - 67, 136, 106, 87, 29, 239, - 32, 100, 138, 218, 2, 105, - 91, 143, 165, 252, 49, 1, + 67, 127, 205, 139, 78, 240, + 148, 72, 80, 60, 232, 29, + 175, 91, 153, 47, 16, 1, 0, 0, 0, 216, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 132, 0, 0, @@ -9900,10 +9900,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, 0, @@ -9940,9 +9940,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, 88, - 66, 67, 249, 28, 197, 252, - 166, 119, 59, 228, 111, 222, - 205, 192, 170, 128, 255, 70, + 66, 67, 134, 58, 181, 81, + 234, 180, 23, 54, 140, 98, + 159, 162, 74, 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, @@ -10109,7 +10109,7 @@ const BYTE g_main[] = 65, 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 6, 0, + 3, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, @@ -10119,7 +10119,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -10234,10 +10234,10 @@ const BYTE g_main[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, @@ -10265,10 +10265,10 @@ const BYTE g_main[] = 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 216, 2, 0, 0, - 68, 88, 66, 67, 136, 106, - 87, 29, 239, 32, 100, 138, - 218, 2, 105, 91, 143, 165, - 252, 49, 1, 0, 0, 0, + 68, 88, 66, 67, 127, 205, + 139, 78, 240, 148, 72, 80, + 60, 232, 29, 175, 91, 153, + 47, 16, 1, 0, 0, 0, 216, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 132, 0, 0, 0, 204, 0, @@ -10360,9 +10360,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -10402,9 +10402,9 @@ const BYTE g_main[] = 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 136, 7, 0, 0, 68, 88, 66, - 67, 249, 28, 197, 252, 166, - 119, 59, 228, 111, 222, 205, - 192, 170, 128, 255, 70, 1, + 67, 134, 58, 181, 81, 234, + 180, 23, 54, 140, 98, 159, + 162, 74, 150, 11, 172, 1, 0, 0, 0, 136, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 188, 1, 0, @@ -10571,7 +10571,7 @@ const BYTE g_main[] = 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 6, 0, 0, + 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, @@ -10581,7 +10581,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -10696,10 +10696,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, 0, @@ -10727,10 +10727,10 @@ const BYTE g_main[] = 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 140, 2, 0, 0, 68, - 88, 66, 67, 120, 218, 197, - 160, 79, 160, 235, 82, 197, - 10, 155, 183, 41, 226, 48, - 248, 1, 0, 0, 0, 140, + 88, 66, 67, 242, 13, 26, + 125, 185, 83, 251, 62, 147, + 219, 54, 247, 94, 94, 245, + 124, 1, 0, 0, 0, 140, 2, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 168, 0, 0, 0, 20, 1, 0, @@ -10805,9 +10805,9 @@ const BYTE g_main[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, @@ -10850,9 +10850,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, 0, 68, 88, - 66, 67, 169, 150, 145, 216, - 234, 78, 253, 86, 77, 68, - 6, 212, 187, 231, 104, 78, + 66, 67, 190, 117, 181, 57, + 187, 108, 178, 85, 11, 114, + 197, 104, 54, 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, @@ -11048,7 +11048,7 @@ const BYTE g_main[] = 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, + 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11173,9 +11173,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, @@ -11208,9 +11208,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 76, 5, 0, 0, 68, 88, - 66, 67, 2, 86, 18, 89, - 155, 147, 85, 85, 212, 15, - 31, 6, 43, 118, 52, 47, + 66, 67, 130, 78, 41, 193, + 98, 190, 236, 116, 206, 211, + 190, 246, 52, 93, 124, 137, 1, 0, 0, 0, 76, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 8, 1, @@ -11403,9 +11403,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, @@ -11449,9 +11449,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, 0, 68, 88, - 66, 67, 169, 150, 145, 216, - 234, 78, 253, 86, 77, 68, - 6, 212, 187, 231, 104, 78, + 66, 67, 190, 117, 181, 57, + 187, 108, 178, 85, 11, 114, + 197, 104, 54, 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, @@ -11647,7 +11647,7 @@ const BYTE g_main[] = 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, + 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -11772,9 +11772,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, @@ -11807,9 +11807,9 @@ const BYTE g_main[] = 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 144, 5, 0, 0, 68, 88, - 66, 67, 239, 83, 247, 155, - 21, 118, 142, 53, 183, 4, - 63, 81, 228, 175, 103, 61, + 66, 67, 113, 140, 186, 29, + 121, 124, 246, 156, 156, 129, + 164, 254, 156, 2, 223, 127, 1, 0, 0, 0, 144, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 8, 1, @@ -12013,10 +12013,10 @@ const BYTE g_main[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, @@ -12059,9 +12059,9 @@ const BYTE g_main[] = 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, 0, 68, 88, 66, 67, - 169, 150, 145, 216, 234, 78, - 253, 86, 77, 68, 6, 212, - 187, 231, 104, 78, 1, 0, + 190, 117, 181, 57, 187, 108, + 178, 85, 11, 114, 197, 104, + 54, 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, @@ -12257,7 +12257,7 @@ const BYTE g_main[] = 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -12382,9 +12382,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, @@ -12417,9 +12417,9 @@ const BYTE g_main[] = 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 40, 5, 0, 0, 68, 88, 66, 67, - 97, 73, 247, 126, 8, 101, - 119, 242, 175, 221, 216, 116, - 1, 172, 160, 250, 1, 0, + 134, 242, 22, 210, 198, 226, + 208, 239, 25, 201, 212, 19, + 217, 12, 67, 204, 1, 0, 0, 0, 40, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0, 0, 0, @@ -12606,9 +12606,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, @@ -12651,10 +12651,10 @@ const BYTE g_main[] = 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 160, 8, 0, 0, - 68, 88, 66, 67, 126, 127, - 73, 177, 123, 87, 14, 42, - 122, 131, 65, 136, 212, 65, - 198, 133, 1, 0, 0, 0, + 68, 88, 66, 67, 34, 121, + 201, 137, 199, 29, 125, 49, + 68, 233, 221, 121, 196, 122, + 136, 83, 1, 0, 0, 0, 160, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 60, 2, 0, 0, 228, 4, @@ -12863,7 +12863,7 @@ const BYTE g_main[] = 65, 84, 116, 0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, - 4, 0, 0, 0, 9, 0, + 4, 0, 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, @@ -12873,7 +12873,7 @@ const BYTE g_main[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -12988,10 +12988,10 @@ const BYTE g_main[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, @@ -13023,10 +13023,10 @@ const BYTE g_main[] = 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 96, 5, 0, 0, - 68, 88, 66, 67, 202, 125, - 64, 99, 21, 11, 196, 180, - 9, 103, 153, 137, 12, 26, - 194, 80, 1, 0, 0, 0, + 68, 88, 66, 67, 241, 142, + 205, 228, 253, 156, 187, 52, + 46, 187, 89, 206, 15, 61, + 26, 195, 1, 0, 0, 0, 96, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 24, 1, 0, 0, 52, 2, @@ -13222,9 +13222,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, @@ -13267,10 +13267,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, - 0, 68, 88, 66, 67, 169, - 150, 145, 216, 234, 78, 253, - 86, 77, 68, 6, 212, 187, - 231, 104, 78, 1, 0, 0, + 0, 68, 88, 66, 67, 190, + 117, 181, 57, 187, 108, 178, + 85, 11, 114, 197, 104, 54, + 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, 144, @@ -13465,7 +13465,7 @@ const BYTE g_main[] = 84, 65, 84, 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 8, + 0, 4, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -13591,9 +13591,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, @@ -13625,10 +13625,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 40, 5, 0, - 0, 68, 88, 66, 67, 97, - 73, 247, 126, 8, 101, 119, - 242, 175, 221, 216, 116, 1, - 172, 160, 250, 1, 0, 0, + 0, 68, 88, 66, 67, 134, + 242, 22, 210, 198, 226, 208, + 239, 25, 201, 212, 19, 217, + 12, 67, 204, 1, 0, 0, 0, 40, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0, 0, 0, 252, @@ -13815,9 +13815,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, @@ -13861,9 +13861,9 @@ const BYTE g_main[] = 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, 0, 68, 88, 66, 67, - 169, 150, 145, 216, 234, 78, - 253, 86, 77, 68, 6, 212, - 187, 231, 104, 78, 1, 0, + 190, 117, 181, 57, 187, 108, + 178, 85, 11, 114, 197, 104, + 54, 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, @@ -14059,7 +14059,7 @@ const BYTE g_main[] = 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -14184,9 +14184,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, @@ -14219,9 +14219,9 @@ const BYTE g_main[] = 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 108, 5, 0, 0, 68, 88, 66, 67, - 68, 156, 177, 19, 117, 199, - 87, 208, 226, 224, 191, 92, - 88, 131, 193, 142, 1, 0, + 186, 119, 163, 245, 195, 113, + 37, 97, 142, 174, 157, 244, + 160, 5, 164, 176, 1, 0, 0, 0, 108, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0, 0, 0, @@ -14419,9 +14419,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, @@ -14466,9 +14466,9 @@ const BYTE g_main[] = 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, 0, 68, 88, 66, 67, - 169, 150, 145, 216, 234, 78, - 253, 86, 77, 68, 6, 212, - 187, 231, 104, 78, 1, 0, + 190, 117, 181, 57, 187, 108, + 178, 85, 11, 114, 197, 104, + 54, 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, @@ -14664,7 +14664,7 @@ const BYTE g_main[] = 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, - 8, 0, 0, 0, 0, 0, + 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -14789,9 +14789,9 @@ const BYTE g_main[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 171, 171, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, @@ -14824,9 +14824,9 @@ const BYTE g_main[] = 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 108, 5, 0, 0, 68, 88, 66, 67, - 68, 156, 177, 19, 117, 199, - 87, 208, 226, 224, 191, 92, - 88, 131, 193, 142, 1, 0, + 186, 119, 163, 245, 195, 113, + 37, 97, 142, 174, 157, 244, + 160, 5, 164, 176, 1, 0, 0, 0, 108, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0, 0, 0, @@ -15024,9 +15024,9 @@ const BYTE g_main[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, @@ -15068,10 +15068,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, - 0, 68, 88, 66, 67, 169, - 150, 145, 216, 234, 78, 253, - 86, 77, 68, 6, 212, 187, - 231, 104, 78, 1, 0, 0, + 0, 68, 88, 66, 67, 190, + 117, 181, 57, 187, 108, 178, + 85, 11, 114, 197, 104, 54, + 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, 144, @@ -15266,7 +15266,7 @@ const BYTE g_main[] = 84, 65, 84, 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 8, + 0, 4, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -15392,9 +15392,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, @@ -15426,10 +15426,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 52, 8, 0, - 0, 68, 88, 66, 67, 202, - 83, 22, 204, 207, 151, 51, - 179, 174, 132, 82, 181, 125, - 14, 145, 73, 1, 0, 0, + 0, 68, 88, 66, 67, 1, + 74, 129, 243, 237, 178, 75, + 1, 68, 217, 73, 188, 217, + 60, 1, 254, 1, 0, 0, 0, 52, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 24, 2, 0, 0, 196, @@ -15449,13 +15449,13 @@ const BYTE g_main[] = 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 1, - 0, 15, 160, 0, 0, 0, - 191, 0, 0, 128, 189, 186, - 73, 204, 63, 197, 32, 80, + 0, 15, 160, 115, 128, 0, + 191, 18, 131, 128, 189, 182, + 74, 204, 63, 205, 30, 80, 63, 81, 0, 0, 5, 2, - 0, 15, 160, 244, 253, 148, - 63, 233, 38, 1, 64, 39, - 49, 200, 62, 0, 0, 128, + 0, 15, 160, 103, 10, 149, + 63, 76, 26, 1, 64, 196, + 148, 200, 62, 0, 0, 128, 63, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, 31, 0, 0, 2, 0, @@ -15550,13 +15550,13 @@ const BYTE g_main[] = 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 0, - 0, 0, 191, 56, 0, 0, + 0, 1, 64, 0, 0, 115, + 128, 0, 191, 56, 0, 0, 10, 50, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 2, - 64, 0, 0, 186, 73, 204, - 63, 197, 32, 80, 63, 0, + 64, 0, 0, 182, 74, 204, + 63, 205, 30, 80, 63, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 1, 0, 0, @@ -15568,18 +15568,18 @@ const BYTE g_main[] = 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, - 0, 0, 0, 128, 189, 50, + 0, 18, 131, 128, 189, 50, 0, 0, 10, 34, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 244, - 253, 148, 63, 26, 0, 16, + 0, 1, 64, 0, 0, 103, + 10, 149, 63, 26, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 9, 18, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 1, - 64, 0, 0, 244, 253, 148, + 64, 0, 0, 103, 10, 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 2, @@ -15591,23 +15591,23 @@ const BYTE g_main[] = 7, 18, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 2, 0, 0, 0, 1, - 64, 0, 0, 0, 0, 0, + 64, 0, 0, 115, 128, 0, 191, 50, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 39, - 49, 200, 62, 26, 0, 16, + 0, 1, 64, 0, 0, 196, + 148, 200, 62, 26, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, - 0, 1, 64, 0, 0, 233, - 38, 1, 64, 50, 0, 0, + 0, 1, 64, 0, 0, 76, + 26, 1, 64, 50, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 1, - 64, 0, 0, 244, 253, 148, + 64, 0, 0, 103, 10, 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, @@ -15633,7 +15633,7 @@ const BYTE g_main[] = 84, 116, 0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 7, 0, 0, + 0, 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, @@ -15746,9 +15746,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, @@ -15791,10 +15791,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, - 0, 68, 88, 66, 67, 169, - 150, 145, 216, 234, 78, 253, - 86, 77, 68, 6, 212, 187, - 231, 104, 78, 1, 0, 0, + 0, 68, 88, 66, 67, 190, + 117, 181, 57, 187, 108, 178, + 85, 11, 114, 197, 104, 54, + 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, 144, @@ -15989,7 +15989,7 @@ const BYTE g_main[] = 84, 65, 84, 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 8, + 0, 4, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -16115,9 +16115,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, @@ -16149,10 +16149,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 160, 6, 0, - 0, 68, 88, 66, 67, 122, - 120, 197, 160, 122, 27, 127, - 104, 85, 146, 3, 115, 69, - 29, 147, 100, 1, 0, 0, + 0, 68, 88, 66, 67, 178, + 167, 73, 233, 167, 120, 251, + 206, 98, 157, 244, 246, 26, + 126, 89, 155, 1, 0, 0, 0, 160, 6, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 124, 1, 0, 0, 52, @@ -16299,7 +16299,7 @@ const BYTE g_main[] = 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -16397,10 +16397,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, @@ -16446,10 +16446,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 3, 0, 0, 0, 255, 255, 255, 255, 76, 8, 0, - 0, 68, 88, 66, 67, 169, - 150, 145, 216, 234, 78, 253, - 86, 77, 68, 6, 212, 187, - 231, 104, 78, 1, 0, 0, + 0, 68, 88, 66, 67, 190, + 117, 181, 57, 187, 108, 178, + 85, 11, 114, 197, 104, 54, + 155, 141, 115, 1, 0, 0, 0, 76, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 4, 2, 0, 0, 144, @@ -16644,7 +16644,7 @@ const BYTE g_main[] = 84, 65, 84, 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 8, + 0, 4, 0, 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, @@ -16770,9 +16770,9 @@ const BYTE g_main[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 171, 73, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, @@ -16804,10 +16804,10 @@ const BYTE g_main[] = 0, 0, 0, 1, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 244, 3, 0, - 0, 68, 88, 66, 67, 56, - 178, 32, 36, 251, 169, 131, - 34, 95, 60, 44, 33, 126, - 59, 30, 160, 1, 0, 0, + 0, 68, 88, 66, 67, 238, + 234, 249, 25, 8, 157, 205, + 248, 243, 67, 9, 213, 110, + 126, 232, 189, 1, 0, 0, 0, 244, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 204, 0, 0, 0, 112, @@ -16942,10 +16942,10 @@ const BYTE g_main[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 171, 171, 171, 73, 83, 71, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, 0, diff --git a/gfx/layers/d3d11/CompositorD3D11.fx b/gfx/layers/d3d11/CompositorD3D11.fx index 99221117bb18..ca189b5a028c 100644 --- a/gfx/layers/d3d11/CompositorD3D11.fx +++ b/gfx/layers/d3d11/CompositorD3D11.fx @@ -180,18 +180,28 @@ float4 RGBShaderMask(const VS_MASK_OUTPUT aVertex) : SV_Target return result * mask; } +/* From Rec601: +[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16] +[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128] +[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128] + +For [0,1] instead of [0,255], and to 5 places: +[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275] +[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196] +[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196] +*/ float4 CalculateYCbCrColor(const float2 aTexCoords) { float4 yuv; float4 color; - yuv.r = tCr.Sample(sSampler, aTexCoords).a - 0.5; - yuv.g = tY.Sample(sSampler, aTexCoords).a - 0.0625; - yuv.b = tCb.Sample(sSampler, aTexCoords).a - 0.5; + yuv.r = tCr.Sample(sSampler, aTexCoords).a - 0.50196; + yuv.g = tY.Sample(sSampler, aTexCoords).a - 0.06275; + yuv.b = tCb.Sample(sSampler, aTexCoords).a - 0.50196; - color.r = yuv.g * 1.164 + yuv.r * 1.596; - color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; - color.b = yuv.g * 1.164 + yuv.b * 2.018; + color.r = yuv.g * 1.16438 + yuv.r * 1.59603; + color.g = yuv.g * 1.16438 - 0.81297 * yuv.r - 0.39176 * yuv.b; + color.b = yuv.g * 1.16438 + yuv.b * 2.01723; color.a = 1.0f; return color; diff --git a/gfx/layers/d3d11/CompositorD3D11Shaders.h b/gfx/layers/d3d11/CompositorD3D11Shaders.h index 5866b4cd2cb5..18b99663296b 100644 --- a/gfx/layers/d3d11/CompositorD3D11Shaders.h +++ b/gfx/layers/d3d11/CompositorD3D11Shaders.h @@ -1,10 +1,6 @@ #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ELayerQuadVS -nologo -Tvs_4_0_level_9_3 -// -FhtmpShaderHeader -VnLayerQuadVS +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -34,17 +30,17 @@ // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xy 0 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// POSITION 0 xy 0 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xy 1 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy // // // Constant buffer to DX9 shader constant mappings: @@ -107,10 +103,10 @@ ret const BYTE LayerQuadVS[] = { - 68, 88, 66, 67, 26, 156, - 32, 249, 73, 220, 32, 91, - 64, 185, 136, 143, 133, 249, - 140, 206, 1, 0, 0, 0, + 68, 88, 66, 67, 200, 251, + 64, 251, 166, 240, 101, 137, + 191, 140, 75, 217, 9, 168, + 61, 163, 1, 0, 0, 0, 180, 6, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 152, 1, 0, 0, 160, 3, @@ -265,7 +261,7 @@ const BYTE LayerQuadVS[] = 65, 84, 116, 0, 0, 0, 13, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, - 3, 0, 0, 0, 6, 0, + 3, 0, 0, 0, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, @@ -275,7 +271,7 @@ const BYTE LayerQuadVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -366,10 +362,10 @@ const BYTE LayerQuadVS[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 171, 171, 73, 83, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, 32, 0, 0, 0, @@ -396,11 +392,7 @@ const BYTE LayerQuadVS[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ESolidColorShader -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnSolidColorShader +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -430,17 +422,17 @@ const BYTE LayerQuadVS[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -466,10 +458,10 @@ ret const BYTE SolidColorShader[] = { - 68, 88, 66, 67, 204, 8, - 5, 100, 51, 20, 107, 176, - 111, 165, 149, 245, 134, 187, - 83, 96, 1, 0, 0, 0, + 68, 88, 66, 67, 30, 148, + 104, 202, 165, 39, 58, 182, + 100, 205, 95, 195, 52, 137, + 197, 241, 1, 0, 0, 0, 224, 3, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 132, 0, 0, 0, 204, 0, @@ -605,9 +597,9 @@ const BYTE SolidColorShader[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -635,11 +627,7 @@ const BYTE SolidColorShader[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ERGBShader -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnRGBShader +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -671,17 +659,17 @@ const BYTE SolidColorShader[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -725,10 +713,10 @@ ret const BYTE RGBShader[] = { - 68, 88, 66, 67, 20, 109, - 176, 198, 26, 112, 108, 185, - 246, 240, 143, 18, 57, 236, - 126, 68, 1, 0, 0, 0, + 68, 88, 66, 67, 239, 198, + 87, 206, 69, 92, 245, 30, + 125, 195, 239, 77, 37, 241, + 175, 187, 1, 0, 0, 0, 232, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 204, 0, 0, 0, 136, 1, @@ -908,9 +896,9 @@ const BYTE RGBShader[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -938,11 +926,7 @@ const BYTE RGBShader[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ERGBAShader -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnRGBAShader +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -974,17 +958,17 @@ const BYTE RGBShader[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1026,10 +1010,10 @@ ret const BYTE RGBAShader[] = { - 68, 88, 66, 67, 214, 26, - 168, 112, 65, 151, 75, 99, - 196, 63, 136, 104, 158, 202, - 217, 7, 1, 0, 0, 0, + 68, 88, 66, 67, 230, 59, + 90, 23, 60, 77, 18, 113, + 14, 129, 183, 152, 233, 55, + 111, 42, 1, 0, 0, 0, 196, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 192, 0, 0, 0, 100, 1, @@ -1203,9 +1187,9 @@ const BYTE RGBAShader[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -1233,11 +1217,7 @@ const BYTE RGBAShader[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -EComponentAlphaShader -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnComponentAlphaShader +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1270,18 +1250,18 @@ const BYTE RGBAShader[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw -// SV_Target 1 xyzw 1 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// SV_Target 1 xyzw 1 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1339,10 +1319,10 @@ ret const BYTE ComponentAlphaShader[] = { - 68, 88, 66, 67, 207, 238, - 180, 151, 111, 52, 137, 3, - 45, 243, 229, 223, 99, 172, - 89, 3, 1, 0, 0, 0, + 68, 88, 66, 67, 186, 162, + 72, 42, 69, 36, 160, 68, + 108, 121, 216, 238, 108, 37, + 6, 145, 1, 0, 0, 0, 68, 6, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 64, 1, 0, 0, 160, 2, @@ -1465,7 +1445,7 @@ const BYTE ComponentAlphaShader[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 2, 0, 0, 0, 0, 0, + 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -1576,9 +1556,9 @@ const BYTE ComponentAlphaShader[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, @@ -1610,11 +1590,7 @@ const BYTE ComponentAlphaShader[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -EYCbCrShader -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnYCbCrShader +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -1648,17 +1624,17 @@ const BYTE ComponentAlphaShader[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -1680,8 +1656,8 @@ const BYTE ComponentAlphaShader[] = // Level9 shader bytecode: // ps_2_x - def c1, -0.5, -0.0625, 1.59599996, 0.813000023 - def c2, 1.16400003, 2.01799989, 0.391000003, 1 + def c1, -0.50195998, -0.0627499968, 1.59603, 0.812969983 + def c2, 1.16437995, 2.01723003, 0.391759992, 1 dcl t0.xy dcl_2d s0 dcl_2d s1 @@ -1713,17 +1689,17 @@ dcl_input_ps linear v1.xy dcl_output o0.xyzw dcl_temps 3 sample r0.xyzw, v1.xyxx, t2.xyzw, s0 -add r0.x, r0.w, l(-0.500000) -mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000) +add r0.x, r0.w, l(-0.501960) +mul r0.xy, r0.xxxx, l(1.596030, 0.812970, 0.000000, 0.000000) sample r1.xyzw, v1.xyxx, t0.xyzw, s0 -add r0.z, r1.w, l(-0.062500) -mad r0.y, r0.z, l(1.164000), -r0.y -mad r1.x, r0.z, l(1.164000), r0.x +add r0.z, r1.w, l(-0.062750) +mad r0.y, r0.z, l(1.164380), -r0.y +mad r1.x, r0.z, l(1.164380), r0.x sample r2.xyzw, v1.xyxx, t1.xyzw, s0 -add r0.x, r2.w, l(-0.500000) -mad r1.y, -r0.x, l(0.391000), r0.y -mul r0.x, r0.x, l(2.018000) -mad r1.z, r0.z, l(1.164000), r0.x +add r0.x, r2.w, l(-0.501960) +mad r1.y, -r0.x, l(0.391760), r0.y +mul r0.x, r0.x, l(2.017230) +mad r1.z, r0.z, l(1.164380), r0.x mov r1.w, l(1.000000) mul o0.xyzw, r1.xyzw, cb0[1].xxxx ret @@ -1732,10 +1708,10 @@ ret const BYTE YCbCrShader[] = { - 68, 88, 66, 67, 235, 16, - 121, 249, 238, 190, 171, 40, - 106, 5, 31, 27, 153, 48, - 114, 96, 1, 0, 0, 0, + 68, 88, 66, 67, 181, 118, + 100, 53, 248, 120, 136, 92, + 59, 190, 18, 201, 139, 224, + 32, 141, 1, 0, 0, 0, 212, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 220, 1, 0, 0, 44, 4, @@ -1754,13 +1730,13 @@ const BYTE YCbCrShader[] = 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, - 1, 0, 15, 160, 0, 0, - 0, 191, 0, 0, 128, 189, - 186, 73, 204, 63, 197, 32, + 1, 0, 15, 160, 115, 128, + 0, 191, 18, 131, 128, 189, + 182, 74, 204, 63, 205, 30, 80, 63, 81, 0, 0, 5, - 2, 0, 15, 160, 244, 253, - 148, 63, 233, 38, 1, 64, - 39, 49, 200, 62, 0, 0, + 2, 0, 15, 160, 103, 10, + 149, 63, 76, 26, 1, 64, + 196, 148, 200, 62, 0, 0, 128, 63, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 3, 176, 31, 0, 0, 2, @@ -1842,12 +1818,12 @@ const BYTE YCbCrShader[] = 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 0, 191, 56, 0, + 115, 128, 0, 191, 56, 0, 0, 10, 50, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, - 2, 64, 0, 0, 186, 73, - 204, 63, 197, 32, 80, 63, + 2, 64, 0, 0, 182, 74, + 204, 63, 205, 30, 80, 63, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 1, 0, @@ -1859,19 +1835,19 @@ const BYTE YCbCrShader[] = 66, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 128, 189, + 0, 0, 18, 131, 128, 189, 50, 0, 0, 10, 34, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, - 244, 253, 148, 63, 26, 0, + 103, 10, 149, 63, 26, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 9, 18, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 244, 253, - 148, 63, 10, 0, 16, 0, + 1, 64, 0, 0, 103, 10, + 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 2, 0, 0, 0, 70, 16, @@ -1882,24 +1858,24 @@ const BYTE YCbCrShader[] = 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 2, 0, 0, 0, - 1, 64, 0, 0, 0, 0, + 1, 64, 0, 0, 115, 128, 0, 191, 50, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 1, 64, 0, 0, - 39, 49, 200, 62, 26, 0, + 196, 148, 200, 62, 26, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, 1, 64, 0, 0, - 233, 38, 1, 64, 50, 0, + 76, 26, 1, 64, 50, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 244, 253, - 148, 63, 10, 0, 16, 0, + 1, 64, 0, 0, 103, 10, + 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, 0, 0, 1, 64, @@ -1914,7 +1890,7 @@ const BYTE YCbCrShader[] = 0, 0, 15, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, - 6, 0, 0, 0, 0, 0, + 10, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2040,9 +2016,9 @@ const BYTE YCbCrShader[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 73, 83, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 73, 83, 71, 78, 80, 0, 0, 0, 2, 0, 0, 0, 8, 0, 0, 0, 56, 0, 0, 0, @@ -2069,11 +2045,7 @@ const BYTE YCbCrShader[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ELayerQuadMaskVS -nologo -Tvs_4_0_level_9_3 -// -FhtmpShaderHeader -VnLayerQuadMaskVS +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2103,18 +2075,18 @@ const BYTE YCbCrShader[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xy 0 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// POSITION 0 xy 0 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 zw 1 NONE float zw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw // // // Constant buffer to DX9 shader constant mappings: @@ -2186,10 +2158,10 @@ ret const BYTE LayerQuadMaskVS[] = { - 68, 88, 66, 67, 15, 196, - 252, 199, 211, 188, 92, 26, - 46, 113, 249, 29, 135, 110, - 83, 119, 1, 0, 0, 0, + 68, 88, 66, 67, 223, 251, + 10, 17, 13, 90, 47, 25, + 119, 198, 20, 157, 124, 193, + 251, 234, 1, 0, 0, 0, 120, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 224, 1, 0, 0, 76, 4, @@ -2373,7 +2345,7 @@ const BYTE LayerQuadMaskVS[] = 116, 0, 0, 0, 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 8, 0, 0, 0, + 0, 0, 14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2474,9 +2446,9 @@ const BYTE LayerQuadMaskVS[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, @@ -2508,11 +2480,7 @@ const BYTE LayerQuadMaskVS[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ELayerQuadMask3DVS -nologo -Tvs_4_0_level_9_3 -// -FhtmpShaderHeader -VnLayerQuadMask3DVS +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -2542,18 +2510,18 @@ const BYTE LayerQuadMaskVS[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// POSITION 0 xy 0 NONE float xy +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// POSITION 0 xy 0 NONE float xy // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float xyzw -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 xyz 2 NONE float xyz +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float xyzw +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xyz 2 NONE float xyz // // // Constant buffer to DX9 shader constant mappings: @@ -2629,10 +2597,10 @@ ret const BYTE LayerQuadMask3DVS[] = { - 68, 88, 66, 67, 100, 40, - 55, 29, 238, 71, 107, 78, - 214, 182, 73, 149, 138, 22, - 163, 187, 1, 0, 0, 0, + 68, 88, 66, 67, 151, 141, + 11, 11, 111, 244, 17, 242, + 119, 116, 248, 53, 235, 192, + 38, 193, 1, 0, 0, 0, 204, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 24, 2, 0, 0, 160, 4, @@ -2830,7 +2798,7 @@ const BYTE LayerQuadMask3DVS[] = 116, 0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 9, 0, 0, 0, + 0, 0, 15, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2840,7 +2808,7 @@ const BYTE LayerQuadMask3DVS[] = 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, + 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -2931,9 +2899,9 @@ const BYTE LayerQuadMask3DVS[] = 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, - 101, 114, 32, 57, 46, 50, - 57, 46, 57, 53, 50, 46, - 51, 49, 49, 49, 0, 171, + 101, 114, 32, 54, 46, 51, + 46, 57, 54, 48, 48, 46, + 49, 54, 51, 56, 52, 0, 171, 171, 73, 83, 71, 78, 44, 0, 0, 0, 1, 0, 0, 0, 8, 0, 0, 0, @@ -2965,11 +2933,7 @@ const BYTE LayerQuadMask3DVS[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ESolidColorShaderMask -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnSolidColorShaderMask +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3001,18 +2965,18 @@ const BYTE LayerQuadMask3DVS[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float -// TEXCOORD 1 zw 1 NONE float zw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float +// TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3055,10 +3019,10 @@ ret const BYTE SolidColorShaderMask[] = { - 68, 88, 66, 67, 92, 193, - 158, 159, 177, 150, 196, 208, - 237, 57, 66, 98, 44, 248, - 148, 128, 1, 0, 0, 0, + 68, 88, 66, 67, 236, 109, + 19, 151, 23, 187, 157, 205, + 112, 188, 91, 187, 108, 106, + 138, 14, 1, 0, 0, 0, 232, 4, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 204, 0, 0, 0, 112, 1, @@ -3234,9 +3198,9 @@ const BYTE SolidColorShaderMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, @@ -3268,11 +3232,7 @@ const BYTE SolidColorShaderMask[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ERGBShaderMask -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnRGBShaderMask +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3305,18 +3265,18 @@ const BYTE SolidColorShaderMask[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 zw 1 NONE float zw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3369,10 +3329,10 @@ ret const BYTE RGBShaderMask[] = { - 68, 88, 66, 67, 211, 41, - 177, 153, 133, 94, 180, 137, - 188, 24, 43, 126, 122, 18, - 165, 144, 1, 0, 0, 0, + 68, 88, 66, 67, 30, 30, + 87, 58, 114, 156, 251, 151, + 29, 94, 34, 100, 228, 250, + 37, 251, 1, 0, 0, 0, 192, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 8, 1, 0, 0, 32, 2, @@ -3584,9 +3544,9 @@ const BYTE RGBShaderMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, @@ -3618,11 +3578,7 @@ const BYTE RGBShaderMask[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ERGBAShaderMask -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnRGBAShaderMask +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3655,18 +3611,18 @@ const BYTE RGBShaderMask[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 zw 1 NONE float zw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -3717,10 +3673,10 @@ ret const BYTE RGBAShaderMask[] = { - 68, 88, 66, 67, 234, 65, - 122, 94, 147, 106, 10, 149, - 54, 131, 161, 84, 79, 89, - 113, 104, 1, 0, 0, 0, + 68, 88, 66, 67, 188, 13, + 191, 168, 231, 201, 42, 209, + 88, 243, 29, 35, 226, 31, + 145, 20, 1, 0, 0, 0, 156, 5, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 252, 0, 0, 0, 252, 1, @@ -3926,9 +3882,9 @@ const BYTE RGBAShaderMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, @@ -3960,11 +3916,7 @@ const BYTE RGBAShaderMask[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -ERGBAShaderMask3D -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnRGBAShaderMask3D +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -3998,18 +3950,18 @@ const BYTE RGBAShaderMask[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 xyz 2 NONE float xyz +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 xyz 2 NONE float xyz // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4064,10 +4016,10 @@ ret const BYTE RGBAShaderMask3D[] = { - 68, 88, 66, 67, 44, 91, - 221, 241, 68, 147, 240, 210, - 227, 186, 152, 41, 63, 147, - 120, 30, 1, 0, 0, 0, + 68, 88, 66, 67, 113, 141, + 78, 23, 128, 223, 235, 10, + 0, 97, 49, 111, 47, 53, + 229, 55, 1, 0, 0, 0, 24, 6, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 24, 1, 0, 0, 64, 2, @@ -4294,9 +4246,9 @@ const BYTE RGBAShaderMask3D[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 73, 83, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, @@ -4327,11 +4279,7 @@ const BYTE RGBAShaderMask3D[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -EYCbCrShaderMask -Tps_4_0_level_9_3 -nologo -// -FhtmpShaderHeader -VnYCbCrShaderMask +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4366,18 +4314,18 @@ const BYTE RGBAShaderMask3D[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 zw 1 NONE float zw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4400,8 +4348,8 @@ const BYTE RGBAShaderMask3D[] = // Level9 shader bytecode: // ps_2_x - def c1, -0.5, -0.0625, 1.59599996, 0.813000023 - def c2, 1.16400003, 2.01799989, 0.391000003, 1 + def c1, -0.50195998, -0.0627499968, 1.59603, 0.812969983 + def c2, 1.16437995, 2.01723003, 0.391759992, 1 dcl t0 dcl_2d s0 dcl_2d s1 @@ -4439,17 +4387,17 @@ dcl_input_ps linear v1.zw dcl_output o0.xyzw dcl_temps 3 sample r0.xyzw, v1.xyxx, t2.xyzw, s0 -add r0.x, r0.w, l(-0.500000) -mul r0.xy, r0.xxxx, l(1.596000, 0.813000, 0.000000, 0.000000) +add r0.x, r0.w, l(-0.501960) +mul r0.xy, r0.xxxx, l(1.596030, 0.812970, 0.000000, 0.000000) sample r1.xyzw, v1.xyxx, t0.xyzw, s0 -add r0.z, r1.w, l(-0.062500) -mad r0.y, r0.z, l(1.164000), -r0.y -mad r1.x, r0.z, l(1.164000), r0.x +add r0.z, r1.w, l(-0.062750) +mad r0.y, r0.z, l(1.164380), -r0.y +mad r1.x, r0.z, l(1.164380), r0.x sample r2.xyzw, v1.xyxx, t1.xyzw, s0 -add r0.x, r2.w, l(-0.500000) -mad r1.y, -r0.x, l(0.391000), r0.y -mul r0.x, r0.x, l(2.018000) -mad r1.z, r0.z, l(1.164000), r0.x +add r0.x, r2.w, l(-0.501960) +mad r1.y, -r0.x, l(0.391760), r0.y +mul r0.x, r0.x, l(2.017230) +mad r1.z, r0.z, l(1.164380), r0.x mov r1.w, l(1.000000) mul r0.xyzw, r1.xyzw, cb0[1].xxxx sample r1.xyzw, v1.zwzz, t3.xyzw, s0 @@ -4460,10 +4408,10 @@ ret const BYTE YCbCrShaderMask[] = { - 68, 88, 66, 67, 129, 98, - 44, 194, 35, 91, 102, 10, - 204, 216, 255, 140, 38, 205, - 76, 26, 1, 0, 0, 0, + 68, 88, 66, 67, 103, 162, + 223, 236, 236, 142, 143, 151, + 73, 154, 187, 112, 81, 114, + 229, 251, 1, 0, 0, 0, 168, 8, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 24, 2, 0, 0, 196, 4, @@ -4483,12 +4431,12 @@ const BYTE YCbCrShaderMask[] = 1, 0, 0, 0, 0, 0, 0, 0, 1, 2, 255, 255, 81, 0, 0, 5, 1, 0, - 15, 160, 0, 0, 0, 191, - 0, 0, 128, 189, 186, 73, - 204, 63, 197, 32, 80, 63, + 15, 160, 115, 128, 0, 191, + 18, 131, 128, 189, 182, 74, + 204, 63, 205, 30, 80, 63, 81, 0, 0, 5, 2, 0, - 15, 160, 244, 253, 148, 63, - 233, 38, 1, 64, 39, 49, + 15, 160, 103, 10, 149, 63, + 76, 26, 1, 64, 196, 148, 200, 62, 0, 0, 128, 63, 31, 0, 0, 2, 0, 0, 0, 128, 0, 0, 15, 176, @@ -4584,13 +4532,13 @@ const BYTE YCbCrShaderMask[] = 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 0, 0, + 1, 64, 0, 0, 115, 128, 0, 191, 56, 0, 0, 10, 50, 0, 16, 0, 0, 0, 0, 0, 6, 0, 16, 0, 0, 0, 0, 0, 2, 64, - 0, 0, 186, 73, 204, 63, - 197, 32, 80, 63, 0, 0, + 0, 0, 182, 74, 204, 63, + 205, 30, 80, 63, 0, 0, 0, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 1, 0, 0, 0, @@ -4602,18 +4550,18 @@ const BYTE YCbCrShaderMask[] = 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 1, 0, 0, 0, 1, 64, 0, 0, - 0, 0, 128, 189, 50, 0, + 18, 131, 128, 189, 50, 0, 0, 10, 34, 0, 16, 0, 0, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 244, 253, - 148, 63, 26, 0, 16, 128, + 1, 64, 0, 0, 103, 10, + 149, 63, 26, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, 50, 0, 0, 9, 18, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 244, 253, 148, 63, + 0, 0, 103, 10, 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 69, 0, 0, 9, 242, 0, 16, 0, 2, 0, @@ -4625,23 +4573,23 @@ const BYTE YCbCrShaderMask[] = 18, 0, 16, 0, 0, 0, 0, 0, 58, 0, 16, 0, 2, 0, 0, 0, 1, 64, - 0, 0, 0, 0, 0, 191, + 0, 0, 115, 128, 0, 191, 50, 0, 0, 10, 34, 0, 16, 0, 1, 0, 0, 0, 10, 0, 16, 128, 65, 0, 0, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 39, 49, + 1, 64, 0, 0, 196, 148, 200, 62, 26, 0, 16, 0, 0, 0, 0, 0, 56, 0, 0, 7, 18, 0, 16, 0, 0, 0, 0, 0, 10, 0, 16, 0, 0, 0, 0, 0, - 1, 64, 0, 0, 233, 38, + 1, 64, 0, 0, 76, 26, 1, 64, 50, 0, 0, 9, 66, 0, 16, 0, 1, 0, 0, 0, 42, 0, 16, 0, 0, 0, 0, 0, 1, 64, - 0, 0, 244, 253, 148, 63, + 0, 0, 103, 10, 149, 63, 10, 0, 16, 0, 0, 0, 0, 0, 54, 0, 0, 5, 130, 0, 16, 0, 1, 0, @@ -4667,7 +4615,7 @@ const BYTE YCbCrShaderMask[] = 116, 0, 0, 0, 17, 0, 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 7, 0, 0, 0, + 0, 0, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -4799,9 +4747,9 @@ const BYTE YCbCrShaderMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 171, 171, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, @@ -4833,11 +4781,7 @@ const BYTE YCbCrShaderMask[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// -// fxc CompositorD3D11.fx -EComponentAlphaShaderMask -Tps_4_0_level_9_3 -// -nologo -FhtmpShaderHeader -VnComponentAlphaShaderMask +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // // Buffer Definitions: @@ -4871,19 +4815,19 @@ const BYTE YCbCrShaderMask[] = // // Input signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Position 0 xyzw 0 POS float -// TEXCOORD 0 xy 1 NONE float xy -// TEXCOORD 1 zw 1 NONE float zw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Position 0 xyzw 0 POS float +// TEXCOORD 0 xy 1 NONE float xy +// TEXCOORD 1 zw 1 NONE float zw // // // Output signature: // -// Name Index Mask Register SysValue Format Used -// -------------------- ----- ------ -------- -------- ------ ------ -// SV_Target 0 xyzw 0 TARGET float xyzw -// SV_Target 1 xyzw 1 TARGET float xyzw +// Name Index Mask Register SysValue Format Used +// -------------------- ----- ------ -------- -------- ------- ------ +// SV_Target 0 xyzw 0 TARGET float xyzw +// SV_Target 1 xyzw 1 TARGET float xyzw // // // Constant buffer to DX9 shader constant mappings: @@ -4950,10 +4894,10 @@ ret const BYTE ComponentAlphaShaderMask[] = { - 68, 88, 66, 67, 136, 77, - 10, 16, 135, 130, 127, 127, - 44, 35, 233, 219, 89, 184, - 173, 170, 1, 0, 0, 0, + 68, 88, 66, 67, 245, 71, + 211, 223, 156, 101, 223, 204, + 145, 138, 53, 12, 16, 220, + 106, 83, 1, 0, 0, 0, 20, 7, 0, 0, 6, 0, 0, 0, 56, 0, 0, 0, 124, 1, 0, 0, 52, 3, @@ -5100,7 +5044,7 @@ const BYTE ComponentAlphaShaderMask[] = 0, 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 2, 0, + 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -5218,9 +5162,9 @@ const BYTE ComponentAlphaShaderMask[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 171, 171, 73, 83, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 73, 83, 71, 78, 104, 0, 0, 0, 3, 0, 0, 0, 8, 0, 0, 0, 80, 0, 0, 0, diff --git a/gfx/layers/d3d11/genshaders.sh b/gfx/layers/d3d11/genshaders.sh index e1d77061460f..9a69bae542fb 100644 --- a/gfx/layers/d3d11/genshaders.sh +++ b/gfx/layers/d3d11/genshaders.sh @@ -32,3 +32,4 @@ fxc CompositorD3D11.fx -EYCbCrShaderMask -Tps_4_0_level_9_3 -nologo -Fh$tempfile cat $tempfile >> CompositorD3D11Shaders.h fxc CompositorD3D11.fx -EComponentAlphaShaderMask -Tps_4_0_level_9_3 -nologo -Fh$tempfile -VnComponentAlphaShaderMask cat $tempfile >> CompositorD3D11Shaders.h +rm $tempfile diff --git a/gfx/layers/d3d9/LayerManagerD3D9Shaders.h b/gfx/layers/d3d9/LayerManagerD3D9Shaders.h index dcea362d45d7..88f50930fa12 100644 --- a/gfx/layers/d3d9/LayerManagerD3D9Shaders.h +++ b/gfx/layers/d3d9/LayerManagerD3D9Shaders.h @@ -1,10 +1,6 @@ #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ELayerQuadVS -nologo -FhtmpShaderHeader -// -VnLayerQuadVS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -100,10 +96,10 @@ const BYTE LayerQuadVS[] = 41, 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, - 105, 108, 101, 114, 32, 57, - 46, 50, 57, 46, 57, 53, - 50, 46, 51, 49, 49, 49, - 0, 171, 81, 0, 0, 5, + 105, 108, 101, 114, 32, 54, + 46, 51, 46, 57, 54, 48, + 48, 46, 49, 54, 51, 56, + 52, 0, 81, 0, 0, 5, 11, 0, 15, 160, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -159,11 +155,7 @@ const BYTE LayerQuadVS[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ERGBAShader -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnRGBAShaderPS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -192,7 +184,7 @@ const BYTE LayerQuadVS[] = const BYTE RGBAShaderPS[] = { 0, 2, 255, 255, 254, 255, - 45, 0, 67, 84, 65, 66, + 46, 0, 67, 84, 65, 66, 28, 0, 0, 0, 127, 0, 0, 0, 0, 2, 255, 255, 2, 0, 0, 0, 28, 0, @@ -220,29 +212,25 @@ const BYTE RGBAShaderPS[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, - 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, - 0, 0, 15, 128, 0, 0, - 228, 176, 0, 8, 228, 160, - 5, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 228, 128, - 0, 0, 0, 160, 1, 0, - 0, 2, 0, 8, 15, 128, - 0, 0, 228, 128, 255, 255, - 0, 0 + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 171, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 3, 176, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 66, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 176, + 0, 8, 228, 160, 5, 0, + 0, 3, 0, 0, 15, 128, + 0, 0, 228, 128, 0, 0, + 0, 160, 1, 0, 0, 2, + 0, 8, 15, 128, 0, 0, + 228, 128, 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -EComponentPass1Shader -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnComponentPass1ShaderPS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -270,17 +258,16 @@ const BYTE RGBAShaderPS[] = add r0.xyz, r0, -r1 add r0.xyz, r0, c1.x mul r0.xyz, r0, c0.x - mov r1.xyz, r0 - mov r1.w, r0.y - mov oC0, r1 + mov r0.w, r0.y + mov oC0, r0 -// approximately 8 instruction slots used (2 texture, 6 arithmetic) +// approximately 7 instruction slots used (2 texture, 5 arithmetic) #endif const BYTE ComponentPass1ShaderPS[] = { 0, 2, 255, 255, 254, 255, - 57, 0, 67, 84, 65, 66, + 58, 0, 67, 84, 65, 66, 28, 0, 0, 0, 175, 0, 0, 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, @@ -316,47 +303,41 @@ const BYTE ComponentPass1ShaderPS[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 81, 0, 0, 5, - 1, 0, 15, 160, 0, 0, - 128, 63, 0, 0, 0, 0, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 171, + 81, 0, 0, 5, 1, 0, + 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, - 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, - 15, 160, 31, 0, 0, 2, - 0, 0, 0, 144, 1, 8, - 15, 160, 66, 0, 0, 3, - 0, 0, 15, 128, 0, 0, - 228, 176, 0, 8, 228, 160, - 66, 0, 0, 3, 1, 0, + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 3, 176, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 31, 0, 0, 2, 0, 0, + 0, 144, 1, 8, 15, 160, + 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, - 1, 8, 228, 160, 2, 0, - 0, 3, 0, 0, 7, 128, - 0, 0, 228, 128, 1, 0, - 228, 129, 2, 0, 0, 3, + 0, 8, 228, 160, 66, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 228, 176, 1, 8, + 228, 160, 2, 0, 0, 3, 0, 0, 7, 128, 0, 0, - 228, 128, 1, 0, 0, 160, - 5, 0, 0, 3, 0, 0, + 228, 128, 1, 0, 228, 129, + 2, 0, 0, 3, 0, 0, 7, 128, 0, 0, 228, 128, - 0, 0, 0, 160, 1, 0, - 0, 2, 1, 0, 7, 128, - 0, 0, 228, 128, 1, 0, - 0, 2, 1, 0, 8, 128, - 0, 0, 85, 128, 1, 0, - 0, 2, 0, 8, 15, 128, - 1, 0, 228, 128, 255, 255, - 0, 0 + 1, 0, 0, 160, 5, 0, + 0, 3, 0, 0, 7, 128, + 0, 0, 228, 128, 0, 0, + 0, 160, 1, 0, 0, 2, + 0, 0, 8, 128, 0, 0, + 85, 128, 1, 0, 0, 2, + 0, 8, 15, 128, 0, 0, + 228, 128, 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -EComponentPass2Shader -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnComponentPass2ShaderPS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -392,7 +373,7 @@ const BYTE ComponentPass1ShaderPS[] = const BYTE ComponentPass2ShaderPS[] = { 0, 2, 255, 255, 254, 255, - 57, 0, 67, 84, 65, 66, + 58, 0, 67, 84, 65, 66, 28, 0, 0, 0, 175, 0, 0, 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, @@ -428,43 +409,39 @@ const BYTE ComponentPass2ShaderPS[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 81, 0, 0, 5, - 1, 0, 15, 160, 0, 0, - 128, 63, 0, 0, 0, 0, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 171, + 81, 0, 0, 5, 1, 0, + 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, - 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, - 15, 160, 31, 0, 0, 2, - 0, 0, 0, 144, 1, 8, - 15, 160, 66, 0, 0, 3, - 0, 0, 15, 128, 0, 0, - 228, 176, 1, 8, 228, 160, - 66, 0, 0, 3, 1, 0, + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 3, 176, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 31, 0, 0, 2, 0, 0, + 0, 144, 1, 8, 15, 160, + 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 176, - 0, 8, 228, 160, 2, 0, - 0, 3, 0, 0, 1, 128, - 0, 0, 85, 129, 1, 0, - 85, 128, 2, 0, 0, 3, - 1, 0, 8, 128, 0, 0, - 0, 128, 1, 0, 0, 160, - 5, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 228, 128, - 0, 0, 0, 160, 1, 0, - 0, 2, 0, 8, 15, 128, - 0, 0, 228, 128, 255, 255, - 0, 0 + 1, 8, 228, 160, 66, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 228, 176, 0, 8, + 228, 160, 2, 0, 0, 3, + 0, 0, 1, 128, 0, 0, + 85, 129, 1, 0, 85, 128, + 2, 0, 0, 3, 1, 0, + 8, 128, 0, 0, 0, 128, + 1, 0, 0, 160, 5, 0, + 0, 3, 0, 0, 15, 128, + 1, 0, 228, 128, 0, 0, + 0, 160, 1, 0, 0, 2, + 0, 8, 15, 128, 0, 0, + 228, 128, 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ERGBShader -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnRGBShaderPS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -495,7 +472,7 @@ const BYTE ComponentPass2ShaderPS[] = const BYTE RGBShaderPS[] = { 0, 2, 255, 255, 254, 255, - 45, 0, 67, 84, 65, 66, + 46, 0, 67, 84, 65, 66, 28, 0, 0, 0, 127, 0, 0, 0, 0, 2, 255, 255, 2, 0, 0, 0, 28, 0, @@ -523,35 +500,31 @@ const BYTE RGBShaderPS[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 81, 0, 0, 5, - 1, 0, 15, 160, 0, 0, - 128, 63, 0, 0, 0, 0, + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 171, + 81, 0, 0, 5, 1, 0, + 15, 160, 0, 0, 128, 63, 0, 0, 0, 0, 0, 0, - 0, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 0, 0, - 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, - 0, 0, 15, 128, 0, 0, - 228, 176, 0, 8, 228, 160, - 1, 0, 0, 2, 0, 0, - 8, 128, 1, 0, 0, 160, - 5, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 228, 128, - 0, 0, 0, 160, 1, 0, - 0, 2, 0, 8, 15, 128, - 0, 0, 228, 128, 255, 255, - 0, 0 + 0, 0, 0, 0, 0, 0, + 31, 0, 0, 2, 0, 0, + 0, 128, 0, 0, 3, 176, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 66, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 228, 176, + 0, 8, 228, 160, 1, 0, + 0, 2, 0, 0, 8, 128, + 1, 0, 0, 160, 5, 0, + 0, 3, 0, 0, 15, 128, + 0, 0, 228, 128, 0, 0, + 0, 160, 1, 0, 0, 2, + 0, 8, 15, 128, 0, 0, + 228, 128, 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -EYCbCrShader -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnYCbCrShaderPS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -599,7 +572,7 @@ const BYTE RGBShaderPS[] = const BYTE YCbCrShaderPS[] = { 0, 2, 255, 255, 254, 255, - 68, 0, 67, 84, 65, 66, + 69, 0, 67, 84, 65, 66, 28, 0, 0, 0, 219, 0, 0, 0, 0, 2, 255, 255, 4, 0, 0, 0, 28, 0, @@ -642,72 +615,69 @@ const BYTE YCbCrShaderPS[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 81, 0, - 0, 5, 1, 0, 15, 160, - 0, 0, 0, 191, 0, 0, - 128, 189, 244, 253, 148, 63, - 186, 73, 204, 63, 81, 0, - 0, 5, 2, 0, 15, 160, - 197, 32, 80, 63, 39, 49, - 200, 62, 233, 38, 1, 64, - 0, 0, 128, 63, 31, 0, - 0, 2, 0, 0, 0, 128, - 0, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, - 0, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 1, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 2, 8, 15, 160, 66, 0, - 0, 3, 0, 0, 15, 128, - 0, 0, 228, 176, 2, 8, - 228, 160, 66, 0, 0, 3, - 1, 0, 15, 128, 0, 0, - 228, 176, 0, 8, 228, 160, - 66, 0, 0, 3, 2, 0, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, + 171, 171, 81, 0, 0, 5, + 1, 0, 15, 160, 0, 0, + 0, 191, 0, 0, 128, 189, + 244, 253, 148, 63, 186, 73, + 204, 63, 81, 0, 0, 5, + 2, 0, 15, 160, 197, 32, + 80, 63, 39, 49, 200, 62, + 233, 38, 1, 64, 0, 0, + 128, 63, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 2, 8, + 15, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 176, 2, 8, 228, 160, + 66, 0, 0, 3, 1, 0, 15, 128, 0, 0, 228, 176, - 1, 8, 228, 160, 2, 0, - 0, 3, 0, 0, 1, 128, - 0, 0, 255, 128, 1, 0, - 0, 160, 2, 0, 0, 3, - 0, 0, 2, 128, 1, 0, - 255, 128, 1, 0, 85, 160, - 5, 0, 0, 3, 0, 0, - 2, 128, 0, 0, 85, 128, - 1, 0, 170, 160, 4, 0, - 0, 4, 0, 0, 4, 128, - 0, 0, 0, 128, 2, 0, - 0, 161, 0, 0, 85, 128, - 4, 0, 0, 4, 1, 0, - 1, 128, 0, 0, 0, 128, - 1, 0, 255, 160, 0, 0, - 85, 128, 2, 0, 0, 3, - 0, 0, 1, 128, 2, 0, + 0, 8, 228, 160, 66, 0, + 0, 3, 2, 0, 15, 128, + 0, 0, 228, 176, 1, 8, + 228, 160, 2, 0, 0, 3, + 0, 0, 1, 128, 0, 0, 255, 128, 1, 0, 0, 160, - 4, 0, 0, 4, 1, 0, - 2, 128, 0, 0, 0, 128, - 2, 0, 85, 161, 0, 0, - 170, 128, 4, 0, 0, 4, - 1, 0, 4, 128, 0, 0, - 0, 128, 2, 0, 170, 160, + 2, 0, 0, 3, 0, 0, + 2, 128, 1, 0, 255, 128, + 1, 0, 85, 160, 5, 0, + 0, 3, 0, 0, 2, 128, 0, 0, 85, 128, 1, 0, - 0, 2, 1, 0, 8, 128, - 2, 0, 255, 160, 5, 0, - 0, 3, 0, 0, 15, 128, - 1, 0, 228, 128, 0, 0, - 0, 160, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, - 228, 128, 255, 255, 0, 0 + 170, 160, 4, 0, 0, 4, + 0, 0, 4, 128, 0, 0, + 0, 128, 2, 0, 0, 161, + 0, 0, 85, 128, 4, 0, + 0, 4, 1, 0, 1, 128, + 0, 0, 0, 128, 1, 0, + 255, 160, 0, 0, 85, 128, + 2, 0, 0, 3, 0, 0, + 1, 128, 2, 0, 255, 128, + 1, 0, 0, 160, 4, 0, + 0, 4, 1, 0, 2, 128, + 0, 0, 0, 128, 2, 0, + 85, 161, 0, 0, 170, 128, + 4, 0, 0, 4, 1, 0, + 4, 128, 0, 0, 0, 128, + 2, 0, 170, 160, 0, 0, + 85, 128, 1, 0, 0, 2, + 1, 0, 8, 128, 2, 0, + 255, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 1, 0, + 228, 128, 0, 0, 0, 160, + 1, 0, 0, 2, 0, 8, + 15, 128, 0, 0, 228, 128, + 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ESolidColorShader -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnSolidColorShaderPS -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -730,7 +700,7 @@ const BYTE YCbCrShaderPS[] = const BYTE SolidColorShaderPS[] = { 0, 2, 255, 255, 254, 255, - 34, 0, 67, 84, 65, 66, + 35, 0, 67, 84, 65, 66, 28, 0, 0, 0, 83, 0, 0, 0, 0, 2, 255, 255, 1, 0, 0, 0, 28, 0, @@ -750,20 +720,17 @@ const BYTE SolidColorShaderPS[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 1, 0, 0, 2, 0, 8, - 15, 128, 0, 0, 228, 160, - 255, 255, 0, 0 + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 171, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 160, 255, 255, + 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ELayerQuadVSMask -nologo -// -FhtmpShaderHeader -VnLayerQuadVSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -872,9 +839,9 @@ const BYTE LayerQuadVSMask[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 81, 0, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 12, 0, 15, 160, 0, 0, 0, 191, 0, 0, 0, 0, 0, 0, 0, 0, @@ -940,11 +907,7 @@ const BYTE LayerQuadVSMask[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ELayerQuadVSMask3D -nologo -// -FhtmpShaderHeader -VnLayerQuadVSMask3D -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1055,9 +1018,9 @@ const BYTE LayerQuadVSMask3D[] = 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, - 32, 57, 46, 50, 57, 46, - 57, 53, 50, 46, 51, 49, - 49, 49, 0, 171, 81, 0, + 32, 54, 46, 51, 46, 57, + 54, 48, 48, 46, 49, 54, + 51, 56, 52, 0, 81, 0, 0, 5, 12, 0, 15, 160, 0, 0, 0, 191, 0, 0, 128, 63, 0, 0, 0, 0, @@ -1128,11 +1091,7 @@ const BYTE LayerQuadVSMask3D[] = }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ERGBAShaderMask -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnRGBAShaderPSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1167,7 +1126,7 @@ const BYTE LayerQuadVSMask3D[] = const BYTE RGBAShaderPSMask[] = { 0, 2, 255, 255, 254, 255, - 56, 0, 67, 84, 65, 66, + 57, 0, 67, 84, 65, 66, 28, 0, 0, 0, 171, 0, 0, 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, @@ -1202,38 +1161,35 @@ const BYTE RGBAShaderPSMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 31, 0, - 0, 2, 0, 0, 0, 128, - 0, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, - 0, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 1, 8, 15, 160, 66, 0, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, + 171, 171, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 128, 1, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 176, 0, 8, 228, 160, + 66, 0, 0, 3, 1, 0, + 15, 128, 1, 0, 228, 176, + 1, 8, 228, 160, 5, 0, 0, 3, 0, 0, 15, 128, - 0, 0, 228, 176, 0, 8, - 228, 160, 66, 0, 0, 3, - 1, 0, 15, 128, 1, 0, - 228, 176, 1, 8, 228, 160, - 5, 0, 0, 3, 0, 0, + 0, 0, 228, 128, 0, 0, + 0, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 1, 0, + 255, 128, 0, 0, 228, 128, + 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, - 0, 0, 0, 160, 5, 0, - 0, 3, 0, 0, 15, 128, - 1, 0, 255, 128, 0, 0, - 228, 128, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, - 228, 128, 255, 255, 0, 0 + 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ERGBAShaderMask3D -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnRGBAShaderPSMask3D -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1256,12 +1212,12 @@ const BYTE RGBAShaderPSMask[] = dcl t1.xyz dcl_2d s0 dcl_2d s1 - texld r0, t0, s0 - rcp r1.w, t1.z - mul r1.xy, r1.w, t1 - texld r1, r1, s1 - mul r0, r0, c0.x - mul r0, r1.w, r0 + rcp r0.w, t1.z + mul r0.xy, r0.w, t1 + texld r0, r0, s1 + texld r1, t0, s0 + mul r1, r1, c0.x + mul r0, r0.w, r1 mov oC0, r0 // approximately 7 instruction slots used (2 texture, 5 arithmetic) @@ -1270,7 +1226,7 @@ const BYTE RGBAShaderPSMask[] = const BYTE RGBAShaderPSMask3D[] = { 0, 2, 255, 255, 254, 255, - 56, 0, 67, 84, 65, 66, + 57, 0, 67, 84, 65, 66, 28, 0, 0, 0, 171, 0, 0, 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, @@ -1305,43 +1261,40 @@ const BYTE RGBAShaderPSMask3D[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 31, 0, - 0, 2, 0, 0, 0, 128, - 0, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 128, - 1, 0, 7, 176, 31, 0, - 0, 2, 0, 0, 0, 144, - 0, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 1, 8, 15, 160, 66, 0, - 0, 3, 0, 0, 15, 128, - 0, 0, 228, 176, 0, 8, - 228, 160, 6, 0, 0, 2, - 1, 0, 8, 128, 1, 0, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, + 171, 171, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 128, 1, 0, + 7, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 6, 0, 0, 2, + 0, 0, 8, 128, 1, 0, 170, 176, 5, 0, 0, 3, - 1, 0, 3, 128, 1, 0, + 0, 0, 3, 128, 0, 0, 255, 128, 1, 0, 228, 176, - 66, 0, 0, 3, 1, 0, - 15, 128, 1, 0, 228, 128, - 1, 8, 228, 160, 5, 0, - 0, 3, 0, 0, 15, 128, - 0, 0, 228, 128, 0, 0, - 0, 160, 5, 0, 0, 3, - 0, 0, 15, 128, 1, 0, - 255, 128, 0, 0, 228, 128, - 1, 0, 0, 2, 0, 8, + 66, 0, 0, 3, 0, 0, 15, 128, 0, 0, 228, 128, - 255, 255, 0, 0 + 1, 8, 228, 160, 66, 0, + 0, 3, 1, 0, 15, 128, + 0, 0, 228, 176, 0, 8, + 228, 160, 5, 0, 0, 3, + 1, 0, 15, 128, 1, 0, + 228, 128, 0, 0, 0, 160, + 5, 0, 0, 3, 0, 0, + 15, 128, 0, 0, 255, 128, + 1, 0, 228, 128, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 128, 255, 255, + 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -EComponentPass1ShaderMask -nologo -// -Tps_2_0 -FhtmpShaderHeader -VnComponentPass1ShaderPSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1375,17 +1328,16 @@ const BYTE RGBAShaderPSMask3D[] = add r0.xyz, r0, c1.x mul r0.xyz, r0, c0.x mul r0.xyz, r2.w, r0 - mov r1.xyz, r0 - mov r1.w, r0.y - mov oC0, r1 + mov r0.w, r0.y + mov oC0, r0 -// approximately 10 instruction slots used (3 texture, 7 arithmetic) +// approximately 9 instruction slots used (3 texture, 6 arithmetic) #endif const BYTE ComponentPass1ShaderPSMask[] = { 0, 2, 255, 255, 254, 255, - 68, 0, 67, 84, 65, 66, + 69, 0, 67, 84, 65, 66, 28, 0, 0, 0, 219, 0, 0, 0, 0, 2, 255, 255, 4, 0, 0, 0, 28, 0, @@ -1428,56 +1380,51 @@ const BYTE ComponentPass1ShaderPSMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 81, 0, - 0, 5, 1, 0, 15, 160, - 0, 0, 128, 63, 0, 0, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, + 171, 171, 81, 0, 0, 5, + 1, 0, 15, 160, 0, 0, + 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, - 0, 2, 0, 0, 0, 128, - 0, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, - 0, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 1, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 2, 8, 15, 160, 66, 0, - 0, 3, 0, 0, 15, 128, - 0, 0, 228, 176, 0, 8, - 228, 160, 66, 0, 0, 3, - 1, 0, 15, 128, 0, 0, - 228, 176, 1, 8, 228, 160, - 66, 0, 0, 3, 2, 0, - 15, 128, 1, 0, 228, 176, - 2, 8, 228, 160, 2, 0, - 0, 3, 0, 0, 7, 128, - 0, 0, 228, 128, 1, 0, - 228, 129, 2, 0, 0, 3, + 0, 0, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 128, 1, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 2, 8, + 15, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 176, 0, 8, 228, 160, + 66, 0, 0, 3, 1, 0, + 15, 128, 0, 0, 228, 176, + 1, 8, 228, 160, 66, 0, + 0, 3, 2, 0, 15, 128, + 1, 0, 228, 176, 2, 8, + 228, 160, 2, 0, 0, 3, 0, 0, 7, 128, 0, 0, - 228, 128, 1, 0, 0, 160, - 5, 0, 0, 3, 0, 0, + 228, 128, 1, 0, 228, 129, + 2, 0, 0, 3, 0, 0, 7, 128, 0, 0, 228, 128, - 0, 0, 0, 160, 5, 0, + 1, 0, 0, 160, 5, 0, 0, 3, 0, 0, 7, 128, - 2, 0, 255, 128, 0, 0, - 228, 128, 1, 0, 0, 2, - 1, 0, 7, 128, 0, 0, - 228, 128, 1, 0, 0, 2, - 1, 0, 8, 128, 0, 0, - 85, 128, 1, 0, 0, 2, - 0, 8, 15, 128, 1, 0, - 228, 128, 255, 255, 0, 0 + 0, 0, 228, 128, 0, 0, + 0, 160, 5, 0, 0, 3, + 0, 0, 7, 128, 2, 0, + 255, 128, 0, 0, 228, 128, + 1, 0, 0, 2, 0, 0, + 8, 128, 0, 0, 85, 128, + 1, 0, 0, 2, 0, 8, + 15, 128, 0, 0, 228, 128, + 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -EComponentPass2ShaderMask -nologo -// -Tps_2_0 -FhtmpShaderHeader -VnComponentPass2ShaderPSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1519,7 +1466,7 @@ const BYTE ComponentPass1ShaderPSMask[] = const BYTE ComponentPass2ShaderPSMask[] = { 0, 2, 255, 255, 254, 255, - 68, 0, 67, 84, 65, 66, + 69, 0, 67, 84, 65, 66, 28, 0, 0, 0, 219, 0, 0, 0, 0, 2, 255, 255, 4, 0, 0, 0, 28, 0, @@ -1562,52 +1509,49 @@ const BYTE ComponentPass2ShaderPSMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 81, 0, - 0, 5, 1, 0, 15, 160, - 0, 0, 128, 63, 0, 0, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, + 171, 171, 81, 0, 0, 5, + 1, 0, 15, 160, 0, 0, + 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, - 0, 2, 0, 0, 0, 128, - 0, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, - 0, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 1, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 2, 8, 15, 160, 66, 0, + 0, 0, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 128, 1, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 2, 8, + 15, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 176, 1, 8, 228, 160, + 66, 0, 0, 3, 1, 0, + 15, 128, 0, 0, 228, 176, + 0, 8, 228, 160, 66, 0, + 0, 3, 2, 0, 15, 128, + 1, 0, 228, 176, 2, 8, + 228, 160, 2, 0, 0, 3, + 0, 0, 1, 128, 0, 0, + 85, 129, 1, 0, 85, 128, + 2, 0, 0, 3, 1, 0, + 8, 128, 0, 0, 0, 128, + 1, 0, 0, 160, 5, 0, 0, 3, 0, 0, 15, 128, - 0, 0, 228, 176, 1, 8, - 228, 160, 66, 0, 0, 3, - 1, 0, 15, 128, 0, 0, - 228, 176, 0, 8, 228, 160, - 66, 0, 0, 3, 2, 0, - 15, 128, 1, 0, 228, 176, - 2, 8, 228, 160, 2, 0, - 0, 3, 0, 0, 1, 128, - 0, 0, 85, 129, 1, 0, - 85, 128, 2, 0, 0, 3, - 1, 0, 8, 128, 0, 0, - 0, 128, 1, 0, 0, 160, - 5, 0, 0, 3, 0, 0, - 15, 128, 1, 0, 228, 128, - 0, 0, 0, 160, 5, 0, - 0, 3, 0, 0, 15, 128, - 2, 0, 255, 128, 0, 0, - 228, 128, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, - 228, 128, 255, 255, 0, 0 + 1, 0, 228, 128, 0, 0, + 0, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 2, 0, + 255, 128, 0, 0, 228, 128, + 1, 0, 0, 2, 0, 8, + 15, 128, 0, 0, 228, 128, + 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ERGBShaderMask -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnRGBShaderPSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1644,7 +1588,7 @@ const BYTE ComponentPass2ShaderPSMask[] = const BYTE RGBShaderPSMask[] = { 0, 2, 255, 255, 254, 255, - 56, 0, 67, 84, 65, 66, + 57, 0, 67, 84, 65, 66, 28, 0, 0, 0, 171, 0, 0, 0, 0, 2, 255, 255, 3, 0, 0, 0, 28, 0, @@ -1679,44 +1623,41 @@ const BYTE RGBShaderPSMask[] = 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, - 114, 32, 57, 46, 50, 57, - 46, 57, 53, 50, 46, 51, - 49, 49, 49, 0, 81, 0, - 0, 5, 1, 0, 15, 160, - 0, 0, 128, 63, 0, 0, + 114, 32, 54, 46, 51, 46, + 57, 54, 48, 48, 46, 49, + 54, 51, 56, 52, 0, 171, + 171, 171, 81, 0, 0, 5, + 1, 0, 15, 160, 0, 0, + 128, 63, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 31, 0, - 0, 2, 0, 0, 0, 128, - 0, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 128, - 1, 0, 3, 176, 31, 0, - 0, 2, 0, 0, 0, 144, - 0, 8, 15, 160, 31, 0, - 0, 2, 0, 0, 0, 144, - 1, 8, 15, 160, 66, 0, + 0, 0, 31, 0, 0, 2, + 0, 0, 0, 128, 0, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 128, 1, 0, + 3, 176, 31, 0, 0, 2, + 0, 0, 0, 144, 0, 8, + 15, 160, 31, 0, 0, 2, + 0, 0, 0, 144, 1, 8, + 15, 160, 66, 0, 0, 3, + 0, 0, 15, 128, 0, 0, + 228, 176, 0, 8, 228, 160, + 66, 0, 0, 3, 1, 0, + 15, 128, 1, 0, 228, 176, + 1, 8, 228, 160, 1, 0, + 0, 2, 0, 0, 8, 128, + 1, 0, 0, 160, 5, 0, 0, 3, 0, 0, 15, 128, - 0, 0, 228, 176, 0, 8, - 228, 160, 66, 0, 0, 3, - 1, 0, 15, 128, 1, 0, - 228, 176, 1, 8, 228, 160, - 1, 0, 0, 2, 0, 0, - 8, 128, 1, 0, 0, 160, - 5, 0, 0, 3, 0, 0, + 0, 0, 228, 128, 0, 0, + 0, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 1, 0, + 255, 128, 0, 0, 228, 128, + 1, 0, 0, 2, 0, 8, 15, 128, 0, 0, 228, 128, - 0, 0, 0, 160, 5, 0, - 0, 3, 0, 0, 15, 128, - 1, 0, 255, 128, 0, 0, - 228, 128, 1, 0, 0, 2, - 0, 8, 15, 128, 0, 0, - 228, 128, 255, 255, 0, 0 + 255, 255, 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -EYCbCrShaderMask -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnYCbCrShaderPSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1739,8 +1680,8 @@ const BYTE RGBShaderPSMask[] = // ps_2_0 - def c1, -0.5, -0.0625, 1.16400003, 1.59599996 - def c2, 0.813000023, 0.391000003, 2.01799989, 1 + def c1, -0.50195998, -0.0627499968, 1.16437995, 1.59603 + def c2, 0.812969983, 0.391759992, 2.01723003, 1 dcl t0.xy dcl t1.xy dcl_2d s0 @@ -1770,7 +1711,7 @@ const BYTE RGBShaderPSMask[] = const BYTE YCbCrShaderPSMask[] = { 0, 2, 255, 255, 254, 255, - 79, 0, 67, 84, 65, 66, + 80, 0, 67, 84, 65, 66, 28, 0, 0, 0, 7, 1, 0, 0, 0, 2, 255, 255, 5, 0, 0, 0, 28, 0, @@ -1820,82 +1761,79 @@ const BYTE YCbCrShaderPSMask[] = 32, 72, 76, 83, 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, - 108, 101, 114, 32, 57, 46, - 50, 57, 46, 57, 53, 50, - 46, 51, 49, 49, 49, 0, - 81, 0, 0, 5, 1, 0, - 15, 160, 0, 0, 0, 191, - 0, 0, 128, 189, 244, 253, - 148, 63, 186, 73, 204, 63, - 81, 0, 0, 5, 2, 0, - 15, 160, 197, 32, 80, 63, - 39, 49, 200, 62, 233, 38, - 1, 64, 0, 0, 128, 63, - 31, 0, 0, 2, 0, 0, - 0, 128, 0, 0, 3, 176, - 31, 0, 0, 2, 0, 0, - 0, 128, 1, 0, 3, 176, - 31, 0, 0, 2, 0, 0, - 0, 144, 0, 8, 15, 160, - 31, 0, 0, 2, 0, 0, - 0, 144, 1, 8, 15, 160, - 31, 0, 0, 2, 0, 0, - 0, 144, 2, 8, 15, 160, - 31, 0, 0, 2, 0, 0, - 0, 144, 3, 8, 15, 160, - 66, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 228, 176, - 2, 8, 228, 160, 66, 0, - 0, 3, 1, 0, 15, 128, - 0, 0, 228, 176, 0, 8, - 228, 160, 66, 0, 0, 3, - 2, 0, 15, 128, 0, 0, - 228, 176, 1, 8, 228, 160, - 66, 0, 0, 3, 3, 0, - 15, 128, 1, 0, 228, 176, - 3, 8, 228, 160, 2, 0, - 0, 3, 0, 0, 1, 128, - 0, 0, 255, 128, 1, 0, - 0, 160, 2, 0, 0, 3, - 0, 0, 2, 128, 1, 0, - 255, 128, 1, 0, 85, 160, - 5, 0, 0, 3, 0, 0, - 2, 128, 0, 0, 85, 128, - 1, 0, 170, 160, 4, 0, - 0, 4, 0, 0, 4, 128, - 0, 0, 0, 128, 2, 0, - 0, 161, 0, 0, 85, 128, - 4, 0, 0, 4, 1, 0, - 1, 128, 0, 0, 0, 128, - 1, 0, 255, 160, 0, 0, - 85, 128, 2, 0, 0, 3, - 0, 0, 1, 128, 2, 0, - 255, 128, 1, 0, 0, 160, - 4, 0, 0, 4, 1, 0, - 2, 128, 0, 0, 0, 128, - 2, 0, 85, 161, 0, 0, - 170, 128, 4, 0, 0, 4, - 1, 0, 4, 128, 0, 0, - 0, 128, 2, 0, 170, 160, - 0, 0, 85, 128, 1, 0, - 0, 2, 1, 0, 8, 128, - 2, 0, 255, 160, 5, 0, + 108, 101, 114, 32, 54, 46, + 51, 46, 57, 54, 48, 48, + 46, 49, 54, 51, 56, 52, + 0, 171, 171, 171, 81, 0, + 0, 5, 1, 0, 15, 160, + 115, 128, 0, 191, 18, 131, + 128, 189, 103, 10, 149, 63, + 182, 74, 204, 63, 81, 0, + 0, 5, 2, 0, 15, 160, + 205, 30, 80, 63, 196, 148, + 200, 62, 76, 26, 1, 64, + 0, 0, 128, 63, 31, 0, + 0, 2, 0, 0, 0, 128, + 0, 0, 3, 176, 31, 0, + 0, 2, 0, 0, 0, 128, + 1, 0, 3, 176, 31, 0, + 0, 2, 0, 0, 0, 144, + 0, 8, 15, 160, 31, 0, + 0, 2, 0, 0, 0, 144, + 1, 8, 15, 160, 31, 0, + 0, 2, 0, 0, 0, 144, + 2, 8, 15, 160, 31, 0, + 0, 2, 0, 0, 0, 144, + 3, 8, 15, 160, 66, 0, 0, 3, 0, 0, 15, 128, - 1, 0, 228, 128, 0, 0, - 0, 160, 5, 0, 0, 3, - 0, 0, 15, 128, 3, 0, - 255, 128, 0, 0, 228, 128, - 1, 0, 0, 2, 0, 8, - 15, 128, 0, 0, 228, 128, - 255, 255, 0, 0 + 0, 0, 228, 176, 2, 8, + 228, 160, 66, 0, 0, 3, + 1, 0, 15, 128, 0, 0, + 228, 176, 0, 8, 228, 160, + 66, 0, 0, 3, 2, 0, + 15, 128, 0, 0, 228, 176, + 1, 8, 228, 160, 66, 0, + 0, 3, 3, 0, 15, 128, + 1, 0, 228, 176, 3, 8, + 228, 160, 2, 0, 0, 3, + 0, 0, 1, 128, 0, 0, + 255, 128, 1, 0, 0, 160, + 2, 0, 0, 3, 0, 0, + 2, 128, 1, 0, 255, 128, + 1, 0, 85, 160, 5, 0, + 0, 3, 0, 0, 2, 128, + 0, 0, 85, 128, 1, 0, + 170, 160, 4, 0, 0, 4, + 0, 0, 4, 128, 0, 0, + 0, 128, 2, 0, 0, 161, + 0, 0, 85, 128, 4, 0, + 0, 4, 1, 0, 1, 128, + 0, 0, 0, 128, 1, 0, + 255, 160, 0, 0, 85, 128, + 2, 0, 0, 3, 0, 0, + 1, 128, 2, 0, 255, 128, + 1, 0, 0, 160, 4, 0, + 0, 4, 1, 0, 2, 128, + 0, 0, 0, 128, 2, 0, + 85, 161, 0, 0, 170, 128, + 4, 0, 0, 4, 1, 0, + 4, 128, 0, 0, 0, 128, + 2, 0, 170, 160, 0, 0, + 85, 128, 1, 0, 0, 2, + 1, 0, 8, 128, 2, 0, + 255, 160, 5, 0, 0, 3, + 0, 0, 15, 128, 1, 0, + 228, 128, 0, 0, 0, 160, + 5, 0, 0, 3, 0, 0, + 15, 128, 3, 0, 255, 128, + 0, 0, 228, 128, 1, 0, + 0, 2, 0, 8, 15, 128, + 0, 0, 228, 128, 255, 255, + 0, 0 }; #if 0 // -// Generated by Microsoft (R) HLSL Shader Compiler 9.29.952.3111 -// -// fxc LayerManagerD3D9Shaders.hlsl -ESolidColorShaderMask -nologo -Tps_2_0 -// -FhtmpShaderHeader -VnSolidColorShaderPSMask -// +// Generated by Microsoft (R) HLSL Shader Compiler 6.3.9600.16384 // // Parameters: // @@ -1924,7 +1862,7 @@ const BYTE YCbCrShaderPSMask[] = const BYTE SolidColorShaderPSMask[] = { 0, 2, 255, 255, 254, 255, - 45, 0, 67, 84, 65, 66, + 46, 0, 67, 84, 65, 66, 28, 0, 0, 0, 127, 0, 0, 0, 0, 2, 255, 255, 2, 0, 0, 0, 28, 0, @@ -1952,19 +1890,19 @@ const BYTE SolidColorShaderPSMask[] = 76, 32, 83, 104, 97, 100, 101, 114, 32, 67, 111, 109, 112, 105, 108, 101, 114, 32, - 57, 46, 50, 57, 46, 57, - 53, 50, 46, 51, 49, 49, - 49, 0, 31, 0, 0, 2, - 0, 0, 0, 128, 1, 0, - 3, 176, 31, 0, 0, 2, - 0, 0, 0, 144, 0, 8, - 15, 160, 66, 0, 0, 3, - 0, 0, 15, 128, 1, 0, - 228, 176, 0, 8, 228, 160, - 5, 0, 0, 3, 0, 0, - 15, 128, 0, 0, 255, 128, - 0, 0, 228, 160, 1, 0, - 0, 2, 0, 8, 15, 128, - 0, 0, 228, 128, 255, 255, - 0, 0 + 54, 46, 51, 46, 57, 54, + 48, 48, 46, 49, 54, 51, + 56, 52, 0, 171, 171, 171, + 31, 0, 0, 2, 0, 0, + 0, 128, 1, 0, 3, 176, + 31, 0, 0, 2, 0, 0, + 0, 144, 0, 8, 15, 160, + 66, 0, 0, 3, 0, 0, + 15, 128, 1, 0, 228, 176, + 0, 8, 228, 160, 5, 0, + 0, 3, 0, 0, 15, 128, + 0, 0, 255, 128, 0, 0, + 228, 160, 1, 0, 0, 2, + 0, 8, 15, 128, 0, 0, + 228, 128, 255, 255, 0, 0 }; diff --git a/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl b/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl index 710edb796022..211f6fbff117 100644 --- a/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl +++ b/gfx/layers/d3d9/LayerManagerD3D9Shaders.hlsl @@ -13,7 +13,7 @@ sampler s2DWhite; sampler s2DY; sampler s2DCb; sampler s2DCr; -sampler s2DMask; +sampler s2DMask; float fLayerOpacity; @@ -44,7 +44,7 @@ VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex) { VS_OUTPUT outp; outp.vPosition = aVertex.vPosition; - + // We use 4 component floats to uniquely describe a rectangle, by the structure // of x, y, width, height. This allows us to easily generate the 4 corners // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the @@ -55,16 +55,16 @@ VS_OUTPUT LayerQuadVS(const VS_INPUT aVertex) float2 size = vLayerQuad.zw; outp.vPosition.x = position.x + outp.vPosition.x * size.x; outp.vPosition.y = position.y + outp.vPosition.y * size.y; - + outp.vPosition = mul(mLayerTransform, outp.vPosition); outp.vPosition.xyz /= outp.vPosition.w; outp.vPosition = outp.vPosition - vRenderTargetOffset; outp.vPosition.xyz *= outp.vPosition.w; - + // adjust our vertices to match d3d9's pixel coordinate system // which has pixel centers at integer locations outp.vPosition.xy -= 0.5; - + outp.vPosition = mul(mProjection, outp.vPosition); position = vTextureCoords.xy; @@ -79,7 +79,7 @@ VS_OUTPUT_MASK LayerQuadVSMask(const VS_INPUT aVertex) { VS_OUTPUT_MASK outp; float4 position = float4(0, 0, 0, 1); - + // We use 4 component floats to uniquely describe a rectangle, by the structure // of x, y, width, height. This allows us to easily generate the 4 corners // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the @@ -89,17 +89,17 @@ VS_OUTPUT_MASK LayerQuadVSMask(const VS_INPUT aVertex) float2 size = vLayerQuad.zw; position.x = vLayerQuad.x + aVertex.vPosition.x * size.x; position.y = vLayerQuad.y + aVertex.vPosition.y * size.y; - + position = mul(mLayerTransform, position); outp.vPosition.w = position.w; outp.vPosition.xyz = position.xyz / position.w; outp.vPosition = outp.vPosition - vRenderTargetOffset; outp.vPosition.xyz *= outp.vPosition.w; - + // adjust our vertices to match d3d9's pixel coordinate system // which has pixel centers at integer locations outp.vPosition.xy -= 0.5; - + outp.vPosition = mul(mProjection, outp.vPosition); // calculate the position on the mask texture @@ -117,7 +117,7 @@ VS_OUTPUT_MASK_3D LayerQuadVSMask3D(const VS_INPUT aVertex) { VS_OUTPUT_MASK_3D outp; float4 position = float4(0, 0, 0, 1); - + // We use 4 component floats to uniquely describe a rectangle, by the structure // of x, y, width, height. This allows us to easily generate the 4 corners // of any rectangle from the 4 corners of the 0,0-1,1 quad that we use as the @@ -127,17 +127,17 @@ VS_OUTPUT_MASK_3D LayerQuadVSMask3D(const VS_INPUT aVertex) float2 size = vLayerQuad.zw; position.x = vLayerQuad.x + aVertex.vPosition.x * size.x; position.y = vLayerQuad.y + aVertex.vPosition.y * size.y; - + position = mul(mLayerTransform, position); outp.vPosition.w = position.w; outp.vPosition.xyz = position.xyz / position.w; outp.vPosition = outp.vPosition - vRenderTargetOffset; outp.vPosition.xyz *= outp.vPosition.w; - + // adjust our vertices to match d3d9's pixel coordinate system // which has pixel centers at integer locations outp.vPosition.xy -= 0.5; - + outp.vPosition = mul(mProjection, outp.vPosition); // calculate the position on the mask texture @@ -197,7 +197,7 @@ float4 YCbCrShader(const VS_OUTPUT aVertex) : COLOR color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; color.b = yuv.g * 1.164 + yuv.b * 2.018; color.a = 1.0f; - + return color * fLayerOpacity; } @@ -250,20 +250,30 @@ float4 RGBShaderMask(const VS_OUTPUT_MASK aVertex) : COLOR return result * fLayerOpacity * mask; } +/* From Rec601: +[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16] +[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128] +[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128] + +For [0,1] instead of [0,255], and to 5 places: +[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275] +[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196] +[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196] +*/ float4 YCbCrShaderMask(const VS_OUTPUT_MASK aVertex) : COLOR { float4 yuv; float4 color; - yuv.r = tex2D(s2DCr, aVertex.vTexCoords).a - 0.5; - yuv.g = tex2D(s2DY, aVertex.vTexCoords).a - 0.0625; - yuv.b = tex2D(s2DCb, aVertex.vTexCoords).a - 0.5; + yuv.r = tex2D(s2DCr, aVertex.vTexCoords).a - 0.50196; + yuv.g = tex2D(s2DY, aVertex.vTexCoords).a - 0.06275; + yuv.b = tex2D(s2DCb, aVertex.vTexCoords).a - 0.50196; - color.r = yuv.g * 1.164 + yuv.r * 1.596; - color.g = yuv.g * 1.164 - 0.813 * yuv.r - 0.391 * yuv.b; - color.b = yuv.g * 1.164 + yuv.b * 2.018; + color.r = yuv.g * 1.16438 + yuv.r * 1.59603; + color.g = yuv.g * 1.16438 - 0.81297 * yuv.r - 0.39176 * yuv.b; + color.b = yuv.g * 1.16438 + yuv.b * 2.01723; color.a = 1.0f; - + float2 maskCoords = aVertex.vMaskCoords; float mask = tex2D(s2DMask, maskCoords).a; return color * fLayerOpacity * mask; diff --git a/gfx/layers/opengl/OGLShaderProgram.cpp b/gfx/layers/opengl/OGLShaderProgram.cpp index afb5d1f4c789..d15d9c703bf4 100644 --- a/gfx/layers/opengl/OGLShaderProgram.cpp +++ b/gfx/layers/opengl/OGLShaderProgram.cpp @@ -261,12 +261,23 @@ ProgramProfileOGL::GetProfileFor(ShaderConfigOGL aConfig) fs << " COLOR_PRECISION float y = texture2D(uYTexture, coord).r;" << endl; fs << " COLOR_PRECISION float cb = texture2D(uCbTexture, coord).r;" << endl; fs << " COLOR_PRECISION float cr = texture2D(uCrTexture, coord).r;" << endl; - fs << " y = (y - 0.0625) * 1.164;" << endl; - fs << " cb = cb - 0.5;" << endl; - fs << " cr = cr - 0.5;" << endl; - fs << " color.r = y + cr * 1.596;" << endl; - fs << " color.g = y - 0.813 * cr - 0.391 * cb;" << endl; - fs << " color.b = y + cb * 2.018;" << endl; + + /* From Rec601: +[R] [1.1643835616438356, 0.0, 1.5960267857142858] [ Y - 16] +[G] = [1.1643835616438358, -0.3917622900949137, -0.8129676472377708] x [Cb - 128] +[B] [1.1643835616438356, 2.017232142857143, 8.862867620416422e-17] [Cr - 128] + +For [0,1] instead of [0,255], and to 5 places: +[R] [1.16438, 0.00000, 1.59603] [ Y - 0.06275] +[G] = [1.16438, -0.39176, -0.81297] x [Cb - 0.50196] +[B] [1.16438, 2.01723, 0.00000] [Cr - 0.50196] + */ + fs << " y = (y - 0.06275) * 1.16438;" << endl; + fs << " cb = cb - 0.50196;" << endl; + fs << " cr = cr - 0.50196;" << endl; + fs << " color.r = y + 1.59603*cr;" << endl; + fs << " color.g = y - 0.39176*cb - 0.81297*cr;" << endl; + fs << " color.b = y + 2.01723*cb;" << endl; fs << " color.a = 1.0;" << endl; } else if (aConfig.mFeatures & ENABLE_TEXTURE_COMPONENT_ALPHA) { fs << " COLOR_PRECISION vec3 onBlack = texture2D(uBlackTexture, coord).rgb;" << endl; From a58ac47144c4fe11735846731b709934ec988795 Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Wed, 2 Jul 2014 17:48:35 -0700 Subject: [PATCH 71/94] Bug 984048 - Patch 4 - Handle parse and uncaught errors. r=khuey --HG-- extra : rebase_source : 463146233c874c2f2c63c018f2a43a66ca9ea49a --- dom/promise/PromiseCallback.cpp | 4 +- dom/workers/ServiceWorkerManager.cpp | 119 ++++++++++++++++++ dom/workers/ServiceWorkerManager.h | 18 +++ dom/workers/WorkerPrivate.cpp | 11 +- dom/workers/test/serviceworkers/mochitest.ini | 1 + .../test/serviceworkers/parse_error_worker.js | 2 + .../test_installation_simple.html | 20 ++- js/src/jsapi-tests/testUncaughtError.cpp | 4 +- js/src/jsapi.h | 6 +- js/src/jsexn.cpp | 4 +- 10 files changed, 175 insertions(+), 14 deletions(-) create mode 100644 dom/workers/test/serviceworkers/parse_error_worker.js diff --git a/dom/promise/PromiseCallback.cpp b/dom/promise/PromiseCallback.cpp index 896278c60c2a..92611af3cb1f 100644 --- a/dom/promise/PromiseCallback.cpp +++ b/dom/promise/PromiseCallback.cpp @@ -278,8 +278,8 @@ WrapperPromiseCallback::Call(JSContext* aCx, } JS::Rooted typeError(aCx); - if (!JS::CreateTypeError(aCx, stack, fn, lineNumber, 0, - nullptr, message, &typeError)) { + if (!JS::CreateError(aCx, JSEXN_TYPEERR, stack, fn, lineNumber, 0, + nullptr, message, &typeError)) { // Out of memory. Promise will stay unresolved. JS_ClearPendingException(aCx); return; diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index ee0ae487ecbb..e2b61a442ce3 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -12,6 +12,7 @@ #include "mozilla/Preferences.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMError.h" +#include "mozilla/dom/ErrorEvent.h" #include "nsContentUtils.h" #include "nsCxPusher.h" @@ -112,6 +113,49 @@ UpdatePromise::RejectAllPromises(nsresult aRv) } } +void +UpdatePromise::RejectAllPromises(const ErrorEventInit& aErrorDesc) +{ + MOZ_ASSERT(mState == Pending); + mState = Rejected; + + nsTArray> array; + array.SwapElements(mPromises); + for (uint32_t i = 0; i < array.Length(); ++i) { + nsTWeakRef& pendingPromise = array.ElementAt(i); + if (pendingPromise) { + // Since ServiceWorkerContainer is only exposed to windows we can be + // certain about this cast. + nsCOMPtr go = do_QueryInterface(pendingPromise->GetParentObject()); + MOZ_ASSERT(go); + + AutoJSAPI jsapi; + jsapi.Init(go); + + JSContext* cx = jsapi.cx(); + + JS::Rooted stack(cx, JS_GetEmptyString(JS_GetRuntime(cx))); + + JS::Rooted fnval(cx); + ToJSValue(cx, aErrorDesc.mFilename, &fnval); + JS::Rooted fn(cx, fnval.toString()); + + JS::Rooted msgval(cx); + ToJSValue(cx, aErrorDesc.mMessage, &msgval); + JS::Rooted msg(cx, msgval.toString()); + + JS::Rooted error(cx); + if (!JS::CreateError(cx, JSEXN_ERR, stack, fn, aErrorDesc.mLineno, + aErrorDesc.mColno, nullptr, msg, &error)) { + pendingPromise->MaybeReject(NS_ERROR_FAILURE); + continue; + } + + pendingPromise->MaybeReject(cx, error); + } + } +} + class FinishFetchOnMainThreadRunnable : public nsRunnable { nsMainThreadPtrHandle mUpdateInstance; @@ -178,6 +222,12 @@ public: AssertIsOnMainThread(); } + const nsCString& + GetScriptSpec() const + { + return mScriptSpec; + } + void Abort() { @@ -475,6 +525,16 @@ ServiceWorkerManager::RejectUpdatePromiseObservers(ServiceWorkerRegistration* aR aRegistration->mUpdatePromise = nullptr; } +void +ServiceWorkerManager::RejectUpdatePromiseObservers(ServiceWorkerRegistration* aRegistration, + const ErrorEventInit& aErrorDesc) +{ + AssertIsOnMainThread(); + MOZ_ASSERT(aRegistration->HasUpdatePromise()); + aRegistration->mUpdatePromise->RejectAllPromises(aErrorDesc); + aRegistration->mUpdatePromise = nullptr; +} + /* * Update() does not return the Promise that the spec says it should. Callers * may access the registration's (new) Promise after calling this method. @@ -589,6 +649,65 @@ ServiceWorkerManager::FinishFetch(ServiceWorkerRegistration* aRegistration, Install(aRegistration, info); } +void +ServiceWorkerManager::HandleError(JSContext* aCx, + const nsACString& aScope, + const nsAString& aWorkerURL, + nsString aMessage, + nsString aFilename, + nsString aLine, + uint32_t aLineNumber, + uint32_t aColumnNumber, + uint32_t aFlags) +{ + AssertIsOnMainThread(); + + nsCOMPtr uri; + nsresult rv = NS_NewURI(getter_AddRefs(uri), aScope, nullptr, nullptr); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + nsCString domain; + rv = uri->GetHost(domain); + if (NS_WARN_IF(NS_FAILED(rv))) { + return; + } + + ServiceWorkerDomainInfo* domainInfo; + if (!mDomainMap.Get(domain, &domainInfo)) { + return; + } + + nsCString scope; + scope.Assign(aScope); + nsRefPtr registration = domainInfo->GetRegistration(scope); + MOZ_ASSERT(registration); + + RootedDictionary init(aCx); + init.mMessage = aMessage; + init.mFilename = aFilename; + init.mLineno = aLineNumber; + init.mColno = aColumnNumber; + + // If the worker was the one undergoing registration, we reject the promises, + // otherwise we fire events on the ServiceWorker instances. + + // If there is an update in progress and the worker that errored is the same one + // that is being updated, it is a sufficient test for 'this worker is being + // registered'. + // FIXME(nsm): Except the case where an update is found for a worker, in + // which case we'll need some other association than simply the URL. + if (registration->mUpdateInstance && + registration->mUpdateInstance->GetScriptSpec().Equals(NS_ConvertUTF16toUTF8(aWorkerURL))) { + RejectUpdatePromiseObservers(registration, init); + // We don't need to abort here since the worker has already run. + registration->mUpdateInstance = nullptr; + } else { + // FIXME(nsm): Bug 983497 Fire 'error' on ServiceWorkerContainers. + } +} + void ServiceWorkerManager::Install(ServiceWorkerRegistration* aRegistration, ServiceWorkerInfo aServiceWorkerInfo) diff --git a/dom/workers/ServiceWorkerManager.h b/dom/workers/ServiceWorkerManager.h index 293a5ae7d77a..d3f9c8c700dc 100644 --- a/dom/workers/ServiceWorkerManager.h +++ b/dom/workers/ServiceWorkerManager.h @@ -18,6 +18,8 @@ #include "nsTArrayForwardDeclare.h" #include "nsTWeakRef.h" +class nsIScriptError; + namespace mozilla { namespace dom { namespace workers { @@ -43,6 +45,7 @@ public: void AddPromise(Promise* aPromise); void ResolveAllPromises(const nsACString& aScriptSpec, const nsACString& aScope); void RejectAllPromises(nsresult aRv); + void RejectAllPromises(const ErrorEventInit& aErrorDesc); bool IsRejected() const @@ -230,10 +233,25 @@ public: RejectUpdatePromiseObservers(ServiceWorkerRegistration* aRegistration, nsresult aResult); + void + RejectUpdatePromiseObservers(ServiceWorkerRegistration* aRegistration, + const ErrorEventInit& aErrorDesc); + void FinishFetch(ServiceWorkerRegistration* aRegistration, nsPIDOMWindow* aWindow); + void + HandleError(JSContext* aCx, + const nsACString& aScope, + const nsAString& aWorkerURL, + nsString aMessage, + nsString aFilename, + nsString aLine, + uint32_t aLineNumber, + uint32_t aColumnNumber, + uint32_t aFlags); + static already_AddRefed GetInstance(); diff --git a/dom/workers/WorkerPrivate.cpp b/dom/workers/WorkerPrivate.cpp index d6e28bceb197..006432f96380 100644 --- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -78,6 +78,7 @@ #include "Principal.h" #include "RuntimeService.h" #include "ScriptLoader.h" +#include "ServiceWorkerManager.h" #include "SharedWorker.h" #include "WorkerFeature.h" #include "WorkerRunnable.h" @@ -1327,7 +1328,15 @@ private: return true; } - if (aWorkerPrivate->IsSharedWorker() || aWorkerPrivate->IsServiceWorker()) { + if (aWorkerPrivate->IsServiceWorker()) { + nsRefPtr swm = ServiceWorkerManager::GetInstance(); + MOZ_ASSERT(swm); + swm->HandleError(aCx, aWorkerPrivate->SharedWorkerName(), + aWorkerPrivate->ScriptURL(), + mMessage, + mFilename, mLine, mLineNumber, mColumnNumber, mFlags); + return true; + } else if (aWorkerPrivate->IsSharedWorker()) { aWorkerPrivate->BroadcastErrorToSharedWorkers(aCx, mMessage, mFilename, mLine, mLineNumber, mColumnNumber, mFlags); diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini index 1ba39eb1fb13..825d4f402bf2 100644 --- a/dom/workers/test/serviceworkers/mochitest.ini +++ b/dom/workers/test/serviceworkers/mochitest.ini @@ -3,6 +3,7 @@ support-files = worker.js worker2.js worker3.js + parse_error_worker.js [test_installation_simple.html] [test_navigator.html] diff --git a/dom/workers/test/serviceworkers/parse_error_worker.js b/dom/workers/test/serviceworkers/parse_error_worker.js new file mode 100644 index 000000000000..b6a8ef0a1af8 --- /dev/null +++ b/dom/workers/test/serviceworkers/parse_error_worker.js @@ -0,0 +1,2 @@ +// intentional parse error. +var foo = {; diff --git a/dom/workers/test/serviceworkers/test_installation_simple.html b/dom/workers/test/serviceworkers/test_installation_simple.html index cf84bd80abec..19558771fbbb 100644 --- a/dom/workers/test/serviceworkers/test_installation_simple.html +++ b/dom/workers/test/serviceworkers/test_installation_simple.html @@ -63,8 +63,8 @@ ok(w.scope == (new URL("/*", document.baseURI)).href, "Scope should match"); ok(w.url == (new URL("worker.js", document.baseURI)).href, "URL should be of the worker"); }, function(e) { - info(e.name); - ok(false, "Registration should have succeeded!"); + info("Error: " + e.name); + ok(false, "realWorker Registration should have succeeded!"); }); } @@ -95,6 +95,18 @@ }); } + function parseError() { + var p = navigator.serviceWorker.register("parse_error_worker.js"); + return p.then(function(w) { + ok(false, "Registration should fail with parse error"); + }, function(e) { + info("NSM " + e.name); + ok(e instanceof Error, "Registration should fail with parse error"); + }); + } + + // FIXME(nsm): test for parse error when Update step doesn't happen (directly from register). + function runTest() { simpleRegister() .then(sameOriginWorker) @@ -102,8 +114,8 @@ .then(httpsOnly) .then(realWorker) .then(abortPrevious) - // FIXME(nsm): Uncomment once we have the error trapping patch from Bug 984048. - // .then(networkError404) + .then(networkError404) + .then(parseError) // put more tests here. .then(function() { SimpleTest.finish(); diff --git a/js/src/jsapi-tests/testUncaughtError.cpp b/js/src/jsapi-tests/testUncaughtError.cpp index 32ed6d93b99c..0cd2b186e8ae 100644 --- a/js/src/jsapi-tests/testUncaughtError.cpp +++ b/js/src/jsapi-tests/testUncaughtError.cpp @@ -4,7 +4,7 @@ #include "jsapi-tests/tests.h" -using JS::CreateTypeError; +using JS::CreateError; using JS::Rooted; using JS::ObjectValue; using JS::Value; @@ -22,7 +22,7 @@ BEGIN_TEST(testUncaughtError) return false; Rooted err(cx); - if (!CreateTypeError(cx, empty, empty, 0, 0, nullptr, empty, &err)) + if (!CreateError(cx, JSEXN_TYPEERR, empty, empty, 0, 0, nullptr, empty, &err)) return false; Rooted errObj(cx, &err.toObject()); diff --git a/js/src/jsapi.h b/js/src/jsapi.h index d453078748a0..d35d2ab6c657 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -4636,9 +4636,9 @@ JS_SetErrorReporter(JSContext *cx, JSErrorReporter er); namespace JS { extern JS_PUBLIC_API(bool) -CreateTypeError(JSContext *cx, HandleString stack, HandleString fileName, - uint32_t lineNumber, uint32_t columnNumber, JSErrorReport *report, - HandleString message, MutableHandleValue rval); +CreateError(JSContext *cx, JSExnType type, HandleString stack, + HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, + JSErrorReport *report, HandleString message, MutableHandleValue rval); /************************************************************************/ diff --git a/js/src/jsexn.cpp b/js/src/jsexn.cpp index 34be8acbf5c8..e67d944ea23d 100644 --- a/js/src/jsexn.cpp +++ b/js/src/jsexn.cpp @@ -915,7 +915,7 @@ js_CopyErrorObject(JSContext *cx, Handle err, HandleObject scope) } JS_PUBLIC_API(bool) -JS::CreateTypeError(JSContext *cx, HandleString stack, HandleString fileName, +JS::CreateError(JSContext *cx, JSExnType type, HandleString stack, HandleString fileName, uint32_t lineNumber, uint32_t columnNumber, JSErrorReport *report, HandleString message, MutableHandleValue rval) { @@ -925,7 +925,7 @@ JS::CreateTypeError(JSContext *cx, HandleString stack, HandleString fileName, rep = CopyErrorReport(cx, report); RootedObject obj(cx, - js::ErrorObject::create(cx, JSEXN_TYPEERR, stack, fileName, + js::ErrorObject::create(cx, type, stack, fileName, lineNumber, columnNumber, &rep, message)); if (!obj) return false; From 20b913a8fbfee06b2ab23f1cfbe46506ff610f0a Mon Sep 17 00:00:00 2001 From: Nikhil Marathe Date: Wed, 2 Jul 2014 17:48:50 -0700 Subject: [PATCH 72/94] Bug 984048 - Patch 5 - ServiceWorker [[Install]] algorithm. r=ehsan, khuey --HG-- extra : rebase_source : 6c710937fde2ebe679908690c1295927eb4c195d --- dom/workers/RuntimeService.cpp | 64 +++- dom/workers/RuntimeService.h | 16 + dom/workers/ServiceWorkerManager.cpp | 287 +++++++++++++++++- dom/workers/ServiceWorkerManager.h | 11 +- .../serviceworkers/install_event_worker.js | 4 + dom/workers/test/serviceworkers/mochitest.ini | 2 + .../serviceworkers/test_install_event.html | 49 +++ 7 files changed, 422 insertions(+), 11 deletions(-) create mode 100644 dom/workers/test/serviceworkers/install_event_worker.js create mode 100644 dom/workers/test/serviceworkers/test_install_event.html diff --git a/dom/workers/RuntimeService.cpp b/dom/workers/RuntimeService.cpp index ee4a52dadf72..845a59ddf441 100644 --- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -2161,6 +2161,33 @@ RuntimeService::CreateServiceWorker(const GlobalObject& aGlobal, return rv; } +nsresult +RuntimeService::CreateServiceWorkerFromLoadInfo(JSContext* aCx, + WorkerPrivate::LoadInfo aLoadInfo, + const nsAString& aScriptURL, + const nsACString& aScope, + ServiceWorker** aServiceWorker) +{ + + nsRefPtr sharedWorker; + nsresult rv = CreateSharedWorkerFromLoadInfo(aCx, aLoadInfo, aScriptURL, aScope, + WorkerTypeService, + getter_AddRefs(sharedWorker)); + + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + nsRefPtr serviceWorker = + new ServiceWorker(nullptr, sharedWorker); + + serviceWorker->mURL = aScriptURL; + serviceWorker->mScope = NS_ConvertUTF8toUTF16(aScope); + + serviceWorker.forget(aServiceWorker); + return rv; +} + nsresult RuntimeService::CreateSharedWorkerInternal(const GlobalObject& aGlobal, const nsAString& aScriptURL, @@ -2181,11 +2208,21 @@ RuntimeService::CreateSharedWorkerInternal(const GlobalObject& aGlobal, false, &loadInfo); NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(loadInfo.mResolvedScriptURI); + return CreateSharedWorkerFromLoadInfo(cx, loadInfo, aScriptURL, aName, aType, + aSharedWorker); +} - nsCString scriptSpec; - rv = loadInfo.mResolvedScriptURI->GetSpec(scriptSpec); - NS_ENSURE_SUCCESS(rv, rv); +nsresult +RuntimeService::CreateSharedWorkerFromLoadInfo(JSContext* aCx, + WorkerPrivate::LoadInfo aLoadInfo, + const nsAString& aScriptURL, + const nsACString& aName, + WorkerType aType, + SharedWorker** aSharedWorker) +{ + AssertIsOnMainThread(); + + MOZ_ASSERT(aLoadInfo.mResolvedScriptURI); nsRefPtr workerPrivate; { @@ -2194,22 +2231,31 @@ RuntimeService::CreateSharedWorkerInternal(const GlobalObject& aGlobal, WorkerDomainInfo* domainInfo; SharedWorkerInfo* sharedWorkerInfo; + nsCString scriptSpec; + nsresult rv = aLoadInfo.mResolvedScriptURI->GetSpec(scriptSpec); + NS_ENSURE_SUCCESS(rv, rv); + nsAutoCString key; GenerateSharedWorkerKey(scriptSpec, aName, key); - if (mDomainMap.Get(loadInfo.mDomain, &domainInfo) && + if (mDomainMap.Get(aLoadInfo.mDomain, &domainInfo) && domainInfo->mSharedWorkerInfos.Get(key, &sharedWorkerInfo)) { workerPrivate = sharedWorkerInfo->mWorkerPrivate; } } - bool created = false; + // Keep a reference to the window before spawning the worker. If the worker is + // a Shared/Service worker and the worker script loads and executes before + // the SharedWorker object itself is created before then WorkerScriptLoaded() + // will reset the loadInfo's window. + nsCOMPtr window = aLoadInfo.mWindow; + bool created = false; if (!workerPrivate) { ErrorResult rv; workerPrivate = - WorkerPrivate::Constructor(aGlobal, aScriptURL, false, - aType, aName, &loadInfo, rv); + WorkerPrivate::Constructor(aCx, aScriptURL, false, + aType, aName, &aLoadInfo, rv); NS_ENSURE_TRUE(workerPrivate, rv.ErrorCode()); created = true; @@ -2217,7 +2263,7 @@ RuntimeService::CreateSharedWorkerInternal(const GlobalObject& aGlobal, nsRefPtr sharedWorker = new SharedWorker(window, workerPrivate); - if (!workerPrivate->RegisterSharedWorker(cx, sharedWorker)) { + if (!workerPrivate->RegisterSharedWorker(aCx, sharedWorker)) { NS_WARNING("Worker is unreachable, this shouldn't happen!"); sharedWorker->Close(); return NS_ERROR_FAILURE; diff --git a/dom/workers/RuntimeService.h b/dom/workers/RuntimeService.h index 35d33056861c..d00992eb0ff9 100644 --- a/dom/workers/RuntimeService.h +++ b/dom/workers/RuntimeService.h @@ -17,6 +17,7 @@ #include "nsClassHashtable.h" #include "nsHashKeys.h" #include "nsTArray.h" +#include "WorkerPrivate.h" class nsIRunnable; class nsIThread; @@ -158,6 +159,13 @@ public: const nsACString& aScope, ServiceWorker** aServiceWorker); + nsresult + CreateServiceWorkerFromLoadInfo(JSContext* aCx, + WorkerPrivate::LoadInfo aLoadInfo, + const nsAString& aScriptURL, + const nsACString& aScope, + ServiceWorker** aServiceWorker); + void ForgetSharedWorker(WorkerPrivate* aWorkerPrivate); @@ -296,6 +304,14 @@ private: const nsACString& aName, WorkerType aType, SharedWorker** aSharedWorker); + + nsresult + CreateSharedWorkerFromLoadInfo(JSContext* aCx, + WorkerPrivate::LoadInfo aLoadInfo, + const nsAString& aScriptURL, + const nsACString& aName, + WorkerType aType, + SharedWorker** aSharedWorker); }; END_WORKERS_NAMESPACE diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index e2b61a442ce3..1e40cd7d8f3e 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -5,6 +5,7 @@ #include "ServiceWorkerManager.h" #include "nsIDocument.h" +#include "nsIScriptSecurityManager.h" #include "nsPIDOMWindow.h" #include "jsapi.h" @@ -13,6 +14,8 @@ #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/DOMError.h" #include "mozilla/dom/ErrorEvent.h" +#include "mozilla/dom/InstallEventBinding.h" +#include "mozilla/dom/PromiseNativeHandler.h" #include "nsContentUtils.h" #include "nsCxPusher.h" @@ -22,9 +25,11 @@ #include "RuntimeService.h" #include "ServiceWorker.h" +#include "ServiceWorkerEvents.h" #include "WorkerInlines.h" #include "WorkerPrivate.h" #include "WorkerRunnable.h" +#include "WorkerScope.h" using namespace mozilla; using namespace mozilla::dom; @@ -708,11 +713,243 @@ ServiceWorkerManager::HandleError(JSContext* aCx, } } +class FinishInstallRunnable MOZ_FINAL : public nsRunnable +{ + nsMainThreadPtrHandle mRegistration; + +public: + explicit FinishInstallRunnable( + const nsMainThreadPtrHandle& aRegistration) + : mRegistration(aRegistration) + { + MOZ_ASSERT(!NS_IsMainThread()); + } + + NS_IMETHOD + Run() MOZ_OVERRIDE + { + AssertIsOnMainThread(); + + nsRefPtr swm = ServiceWorkerManager::GetInstance(); + swm->FinishInstall(mRegistration.get()); + return NS_OK; + } +}; + +class CancelServiceWorkerInstallationRunnable MOZ_FINAL : public nsRunnable +{ + nsMainThreadPtrHandle mRegistration; + +public: + explicit CancelServiceWorkerInstallationRunnable( + const nsMainThreadPtrHandle& aRegistration) + : mRegistration(aRegistration) + { + } + + NS_IMETHOD + Run() MOZ_OVERRIDE + { + AssertIsOnMainThread(); + // FIXME(nsm): Change installing worker state to redundant. + // FIXME(nsm): Fire statechange. + mRegistration->mInstallingWorker.Invalidate(); + return NS_OK; + } +}; + +/* + * Used to handle InstallEvent::waitUntil() and proceed with installation. + */ +class FinishInstallHandler MOZ_FINAL : public PromiseNativeHandler +{ + nsMainThreadPtrHandle mRegistration; + + virtual + ~FinishInstallHandler() + { } + +public: + explicit FinishInstallHandler( + const nsMainThreadPtrHandle& aRegistration) + : mRegistration(aRegistration) + { + MOZ_ASSERT(!NS_IsMainThread()); + } + + void + ResolvedCallback(JSContext* aCx, JS::Handle aValue) MOZ_OVERRIDE + { + WorkerPrivate* workerPrivate = GetCurrentThreadWorkerPrivate(); + MOZ_ASSERT(workerPrivate); + workerPrivate->AssertIsOnWorkerThread(); + + nsRefPtr r = new FinishInstallRunnable(mRegistration); + NS_DispatchToMainThread(r); + } + + void + RejectedCallback(JSContext* aCx, JS::Handle aValue) MOZ_OVERRIDE + { + nsRefPtr r = + new CancelServiceWorkerInstallationRunnable(mRegistration); + NS_DispatchToMainThread(r); + } +}; + +/* + * Fires 'install' event on the ServiceWorkerGlobalScope. Modifies busy count + * since it fires the event. This is ok since there can't be nested + * ServiceWorkers, so the parent thread -> worker thread requirement for + * runnables is satisfied. + */ +class InstallEventRunnable MOZ_FINAL : public WorkerRunnable +{ + nsMainThreadPtrHandle mRegistration; + nsCString mScope; + +public: + InstallEventRunnable( + WorkerPrivate* aWorkerPrivate, + const nsMainThreadPtrHandle& aRegistration) + : WorkerRunnable(aWorkerPrivate, WorkerThreadModifyBusyCount), + mRegistration(aRegistration), + mScope(aRegistration.get()->mScope) // copied for access on worker thread. + { + AssertIsOnMainThread(); + MOZ_ASSERT(aWorkerPrivate); + } + + bool + WorkerRun(JSContext* aCx, WorkerPrivate* aWorkerPrivate) + { + MOZ_ASSERT(aWorkerPrivate); + return DispatchInstallEvent(aCx, aWorkerPrivate); + } + +private: + bool + DispatchInstallEvent(JSContext* aCx, WorkerPrivate* aWorkerPrivate) + { + aWorkerPrivate->AssertIsOnWorkerThread(); + MOZ_ASSERT(aWorkerPrivate->IsServiceWorker()); + InstallEventInit init; + init.mBubbles = false; + init.mCancelable = true; + + // FIXME(nsm): Bug 982787 pass previous active worker. + + nsRefPtr target = aWorkerPrivate->GlobalScope(); + nsRefPtr event = + InstallEvent::Constructor(target, NS_LITERAL_STRING("install"), init); + + event->SetTrusted(true); + + nsRefPtr waitUntilPromise; + + nsresult rv = target->DispatchDOMEvent(nullptr, event, nullptr, nullptr); + + nsCOMPtr sgo = aWorkerPrivate->GlobalScope(); + if (NS_SUCCEEDED(rv)) { + waitUntilPromise = event->GetPromise(); + if (!waitUntilPromise) { + ErrorResult rv; + waitUntilPromise = + Promise::Resolve(sgo, + aCx, JS::UndefinedHandleValue, rv); + } + } else { + ErrorResult rv; + // Continue with a canceled install. + waitUntilPromise = Promise::Reject(sgo, aCx, + JS::UndefinedHandleValue, rv); + } + + nsRefPtr handler = + new FinishInstallHandler(mRegistration); + waitUntilPromise->AppendNativeHandler(handler); + return true; + } +}; + void ServiceWorkerManager::Install(ServiceWorkerRegistration* aRegistration, ServiceWorkerInfo aServiceWorkerInfo) { - // FIXME(nsm): Same bug, different patch. + AssertIsOnMainThread(); + aRegistration->mInstallingWorker = aServiceWorkerInfo; + + nsMainThreadPtrHandle handle = + new nsMainThreadPtrHolder(aRegistration); + + nsRefPtr serviceWorker; + nsresult rv = + CreateServiceWorker(aServiceWorkerInfo.GetScriptSpec(), + aRegistration->mScope, + getter_AddRefs(serviceWorker)); + + if (NS_WARN_IF(NS_FAILED(rv))) { + aRegistration->mInstallingWorker.Invalidate(); + return; + } + + nsRefPtr r = + new InstallEventRunnable(serviceWorker->GetWorkerPrivate(), handle); + + AutoSafeJSContext cx; + r->Dispatch(cx); + + // When this function exits, although we've lost references to the ServiceWorker, + // which means the underlying WorkerPrivate has no references, the worker + // will stay alive due to the modified busy count until the install event has + // been dispatched. + // NOTE: The worker spec does not require Promises to keep a worker alive, so + // the waitUntil() construct by itself will not keep a worker alive beyond + // the event dispatch. On the other hand, networking, IDB and so on do keep + // the worker alive, so the waitUntil() is only relevant if the Promise is + // gated on those actions. I (nsm) am not sure if it is worth requiring + // a special spec mention saying the install event should keep the worker + // alive indefinitely purely on the basis of calling waitUntil(), since + // a wait is likely to be required only when performing networking or storage + // transactions in the first place. + + // FIXME(nsm): Bug 983497. Fire "updatefound" on ServiceWorkerContainers. +} + +class ActivationRunnable : public nsRunnable +{ +public: + explicit ActivationRunnable(ServiceWorkerRegistration* aRegistration) + { } +}; + +void +ServiceWorkerManager::FinishInstall(ServiceWorkerRegistration* aRegistration) +{ + AssertIsOnMainThread(); + + if (aRegistration->mWaitingWorker.IsValid()) { + // FIXME(nsm): Actually update the state of active ServiceWorker instances. + } + + aRegistration->mWaitingWorker = aRegistration->mInstallingWorker; + aRegistration->mInstallingWorker.Invalidate(); + + // FIXME(nsm): Actually update state of active ServiceWorker instances to + // installed. + // FIXME(nsm): Fire statechange on the instances. + + // FIXME(nsm): Handle replace(). + + // FIXME(nsm): Check that no document is using the registration! + + nsRefPtr r = + new ActivationRunnable(aRegistration); + + nsresult rv = NS_DispatchToMainThread(r); + if (NS_WARN_IF(NS_FAILED(rv))) { + // FIXME(nsm): Handle error. + } } NS_IMETHODIMP @@ -747,4 +984,52 @@ ServiceWorkerManager::CreateServiceWorkerForWindow(nsPIDOMWindow* aWindow, return rv; } +NS_IMETHODIMP +ServiceWorkerManager::CreateServiceWorker(const nsACString& aScriptSpec, + const nsACString& aScope, + ServiceWorker** aServiceWorker) +{ + AssertIsOnMainThread(); + + WorkerPrivate::LoadInfo info; + nsresult rv = NS_NewURI(getter_AddRefs(info.mBaseURI), aScriptSpec, nullptr, nullptr); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + info.mResolvedScriptURI = info.mBaseURI; + + rv = info.mBaseURI->GetHost(info.mDomain); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + // FIXME(nsm): Create correct principal based on app-ness. + // Would it make sense to store the nsIPrincipal of the first register() in + // the ServiceWorkerRegistration and use that? + nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager(); + rv = ssm->GetNoAppCodebasePrincipal(info.mBaseURI, getter_AddRefs(info.mPrincipal)); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + AutoSafeJSContext cx; + + nsRefPtr serviceWorker; + RuntimeService* rs = RuntimeService::GetService(); + if (!rs) { + return NS_ERROR_FAILURE; + } + + rv = rs->CreateServiceWorkerFromLoadInfo(cx, info, NS_ConvertUTF8toUTF16(aScriptSpec), aScope, + getter_AddRefs(serviceWorker)); + + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + + serviceWorker.forget(aServiceWorker); + return NS_OK; +} + END_WORKERS_NAMESPACE diff --git a/dom/workers/ServiceWorkerManager.h b/dom/workers/ServiceWorkerManager.h index d3f9c8c700dc..5193ed963404 100644 --- a/dom/workers/ServiceWorkerManager.h +++ b/dom/workers/ServiceWorkerManager.h @@ -25,6 +25,7 @@ namespace dom { namespace workers { class ServiceWorker; +class ServiceWorkerContainer; class ServiceWorkerUpdateInstance; /** @@ -241,6 +242,9 @@ public: FinishFetch(ServiceWorkerRegistration* aRegistration, nsPIDOMWindow* aWindow); + void + FinishInstall(ServiceWorkerRegistration* aRegistration); + void HandleError(JSContext* aCx, const nsACString& aScope, @@ -266,12 +270,17 @@ private: Install(ServiceWorkerRegistration* aRegistration, ServiceWorkerInfo aServiceWorkerInfo); - NS_IMETHODIMP + NS_IMETHOD CreateServiceWorkerForWindow(nsPIDOMWindow* aWindow, const nsACString& aScriptSpec, const nsACString& aScope, ServiceWorker** aServiceWorker); + NS_IMETHOD + CreateServiceWorker(const nsACString& aScriptSpec, + const nsACString& aScope, + ServiceWorker** aServiceWorker); + static PLDHashOperator CleanupServiceWorkerInformation(const nsACString& aDomain, ServiceWorkerDomainInfo* aDomainInfo, diff --git a/dom/workers/test/serviceworkers/install_event_worker.js b/dom/workers/test/serviceworkers/install_event_worker.js new file mode 100644 index 000000000000..02b5174a778c --- /dev/null +++ b/dom/workers/test/serviceworkers/install_event_worker.js @@ -0,0 +1,4 @@ +oninstall = function(e) { + dump("NSM Got install event\n"); + dump(e.activeWorker); +} diff --git a/dom/workers/test/serviceworkers/mochitest.ini b/dom/workers/test/serviceworkers/mochitest.ini index 825d4f402bf2..f0d114a663e2 100644 --- a/dom/workers/test/serviceworkers/mochitest.ini +++ b/dom/workers/test/serviceworkers/mochitest.ini @@ -4,6 +4,8 @@ support-files = worker2.js worker3.js parse_error_worker.js + install_event_worker.js [test_installation_simple.html] +[test_install_event.html] [test_navigator.html] diff --git a/dom/workers/test/serviceworkers/test_install_event.html b/dom/workers/test/serviceworkers/test_install_event.html new file mode 100644 index 000000000000..b84a9604bb5d --- /dev/null +++ b/dom/workers/test/serviceworkers/test_install_event.html @@ -0,0 +1,49 @@ + + + + + Bug 94048 - test install event. + + + + +

+ +

+
+
+
+
+

From 22dabfaad38e1d15cb612b2ab2db8a4ce244abde Mon Sep 17 00:00:00 2001
From: Seth Fowler 
Date: Wed, 2 Jul 2014 17:58:53 -0700
Subject: [PATCH 73/94] Bug 1027611 (Part 1) - Don't use a frame before
 initializing it in CreateContinuingTableFrame. r=bz

---
 layout/base/nsCSSFrameConstructor.cpp | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp
index 72710281a419..8b589667fe18 100644
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -8134,14 +8134,15 @@ nsCSSFrameConstructor::CreateContinuingTableFrame(nsIPresShell*     aPresShell,
       headerFooterFrame = static_cast
                                      (NS_NewTableRowGroupFrame(aPresShell, headerFooterStyleContext));
 
+      nsIContent* headerFooter = rowGroupFrame->GetContent();
+      headerFooterFrame->Init(headerFooter, newFrame, nullptr);
+
       nsFrameConstructorSaveState absoluteSaveState;
       MakeTablePartAbsoluteContainingBlockIfNeeded(state,
                                                    headerFooterStyleContext->StyleDisplay(),
                                                    absoluteSaveState,
                                                    headerFooterFrame);
 
-      nsIContent* headerFooter = rowGroupFrame->GetContent();
-      headerFooterFrame->Init(headerFooter, newFrame, nullptr);
       ProcessChildren(state, headerFooter, rowGroupFrame->StyleContext(),
                       headerFooterFrame, true, childItems, false,
                       nullptr);

From 5713153de2c86b7bcafcf5da14d7c21c6b528ed5 Mon Sep 17 00:00:00 2001
From: Wes Kocher 
Date: Wed, 2 Jul 2014 18:10:55 -0700
Subject: [PATCH 74/94] Backed out changeset 63e44c0641c3 (bug 925530) for
 build bustage on a CLOSED TREE

---
 content/canvas/src/WebGLContext.cpp | 5 -----
 modules/libpref/src/init/all.js     | 5 -----
 2 files changed, 10 deletions(-)

diff --git a/content/canvas/src/WebGLContext.cpp b/content/canvas/src/WebGLContext.cpp
index 025b4107c485..6c9993a6d54f 100644
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -437,11 +437,6 @@ WebGLContext::SetContextOptions(JSContext* aCx, JS::Handle aOptions)
     // enforce that if stencil is specified, we also give back depth
     newOpts.depth |= newOpts.stencil;
 
-    // Don't do antialiasing if we've disabled MSAA.
-    if (!gfxPrefs::MSAALevel()) {
-      newOpts.antialias = false;
-    }
-
 #if 0
     GenerateWarning("aaHint: %d stencil: %d depth: %d alpha: %d premult: %d preserve: %d\n",
                newOpts.antialias ? 1 : 0,
diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js
index 746036e86df0..cbb017a34691 100644
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -3701,12 +3701,7 @@ pref("canvas.image.cache.limit", 0);
 pref("image.onload.decode.limit", 0);
 
 // WebGL prefs
-#ifdef ANDROID
-// Disable MSAA on mobile.
-pref("gl.msaa-level", 0);
-#else
 pref("gl.msaa-level", 2);
-#endif
 pref("webgl.force-enabled", false);
 pref("webgl.disabled", false);
 pref("webgl.shader_validator", true);

From 21f4c1ac8301d3a4067ff9a68594944457ffbf1d Mon Sep 17 00:00:00 2001
From: Wes Kocher 
Date: Wed, 2 Jul 2014 18:15:55 -0700
Subject: [PATCH 75/94] Backed out changeset 5206957b4f83 (bug 940506) for
 build bustage on a CLOSED TREE

---
 security/manager/ssl/public/moz.build         |   1 +
 .../ssl/public/nsIRecentBadCertsService.idl   |  50 ++++++
 security/manager/ssl/public/nsIX509CertDB.idl |  13 +-
 .../ssl/src/SSLServerCertVerification.cpp     |  14 ++
 security/manager/ssl/src/SharedSSLState.cpp   |  21 +++
 security/manager/ssl/src/SharedSSLState.h     |   1 +
 security/manager/ssl/src/moz.build            |   1 +
 .../manager/ssl/src/nsNSSCertificateDB.cpp    |  30 ++++
 security/manager/ssl/src/nsNSSCertificateDB.h |   7 +
 security/manager/ssl/src/nsRecentBadCerts.cpp | 156 ++++++++++++++++++
 security/manager/ssl/src/nsRecentBadCerts.h   |  84 ++++++++++
 11 files changed, 377 insertions(+), 1 deletion(-)
 create mode 100644 security/manager/ssl/public/nsIRecentBadCertsService.idl
 create mode 100644 security/manager/ssl/src/nsRecentBadCerts.cpp
 create mode 100644 security/manager/ssl/src/nsRecentBadCerts.h

diff --git a/security/manager/ssl/public/moz.build b/security/manager/ssl/public/moz.build
index 6b9fee093979..f3fd5dacf19e 100644
--- a/security/manager/ssl/public/moz.build
+++ b/security/manager/ssl/public/moz.build
@@ -31,6 +31,7 @@ XPIDL_SOURCES += [
     'nsIPKCS11ModuleDB.idl',
     'nsIPKCS11Slot.idl',
     'nsIProtectedAuthThread.idl',
+    'nsIRecentBadCertsService.idl',
     'nsISSLErrorListener.idl',
     'nsISSLStatus.idl',
     'nsIStreamCipher.idl',
diff --git a/security/manager/ssl/public/nsIRecentBadCertsService.idl b/security/manager/ssl/public/nsIRecentBadCertsService.idl
new file mode 100644
index 000000000000..c221aa1dbd93
--- /dev/null
+++ b/security/manager/ssl/public/nsIRecentBadCertsService.idl
@@ -0,0 +1,50 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsISupports.idl"
+
+interface nsIArray;
+interface nsIX509Cert;
+interface nsISSLStatus;
+
+%{C++
+#define NS_RECENTBADCERTS_CONTRACTID "@mozilla.org/security/recentbadcerts;1"
+%}
+
+/**
+ * This represents a global list of recently seen bad ssl status
+ * including the bad cert.
+ * The implementation will decide how many entries it will hold,
+ * the number is expected to be small.
+ */
+[scriptable, uuid(0fed7784-d152-44d6-95a7-67a59024de0f)]
+interface nsIRecentBadCerts : nsISupports {
+  /**
+   *  Retrieve the recently seen bad ssl status for the given hostname:port.
+   *  If no SSL cert was recently seen for the given hostname:port, return null.
+   *  If a good cert was seen for the given hostname:port, return null.
+   *
+   *  @param aHostNameWithPort The host:port whose entry should be tested
+   *  @return null or a recently seen bad ssl status with cert
+   */
+  nsISSLStatus getRecentBadCert(in AString aHostNameWithPort);
+
+  /**
+   *  A bad certificate that should be remembered by the service.
+   *  Will be added as the most recently seen cert.
+   *  The service may forget older entries to make room for the new one.
+   *
+   *  @param aHostNameWithPort The host:port whose entry should be tested
+   *  @param aCert The bad ssl status with certificate
+   */
+  void addBadCert(in AString aHostNameWithPort,
+                  in nsISSLStatus aStatus);
+
+  /**
+   * Clear all stored cert data.
+   */
+  void resetStoredCerts();
+};
diff --git a/security/manager/ssl/public/nsIX509CertDB.idl b/security/manager/ssl/public/nsIX509CertDB.idl
index 82d1e96af5be..1fbf2a33129f 100644
--- a/security/manager/ssl/public/nsIX509CertDB.idl
+++ b/security/manager/ssl/public/nsIX509CertDB.idl
@@ -12,6 +12,7 @@ interface nsIX509Cert3;
 interface nsIFile;
 interface nsIInterfaceRequestor;
 interface nsIZipReader;
+interface nsIRecentBadCerts;
 interface nsIX509CertList;
 
 %{C++
@@ -32,7 +33,7 @@ interface nsIOpenSignedAppFileCallback : nsISupports
  * This represents a service to access and manipulate 
  * X.509 certificates stored in a database.
  */
-[scriptable, uuid(dd6e4af8-23bb-41d9-a1e3-9ce925429f2f)]
+[scriptable, uuid(7446a5b1-84ca-491f-a2fe-0bc60a71ffa5)]
 interface nsIX509CertDB : nsISupports {
 
   /**
@@ -280,6 +281,16 @@ interface nsIX509CertDB : nsISupports {
    */
   nsIX509Cert constructX509(in string certDER, in unsigned long length);
 
+  /*
+   *  Obtain a reference to the appropriate service for recent
+   *  bad certificates. May only be called on the main thread.
+   *
+   *  @param isPrivate True if the service for certs for private connections
+   *                   is desired, false otherwise.
+   *  @return The requested service.
+   */
+  nsIRecentBadCerts getRecentBadCerts(in boolean isPrivate);
+
   /**
    *  Verifies the signature on the given JAR file to verify that it has a
    *  valid signature.  To be considered valid, there must be exactly one
diff --git a/security/manager/ssl/src/SSLServerCertVerification.cpp b/security/manager/ssl/src/SSLServerCertVerification.cpp
index f0eb67adae78..abf2f510c870 100644
--- a/security/manager/ssl/src/SSLServerCertVerification.cpp
+++ b/security/manager/ssl/src/SSLServerCertVerification.cpp
@@ -105,6 +105,7 @@
 #include "nsICertOverrideService.h"
 #include "nsISiteSecurityService.h"
 #include "nsNSSComponent.h"
+#include "nsRecentBadCerts.h"
 #include "nsNSSIOLayer.h"
 #include "nsNSSShutDown.h"
 
@@ -498,6 +499,19 @@ CertErrorRunnable::CheckCertOverrides()
     }
   }
 
+  nsCOMPtr certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
+  nsCOMPtr recentBadCertsService;
+  if (certdb) {
+    bool isPrivate = mProviderFlags & nsISocketProvider::NO_PERMANENT_STORAGE;
+    certdb->GetRecentBadCerts(isPrivate, getter_AddRefs(recentBadCertsService));
+  }
+
+  if (recentBadCertsService) {
+    NS_ConvertUTF8toUTF16 hostWithPortStringUTF16(hostWithPortString);
+    recentBadCertsService->AddBadCert(hostWithPortStringUTF16,
+                                      mInfoObject->SSLStatus());
+  }
+
   // pick the error code to report by priority
   PRErrorCode errorCodeToReport = mErrorCodeTrust    ? mErrorCodeTrust
                                 : mErrorCodeMismatch ? mErrorCodeMismatch
diff --git a/security/manager/ssl/src/SharedSSLState.cpp b/security/manager/ssl/src/SharedSSLState.cpp
index 3c71c67a6f14..7e70d4a693c1 100644
--- a/security/manager/ssl/src/SharedSSLState.cpp
+++ b/security/manager/ssl/src/SharedSSLState.cpp
@@ -13,6 +13,7 @@
 #include "nsThreadUtils.h"
 #include "nsCRT.h"
 #include "nsServiceManagerUtils.h"
+#include "nsRecentBadCerts.h"
 #include "PSMRunnable.h"
 #include "PublicSSL.h"
 #include "ssl.h"
@@ -27,6 +28,7 @@ using mozilla::unused;
 namespace {
 
 static Atomic sCertOverrideSvcExists(false);
+static Atomic sCertDBExists(false);
 
 class MainThreadClearer : public SyncRunnableBase
 {
@@ -49,6 +51,19 @@ public:
       }
     }
 
+    bool certDBExists = sCertDBExists.exchange(false);
+    if (certDBExists) {
+      sCertDBExists = true;
+      nsCOMPtr certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
+      if (certdb) {
+        nsCOMPtr badCerts;
+        certdb->GetRecentBadCerts(true, getter_AddRefs(badCerts));
+        if (badCerts) {
+          badCerts->ResetStoredCerts();
+        }
+      }
+    }
+
     // This needs to be checked on the main thread to avoid racing with NSS
     // initialization.
     mShouldClearSessionCache = mozilla::psm::PrivateSSLState() &&
@@ -195,6 +210,12 @@ SharedSSLState::NoteCertOverrideServiceInstantiated()
   sCertOverrideSvcExists = true;
 }
 
+/*static*/ void
+SharedSSLState::NoteCertDBServiceInstantiated()
+{
+  sCertDBExists = true;
+}
+
 void
 SharedSSLState::Cleanup()
 {
diff --git a/security/manager/ssl/src/SharedSSLState.h b/security/manager/ssl/src/SharedSSLState.h
index 396f5fef6984..4d2db8c0efd4 100644
--- a/security/manager/ssl/src/SharedSSLState.h
+++ b/security/manager/ssl/src/SharedSSLState.h
@@ -44,6 +44,7 @@ public:
   bool SocketCreated();
   void NoteSocketCreated();
   static void NoteCertOverrideServiceInstantiated();
+  static void NoteCertDBServiceInstantiated();
   bool IsOCSPStaplingEnabled() const { return mOCSPStaplingEnabled; }
 
 private:
diff --git a/security/manager/ssl/src/moz.build b/security/manager/ssl/src/moz.build
index d315523479d3..67bd2f889a7e 100644
--- a/security/manager/ssl/src/moz.build
+++ b/security/manager/ssl/src/moz.build
@@ -49,6 +49,7 @@ SOURCES += [
     'nsProtectedAuthThread.cpp',
     'nsPSMBackgroundThread.cpp',
     'nsRandomGenerator.cpp',
+    'nsRecentBadCerts.cpp',
     'nsSDR.cpp',
     'NSSErrorsService.cpp',
     'nsSSLSocketProvider.cpp',
diff --git a/security/manager/ssl/src/nsNSSCertificateDB.cpp b/security/manager/ssl/src/nsNSSCertificateDB.cpp
index 257c61491ab2..a4f048976cf2 100644
--- a/security/manager/ssl/src/nsNSSCertificateDB.cpp
+++ b/security/manager/ssl/src/nsNSSCertificateDB.cpp
@@ -37,6 +37,7 @@
 #include "nsIPrompt.h"
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
+#include "nsRecentBadCerts.h"
 #include "SharedSSLState.h"
 
 #include "nspr.h"
@@ -83,6 +84,12 @@ attemptToLogInWithDefaultPassword()
 
 NS_IMPL_ISUPPORTS(nsNSSCertificateDB, nsIX509CertDB, nsIX509CertDB2)
 
+nsNSSCertificateDB::nsNSSCertificateDB()
+: mBadCertsLock("nsNSSCertificateDB::mBadCertsLock")
+{
+  SharedSSLState::NoteCertDBServiceInstantiated();
+}
+
 nsNSSCertificateDB::~nsNSSCertificateDB()
 {
   nsNSSShutDownPreventionLock locker;
@@ -1705,6 +1712,29 @@ nsNSSCertificateDB::GetCerts(nsIX509CertList **_retval)
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsNSSCertificateDB::GetRecentBadCerts(bool isPrivate, nsIRecentBadCerts** result)
+{
+  nsNSSShutDownPreventionLock locker;
+  if (isAlreadyShutDown()) {
+    return NS_ERROR_NOT_AVAILABLE;
+  }
+
+  MutexAutoLock lock(mBadCertsLock);
+  if (isPrivate) {
+    if (!mPrivateRecentBadCerts) {
+      mPrivateRecentBadCerts = new nsRecentBadCerts;
+    }
+    NS_ADDREF(*result = mPrivateRecentBadCerts);
+  } else {
+    if (!mPublicRecentBadCerts) {
+      mPublicRecentBadCerts = new nsRecentBadCerts;
+    }
+    NS_ADDREF(*result = mPublicRecentBadCerts);
+  }
+  return NS_OK;
+}
+
 NS_IMETHODIMP
 nsNSSCertificateDB::VerifyCertNow(nsIX509Cert* aCert,
                                   int64_t /*SECCertificateUsage*/ aUsage,
diff --git a/security/manager/ssl/src/nsNSSCertificateDB.h b/security/manager/ssl/src/nsNSSCertificateDB.h
index 8f15f32d9365..1fe5c745c6e9 100644
--- a/security/manager/ssl/src/nsNSSCertificateDB.h
+++ b/security/manager/ssl/src/nsNSSCertificateDB.h
@@ -14,6 +14,7 @@
 
 class nsCString;
 class nsIArray;
+class nsRecentBadCerts;
 
 class nsNSSCertificateDB : public nsIX509CertDB
                          , public nsIX509CertDB2
@@ -25,6 +26,8 @@ public:
   NS_DECL_NSIX509CERTDB
   NS_DECL_NSIX509CERTDB2
 
+  nsNSSCertificateDB(); 
+
   // Use this function to generate a default nickname for a user
   // certificate that is to be imported onto a token.
   static void
@@ -62,6 +65,10 @@ private:
                                 nsIInterfaceRequestor *ctx,
                                 const nsNSSShutDownPreventionLock &proofOfLock);
 
+  mozilla::Mutex mBadCertsLock;
+  mozilla::RefPtr mPublicRecentBadCerts;
+  mozilla::RefPtr mPrivateRecentBadCerts;
+
   // We don't own any NSS objects here, so no need to clean up
   virtual void virtualDestroyNSSReference() { };
 };
diff --git a/security/manager/ssl/src/nsRecentBadCerts.cpp b/security/manager/ssl/src/nsRecentBadCerts.cpp
new file mode 100644
index 000000000000..4420fceacdb5
--- /dev/null
+++ b/security/manager/ssl/src/nsRecentBadCerts.cpp
@@ -0,0 +1,156 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "nsRecentBadCerts.h"
+
+#include "pkix/pkixtypes.h"
+#include "nsIX509Cert.h"
+#include "nsIObserverService.h"
+#include "mozilla/RefPtr.h"
+#include "mozilla/Services.h"
+#include "nsSSLStatus.h"
+#include "nsCOMPtr.h"
+#include "nsNSSCertificate.h"
+#include "nsCRT.h"
+#include "nsPromiseFlatString.h"
+#include "nsStringBuffer.h"
+#include "nspr.h"
+#include "pk11pub.h"
+#include "certdb.h"
+#include "sechash.h"
+
+using namespace mozilla;
+
+NS_IMPL_ISUPPORTS(nsRecentBadCerts, nsIRecentBadCerts)
+
+nsRecentBadCerts::nsRecentBadCerts()
+:monitor("nsRecentBadCerts.monitor")
+,mNextStorePosition(0)
+{
+}
+
+nsRecentBadCerts::~nsRecentBadCerts()
+{
+}
+
+NS_IMETHODIMP
+nsRecentBadCerts::GetRecentBadCert(const nsAString & aHostNameWithPort, 
+                                   nsISSLStatus **aStatus)
+{
+  NS_ENSURE_ARG_POINTER(aStatus);
+  if (!aHostNameWithPort.Length())
+    return NS_ERROR_INVALID_ARG;
+
+  *aStatus = nullptr;
+  RefPtr status(new nsSSLStatus());
+
+  SECItem foundDER;
+  foundDER.len = 0;
+  foundDER.data = nullptr;
+
+  bool isDomainMismatch = false;
+  bool isNotValidAtThisTime = false;
+  bool isUntrusted = false;
+
+  {
+    ReentrantMonitorAutoEnter lock(monitor);
+    for (size_t i=0; imServerCert = nsNSSCertificate::Create(nssCert.get());
+    status->mHaveCertErrorBits = true;
+    status->mIsDomainMismatch = isDomainMismatch;
+    status->mIsNotValidAtThisTime = isNotValidAtThisTime;
+    status->mIsUntrusted = isUntrusted;
+
+    *aStatus = status;
+    NS_IF_ADDREF(*aStatus);
+  }
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsRecentBadCerts::AddBadCert(const nsAString &hostWithPort, 
+                                    nsISSLStatus *aStatus)
+{
+  NS_ENSURE_ARG(aStatus);
+
+  nsCOMPtr cert;
+  nsresult rv;
+  rv = aStatus->GetServerCert(getter_AddRefs(cert));
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  bool isDomainMismatch;
+  bool isNotValidAtThisTime;
+  bool isUntrusted;
+
+  rv = aStatus->GetIsDomainMismatch(&isDomainMismatch);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  rv = aStatus->GetIsNotValidAtThisTime(&isNotValidAtThisTime);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  rv = aStatus->GetIsUntrusted(&isUntrusted);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  SECItem tempItem;
+  rv = cert->GetRawDER(&tempItem.len, (uint8_t **)&tempItem.data);
+  NS_ENSURE_SUCCESS(rv, rv);
+
+  {
+    ReentrantMonitorAutoEnter lock(monitor);
+    RecentBadCert &updatedEntry = mCerts[mNextStorePosition];
+
+    ++mNextStorePosition;
+    if (mNextStorePosition == const_recently_seen_list_size)
+      mNextStorePosition = 0;
+
+    updatedEntry.Clear();
+    updatedEntry.mHostWithPort = hostWithPort;
+    updatedEntry.mDERCert = tempItem; // consume
+    updatedEntry.isDomainMismatch = isDomainMismatch;
+    updatedEntry.isNotValidAtThisTime = isNotValidAtThisTime;
+    updatedEntry.isUntrusted = isUntrusted;
+  }
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsRecentBadCerts::ResetStoredCerts()
+{
+  for (size_t i = 0; i < const_recently_seen_list_size; ++i) {
+    RecentBadCert &entry = mCerts[i];
+    entry.Clear();
+  }
+  return NS_OK;
+}
diff --git a/security/manager/ssl/src/nsRecentBadCerts.h b/security/manager/ssl/src/nsRecentBadCerts.h
new file mode 100644
index 000000000000..d96427dd1b03
--- /dev/null
+++ b/security/manager/ssl/src/nsRecentBadCerts.h
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef __RECENTBADCERTS_H__
+#define __RECENTBADCERTS_H__
+
+#include "mozilla/Attributes.h"
+#include "mozilla/ReentrantMonitor.h"
+
+#include "nsIRecentBadCertsService.h"
+#include "nsTHashtable.h"
+#include "nsString.h"
+#include "cert.h"
+#include "secitem.h"
+
+class RecentBadCert
+{
+public:
+
+  RecentBadCert()
+  {
+    mDERCert.len = 0;
+    mDERCert.data = nullptr;
+    isDomainMismatch = false;
+    isNotValidAtThisTime = false;
+    isUntrusted = false;
+  }
+
+  ~RecentBadCert()
+  {
+    Clear();
+  }
+
+  void Clear()
+  {
+    mHostWithPort.Truncate();
+    if (mDERCert.len)
+      nsMemory::Free(mDERCert.data);
+    mDERCert.len = 0;
+    mDERCert.data = nullptr;
+  }
+
+  nsString mHostWithPort;
+  SECItem mDERCert;
+  bool isDomainMismatch;
+  bool isNotValidAtThisTime;
+  bool isUntrusted;
+
+private:
+  RecentBadCert(const RecentBadCert &other) MOZ_DELETE;
+  RecentBadCert &operator=(const RecentBadCert &other) MOZ_DELETE;
+};
+
+class nsRecentBadCerts MOZ_FINAL : public nsIRecentBadCerts
+{
+public:
+  NS_DECL_THREADSAFE_ISUPPORTS
+  NS_DECL_NSIRECENTBADCERTS
+
+  nsRecentBadCerts();
+
+protected:
+    ~nsRecentBadCerts();
+
+    mozilla::ReentrantMonitor monitor;
+
+    enum {const_recently_seen_list_size = 5};
+    RecentBadCert mCerts[const_recently_seen_list_size];
+
+    // will be in the range of 0 to list_size-1
+    uint32_t mNextStorePosition;
+};
+
+#define NS_RECENTBADCERTS_CID { /* e7caf8c0-3570-47fe-aa1b-da47539b5d07 */ \
+    0xe7caf8c0,                                                        \
+    0x3570,                                                            \
+    0x47fe,                                                            \
+    {0xaa, 0x1b, 0xda, 0x47, 0x53, 0x9b, 0x5d, 0x07}                   \
+  }
+
+#endif

From c2589946c71c841d24bf9ba5c0381c6af7dd67ed Mon Sep 17 00:00:00 2001
From: Nick Fitzgerald 
Date: Wed, 2 Jul 2014 19:10:44 -0700
Subject: [PATCH 76/94] Bug 1031168 - Trace the source strings in
 SavedStacks::PCLocationMap. r=terrence

---
 js/src/gc/Barrier.h                           |  1 +
 .../saved-stacks/bug-1031168-trace-sources.js |  9 ++++
 js/src/jscompartment.cpp                      |  3 +-
 js/src/vm/SavedStacks.cpp                     | 26 +++++++---
 js/src/vm/SavedStacks.h                       | 48 +++++++++++++++++--
 5 files changed, 75 insertions(+), 12 deletions(-)
 create mode 100644 js/src/jit-test/tests/saved-stacks/bug-1031168-trace-sources.js

diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h
index fda4765421a6..6d5ca65e18af 100644
--- a/js/src/gc/Barrier.h
+++ b/js/src/gc/Barrier.h
@@ -800,6 +800,7 @@ struct TypeObjectAddendum;
 typedef PreBarriered PreBarrieredObject;
 typedef PreBarriered PreBarrieredScript;
 typedef PreBarriered PreBarrieredJitCode;
+typedef PreBarriered PreBarrieredAtom;
 
 typedef RelocatablePtr RelocatablePtrObject;
 typedef RelocatablePtr RelocatablePtrScript;
diff --git a/js/src/jit-test/tests/saved-stacks/bug-1031168-trace-sources.js b/js/src/jit-test/tests/saved-stacks/bug-1031168-trace-sources.js
new file mode 100644
index 000000000000..3162855a8c94
--- /dev/null
+++ b/js/src/jit-test/tests/saved-stacks/bug-1031168-trace-sources.js
@@ -0,0 +1,9 @@
+loadFile("\
+saveStack();\
+gcPreserveCode = function() {};\
+gc();\
+saveStack() == 3\
+");
+function loadFile(lfVarx) {
+   evaluate(lfVarx);
+}
diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp
index a4b8ea3f9e96..facec140a0fd 100644
--- a/js/src/jscompartment.cpp
+++ b/js/src/jscompartment.cpp
@@ -556,8 +556,7 @@ JSCompartment::markCrossCompartmentWrappers(JSTracer *trc)
 void
 JSCompartment::trace(JSTracer *trc)
 {
-    // At the moment, this is merely ceremonial, but any live-compartment-only tracing should go
-    // here.
+    savedStacks_.trace(trc);
 }
 
 void
diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp
index a89845a18b8a..0280d3c7a956 100644
--- a/js/src/vm/SavedStacks.cpp
+++ b/js/src/vm/SavedStacks.cpp
@@ -12,6 +12,7 @@
 #include "jsfriendapi.h"
 #include "jsnum.h"
 
+#include "gc/Marking.h"
 #include "vm/GlobalObject.h"
 #include "vm/StringBuffer.h"
 
@@ -442,6 +443,19 @@ SavedStacks::sweep(JSRuntime *rt)
     }
 }
 
+void
+SavedStacks::trace(JSTracer *trc)
+{
+    if (!pcLocationMap.initialized())
+        return;
+
+    // Mark each of the source strings in our pc to location cache.
+    for (PCLocationMap::Enum e(pcLocationMap); !e.empty(); e.popFront()) {
+        LocationValue &loc = e.front().value();
+        MarkString(trc, &loc.source, "SavedStacks::PCLocationMap's memoized script source name");
+    }
+}
+
 uint32_t
 SavedStacks::count()
 {
@@ -486,14 +500,14 @@ SavedStacks::insertFrames(JSContext *cx, ScriptFrameIter &iter, MutableHandleSav
     if (!insertFrames(cx, ++iter, &parentFrame))
         return false;
 
-    LocationValue location;
+    AutoLocationValueRooter location(cx);
     if (!getLocation(cx, script, pc, &location))
         return false;
 
     SavedFrame::AutoLookupRooter lookup(cx,
-                                        location.source,
-                                        location.line,
-                                        location.column,
+                                        location.get().source,
+                                        location.get().line,
+                                        location.get().column,
                                         callee ? callee->displayAtom() : nullptr,
                                         parentFrame,
                                         compartment->principals);
@@ -589,7 +603,7 @@ SavedStacks::sweepPCLocationMap()
 
 bool
 SavedStacks::getLocation(JSContext *cx, JSScript *script, jsbytecode *pc,
-                         LocationValue *locationp)
+                         MutableHandleLocationValue locationp)
 {
     PCKey key(script, pc);
     PCLocationMap::AddPtr p = pcLocationMap.lookupForAdd(key);
@@ -608,7 +622,7 @@ SavedStacks::getLocation(JSContext *cx, JSScript *script, jsbytecode *pc,
             return false;
     }
 
-    *locationp = p->value();
+    locationp.set(p->value());
     return true;
 }
 
diff --git a/js/src/vm/SavedStacks.h b/js/src/vm/SavedStacks.h
index 9b76a0358625..f7125db74338 100644
--- a/js/src/vm/SavedStacks.h
+++ b/js/src/vm/SavedStacks.h
@@ -106,6 +106,7 @@ class SavedStacks {
     bool     initialized() const { return frames.initialized(); }
     bool     saveCurrentStack(JSContext *cx, MutableHandleSavedFrame frame);
     void     sweep(JSRuntime *rt);
+    void     trace(JSTracer *trc);
     uint32_t count();
     void     clear();
 
@@ -139,9 +140,47 @@ class SavedStacks {
               column(column)
         { }
 
-        ReadBarrieredAtom source;
-        size_t            line;
-        size_t            column;
+        PreBarrieredAtom source;
+        size_t           line;
+        size_t           column;
+    };
+
+    class MOZ_STACK_CLASS AutoLocationValueRooter : public JS::CustomAutoRooter
+    {
+      public:
+        AutoLocationValueRooter(JSContext *cx)
+            : JS::CustomAutoRooter(cx),
+              value() {}
+
+        void set(LocationValue &loc) {
+            value = loc;
+        }
+
+        LocationValue &get() {
+            return value;
+        }
+
+      private:
+        virtual void trace(JSTracer *trc) {
+            if (value.source)
+                gc::MarkString(trc, &value.source, "SavedStacks::LocationValue::source");
+        }
+
+        SavedStacks::LocationValue value;
+    };
+
+    class MOZ_STACK_CLASS MutableHandleLocationValue
+    {
+      public:
+        inline MOZ_IMPLICIT MutableHandleLocationValue(AutoLocationValueRooter *location)
+            : location(location) {}
+
+        void set(LocationValue &loc) {
+            location->set(loc);
+        }
+
+      private:
+        AutoLocationValueRooter *location;
     };
 
     struct PCLocationHasher : public DefaultHasher {
@@ -163,7 +202,8 @@ class SavedStacks {
     PCLocationMap pcLocationMap;
 
     void sweepPCLocationMap();
-    bool getLocation(JSContext *cx, JSScript *script, jsbytecode *pc, LocationValue *locationp);
+    bool getLocation(JSContext *cx, JSScript *script, jsbytecode *pc,
+                     MutableHandleLocationValue locationp);
 };
 
 bool SavedStacksMetadataCallback(JSContext *cx, JSObject **pmetadata);

From 733ed0912b14da3d1091e4e02608835c59060cbb Mon Sep 17 00:00:00 2001
From: Nick Fitzgerald 
Date: Wed, 2 Jul 2014 19:13:41 -0700
Subject: [PATCH 77/94] Bug 1032954 - Allow TestingFunction.cpp's SaveStack to
 be called as the top frame. r=jimb

---
 js/src/builtin/TestingFunctions.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp
index a7face4175c6..2a9c060d55c1 100644
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -883,7 +883,7 @@ SaveStack(JSContext *cx, unsigned argc, jsval *vp)
     Rooted stack(cx);
     if (!JS::CaptureCurrentStack(cx, &stack))
         return false;
-    args.rval().setObject(*stack);
+    args.rval().setObjectOrNull(stack);
     return true;
 }
 

From 4b1142651a4bfe9fb71928cd887b870bee312083 Mon Sep 17 00:00:00 2001
From: Anthony Jones 
Date: Thu, 3 Jul 2014 14:43:13 +1200
Subject: [PATCH 78/94] Bug 1015829 - Runtime binding for libav 53, 54, 55;
 r=edwin

--HG--
rename : content/media/fmp4/ffmpeg/include/README_mozilla => content/media/fmp4/ffmpeg/README_mozilla
rename : content/media/fmp4/ffmpeg/include/COPYING.LGPLv2.1 => content/media/fmp4/ffmpeg/libav53/include/COPYING.LGPLv2.1
rename : content/media/fmp4/ffmpeg/include/libavcodec/avcodec.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/avcodec.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/avfft.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/avfft.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/dxva2.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/dxva2.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/old_codec_ids.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/old_codec_ids.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/opt.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/opt.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/vaapi.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/vaapi.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/vda.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/vda.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/vdpau.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/vdpau.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/version.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/version.h
rename : content/media/fmp4/ffmpeg/include/libavcodec/xvmc.h => content/media/fmp4/ffmpeg/libav53/include/libavcodec/xvmc.h
rename : content/media/fmp4/ffmpeg/include/libavformat/avformat.h => content/media/fmp4/ffmpeg/libav53/include/libavformat/avformat.h
rename : content/media/fmp4/ffmpeg/include/libavformat/avio.h => content/media/fmp4/ffmpeg/libav53/include/libavformat/avio.h
rename : content/media/fmp4/ffmpeg/include/libavformat/version.h => content/media/fmp4/ffmpeg/libav53/include/libavformat/version.h
rename : content/media/fmp4/ffmpeg/include/libavutil/adler32.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/adler32.h
rename : content/media/fmp4/ffmpeg/include/libavutil/aes.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/aes.h
rename : content/media/fmp4/ffmpeg/include/libavutil/attributes.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/attributes.h
rename : content/media/fmp4/ffmpeg/include/libavutil/audio_fifo.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/audio_fifo.h
rename : content/media/fmp4/ffmpeg/include/libavutil/audioconvert.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/audioconvert.h
rename : content/media/fmp4/ffmpeg/include/libavutil/avassert.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/avassert.h
rename : content/media/fmp4/ffmpeg/include/libavutil/avconfig.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/avconfig.h
rename : content/media/fmp4/ffmpeg/include/libavutil/avstring.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/avstring.h
rename : content/media/fmp4/ffmpeg/include/libavutil/avutil.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/avutil.h
rename : content/media/fmp4/ffmpeg/include/libavutil/base64.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/base64.h
rename : content/media/fmp4/ffmpeg/include/libavutil/blowfish.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/blowfish.h
rename : content/media/fmp4/ffmpeg/include/libavutil/bprint.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/bprint.h
rename : content/media/fmp4/ffmpeg/include/libavutil/bswap.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/bswap.h
rename : content/media/fmp4/ffmpeg/include/libavutil/common.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/common.h
rename : content/media/fmp4/ffmpeg/include/libavutil/cpu.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/cpu.h
rename : content/media/fmp4/ffmpeg/include/libavutil/crc.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/crc.h
rename : content/media/fmp4/ffmpeg/include/libavutil/dict.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/dict.h
rename : content/media/fmp4/ffmpeg/include/libavutil/error.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/error.h
rename : content/media/fmp4/ffmpeg/include/libavutil/eval.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/eval.h
rename : content/media/fmp4/ffmpeg/include/libavutil/fifo.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/fifo.h
rename : content/media/fmp4/ffmpeg/include/libavutil/file.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/file.h
rename : content/media/fmp4/ffmpeg/include/libavutil/imgutils.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/imgutils.h
rename : content/media/fmp4/ffmpeg/include/libavutil/intfloat.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/intfloat.h
rename : content/media/fmp4/ffmpeg/include/libavutil/intfloat_readwrite.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/intfloat_readwrite.h
rename : content/media/fmp4/ffmpeg/include/libavutil/intreadwrite.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/intreadwrite.h
rename : content/media/fmp4/ffmpeg/include/libavutil/lfg.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/lfg.h
rename : content/media/fmp4/ffmpeg/include/libavutil/log.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/log.h
rename : content/media/fmp4/ffmpeg/include/libavutil/lzo.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/lzo.h
rename : content/media/fmp4/ffmpeg/include/libavutil/mathematics.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/mathematics.h
rename : content/media/fmp4/ffmpeg/include/libavutil/md5.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/md5.h
rename : content/media/fmp4/ffmpeg/include/libavutil/mem.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/mem.h
rename : content/media/fmp4/ffmpeg/include/libavutil/old_pix_fmts.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/old_pix_fmts.h
rename : content/media/fmp4/ffmpeg/include/libavutil/opt.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/opt.h
rename : content/media/fmp4/ffmpeg/include/libavutil/parseutils.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/parseutils.h
rename : content/media/fmp4/ffmpeg/include/libavutil/pixdesc.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/pixdesc.h
rename : content/media/fmp4/ffmpeg/include/libavutil/pixfmt.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/pixfmt.h
rename : content/media/fmp4/ffmpeg/include/libavutil/random_seed.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/random_seed.h
rename : content/media/fmp4/ffmpeg/include/libavutil/rational.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/rational.h
rename : content/media/fmp4/ffmpeg/include/libavutil/samplefmt.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/samplefmt.h
rename : content/media/fmp4/ffmpeg/include/libavutil/sha.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/sha.h
rename : content/media/fmp4/ffmpeg/include/libavutil/time.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/time.h
rename : content/media/fmp4/ffmpeg/include/libavutil/timecode.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/timecode.h
rename : content/media/fmp4/ffmpeg/include/libavutil/timestamp.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/timestamp.h
rename : content/media/fmp4/ffmpeg/include/libavutil/version.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/version.h
rename : content/media/fmp4/ffmpeg/include/libavutil/xtea.h => content/media/fmp4/ffmpeg/libav53/include/libavutil/xtea.h
---
 content/media/fmp4/MP4Decoder.cpp             |    4 +-
 content/media/fmp4/PlatformDecoderModule.cpp  |    4 +-
 .../media/fmp4/ffmpeg/FFmpegAACDecoder.cpp    |   18 +-
 content/media/fmp4/ffmpeg/FFmpegAACDecoder.h  |    9 +-
 .../media/fmp4/ffmpeg/FFmpegDataDecoder.cpp   |   24 +-
 content/media/fmp4/ffmpeg/FFmpegDataDecoder.h |   11 +-
 .../media/fmp4/ffmpeg/FFmpegDecoderModule.cpp |   72 +-
 .../media/fmp4/ffmpeg/FFmpegDecoderModule.h   |   36 +-
 .../media/fmp4/ffmpeg/FFmpegFunctionList.h    |   41 +-
 .../media/fmp4/ffmpeg/FFmpegH264Decoder.cpp   |   41 +-
 content/media/fmp4/ffmpeg/FFmpegH264Decoder.h |   12 +-
 content/media/fmp4/ffmpeg/FFmpegLibs.h        |   34 +
 content/media/fmp4/ffmpeg/FFmpegLog.cpp       |   17 +
 .../ffmpeg/{FFmpegCompat.h => FFmpegLog.h}    |   17 +-
 .../media/fmp4/ffmpeg/FFmpegRuntimeLinker.cpp |   97 +-
 .../media/fmp4/ffmpeg/FFmpegRuntimeLinker.h   |   22 +-
 .../fmp4/ffmpeg/{include => }/README_mozilla  |    2 +-
 .../{ => libav53}/include/COPYING.LGPLv2.1    |    0
 .../include/libavcodec/avcodec.h              |    0
 .../{ => libav53}/include/libavcodec/avfft.h  |    0
 .../{ => libav53}/include/libavcodec/dxva2.h  |    0
 .../include/libavcodec/old_codec_ids.h        |    0
 .../{ => libav53}/include/libavcodec/opt.h    |    0
 .../{ => libav53}/include/libavcodec/vaapi.h  |    0
 .../{ => libav53}/include/libavcodec/vda.h    |    0
 .../{ => libav53}/include/libavcodec/vdpau.h  |    0
 .../include/libavcodec/version.h              |    0
 .../{ => libav53}/include/libavcodec/xvmc.h   |    0
 .../include/libavformat/avformat.h            |    0
 .../{ => libav53}/include/libavformat/avio.h  |    0
 .../include/libavformat/version.h             |    0
 .../{ => libav53}/include/libavutil/adler32.h |    0
 .../{ => libav53}/include/libavutil/aes.h     |    0
 .../include/libavutil/attributes.h            |    0
 .../include/libavutil/audio_fifo.h            |    0
 .../include/libavutil/audioconvert.h          |    0
 .../include/libavutil/avassert.h              |    0
 .../include/libavutil/avconfig.h              |    0
 .../include/libavutil/avstring.h              |    0
 .../{ => libav53}/include/libavutil/avutil.h  |    0
 .../{ => libav53}/include/libavutil/base64.h  |    0
 .../include/libavutil/blowfish.h              |    0
 .../{ => libav53}/include/libavutil/bprint.h  |    0
 .../{ => libav53}/include/libavutil/bswap.h   |    0
 .../{ => libav53}/include/libavutil/common.h  |    0
 .../{ => libav53}/include/libavutil/cpu.h     |    0
 .../{ => libav53}/include/libavutil/crc.h     |    0
 .../{ => libav53}/include/libavutil/dict.h    |    0
 .../{ => libav53}/include/libavutil/error.h   |    0
 .../{ => libav53}/include/libavutil/eval.h    |    0
 .../{ => libav53}/include/libavutil/fifo.h    |    0
 .../{ => libav53}/include/libavutil/file.h    |    0
 .../include/libavutil/imgutils.h              |    0
 .../include/libavutil/intfloat.h              |    0
 .../include/libavutil/intfloat_readwrite.h    |    0
 .../include/libavutil/intreadwrite.h          |    0
 .../{ => libav53}/include/libavutil/lfg.h     |    0
 .../{ => libav53}/include/libavutil/log.h     |    0
 .../{ => libav53}/include/libavutil/lzo.h     |    0
 .../include/libavutil/mathematics.h           |    0
 .../{ => libav53}/include/libavutil/md5.h     |    0
 .../{ => libav53}/include/libavutil/mem.h     |    0
 .../include/libavutil/old_pix_fmts.h          |    0
 .../{ => libav53}/include/libavutil/opt.h     |    0
 .../include/libavutil/parseutils.h            |    0
 .../{ => libav53}/include/libavutil/pixdesc.h |    0
 .../{ => libav53}/include/libavutil/pixfmt.h  |    0
 .../include/libavutil/random_seed.h           |    0
 .../include/libavutil/rational.h              |    0
 .../include/libavutil/samplefmt.h             |    0
 .../{ => libav53}/include/libavutil/sha.h     |    0
 .../{ => libav53}/include/libavutil/time.h    |    0
 .../include/libavutil/timecode.h              |    0
 .../include/libavutil/timestamp.h             |    0
 .../{ => libav53}/include/libavutil/version.h |    0
 .../{ => libav53}/include/libavutil/xtea.h    |    0
 content/media/fmp4/ffmpeg/libav53/moz.build   |   20 +
 .../ffmpeg/libav54/include/COPYING.LGPLv2.1   |  504 ++
 .../libav54/include/libavcodec/avcodec.h      | 4658 +++++++++++++++++
 .../ffmpeg/libav54/include/libavcodec/avfft.h |  116 +
 .../ffmpeg/libav54/include/libavcodec/dxva2.h |   88 +
 .../include/libavcodec/old_codec_ids.h        |  366 ++
 .../ffmpeg/libav54/include/libavcodec/vaapi.h |  173 +
 .../ffmpeg/libav54/include/libavcodec/vda.h   |  217 +
 .../ffmpeg/libav54/include/libavcodec/vdpau.h |   94 +
 .../libav54/include/libavcodec/version.h      |   95 +
 .../ffmpeg/libav54/include/libavcodec/xvmc.h  |  168 +
 .../libav54/include/libavformat/avformat.h    | 1749 +++++++
 .../ffmpeg/libav54/include/libavformat/avio.h |  433 ++
 .../libav54/include/libavformat/version.h     |   71 +
 .../libav54/include/libavutil/adler32.h       |   43 +
 .../ffmpeg/libav54/include/libavutil/aes.h    |   67 +
 .../libav54/include/libavutil/attributes.h    |  122 +
 .../libav54/include/libavutil/audio_fifo.h    |  146 +
 .../libav54/include/libavutil/audioconvert.h  |    6 +
 .../libav54/include/libavutil/avassert.h      |   66 +
 .../libav54/include/libavutil/avconfig.h      |    6 +
 .../libav54/include/libavutil/avstring.h      |  191 +
 .../ffmpeg/libav54/include/libavutil/avutil.h |  275 +
 .../ffmpeg/libav54/include/libavutil/base64.h |   65 +
 .../libav54/include/libavutil/blowfish.h      |   76 +
 .../ffmpeg/libav54/include/libavutil/bswap.h  |  109 +
 .../include/libavutil/channel_layout.h        |  182 +
 .../ffmpeg/libav54/include/libavutil/common.h |  406 ++
 .../ffmpeg/libav54/include/libavutil/cpu.h    |   84 +
 .../ffmpeg/libav54/include/libavutil/crc.h    |   74 +
 .../ffmpeg/libav54/include/libavutil/dict.h   |  129 +
 .../ffmpeg/libav54/include/libavutil/error.h  |   83 +
 .../ffmpeg/libav54/include/libavutil/eval.h   |  113 +
 .../ffmpeg/libav54/include/libavutil/fifo.h   |  131 +
 .../ffmpeg/libav54/include/libavutil/file.h   |   54 +
 .../libav54/include/libavutil/imgutils.h      |  138 +
 .../libav54/include/libavutil/intfloat.h      |   77 +
 .../include/libavutil/intfloat_readwrite.h    |   40 +
 .../libav54/include/libavutil/intreadwrite.h  |  549 ++
 .../ffmpeg/libav54/include/libavutil/lfg.h    |   62 +
 .../ffmpeg/libav54/include/libavutil/log.h    |  173 +
 .../ffmpeg/libav54/include/libavutil/lzo.h    |   66 +
 .../libav54/include/libavutil/mathematics.h   |  111 +
 .../ffmpeg/libav54/include/libavutil/md5.h    |   51 +
 .../ffmpeg/libav54/include/libavutil/mem.h    |  183 +
 .../libav54/include/libavutil/old_pix_fmts.h  |  128 +
 .../ffmpeg/libav54/include/libavutil/opt.h    |  516 ++
 .../libav54/include/libavutil/parseutils.h    |  124 +
 .../libav54/include/libavutil/pixdesc.h       |  223 +
 .../ffmpeg/libav54/include/libavutil/pixfmt.h |  268 +
 .../libav54/include/libavutil/random_seed.h   |   44 +
 .../libav54/include/libavutil/rational.h      |  155 +
 .../libav54/include/libavutil/samplefmt.h     |  220 +
 .../ffmpeg/libav54/include/libavutil/sha.h    |   76 +
 .../ffmpeg/libav54/include/libavutil/time.h   |   39 +
 .../libav54/include/libavutil/version.h       |   87 +
 .../ffmpeg/libav54/include/libavutil/xtea.h   |   61 +
 content/media/fmp4/ffmpeg/libav54/moz.build   |   20 +
 .../ffmpeg/libav55/include/COPYING.LGPLv2.1   |  504 ++
 .../libav55/include/libavcodec/avcodec.h      | 4356 +++++++++++++++
 .../ffmpeg/libav55/include/libavcodec/avfft.h |  118 +
 .../ffmpeg/libav55/include/libavcodec/dxva2.h |   88 +
 .../ffmpeg/libav55/include/libavcodec/vaapi.h |  173 +
 .../ffmpeg/libav55/include/libavcodec/vda.h   |  142 +
 .../ffmpeg/libav55/include/libavcodec/vdpau.h |  189 +
 .../libav55/include/libavcodec/version.h      |  127 +
 .../ffmpeg/libav55/include/libavcodec/xvmc.h  |  174 +
 .../libav55/include/libavformat/avformat.h    | 1869 +++++++
 .../ffmpeg/libav55/include/libavformat/avio.h |  439 ++
 .../libav55/include/libavformat/version.h     |   55 +
 .../libav55/include/libavutil/adler32.h       |   43 +
 .../ffmpeg/libav55/include/libavutil/aes.h    |   67 +
 .../libav55/include/libavutil/attributes.h    |  126 +
 .../libav55/include/libavutil/audio_fifo.h    |  146 +
 .../libav55/include/libavutil/audioconvert.h  |    6 +
 .../libav55/include/libavutil/avassert.h      |   66 +
 .../libav55/include/libavutil/avconfig.h      |    6 +
 .../libav55/include/libavutil/avstring.h      |  226 +
 .../ffmpeg/libav55/include/libavutil/avutil.h |  284 +
 .../ffmpeg/libav55/include/libavutil/base64.h |   65 +
 .../libav55/include/libavutil/blowfish.h      |   76 +
 .../ffmpeg/libav55/include/libavutil/bswap.h  |  111 +
 .../ffmpeg/libav55/include/libavutil/buffer.h |  267 +
 .../include/libavutil/channel_layout.h        |  186 +
 .../ffmpeg/libav55/include/libavutil/common.h |  406 ++
 .../ffmpeg/libav55/include/libavutil/cpu.h    |   87 +
 .../ffmpeg/libav55/include/libavutil/crc.h    |   74 +
 .../ffmpeg/libav55/include/libavutil/dict.h   |  146 +
 .../libav55/include/libavutil/downmix_info.h  |  114 +
 .../ffmpeg/libav55/include/libavutil/error.h  |   82 +
 .../ffmpeg/libav55/include/libavutil/eval.h   |  113 +
 .../ffmpeg/libav55/include/libavutil/fifo.h   |  131 +
 .../ffmpeg/libav55/include/libavutil/file.h   |   54 +
 .../ffmpeg/libav55/include/libavutil/frame.h  |  552 ++
 .../ffmpeg/libav55/include/libavutil/hmac.h   |   95 +
 .../libav55/include/libavutil/imgutils.h      |  138 +
 .../libav55/include/libavutil/intfloat.h      |   77 +
 .../libav55/include/libavutil/intreadwrite.h  |  549 ++
 .../ffmpeg/libav55/include/libavutil/lfg.h    |   62 +
 .../ffmpeg/libav55/include/libavutil/log.h    |  262 +
 .../ffmpeg/libav55/include/libavutil/lzo.h    |   66 +
 .../ffmpeg/libav55/include/libavutil/macros.h |   48 +
 .../libav55/include/libavutil/mathematics.h   |  111 +
 .../ffmpeg/libav55/include/libavutil/md5.h    |   51 +
 .../ffmpeg/libav55/include/libavutil/mem.h    |  265 +
 .../libav55/include/libavutil/old_pix_fmts.h  |  134 +
 .../ffmpeg/libav55/include/libavutil/opt.h    |  516 ++
 .../libav55/include/libavutil/parseutils.h    |  124 +
 .../libav55/include/libavutil/pixdesc.h       |  276 +
 .../ffmpeg/libav55/include/libavutil/pixfmt.h |  283 +
 .../libav55/include/libavutil/random_seed.h   |   44 +
 .../libav55/include/libavutil/rational.h      |  155 +
 .../libav55/include/libavutil/samplefmt.h     |  220 +
 .../ffmpeg/libav55/include/libavutil/sha.h    |   76 +
 .../libav55/include/libavutil/stereo3d.h      |  147 +
 .../ffmpeg/libav55/include/libavutil/time.h   |   39 +
 .../libav55/include/libavutil/version.h       |  116 +
 .../ffmpeg/libav55/include/libavutil/xtea.h   |   61 +
 content/media/fmp4/ffmpeg/libav55/moz.build   |   21 +
 content/media/fmp4/moz.build                  |   17 +-
 196 files changed, 30441 insertions(+), 232 deletions(-)
 create mode 100644 content/media/fmp4/ffmpeg/FFmpegLibs.h
 create mode 100644 content/media/fmp4/ffmpeg/FFmpegLog.cpp
 rename content/media/fmp4/ffmpeg/{FFmpegCompat.h => FFmpegLog.h} (57%)
 rename content/media/fmp4/ffmpeg/{include => }/README_mozilla (89%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/COPYING.LGPLv2.1 (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/avcodec.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/avfft.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/dxva2.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/old_codec_ids.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/opt.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/vaapi.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/vda.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/vdpau.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/version.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavcodec/xvmc.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavformat/avformat.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavformat/avio.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavformat/version.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/adler32.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/aes.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/attributes.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/audio_fifo.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/audioconvert.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/avassert.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/avconfig.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/avstring.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/avutil.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/base64.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/blowfish.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/bprint.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/bswap.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/common.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/cpu.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/crc.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/dict.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/error.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/eval.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/fifo.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/file.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/imgutils.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/intfloat.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/intfloat_readwrite.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/intreadwrite.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/lfg.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/log.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/lzo.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/mathematics.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/md5.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/mem.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/old_pix_fmts.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/opt.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/parseutils.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/pixdesc.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/pixfmt.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/random_seed.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/rational.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/samplefmt.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/sha.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/time.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/timecode.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/timestamp.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/version.h (100%)
 rename content/media/fmp4/ffmpeg/{ => libav53}/include/libavutil/xtea.h (100%)
 create mode 100644 content/media/fmp4/ffmpeg/libav53/moz.build
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/COPYING.LGPLv2.1
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/avcodec.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/avfft.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/dxva2.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/old_codec_ids.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/vaapi.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/vda.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/vdpau.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/version.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavcodec/xvmc.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavformat/avformat.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavformat/avio.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavformat/version.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/adler32.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/aes.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/attributes.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/audio_fifo.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/audioconvert.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/avassert.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/avconfig.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/avstring.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/avutil.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/base64.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/blowfish.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/bswap.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/channel_layout.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/common.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/cpu.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/crc.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/dict.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/error.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/eval.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/fifo.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/file.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/imgutils.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat_readwrite.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/intreadwrite.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/lfg.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/log.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/lzo.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/mathematics.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/md5.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/mem.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/old_pix_fmts.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/opt.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/parseutils.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/pixdesc.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/pixfmt.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/random_seed.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/rational.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/samplefmt.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/sha.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/time.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/version.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/include/libavutil/xtea.h
 create mode 100644 content/media/fmp4/ffmpeg/libav54/moz.build
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/COPYING.LGPLv2.1
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/avcodec.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/avfft.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/dxva2.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/vaapi.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/vda.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/vdpau.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/version.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavcodec/xvmc.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavformat/avformat.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavformat/avio.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavformat/version.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/adler32.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/aes.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/attributes.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/audio_fifo.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/audioconvert.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/avassert.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/avconfig.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/avstring.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/avutil.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/base64.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/blowfish.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/bswap.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/buffer.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/channel_layout.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/common.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/cpu.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/crc.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/dict.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/downmix_info.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/error.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/eval.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/fifo.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/file.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/frame.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/hmac.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/imgutils.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/intfloat.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/intreadwrite.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/lfg.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/log.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/lzo.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/macros.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/mathematics.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/md5.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/mem.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/old_pix_fmts.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/opt.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/parseutils.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/pixdesc.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/pixfmt.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/random_seed.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/rational.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/samplefmt.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/sha.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/stereo3d.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/time.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/version.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/include/libavutil/xtea.h
 create mode 100644 content/media/fmp4/ffmpeg/libav55/moz.build

diff --git a/content/media/fmp4/MP4Decoder.cpp b/content/media/fmp4/MP4Decoder.cpp
index 951c3bfde5bf..2e1b66588562 100644
--- a/content/media/fmp4/MP4Decoder.cpp
+++ b/content/media/fmp4/MP4Decoder.cpp
@@ -13,7 +13,7 @@
 #include "mozilla/WindowsVersion.h"
 #endif
 #ifdef MOZ_FFMPEG
-#include "FFmpegDecoderModule.h"
+#include "FFmpegRuntimeLinker.h"
 #endif
 
 namespace mozilla {
@@ -79,7 +79,7 @@ IsFFmpegAvailable()
 
   // If we can link to FFmpeg, then we can almost certainly play H264 and AAC
   // with it.
-  return FFmpegDecoderModule::Link();
+  return FFmpegRuntimeLinker::Link();
 #endif
 }
 
diff --git a/content/media/fmp4/PlatformDecoderModule.cpp b/content/media/fmp4/PlatformDecoderModule.cpp
index c84ce90b0401..3e3aef5d8950 100644
--- a/content/media/fmp4/PlatformDecoderModule.cpp
+++ b/content/media/fmp4/PlatformDecoderModule.cpp
@@ -9,7 +9,7 @@
 #include "WMFDecoderModule.h"
 #endif
 #ifdef MOZ_FFMPEG
-#include "FFmpegDecoderModule.h"
+#include "FFmpegRuntimeLinker.h"
 #endif
 #include "mozilla/Preferences.h"
 
@@ -56,7 +56,7 @@ PlatformDecoderModule::Create()
 #endif
 #ifdef MOZ_FFMPEG
   if (sFFmpegDecoderEnabled) {
-    return new FFmpegDecoderModule();
+    return FFmpegRuntimeLinker::CreateDecoderModule();
   }
 #endif
   return nullptr;
diff --git a/content/media/fmp4/ffmpeg/FFmpegAACDecoder.cpp b/content/media/fmp4/ffmpeg/FFmpegAACDecoder.cpp
index 9c1446c0278c..15ce1ed97626 100644
--- a/content/media/fmp4/ffmpeg/FFmpegAACDecoder.cpp
+++ b/content/media/fmp4/ffmpeg/FFmpegAACDecoder.cpp
@@ -16,17 +16,16 @@ typedef mp4_demuxer::MP4Sample MP4Sample;
 namespace mozilla
 {
 
-FFmpegAACDecoder::FFmpegAACDecoder(
+FFmpegAACDecoder::FFmpegAACDecoder(
   MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
-  const mp4_demuxer::AudioDecoderConfig &aConfig)
-  : FFmpegDataDecoder(aTaskQueue, AV_CODEC_ID_AAC)
-  , mCallback(aCallback)
+  const mp4_demuxer::AudioDecoderConfig& aConfig)
+  : FFmpegDataDecoder(aTaskQueue, AV_CODEC_ID_AAC), mCallback(aCallback)
 {
   MOZ_COUNT_CTOR(FFmpegAACDecoder);
 }
 
 nsresult
-FFmpegAACDecoder::Init()
+FFmpegAACDecoder::Init()
 {
   nsresult rv = FFmpegDataDecoder::Init();
   NS_ENSURE_SUCCESS(rv, rv);
@@ -64,7 +63,7 @@ CopyAndPackAudio(AVFrame* aFrame, uint32_t aNumChannels, uint32_t aNumSamples)
 }
 
 void
-FFmpegAACDecoder::DecodePacket(MP4Sample* aSample)
+FFmpegAACDecoder::DecodePacket(MP4Sample* aSample)
 {
   nsAutoPtr frame(avcodec_alloc_frame());
   avcodec_get_frame_defaults(frame);
@@ -106,7 +105,7 @@ FFmpegAACDecoder::DecodePacket(MP4Sample* aSample)
 }
 
 nsresult
-FFmpegAACDecoder::Input(MP4Sample* aSample)
+FFmpegAACDecoder::Input(MP4Sample* aSample)
 {
   mTaskQueue->Dispatch(NS_NewRunnableMethodWithArg >(
     this, &FFmpegAACDecoder::DecodePacket, nsAutoPtr(aSample)));
@@ -115,13 +114,14 @@ FFmpegAACDecoder::Input(MP4Sample* aSample)
 }
 
 nsresult
-FFmpegAACDecoder::Drain()
+FFmpegAACDecoder::Drain()
 {
   // AAC is never delayed; nothing to do here.
   return NS_OK;
 }
 
-FFmpegAACDecoder::~FFmpegAACDecoder() {
+FFmpegAACDecoder::~FFmpegAACDecoder()
+{
   MOZ_COUNT_DTOR(FFmpegAACDecoder);
 }
 
diff --git a/content/media/fmp4/ffmpeg/FFmpegAACDecoder.h b/content/media/fmp4/ffmpeg/FFmpegAACDecoder.h
index 2ac14f7b3c7b..446a4082f142 100644
--- a/content/media/fmp4/ffmpeg/FFmpegAACDecoder.h
+++ b/content/media/fmp4/ffmpeg/FFmpegAACDecoder.h
@@ -13,12 +13,17 @@
 namespace mozilla
 {
 
-class FFmpegAACDecoder : public FFmpegDataDecoder
+template  class FFmpegAACDecoder
+{
+};
+
+template <>
+class FFmpegAACDecoder : public FFmpegDataDecoder
 {
 public:
   FFmpegAACDecoder(MediaTaskQueue* aTaskQueue,
                    MediaDataDecoderCallback* aCallback,
-                   const mp4_demuxer::AudioDecoderConfig &aConfig);
+                   const mp4_demuxer::AudioDecoderConfig& aConfig);
   virtual ~FFmpegAACDecoder();
 
   virtual nsresult Init() MOZ_OVERRIDE;
diff --git a/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp b/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp
index cfed3ac59d49..c6ba598f17b0 100644
--- a/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp
+++ b/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp
@@ -9,23 +9,24 @@
 
 #include "MediaTaskQueue.h"
 #include "mp4_demuxer/mp4_demuxer.h"
-#include "FFmpegRuntimeLinker.h"
-
+#include "FFmpegLibs.h"
+#include "FFmpegLog.h"
 #include "FFmpegDataDecoder.h"
 
 namespace mozilla
 {
 
-bool FFmpegDataDecoder::sFFmpegInitDone = false;
+bool FFmpegDataDecoder::sFFmpegInitDone = false;
 
-FFmpegDataDecoder::FFmpegDataDecoder(MediaTaskQueue* aTaskQueue,
-                                     AVCodecID aCodecID)
+FFmpegDataDecoder::FFmpegDataDecoder(MediaTaskQueue* aTaskQueue,
+                                                AVCodecID aCodecID)
   : mTaskQueue(aTaskQueue), mCodecID(aCodecID)
 {
   MOZ_COUNT_CTOR(FFmpegDataDecoder);
 }
 
-FFmpegDataDecoder::~FFmpegDataDecoder() {
+FFmpegDataDecoder::~FFmpegDataDecoder()
+{
   MOZ_COUNT_DTOR(FFmpegDataDecoder);
 }
 
@@ -51,15 +52,10 @@ ChoosePixelFormat(AVCodecContext* aCodecContext, const PixelFormat* aFormats)
 }
 
 nsresult
-FFmpegDataDecoder::Init()
+FFmpegDataDecoder::Init()
 {
   FFMPEG_LOG("Initialising FFmpeg decoder.");
 
-  if (!FFmpegRuntimeLinker::Link()) {
-    NS_WARNING("Failed to link FFmpeg shared libraries.");
-    return NS_ERROR_FAILURE;
-  }
-
   if (!sFFmpegInitDone) {
     av_register_all();
 #ifdef DEBUG
@@ -108,7 +104,7 @@ FFmpegDataDecoder::Init()
 }
 
 nsresult
-FFmpegDataDecoder::Flush()
+FFmpegDataDecoder::Flush()
 {
   mTaskQueue->Flush();
   avcodec_flush_buffers(&mCodecContext);
@@ -116,7 +112,7 @@ FFmpegDataDecoder::Flush()
 }
 
 nsresult
-FFmpegDataDecoder::Shutdown()
+FFmpegDataDecoder::Shutdown()
 {
   if (sFFmpegInitDone) {
     avcodec_close(&mCodecContext);
diff --git a/content/media/fmp4/ffmpeg/FFmpegDataDecoder.h b/content/media/fmp4/ffmpeg/FFmpegDataDecoder.h
index 1bebdb140858..e861426b3c07 100644
--- a/content/media/fmp4/ffmpeg/FFmpegDataDecoder.h
+++ b/content/media/fmp4/ffmpeg/FFmpegDataDecoder.h
@@ -7,16 +7,21 @@
 #ifndef __FFmpegDataDecoder_h__
 #define __FFmpegDataDecoder_h__
 
-#include "FFmpegDecoderModule.h"
-#include "FFmpegRuntimeLinker.h"
-#include "FFmpegCompat.h"
+#include "PlatformDecoderModule.h"
+#include "FFmpegLibs.h"
 #include "mozilla/Vector.h"
 
 namespace mozilla
 {
 
+template 
 class FFmpegDataDecoder : public MediaDataDecoder
 {
+};
+
+template <>
+class FFmpegDataDecoder : public MediaDataDecoder
+{
 public:
   FFmpegDataDecoder(MediaTaskQueue* aTaskQueue, AVCodecID aCodecID);
   virtual ~FFmpegDataDecoder();
diff --git a/content/media/fmp4/ffmpeg/FFmpegDecoderModule.cpp b/content/media/fmp4/ffmpeg/FFmpegDecoderModule.cpp
index 3209a9743148..7366bd899805 100644
--- a/content/media/fmp4/ffmpeg/FFmpegDecoderModule.cpp
+++ b/content/media/fmp4/ffmpeg/FFmpegDecoderModule.cpp
@@ -4,78 +4,10 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#include "FFmpegRuntimeLinker.h"
-#include "FFmpegAACDecoder.h"
-#include "FFmpegH264Decoder.h"
-
 #include "FFmpegDecoderModule.h"
 
-namespace mozilla
-{
+namespace mozilla {
 
-PRLogModuleInfo* GetFFmpegDecoderLog()
-{
-  static PRLogModuleInfo* sFFmpegDecoderLog = nullptr;
-  if (!sFFmpegDecoderLog) {
-    sFFmpegDecoderLog = PR_NewLogModule("FFmpegDecoderModule");
-  }
-  return sFFmpegDecoderLog;
-}
-
-bool FFmpegDecoderModule::sFFmpegLinkDone = false;
-
-FFmpegDecoderModule::FFmpegDecoderModule()
-{
-  MOZ_COUNT_CTOR(FFmpegDecoderModule);
-}
-
-FFmpegDecoderModule::~FFmpegDecoderModule() {
-  MOZ_COUNT_DTOR(FFmpegDecoderModule);
-}
-
-bool
-FFmpegDecoderModule::Link()
-{
-  if (sFFmpegLinkDone) {
-    return true;
-  }
-
-  if (!FFmpegRuntimeLinker::Link()) {
-    NS_WARNING("Failed to link FFmpeg shared libraries.");
-    return false;
-  }
-
-  sFFmpegLinkDone = true;
-
-  return true;
-}
-
-nsresult
-FFmpegDecoderModule::Shutdown()
-{
-  // Nothing to do here.
-  return NS_OK;
-}
-
-MediaDataDecoder*
-FFmpegDecoderModule::CreateH264Decoder(
-  const mp4_demuxer::VideoDecoderConfig& aConfig,
-  mozilla::layers::LayersBackend aLayersBackend,
-  mozilla::layers::ImageContainer* aImageContainer,
-  MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback)
-{
-  FFMPEG_LOG("Creating FFmpeg H264 decoder.");
-  return new FFmpegH264Decoder(aVideoTaskQueue, aCallback, aConfig,
-                               aImageContainer);
-}
-
-MediaDataDecoder*
-FFmpegDecoderModule::CreateAACDecoder(
-  const mp4_demuxer::AudioDecoderConfig& aConfig,
-  MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback)
-{
-  FFMPEG_LOG("Creating FFmpeg AAC decoder.");
-  return new FFmpegAACDecoder(aAudioTaskQueue, aCallback, aConfig);
-}
+template class FFmpegDecoderModule;
 
 } // namespace mozilla
diff --git a/content/media/fmp4/ffmpeg/FFmpegDecoderModule.h b/content/media/fmp4/ffmpeg/FFmpegDecoderModule.h
index 44e6c3537802..9581ebf5757f 100644
--- a/content/media/fmp4/ffmpeg/FFmpegDecoderModule.h
+++ b/content/media/fmp4/ffmpeg/FFmpegDecoderModule.h
@@ -8,41 +8,41 @@
 #define __FFmpegDecoderModule_h__
 
 #include "PlatformDecoderModule.h"
+#include "FFmpegAACDecoder.h"
+#include "FFmpegH264Decoder.h"
 
 namespace mozilla
 {
 
-#ifdef PR_LOGGING
-extern PRLogModuleInfo* GetFFmpegDecoderLog();
-#define FFMPEG_LOG(...) PR_LOG(GetFFmpegDecoderLog(), PR_LOG_DEBUG, (__VA_ARGS__))
-#else
-#define FFMPEG_LOG(...)
-#endif
-
+template 
 class FFmpegDecoderModule : public PlatformDecoderModule
 {
 public:
-  FFmpegDecoderModule();
-  virtual ~FFmpegDecoderModule();
+  static PlatformDecoderModule* Create() { return new FFmpegDecoderModule(); }
 
-  static bool Link();
+  FFmpegDecoderModule() {}
+  virtual ~FFmpegDecoderModule() {}
 
-  virtual nsresult Shutdown() MOZ_OVERRIDE;
+  virtual nsresult Shutdown() MOZ_OVERRIDE { return NS_OK; }
 
   virtual MediaDataDecoder* CreateH264Decoder(
     const mp4_demuxer::VideoDecoderConfig& aConfig,
     mozilla::layers::LayersBackend aLayersBackend,
     mozilla::layers::ImageContainer* aImageContainer,
-    MediaTaskQueue* aVideoTaskQueue,
-    MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
+    MediaTaskQueue* aVideoTaskQueue, MediaDataDecoderCallback* aCallback)
+    MOZ_OVERRIDE
+  {
+    return new FFmpegH264Decoder(aVideoTaskQueue, aCallback, aConfig,
+                                    aImageContainer);
+  }
 
   virtual MediaDataDecoder* CreateAACDecoder(
     const mp4_demuxer::AudioDecoderConfig& aConfig,
-    MediaTaskQueue* aAudioTaskQueue,
-    MediaDataDecoderCallback* aCallback) MOZ_OVERRIDE;
-
-private:
-  static bool sFFmpegLinkDone;
+    MediaTaskQueue* aAudioTaskQueue, MediaDataDecoderCallback* aCallback)
+    MOZ_OVERRIDE
+  {
+    return new FFmpegAACDecoder(aAudioTaskQueue, aCallback, aConfig);
+  }
 };
 
 } // namespace mozilla
diff --git a/content/media/fmp4/ffmpeg/FFmpegFunctionList.h b/content/media/fmp4/ffmpeg/FFmpegFunctionList.h
index 62e3dceec0c3..27fab7908180 100644
--- a/content/media/fmp4/ffmpeg/FFmpegFunctionList.h
+++ b/content/media/fmp4/ffmpeg/FFmpegFunctionList.h
@@ -2,24 +2,27 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-AV_FUNC(LIBAVCODEC, avcodec_align_dimensions2)
-AV_FUNC(LIBAVCODEC, avcodec_alloc_frame)
-AV_FUNC(LIBAVCODEC, avcodec_close)
-AV_FUNC(LIBAVCODEC, avcodec_decode_audio4)
-AV_FUNC(LIBAVCODEC, avcodec_decode_video2)
-AV_FUNC(LIBAVCODEC, avcodec_default_get_buffer)
-AV_FUNC(LIBAVCODEC, avcodec_default_release_buffer)
-AV_FUNC(LIBAVCODEC, avcodec_find_decoder)
-AV_FUNC(LIBAVCODEC, avcodec_flush_buffers)
-AV_FUNC(LIBAVCODEC, avcodec_get_context_defaults3)
-AV_FUNC(LIBAVCODEC, avcodec_get_edge_width)
-AV_FUNC(LIBAVCODEC, avcodec_get_frame_defaults)
-AV_FUNC(LIBAVCODEC, avcodec_open2)
-AV_FUNC(LIBAVCODEC, av_init_packet)
-AV_FUNC(LIBAVCODEC, av_dict_get)
+/* libavformat */
+AV_FUNC(av_register_all)
 
-AV_FUNC(LIBAVFORMAT, av_register_all)
+/* libavcodec */
+AV_FUNC(avcodec_align_dimensions2)
+AV_FUNC(avcodec_alloc_frame)
+AV_FUNC(avcodec_close)
+AV_FUNC(avcodec_decode_audio4)
+AV_FUNC(avcodec_decode_video2)
+AV_FUNC(avcodec_default_get_buffer)
+AV_FUNC(avcodec_default_release_buffer)
+AV_FUNC(avcodec_find_decoder)
+AV_FUNC(avcodec_flush_buffers)
+AV_FUNC(avcodec_get_context_defaults3)
+AV_FUNC(avcodec_get_edge_width)
+AV_FUNC(avcodec_get_frame_defaults)
+AV_FUNC(avcodec_open2)
+AV_FUNC(av_init_packet)
+AV_FUNC(av_dict_get)
 
-AV_FUNC(LIBAVUTIL, av_image_fill_linesizes)
-AV_FUNC(LIBAVUTIL, av_image_fill_pointers)
-AV_FUNC(LIBAVUTIL, av_log_set_level)
+/* libavutil */
+AV_FUNC(av_image_fill_linesizes)
+AV_FUNC(av_image_fill_pointers)
+AV_FUNC(av_log_set_level)
diff --git a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
index 25bb9bfc0dcb..7bd6205a1fcd 100644
--- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
+++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp
@@ -10,7 +10,6 @@
 #include "ImageContainer.h"
 
 #include "mp4_demuxer/mp4_demuxer.h"
-#include "FFmpegRuntimeLinker.h"
 
 #include "FFmpegH264Decoder.h"
 
@@ -24,9 +23,9 @@ typedef mp4_demuxer::MP4Sample MP4Sample;
 namespace mozilla
 {
 
-FFmpegH264Decoder::FFmpegH264Decoder(
+FFmpegH264Decoder::FFmpegH264Decoder(
   MediaTaskQueue* aTaskQueue, MediaDataDecoderCallback* aCallback,
-  const mp4_demuxer::VideoDecoderConfig &aConfig,
+  const mp4_demuxer::VideoDecoderConfig& aConfig,
   ImageContainer* aImageContainer)
   : FFmpegDataDecoder(aTaskQueue, AV_CODEC_ID_H264)
   , mCallback(aCallback)
@@ -37,7 +36,7 @@ FFmpegH264Decoder::FFmpegH264Decoder(
 }
 
 nsresult
-FFmpegH264Decoder::Init()
+FFmpegH264Decoder::Init()
 {
   nsresult rv = FFmpegDataDecoder::Init();
   NS_ENSURE_SUCCESS(rv, rv);
@@ -48,7 +47,7 @@ FFmpegH264Decoder::Init()
 }
 
 void
-FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
+FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
 {
   AVPacket packet;
   av_init_packet(&packet);
@@ -82,8 +81,9 @@ FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
     info.mHasVideo = true;
 
     data = VideoData::CreateFromImage(
-      info, mImageContainer, aSample->byte_offset, aSample->composition_timestamp,
-      aSample->duration, mCurrentImage, aSample->is_sync_point, -1,
+      info, mImageContainer, aSample->byte_offset,
+      aSample->composition_timestamp, aSample->duration, mCurrentImage,
+      aSample->is_sync_point, -1,
       gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height));
 
     // Insert the frame into the heap for reordering.
@@ -104,7 +104,7 @@ FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample)
 }
 
 static void
-PlanarYCbCrDataFromAVFrame(mozilla::layers::PlanarYCbCrData &aData,
+PlanarYCbCrDataFromAVFrame(mozilla::layers::PlanarYCbCrData& aData,
                            AVFrame* aFrame)
 {
   aData.mPicX = aData.mPicY = 0;
@@ -125,8 +125,8 @@ PlanarYCbCrDataFromAVFrame(mozilla::layers::PlanarYCbCrData &aData,
 }
 
 /* static */ int
-FFmpegH264Decoder::AllocateBufferCb(AVCodecContext* aCodecContext,
-                                    AVFrame* aFrame)
+FFmpegH264Decoder::AllocateBufferCb(AVCodecContext* aCodecContext,
+                                               AVFrame* aFrame)
 {
   MOZ_ASSERT(aCodecContext->codec_type == AVMEDIA_TYPE_VIDEO);
 
@@ -142,8 +142,8 @@ FFmpegH264Decoder::AllocateBufferCb(AVCodecContext* aCodecContext,
 }
 
 int
-FFmpegH264Decoder::AllocateYUV420PVideoBuffer(AVCodecContext* aCodecContext,
-                                              AVFrame* aFrame)
+FFmpegH264Decoder::AllocateYUV420PVideoBuffer(
+  AVCodecContext* aCodecContext, AVFrame* aFrame)
 {
   // Older versions of ffmpeg require that edges be allocated* around* the
   // actual image.
@@ -209,18 +209,18 @@ FFmpegH264Decoder::AllocateYUV420PVideoBuffer(AVCodecContext* aCodecContext,
 }
 
 nsresult
-FFmpegH264Decoder::Input(mp4_demuxer::MP4Sample* aSample)
+FFmpegH264Decoder::Input(mp4_demuxer::MP4Sample* aSample)
 {
   mTaskQueue->Dispatch(
     NS_NewRunnableMethodWithArg >(
-      this, &FFmpegH264Decoder::DecodeFrame,
+      this, &FFmpegH264Decoder::DecodeFrame,
       nsAutoPtr(aSample)));
 
   return NS_OK;
 }
 
 void
-FFmpegH264Decoder::OutputDelayedFrames()
+FFmpegH264Decoder::OutputDelayedFrames()
 {
   while (!mDelayedFrames.IsEmpty()) {
     mCallback->Output(mDelayedFrames.Pop());
@@ -228,7 +228,7 @@ FFmpegH264Decoder::OutputDelayedFrames()
 }
 
 nsresult
-FFmpegH264Decoder::Drain()
+FFmpegH264Decoder::Drain()
 {
   // The maximum number of frames that can be waiting to be decoded is
   // max_b_frames + 1: One P frame and max_b_frames B frames.
@@ -241,14 +241,14 @@ FFmpegH264Decoder::Drain()
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
-  mTaskQueue->Dispatch(
-    NS_NewRunnableMethod(this, &FFmpegH264Decoder::OutputDelayedFrames));
+  mTaskQueue->Dispatch(NS_NewRunnableMethod(
+    this, &FFmpegH264Decoder::OutputDelayedFrames));
 
   return NS_OK;
 }
 
 nsresult
-FFmpegH264Decoder::Flush()
+FFmpegH264Decoder::Flush()
 {
   nsresult rv = FFmpegDataDecoder::Flush();
   // Even if the above fails we may as well clear our frame queue.
@@ -256,7 +256,8 @@ FFmpegH264Decoder::Flush()
   return rv;
 }
 
-FFmpegH264Decoder::~FFmpegH264Decoder() {
+FFmpegH264Decoder::~FFmpegH264Decoder()
+{
   MOZ_COUNT_DTOR(FFmpegH264Decoder);
   MOZ_ASSERT(mDelayedFrames.IsEmpty());
 }
diff --git a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h
index ca4575f7c51f..cf13b4b7972a 100644
--- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h
+++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h
@@ -14,7 +14,13 @@
 namespace mozilla
 {
 
-class FFmpegH264Decoder : public FFmpegDataDecoder
+template 
+class FFmpegH264Decoder : public FFmpegDataDecoder
+{
+};
+
+template <>
+class FFmpegH264Decoder : public FFmpegDataDecoder
 {
   typedef mozilla::layers::Image Image;
   typedef mozilla::layers::ImageContainer ImageContainer;
@@ -22,7 +28,7 @@ class FFmpegH264Decoder : public FFmpegDataDecoder
 public:
   FFmpegH264Decoder(MediaTaskQueue* aTaskQueue,
                     MediaDataDecoderCallback* aCallback,
-                    const mp4_demuxer::VideoDecoderConfig &aConfig,
+                    const mp4_demuxer::VideoDecoderConfig& aConfig,
                     ImageContainer* aImageContainer);
   virtual ~FFmpegH264Decoder();
 
@@ -64,7 +70,7 @@ private:
 
   struct VideoDataComparator
   {
-    bool LessThan(VideoData* const &a, VideoData* const &b) const
+    bool LessThan(VideoData* const& a, VideoData* const& b) const
     {
       return a->mTime < b->mTime;
     }
diff --git a/content/media/fmp4/ffmpeg/FFmpegLibs.h b/content/media/fmp4/ffmpeg/FFmpegLibs.h
new file mode 100644
index 000000000000..2f25d1087267
--- /dev/null
+++ b/content/media/fmp4/ffmpeg/FFmpegLibs.h
@@ -0,0 +1,34 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef __FFmpegLibs_h__
+#define __FFmpegLibs_h__
+
+extern "C" {
+#pragma GCC visibility push(default)
+#include 
+#include 
+#include 
+#pragma GCC visibility pop
+}
+
+#if LIBAVCODEC_VERSION_MAJOR < 55
+#define AV_CODEC_ID_H264 CODEC_ID_H264
+#define AV_CODEC_ID_AAC CODEC_ID_AAC
+typedef CodecID AVCodecID;
+#endif
+
+enum { LIBAV_VER = LIBAVFORMAT_VERSION_MAJOR };
+
+namespace mozilla {
+
+#define AV_FUNC(func) extern typeof(func)* func;
+#include "FFmpegFunctionList.h"
+#undef AV_FUNC
+
+}
+
+#endif // __FFmpegLibs_h__
diff --git a/content/media/fmp4/ffmpeg/FFmpegLog.cpp b/content/media/fmp4/ffmpeg/FFmpegLog.cpp
new file mode 100644
index 000000000000..6053a53f1347
--- /dev/null
+++ b/content/media/fmp4/ffmpeg/FFmpegLog.cpp
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:set ts=2 sw=2 sts=2 et cindent: */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "prlog.h"
+
+PRLogModuleInfo* GetFFmpegDecoderLog()
+{
+  static PRLogModuleInfo* sFFmpegDecoderLog = nullptr;
+  if (!sFFmpegDecoderLog) {
+    sFFmpegDecoderLog = PR_NewLogModule("FFmpegDecoderModule");
+  }
+  return sFFmpegDecoderLog;
+}
+
diff --git a/content/media/fmp4/ffmpeg/FFmpegCompat.h b/content/media/fmp4/ffmpeg/FFmpegLog.h
similarity index 57%
rename from content/media/fmp4/ffmpeg/FFmpegCompat.h
rename to content/media/fmp4/ffmpeg/FFmpegLog.h
index 21b05d6c6fd7..7615c26ccb79 100644
--- a/content/media/fmp4/ffmpeg/FFmpegCompat.h
+++ b/content/media/fmp4/ffmpeg/FFmpegLog.h
@@ -4,15 +4,14 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#ifndef __FFmpegCompat_h__
-#define __FFmpegCompat_h__
+#ifndef __FFmpegLog_h__
+#define __FFmpegLog_h__
 
-#include 
-
-#if LIBAVCODEC_VERSION_MAJOR < 55
-#define AV_CODEC_ID_H264 CODEC_ID_H264
-#define AV_CODEC_ID_AAC CODEC_ID_AAC
-typedef CodecID AVCodecID;
+#ifdef PR_LOGGING
+extern PRLogModuleInfo* GetFFmpegDecoderLog();
+#define FFMPEG_LOG(...) PR_LOG(GetFFmpegDecoderLog(), PR_LOG_DEBUG, (__VA_ARGS__))
+#else
+#define FFMPEG_LOG(...)
 #endif
 
-#endif // __FFmpegCompat_h__
+#endif // __FFmpegLog_h__
diff --git a/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.cpp b/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.cpp
index 96776a1032d1..fac680fd262a 100644
--- a/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.cpp
+++ b/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.cpp
@@ -6,34 +6,40 @@
 
 #include 
 
-#include "nsDebug.h"
-
 #include "FFmpegRuntimeLinker.h"
-
-// For FFMPEG_LOG
-#include "FFmpegDecoderModule.h"
+#include "mozilla/ArrayUtils.h"
+#include "FFmpegLog.h"
 
 #define NUM_ELEMENTS(X) (sizeof(X) / sizeof((X)[0]))
 
-#define LIBAVCODEC 0
-#define LIBAVFORMAT 1
-#define LIBAVUTIL 2
-
 namespace mozilla
 {
 
 FFmpegRuntimeLinker::LinkStatus FFmpegRuntimeLinker::sLinkStatus =
   LinkStatus_INIT;
 
-static const char * const sLibNames[] = {
-  "libavcodec.so.53", "libavformat.so.53", "libavutil.so.51",
+struct AvFormatLib
+{
+  const char* Name;
+  PlatformDecoderModule* (*Factory)();
 };
 
-void* FFmpegRuntimeLinker::sLinkedLibs[NUM_ELEMENTS(sLibNames)] = {
-  nullptr, nullptr, nullptr
+template  class FFmpegDecoderModule
+{
+public:
+  static PlatformDecoderModule* Create();
 };
 
-#define AV_FUNC(lib, func) typeof(func) func;
+static const AvFormatLib sLibs[] = {
+  { "libavformat.so.55", FFmpegDecoderModule<55>::Create },
+  { "libavformat.so.54", FFmpegDecoderModule<54>::Create },
+  { "libavformat.so.53", FFmpegDecoderModule<53>::Create },
+};
+
+void* FFmpegRuntimeLinker::sLinkedLib = nullptr;
+const AvFormatLib* FFmpegRuntimeLinker::sLib = nullptr;
+
+#define AV_FUNC(func) void (*func)();
 #include "FFmpegFunctionList.h"
 #undef AV_FUNC
 
@@ -44,41 +50,60 @@ FFmpegRuntimeLinker::Link()
     return sLinkStatus == LinkStatus_SUCCEEDED;
   }
 
-  for (uint32_t i = 0; i < NUM_ELEMENTS(sLinkedLibs); i++) {
-    if (!(sLinkedLibs[i] = dlopen(sLibNames[i], RTLD_NOW | RTLD_LOCAL))) {
-      NS_WARNING("Couldn't link ffmpeg libraries.");
-      goto fail;
+  for (size_t i = 0; i < ArrayLength(sLibs); i++) {
+    const AvFormatLib* lib = &sLibs[i];
+    sLinkedLib = dlopen(lib->Name, RTLD_NOW | RTLD_LOCAL);
+    if (sLinkedLib) {
+      if (Bind(lib->Name)) {
+        sLib = lib;
+        sLinkStatus = LinkStatus_SUCCEEDED;
+        return true;
+      }
+      // Shouldn't happen but if it does then we try the next lib..
+      Unlink();
     }
   }
 
-#define AV_FUNC(lib, func)                                                     \
-  func = (typeof(func))dlsym(sLinkedLibs[lib], #func);                         \
-  if (!func) {                                                                 \
-    NS_WARNING("Couldn't load FFmpeg function " #func ".");                    \
-    goto fail;                                                                 \
+  FFMPEG_LOG("H264/AAC codecs unsupported without [");
+  for (size_t i = 0; i < ArrayLength(sLibs); i++) {
+    FFMPEG_LOG("%s %s", i ? "," : "", sLibs[i].Name);
   }
-#include "FFmpegFunctionList.h"
-#undef AV_FUNC
+  FFMPEG_LOG(" ]\n");
 
-  sLinkStatus = LinkStatus_SUCCEEDED;
-  return true;
-
-fail:
   Unlink();
 
   sLinkStatus = LinkStatus_FAILED;
-  return false;
+  return nullptr;
+}
+
+/* static */ bool
+FFmpegRuntimeLinker::Bind(const char* aLibName)
+{
+#define AV_FUNC(func)                                                          \
+  if (!(func = (typeof(func))dlsym(sLinkedLib, #func))) {                      \
+    FFMPEG_LOG("Couldn't load function " #func " from %s.", aLibName);         \
+    return false;                                                              \
+  }
+#include "FFmpegFunctionList.h"
+#undef AV_FUNC
+  return true;
+}
+
+/* static */ PlatformDecoderModule*
+FFmpegRuntimeLinker::CreateDecoderModule()
+{
+  PlatformDecoderModule* module = sLib->Factory();
+  return module;
 }
 
 /* static */ void
 FFmpegRuntimeLinker::Unlink()
 {
-  FFMPEG_LOG("Unlinking ffmpeg libraries.");
-  for (uint32_t i = 0; i < NUM_ELEMENTS(sLinkedLibs); i++) {
-    if (sLinkedLibs[i]) {
-      dlclose(sLinkedLibs[i]);
-      sLinkedLibs[i] = nullptr;
-    }
+  if (sLinkedLib) {
+    dlclose(sLinkedLib);
+    sLinkedLib = nullptr;
+    sLib = nullptr;
+    sLinkStatus = LinkStatus_INIT;
   }
 }
 
diff --git a/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.h b/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.h
index 46b4b6f4d695..0c4762e45e4e 100644
--- a/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.h
+++ b/content/media/fmp4/ffmpeg/FFmpegRuntimeLinker.h
@@ -7,27 +7,24 @@
 #ifndef __FFmpegRuntimeLinker_h__
 #define __FFmpegRuntimeLinker_h__
 
-extern "C" {
-#pragma GCC visibility push(default)
-#include 
-#include 
-#include 
-#pragma GCC visibility pop
-}
-
-#include "nsAutoPtr.h"
-
 namespace mozilla
 {
 
+class PlatformDecoderModule;
+struct AvFormatLib;
+
 class FFmpegRuntimeLinker
 {
 public:
   static bool Link();
   static void Unlink();
+  static PlatformDecoderModule* CreateDecoderModule();
 
 private:
-  static void* sLinkedLibs[];
+  static void* sLinkedLib;
+  static const AvFormatLib* sLib;
+
+  static bool Bind(const char* aLibName);
 
   static enum LinkStatus {
     LinkStatus_INIT = 0,
@@ -36,9 +33,6 @@ private:
   } sLinkStatus;
 };
 
-#define AV_FUNC(lib, func) extern typeof(func)* func;
-#include "FFmpegFunctionList.h"
-#undef AV_FUNC
 }
 
 #endif // __FFmpegRuntimeLinker_h__
diff --git a/content/media/fmp4/ffmpeg/include/README_mozilla b/content/media/fmp4/ffmpeg/README_mozilla
similarity index 89%
rename from content/media/fmp4/ffmpeg/include/README_mozilla
rename to content/media/fmp4/ffmpeg/README_mozilla
index e05721eed6cc..19761f751423 100644
--- a/content/media/fmp4/ffmpeg/include/README_mozilla
+++ b/content/media/fmp4/ffmpeg/README_mozilla
@@ -1,4 +1,4 @@
-These headers are taken from Libav version 0.8.9.
+These headers are taken from Libav versions 0.8.9, 0.9 and 1.0.
 
 These headers are licensed under the GNU Lesser General Public License version
 2.1. For more information see the file COPYING.LGPLv2.1
diff --git a/content/media/fmp4/ffmpeg/include/COPYING.LGPLv2.1 b/content/media/fmp4/ffmpeg/libav53/include/COPYING.LGPLv2.1
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/COPYING.LGPLv2.1
rename to content/media/fmp4/ffmpeg/libav53/include/COPYING.LGPLv2.1
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/avcodec.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/avcodec.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/avcodec.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/avcodec.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/avfft.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/avfft.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/avfft.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/avfft.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/dxva2.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/dxva2.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/dxva2.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/dxva2.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/old_codec_ids.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/old_codec_ids.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/old_codec_ids.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/old_codec_ids.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/opt.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/opt.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/opt.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/opt.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/vaapi.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/vaapi.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/vaapi.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/vaapi.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/vda.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/vda.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/vda.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/vda.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/vdpau.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/vdpau.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/vdpau.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/vdpau.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/version.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/version.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/version.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/version.h
diff --git a/content/media/fmp4/ffmpeg/include/libavcodec/xvmc.h b/content/media/fmp4/ffmpeg/libav53/include/libavcodec/xvmc.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavcodec/xvmc.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavcodec/xvmc.h
diff --git a/content/media/fmp4/ffmpeg/include/libavformat/avformat.h b/content/media/fmp4/ffmpeg/libav53/include/libavformat/avformat.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavformat/avformat.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavformat/avformat.h
diff --git a/content/media/fmp4/ffmpeg/include/libavformat/avio.h b/content/media/fmp4/ffmpeg/libav53/include/libavformat/avio.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavformat/avio.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavformat/avio.h
diff --git a/content/media/fmp4/ffmpeg/include/libavformat/version.h b/content/media/fmp4/ffmpeg/libav53/include/libavformat/version.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavformat/version.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavformat/version.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/adler32.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/adler32.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/adler32.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/adler32.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/aes.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/aes.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/aes.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/aes.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/attributes.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/attributes.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/attributes.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/attributes.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/audio_fifo.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/audio_fifo.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/audio_fifo.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/audio_fifo.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/audioconvert.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/audioconvert.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/audioconvert.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/audioconvert.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/avassert.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/avassert.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/avassert.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/avassert.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/avconfig.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/avconfig.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/avconfig.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/avconfig.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/avstring.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/avstring.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/avstring.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/avstring.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/avutil.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/avutil.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/avutil.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/avutil.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/base64.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/base64.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/base64.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/base64.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/blowfish.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/blowfish.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/blowfish.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/blowfish.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/bprint.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/bprint.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/bprint.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/bprint.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/bswap.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/bswap.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/bswap.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/bswap.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/common.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/common.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/common.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/common.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/cpu.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/cpu.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/cpu.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/cpu.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/crc.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/crc.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/crc.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/crc.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/dict.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/dict.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/dict.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/dict.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/error.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/error.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/error.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/error.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/eval.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/eval.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/eval.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/eval.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/fifo.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/fifo.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/fifo.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/fifo.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/file.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/file.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/file.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/file.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/imgutils.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/imgutils.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/imgutils.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/imgutils.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/intfloat.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/intfloat.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/intfloat.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/intfloat.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/intfloat_readwrite.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/intfloat_readwrite.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/intfloat_readwrite.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/intfloat_readwrite.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/intreadwrite.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/intreadwrite.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/intreadwrite.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/intreadwrite.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/lfg.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/lfg.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/lfg.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/lfg.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/log.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/log.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/log.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/log.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/lzo.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/lzo.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/lzo.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/lzo.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/mathematics.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/mathematics.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/mathematics.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/mathematics.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/md5.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/md5.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/md5.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/md5.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/mem.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/mem.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/mem.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/mem.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/old_pix_fmts.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/old_pix_fmts.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/old_pix_fmts.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/old_pix_fmts.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/opt.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/opt.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/opt.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/opt.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/parseutils.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/parseutils.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/parseutils.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/parseutils.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/pixdesc.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/pixdesc.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/pixdesc.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/pixdesc.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/pixfmt.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/pixfmt.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/pixfmt.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/pixfmt.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/random_seed.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/random_seed.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/random_seed.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/random_seed.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/rational.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/rational.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/rational.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/rational.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/samplefmt.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/samplefmt.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/samplefmt.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/samplefmt.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/sha.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/sha.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/sha.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/sha.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/time.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/time.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/time.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/time.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/timecode.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/timecode.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/timecode.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/timecode.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/timestamp.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/timestamp.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/timestamp.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/timestamp.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/version.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/version.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/version.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/version.h
diff --git a/content/media/fmp4/ffmpeg/include/libavutil/xtea.h b/content/media/fmp4/ffmpeg/libav53/include/libavutil/xtea.h
similarity index 100%
rename from content/media/fmp4/ffmpeg/include/libavutil/xtea.h
rename to content/media/fmp4/ffmpeg/libav53/include/libavutil/xtea.h
diff --git a/content/media/fmp4/ffmpeg/libav53/moz.build b/content/media/fmp4/ffmpeg/libav53/moz.build
new file mode 100644
index 000000000000..fb602ebb9fd7
--- /dev/null
+++ b/content/media/fmp4/ffmpeg/libav53/moz.build
@@ -0,0 +1,20 @@
+# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
+# vim: set filetype=python:
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+UNIFIED_SOURCES += [
+    '../FFmpegAACDecoder.cpp',
+    '../FFmpegDataDecoder.cpp',
+    '../FFmpegDecoderModule.cpp',
+    '../FFmpegH264Decoder.cpp',
+]
+LOCAL_INCLUDES += [
+    '..',
+    'include',
+]
+
+FINAL_LIBRARY = 'gklayout'
+
+FAIL_ON_WARNINGS = True
diff --git a/content/media/fmp4/ffmpeg/libav54/include/COPYING.LGPLv2.1 b/content/media/fmp4/ffmpeg/libav54/include/COPYING.LGPLv2.1
new file mode 100644
index 000000000000..00b4fedfe7e7
--- /dev/null
+++ b/content/media/fmp4/ffmpeg/libav54/include/COPYING.LGPLv2.1
@@ -0,0 +1,504 @@
+                  GNU LESSER GENERAL PUBLIC LICENSE
+                       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+                            Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+                  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+                            NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+                     END OF TERMS AND CONDITIONS
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    
+    Copyright (C)   
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  , 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/avcodec.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/avcodec.h
new file mode 100644
index 000000000000..e6b8ec626f6b
--- /dev/null
+++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/avcodec.h
@@ -0,0 +1,4658 @@
+/*
+ * copyright (c) 2001 Fabrice Bellard
+ *
+ * This file is part of Libav.
+ *
+ * Libav is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * Libav is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with Libav; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef AVCODEC_AVCODEC_H
+#define AVCODEC_AVCODEC_H
+
+/**
+ * @file
+ * external API header
+ */
+
+#include 
+#include "libavutil/samplefmt.h"
+#include "libavutil/avutil.h"
+#include "libavutil/cpu.h"
+#include "libavutil/dict.h"
+#include "libavutil/log.h"
+#include "libavutil/pixfmt.h"
+#include "libavutil/rational.h"
+
+#include "libavcodec/version.h"
+/**
+ * @defgroup libavc Encoding/Decoding Library
+ * @{
+ *
+ * @defgroup lavc_decoding Decoding
+ * @{
+ * @}
+ *
+ * @defgroup lavc_encoding Encoding
+ * @{
+ * @}
+ *
+ * @defgroup lavc_codec Codecs
+ * @{
+ * @defgroup lavc_codec_native Native Codecs
+ * @{
+ * @}
+ * @defgroup lavc_codec_wrappers External library wrappers
+ * @{
+ * @}
+ * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge
+ * @{
+ * @}
+ * @}
+ * @defgroup lavc_internal Internal
+ * @{
+ * @}
+ * @}
+ *
+ */
+
+/**
+ * @defgroup lavc_core Core functions/structures.
+ * @ingroup libavc
+ *
+ * Basic definitions, functions for querying libavcodec capabilities,
+ * allocating core structures, etc.
+ * @{
+ */
+
+
+/**
+ * Identify the syntax and semantics of the bitstream.
+ * The principle is roughly:
+ * Two decoders with the same ID can decode the same streams.
+ * Two encoders with the same ID can encode compatible streams.
+ * There may be slight deviations from the principle due to implementation
+ * details.
+ *
+ * If you add a codec ID to this list, add it so that
+ * 1. no value of a existing codec ID changes (that would break ABI),
+ * 2. it is as close as possible to similar codecs.
+ *
+ * After adding new codec IDs, do not forget to add an entry to the codec
+ * descriptor list and bump libavcodec minor version.
+ */
+enum AVCodecID {
+    AV_CODEC_ID_NONE,
+
+    /* video codecs */
+    AV_CODEC_ID_MPEG1VIDEO,
+    AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding
+    AV_CODEC_ID_MPEG2VIDEO_XVMC,
+    AV_CODEC_ID_H261,
+    AV_CODEC_ID_H263,
+    AV_CODEC_ID_RV10,
+    AV_CODEC_ID_RV20,
+    AV_CODEC_ID_MJPEG,
+    AV_CODEC_ID_MJPEGB,
+    AV_CODEC_ID_LJPEG,
+    AV_CODEC_ID_SP5X,
+    AV_CODEC_ID_JPEGLS,
+    AV_CODEC_ID_MPEG4,
+    AV_CODEC_ID_RAWVIDEO,
+    AV_CODEC_ID_MSMPEG4V1,
+    AV_CODEC_ID_MSMPEG4V2,
+    AV_CODEC_ID_MSMPEG4V3,
+    AV_CODEC_ID_WMV1,
+    AV_CODEC_ID_WMV2,
+    AV_CODEC_ID_H263P,
+    AV_CODEC_ID_H263I,
+    AV_CODEC_ID_FLV1,
+    AV_CODEC_ID_SVQ1,
+    AV_CODEC_ID_SVQ3,
+    AV_CODEC_ID_DVVIDEO,
+    AV_CODEC_ID_HUFFYUV,
+    AV_CODEC_ID_CYUV,
+    AV_CODEC_ID_H264,
+    AV_CODEC_ID_INDEO3,
+    AV_CODEC_ID_VP3,
+    AV_CODEC_ID_THEORA,
+    AV_CODEC_ID_ASV1,
+    AV_CODEC_ID_ASV2,
+    AV_CODEC_ID_FFV1,
+    AV_CODEC_ID_4XM,
+    AV_CODEC_ID_VCR1,
+    AV_CODEC_ID_CLJR,
+    AV_CODEC_ID_MDEC,
+    AV_CODEC_ID_ROQ,
+    AV_CODEC_ID_INTERPLAY_VIDEO,
+    AV_CODEC_ID_XAN_WC3,
+    AV_CODEC_ID_XAN_WC4,
+    AV_CODEC_ID_RPZA,
+    AV_CODEC_ID_CINEPAK,
+    AV_CODEC_ID_WS_VQA,
+    AV_CODEC_ID_MSRLE,
+    AV_CODEC_ID_MSVIDEO1,
+    AV_CODEC_ID_IDCIN,
+    AV_CODEC_ID_8BPS,
+    AV_CODEC_ID_SMC,
+    AV_CODEC_ID_FLIC,
+    AV_CODEC_ID_TRUEMOTION1,
+    AV_CODEC_ID_VMDVIDEO,
+    AV_CODEC_ID_MSZH,
+    AV_CODEC_ID_ZLIB,
+    AV_CODEC_ID_QTRLE,
+    AV_CODEC_ID_SNOW,
+    AV_CODEC_ID_TSCC,
+    AV_CODEC_ID_ULTI,
+    AV_CODEC_ID_QDRAW,
+    AV_CODEC_ID_VIXL,
+    AV_CODEC_ID_QPEG,
+    AV_CODEC_ID_PNG,
+    AV_CODEC_ID_PPM,
+    AV_CODEC_ID_PBM,
+    AV_CODEC_ID_PGM,
+    AV_CODEC_ID_PGMYUV,
+    AV_CODEC_ID_PAM,
+    AV_CODEC_ID_FFVHUFF,
+    AV_CODEC_ID_RV30,
+    AV_CODEC_ID_RV40,
+    AV_CODEC_ID_VC1,
+    AV_CODEC_ID_WMV3,
+    AV_CODEC_ID_LOCO,
+    AV_CODEC_ID_WNV1,
+    AV_CODEC_ID_AASC,
+    AV_CODEC_ID_INDEO2,
+    AV_CODEC_ID_FRAPS,
+    AV_CODEC_ID_TRUEMOTION2,
+    AV_CODEC_ID_BMP,
+    AV_CODEC_ID_CSCD,
+    AV_CODEC_ID_MMVIDEO,
+    AV_CODEC_ID_ZMBV,
+    AV_CODEC_ID_AVS,
+    AV_CODEC_ID_SMACKVIDEO,
+    AV_CODEC_ID_NUV,
+    AV_CODEC_ID_KMVC,
+    AV_CODEC_ID_FLASHSV,
+    AV_CODEC_ID_CAVS,
+    AV_CODEC_ID_JPEG2000,
+    AV_CODEC_ID_VMNC,
+    AV_CODEC_ID_VP5,
+    AV_CODEC_ID_VP6,
+    AV_CODEC_ID_VP6F,
+    AV_CODEC_ID_TARGA,
+    AV_CODEC_ID_DSICINVIDEO,
+    AV_CODEC_ID_TIERTEXSEQVIDEO,
+    AV_CODEC_ID_TIFF,
+    AV_CODEC_ID_GIF,
+    AV_CODEC_ID_DXA,
+    AV_CODEC_ID_DNXHD,
+    AV_CODEC_ID_THP,
+    AV_CODEC_ID_SGI,
+    AV_CODEC_ID_C93,
+    AV_CODEC_ID_BETHSOFTVID,
+    AV_CODEC_ID_PTX,
+    AV_CODEC_ID_TXD,
+    AV_CODEC_ID_VP6A,
+    AV_CODEC_ID_AMV,
+    AV_CODEC_ID_VB,
+    AV_CODEC_ID_PCX,
+    AV_CODEC_ID_SUNRAST,
+    AV_CODEC_ID_INDEO4,
+    AV_CODEC_ID_INDEO5,
+    AV_CODEC_ID_MIMIC,
+    AV_CODEC_ID_RL2,
+    AV_CODEC_ID_ESCAPE124,
+    AV_CODEC_ID_DIRAC,
+    AV_CODEC_ID_BFI,
+    AV_CODEC_ID_CMV,
+    AV_CODEC_ID_MOTIONPIXELS,
+    AV_CODEC_ID_TGV,
+    AV_CODEC_ID_TGQ,
+    AV_CODEC_ID_TQI,
+    AV_CODEC_ID_AURA,
+    AV_CODEC_ID_AURA2,
+    AV_CODEC_ID_V210X,
+    AV_CODEC_ID_TMV,
+    AV_CODEC_ID_V210,
+    AV_CODEC_ID_DPX,
+    AV_CODEC_ID_MAD,
+    AV_CODEC_ID_FRWU,
+    AV_CODEC_ID_FLASHSV2,
+    AV_CODEC_ID_CDGRAPHICS,
+    AV_CODEC_ID_R210,
+    AV_CODEC_ID_ANM,
+    AV_CODEC_ID_BINKVIDEO,
+    AV_CODEC_ID_IFF_ILBM,
+    AV_CODEC_ID_IFF_BYTERUN1,
+    AV_CODEC_ID_KGV1,
+    AV_CODEC_ID_YOP,
+    AV_CODEC_ID_VP8,
+    AV_CODEC_ID_PICTOR,
+    AV_CODEC_ID_ANSI,
+    AV_CODEC_ID_A64_MULTI,
+    AV_CODEC_ID_A64_MULTI5,
+    AV_CODEC_ID_R10K,
+    AV_CODEC_ID_MXPEG,
+    AV_CODEC_ID_LAGARITH,
+    AV_CODEC_ID_PRORES,
+    AV_CODEC_ID_JV,
+    AV_CODEC_ID_DFA,
+    AV_CODEC_ID_WMV3IMAGE,
+    AV_CODEC_ID_VC1IMAGE,
+    AV_CODEC_ID_UTVIDEO,
+    AV_CODEC_ID_BMV_VIDEO,
+    AV_CODEC_ID_VBLE,
+    AV_CODEC_ID_DXTORY,
+    AV_CODEC_ID_V410,
+    AV_CODEC_ID_XWD,
+    AV_CODEC_ID_CDXL,
+    AV_CODEC_ID_XBM,
+    AV_CODEC_ID_ZEROCODEC,
+    AV_CODEC_ID_MSS1,
+    AV_CODEC_ID_MSA1,
+    AV_CODEC_ID_TSCC2,
+    AV_CODEC_ID_MTS2,
+    AV_CODEC_ID_CLLC,
+    AV_CODEC_ID_MSS2,
+
+    /* various PCM "codecs" */
+    AV_CODEC_ID_FIRST_AUDIO = 0x10000,     ///< A dummy id pointing at the start of audio codecs
+    AV_CODEC_ID_PCM_S16LE = 0x10000,
+    AV_CODEC_ID_PCM_S16BE,
+    AV_CODEC_ID_PCM_U16LE,
+    AV_CODEC_ID_PCM_U16BE,
+    AV_CODEC_ID_PCM_S8,
+    AV_CODEC_ID_PCM_U8,
+    AV_CODEC_ID_PCM_MULAW,
+    AV_CODEC_ID_PCM_ALAW,
+    AV_CODEC_ID_PCM_S32LE,
+    AV_CODEC_ID_PCM_S32BE,
+    AV_CODEC_ID_PCM_U32LE,
+    AV_CODEC_ID_PCM_U32BE,
+    AV_CODEC_ID_PCM_S24LE,
+    AV_CODEC_ID_PCM_S24BE,
+    AV_CODEC_ID_PCM_U24LE,
+    AV_CODEC_ID_PCM_U24BE,
+    AV_CODEC_ID_PCM_S24DAUD,
+    AV_CODEC_ID_PCM_ZORK,
+    AV_CODEC_ID_PCM_S16LE_PLANAR,
+    AV_CODEC_ID_PCM_DVD,
+    AV_CODEC_ID_PCM_F32BE,
+    AV_CODEC_ID_PCM_F32LE,
+    AV_CODEC_ID_PCM_F64BE,
+    AV_CODEC_ID_PCM_F64LE,
+    AV_CODEC_ID_PCM_BLURAY,
+    AV_CODEC_ID_PCM_LXF,
+    AV_CODEC_ID_S302M,
+    AV_CODEC_ID_PCM_S8_PLANAR,
+
+    /* various ADPCM codecs */
+    AV_CODEC_ID_ADPCM_IMA_QT = 0x11000,
+    AV_CODEC_ID_ADPCM_IMA_WAV,
+    AV_CODEC_ID_ADPCM_IMA_DK3,
+    AV_CODEC_ID_ADPCM_IMA_DK4,
+    AV_CODEC_ID_ADPCM_IMA_WS,
+    AV_CODEC_ID_ADPCM_IMA_SMJPEG,
+    AV_CODEC_ID_ADPCM_MS,
+    AV_CODEC_ID_ADPCM_4XM,
+    AV_CODEC_ID_ADPCM_XA,
+    AV_CODEC_ID_ADPCM_ADX,
+    AV_CODEC_ID_ADPCM_EA,
+    AV_CODEC_ID_ADPCM_G726,
+    AV_CODEC_ID_ADPCM_CT,
+    AV_CODEC_ID_ADPCM_SWF,
+    AV_CODEC_ID_ADPCM_YAMAHA,
+    AV_CODEC_ID_ADPCM_SBPRO_4,
+    AV_CODEC_ID_ADPCM_SBPRO_3,
+    AV_CODEC_ID_ADPCM_SBPRO_2,
+    AV_CODEC_ID_ADPCM_THP,
+    AV_CODEC_ID_ADPCM_IMA_AMV,
+    AV_CODEC_ID_ADPCM_EA_R1,
+    AV_CODEC_ID_ADPCM_EA_R3,
+    AV_CODEC_ID_ADPCM_EA_R2,
+    AV_CODEC_ID_ADPCM_IMA_EA_SEAD,
+    AV_CODEC_ID_ADPCM_IMA_EA_EACS,
+    AV_CODEC_ID_ADPCM_EA_XAS,
+    AV_CODEC_ID_ADPCM_EA_MAXIS_XA,
+    AV_CODEC_ID_ADPCM_IMA_ISS,
+    AV_CODEC_ID_ADPCM_G722,
+    AV_CODEC_ID_ADPCM_IMA_APC,
+
+    /* AMR */
+    AV_CODEC_ID_AMR_NB = 0x12000,
+    AV_CODEC_ID_AMR_WB,
+
+    /* RealAudio codecs*/
+    AV_CODEC_ID_RA_144 = 0x13000,
+    AV_CODEC_ID_RA_288,
+
+    /* various DPCM codecs */
+    AV_CODEC_ID_ROQ_DPCM = 0x14000,
+    AV_CODEC_ID_INTERPLAY_DPCM,
+    AV_CODEC_ID_XAN_DPCM,
+    AV_CODEC_ID_SOL_DPCM,
+
+    /* audio codecs */
+    AV_CODEC_ID_MP2 = 0x15000,
+    AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3
+    AV_CODEC_ID_AAC,
+    AV_CODEC_ID_AC3,
+    AV_CODEC_ID_DTS,
+    AV_CODEC_ID_VORBIS,
+    AV_CODEC_ID_DVAUDIO,
+    AV_CODEC_ID_WMAV1,
+    AV_CODEC_ID_WMAV2,
+    AV_CODEC_ID_MACE3,
+    AV_CODEC_ID_MACE6,
+    AV_CODEC_ID_VMDAUDIO,
+    AV_CODEC_ID_FLAC,
+    AV_CODEC_ID_MP3ADU,
+    AV_CODEC_ID_MP3ON4,
+    AV_CODEC_ID_SHORTEN,
+    AV_CODEC_ID_ALAC,
+    AV_CODEC_ID_WESTWOOD_SND1,
+    AV_CODEC_ID_GSM, ///< as in Berlin toast format
+    AV_CODEC_ID_QDM2,
+    AV_CODEC_ID_COOK,
+    AV_CODEC_ID_TRUESPEECH,
+    AV_CODEC_ID_TTA,
+    AV_CODEC_ID_SMACKAUDIO,
+    AV_CODEC_ID_QCELP,
+    AV_CODEC_ID_WAVPACK,
+    AV_CODEC_ID_DSICINAUDIO,
+    AV_CODEC_ID_IMC,
+    AV_CODEC_ID_MUSEPACK7,
+    AV_CODEC_ID_MLP,
+    AV_CODEC_ID_GSM_MS, /* as found in WAV */
+    AV_CODEC_ID_ATRAC3,
+    AV_CODEC_ID_VOXWARE,
+    AV_CODEC_ID_APE,
+    AV_CODEC_ID_NELLYMOSER,
+    AV_CODEC_ID_MUSEPACK8,
+    AV_CODEC_ID_SPEEX,
+    AV_CODEC_ID_WMAVOICE,
+    AV_CODEC_ID_WMAPRO,
+    AV_CODEC_ID_WMALOSSLESS,
+    AV_CODEC_ID_ATRAC3P,
+    AV_CODEC_ID_EAC3,
+    AV_CODEC_ID_SIPR,
+    AV_CODEC_ID_MP1,
+    AV_CODEC_ID_TWINVQ,
+    AV_CODEC_ID_TRUEHD,
+    AV_CODEC_ID_MP4ALS,
+    AV_CODEC_ID_ATRAC1,
+    AV_CODEC_ID_BINKAUDIO_RDFT,
+    AV_CODEC_ID_BINKAUDIO_DCT,
+    AV_CODEC_ID_AAC_LATM,
+    AV_CODEC_ID_QDMC,
+    AV_CODEC_ID_CELT,
+    AV_CODEC_ID_G723_1,
+    AV_CODEC_ID_G729,
+    AV_CODEC_ID_8SVX_EXP,
+    AV_CODEC_ID_8SVX_FIB,
+    AV_CODEC_ID_BMV_AUDIO,
+    AV_CODEC_ID_RALF,
+    AV_CODEC_ID_IAC,
+    AV_CODEC_ID_ILBC,
+    AV_CODEC_ID_OPUS,
+    AV_CODEC_ID_COMFORT_NOISE,
+    AV_CODEC_ID_TAK,
+
+    /* subtitle codecs */
+    AV_CODEC_ID_FIRST_SUBTITLE = 0x17000,          ///< A dummy ID pointing at the start of subtitle codecs.
+    AV_CODEC_ID_DVD_SUBTITLE = 0x17000,
+    AV_CODEC_ID_DVB_SUBTITLE,
+    AV_CODEC_ID_TEXT,  ///< raw UTF-8 text
+    AV_CODEC_ID_XSUB,
+    AV_CODEC_ID_SSA,
+    AV_CODEC_ID_MOV_TEXT,
+    AV_CODEC_ID_HDMV_PGS_SUBTITLE,
+    AV_CODEC_ID_DVB_TELETEXT,
+    AV_CODEC_ID_SRT,
+
+    /* other specific kind of codecs (generally used for attachments) */
+    AV_CODEC_ID_FIRST_UNKNOWN = 0x18000,           ///< A dummy ID pointing at the start of various fake codecs.
+    AV_CODEC_ID_TTF = 0x18000,
+
+    AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it
+
+    AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS
+                                * stream (only used by libavformat) */
+    AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems
+                                * stream (only used by libavformat) */
+    AV_CODEC_ID_FFMETADATA = 0x21000,   ///< Dummy codec for streams containing only metadata information.
+
+#if FF_API_CODEC_ID
+#include "old_codec_ids.h"
+#endif
+};
+
+#if FF_API_CODEC_ID
+#define CodecID AVCodecID
+#endif
+
+/**
+ * This struct describes the properties of a single codec described by an
+ * AVCodecID.
+ * @see avcodec_get_descriptor()
+ */
+typedef struct AVCodecDescriptor {
+    enum AVCodecID     id;
+    enum AVMediaType type;
+    /**
+     * Name of the codec described by this descriptor. It is non-empty and
+     * unique for each codec descriptor. It should contain alphanumeric
+     * characters and '_' only.
+     */
+    const char      *name;
+    /**
+     * A more descriptive name for this codec. May be NULL.
+     */
+    const char *long_name;
+    /**
+     * Codec properties, a combination of AV_CODEC_PROP_* flags.
+     */
+    int             props;
+} AVCodecDescriptor;
+
+/**
+ * Codec uses only intra compression.
+ * Video codecs only.
+ */
+#define AV_CODEC_PROP_INTRA_ONLY    (1 << 0)
+/**
+ * Codec supports lossy compression. Audio and video codecs only.
+ * @note a codec may support both lossy and lossless
+ * compression modes
+ */
+#define AV_CODEC_PROP_LOSSY         (1 << 1)
+/**
+ * Codec supports lossless compression. Audio and video codecs only.
+ */
+#define AV_CODEC_PROP_LOSSLESS      (1 << 2)
+
+#if FF_API_OLD_DECODE_AUDIO
+/* in bytes */
+#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+#endif
+
+/**
+ * @ingroup lavc_decoding
+ * Required number of additionally allocated bytes at the end of the input bitstream for decoding.
+ * This is mainly needed because some optimized bitstream readers read
+ * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 8 + +/** + * @ingroup lavc_encoding + * minimum encoding buffer size + * Used to avoid some checks during header writing. + */ +#define FF_MIN_BUFFER_SIZE 16384 + + +/** + * @ingroup lavc_encoding + * motion estimation type. + */ +enum Motion_Est_ID { + ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, ///< enhanced predictive zonal search + ME_X1, ///< reserved for experiments + ME_HEX, ///< hexagon based search + ME_UMH, ///< uneven multi-hexagon search + ME_ITER, ///< iterative search + ME_TESA, ///< transformed exhaustive search algorithm +}; + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVColorPrimaries{ + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_BT470M = 4, + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, + AVCOL_PRI_NB , ///< Not part of ABI +}; + +enum AVColorTransferCharacteristic{ + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_NB , ///< Not part of ABI +}; + +enum AVColorSpace{ + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_NB , ///< Not part of ABI +}; + +enum AVColorRange{ + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB , ///< Not part of ABI +}; + +/** + * X X 3 4 X X are luma samples, + * 1 2 1-6 are possible chroma positions + * X X 5 6 X 0 is undefined/unknown position + */ +enum AVChromaLocation{ + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default + AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 + AVCHROMA_LOC_TOPLEFT = 3, ///< DV + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB , ///< Not part of ABI +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * @ingroup lavc_encoding + */ +typedef struct RcOverride{ + int start_frame; + int end_frame; + int qscale; // If this is 0 then quality_factor will be used instead. + float quality_factor; +} RcOverride; + +#define FF_MAX_B_FRAMES 16 + +/* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*/ + +#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. +#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. +#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. +#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. +#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>. +/** + * The parent program guarantees that the input for B-frames containing + * streams is not written to for at least s->max_b_frames+1 frames, if + * this is not set the input will be copied. + */ +#define CODEC_FLAG_INPUT_PRESERVED 0x0100 +#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. +#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. +#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. +#define CODEC_FLAG_EMU_EDGE 0x4000 ///< Don't draw edges. +#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. +#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random + location instead of only at frame boundaries. */ +#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization. +#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. +#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. +#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. +#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). +/* Fx : Flag for h263+ extra options */ +#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction +#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter +#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation +#define CODEC_FLAG_CLOSED_GOP 0x80000000 +#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. +#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. +#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. +#if FF_API_MPV_GLOBAL_OPTS +#define CODEC_FLAG_CBP_RD 0x04000000 ///< Use rate distortion optimization for cbp. +#define CODEC_FLAG_QP_RD 0x08000000 ///< Use rate distortion optimization for qp selectioon. +#define CODEC_FLAG2_STRICT_GOP 0x00000002 ///< Strictly enforce GOP size. +#define CODEC_FLAG2_SKIP_RD 0x00004000 ///< RD optimal MB level residual skipping +#endif +#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define CODEC_CAP_DR1 0x0002 +#define CODEC_CAP_TRUNCATED 0x0008 +/* Codec can export data for HW decoding (XvMC). */ +#define CODEC_CAP_HWACCEL 0x0010 +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define CODEC_CAP_DELAY 0x0020 +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define CODEC_CAP_HWACCEL_VDPAU 0x0080 +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define CODEC_CAP_SUBFRAMES 0x0100 +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 +/** + * Codec is able to deal with negative linesizes + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE 0x4000 +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define CODEC_CAP_AUTO_THREADS 0x8000 +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 + +//The following defines may change, don't expect compatibility if you use them. +#define MB_TYPE_INTRA4x4 0x0001 +#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific +#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific +#define MB_TYPE_16x16 0x0008 +#define MB_TYPE_16x8 0x0010 +#define MB_TYPE_8x16 0x0020 +#define MB_TYPE_8x8 0x0040 +#define MB_TYPE_INTERLACED 0x0080 +#define MB_TYPE_DIRECT2 0x0100 //FIXME +#define MB_TYPE_ACPRED 0x0200 +#define MB_TYPE_GMC 0x0400 +#define MB_TYPE_SKIP 0x0800 +#define MB_TYPE_P0L0 0x1000 +#define MB_TYPE_P1L0 0x2000 +#define MB_TYPE_P0L1 0x4000 +#define MB_TYPE_P1L1 0x8000 +#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) +#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) +#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) +#define MB_TYPE_QUANT 0x00010000 +#define MB_TYPE_CBP 0x00020000 +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan{ + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +}AVPanScan; + +#define FF_QSCALE_TYPE_MPEG1 0 +#define FF_QSCALE_TYPE_MPEG2 1 +#define FF_QSCALE_TYPE_H264 2 +#define FF_QSCALE_TYPE_VP56 3 + +#define FF_BUFFER_TYPE_INTERNAL 1 +#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) +#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. +#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. + +#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). +#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. +#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. +#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). + +/** + * @defgroup lavc_packet AVPacket + * + * Types and functions for working with AVPacket. + * @{ + */ +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, + AV_PKT_DATA_NEW_EXTRADATA, + + /** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * @code + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + * @endcode + */ + AV_PKT_DATA_PARAM_CHANGE, + + /** + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of + * structures with info about macroblocks relevant to splitting the + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). + * That is, it does not necessarily contain info about all macroblocks, + * as long as the distance between macroblocks in the info is smaller + * than the target payload size. + * Each MB info structure is 12 bytes, and is laid out as follows: + * @code + * u32le bit offset from the start of the packet + * u8 current quantizer at the start of the macroblock + * u8 GOB number + * u16le macroblock address within the GOB + * u8 horizontal MV predictor + * u8 vertical MV predictor + * u8 horizontal MV predictor for block number 3 + * u8 vertical MV predictor for block number 3 + * @endcode + */ + AV_PKT_DATA_H263_MB_INFO, +}; + +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. + * + * AVPacket is one of the few structs in Libav, whose size is a part of public + * ABI. Thus it may be allocated on stack and no new fields can be added to it + * without libavcodec and libavformat major bump. + * + * The semantics of data ownership depends on the destruct field. + * If it is set, the packet data is dynamically allocated and is valid + * indefinitely until av_free_packet() is called (which in turn calls the + * destruct callback to free the data). If destruct is not set, the packet data + * is typically backed by some static buffer somewhere and is only valid for a + * limited time (e.g. until the next read call when demuxing). + * + * The side data is always allocated with av_malloc() and is freed in + * av_free_packet(). + */ +typedef struct AVPacket { + /** + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + */ + int64_t pts; + /** + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + */ + int64_t dts; + uint8_t *data; + int size; + int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ + int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + struct { + uint8_t *data; + int size; + enum AVPacketSideDataType type; + } *side_data; + int side_data_elems; + + /** + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + */ + int duration; + void (*destruct)(struct AVPacket *); + void *priv; + int64_t pos; ///< byte position in stream, -1 if unknown + + /** + * Time difference in AVStream->time_base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current packet. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; +} AVPacket; +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; +/** + * @} + */ + +/** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using avcodec_alloc_frame() and freed with + * avcodec_free_frame(). Note that this allocates only the AVFrame itself. The + * buffers for the data must be managed through other means. + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, avcodec_get_frame_defaults() should be used to + * reset the frame to its original clean state before it is reused again. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + */ +typedef struct AVFrame { +#define AV_NUM_DATA_POINTERS 8 + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + * - encoding: Set by user + * - decoding: set by AVCodecContext.get_buffer() + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * Size, in bytes, of the data for each picture/channel plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * - encoding: Set by user + * - decoding: set by AVCodecContext.get_buffer() + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data will always be set by get_buffer(), + * but for planar audio with more channels that can fit in data, + * extended_data must be used by the decoder in order to access all + * channels. + * + * encoding: set by user + * decoding: set by AVCodecContext.get_buffer() + */ + uint8_t **extended_data; + + /** + * width and height of the video frame + * - encoding: unused + * - decoding: Read by user. + */ + int width, height; + + /** + * number of audio samples (per channel) described by this frame + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + int nb_samples; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + * - encoding: unused + * - decoding: Read by user. + */ + int format; + + /** + * 1 -> keyframe, 0-> not + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int key_frame; + + /** + * Picture type of the frame, see ?_TYPE below. + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + */ + enum AVPictureType pict_type; + + /** + * pointer to the first allocated byte of the picture. Can be used in get_buffer/release_buffer. + * This isn't used by libavcodec unless the default get/release_buffer() is used. + * - encoding: + * - decoding: + */ + uint8_t *base[AV_NUM_DATA_POINTERS]; + + /** + * sample aspect ratio for the video frame, 0/1 if unknown/unspecified + * - encoding: unused + * - decoding: Read by user. + */ + AVRational sample_aspect_ratio; + + /** + * presentation timestamp in time_base units (time when frame should be shown to user) + * If AV_NOPTS_VALUE then frame_rate = 1/time_base will be assumed. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + */ + int64_t pts; + + /** + * pts copied from the AVPacket that was decoded to produce this frame + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_pts; + + /** + * dts copied from the AVPacket that triggered returning this frame + * - encoding: unused + * - decoding: Read by user. + */ + int64_t pkt_dts; + + /** + * picture number in bitstream order + * - encoding: set by + * - decoding: Set by libavcodec. + */ + int coded_picture_number; + /** + * picture number in display order + * - encoding: set by + * - decoding: Set by libavcodec. + */ + int display_picture_number; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + * - encoding: Set by libavcodec. for coded_picture (and set by user for input). + * - decoding: Set by libavcodec. + */ + int quality; + + /** + * is this picture used as reference + * The values for this are the same as the MpegEncContext.picture_structure + * variable, that is 1->top field, 2->bottom field, 3->frame/both fields. + * Set to 4 for delayed, non-reference frames. + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + */ + int reference; + + /** + * QP table + * - encoding: unused + * - decoding: Set by libavcodec. + */ + int8_t *qscale_table; + /** + * QP store stride + * - encoding: unused + * - decoding: Set by libavcodec. + */ + int qstride; + + /** + * + */ + int qscale_type; + + /** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + * - encoding: unused + * - decoding: Set by libavcodec. + */ + uint8_t *mbskip_table; + + /** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t (*motion_val[2])[2]; + + /** + * macroblock type table + * mb_type_base + mb_width + 2 + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + uint32_t *mb_type; + + /** + * DCT coefficients + * - encoding: unused + * - decoding: Set by libavcodec. + */ + short *dct_coeff; + + /** + * motion reference frame index + * the order in which these are stored can depend on the codec. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int8_t *ref_index[2]; + + /** + * for some private data of the user + * - encoding: unused + * - decoding: Set by user. + */ + void *opaque; + + /** + * error + * - encoding: Set by libavcodec. if flags&CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * type of the buffer (to keep track of who has to deallocate data[*]) + * - encoding: Set by the one who allocates it. + * - decoding: Set by the one who allocates it. + * Note: User allocated (direct rendering) & internal buffers cannot coexist currently. + */ + int type; + + /** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + * - encoding: unused + * - decoding: Set by libavcodec. + */ + int repeat_pict; + + /** + * The content of the picture is interlaced. + * - encoding: Set by user. + * - decoding: Set by libavcodec. (default 0) + */ + int interlaced_frame; + + /** + * If the content is interlaced, is top field displayed first. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int top_field_first; + + /** + * Tell user application that palette has changed from previous frame. + * - encoding: ??? (no palette-enabled encoder yet) + * - decoding: Set by libavcodec. (default 0). + */ + int palette_has_changed; + + /** + * codec suggestion on buffer type if != 0 + * - encoding: unused + * - decoding: Set by libavcodec. (before get_buffer() call)). + */ + int buffer_hints; + + /** + * Pan scan. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVPanScan *pan_scan; + + /** + * reordered opaque 64bit (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + * - encoding: unused + * - decoding: Read by user. + */ + int64_t reordered_opaque; + + /** + * hardware accelerator private data (Libav-allocated) + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *hwaccel_picture_private; + + /** + * the AVCodecContext which ff_thread_get_buffer() was last called on + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + struct AVCodecContext *owner; + + /** + * used by multithreading to store frame-specific info + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + void *thread_opaque; + + /** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + * - encoding: unused + * - decoding: Set by libavcodec. + */ + uint8_t motion_subsample_log2; + + /** + * Sample rate of the audio data. + * + * - encoding: unused + * - decoding: set by get_buffer() + */ + int sample_rate; + + /** + * Channel layout of the audio data. + * + * - encoding: unused + * - decoding: set by get_buffer() + */ + uint64_t channel_layout; +} AVFrame; + +struct AVCodecInternal; + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + +/** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVCodecContext) must not be used outside libav*. + */ +typedef struct AVCodecContext { + /** + * information on struct for av_log + * - set by avcodec_alloc_context3 + */ + const AVClass *av_class; + int log_level_offset; + + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ + const struct AVCodec *codec; + char codec_name[32]; + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ + + /** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger than 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int codec_tag; + + /** + * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * - encoding: unused + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int stream_codec_tag; + +#if FF_API_SUB_ID + /** + * @deprecated this field is unused + */ + attribute_deprecated int sub_id; +#endif + + void *priv_data; + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + */ + void *opaque; + + /** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + */ + int bit_rate; + + /** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + */ + int bit_rate_tolerance; + + /** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + */ + int global_quality; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int compression_level; +#define FF_COMPRESSION_DEFAULT -1 + + /** + * CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags; + + /** + * CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags2; + + /** + * some codecs need / can use extradata like Huffman tables. + * mjpeg: Huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * than extradata_size to avoid prolems if it is read with the bitstream reader. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness. + * - encoding: Set/allocated/freed by libavcodec. + * - decoding: Set/allocated/freed by user. + */ + uint8_t *extradata; + int extradata_size; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + */ + AVRational time_base; + + /** + * For some codecs, the time base is closer to the field rate than the frame rate. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration + * if no telecine is used ... + * + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. + */ + int ticks_per_frame; + + /** + * Codec delay. + * + * Video: + * Number of frames the decoded output will be delayed relative to the + * encoded input. + * + * Audio: + * For encoding, this is the number of "priming" samples added to the + * beginning of the stream. The decoded output will be delayed by this + * many samples relative to the input to the encoder. Note that this + * field is purely informational and does not directly affect the pts + * output by the encoder, which should always be based on the actual + * presentation time, including any delay. + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. + * + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int delay; + + + /* video only */ + /** + * picture width / height. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + * Note: For compatibility it is possible to set this instead of + * coded_width/height before decoding. + */ + int width, height; + + /** + * Bitstream width / height, may be different from width/height. + * - encoding: unused + * - decoding: Set by user before init if known. Codec should override / dynamically change if needed. + */ + int coded_width, coded_height; + +#define FF_ASPECT_EXTENDED 15 + + /** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + */ + int gop_size; + + /** + * Pixel format, see AV_PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overriden by the decoder if it knows better. + * - encoding: Set by user. + * - decoding: Set by user if known, overridden by libavcodec if known + */ + enum AVPixelFormat pix_fmt; + + /** + * Motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 9 (iter), 10 (tesa) [7, 8, 10 are x264 specific, 9 is snow specific] + * - encoding: MUST be set by user. + * - decoding: unused + */ + int me_method; + + /** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + */ + void (*draw_horiz_band)(struct AVCodecContext *s, + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], + int y, int type, int height); + + /** + * callback to negotiate the pixelFormat + * @param fmt is the list of formats which are supported by the codec, + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. + * The first is always the native one. + * @return the chosen format + * - encoding: unused + * - decoding: Set by user, if not set the native format will be chosen. + */ + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + + /** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + */ + int max_b_frames; + + /** + * qscale factor between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_factor; + + /** obsolete FIXME remove */ + int rc_strategy; +#define FF_RC_STRATEGY_XVID 1 + + int b_frame_strategy; + +#if FF_API_MPV_GLOBAL_OPTS + /** + * luma single coefficient elimination threshold + * - encoding: Set by user. + * - decoding: unused + */ + attribute_deprecated int luma_elim_threshold; + + /** + * chroma single coeff elimination threshold + * - encoding: Set by user. + * - decoding: unused + */ + attribute_deprecated int chroma_elim_threshold; +#endif + + /** + * qscale offset between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_offset; + + /** + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int has_b_frames; + + /** + * 0-> h263 quant 1-> mpeg quant + * - encoding: Set by user. + * - decoding: unused + */ + int mpeg_quant; + + /** + * qscale factor between P and I-frames + * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_factor; + + /** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_offset; + + /** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float lumi_masking; + + /** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float temporal_cplx_masking; + + /** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float spatial_cplx_masking; + + /** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float p_masking; + + /** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float dark_masking; + + /** + * slice count + * - encoding: Set by libavcodec. + * - decoding: Set by user (or 0). + */ + int slice_count; + /** + * prediction method (needed for huffyuv) + * - encoding: Set by user. + * - decoding: unused + */ + int prediction_method; +#define FF_PRED_LEFT 0 +#define FF_PRED_PLANE 1 +#define FF_PRED_MEDIAN 2 + + /** + * slice offsets in the frame in bytes + * - encoding: Set/allocated by libavcodec. + * - decoding: Set/allocated by user (or NULL). + */ + int *slice_offset; + + /** + * sample aspect ratio (0 if unknown) + * That is the width of a pixel divided by the height of the pixel. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVRational sample_aspect_ratio; + + /** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_cmp; + /** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_sub_cmp; + /** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + */ + int mb_cmp; + /** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int ildct_cmp; +#define FF_CMP_SAD 0 +#define FF_CMP_SSE 1 +#define FF_CMP_SATD 2 +#define FF_CMP_DCT 3 +#define FF_CMP_PSNR 4 +#define FF_CMP_BIT 5 +#define FF_CMP_RD 6 +#define FF_CMP_ZERO 7 +#define FF_CMP_VSAD 8 +#define FF_CMP_VSSE 9 +#define FF_CMP_NSSE 10 +#define FF_CMP_W53 11 +#define FF_CMP_W97 12 +#define FF_CMP_DCTMAX 13 +#define FF_CMP_DCT264 14 +#define FF_CMP_CHROMA 256 + + /** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int dia_size; + + /** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + */ + int last_predictor_count; + + /** + * prepass for motion estimation + * - encoding: Set by user. + * - decoding: unused + */ + int pre_me; + + /** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_pre_cmp; + + /** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int pre_dia_size; + + /** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + */ + int me_subpel_quality; + + /** + * DTG active format information (additional aspect ratio + * information only used in DVB MPEG-2 transport streams) + * 0 if not set. + * + * - encoding: unused + * - decoding: Set by decoder. + */ + int dtg_active_format; +#define FF_DTG_AFD_SAME 8 +#define FF_DTG_AFD_4_3 9 +#define FF_DTG_AFD_16_9 10 +#define FF_DTG_AFD_14_9 11 +#define FF_DTG_AFD_4_3_SP_14_9 13 +#define FF_DTG_AFD_16_9_SP_14_9 14 +#define FF_DTG_AFD_SP_4_3 15 + + /** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_range; + + /** + * intra quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int intra_quant_bias; +#define FF_DEFAULT_QUANT_BIAS 999999 + + /** + * inter quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int inter_quant_bias; + +#if FF_API_COLOR_TABLE_ID + /** + * color table ID + * - encoding: unused + * - decoding: Which clrtable should be used for 8bit RGB images. + * Tables have to be stored somewhere. FIXME + */ + attribute_deprecated int color_table_id; +#endif + + /** + * slice flags + * - encoding: unused + * - decoding: Set by user. + */ + int slice_flags; +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + /** + * XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder + */ + int xvmc_acceleration; + + /** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + */ + int mb_decision; +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits +#define FF_MB_DECISION_RD 2 ///< rate distortion + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *intra_matrix; + + /** + * custom inter quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *inter_matrix; + + /** + * scene change detection threshold + * 0 is default, larger means fewer detected scene changes. + * - encoding: Set by user. + * - decoding: unused + */ + int scenechange_threshold; + + /** + * noise reduction strength + * - encoding: Set by user. + * - decoding: unused + */ + int noise_reduction; + +#if FF_API_INTER_THRESHOLD + /** + * @deprecated this field is unused + */ + attribute_deprecated int inter_threshold; +#endif + +#if FF_API_MPV_GLOBAL_OPTS + /** + * @deprecated use mpegvideo private options instead + */ + attribute_deprecated int quantizer_noise_shaping; +#endif + + /** + * Motion estimation threshold below which no motion estimation is + * performed, but instead the user specified motion vectors are used. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_threshold; + + /** + * Macroblock threshold below which the user specified macroblock types will be used. + * - encoding: Set by user. + * - decoding: unused + */ + int mb_threshold; + + /** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: unused + */ + int intra_dc_precision; + + /** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_top; + + /** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_bottom; + + /** + * Border processing masking, raises the quantizer for mbs on the borders + * of the picture. + * - encoding: Set by user. + * - decoding: unused + */ + float border_masking; + + /** + * minimum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmin; + + /** + * maximum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmax; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_penalty_compensation; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int bidir_refine; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int brd_scale; + + /** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + */ + int keyint_min; + + /** + * number of reference frames + * - encoding: Set by user. + * - decoding: Set by lavc. + */ + int refs; + + /** + * chroma qp offset from luma + * - encoding: Set by user. + * - decoding: unused + */ + int chromaoffset; + + /** + * Multiplied by qscale for each frame and added to scene_change_score. + * - encoding: Set by user. + * - decoding: unused + */ + int scenechange_factor; + + /** + * + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + */ + int mv0_threshold; + + /** + * Adjust sensitivity of b_frame_strategy 1. + * - encoding: Set by user. + * - decoding: unused + */ + int b_sensitivity; + + /** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorPrimaries color_primaries; + + /** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + /** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVChromaLocation chroma_sample_location; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by libavcodec + */ + enum AVFieldOrder field_order; + + /* audio only */ + int sample_rate; ///< samples per second + int channels; ///< number of audio channels + + /** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVSampleFormat sample_fmt; ///< sample format + + /* The following data should not be initialized. */ + /** + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size + */ + int frame_size; + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int frame_number; + + /** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + */ + int block_align; + + /** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + */ + int cutoff; + +#if FF_API_REQUEST_CHANNELS + /** + * Decoder should decode to this many channels if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + * @deprecated Deprecated in favor of request_channel_layout. + */ + int request_channels; +#endif + + /** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + uint64_t channel_layout; + + /** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + */ + uint64_t request_channel_layout; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * Used to request a sample format from the decoder. + * - encoding: unused. + * - decoding: Set by user. + */ + enum AVSampleFormat request_sample_fmt; + + /** + * Called at the beginning of each frame to get a buffer for it. + * + * The function will set AVFrame.data[], AVFrame.linesize[]. + * AVFrame.extended_data[] must also be set, but it should be the same as + * AVFrame.data[] except for planar audio with more channels than can fit + * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as + * many data pointers as it can hold. + * + * if CODEC_CAP_DR1 is not set then get_buffer() must call + * avcodec_default_get_buffer() instead of providing buffers allocated by + * some other means. + * + * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't + * need it. avcodec_default_get_buffer() aligns the output buffer properly, + * but if get_buffer() is overridden then alignment considerations should + * be taken into account. + * + * @see avcodec_default_get_buffer() + * + * Video: + * + * If pic.reference is set then the frame will be read later by libavcodec. + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at + * once. Does not need to be reentrant. + * + * @see release_buffer(), reget_buffer() + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * Decoders cannot use the buffer after returning from + * avcodec_decode_audio4(), so they will not call release_buffer(), as it + * is assumed to be released immediately upon return. In some rare cases, + * a decoder may need to call get_buffer() more than once in a single + * call to avcodec_decode_audio4(). In that case, when get_buffer() is + * called again after it has already been called once, the previously + * acquired buffer is assumed to be released at that time and may not be + * reused by the decoder. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called to release buffers which were allocated with get_buffer. + * A released buffer can be reused in get_buffer(). + * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called at the beginning of a frame to get cr buffer for it. + * Buffer type (size, hints) must be the same. libavcodec won't check it. + * libavcodec will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * If pic.data[0] == NULL must behave like get_buffer(). + * if CODEC_CAP_DR1 is not set then reget_buffer() must call + * avcodec_default_reget_buffer() instead of providing buffers allocated by + * some other means. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); + + + /* - encoding parameters */ + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + float qblur; ///< amount of qscale smoothing over time (0.0-1.0) + + /** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmin; + + /** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmax; + + /** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + */ + int max_qdiff; + + /** + * ratecontrol qmin qmax limiting method + * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. + * - encoding: Set by user. + * - decoding: unused + */ + float rc_qsquish; + + float rc_qmod_amp; + int rc_qmod_freq; + + /** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: unused + */ + int rc_buffer_size; + + /** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + int rc_override_count; + RcOverride *rc_override; + + /** + * rate control equation + * - encoding: Set by user + * - decoding: unused + */ + const char *rc_eq; + + /** + * maximum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_max_rate; + + /** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_min_rate; + + float rc_buffer_aggressivity; + + /** + * initial complexity for pass1 ratecontrol + * - encoding: Set by user. + * - decoding: unused + */ + float rc_initial_cplx; + + /** + * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_max_available_vbv_use; + + /** + * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_min_vbv_overflow_use; + + /** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + */ + int rc_initial_buffer_occupancy; + +#define FF_CODER_TYPE_VLC 0 +#define FF_CODER_TYPE_AC 1 +#define FF_CODER_TYPE_RAW 2 +#define FF_CODER_TYPE_RLE 3 +#define FF_CODER_TYPE_DEFLATE 4 + /** + * coder type + * - encoding: Set by user. + * - decoding: unused + */ + int coder_type; + + /** + * context model + * - encoding: Set by user. + * - decoding: unused + */ + int context_model; + + /** + * minimum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int lmin; + + /** + * maximum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int lmax; + + /** + * frame skip threshold + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_threshold; + + /** + * frame skip factor + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_factor; + + /** + * frame skip exponent + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_exp; + + /** + * frame skip comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_cmp; + + /** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + */ + int trellis; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int min_prediction_order; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int max_prediction_order; + + /** + * GOP timecode frame start number, in non drop frame format + * - encoding: Set by user. + * - decoding: unused + */ + int64_t timecode_frame_start; + + /* The RTP callback: This function is called */ + /* every time the encoder has a packet to send. */ + /* It depends on the encoder if the data starts */ + /* with a Start Code (it should). H.263 does. */ + /* mb_nb contains the number of macroblocks */ + /* encoded in the RTP payload. */ + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); + + int rtp_payload_size; /* The size of the RTP payload: the coder will */ + /* do its best to deliver a chunk with size */ + /* below rtp_payload_size, the chunk will start */ + /* with a start code on some codecs like H.263. */ + /* This doesn't take account of any particular */ + /* headers inside the transmitted RTP payload. */ + + /* statistics, used for 2-pass encoding */ + int mv_bits; + int header_bits; + int i_tex_bits; + int p_tex_bits; + int i_count; + int p_count; + int skip_count; + int misc_bits; + + /** + * number of bits used for the previously encoded frame + * - encoding: Set by libavcodec. + * - decoding: unused + */ + int frame_bits; + + /** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + */ + char *stats_out; + + /** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + char *stats_in; + + /** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + */ + int workaround_bugs; +#define FF_BUG_AUTODETECT 1 ///< autodetection +#define FF_BUG_OLD_MSMPEG4 2 +#define FF_BUG_XVID_ILACE 4 +#define FF_BUG_UMP4 8 +#define FF_BUG_NO_PADDING 16 +#define FF_BUG_AMV 32 +#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. +#define FF_BUG_QPEL_CHROMA 64 +#define FF_BUG_STD_QPEL 128 +#define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 +#define FF_BUG_EDGE 1024 +#define FF_BUG_HPEL_CHROMA 2048 +#define FF_BUG_DC_CLIP 4096 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 + + /** + * strictly follow the standard (MPEG4, ...). + * - encoding: Set by user. + * - decoding: Set by user. + * Setting this to STRICT or higher means the encoder and decoder will + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly + * (=strictly conform to the specs) + */ + int strict_std_compliance; +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. + + /** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + */ + int error_concealment; +#define FF_EC_GUESS_MVS 1 +#define FF_EC_DEBLOCK 2 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug; +#define FF_DEBUG_PICT_INFO 1 +#define FF_DEBUG_RC 2 +#define FF_DEBUG_BITSTREAM 4 +#define FF_DEBUG_MB_TYPE 8 +#define FF_DEBUG_QP 16 +#define FF_DEBUG_MV 32 +#define FF_DEBUG_DCT_COEFF 0x00000040 +#define FF_DEBUG_SKIP 0x00000080 +#define FF_DEBUG_STARTCODE 0x00000100 +#define FF_DEBUG_PTS 0x00000200 +#define FF_DEBUG_ER 0x00000400 +#define FF_DEBUG_MMCO 0x00000800 +#define FF_DEBUG_BUGS 0x00001000 +#define FF_DEBUG_VIS_QP 0x00002000 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000 +#define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int err_recognition; +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) +#define AV_EF_BUFFER (1<<2) +#define AV_EF_EXPLODE (1<<3) + + /** + * opaque 64bit number (generally a PTS) that will be reordered and + * output in AVFrame.reordered_opaque + * @deprecated in favor of pkt_pts + * - encoding: unused + * - decoding: Set by user. + */ + int64_t reordered_opaque; + + /** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + */ + struct AVHWAccel *hwaccel; + + /** + * Hardware accelerator context. + * For some hardware accelerators, a global context needs to be + * provided by the user. In that case, this holds display-dependent + * data Libav cannot instantiate itself. Please refer to the + * Libav HW accelerator documentation to know how to fill this + * is. e.g. for VA API, this is a struct vaapi_context. + * - encoding: unused + * - decoding: Set by user + */ + void *hwaccel_context; + + /** + * error + * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + */ + int dct_algo; +#define FF_DCT_AUTO 0 +#define FF_DCT_FASTINT 1 +#define FF_DCT_INT 2 +#define FF_DCT_MMX 3 +#define FF_DCT_ALTIVEC 5 +#define FF_DCT_FAAN 6 + + /** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int idct_algo; +#define FF_IDCT_AUTO 0 +#define FF_IDCT_INT 1 +#define FF_IDCT_SIMPLE 2 +#define FF_IDCT_SIMPLEMMX 3 +#if FF_API_LIBMPEG2 +#define FF_IDCT_LIBMPEG2MMX 4 +#endif +#if FF_API_MMI +#define FF_IDCT_MMI 5 +#endif +#define FF_IDCT_ARM 7 +#define FF_IDCT_ALTIVEC 8 +#define FF_IDCT_SH4 9 +#define FF_IDCT_SIMPLEARM 10 +#define FF_IDCT_H264 11 +#define FF_IDCT_VP3 12 +#define FF_IDCT_IPP 13 +#define FF_IDCT_XVIDMMX 14 +#define FF_IDCT_CAVS 15 +#define FF_IDCT_SIMPLEARMV5TE 16 +#define FF_IDCT_SIMPLEARMV6 17 +#define FF_IDCT_SIMPLEVIS 18 +#define FF_IDCT_WMV2 19 +#define FF_IDCT_FAAN 20 +#define FF_IDCT_EA 21 +#define FF_IDCT_SIMPLENEON 22 +#define FF_IDCT_SIMPLEALPHA 23 +#define FF_IDCT_BINK 24 + +#if FF_API_DSP_MASK + /** + * Unused. + * @deprecated use av_set_cpu_flags_mask() instead. + */ + attribute_deprecated unsigned dsp_mask; +#endif + + /** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + */ + int bits_per_coded_sample; + + /** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + int bits_per_raw_sample; + + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + */ + attribute_deprecated int lowres; + + /** + * the picture in the bitstream + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + AVFrame *coded_frame; + + /** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_count; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * synchronously from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. + * @param c context passed also to func + * @param count the number of things to execute + * @param arg2 argument passed unchanged to func + * @param ret return values of executed functions, must have space for "count" values. May be NULL. + * @param func function that will be called count times, with jobnr from 0 to count-1. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no + * two instances of func executing at the same time will have the same threadnr. + * @return always 0 currently, but code should handle a future improvement where when any call to func + * returns < 0 no further calls to func may be done and < 0 is returned. + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); + + /** + * thread opaque + * Can be used by execute() to store some per AVCodecContext stuff. + * - encoding: set by execute() + * - decoding: set by execute() + */ + void *thread_opaque; + + /** + * noise vs. sse weight for the nsse comparsion function + * - encoding: Set by user. + * - decoding: unused + */ + int nsse_weight; + + /** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int profile; +#define FF_PROFILE_UNKNOWN -99 +#define FF_PROFILE_RESERVED -100 + +#define FF_PROFILE_AAC_MAIN 0 +#define FF_PROFILE_AAC_LOW 1 +#define FF_PROFILE_AAC_SSR 2 +#define FF_PROFILE_AAC_LTP 3 +#define FF_PROFILE_AAC_HE 4 +#define FF_PROFILE_AAC_HE_V2 28 +#define FF_PROFILE_AAC_LD 22 +#define FF_PROFILE_AAC_ELD 38 + +#define FF_PROFILE_DTS 20 +#define FF_PROFILE_DTS_ES 30 +#define FF_PROFILE_DTS_96_24 40 +#define FF_PROFILE_DTS_HD_HRA 50 +#define FF_PROFILE_DTS_HD_MA 60 + +#define FF_PROFILE_MPEG2_422 0 +#define FF_PROFILE_MPEG2_HIGH 1 +#define FF_PROFILE_MPEG2_SS 2 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 +#define FF_PROFILE_MPEG2_MAIN 4 +#define FF_PROFILE_MPEG2_SIMPLE 5 + +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444 144 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 + +#define FF_PROFILE_VC1_SIMPLE 0 +#define FF_PROFILE_VC1_MAIN 1 +#define FF_PROFILE_VC1_COMPLEX 2 +#define FF_PROFILE_VC1_ADVANCED 3 + +#define FF_PROFILE_MPEG4_SIMPLE 0 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 +#define FF_PROFILE_MPEG4_CORE 2 +#define FF_PROFILE_MPEG4_MAIN 3 +#define FF_PROFILE_MPEG4_N_BIT 4 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 +#define FF_PROFILE_MPEG4_HYBRID 8 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 + + /** + * level + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int level; +#define FF_LEVEL_UNKNOWN -99 + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_loop_filter; + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_idct; + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_frame; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open2()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; + + /** + * Simulates errors in the bitstream to test error concealment. + * - encoding: Set by user. + * - decoding: unused + */ + int error_rate; + + /** + * Current packet as passed into the decoder, to avoid having + * to pass the packet into every function. Currently only valid + * inside lavc and get/release_buffer callbacks. + * - decoding: set by avcodec_decode_*, read by get_buffer() for setting pkt_pts + * - encoding: unused + */ + AVPacket *pkt; + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; +} AVCodecContext; + +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +typedef struct AVCodecDefault AVCodecDefault; + +struct AVSubtitle; + +/** + * AVCodec. + */ +typedef struct AVCodec { + /** + * Name of the codec implementation. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + * This is the primary way to find a codec from the user perspective. + */ + const char *name; + /** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *long_name; + enum AVMediaType type; + enum AVCodecID id; + /** + * Codec capabilities. + * see CODEC_CAP_* + */ + int capabilities; + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 + attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int priv_data_size; + struct AVCodec *next; + /** + * @name Frame-level threading support functions + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ + + /** + * Private codec-specific defaults. + */ + const AVCodecDefault *defaults; + + /** + * Initialize codec static data, called from avcodec_register(). + */ + void (*init_static_data)(struct AVCodec *codec); + + int (*init)(AVCodecContext *); + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); + int (*close)(AVCodecContext *); + /** + * Flush buffers. + * Will be called when seeking + */ + void (*flush)(AVCodecContext *); +} AVCodec; + +/** + * AVHWAccel. + */ +typedef struct AVHWAccel { + /** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + */ + const char *name; + + /** + * Type of codec implemented by the hardware accelerator. + * + * See AVMEDIA_TYPE_xxx + */ + enum AVMediaType type; + + /** + * Codec implemented by the hardware accelerator. + * + * See AV_CODEC_ID_xxx + */ + enum AVCodecID id; + + /** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + */ + enum AVPixelFormat pix_fmt; + + /** + * Hardware accelerated codec capabilities. + * see FF_HWACCEL_CODEC_CAP_* + */ + int capabilities; + + struct AVHWAccel *next; + + /** + * Called at the beginning of each frame or field picture. + * + * Meaningful frame information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * Note that buf can be NULL along with buf_size set to 0. + * Otherwise, this means the whole frame is available at this point. + * + * @param avctx the codec context + * @param buf the frame data buffer base + * @param buf_size the size of the frame in bytes + * @return zero if successful, a negative value otherwise + */ + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Callback for each slice. + * + * Meaningful slice information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * @param avctx the codec context + * @param buf the slice data buffer base + * @param buf_size the size of the slice in bytes + * @return zero if successful, a negative value otherwise + */ + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Called at the end of each frame or field picture. + * + * The whole picture is parsed at this point and can now be sent + * to the hardware accelerator. This function is mandatory. + * + * @param avctx the codec context + * @return zero if successful, a negative value otherwise + */ + int (*end_frame)(AVCodecContext *avctx); + + /** + * Size of HW accelerator private data. + * + * Private data is allocated with av_mallocz() before + * AVCodecContext.get_buffer() and deallocated after + * AVCodecContext.release_buffer(). + */ + int priv_data_size; +} AVHWAccel; + +/** + * @defgroup lavc_picture AVPicture + * + * Functions for working with AVPicture + * @{ + */ + +/** + * four components are given, that's all. + * the last component is alpha + */ +typedef struct AVPicture { + uint8_t *data[AV_NUM_DATA_POINTERS]; + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line +} AVPicture; + +/** + * @} + */ + +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 + +enum AVSubtitleType { + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + /** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + */ + SUBTITLE_TEXT, + + /** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + */ + SUBTITLE_ASS, +}; + +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + +typedef struct AVSubtitleRect { + int x; ///< top left corner of pict, undefined when pict is not set + int y; ///< top left corner of pict, undefined when pict is not set + int w; ///< width of pict, undefined when pict is not set + int h; ///< height of pict, undefined when pict is not set + int nb_colors; ///< number of colors in pict, undefined when pict is not set + + /** + * data+linesize for the bitmap of this subtitle. + * can be set for text/ass as well once they where rendered + */ + AVPicture pict; + enum AVSubtitleType type; + + char *text; ///< 0 terminated plain UTF-8 text + + /** + * 0 terminated ASS/SSA compatible event line. + * The pressentation of this is unaffected by the other values in this + * struct. + */ + char *ass; + int flags; +} AVSubtitleRect; + +typedef struct AVSubtitle { + uint16_t format; /* 0 = graphics */ + uint32_t start_display_time; /* relative to packet pts, in ms */ + uint32_t end_display_time; /* relative to packet pts, in ms */ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE +} AVSubtitle; + +/** + * If c is NULL, returns the first registered codec, + * if c is non-NULL, returns the next registered codec after c, + * or NULL if c is the last one. + */ +AVCodec *av_codec_next(const AVCodec *c); + +/** + * Return the LIBAVCODEC_VERSION_INT constant. + */ +unsigned avcodec_version(void); + +/** + * Return the libavcodec build-time configuration. + */ +const char *avcodec_configuration(void); + +/** + * Return the libavcodec license. + */ +const char *avcodec_license(void); + +/** + * Register the codec codec and initialize libavcodec. + * + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() + */ +void avcodec_register(AVCodec *codec); + +/** + * Register all the codecs, parsers and bitstream filters which were enabled at + * configuration time. If you do not call this function you can select exactly + * which formats you want to support, by using the individual registration + * functions. + * + * @see avcodec_register + * @see av_register_codec_parser + * @see av_register_bitstream_filter + */ +void avcodec_register_all(void); + +/** + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct can be deallocated by calling avcodec_close() on it followed + * by av_free(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). + * + * @return An AVCodecContext filled with default values or NULL on failure. + * @see avcodec_get_context_defaults + */ +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); + +/** + * Set the fields of the given AVCodecContext to default values corresponding + * to the given codec (defaults may be codec-dependent). + * + * Do not call this function if a non-NULL codec has been passed + * to avcodec_alloc_context3() that allocated this AVCodecContext. + * If codec is non-NULL, it is illegal to call avcodec_open2() with a + * different codec on this AVCodecContext. + */ +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +/** + * Copy the settings of the source AVCodecContext into the destination + * AVCodecContext. The resulting destination codec context will be + * unopened, i.e. you are required to call avcodec_open2() before you + * can use this AVCodecContext to decode/encode video/audio data. + * + * @param dest target codec context, should be initialized with + * avcodec_alloc_context3(), but otherwise uninitialized + * @param src source codec context + * @return AVERROR() on error (e.g. memory allocation error), 0 on success + */ +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); + +/** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using avcodec_free_frame(). + * + * @return An AVFrame filled with default values or NULL on failure. + * @see avcodec_get_frame_defaults + */ +AVFrame *avcodec_alloc_frame(void); + +/** + * Set the fields of the given AVFrame to default values. + * + * @param frame The AVFrame of which the fields should be set to default values. + */ +void avcodec_get_frame_defaults(AVFrame *frame); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. + * + * @param frame frame to be freed. The pointer will be set to NULL. + * + * @warning this function does NOT free the data buffers themselves + * (it does not know how, since they might have been allocated with + * a custom get_buffer()). + */ +void avcodec_free_frame(AVFrame **frame); + +/** + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @code + * avcodec_register_all(); + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(AV_CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * @param avctx The context to initialize. + * @param codec The codec to open this context for. If a non-NULL codec has been + * previously passed to avcodec_alloc_context3() or + * avcodec_get_context_defaults3() for this context, then this + * parameter MUST be either NULL or equal to the previously passed + * codec. + * @param options A dictionary filled with AVCodecContext and codec-private options. + * On return this object will be filled with options that were not found. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_find(). + */ +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + +/** + * Close a given AVCodecContext and free all the data associated with it + * (but not the AVCodecContext itself). + * + * Calling this function on an AVCodecContext that hasn't been opened will free + * the codec-specific data allocated in avcodec_alloc_context3() / + * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will + * do nothing. + */ +int avcodec_close(AVCodecContext *avctx); + +/** + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +/** + * @} + */ + +/** + * @addtogroup lavc_packet + * @{ + */ + +/** + * Default packet destructor. + */ +void av_destruct_packet(AVPacket *pkt); + +/** + * Initialize optional fields of a packet with default values. + * + * Note, this does not touch the data and size members, which have to be + * initialized separately. + * + * @param pkt packet + */ +void av_init_packet(AVPacket *pkt); + +/** + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + */ +int av_new_packet(AVPacket *pkt, int size); + +/** + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + */ +void av_shrink_packet(AVPacket *pkt, int size); + +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + +/** + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated. + */ +int av_dup_packet(AVPacket *pkt); + +/** + * Free a packet. + * + * @param pkt packet to free + */ +void av_free_packet(AVPacket *pkt); + +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Shrink the already allocated side data buffer + * + * @param pkt packet + * @param type side information type + * @param size new side information size + * @return 0 on success, < 0 on failure + */ +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + +/** + * @} + */ + +/** + * @addtogroup lavc_decoding + * @{ + */ + +/** + * Find a registered decoder with a matching codec ID. + * + * @param id AVCodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder(enum AVCodecID id); + +/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder_by_name(const char *name); + +int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); +void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); +int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); + +/** + * Return the amount of padding in pixels which the get_buffer callback must + * provide around the edge of the image for codecs which do not have the + * CODEC_FLAG_EMU_EDGE flag. + * + * @return Required padding in pixels. + */ +unsigned avcodec_get_edge_width(void); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased + * according to avcodec_get_edge_width() before. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + * If CODEC_FLAG_EMU_EDGE is not set, the dimensions must have been increased + * according to avcodec_get_edge_width() before. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + +#if FF_API_OLD_DECODE_AUDIO +/** + * Wrapper function which calls avcodec_decode_audio4. + * + * @deprecated Use avcodec_decode_audio4 instead. + * + * Decode the audio frame of size avpkt->size from avpkt->data into samples. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. In this case, + * avcodec_decode_audio3 has to be called again with an AVPacket that contains + * the remaining data in order to decode the second frame etc. + * If no frame + * could be outputted, frame_size_ptr is zero. Otherwise, it is the + * decompressed frame size in bytes. + * + * @warning You must set frame_size_ptr to the allocated size of the + * output buffer before calling avcodec_decode_audio3(). + * + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer avpkt->data should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @warning You must not provide a custom get_buffer() when using + * avcodec_decode_audio3(). Doing so will override it with + * avcodec_default_get_buffer. Use avcodec_decode_audio4() instead, + * which does allow the application to provide a custom get_buffer(). + * + * @note You might have to align the input buffer avpkt->data and output buffer + * samples. The alignment requirements depend on the CPU: On some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. + * + * In practice, avpkt->data should have 4 byte alignment at minimum and + * samples should be 16 byte aligned unless the CPU doesn't need it + * (AltiVec and SSE do). + * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @param avctx the codec context + * @param[out] samples the output buffer, sample type in avctx->sample_fmt + * If the sample format is planar, each channel plane will + * be the same size, with no padding between channels. + * @param[in,out] frame_size_ptr the output buffer size in bytes + * @param[in] avpkt The input AVPacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields. + * All decoders are designed to use the least fields possible though. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame data was decompressed (used) from the input AVPacket. + */ +attribute_deprecated int avcodec_decode_audio3(AVCodecContext *avctx, int16_t *samples, + int *frame_size_ptr, + AVPacket *avpkt); +#endif + +/** + * Decode the audio frame of size avpkt->size from avpkt->data into frame. + * + * Some decoders may support multiple frames in a single AVPacket. Such + * decoders would then just decode the first frame. In this case, + * avcodec_decode_audio4 has to be called again with an AVPacket containing + * the remaining data in order to decode the second frame, etc... + * Even if no frames are returned, the packet needs to be fed to the decoder + * with remaining data until it is completely consumed or an error occurs. + * + * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @note You might have to align the input buffer. The alignment requirements + * depend on the CPU and the decoder. + * + * @param avctx the codec context + * @param[out] frame The AVFrame in which to store decoded audio samples. + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The + * decoder may, however, only utilize part of the buffer by + * setting AVFrame.nb_samples to a smaller value in the + * output frame. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is + * non-zero. + * @param[in] avpkt The input AVPacket containing the input buffer. + * At least avpkt->data and avpkt->size should be set. Some + * decoders might also require additional fields to be set. + * @return A negative error code is returned if an error occurred during + * decoding, otherwise the number of bytes consumed from the input + * AVPacket is returned. + */ +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, + int *got_frame_ptr, AVPacket *avpkt); + +/** + * Decode the video frame of size avpkt->size from avpkt->data into picture. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. + * + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note You might have to align the input buffer avpkt->data. + * The alignment requirements depend on the CPU: on some CPUs it isn't + * necessary at all, on others it won't work at all if not aligned and on others + * it will work but it will have an impact on performance. + * + * In practice, avpkt->data should have 4 byte alignment at minimum. + * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * Use avcodec_alloc_frame to get an AVFrame, the codec will + * allocate memory for the actual bitmap. + * with default get/release_buffer(), the decoder frees/reuses the bitmap as it sees fit. + * with overridden get/release_buffer() (needs CODEC_CAP_DR1) the user decides into what buffer the decoder + * decodes and the decoder tells the user once it does not need the data anymore, + * the user app can at this point free/reuse/keep the memory as it sees fit. + * + * @param[in] avpkt The input AVpacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields like + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least + * fields possible. + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + */ +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, + AVPacket *avpkt); + +/** + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in *sub. + * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. + * + * @param avctx the codec context + * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be + freed with avsubtitle_free if *got_sub_ptr is set. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + */ +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt); + +/** + * @defgroup lavc_parsing Frame parsing + * @{ + */ + +typedef struct AVCodecParserContext { + void *priv_data; + struct AVCodecParser *parser; + int64_t frame_offset; /* offset of the current frame */ + int64_t cur_offset; /* current offset + (incremented by each av_parser_parse()) */ + int64_t next_frame_offset; /* offset of the next frame */ + /* video info */ + int pict_type; /* XXX: Put it back in AVCodecContext. */ + /** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + */ + int repeat_pict; /* XXX: Put it back in AVCodecContext. */ + int64_t pts; /* pts of the current frame */ + int64_t dts; /* dts of the current frame */ + + /* private data */ + int64_t last_pts; + int64_t last_dts; + int fetch_timestamp; + +#define AV_PARSER_PTS_NB 4 + int cur_frame_start_index; + int64_t cur_frame_offset[AV_PARSER_PTS_NB]; + int64_t cur_frame_pts[AV_PARSER_PTS_NB]; + int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 + + int64_t offset; ///< byte offset from starting packet start + int64_t cur_frame_end[AV_PARSER_PTS_NB]; + + /** + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames + * will be used. + */ + int key_frame; + + /** + * Time difference in stream time base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current frame. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; + + // Timestamp generation support: + /** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + */ + int dts_sync_point; + + /** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + */ + int dts_ref_dts_delta; + + /** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + */ + int pts_dts_delta; + + /** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + */ + int64_t cur_frame_pos[AV_PARSER_PTS_NB]; + + /** + * Byte position of currently parsed frame in stream. + */ + int64_t pos; + + /** + * Previous frame byte position. + */ + int64_t last_pos; + + /** + * Duration of the current frame. + * For audio, this is in units of 1 / AVCodecContext.sample_rate. + * For all other types, this is in units of AVCodecContext.time_base. + */ + int duration; +} AVCodecParserContext; + +typedef struct AVCodecParser { + int codec_ids[5]; /* several codec IDs are permitted */ + int priv_data_size; + int (*parser_init)(AVCodecParserContext *s); + int (*parser_parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + void (*parser_close)(AVCodecParserContext *s); + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); + struct AVCodecParser *next; +} AVCodecParser; + +AVCodecParser *av_parser_next(AVCodecParser *c); + +void av_register_codec_parser(AVCodecParser *parser); +AVCodecParserContext *av_parser_init(int codec_id); + +/** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts, pos); + * in_data += len; + * in_len -= len; + * + * if(size) + * decode_frame(data, size); + * } + * @endcode + */ +int av_parser_parse2(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, + int64_t pts, int64_t dts, + int64_t pos); + +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitstreamFilter + */ +int av_parser_change(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_parser_close(AVCodecParserContext *s); + +/** + * @} + * @} + */ + +/** + * @addtogroup lavc_encoding + * @{ + */ + +/** + * Find a registered encoder with a matching codec ID. + * + * @param id AVCodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder(enum AVCodecID id); + +/** + * Find a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder_by_name(const char *name); + +#if FF_API_OLD_ENCODE_AUDIO +/** + * Encode an audio frame from samples into buf. + * + * @deprecated Use avcodec_encode_audio2 instead. + * + * @note The output buffer should be at least FF_MIN_BUFFER_SIZE bytes large. + * However, for codecs with avctx->frame_size equal to 0 (e.g. PCM) the user + * will know how much space is needed because it depends on the value passed + * in buf_size as described below. In that case a lower value can be used. + * + * @param avctx the codec context + * @param[out] buf the output buffer + * @param[in] buf_size the output buffer size + * @param[in] samples the input buffer containing the samples + * The number of samples read from this buffer is frame_size*channels, + * both of which are defined in avctx. + * For codecs which have avctx->frame_size equal to 0 (e.g. PCM) the number of + * samples read from samples is equal to: + * buf_size * 8 / (avctx->channels * av_get_bits_per_sample(avctx->codec_id)) + * This also implies that av_get_bits_per_sample() must not return 0 for these + * codecs. + * @return On error a negative value is returned, on success zero or the number + * of bytes used to encode the data read from the input buffer. + */ +int attribute_deprecated avcodec_encode_audio(AVCodecContext *avctx, + uint8_t *buf, int buf_size, + const short *samples); +#endif + +/** + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +#if FF_API_OLD_ENCODE_VIDEO +/** + * @deprecated use avcodec_encode_video2() instead. + * + * Encode a video frame from pict into buf. + * The input picture should be + * stored using a specific format, namely avctx.pix_fmt. + * + * @param avctx the codec context + * @param[out] buf the output buffer for the bitstream of encoded frame + * @param[in] buf_size the size of the output buffer in bytes + * @param[in] pict the input picture to encode + * @return On error a negative value is returned, on success zero or the number + * of bytes used from the output buffer. + */ +attribute_deprecated +int avcodec_encode_video(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVFrame *pict); +#endif + +/** + * Encode a frame of video. + * + * Takes input raw video data from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay and reorder input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. The returned data (if any) belongs to the + * caller, he is responsible for freeing it. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw video data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub); + + +/** + * @} + */ + +#if FF_API_AVCODEC_RESAMPLE +/** + * @defgroup lavc_resample Audio resampling + * @ingroup libavc + * @deprecated use libavresample instead + * + * @{ + */ +struct ReSampleContext; +struct AVResampleContext; + +typedef struct ReSampleContext ReSampleContext; + +/** + * Initialize audio resampling context. + * + * @param output_channels number of output channels + * @param input_channels number of input channels + * @param output_rate output sample rate + * @param input_rate input sample rate + * @param sample_fmt_out requested output sample format + * @param sample_fmt_in input sample format + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear if 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + * @return allocated ReSampleContext, NULL if error occurred + */ +attribute_deprecated +ReSampleContext *av_audio_resample_init(int output_channels, int input_channels, + int output_rate, int input_rate, + enum AVSampleFormat sample_fmt_out, + enum AVSampleFormat sample_fmt_in, + int filter_length, int log2_phase_count, + int linear, double cutoff); + +attribute_deprecated +int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples); + +/** + * Free resample context. + * + * @param s a non-NULL pointer to a resample context previously + * created with av_audio_resample_init() + */ +attribute_deprecated +void audio_resample_close(ReSampleContext *s); + + +/** + * Initialize an audio resampler. + * Note, if either rate is not an integer then simply scale both rates up so they are. + * @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq + * @param log2_phase_count log2 of the number of entries in the polyphase filterbank + * @param linear If 1 then the used FIR filter will be linearly interpolated + between the 2 closest, if 0 the closest will be used + * @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate + */ +attribute_deprecated +struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff); + +/** + * Resample an array of samples using a previously configured context. + * @param src an array of unconsumed samples + * @param consumed the number of samples of src which have been consumed are returned here + * @param src_size the number of unconsumed samples available + * @param dst_size the amount of space in samples available in dst + * @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context. + * @return the number of samples written in dst or -1 if an error occurred + */ +attribute_deprecated +int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx); + + +/** + * Compensate samplerate/timestamp drift. The compensation is done by changing + * the resampler parameters, so no audible clicks or similar distortions occur + * @param compensation_distance distance in output samples over which the compensation should be performed + * @param sample_delta number of output samples which should be output less + * + * example: av_resample_compensate(c, 10, 500) + * here instead of 510 samples only 500 samples would be output + * + * note, due to rounding the actual compensation might be slightly different, + * especially if the compensation_distance is large and the in_rate used during init is small + */ +attribute_deprecated +void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance); +attribute_deprecated +void av_resample_close(struct AVResampleContext *c); + +/** + * @} + */ +#endif + +/** + * @addtogroup lavc_picture + * @{ + */ + +/** + * Allocate memory for a picture. Call avpicture_free() to free it. + * + * @see avpicture_fill() + * + * @param picture the picture to be filled in + * @param pix_fmt the format of the picture + * @param width the width of the picture + * @param height the height of the picture + * @return zero if successful, a negative value if not + */ +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Free a picture previously allocated by avpicture_alloc(). + * The data buffer used by the AVPicture is freed, but the AVPicture structure + * itself is not. + * + * @param picture the AVPicture to be freed + */ +void avpicture_free(AVPicture *picture); + +/** + * Fill in the AVPicture fields. + * The fields of the given AVPicture are filled in by using the 'ptr' address + * which points to the image data buffer. Depending on the specified picture + * format, one or multiple image data pointers and line sizes will be set. + * If a planar format is specified, several pointers will be set pointing to + * the different picture planes and the line sizes of the different planes + * will be stored in the lines_sizes array. + * Call with ptr == NULL to get the required size for the ptr buffer. + * + * To allocate the buffer and fill in the AVPicture fields in one call, + * use avpicture_alloc(). + * + * @param picture AVPicture whose fields are to be filled in + * @param ptr Buffer which will contain or contains the actual image data + * @param pix_fmt The format in which the picture data is stored. + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return size of the image data in bytes + */ +int avpicture_fill(AVPicture *picture, uint8_t *ptr, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Copy pixel data from an AVPicture into a buffer. + * The data is stored compactly, without any gaps for alignment or padding + * which may be applied by avpicture_fill(). + * + * @see avpicture_get_size() + * + * @param[in] src AVPicture containing image data + * @param[in] pix_fmt The format in which the picture data is stored. + * @param[in] width the width of the image in pixels. + * @param[in] height the height of the image in pixels. + * @param[out] dest A buffer into which picture data will be copied. + * @param[in] dest_size The size of 'dest'. + * @return The number of bytes written to dest, or a negative value (error code) on error. + */ +int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, + int width, int height, + unsigned char *dest, int dest_size); + +/** + * Calculate the size in bytes that a picture of the given width and height + * would occupy if stored in the given picture format. + * Note that this returns the size of a compact representation as generated + * by avpicture_layout(), which can be smaller than the size required for e.g. + * avpicture_fill(). + * + * @param pix_fmt the given picture format + * @param width the width of the image + * @param height the height of the image + * @return Image data size in bytes or -1 on error (e.g. too large dimensions). + */ +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); + +/** + * deinterlace - if not supported return -1 + */ +int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); +/** + * Copy image src to dst. Wraps av_picture_data_copy() above. + */ +void av_picture_copy(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Crop image top and left side. + */ +int av_picture_crop(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int top_band, int left_band); + +/** + * Pad image. + */ +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, + int padtop, int padbottom, int padleft, int padright, int *color); + +/** + * @} + */ + +/** + * @defgroup lavc_misc Utility functions + * @ingroup libavc + * + * Miscellaneous utility functions related to both encoding and decoding + * (or neither). + * @{ + */ + +/** + * @defgroup lavc_misc_pixfmt Pixel formats + * + * Functions for working with pixel formats. + * @{ + */ + +/** + * @deprecated Use av_pix_fmt_get_chroma_sub_sample + */ + +void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); + +/** + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. + */ +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); + +#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ +#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ +#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ +#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ +#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ +#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * avcodec_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur. + */ +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, + int has_alpha); + +#if FF_API_FIND_BEST_PIX_FMT +/** + * @deprecated use avcodec_find_best_pix_fmt2() instead. + * + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_mask parameter. + * + * @code + * src_pix_fmt = AV_PIX_FMT_YUV420P; + * pix_fmt_mask = (1 << AV_PIX_FMT_YUV422P) || (1 << AV_PIX_FMT_RGB24); + * dst_pix_fmt = avcodec_find_best_pix_fmt(pix_fmt_mask, src_pix_fmt, alpha, &loss); + * @endcode + * + * @param[in] pix_fmt_mask bitmask determining which pixel format to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +attribute_deprecated +enum AVPixelFormat avcodec_find_best_pix_fmt(int64_t pix_fmt_mask, enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); +#endif /* FF_API_FIND_BEST_PIX_FMT */ + +/** + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt2() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_list parameter. + * + * + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); + +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + +/** + * @} + */ + +void avcodec_set_dimensions(AVCodecContext *s, int width, int height); + +/** + * Put a string representing the codec tag codec_tag in buf. + * + * @param buf_size size in bytes of buf + * @return the length of the string that would have been generated if + * enough space had been available, excluding the trailing null + */ +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); + +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); + +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); +//FIXME func typedef + +/** + * Fill audio frame data and linesize. + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment (0 = default) + * @return 0 on success, negative error code on failure + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Flush buffers, should be called when seeking or when switching to a different stream. + */ +void avcodec_flush_buffers(AVCodecContext *avctx); + +void avcodec_default_free_buffers(AVCodecContext *s); + +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return audio frame duration. + * + * @param avctx codec context + * @param frame_bytes size of the frame, or 0 if unknown + * @return frame duration, in samples, if known. 0 if not able to + * determine. + */ +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); + + +typedef struct AVBitStreamFilterContext { + void *priv_data; + struct AVBitStreamFilter *filter; + AVCodecParserContext *parser; + struct AVBitStreamFilterContext *next; +} AVBitStreamFilterContext; + + +typedef struct AVBitStreamFilter { + const char *name; + int priv_data_size; + int (*filter)(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); + void (*close)(AVBitStreamFilterContext *bsfc); + struct AVBitStreamFilter *next; +} AVBitStreamFilter; + +void av_register_bitstream_filter(AVBitStreamFilter *bsf); +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); + +AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); + +/* memory */ + +/** + * Reallocate the given block if it is not large enough, otherwise do nothing. + * + * @see av_realloc + */ +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer with padding, reusing the given one if large enough. + * + * Same behaviour av_fast_malloc but the buffer has additional + * FF_INPUT_PADDING_SIZE at the end which will always memset to 0. + * + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +/** + * Log a generic warning message about a missing feature. This function is + * intended to be used internally by Libav (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] feature string containing the name of the missing feature + * @param[in] want_sample indicates if samples are wanted which exhibit this feature. + * If want_sample is non-zero, additional verbage will be added to the log + * message which tells the user how to report samples to the development + * mailing list. + */ +void av_log_missing_feature(void *avc, const char *feature, int want_sample); + +/** + * Log a generic warning message asking for a sample. This function is + * intended to be used internally by Libav (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] msg string containing an optional message, or NULL if no message + */ +void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); + +/** + * Register the hardware accelerator hwaccel. + */ +void av_register_hwaccel(AVHWAccel *hwaccel); + +/** + * If hwaccel is NULL, returns the first registered hardware accelerator, + * if hwaccel is non-NULL, returns the next registered hardware accelerator + * after hwaccel, or NULL if hwaccel is the last one. + */ +AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); + + +/** + * Lock operation used by lockmgr + */ +enum AVLockOp { + AV_LOCK_CREATE, ///< Create a mutex + AV_LOCK_OBTAIN, ///< Lock the mutex + AV_LOCK_RELEASE, ///< Unlock the mutex + AV_LOCK_DESTROY, ///< Free mutex resources +}; + +/** + * Register a user provided lock manager supporting the operations + * specified by AVLockOp. mutex points to a (void *) where the + * lockmgr should store/get a pointer to a user allocated mutex. It's + * NULL upon AV_LOCK_CREATE and != NULL for all other ops. + * + * @param cb User defined callback. Note: Libav may invoke calls to this + * callback during the call to av_lockmgr_register(). + * Thus, the application must be prepared to handle that. + * If cb is set to NULL the lockmgr will be unregistered. + * Also note that during unregistration the previously registered + * lockmgr callback may also be invoked. + */ +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); + +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); + +/** + * @return a positive value if s is open (i.e. avcodec_open2() was called on it + * with no corresponding avcodec_close()), 0 otherwise. + */ +int avcodec_is_open(AVCodecContext *s); + +/** + * @return a non-zero number if codec is an encoder, zero otherwise + */ +int av_codec_is_encoder(const AVCodec *codec); + +/** + * @return a non-zero number if codec is a decoder, zero otherwise + */ +int av_codec_is_decoder(const AVCodec *codec); + +/** + * @return descriptor for given codec ID or NULL if no descriptor exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); + +/** + * Iterate over all codec descriptors known to libavcodec. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); + +/** + * @return codec descriptor with the given name or NULL if no such descriptor + * exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); + +/** + * @} + */ + +#endif /* AVCODEC_AVCODEC_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/avfft.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/avfft.h new file mode 100644 index 000000000000..b89618258e63 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/avfft.h @@ -0,0 +1,116 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVFFT_H +#define AVCODEC_AVFFT_H + +/** + * @file + * @ingroup lavc_fft + * FFT functions + */ + +/** + * @defgroup lavc_fft FFT functions + * @ingroup lavc_misc + * + * @{ + */ + +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext FFTContext; + +/** + * Set up a complex FFT. + * @param nbits log2 of the length of the input array + * @param inverse if 0 perform the forward transform, if 1 perform the inverse + */ +FFTContext *av_fft_init(int nbits, int inverse); + +/** + * Do the permutation needed BEFORE calling ff_fft_calc(). + */ +void av_fft_permute(FFTContext *s, FFTComplex *z); + +/** + * Do a complex FFT with the parameters defined in av_fft_init(). The + * input data must be permuted before. No 1.0/sqrt(n) normalization is done. + */ +void av_fft_calc(FFTContext *s, FFTComplex *z); + +void av_fft_end(FFTContext *s); + +FFTContext *av_mdct_init(int nbits, int inverse, double scale); +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_end(FFTContext *s); + +/* Real Discrete Fourier Transform */ + +enum RDFTransformType { + DFT_R2C, + IDFT_C2R, + IDFT_R2C, + DFT_C2R, +}; + +typedef struct RDFTContext RDFTContext; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); +void av_rdft_calc(RDFTContext *s, FFTSample *data); +void av_rdft_end(RDFTContext *s); + +/* Discrete Cosine Transform */ + +typedef struct DCTContext DCTContext; + +enum DCTTransformType { + DCT_II = 0, + DCT_III, + DCT_I, + DST_I, +}; + +/** + * Set up DCT. + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * + * @note the first element of the input of DST-I is ignored + */ +DCTContext *av_dct_init(int nbits, enum DCTTransformType type); +void av_dct_calc(DCTContext *s, FFTSample *data); +void av_dct_end (DCTContext *s); + +/** + * @} + */ + +#endif /* AVCODEC_AVFFT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/dxva2.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/dxva2.h new file mode 100644 index 000000000000..c06f1f333271 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/dxva2.h @@ -0,0 +1,88 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA_H +#define AVCODEC_DXVA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_dxva2 + * Public libavcodec DXVA2 header. + */ + +#include + +#include +#include + +/** + * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 Libav HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the Libav AVHWAccel implementation + */ + unsigned report_id; +}; + +/** + * @} + */ + +#endif /* AVCODEC_DXVA_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/old_codec_ids.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/old_codec_ids.h new file mode 100644 index 000000000000..2b72e38d2029 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/old_codec_ids.h @@ -0,0 +1,366 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_OLD_CODEC_IDS_H +#define AVCODEC_OLD_CODEC_IDS_H + +/* + * This header exists to prevent new codec IDs from being accidentally added to + * the deprecated list. + * Do not include it directly. It will be removed on next major bump + * + * Do not add new items to this list. Use the AVCodecID enum instead. + */ + + CODEC_ID_NONE = AV_CODEC_ID_NONE, + + /* video codecs */ + CODEC_ID_MPEG1VIDEO, + CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding + CODEC_ID_MPEG2VIDEO_XVMC, + CODEC_ID_H261, + CODEC_ID_H263, + CODEC_ID_RV10, + CODEC_ID_RV20, + CODEC_ID_MJPEG, + CODEC_ID_MJPEGB, + CODEC_ID_LJPEG, + CODEC_ID_SP5X, + CODEC_ID_JPEGLS, + CODEC_ID_MPEG4, + CODEC_ID_RAWVIDEO, + CODEC_ID_MSMPEG4V1, + CODEC_ID_MSMPEG4V2, + CODEC_ID_MSMPEG4V3, + CODEC_ID_WMV1, + CODEC_ID_WMV2, + CODEC_ID_H263P, + CODEC_ID_H263I, + CODEC_ID_FLV1, + CODEC_ID_SVQ1, + CODEC_ID_SVQ3, + CODEC_ID_DVVIDEO, + CODEC_ID_HUFFYUV, + CODEC_ID_CYUV, + CODEC_ID_H264, + CODEC_ID_INDEO3, + CODEC_ID_VP3, + CODEC_ID_THEORA, + CODEC_ID_ASV1, + CODEC_ID_ASV2, + CODEC_ID_FFV1, + CODEC_ID_4XM, + CODEC_ID_VCR1, + CODEC_ID_CLJR, + CODEC_ID_MDEC, + CODEC_ID_ROQ, + CODEC_ID_INTERPLAY_VIDEO, + CODEC_ID_XAN_WC3, + CODEC_ID_XAN_WC4, + CODEC_ID_RPZA, + CODEC_ID_CINEPAK, + CODEC_ID_WS_VQA, + CODEC_ID_MSRLE, + CODEC_ID_MSVIDEO1, + CODEC_ID_IDCIN, + CODEC_ID_8BPS, + CODEC_ID_SMC, + CODEC_ID_FLIC, + CODEC_ID_TRUEMOTION1, + CODEC_ID_VMDVIDEO, + CODEC_ID_MSZH, + CODEC_ID_ZLIB, + CODEC_ID_QTRLE, + CODEC_ID_SNOW, + CODEC_ID_TSCC, + CODEC_ID_ULTI, + CODEC_ID_QDRAW, + CODEC_ID_VIXL, + CODEC_ID_QPEG, + CODEC_ID_PNG, + CODEC_ID_PPM, + CODEC_ID_PBM, + CODEC_ID_PGM, + CODEC_ID_PGMYUV, + CODEC_ID_PAM, + CODEC_ID_FFVHUFF, + CODEC_ID_RV30, + CODEC_ID_RV40, + CODEC_ID_VC1, + CODEC_ID_WMV3, + CODEC_ID_LOCO, + CODEC_ID_WNV1, + CODEC_ID_AASC, + CODEC_ID_INDEO2, + CODEC_ID_FRAPS, + CODEC_ID_TRUEMOTION2, + CODEC_ID_BMP, + CODEC_ID_CSCD, + CODEC_ID_MMVIDEO, + CODEC_ID_ZMBV, + CODEC_ID_AVS, + CODEC_ID_SMACKVIDEO, + CODEC_ID_NUV, + CODEC_ID_KMVC, + CODEC_ID_FLASHSV, + CODEC_ID_CAVS, + CODEC_ID_JPEG2000, + CODEC_ID_VMNC, + CODEC_ID_VP5, + CODEC_ID_VP6, + CODEC_ID_VP6F, + CODEC_ID_TARGA, + CODEC_ID_DSICINVIDEO, + CODEC_ID_TIERTEXSEQVIDEO, + CODEC_ID_TIFF, + CODEC_ID_GIF, + CODEC_ID_DXA, + CODEC_ID_DNXHD, + CODEC_ID_THP, + CODEC_ID_SGI, + CODEC_ID_C93, + CODEC_ID_BETHSOFTVID, + CODEC_ID_PTX, + CODEC_ID_TXD, + CODEC_ID_VP6A, + CODEC_ID_AMV, + CODEC_ID_VB, + CODEC_ID_PCX, + CODEC_ID_SUNRAST, + CODEC_ID_INDEO4, + CODEC_ID_INDEO5, + CODEC_ID_MIMIC, + CODEC_ID_RL2, + CODEC_ID_ESCAPE124, + CODEC_ID_DIRAC, + CODEC_ID_BFI, + CODEC_ID_CMV, + CODEC_ID_MOTIONPIXELS, + CODEC_ID_TGV, + CODEC_ID_TGQ, + CODEC_ID_TQI, + CODEC_ID_AURA, + CODEC_ID_AURA2, + CODEC_ID_V210X, + CODEC_ID_TMV, + CODEC_ID_V210, + CODEC_ID_DPX, + CODEC_ID_MAD, + CODEC_ID_FRWU, + CODEC_ID_FLASHSV2, + CODEC_ID_CDGRAPHICS, + CODEC_ID_R210, + CODEC_ID_ANM, + CODEC_ID_BINKVIDEO, + CODEC_ID_IFF_ILBM, + CODEC_ID_IFF_BYTERUN1, + CODEC_ID_KGV1, + CODEC_ID_YOP, + CODEC_ID_VP8, + CODEC_ID_PICTOR, + CODEC_ID_ANSI, + CODEC_ID_A64_MULTI, + CODEC_ID_A64_MULTI5, + CODEC_ID_R10K, + CODEC_ID_MXPEG, + CODEC_ID_LAGARITH, + CODEC_ID_PRORES, + CODEC_ID_JV, + CODEC_ID_DFA, + CODEC_ID_WMV3IMAGE, + CODEC_ID_VC1IMAGE, + CODEC_ID_UTVIDEO, + CODEC_ID_BMV_VIDEO, + CODEC_ID_VBLE, + CODEC_ID_DXTORY, + CODEC_ID_V410, + CODEC_ID_XWD, + CODEC_ID_CDXL, + CODEC_ID_XBM, + CODEC_ID_ZEROCODEC, + CODEC_ID_MSS1, + CODEC_ID_MSA1, + CODEC_ID_TSCC2, + CODEC_ID_MTS2, + CODEC_ID_CLLC, + + /* various PCM "codecs" */ + CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + CODEC_ID_PCM_S16LE = 0x10000, + CODEC_ID_PCM_S16BE, + CODEC_ID_PCM_U16LE, + CODEC_ID_PCM_U16BE, + CODEC_ID_PCM_S8, + CODEC_ID_PCM_U8, + CODEC_ID_PCM_MULAW, + CODEC_ID_PCM_ALAW, + CODEC_ID_PCM_S32LE, + CODEC_ID_PCM_S32BE, + CODEC_ID_PCM_U32LE, + CODEC_ID_PCM_U32BE, + CODEC_ID_PCM_S24LE, + CODEC_ID_PCM_S24BE, + CODEC_ID_PCM_U24LE, + CODEC_ID_PCM_U24BE, + CODEC_ID_PCM_S24DAUD, + CODEC_ID_PCM_ZORK, + CODEC_ID_PCM_S16LE_PLANAR, + CODEC_ID_PCM_DVD, + CODEC_ID_PCM_F32BE, + CODEC_ID_PCM_F32LE, + CODEC_ID_PCM_F64BE, + CODEC_ID_PCM_F64LE, + CODEC_ID_PCM_BLURAY, + CODEC_ID_PCM_LXF, + CODEC_ID_S302M, + CODEC_ID_PCM_S8_PLANAR, + + /* various ADPCM codecs */ + CODEC_ID_ADPCM_IMA_QT = 0x11000, + CODEC_ID_ADPCM_IMA_WAV, + CODEC_ID_ADPCM_IMA_DK3, + CODEC_ID_ADPCM_IMA_DK4, + CODEC_ID_ADPCM_IMA_WS, + CODEC_ID_ADPCM_IMA_SMJPEG, + CODEC_ID_ADPCM_MS, + CODEC_ID_ADPCM_4XM, + CODEC_ID_ADPCM_XA, + CODEC_ID_ADPCM_ADX, + CODEC_ID_ADPCM_EA, + CODEC_ID_ADPCM_G726, + CODEC_ID_ADPCM_CT, + CODEC_ID_ADPCM_SWF, + CODEC_ID_ADPCM_YAMAHA, + CODEC_ID_ADPCM_SBPRO_4, + CODEC_ID_ADPCM_SBPRO_3, + CODEC_ID_ADPCM_SBPRO_2, + CODEC_ID_ADPCM_THP, + CODEC_ID_ADPCM_IMA_AMV, + CODEC_ID_ADPCM_EA_R1, + CODEC_ID_ADPCM_EA_R3, + CODEC_ID_ADPCM_EA_R2, + CODEC_ID_ADPCM_IMA_EA_SEAD, + CODEC_ID_ADPCM_IMA_EA_EACS, + CODEC_ID_ADPCM_EA_XAS, + CODEC_ID_ADPCM_EA_MAXIS_XA, + CODEC_ID_ADPCM_IMA_ISS, + CODEC_ID_ADPCM_G722, + CODEC_ID_ADPCM_IMA_APC, + + /* AMR */ + CODEC_ID_AMR_NB = 0x12000, + CODEC_ID_AMR_WB, + + /* RealAudio codecs*/ + CODEC_ID_RA_144 = 0x13000, + CODEC_ID_RA_288, + + /* various DPCM codecs */ + CODEC_ID_ROQ_DPCM = 0x14000, + CODEC_ID_INTERPLAY_DPCM, + CODEC_ID_XAN_DPCM, + CODEC_ID_SOL_DPCM, + + /* audio codecs */ + CODEC_ID_MP2 = 0x15000, + CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + CODEC_ID_AAC, + CODEC_ID_AC3, + CODEC_ID_DTS, + CODEC_ID_VORBIS, + CODEC_ID_DVAUDIO, + CODEC_ID_WMAV1, + CODEC_ID_WMAV2, + CODEC_ID_MACE3, + CODEC_ID_MACE6, + CODEC_ID_VMDAUDIO, + CODEC_ID_FLAC, + CODEC_ID_MP3ADU, + CODEC_ID_MP3ON4, + CODEC_ID_SHORTEN, + CODEC_ID_ALAC, + CODEC_ID_WESTWOOD_SND1, + CODEC_ID_GSM, ///< as in Berlin toast format + CODEC_ID_QDM2, + CODEC_ID_COOK, + CODEC_ID_TRUESPEECH, + CODEC_ID_TTA, + CODEC_ID_SMACKAUDIO, + CODEC_ID_QCELP, + CODEC_ID_WAVPACK, + CODEC_ID_DSICINAUDIO, + CODEC_ID_IMC, + CODEC_ID_MUSEPACK7, + CODEC_ID_MLP, + CODEC_ID_GSM_MS, /* as found in WAV */ + CODEC_ID_ATRAC3, + CODEC_ID_VOXWARE, + CODEC_ID_APE, + CODEC_ID_NELLYMOSER, + CODEC_ID_MUSEPACK8, + CODEC_ID_SPEEX, + CODEC_ID_WMAVOICE, + CODEC_ID_WMAPRO, + CODEC_ID_WMALOSSLESS, + CODEC_ID_ATRAC3P, + CODEC_ID_EAC3, + CODEC_ID_SIPR, + CODEC_ID_MP1, + CODEC_ID_TWINVQ, + CODEC_ID_TRUEHD, + CODEC_ID_MP4ALS, + CODEC_ID_ATRAC1, + CODEC_ID_BINKAUDIO_RDFT, + CODEC_ID_BINKAUDIO_DCT, + CODEC_ID_AAC_LATM, + CODEC_ID_QDMC, + CODEC_ID_CELT, + CODEC_ID_G723_1, + CODEC_ID_G729, + CODEC_ID_8SVX_EXP, + CODEC_ID_8SVX_FIB, + CODEC_ID_BMV_AUDIO, + CODEC_ID_RALF, + CODEC_ID_IAC, + CODEC_ID_ILBC, + + /* subtitle codecs */ + CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + CODEC_ID_DVD_SUBTITLE = 0x17000, + CODEC_ID_DVB_SUBTITLE, + CODEC_ID_TEXT, ///< raw UTF-8 text + CODEC_ID_XSUB, + CODEC_ID_SSA, + CODEC_ID_MOV_TEXT, + CODEC_ID_HDMV_PGS_SUBTITLE, + CODEC_ID_DVB_TELETEXT, + CODEC_ID_SRT, + + /* other specific kind of codecs (generally used for attachments) */ + CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + CODEC_ID_TTF = 0x18000, + + CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like CODEC_ID_NONE) but lavf should attempt to identify it + + CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + +#endif /* AVCODEC_OLD_CODEC_IDS_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vaapi.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vaapi.h new file mode 100644 index 000000000000..39e88259d641 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vaapi.h @@ -0,0 +1,173 @@ +/* + * Video Acceleration API (shared data between Libav and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vaapi + * Public libavcodec VA API header. + */ + +#include + +/** + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding + * @ingroup lavc_codec_hwaccel + * @{ + */ + +/** + * This structure is used to share data between the Libav library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +struct vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; + + /** + * VAPictureParameterBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t pic_param_buf_id; + + /** + * VAIQMatrixBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t iq_matrix_buf_id; + + /** + * VABitPlaneBuffer ID (for VC-1 decoding) + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t bitplane_buf_id; + + /** + * Slice parameter/data buffer IDs + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t *slice_buf_ids; + + /** + * Number of effective slice buffer IDs to send to the HW + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int n_slice_buf_ids; + + /** + * Size of pre-allocated slice_buf_ids + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_buf_ids_alloc; + + /** + * Pointer to VASliceParameterBuffers + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *slice_params; + + /** + * Size of a VASliceParameterBuffer element + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_param_size; + + /** + * Size of pre-allocated slice_params + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_params_alloc; + + /** + * Number of slices currently filled in + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_count; + + /** + * Pointer to slice data buffer base + * - encoding: unused + * - decoding: Set by libavcodec + */ + const uint8_t *slice_data; + + /** + * Current size of slice data + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t slice_data_size; +}; + +/* @} */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vda.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vda.h new file mode 100644 index 000000000000..f0ec2bfec331 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vda.h @@ -0,0 +1,217 @@ +/* + * VDA HW acceleration + * + * copyright (c) 2011 Sebastien Zwickert + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDA_H +#define AVCODEC_VDA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vda + * Public libavcodec VDA header. + */ + +#include "libavcodec/version.h" + +#if FF_API_VDA_ASYNC +#include +#endif + +#include + +// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes +// http://openradar.appspot.com/8026390 +#undef __GNUC_STDC_INLINE__ + +#define Picture QuickdrawPicture +#include +#undef Picture + +/** + * @defgroup lavc_codec_hwaccel_vda VDA + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#if FF_API_VDA_ASYNC +/** + * This structure is used to store decoded frame information and data. + * + * @deprecated Use synchronous decoding mode. + */ +typedef struct vda_frame { + /** + * The PTS of the frame. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + int64_t pts; + + /** + * The CoreVideo buffer that contains the decoded data. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + CVPixelBufferRef cv_buffer; + + /** + * A pointer to the next frame. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + struct vda_frame *next_frame; +} vda_frame; +#endif + +/** + * This structure is used to provide the necessary configurations and data + * to the VDA Libav HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct vda_context { + /** + * VDA decoder object. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + VDADecoder decoder; + + /** + * The Core Video pixel buffer that contains the current image data. + * + * encoding: unused + * decoding: Set by libavcodec. Unset by user. + */ + CVPixelBufferRef cv_buffer; + + /** + * Use the hardware decoder in synchronous mode. + * + * encoding: unused + * decoding: Set by user. + */ + int use_sync_decoding; + +#if FF_API_VDA_ASYNC + /** + * VDA frames queue ordered by presentation timestamp. + * + * @deprecated Use synchronous decoding mode. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + vda_frame *queue; + + /** + * Mutex for locking queue operations. + * + * @deprecated Use synchronous decoding mode. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + pthread_mutex_t queue_mutex; +#endif + + /** + * The frame width. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int width; + + /** + * The frame height. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int height; + + /** + * The frame format. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int format; + + /** + * The pixel format for output image buffers. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + OSType cv_pix_fmt_type; + + /** + * The current bitstream buffer. + */ + uint8_t *priv_bitstream; + + /** + * The current size of the bitstream. + */ + int priv_bitstream_size; + + /** + * The reference size used for fast reallocation. + */ + int priv_allocated_size; +}; + +/** Create the video decoder. */ +int ff_vda_create_decoder(struct vda_context *vda_ctx, + uint8_t *extradata, + int extradata_size); + +/** Destroy the video decoder. */ +int ff_vda_destroy_decoder(struct vda_context *vda_ctx); + +#if FF_API_VDA_ASYNC +/** + * Return the top frame of the queue. + * + * @deprecated Use synchronous decoding mode. + */ +vda_frame *ff_vda_queue_pop(struct vda_context *vda_ctx); + +/** + * Release the given frame. + * + * @deprecated Use synchronous decoding mode. + */ +void ff_vda_release_vda_frame(vda_frame *frame); +#endif + +/** + * @} + */ + +#endif /* AVCODEC_VDA_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vdpau.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vdpau.h new file mode 100644 index 000000000000..241ff190517a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/vdpau.h @@ -0,0 +1,94 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using Libav + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include +#include + +/** @brief The videoSurface is used for rendering. */ +#define FF_VDPAU_STATE_USED_FOR_RENDER 1 + +/** + * @brief The videoSurface is needed for reference/prediction. + * The codec manipulates this. + */ +#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 + +/** + * @brief This structure is used as a callback between the Libav + * decoder (vd_) and presentation (vo_) module. + * This is used for defining a video frame containing surface, + * picture parameter, bitstream information etc which are passed + * between the Libav decoder and its clients. + */ +struct vdpau_render_state { + VdpVideoSurface surface; ///< Used as rendered surface, never changed. + + int state; ///< Holds FF_VDPAU_STATE_* values. + + /** picture parameter information for all supported codecs */ + union VdpPictureInfo { + VdpPictureInfoH264 h264; + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoVC1 vc1; + VdpPictureInfoMPEG4Part2 mpeg4; + } info; + + /** Describe size/location of the compressed video data. + Set to 0 when freeing bitstream_buffers. */ + int bitstream_buffers_allocated; + int bitstream_buffers_used; + /** The user is responsible for freeing this buffer using av_freep(). */ + VdpBitstreamBuffer *bitstream_buffers; +}; + +/* @}*/ + +#endif /* AVCODEC_VDPAU_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/version.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/version.h new file mode 100644 index 000000000000..348ce99f2ad1 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/version.h @@ -0,0 +1,95 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#define LIBAVCODEC_VERSION_MAJOR 54 +#define LIBAVCODEC_VERSION_MINOR 35 +#define LIBAVCODEC_VERSION_MICRO 0 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_REQUEST_CHANNELS +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OLD_DECODE_AUDIO +#define FF_API_OLD_DECODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OLD_ENCODE_AUDIO +#define FF_API_OLD_ENCODE_AUDIO (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_OLD_ENCODE_VIDEO +#define FF_API_OLD_ENCODE_VIDEO (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_MPV_GLOBAL_OPTS +#define FF_API_MPV_GLOBAL_OPTS (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_COLOR_TABLE_ID +#define FF_API_COLOR_TABLE_ID (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_INTER_THRESHOLD +#define FF_API_INTER_THRESHOLD (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_SUB_ID +#define FF_API_SUB_ID (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_DSP_MASK +#define FF_API_DSP_MASK (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_FIND_BEST_PIX_FMT +#define FF_API_FIND_BEST_PIX_FMT (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_CODEC_ID +#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_VDA_ASYNC +#define FF_API_VDA_ASYNC (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AVCODEC_RESAMPLE +#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_LIBMPEG2 +#define FF_API_LIBMPEG2 (LIBAVCODEC_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_MMI +#define FF_API_MMI (LIBAVCODEC_VERSION_MAJOR < 55) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavcodec/xvmc.h b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/xvmc.h new file mode 100644 index 000000000000..1f77e4efca85 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavcodec/xvmc.h @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2003 Ivan Kalvachev + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_XVMC_H +#define AVCODEC_XVMC_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_xvmc + * Public libavcodec XvMC header. + */ + +#include + +#include "avcodec.h" + +/** + * @defgroup lavc_codec_hwaccel_xvmc XvMC + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct + the number is 1337 speak for the letters IDCT MCo (motion compensation) */ + +struct xvmc_pix_fmt { + /** The field contains the special constant value AV_XVMC_ID. + It is used as a test that the application correctly uses the API, + and that there is no corruption caused by pixel routines. + - application - set during initialization + - libavcodec - unchanged + */ + int xvmc_id; + + /** Pointer to the block array allocated by XvMCCreateBlocks(). + The array has to be freed by XvMCDestroyBlocks(). + Each group of 64 values represents one data block of differential + pixel information (in MoCo mode) or coefficients for IDCT. + - application - set the pointer during initialization + - libavcodec - fills coefficients/pixel data into the array + */ + short* data_blocks; + + /** Pointer to the macroblock description array allocated by + XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). + - application - set the pointer during initialization + - libavcodec - fills description data into the array + */ + XvMCMacroBlock* mv_blocks; + + /** Number of macroblock descriptions that can be stored in the mv_blocks + array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_mv_blocks; + + /** Number of blocks that can be stored at once in the data_blocks array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_data_blocks; + + /** Indicate that the hardware would interpret data_blocks as IDCT + coefficients and perform IDCT on them. + - application - set during initialization + - libavcodec - unchanged + */ + int idct; + + /** In MoCo mode it indicates that intra macroblocks are assumed to be in + unsigned format; same as the XVMC_INTRA_UNSIGNED flag. + - application - set during initialization + - libavcodec - unchanged + */ + int unsigned_intra; + + /** Pointer to the surface allocated by XvMCCreateSurface(). + It has to be freed by XvMCDestroySurface() on application exit. + It identifies the frame and its state on the video hardware. + - application - set during initialization + - libavcodec - unchanged + */ + XvMCSurface* p_surface; + +/** Set by the decoder before calling ff_draw_horiz_band(), + needed by the XvMCRenderSurface function. */ +//@{ + /** Pointer to the surface used as past reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_past_surface; + + /** Pointer to the surface used as future reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_future_surface; + + /** top/bottom field or frame + - application - unchanged + - libavcodec - set + */ + unsigned int picture_structure; + + /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence + - application - unchanged + - libavcodec - set + */ + unsigned int flags; +//}@ + + /** Number of macroblock descriptions in the mv_blocks array + that have already been passed to the hardware. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may increment it + with filled_mb_block_num or zero both. + - libavcodec - unchanged + */ + int start_mv_blocks_num; + + /** Number of new macroblock descriptions in the mv_blocks array (after + start_mv_blocks_num) that are filled by libavcodec and have to be + passed to the hardware. + - application - zeroes it on get_buffer() or after successful + ff_draw_horiz_band(). + - libavcodec - increment with one of each stored MB + */ + int filled_mv_blocks_num; + + /** Number of the next free data block; one data block consists of + 64 short values in the data_blocks array. + All blocks before this one have already been claimed by placing their + position into the corresponding block description structure field, + that are part of the mv_blocks array. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may zero it together + with start_mb_blocks_num. + - libavcodec - each decoded macroblock increases it by the number + of coded blocks it contains. + */ + int next_free_data_block_num; +}; + +/** + * @} + */ + +#endif /* AVCODEC_XVMC_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavformat/avformat.h b/content/media/fmp4/ffmpeg/libav54/include/libavformat/avformat.h new file mode 100644 index 000000000000..149b66f1c9d5 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavformat/avformat.h @@ -0,0 +1,1749 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVFORMAT_H +#define AVFORMAT_AVFORMAT_H + +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + +/** + * @defgroup libavf I/O and Muxing/Demuxing Library + * @{ + * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libav structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * + * @section lavf_options Passing options to (de)muxers + * Lavf allows to configure muxers and demuxers using the @ref avoptions + * mechanism. Generic (format-independent) libavformat options are provided by + * AVFormatContext, they can be examined from a user program by calling + * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass + * from avformat_get_class()). Private (format-specific) options are provided by + * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / + * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. + * Further options may be provided by the @ref AVFormatContext.pb "I/O context", + * if its AVClass is non-NULL, and the protocols layer. See the discussion on + * nesting in @ref avoptions documentation to learn how to access those. + * + * @defgroup lavf_decoding Demuxing + * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more encoded frames which belongs to a + * single elementary stream. In the lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL or filename, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * Since the format of the opened file is in general not known until after + * avformat_open_input() has returned, it is not possible to set demuxer private + * options on a preallocated context. Instead, the options should be passed to + * avformat_open_input() wrapped in an AVDictionary: + * @code + * AVDictionary *options = NULL; + * av_dict_set(&options, "video_size", "640x480", 0); + * av_dict_set(&options, "pixel_format", "rgb24", 0); + * + * if (avformat_open_input(&s, url, NULL, &options) < 0) + * abort(); + * av_dict_free(&options); + * @endcode + * This code passes the private options 'video_size' and 'pixel_format' to the + * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it + * cannot know how to interpret raw video data otherwise. If the format turns + * out to be something different than raw video, those options will not be + * recognized by the demuxer and therefore will not be applied. Such unrecognized + * options are then returned in the options dictionary (recognized options are + * consumed). The calling program can handle such unrecognized options as it + * wishes, e.g. + * @code + * AVDictionaryEntry *e; + * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); + * abort(); + * } + * @endcode + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * Reading data from an opened AVFormatContext is done by repeatedly calling + * av_read_frame() on it. Each call, if successful, will return an AVPacket + * containing encoded data for one AVStream, identified by + * AVPacket.stream_index. This packet may be passed straight into the libavcodec + * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or + * avcodec_decode_subtitle2() if the caller wishes to decode the data. + * + * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be + * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for + * pts/dts, 0 for duration) if the stream does not provide them. The timing + * information will be in AVStream.time_base units, i.e. it has to be + * multiplied by the timebase to convert them to seconds. + * + * If AVPacket.destruct is set on the returned packet, then the packet is + * allocated dynamically and the user may keep it indefinitely. + * Otherwise, if AVPacket.destruct is NULL, the packet data is backed by a + * static storage somewhere inside the demuxer and the packet is only valid + * until the next av_read_frame() call or closing the file. If the caller + * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy + * of it. + * In both cases, the packet must be freed with av_free_packet() when it is no + * longer needed. + * + * @section lavf_decoding_seek Seeking + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * @} + * + * @defgroup lavf_io I/O Read/Write + * @{ + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + * + */ + +#include +#include /* FILE */ +#include "libavcodec/avcodec.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "avio.h" +#include "libavformat/version.h" + +#if FF_API_AV_GETTIME +#include "libavutil/time.h" +#endif + +struct AVFormatContext; + + +/** + * @defgroup metadata_api Public Metadata API + * @{ + * @ingroup libavf + * The metadata API allows libavformat to export metadata tags to a client + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in Libav, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata + * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * + * Important concepts to keep in mind: + * - Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * - Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * - Several modifiers can be applied to the tag name. This is done by + * appending a dash character ('-') and the modifier name in the order + * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. + * - language -- a tag whose value is localized for a particular language + * is appended with the ISO 639-2/B 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + * - sorting -- a modified version of a tag that should be used for + * sorting will have '-sort' appended. E.g. artist="The Beatles", + * artist-sort="Beatles, The". + * + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: + * + @verbatim + album -- name of the set this work belongs to + album_artist -- main creator of the set/album, if different from artist. + e.g. "Various Artists" for compilation albums. + artist -- main creator of the work + comment -- any additional description of the file. + composer -- who composed the work, if different from artist. + copyright -- name of copyright holder. + creation_time-- date when the file was created, preferably in ISO 8601. + date -- date when the work was created, preferably in ISO 8601. + disc -- number of a subset, e.g. disc in a multi-disc collection. + encoder -- name/settings of the software/hardware that produced the file. + encoded_by -- person/group who created the file. + filename -- original name of the file. + genre -- . + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + performer -- artist who performed the work, if different from artist. + E.g for "Also sprach Zarathustra", artist would be "Richard + Strauss" and performer "London Philharmonic Orchestra". + publisher -- name of the label/publisher. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} + */ + +/* packet functions */ + + +/** + * Allocate and read the payload of a packet and initialize its + * fields with default values. + * + * @param pkt packet + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise + */ +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); + + +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + +/*************************************************/ +/* fractional numbers for exact pts handling */ + +/** + * The exact value of the fractional number is: 'val + num / den'. + * num is assumed to be 0 <= num < den. + */ +typedef struct AVFrac { + int64_t val, num, den; +} AVFrac; + +/*************************************************/ +/* input/output formats */ + +struct AVCodecTag; + +/** + * This structure contains the data a format has to probe a file. + */ +typedef struct AVProbeData { + const char *filename; + unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ + int buf_size; /**< Size of buf except extra allocated bytes */ +} AVProbeData; + +#define AVPROBE_SCORE_MAX 100 ///< maximum score, half of that is used for file-extension-based detection +#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer + +/// Demuxer will use avio_open, no opened file should be provided by the caller. +#define AVFMT_NOFILE 0x0001 +#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ +#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for + raw picture data. */ +#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ +#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ +#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ +#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ +#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fallback to binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fallback to generic search */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ +#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ + +/** + * @addtogroup lavf_encoding + * @{ + */ +typedef struct AVOutputFormat { + const char *name; + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + const char *mime_type; + const char *extensions; /**< comma-separated filename extensions */ + /* output support */ + enum AVCodecID audio_codec; /**< default audio codec */ + enum AVCodecID video_codec; /**< default video codec */ + enum AVCodecID subtitle_codec; /**< default subtitle codec */ + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, + * AVFMT_TS_NONSTRICT + */ + int flags; + + /** + * List of supported codec_id-codec_tag pairs, ordered by "better + * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. + */ + const struct AVCodecTag * const *codec_tag; + + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVOutputFormat *next; + /** + * size of private data so that it can be allocated in the wrapper + */ + int priv_data_size; + + int (*write_header)(struct AVFormatContext *); + /** + * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, + * pkt can be NULL in order to flush data buffered in the muxer. + * When flushing, return 0 if there still is more data to flush, + * or 1 if everything was flushed and there is no more buffered + * data. + */ + int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); + int (*write_trailer)(struct AVFormatContext *); + /** + * Currently only used to set pixel format if not YUV420P. + */ + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, + AVPacket *in, int flush); + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + */ + int (*query_codec)(enum AVCodecID id, int std_compliance); +} AVOutputFormat; +/** + * @} + */ + +/** + * @addtogroup lavf_decoding + * @{ + */ +typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ + const char *name; + + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK. + */ + int flags; + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ + const char *extensions; + + const struct AVCodecTag * const *codec_tag; + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVInputFormat *next; + + /** + * Raw demuxers store their codec ID here. + */ + int raw_codec_id; + + /** + * Size of private data so that it can be allocated in the wrapper. + */ + int priv_data_size; + + /** + * Tell if a given file has a chance of being parsed as this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + */ + int (*read_probe)(AVProbeData *); + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. Only used in raw format right + * now. 'avformat_new_stream' should be called to create new streams. + */ + int (*read_header)(struct AVFormatContext *); + + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). + * @return 0 on success, < 0 on error. + * When returning an error, pkt must not have been allocated + * or must be freed before returning + */ + int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ + int (*read_close)(struct AVFormatContext *); + + /** + * Seek to a given timestamp relative to the frames in + * stream component stream_index. + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. + * @return >= 0 on success (but not necessarily the new offset) + */ + int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); + + /** + * Get the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occurred + */ + int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, + int64_t *pos, int64_t pos_limit); + + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_play)(struct AVFormatContext *); + + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_pause)(struct AVFormatContext *); + + /** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + */ + int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); +} AVInputFormat; +/** + * @} + */ + +enum AVStreamParseType { + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, /**< full parsing and repack */ + AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ + AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ +}; + +typedef struct AVIndexEntry { + int64_t pos; + int64_t timestamp; +#define AVINDEX_KEYFRAME 0x0001 + int flags:2; + int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). + int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ +} AVIndexEntry; + +#define AV_DISPOSITION_DEFAULT 0x0001 +#define AV_DISPOSITION_DUB 0x0002 +#define AV_DISPOSITION_ORIGINAL 0x0004 +#define AV_DISPOSITION_COMMENT 0x0008 +#define AV_DISPOSITION_LYRICS 0x0010 +#define AV_DISPOSITION_KARAOKE 0x0020 + +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ +/** + * The stream is stored in the file as an attached picture/"cover art" (e.g. + * APIC frame in ID3v2). The single packet associated with it will be returned + * among the first few packets read from the file unless seeking takes place. + * It can also be accessed at any time in AVStream.attached_pic. + */ +#define AV_DISPOSITION_ATTACHED_PIC 0x0400 + +/** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + */ +typedef struct AVStream { + int index; /**< stream index in AVFormatContext */ + /** + * Format-specific stream ID. + * decoding: set by libavformat + * encoding: set by the user, replaced by libavformat if left unset + */ + int id; + /** + * Codec context associated with this stream. Allocated and freed by + * libavformat. + * + * - decoding: The demuxer exports codec information stored in the headers + * here. + * - encoding: The user sets codec information, the muxer writes it to the + * output. Mandatory fields as specified in AVCodecContext + * documentation must be set even if this AVCodecContext is + * not actually used for encoding. + */ + AVCodecContext *codec; +#if FF_API_R_FRAME_RATE + /** + * Real base framerate of the stream. + * This is the lowest framerate with which all timestamps can be + * represented accurately (it is the least common multiple of all + * framerates in the stream). Note, this value is just a guess! + * For example, if the time base is 1/90000 and all frames have either + * approximately 3600 or 1800 timer ticks, then r_frame_rate will be 50/1. + */ + AVRational r_frame_rate; +#endif + void *priv_data; + + /** + * encoding: pts generation when outputting stream + */ + struct AVFrac pts; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. + * + * decoding: set by libavformat + * encoding: set by libavformat in avformat_write_header. The muxer may use the + * user-provided value of @ref AVCodecContext.time_base "codec->time_base" + * as a hint. + */ + AVRational time_base; + + /** + * Decoding: pts of the first frame of the stream, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimated from bitrate and file size. + */ + int64_t duration; + + int64_t nb_frames; ///< number of frames in this stream if known or 0 + + int disposition; /**< AV_DISPOSITION_* bit field */ + + enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + + /** + * sample aspect ratio (0 if unknown) + * - encoding: Set by user. + * - decoding: Set by libavformat. + */ + AVRational sample_aspect_ratio; + + AVDictionary *metadata; + + /** + * Average framerate + */ + AVRational avg_frame_rate; + + /** + * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet + * will contain the attached picture. + * + * decoding: set by libavformat, must not be modified by the caller. + * encoding: unused + */ + AVPacket attached_pic; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Stream information used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (60*12+5) + struct { +#if FF_API_R_FRAME_RATE + int64_t last_dts; + int64_t duration_gcd; + int duration_count; + double duration_error[MAX_STD_TIMEBASES]; +#endif + int nb_decoded_frames; + int found_decoder; + + /** + * Those are used for average framerate estimation. + */ + int64_t fps_first_dts; + int fps_first_dts_idx; + int64_t fps_last_dts; + int fps_last_dts_idx; + + } *info; + + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ + + // Timestamp generation support: + /** + * Timestamp corresponding to the last dts sync point. + * + * Initialized when AVCodecParserContext.dts_sync_point >= 0 and + * a DTS is received from the underlying container. Otherwise set to + * AV_NOPTS_VALUE by default. + */ + int64_t reference_dts; + int64_t first_dts; + int64_t cur_dts; + int64_t last_IP_pts; + int last_IP_duration; + + /** + * Number of packets to buffer for codec probing + */ +#define MAX_PROBE_PACKETS 2500 + int probe_packets; + + /** + * Number of frames that have been demuxed during av_find_stream_info() + */ + int codec_info_nb_frames; + + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct AVPacketList *last_in_packet_buffer; + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY+1]; + + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; +} AVStream; + +#define AV_PROGRAM_RUNNING 1 + +/** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + */ +typedef struct AVProgram { + int id; + int flags; + enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller + unsigned int *stream_index; + unsigned int nb_stream_indexes; + AVDictionary *metadata; +} AVProgram; + +#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present + (streams are added dynamically) */ + +typedef struct AVChapter { + int id; ///< unique ID to identify the chapter + AVRational time_base; ///< time base in which the start/end timestamps are specified + int64_t start, end; ///< chapter start/end time in time_base units + AVDictionary *metadata; +} AVChapter; + +/** + * Format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. + */ +typedef struct AVFormatContext { + /** + * A class for logging and AVOptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * Can only be iformat or oformat, not both at the same time. + * + * decoding: set by avformat_open_input(). + * encoding: set by the user. + */ + struct AVInputFormat *iformat; + struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + */ + void *priv_data; + + /** + * I/O context. + * + * decoding: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * encoding: set by the user. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ + AVIOContext *pb; + + /* stream info */ + int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ + + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * decoding: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * encoding: streams are created by the user before avformat_write_header(). + */ + unsigned int nb_streams; + AVStream **streams; + + char filename[1024]; /**< input or output filename */ + + /** + * Decoding: position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in AV_TIME_BASE fractional + * seconds. Only set this value if you know none of the individual stream + * durations and also do not set any of them. This is deduced from the + * AVStream values if not set. + */ + int64_t duration; + + /** + * Decoding: total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as Libav can compute it automatically. + */ + int bit_rate; + + unsigned int packet_size; + int max_delay; + + int flags; +#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. +#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. +#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. +#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS +#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container +#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled +#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted + + /** + * decoding: size of data to probe; encoding: unused. + */ + unsigned int probesize; + + /** + * decoding: maximum time (in AV_TIME_BASE units) during which the input should + * be analyzed in avformat_find_stream_info(). + */ + int max_analyze_duration; + + const uint8_t *key; + int keylen; + + unsigned int nb_programs; + AVProgram **programs; + + /** + * Forced video codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID video_codec_id; + + /** + * Forced audio codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID audio_codec_id; + + /** + * Forced subtitle codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID subtitle_codec_id; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * muxing : unused + * demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + + unsigned int nb_chapters; + AVChapter **chapters; + + AVDictionary *metadata; + + /** + * Start time of the stream in real world time, in microseconds + * since the unix epoch (00:00 1st January 1970). That is, pts=0 + * in the stream was captured at this real world time. + * - encoding: Set by user. + * - decoding: Unused. + */ + int64_t start_time_realtime; + + /** + * decoding: number of frames used to probe fps + */ + int fps_probe_size; + + /** + * Error recognition; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int error_recognition; + + /** + * Custom interrupt callbacks for the I/O layer. + * + * decoding: set by the user before avformat_open_input(). + * encoding: set by the user before avformat_write_header() + * (mainly useful for AVFMT_NOFILE formats). The callback + * should also be passed to avio_open2() if it's used to + * open the file. + */ + AVIOInterruptCB interrupt_callback; + + /** + * Flags to enable debugging. + */ + int debug; +#define FF_FDEBUG_TS 0x0001 + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ + struct AVPacketList *packet_buffer; + struct AVPacketList *packet_buffer_end; + + /* av_seek_frame() support */ + int64_t data_offset; /**< offset of the first packet */ + + /** + * Raw packets from the demuxer, prior to parsing and decoding. + * This buffer is used for buffering packets until the codec can + * be identified, as parsing cannot be done without knowing the + * codec. + */ + struct AVPacketList *raw_packet_buffer; + struct AVPacketList *raw_packet_buffer_end; + /** + * Packets split by the parser get queued here. + */ + struct AVPacketList *parse_queue; + struct AVPacketList *parse_queue_end; + /** + * Remaining size available for raw_packet_buffer, in bytes. + */ +#define RAW_PACKET_BUFFER_SIZE 2500000 + int raw_packet_buffer_remaining_size; +} AVFormatContext; + +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; + + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + * @see av_register_protocol() + */ +void av_register_all(void); + +void av_register_input_format(AVInputFormat *format); +void av_register_output_format(AVOutputFormat *format); + +/** + * Do global initialization of network components. This is optional, + * but recommended, since it avoids the overhead of implicitly + * doing the setup for each session. + * + * Calling this function will become mandatory if using network + * protocols at some major version bump. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. + */ +int avformat_network_deinit(void); + +/** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + */ +AVInputFormat *av_iformat_next(AVInputFormat *f); + +/** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered output format after f + * or NULL if f is the last one. + */ +AVOutputFormat *av_oformat_next(AVOutputFormat *f); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + +/** + * @addtogroup lavf_decoding + * @{ + */ + +/** + * Find AVInputFormat based on the short name of the input format. + */ +AVInputFormat *av_find_input_format(const char *short_name); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + */ +AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); + +/** + * Guess the file format. + * + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_max A probe score larger that this is required to accept a + * detection, the variable is set to the actual detection + * score afterwards. + * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended + * to retry with a larger probe buffer. + */ +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with av_close_input_file(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param filename Name of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); + +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @param options If non-NULL, an ic.nb_streams long array of pointers to + * dictionaries, where i-th member contains options for + * codec corresponding to i-th stream. + * On return each dictionary will be filled with options that were not found. + * @return >=0 if OK, AVERROR_xxx on error + * + * @note this function isn't guaranteed to open all the codecs, so + * options being non-empty at return is a perfectly normal behavior. + * + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + */ +int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); + +/** + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +#if FF_API_READ_PACKET +/** + * @deprecated use AVFMT_FLAG_NOFILLIN | AVFMT_FLAG_NOPARSE to read raw + * unprocessed packets + * + * Read a transport packet from a media file. + * + * This function is obsolete and should never be used. + * Use av_read_frame() instead. + * + * @param s media file handle + * @param pkt is filled + * @return 0 if OK, AVERROR_xxx on error + */ +attribute_deprecated +int av_read_packet(AVFormatContext *s, AVPacket *pkt); +#endif + +/** + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. + * + * If pkt->destruct is NULL, then the packet is valid until the next + * av_read_frame() or until av_close_input_file(). Otherwise the packet is valid + * indefinitely. In both cases the packet must be freed with + * av_free_packet when it is no longer needed. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of frames if each + * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames + * have a variable size (e.g. MPEG audio), then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AVStream.time_base units (and guessed if the format cannot + * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B-frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 on error or end of file + */ +int av_read_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp Timestamp in AVStream.time_base units + * or, if no stream is specified, in AV_TIME_BASE units. + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + */ +int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, + int flags); + +/** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * + * @param stream_index index of the stream which is used as time base reference + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @return >=0 on success, error code otherwise + * + * @note This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + */ +int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + +/** + * Start playing a network-based stream (e.g. RTSP stream) at the + * current position. + */ +int av_read_play(AVFormatContext *s); + +/** + * Pause a network-based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + */ +int av_read_pause(AVFormatContext *s); + +#if FF_API_CLOSE_INPUT_FILE +/** + * @deprecated use avformat_close_input() + * Close a media file (but not its codecs). + * + * @param s media file handle + */ +attribute_deprecated +void av_close_input_file(AVFormatContext *s); +#endif + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); +/** + * @} + */ + +#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward +#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes +#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes +#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number + +/** + * @addtogroup lavf_encoding + * @{ + */ +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already openened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + */ +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +/** + * Write a packet to an output media file. + * + * The packet shall contain one audio or video frame. + * The packet must be correctly interleaved according to the container + * specification, if not then av_interleaved_write_frame must be used. + * + * @param s media file handle + * @param pkt The packet, which contains the stream_index, buf/buf_size, + * dts/pts, ... + * This can be NULL (at any time, not just at the end), in + * order to immediately flush data buffered within the muxer, + * for muxers that buffer up data internally before writing it + * to the output. + * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush + */ +int av_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a packet to an output media file ensuring correct interleaving. + * + * The packet must contain one audio or video frame. + * If the packets are already correctly interleaved, the application should + * call av_write_frame() instead as it is slightly faster. It is also important + * to keep in mind that completely non-interleaved input will need huge amounts + * of memory to interleave with this, so it is preferable to interleave at the + * demuxer level. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. Libavformat takes + * ownership of the data and will free it when it sees fit using the packet's + * @ref AVPacket.destruct "destruct" field. The caller must not access the data + * after this function returns, as it may already be freed. + * This can be NULL (at any time, not just at the end), to flush the + * interleaving queues. + * Packet's @ref AVPacket.stream_index "stream_index" field must be set to the + * index of the corresponding stream in @ref AVFormatContext.streams + * "s.streams". + * It is very strongly recommended that timing information (@ref AVPacket.pts + * "pts", @ref AVPacket.dts "dts" @ref AVPacket.duration "duration") is set to + * correct values. + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); + +#if FF_API_INTERLEAVE_PACKET +/** + * @deprecated this function was never meant to be called by the user + * programs. + */ +attribute_deprecated +int av_interleave_packet_per_dts(AVFormatContext *s, AVPacket *out, + AVPacket *pkt, int flush); +#endif + +/** + * Write the stream trailer to an output media file and free the + * file private data. + * + * May only be called after a successful call to avformat_write_header. + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + */ +int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + +/** + * @} + */ + + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscellaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, const uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +/** + * Get the AVCodecID for the given codec tag tag. + * If no codec id is found returns AV_CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ +enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + +/** + * Return in 'buf' the path with '%d' replaced by a number. + * + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @return 0 if OK, -1 on format error + */ +int av_get_frame_filename(char *buf, int buf_size, + const char *path, int number); + +/** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise + */ +int av_filename_number_test(const char *filename); + +/** + * Generate an SDP for an RTP session. + * + * Note, this overwrites the id values of AVStreams in the muxer contexts + * for getting unique dynamic payload types. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream. + * @param n_files number of AVCodecContexts contained in ac + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) + * @param size the size of the buffer + * @return 0 if OK, AVERROR_xxx on error + */ +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +/** + * Return a positive value if the given filename has one of the given + * extensions, 0 otherwise. + * + * @param extensions a comma-separated list of filename extensions + */ +int av_match_ext(const char *filename, const char *extensions); + +/** + * Test if the given container can store a codec. + * + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance); + +/** + * @defgroup riff_fourcc RIFF FourCCs + * @{ + * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are + * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the + * following code: + * @code + * uint32_t tag = MKTAG('H', '2', '6', '4'); + * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; + * enum AVCodecID id = av_codec_get_id(table, tag); + * @endcode + */ +/** + * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_video_tags(void); +/** + * @return the table mapping RIFF FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_audio_tags(void); +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavformat/avio.h b/content/media/fmp4/ffmpeg/libav54/include/libavformat/avio.h new file mode 100644 index 000000000000..b6d3cb33b21a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavformat/avio.h @@ -0,0 +1,433 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_AVIO_H +#define AVFORMAT_AVIO_H + +/** + * @file + * @ingroup lavf_io + * Buffered I/O operations + */ + +#include + +#include "libavutil/common.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Callback for checking whether to abort blocking functions. + * AVERROR_EXIT is returned in this case by the interrupted + * function. During blocking operations, callback is called with + * opaque as parameter. If the callback returns 1, the + * blocking operation will be aborted. + * + * No members can be added to this struct without a major bump, if + * new elements have been added after this struct in AVFormatContext + * or AVIOContext. + */ +typedef struct AVIOInterruptCB { + int (*callback)(void*); + void *opaque; +} AVIOInterruptCB; + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct AVIOContext { + /** + * A class for private options. + * + * If this AVIOContext is created by avio_open2(), av_class is set and + * passes the options down to protocols. + * + * If this AVIOContext is manually allocated, then av_class may be set by + * the caller. + * + * warning -- this field can be NULL, be sure to not pass this AVIOContext + * to any av_opt_* functions in that case. + */ + const AVClass *av_class; + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; +} AVIOContext; + +/* unbuffered I/O */ + +/** + * Return AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + */ +int avio_check(const char *url, int flags); + +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with av_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * @param write_packet A function for writing the buffer contents, may be NULL. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * Oring this flag as into the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonble + * means that can be extreemly slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset) +{ + return avio_seek(s, offset, SEEK_CUR); +} + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** @warning currently size is limited */ +int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); + +void avio_flush(AVIOContext *s); + + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param flags flags which control how the resource indicated by url + * is to be opened + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param flags flags which control how the resource indicated by url + * is to be opened + * @param int_cb an interrupt callback to be used at the protocols level + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dict containing options + * that were not found. May be NULL. + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open2(AVIOContext **s, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ +int avio_close(AVIOContext *s); + +/** + * Close the resource accessed by the AVIOContext *s, free it + * and set the pointer pointing to it to NULL. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_close + */ +int avio_closep(AVIOContext **s); + + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail with ENOTSUP. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail with ENOTSUP if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +#endif /* AVFORMAT_AVIO_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavformat/version.h b/content/media/fmp4/ffmpeg/libav54/include/libavformat/version.h new file mode 100644 index 000000000000..2944d5e1f8f3 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavformat/version.h @@ -0,0 +1,71 @@ +/* + * Version macros. + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + +#include "libavutil/avutil.h" + +#define LIBAVFORMAT_VERSION_MAJOR 54 +#define LIBAVFORMAT_VERSION_MINOR 20 +#define LIBAVFORMAT_VERSION_MICRO 4 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_CLOSE_INPUT_FILE +#define FF_API_CLOSE_INPUT_FILE (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_APPLEHTTP_PROTO +#define FF_API_APPLEHTTP_PROTO (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_READ_PACKET +#define FF_API_READ_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_INTERLEAVE_PACKET +#define FF_API_INTERLEAVE_PACKET (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_AV_GETTIME +#define FF_API_AV_GETTIME (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif +#ifndef FF_API_R_FRAME_RATE +#define FF_API_R_FRAME_RATE (LIBAVFORMAT_VERSION_MAJOR < 55) +#endif + +#endif /* AVFORMAT_VERSION_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/adler32.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/adler32.h new file mode 100644 index 000000000000..a8ff6f9d41c2 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/adler32.h @@ -0,0 +1,43 @@ +/* + * copyright (c) 2006 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_ADLER32_H +#define AVUTIL_ADLER32_H + +#include +#include "attributes.h" + +/** + * @ingroup lavu_crypto + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ +unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, + unsigned int len) av_pure; + +#endif /* AVUTIL_ADLER32_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/aes.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/aes.h new file mode 100644 index 000000000000..edff275b7ad8 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/aes.h @@ -0,0 +1,67 @@ +/* + * copyright (c) 2007 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_aes_size; +#endif + +struct AVAES; + +/** + * Allocate an AVAES context. + */ +struct AVAES *av_aes_alloc(void); + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/attributes.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/attributes.h new file mode 100644 index 000000000000..292a0a1a88f0 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/attributes.h @@ -0,0 +1,122 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) +#else +# define AV_GCC_VERSION_AT_LEAST(x,y) 0 +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define av_always_inline __forceinline +#else +# define av_always_inline inline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_noinline __attribute__((noinline)) +#else +# define av_noinline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,6) +# define av_const __attribute__((const)) +#else +# define av_const +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,1) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define attribute_deprecated __attribute__((deprecated)) +#else +# define attribute_deprecated +#endif + +#if defined(__GNUC__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,3) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif + +#if defined(__GNUC__) && !defined(__ICC) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif + +#ifdef __GNUC__ +# define av_builtin_constant_p __builtin_constant_p +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) +#else +# define av_builtin_constant_p(x) 0 +# define av_printf_format(fmtpos, attrpos) +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,5) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/audio_fifo.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/audio_fifo.h new file mode 100644 index 000000000000..8c76388255bf --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/audio_fifo.h @@ -0,0 +1,146 @@ +/* + * Audio FIFO + * Copyright (c) 2012 Justin Ruggles + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/audioconvert.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/audioconvert.h new file mode 100644 index 000000000000..300a67cd3d5a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/audioconvert.h @@ -0,0 +1,6 @@ + +#include "version.h" + +#if FF_API_AUDIOCONVERT +#include "channel_layout.h" +#endif diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/avassert.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avassert.h new file mode 100644 index 000000000000..b223d26e8d13 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/avconfig.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avconfig.h new file mode 100644 index 000000000000..f10aa6186b4f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avconfig.h @@ -0,0 +1,6 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/avstring.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avstring.h new file mode 100644 index 000000000000..acd6610d38fc --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avstring.h @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2007 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVSTRING_H +#define AVUTIL_AVSTRING_H + +#include +#include "attributes.h" + +/** + * @addtogroup lavu_string + * @{ + */ + +/** + * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to + * the address of the first character in str after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_strstart(const char *str, const char *pfx, const char **ptr); + +/** + * Return non-zero if pfx is a prefix of str independent of case. If + * it is, *ptr is set to the address of the first character in str + * after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_stristart(const char *str, const char *pfx, const char **ptr); + +/** + * Locate the first case-independent occurrence in the string haystack + * of the string needle. A zero-length string needle is considered to + * match at the start of haystack. + * + * This function is a case-insensitive version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_stristr(const char *haystack, const char *needle); + +/** + * Copy the string src to dst, but no more than size - 1 bytes, and + * null-terminate dst. + * + * This function is the same as BSD strlcpy(). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the length of src + * + * @warning since the return value is the length of src, src absolutely + * _must_ be a properly 0-terminated string, otherwise this will read beyond + * the end of the buffer and possibly crash. + */ +size_t av_strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst, but to a total length of + * no more than size - 1 bytes, and null-terminate dst. + * + * This function is similar to BSD strlcat(), but differs when + * size <= strlen(dst). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the total length of src and dst + * + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. + */ +size_t av_strlcat(char *dst, const char *src, size_t size); + +/** + * Append output to a string, according to a format. Never write out of + * the destination buffer, and always put a terminating 0 within + * the buffer. + * @param dst destination buffer (string to which the output is + * appended) + * @param size total size of the destination buffer + * @param fmt printf-compatible format string, specifying how the + * following parameters are used + * @return the length of the string that would have been generated + * if enough space had been available + */ +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Convert a number to a av_malloced string. + */ +char *av_d2str(double d); + +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + +/** + * Locale-independent conversion of ASCII characters to uppercase. + */ +static inline int av_toupper(int c) +{ + if (c >= 'a' && c <= 'z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII characters to lowercase. + */ +static inline int av_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + c ^= 0x20; + return c; +} + +/* + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strcasecmp(const char *a, const char *b); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strncasecmp(const char *a, const char *b, size_t n); + + +/** + * Thread safe basename. + * @param path the path, on DOS both \ and / are considered separators. + * @return pointer to the basename substring. + */ +const char *av_basename(const char *path); + +/** + * Thread safe dirname. + * @param path the path, on DOS both \ and / are considered separators. + * @return the path with the separator replaced by the string terminator or ".". + * @note the function may change the input string. + */ +const char *av_dirname(char *path); + +/** + * @} + */ + +#endif /* AVUTIL_AVSTRING_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/avutil.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avutil.h new file mode 100644 index 000000000000..33f9bea7236c --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/avutil.h @@ -0,0 +1,275 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * external API header + */ + +/** + * @mainpage + * + * @section libav_intro Introduction + * + * This document describes the usage of the different libraries + * provided by Libav. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @subpage libavfilter graph based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @ref lavr "libavresample" audio resampling, format conversion and mixing + * @li @subpage libswscale color conversion and scaling library + */ + +/** + * @defgroup lavu Common utility functions + * + * @brief + * libavutil contains the code shared across all the other Libav + * libraries + * + * @note In order to use the functions provided by avutil you must include + * the specific header. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Maths + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup lavu_internal Internal + * + * Not exported functions, for internal usage only + * + * @{ + * + * @} + */ + + +/** + * @defgroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +#define AV_PRAGMA(s) _Pragma(#s) + +/** + * @} + */ + +/** + * @defgroup version_utils Library Version Macros + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * @} + */ + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< + +/** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** + * Decode a base64-encoded string. + * + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input + */ +int av_base64_decode(uint8_t *out, const char *in, int out_size); + +/** + * Encode data to base64 and null-terminate. + * + * @param out buffer for encoded data + * @param out_size size in bytes of the output buffer, must be at + * least AV_BASE64_SIZE(in_size) + * @param in_size size in bytes of the 'in' buffer + * @return 'out' or NULL in case of error + */ +char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); + +/** + * Calculate the output size needed to base64-encode x bytes. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + + /** + * @} + */ + +#endif /* AVUTIL_BASE64_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/blowfish.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/blowfish.h new file mode 100644 index 000000000000..8c29536cfe01 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/blowfish.h @@ -0,0 +1,76 @@ +/* + * Blowfish algorithm + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOWFISH_H +#define AVUTIL_BLOWFISH_H + +#include + +/** + * @defgroup lavu_blowfish Blowfish + * @ingroup lavu_crypto + * @{ + */ + +#define AV_BF_ROUNDS 16 + +typedef struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +} AVBlowfish; + +/** + * Initialize an AVBlowfish context. + * + * @param ctx an AVBlowfish context + * @param key a key + * @param key_len length of the key + */ +void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param xl left four bytes halves of input to be encrypted + * @param xr right four bytes halves of input to be encrypted + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, + int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_BLOWFISH_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/bswap.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/bswap.h new file mode 100644 index 000000000000..8a350e1cd5c3 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/bswap.h @@ -0,0 +1,109 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_BFIN +# include "bfin/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) +{ + x= (x>>8) | (x<<8); + return x; +} +#endif + +#ifndef av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + return AV_BSWAP32C(x); +} +#endif + +#ifndef av_bswap64 +static inline uint64_t av_const av_bswap64(uint64_t x) +{ + return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); +} +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/channel_layout.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/channel_layout.h new file mode 100644 index 000000000000..15b6887a6743 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/channel_layout.h @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2006 Michael Niedermayer + * Copyright (c) 2008 Peter Ross + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CHANNEL_LAYOUT_H +#define AVUTIL_CHANNEL_LAYOUT_H + +#include + +/** + * @file + * audio channel layout utility functions + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * @{ + */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL + +/** + * @} + * @defgroup channel_mask_c Audio channel convenience macros + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +enum AVMatrixEncoding { + AV_MATRIX_ENCODING_NONE, + AV_MATRIX_ENCODING_DOLBY, + AV_MATRIX_ENCODING_DPLII, + AV_MATRIX_ENCODING_NB +}; + +/** + * @} + */ + +/** + * Return a channel layout id that matches name, or 0 if no match is found. + * + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, optionally followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + * + * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" + */ +uint64_t av_get_channel_layout(const char *name); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(uint64_t channel_layout); + +/** + * Return default channel layout for a given number of channels. + */ +uint64_t av_get_default_channel_layout(int nb_channels); + +/** + * Get the index of a channel in channel_layout. + * + * @param channel a channel layout describing exactly one channel which must be + * present in channel_layout. + * + * @return index of channel in channel_layout on success, a negative AVERROR + * on error. + */ +int av_get_channel_layout_channel_index(uint64_t channel_layout, + uint64_t channel); + +/** + * Get the channel with the given index in channel_layout. + */ +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); + +/** + * Get the name of a given channel. + * + * @return channel name on success, NULL on error. + */ +const char *av_get_channel_name(uint64_t channel); + +/** + * @} + */ + +#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/common.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/common.h new file mode 100644 index 000000000000..cc4df16e4a7a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/common.h @@ -0,0 +1,406 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "attributes.h" +#include "version.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +//rounded division & shift +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +/* misc math functions */ + +#if FF_API_AV_REVERSE +extern attribute_deprecated const uint8_t av_reverse[256]; +#endif + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +#endif + +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" + +#ifndef av_log2 +av_const int av_log2(unsigned v); +#endif + +#ifndef av_log2_16bit +av_const int av_log2_16bit(unsigned v); +#endif + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) +{ + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) +{ + if (a&(~0xFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) +{ + if (a&(~0xFFFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) +{ + if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) +{ + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; + else return a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<> 31 & ((1< amax) return amax; + else return a; +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) +{ + return av_log2((x - 1) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) +{ + return av_popcount(x) + av_popcount(x >> 32); +} + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= GET_BYTE;\ + {\ + uint32_t top = (val & 128) >> 1;\ + if ((val & 0xc0) == 0x80)\ + ERROR\ + while (val & top) {\ + int tmp= GET_BYTE - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + top <<= 5;\ + }\ + val &= (top << 1) - 1;\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = GET_16BIT;\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = GET_16BIT - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + ERROR\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + + + +#include "mem.h" + +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_sat_add32 +# define av_sat_add32 av_sat_add32_c +#endif +#ifndef av_sat_dadd32 +# define av_sat_dadd32 av_sat_dadd32_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/cpu.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/cpu.h new file mode 100644 index 000000000000..4929512c66f3 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/cpu.h @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#include "version.h" + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext +#if FF_API_CPU_FLAG_MMX2 +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#endif +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +#define AV_CPU_FLAG_CMOV 0x1000 ///< i686 cmov + +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +#define AV_CPU_FLAG_ARMV5TE (1 << 0) +#define AV_CPU_FLAG_ARMV6 (1 << 1) +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) +#define AV_CPU_FLAG_VFP (1 << 3) +#define AV_CPU_FLAG_VFPV3 (1 << 4) +#define AV_CPU_FLAG_NEON (1 << 5) + +/** + * Return the flags which specify extensions supported by the CPU. + */ +int av_get_cpu_flags(void); + +/** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * + * @warning this function is not thread safe. + */ +void av_set_cpu_flags_mask(int mask); + +/** + * Parse CPU flags from a string. + * + * @return a combination of AV_CPU_* flags, negative on error. + */ +int av_parse_cpu_flags(const char *s); + +/* The following CPU-specific functions shall not be called directly. */ +int ff_get_cpu_flags_arm(void); +int ff_get_cpu_flags_ppc(void); +int ff_get_cpu_flags_x86(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/crc.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/crc.h new file mode 100644 index 000000000000..0540619d20f2 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/crc.h @@ -0,0 +1,74 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CRC_H +#define AVUTIL_CRC_H + +#include +#include +#include "attributes.h" + +typedef uint32_t AVCRC; + +typedef enum { + AV_CRC_8_ATM, + AV_CRC_16_ANSI, + AV_CRC_16_CCITT, + AV_CRC_32_IEEE, + AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ +}AVCRCId; + +/** + * Initialize a CRC table. + * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 + * @param le If 1, the lowest bit represents the coefficient for the highest + * exponent of the corresponding polynomial (both for poly and + * actual CRC). + * If 0, you must swap the CRC parameter and the result of av_crc + * if you need the standard representation (can be simplified in + * most cases to e.g. bswap16): + * av_bswap32(crc << (32-bits)) + * @param bits number of bits for the CRC + * @param poly generator polynomial without the x**bits coefficient, in the + * representation as specified by le + * @param ctx_size size of ctx in bytes + * @return <0 on failure + */ +int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); + +/** + * Get an initialized standard CRC table. + * @param crc_id ID of a standard CRC + * @return a pointer to the CRC table or NULL on failure + */ +const AVCRC *av_crc_get_table(AVCRCId crc_id); + +/** + * Calculate the CRC of a block. + * @param crc CRC of previous blocks if any or initial value for CRC + * @return CRC updated with the data from the given block + * + * @see av_crc_init() "le" parameter + */ +uint32_t av_crc(const AVCRC *ctx, uint32_t crc, + const uint8_t *buffer, size_t length) av_pure; + +#endif /* AVUTIL_CRC_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/dict.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/dict.h new file mode 100644 index 000000000000..492da9a41c31 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/dict.h @@ -0,0 +1,129 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + * @code + * AVDictionary *d = NULL; // "create" an empty dictionary + * av_dict_set(&d, "foo", "bar", 0); // add an entry + * + * char *k = av_strdup("key"); // if your strings are already allocated, + * char *v = av_strdup("value"); // you can avoid copying them like this + * av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + * + * AVDictionaryEntry *t = NULL; + * while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + * <....> // iterate over all entries in d + * } + * + * av_dict_free(&d); + * @endcode + * + */ + +#define AV_DICT_MATCH_CASE 1 +#define AV_DICT_IGNORE_SUFFIX 2 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() and children. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() and chilren. */ +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ + +typedef struct AVDictionaryEntry { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + */ +AVDictionaryEntry * +av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); + +/** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + */ +int av_dict_count(const AVDictionary *m); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * @} + */ + +#endif /* AVUTIL_DICT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/error.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/error.h new file mode 100644 index 000000000000..3dfd8807feff --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/error.h @@ -0,0 +1,83 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include +#include +#include "avutil.h" + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define AVERROR_BSF_NOT_FOUND (-0x39acbd08) ///< Bitstream filter not found +#define AVERROR_DECODER_NOT_FOUND (-0x3cbabb08) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-0x32babb08) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-0x3cb1ba08) ///< Encoder not found +#define AVERROR_EOF (-0x5fb9b0bb) ///< End of file +#define AVERROR_EXIT (-0x2bb6a7bb) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-0x33b6b908) ///< Filter not found +#define AVERROR_INVALIDDATA (-0x3ebbb1b7) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-0x27aab208) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-0x2bafb008) ///< Option not found +#define AVERROR_PATCHWELCOME (-0x3aa8beb0) ///< Not yet implemented in Libav, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-0x30adaf08) ///< Protocol not found +#define AVERROR_STREAM_NOT_FOUND (-0x2dabac08) ///< Stream not found +#define AVERROR_BUG (-0x5fb8aabe) ///< Bug detected, please report the issue +#define AVERROR_UNKNOWN (-0x31b4b1ab) ///< Unknown error, typically from an external library +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/eval.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/eval.h new file mode 100644 index 000000000000..ccb29e7a336f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/eval.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successful parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value for + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/fifo.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/fifo.h new file mode 100644 index 000000000000..ea30f5d2bdd0 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/fifo.h @@ -0,0 +1,131 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a very simple circular buffer FIFO implementation + */ + +#ifndef AVUTIL_FIFO_H +#define AVUTIL_FIFO_H + +#include +#include "avutil.h" +#include "attributes.h" + +typedef struct AVFifoBuffer { + uint8_t *buffer; + uint8_t *rptr, *wptr, *end; + uint32_t rndx, wndx; +} AVFifoBuffer; + +/** + * Initialize an AVFifoBuffer. + * @param size of FIFO + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc(unsigned int size); + +/** + * Free an AVFifoBuffer. + * @param f AVFifoBuffer to free + */ +void av_fifo_free(AVFifoBuffer *f); + +/** + * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * @param f AVFifoBuffer to reset + */ +void av_fifo_reset(AVFifoBuffer *f); + +/** + * Return the amount of data in bytes in the AVFifoBuffer, that is the + * amount of data you can read from it. + * @param f AVFifoBuffer to read from + * @return size + */ +int av_fifo_size(AVFifoBuffer *f); + +/** + * Return the amount of space in bytes in the AVFifoBuffer, that is the + * amount of data you can write into it. + * @param f AVFifoBuffer to write into + * @return size + */ +int av_fifo_space(AVFifoBuffer *f); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from a user-supplied callback to an AVFifoBuffer. + * @param f AVFifoBuffer to write to + * @param src data source; non-const since it may be used as a + * modifiable context by the function defined in func + * @param size number of bytes to write + * @param func generic write function; the first parameter is src, + * the second is dest_buf, the third is dest_buf_size. + * func must return the number of bytes written to dest_buf, or <= 0 to + * indicate no more data available to write. + * If func is NULL, src is interpreted as a simple byte array for source data. + * @return the number of bytes written to the FIFO + */ +int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); + +/** + * Resize an AVFifoBuffer. + * @param f AVFifoBuffer to resize + * @param size new AVFifoBuffer size in bytes + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); + +/** + * Read and discard the specified amount of data from an AVFifoBuffer. + * @param f AVFifoBuffer to read from + * @param size amount of data to read in bytes + */ +void av_fifo_drain(AVFifoBuffer *f, int size); + +/** + * Return a pointer to the data stored in a FIFO buffer at a certain offset. + * The FIFO buffer is not modified. + * + * @param f AVFifoBuffer to peek at, f must be non-NULL + * @param offs an offset in bytes, its absolute value must be less + * than the used buffer size or the returned pointer will + * point outside to the buffer data. + * The used buffer size can be checked with av_fifo_size(). + */ +static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) +{ + uint8_t *ptr = f->rptr + offs; + if (ptr >= f->end) + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; +} + +#endif /* AVUTIL_FIFO_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/file.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/file.h new file mode 100644 index 000000000000..e3f02a8308b7 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/file.h @@ -0,0 +1,54 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +#endif /* AVUTIL_FILE_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/imgutils.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/imgutils.h new file mode 100644 index 000000000000..71510132ae73 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/imgutils.h @@ -0,0 +1,138 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + * + * @addtogroup lavu_picture + * @{ + */ + +#include "avutil.h" +#include "pixdesc.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum AVPixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesizes linesizes for the image in dst_data + * @param src_linesizes linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); + +/** + * @} + */ + + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat.h new file mode 100644 index 000000000000..38d26ad87e12 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTFLOAT_H +#define AVUTIL_INTFLOAT_H + +#include +#include "attributes.h" + +union av_intfloat32 { + uint32_t i; + float f; +}; + +union av_intfloat64 { + uint64_t i; + double f; +}; + +/** + * Reinterpret a 32-bit integer as a float. + */ +static av_always_inline float av_int2float(uint32_t i) +{ + union av_intfloat32 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a float as a 32-bit integer. + */ +static av_always_inline uint32_t av_float2int(float f) +{ + union av_intfloat32 v; + v.f = f; + return v.i; +} + +/** + * Reinterpret a 64-bit integer as a double. + */ +static av_always_inline double av_int2double(uint64_t i) +{ + union av_intfloat64 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a double as a 64-bit integer. + */ +static av_always_inline uint64_t av_double2int(double f) +{ + union av_intfloat64 v; + v.f = f; + return v.i; +} + +#endif /* AVUTIL_INTFLOAT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat_readwrite.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat_readwrite.h new file mode 100644 index 000000000000..f093b92cd23b --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/intfloat_readwrite.h @@ -0,0 +1,40 @@ +/* + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTFLOAT_READWRITE_H +#define AVUTIL_INTFLOAT_READWRITE_H + +#include +#include "attributes.h" + +/* IEEE 80 bits extended float */ +typedef struct AVExtFloat { + uint8_t exponent[2]; + uint8_t mantissa[8]; +} AVExtFloat; + +attribute_deprecated double av_int2dbl(int64_t v) av_const; +attribute_deprecated float av_int2flt(int32_t v) av_const; +attribute_deprecated double av_ext2dbl(const AVExtFloat ext) av_const; +attribute_deprecated int64_t av_dbl2int(double d) av_const; +attribute_deprecated int32_t av_flt2int(float d) av_const; +attribute_deprecated AVExtFloat av_dbl2ext(double d) av_const; + +#endif /* AVUTIL_INTFLOAT_READWRITE_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/intreadwrite.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/intreadwrite.h new file mode 100644 index 000000000000..f77fd60f383f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/intreadwrite.h @@ -0,0 +1,549 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8 [8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8 [4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8 [2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(__DECC) + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, d) do { \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, d) do { \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, d) do { \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* + * The AV_COPYxxU macros are suitable for copying data to/from unaligned + * memory locations. + */ + +#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s)); + +#ifndef AV_COPY16U +# define AV_COPY16U(d, s) AV_COPYU(16, d, s) +#endif + +#ifndef AV_COPY32U +# define AV_COPY32U(d, s) AV_COPYU(32, d, s) +#endif + +#ifndef AV_COPY64U +# define AV_COPY64U(d, s) AV_COPYU(64, d, s) +#endif + +#ifndef AV_COPY128U +# define AV_COPY128U(d, s) \ + do { \ + AV_COPY64U(d, s); \ + AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \ + } while(0) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/lfg.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/lfg.h new file mode 100644 index 000000000000..5e526c1dae21 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/lfg.h @@ -0,0 +1,62 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +typedef struct AVLFG { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c){ + c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c){ + unsigned int a= c->state[(c->index-55) & 63]; + unsigned int b= c->state[(c->index-24) & 63]; + return c->state[c->index++ & 63] = 2*a*b+a+b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/log.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/log.h new file mode 100644 index 000000000000..7b173302f809 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/log.h @@ -0,0 +1,173 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LOG_H +#define AVUTIL_LOG_H + +#include +#include "avutil.h" +#include "attributes.h" + +/** + * Describe the class of an AVClass context structure. That is an + * arbitrary struct of which the first field is a pointer to an + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). + */ +typedef struct AVClass { + /** + * The name of the class; usually it is the same name as the + * context structure type to which the AVClass is associated. + */ + const char* class_name; + + /** + * A pointer to a function which returns the name of a context + * instance ctx associated with the class. + */ + const char* (*item_name)(void* ctx); + + /** + * a pointer to the first option specified in the class if any or NULL + * + * @see av_set_default_options() + */ + const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + */ + int parent_log_context_offset; + + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_next)(const struct AVClass *prev); +} AVClass; + +/* av_log API */ + +#define AV_LOG_QUIET -8 + +/** + * Something went really wrong and we will crash now. + */ +#define AV_LOG_PANIC 0 + +/** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + */ +#define AV_LOG_FATAL 8 + +/** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + */ +#define AV_LOG_ERROR 16 + +/** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + */ +#define AV_LOG_WARNING 24 + +#define AV_LOG_INFO 32 +#define AV_LOG_VERBOSE 40 + +/** + * Stuff which is only useful for libav* developers. + */ +#define AV_LOG_DEBUG 48 + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different av_vlog callback + * function. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @see av_vlog + */ +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); + +void av_vlog(void *avcl, int level, const char *fmt, va_list); +int av_log_get_level(void); +void av_log_set_level(int); +void av_log_set_callback(void (*)(void*, int, const char*, va_list)); +void av_log_default_callback(void* ptr, int level, const char* fmt, va_list vl); +const char* av_default_item_name(void* ctx); + +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) +#endif + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); + +#endif /* AVUTIL_LOG_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/lzo.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/lzo.h new file mode 100644 index 000000000000..9d7e8f1dc10a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/lzo.h @@ -0,0 +1,66 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LZO_H +#define AVUTIL_LZO_H + +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + +#include + +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished +#define AV_LZO_INPUT_DEPLETED 1 +/// decoded data did not fit into output buffer +#define AV_LZO_OUTPUT_FULL 2 +/// a reference to previously decoded data was wrong +#define AV_LZO_INVALID_BACKPTR 4 +/// a non-specific error in the compressed bitstream +#define AV_LZO_ERROR 8 +/** @} */ + +#define AV_LZO_INPUT_PADDING 8 +#define AV_LZO_OUTPUT_PADDING 12 + +/** + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above + * + * Make sure all buffers are appropriately padded, in must provide + * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. + */ +int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); + +/** + * @} + */ + +#endif /* AVUTIL_LZO_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/mathematics.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/mathematics.h new file mode 100644 index 000000000000..043dd0fafea8 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/mathematics.h @@ -0,0 +1,111 @@ +/* + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MATHEMATICS_H +#define AVUTIL_MATHEMATICS_H + +#include +#include +#include "attributes.h" +#include "rational.h" +#include "intfloat.h" + +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif +#ifndef NAN +#define NAN av_int2float(0x7fc00000) +#endif +#ifndef INFINITY +#define INFINITY av_int2float(0x7f800000) +#endif + +/** + * @addtogroup lavu_math + * @{ + */ + + +enum AVRounding { + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. +}; + +/** + * Return the greatest common divisor of a and b. + * If both a and b are 0 or either or both are <0 then behavior is + * undefined. + */ +int64_t av_const av_gcd(int64_t a, int64_t b); + +/** + * Rescale a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; + +/** + * Rescale a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers. + */ +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + */ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding) av_const; + +/** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positive value if a is greater than b + * 0 if a equals b + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * @} + */ + +#endif /* AVUTIL_MATHEMATICS_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/md5.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/md5.h new file mode 100644 index 000000000000..29e4e7c2ba2d --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/md5.h @@ -0,0 +1,51 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MD5_H +#define AVUTIL_MD5_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_md5_size; +#endif + +struct AVMD5; + +struct AVMD5 *av_md5_alloc(void); +void av_md5_init(struct AVMD5 *ctx); +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); +void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); +void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); + +/** + * @} + */ + +#endif /* AVUTIL_MD5_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/mem.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/mem.h new file mode 100644 index 000000000000..8f4722447d39 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/mem.h @@ -0,0 +1,183 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include +#include + +#include "attributes.h" +#include "avutil.h" + +/** + * @addtogroup lavu_mem + * @{ + */ + + +#if defined(__ICC) && __ICC < 1200 || defined(__SUNPRO_C) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__TI_COMPILER_VERSION__) + #define DECLARE_ALIGNED(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + t __attribute__((aligned(n))) v + #define DECLARE_ASM_CONST(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + static const t __attribute__((aligned(n))) v +#elif defined(__GNUC__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else + #define DECLARE_ALIGNED(n,t,v) t v + #define DECLARE_ASM_CONST(n,t,v) static const t v +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) + #define av_malloc_attrib __attribute__((__malloc__)) +#else + #define av_malloc_attrib +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) +#else + #define av_alloc_size(...) +#endif + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Helper function to allocate a block of size * nmemb bytes with + * using av_malloc() + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_malloc() + */ +av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size) +{ + if (size <= 0 || nmemb >= INT_MAX / size) + return NULL; + return av_malloc(nmemb * size); +} + +/** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_malloc(z)() or av_realloc() or NULL. + * @param size Size in bytes for the memory block to be allocated or + * reallocated. + * @return Pointer to a newly reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @see av_fast_realloc() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Helper function to allocate a block of size * nmemb bytes with + * using av_mallocz() + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + * @see av_malloc_array() + */ +av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size) +{ + if (size <= 0 || nmemb >= INT_MAX / size) + return NULL; + return av_mallocz(nmemb * size); +} + +/** + * Duplicate the string s. + * @param s string to be duplicated + * @return Pointer to a newly allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * @brief deliberately overlapping memcpy implementation + * @param dst destination buffer + * @param back how many bytes back we start (the initial size of the overlapping window) + * @param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + */ +void av_memcpy_backptr(uint8_t *dst, int back, int cnt); + +/** + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/old_pix_fmts.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/old_pix_fmts.h new file mode 100644 index 000000000000..31765aed5056 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/old_pix_fmts.h @@ -0,0 +1,128 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OLD_PIX_FMTS_H +#define AVUTIL_OLD_PIX_FMTS_H + +/* + * This header exists to prevent new pixel formats from being accidentally added + * to the deprecated list. + * Do not include it directly. It will be removed on next major bump + * + * Do not add new items to this list. Use the AVPixelFormat enum instead. + */ + PIX_FMT_NONE = AV_PIX_FMT_NONE, + PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + PIX_FMT_XVMC_MPEG2_IDCT, + PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha + PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian + PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian + PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian + PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian + PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian + PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#endif /* AVUTIL_OLD_PIX_FMTS_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/opt.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/opt.h new file mode 100644 index 000000000000..2d3cc731ee09 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/opt.h @@ -0,0 +1,516 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" +#include "log.h" + +/** + * @defgroup avoptions AVOptions + * @ingroup lavu_data + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct must be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() must be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_malloc(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in Libav are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This allows to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + */ + +enum AVOptionType{ + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128, +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + int64_t i64; + double dbl; + const char *str; + /* TODO those are unused now */ + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ +void av_opt_set_defaults(void *s); + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Free all string and binary options in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/* + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); +int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); +int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); +int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); +int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + +#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the + given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_set_string3(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double(void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + */ +/** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + */ +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +/** + * @} + * @} + */ + +#endif /* AVUTIL_OPT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/parseutils.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/parseutils.h new file mode 100644 index 000000000000..0844abb2f013 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/parseutils.h @@ -0,0 +1,124 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Parse timestr and return in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param timestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +/** + * Convert the decomposed UTC time in tm to a time_t value. + */ +time_t av_timegm(struct tm *tm); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/pixdesc.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/pixdesc.h new file mode 100644 index 000000000000..47e6bb838d6a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/pixdesc.h @@ -0,0 +1,223 @@ +/* + * pixel format descriptor + * Copyright (c) 2009 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXDESC_H +#define AVUTIL_PIXDESC_H + +#include +#include "pixfmt.h" + +typedef struct AVComponentDescriptor{ + uint16_t plane :2; ///< which of the 4 planes contains the component + + /** + * Number of elements between 2 horizontally consecutive pixels minus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t step_minus1 :3; + + /** + * Number of elements before the component of the first pixel plus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t offset_plus1 :3; + uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value + uint16_t depth_minus1 :4; ///< number of bits in the component minus 1 +}AVComponentDescriptor; + +/** + * Descriptor that unambiguously describes how the bits of a pixel are + * stored in the up to 4 data planes of an image. It also stores the + * subsampling factors and number of components. + * + * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV + * and all the YUV variants) AVPixFmtDescriptor just stores how values + * are stored not what these values represent. + */ +typedef struct AVPixFmtDescriptor{ + const char *name; + uint8_t nb_components; ///< The number of components each pixel has, (1-4) + + /** + * Amount to shift the luma width right to find the chroma width. + * For YV12 this is 1 for example. + * chroma_width = -((-luma_width) >> log2_chroma_w) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) + + /** + * Amount to shift the luma height right to find the chroma height. + * For YV12 this is 1 for example. + * chroma_height= -((-luma_height) >> log2_chroma_h) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_h; + uint8_t flags; + + /** + * Parameters that describe how pixels are packed. If the format + * has chroma components, they must be stored in comp[1] and + * comp[2]. + */ + AVComponentDescriptor comp[4]; +}AVPixFmtDescriptor; + +#define PIX_FMT_BE 1 ///< Pixel format is big-endian. +#define PIX_FMT_PAL 2 ///< Pixel format has a palette in data[1], values are indexes in this palette. +#define PIX_FMT_BITSTREAM 4 ///< All values of a component are bit-wise packed end to end. +#define PIX_FMT_HWACCEL 8 ///< Pixel format is an HW accelerated format. +#define PIX_FMT_PLANAR 16 ///< At least one pixel component is not in the first data plane +#define PIX_FMT_RGB 32 ///< The pixel format contains RGB-like data (as opposed to YUV/grayscale) +/** + * The pixel format is "pseudo-paletted". This means that Libav treats it as + * paletted internally, but the palette is generated by the decoder and is not + * stored in the file. + */ +#define PIX_FMT_PSEUDOPAL 64 + +#define PIX_FMT_ALPHA 128 ///< The pixel format has an alpha channel + + +#if FF_API_PIX_FMT_DESC +/** + * The array of all the pixel format descriptors. + */ +extern const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +#endif + +/** + * Read a line from an image, and write the values of the + * pixel format component c to dst. + * + * @param data the array containing the pointers to the planes of the image + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to read + * @param y the vertical coordinate of the first pixel to read + * @param w the width of the line to read, that is the number of + * values to write to dst + * @param read_pal_component if not zero and the format is a paletted + * format writes the values corresponding to the palette + * component c in data[1] to dst, rather than the palette indexes in + * data[0]. The behavior is undefined if the format is not paletted. + */ +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], + const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); + +/** + * Write the values from src to the pixel format component c of an + * image line. + * + * @param src array containing the values to write + * @param data the array containing the pointers to the planes of the + * image to write into. It is supposed to be zeroed. + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to write + * @param y the vertical coordinate of the first pixel to write + * @param w the width of the line to write, that is the number of + * values to write to the image line + */ +void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], + const AVPixFmtDescriptor *desc, int x, int y, int c, int w); + +/** + * Return the pixel format corresponding to name. + * + * If there is no pixel format with name name, then looks for a + * pixel format with the name corresponding to the native endian + * format of name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns PIX_FMT_NONE. + */ +enum AVPixelFormat av_get_pix_fmt(const char *name); + +/** + * Return the short name for a pixel format, NULL in case pix_fmt is + * unknown. + * + * @see av_get_pix_fmt(), av_get_pix_fmt_string() + */ +const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); + +/** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or an header if pix_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param pix_fmt the number of the pixel format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + */ +char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt); + +/** + * Return the number of bits per pixel used by the pixel format + * described by pixdesc. + * + * The returned number of bits refers to the number of bits actually + * used for storing the pixel information, that is padding bits are + * not counted. + */ +int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * @return a pixel format descriptor for provided pixel format or NULL if + * this pixel format is unknown. + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); + +/** + * Iterate over all pixel format descriptors known to libavutil. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); + +/** + * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc + * is not a valid pointer to a pixel format descriptor. + */ +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); + +/** + * Utility function to access log2_chroma_w log2_chroma_h from + * the pixel format AVPixFmtDescriptor. + * + * @param[in] pix_fmt the pixel format + * @param[out] h_shift store log2_chroma_h + * @param[out] v_shift store log2_chroma_w + * + * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format + */ +int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, + int *h_shift, int *v_shift); + + +#endif /* AVUTIL_PIXDESC_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/pixfmt.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/pixfmt.h new file mode 100644 index 000000000000..1072f008954b --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/pixfmt.h @@ -0,0 +1,268 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXFMT_H +#define AVUTIL_PIXFMT_H + +/** + * @file + * pixel format definitions + * + */ + +#include "libavutil/avconfig.h" +#include "libavutil/version.h" + +/** + * Pixel format. + * + * @note + * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + * + * @note + * Make sure that all newly added big-endian formats have pix_fmt & 1 == 1 + * and that all newly added little-endian formats have pix_fmt & 1 == 0. + * This allows simpler detection of big vs little-endian. + */ +enum AVPixelFormat { + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + AV_PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#if FF_API_PIX_FMT +#include "old_pix_fmts.h" +#endif +}; + +#if AV_HAVE_BIGENDIAN +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be +#else +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le +#endif + +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) + +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) + +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) + +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) + +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + +#if FF_API_PIX_FMT +#define PixelFormat AVPixelFormat + +#define PIX_FMT_NE(be, le) AV_PIX_FMT_NE(be, le) + +#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32 +#define PIX_FMT_RGB32_1 AV_PIX_FMT_RGB32_1 +#define PIX_FMT_BGR32 AV_PIX_FMT_BGR32 +#define PIX_FMT_BGR32_1 AV_PIX_FMT_BGR32_1 + +#define PIX_FMT_GRAY16 AV_PIX_FMT_GRAY16 +#define PIX_FMT_RGB48 AV_PIX_FMT_RGB48 +#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565 +#define PIX_FMT_RGB555 AV_PIX_FMT_RGB555 +#define PIX_FMT_RGB444 AV_PIX_FMT_RGB444 +#define PIX_FMT_BGR48 AV_PIX_FMT_BGR48 +#define PIX_FMT_BGR565 AV_PIX_FMT_BGR565 +#define PIX_FMT_BGR555 AV_PIX_FMT_BGR555 +#define PIX_FMT_BGR444 AV_PIX_FMT_BGR444 + +#define PIX_FMT_YUV420P9 AV_PIX_FMT_YUV420P9 +#define PIX_FMT_YUV422P9 AV_PIX_FMT_YUV422P9 +#define PIX_FMT_YUV444P9 AV_PIX_FMT_YUV444P9 +#define PIX_FMT_YUV420P10 AV_PIX_FMT_YUV420P10 +#define PIX_FMT_YUV422P10 AV_PIX_FMT_YUV422P10 +#define PIX_FMT_YUV444P10 AV_PIX_FMT_YUV444P10 +#define PIX_FMT_YUV420P16 AV_PIX_FMT_YUV420P16 +#define PIX_FMT_YUV422P16 AV_PIX_FMT_YUV422P16 +#define PIX_FMT_YUV444P16 AV_PIX_FMT_YUV444P16 + +#define PIX_FMT_GBRP9 AV_PIX_FMT_GBRP9 +#define PIX_FMT_GBRP10 AV_PIX_FMT_GBRP10 +#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16 +#endif + +#endif /* AVUTIL_PIXFMT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/random_seed.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/random_seed.h new file mode 100644 index 000000000000..b1fad13d0757 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/random_seed.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2009 Baptiste Coudurier + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H + +#include +/** + * @addtogroup lavu_crypto + * @{ + */ + +/** + * Get random data. + * + * This function can be called repeatedly to generate more random bits + * as needed. It is generally quite slow, and usually used to seed a + * PRNG. As it uses /dev/urandom and /dev/random, the quality of the + * returned random data depends on the platform. + */ +uint32_t av_get_random_seed(void); + +/** + * @} + */ + +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/rational.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/rational.h new file mode 100644 index 000000000000..5d7dab7fd0d2 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/rational.h @@ -0,0 +1,155 @@ +/* + * rational numbers + * Copyright (c) 2003 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * rational numbers + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_RATIONAL_H +#define AVUTIL_RATIONAL_H + +#include +#include +#include "attributes.h" + +/** + * @addtogroup lavu_math + * @{ + */ + +/** + * rational number numerator/denominator + */ +typedef struct AVRational{ + int num; ///< numerator + int den; ///< denominator +} AVRational; + +/** + * Compare two rationals. + * @param a first rational + * @param b second rational + * @return 0 if a==b, 1 if a>b, -1 if a>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; +} + +/** + * Convert rational to double. + * @param a rational to convert + * @return (double) a + */ +static inline double av_q2d(AVRational a){ + return a.num / (double) a.den; +} + +/** + * Reduce a fraction. + * This is useful for framerate calculations. + * @param dst_num destination numerator + * @param dst_den destination denominator + * @param num source numerator + * @param den source denominator + * @param max the maximum allowed for dst_num & dst_den + * @return 1 if exact, 0 otherwise + */ +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); + +/** + * Multiply two rationals. + * @param b first rational + * @param c second rational + * @return b*c + */ +AVRational av_mul_q(AVRational b, AVRational c) av_const; + +/** + * Divide one rational by another. + * @param b first rational + * @param c second rational + * @return b/c + */ +AVRational av_div_q(AVRational b, AVRational c) av_const; + +/** + * Add two rationals. + * @param b first rational + * @param c second rational + * @return b+c + */ +AVRational av_add_q(AVRational b, AVRational c) av_const; + +/** + * Subtract one rational from another. + * @param b first rational + * @param c second rational + * @return b-c + */ +AVRational av_sub_q(AVRational b, AVRational c) av_const; + +/** + * Invert a rational. + * @param q value + * @return 1 / q + */ +static av_always_inline AVRational av_inv_q(AVRational q) +{ + AVRational r = { q.den, q.num }; + return r; +} + +/** + * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * + * @param d double to convert + * @param max the maximum allowed numerator and denominator + * @return (AVRational) d + */ +AVRational av_d2q(double d, int max) av_const; + +/** + * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer + * than q1, 0 if they have the same distance. + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Find the nearest value in q_list to q. + * @param q_list an array of rationals terminated by {0, 0} + * @return the index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); + +/** + * @} + */ + +#endif /* AVUTIL_RATIONAL_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/samplefmt.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/samplefmt.h new file mode 100644 index 000000000000..33cbdedf5f0b --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/samplefmt.h @@ -0,0 +1,220 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include + +#include "avutil.h" +#include "attributes.h" + +/** + * Audio Sample Formats + * + * @par + * The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * @par + * The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * @par + * The data layout as used in av_samples_fill_arrays() and elsewhere in Libav + * (such as AVFrame in libavcodec) is as follows: + * + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Fill channel data pointers and linesize for samples with sample + * format sample_fmt. + * + * The pointers array is filled with the pointers to the samples data: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The linesize array is filled with the aligned size of each channel's data + * buffer for planar layout, or the aligned size of the buffer for all channels + * for packed layout. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return 0 on success or a negative error code on failure + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, + const uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * Allocated data will be initialized to silence. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return 0 on success or a negative error code on failure + * @see av_samples_fill_arrays() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, + int src_offset, int nb_samples, int nb_channels, + enum AVSampleFormat sample_fmt); + +/** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, + int nb_channels, enum AVSampleFormat sample_fmt); + +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/sha.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/sha.h new file mode 100644 index 000000000000..4c9a0c90950d --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/sha.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_sha_size; +#endif + +struct AVSHA; + +/** + * Allocate an AVSHA context. + */ +struct AVSHA *av_sha_alloc(void); + +/** + * Initialize SHA-1 or SHA-2 hashing. + * + * @param context pointer to the function context (of size av_sha_size) + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha_init(struct AVSHA* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha_final(struct AVSHA* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/time.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/time.h new file mode 100644 index 000000000000..b01a97d77012 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/time.h @@ -0,0 +1,39 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TIME_H +#define AVUTIL_TIME_H + +#include + +/** + * Get the current time in microseconds. + */ +int64_t av_gettime(void); + +/** + * Sleep for a period of time. Although the duration is expressed in + * microseconds, the actual delay may be rounded to the precision of the + * system timer. + * + * @param usec Number of microseconds to sleep. + * @return zero on success or (negative) error code. + */ +int av_usleep(unsigned usec); + +#endif /* AVUTIL_TIME_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/version.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/version.h new file mode 100644 index 000000000000..1dbb11ca21e8 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/version.h @@ -0,0 +1,87 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_VERSION_H +#define AVUTIL_VERSION_H + +#include "avutil.h" + +/** + * @file + * @ingroup lavu + * Libavutil version macros + */ + +/** + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 52 +#define LIBAVUTIL_VERSION_MINOR 3 +#define LIBAVUTIL_VERSION_MICRO 0 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @} + * + * @defgroup depr_guards Deprecation guards + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @{ + */ + +#ifndef FF_API_PIX_FMT +#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_CONTEXT_SIZE +#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_PIX_FMT_DESC +#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_AV_REVERSE +#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_AUDIOCONVERT +#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 53) +#endif +#ifndef FF_API_CPU_FLAG_MMX2 +#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 53) +#endif + +/** + * @} + */ + +#endif /* AVUTIL_VERSION_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/include/libavutil/xtea.h b/content/media/fmp4/ffmpeg/libav54/include/libavutil/xtea.h new file mode 100644 index 000000000000..7d2b07bbc73b --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/include/libavutil/xtea.h @@ -0,0 +1,61 @@ +/* + * A 32-bit implementation of the XTEA algorithm + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_XTEA_H +#define AVUTIL_XTEA_H + +#include + +/** + * @defgroup lavu_xtea XTEA + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVXTEA { + uint32_t key[16]; +} AVXTEA; + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption + */ +void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_XTEA_H */ diff --git a/content/media/fmp4/ffmpeg/libav54/moz.build b/content/media/fmp4/ffmpeg/libav54/moz.build new file mode 100644 index 000000000000..fb602ebb9fd7 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav54/moz.build @@ -0,0 +1,20 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +UNIFIED_SOURCES += [ + '../FFmpegAACDecoder.cpp', + '../FFmpegDataDecoder.cpp', + '../FFmpegDecoderModule.cpp', + '../FFmpegH264Decoder.cpp', +] +LOCAL_INCLUDES += [ + '..', + 'include', +] + +FINAL_LIBRARY = 'gklayout' + +FAIL_ON_WARNINGS = True diff --git a/content/media/fmp4/ffmpeg/libav55/include/COPYING.LGPLv2.1 b/content/media/fmp4/ffmpeg/libav55/include/COPYING.LGPLv2.1 new file mode 100644 index 000000000000..00b4fedfe7e7 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/COPYING.LGPLv2.1 @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/avcodec.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/avcodec.h new file mode 100644 index 000000000000..244f47ba1063 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/avcodec.h @@ -0,0 +1,4356 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVCODEC_H +#define AVCODEC_AVCODEC_H + +/** + * @file + * @ingroup libavc + * Libavcodec external API header + */ + +#include +#include "libavutil/samplefmt.h" +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/buffer.h" +#include "libavutil/cpu.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "version.h" + +#if FF_API_FAST_MALLOC +// to provide fast_*alloc +#include "libavutil/mem.h" +#endif + +/** + * @defgroup libavc Encoding/Decoding Library + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + * + */ + +/** + * @defgroup lavc_core Core functions/structures. + * @ingroup libavc + * + * Basic definitions, functions for querying libavcodec capabilities, + * allocating core structures, etc. + * @{ + */ + + +/** + * Identify the syntax and semantics of the bitstream. + * The principle is roughly: + * Two decoders with the same ID can decode the same streams. + * Two encoders with the same ID can encode compatible streams. + * There may be slight deviations from the principle due to implementation + * details. + * + * If you add a codec ID to this list, add it so that + * 1. no value of a existing codec ID changes (that would break ABI), + * 2. it is as close as possible to similar codecs. + * + * After adding new codec IDs, do not forget to add an entry to the codec + * descriptor list and bump libavcodec minor version. + */ +enum AVCodecID { + AV_CODEC_ID_NONE, + + /* video codecs */ + AV_CODEC_ID_MPEG1VIDEO, + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding +#if FF_API_XVMC + AV_CODEC_ID_MPEG2VIDEO_XVMC, +#endif /* FF_API_XVMC */ + AV_CODEC_ID_H261, + AV_CODEC_ID_H263, + AV_CODEC_ID_RV10, + AV_CODEC_ID_RV20, + AV_CODEC_ID_MJPEG, + AV_CODEC_ID_MJPEGB, + AV_CODEC_ID_LJPEG, + AV_CODEC_ID_SP5X, + AV_CODEC_ID_JPEGLS, + AV_CODEC_ID_MPEG4, + AV_CODEC_ID_RAWVIDEO, + AV_CODEC_ID_MSMPEG4V1, + AV_CODEC_ID_MSMPEG4V2, + AV_CODEC_ID_MSMPEG4V3, + AV_CODEC_ID_WMV1, + AV_CODEC_ID_WMV2, + AV_CODEC_ID_H263P, + AV_CODEC_ID_H263I, + AV_CODEC_ID_FLV1, + AV_CODEC_ID_SVQ1, + AV_CODEC_ID_SVQ3, + AV_CODEC_ID_DVVIDEO, + AV_CODEC_ID_HUFFYUV, + AV_CODEC_ID_CYUV, + AV_CODEC_ID_H264, + AV_CODEC_ID_INDEO3, + AV_CODEC_ID_VP3, + AV_CODEC_ID_THEORA, + AV_CODEC_ID_ASV1, + AV_CODEC_ID_ASV2, + AV_CODEC_ID_FFV1, + AV_CODEC_ID_4XM, + AV_CODEC_ID_VCR1, + AV_CODEC_ID_CLJR, + AV_CODEC_ID_MDEC, + AV_CODEC_ID_ROQ, + AV_CODEC_ID_INTERPLAY_VIDEO, + AV_CODEC_ID_XAN_WC3, + AV_CODEC_ID_XAN_WC4, + AV_CODEC_ID_RPZA, + AV_CODEC_ID_CINEPAK, + AV_CODEC_ID_WS_VQA, + AV_CODEC_ID_MSRLE, + AV_CODEC_ID_MSVIDEO1, + AV_CODEC_ID_IDCIN, + AV_CODEC_ID_8BPS, + AV_CODEC_ID_SMC, + AV_CODEC_ID_FLIC, + AV_CODEC_ID_TRUEMOTION1, + AV_CODEC_ID_VMDVIDEO, + AV_CODEC_ID_MSZH, + AV_CODEC_ID_ZLIB, + AV_CODEC_ID_QTRLE, + AV_CODEC_ID_TSCC, + AV_CODEC_ID_ULTI, + AV_CODEC_ID_QDRAW, + AV_CODEC_ID_VIXL, + AV_CODEC_ID_QPEG, + AV_CODEC_ID_PNG, + AV_CODEC_ID_PPM, + AV_CODEC_ID_PBM, + AV_CODEC_ID_PGM, + AV_CODEC_ID_PGMYUV, + AV_CODEC_ID_PAM, + AV_CODEC_ID_FFVHUFF, + AV_CODEC_ID_RV30, + AV_CODEC_ID_RV40, + AV_CODEC_ID_VC1, + AV_CODEC_ID_WMV3, + AV_CODEC_ID_LOCO, + AV_CODEC_ID_WNV1, + AV_CODEC_ID_AASC, + AV_CODEC_ID_INDEO2, + AV_CODEC_ID_FRAPS, + AV_CODEC_ID_TRUEMOTION2, + AV_CODEC_ID_BMP, + AV_CODEC_ID_CSCD, + AV_CODEC_ID_MMVIDEO, + AV_CODEC_ID_ZMBV, + AV_CODEC_ID_AVS, + AV_CODEC_ID_SMACKVIDEO, + AV_CODEC_ID_NUV, + AV_CODEC_ID_KMVC, + AV_CODEC_ID_FLASHSV, + AV_CODEC_ID_CAVS, + AV_CODEC_ID_JPEG2000, + AV_CODEC_ID_VMNC, + AV_CODEC_ID_VP5, + AV_CODEC_ID_VP6, + AV_CODEC_ID_VP6F, + AV_CODEC_ID_TARGA, + AV_CODEC_ID_DSICINVIDEO, + AV_CODEC_ID_TIERTEXSEQVIDEO, + AV_CODEC_ID_TIFF, + AV_CODEC_ID_GIF, + AV_CODEC_ID_DXA, + AV_CODEC_ID_DNXHD, + AV_CODEC_ID_THP, + AV_CODEC_ID_SGI, + AV_CODEC_ID_C93, + AV_CODEC_ID_BETHSOFTVID, + AV_CODEC_ID_PTX, + AV_CODEC_ID_TXD, + AV_CODEC_ID_VP6A, + AV_CODEC_ID_AMV, + AV_CODEC_ID_VB, + AV_CODEC_ID_PCX, + AV_CODEC_ID_SUNRAST, + AV_CODEC_ID_INDEO4, + AV_CODEC_ID_INDEO5, + AV_CODEC_ID_MIMIC, + AV_CODEC_ID_RL2, + AV_CODEC_ID_ESCAPE124, + AV_CODEC_ID_DIRAC, + AV_CODEC_ID_BFI, + AV_CODEC_ID_CMV, + AV_CODEC_ID_MOTIONPIXELS, + AV_CODEC_ID_TGV, + AV_CODEC_ID_TGQ, + AV_CODEC_ID_TQI, + AV_CODEC_ID_AURA, + AV_CODEC_ID_AURA2, + AV_CODEC_ID_V210X, + AV_CODEC_ID_TMV, + AV_CODEC_ID_V210, + AV_CODEC_ID_DPX, + AV_CODEC_ID_MAD, + AV_CODEC_ID_FRWU, + AV_CODEC_ID_FLASHSV2, + AV_CODEC_ID_CDGRAPHICS, + AV_CODEC_ID_R210, + AV_CODEC_ID_ANM, + AV_CODEC_ID_BINKVIDEO, + AV_CODEC_ID_IFF_ILBM, + AV_CODEC_ID_IFF_BYTERUN1, + AV_CODEC_ID_KGV1, + AV_CODEC_ID_YOP, + AV_CODEC_ID_VP8, + AV_CODEC_ID_PICTOR, + AV_CODEC_ID_ANSI, + AV_CODEC_ID_A64_MULTI, + AV_CODEC_ID_A64_MULTI5, + AV_CODEC_ID_R10K, + AV_CODEC_ID_MXPEG, + AV_CODEC_ID_LAGARITH, + AV_CODEC_ID_PRORES, + AV_CODEC_ID_JV, + AV_CODEC_ID_DFA, + AV_CODEC_ID_WMV3IMAGE, + AV_CODEC_ID_VC1IMAGE, + AV_CODEC_ID_UTVIDEO, + AV_CODEC_ID_BMV_VIDEO, + AV_CODEC_ID_VBLE, + AV_CODEC_ID_DXTORY, + AV_CODEC_ID_V410, + AV_CODEC_ID_XWD, + AV_CODEC_ID_CDXL, + AV_CODEC_ID_XBM, + AV_CODEC_ID_ZEROCODEC, + AV_CODEC_ID_MSS1, + AV_CODEC_ID_MSA1, + AV_CODEC_ID_TSCC2, + AV_CODEC_ID_MTS2, + AV_CODEC_ID_CLLC, + AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, + AV_CODEC_ID_AIC, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, + AV_CODEC_ID_HNM4_VIDEO, + AV_CODEC_ID_HEVC, + AV_CODEC_ID_FIC, + + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, + AV_CODEC_ID_PCM_S16BE, + AV_CODEC_ID_PCM_U16LE, + AV_CODEC_ID_PCM_U16BE, + AV_CODEC_ID_PCM_S8, + AV_CODEC_ID_PCM_U8, + AV_CODEC_ID_PCM_MULAW, + AV_CODEC_ID_PCM_ALAW, + AV_CODEC_ID_PCM_S32LE, + AV_CODEC_ID_PCM_S32BE, + AV_CODEC_ID_PCM_U32LE, + AV_CODEC_ID_PCM_U32BE, + AV_CODEC_ID_PCM_S24LE, + AV_CODEC_ID_PCM_S24BE, + AV_CODEC_ID_PCM_U24LE, + AV_CODEC_ID_PCM_U24BE, + AV_CODEC_ID_PCM_S24DAUD, + AV_CODEC_ID_PCM_ZORK, + AV_CODEC_ID_PCM_S16LE_PLANAR, + AV_CODEC_ID_PCM_DVD, + AV_CODEC_ID_PCM_F32BE, + AV_CODEC_ID_PCM_F32LE, + AV_CODEC_ID_PCM_F64BE, + AV_CODEC_ID_PCM_F64LE, + AV_CODEC_ID_PCM_BLURAY, + AV_CODEC_ID_PCM_LXF, + AV_CODEC_ID_S302M, + AV_CODEC_ID_PCM_S8_PLANAR, + AV_CODEC_ID_PCM_S24LE_PLANAR, + AV_CODEC_ID_PCM_S32LE_PLANAR, + + /* various ADPCM codecs */ + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, + AV_CODEC_ID_ADPCM_IMA_WAV, + AV_CODEC_ID_ADPCM_IMA_DK3, + AV_CODEC_ID_ADPCM_IMA_DK4, + AV_CODEC_ID_ADPCM_IMA_WS, + AV_CODEC_ID_ADPCM_IMA_SMJPEG, + AV_CODEC_ID_ADPCM_MS, + AV_CODEC_ID_ADPCM_4XM, + AV_CODEC_ID_ADPCM_XA, + AV_CODEC_ID_ADPCM_ADX, + AV_CODEC_ID_ADPCM_EA, + AV_CODEC_ID_ADPCM_G726, + AV_CODEC_ID_ADPCM_CT, + AV_CODEC_ID_ADPCM_SWF, + AV_CODEC_ID_ADPCM_YAMAHA, + AV_CODEC_ID_ADPCM_SBPRO_4, + AV_CODEC_ID_ADPCM_SBPRO_3, + AV_CODEC_ID_ADPCM_SBPRO_2, + AV_CODEC_ID_ADPCM_THP, + AV_CODEC_ID_ADPCM_IMA_AMV, + AV_CODEC_ID_ADPCM_EA_R1, + AV_CODEC_ID_ADPCM_EA_R3, + AV_CODEC_ID_ADPCM_EA_R2, + AV_CODEC_ID_ADPCM_IMA_EA_SEAD, + AV_CODEC_ID_ADPCM_IMA_EA_EACS, + AV_CODEC_ID_ADPCM_EA_XAS, + AV_CODEC_ID_ADPCM_EA_MAXIS_XA, + AV_CODEC_ID_ADPCM_IMA_ISS, + AV_CODEC_ID_ADPCM_G722, + AV_CODEC_ID_ADPCM_IMA_APC, + + /* AMR */ + AV_CODEC_ID_AMR_NB = 0x12000, + AV_CODEC_ID_AMR_WB, + + /* RealAudio codecs*/ + AV_CODEC_ID_RA_144 = 0x13000, + AV_CODEC_ID_RA_288, + + /* various DPCM codecs */ + AV_CODEC_ID_ROQ_DPCM = 0x14000, + AV_CODEC_ID_INTERPLAY_DPCM, + AV_CODEC_ID_XAN_DPCM, + AV_CODEC_ID_SOL_DPCM, + + /* audio codecs */ + AV_CODEC_ID_MP2 = 0x15000, + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + AV_CODEC_ID_AAC, + AV_CODEC_ID_AC3, + AV_CODEC_ID_DTS, + AV_CODEC_ID_VORBIS, + AV_CODEC_ID_DVAUDIO, + AV_CODEC_ID_WMAV1, + AV_CODEC_ID_WMAV2, + AV_CODEC_ID_MACE3, + AV_CODEC_ID_MACE6, + AV_CODEC_ID_VMDAUDIO, + AV_CODEC_ID_FLAC, + AV_CODEC_ID_MP3ADU, + AV_CODEC_ID_MP3ON4, + AV_CODEC_ID_SHORTEN, + AV_CODEC_ID_ALAC, + AV_CODEC_ID_WESTWOOD_SND1, + AV_CODEC_ID_GSM, ///< as in Berlin toast format + AV_CODEC_ID_QDM2, + AV_CODEC_ID_COOK, + AV_CODEC_ID_TRUESPEECH, + AV_CODEC_ID_TTA, + AV_CODEC_ID_SMACKAUDIO, + AV_CODEC_ID_QCELP, + AV_CODEC_ID_WAVPACK, + AV_CODEC_ID_DSICINAUDIO, + AV_CODEC_ID_IMC, + AV_CODEC_ID_MUSEPACK7, + AV_CODEC_ID_MLP, + AV_CODEC_ID_GSM_MS, /* as found in WAV */ + AV_CODEC_ID_ATRAC3, +#if FF_API_VOXWARE + AV_CODEC_ID_VOXWARE, +#endif + AV_CODEC_ID_APE, + AV_CODEC_ID_NELLYMOSER, + AV_CODEC_ID_MUSEPACK8, + AV_CODEC_ID_SPEEX, + AV_CODEC_ID_WMAVOICE, + AV_CODEC_ID_WMAPRO, + AV_CODEC_ID_WMALOSSLESS, + AV_CODEC_ID_ATRAC3P, + AV_CODEC_ID_EAC3, + AV_CODEC_ID_SIPR, + AV_CODEC_ID_MP1, + AV_CODEC_ID_TWINVQ, + AV_CODEC_ID_TRUEHD, + AV_CODEC_ID_MP4ALS, + AV_CODEC_ID_ATRAC1, + AV_CODEC_ID_BINKAUDIO_RDFT, + AV_CODEC_ID_BINKAUDIO_DCT, + AV_CODEC_ID_AAC_LATM, + AV_CODEC_ID_QDMC, + AV_CODEC_ID_CELT, + AV_CODEC_ID_G723_1, + AV_CODEC_ID_G729, + AV_CODEC_ID_8SVX_EXP, + AV_CODEC_ID_8SVX_FIB, + AV_CODEC_ID_BMV_AUDIO, + AV_CODEC_ID_RALF, + AV_CODEC_ID_IAC, + AV_CODEC_ID_ILBC, + AV_CODEC_ID_OPUS, + AV_CODEC_ID_COMFORT_NOISE, + AV_CODEC_ID_TAK, + AV_CODEC_ID_METASOUND, + + /* subtitle codecs */ + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000, + AV_CODEC_ID_DVB_SUBTITLE, + AV_CODEC_ID_TEXT, ///< raw UTF-8 text + AV_CODEC_ID_XSUB, + AV_CODEC_ID_SSA, + AV_CODEC_ID_MOV_TEXT, + AV_CODEC_ID_HDMV_PGS_SUBTITLE, + AV_CODEC_ID_DVB_TELETEXT, + AV_CODEC_ID_SRT, + + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, + + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. +}; + +/** + * This struct describes the properties of a single codec described by an + * AVCodecID. + * @see avcodec_get_descriptor() + */ +typedef struct AVCodecDescriptor { + enum AVCodecID id; + enum AVMediaType type; + /** + * Name of the codec described by this descriptor. It is non-empty and + * unique for each codec descriptor. It should contain alphanumeric + * characters and '_' only. + */ + const char *name; + /** + * A more descriptive name for this codec. May be NULL. + */ + const char *long_name; + /** + * Codec properties, a combination of AV_CODEC_PROP_* flags. + */ + int props; +} AVCodecDescriptor; + +/** + * Codec uses only intra compression. + * Video codecs only. + */ +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0) +/** + * Codec supports lossy compression. Audio and video codecs only. + * @note a codec may support both lossy and lossless + * compression modes + */ +#define AV_CODEC_PROP_LOSSY (1 << 1) +/** + * Codec supports lossless compression. Audio and video codecs only. + */ +#define AV_CODEC_PROP_LOSSLESS (1 << 2) + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define FF_INPUT_BUFFER_PADDING_SIZE 8 + +/** + * @ingroup lavc_encoding + * minimum encoding buffer size + * Used to avoid some checks during header writing. + */ +#define FF_MIN_BUFFER_SIZE 16384 + + +/** + * @ingroup lavc_encoding + * motion estimation type. + */ +enum Motion_Est_ID { + ME_ZERO = 1, ///< no search, that is use 0,0 vector whenever one is needed + ME_FULL, + ME_LOG, + ME_PHODS, + ME_EPZS, ///< enhanced predictive zonal search + ME_X1, ///< reserved for experiments + ME_HEX, ///< hexagon based search + ME_UMH, ///< uneven multi-hexagon search + ME_TESA, ///< transformed exhaustive search algorithm +}; + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVColorPrimaries{ + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_BT470M = 4, + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< functionally identical to above + AVCOL_PRI_FILM = 8, + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_NB , ///< Not part of ABI +}; + +enum AVColorTransferCharacteristic{ + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt( 10 ) : 1 range)" + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10 bit system + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12 bit system + AVCOL_TRC_NB , ///< Not part of ABI +}; + +enum AVColorSpace{ + AVCOL_SPC_RGB = 0, + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / SMPTE RP177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_FCC = 4, + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, + AVCOL_SPC_YCOCG = 8, ///< Used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_NB , ///< Not part of ABI +}; + +enum AVColorRange{ + AVCOL_RANGE_UNSPECIFIED = 0, + AVCOL_RANGE_MPEG = 1, ///< the normal 219*2^(n-8) "MPEG" YUV ranges + AVCOL_RANGE_JPEG = 2, ///< the normal 2^n-1 "JPEG" YUV ranges + AVCOL_RANGE_NB , ///< Not part of ABI +}; + +/** + * X X 3 4 X X are luma samples, + * 1 2 1-6 are possible chroma positions + * X X 5 6 X 0 is undefined/unknown position + */ +enum AVChromaLocation{ + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< mpeg2/4, h264 default + AVCHROMA_LOC_CENTER = 2, ///< mpeg1, jpeg, h263 + AVCHROMA_LOC_TOPLEFT = 3, ///< DV + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB , ///< Not part of ABI +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * @ingroup lavc_encoding + */ +typedef struct RcOverride{ + int start_frame; + int end_frame; + int qscale; // If this is 0 then quality_factor will be used instead. + float quality_factor; +} RcOverride; + +#if FF_API_MAX_BFRAMES +/** + * @deprecated there is no libavcodec-wide limit on the number of B-frames + */ +#define FF_MAX_B_FRAMES 16 +#endif + +/* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*/ + +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define CODEC_FLAG_UNALIGNED 0x0001 +#define CODEC_FLAG_QSCALE 0x0002 ///< Use fixed qscale. +#define CODEC_FLAG_4MV 0x0004 ///< 4 MV per MB allowed / advanced prediction for H.263. +#define CODEC_FLAG_OUTPUT_CORRUPT 0x0008 ///< Output even those frames that might be corrupted +#define CODEC_FLAG_QPEL 0x0010 ///< Use qpel MC. +#define CODEC_FLAG_GMC 0x0020 ///< Use GMC. +#define CODEC_FLAG_MV0 0x0040 ///< Always try a MB with MV=<0,0>. +/** + * The parent program guarantees that the input for B-frames containing + * streams is not written to for at least s->max_b_frames+1 frames, if + * this is not set the input will be copied. + */ +#define CODEC_FLAG_INPUT_PRESERVED 0x0100 +#define CODEC_FLAG_PASS1 0x0200 ///< Use internal 2pass ratecontrol in first pass mode. +#define CODEC_FLAG_PASS2 0x0400 ///< Use internal 2pass ratecontrol in second pass mode. +#define CODEC_FLAG_GRAY 0x2000 ///< Only decode/encode grayscale. +#if FF_API_EMU_EDGE +/** + * @deprecated edges are not used/required anymore. I.e. this flag is now always + * set. + */ +#define CODEC_FLAG_EMU_EDGE 0x4000 +#endif +#define CODEC_FLAG_PSNR 0x8000 ///< error[?] variables will be set during encoding. +#define CODEC_FLAG_TRUNCATED 0x00010000 /** Input bitstream might be truncated at a random + location instead of only at frame boundaries. */ +#define CODEC_FLAG_NORMALIZE_AQP 0x00020000 ///< Normalize adaptive quantization. +#define CODEC_FLAG_INTERLACED_DCT 0x00040000 ///< Use interlaced DCT. +#define CODEC_FLAG_LOW_DELAY 0x00080000 ///< Force low delay. +#define CODEC_FLAG_GLOBAL_HEADER 0x00400000 ///< Place global headers in extradata instead of every keyframe. +#define CODEC_FLAG_BITEXACT 0x00800000 ///< Use only bitexact stuff (except (I)DCT). +/* Fx : Flag for h263+ extra options */ +#define CODEC_FLAG_AC_PRED 0x01000000 ///< H.263 advanced intra coding / MPEG-4 AC prediction +#define CODEC_FLAG_LOOP_FILTER 0x00000800 ///< loop filter +#define CODEC_FLAG_INTERLACED_ME 0x20000000 ///< interlaced motion estimation +#define CODEC_FLAG_CLOSED_GOP 0x80000000 +#define CODEC_FLAG2_FAST 0x00000001 ///< Allow non spec compliant speedup tricks. +#define CODEC_FLAG2_NO_OUTPUT 0x00000004 ///< Skip bitstream encoding. +#define CODEC_FLAG2_LOCAL_HEADER 0x00000008 ///< Place global headers at every keyframe instead of in extradata. +#define CODEC_FLAG2_IGNORE_CROP 0x00010000 ///< Discard cropping information from SPS. + +#define CODEC_FLAG2_CHUNKS 0x00008000 ///< Input bitstream might be truncated at a packet boundaries instead of only at frame boundaries. + +/* Unsupported options : + * Syntax Arithmetic coding (SAC) + * Reference Picture Selection + * Independent Segment Decoding */ +/* /Fx */ +/* codec capabilities */ + +#define CODEC_CAP_DRAW_HORIZ_BAND 0x0001 ///< Decoder can use draw_horiz_band callback. +/** + * Codec uses get_buffer() for allocating buffers and supports custom allocators. + * If not set, it might not use get_buffer() at all or use operations that + * assume the buffer was allocated by avcodec_default_get_buffer. + */ +#define CODEC_CAP_DR1 0x0002 +#define CODEC_CAP_TRUNCATED 0x0008 +#if FF_API_XVMC +/* Codec can export data for HW decoding (XvMC). */ +#define CODEC_CAP_HWACCEL 0x0010 +#endif /* FF_API_XVMC */ +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define CODEC_CAP_DELAY 0x0020 +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define CODEC_CAP_SMALL_LAST_FRAME 0x0040 +#if FF_API_CAP_VDPAU +/** + * Codec can export data for HW decoding (VDPAU). + */ +#define CODEC_CAP_HWACCEL_VDPAU 0x0080 +#endif +/** + * Codec can output multiple frames per AVPacket + * Normally demuxers return one frame at a time, demuxers which do not do + * are connected to a parser to split what they return into proper frames. + * This flag is reserved to the very rare category of codecs which have a + * bitstream that cannot be split into frames without timeconsuming + * operations like full decoding. Demuxers carring such bitstreams thus + * may return multiple frames in a packet. This has many disadvantages like + * prohibiting stream copy in many cases thus it should only be considered + * as a last resort. + */ +#define CODEC_CAP_SUBFRAMES 0x0100 +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define CODEC_CAP_EXPERIMENTAL 0x0200 +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define CODEC_CAP_CHANNEL_CONF 0x0400 +#if FF_API_NEG_LINESIZES +/** + * @deprecated no codecs use this capability + */ +#define CODEC_CAP_NEG_LINESIZES 0x0800 +#endif +/** + * Codec supports frame-level multithreading. + */ +#define CODEC_CAP_FRAME_THREADS 0x1000 +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define CODEC_CAP_SLICE_THREADS 0x2000 +/** + * Codec supports changed parameters at any point. + */ +#define CODEC_CAP_PARAM_CHANGE 0x4000 +/** + * Codec supports avctx->thread_count == 0 (auto). + */ +#define CODEC_CAP_AUTO_THREADS 0x8000 +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define CODEC_CAP_VARIABLE_FRAME_SIZE 0x10000 + +#if FF_API_MB_TYPE +//The following defines may change, don't expect compatibility if you use them. +#define MB_TYPE_INTRA4x4 0x0001 +#define MB_TYPE_INTRA16x16 0x0002 //FIXME H.264-specific +#define MB_TYPE_INTRA_PCM 0x0004 //FIXME H.264-specific +#define MB_TYPE_16x16 0x0008 +#define MB_TYPE_16x8 0x0010 +#define MB_TYPE_8x16 0x0020 +#define MB_TYPE_8x8 0x0040 +#define MB_TYPE_INTERLACED 0x0080 +#define MB_TYPE_DIRECT2 0x0100 //FIXME +#define MB_TYPE_ACPRED 0x0200 +#define MB_TYPE_GMC 0x0400 +#define MB_TYPE_SKIP 0x0800 +#define MB_TYPE_P0L0 0x1000 +#define MB_TYPE_P1L0 0x2000 +#define MB_TYPE_P0L1 0x4000 +#define MB_TYPE_P1L1 0x8000 +#define MB_TYPE_L0 (MB_TYPE_P0L0 | MB_TYPE_P1L0) +#define MB_TYPE_L1 (MB_TYPE_P0L1 | MB_TYPE_P1L1) +#define MB_TYPE_L0L1 (MB_TYPE_L0 | MB_TYPE_L1) +#define MB_TYPE_QUANT 0x00010000 +#define MB_TYPE_CBP 0x00020000 +//Note bits 24-31 are reserved for codec specific use (h264 ref0, mpeg1 0mv, ...) +#endif + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan{ + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +}AVPanScan; + +#if FF_API_QSCALE_TYPE +#define FF_QSCALE_TYPE_MPEG1 0 +#define FF_QSCALE_TYPE_MPEG2 1 +#define FF_QSCALE_TYPE_H264 2 +#define FF_QSCALE_TYPE_VP56 3 +#endif + +#if FF_API_GET_BUFFER +#define FF_BUFFER_TYPE_INTERNAL 1 +#define FF_BUFFER_TYPE_USER 2 ///< direct rendering buffers (image is (de)allocated by user) +#define FF_BUFFER_TYPE_SHARED 4 ///< Buffer from somewhere else; don't deallocate image (data/base), all other tables are not shared. +#define FF_BUFFER_TYPE_COPY 8 ///< Just a (modified) copy of some other buffer, don't deallocate anything. + +#define FF_BUFFER_HINTS_VALID 0x01 // Buffer hints value is meaningful (if 0 ignore). +#define FF_BUFFER_HINTS_READABLE 0x02 // Codec will read from buffer. +#define FF_BUFFER_HINTS_PRESERVE 0x04 // User must not alter buffer content. +#define FF_BUFFER_HINTS_REUSABLE 0x08 // Codec will reuse the buffer (update). +#endif + +/** + * The decoder will keep a reference to the frame and may reuse it later. + */ +#define AV_GET_BUFFER_FLAG_REF (1 << 0) + +/** + * @defgroup lavc_packet AVPacket + * + * Types and functions for working with AVPacket. + * @{ + */ +enum AVPacketSideDataType { + AV_PKT_DATA_PALETTE, + AV_PKT_DATA_NEW_EXTRADATA, + + /** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * @code + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT) + * s32le channel_count + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT) + * u64le channel_layout + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + * @endcode + */ + AV_PKT_DATA_PARAM_CHANGE, + + /** + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of + * structures with info about macroblocks relevant to splitting the + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). + * That is, it does not necessarily contain info about all macroblocks, + * as long as the distance between macroblocks in the info is smaller + * than the target payload size. + * Each MB info structure is 12 bytes, and is laid out as follows: + * @code + * u32le bit offset from the start of the packet + * u8 current quantizer at the start of the macroblock + * u8 GOB number + * u16le macroblock address within the GOB + * u8 horizontal MV predictor + * u8 vertical MV predictor + * u8 horizontal MV predictor for block number 3 + * u8 vertical MV predictor for block number 3 + * @endcode + */ + AV_PKT_DATA_H263_MB_INFO, +}; + +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. + * + * AVPacket is one of the few structs in Libav, whose size is a part of public + * ABI. Thus it may be allocated on stack and no new fields can be added to it + * without libavcodec and libavformat major bump. + * + * The semantics of data ownership depends on the buf or destruct (deprecated) + * fields. If either is set, the packet data is dynamically allocated and is + * valid indefinitely until av_free_packet() is called (which in turn calls + * av_buffer_unref()/the destruct callback to free the data). If neither is set, + * the packet data is typically backed by some static buffer somewhere and is + * only valid for a limited time (e.g. until the next read call when demuxing). + * + * The side data is always allocated with av_malloc() and is freed in + * av_free_packet(). + */ +typedef struct AVPacket { + /** + * A reference to the reference-counted buffer where the packet data is + * stored. + * May be NULL, then the packet data is not reference-counted. + */ + AVBufferRef *buf; + /** + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + */ + int64_t pts; + /** + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + */ + int64_t dts; + uint8_t *data; + int size; + int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ + int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + struct { + uint8_t *data; + int size; + enum AVPacketSideDataType type; + } *side_data; + int side_data_elems; + + /** + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + */ + int duration; +#if FF_API_DESTRUCT_PACKET + attribute_deprecated + void (*destruct)(struct AVPacket *); + attribute_deprecated + void *priv; +#endif + int64_t pos; ///< byte position in stream, -1 if unknown + + /** + * Time difference in AVStream->time_base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current packet. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; +} AVPacket; +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_COUNT = 0x0001, + AV_SIDE_DATA_PARAM_CHANGE_CHANNEL_LAYOUT = 0x0002, + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; +/** + * @} + */ + +struct AVCodecInternal; + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, //< Top coded_first, top displayed first + AV_FIELD_BB, //< Bottom coded first, bottom displayed first + AV_FIELD_TB, //< Top coded first, bottom displayed first + AV_FIELD_BT, //< Bottom coded first, top displayed first +}; + +/** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVCodecContext) must not be used outside libav*. + */ +typedef struct AVCodecContext { + /** + * information on struct for av_log + * - set by avcodec_alloc_context3 + */ + const AVClass *av_class; + int log_level_offset; + + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ + const struct AVCodec *codec; + char codec_name[32]; + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ + + /** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger than 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int codec_tag; + + /** + * fourcc from the AVI stream header (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * - encoding: unused + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int stream_codec_tag; + + void *priv_data; + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + */ + void *opaque; + + /** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by libavcodec. 0 or some bitrate if this info is available in the stream. + */ + int bit_rate; + + /** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + */ + int bit_rate_tolerance; + + /** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + */ + int global_quality; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int compression_level; +#define FF_COMPRESSION_DEFAULT -1 + + /** + * CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags; + + /** + * CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags2; + + /** + * some codecs need / can use extradata like Huffman tables. + * mjpeg: Huffman tables + * rv10: additional flags + * mpeg4: global headers (they can be in the bitstream or here) + * The allocated memory should be FF_INPUT_BUFFER_PADDING_SIZE bytes larger + * than extradata_size to avoid prolems if it is read with the bitstream reader. + * The bytewise contents of extradata must not depend on the architecture or CPU endianness. + * - encoding: Set/allocated/freed by libavcodec. + * - decoding: Set/allocated/freed by user. + */ + uint8_t *extradata; + int extradata_size; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * - encoding: MUST be set by user. + * - decoding: Set by libavcodec. + */ + AVRational time_base; + + /** + * For some codecs, the time base is closer to the field rate than the frame rate. + * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration + * if no telecine is used ... + * + * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. + */ + int ticks_per_frame; + + /** + * Codec delay. + * + * Video: + * Number of frames the decoded output will be delayed relative to the + * encoded input. + * + * Audio: + * For encoding, this is the number of "priming" samples added to the + * beginning of the stream. The decoded output will be delayed by this + * many samples relative to the input to the encoder. Note that this + * field is purely informational and does not directly affect the pts + * output by the encoder, which should always be based on the actual + * presentation time, including any delay. + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. + * + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int delay; + + + /* video only */ + /** + * picture width / height. + * - encoding: MUST be set by user. + * - decoding: May be set by the user before opening the decoder if known e.g. + * from the container. Some decoders will require the dimensions + * to be set by the caller. During decoding, the decoder may + * overwrite those values as required. + */ + int width, height; + + /** + * Bitstream width / height, may be different from width/height e.g. when + * the decoded frame is cropped before being output. + * - encoding: unused + * - decoding: May be set by the user before opening the decoder if known + * e.g. from the container. During decoding, the decoder may + * overwrite those values as required. + */ + int coded_width, coded_height; + +#if FF_API_ASPECT_EXTENDED +#define FF_ASPECT_EXTENDED 15 +#endif + + /** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + */ + int gop_size; + + /** + * Pixel format, see AV_PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overriden by the decoder if it knows better. + * - encoding: Set by user. + * - decoding: Set by user if known, overridden by libavcodec if known + */ + enum AVPixelFormat pix_fmt; + + /** + * Motion estimation algorithm used for video coding. + * 1 (zero), 2 (full), 3 (log), 4 (phods), 5 (epzs), 6 (x1), 7 (hex), + * 8 (umh), 10 (tesa) [7, 8, 10 are x264 specific] + * - encoding: MUST be set by user. + * - decoding: unused + */ + int me_method; + + /** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + */ + void (*draw_horiz_band)(struct AVCodecContext *s, + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], + int y, int type, int height); + + /** + * callback to negotiate the pixelFormat + * @param fmt is the list of formats which are supported by the codec, + * it is terminated by -1 as 0 is a valid format, the formats are ordered by quality. + * The first is always the native one. + * @return the chosen format + * - encoding: unused + * - decoding: Set by user, if not set the native format will be chosen. + */ + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + + /** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + */ + int max_b_frames; + + /** + * qscale factor between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_factor; + + /** obsolete FIXME remove */ + int rc_strategy; +#define FF_RC_STRATEGY_XVID 1 + + int b_frame_strategy; + + /** + * qscale offset between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_offset; + + /** + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int has_b_frames; + + /** + * 0-> h263 quant 1-> mpeg quant + * - encoding: Set by user. + * - decoding: unused + */ + int mpeg_quant; + + /** + * qscale factor between P and I-frames + * If > 0 then the last p frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_factor; + + /** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_offset; + + /** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float lumi_masking; + + /** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float temporal_cplx_masking; + + /** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float spatial_cplx_masking; + + /** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float p_masking; + + /** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float dark_masking; + + /** + * slice count + * - encoding: Set by libavcodec. + * - decoding: Set by user (or 0). + */ + int slice_count; + /** + * prediction method (needed for huffyuv) + * - encoding: Set by user. + * - decoding: unused + */ + int prediction_method; +#define FF_PRED_LEFT 0 +#define FF_PRED_PLANE 1 +#define FF_PRED_MEDIAN 2 + + /** + * slice offsets in the frame in bytes + * - encoding: Set/allocated by libavcodec. + * - decoding: Set/allocated by user (or NULL). + */ + int *slice_offset; + + /** + * sample aspect ratio (0 if unknown) + * That is the width of a pixel divided by the height of the pixel. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVRational sample_aspect_ratio; + + /** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_cmp; + /** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_sub_cmp; + /** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + */ + int mb_cmp; + /** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int ildct_cmp; +#define FF_CMP_SAD 0 +#define FF_CMP_SSE 1 +#define FF_CMP_SATD 2 +#define FF_CMP_DCT 3 +#define FF_CMP_PSNR 4 +#define FF_CMP_BIT 5 +#define FF_CMP_RD 6 +#define FF_CMP_ZERO 7 +#define FF_CMP_VSAD 8 +#define FF_CMP_VSSE 9 +#define FF_CMP_NSSE 10 +#define FF_CMP_DCTMAX 13 +#define FF_CMP_DCT264 14 +#define FF_CMP_CHROMA 256 + + /** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int dia_size; + + /** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + */ + int last_predictor_count; + + /** + * prepass for motion estimation + * - encoding: Set by user. + * - decoding: unused + */ + int pre_me; + + /** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_pre_cmp; + + /** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int pre_dia_size; + + /** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + */ + int me_subpel_quality; + + /** + * DTG active format information (additional aspect ratio + * information only used in DVB MPEG-2 transport streams) + * 0 if not set. + * + * - encoding: unused + * - decoding: Set by decoder. + */ + int dtg_active_format; +#define FF_DTG_AFD_SAME 8 +#define FF_DTG_AFD_4_3 9 +#define FF_DTG_AFD_16_9 10 +#define FF_DTG_AFD_14_9 11 +#define FF_DTG_AFD_4_3_SP_14_9 13 +#define FF_DTG_AFD_16_9_SP_14_9 14 +#define FF_DTG_AFD_SP_4_3 15 + + /** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_range; + + /** + * intra quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int intra_quant_bias; +#define FF_DEFAULT_QUANT_BIAS 999999 + + /** + * inter quantizer bias + * - encoding: Set by user. + * - decoding: unused + */ + int inter_quant_bias; + + /** + * slice flags + * - encoding: unused + * - decoding: Set by user. + */ + int slice_flags; +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG2 field pics) +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + +#if FF_API_XVMC + /** + * XVideo Motion Acceleration + * - encoding: forbidden + * - decoding: set by decoder + * @deprecated XvMC support is slated for removal. + */ + attribute_deprecated int xvmc_acceleration; +#endif /* FF_API_XVMC */ + + /** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + */ + int mb_decision; +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits +#define FF_MB_DECISION_RD 2 ///< rate distortion + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *intra_matrix; + + /** + * custom inter quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: Set by libavcodec. + */ + uint16_t *inter_matrix; + + /** + * scene change detection threshold + * 0 is default, larger means fewer detected scene changes. + * - encoding: Set by user. + * - decoding: unused + */ + int scenechange_threshold; + + /** + * noise reduction strength + * - encoding: Set by user. + * - decoding: unused + */ + int noise_reduction; + + /** + * Motion estimation threshold below which no motion estimation is + * performed, but instead the user specified motion vectors are used. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_threshold; + + /** + * Macroblock threshold below which the user specified macroblock types will be used. + * - encoding: Set by user. + * - decoding: unused + */ + int mb_threshold; + + /** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: unused + */ + int intra_dc_precision; + + /** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_top; + + /** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_bottom; + + /** + * Border processing masking, raises the quantizer for mbs on the borders + * of the picture. + * - encoding: Set by user. + * - decoding: unused + */ + float border_masking; + + /** + * minimum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmin; + + /** + * maximum MB lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmax; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_penalty_compensation; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int bidir_refine; + + /** + * + * - encoding: Set by user. + * - decoding: unused + */ + int brd_scale; + + /** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + */ + int keyint_min; + + /** + * number of reference frames + * - encoding: Set by user. + * - decoding: Set by lavc. + */ + int refs; + + /** + * chroma qp offset from luma + * - encoding: Set by user. + * - decoding: unused + */ + int chromaoffset; + + /** + * Multiplied by qscale for each frame and added to scene_change_score. + * - encoding: Set by user. + * - decoding: unused + */ + int scenechange_factor; + + /** + * + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + */ + int mv0_threshold; + + /** + * Adjust sensitivity of b_frame_strategy 1. + * - encoding: Set by user. + * - decoding: unused + */ + int b_sensitivity; + + /** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorPrimaries color_primaries; + + /** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + /** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVChromaLocation chroma_sample_location; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by libavcodec + */ + enum AVFieldOrder field_order; + + /* audio only */ + int sample_rate; ///< samples per second + int channels; ///< number of audio channels + + /** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVSampleFormat sample_fmt; ///< sample format + + /* The following data should not be initialized. */ + /** + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size + */ + int frame_size; + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int frame_number; + + /** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + */ + int block_align; + + /** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + */ + int cutoff; + +#if FF_API_REQUEST_CHANNELS + /** + * Decoder should decode to this many channels if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + * @deprecated Deprecated in favor of request_channel_layout. + */ + attribute_deprecated int request_channels; +#endif + + /** + * Audio channel layout. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + uint64_t channel_layout; + + /** + * Request decoder to use this channel layout if it can (0 for default) + * - encoding: unused + * - decoding: Set by user. + */ + uint64_t request_channel_layout; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * Used to request a sample format from the decoder. + * - encoding: unused. + * - decoding: Set by user. + */ + enum AVSampleFormat request_sample_fmt; + +#if FF_API_GET_BUFFER + /** + * Called at the beginning of each frame to get a buffer for it. + * + * The function will set AVFrame.data[], AVFrame.linesize[]. + * AVFrame.extended_data[] must also be set, but it should be the same as + * AVFrame.data[] except for planar audio with more channels than can fit + * in AVFrame.data[]. In that case, AVFrame.data[] shall still contain as + * many data pointers as it can hold. + * + * if CODEC_CAP_DR1 is not set then get_buffer() must call + * avcodec_default_get_buffer() instead of providing buffers allocated by + * some other means. + * + * AVFrame.data[] should be 32- or 16-byte-aligned unless the CPU doesn't + * need it. avcodec_default_get_buffer() aligns the output buffer properly, + * but if get_buffer() is overridden then alignment considerations should + * be taken into account. + * + * @see avcodec_default_get_buffer() + * + * Video: + * + * If pic.reference is set then the frame will be read later by libavcodec. + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * it may be called from a different thread, but not from more than one at + * once. Does not need to be reentrant. + * + * @see release_buffer(), reget_buffer() + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * Decoders cannot use the buffer after returning from + * avcodec_decode_audio4(), so they will not call release_buffer(), as it + * is assumed to be released immediately upon return. In some rare cases, + * a decoder may need to call get_buffer() more than once in a single + * call to avcodec_decode_audio4(). In that case, when get_buffer() is + * called again after it has already been called once, the previously + * acquired buffer is assumed to be released at that time and may not be + * reused by the decoder. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + * + * @deprecated use get_buffer2() + */ + attribute_deprecated + int (*get_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called to release buffers which were allocated with get_buffer. + * A released buffer can be reused in get_buffer(). + * pic.data[*] must be set to NULL. + * May be called from a different thread if frame multithreading is used, + * but not by more than one thread at once, so does not need to be reentrant. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + * + * @deprecated custom freeing callbacks should be set from get_buffer2() + */ + attribute_deprecated + void (*release_buffer)(struct AVCodecContext *c, AVFrame *pic); + + /** + * Called at the beginning of a frame to get cr buffer for it. + * Buffer type (size, hints) must be the same. libavcodec won't check it. + * libavcodec will pass previous buffer in pic, function should return + * same buffer or new buffer with old frame "painted" into it. + * If pic.data[0] == NULL must behave like get_buffer(). + * if CODEC_CAP_DR1 is not set then reget_buffer() must call + * avcodec_default_reget_buffer() instead of providing buffers allocated by + * some other means. + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + attribute_deprecated + int (*reget_buffer)(struct AVCodecContext *c, AVFrame *pic); +#endif + + /** + * This callback is called at the beginning of each frame to get data + * buffer(s) for it. There may be one contiguous buffer for all the data or + * there may be a buffer per each data plane or anything in between. What + * this means is, you may set however many entries in buf[] you feel necessary. + * Each buffer must be reference-counted using the AVBuffer API (see description + * of buf[] below). + * + * The following fields will be set in the frame before this callback is + * called: + * - format + * - width, height (video only) + * - sample_rate, channel_layout, nb_samples (audio only) + * Their values may differ from the corresponding values in + * AVCodecContext. This callback must use the frame values, not the codec + * context values, to calculate the required buffer size. + * + * This callback must fill the following fields in the frame: + * - data[] + * - linesize[] + * - extended_data: + * * if the data is planar audio with more than 8 channels, then this + * callback must allocate and fill extended_data to contain all pointers + * to all data planes. data[] must hold as many pointers as it can. + * extended_data must be allocated with av_malloc() and will be freed in + * av_frame_unref(). + * * otherwise exended_data must point to data + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of + * the frame's data and extended_data pointers must be contained in these. That + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by + * this callback and filled with the extra buffers if there are more + * buffers than buf[] can hold. extended_buf will be freed in + * av_frame_unref(). + * + * If CODEC_CAP_DR1 is not set then get_buffer2() must call + * avcodec_default_get_buffer2() instead of providing buffers allocated by + * some other means. + * + * Each data plane must be aligned to the maximum required by the target + * CPU. + * + * @see avcodec_default_get_buffer2() + * + * Video: + * + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * If frame multithreading is used and thread_safe_callbacks is set, + * this callback may be called from a different thread, but not from more + * than one at once. Does not need to be reentrant. + * + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); + + /** + * If non-zero, the decoded audio and video frames returned from + * avcodec_decode_video2() and avcodec_decode_audio4() are reference-counted + * and are valid indefinitely. The caller must free them with + * av_frame_unref() when they are not needed anymore. + * Otherwise, the decoded frames must not be freed by the caller and are + * only valid until the next decode call. + * + * - encoding: unused + * - decoding: set by the caller before avcodec_open2(). + */ + int refcounted_frames; + + /* - encoding parameters */ + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + float qblur; ///< amount of qscale smoothing over time (0.0-1.0) + + /** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmin; + + /** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmax; + + /** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + */ + int max_qdiff; + + /** + * ratecontrol qmin qmax limiting method + * 0-> clipping, 1-> use a nice continuous function to limit qscale wthin qmin/qmax. + * - encoding: Set by user. + * - decoding: unused + */ + float rc_qsquish; + + float rc_qmod_amp; + int rc_qmod_freq; + + /** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: unused + */ + int rc_buffer_size; + + /** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + int rc_override_count; + RcOverride *rc_override; + + /** + * rate control equation + * - encoding: Set by user + * - decoding: unused + */ + const char *rc_eq; + + /** + * maximum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_max_rate; + + /** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int rc_min_rate; + + float rc_buffer_aggressivity; + + /** + * initial complexity for pass1 ratecontrol + * - encoding: Set by user. + * - decoding: unused + */ + float rc_initial_cplx; + + /** + * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_max_available_vbv_use; + + /** + * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_min_vbv_overflow_use; + + /** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + */ + int rc_initial_buffer_occupancy; + +#define FF_CODER_TYPE_VLC 0 +#define FF_CODER_TYPE_AC 1 +#define FF_CODER_TYPE_RAW 2 +#define FF_CODER_TYPE_RLE 3 +#define FF_CODER_TYPE_DEFLATE 4 + /** + * coder type + * - encoding: Set by user. + * - decoding: unused + */ + int coder_type; + + /** + * context model + * - encoding: Set by user. + * - decoding: unused + */ + int context_model; + + /** + * minimum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int lmin; + + /** + * maximum Lagrange multipler + * - encoding: Set by user. + * - decoding: unused + */ + int lmax; + + /** + * frame skip threshold + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_threshold; + + /** + * frame skip factor + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_factor; + + /** + * frame skip exponent + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_exp; + + /** + * frame skip comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int frame_skip_cmp; + + /** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + */ + int trellis; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int min_prediction_order; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int max_prediction_order; + + /** + * GOP timecode frame start number, in non drop frame format + * - encoding: Set by user. + * - decoding: unused + */ + int64_t timecode_frame_start; + + /* The RTP callback: This function is called */ + /* every time the encoder has a packet to send. */ + /* It depends on the encoder if the data starts */ + /* with a Start Code (it should). H.263 does. */ + /* mb_nb contains the number of macroblocks */ + /* encoded in the RTP payload. */ + void (*rtp_callback)(struct AVCodecContext *avctx, void *data, int size, int mb_nb); + + int rtp_payload_size; /* The size of the RTP payload: the coder will */ + /* do its best to deliver a chunk with size */ + /* below rtp_payload_size, the chunk will start */ + /* with a start code on some codecs like H.263. */ + /* This doesn't take account of any particular */ + /* headers inside the transmitted RTP payload. */ + + /* statistics, used for 2-pass encoding */ + int mv_bits; + int header_bits; + int i_tex_bits; + int p_tex_bits; + int i_count; + int p_count; + int skip_count; + int misc_bits; + + /** + * number of bits used for the previously encoded frame + * - encoding: Set by libavcodec. + * - decoding: unused + */ + int frame_bits; + + /** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + */ + char *stats_out; + + /** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + char *stats_in; + + /** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + */ + int workaround_bugs; +#define FF_BUG_AUTODETECT 1 ///< autodetection +#if FF_API_OLD_MSMPEG4 +#define FF_BUG_OLD_MSMPEG4 2 +#endif +#define FF_BUG_XVID_ILACE 4 +#define FF_BUG_UMP4 8 +#define FF_BUG_NO_PADDING 16 +#define FF_BUG_AMV 32 +#if FF_API_AC_VLC +#define FF_BUG_AC_VLC 0 ///< Will be removed, libavcodec can now handle these non-compliant files by default. +#endif +#define FF_BUG_QPEL_CHROMA 64 +#define FF_BUG_STD_QPEL 128 +#define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 +#define FF_BUG_EDGE 1024 +#define FF_BUG_HPEL_CHROMA 2048 +#define FF_BUG_DC_CLIP 4096 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 + + /** + * strictly follow the standard (MPEG4, ...). + * - encoding: Set by user. + * - decoding: Set by user. + * Setting this to STRICT or higher means the encoder and decoder will + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly + * (=strictly conform to the specs) + */ + int strict_std_compliance; +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. + + /** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + */ + int error_concealment; +#define FF_EC_GUESS_MVS 1 +#define FF_EC_DEBLOCK 2 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug; +#define FF_DEBUG_PICT_INFO 1 +#define FF_DEBUG_RC 2 +#define FF_DEBUG_BITSTREAM 4 +#define FF_DEBUG_MB_TYPE 8 +#define FF_DEBUG_QP 16 +#if FF_API_DEBUG_MV +/** + * @deprecated this option does nothing + */ +#define FF_DEBUG_MV 32 +#endif +#define FF_DEBUG_DCT_COEFF 0x00000040 +#define FF_DEBUG_SKIP 0x00000080 +#define FF_DEBUG_STARTCODE 0x00000100 +#define FF_DEBUG_PTS 0x00000200 +#define FF_DEBUG_ER 0x00000400 +#define FF_DEBUG_MMCO 0x00000800 +#define FF_DEBUG_BUGS 0x00001000 +#if FF_API_DEBUG_MV +#define FF_DEBUG_VIS_QP 0x00002000 +#define FF_DEBUG_VIS_MB_TYPE 0x00004000 +#endif +#define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 + +#if FF_API_DEBUG_MV + /** + * @deprecated this option does not have any effect + */ + attribute_deprecated + int debug_mv; +#define FF_DEBUG_VIS_MV_P_FOR 0x00000001 //visualize forward predicted MVs of P frames +#define FF_DEBUG_VIS_MV_B_FOR 0x00000002 //visualize forward predicted MVs of B frames +#define FF_DEBUG_VIS_MV_B_BACK 0x00000004 //visualize backward predicted MVs of B frames +#endif + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * - encoding: unused + * - decoding: Set by user. + */ + int err_recognition; + +/** + * Verify checksums embedded in the bitstream (could be of either encoded or + * decoded data, depending on the codec) and print an error message on mismatch. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the + * decoder returning an error. + */ +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) +#define AV_EF_BUFFER (1<<2) +#define AV_EF_EXPLODE (1<<3) + + /** + * opaque 64bit number (generally a PTS) that will be reordered and + * output in AVFrame.reordered_opaque + * @deprecated in favor of pkt_pts + * - encoding: unused + * - decoding: Set by user. + */ + int64_t reordered_opaque; + + /** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + */ + struct AVHWAccel *hwaccel; + + /** + * Hardware accelerator context. + * For some hardware accelerators, a global context needs to be + * provided by the user. In that case, this holds display-dependent + * data Libav cannot instantiate itself. Please refer to the + * Libav HW accelerator documentation to know how to fill this + * is. e.g. for VA API, this is a struct vaapi_context. + * - encoding: unused + * - decoding: Set by user + */ + void *hwaccel_context; + + /** + * error + * - encoding: Set by libavcodec if flags&CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + */ + int dct_algo; +#define FF_DCT_AUTO 0 +#define FF_DCT_FASTINT 1 +#define FF_DCT_INT 2 +#define FF_DCT_MMX 3 +#define FF_DCT_ALTIVEC 5 +#define FF_DCT_FAAN 6 + + /** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int idct_algo; +#define FF_IDCT_AUTO 0 +#define FF_IDCT_INT 1 +#define FF_IDCT_SIMPLE 2 +#define FF_IDCT_SIMPLEMMX 3 +#define FF_IDCT_ARM 7 +#define FF_IDCT_ALTIVEC 8 +#define FF_IDCT_SH4 9 +#define FF_IDCT_SIMPLEARM 10 +#define FF_IDCT_IPP 13 +#define FF_IDCT_XVIDMMX 14 +#define FF_IDCT_SIMPLEARMV5TE 16 +#define FF_IDCT_SIMPLEARMV6 17 +#define FF_IDCT_SIMPLEVIS 18 +#define FF_IDCT_FAAN 20 +#define FF_IDCT_SIMPLENEON 22 +#if FF_API_ARCH_ALPHA +#define FF_IDCT_SIMPLEALPHA 23 +#endif + + /** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + */ + int bits_per_coded_sample; + + /** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + int bits_per_raw_sample; + +#if FF_API_LOWRES + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + * + * @deprecated use decoder private options instead + */ + attribute_deprecated int lowres; +#endif + + /** + * the picture in the bitstream + * - encoding: Set by libavcodec. + * - decoding: unused + */ + AVFrame *coded_frame; + + /** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_count; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * Set by the client if its custom get_buffer() callback can be called + * synchronously from another thread, which allows faster multithreaded decoding. + * draw_horiz_band() will be called from other threads regardless of this setting. + * Ignored if the default get_buffer() is used. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_safe_callbacks; + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * Also see avcodec_thread_init and e.g. the --enable-pthread configure option. + * @param c context passed also to func + * @param count the number of things to execute + * @param arg2 argument passed unchanged to func + * @param ret return values of executed functions, must have space for "count" values. May be NULL. + * @param func function that will be called count times, with jobnr from 0 to count-1. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no + * two instances of func executing at the same time will have the same threadnr. + * @return always 0 currently, but code should handle a future improvement where when any call to func + * returns < 0 no further calls to func may be done and < 0 is returned. + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); + +#if FF_API_THREAD_OPAQUE + /** + * @deprecated this field should not be used from outside of lavc + */ + attribute_deprecated + void *thread_opaque; +#endif + + /** + * noise vs. sse weight for the nsse comparsion function + * - encoding: Set by user. + * - decoding: unused + */ + int nsse_weight; + + /** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int profile; +#define FF_PROFILE_UNKNOWN -99 +#define FF_PROFILE_RESERVED -100 + +#define FF_PROFILE_AAC_MAIN 0 +#define FF_PROFILE_AAC_LOW 1 +#define FF_PROFILE_AAC_SSR 2 +#define FF_PROFILE_AAC_LTP 3 +#define FF_PROFILE_AAC_HE 4 +#define FF_PROFILE_AAC_HE_V2 28 +#define FF_PROFILE_AAC_LD 22 +#define FF_PROFILE_AAC_ELD 38 +#define FF_PROFILE_MPEG2_AAC_LOW 128 +#define FF_PROFILE_MPEG2_AAC_HE 131 + +#define FF_PROFILE_DTS 20 +#define FF_PROFILE_DTS_ES 30 +#define FF_PROFILE_DTS_96_24 40 +#define FF_PROFILE_DTS_HD_HRA 50 +#define FF_PROFILE_DTS_HD_MA 60 + +#define FF_PROFILE_MPEG2_422 0 +#define FF_PROFILE_MPEG2_HIGH 1 +#define FF_PROFILE_MPEG2_SS 2 +#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 +#define FF_PROFILE_MPEG2_MAIN 4 +#define FF_PROFILE_MPEG2_SIMPLE 5 + +#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define FF_PROFILE_H264_BASELINE 66 +#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) +#define FF_PROFILE_H264_MAIN 77 +#define FF_PROFILE_H264_EXTENDED 88 +#define FF_PROFILE_H264_HIGH 100 +#define FF_PROFILE_H264_HIGH_10 110 +#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_422 122 +#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_HIGH_444 144 +#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) +#define FF_PROFILE_H264_CAVLC_444 44 + +#define FF_PROFILE_VC1_SIMPLE 0 +#define FF_PROFILE_VC1_MAIN 1 +#define FF_PROFILE_VC1_COMPLEX 2 +#define FF_PROFILE_VC1_ADVANCED 3 + +#define FF_PROFILE_MPEG4_SIMPLE 0 +#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 +#define FF_PROFILE_MPEG4_CORE 2 +#define FF_PROFILE_MPEG4_MAIN 3 +#define FF_PROFILE_MPEG4_N_BIT 4 +#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 +#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 +#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 +#define FF_PROFILE_MPEG4_HYBRID 8 +#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 +#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 +#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 +#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 +#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 +#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 +#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 + +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 0 +#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 1 +#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 2 +#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 +#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 + + +#define FF_PROFILE_HEVC_MAIN 1 +#define FF_PROFILE_HEVC_MAIN_10 2 +#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 + + /** + * level + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int level; +#define FF_LEVEL_UNKNOWN -99 + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_loop_filter; + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_idct; + + /** + * + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_frame; + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * - encoding: Set/allocated/freed by user (before avcodec_open2()) + * - decoding: Set/allocated/freed by libavcodec (by avcodec_open2()) + */ + uint8_t *subtitle_header; + int subtitle_header_size; + +#if FF_API_ERROR_RATE + /** + * @deprecated use the 'error_rate' private AVOption of the mpegvideo + * encoders + */ + attribute_deprecated + int error_rate; +#endif + +#if FF_API_CODEC_PKT + /** + * @deprecated this field is not supposed to be accessed from outside lavc + */ + attribute_deprecated + AVPacket *pkt; +#endif + + /** + * VBV delay coded in the last frame (in periods of a 27 MHz clock). + * Used for compliant TS muxing. + * - encoding: Set by libavcodec. + * - decoding: unused. + */ + uint64_t vbv_delay; +} AVCodecContext; + +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +typedef struct AVCodecDefault AVCodecDefault; + +struct AVSubtitle; + +/** + * AVCodec. + */ +typedef struct AVCodec { + /** + * Name of the codec implementation. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + * This is the primary way to find a codec from the user perspective. + */ + const char *name; + /** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *long_name; + enum AVMediaType type; + enum AVCodecID id; + /** + * Codec capabilities. + * see CODEC_CAP_* + */ + int capabilities; + const AVRational *supported_framerates; ///< array of supported framerates, or NULL if any, array is terminated by {0,0} + const enum AVPixelFormat *pix_fmts; ///< array of supported pixel formats, or NULL if unknown, array is terminated by -1 + const int *supported_samplerates; ///< array of supported audio samplerates, or NULL if unknown, array is terminated by 0 + const enum AVSampleFormat *sample_fmts; ///< array of supported sample formats, or NULL if unknown, array is terminated by -1 + const uint64_t *channel_layouts; ///< array of support channel layouts, or NULL if unknown. array is terminated by 0 +#if FF_API_LOWRES + attribute_deprecated uint8_t max_lowres; ///< maximum value for lowres supported by the decoder +#endif + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {FF_PROFILE_UNKNOWN} + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + int priv_data_size; + struct AVCodec *next; + /** + * @name Frame-level threading support functions + * @{ + */ + /** + * If defined, called on thread contexts when they are created. + * If the codec allocates writable tables in init(), re-allocate them here. + * priv_data will be set to a copy of the original. + */ + int (*init_thread_copy)(AVCodecContext *); + /** + * Copy necessary context variables from a previous thread context to the current one. + * If not defined, the next thread will start automatically; otherwise, the codec + * must call ff_thread_finish_setup(). + * + * dst and src will (rarely) point to the same context, in which case memcpy should be skipped. + */ + int (*update_thread_context)(AVCodecContext *dst, const AVCodecContext *src); + /** @} */ + + /** + * Private codec-specific defaults. + */ + const AVCodecDefault *defaults; + + /** + * Initialize codec static data, called from avcodec_register(). + */ + void (*init_static_data)(struct AVCodec *codec); + + int (*init)(AVCodecContext *); + int (*encode_sub)(AVCodecContext *, uint8_t *buf, int buf_size, + const struct AVSubtitle *sub); + /** + * Encode data to an AVPacket. + * + * @param avctx codec context + * @param avpkt output AVPacket (may contain a user-provided buffer) + * @param[in] frame AVFrame containing the raw data to be encoded + * @param[out] got_packet_ptr encoder sets to 0 or 1 to indicate that a + * non-empty packet was returned in avpkt. + * @return 0 on success, negative error code on failure + */ + int (*encode2)(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, + int *got_packet_ptr); + int (*decode)(AVCodecContext *, void *outdata, int *outdata_size, AVPacket *avpkt); + int (*close)(AVCodecContext *); + /** + * Flush buffers. + * Will be called when seeking + */ + void (*flush)(AVCodecContext *); +} AVCodec; + +/** + * AVHWAccel. + */ +typedef struct AVHWAccel { + /** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + */ + const char *name; + + /** + * Type of codec implemented by the hardware accelerator. + * + * See AVMEDIA_TYPE_xxx + */ + enum AVMediaType type; + + /** + * Codec implemented by the hardware accelerator. + * + * See AV_CODEC_ID_xxx + */ + enum AVCodecID id; + + /** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + */ + enum AVPixelFormat pix_fmt; + + /** + * Hardware accelerated codec capabilities. + * see FF_HWACCEL_CODEC_CAP_* + */ + int capabilities; + + struct AVHWAccel *next; + + /** + * Called at the beginning of each frame or field picture. + * + * Meaningful frame information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * Note that buf can be NULL along with buf_size set to 0. + * Otherwise, this means the whole frame is available at this point. + * + * @param avctx the codec context + * @param buf the frame data buffer base + * @param buf_size the size of the frame in bytes + * @return zero if successful, a negative value otherwise + */ + int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Callback for each slice. + * + * Meaningful slice information (codec specific) is guaranteed to + * be parsed at this point. This function is mandatory. + * + * @param avctx the codec context + * @param buf the slice data buffer base + * @param buf_size the size of the slice in bytes + * @return zero if successful, a negative value otherwise + */ + int (*decode_slice)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + + /** + * Called at the end of each frame or field picture. + * + * The whole picture is parsed at this point and can now be sent + * to the hardware accelerator. This function is mandatory. + * + * @param avctx the codec context + * @return zero if successful, a negative value otherwise + */ + int (*end_frame)(AVCodecContext *avctx); + + /** + * Size of HW accelerator private data. + * + * Private data is allocated with av_mallocz() before + * AVCodecContext.get_buffer() and deallocated after + * AVCodecContext.release_buffer(). + */ + int priv_data_size; +} AVHWAccel; + +/** + * @defgroup lavc_picture AVPicture + * + * Functions for working with AVPicture + * @{ + */ + +/** + * four components are given, that's all. + * the last component is alpha + */ +typedef struct AVPicture { + uint8_t *data[AV_NUM_DATA_POINTERS]; + int linesize[AV_NUM_DATA_POINTERS]; ///< number of bytes per line +} AVPicture; + +/** + * @} + */ + +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 + +enum AVSubtitleType { + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + /** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + */ + SUBTITLE_TEXT, + + /** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + */ + SUBTITLE_ASS, +}; + +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + +typedef struct AVSubtitleRect { + int x; ///< top left corner of pict, undefined when pict is not set + int y; ///< top left corner of pict, undefined when pict is not set + int w; ///< width of pict, undefined when pict is not set + int h; ///< height of pict, undefined when pict is not set + int nb_colors; ///< number of colors in pict, undefined when pict is not set + + /** + * data+linesize for the bitmap of this subtitle. + * can be set for text/ass as well once they where rendered + */ + AVPicture pict; + enum AVSubtitleType type; + + char *text; ///< 0 terminated plain UTF-8 text + + /** + * 0 terminated ASS/SSA compatible event line. + * The pressentation of this is unaffected by the other values in this + * struct. + */ + char *ass; + int flags; +} AVSubtitleRect; + +typedef struct AVSubtitle { + uint16_t format; /* 0 = graphics */ + uint32_t start_display_time; /* relative to packet pts, in ms */ + uint32_t end_display_time; /* relative to packet pts, in ms */ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE +} AVSubtitle; + +/** + * If c is NULL, returns the first registered codec, + * if c is non-NULL, returns the next registered codec after c, + * or NULL if c is the last one. + */ +AVCodec *av_codec_next(const AVCodec *c); + +/** + * Return the LIBAVCODEC_VERSION_INT constant. + */ +unsigned avcodec_version(void); + +/** + * Return the libavcodec build-time configuration. + */ +const char *avcodec_configuration(void); + +/** + * Return the libavcodec license. + */ +const char *avcodec_license(void); + +/** + * Register the codec codec and initialize libavcodec. + * + * @warning either this function or avcodec_register_all() must be called + * before any other libavcodec functions. + * + * @see avcodec_register_all() + */ +void avcodec_register(AVCodec *codec); + +/** + * Register all the codecs, parsers and bitstream filters which were enabled at + * configuration time. If you do not call this function you can select exactly + * which formats you want to support, by using the individual registration + * functions. + * + * @see avcodec_register + * @see av_register_codec_parser + * @see av_register_bitstream_filter + */ +void avcodec_register_all(void); + +/** + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct can be deallocated by calling avcodec_close() on it followed + * by av_free(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). + * + * @return An AVCodecContext filled with default values or NULL on failure. + * @see avcodec_get_context_defaults + */ +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); + +/** + * Set the fields of the given AVCodecContext to default values corresponding + * to the given codec (defaults may be codec-dependent). + * + * Do not call this function if a non-NULL codec has been passed + * to avcodec_alloc_context3() that allocated this AVCodecContext. + * If codec is non-NULL, it is illegal to call avcodec_open2() with a + * different codec on this AVCodecContext. + */ +int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec); + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +/** + * Copy the settings of the source AVCodecContext into the destination + * AVCodecContext. The resulting destination codec context will be + * unopened, i.e. you are required to call avcodec_open2() before you + * can use this AVCodecContext to decode/encode video/audio data. + * + * @param dest target codec context, should be initialized with + * avcodec_alloc_context3(), but otherwise uninitialized + * @param src source codec context + * @return AVERROR() on error (e.g. memory allocation error), 0 on success + */ +int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src); + +#if FF_API_AVFRAME_LAVC +/** + * @deprecated use av_frame_alloc() + */ +attribute_deprecated +AVFrame *avcodec_alloc_frame(void); + +/** + * Set the fields of the given AVFrame to default values. + * + * @param frame The AVFrame of which the fields should be set to default values. + * + * @deprecated use av_frame_unref() + */ +attribute_deprecated +void avcodec_get_frame_defaults(AVFrame *frame); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. + * + * @param frame frame to be freed. The pointer will be set to NULL. + * + * @warning this function does NOT free the data buffers themselves + * (it does not know how, since they might have been allocated with + * a custom get_buffer()). + * + * @deprecated use av_frame_free() + */ +attribute_deprecated +void avcodec_free_frame(AVFrame **frame); +#endif + +/** + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * @warning This function is not thread safe! + * + * @code + * avcodec_register_all(); + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(AV_CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * @param avctx The context to initialize. + * @param codec The codec to open this context for. If a non-NULL codec has been + * previously passed to avcodec_alloc_context3() or + * avcodec_get_context_defaults3() for this context, then this + * parameter MUST be either NULL or equal to the previously passed + * codec. + * @param options A dictionary filled with AVCodecContext and codec-private options. + * On return this object will be filled with options that were not found. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_find(). + */ +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + +/** + * Close a given AVCodecContext and free all the data associated with it + * (but not the AVCodecContext itself). + * + * Calling this function on an AVCodecContext that hasn't been opened will free + * the codec-specific data allocated in avcodec_alloc_context3() / + * avcodec_get_context_defaults3() with a non-NULL codec. Subsequent calls will + * do nothing. + */ +int avcodec_close(AVCodecContext *avctx); + +/** + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +/** + * @} + */ + +/** + * @addtogroup lavc_packet + * @{ + */ + +#if FF_API_DESTRUCT_PACKET +/** + * Default packet destructor. + * @deprecated use the AVBuffer API instead + */ +attribute_deprecated +void av_destruct_packet(AVPacket *pkt); +#endif + +/** + * Initialize optional fields of a packet with default values. + * + * Note, this does not touch the data and size members, which have to be + * initialized separately. + * + * @param pkt packet + */ +void av_init_packet(AVPacket *pkt); + +/** + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + */ +int av_new_packet(AVPacket *pkt, int size); + +/** + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + */ +void av_shrink_packet(AVPacket *pkt, int size); + +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + +/** + * Initialize a reference-counted packet from av_malloc()ed data. + * + * @param pkt packet to be initialized. This function will set the data, size, + * buf and destruct fields, all others are left untouched. + * @param data Data allocated by av_malloc() to be used as packet data. If this + * function returns successfully, the data is owned by the underlying AVBuffer. + * The caller may not access the data through other means. + * @param size size of data in bytes, without the padding. I.e. the full buffer + * size is assumed to be size + FF_INPUT_BUFFER_PADDING_SIZE. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); + +/** + * @warning This is a hack - the packet memory allocation stuff is broken. The + * packet is allocated if it was not really allocated. + */ +int av_dup_packet(AVPacket *pkt); + +/** + * Free a packet. + * + * @param pkt packet to free + */ +void av_free_packet(AVPacket *pkt); + +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Shrink the already allocated side data buffer + * + * @param pkt packet + * @param type side information type + * @param size new side information size + * @return 0 on success, < 0 on failure + */ +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size pointer for side information size to store (optional) + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + int *size); + +/** + * Convenience function to free all the side data stored. + * All the other fields stay untouched. + * + * @param pkt packet + */ +void av_packet_free_side_data(AVPacket *pkt); + +/** + * Setup a new reference to the data described by a given packet + * + * If src is reference-counted, setup dst as a new reference to the + * buffer in src. Otherwise allocate a new buffer in dst and copy the + * data from src into it. + * + * All the other fields are copied from src. + * + * @see av_packet_unref + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_packet_ref(AVPacket *dst, AVPacket *src); + +/** + * Wipe the packet. + * + * Unreference the buffer referenced by the packet and reset the + * remaining packet fields to their default values. + * + * @param pkt The packet to be unreferenced. + */ +void av_packet_unref(AVPacket *pkt); + +/** + * Move every field in src to dst and reset src. + * + * @see av_packet_unref + * + * @param src Source packet, will be reset + * @param dst Destination packet + */ +void av_packet_move_ref(AVPacket *dst, AVPacket *src); + +/** + * Copy only "properties" fields from src to dst. + * + * Properties for the purpose of this function are all the fields + * beside those related to the packet data (buf, data, size) + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success AVERROR on failure. + * + */ +int av_packet_copy_props(AVPacket *dst, const AVPacket *src); + +/** + * @} + */ + +/** + * @addtogroup lavc_decoding + * @{ + */ + +/** + * Find a registered decoder with a matching codec ID. + * + * @param id AVCodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder(enum AVCodecID id); + +/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_decoder_by_name(const char *name); + +#if FF_API_GET_BUFFER +attribute_deprecated int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic); +attribute_deprecated void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic); +attribute_deprecated int avcodec_default_reget_buffer(AVCodecContext *s, AVFrame *pic); +#endif + +/** + * The default callback for AVCodecContext.get_buffer2(). It is made public so + * it can be called by custom get_buffer2() implementations for decoders without + * CODEC_CAP_DR1 set. + */ +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); + +#if FF_API_EMU_EDGE +/** + * Return the amount of padding in pixels which the get_buffer callback must + * provide around the edge of the image for codecs which do not have the + * CODEC_FLAG_EMU_EDGE flag. + * + * @return Required padding in pixels. + * + * @deprecated CODEC_FLAG_EMU_EDGE is deprecated, so this function is no longer + * needed + */ +attribute_deprecated +unsigned avcodec_get_edge_width(void); +#endif + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + +/** + * Decode the audio frame of size avpkt->size from avpkt->data into frame. + * + * Some decoders may support multiple frames in a single AVPacket. Such + * decoders would then just decode the first frame and the return value would be + * less than the packet size. In this case, avcodec_decode_audio4 has to be + * called again with an AVPacket containing the remaining data in order to + * decode the second frame, etc... Even if no frames are returned, the packet + * needs to be fed to the decoder with remaining data until it is completely + * consumed or an error occurs. + * + * Some decoders (those marked with CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning samples. It is safe to flush even those decoders that are not + * marked with CODEC_CAP_DELAY, then no samples will be returned. + * + * @warning The input buffer, avpkt->data must be FF_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @param avctx the codec context + * @param[out] frame The AVFrame in which to store decoded audio samples. + * The decoder will allocate a buffer for the decoded frame by + * calling the AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * @param[out] got_frame_ptr Zero if no frame could be decoded, otherwise it is + * non-zero. Note that this field being set to zero + * does not mean that an error has occurred. For + * decoders with CODEC_CAP_DELAY set, no given decode + * call is guaranteed to produce a frame. + * @param[in] avpkt The input AVPacket containing the input buffer. + * At least avpkt->data and avpkt->size should be set. Some + * decoders might also require additional fields to be set. + * @return A negative error code is returned if an error occurred during + * decoding, otherwise the number of bytes consumed from the input + * AVPacket is returned. + */ +int avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, + int *got_frame_ptr, AVPacket *avpkt); + +/** + * Decode the video frame of size avpkt->size from avpkt->data into picture. + * Some decoders may support multiple frames in a single AVPacket, such + * decoders would then just decode the first frame. + * + * @warning The input buffer must be FF_INPUT_BUFFER_PADDING_SIZE larger than + * the actual read bytes because some optimized bitstream readers read 32 or 64 + * bits at once and could read over the end. + * + * @warning The end of the input buffer buf should be set to 0 to ensure that + * no overreading happens for damaged MPEG streams. + * + * @note Codecs which have the CODEC_CAP_DELAY capability set have a delay + * between input and output, these need to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to return the remaining frames. + * + * @param avctx the codec context + * @param[out] picture The AVFrame in which the decoded video frame will be stored. + * Use av_frame_alloc() to get an AVFrame. The codec will + * allocate memory for the actual bitmap by calling the + * AVCodecContext.get_buffer2() callback. + * When AVCodecContext.refcounted_frames is set to 1, the frame is + * reference counted and the returned reference belongs to the + * caller. The caller must release the frame using av_frame_unref() + * when the frame is no longer needed. The caller may safely write + * to the frame if av_frame_is_writable() returns 1. + * When AVCodecContext.refcounted_frames is set to 0, the returned + * reference belongs to the decoder and is valid only until the + * next call to this function or until closing or flushing the + * decoder. The caller may not write to it. + * + * @param[in] avpkt The input AVpacket containing the input buffer. + * You can create such packet with av_init_packet() and by then setting + * data and size, some decoders might in addition need other fields like + * flags&AV_PKT_FLAG_KEY. All decoders are designed to use the least + * fields possible. + * @param[in,out] got_picture_ptr Zero if no frame could be decompressed, otherwise, it is nonzero. + * @return On error a negative value is returned, otherwise the number of bytes + * used or zero if no frame could be decompressed. + */ +int avcodec_decode_video2(AVCodecContext *avctx, AVFrame *picture, + int *got_picture_ptr, + AVPacket *avpkt); + +/** + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in *sub. + * Note that CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expect to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. + * + * @param avctx the codec context + * @param[out] sub The AVSubtitle in which the decoded subtitle will be stored, must be + freed with avsubtitle_free if *got_sub_ptr is set. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + */ +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, + AVPacket *avpkt); + +/** + * @defgroup lavc_parsing Frame parsing + * @{ + */ + +enum AVPictureStructure { + AV_PICTURE_STRUCTURE_UNKNOWN, //< unknown + AV_PICTURE_STRUCTURE_TOP_FIELD, //< coded as top field + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, //< coded as bottom field + AV_PICTURE_STRUCTURE_FRAME, //< coded as frame +}; + +typedef struct AVCodecParserContext { + void *priv_data; + struct AVCodecParser *parser; + int64_t frame_offset; /* offset of the current frame */ + int64_t cur_offset; /* current offset + (incremented by each av_parser_parse()) */ + int64_t next_frame_offset; /* offset of the next frame */ + /* video info */ + int pict_type; /* XXX: Put it back in AVCodecContext. */ + /** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + */ + int repeat_pict; /* XXX: Put it back in AVCodecContext. */ + int64_t pts; /* pts of the current frame */ + int64_t dts; /* dts of the current frame */ + + /* private data */ + int64_t last_pts; + int64_t last_dts; + int fetch_timestamp; + +#define AV_PARSER_PTS_NB 4 + int cur_frame_start_index; + int64_t cur_frame_offset[AV_PARSER_PTS_NB]; + int64_t cur_frame_pts[AV_PARSER_PTS_NB]; + int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 + + int64_t offset; ///< byte offset from starting packet start + int64_t cur_frame_end[AV_PARSER_PTS_NB]; + + /** + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames + * will be used. + */ + int key_frame; + + /** + * Time difference in stream time base units from the pts of this + * packet to the point at which the output from the decoder has converged + * independent from the availability of previous frames. That is, the + * frames are virtually identical no matter if decoding started from + * the very first frame or from this keyframe. + * Is AV_NOPTS_VALUE if unknown. + * This field is not the display duration of the current frame. + * This field has no meaning if the packet does not have AV_PKT_FLAG_KEY + * set. + * + * The purpose of this field is to allow seeking in streams that have no + * keyframes in the conventional sense. It corresponds to the + * recovery point SEI in H.264 and match_time_delta in NUT. It is also + * essential for some types of subtitle streams to ensure that all + * subtitles are correctly displayed after seeking. + */ + int64_t convergence_duration; + + // Timestamp generation support: + /** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + */ + int dts_sync_point; + + /** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + */ + int dts_ref_dts_delta; + + /** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + */ + int pts_dts_delta; + + /** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + */ + int64_t cur_frame_pos[AV_PARSER_PTS_NB]; + + /** + * Byte position of currently parsed frame in stream. + */ + int64_t pos; + + /** + * Previous frame byte position. + */ + int64_t last_pos; + + /** + * Duration of the current frame. + * For audio, this is in units of 1 / AVCodecContext.sample_rate. + * For all other types, this is in units of AVCodecContext.time_base. + */ + int duration; + + enum AVFieldOrder field_order; + + /** + * Indicate whether a picture is coded as a frame, top field or bottom field. + * + * For example, H.264 field_pic_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag + * equal to 1 and bottom_field_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_TOP_FIELD. + */ + enum AVPictureStructure picture_structure; + + /** + * Picture number incremented in presentation or output order. + * This field may be reinitialized at the first picture of a new sequence. + * + * For example, this corresponds to H.264 PicOrderCnt. + */ + int output_picture_number; +} AVCodecParserContext; + +typedef struct AVCodecParser { + int codec_ids[5]; /* several codec IDs are permitted */ + int priv_data_size; + int (*parser_init)(AVCodecParserContext *s); + int (*parser_parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + void (*parser_close)(AVCodecParserContext *s); + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); + struct AVCodecParser *next; +} AVCodecParser; + +AVCodecParser *av_parser_next(AVCodecParser *c); + +void av_register_codec_parser(AVCodecParser *parser); +AVCodecParserContext *av_parser_init(int codec_id); + +/** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size input length, to signal EOF, this should be 0 (so that the last frame can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts, pos); + * in_data += len; + * in_len -= len; + * + * if(size) + * decode_frame(data, size); + * } + * @endcode + */ +int av_parser_parse2(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, + int64_t pts, int64_t dts, + int64_t pos); + +/** + * @return 0 if the output buffer is a subset of the input, 1 if it is allocated and must be freed + * @deprecated use AVBitstreamFilter + */ +int av_parser_change(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_parser_close(AVCodecParserContext *s); + +/** + * @} + * @} + */ + +/** + * @addtogroup lavc_encoding + * @{ + */ + +/** + * Find a registered encoder with a matching codec ID. + * + * @param id AVCodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder(enum AVCodecID id); + +/** + * Find a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +AVCodec *avcodec_find_encoder_by_name(const char *name); + +/** + * Encode a frame of audio. + * + * Takes input samples from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay, split, and combine input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw audio data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * If CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_audio2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +/** + * Encode a frame of video. + * + * Takes input raw video data from frame and writes the next output packet, if + * available, to avpkt. The output packet does not necessarily contain data for + * the most recent frame, as encoders can delay and reorder input frames + * internally as needed. + * + * @param avctx codec context + * @param avpkt output AVPacket. + * The user can supply an output buffer by setting + * avpkt->data and avpkt->size prior to calling the + * function, but if the size of the user-provided data is not + * large enough, encoding will fail. All other AVPacket fields + * will be reset by the encoder using av_init_packet(). If + * avpkt->data is NULL, the encoder will allocate it. + * The encoder will set avpkt->size to the size of the + * output packet. The returned data (if any) belongs to the + * caller, he is responsible for freeing it. + * + * If this function fails or produces no output, avpkt will be + * freed using av_free_packet() (i.e. avpkt->destruct will be + * called to free the user supplied buffer). + * @param[in] frame AVFrame containing the raw video data to be encoded. + * May be NULL when flushing an encoder that has the + * CODEC_CAP_DELAY capability set. + * @param[out] got_packet_ptr This field is set to 1 by libavcodec if the + * output packet is non-empty, and to 0 if it is + * empty. If the function returns an error, the + * packet can be assumed to be invalid, and the + * value of got_packet_ptr is undefined and should + * not be used. + * @return 0 on success, negative error code on failure + */ +int avcodec_encode_video2(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr); + +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub); + + +/** + * @} + */ + +/** + * @addtogroup lavc_picture + * @{ + */ + +/** + * Allocate memory for a picture. Call avpicture_free() to free it. + * + * @see avpicture_fill() + * + * @param picture the picture to be filled in + * @param pix_fmt the format of the picture + * @param width the width of the picture + * @param height the height of the picture + * @return zero if successful, a negative value if not + */ +int avpicture_alloc(AVPicture *picture, enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Free a picture previously allocated by avpicture_alloc(). + * The data buffer used by the AVPicture is freed, but the AVPicture structure + * itself is not. + * + * @param picture the AVPicture to be freed + */ +void avpicture_free(AVPicture *picture); + +/** + * Fill in the AVPicture fields. + * The fields of the given AVPicture are filled in by using the 'ptr' address + * which points to the image data buffer. Depending on the specified picture + * format, one or multiple image data pointers and line sizes will be set. + * If a planar format is specified, several pointers will be set pointing to + * the different picture planes and the line sizes of the different planes + * will be stored in the lines_sizes array. + * Call with ptr == NULL to get the required size for the ptr buffer. + * + * To allocate the buffer and fill in the AVPicture fields in one call, + * use avpicture_alloc(). + * + * @param picture AVPicture whose fields are to be filled in + * @param ptr Buffer which will contain or contains the actual image data + * @param pix_fmt The format in which the picture data is stored. + * @param width the width of the image in pixels + * @param height the height of the image in pixels + * @return size of the image data in bytes + */ +int avpicture_fill(AVPicture *picture, uint8_t *ptr, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Copy pixel data from an AVPicture into a buffer. + * The data is stored compactly, without any gaps for alignment or padding + * which may be applied by avpicture_fill(). + * + * @see avpicture_get_size() + * + * @param[in] src AVPicture containing image data + * @param[in] pix_fmt The format in which the picture data is stored. + * @param[in] width the width of the image in pixels. + * @param[in] height the height of the image in pixels. + * @param[out] dest A buffer into which picture data will be copied. + * @param[in] dest_size The size of 'dest'. + * @return The number of bytes written to dest, or a negative value (error code) on error. + */ +int avpicture_layout(const AVPicture* src, enum AVPixelFormat pix_fmt, + int width, int height, + unsigned char *dest, int dest_size); + +/** + * Calculate the size in bytes that a picture of the given width and height + * would occupy if stored in the given picture format. + * Note that this returns the size of a compact representation as generated + * by avpicture_layout(), which can be smaller than the size required for e.g. + * avpicture_fill(). + * + * @param pix_fmt the given picture format + * @param width the width of the image + * @param height the height of the image + * @return Image data size in bytes or -1 on error (e.g. too large dimensions). + */ +int avpicture_get_size(enum AVPixelFormat pix_fmt, int width, int height); + +#if FF_API_DEINTERLACE +/** + * deinterlace - if not supported return -1 + * + * @deprecated - use yadif (in libavfilter) instead + */ +attribute_deprecated +int avpicture_deinterlace(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); +#endif +/** + * Copy image src to dst. Wraps av_picture_data_copy() above. + */ +void av_picture_copy(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Crop image top and left side. + */ +int av_picture_crop(AVPicture *dst, const AVPicture *src, + enum AVPixelFormat pix_fmt, int top_band, int left_band); + +/** + * Pad image. + */ +int av_picture_pad(AVPicture *dst, const AVPicture *src, int height, int width, enum AVPixelFormat pix_fmt, + int padtop, int padbottom, int padleft, int padright, int *color); + +/** + * @} + */ + +/** + * @defgroup lavc_misc Utility functions + * @ingroup libavc + * + * Miscellaneous utility functions related to both encoding and decoding + * (or neither). + * @{ + */ + +/** + * @defgroup lavc_misc_pixfmt Pixel formats + * + * Functions for working with pixel formats. + * @{ + */ + +/** + * @deprecated Use av_pix_fmt_get_chroma_sub_sample + */ + +void attribute_deprecated avcodec_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, int *h_shift, int *v_shift); + +/** + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. + */ +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); + +#define FF_LOSS_RESOLUTION 0x0001 /**< loss due to resolution change */ +#define FF_LOSS_DEPTH 0x0002 /**< loss due to color depth change */ +#define FF_LOSS_COLORSPACE 0x0004 /**< loss due to color space conversion */ +#define FF_LOSS_ALPHA 0x0008 /**< loss of alpha bits */ +#define FF_LOSS_COLORQUANT 0x0010 /**< loss due to color quantization */ +#define FF_LOSS_CHROMA 0x0020 /**< loss of chroma (e.g. RGB to gray conversion) */ + +/** + * Compute what kind of losses will occur when converting from one specific + * pixel format to another. + * When converting from one pixel format to another, information loss may occur. + * For example, when converting from RGB24 to GRAY, the color information will + * be lost. Similarly, other losses occur when converting from some formats to + * other formats. These losses can involve loss of chroma, but also loss of + * resolution, loss of color depth, loss due to the color space conversion, loss + * of the alpha bits or loss due to color quantization. + * avcodec_get_fix_fmt_loss() informs you about the various types of losses + * which will occur when converting from one pixel format to another. + * + * @param[in] dst_pix_fmt destination pixel format + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @return Combination of flags informing you what kind of losses will occur. + */ +int avcodec_get_pix_fmt_loss(enum AVPixelFormat dst_pix_fmt, enum AVPixelFormat src_pix_fmt, + int has_alpha); + +/** + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt2() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_list parameter. + * + * + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +enum AVPixelFormat avcodec_find_best_pix_fmt2(enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); + +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + +/** + * @} + */ + +#if FF_API_SET_DIMENSIONS +/** + * @deprecated this function is not supposed to be used from outside of lavc + */ +attribute_deprecated +void avcodec_set_dimensions(AVCodecContext *s, int width, int height); +#endif + +/** + * Put a string representing the codec tag codec_tag in buf. + * + * @param buf buffer to place codec tag in + * @param buf_size size in bytes of buf + * @param codec_tag codec tag to assign + * @return the length of the string that would have been generated if + * enough space had been available, excluding the trailing null + */ +size_t av_get_codec_tag_string(char *buf, size_t buf_size, unsigned int codec_tag); + +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); + +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); +//FIXME func typedef + +/** + * Fill audio frame data and linesize. + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment (0 = default) + * @return 0 on success, negative error code on failure + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Reset the internal decoder state / flush internal buffers. Should be called + * e.g. when seeking or when switching to a different stream. + * + * @note when refcounted frames are not used (i.e. avctx->refcounted_frames is 0), + * this invalidates the frames previously returned from the decoder. When + * refcounted frames are used, the decoder just releases any references it might + * keep internally, but the caller's reference remains valid. + */ +void avcodec_flush_buffers(AVCodecContext *avctx); + +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return audio frame duration. + * + * @param avctx codec context + * @param frame_bytes size of the frame, or 0 if unknown + * @return frame duration, in samples, if known. 0 if not able to + * determine. + */ +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); + + +typedef struct AVBitStreamFilterContext { + void *priv_data; + struct AVBitStreamFilter *filter; + AVCodecParserContext *parser; + struct AVBitStreamFilterContext *next; +} AVBitStreamFilterContext; + + +typedef struct AVBitStreamFilter { + const char *name; + int priv_data_size; + int (*filter)(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); + void (*close)(AVBitStreamFilterContext *bsfc); + struct AVBitStreamFilter *next; +} AVBitStreamFilter; + +void av_register_bitstream_filter(AVBitStreamFilter *bsf); +AVBitStreamFilterContext *av_bitstream_filter_init(const char *name); +int av_bitstream_filter_filter(AVBitStreamFilterContext *bsfc, + AVCodecContext *avctx, const char *args, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, int keyframe); +void av_bitstream_filter_close(AVBitStreamFilterContext *bsf); + +AVBitStreamFilter *av_bitstream_filter_next(AVBitStreamFilter *f); + +/* memory */ + +/** + * Allocate a buffer with padding, reusing the given one if large enough. + * + * Same behaviour av_fast_malloc but the buffer has additional + * FF_INPUT_PADDING_SIZE at the end which will always memset to 0. + * + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#if FF_API_MISSING_SAMPLE +/** + * Log a generic warning message about a missing feature. This function is + * intended to be used internally by Libav (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] feature string containing the name of the missing feature + * @param[in] want_sample indicates if samples are wanted which exhibit this feature. + * If want_sample is non-zero, additional verbage will be added to the log + * message which tells the user how to report samples to the development + * mailing list. + * @deprecated Use avpriv_report_missing_feature() instead. + */ +attribute_deprecated +void av_log_missing_feature(void *avc, const char *feature, int want_sample); + +/** + * Log a generic warning message asking for a sample. This function is + * intended to be used internally by Libav (libavcodec, libavformat, etc.) + * only, and would normally not be used by applications. + * @param[in] avc a pointer to an arbitrary struct of which the first field is + * a pointer to an AVClass struct + * @param[in] msg string containing an optional message, or NULL if no message + * @deprecated Use avpriv_request_sample() instead. + */ +attribute_deprecated +void av_log_ask_for_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); +#endif /* FF_API_MISSING_SAMPLE */ + +/** + * Register the hardware accelerator hwaccel. + */ +void av_register_hwaccel(AVHWAccel *hwaccel); + +/** + * If hwaccel is NULL, returns the first registered hardware accelerator, + * if hwaccel is non-NULL, returns the next registered hardware accelerator + * after hwaccel, or NULL if hwaccel is the last one. + */ +AVHWAccel *av_hwaccel_next(AVHWAccel *hwaccel); + + +/** + * Lock operation used by lockmgr + */ +enum AVLockOp { + AV_LOCK_CREATE, ///< Create a mutex + AV_LOCK_OBTAIN, ///< Lock the mutex + AV_LOCK_RELEASE, ///< Unlock the mutex + AV_LOCK_DESTROY, ///< Free mutex resources +}; + +/** + * Register a user provided lock manager supporting the operations + * specified by AVLockOp. mutex points to a (void *) where the + * lockmgr should store/get a pointer to a user allocated mutex. It's + * NULL upon AV_LOCK_CREATE and != NULL for all other ops. + * + * @param cb User defined callback. Note: Libav may invoke calls to this + * callback during the call to av_lockmgr_register(). + * Thus, the application must be prepared to handle that. + * If cb is set to NULL the lockmgr will be unregistered. + * Also note that during unregistration the previously registered + * lockmgr callback may also be invoked. + */ +int av_lockmgr_register(int (*cb)(void **mutex, enum AVLockOp op)); + +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); + +/** + * @return a positive value if s is open (i.e. avcodec_open2() was called on it + * with no corresponding avcodec_close()), 0 otherwise. + */ +int avcodec_is_open(AVCodecContext *s); + +/** + * @return a non-zero number if codec is an encoder, zero otherwise + */ +int av_codec_is_encoder(const AVCodec *codec); + +/** + * @return a non-zero number if codec is a decoder, zero otherwise + */ +int av_codec_is_decoder(const AVCodec *codec); + +/** + * @return descriptor for given codec ID or NULL if no descriptor exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); + +/** + * Iterate over all codec descriptors known to libavcodec. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); + +/** + * @return codec descriptor with the given name or NULL if no such descriptor + * exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); + +/** + * @} + */ + +#endif /* AVCODEC_AVCODEC_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/avfft.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/avfft.h new file mode 100644 index 000000000000..e2e727da9ede --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/avfft.h @@ -0,0 +1,118 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_AVFFT_H +#define AVCODEC_AVFFT_H + +/** + * @file + * @ingroup lavc_fft + * FFT functions + */ + +/** + * @defgroup lavc_fft FFT functions + * @ingroup lavc_misc + * + * @{ + */ + +typedef float FFTSample; + +typedef struct FFTComplex { + FFTSample re, im; +} FFTComplex; + +typedef struct FFTContext FFTContext; + +/** + * Set up a complex FFT. + * @param nbits log2 of the length of the input array + * @param inverse if 0 perform the forward transform, if 1 perform the inverse + */ +FFTContext *av_fft_init(int nbits, int inverse); + +/** + * Do the permutation needed BEFORE calling ff_fft_calc(). + */ +void av_fft_permute(FFTContext *s, FFTComplex *z); + +/** + * Do a complex FFT with the parameters defined in av_fft_init(). The + * input data must be permuted before. No 1.0/sqrt(n) normalization is done. + */ +void av_fft_calc(FFTContext *s, FFTComplex *z); + +void av_fft_end(FFTContext *s); + +FFTContext *av_mdct_init(int nbits, int inverse, double scale); +void av_imdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_imdct_half(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_calc(FFTContext *s, FFTSample *output, const FFTSample *input); +void av_mdct_end(FFTContext *s); + +/* Real Discrete Fourier Transform */ + +enum RDFTransformType { + DFT_R2C, + IDFT_C2R, + IDFT_R2C, + DFT_C2R, +}; + +typedef struct RDFTContext RDFTContext; + +/** + * Set up a real FFT. + * @param nbits log2 of the length of the input array + * @param trans the type of transform + */ +RDFTContext *av_rdft_init(int nbits, enum RDFTransformType trans); +void av_rdft_calc(RDFTContext *s, FFTSample *data); +void av_rdft_end(RDFTContext *s); + +/* Discrete Cosine Transform */ + +typedef struct DCTContext DCTContext; + +enum DCTTransformType { + DCT_II = 0, + DCT_III, + DCT_I, + DST_I, +}; + +/** + * Set up DCT. + * + * @param nbits size of the input array: + * (1 << nbits) for DCT-II, DCT-III and DST-I + * (1 << nbits) + 1 for DCT-I + * @param type the type of transform + * + * @note the first element of the input of DST-I is ignored + */ +DCTContext *av_dct_init(int nbits, enum DCTTransformType type); +void av_dct_calc(DCTContext *s, FFTSample *data); +void av_dct_end (DCTContext *s); + +/** + * @} + */ + +#endif /* AVCODEC_AVFFT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/dxva2.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/dxva2.h new file mode 100644 index 000000000000..d161eb9f5ea7 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/dxva2.h @@ -0,0 +1,88 @@ +/* + * DXVA2 HW acceleration + * + * copyright (c) 2009 Laurent Aimar + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_DXVA_H +#define AVCODEC_DXVA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_dxva2 + * Public libavcodec DXVA2 header. + */ + +#define _WIN32_WINNT 0x0600 +#include +#include +#include + +/** + * @defgroup lavc_codec_hwaccel_dxva2 DXVA2 + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define FF_DXVA2_WORKAROUND_SCALING_LIST_ZIGZAG 1 ///< Work around for DXVA2 and old UVD/UVD+ ATI video cards + +/** + * This structure is used to provides the necessary configurations and data + * to the DXVA2 Libav HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct dxva_context { + /** + * DXVA2 decoder object + */ + IDirectXVideoDecoder *decoder; + + /** + * DXVA2 configuration used to create the decoder + */ + const DXVA2_ConfigPictureDecode *cfg; + + /** + * The number of surface in the surface array + */ + unsigned surface_count; + + /** + * The array of Direct3D surfaces used to create the decoder + */ + LPDIRECT3DSURFACE9 *surface; + + /** + * A bit field configuring the workarounds needed for using the decoder + */ + uint64_t workaround; + + /** + * Private to the Libav AVHWAccel implementation + */ + unsigned report_id; +}; + +/** + * @} + */ + +#endif /* AVCODEC_DXVA_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vaapi.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vaapi.h new file mode 100644 index 000000000000..39e88259d641 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vaapi.h @@ -0,0 +1,173 @@ +/* + * Video Acceleration API (shared data between Libav and the video player) + * HW decode acceleration for MPEG-2, MPEG-4, H.264 and VC-1 + * + * Copyright (C) 2008-2009 Splitted-Desktop Systems + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VAAPI_H +#define AVCODEC_VAAPI_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vaapi + * Public libavcodec VA API header. + */ + +#include + +/** + * @defgroup lavc_codec_hwaccel_vaapi VA API Decoding + * @ingroup lavc_codec_hwaccel + * @{ + */ + +/** + * This structure is used to share data between the Libav library and + * the client video application. + * This shall be zero-allocated and available as + * AVCodecContext.hwaccel_context. All user members can be set once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + */ +struct vaapi_context { + /** + * Window system dependent data + * + * - encoding: unused + * - decoding: Set by user + */ + void *display; + + /** + * Configuration ID + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t config_id; + + /** + * Context ID (video decode pipeline) + * + * - encoding: unused + * - decoding: Set by user + */ + uint32_t context_id; + + /** + * VAPictureParameterBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t pic_param_buf_id; + + /** + * VAIQMatrixBuffer ID + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t iq_matrix_buf_id; + + /** + * VABitPlaneBuffer ID (for VC-1 decoding) + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t bitplane_buf_id; + + /** + * Slice parameter/data buffer IDs + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t *slice_buf_ids; + + /** + * Number of effective slice buffer IDs to send to the HW + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int n_slice_buf_ids; + + /** + * Size of pre-allocated slice_buf_ids + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_buf_ids_alloc; + + /** + * Pointer to VASliceParameterBuffers + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + void *slice_params; + + /** + * Size of a VASliceParameterBuffer element + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_param_size; + + /** + * Size of pre-allocated slice_params + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_params_alloc; + + /** + * Number of slices currently filled in + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + unsigned int slice_count; + + /** + * Pointer to slice data buffer base + * - encoding: unused + * - decoding: Set by libavcodec + */ + const uint8_t *slice_data; + + /** + * Current size of slice data + * + * - encoding: unused + * - decoding: Set by libavcodec + */ + uint32_t slice_data_size; +}; + +/* @} */ + +#endif /* AVCODEC_VAAPI_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vda.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vda.h new file mode 100644 index 000000000000..987b94f1fabd --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vda.h @@ -0,0 +1,142 @@ +/* + * VDA HW acceleration + * + * copyright (c) 2011 Sebastien Zwickert + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDA_H +#define AVCODEC_VDA_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vda + * Public libavcodec VDA header. + */ + +#include "libavcodec/version.h" + +#include + +// emmintrin.h is unable to compile with -std=c99 -Werror=missing-prototypes +// http://openradar.appspot.com/8026390 +#undef __GNUC_STDC_INLINE__ + +#define Picture QuickdrawPicture +#include +#undef Picture + +/** + * @defgroup lavc_codec_hwaccel_vda VDA + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +/** + * This structure is used to provide the necessary configurations and data + * to the VDA Libav HWAccel implementation. + * + * The application must make it available as AVCodecContext.hwaccel_context. + */ +struct vda_context { + /** + * VDA decoder object. + * + * - encoding: unused + * - decoding: Set/Unset by libavcodec. + */ + VDADecoder decoder; + + /** + * The Core Video pixel buffer that contains the current image data. + * + * encoding: unused + * decoding: Set by libavcodec. Unset by user. + */ + CVPixelBufferRef cv_buffer; + + /** + * Use the hardware decoder in synchronous mode. + * + * encoding: unused + * decoding: Set by user. + */ + int use_sync_decoding; + + /** + * The frame width. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int width; + + /** + * The frame height. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int height; + + /** + * The frame format. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + int format; + + /** + * The pixel format for output image buffers. + * + * - encoding: unused + * - decoding: Set/Unset by user. + */ + OSType cv_pix_fmt_type; + + /** + * The current bitstream buffer. + */ + uint8_t *priv_bitstream; + + /** + * The current size of the bitstream. + */ + int priv_bitstream_size; + + /** + * The reference size used for fast reallocation. + */ + int priv_allocated_size; +}; + +/** Create the video decoder. */ +int ff_vda_create_decoder(struct vda_context *vda_ctx, + uint8_t *extradata, + int extradata_size); + +/** Destroy the video decoder. */ +int ff_vda_destroy_decoder(struct vda_context *vda_ctx); + +/** + * @} + */ + +#endif /* AVCODEC_VDA_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vdpau.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vdpau.h new file mode 100644 index 000000000000..75cb1bf7a33a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/vdpau.h @@ -0,0 +1,189 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using Libav + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include +#include + +#include "libavutil/attributes.h" + +#include "avcodec.h" +#include "version.h" + +#if FF_API_BUFS_VDPAU +union AVVDPAUPictureInfo { + VdpPictureInfoH264 h264; + VdpPictureInfoMPEG1Or2 mpeg; + VdpPictureInfoVC1 vc1; + VdpPictureInfoMPEG4Part2 mpeg4; +}; +#endif + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * The user shall zero-allocate the structure and make it available as + * AVCodecContext.hwaccel_context. Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * The size of this structure is not a part of the public ABI and must not + * be used outside of libavcodec. Use av_vdpau_alloc_context() to allocate an + * AVVDPAUContext. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + +#if FF_API_BUFS_VDPAU + /** + * VDPAU picture information + * + * Set by libavcodec. + */ + attribute_deprecated + union AVVDPAUPictureInfo info; + + /** + * Allocated size of the bitstream_buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_allocated; + + /** + * Useful bitstream buffers in the bitstream buffers table. + * + * Set by libavcodec. + */ + attribute_deprecated + int bitstream_buffers_used; + + /** + * Table of bitstream buffers. + * The user is responsible for freeing this buffer using av_freep(). + * + * Set by libavcodec. + */ + attribute_deprecated + VdpBitstreamBuffer *bitstream_buffers; +#endif +} AVVDPAUContext; + +/** + * Allocate an AVVDPAUContext. + * + * @return Newly-allocated AVVDPAUContext or NULL on failure. + */ +AVVDPAUContext *av_vdpau_alloc_context(void); + +/** + * Get a decoder profile that should be used for initializing a VDPAU decoder. + * Should be called from the AVCodecContext.get_format() callback. + * + * @param avctx the codec context being used for decoding the stream + * @param profile a pointer into which the result will be written on success. + * The contents of profile are undefined if this function returns + * an error. + * + * @return 0 on success (non-negative), a negative AVERROR on failure. + */ +int av_vdpau_get_profile(AVCodecContext *avctx, VdpDecoderProfile *profile); + +#if FF_API_CAP_VDPAU +/** @brief The videoSurface is used for rendering. */ +#define FF_VDPAU_STATE_USED_FOR_RENDER 1 + +/** + * @brief The videoSurface is needed for reference/prediction. + * The codec manipulates this. + */ +#define FF_VDPAU_STATE_USED_FOR_REFERENCE 2 + +/** + * @brief This structure is used as a callback between the Libav + * decoder (vd_) and presentation (vo_) module. + * This is used for defining a video frame containing surface, + * picture parameter, bitstream information etc which are passed + * between the Libav decoder and its clients. + */ +struct vdpau_render_state { + VdpVideoSurface surface; ///< Used as rendered surface, never changed. + + int state; ///< Holds FF_VDPAU_STATE_* values. + + /** picture parameter information for all supported codecs */ + union AVVDPAUPictureInfo info; + + /** Describe size/location of the compressed video data. + Set to 0 when freeing bitstream_buffers. */ + int bitstream_buffers_allocated; + int bitstream_buffers_used; + /** The user is responsible for freeing this buffer using av_freep(). */ + VdpBitstreamBuffer *bitstream_buffers; +}; +#endif + +/* @}*/ + +#endif /* AVCODEC_VDPAU_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/version.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/version.h new file mode 100644 index 000000000000..cdd5a613d551 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/version.h @@ -0,0 +1,127 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#include "libavutil/version.h" + +#define LIBAVCODEC_VERSION_MAJOR 55 +#define LIBAVCODEC_VERSION_MINOR 34 +#define LIBAVCODEC_VERSION_MICRO 1 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ + +#ifndef FF_API_REQUEST_CHANNELS +#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_DEINTERLACE +#define FF_API_DEINTERLACE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_DESTRUCT_PACKET +#define FF_API_DESTRUCT_PACKET (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_GET_BUFFER +#define FF_API_GET_BUFFER (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_MISSING_SAMPLE +#define FF_API_MISSING_SAMPLE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_LOWRES +#define FF_API_LOWRES (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_CAP_VDPAU +#define FF_API_CAP_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_BUFS_VDPAU +#define FF_API_BUFS_VDPAU (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_VOXWARE +#define FF_API_VOXWARE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_SET_DIMENSIONS +#define FF_API_SET_DIMENSIONS (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_DEBUG_MV +#define FF_API_DEBUG_MV (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_AC_VLC +#define FF_API_AC_VLC (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_OLD_MSMPEG4 +#define FF_API_OLD_MSMPEG4 (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_ASPECT_EXTENDED +#define FF_API_ASPECT_EXTENDED (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_THREAD_OPAQUE +#define FF_API_THREAD_OPAQUE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_CODEC_PKT +#define FF_API_CODEC_PKT (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_ARCH_ALPHA +#define FF_API_ARCH_ALPHA (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_ERROR_RATE +#define FF_API_ERROR_RATE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_QSCALE_TYPE +#define FF_API_QSCALE_TYPE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_MB_TYPE +#define FF_API_MB_TYPE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_MAX_BFRAMES +#define FF_API_MAX_BFRAMES (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_FAST_MALLOC +#define FF_API_FAST_MALLOC (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_NEG_LINESIZES +#define FF_API_NEG_LINESIZES (LIBAVCODEC_VERSION_MAJOR < 56) +#endif +#ifndef FF_API_EMU_EDGE +#define FF_API_EMU_EDGE (LIBAVCODEC_VERSION_MAJOR < 56) +#endif + +#endif /* AVCODEC_VERSION_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavcodec/xvmc.h b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/xvmc.h new file mode 100644 index 000000000000..950ed1827646 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavcodec/xvmc.h @@ -0,0 +1,174 @@ +/* + * Copyright (C) 2003 Ivan Kalvachev + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVCODEC_XVMC_H +#define AVCODEC_XVMC_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_xvmc + * Public libavcodec XvMC header. + */ + +#include + +#include "libavutil/attributes.h" +#include "version.h" +#include "avcodec.h" + +#if FF_API_XVMC + +/** + * @defgroup lavc_codec_hwaccel_xvmc XvMC + * @ingroup lavc_codec_hwaccel + * + * @{ + */ + +#define AV_XVMC_ID 0x1DC711C0 /**< special value to ensure that regular pixel routines haven't corrupted the struct + the number is 1337 speak for the letters IDCT MCo (motion compensation) */ + +attribute_deprecated struct xvmc_pix_fmt { + /** The field contains the special constant value AV_XVMC_ID. + It is used as a test that the application correctly uses the API, + and that there is no corruption caused by pixel routines. + - application - set during initialization + - libavcodec - unchanged + */ + int xvmc_id; + + /** Pointer to the block array allocated by XvMCCreateBlocks(). + The array has to be freed by XvMCDestroyBlocks(). + Each group of 64 values represents one data block of differential + pixel information (in MoCo mode) or coefficients for IDCT. + - application - set the pointer during initialization + - libavcodec - fills coefficients/pixel data into the array + */ + short* data_blocks; + + /** Pointer to the macroblock description array allocated by + XvMCCreateMacroBlocks() and freed by XvMCDestroyMacroBlocks(). + - application - set the pointer during initialization + - libavcodec - fills description data into the array + */ + XvMCMacroBlock* mv_blocks; + + /** Number of macroblock descriptions that can be stored in the mv_blocks + array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_mv_blocks; + + /** Number of blocks that can be stored at once in the data_blocks array. + - application - set during initialization + - libavcodec - unchanged + */ + int allocated_data_blocks; + + /** Indicate that the hardware would interpret data_blocks as IDCT + coefficients and perform IDCT on them. + - application - set during initialization + - libavcodec - unchanged + */ + int idct; + + /** In MoCo mode it indicates that intra macroblocks are assumed to be in + unsigned format; same as the XVMC_INTRA_UNSIGNED flag. + - application - set during initialization + - libavcodec - unchanged + */ + int unsigned_intra; + + /** Pointer to the surface allocated by XvMCCreateSurface(). + It has to be freed by XvMCDestroySurface() on application exit. + It identifies the frame and its state on the video hardware. + - application - set during initialization + - libavcodec - unchanged + */ + XvMCSurface* p_surface; + +/** Set by the decoder before calling ff_draw_horiz_band(), + needed by the XvMCRenderSurface function. */ +//@{ + /** Pointer to the surface used as past reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_past_surface; + + /** Pointer to the surface used as future reference + - application - unchanged + - libavcodec - set + */ + XvMCSurface* p_future_surface; + + /** top/bottom field or frame + - application - unchanged + - libavcodec - set + */ + unsigned int picture_structure; + + /** XVMC_SECOND_FIELD - 1st or 2nd field in the sequence + - application - unchanged + - libavcodec - set + */ + unsigned int flags; +//}@ + + /** Number of macroblock descriptions in the mv_blocks array + that have already been passed to the hardware. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may increment it + with filled_mb_block_num or zero both. + - libavcodec - unchanged + */ + int start_mv_blocks_num; + + /** Number of new macroblock descriptions in the mv_blocks array (after + start_mv_blocks_num) that are filled by libavcodec and have to be + passed to the hardware. + - application - zeroes it on get_buffer() or after successful + ff_draw_horiz_band(). + - libavcodec - increment with one of each stored MB + */ + int filled_mv_blocks_num; + + /** Number of the next free data block; one data block consists of + 64 short values in the data_blocks array. + All blocks before this one have already been claimed by placing their + position into the corresponding block description structure field, + that are part of the mv_blocks array. + - application - zeroes it on get_buffer(). + A successful ff_draw_horiz_band() may zero it together + with start_mb_blocks_num. + - libavcodec - each decoded macroblock increases it by the number + of coded blocks it contains. + */ + int next_free_data_block_num; +}; + +/** + * @} + */ + +#endif /* FF_API_XVMC */ + +#endif /* AVCODEC_XVMC_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavformat/avformat.h b/content/media/fmp4/ffmpeg/libav55/include/libavformat/avformat.h new file mode 100644 index 000000000000..ec9c2627cba3 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavformat/avformat.h @@ -0,0 +1,1869 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_AVFORMAT_H +#define AVFORMAT_AVFORMAT_H + +/** + * @file + * @ingroup libavf + * Main libavformat public API header + */ + +/** + * @defgroup libavf I/O and Muxing/Demuxing Library + * @{ + * + * Libavformat (lavf) is a library for dealing with various media container + * formats. Its main two purposes are demuxing - i.e. splitting a media file + * into component streams, and the reverse process of muxing - writing supplied + * data in a specified container format. It also has an @ref lavf_io + * "I/O module" which supports a number of protocols for accessing the data (e.g. + * file, tcp, http and others). Before using lavf, you need to call + * av_register_all() to register all compiled muxers, demuxers and protocols. + * Unless you are absolutely sure you won't use libavformat's network + * capabilities, you should also call avformat_network_init(). + * + * A supported input format is described by an AVInputFormat struct, conversely + * an output format is described by AVOutputFormat. You can iterate over all + * registered input/output formats using the av_iformat_next() / + * av_oformat_next() functions. The protocols layer is not part of the public + * API, so you can only get the names of supported protocols with the + * avio_enum_protocols() function. + * + * Main lavf structure used for both muxing and demuxing is AVFormatContext, + * which exports all information about the file being read or written. As with + * most Libav structures, its size is not part of public ABI, so it cannot be + * allocated on stack or directly with av_malloc(). To create an + * AVFormatContext, use avformat_alloc_context() (some functions, like + * avformat_open_input() might do that for you). + * + * Most importantly an AVFormatContext contains: + * @li the @ref AVFormatContext.iformat "input" or @ref AVFormatContext.oformat + * "output" format. It is either autodetected or set by user for input; + * always set by user for output. + * @li an @ref AVFormatContext.streams "array" of AVStreams, which describe all + * elementary streams stored in the file. AVStreams are typically referred to + * using their index in this array. + * @li an @ref AVFormatContext.pb "I/O context". It is either opened by lavf or + * set by user for input, always set by user for output (unless you are dealing + * with an AVFMT_NOFILE format). + * + * @section lavf_options Passing options to (de)muxers + * Lavf allows to configure muxers and demuxers using the @ref avoptions + * mechanism. Generic (format-independent) libavformat options are provided by + * AVFormatContext, they can be examined from a user program by calling + * av_opt_next() / av_opt_find() on an allocated AVFormatContext (or its AVClass + * from avformat_get_class()). Private (format-specific) options are provided by + * AVFormatContext.priv_data if and only if AVInputFormat.priv_class / + * AVOutputFormat.priv_class of the corresponding format struct is non-NULL. + * Further options may be provided by the @ref AVFormatContext.pb "I/O context", + * if its AVClass is non-NULL, and the protocols layer. See the discussion on + * nesting in @ref avoptions documentation to learn how to access those. + * + * @defgroup lavf_decoding Demuxing + * @{ + * Demuxers read a media file and split it into chunks of data (@em packets). A + * @ref AVPacket "packet" contains one or more encoded frames which belongs to a + * single elementary stream. In the lavf API this process is represented by the + * avformat_open_input() function for opening a file, av_read_frame() for + * reading a single packet and finally avformat_close_input(), which does the + * cleanup. + * + * @section lavf_decoding_open Opening a media file + * The minimum information required to open a file is its URL or filename, which + * is passed to avformat_open_input(), as in the following code: + * @code + * const char *url = "in.mp3"; + * AVFormatContext *s = NULL; + * int ret = avformat_open_input(&s, url, NULL, NULL); + * if (ret < 0) + * abort(); + * @endcode + * The above code attempts to allocate an AVFormatContext, open the + * specified file (autodetecting the format) and read the header, exporting the + * information stored there into s. Some formats do not have a header or do not + * store enough information there, so it is recommended that you call the + * avformat_find_stream_info() function which tries to read and decode a few + * frames to find missing information. + * + * In some cases you might want to preallocate an AVFormatContext yourself with + * avformat_alloc_context() and do some tweaking on it before passing it to + * avformat_open_input(). One such case is when you want to use custom functions + * for reading input data instead of lavf internal I/O layer. + * To do that, create your own AVIOContext with avio_alloc_context(), passing + * your reading callbacks to it. Then set the @em pb field of your + * AVFormatContext to newly created AVIOContext. + * + * Since the format of the opened file is in general not known until after + * avformat_open_input() has returned, it is not possible to set demuxer private + * options on a preallocated context. Instead, the options should be passed to + * avformat_open_input() wrapped in an AVDictionary: + * @code + * AVDictionary *options = NULL; + * av_dict_set(&options, "video_size", "640x480", 0); + * av_dict_set(&options, "pixel_format", "rgb24", 0); + * + * if (avformat_open_input(&s, url, NULL, &options) < 0) + * abort(); + * av_dict_free(&options); + * @endcode + * This code passes the private options 'video_size' and 'pixel_format' to the + * demuxer. They would be necessary for e.g. the rawvideo demuxer, since it + * cannot know how to interpret raw video data otherwise. If the format turns + * out to be something different than raw video, those options will not be + * recognized by the demuxer and therefore will not be applied. Such unrecognized + * options are then returned in the options dictionary (recognized options are + * consumed). The calling program can handle such unrecognized options as it + * wishes, e.g. + * @code + * AVDictionaryEntry *e; + * if (e = av_dict_get(options, "", NULL, AV_DICT_IGNORE_SUFFIX)) { + * fprintf(stderr, "Option %s not recognized by the demuxer.\n", e->key); + * abort(); + * } + * @endcode + * + * After you have finished reading the file, you must close it with + * avformat_close_input(). It will free everything associated with the file. + * + * @section lavf_decoding_read Reading from an opened file + * Reading data from an opened AVFormatContext is done by repeatedly calling + * av_read_frame() on it. Each call, if successful, will return an AVPacket + * containing encoded data for one AVStream, identified by + * AVPacket.stream_index. This packet may be passed straight into the libavcodec + * decoding functions avcodec_decode_video2(), avcodec_decode_audio4() or + * avcodec_decode_subtitle2() if the caller wishes to decode the data. + * + * AVPacket.pts, AVPacket.dts and AVPacket.duration timing information will be + * set if known. They may also be unset (i.e. AV_NOPTS_VALUE for + * pts/dts, 0 for duration) if the stream does not provide them. The timing + * information will be in AVStream.time_base units, i.e. it has to be + * multiplied by the timebase to convert them to seconds. + * + * If AVPacket.buf is set on the returned packet, then the packet is + * allocated dynamically and the user may keep it indefinitely. + * Otherwise, if AVPacket.buf is NULL, the packet data is backed by a + * static storage somewhere inside the demuxer and the packet is only valid + * until the next av_read_frame() call or closing the file. If the caller + * requires a longer lifetime, av_dup_packet() will make an av_malloc()ed copy + * of it. + * In both cases, the packet must be freed with av_free_packet() when it is no + * longer needed. + * + * @section lavf_decoding_seek Seeking + * @} + * + * @defgroup lavf_encoding Muxing + * @{ + * Muxers take encoded data in the form of @ref AVPacket "AVPackets" and write + * it into files or other output bytestreams in the specified container format. + * + * The main API functions for muxing are avformat_write_header() for writing the + * file header, av_write_frame() / av_interleaved_write_frame() for writing the + * packets and av_write_trailer() for finalizing the file. + * + * At the beginning of the muxing process, the caller must first call + * avformat_alloc_context() to create a muxing context. The caller then sets up + * the muxer by filling the various fields in this context: + * + * - The @ref AVFormatContext.oformat "oformat" field must be set to select the + * muxer that will be used. + * - Unless the format is of the AVFMT_NOFILE type, the @ref AVFormatContext.pb + * "pb" field must be set to an opened IO context, either returned from + * avio_open2() or a custom one. + * - Unless the format is of the AVFMT_NOSTREAMS type, at least one stream must + * be created with the avformat_new_stream() function. The caller should fill + * the @ref AVStream.codec "stream codec context" information, such as the + * codec @ref AVCodecContext.codec_type "type", @ref AVCodecContext.codec_id + * "id" and other parameters (e.g. width / height, the pixel or sample format, + * etc.) as known. The @ref AVCodecContext.time_base "codec timebase" should + * be set to the timebase that the caller desires to use for this stream (note + * that the timebase actually used by the muxer can be different, as will be + * described later). + * - The caller may fill in additional information, such as @ref + * AVFormatContext.metadata "global" or @ref AVStream.metadata "per-stream" + * metadata, @ref AVFormatContext.chapters "chapters", @ref + * AVFormatContext.programs "programs", etc. as described in the + * AVFormatContext documentation. Whether such information will actually be + * stored in the output depends on what the container format and the muxer + * support. + * + * When the muxing context is fully set up, the caller must call + * avformat_write_header() to initialize the muxer internals and write the file + * header. Whether anything actually is written to the IO context at this step + * depends on the muxer, but this function must always be called. Any muxer + * private options must be passed in the options parameter to this function. + * + * The data is then sent to the muxer by repeatedly calling av_write_frame() or + * av_interleaved_write_frame() (consult those functions' documentation for + * discussion on the difference between them; only one of them may be used with + * a single muxing context, they should not be mixed). Do note that the timing + * information on the packets sent to the muxer must be in the corresponding + * AVStream's timebase. That timebase is set by the muxer (in the + * avformat_write_header() step) and may be different from the timebase the + * caller set on the codec context. + * + * Once all the data has been written, the caller must call av_write_trailer() + * to flush any buffered packets and finalize the output file, then close the IO + * context (if any) and finally free the muxing context with + * avformat_free_context(). + * @} + * + * @defgroup lavf_io I/O Read/Write + * @{ + * @} + * + * @defgroup lavf_codec Demuxers + * @{ + * @defgroup lavf_codec_native Native Demuxers + * @{ + * @} + * @defgroup lavf_codec_wrappers External library wrappers + * @{ + * @} + * @} + * @defgroup lavf_protos I/O Protocols + * @{ + * @} + * @defgroup lavf_internal Internal + * @{ + * @} + * @} + * + */ + +#include +#include /* FILE */ +#include "libavcodec/avcodec.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "avio.h" +#include "libavformat/version.h" + +struct AVFormatContext; + + +/** + * @defgroup metadata_api Public Metadata API + * @{ + * @ingroup libavf + * The metadata API allows libavformat to export metadata tags to a client + * application when demuxing. Conversely it allows a client application to + * set metadata when muxing. + * + * Metadata is exported or set as pairs of key/value strings in the 'metadata' + * fields of the AVFormatContext, AVStream, AVChapter and AVProgram structs + * using the @ref lavu_dict "AVDictionary" API. Like all strings in Libav, + * metadata is assumed to be UTF-8 encoded Unicode. Note that metadata + * exported by demuxers isn't checked to be valid UTF-8 in most cases. + * + * Important concepts to keep in mind: + * - Keys are unique; there can never be 2 tags with the same key. This is + * also meant semantically, i.e., a demuxer should not knowingly produce + * several keys that are literally different but semantically identical. + * E.g., key=Author5, key=Author6. In this example, all authors must be + * placed in the same tag. + * - Metadata is flat, not hierarchical; there are no subtags. If you + * want to store, e.g., the email address of the child of producer Alice + * and actor Bob, that could have key=alice_and_bobs_childs_email_address. + * - Several modifiers can be applied to the tag name. This is done by + * appending a dash character ('-') and the modifier name in the order + * they appear in the list below -- e.g. foo-eng-sort, not foo-sort-eng. + * - language -- a tag whose value is localized for a particular language + * is appended with the ISO 639-2/B 3-letter language code. + * For example: Author-ger=Michael, Author-eng=Mike + * The original/default language is in the unqualified "Author" tag. + * A demuxer should set a default if it sets any translated tag. + * - sorting -- a modified version of a tag that should be used for + * sorting will have '-sort' appended. E.g. artist="The Beatles", + * artist-sort="Beatles, The". + * + * - Demuxers attempt to export metadata in a generic format, however tags + * with no generic equivalents are left as they are stored in the container. + * Follows a list of generic tag names: + * + @verbatim + album -- name of the set this work belongs to + album_artist -- main creator of the set/album, if different from artist. + e.g. "Various Artists" for compilation albums. + artist -- main creator of the work + comment -- any additional description of the file. + composer -- who composed the work, if different from artist. + copyright -- name of copyright holder. + creation_time-- date when the file was created, preferably in ISO 8601. + date -- date when the work was created, preferably in ISO 8601. + disc -- number of a subset, e.g. disc in a multi-disc collection. + encoder -- name/settings of the software/hardware that produced the file. + encoded_by -- person/group who created the file. + filename -- original name of the file. + genre -- . + language -- main language in which the work is performed, preferably + in ISO 639-2 format. Multiple languages can be specified by + separating them with commas. + performer -- artist who performed the work, if different from artist. + E.g for "Also sprach Zarathustra", artist would be "Richard + Strauss" and performer "London Philharmonic Orchestra". + publisher -- name of the label/publisher. + service_name -- name of the service in broadcasting (channel name). + service_provider -- name of the service provider in broadcasting. + title -- name of the work. + track -- number of this work in the set, can be in form current/total. + variant_bitrate -- the total bitrate of the bitrate variant that the current stream is part of + @endverbatim + * + * Look in the examples section for an application example how to use the Metadata API. + * + * @} + */ + +/* packet functions */ + + +/** + * Allocate and read the payload of a packet and initialize its + * fields with default values. + * + * @param s associated IO context + * @param pkt packet + * @param size desired payload size + * @return >0 (read size) if OK, AVERROR_xxx otherwise + */ +int av_get_packet(AVIOContext *s, AVPacket *pkt, int size); + + +/** + * Read data and append it to the current content of the AVPacket. + * If pkt->size is 0 this is identical to av_get_packet. + * Note that this uses av_grow_packet and thus involves a realloc + * which is inefficient. Thus this function should only be used + * when there is no reasonable way to know (an upper bound of) + * the final size. + * + * @param s associated IO context + * @param pkt packet + * @param size amount of data to read + * @return >0 (read size) if OK, AVERROR_xxx otherwise, previous data + * will not be lost even if an error occurs. + */ +int av_append_packet(AVIOContext *s, AVPacket *pkt, int size); + +/*************************************************/ +/* fractional numbers for exact pts handling */ + +/** + * The exact value of the fractional number is: 'val + num / den'. + * num is assumed to be 0 <= num < den. + */ +typedef struct AVFrac { + int64_t val, num, den; +} AVFrac; + +/*************************************************/ +/* input/output formats */ + +struct AVCodecTag; + +/** + * This structure contains the data a format has to probe a file. + */ +typedef struct AVProbeData { + const char *filename; + unsigned char *buf; /**< Buffer must have AVPROBE_PADDING_SIZE of extra allocated bytes filled with zero. */ + int buf_size; /**< Size of buf except extra allocated bytes */ +} AVProbeData; + +#define AVPROBE_SCORE_EXTENSION 50 ///< score for file extension +#define AVPROBE_SCORE_MAX 100 ///< maximum score + +#define AVPROBE_PADDING_SIZE 32 ///< extra allocated bytes at the end of the probe buffer + +/// Demuxer will use avio_open, no opened file should be provided by the caller. +#define AVFMT_NOFILE 0x0001 +#define AVFMT_NEEDNUMBER 0x0002 /**< Needs '%d' in filename. */ +#define AVFMT_SHOW_IDS 0x0008 /**< Show format stream IDs numbers. */ +#define AVFMT_RAWPICTURE 0x0020 /**< Format wants AVPicture structure for + raw picture data. */ +#define AVFMT_GLOBALHEADER 0x0040 /**< Format wants global header. */ +#define AVFMT_NOTIMESTAMPS 0x0080 /**< Format does not need / have any timestamps. */ +#define AVFMT_GENERIC_INDEX 0x0100 /**< Use generic index building code. */ +#define AVFMT_TS_DISCONT 0x0200 /**< Format allows timestamp discontinuities. Note, muxers always require valid (monotone) timestamps */ +#define AVFMT_VARIABLE_FPS 0x0400 /**< Format allows variable fps. */ +#define AVFMT_NODIMENSIONS 0x0800 /**< Format does not need width/height */ +#define AVFMT_NOSTREAMS 0x1000 /**< Format does not require any streams */ +#define AVFMT_NOBINSEARCH 0x2000 /**< Format does not allow to fall back on binary search via read_timestamp */ +#define AVFMT_NOGENSEARCH 0x4000 /**< Format does not allow to fall back on generic search */ +#define AVFMT_NO_BYTE_SEEK 0x8000 /**< Format does not allow seeking by bytes */ +#define AVFMT_ALLOW_FLUSH 0x10000 /**< Format allows flushing. If not set, the muxer will not receive a NULL packet in the write_packet function. */ +#define AVFMT_TS_NONSTRICT 0x20000 /**< Format does not require strictly + increasing timestamps, but they must + still be monotonic */ +#define AVFMT_TS_NEGATIVE 0x40000 /**< Format allows muxing negative + timestamps. If not set the timestamp + will be shifted in av_write_frame and + av_interleaved_write_frame so they + start from 0. */ + +/** + * @addtogroup lavf_encoding + * @{ + */ +typedef struct AVOutputFormat { + const char *name; + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + const char *mime_type; + const char *extensions; /**< comma-separated filename extensions */ + /* output support */ + enum AVCodecID audio_codec; /**< default audio codec */ + enum AVCodecID video_codec; /**< default video codec */ + enum AVCodecID subtitle_codec; /**< default subtitle codec */ + /** + * can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_RAWPICTURE, + * AVFMT_GLOBALHEADER, AVFMT_NOTIMESTAMPS, AVFMT_VARIABLE_FPS, + * AVFMT_NODIMENSIONS, AVFMT_NOSTREAMS, AVFMT_ALLOW_FLUSH, + * AVFMT_TS_NONSTRICT + */ + int flags; + + /** + * List of supported codec_id-codec_tag pairs, ordered by "better + * choice first". The arrays are all terminated by AV_CODEC_ID_NONE. + */ + const struct AVCodecTag * const *codec_tag; + + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVOutputFormat *next; + /** + * size of private data so that it can be allocated in the wrapper + */ + int priv_data_size; + + int (*write_header)(struct AVFormatContext *); + /** + * Write a packet. If AVFMT_ALLOW_FLUSH is set in flags, + * pkt can be NULL in order to flush data buffered in the muxer. + * When flushing, return 0 if there still is more data to flush, + * or 1 if everything was flushed and there is no more buffered + * data. + */ + int (*write_packet)(struct AVFormatContext *, AVPacket *pkt); + int (*write_trailer)(struct AVFormatContext *); + /** + * Currently only used to set pixel format if not YUV420P. + */ + int (*interleave_packet)(struct AVFormatContext *, AVPacket *out, + AVPacket *in, int flush); + /** + * Test if the given codec can be stored in this container. + * + * @return 1 if the codec is supported, 0 if it is not. + * A negative number if unknown. + */ + int (*query_codec)(enum AVCodecID id, int std_compliance); +} AVOutputFormat; +/** + * @} + */ + +/** + * @addtogroup lavf_decoding + * @{ + */ +typedef struct AVInputFormat { + /** + * A comma separated list of short names for the format. New names + * may be appended with a minor bump. + */ + const char *name; + + /** + * Descriptive name for the format, meant to be more human-readable + * than name. You should use the NULL_IF_CONFIG_SMALL() macro + * to define it. + */ + const char *long_name; + + /** + * Can use flags: AVFMT_NOFILE, AVFMT_NEEDNUMBER, AVFMT_SHOW_IDS, + * AVFMT_GENERIC_INDEX, AVFMT_TS_DISCONT, AVFMT_NOBINSEARCH, + * AVFMT_NOGENSEARCH, AVFMT_NO_BYTE_SEEK. + */ + int flags; + + /** + * If extensions are defined, then no probe is done. You should + * usually not use extension format guessing because it is not + * reliable enough + */ + const char *extensions; + + const struct AVCodecTag * const *codec_tag; + + const AVClass *priv_class; ///< AVClass for the private context + + /***************************************************************** + * No fields below this line are part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + struct AVInputFormat *next; + + /** + * Raw demuxers store their codec ID here. + */ + int raw_codec_id; + + /** + * Size of private data so that it can be allocated in the wrapper. + */ + int priv_data_size; + + /** + * Tell if a given file has a chance of being parsed as this format. + * The buffer provided is guaranteed to be AVPROBE_PADDING_SIZE bytes + * big so you do not have to check for that unless you need more. + */ + int (*read_probe)(AVProbeData *); + + /** + * Read the format header and initialize the AVFormatContext + * structure. Return 0 if OK. Only used in raw format right + * now. 'avformat_new_stream' should be called to create new streams. + */ + int (*read_header)(struct AVFormatContext *); + + /** + * Read one packet and put it in 'pkt'. pts and flags are also + * set. 'avformat_new_stream' can be called only if the flag + * AVFMTCTX_NOHEADER is used and only in the calling thread (not in a + * background thread). + * @return 0 on success, < 0 on error. + * When returning an error, pkt must not have been allocated + * or must be freed before returning + */ + int (*read_packet)(struct AVFormatContext *, AVPacket *pkt); + + /** + * Close the stream. The AVFormatContext and AVStreams are not + * freed by this function + */ + int (*read_close)(struct AVFormatContext *); + + /** + * Seek to a given timestamp relative to the frames in + * stream component stream_index. + * @param stream_index Must not be -1. + * @param flags Selects which direction should be preferred if no exact + * match is available. + * @return >= 0 on success (but not necessarily the new offset) + */ + int (*read_seek)(struct AVFormatContext *, + int stream_index, int64_t timestamp, int flags); + + /** + * Get the next timestamp in stream[stream_index].time_base units. + * @return the timestamp or AV_NOPTS_VALUE if an error occurred + */ + int64_t (*read_timestamp)(struct AVFormatContext *s, int stream_index, + int64_t *pos, int64_t pos_limit); + + /** + * Start/resume playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_play)(struct AVFormatContext *); + + /** + * Pause playing - only meaningful if using a network-based format + * (RTSP). + */ + int (*read_pause)(struct AVFormatContext *); + + /** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + */ + int (*read_seek2)(struct AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); +} AVInputFormat; +/** + * @} + */ + +enum AVStreamParseType { + AVSTREAM_PARSE_NONE, + AVSTREAM_PARSE_FULL, /**< full parsing and repack */ + AVSTREAM_PARSE_HEADERS, /**< Only parse headers, do not repack. */ + AVSTREAM_PARSE_TIMESTAMPS, /**< full parsing and interpolation of timestamps for frames not starting on a packet boundary */ + AVSTREAM_PARSE_FULL_ONCE, /**< full parsing and repack of the first frame only, only implemented for H.264 currently */ +}; + +typedef struct AVIndexEntry { + int64_t pos; + int64_t timestamp; +#define AVINDEX_KEYFRAME 0x0001 + int flags:2; + int size:30; //Yeah, trying to keep the size of this small to reduce memory requirements (it is 24 vs. 32 bytes due to possible 8-byte alignment). + int min_distance; /**< Minimum distance between this and the previous keyframe, used to avoid unneeded searching. */ +} AVIndexEntry; + +#define AV_DISPOSITION_DEFAULT 0x0001 +#define AV_DISPOSITION_DUB 0x0002 +#define AV_DISPOSITION_ORIGINAL 0x0004 +#define AV_DISPOSITION_COMMENT 0x0008 +#define AV_DISPOSITION_LYRICS 0x0010 +#define AV_DISPOSITION_KARAOKE 0x0020 + +/** + * Track should be used during playback by default. + * Useful for subtitle track that should be displayed + * even when user did not explicitly ask for subtitles. + */ +#define AV_DISPOSITION_FORCED 0x0040 +#define AV_DISPOSITION_HEARING_IMPAIRED 0x0080 /**< stream for hearing impaired audiences */ +#define AV_DISPOSITION_VISUAL_IMPAIRED 0x0100 /**< stream for visual impaired audiences */ +#define AV_DISPOSITION_CLEAN_EFFECTS 0x0200 /**< stream without voice */ +/** + * The stream is stored in the file as an attached picture/"cover art" (e.g. + * APIC frame in ID3v2). The single packet associated with it will be returned + * among the first few packets read from the file unless seeking takes place. + * It can also be accessed at any time in AVStream.attached_pic. + */ +#define AV_DISPOSITION_ATTACHED_PIC 0x0400 + +/** + * Stream structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVStream) must not be used outside libav*. + */ +typedef struct AVStream { + int index; /**< stream index in AVFormatContext */ + /** + * Format-specific stream ID. + * decoding: set by libavformat + * encoding: set by the user, replaced by libavformat if left unset + */ + int id; + /** + * Codec context associated with this stream. Allocated and freed by + * libavformat. + * + * - decoding: The demuxer exports codec information stored in the headers + * here. + * - encoding: The user sets codec information, the muxer writes it to the + * output. Mandatory fields as specified in AVCodecContext + * documentation must be set even if this AVCodecContext is + * not actually used for encoding. + */ + AVCodecContext *codec; + void *priv_data; + + /** + * encoding: pts generation when outputting stream + */ + struct AVFrac pts; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. + * + * decoding: set by libavformat + * encoding: set by libavformat in avformat_write_header. The muxer may use the + * user-provided value of @ref AVCodecContext.time_base "codec->time_base" + * as a hint. + */ + AVRational time_base; + + /** + * Decoding: pts of the first frame of the stream, in stream time base. + * Only set this if you are absolutely 100% sure that the value you set + * it to really is the pts of the first frame. + * This may be undefined (AV_NOPTS_VALUE). + */ + int64_t start_time; + + /** + * Decoding: duration of the stream, in stream time base. + * If a source file does not specify a duration, but does specify + * a bitrate, this value will be estimated from bitrate and file size. + */ + int64_t duration; + + int64_t nb_frames; ///< number of frames in this stream if known or 0 + + int disposition; /**< AV_DISPOSITION_* bit field */ + + enum AVDiscard discard; ///< Selects which packets can be discarded at will and do not need to be demuxed. + + /** + * sample aspect ratio (0 if unknown) + * - encoding: Set by user. + * - decoding: Set by libavformat. + */ + AVRational sample_aspect_ratio; + + AVDictionary *metadata; + + /** + * Average framerate + */ + AVRational avg_frame_rate; + + /** + * For streams with AV_DISPOSITION_ATTACHED_PIC disposition, this packet + * will contain the attached picture. + * + * decoding: set by libavformat, must not be modified by the caller. + * encoding: unused + */ + AVPacket attached_pic; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * Stream information used internally by av_find_stream_info() + */ +#define MAX_STD_TIMEBASES (60*12+5) + struct { + int nb_decoded_frames; + int found_decoder; + + /** + * Those are used for average framerate estimation. + */ + int64_t fps_first_dts; + int fps_first_dts_idx; + int64_t fps_last_dts; + int fps_last_dts_idx; + + } *info; + + int pts_wrap_bits; /**< number of bits in pts (used for wrapping control) */ + +#if FF_API_REFERENCE_DTS + /* a hack to keep ABI compatibility for avconv, which accesses parser even + * though it should not */ + int64_t do_not_use; +#endif + // Timestamp generation support: + int64_t first_dts; + int64_t cur_dts; + int64_t last_IP_pts; + int last_IP_duration; + + /** + * Number of packets to buffer for codec probing + */ +#define MAX_PROBE_PACKETS 2500 + int probe_packets; + + /** + * Number of frames that have been demuxed during av_find_stream_info() + */ + int codec_info_nb_frames; + + /* av_read_frame() support */ + enum AVStreamParseType need_parsing; + struct AVCodecParserContext *parser; + + /** + * last packet in packet_buffer for this stream when muxing. + */ + struct AVPacketList *last_in_packet_buffer; + AVProbeData probe_data; +#define MAX_REORDER_DELAY 16 + int64_t pts_buffer[MAX_REORDER_DELAY+1]; + + AVIndexEntry *index_entries; /**< Only used if the format does not + support seeking natively. */ + int nb_index_entries; + unsigned int index_entries_allocated_size; +} AVStream; + +#define AV_PROGRAM_RUNNING 1 + +/** + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVProgram) must not be used outside libav*. + */ +typedef struct AVProgram { + int id; + int flags; + enum AVDiscard discard; ///< selects which program to discard and which to feed to the caller + unsigned int *stream_index; + unsigned int nb_stream_indexes; + AVDictionary *metadata; +} AVProgram; + +#define AVFMTCTX_NOHEADER 0x0001 /**< signal that no header is present + (streams are added dynamically) */ + +typedef struct AVChapter { + int id; ///< unique ID to identify the chapter + AVRational time_base; ///< time base in which the start/end timestamps are specified + int64_t start, end; ///< chapter start/end time in time_base units + AVDictionary *metadata; +} AVChapter; + +typedef struct AVFormatInternal AVFormatInternal; + +/** + * Format I/O context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVFormatContext) must not be used outside libav*, use + * avformat_alloc_context() to create an AVFormatContext. + */ +typedef struct AVFormatContext { + /** + * A class for logging and @ref avoptions. Set by avformat_alloc_context(). + * Exports (de)muxer private options if they exist. + */ + const AVClass *av_class; + + /** + * The input container format. + * + * Demuxing only, set by avformat_open_input(). + */ + struct AVInputFormat *iformat; + + /** + * The output container format. + * + * Muxing only, must be set by the caller before avformat_write_header(). + */ + struct AVOutputFormat *oformat; + + /** + * Format private data. This is an AVOptions-enabled struct + * if and only if iformat/oformat.priv_class is not NULL. + * + * - muxing: set by avformat_write_header() + * - demuxing: set by avformat_open_input() + */ + void *priv_data; + + /** + * I/O context. + * + * - demuxing: either set by the user before avformat_open_input() (then + * the user must close it manually) or set by avformat_open_input(). + * - muxing: set by the user before avformat_write_header(). The caller must + * take care of closing / freeing the IO context. + * + * Do NOT set this field if AVFMT_NOFILE flag is set in + * iformat/oformat.flags. In such a case, the (de)muxer will handle + * I/O in some other way and this field will be NULL. + */ + AVIOContext *pb; + + /* stream info */ + int ctx_flags; /**< Format-specific flags, see AVFMTCTX_xx */ + + /** + * Number of elements in AVFormatContext.streams. + * + * Set by avformat_new_stream(), must not be modified by any other code. + */ + unsigned int nb_streams; + /** + * A list of all streams in the file. New streams are created with + * avformat_new_stream(). + * + * - demuxing: streams are created by libavformat in avformat_open_input(). + * If AVFMTCTX_NOHEADER is set in ctx_flags, then new streams may also + * appear in av_read_frame(). + * - muxing: streams are created by the user before avformat_write_header(). + * + * Freed by libavformat in avformat_free_context(). + */ + AVStream **streams; + + /** + * input or output filename + * + * - demuxing: set by avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + */ + char filename[1024]; + + /** + * Position of the first frame of the component, in + * AV_TIME_BASE fractional seconds. NEVER set this value directly: + * It is deduced from the AVStream values. + * + * Demuxing only, set by libavformat. + */ + int64_t start_time; + + /** + * Duration of the stream, in AV_TIME_BASE fractional + * seconds. Only set this value if you know none of the individual stream + * durations and also do not set any of them. This is deduced from the + * AVStream values if not set. + * + * Demuxing only, set by libavformat. + */ + int64_t duration; + + /** + * Total stream bitrate in bit/s, 0 if not + * available. Never set it directly if the file_size and the + * duration are known as Libav can compute it automatically. + */ + int bit_rate; + + unsigned int packet_size; + int max_delay; + + int flags; +#define AVFMT_FLAG_GENPTS 0x0001 ///< Generate missing pts even if it requires parsing future frames. +#define AVFMT_FLAG_IGNIDX 0x0002 ///< Ignore index. +#define AVFMT_FLAG_NONBLOCK 0x0004 ///< Do not block when reading packets from input. +#define AVFMT_FLAG_IGNDTS 0x0008 ///< Ignore DTS on frames that contain both DTS & PTS +#define AVFMT_FLAG_NOFILLIN 0x0010 ///< Do not infer any values from other values, just return what is stored in the container +#define AVFMT_FLAG_NOPARSE 0x0020 ///< Do not use AVParsers, you also must set AVFMT_FLAG_NOFILLIN as the fillin code works on frames and no parsing -> no frames. Also seeking to frames can not work if parsing to find frame boundaries has been disabled +#define AVFMT_FLAG_NOBUFFER 0x0040 ///< Do not buffer frames when possible +#define AVFMT_FLAG_CUSTOM_IO 0x0080 ///< The caller has supplied a custom AVIOContext, don't avio_close() it. +#define AVFMT_FLAG_DISCARD_CORRUPT 0x0100 ///< Discard frames marked corrupted +#define AVFMT_FLAG_FLUSH_PACKETS 0x0200 ///< Flush the AVIOContext every packet. + + /** + * Maximum size of the data read from input for determining + * the input container format. + * Demuxing only, set by the caller before avformat_open_input(). + */ + unsigned int probesize; + + /** + * Maximum duration (in AV_TIME_BASE units) of the data read + * from input in avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + */ + int max_analyze_duration; + + const uint8_t *key; + int keylen; + + unsigned int nb_programs; + AVProgram **programs; + + /** + * Forced video codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID video_codec_id; + + /** + * Forced audio codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID audio_codec_id; + + /** + * Forced subtitle codec_id. + * Demuxing: Set by user. + */ + enum AVCodecID subtitle_codec_id; + + /** + * Maximum amount of memory in bytes to use for the index of each stream. + * If the index exceeds this size, entries will be discarded as + * needed to maintain a smaller size. This can lead to slower or less + * accurate seeking (depends on demuxer). + * Demuxers for which a full in-memory index is mandatory will ignore + * this. + * - muxing: unused + * - demuxing: set by user + */ + unsigned int max_index_size; + + /** + * Maximum amount of memory in bytes to use for buffering frames + * obtained from realtime capture devices. + */ + unsigned int max_picture_buffer; + + /** + * Number of chapters in AVChapter array. + * When muxing, chapters are normally written in the file header, + * so nb_chapters should normally be initialized before write_header + * is called. Some muxers (e.g. mov and mkv) can also write chapters + * in the trailer. To write chapters in the trailer, nb_chapters + * must be zero when write_header is called and non-zero when + * write_trailer is called. + * - muxing: set by user + * - demuxing: set by libavformat + */ + unsigned int nb_chapters; + AVChapter **chapters; + + /** + * Metadata that applies to the whole file. + * + * - demuxing: set by libavformat in avformat_open_input() + * - muxing: may be set by the caller before avformat_write_header() + * + * Freed by libavformat in avformat_free_context(). + */ + AVDictionary *metadata; + + /** + * Start time of the stream in real world time, in microseconds + * since the Unix epoch (00:00 1st January 1970). That is, pts=0 in the + * stream was captured at this real world time. + * Muxing only, set by the caller before avformat_write_header(). + */ + int64_t start_time_realtime; + + /** + * The number of frames used for determining the framerate in + * avformat_find_stream_info(). + * Demuxing only, set by the caller before avformat_find_stream_info(). + */ + int fps_probe_size; + + /** + * Error recognition; higher values will detect more errors but may + * misdetect some more or less valid parts as errors. + * Demuxing only, set by the caller before avformat_open_input(). + */ + int error_recognition; + + /** + * Custom interrupt callbacks for the I/O layer. + * + * demuxing: set by the user before avformat_open_input(). + * muxing: set by the user before avformat_write_header() + * (mainly useful for AVFMT_NOFILE formats). The callback + * should also be passed to avio_open2() if it's used to + * open the file. + */ + AVIOInterruptCB interrupt_callback; + + /** + * Flags to enable debugging. + */ + int debug; +#define FF_FDEBUG_TS 0x0001 + + /** + * Maximum buffering duration for interleaving. + * + * To ensure all the streams are interleaved correctly, + * av_interleaved_write_frame() will wait until it has at least one packet + * for each stream before actually writing any packets to the output file. + * When some streams are "sparse" (i.e. there are large gaps between + * successive packets), this can result in excessive buffering. + * + * This field specifies the maximum difference between the timestamps of the + * first and the last packet in the muxing queue, above which libavformat + * will output a packet regardless of whether it has queued a packet for all + * the streams. + * + * Muxing only, set by the caller before avformat_write_header(). + */ + int64_t max_interleave_delta; + + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavformat and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + + /** + * This buffer is only needed when packets were already buffered but + * not decoded, for example to get the codec parameters in MPEG + * streams. + */ + struct AVPacketList *packet_buffer; + struct AVPacketList *packet_buffer_end; + + /* av_seek_frame() support */ + int64_t data_offset; /**< offset of the first packet */ + + /** + * Raw packets from the demuxer, prior to parsing and decoding. + * This buffer is used for buffering packets until the codec can + * be identified, as parsing cannot be done without knowing the + * codec. + */ + struct AVPacketList *raw_packet_buffer; + struct AVPacketList *raw_packet_buffer_end; + /** + * Packets split by the parser get queued here. + */ + struct AVPacketList *parse_queue; + struct AVPacketList *parse_queue_end; + /** + * Remaining size available for raw_packet_buffer, in bytes. + */ +#define RAW_PACKET_BUFFER_SIZE 2500000 + int raw_packet_buffer_remaining_size; + + /** + * Offset to remap timestamps to be non-negative. + * Expressed in timebase units. + */ + int64_t offset; + + /** + * Timebase for the timestamp offset. + */ + AVRational offset_timebase; + + /** + * An opaque field for libavformat internal usage. + * Must not be accessed in any way by callers. + */ + AVFormatInternal *internal; +} AVFormatContext; + +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; + + +/** + * @defgroup lavf_core Core functions + * @ingroup libavf + * + * Functions for querying libavformat capabilities, allocating core structures, + * etc. + * @{ + */ + +/** + * Return the LIBAVFORMAT_VERSION_INT constant. + */ +unsigned avformat_version(void); + +/** + * Return the libavformat build-time configuration. + */ +const char *avformat_configuration(void); + +/** + * Return the libavformat license. + */ +const char *avformat_license(void); + +/** + * Initialize libavformat and register all the muxers, demuxers and + * protocols. If you do not call this function, then you can select + * exactly which formats you want to support. + * + * @see av_register_input_format() + * @see av_register_output_format() + * @see av_register_protocol() + */ +void av_register_all(void); + +void av_register_input_format(AVInputFormat *format); +void av_register_output_format(AVOutputFormat *format); + +/** + * Do global initialization of network components. This is optional, + * but recommended, since it avoids the overhead of implicitly + * doing the setup for each session. + * + * Calling this function will become mandatory if using network + * protocols at some major version bump. + */ +int avformat_network_init(void); + +/** + * Undo the initialization done by avformat_network_init. + */ +int avformat_network_deinit(void); + +/** + * If f is NULL, returns the first registered input format, + * if f is non-NULL, returns the next registered input format after f + * or NULL if f is the last one. + */ +AVInputFormat *av_iformat_next(AVInputFormat *f); + +/** + * If f is NULL, returns the first registered output format, + * if f is non-NULL, returns the next registered output format after f + * or NULL if f is the last one. + */ +AVOutputFormat *av_oformat_next(AVOutputFormat *f); + +/** + * Allocate an AVFormatContext. + * avformat_free_context() can be used to free the context and everything + * allocated by the framework within it. + */ +AVFormatContext *avformat_alloc_context(void); + +/** + * Free an AVFormatContext and all its streams. + * @param s context to free + */ +void avformat_free_context(AVFormatContext *s); + +/** + * Get the AVClass for AVFormatContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avformat_get_class(void); + +/** + * Add a new stream to a media file. + * + * When demuxing, it is called by the demuxer in read_header(). If the + * flag AVFMTCTX_NOHEADER is set in s.ctx_flags, then it may also + * be called in read_packet(). + * + * When muxing, should be called by the user before avformat_write_header(). + * + * @param s media file handle + * @param c If non-NULL, the AVCodecContext corresponding to the new stream + * will be initialized to use this codec. This is needed for e.g. codec-specific + * defaults to be set, so codec should be provided if it is known. + * + * @return newly created stream or NULL on error. + */ +AVStream *avformat_new_stream(AVFormatContext *s, AVCodec *c); + +AVProgram *av_new_program(AVFormatContext *s, int id); + +/** + * @} + */ + + +/** + * @addtogroup lavf_decoding + * @{ + */ + +/** + * Find AVInputFormat based on the short name of the input format. + */ +AVInputFormat *av_find_input_format(const char *short_name); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + */ +AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened); + +/** + * Guess the file format. + * + * @param pd data to be probed + * @param is_opened Whether the file is already opened; determines whether + * demuxers with or without AVFMT_NOFILE are probed. + * @param score_max A probe score larger that this is required to accept a + * detection, the variable is set to the actual detection + * score afterwards. + * If the score is <= AVPROBE_SCORE_MAX / 4 it is recommended + * to retry with a larger probe buffer. + */ +AVInputFormat *av_probe_input_format2(AVProbeData *pd, int is_opened, int *score_max); + +/** + * Probe a bytestream to determine the input format. Each time a probe returns + * with a score that is too low, the probe buffer size is increased and another + * attempt is made. When the maximum probe size is reached, the input format + * with the highest score is returned. + * + * @param pb the bytestream to probe + * @param fmt the input format is put here + * @param filename the filename of the stream + * @param logctx the log context + * @param offset the offset within the bytestream to probe from + * @param max_probe_size the maximum probe buffer size (zero for default) + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_probe_input_buffer(AVIOContext *pb, AVInputFormat **fmt, + const char *filename, void *logctx, + unsigned int offset, unsigned int max_probe_size); + +/** + * Open an input stream and read the header. The codecs are not opened. + * The stream must be closed with avformat_close_input(). + * + * @param ps Pointer to user-supplied AVFormatContext (allocated by avformat_alloc_context). + * May be a pointer to NULL, in which case an AVFormatContext is allocated by this + * function and written into ps. + * Note that a user-supplied AVFormatContext will be freed on failure. + * @param filename Name of the stream to open. + * @param fmt If non-NULL, this parameter forces a specific input format. + * Otherwise the format is autodetected. + * @param options A dictionary filled with AVFormatContext and demuxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, a negative AVERROR on failure. + * + * @note If you want to use custom IO, preallocate the format context and set its pb field. + */ +int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options); + +/** + * Read packets of a media file to get stream information. This + * is useful for file formats with no headers such as MPEG. This + * function also computes the real framerate in case of MPEG-2 repeat + * frame mode. + * The logical file position is not changed by this function; + * examined packets may be buffered for later processing. + * + * @param ic media file handle + * @param options If non-NULL, an ic.nb_streams long array of pointers to + * dictionaries, where i-th member contains options for + * codec corresponding to i-th stream. + * On return each dictionary will be filled with options that were not found. + * @return >=0 if OK, AVERROR_xxx on error + * + * @note this function isn't guaranteed to open all the codecs, so + * options being non-empty at return is a perfectly normal behavior. + * + * @todo Let the user decide somehow what information is needed so that + * we do not waste time getting stuff the user does not need. + */ +int avformat_find_stream_info(AVFormatContext *ic, AVDictionary **options); + +/** + * Find the "best" stream in the file. + * The best stream is determined according to various heuristics as the most + * likely to be what the user expects. + * If the decoder parameter is non-NULL, av_find_best_stream will find the + * default decoder for the stream's codec; streams for which no decoder can + * be found are ignored. + * + * @param ic media file handle + * @param type stream type: video, audio, subtitles, etc. + * @param wanted_stream_nb user-requested stream number, + * or -1 for automatic selection + * @param related_stream try to find a stream related (eg. in the same + * program) to this one, or -1 if none + * @param decoder_ret if non-NULL, returns the decoder for the + * selected stream + * @param flags flags; none are currently defined + * @return the non-negative stream number in case of success, + * AVERROR_STREAM_NOT_FOUND if no stream with the requested type + * could be found, + * AVERROR_DECODER_NOT_FOUND if streams were found but no decoder + * @note If av_find_best_stream returns successfully and decoder_ret is not + * NULL, then *decoder_ret is guaranteed to be set to a valid AVCodec. + */ +int av_find_best_stream(AVFormatContext *ic, + enum AVMediaType type, + int wanted_stream_nb, + int related_stream, + AVCodec **decoder_ret, + int flags); + +/** + * Return the next frame of a stream. + * This function returns what is stored in the file, and does not validate + * that what is there are valid frames for the decoder. It will split what is + * stored in the file into frames and return one for each call. It will not + * omit invalid data between valid frames so as to give the decoder the maximum + * information possible for decoding. + * + * If pkt->buf is NULL, then the packet is valid until the next + * av_read_frame() or until avformat_close_input(). Otherwise the packet + * is valid indefinitely. In both cases the packet must be freed with + * av_free_packet when it is no longer needed. For video, the packet contains + * exactly one frame. For audio, it contains an integer number of frames if each + * frame has a known fixed size (e.g. PCM or ADPCM data). If the audio frames + * have a variable size (e.g. MPEG audio), then it contains one frame. + * + * pkt->pts, pkt->dts and pkt->duration are always set to correct + * values in AVStream.time_base units (and guessed if the format cannot + * provide them). pkt->pts can be AV_NOPTS_VALUE if the video format + * has B-frames, so it is better to rely on pkt->dts if you do not + * decompress the payload. + * + * @return 0 if OK, < 0 on error or end of file + */ +int av_read_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Seek to the keyframe at timestamp. + * 'timestamp' in 'stream_index'. + * + * @param s media file handle + * @param stream_index If stream_index is (-1), a default + * stream is selected, and timestamp is automatically converted + * from AV_TIME_BASE units to the stream specific time_base. + * @param timestamp Timestamp in AVStream.time_base units + * or, if no stream is specified, in AV_TIME_BASE units. + * @param flags flags which select direction and seeking mode + * @return >= 0 on success + */ +int av_seek_frame(AVFormatContext *s, int stream_index, int64_t timestamp, + int flags); + +/** + * Seek to timestamp ts. + * Seeking will be done so that the point from which all active streams + * can be presented successfully will be closest to ts and within min/max_ts. + * Active streams are all streams that have AVStream.discard < AVDISCARD_ALL. + * + * If flags contain AVSEEK_FLAG_BYTE, then all timestamps are in bytes and + * are the file position (this may not be supported by all demuxers). + * If flags contain AVSEEK_FLAG_FRAME, then all timestamps are in frames + * in the stream with stream_index (this may not be supported by all demuxers). + * Otherwise all timestamps are in units of the stream selected by stream_index + * or if stream_index is -1, in AV_TIME_BASE units. + * If flags contain AVSEEK_FLAG_ANY, then non-keyframes are treated as + * keyframes (this may not be supported by all demuxers). + * + * @param s media file handle + * @param stream_index index of the stream which is used as time base reference + * @param min_ts smallest acceptable timestamp + * @param ts target timestamp + * @param max_ts largest acceptable timestamp + * @param flags flags + * @return >=0 on success, error code otherwise + * + * @note This is part of the new seek API which is still under construction. + * Thus do not use this yet. It may change at any time, do not expect + * ABI compatibility yet! + */ +int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int64_t ts, int64_t max_ts, int flags); + +/** + * Start playing a network-based stream (e.g. RTSP stream) at the + * current position. + */ +int av_read_play(AVFormatContext *s); + +/** + * Pause a network-based stream (e.g. RTSP stream). + * + * Use av_read_play() to resume it. + */ +int av_read_pause(AVFormatContext *s); + +/** + * Close an opened input AVFormatContext. Free it and all its contents + * and set *s to NULL. + */ +void avformat_close_input(AVFormatContext **s); +/** + * @} + */ + +#define AVSEEK_FLAG_BACKWARD 1 ///< seek backward +#define AVSEEK_FLAG_BYTE 2 ///< seeking based on position in bytes +#define AVSEEK_FLAG_ANY 4 ///< seek to any frame, even non-keyframes +#define AVSEEK_FLAG_FRAME 8 ///< seeking based on frame number + +/** + * @addtogroup lavf_encoding + * @{ + */ +/** + * Allocate the stream private data and write the stream header to + * an output media file. + * + * @param s Media file handle, must be allocated with avformat_alloc_context(). + * Its oformat field must be set to the desired output format; + * Its pb field must be set to an already opened AVIOContext. + * @param options An AVDictionary filled with AVFormatContext and muxer-private options. + * On return this parameter will be destroyed and replaced with a dict containing + * options that were not found. May be NULL. + * + * @return 0 on success, negative AVERROR on failure. + * + * @see av_opt_find, av_dict_set, avio_open, av_oformat_next. + */ +int avformat_write_header(AVFormatContext *s, AVDictionary **options); + +/** + * Write a packet to an output media file. + * + * This function passes the packet directly to the muxer, without any buffering + * or reordering. The caller is responsible for correctly interleaving the + * packets if the format requires it. Callers that want libavformat to handle + * the interleaving should call av_interleaved_write_frame() instead of this + * function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. Note that unlike + * av_interleaved_write_frame(), this function does not take + * ownership of the packet passed to it (though some muxers may make + * an internal reference to the input packet). + *
+ * This parameter can be NULL (at any time, not just at the end), in + * order to immediately flush data buffered within the muxer, for + * muxers that buffer up data internally before writing it to the + * output. + *
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". It is very strongly + * recommended that timing information (@ref AVPacket.pts "pts", @ref + * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to + * correct values. + * @return < 0 on error, = 0 if OK, 1 if flushed and there is no more data to flush + * + * @see av_interleaved_write_frame() + */ +int av_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write a packet to an output media file ensuring correct interleaving. + * + * This function will buffer the packets internally as needed to make sure the + * packets in the output file are properly interleaved in the order of + * increasing dts. Callers doing their own interleaving should call + * av_write_frame() instead of this function. + * + * @param s media file handle + * @param pkt The packet containing the data to be written. + *
+ * If the packet is reference-counted, this function will take + * ownership of this reference and unreference it later when it sees + * fit. + * The caller must not access the data through this reference after + * this function returns. If the packet is not reference-counted, + * libavformat will make a copy. + *
+ * This parameter can be NULL (at any time, not just at the end), to + * flush the interleaving queues. + *
+ * Packet's @ref AVPacket.stream_index "stream_index" field must be + * set to the index of the corresponding stream in @ref + * AVFormatContext.streams "s->streams". It is very strongly + * recommended that timing information (@ref AVPacket.pts "pts", @ref + * AVPacket.dts "dts", @ref AVPacket.duration "duration") is set to + * correct values. + * + * @return 0 on success, a negative AVERROR on error. Libavformat will always + * take care of freeing the packet, even if this function fails. + * + * @see av_write_frame(), AVFormatContext.max_interleave_delta + */ +int av_interleaved_write_frame(AVFormatContext *s, AVPacket *pkt); + +/** + * Write the stream trailer to an output media file and free the + * file private data. + * + * May only be called after a successful call to avformat_write_header. + * + * @param s media file handle + * @return 0 if OK, AVERROR_xxx on error + */ +int av_write_trailer(AVFormatContext *s); + +/** + * Return the output format in the list of registered output formats + * which best matches the provided parameters, or return NULL if + * there is no match. + * + * @param short_name if non-NULL checks if short_name matches with the + * names of the registered formats + * @param filename if non-NULL checks if filename terminates with the + * extensions of the registered formats + * @param mime_type if non-NULL checks if mime_type matches with the + * MIME type of the registered formats + */ +AVOutputFormat *av_guess_format(const char *short_name, + const char *filename, + const char *mime_type); + +/** + * Guess the codec ID based upon muxer and filename. + */ +enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name, + const char *filename, const char *mime_type, + enum AVMediaType type); + +/** + * @} + */ + + +/** + * @defgroup lavf_misc Utility functions + * @ingroup libavf + * @{ + * + * Miscellaneous utility functions related to both muxing and demuxing + * (or neither). + */ + +/** + * Send a nice hexadecimal dump of a buffer to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump_log, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump(FILE *f, const uint8_t *buf, int size); + +/** + * Send a nice hexadecimal dump of a buffer to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param buf buffer + * @param size buffer size + * + * @see av_hex_dump, av_pkt_dump2, av_pkt_dump_log2 + */ +void av_hex_dump_log(void *avcl, int level, const uint8_t *buf, int size); + +/** + * Send a nice dump of a packet to the specified file stream. + * + * @param f The file stream pointer where the dump should be sent to. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump2(FILE *f, AVPacket *pkt, int dump_payload, AVStream *st); + + +/** + * Send a nice dump of a packet to the log. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message, lower values signifying + * higher importance. + * @param pkt packet to dump + * @param dump_payload True if the payload must be displayed, too. + * @param st AVStream that the packet belongs to + */ +void av_pkt_dump_log2(void *avcl, int level, AVPacket *pkt, int dump_payload, + AVStream *st); + +/** + * Get the AVCodecID for the given codec tag tag. + * If no codec id is found returns AV_CODEC_ID_NONE. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param tag codec tag to match to a codec ID + */ +enum AVCodecID av_codec_get_id(const struct AVCodecTag * const *tags, unsigned int tag); + +/** + * Get the codec tag for the given codec id id. + * If no codec tag is found returns 0. + * + * @param tags list of supported codec_id-codec_tag pairs, as stored + * in AVInputFormat.codec_tag and AVOutputFormat.codec_tag + * @param id codec ID to match to a codec tag + */ +unsigned int av_codec_get_tag(const struct AVCodecTag * const *tags, enum AVCodecID id); + +int av_find_default_stream_index(AVFormatContext *s); + +/** + * Get the index for a specific timestamp. + * + * @param st stream that the timestamp belongs to + * @param timestamp timestamp to retrieve the index for + * @param flags if AVSEEK_FLAG_BACKWARD then the returned index will correspond + * to the timestamp which is <= the requested one, if backward + * is 0, then it will be >= + * if AVSEEK_FLAG_ANY seek to any frame, only keyframes otherwise + * @return < 0 if no such timestamp could be found + */ +int av_index_search_timestamp(AVStream *st, int64_t timestamp, int flags); + +/** + * Add an index entry into a sorted list. Update the entry if the list + * already contains it. + * + * @param timestamp timestamp in the time base of the given stream + */ +int av_add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, + int size, int distance, int flags); + + +/** + * Split a URL string into components. + * + * The pointers to buffers for storing individual components may be null, + * in order to ignore that component. Buffers for components not found are + * set to empty strings. If the port is not found, it is set to a negative + * value. + * + * @param proto the buffer for the protocol + * @param proto_size the size of the proto buffer + * @param authorization the buffer for the authorization + * @param authorization_size the size of the authorization buffer + * @param hostname the buffer for the host name + * @param hostname_size the size of the hostname buffer + * @param port_ptr a pointer to store the port number in + * @param path the buffer for the path + * @param path_size the size of the path buffer + * @param url the URL to split + */ +void av_url_split(char *proto, int proto_size, + char *authorization, int authorization_size, + char *hostname, int hostname_size, + int *port_ptr, + char *path, int path_size, + const char *url); + + +void av_dump_format(AVFormatContext *ic, + int index, + const char *url, + int is_output); + +/** + * Return in 'buf' the path with '%d' replaced by a number. + * + * Also handles the '%0nd' format where 'n' is the total number + * of digits and '%%'. + * + * @param buf destination buffer + * @param buf_size destination buffer size + * @param path numbered sequence string + * @param number frame number + * @return 0 if OK, -1 on format error + */ +int av_get_frame_filename(char *buf, int buf_size, + const char *path, int number); + +/** + * Check whether filename actually is a numbered sequence generator. + * + * @param filename possible numbered sequence string + * @return 1 if a valid numbered sequence string, 0 otherwise + */ +int av_filename_number_test(const char *filename); + +/** + * Generate an SDP for an RTP session. + * + * Note, this overwrites the id values of AVStreams in the muxer contexts + * for getting unique dynamic payload types. + * + * @param ac array of AVFormatContexts describing the RTP streams. If the + * array is composed by only one context, such context can contain + * multiple AVStreams (one AVStream per RTP stream). Otherwise, + * all the contexts in the array (an AVCodecContext per RTP stream) + * must contain only one AVStream. + * @param n_files number of AVCodecContexts contained in ac + * @param buf buffer where the SDP will be stored (must be allocated by + * the caller) + * @param size the size of the buffer + * @return 0 if OK, AVERROR_xxx on error + */ +int av_sdp_create(AVFormatContext *ac[], int n_files, char *buf, int size); + +/** + * Return a positive value if the given filename has one of the given + * extensions, 0 otherwise. + * + * @param filename file name to check against the given extensions + * @param extensions a comma-separated list of filename extensions + */ +int av_match_ext(const char *filename, const char *extensions); + +/** + * Test if the given container can store a codec. + * + * @param ofmt container to check for compatibility + * @param codec_id codec to potentially store in container + * @param std_compliance standards compliance level, one of FF_COMPLIANCE_* + * + * @return 1 if codec with ID codec_id can be stored in ofmt, 0 if it cannot. + * A negative number if this information is not available. + */ +int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance); + +/** + * @defgroup riff_fourcc RIFF FourCCs + * @{ + * Get the tables mapping RIFF FourCCs to libavcodec AVCodecIDs. The tables are + * meant to be passed to av_codec_get_id()/av_codec_get_tag() as in the + * following code: + * @code + * uint32_t tag = MKTAG('H', '2', '6', '4'); + * const struct AVCodecTag *table[] = { avformat_get_riff_video_tags(), 0 }; + * enum AVCodecID id = av_codec_get_id(table, tag); + * @endcode + */ +/** + * @return the table mapping RIFF FourCCs for video to libavcodec AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_video_tags(void); +/** + * @return the table mapping RIFF FourCCs for audio to AVCodecID. + */ +const struct AVCodecTag *avformat_get_riff_audio_tags(void); +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVFORMAT_AVFORMAT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavformat/avio.h b/content/media/fmp4/ffmpeg/libav55/include/libavformat/avio.h new file mode 100644 index 000000000000..3360e8296e85 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavformat/avio.h @@ -0,0 +1,439 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef AVFORMAT_AVIO_H +#define AVFORMAT_AVIO_H + +/** + * @file + * @ingroup lavf_io + * Buffered I/O operations + */ + +#include + +#include "libavutil/common.h" +#include "libavutil/dict.h" +#include "libavutil/log.h" + +#include "libavformat/version.h" + + +#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */ + +/** + * Callback for checking whether to abort blocking functions. + * AVERROR_EXIT is returned in this case by the interrupted + * function. During blocking operations, callback is called with + * opaque as parameter. If the callback returns 1, the + * blocking operation will be aborted. + * + * No members can be added to this struct without a major bump, if + * new elements have been added after this struct in AVFormatContext + * or AVIOContext. + */ +typedef struct AVIOInterruptCB { + int (*callback)(void*); + void *opaque; +} AVIOInterruptCB; + +/** + * Bytestream IO Context. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * sizeof(AVIOContext) must not be used outside libav*. + * + * @note None of the function pointers in AVIOContext should be called + * directly, they should only be set by the client application + * when implementing custom I/O. Normally these are set to the + * function pointers specified in avio_alloc_context() + */ +typedef struct AVIOContext { + /** + * A class for private options. + * + * If this AVIOContext is created by avio_open2(), av_class is set and + * passes the options down to protocols. + * + * If this AVIOContext is manually allocated, then av_class may be set by + * the caller. + * + * warning -- this field can be NULL, be sure to not pass this AVIOContext + * to any av_opt_* functions in that case. + */ + const AVClass *av_class; + unsigned char *buffer; /**< Start of the buffer. */ + int buffer_size; /**< Maximum buffer size */ + unsigned char *buf_ptr; /**< Current position in the buffer */ + unsigned char *buf_end; /**< End of the data, may be less than + buffer+buffer_size if the read function returned + less data than requested, e.g. for streams where + no more data has been received yet. */ + void *opaque; /**< A private pointer, passed to the read/write/seek/... + functions. */ + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size); + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size); + int64_t (*seek)(void *opaque, int64_t offset, int whence); + int64_t pos; /**< position in the file of the current buffer */ + int must_flush; /**< true if the next seek should flush */ + int eof_reached; /**< true if eof reached */ + int write_flag; /**< true if open for writing */ + int max_packet_size; + unsigned long checksum; + unsigned char *checksum_ptr; + unsigned long (*update_checksum)(unsigned long checksum, const uint8_t *buf, unsigned int size); + int error; /**< contains the error code or 0 if no error happened */ + /** + * Pause or resume playback for network streaming protocols - e.g. MMS. + */ + int (*read_pause)(void *opaque, int pause); + /** + * Seek to a given timestamp in stream with the specified stream_index. + * Needed for some network streaming protocols which don't support seeking + * to byte position. + */ + int64_t (*read_seek)(void *opaque, int stream_index, + int64_t timestamp, int flags); + /** + * A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable. + */ + int seekable; +} AVIOContext; + +/* unbuffered I/O */ + +/** + * Return AVIO_FLAG_* access flags corresponding to the access permissions + * of the resource in url, or a negative value corresponding to an + * AVERROR code in case of failure. The returned access flags are + * masked by the value in flags. + * + * @note This function is intrinsically unsafe, in the sense that the + * checked resource may change its existence or permission status from + * one call to another. Thus you should not trust the returned value, + * unless you are sure that no other processes are accessing the + * checked resource. + */ +int avio_check(const char *url, int flags); + +/** + * Allocate and initialize an AVIOContext for buffered I/O. It must be later + * freed with av_free(). + * + * @param buffer Memory block for input/output operations via AVIOContext. + * The buffer must be allocated with av_malloc() and friends. + * @param buffer_size The buffer size is very important for performance. + * For protocols with fixed blocksize it should be set to this blocksize. + * For others a typical size is a cache page, e.g. 4kb. + * @param write_flag Set to 1 if the buffer should be writable, 0 otherwise. + * @param opaque An opaque pointer to user-specific data. + * @param read_packet A function for refilling the buffer, may be NULL. + * @param write_packet A function for writing the buffer contents, may be NULL. + * @param seek A function for seeking to specified byte position, may be NULL. + * + * @return Allocated AVIOContext or NULL on failure. + */ +AVIOContext *avio_alloc_context( + unsigned char *buffer, + int buffer_size, + int write_flag, + void *opaque, + int (*read_packet)(void *opaque, uint8_t *buf, int buf_size), + int (*write_packet)(void *opaque, uint8_t *buf, int buf_size), + int64_t (*seek)(void *opaque, int64_t offset, int whence)); + +void avio_w8(AVIOContext *s, int b); +void avio_write(AVIOContext *s, const unsigned char *buf, int size); +void avio_wl64(AVIOContext *s, uint64_t val); +void avio_wb64(AVIOContext *s, uint64_t val); +void avio_wl32(AVIOContext *s, unsigned int val); +void avio_wb32(AVIOContext *s, unsigned int val); +void avio_wl24(AVIOContext *s, unsigned int val); +void avio_wb24(AVIOContext *s, unsigned int val); +void avio_wl16(AVIOContext *s, unsigned int val); +void avio_wb16(AVIOContext *s, unsigned int val); + +/** + * Write a NULL-terminated string. + * @return number of bytes written. + */ +int avio_put_str(AVIOContext *s, const char *str); + +/** + * Convert an UTF-8 string to UTF-16LE and write it. + * @return number of bytes written. + */ +int avio_put_str16le(AVIOContext *s, const char *str); + +/** + * Passing this as the "whence" parameter to a seek function causes it to + * return the filesize without seeking anywhere. Supporting this is optional. + * If it is not supported then the seek function will return <0. + */ +#define AVSEEK_SIZE 0x10000 + +/** + * Oring this flag as into the "whence" parameter to a seek function causes it to + * seek by any means (like reopening and linear reading) or other normally unreasonble + * means that can be extreemly slow. + * This may be ignored by the seek code. + */ +#define AVSEEK_FORCE 0x20000 + +/** + * fseek() equivalent for AVIOContext. + * @return new position or AVERROR. + */ +int64_t avio_seek(AVIOContext *s, int64_t offset, int whence); + +/** + * Skip given number of bytes forward + * @return new position or AVERROR. + */ +static av_always_inline int64_t avio_skip(AVIOContext *s, int64_t offset) +{ + return avio_seek(s, offset, SEEK_CUR); +} + +/** + * ftell() equivalent for AVIOContext. + * @return position or AVERROR. + */ +static av_always_inline int64_t avio_tell(AVIOContext *s) +{ + return avio_seek(s, 0, SEEK_CUR); +} + +/** + * Get the filesize. + * @return filesize or AVERROR + */ +int64_t avio_size(AVIOContext *s); + +/** @warning currently size is limited */ +int avio_printf(AVIOContext *s, const char *fmt, ...) av_printf_format(2, 3); + +void avio_flush(AVIOContext *s); + + +/** + * Read size bytes from AVIOContext into buf. + * @return number of bytes read or AVERROR + */ +int avio_read(AVIOContext *s, unsigned char *buf, int size); + +/** + * @name Functions for reading from AVIOContext + * @{ + * + * @note return 0 if EOF, so you cannot use it if EOF handling is + * necessary + */ +int avio_r8 (AVIOContext *s); +unsigned int avio_rl16(AVIOContext *s); +unsigned int avio_rl24(AVIOContext *s); +unsigned int avio_rl32(AVIOContext *s); +uint64_t avio_rl64(AVIOContext *s); +unsigned int avio_rb16(AVIOContext *s); +unsigned int avio_rb24(AVIOContext *s); +unsigned int avio_rb32(AVIOContext *s); +uint64_t avio_rb64(AVIOContext *s); +/** + * @} + */ + +/** + * Read a string from pb into buf. The reading will terminate when either + * a NULL character was encountered, maxlen bytes have been read, or nothing + * more can be read from pb. The result is guaranteed to be NULL-terminated, it + * will be truncated if buf is too small. + * Note that the string is not interpreted or validated in any way, it + * might get truncated in the middle of a sequence for multi-byte encodings. + * + * @return number of bytes read (is always <= maxlen). + * If reading ends on EOF or error, the return value will be one more than + * bytes actually read. + */ +int avio_get_str(AVIOContext *pb, int maxlen, char *buf, int buflen); + +/** + * Read a UTF-16 string from pb and convert it to UTF-8. + * The reading will terminate when either a null or invalid character was + * encountered or maxlen bytes have been read. + * @return number of bytes read (is always <= maxlen) + */ +int avio_get_str16le(AVIOContext *pb, int maxlen, char *buf, int buflen); +int avio_get_str16be(AVIOContext *pb, int maxlen, char *buf, int buflen); + + +/** + * @name URL open modes + * The flags argument to avio_open must be one of the following + * constants, optionally ORed with other flags. + * @{ + */ +#define AVIO_FLAG_READ 1 /**< read-only */ +#define AVIO_FLAG_WRITE 2 /**< write-only */ +#define AVIO_FLAG_READ_WRITE (AVIO_FLAG_READ|AVIO_FLAG_WRITE) /**< read-write pseudo flag */ +/** + * @} + */ + +/** + * Use non-blocking mode. + * If this flag is set, operations on the context will return + * AVERROR(EAGAIN) if they can not be performed immediately. + * If this flag is not set, operations on the context will never return + * AVERROR(EAGAIN). + * Note that this flag does not affect the opening/connecting of the + * context. Connecting a protocol will always block if necessary (e.g. on + * network protocols) but never hang (e.g. on busy devices). + * Warning: non-blocking protocols is work-in-progress; this flag may be + * silently ignored. + */ +#define AVIO_FLAG_NONBLOCK 8 + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open(AVIOContext **s, const char *url, int flags); + +/** + * Create and initialize a AVIOContext for accessing the + * resource indicated by url. + * @note When the resource indicated by url has been opened in + * read+write mode, the AVIOContext can be used only for writing. + * + * @param s Used to return the pointer to the created AVIOContext. + * In case of failure the pointed to value is set to NULL. + * @param url resource to access + * @param flags flags which control how the resource indicated by url + * is to be opened + * @param int_cb an interrupt callback to be used at the protocols level + * @param options A dictionary filled with protocol-private options. On return + * this parameter will be destroyed and replaced with a dict containing options + * that were not found. May be NULL. + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code in case of failure + */ +int avio_open2(AVIOContext **s, const char *url, int flags, + const AVIOInterruptCB *int_cb, AVDictionary **options); + +/** + * Close the resource accessed by the AVIOContext s and free it. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_closep + */ +int avio_close(AVIOContext *s); + +/** + * Close the resource accessed by the AVIOContext *s, free it + * and set the pointer pointing to it to NULL. + * This function can only be used if s was opened by avio_open(). + * + * The internal buffer is automatically flushed before closing the + * resource. + * + * @return 0 on success, an AVERROR < 0 on error. + * @see avio_close + */ +int avio_closep(AVIOContext **s); + + +/** + * Open a write only memory stream. + * + * @param s new IO context + * @return zero if no error. + */ +int avio_open_dyn_buf(AVIOContext **s); + +/** + * Return the written size and a pointer to the buffer. The buffer + * must be freed with av_free(). + * Padding of FF_INPUT_BUFFER_PADDING_SIZE is added to the buffer. + * + * @param s IO context + * @param pbuffer pointer to a byte buffer + * @return the length of the byte buffer + */ +int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer); + +/** + * Iterate through names of available protocols. + * + * @param opaque A private pointer representing current protocol. + * It must be a pointer to NULL on first iteration and will + * be updated by successive calls to avio_enum_protocols. + * @param output If set to 1, iterate over output protocols, + * otherwise over input protocols. + * + * @return A static string containing the name of current protocol or NULL + */ +const char *avio_enum_protocols(void **opaque, int output); + +/** + * Pause and resume playing - only meaningful if using a network streaming + * protocol (e.g. MMS). + * + * @param h IO context from which to call the read_pause function pointer + * @param pause 1 for pause, 0 for resume + */ +int avio_pause(AVIOContext *h, int pause); + +/** + * Seek to a given timestamp relative to some component stream. + * Only meaningful if using a network streaming protocol (e.g. MMS.). + * + * @param h IO context from which to call the seek function pointers + * @param stream_index The stream index that the timestamp is relative to. + * If stream_index is (-1) the timestamp should be in AV_TIME_BASE + * units from the beginning of the presentation. + * If a stream_index >= 0 is used and the protocol does not support + * seeking based on component streams, the call will fail with ENOTSUP. + * @param timestamp timestamp in AVStream.time_base units + * or if there is no stream specified then in AV_TIME_BASE units. + * @param flags Optional combination of AVSEEK_FLAG_BACKWARD, AVSEEK_FLAG_BYTE + * and AVSEEK_FLAG_ANY. The protocol may silently ignore + * AVSEEK_FLAG_BACKWARD and AVSEEK_FLAG_ANY, but AVSEEK_FLAG_BYTE will + * fail with ENOTSUP if used and not supported. + * @return >= 0 on success + * @see AVInputFormat::read_seek + */ +int64_t avio_seek_time(AVIOContext *h, int stream_index, + int64_t timestamp, int flags); + +#endif /* AVFORMAT_AVIO_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavformat/version.h b/content/media/fmp4/ffmpeg/libav55/include/libavformat/version.h new file mode 100644 index 000000000000..3d1e21f17b83 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavformat/version.h @@ -0,0 +1,55 @@ +/* + * Version macros. + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVFORMAT_VERSION_H +#define AVFORMAT_VERSION_H + +/** + * @file + * @ingroup libavf + * Libavformat version macros + */ + +#include "libavutil/version.h" + +#define LIBAVFORMAT_VERSION_MAJOR 55 +#define LIBAVFORMAT_VERSION_MINOR 12 +#define LIBAVFORMAT_VERSION_MICRO 0 + +#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_VERSION AV_VERSION(LIBAVFORMAT_VERSION_MAJOR, \ + LIBAVFORMAT_VERSION_MINOR, \ + LIBAVFORMAT_VERSION_MICRO) +#define LIBAVFORMAT_BUILD LIBAVFORMAT_VERSION_INT + +#define LIBAVFORMAT_IDENT "Lavf" AV_STRINGIFY(LIBAVFORMAT_VERSION) + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + */ +#ifndef FF_API_REFERENCE_DTS +#define FF_API_REFERENCE_DTS (LIBAVFORMAT_VERSION_MAJOR < 56) +#endif + +#endif /* AVFORMAT_VERSION_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/adler32.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/adler32.h new file mode 100644 index 000000000000..a8ff6f9d41c2 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/adler32.h @@ -0,0 +1,43 @@ +/* + * copyright (c) 2006 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_ADLER32_H +#define AVUTIL_ADLER32_H + +#include +#include "attributes.h" + +/** + * @ingroup lavu_crypto + * Calculate the Adler32 checksum of a buffer. + * + * Passing the return value to a subsequent av_adler32_update() call + * allows the checksum of multiple buffers to be calculated as though + * they were concatenated. + * + * @param adler initial checksum value + * @param buf pointer to input buffer + * @param len size of input buffer + * @return updated checksum + */ +unsigned long av_adler32_update(unsigned long adler, const uint8_t *buf, + unsigned int len) av_pure; + +#endif /* AVUTIL_ADLER32_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/aes.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/aes.h new file mode 100644 index 000000000000..edff275b7ad8 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/aes.h @@ -0,0 +1,67 @@ +/* + * copyright (c) 2007 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AES_H +#define AVUTIL_AES_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_aes AES + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_aes_size; +#endif + +struct AVAES; + +/** + * Allocate an AVAES context. + */ +struct AVAES *av_aes_alloc(void); + +/** + * Initialize an AVAES context. + * @param key_bits 128, 192 or 256 + * @param decrypt 0 for encryption, 1 for decryption + */ +int av_aes_init(struct AVAES *a, const uint8_t *key, int key_bits, int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * @param count number of 16 byte blocks + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_aes_crypt(struct AVAES *a, uint8_t *dst, const uint8_t *src, int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_AES_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/attributes.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/attributes.h new file mode 100644 index 000000000000..d7f2bb5c6fc8 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/attributes.h @@ -0,0 +1,126 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > x || __GNUC__ == x && __GNUC_MINOR__ >= y) +#else +# define AV_GCC_VERSION_AT_LEAST(x,y) 0 +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define av_always_inline __forceinline +#else +# define av_always_inline inline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_noinline __attribute__((noinline)) +#elif defined(_MSC_VER) +# define av_noinline __declspec(noinline) +#else +# define av_noinline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,6) +# define av_const __attribute__((const)) +#else +# define av_const +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +#if defined(__GNUC__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#if AV_GCC_VERSION_AT_LEAST(3,1) +# define av_used __attribute__((used)) +#else +# define av_used +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,3) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif + +#if defined(__GNUC__) && !defined(__ICC) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif + +#ifdef __GNUC__ +# define av_builtin_constant_p __builtin_constant_p +# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) +#else +# define av_builtin_constant_p(x) 0 +# define av_printf_format(fmtpos, attrpos) +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,5) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/audio_fifo.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/audio_fifo.h new file mode 100644 index 000000000000..8c76388255bf --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/audio_fifo.h @@ -0,0 +1,146 @@ +/* + * Audio FIFO + * Copyright (c) 2012 Justin Ruggles + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Audio FIFO Buffer + */ + +#ifndef AVUTIL_AUDIO_FIFO_H +#define AVUTIL_AUDIO_FIFO_H + +#include "avutil.h" +#include "fifo.h" +#include "samplefmt.h" + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * Context for an Audio FIFO Buffer. + * + * - Operates at the sample level rather than the byte level. + * - Supports multiple channels with either planar or packed sample format. + * - Automatic reallocation when writing to a full buffer. + */ +typedef struct AVAudioFifo AVAudioFifo; + +/** + * Free an AVAudioFifo. + * + * @param af AVAudioFifo to free + */ +void av_audio_fifo_free(AVAudioFifo *af); + +/** + * Allocate an AVAudioFifo. + * + * @param sample_fmt sample format + * @param channels number of channels + * @param nb_samples initial allocation size, in samples + * @return newly allocated AVAudioFifo, or NULL on error + */ +AVAudioFifo *av_audio_fifo_alloc(enum AVSampleFormat sample_fmt, int channels, + int nb_samples); + +/** + * Reallocate an AVAudioFifo. + * + * @param af AVAudioFifo to reallocate + * @param nb_samples new allocation size, in samples + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_realloc(AVAudioFifo *af, int nb_samples); + +/** + * Write data to an AVAudioFifo. + * + * The AVAudioFifo will be reallocated automatically if the available space + * is less than nb_samples. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to write to + * @param data audio data plane pointers + * @param nb_samples number of samples to write + * @return number of samples actually written, or negative AVERROR + * code on failure. + */ +int av_audio_fifo_write(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Read data from an AVAudioFifo. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param af AVAudioFifo to read from + * @param data audio data plane pointers + * @param nb_samples number of samples to read + * @return number of samples actually read, or negative AVERROR code + * on failure. + */ +int av_audio_fifo_read(AVAudioFifo *af, void **data, int nb_samples); + +/** + * Drain data from an AVAudioFifo. + * + * Removes the data without reading it. + * + * @param af AVAudioFifo to drain + * @param nb_samples number of samples to drain + * @return 0 if OK, or negative AVERROR code on failure + */ +int av_audio_fifo_drain(AVAudioFifo *af, int nb_samples); + +/** + * Reset the AVAudioFifo buffer. + * + * This empties all data in the buffer. + * + * @param af AVAudioFifo to reset + */ +void av_audio_fifo_reset(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for reading. + * + * @param af the AVAudioFifo to query + * @return number of samples available for reading + */ +int av_audio_fifo_size(AVAudioFifo *af); + +/** + * Get the current number of samples in the AVAudioFifo available for writing. + * + * @param af the AVAudioFifo to query + * @return number of samples available for writing + */ +int av_audio_fifo_space(AVAudioFifo *af); + +/** + * @} + */ + +#endif /* AVUTIL_AUDIO_FIFO_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/audioconvert.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/audioconvert.h new file mode 100644 index 000000000000..300a67cd3d5a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/audioconvert.h @@ -0,0 +1,6 @@ + +#include "version.h" + +#if FF_API_AUDIOCONVERT +#include "channel_layout.h" +#endif diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/avassert.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avassert.h new file mode 100644 index 000000000000..b223d26e8d13 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avassert.h @@ -0,0 +1,66 @@ +/* + * copyright (c) 2010 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple assert() macros that are a bit more flexible than ISO C assert(). + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_AVASSERT_H +#define AVUTIL_AVASSERT_H + +#include +#include "avutil.h" +#include "log.h" + +/** + * assert() equivalent, that is always enabled. + */ +#define av_assert0(cond) do { \ + if (!(cond)) { \ + av_log(NULL, AV_LOG_FATAL, "Assertion %s failed at %s:%d\n", \ + AV_STRINGIFY(cond), __FILE__, __LINE__); \ + abort(); \ + } \ +} while (0) + + +/** + * assert() equivalent, that does not lie in speed critical code. + * These asserts() thus can be enabled without fearing speedloss. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 0 +#define av_assert1(cond) av_assert0(cond) +#else +#define av_assert1(cond) ((void)0) +#endif + + +/** + * assert() equivalent, that does lie in speed critical code. + */ +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2(cond) av_assert0(cond) +#else +#define av_assert2(cond) ((void)0) +#endif + +#endif /* AVUTIL_AVASSERT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/avconfig.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avconfig.h new file mode 100644 index 000000000000..f10aa6186b4f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avconfig.h @@ -0,0 +1,6 @@ +/* Generated by ffconf */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 1 +#endif /* AVUTIL_AVCONFIG_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/avstring.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avstring.h new file mode 100644 index 000000000000..b7d10983c395 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avstring.h @@ -0,0 +1,226 @@ +/* + * Copyright (c) 2007 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVSTRING_H +#define AVUTIL_AVSTRING_H + +#include +#include "attributes.h" + +/** + * @addtogroup lavu_string + * @{ + */ + +/** + * Return non-zero if pfx is a prefix of str. If it is, *ptr is set to + * the address of the first character in str after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_strstart(const char *str, const char *pfx, const char **ptr); + +/** + * Return non-zero if pfx is a prefix of str independent of case. If + * it is, *ptr is set to the address of the first character in str + * after the prefix. + * + * @param str input string + * @param pfx prefix to test + * @param ptr updated if the prefix is matched inside str + * @return non-zero if the prefix matches, zero otherwise + */ +int av_stristart(const char *str, const char *pfx, const char **ptr); + +/** + * Locate the first case-independent occurrence in the string haystack + * of the string needle. A zero-length string needle is considered to + * match at the start of haystack. + * + * This function is a case-insensitive version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_stristr(const char *haystack, const char *needle); + +/** + * Locate the first occurrence of the string needle in the string haystack + * where not more than hay_length characters are searched. A zero-length + * string needle is considered to match at the start of haystack. + * + * This function is a length-limited version of the standard strstr(). + * + * @param haystack string to search in + * @param needle string to search for + * @param hay_length length of string to search in + * @return pointer to the located match within haystack + * or a null pointer if no match + */ +char *av_strnstr(const char *haystack, const char *needle, size_t hay_length); + +/** + * Copy the string src to dst, but no more than size - 1 bytes, and + * null-terminate dst. + * + * This function is the same as BSD strlcpy(). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the length of src + * + * @warning since the return value is the length of src, src absolutely + * _must_ be a properly 0-terminated string, otherwise this will read beyond + * the end of the buffer and possibly crash. + */ +size_t av_strlcpy(char *dst, const char *src, size_t size); + +/** + * Append the string src to the string dst, but to a total length of + * no more than size - 1 bytes, and null-terminate dst. + * + * This function is similar to BSD strlcat(), but differs when + * size <= strlen(dst). + * + * @param dst destination buffer + * @param src source string + * @param size size of destination buffer + * @return the total length of src and dst + * + * @warning since the return value use the length of src and dst, these + * absolutely _must_ be a properly 0-terminated strings, otherwise this + * will read beyond the end of the buffer and possibly crash. + */ +size_t av_strlcat(char *dst, const char *src, size_t size); + +/** + * Append output to a string, according to a format. Never write out of + * the destination buffer, and always put a terminating 0 within + * the buffer. + * @param dst destination buffer (string to which the output is + * appended) + * @param size total size of the destination buffer + * @param fmt printf-compatible format string, specifying how the + * following parameters are used + * @return the length of the string that would have been generated + * if enough space had been available + */ +size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Convert a number to a av_malloced string. + */ +char *av_d2str(double d); + +/** + * Unescape the given string until a non escaped terminating char, + * and return the token corresponding to the unescaped string. + * + * The normal \ and ' escaping is supported. Leading and trailing + * whitespaces are removed, unless they are escaped with '\' or are + * enclosed between ''. + * + * @param buf the buffer to parse, buf will be updated to point to the + * terminating char + * @param term a 0-terminated list of terminating chars + * @return the malloced unescaped string, which must be av_freed by + * the user, NULL in case of allocation failure + */ +char *av_get_token(const char **buf, const char *term); + +/** + * Locale-independent conversion of ASCII isdigit. + */ +int av_isdigit(int c); + +/** + * Locale-independent conversion of ASCII isgraph. + */ +int av_isgraph(int c); + +/** + * Locale-independent conversion of ASCII isspace. + */ +int av_isspace(int c); + +/** + * Locale-independent conversion of ASCII characters to uppercase. + */ +static inline int av_toupper(int c) +{ + if (c >= 'a' && c <= 'z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII characters to lowercase. + */ +static inline int av_tolower(int c) +{ + if (c >= 'A' && c <= 'Z') + c ^= 0x20; + return c; +} + +/** + * Locale-independent conversion of ASCII isxdigit. + */ +int av_isxdigit(int c); + +/* + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strcasecmp(const char *a, const char *b); + +/** + * Locale-independent case-insensitive compare. + * @note This means only ASCII-range characters are case-insensitive + */ +int av_strncasecmp(const char *a, const char *b, size_t n); + + +/** + * Thread safe basename. + * @param path the path, on DOS both \ and / are considered separators. + * @return pointer to the basename substring. + */ +const char *av_basename(const char *path); + +/** + * Thread safe dirname. + * @param path the path, on DOS both \ and / are considered separators. + * @return the path with the separator replaced by the string terminator or ".". + * @note the function may change the input string. + */ +const char *av_dirname(char *path); + +/** + * @} + */ + +#endif /* AVUTIL_AVSTRING_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/avutil.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avutil.h new file mode 100644 index 000000000000..a0d35d16278e --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/avutil.h @@ -0,0 +1,284 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * external API header + */ + +/** + * @mainpage + * + * @section libav_intro Introduction + * + * This document describes the usage of the different libraries + * provided by Libav. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @ref lavfi "libavfilter" graph-based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @ref lavr "libavresample" audio resampling, format conversion and mixing + * @li @ref libsws "libswscale" color conversion and scaling library + * + * @section libav_versioning Versioning and compatibility + * + * Each of the Libav libraries contains a version.h header, which defines a + * major, minor and micro version number with the + * LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO} macros. The major version + * number is incremented with backward incompatible changes - e.g. removing + * parts of the public API, reordering public struct members, etc. The minor + * version number is incremented for backward compatible API changes or major + * new features - e.g. adding a new public function or a new decoder. The micro + * version number is incremented for smaller changes that a calling program + * might still want to check for - e.g. changing behavior in a previously + * unspecified situation. + * + * Libav guarantees backward API and ABI compatibility for each library as long + * as its major version number is unchanged. This means that no public symbols + * will be removed or renamed. Types and names of the public struct members and + * values of public macros and enums will remain the same (unless they were + * explicitly declared as not part of the public API). Documented behavior will + * not change. + * + * In other words, any correct program that works with a given Libav snapshot + * should work just as well without any changes with any later snapshot with the + * same major versions. This applies to both rebuilding the program against new + * Libav versions or to replacing the dynamic Libav libraries that a program + * links against. + * + * However, new public symbols may be added and new members may be appended to + * public structs whose size is not part of public ABI (most public structs in + * Libav). New macros and enum values may be added. Behavior in undocumented + * situations may change slightly (and be documented). All those are accompanied + * by an entry in doc/APIchanges and incrementing either the minor or micro + * version number. + */ + +/** + * @defgroup lavu Common utility functions + * + * @brief + * libavutil contains the code shared across all the other Libav + * libraries + * + * @note In order to use the functions provided by avutil you must include + * the specific header. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Maths + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_log Logging Facility + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup lavu_internal Internal + * + * Not exported functions, for internal usage only + * + * @{ + * + * @} + * + * @defgroup preproc_misc Preprocessor String Macros + * + * @{ + * + * @} + */ + + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< + +/** + * @defgroup lavu_base64 Base64 + * @ingroup lavu_crypto + * @{ + */ + + +/** + * Decode a base64-encoded string. + * + * @param out buffer for decoded data + * @param in null-terminated input string + * @param out_size size in bytes of the out buffer, must be at + * least 3/4 of the length of in + * @return number of bytes written, or a negative value in case of + * invalid input + */ +int av_base64_decode(uint8_t *out, const char *in, int out_size); + +/** + * Encode data to base64 and null-terminate. + * + * @param out buffer for encoded data + * @param out_size size in bytes of the output buffer, must be at + * least AV_BASE64_SIZE(in_size) + * @param in_size size in bytes of the 'in' buffer + * @return 'out' or NULL in case of error + */ +char *av_base64_encode(char *out, int out_size, const uint8_t *in, int in_size); + +/** + * Calculate the output size needed to base64-encode x bytes. + */ +#define AV_BASE64_SIZE(x) (((x)+2) / 3 * 4 + 1) + + /** + * @} + */ + +#endif /* AVUTIL_BASE64_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/blowfish.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/blowfish.h new file mode 100644 index 000000000000..8c29536cfe01 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/blowfish.h @@ -0,0 +1,76 @@ +/* + * Blowfish algorithm + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_BLOWFISH_H +#define AVUTIL_BLOWFISH_H + +#include + +/** + * @defgroup lavu_blowfish Blowfish + * @ingroup lavu_crypto + * @{ + */ + +#define AV_BF_ROUNDS 16 + +typedef struct AVBlowfish { + uint32_t p[AV_BF_ROUNDS + 2]; + uint32_t s[4][256]; +} AVBlowfish; + +/** + * Initialize an AVBlowfish context. + * + * @param ctx an AVBlowfish context + * @param key a key + * @param key_len length of the key + */ +void av_blowfish_init(struct AVBlowfish *ctx, const uint8_t *key, int key_len); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param xl left four bytes halves of input to be encrypted + * @param xr right four bytes halves of input to be encrypted + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt_ecb(struct AVBlowfish *ctx, uint32_t *xl, uint32_t *xr, + int decrypt); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVBlowfish context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_blowfish_crypt(struct AVBlowfish *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_BLOWFISH_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/bswap.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/bswap.h new file mode 100644 index 000000000000..93a6016b8c63 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/bswap.h @@ -0,0 +1,111 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * byte swapping routines + */ + +#ifndef AVUTIL_BSWAP_H +#define AVUTIL_BSWAP_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_AARCH64 +# include "aarch64/bswap.h" +#elif ARCH_ARM +# include "arm/bswap.h" +#elif ARCH_AVR32 +# include "avr32/bswap.h" +#elif ARCH_BFIN +# include "bfin/bswap.h" +#elif ARCH_SH4 +# include "sh4/bswap.h" +#elif ARCH_X86 +# include "x86/bswap.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +#define AV_BSWAP16C(x) (((x) << 8 & 0xff00) | ((x) >> 8 & 0x00ff)) +#define AV_BSWAP32C(x) (AV_BSWAP16C(x) << 16 | AV_BSWAP16C((x) >> 16)) +#define AV_BSWAP64C(x) (AV_BSWAP32C(x) << 32 | AV_BSWAP32C((x) >> 32)) + +#define AV_BSWAPC(s, x) AV_BSWAP##s##C(x) + +#ifndef av_bswap16 +static av_always_inline av_const uint16_t av_bswap16(uint16_t x) +{ + x= (x>>8) | (x<<8); + return x; +} +#endif + +#ifndef av_bswap32 +static av_always_inline av_const uint32_t av_bswap32(uint32_t x) +{ + return AV_BSWAP32C(x); +} +#endif + +#ifndef av_bswap64 +static inline uint64_t av_const av_bswap64(uint64_t x) +{ + return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); +} +#endif + +// be2ne ... big-endian to native-endian +// le2ne ... little-endian to native-endian + +#if AV_HAVE_BIGENDIAN +#define av_be2ne16(x) (x) +#define av_be2ne32(x) (x) +#define av_be2ne64(x) (x) +#define av_le2ne16(x) av_bswap16(x) +#define av_le2ne32(x) av_bswap32(x) +#define av_le2ne64(x) av_bswap64(x) +#define AV_BE2NEC(s, x) (x) +#define AV_LE2NEC(s, x) AV_BSWAPC(s, x) +#else +#define av_be2ne16(x) av_bswap16(x) +#define av_be2ne32(x) av_bswap32(x) +#define av_be2ne64(x) av_bswap64(x) +#define av_le2ne16(x) (x) +#define av_le2ne32(x) (x) +#define av_le2ne64(x) (x) +#define AV_BE2NEC(s, x) AV_BSWAPC(s, x) +#define AV_LE2NEC(s, x) (x) +#endif + +#define AV_BE2NE16C(x) AV_BE2NEC(16, x) +#define AV_BE2NE32C(x) AV_BE2NEC(32, x) +#define AV_BE2NE64C(x) AV_BE2NEC(64, x) +#define AV_LE2NE16C(x) AV_LE2NEC(16, x) +#define AV_LE2NE32C(x) AV_LE2NEC(32, x) +#define AV_LE2NE64C(x) AV_LE2NEC(64, x) + +#endif /* AVUTIL_BSWAP_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/buffer.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/buffer.h new file mode 100644 index 000000000000..56b4d020e5dc --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/buffer.h @@ -0,0 +1,267 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_buffer + * refcounted data buffer API + */ + +#ifndef AVUTIL_BUFFER_H +#define AVUTIL_BUFFER_H + +#include + +/** + * @defgroup lavu_buffer AVBuffer + * @ingroup lavu_data + * + * @{ + * AVBuffer is an API for reference-counted data buffers. + * + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer + * represents the data buffer itself; it is opaque and not meant to be accessed + * by the caller directly, but only through AVBufferRef. However, the caller may + * e.g. compare two AVBuffer pointers to check whether two different references + * are describing the same data buffer. AVBufferRef represents a single + * reference to an AVBuffer and it is the object that may be manipulated by the + * caller directly. + * + * There are two functions provided for creating a new AVBuffer with a single + * reference -- av_buffer_alloc() to just allocate a new buffer, and + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing + * reference, additional references may be created with av_buffer_ref(). + * Use av_buffer_unref() to free a reference (this will automatically free the + * data once all the references are freed). + * + * The convention throughout this API and the rest of Libav is such that the + * buffer is considered writable if there exists only one reference to it (and + * it has not been marked as read-only). The av_buffer_is_writable() function is + * provided to check whether this is true and av_buffer_make_writable() will + * automatically create a new writable buffer when necessary. + * Of course nothing prevents the calling code from violating this convention, + * however that is safe only when all the existing references are under its + * control. + * + * @note Referencing and unreferencing the buffers is thread-safe and thus + * may be done from multiple threads simultaneously without any need for + * additional locking. + * + * @note Two different references to the same buffer can point to different + * parts of the buffer (i.e. their AVBufferRef.data will not be equal). + */ + +/** + * A reference counted buffer type. It is opaque and is meant to be used through + * references (AVBufferRef). + */ +typedef struct AVBuffer AVBuffer; + +/** + * A reference to a data buffer. + * + * The size of this struct is not a part of the public ABI and it is not meant + * to be allocated directly. + */ +typedef struct AVBufferRef { + AVBuffer *buffer; + + /** + * The data buffer. It is considered writable if and only if + * this is the only reference to the buffer, in which case + * av_buffer_is_writable() returns 1. + */ + uint8_t *data; + /** + * Size of data in bytes. + */ + int size; +} AVBufferRef; + +/** + * Allocate an AVBuffer of the given size using av_malloc(). + * + * @return an AVBufferRef of given size or NULL when out of memory + */ +AVBufferRef *av_buffer_alloc(int size); + +/** + * Same as av_buffer_alloc(), except the returned buffer will be initialized + * to zero. + */ +AVBufferRef *av_buffer_allocz(int size); + +/** + * Always treat the buffer as read-only, even when it has only one + * reference. + */ +#define AV_BUFFER_FLAG_READONLY (1 << 0) + +/** + * Create an AVBuffer from an existing array. + * + * If this function is successful, data is owned by the AVBuffer. The caller may + * only access data through the returned AVBufferRef and references derived from + * it. + * If this function fails, data is left untouched. + * @param data data array + * @param size size of data in bytes + * @param free a callback for freeing this buffer's data + * @param opaque parameter to be passed to free + * @param flags a combination of AV_BUFFER_FLAG_* + * + * @return an AVBufferRef referring to data on success, NULL on failure. + */ +AVBufferRef *av_buffer_create(uint8_t *data, int size, + void (*free)(void *opaque, uint8_t *data), + void *opaque, int flags); + +/** + * Default free callback, which calls av_free() on the buffer data. + * This function is meant to be passed to av_buffer_create(), not called + * directly. + */ +void av_buffer_default_free(void *opaque, uint8_t *data); + +/** + * Create a new reference to an AVBuffer. + * + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on + * failure. + */ +AVBufferRef *av_buffer_ref(AVBufferRef *buf); + +/** + * Free a given reference and automatically free the buffer if there are no more + * references to it. + * + * @param buf the reference to be freed. The pointer is set to NULL on return. + */ +void av_buffer_unref(AVBufferRef **buf); + +/** + * @return 1 if the caller may write to the data referred to by buf (which is + * true if and only if buf is the only reference to the underlying AVBuffer). + * Return 0 otherwise. + * A positive answer is valid until av_buffer_ref() is called on buf. + */ +int av_buffer_is_writable(const AVBufferRef *buf); + +/** + * Create a writable reference from a given buffer reference, avoiding data copy + * if possible. + * + * @param buf buffer reference to make writable. On success, buf is either left + * untouched, or it is unreferenced and a new writable AVBufferRef is + * written in its place. On failure, buf is left untouched. + * @return 0 on success, a negative AVERROR on failure. + */ +int av_buffer_make_writable(AVBufferRef **buf); + +/** + * Reallocate a given buffer. + * + * @param buf a buffer reference to reallocate. On success, buf will be + * unreferenced and a new reference with the required size will be + * written in its place. On failure buf will be left untouched. *buf + * may be NULL, then a new buffer is allocated. + * @param size required new buffer size. + * @return 0 on success, a negative AVERROR on failure. + * + * @note the buffer is actually reallocated with av_realloc() only if it was + * initially allocated through av_buffer_realloc(NULL) and there is only one + * reference to it (i.e. the one passed to this function). In all other cases + * a new buffer is allocated and the data is copied. + */ +int av_buffer_realloc(AVBufferRef **buf, int size); + +/** + * @} + */ + +/** + * @defgroup lavu_bufferpool AVBufferPool + * @ingroup lavu_data + * + * @{ + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. + * + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is + * meant to solve this in cases when the caller needs a set of buffers of the + * same size (the most obvious use case being buffers for raw video or audio + * frames). + * + * At the beginning, the user must call av_buffer_pool_init() to create the + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to + * get a reference to a new buffer, similar to av_buffer_alloc(). This new + * reference works in all aspects the same way as the one created by + * av_buffer_alloc(). However, when the last reference to this buffer is + * unreferenced, it is returned to the pool instead of being freed and will be + * reused for subsequent av_buffer_pool_get() calls. + * + * When the caller is done with the pool and no longer needs to allocate any new + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. + * Once all the buffers are released, it will automatically be freed. + * + * Allocating and releasing buffers with this API is thread-safe as long as + * either the default alloc callback is used, or the user-supplied one is + * thread-safe. + */ + +/** + * The buffer pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with av_buffer_pool_init() and freed with + * av_buffer_pool_uninit(). + */ +typedef struct AVBufferPool AVBufferPool; + +/** + * Allocate and initialize a buffer pool. + * + * @param size size of each buffer in this pool + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be used + * (av_buffer_alloc()). + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size)); + +/** + * Mark the pool as being available for freeing. It will actually be freed only + * once all the allocated buffers associated with the pool are released. Thus it + * is safe to call this function while some of the allocated buffers are still + * in use. + * + * @param pool pointer to the pool to be freed. It will be set to NULL. + * @see av_buffer_pool_can_uninit() + */ +void av_buffer_pool_uninit(AVBufferPool **pool); + +/** + * Allocate a new AVBuffer, reusing an old buffer from the pool when available. + * This function may be called simultaneously from multiple threads. + * + * @return a reference to the new buffer on success, NULL on error. + */ +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); + +/** + * @} + */ + +#endif /* AVUTIL_BUFFER_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/channel_layout.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/channel_layout.h new file mode 100644 index 000000000000..6a1f83005a68 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/channel_layout.h @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2006 Michael Niedermayer + * Copyright (c) 2008 Peter Ross + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CHANNEL_LAYOUT_H +#define AVUTIL_CHANNEL_LAYOUT_H + +#include + +/** + * @file + * audio channel layout utility functions + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup channel_masks Audio channel masks + * @{ + */ +#define AV_CH_FRONT_LEFT 0x00000001 +#define AV_CH_FRONT_RIGHT 0x00000002 +#define AV_CH_FRONT_CENTER 0x00000004 +#define AV_CH_LOW_FREQUENCY 0x00000008 +#define AV_CH_BACK_LEFT 0x00000010 +#define AV_CH_BACK_RIGHT 0x00000020 +#define AV_CH_FRONT_LEFT_OF_CENTER 0x00000040 +#define AV_CH_FRONT_RIGHT_OF_CENTER 0x00000080 +#define AV_CH_BACK_CENTER 0x00000100 +#define AV_CH_SIDE_LEFT 0x00000200 +#define AV_CH_SIDE_RIGHT 0x00000400 +#define AV_CH_TOP_CENTER 0x00000800 +#define AV_CH_TOP_FRONT_LEFT 0x00001000 +#define AV_CH_TOP_FRONT_CENTER 0x00002000 +#define AV_CH_TOP_FRONT_RIGHT 0x00004000 +#define AV_CH_TOP_BACK_LEFT 0x00008000 +#define AV_CH_TOP_BACK_CENTER 0x00010000 +#define AV_CH_TOP_BACK_RIGHT 0x00020000 +#define AV_CH_STEREO_LEFT 0x20000000 ///< Stereo downmix. +#define AV_CH_STEREO_RIGHT 0x40000000 ///< See AV_CH_STEREO_LEFT. +#define AV_CH_WIDE_LEFT 0x0000000080000000ULL +#define AV_CH_WIDE_RIGHT 0x0000000100000000ULL +#define AV_CH_SURROUND_DIRECT_LEFT 0x0000000200000000ULL +#define AV_CH_SURROUND_DIRECT_RIGHT 0x0000000400000000ULL +#define AV_CH_LOW_FREQUENCY_2 0x0000000800000000ULL + +/** Channel mask value used for AVCodecContext.request_channel_layout + to indicate that the user requests the channel order of the decoder output + to be the native codec channel order. */ +#define AV_CH_LAYOUT_NATIVE 0x8000000000000000ULL + +/** + * @} + * @defgroup channel_mask_c Audio channel convenience macros + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) + +enum AVMatrixEncoding { + AV_MATRIX_ENCODING_NONE, + AV_MATRIX_ENCODING_DOLBY, + AV_MATRIX_ENCODING_DPLII, + AV_MATRIX_ENCODING_DPLIIX, + AV_MATRIX_ENCODING_DPLIIZ, + AV_MATRIX_ENCODING_DOLBYEX, + AV_MATRIX_ENCODING_DOLBYHEADPHONE, + AV_MATRIX_ENCODING_NB +}; + +/** + * @} + */ + +/** + * Return a channel layout id that matches name, or 0 if no match is found. + * + * name can be one or several of the following notations, + * separated by '+' or '|': + * - the name of an usual channel layout (mono, stereo, 4.0, quad, 5.0, + * 5.0(side), 5.1, 5.1(side), 7.1, 7.1(wide), downmix); + * - the name of a single channel (FL, FR, FC, LFE, BL, BR, FLC, FRC, BC, + * SL, SR, TC, TFL, TFC, TFR, TBL, TBC, TBR, DL, DR); + * - a number of channels, in decimal, optionally followed by 'c', yielding + * the default channel layout for that number of channels (@see + * av_get_default_channel_layout); + * - a channel layout mask, in hexadecimal starting with "0x" (see the + * AV_CH_* macros). + * + * Example: "stereo+FC" = "2+FC" = "2c+1c" = "0x7" + */ +uint64_t av_get_channel_layout(const char *name); + +/** + * Return a description of a channel layout. + * If nb_channels is <= 0, it is guessed from the channel_layout. + * + * @param buf put here the string containing the channel layout + * @param buf_size size in bytes of the buffer + */ +void av_get_channel_layout_string(char *buf, int buf_size, int nb_channels, uint64_t channel_layout); + +/** + * Return the number of channels in the channel layout. + */ +int av_get_channel_layout_nb_channels(uint64_t channel_layout); + +/** + * Return default channel layout for a given number of channels. + */ +uint64_t av_get_default_channel_layout(int nb_channels); + +/** + * Get the index of a channel in channel_layout. + * + * @param channel a channel layout describing exactly one channel which must be + * present in channel_layout. + * + * @return index of channel in channel_layout on success, a negative AVERROR + * on error. + */ +int av_get_channel_layout_channel_index(uint64_t channel_layout, + uint64_t channel); + +/** + * Get the channel with the given index in channel_layout. + */ +uint64_t av_channel_layout_extract_channel(uint64_t channel_layout, int index); + +/** + * Get the name of a given channel. + * + * @return channel name on success, NULL on error. + */ +const char *av_get_channel_name(uint64_t channel); + +/** + * @} + */ + +#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/common.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/common.h new file mode 100644 index 000000000000..eb40e1299030 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/common.h @@ -0,0 +1,406 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "attributes.h" +#include "version.h" +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +//rounded division & shift +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a,b) (((a)>0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +/* misc math functions */ + +#if FF_API_AV_REVERSE +extern attribute_deprecated const uint8_t av_reverse[256]; +#endif + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +#endif + +/* Pull in unguarded fallback defines at the end of this file. */ +#include "common.h" + +#ifndef av_log2 +av_const int av_log2(unsigned v); +#endif + +#ifndef av_log2_16bit +av_const int av_log2_16bit(unsigned v); +#endif + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) +{ + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) +{ + if (a&(~0xFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) +{ + if (a&(~0xFFFF)) return (-a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) +{ + if ((a+0x8000) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) +{ + if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF; + else return a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1<> 31 & ((1< amax) return amax; + else return a; +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) +{ + return av_log2((x - 1) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) +{ + return av_popcount(x) + av_popcount(x >> 32); +} + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= GET_BYTE;\ + {\ + uint32_t top = (val & 128) >> 1;\ + if ((val & 0xc0) == 0x80)\ + ERROR\ + while (val & top) {\ + int tmp= GET_BYTE - 128;\ + if(tmp>>6)\ + ERROR\ + val= (val<<6) + tmp;\ + top <<= 5;\ + }\ + val &= (top << 1) - 1;\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = GET_16BIT;\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = GET_16BIT - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + ERROR\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + + + +#include "mem.h" + +#ifdef HAVE_AV_CONFIG_H +# include "internal.h" +#endif /* HAVE_AV_CONFIG_H */ + +#endif /* AVUTIL_COMMON_H */ + +/* + * The following definitions are outside the multiple inclusion guard + * to ensure they are immediately available in intmath.h. + */ + +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_sat_add32 +# define av_sat_add32 av_sat_add32_c +#endif +#ifndef av_sat_dadd32 +# define av_sat_dadd32 av_sat_dadd32_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/cpu.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/cpu.h new file mode 100644 index 000000000000..29036e394156 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/cpu.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#include "version.h" + +#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext +#if FF_API_CPU_FLAG_MMX2 +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#endif +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +#define AV_CPU_FLAG_CMOV 0x1000 ///< i686 cmov +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used + +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard + +#define AV_CPU_FLAG_ARMV5TE (1 << 0) +#define AV_CPU_FLAG_ARMV6 (1 << 1) +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) +#define AV_CPU_FLAG_VFP (1 << 3) +#define AV_CPU_FLAG_VFPV3 (1 << 4) +#define AV_CPU_FLAG_NEON (1 << 5) + +/** + * Return the flags which specify extensions supported by the CPU. + */ +int av_get_cpu_flags(void); + +/** + * Set a mask on flags returned by av_get_cpu_flags(). + * This function is mainly useful for testing. + * + * @warning this function is not thread safe. + */ +void av_set_cpu_flags_mask(int mask); + +/** + * Parse CPU flags from a string. + * + * @return a combination of AV_CPU_* flags, negative on error. + */ +int av_parse_cpu_flags(const char *s); + +/** + * @return the number of logical CPU cores present. + */ +int av_cpu_count(void); + +#endif /* AVUTIL_CPU_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/crc.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/crc.h new file mode 100644 index 000000000000..0540619d20f2 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/crc.h @@ -0,0 +1,74 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_CRC_H +#define AVUTIL_CRC_H + +#include +#include +#include "attributes.h" + +typedef uint32_t AVCRC; + +typedef enum { + AV_CRC_8_ATM, + AV_CRC_16_ANSI, + AV_CRC_16_CCITT, + AV_CRC_32_IEEE, + AV_CRC_32_IEEE_LE, /*< reversed bitorder version of AV_CRC_32_IEEE */ + AV_CRC_MAX, /*< Not part of public API! Do not use outside libavutil. */ +}AVCRCId; + +/** + * Initialize a CRC table. + * @param ctx must be an array of size sizeof(AVCRC)*257 or sizeof(AVCRC)*1024 + * @param le If 1, the lowest bit represents the coefficient for the highest + * exponent of the corresponding polynomial (both for poly and + * actual CRC). + * If 0, you must swap the CRC parameter and the result of av_crc + * if you need the standard representation (can be simplified in + * most cases to e.g. bswap16): + * av_bswap32(crc << (32-bits)) + * @param bits number of bits for the CRC + * @param poly generator polynomial without the x**bits coefficient, in the + * representation as specified by le + * @param ctx_size size of ctx in bytes + * @return <0 on failure + */ +int av_crc_init(AVCRC *ctx, int le, int bits, uint32_t poly, int ctx_size); + +/** + * Get an initialized standard CRC table. + * @param crc_id ID of a standard CRC + * @return a pointer to the CRC table or NULL on failure + */ +const AVCRC *av_crc_get_table(AVCRCId crc_id); + +/** + * Calculate the CRC of a block. + * @param crc CRC of previous blocks if any or initial value for CRC + * @return CRC updated with the data from the given block + * + * @see av_crc_init() "le" parameter + */ +uint32_t av_crc(const AVCRC *ctx, uint32_t crc, + const uint8_t *buffer, size_t length) av_pure; + +#endif /* AVUTIL_CRC_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/dict.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/dict.h new file mode 100644 index 000000000000..e0a91ae8367c --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/dict.h @@ -0,0 +1,146 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * Public dictionary API. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key:value pairs. To create + * an AVDictionary, simply pass an address of a NULL pointer to + * av_dict_set(). NULL can be used as an empty dictionary wherever + * a pointer to an AVDictionary is required. + * Use av_dict_get() to retrieve an entry or iterate over all + * entries and finally av_dict_free() to free the dictionary + * and all its contents. + * + @code + AVDictionary *d = NULL; // "create" an empty dictionary + AVDictionaryEntry *t = NULL; + + av_dict_set(&d, "foo", "bar", 0); // add an entry + + char *k = av_strdup("key"); // if your strings are already allocated, + char *v = av_strdup("value"); // you can avoid copying them like this + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + + while (t = av_dict_get(d, "", t, AV_DICT_IGNORE_SUFFIX)) { + <....> // iterate over all entries in d + } + av_dict_free(&d); + @endcode + * + */ + +#define AV_DICT_MATCH_CASE 1 +#define AV_DICT_IGNORE_SUFFIX 2 +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() and children. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() and chilren. */ +#define AV_DICT_DONT_OVERWRITE 16 ///< Don't overwrite existing entries. +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ + +typedef struct AVDictionaryEntry { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param flags Allows case as well as suffix-insensitive comparisons. + * @return Found entry or NULL, changing key or value leads to undefined behavior. + */ +AVDictionaryEntry * +av_dict_get(AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags); + +/** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + */ +int av_dict_count(const AVDictionary *m); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * @param pm pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key entry key to add to *pm (will be av_strduped depending on flags) + * @param value entry value to add to *pm (will be av_strduped depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Parse the key/value pairs list and add to a dictionary. + * + * @param key_val_sep a 0-terminated list of characters used to separate + * key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @param flags flags to use when adding to dictionary. + * AV_DICT_DONT_STRDUP_KEY and AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * @return 0 on success, negative AVERROR code on failure + */ +int av_dict_parse_string(AVDictionary **pm, const char *str, + const char *key_val_sep, const char *pairs_sep, + int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * @param dst pointer to a pointer to a AVDictionary struct. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src pointer to source AVDictionary struct + * @param flags flags to use when setting entries in *dst + * @note metadata is read using the AV_DICT_IGNORE_SUFFIX flag + */ +void av_dict_copy(AVDictionary **dst, AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * @} + */ + +#endif /* AVUTIL_DICT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/downmix_info.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/downmix_info.h new file mode 100644 index 000000000000..69969f6fbdf6 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/downmix_info.h @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2014 Tim Walker + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_DOWNMIX_INFO_H +#define AVUTIL_DOWNMIX_INFO_H + +#include "frame.h" + +/** + * @file + * audio downmix medatata + */ + +/** + * @addtogroup lavu_audio + * @{ + */ + +/** + * @defgroup downmix_info Audio downmix metadata + * @{ + */ + +/** + * Possible downmix types. + */ +enum AVDownmixType { + AV_DOWNMIX_TYPE_UNKNOWN, /**< Not indicated. */ + AV_DOWNMIX_TYPE_LORO, /**< Lo/Ro 2-channel downmix (Stereo). */ + AV_DOWNMIX_TYPE_LTRT, /**< Lt/Rt 2-channel downmix, Dolby Surround compatible. */ + AV_DOWNMIX_TYPE_DPLII, /**< Lt/Rt 2-channel downmix, Dolby Pro Logic II compatible. */ + AV_DOWNMIX_TYPE_NB /**< Number of downmix types. Not part of ABI. */ +}; + +/** + * This structure describes optional metadata relevant to a downmix procedure. + * + * All fields are set by the decoder to the value indicated in the audio + * bitstream (if present), or to a "sane" default otherwise. + */ +typedef struct AVDownmixInfo { + /** + * Type of downmix preferred by the mastering engineer. + */ + enum AVDownmixType preferred_downmix_type; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during a regular downmix. + */ + double center_mix_level; + + /** + * Absolute scale factor representing the nominal level of the center + * channel during an Lt/Rt compatible downmix. + */ + double center_mix_level_ltrt; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during a regular downmix. + */ + double surround_mix_level; + + /** + * Absolute scale factor representing the nominal level of the surround + * channels during an Lt/Rt compatible downmix. + */ + double surround_mix_level_ltrt; + + /** + * Absolute scale factor representing the level at which the LFE data is + * mixed into L/R channels during downmixing. + */ + double lfe_mix_level; +} AVDownmixInfo; + +/** + * Get a frame's AV_FRAME_DATA_DOWNMIX_INFO side data for editing. + * + * The side data is created and added to the frame if it's absent. + * + * @param frame the frame for which the side data is to be obtained. + * + * @return the AVDownmixInfo structure to be edited by the caller. + */ +AVDownmixInfo *av_downmix_info_update_side_data(AVFrame *frame); + +/** + * @} + */ + +/** + * @} + */ + +#endif /* AVUTIL_DOWNMIX_INFO_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/error.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/error.h new file mode 100644 index 000000000000..268a0320a876 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/error.h @@ -0,0 +1,82 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include +#include + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define AVERROR_BSF_NOT_FOUND (-0x39acbd08) ///< Bitstream filter not found +#define AVERROR_DECODER_NOT_FOUND (-0x3cbabb08) ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND (-0x32babb08) ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND (-0x3cb1ba08) ///< Encoder not found +#define AVERROR_EOF (-0x5fb9b0bb) ///< End of file +#define AVERROR_EXIT (-0x2bb6a7bb) ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_FILTER_NOT_FOUND (-0x33b6b908) ///< Filter not found +#define AVERROR_INVALIDDATA (-0x3ebbb1b7) ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND (-0x27aab208) ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND (-0x2bafb008) ///< Option not found +#define AVERROR_PATCHWELCOME (-0x3aa8beb0) ///< Not yet implemented in Libav, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND (-0x30adaf08) ///< Protocol not found +#define AVERROR_STREAM_NOT_FOUND (-0x2dabac08) ///< Stream not found +#define AVERROR_BUG (-0x5fb8aabe) ///< Bug detected, please report the issue +#define AVERROR_UNKNOWN (-0x31b4b1ab) ///< Unknown error, typically from an external library +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/eval.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/eval.h new file mode 100644 index 000000000000..ccb29e7a336f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/eval.h @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2002 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * simple arithmetic expression evaluator + */ + +#ifndef AVUTIL_EVAL_H +#define AVUTIL_EVAL_H + +#include "avutil.h" + +typedef struct AVExpr AVExpr; + +/** + * Parse and evaluate an expression. + * Note, this is significantly slower than av_expr_eval(). + * + * @param res a pointer to a double where is put the result value of + * the expression, or NAN in case of error + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param const_values a zero terminated array of values for the identifiers from const_names + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse_and_eval(double *res, const char *s, + const char * const *const_names, const double *const_values, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + void *opaque, int log_offset, void *log_ctx); + +/** + * Parse an expression. + * + * @param expr a pointer where is put an AVExpr containing the parsed + * value in case of successful parsing, or NULL otherwise. + * The pointed to AVExpr must be freed with av_expr_free() by the user + * when it is not needed anymore. + * @param s expression as a zero terminated string, for example "1+2^3+5*5+sin(2/3)" + * @param const_names NULL terminated array of zero terminated strings of constant identifiers, for example {"PI", "E", 0} + * @param func1_names NULL terminated array of zero terminated strings of funcs1 identifiers + * @param funcs1 NULL terminated array of function pointers for functions which take 1 argument + * @param func2_names NULL terminated array of zero terminated strings of funcs2 identifiers + * @param funcs2 NULL terminated array of function pointers for functions which take 2 arguments + * @param log_ctx parent logging context + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_expr_parse(AVExpr **expr, const char *s, + const char * const *const_names, + const char * const *func1_names, double (* const *funcs1)(void *, double), + const char * const *func2_names, double (* const *funcs2)(void *, double, double), + int log_offset, void *log_ctx); + +/** + * Evaluate a previously parsed expression. + * + * @param const_values a zero terminated array of values for the identifiers from av_expr_parse() const_names + * @param opaque a pointer which will be passed to all functions from funcs1 and funcs2 + * @return the value of the expression + */ +double av_expr_eval(AVExpr *e, const double *const_values, void *opaque); + +/** + * Free a parsed expression previously created with av_expr_parse(). + */ +void av_expr_free(AVExpr *e); + +/** + * Parse the string in numstr and return its value as a double. If + * the string is empty, contains only whitespaces, or does not contain + * an initial substring that has the expected syntax for a + * floating-point number, no conversion is performed. In this case, + * returns a value of zero and the value returned in tail is the value + * of numstr. + * + * @param numstr a string representing a number, may contain one of + * the International System number postfixes, for example 'K', 'M', + * 'G'. If 'i' is appended after the postfix, powers of 2 are used + * instead of powers of 10. The 'B' postfix multiplies the value for + * 8, and can be appended after another postfix or used alone. This + * allows using for example 'KB', 'MiB', 'G' and 'B' as postfix. + * @param tail if non-NULL puts here the pointer to the char next + * after the last parsed character + */ +double av_strtod(const char *numstr, char **tail); + +#endif /* AVUTIL_EVAL_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/fifo.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/fifo.h new file mode 100644 index 000000000000..ea30f5d2bdd0 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/fifo.h @@ -0,0 +1,131 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * a very simple circular buffer FIFO implementation + */ + +#ifndef AVUTIL_FIFO_H +#define AVUTIL_FIFO_H + +#include +#include "avutil.h" +#include "attributes.h" + +typedef struct AVFifoBuffer { + uint8_t *buffer; + uint8_t *rptr, *wptr, *end; + uint32_t rndx, wndx; +} AVFifoBuffer; + +/** + * Initialize an AVFifoBuffer. + * @param size of FIFO + * @return AVFifoBuffer or NULL in case of memory allocation failure + */ +AVFifoBuffer *av_fifo_alloc(unsigned int size); + +/** + * Free an AVFifoBuffer. + * @param f AVFifoBuffer to free + */ +void av_fifo_free(AVFifoBuffer *f); + +/** + * Reset the AVFifoBuffer to the state right after av_fifo_alloc, in particular it is emptied. + * @param f AVFifoBuffer to reset + */ +void av_fifo_reset(AVFifoBuffer *f); + +/** + * Return the amount of data in bytes in the AVFifoBuffer, that is the + * amount of data you can read from it. + * @param f AVFifoBuffer to read from + * @return size + */ +int av_fifo_size(AVFifoBuffer *f); + +/** + * Return the amount of space in bytes in the AVFifoBuffer, that is the + * amount of data you can write into it. + * @param f AVFifoBuffer to write into + * @return size + */ +int av_fifo_space(AVFifoBuffer *f); + +/** + * Feed data from an AVFifoBuffer to a user-supplied callback. + * @param f AVFifoBuffer to read from + * @param buf_size number of bytes to read + * @param func generic read function + * @param dest data destination + */ +int av_fifo_generic_read(AVFifoBuffer *f, void *dest, int buf_size, void (*func)(void*, void*, int)); + +/** + * Feed data from a user-supplied callback to an AVFifoBuffer. + * @param f AVFifoBuffer to write to + * @param src data source; non-const since it may be used as a + * modifiable context by the function defined in func + * @param size number of bytes to write + * @param func generic write function; the first parameter is src, + * the second is dest_buf, the third is dest_buf_size. + * func must return the number of bytes written to dest_buf, or <= 0 to + * indicate no more data available to write. + * If func is NULL, src is interpreted as a simple byte array for source data. + * @return the number of bytes written to the FIFO + */ +int av_fifo_generic_write(AVFifoBuffer *f, void *src, int size, int (*func)(void*, void*, int)); + +/** + * Resize an AVFifoBuffer. + * @param f AVFifoBuffer to resize + * @param size new AVFifoBuffer size in bytes + * @return <0 for failure, >=0 otherwise + */ +int av_fifo_realloc2(AVFifoBuffer *f, unsigned int size); + +/** + * Read and discard the specified amount of data from an AVFifoBuffer. + * @param f AVFifoBuffer to read from + * @param size amount of data to read in bytes + */ +void av_fifo_drain(AVFifoBuffer *f, int size); + +/** + * Return a pointer to the data stored in a FIFO buffer at a certain offset. + * The FIFO buffer is not modified. + * + * @param f AVFifoBuffer to peek at, f must be non-NULL + * @param offs an offset in bytes, its absolute value must be less + * than the used buffer size or the returned pointer will + * point outside to the buffer data. + * The used buffer size can be checked with av_fifo_size(). + */ +static inline uint8_t *av_fifo_peek2(const AVFifoBuffer *f, int offs) +{ + uint8_t *ptr = f->rptr + offs; + if (ptr >= f->end) + ptr = f->buffer + (ptr - f->end); + else if (ptr < f->buffer) + ptr = f->end - (f->buffer - ptr); + return ptr; +} + +#endif /* AVUTIL_FIFO_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/file.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/file.h new file mode 100644 index 000000000000..e3f02a8308b7 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/file.h @@ -0,0 +1,54 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FILE_H +#define AVUTIL_FILE_H + +#include + +#include "avutil.h" + +/** + * @file + * Misc file utilities. + */ + +/** + * Read the file with name filename, and put its content in a newly + * allocated buffer or map it with mmap() when available. + * In case of success set *bufptr to the read or mmapped buffer, and + * *size to the size in bytes of the buffer in *bufptr. + * The returned buffer must be released with av_file_unmap(). + * + * @param log_offset loglevel offset used for logging + * @param log_ctx context used for logging + * @return a non negative number in case of success, a negative value + * corresponding to an AVERROR error code in case of failure + */ +int av_file_map(const char *filename, uint8_t **bufptr, size_t *size, + int log_offset, void *log_ctx); + +/** + * Unmap or free the buffer bufptr created by av_file_map(). + * + * @param size size in bytes of bufptr, must be the same as returned + * by av_file_map() + */ +void av_file_unmap(uint8_t *bufptr, size_t size); + +#endif /* AVUTIL_FILE_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/frame.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/frame.h new file mode 100644 index 000000000000..63ed219f478c --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/frame.h @@ -0,0 +1,552 @@ +/* + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu_frame + * reference-counted frame API + */ + +#ifndef AVUTIL_FRAME_H +#define AVUTIL_FRAME_H + +#include + +#include "avutil.h" +#include "buffer.h" +#include "dict.h" +#include "rational.h" +#include "samplefmt.h" +#include "version.h" + + +/** + * @defgroup lavu_frame AVFrame + * @ingroup lavu_data + * + * @{ + * AVFrame is an abstraction for reference-counted raw multimedia data. + */ + +enum AVFrameSideDataType { + /** + * The data is the AVPanScan struct defined in libavcodec. + */ + AV_FRAME_DATA_PANSCAN, + /** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + */ + AV_FRAME_DATA_A53_CC, + /** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + */ + AV_FRAME_DATA_STEREO3D, + /** + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. + */ + AV_FRAME_DATA_MATRIXENCODING, + /** + * Metadata relevant to a downmix procedure. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. + */ + AV_FRAME_DATA_DOWNMIX_INFO, +}; + +typedef struct AVFrameSideData { + enum AVFrameSideDataType type; + uint8_t *data; + int size; + AVDictionary *metadata; +} AVFrameSideData; + +/** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using av_frame_alloc(). Note that this only + * allocates the AVFrame itself, the buffers for the data must be managed + * through other means (see below). + * AVFrame must be freed with av_frame_free(). + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, av_frame_unref() will free any references held by + * the frame and reset it to its original clean state before it + * is reused again. + * + * The data described by an AVFrame is usually reference counted through the + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, + * every single data plane must be contained in one of the buffers in + * AVFrame.buf or AVFrame.extended_buf. + * There may be a single buffer for all the data, or one separate buffer for + * each plane, or anything in between. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + */ +typedef struct AVFrame { +#define AV_NUM_DATA_POINTERS 8 + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * For video, size in bytes of each picture line. + * For audio, size in bytes of each plane. + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data should always be set in a valid frame, + * but for planar audio with more channels that can fit in data, + * extended_data must be used in order to access all channels. + */ + uint8_t **extended_data; + + /** + * width and height of the video frame + */ + int width, height; + + /** + * number of audio samples (per channel) described by this frame + */ + int nb_samples; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + */ + int format; + + /** + * 1 -> keyframe, 0-> not + */ + int key_frame; + + /** + * Picture type of the frame. + */ + enum AVPictureType pict_type; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + uint8_t *base[AV_NUM_DATA_POINTERS]; +#endif + + /** + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. + */ + AVRational sample_aspect_ratio; + + /** + * Presentation timestamp in time_base units (time when frame should be shown to user). + */ + int64_t pts; + + /** + * PTS copied from the AVPacket that was decoded to produce this frame. + */ + int64_t pkt_pts; + + /** + * DTS copied from the AVPacket that triggered returning this frame. + */ + int64_t pkt_dts; + + /** + * picture number in bitstream order + */ + int coded_picture_number; + /** + * picture number in display order + */ + int display_picture_number; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + */ + int quality; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int reference; + + /** + * QP table + */ + attribute_deprecated + int8_t *qscale_table; + /** + * QP store stride + */ + attribute_deprecated + int qstride; + + attribute_deprecated + int qscale_type; + + /** + * mbskip_table[mb]>=1 if MB didn't change + * stride= mb_width = (width+15)>>4 + */ + attribute_deprecated + uint8_t *mbskip_table; + + /** + * motion vector table + * @code + * example: + * int mv_sample_log2= 4 - motion_subsample_log2; + * int mb_width= (width+15)>>4; + * int mv_stride= (mb_width << mv_sample_log2) + 1; + * motion_val[direction][x + y*mv_stride][0->mv_x, 1->mv_y]; + * @endcode + */ + attribute_deprecated + int16_t (*motion_val[2])[2]; + + /** + * macroblock type table + * mb_type_base + mb_width + 2 + */ + attribute_deprecated + uint32_t *mb_type; + + /** + * DCT coefficients + */ + attribute_deprecated + short *dct_coeff; + + /** + * motion reference frame index + * the order in which these are stored can depend on the codec. + */ + attribute_deprecated + int8_t *ref_index[2]; +#endif + + /** + * for some private data of the user + */ + void *opaque; + + /** + * error + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int type; +#endif + + /** + * When decoding, this signals how much the picture must be delayed. + * extra_delay = repeat_pict / (2*fps) + */ + int repeat_pict; + + /** + * The content of the picture is interlaced. + */ + int interlaced_frame; + + /** + * If the content is interlaced, is top field displayed first. + */ + int top_field_first; + + /** + * Tell user application that palette has changed from previous frame. + */ + int palette_has_changed; + +#if FF_API_AVFRAME_LAVC + attribute_deprecated + int buffer_hints; + + /** + * Pan scan. + */ + attribute_deprecated + struct AVPanScan *pan_scan; +#endif + + /** + * reordered opaque 64bit (generally an integer or a double precision float + * PTS but can be anything). + * The user sets AVCodecContext.reordered_opaque to represent the input at + * that time, + * the decoder reorders values as needed and sets AVFrame.reordered_opaque + * to exactly one of the values provided by the user through AVCodecContext.reordered_opaque + * @deprecated in favor of pkt_pts + */ + int64_t reordered_opaque; + +#if FF_API_AVFRAME_LAVC + /** + * @deprecated this field is unused + */ + attribute_deprecated void *hwaccel_picture_private; + + attribute_deprecated + struct AVCodecContext *owner; + attribute_deprecated + void *thread_opaque; + + /** + * log2 of the size of the block which a single vector in motion_val represents: + * (4->16x16, 3->8x8, 2-> 4x4, 1-> 2x2) + */ + attribute_deprecated + uint8_t motion_subsample_log2; +#endif + + /** + * Sample rate of the audio data. + */ + int sample_rate; + + /** + * Channel layout of the audio data. + */ + uint64_t channel_layout; + + /** + * AVBuffer references backing the data for this frame. If all elements of + * this array are NULL, then this frame is not reference counted. + * + * There may be at most one AVBuffer per data plane, so for video this array + * always contains all the references. For planar audio with more than + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in + * this array. Then the extra AVBufferRef pointers are stored in the + * extended_buf array. + */ + AVBufferRef *buf[AV_NUM_DATA_POINTERS]; + + /** + * For planar audio which requires more than AV_NUM_DATA_POINTERS + * AVBufferRef pointers, this array will hold all the references which + * cannot fit into AVFrame.buf. + * + * Note that this is different from AVFrame.extended_data, which always + * contains all the pointers. This array only contains the extra pointers, + * which cannot fit into AVFrame.buf. + * + * This array is always allocated using av_malloc() by whoever constructs + * the frame. It is freed in av_frame_unref(). + */ + AVBufferRef **extended_buf; + /** + * Number of elements in extended_buf. + */ + int nb_extended_buf; + + AVFrameSideData **side_data; + int nb_side_data; + +/** + * @defgroup lavu_frame_flags AV_FRAME_FLAGS + * Flags describing additional frame properties. + * + * @{ + */ + +/** + * The frame data may be corrupted, e.g. due to decoding errors. + */ +#define AV_FRAME_FLAG_CORRUPT (1 << 0) +/** + * @} + */ + + /** + * Frame flags, a combination of @ref lavu_frame_flags + */ + int flags; +} AVFrame; + +/** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using av_frame_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * + * @note this only allocates the AVFrame itself, not the data buffers. Those + * must be allocated through other means, e.g. with av_frame_get_buffer() or + * manually. + */ +AVFrame *av_frame_alloc(void); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. If the frame is reference counted, it will be + * unreferenced first. + * + * @param frame frame to be freed. The pointer will be set to NULL. + */ +void av_frame_free(AVFrame **frame); + +/** + * Set up a new reference to the data described by the source frame. + * + * Copy frame properties from src to dst and create a new reference for each + * AVBufferRef from src. + * + * If src is not reference counted, new buffers are allocated and the data is + * copied. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_frame_ref(AVFrame *dst, const AVFrame *src); + +/** + * Create a new frame that references the same data as src. + * + * This is a shortcut for av_frame_alloc()+av_frame_ref(). + * + * @return newly created AVFrame on success, NULL on error. + */ +AVFrame *av_frame_clone(const AVFrame *src); + +/** + * Unreference all the buffers referenced by frame and reset the frame fields. + */ +void av_frame_unref(AVFrame *frame); + +/** + * Move everythnig contained in src to dst and reset src. + */ +void av_frame_move_ref(AVFrame *dst, AVFrame *src); + +/** + * Allocate new buffer(s) for audio or video data. + * + * The following fields must be set on frame before calling this function: + * - format (pixel format for video, sample format for audio) + * - width and height for video + * - nb_samples and channel_layout for audio + * + * This function will fill AVFrame.data and AVFrame.buf arrays and, if + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. + * For planar formats, one buffer will be allocated for each plane. + * + * @param frame frame in which to store the new buffers. + * @param align required buffer size alignment + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_frame_get_buffer(AVFrame *frame, int align); + +/** + * Check if the frame data is writable. + * + * @return A positive value if the frame data is writable (which is true if and + * only if each of the underlying buffers has only one reference, namely the one + * stored in this frame). Return 0 otherwise. + * + * If 1 is returned the answer is valid until av_buffer_ref() is called on any + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). + * + * @see av_frame_make_writable(), av_buffer_is_writable() + */ +int av_frame_is_writable(AVFrame *frame); + +/** + * Ensure that the frame data is writable, avoiding data copy if possible. + * + * Do nothing if the frame is writable, allocate new buffers and copy the data + * if it is not. + * + * @return 0 on success, a negative AVERROR on error. + * + * @see av_frame_is_writable(), av_buffer_is_writable(), + * av_buffer_make_writable() + */ +int av_frame_make_writable(AVFrame *frame); + +/** + * Copy only "metadata" fields from src to dst. + * + * Metadata for the purpose of this function are those fields that do not affect + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample + * aspect ratio (for video), but not width/height or channel layout. + * Side data is also copied. + */ +int av_frame_copy_props(AVFrame *dst, const AVFrame *src); + +/** + * Get the buffer reference a given data plane is stored in. + * + * @param plane index of the data plane of interest in frame->extended_data. + * + * @return the buffer reference that contains the plane or NULL if the input + * frame is not valid. + */ +AVBufferRef *av_frame_get_plane_buffer(AVFrame *frame, int plane); + +/** + * Add a new side data to a frame. + * + * @param frame a frame to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + */ +AVFrameSideData *av_frame_new_side_data(AVFrame *frame, + enum AVFrameSideDataType type, + int size); + +/** + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this frame. + */ +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, + enum AVFrameSideDataType type); + +/** + * @} + */ + +#endif /* AVUTIL_FRAME_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/hmac.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/hmac.h new file mode 100644 index 000000000000..28c2062b1b9f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/hmac.h @@ -0,0 +1,95 @@ +/* + * Copyright (C) 2012 Martin Storsjo + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_HMAC_H +#define AVUTIL_HMAC_H + +#include + +/** + * @defgroup lavu_hmac HMAC + * @ingroup lavu_crypto + * @{ + */ + +enum AVHMACType { + AV_HMAC_MD5, + AV_HMAC_SHA1, +}; + +typedef struct AVHMAC AVHMAC; + +/** + * Allocate an AVHMAC context. + * @param type The hash function used for the HMAC. + */ +AVHMAC *av_hmac_alloc(enum AVHMACType type); + +/** + * Free an AVHMAC context. + * @param ctx The context to free, may be NULL + */ +void av_hmac_free(AVHMAC *ctx); + +/** + * Initialize an AVHMAC context with an authentication key. + * @param ctx The HMAC context + * @param key The authentication key + * @param keylen The length of the key, in bytes + */ +void av_hmac_init(AVHMAC *ctx, const uint8_t *key, unsigned int keylen); + +/** + * Hash data with the HMAC. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + */ +void av_hmac_update(AVHMAC *ctx, const uint8_t *data, unsigned int len); + +/** + * Finish hashing and output the HMAC digest. + * @param ctx The HMAC context + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_final(AVHMAC *ctx, uint8_t *out, unsigned int outlen); + +/** + * Hash an array of data with a key. + * @param ctx The HMAC context + * @param data The data to hash + * @param len The length of the data, in bytes + * @param key The authentication key + * @param keylen The length of the key, in bytes + * @param out The output buffer to write the digest into + * @param outlen The length of the out buffer, in bytes + * @return The number of bytes written to out, or a negative error code. + */ +int av_hmac_calc(AVHMAC *ctx, const uint8_t *data, unsigned int len, + const uint8_t *key, unsigned int keylen, + uint8_t *out, unsigned int outlen); + +/** + * @} + */ + +#endif /* AVUTIL_HMAC_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/imgutils.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/imgutils.h new file mode 100644 index 000000000000..71510132ae73 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/imgutils.h @@ -0,0 +1,138 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_IMGUTILS_H +#define AVUTIL_IMGUTILS_H + +/** + * @file + * misc image utilities + * + * @addtogroup lavu_picture + * @{ + */ + +#include "avutil.h" +#include "pixdesc.h" + +/** + * Compute the max pixel step for each plane of an image with a + * format described by pixdesc. + * + * The pixel step is the distance in bytes between the first byte of + * the group of bytes which describe a pixel component and the first + * byte of the successive group in the same plane for the same + * component. + * + * @param max_pixsteps an array which is filled with the max pixel step + * for each plane. Since a plane may contain different pixel + * components, the computed max_pixsteps[plane] is relative to the + * component in the plane with the max pixel step. + * @param max_pixstep_comps an array which is filled with the component + * for each plane which has the max pixel step. May be NULL. + */ +void av_image_fill_max_pixsteps(int max_pixsteps[4], int max_pixstep_comps[4], + const AVPixFmtDescriptor *pixdesc); + +/** + * Compute the size of an image line with format pix_fmt and width + * width for the plane plane. + * + * @return the computed size in bytes + */ +int av_image_get_linesize(enum AVPixelFormat pix_fmt, int width, int plane); + +/** + * Fill plane linesizes for an image with pixel format pix_fmt and + * width width. + * + * @param linesizes array to be filled with the linesize for each plane + * @return >= 0 in case of success, a negative error code otherwise + */ +int av_image_fill_linesizes(int linesizes[4], enum AVPixelFormat pix_fmt, int width); + +/** + * Fill plane data pointers for an image with pixel format pix_fmt and + * height height. + * + * @param data pointers array to be filled with the pointer for each image plane + * @param ptr the pointer to a buffer which will contain the image + * @param linesizes the array containing the linesize for each + * plane, should be filled by av_image_fill_linesizes() + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_fill_pointers(uint8_t *data[4], enum AVPixelFormat pix_fmt, int height, + uint8_t *ptr, const int linesizes[4]); + +/** + * Allocate an image with size w and h and pixel format pix_fmt, and + * fill pointers and linesizes accordingly. + * The allocated image buffer has to be freed by using + * av_freep(&pointers[0]). + * + * @param align the value to use for buffer size alignment + * @return the size in bytes required for the image buffer, a negative + * error code in case of failure + */ +int av_image_alloc(uint8_t *pointers[4], int linesizes[4], + int w, int h, enum AVPixelFormat pix_fmt, int align); + +/** + * Copy image plane from src to dst. + * That is, copy "height" number of lines of "bytewidth" bytes each. + * The first byte of each successive line is separated by *_linesize + * bytes. + * + * @param dst_linesize linesize for the image plane in dst + * @param src_linesize linesize for the image plane in src + */ +void av_image_copy_plane(uint8_t *dst, int dst_linesize, + const uint8_t *src, int src_linesize, + int bytewidth, int height); + +/** + * Copy image in src_data to dst_data. + * + * @param dst_linesizes linesizes for the image in dst_data + * @param src_linesizes linesizes for the image in src_data + */ +void av_image_copy(uint8_t *dst_data[4], int dst_linesizes[4], + const uint8_t *src_data[4], const int src_linesizes[4], + enum AVPixelFormat pix_fmt, int width, int height); + +/** + * Check if the given dimension of an image is valid, meaning that all + * bytes of the image can be addressed with a signed int. + * + * @param w the width of the picture + * @param h the height of the picture + * @param log_offset the offset to sum to the log level for logging with log_ctx + * @param log_ctx the parent logging context, it may be NULL + * @return >= 0 if valid, a negative error code otherwise + */ +int av_image_check_size(unsigned int w, unsigned int h, int log_offset, void *log_ctx); + +int avpriv_set_systematic_pal2(uint32_t pal[256], enum AVPixelFormat pix_fmt); + +/** + * @} + */ + + +#endif /* AVUTIL_IMGUTILS_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/intfloat.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/intfloat.h new file mode 100644 index 000000000000..38d26ad87e12 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/intfloat.h @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTFLOAT_H +#define AVUTIL_INTFLOAT_H + +#include +#include "attributes.h" + +union av_intfloat32 { + uint32_t i; + float f; +}; + +union av_intfloat64 { + uint64_t i; + double f; +}; + +/** + * Reinterpret a 32-bit integer as a float. + */ +static av_always_inline float av_int2float(uint32_t i) +{ + union av_intfloat32 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a float as a 32-bit integer. + */ +static av_always_inline uint32_t av_float2int(float f) +{ + union av_intfloat32 v; + v.f = f; + return v.i; +} + +/** + * Reinterpret a 64-bit integer as a double. + */ +static av_always_inline double av_int2double(uint64_t i) +{ + union av_intfloat64 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a double as a 64-bit integer. + */ +static av_always_inline uint64_t av_double2int(double f) +{ + union av_intfloat64 v; + v.f = f; + return v.i; +} + +#endif /* AVUTIL_INTFLOAT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/intreadwrite.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/intreadwrite.h new file mode 100644 index 000000000000..f77fd60f383f --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/intreadwrite.h @@ -0,0 +1,549 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_INTREADWRITE_H +#define AVUTIL_INTREADWRITE_H + +#include +#include "libavutil/avconfig.h" +#include "attributes.h" +#include "bswap.h" + +typedef union { + uint64_t u64; + uint32_t u32[2]; + uint16_t u16[4]; + uint8_t u8 [8]; + double f64; + float f32[2]; +} av_alias av_alias64; + +typedef union { + uint32_t u32; + uint16_t u16[2]; + uint8_t u8 [4]; + float f32; +} av_alias av_alias32; + +typedef union { + uint16_t u16; + uint8_t u8 [2]; +} av_alias av_alias16; + +/* + * Arch-specific headers can provide any combination of + * AV_[RW][BLN](16|24|32|64) and AV_(COPY|SWAP|ZERO)(64|128) macros. + * Preprocessor symbols must be defined, even if these are implemented + * as inline functions. + */ + +#ifdef HAVE_AV_CONFIG_H + +#include "config.h" + +#if ARCH_ARM +# include "arm/intreadwrite.h" +#elif ARCH_AVR32 +# include "avr32/intreadwrite.h" +#elif ARCH_MIPS +# include "mips/intreadwrite.h" +#elif ARCH_PPC +# include "ppc/intreadwrite.h" +#elif ARCH_TOMI +# include "tomi/intreadwrite.h" +#elif ARCH_X86 +# include "x86/intreadwrite.h" +#endif + +#endif /* HAVE_AV_CONFIG_H */ + +/* + * Map AV_RNXX <-> AV_R[BL]XX for all variants provided by per-arch headers. + */ + +#if AV_HAVE_BIGENDIAN + +# if defined(AV_RN16) && !defined(AV_RB16) +# define AV_RB16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RB16) +# define AV_RN16(p) AV_RB16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WB16) +# define AV_WB16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WB16) +# define AV_WN16(p, v) AV_WB16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RB24) +# define AV_RB24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RB24) +# define AV_RN24(p) AV_RB24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WB24) +# define AV_WB24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WB24) +# define AV_WN24(p, v) AV_WB24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RB32) +# define AV_RB32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RB32) +# define AV_RN32(p) AV_RB32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WB32) +# define AV_WB32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WB32) +# define AV_WN32(p, v) AV_WB32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RB64) +# define AV_RB64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RB64) +# define AV_RN64(p) AV_RB64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WB64) +# define AV_WB64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WB64) +# define AV_WN64(p, v) AV_WB64(p, v) +# endif + +#else /* AV_HAVE_BIGENDIAN */ + +# if defined(AV_RN16) && !defined(AV_RL16) +# define AV_RL16(p) AV_RN16(p) +# elif !defined(AV_RN16) && defined(AV_RL16) +# define AV_RN16(p) AV_RL16(p) +# endif + +# if defined(AV_WN16) && !defined(AV_WL16) +# define AV_WL16(p, v) AV_WN16(p, v) +# elif !defined(AV_WN16) && defined(AV_WL16) +# define AV_WN16(p, v) AV_WL16(p, v) +# endif + +# if defined(AV_RN24) && !defined(AV_RL24) +# define AV_RL24(p) AV_RN24(p) +# elif !defined(AV_RN24) && defined(AV_RL24) +# define AV_RN24(p) AV_RL24(p) +# endif + +# if defined(AV_WN24) && !defined(AV_WL24) +# define AV_WL24(p, v) AV_WN24(p, v) +# elif !defined(AV_WN24) && defined(AV_WL24) +# define AV_WN24(p, v) AV_WL24(p, v) +# endif + +# if defined(AV_RN32) && !defined(AV_RL32) +# define AV_RL32(p) AV_RN32(p) +# elif !defined(AV_RN32) && defined(AV_RL32) +# define AV_RN32(p) AV_RL32(p) +# endif + +# if defined(AV_WN32) && !defined(AV_WL32) +# define AV_WL32(p, v) AV_WN32(p, v) +# elif !defined(AV_WN32) && defined(AV_WL32) +# define AV_WN32(p, v) AV_WL32(p, v) +# endif + +# if defined(AV_RN64) && !defined(AV_RL64) +# define AV_RL64(p) AV_RN64(p) +# elif !defined(AV_RN64) && defined(AV_RL64) +# define AV_RN64(p) AV_RL64(p) +# endif + +# if defined(AV_WN64) && !defined(AV_WL64) +# define AV_WL64(p, v) AV_WN64(p, v) +# elif !defined(AV_WN64) && defined(AV_WL64) +# define AV_WN64(p, v) AV_WL64(p, v) +# endif + +#endif /* !AV_HAVE_BIGENDIAN */ + +/* + * Define AV_[RW]N helper macros to simplify definitions not provided + * by per-arch headers. + */ + +#if defined(__GNUC__) && !defined(__TI_COMPILER_VERSION__) + +union unaligned_64 { uint64_t l; } __attribute__((packed)) av_alias; +union unaligned_32 { uint32_t l; } __attribute__((packed)) av_alias; +union unaligned_16 { uint16_t l; } __attribute__((packed)) av_alias; + +# define AV_RN(s, p) (((const union unaligned_##s *) (p))->l) +# define AV_WN(s, p, v) ((((union unaligned_##s *) (p))->l) = (v)) + +#elif defined(__DECC) + +# define AV_RN(s, p) (*((const __unaligned uint##s##_t*)(p))) +# define AV_WN(s, p, v) (*((__unaligned uint##s##_t*)(p)) = (v)) + +#elif AV_HAVE_FAST_UNALIGNED + +# define AV_RN(s, p) (((const av_alias##s*)(p))->u##s) +# define AV_WN(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#else + +#ifndef AV_RB16 +# define AV_RB16(x) \ + ((((const uint8_t*)(x))[0] << 8) | \ + ((const uint8_t*)(x))[1]) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, d) do { \ + ((uint8_t*)(p))[1] = (d); \ + ((uint8_t*)(p))[0] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RL16 +# define AV_RL16(x) \ + ((((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + } while(0) +#endif + +#ifndef AV_RB32 +# define AV_RB32(x) \ + (((uint32_t)((const uint8_t*)(x))[0] << 24) | \ + (((const uint8_t*)(x))[1] << 16) | \ + (((const uint8_t*)(x))[2] << 8) | \ + ((const uint8_t*)(x))[3]) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, d) do { \ + ((uint8_t*)(p))[3] = (d); \ + ((uint8_t*)(p))[2] = (d)>>8; \ + ((uint8_t*)(p))[1] = (d)>>16; \ + ((uint8_t*)(p))[0] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RL32 +# define AV_RL32(x) \ + (((uint32_t)((const uint8_t*)(x))[3] << 24) | \ + (((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + } while(0) +#endif + +#ifndef AV_RB64 +# define AV_RB64(x) \ + (((uint64_t)((const uint8_t*)(x))[0] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 8) | \ + (uint64_t)((const uint8_t*)(x))[7]) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, d) do { \ + ((uint8_t*)(p))[7] = (d); \ + ((uint8_t*)(p))[6] = (d)>>8; \ + ((uint8_t*)(p))[5] = (d)>>16; \ + ((uint8_t*)(p))[4] = (d)>>24; \ + ((uint8_t*)(p))[3] = (d)>>32; \ + ((uint8_t*)(p))[2] = (d)>>40; \ + ((uint8_t*)(p))[1] = (d)>>48; \ + ((uint8_t*)(p))[0] = (d)>>56; \ + } while(0) +#endif + +#ifndef AV_RL64 +# define AV_RL64(x) \ + (((uint64_t)((const uint8_t*)(x))[7] << 56) | \ + ((uint64_t)((const uint8_t*)(x))[6] << 48) | \ + ((uint64_t)((const uint8_t*)(x))[5] << 40) | \ + ((uint64_t)((const uint8_t*)(x))[4] << 32) | \ + ((uint64_t)((const uint8_t*)(x))[3] << 24) | \ + ((uint64_t)((const uint8_t*)(x))[2] << 16) | \ + ((uint64_t)((const uint8_t*)(x))[1] << 8) | \ + (uint64_t)((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + ((uint8_t*)(p))[3] = (d)>>24; \ + ((uint8_t*)(p))[4] = (d)>>32; \ + ((uint8_t*)(p))[5] = (d)>>40; \ + ((uint8_t*)(p))[6] = (d)>>48; \ + ((uint8_t*)(p))[7] = (d)>>56; \ + } while(0) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RN(s, p) AV_RB##s(p) +# define AV_WN(s, p, v) AV_WB##s(p, v) +#else +# define AV_RN(s, p) AV_RL##s(p) +# define AV_WN(s, p, v) AV_WL##s(p, v) +#endif + +#endif /* HAVE_FAST_UNALIGNED */ + +#ifndef AV_RN16 +# define AV_RN16(p) AV_RN(16, p) +#endif + +#ifndef AV_RN32 +# define AV_RN32(p) AV_RN(32, p) +#endif + +#ifndef AV_RN64 +# define AV_RN64(p) AV_RN(64, p) +#endif + +#ifndef AV_WN16 +# define AV_WN16(p, v) AV_WN(16, p, v) +#endif + +#ifndef AV_WN32 +# define AV_WN32(p, v) AV_WN(32, p, v) +#endif + +#ifndef AV_WN64 +# define AV_WN64(p, v) AV_WN(64, p, v) +#endif + +#if AV_HAVE_BIGENDIAN +# define AV_RB(s, p) AV_RN##s(p) +# define AV_WB(s, p, v) AV_WN##s(p, v) +# define AV_RL(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WL(s, p, v) AV_WN##s(p, av_bswap##s(v)) +#else +# define AV_RB(s, p) av_bswap##s(AV_RN##s(p)) +# define AV_WB(s, p, v) AV_WN##s(p, av_bswap##s(v)) +# define AV_RL(s, p) AV_RN##s(p) +# define AV_WL(s, p, v) AV_WN##s(p, v) +#endif + +#define AV_RB8(x) (((const uint8_t*)(x))[0]) +#define AV_WB8(p, d) do { ((uint8_t*)(p))[0] = (d); } while(0) + +#define AV_RL8(x) AV_RB8(x) +#define AV_WL8(p, d) AV_WB8(p, d) + +#ifndef AV_RB16 +# define AV_RB16(p) AV_RB(16, p) +#endif +#ifndef AV_WB16 +# define AV_WB16(p, v) AV_WB(16, p, v) +#endif + +#ifndef AV_RL16 +# define AV_RL16(p) AV_RL(16, p) +#endif +#ifndef AV_WL16 +# define AV_WL16(p, v) AV_WL(16, p, v) +#endif + +#ifndef AV_RB32 +# define AV_RB32(p) AV_RB(32, p) +#endif +#ifndef AV_WB32 +# define AV_WB32(p, v) AV_WB(32, p, v) +#endif + +#ifndef AV_RL32 +# define AV_RL32(p) AV_RL(32, p) +#endif +#ifndef AV_WL32 +# define AV_WL32(p, v) AV_WL(32, p, v) +#endif + +#ifndef AV_RB64 +# define AV_RB64(p) AV_RB(64, p) +#endif +#ifndef AV_WB64 +# define AV_WB64(p, v) AV_WB(64, p, v) +#endif + +#ifndef AV_RL64 +# define AV_RL64(p) AV_RL(64, p) +#endif +#ifndef AV_WL64 +# define AV_WL64(p, v) AV_WL(64, p, v) +#endif + +#ifndef AV_RB24 +# define AV_RB24(x) \ + ((((const uint8_t*)(x))[0] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[2]) +#endif +#ifndef AV_WB24 +# define AV_WB24(p, d) do { \ + ((uint8_t*)(p))[2] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[0] = (d)>>16; \ + } while(0) +#endif + +#ifndef AV_RL24 +# define AV_RL24(x) \ + ((((const uint8_t*)(x))[2] << 16) | \ + (((const uint8_t*)(x))[1] << 8) | \ + ((const uint8_t*)(x))[0]) +#endif +#ifndef AV_WL24 +# define AV_WL24(p, d) do { \ + ((uint8_t*)(p))[0] = (d); \ + ((uint8_t*)(p))[1] = (d)>>8; \ + ((uint8_t*)(p))[2] = (d)>>16; \ + } while(0) +#endif + +/* + * The AV_[RW]NA macros access naturally aligned data + * in a type-safe way. + */ + +#define AV_RNA(s, p) (((const av_alias##s*)(p))->u##s) +#define AV_WNA(s, p, v) (((av_alias##s*)(p))->u##s = (v)) + +#ifndef AV_RN16A +# define AV_RN16A(p) AV_RNA(16, p) +#endif + +#ifndef AV_RN32A +# define AV_RN32A(p) AV_RNA(32, p) +#endif + +#ifndef AV_RN64A +# define AV_RN64A(p) AV_RNA(64, p) +#endif + +#ifndef AV_WN16A +# define AV_WN16A(p, v) AV_WNA(16, p, v) +#endif + +#ifndef AV_WN32A +# define AV_WN32A(p, v) AV_WNA(32, p, v) +#endif + +#ifndef AV_WN64A +# define AV_WN64A(p, v) AV_WNA(64, p, v) +#endif + +/* + * The AV_COPYxxU macros are suitable for copying data to/from unaligned + * memory locations. + */ + +#define AV_COPYU(n, d, s) AV_WN##n(d, AV_RN##n(s)); + +#ifndef AV_COPY16U +# define AV_COPY16U(d, s) AV_COPYU(16, d, s) +#endif + +#ifndef AV_COPY32U +# define AV_COPY32U(d, s) AV_COPYU(32, d, s) +#endif + +#ifndef AV_COPY64U +# define AV_COPY64U(d, s) AV_COPYU(64, d, s) +#endif + +#ifndef AV_COPY128U +# define AV_COPY128U(d, s) \ + do { \ + AV_COPY64U(d, s); \ + AV_COPY64U((char *)(d) + 8, (const char *)(s) + 8); \ + } while(0) +#endif + +/* Parameters for AV_COPY*, AV_SWAP*, AV_ZERO* must be + * naturally aligned. They may be implemented using MMX, + * so emms_c() must be called before using any float code + * afterwards. + */ + +#define AV_COPY(n, d, s) \ + (((av_alias##n*)(d))->u##n = ((const av_alias##n*)(s))->u##n) + +#ifndef AV_COPY16 +# define AV_COPY16(d, s) AV_COPY(16, d, s) +#endif + +#ifndef AV_COPY32 +# define AV_COPY32(d, s) AV_COPY(32, d, s) +#endif + +#ifndef AV_COPY64 +# define AV_COPY64(d, s) AV_COPY(64, d, s) +#endif + +#ifndef AV_COPY128 +# define AV_COPY128(d, s) \ + do { \ + AV_COPY64(d, s); \ + AV_COPY64((char*)(d)+8, (char*)(s)+8); \ + } while(0) +#endif + +#define AV_SWAP(n, a, b) FFSWAP(av_alias##n, *(av_alias##n*)(a), *(av_alias##n*)(b)) + +#ifndef AV_SWAP64 +# define AV_SWAP64(a, b) AV_SWAP(64, a, b) +#endif + +#define AV_ZERO(n, d) (((av_alias##n*)(d))->u##n = 0) + +#ifndef AV_ZERO16 +# define AV_ZERO16(d) AV_ZERO(16, d) +#endif + +#ifndef AV_ZERO32 +# define AV_ZERO32(d) AV_ZERO(32, d) +#endif + +#ifndef AV_ZERO64 +# define AV_ZERO64(d) AV_ZERO(64, d) +#endif + +#ifndef AV_ZERO128 +# define AV_ZERO128(d) \ + do { \ + AV_ZERO64(d); \ + AV_ZERO64((char*)(d)+8); \ + } while(0) +#endif + +#endif /* AVUTIL_INTREADWRITE_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/lfg.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/lfg.h new file mode 100644 index 000000000000..5e526c1dae21 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/lfg.h @@ -0,0 +1,62 @@ +/* + * Lagged Fibonacci PRNG + * Copyright (c) 2008 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LFG_H +#define AVUTIL_LFG_H + +typedef struct AVLFG { + unsigned int state[64]; + int index; +} AVLFG; + +void av_lfg_init(AVLFG *c, unsigned int seed); + +/** + * Get the next random unsigned 32-bit number using an ALFG. + * + * Please also consider a simple LCG like state= state*1664525+1013904223, + * it may be good enough and faster for your specific use case. + */ +static inline unsigned int av_lfg_get(AVLFG *c){ + c->state[c->index & 63] = c->state[(c->index-24) & 63] + c->state[(c->index-55) & 63]; + return c->state[c->index++ & 63]; +} + +/** + * Get the next random unsigned 32-bit number using a MLFG. + * + * Please also consider av_lfg_get() above, it is faster. + */ +static inline unsigned int av_mlfg_get(AVLFG *c){ + unsigned int a= c->state[(c->index-55) & 63]; + unsigned int b= c->state[(c->index-24) & 63]; + return c->state[c->index++ & 63] = 2*a*b+a+b; +} + +/** + * Get the next two numbers generated by a Box-Muller Gaussian + * generator using the random numbers issued by lfg. + * + * @param out array where the two generated numbers are placed + */ +void av_bmg_get(AVLFG *lfg, double out[2]); + +#endif /* AVUTIL_LFG_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/log.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/log.h new file mode 100644 index 000000000000..6d26b67db85d --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/log.h @@ -0,0 +1,262 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LOG_H +#define AVUTIL_LOG_H + +#include +#include "avutil.h" +#include "attributes.h" + +/** + * Describe the class of an AVClass context structure. That is an + * arbitrary struct of which the first field is a pointer to an + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). + */ +typedef struct AVClass { + /** + * The name of the class; usually it is the same name as the + * context structure type to which the AVClass is associated. + */ + const char* class_name; + + /** + * A pointer to a function which returns the name of a context + * instance ctx associated with the class. + */ + const char* (*item_name)(void* ctx); + + /** + * a pointer to the first option specified in the class if any or NULL + * + * @see av_set_default_options() + */ + const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added without requiring major + * version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where log_level_offset is stored. + * 0 means there is no such variable + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an av_log() implementation + * could then leverage to display the parent context. + * The offset can be NULL. + */ + int parent_log_context_offset; + + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** + * Return an AVClass corresponding to the next potential + * AVOptions-enabled child. + * + * The difference between child_next and this is that + * child_next iterates over _already existing_ objects, while + * child_class_next iterates over _all possible_ children. + */ + const struct AVClass* (*child_class_next)(const struct AVClass *prev); +} AVClass; + +/** + * @addtogroup lavu_log + * + * @{ + * + * @defgroup lavu_log_constants Logging Constants + * + * @{ + */ + +/** + * Print no output. + */ +#define AV_LOG_QUIET -8 + +/** + * Something went really wrong and we will crash now. + */ +#define AV_LOG_PANIC 0 + +/** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + */ +#define AV_LOG_FATAL 8 + +/** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + */ +#define AV_LOG_ERROR 16 + +/** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + */ +#define AV_LOG_WARNING 24 + +/** + * Standard information. + */ +#define AV_LOG_INFO 32 + +/** + * Detailed information. + */ +#define AV_LOG_VERBOSE 40 + +/** + * Stuff which is only useful for libav* developers. + */ +#define AV_LOG_DEBUG 48 + +/** + * @} + */ + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + */ +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); + + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_vlog(void *avcl, int level, const char *fmt, va_list vl); + +/** + * Get the current log level + * + * @see lavu_log_constants + * + * @return Current log level + */ +int av_log_get_level(void); + +/** + * Set the log level + * + * @see lavu_log_constants + * + * @param level Logging level + */ +void av_log_set_level(int level); + +/** + * Set the logging callback + * + * @see av_log_default_callback + * + * @param callback A logging function with a compatible signature. + */ +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); + +/** + * Default logging callback + * + * It prints the message to stderr, optionally colorizing it. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_log_default_callback(void *avcl, int level, const char *fmt, + va_list vl); + +/** + * Return the context name + * + * @param ctx The AVClass context + * + * @return The AVClass class_name + */ +const char* av_default_item_name(void* ctx); + +/** + * av_dlog macros + * Useful to print debug messages that shouldn't get compiled in normally. + */ + +#ifdef DEBUG +# define av_dlog(pctx, ...) av_log(pctx, AV_LOG_DEBUG, __VA_ARGS__) +#else +# define av_dlog(pctx, ...) +#endif + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 +void av_log_set_flags(int arg); + +/** + * @} + */ + +#endif /* AVUTIL_LOG_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/lzo.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/lzo.h new file mode 100644 index 000000000000..9d7e8f1dc10a --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/lzo.h @@ -0,0 +1,66 @@ +/* + * LZO 1x decompression + * copyright (c) 2006 Reimar Doeffinger + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_LZO_H +#define AVUTIL_LZO_H + +/** + * @defgroup lavu_lzo LZO + * @ingroup lavu_crypto + * + * @{ + */ + +#include + +/** @name Error flags returned by av_lzo1x_decode + * @{ */ +/// end of the input buffer reached before decoding finished +#define AV_LZO_INPUT_DEPLETED 1 +/// decoded data did not fit into output buffer +#define AV_LZO_OUTPUT_FULL 2 +/// a reference to previously decoded data was wrong +#define AV_LZO_INVALID_BACKPTR 4 +/// a non-specific error in the compressed bitstream +#define AV_LZO_ERROR 8 +/** @} */ + +#define AV_LZO_INPUT_PADDING 8 +#define AV_LZO_OUTPUT_PADDING 12 + +/** + * @brief Decodes LZO 1x compressed data. + * @param out output buffer + * @param outlen size of output buffer, number of bytes left are returned here + * @param in input buffer + * @param inlen size of input buffer, number of bytes left are returned here + * @return 0 on success, otherwise a combination of the error flags above + * + * Make sure all buffers are appropriately padded, in must provide + * AV_LZO_INPUT_PADDING, out must provide AV_LZO_OUTPUT_PADDING additional bytes. + */ +int av_lzo1x_decode(void *out, int *outlen, const void *in, int *inlen); + +/** + * @} + */ + +#endif /* AVUTIL_LZO_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/macros.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/macros.h new file mode 100644 index 000000000000..bf3eb9b9a459 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/macros.h @@ -0,0 +1,48 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * @ingroup lavu + * Utility Preprocessor macros + */ + +#ifndef AVUTIL_MACROS_H +#define AVUTIL_MACROS_H + +/** + * @addtogroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +/** + * @} + */ + +#define AV_PRAGMA(s) _Pragma(#s) + +#endif /* AVUTIL_MACROS_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/mathematics.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/mathematics.h new file mode 100644 index 000000000000..043dd0fafea8 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/mathematics.h @@ -0,0 +1,111 @@ +/* + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MATHEMATICS_H +#define AVUTIL_MATHEMATICS_H + +#include +#include +#include "attributes.h" +#include "rational.h" +#include "intfloat.h" + +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif +#ifndef NAN +#define NAN av_int2float(0x7fc00000) +#endif +#ifndef INFINITY +#define INFINITY av_int2float(0x7f800000) +#endif + +/** + * @addtogroup lavu_math + * @{ + */ + + +enum AVRounding { + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. +}; + +/** + * Return the greatest common divisor of a and b. + * If both a and b are 0 or either or both are <0 then behavior is + * undefined. + */ +int64_t av_const av_gcd(int64_t a, int64_t b); + +/** + * Rescale a 64-bit integer with rounding to nearest. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; + +/** + * Rescale a 64-bit integer with specified rounding. + * A simple a*b/c isn't possible as it can overflow. + */ +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers. + */ +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + */ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding) av_const; + +/** + * Compare 2 timestamps each in its own timebases. + * The result of the function is undefined if one of the timestamps + * is outside the int64_t range when represented in the others timebase. + * @return -1 if ts_a is before ts_b, 1 if ts_a is after ts_b or 0 if they represent the same position + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare 2 integers modulo mod. + * That is we compare integers a and b for which only the least + * significant log2(mod) bits are known. + * + * @param mod must be a power of 2 + * @return a negative value if a is smaller than b + * a positive value if a is greater than b + * 0 if a equals b + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * @} + */ + +#endif /* AVUTIL_MATHEMATICS_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/md5.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/md5.h new file mode 100644 index 000000000000..29e4e7c2ba2d --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/md5.h @@ -0,0 +1,51 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_MD5_H +#define AVUTIL_MD5_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_md5 MD5 + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_md5_size; +#endif + +struct AVMD5; + +struct AVMD5 *av_md5_alloc(void); +void av_md5_init(struct AVMD5 *ctx); +void av_md5_update(struct AVMD5 *ctx, const uint8_t *src, const int len); +void av_md5_final(struct AVMD5 *ctx, uint8_t *dst); +void av_md5_sum(uint8_t *dst, const uint8_t *src, const int len); + +/** + * @} + */ + +#endif /* AVUTIL_MD5_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/mem.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/mem.h new file mode 100644 index 000000000000..4a5e362cec54 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/mem.h @@ -0,0 +1,265 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include +#include + +#include "attributes.h" +#include "avutil.h" + +/** + * @addtogroup lavu_mem + * @{ + */ + + +#if defined(__ICC) && __ICC < 1200 || defined(__SUNPRO_C) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) const t __attribute__ ((aligned (n))) v +#elif defined(__TI_COMPILER_VERSION__) + #define DECLARE_ALIGNED(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + t __attribute__((aligned(n))) v + #define DECLARE_ASM_CONST(n,t,v) \ + AV_PRAGMA(DATA_ALIGN(v,n)) \ + static const t __attribute__((aligned(n))) v +#elif defined(__GNUC__) + #define DECLARE_ALIGNED(n,t,v) t __attribute__ ((aligned (n))) v + #define DECLARE_ASM_CONST(n,t,v) static const t av_used __attribute__ ((aligned (n))) v +#elif defined(_MSC_VER) + #define DECLARE_ALIGNED(n,t,v) __declspec(align(n)) t v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v +#else + #define DECLARE_ALIGNED(n,t,v) t v + #define DECLARE_ASM_CONST(n,t,v) static const t v +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) + #define av_malloc_attrib __attribute__((__malloc__)) +#else + #define av_malloc_attrib +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) +#else + #define av_alloc_size(...) +#endif + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU). + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of size * nmemb bytes with av_malloc(). + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_malloc() + */ +av_alloc_size(1, 2) static inline void *av_malloc_array(size_t nmemb, size_t size) +{ + if (!size || nmemb >= INT_MAX / size) + return NULL; + return av_malloc(nmemb * size); +} + +/** + * Allocate or reallocate a block of memory. + * If ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or NULL. + * @param size Size in bytes of the memory block to be allocated or + * reallocated. + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + * @see av_fast_realloc() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Allocate or reallocate a block of memory. + * If *ptr is NULL and size > 0, allocate a new block. If + * size is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param size Size in bytes for the memory block to be allocated or + * reallocated + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_reallocp(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +int av_reallocp(void *ptr, size_t size); + +/** + * Allocate or reallocate an array. + * If ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or NULL. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated or the function is used to free the memory block. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); + +/** + * Allocate or reallocate an array through a pointer to a pointer. + * If *ptr is NULL and nmemb > 0, allocate a new block. If + * nmemb is zero, free the memory block pointed to by ptr. + * @param ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or pointer to a pointer to NULL. + * The pointer is updated on success, or freed on failure. + * @param nmemb Number of elements + * @param size Size of the single element + * @return Zero on success, an AVERROR error code on failure. + * @warning Pointers originating from the av_malloc() family of functions must + * not be passed to av_realloc(). The former can be implemented using + * memalign() (or other functions), and there is no guarantee that + * pointers from such functions can be passed to realloc() at all. + * The situation is undefined according to POSIX and may crash with + * some libc implementations. + */ +av_alloc_size(2, 3) int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc(). + * @param ptr Pointer to the memory block which should be freed. + * @note ptr = NULL is explicitly allowed. + * @note It is recommended that you use av_freep() instead. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Allocate a block of size bytes with alignment suitable for all + * memory accesses (including vectors if available on the CPU) and + * zero all the bytes of the block. + * @param size Size in bytes for the memory block to be allocated. + * @return Pointer to the allocated block, NULL if it cannot be allocated. + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a block of size * nmemb bytes with av_mallocz(). + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, NULL if the block cannot + * be allocated. + * @see av_mallocz() + * @see av_malloc_array() + */ +av_alloc_size(1, 2) static inline void *av_mallocz_array(size_t nmemb, size_t size) +{ + if (!size || nmemb >= INT_MAX / size) + return NULL; + return av_mallocz(nmemb * size); +} + +/** + * Duplicate the string s. + * @param s string to be duplicated + * @return Pointer to a newly-allocated string containing a + * copy of s or NULL if the string cannot be allocated. + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Free a memory block which has been allocated with av_malloc(z)() or + * av_realloc() and set the pointer pointing to it to NULL. + * @param ptr Pointer to the pointer to the memory block which should + * be freed. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * deliberately overlapping memcpy implementation + * @param dst destination buffer + * @param back how many bytes back we start (the initial size of the overlapping window) + * @param cnt number of bytes to copy, must be >= 0 + * + * cnt > back is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of back. + */ +void av_memcpy_backptr(uint8_t *dst, int back, int cnt); + +/** + * Reallocate the given block if it is not large enough, otherwise do nothing. + * + * @see av_realloc + */ +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special + * handling to avoid memleaks is necessary. + * + * @param ptr pointer to pointer to already allocated buffer, overwritten with pointer to new buffer + * @param size size of the buffer *ptr points to + * @param min_size minimum size of *ptr buffer after returning, *ptr will be NULL and + * *size 0 if an error occurred. + */ +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/old_pix_fmts.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/old_pix_fmts.h new file mode 100644 index 000000000000..d3e1e5b24da4 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/old_pix_fmts.h @@ -0,0 +1,134 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OLD_PIX_FMTS_H +#define AVUTIL_OLD_PIX_FMTS_H + +/* + * This header exists to prevent new pixel formats from being accidentally added + * to the deprecated list. + * Do not include it directly. It will be removed on next major bump + * + * Do not add new items to this list. Use the AVPixelFormat enum instead. + */ + PIX_FMT_NONE = AV_PIX_FMT_NONE, + PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + PIX_FMT_GRAY8, ///< Y , 8bpp + PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC + PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + PIX_FMT_XVMC_MPEG2_IDCT, +#endif /* FF_API_XVMC */ + PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) +#if FF_API_VDPAU + PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian +#if FF_API_VDPAU + PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha + PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big endian + PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little endian + PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big endian + PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little endian + PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big endian + PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little endian + PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#endif /* AVUTIL_OLD_PIX_FMTS_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/opt.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/opt.h new file mode 100644 index 000000000000..0181379b78eb --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/opt.h @@ -0,0 +1,516 @@ +/* + * AVOptions + * copyright (c) 2005 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_OPT_H +#define AVUTIL_OPT_H + +/** + * @file + * AVOptions + */ + +#include "rational.h" +#include "avutil.h" +#include "dict.h" +#include "log.h" + +/** + * @defgroup avoptions AVOptions + * @ingroup lavu_data + * @{ + * AVOptions provide a generic system to declare options on arbitrary structs + * ("objects"). An option can have a help text, a type and a range of possible + * values. Options may then be enumerated, read and written to. + * + * @section avoptions_implement Implementing AVOptions + * This section describes how to add AVOptions capabilities to a struct. + * + * All AVOptions-related information is stored in an AVClass. Therefore + * the first member of the struct must be a pointer to an AVClass describing it. + * The option field of the AVClass must be set to a NULL-terminated static array + * of AVOptions. Each AVOption must have a non-empty name, a type, a default + * value and for number-type AVOptions also a range of allowed values. It must + * also declare an offset in bytes from the start of the struct, where the field + * associated with this AVOption is located. Other fields in the AVOption struct + * should also be set when applicable, but are not required. + * + * The following example illustrates an AVOptions-enabled struct: + * @code + * typedef struct test_struct { + * AVClass *class; + * int int_opt; + * char *str_opt; + * uint8_t *bin_opt; + * int bin_len; + * } test_struct; + * + * static const AVOption test_options[] = { + * { "test_int", "This is a test option of int type.", offsetof(test_struct, int_opt), + * AV_OPT_TYPE_INT, { .i64 = -1 }, INT_MIN, INT_MAX }, + * { "test_str", "This is a test option of string type.", offsetof(test_struct, str_opt), + * AV_OPT_TYPE_STRING }, + * { "test_bin", "This is a test option of binary type.", offsetof(test_struct, bin_opt), + * AV_OPT_TYPE_BINARY }, + * { NULL }, + * }; + * + * static const AVClass test_class = { + * .class_name = "test class", + * .item_name = av_default_item_name, + * .option = test_options, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * @endcode + * + * Next, when allocating your struct, you must ensure that the AVClass pointer + * is set to the correct value. Then, av_opt_set_defaults() must be called to + * initialize defaults. After that the struct is ready to be used with the + * AVOptions API. + * + * When cleaning up, you may use the av_opt_free() function to automatically + * free all the allocated string and binary options. + * + * Continuing with the above example: + * + * @code + * test_struct *alloc_test_struct(void) + * { + * test_struct *ret = av_malloc(sizeof(*ret)); + * ret->class = &test_class; + * av_opt_set_defaults(ret); + * return ret; + * } + * void free_test_struct(test_struct **foo) + * { + * av_opt_free(*foo); + * av_freep(foo); + * } + * @endcode + * + * @subsection avoptions_implement_nesting Nesting + * It may happen that an AVOptions-enabled struct contains another + * AVOptions-enabled struct as a member (e.g. AVCodecContext in + * libavcodec exports generic options, while its priv_data field exports + * codec-specific options). In such a case, it is possible to set up the + * parent struct to export a child's options. To do that, simply + * implement AVClass.child_next() and AVClass.child_class_next() in the + * parent struct's AVClass. + * Assuming that the test_struct from above now also contains a + * child_struct field: + * + * @code + * typedef struct child_struct { + * AVClass *class; + * int flags_opt; + * } child_struct; + * static const AVOption child_opts[] = { + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX }, + * { NULL }, + * }; + * static const AVClass child_class = { + * .class_name = "child class", + * .item_name = av_default_item_name, + * .option = child_opts, + * .version = LIBAVUTIL_VERSION_INT, + * }; + * + * void *child_next(void *obj, void *prev) + * { + * test_struct *t = obj; + * if (!prev && t->child_struct) + * return t->child_struct; + * return NULL + * } + * const AVClass child_class_next(const AVClass *prev) + * { + * return prev ? NULL : &child_class; + * } + * @endcode + * Putting child_next() and child_class_next() as defined above into + * test_class will now make child_struct's options accessible through + * test_struct (again, proper setup as described above needs to be done on + * child_struct right after it is created). + * + * From the above example it might not be clear why both child_next() + * and child_class_next() are needed. The distinction is that child_next() + * iterates over actually existing objects, while child_class_next() + * iterates over all possible child classes. E.g. if an AVCodecContext + * was initialized to use a codec which has private options, then its + * child_next() will return AVCodecContext.priv_data and finish + * iterating. OTOH child_class_next() on AVCodecContext.av_class will + * iterate over all available codecs with private options. + * + * @subsection avoptions_implement_named_constants Named constants + * It is possible to create named constants for options. Simply set the unit + * field of the option the constants should apply to to a string and + * create the constants themselves as options of type AV_OPT_TYPE_CONST + * with their unit field set to the same string. + * Their default_val field should contain the value of the named + * constant. + * For example, to add some named constants for the test_flags option + * above, put the following into the child_opts array: + * @code + * { "test_flags", "This is a test option of flags type.", + * offsetof(child_struct, flags_opt), AV_OPT_TYPE_FLAGS, { .i64 = 0 }, INT_MIN, INT_MAX, "test_unit" }, + * { "flag1", "This is a flag with value 16", 0, AV_OPT_TYPE_CONST, { .i64 = 16 }, 0, 0, "test_unit" }, + * @endcode + * + * @section avoptions_use Using AVOptions + * This section deals with accessing options in an AVOptions-enabled struct. + * Such structs in Libav are e.g. AVCodecContext in libavcodec or + * AVFormatContext in libavformat. + * + * @subsection avoptions_use_examine Examining AVOptions + * The basic functions for examining options are av_opt_next(), which iterates + * over all options defined for one object, and av_opt_find(), which searches + * for an option with the given name. + * + * The situation is more complicated with nesting. An AVOptions-enabled struct + * may have AVOptions-enabled children. Passing the AV_OPT_SEARCH_CHILDREN flag + * to av_opt_find() will make the function search children recursively. + * + * For enumerating there are basically two cases. The first is when you want to + * get all options that may potentially exist on the struct and its children + * (e.g. when constructing documentation). In that case you should call + * av_opt_child_class_next() recursively on the parent struct's AVClass. The + * second case is when you have an already initialized struct with all its + * children and you want to get all options that can be actually written or read + * from it. In that case you should call av_opt_child_next() recursively (and + * av_opt_next() on each result). + * + * @subsection avoptions_use_get_set Reading and writing AVOptions + * When setting options, you often have a string read directly from the + * user. In such a case, simply passing it to av_opt_set() is enough. For + * non-string type options, av_opt_set() will parse the string according to the + * option type. + * + * Similarly av_opt_get() will read any option type and convert it to a string + * which will be returned. Do not forget that the string is allocated, so you + * have to free it with av_free(). + * + * In some cases it may be more convenient to put all options into an + * AVDictionary and call av_opt_set_dict() on it. A specific case of this + * are the format/codec open functions in lavf/lavc which take a dictionary + * filled with option as a parameter. This allows to set some options + * that cannot be set otherwise, since e.g. the input file format is not known + * before the file is actually opened. + */ + +enum AVOptionType{ + AV_OPT_TYPE_FLAGS, + AV_OPT_TYPE_INT, + AV_OPT_TYPE_INT64, + AV_OPT_TYPE_DOUBLE, + AV_OPT_TYPE_FLOAT, + AV_OPT_TYPE_STRING, + AV_OPT_TYPE_RATIONAL, + AV_OPT_TYPE_BINARY, ///< offset must point to a pointer immediately followed by an int for the length + AV_OPT_TYPE_CONST = 128, +}; + +/** + * AVOption + */ +typedef struct AVOption { + const char *name; + + /** + * short English help text + * @todo What about other languages? + */ + const char *help; + + /** + * The offset relative to the context structure where the option + * value is stored. It should be 0 for named constants. + */ + int offset; + enum AVOptionType type; + + /** + * the default value for scalar options + */ + union { + int64_t i64; + double dbl; + const char *str; + /* TODO those are unused now */ + AVRational q; + } default_val; + double min; ///< minimum valid value for the option + double max; ///< maximum valid value for the option + + int flags; +#define AV_OPT_FLAG_ENCODING_PARAM 1 ///< a generic parameter which can be set by the user for muxing or encoding +#define AV_OPT_FLAG_DECODING_PARAM 2 ///< a generic parameter which can be set by the user for demuxing or decoding +#define AV_OPT_FLAG_METADATA 4 ///< some data extracted or inserted into the file like title, comment, ... +#define AV_OPT_FLAG_AUDIO_PARAM 8 +#define AV_OPT_FLAG_VIDEO_PARAM 16 +#define AV_OPT_FLAG_SUBTITLE_PARAM 32 +//FIXME think about enc-audio, ... style flags + + /** + * The logical unit to which the option belongs. Non-constant + * options and corresponding named constants share the same + * unit. May be NULL. + */ + const char *unit; +} AVOption; + +/** + * Show the obj options. + * + * @param req_flags requested flags for the options to show. Show only the + * options for which it is opt->flags & req_flags. + * @param rej_flags rejected flags for the options to show. Show only the + * options for which it is !(opt->flags & req_flags). + * @param av_log_obj log context to use for showing the options + */ +int av_opt_show2(void *obj, void *av_log_obj, int req_flags, int rej_flags); + +/** + * Set the values of all AVOption fields to their default values. + * + * @param s an AVOption-enabled struct (its first member must be a pointer to AVClass) + */ +void av_opt_set_defaults(void *s); + +/** + * Parse the key/value pairs list in opts. For each key/value pair + * found, stores the value in the field in ctx that is named like the + * key. ctx must be an AVClass context, storing is done using + * AVOptions. + * + * @param key_val_sep a 0-terminated list of characters used to + * separate key from value + * @param pairs_sep a 0-terminated list of characters used to separate + * two pairs from each other + * @return the number of successfully set key/value pairs, or a negative + * value corresponding to an AVERROR code in case of error: + * AVERROR(EINVAL) if opts cannot be parsed, + * the error code issued by av_set_string3() if a key/value pair + * cannot be set + */ +int av_set_options_string(void *ctx, const char *opts, + const char *key_val_sep, const char *pairs_sep); + +/** + * Free all string and binary options in obj. + */ +void av_opt_free(void *obj); + +/** + * Check whether a particular flag is set in a flags field. + * + * @param field_name the name of the flag field option + * @param flag_name the name of the flag to check + * @return non-zero if the flag is set, zero if the flag isn't set, + * isn't of the right type, or the flags field doesn't exist. + */ +int av_opt_flag_is_set(void *obj, const char *field_name, const char *flag_name); + +/* + * Set all the options from a given dictionary on an object. + * + * @param obj a struct whose first element is a pointer to AVClass + * @param options options to process. This dictionary will be freed and replaced + * by a new one containing all options not found in obj. + * Of course this new dictionary needs to be freed by caller + * with av_dict_free(). + * + * @return 0 on success, a negative AVERROR if some option was found in obj, + * but could not be set. + * + * @see av_dict_copy() + */ +int av_opt_set_dict(void *obj, struct AVDictionary **options); + +/** + * @defgroup opt_eval_funcs Evaluating option strings + * @{ + * This group of functions can be used to evaluate option strings + * and get numbers out of them. They do the same thing as av_opt_set(), + * except the result is written into the caller-supplied pointer. + * + * @param obj a struct whose first element is a pointer to AVClass. + * @param o an option for which the string is to be evaluated. + * @param val string to be evaluated. + * @param *_out value of the string will be written here. + * + * @return 0 on success, a negative number on failure. + */ +int av_opt_eval_flags (void *obj, const AVOption *o, const char *val, int *flags_out); +int av_opt_eval_int (void *obj, const AVOption *o, const char *val, int *int_out); +int av_opt_eval_int64 (void *obj, const AVOption *o, const char *val, int64_t *int64_out); +int av_opt_eval_float (void *obj, const AVOption *o, const char *val, float *float_out); +int av_opt_eval_double(void *obj, const AVOption *o, const char *val, double *double_out); +int av_opt_eval_q (void *obj, const AVOption *o, const char *val, AVRational *q_out); +/** + * @} + */ + +#define AV_OPT_SEARCH_CHILDREN 0x0001 /**< Search in possible children of the + given object first. */ +/** + * The obj passed to av_opt_find() is fake -- only a double pointer to AVClass + * instead of a required pointer to a struct containing AVClass. This is + * useful for searching for options without needing to allocate the corresponding + * object. + */ +#define AV_OPT_SEARCH_FAKE_OBJ 0x0002 + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * + * @return A pointer to the option found, or NULL if no option + * was found. + * + * @note Options found with AV_OPT_SEARCH_CHILDREN flag may not be settable + * directly with av_set_string3(). Use special calls which take an options + * AVDictionary (e.g. avformat_open_input()) to set options found with this + * flag. + */ +const AVOption *av_opt_find(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags); + +/** + * Look for an option in an object. Consider only options which + * have all the specified flags set. + * + * @param[in] obj A pointer to a struct whose first element is a + * pointer to an AVClass. + * Alternatively a double pointer to an AVClass, if + * AV_OPT_SEARCH_FAKE_OBJ search flag is set. + * @param[in] name The name of the option to look for. + * @param[in] unit When searching for named constants, name of the unit + * it belongs to. + * @param opt_flags Find only options with all the specified flags set (AV_OPT_FLAG). + * @param search_flags A combination of AV_OPT_SEARCH_*. + * @param[out] target_obj if non-NULL, an object to which the option belongs will be + * written here. It may be different from obj if AV_OPT_SEARCH_CHILDREN is present + * in search_flags. This parameter is ignored if search_flags contain + * AV_OPT_SEARCH_FAKE_OBJ. + * + * @return A pointer to the option found, or NULL if no option + * was found. + */ +const AVOption *av_opt_find2(void *obj, const char *name, const char *unit, + int opt_flags, int search_flags, void **target_obj); + +/** + * Iterate over all AVOptions belonging to obj. + * + * @param obj an AVOptions-enabled struct or a double pointer to an + * AVClass describing it. + * @param prev result of the previous call to av_opt_next() on this object + * or NULL + * @return next AVOption or NULL + */ +const AVOption *av_opt_next(void *obj, const AVOption *prev); + +/** + * Iterate over AVOptions-enabled children of obj. + * + * @param prev result of a previous call to this function or NULL + * @return next AVOptions-enabled child or NULL + */ +void *av_opt_child_next(void *obj, void *prev); + +/** + * Iterate over potential AVOptions-enabled children of parent. + * + * @param prev result of a previous call to this function or NULL + * @return AVClass corresponding to next potential child or NULL + */ +const AVClass *av_opt_child_class_next(const AVClass *parent, const AVClass *prev); + +/** + * @defgroup opt_set_funcs Option setting functions + * @{ + * Those functions set the field of obj with the given name to value. + * + * @param[in] obj A struct whose first element is a pointer to an AVClass. + * @param[in] name the name of the field to set + * @param[in] val The value to set. In case of av_opt_set() if the field is not + * of a string type, then the given string is parsed. + * SI postfixes and some named scalars are supported. + * If the field is of a numeric type, it has to be a numeric or named + * scalar. Behavior with more than one scalar and +- infix operators + * is undefined. + * If the field is of a flags type, it has to be a sequence of numeric + * scalars or named flags separated by '+' or '-'. Prefixing a flag + * with '+' causes it to be set without affecting the other flags; + * similarly, '-' unsets a flag. + * @param search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be set on a child of obj. + * + * @return 0 if the value has been set, or an AVERROR code in case of + * error: + * AVERROR_OPTION_NOT_FOUND if no matching option exists + * AVERROR(ERANGE) if the value is out of range + * AVERROR(EINVAL) if the value is not valid + */ +int av_opt_set (void *obj, const char *name, const char *val, int search_flags); +int av_opt_set_int (void *obj, const char *name, int64_t val, int search_flags); +int av_opt_set_double(void *obj, const char *name, double val, int search_flags); +int av_opt_set_q (void *obj, const char *name, AVRational val, int search_flags); +int av_opt_set_bin (void *obj, const char *name, const uint8_t *val, int size, int search_flags); +/** + * @} + */ + +/** + * @defgroup opt_get_funcs Option getting functions + * @{ + * Those functions get a value of the option with the given name from an object. + * + * @param[in] obj a struct whose first element is a pointer to an AVClass. + * @param[in] name name of the option to get. + * @param[in] search_flags flags passed to av_opt_find2. I.e. if AV_OPT_SEARCH_CHILDREN + * is passed here, then the option may be found in a child of obj. + * @param[out] out_val value of the option will be written here + * @return 0 on success, a negative error code otherwise + */ +/** + * @note the returned string will av_malloc()ed and must be av_free()ed by the caller + */ +int av_opt_get (void *obj, const char *name, int search_flags, uint8_t **out_val); +int av_opt_get_int (void *obj, const char *name, int search_flags, int64_t *out_val); +int av_opt_get_double(void *obj, const char *name, int search_flags, double *out_val); +int av_opt_get_q (void *obj, const char *name, int search_flags, AVRational *out_val); +/** + * @} + * @} + */ + +#endif /* AVUTIL_OPT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/parseutils.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/parseutils.h new file mode 100644 index 000000000000..0844abb2f013 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/parseutils.h @@ -0,0 +1,124 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PARSEUTILS_H +#define AVUTIL_PARSEUTILS_H + +#include + +#include "rational.h" + +/** + * @file + * misc parsing utilities + */ + +/** + * Parse str and put in width_ptr and height_ptr the detected values. + * + * @param[in,out] width_ptr pointer to the variable which will contain the detected + * width value + * @param[in,out] height_ptr pointer to the variable which will contain the detected + * height value + * @param[in] str the string to parse: it has to be a string in the format + * width x height or a valid video size abbreviation. + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str); + +/** + * Parse str and store the detected values in *rate. + * + * @param[in,out] rate pointer to the AVRational which will contain the detected + * frame rate + * @param[in] str the string to parse: it has to be a string in the format + * rate_num / rate_den, a float number or a valid video rate abbreviation + * @return >= 0 on success, a negative error code otherwise + */ +int av_parse_video_rate(AVRational *rate, const char *str); + +/** + * Put the RGBA values that correspond to color_string in rgba_color. + * + * @param color_string a string specifying a color. It can be the name of + * a color (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, + * possibly followed by "@" and a string representing the alpha + * component. + * The alpha component may be a string composed by "0x" followed by an + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. + * The string "random" will result in a random color. + * @param slen length of the initial part of color_string containing the + * color. It can be set to -1 if color_string is a null terminated string + * containing nothing else than the color. + * @return >= 0 in case of success, a negative value in case of + * failure (for example if color_string cannot be parsed). + */ +int av_parse_color(uint8_t *rgba_color, const char *color_string, int slen, + void *log_ctx); + +/** + * Parse timestr and return in *time a corresponding number of + * microseconds. + * + * @param timeval puts here the number of microseconds corresponding + * to the string in timestr. If the string represents a duration, it + * is the number of microseconds contained in the time interval. If + * the string is a date, is the number of microseconds since 1st of + * January, 1970 up to the time of the parsed date. If timestr cannot + * be successfully parsed, set *time to INT64_MIN. + + * @param timestr a string representing a date or a duration. + * - If a date the syntax is: + * @code + * [{YYYY-MM-DD|YYYYMMDD}[T|t| ]]{{HH[:MM[:SS[.m...]]]}|{HH[MM[SS[.m...]]]}}[Z] + * now + * @endcode + * If the value is "now" it takes the current time. + * Time is local time unless Z is appended, in which case it is + * interpreted as UTC. + * If the year-month-day part is not specified it takes the current + * year-month-day. + * - If a duration the syntax is: + * @code + * [-]HH[:MM[:SS[.m...]]] + * [-]S+[.m...] + * @endcode + * @param duration flag which tells how to interpret timestr, if not + * zero timestr is interpreted as a duration, otherwise as a date + * @return 0 in case of success, a negative value corresponding to an + * AVERROR code otherwise + */ +int av_parse_time(int64_t *timeval, const char *timestr, int duration); + +/** + * Attempt to find a specific tag in a URL. + * + * syntax: '?tag1=val1&tag2=val2...'. Little URL decoding is done. + * Return 1 if found. + */ +int av_find_info_tag(char *arg, int arg_size, const char *tag1, const char *info); + +/** + * Convert the decomposed UTC time in tm to a time_t value. + */ +time_t av_timegm(struct tm *tm); + +#endif /* AVUTIL_PARSEUTILS_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/pixdesc.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/pixdesc.h new file mode 100644 index 000000000000..e5a16f418b7e --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/pixdesc.h @@ -0,0 +1,276 @@ +/* + * pixel format descriptor + * Copyright (c) 2009 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXDESC_H +#define AVUTIL_PIXDESC_H + +#include + +#include "attributes.h" +#include "pixfmt.h" + +typedef struct AVComponentDescriptor{ + uint16_t plane :2; ///< which of the 4 planes contains the component + + /** + * Number of elements between 2 horizontally consecutive pixels minus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t step_minus1 :3; + + /** + * Number of elements before the component of the first pixel plus 1. + * Elements are bits for bitstream formats, bytes otherwise. + */ + uint16_t offset_plus1 :3; + uint16_t shift :3; ///< number of least significant bits that must be shifted away to get the value + uint16_t depth_minus1 :4; ///< number of bits in the component minus 1 +}AVComponentDescriptor; + +/** + * Descriptor that unambiguously describes how the bits of a pixel are + * stored in the up to 4 data planes of an image. It also stores the + * subsampling factors and number of components. + * + * @note This is separate of the colorspace (RGB, YCbCr, YPbPr, JPEG-style YUV + * and all the YUV variants) AVPixFmtDescriptor just stores how values + * are stored not what these values represent. + */ +typedef struct AVPixFmtDescriptor{ + const char *name; + uint8_t nb_components; ///< The number of components each pixel has, (1-4) + + /** + * Amount to shift the luma width right to find the chroma width. + * For YV12 this is 1 for example. + * chroma_width = -((-luma_width) >> log2_chroma_w) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_w; ///< chroma_width = -((-luma_width )>>log2_chroma_w) + + /** + * Amount to shift the luma height right to find the chroma height. + * For YV12 this is 1 for example. + * chroma_height= -((-luma_height) >> log2_chroma_h) + * The note above is needed to ensure rounding up. + * This value only refers to the chroma components. + */ + uint8_t log2_chroma_h; + uint8_t flags; + + /** + * Parameters that describe how pixels are packed. If the format + * has chroma components, they must be stored in comp[1] and + * comp[2]. + */ + AVComponentDescriptor comp[4]; +}AVPixFmtDescriptor; + +/** + * Pixel format is big-endian. + */ +#define AV_PIX_FMT_FLAG_BE (1 << 0) +/** + * Pixel format has a palette in data[1], values are indexes in this palette. + */ +#define AV_PIX_FMT_FLAG_PAL (1 << 1) +/** + * All values of a component are bit-wise packed end to end. + */ +#define AV_PIX_FMT_FLAG_BITSTREAM (1 << 2) +/** + * Pixel format is an HW accelerated format. + */ +#define AV_PIX_FMT_FLAG_HWACCEL (1 << 3) +/** + * At least one pixel component is not in the first data plane. + */ +#define AV_PIX_FMT_FLAG_PLANAR (1 << 4) +/** + * The pixel format contains RGB-like data (as opposed to YUV/grayscale). + */ +#define AV_PIX_FMT_FLAG_RGB (1 << 5) +/** + * The pixel format is "pseudo-paletted". This means that Libav treats it as + * paletted internally, but the palette is generated by the decoder and is not + * stored in the file. + */ +#define AV_PIX_FMT_FLAG_PSEUDOPAL (1 << 6) +/** + * The pixel format has an alpha channel. + */ +#define AV_PIX_FMT_FLAG_ALPHA (1 << 7) + +#if FF_API_PIX_FMT +/** + * @deprecated use the AV_PIX_FMT_FLAG_* flags + */ +#define PIX_FMT_BE AV_PIX_FMT_FLAG_BE +#define PIX_FMT_PAL AV_PIX_FMT_FLAG_PAL +#define PIX_FMT_BITSTREAM AV_PIX_FMT_FLAG_BITSTREAM +#define PIX_FMT_HWACCEL AV_PIX_FMT_FLAG_HWACCEL +#define PIX_FMT_PLANAR AV_PIX_FMT_FLAG_PLANAR +#define PIX_FMT_RGB AV_PIX_FMT_FLAG_RGB +#define PIX_FMT_PSEUDOPAL AV_PIX_FMT_FLAG_PSEUDOPAL +#define PIX_FMT_ALPHA AV_PIX_FMT_FLAG_ALPHA +#endif + +#if FF_API_PIX_FMT_DESC +/** + * The array of all the pixel format descriptors. + */ +extern attribute_deprecated const AVPixFmtDescriptor av_pix_fmt_descriptors[]; +#endif + +/** + * Read a line from an image, and write the values of the + * pixel format component c to dst. + * + * @param data the array containing the pointers to the planes of the image + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to read + * @param y the vertical coordinate of the first pixel to read + * @param w the width of the line to read, that is the number of + * values to write to dst + * @param read_pal_component if not zero and the format is a paletted + * format writes the values corresponding to the palette + * component c in data[1] to dst, rather than the palette indexes in + * data[0]. The behavior is undefined if the format is not paletted. + */ +void av_read_image_line(uint16_t *dst, const uint8_t *data[4], const int linesize[4], + const AVPixFmtDescriptor *desc, int x, int y, int c, int w, int read_pal_component); + +/** + * Write the values from src to the pixel format component c of an + * image line. + * + * @param src array containing the values to write + * @param data the array containing the pointers to the planes of the + * image to write into. It is supposed to be zeroed. + * @param linesize the array containing the linesizes of the image + * @param desc the pixel format descriptor for the image + * @param x the horizontal coordinate of the first pixel to write + * @param y the vertical coordinate of the first pixel to write + * @param w the width of the line to write, that is the number of + * values to write to the image line + */ +void av_write_image_line(const uint16_t *src, uint8_t *data[4], const int linesize[4], + const AVPixFmtDescriptor *desc, int x, int y, int c, int w); + +/** + * Return the pixel format corresponding to name. + * + * If there is no pixel format with name name, then looks for a + * pixel format with the name corresponding to the native endian + * format of name. + * For example in a little-endian system, first looks for "gray16", + * then for "gray16le". + * + * Finally if no pixel format has been found, returns PIX_FMT_NONE. + */ +enum AVPixelFormat av_get_pix_fmt(const char *name); + +/** + * Return the short name for a pixel format, NULL in case pix_fmt is + * unknown. + * + * @see av_get_pix_fmt(), av_get_pix_fmt_string() + */ +const char *av_get_pix_fmt_name(enum AVPixelFormat pix_fmt); + +/** + * Print in buf the string corresponding to the pixel format with + * number pix_fmt, or an header if pix_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param pix_fmt the number of the pixel format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + */ +char *av_get_pix_fmt_string (char *buf, int buf_size, enum AVPixelFormat pix_fmt); + +/** + * Return the number of bits per pixel used by the pixel format + * described by pixdesc. Note that this is not the same as the number + * of bits per sample. + * + * The returned number of bits refers to the number of bits actually + * used for storing the pixel information, that is padding bits are + * not counted. + */ +int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc); + +/** + * @return a pixel format descriptor for provided pixel format or NULL if + * this pixel format is unknown. + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt); + +/** + * Iterate over all pixel format descriptors known to libavutil. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVPixFmtDescriptor *av_pix_fmt_desc_next(const AVPixFmtDescriptor *prev); + +/** + * @return an AVPixelFormat id described by desc, or AV_PIX_FMT_NONE if desc + * is not a valid pointer to a pixel format descriptor. + */ +enum AVPixelFormat av_pix_fmt_desc_get_id(const AVPixFmtDescriptor *desc); + +/** + * Utility function to access log2_chroma_w log2_chroma_h from + * the pixel format AVPixFmtDescriptor. + * + * @param[in] pix_fmt the pixel format + * @param[out] h_shift store log2_chroma_h + * @param[out] v_shift store log2_chroma_w + * + * @return 0 on success, AVERROR(ENOSYS) on invalid or unknown pixel format + */ +int av_pix_fmt_get_chroma_sub_sample(enum AVPixelFormat pix_fmt, + int *h_shift, int *v_shift); + +/** + * @return number of planes in pix_fmt, a negative AVERROR if pix_fmt is not a + * valid pixel format. + */ +int av_pix_fmt_count_planes(enum AVPixelFormat pix_fmt); + + +/** + * Utility function to swap the endianness of a pixel format. + * + * @param[in] pix_fmt the pixel format + * + * @return pixel format with swapped endianness if it exists, + * otherwise AV_PIX_FMT_NONE + */ +enum AVPixelFormat av_pix_fmt_swap_endianness(enum AVPixelFormat pix_fmt); + + +#endif /* AVUTIL_PIXDESC_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/pixfmt.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/pixfmt.h new file mode 100644 index 000000000000..0d6e0a300797 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/pixfmt.h @@ -0,0 +1,283 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_PIXFMT_H +#define AVUTIL_PIXFMT_H + +/** + * @file + * pixel format definitions + * + */ + +#include "libavutil/avconfig.h" +#include "version.h" + +/** + * Pixel format. + * + * @note + * PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @par + * When the pixel format is palettized RGB (PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8bit per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + * + * @note + * Make sure that all newly added big-endian formats have pix_fmt & 1 == 1 + * and that all newly added little-endian formats have pix_fmt & 1 == 0. + * This allows simpler detection of big vs little-endian. + */ +enum AVPixelFormat { + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bit with PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of PIX_FMT_YUV444P and setting color_range +#if FF_API_XVMC + AV_PIX_FMT_XVMC_MPEG2_MC,///< XVideo Motion Acceleration via common packet passing + AV_PIX_FMT_XVMC_MPEG2_IDCT, +#endif /* FF_API_XVMC */ + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)2R 3G 3B(lsb) + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) +#if FF_API_VDPAU + AV_PIX_FMT_VDPAU_H264,///< H.264 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG1,///< MPEG-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_MPEG2,///< MPEG-2 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_WMV3,///< WMV3 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + AV_PIX_FMT_VDPAU_VC1, ///< VC-1 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), big-endian, most significant bit to 0 + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1A 5R 5G 5B(lsb), little-endian, most significant bit to 0 + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), big-endian, most significant bit to 1 + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1A 5B 5G 5R(lsb), little-endian, most significant bit to 1 + + AV_PIX_FMT_VAAPI_MOCO, ///< HW acceleration through VA API at motion compensation entry-point, Picture.data[3] contains a vaapi_render_state struct which contains macroblocks as well as various fields extracted from headers + AV_PIX_FMT_VAAPI_IDCT, ///< HW acceleration through VA API at IDCT entry-point, Picture.data[3] contains a vaapi_render_state struct which contains fields extracted from headers + AV_PIX_FMT_VAAPI_VLD, ///< HW decoding through VA API, Picture.data[3] contains a vaapi_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian +#if FF_API_VDPAU + AV_PIX_FMT_VDPAU_MPEG4, ///< MPEG4 HW decoding with VDPAU, data[0] contains a vdpau_render_state struct which contains the bitstream of the slices as well as various fields extracted from headers +#endif + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), little-endian, most significant bits to 0 + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4A 4R 4G 4B(lsb), big-endian, most significant bits to 0 + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), little-endian, most significant bits to 1 + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4A 4B 4G 4R(lsb), big-endian, most significant bits to 1 + AV_PIX_FMT_Y400A, ///< 8bit gray, 8bit alpha + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_VDA_VLD, ///< hardware decoding through VDA + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_NB, ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions + +#if FF_API_PIX_FMT +#include "old_pix_fmts.h" +#endif +}; + +#if AV_HAVE_BIGENDIAN +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be +#else +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le +#endif + +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) + +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) + +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) + +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) + +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) + +#if FF_API_PIX_FMT +#define PixelFormat AVPixelFormat + +#define PIX_FMT_NE(be, le) AV_PIX_FMT_NE(be, le) + +#define PIX_FMT_RGB32 AV_PIX_FMT_RGB32 +#define PIX_FMT_RGB32_1 AV_PIX_FMT_RGB32_1 +#define PIX_FMT_BGR32 AV_PIX_FMT_BGR32 +#define PIX_FMT_BGR32_1 AV_PIX_FMT_BGR32_1 + +#define PIX_FMT_GRAY16 AV_PIX_FMT_GRAY16 +#define PIX_FMT_RGB48 AV_PIX_FMT_RGB48 +#define PIX_FMT_RGB565 AV_PIX_FMT_RGB565 +#define PIX_FMT_RGB555 AV_PIX_FMT_RGB555 +#define PIX_FMT_RGB444 AV_PIX_FMT_RGB444 +#define PIX_FMT_BGR48 AV_PIX_FMT_BGR48 +#define PIX_FMT_BGR565 AV_PIX_FMT_BGR565 +#define PIX_FMT_BGR555 AV_PIX_FMT_BGR555 +#define PIX_FMT_BGR444 AV_PIX_FMT_BGR444 + +#define PIX_FMT_YUV420P9 AV_PIX_FMT_YUV420P9 +#define PIX_FMT_YUV422P9 AV_PIX_FMT_YUV422P9 +#define PIX_FMT_YUV444P9 AV_PIX_FMT_YUV444P9 +#define PIX_FMT_YUV420P10 AV_PIX_FMT_YUV420P10 +#define PIX_FMT_YUV422P10 AV_PIX_FMT_YUV422P10 +#define PIX_FMT_YUV444P10 AV_PIX_FMT_YUV444P10 +#define PIX_FMT_YUV420P16 AV_PIX_FMT_YUV420P16 +#define PIX_FMT_YUV422P16 AV_PIX_FMT_YUV422P16 +#define PIX_FMT_YUV444P16 AV_PIX_FMT_YUV444P16 + +#define PIX_FMT_GBRP9 AV_PIX_FMT_GBRP9 +#define PIX_FMT_GBRP10 AV_PIX_FMT_GBRP10 +#define PIX_FMT_GBRP16 AV_PIX_FMT_GBRP16 +#endif + +#endif /* AVUTIL_PIXFMT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/random_seed.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/random_seed.h new file mode 100644 index 000000000000..b1fad13d0757 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/random_seed.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2009 Baptiste Coudurier + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_RANDOM_SEED_H +#define AVUTIL_RANDOM_SEED_H + +#include +/** + * @addtogroup lavu_crypto + * @{ + */ + +/** + * Get random data. + * + * This function can be called repeatedly to generate more random bits + * as needed. It is generally quite slow, and usually used to seed a + * PRNG. As it uses /dev/urandom and /dev/random, the quality of the + * returned random data depends on the platform. + */ +uint32_t av_get_random_seed(void); + +/** + * @} + */ + +#endif /* AVUTIL_RANDOM_SEED_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/rational.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/rational.h new file mode 100644 index 000000000000..5d7dab7fd0d2 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/rational.h @@ -0,0 +1,155 @@ +/* + * rational numbers + * Copyright (c) 2003 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +/** + * @file + * rational numbers + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_RATIONAL_H +#define AVUTIL_RATIONAL_H + +#include +#include +#include "attributes.h" + +/** + * @addtogroup lavu_math + * @{ + */ + +/** + * rational number numerator/denominator + */ +typedef struct AVRational{ + int num; ///< numerator + int den; ///< denominator +} AVRational; + +/** + * Compare two rationals. + * @param a first rational + * @param b second rational + * @return 0 if a==b, 1 if a>b, -1 if a>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; +} + +/** + * Convert rational to double. + * @param a rational to convert + * @return (double) a + */ +static inline double av_q2d(AVRational a){ + return a.num / (double) a.den; +} + +/** + * Reduce a fraction. + * This is useful for framerate calculations. + * @param dst_num destination numerator + * @param dst_den destination denominator + * @param num source numerator + * @param den source denominator + * @param max the maximum allowed for dst_num & dst_den + * @return 1 if exact, 0 otherwise + */ +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); + +/** + * Multiply two rationals. + * @param b first rational + * @param c second rational + * @return b*c + */ +AVRational av_mul_q(AVRational b, AVRational c) av_const; + +/** + * Divide one rational by another. + * @param b first rational + * @param c second rational + * @return b/c + */ +AVRational av_div_q(AVRational b, AVRational c) av_const; + +/** + * Add two rationals. + * @param b first rational + * @param c second rational + * @return b+c + */ +AVRational av_add_q(AVRational b, AVRational c) av_const; + +/** + * Subtract one rational from another. + * @param b first rational + * @param c second rational + * @return b-c + */ +AVRational av_sub_q(AVRational b, AVRational c) av_const; + +/** + * Invert a rational. + * @param q value + * @return 1 / q + */ +static av_always_inline AVRational av_inv_q(AVRational q) +{ + AVRational r = { q.den, q.num }; + return r; +} + +/** + * Convert a double precision floating point number to a rational. + * inf is expressed as {1,0} or {-1,0} depending on the sign. + * + * @param d double to convert + * @param max the maximum allowed numerator and denominator + * @return (AVRational) d + */ +AVRational av_d2q(double d, int max) av_const; + +/** + * @return 1 if q1 is nearer to q than q2, -1 if q2 is nearer + * than q1, 0 if they have the same distance. + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Find the nearest value in q_list to q. + * @param q_list an array of rationals terminated by {0, 0} + * @return the index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); + +/** + * @} + */ + +#endif /* AVUTIL_RATIONAL_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/samplefmt.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/samplefmt.h new file mode 100644 index 000000000000..33cbdedf5f0b --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/samplefmt.h @@ -0,0 +1,220 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include + +#include "avutil.h" +#include "attributes.h" + +/** + * Audio Sample Formats + * + * @par + * The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * @par + * The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * @par + * The data layout as used in av_samples_fill_arrays() and elsewhere in Libav + * (such as AVFrame in libavcodec) is as follows: + * + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL if sample_fmt is + * unknown or in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Fill channel data pointers and linesize for samples with sample + * format sample_fmt. + * + * The pointers array is filled with the pointers to the samples data: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The linesize array is filled with the aligned size of each channel's data + * buffer for planar layout, or the aligned size of the buffer for all channels + * for packed layout. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return 0 on success or a negative error code on failure + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, + const uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * Allocated data will be initialized to silence. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return 0 on success or a negative error code on failure + * @see av_samples_fill_arrays() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t **dst, uint8_t * const *src, int dst_offset, + int src_offset, int nb_samples, int nb_channels, + enum AVSampleFormat sample_fmt); + +/** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_set_silence(uint8_t **audio_data, int offset, int nb_samples, + int nb_channels, enum AVSampleFormat sample_fmt); + +#endif /* AVUTIL_SAMPLEFMT_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/sha.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/sha.h new file mode 100644 index 000000000000..4c9a0c90950d --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/sha.h @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2007 Michael Niedermayer + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_SHA_H +#define AVUTIL_SHA_H + +#include + +#include "attributes.h" +#include "version.h" + +/** + * @defgroup lavu_sha SHA + * @ingroup lavu_crypto + * @{ + */ + +#if FF_API_CONTEXT_SIZE +extern attribute_deprecated const int av_sha_size; +#endif + +struct AVSHA; + +/** + * Allocate an AVSHA context. + */ +struct AVSHA *av_sha_alloc(void); + +/** + * Initialize SHA-1 or SHA-2 hashing. + * + * @param context pointer to the function context (of size av_sha_size) + * @param bits number of bits in digest (SHA-1 - 160 bits, SHA-2 224 or 256 bits) + * @return zero if initialization succeeded, -1 otherwise + */ +int av_sha_init(struct AVSHA* context, int bits); + +/** + * Update hash value. + * + * @param context hash function context + * @param data input data to update hash with + * @param len input data length + */ +void av_sha_update(struct AVSHA* context, const uint8_t* data, unsigned int len); + +/** + * Finish hashing and output digest value. + * + * @param context hash function context + * @param digest buffer where output digest value is stored + */ +void av_sha_final(struct AVSHA* context, uint8_t *digest); + +/** + * @} + */ + +#endif /* AVUTIL_SHA_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/stereo3d.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/stereo3d.h new file mode 100644 index 000000000000..695d6f1baea6 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/stereo3d.h @@ -0,0 +1,147 @@ +/* + * Copyright (c) 2013 Vittorio Giovara + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +#include "frame.h" + +/** + * List of possible 3D Types + */ +enum AVStereo3DType { + /** + * Video is not stereoscopic (and metadata has to be there). + */ + AV_STEREO3D_2D, + + /** + * Views are next to each other. + * + * LLLLRRRR + * LLLLRRRR + * LLLLRRRR + * ... + */ + AV_STEREO3D_SIDEBYSIDE, + + /** + * Views are on top of each other. + * + * LLLLLLLL + * LLLLLLLL + * RRRRRRRR + * RRRRRRRR + */ + AV_STEREO3D_TOPBOTTOM, + + /** + * Views are alternated temporally. + * + * frame0 frame1 frame2 ... + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * LLLLLLLL RRRRRRRR LLLLLLLL + * ... ... ... + */ + AV_STEREO3D_FRAMESEQUENCE, + + /** + * Views are packed in a checkerboard-like structure per pixel. + * + * LRLRLRLR + * RLRLRLRL + * LRLRLRLR + * ... + */ + AV_STEREO3D_CHECKERBOARD, + + /** + * Views are next to each other, but when upscaling + * apply a checkerboard pattern. + * + * LLLLRRRR L L L L R R R R + * LLLLRRRR => L L L L R R R R + * LLLLRRRR L L L L R R R R + * LLLLRRRR L L L L R R R R + */ + AV_STEREO3D_SIDEBYSIDE_QUINCUNX, + + /** + * Views are packed per line, as if interlaced. + * + * LLLLLLLL + * RRRRRRRR + * LLLLLLLL + * ... + */ + AV_STEREO3D_LINES, + + /** + * Views are packed per column. + * + * LRLRLRLR + * LRLRLRLR + * LRLRLRLR + * ... + */ + AV_STEREO3D_COLUMNS, +}; + + +/** + * Inverted views, Right/Bottom represents the left view. + */ +#define AV_STEREO3D_FLAG_INVERT (1 << 0) + +/** + * Stereo 3D type: this structure describes how two videos are packed + * within a single video surface, with additional information as needed. + * + * @note The struct must be allocated with av_stereo3d_alloc() and + * its size is not a part of the public ABI. + */ +typedef struct AVStereo3D { + /** + * How views are packed within the video. + */ + enum AVStereo3DType type; + + /** + * Additional information about the frame packing. + */ + int flags; +} AVStereo3D; + +/** + * Allocate an AVStereo3D structure and set its fields to default values. + * The resulting struct can be freed using av_freep(). + * + * @return An AVStereo3D filled with default values or NULL on failure. + */ +AVStereo3D *av_stereo3d_alloc(void); + +/** + * Allocate a complete AVFrameSideData and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVStereo3D structure to be filled by caller. + */ +AVStereo3D *av_stereo3d_create_side_data(AVFrame *frame); diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/time.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/time.h new file mode 100644 index 000000000000..b01a97d77012 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/time.h @@ -0,0 +1,39 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_TIME_H +#define AVUTIL_TIME_H + +#include + +/** + * Get the current time in microseconds. + */ +int64_t av_gettime(void); + +/** + * Sleep for a period of time. Although the duration is expressed in + * microseconds, the actual delay may be rounded to the precision of the + * system timer. + * + * @param usec Number of microseconds to sleep. + * @return zero on success or (negative) error code. + */ +int av_usleep(unsigned usec); + +#endif /* AVUTIL_TIME_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/version.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/version.h new file mode 100644 index 000000000000..5196a674dea4 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/version.h @@ -0,0 +1,116 @@ +/* + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_VERSION_H +#define AVUTIL_VERSION_H + +#include "macros.h" + +/** + * @defgroup version_utils Library Version Macros + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) (a<<16 | b<<8 | c) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * @} + */ + +/** + * @file + * @ingroup lavu + * Libavutil version macros + */ + +/** + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compiletime and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 53 +#define LIBAVUTIL_VERSION_MINOR 3 +#define LIBAVUTIL_VERSION_MICRO 0 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @} + * + * @defgroup depr_guards Deprecation guards + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @{ + */ + +#ifndef FF_API_PIX_FMT +#define FF_API_PIX_FMT (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_CONTEXT_SIZE +#define FF_API_CONTEXT_SIZE (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_PIX_FMT_DESC +#define FF_API_PIX_FMT_DESC (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_AV_REVERSE +#define FF_API_AV_REVERSE (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_AUDIOCONVERT +#define FF_API_AUDIOCONVERT (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_CPU_FLAG_MMX2 +#define FF_API_CPU_FLAG_MMX2 (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_LLS_PRIVATE +#define FF_API_LLS_PRIVATE (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_AVFRAME_LAVC +#define FF_API_AVFRAME_LAVC (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_VDPAU +#define FF_API_VDPAU (LIBAVUTIL_VERSION_MAJOR < 54) +#endif +#ifndef FF_API_XVMC +#define FF_API_XVMC (LIBAVUTIL_VERSION_MAJOR < 54) +#endif + +/** + * @} + */ + +#endif /* AVUTIL_VERSION_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/include/libavutil/xtea.h b/content/media/fmp4/ffmpeg/libav55/include/libavutil/xtea.h new file mode 100644 index 000000000000..7d2b07bbc73b --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/include/libavutil/xtea.h @@ -0,0 +1,61 @@ +/* + * A 32-bit implementation of the XTEA algorithm + * + * This file is part of Libav. + * + * Libav is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * Libav is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with Libav; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_XTEA_H +#define AVUTIL_XTEA_H + +#include + +/** + * @defgroup lavu_xtea XTEA + * @ingroup lavu_crypto + * @{ + */ + +typedef struct AVXTEA { + uint32_t key[16]; +} AVXTEA; + +/** + * Initialize an AVXTEA context. + * + * @param ctx an AVXTEA context + * @param key a key of 16 bytes used for encryption/decryption + */ +void av_xtea_init(struct AVXTEA *ctx, const uint8_t key[16]); + +/** + * Encrypt or decrypt a buffer using a previously initialized context. + * + * @param ctx an AVXTEA context + * @param dst destination array, can be equal to src + * @param src source array, can be equal to dst + * @param count number of 8 byte blocks + * @param iv initialization vector for CBC mode, if NULL then ECB will be used + * @param decrypt 0 for encryption, 1 for decryption + */ +void av_xtea_crypt(struct AVXTEA *ctx, uint8_t *dst, const uint8_t *src, + int count, uint8_t *iv, int decrypt); + +/** + * @} + */ + +#endif /* AVUTIL_XTEA_H */ diff --git a/content/media/fmp4/ffmpeg/libav55/moz.build b/content/media/fmp4/ffmpeg/libav55/moz.build new file mode 100644 index 000000000000..05fc31027af0 --- /dev/null +++ b/content/media/fmp4/ffmpeg/libav55/moz.build @@ -0,0 +1,21 @@ +# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*- +# vim: set filetype=python: +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +UNIFIED_SOURCES += [ + '../FFmpegAACDecoder.cpp', + '../FFmpegDataDecoder.cpp', + '../FFmpegDecoderModule.cpp', + '../FFmpegH264Decoder.cpp', +] +LOCAL_INCLUDES += [ + '..', + 'include', +] +CXXFLAGS += [ '-Wno-deprecated-declarations' ] + +FINAL_LIBRARY = 'gklayout' + +FAIL_ON_WARNINGS = True diff --git a/content/media/fmp4/moz.build b/content/media/fmp4/moz.build index 0cadbfdbac15..a0505ff82b32 100644 --- a/content/media/fmp4/moz.build +++ b/content/media/fmp4/moz.build @@ -38,22 +38,19 @@ if CONFIG['MOZ_WMF']: if CONFIG['MOZ_FFMPEG']: EXPORTS += [ - 'ffmpeg/FFmpegAACDecoder.h', - 'ffmpeg/FFmpegDataDecoder.h', - 'ffmpeg/FFmpegDecoderModule.h', - 'ffmpeg/FFmpegFunctionList.h', - 'ffmpeg/FFmpegH264Decoder.h', 'ffmpeg/FFmpegRuntimeLinker.h', ] UNIFIED_SOURCES += [ - 'ffmpeg/FFmpegAACDecoder.cpp', - 'ffmpeg/FFmpegDataDecoder.cpp', - 'ffmpeg/FFmpegDecoderModule.cpp', - 'ffmpeg/FFmpegH264Decoder.cpp', + 'ffmpeg/FFmpegLog.cpp', 'ffmpeg/FFmpegRuntimeLinker.cpp', ] + PARALLEL_DIRS += [ + 'ffmpeg/libav53', + 'ffmpeg/libav54', + 'ffmpeg/libav55', + ] LOCAL_INCLUDES += [ - 'ffmpeg/include', + 'ffmpeg', ] FINAL_LIBRARY = 'gklayout' From 441cb860ec9a0519de552cc194413d135856d7ee Mon Sep 17 00:00:00 2001 From: Anthony Jones Date: Thu, 3 Jul 2014 14:43:15 +1200 Subject: [PATCH 79/94] Bug 1033137 - Remove extra frame reordering in libav; r=edwin --- .../media/fmp4/ffmpeg/FFmpegH264Decoder.cpp | 24 +------------------ content/media/fmp4/ffmpeg/FFmpegH264Decoder.h | 17 ------------- 2 files changed, 1 insertion(+), 40 deletions(-) diff --git a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp index 7bd6205a1fcd..2fe03703eb8a 100644 --- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp +++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp @@ -86,16 +86,7 @@ FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample) aSample->is_sync_point, -1, gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height)); - // Insert the frame into the heap for reordering. - mDelayedFrames.Push(data.forget()); - - // Reorder video frames from decode order to presentation order. The minimum - // size of the heap comes from one P frame + |max_b_frames| B frames, which - // is the maximum number of frames in a row which will be out-of-order. - if (mDelayedFrames.Length() > (uint32_t)mCodecContext.max_b_frames + 1) { - VideoData* d = mDelayedFrames.Pop(); - mCallback->Output(d); - } + mCallback->Output(data.forget()); } if (mTaskQueue->IsEmpty()) { @@ -219,14 +210,6 @@ FFmpegH264Decoder::Input(mp4_demuxer::MP4Sample* aSample) return NS_OK; } -void -FFmpegH264Decoder::OutputDelayedFrames() -{ - while (!mDelayedFrames.IsEmpty()) { - mCallback->Output(mDelayedFrames.Pop()); - } -} - nsresult FFmpegH264Decoder::Drain() { @@ -241,9 +224,6 @@ FFmpegH264Decoder::Drain() NS_ENSURE_SUCCESS(rv, rv); } - mTaskQueue->Dispatch(NS_NewRunnableMethod( - this, &FFmpegH264Decoder::OutputDelayedFrames)); - return NS_OK; } @@ -252,14 +232,12 @@ FFmpegH264Decoder::Flush() { nsresult rv = FFmpegDataDecoder::Flush(); // Even if the above fails we may as well clear our frame queue. - mDelayedFrames.Clear(); return rv; } FFmpegH264Decoder::~FFmpegH264Decoder() { MOZ_COUNT_DTOR(FFmpegH264Decoder); - MOZ_ASSERT(mDelayedFrames.IsEmpty()); } } // namespace mozilla diff --git a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h index cf13b4b7972a..9947b8ab30a5 100644 --- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h +++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h @@ -7,8 +7,6 @@ #ifndef __FFmpegH264Decoder_h__ #define __FFmpegH264Decoder_h__ -#include "nsTPriorityQueue.h" - #include "FFmpegDataDecoder.h" namespace mozilla @@ -67,21 +65,6 @@ private: * refcounting. */ nsRefPtr mCurrentImage; - - struct VideoDataComparator - { - bool LessThan(VideoData* const& a, VideoData* const& b) const - { - return a->mTime < b->mTime; - } - }; - - /** - * FFmpeg returns frames in DTS order, so we need to keep a heap of the - * previous MAX_B_FRAMES + 1 frames (all B frames in a GOP + one P frame) - * ordered by PTS to make sure we present video frames in the intended order. - */ - nsTPriorityQueue mDelayedFrames; }; } // namespace mozilla From 7905911bfde90df5f9d7b9ddce2dbc553bf29479 Mon Sep 17 00:00:00 2001 From: Anthony Jones Date: Thu, 3 Jul 2014 14:43:17 +1200 Subject: [PATCH 80/94] Bug 1033137 - Fix image lifetime issues in libav backend; r=edwin --- content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp | 5 +++++ content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp | 14 +++++++++++--- content/media/fmp4/ffmpeg/FFmpegH264Decoder.h | 14 +------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp b/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp index c6ba598f17b0..15773a1fa5d0 100644 --- a/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp +++ b/content/media/fmp4/ffmpeg/FFmpegDataDecoder.cpp @@ -12,6 +12,7 @@ #include "FFmpegLibs.h" #include "FFmpegLog.h" #include "FFmpegDataDecoder.h" +#include "prsystem.h" namespace mozilla { @@ -83,6 +84,10 @@ FFmpegDataDecoder::Init() // FFmpeg will call back to this to negotiate a video pixel format. mCodecContext.get_format = ChoosePixelFormat; + mCodecContext.thread_count = PR_GetNumberOfProcessors(); + mCodecContext.thread_type = FF_THREAD_FRAME; + mCodecContext.thread_safe_callbacks = false; + mCodecContext.extradata = mExtraData.begin(); mCodecContext.extradata_size = mExtraData.length(); diff --git a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp index 2fe03703eb8a..781764419a89 100644 --- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp +++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.cpp @@ -42,6 +42,7 @@ FFmpegH264Decoder::Init() NS_ENSURE_SUCCESS(rv, rv); mCodecContext.get_buffer = AllocateBufferCb; + mCodecContext.release_buffer = ReleaseBufferCb; return NS_OK; } @@ -82,8 +83,8 @@ FFmpegH264Decoder::DecodeFrame(mp4_demuxer::MP4Sample* aSample) data = VideoData::CreateFromImage( info, mImageContainer, aSample->byte_offset, - aSample->composition_timestamp, aSample->duration, mCurrentImage, - aSample->is_sync_point, -1, + aSample->composition_timestamp, aSample->duration, + reinterpret_cast(frame->opaque), aSample->is_sync_point, -1, gfx::IntRect(0, 0, mCodecContext.width, mCodecContext.height)); mCallback->Output(data.forget()); @@ -132,6 +133,13 @@ FFmpegH264Decoder::AllocateBufferCb(AVCodecContext* aCodecContext, } } +/* static */ void +FFmpegH264Decoder::ReleaseBufferCb(AVCodecContext* aCodecContext, + AVFrame* aFrame) +{ + reinterpret_cast(aFrame->opaque)->Release(); +} + int FFmpegH264Decoder::AllocateYUV420PVideoBuffer( AVCodecContext* aCodecContext, AVFrame* aFrame) @@ -194,7 +202,7 @@ FFmpegH264Decoder::AllocateYUV420PVideoBuffer( PlanarYCbCrDataFromAVFrame(data, aFrame); ycbcr->SetDataNoCopy(data); - mCurrentImage.swap(image); + aFrame->opaque = reinterpret_cast(image.forget().take()); return 0; } diff --git a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h index 9947b8ab30a5..f81aa89218bf 100644 --- a/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h +++ b/content/media/fmp4/ffmpeg/FFmpegH264Decoder.h @@ -49,22 +49,10 @@ private: AVFrame* aFrame); static int AllocateBufferCb(AVCodecContext* aCodecContext, AVFrame* aFrame); + static void ReleaseBufferCb(AVCodecContext* aCodecContext, AVFrame* aFrame); MediaDataDecoderCallback* mCallback; nsRefPtr mImageContainer; - - /** - * Pass Image back from the allocator to our DoDecode method. - * We *should* return the image back through ffmpeg wrapped in an AVFrame like - * we're meant to. However, if avcodec_decode_video2 fails, it returns a - * completely different frame from the one holding our image and it will be - * leaked. - * This could be handled in the future by wrapping our Image in a reference - * counted AVBuffer and letting ffmpeg hold the nsAutoPtr, but - * currently we have to support older versions of ffmpeg which lack - * refcounting. - */ - nsRefPtr mCurrentImage; }; } // namespace mozilla From b5b24844589571817a49c33ededd2d4c92317db5 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 1 Jul 2014 16:28:45 -0700 Subject: [PATCH 81/94] Bug 1033092: Add unit tests for mozilla::pkix::der::ExpectTagAndGetValue, r=keeler --HG-- extra : rebase_source : 8ad8960969e5ee5bf47054f1c285a85cbbdb18cf --- .../pkix/test/gtest/pkixder_input_tests.cpp | 131 ++++++++++++++++++ 1 file changed, 131 insertions(+) diff --git a/security/pkix/test/gtest/pkixder_input_tests.cpp b/security/pkix/test/gtest/pkixder_input_tests.cpp index 24f7941b6bc8..6f09e9f7578a 100644 --- a/security/pkix/test/gtest/pkixder_input_tests.cpp +++ b/security/pkix/test/gtest/pkixder_input_tests.cpp @@ -42,6 +42,26 @@ protected: } }; +static const uint8_t DER_SEQUENCE_EMPTY[] = { + 0x30, // SEQUENCE + 0x00, // length +}; + +static const uint8_t DER_SEQUENCE_NOT_EMPTY[] = { + 0x30, // SEQUENCE + 0x01, // length + 'X', // value +}; + +static const uint8_t DER_SEQUENCE_NOT_EMPTY_VALUE[] = { + 'X', // value +}; + +static const uint8_t DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED[] = { + 0x30, // SEQUENCE + 0x01, // length +}; + const uint8_t DER_SEQUENCE_OF_INT8[] = { 0x30, // SEQUENCE 0x09, // length @@ -569,6 +589,117 @@ TEST_F(pkixder_input_tests, ExpectTagAndGetLengthWithWrongLength) ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); } +TEST_F(pkixder_input_tests, ExpectTagAndGetValue_Input_ValidEmpty) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_EMPTY, sizeof DER_SEQUENCE_EMPTY)); + Input value; + ASSERT_EQ(Success, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_TRUE(value.AtEnd()); + ASSERT_TRUE(input.AtEnd()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetValue_Input_ValidNotEmpty) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY, sizeof DER_SEQUENCE_NOT_EMPTY)); + Input value; + ASSERT_EQ(Success, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_TRUE(value.MatchRest(DER_SEQUENCE_NOT_EMPTY_VALUE)); + ASSERT_TRUE(input.AtEnd()); +} + +TEST_F(pkixder_input_tests, + ExpectTagAndGetValue_Input_InvalidNotEmptyValueTruncated) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED, + sizeof DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED)); + Input value; + ASSERT_EQ(Failure, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetValue_Input_InvalidWrongLength) +{ + Input input; + ASSERT_EQ(Success, input.Init(DER_TRUNCATED_SEQUENCE_OF_INT8, + sizeof DER_TRUNCATED_SEQUENCE_OF_INT8)); + Input value; + ASSERT_EQ(Failure, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetLength_Input_InvalidWrongTag) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY, sizeof DER_SEQUENCE_NOT_EMPTY)); + Input value; + ASSERT_EQ(Failure, ExpectTagAndGetValue(input, INTEGER, value)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetValue_SECItem_ValidEmpty) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_EMPTY, sizeof DER_SEQUENCE_EMPTY)); + SECItem value = { siBuffer, nullptr, 5 }; + ASSERT_EQ(Success, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_EQ(0u, value.len); + ASSERT_TRUE(input.AtEnd()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetValue_SECItem_ValidNotEmpty) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY, sizeof DER_SEQUENCE_NOT_EMPTY)); + SECItem value; + ASSERT_EQ(Success, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_EQ(sizeof(DER_SEQUENCE_NOT_EMPTY_VALUE), value.len); + ASSERT_TRUE(value.data); + ASSERT_FALSE(memcmp(value.data, DER_SEQUENCE_NOT_EMPTY_VALUE, + sizeof(DER_SEQUENCE_NOT_EMPTY_VALUE))); + ASSERT_TRUE(input.AtEnd()); +} + +TEST_F(pkixder_input_tests, + ExpectTagAndGetValue_SECItem_InvalidNotEmptyValueTruncated) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED, + sizeof DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED)); + SECItem value; + ASSERT_EQ(Failure, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetValue_SECItem_InvalidWrongLength) +{ + Input input; + ASSERT_EQ(Success, input.Init(DER_TRUNCATED_SEQUENCE_OF_INT8, + sizeof DER_TRUNCATED_SEQUENCE_OF_INT8)); + SECItem value; + ASSERT_EQ(Failure, ExpectTagAndGetValue(input, SEQUENCE, value)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetLength_SECItem_InvalidWrongTag) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY, sizeof DER_SEQUENCE_NOT_EMPTY)); + SECItem value; + ASSERT_EQ(Failure, ExpectTagAndGetValue(input, INTEGER, value)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + TEST_F(pkixder_input_tests, ExpectTagAndSkipLength) { Input input; From 493ba137ecfae666975e99041ff8e76c8f882125 Mon Sep 17 00:00:00 2001 From: Brian Smith Date: Tue, 1 Jul 2014 13:25:43 -0700 Subject: [PATCH 82/94] Bug 1033103: Add and use mozilla::pkix::der::ExpectTagAndGetTLV, r=keeler --HG-- extra : rebase_source : 16461be12705998799f5c84e2043d68b0c431cb0 --- security/pkix/lib/pkixder.h | 16 +++++ security/pkix/lib/pkixocsp.cpp | 10 +--- .../pkix/test/gtest/pkixder_input_tests.cpp | 60 +++++++++++++++++++ 3 files changed, 78 insertions(+), 8 deletions(-) diff --git a/security/pkix/lib/pkixder.h b/security/pkix/lib/pkixder.h index 44a6b418b108..f5b39a88e85d 100644 --- a/security/pkix/lib/pkixder.h +++ b/security/pkix/lib/pkixder.h @@ -338,6 +338,22 @@ ExpectTagAndGetValue(Input& input, uint8_t tag, /*out*/ Input& value) return input.Skip(length, value); } +// Like ExpectTagAndGetValue, except the output SECItem will contain the +// encoded tag and length along with the value. +inline Result +ExpectTagAndGetTLV(Input& input, uint8_t tag, /*out*/ SECItem& tlv) +{ + Input::Mark mark(input.GetMark()); + uint16_t length; + if (internal::ExpectTagAndGetLength(input, tag, length) != Success) { + return Failure; + } + if (input.Skip(length) != Success) { + return Failure; + } + return input.GetSECItem(siBuffer, mark, tlv); +} + inline Result End(Input& input) { diff --git a/security/pkix/lib/pkixocsp.cpp b/security/pkix/lib/pkixocsp.cpp index 83140c5bd411..5285a155a0da 100644 --- a/security/pkix/lib/pkixocsp.cpp +++ b/security/pkix/lib/pkixocsp.cpp @@ -460,14 +460,8 @@ BasicResponse(der::Input& input, Context& context) return der::Fail(SEC_ERROR_BAD_DER); } - // Unwrap the SEQUENCE that contains the certificate, which is itself a - // SEQUENCE. - der::Input::Mark mark(input.GetMark()); - if (der::ExpectTagAndSkipValue(input, der::SEQUENCE) != der::Success) { - return der::Failure; - } - - if (input.GetSECItem(siBuffer, mark, certs[numCerts]) != der::Success) { + if (der::ExpectTagAndGetTLV(input, der::SEQUENCE, certs[numCerts]) + != der::Success) { return der::Failure; } ++numCerts; diff --git a/security/pkix/test/gtest/pkixder_input_tests.cpp b/security/pkix/test/gtest/pkixder_input_tests.cpp index 6f09e9f7578a..6c20220e0ddb 100644 --- a/security/pkix/test/gtest/pkixder_input_tests.cpp +++ b/security/pkix/test/gtest/pkixder_input_tests.cpp @@ -700,6 +700,66 @@ TEST_F(pkixder_input_tests, ExpectTagAndGetLength_SECItem_InvalidWrongTag) ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); } +TEST_F(pkixder_input_tests, ExpectTagAndGetTLV_SECItem_ValidEmpty) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_EMPTY, sizeof DER_SEQUENCE_EMPTY)); + SECItem tlv = { siBuffer, nullptr, 5 }; + ASSERT_EQ(Success, ExpectTagAndGetTLV(input, SEQUENCE, tlv)); + ASSERT_EQ(sizeof DER_SEQUENCE_EMPTY, tlv.len); + ASSERT_TRUE(tlv.data); + ASSERT_FALSE(memcmp(tlv.data, DER_SEQUENCE_EMPTY, + sizeof DER_SEQUENCE_EMPTY)); + ASSERT_TRUE(input.AtEnd()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetTLV_SECItem_ValidNotEmpty) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY, sizeof DER_SEQUENCE_NOT_EMPTY)); + SECItem tlv; + ASSERT_EQ(Success, ExpectTagAndGetTLV(input, SEQUENCE, tlv)); + ASSERT_EQ(sizeof(DER_SEQUENCE_NOT_EMPTY), tlv.len); + ASSERT_TRUE(tlv.data); + ASSERT_FALSE(memcmp(tlv.data, DER_SEQUENCE_NOT_EMPTY, + sizeof(DER_SEQUENCE_NOT_EMPTY))); + ASSERT_TRUE(input.AtEnd()); +} + +TEST_F(pkixder_input_tests, + ExpectTagAndGetTLV_SECItem_InvalidNotEmptyValueTruncated) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED, + sizeof DER_SEQUENCE_NOT_EMPTY_VALUE_TRUNCATED)); + SECItem tlv; + ASSERT_EQ(Failure, ExpectTagAndGetTLV(input, SEQUENCE, tlv)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetTLV_SECItem_InvalidWrongLength) +{ + Input input; + ASSERT_EQ(Success, input.Init(DER_TRUNCATED_SEQUENCE_OF_INT8, + sizeof DER_TRUNCATED_SEQUENCE_OF_INT8)); + SECItem tlv; + ASSERT_EQ(Failure, ExpectTagAndGetTLV(input, SEQUENCE, tlv)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + +TEST_F(pkixder_input_tests, ExpectTagAndGetTLV_SECItem_InvalidWrongTag) +{ + Input input; + ASSERT_EQ(Success, + input.Init(DER_SEQUENCE_NOT_EMPTY, sizeof DER_SEQUENCE_NOT_EMPTY)); + SECItem tlv; + ASSERT_EQ(Failure, ExpectTagAndGetTLV(input, INTEGER, tlv)); + ASSERT_EQ(SEC_ERROR_BAD_DER, PR_GetError()); +} + TEST_F(pkixder_input_tests, ExpectTagAndSkipLength) { Input input; From 829b53c8b43f30ae39b16d47b3553e7dd121b310 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Thu, 3 Jul 2014 15:53:34 +1200 Subject: [PATCH 83/94] b=1020205 reset mRemainingResamplerTail when no longer using the resampler r=padenot --- content/media/webaudio/AudioBufferSourceNode.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/content/media/webaudio/AudioBufferSourceNode.cpp b/content/media/webaudio/AudioBufferSourceNode.cpp index 5e7065c7e9e4..33492e763674 100644 --- a/content/media/webaudio/AudioBufferSourceNode.cpp +++ b/content/media/webaudio/AudioBufferSourceNode.cpp @@ -155,6 +155,7 @@ public: (aOutRate == mBufferSampleRate && !BegunResampling()))) { speex_resampler_destroy(mResampler); mResampler = nullptr; + mRemainingResamplerTail = 0; mBeginProcessing = mStart + 0.5; } From 0edb1283ff768fb46bf3aaddf214cedbb5987257 Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Tue, 1 Jul 2014 18:21:57 +1200 Subject: [PATCH 84/94] b=1027963 count ticks remaining in PlayAudio() better when blocking changes r=padenot The previous code could result in an infinite loop. --HG-- extra : transplant_source : %DB%20%2C%A3%26%A1%B0%00E%0B%85v%DC%1F0%F1%81Tm%9B --- content/media/MediaStreamGraph.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/content/media/MediaStreamGraph.cpp b/content/media/MediaStreamGraph.cpp index 18c386b805c6..12c75a4acdc4 100644 --- a/content/media/MediaStreamGraph.cpp +++ b/content/media/MediaStreamGraph.cpp @@ -942,7 +942,7 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, if (end >= aTo) { toWrite = ticksNeeded; } else { - toWrite = TimeToTicksRoundDown(mSampleRate, end - aFrom); + toWrite = TimeToTicksRoundDown(mSampleRate, end - t); } ticksNeeded -= toWrite; From 7bfa2b8c8fa3480939771d558640aaf5459868b5 Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Wed, 2 Jul 2014 21:06:28 -0700 Subject: [PATCH 85/94] Bug 1033920 - Handle null in XrayWrapper::setPrototypeOf. v1 r=efaust From ac73068c4494c0df74329482e57f64ba8ec93cb4 Mon Sep 17 00:00:00 2001 --- js/xpconnect/tests/unit/test_bug1033920.js | 7 +++++++ js/xpconnect/tests/unit/xpcshell.ini | 1 + js/xpconnect/wrappers/XrayWrapper.cpp | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) create mode 100644 js/xpconnect/tests/unit/test_bug1033920.js diff --git a/js/xpconnect/tests/unit/test_bug1033920.js b/js/xpconnect/tests/unit/test_bug1033920.js new file mode 100644 index 000000000000..dc3834ecb8e9 --- /dev/null +++ b/js/xpconnect/tests/unit/test_bug1033920.js @@ -0,0 +1,7 @@ +const Cu = Components.utils; +function run_test() { + var sb = Cu.Sandbox('http://www.example.com'); + var o = new sb.Object(); + o.__proto__ = null; + do_check_eq(Object.getPrototypeOf(o), null); +} diff --git a/js/xpconnect/tests/unit/xpcshell.ini b/js/xpconnect/tests/unit/xpcshell.ini index 4131ca31820e..ddc9f14b889a 100644 --- a/js/xpconnect/tests/unit/xpcshell.ini +++ b/js/xpconnect/tests/unit/xpcshell.ini @@ -44,6 +44,7 @@ support-files = [test_bug1001094.js] [test_bug1021312.js] [test_bug1033253.js] +[test_bug1033920.js] [test_bug_442086.js] [test_file.js] [test_blob.js] diff --git a/js/xpconnect/wrappers/XrayWrapper.cpp b/js/xpconnect/wrappers/XrayWrapper.cpp index 304508156ccf..a0b8fb9c2852 100644 --- a/js/xpconnect/wrappers/XrayWrapper.cpp +++ b/js/xpconnect/wrappers/XrayWrapper.cpp @@ -2653,7 +2653,7 @@ XrayWrapper::setPrototypeOf(JSContext *cx, JS::HandleObject wrappe // The expando lives in the target's compartment, so do our installation there. JSAutoCompartment ac(cx, target); - RootedValue v(cx, ObjectValue(*proto)); + RootedValue v(cx, ObjectOrNullValue(proto)); if (!JS_WrapValue(cx, &v)) return false; JS_SetReservedSlot(expando, JSSLOT_EXPANDO_PROTOTYPE, v); From 518a1f17192835949574e5b114b10d9c3fca6de1 Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Wed, 2 Jul 2014 11:22:40 -0700 Subject: [PATCH 86/94] Bug 956961 - FileDescriptorToFILE should always use its input. r=bent --HG-- extra : rebase_source : 5b5f0b5367c95ba1eb74ec158a93520675ed63ee --- ipc/glue/FileDescriptorUtils.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ipc/glue/FileDescriptorUtils.cpp b/ipc/glue/FileDescriptorUtils.cpp index 590b91e658e2..409ca73230e3 100644 --- a/ipc/glue/FileDescriptorUtils.cpp +++ b/ipc/glue/FileDescriptorUtils.cpp @@ -91,11 +91,13 @@ FILE* FileDescriptorToFILE(const FileDescriptor& aDesc, const char* aOpenMode) { + // Debug builds check whether the handle was "used", even if it's + // invalid, so that needs to happen first. + FileDescriptor::PlatformHandleType handle = aDesc.PlatformHandle(); if (!aDesc.IsValid()) { errno = EBADF; return nullptr; } - FileDescriptor::PlatformHandleType handle = aDesc.PlatformHandle(); #ifdef XP_WIN int fd = _open_osfhandle(reinterpret_cast(handle), 0); if (fd == -1) { From 1e4a828cc8aad1fc2d0c584dc74e313d4867b1a0 Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Wed, 2 Jul 2014 15:59:02 -0700 Subject: [PATCH 87/94] Bug 956961 - Open content processes' DMD log files in the parent process. r=njn --HG-- extra : rebase_source : 2958f582f43bfac86ec29d784b4fb8825ca17257 extra : histedit_source : 96e39e36cbe506332d761c375b902284a695901a%2C245fc9ec3c6a3bbf4e5e5ce7b0da63f4477f36b9 --- dom/ipc/ContentChild.cpp | 17 +++++----- dom/ipc/ContentChild.h | 4 +-- dom/ipc/ContentParent.cpp | 20 ++++++++++-- dom/ipc/ContentParent.h | 2 +- dom/ipc/PContent.ipdl | 2 +- xpcom/base/nsGZFileWriter.cpp | 9 ++++-- xpcom/base/nsIGZFileWriter.idl | 10 +++++- xpcom/base/nsIMemoryReporter.idl | 13 +++++--- xpcom/base/nsMemoryInfoDumper.cpp | 43 ++++++++++++++++++++------ xpcom/base/nsMemoryInfoDumper.h | 8 +++++ xpcom/base/nsMemoryReporterManager.cpp | 30 +++++++++++++----- 11 files changed, 119 insertions(+), 39 deletions(-) diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index e01be71c85dc..29b40df5f774 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -59,6 +59,7 @@ #include "nsIMutable.h" #include "nsIObserverService.h" #include "nsIScriptSecurityManager.h" +#include "nsMemoryInfoDumper.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" #include "nsXULAppAPI.h" @@ -192,22 +193,22 @@ public: NS_DECL_ISUPPORTS MemoryReportRequestChild(uint32_t aGeneration, bool aAnonymize, - const nsAString& aDMDDumpIdent); + const FileDescriptor& aDMDFile); NS_IMETHOD Run(); private: virtual ~MemoryReportRequestChild(); uint32_t mGeneration; bool mAnonymize; - nsString mDMDDumpIdent; + FileDescriptor mDMDFile; }; NS_IMPL_ISUPPORTS(MemoryReportRequestChild, nsIRunnable) MemoryReportRequestChild::MemoryReportRequestChild( - uint32_t aGeneration, bool aAnonymize, const nsAString& aDMDDumpIdent) + uint32_t aGeneration, bool aAnonymize, const FileDescriptor& aDMDFile) : mGeneration(aGeneration), mAnonymize(aAnonymize), - mDMDDumpIdent(aDMDDumpIdent) + mDMDFile(aDMDFile) { MOZ_COUNT_CTOR(MemoryReportRequestChild); } @@ -692,10 +693,10 @@ PMemoryReportRequestChild* ContentChild::AllocPMemoryReportRequestChild(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString& aDMDDumpIdent) + const FileDescriptor& aDMDFile) { MemoryReportRequestChild *actor = - new MemoryReportRequestChild(aGeneration, aAnonymize, aDMDDumpIdent); + new MemoryReportRequestChild(aGeneration, aAnonymize, aDMDFile); actor->AddRef(); return actor; } @@ -750,7 +751,7 @@ ContentChild::RecvPMemoryReportRequestConstructor( const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, - const nsString& aDMDDumpIdent) + const FileDescriptor& aDMDFile) { MemoryReportRequestChild *actor = static_cast(aChild); @@ -784,7 +785,7 @@ NS_IMETHODIMP MemoryReportRequestChild::Run() new MemoryReportsWrapper(&reports); nsRefPtr cb = new MemoryReportCallback(process); mgr->GetReportsForThisProcessExtended(cb, wrappedReports, mAnonymize, - mDMDDumpIdent); + FileDescriptorToFILE(mDMDFile, "wb")); bool sent = Send__delete__(this, mGeneration, reports); return sent ? NS_OK : NS_ERROR_FAILURE; diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index a97e1dc11ac6..3db0d5983668 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -155,7 +155,7 @@ public: AllocPMemoryReportRequestChild(const uint32_t& aGeneration, const bool& aAnonymize, const bool& aMinimizeMemoryUsage, - const nsString& aDMDDumpIdent) MOZ_OVERRIDE; + const FileDescriptor& aDMDFile) MOZ_OVERRIDE; virtual bool DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor) MOZ_OVERRIDE; @@ -164,7 +164,7 @@ public: const uint32_t& aGeneration, const bool& aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString &aDMDDumpIdent) MOZ_OVERRIDE; + const FileDescriptor &aDMDFile) MOZ_OVERRIDE; virtual PCycleCollectWithLogsChild* AllocPCycleCollectWithLogsChild(const bool& aDumpAllTraces, diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 822f1f9e1cd2..136e326444fb 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -103,6 +103,7 @@ #include "nsIURIFixup.h" #include "nsIWindowWatcher.h" #include "nsIXULRuntime.h" +#include "nsMemoryInfoDumper.h" #include "nsMemoryReporterManager.h" #include "nsServiceManagerUtils.h" #include "nsStyleSheetService.h" @@ -2457,9 +2458,22 @@ ContentParent::Observe(nsISupports* aSubject, // The pre-%n part of the string should be all ASCII, so the byte // offset in identOffset should be correct as a char offset. MOZ_ASSERT(cmsg[identOffset - 1] == '='); + FileDescriptor dmdFileDesc; +#ifdef MOZ_DMD + FILE *dmdFile; + nsAutoString dmdIdent(Substring(msg, identOffset)); + nsresult rv = nsMemoryInfoDumper::OpenDMDFile(dmdIdent, Pid(), &dmdFile); + if (NS_WARN_IF(NS_FAILED(rv))) { + // Proceed with the memory report as if DMD were disabled. + dmdFile = nullptr; + } + if (dmdFile) { + dmdFileDesc = FILEToFileDescriptor(dmdFile); + fclose(dmdFile); + } +#endif unused << SendPMemoryReportRequestConstructor( - generation, anonymize, minimize, - nsString(Substring(msg, identOffset))); + generation, anonymize, minimize, dmdFileDesc); } } else if (!strcmp(aTopic, "child-gc-request")){ @@ -2804,7 +2818,7 @@ PMemoryReportRequestParent* ContentParent::AllocPMemoryReportRequestParent(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString &aDMDDumpIdent) + const FileDescriptor &aDMDFile) { MemoryReportRequestParent* parent = new MemoryReportRequestParent(); return parent; diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 6c08a5787b61..c074f9191e35 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -422,7 +422,7 @@ private: AllocPMemoryReportRequestParent(const uint32_t& aGeneration, const bool &aAnonymize, const bool &aMinimizeMemoryUsage, - const nsString &aDMDDumpIdent) MOZ_OVERRIDE; + const FileDescriptor &aDMDFile) MOZ_OVERRIDE; virtual bool DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) MOZ_OVERRIDE; virtual PCycleCollectWithLogsParent* diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index c073b68c72e4..bd85b0986b77 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -352,7 +352,7 @@ child: async SetProcessSandbox(); PMemoryReportRequest(uint32_t generation, bool anonymize, - bool minimizeMemoryUsage, nsString DMDDumpIdent); + bool minimizeMemoryUsage, FileDescriptor DMDFile); /** * Notify the AudioChannelService in the child processes. diff --git a/xpcom/base/nsGZFileWriter.cpp b/xpcom/base/nsGZFileWriter.cpp index 92a02535c5c1..29bc8608a435 100644 --- a/xpcom/base/nsGZFileWriter.cpp +++ b/xpcom/base/nsGZFileWriter.cpp @@ -47,9 +47,14 @@ nsGZFileWriter::Init(nsIFile* aFile) if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } + return InitANSIFileDesc(file); +} - mGZFile = gzdopen(dup(fileno(file)), "wb"); - fclose(file); +NS_IMETHODIMP +nsGZFileWriter::InitANSIFileDesc(FILE* aFile) +{ + mGZFile = gzdopen(dup(fileno(aFile)), "wb"); + fclose(aFile); // gzdopen returns nullptr on error. if (NS_WARN_IF(!mGZFile)) { diff --git a/xpcom/base/nsIGZFileWriter.idl b/xpcom/base/nsIGZFileWriter.idl index cff1fe949fd1..70898e9e2897 100644 --- a/xpcom/base/nsIGZFileWriter.idl +++ b/xpcom/base/nsIGZFileWriter.idl @@ -8,9 +8,11 @@ %{C++ #include "nsDependentString.h" +#include %} interface nsIFile; +[ptr] native FILE(FILE); /** * A simple interface for writing to a .gz file. @@ -22,7 +24,7 @@ interface nsIFile; * The standard gunzip tool cannot decompress a raw gzip stream, but can handle * the files produced by this interface. */ -[scriptable, uuid(a256f26a-c603-459e-b5a4-53b4877f2cd8)] +[scriptable, uuid(6bd5642c-1b90-4499-ba4b-199f27efaba5)] interface nsIGZFileWriter : nsISupports { /** @@ -34,6 +36,12 @@ interface nsIGZFileWriter : nsISupports */ void init(in nsIFile file); + /** + * Alternate version of init() for use when the file is already opened; + * e.g., with a FileDescriptor passed over IPC. + */ + [noscript] void initANSIFileDesc(in FILE file); + /** * Write the given string to the file. */ diff --git a/xpcom/base/nsIMemoryReporter.idl b/xpcom/base/nsIMemoryReporter.idl index c9bfbd6aba18..2c40fac11c5e 100644 --- a/xpcom/base/nsIMemoryReporter.idl +++ b/xpcom/base/nsIMemoryReporter.idl @@ -5,10 +5,14 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.idl" +%{C++ +#include +%} interface nsIDOMWindow; interface nsIRunnable; interface nsISimpleEnumerator; +[ptr] native FILE(FILE); /* * Memory reporters measure Firefox's memory usage. They are primarily used to @@ -201,7 +205,7 @@ interface nsIFinishReportingCallback : nsISupports void callback(in nsISupports data); }; -[scriptable, builtinclass, uuid(c27f8662-a0b7-45b3-8207-14d66b02b9c5)] +[scriptable, builtinclass, uuid(51e17609-e98a-47cc-9f95-095ef3c3823e)] interface nsIMemoryReporterManager : nsISupports { /* @@ -294,15 +298,14 @@ interface nsIMemoryReporterManager : nsISupports in boolean anonymize); /* - * As above, but if DMD is enabled and |DMDDumpIdent| is non-empty - * then write a DMD report to a file in the usual temporary directory (see - * |dumpMemoryInfoToTempDir| in |nsIMemoryInfoDumper|.) + * As above, but if DMD is enabled and |DMDFile| is non-null then + * write a DMD report to that file and close it. */ [noscript] void getReportsForThisProcessExtended(in nsIMemoryReporterCallback handleReport, in nsISupports handleReportData, in boolean anonymize, - in AString DMDDumpIdent); + in FILE DMDFile); /* * The memory reporter manager, for the most part, treats reporters diff --git a/xpcom/base/nsMemoryInfoDumper.cpp b/xpcom/base/nsMemoryInfoDumper.cpp index 0491e50a4137..e2f5fb53efb2 100644 --- a/xpcom/base/nsMemoryInfoDumper.cpp +++ b/xpcom/base/nsMemoryInfoDumper.cpp @@ -24,7 +24,9 @@ #ifdef XP_WIN #include +#ifndef getpid #define getpid _getpid +#endif #else #include #endif @@ -508,12 +510,12 @@ NS_IMPL_ISUPPORTS(DumpReportCallback, nsIHandleReportCallback) static void MakeFilename(const char* aPrefix, const nsAString& aIdentifier, - const char* aSuffix, nsACString& aResult) + int aPid, const char* aSuffix, nsACString& aResult) { aResult = nsPrintfCString("%s-%s-%d.%s", aPrefix, NS_ConvertUTF16toUTF8(aIdentifier).get(), - getpid(), aSuffix); + aPid, aSuffix); } #ifdef MOZ_DMD @@ -633,7 +635,8 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, // each process as was the case before bug 946407. This is so that // the get_about_memory.py script in the B2G repository can // determine when it's done waiting for files to appear. - MakeFilename("unified-memory-report", identifier, "json.gz", mrFilename); + MakeFilename("unified-memory-report", identifier, getpid(), "json.gz", + mrFilename); nsCOMPtr mrTmpFile; nsresult rv; @@ -676,24 +679,25 @@ nsMemoryInfoDumper::DumpMemoryInfoToTempDir(const nsAString& aIdentifier, #ifdef MOZ_DMD nsresult -nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) +nsMemoryInfoDumper::OpenDMDFile(const nsAString& aIdentifier, int aPid, + FILE** aOutFile) { if (!dmd::IsRunning()) { + *aOutFile = nullptr; return NS_OK; } - nsresult rv; - // Create a filename like dmd--.txt.gz, which will be used // if DMD is enabled. nsCString dmdFilename; - MakeFilename("dmd", aIdentifier, "txt.gz", dmdFilename); + MakeFilename("dmd", aIdentifier, aPid, "txt.gz", dmdFilename); // Open a new DMD file named |dmdFilename| in NS_OS_TEMP_DIR for writing, // and dump DMD output to it. This must occur after the memory reporters // have been run (above), but before the memory-reports file has been // renamed (so scripts can detect the DMD file, if present). + nsresult rv; nsCOMPtr dmdFile; rv = nsDumpUtils::OpenTempFile(dmdFilename, getter_AddRefs(dmdFile), @@ -701,15 +705,21 @@ nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } + rv = dmdFile->OpenANSIFileDesc("wb", aOutFile); + NS_WARN_IF(NS_FAILED(rv)); + return rv; +} +nsresult +nsMemoryInfoDumper::DumpDMDToFile(FILE* aFile) +{ nsRefPtr dmdWriter = new nsGZFileWriter(); - rv = dmdWriter->Init(dmdFile); + nsresult rv = dmdWriter->InitANSIFileDesc(aFile); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } // Dump DMD output to the file. - DMDWriteState state(dmdWriter); dmd::Writer w(DMDWrite, &state); dmd::Dump(w); @@ -718,6 +728,21 @@ nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) NS_WARN_IF(NS_FAILED(rv)); return rv; } + +nsresult +nsMemoryInfoDumper::DumpDMD(const nsAString& aIdentifier) +{ + nsresult rv; + FILE* dmdFile; + rv = OpenDMDFile(aIdentifier, getpid(), &dmdFile); + if (NS_WARN_IF(NS_FAILED(rv))) { + return rv; + } + if (!dmdFile) { + return NS_OK; + } + return DumpDMDToFile(dmdFile); +} #endif // MOZ_DMD NS_IMETHODIMP diff --git a/xpcom/base/nsMemoryInfoDumper.h b/xpcom/base/nsMemoryInfoDumper.h index ad6b0394ff9f..b77602df5699 100644 --- a/xpcom/base/nsMemoryInfoDumper.h +++ b/xpcom/base/nsMemoryInfoDumper.h @@ -8,6 +8,7 @@ #define mozilla_nsMemoryInfoDumper_h #include "nsIMemoryInfoDumper.h" +#include class nsACString; @@ -31,7 +32,14 @@ public: static void Initialize(); #ifdef MOZ_DMD + // Write a DMD report. static nsresult DumpDMD(const nsAString& aIdentifier); + // Open an appropriately named file for a DMD report. If DMD is + // disabled, return a null FILE* instead. + static nsresult OpenDMDFile(const nsAString& aIdentifier, int aPid, + FILE** aOutFile); + // Write a DMD report to the given file and close it. + static nsresult DumpDMDToFile(FILE* aFile); #endif }; diff --git a/xpcom/base/nsMemoryReporterManager.cpp b/xpcom/base/nsMemoryReporterManager.cpp index 63cd7da1fb7a..a6a7480d48c5 100644 --- a/xpcom/base/nsMemoryReporterManager.cpp +++ b/xpcom/base/nsMemoryReporterManager.cpp @@ -27,7 +27,12 @@ #include "mozilla/Telemetry.h" #include "mozilla/dom/PMemoryReportRequestParent.h" // for dom::MemoryReport -#ifndef XP_WIN +#ifdef XP_WIN +#include +#ifndef getpid +#define getpid _getpid +#endif +#else #include #endif @@ -1104,8 +1109,17 @@ nsMemoryReporterManager::StartGettingReports() GetReportsState* s = mGetReportsState; // Get reports for this process. + FILE *parentDMDFile = nullptr; +#ifdef MOZ_DMD + nsresult rv = nsMemoryInfoDumper::OpenDMDFile(s->mDMDDumpIdent, getpid(), + &parentDMDFile); + if (NS_WARN_IF(NS_FAILED(rv))) { + // Proceed with the memory report as if DMD were disabled. + parentDMDFile = nullptr; + } +#endif GetReportsForThisProcessExtended(s->mHandleReport, s->mHandleReportData, - s->mAnonymize, s->mDMDDumpIdent); + s->mAnonymize, parentDMDFile); s->mParentDone = true; // If there are no remaining child processes, we can finish up immediately. @@ -1138,13 +1152,13 @@ nsMemoryReporterManager::GetReportsForThisProcess( nsISupports* aHandleReportData, bool aAnonymize) { return GetReportsForThisProcessExtended(aHandleReport, aHandleReportData, - aAnonymize, nsString()); + aAnonymize, nullptr); } NS_IMETHODIMP nsMemoryReporterManager::GetReportsForThisProcessExtended( nsIHandleReportCallback* aHandleReport, nsISupports* aHandleReportData, - bool aAnonymize, const nsAString& aDMDDumpIdent) + bool aAnonymize, FILE* aDMDFile) { // Memory reporters are not necessarily threadsafe, so this function must // be called from the main thread. @@ -1153,11 +1167,13 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( } #ifdef MOZ_DMD - if (!aDMDDumpIdent.IsEmpty()) { + if (aDMDFile) { // Clear DMD's reportedness state before running the memory // reporters, to avoid spurious twice-reported warnings. dmd::ClearReports(); } +#else + MOZ_ASSERT(!aDMDFile); #endif MemoryReporterArray allReporters; @@ -1172,8 +1188,8 @@ nsMemoryReporterManager::GetReportsForThisProcessExtended( } #ifdef MOZ_DMD - if (!aDMDDumpIdent.IsEmpty()) { - return nsMemoryInfoDumper::DumpDMD(aDMDDumpIdent); + if (aDMDFile) { + return nsMemoryInfoDumper::DumpDMDToFile(aDMDFile); } #endif From afdeb7bf07ef907294a84b17c50d54a7ccb561bc Mon Sep 17 00:00:00 2001 From: Jed Davis Date: Wed, 2 Jul 2014 11:28:48 -0700 Subject: [PATCH 88/94] Bug 956961 - Stop disabling sandboxing when DMD is enabled. r=kang --HG-- extra : rebase_source : 4737cfd613c1ddee8e1a4340e819eddc151e73f7 extra : histedit_source : 2d2610a775a3ae986157f61ef3797f4e88baa922 --- security/sandbox/linux/Sandbox.cpp | 9 --------- 1 file changed, 9 deletions(-) diff --git a/security/sandbox/linux/Sandbox.cpp b/security/sandbox/linux/Sandbox.cpp index 1b60e549362c..bde6268f38eb 100644 --- a/security/sandbox/linux/Sandbox.cpp +++ b/security/sandbox/linux/Sandbox.cpp @@ -211,15 +211,6 @@ InstallSyscallReporter(void) static int InstallSyscallFilter(const sock_fprog *prog) { -#ifdef MOZ_DMD - char* e = PR_GetEnv("DMD"); - if (e && strcmp(e, "") != 0 && strcmp(e, "0") != 0) { - LOG_ERROR("SANDBOX DISABLED FOR DMD! See bug 956961."); - // Must treat this as "failure" in order to prevent infinite loop; - // cf. the PR_GET_SECCOMP check below. - return 1; - } -#endif if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)) { return 1; } From e56956aa2f756332ef044f55a4fc32688ca6e591 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Wed, 2 Jul 2014 18:55:19 -0700 Subject: [PATCH 89/94] Bug 1032644 - Fix some -Wunused warnings in non-unified OS X build. r=ehsan --- caps/src/nsNullPrincipalURI.cpp | 3 ++- caps/src/nsScriptSecurityManager.cpp | 2 -- extensions/spellcheck/hunspell/src/mozHunspell.cpp | 2 -- extensions/spellcheck/src/moz.build | 2 ++ extensions/spellcheck/src/mozPersonalDictionary.cpp | 4 ---- extensions/universalchardet/src/base/moz.build | 2 ++ extensions/universalchardet/src/xpcom/moz.build | 2 ++ .../universalchardet/src/xpcom/nsUdetXPCOMWrapper.cpp | 3 --- parser/html/moz.build | 1 + parser/html/nsParserUtils.cpp | 4 ---- toolkit/xre/nsSigHandlers.cpp | 8 ++++---- 11 files changed, 13 insertions(+), 20 deletions(-) diff --git a/caps/src/nsNullPrincipalURI.cpp b/caps/src/nsNullPrincipalURI.cpp index b5e0d2bb127e..629626de67b0 100644 --- a/caps/src/nsNullPrincipalURI.cpp +++ b/caps/src/nsNullPrincipalURI.cpp @@ -6,6 +6,7 @@ #include "nsNullPrincipalURI.h" +#include "mozilla/DebugOnly.h" #include "mozilla/MemoryReporting.h" #include "nsNetUtil.h" @@ -20,7 +21,7 @@ nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec) int32_t dividerPosition = aSpec.FindChar(':'); NS_ASSERTION(dividerPosition != -1, "Malformed URI!"); - int32_t n = aSpec.Left(mScheme, dividerPosition); + mozilla::DebugOnly n = aSpec.Left(mScheme, dividerPosition); NS_ASSERTION(n == dividerPosition, "Storing the scheme failed!"); int32_t count = aSpec.Length() - dividerPosition - 1; diff --git a/caps/src/nsScriptSecurityManager.cpp b/caps/src/nsScriptSecurityManager.cpp index 158ff7865359..acb3c9ebfa80 100644 --- a/caps/src/nsScriptSecurityManager.cpp +++ b/caps/src/nsScriptSecurityManager.cpp @@ -71,8 +71,6 @@ using namespace mozilla; using namespace mozilla::dom; -static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID); - nsIIOService *nsScriptSecurityManager::sIOService = nullptr; nsIStringBundle *nsScriptSecurityManager::sStrBundle = nullptr; JSRuntime *nsScriptSecurityManager::sRuntime = 0; diff --git a/extensions/spellcheck/hunspell/src/mozHunspell.cpp b/extensions/spellcheck/hunspell/src/mozHunspell.cpp index d2e9c35a0ac3..c18cf7f661e1 100644 --- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp @@ -79,8 +79,6 @@ using mozilla::dom::EncodingUtils; -static NS_DEFINE_CID(kUnicharUtilCID, NS_UNICHARUTIL_CID); - NS_IMPL_CYCLE_COLLECTING_ADDREF(mozHunspell) NS_IMPL_CYCLE_COLLECTING_RELEASE(mozHunspell) diff --git a/extensions/spellcheck/src/moz.build b/extensions/spellcheck/src/moz.build index 1de891847457..57e8b570017e 100644 --- a/extensions/spellcheck/src/moz.build +++ b/extensions/spellcheck/src/moz.build @@ -24,3 +24,5 @@ LOCAL_INCLUDES += [ '/content/base/src', '/editor/libeditor/base', ] + +FAIL_ON_WARNINGS = True diff --git a/extensions/spellcheck/src/mozPersonalDictionary.cpp b/extensions/spellcheck/src/mozPersonalDictionary.cpp index ed9c694b5868..ef23a4318bb3 100644 --- a/extensions/spellcheck/src/mozPersonalDictionary.cpp +++ b/extensions/spellcheck/src/mozPersonalDictionary.cpp @@ -21,8 +21,6 @@ #define MOZ_PERSONAL_DICT_NAME "persdict.dat" -const int kMaxWordLen=256; - /** * This is the most braindead implementation of a personal dictionary possible. * There is not much complexity needed, though. It could be made much faster, @@ -34,7 +32,6 @@ const int kMaxWordLen=256; * Implement the suggestion record. */ - NS_IMPL_CYCLE_COLLECTING_ADDREF(mozPersonalDictionary) NS_IMPL_CYCLE_COLLECTING_RELEASE(mozPersonalDictionary) @@ -390,4 +387,3 @@ NS_IMETHODIMP mozPersonalDictionary::Observe(nsISupports *aSubject, const char * return NS_OK; } - diff --git a/extensions/universalchardet/src/base/moz.build b/extensions/universalchardet/src/base/moz.build index 9867e8a833a6..041dccd9c682 100644 --- a/extensions/universalchardet/src/base/moz.build +++ b/extensions/universalchardet/src/base/moz.build @@ -33,3 +33,5 @@ UNIFIED_SOURCES += [ ] FINAL_LIBRARY = 'universalchardet' + +FAIL_ON_WARNINGS = True diff --git a/extensions/universalchardet/src/xpcom/moz.build b/extensions/universalchardet/src/xpcom/moz.build index b89d526a2128..90ce6cb0e1d9 100644 --- a/extensions/universalchardet/src/xpcom/moz.build +++ b/extensions/universalchardet/src/xpcom/moz.build @@ -16,3 +16,5 @@ FINAL_LIBRARY = 'xul' LOCAL_INCLUDES += [ '../base', ] + +FAIL_ON_WARNINGS = True diff --git a/extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.cpp b/extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.cpp index f8099e1bee1c..adb7f4741bfc 100644 --- a/extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.cpp +++ b/extensions/universalchardet/src/xpcom/nsUdetXPCOMWrapper.cpp @@ -15,9 +15,6 @@ #include "nsISupports.h" #include "nsCOMPtr.h" -static NS_DEFINE_CID(kUniversalDetectorCID, NS_UNIVERSAL_DETECTOR_CID); -static NS_DEFINE_CID(kUniversalStringDetectorCID, NS_UNIVERSAL_STRING_DETECTOR_CID); - //--------------------------------------------------------------------- nsXPCOMDetector:: nsXPCOMDetector(uint32_t aLanguageFilter) : nsUniversalDetector(aLanguageFilter) diff --git a/parser/html/moz.build b/parser/html/moz.build index f46a7b87c50f..fbc2159f2d40 100644 --- a/parser/html/moz.build +++ b/parser/html/moz.build @@ -100,3 +100,4 @@ LOCAL_INCLUDES += [ '../../content/base/src', ] +FAIL_ON_WARNINGS = True diff --git a/parser/html/nsParserUtils.cpp b/parser/html/nsParserUtils.cpp index 7fa34231973d..e49e2fce5042 100644 --- a/parser/html/nsParserUtils.cpp +++ b/parser/html/nsParserUtils.cpp @@ -45,10 +45,6 @@ NS_IMPL_ISUPPORTS(nsParserUtils, nsIScriptableUnescapeHTML, nsIParserUtils) -static NS_DEFINE_CID(kCParserCID, NS_PARSER_CID); - - - NS_IMETHODIMP nsParserUtils::ConvertToPlainText(const nsAString& aFromStr, uint32_t aFlags, diff --git a/toolkit/xre/nsSigHandlers.cpp b/toolkit/xre/nsSigHandlers.cpp index 3bc5d55cb5a6..dd3df27bcf5d 100644 --- a/toolkit/xre/nsSigHandlers.cpp +++ b/toolkit/xre/nsSigHandlers.cpp @@ -39,10 +39,6 @@ static char _progname[1024] = "huh?"; static unsigned int _gdb_sleep_duration = 300; -// NB: keep me up to date with the same variable in -// ipc/chromium/chrome/common/ipc_channel_posix.cc -static const int kClientChannelFd = 3; - #if defined(LINUX) && defined(DEBUG) && \ (defined(__i386) || defined(__x86_64) || defined(PPC)) #define CRAWL_STACK_ON_SIGSEGV @@ -54,6 +50,10 @@ static const int kClientChannelFd = 3; #include "nsISupportsUtils.h" #include "nsStackWalk.h" +// NB: keep me up to date with the same variable in +// ipc/chromium/chrome/common/ipc_channel_posix.cc +static const int kClientChannelFd = 3; + extern "C" { static void PrintStackFrame(void *aPC, void *aSP, void *aClosure) From 0b109cf641c6067b77c854979baf1d19afbf5ebb Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 1 Jul 2014 18:49:52 -0700 Subject: [PATCH 90/94] Bug 1033188 - #include for getenv() function declaration. r=glandium --- memory/build/moz.build | 2 ++ memory/build/replace_malloc.c | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/memory/build/moz.build b/memory/build/moz.build index 5570830738ab..7708ac534432 100644 --- a/memory/build/moz.build +++ b/memory/build/moz.build @@ -46,3 +46,5 @@ if CONFIG['MOZ_MEMORY'] and (CONFIG['OS_TARGET'] in ('WINNT', 'Darwin', 'Android if CONFIG['MOZ_REPLACE_MALLOC'] and CONFIG['OS_TARGET'] == 'Darwin': # The zone allocator for OSX needs some jemalloc internal functions LOCAL_INCLUDES += ['/memory/jemalloc/src/include'] + +FAIL_ON_WARNINGS = True diff --git a/memory/build/replace_malloc.c b/memory/build/replace_malloc.c index 7efbd734c08c..76127bcf83ff 100644 --- a/memory/build/replace_malloc.c +++ b/memory/build/replace_malloc.c @@ -76,10 +76,11 @@ replace_malloc_init_funcs() } # elif defined(MOZ_WIDGET_ANDROID) # include +# include static void replace_malloc_init_funcs() { - char *replace_malloc_lib = getenv("MOZ_REPLACE_MALLOC_LIB"); + const char *replace_malloc_lib = getenv("MOZ_REPLACE_MALLOC_LIB"); if (replace_malloc_lib && *replace_malloc_lib) { void *handle = dlopen(replace_malloc_lib, RTLD_LAZY); if (handle) { From 4009563e3e68645046f5c4fe1dd6ebfd4c93b847 Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Tue, 1 Jul 2014 19:02:56 -0700 Subject: [PATCH 91/94] Bug 1033192 - Fix gcc and MSVC warnings in media/libcubeb/. r=padenot --- media/libcubeb/src/cubeb_opensl.c | 4 ++-- media/libcubeb/src/cubeb_winmm.c | 3 +++ media/libcubeb/src/moz.build | 2 ++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/media/libcubeb/src/cubeb_opensl.c b/media/libcubeb/src/cubeb_opensl.c index 311ba3d13ca5..e859e0c73843 100644 --- a/media/libcubeb/src/cubeb_opensl.c +++ b/media/libcubeb/src/cubeb_opensl.c @@ -49,7 +49,7 @@ struct cubeb_stream { SLObjectItf playerObj; SLPlayItf play; SLBufferQueueItf bufq; - void *queuebuf[NBUFS]; + uint8_t *queuebuf[NBUFS]; int queuebuf_idx; long queuebuf_len; long bytespersec; @@ -102,7 +102,7 @@ bufferqueue_callback(SLBufferQueueItf caller, void * user_ptr) SLuint32 i; for (i = state.count; i < NBUFS; i++) { - void *buf = stm->queuebuf[stm->queuebuf_idx]; + uint8_t *buf = stm->queuebuf[stm->queuebuf_idx]; long written = 0; pthread_mutex_lock(&stm->mutex); int draining = stm->draining; diff --git a/media/libcubeb/src/cubeb_winmm.c b/media/libcubeb/src/cubeb_winmm.c index 6ca98c5aaabe..b77ee6f06231 100644 --- a/media/libcubeb/src/cubeb_winmm.c +++ b/media/libcubeb/src/cubeb_winmm.c @@ -6,8 +6,11 @@ */ #undef NDEBUG #define __MSVCRT_VERSION__ 0x0700 +#undef WINVER #define WINVER 0x0501 +#undef WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN + #include #include #include diff --git a/media/libcubeb/src/moz.build b/media/libcubeb/src/moz.build index 6cf67cb857bf..f0fc9d3e8b98 100644 --- a/media/libcubeb/src/moz.build +++ b/media/libcubeb/src/moz.build @@ -70,3 +70,5 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk': 'system/media/wilhelm/include', ] ] + +FAIL_ON_WARNINGS = True From 9c58a25bae575105e2f61cdbd0449fbeb8e2d6a4 Mon Sep 17 00:00:00 2001 From: Yuan Xulei Date: Thu, 3 Jul 2014 14:07:06 +0800 Subject: [PATCH 92/94] Bug 1027127 - Remove setTimeout to avoid intermittent test failure. r=dchan --- dom/permission/tests/file_shim.html | 6 ------ 1 file changed, 6 deletions(-) diff --git a/dom/permission/tests/file_shim.html b/dom/permission/tests/file_shim.html index 739c5c26eb2a..7791eba65792 100644 --- a/dom/permission/tests/file_shim.html +++ b/dom/permission/tests/file_shim.html @@ -55,12 +55,10 @@ function receiveMessage(e) { var src = e.source; var step = e.data.step; var id = e.data.id; - var timer = window.setTimeout(timeout, 10000); var data = new TestData(e.data.testdata); var success, failure; function reply(res, msg) { - window.clearTimeout(timer); window.removeEventListener("message", receiveMessage, false); src.postMessage({result: res, msg: msg, id: id}, "*"); @@ -74,10 +72,6 @@ function receiveMessage(e) { reply(false, msg); } - function timeout() { - reply(false, "Test timed out", false); - } - // flip success and failure around for precheck if (step == 0) { success = _failure; From 6cbdff01c31c2d20d4a0964f7346659aef3e8bea Mon Sep 17 00:00:00 2001 From: "Nils Ohlmeier [:drno]" Date: Wed, 2 Jul 2014 18:08:00 +0200 Subject: [PATCH 93/94] Bug 1020024 - fix data channel connecting race conditions. r=jib --- dom/media/tests/mochitest/pc.js | 52 +++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 18 deletions(-) diff --git a/dom/media/tests/mochitest/pc.js b/dom/media/tests/mochitest/pc.js index 3463fd5d3068..c40ad988826f 100644 --- a/dom/media/tests/mochitest/pc.js +++ b/dom/media/tests/mochitest/pc.js @@ -1119,23 +1119,17 @@ DataChannelTest.prototype = Object.create(PeerConnectionTest.prototype, { */ value : function DCT_waitForInitialDataChannel(peer, onSuccess, onFailure) { var dcConnectionTimeout = null; + var dcOpened = false; function dataChannelConnected(channel) { - clearTimeout(dcConnectionTimeout); - is(channel.readyState, "open", peer + " dataChannels[0] switched to state: 'open'"); - onSuccess(); - } - - if (peer.dataChannels.length >= 1) { - if (peer.dataChannels[0].readyState === "open") { - is(peer.dataChannels[0].readyState, "open", peer + " dataChannels[0] is already in state: 'open'"); + // in case the switch statement below had called onSuccess already we + // don't want to call it again + if (!dcOpened) { + clearTimeout(dcConnectionTimeout); + is(channel.readyState, "open", peer + " dataChannels[0] switched to state: 'open'"); + dcOpened = true; onSuccess(); - return; - } else { - is(peer.dataChannels[0].readyState, "connecting", peer + " dataChannels[0] is in state: 'connecting'"); } - } else { - info(peer + "'s dataChannels[] is empty"); } // TODO: drno: convert dataChannels into an object and make @@ -1146,11 +1140,33 @@ DataChannelTest.prototype = Object.create(PeerConnectionTest.prototype, { peer.registerDataChannelOpenEvents(dataChannelConnected); } - if (onFailure) { - dcConnectionTimeout = setTimeout(function () { - info(peer + " timed out while waiting for dataChannels[0] to connect"); - onFailure(); - }, 60000); + if (peer.dataChannels.length >= 1) { + // snapshot of the live value as it might change during test execution + const readyState = peer.dataChannels[0].readyState; + switch (readyState) { + case "open": { + is(readyState, "open", peer + " dataChannels[0] is already in state: 'open'"); + dcOpened = true; + onSuccess(); + break; + } + case "connecting": { + is(readyState, "connecting", peer + " dataChannels[0] is in state: 'connecting'"); + if (onFailure) { + dcConnectionTimeout = setTimeout(function () { + is(peer.dataChannels[0].readyState, "open", peer + " timed out while waiting for dataChannels[0] to open"); + onFailure(); + }, 60000); + } + break; + } + default: { + ok(false, "dataChannels[0] is in unexpected state " + readyState); + if (onFailure) { + onFailure() + } + } + } } } } From bbae05b73e0e709e351f07a005469c7d5c105139 Mon Sep 17 00:00:00 2001 From: Henrik Skupin Date: Thu, 3 Jul 2014 07:27:06 +0200 Subject: [PATCH 94/94] Bug 1033680 - TPS should use mozversion to retrieve the application data. r=jgriffin a=testonly DONTBUILD --- testing/tps/setup.py | 1 + testing/tps/tps/testrunner.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) --- testing/tps/setup.py | 1 + testing/tps/tps/testrunner.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/testing/tps/setup.py b/testing/tps/setup.py index 72fb08711fac..0d6d3bc9940b 100644 --- a/testing/tps/setup.py +++ b/testing/tps/setup.py @@ -15,6 +15,7 @@ deps = ['httplib2 >= 0.7.3', 'mozprocess >= 0.18', 'mozprofile >= 0.21', 'mozrunner >= 5.35', + 'mozversion == 0.6', ] # we only support python 2.6+ right now diff --git a/testing/tps/tps/testrunner.py b/testing/tps/tps/testrunner.py index 7e9ee0c01368..c41c73e432cf 100644 --- a/testing/tps/tps/testrunner.py +++ b/testing/tps/tps/testrunner.py @@ -14,6 +14,7 @@ import traceback from mozhttpd import MozHttpd import mozinfo from mozprofile import Profile +import mozversion from .firefoxrunner import TPSFirefoxRunner from .phase import TPSTestPhase @@ -294,7 +295,7 @@ class TPSTestRunner(object): logstr = "\n%s | %s%s\n" % (result[0], testname, (' | %s' % result[1] if result[1] else '')) try: - repoinfo = self.firefoxRunner.runner.get_repositoryInfo() + repoinfo = mozversion.get_version(self.binary) except: repoinfo = {} apprepo = repoinfo.get('application_repository', '')