Go to the documentation of this file.
40 #define LOCAL_ADDRESS 0xc0a80081 // FIXME get and use correct local ip address.
41 #define LOCAL_PORT 1037 // as above.
119 uint32_t prefix1, uint32_t prefix2)
131 int first_length= exact_length - 16;
132 int len8= first_length/8;
143 if(write_result != exact_length) {
145 "Failed to write data of length %d: %d (%s)\n",
146 exact_length, write_result,
147 write_result < 0 ? strerror(
AVUNERROR(write_result)) :
148 "The server closed the connection");
180 char data_string[256];
188 snprintf(data_string,
sizeof(data_string),
"\\\\%d.%d.%d.%d\\%s\\%d",
252 if (read_result != 8) {
253 if(read_result < 0) {
255 "Error reading packet header: %d (%s)\n",
256 read_result, strerror(
AVUNERROR(read_result)));
260 "The server closed the connection\n");
268 int length_remaining, hr;
272 if(read_result != 4) {
274 "Reading command packet length failed: %d (%s)\n",
276 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
277 "The server closed the connection");
278 return read_result < 0 ? read_result :
AVERROR(EIO);
284 if (length_remaining < 0
285 || length_remaining >
sizeof(mms->
in_buffer) - 12) {
288 length_remaining,
sizeof(mms->
in_buffer) - 12);
293 if (read_result != length_remaining) {
295 "Reading pkt data (length=%d) failed: %d (%s)\n",
296 length_remaining, read_result,
297 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
298 "The server closed the connection");
299 return read_result < 0 ? read_result :
AVERROR(EIO);
304 "Server sent a message with packet type 0x%x and error status code 0x%08x\n", packet_type, hr);
308 int length_remaining;
315 length_remaining = (
tmp - 8) & 0xffff;
320 if (length_remaining < 0
321 || length_remaining >
sizeof(mms->
in_buffer) - 8) {
323 "Data length %d is invalid or too large (max=%"SIZE_SPECIFIER")\n",
324 length_remaining,
sizeof(mms->
in_buffer));
330 if(read_result != length_remaining) {
332 "Failed to read packet data of size %d: %d (%s)\n",
333 length_remaining, read_result,
334 read_result < 0 ? strerror(
AVUNERROR(read_result)) :
335 "The server closed the connection");
336 return read_result < 0 ? read_result :
AVERROR(EIO);
358 }
else if(packet_id_type == mmst->
packet_id) {
385 int ret = send_fun(mmst);
394 "Corrupt stream (unexpected packet type 0x%x, expected 0x%x)\n",
426 char data_string[256];
433 snprintf(data_string,
sizeof(data_string),
434 "NSPlayer/7.0.0.1956; {%s}; Host: %s",
435 "7E667F5D-A661-495E-A512-F55686DDA178", mmst->
host);
524 sizeof(mmst->
path), uri);
532 &
h->interrupt_callback,
NULL,
533 h->protocol_whitelist,
h->protocol_blacklist,
h);
559 "The server does not support MMST (try MMSH or RTSP)\n");
612 "Incoming pktlen %d is larger than ASF pktsize %d\n",
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
#define URL_PROTOCOL_FLAG_NETWORK
#define AVIO_FLAG_READ_WRITE
read-write pseudo flag
@ SC_PKT_CLIENT_ACCEPTED
Control packets.
MMSCSPacketType
Client to server packet types.
int header_parsed
The header has been received and parsed.
static int mms_close(URLContext *h)
Close the MMSH/MMST connection.
static void handle_packet_stream_changing_type(MMSTContext *mmst)
uint8_t * asf_header
Internal handling of the ASF header.
int incoming_flags
Incoming packet flags.
@ SC_PKT_STREAM_ID_ACCEPTED
MMSSCPacketType
Server to client packet types.
char path[256]
Path of the resource being asked for.
static int send_media_file_request(MMSTContext *mmst)
int stream_num
stream numbers.
static int mms_read(URLContext *h, uint8_t *buf, int size)
Read ASF data through the protocol.
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int incoming_packet_seq
Incoming packet sequence number.
static int send_stream_selection_request(MMSTContext *mmst)
Send MMST stream selection command based on the AVStream->discard values.
@ SC_PKT_MEDIA_PKT_FOLLOWS
#define AV_LOG_TRACE
Extremely verbose debugging, useful for libav* development.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
int ff_mms_asf_header_parser(MMSContext *mms)
int ffurl_open_whitelist(URLContext **puc, const char *filename, int flags, const AVIOInterruptCB *int_cb, AVDictionary **options, const char *whitelist, const char *blacklist, URLContext *parent)
Create an URLContext for accessing to the resource indicated by url, and open it.
@ SC_PKT_ASF_HEADER
Data packets.
int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size)
int ff_url_join(char *str, int size, const char *proto, const char *authorization, const char *hostname, int port, const char *fmt,...)
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_WL32 unsigned int_TMPL AV_WL24 unsigned int_TMPL AV_RL16
static void pad_media_packet(MMSContext *mms)
Pad media packets smaller than max_packet_size and/or adjust read position after a seek.
uint8_t in_buffer[65536]
Buffer for incoming packets.
static int send_media_packet_request(MMSTContext *mmst)
and forward the result(frame or status change) to the corresponding input. If nothing is possible
char host[128]
Host of the resources.
uint8_t out_buffer[512]
Buffer for outgoing packet.
@ CS_PKT_MEDIA_HEADER_REQUEST
static int mms_put_utf16(MMSContext *mms, const uint8_t *src)
int ff_mms_read_data(MMSContext *mms, uint8_t *buf, const int size)
static MMSSCPacketType get_tcp_server_response(MMSTContext *mmst)
Read incoming MMST media, header or command packet.
int outgoing_packet_seq
Outgoing packet sequence number.
@ SC_PKT_MEDIA_FILE_DETAILS
int remaining_in_len
Reading length from incoming buffer.
@ SC_PKT_PROTOCOL_ACCEPTED
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
uint8_t * write_out_ptr
Buffer for outgoing packets.
static int mms_open(URLContext *h, const char *uri, int flags)
@ CS_PKT_MEDIA_FILE_REQUEST
@ SC_PKT_HEADER_REQUEST_ACCEPTED
#define i(width, name, range_min, range_max)
void ffio_init_context(FFIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
static int send_command_packet(MMSTContext *mmst)
Send a prepared MMST command packet.
static int send_protocol_select(MMSTContext *mmst)
void av_url_split(char *proto, int proto_size, char *authorization, int authorization_size, char *hostname, int hostname_size, int *port_ptr, char *path, int path_size, const char *url)
Split a URL string into components.
static int mms_safe_send_recv(MMSTContext *mmst, int(*send_fun)(MMSTContext *mmst), const MMSSCPacketType expect_type)
static void start_command_packet(MMSTContext *mmst, MMSCSPacketType packet_type)
Create MMST command packet header.
static int send_close_packet(MMSTContext *mmst)
@ CS_PKT_START_FROM_PKT_ID
int ffurl_closep(URLContext **hh)
Close the resource accessed by the URLContext h, and free the memory used by it.
int packet_id
Identifier for packets in the current stream.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
static int send_keepalive_packet(MMSTContext *mmst)
@ CS_PKT_TIMING_DATA_REQUEST
static int send_media_header_request(MMSTContext *mmst)
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
Write size bytes from buf to the resource accessed by h.
static void clear_stream_buffers(MMSContext *mms)
int asf_header_size
Size of stored ASF header.
@ SC_PKT_TIMING_TEST_REPLY
unsigned int header_packet_id
default is 2.
@ SC_PKT_PASSWORD_REQUIRED
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
Read as many bytes as possible (up to size), calling the read function multiple times if necessary.
static int send_time_test_data(MMSTContext *mmst)
int avio_put_str16le(AVIOContext *s, const char *str)
Convert an UTF-8 string to UTF-16LE and write it.
#define flags(name, subs,...)
#define AVERROR_INVALIDDATA
Invalid data found when processing input.
#define MKTAG(a, b, c, d)
static int send_startup_packet(MMSTContext *mmst)
Send the initial handshake.
static void insert_command_prefixes(MMSContext *mms, uint32_t prefix1, uint32_t prefix2)
Add prefixes to MMST command packet.
const URLProtocol ff_mmst_protocol
URLContext * mms_hd
TCP connection handle.
uint8_t * read_in_ptr
Pointer for reading from incoming buffer.
@ CS_PKT_STREAM_ID_REQUEST
@ SC_PKT_CANCEL
Pseudo packets.