Commit e0d08401 authored by Simon Morlat's avatar Simon Morlat

fix crash with file player features

parent 81fbe7c8
......@@ -439,7 +439,7 @@ static int player_get_nch(MSFilter *f, void *arg){
static int player_get_fmtp(MSFilter *f, void *arg){
PlayerData *d=(PlayerData*)f->data;
MSPinFormat *pinfmt = (MSPinFormat*)arg;
pinfmt->fmt = ms_factory_get_audio_format(f->factory, "pcm", d->rate, d->nchannels, NULL);
if (pinfmt->pin == 0) pinfmt->fmt = ms_factory_get_audio_format(f->factory, "pcm", d->rate, d->nchannels, NULL);
return 0;
}
......
......@@ -514,16 +514,24 @@ static int open_av_player(AudioStream *stream, const char *filename){
fmt1.fmt=ms_factory_get_audio_format(stream->ms.factory, "pcm", sr, channels, NULL);
audiofmt=&fmt1;
}else{
if (fmt1.fmt && fmt1.fmt->type==MSAudio) {
audiofmt=&fmt1;
videofmt=&fmt2;
player->audiopin=0;
player->videopin=1;
}else{
videofmt=&fmt1;
audiofmt=&fmt2;
player->audiopin=1;
player->videopin=0;
if (fmt1.fmt) {
if (fmt1.fmt->type==MSAudio){
audiofmt=&fmt1;
player->audiopin=0;
}else{
videofmt=&fmt1;
player->videopin=0;
}
}
if (fmt2.fmt){
if (fmt2.fmt->type == MSAudio){
audiofmt=&fmt2;
player->audiopin=1;
}else{
videofmt=&fmt2;
player->videopin=1;
}
}
}
if (audiofmt && audiofmt->fmt && strcasecmp(audiofmt->fmt->encoding,"pcm")!=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