djp
djp

Reputation: 646

my YUY2 output does not work with Video Renderer filter

I have a basic avstream driver (based on the avshws sample).

When testing the YUY2 output I get different results based on which renderer I use:

I dont know why the basic video renderer (used by amcap) wont work. I have examined the graph of a webcam outputting the same format and I cannot see any difference apart from the renderer output.

Upvotes: 0

Views: 507

Answers (2)

djp
djp

Reputation: 646

I have figured out the problem. I was missing one line to update the remaining bytes in the stream pointer structure:

Leading->OffsetOut.Remaining = 0;

This caused certain filters to drop my samples (AVI/MJPEG Decompressor, Dump) which meant that certain graph configurations would simply not render anything.

Upvotes: 0

persiflage
persiflage

Reputation: 1204

I'm assuming you're writing your own filter based on avshws. I'm not familiar with this particular sample but generally you need to ensure two things:

  • Make sure your filter checks any media types proposed are acceptable. In the DirectShow baseclasses the video renderer calls the output pin IPin::QueryAccept which calls whichever base class member you're using e.g. CBasePin.CheckMediaType or CTransformFilter.CheckTransform
  • Make sure you call IMediaSample::GetMediaType on every output sample and respond appropriately e.g. calling CTransformFilter.SetMediaType and changing the format/stride of your output. It's too late to negotiate at this point - you've accepted the change already and if you really can't continue you have to abort streaming, return an error HRESULT and notify EC_ERRORABORT or EC_ERRORABORTEX. Unless it's buggy the downstream filter should have called your output pin's QueryAccept and received S_OK before it sends a sample with a media type change attached (I've seen occasional filters that add duplicate media types to the first sample without asking).

See Handling Format Changes from the Video Renderer

Upvotes: 1

Related Questions