Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Erik Sohns committed Apr 5, 2022
1 parent 56f6881 commit 8dd449e
Show file tree
Hide file tree
Showing 7 changed files with 442 additions and 163 deletions.
126 changes: 83 additions & 43 deletions test_i/av_stream/test_i_av_stream_client.cpp

Large diffs are not rendered by default.

95 changes: 64 additions & 31 deletions test_i/av_stream/test_i_av_stream_client_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,23 @@ typedef Stream_Base_T<ACE_MT_SYNCH,
Test_I_AVStream_Client_DirectShow_StreamSessionData_t,
Stream_ControlMessage_t,
Test_I_AVStream_Client_DirectShow_Message,
Test_I_AVStream_Client_DirectShow_SessionMessage> Test_I_AVStream_Client_DirectShow_StreamBase_t;
Test_I_AVStream_Client_DirectShow_SessionMessage> Test_I_AVStream_Client_DirectShow_Audio_StreamBase_t;
typedef Stream_Base_T<ACE_MT_SYNCH,
Common_TimePolicy_t,
stream_name_string_2,
enum Stream_ControlType,
enum Stream_SessionMessageType,
enum Stream_StateMachine_ControlState,
struct Test_I_AVStream_Client_DirectShow_StreamState,
struct Test_I_AVStream_Client_DirectShow_StreamConfiguration,
struct Stream_Statistic,
struct Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration,
Test_I_AVStream_Client_DirectShow_StreamSessionData,
Test_I_AVStream_Client_DirectShow_StreamSessionData_t,
Stream_ControlMessage_t,
Test_I_AVStream_Client_DirectShow_Message,
Test_I_AVStream_Client_DirectShow_SessionMessage> Test_I_AVStream_Client_DirectShow_Video_StreamBase_t;

typedef Stream_Base_T<ACE_MT_SYNCH,
Common_TimePolicy_t,
stream_name_string_,
Expand All @@ -256,7 +272,22 @@ typedef Stream_Base_T<ACE_MT_SYNCH,
Test_I_AVStream_Client_MediaFoundation_StreamSessionData_t,
Stream_ControlMessage_t,
Test_I_AVStream_Client_MediaFoundation_Message,
Test_I_AVStream_Client_MediaFoundation_SessionMessage> Test_I_AVStream_Client_MediaFoundation_StreamBase_t;
Test_I_AVStream_Client_MediaFoundation_SessionMessage> Test_I_AVStream_Client_MediaFoundation_Audio_StreamBase_t;
typedef Stream_Base_T<ACE_MT_SYNCH,
Common_TimePolicy_t,
stream_name_string_2,
enum Stream_ControlType,
enum Stream_SessionMessageType,
enum Stream_StateMachine_ControlState,
struct Test_I_AVStream_Client_MediaFoundation_StreamState,
struct Test_I_AVStream_Client_MediaFoundation_StreamConfiguration,
struct Stream_Statistic,
struct Test_I_AVStream_Client_MediaFoundation_ModuleHandlerConfiguration,
Test_I_AVStream_Client_MediaFoundation_StreamSessionData,
Test_I_AVStream_Client_MediaFoundation_StreamSessionData_t,
Stream_ControlMessage_t,
Test_I_AVStream_Client_MediaFoundation_Message,
Test_I_AVStream_Client_MediaFoundation_SessionMessage> Test_I_AVStream_Client_MediaFoundation_Video_StreamBase_t;
#else
struct Test_I_AVStream_Client_ALSA_V4L_StreamState;
struct Test_I_AVStream_Client_ALSA_V4L_ModuleHandlerConfiguration;
Expand Down Expand Up @@ -320,9 +351,6 @@ struct Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration
{
Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration ()
: Test_I_AVStream_ModuleHandlerConfiguration ()
#if defined (GUI_SUPPORT)
, area ()
#endif // GUI_SUPPORT
, builder (NULL)
, connection (NULL)
, connectionConfigurations (NULL)
Expand Down Expand Up @@ -352,7 +380,8 @@ struct Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration

struct Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration operator= (const struct Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration& rhs_in)
{
area = rhs_in.area;
Test_I_AVStream_ModuleHandlerConfiguration::operator= (rhs_in);

if (builder)
{
builder->Release (); builder = NULL;
Expand Down Expand Up @@ -423,29 +452,25 @@ struct Test_I_AVStream_Client_DirectShow_ModuleHandlerConfiguration
return *this;
}

#if defined (GUI_SUPPORT)
struct tagRECT area; // visualization module
#endif // GUI_SUPPORT
IGraphBuilder* builder;
Net_IINETConnection_t* connection; // TCP target/IO module
Net_ConnectionConfigurations_t* connectionConfigurations;
IGraphBuilder* builder;
Net_IINETConnection_t* connection; // TCP target/IO module
Net_ConnectionConfigurations_t* connectionConfigurations;
Test_I_AVStream_Client_DirectShow_TCPConnectionManager_t* connectionManager; // TCP IO module
#if defined (GUI_SUPPORT)
#if defined (GTK_USE)
guint contextId;
guint contextId;
#endif // GTK_USE
#endif // GUI_SUPPORT
struct Test_I_AVStream_Client_DirectShow_FilterConfiguration* filterConfiguration;
CLSID filterCLSID;
struct _AMMediaType outputFormat; // display module
bool push;
//struct _AMMediaType sourceFormat;
CLSID filterCLSID;
struct _AMMediaType outputFormat; // display module
bool push;
Test_I_AVStream_Client_DirectShow_StreamConfiguration_t* streamConfiguration;
Test_I_AVStream_Client_DirectShow_ISessionNotify_t* subscriber;
Test_I_AVStream_Client_DirectShow_Subscribers_t* subscribers;
#if defined (GUI_SUPPORT)
IVideoWindow* windowController; // visualization module
IMFVideoDisplayControl* windowController2; // visualization module (EVR)
IVideoWindow* windowController; // visualization module
IMFVideoDisplayControl* windowController2; // visualization module (EVR)
#endif // GUI_SUPPORT
};

Expand Down Expand Up @@ -567,12 +592,14 @@ struct Test_I_AVStream_Client_DirectShow_SignalHandlerConfiguration
: Test_I_SignalHandlerConfiguration ()
, connectionManager (NULL)
// , statisticReportingInterval (0)
, stream (NULL)
, audioStream (NULL)
, videoStream (NULL)
{}

Test_I_AVStream_Client_DirectShow_TCPConnectionManager_t* connectionManager;
Test_I_AVStream_Client_DirectShow_TCPConnectionManager_t* connectionManager;
// unsigned int statisticReportingInterval; // statistic collecting interval (second(s)) [0: off]
Test_I_AVStream_Client_DirectShow_StreamBase_t* stream;
Test_I_AVStream_Client_DirectShow_Audio_StreamBase_t* audioStream;
Test_I_AVStream_Client_DirectShow_Video_StreamBase_t* videoStream;
};
typedef Test_I_AVStream_Client_SignalHandler_T<struct Test_I_AVStream_Client_DirectShow_SignalHandlerConfiguration> Test_I_AVStream_Client_DirectShow_SignalHandler_t;
struct Test_I_AVStream_Client_MediaFoundation_SignalHandlerConfiguration
Expand All @@ -582,12 +609,14 @@ struct Test_I_AVStream_Client_MediaFoundation_SignalHandlerConfiguration
: Test_I_SignalHandlerConfiguration ()
, connectionManager (NULL)
// , statisticReportingInterval (0)
, stream (NULL)
, audioStream (NULL)
, videoStream (NULL)
{}

