Werbung: SecurityConsole.de verwaltet Ihre Computer mit Security Essentails aus der Cloud!
30 Tage kostenfrei testen und 20% Rabatt für Ihre Bestellung mit Promocode: WBF2685582
(Promocode gültig bis 31.12.2011)

Group:  English: Entertainment » microsoft.public.windowsmedia.sdk
Thread: Windows Media Services plugin

HTVi
TV Discussion Newsgroups

Windows Media Services plugin
David Eu 11/9/2008 9:33:00 AM
Hi, I need to write a C++ plugin for WMS that will grab the stream from a
publishing point, parse the stream and save portions of it to file(s).

Essentially I want to achieve the same result as the WMS Archive Data Writer
but be able to control the archiving by saving desired portions of the stream
and making them available while the publishing point is active.

I've been looking at the sample SDK plugin sources and the MS docs but do
not see how to do this. Can anyone kindly point me in the right direction?

Thanks in advance!

Dave
Re: Windows Media Services plugin
"Vladimir Polischuk" <vlad_at_voynex.com> 11/10/2008 4:01:23 PM
Why not to use WMS Archive Data Writer for that? Just start and stop
archiving when you need.

Regards,
Vladimir V. Polischuk
IT Manager
www.voynex.com - custom software development, solutions for Windows Media
(pay-per-minute billing, streaming content protection, access control)


"David Eu" <DavidEu[ at ]discussions.microsoft.com> wrote in message
news:D1553F67-19C9-4D73-9BF6-36CD04DBDED0[ at ]microsoft.com...
[Quoted Text]
> Hi, I need to write a C++ plugin for WMS that will grab the stream from a
> publishing point, parse the stream and save portions of it to file(s).
>
> Essentially I want to achieve the same result as the WMS Archive Data
> Writer
> but be able to control the archiving by saving desired portions of the
> stream
> and making them available while the publishing point is active.
>
> I've been looking at the sample SDK plugin sources and the MS docs but do
> not see how to do this. Can anyone kindly point me in the right direction?
>
> Thanks in advance!
>
> Dave


Re: Windows Media Services plugin
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 11/10/2008 4:20:37 PM
From: "David Eu"

[Quoted Text]
> Hi, I need to write a C++ plugin for WMS that will grab
> the stream from a publishing point, parse the stream and
> save portions of it to file(s).
>
> Essentially I want to achieve the same result as the WMS
> Archive Data Writer but be able to control the archiving
> by saving desired portions of the stream and making them
> available while the publishing point is active.
>
> I've been looking at the sample SDK plugin sources and
> the MS docs but do not see how to do this. Can anyone
> kindly point me in the right direction?

You need to use the WMReader and WMWriter object in the
WindowsMediaFormat runtime (see the WMF SDK, which is now
also part of the Windows SDK), both configured to work in
compressed mode. See the WMVCopy sample in the WMF SDK and
Q21 in my FAQ for sample code. You can also use the
WMASFReader and WMASFWriter filters in DirectShow (which are
DirectShow wrapper for the WMF objects).



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


Re: Windows Media Services plugin
David Eu 11/11/2008 7:34:05 AM
Thanks very much for both of your responses. I greatly appreciate your time.

Allesandro, when I ran your sample Q21 I got the following error:
OnStatus(1, 0x0000000). It happens on the WaitEvent(EReaderEvent, ...) call
after opening the src reader in the main func. I don't know what I might be
doing wrong. My call looked like: WmvSlipWriter myfile.asf outfile asf 0 1
Perhaps you can point out my usage error?

The WMVCopy sample looks like what I need except it processes a file.
I was wondering how I could do the following:

In Windows Media Services I have a publishing point (could be a live stream
being pulled from Windows Media Encoder). The publishing point is
broadcasting an MMS stream.

So how can I get that MMS stream into something like WMVCopy or WmvSlipWriter?
Also I think MMS has to be parsed differently than ASF but not sure how this
is done.

Any ideas?

Thanks so much again!


"Alessandro Angeli" wrote:

[Quoted Text]
> From: "David Eu"
>
> > Hi, I need to write a C++ plugin for WMS that will grab
> > the stream from a publishing point, parse the stream and
> > save portions of it to file(s).
> >
> > Essentially I want to achieve the same result as the WMS
> > Archive Data Writer but be able to control the archiving
> > by saving desired portions of the stream and making them
> > available while the publishing point is active.
> >
> > I've been looking at the sample SDK plugin sources and
> > the MS docs but do not see how to do this. Can anyone
> > kindly point me in the right direction?
>
> You need to use the WMReader and WMWriter object in the
> WindowsMediaFormat runtime (see the WMF SDK, which is now
> also part of the Windows SDK), both configured to work in
> compressed mode. See the WMVCopy sample in the WMF SDK and
> Q21 in my FAQ for sample code. You can also use the
> WMASFReader and WMASFWriter filters in DirectShow (which are
> DirectShow wrapper for the WMF objects).
>
>
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> // http://www.riseoftheants.com/mmx/faq.htm
>
>
>
Re: Windows Media Services plugin
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 11/11/2008 9:35:12 AM
From: "David Eu"

[Quoted Text]
> Allesandro, when I ran your sample Q21 I got the
> following error:
[...]

I'll look into it and let you know.

[...]
> So how can I get that MMS stream into something like
> WMVCopy or WmvSlipWriter? Also I think MMS has to be
> parsed differently than ASF but not sure how this is done.

