From 5f1065e4e2d7d392d8cd8d217f1a15b223720504 Mon Sep 17 00:00:00 2001 From: Tom Finegan Date: Thu, 17 Mar 2016 15:09:46 -0700 Subject: [PATCH] webvtt: Organize and clean up webvtt support. Move webvtt support code into webvtt sub dir, and update build/includes as necessary. Change-Id: I1c0891afd413e92d43ba54b61cc8dc694c0bff36 --- CMakeLists.txt | 20 ++++++------ Makefile.unix | 38 +++++++++++------------ dumpvtt.cc | 4 +-- sample_muxer_metadata.cc | 2 +- sample_muxer_metadata.h | 3 +- vttdemux.cc | 4 +-- vttreader.cc => webvtt/vttreader.cc | 0 vttreader.h => webvtt/vttreader.h | 6 ++-- webvttparser.cc => webvtt/webvttparser.cc | 0 webvttparser.h => webvtt/webvttparser.h | 6 ++-- 10 files changed, 41 insertions(+), 42 deletions(-) rename vttreader.cc => webvtt/vttreader.cc (100%) rename vttreader.h => webvtt/vttreader.h (93%) rename webvttparser.cc => webvtt/webvttparser.cc (100%) rename webvttparser.h => webvtt/webvttparser.h (98%) diff --git a/CMakeLists.txt b/CMakeLists.txt index ebb0e6f..f271475 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,26 +84,26 @@ add_executable(sample_muxer "${LIBWEBM_SRC_DIR}/sample_muxer.cpp" "${LIBWEBM_SRC_DIR}/sample_muxer_metadata.cc" "${LIBWEBM_SRC_DIR}/sample_muxer_metadata.h" - "${LIBWEBM_SRC_DIR}/vttreader.cc" - "${LIBWEBM_SRC_DIR}/vttreader.h" - "${LIBWEBM_SRC_DIR}/webvttparser.cc" - "${LIBWEBM_SRC_DIR}/webvttparser.h") + "${LIBWEBM_SRC_DIR}/webvtt/vttreader.cc" + "${LIBWEBM_SRC_DIR}/webvtt/vttreader.h" + "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.cc" + "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.h") target_link_libraries(sample_muxer LINK_PUBLIC webm) # Dumpvtt section. add_executable(dumpvtt "${LIBWEBM_SRC_DIR}/dumpvtt.cc" - "${LIBWEBM_SRC_DIR}/vttreader.cc" - "${LIBWEBM_SRC_DIR}/vttreader.h" - "${LIBWEBM_SRC_DIR}/webvttparser.cc" - "${LIBWEBM_SRC_DIR}/webvttparser.h") + "${LIBWEBM_SRC_DIR}/webvtt/vttreader.cc" + "${LIBWEBM_SRC_DIR}/webvtt/vttreader.h" + "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.cc" + "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.h") target_link_libraries(dumpvtt LINK_PUBLIC webm) # Vttdemux section. add_executable(vttdemux "${LIBWEBM_SRC_DIR}/vttdemux.cc" - "${LIBWEBM_SRC_DIR}/webvttparser.cc" - "${LIBWEBM_SRC_DIR}/webvttparser.h") + "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.cc" + "${LIBWEBM_SRC_DIR}/webvtt/webvttparser.h") target_link_libraries(vttdemux LINK_PUBLIC webm) if (ENABLE_WEBMTS) diff --git a/Makefile.unix b/Makefile.unix index 171405d..50f0661 100644 --- a/Makefile.unix +++ b/Makefile.unix @@ -1,22 +1,22 @@ -CXX := g++ -PREDEFINES := -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -INCLUDES := -I. -CXXFLAGS := -W -Wall -g -MMD -MP $(PREDEFINES) $(INCLUDES) -LIBWEBMA := libwebm.a -LIBWEBMSO := libwebm.so -WEBMOBJS := mkvmuxer.o mkvmuxerutil.o mkvwriter.o -WEBMOBJS += mkvparser/mkvparser.o mkvparser/mkvreader.o -WEBMOBJS += common/file_util.o common/hdr_util.o -OBJSA := $(WEBMOBJS:.o=_a.o) -OBJSSO := $(WEBMOBJS:.o=_so.o) -VTTOBJS := vttreader.o webvttparser.o sample_muxer_metadata.o -EXEOBJS := sample.o sample_muxer.o dumpvtt.o vttdemux.o -DEPS := $(WEBMOBJS:.o=.d) $(OBJECTS1:.o=.d) $(OBJECTS2:.o=.d) -DEPS += $(OBJECTS3:.o=.d) $(OBJECTS4:.o=.d) $(OBJSA:.o=.d) $(OBJSSO:.o=.d) -DEPS += $(VTTOBJS:.o=.d) $(EXEOBJS:.o=.d) -EXES := sample_muxer sample dumpvtt vttdemux -CLEAN := $(EXEOBJS) $(VTTOBJS) $(WEBMOBJS) $(OBJSA) $(OBJSSO) $(LIBWEBMA) -CLEAN += $(LIBWEBMSO) $(EXES) $(DEPS) +CXX := g++ +DEFINES := -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS +INCLUDES := -I. +CXXFLAGS := -W -Wall -g -MMD -MP $(DEFINES) $(INCLUDES) +LIBWEBMA := libwebm.a +LIBWEBMSO := libwebm.so +WEBMOBJS := mkvmuxer.o mkvmuxerutil.o mkvwriter.o +WEBMOBJS += mkvparser/mkvparser.o mkvparser/mkvreader.o +WEBMOBJS += common/file_util.o common/hdr_util.o +OBJSA := $(WEBMOBJS:.o=_a.o) +OBJSSO := $(WEBMOBJS:.o=_so.o) +VTTOBJS := webvtt/vttreader.o webvtt/webvttparser.o sample_muxer_metadata.o +EXEOBJS := sample.o sample_muxer.o dumpvtt.o vttdemux.o +DEPS := $(WEBMOBJS:.o=.d) $(OBJECTS1:.o=.d) $(OBJECTS2:.o=.d) +DEPS += $(OBJECTS3:.o=.d) $(OBJECTS4:.o=.d) $(OBJSA:.o=.d) $(OBJSSO:.o=.d) +DEPS += $(VTTOBJS:.o=.d) $(EXEOBJS:.o=.d) +EXES := sample_muxer sample dumpvtt vttdemux +CLEAN := $(EXEOBJS) $(VTTOBJS) $(WEBMOBJS) $(OBJSA) $(OBJSSO) $(LIBWEBMA) +CLEAN += $(LIBWEBMSO) $(EXES) $(DEPS) all: $(EXES) diff --git a/dumpvtt.cc b/dumpvtt.cc index e5cd4b5..472da52 100644 --- a/dumpvtt.cc +++ b/dumpvtt.cc @@ -8,8 +8,8 @@ #include #include -#include "./vttreader.h" -#include "./webvttparser.h" +#include "webvtt/vttreader.h" +#include "webvtt/webvttparser.h" int main(int argc, const char* argv[]) { if (argc != 2) { diff --git a/sample_muxer_metadata.cc b/sample_muxer_metadata.cc index cc871d4..1d72413 100644 --- a/sample_muxer_metadata.cc +++ b/sample_muxer_metadata.cc @@ -15,7 +15,7 @@ #include #include "mkvmuxer.hpp" -#include "vttreader.h" +#include "webvtt/vttreader.h" namespace libwebm { diff --git a/sample_muxer_metadata.h b/sample_muxer_metadata.h index 3e20eec..0d08e0a 100644 --- a/sample_muxer_metadata.h +++ b/sample_muxer_metadata.h @@ -15,8 +15,7 @@ #include #include -#include "mkvmuxertypes.hpp" -#include "webvttparser.h" +#include "webvtt/webvttparser.h" namespace libwebm { diff --git a/vttdemux.cc b/vttdemux.cc index 8868523..96267d0 100644 --- a/vttdemux.cc +++ b/vttdemux.cc @@ -16,7 +16,7 @@ #include "mkvparser/mkvparser.hpp" #include "mkvparser/mkvreader.hpp" -#include "webvttparser.h" +#include "webvtt/webvttparser.h" #ifdef _MSC_VER // Disable MSVC warnings that suggest making code non-portable. @@ -1002,4 +1002,4 @@ int main(int argc, const char* argv[]) { CloseFiles(&metadata_map); return EXIT_SUCCESS; -} \ No newline at end of file +} diff --git a/vttreader.cc b/webvtt/vttreader.cc similarity index 100% rename from vttreader.cc rename to webvtt/vttreader.cc diff --git a/vttreader.h b/webvtt/vttreader.h similarity index 93% rename from vttreader.h rename to webvtt/vttreader.h index 6d6c7e6..8c3853f 100644 --- a/vttreader.h +++ b/webvtt/vttreader.h @@ -6,8 +6,8 @@ // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. -#ifndef VTTREADER_H_ // NOLINT -#define VTTREADER_H_ +#ifndef WEBVTT_VTTREADER_H_ +#define WEBVTT_VTTREADER_H_ #include #include "./webvttparser.h" @@ -41,4 +41,4 @@ class VttReader : public libwebvtt::Reader { } // namespace libwebvtt -#endif // VTTREADER_H_ // NOLINT +#endif // WEBVTT_VTTREADER_H_ diff --git a/webvttparser.cc b/webvtt/webvttparser.cc similarity index 100% rename from webvttparser.cc rename to webvtt/webvttparser.cc diff --git a/webvttparser.h b/webvtt/webvttparser.h similarity index 98% rename from webvttparser.h rename to webvtt/webvttparser.h index cf599ce..c1f4c6b 100644 --- a/webvttparser.h +++ b/webvtt/webvttparser.h @@ -6,8 +6,8 @@ // in the file PATENTS. All contributing project authors may // be found in the AUTHORS file in the root of the source tree. -#ifndef WEBVTTPARSER_H_ // NOLINT -#define WEBVTTPARSER_H_ +#ifndef WEBVTT_WEBVTTPARSER_H_ +#define WEBVTT_WEBVTTPARSER_H_ #include #include @@ -155,4 +155,4 @@ class Parser : private LineReader { } // namespace libwebvtt -#endif // WEBVTTPARSER_H_ // NOLINT +#endif // WEBVTT_WEBVTTPARSER_H_