applemedia: vtdec: set the correct video format in the video meta

Fixes all kinds of weird bugs when videoconvert is used with the decoder.
This commit is contained in:
Alessandro Decina 2013-12-10 11:10:54 +01:00
parent 631d5d94ed
commit 7dffa2e1f2
2 changed files with 6 additions and 4 deletions

View file

@ -102,10 +102,9 @@ gst_core_video_buffer_new (CVBufferRef cvbuf, GstVideoInfo * vinfo)
for (i = 0; i < n_planes; ++i)
stride[i] = CVPixelBufferGetBytesPerRowOfPlane (pixbuf, i);
/* FIXME: don't hardcode NV12 */
gst_video_info_init (&tmp_vinfo);
gst_video_info_set_format (&tmp_vinfo,
GST_VIDEO_FORMAT_NV12, stride[0], height);
vinfo->finfo->format, stride[0], height);
offset[1] = tmp_vinfo.offset[1];
size = tmp_vinfo.size;
} else {
@ -124,7 +123,7 @@ gst_core_video_buffer_new (CVBufferRef cvbuf, GstVideoInfo * vinfo)
width = vinfo->width;
video_meta =
gst_buffer_add_video_meta_full (buf, GST_VIDEO_FRAME_FLAG_NONE,
GST_VIDEO_FORMAT_NV12, width, height, n_planes, offset, stride);
vinfo->finfo->format, width, height, n_planes, offset, stride);
}
return buf;

View file

@ -490,6 +490,7 @@ gst_vtdec_session_output_callback (void *decompression_output_ref_con,
GstVtdec *vtdec = (GstVtdec *) decompression_output_ref_con;
GstVideoCodecFrame *frame = (GstVideoCodecFrame *) source_frame_ref_con;
GstBuffer *buf;
GstVideoCodecState *state;
GST_LOG_OBJECT (vtdec, "got output frame %p %d", frame,
frame->decode_frame_number);
@ -503,7 +504,9 @@ gst_vtdec_session_output_callback (void *decompression_output_ref_con,
goto drop;
/* FIXME: use gst_video_decoder_allocate_output_buffer */
buf = gst_core_video_buffer_new (image_buffer, &vtdec->video_info);
state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (vtdec));
buf = gst_core_video_buffer_new (image_buffer, &state->info);
gst_video_codec_state_unref (state);
frame->output_buffer = buf;
gst_buffer_copy_into (buf, frame->input_buffer,