Commit 15387edf authored by Simon Morlat's avatar Simon Morlat

fix video bugs

parent d9ee906f
......@@ -660,6 +660,7 @@ const char *ms_fmt_descriptor_to_string(const MSFmtDescriptor *obj){
static void ms_fmt_descriptor_destroy(MSFmtDescriptor *obj){
if (obj->encoding) ms_free(obj->encoding);
if (obj->fmtp) ms_free(obj->fmtp);
if (obj->text) ms_free(obj->text);
ms_free(obj);
}
......
......@@ -1965,9 +1965,7 @@ static int recorder_set_input_fmt(MSFilter *f, void *arg)
{
data->haveVideoTrack = TRUE;
}
const char *fmtDescriptorString = ms_fmt_descriptor_to_string(pinFmt->fmt);
ms_message("MKVRecorder: pin #%d set on '%s'", pinFmt->pin, fmtDescriptorString);
ms_free((void *)fmtDescriptorString);
ms_message("MKVRecorder: pin #%d set on '%s'", pinFmt->pin, ms_fmt_descriptor_to_string(pinFmt->fmt));
err = 0;
}
}
......
......@@ -45,6 +45,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <netdb.h>
#endif
static void configure_av_recorder(AudioStream *stream);
static void audio_stream_free(AudioStream *stream) {
media_stream_free(&stream->ms);
if (stream->soundread!=NULL) ms_filter_destroy(stream->soundread);
......@@ -290,6 +292,13 @@ static float audio_stream_get_rtcp_xr_average_lq_quality_rating(unsigned long us
return audio_stream_get_average_lq_quality_rating(stream);
}
static void video_input_updated(void *stream, MSFilter *f, unsigned int event_id, void *arg){
if (event_id==MS_ITC_SOURCE_UPDATED){
ms_message("Video ITC source updated.");
configure_av_recorder((AudioStream*)stream);
}
}
static void setup_av_recorder(AudioStream *stream, int sample_rate, int nchannels){
stream->av_recorder.recorder=ms_filter_new(MS_MKV_RECORDER_ID);
if (stream->av_recorder.recorder){
......@@ -323,6 +332,7 @@ static void setup_av_recorder(AudioStream *stream, int sample_rate, int nchannel
pinfmt.pin=1;
ms_message("Configuring av recorder with audio format %s",ms_fmt_descriptor_to_string(pinfmt.fmt));
ms_filter_call_method(stream->av_recorder.recorder,MS_FILTER_SET_INPUT_FMT,&pinfmt);
ms_filter_add_notify_callback(stream->av_recorder.video_input,video_input_updated,stream,TRUE);
}
}
......@@ -1112,6 +1122,7 @@ static void configure_av_recorder(AudioStream *stream){
void audio_stream_link_video(AudioStream *stream, VideoStream *video){
if (stream->av_recorder.video_input && video->itcsink){
ms_message("audio_stream_link_video() connecting itc filters");
ms_filter_call_method(video->itcsink,MS_ITC_SINK_CONNECT,stream->av_recorder.video_input);
configure_av_recorder(stream);
}
......
......@@ -217,6 +217,14 @@ VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *session
stream->output_performs_decoding = FALSE;
choose_display_name(stream);
stream->ms.process_rtcp=video_stream_process_rtcp;
/*
* In practice, these filters are needed only for audio+video recording.
*/
if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(), MS_MKV_RECORDER_ID)){
stream->itcsink=ms_filter_new(MS_ITC_SINK_ID);
stream->tee3=ms_filter_new(MS_TEE_ID);
}
return stream;
}
......@@ -396,7 +404,7 @@ static void configure_itc(VideoStream *stream){
MSPinFormat pinfmt={0};
pinfmt.pin=0;
pinfmt.fmt=fmt;
ms_filter_call_method(stream->itcsink,MS_FILTER_SET_OUTPUT_FMT,&pinfmt);
ms_filter_call_method(stream->itcsink,MS_FILTER_SET_INPUT_FMT,&pinfmt);
}
}
}
......@@ -528,13 +536,6 @@ int video_stream_start (VideoStream *stream, RtpProfile *profile, const char *re
ms_error("videostream.c: No decoder available for payload %i:%s.",payload,pt->mime_type);
return -1;
}
/*
* In practice, these filters are needed only for audio+video recording.
*/
if (ms_factory_lookup_filter_by_id(ms_factory_get_fallback(), MS_MKV_RECORDER_ID)){
stream->itcsink=ms_filter_new(MS_ITC_SINK_ID);
stream->tee3=ms_filter_new(MS_TEE_ID);
}
/* display logic */
if (stream->rendercb!=NULL){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment