Beispiel #1
0
static int get_receiver_output_fmt(MSFilter *f, void *arg) {
	ReceiverData *d = (ReceiverData *) f->data;
	MSPinFormat *pinFmt = (MSPinFormat *)arg;
	PayloadType *pt = rtp_profile_get_payload(rtp_session_get_profile(d->session), rtp_session_get_send_payload_type(d->session));
	pinFmt->fmt = ms_factory_get_audio_format(f->factory, pt->mime_type, pt->clock_rate, pt->channels, NULL);
	return 0;
}
Beispiel #2
0
static void _create_decoders(MSMediaPlayer *obj) {
	int sample_rate, nchannels;
	switch(obj->format) {
	case FILE_FORMAT_WAVE:
		ms_filter_call_method(obj->player, MS_FILTER_GET_SAMPLE_RATE, &sample_rate);
		ms_filter_call_method(obj->player, MS_FILTER_GET_NCHANNELS, &nchannels);
		obj->audio_pin_fmt.pin = 0;
		obj->audio_pin_fmt.fmt = ms_factory_get_audio_format(ms_factory_get_fallback(), "pcm", sample_rate, nchannels, NULL);
		break;
	case FILE_FORMAT_MATROSKA:
		obj->audio_pin_fmt.pin = 1;
		obj->video_pin_fmt.pin = 0;
		ms_filter_call_method(obj->player, MS_FILTER_GET_OUTPUT_FMT, &obj->audio_pin_fmt);
		ms_filter_call_method(obj->player, MS_FILTER_GET_OUTPUT_FMT, &obj->video_pin_fmt);
		if(obj->audio_pin_fmt.fmt) {
			obj->audio_decoder = ms_factory_create_decoder(ms_factory_get_fallback(), obj->audio_pin_fmt.fmt->encoding);
			if(obj->audio_decoder == NULL) {
				ms_error("Could not create audio decoder for %s", obj->audio_pin_fmt.fmt->encoding);
				obj->audio_pin_fmt.fmt = NULL;
			}
			sample_rate = obj->audio_pin_fmt.fmt->rate;
			nchannels = obj->audio_pin_fmt.fmt->nchannels;
			ms_filter_call_method(obj->audio_decoder, MS_FILTER_SET_SAMPLE_RATE, &sample_rate);
			ms_filter_call_method(obj->audio_decoder, MS_FILTER_SET_NCHANNELS, &nchannels);
		}
		if(obj->video_pin_fmt.fmt) {
			obj->video_decoder = ms_factory_create_decoder(ms_factory_get_fallback(), obj->video_pin_fmt.fmt->encoding);
			if(obj->video_decoder == NULL) {
				ms_error("Could not create video decoder for %s", obj->video_pin_fmt.fmt->encoding);
				obj->video_pin_fmt.fmt = NULL;
			}
		}
		break;
	default:
		break;
	}
}
Beispiel #3
0
static int rec_get_fmtp(MSFilter *f, void *arg){
	RecState *d=(RecState*)f->data;
	MSPinFormat *pinfmt = (MSPinFormat*)arg;
	if (pinfmt->pin == 0) pinfmt->fmt = ms_factory_get_audio_format(f->factory, d->mime, d->rate, d->nchannels, NULL);
	return 0;
}