Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions .github/workflows/linux-gcc13.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ on:

jobs:
build_libebml:
name: libebml for Linux ${{ matrix.cxx }}
name: libebml for Linux ${{ matrix.cxx }} (${{ matrix.lib.name }})
runs-on: ubuntu-latest
strategy:
matrix:
cxx: ['g++-14', 'clang++-18']
lib: [
{ "name": "static", "option": "-DBUILD_SHARED_LIBS=OFF"},
{ "name": "shared", "option": "-DBUILD_SHARED_LIBS=ON"},
{ "name": "auto", "option": ""},
]
env:
CXX: ${{matrix.cxx}}
steps:
Expand All @@ -22,10 +27,17 @@ jobs:
uses: actions/checkout@v7

- name: Configure CMake
run: cmake -S . -B _build -DCMAKE_INSTALL_PREFIX:STRING=${GITHUB_WORKSPACE}/_built -G Ninja
run: cmake -S . -B _build ${{ matrix.lib.option }} -DCMAKE_INSTALL_PREFIX:STRING=${GITHUB_WORKSPACE}/_built -G Ninja

- name: Build with CMake
run: cmake --build _build --parallel

- name: Test installation
run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
run: |
cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
cmake -E remove_directory _build

- name: Check installed version links properly with CMake
run: |
cmake -S examples -B examples/_build ${{ matrix.lib.option }} -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/_built"
cmake --build examples/_build --parallel
18 changes: 15 additions & 3 deletions .github/workflows/linux-newer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,16 @@ on:

jobs:
build_libebml:
name: libebml for Newer Linux ${{ matrix.cxx }}
name: libebml for Newer Linux ${{ matrix.cxx }} (${{ matrix.lib.name }})
runs-on: ubuntu-26.04
strategy:
matrix:
cxx: ['g++-15', 'clang++-22']
lib: [
{ "name": "static", "option": "-DBUILD_SHARED_LIBS=OFF"},
{ "name": "shared", "option": "-DBUILD_SHARED_LIBS=ON"},
{ "name": "auto", "option": ""},
]
env:
CXX: ${{matrix.cxx}}
steps:
Expand All @@ -27,10 +32,17 @@ jobs:
uses: actions/checkout@v7

- name: Configure CMake
run: cmake -S . -B _build -DCMAKE_INSTALL_PREFIX:STRING=${GITHUB_WORKSPACE}/_built -G Ninja
run: cmake -S . -B _build ${{ matrix.lib.option }} -DCMAKE_INSTALL_PREFIX:STRING=${GITHUB_WORKSPACE}/_built -G Ninja

- name: Build with CMake
run: cmake --build _build --parallel

- name: Test installation
run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
run: |
cmake --install _build --prefix ${GITHUB_WORKSPACE}/_built
cmake -E remove_directory _build

- name: Check installed version links properly with CMake
run: |
cmake -S examples -B examples/_build ${{ matrix.lib.option }} -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/_built"
cmake --build examples/_build --parallel
5 changes: 5 additions & 0 deletions EBMLConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@

include(${CMAKE_CURRENT_LIST_DIR}/EBMLTargets.cmake)

include(CMakeFindDependencyMacro)
if(@utf8cpp_FOUND@)
find_dependency(utf8cpp REQUIRED)
endif()

check_required_components(EBML)
10 changes: 10 additions & 0 deletions examples/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cmake_minimum_required(VERSION 3.5)

project(linkebml VERSION 0.0.1)

find_package(EBML REQUIRED)

add_executable(testlink test00.cpp)
target_link_libraries(testlink PUBLIC EBML::ebml)


91 changes: 91 additions & 0 deletions examples/test00.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
// Copyright © 2002-2004 Steve Lhomme.
// SPDX-License-Identifier: LGPL-2.1-or-later

/*!
\file
\author Steve Lhomme <robux4 @ users.sf.net>
Test the writing a basic EBML file
*/

#include <ebml/StdIOCallback.h>
#include <ebml/EbmlHead.h>
#include <ebml/EbmlStream.h>
#include <ebml/EbmlSubHead.h>
#include <ebml/EbmlUnicodeString.h>
#include <ebml/EbmlVoid.h>
#include <ebml/EbmlContexts.h>
#include <ebml/EbmlVersion.h>

#include <cstdio>
#include <string>

using namespace libebml;

class UniStringWithoutDefault : public EbmlUnicodeString {
public: UniStringWithoutDefault(EBML_EXTRA_PARAM);
UniStringWithoutDefault(const UniStringWithoutDefault & ElementToClone) : EbmlUnicodeString(ElementToClone) {}
EBML_CONCRETE_CLASS(UniStringWithoutDefault)
};

DEFINE_xxx_CLASS(UniStringWithoutDefault, 0x4123, 2, EbmlHead, "UniStringWithoutDefault", GetEbmlGlobal_Context)

const char RW_FILENAME[] = "test.ebml";

int main(void)
{
printf("Test00 :\nEBML %s\n", EbmlCodeVersion.c_str());
StdIOCallback Ebml_file(RW_FILENAME, ::MODE_CREATE);

///// Writing test
EbmlHead TestHead;

printf("Write EBML + Matroska elements\n");
EDocType & MyDocType = GetChild<EDocType>(TestHead);
MyDocType.SetValue("matroska");

EDocTypeVersion & MyDocTypeVer = GetChild<EDocTypeVersion>(TestHead);
MyDocTypeVer.SetValue(1);

EDocTypeReadVersion & MyDocTypeReadVer = GetChild<EDocTypeReadVersion>(TestHead);
MyDocTypeReadVer.SetValue(1);

auto & MyString = GetChild<UniStringWithoutDefault>(TestHead);
MyDocType.SetValue("éé");

TestHead.Render(Ebml_file);

Ebml_file.close();

///// Reading test
StdIOCallback Ebml_Wfile(RW_FILENAME, ::MODE_READ);

// example 1 skip all the elements found
EbmlStream aStream(Ebml_Wfile);
EbmlElement * ElementLevel0;
EbmlElement * ElementLevel1;
EbmlElement * ElementLevel2;
EbmlElement * ElementLevel3;

// read the data until a possible element is found (valid ID + size combination)
printf("Read EBML elements & skip data\n");
// find the EBML head in the file
ElementLevel0 = aStream.FindNextID(EBML_INFO(EbmlHead), 0xFFFFFFFFL);
if (ElementLevel0 != NULL)
{
printf("ID : ");
for (unsigned int i=EbmlId(*ElementLevel0).GetLength(); i; i++)
{
printf("[%02X]", (EbmlId(*ElementLevel0).GetValue() >> ((i-1)*8)) & 0xFF);
}
printf("\n");

ElementLevel0->SkipData(aStream, EBML_CLASS_CONTEXT(EbmlHead));
if (ElementLevel0 != NULL)
delete ElementLevel0;
}


Ebml_Wfile.close();

return 0;
}