J2me流媒体技术实现讨论[1] - 编程入门网
作者 佚名技术
来源 NET编程
浏览
发布时间 2012-06-15
// audio[54] = (byte)0x50;
// audio[55] = (byte)0xC3;
// audio[56] = (byte)0x00;
// audio[57] = (byte)0x00;
byte[] tmp = new byte[50058];
int countBytes= 0;
int headerup = 32; //mp3 header is 32 bytes.
while(i<50058){
tmp[i] = audio[i]; //byte array audio is byte array from mp3 file
i++;
countBytes++;
}
output.writeInt(50058); //write to midlet, that chunk size will be 50058
output.write(tmp); //write chunk itself
boolean varam = true; //booleand that will become false, when file ends
while(varam){
int tmplen = garums - countBytes; //check if it is not last chunk
int o=50058;
if(tmplen>50058){ //if it is not last chunk
o = 50058;
}
else{
o = tmplen+headerup; // if it is last chunk
tmp = new byte[o];
varam = false; //out while loop will end
}
int z = 0;
while(z<32){ //write 32 byte header to chunk
tmp[z] = audio[z];
z++;
countBytes++;
}
while(z<o){ //white chunk it self
tmp[z] = audio[i];
z++;
i++;
countBytes++;
}
headerup = headerup +32;
output.writeInt(o); //white size of chunk (typically 50058)
output.write(tmp); //white chunk itself
}
}
catch (Exception e) {}
} |
凌众科技专业提供服务器租用、服务器托管、企业邮局、虚拟主机等服务,公司网站:http://www.lingzhong.cn 为了给广大客户了解更多的技术信息,本技术文章收集来源于网络,凌众科技尊重文章作者的版权,如果有涉及你的版权有必要删除你的文章,请和我们联系。以上信息与文章正文是不可分割的一部分,如果您要转载本文章,请保留以上信息,谢谢! |
你可能对下面的文章感兴趣
关于J2me流媒体技术实现讨论[1] - 编程入门网的所有评论