Skip to content

Commit

Permalink
Add HandleStreamStopInfo helper
Browse files Browse the repository at this point in the history
  • Loading branch information
palana committed Sep 24, 2014
1 parent 8919fcb commit 3caa30c
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
10 changes: 10 additions & 0 deletions Source/OBS.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,16 @@ class OBS

//---------------------------------------------------

struct StopInfo
{
DWORD time = (DWORD)-1;
bool timeSeen = false;
std::function<void()> func;
};
bool HandleStreamStopInfo(StopInfo &, PacketType, const VideoSegment&);

//---------------------------------------------------

std::unique_ptr<NetworkStream> network;

//---------------------------------------------------
Expand Down
19 changes: 19 additions & 0 deletions Source/OBSVideoCapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,25 @@ void OBS::SendFrame(VideoSegment &curSegment, QWORD firstFrameTime)
}
}

bool OBS::HandleStreamStopInfo(OBS::StopInfo &info, PacketType type, const VideoSegment& segment)
{
if (type == PacketType_Audio || !info.func)
return false;

if (segment.pts < info.time)
return false;

if (!info.timeSeen)
{
info.timeSeen = true;
return false;
}

info.func();
info = {};
return true;
}

bool OBS::ProcessFrame(FrameProcessInfo &frameInfo)
{
List<DataPacket> videoPackets;
Expand Down

0 comments on commit 3caa30c

Please sign in to comment.