Skip to content

fix: make GPAC dependency optional in CMake - #2320

Open
shubhrai23 wants to merge 3 commits into
CCExtractor:masterfrom
shubhrai23:fix/issue-2254-optional-gpac
Open

fix: make GPAC dependency optional in CMake#2320
shubhrai23 wants to merge 3 commits into
CCExtractor:masterfrom
shubhrai23:fix/issue-2254-optional-gpac

Conversation

@shubhrai23

Copy link
Copy Markdown

Resolves #2254

What changed: Made the GPAC library dependency optional via a CMake option flag. When GPAC is not found or disabled, CCExtractor builds without GPAC-dependent features. Added ifdef ENABLE_GPAC guards with graceful fallback stubs. Updated the Windows MSVC project file.

Why: libgpac-dev was removed from Ubuntu 24.10+ repositories, causing hard build failures.

Copilot AI lite review requested due to automatic review settings August 12, 2026 21:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Makes the GPAC (libgpac) dependency optional for CMake builds so CCExtractor can still configure/build on systems where GPAC is unavailable (e.g., newer Ubuntu releases), while keeping GPAC-backed MP4 functionality enabled when the library is detected.

Changes:

  • Added WITH_GPAC CMake option and made GPAC detection non-fatal, compiling without GPAC when not found.
  • Introduced #ifdef ENABLE_GPAC guards for GPAC headers/version reporting, and added GPAC-disabled stub implementations for MP4 entry points.
  • Updated the Windows MSVC project to define ENABLE_GPAC so GPAC-backed code remains enabled there.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
windows/ccextractor.vcxproj Defines ENABLE_GPAC for MSVC “*-Full” configs to keep GPAC-backed code enabled in that build.
src/lib_ccx/params.c Guards GPAC header includes and version-printing behind ENABLE_GPAC.
src/lib_ccx/mp4.c Wraps GPAC MP4 implementation behind ENABLE_GPAC and adds non-GPAC stubs.
src/lib_ccx/CMakeLists.txt Makes GPAC discovery conditional/optional and toggles ENABLE_GPAC when found.
src/CMakeLists.txt Adds WITH_GPAC option and avoids unconditional GPAC-related definitions/linking.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +14 to +23
if (WITH_GPAC)
pkg_check_modules (GPAC gpac)
if (GPAC_FOUND)
set (EXTRA_INCLUDES ${EXTRA_INCLUDES} ${GPAC_INCLUDE_DIRS})
set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES})
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DENABLE_GPAC")
else ()
message(WARNING "GPAC not found. Compiling without GPAC support.")
endif ()
endif ()
Comment thread src/CMakeLists.txt Outdated
Comment on lines +184 to +186
if (WITH_GPAC)
set (EXTRA_LIBS ${EXTRA_LIBS} ${GPAC_LIBRARIES})
endif()
Comment thread src/lib_ccx/mp4.c
Comment on lines +1302 to +1311
int processmp4(struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file)
{
mprint("GPAC support is disabled. MP4 parsing will not work.\n");
return -1;
}

int dumpchapters(struct lib_ccx_ctx *ctx, struct ccx_s_mp4Cfg *cfg, char *file)
{
return -1;
}
@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on linux. Below is a summary of the test results, when compared to test for commit 128175e...:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 1/7
DVD 3/3
DVR-MS 2/2
General 21/27
Hardsubx 1/1
Hauppage 3/3
MP4 0/3
NoCC 4/10
Options 68/86
Teletext 0/21
WTV 12/13
XDS 31/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=srt --latin1 f1422b8bfe..., Last passed: Never

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

@ccextractor-bot

Copy link
Copy Markdown
Collaborator
CCExtractor CI platform finished running the test files on windows. Below is a summary of the test results, when compared to test for commit 128175e...:
Report Name Tests Passed
Broken 9/13
CEA-708 2/14
DVB 1/7
DVD 3/3
DVR-MS 2/2
General 22/27
Hardsubx 1/1
Hauppage 3/3
MP4 3/3
NoCC 10/10
Options 69/86
Teletext 0/21
WTV 12/13
XDS 31/34

Your PR breaks these cases:

NOTE: The following tests have been failing on the master branch as well as the PR:

Congratulations: Merging this PR would fix the following tests:

  • ccextractor --autoprogram --out=srt --latin1 f1422b8bfe..., Last passed: Never

It seems that not all tests were passed completely. This is an indication that the output of some files is not as expected (but might be according to you).

Check the result page for more info.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gpac no longer included in ubuntu (resolute...) will make it hard to impossible to build

3 participants