[prev in list] [next in list] [prev in thread] [next in thread]
List: xaudio-sdk
Subject: [xaudio-sdk] WAVE Input Source
From: "Adam Strasel" <fizz_20120 () yahoo ! com>
Date: 2001-05-22 21:48:28
[Download RAW message or body]
Still having problems using the SYNC API when processing Wave files...
Here is the situation:
The decoder_input_open call fails if I'm using a memory input module or a
file input module where the file name does not end in '.wav'.
I had a response on this once before suggesting that I need to set the mime
type
Here is the 'init' code: (the _Source variable is my own enum, it is set to
SourceTypeWave on entry, _pcFile is NULL when I'm going to process from
memory and pointer to the source file when from file)
{
// create a pXAudioDecoder
if(decoder_new(&pXAudioDecoder) != XA_SUCCESS)
{
SignalError(ErrorDecoderNewError);
return;
}
XA_CodecModule codecModule;
// register codec
{
switch(_Source)
{
case SourceTypeMP3:
// register mpeg audio codec
mpeg_codec_module_register(&codecModule);
break;
case SourceTypeWave:
// register wave audio codec
wave_codec_module_register(&codecModule);
break;
default:
SignalError(ErrorDecoderNoCodecError);
return;
}
decoder_codec_module_register(pXAudioDecoder, &codecModule);
}
XA_InputModule inputModule;
// register the input module
{
// if using file input
if (_pcFile != NULL)
{
// register the file input module
file_input_module_register(&inputModule);
}
// else, using memory input
else
{
// register the memory input module
memory_input_module_register(&inputModule);
}
decoder_input_module_register(pXAudioDecoder, &inputModule);
}
// create input object
if(decoder_input_new(pXAudioDecoder, _pcFile, XA_DECODER_INPUT_AUTOSELECT)
!= XA_SUCCESS)
{
SignalError(ErrorDecoderInputNewError);
return;
}
// set the mime type
switch(_Source)
{
case SourceTypeMP3:
XAudioSetMimeType(pcMP3MimeType);
break;
case SourceTypeWave:
XAudioSetMimeType(pcWaveMimeType);
break;
default:
SignalError(ErrorDecoderNoCodecError);
return;
}
// open input object - fails here!
if(decoder_input_open(pXAudioDecoder) != XA_SUCCESS)
{
SignalError(ErrorDecoderInputOpenError);
return;
}
// if here, success
_Status = working;
return _Status;
End of the 'init' function, here the my XAudioSetMimeType function:
void
InfoFFTIDTagSource::XAudioSetMimeType(const char *pcType)
{
// tried using this at first - no luck!
// decoder_input_send_message(pXAudioDecoder,
XA_MEMORY_INPUT_MESSAGE_SET_MIME_TYPE,
// pcType, strlen(pcType)+1);
// here is desperate attempt to set the data directly, still no luck!
if (pXAudioDecoder != NULL)
{
if (pXAudioDecoder->input != NULL)
{
pXAudioDecoder->input->mime_type = pcUnknownMimeType;
}
if (pXAudioDecoder->status != NULL)
{
pXAudioDecoder->status->info.mime_type = pcType;
pXAudioDecoder->status->info.changed =
XA_DECODER_STREAM_MIME_TYPE_CHANGED;
}
}
}
This seems so simple but it would really help me out to get this resolved!
Thanks,
-Adam
[Attachment #3 (text/html)]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META content="text/html; charset=iso-8859-1" http-equiv=Content-Type>
<META content="MSHTML 5.00.3103.1000" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>Still
having problems using the SYNC API when processing Wave
files...</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>Here
is the situation:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>The
decoder_input_open call fails if I'm using a memory input module or a file input
module where the file name does not end in '.wav'.</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>I had
a response on this once before suggesting that I need to set the mime
type</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>Here
is the 'init' code: (the _Source variable is my own enum, it is set to
SourceTypeWave on entry, _pcFile is NULL when I'm going to process from memory
and pointer to the source file when from file)</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001>{<BR> // create a
pXAudioDecoder<BR> if(decoder_new(&pXAudioDecoder) !=
XA_SUCCESS)<BR> {<BR> SignalError(ErrorDecoderNewError);<BR> return;<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> XA_CodecModule codecModule;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> // register
codec<BR> {<BR> switch(_Source)<BR> {<BR> case
SourceTypeMP3:<BR> // register mpeg audio
codec<BR> mpeg_codec_module_register(&codecModule);<BR> break;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> case
SourceTypeWave:<BR> // register wave audio
codec<BR> wave_codec_module_register(&codecModule);<BR> break;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> default:<BR> SignalError(ErrorDe \
coderNoCodecError);<BR> return;<BR> }</SPAN></FONT></DIV> \
<DIV> </DIV> <DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> decoder_codec_module_register(pXAudioDecoder,
&codecModule);<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> XA_InputModule inputModule;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> // register the input
module<BR> {<BR> // if using file input<BR> if
(_pcFile != NULL)<BR> {<BR> // register the file
input
module<BR> file_input_module_register(&inputModule);<BR> }<BR> // \
else, using memory
input<BR> else<BR> {<BR> // register the
memory input
module<BR> memory_input_module_register(&inputModule);</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> decoder_input_module_register(pXAudioDecoder,
&inputModule);<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> // create input
object<BR> if(decoder_input_new(pXAudioDecoder, _pcFile,
XA_DECODER_INPUT_AUTOSELECT) !=
XA_SUCCESS)<BR> {<BR> SignalError(ErrorDecoderInputNewError);<BR> return;<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> // set the mime
type<BR> switch(_Source)<BR> {<BR> case
SourceTypeMP3:<BR> XAudioSetMimeType(pcMP3MimeType);<BR> break;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> case
SourceTypeWave:<BR> XAudioSetMimeType(pcWaveMimeType);<BR> break;</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> default:<BR> SignalError(ErrorDecoderNoCodecError);<BR> return;<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> // open input object - fails
here!<BR> if(decoder_input_open(pXAudioDecoder) !=
XA_SUCCESS)<BR> {<BR> SignalError(ErrorDecoderInputOpenError);<BR> return;<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> // if here, success<BR> _Status =
working;<BR> return _Status;<BR></SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>End of
the 'init' function, here the my XAudioSetMimeType function:</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001>void<BR>InfoFFTIDTagSource::XAudioSetMimeType(const
char *pcType)<BR>{</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>//
tried using this at first - no
luck!<BR>// decoder_input_send_message(pXAudioDecoder,
XA_MEMORY_INPUT_MESSAGE_SET_MIME_TYPE,<BR>// pcType,
strlen(pcType)+1);</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>//
here is desperate attempt to set the data directly, still no
luck!</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> if (pXAudioDecoder !=
NULL)<BR> {<BR> if (pXAudioDecoder->input !=
NULL)<BR> {<BR> pXAudioDecoder->input->mime_type
= pcUnknownMimeType;<BR> }</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001> if (pXAudioDecoder->status !=
NULL)<BR> {<BR> pXAudioDecoder->status->info.mime_type \
= pcType;<BR> pXAudioDecoder->status->info.changed =
XA_DECODER_STREAM_MIME_TYPE_CHANGED;<BR> }<BR> }<BR>}</SPAN></FONT></DIV>
<DIV> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>This
seems so simple but it would really help me out to get this
resolved!</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001></SPAN></FONT> </DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001>Thanks,</SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN
class=877433721-22052001>-Adam</DIV></SPAN></FONT></BODY></HTML>
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
_______________________________________________
xaudio-sdk mailing list
xaudio-sdk@mpegtv.com
http://mailman.bok.net/mailman/listinfo/xaudio-sdk
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic