Skip to content

Commit

Permalink
Changes for v20
Browse files Browse the repository at this point in the history
  • Loading branch information
awawa-dev committed Mar 21, 2024
1 parent fc83579 commit d609dcc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,7 @@ include_directories(${CMAKE_SOURCE_DIR}/include)
# enable C++11; MSVC doesn't have c++11 feature switch
if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++17" COMPILER_SUPPORTS_CXX17)
CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11)
CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X)

Expand All @@ -470,7 +471,10 @@ if(NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-psabi")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-psabi")
endif()
if(COMPILER_SUPPORTS_CXX11)
if(COMPILER_SUPPORTS_CXX17 AND Qt_VERSION EQUAL 6)
message(STATUS "Enabling support for C++17 for QT6")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
elseif(COMPILER_SUPPORTS_CXX11)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
elseif(COMPILER_SUPPORTS_CXX0X)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
Expand Down
12 changes: 9 additions & 3 deletions sources/grabber/pipewire/PipewireHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,12 @@ void PipewireHandler::onProcessFrame()

void PipewireHandler::getImage(PipewireImage& retVal)
{
if (_framePaused)
{
_image.isError = hasError();
_image.data = nullptr;
}

retVal = _image;
}

Expand All @@ -699,7 +705,7 @@ void PipewireHandler::captureFrame()
uint8_t* mappedMemory = nullptr;
uint8_t* frameBuffer = nullptr;

if (_pwStream == nullptr)
if (_pwStream == nullptr || _framePaused)
return;

_hasFrame = false;
Expand All @@ -713,7 +719,7 @@ void PipewireHandler::captureFrame()

while ((dequeueFrame = pw_stream_dequeue_buffer(_pwStream)) != nullptr)
{
if (newFrame != nullptr)
if (newFrame != nullptr && pw_stream_get_state(_pwStream, NULL) == PW_STREAM_STATE_STREAMING)
pw_stream_queue_buffer(_pwStream, newFrame);
newFrame = dequeueFrame;
}
Expand Down Expand Up @@ -880,7 +886,7 @@ void PipewireHandler::captureFrame()
if (mappedMemory != nullptr)
munmap(mappedMemory, newFrame->buffer->datas->maxsize + newFrame->buffer->datas->mapoffset);

if (newFrame != nullptr)
if (newFrame != nullptr && pw_stream_get_state(_pwStream, NULL) == PW_STREAM_STATE_STREAMING)
pw_stream_queue_buffer(_pwStream, newFrame);

// goodbye
Expand Down
4 changes: 3 additions & 1 deletion sources/grabber/pipewire/smartPipewire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ const char* getPipewireToken()

const char* getPipewireError()
{
static QByteArray errorData;
QString err = pipewireHandler.getError();
return err.toLatin1().constData();
errorData = err.toLatin1();
return errorData.constData();
}

void uninitPipewireDisplay()
Expand Down
2 changes: 1 addition & 1 deletion version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.0.0.0beta2
20.0.0.0

0 comments on commit d609dcc

Please sign in to comment.