Skip to content

Commit

Permalink
Update preferred filters (part 1)
Browse files Browse the repository at this point in the history
- Add LAV and DScaler audio decoders
- Reinstate Gabest MPEG Splitter

Issue: #37
  • Loading branch information
MSDN-WhiteKnight committed Mar 18, 2023
1 parent cd99d43 commit 800d507
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions SmallMediaPlayer/dshow_helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ typedef struct{
SMP_DEFINE_GUID(CLSID_LavSplitter, 0x171252A0, 0x8820, 0x4AFE, 0x9D, 0xF8, 0x5C, 0x92, 0xB2, 0xD6, 0x6B, 0x04);
// https://github.com/Nevcairiel/LAVFilters/blob/master/common/includes/moreuuids.h

// MPC - Mpeg Splitter (Gabest): DC257063-045F-4BE2-BD5B-E12279C464F0
SMP_DEFINE_GUID(CLSID_GabestMpegSplitter, 0xDC257063, 0x045F, 0x4BE2, 0xBD, 0x5B, 0xE1, 0x22, 0x79, 0xC4, 0x64, 0xF0);
// https://github.com/jeeb/mpc-be/blob/master/src/filters/parser/MpegSplitter/MpegSplitter.h

const SPLITTER_DATA sdAsfReader={SOURCE_FILTER,true};
const SPLITTER_DATA sdBassSource={L"DC-Bass Source",true};
const SPLITTER_DATA sdGretechMp3={L"Gretech MP3 Source Filter",true};
Expand Down
14 changes: 11 additions & 3 deletions SmallMediaPlayer/player_dshow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ BOOL BuildGraph(MEDIATYPE mt,TCHAR* file){
if(res==FALSE) res=InsertSplitter(file,&sdMpeg2Splitter);
if(res==FALSE) res=InsertSplitter(file,&sdNeroSplitter);
if(res==FALSE) res=InsertSplitterByCLSID(file,CLSID_LavSplitter,FALSE);
if(res==FALSE) res=InsertSplitterByCLSID(file,CLSID_GabestMpegSplitter,FALSE);
if(res==FALSE) goto end_fail;
break;
case MT_MKV:
Expand All @@ -583,9 +584,16 @@ if(FAILED(hr))c=0;
for(i=0;i<c;i++){
pins[i]->QueryDirection(&PinDir);
if(PinDir==PINDIR_INPUT)continue;
if(CheckMediaType(pins[i],MEDIATYPE_Audio)!=FALSE){
if(fAudioRendered==true)goto next;
res=InsertAudioDecoder(pins[i],L"ffdshow Audio Decoder");

if(CheckMediaType(pins[i],MEDIATYPE_Audio)!=FALSE){
if(fAudioRendered==true)goto next;

// Try to manually insert some known well-behaving audio decoders, to mitigate issues with
// Windows MPEG Audio decoder.

res=InsertAudioDecoder(pins[i],L"LAV Audio Decoder");
if(res==FALSE && mt==MT_MPEG) res=InsertAudioDecoder(pins[i],L"DScaler Audio Decoder");
if(res==FALSE) res=InsertAudioDecoder(pins[i],L"ffdshow Audio Decoder");

if(res==FALSE){pGraph->Render(pins[i]);}
else {fAudioRendered=true;}
Expand Down

0 comments on commit 800d507

Please sign in to comment.