mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
ext/ffmpeg/gstffmpegcodecmap.c: Recognize video/x-raw-gray and map to proper pixfmt.
Original commit message from CVS: * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt): Recognize video/x-raw-gray and map to proper pixfmt. * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_setcaps), (gst_ffmpegenc_chain_video): Fail negotiation if pixfmt cannot be determined from input caps. Prevent segfault accessing non-existant coded_frame, provide some warning debug output instead.
This commit is contained in:
parent
e4679bb66e
commit
f86e548d47
3 changed files with 35 additions and 2 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2008-07-28 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
|
||||||
|
|
||||||
|
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_pixfmt):
|
||||||
|
Recognize video/x-raw-gray and map to proper pixfmt.
|
||||||
|
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_setcaps),
|
||||||
|
(gst_ffmpegenc_chain_video):
|
||||||
|
Fail negotiation if pixfmt cannot be determined from input caps.
|
||||||
|
Prevent segfault accessing non-existant coded_frame, provide some
|
||||||
|
warning debug output instead.
|
||||||
|
|
||||||
2008-07-23 Edward Hervey <edward.hervey@collabora.co.uk>
|
2008-07-23 Edward Hervey <edward.hervey@collabora.co.uk>
|
||||||
|
|
||||||
* ffmpegrev:
|
* ffmpegrev:
|
||||||
|
|
|
@ -1556,6 +1556,17 @@ gst_ffmpeg_caps_to_pixfmt (const GstCaps * caps,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if (strcmp (gst_structure_get_name (structure),
|
||||||
|
"video/x-raw-gray") == 0) {
|
||||||
|
gint bpp = 0;
|
||||||
|
|
||||||
|
if (gst_structure_get_int (structure, "bpp", &bpp)) {
|
||||||
|
switch (bpp) {
|
||||||
|
case 8:
|
||||||
|
context->pix_fmt = PIX_FMT_GRAY8;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -527,6 +527,14 @@ gst_ffmpegenc_setcaps (GstPad * pad, GstCaps * caps)
|
||||||
oclass->in_plugin->name, pix_fmt, ffmpegenc->context->pix_fmt);
|
oclass->in_plugin->name, pix_fmt, ffmpegenc->context->pix_fmt);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
/* we may have failed mapping caps to a pixfmt,
|
||||||
|
* and quite some codecs do not make up their own mind about that
|
||||||
|
* in any case, _NONE can never work out later on */
|
||||||
|
if (oclass->in_plugin->type == CODEC_TYPE_VIDEO && pix_fmt == PIX_FMT_NONE) {
|
||||||
|
GST_DEBUG_OBJECT (ffmpegenc, "ffenc_%s: Failed to determine input format",
|
||||||
|
oclass->in_plugin->name);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* some codecs support more than one format, first auto-choose one */
|
/* some codecs support more than one format, first auto-choose one */
|
||||||
GST_DEBUG_OBJECT (ffmpegenc, "picking an output format ...");
|
GST_DEBUG_OBJECT (ffmpegenc, "picking an output format ...");
|
||||||
|
@ -652,8 +660,12 @@ gst_ffmpegenc_chain_video (GstPad * pad, GstBuffer * inbuf)
|
||||||
memcpy (GST_BUFFER_DATA (outbuf), ffmpegenc->working_buf, ret_size);
|
memcpy (GST_BUFFER_DATA (outbuf), ffmpegenc->working_buf, ret_size);
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
|
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
|
||||||
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
|
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
|
||||||
|
/* buggy codec may not set coded_frame */
|
||||||
|
if (ffmpegenc->context->coded_frame) {
|
||||||
if (!ffmpegenc->context->coded_frame->key_frame)
|
if (!ffmpegenc->context->coded_frame->key_frame)
|
||||||
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
|
||||||
|
} else
|
||||||
|
GST_WARNING_OBJECT (ffmpegenc, "codec did not provide keyframe info");
|
||||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegenc->srcpad));
|
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (ffmpegenc->srcpad));
|
||||||
|
|
||||||
gst_buffer_unref (inbuf);
|
gst_buffer_unref (inbuf);
|
||||||
|
|
Loading…
Reference in a new issue