mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
video: add support for max-framerate
Add support for max-framerate in the video helpers and update the video caps document.
This commit is contained in:
parent
6781587784
commit
06a6ab3e32
3 changed files with 31 additions and 8 deletions
|
@ -12,6 +12,10 @@ Media Types
|
|||
framerate, GST_TYPE_FRACTION, default 0/1
|
||||
The framerate of the video 0/1 for variable framerate
|
||||
|
||||
max-framerate, GST_TYPE_FRACTION, default as framerate
|
||||
For variable framerates this would be the maximum framerate that
|
||||
is expected. This value is only valid when the framerate is 0/1
|
||||
|
||||
pixel-aspect-ratio, GST_TYPE_FRACTION, default 1/1
|
||||
The pixel aspect ration of the video
|
||||
|
||||
|
|
|
@ -826,9 +826,16 @@ gst_video_info_from_caps (GstVideoInfo * info, const GstCaps * caps)
|
|||
gst_video_info_set_format (info, format, width, height);
|
||||
|
||||
if (gst_structure_get_fraction (structure, "framerate", &fps_n, &fps_d)) {
|
||||
if (fps_n == 0) {
|
||||
/* variable framerate */
|
||||
info->flags |= GST_VIDEO_FLAG_VARIABLE_FPS;
|
||||
/* see if we have a max-framerate */
|
||||
gst_structure_get_fraction (structure, "max-framerate", &fps_n, &fps_d);
|
||||
}
|
||||
info->fps_n = fps_n;
|
||||
info->fps_d = fps_d;
|
||||
} else {
|
||||
/* unspecified is variable framerate */
|
||||
info->fps_n = 0;
|
||||
info->fps_d = 1;
|
||||
}
|
||||
|
@ -915,7 +922,6 @@ gst_video_info_to_caps (GstVideoInfo * info)
|
|||
"format", G_TYPE_STRING, format,
|
||||
"width", G_TYPE_INT, info->width,
|
||||
"height", G_TYPE_INT, info->height,
|
||||
"framerate", GST_TYPE_FRACTION, info->fps_n, info->fps_d,
|
||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, info->par_n, info->par_d, NULL);
|
||||
|
||||
if (info->flags & GST_VIDEO_FLAG_INTERLACED)
|
||||
|
@ -930,6 +936,16 @@ gst_video_info_to_caps (GstVideoInfo * info)
|
|||
if (info->views > 1)
|
||||
gst_caps_set_simple (caps, "views", G_TYPE_INT, info->views, NULL);
|
||||
|
||||
if (info->flags & GST_VIDEO_FLAG_VARIABLE_FPS && info->fps_n != 0) {
|
||||
/* variable fps with a max-framerate */
|
||||
gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION, 0, 1,
|
||||
"max-framerate", GST_TYPE_FRACTION, info->fps_n, info->fps_d, NULL);
|
||||
} else {
|
||||
/* no variable fps or no max-framerate */
|
||||
gst_caps_set_simple (caps, "framerate", GST_TYPE_FRACTION,
|
||||
info->fps_n, info->fps_d, NULL);
|
||||
}
|
||||
|
||||
return caps;
|
||||
}
|
||||
|
||||
|
|
|
@ -312,17 +312,20 @@ typedef struct _GstVideoFrame GstVideoFrame;
|
|||
* @GST_VIDEO_FLAG_ONEFIELD: one field
|
||||
* @GST_VIDEO_FLAG_TELECINE: telecine
|
||||
* @GST_VIDEO_FLAG_PROGRESSIVE: video is progressive
|
||||
* @GST_VIDEO_FLAG_VARIABLE_FPS: a variable fps is selected, fps_n and fps_d
|
||||
* denote the maximum fps of the video
|
||||
*
|
||||
* Extra video flags
|
||||
*/
|
||||
typedef enum {
|
||||
GST_VIDEO_FLAG_NONE = 0,
|
||||
GST_VIDEO_FLAG_INTERLACED = (1 << 0),
|
||||
GST_VIDEO_FLAG_TFF = (1 << 1),
|
||||
GST_VIDEO_FLAG_RFF = (1 << 2),
|
||||
GST_VIDEO_FLAG_ONEFIELD = (1 << 3),
|
||||
GST_VIDEO_FLAG_TELECINE = (1 << 4),
|
||||
GST_VIDEO_FLAG_PROGRESSIVE = (1 << 5)
|
||||
GST_VIDEO_FLAG_NONE = 0,
|
||||
GST_VIDEO_FLAG_INTERLACED = (1 << 0),
|
||||
GST_VIDEO_FLAG_TFF = (1 << 1),
|
||||
GST_VIDEO_FLAG_RFF = (1 << 2),
|
||||
GST_VIDEO_FLAG_ONEFIELD = (1 << 3),
|
||||
GST_VIDEO_FLAG_TELECINE = (1 << 4),
|
||||
GST_VIDEO_FLAG_PROGRESSIVE = (1 << 5),
|
||||
GST_VIDEO_FLAG_VARIABLE_FPS = (1 << 6)
|
||||
} GstVideoFlags;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue