深圳做网站哪里好,广州网站建设吧,做网站的软件电子,市场调研方案怎么写我叫张挺#xff0c;虽然开博#xff0c;除了转了一篇黄色文章以外#xff0c;技术文章从来没有写#xff0c;所以呢#xff0c;感到很不好意思#xff01;于是决定还写一篇在网上也留点痕迹。我这里主要是介绍TCPMP的移植以及如何把这个鸟鸟整到自己的界面中来#xff…我叫张挺虽然开博除了转了一篇黄色文章以外技术文章从来没有写所以呢感到很不好意思于是决定还写一篇在网上也留点痕迹。我这里主要是介绍TCPMP的移植以及如何把这个鸟鸟整到自己的界面中来网上关于TCPMP的开发文章不是很多有一点点呢犹如太短不能深入又或者不实用今天呢我先讲如何编译然后讲如何操控制eMail:zt00tom.com 一、编译。
关于编译我是引用的别人的文章我实验过确实可行。如下所言
开发环境windows xp sp2 EVC4.0(SP4) 目标平台Windows CE5.0(ARMV4)
1.下载源码可以去http://picard.exceed.hu/tcpmp/下载TCPMP源代码。我下载的源码版本是0.72RC1。
2.编译环境.我安装的是evc4.2(SP4)standard sdkWin32(WCE ARMV4) Release.如果是编译x86或者Emulator版本的.要下载一个nasm汇编工具.这点在readme.txt里面提到.nasm的下载地址http://nasm.sourceforge.net/.否则的话会因为缺少汇编器而报大量的错误。
3.下载下来的源码包中不包含ARM的解码器源码可以从下面2个网址下载AMR的解码器的源代码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 并且分别拷贝到AMR目录下的26104和26204中。同样这个信息在readme.txt中提到。
4.准备ARM的汇编器根据实践经验从ARM官网上面下载下来的汇编器编译时会报错不适合使用建议使用VS2005的ARM汇编器ARMASM.EXE将其拷贝到C:/Microsoft eMbedded C 4.0/EVC/WCE400/BIN下面。
5.编译的时候切勿rebuild all否则会报大量的错误从Project—-Dependencies下来框里选择player_ce3主项目可以看到子项目间的相互依赖关系所以player_ce3是最后一个编译的项目。随便在下拉框中选择一个子项目在依赖项中都会发现common项目说明该项目应该是首先需要进行编译的下面我们首先从common项目入手。
6.将player_ce3项目set as active project编译版本直接选择Win32 (WCE ARMV4) Release。这个项目将最后一个进行编译最终生成一个player_ce3.exe的应用程序那我们的目标也就达成了。但编译这个程序依赖许多的库。这些库就是其他的project编译后提供的。
7.在EVC左边的文件查看模式里首先选择common files右键菜单Build(selection only)进行common项目的编译会很顺利的过去。接下来由上而下顺序为子项目进行编译当然在Project—-Dependencies中没有关联的项目不需要进行编译总共6项player_ce2、sample_ce3、setup_ce2、setup_ce3、template、vorbislq其它的把asap、flac、player_ce3三项放下来最后处理这三项需要对编译器进行额外配置否则会报大量错误。不出意外的话都会顺利编译过去。接下来我们需要处理剩下来的3个项目。
8.编译asap项目。右键点asap files –settings–c/c–Category–Preprocessor在Additional include directories:中增加项目路径注意这个是相对路径以下所有需添加内容都不包括引号”.,asap,atari800/src”.不然一堆头文件会找不到.在Preprocessor definitions:中增加一个宏定义”,ASAP”当然这2步动作也可以在源代码中修改.如此设置完毕后,asap files project就可以正确编译了.
9.编译flac项目。同8,打开flac的settings到相同界面.在Additional include directories:中增加路径”flac/include,flac/src/libFLAC/include”不然一堆头文件找不到。然后在Preprocessor definitions添加”,FLAC__NO_DLL”。增加这个定义避免使用_declspec(dllexport)定义函数造成的一大堆c2491错误.如此设置后,flac project应该可以正确编译.
10.同理修改player_ce3项目在Additional include directories中增加路径 ”../asap/asap,../asap,../asap/atari800/src,flac/include,flac/src/libFLAC/include”。然后在Preprocessor difinitions:增加”,ASAP”。这是最后一个项目文件也是主项目文件成功编译player_ce3.exe。
11. 拷贝包含player_ce3.exe在内所有的生成文件到目标板上所有文件必须放在同一个目录中可以运行!但是菜单没有显示正确。主要原因是现实语言配置文件没有加载上去可以将源码lang目录下面的多国语言支持文件拷贝到目标板同一个目录下面。如果只需要简体中文和英文的只要拷贝lang_std.txt lang_en.txt,lang_chs.txt,lang_ca.def四个文件四个语言配置文件一定要和应用程序放在同一个目录就可以了打开后默认显示是英语你可以更改到简体中文前提是你的CE平台支持简体中文。
我是在VS2005中用开发平台的模拟器跑的一切正常就是播放不流畅后期需要对这块进行优化。
我也尝试将其编译到ARMV4I平台上结果也是可行的不过由于的平台的特殊性有部分配置需要改动也有部分插件不被支持不过不影响使用大体总结如下
1.经验总结表明在ARMV4I平台的编译工作中TCPMP有部分模块不被支持编译提示缺少相应文件。由于该部分不被支持的模块不影响播放器的正常使用可以在Project–Dependenties中下拉框中选择player_ce3然后将以下几项前面的勾拿掉ffmpeg、mpc、speex 这三项可以不必编译。
2.Win32 (WCE ARMV4I) Debug及Release版本需要自己手动创建。在Build–Configurations里为每个子项目选择ADD上面提到的3项和依赖项中不需要编译的6项不必添加CPU选择Win32 (WCE ARMV4I)在Copy settings from里选择Win32 (WCE ARMV4) Release然后选择OK你就为该子项目添加了相应编译版本。
3.右击需要编译的子项目选择Settings–Link在Category中选择General然后再下面Project Options里将最后一行语句/MACHINE:ARM 改成 /MACHINE:THUMB 每个项目都必须要改
4.其它步骤按照按照上文ARMV4的过程来就可以了相应的修改也是需要的先从common开始以player_ce3结束。
经过以上过程你就可以定制自己专用的TCPMP播放器了可以在interface项目中更改TCPMP的外观当然重头工作还在于对于特定平台的一些优化工作 二、关于控制TCPMP张挺 zt00tom.com
说到控制世界上很多东西需要控制就象女人也同样需要控制控制的好于是社会才能和谐 1、让TCPMP播放时能在我们自己指定的窗口
呵呵要真正让TCPMP播放器在我们指定的窗口播放是需要修改COMMON插件的请同志们把COMMON设置成当前工程然后把GetDC函数全部搜索出来然后通通GetDC(Context()-Wnd)代替并且ReleaseDC(NULL,DC)也通通用ReleaseDC(Context()-Wnd,DC)代替然后编译出来的插件就是我们需要的插件只有这样才能使Context_Wnd(this-GetSafeHwnd())真正有效 2、建立一个MFC的对话框工程下面贴出代码
下载代码请到http://download.csdn.net/source/1229925
下面贴出主要代码
头文件
// TCPMP_MyUIDlg.h : header file // 张挺 2009-04-20 eMail:zt00tom.com
#if !defined(AFX_TCPMP_MYUIDLG_H__B5DD421B_AF1E_4678_AD26_08A3F0DE3087__INCLUDED_) #define AFX_TCPMP_MYUIDLG_H__B5DD421B_AF1E_4678_AD26_08A3F0DE3087__INCLUDED_
#if _MSC_VER 1000 #pragma once #endif // _MSC_VER 1000
//包含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;//播放/暂停标志 player* m_Player;//操控TCPMP播放器的指针 BOOL InitTcpmp();//初始化TCPMP CString TickToStringZhang(int Tick);//时间转换
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 wParam, LPARAM 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_H__B5DD421B_AF1E_4678_AD26_08A3F0DE3087__INCLUDED_) 下面是文件
// TCPMP_MyUIDlg.cpp : implementation file // // 张挺 2009-04-20 eMail:zt00tom.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//播放器事件消息
notify Notify;//通知
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 applications main window is not a dialog SetIcon(m_hIcon, TRUE); // Set big icon SetIcon(m_hIcon, FALSE); // Set small icon CenterWindow(GetDesktopWindow()); // 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,0,320,240};//播放电影窗口区域 tchar_t URL[] _T(//SDMMC Card//TCPMP72NEW//008.mp4);//播放文件的路径
//初始化TCPMP BOOL CTCPMP_MyUIDlg::InitTcpmp() { //初始化 if(Context_Init(_T(TCPMP),_T(0.72RC1),3,(tchar_t*)AfxGetApp()-m_lpCmdLine,NULL))// { context* pContextContext();//获得上下文 if(pContext) m_Player(player*)(pContext-Player); else return false; Context_Wnd(this-GetSafeHwnd());//播放窗口关联 //设置通知处理函数 Notify.Func (notifyfunc)PlayerNotify; Notify.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));//播放列表清空 m_Player-Set(m_Player,PLAYER_LIST_URL0,URL,sizeof(URL)); m_Player-Set(m_Player,PLAYER_SKIN_VIEWPORT,DefaultRect,sizeof(rect));//设置播放电影窗口区域 int index 0; m_Player-Set(m_Player,PLAYER_LIST_CURRIDX,index,sizeof(int));//设置播放列表里的某个文件为当前播放文件 m_Player-Set(m_Player,PLAYER_PLAY,m_bPlayOrPaulse,sizeof(BOOL));//开始播放 } else return false; return true;
}
void CTCPMP_MyUIDlg::OnPlay()//播放/暂停 { if(m_Player) { m_bPlayOrPaulse !m_bPlayOrPaulse; m_Player-Set(m_Player,PLAYER_PLAY,m_bPlayOrPaulse,sizeof(BOOL)); } }
void CTCPMP_MyUIDlg::OnStop()//停止 { if(m_Player) m_Player-Set(m_Player,PLAYER_STOP,NULL,0);
}
BOOL CTCPMP_MyUIDlg::DestroyWindow()//程序退出 { if(m_Player) { Context_Wnd(NULL); Context_Done(); ::Sleep(200); } return CDialog::DestroyWindow(); }
CString CTCPMP_MyUIDlg::TickToStringZhang(int Tick) { if (Tick0) Tick -Tick; int Hour,Min,Sec; Hour Tick / 3600 / TICKSPERSEC;//获得小时 Tick - Hour * 3600 * TICKSPERSEC; Min Tick / 60 / TICKSPERSEC;//获得分钟 Tick - Min * 60 * TICKSPERSEC; Sec Tick / TICKSPERSEC;//获得秒钟 Tick - Sec * TICKSPERSEC; CString strTime; strTime.Format(_T(0%d:%d:%d),Hour,Min,Sec); if(Min10) strTime.Insert(3,0); if(Sec10) strTime.Insert(strTime.GetLength()-1,0); return strTime; }
LRESULT CTCPMP_MyUIDlg::PlayerEventMsg(WPARAM wParam, LPARAM 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_TrackPos29700) 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_TextOutStrTickToStringZhang(Time); m_TextOutStr_T(/); m_TextOutStrm_TotalTimeStr; //m_TextOutStr_T( ); //m_TextOutStrm_TitleNameStr; m_TextOutLable.SetWindowText(m_TextOutStr); } break; case PLAYER_PLAY: break; case PLAYER_TITLE: break; default: break; } return true;
} 呵呵请结合代码进行查看一切变的很简单