Using pjsua to create a mp3 stream

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Marco,

Thank you for the example code. I made the changes and can now record in RAW
and MP3 format. But when I pass a pipe to the pjsua --rec-file argument the
application still halts. Probably I still need to change the code that opens
the file to open it in streaming mode instead of random access mode. Can you
give me a pointer where this is done?

Best regards,
Jan.


On Sat, Feb 23, 2008 at 10:32 AM, Marco Zissen <maz at gmx.net> wrote:

>  Hi Jan,
>
> There is some coding required. Toni posted an example for the mp3 encoder.
> You can do it the same way. E.g:
>
>    enum Format
>    {
>        FMT_UNKNOWN,
>        FMT_WAV,
>        FMT_MP3,
>        FMT_RAW,
>    };
>       .....
>       .....
>    if (pj_stricmp2(&ext, ".wav") == 0)
>      file_format = FMT_WAV;
>    else if (pj_stricmp2(&ext, ".mp3") == 0)
>      file_format = FMT_MP3;
>    else if (pj_stricmp2(&ext, ".raw") == 0)
>      file_format = FMT_RAW;
>    else {
>      PJ_LOG(1,(THIS_FILE, "pjsua_recorder_create() error: unable to "
>         "determine file format for %.*s",
>         (int)filename->slen, filename->ptr));
>         return PJ_ENOTSUP;
>    }
>       ....
>       ....
>    if (file_format == FMT_WAV) {
>            status = pjmedia_wav_writer_port_create(pool, path,
>            pjsua_var.media_cfg.clock_rate,
>            pjsua_var.mconf_cfg.channel_count,
>            pjsua_var.mconf_cfg.samples_per_frame,
>            pjsua_var.mconf_cfg.bits_per_sample,
>            options, 0, &port);
>    } else if (file_format == FMT_RAW) {
>            status = pjmedia_raw_writer_port_create(pool, path,
>            pjsua_var.media_cfg.clock_rate,
>            pjsua_var.mconf_cfg.channel_count,
>            pjsua_var.mconf_cfg.samples_per_frame,
>            pjsua_var.mconf_cfg.bits_per_sample,
>            0, 0,
>            &port);
>    } else {
>         PJ_UNUSED_ARG(enc_param);
>         port = NULL;
>         status = PJ_ENOTSUP;
>    }
>
> When the extension of the named pipe is '.raw', the raw media port will be
> used.
>
> - Marco
>
>  ------------------------------
> *Von:* pjsip-bounces at lists.pjsip.org [mailto:pjsip-bounces at lists.pjsip.org]
> *Im Auftrag von *jvdsandt
> *Gesendet:* Freitag, 22. Februar 2008 21:18
>
> *An:* pjsip list
> *Betreff:* Re: [pjsip] Using pjsua to create a mp3 stream
>
> Marco,
>
> Great, I have build your modifications and the playfile en recfile
> examples work. Is it possible to use these new "raw" ports from the pjsua
> program. Or is there more coding required for this?
>
> Thanks,
> Jan.
>
> On Fri, Feb 22, 2008 at 4:19 PM, Marco Zissen <maz at gmx.net> wrote:
>
> >   Hi Jan,
> >
> > I just copied and modified the wav_player.c and wav_writer.c and created
> > two new ports in pjsip (raw_player.c, raw_writer.c).
> > With these ports you are able to play and record from/to a named pipe
> > (raw pcm data without a wave header).
> >
> > Maybe others will also find it useful, so I post it to the list. Just
> > unpack the tar archive in pjproject-0.8.0.
> > It will overwrite a Makefile and the playfile.c/recfile.c example to
> > show how it works.
> >
> > Best regards,
> > Marco
> >
> > ps: The functions can be much more improved and are poorly tested. I
> > think it's a good "startpoint" to work with.
> >
> >  ------------------------------
> > *Von:* pjsip-bounces at lists.pjsip.org [mailto:
> > pjsip-bounces at lists.pjsip.org] *Im Auftrag von *jvdsandt
> > *Gesendet:* Dienstag, 19. Februar 2008 20:01
> > *An:* pjsip list
> > *Betreff:* Re: [pjsip] Using pjsua to create a mp3 stream
> >
> >   Hello,
> >
> > Thank you all for your responses. I think it is possible to use
> > pjsip/pjsau to stream a VoIP conversation as an mp3 stream without to much
> > work.
> >
> > Unfortunately I am not a C programmer. I will look for someone who can
> > help me to write the correct extension to pjsip/pjsua.
> >
> > Chhers,
> > Jan.
> >
> > On Feb 19, 2008 7:15 PM, <buldozer at aufbix.org> wrote:
> >
> > > Regarding MP3 recording ... what I do, is to re-add the code to
> > > pjsua-lib,
> > > which was there until mp3 writer was moved to the third-party folder.
> > > Just find
> > >
> > >
> > >    if (file_format == FMT_WAV) {
> > >        status = pjmedia_wav_writer_port_create(pool, path,
> > >
> > >  pjsua_var.media_cfg.clock_rate,
> > >
> > >  pjsua_var.mconf_cfg.channel_count,
> > >
> > >  pjsua_var.mconf_cfg.samples_per_frame,
> > >
> > >  pjsua_var.mconf_cfg.bits_per_sample,
> > >                                                options, 0, &port);
> > >
> > > in pjsua_media.c and add the following lines right after
> > >
> > >    } else if (file_format == FMT_MP3) {
> > >        status = pjmedia_mp3_writer_port_create(pjsua_var.pool, path,
> > >
> > >  pjsua_var.media_cfg.clock_rate,
> > >
> > >  pjsua_var.mconf_cfg.channel_count,
> > >
> > >  pjsua_var.mconf_cfg.samples_per_frame,
> > >
> > >  pjsua_var.mconf_cfg.bits_per_sample,
> > >                                                enc_param, &port);
> > >
> > > ... and include mp3_writer.c and mp3_port.h to pjsua-lib project. This
> > > works
> > > for any pjsua-lib based applications.
> > >
> > >
> > > Greets, Toni
> > >
> > > ----------------------------------------------------------------
> > > This message was sent using IMP, the Internet Messaging Program.
> > >
> > >
> > >
> > > _______________________________________________
> > > Visit our blog: http://blog.pjsip.org
> > >
> > > pjsip mailing list
> > > pjsip at lists.pjsip.org
> > > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> > >
> >
> >
> > _______________________________________________
> > Visit our blog: http://blog.pjsip.org
> >
> > pjsip mailing list
> > pjsip at lists.pjsip.org
> > http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
> >
> >
>
> _______________________________________________
> Visit our blog: http://blog.pjsip.org
>
> pjsip mailing list
> pjsip at lists.pjsip.org
> http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.pjsip.org/pipermail/pjsip_lists.pjsip.org/attachments/20080223/9a5553dd/attachment-0001.html 


[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux