int gst_video1_encode(struct videnc_state *st, bool update, const struct vidframe *frame) { int err; if (!st || !frame || frame->fmt != VID_FMT_YUV420P) return EINVAL; if (!st->streamer.valid || !vidsz_cmp(&st->encoder.size, &frame->size)) { pipeline_close(st); err = pipeline_init(st, &frame->size); if (err) { warning("gst_video: pipeline initialization failed\n"); return err; } st->encoder.size = frame->size; } if (update) { debug("gst_video: gstreamer picture update" ", it's not implemented...\n"); } /* * Push frame into pipeline. * Function call will return once frame has been processed completely. */ err = pipeline_push(st, frame); return err; }
/** * process incoming pipeline input. * * the only input processed so far is from the video output stage to * draw something into the image. */ void pipeline_process_input(CPipelinePacket &i_cPipelinePacket) { if (i_cPipelinePacket.type_info_name != typeid(CDataDrawingInformation).name()) { std::cerr << "ERROR: Only data drawing information allowed for image input stage" << std::endl; exit(-1); } // unpack CDataDrawingInformation *d = i_cPipelinePacket.getPayload< CDataDrawingInformation>(); // handle package by drawing a circle draw_circle(*d); // push modifications on image to pipeline pipeline_push(); }