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: how to calculate cnsSampleTime

HTVi
TV Discussion Newsgroups

how to calculate cnsSampleTime
oan 11/21/2008 7:49:01 PM

How can I calculate cnsSampleTime for WriteStreamSample method using current
system time?
Re: how to calculate cnsSampleTime
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 11/21/2008 7:58:22 PM
From: "oan"

[Quoted Text]
> How can I calculate cnsSampleTime for WriteStreamSample
> method using current system time?

Unless your source is a constant rate live source,
cnsSampleTime is not related to the system time at all.
cnsSampleTime is the zer-based position of the sample in the
stream timeline. How to calculate the value depends on how
you produce the sample and how they are positioned in the
stream.

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


Re: how to calculate cnsSampleTime
oan 11/21/2008 8:30:01 PM
Thanks for the answer!

I have live stream and I am saving it using writestreamsample in
onstreamsample method. everything works fine when I use sampletime parameter
except the cases when the stream breaks and the reader is restarted. let
say, if i have a gap from 3:30 to 3:40 in the incoming stream, in saved
stream i should have the same 10 minutes gap. i wanted to set the sample time
according to the system time when the sample is written to solve this issue.
I didn't plan to use the system time as is, but some calculation based on it.

Thanks!


"Alessandro Angeli" wrote:

[Quoted Text]
> From: "oan"
>
> > How can I calculate cnsSampleTime for WriteStreamSample
> > method using current system time?
>
> Unless your source is a constant rate live source,
> cnsSampleTime is not related to the system time at all.
> cnsSampleTime is the zer-based position of the sample in the
> stream timeline. How to calculate the value depends on how
> you produce the sample and how they are positioned in the
> stream.
>
> --
> // Alessandro Angeli
> // MVP :: DirectShow / MediaFoundation
> // mvpnews at riseoftheants dot com
> // http://www.riseoftheants.com/mmx/faq.htm
>
>
>
Re: how to calculate cnsSampleTime
"Alessandro Angeli" <nobody[ at ]nowhere.in.the.net> 11/21/2008 8:50:41 PM
From: "oan"

[Quoted Text]
> I have live stream and I am saving it using
> writestreamsample in onstreamsample method. everything
> works fine when I use sampletime parameter except the
> cases when the stream breaks and the reader is restarted.
> let say, if i have a gap from 3:30 to 3:40 in the
> incoming stream, in saved stream i should have the same
> 10 minutes gap. i wanted to set the sample time according
> to the system time when the sample is written to solve
> this issue. I didn't plan to use the system time as is,
> but some calculation based on it.

Assuming that, when the reader restarts, the new sample
times restart from 0, simply add to them a costant offset
that is equals to the last timestamp before the break plus
the system time that elapsed from the break to the restart.
After the restart, you must also mark the first sample of
each stream with WM_SF_DISCONTINUITY. Hopefully that will
solve your problem.

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