static void dec_init(MSFilter *f){
	AMediaFormat *format;
	AMediaCodec *codec = AMediaCodec_createDecoderByType("video/avc");
	DecData *d=ms_new0(DecData,1);
	d->codec = codec;
	d->sps=NULL;
	d->pps=NULL;
	rfc3984_init(&d->unpacker);
	d->packet_num=0;
	d->vsize.width=0;
	d->vsize.height=0;
	d->bitstream_size=65536;
	d->avpf_enabled=FALSE;
    d->bitstream=ms_malloc0(d->bitstream_size);
	d->buf_allocator = ms_yuv_buf_allocator_new();
	ms_average_fps_init(&d->fps, " H264 decoder: FPS: %f");

	format = AMediaFormat_new();
	AMediaFormat_setString(format,"mime","video/avc");
	//Size mandatory for decoder configuration
	AMediaFormat_setInt32(format,"width",1920);
	AMediaFormat_setInt32(format,"height",1080);

	AMediaCodec_configure(codec, format, NULL, NULL, 0);
    AMediaCodec_start(codec);
    AMediaFormat_delete(format);

	f->data=d;
}
static void bb10capture_preprocess(MSFilter *f) {
    BB10Capture *d = (BB10Capture*) f->data;

    if (!d->camera_openned) {
        bb10capture_open_camera(d);
    }

    ms_average_fps_init(&d->avgfps, "[bb10_capture] fps=%f");
    ms_queue_flush(&d->rq);

    bb10capture_start_capture(d);
}
static void h264_dec_init(MSFilter *f) {
	VTH264DecCtx *ctx = ms_new0(VTH264DecCtx, 1);
	ms_queue_init(&ctx->queue);
	ms_mutex_init(&ctx->mutex, NULL);
	ctx->pixbuf_allocator = ms_yuv_buf_allocator_new();
	rfc3984_init(&ctx->unpacker);
	ctx->vsize = MS_VIDEO_SIZE_UNKNOWN;
	ms_average_fps_init(&ctx->fps, "VideoToolboxDecoder: decoding at %ffps");
	ctx->first_image = TRUE;
	ctx->f = f;
	f->data = ctx;
}
Exemple #4
0
static void dec_init(MSFilter *f) {
	DecState *s = (DecState *)ms_new0(DecState, 1);

	s->iface = vpx_codec_vp8_dx();
	ms_message("Using %s", vpx_codec_iface_name(s->iface));

	s->last_error_reported_time = 0;
	s->yuv_width = 0;
	s->yuv_height = 0;
	s->yuv_msg = 0;
	ms_queue_init(&s->q);
	s->first_image_decoded = FALSE;
	s->avpf_enabled = FALSE;
	s->freeze_on_error = TRUE;
	f->data = s;
	ms_average_fps_init(&s->fps, "VP8 decoder: FPS: %f");
}
Exemple #5
0
static void dec_init(MSFilter *f){
	DecData *d=(DecData*)ms_new(DecData,1);
	ffmpeg_init();
	d->yuv_msg=NULL;
	d->sps=NULL;
	d->pps=NULL;
	d->sws_ctx=NULL;
	rfc3984_init(&d->unpacker);
	d->packet_num=0;
	dec_open(d);
	d->outbuf.w=0;
	d->outbuf.h=0;
	d->bitstream_size=65536;
	d->bitstream=ms_malloc0(d->bitstream_size);
	d->orig = av_frame_alloc();
	ms_average_fps_init(&d->fps, "ffmpeg H264 decoder: FPS: %f");
	if (!d->orig) {
		ms_error("Could not allocate frame");
	}
	f->data=d;
}
void MSOpenH264Decoder::initialize()
{
    if (!mInitialized) {
        mFirstImageDecoded = false;
        mUnpacker=rfc3984_new();
        if (mDecoder != 0) {
            SDecodingParam params = { 0 };
            params.eOutputColorFormat = videoFormatI420;
            params.uiTargetDqLayer = (unsigned char) -1;
            params.eEcActiveIdc = ERROR_CON_FRAME_COPY_CROSS_IDR;
            params.sVideoProperty.size = sizeof(params.sVideoProperty);
            params.sVideoProperty.eVideoBsType = VIDEO_BITSTREAM_DEFAULT;
            long ret = mDecoder->Initialize(&params);
            if (ret != 0) {
                ms_error("OpenH264 decoder: Failed to initialize: %li", ret);
            } else {
                ms_average_fps_init(&mFPS, "OpenH264 decoder: FPS=%f");
                mInitialized = true;
            }
        }
    }
}
Exemple #7
0
/*compatibility, deprecated*/
void ms_video_init_average_fps(MSAverageFPS* afps, const char* ctx){
	ms_average_fps_init(afps,ctx);
}