+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>
* ffmpegrev:
}
}
}
+ } 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;
+ }
+ }
}
}
oclass->in_plugin->name, pix_fmt, ffmpegenc->context->pix_fmt);
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 */
GST_DEBUG_OBJECT (ffmpegenc, "picking an output format ...");
memcpy (GST_BUFFER_DATA (outbuf), ffmpegenc->working_buf, ret_size);
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (inbuf);
GST_BUFFER_DURATION (outbuf) = GST_BUFFER_DURATION (inbuf);
- if (!ffmpegenc->context->coded_frame->key_frame)
- GST_BUFFER_FLAG_SET (outbuf, GST_BUFFER_FLAG_DELTA_UNIT);
+ /* buggy codec may not set coded_frame */
+ if (ffmpegenc->context->coded_frame) {
+ if (!ffmpegenc->context->coded_frame->key_frame)
+ 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_unref (inbuf);