|
Ok, sounds pretty nasty. So I think your two methods are
1) "Capture" filter creates an internal graph with sample grabber. When sample grabber provides sample, copy the data in the sample into the buffer your "capture" filter gets from its allocator and pass that sample along.
2) "Capture" filter creates an internal graph and connects the output pin of the last filter in the chain with the input pin being provided.
Never faced with something like this before, the first method is workable. I *think* the second one might work. I guess there is quite a bit of delegation of calls to other interfaces (Run(), Stop() etc from the filter to the internal graph manager or I think you can do it yourself by going through the filters upstream and calling Run() etc).
I guess one thing to be careful about is that all the filters have agreed on actual memory allocators that are allocating the sample buffers since you are connecting them up in such a manner.
DobosCake wrote: sometimes just didn't refresh the picture properly
This *could* be because the format that you are requesting off the sample grabber isn't the preferred format of the video renderer (which like YUV media types). Kind of a stab in the dark though. If you use GraphEdit do you see this as well? You might want to try with all the 3 different video renderers.
DobosCake wrote: Internally, I built a regular filter graph (using IGraphBuilder::RenderFile with the file you choose from the file dialog).
I tend to dislike breaking pins after they get connected as sometimes that filter could be buggy and might get stuck in a wrong state. I generally prefer to use IGraphBuilder::AddSourceFilter() to get the source filter, and then ICaptureGraphBuilder2::RenderStream() to string the filters up together. You could string up the SourceFilter -> SampleGrabber -> NullRenderer.
|
|
|
|
|
Thanks for your response.
hfry wrote:
1) "Capture" filter creates an internal graph with sample grabber. When sample grabber provides sample, copy the data in the sample into the buffer your "capture" filter gets from its allocator and pass that sample along.
So that's what I did, and it's working perfectly for quite a lot of files.
I also add the Color Space Converter filter right before the (removed) Video Renderer filter, because some applications want to change the media format.
I still have one problem though. For some files, I don't know exactly
when, but apparently when the format is changed, it breaks the pin of
the Sample Grabber. In SetFormat, I sometimes have to reconnect pins
myself because that's what the documentation says you have to do when you change the format of an already connected pin. I do that successfully, but somewhere afterwards (I'm not sure yet when...), by the time I get to FillBuffer(), something disconnects again.
I also tried to connect filters in GraphEdit the same way I do in my filter. For connection combination you see that the Sample Grabber disconnects and has to be reconnected again. I still don't get it...
Any advice?
|
|
|
|
|
|
kitty5 wrote: I wouldn't need to use new(), correct?
you would most certainly use new[] with an array that large. it's bad practice to put such a large array on the stack.
|
|
|
|
|
Chris Losinger wrote: you would most certainly use new[] with an array that large. it's bad practice to put such a large array on the stack.
if it's a double array would you do:
<br />
ULONG *buff;<br />
buff = new ULONG [1000][1000];<br />
do I access buff the same as an array?
i.e. buff[0][10] = 0x12345678;
Thanks!
Kitty5
|
|
|
|
|
kitty5 wrote: do I access buff the same as an array?
yes
|
|
|
|
|
The following code is intended to clear garbage from a fixed array of strings, however I am getting the following errors, the first of which (I think) is the most relevant:
SentenceAr.cpp(13): error C2440: '=' : cannot convert from 'const char [1]' to 'char'
SentenceAr.cpp(20): error C2144: syntax error : 'void' should be preceded by ')'
SentenceAr.cpp(20): error C2059: syntax error : ')'
SentenceAr.cpp(21): error C2143: syntax error : missing ';' before '{'
SentenceAr.cpp(23): error C2601: 'CSentenceAr::readFromFile' : local function definitions are illegal
SentenceAr.cpp (extract)
CSentenceAr::CSentenceAr(char strFileToRead[MAX_FILENAME_LENGTH + 1])
{
// Initialize strSentence
{ for (int iLineNumber = 1; iLineNumber <= MAX_LINES; iLineNumber++)
{
for (int iCharPos = 1; iCharPos <= MAX_SENTENCE_LENGTH; iCharPos++)
{strSentence[iLineNumber] [iCharPos] = "";}
}
readFromFile(strFileToRead);
}
...
SentenceAr.h
#define MAX_LINES 100
#define MAX_SENTENCE_LENGTH 1000
#define MAX_FILENAME_LENGTH 40
#define MAX_WORD_LENGTH 10
class CSentenceAr
{
public:
CSentenceAr(char strFileToRead[MAX_SENTENCE_LENGTH + 1]);
virtual ~CSentenceAr(void);
void sortSentences(bool bAscending); // implements BubbleSort
int HowManyWords(char strWord[MAX_WORD_LENGTH + 1]);
char strSentence [MAX_LINES + 1] [MAX_SENTENCE_LENGTH + 1];
private:
void readFromFile(char strFileToRead[MAX_SENTENCE_LENGTH + 1]);
};
SentenceAr.cpp (whole)
#include ".\SentenceAr.h"
#include <fstream>
using namespace std;
CSentenceAr::CSentenceAr(char strFileToRead[MAX_FILENAME_LENGTH + 1])
{
// Initialize strSentence
{ for (int iLineNumber = 1; iLineNumber <= MAX_LINES; iLineNumber++)
{
for (int iCharPos = 1; iCharPos <= MAX_SENTENCE_LENGTH; iCharPos++)
{strSentence[iLineNumber] [iCharPos] = "";}
}
readFromFile(strFileToRead);
}
CSentenceAr::~CSentenceAr(void)
{}
void CSentenceAr::readFromFile(char strFileToRead[MAX_FILENAME_LENGTH + 1])
{
char strLine[MAX_SENTENCE_LENGTH + 1];
short iLineNumber = 1;
fstream fileToRead(strFileToRead,ios::in);
while (!fileToRead.eof())
{ fileToRead.getline(strLine, MAX_SENTENCE_LENGTH);
// copy strLine to strSentence for each iLineNumber
for (int iCharPos = 1; iCharPos <= MAX_SENTENCE_LENGTH; iCharPos++)
{
strSentence[iLineNumber] [iCharPos] = strLine[iCharPos];
}
iLineNumber++;
}
}
}
Jon
|
|
|
|
|
My guess is that you need to do some reading on what C style strings are. Any good reason why you are not using std::vector and std::string?
Arrays start at index 0. Why do you allocate more memory just to get it to start at index 1? Just do strSentence[iLineNumber-1] when accessing your array.
for (int iLineNumber = 0; iLineNumber < MAX_LINES; iLineNumber++)
{
strSentence[iLineNumber][0] = '\0';
}
char strSentence[MAX_LINES][MAX_SENTENCE_LENGTH + 1];
Use strcpy instead. Code below is an idea of what strcpy is doing. This is why C style strings are refered to as NUL ('\0') terminated.
int iCharPos = 0;
while(strLine[iCharPos] != '\0')
{
strSentence[iLineNumber][iCharPos] = strLine[iCharPos];
iCharPos++;
}
strSentence[iLineNumber][iCharPos] = '\0';
-- modified at 10:28 Sunday 23rd July, 2006
|
|
|
|
|
how can i implement the NM_CUSTOMDRAW message for the default Toolbar for an MDI application (toolbar ID = IDR_MAINFRAME) ?
thanks in advance ..
k_dehairy
|
|
|
|
|
See Here[^] maybe it is some helpful to you
|
|
|
|
|
I already drived a class from the CToolBar and implemented the
ON_NOTIFY_REFLECT(NM_CUSTOMDRAW, OnCustomDraw)
within it, and it worked fine untill I implemented the xp theme manifest in the application!!
why is that? I don't know? .. I need help on that
thanks very much for your care .. really
k_dehairy
|
|
|
|
|
I see this problem when i use manifest in app (of course i use combobox derived)
|
|
|
|
|
Hi,
I am looking for an example of a CListCtrl derived class
which implements static columns. These are columns which
are excluded from a horizontal scroll, so it is possible
to scroll horizontal through a large list control, leaving
some important columns permanently in view. Can anybody help
me to a link or say how exactly it is done.
tia.
|
|
|
|
|
Did you see examples from Listctrl in codeproject
|
|
|
|
|
No, cann't find any examples.
|
|
|
|
|
|
I am trying to read a file and write its contents to a listbox control.
However, the listbox control variable is not recognized within the 'click' event of the button.
void CSentenceTestDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DISPLAY, m_Display); // m_Display is the control variable for the listbox
}
...
void CSentenceTestDlg::OnBnClickedTest()
{
//m_Display returns a synthax error when typed here!!
}
Jon
|
|
|
|
|
Can you be more specific ON_LBN_SELCHANGE(IDC_LIST2, OnLbnSelchangeList2) when you click
in a listbox you have a event ON_LBN_SELCHANGE now what do you need
|
|
|
|
|
How to get creation time of a contact in Outlook Express?
|
|
|
|
|
i need some projects in VC,related to sound processing
http://www.engineeringproject.net
|
|
|
|
|
You can search in codeproject and find your answer what do you need?
|
|
|
|
|
no have searched.
i need algorithm for pcm mixing
http://www.engineeringproject.net
|
|
|
|
|
Hi, I am a newbie to WinAPI. I have 2 projects in one workspace: 1 has a window handle, is there a way of accessing this window handle in the second project?
|
|
|
|
|
|