~ubuntu-branches/ubuntu/precise/gst-plugins-base0.10/precise-updates

« back to all changes in this revision

Viewing changes to gst/playback/gstplaysinkvideoconvert.c

  • Committer: Package Import Robot
  • Author(s): Sebastian Dröge
  • Date: 2011-12-12 12:40:13 UTC
  • mfrom: (36.1.15 experimental)
  • Revision ID: package-import@ubuntu.com-20111212124013-onyadfb150d8c5dk
Tags: 0.10.35.2-2
* debian/libgstreamer-plugins-base.install:
  + Add license translations file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* GStreamer
 
2
 * Copyright (C) <2011> Sebastian Dröge <sebastian.droege@collabora.co.uk>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Library General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2 of the License, or (at your option) any later version.
 
8
 *
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Library General Public License for more details.
 
13
 *
 
14
 * You should have received a copy of the GNU Library General Public
 
15
 * License along with this library; if not, write to the
 
16
 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 
17
 * Boston, MA 02111-1307, USA.
 
18
 */
 
19
 
 
20
#ifdef HAVE_CONFIG_H
 
21
#include "config.h"
 
22
#endif
 
23
 
 
24
#include "gstplaysinkvideoconvert.h"
 
25
 
 
26
#include <gst/pbutils/pbutils.h>
 
27
#include <gst/gst-i18n-plugin.h>
 
28
 
 
29
GST_DEBUG_CATEGORY_STATIC (gst_play_sink_video_convert_debug);
 
30
#define GST_CAT_DEFAULT gst_play_sink_video_convert_debug
 
31
 
 
32
#define parent_class gst_play_sink_video_convert_parent_class
 
33
 
 
34
G_DEFINE_TYPE (GstPlaySinkVideoConvert, gst_play_sink_video_convert,
 
35
    GST_TYPE_PLAY_SINK_CONVERT_BIN);
 
36
 
 
37
static gboolean
 
38
gst_play_sink_video_convert_add_conversion_elements (GstPlaySinkVideoConvert *
 
39
    self)
 
40
{
 
41
  GstPlaySinkConvertBin *cbin = GST_PLAY_SINK_CONVERT_BIN (self);
 
42
  GstElement *el, *prev = NULL;
 
43
 
 
44
  el = gst_play_sink_convert_bin_add_conversion_element_factory (cbin,
 
45
      COLORSPACE, "conv");
 
46
  if (el)
 
47
    prev = el;
 
48
 
 
49
  el = gst_play_sink_convert_bin_add_conversion_element_factory (cbin,
 
50
      "videoscale", "scale");
 
51
  if (el) {
 
52
    /* Add black borders if necessary to keep the DAR */
 
53
    g_object_set (el, "add-borders", TRUE, NULL);
 
54
    if (prev) {
 
55
      if (!gst_element_link_pads_full (prev, "src", el, "sink",
 
56
              GST_PAD_LINK_CHECK_TEMPLATE_CAPS))
 
57
        goto link_failed;
 
58
    }
 
59
    prev = el;
 
60
  }
 
61
 
 
62
  return TRUE;
 
63
 
 
64
link_failed:
 
65
  return FALSE;
 
66
}
 
67
 
 
68
static void
 
69
gst_play_sink_video_convert_class_init (GstPlaySinkVideoConvertClass * klass)
 
70
{
 
71
  GstElementClass *gstelement_class;
 
72
 
 
73
  GST_DEBUG_CATEGORY_INIT (gst_play_sink_video_convert_debug,
 
74
      "playsinkvideoconvert", 0, "play bin");
 
75
 
 
76
  gstelement_class = (GstElementClass *) klass;
 
77
 
 
78
  gst_element_class_set_details_simple (gstelement_class,
 
79
      "Player Sink Video Converter", "Video/Bin/Converter",
 
80
      "Convenience bin for video conversion",
 
81
      "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
 
82
}
 
83
 
 
84
static void
 
85
gst_play_sink_video_convert_init (GstPlaySinkVideoConvert * self)
 
86
{
 
87
  GstPlaySinkConvertBin *cbin = GST_PLAY_SINK_CONVERT_BIN (self);
 
88
  cbin->audio = FALSE;
 
89
 
 
90
  gst_play_sink_video_convert_add_conversion_elements (self);
 
91
  gst_play_sink_convert_bin_cache_converter_caps (cbin);
 
92
}