ASF is a file format, MMS is a transport protocol (which
happens to transport ASF streams). Both WMVCopy and my code
use the same technique, which works with whatever transport
protocol (local file, network file, MMS, HTTP, RTSP...) and
file format (ASF, MP3) the WMReader supports:
IWMReader::Open() accepts a URI, which can be a file path or
a URL. So, simply use a URL instead of a path.

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


Re: Windows Media Services plugin
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 11/11/2008 5:52:10 PM
From: "David Eu"

[Quoted Text]
> Allesandro, when I ran your sample Q21 I got the
> following error:
> OnStatus(1, 0x0000000). It happens on the
> WaitEvent(EReaderEvent, ...) call after opening the src
> reader in the main func. I don't know what I might be
> doing wrong. My call looked like: WmvSlipWriter
> myfile.asf outfile asf 0 1 Perhaps you can point out my
> usage error?

That message is just for information, it is not an error
(the hex number is a HRESULT, which means S_OK). If you
thought it was an error because the program appears to hang
after that, there was a bug that was masked out by the
debugger. I fixed it now, so you should download the updated
code.

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


Re: Windows Media Services plugin
David Eu 11/25/2008 11:03:02 PM
Thanks again Alessandro for providing that example.
The hang problem seems to be resolved.

I ran your program on a stream and when I play back the resulting split
files the video freezes up at the beginning of the files (excluding the first
file) and the audio data is missing at the end of each file.
If the split file sequence is F1 F2 F3 F4 etc it seems that video samples
from F1 get saved in F2, video from F2 gets saved in F3, etc.
Looking at the sample traces it looks like you need to split on video key
frames rather than just arbitrary key frames - what's happening is that you
mostly wind up splitting on audio keyframes and video key frames often come a
couple of seconds after the start of the split files.

I also tried using wmvappend on some of the split files produced by
WmvSlipWriter (e.g. appending F1 and F2) and you get frame freezing where
the splitting was done, the audio also gets very garbled.

Any insights on how to properly split the stream cleanly so that no freezing
occurs and also wmvappend will be able to glue them back together again
seamlessly?

I have been testing various modifications to WmvSlipWriter to split only on
video keyframes and have been able to get better results but there always
seems to be some slight gaps introduced when re-gluing the same file sequence
F1 F2 F3 etc with wmvappend.

Another question: I read in the MSDN docs that on streams the reader will
mark the first stream sample with WM_SF_DISCONTINUITY. This would mean that
each
file F1, F2, F3, etc starts with a discontinuity flag. I was wondering if
this could cause a problem with wmvappend as that flag then appears in the
output file where each original split was made. Could this be an issue? If
so, how can I eliminate the WM_SF_DISCONTINUITY flag? Turning it off in the
call to WriteStreamSample() does not seem to help.

Thanks!


"Alessandro Angeli" wrote:

[Quoted Text]
> From: "David Eu"
>
> > Allesandro, when I ran your sample Q21 I got the
> > following error:
> > OnStatus(1, 0x0000000). It happens on the
> > WaitEvent(EReaderEvent, ...) call after opening the src
> > reader in the main func. I don't know what I might be
> > doing wrong. My call looked like: WmvSlipWriter
> > myfile.asf outfile asf 0 1 Perhaps you can point out my
> > usage error?
>
> That message is just for information, it is not an error
> (the hex number is a HRESULT, which means S_OK). If you
> thought it was an error because the program appears to hang
> after that, there was a bug that was masked out by the
> debugger. I fixed it now, so you should download the updated
> code.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> // http://www.riseoftheants.com/mmx/faq.htm
>
>
>
Re: Windows Media Services plugin
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 12/2/2008 10:50:17 PM
From: "David Eu"

[Quoted Text]
> I ran your program on a stream and when I play back the
> resulting split files the video freezes up at the
> beginning of the files (excluding the first file) and the

I made a dumb mistake with the timestamps. You may want to
try the fixed version I just uploaded.

> audio data is missing at the end of each file.

That is by design. The code is format-agnostic, so it splits
whenever it has a chance, which means most likely on an
audio frame, so that you will end up with:

V: ... 3 4 5 6 7 || # # # 8 9...
A: ... 3 4 # # # || 5 6 7 8 9...

No data is lost. Anyway, I added an additional condition to
split on a master stream, which defaults to the first video
stream, if present.

> Any insights on how to properly split the stream cleanly
> so that no freezing occurs and also wmvappend will be
> able to glue them back together again seamlessly?

With the corrected timestamps, there should be no freezing.

> Another question: I read in the MSDN docs that on streams
> the reader will mark the first stream sample with
> WM_SF_DISCONTINUITY. This would mean that each
> file F1, F2, F3, etc starts with a discontinuity flag. I
> was wondering if this could cause a problem with
> wmvappend as that flag then appears in the output file
> where each original split was made. Could this be an
> issue? If so, how can I eliminate the WM_SF_DISCONTINUITY
> flag? Turning it off in the call to WriteStreamSample()
> does not seem to help.

WMVAppend already takes care of the WM_SF_DISCONTINUITY. In
any case, a WM_SF_DISCONTINUITY on a sample that is also a
WM_SF_CLEANPOINT (which is the case with my splitter) has no
effect.

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



Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net
Suche nach Orten, Städten, Postleitzahlen, Vorwahlen, Kfz-Kennzeichen