Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
single-instance filter
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
haipt  
View profile  
 More options Dec 9 2004, 9:46 pm
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "haipt" <h...@eyepowergames.com>
Date: Fri, 10 Dec 2004 10:46:54 +0800
Local: Thurs, Dec 9 2004 9:46 pm
Subject: single-instance filter
Hi all,

I'm trying to do a single-instance filter, which would be able to access
some common global data across different applications which instantiate it.
Could anyone advise me on the architecture to achieve that?
For example, now I want my "Bouncing Ball" to run exactly the same (i.e the
ball at the same position) when I run it in Graph Edit and in my application
simultaneously.

I've tried modifying the CreateInstance() inside the BouncingBall, so that
it becomes a singleton design, but that only works when I open two
BouncingBall in GraphEdit (i.e. from the same app). The moment I open it in
my app it would create and return another instance of Bouncing Ball.

Thanks a lot for your suggestion.
Hai.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alessandro Angeli [MVP::DigitalMedia]  
View profile  
 More options Dec 9 2004, 10:56 pm
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net>
Date: Fri, 10 Dec 2004 04:56:56 +0100
Local: Thurs, Dec 9 2004 10:56 pm
Subject: Re: single-instance filter

This is not really a DirectShow question. Anyway...

You need to use a shared memory buffer and a pair of named
global mutex and event for synchronization. It's up to how
to generate the data and synchronized the processes.

You can create the mutex and event objects using
CreateMutex() and CreateEvent() and giving them a name
(better use unique names, e.g. string that contain some
GUID, like your own CLSID).

You can create a shared memory buffer using the
memory-mapped file APIs (CreateFileMapping(); again, better
choose a unique name) or enclosing the external buffer
declaration in a data_seg() #pragma directive (which
actually instructs the compiler to create a memory-mapped
file for you):

#pragma data_seg("shared")
BYTE buffer[1024];
#pragma data_seg()

and then telling the linker to make this segment shared
(/SECTION:shared,RWS).

Maybe the MFC class CSharedFile is another way to create a
memory-mapped file.

--

// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
haipt  
View profile  
 More options Dec 9 2004, 11:13 pm
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "haipt" <h...@eyepowergames.com>
Date: Fri, 10 Dec 2004 12:13:00 +0800
Subject: Re: single-instance filter
"Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net> wrote in
message news:OPbtMxm3EHA.3336@TK2MSFTNGP11.phx.gbl...

Oh, this's very informative. I'll look into it immediately. Thanks a lot for
your answer Allesandro.

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
The March Hare [MVP]  
View profile  
 More options Dec 10 2004, 12:34 am
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "The March Hare [MVP]" <p...@ndsm.maps>
Date: Thu, 9 Dec 2004 22:34:10 -0700
Local: Fri, Dec 10 2004 12:34 am
Subject: Re: single-instance filter

On Fri, 10 Dec 2004 12:13:00 +0800, haipt wrote:

<snip>

> your answer Allesandro.

Alessandro: still better than Alessandra <g>

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alessandro Angeli [MVP::DigitalMedia]  
View profile  
 More options Dec 10 2004, 7:50 am
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net>
Date: Fri, 10 Dec 2004 13:50:30 +0100
Local: Fri, Dec 10 2004 7:50 am
Subject: Re: single-instance filter
The March Hare [MVP] wrote:

> On Fri, 10 Dec 2004 12:13:00 +0800, haipt wrote:

> <snip>
>> your answer Allesandro.

> Alessandro: still better than Alessandra <g>

I always told my mother "Alessandro" was too long a name and
she should have chosen a shorter and simpler one :-))

--

// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
haipt  
View profile  
 More options Dec 12 2004, 8:44 pm
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "haipt" <h...@eyepowergames.com>
Date: Mon, 13 Dec 2004 09:44:16 +0800
Local: Sun, Dec 12 2004 8:44 pm
Subject: Re: single-instance filter

"Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net> wrote in
message news:uKbGGdr3EHA.4028@TK2MSFTNGP15.phx.gbl...

I'm sorry to misspell your name, Alessandro (a careful programmer should
never misspell anything actually :) ). Anyway, your suggested method works
really well in my case. Initially i declared like this:
#pragma data_seg("SHARED")
char buf[1000];
#pragma data_seg()
#pragma comment(linker, "/section:SHARED,RWS")
(i'm using VC.NET 2003)

Then the two processes did see the same buf's global address, but somehow
whenever one updated it, the other could not see the update.
After a good few hour tracing the problem, i realized that it's due to my
buf's not initialized. So I changed it to char buf[1000]="", and from there
on it works perfectly for me. I've got no explanation except the guess that
it's due to some linker's internal decision.

So thanks again, Alessandro.
Hai.


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alessandro Angeli [MVP::DigitalMedia]  
View profile  
 More options Dec 12 2004, 11:51 pm
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net>
Date: Mon, 13 Dec 2004 05:51:43 +0100
Local: Sun, Dec 12 2004 11:51 pm
Subject: Re: single-instance filter

haipt wrote:
> After a good few hour tracing the problem, i realized
> that it's due to my buf's not initialized. So I changed
> it to char buf[1000]="", and from there on it works
> perfectly for me. I've got no explanation except the
> guess that it's due to some linker's internal decision.

I don't think that's the case: when you declare an array
pointer but you do not initialize it, you're only reserving
space for the pointer while, when you initialize it, you are
reserving space for the array but not the pointer. In the
first case, your processes were sharing the pointer's memory
location but not the actual buffers which were allocated
outside shared memory unless you did some memory-mapped file
"magic" of you own. This scenario was also dangerous because
one process would end up using the other's pointer value
which was not necessarily a valid pointer in its own memory
space.

> So thanks again, Alessandro.

You're welcome :-)

--

// Alessandro Angeli
// MVP :: Digital Media
// a dot angeli at psynet dot net


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google