summaryrefslogtreecommitdiff
path: root/gstreamer_ti/ti_build/ticodecplugin/src/gstticodecplugin.c
blob: 8c21fc60bdb6c781ee6b61e4a80b885febc776e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
/*
 * gstticodecplugin.c
 *
 * This file defines the main entry point of the TI Codec Plugin for GStreamer.
 *
 * Original Author:
 *     Don Darling, Texas Instruments, Inc.
 *
 * Copyright (C) 2008-2010 Texas Instruments Incorporated - http://www.ti.com/
 *
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation version 2.1 of the License.
 *
 * This program is distributed #as is# WITHOUT ANY WARRANTY of any kind,
 * whether express or implied; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 */

#ifdef HAVE_CONFIG_H
#  include <config.h>
#endif

#include <sys/resource.h>
#include <stdlib.h>

#include <gst/gst.h>

#include <xdc/std.h>
#include <ti/sdo/ce/Engine.h>
#include <ti/sdo/ce/CERuntime.h>
#include <ti/sdo/dmai/Dmai.h>

#include "gsttiauddec1.h"
#include "gsttividdec2.h"
#include "gsttiimgenc1.h"
#include "gsttiimgdec1.h"
#include "gsttidmaivideosink.h"
#include "gsttividenc1.h"
#include "gsttiaudenc1.h"
#include "gsttividresize.h"
#include "gsttiprepencbuf.h"
#include "gsttidmaiperf.h"

#ifdef HAVE_C6ACCEL
    #include "gsttic6xcolorspace.h"
#endif

/* entry point to initialize the plug-in
 * initialize the plug-in itself
 * register the element factories and other features
 */
static gboolean
TICodecPlugin_init (GstPlugin * TICodecPlugin)
{
    Char    *env_value;

    /* Initialize the codec engine run time */
    CERuntime_init();

    /* Initialize DMAI */
    Dmai_init(); 

    env_value = getenv("GST_TI_TIVidenc1_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIVidenc1", GST_RANK_PRIMARY,
        GST_TYPE_TIVIDENC1))
        return FALSE;

    env_value = getenv("GST_TI_TIViddec2_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIViddec2", GST_RANK_PRIMARY,
        GST_TYPE_TIVIDDEC2))
        return FALSE;

    env_value = getenv("GST_TI_TIImgenc1_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIImgenc1", GST_RANK_PRIMARY,
        GST_TYPE_TIIMGENC1))
        return FALSE;

    env_value = getenv("GST_TI_TIImgdec1_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIImgdec1", GST_RANK_PRIMARY,
        GST_TYPE_TIIMGDEC1))
        return FALSE;

    env_value = getenv("GST_TI_TIAuddec1_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIAuddec1", GST_RANK_PRIMARY,
        GST_TYPE_TIAUDDEC1))
        return FALSE;

    env_value = getenv("GST_TI_TIAudenc1_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIAudenc1", GST_RANK_PRIMARY,
        GST_TYPE_TIAUDENC1))
        return FALSE;

    env_value = getenv("GST_TI_TIDmaiVideoSink_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIDmaiVideoSink", GST_RANK_PRIMARY,
        GST_TYPE_TIDMAIVIDEOSINK))
        return FALSE;

    env_value = getenv("GST_TI_TIVidResize_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIVidResize", GST_RANK_PRIMARY,
        GST_TYPE_TIVIDRESIZE))
        return FALSE;

    env_value = getenv("GST_TI_TIPrepEncBuf_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIPrepEncBuf", GST_RANK_PRIMARY,
        GST_TYPE_TIPREPENCBUF))
        return FALSE;

    env_value = getenv("GST_TI_TIDmaiPerf_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "dmaiperf", GST_RANK_PRIMARY,
        GST_TYPE_DMAIPERF))
        return FALSE;

#ifdef HAVE_C6ACCEL
    env_value = getenv("GST_TI_TIC6xColorspace_DISABLE");

    if ((!env_value || strcmp(env_value,"1")) && !gst_element_register(
        TICodecPlugin, "TIC6xColorspace", GST_RANK_PRIMARY,
        GST_TYPE_TIC6XCOLORSPACE))
        return FALSE;
#endif

    return TRUE;
}

/* gstreamer looks for this structure to register TICodecPlugins */
GST_PLUGIN_DEFINE (
    GST_VERSION_MAJOR,
    GST_VERSION_MINOR,
    "TICodecPlugin",
    "Plugin for TI xDM-Based Codecs",
    TICodecPlugin_init,
    VERSION,
    GST_LICENSE_UNKNOWN,
    "TI",
    "http://www.ti.com/"
)


/******************************************************************************
 * Custom ViM Settings for editing this file
 ******************************************************************************/
#if 0
 Tabs (use 4 spaces for indentation)
 vim:set tabstop=4:      /* Use 4 spaces for tabs          */
 vim:set shiftwidth=4:   /* Use 4 spaces for >> operations */
 vim:set expandtab:      /* Expand tabs into white spaces  */
#endif