summaryrefslogtreecommitdiff
path: root/gst/rawparse
diff options
context:
space:
mode:
authorAurélien Zanelli <aurelien.zanelli@parrot.com>2016-01-07 14:18:08 +0100
committerNicolas Dufresne <nicolas.dufresne@collabora.com>2016-01-28 10:02:54 -0500
commitcf25e09b1aabbd7b4b594e718e1cb0a1ecbd1862 (patch)
tree1f95319fe52c95688e558d0b3e528270c4af0306 /gst/rawparse
parent3df615a503d1f00cb4e498ac05b95d8a1d2320dd (diff)
videoparse: cache video info in instance
To avoid initializing and filling video info each time we need it. https://bugzilla.gnome.org/show_bug.cgi?id=760270
Diffstat (limited to 'gst/rawparse')
-rw-r--r--gst/rawparse/gstvideoparse.c48
-rw-r--r--gst/rawparse/gstvideoparse.h2
2 files changed, 23 insertions, 27 deletions
diff --git a/gst/rawparse/gstvideoparse.c b/gst/rawparse/gstvideoparse.c
index b8bc7d14e..80274dee2 100644
--- a/gst/rawparse/gstvideoparse.c
+++ b/gst/rawparse/gstvideoparse.c
@@ -40,7 +40,7 @@ static GstCaps *gst_video_parse_get_caps (GstRawParse * rp);
static void gst_video_parse_set_buffer_flags (GstRawParse * rp,
GstBuffer * buffer);
-static void gst_video_parse_update_frame_size (GstVideoParse * vp);
+static void gst_video_parse_update_info (GstVideoParse * vp);
GST_DEBUG_CATEGORY_STATIC (gst_video_parse_debug);
#define GST_CAT_DEFAULT gst_video_parse_debug
@@ -126,8 +126,8 @@ gst_video_parse_init (GstVideoParse * vp)
vp->par_n = 1;
vp->par_d = 1;
- gst_video_parse_update_frame_size (vp);
gst_raw_parse_set_fps (GST_RAW_PARSE (vp), 25, 1);
+ gst_video_parse_update_info (vp);
}
static void
@@ -168,7 +168,7 @@ gst_video_parse_set_property (GObject * object, guint prop_id,
break;
}
- gst_video_parse_update_frame_size (vp);
+ gst_video_parse_update_info (vp);
}
static void
@@ -209,16 +209,27 @@ gst_video_parse_get_property (GObject * object, guint prop_id, GValue * value,
}
}
-void
-gst_video_parse_update_frame_size (GstVideoParse * vp)
+static void
+gst_video_parse_update_info (GstVideoParse * vp)
{
+ GstVideoInfo *info = &vp->info;
+ gint fps_n, fps_d;
gint framesize;
- GstVideoInfo info;
- gst_video_info_init (&info);
- gst_video_info_set_format (&info, vp->format, vp->width, vp->height);
- framesize = GST_VIDEO_INFO_SIZE (&info);
+ gst_raw_parse_get_fps (GST_RAW_PARSE (vp), &fps_n, &fps_d);
+
+ gst_video_info_init (info);
+ gst_video_info_set_format (info, vp->format, vp->width, vp->height);
+ info->fps_n = fps_n;
+ info->fps_d = fps_d;
+ info->par_n = vp->par_n;
+ info->par_d = vp->par_d;
+ info->interlace_mode = vp->interlaced ?
+ GST_VIDEO_INTERLACE_MODE_INTERLEAVED :
+ GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
+ /* update base class framesize */
+ framesize = GST_VIDEO_INFO_SIZE (info);
gst_raw_parse_set_framesize (GST_RAW_PARSE (vp), framesize);
}
@@ -226,25 +237,8 @@ static GstCaps *
gst_video_parse_get_caps (GstRawParse * rp)
{
GstVideoParse *vp = GST_VIDEO_PARSE (rp);
- GstVideoInfo info;
- GstCaps *caps;
- gint fps_n, fps_d;
-
- gst_raw_parse_get_fps (rp, &fps_n, &fps_d);
-
- gst_video_info_init (&info);
- gst_video_info_set_format (&info, vp->format, vp->width, vp->height);
- info.fps_n = fps_n;
- info.fps_d = fps_d;
- info.par_n = vp->par_n;
- info.par_d = vp->par_d;
- info.interlace_mode = vp->interlaced ?
- GST_VIDEO_INTERLACE_MODE_INTERLEAVED :
- GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;
-
- caps = gst_video_info_to_caps (&info);
- return caps;
+ return gst_video_info_to_caps (&vp->info);
}
static void
diff --git a/gst/rawparse/gstvideoparse.h b/gst/rawparse/gstvideoparse.h
index b4173df23..1cc40cb81 100644
--- a/gst/rawparse/gstvideoparse.h
+++ b/gst/rawparse/gstvideoparse.h
@@ -48,6 +48,8 @@ struct _GstVideoParse
{
GstRawParse parent;
+ GstVideoInfo info;
+
/* properties */
GstVideoFormat format;
gint width;