Package org.red5.app.sip.codecs

Examples of org.red5.app.sip.codecs.Codec


     * @return Returns the audio codec to be used on current session.
     */
    public static Codec getNegotiatedAudioCodec(SessionDescriptor negotiatedSDP){
        int payloadId;
        String rtpmap;
        Codec sipCodec = null;
       
        MediaDescriptor md = negotiatedSDP.getMediaDescriptor(Codec.MEDIA_TYPE_AUDIO );
        rtpmap = md.getAttribute(Codec.ATTRIBUTE_RTPMAP).getAttributeValue();
       
        if (!rtpmap.isEmpty()) {           
            payloadId = Integer.parseInt(rtpmap.substring(0, rtpmap.indexOf(" ")));
           
            sipCodec = CodecFactory.getInstance().getSIPAudioCodec(payloadId);           
            if (sipCodec == null) {
              log.error("Negotiated codec {} not found", payloadId);
            }
            else {
                log.info("Found codec: payloadType={}, payloadName={}.", sipCodec.getCodecId(),
                      sipCodec.getCodecName());
            }
        }       
        return sipCodec;
    }
View Full Code Here


                    // already present on newSdp.                   
//                    log.debug("Payload " + payloadId + " present on newSdp.");
                   
                    AttributeField localAttribute = findAttributeByPayloadId(remoteAttribute.getAttributeName(), payloadId, localMedia );
                   
                    Codec sipCodec = CodecFactory.getInstance().getSIPAudioCodec(Integer.valueOf( payloadId));
                   
                    if (sipCodec != null) {                       
                        String localAttibuteValue = "";
                       
                        if (localAttribute != null) {                           
                            localAttibuteValue = localAttribute.getAttributeValue();
                        } else {
                            log.info("Attribute not found on local media.");
                        }
                       
                        String attributeValueResult = sipCodec.codecNegotiateAttribute(remoteAttribute.getAttributeName(),
                                          localAttibuteValue, remoteAttribute.getAttributeValue());
                       
                        if ((attributeValueResult != null) && (!"".equals(attributeValueResult))) {
                          AttributeField af = new AttributeField(remoteAttribute.getAttributeName(), attributeValueResult);
                          MediaDescriptor md = newSdp.getMediaDescriptor(localMedia.getMedia().getMedia());
View Full Code Here

     * @return Returns the audio codec to be used on current session.
     */
    public static Codec getNegotiatedAudioCodec(SessionDescriptor negotiatedSDP){
        int payloadId;
        String rtpmap;
        Codec sipCodec = null;
       
        MediaDescriptor md = negotiatedSDP.getMediaDescriptor(Codec.MEDIA_TYPE_AUDIO );
        rtpmap = md.getAttribute(Codec.ATTRIBUTE_RTPMAP).getAttributeValue();
       
        if (!rtpmap.isEmpty()) {           
            payloadId = Integer.parseInt(rtpmap.substring(0, rtpmap.indexOf(" ")));
           
            sipCodec = CodecFactory.getInstance().getSIPAudioCodec(payloadId);           
            if (sipCodec == null) {
              log.error("Negotiated codec {} not found", payloadId);
            }
            else {
                log.info("Found codec: payloadType={}, payloadName={}.", sipCodec.getCodecId(),
                      sipCodec.getCodecName());
            }
        }       
        return sipCodec;
    }
View Full Code Here

                    // already present on newSdp.                   
//                    log.debug("Payload " + payloadId + " present on newSdp.");
                   
                    AttributeField localAttribute = findAttributeByPayloadId(remoteAttribute.getAttributeName(), payloadId, localMedia );
                   
                    Codec sipCodec = CodecFactory.getInstance().getSIPAudioCodec(Integer.valueOf( payloadId));
                   
                    if (sipCodec != null) {                       
                        String localAttibuteValue = "";
                       
                        if (localAttribute != null) {                           
                            localAttibuteValue = localAttribute.getAttributeValue();
                        } else {
                            log.info("Attribute not found on local media.");
                        }
                       
                        String attributeValueResult = sipCodec.codecNegotiateAttribute(remoteAttribute.getAttributeName(),
                                          localAttibuteValue, remoteAttribute.getAttributeValue());
                       
                        if ((attributeValueResult != null) && (!"".equals(attributeValueResult))) {
                          AttributeField af = new AttributeField(remoteAttribute.getAttributeName(), attributeValueResult);
                          MediaDescriptor md = newSdp.getMediaDescriptor(localMedia.getMedia().getMedia());
View Full Code Here

    }

    IStreamableFileService service = factory.getService(file);

    IStreamableFile flv = service.getStreamableFile(file);

    writer = flv.getWriter();

  }
View Full Code Here

    } else if (!file.canWrite()) {
      throw new IOException("The file is read-only");
    }

    IStreamableFileService service = factory.getService(this.file);
    IStreamableFile flv = service.getStreamableFile(this.file);
    this.writer = flv.getWriter();

  }
View Full Code Here

     */

    private void init() throws IOException {

   
    IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils

        .getScopeService(scope, IStreamableFileFactory.class,

            StreamableFileFactory.class);

    File folder = file.getParentFile();

    if (!folder.exists()) {

      if (!folder.mkdirs()) {

        throw new IOException("Could not create parent folder");

      }

    }

    if (!file.isFile()) {

      // Maybe the (previously existing) file has been deleted

      file.createNewFile();

    } else if (!file.canWrite()) {

      throw new IOException("The file is read-only");

    }

    IStreamableFileService service = factory.getService(file);

    IStreamableFile flv = service.getStreamableFile(file);

    writer = flv.getWriter();

View Full Code Here

     *
     * @throws IOException          I/O exception
     */
    protected void init() throws IOException {

    IStreamableFileFactory factory = (IStreamableFileFactory) ScopeUtils
        .getScopeService(this.scope, IStreamableFileFactory.class,
            StreamableFileFactory.class);
   
    File folder = file.getParentFile();

    if (!folder.exists()) {
      if (!folder.mkdirs()) {
        throw new IOException("Could not create parent folder");
      }
    }

    if (!this.file.isFile()) {

      // Maybe the (previously existing) file has been deleted
      this.file.createNewFile();

    } else if (!file.canWrite()) {
      throw new IOException("The file is read-only");
    }

    IStreamableFileService service = factory.getService(this.file);
    IStreamableFile flv = service.getStreamableFile(this.file);
    this.writer = flv.getWriter();

  }
View Full Code Here

      throw new IOException("The file is read-only");

    }

    IStreamableFileService service = factory.getService(file);

    IStreamableFile flv = service.getStreamableFile(file);

    writer = flv.getWriter();

  }
View Full Code Here

    } else if (!file.canWrite()) {
      throw new IOException("The file is read-only");
    }

    IStreamableFileService service = factory.getService(this.file);
    IStreamableFile flv = service.getStreamableFile(this.file);
    this.writer = flv.getWriter();

  }
View Full Code Here

TOP

Related Classes of org.red5.app.sip.codecs.Codec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.