[xiph-commits] r8791 - in trunk/oggdsf/src/lib/codecs: helper/libfishsound/include/fishsound helper/libfishsound/src/libfishsound vorbis/filters/dsfVorbisEncoder

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Wed Jan 26 05:09:50 PST 2005


Author: illiminable
Date: 2005-01-26 05:09:33 -0800 (Wed, 26 Jan 2005)
New Revision: 8791

Added:
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/IVorbisEncodeSettings.h
Modified:
   trunk/oggdsf/src/lib/codecs/helper/libfishsound/include/fishsound/constants.h
   trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/vorbis.c
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.vcproj
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/vorbisencoderdllstuff.h
Log:
* Vorbis encoder filter now has interface to set vorbis quality

Modified: trunk/oggdsf/src/lib/codecs/helper/libfishsound/include/fishsound/constants.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/helper/libfishsound/include/fishsound/constants.h	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/helper/libfishsound/include/fishsound/constants.h	2005-01-26 13:09:33 UTC (rev 8791)
@@ -71,9 +71,9 @@
 
   /** Set to 1 to interleave, 0 to non-interleave */
   FISH_SOUND_SET_INTERLEAVE      = 0x2001,
-
+  /** Hackination */
   FISH_SOUND_VORBIS_SET_QUALITY = 0x2100,
-
+  /** Hackination ends */
   FISH_SOUND_SET_ENCODE_VBR             = 0x4000,
 
   

Modified: trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/vorbis.c
===================================================================
--- trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/vorbis.c	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/vorbis.c	2005-01-26 13:09:33 UTC (rev 8791)
@@ -435,9 +435,10 @@
 	  fsound->info.samplerate);
 #endif
 
-
+ /* Hackination here */
   vorbis_encode_init_vbr (&fsv->vi, fsound->info.channels,
 			  fsound->info.samplerate, (float)fs_vorbis_quality_setting_variable /* quality */);
+  /* Hackination ends */
 
   vorbis_encode_setup_init (&fsv->vi);
 

Added: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/IVorbisEncodeSettings.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/IVorbisEncodeSettings.h	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/IVorbisEncodeSettings.h	2005-01-26 13:09:33 UTC (rev 8791)
@@ -0,0 +1,24 @@
+#pragma once
+
+#ifndef __IVORBISENCODESETTINGS__
+#define __IVORBISENCODESETTINGS__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+DECLARE_INTERFACE_(IVorbisEncodeSettings, IUnknown) {
+
+	//virtual STDMETHODIMP_(unsigned long) targetBitrate() PURE;
+	//virtual STDMETHODIMP_(bool) setTargetBitrate(unsigned long inBitrate) PURE;
+	
+	virtual STDMETHODIMP_(signed char) quality() PURE;
+	virtual STDMETHODIMP_(bool) setQuality(signed char inQuality) PURE;
+};
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp	2005-01-26 13:09:33 UTC (rev 8791)
@@ -71,6 +71,11 @@
 }
 
 STDMETHODIMP VorbisEncodeFilter::NonDelegatingQueryInterface(REFIID riid, void **ppv) {
+	if (riid == IID_IVorbisEncodeSettings) {
+		*ppv = (IVorbisEncodeSettings*)this;
+		((IUnknown*)*ppv)->AddRef();
+		return NOERROR;
+	}
 	return AbstractTransformFilter::NonDelegatingQueryInterface(riid, ppv);
 }
 bool VorbisEncodeFilter::ConstructPins() 
@@ -105,4 +110,19 @@
 	
 	mInputPin = new VorbisEncodeInputPin(this, m_pLock, mOutputPin, locAcceptableTypes);	//Deleted in base class filter destructor.
 	return true;
+}
+
+
+STDMETHODIMP_(signed char) VorbisEncodeFilter::quality() {
+	return (signed char)( ((VorbisEncodeInputPin*)mInputPin)->mVorbisQuality * 100 );
+}
+
+
+STDMETHODIMP_(bool) VorbisEncodeFilter::setQuality(signed char inQuality) {
+	if ((inQuality >= 0) && (inQuality < 100)) {
+		((VorbisEncodeInputPin*)mInputPin)->mVorbisQuality = (float)inQuality/(float)100;
+		return true;
+	} else {
+		return false;
+	}
 }
\ No newline at end of file

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.h	2005-01-26 13:09:33 UTC (rev 8791)
@@ -33,6 +33,7 @@
 
 //Local Includes
 #include "vorbisencoderdllstuff.h"
