Experience of modifying the mplayerplugin-in Plug-in
Source: Internet
Author: User
The experience of changing the mplayerplugin-in Plug-in-Linux general technology-Linux programming and kernel information. The following is a detailed description. The lab has made a j2ee teaching system, which runs well in both windows and x86 linux, and uses adobe flash player for audio and video, however, on the 15th, I received a task saying that it was not enough time for the system to run on "Dragon core" debian linux. I hope to work hard on the firefox plug-in, the code for playing audio and video is as follows:
Flash plug-ins are determined to use flash to play the corresponding flv format stream or Mp3 files through the. SWF Suffix of src.pdf. Because the adboe flash plug-in does not support "Dragon core" debian linux, you must improve the plug-in.
Basic Idea: Read the src and flashvar attributes and perform transformations to access the correct media file. test whether the flv format and Mp3 files are played by mplayer in linux are excellent.
At first, I wanted to directly find a firefox plug-in and extract the flashvar value and assign it to src. I read the xul, js and other documents related to the firefox plug-in one day, checked the source code of the mediawrap and mediaconnectivity plug-ins, and finally completed the task on Sunday afternoon.
The biggest feeling is: How can I debug the plug-in? At the beginning, even printf didn't know where it was to be played, and finally found the console service provided by firefox. debugging information can be output to the "error console.
Changed and completed, but unfortunately the called mplayer is running as an independent application and is not embedded in firefox! It took two days to complete the task using xul and js!
So I found the mplayerplug-in plug-in. I didn't have it in the kernel library, so I took apt-get source and the ubuntu source to get the kernel for compilation. although the names of related dependent libraries are different from those of ubuntu, the compilation environment is successfully established.
I have never used c ++ development in linux before, and I have never used C ++ for any projects. But according to my own ideas: isn't it just converting the src attribute with the flashvar attribute? It doesn't matter if you are not familiar with C ++. Just click the basic syntax.
So I looked at the makefile file, looked at the header file, looked at the source code, and probably sorted out the process. Soon on November 2, I changed the src attribute of the parameter passed to plugin from the browser. The test won't work!
So I went on to look at the source code carefully and found that the stream-> url was actually used during the call. So I wanted to change the stream-> url attribute and found it to be a const char *. I am not allowed to change it, when the dead horse is a live horse, find the system library header file, change it to char *, and adjust the stream-> url value. The result still does not work!
"If there is no way, go to the Manual." On the fifth day of the week, I read the plug-in document on dev.mozilla.org several times: I figured out the process: firefox-> find the appropriate plug-in based on the webpage-> initialize the plug-in-> instantiate-> Play files. imagine that you only need to change the parameter before instantiating the plug-in. The test still won't work!
Then it is found that when the plug-in is initialized The file in it already exists as stream. The parameters changed after the plug-in is instantiated cannot affect the stream from the browser to the plug-in! If you want to change it, you can only create a new stream and get the corresponding URL file. However, the stream is also from the browser> plug-in. The default value is http://domain.com/xxx.flv. the browser automatically transmits the stream to plugin, for no reason. Method. If you really want to process the file, you can only get a stream mechanism to process the obtained file, which is too troublesome.
In other words, the playback url is directly transmitted to plugin for direct playback by plugin. Unfortunately, the stream is not seekable, so many flv-format stream playback will fail ..
Give up.
Summary:
1. Plug-in debugging is a hassle
2. You must first understand what the task is.
3. Do not use complicated solutions for simpler solutions.
4. You must first read the document before proceeding to the task.
5. It's really annoying to allocate C memory.
In fact, there is no need to change the embed tag. The default mplayerplugin-in does not support x-flv. It is much easier to change it to support this format.
To change the webpage's output source and use the standard method, why should it be reduced to 1 week.
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