Skip to content

Commit 5e2b764

Browse files
committed
1) Improved functionalty of IjvxPackage objects to allow better integraton as tools
2) Added function in bitstreame/decoder to work with a local tools reference
1 parent e58167c commit 5e2b764

11 files changed

Lines changed: 205 additions & 53 deletions

File tree

software/codeFragments/jvxHosts/common/allHostsStatic_common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ class oneAddedStaticComponent
1010
jvxTerminateObject_tp funcTerm = nullptr;
1111
jvxBool run_init;
1212
IjvxObject* packageRef = nullptr;
13+
jvxBool allowMulti = false;
1314
oneAddedStaticComponent()
1415
{
1516
reset();

sources/jvxComponents/jvxAudioNodes/jvxAuNBitstreamDecoder/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set(LOCAL_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/target/componentEntry.cpp
2626

2727
set(LOCAL_PCG_FILES
2828
${CMAKE_CURRENT_SOURCE_DIR}/codeGen/exports_node.pcg
29+
${CMAKE_CURRENT_SOURCE_DIR}/codeGen/exports_node_select.pcg
2930
)
3031

3132
set(LOCAL_LIBS

sources/jvxComponents/jvxAudioNodes/jvxAuNBitstreamDecoder/src/CjvxAuNBitstreamDecoder.cpp

Lines changed: 106 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -24,41 +24,90 @@ CjvxAuNBitstreamDecoder::~CjvxAuNBitstreamDecoder()
2424

2525
// ===================================================================
2626

27-
#if 0
28-
jvxErrorType
29-
CjvxAuNBitstreamDecoder::select(IjvxObject* owner)
27+
jvxErrorType
28+
CjvxAuNBitstreamDecoder::select(IjvxObject* parent)
3029
{
31-
jvxErrorType res = JVX_LOCAL_BASE_CLASS::select(owner);
30+
jvxErrorType res = CjvxBareNode1ioRearrange::select(parent);
3231
if (res == JVX_NO_ERROR)
3332
{
34-
/*
35-
// Need to allocate properties on selected to allow modification of prefix
36-
genCaptureFile_node::init_all();
37-
genCaptureFile_node::allocate_all();
38-
genCaptureFile_node::register_all(static_cast<CjvxProperties*>(this));
39-
genCaptureFile_node::register_callbacks(static_cast<CjvxProperties*>(this),
40-
set_processing_props, get_processing_monitor,
41-
reinterpret_cast<jvxHandle*>(this), NULL);
42-
*/
33+
genBitstreamDecoder_node_select::init_all();
34+
genBitstreamDecoder_node_select::allocate_all();
35+
genBitstreamDecoder_node_select::register_all(this);
36+
37+
genBitstreamDecoder_node_select::ext_tools_host.ex_interface.ptr = static_cast<IjvxPropertyExtender*>(this);
4338
}
4439
return res;
4540
}
4641

47-
jvxErrorType
42+
jvxErrorType
4843
CjvxAuNBitstreamDecoder::unselect()
4944
{
50-
jvxErrorType res = JVX_LOCAL_BASE_CLASS::unselect();
45+
jvxErrorType res = CjvxBareNode1ioRearrange::_pre_check_unselect();
5146
if (res == JVX_NO_ERROR)
5247
{
53-
/*
54-
genCaptureFile_node::unregister_callbacks(static_cast<CjvxProperties*>(this), NULL);
55-
genCaptureFile_node::unregister_all(static_cast<CjvxProperties*>(this));
56-
genCaptureFile_node::deallocate_all();
57-
*/
48+
genBitstreamDecoder_node_select::ext_tools_host.ex_interface.ptr = nullptr;
49+
genBitstreamDecoder_node_select::unregister_all(this);
50+
genBitstreamDecoder_node_select::deallocate_all();
51+
52+
res = CjvxBareNode1ioRearrange::unselect();
53+
}
54+
return res;
55+
}
56+
57+
// ===============================================================================
58+
59+
jvxErrorType
60+
CjvxAuNBitstreamDecoder::supports_prop_extender_type(jvxPropertyExtenderType tp)
61+
{
62+
if (tp == jvxPropertyExtenderType::JVX_PROPERTY_EXTENDER_SIMPLE_TOOLS_HOST)
63+
{
64+
return JVX_NO_ERROR;
65+
}
66+
return JVX_LOCAL_BASE_CLASS::supports_prop_extender_type(tp);
67+
};
68+
69+
jvxErrorType
70+
CjvxAuNBitstreamDecoder::prop_extender_specialization(jvxHandle** prop_extender, jvxPropertyExtenderType tp)
71+
{
72+
jvxErrorType res = JVX_ERROR_UNSUPPORTED;
73+
switch (tp)
74+
{
75+
case jvxPropertyExtenderType::JVX_PROPERTY_EXTENDER_SIMPLE_TOOLS_HOST:
76+
if (prop_extender)
77+
{
78+
*prop_extender = static_cast<IjvxPropertyExtenderSimpleToolsHostInstall*>(this);
79+
}
80+
res = JVX_NO_ERROR;
81+
break;
82+
default:
83+
return JVX_LOCAL_BASE_CLASS::prop_extender_specialization(prop_extender, tp);
84+
}
85+
return res;
86+
};
87+
88+
jvxErrorType
89+
CjvxAuNBitstreamDecoder::install(IjvxPropertyExtenderSimpleToolsHost* installThis)
90+
{
91+
jvxErrorType res = JVX_ERROR_DUPLICATE_ENTRY;
92+
if (registeredToolsHost == nullptr)
93+
{
94+
registeredToolsHost = installThis;
95+
res = JVX_NO_ERROR;
96+
}
97+
return res;
98+
}
99+
100+
jvxErrorType
101+
CjvxAuNBitstreamDecoder::uninstall(IjvxPropertyExtenderSimpleToolsHost* uninstallThis)
102+
{
103+
jvxErrorType res = JVX_ERROR_ELEMENT_NOT_FOUND;
104+
if (registeredToolsHost == uninstallThis)
105+
{
106+
registeredToolsHost = nullptr;
107+
res = JVX_NO_ERROR;
58108
}
59109
return res;
60110
}
61-
#endif
62111

63112
// ===================================================================
64113

@@ -70,14 +119,30 @@ CjvxAuNBitstreamDecoder::activate()
70119
{
71120
jvxSize num = 0;
72121
jvxSize i;
73-
_common_set.theToolsHost->number_tools(JVX_COMPONENT_AUDIO_CODEC, &num);
74-
for (i = 0; i < num; i++)
122+
if (registeredToolsHost)
123+
{
124+
registeredToolsHost->number_tools(JVX_COMPONENT_AUDIO_CODEC, &num);
125+
for (i = 0; i < num; i++)
126+
{
127+
refComp<IjvxAudioCodec> retI;
128+
retI = reqInstTool<IjvxAudioCodec, IjvxPropertyExtenderSimpleToolsHost>(registeredToolsHost, JVX_COMPONENT_AUDIO_CODEC, i);
129+
if (retI.cpPtr)
130+
{
131+
lstCodecInstances[i] = retI;
132+
}
133+
}
134+
}
135+
else if (_common_set.theToolsHost)
75136
{
76-
refComp<IjvxAudioCodec> retI;
77-
retI = reqInstTool<IjvxAudioCodec, IjvxToolsHost>(_common_set.theToolsHost, JVX_COMPONENT_AUDIO_CODEC, i);
78-
if (retI.cpPtr)
137+
_common_set.theToolsHost->number_tools(JVX_COMPONENT_AUDIO_CODEC, &num);
138+
for (i = 0; i < num; i++)
79139
{
80-
lstCodecInstances[i] = retI;
140+
refComp<IjvxAudioCodec> retI;
141+
retI = reqInstTool<IjvxAudioCodec, IjvxToolsHost>(_common_set.theToolsHost, JVX_COMPONENT_AUDIO_CODEC, i);
142+
if (retI.cpPtr)
143+
{
144+
lstCodecInstances[i] = retI;
145+
}
81146
}
82147
}
83148

@@ -113,10 +178,22 @@ CjvxAuNBitstreamDecoder::deactivate()
113178
// Delete the microconnection
114179

115180
// Release all codecs
116-
for(std::pair<jvxSize, refComp<IjvxAudioCodec>> elm: lstCodecInstances)
181+
if (registeredToolsHost)
182+
{
183+
// Release all codecs
184+
for (std::pair<jvxSize, refComp<IjvxAudioCodec>> elm : lstCodecInstances)
185+
{
186+
retInstTool<IjvxAudioCodec, IjvxPropertyExtenderSimpleToolsHost>(registeredToolsHost, JVX_COMPONENT_AUDIO_CODEC, elm.second, elm.first);
187+
}
188+
}
189+
else if (_common_set.theToolsHost)
117190
{
118-
retInstTool<IjvxAudioCodec, IjvxToolsHost>(_common_set.theToolsHost, JVX_COMPONENT_AUDIO_CODEC, elm.second, elm.first);
191+
for (std::pair<jvxSize, refComp<IjvxAudioCodec>> elm : lstCodecInstances)
192+
{
193+
retInstTool<IjvxAudioCodec, IjvxToolsHost>(_common_set.theToolsHost, JVX_COMPONENT_AUDIO_CODEC, elm.second, elm.first);
194+
}
119195
}
196+
120197
lstCodecInstances.clear();
121198
JVX_LOCAL_BASE_CLASS::deactivate();
122199
}

sources/jvxComponents/jvxAudioNodes/jvxAuNBitstreamDecoder/src/CjvxAuNBitstreamDecoder.h

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
#include "jvxNodes/CjvxBareNode1ioRearrange.h"
66
#include "pcg_exports_node.h"
7+
#include "pcg_exports_node_select.h"
8+
79

810
#include "HjvxMicroConnection.h"
911

@@ -13,7 +15,10 @@
1315
class CjvxAuNBitstreamDecoder:
1416
public JVX_LOCAL_BASE_CLASS,
1517
public IayfConnectionStateSwitchNode,
16-
public genBitstreamDecoder_node
18+
public genBitstreamDecoder_node,
19+
// public IjvxPropertyExtender, <- already implemented!!
20+
public IjvxPropertyExtenderSimpleToolsHostInstall,
21+
public genBitstreamDecoder_node_select
1722
{
1823
private:
1924
class audio_params
@@ -54,15 +59,15 @@ class CjvxAuNBitstreamDecoder:
5459
jvxLinkDataDescriptor decoderDescrIn;
5560
jvxLinkDataDescriptor decoderDescrOut;
5661

62+
IjvxPropertyExtenderSimpleToolsHost* registeredToolsHost = nullptr;
63+
5764
public:
5865

5966
JVX_CALLINGCONVENTION CjvxAuNBitstreamDecoder(JVX_CONSTRUCTOR_ARGUMENTS_MACRO_DECLARE);
6067
~CjvxAuNBitstreamDecoder();
6168

62-
#if 0
6369
virtual jvxErrorType JVX_CALLINGCONVENTION select(IjvxObject* owner)override;
6470
virtual jvxErrorType JVX_CALLINGCONVENTION unselect()override;
65-
#endif
6671

6772
virtual jvxErrorType JVX_CALLINGCONVENTION activate()override;
6873
virtual jvxErrorType JVX_CALLINGCONVENTION deactivate()override;
@@ -96,4 +101,12 @@ class CjvxAuNBitstreamDecoder:
96101
virtual jvxErrorType componentsAboutToConnect() override;
97102
virtual jvxErrorType runTestChainComplete(jvxErrorType lastResult, IjvxSimpleNode* node, const char* moduleName, jvxSize uniqueId) override;
98103

104+
// Interface IjvxPropertyExtender
105+
virtual jvxErrorType supports_prop_extender_type(jvxPropertyExtenderType tp) override;
106+
virtual jvxErrorType prop_extender_specialization(jvxHandle** prop_extender, jvxPropertyExtenderType tp)override;
107+
108+
// Interface IjvxPropertyExtenderSimpleToolsHostInstall
109+
virtual jvxErrorType install(IjvxPropertyExtenderSimpleToolsHost* installThis) override;
110+
virtual jvxErrorType uninstall(IjvxPropertyExtenderSimpleToolsHost* uninstallThis) override;
111+
99112
};

sources/jvxLibraries/ayf-component-lib/include/CayfComponentLib.h

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,17 @@ class CayfComponentLib :
131131
public genComponentLib
132132
{
133133
public:
134-
struct _oneSubModule
134+
template <class T> class _oneSubModule
135135
{
136-
IjvxObject* obj = nullptr;
137-
IjvxNode* node = nullptr;
136+
public:
137+
IjvxObject* obj = nullptr;
138+
T* specObj = nullptr;
139+
};
140+
141+
template <class T> class _oneSubModule_tp : public _oneSubModule<T>
142+
{
143+
public:
144+
jvxComponentIdentification tp;
138145
};
139146

140147
protected:

sources/jvxLibraries/ayf-component-lib/src/CayfComponentLib.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,10 @@ CayfComponentLib::deactivate()
794794

795795
deallocate_main_node();
796796
this->mainObj = nullptr;
797-
797+
798+
// The list of components SHOULD empty. This is up to the deallocate_main:node function!
799+
assert(subsequentComponents.size() == 0);
800+
798801
if (optMasFactory)
799802
{
800803
optMasFactory->deactivate();

sources/jvxLibraries/jvx-app-host/src/CjvxAppFactoryHostBase.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,15 +1305,18 @@ JVX_APP_FACTORY_HOST_CLASSNAME::static_load_loop()
13051305
{
13061306
oneAddedStaticComponent compFromPackage;
13071307
jvxApiString descriptionComponentPackage;
1308+
jvxApiString descriptorComponentPackage;
13081309
IjvxPackage* thePack = reqInterfaceObj<IjvxPackage>(comp.theStaticObject);
13091310
if (thePack)
13101311
{
13111312
jvxSize numCompsPackage = 0;
1313+
jvxComponentType tpCp = jvxComponentType::JVX_COMPONENT_UNKNOWN;
13121314
thePack->number_components(&numCompsPackage);
13131315
for (jvxSize cpi = 0; cpi < numCompsPackage; cpi++)
13141316
{
1315-
resL = thePack->request_entries_component(cpi, &descriptionComponentPackage,
1316-
&compFromPackage.funcInit, &compFromPackage.funcTerm);
1317+
resL = thePack->request_entries_component(cpi,
1318+
&tpCp, &descriptionComponentPackage, &descriptorComponentPackage,
1319+
&compFromPackage.funcInit, &compFromPackage.funcTerm, &compFromPackage.allowMulti);
13171320
if (resL == JVX_NO_ERROR)
13181321
{
13191322
compFromPackage.theStaticObject = NULL;

sources/jvxLibraries/jvx-component-templates-base/src/jvxHosts/CjvxHostInteraction.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -670,13 +670,17 @@ CjvxHostInteraction::loadAllComponents(jvxBool do_unload_dlls, std::vector<std::
670670
{
671671
if (!isPackageMainComponent)
672672
{
673-
jvxApiString descrComp;
673+
jvxApiString descrionComp;
674+
jvxApiString descrorComp;
675+
jvxComponentType tpCp = JVX_COMPONENT_UNKNOWN;
676+
jvxBool allowMulti = false;
674677
newObjAdd = nullptr;
675678
funcInitAdd = nullptr;
676679
funcTermAdd = nullptr;
677680
specCompAdd = nullptr;
678-
jvxErrorType resL = thePack->request_entries_component(tlp, &descrComp,
679-
&funcInitAdd, &funcTermAdd);
681+
jvxErrorType resL = thePack->request_entries_component(tlp,
682+
&tpCp, &descrionComp, &descrorComp,
683+
&funcInitAdd, &funcTermAdd, &allowMulti);
680684
thePackIdx = tlp;
681685
if (resL == JVX_NO_ERROR)
682686
{
@@ -688,12 +692,12 @@ CjvxHostInteraction::loadAllComponents(jvxBool do_unload_dlls, std::vector<std::
688692
{
689693
if (info_cout)
690694
{
691-
std::cout << " - opening object <" << descrComp.std_str() <<
695+
std::cout << " - opening object <" << descrionComp.std_str() <<
692696
" from package <" << astr.std_str() << ">." << std::endl;
693697
}
694698
else
695699
{
696-
outTxt = " - opening object <" + descrComp.std_str() +
700+
outTxt = " - opening object <" + descrionComp.std_str() +
697701
" from package <" + astr.std_str() + ">.";
698702
if (_common_set_host.reportUnit)
699703
{

sources/jvxLibraries/jvx-system-base/include/interfaces/IjvxPackage.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ JVX_INTERFACE IjvxPackage
88

99
virtual jvxErrorType JVX_CALLINGCONVENTION number_components(jvxSize* numOnReturn) = 0;
1010
virtual jvxErrorType JVX_CALLINGCONVENTION request_entries_component(jvxSize idx,
11-
jvxApiString* description, jvxInitObject_tp* funcInit, jvxTerminateObject_tp* funcTerm) = 0;
11+
jvxComponentType* tp, jvxApiString* description, jvxApiString* descriptor,
12+
jvxInitObject_tp* funcInit, jvxTerminateObject_tp* funcTerm, jvxBool* allowMultiplInstances) = 0;
1213
virtual jvxErrorType JVX_CALLINGCONVENTION release_entries_component(jvxSize idx) = 0;
1314

1415
};

0 commit comments

Comments
 (0)