Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.x] test ABI breakage on 1.x branches #85

Open
wants to merge 18 commits into
base: v1.x
Choose a base branch
from
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
71 changes: 71 additions & 0 deletions .github/workflows/abibreak.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: "ABI Breakage"
on:
push:
branches: [ v1.x ]
pull_request:

jobs:
test_abidiff:
name: abidiff
runs-on: ubuntu-latest
steps:
- name: Checkout libebml 1.x
uses: actions/checkout@v3
with:
repository: Matroska-Org/libebml
path: libebml
ref: v1.x

- name: Configure libebml 1.x
run: cmake -S libebml -B libebml/_build -DBUILD_SHARED_LIBS=ON

- name: Build libebml 1.x
run: cmake --build libebml/_build --parallel

- name: Install libebml 1.x
run: cmake --install libebml/_build --prefix ${GITHUB_WORKSPACE}/_built


- name: Get libmatroska 1.x
uses: actions/checkout@v3
with:
path: libmatroska-1
ref: v1.x

- name: Configure v1.x
run: cmake -S libmatroska-1 -B _build_1 -DBUILD_SHARED_LIBS=ON -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML" -DCMAKE_BUILD_TYPE=RelWithDebInfo

- name: Build v1.x
run: cmake --build _build_1 --parallel

- name: Install v1.x
run: cmake --install _build_1 --prefix ${GITHUB_WORKSPACE}/dir-old


- name: Get libmatroska 1.x from Pull Request
uses: actions/checkout@v3
with:
path: libmatroska-new

- name: Configure CMake
run: cmake -S libmatroska-new -B _build -DBUILD_SHARED_LIBS=ON -DEBML_DIR="${GITHUB_WORKSPACE}/_built/lib/cmake/EBML" -DCMAKE_BUILD_TYPE=RelWithDebInfo

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

- name: Install
run: cmake --install _build --prefix ${GITHUB_WORKSPACE}/dir-new


- name: Get abidiff
run: |
sudo apt update
sudo apt install abigail-tools

