How to control the TS output rate in BDA?

Hi??Tim??

Thanks for you on my last question.

what ??s the condition that I should to use the KS_INTERLACE_IsInterlaced in
KS_DATARANGE_VIDEO2?

I have another problem in BDA.

In the AVSream I can set the AvgTimePerFrame to control

the stream rate. But, How can I control the rate in BDA when the

stream is TS? Because I find that the Europe sample sets the AvgTimePerFrame
value is 0.

On Fri, Apr 25, 2008 at 02:11:37PM +0800, weilufei wrote:

Thanks for you on my last question.

what is the condition that I should to use the KS_INTERLACE_IsInterlaced in
KS_DATARANGE_VIDEO2?

Well, maybe *I* misunderstand what that bit is used for. I've always
assumed that would be used on an interlaced stream where the fields were
sent separately, but that doesn't make sense, given the name of the bit.
One can certainly understand an application wanting to know that the
frames it is getting USED to be part of an interlaced stream.

I guess I need to do more reading.

I have another problem in BDA.

In the AVSream I can set the AvgTimePerFrame to control

the stream rate. But, How can I control the rate in BDA when the
stream is TS? Because I find that the Europe sample sets the AvgTimePerFrame
value is 0.

A transport stream has the frame rate embedded in the data stream. You
don't specify it in the data ranges.

Tim Roberts, xxxxx@probo.com
Providenza & Boeklheide, Inc.

Thanks Tim,

But as I know that the TS has not an information about frame rate, the TS
frame rate just depend on the physical device output rate.

We are developing an usb dongle product and we select bulk endpoint for
transport. If set AvgTimePerFrame zero, how to control the data input rate?
And how to make sure that all TS data from device has been captured?

On Fri, Apr 25, 2008 at 02:11:37PM +0800, weilufei wrote:

Thanks for you on my last question.

what is the condition that I should to use the

KS_INTERLACE_IsInterlaced in KS_DATARANGE_VIDEO2?

Well, maybe *I* misunderstand what that bit is used for. I’ve always
assumed that would be used on an interlaced stream where the fields were
sent separately, but that doesn’t make sense, given the name of the bit.

One can certainly understand an application wanting to know that the frames
it is getting USED to be part of an interlaced stream.

I guess I need to do more reading.

I have another problem in BDA.

In the AVSream I can set the AvgTimePerFrame to control

the stream rate. But, How can I control the rate in BDA when the

stream is TS? Because I find that the Europe sample sets the

AvgTimePerFrame value is 0.

A transport stream has the frame rate embedded in the data stream. You
don’t specify it in the data ranges.

Tim Roberts, xxxxx@probo.com

Providenza & Boeklheide, Inc.

The preview pin for my capture filter supplies interlaced video; I use
KS_INTERLACE_IsInterlaced | KS_INTERLACE_1FieldPerSample to indicate
this. I also OR in KS_INTERLACE_FieldPatBothRegular, since I always
supply two (sequential) fields (although I have to say, it does not
appear that the renderer on my target machine pays any attention to this
flag).

Cheers,

–mkj

xxxxx@probo.com wrote:

On Fri, Apr 25, 2008 at 02:11:37PM +0800, weilufei wrote:
> Thanks for you on my last question.
>
> what is the condition that I should to use the KS_INTERLACE_IsInterlaced in
> KS_DATARANGE_VIDEO2?

Well, maybe *I* misunderstand what that bit is used for. I’ve always
assumed that would be used on an interlaced stream where the fields were
sent separately, but that doesn’t make sense, given the name of the bit.
One can certainly understand an application wanting to know that the
frames it is getting USED to be part of an interlaced stream.

I guess I need to do more reading.

> I have another problem in BDA.
>
> In the AVSream I can set the AvgTimePerFrame to control
>
> the stream rate. But, How can I control the rate in BDA when the
> stream is TS? Because I find that the Europe sample sets the AvgTimePerFrame
> value is 0.

A transport stream has the frame rate embedded in the data stream. You
don’t specify it in the data ranges.


//
// Michael K. Jones
// Stone Hill Consulting, LLC
// http://www.stonehill.com
//_______________________________________________

weilufei wrote:

Thanks Tim,

But as I know that the TS has not an information about frame rate, the
TS frame rate just depend on the physical device output rate.

That’s not right. A transport stream contains elementary streams, and
the header of an elementary stream tells you the frame rate. Each frame
then has an ordinal that tells where it is in the time stream… It’s
part of the MPEG standards.

You just ship the transport stream packets into the filter graph without
timestamps. The MPEG demux will extract the frames from the elementary
streams, and assign timestamps based on the header information. A
transport stream provider is just sending a stream, not a series of
timed frames.