Test_I_AVStream_Client_MediaFoundation_TCPConnectionManager_t* connectionManager;
Test_I_AVStream_Client_MediaFoundation_TCPConnectionManager_t* connectionManager;
// unsigned int statisticReportingInterval; // statistic collecting interval (second(s)) [0: off]
Test_I_AVStream_Client_MediaFoundation_StreamBase_t* stream;
Test_I_AVStream_Client_MediaFoundation_Audio_StreamBase_t* audioStream;
Test_I_AVStream_Client_MediaFoundation_Video_StreamBase_t* videoStream;
};
typedef Test_I_AVStream_Client_SignalHandler_T<struct Test_I_AVStream_Client_MediaFoundation_SignalHandlerConfiguration> Test_I_AVStream_Client_MediaFoundation_SignalHandler_t;
#else
Expand Down Expand Up @@ -839,19 +868,21 @@ struct Test_I_AVStream_Client_DirectShow_UI_CBData
Test_I_AVStream_Client_DirectShow_UI_CBData ()
: Test_I_AVStream_UI_CBData ()
, configuration (NULL)
, stream (NULL)
, audioStream (NULL)
, videoStream (NULL)
, subscribers ()
, subscribersLock ()
, streamConfiguration (NULL)
, UDPStream (NULL)
{}

struct Test_I_AVStream_Client_DirectShow_Configuration* configuration;
Test_I_AVStream_Client_DirectShow_StreamBase_t* stream;
Test_I_AVStream_Client_DirectShow_Audio_StreamBase_t* audioStream;
Test_I_AVStream_Client_DirectShow_Video_StreamBase_t* videoStream;
Test_I_AVStream_Client_DirectShow_Subscribers_t subscribers;
ACE_SYNCH_RECURSIVE_MUTEX subscribersLock;
IAMStreamConfig* streamConfiguration;
Test_I_AVStream_Client_DirectShow_StreamBase_t* UDPStream;
Test_I_AVStream_Client_DirectShow_Video_StreamBase_t* UDPStream;
};

