?? input.cpp
字號:
/**************************************************************************************
* *
* *
**************************************************************************************/
#include "Input.h"
MediaInput::MediaInput()
{
this->inputInternet = new MediaInputInternet();
this->inputFile = new MediaInputFile();
this->input = NULL;
}
MediaInput::~MediaInput()
{
delete this->inputFile;
delete this->inputInternet;
}
media_type_t MediaInput::GetType()
{
return MEDIA_TYPE_INPUT;
}
char *MediaInput::GetName()
{
if(this->input)
return this->input->GetName();
return "Input Wrapper";
}
MP_RESULT MediaInput::Connect(MediaItem *item)
{
return MP_RESULT_ERROR;
}
MP_RESULT MediaInput::ReleaseConnections()
{
return MP_RESULT_ERROR;
}
DWORD MediaInput::GetCaps()
{
if(this->input)
return this->input->GetCaps();
return 0;
}
MP_RESULT MediaInput::Configure(HINSTANCE hInstance, HWND hwnd)
{
return MP_RESULT_ERROR;
}
MP_RESULT MediaInput::Open(char *url, media_input_mode_t mode)
{
if(this->input != NULL)
return MP_RESULT_ERROR;
if(url != NULL) {
if(strstr(url, "http://") != NULL || strstr(url, "ftp://") != NULL ||
strstr(url, "HTTP://") != NULL || strstr(url, "FTP://") != NULL) {
if(this->inputInternet->Open(url, mode) != MP_RESULT_OK)
return MP_RESULT_ERROR;
this->input = this->inputInternet;
return MP_RESULT_OK;
}
else {
if(this->inputFile->Open(url, mode) != MP_RESULT_OK)
return MP_RESULT_ERROR;
this->input = this->inputFile;
return MP_RESULT_OK;
}
}
return MP_RESULT_ERROR;
}
long MediaInput::GetSize()
{
if(this->input != NULL)
return this->input->GetSize();
return MP_RESULT_ERROR;
}
long MediaInput::GetBufferSize()
{
if(this->input != NULL)
return this->input->GetBufferSize();
return MP_RESULT_ERROR;
}
long MediaInput::GetBufferPosition()
{
if(this->input != NULL)
return this->input->GetBufferPosition();
return MP_RESULT_ERROR;
}
long MediaInput::GetBufferingSize()
{
if(this->input != NULL)
return this->input->GetBufferingSize();
return MP_RESULT_ERROR;
}
unsigned int MediaInput::Read(MediaBuffer *mb, unsigned int size)
{
if(this->input != NULL)
return this->input->Read(mb, size);
return MP_RESULT_ERROR;
}
unsigned int MediaInput::Seek(int size, media_input_seek_t method)
{
if(this->input != NULL)
return this->input->Seek(size, method);
return MP_RESULT_ERROR;
}
unsigned int MediaInput::GetLine(MediaBuffer *mb)
{
if(this->input != NULL)
return this->input->GetLine(mb);
return 0;
}
BOOL MediaInput::EndOfFile()
{
if(this->input != NULL)
return this->input->EndOfFile();
return FALSE;
}
MP_RESULT MediaInput::Close()
{
if(this->input != NULL)
this->input->Close();
this->input = NULL;
return MP_RESULT_ERROR;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -