Blame gst-libs/gst/video/gstvideotimecode.h

Packit 971217
/* GStreamer
Packit 971217
 * Copyright (C) <2016> Vivia Nikolaidou <vivia@toolsonair.com>
Packit 971217
 *
Packit 971217
 * This library is free software; you can redistribute it and/or
Packit 971217
 * modify it under the terms of the GNU Library General Public
Packit 971217
 * License as published by the Free Software Foundation; either
Packit 971217
 * version 2 of the License, or (at your option) any later version.
Packit 971217
 *
Packit 971217
 * This library is distributed in the hope that it will be useful,
Packit 971217
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 971217
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 971217
 * Library General Public License for more details.
Packit 971217
 *
Packit 971217
 * You should have received a copy of the GNU Library General Public
Packit 971217
 * License along with this library; if not, write to the
Packit 971217
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit 971217
 * Boston, MA 02110-1301, USA.
Packit 971217
 */
Packit 971217
Packit 971217
#ifndef __GST_VIDEO_TIME_CODE_H__
Packit 971217
#define __GST_VIDEO_TIME_CODE_H__
Packit 971217
Packit 971217
#include <gst/gst.h>
Packit 971217
#include <gst/video/video-prelude.h>
Packit 971217
Packit 971217
G_BEGIN_DECLS
Packit 971217
Packit 971217
typedef struct _GstVideoTimeCodeConfig GstVideoTimeCodeConfig;
Packit 971217
typedef struct _GstVideoTimeCode GstVideoTimeCode;
Packit 971217
typedef struct _GstVideoTimeCodeInterval GstVideoTimeCodeInterval;
Packit 971217
Packit 971217
/**
Packit 971217
 * GstVideoTimeCodeFlags:
Packit 971217
 * @GST_VIDEO_TIME_CODE_FLAGS_NONE: No flags
Packit 971217
 * @GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME: Whether we have drop frame rate
Packit 971217
 * @GST_VIDEO_TIME_CODE_FLAGS_INTERLACED: Whether we have interlaced video
Packit 971217
 *
Packit 971217
 * Flags related to the time code information.
Packit 971217
 * For drop frame, only 30000/1001 and 60000/1001 frame rates are supported.
Packit 971217
 *
Packit 971217
 * Since: 1.10
Packit 971217
 */
Packit 971217
typedef enum
Packit 971217
{
Packit 971217
  GST_VIDEO_TIME_CODE_FLAGS_NONE = 0,
Packit 971217
  GST_VIDEO_TIME_CODE_FLAGS_DROP_FRAME = (1<<0),
Packit 971217
  GST_VIDEO_TIME_CODE_FLAGS_INTERLACED = (1<<1)
Packit 971217
  /* Not supported yet:
Packit 971217
   * GST_VIDEO_TIME_CODE_ALLOW_MORE_THAN_24H = (1<<2)
Packit 971217
   * GST_VIDEO_TIME_CODE_ALLOW_NEGATIVE = (1<<3)
Packit 971217
   */
Packit 971217
} GstVideoTimeCodeFlags;
Packit 971217
Packit 971217
/**
Packit 971217
 * GstVideoTimeCodeConfig:
Packit 971217
 * @fps_n: Numerator of the frame rate
Packit 971217
 * @fps_d: Denominator of the frame rate
Packit 971217
 * @flags: the corresponding #GstVideoTimeCodeFlags
Packit 971217
 * @latest_daily_jam: The latest daily jam information, if present, or NULL
Packit 971217
 *
Packit 971217
 * Supported frame rates: 30000/1001, 60000/1001 (both with and without drop
Packit 971217
 * frame), and integer frame rates e.g. 25/1, 30/1, 50/1, 60/1.
Packit 971217
 *
Packit 971217
 * The configuration of the time code.
Packit 971217
 *
Packit 971217
 * Since: 1.10
Packit 971217
 */
Packit 971217
struct _GstVideoTimeCodeConfig {
Packit 971217
  guint fps_n;
Packit 971217
  guint fps_d;
Packit 971217
  GstVideoTimeCodeFlags flags;
Packit 971217
  GDateTime *latest_daily_jam;
Packit 971217
};
Packit 971217
Packit 971217
/**
Packit 971217
 * GstVideoTimeCode:
Packit 971217
 * @hours: the hours field of #GstVideoTimeCode
Packit 971217
 * @minutes: the minutes field of #GstVideoTimeCode
Packit 971217
 * @seconds: the seconds field of #GstVideoTimeCode
Packit 971217
 * @frames: the frames field of #GstVideoTimeCode
Packit 971217
 * @field_count: Interlaced video field count
Packit 971217
 * @config: the corresponding #GstVideoTimeCodeConfig
Packit 971217
 *
Packit 971217
 * @field_count must be 0 for progressive video and 1 or 2 for interlaced.
Packit 971217
 *
Packit 971217
 * A representation of a SMPTE time code.
Packit 971217
 *
Packit 971217
 * @hours must be positive and less than 24. Will wrap around otherwise.
Packit 971217
 * @minutes and @seconds must be positive and less than 60.
Packit 971217
 * @frames must be less than or equal to @config.fps_n / @config.fps_d
Packit 971217
 * These values are *NOT* automatically normalized.
Packit 971217
 *
Packit 971217
 * Since: 1.10
Packit 971217
 */
