mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
77 lines
2.6 KiB
C
77 lines
2.6 KiB
C
|
/* GStreamer video frame cropping
|
||
|
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
|
||
|
*
|
||
|
* This library is free software; you can redistribute it and/or
|
||
|
* modify it under the terms of the GNU Library General Public
|
||
|
* License as published by the Free Software Foundation; either
|
||
|
* version 2 of the License, or (at your option) any later version.
|
||
|
*
|
||
|
* This library is distributed in the hope that it will be useful,
|
||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||
|
* Library General Public License for more details.
|
||
|
*
|
||
|
* You should have received a copy of the GNU Library General Public
|
||
|
* License along with this library; if not, write to the
|
||
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||
|
* Boston, MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* SECTION:element-videocrop
|
||
|
* @title: videocrop
|
||
|
* @see_also: #GstVideoBox
|
||
|
*
|
||
|
* This element crops video frames, meaning it can remove parts of the
|
||
|
* picture on the left, right, top or bottom of the picture and output
|
||
|
* a smaller picture than the input picture, with the unwanted parts at the
|
||
|
* border removed.
|
||
|
*
|
||
|
* The videocrop element is similar to the videobox element, but its main
|
||
|
* goal is to support a multitude of formats as efficiently as possible.
|
||
|
* Unlike videbox, it cannot add borders to the picture and unlike videbox
|
||
|
* it will always output images in exactly the same format as the input image.
|
||
|
*
|
||
|
* If there is nothing to crop, the element will operate in pass-through mode.
|
||
|
*
|
||
|
* Note that no special efforts are made to handle chroma-subsampled formats
|
||
|
* in the case of odd-valued cropping and compensate for sub-unit chroma plane
|
||
|
* shifts for such formats in the case where the #GstVideoCrop:left or
|
||
|
* #GstVideoCrop:top property is set to an odd number. This doesn't matter for
|
||
|
* most use cases, but it might matter for yours.
|
||
|
*
|
||
|
* ## Example launch line
|
||
|
* |[
|
||
|
* gst-launch-1.0 -v videotestsrc ! videocrop top=42 left=1 right=4 bottom=0 ! ximagesink
|
||
|
* ]|
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/* TODO:
|
||
|
* - for packed formats, we could avoid memcpy() in case crop_left
|
||
|
* and crop_right are 0 and just create a sub-buffer of the input
|
||
|
* buffer
|
||
|
*/
|
||
|
|
||
|
#ifdef HAVE_CONFIG_H
|
||
|
#include "config.h"
|
||
|
#endif
|
||
|
|
||
|
#include <gst/gst.h>
|
||
|
#include <gst/video/video.h>
|
||
|
|
||
|
#include "gstvideocropelements.h"
|
||
|
|
||
|
GST_DEBUG_CATEGORY_STATIC (videocrop_debug);
|
||
|
#define GST_CAT_DEFAULT videocrop_debug
|
||
|
|
||
|
void
|
||
|
videocrop_element_init (GstPlugin * plugin)
|
||
|
{
|
||
|
static gsize res = FALSE;
|
||
|
if (g_once_init_enter (&res)) {
|
||
|
GST_DEBUG_CATEGORY_INIT (videocrop_debug, "videocrop", 0, "videocrop");
|
||
|
g_once_init_leave (&res, TRUE);
|
||
|
}
|
||
|
}
|