mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +00:00
v4l2codecs: decoders: Introduce and use set_output_state helper class
Allowing us to avoid some code duplication. This will become more important with upcoming changes to caps generation. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5890>
This commit is contained in:
parent
a95acbcc11
commit
513d0d8cbb
8 changed files with 35 additions and 30 deletions
|
@ -334,11 +334,8 @@ done:
|
||||||
gst_video_codec_state_unref (self->output_state);
|
gst_video_codec_state_unref (self->output_state);
|
||||||
|
|
||||||
self->output_state =
|
self->output_state =
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
|
gst_v4l2_decoder_set_output_state (GST_VIDEO_DECODER (self), &self->vinfo,
|
||||||
self->vinfo.finfo->format, self->render_width,
|
self->render_width, self->render_height, av1dec->input_state);
|
||||||
self->render_height, av1dec->input_state);
|
|
||||||
|
|
||||||
self->output_state->caps = gst_video_info_to_caps (&self->output_state->info);
|
|
||||||
|
|
||||||
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
||||||
if (self->streaming)
|
if (self->streaming)
|
||||||
|
|
|
@ -377,15 +377,12 @@ done:
|
||||||
gst_video_codec_state_unref (self->output_state);
|
gst_video_codec_state_unref (self->output_state);
|
||||||
|
|
||||||
self->output_state =
|
self->output_state =
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
|
gst_v4l2_decoder_set_output_state (GST_VIDEO_DECODER (self), &self->vinfo,
|
||||||
self->vinfo.finfo->format, self->display_width,
|
self->display_width, self->display_height, h264dec->input_state);
|
||||||
self->display_height, h264dec->input_state);
|
|
||||||
|
|
||||||
if (self->interlaced)
|
if (self->interlaced)
|
||||||
self->output_state->info.interlace_mode = GST_VIDEO_INTERLACE_MODE_MIXED;
|
self->output_state->info.interlace_mode = GST_VIDEO_INTERLACE_MODE_MIXED;
|
||||||
|
|
||||||
self->output_state->caps = gst_video_info_to_caps (&self->output_state->info);
|
|
||||||
|
|
||||||
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
||||||
if (self->streaming)
|
if (self->streaming)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -411,11 +411,8 @@ done:
|
||||||
gst_video_codec_state_unref (self->output_state);
|
gst_video_codec_state_unref (self->output_state);
|
||||||
|
|
||||||
self->output_state =
|
self->output_state =
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
|
gst_v4l2_decoder_set_output_state (GST_VIDEO_DECODER (self), &self->vinfo,
|
||||||
self->vinfo.finfo->format, self->display_width,
|
self->display_width, self->display_height, h265dec->input_state);
|
||||||
self->display_height, h265dec->input_state);
|
|
||||||
|
|
||||||
self->output_state->caps = gst_video_info_to_caps (&self->output_state->info);
|
|
||||||
|
|
||||||
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
||||||
if (self->streaming)
|
if (self->streaming)
|
||||||
|
|
|
@ -299,16 +299,13 @@ done:
|
||||||
gst_video_codec_state_unref (self->output_state);
|
gst_video_codec_state_unref (self->output_state);
|
||||||
|
|
||||||
self->output_state =
|
self->output_state =
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
|
gst_v4l2_decoder_set_output_state (GST_VIDEO_DECODER (self), &self->vinfo,
|
||||||
self->vinfo.finfo->format, self->width,
|
self->width, self->height, mpeg2dec->input_state);
|
||||||
self->height, mpeg2dec->input_state);
|
|
||||||
|
|
||||||
if (self->interlaced)
|
if (self->interlaced)
|
||||||
self->output_state->info.interlace_mode =
|
self->output_state->info.interlace_mode =
|
||||||
GST_VIDEO_INTERLACE_MODE_INTERLEAVED;
|
GST_VIDEO_INTERLACE_MODE_INTERLEAVED;
|
||||||
|
|
||||||
self->output_state->caps = gst_video_info_to_caps (&self->output_state->info);
|
|
||||||
|
|
||||||
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
||||||
if (self->streaming)
|
if (self->streaming)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -248,11 +248,8 @@ done:
|
||||||
gst_video_codec_state_unref (self->output_state);
|
gst_video_codec_state_unref (self->output_state);
|
||||||
|
|
||||||
self->output_state =
|
self->output_state =
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
|
gst_v4l2_decoder_set_output_state (GST_VIDEO_DECODER (self), &self->vinfo,
|
||||||
self->vinfo.finfo->format, self->width,
|
self->width, self->height, vp8dec->input_state);
|
||||||
self->height, vp8dec->input_state);
|
|
||||||
|
|
||||||
self->output_state->caps = gst_video_info_to_caps (&self->output_state->info);
|
|
||||||
|
|
||||||
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
||||||
if (self->streaming)
|
if (self->streaming)
|
||||||
|
|
|
@ -518,11 +518,8 @@ done:
|
||||||
gst_video_codec_state_unref (self->output_state);
|
gst_video_codec_state_unref (self->output_state);
|
||||||
|
|
||||||
self->output_state =
|
self->output_state =
|
||||||
gst_video_decoder_set_output_state (GST_VIDEO_DECODER (self),
|
gst_v4l2_decoder_set_output_state (GST_VIDEO_DECODER (self), &self->vinfo,
|
||||||
self->vinfo.finfo->format, self->width,
|
self->width, self->height, vp9dec->input_state);
|
||||||
self->height, vp9dec->input_state);
|
|
||||||
|
|
||||||
self->output_state->caps = gst_video_info_to_caps (&self->output_state->info);
|
|
||||||
|
|
||||||
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
if (GST_VIDEO_DECODER_CLASS (parent_class)->negotiate (decoder)) {
|
||||||
if (self->streaming)
|
if (self->streaming)
|
||||||
|
|
|
@ -554,6 +554,23 @@ gst_v4l2_decoder_select_src_format (GstV4l2Decoder * self, GstCaps * caps,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GstVideoCodecState *
|
||||||
|
gst_v4l2_decoder_set_output_state (GstVideoDecoder * decoder,
|
||||||
|
GstVideoInfo * vinfo, guint width, guint height,
|
||||||
|
GstVideoCodecState * reference)
|
||||||
|
{
|
||||||
|
GstVideoCodecState *state;
|
||||||
|
|
||||||
|
state = gst_video_decoder_set_output_state (decoder, vinfo->finfo->format,
|
||||||
|
width, height, reference);
|
||||||
|
|
||||||
|
state->caps = gst_video_info_to_caps (&state->info);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (decoder, "Setting caps: %" GST_PTR_FORMAT, state->caps);
|
||||||
|
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
gint
|
gint
|
||||||
gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
|
gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
|
||||||
GstPadDirection direction, guint num_buffers)
|
GstPadDirection direction, guint num_buffers)
|
||||||
|
|
|
@ -74,6 +74,12 @@ gboolean gst_v4l2_decoder_select_src_format (GstV4l2Decoder * self,
|
||||||
GstCaps * caps,
|
GstCaps * caps,
|
||||||
GstVideoInfo * vinfo);
|
GstVideoInfo * vinfo);
|
||||||
|
|
||||||
|
GstVideoCodecState * gst_v4l2_decoder_set_output_state (GstVideoDecoder * decoder,
|
||||||
|
GstVideoInfo * vinfo,
|
||||||
|
guint width,
|
||||||
|
guint height,
|
||||||
|
GstVideoCodecState * reference);
|
||||||
|
|
||||||
gint gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
|
gint gst_v4l2_decoder_request_buffers (GstV4l2Decoder * self,
|
||||||
GstPadDirection direction,
|
GstPadDirection direction,
|
||||||
guint num_buffers);
|
guint num_buffers);
|
||||||
|
|
Loading…
Reference in a new issue