Skip to content

Commit

Permalink
Renamed AudioManager.vala to AVManager.vala
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed Aug 21, 2014
1 parent 6f46bd5 commit b186874
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 31 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ CONFIGURE_FILE( config.h.in config.h )
# define our source files
SET( VENOM_SRC
Main.vala
core/AudioManager.vala
core/AVManager.vala
core/Contact.vala
core/ContactStorage.vala
core/DhtNode.vala
Expand Down
38 changes: 17 additions & 21 deletions src/core/AudioManager.vala → src/core/AVManager.vala
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* AudioManager.vala
* AVManager.vala
*
* Copyright (C) 2013-2014 Venom authors and contributors
*
Expand All @@ -20,7 +20,7 @@
*/

namespace Venom {
public errordomain AudioManagerError {
public errordomain AVManagerError {
INIT,
PIPELINE
}
Expand Down Expand Up @@ -59,7 +59,7 @@ namespace Venom {
int var1;
}

public class AudioManager {
public class AVManager {

private const string PIPELINE_IN = "audioPipelineIn";
private const string AUDIO_SOURCE_IN = "audioSourceIn";
Expand Down Expand Up @@ -128,29 +128,29 @@ namespace Venom {
}
}

public static AudioManager instance {get; private set; default = null;}
public static AVManager instance {get; private set;}

public static void init() throws AudioManagerError {
public static void init() throws AVManagerError {
#if DEBUG
instance = new AudioManager({"", "--gst-debug-level=0"});
instance = new AVManager({"", "--gst-debug-level=3"});
#else
instance = new AudioManager({""});
instance = new AVManager({""});
#endif
}

public static void free() {
Logger.log(LogLevel.DEBUG, "Audiomanager free called");
Logger.log(LogLevel.DEBUG, "AVManager free called");
instance = null;
}

private AudioManager(string[] args) throws AudioManagerError {
private AVManager(string[] args) throws AVManagerError {
// Initialize Gstreamer
try {
if(!Gst.init_check(ref args)) {
throw new AudioManagerError.INIT("Gstreamer initialization failed.");
throw new AVManagerError.INIT("Gstreamer initialization failed.");
}
} catch (Error e) {
throw new AudioManagerError.INIT(e.message);
throw new AVManagerError.INIT(e.message);
}
Logger.log(LogLevel.INFO, "Gstreamer initialized");

Expand All @@ -162,7 +162,7 @@ namespace Venom {
" ! volume name=" + AUDIO_VOLUME_IN +
" ! openalsink name=" + AUDIO_SINK_IN) as Gst.Pipeline;
} catch (Error e) {
throw new AudioManagerError.PIPELINE("Error creating the audio input pipeline: " + e.message);
throw new AVManagerError.PIPELINE("Error creating the audio input pipeline: " + e.message);
}
audio_source_in = pipeline_in.get_by_name(AUDIO_SOURCE_IN) as Gst.AppSrc;
audio_volume_in = pipeline_in.get_by_name(AUDIO_VOLUME_IN);
Expand All @@ -174,7 +174,7 @@ namespace Venom {
" ! volume name=" + AUDIO_VOLUME_OUT +
" ! appsink name=" + AUDIO_SINK_OUT) as Gst.Pipeline;
} catch (Error e) {
throw new AudioManagerError.PIPELINE("Error creating the audio output pipeline: " + e.message);
throw new AVManagerError.PIPELINE("Error creating the audio output pipeline: " + e.message);
}
audio_source_out = pipeline_out.get_by_name(AUDIO_SOURCE_OUT);
audio_volume_out = pipeline_out.get_by_name(AUDIO_VOLUME_OUT);
Expand All @@ -186,7 +186,7 @@ namespace Venom {
" ! ffmpegcolorspace name=" + VIDEO_CONVERTER +
" ! xvimagesink name=" + VIDEO_SINK_IN) as Gst.Pipeline;
} catch (Error e) {
throw new AudioManagerError.PIPELINE("Error creating the video input pipeline: " + e.message);
throw new AVManagerError.PIPELINE("Error creating the video input pipeline: " + e.message);
}
video_source_in = video_pipeline_in.get_by_name(VIDEO_SOURCE_IN) as Gst.AppSrc;
video_sink_in = video_pipeline_in.get_by_name(VIDEO_SINK_IN);
Expand All @@ -197,7 +197,7 @@ namespace Venom {
" ! ffmpegcolorspace name=" + VIDEO_CONVERTER_OUT +
" ! appsink name=" + VIDEO_SINK_OUT) as Gst.Pipeline;
} catch (Error e) {
throw new AudioManagerError.PIPELINE("Error creating the video output pipeline: " + e.message);
throw new AVManagerError.PIPELINE("Error creating the video output pipeline: " + e.message);
}
video_source_out = video_pipeline_out.get_by_name(VIDEO_SOURCE_OUT);
video_converter_out = video_pipeline_out.get_by_name(VIDEO_CONVERTER_OUT);
Expand Down Expand Up @@ -233,8 +233,8 @@ namespace Venom {
Settings.instance.bind_property(Settings.MIC_VOLUME_KEY, audio_volume_out, "volume", BindingFlags.SYNC_CREATE);
}

~AudioManager() {
Logger.log(LogLevel.INFO, "Audiomanager destructor called");
~AVManager() {
Logger.log(LogLevel.INFO, "AVManager destructor called");
audio_status_changes.push( AVStatusChange() {
type = VideoStatusChangeType.KILL
});
Expand Down Expand Up @@ -263,9 +263,7 @@ namespace Venom {

private void register_callbacks() {
toxav.register_audio_recv_callback(audio_receive_callback);
#if DEBUG
toxav.register_video_recv_callback(video_receive_callback);
#endif
}

private void destroy_audio_pipeline() {
Expand Down Expand Up @@ -293,11 +291,9 @@ namespace Venom {
}

private void set_video_pipeline_playing() {
#if DEBUG
video_pipeline_in.set_state(Gst.State.PLAYING);
video_pipeline_out.set_state(Gst.State.PLAYING);
Logger.log(LogLevel.INFO, "Video pipeline set to playing");
#endif
}

private void set_video_pipeline_paused() {
Expand Down
6 changes: 3 additions & 3 deletions src/ui/Client.vala
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,8 @@ namespace Venom {
protected override void startup() {
add_action_entries(app_entries, this);
try {
AudioManager.init();
} catch (AudioManagerError e) {
AVManager.init();
} catch (AVManagerError e) {
Logger.log(LogLevel.FATAL, "Error creating Audio Pipeline: " + e.message);
}
Notification.init(APPLICATION_NAME);
Expand All @@ -123,7 +123,7 @@ namespace Venom {
if(contact_list_window != null) {
contact_list_window.cleanup();
}
AudioManager.free();
AVManager.free();
base.shutdown();
}

Expand Down
12 changes: 6 additions & 6 deletions src/ui/ContactListWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ namespace Venom {
// Create a new session, load/create session data
private void init_session() {
session = new ToxSession();
AudioManager.instance.tox_session = session;
AVManager.instance.tox_session = session;
try {
session.load_from_file(ResourceFactory.instance.data_filename);
} catch (Error e) {
Expand Down Expand Up @@ -348,13 +348,13 @@ namespace Venom {

/*=== AV signals ===*/
session.on_av_invite.connect(this.on_av_invite);
session.on_av_start.connect(AudioManager.instance.on_start_call);
session.on_av_end.connect(AudioManager.instance.on_end_call);
session.on_av_start.connect(AVManager.instance.on_start_call);
session.on_av_end.connect(AVManager.instance.on_end_call);
//av responses
session.on_av_starting.connect(AudioManager.instance.on_start_call);
session.on_av_ending.connect(AudioManager.instance.on_end_call);
session.on_av_starting.connect(AVManager.instance.on_start_call);
session.on_av_ending.connect(AVManager.instance.on_end_call);
//av protocol
session.on_av_peer_timeout.connect(AudioManager.instance.on_end_call);
session.on_av_peer_timeout.connect(AVManager.instance.on_end_call);

//file signals
session.on_file_sendrequest.connect(this.on_file_sendrequest);
Expand Down

0 comments on commit b186874

Please sign in to comment.