Permalink
Browse files

Merge remote branch 'qatar/master'

* qatar/master:
  proto: include os_support.h in network.h
  matroskaenc: don't write an empty Cues element.
  lavc: add a FF_API_REQUEST_CHANNELS deprecation macro
  avio: move extern url_interrupt_cb declaration from avio.h to url.h
  avio: make av_register_protocol2 internal.
  avio: avio_ prefix for url_set_interrupt_cb.
  avio: AVIO_ prefixes for URL_ open flags.
  proto: introduce listen option in tcp
  doc: clarify configure features
  proto: factor ff_network_wait_fd and use it on udp

Conflicts:
	ffmpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
  • Loading branch information...
2 parents db95e55 + a203125 commit c88caa522c41cd4108d39d8dd98805e867606ae3 @michaelni michaelni committed Apr 8, 2011
View
@@ -9,3 +9,7 @@ path when launching 'configure', e.g. '/ffmpegdir/ffmpeg/configure'.
2) Then type 'make' to build FFmpeg. GNU Make 3.81 or later is required.
3) Type 'make install' to install all binaries and libraries you built.
+
+NOTICE
+
+ - Non system dependencies (e.g. libx264, libvpx) are disabled by default.
View
@@ -402,6 +402,23 @@ ffplay sap://[ff0e::2:7ffe]
Trasmission Control Protocol.
+The required syntax for a TCP url is:
+@example
+tcp://@var{hostname}:@var{port}[?@var{options}]
+@end example
+
+@table @option
+
+@item listen
+Listen for an incoming connection
+
+@example
+ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
+ffplay tcp://@var{hostname}:@var{port}
+@end example
+
+@end table
+
@section udp
User Datagram Protocol.
View
@@ -2569,7 +2569,7 @@ static int transcode(AVFormatContext **output_files,
if (!using_stdin) {
if(verbose >= 0)
fprintf(stderr, "Press [q] to stop encoding\n");
- url_set_interrupt_cb(decode_interrupt_cb);
+ avio_set_interrupt_cb(decode_interrupt_cb);
}
term_init();
@@ -3887,7 +3887,7 @@ static void opt_output_file(const char *filename)
}
/* open the file */
- if ((err = avio_open(&oc->pb, filename, URL_WRONLY)) < 0) {
+ if ((err = avio_open(&oc->pb, filename, AVIO_WRONLY)) < 0) {
print_error(filename, err);
ffmpeg_exit(1);
}
@@ -4426,7 +4426,7 @@ int main(int argc, char **argv)
#if HAVE_ISATTY
if(isatty(STDIN_FILENO))
- url_set_interrupt_cb(decode_interrupt_cb);
+ avio_set_interrupt_cb(decode_interrupt_cb);
#endif
init_opts();
View
@@ -2406,7 +2406,7 @@ static int decode_thread(void *arg)
is->subtitle_stream = -1;
global_video_state = is;
- url_set_interrupt_cb(decode_interrupt_cb);
+ avio_set_interrupt_cb(decode_interrupt_cb);
memset(ap, 0, sizeof(*ap));
@@ -2626,7 +2626,7 @@ static int decode_thread(void *arg)
av_close_input_file(is->ic);
is->ic = NULL; /* safety */
}
- url_set_interrupt_cb(NULL);
+ avio_set_interrupt_cb(NULL);
if (ret != 0) {
SDL_Event event;
View
@@ -3427,7 +3427,7 @@ static int rtp_new_av_stream(HTTPContext *c,
"rtp://%s:%d", ipaddr, ntohs(dest_addr->sin_port));
}
- if (url_open(&h, ctx->filename, URL_WRONLY) < 0)
+ if (url_open(&h, ctx->filename, AVIO_WRONLY) < 0)
goto fail;
c->rtp_handles[stream_index] = h;
max_packet_size = url_get_max_packet_size(h);
@@ -3767,7 +3767,7 @@ static void build_feed_streams(void)
}
/* only write the header of the ffm file */
- if (avio_open(&s->pb, feed->feed_filename, URL_WRONLY) < 0) {
+ if (avio_open(&s->pb, feed->feed_filename, AVIO_WRONLY) < 0) {
http_log("Could not open output feed file '%s'\n",
feed->feed_filename);
exit(1);
View
@@ -2601,7 +2601,7 @@ typedef struct AVCodecContext {
*/
int64_t timecode_frame_start;
-#if LIBAVCODEC_VERSION_MAJOR < 53
+#if FF_API_REQUEST_CHANNELS
/**
* Decoder should decode to this many channels if it can (0 for default)
* - encoding: unused
View
@@ -408,7 +408,9 @@ static const AVOption options[]={
{"timecode_frame_start", "GOP timecode frame start number, in non drop frame format", OFFSET(timecode_frame_start), FF_OPT_TYPE_INT64, 0, 0, INT64_MAX, V|E},
{"drop_frame_timecode", NULL, 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_DROP_FRAME_TIMECODE, INT_MIN, INT_MAX, V|E, "flags2"},
{"non_linear_q", "use non linear quantizer", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_NON_LINEAR_QUANT, INT_MIN, INT_MAX, V|E, "flags2"},
+#if FF_API_REQUEST_CHANNELS
{"request_channels", "set desired number of audio channels", OFFSET(request_channels), FF_OPT_TYPE_INT, DEFAULT, 0, INT_MAX, A|D},
+#endif
{"drc_scale", "percentage of dynamic range compression to apply", OFFSET(drc_scale), FF_OPT_TYPE_FLOAT, 1.0, 0.0, 1.0, A|D},
{"reservoir", "use bit reservoir", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_BIT_RESERVOIR, INT_MIN, INT_MAX, A|E, "flags2"},
{"mbtree", "use macroblock tree ratecontrol (x264 only)", 0, FF_OPT_TYPE_CONST, CODEC_FLAG2_MBTREE, INT_MIN, INT_MAX, V|E, "flags2"},
View
@@ -83,5 +83,8 @@
#ifndef FF_API_ANTIALIAS_ALGO
#define FF_API_ANTIALIAS_ALGO (LIBAVCODEC_VERSION_MAJOR < 54)
#endif
+#ifndef FF_API_REQUEST_CHANNELS
+#define FF_API_REQUEST_CHANNELS (LIBAVCODEC_VERSION_MAJOR < 53)
+#endif
#endif /* AVCODEC_VERSION_H */
View
@@ -21,6 +21,7 @@
#include "avformat.h"
#include "rtp.h"
#include "rdt.h"
+#include "url.h"
#define REGISTER_MUXER(X,x) { \
extern AVOutputFormat ff_##x##_muxer; \
@@ -34,7 +35,7 @@
#define REGISTER_PROTOCOL(X,x) { \
extern URLProtocol ff_##x##_protocol; \
- if(CONFIG_##X##_PROTOCOL) av_register_protocol2(&ff_##x##_protocol, sizeof(ff_##x##_protocol)); }
+ if(CONFIG_##X##_PROTOCOL) ffurl_register_protocol(&ff_##x##_protocol, sizeof(ff_##x##_protocol)); }
void av_register_all(void)
{
View
@@ -31,6 +31,7 @@
#include "internal.h"
#include <unistd.h>
#include "avio_internal.h"
+#include "url.h"
#define INITIAL_BUFFER_SIZE 32768
@@ -169,7 +170,7 @@ static int parse_playlist(AppleHTTPContext *c, const char *url,
if (!in) {
close_in = 1;
- if ((ret = avio_open(&in, url, URL_RDONLY)) < 0)
+ if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
return ret;
}
@@ -292,7 +293,7 @@ static int read_data(void *opaque, uint8_t *buf, int buf_size)
ret = url_open(&v->input,
v->segments[v->cur_seq_no - v->start_seq_no]->url,
- URL_RDONLY);
+ AVIO_RDONLY);
if (ret < 0)
return ret;
}
@@ -115,7 +115,7 @@ static int parse_playlist(URLContext *h, const char *url)
char line[1024];
const char *ptr;
- if ((ret = avio_open(&in, url, URL_RDONLY)) < 0)
+ if ((ret = avio_open(&in, url, AVIO_RDONLY)) < 0)
return ret;
read_chomp_line(in, line, sizeof(line));
@@ -180,7 +180,7 @@ static int applehttp_open(URLContext *h, const char *uri, int flags)
int ret, i;
const char *nested_url;
- if (flags & (URL_WRONLY | URL_RDWR))
+ if (flags & (AVIO_WRONLY | AVIO_RDWR))
return AVERROR(ENOSYS);
s = av_mallocz(sizeof(AppleHTTPContext));
@@ -275,7 +275,7 @@ static int applehttp_read(URLContext *h, uint8_t *buf, int size)
}
url = s->segments[s->cur_seq_no - s->start_seq_no]->url,
av_log(NULL, AV_LOG_DEBUG, "opening %s\n", url);
- ret = ffurl_open(&s->seg_hd, url, URL_RDONLY);
+ ret = ffurl_open(&s->seg_hd, url, AVIO_RDONLY);
if (ret < 0) {
if (url_interrupt_cb())
return AVERROR_EXIT;
View
@@ -57,7 +57,7 @@ URLProtocol *av_protocol_next(URLProtocol *p)
else return first_protocol;
}
-int av_register_protocol2(URLProtocol *protocol, int size)
+int ffurl_register_protocol(URLProtocol *protocol, int size)
{
URLProtocol **p;
if (size < sizeof(URLProtocol)) {
@@ -86,12 +86,12 @@ struct URLProtocol_compat {
int av_register_protocol(URLProtocol *protocol)
{
- return av_register_protocol2(protocol, sizeof(struct URLProtocol_compat));
+ return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
}
int register_protocol(URLProtocol *protocol)
{
- return av_register_protocol2(protocol, sizeof(struct URLProtocol_compat));
+ return ffurl_register_protocol(protocol, sizeof(struct URLProtocol_compat));
}
#endif
@@ -144,7 +144,7 @@ int ffurl_connect(URLContext* uc)
return err;
uc->is_connected = 1;
//We must be careful here as ffurl_seek() could be slow, for example for http
- if( (uc->flags & (URL_WRONLY | URL_RDWR))
+ if( (uc->flags & (AVIO_WRONLY | AVIO_RDWR))
|| !strcmp(uc->prot->name, "file"))
if(!uc->is_streamed && ffurl_seek(uc, 0, SEEK_SET) < 0)
uc->is_streamed= 1;
@@ -216,6 +216,14 @@ void url_get_filename(URLContext *h, char *buf, int buf_size)
{
av_strlcpy(buf, h->filename, buf_size);
}
+void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+{
+ avio_set_interrupt_cb(interrupt_cb);
+}
+int av_register_protocol2(URLProtocol *protocol, int size)
+{
+ return ffurl_register_protocol(protocol, size);
+}
#endif
#define URL_SCHEME_CHARS \
@@ -275,7 +283,7 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
ret = transfer_func(h, buf+len, size-len);
if (ret == AVERROR(EINTR))
continue;
- if (h->flags & URL_FLAG_NONBLOCK)
+ if (h->flags & AVIO_FLAG_NONBLOCK)
return ret;
if (ret == AVERROR(EAGAIN)) {
ret = 0;
@@ -296,21 +304,21 @@ static inline int retry_transfer_wrapper(URLContext *h, unsigned char *buf, int
int ffurl_read(URLContext *h, unsigned char *buf, int size)
{
- if (h->flags & URL_WRONLY)
+ if (h->flags & AVIO_WRONLY)
return AVERROR(EIO);
return retry_transfer_wrapper(h, buf, size, 1, h->prot->url_read);
}
int ffurl_read_complete(URLContext *h, unsigned char *buf, int size)
{
- if (h->flags & URL_WRONLY)
+ if (h->flags & AVIO_WRONLY)
return AVERROR(EIO);
return retry_transfer_wrapper(h, buf, size, size, h->prot->url_read);
}
int ffurl_write(URLContext *h, const unsigned char *buf, int size)
{
- if (!(h->flags & (URL_WRONLY | URL_RDWR)))
+ if (!(h->flags & (AVIO_WRONLY | AVIO_RDWR)))
return AVERROR(EIO);
/* avoid sending too big packets */
if (h->max_packet_size && size > h->max_packet_size)
@@ -348,7 +356,7 @@ int ffurl_close(URLContext *h)
int url_exist(const char *filename)
{
URLContext *h;
- if (ffurl_open(&h, filename, URL_RDONLY) < 0)
+ if (ffurl_open(&h, filename, AVIO_RDONLY) < 0)
return 0;
ffurl_close(h);
return 1;
@@ -381,7 +389,7 @@ static int default_interrupt_cb(void)
return 0;
}
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb)
+void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb)
{
if (!interrupt_cb)
interrupt_cb = default_interrupt_cb;
View
@@ -63,7 +63,6 @@ typedef struct URLPollEntry {
int events;
int revents;
} URLPollEntry;
-#endif
/**
* @defgroup open_modes URL open modes
@@ -91,6 +90,7 @@ typedef struct URLPollEntry {
* silently ignored.
*/
#define URL_FLAG_NONBLOCK 4
+#endif
typedef int URLInterruptCB(void);
@@ -117,6 +117,7 @@ attribute_deprecated void url_get_filename(URLContext *h, char *buf, int buf_siz
attribute_deprecated int av_url_read_pause(URLContext *h, int pause);
attribute_deprecated int64_t av_url_read_seek(URLContext *h, int stream_index,
int64_t timestamp, int flags);
+attribute_deprecated void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
#endif
/**
@@ -131,7 +132,7 @@ int url_exist(const char *url);
* in this case by the interrupted function. 'NULL' means no interrupt
* callback is given.
*/
-void url_set_interrupt_cb(URLInterruptCB *interrupt_cb);
+void avio_set_interrupt_cb(URLInterruptCB *interrupt_cb);
#if FF_API_OLD_AVIO
/* not implemented */
@@ -162,7 +163,9 @@ typedef struct URLProtocol {
extern URLProtocol *first_protocol;
#endif
+#if FF_API_OLD_AVIO
extern URLInterruptCB *url_interrupt_cb;
+#endif
/**
* If protocol is NULL, returns the first registered protocol,
@@ -183,12 +186,14 @@ attribute_deprecated int register_protocol(URLProtocol *protocol);
attribute_deprecated int av_register_protocol(URLProtocol *protocol);
#endif
+#if FF_API_OLD_AVIO
/**
* Register the URLProtocol protocol.
*
* @param size the size of the URLProtocol struct referenced
*/
-int av_register_protocol2(URLProtocol *protocol, int size);
+attribute_deprecated int av_register_protocol2(URLProtocol *protocol, int size);
+#endif
#define AVIO_SEEKABLE_NORMAL 0x0001 /**< Seeking works like for a local file */
@@ -511,6 +516,33 @@ int url_resetbuf(AVIOContext *s, int flags);
#endif
/**
+ * @defgroup open_modes URL open modes
+ * The flags argument to avio_open must be one of the following
+ * constants, optionally ORed with other flags.
+ * @{
+ */
+#define AVIO_RDONLY 0 /**< read-only */
+#define AVIO_WRONLY 1 /**< write-only */
+#define AVIO_RDWR 2 /**< read-write */
+/**
+ * @}
+ */
+
+/**
+ * Use non-blocking mode.
+ * If this flag is set, operations on the context will return
+ * AVERROR(EAGAIN) if they can not be performed immediately.
+ * If this flag is not set, operations on the context will never return
+ * AVERROR(EAGAIN).
+ * Note that this flag does not affect the opening/connecting of the
+ * context. Connecting a protocol will always block if necessary (e.g. on
+ * network protocols) but never hang (e.g. on busy devices).
+ * Warning: non-blocking protocols is work-in-progress; this flag may be
+ * silently ignored.
+ */
+#define AVIO_FLAG_NONBLOCK 4
+
+/**
* Create and initialize a AVIOContext for accessing the
* resource indicated by url.
* @note When the resource indicated by url has been opened in
Oops, something went wrong.

0 comments on commit c88caa5

Please sign in to comment.