mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-06 10:42:22 +00:00
gst/ffmpegcolorspace/gstffmpegcolorspace.c: We are asked to compute a buffer size from caps, let's use the caps...
Original commit message from CVS: 2005-10-17 Julien MOUTTE <julien@moutte.net> * gst/ffmpegcolorspace/gstffmpegcolorspace.c: (gst_ffmpegcsp_get_unit_size): We are asked to compute a buffer size from caps, let's use the caps...
This commit is contained in:
parent
9315aee952
commit
746a33e720
2 changed files with 24 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2005-10-17 Julien MOUTTE <julien@moutte.net>
|
||||||
|
|
||||||
|
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
|
||||||
|
(gst_ffmpegcsp_get_unit_size): We are asked to compute a buffer size
|
||||||
|
from caps, let's use the caps...
|
||||||
|
|
||||||
2005-10-17 Thomas Vander Stichele <thomas at apestaart dot org>
|
2005-10-17 Thomas Vander Stichele <thomas at apestaart dot org>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -305,17 +305,28 @@ static gboolean
|
||||||
gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||||
guint * size)
|
guint * size)
|
||||||
{
|
{
|
||||||
GstFFMpegCsp *space;
|
GstFFMpegCsp *space = NULL;
|
||||||
|
GstStructure *structure = NULL;
|
||||||
|
AVCodecContext *ctx = NULL;
|
||||||
|
gint width, height;
|
||||||
|
|
||||||
g_return_val_if_fail (size, FALSE);
|
g_return_val_if_fail (size, FALSE);
|
||||||
|
|
||||||
space = GST_FFMPEGCSP (btrans);
|
space = GST_FFMPEGCSP (btrans);
|
||||||
if (gst_caps_is_equal (caps, GST_PAD_CAPS (btrans->srcpad))) {
|
|
||||||
*size = avpicture_get_size (space->to_pixfmt, space->width, space->height);
|
structure = gst_caps_get_structure (caps, 0);
|
||||||
} else if (gst_caps_is_equal (caps, GST_PAD_CAPS (btrans->sinkpad))) {
|
gst_structure_get_int (structure, "width", &width);
|
||||||
*size =
|
gst_structure_get_int (structure, "height", &height);
|
||||||
avpicture_get_size (space->from_pixfmt, space->width, space->height);
|
|
||||||
}
|
ctx = avcodec_alloc_context ();
|
||||||
|
|
||||||
|
g_assert (ctx != NULL);
|
||||||
|
|
||||||
|
gst_ffmpegcsp_caps_with_codectype (CODEC_TYPE_VIDEO, caps, ctx);
|
||||||
|
|
||||||
|
*size = avpicture_get_size (ctx->pix_fmt, width, height);
|
||||||
|
|
||||||
|
av_free (ctx);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue