mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-23 18:21:04 +00:00
basevideodecoder: really and only set src pad caps whenever requested
... since subclass is expected to be wise enough to know when to do so.
This commit is contained in:
parent
550237347b
commit
1b151caf11
4 changed files with 13 additions and 36 deletions
|
@ -382,9 +382,7 @@ parse_sequence_header (GstSchroDec * schro_dec, guint8 * data, int size)
|
|||
state->par_d = video_format.aspect_ratio_denominator;
|
||||
GST_DEBUG ("Pixel aspect ratio is %d/%d", state->par_n, state->par_d);
|
||||
|
||||
/* FIXME state points to what is actually in the decoder */
|
||||
//gst_base_video_decoder_set_state (GST_BASE_VIDEO_DECODER (schro_dec),
|
||||
// state);
|
||||
gst_base_video_decoder_set_src_caps (GST_BASE_VIDEO_DECODER (schro_dec));
|
||||
} else {
|
||||
GST_WARNING ("Failed to get frame rate from sequence header");
|
||||
}
|
||||
|
|
|
@ -399,11 +399,11 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame)
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
/* should set size here */
|
||||
state->width = stream_info.w;
|
||||
state->height = stream_info.h;
|
||||
state->format = GST_VIDEO_FORMAT_I420;
|
||||
gst_vp8_dec_send_tags (dec);
|
||||
gst_base_video_decoder_set_src_caps (decoder);
|
||||
|
||||
caps = vpx_codec_get_caps (&vpx_codec_vp8_dx_algo);
|
||||
|
||||
|
@ -445,21 +445,6 @@ gst_vp8_dec_handle_frame (GstBaseVideoDecoder * decoder, GstVideoFrame * frame)
|
|||
if (!GST_BUFFER_FLAG_IS_SET (frame->sink_buffer, GST_BUFFER_FLAG_DELTA_UNIT))
|
||||
gst_base_video_decoder_set_sync_point (decoder);
|
||||
|
||||
#if 0
|
||||
if (GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (decoder)) == NULL) {
|
||||
GstCaps *caps;
|
||||
|
||||
caps = gst_video_format_new_caps (decoder->state.format,
|
||||
decoder->state.width, decoder->state.height,
|
||||
decoder->state.fps_n, decoder->state.fps_d,
|
||||
decoder->state.par_n, decoder->state.par_d);
|
||||
|
||||
GST_DEBUG ("setting caps %" GST_PTR_FORMAT, caps);
|
||||
|
||||
gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (decoder), caps);
|
||||
}
|
||||
#endif
|
||||
|
||||
deadline = gst_base_video_decoder_get_max_decode_time (decoder, frame);
|
||||
if (deadline < 0) {
|
||||
decoder_deadline = 1;
|
||||
|
|
|
@ -1245,7 +1245,6 @@ gst_base_video_decoder_finish_frame (GstBaseVideoDecoder * base_video_decoder,
|
|||
GST_BASE_VIDEO_CODEC (base_video_decoder)->time = GST_CLOCK_TIME_NONE;
|
||||
}
|
||||
|
||||
gst_base_video_decoder_set_src_caps (base_video_decoder);
|
||||
gst_buffer_set_caps (src_buffer,
|
||||
GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder)));
|
||||
|
||||
|
@ -1583,9 +1582,6 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
|
|||
g_return_val_if_fail (state->width != 0, FALSE);
|
||||
g_return_val_if_fail (state->height != 0, FALSE);
|
||||
|
||||
if (GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder)) != NULL)
|
||||
return;
|
||||
|
||||
/* sanitize */
|
||||
if (state->fps_d == 0) {
|
||||
state->fps_n = 0;
|
||||
|
@ -1599,9 +1595,6 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
|
|||
caps = gst_video_format_new_caps (state->format,
|
||||
state->width, state->height,
|
||||
state->fps_n, state->fps_d, state->par_n, state->par_d);
|
||||
/* arrange for derived info */
|
||||
state->bytes_per_picture =
|
||||
gst_video_format_get_size (state->format, state->width, state->height);
|
||||
gst_caps_set_simple (caps, "interlaced",
|
||||
G_TYPE_BOOLEAN, state->interlaced, NULL);
|
||||
|
||||
|
@ -1610,9 +1603,12 @@ gst_base_video_decoder_set_src_caps (GstBaseVideoDecoder * base_video_decoder)
|
|||
ret =
|
||||
gst_pad_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD (base_video_decoder),
|
||||
caps);
|
||||
|
||||
gst_caps_unref (caps);
|
||||
|
||||
/* arrange for derived info */
|
||||
state->bytes_per_picture =
|
||||
gst_video_format_get_size (state->format, state->width, state->height);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1635,8 +1631,6 @@ gst_base_video_decoder_alloc_src_buffer (GstBaseVideoDecoder *
|
|||
int num_bytes;
|
||||
GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state;
|
||||
|
||||
gst_base_video_decoder_set_src_caps (base_video_decoder);
|
||||
|
||||
num_bytes = gst_video_format_get_size (state->format, state->width,
|
||||
state->height);
|
||||
GST_DEBUG ("alloc src buffer caps=%" GST_PTR_FORMAT,
|
||||
|
@ -1663,7 +1657,8 @@ gst_base_video_decoder_alloc_src_buffer (GstBaseVideoDecoder *
|
|||
*
|
||||
* Helper function that uses gst_pad_alloc_buffer_and_set_caps
|
||||
* to allocate a buffer to hold a video frame for @base_video_decoder's
|
||||
* current #GstVideoState.
|
||||
* current #GstVideoState. Subclass should already have configured video state
|
||||
* and set src pad caps.
|
||||
*
|
||||
* Returns: result from pad alloc call
|
||||
*/
|
||||
|
@ -1672,13 +1667,14 @@ gst_base_video_decoder_alloc_src_frame (GstBaseVideoDecoder *
|
|||
base_video_decoder, GstVideoFrame * frame)
|
||||
{
|
||||
GstFlowReturn flow_ret;
|
||||
int num_bytes;
|
||||
GstVideoState *state = &GST_BASE_VIDEO_CODEC (base_video_decoder)->state;
|
||||
int num_bytes = state->bytes_per_picture;
|
||||
|
||||
gst_base_video_decoder_set_src_caps (base_video_decoder);
|
||||
g_return_val_if_fail (state->bytes_per_picture != 0, GST_FLOW_ERROR);
|
||||
g_return_val_if_fail (GST_PAD_CAPS (GST_BASE_VIDEO_CODEC_SRC_PAD
|
||||
(base_video_decoder)) != NULL, GST_FLOW_ERROR);
|
||||
|
||||
num_bytes = gst_video_format_get_size (state->format, state->width,
|
||||
state->height);
|
||||
GST_LOG_OBJECT (base_video_decoder, "alloc buffer size %d", num_bytes);
|
||||
flow_ret =
|
||||
gst_pad_alloc_buffer_and_set_caps (GST_BASE_VIDEO_CODEC_SRC_PAD
|
||||
(base_video_decoder), GST_BUFFER_OFFSET_NONE, num_bytes,
|
||||
|
|
|
@ -109,8 +109,6 @@ struct _GstBaseVideoDecoder
|
|||
|
||||
/* need mark discont */
|
||||
gboolean discont;
|
||||
/* src caps set */
|
||||
gboolean have_src_caps;
|
||||
|
||||
/* combine to yield (presentation) ts */
|
||||
GstClockTime timestamp_offset;
|
||||
|
|
Loading…
Reference in a new issue