media player 插件问题,在线等,有结果立即给分
请问开发media player 插件能否达到播放自定义格式的视频文件或者其他媒体文件,如SWF,WMPSDK中定义的插件为Custom Visualizations,Interface Plug-ins,DSP Plug-ins,Rendering Plug-ins,其中Rendering Plug-ins能否达到上述功能吗?media player 中的插件是否只有上述4种,那datasource plug-ins是什么?
[解决办法]
lz 什么意思? 你要做media player插件么? 你是要让media player能够播放其他格式的音视频么?
如果是这样 你可以做一个decoder filter 和parser filter 然后把这两个filter注册到media 下面就可以用了
[解决办法]
1.定义格式扩展名,让media player认识
2.写一个source filter,并注册
3.定义解码filter
示例代码:
char m_szFileExt = {"mp2"};
HKEY hKey, hSubKey, hSubSubKey, hSub3Key;
DWORD dwDisposition;
LONG lreturn = -1;
m_StaticInfo += "Regist file: ";
m_StaticInfo += m_szFileExt;
CheckReturn(RegCreateKeyEx(HKEY_CLASSES_ROOT, m_szFileExt, 0,
TEXT(""), 0, 0, 0, &hKey, &dwDisposition));
CheckReturn(RegSetValueEx(hKey, TEXT(""), 0L, REG_SZ,
(CONST BYTE *)m_szFileType,
sizeof(TCHAR) * (_tcslen(m_szFileType)+1) ));
CheckReturn(RegCloseKey( hKey ));
CheckReturn(RegCreateKeyEx(HKEY_CLASSES_ROOT, m_szFileType, 0,
TEXT(""), 0, 0, 0, &hKey, &dwDisposition));
CheckReturn(RegCreateKeyEx(hKey, TEXT("Shell"), 0,
TEXT(""), 0, 0, 0, &hSubKey, &dwDisposition));
CheckReturn(RegCreateKeyEx(hSubKey, TEXT("Open"), 0,
TEXT(""), 0, 0, 0, &hSubSubKey, &dwDisposition));
CheckReturn(RegCreateKeyEx(hSubSubKey, TEXT("Command"), 0,
TEXT(""), 0, 0, 0, &hSub3Key, &dwDisposition));
CheckReturn(RegSetValueEx(hSub3Key, TEXT(""), 0L, REG_SZ,
(CONST BYTE *)m_szWMP,
sizeof(TCHAR) * (_tcslen(m_szWMP)+1) ));
CheckReturn(RegCloseKey( hSub3Key ));
CheckReturn(RegCloseKey( hSubSubKey ));
CheckReturn(RegCloseKey( hSubKey ));
CheckReturn(RegCloseKey( hKey ));
CheckReturn(RegOpenKeyEx(HKEY_CLASSES_ROOT, TEXT("Media Type"), 0, 0, &hKey));
CheckReturn(RegCreateKeyEx(hKey, TEXT("Extensions"), 0,
TEXT(""), 0, 0, 0, &hSubKey, &dwDisposition));
CheckReturn(RegCloseKey( hKey ));
hKey = hSubKey;
CheckReturn(RegCreateKeyEx(hKey, m_szFileExt, 0,
TEXT(""), 0, 0, 0, &hSubKey, &dwDisposition));
CheckReturn(RegSetValueEx(hSubKey, TEXT("Source Filter"), 0L, REG_SZ,
(CONST BYTE *)m_szSourceFilter, sizeof(TCHAR) * (_tcslen(m_szSourceFilter)+1)));
CheckReturn(RegSetValueEx(hSubKey, TEXT("Media Type"), 0L, REG_SZ,
(CONST BYTE *)m_SZMediaType, sizeof(TCHAR) * (_tcslen(m_SZMediaType)+1)));
CheckReturn(RegSetValueEx(hSubKey, TEXT("Subtype"), 0L, REG_SZ,
(CONST BYTE *)m_szSubtype, sizeof(TCHAR) * (_tcslen(m_szSubtype)+1)));
CheckReturn(RegCloseKey( hKey ));
CheckReturn(RegCloseKey( hSubKey ));
HRESULT hr = RegOpenKeyEx(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Microsoft\\Multimedia\\CEPlayer\\Extensions"), 0, 0, &hKey);
if(hr == S_OK)
{
CheckReturn(RegCreateKeyEx(hKey, m_szFileExt, 0,
TEXT(""), 0, 0, 0, &hSubKey, &dwDisposition));
DWORD dwValue = 7;
CheckReturn(RegSetValueEx(hSubKey, TEXT("Runtime"), 0L, REG_DWORD,
(CONST BYTE *)&dwValue, sizeof dwValue ));
dwValue = 9;
CheckReturn(RegSetValueEx(hSubKey, TEXT("Permissions"), 0L, REG_DWORD,
(CONST BYTE *)&dwValue, sizeof dwValue ));
CheckReturn(RegCloseKey( hKey ));
CheckReturn(RegCloseKey( hSubKey ));
}