Use Clion to read FFmpeg source code (support jump)

The starting address will be even more wrong

foreword

This solution is only suitable for reading FFmpeg, the configuration method is extremely simple, and it can support jumps between methods, but some of them cannot be recognized or jumped due to configuration reasons, so please do not enter if you mind! !

Option 1 (simple)

This solution is very simple, and most of the source code can be read, but some header files are still missing, making it impossible to view a small part.

step 1

Create a new c++ project in Clion File->New Project->Create, as shown below:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-l6w0Zhdv-1610869186665)(05_source/source-create1.jpg)]

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-scBpuL0O-1610869186667)(05_source/source-create2.jpg)]

step 2

Copy the FFmpeg source code to the root directory, as shown below:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-YNeqryyf-1610869186673)(05_source/source-copy.jpg)]

step 3

Write CMakeLists.txtthe file as follows:

cmake_minimum_required(VERSION 3.17)
project(SourceFFmpeg)

set(CMAKE_CXX_STANDARD 11)

file(GLOB EX_DIR ./*.cpp ./*.c ./*/*.c ./*/*/*.c ./*/*/*/*.c)
set(INCLUDE_DIR ./ ./*/ ./*/*/ ./*/*/*/ ./*/*/*/*/)

include_directories(${INCLUDE_DIR})

add_executable(SourceFFmpeg ${EX_DIR})

simple view

This has been completed, here we look at the jump between source codes, and some methods are called, you can doc/examplessee from the example whether the source code can jump normally, etc., I am as follows:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-9YAnQnR1-1610869186675)(05_source/source-look.jpg)]

Solution 2 (requires compiling source code)

In solution one, some header files are missing.

Step 1 (same as plan 1)

Step 2 (same as solution 1)

step 3

Compile the source code to generate a dynamic library/static library, the purpose requires a header file, and then copy the generated header file to the project, as follows:

[External link picture transfer failed, the source site may have an anti-leeching mechanism, it is recommended to save the picture and upload it directly (img-MzXM5fUe-1610869186676)(05_source/source-head.jpg)]

step 4

Write CMakeLists.txtthe file as follows:

cmake_minimum_required(VERSION 3.17)
project(SourceFFmpeg)

set(CMAKE_CXX_STANDARD 11)

include_directories(./include/)

file(GLOB EX_DIR ./*.cpp ./*.c ./*/*.c ./*/*/*.c ./*/*/*/*.c)

add_executable(SourceFFmpeg ${EX_DIR})

Up to here, the second plan is also completed, you can check it yourself.



Guess you like

Origin blog.csdn.net/github_38117599/article/details/112748073