We are developing an usb dongle product and we select bulk endpoint
for transport. If set AvgTimePerFrame zero, how to control the data
input rate?

Are you saying your external device has an adjustable frame rate? Client
apps will tell you the frame rate they want in the AvgTimePerFrame
field, and you can certainly use that value to configure your device.
Many MPEG hardware vendors simply implement their own private API for
setting this, since it is something that is rare changed.

And how to make sure that all TS data from device has been captured?

I don’t understand the question. A transport stream is a continuous
stream; it never stops. When the graph asks you to stop, you’ll stop
reading. Any partial packets in the graph at that point will be discarded.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.

I’m trying to develop a AVStream driver for an Analog/Digital TV USB device.
When Video Capture Pin’s state changes into KSSTATE_RUN, it will start the
stream’s iso transfer. First, in the stream iso transfer, it will submit two
irp/urb. In the complete routine of an IRP, the routine will resubmits the
urb. The data process will be done in complete routine (copy the stream data
to the pin’s queue). I copy two fields data to one frame buffer in the data
processing. Then advance the leading pointer. After some time delay, the
code will go to the capture pin’s process again, and then point the new
frame’s buffer.
After copying two fields data to one frame buffer, there are some data
behind that belong to the next frame have not been processed. How to deal
with these data?

we pass a IRP with a urb that include a buffer’s address to the USBD. The
buffer’s size just as the size of one field, so when the usb thansfer the
field data to the buffer, whether we can just get a field that the field’s
header mapping at the buffer’ s header. That means whether we can get a
complete field data when in one urb request. We don’t promise more or less
data than a field data.
If we can not get a complete field data, it means that we may get two fields
data
in a field data buffer.
So I don’t know how to deal with the data is this condition?

Re: [ntdev] How to control the TS output rate in BDA?

weilufei wrote:

Thanks Tim,

But as I know that the TS has not an information about frame rate, the
TS frame rate just depend on the physical device output rate.

That’s not right. A transport stream contains elementary streams, and
the header of an elementary stream tells you the frame rate. Each frame
then has an ordinal that tells where it is in the time stream… It’s
part of the MPEG standards.

You just ship the transport stream packets into the filter graph without
timestamps. The MPEG demux will extract the frames from the elementary
streams, and assign timestamps based on the header information. A
transport stream provider is just sending a stream, not a series of
timed frames.

We are developing an usb dongle product and we select bulk endpoint
for transport. If set AvgTimePerFrame zero, how to control the data
input rate?

Are you saying your external device has an adjustable frame rate? Client
apps will tell you the frame rate they want in the AvgTimePerFrame
field, and you can certainly use that value to configure your device.
Many MPEG hardware vendors simply implement their own private API for
setting this, since it is something that is rare changed.

And how to make sure that all TS data from device has been captured?

I don’t understand the question. A transport stream is a continuous
stream; it never stops. When the graph asks you to stop, you’ll stop
reading. Any partial packets in the graph at that point will be discarded.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.


NTDEV is sponsored by OSR

For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars

To unsubscribe, visit the List Server section of OSR Online at
http://www.osronline.com/page.cfm?name=ListServer

weilufei wrote:

I’m trying to develop a AVStream driver for an Analog/Digital TV USB device.
When Video Capture Pin’s state changes into KSSTATE_RUN, it will start the
stream’s iso transfer. First, in the stream iso transfer, it will submit two
irp/urb. In the complete routine of an IRP, the routine will resubmits the
urb. The data process will be done in complete routine (copy the stream data
to the pin’s queue). I copy two fields data to one frame buffer in the data
processing. Then advance the leading pointer. After some time delay, the
code will go to the capture pin’s process again, and then point the new
frame’s buffer.
After copying two fields data to one frame buffer, there are some data
behind that belong to the next frame have not been processed. How to deal
with these data?

we pass a IRP with a urb that include a buffer’s address to the USBD. The
buffer’s size just as the size of one field, so when the usb thansfer the
field data to the buffer, whether we can just get a field that the field’s
header mapping at the buffer’ s header. That means whether we can get a
complete field data when in one urb request. We don’t promise more or less
data than a field data.
If we can not get a complete field data, it means that we may get two fields
data in a field data buffer.
So I don’t know how to deal with the data is this condition?

So, these are uncompressed frames coming to you as fields? I thought
you said this was a transport stream.

If you have additional data after shipping off a frame, then just grab
the next cloned pointer from the leading edge and start copying. In
virtually every case, you will have at least 2 or 3 empty buffers
waiting to be filled. If you find that there are no more buffers, then
it seems you have little choice other than to drop the frame. Be sure
to note the discontinuity in the frame header.

Also remember that you can call KsPinAttemptProcessing yourself. You
don’t have to wait for the system to call it. You can’t force it to
generate new buffers, of course.


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.