Click here to Skip to main content
15,878,748 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: c++ upd brodcast client Pin
arishri3-Dec-13 4:11
arishri3-Dec-13 4:11 
GeneralRe: c++ upd brodcast client Pin
jeron13-Dec-13 4:21
jeron13-Dec-13 4:21 
GeneralRe: c++ upd brodcast client Pin
arishri3-Dec-13 4:13
arishri3-Dec-13 4:13 
GeneralRe: c++ upd brodcast client Pin
jeron13-Dec-13 4:29
jeron13-Dec-13 4:29 
AnswerRe: c++ upd brodcast client Pin
Member 104421753-Dec-13 21:25
professionalMember 104421753-Dec-13 21:25 
Questionpointer to pointer Pin
messages2-Dec-13 7:13
messages2-Dec-13 7:13 
AnswerRe: pointer to pointer Pin
Joe Woodbury2-Dec-13 8:56
professionalJoe Woodbury2-Dec-13 8:56 
Question[SOLVED] Capture CAM using Media Foundation Pin
Django_Untaken2-Dec-13 5:27
Django_Untaken2-Dec-13 5:27 
Hello sound and video gurus. I am trying to capture my integrated web cam using Media Foundation APIs. I could not figure out the following couple of points.

1 - Difference between RAW video and uncompressed video
2 - Video format for RAW video (like PCM for RAW audio, MFVideoFormat_Base perhaps?)

I am using the following code to capture and store data onto my hard disk (a lot of code is ommited for clarity). I am saving on 100 samples but it stores 267+ hours of data. Here it is
C++
BOOL CMyClass::StartRecording()
{
  HRESULT hResult;
  dwActualStreamIndex = 0;

  m_bFirstSample = TRUE;
  m_llBaseTime = 0, m_llTimeStamp = 0;
	
  IMFSample* pSample = NULL;
  IMFMediaBuffer* pMediaBuffer = NULL;
  BYTE* pData = NULL;

  BOOL bResult = InitCamera();  // this code is ommited. just assume it is correct
  if(!bResult) return FALSE;

  hResult = m_pReader->ReadSample((DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &dwActualStreamIndex, &dwStreamsFlags, &m_llTimeStamp, &pSample);
  if(FAILED(hResult)) return FALSE;

  hResult = m_pReader->ReadSample((DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &dwActualStreamIndex, &dwStreamsFlags, &m_llTimeStamp, &pSample);
  if(FAILED(hResult)) return FALSE;

  // 100 samples contain 267+ hours of data ? something wrong with this loop
  for (DWORD i = 0; i < 100; ++i)
  {
	hResult = m_pWriter->WriteSample(0, pSample);
	if(FAILED(hResult)) return FALSE;

	unsigned int c=0;
	hResult=pSample->GetBufferCount((DWORD*)&c);
	if(FAILED(hResult))MessageBox(NULL, "err","get buffer count", MB_OK);
 
	IMFMediaBuffer* buffer=NULL;
	hResult=pSample->GetBufferByIndex(0,&buffer);
	if(FAILED(hResult))MessageBox(NULL, "err","GetBufferByIndex", MB_OK);
 
	unsigned int sz=0;
	hResult=buffer->GetCurrentLength((DWORD*)&sz);
	if(FAILED(hResult))MessageBox(NULL, "err","GetCurrentLength", MB_OK);
 
	unsigned char* data=NULL;
	unsigned int validSize=0;
	hResult=buffer->Lock((BYTE**)&data,NULL,(DWORD*)&validSize);
	if(FAILED(hResult))MessageBox(NULL, "err","Lock", MB_OK);
 
	hResult=buffer->Unlock();
	if(FAILED(hResult))MessageBox(NULL, "err","Unlock", MB_OK);

	hResult = m_pReader->ReadSample((DWORD)MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, &dwActualStreamIndex, &dwStreamsFlags, &m_llTimeStamp, &pSample);
	if(FAILED(hResult)) return FALSE;
  }

	return TRUE;	
}

Thanks for any pointers.

modified 9-Dec-13 7:57am.

QuestionHow to add the number to the shortcut in the desktop of the application. Pin
yu-jian2-Dec-13 3:32
yu-jian2-Dec-13 3:32 
QuestionRe: How to add the number to the shortcut in the desktop of the application. Pin
Richard MacCutchan2-Dec-13 5:14
mveRichard MacCutchan2-Dec-13 5:14 
QuestionRe: How to add the number to the shortcut in the desktop of the application. Pin
jeron12-Dec-13 5:40
jeron12-Dec-13 5:40 
AnswerRe: How to add the number to the shortcut in the desktop of the application. Pin
yu-jian2-Dec-13 5:55
yu-jian2-Dec-13 5:55 
QuestionRe: How to add the number to the shortcut in the desktop of the application. Pin
jeron12-Dec-13 6:06
jeron12-Dec-13 6:06 
AnswerRe: How to add the number to the shortcut in the desktop of the application. Pin
yu-jian2-Dec-13 6:19
yu-jian2-Dec-13 6:19 
GeneralRe: How to add the number to the shortcut in the desktop of the application. Pin
jeron12-Dec-13 6:46
jeron12-Dec-13 6:46 
Questionhow to get ip address of a host Pin
Member 104386231-Dec-13 21:26
Member 104386231-Dec-13 21:26 
QuestionRe: how to get ip address of a host Pin
Richard MacCutchan1-Dec-13 23:42
mveRichard MacCutchan1-Dec-13 23:42 
AnswerRe: how to get ip address of a host Pin
Member 104386232-Dec-13 0:04
Member 104386232-Dec-13 0:04 
GeneralRe: how to get ip address of a host Pin
Richard MacCutchan2-Dec-13 0:30
mveRichard MacCutchan2-Dec-13 0:30 
GeneralRe: how to get ip address of a host Pin
ahmad_ali2-Dec-13 22:54
ahmad_ali2-Dec-13 22:54 
GeneralRe: how to get ip address of a host Pin
Member 104386234-Dec-13 16:39
Member 104386234-Dec-13 16:39 
AnswerRe: how to get ip address of a host Pin
arishri3-Dec-13 3:48
arishri3-Dec-13 3:48 
QuestionVisual C++ 2008 mis-compiling Pin
Anthony Appleyard30-Nov-13 8:13
Anthony Appleyard30-Nov-13 8:13 
AnswerRe: Visual C++ 2008 mis-compiling Pin
Richard Andrew x6430-Nov-13 10:57
professionalRichard Andrew x6430-Nov-13 10:57 
GeneralRe: Visual C++ 2008 mis-compiling Pin
Anthony Appleyard30-Nov-13 11:38
Anthony Appleyard30-Nov-13 11:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.