struct Test_I_AVStream_Client_MediaFoundation_UI_CBData
Expand All @@ -860,17 +891,19 @@ struct Test_I_AVStream_Client_MediaFoundation_UI_CBData
Test_I_AVStream_Client_MediaFoundation_UI_CBData ()
: Test_I_AVStream_UI_CBData ()
, configuration (NULL)
, stream (NULL)
, audioStream (NULL)
, videoStream (NULL)
, subscribers ()
, subscribersLock ()
, UDPStream (NULL)
{}

struct Test_I_AVStream_Client_MediaFoundation_Configuration* configuration;
Test_I_AVStream_Client_MediaFoundation_StreamBase_t* stream;
Test_I_AVStream_Client_MediaFoundation_Audio_StreamBase_t* audioStream;
Test_I_AVStream_Client_MediaFoundation_Video_StreamBase_t* videoStream;
Test_I_AVStream_Client_MediaFoundation_Subscribers_t subscribers;
ACE_SYNCH_RECURSIVE_MUTEX subscribersLock;
Test_I_AVStream_Client_MediaFoundation_StreamBase_t* UDPStream;
Test_I_AVStream_Client_MediaFoundation_Video_StreamBase_t* UDPStream;
};
#else
struct Test_I_AVStream_Client_ALSA_V4L_UI_CBData
Expand Down
18 changes: 12 additions & 6 deletions test_i/av_stream/test_i_av_stream_client_signalhandler.inl
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,24 @@ Test_I_AVStream_Client_SignalHandler_T<ConfigurationType>::handle (const struct
// - stop processing stream
// - activation timers (connection attempts, ...)

// step1: stop processing stream
ACE_ASSERT (inherited::configuration_->stream);
inherited::configuration_->stream->stop (false, // don't block
true); // locked access
// step1: stop processing streams
ACE_ASSERT (inherited::configuration_->audioStream);
ACE_ASSERT (inherited::configuration_->videoStream);
inherited::configuration_->audioStream->stop (false, // don't block
false, // recurse ?
true); // high priority ?
inherited::configuration_->videoStream->stop (false, // don't block
false, // recurse ?
true); // high priority ?

// step2: stop/abort(/wait) for connections
//ConnectionManagerType* connection_manager_p =
// Test_I_AVStream_Client_CONNECTIONMANAGER_SINGLETON::instance ();
// TEST_I_AVSTREAM_CLIENT_CONNECTIONMANAGER_SINGLETON::instance ();
//ACE_ASSERT (connection_manager_p);
//connection_manager_p->stop ();
ACE_ASSERT (inherited::configuration_->connectionManager);
inherited::configuration_->connectionManager->stop (false, true);
inherited::configuration_->connectionManager->stop (false,
true);
inherited::configuration_->connectionManager->abort ();
//inherited::configuration_->connectionManager->wait ();
} // end IF
Expand Down
137 changes: 137 additions & 0 deletions test_i/av_stream/test_i_av_stream_client_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,143 @@
#include "test_i_av_stream_client_stream.h"

#if defined (ACE_WIN32) || defined (ACE_WIN64)
Test_I_AVStream_Client_DirectShow_Audio_Stream::Test_I_AVStream_Client_DirectShow_Audio_Stream ()
: inherited ()
{
STREAM_TRACE (ACE_TEXT ("Test_I_AVStream_Client_DirectShow_Audio_Stream::Test_I_AVStream_Client_DirectShow_Audio_Stream"));

}

