<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">
<!--
p
        {margin-top:0;
        margin-bottom:0}
-->
</style>
</head>
<body>
<div style="direction:ltr; font-family:Tahoma; color:#000000; font-size:10pt">Hello Everyone,<br>
<br>
I am new to ffmpeg and I am working on AAC encoder, I tried encoding the pcm sample having f32le sample format but whatever the pcm sample format i am having is  s32le so i need to convert it to f32le,I tried with ffmpeg's
<span style="font-weight:bold">resampling_audio.c</span> example and i have modified the code to take pcm file as input.. but the output file size is always ~=11000 bytes and it is not playing<br>
<br>
Also i tried with very the following code but swr_convert() is returning -22 and i am not sure what ever code i got/written is correct...<br>
<br>
Here is the sample code i am trying currently<br>
<br>
int main(int argc, char **argv)<br>
{<br>
uint8_t *dst,*dstp;<br>
uint8_t *outbuf;<br>
int ret;<br>
size_t bufsize;<br>
FILE *fp=NULL;<br>
FILE *fout=NULL;<br>
struct SwrContext *ctx = NULL;<br>
char *filename=argv[1];<br>
fp = fopen("FLTP1.pcm","rb");<br>
fout = fopen(filename,"wb");<br>
<br>
if (fseek(fp, 0L, SEEK_END) == 0) <br>
    bufsize=ftell(fp);<br>
<br>
fseek(fp, 0L, SEEK_SET);<br>
<br>
printf(" buf size is %d\n",bufsize);<br>
dstp=( uint8_t *)malloc(sizeof(uint8_t) * (bufsize + 1));<br>
outbuf=( uint8_t *)malloc(sizeof(uint32_t) * (bufsize*1000 + 1));<br>
dstp=dst;    <br>
while(!feof(fp))<br>
{<br>
printf(" reading samples from file\n");<br>
    ret=fread(&dstp,1,4,fp);<br>
dst++;<br>
printf(" return value is %d\n",ret);<br>
}<br>
//dst=dstp;<br>
<br>
<br>
<br>
<br>
<br>
ctx = swr_alloc_set_opts(ctx,AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_S32,48000,<br>
                                         AV_CH_LAYOUT_STEREO,AV_SAMPLE_FMT_FLTP,44100,0,0);<br>
if(swr_init(ctx) < 0)<br>
     return -1;<br>
<br>
<br>
printf(" converting\n");<br>
<br>
int  resample_samples = swr_convert(ctx,(uint8_t**)&outbuf,bufsize*1000,<br>
                                         (const uint8_t**)&dst,bufsize);<br>
printf(" return value is %d\n",resample_samples);<br>
printf(" writing to file\n");<br>
<br>
fwrite(outbuf,resample_samples,1,fout);<br>
<br>
printf(" wrote to file\n");<br>
<br>
<br>
//free(&outbuf);<br>
//free(&dstp);<br>
<br>
swr_free(&ctx);<br>
<br>
return 0;<br>
<br>
}<br>
 <br>
It will be of great help to me  if you provide me with any suggestions/help<br>
<br>
Thanks in advance<br>
<br>
Best regards<br>
<br>
Haridas Sagar N<br>
<br>
<br>
</div>
Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information
 contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank
 you
<br clear=all> 
</body>
</html>