return TRUE;
}
+
+GstFlowReturn
+gst_va_base_dec_prepare_output_frame (GstVaBaseDec * base,
+ GstVideoCodecFrame * frame)
+{
+ GstVideoDecoder *vdec = GST_VIDEO_DECODER (base);
+
+ if (base->need_negotiation) {
+ if (!gst_video_decoder_negotiate (vdec)) {
+ GST_ERROR_OBJECT (base, "Failed to negotiate with downstream");
+ return GST_FLOW_NOT_NEGOTIATED;
+ }
+ }
+
+ if (frame)
+ return gst_video_decoder_allocate_output_frame (vdec, frame);
+ return GST_FLOW_OK;
+}
gboolean gst_va_base_dec_process_output (GstVaBaseDec * base,
GstVideoCodecFrame * frame,
GstVideoBufferFlags buffer_flags);
+GstFlowReturn gst_va_base_dec_prepare_output_frame (GstVaBaseDec * base,
+ GstVideoCodecFrame * frame);
+
G_END_DECLS
GstVideoCodecFrame * frame, GstH264Picture * picture)
{
GstVaH264Dec *self = GST_VA_H264_DEC (decoder);
- GstVaDecodePicture *pic;
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
+ GstVaDecodePicture *pic;
GstFlowReturn ret;
- if (base->need_negotiation) {
- if (!gst_video_decoder_negotiate (vdec)) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
-
- ret = gst_video_decoder_allocate_output_frame (vdec, frame);
+ ret = gst_va_base_dec_prepare_output_frame (base, frame);
if (ret != GST_FLOW_OK)
goto error;
GstJpegFrameHdr * frame_hdr)
{
GstVaJpegDec *self = GST_VA_JPEG_DEC (decoder);
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstFlowReturn ret;
VAProfile profile;
gst_va_profile_name (profile), rt_format, base->width, base->height);
}
- if (base->need_negotiation) {
- if (!gst_video_decoder_negotiate (vdec)) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
-
- ret = gst_video_decoder_allocate_output_frame (vdec, frame);
+ ret = gst_va_base_dec_prepare_output_frame (base, frame);
if (ret != GST_FLOW_OK) {
GST_ERROR_OBJECT (self, "Failed to allocate output buffer: %s",
gst_flow_get_name (ret));
gst_va_mpeg2_dec_new_picture (GstMpeg2Decoder * decoder,
GstVideoCodecFrame * frame, GstMpeg2Picture * picture)
{
- GstFlowReturn ret;
GstVaMpeg2Dec *self = GST_VA_MPEG2_DEC (decoder);
- GstVaDecodePicture *pic;
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
-
- if (base->need_negotiation) {
- if (!gst_video_decoder_negotiate (vdec)) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
+ GstVaDecodePicture *pic;
+ GstFlowReturn ret;
- ret = gst_video_decoder_allocate_output_frame (vdec, frame);
+ ret = gst_va_base_dec_prepare_output_frame (base, frame);
if (ret != GST_FLOW_OK)
goto error;
{
GstVaVp8Dec *self = GST_VA_VP8_DEC (decoder);
GstVaDecodePicture *pic;
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
GstFlowReturn ret;
- if (base->need_negotiation) {
- if (!gst_video_decoder_negotiate (vdec)) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
-
- ret = gst_video_decoder_allocate_output_frame (vdec, frame);
+ ret = gst_va_base_dec_prepare_output_frame (base, frame);
if (ret != GST_FLOW_OK)
goto error;
GstFlowReturn ret;
GstVaVp9Dec *self = GST_VA_VP9_DEC (decoder);
GstVaDecodePicture *pic;
- GstVideoDecoder *vdec = GST_VIDEO_DECODER (decoder);
GstVaBaseDec *base = GST_VA_BASE_DEC (decoder);
ret = _check_resolution_change (self, picture);
if (ret != GST_FLOW_OK)
return ret;
- if (base->need_negotiation) {
- if (!gst_video_decoder_negotiate (vdec)) {
- GST_ERROR_OBJECT (self, "Failed to negotiate with downstream");
- return GST_FLOW_NOT_NEGOTIATED;
- }
- }
-
- ret = gst_video_decoder_allocate_output_frame (vdec, frame);
+ ret = gst_va_base_dec_prepare_output_frame (base, frame);
if (ret != GST_FLOW_OK)
goto error;