Skip to content

Adding compilation with mingw, and a test suite, for mingw #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
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
27 changes: 27 additions & 0 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: C/C++ CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: windows-latest


steps:
- uses: actions/checkout@v3
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: mingw-w64-x86_64-gcc mingw-w64-x86_64-make make mingw-w64-x86_64-libjpeg-turbo
update: true
- name: create build dir
shell: msys2 {0}
run: mkdir -p build/gcc
- name: make
shell: msys2 {0}
run: cd src/apps/win/ && make
8 changes: 6 additions & 2 deletions src/apps/win/AccessRightsDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ static void AddUserToListView( HWND hwndListView, const string& userName, UserGr
lvI.iItem = ListView_GetItemCount( hwndListView );

ListView_InsertItem( hwndListView, &lvI );
wchar_t adminText[] = L"Admin";
wchar_t userText[] = L"User";
lvI.pszText = (userGroup == UserGroup::Admin) ? adminText : userText;

lvI.pszText = ( userGroup == UserGroup::Admin ) ? L"Admin" : L"User";
lvI.mask = LVIF_TEXT;
lvI.iSubItem = 1;

Expand Down Expand Up @@ -171,7 +173,9 @@ static void UpdateUserInListView( HWND hwndListView, const string& userName, Use
lvI.mask = LVIF_TEXT;
lvI.iItem = i;
lvI.iSubItem = 1;
lvI.pszText = ( userGroup == UserGroup::Admin ) ? L"Admin" : L"User";
wchar_t adminText[] = L"Admin";
wchar_t userText[] = L"User";
lvI.pszText = (userGroup == UserGroup::Admin) ? adminText : userText;

ListView_SetItem( hwndListView, &lvI );

Expand Down
1 change: 1 addition & 0 deletions src/apps/win/EditUserDialog.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <string>
#include <vector>
#include <algorithm>

typedef struct
{
Expand Down
Binary file modified src/apps/win/cam2web.rc
Binary file not shown.
71 changes: 71 additions & 0 deletions src/apps/win/makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Compiler settings
CXX = g++
CXXFLAGS = -Wall -g -DUNICODE -D_UNICODE -D_DEBUG -mssse3 -std=c++0x -fpermissive
INCLUDES = -I../../core/ -I../../core/cameras/DirectShow/ -I../../../externals/mongoose/

# Application name
APP = cam2web

# Source files
CPP_SOURCES = $(wildcard *.cpp) $(wildcard ../../core/*.cpp) $(wildcard ../../core/cameras/DirectShow/*.cpp)
C_SOURCES = $(wildcard ../../../externals/mongoose/*.c)

# Object files
CPP_OBJECTS = $(CPP_SOURCES:.cpp=.o)
C_OBJECTS = $(C_SOURCES:.c=.o)

# Libraries to link against
LIBS = -lcomctl32 -lgdi32 -ljpeg -pthread -lIphlpapi -lole32 -lOleAut32 -lstrmiids -luuid -lrpcrt4 -lws2_32 -municode -Wl,-subsystem,windows

# Output folder
OUT_FOLDER = ../../../build/gcc/

# Resource file
RES_FILE = cam2web.rc
RES_OBJECT = cam2web.res
# Default target
all: $(APP)

# Rule to compile the resource file
$(RES_OBJECT): $(RES_FILE)
windres $(RES_FILE) -O coff -o $(RES_OBJECT)

# Linking the application
$(APP): $(CPP_OBJECTS) $(C_OBJECTS) $(RES_OBJECT)
$(CXX) $(CXXFLAGS) $(INCLUDES) -o $(OUT_FOLDER)$(APP) $(CPP_OBJECTS) $(C_OBJECTS) $(LIBS) $(RES_OBJECT)

# Compiling C++ source files into object files
%.o: %.cpp
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@

# Compiling C source files into object files
%.o: %.c
$(CXX) $(CXXFLAGS) $(INCLUDES) -c $< -o $@

copyweb:
mkdir -p $(OUT_WEB)
cp ../../web/* $(OUT_WEB)
cp ../../../externals/jquery/*.js $(OUT_WEB)
cp ../../../externals/jquery/*.css $(OUT_WEB)
cp -r $(OUT_WEB) .

generateweb:
mkdir -p $(OUT_INC)
cp ../../web/* $(OUT_INC)
cp ../../../externals/jquery/*.js $(OUT_INC)
cp ../../../externals/jquery/*.css $(OUT_INC)
$(WEB2H) -i $(OUT_INC)index.html -o $(OUT_INC)index.html.h
$(WEB2H) -i $(OUT_INC)styles.css -o $(OUT_INC)styles.css.h
$(WEB2H) -i $(OUT_INC)cam2web.png -o $(OUT_INC)cam2web.png.h
$(WEB2H) -i $(OUT_INC)cam2web_white.png -o $(OUT_INC)cam2web_white.png.h
$(WEB2H) -i $(OUT_INC)cameraproperties.html -o $(OUT_INC)cameraproperties.html.h
$(WEB2H) -i $(OUT_INC)camera.js -o $(OUT_INC)camera.js.h
$(WEB2H) -i $(OUT_INC)cameraproperties.js -o $(OUT_INC)cameraproperties.js.h
$(WEB2H) -i $(OUT_INC)jquery.js -o $(OUT_INC)jquery.js.h
$(WEB2H) -i $(OUT_INC)jquery.mobile.js -o $(OUT_INC)jquery.mobile.js.h
$(WEB2H) -i $(OUT_INC)jquery.mobile.css -o $(OUT_INC)jquery.mobile.css.h
rm $(OUT_INC)*.html
rm $(OUT_INC)*.css
rm $(OUT_INC)*.js
# Phony targets
.PHONY: all clean
29 changes: 14 additions & 15 deletions src/core/cameras/DirectShow/XLocalVideoDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#include <Dvdmedia.h>
// Include qedit.h to get ISampleGrabberCB declaration
#include <qedit.h>

#include "XLocalVideoDevice.hpp"
#include "XManualResetEvent.hpp"

Expand Down Expand Up @@ -141,14 +140,14 @@ namespace Private

XError SetVideoProperty( XVideoProperty property, int32_t value, bool automatic );
XError GetVideoProperty( XVideoProperty property, int32_t* value, bool* automatic ) const;
XError GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const;
XError GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const;

// Camera's control configuration
bool IsCameraConfigSupported( ) const;

XError SetCameraProperty( XCameraProperty property, int32_t value, bool automatic );
XError GetCameraProperty( XCameraProperty property, int32_t* value, bool* automatic ) const;
XError GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const;
XError GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const;

private:
// Run video loop in a background thread
Expand Down Expand Up @@ -619,9 +618,9 @@ XError XLocalVideoDevice::GetVideoProperty( XVideoProperty property, int32_t* va
}

// Get range of values supported by the specified video property
XError XLocalVideoDevice::GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const
XError XLocalVideoDevice::GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const
{
return mData->GetVideoPropertyRange( property, min, max, step, default, isAutomaticSupported );
return mData->GetVideoPropertyRange( property, min, max, step, defaultValue, isAutomaticSupported );
}

// Check if camera configuration is supported
Expand All @@ -643,9 +642,9 @@ XError XLocalVideoDevice::GetCameraProperty( XCameraProperty property, int32_t*
}

// Get range of values supported by the specified camera property
XError XLocalVideoDevice::GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const
XError XLocalVideoDevice::GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const
{
return mData->GetCameraPropertyRange( property, min, max, step, default, isAutomaticSupported );
return mData->GetCameraPropertyRange( property, min, max, step, defaultValue, isAutomaticSupported );
}

namespace Private
Expand Down Expand Up @@ -936,7 +935,7 @@ void XLocalVideoDeviceData::RunVideo( bool run )
// configure all video properties, which were set before device got running
for ( auto property : VideoPropertiesToSet )
{
configOK &= SetVideoProperty( property.first, property.second.first, property.second.second );
configOK &= static_cast<bool>(SetVideoProperty(property.first, property.second.first, property.second.second));
}
VideoPropertiesToSet.clear( );

Expand All @@ -955,7 +954,7 @@ void XLocalVideoDeviceData::RunVideo( bool run )
// configure all camera properties, which were set before device got running
for ( auto property : CameraPropertiesToSet )
{
configOK &= SetCameraProperty( property.first, property.second.first, property.second.second );
configOK &= static_cast<bool>(SetCameraProperty( property.first, property.second.first, property.second.second ));
}
CameraPropertiesToSet.clear( );

Expand Down Expand Up @@ -1185,12 +1184,12 @@ XError XLocalVideoDeviceData::GetVideoProperty( XVideoProperty property, int32_t
}

// Get range of values supported by the specified video property
XError XLocalVideoDeviceData::GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const
XError XLocalVideoDeviceData::GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const
{
lock_guard<recursive_mutex> lock( RunningSync );
XError ret = XError::Success;

if ( ( min == nullptr ) || ( max == nullptr ) || ( step == nullptr ) || ( default == nullptr ) || ( isAutomaticSupported == nullptr ) )
if ( ( min == nullptr ) || ( max == nullptr ) || ( step == nullptr ) || ( defaultValue == nullptr ) || ( isAutomaticSupported == nullptr ) )
{
ret = XError::NullPointer;
}
Expand Down Expand Up @@ -1220,7 +1219,7 @@ XError XLocalVideoDeviceData::GetVideoPropertyRange( XVideoProperty property, in
*min = propMin;
*max = propMax;
*step = propStep;
*default = propDef;
*defaultValue = propDef;

*isAutomaticSupported = ( propFlags & VideoProcAmp_Flags_Auto );
}
Expand Down Expand Up @@ -1333,12 +1332,12 @@ XError XLocalVideoDeviceData::GetCameraProperty( XCameraProperty property, int32
}

// Get range of values supported by the specified camera property
XError XLocalVideoDeviceData::GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const
XError XLocalVideoDeviceData::GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const
{
lock_guard<recursive_mutex> lock( RunningSync );
XError ret = XError::Success;

if ( ( min == nullptr ) || ( max == nullptr ) || ( step == nullptr ) || ( default == nullptr ) || ( isAutomaticSupported == nullptr ) )
if ( ( min == nullptr ) || ( max == nullptr ) || ( step == nullptr ) || ( defaultValue == nullptr ) || ( isAutomaticSupported == nullptr ) )
{
ret = XError::NullPointer;
}
Expand Down Expand Up @@ -1368,7 +1367,7 @@ XError XLocalVideoDeviceData::GetCameraPropertyRange( XCameraProperty property,
*min = propMin;
*max = propMax;
*step = propStep;
*default = propDef;
*defaultValue = propDef;

*isAutomaticSupported = ( propFlags & CameraControl_Flags_Auto );
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/cameras/DirectShow/XLocalVideoDevice.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ class XLocalVideoDevice : public IVideoSource, private Uncopyable
// Get current value if the specified video property. The device must be running.
XError GetVideoProperty( XVideoProperty property, int32_t* value, bool* automatic = nullptr ) const;
// Get range of values supported by the specified video property
XError GetVideoPropertyRange( XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const;
XError GetVideoPropertyRange(XVideoProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported) const;

// Check if camera configuration is supported (device must be running)
bool IsCameraConfigSupported( ) const;
Expand All @@ -140,7 +140,7 @@ class XLocalVideoDevice : public IVideoSource, private Uncopyable
// Get current value if the specified camera property. The device must be running.
XError GetCameraProperty( XCameraProperty property, int32_t* value, bool* automatic = nullptr ) const;
// Get range of values supported by the specified camera property
XError GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* default, bool* isAutomaticSupported ) const;
XError GetCameraPropertyRange( XCameraProperty property, int32_t* min, int32_t* max, int32_t* step, int32_t* defaultValue, bool* isAutomaticSupported ) const;

private:
Private::XLocalVideoDeviceData* mData;
Expand Down
14 changes: 7 additions & 7 deletions src/core/cameras/DirectShow/XLocalVideoDeviceConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,23 +208,23 @@ XError XLocalVideoDevicePropsInfo::GetProperty( const std::string& propertyName,
}
else
{
int32_t min = 0, max = 0, step = 0, default = 0;
int32_t min = 0, max = 0, step = 0, defaultValue = 0;
bool isAutoSupported;

// get property features - min/max/default/etc
// get property features - min/max/defaultValue/etc
if ( itSupportedProperty->second.PropertyKind == PROP_KIND_VIDEO )
{
ret = mCamera->GetVideoPropertyRange( static_cast<XVideoProperty>( itSupportedProperty->second.Property ), &min, &max, &step, &default, &isAutoSupported );
ret = mCamera->GetVideoPropertyRange( static_cast<XVideoProperty>( itSupportedProperty->second.Property ), &min, &max, &step, &defaultValue, &isAutoSupported );
}
else
{
if ( itSupportedProperty->second.ValueType == TYPE_INT )
{
ret = mCamera->GetCameraPropertyRange( static_cast< XCameraProperty >( itSupportedProperty->second.Property ), &min, &max, &step, &default, &isAutoSupported );
ret = mCamera->GetCameraPropertyRange( static_cast< XCameraProperty >( itSupportedProperty->second.Property ), &min, &max, &step, &defaultValue, &isAutoSupported );
}
else
{
default = true;
defaultValue = true;
}
}

Expand All @@ -233,12 +233,12 @@ XError XLocalVideoDevicePropsInfo::GetProperty( const std::string& propertyName,
if ( itSupportedProperty->second.ValueType == TYPE_INT )
{
sprintf( buffer, "{\"min\":%d,\"max\":%d,\"def\":%d,\"type\":\"int\",\"order\":%d,\"name\":\"%s\"}",
min, max, default, itSupportedProperty->second.Order, itSupportedProperty->second.Name );
min, max, defaultValue, itSupportedProperty->second.Order, itSupportedProperty->second.Name );
}
else
{
sprintf( buffer, "{\"def\":%d,\"type\":\"bool\",\"order\":%d,\"name\":\"%s\"}",
default, itSupportedProperty->second.Order, itSupportedProperty->second.Name );
defaultValue, itSupportedProperty->second.Order, itSupportedProperty->second.Name );
}

value = buffer;
Expand Down