- name: Check ABI differences
run: |
abidiff --no-added-syms \
--headers-dir1 ${GITHUB_WORKSPACE}/dir-new/include/matroska \
--headers-dir2 ${GITHUB_WORKSPACE}/dir-old/include/matroska \
${GITHUB_WORKSPACE}/dir-new/lib/libmatroska.so \
${GITHUB_WORKSPACE}/dir-old/lib/libmatroska.so
26 changes: 13 additions & 13 deletions matroska/KaxBlock.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ class MATROSKA_DLL_API DataBuffer {
binary *myBuffer{nullptr};
uint32 mySize;
bool bValidValue{true};
bool (*myFreeBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer
bool (*FreemyBuffer)(const DataBuffer & aBuffer); // method to free the internal buffer
bool bInternalBuffer;

public:
DataBuffer(binary * aBuffer, uint32 aSize, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = nullptr, bool _bInternalBuffer = false)
:mySize(aSize)
,myFreeBuffer(aFreeBuffer)
,FreemyBuffer(aFreeBuffer)
,bInternalBuffer(_bInternalBuffer)
{
if (bInternalBuffer)
Expand All @@ -87,8 +87,8 @@ class MATROSKA_DLL_API DataBuffer {
bool FreeBuffer(const DataBuffer & aBuffer) {
bool bResult = true;
if (myBuffer != nullptr && bValidValue) {
if (myFreeBuffer != nullptr)
bResult = myFreeBuffer(aBuffer);
if (FreemyBuffer != nullptr)
bResult = FreemyBuffer(aBuffer);
if (bInternalBuffer)
delete [] myBuffer;
myBuffer = nullptr;
Expand All @@ -103,7 +103,7 @@ class MATROSKA_DLL_API DataBuffer {

class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
public:
SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = myFreeBuffer)
SimpleDataBuffer(binary * aBuffer, uint32 aSize, uint32 aOffset, bool (*aFreeBuffer)(const DataBuffer & aBuffer) = FreemyBuffer, void *unused = nullptr)
:DataBuffer(aBuffer + aOffset, aSize, aFreeBuffer)
,Offset(aOffset)
,BaseBuffer(aBuffer)
Expand All @@ -116,7 +116,7 @@ class MATROSKA_DLL_API SimpleDataBuffer : public DataBuffer {
uint32 Offset;
binary * BaseBuffer;

static bool myFreeBuffer(const DataBuffer & aBuffer)
static inline bool FreemyBuffer(const DataBuffer & aBuffer)
{
auto _Buffer = static_cast<const SimpleDataBuffer*>(&aBuffer)->BaseBuffer;
if (_Buffer != nullptr)
Expand Down Expand Up @@ -197,11 +197,11 @@ DECLARE_MKX_MASTER(KaxBlockGroup)

operator KaxInternalBlock &();

const KaxCluster *GetParentCluster() const { return ParentCluster; }
const KaxCluster *GetParentCluster2() const { return ParentCluster; }

protected:
KaxCluster * ParentCluster{nullptr};
const KaxTrackEntry * ParentTrack{nullptr};
KaxCluster * ParentCluster;
const KaxTrackEntry * ParentTrack;
};

class MATROSKA_DLL_API KaxInternalBlock : public EbmlBinary {
Expand Down Expand Up @@ -345,12 +345,12 @@ class MATROSKA_DLL_API KaxBlockBlob {

bool ReplaceSimpleByGroup();
protected:
KaxCluster *ParentCluster{nullptr};
KaxCluster *ParentCluster;
union {
KaxBlockGroup *group;
KaxSimpleBlock *simpleblock;
} Block;
bool bUseSimpleBlock;
bool bUseSimpleBlock{false};
BlockBlobType SimpleBlockMode;
};

Expand All @@ -370,8 +370,8 @@ DECLARE_MKX_BINARY_CONS(KaxBlockVirtual)
filepos_t ReadData(IOCallback & input, ScopeMode ReadFully = SCOPE_ALL_DATA) override;

protected:
uint64 Timecode; // temporary timecode of the first frame if there are more than one
uint16 TrackNumber;
uint64 Timecode{0}; // temporary timecode of the first frame if there are more than one
uint16 TrackNumber{0};
binary DataBlock[5];

const KaxCluster * ParentCluster{nullptr};
Expand Down
3 changes: 2 additions & 1 deletion src/KaxBlock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ DataBuffer * DataBuffer::Clone()
}

SimpleDataBuffer::SimpleDataBuffer(const SimpleDataBuffer & ToClone)
:DataBuffer(static_cast<binary *>(malloc(ToClone.mySize * sizeof(binary))), ToClone.mySize, myFreeBuffer)
:DataBuffer(static_cast<binary *>(malloc(ToClone.mySize * sizeof(binary))), ToClone.mySize, FreemyBuffer)
{
assert(myBuffer != nullptr);
memcpy(myBuffer, ToClone.myBuffer ,mySize );
Expand Down Expand Up @@ -101,6 +101,7 @@ KaxInternalBlock::KaxInternalBlock(const KaxInternalBlock & ElementToClone)

KaxBlockGroup::KaxBlockGroup(EBML_EXTRA_DEF)
:EbmlMaster(EBML_CLASS_SEMCONTEXT(KaxBlockGroup) EBML_DEF_SEP EBML_EXTRA_CALL)
,ParentCluster(nullptr), ParentTrack(nullptr)
{}

/*!
Expand Down
4 changes: 2 additions & 2 deletions src/KaxCuesData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ void KaxCuePoint::PositionSet(const KaxBlockGroup & BlockReference, uint64 Globa
auto CodecState = static_cast<KaxCodecState *>(BlockReference.FindFirstElt(EBML_INFO(KaxCodecState)));
if (CodecState != nullptr) {
auto &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
*static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
*static_cast<EbmlUInteger*>(&CueCodecState) = BlockReference.GetParentCluster2()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
}

SetValueIsSet();
Expand Down Expand Up @@ -123,7 +123,7 @@ void KaxCuePoint::PositionSet(const KaxInternalBlock & BlockReference, const Kax
const auto CodecState = static_cast<const KaxCodecState *>(BlockGroup->FindFirstElt(EBML_INFO(KaxCodecState)));
if (CodecState != nullptr) {
auto &CueCodecState = AddNewChild<KaxCueCodecState>(NewPositions);
*static_cast<EbmlUInteger*>(&CueCodecState) = BlockGroup->GetParentCluster()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
*static_cast<EbmlUInteger*>(&CueCodecState) = BlockGroup->GetParentCluster2()->GetParentSegment()->GetRelativePosition(CodecState->GetElementPosition());
}
}

Expand Down
Loading