Skip to content

Commit

Permalink
Add device type to --list_devices
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Gervais <[email protected]>
  • Loading branch information
g-maxime committed Jul 9, 2023
1 parent ae221eb commit e3b1e0f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions Source/Common/AvfCtlWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@ class AVFCtlWrapper : public BaseWrapper {
bool WaitForSessionEnd(uint64_t Timeout);

private:
static std::string Interface;
void* Ctl;
};
4 changes: 3 additions & 1 deletion Source/Common/AvfCtlWrapper.mm
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ - (void) captureOutput:(AVCaptureOutput *)captureOutput
}
@end

string AVFCtlWrapper::Interface = "DV";

AVFCtlWrapper::AVFCtlWrapper(size_t DeviceIndex)
{
Ctl = (void*)[[AVFCtl alloc] initWithDeviceIndex:DeviceIndex];
Expand Down Expand Up @@ -104,7 +106,7 @@ - (void) captureOutput:(AVCaptureOutput *)captureOutput
if (DeviceIndex < 0)
return string();

return string([[AVFCtl getDeviceName:DeviceIndex] UTF8String]);
return string([[AVFCtl getDeviceName:DeviceIndex] UTF8String]) + " [" + Interface + "]";
}

string AVFCtlWrapper::GetDeviceID(size_t DeviceIndex)
Expand Down
5 changes: 4 additions & 1 deletion Source/Common/DecklinkWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ HRESULT DecklinkWrapper::CaptureDelegate::VideoInputFormatChanged(BMDVideoInputF
return S_OK;
}

//---------------------------------------------------------------------------
string DecklinkWrapper::Interface = "DeckLink";

//---------------------------------------------------------------------------
void DecklinkWrapper::Init()
{
Expand Down Expand Up @@ -227,7 +230,7 @@ string DecklinkWrapper::GetDeviceName(size_t DeviceIndex)
if (DeviceIndex >= Devices.size())
return "";

return Devices[DeviceIndex].Name;
return Devices[DeviceIndex].Name + " [" + Interface + "]";
}

//---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Source/Common/DecklinkWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ class DecklinkWrapper : public BaseWrapper {
bool WaitForSessionEnd(uint64_t Timeout);

private:
static std::string Interface;
playback_mode PlaybackMode;

//DeckLink
Expand Down
4 changes: 3 additions & 1 deletion Source/Common/LinuxWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ static int ReceiveFrame(unsigned char* Data, int Lenght, int, void *UserData)
return 0;
}

//---------------------------------------------------------------------------
string LinuxWrapper::Interface = "DV";

//---------------------------------------------------------------------------
void LinuxWrapper::Init()
Expand Down Expand Up @@ -220,7 +222,7 @@ string LinuxWrapper::GetDeviceName(const string& DeviceID)
for (size_t Pos = 0; Pos < Devices.size(); Pos++)
{
if (Devices[Pos].UUID == ID)
return Devices[Pos].Vendor + " " + Devices[Pos].Model;
return Devices[Pos].Vendor + " " + Devices[Pos].Model + " [" + Interface + "]";
}

return "";
Expand Down
2 changes: 2 additions & 0 deletions Source/Common/LinuxWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class LinuxWrapper : public BaseWrapper {
bool WaitForSessionEnd(uint64_t Timeout);

private:
static std::string Interface;

// global
int Port = -1;
nodeid_t Node = (nodeid_t)-1;
Expand Down
5 changes: 4 additions & 1 deletion Source/Common/SimulatorWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,9 @@ static ZtringListList ReadFileNames()
return List;
}

//---------------------------------------------------------------------------
string SimulatorWrapper::Interface = "Simulator";

//---------------------------------------------------------------------------
SimulatorWrapper::SimulatorWrapper(std::size_t DeviceIndex)
{
Expand Down Expand Up @@ -188,7 +191,7 @@ std::string SimulatorWrapper::GetDeviceName(std::size_t DeviceIndex)
auto List = ReadFileNames();
if (DeviceIndex >= List.size() || List[DeviceIndex].empty())
return {};
return List[DeviceIndex][0].To_UTF8() + " (Simulator)";
return List[DeviceIndex][0].To_UTF8() + " [" + Interface + "]";
}

//---------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions Source/Common/SimulatorWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ class SimulatorWrapper : public BaseWrapper {
bool WaitForSessionEnd(uint64_t Timeout);

private:
static std::string Interface;
void* Ctl;
};

0 comments on commit e3b1e0f

Please sign in to comment.