bool
Test_I_AVStream_Client_DirectShow_Audio_Stream::load (Stream_ILayout* layout_inout,
bool& delete_out)
{
STREAM_TRACE (ACE_TEXT ("Test_I_AVStream_Client_DirectShow_Audio_Stream::load"));

// *TODO*: remove type inference
// typename inherited::CONFIGURATION_T::ITERATOR_T iterator =
// inherited::configuration_->find (ACE_TEXT_ALWAYS_CHAR (""));
// ACE_ASSERT (iterator != inherited::configuration_->end ());
Stream_Module_t* module_p = NULL;
// typename inherited::MODULE_T* branch_p = NULL; // NULL: 'main' branch
// unsigned int index_i = 0;

// *TODO*: remove type inference
ACE_NEW_RETURN (module_p,
Test_I_AVStream_Client_DirectShow_WASAPIIn_Module (this,
ACE_TEXT_ALWAYS_CHAR (STREAM_DEV_WASAPI_CAPTURE_DEFAULT_NAME_STRING)),
false);
layout_inout->append (module_p, NULL, 0);
module_p = NULL;
ACE_NEW_RETURN (module_p,
Test_I_AVStream_Client_DirectShow_Audio_Tagger_Module (this,
ACE_TEXT_ALWAYS_CHAR (STREAM_LIB_TAGGER_DEFAULT_NAME_STRING)),
false);
layout_inout->append (module_p, NULL, 0);
module_p = NULL;

//#if defined (GUI_SUPPORT)
// if ((*iterator).second.second->window)
// {
// ACE_NEW_RETURN (module_p,
// Test_I_AVStream_Client_ALSA_V4L_Distributor_Module (this,
// ACE_TEXT_ALWAYS_CHAR (STREAM_MISC_DISTRIBUTOR_DEFAULT_NAME_STRING)),
// false);
// layout_inout->append (module_p, NULL, 0);
// branch_p = module_p;
// inherited::configuration_->configuration_->branches.push_back (ACE_TEXT_ALWAYS_CHAR (STREAM_SUBSTREAM_DISPLAY_NAME));
// Stream_IDistributorModule* idistributor_p =
// dynamic_cast<Stream_IDistributorModule*> (module_p->writer ());
// ACE_ASSERT (idistributor_p);
// idistributor_p->initialize (inherited::configuration_->configuration_->branches);
// } // end IF

ACE_ASSERT (inherited::configuration_->configuration_->module_2);
layout_inout->append (inherited::configuration_->configuration_->module_2, NULL, 0);

// if ((*iterator).second.second->window)
// {
// module_p = NULL;
// ACE_NEW_RETURN (module_p,
// Test_I_AVStream_Client_ALSA_V4L_Resize_Module (this,
// ACE_TEXT_ALWAYS_CHAR (STREAM_VIS_LIBAV_RESIZE_DEFAULT_NAME_STRING)),
// false);
// layout_inout->append (module_p, branch_p, index_i);
// module_p = NULL;
//#if defined (GTK_USE)
// ACE_NEW_RETURN (module_p,
// Test_I_AVStream_Client_ALSA_V4L_Display_Module (this,
// ACE_TEXT_ALWAYS_CHAR (STREAM_VIS_GTK_PIXBUF_DEFAULT_NAME_STRING)),
// false);
// layout_inout->append (module_p, branch_p, index_i);
// module_p = NULL;
//#endif // GTK_USE
//#endif // GUI_SUPPORT
// } // end IF

delete_out = true;

return true;
}

bool
Test_I_AVStream_Client_DirectShow_Audio_Stream::initialize (const typename inherited::CONFIGURATION_T& configuration_in)
{
STREAM_TRACE (ACE_TEXT ("Test_I_AVStream_Client_DirectShow_Audio_Stream::initialize"));

// bool result = false;
bool setup_pipeline = configuration_in.configuration_->setupPipeline;
bool reset_setup_pipeline = false;
struct Stream_MediaFramework_DirectShow_AudioVideoFormat format_s;

// allocate a new session state, reset stream
const_cast<typename inherited::CONFIGURATION_T&> (configuration_in).configuration_->setupPipeline =
false;
reset_setup_pipeline = true;
if (!inherited::initialize (configuration_in))
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%s: failed to Stream_Base_T::initialize(), aborting\n"),
ACE_TEXT (stream_name_string_)));
return false;
} // end IF
const_cast<typename inherited::CONFIGURATION_T&> (configuration_in).configuration_->setupPipeline =
setup_pipeline;
reset_setup_pipeline = false;
ACE_ASSERT (inherited::sessionData_);
Test_I_AVStream_Client_DirectShow_StreamSessionData& session_data_r =
const_cast<Test_I_AVStream_Client_DirectShow_StreamSessionData&> (inherited::sessionData_->getR ());
// *TODO*: remove type inferences
typename inherited::CONFIGURATION_T::ITERATOR_T iterator =
const_cast<typename inherited::CONFIGURATION_T&> (configuration_in).find (ACE_TEXT_ALWAYS_CHAR (""));
ACE_ASSERT (iterator != configuration_in.end ());
ACE_ASSERT (session_data_r.formats.empty ());
Stream_MediaFramework_DirectShow_Tools::copy (configuration_in.configuration_->format,
format_s);
session_data_r.formats.push_back (format_s);
session_data_r.stream = this;

if (configuration_in.configuration_->setupPipeline)
if (!inherited::setup (NULL))
{
ACE_DEBUG ((LM_ERROR,
ACE_TEXT ("%s: failed to set up pipeline, aborting\n"),
ACE_TEXT (stream_name_string_)));
goto error;
} // end IF

// OK: all went well
inherited::isInitialized_ = true;

return true;

error:
if (reset_setup_pipeline)
const_cast<typename inherited::CONFIGURATION_T&> (configuration_in).configuration_->setupPipeline =
setup_pipeline;

return false;
}
#else
Test_I_AVStream_Client_ALSA_Stream::Test_I_AVStream_Client_ALSA_Stream ()
: inherited ()
Expand Down
Loading

0 comments on commit 8dd449e

Please sign in to comment.