#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <getopt.h>
#include <time.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/mman.h>
#include <fcntl.h>
#include <unistd.h>
#include <limits.h>
#include <math.h>
#include <netinet/in.h>
#include <pthread.h>
#include <sched.h>
#include <errno.h>
#include <sys/socket.h>
#include <arpa/inet.h>
#include <netpacket/packet.h>
#include <net/ethernet.h>
#include "str.h"
#include "net_udp.h"
#include "rtp.h"
#include <asm/elphel/c313a.h>
#include <asm/elphel/hist.h>
#include "event.h"
#include "rtsp.h"
Include dependency graph for str.c:
Go to the source code of this file.
Defines | |
#define | RTP_PAYLOAD_SIZE 1460 |
#define | JPEG_RTP_HDR_SIZE 8 |
#define | MMAP_METHOD 1 |
#define | READ_METHOD 2 |
#define | SDP_FILE "/var/html/session.sdp" |
#define | SESSION_DESCR "Elphel camera 353" |
#define | PROGR_PARAM 1 |
#define | DEFAULT_DEST_IP "232.1.1.1" |
#define | DEFAULT_DEST_PORT 20020 |
#define | DEFAULT_RTSP_PORT 554 |
#define | DEFAULT_TTL 2 |
#define | DEFAULT_REFRESH_INTERVAL 5 |
#define | RTSP_ON_TAG 10 |
#define | RTSP_OFF_TAG 11 |
#define | RTSP_LISTEN_PORT_TAG 12 |
#define | RTSP_USE_OPT_ADDR_TAG 13 |
#define | RTSP_USE_OPT_PORT_TAG 14 |
#define | RTSP_QT_COMPAT_TAG 15 |
#define | FRESH_FILE "/var/html/fresh.jpeg" |
#define | HDR_SIZE 623 |
#define | TMP_BUF_OFFS 0xfe000 |
#define | YUV420 1 |
#define | MAX_JPEG_BUF 2000000 |
#define | HZ 10000 |
#define | NO_IOCTLS_IN_CIRCBUF y |
Functions | |
uint64_t | GetTimestamp (uint32_t tv_sec, uint32_t tv_usec) |
uint32_t | ts2rtp (struct param *p, uint64_t t) |
int8_t | write_sdp (struct param *p, int save, int8_t *sdp) |
void | session_finish (struct param *p) |
int32_t | jpeg_session_start (struct param *p) |
int32_t | send_jpeg (struct param *p, uint8_t *_data, uint32_t sz, uint32_t max_size, uint8_t type, uint8_t q, uint32_t t_sec, uint32_t t_usec) |
void | usage (struct param *p, int32_t ret) |
void | opt_parse (int32_t argc, char *const argv[], struct param *p) |
int32_t | grab_and_send (struct param *p) |
void * | rtsp_loop (void *var) |
int | main (int argc, char **argv) |
Variables | |
int8_t | version [] = "1.7" |
static int8_t * | header |
const uint64_t | TimestampTicks = 1000000 |
int32_t | fd |
int32_t | ioctl_fd |
temporary adding another file descriptor as circbuf does not support ioctl anymore | |
int32_t | buf_size |
int32_t | str_setup |
int32_t | str_play |
int32_t | str_teardown |
int32_t | str_stop |
int32_t | str_count |
int8_t * | wbuf |
unsigned long * | start |
unsigned long * | ccam_dma_buf |
#define DEFAULT_DEST_IP "232.1.1.1" |
#define DEFAULT_DEST_PORT 20020 |
#define FRESH_FILE "/var/html/fresh.jpeg" |
#define HDR_SIZE 623 |
#define HZ 10000 |
Definition at line 83 of file str.c.
Referenced by crisv32_eth_receive_packet(), crisv32_eth_send_packet(), grab_and_send(), nand_do_read_ecc(), and nand_wait().
#define JPEG_RTP_HDR_SIZE 8 |
#define MAX_JPEG_BUF 2000000 |
#define MMAP_METHOD 1 |
#define PROGR_PARAM 1 |
#define READ_METHOD 2 |
Definition at line 59 of file str.c.
Referenced by grab_and_send(), jpeg_session_start(), and main().
#define RTP_PAYLOAD_SIZE 1460 |
#define SDP_FILE "/var/html/session.sdp" |
#define SESSION_DESCR "Elphel camera 353" |
#define TMP_BUF_OFFS 0xfe000 |
#define YUV420 1 |
uint64_t GetTimestamp | ( | uint32_t | tv_sec, | |
uint32_t | tv_usec | |||
) | [inline] |
int32_t grab_and_send | ( | struct param * | p | ) |
Definition at line 795 of file str.c.
References _CCCMD, buf, buf_size, CAMSEQ_RUN, CAMSEQ_SINGLE, ccam_dma_buf, CCAM_RPARS, CMOSCAM_IOCTYPE, fd, param::fps, param::fps_soft, frame, FRESH_FILE, G_CIRCBUFWP, HDR_SIZE, param::height, HZ, IO_CCAM_JPEG, IO_CCAM_MONITOR_SEQ, ioctl_fd, IP_UDP_SIZE, JPEG_CMD_ACQUIRE, JPEG_CMD_CATCHUP, JPEG_CMD_FORGET, JPEG_CMD_START, JPEG_CMD_STOP, JPEG_RTP_HDR_SIZE, jpeg_session_start(), MAX_JPEG_BUF, memcpy(), memset(), param::meth, MMAP_METHOD, P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, P_QUALITY, ptr, param::raw, read, READ_METHOD, RTP_PAYLOAD_SIZE, param::rtsp, param::rtsp_qt_compat, SEEK_END, SEEK_SET, send_jpeg(), session_finish(), start, stderr, str_play, str_stop, str_teardown, time, TMP_BUF_OFFS, param::vbitrt, param::verbose, wbuf, param::web, param::width, write, write_sdp(), YUV420, and param::zero.
int32_t jpeg_session_start | ( | struct param * | p | ) |
Definition at line 258 of file str.c.
References _CCCMD, a, CCAM_RPARS, param::dport, param::dst, param::dst_mac, param::eth_index, param::fd_raw, param::fd_udp, param::fps, param::fps_soft, header, param::height, ioctl_fd, ismulticast(), JPEG_PAYLOAD_NUM, memcpy(), memset(), param::meth, param::msg, param::my_ssrc, P_QUALITY, param::payload_num, param::raw, READ_METHOD, rtp_init(), param::rtsp, param::rtsp_port, param::rtsp_use_cmd_addr, param::rtsp_use_cmd_port, param::s_ll, param::src, param::start_timestamp, stderr, param::ttl, version, param::web, param::width, and param::zero.
Referenced by grab_and_send().
int main | ( | int | argc, | |
char ** | argv | |||
) |
Definition at line 1030 of file str.c.
References DEFAULT_DEST_IP, DEFAULT_DEST_PORT, DEFAULT_REFRESH_INTERVAL, DEFAULT_RTSP_PORT, DEFAULT_TTL, param::dport, param::dst, param::fd_raw, param::fd_udp, param::fps_soft, get_src_addr(), param::hw_fps, IOC_STREAM_SET_FPS, memset(), param::meth, MMAP_METHOD, param::msg, opt_parse(), param::raw, READ_METHOD, param::rtsp, param::rtsp_port, param::rtsp_qt_compat, param::rtsp_use_cmd_addr, param::rtsp_use_cmd_port, stderr, param::ttl, usage, param::verbose, param::web, and param::zero.
void opt_parse | ( | int32_t | argc, | |
char *const | argv[], | |||
struct param * | p | |||
) |
void* rtsp_loop | ( | void * | var | ) |
int32_t send_jpeg | ( | struct param * | p, | |
uint8_t * | _data, | |||
uint32_t | sz, | |||
uint32_t | max_size, | |||
uint8_t | type, | |||
uint8_t | q, | |||
uint32_t | t_sec, | |||
uint32_t | t_usec | |||
) |
Definition at line 380 of file str.c.
References GetTimestamp(), param::height, JPEG_RTP_HDR_SIZE, param::payload_num, param::raw, RTP_PAYLOAD_SIZE, rtp_send_data(), size, stderr, ts2rtp(), and param::width.
Referenced by grab_and_send().
void session_finish | ( | struct param * | p | ) |
Definition at line 253 of file str.c.
References param::my_ssrc, rtp_done(), and stderr.
Referenced by grab_and_send().
uint32_t ts2rtp | ( | struct param * | p, | |
uint64_t | t | |||
) | [inline] |
Definition at line 107 of file str.c.
References param::start_timestamp, TimestampTicks, and param::vbitrt.
Referenced by send_jpeg().
void usage | ( | struct param * | p, | |
int32_t | ret | |||
) |
Definition at line 473 of file str.c.
References DEFAULT_DEST_IP, DEFAULT_DEST_PORT, DEFAULT_TTL, exit, header, param::program_name, stderr, usage, and version.
int8_t write_sdp | ( | struct param * | p, | |
int | save, | |||
int8_t * | sdp | |||
) |
Definition at line 120 of file str.c.
References _CCCMD, CCAM_RPARS, param::dport, dst, param::dst, f, fps, param::fps, param::fps_soft, ioctl_fd, ismulticast(), JPEG_PAYLOAD_NUM, memset(), P_ACTUAL_HEIGHT, P_ACTUAL_WIDTH, param::rtsp, param::rtsp_port, param::rtsp_use_cmd_addr, param::rtsp_use_cmd_port, SDP_FILE, SESSION_DESCR, param::src, stderr, str_count, param::ttl, and version.
Referenced by grab_and_send(), and handle_DESCRIBE().
int32_t buf_size |
unsigned long * ccam_dma_buf |
int32_t fd |
Definition at line 98 of file str.c.
Referenced by CreateBootLoader(), do_accept(), Fopen(), get_char(), get_char_skip_comments(), get_self_ip(), get_src_addr(), getChipParams(), GetLocalEthAddr(), grab_and_send(), listener_loop(), main(), PHP_FUNCTION(), rtsp_listen(), SendToDevice(), signal_recv(), snd_config_load1(), streamer_is_run(), and write_regular_file().
int8_t* header [static] |
Initial value:
"RTP/JPEG streamer for Elphel 333/353 camera\n" "Version %s\n" " (C) Elphel, Inc\n" " 2004 Alexander Melichenko <alexlp@freemail.ru>\n" " 2007 Mykhailo Malyshko aka Spectr\n" "\n"
Definition at line 88 of file str.c.
Referenced by _returnXML(), create_elphel353_kdevelop(), fpga(), gen_dynamic_xml(), gen_static_xml(), generate(), getSerial(), jpeg_session_start(), main(), out1x1gif(), parseGetNames(), showHistGamma(), showJpegHeader(), showUsage(), and usage().
int32_t ioctl_fd |
temporary adding another file descriptor as circbuf does not support ioctl anymore
Definition at line 100 of file str.c.
Referenced by grab_and_send(), jpeg_session_start(), and write_sdp().
int32_t str_count |
Definition at line 791 of file str.c.
Referenced by do_read(), handle_DESCRIBE(), handle_PAUSE(), handle_TEARDOWN(), rtsp_udp_setup(), and write_sdp().
int32_t str_play |
Definition at line 788 of file str.c.
Referenced by grab_and_send(), handle_PAUSE(), and handle_PLAY().
int32_t str_setup |
int32_t str_stop |
int32_t str_teardown |
Definition at line 789 of file str.c.
Referenced by do_read(), grab_and_send(), and handle_TEARDOWN().
const uint64_t TimestampTicks = 1000000 |
int8_t* wbuf |
Definition at line 792 of file str.c.
Referenced by fpga_io_write(), grab_and_send(), png_write_sCAL(), and write_regular_file().