-
Notifications
You must be signed in to change notification settings - Fork 4
Referring to common choices in open source projects, directly provide some definitions here instead of relying on the 'strmiids' static library #20
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
Conversation
… some definitions here instead of relying on the 'strmiids' static library.
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughMoves DirectShow GUID definitions into a new guarded header and emits them from one translation unit via <initguid.h>; removes in-file GUIDs and the pragma link to strmiids.lib; adds Windows-only GUID verification tests and integrates them into the test/build scripts. Changes
Sequence Diagram(s)No runtime control-flow changes; sequence diagram omitted. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
✅ Files skipped from review due to trivial changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
🔇 Additional comments (2)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes the dependency on the strmiids.lib static library by defining all required DirectShow GUIDs locally using the DEFINE_GUID macro. This is a common practice in cross-platform builds, particularly for MinGW compatibility, and helps reduce external library dependencies.
Key Changes:
- Removed
#pragma comment(lib, "strmiids.lib")directive from ccap_imp_windows.cpp - Added explicit DEFINE_GUID declarations for ~40 DirectShow GUIDs (interfaces, CLSIDs, media types, and format types)
- Updated header file comments to document the new approach
- Removed obsolete EXTERN_C declarations from the header file
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/ccap_imp_windows.h | Removed EXTERN_C declarations for three GUIDs and added explanatory comment about the new approach |
| src/ccap_imp_windows.cpp | Replaced strmiids.lib dependency with explicit GUID definitions for all DirectShow interfaces, CLSIDs, media types, and format types |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (2)
src/ccap_dshow_guids.h (2)
37-37: Inconsistent spacing after identifier name.Line 37 has
CCAP_IID_ICaptureGraphBuilder2,0x93e5a4e0(no space after comma) while other lines have a space. This was flagged in a previous review.-DEFINE_GUID(CCAP_IID_ICaptureGraphBuilder2,0x93e5a4e0, 0x2d50, 0x11d2, 0xab, 0xfa, 0x00, 0xa0, 0xc9, 0xc6, 0xe3, 0x8d); +DEFINE_GUID(CCAP_IID_ICaptureGraphBuilder2, 0x93e5a4e0, 0x2d50, 0x11d2, 0xab, 0xfa, 0x00, 0xa0, 0xc9, 0xc6, 0xe3, 0x8d);
49-49: Inconsistent spacing after identifier name.Line 49 has
CCAP_CLSID_VideoInputDeviceCategory,0x860bb310(no space after comma), inconsistent with other lines. This was flagged in a previous review.-DEFINE_GUID(CCAP_CLSID_VideoInputDeviceCategory,0x860bb310,0x5d01, 0x11d0, 0xbd, 0x3b, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86); +DEFINE_GUID(CCAP_CLSID_VideoInputDeviceCategory, 0x860bb310, 0x5d01, 0x11d0, 0xbd, 0x3b, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86);
🧹 Nitpick comments (1)
src/ccap_imp_windows.cpp (1)
34-41: Orphanclang-format ondirective.Line 40 has
// clang-format onwithout a corresponding// clang-format off. The "off" directive was likely in the removed code (the old GUID definitions). Either remove the orphan directive or add the matching// clang-format offbefore line 34 if formatting control is still needed for the includes.// Include initguid.h before our GUID definitions header so that DEFINE_GUID // actually defines the GUIDs (rather than just declaring them as extern). // This avoids the need to link against strmiids.lib. #include <initguid.h> #include "ccap_dshow_guids.h" - -// clang-format on
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
src/ccap_dshow_guids.h(1 hunks)src/ccap_imp_windows.cpp(1 hunks)tests/CMakeLists.txt(2 hunks)tests/test_guid_definitions.cpp(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Build ARM64 (Debug-gcc-static)
- GitHub Check: Build Fedora (Release-static)
- GitHub Check: Build Fedora (Release-shared)
- GitHub Check: Build ARM64 (Debug-gcc-shared)
- GitHub Check: Build ARM64 (Release-gcc-static)
- GitHub Check: Build (Release-clang-shared)
- GitHub Check: Build (Release-clang-static)
- GitHub Check: Windows Build (Debug-shared)
- GitHub Check: Windows Build (Release-static)
- GitHub Check: Windows Build (Release-shared)
🔇 Additional comments (6)
tests/CMakeLists.txt (2)
83-114: LGTM! Well-structured Windows-only GUID verification test.The test target configuration is correct:
- Properly guarded with
WIN32- Links against
strmiidsandole32for reference GUID values- Compile options are consistent with other test targets in this file
- C++17 standard is correctly set
144-146: LGTM!Test discovery correctly mirrors the pattern used for other test executables and is properly guarded for Windows.
src/ccap_imp_windows.cpp (1)
126-153: LGTM! GUID usage through aliases works correctly.The
s_pixelInfoListarray and other GUID references throughout the file correctly use the standard names (e.g.,MEDIASUBTYPE_MJPG,MEDIASUBTYPE_RGB24), which are aliased to theCCAP_prefixed definitions via macros inccap_dshow_guids.h. This maintains source compatibility while eliminating thestrmiids.libdependency.tests/test_guid_definitions.cpp (1)
1-44: Well-designed test file with comprehensive GUID verification.The test design is sound:
- Links against
strmiids.libto get ground-truth GUID values- Uses
CCAP_NO_GUID_ALIASESto avoid macro conflicts- Includes
initguid.hbefore the GUID header to define (not just declare) the GUIDs- Provides both individual test cases and a summary test for visual inspection
src/ccap_dshow_guids.h (2)
1-27: Well-documented header with clear usage instructions.The documentation clearly explains:
- The purpose of avoiding
strmiids.libdependency- The requirement to include
<initguid.h>before this header in exactly one.cppfile- Cross-compilation scenarios where this is useful
The Windows guard and minimal includes are appropriate.
104-163: LGTM! Clean alias design for backward compatibility.The
CCAP_NO_GUID_ALIASESguard allows:
- Production code to use standard names (
MEDIASUBTYPE_RGB24, etc.) transparently- Test code to disable aliases and compare
CCAP_prefixed values againststrmiids.libreferencesAll defined GUIDs have corresponding aliases.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
scripts/run_tests.sh (1)
188-188: Quote the command substitution to prevent word splitting.The
$(detectCores)should be quoted to avoid potential issues with word splitting, as flagged by Shellcheck.Apply this diff:
- cmake --build . --config Debug --target ccap_guid_test --parallel $(detectCores) + cmake --build . --config Debug --target ccap_guid_test --parallel "$(detectCores)"Note: You may also want to apply the same fix to line 187 for consistency.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
scripts/run_tests.sh(3 hunks)src/ccap_dshow_guids.h(1 hunks)src/ccap_imp_windows.cpp(1 hunks)tests/test_guid_definitions.cpp(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/ccap_imp_windows.cpp
🧰 Additional context used
🧬 Code graph analysis (1)
scripts/run_tests.sh (1)
scripts/build_and_install.sh (2)
detectCores(16-22)isWindows(12-14)
🪛 Shellcheck (0.11.0)
scripts/run_tests.sh
[warning] 188-188: Quote this to prevent word splitting.
(SC2046)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
- GitHub Check: Build Fedora (Release-static)
- GitHub Check: Build Fedora (Release-shared)
- GitHub Check: Build Fedora (Debug-static)
- GitHub Check: Build (Release-clang-static)
- GitHub Check: Windows Build (Release-static)
- GitHub Check: Windows Build (Release-shared)
- GitHub Check: Windows Build (Debug-shared)
🔇 Additional comments (11)
scripts/run_tests.sh (1)
291-308: Well-integrated Windows-only GUID verification tests.The GUID test execution is properly guarded, follows the same patterns as existing tests, and correctly propagates failures to the overall test result.
tests/test_guid_definitions.cpp (6)
14-34: Correct include ordering and conflict prevention.The test properly includes
initguid.hbefore the GUID header to ensure definitions are emitted, and usesCCAP_NO_GUID_ALIASESto prevent macro conflicts with strmiids.lib. This ensures the test validates the exact same GUIDs used in production.
39-64: Thorough GUID comparison with detailed error reporting.The helper functions provide both field-by-field validation and
IsEqualGUIDcomparison, with clear error messages showing both the CCAP and reference GUID values.
69-276: Comprehensive GUID test coverage with FourCC validation.The test suite covers all critical DirectShow GUIDs and includes special FourCC pattern validation for I420 and YUYV, which may not be in strmiids.lib on all systems.
282-339: COM initialization handling correctly implemented.The tests now properly track whether they initialized COM vs. finding it already initialized (RPC_E_CHANGED_MODE), and only call
CoUninitialize()whenweInitializedComis true. This prevents COM reference count imbalance as flagged in previous reviews.
344-413: Helpful summary test for visual inspection.The
PrintAllGuidComparisonstest provides a convenient overview of all GUID validations, useful for debugging and visual verification during development.
415-422: Appropriate handling of non-Windows platforms.Using
GTEST_SKIP()with a clear message is the correct approach for platform-specific tests, ensuring test runners show these tests as skipped rather than missing.src/ccap_dshow_guids.h (4)
1-28: Clear documentation and proper header structure.The header provides excellent documentation about its purpose, usage requirements (especially the critical initguid.h ordering), and includes appropriate guards for both ODR protection and platform targeting.
29-101: Well-organized GUID definitions with clear structure.The GUIDs are logically grouped by category, use consistent CCAP_ prefixing to avoid conflicts, and include helpful FourCC comments. The clang-format guards preserve the alignment for readability.
104-163: Smart compatibility layer for seamless integration.The optional alias mappings (guarded by
CCAP_NO_GUID_ALIASES) allow production code to use standard DirectShow names while the test code can compare CCAP_ versions against strmiids.lib references without conflicts. This is a well-designed compatibility strategy.
165-167: Proper include guard closure.The header guards are correctly closed in the proper order.
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.