Click here to Skip to main content
15,891,136 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Cann't Show Picture using RGB Data Pin
Richard MacCutchan30-Dec-13 22:57
mveRichard MacCutchan30-Dec-13 22:57 
AnswerRe: Cann't Show Picture using RGB Data Pin
Django_Untaken31-Dec-13 0:24
Django_Untaken31-Dec-13 0:24 
GeneralRe: Cann't Show Picture using RGB Data Pin
Jochen Arndt31-Dec-13 3:48
professionalJochen Arndt31-Dec-13 3:48 
AnswerRe: Cann't Show Picture using RGB Data Pin
Django_Untaken31-Dec-13 5:56
Django_Untaken31-Dec-13 5:56 
GeneralRe: Cann't Show Picture using RGB Data Pin
Jochen Arndt31-Dec-13 6:12
professionalJochen Arndt31-Dec-13 6:12 
GeneralRe: Cann't Show Picture using RGB Data Pin
Django_Untaken31-Dec-13 18:33
Django_Untaken31-Dec-13 18:33 
GeneralRe: Cann't Show Picture using RGB Data Pin
Jochen Arndt31-Dec-13 23:50
professionalJochen Arndt31-Dec-13 23:50 
GeneralRe: Cann't Show Picture using RGB Data Pin
Django_Untaken1-Jan-14 1:59
Django_Untaken1-Jan-14 1:59 
Jochen Arndt wrote:
How did you checked that?

Let me write a small pseudo code for this operation, though the code is very long.
HRESULT hResult = OpenMediaSource(); // opens the MediaSource
hResult = EnumerateStream(); // enumerates the stream using presentaion desc and stream desc
hResult = ConfigureDecoder(); // configures the IMFSourceReader
hResult = SetDeviceFormat(); // set the format
hResult = ConfigureEncoder(); // configures the IMFSinkWriter

Now I am setting frame size on IMFSourceReader in ConfigureDecoder(). Then I get IMFMediaType of IMFSourceReader in ConfigureEncoder() and set it using IMFSinkWriter::SetInputMediaType(). I also use IMFMediaType->GetUINT32(MFVideoInterlaceMode, ...) within ConfigureEncoder (among other things), which returns MFVideoInterlace_Progressive.

In short, IMFSinkWriter has the same type as the IMFSourceReader. Here is how I capture the video and save it in a .bin file
IMFSample* pSample = NULL;
IMFMediaBuffer* pBuffer = NULL;

HRESULT hResult = pReader->ReadSample(); // opens stream in first call
hResult = pReader->ReadSample(); // read first sample

while(nTotalSamples <= 360) // capturing 360 samples
{
   pSample->SetSampleTime(llTimeStamp);
   pWriter->WriteSample(0, pSample);

   pSample->GetBufferByIndex(0, &pBuffer);
   pBuffer->GetCurrentLength(&dwLength); // here I get 614400

   pBuffer->Lock(&pData, NULL, &dwSize);  // again, I get 614400
   pBuffer->Unlock();

   pReader->ReadSample();

   nTotalSamples++; 
}

Hopefully I was able to make it clear.
GeneralRe: Cann't Show Picture using RGB Data Pin
Jochen Arndt1-Jan-14 2:30
professionalJochen Arndt1-Jan-14 2:30 
GeneralRe: Cann't Show Picture using RGB Data Pin
Django_Untaken1-Jan-14 5:08
Django_Untaken1-Jan-14 5:08 
QuestionClose Child Common Dialog Pin
john563230-Dec-13 18:21
john563230-Dec-13 18:21 
QuestionRe: Close Child Common Dialog Pin
Richard MacCutchan30-Dec-13 22:55
mveRichard MacCutchan30-Dec-13 22:55 
Questionhow to fix the error of the set and get function in my program? Pin
Member 1049499430-Dec-13 5:16
Member 1049499430-Dec-13 5:16 
AnswerRe: how to fix the error of the set and get function in my program? Pin
Thong LeTrung30-Dec-13 5:27
Thong LeTrung30-Dec-13 5:27 
AnswerRe: how to fix the error of the set and get function in my program? Pin
Albert Holguin30-Dec-13 5:28
professionalAlbert Holguin30-Dec-13 5:28 
QuestionHow to convert a visual c++ project to a dll project file? Pin
Adewumi Adedeji29-Dec-13 23:51
Adewumi Adedeji29-Dec-13 23:51 
AnswerRe: How to convert a visual c++ project to a dll project file? Pin
Richard MacCutchan30-Dec-13 0:44
mveRichard MacCutchan30-Dec-13 0:44 
QuestionOverlapped serial comunication Pin
Palmitoxico29-Dec-13 11:55
Palmitoxico29-Dec-13 11:55 
AnswerRe: Overlapped serial comunication Pin
Richard MacCutchan29-Dec-13 22:52
mveRichard MacCutchan29-Dec-13 22:52 
GeneralRe: Overlapped serial comunication Pin
Palmitoxico30-Dec-13 8:09
Palmitoxico30-Dec-13 8:09 
AnswerRe: Overlapped serial comunication Pin
Richard Andrew x6430-Dec-13 9:26
professionalRichard Andrew x6430-Dec-13 9:26 
GeneralRe: Overlapped serial comunication Pin
Palmitoxico31-Dec-13 2:32
Palmitoxico31-Dec-13 2:32 
Questionhow to initialize array of variable length? Pin
Le@rner27-Dec-13 21:18
Le@rner27-Dec-13 21:18 
AnswerRe: how to initialize array of variable length? Pin
Randor 27-Dec-13 21:36
professional Randor 27-Dec-13 21:36 
GeneralRe: how to initialize array of variable length? Pin
Le@rner20-Jan-14 21:26
Le@rner20-Jan-14 21:26 

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.