Commit 91f27820 authored by Simon Morlat's avatar Simon Morlat

implement play video file within VideoStream

parent 75080eb5
......@@ -56,6 +56,7 @@ struct _MSFmtDescriptor{
int rate; /**<Samplerate for audio, clockrate for video*/
char *fmtp; /**<fmtp*/
MSVideoSize vsize; /**<video size*/
float fps; /**<average framerate*/
char *text; /**<do not use directly, use ms_fmt_descriptor_to_string() instead*/
};
......
......@@ -322,6 +322,7 @@ struct _AudioStream
EchoLimiterType el_type; /*use echo limiter: two MSVolume, measured input level controlling local output level*/
EqualizerLocation eq_loc;
uint32_t features;
struct _VideoStream *videostream;/*the stream with which this audiostream is paired*/
bool_t play_dtmfs;
bool_t use_gc;
bool_t use_agc;
......@@ -535,6 +536,8 @@ MS2_PUBLIC int audio_stream_mixed_record_stop(AudioStream *st);
**/
MS2_PUBLIC MSFilter * audio_stream_open_remote_play(AudioStream *stream, const char *filename);
MS2_PUBLIC void audio_stream_close_remote_play(AudioStream *stream);
MS2_PUBLIC void audio_stream_set_default_card(int cardindex);
/* retrieve RTP statistics*/
......@@ -635,6 +638,7 @@ struct _VideoStream
bool_t display_filter_auto_rotate_enabled;
bool_t source_performs_encoding;
bool_t output_performs_decoding;
bool_t player_active;
};
......
......@@ -240,5 +240,7 @@ MS2_PUBLIC void ms_factory_set_payload_max_size(MSFactory *obj, int size);
MS2_PUBLIC const struct _MSFmtDescriptor * ms_factory_get_audio_format(MSFactory *obj, const char *mime, int rate, int channels, const char *fmtp);
MS2_PUBLIC const struct _MSFmtDescriptor * ms_factory_get_video_format(MSFactory *obj, const char *mime, const MSVideoSize *size, const char *fmtp);
MS2_PUBLIC const struct _MSFmtDescriptor * ms_factory_get_video_format(MSFactory *obj, const char *mime, MSVideoSize size, float fps, const char *fmtp);
MS2_PUBLIC const MSFmtDescriptor *ms_factory_get_format(MSFactory *obj, const MSFmtDescriptor *ref);
#endif
......@@ -641,6 +641,13 @@ the method index (_cnt_) and the argument size */
#define MS_FILTER_EVENT_NO_ARG(_id_,_count_)\
MS_FILTER_METHOD_ID(_id_,_count_,0)
#define MS_FILTER_BASE_EVENT(_count_,_argtype_) \
MS_FILTER_EVENT(MS_FILTER_BASE_ID,_count_,_argtype_)
#define MS_FILTER_BASE_EVENT_NO_ARG(_count_) \
MS_FILTER_EVENT_NO_ARG(MS_FILTER_BASE_ID,_count_)
/**
* some MSFilter base generic methods:
**/
......@@ -697,6 +704,12 @@ typedef struct _MSPinFormat{
#define MS_FILTER_SET_OUTPUT_FMT MS_FILTER_BASE_METHOD(33,MSPinFormat)
/**
* MSFilter generic events
**/
#define MS_FILTER_OUTPUT_FMT_CHANGED MS_FILTER_BASE_EVENT_NO_ARG(0) /**<triggered whenever a filter decides to change its output format for one or more more output pins*/
/* DEPRECATED specific methods: to be moved into implementation specific header files - DO NOT USE IN NEW CODE*/
#define MS_FILTER_SET_FILTERLENGTH MS_FILTER_BASE_METHOD(12,int)
#define MS_FILTER_SET_OUTPUT_SAMPLE_RATE MS_FILTER_BASE_METHOD(13,int)
......
......@@ -134,8 +134,6 @@ typedef enum _MSPlayerState MSPlayerState;
#define MS_PLAYER_EOF \
MS_FILTER_EVENT_NO_ARG(MSFilterPlayerInterface,0)
#define MS_PLAYER_FORMAT_CHANGED\
MS_FILTER_EVENT_NO_ARG(MSFilterPlayerInterface,1)
/**
* Interface definitions for recorders
......
......@@ -23,6 +23,5 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define MS_ITC_SINK_CONNECT MS_FILTER_METHOD(MS_ITC_SINK_ID,0,MSFilter)
#define MS_ITC_SOURCE_UPDATED MS_FILTER_EVENT_NO_ARG(MS_ITC_SOURCE_ID,0)
#endif
......@@ -269,6 +269,11 @@ void deinterlace_down_scale_neon(uint8_t* ysrc, uint8_t* cbcrsrc, uint8_t* ydst,
#endif
mblk_t *copy_ycbcrbiplanar_to_true_yuv_with_rotation_and_down_scale_by_2(uint8_t* y, uint8_t * cbcr, int rotation, int w, int h, int y_byte_per_row,int cbcr_byte_per_row, bool_t uFirstvSecond, bool_t down_scale);
static MS2_INLINE MSVideoSize ms_video_size_make(int width, int height){
MSVideoSize vsize={width,height};
return vsize;
}
static MS2_INLINE bool_t ms_video_size_greater_than(MSVideoSize vs1, MSVideoSize vs2){
return (vs1.width>=vs2.width) && (vs1.height>=vs2.height);
}
......
......@@ -215,6 +215,6 @@ public class AndroidVideoApi5JniWrapper {
Log.d("mediastreamer", "Preview framerate set:" + params.getPreviewFrameRate());
}
camera.setParameters(params);
camera.setParameters(params);
}
}
......@@ -205,7 +205,7 @@ static int player_open(MSFilter *f, void *arg){
if (read_wav_header(d)!=0 && strstr(file,".wav")){
ms_warning("File %s has .wav extension but wav header could be found.",file);
}
ms_filter_notify_no_arg(f,MS_PLAYER_FORMAT_CHANGED);
ms_filter_notify_no_arg(f,MS_FILTER_OUTPUT_FMT_CHANGED);
ms_message("MSFilePlayer[%p]: %s opened: rate=%i,channel=%i",f,file,d->rate,d->nchannels);
return 0;
}
......
......@@ -664,6 +664,8 @@ static void ms_opus_dec_process(MSFilter *f) {
mblk_t *im;
mblk_t *om;
int frames;
if (!d->state) ms_queue_flush(f->inputs[0]);
/* decode available packets */
while ((im = ms_queue_get(f->inputs[0])) != NULL) {
......
......@@ -670,6 +670,7 @@ static int compare_fmt(const MSFmtDescriptor *a, const MSFmtDescriptor *b){
if (a->fmtp && b->fmtp && strcmp(a->fmtp,b->fmtp)!=0) return -1;
if (a->type==MSVideo){
if (a->vsize.width!=b->vsize.width || a->vsize.height!=b->vsize.height) return -1;
if (a->fps!=b->fps) return -1;
}
return 0;
}
......@@ -682,6 +683,7 @@ static MSFmtDescriptor * ms_fmt_descriptor_new_copy(const MSFmtDescriptor *orig)
if (orig->fmtp) obj->fmtp=ms_strdup(orig->fmtp);
if (orig->encoding) obj->encoding=ms_strdup(orig->encoding);
obj->vsize=orig->vsize;
obj->fps=orig->fps;
return obj;
}
......@@ -693,8 +695,8 @@ const char *ms_fmt_descriptor_to_string(const MSFmtDescriptor *obj){
mutable_fmt->text=ms_strdup_printf("type=audio;encoding=%s;rate=%i;channels=%i;fmtp='%s'",
obj->encoding,obj->rate,obj->nchannels,obj->fmtp ? obj->fmtp : "");
}else{
mutable_fmt->text=ms_strdup_printf("type=video;encoding=%s;vsize=%ix%i;fmtp='%s'",
obj->encoding,obj->vsize.width,obj->vsize.height,obj->fmtp ? obj->fmtp : "");
mutable_fmt->text=ms_strdup_printf("type=video;encoding=%s;vsize=%ix%i;fps=%f;fmtp='%s'",
obj->encoding,obj->vsize.width,obj->vsize.height,obj->fps,obj->fmtp ? obj->fmtp : "");
}
}
return obj->text;
......@@ -707,7 +709,7 @@ static void ms_fmt_descriptor_destroy(MSFmtDescriptor *obj){
ms_free(obj);
}
static MSFmtDescriptor *ms_factory_lookup_format(MSFactory *obj, const MSFmtDescriptor *ref){
const MSFmtDescriptor *ms_factory_get_format(MSFactory *obj, const MSFmtDescriptor *ref){
MSFmtDescriptor *ret;
MSList *found;
if ((found=ms_list_find_custom(obj->formats,(int (*)(const void*, const void*))compare_fmt, ref))==NULL){
......@@ -725,16 +727,17 @@ const MSFmtDescriptor * ms_factory_get_audio_format(MSFactory *obj, const char *
tmp.rate=rate;
tmp.nchannels=channels;
tmp.fmtp=(char*)fmtp;
return ms_factory_lookup_format(obj,&tmp);
return ms_factory_get_format(obj,&tmp);
}
const MSFmtDescriptor * ms_factory_get_video_format(MSFactory *obj, const char *mime, const MSVideoSize *size, const char *fmtp){
const MSFmtDescriptor * ms_factory_get_video_format(MSFactory *obj, const char *mime, MSVideoSize size, float fps, const char *fmtp){
MSFmtDescriptor tmp={0};
MSVideoSize undef={0};
tmp.type=MSVideo;
tmp.encoding=(char*)mime;
tmp.rate=90000;
tmp.vsize=size ? *size : undef;
tmp.vsize=size;
tmp.fmtp=(char*)fmtp;
return ms_factory_lookup_format(obj,&tmp);
tmp.fps=fps;
return ms_factory_get_format(obj,&tmp);
}
......@@ -20,81 +20,74 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "mediastreamer2/msitc.h"
typedef struct SourceState{
typedef struct SinkState{
ms_mutex_t mutex;
int rate;
int nchannels;
MSQueue q;
const MSFmtDescriptor *fmt;
}SourceState;
MSFilter *source;
}SinkState;
static void itc_source_init(MSFilter *f){
SourceState *s=ms_new0(SourceState,1);
ms_mutex_init(&s->mutex,NULL);
ms_queue_init(&s->q);
s->rate=44100;
s->nchannels=1;
f->data=s;
f->data=NULL;
}
static void itc_source_uninit(MSFilter *f){
SourceState *s=(SourceState *)f->data;
ms_mutex_destroy(&s->mutex);
ms_queue_flush (&s->q);
ms_free(s);
}
static void itc_source_queue_packet(MSFilter *f, mblk_t *m){
SourceState *s=(SourceState *)f->data;
ms_mutex_lock(&s->mutex);
ms_queue_put(&s->q,m);
ms_mutex_unlock(&s->mutex);
}
static void itc_source_set_nchannels(MSFilter *f, int chans){
SourceState *s=(SourceState *)f->data;
s->nchannels=chans;
}
static void itc_source_set_rate(MSFilter *f, int rate){
SourceState *s=(SourceState *)f->data;
s->rate=rate;
static SinkState * itc_source_get_sink_state(MSFilter *f){
MSFilter *sink=(MSFilter *)f->data;
if (sink){
SinkState *s=(SinkState*)sink->data;
return s;
}
return NULL;
}
static int itc_source_get_nchannels(MSFilter *f, void *data){
SourceState *s=(SourceState *)f->data;
*(int*)data=s->nchannels;
return 0;
SinkState *ss=itc_source_get_sink_state(f);
if (ss){
*(int*)data=ss->nchannels;
return 0;
}
ms_error("Itc source is not connected.");
return -1;
}
static int itc_source_get_rate(MSFilter *f, void *data){
SourceState *s=(SourceState *)f->data;
*(int*)data=s->rate;
return 0;
SinkState *ss=itc_source_get_sink_state(f);
if (ss){
*(int*)data=ss->rate;
return 0;
}
ms_error("Itc source is not connected.");
return -1;
}
static int itc_source_set_fmt(MSFilter *f, void *data){
SourceState *s=(SourceState *)f->data;
s->fmt=((MSPinFormat*)data)->fmt;
static int itc_source_get_out_fmt(MSFilter *f, void *data){
SinkState *ss=itc_source_get_sink_state(f);
if (ss){
((MSPinFormat*)data)->fmt=ss->fmt;
return 0;
}
ms_error("Itc source is not connected.");
return 0;
}
static void itc_source_process(MSFilter *f){
SourceState *s=(SourceState *)f->data;
SinkState *ss=itc_source_get_sink_state(f);
mblk_t *m;
ms_mutex_lock(&s->mutex);
while((m=ms_queue_get(&s->q))!=NULL){
ms_mutex_unlock(&s->mutex);
ms_queue_put(f->outputs[0],m);
ms_mutex_lock(&s->mutex);
if (ss){
ms_mutex_lock(&ss->mutex);
while((m=ms_queue_get(&ss->q))!=NULL){
ms_mutex_unlock(&ss->mutex);
ms_queue_put(f->outputs[0],m);
ms_mutex_lock(&ss->mutex);
}
ms_mutex_unlock(&ss->mutex);
}
ms_mutex_unlock(&s->mutex);
}
static int itc_source_get_out_fmt(MSFilter *f, void *data){
SourceState *s=(SourceState *)f->data;
((MSPinFormat*)data)->fmt=s->fmt;
return 0;
}
static MSFilterMethod source_methods[]={
......@@ -139,70 +132,87 @@ MSFilterDesc ms_itc_source_desc={
#endif
static void itc_sink_init(MSFilter *f){
SinkState *s;
f->data=s=ms_new0(SinkState,1);
ms_mutex_init(&s->mutex,NULL);
ms_queue_init(&s->q);
}
static void itc_sink_uninit(MSFilter *f){
SinkState *s=(SinkState *)f->data;
ms_queue_flush(&s->q);
ms_mutex_destroy(&s->mutex);
ms_free(s);
}
static void itc_sink_preprocess(MSFilter *f){
MSFilter *other=(MSFilter *)f->data;
if (other) ms_filter_notify(other,MS_ITC_SOURCE_UPDATED,NULL);
SinkState *s=(SinkState *)f->data;
if (s->source && s->fmt==NULL) ms_filter_notify_no_arg(s->source,MS_FILTER_OUTPUT_FMT_CHANGED);
}
static void itc_sink_queue_packet(MSFilter *f, mblk_t *m){
SinkState *s=(SinkState *)f->data;
ms_mutex_lock(&s->mutex);
if (s->source==NULL){
freemsg(m);
}else{
ms_queue_put(&s->q,m);
}
ms_mutex_unlock(&s->mutex);
}
static void itc_sink_process(MSFilter *f){
MSFilter *other=(MSFilter *)f->data;
mblk_t *im;
while((im=ms_queue_get(f->inputs[0]))!=NULL){
if (other) itc_source_queue_packet(other,im);
else freemsg(im);
itc_sink_queue_packet(f,im);
}
}
static int itc_sink_connect(MSFilter *f, void *data){
f->data=data;
SinkState *s=(SinkState *)f->data;
MSFilter *srcfilter=(MSFilter*)data;
if (srcfilter){
srcfilter->data=f;
}else{
MSFilter *oldsrc=s->source;
if (oldsrc)
oldsrc->data=NULL;
}
s->source=srcfilter;
return 0;
}
static int itc_sink_set_nchannels(MSFilter *f , void *data){
MSFilter *other=(MSFilter *)f->data;
if (other==NULL){
ms_error("MSItcSink not connected to any source !");
return -1;
}
itc_source_set_nchannels (other,*(int*)data);
SinkState *s=(SinkState *)f->data;
s->nchannels=*(int*)data;
return 0;
}
static int itc_sink_set_sr(MSFilter *f , void *data){
MSFilter *other=(MSFilter *)f->data;
if (other==NULL){
ms_error("MSItcSink not connected to any source !");
return -1;
}
itc_source_set_rate (other,*(int*)data);
SinkState *s=(SinkState *)f->data;
s->rate=*(int*)data;
return 0;
}
static int itc_sink_get_nchannels(MSFilter *f , void *data){
MSFilter *other=(MSFilter *)f->data;
if (other==NULL){
ms_error("MSItcSink not connected to any source !");
return -1;
}
return itc_source_get_nchannels (other,data);
SinkState *s=(SinkState *)f->data;
*(int*)data=s->nchannels;
return 0;
}
static int itc_sink_get_sr(MSFilter *f , void *data){
MSFilter *other=(MSFilter *)f->data;
if (other==NULL){
ms_error("MSItcSink not connected to any source !");
return -1;
}
return itc_source_get_rate (other,data);
SinkState *s=(SinkState *)f->data;
*(int*)data=s->rate;
return 0;
}
static int itc_sink_set_fmt(MSFilter *f, void *data){
MSFilter *other=(MSFilter *)f->data;
if (other==NULL){
ms_error("MSItcSink not connected to any source !");
return -1;
}
return itc_source_set_fmt(other,data);
SinkState *s=(SinkState *)f->data;
s->fmt=((MSPinFormat*)data)->fmt;
if (s->source && s->fmt)
ms_filter_notify_no_arg(s->source,MS_FILTER_OUTPUT_FMT_CHANGED);
return 0;
}
static MSFilterMethod sink_methods[]={
......@@ -225,11 +235,11 @@ MSFilterDesc ms_itc_sink_desc={
NULL,
1,
0,
NULL,
itc_sink_init,
itc_sink_preprocess,
itc_sink_process,
NULL,
NULL,
itc_sink_uninit,
sink_methods
};
......@@ -242,8 +252,10 @@ MSFilterDesc ms_itc_sink_desc={
.category=MS_FILTER_OTHER,
.ninputs=1,
.noutputs=0,
.init=itc_sink_init,
.preprocess=itc_sink_preprocess,
.process=itc_sink_process,
.uninit=itc_sink_uninit,
.methods=sink_methods
};
......
......@@ -213,6 +213,7 @@ typedef struct {
static void *h264_module_new() {
H264Module *mod = ms_new0(H264Module, 1);
rfc3984_init(&mod->rfc3984Context);
rfc3984_set_mode(&mod->rfc3984Context,1);
return mod;
}
......@@ -1471,7 +1472,8 @@ static int matroska_track_get_info(const Matroska *obj, int trackNum, const MSFm
MSVideoSize vsize;
vsize.width = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild((ebml_master *)elt, &MATROSKA_ContextPixelWidth));
vsize.height = EBML_IntegerValue((ebml_integer *)EBML_MasterFindChild((ebml_master *)elt, &MATROSKA_ContextPixelHeight));
*fmt = ms_factory_get_video_format(ms_factory_get_fallback(), rfcName, &vsize, NULL);
/*TODO: add fps here*/
*fmt = ms_factory_get_video_format(ms_factory_get_fallback(), rfcName, vsize, 0, NULL);
}
break;
......
......@@ -832,6 +832,7 @@ static void dec_process(MSFilter *f) {
s->yuv_msg = ms_yuv_buf_alloc(&s->outbuf, img->d_w, img->d_h);
s->yuv_width = img->d_w;
s->yuv_height = img->d_h;
ms_filter_notify_no_arg(f,MS_FILTER_OUTPUT_FMT_CHANGED);
}
/* scale/copy frame to destination mblk_t */
......@@ -902,12 +903,20 @@ static int dec_get_fps(MSFilter *f, void *data){
return 0;
}
static int dec_get_out_fmt(MSFilter *f, void *data){
DecState *s = (DecState *)f->data;
MSPinFormat *pf=(MSPinFormat*)data;
pf->fmt=ms_factory_get_video_format(f->factory,"YUV420P",ms_video_size_make(s->yuv_width,s->yuv_height),0,NULL);
return 0;
}
static MSFilterMethod dec_methods[] = {
{ MS_VIDEO_DECODER_RESET_FIRST_IMAGE_NOTIFICATION, dec_reset_first_image },
{ MS_VIDEO_DECODER_ENABLE_AVPF, dec_enable_avpf },
{ MS_VIDEO_DECODER_FREEZE_ON_ERROR, dec_freeze_on_error },
{ MS_FILTER_GET_VIDEO_SIZE, dec_get_vsize },
{ MS_FILTER_GET_FPS, dec_get_fps },
{ MS_FILTER_GET_OUTPUT_FMT, dec_get_out_fmt },
{ 0, NULL }
};
......
......@@ -211,7 +211,7 @@ static void player_callback(void *ud, MSFilter *f, unsigned int id, void *arg){
int sr=0;
int channels=0;
switch(id){
case MS_PLAYER_FORMAT_CHANGED:
case MS_FILTER_OUTPUT_FMT_CHANGED:
ms_filter_call_method(f,MS_FILTER_GET_SAMPLE_RATE,&sr);
ms_filter_call_method(f,MS_FILTER_GET_NCHANNELS,&channels);
if (f==stream->local_player){
......@@ -382,7 +382,7 @@ static void configure_av_player(AudioStream *stream, const MSFmtDescriptor *audi
MSPinFormat pf;
pf.pin=0;
pf.fmt=videofmt;
ms_filter_call_method(player->video_output,MS_FILTER_SET_OUTPUT_FMT,&pf);
ms_filter_call_method(player->video_output,MS_FILTER_SET_INPUT_FMT,&pf);
}
}
......@@ -462,6 +462,7 @@ static int open_av_player(AudioStream *stream, const char *filename){
if (videofmt && videofmt->fmt) player->video_output=ms_filter_new(MS_ITC_SINK_ID);
else player->videopin=-1;
configure_av_player(stream,audiofmt ? audiofmt->fmt : NULL ,videofmt ? videofmt->fmt : NULL);
if (stream->videostream) video_stream_open_player(stream->videostream,player->video_output);
plumb_av_player(stream);
return 0;
}
......@@ -481,9 +482,18 @@ MSFilter * audio_stream_open_remote_play(AudioStream *stream, const char *filena
return stream->av_player.player;
}
void audio_stream_close_remote_play(AudioStream *stream){
MSPlayerState state;
if (stream->av_player.player){
ms_filter_call_method(stream->av_player.player,MS_PLAYER_GET_STATE,&state);
if (state!=MSPlayerClosed)
ms_filter_call_method_noarg(stream->av_player.player,MS_PLAYER_CLOSE);
}
if (stream->videostream) video_stream_close_player(stream->videostream);
}
static void video_input_updated(void *stream, MSFilter *f, unsigned int event_id, void *arg){
if (event_id==MS_ITC_SOURCE_UPDATED){
if (event_id==MS_FILTER_OUTPUT_FMT_CHANGED){
ms_message("Video ITC source updated.");
configure_av_recorder((AudioStream*)stream);
}
......@@ -1349,11 +1359,11 @@ static void configure_av_recorder(AudioStream *stream){
pinfmt.pin=0;
ms_filter_call_method(stream->av_recorder.recorder,MS_FILTER_SET_INPUT_FMT,&pinfmt);
}
}
}
void audio_stream_link_video(AudioStream *stream, VideoStream *video){
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);
......@@ -1362,6 +1372,7 @@ void audio_stream_link_video(AudioStream *stream, VideoStream *video){
}
void audio_stream_unlink_video(AudioStream *stream, VideoStream *video){
stream->videostream=NULL;
if (stream->av_recorder.video_input && video->itcsink){
ms_filter_call_method(video->itcsink,MS_ITC_SINK_CONNECT,NULL);
}
......
......@@ -666,4 +666,12 @@ int ms_crypto_suite_to_name_params(MSCryptoSuite cs, MSCryptoSuiteNameParams *pa
return 0;
}
/*stubs*/
#ifndef VIDEO_ENABLED
void video_stream_open_player(VideoStream *stream, MSFilter *sink){
}
void video_stream_close_player(VideoStream *stream){
}
#endif
......@@ -60,7 +60,7 @@ typedef struct _mblk_video_header mblk_video_header;
static void yuv_buf_init(YuvBuf *buf, int w, int h, uint8_t *ptr){
int ysize,usize;
ysize=w*h;
ysize=w*(h & 0x1 ? h +1 : h);
usize=ysize/4;
buf->w=w;
buf->h=h;
......@@ -127,8 +127,8 @@ int ms_picture_init_from_mblk_with_size(MSPicture *buf, mblk_t *m, MSPixFmt fmt,
}
mblk_t * ms_yuv_buf_alloc(YuvBuf *buf, int w, int h){
int size=(w*h*3)/2;
const int header_size =sizeof(mblk_video_header);
int size=(w * (h & 0x1 ? h+1 : h) *3)/2; /*swscale doesn't like odd numbers of line*/
const int header_size = sizeof(mblk_video_header);
const int padding=16;
mblk_t *msg=allocb(header_size + size+padding,0);
// write width/height in header
......
......@@ -81,6 +81,11 @@ MS2_PUBLIC void video_stream_send_sli(VideoStream *stream, uint16_t first, uint1
*/
MS2_PUBLIC void video_stream_send_rpsi(VideoStream *stream, uint8_t *bit_string, uint16_t bit_string_len);
void video_stream_open_player(VideoStream *stream, MSFilter *sink);
void video_stream_close_player(VideoStream *stream);
#ifdef __cplusplus
}
#endif
......
......@@ -27,7 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
static void ring_player_event_handler(void *ud, MSFilter *f, unsigned int evid, void *arg){
RingStream *stream=(RingStream*)ud;
int channels,rate;
if (evid==MS_PLAYER_FORMAT_CHANGED){
if (evid==MS_FILTER_OUTPUT_FMT_CHANGED){
ms_filter_call_method(stream->source,MS_FILTER_GET_NCHANNELS,&channels);
ms_filter_call_method(stream->source,MS_FILTER_GET_SAMPLE_RATE,&rate);
ms_message("Configuring resampler input with rate=[%i], nchannels=[%i]",rate,channels);
......
This diff is collapsed.
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