<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">On 04/16/2014 03:55 PM, Yamusani Vinay
      wrote:<br>
    </div>
    <blockquote
cite="mid:CA+Z6vDEm77cVOQFqp39ewseNFv9Hh_xvuHo+g+K5fZpHy-qW8Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">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.
        <div>
          <br>
        </div>
        <div>I tried with the following code:</div>
        <div><br>
        </div>
        <div>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</div>
        <div><br>
        </div>
        <div>
          <p class=""><span class="">struct</span> buffer_data {</p>
          <p class="">    <span class="">uint8_t</span> *<span class="">ptr</span>;</p>
          <p class=""><span class="">    </span><span class="">size_t</span><span
              class=""> </span><span class="">size</span><span class="">;
            </span>///< size left in the buffer</p>
          <p class="">};</p>
          <p class=""><br>
          </p>
          <p class="">
          </p>
          <p class=""> <span class="">struct</span> buffer_data bd = { 0
            };</p>
          <p class=""><br>
          </p>
        </div>
        <div>
          <p class=""><span class=""> </span> <span class="">jbyte</span>
            *bytesTemp = (*env)-><span class="">GetByteArrayElements</span>(env,
            inputArray,NULL);</p>
          <p class=""><span class=""> </span> buffer_temp = <span
              class="">av_malloc</span>(length);</p>
          <p class=""><span class=""> </span> <span class="">memcpy</span>(buffer_temp,bytesTemp,length);</p>
          <p class=""><span class=""> </span> bd.<span class="">ptr</span> 
            = buffer_temp;</p>
          <p class=""><span class=""> </span> bd.<span class="">size</span>
            = length;</p>
        </div>
        <div><br>
        </div>
        <div>fmt_ctx->pb = bd;</div>
        <div><br>
        </div>
        <div>from here I am trying to open file by using below code</div>
        <div>
          <p class=""><span class="">if</span> ((ret = <span class="">avformat_open_input</span>(&fmt_ctx,
            NULL, NULL, &m_iFormatOpts)) < 0)</p>
          <p class=""><span class=""> </span>{</p>
          <p class=""><span class=""><span class=""> </span><span
                class=""> </span>LOGE(</span>"Cannot open input file\n"<span
              class="">);</span></p>
          <p class="">return<span class="">;</span></p>
          <p class="">}</p>
          <p class="">
            <br>
          </p>
          <p class="">then I am getting ret <0</p>
          <p class=""><br>
          </p>
          <p class="">So please help me in solving this problem.</p>
          <p class=""><br>
          </p>
          <p class="">Thanks & Regards,</p>
          <p class="">Vinay.</p>
        </div>
      </div>
      <div class="gmail_extra">
        <br>
        <br>
        <div class="gmail_quote">On Mon, Apr 14, 2014 at 11:12 AM,
          Anshul <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:anshul.ffmpeg@gmail.com" target="_blank">anshul.ffmpeg@gmail.com</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div class="HOEnZb">
              <div class="h5">Yamusani Vinay <<a
                  moz-do-not-send="true"
                  href="mailto:yamusanivinay@gmail.com">yamusanivinay@gmail.com</a>>
                wrote:<br>
                >Hi All,<br>
                ><br>
                >I am developing an android app where I need to play
                music.I know how to<br>
                >play audio using ffmpeg by giving the audio path.but
                my problem is in<br>
                >my<br>
                >application I will get audio stream in  the form of
                bytes.So anyone<br>
                >please<br>
                >help me in playing these audio bytes using ffmpeg.<br>
                ><br>
                >input:audio stream in the form of bytes.<br>
                ><br>
                >Thanks,<br>
                >Vinay Yamusani.<br>
                ><br>
                ><br>
              </div>
            </div>
>------------------------------------------------------------------------<br>
            ><br>
            >_______________________________________________<br>
            >Libav-user mailing list<br>
            ><a moz-do-not-send="true"
              href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
            ><a moz-do-not-send="true"
              href="http://ffmpeg.org/mailman/listinfo/libav-user"
              target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
            <br>
            <br>
            Since u have posted at libav I consider you would be using
            library not ffmpeg binary.<br>
            <br>
            You should start with avio_ reading.c example at
            doc/examples.<br>
            <span class="HOEnZb"><font color="#888888"><br>
                <br>
                -Anshul<br>
                <br>
                --<br>
                Sent from my Android device with K-9 Mail. Please excuse
                my brevity.<br>
                _______________________________________________<br>
                Libav-user mailing list<br>
                <a moz-do-not-send="true"
                  href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
                <a moz-do-not-send="true"
                  href="http://ffmpeg.org/mailman/listinfo/libav-user"
                  target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
              </font></span></blockquote>
        </div>
        <br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
Libav-user mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a>
<a class="moz-txt-link-freetext" href="http://ffmpeg.org/mailman/listinfo/libav-user">http://ffmpeg.org/mailman/listinfo/libav-user</a>
</pre>
    </blockquote>
    <br>
    Please don't top Post, Its consider rude.<br>
    <br>
    I think you missed some thing from example.<br>
    pb is not the buffer where you can copy your audio data.<br>
    <br>
    In pb you need to register a callback function which will be called
    when ffmpeg library require data.<br>
    <br>
    here is how this is done....<br>
        avio_ctx = avio_alloc_context(avio_ctx_buffer,
    avio_ctx_buffer_size,<br>
                                      0, &bd, &read_packet,
    NULL, NULL);<br>
        if (!avio_ctx) {<br>
            ret = AVERROR(ENOMEM);<br>
            goto end;<br>
        }   <br>
        fmt_ctx->pb = avio_ctx;<br>
    <br>
    -Anshul<br>
    <br>
  </body>
</html>