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

illiminable at motherfish-iii.xiph.org illiminable at motherfish-iii.xiph.org
Wed Jan 26 08:20:42 PST 2005


Author: illiminable
Date: 2005-01-26 08:20:21 -0800 (Wed, 26 Jan 2005)
New Revision: 8793

Modified:
   trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/fishsound.c
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp
   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/VorbisEncodeOutputPin.cpp
Log:
* Fishsound sets up it's encoder params when you do a fishsound_new, after that you have no way to set the params. So we use fishsound_command to set an internal  variable, and pass in a fake FishSound pointer to trick the test for NULL. This lets us call fishsound_command before fishsound_new. Pretty nasty hack, but now you can set quality. In fact with this particular build... you must set it like this, otherwise it will try and use garbage memory.
* Updated the encoder filters to do this trick.
* Got rid of some old guff commented out code.

Modified: trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/fishsound.c
===================================================================
--- trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/fishsound.c	2005-01-26 15:20:45 UTC (rev 8792)
+++ trunk/oggdsf/src/lib/codecs/helper/libfishsound/src/libfishsound/fishsound.c	2005-01-26 16:20:21 UTC (rev 8793)
@@ -79,7 +79,7 @@
   FishSound * fsound;
 
   	/* Zen's hackination for quality settings - PART C */
-	fs_vorbis_quality_setting_variable = 0.3;
+	//fs_vorbis_quality_setting_variable = 0.3;
 	/* End hackination */
 
   if (!FS_DECODE && mode == FISH_SOUND_DECODE) return NULL;

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp	2005-01-26 15:20:45 UTC (rev 8792)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeFilter.cpp	2005-01-26 16:20:21 UTC (rev 8793)
@@ -119,10 +119,14 @@
 
 
 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/VorbisEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp	2005-01-26 15:20:45 UTC (rev 8792)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp	2005-01-26 16:20:21 UTC (rev 8793)
@@ -41,11 +41,13 @@
 	,	mUptoFrame(0)
 	,	mVorbisQuality(0.6f)
 {
-	
+	debugLog.open("G:\\logs\\vorbisenc.logs", ios_base::out);
+
 }
 
 VorbisEncodeInputPin::~VorbisEncodeInputPin(void)
 {
+	debugLog.close();
 	DestroyCodec();
 }
 
@@ -81,6 +83,15 @@
 	mFishInfo.samplerate = mWaveFormat->nSamplesPerSec;
     
 	mFishInfo.format = FISH_SOUND_VORBIS;
+	
+	//This has to be done before fishsound new... otherwise, wy the time we get to setting it later... it's too late.
+	debugLog<<"Setting quality with fs command to "<<mVorbisQuality<<endl;
+	
+	//Evil bit of hackery to trick the check for null.
+	int I_AM_NOT_NULL = 1;
+
+	fish_sound_command((FishSound*)I_AM_NOT_NULL, FISH_SOUND_VORBIS_SET_QUALITY, &mVorbisQuality, sizeof(float));
+
 	mFishSound = fish_sound_new (FISH_SOUND_ENCODE, &mFishInfo);
 
 	//Change to fill in vorbis format block so muxer can work
@@ -92,9 +103,8 @@
 	//FIX::: Use new API for interleave setting
 	fish_sound_command(mFishSound, FISH_SOUND_SET_INTERLEAVE, &i, sizeof(int));
 
-	
-	fish_sound_command(mFishSound, FISH_SOUND_VORBIS_SET_QUALITY, &mVorbisQuality, sizeof(float));
 
+
 	fish_sound_set_encoded_callback (mFishSound, VorbisEncodeInputPin::VorbisEncoded, this);
 	//FIX::: Proper return value
 	return true;

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h	2005-01-26 15:20:45 UTC (rev 8792)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h	2005-01-26 16:20:21 UTC (rev 8793)
@@ -35,7 +35,8 @@
 #include "VorbisEncodeInputPin.h"
 
 #include "VorbisEncodeFilter.h"
