summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-22 01:57:58 +0000
committerarpi_esp <arpi_esp@b3059339-0415-0410-9bf9-f77b7e298cf2>2001-03-22 01:57:58 +0000
commit0a332ce23a404c482663122abc586662c05049c5 (patch)
treeb0709dbdb272ed049654132c2324d46e3a4263aa
parent5189452171181110bcb8f687be521bf0b43ecf40 (diff)
downloadmpv-0a332ce23a404c482663122abc586662c05049c5.tar.bz2
mpv-0a332ce23a404c482663122abc586662c05049c5.tar.xz
DirectShow audio support
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@191 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r--codecs.c28
-rw-r--r--mplayer.c37
2 files changed, 61 insertions, 4 deletions
diff --git a/codecs.c b/codecs.c
index b5e2109424..76181f2aac 100644
--- a/codecs.c
+++ b/codecs.c
@@ -1,8 +1,23 @@
//#define ANGELPOTION
//#define USE_DIRECTSHOW
-static GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
+static GUID wmv1_clsid={0x4facbba1, 0xffd8, 0x4cd7,
+ {0x82, 0x28, 0x61, 0xe2, 0xf6, 0x5c, 0xb1, 0xae}};
+static GUID wmv2_clsid={0x521fb373, 0x7654, 0x49f2,
+ {0xbd, 0xb1, 0x0c, 0x6e, 0x66, 0x60, 0x71, 0x4f}};
+static GUID CLSID_MorganMjpeg={0x6988b440, 0x8352, 0x11d3,
+ {0x9b, 0xda, 0xca, 0x86, 0x73, 0x7c, 0x71, 0x68}};
+static GUID CLSID_Acelp={0x4009f700, 0xaeba, 0x11d1,
+ {0x83, 0x44, 0x00, 0xc0, 0x4f, 0xb9, 0x2e, 0xb7}};
+static GUID CLSID_Voxware={0x73f7a062, 0x8829, 0x11d1,
+ {0xb5, 0x50, 0x00, 0x60, 0x97, 0x24, 0x2d, 0x8d}};
+static GUID CLSID_DivxDecompressorCF={0x82CCd3E0, 0xF71A, 0x11D0,
{ 0x9f, 0xe5, 0x00, 0x60, 0x97, 0x78, 0xaa, 0xaa}};
+static GUID CLSID_IV50_Decoder={0x30355649, 0x0000, 0x0010,
+ {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
+static GUID dvsd_clsid={0xB1B77C00, 0xC3E4, 0x11CF,
+ {0xAF, 0x79, 0x00, 0xAA, 0x00, 0xB6, 0x7A, 0x42}};
+
char* get_vids_codec_name(){
// unsigned long fccHandler=avi_header.video.fccHandler;
@@ -134,6 +149,14 @@ char* get_vids_codec_name(){
return "mcmjpg32.dll";
// return "m3jpeg32.dll";
// return "libavi_mjpeg.so";
+
+ case mmioFOURCC('W', 'M', 'V', '1'):
+ printf("Video in Windows Media Video 1 format\n");
+ avi_header.yuv_supported=1;
+ avi_header.vids_guid=&wmv1_clsid;
+ return "wmvds32.ax";
+
+
}
printf("UNKNOWN video codec: %.4s (0x%0X)\n",&fccHandler,fccHandler);
printf("If you know this video format and codec, you can edit codecs.c in the source!\n");
@@ -162,7 +185,8 @@ char* get_auds_codec_name(){
case 0x32://MS GSM
return "msgsm32.acm"; // segfault :( - not req. has internal now!
case 0x75://VoxWare
- return "voxmsdec.ax"; // directshow, not yet supported just a try
+ avi_header.auds_guid=&CLSID_Voxware;
+ return "voxmsdec.ax";
// case 0x06://???
// return "lhacm.acm";
// return "msg711.acm";
diff --git a/mplayer.c b/mplayer.c
index d9b0cf3477..da6ae961f4 100644
--- a/mplayer.c
+++ b/mplayer.c
@@ -58,6 +58,7 @@ typedef struct
#ifdef USE_DIRECTSHOW
#include "DirectShow/DS_VideoDec.h"
+#include "DirectShow/DS_AudioDec.h"
#endif
#include "opendivx/decore.h"
@@ -367,8 +368,8 @@ int f; // filedes
int stream_type;
stream_t* stream=NULL;
int file_format=DEMUXER_TYPE_UNKNOWN;
-int has_audio=1; // audio format 0=no 1=mpeg 2=pcm 3=ac3 4=win32 5=alaw 6=msgsm
-int has_video=0; // video format 0=no 1=mpeg 2=win32/VfW 3=OpenDivX 4=w32/DShow
+int has_audio=1; // audio 0=no 1=mpeg 2=pcm 3=ac3 4=ACM 5=alaw 6=msgsm 7=DShow
+int has_video=0; // video 0=no 1=mpeg 2=win32/VfW 3=OpenDivX 4=w32/DShow
//
int audio_format=0; // override
#ifdef ALSA_TIMER
@@ -676,6 +677,7 @@ switch(file_format){
if(verbose) printf("detected AVI audio format: %d\n",has_audio);
if(has_audio==4){
if(!avi_header.audio_codec) avi_header.audio_codec=get_auds_codec_name();
+ if(avi_header.auds_guid) has_audio=7; // force DShow
if(!avi_header.audio_codec) has_audio=0; // unknown win32 codec
if(verbose) printf("win32 audio codec: '%s'\n",avi_header.audio_codec);
}
@@ -743,6 +745,7 @@ switch(file_format){
if(verbose) printf("detected ASF audio format: %d\n",has_audio);
if(has_audio==4){
if(!avi_header.audio_codec) avi_header.audio_codec=get_auds_codec_name();
+ if(avi_header.auds_guid) has_audio=7; // force DShow
if(!avi_header.audio_codec) has_audio=0; // unknown win32 codec
if(verbose) printf("win32 audio codec: '%s'\n",avi_header.audio_codec);
}
@@ -1166,6 +1169,36 @@ if(has_audio==4){
}
}
+if(has_audio==7){
+#ifndef USE_DIRECTSHOW
+ printf("Compiled without DirectShow support -> force nosound :(\n");
+ has_audio=0;
+#else
+ // Win32 DShow audio codec:
+ WAVEFORMATEX *in_fmt=(WAVEFORMATEX*)&avi_header.wf_ext;
+ avi_header.wf.nChannels=in_fmt->nChannels;
+ avi_header.wf.nSamplesPerSec=in_fmt->nSamplesPerSec;
+ avi_header.wf.nAvgBytesPerSec=2*avi_header.wf.nSamplesPerSec*avi_header.wf.nChannels;
+ avi_header.wf.wFormatTag=WAVE_FORMAT_PCM;
+ avi_header.wf.nBlockAlign=2*in_fmt->nChannels;
+ avi_header.wf.wBitsPerSample=16;
+ avi_header.wf.cbSize=0;
+
+ if(!DS_AudioDecoder_Open(avi_header.audio_codec,avi_header.auds_guid,in_fmt)){
+ MP3_channels=avi_header.wf.nChannels;
+ MP3_samplerate=avi_header.wf.nSamplesPerSec;
+ } else {
+ printf("Could not load/initialize Win32/DirctShow AUDIO codec (missing .AX file?)\n");
+ if((in_fmt->wFormatTag)==0x55){
+ printf("Audio format is MP3 -> fallback to internal mp3lib/mpg123\n");
+ has_audio=1; // fallback to mp3lib
+ } else
+ has_audio=0; // nosound
+ }
+#endif
+}
+
+
// allocate audio out buffer:
a_buffer=malloc(a_buffer_size);
memset(a_buffer,0,a_buffer_size);