[Libav-user] FFmpeg Audio Play

Yamusani Vinay yamusanivinay at gmail.com
Wed Apr 16 12:25:09 CEST 2014


Thanks for the reply,I checked it got some what I need I have another doubt
here in avio_reading.c it is directly mapping file to a byte array but what
I need is,to ffmpeg I need to pass a sample byte array with some values i.e
then ffmpeg need to play those bytes.

I tried with the following code:

what I did is I am passing a byte array which contains some values from my
java code and copying that to uint *buffer_temp and assigned it to bd

struct buffer_data {

    uint8_t *ptr;

    size_t size; ///< size left in the buffer

};


 struct buffer_data bd = { 0 };


 jbyte *bytesTemp = (*env)->GetByteArrayElements(env, inputArray,NULL);

 buffer_temp = av_malloc(length);

 memcpy(buffer_temp,bytesTemp,length);

 bd.ptr  = buffer_temp;

 bd.size = length;

fmt_ctx->pb = bd;

from here I am trying to open file by using below code

if ((ret = avformat_open_input(&fmt_ctx, NULL, NULL, &m_iFormatOpts)) < 0)

{

 LOGE("Cannot open input file\n");

return;

}


then I am getting ret <0


So please help me in solving this problem.


Thanks & Regards,

Vinay.


On Mon, Apr 14, 2014 at 11:12 AM, Anshul <anshul.ffmpeg at gmail.com> wrote:

> Yamusani Vinay <yamusanivinay at gmail.com> wrote:
> >Hi All,
> >
> >I am developing an android app where I need to play music.I know how to
> >play audio using ffmpeg by giving the audio path.but my problem is in
> >my
> >application I will get audio stream in  the form of bytes.So anyone
> >please
> >help me in playing these audio bytes using ffmpeg.
> >
> >input:audio stream in the form of bytes.
> >
> >Thanks,
> >Vinay Yamusani.
> >
> >
> >------------------------------------------------------------------------
> >
> >_______________________________________________
> >Libav-user mailing list
> >Libav-user at ffmpeg.org
> >http://ffmpeg.org/mailman/listinfo/libav-user
>
>
> Since u have posted at libav I consider you would be using library not
> ffmpeg binary.
>
> You should start with avio_ reading.c example at doc/examples.
>
>
> -Anshul
>
> --
> Sent from my Android device with K-9 Mail. Please excuse my brevity.
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20140416/26faa321/attachment.html>


More information about the Libav-user mailing list