Commit aa5fe86a authored by Miguel Angel Cabrera Moya's avatar Miguel Angel Cabrera Moya Committed by Ilkka Ollakka

RTMP bugfix and reusability enhacenment

Signed-off-by: default avatarIlkka Ollakka <ileoo@videolan.org>
parent fb19b264
This diff is collapsed.
This diff is collapsed.
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
typedef struct rtmp_packet_t rtmp_packet_t; typedef struct rtmp_packet_t rtmp_packet_t;
typedef struct rtmp_body_t rtmp_body_t; typedef struct rtmp_body_t rtmp_body_t;
typedef struct rtmp_control_thread_t rtmp_control_thread_t; typedef struct rtmp_control_thread_t rtmp_control_thread_t;
typedef void (*rtmp_handler_t)( rtmp_control_thread_t *rtmp_control_thread, rtmp_packet_t *rtmp_packet ); typedef void (*rtmp_handler_t)( rtmp_control_thread_t *p_thread, rtmp_packet_t *rtmp_packet );
struct rtmp_packet_t struct rtmp_packet_t
{ {
...@@ -54,51 +54,61 @@ struct rtmp_control_thread_t ...@@ -54,51 +54,61 @@ struct rtmp_control_thread_t
int fd; int fd;
block_fifo_t *p_fifo_media; vlc_url_t url;
char *psz_application;
char *psz_media;
block_fifo_t *p_fifo_input;
block_fifo_t *p_empty_blocks; block_fifo_t *p_empty_blocks;
vlc_mutex_t lock; vlc_mutex_t lock;
vlc_cond_t wait; vlc_cond_t wait;
int result_connect; int result_connect;
int result_publish;
int result_play; int result_play;
int result_publish; int result_stop;
double stream_client; double stream_client_id;
double stream_server; double stream_server_id;
char *psz_publish; char *psz_publish;
/* Rebuild FLV variables */ /* Rebuild FLV variables (access) */
int has_audio; int has_audio;
int has_video; int has_video;
int metadata_received; int metadata_received;
uint8_t metadata_stereo; uint8_t metadata_stereo;
uint8_t metadata_samplesize; uint8_t metadata_samplesize;
uint8_t metadata_samplerate; uint32_t metadata_samplerate;
uint8_t metadata_audiocodecid; uint8_t metadata_audiocodecid;
uint8_t metadata_videocodecid; uint8_t metadata_videocodecid;
uint8_t metadata_frametype; uint8_t metadata_frametype;
int first_media_packet; int first_media_packet;
uint32_t flv_tag_previous_tag_size; uint32_t flv_tag_previous_tag_size;
/* Vars for rebuilding FLV (access_output) */
rtmp_body_t *flv_body;
uint8_t flv_content_type;
uint32_t flv_length_body;
uint32_t flv_timestamp;
/* vars for channel state */ /* vars for channel state */
uint32_t chunk_size_recv;
uint32_t chunk_size_send;
rtmp_packet_t rtmp_headers_recv[64]; /* RTMP_HEADER_STREAM_MAX */ rtmp_packet_t rtmp_headers_recv[64]; /* RTMP_HEADER_STREAM_MAX */
rtmp_packet_t rtmp_headers_send[64]; rtmp_packet_t rtmp_headers_send[64];
rtmp_handler_t rtmp_handler[21]; /* index by RTMP_CONTENT_TYPE */ rtmp_handler_t rtmp_handler[21]; /* index by RTMP_CONTENT_TYPE */
/* Pointer to base module object (later needs to casted) */
void *p_base_object;
}; };
struct access_sys_t struct access_sys_t
{ {
int active; int active;
int fd;
vlc_url_t url;
char *psz_application;
char *psz_media;
/* vars for reading from fifo */ /* vars for reading from fifo */
block_t *flv_packet; block_t *flv_packet;
int read_packet; int read_packet;
...@@ -110,17 +120,27 @@ struct access_sys_t ...@@ -110,17 +120,27 @@ struct access_sys_t
/***************************************************************************** /*****************************************************************************
* RTMP header: * RTMP header:
******************************************************************************/ ******************************************************************************/
int rtmp_handshake_passive( vlc_object_t *p_this ); int rtmp_handshake_active( vlc_object_t *p_this, int fd );
int rtmp_handshake_active( vlc_object_t *p_this ); int rtmp_handshake_passive( vlc_object_t *p_this, int fd );
int rtmp_connect_active( vlc_object_t *p_this ); int rtmp_connect_active( rtmp_control_thread_t *p_thread );
int rtmp_connect_passive( rtmp_control_thread_t *p_thread );
//int rtmp_seek( access_t *p_access, int64_t i_pos ); TODO //int rtmp_seek( access_t *p_access, int64_t i_pos ); TODO
int rtmp_send_bytes_read( access_t *p_access, uint32_t reply ); //
int rtmp_send_publish_start( access_t *p_access ); rtmp_packet_t *rtmp_build_bytes_read( rtmp_control_thread_t *p_thread, uint32_t reply );
rtmp_packet_t *rtmp_build_publish_start( rtmp_control_thread_t *p_thread );
rtmp_packet_t *rtmp_build_flv_over_rtmp( rtmp_control_thread_t *p_thread, block_t *p_buffer );
rtmp_packet_t *rtmp_read_net_packet( rtmp_control_thread_t *p_thread ); rtmp_packet_t *rtmp_read_net_packet( rtmp_control_thread_t *p_thread );
uint8_t *rtmp_encode_packet( rtmp_control_thread_t *p_thread, rtmp_packet_t *rtmp_packet );
void rtmp_init_handler( rtmp_handler_t *rtmp_handler ); void rtmp_init_handler( rtmp_handler_t *rtmp_handler );
/***************************************************************************** /*****************************************************************************
* FLV header: * FLV header:
******************************************************************************/ ******************************************************************************/
block_t *flv_get_metadata( access_t *p_access ); block_t *flv_get_metadata( access_t *p_access );
block_t *flv_insert_header( access_t *p_access, block_t *first_packet ); block_t *flv_insert_header( access_t *p_access, block_t *first_packet );
/*****************************************************************************
* RTMP body header:
******************************************************************************/
rtmp_body_t *rtmp_body_new( int length_buffer );
void rtmp_body_reset( rtmp_body_t * );
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment