[xiph-commits] r11870 - trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder

illiminable at svn.xiph.org illiminable at svn.xiph.org
Sat Sep 30 21:03:02 PDT 2006


Author: illiminable
Date: 2006-09-30 21:02:53 -0700 (Sat, 30 Sep 2006)
New Revision: 11870

Modified:
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp
   trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h
Log:
* Flushing at the end of vorbis streams to get out the last few samples lurking inside libvorbis

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp	2006-09-30 16:25:52 UTC (rev 11869)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.cpp	2006-10-01 04:02:53 UTC (rev 11870)
@@ -118,6 +118,18 @@
 
 }
 
+HRESULT VorbisEncodeInputPin::EndOfStream()
+{
+    CAutoLock locLock(mStreamLock);
+
+    vector<StampedOggPacket*> locPackets = mVorbisEncoder.flush();
+
+    HRESULT locHR = sendPackets(locPackets);
+    deletePacketsAndEmptyVector(locPackets);
+    return AbstractTransformInputPin::EndOfStream();
+
+}
+
 void VorbisEncodeInputPin::deletePacketsAndEmptyVector(vector<StampedOggPacket*>& inPackets)
 {
     for (size_t i = 0; i < inPackets.size(); i++) {
@@ -172,7 +184,7 @@
 		    //Set the sample parameters.
 		    SetSampleParams(locSample, inPackets[pack]->packetSize(), &locFrameStart, &locFrameEnd);
 
-		    locHR = ((VorbisEncodeOutputPin*)mOutputPin)->mDataQueue->Receive(locSample);						//->DownstreamFilter()->Receive(locSample);
+		    locHR = ((VorbisEncodeOutputPin*)mOutputPin)->mDataQueue->Receive(locSample);
             if (locHR != S_OK) {
                 return locHR;
             }

Modified: trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h
===================================================================
--- trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h	2006-09-30 16:25:52 UTC (rev 11869)
+++ trunk/oggdsf/src/lib/codecs/vorbis/filters/dsfVorbisEncoder/VorbisEncodeInputPin.h	2006-10-01 04:02:53 UTC (rev 11870)
@@ -42,12 +42,6 @@
 #include <fstream>
 using namespace std;
 
-
-//extern "C" {
-//#include <fishsound/fishsound.h>
-//#include "fish_cdecl.h"
-//}
-
 class VorbisEncodeInputPin
 	:	public AbstractTransformInputPin
 {
@@ -60,12 +54,8 @@
                             ,   vector<CMediaType*> inAcceptableMediaTypes);
 	virtual ~VorbisEncodeInputPin(void);
 
-	//static int __cdecl VorbisEncoded (      FishSound* inFishSound
- //                                       ,   unsigned char* inPacketData
- //                                       ,   long inNumBytes
- //                                       ,   void* inThisPointer);
-	
 	virtual HRESULT SetMediaType(const CMediaType* inMediaType);
+    virtual STDMETHODIMP EndOfStream();
 
 protected:
 
@@ -79,17 +69,10 @@
     unsigned long bufferBytesToSampleCount(long inByteCount);
 
 	//Member data
-	//HRESULT mHR;
 	bool mBegun;
 	WAVEFORMATEX* mWaveFormat;
 	LONGLONG mUptoFrame;
 
-	//Fishsound member data
-	//FishSound* mFishSound;
-	//FishSoundInfo mFishInfo; 	
-
-	//float mVorbisQuality;
-
     VorbisEncodeSettings mEncoderSettings;
     VorbisEncoder mVorbisEncoder;
 



More information about the commits mailing list