mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
vp8enc: Set timebase
Also misc cleanup.
This commit is contained in:
parent
557fe5c0e4
commit
95ddcc24fd
1 changed files with 5 additions and 7 deletions
|
@ -72,6 +72,7 @@ struct _GstVP8Enc
|
||||||
|
|
||||||
/* state */
|
/* state */
|
||||||
|
|
||||||
|
gboolean force_keyframe;
|
||||||
gboolean inited;
|
gboolean inited;
|
||||||
|
|
||||||
int resolution_id;
|
int resolution_id;
|
||||||
|
@ -570,8 +571,8 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||||
|
|
||||||
cfg.g_w = base_video_encoder->state.width;
|
cfg.g_w = base_video_encoder->state.width;
|
||||||
cfg.g_h = base_video_encoder->state.height;
|
cfg.g_h = base_video_encoder->state.height;
|
||||||
//cfg.g_timebase.num = base_video_encoder->state.fps_n;
|
cfg.g_timebase.num = base_video_encoder->state.fps_d;
|
||||||
//cfg.g_timebase.den = base_video_encoder->state.fps_d;
|
cfg.g_timebase.den = base_video_encoder->state.fps_n;
|
||||||
|
|
||||||
cfg.g_error_resilient = encoder->error_resilient;
|
cfg.g_error_resilient = encoder->error_resilient;
|
||||||
cfg.g_pass = VPX_RC_ONE_PASS;
|
cfg.g_pass = VPX_RC_ONE_PASS;
|
||||||
|
@ -617,11 +618,9 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||||
hook->image = image;
|
hook->image = image;
|
||||||
frame->coder_hook = hook;
|
frame->coder_hook = hook;
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (encoder->force_keyframe) {
|
if (encoder->force_keyframe) {
|
||||||
flags |= VPX_EFLAG_FORCE_KF;
|
flags |= VPX_EFLAG_FORCE_KF;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
status = vpx_codec_encode (&encoder->encoder, image,
|
status = vpx_codec_encode (&encoder->encoder, image,
|
||||||
encoder->n_frames, 1, flags, speed_table[encoder->speed]);
|
encoder->n_frames, 1, flags, speed_table[encoder->speed]);
|
||||||
|
@ -632,7 +631,7 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||||
pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter);
|
pkt = vpx_codec_get_cx_data (&encoder->encoder, &iter);
|
||||||
while (pkt != NULL) {
|
while (pkt != NULL) {
|
||||||
GstBuffer *buffer;
|
GstBuffer *buffer;
|
||||||
gboolean invisible, keyframe;
|
gboolean invisible;
|
||||||
|
|
||||||
GST_DEBUG ("packet %d type %d", pkt->data.frame.sz, pkt->kind);
|
GST_DEBUG ("packet %d type %d", pkt->data.frame.sz, pkt->kind);
|
||||||
|
|
||||||
|
@ -642,7 +641,7 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||||
}
|
}
|
||||||
|
|
||||||
invisible = (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) != 0;
|
invisible = (pkt->data.frame.flags & VPX_FRAME_IS_INVISIBLE) != 0;
|
||||||
keyframe = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
|
frame->is_sync_point = (pkt->data.frame.flags & VPX_FRAME_IS_KEY) != 0;
|
||||||
frame = gst_base_video_encoder_get_oldest_frame (base_video_encoder);
|
frame = gst_base_video_encoder_get_oldest_frame (base_video_encoder);
|
||||||
hook = frame->coder_hook;
|
hook = frame->coder_hook;
|
||||||
/* FIXME: If frame is NULL something went really wrong! */
|
/* FIXME: If frame is NULL something went really wrong! */
|
||||||
|
@ -650,7 +649,6 @@ gst_vp8_enc_handle_frame (GstBaseVideoEncoder * base_video_encoder,
|
||||||
buffer = gst_buffer_new_and_alloc (pkt->data.frame.sz);
|
buffer = gst_buffer_new_and_alloc (pkt->data.frame.sz);
|
||||||
|
|
||||||
memcpy (GST_BUFFER_DATA (buffer), pkt->data.frame.buf, pkt->data.frame.sz);
|
memcpy (GST_BUFFER_DATA (buffer), pkt->data.frame.buf, pkt->data.frame.sz);
|
||||||
frame->is_sync_point = frame->is_sync_point || keyframe;
|
|
||||||
|
|
||||||
if (hook->image)
|
if (hook->image)
|
||||||
g_free (hook->image);
|
g_free (hook->image);
|
||||||
|
|
Loading…
Reference in a new issue