mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
ext/ffmpeg/gstffmpegcodecmap.c: Add more specific width/height for DV video so that it negotiates more automatically.
Original commit message from CVS: * ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_vid_caps_new), (gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_with_codecid): Add more specific width/height for DV video so that it negotiates more automatically. Try to avoid accessing NULL caps. * ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps): Add some more debuggin to the caps generation.
This commit is contained in:
parent
2a2f93fd72
commit
b150447eae
3 changed files with 61 additions and 10 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2008-05-26 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||
|
||||
* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ff_vid_caps_new),
|
||||
(gst_ffmpeg_pixfmt_to_caps), (gst_ffmpeg_caps_with_codecid):
|
||||
Add more specific width/height for DV video so that it negotiates more
|
||||
automatically.
|
||||
Try to avoid accessing NULL caps.
|
||||
|
||||
* ext/ffmpeg/gstffmpegenc.c: (gst_ffmpegenc_getcaps):
|
||||
Add some more debuggin to the caps generation.
|
||||
|
||||
2008-05-26 Sebastian Dröge <slomo@circular-chaos.org>
|
||||
|
||||
* Makefile.am:
|
||||
|
|
|
@ -116,6 +116,24 @@ gst_ff_vid_caps_new (AVCodecContext * context, enum CodecID codec_id,
|
|||
}
|
||||
break;
|
||||
}
|
||||
case CODEC_ID_DVVIDEO:
|
||||
{
|
||||
const static gint widths[] = { 720, 720 };
|
||||
const static gint heights[] = { 576, 480 };
|
||||
GstCaps *temp;
|
||||
gint n_sizes = G_N_ELEMENTS (widths);
|
||||
|
||||
caps = gst_caps_new_empty ();
|
||||
for (i = 0; i < n_sizes; i++) {
|
||||
temp = gst_caps_new_simple (mimetype,
|
||||
"width", G_TYPE_INT, widths[i],
|
||||
"height", G_TYPE_INT, heights[i],
|
||||
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
||||
|
||||
gst_caps_append (caps, temp);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
caps = gst_caps_new_simple (mimetype,
|
||||
"width", GST_TYPE_INT_RANGE, 16, 4096,
|
||||
|
@ -1212,22 +1230,31 @@ gst_ffmpeg_pixfmt_to_caps (enum PixelFormat pix_fmt, AVCodecContext * context,
|
|||
if (caps == NULL) {
|
||||
if (bpp != 0) {
|
||||
if (r_mask != 0) {
|
||||
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb",
|
||||
if (a_mask) {
|
||||
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"red_mask", G_TYPE_INT, r_mask,
|
||||
"green_mask", G_TYPE_INT, g_mask,
|
||||
"blue_mask", G_TYPE_INT, b_mask,
|
||||
"alpha_mask", G_TYPE_INT, a_mask,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
}
|
||||
else {
|
||||
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"red_mask", G_TYPE_INT, r_mask,
|
||||
"green_mask", G_TYPE_INT, g_mask,
|
||||
"blue_mask", G_TYPE_INT, b_mask,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
if (a_mask) {
|
||||
gst_caps_set_simple (caps, "alpha_mask", G_TYPE_INT, a_mask, NULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
caps = gst_ff_vid_caps_new (context, codec_id, "video/x-raw-rgb",
|
||||
"bpp", G_TYPE_INT, bpp,
|
||||
"depth", G_TYPE_INT, depth,
|
||||
"endianness", G_TYPE_INT, endianness, NULL);
|
||||
if (context) {
|
||||
if (caps && context) {
|
||||
gst_ffmpeg_set_palette (caps, context);
|
||||
}
|
||||
}
|
||||
|
@ -1705,7 +1732,6 @@ gst_ffmpeg_caps_with_codecid (enum CodecID codec_id,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -287,20 +287,30 @@ gst_ffmpegenc_getcaps (GstPad * pad)
|
|||
enum PixelFormat pixfmt;
|
||||
GstCaps *caps = NULL;
|
||||
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "getting caps");
|
||||
|
||||
/* audio needs no special care */
|
||||
if (oclass->in_plugin->type == CODEC_TYPE_AUDIO) {
|
||||
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "audio caps, return template %"GST_PTR_FORMAT, caps);
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
/* cached */
|
||||
if (oclass->sinkcaps) {
|
||||
return gst_caps_copy (oclass->sinkcaps);
|
||||
caps = gst_caps_copy (oclass->sinkcaps);
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "return cached caps %"GST_PTR_FORMAT, caps);
|
||||
return caps;
|
||||
}
|
||||
|
||||
/* create cache etc. */
|
||||
ctx = avcodec_alloc_context ();
|
||||
if (!ctx) {
|
||||
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "no context, return template caps %"GST_PTR_FORMAT, caps);
|
||||
return caps;
|
||||
}
|
||||
|
||||
/* set some default properties */
|
||||
|
@ -321,6 +331,7 @@ gst_ffmpegenc_getcaps (GstPad * pad)
|
|||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
_shut_up_I_am_probing = TRUE;
|
||||
#endif
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "probing caps");
|
||||
for (pixfmt = 0; pixfmt < PIX_FMT_NB; pixfmt++) {
|
||||
GstCaps *tmpcaps;
|
||||
|
||||
|
@ -350,9 +361,12 @@ gst_ffmpegenc_getcaps (GstPad * pad)
|
|||
|
||||
/* make sure we have something */
|
||||
if (!caps) {
|
||||
return gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "probing gave nothing, return template %"GST_PTR_FORMAT, caps);
|
||||
return caps;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (ffmpegenc, "probed caps gave %"GST_PTR_FORMAT, caps);
|
||||
oclass->sinkcaps = gst_caps_copy (caps);
|
||||
|
||||
return caps;
|
||||
|
|
Loading…
Reference in a new issue