Skip to content

alexa/webvtt

 
 

Build Status

libwebvtt

A C/C++ library for interpreting and authoring conformant WebVTT content. WebVTT is a caption and subtitle format designed for use with HTML5 audio and video elements. This project is a fork of caitp/webvtt.

Build Instructions:

CMake is used for running the builds and tests. When using CMake, it's recommended that builds take place outside of the main project source, such as in a build directory.

Building and Running the parsevtt Sample Program

# assuming the current working directory is the project directory
cd build

# configure the project with CMake
cmake ..

# compile the test executable
make

# Run the sample executable with a WebVTT file as input,
# using the -f argument to point to the file location.
src/parsevtt/parsevtt -f ../test/webvtt_example.vtt

Once built, the static library and include files are available at these locations:

For C

  • Static library: build/src/webvtt/libwebvtt.a
  • Include: include/webvtt

For C++

  • Static library: build/src/webvttxx/libwebvttxx.a
  • Include: include/webvttxx

Building a .dll in Windows (MinGW)

CMake is also used on Windows for running the builds and tests, but it's recommended to use MSYS2 to create the Mingw64 build environment.

When using CMake, it's recommended that builds take place outside of the main project source, such as in a build directory.

  1. Download, install, and update MSYS2 using the steps on the MSYS2 homepage
  2. Open the MSYS2 terminal, choosing "Mingw-w64 64 bit" when prompted
  3. Change directories to the working folder where you want to build libwebvtt. Keep in mind that the C:\ for Windows is mounted under /c/ in MinGW. For example, if the build location is "C:\Users\username\sources", then do cd /c/users/username/sources/
# clone the project
git clone https://github.com/alexa/webvtt.git

# change directories to the project root
cd webvtt

# create and enter the build directory
mkdir build && cd build

# configure the project with CMake, using the MSYS generator
cmake -G 'MSYS Makefiles' -DBUILD_LIBRARY=1 ..

# compile the DLL
make libwebvtt

Building in Microsoft Visual Studio 10 with UWP

  1. Download or clone this repository.
  2. Ensure that Visual Studio Installer has installed the following Workloads:
  • Desktop development with C++
  • Universal Windows Platform development
  1. Open Microsoft Visual Studio, and File -> Open -> CMake...
  2. Navigate to this project's CMakeLists.txt in the root project directory. This will import the Webvtt project. This project's Visual Studio settings are in CMakeSettings.json. It's configured already to build libwebvtt.dll.
  3. Select Build -> Build All. This will produce a .lib and a .dll file in out/build/x64-Debug/src/webvtt, and some .lib files in the other src/ directories.

Running Tests:

All tests are written using Google Test.

# assuming the current working directory is the project directory
cd build

# configure the project with CMake
cmake ..

# compile the test executable
make all test

# run the test executable
test/unit/unittests

Versioning

We use SemVer for versioning. For the versions available, see the tags on this repository.

License

This project is licensed under the 2-Clause BSD License - see the LICENSE file for details.

Acknowledgments

This project was originally the work of these individuals: Ralph Giles, Caitlin Potter, Rick Eyre, Edwin Lim, Dale Karp, Michael Afidchao, Shayan Ahmad, Jordan Raffoul, David Humphrey, Vince Lee, Mandeep Garg, Anh Tran, Thevakaran Virutthasalam, Mike Shutov, Michael Stiver-Balla, Kyle Barnhart, and David Perit. Many thanks to these people for their efforts!

About

WebVTT parsing library

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 81.5%
  • Python 11.3%
  • C 4.8%
  • CMake 1.0%
  • Shell 0.8%
  • Starlark 0.5%
  • Other 0.1%