[MPlayer-dev-eng] [PATCH] dshow audio subtype is "capped" to 16bit

Gianluigi Tiesi mplayer at netfarm.it
Sun Apr 27 01:41:28 CEST 2008


While testing mmamr.ax I've discovered
that the dshow audio filter setup
uses the fourcc/format from WAVEFORMATEX
struct that is a WORD thus 16bit

while creating the filter graph
the audio filter gets:
0x6173
instead of 0x726D6173

and the filter fails with source format not
accepted

Attached patch solve this problem,
perhaps I'm not aware of side effects
with other dshow audio filters

I'm using "format" field from sh_audio_t

I'm not aware of a less intrusive method

mmamr.ax still produces weird audio
but at least the filter chain is done

if you want to play with, here the codecs.conf entry:

audiocodec mmamrnb
  info "Monogram amr filter"
  comment "http://www.hydrogenaudio.org/forums/index.php?showtopic=61947"
  status buggy
  fourcc samr
  ; format 0x726D6173
  driver dshow
  dll "mmamr.ax"
  guid 0x50dda33e, 0xc529, 0x4343, 0x96, 0x89, 0x33, 0x8a, 0xdc, 0x79, 0x3b, 0xb5

the binary can be found at the link in the comment

Regards


-- 
Gianluigi Tiesi <sherpya at netfarm.it>
EDP Project Leader
Netfarm S.r.l. - http://www.netfarm.it/
Free Software: http://oss.netfarm.it/
-------------- next part --------------
Index: libmpcodecs/ad_dshow.c
===================================================================
--- libmpcodecs/ad_dshow.c	(revision 26551)
+++ libmpcodecs/ad_dshow.c	(working copy)
@@ -29,7 +29,7 @@
 static int preinit(sh_audio_t *sh_audio)
 {
   DS_AudioDecoder* ds_adec;
-  if(!(ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf)))
+  if(!(ds_adec=DS_AudioDecoder_Open(sh_audio->codec->dll,&sh_audio->codec->guid,sh_audio->wf,sh_audio->format)))
   {
     mp_msg(MSGT_DECAUDIO,MSGL_ERR,MSGTR_MissingDLLcodec,sh_audio->codec->dll);
     return 0;
Index: loader/dshow/DS_AudioDecoder.c
===================================================================
--- loader/dshow/DS_AudioDecoder.c	(revision 26551)
+++ loader/dshow/DS_AudioDecoder.c	(working copy)
@@ -33,7 +33,7 @@
 static SampleProcUserData sampleProcData;
 
 
-DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf)
+DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf, unsigned int format)
 //DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf)
 {
     DS_AudioDecoder *this;
@@ -65,7 +65,8 @@
     memset(&this->m_sOurType, 0, sizeof(this->m_sOurType));
     this->m_sOurType.majortype=MEDIATYPE_Audio;
     this->m_sOurType.subtype=MEDIASUBTYPE_PCM;
-    this->m_sOurType.subtype.f1=wf->wFormatTag;
+    //this->m_sOurType.subtype.f1=wf->wFormatTag;
+    this->m_sOurType.subtype.f1=format;
     this->m_sOurType.formattype=FORMAT_WaveFormatEx;
     this->m_sOurType.lSampleSize=wf->nBlockAlign;
     this->m_sOurType.bFixedSizeSamples=1;
Index: loader/dshow/DS_AudioDecoder.h
===================================================================
--- loader/dshow/DS_AudioDecoder.h	(revision 26551)
+++ loader/dshow/DS_AudioDecoder.h	(working copy)
@@ -4,7 +4,7 @@
 typedef struct DS_AudioDecoder DS_AudioDecoder;
 
 //DS_AudioDecoder * DS_AudioDecoder_Create(const CodecInfo * info, const WAVEFORMATEX* wf);
-DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf);
+DS_AudioDecoder * DS_AudioDecoder_Open(char* dllname, GUID* guid, WAVEFORMATEX* wf, unsigned int format);
 
 void DS_AudioDecoder_Destroy(DS_AudioDecoder *this);
 


More information about the MPlayer-dev-eng mailing list