|
What do you need to do with the output - does it need to be rendered? Is there a video stream
as well as the audio stream?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I don't need to render the output, I just need to analyze it and write the results to another file. Yes, the input media file contains video as well as audio.
Claudiu
|
|
|
|
|
By using pGraph->Render(), you're getting the default renderers, right? In your current code,
does the audio play when you run the graph?
I'm thinking if you use the NULL Renderer filter on the outputs of the grabber and the AVI
Splitter (instead of the default renderers) then maybe the graph will run as fast as possible
with the sync source set to NULL.
I thought the audio renderer was determining the flow rate of samples through the graph, which is
why setting the sync source to NULL has no effect. If the AVI splitter is pushing samples at the
real-time rate, then you'd probably need a custom grabber filter.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Exactly, the audio gets played when I run the graph.
Can you please show me where to insert those filters in the graph? To make a test and see if it's working ?
Claudiu
|
|
|
|
|
After you connect the source filter to the grabber filter, there will be some splitter filter(s)
inserted in between by the graph builder. To get an idea of exactly which filter(s) are inserted
use GRAPHEDIT.EXE - Add a file source (async) filter, set it's input filename in the dialog,
add a grabber filter, and connect the output of the source to the input of the grabber. You'll
then see the inserted filter(s).
So after you connect the source filter to the grabber filter, You can traverse the partial graph
(as described here[^]) starting from the grabber's input pin. Unless an intermediate decoder filter
was needed for the audio stream, the next filter upstream should be a splitter filter (it may
be AVI, MPEG-1, or other depending on the file format). It should be the first filter you find
that has unconnected output pins (see Find an Unconnected Pin on a Filter[^]). For each of the
unconnected output pins, create a NULL renderer filter and connect its input pin to the
unconnected output pin.
Create another NULL Renderer filter and connect it to the grabber filter's output pin.
The graph should be complete at this point. You don't need to call pGraph->Render().
You'll still want to call SetSyncSource on the graph builder's IMediaFilter interface to set
the sync source to NULL.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I managed to create the NULL Renderer and insert it into the graph and it works !
The samples are received as I would expected.
Here's the modifications I made:
CComPtr<IBaseFilter> nullRenderer;
hr = nullRenderer.CoCreateInstance(CLSID_NullRenderer);
hr = pGraph->AddFilter(nullRenderer, L"NULL renderer");
CComPtr <IPin> nullGrabInPin = GetInPin(nullRenderer, 0);
CComPtr <IPin> pGrabOutPin = GetOutPin(pGrabberBase, 0);
pGraph->Connect(pGrabOutPin, nullGrabInPin);
Thanks so much for your help !
Now I have to find somewhere the format of the data received on BufferCB for audio PCM and I'm all done.
Claudiu
|
|
|
|
|
Claudiu Bucur wrote: Now I have to find somewhere the format of the data received on BufferCB for audio PCM
Maybe pGrabPin->ConnectionMediaType()
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
helloo guys..okie iam creating acode that can draw different shapes(lines, squar,..etc)thats done then save their info in text file ..(like the start point ,end point,..etc)..thats cool too ; BUTT the problem is its writting the last thing i draw ..(if i draw line then squar ..it writes squar twice)
// save the file
string str_Line;
System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
StreamWriter streamWriter=new StreamWriter(fs);
if(drawwhat==1)
{
for(int j=0;j less than arraylist_points.Count;j++)
streamWriter.WriteLine("Line");
start=(Point)arraylist_points[j];
end=(Point)arraylist_points[j+1];
str_Line=start.ToString()+end.ToString();
streamWriter.WriteLine(str_Line);
j++;
}
}
else if(drawwhat==2)
{
for(int j=0;j {
streamWriter.WriteLine("squar");
start=(Point)arraylist_points[j];
end=(Point)arraylist_points[j+1];
str_Line=start.ToString()+end.ToString();
streamWriter.WriteLine(str_Line);
j++;
}
}
streamWriter.Flush();
streamWriter.Close();
fs.Close();
}
//plzz brothers iam stuck !
|
|
|
|
|
I can't see where anything would be written twice, unless you have something in your
arraylist_points array twice..
How do you separate the start and end points when you read them in since they've been
concatenated?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
heloo my friend..okie my for loop like that :
for (int j=0; j < arraylist_points.Count; j++){...}
so lets say i draw squar then line ..it will be saved in text file as..:
Line
{X=83,Y=58}{X=257,Y=172}
Line
{X=165,Y=55}{X=71,Y=251}
its should write squar then line..not line twice..!!
|
|
|
|
|
Cool but the code you posted doesn't show anything except looping through an existing array.
If DrawWhat==1 it writes a bunch of lines (in a loop)
If DrawWhat==2 it writes a bunch of squares (in a loop)
If you want them written in a different order than that you'll need to code it that way
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
mr jets wrote: for(int j=0;j {
Check 'Ignore HTML tags in this message' to make your code render properly.
Have you stepped through the code ? Have you made sure the last item isn't actually in the list twice ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
mr jets wrote: BUTT the problem is its writting the last thing i draw
As I tell my team. When faced with a bug/issue you cannot explain, start verifying your assumptions. Step through the code with a debugger, generate a smaller sample to easily step through. If the bug is consistant, then you can reduce it to 2 or 3 shapes and still get the extra item, so single step through inspecting values. Debugging isn't magic, its just research into how the computer is dealing with your code, and finding where what you told it is inconsistant with what it is doing.
If you don't have a debugger, message boxes, print displays and other items have been an age-old custom to watching computer activity as it happens.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Hi, i am writing a small app which renders OpenGL to a frame inside a window. I want it to be rendered every time an event occurs such as creating a new file (which would reset the view). However, i also want to render in frames per second when it is enabled. In this case, a timer causes an event every, say, 100ms. Now, that event causes a render function to be called which copies the OpenGL screen to a texture, warps it, and renders it back. Every time any other event occurs, all that needs to be done is to draw the warped image.
So, how do i use SwapBuffers(HDC) twice, once in each render function, but so that the image does not flicker.
Download here[^] and get my WMP visualization here[^]. Run the program before you try to compile, because if Dev-Cpp can't compile it will delete the exe.
Customer in computer shop: "Can you copy the Internet onto this disk for me?"
|
|
|
|
|
don't copy the buffer, render straight to texture so that you can warp it to your heart's content.
http://www.paulsprojects.net/opengl/rtotex/rtotex.html[^]
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
I'm not sure if you know what i mean. Did you download my files? Look at the effect in my Visualization, that is the kind of effect i want.
Here is a pic: http://img519.imageshack.us/my.php?image=viz1kx4.png
Do you mean for me to render directly to a texture, then display that? How exactly would i do that?
btw, your link is broken
Customer in computer shop: "Can you copy the Internet onto this disk for me?"
|
|
|
|
|
VizCoder wrote: Do you mean for me to render directly to a texture, then display that? How exactly would i do that?
Yes, that is exactly what I mean. Using pbuffers and render to texture you no longer have to render to a screen (double buffered or not) and then copy back the image. You can render directly to a pbuffer which allows you to copy the image directly to memory on your computer, or you can render directly to texture memory which can then be used for rendering as a texture on another object, all in the same scene.
Also you can achieve the same process by manually controlling bufferswap so that you never see it. This is how it was done before pbuffers and render to texture calls:
render(sceneA);
glFlush();
glCopyPixels();
glClear(GL_COLOR_BUFFER_BIT|GL_DEPTH_BUFFER_BIT);
createyourtexture();
render(sceneB);
swapbuffers();
the problem with this style is that it broke the rendering cycle several times 1) with the glFlush() 2) with the read-back cycle of glCopyPixels() and 3) with the texture binding procedures.
VizCoder wrote: btw, your link is broken
It still works for me.... so just google "render to texture"
VizCoder wrote: Did you download my files?
Advice is free, debugging your code takes a lot more time. Sorry, maybe someone else will.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
El Corazon wrote: Advice is free, debugging your code takes a lot more time. Sorry, maybe someone else will.
that's ok, i can't expect everyone to go searching through my code finding bugs. I just wanted you to see my viz to get an idea of what i want to do.
As for your solution, i don't really know much about OpenGL so i might read a few tutorials before attempting anything like that
Customer in computer shop: "Can you copy the Internet onto this disk for me?"
|
|
|
|
|
Well, i have taken the leap to using pbuffers. I really have no idea about OpenGL let alone pbuffers so i am just picking things up as i go along. I got some code of the internet which uses pbuffers but i can't get it to work. There were 3 ways of doing it, i did the second one since my hardware doesn't support the 3rd way (see here[^], "Off-screen Rendering Using Pixel Buffers" Version #2).
I was wondering if i need a certain version(?) of wglext.h since they included one in the download and i didn't have one before so i just copied that.
I keep getting errors when trying to switch contexts between rendering to the pbuffer and rendering to the screen, i,e wglMakeCurrent() fails.
Any ideas, just of the top of your head since i can't post my whole code. Could it be the way i'm doing it or is it my hardware? (The example exe from the site worked but i didn't compile)
Customer in computer shop: "Can you copy the Internet onto this disk for me?"
|
|
|
|
|
Hi,
I agree with previous posts. I will take a lot of time to download your files, compile them, run them... even if the resulting images are quite cool. I come here once in a while to give some advice if I think they can be usefull, but I have my own project and many other things to ocupy my time.
So I would like to invite you to state what your problem is. In other words, what it is that is happening that is not as you expected? I think this is a good starting point for me to try to help.
Anyway, I suspect that SwapBuffers() 2 times results in not swapping at all. At least with double buffering. So I don't know why you would want that.
I have the feeling you would want something like:
1. WaitEvent()
2. TakePrimaryBufferAndCopyItToTexture()
3. WarpItAsNecessary()
4. DrawToSecondaryBuffer()
5. SwapBuffersOnceToMakeSecondaryBecomePrimary()
6. goto 1.
Is this not what you want?
I hope this helps,
Rilhas
|
|
|
|
|
hello guys..my program is about drawing some shapes like (lines ,polygons..etc)my nightmare is after drawing the shapes i wanna to save them as atext file which contains the (start point , end point , color ,..etc)
iam using V.S 2003...i will apprecaite any help .
Regards ;
|
|
|
|
|
hi,
i would recommend that you create a separate class to hold all the fields that you need such as points and colors etc. and every time you draw any shape, you would need to save the things you need in memory. then when you click save(or whatever) you can write the contents of the array to the file.
you can use an arraylist to store the objects that you create, or any array structure that you are comfortable with.
hope this helps.
regards
|
|
|
|
|
yah thats cool my bro..i have already used an arraylist and thats was my best :
// save the file
string str_Line;
System.IO.FileStream fs = new System.IO.FileStream("c:\\graphics.txt", System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.Write, System.IO.FileShare.ReadWrite);
StreamWriter streamWriter=new StreamWriter(fs);
if(drawwhat==1)
{
for(int j=0;j
|
|
|
|
|
hi,
from the code above i see that you are storing the points in the array list, but this is not a good way to store data because you don't know that kind of shape it is i.e. is it a line, a circle, a rectangle... what?
therefore, i recommmend you to store objects of the shape class that you can create for each shape you draw and store that object in the arraylist.
if you do this, you can set the type of shape that it represents just by setting a simple flag - some enum value. so, when you save the data, you will be saving the class objects and not points. when you retrieve the data, you will retrieve the class objects.
this will enable you to distinguish what type of shape it is and enable you to draw accordingly.
hope this helps.
regards
|
|
|
|
|
You have been asking the same questions for some time now. Realistically, the best way to do this is to create a class for each shape you want to draw, with a common base class, and make a list of that base class. Then you can make the class know how to build itself from the string you store in your file, and to generate a string which identifies the shape type and the details of that shape.
I'd go for something less verbose, you really only need to store numbers, just assign each shape type a number.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|