[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>&nbsp;</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>&nbsp;</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>&nbsp;</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>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN class=877433721-22052001>Here 
is the&nbsp;'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>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>{<BR>&nbsp;// create a 
pXAudioDecoder<BR>&nbsp;if(decoder_new(&amp;pXAudioDecoder) != 
XA_SUCCESS)<BR>&nbsp;{<BR>&nbsp;&nbsp;SignalError(ErrorDecoderNewError);<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;XA_CodecModule codecModule;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;// register 
codec<BR>&nbsp;{<BR>&nbsp;&nbsp;switch(_Source)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;case 
SourceTypeMP3:<BR>&nbsp;&nbsp;&nbsp;// register mpeg audio 
codec<BR>&nbsp;&nbsp;&nbsp;mpeg_codec_module_register(&amp;codecModule);<BR>&nbsp;&nbsp;&nbsp;break;</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;&nbsp;case 
SourceTypeWave:<BR>&nbsp;&nbsp;&nbsp;// register wave audio 
codec<BR>&nbsp;&nbsp;&nbsp;wave_codec_module_register(&amp;codecModule);<BR>&nbsp;&nbsp;&nbsp;break;</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;&nbsp;default:<BR>&nbsp;&nbsp;&nbsp;SignalError(ErrorDe \
coderNoCodecError);<BR>&nbsp;&nbsp;&nbsp;return;<BR>&nbsp;&nbsp;}</SPAN></FONT></DIV> \
<DIV>&nbsp;</DIV> <DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;&nbsp;decoder_codec_module_register(pXAudioDecoder, 
&amp;codecModule);<BR>&nbsp;}</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;XA_InputModule inputModule;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;// register the input 
module<BR>&nbsp;{<BR>&nbsp;&nbsp;// if using file input<BR>&nbsp;&nbsp;if 
(_pcFile != NULL)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;// register the file 
input 
module<BR>&nbsp;&nbsp;&nbsp;file_input_module_register(&amp;inputModule);<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;// \
 else, using memory 
input<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;// register the 
memory input 
module<BR>&nbsp;&nbsp;&nbsp;memory_input_module_register(&amp;inputModule);</SPAN></FONT></DIV>
 <DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;&nbsp;}</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;&nbsp;decoder_input_module_register(pXAudioDecoder, 
&amp;inputModule);<BR>&nbsp;}</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;// create input 
object<BR>&nbsp;if(decoder_input_new(pXAudioDecoder, _pcFile, 
XA_DECODER_INPUT_AUTOSELECT) != 
XA_SUCCESS)<BR>&nbsp;{<BR>&nbsp;&nbsp;SignalError(ErrorDecoderInputNewError);<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;// set the mime 
type<BR>&nbsp;switch(_Source)<BR>&nbsp;{<BR>&nbsp;case 
SourceTypeMP3:<BR>&nbsp;&nbsp;XAudioSetMimeType(pcMP3MimeType);<BR>&nbsp;&nbsp;break;</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;case 
SourceTypeWave:<BR>&nbsp;&nbsp;XAudioSetMimeType(pcWaveMimeType);<BR>&nbsp;&nbsp;break;</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;default:<BR>&nbsp;&nbsp;SignalError(ErrorDecoderNoCodecError);<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;// open input object - fails 
here!<BR>&nbsp;if(decoder_input_open(pXAudioDecoder) != 
XA_SUCCESS)<BR>&nbsp;{<BR>&nbsp;&nbsp;SignalError(ErrorDecoderInputOpenError);<BR>&nbsp;&nbsp;return;<BR>&nbsp;}</SPAN></FONT></DIV>
 <DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;// if here, success<BR>&nbsp;_Status = 
working;<BR>&nbsp;return _Status;<BR></SPAN></FONT></DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001></SPAN></FONT>&nbsp;</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>&nbsp;</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>//&nbsp;decoder_input_send_message(pXAudioDecoder, 
XA_MEMORY_INPUT_MESSAGE_SET_MIME_TYPE,<BR>//&nbsp;&nbsp;pcType, 
strlen(pcType)+1);</SPAN></FONT></DIV>
<DIV>&nbsp;</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>&nbsp;if (pXAudioDecoder != 
NULL)<BR>&nbsp;{<BR>&nbsp;&nbsp;if (pXAudioDecoder-&gt;input != 
NULL)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pXAudioDecoder-&gt;input-&gt;mime_type 
= pcUnknownMimeType;<BR>&nbsp;&nbsp;}</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT color=#0000ff face=Arial size=2><SPAN 
class=877433721-22052001>&nbsp;&nbsp;if (pXAudioDecoder-&gt;status != 
NULL)<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pXAudioDecoder-&gt;status-&gt;info.mime_type \
 = pcType;<BR>&nbsp;&nbsp;&nbsp;pXAudioDecoder-&gt;status-&gt;info.changed = 
XA_DECODER_STREAM_MIME_TYPE_CHANGED;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</SPAN></FONT></DIV>
 <DIV>&nbsp;</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>&nbsp;</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