mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-09-08 13:18:52 +00:00
basevideoencoder: invoke subclass start method at state change
While this changes order w.r.t. set_format, which is OK for unstable API, it has following merits: * symmetric w.r.t. stop at state change * in line with other base class practice * little benefit in invoking 2 subclass virtual methods (set_format and start) in immediate succession; all actions in the second could be done in the first whereas subclass has no chance to do anything 'global' at activation time Moreover, current -bad subclass relevant methods either trivially commute or are either trivially adjusted accordingly.
This commit is contained in:
parent
d567fa2834
commit
4b5623d687
3 changed files with 10 additions and 13 deletions
|
@ -421,6 +421,10 @@ gst_dirac_enc_set_format (GstBaseVideoEncoder * base_video_encoder,
|
|||
dirac_enc->enc_ctx.decode_flag = 0;
|
||||
dirac_enc->enc_ctx.instr_flag = 0;
|
||||
|
||||
dirac_enc->granule_offset = ~0;
|
||||
|
||||
dirac_enc->encoder = dirac_encoder_init (&dirac_enc->enc_ctx, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -821,12 +825,6 @@ error:
|
|||
static gboolean
|
||||
gst_dirac_enc_start (GstBaseVideoEncoder * base_video_encoder)
|
||||
{
|
||||
GstDiracEnc *dirac_enc = GST_DIRAC_ENC (base_video_encoder);
|
||||
|
||||
dirac_enc->granule_offset = ~0;
|
||||
|
||||
dirac_enc->encoder = dirac_encoder_init (&dirac_enc->enc_ctx, FALSE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -338,6 +338,8 @@ gst_schro_enc_set_format (GstBaseVideoEncoder * base_video_encoder,
|
|||
gst_schro_wrap_schro_buffer (schro_encoder_encode_sequence_header
|
||||
(schro_enc->encoder));
|
||||
|
||||
schro_enc->granule_offset = ~0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -413,10 +415,6 @@ gst_schro_enc_get_property (GObject * object, guint prop_id, GValue * value,
|
|||
static gboolean
|
||||
gst_schro_enc_start (GstBaseVideoEncoder * base_video_encoder)
|
||||
{
|
||||
GstSchroEnc *schro_enc = GST_SCHRO_ENC (base_video_encoder);
|
||||
|
||||
schro_enc->granule_offset = ~0;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -164,9 +164,6 @@ gst_base_video_encoder_sink_setcaps (GstPad * pad, GstCaps * caps)
|
|||
|
||||
ret = base_video_encoder_class->set_format (base_video_encoder,
|
||||
&GST_BASE_VIDEO_CODEC (base_video_encoder)->state);
|
||||
if (ret) {
|
||||
ret = base_video_encoder_class->start (base_video_encoder);
|
||||
}
|
||||
|
||||
g_object_unref (base_video_encoder);
|
||||
|
||||
|
@ -489,6 +486,10 @@ gst_base_video_encoder_change_state (GstElement * element,
|
|||
switch (transition) {
|
||||
case GST_STATE_CHANGE_READY_TO_PAUSED:
|
||||
gst_base_video_encoder_reset (base_video_encoder);
|
||||
gst_base_video_encoder_reset (base_video_encoder);
|
||||
if (base_video_encoder_class->start) {
|
||||
base_video_encoder_class->start (base_video_encoder);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue