How to modify a strange code

Source: Internet
Author: User

It's written here just for the sake of memo.

Scene:

Recent work has enabled the use of FFmpeg to implement a number of functions, and there are now requirements changes that need to be modified (re-assembled or split).

I am very unfamiliar with ffmpeg, and we are familiar with the function of ffmpeg realization in our project. This is typical of the business cooked, not familiar with the code, hehe.

1, familiar with the function

2, not familiar with the implementation of the function of the code

3. To modify these functions (code)

Work hard to finish the work through these days. The special summary is as follows:

1, understand the function, the function according to the structure of the code refinement, such as saving the file refinement to encode + save file

(The refinement of the function is based on the implementation logic of the Code, not imaginary), do not need to know very detailed code implementation details, macro can be.

2, ignore some methods, many methods in fact we just need to know which function inside is good, such as Av_interleaved_write_frame is used in the preservation of files, so enough, do not need to go into the drill. Because there are places (where there is no need to split) we just have to do what we did.

3, find the interface between the modules (methods, objects, etc.) if you need to split a large function, such as saving the file is split into encoding and saving files.

4, the realization of the modular after refinement.

So we basically solved the problem. Well, usually the question is far from resolved.

5, after the module is running the program. But the results are often unsatisfactory.

6, after the module, in fact, we are unfamiliar with the module has a certain understanding, then we need to more detailed understanding of the code, but not to all parts of this, the relevant modules can be.

7, then we are familiar with the code, should be able to solve the problem, if still do not go to the Internet to find some instance code ( do not ignore the official website example ), through the study of the demo to understand the API

8, do not forget the original code is no problem, and the use of the scene and the existing scene basically exactly match, so he is also a good demo.

Look back at the original code to see the original code and now the code has and different,

9, debug the original code . By modifying the original code (replacing some API parameters, cutting some function calls, etc.) to deepen the understanding of the API, to confirm their own ideas.

10, the problem at this time has not been solved, basically has been plunged into it, the first rest , after you have to pull out , from the macro-clear ideas, formulate strategies .

At this point the code is already very familiar with, should be able to solve all the problems

How to modify a strange code

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.