Web Images Videos Maps News Shopping Gmail more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Message from discussion IAsyncReader implementation
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
 
Alessandro Angeli [MVP::DigitalMedia]  
View profile  
 More options Apr 5 2005, 6:28 am
Newsgroups: microsoft.public.win32.programmer.directx.video
From: "Alessandro Angeli [MVP::DigitalMedia]" <nob...@nowhere.in.the.net>
Date: Tue, 5 Apr 2005 12:28:04 +0200
Local: Tues, Apr 5 2005 6:28 am
Subject: Re: IAsyncReader implementation

Robin wrote:
> The problem on the microsoft example is, that it is using
> a lot of seperated classes mixed together, so to get an
> overview
> is not so easy.

> Now I have a first implementation of IAsyncSource based
> on the ideas of the mircosoft sample but I do not using
> their classes.
> Because I need no file access... and this is the problem
> now.

From the Async sample you only need 4 files: asyncio.cpp,
asyncio.h, asyncrdr.cpp, asyncrdr.h. The only modification
needed IIRC is to comment out #include "asyncflt.h" in
asyncrdr.cpp.

Derive your filter from CAsyncReader and its output pin from
CAsyncStream.

Add whatever initialization interface you like to the filter
(I used IFileSourceFilter, but a custom interface would be
ok, too).

Override the following methods on the pin: SetPointer(),
Read(), Size(), Alignment(), Lock(), Unlock(). The
Lock()/Unlock() pair can just execute a Lock()/Unlock() on a
private member CCritSec. The Alignment() can just return 1
(or whatever packet size your network protocol requires).
SetPointer(), Read(), Size() must be implemented according
to how your protocol works (SetPointer() and Size() may need
to return an error).

> Are their any resource available, how it's best to use
> IAsyncSource (pull mode) with network sources instead
> file sources?

> Because the most useful mpeg2 demultiplexers only
> support the pull interface.
> But I have no file access... I get a stream from network.

Pull-mode uses random access to the source stream where all
the stream is available at any moment while a network source
is usually a sequential stream where only the current
samples are available so it is not easy to write a pull-mode
source filter for a network source, hence your problems. You
need to do any needed buffering to simulate random access:
this what the URLReader does, to the extent that it fully
transfers a stream an buffers it to disk when a request is
made to read a part of the stream that it does not yet have.

--

// 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.

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