/* The weird handling of cropping, alignment and everything is taken from * platform/frameworks/media/libstagefright/colorconversion/ColorConversion.cpp */ static gboolean gst_amc_video_enc_fill_buffer (GstAmcVideoEnc * self, GstBuffer * inbuf, GstAmcBuffer * outbuf, const GstAmcBufferInfo * buffer_info) { GstVideoCodecState *input_state = self->input_state; /* The fill_buffer runs in the same thread as set_format? * then we can use state->info safely */ GstVideoInfo *info = &input_state->info; if (buffer_info->size < self->color_format_info.frame_size) return FALSE; return gst_amc_color_format_copy (&self->color_format_info, outbuf, buffer_info, info, inbuf, COLOR_FORMAT_COPY_IN); }
static gboolean gst_amc_video_dec_fill_buffer (GstAmcVideoDec * self, GstAmcBuffer * buf, const GstAmcBufferInfo * buffer_info, GstBuffer * outbuf) { GstVideoCodecState *state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (self)); GstVideoInfo *info = &state->info; gboolean ret = FALSE; ret = gst_amc_color_format_copy (&self->color_format_info, buf, buffer_info, info, outbuf, COLOR_FORMAT_COPY_OUT); gst_video_codec_state_unref (state); return ret; }