gst_plugins_symbian/gst/devsound/devsoundsinkwrapper.h
changeset 0 0e761a78d257
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gst_plugins_symbian/gst/devsound/devsoundsinkwrapper.h	Thu Dec 17 08:53:32 2009 +0200
@@ -0,0 +1,177 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description: 
+*
+*/
+
+
+
+#include <mmf/server/sounddevice.h>
+#include <mmf/server/mmfbuffer.h>
+#include <mmf/server/mmfdatabuffer.h>
+#include <dirent.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <semaphore.h>
+
+#include <e32def.h>
+#include <e32cons.h>
+#include <e32std.h>
+
+
+
+#include "gstdevsoundsink.h"
+
+#include <IlbcDecoderIntfc.h>
+#include <G711DecoderIntfc.h>
+#include <G729DecoderIntfc.h>
+#include <ErrorConcealmentIntfc.h>
+#include <AudioOutput.h>
+
+#include "gstg729decoderinterface.h"
+#include "gstilbcdecoderinterface.h"
+
+class CActiveListener : public CActive
+	{
+public:
+CActiveSchedulerWait *asw;
+	CActiveListener() : CActive(CActive::EPriorityStandard)
+		{
+		CActiveScheduler::Add(this);
+		}
+	void InitialiseActiveListener()
+		{
+		iStatus = KRequestPending; SetActive();
+		}
+	// From CActive
+	virtual void RunL()
+		{
+		asw->AsyncStop();
+		}
+	void StartActiveScheduler()
+	    {
+	    asw->Start();
+	    }
+	virtual void DoCancel()
+		{
+		asw->AsyncStop();
+		};
+
+	};
+
+
+class DevSoundWrapper:public MDevSoundObserver
+{
+
+public:
+    DevSoundWrapper();
+
+	CActiveListener	*AL;
+	CActiveScheduler *as;
+	TInt init_complete;
+	CMMFBuffer *buffer;
+	CMMFDevSound    *dev_sound;
+	TMMFCapabilities caps;
+  	int buffersize;
+  	int volume;
+  	int dev_count;
+  	TInt iCallbackError;
+  	TUint32 fourcc;
+  	bool eosReceived;
+  	//sem_t mutex;
+  	//RArray<TFourCC> supportedtypes;
+    CErrorConcealmentIntfc* iErrConcealmentIntfc;
+    CG711DecoderIntfc*      iG711DecoderIntfc;
+    CG729DecoderIntfc*      iG729DecoderIntfc;
+    CIlbcDecoderIntfc*      iIlbcDecoderIntfc;
+    CAudioOutput*           iAudioOutput;
+
+
+public:
+	void InitializeComplete(TInt aError);
+	void ToneFinished(TInt aError);
+	void BufferToBeFilled(CMMFBuffer* aBuffer);
+	void PlayError(TInt aError);
+	void BufferToBeEmptied(CMMFBuffer* aBuffer);
+	void RecordError(TInt aError);
+	void ConvertError(TInt aError);
+	void DeviceMessage(TUid aMessageType, const TDesC8& aMsg);
+	void SendEventToClient(const TMMFEvent& aEvent);
+	void GetDataTypesL(GstDevsoundSink *ds);
+};
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+	int playinit(DevSoundWrapper *handle);
+
+	int write_data(DevSoundWrapper *handle,TUint8 *ptr, int length, gboolean lastBuffer);
+	int play_data(DevSoundWrapper *handle);
+	int get_rate(DevSoundWrapper *handle);
+	int get_channels(DevSoundWrapper *handle);
+	int get_encoding(DevSoundWrapper *handle);
+	int get_size(DevSoundWrapper *handle);
+	void set_rate(DevSoundWrapper *handle,int rate);
+	void set_channels(DevSoundWrapper *handle,int channels);
+	void set_encoding(DevSoundWrapper *handle,int encoding);
+	void set_size(DevSoundWrapper *handle,int size);
+	void set_fourcc(DevSoundWrapper *handle,int fourcc);
+
+	void set_volume(DevSoundWrapper* handle,int volume);
+
+	int open_devsound(DevSoundWrapper **handle);
+	int open_device(DevSoundWrapper **handle);
+    int initialize_devsound(GstDevsoundSink* sink);
+    int close_devsound(GstDevsoundSink *ds);
+    int check_if_device_open(DevSoundWrapper *handle) ;
+
+	int get_ds_cb_error(DevSoundWrapper *handle);
+
+	//Error Concealment custom interface
+    void conceal_error_for_next_buffer(DevSoundWrapper *handle);
+    void set_framemode(DevSoundWrapper *handle,gboolean mode);
+    int framemode_rqrd_for_ec(DevSoundWrapper *handle,gboolean* modereq);
+
+    //G711 custom interface
+    int set_decodermode(DevSoundWrapper* handle,int aDecodeMode);
+    int set_cng(DevSoundWrapper* handle,gboolean aCng);
+    int get_cng(DevSoundWrapper* handle,gboolean* aCng);
+    int set_plc(DevSoundWrapper* handle,gboolean aPlc);
+
+    //G729 custom interface
+    gint badlsfnextbuffer(DevSoundWrapper *handle);
+
+    //Ilbc custom interace
+    gint get_ilbccng(DevSoundWrapper *handle,gboolean* aCng);
+    gint set_ilbccng(DevSoundWrapper *handle,gboolean aCng);
+    gint set_ilbcdecodermode(DevSoundWrapper *handle,enum TIlbcDecodeMode aDecodeMode);
+
+
+	int post_init_setconfig(DevSoundWrapper *handle);
+	int reset_devsound(DevSoundWrapper *handle);
+
+	void populateproperties(GstDevsoundSink *ds);
+    void initproperties(GstDevsoundSink* ds);
+	int pre_init_setconf(GstDevsoundSink *ds);
+	void getsupporteddatatypes(GstDevsoundSink *ds);
+
+
+#ifdef __cplusplus
+}//extern c
+#endif