mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 21:35:44 +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>
|
||||
|
||||
* configure.ac:
|
||||
|
|
|
@ -305,17 +305,28 @@ static gboolean
|
|||
gst_ffmpegcsp_get_unit_size (GstBaseTransform * btrans, GstCaps * caps,
|
||||
guint * size)
|
||||
{
|
||||
GstFFMpegCsp *space;
|
||||
GstFFMpegCsp *space = NULL;
|
||||
GstStructure *structure = NULL;
|
||||
AVCodecContext *ctx = NULL;
|
||||
gint width, height;
|
||||
|
||||
g_return_val_if_fail (size, FALSE);
|
||||
|
||||
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);
|
||||
} else if (gst_caps_is_equal (caps, GST_PAD_CAPS (btrans->sinkpad))) {
|
||||
*size =
|
||||
avpicture_get_size (space->from_pixfmt, space->width, space->height);
|
||||
}
|
||||
|
||||
structure = gst_caps_get_structure (caps, 0);
|
||||
gst_structure_get_int (structure, "width", &width);
|
||||
gst_structure_get_int (structure, "height", &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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue