Commit 2acfebd9 authored by Sandrine Avakian's avatar Sandrine Avakian
Browse files

Small fixes in audiostream videostream mkv and videodisplay.

Replacing ms_init   and ms_filter_new with ms_factory functions.
parent b55b08c2
......@@ -2328,7 +2328,7 @@ typedef struct {
ms_bool_t eot; // end-of-track
} MKVTrackPlayer;
static MKVTrackPlayer *mkv_track_player_new(MKVReader *reader, const MKVTrack *track) {
static MKVTrackPlayer *mkv_track_player_new(MSFactory *factory, MKVReader *reader, const MKVTrack *track) {
MKVTrackPlayer *obj;
const char *codec_name = codec_id_to_rfc_name(track->codec_id);
......@@ -2340,16 +2340,12 @@ static MKVTrackPlayer *mkv_track_player_new(MKVReader *reader, const MKVTrack *t
obj->track = track;
if(track->type == MKV_TRACK_TYPE_VIDEO) {
MKVVideoTrack *v_track = (MKVVideoTrack *)track;
<<<<<<< HEAD
MSVideoSize vsize = {v_track->width, v_track->height};// TODO : FIX THIS !!!
obj->output_pin_desc = ms_factory_get_video_format(NULL, codec_name, vsize, v_track->frame_rate,NULL);
=======
MSVideoSize vsize = {v_track->width, v_track->height};
obj->output_pin_desc = ms_factory_get_video_format(ms_factory_get_fallback(), codec_name, vsize, v_track->frame_rate, NULL);
>>>>>>> ef599c81705fd8204feb20fc7d9f87aae75286bd
obj->output_pin_desc = ms_factory_get_video_format(factory, codec_name, vsize, v_track->frame_rate,NULL);
} else if(track->type == MKV_TRACK_TYPE_AUDIO) {
MKVAudioTrack *a_track = (MKVAudioTrack *)track;
obj->output_pin_desc = ms_factory_get_audio_format(NULL, codec_name, a_track->sampling_freq, a_track->channels, NULL);
obj->output_pin_desc = ms_factory_get_audio_format(factory, codec_name, a_track->sampling_freq, a_track->channels, NULL);
} else {
ms_error("MKVTrackPlayer: unsupported track type: %d", track->type);
ms_free(obj);
......@@ -2474,7 +2470,7 @@ static int player_open_file(MSFilter *f, void *arg) {
}
}
if(track) {
obj->players[i] = mkv_track_player_new(obj->reader, track);
obj->players[i] = mkv_track_player_new(f->factory, obj->reader, track);
if(obj->players[i] == NULL) {
ms_warning("MKVPlayer: could not instanciate MKVTrackPlayer for track #%d", track->num);
}
......
......@@ -605,9 +605,9 @@ static void setup_av_recorder(AudioStream *stream, int sample_rate, int nchannel
stream->av_recorder.recorder=ms_factory_create_filter(stream->ms.factory, MS_MKV_RECORDER_ID);
if (stream->av_recorder.recorder){
MSPinFormat pinfmt={0};
stream->av_recorder.video_input=ms_factory_create_filter(stream->videostream->ms.factory, MS_ITC_SOURCE_ID);
stream->av_recorder.resampler=ms_factory_create_filter(stream->videostream->ms.factory,MS_RESAMPLE_ID);
stream->av_recorder.encoder=ms_factory_create_filter(stream->videostream->ms.factory,MS_OPUS_ENC_ID);
stream->av_recorder.video_input=ms_factory_create_filter(stream->ms.factory, MS_ITC_SOURCE_ID);
stream->av_recorder.resampler=ms_factory_create_filter(stream->ms.factory,MS_RESAMPLE_ID);
stream->av_recorder.encoder=ms_factory_create_filter(stream->ms.factory,MS_OPUS_ENC_ID);
if (stream->av_recorder.encoder==NULL){
int g711_rate=8000;
......
......@@ -295,7 +295,7 @@ VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *session
stream->ms.type = MSVideo;
stream->ms.sessions=*sessions;
//media_stream_init(&stream->ms, ms_factory_get_fallback());
media_stream_init(&stream->ms, factory);
if (sessions->zrtp_context != NULL) {
ms_zrtp_set_stream_sessions(sessions->zrtp_context, &(stream->ms.sessions));
......@@ -306,7 +306,7 @@ VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *session
rtp_session_resync(stream->ms.sessions.rtp_session);
stream->ms.qi=ms_quality_indicator_new(stream->ms.sessions.rtp_session);
ms_quality_indicator_set_label(stream->ms.qi,"video");
// stream->ms.rtpsend=ms_filter_new(MS_RTP_SEND_ID);
stream->ms.rtpsend=ms_factory_create_filter(stream->ms.factory, MS_RTP_SEND_ID);
stream->ms.ice_check_list=NULL;
......@@ -323,8 +323,7 @@ VideoStream *video_stream_new_with_sessions(const MSMediaStreamSessions *session
* In practice, these filters are needed only for audio+video recording.
*/
if (ms_factory_lookup_filter_by_id(stream->ms.factory, MS_MKV_RECORDER_ID)){
// stream->tee3=ms_filter_new(MS_TEE_ID);
// stream->recorder_output=ms_filter_new(MS_ITC_SINK_ID);
stream->tee3=ms_factory_create_filter(stream->ms.factory, MS_TEE_ID);
stream->recorder_output=ms_factory_create_filter(stream->ms.factory, MS_ITC_SINK_ID);
......@@ -562,20 +561,16 @@ static void configure_video_source(VideoStream *stream){
ms_filter_call_method(stream->ms.encoder, MS_FILTER_SET_PIX_FMT, &format);
} else {
if (format==MS_MJPEG){
// stream->pixconv=ms_filter_new(MS_MJPEG_DEC_ID);
stream->pixconv=ms_factory_create_filter(stream->ms.factory, MS_MJPEG_DEC_ID);
}else if (format==MS_PIX_FMT_UNKNOWN){
// stream->pixconv = ms_filter_create_decoder(pf.fmt->encoding);
stream->pixconv = ms_factory_create_filter(stream->ms.factory, pf.fmt->encoding);
}else{
//stream->pixconv = ms_filter_new(MS_PIX_CONV_ID);
stream->pixconv = ms_factory_create_filter(stream->ms.factory, MS_PIX_CONV_ID);
/*set it to the pixconv */
ms_filter_call_method(stream->pixconv,MS_FILTER_SET_PIX_FMT,&format);
ms_filter_call_method(stream->pixconv,MS_FILTER_SET_VIDEO_SIZE,&cam_vsize);
}
// stream->sizeconv=ms_filter_new(MS_SIZE_CONV_ID);
stream->sizeconv=ms_factory_create_filter(stream->ms.factory, MS_SIZE_CONV_ID);
ms_filter_call_method(stream->sizeconv,MS_FILTER_SET_VIDEO_SIZE,&vsize);
}
......
......@@ -40,14 +40,14 @@ int main(int argc, char *argv[]){
vsize.width=MS_VIDEO_SIZE_CIF_W;
vsize.height=MS_VIDEO_SIZE_CIF_H;
ortp_init();
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
//ms_init();
factory = ms_factory_new();
ms_factory_init_voip(factory);
ms_factory_init_plugins(factory);
ortp_init();
ortp_set_log_level_mask(ORTP_LOG_DOMAIN, ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
ms_init();
cam=ms_web_cam_manager_get_default_cam(ms_web_cam_manager_get());
//cam=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"StaticImage: Static picture");
......@@ -83,7 +83,7 @@ int main(int argc, char *argv[]){
{
ms_ticker_detach (vs->ms.sessions.ticker, vs->source);
vs->tee = ms_filter_new(MS_TEE_ID);
vs->tee = ms_factory_create_filter(factory, MS_TEE_ID);
ms_filter_unlink(vs->pixconv,0, vs->output2,0);
......
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