views:

30

answers:

2

Hello

I couldn't find a suitable renderer class in BaseClasses that has 2 input pins - one for video and one for audio. Can anybody recommend/provide some code?

Regards Dominik

A: 

Hi Dominik,

The CBaseRenderer class is a base class for implementing renderer filters. It only supports one input pin though.

I've never encountered a renderer class that handles both audio and video, they're always rendered via separate renderer filters.

The VMR9 renderer (CLSID_VideoMixingRenderer9) is great for rendering video, while the DirectSound Renderer (CLSID_DSoundRender) is used for rendering audio.

Are you maybe trying to get both streams written to disk in a media file? Then you'll need a mux filter that understands both media types. Since I don't know what media types you're using, I could recommend you might have a look at the AVI Mux filter, which does such a job.

I hope that this points you in the right direction ;)

freefallr
Hello. Thanks for answer. I'm aiming at implementing audio/video renderer that does H264 encoding and RTP streaming of encoded video stream.
dominolog
The x264 encoder filter will encode video for you in H.264 format, and you can encode audio via several audio filters available. I'd recommend writing a filter for transport. You should base this filter on the CBaseFilter base class and define two input pins - one for audio, and one for video. Its job is to receive media samples, and transport them over the network to the client.
freefallr
+1  A: 

Alternatively you can add sample grabber filters to your media pipeline after your video and audio encoders and packetize the media and deliver the RTP packets in the sample grabber callbacks. The sample grabbers can be connected to the NULL renderer. That way you can avoid writing a filter and focus on the network transport.

Also, you should consider if you even want to mux the streams: usually in RTP video and audio are delivered in separate RTP sessions. If you still want to write a filter with multiple input pins, you can have a look at some baseclasses I wrote for a video mixer available at http://sourceforge.net/projects/videoprocessing/ as a starting point.

Ralf
Hi Ralf, An interesting alternative to writing a custom renderer filter. According to the RTP standard, different media samples are transported via different UDP streams. But that means you need to open two ports on your customers' firewall, which they don't like. There's no penalty incurred by using one UDP session.
freefallr
Hi freefallr, that's the approach I used in our streaming system. It's nice since you can focus purely on the networking. I agree with you though, firewall and NAT traversal are a real problem, but the RTP RFC states in section 5.2: "Separate audio and video streams SHOULD NOT be carried in a single RTP session and demultiplexed based on the payload type or SSRC fields." Also, AFAIK some firewalls block UDP traffic completely, which is why we decided to stream RTP over TCP.
Ralf