1 /*
2 * GPAC - Multimedia Framework C SDK
3 *
4 * Authors: Romain Bouqueau, Jean Le Feuvre
5 * Copyright (c) 2014-2016 GPAC Licensing
6 * Copyright (c) 2016-2020 Telecom Paris
7 * All rights reserved
8 *
9 * This file is part of GPAC / Dektec SDI video output filter
10 *
11 * GPAC is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License as published by
13 * the Free Software Foundation; either version 2, or (at your option)
14 * any later version.
15 *
16 * GPAC is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with this library; see the file COPYING. If not, write to
23 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
24 *
25 */
26
27 #include "dektec_video.h"
28
29
30 #ifdef GPAC_HAS_DTAPI
31 #define OFFS(_n) #_n, offsetof(GF_DTOutCtx, _n)
32 #else
33 #define OFFS(_n) #_n, -1
34
dtout_process_dummy(GF_Filter * filter)35 static GF_Err dtout_process_dummy(GF_Filter *filter)
36 {
37 return GF_OK;
38 }
39 #endif
40
41 static const GF_FilterArgs DTOutArgs[] =
42 {
43 { OFFS(bus), "PCI bus number - if not set, device discovery is used", GF_PROP_SINT, "-1", NULL, GF_FS_ARG_HINT_EXPERT},
44 { OFFS(slot), "PCI bus number - if not set, device discovery is used", GF_PROP_SINT, "-1", NULL, GF_FS_ARG_HINT_EXPERT },
45 { OFFS(fps), "default FPS to use if input stream fps cannot be detected", GF_PROP_FRACTION, "30/1", NULL, GF_FS_ARG_HINT_ADVANCED },
46 { OFFS(clip), "clip YUV data to valid SDI range, slower", GF_PROP_BOOL, "false", NULL, GF_FS_ARG_HINT_ADVANCED },
47 { OFFS(port), "set sdi output port of card", GF_PROP_UINT, "1", NULL, GF_FS_ARG_HINT_ADVANCED },
48 { OFFS(start), "set playback start offset, [-1, 0] means percent of media dur, eg -1 == dur", GF_PROP_DOUBLE, "0.0", NULL, GF_FS_ARG_HINT_NORMAL },
49 { 0 }
50 };
51
52 static GF_FilterCapability DTOutCaps[3];
53
54 GF_FilterRegister DTOutRegister;
55
56 #ifdef GPAC_HAS_DTAPI
57 GPAC_MODULE_EXPORT
RegisterFilter(GF_FilterSession * session)58 GF_FilterRegister *RegisterFilter(GF_FilterSession *session)
59 #else
60 GF_FilterRegister *dtout_register(GF_FilterSession *session)
61 #endif
62 {
63 memset(DTOutCaps, 0, sizeof(DTOutCaps));
64 memset(&DTOutRegister, 0, sizeof(GF_FilterRegister));
65
66 #ifndef GPAC_HAS_DTAPI
67 if (!gf_opts_get_bool("temp", "gendoc"))
68 return NULL;
69 DTOutRegister.version = "! Warning: DekTek SDK NOT AVAILABLE IN THIS BUILD !";
70 #endif
71
72 DTOutCaps[0].code = GF_PROP_PID_STREAM_TYPE;
73 DTOutCaps[0].flags = GF_CAPS_INPUT;
74 DTOutCaps[0].val.type = GF_PROP_UINT;
75 DTOutCaps[0].val.value.uint = GF_STREAM_VISUAL;
76
77 DTOutCaps[1].code = GF_PROP_PID_STREAM_TYPE;
78 DTOutCaps[1].flags = GF_CAPS_INPUT;
79 DTOutCaps[1].val.type = GF_PROP_UINT;
80 DTOutCaps[1].val.value.uint = GF_STREAM_AUDIO;
81
82 DTOutCaps[2].code = GF_PROP_PID_CODECID;
83 DTOutCaps[2].flags = GF_CAPS_INPUT;
84 DTOutCaps[2].val.type = GF_PROP_UINT;
85 DTOutCaps[2].val.value.uint = GF_CODECID_RAW;
86
87 DTOutRegister.name = "dtout";
88 #ifndef GPAC_DISABLE_DOC
89 DTOutRegister.description = "DekTec SDIOut";
90 DTOutRegister.help = "This filter provides SDI output to be used with __DTA 2174__ or __DTA 2154__ cards.";
91 #endif
92 DTOutRegister.private_size = sizeof(GF_DTOutCtx);
93 DTOutRegister.args = DTOutArgs;
94 DTOutRegister.caps = DTOutCaps;
95 DTOutRegister.nb_caps = 3;
96
97 #if defined(GPAC_HAS_DTAPI) && !defined(FAKE_DT_API)
98 DTOutRegister.initialize = dtout_initialize;
99 DTOutRegister.finalize = dtout_finalize;
100 DTOutRegister.configure_pid = dtout_configure_pid;
101 DTOutRegister.process = dtout_process;
102 #else
103 DTOutRegister.process = dtout_process_dummy;
104
105 #ifdef GPAC_ENABLE_COVERAGE
106 dtout_process_dummy(NULL);
107 #endif
108
109 #endif
110 return &DTOutRegister;
111 }
112