static bool_t check_sps_pps_change(DecData *d, mblk_t *sps, mblk_t *pps){ bool_t ret1=FALSE,ret2=FALSE; if (d->sps){ if (sps){ ret1=(msgdsize(sps)!=msgdsize(d->sps)) || (memcmp(d->sps->b_rptr,sps->b_rptr,msgdsize(sps))!=0); if (ret1) { update_sps(d,sps); ms_message("SPS changed !"); update_pps(d,NULL); } } }else if (sps) { ms_message("Receiving first SPS"); update_sps(d,sps); } if (d->pps){ if (pps){ ret2=(msgdsize(pps)!=msgdsize(d->pps)) || (memcmp(d->pps->b_rptr,pps->b_rptr,msgdsize(pps))!=0); if (ret2) { ms_message("PPS changed ! %i,%i",msgdsize(pps),msgdsize(d->pps)); update_pps(d,pps); } } }else if (pps) { ms_message("Receiving first PPS"); update_pps(d,pps); } return ret1 || ret2; }
static bool_t check_pps_change(DecData *d, mblk_t *pps){ bool_t ret=FALSE; if (d->pps){ ret=(msgdsize(pps)!=msgdsize(d->pps)) || (memcmp(d->pps->b_rptr,pps->b_rptr,msgdsize(pps))!=0); if (ret) { ms_message("PPS changed ! %i,%i",(int)msgdsize(pps),(int)msgdsize(d->pps)); update_pps(d,pps); } }else { ms_message("Receiving first PPS"); update_pps(d,pps); } return ret; }
static mblk_t *get_as_yuvmsg(MSFilter *f, DecData *s, AVFrame *orig){ AVCodecContext *ctx=&s->av_context; if (s->outbuf.w!=ctx->width || s->outbuf.h!=ctx->height){ if (s->sws_ctx!=NULL){ sws_freeContext(s->sws_ctx); s->sws_ctx=NULL; freemsg(s->yuv_msg); s->yuv_msg=NULL; } ms_message("Getting yuv picture of %ix%i",ctx->width,ctx->height); s->yuv_msg=ms_yuv_buf_alloc(&s->outbuf,ctx->width,ctx->height); s->outbuf.w=ctx->width; s->outbuf.h=ctx->height; s->sws_ctx=sws_getContext(ctx->width,ctx->height,ctx->pix_fmt, ctx->width,ctx->height,PIX_FMT_YUV420P,SWS_FAST_BILINEAR, NULL, NULL, NULL); ms_filter_notify_no_arg(f,MS_FILTER_OUTPUT_FMT_CHANGED); } #if LIBSWSCALE_VERSION_INT >= AV_VERSION_INT(0,9,0) if (sws_scale(s->sws_ctx,(const uint8_t * const *)orig->data,orig->linesize, 0, ctx->height, s->outbuf.planes, s->outbuf.strides)<0){ #else if (sws_scale(s->sws_ctx,(uint8_t **)orig->data,orig->linesize, 0, ctx->height, s->outbuf.planes, s->outbuf.strides)<0){ #endif ms_error("%s: error in sws_scale().",f->desc->name); } return dupmsg(s->yuv_msg); } static void update_sps(DecData *d, mblk_t *sps){ if (d->sps) freemsg(d->sps); d->sps=dupb(sps); } static void update_pps(DecData *d, mblk_t *pps){ if (d->pps) freemsg(d->pps); if (pps) d->pps=dupb(pps); else d->pps=NULL; } static bool_t check_sps_change(DecData *d, mblk_t *sps){ bool_t ret=FALSE; if (d->sps){ ret=(msgdsize(sps)!=msgdsize(d->sps)) || (memcmp(d->sps->b_rptr,sps->b_rptr,msgdsize(sps))!=0); if (ret) { ms_message("SPS changed ! %i,%i",(int)msgdsize(sps),(int)msgdsize(d->sps)); update_sps(d,sps); update_pps(d,NULL); } } else { ms_message("Receiving first SPS"); update_sps(d,sps); } return ret; }
static bool_t check_sps_change(DecData *d, mblk_t *sps){ bool_t ret=FALSE; if (d->sps){ ret=(msgdsize(sps)!=msgdsize(d->sps)) || (memcmp(d->sps->b_rptr,sps->b_rptr,msgdsize(sps))!=0); if (ret) { ms_message("SPS changed ! %i,%i",msgdsize(sps),msgdsize(d->sps)); update_sps(d,sps); update_pps(d,NULL); } } else { ms_message("Receiving first SPS"); update_sps(d,sps); } return ret; }