Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Source filter which receives MPEG2 Program Stream via network

5 views
Skip to first unread message

theLittleFunnyBoy

unread,
Nov 6, 2009, 12:51:03 PM11/6/09
to

Hi,

I am currently writing a source filter which suppose to receive a MPEG2
Program Stream (via UDP) and more or less just forward it to the demux /
splitter.

I don't have any problems with the filter programing itself but with how to
fill the buffer. I tried to just copy the received packets to the media
samples, but the demux filter won't create any output pins. So that means,
the data is messed up or some information is missing, which I have to add to
the samples.

Some details:
- Majortype is MEDIATYPE_Stream
- Subtype is MEDIASUBTYPE_MPEG2_PROGRAM
- Formattype is GUID_NULL
- cbFormat set to 0
- Sample size is set to 1
- Buffers is set to 1
- Buffersize is set to 200000 (Any special size for MPEG2-PS?)

I actually took those settings from using the Microsoft File Reader (URL)
Filter (infos through GraphEdit). The same procedure, also MPEG2-PS, just via
HTTP. Works fine!
So that's why I thought I wouldn't have to care about the actual content of
the program stream and just deliver the received data to the samples and push
them right to the demux.

So, can anyone help me here? I'm kinda confused and overwhelmed :-)

Thank you very much!

Alessandro Angeli

unread,
Nov 6, 2009, 4:13:09 PM11/6/09
to
From: "theLittleFunnyBoy"

> I actually took those settings from using the Microsoft
> File Reader (URL) Filter (infos through GraphEdit). The
> same procedure, also MPEG2-PS, just via HTTP. Works fine!
> So that's why I thought I wouldn't have to care about the
> actual content of the program stream and just deliver the
> received data to the samples and push them right to the
> demux.

1. Did you derive your filter from the BaseClasses? If yes,
which one?

2. What splitter are you using? Windows does not include an
MPEG-2 PS splittet that works in push mode (the URLReader is
an async reader that works in pull mode, not a push source).


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// mvpnews at riseoftheants dot com
// http://www.riseoftheants.com/mmx/faq.htm


georgec

unread,
Nov 6, 2009, 4:22:14 PM11/6/09
to


Your source filter has to create the pins on the demux and you will
probably need something to map the PIDs, similar to the Transport
Information Filter (TIF) used for transport streams. You could try
manually creating some output pins and mapping the appropriate PIDs in
graphedit.

theLittleFunnyBoy

unread,
Nov 12, 2009, 10:56:01 AM11/12/09
to
Yes, I'm using the BaseClasses (CSourceStream, CSource).

Why does the Demux care about where and how I get the data? As long as
transfer the samples, that shouldn't matter or does it?

So, a simple information that a ps media type will be passed won't be enough
for the demux? I actually have to tell that filter, what pin to create or
even create the pin on that filter myself?

I discovered something else, with a udp client I wrote (winsock). The client
just receives the data and writes it into a file. The file can be read, the
elementary streams are there, but the picture is pretty noisy (green blocks /
corrupted packs). Is it possible that I have to setup the socket a specific
way when receiving a stream?

currently:
mySocket = socket(AF_INET, SOCK_DGRAM, 0);


"George C" wrote:

> .
>

georgec

unread,
Nov 12, 2009, 12:02:11 PM11/12/09
to

>Yes, I'm using the BaseClasses (CSourceStream, CSource).
>
>Why does the Demux care about where and how I get the data? As long as
>transfer the samples, that shouldn't matter or does it?
>
>So, a simple information that a ps media type will be passed won't be enough
>for the demux? I actually have to tell that filter, what pin to create or
>even create the pin on that filter myself?
>
>I discovered something else, with a udp client I wrote (winsock). The client
>just receives the data and writes it into a file. The file can be read, the
>elementary streams are there, but the picture is pretty noisy (green blocks /
>corrupted packs). Is it possible that I have to setup the socket a specific
>way when receiving a stream?
>
>currently:
>mySocket = socket(AF_INET, SOCK_DGRAM, 0);
>
>

Looks like it depends on the mode, push or pull, as to who creates the
pins. Look at:
http://msdn.microsoft.com/en-us/library/dd390723(VS.85).aspx


Alessandro Angeli

unread,
Nov 12, 2009, 1:41:48 PM11/12/09
to
From: "theLittleFunnyBoy"

> Yes, I'm using the BaseClasses (CSourceStream, CSource).
>
> Why does the Demux care about where and how I get the
> data? As long as transfer the samples, that shouldn't
> matter or does it?

With the stock demux, it matters HOW you pass the sample
(push or pull).

CSource is a push source, so the demux expects a TS not a
PS.

> I discovered something else, with a udp client I wrote
> (winsock). The client just receives the data and writes
> it into a file. The file can be read, the elementary
> streams are there, but the picture is pretty noisy (green
> blocks / corrupted packs). Is it possible that I have to
> setup the socket a specific way when receiving a stream?

Those are typical artifacts caused by errors in the
bitstream. Probably you are either loosing packets (UDP is
not a reliable transfer) or receiving them in the wrong
order (UDP is not sequential) or having network errors (UDP
does not correct them) or saving too many or too few bytes.

0 new messages