Tcpmp0.72rc1 compilation and transplantation and complete UI Method

Source: Internet
Author: User

1. compile.

For compilation, I reference other people's articles. I have tried it and it is indeed feasible. As follows:

Development Environment: Windows XP SP2 + evc4.0 (SP4)
Target Platform: Windows ce5.0 (armv4)

1. To download the source code, go to http://picard.exceed.hu/tcpmp/to download the tcpmpsource code. The source code version I downloaded is 0.72rc1.

2. Compile the environment. I installed evc4.2 (SP4) + standard SDK + Win32 (wce armv4) release.if it is a compilation of x861_emulator.pdf, download a nasm .this point is mentioned in readme.txt.

3. The downloaded source code package does not contain arm Decoder source code, you can download the source code of AMR decoder from the following two URLs: http://www.3gpp.org/ftp/Specs/archive/26_series/26.104/26104-610.zip
Http://www.3gpp.org/ftp/Specs/archive/26_series/26.204/26204-600.zip
And copy them to the 26104 and 26204 files in the AMR directory respectively. Similarly, this information is mentioned in readme.txt.

4. prepare the arm assembler. based on practical experience, the compiler downloaded from the arm official website reports an error during compilation and is not suitable for use. We recommend that you use the arm assembler armasm of vs2005. EXE to C:/Microsoft Embedded C ++ 4.0/EVC/wce400/bin.

5. do not rebuild all during compilation. Otherwise, a large number of errors will be reported. Select player_e3 (main project) from the project-dependencies drop-down box to see the dependency between sub-projects, therefore, player_c4is the last compiled project. Select a sub-project in the drop-down box and the common project will be found in the dependencies. This indicates that the project should be compiled first. Next we will start with the common project.

6. Set the player_e3 project as active project, and select Win32 (wce armv4) release for the compilation version. This project will be compiled at the very beginning, and the player_ce3.exe application will be generated at the end, so our goal will be achieved. However, compiling this program depends on many libraries. These libraries are provided after compilation by other projects.

7. In the file view mode on the left of EVC, select common files and right-click the build (selection only) menu to compile the common project. Next, we will compile the sub-projects in the upper and lower order. Of course, compilation is not required for projects that are not associated with the project -- dependencies (6 items in total: player_ce2, sample_e3, setup_ce2, setup_e3, template, and vorbisscsi). The other three items put down asap, FLAC, and player_e3 for final processing. The Compiler needs to be configured additionally, otherwise, a large number of errors will be reported. If there is no accident, compilation will be successful. Next, we need to process the remaining three projects.

8. Compile the ASAP project. Right-click ASAP files-> Settings-> C/C ++-> category-> Preprocessor and add the project path to additional include directories: (Note that this is a relative path, all of the following content to be added does not include quotation marks )"., ASAP, atari800/src ". otherwise, a pile of header files will not be found. add a macro definition ", ASAP" to Preprocessor definitions: which can be modified in the source code. after the settings are completed, the ASAP files project can be correctly compiled.

9. Compile the FLAC project. In the same 8, open the settings of FLAC to the same interface. In additional include directories: add the path "FLAC/include, FLAC/src/libflac/include". Otherwise, a pile of headers cannot be found. Then, add ", too many no_dll" in Preprocessor definitions ". Add this definition to avoid a lot of c2491 errors caused by _ declspec (dllexport)-defined functions. After this setting, the FLAC project should be correctly compiled.

10. similarly, to modify the player_c4project, add the path "in additional include directories ".. /ASAP ,.. /ASAP ,.. /ASAP/atari800/src, FLAC/include, FLAC/src/libflac/include ". Then add ", ASAP" in Preprocessor difinitions ". This is the last project file. It is also the main project file that successfully compiled player_ce3.exe.

