/***************************************************************************** * multicat.c: netcat-equivalent for multicast ***************************************************************************** * Copyright (C) 2009 VideoLAN * $Id: multicat.c 48 2007-11-30 14:08:21Z cmassiot $ * * Authors: Christophe Massiot * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. *****************************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include #include "util.h" #define RTP_HEADER_MAX_SIZE (RTP_HEADER_SIZE + 15 * 4) #define RTP_TS_TYPE 33 /***************************************************************************** * Local declarations *****************************************************************************/ static int i_input_fd, i_output_fd; FILE *p_input_aux, *p_output_aux; static uint16_t i_pcr_pid = 0; static bool b_overwrite_ssrc = false; static in_addr_t i_ssrc = 0; static bool b_input_udp = false, b_output_udp = false; static size_t i_asked_payload_size = DEFAULT_PAYLOAD_SIZE; static bool b_die = false; static uint16_t i_rtp_cc; static uint64_t i_stc = 0; /* system time clock, used for date calculations */ static uint64_t i_pcr = 0, i_pcr_stc = 0; /* for RTP/TS output */ void (*pf_Skip)( size_t i_len, int i_nb_chunks ); ssize_t (*pf_Read)( void *p_buf, size_t i_len ); ssize_t (*pf_Write)( const void *p_buf, size_t i_len ); static void usage(void) { msg_Raw( NULL, "Usage: multicat [-i ] [-t ] [-p ] [-s ] [-n ] [-d