Created
January 28, 2013 23:03
-
-
Save humphd/4660122 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| DIFF against humphd/rillian patch, focused on Mozilla build integration | |
| diff --git a/content/html/content/public/nsHTMLMediaElement.h b/content/html/content/public/nsHTMLMediaElement.h | |
| index e822318..049fb9b 100644 | |
| --- a/content/html/content/public/nsHTMLMediaElement.h | |
| +++ b/content/html/content/public/nsHTMLMediaElement.h | |
| @@ -24,17 +24,17 @@ | |
| #include "nsTimeRanges.h" | |
| #include "nsIDOMWakeLock.h" | |
| #include "AudioChannelCommon.h" | |
| #include "DecoderTraits.h" | |
| #include "MediaMetadataManager.h" | |
| #include "AudioChannelAgent.h" | |
| //XXXhumph: commented out in rillian's original... | |
| //#include "mozilla/dom/TextTrack.h" | |
| -#include "webvtt.h" | |
| +#include <webvtt/parser.h> | |
| // Define to output information on decoding and painting framerate | |
| /* #define DEBUG_FRAME_RATE 1 */ | |
| typedef uint16_t nsMediaNetworkState; | |
| typedef uint16_t nsMediaReadyState; | |
| namespace mozilla { | |
| diff --git a/content/html/content/src/HTMLTrackElement.cpp b/content/html/content/src/HTMLTrackElement.cpp | |
| index 2159f53..345b865 100644 | |
| --- a/content/html/content/src/HTMLTrackElement.cpp | |
| +++ b/content/html/content/src/HTMLTrackElement.cpp | |
| @@ -27,17 +27,17 @@ | |
| #include "nsIAsyncVerifyRedirectCallback.h" | |
| #include "nsIContentSecurityPolicy.h" | |
| #include "nsIInterfaceRequestor.h" | |
| #include "nsIObserver.h" | |
| #include "nsCOMPtr.h" | |
| #include "nsThreadUtils.h" | |
| #include "nsIFrame.h" | |
| #include "nsVideoFrame.h" | |
| -#include "webvtt.h" | |
| +#include <webvtt/parser.h> | |
| #ifdef PR_LOGGING | |
| #warning enabling nspr logging | |
| static PRLogModuleInfo* gTrackElementLog; | |
| #define LOG(type, msg) PR_LOG(gTrackElementLog, type, msg) | |
| #else | |
| #define LOG(type, msg) | |
| #endif | |
| @@ -145,16 +145,19 @@ HTMLTrackElement::LoadListener::OnDataAvailable(nsIRequest* aRequest, | |
| uint32_t read; | |
| rv = aStream->Read(buf, aCount, &read); | |
| NS_ENSURE_SUCCESS(rv, rv); | |
| if (read >= aCount) | |
| read = aCount - 1; | |
| buf[read] = '\0'; | |
| printf("Track data:\n%s\n", buf); | |
| +#if 0 | |
| + // TODO: | |
| + // Implement this using libwebvtt | |
| webvtt_parser *webvtt = webvtt_parse_new(); | |
| NS_ENSURE_TRUE(webvtt, NS_ERROR_FAILURE); | |
| webvtt_cue *cue = webvtt_parse_buffer(webvtt, buf, read); | |
| webvtt_parse_free(webvtt); | |
| // poke the cues into the parent object | |
| nsHTMLMediaElement* parent = | |
| @@ -163,17 +166,17 @@ HTMLTrackElement::LoadListener::OnDataAvailable(nsIRequest* aRequest, | |
| // Get the parent media element's frame | |
| nsIFrame* frame = mElement->mMediaParent->GetPrimaryFrame(); | |
| if (frame && frame->GetType() == nsGkAtoms::HTMLVideoFrame) { | |
| nsIContent *overlay = static_cast<nsVideoFrame*>(frame)->GetCaptionOverlay(); | |
| nsCOMPtr<nsIDOMHTMLElement> div = do_QueryInterface(overlay); | |
| div->SetInnerHTML(NS_ConvertUTF8toUTF16(cue->text)); | |
| } | |
| - | |
| +#endif | |
| free(buf); | |
| } | |
| return NS_OK; | |
| } | |
| NS_IMETHODIMP | |
| HTMLTrackElement::LoadListener::AsyncOnChannelRedirect( | |
| diff --git a/content/html/content/src/nsHTMLMediaElement.cpp b/content/html/content/src/nsHTMLMediaElement.cpp | |
| index 0e50ad8..09b7645 100644 | |
| --- a/content/html/content/src/nsHTMLMediaElement.cpp | |
| +++ b/content/html/content/src/nsHTMLMediaElement.cpp | |
| @@ -3410,16 +3410,17 @@ void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic) | |
| if (mFragmentEnd >= 0.0 && time >= mFragmentEnd) { | |
| Pause(); | |
| mFragmentEnd = -1.0; | |
| mFragmentStart = -1.0; | |
| mDecoder->SetFragmentEndTime(mFragmentEnd); | |
| } | |
| // HACK: update current text track cue from here | |
| +#if 0 | |
| nsIFrame* frame = GetPrimaryFrame(); | |
| if (frame && frame->GetType() == nsGkAtoms::HTMLVideoFrame) { | |
| nsIContent *overlay = static_cast<nsVideoFrame*>(frame)->GetCaptionOverlay(); | |
| long mstime = time * 1e3; | |
| webvtt_cue *cue = mCues; | |
| while (cue) { | |
| if (cue->start < mstime && cue->end > mstime) | |
| break; | |
| @@ -3427,16 +3428,17 @@ void nsHTMLMediaElement::FireTimeUpdate(bool aPeriodic) | |
| } | |
| const char *text = cue ? cue->text : ""; | |
| nsCOMPtr<nsIDOMHTMLElement> div = do_QueryInterface(overlay); | |
| char timestring[1024] = "mollis non commodo et"; | |
| snprintf(timestring, 1024, "<p>Cue update %lf</p>\n" | |
| "<p>%s</p>\n", time, text); | |
| div->SetInnerHTML(NS_ConvertUTF8toUTF16(timestring)); | |
| } | |
| +#endif | |
| } | |
| void nsHTMLMediaElement::GetCurrentSpec(nsCString& aString) | |
| { | |
| if (mLoadingSrc) { | |
| mLoadingSrc->GetSpec(aString); | |
| } else { | |
| aString.Truncate(); | |
| diff --git a/content/media/webvtt/nsWebVTTReader.cpp b/content/media/webvtt/nsWebVTTReader.cpp | |
| index 13b69ef..ca65285 100644 | |
| --- a/content/media/webvtt/nsWebVTTReader.cpp | |
| +++ b/content/media/webvtt/nsWebVTTReader.cpp | |
| @@ -4,17 +4,17 @@ | |
| * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | |
| #if !defined(nsWebVTTReader_h_) | |
| #define nsWebVTTReader_h_ | |
| #include "nsBuiltinDecoderReader.h" | |
| #include "nsWebVTTReader.h" | |
| -#include "webvtt/webvtt.h" | |
| +#include <webvtt/parser.h> | |
| nsWebVTTReader::nsWebVTTReader(nsBuildinDecoder* aDecoder) | |
| : nsBuiltinDecoderReader(aDecoder) | |
| { | |
| MOZ_COUNT_CTOR(nsWebVTTReader); | |
| } | |
| nsWebVTTReader::~nsWebVTTReader() | |
| diff --git a/layout/media/Makefile.in b/layout/media/Makefile.in | |
| index a23567a..6b7e39a 100644 | |
| --- a/layout/media/Makefile.in | |
| +++ b/layout/media/Makefile.in | |
| @@ -62,16 +62,22 @@ SHARED_LIBRARY_LIBS += \ | |
| endif | |
| ifdef MOZ_WEBM | |
| SHARED_LIBRARY_LIBS += \ | |
| $(DEPTH)/media/libnestegg/src/$(LIB_PREFIX)nestegg.$(LIB_SUFFIX) \ | |
| $(NULL) | |
| endif | |
| +ifdef MOZ_WEBVTT | |
| +SHARED_LIBRARY_LIBS += \ | |
| + $(DEPTH)/media/webvtt/$(LIB_PREFIX)webvtt.$(LIB_SUFFIX) \ | |
| + $(NULL) | |
| +endif | |
| + | |
| ifdef MOZ_VP8 | |
| ifndef MOZ_NATIVE_LIBVPX | |
| SHARED_LIBRARY_LIBS += \ | |
| $(DEPTH)/media/libvpx/$(LIB_PREFIX)vpx.$(LIB_SUFFIX) \ | |
| $(NULL) | |
| endif | |
| endif | |
| diff --git a/media/webvtt/Makefile.in b/media/webvtt/Makefile.in | |
| index 1bc2b74..7153fc5 100644 | |
| --- a/media/webvtt/Makefile.in | |
| +++ b/media/webvtt/Makefile.in | |
| @@ -1,28 +1,38 @@ | |
| # 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/. | |
| -DEPTH = ../.. | |
| +DEPTH = ../.. | |
| topsrcdir = @top_srcdir@ | |
| srcdir = @srcdir@ | |
| VPATH = @srcdir@ | |
| - | |
| +DIRS = src | |
| + | |
| include $(DEPTH)/config/autoconf.mk | |
| -MODULE = webvtt | |
| -LIBRARY_NAME = webvtt | |
| -FORCE_STATIC_LIB= 1 | |
| +MODULE = webvtt | |
| +LIBRARY_NAME = webvtt | |
| -EXPORTS = \ | |
| - webvtt.h \ | |
| - $(NULL) | |
| +#Doesn't seem to matter | |
| +#FORCE_STATIC_LIB = 1 | |
| -VPATH += \ | |
| - $(srcdir)/src \ | |
| +EXPORTS_NAMESPACES = webvtt | |
| +EXPORTS_webvtt = \ | |
| + include/webvtt/cue.h \ | |
| + include/webvtt/error.h \ | |
| + include/webvtt/parser.h \ | |
| + include/webvtt/string.h \ | |
| + include/webvtt/util.h \ | |
| $(NULL) | |
| CSRCS = \ | |
| - webvtt.c \ | |
| + src/alloc.c \ | |
| + src/cue.c \ | |
| + src/cuetext.c \ | |
| + src/error.c \ | |
| + src/lexer.c \ | |
| + src/parser.c \ | |
| + src/string.c \ | |
| $(NULL) | |
| include $(topsrcdir)/config/rules.mk | |
| diff --git a/media/webvtt/patch1.patch b/media/webvtt/patch1.patch | |
| new file mode 100644 | |
| index 0000000..88a9278 | |
| --- /dev/null | |
| +++ b/media/webvtt/patch1.patch | |
| @@ -0,0 +1,22 @@ | |
| +diff -ubr old/webvtt/util.h include/webvtt/util.h | |
| +--- old/webvtt/util.h 2013-01-28 10:54:49.000000000 -0500 | |
| ++++ include/webvtt/util.h 2013-01-28 10:54:14.000000000 -0500 | |
| +@@ -5,14 +5,15 @@ | |
| + extern "C" { | |
| + #endif | |
| + | |
| ++# ifndef WEBVTT_STATIC | |
| ++# define WEBVTT_STATIC (1) | |
| ++# endif | |
| ++ | |
| + # if defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__) | |
| +-# include "webvtt-config-win32.h" | |
| + # define WEBVTT_OS_WIN32 1 | |
| + # if defined(_WIN64) | |
| + # define WEBVTT_OS_WIN64 1 | |
| + # endif | |
| +-# else | |
| +-# include <webvtt/webvtt-config.h> | |
| + # endif | |
| + | |
| + # if defined(_MSC_VER) | |
| diff --git a/media/webvtt/patch2.patch b/media/webvtt/patch2.patch | |
| new file mode 100644 | |
| index 0000000..b14f920 | |
| --- /dev/null | |
| +++ b/media/webvtt/patch2.patch | |
| @@ -0,0 +1,21 @@ | |
| +Create empty Makefile under `src' to force creation of directory | |
| +--- src/Makefile.in 1969-12-31 19:00:00.000000000 -0500 | |
| ++++ src/Makefile.in 2013-01-28 14:52:37.000000000 -0500 | |
| +@@ -0,0 +1,17 @@ | |
| ++# 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/. | |
| ++ | |
| ++DEPTH = ../../.. | |
| ++topsrcdir = @top_srcdir@ | |
| ++srcdir = @srcdir@ | |
| ++VPATH = @srcdir@ | |
| ++ | |
| ++include $(DEPTH)/config/autoconf.mk | |
| ++ | |
| ++MODULE = webvtt | |
| ++LIBRARY_NAME = webvtt | |
| ++ | |
| ++#Empty Makefile.in to force directory creation | |
| ++ | |
| ++include $(topsrcdir)/config/rules.mk | |
| diff --git a/media/webvtt/update.sh b/media/webvtt/update.sh | |
| index 7ee6874..8be38dc 100755 | |
| --- a/media/webvtt/update.sh | |
| +++ b/media/webvtt/update.sh | |
| @@ -1,13 +1,30 @@ | |
| #!/bin/sh | |
| # script to update the webvtt library source | |
| -URL=https://github.com/rillian/webvtt.git | |
| -SRCDIR=src | |
| +URL=https://github.com/mozilla/webvtt.git | |
| +BRANCH=dev | |
| +REPO=gunk | |
| +SRCDIR=. | |
| -if [ -d ${SRCDIR}/.git ]; then | |
| +rm -rf include src | |
| + | |
| +if [ -d ${REPO}/.git ]; then | |
| echo "Updating existing checkout..." | |
| - cd ${SRCDIR} && git pull | |
| + cd ${REPO} && git fetch && git checkout ${BRANCH} -f && git clean -x -f -d && cd .. | |
| else | |
| echo "Downloading source from ${URL}" | |
| - git clone ${URL} ${SRCDIR} | |
| + git clone ${URL} ${REPO} -b ${BRANCH} | |
| fi | |
| + | |
| +#Create directories | |
| +mkdir include include/webvtt src | |
| + | |
| +#Copy C headers | |
| +find ${REPO}/include/webvtt -type f -name '[^w]*.h' -exec cp '{}' ${SRCDIR}/include/webvtt/ \; | |
| +#Copy C sources | |
| +find ${REPO}/src/libwebvtt -type f -name '*.[ch]' -exec cp '{}' ${SRCDIR}/src/ \; | |
| + | |
| +rm -rf ${REPO} | |
| + | |
| +patch -p 0 -r . < no-config.patch | |
| +patch -p 0 -r . < patch2.patch |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment