In Linux, QT starts to use FFMPEG and OpenGL.

Source: Internet
Author: User

In Linux, QT starts to use FFMPEG and OpenGL.

This article only records how to start using FFMPEG and OpenGL, until the basic functions that can be called can be compiled normally.

This article is the beginning of the use of the article after the installation of the http://blog.csdn.net/jszj/article/details/7589566, there may be further articles in the future, but now not sure.

2012.5.22
Create a QT project and find that xx. Pro exists in the file list.
Http://blog.csdn.net/betty_ting/article/details/5769701 instructions, added to the FFMPEG library support is also very simple, because the file view double-click this file will open, you can directly edit.
Because the header file of FFmpeg is already in the system path, you do not need to add the include path to the path above, just add it to the support of Lib:

Libs + =-lavcodec-lavformat-lavutil

It is a bit strange to view the Writing Method of this line. To view the FFMPEG library in the/usr/local/lib directory, all the libraries start with lib and start. end with A, and write it here, and then I will put libavcodec. A changed the name libavcodecn. a. When the result is compiled again, the library file cannot be found. So I guess the name here is removed from the previous lib and later. the part in the middle of a is used as the name, and then check the Lib file in this directory. It is found that all the parts start with Lib, so it basically verifies my guess.
Search for an article: Workshop.
Add the following content to FFMPEG in the source. h file:

# Ifndef int64_c
# Define int64_c (C) (C # LL)
# Define uint64_c (C) (C # ull)
# Endif
Extern "C"
{
# Include <libavformat/avformat. h>
}

The previous # define is used to solve a bug in FFMPEG, which causes the compilation to fail. It is a solution found on the Internet.
For verification, a call to FFmpeg is added to the constructor of the first class:

Avcodec_init ();

Then the compilation results show many errors:

/Home/LIGO/qttools/QT/ffmpeg_org/libavcodec/utils. C: 225: Error: Undefined reference to 'av _ image_check_size'

Add the libavcore. A dependency. The result is as follows:
/Home/LIGO/qttools/QT/ffmpeg_org/libavcore/parseutils. C: 320: Error: Undefined reference to 'av _ get_random_seed'
I did not find the cause after searching for half a day. I finally found the cause.

Bytes:

Libs + =-lavcodec-lavformat-lavcore-lavutil
Compilation is successful. Dizzy. This order is too unpleasant. It's too late. Continue tomorrow.

5.23
To decode the video file, I put several header files defined by myself into the/usr/local/myinclude directory, and then added a line to the. Pro file:
Includepath + =/usr/local/myinclude
In addition, I used FFMPEG Decoding in windows and wrote four files in two classes (one parent class and one subclass) into the project directory and then added them to the project, result prompt:
Unable to use "System"-encoding and decoding
Unable to edit! I use root to log on, and the permission is definitely not a problem. Again, I found a button to change the encoding, press it, and then select windows-1258/cp1258 encoding (the last one in the Windows column may be the latest, so select it), and then you can edit it.
The header files defined by myself are defined in windows, so many things such as ulonglong are not defined, so we added the undefined one-to-one definition at the beginning to the OpenGL header file. The result indicated that the file could not be found, and then we checked the USR directory, I didn't find any OpenGL header files or library files, so I downloaded and installed them online, and it took a lot of effort to install them! Reference URL:
Http://www.linuxdiyf.com/blog? 135044/action_viewspace_itemid_3877.html
Http://hi.baidu.com/pengnini_715/blog/item/a9cb713de48ee0ee3d6d9728.html (note that this URL may have an error, OpenGL = usr/lib/libglu. So, instead of OpenGL = usr/lib/libglu. So)
During installation, the following error occurs:
Bash:./mkmkfiles. imake:/bin/CSH: Bad Interpreter: no such file or directory
First dos2unix does not work, and then Baidu on the search results, to bing search: http://www.lemis.com/grog/diary-may2010.php? Topics = C:

So why didn't that message appear from make? It makes things very confusing. Installing CSH (another indication of the age of this Code) fixed that

The error is the same, but the cleandir error is reported above.
Because root logon is used, you can directly:
Apt-Get install CSH
After the installation is complete, make again. The result is displayed (the last line ):
Make: *** no rule to make target 'depend'. Stop.
I do not know if the installation is successful. Continue with the installation. The following error is reported:
GCC: Error: Unrecognized command line option '-mcompute'
Follow http://www.howtoforge.com/forums/showpost.php? P = 143108 & postcount = 8, "Edit configure and makefile and change all instances of-mnames to-mtune = ices ."

Here, I only modified this item in the LIB/glut/MAKEFILE file and continued to make. The result is still incorrect:
.../../Include/Gl/glut. h: 58: 19: Fatal error: Gl/Gl. h: no such file or directory

5.24
If the GL library cannot be found on the Internet, you have to copy the header file and library from another one. Put the header file in/usr/include/Gl/, and put the library in/usr/lib/Gl, in/usr/lib/, the Library link is established. There are two libraries, libgl. so.1.2, libglut. so.3.8.0, in which libglut. so.3.8.0 creates two connections. However, libgl. so.1.2's library seems to have a link, which is a bit confusing. Libglut. so.3.8.0 creates two links. libglut. So is used for compilation, libglut. so.3 is used for runtime loading, and the Go header file contained in the project is modified
"Gl/glut. H"
Compiled and run successfully.

 

5.28 supplement

After actual operation, problems are found. The normal call is as follows:

Gluinit (& argc, argv );
Gluinitdisplaymode (glu_rgb );
Gluinitwindowposition (100,100 );
Gluinitwindowsize (LW, LH );
Fig ("");
Gludisplayfunc (& Display );
Glumainloop ();

However, when I call glucreatewindow (), it will get stuck and show "The breakpoint is being set. After a few days, the problem was not found on the Internet.

It was originally intended to render the image to a specified window (a control on the dialog box), and this would not work at all, in addition, the descriptions and demos for rendering directly in non-OpenGL windows are not found on the Internet. Well, it's too difficult. It seems that OpenGL has no chance.

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.