+#include "IVorbisEncodeSettings.h"
 
 //External Includes
 #include "AbstractTransformFilter.h"
@@ -44,6 +45,7 @@
 
 class VorbisEncodeFilter
 	:	public AbstractTransformFilter
+	,	public IVorbisEncodeSettings
 {
 public:
 	//Friend Classes
@@ -61,6 +63,13 @@
 	//COM Creator function
 	static CUnknown* WINAPI VorbisEncodeFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
 
+	/// Returns the quality setting for vorbis
+	virtual STDMETHODIMP_(signed char) quality();
+
+	/// Set the quality for vorbis encoding, between 0 and 99 inclusive (equiv to 0.0 to 0.99)
+	virtual STDMETHODIMP_(bool) setQuality(signed char inQuality);
+
+
 protected:
 
 	//Implementation of pure virtuals from AbstractTransformFilter
@@ -68,37 +77,8 @@
 
 	//Member data
 	sVorbisFormatBlock mVorbisFormatBlock;
+
+
 	
 };
 
-
-//Old imp
-//*************************************
-//#pragma once
-//
-//#include "vorbisencoderdllstuff.h"
-//#include "AbstractAudioEncodeFilter.h"
-//
-////Forward Declarations
-//struct sVorbisFormatBlock;
-//class VorbisEncodeInputPin;
-//class VorbisEncodeOutputPin;
-//
-//class VorbisEncodeFilter
-//	:	public AbstractAudioEncodeFilter
-//{
-//public:
-//	friend class VorbisEncodeInputPin;
-//	friend class VorbisEncodeOutputPin;
-//	VorbisEncodeFilter(void);
-//	virtual ~VorbisEncodeFilter(void);
-//
-//	static CUnknown* WINAPI VorbisEncodeFilter::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr);
-//
-//	//PURE VIRTUAL IMPLEMENTATION
-//	virtual bool ConstructPins();
-//
-//protected:
-//	sVorbisFormatBlock mVorbisFormatBlock;
-//	
-//};

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp	2005-01-26 13:09:33 UTC (rev 8791)
@@ -39,7 +39,7 @@
 	,	mFishSound(NULL)
 	,	mWaveFormat(NULL)
 	,	mUptoFrame(0)
-	,	mVorbisQuality(0.6)
+	,	mVorbisQuality(0.6f)
 {
 	
 }

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h	2005-01-26 13:09:33 UTC (rev 8791)
@@ -48,6 +48,8 @@
 	VorbisEncodeInputPin(AbstractTransformFilter* inParentFilter, CCritSec* inFilterLock, AbstractTransformOutputPin* inOutputPin, vector<CMediaType*> inAcceptableMediaTypes);
 	virtual ~VorbisEncodeInputPin(void);
 
+	friend class VorbisEncodeFilter;
+
 	static int __cdecl VorbisEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
 	
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
@@ -59,6 +61,7 @@
 	virtual bool ConstructCodec();
 	virtual void DestroyCodec();
 
+
 	//Member data
 	HRESULT mHR;
 	bool mBegun;

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.vcproj
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.vcproj	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/dsfVorbisEncoder.vcproj	2005-01-26 13:09:33 UTC (rev 8791)
@@ -312,6 +312,9 @@
 				RelativePath=".\fish_cdecl.h">
 			</File>
 			<File
+				RelativePath=".\IVorbisEncodeSettings.h">
+			</File>
+			<File
 				RelativePath="stdafx.h">
 			</File>
 			<File

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/vorbisencoderdllstuff.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/vorbisencoderdllstuff.h	2005-01-26 12:19:33 UTC (rev 8790)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/vorbisencoderdllstuff.h	2005-01-26 13:09:33 UTC (rev 8791)
@@ -78,6 +78,10 @@
 0x44e04f43, 0x58b3, 0x4de1, 0x9b, 0xaa, 0x89, 0x1, 0xf8, 0x52, 0xda, 0xe4);
 
 
+// {A4C6A887-7BD3-4b33-9A57-A3EB10924D3A}
+DEFINE_GUID(IID_IVorbisEncodeSettings, 
+0xa4c6a887, 0x7bd3, 0x4b33, 0x9a, 0x57, 0xa3, 0xeb, 0x10, 0x92, 0x4d, 0x3a);
+
 const REGPINTYPES VorbisEncodeInputTypes = {
     &MEDIATYPE_Audio,
 	&MEDIASUBTYPE_PCM



More information about the commits mailing list