-
+#include <fstream>
+using namespace std;
 extern "C" {
 //#include <fishsound/fishsound.h>
 #include "fish_cdecl.h"
@@ -74,46 +75,8 @@
 
 	float mVorbisQuality;
 
+	fstream debugLog;
+
 	
 };
 
-
-//Old imp
-//****************************************************
-//#pragma once
-//
-//#include "AbstractAudioEncodeInputPin.h"
-//#include "VorbisEncodeInputPin.h"
-//
-//#include "VorbisEncodeFilter.h"
-//
-//extern "C" {
-//#include <fishsound/fishsound.h>
-////#include <../src/libfishsound/private.h>
-//}
-//
-//class VorbisEncodeInputPin
-//	:	public AbstractAudioEncodeInputPin
-//{
-//public:
-//	VorbisEncodeInputPin(AbstractAudioEncodeFilter* inFilter, CCritSec* inFilterLock, AbstractAudioEncodeOutputPin* inOutputPin);
-//	virtual ~VorbisEncodeInputPin(void);
-//
-//	static int VorbisEncodeInputPin::VorbisEncoded (FishSound* inFishSound, unsigned char* inPacketData, long inNumBytes, void* inThisPointer) ;
-//	//PURE VIRTUALS
-//	virtual long encodeData(unsigned char* inBuf, long inNumBytes);
-//	virtual bool ConstructCodec();
-//	virtual void DestroyCodec();
-//	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
-//
-//protected:
-//	HRESULT mHR;
-//	bool mBegun;
-//	//VorbisDecodeOutputPin* mOutputPin;
-//	//__int64 mUptoFrame;
-//
-//	FishSound* mFishSound;
-//	FishSoundInfo mFishInfo; 
-//
-//	
-//};

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeOutputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeOutputPin.cpp	2005-01-26 15:20:45 UTC (rev 8792)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeOutputPin.cpp	2005-01-26 16:20:21 UTC (rev 8793)
@@ -55,38 +55,3 @@
 	}
 }
 
-
-//bool VorbisEncodeOutputPin::FillFormatBuffer(BYTE* inFormatBuffer) {
-//	VorbisEncodeFilter* locParentFilter = (VorbisEncodeFilter*)mParentFilter;
-//	memcpy((void*)inFormatBuffer, (const void*) &(locParentFilter->mVorbisFormatBlock), sizeof(sVorbisFormatBlock));
-//	return true;
-//}
-//unsigned long VorbisEncodeOutputPin::FormatBufferSize() {
-//	return sizeof(sVorbisFormatBlock);
-//}
-
-
-
-
-//Old imp
-//*********************************************
-//#include "stdafx.h"
-//#include "vorbisencodeoutputpin.h"
-//
-//VorbisEncodeOutputPin::VorbisEncodeOutputPin(VorbisEncodeFilter* inParentFilter,CCritSec* inFilterLock, CMediaType* inOutputMediaType)
-//	:	AbstractAudioEncodeOutputPin(inParentFilter, inFilterLock,NAME("VorbisDecodeOutputPin"), L"Vorbis Out", inOutputMediaType)
-//{
-//}
-//
-//VorbisEncodeOutputPin::~VorbisEncodeOutputPin(void)
-//{
-//}
-//
-//bool VorbisEncodeOutputPin::FillFormatBuffer(BYTE* inFormatBuffer) {
-//	VorbisEncodeFilter* locParentFilter = (VorbisEncodeFilter*)mParentFilter;
-//	memcpy((void*)inFormatBuffer, (const void*) &(locParentFilter->mVorbisFormatBlock), sizeof(sVorbisFormatBlock));
-//	return true;
-//}
-//unsigned long VorbisEncodeOutputPin::FormatBufferSize() {
-//	return sizeof(sVorbisFormatBlock);
-//}



More information about the commits mailing list