Remove obsolete capture pause events

This commit is contained in:
Mark.lin
2026-07-29 15:52:51 +08:00
parent d9f194c1ab
commit 9124930e98
8 changed files with 12 additions and 55 deletions
+1 -3
View File
@@ -168,9 +168,7 @@ extern "C"
{
GVFG_EVENT_UNKNOWN = 0,
GVFG_EVENT_SIGNAL_CONNECTED = 1,
GVFG_EVENT_SIGNAL_DISCONNECTED = 2,
GVFG_EVENT_CAPTURE_PAUSED = 3,
GVFG_EVENT_CAPTURE_RESUMED = 4
GVFG_EVENT_SIGNAL_DISCONNECTED = 2
} gvfg_event_type_t;
typedef struct
@@ -83,33 +83,21 @@ typedef struct pcies2mm_debug_state_t
typedef enum pcies2mm_event_type_t
{
PCIES2MM_EVENT_VIDEO_IRQ = 1,
PCIES2MM_EVENT_PLUG_IN = 2,
PCIES2MM_EVENT_PLUG_OUT = 3,
PCIES2MM_EVENT_CAPTURE_PAUSED = 4,
PCIES2MM_EVENT_CAPTURE_RESUMED = 5
PCIES2MM_EVENT_PLUG_IN = 1,
PCIES2MM_EVENT_PLUG_OUT = 2
} pcies2mm_event_type_t;
enum
{
PCIES2MM_EVENT_MASK_VIDEO_IRQ = 1u << 0,
PCIES2MM_EVENT_MASK_PLUG_IN = 1u << 1,
PCIES2MM_EVENT_MASK_PLUG_OUT = 1u << 2,
PCIES2MM_EVENT_MASK_CAPTURE_PAUSED = 1u << 3,
PCIES2MM_EVENT_MASK_CAPTURE_RESUMED = 1u << 4,
PCIES2MM_EVENT_MASK_HOTPLUG = PCIES2MM_EVENT_MASK_PLUG_IN |
PCIES2MM_EVENT_MASK_PLUG_OUT |
PCIES2MM_EVENT_MASK_CAPTURE_PAUSED |
PCIES2MM_EVENT_MASK_CAPTURE_RESUMED,
PCIES2MM_EVENT_MASK_DEFAULT = PCIES2MM_EVENT_MASK_HOTPLUG,
PCIES2MM_EVENT_MASK_ALL = PCIES2MM_EVENT_MASK_VIDEO_IRQ | PCIES2MM_EVENT_MASK_HOTPLUG
PCIES2MM_EVENT_MASK_PLUG_IN = 1u << 0,
PCIES2MM_EVENT_MASK_PLUG_OUT = 1u << 1,
PCIES2MM_EVENT_MASK_DEFAULT = PCIES2MM_EVENT_MASK_PLUG_IN |
PCIES2MM_EVENT_MASK_PLUG_OUT
};
typedef struct pcies2mm_event_t
{
pcies2mm_event_type_t type;
uint32_t irq_bit;
uint32_t irq_mask;
uint64_t timestamp_ns;
} pcies2mm_event_t;
@@ -105,16 +105,10 @@ namespace
{
switch (type)
{
case PCIES2MM_EVENT_VIDEO_IRQ:
return PCIES2MM_EVENT_MASK_VIDEO_IRQ;
case PCIES2MM_EVENT_PLUG_IN:
return PCIES2MM_EVENT_MASK_PLUG_IN;
case PCIES2MM_EVENT_PLUG_OUT:
return PCIES2MM_EVENT_MASK_PLUG_OUT;
case PCIES2MM_EVENT_CAPTURE_PAUSED:
return PCIES2MM_EVENT_MASK_CAPTURE_PAUSED;
case PCIES2MM_EVENT_CAPTURE_RESUMED:
return PCIES2MM_EVENT_MASK_CAPTURE_RESUMED;
default:
return 0;
}
@@ -795,8 +789,6 @@ namespace gvfg::internal
return;
}
emit_event(PCIES2MM_EVENT_VIDEO_IRQ, channel == 0 ? 0 : 4, video_irq_mask_bit());
const DWORD bytes = static_cast<DWORD>(frame_size_bytes());
size_t slotIndex = frame_ring_.size();
uint8_t *slotData = nullptr;
@@ -869,8 +861,7 @@ namespace gvfg::internal
{
signal_present_.store(true, std::memory_order_release);
signal_presence_known_.store(true, std::memory_order_release);
emit_event(PCIES2MM_EVENT_PLUG_IN, channel == 0 ? 0 : 4, video_irq_mask_bit());
emit_event(PCIES2MM_EVENT_CAPTURE_RESUMED, channel == 0 ? 0 : 4, video_irq_mask_bit());
emit_event(PCIES2MM_EVENT_PLUG_IN);
}
{
@@ -886,8 +877,6 @@ namespace gvfg::internal
write_reg(video_base() + VIDEO_DMA_EN_OFFSET, 0);
write_reg(video_base() + VIDEO_EN_OFFSET, 0);
capture_active_ = false;
emit_event(PCIES2MM_EVENT_CAPTURE_PAUSED, channel == 0 ? 0 : 4, video_irq_mask_bit());
resume_capture_from_signal(channel);
frame_cv_.notify_all();
@@ -908,7 +897,7 @@ namespace gvfg::internal
signal_probe_active_.store(false, std::memory_order_release);
signal_present_.store(true, std::memory_order_release);
signal_presence_known_.store(true, std::memory_order_release);
emit_event(PCIES2MM_EVENT_PLUG_IN, channel == 0 ? 0 : 4, video_irq_mask_bit());
emit_event(PCIES2MM_EVENT_PLUG_IN);
resume_capture_from_signal(channel);
frame_cv_.notify_all();
data_cv_.notify_all();
@@ -922,8 +911,7 @@ namespace gvfg::internal
write_reg(video_base() + VIDEO_DMA_EN_OFFSET, 0);
write_reg(video_base() + VIDEO_EN_OFFSET, 0);
capture_active_ = false;
emit_event(PCIES2MM_EVENT_PLUG_OUT, channel == 0 ? 0 : 4, video_irq_mask_bit());
emit_event(PCIES2MM_EVENT_CAPTURE_PAUSED, channel == 0 ? 0 : 4, video_irq_mask_bit());
emit_event(PCIES2MM_EVENT_PLUG_OUT);
{
std::lock_guard<std::mutex> lock(mutex_);
@@ -973,7 +961,6 @@ namespace gvfg::internal
stream_error_ = false;
stats_.state = PCIES2MM_STREAM_RUNNING;
}
emit_event(PCIES2MM_EVENT_CAPTURE_RESUMED, channel == 0 ? 0 : 4, video_irq_mask_bit());
frame_cv_.notify_all();
data_cv_.notify_all();
return true;
@@ -1055,7 +1042,7 @@ namespace gvfg::internal
data_cv_.notify_all();
}
void PcieS2mmCaptureSession::emit_event(pcies2mm_event_type_t type, uint32_t irqBit, uint32_t irqMask) const
void PcieS2mmCaptureSession::emit_event(pcies2mm_event_type_t type) const
{
pcies2mm_event_callback_t callback = nullptr;
void *user = nullptr;
@@ -1070,8 +1057,6 @@ namespace gvfg::internal
pcies2mm_event_t event{};
event.type = type;
event.irq_bit = irqBit;
event.irq_mask = irqMask;
event.timestamp_ns = steady_now_ns();
callback(&event, user);
}
@@ -64,7 +64,7 @@ namespace gvfg::internal
bool resume_capture_from_signal(uint32_t channel);
bool refresh_stream_from_registers(bool resizeRing);
void publish_frame(size_t slotIndex, size_t bytes);
void emit_event(pcies2mm_event_type_t type, uint32_t irqBit, uint32_t irqMask) const;
void emit_event(pcies2mm_event_type_t type) const;
pcies2mm_status_t fail(pcies2mm_status_t status, const char *where, DWORD winerr = GetLastError()) const;
void set_last_error(const std::string &message) const;
-4
View File
@@ -131,10 +131,6 @@ namespace
return GVFG_EVENT_SIGNAL_CONNECTED;
case PCIES2MM_EVENT_PLUG_OUT:
return GVFG_EVENT_SIGNAL_DISCONNECTED;
case PCIES2MM_EVENT_CAPTURE_PAUSED:
return GVFG_EVENT_CAPTURE_PAUSED;
case PCIES2MM_EVENT_CAPTURE_RESUMED:
return GVFG_EVENT_CAPTURE_RESUMED;
default:
return GVFG_EVENT_UNKNOWN;
}