1 /*
2 * renderer-dali.cc --
3 *
4 * A Dali-object renderer: it gets a frame and passes it to the
5 * FX engine. It's used only to keep the input stream id.
6 *
7 * Copyright (c) 1993-2001 The Regents of the University of California.
8 * All rights reserved.
9 *
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions are met:
12 *
13 * A. Redistributions of source code must retain the above copyright notice,
14 * this list of conditions and the following disclaimer.
15 * B. Redistributions in binary form must reproduce the above copyright notice,
16 * this list of conditions and the following disclaimer in the documentation
17 * and/or other materials provided with the distribution.
18 * C. Neither the names of the copyright holders nor the names of its
19 * contributors may be used to endorse or promote products derived from this
20 * software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
23 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
24 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
25 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE
26 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
27 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
29 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
30 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
31 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32 * POSSIBILITY OF SUCH DAMAGE.
33 */
34
35 /* @(#) $Header: /usr/mash/src/repository/mash/mash-1/fx/renderer-dali.cc,v 1.2 2002/03/16 02:57:57 chema Exp $ */
36
37
38 //
39 // TBD: it's not clear how to pass the ssrc_ and ts_ values
40 // from a Decoder to an FX module through a Renderer (most Renderers don't
41 // need it). Ketan solved this by duplicating the decoders (which I don't
42 // like too much because it implies maintaining the same code in two
43 // different places) and passing at the target_->recv() a new VidRep
44 // structure. It should be easier and more elegant to permit the Renderer
45 // object querying the decoder about ts_ and ssrc_.
46
47
48 #include <stdlib.h>
49 #include "renderer.h"
50 #include "vw.h"
51 #include "rv.h"
52
53 #include "tclcl.h"
54 #include "module.h"
55
56 #include "renderer-dali.h"
57
58 DaliRenderer::DaliRenderer(bool editable)
59 : Renderer(), input_id_(0), target_(0), editable_(editable)
60 {
61 }
62
63
64
65 int DaliRenderer::command (int argc, const char*const* argv) {
66 Tcl& tcl = Tcl::instance();
67
68
69 if ((argc == 4) || (argc == 5)) {
70 // target_ is used for C++ defined effects (EffectModule inheriting)
71 if (strcmp(argv[1], "attach") == 0) {
72 // get the input id
73 if (argc < 5) {
74 input_id_ = 0;
75 } else {
76 input_id_ = atoi(argv[3]);
77 }
78
79 // get the target object
80 target_ = (EffectModule *) TclObject::lookup(argv[2]);
81 if (target_ == 0) {
82 tcl.resultf("%s attach: no such effect: %s",
83 argv[0], argv[2]);
84 return (TCL_ERROR);
85 }
86 return (TCL_OK);
87 }
88 }
89
90 return (Renderer::command(argc, argv));
91 }
92
93
94
95 void DaliRenderer::resize (int w, int h) {
96 printf ("DaliRenderer::resize -> SHOULDN'T BE HERE!!\n");
97 abort();
98 return;
99 }
100
101
102
103 void DaliRenderer::recv (Buffer* bp)
104 {
105 // if an EffectModule object is waiting for this frame, send it
106 if (target_ != 0) {
107 target_->recv(bp, input_id_, editable_);
108 }
109
110 return;
111 }
112
113
114
115 //
116 // create the tcl version of the class
117 //
118 static class DaliRendererClass : public TclClass {
119 public:
120 DaliRendererClass() : TclClass("Renderer/Dali") {}
121 TclObject* create(int argc, const char*const* argv) {
122 if (argc != 5) {
123 fprintf(stderr,"Wrong number of arguments passed to Renderer/Dali\n");
124 abort();
125 }
126 bool editable = true;
127 if (strcmp(argv[4], "Module/VideoDecoder/H261") == 0) {
128 editable = false;
129 }
130 return (new DaliRenderer(editable));
131 }
132 } dalirenderer_class;
133
134
135
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.