|
omg i think i found it :/
i have inside for 3 if
if (i ==0)
{}
if (i>0)
{}
if( i== (x-1))
{}
x-1 >0 so i had to put the 3rd if inside 2nd
i correct it and now my program works
1 whole week trying to fingure out. So i will have to watch about that false in the other 2 project
I think that's the problem I hope you agree with me David or i have to dive deeper !
|
|
|
|
|
Immunity18 wrote: I hope you agree with me David or i have to dive deeper !
I wouldn't know without stepping through it myself. After looking at your code, however, I did find several places that need attention.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
could you printscreen and mark them on paint ? and give me a link so i could look on that ?
|
|
|
|
|
hm and something else
when i debug how i move the for () loop?
i mean it so me variables for i = 0 how i make it to move and show me the variables for i = 1?
|
|
|
|
|
Immunity18 wrote: i mean it so me variables for i = 0 how i make it to move and show me the variables for i = 1?
F10 = step over
F11 = step into
Shift+F11 = step out
Ctrl+F10 = run to cursor
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
thanks
|
|
|
|
|
I wonder, how do I change the name of my main dialog window when my MFC program is running? (from the program itself)
I'm working on a Dialog based MFC application in vc6.0)
thanks!
//Johannes
|
|
|
|
|
Hi
You can use SetWindowText("New Title");
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Thanks Zainu!
That works perfectly!
//Johannes
|
|
|
|
|
Hi,
I am using the CPushSource Filter as a step to get my filter working, I have the Pushsource working nicely.
I have a camera that requires a callback in which it sends all the images to, I simply want to take this data and transfer it to the filter but I want to do it using a callback or any other method that is efficient.
Is there any way of doing this?
Thanks in advance
|
|
|
|
|
You should be able to add a callback function to your filter module just like you would anywhere
else.
If you aren't connecting to the camera within the filter, then you can add a method to your
filter class which returns the address of the callback. Once you obtain an interface to
the filter (when creating the graph) you can use that interface instance to call the
method.
I hope that make sense,
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks for the response, so when I get the callback in the filter, how does one trigger the FillBuffer routine that talks to the output pin, is there anyway to redirect the callback data to it?
|
|
|
|
|
The source pin is derived from CSourceStream so it has its own thread that is looping calling
FillBuffer().
The easiest solution based on the code you have would be to keep a copy of the current frame from
the camera (given to the filter through the callback) and every time your FillBuffer override
is called, copy the newest frame into the passed sample buffer and set the sample time.
The only real problem with this solution is 2 threads doing the job of one - a bit innefficient
especially with resources for the extra thread. The plus side to this solution is it's easiest
to code.
A more robust solution would be to do something closer to a capture filter. Using the existing
CSource/CSourceStream classes it's relatively easy to override a few methods to not use the
CAMThread base of CSourceStream. The CSourceStream::Active/CSourceStream::Inactive overrides
are where the thread creation/destruction occurs. CSourceStream::ThreadProc and
CSourceStream::DoBufferProcessingLoop are the methods relevant to the FillBuffer call so there
you'll find the necessary calls for obtaining/releasing sample buffers and making the delivery
calls. Those you'd want to do in your callback.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
Thanks for the response, so if I understood you correct, in my callback I do the following:
void callback(.... ) {
InActivate();
//copy the byte array to the proper pData
DoBufferProcessingLoop();
Activate();
}
Did I get that right?
|
|
|
|
|
DoBufferProcessingLoop() is already running so you definitely don't want to call it. It is
called by the threadproc, so it is running on the sample-push thread.
I was speaking of overriding Active() and Inactive(), and in the overrides, don't create the
thread at all. Then, in your callback, do the processing that DoBufferProcessingLoop() does
on each iteration of its loop - get a sample buffer from the allocator, fill the sample with
data, set the sample's time, and send it on downstream.
So, instead of using CSourceStream for your pin class, derive a class from CSourceStream and do
the overrides. Then you're essentially using the benifits of CSourceStream without the built-in
thread (CSourceStream is derived from CAMThread).
Take a look at the source code for CSourceStream in the DirectShow base classes and you'll see
what I'm referring to (I think it's source.cpp/.h).
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Mark,
I think I am understanding..., let me see if I have this right, so basically I override InActive and Active, I dont have to write anything in there. By overriding them they wont be able to trigger the thread to start and stop, so then in my callback I go in and pretty much do what the DoBufferProcessingLoop is doing and once I get IMediaSample *pSample I just populate it with the image data I have and we are ready to go?
Did I get that right?
Once again thanks
|
|
|
|
|
I have a class derived from CMultiDocTemplate and using constructor with parameters:
CMyTemplate::CMyTemplate(UINT nIDResource, CRuntimeClass* pDocClass,
CRuntimeClass* pFrameClass, CRuntimeClass* pViewClass)
: CMultiDocTemplate(nIDResource, pDocClass, pFrameClass, pViewClass)
{
.....
}
Now the VC++ 6.0 compiler complains that it needs a default constructor.
I have added one and now the linker complains:
Linking...
CMyTemplate.obj : error LNK2001: unresolved external symbol "public: __thiscall CMultiDocTemplate::CMultiDocTemplate(void)" (??0CMultiDocTemplate@@QAE@XZ)
Debug/0_IRA_GL_MFC.exe : fatal error LNK1120: 1 unresolved externals
The linker cannot find the base class default constructor?
What am I missing?
Thanks for you help.
Vaclav
|
|
|
|
|
It seems the problem is in your creation of an object of type CMyTemplate, not in the class
definition itself.
The DocTemplate classes don't have default constructors - they are meant to be created with
parameters.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi
How did you create your object ?
This could help you,
class Base
{
public:
Base(int k)
{
value = k;
}
private :
int value;
};
class Derived:public Base
{
public:
Derived(int k):Base(k)
{
}
private:
char s;
};
int main(int argc, char* argv[])
{
Derived object(10); // and not Derived object; This will give those
return 0; //errors as you mentioned.
}
Regards
The Best Religion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Thanks for your replies.
I am not sure what I did wrong but after deleting the default constructor it compiles and links without errors. I think my object instantiation was wrong. Unfortunately I did not have VSS running at this time so I cannot backtrack my code. Sorry.
Thanks again.
Vaclav
|
|
|
|
|
I need to receive in matrix, the image data of a USB camera. Is there some built in VC++ function or some API/SDK for this purpose.
Regards
|
|
|
|
|
Check this article, it may be a good starting point.
http://www.codeproject.com/audio/avicapwrp.asp
|
|
|
|
|
|
My program is going to either save, or have access to notepad edited text files that I can rely on to be in a certain format, N rows of header info (in CSV format mainly), and then rows of data. I could include a "datarows=" field in, but think I'd prefer a more elegant way to be able to read past the header (I'll worry about that later), but then be able to just read in a line from the file, check if it's data, and do something with it, but if it's an empty line or end of file, to stop
Not sure how to correctly process .getline properly on my fstream object to do that even though it seems obvious I want
assume file checked for existence
read in (use/dont use) N lines of header
while(some return condition that isn't end of file)
{
get a line - put in CString?
process the line
make sure it was valid data, or end the reading
}
A nudge in the right direction would be appreciated
|
|
|
|
|
ldsdbomber wrote: Not sure how to correctly process .getline properly on my fstream object to do that even though it seems obvious I want
One possibility:
ifstream in("");
string strLine;
while (getline(in, strLine))
{
} For a more complete, and C++, solution, see here and here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|