Portal    Foro    Buscar    FAQ    Registrarse    Conectarse


Publicar nuevo tema  Responder al tema 
Página 1 de 1
 
 
Conexión A Icecast 2 Usando La Librería Libshout
Autor Mensaje
Responder citando   Descargar mensaje 
Mensaje Conexión A Icecast 2 Usando La Librería Libshout 
 
esto es el código resultante de unas pruebas que hice usando EXTERN para conectarme a un servidor icecast

' gambas module file

LIBRARY "libshout"
CONST SHOUTERR_SUCCESS AS Integer = 0
CONST SHOUTERR_INSANE AS Integer = -1
CONST SHOUTERR_NOCONNECT AS Integer = -2
CONST SHOUTERR_NOLOGIN AS Integer = -3
CONST SHOUTERR_SOCKET AS Integer = -4
CONST SHOUTERR_MALLOC AS Integer = -5
CONST SHOUTERR_METADATA AS Integer = -6
CONST SHOUTERR_CONNECTED AS Integer = -7
CONST SHOUTERR_UNCONNECTED AS Integer = -8
CONST SHOUTERR_UNSUPPORTED AS Integer = -9
CONST SHOUTERR_BUSY AS Integer = -10
CONST SHOUT_FORMAT_OGG AS Integer = 0
CONST SHOUT_FORMAT_MP3 AS Integer = 1
CONST SHOUT_FORMAT_VORBIS AS Integer = 0
CONST SHOUT_PROTOCOL_HTTP AS Integer = 0
CONST SHOUT_PROTOCOL_XAUDIOCAST AS Integer = 1
CONST SHOUT_PROTOCOL_ICY AS Integer = 2
CONST SHOUT_AI_BITRATE AS String = "bitrate"
CONST SHOUT_AI_SAMPLERATE AS String = "samplerate"
CONST SHOUT_AI_CHANNELS AS String = "channels"
CONST SHOUT_AI_QUALITY AS String = "quality"

EXTERN shout_new() AS Pointer
EXTERN shout_set_host(Shout AS Pointer, Host AS String) AS Integer ' Host
EXTERN shout_set_port(Shout AS Pointer, Port AS Short) AS Integer ' Port
EXTERN shout_set_password(Shout AS Pointer, Pass AS String) AS Integer ' Pass
EXTERN shout_set_user(Shout AS Pointer, User AS String) AS Integer
EXTERN shout_set_mount(Shout AS Pointer, Mount AS String) AS Integer ' Mount
EXTERN shout_set_agent(Shout AS Pointer, Name AS String) AS Integer
EXTERN shout_set_public(Shout AS Pointer, iPublic AS Integer) AS Integer
EXTERN shout_set_name(Shout AS Pointer, Name AS String) AS Integer
EXTERN shout_set_genre(Shout AS Pointer, Genre AS String) AS Integer
EXTERN shout_set_description(Shout AS Pointer, Description AS String) AS Integer
EXTERN shout_set_url(Shout AS Pointer, URL AS String) AS Integer
EXTERN shout_set_format(Shout AS Pointer, iFormat AS Integer) AS Integer ' Formato
EXTERN shout_set_protocol(Shout AS Pointer, Protocol AS Integer) AS Integer
EXTERN shout_set_audio_info(shout AS Pointer, Name AS String, value AS String) AS Integer
EXTERN shout_send_raw(shout AS Pointer, data AS String, iLen AS Integer) AS Integer
EXTERN shout_open(Shout AS Pointer) AS Integer

EXTERN shout_get_error(Shout AS Pointer) AS String
EXTERN shout_get_connected(Shout AS Pointer) AS Integer

EXTERN shout_metadata_new() AS Pointer
EXTERN shout_metadata_add(shout AS Pointer, name AS String, value AS String) AS Integer
EXTERN shout_set_metadata(shout AS Pointer, Metadata AS Pointer) AS Integer

PUBLIC Shout AS Pointer
PUBLIC MetaData AS Pointer

PUBLIC SUB Main()
  DIM Version AS Pointer
  
  Shout = shout_new()
  DEBUG shout_set_format(Shout, SHOUT_FORMAT_OGG)
  DEBUG shout_set_protocol(Shout, SHOUT_PROTOCOL_HTTP)
  IF NOT shout_set_host(Shout, "ACA EL HOST") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  DEBUG shout_set_port(Shout, 8000)
  IF NOT shout_set_password(Shout, "ACA EL PASSWORD") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_user(Shout, "ACA EL USUARIO") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_agent(Shout, "willicab") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_mount(Shout, "ACA EL PUNTO DE MONTAJE") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_public(Shout, 1) = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_name(Shout, "Nombre del stream") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_genre(Shout, "Live Libre") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_Description(Shout, "Descripcion del stream") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  IF NOT shout_set_url(Shout, "http://willicab.gnu.org.ve") = SHOUTERR_SUCCESS THEN
    LogError(shout_get_error(Shout))
    RETURN
  ENDIF
  DEBUG shout_set_audio_info(shout, SHOUT_AI_SAMPLERATE, "48000")
  DEBUG shout_set_audio_info(shout, SHOUT_AI_CHANNELS, "1")
  DEBUG shout_set_audio_info(shout, SHOUT_AI_BITRATE, "96");
  
  DEBUG shout_open(Shout)

  DO WHILE 1
    shout_send_raw(shout, "1", 1)
    WAIT 0.1
  LOOP
END

PUBLIC SUB LogError(sError AS String)
  DEBUG "libshout error: " & sError
END


En fin, espero que les sirva este código.
 




===================
William Cabrera
Mi Blog
Mi Twitter
IRC de Gambas en Español
 
willicab - Ver perfil del usuarioEnviar mensaje privadoVisitar sitio web del usuario 
Volver arribaPágina inferior
Mostrar mensajes anteriores:    
 
Ocultar¡Este tema fue útil?

 

Elegir valoración:                       

Media de valoración Valoración mínima Valoración máxima Número de valoraciones
0.00 0 0 0
 
OcultarTemas parecidos
Tema Autor Foro Respuestas último mensaje
No hay nuevos mensajes Libmodbus: Usando Una Librería Externa razaAztk Controles/Librerías/Componentes 16 Martes, 10 Julio 2018, 15:37 Ver último mensaje
mckaygerhard
No hay nuevos mensajes Conexión A BD sulky16v2 Bases de Datos 4 Martes, 03 May 2016, 14:05 Ver último mensaje
Invitado
No hay nuevos mensajes Mensaje De Conexión techm3 Bases de Datos 6 Miercoles, 17 Marzo 2010, 20:36 Ver último mensaje
techm3
No hay nuevos mensajes Comprobar La Conexión A Internet bies88 General 1 Sabado, 19 Febrero 2011, 00:47 Ver último mensaje
soplo
 

Publicar nuevo tema  Responder al tema  Página 1 de 1
 

Usuarios navegando en este tema: 0 registrados, 0 ocultos y 1 invitado
Usuarios registrados conectados: Ninguno


 
Lista de permisos
No puede crear mensajes
No puede responder temas
No puede editar sus mensajes
No puede borrar sus mensajes
No puede votar en encuestas
No puede adjuntar archivos
No puede descargar archivos
No puede publicar eventos en el calendario