11. Beibei includes all generated files including player_ce3.exe to the target board (all files must be placed in the same directory) and can be run! However, the menu is not correctly displayed. The main reason is that the real language configuration file is not loaded. You can copy the multi-language support files under the Lang directory of the source code to the same directory of the target board. Export lang_en.txt,lang_chs.txt and lang_ca.def files (the configuration files in the four languages must be in the same directory as the application). After opening the file, it is displayed in English by default. You can change it to simplified Chinese, the premise is that your CE platform supports Simplified Chinese.

I ran it using the development platform simulator in vs2005. Everything was normal, that is, the playback was not smooth and I needed to optimize it later.

I also tried to compile it to the armv4i platform, and the result was also feasible. However, due to the particularity of the platform, some configurations need to be modified, and some plug-ins are not supported, however, it does not affect the usage, which is summarized as follows:

1. Experience summary shows that some tcpmp modules are not supported during compilation on the armv4i platform, and corresponding files are missing during compilation. The Unsupported modules do not affect the normal use of the player. In the project-dependenties drop-down list, select player_e3 and remove the following ones: you do not need to compile FFMPEG, MPC, and speex.

2. You must manually create Win32 (wce armv4i) debug and release versions. In build-dependencies, select Add for each sub-project (the three items mentioned above, and do not need to be added for the six items that do not need to be compiled in the dependencies), and select Win32 (wce armv4i) for the CPU ), in copy settings from, select Win32 (wce armv4) release, and then select OK. Then, you add the corresponding compilation version for the sub-project.

3. right-click the sub-project to be compiled, select Settings-link, select general in category, and change the last line of statement:/machine: arm to/machine in the following project options: thumb (each project must be changed)

4. Follow the armv4 process above for other steps. The corresponding modifications are also required. The modifications start from common and end with player_c4.

After the above process, you can customize your own tcpmp player. You can change the appearance of tcpmp in the interface project. Of course, the first job is to optimize the specific platform :)

2. Control tcpmp (Zhang Ting zt00@tom.com)

When it comes to control, many things in the world need control, just as women need control and control, so that society can be harmonious!

1. Let tcpmp play in the window we specify.

