Blame gst-libs/gst/video/videoorientation.c

Packit 971217
/* GStreamer
Packit 971217
 * Copyright (C) 2006 Nokia <stefan.kost@nokia.com>
Packit 971217
 *
Packit 971217
 * videoorientation.c: video flipping and centering interface
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
#ifdef HAVE_CONFIG_H
Packit 971217
#include "config.h"
Packit 971217
#endif
Packit 971217
Packit 971217
#include "videoorientation.h"
Packit 971217
Packit 971217
#include <string.h>
Packit 971217
Packit 971217
/**
Packit 971217
 * SECTION:gstvideoorientation
Packit 971217
 * @title: GstVideoOrientation
Packit 971217
 * @short_description: Interface for elements providing video orientation
Packit 971217
 * controls
Packit 971217
 *
Packit 971217
 * The interface allows unified access to control flipping and autocenter
Packit 971217
 * operation of video-sources or operators.
Packit 971217
 */
Packit 971217
Packit 971217
/* FIXME 0.11: check if we need to add API for sometimes-supportedness
Packit 971217
 * (aka making up for GstImplementsInterface removal) (probably yes) */
Packit 971217
Packit 971217
G_DEFINE_INTERFACE (GstVideoOrientation, gst_video_orientation, 0)
Packit 971217
Packit 971217
     static void
Packit 971217
         gst_video_orientation_default_init (GstVideoOrientationInterface *
Packit 971217
    iface)
Packit 971217
{
Packit 971217
  /* default virtual functions */
Packit 971217
Packit 971217
  iface->get_hflip = NULL;
Packit 971217
  iface->get_vflip = NULL;
Packit 971217
  iface->get_hcenter = NULL;
Packit 971217
  iface->get_vcenter = NULL;
Packit 971217
Packit 971217
  iface->set_hflip = NULL;
Packit 971217
  iface->set_vflip = NULL;
Packit 971217
  iface->set_hcenter = NULL;
Packit 971217
  iface->set_vcenter = NULL;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_get_hflip:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @flip: (out): return location for the result
Packit 971217
 *
Packit 971217
 * Get the horizontal flipping state (%TRUE for flipped) from the given object.
Packit 971217
 * Returns: %TRUE in case the element supports flipping
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_get_hflip (GstVideoOrientation * video_orientation,
Packit 971217
    gboolean * flip)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->get_hflip) {
Packit 971217
    return iface->get_hflip (video_orientation, flip);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_get_vflip:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @flip: (out): return location for the result
Packit 971217
 *
Packit 971217
 * Get the vertical flipping state (%TRUE for flipped) from the given object.
Packit 971217
 * Returns: %TRUE in case the element supports flipping
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_get_vflip (GstVideoOrientation * video_orientation,
Packit 971217
    gboolean * flip)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->get_vflip) {
Packit 971217
    return iface->get_vflip (video_orientation, flip);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_get_hcenter:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @center: (out): return location for the result
Packit 971217
 *
Packit 971217
 * Get the horizontal centering offset from the given object.
Packit 971217
 * Returns: %TRUE in case the element supports centering
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_get_hcenter (GstVideoOrientation * video_orientation,
Packit 971217
    gint * center)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->get_hcenter) {
Packit 971217
    return iface->get_hcenter (video_orientation, center);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_get_vcenter:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @center: (out): return location for the result
Packit 971217
 *
Packit 971217
 * Get the vertical centering offset from the given object.
Packit 971217
 * Returns: %TRUE in case the element supports centering
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_get_vcenter (GstVideoOrientation * video_orientation,
Packit 971217
    gint * center)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->get_vcenter) {
Packit 971217
    return iface->get_vcenter (video_orientation, center);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_set_hflip:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @flip: use flipping
Packit 971217
 *
Packit 971217
 * Set the horizontal flipping state (%TRUE for flipped) for the given object.
Packit 971217
 * Returns: %TRUE in case the element supports flipping
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_set_hflip (GstVideoOrientation * video_orientation,
Packit 971217
    gboolean flip)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->set_hflip) {
Packit 971217
    return iface->set_hflip (video_orientation, flip);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_set_vflip:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @flip: use flipping
Packit 971217
 *
Packit 971217
 * Set the vertical flipping state (%TRUE for flipped) for the given object.
Packit 971217
 * Returns: %TRUE in case the element supports flipping
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_set_vflip (GstVideoOrientation * video_orientation,
Packit 971217
    gboolean flip)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->set_vflip) {
Packit 971217
    return iface->set_vflip (video_orientation, flip);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_set_hcenter:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @center: centering offset
Packit 971217
 *
Packit 971217
 * Set the horizontal centering offset for the given object.
Packit 971217
 * Returns: %TRUE in case the element supports centering
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_set_hcenter (GstVideoOrientation * video_orientation,
Packit 971217
    gint center)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->set_hcenter) {
Packit 971217
    return iface->set_hcenter (video_orientation, center);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}
Packit 971217
Packit 971217
/**
Packit 971217
 * gst_video_orientation_set_vcenter:
Packit 971217
 * @video_orientation: #GstVideoOrientation interface of a #GstElement
Packit 971217
 * @center: centering offset
Packit 971217
 *
Packit 971217
 * Set the vertical centering offset for the given object.
Packit 971217
 * Returns: %TRUE in case the element supports centering
Packit 971217
 */
Packit 971217
gboolean
Packit 971217
gst_video_orientation_set_vcenter (GstVideoOrientation * video_orientation,
Packit 971217
    gint center)
Packit 971217
{
Packit 971217
  GstVideoOrientationInterface *iface =
Packit 971217
      GST_VIDEO_ORIENTATION_GET_INTERFACE (video_orientation);
Packit 971217
Packit 971217
  if (iface->set_vcenter) {
Packit 971217
    return iface->set_vcenter (video_orientation, center);
Packit 971217
  }
Packit 971217
  return FALSE;
Packit 971217
}