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
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ function(get_bento4_version)
endfunction()

get_bento4_version()
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "")

option(USE_DEFAULT_OSX_ARCHITECTURES "Build bento4 by default for arm64, x86_64 OSX architectures" ON)

if(USE_DEFAULT_OSX_ARCHITECTURES)
set(CMAKE_OSX_ARCHITECTURES "arm64;x86_64" CACHE STRING "")
endif()

project(bento4 VERSION "${BENTO4_VERSION}")

# Variables
Expand Down
2 changes: 1 addition & 1 deletion Source/C++/Codecs/Ap4Ac3Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class AP4_Ac3Parser {
AP4_Size GetBytesFree();
AP4_Size GetBytesAvailable();

private:
protected:
// methods
AP4_Result FindHeader(AP4_UI08* header);

Expand Down
2 changes: 1 addition & 1 deletion Source/C++/Codecs/Ap4Ac4Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class AP4_Ac4Parser {
AP4_Size GetBytesFree();
AP4_Size GetBytesAvailable();

private:
protected:
// methods
AP4_Result FindHeader(AP4_UI08* header);
AP4_UI32 GetSyncFrameSize(AP4_BitReader &bits);
Expand Down
2 changes: 1 addition & 1 deletion Source/C++/Codecs/Ap4AdtsParser.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class AP4_AdtsParser {
AP4_Size GetBytesFree();
AP4_Size GetBytesAvailable();

private:
protected:
// methods
AP4_Result FindHeader(AP4_UI08* header);

Expand Down
2 changes: 1 addition & 1 deletion Source/C++/Codecs/Ap4Eac3Parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ class AP4_Eac3Parser {
AP4_Size GetBytesFree();
AP4_Size GetBytesAvailable();

private:
protected:
// methods
AP4_Result FindHeader(AP4_UI08* header, AP4_Size& skip_size);

Expand Down
25 changes: 21 additions & 4 deletions Source/C++/Core/Ap4FragmentSampleTable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -291,19 +291,36 @@ AP4_FragmentSampleTable::GetSampleChunkPosition(AP4_Ordinal sample_index,
| AP4_FragmentSampleTable::GetSampleIndexForTimeStamp
+---------------------------------------------------------------------*/
AP4_Result
AP4_FragmentSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 /*ts*/,
AP4_FragmentSampleTable::GetSampleIndexForTimeStamp(AP4_UI64 ts,
AP4_Ordinal& sample_index)
{
sample_index = 0; // TODO
if (!m_Samples.ItemCount())
return AP4_ERROR_NOT_ENOUGH_DATA;

sample_index = 0;
while (sample_index < m_Samples.ItemCount() && m_Samples[sample_index].GetCts() + m_Samples[sample_index].GetDuration() < ts)
++sample_index;

if (sample_index == m_Samples.ItemCount())
return AP4_ERROR_NOT_ENOUGH_DATA;

return AP4_SUCCESS;
}

/*----------------------------------------------------------------------
| AP4_FragmentSampleTable::GetNearestSyncSampleIndex
+---------------------------------------------------------------------*/
AP4_Ordinal
AP4_FragmentSampleTable::GetNearestSyncSampleIndex(AP4_Ordinal /*sample_index*/, bool /*before*/)
AP4_FragmentSampleTable::GetNearestSyncSampleIndex(AP4_Ordinal sample_index, bool before)
{
return 0; // TODO
if (sample_index >= m_Samples.ItemCount())
return sample_index;

AP4_Ordinal end(before ? 0 : m_Samples.ItemCount());

while (sample_index != end && !m_Samples[sample_index].IsSync())
sample_index = sample_index + (before ? -1 : 1);

return sample_index;
}