Commit 9ca27df5 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge remote-tracking branch 'qatar/master'

* qatar/master:
  configure: Check for the math function rint
  TechSmith Screen Codec 2 decoder
  rtsp: Add listen mode
  rtsp: Make rtsp_open_transport_ctx() non-static
  rtsp: Move rtsp_read_close
  rtsp: Parse the mode=receive/record parameter in transport lines

Conflicts:
	Changelog
	libavcodec/avcodec.h
	libavcodec/version.h
	libavformat/version.h
Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents 5f298c67 183b1c22
......@@ -15,6 +15,8 @@ version next:
- join audio filter
- audio channel mapping filter
- Microsoft ATC Screen decoder
- RTSP listen mode
- TechSmith Screen Codec 2 decoder
- showwaves filter
- LucasArts SMUSH playback support
- SAMI demuxer and decoder
......
......@@ -1256,6 +1256,7 @@ HAVE_LIST="
posix_memalign
pthread_cancel
rdtsc
rint
round
roundf
rweflags
......@@ -3288,6 +3289,7 @@ check_mathfunc log2
check_mathfunc log2f
check_mathfunc lrint
check_mathfunc lrintf
check_mathfunc rint
check_mathfunc round
check_mathfunc roundf
check_mathfunc trunc
......
......@@ -642,6 +642,8 @@ following image formats are supported:
@tab fourcc: SP5X
@item TechSmith Screen Capture Codec @tab @tab X
@tab fourcc: TSCC
@item TechSmith Screen Capture Codec 2 @tab @tab X
@tab fourcc: TSC2
@item Theora @tab E @tab X
@tab encoding supported through external library libtheora
@item Tiertex Limited SEQ video @tab @tab X
......
......@@ -377,6 +377,8 @@ Flags for @code{rtsp_flags}:
@table @option
@item filter_src
Accept packets only from negotiated peer address and port.
@item listen
Act as a server, listening for an incoming connection.
@end table
When receiving data over UDP, the demuxer tries to reorder received packets
......@@ -409,6 +411,12 @@ To send a stream in realtime to a RTSP server, for others to watch:
ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
@end example
To receive a stream in realtime:
@example
avconv -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
@end example
@section sap
Session Announcement Protocol (RFC 2974). This is not technically a
......
......@@ -451,6 +451,7 @@ OBJS-$(CONFIG_TRUEMOTION1_DECODER) += truemotion1.o
OBJS-$(CONFIG_TRUEMOTION2_DECODER) += truemotion2.o
OBJS-$(CONFIG_TRUESPEECH_DECODER) += truespeech.o
OBJS-$(CONFIG_TSCC_DECODER) += tscc.o msrledec.o
OBJS-$(CONFIG_TSCC2_DECODER) += tscc2.o
OBJS-$(CONFIG_TTA_DECODER) += tta.o
OBJS-$(CONFIG_TWINVQ_DECODER) += twinvq.o celp_math.o
OBJS-$(CONFIG_TXD_DECODER) += txd.o s3tc.o
......
......@@ -222,6 +222,7 @@ void avcodec_register_all(void)
REGISTER_DECODER (TRUEMOTION1, truemotion1);
REGISTER_DECODER (TRUEMOTION2, truemotion2);
REGISTER_DECODER (TSCC, tscc);
REGISTER_DECODER (TSCC2, tscc2);
REGISTER_DECODER (TXD, txd);
REGISTER_DECODER (ULTI, ulti);
REGISTER_DECODER (UTVIDEO, utvideo);
......
......@@ -259,6 +259,7 @@ enum CodecID {
CODEC_ID_ZEROCODEC,
CODEC_ID_MSS1,
CODEC_ID_MSA1,
CODEC_ID_TSCC2,
CODEC_ID_Y41P = MKBETAG('Y','4','1','P'),
CODEC_ID_ESCAPE130 = MKBETAG('E','1','3','0'),
CODEC_ID_EXR = MKBETAG('0','E','X','R'),
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,7 +27,7 @@
*/
#define LIBAVCODEC_VERSION_MAJOR 54
#define LIBAVCODEC_VERSION_MINOR 33
#define LIBAVCODEC_VERSION_MINOR 34
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
......
......@@ -310,6 +310,7 @@ const AVCodecTag ff_codec_bmp_tags[] = {
{ CODEC_ID_EXR, MKTAG('e', 'x', 'r', ' ') },
{ CODEC_ID_MSS1, MKTAG('M', 'S', 'S', '1') },
{ CODEC_ID_MSA1, MKTAG('M', 'S', 'A', '1') },
{ CODEC_ID_TSCC2, MKTAG('T', 'S', 'C', '2') },
{ CODEC_ID_NONE, 0 }
};
......
......@@ -63,7 +63,8 @@
#define RTSP_FLAG_OPTS(name, longname) \
{ name, longname, OFFSET(rtsp_flags), AV_OPT_TYPE_FLAGS, {0}, INT_MIN, INT_MAX, DEC, "rtsp_flags" }, \
{ "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }
{ "filter_src", "Only receive packets from the negotiated peer IP", 0, AV_OPT_TYPE_CONST, {RTSP_FLAG_FILTER_SRC}, 0, 0, DEC, "rtsp_flags" }, \
{ "listen", "Wait for incoming connections", 0, AV_OPT_TYPE_CONST, {RTSP_FLAG_LISTEN}, 0, 0, DEC, "rtsp_flags" }
#define RTSP_MEDIATYPE_OPTS(name, longname) \
{ name, longname, OFFSET(media_type_mask), AV_OPT_TYPE_FLAGS, { (1 << (AVMEDIA_TYPE_DATA+1)) - 1 }, INT_MIN, INT_MAX, DEC, "allowed_media_types" }, \
......@@ -83,6 +84,7 @@ const AVOption ff_rtsp_options[] = {
RTSP_MEDIATYPE_OPTS("allowed_media_types", "Media types to accept from the server"),
{ "min_port", "Minimum local UDP port", OFFSET(rtp_port_min), AV_OPT_TYPE_INT, {RTSP_RTP_PORT_MIN}, 0, 65535, DEC|ENC },
{ "max_port", "Maximum local UDP port", OFFSET(rtp_port_max), AV_OPT_TYPE_INT, {RTSP_RTP_PORT_MAX}, 0, 65535, DEC|ENC },
{ "timeout", "Maximum timeout (in seconds) to wait for incoming connections. -1 is infinite. Implies flag listen", OFFSET(initial_timeout), AV_OPT_TYPE_INT, {-1}, INT_MIN, INT_MAX, DEC },
{ NULL },
};
......@@ -595,7 +597,7 @@ void ff_rtsp_close_streams(AVFormatContext *s)
av_free(rt->recvbuf);
}
static int rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
int ff_rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
{
RTSPState *rt = s->priv_data;
AVStream *st = NULL;
......@@ -749,6 +751,14 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, const char *p)
get_word_sep(buf, sizeof(buf), ";,", &p);
av_strlcpy(th->source, buf, sizeof(th->source));
}
} else if (!strcmp(parameter, "mode")) {
if (*p == '=') {
p++;
get_word_sep(buf, sizeof(buf), ";, ", &p);
if (!strcmp(buf, "record") ||
!strcmp(buf, "receive"))
th->mode_record = 1;
}
}
while (*p != ';' && *p != '\0' && *p != ',')
......@@ -1389,7 +1399,7 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
}
}
if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
......@@ -1701,14 +1711,24 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
}
#if CONFIG_RTSP_DEMUXER
if (tcp_fd != -1 && p[0].revents & POLLIN) {
RTSPMessageHeader reply;
ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL);
if (ret < 0)
return ret;
/* XXX: parse message */
if (rt->state != RTSP_STATE_STREAMING)
return 0;
if (rt->rtsp_flags & RTSP_FLAG_LISTEN) {
if (rt->state == RTSP_STATE_STREAMING) {
if (!ff_rtsp_parse_streaming_commands(s))
return AVERROR_EOF;
else
av_log(s, AV_LOG_WARNING,
"Unable to answer to TEARDOWN\n");
} else
return 0;
} else {
RTSPMessageHeader reply;
ret = ff_rtsp_read_reply(s, &reply, NULL, 0, NULL);
if (ret < 0)
return ret;
/* XXX: parse message */
if (rt->state != RTSP_STATE_STREAMING)
return 0;
}
}
#endif
} else if (n == 0 && ++timeout_cnt >= MAX_TIMEOUTS) {
......@@ -1912,7 +1932,7 @@ static int sdp_read_header(AVFormatContext *s)
err = AVERROR_INVALIDDATA;
goto fail;
}
if ((err = rtsp_open_transport_ctx(s, rtsp_st)))
if ((err = ff_rtsp_open_transport_ctx(s, rtsp_st)))
goto fail;
}
return 0;
......
......@@ -102,6 +102,9 @@ typedef struct RTSPTransportField {
* packets will be allowed to make before being discarded. */
int ttl;
/** transport set to record data */
int mode_record;
struct sockaddr_storage destination; /**< destination IP address */
char source[INET6_ADDRSTRLEN + 1]; /**< source IP address */
......@@ -369,11 +372,17 @@ typedef struct RTSPState {
* Minimum and maximum local UDP ports.
*/
int rtp_port_min, rtp_port_max;
/**
* Timeout to wait for incoming connections.
*/
int initial_timeout;
} RTSPState;
#define RTSP_FLAG_FILTER_SRC 0x1 /**< Filter incoming UDP packets -
receive packets only from the right
source address and port. */
#define RTSP_FLAG_LISTEN 0x2 /**< Wait for incoming connections. */
/**
* Describe a single stream, as identified by a single m= line block in the
......@@ -525,6 +534,12 @@ int ff_rtsp_setup_input_streams(AVFormatContext *s, RTSPMessageHeader *reply);
*/
int ff_rtsp_setup_output_streams(AVFormatContext *s, const char *addr);
/**
* Parse RTSP commands (OPTIONS, PAUSE and TEARDOWN) during streaming in
* listen mode.
*/
int ff_rtsp_parse_streaming_commands(AVFormatContext *s);
/**
* Parse an SDP description of streams by populating an RTSPState struct
* within the AVFormatContext; also allocate the RTP streams and the
......@@ -558,6 +573,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
*/
void ff_rtsp_undo_setup(AVFormatContext *s);
/**
* Open RTSP transport context.
*/
int ff_rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st);
extern const AVOption ff_rtsp_options[];
#endif /* AVFORMAT_RTSP_H */
......@@ -37,4 +37,18 @@ RTSP_STATUS_SERVICE =503, /**< Service Unavailable */
RTSP_STATUS_VERSION =505, /**< RTSP Version not supported */
};
enum RTSPMethod {
DESCRIBE,
ANNOUNCE,
OPTIONS,
SETUP,
PLAY,
PAUSE,
TEARDOWN,
GET_PARAMETER,
SET_PARAMETER,
REDIRECT,
RECORD,
UNKNOWN = -1,
};
#endif /* AVFORMAT_RTSPCODES_H */
This diff is collapsed.
......@@ -30,7 +30,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 54
#define LIBAVFORMAT_VERSION_MINOR 15
#define LIBAVFORMAT_VERSION_MINOR 16
#define LIBAVFORMAT_VERSION_MICRO 104
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
......
......@@ -90,6 +90,13 @@ static av_always_inline av_const int isnan(float x)
#define log2f(x) ((float)log2(x))
#endif /* HAVE_LOG2F */
#if !HAVE_RINT
static inline double rint(double x)
{
return x >= 0 ? floor(x + 0.5) : ceil(x - 0.5);
}
#endif /* HAVE_RINT */
#if !HAVE_LRINT
static av_always_inline av_const long int lrint(double x)
{
......
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