Re: How to play audio and video from two different sources



Hi Alessandro (sorry I have switched "nome e cognome"... I'm the italian guy
you helped a month ago in my post "Help regarding writing a Source Filter").

Thanks for the info, I saw the statement with IMediaSample::SetTime(). Now I
have the info for proceeding writing the second pin for the audio.

Ciao

Dev


"Alessandro Angeli [MVP::DS/MF]" <nobody@xxxxxxxxxxxxxxxxxx> wrote in
message news:#4m9jubTGHA.4600@xxxxxxxxxxxxxxxxxxxxxxx
DevX wrote:

Hi Angelo,

I don't know who Angelo is, but hi to you to :-)

How I set the timestamp on the samples? My samples are
only a bunch of bytes representing a YUV buffer or a WAV
sample, there is some form of DirectShow pre-processing I
must do? Currently the only timing facilities I have on
my filter are the same found on the BouncingBall, in the
Notify() function were I set the repeat time of the
frame.

If you copied CBallStream::FillBuffer(), then you are
calling IMediaSample::SetTime() to set the sample's
timestamp. The stop time is not really needed, but the start
time is important: as long as you set the correct start time
to each audio and video sample, the renderers will keep the
streams in sync.

How to calculate the start times depends on how you produce
the data, but usually the start time starts at 0
(CBallStream::OnThreadCreate()) and for each sample S,
start_time[S] = start_time[S-1] + duration[S].

With video, duration[S] is usually a known value
(VIDEOINFOHEADER::AvgTimePerFrame), if the frame rate is
constant.

With PCM audio, duration_in_secs = 8 * buffer_size /
wBitsPerSample / nChannels / nSamplesPerSec or
duration_in_secs = buffer_size / nAvgBytesPerSec (since, for
PCM audio, nAvgBytesPerSec = wBitsPerSample * nChannels *
nSamplesPerSec / 8).

Thanks a lot for the help and the patience.

You're welcome.


--
// Alessandro Angeli
// MVP :: DirectShow / MediaFoundation
// a dot angeli at psynet dot net




.



Relevant Pages

  • Re: OT:For Howard
    ... world of audio. ... I also did not need to make a living ... I, however, do make a living while writing. ... your belief about freezing wires. ...
    (rec.audio.opinion)
  • Re: Lets Invent a Word
    ... nospam@xxxxxxxxxx (Don Pearce) wrote: ... They do in the context of the subject of the writing. ... treatise, they have mathematical meaning. ... about audio the symbols would not automatically be assumed to be ...
    (rec.audio.pro)
  • Re: Anthony Cordesman
    ... I liked his writing in Absolute ... I wonder if he's still into home audio. ... of, if not THE, bests analysts in Washington covering the ... Cordesman is a fine intellect and analyst. ...
    (rec.audio.opinion)
  • Re: Lets Invent a Word
    ... nospam@xxxxxxxxxx (Don Pearce) wrote: ... I'm getting tired of writing "24-bit audio at 96 kHz sample rate" and ...
    (rec.audio.pro)
  • help with dvd logo
    ... audio" logos in it. ... Alessandro ... Prev by Date: ...
    (rec.video.desktop)