Packit 971217
struct _GstVideoTimeCode {
Packit 971217
  GstVideoTimeCodeConfig config;
Packit 971217
Packit 971217
  guint hours;
Packit 971217
  guint minutes;
Packit 971217
  guint seconds;
Packit 971217
  guint frames;
Packit 971217
  guint field_count;
Packit 971217
};
Packit 971217
Packit 971217
/**
Packit 971217
 * GstVideoTimeCodeInterval:
Packit 971217
 * @hours: the hours field of #GstVideoTimeCodeInterval
Packit 971217
 * @minutes: the minutes field of #GstVideoTimeCodeInterval
Packit 971217
 * @seconds: the seconds field of #GstVideoTimeCodeInterval
Packit 971217
 * @frames: the frames field of #GstVideoTimeCodeInterval
Packit 971217
 *
Packit 971217
 * A representation of a difference between two #GstVideoTimeCode instances.
Packit 971217
 * Will not necessarily correspond to a real timecode (e.g. 00:00:10;00)
Packit 971217
 *
Packit 971217
 * Since: 1.12
Packit 971217
 */
Packit 971217
struct _GstVideoTimeCodeInterval {
Packit 971217
  guint hours;
Packit 971217
  guint minutes;
Packit 971217
  guint seconds;
Packit 971217
  guint frames;
Packit 971217
};
Packit 971217
Packit 971217
#define GST_VIDEO_TIME_CODE_INIT { {0, 0, 0, NULL}, 0, 0, 0, 0, 0 }
Packit 971217
Packit 971217
#define GST_TYPE_VIDEO_TIME_CODE (gst_video_time_code_get_type())
Packit 971217
GST_VIDEO_API
Packit 971217
GType gst_video_time_code_get_type (void);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCode * gst_video_time_code_new          (guint                    fps_n,
Packit 971217
                                                     guint                    fps_d,
Packit 971217
                                                     GDateTime              * latest_daily_jam,
Packit 971217
                                                     GstVideoTimeCodeFlags    flags,
Packit 971217
                                                     guint                    hours,
Packit 971217
                                                     guint                    minutes,
Packit 971217
                                                     guint                    seconds,
Packit 971217
                                                     guint                    frames,
Packit 971217
                                                     guint                    field_count);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCode * gst_video_time_code_new_empty    (void);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCode * gst_video_time_code_new_from_string    (const gchar * tc_str);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCode * gst_video_time_code_new_from_date_time (guint              fps_n,
Packit 971217
                                                     guint                    fps_d,
Packit 971217
                                                     GDateTime              * dt,
Packit 971217
                                                     GstVideoTimeCodeFlags    flags,
Packit 971217
                                                     guint                    field_count);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_free                       (GstVideoTimeCode       * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCode * gst_video_time_code_copy         (const GstVideoTimeCode * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_init                       (GstVideoTimeCode       * tc,
Packit 971217
                                                     guint                    fps_n,
Packit 971217
                                                     guint                    fps_d,
Packit 971217
                                                     GDateTime              * latest_daily_jam,
Packit 971217
                                                     GstVideoTimeCodeFlags    flags,
Packit 971217
                                                     guint                    hours,
Packit 971217
                                                     guint                    minutes,
Packit 971217
                                                     guint                    seconds,
Packit 971217
                                                     guint                    frames,
Packit 971217
                                                     guint                    field_count);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_init_from_date_time        (GstVideoTimeCode       * tc,
Packit 971217
                                                     guint                    fps_n,
Packit 971217
                                                     guint                    fps_d,
Packit 971217
                                                     GDateTime              * dt,
Packit 971217
                                                     GstVideoTimeCodeFlags    flags,
Packit 971217
                                                     guint                    field_count);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_clear                      (GstVideoTimeCode       * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
gboolean gst_video_time_code_is_valid               (const GstVideoTimeCode * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
gint gst_video_time_code_compare                    (const GstVideoTimeCode * tc1,
Packit 971217
                                                     const GstVideoTimeCode * tc2);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_increment_frame            (GstVideoTimeCode       * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_add_frames                 (GstVideoTimeCode       * tc,
Packit 971217
                                                     gint64                   frames);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
gchar *gst_video_time_code_to_string                (const GstVideoTimeCode * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GDateTime *gst_video_time_code_to_date_time         (const GstVideoTimeCode * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
guint64 gst_video_time_code_nsec_since_daily_jam    (const GstVideoTimeCode * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
guint64 gst_video_time_code_frames_since_daily_jam  (const GstVideoTimeCode * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCode * gst_video_time_code_add_interval (const GstVideoTimeCode * tc, const GstVideoTimeCodeInterval * tc_inter);
Packit 971217
Packit 971217
#define GST_TYPE_VIDEO_TIME_CODE_INTERVAL (gst_video_time_code_interval_get_type())
Packit 971217
GST_VIDEO_API
Packit 971217
GType gst_video_time_code_interval_get_type (void);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCodeInterval * gst_video_time_code_interval_new  (guint                    hours,
Packit 971217
                                                     guint                    minutes,
Packit 971217
                                                     guint                    seconds,
Packit 971217
                                                     guint                    frames);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCodeInterval * gst_video_time_code_interval_new_from_string    (const gchar * tc_inter_str);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_interval_free                   (GstVideoTimeCodeInterval       * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
GstVideoTimeCodeInterval * gst_video_time_code_interval_copy (const GstVideoTimeCodeInterval * tc);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_interval_init                   (GstVideoTimeCodeInterval       * tc,
Packit 971217
                                                     guint                    hours,
Packit 971217
                                                     guint                    minutes,
Packit 971217
                                                     guint                    seconds,
Packit 971217
                                                     guint                    frames);
Packit 971217
Packit 971217
GST_VIDEO_API
Packit 971217
void gst_video_time_code_interval_clear                  (GstVideoTimeCodeInterval       * tc);
Packit 971217
Packit 971217
G_END_DECLS
Packit 971217
Packit 971217
#endif /* __GST_VIDEO_TIME_CODE_H__ */