Click here to Skip to main content
15,566,615 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: c++ upd brodcast client Pin
arishri3-Dec-13 5:11
arishri3-Dec-13 5:11 
GeneralRe: c++ upd brodcast client Pin
jeron13-Dec-13 5:21
jeron13-Dec-13 5:21 
GeneralRe: c++ upd brodcast client Pin
arishri3-Dec-13 5:13
arishri3-Dec-13 5:13 
GeneralRe: c++ upd brodcast client Pin
jeron13-Dec-13 5:29
jeron13-Dec-13 5:29 
AnswerRe: c++ upd brodcast client Pin
Member 104421753-Dec-13 22:25
professionalMember 104421753-Dec-13 22:25 
Questionpointer to pointer Pin
messages2-Dec-13 8:13
messages2-Dec-13 8:13 
AnswerRe: pointer to pointer Pin
Joe Woodbury2-Dec-13 9:56
professionalJoe Woodbury2-Dec-13 9:56 
Question[SOLVED] Capture CAM using Media Foundation Pin
Django_Untaken2-Dec-13 6:27
Django_Untaken2-Dec-13 6: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 4:32
yu-jian2-Dec-13 4:32 
QuestionRe: How to add the number to the shortcut in the desktop of the application. Pin
Richard MacCutchan2-Dec-13 6:14
mveRichard MacCutchan2-Dec-13 6:14 
QuestionRe: How to add the number to the shortcut in the desktop of the application. Pin
jeron12-Dec-13 6:40
jeron12-Dec-13 6:40 
AnswerRe: How to add the number to the shortcut in the desktop of the application. Pin
yu-jian2-Dec-13 6:55
yu-jian2-Dec-13 6:55 
QuestionRe: How to add the number to the shortcut in the desktop of the application. Pin
jeron12-Dec-13 7:06
jeron12-Dec-13 7:06 
AnswerRe: How to add the number to the shortcut in the desktop of the application. Pin
yu-jian2-Dec-13 7:19
yu-jian2-Dec-13 7:19 
GeneralRe: How to add the number to the shortcut in the desktop of the application. Pin
jeron12-Dec-13 7:46
jeron12-Dec-13 7:46 
Questionhow to get ip address of a host Pin
Member 104386231-Dec-13 22:26
Member 104386231-Dec-13 22:26 
QuestionRe: how to get ip address of a host Pin
Richard MacCutchan2-Dec-13 0:42
mveRichard MacCutchan2-Dec-13 0:42 
AnswerRe: how to get ip address of a host Pin
Member 104386232-Dec-13 1:04
Member 104386232-Dec-13 1:04 
GeneralRe: how to get ip address of a host Pin
Richard MacCutchan2-Dec-13 1:30
mveRichard MacCutchan2-Dec-13 1:30 
GeneralRe: how to get ip address of a host Pin
ahmad_ali2-Dec-13 23:54
ahmad_ali2-Dec-13 23:54 
GeneralRe: how to get ip address of a host Pin
Member 104386234-Dec-13 17:39
Member 104386234-Dec-13 17:39 
AnswerRe: how to get ip address of a host Pin
arishri3-Dec-13 4:48
arishri3-Dec-13 4:48 
QuestionVisual C++ 2008 mis-compiling Pin
Anthony Appleyard30-Nov-13 9:13
Anthony Appleyard30-Nov-13 9:13 
AnswerRe: Visual C++ 2008 mis-compiling Pin
Richard Andrew x6430-Nov-13 11:57
professionalRichard Andrew x6430-Nov-13 11:57 
GeneralRe: Visual C++ 2008 mis-compiling Pin
Anthony Appleyard30-Nov-13 12:38
Anthony Appleyard30-Nov-13 12: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.