int CPlayerMedia::srtp_init (void)
{
  if (m_rtp_session == NULL) return -1;

  const char *crypto;

  crypto = find_unparsed_a_value(m_media_info->unparsed_a_lines, 
				 "a=crypto");
  if (crypto == NULL) {
    media_message(LOG_CRIT, "%s: can't find a=crypto line in sdp for srtp",
		  get_name());
    return -1;
  }

  m_srtp_session = srtp_setup_from_sdp(get_name(), m_rtp_session, crypto);
  if (m_srtp_session == NULL)
    media_message(LOG_ERR, "player_media_rtp.srtp_init: srtp_setup failed");
  
  return 0;
}
Beispiel #2
0
static int xvid_codec_check (lib_message_func_t message,
			     const char *compressor,
			     int type,
			     int profile,
			     format_list_t *fptr,
			     const uint8_t *userdata,
			     uint32_t userdata_size,
			     CConfigSet *pConfig)
{
  int retval;
  retval = 3;
  if (compressor != NULL && 
      (strcasecmp(compressor, "MP4 FILE") == 0)) {
    if ((type == MP4_MPEG4_VIDEO_TYPE) &&
	((profile >= MPEG4_SP_L1 && profile <= MPEG4_SP_L3) ||
	 (profile == MPEG4_SP_L0))) {
      return retval;
    }
    return -1;
  }
  if (fptr != NULL) {
    // find format. If matches, call parse_fmtp_for_mpeg4, look at
    // profile level.
    if (fptr->rtpmap != NULL && fptr->rtpmap->encode_name != NULL) {
      if (strcasecmp(fptr->rtpmap->encode_name, "MP4V-ES") == 0) {
	fmtp_parse_t *fmtp;
	media_desc_t *mptr = fptr->media;
	if (find_unparsed_a_value(mptr->unparsed_a_lines, "a=x-mpeg4-simple-profile-decoder") != NULL) {
	  // our own special code for simple profile decoder
	  return retval;
	}
	fmtp = parse_fmtp_for_mpeg4(fptr->fmt_param, message);
	int retvl = -1;
	if (fmtp != NULL) {
	  int profile = fmtp->profile_level_id;
	  if ((profile >= MPEG4_SP_L1 && profile <= MPEG4_SP_L3) || 
	      (profile == MPEG4_SP_L0)) {
	    retvl = retval;
	  } else if (fmtp->config_binary != NULL) {
	    // see if they indicate simple tools in VOL
#if 0
	    uint8_t *volptr;
	    volptr = MP4AV_Mpeg4FindVol(fmtp->config_binary, 
					fmtp->config_binary_len);
	    if (volptr != NULL && 
		((volptr[4] & 0x7f) == 0) &&
		((volptr[5] & 0x80) == 0x80)) {
message(LOG_ERR, "xvid", "indicated simple tools in xvid");
	      retvl = retval;
	    }
#endif
	  }
	  free_fmtp_parse(fmtp);
	}
	return retvl;
      }
    }
    return -1;
  }

  if (compressor != NULL) {
    const char **lptr = xvid_compressors;
    while (*lptr != NULL) {
      if (strcasecmp(*lptr, compressor) == 0) {
	return retval;
      }
      lptr++;
    }
  }
  return -1;
}