To enable the tcpmp player to play in the specified window, you need to modify the common plug-in. please set common to the current project, search for all the getdc functions, replace them with getdc (context ()-> WND), and releasedc (null, DC) it can also be replaced by releasedc (context ()-> WND, DC). The compiled plug-in is the plug-in we need. only in this way can context_wnd (this-> getsafehwnd () be truly valid.

2. Create a dialog box project for MFC. The following code is provided:

Download the code to: http://download.csdn.net/source/1229925

The following shows the main code:

Header file:

// Tcpmp_myuidlg.h: header file
// Zhang Ting Email: zt00@tom.com

# If! Defined (afx_tcpmp_myuidlg_h1_b5dd421b_af1e_4678_ad26_08a3f0de30871_encoded _)
# Define afx_tcpmp_myuidlg_h1_b5dd421b_af1e_4678_ad26_08a3f0de30871_encoded _

# If _ msc_ver> = 1000
# Pragma once
# Endif // _ msc_ver >=1000

// Header file containing tcpmp
# Include "include/common. H"

//////////////////////////////////////// /////////////////////////////////////
// Ctcpmp_myuidlg Dialog

Class ctcpmp_myuidlg: Public cdialog
{
// Construction
Public:
Ctcpmp_myuidlg (cwnd * pparent = NULL); // standard Constructor

// Dialog data
// {Afx_data (ctcpmp_myuidlg)
Enum {IDD = idd_tcpmp_myui_dialog };
Csliderctrl m_sliderplay;
Cstatic m_textoutlable;
//} Afx_data

// Classwizard generated virtual function overrides
// {Afx_virtual (ctcpmp_myuidlg)
Public:
Virtual bool destroywindow ();
Protected:
Virtual void dodataexchange (cdataexchange * PDX); // DDX/DDV support
//} Afx_virtual

Public:
Int m_trackpos;
Cstring m_textoutstr, m_totaltimestr;

Bool m_bplayorpaulse; // "play/pause" flag

Player * m_player; // control the pointer of the tcpmp player

 
Bool inittcpmp (); // initialize tcpmp

Cstring ticktostringzhang (INT tick); // time Conversion

Protected:
Hicon m_hicon;

// Generated message map Functions
// {Afx_msg (ctcpmp_myuidlg)
Virtual bool oninitdialog ();
Afx_msg void onplay ();
Afx_msg void onstop ();
//} Afx_msg

Afx_msg lresult playereventmsg (wparam, lparam );

Declare_message_map ()
};

// {Afx_insert_location }}
// Microsoft Embedded Visual C ++ will insert additional declarations immediately before the previous line.

# Endif //! Defined (afx_tcpmp_myuidlg_h1_b5dd421b_af1e_4678_ad26_08a3f0de30871_encoded _)

The following is the CPP file:

// Tcpmp_myuidlg.cpp: implementation file
//
// Zhang Ting Email: zt00@tom.com
# Include "stdafx. H"
# Include "tcpmp_myui.h"
# Include "tcpmp_myuidlg.h"

# Ifdef _ debug
# Define new debug_new
# UNDEF this_file
Static char this_file [] = _ file __;
# Endif

# Define wm_player_eventmsg wm_user + 1985 // player event message

Y notify; // notification

Cwnd * g_pplayerwnd = NULL;

Int playernotify (node * player, int Param, int param2)
{

G_pplayerwnd-> postmessage (wm_player_eventmsg, Param, (lparam) param2 );

Return err_none;
}

//////////////////////////////////////// /////////////////////////////////////
// Ctcpmp_myuidlg Dialog

Ctcpmp_myuidlg: ctcpmp_myuidlg (cwnd * pparent/* = NULL */)
: Cdialog (ctcpmp_myuidlg: IDD, pparent), m_bplayorpaulse (true)
{
// {Afx_data_init (ctcpmp_myuidlg)
//} Afx_data_init
// Note that loadicon does not require a subsequent destroyicon in Win32
M_hicon = afxgetapp ()-> loadicon (idr_mainframe );

M_player = NULL;

M_trackpos = 0;

}

Void ctcpmp_myuidlg: dodataexchange (cdataexchange * PDX)
{
Cdialog: dodataexchange (PDX );
// {Afx_data_map (ctcpmp_myuidlg)
Ddx_control (PDX, idc_percent, m_sliderplay );
Ddx_control (PDX, idc_time, m_textoutlable );
//} Afx_data_map
}

Begin_message_map (ctcpmp_myuidlg, cdialog)
// {Afx_msg_map (ctcpmp_myuidlg)
On_bn_clicked (idc_play, onplay)
On_bn_clicked (idc_stop, onstop)
//} Afx_msg_map
On_message (wm_player_eventmsg, playereventmsg)
End_message_map ()

//////////////////////////////////////// /////////////////////////////////////
// Ctcpmp_myuidlg message handlers

Bool ctcpmp_myuidlg: oninitdialog ()
{
Cdialog: oninitdialog ();

// Set the icon for this dialog. The framework does this automatically
// When the application's main window is not a dialog
Seticon (m_hicon, true); // set big icon
Seticon (m_hicon, false); // set small icon
 
Centerwindow (getshorttopwindow (); // center to the HPC Screen

// Todo: add extra initialization here
G_pplayerwnd = this;

M_sliderplay.setrange (0,30000 );

Inittcpmp ();

Return true; // return true unless you set the focus to a control
}

Rect defaultrect = {0, 320,240}; // specifies the window for playing a movie.
Tchar_t URL [] = _ T ("// sdmmc card // tcpmp72new // 008.mp4"); // path of the playback File

// Initialize tcpmp
Bool ctcpmp_myuidlg: inittcpmp ()
{
// Initialization
If (context_init (_ T ("tcpmp"), _ T ("0.72rc1"), 3, (tchar_t *) afxgetapp ()-> m_lpcmdline, null ))//
{

Context * pcontext = context (); // obtain the context

If (pcontext)
M_player = (player *) (pcontext-> player );
Else
Return false;
 

Context_wnd (this-> getsafehwnd (); // stream play window Association

// Set the notification processing function
Policy. func = (policyfunc) playerpolicy;
Required Y. This = (void *) m_player;

If (m_player)
M_player-> set (m_player, player_notify, & notify, sizeof (notify ));
 

Int I = 0;
M_player-> set (m_player, player_list_count, & I, sizeof (INT); // clear the playlist

M_player-> set (m_player, player_list_url + 0, URL, sizeof (URL ));

M_player-> set (m_player, player_skin_viewport, & defaultrect, sizeof (rect); // you can specify a window for playing a movie.

Int Index = 0;
M_player-> set (m_player, player_list_curridx, & Index, sizeof (INT); // you can specify a file in the playlist as the current file.

M_player-> set (m_player, player_play, & m_bplayorpaulse, sizeof (bool); // start playing

}
Else
Return false;

Return true;

}

Void ctcpmp_myuidlg: onplay () // play/pause
{

If (m_player)
{

M_bplayorpaulse =! M_bplayorpaulse;

M_player-> set (m_player, player_play, & m_bplayorpaulse, sizeof (bool ));

}

 
}

Void ctcpmp_myuidlg: onstop () // stop
{

If (m_player)
M_player-> set (m_player, player_stop, null, 0 );

}

Bool ctcpmp_myuidlg: destroywindow () // exit the program
{

If (m_player)
{

Context_wnd (null );
 
Context_done ();

: Sleep (200 );
}

Return cdialog: destroywindow ();
}

Cstring ctcpmp_myuidlg: ticktostringzhang (INT tick)
{
If (tick <0)
Tick =-tick;
 
Int hour, Min, SEC;

Hour = tick/3600/tickspersec; // get the hour
Tick-= hour x 3600 * tickspersec;
Min = tick/60/tickspersec; // minutes
Tick-= min * 60 * tickspersec;
SEC = tick/tickspersec; // obtain the second
Tick-= sec * tickspersec;

Cstring strtime;

Strtime. Format (_ T ("0% D: % d"), hour, Min, Sec );
If (Min <10)
Strtime. insert (3, '0 ');
If (SEC <10)
Strtime. insert (strtime. getlength ()-1, '0 ');

Return strtime;
}

Lresult ctcpmp_myuidlg: playereventmsg (wparam, lparam)
{
Fraction F;
Int msg_id = (INT) wparam;
Int msg_status = (INT) lparam;

Switch (msg_id)
{
Case player_percent:

If (msg_status = 1)
{
M_player-> get (m_player, player_percent, & F, sizeof (fraction ));
M_trackpos = Scale (30000, F. Num, F. Den );

If (m_trackpos >=29700)
M_trackpos = 30000;

M_sliderplay.setpos (m_trackpos );

Tick_t time = 0;
// Tchar_t dur [32];
If (m_player-> get (m_player, player_position, & time, sizeof (tick_t) = err_none) // player_duration
{

}
Else
{

}
M_textoutstr.empty ();
M_textoutstr = ticktostringzhang (time );
M_textoutstr + = _ T ("/");
M_textoutstr + = m_totaltimestr;
// M_textoutstr + = _ T ("");
// M_textoutstr + = m_titlenamestr;

M_textoutlable.setwindowtext (m_textoutstr );
}

Break;
Case player_play:

Break;
Case player_title:

Break;
Default:
Break;


}

Return true;

}

Haha, check it with the Code. Everything becomes simple!

 

This article from the csdn blog, reproduced please indicate the source: http://blog.csdn.net/zhangting00_2000/archive/2009/04/20/4095272.aspx

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.