Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-18 17:10:13 +0400
committerMichael Niedermayer <michaelni@gmx.at>2012-08-18 17:20:32 +0400
commit6c180b35c43f0738d8a3d5c08a01209b51eda569 (patch)
treeb278223305ed9dc4af792f53a376a558ad9155ee /libavformat
parent69fc2489c4059886fcda2de91029b43447330951 (diff)
parent7f9aaa499b8a5ce066cc17aac6ebbdf0111980b6 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: mpegvideo_enc: don't use deprecated avcodec_encode_video(). cmdutils: refactor -codecs option. avconv: make -shortest a per-output file option. lavc: add avcodec_descriptor_get_by_name(). lavc: add const to AVCodec* function parameters. swf(dec): replace CODEC_ID with AV_CODEC_ID dvenc: don't use deprecated AVCODEC_MAX_AUDIO_FRAME_SIZE rtmpdh: Do not generate the same private key every time when using libnettle rtp: remove ff_rtp_get_rtcp_file_handle(). rtsp.c: use ffurl_get_multi_file_handle() instead of ff_rtp_get_rtcp_file_handle() avio: add (ff)url_get_multi_file_handle() for getting more than one fd h264: vdpau: fix crash with unsupported colorspace amrwbdec: Decode the fr_quality bit properly Conflicts: Changelog cmdutils.c cmdutils_common_opts.h doc/ffmpeg.texi ffmpeg.c ffmpeg.h ffmpeg_opt.c libavcodec/h264.c libavcodec/options.c libavcodec/utils.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/avio.c15
-rw-r--r--libavformat/dvenc.c6
-rw-r--r--libavformat/rtmpdh.c10
-rw-r--r--libavformat/rtpdec.h5
-rw-r--r--libavformat/rtpproto.c29
-rw-r--r--libavformat/rtsp.c20
-rw-r--r--libavformat/swf.c6
-rw-r--r--libavformat/swfdec.c12
-rw-r--r--libavformat/url.h9
9 files changed, 81 insertions, 31 deletions
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 9dca8679e3..fc902ff8a2 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -382,6 +382,21 @@ int ffurl_get_file_handle(URLContext *h)
return h->prot->url_get_file_handle(h);
}
+int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles)
+{
+ if (!h->prot->url_get_multi_file_handle) {
+ if (!h->prot->url_get_file_handle)
+ return AVERROR(ENOSYS);
+ *handles = av_malloc(sizeof(*handles));
+ if (!*handles)
+ return AVERROR(ENOMEM);
+ *numhandles = 1;
+ *handles[0] = h->prot->url_get_file_handle(h);
+ return 0;
+ }
+ return h->prot->url_get_multi_file_handle(h, handles, numhandles);
+}
+
int ffurl_shutdown(URLContext *h, int flags)
{
if (!h->prot->url_shutdown)
diff --git a/libavformat/dvenc.c b/libavformat/dvenc.c
index 518ae70ccc..604f4ce833 100644
--- a/libavformat/dvenc.c
+++ b/libavformat/dvenc.c
@@ -41,6 +41,8 @@
#include "libavutil/opt.h"
#include "libavutil/timecode.h"
+#define MAX_AUDIO_FRAME_SIZE 192000 // 1 second of 48khz 32bit audio
+
struct DVMuxContext {
AVClass *av_class;
const DVprofile* sys; /* current DV profile, e.g.: 525/60, 625/50 */
@@ -241,7 +243,7 @@ static int dv_assemble_frame(DVMuxContext *c, AVStream* st,
for (i = 0; i < c->n_ast && st != c->ast[i]; i++);
/* FIXME: we have to have more sensible approach than this one */
- if (av_fifo_size(c->audio_data[i]) + data_size >= 100*AVCODEC_MAX_AUDIO_FRAME_SIZE)
+ if (av_fifo_size(c->audio_data[i]) + data_size >= 100*MAX_AUDIO_FRAME_SIZE)
av_log(st->codec, AV_LOG_ERROR, "Can't process DV frame #%d. Insufficient video data or severe sync problem.\n", c->frames);
av_fifo_generic_write(c->audio_data[i], data, data_size, NULL);
@@ -329,7 +331,7 @@ static DVMuxContext* dv_init_mux(AVFormatContext* s)
c->start_time = ff_iso8601_to_unix_time(t->value);
for (i=0; i < c->n_ast; i++) {
- if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*AVCODEC_MAX_AUDIO_FRAME_SIZE))) {
+ if (c->ast[i] && !(c->audio_data[i]=av_fifo_alloc(100*MAX_AUDIO_FRAME_SIZE))) {
while (i > 0) {
i--;
av_fifo_free(c->audio_data[i]);
diff --git a/libavformat/rtmpdh.c b/libavformat/rtmpdh.c
index 03582eafb9..7d6734daac 100644
--- a/libavformat/rtmpdh.c
+++ b/libavformat/rtmpdh.c
@@ -28,6 +28,7 @@
#include "config.h"
#include "rtmpdh.h"
+#include "libavutil/random_seed.h"
#define P1024 \
"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD1" \
@@ -78,7 +79,14 @@
ret = (mpz_set_str(bn, buf, 16) == 0); \
} while (0)
#define bn_modexp(bn, y, q, p) mpz_powm(bn, y, q, p)
-#define bn_random(bn, num_bytes) mpz_random(bn, num_bytes);
+#define bn_random(bn, num_bytes) \
+ do { \
+ gmp_randstate_t rs; \
+ gmp_randinit_mt(rs); \
+ gmp_randseed_ui(rs, av_get_random_seed()); \
+ mpz_urandomb(bn, rs, num_bytes); \
+ gmp_randclear(rs); \
+ } while (0)
#elif CONFIG_GCRYPT
#define bn_new(bn) bn = gcry_mpi_new(1)
#define bn_free(bn) gcry_mpi_release(bn)
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 907403286f..521b2f5be4 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -71,11 +71,6 @@ void ff_rtp_send_punch_packets(URLContext* rtp_handle);
*/
int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
-/**
- * Get the file handle for the RTCP socket.
- */
-int ff_rtp_get_rtcp_file_handle(URLContext *h);
-
// these statistics are used for rtcp receiver reports...
typedef struct {
uint16_t max_seq; ///< highest sequence number seen
diff --git a/libavformat/rtpproto.c b/libavformat/rtpproto.c
index f140580c7e..17b0f64afb 100644
--- a/libavformat/rtpproto.c
+++ b/libavformat/rtpproto.c
@@ -316,18 +316,27 @@ static int rtp_get_file_handle(URLContext *h)
return s->rtp_fd;
}
-int ff_rtp_get_rtcp_file_handle(URLContext *h) {
+static int rtp_get_multi_file_handle(URLContext *h, int **handles,
+ int *numhandles)
+{
RTPContext *s = h->priv_data;
- return s->rtcp_fd;
+ int *hs = *handles = av_malloc(sizeof(**handles) * 2);
+ if (!hs)
+ return AVERROR(ENOMEM);
+ hs[0] = s->rtp_fd;
+ hs[1] = s->rtcp_fd;
+ *numhandles = 2;
+ return 0;
}
URLProtocol ff_rtp_protocol = {
- .name = "rtp",
- .url_open = rtp_open,
- .url_read = rtp_read,
- .url_write = rtp_write,
- .url_close = rtp_close,
- .url_get_file_handle = rtp_get_file_handle,
- .priv_data_size = sizeof(RTPContext),
- .flags = URL_PROTOCOL_FLAG_NETWORK,
+ .name = "rtp",
+ .url_open = rtp_open,
+ .url_read = rtp_read,
+ .url_write = rtp_write,
+ .url_close = rtp_close,
+ .url_get_file_handle = rtp_get_file_handle,
+ .url_get_multi_file_handle = rtp_get_multi_file_handle,
+ .priv_data_size = sizeof(RTPContext),
+ .flags = URL_PROTOCOL_FLAG_NETWORK,
};
diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index b5e6858e00..35b2724950 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -1690,6 +1690,7 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
int n, i, ret, tcp_fd, timeout_cnt = 0;
int max_p = 0;
struct pollfd *p = rt->p;
+ int *fds = NULL, fdsnum, fdsidx;
for (;;) {
if (ff_check_interrupt(&s->interrupt_callback))
@@ -1707,10 +1708,21 @@ static int udp_read_packet(AVFormatContext *s, RTSPStream **prtsp_st,
for (i = 0; i < rt->nb_rtsp_streams; i++) {
rtsp_st = rt->rtsp_streams[i];
if (rtsp_st->rtp_handle) {
- p[max_p].fd = ffurl_get_file_handle(rtsp_st->rtp_handle);
- p[max_p++].events = POLLIN;
- p[max_p].fd = ff_rtp_get_rtcp_file_handle(rtsp_st->rtp_handle);
- p[max_p++].events = POLLIN;
+ if (ret = ffurl_get_multi_file_handle(rtsp_st->rtp_handle,
+ &fds, &fdsnum)) {
+ av_log(s, AV_LOG_ERROR, "Unable to recover rtp ports\n");
+ return ret;
+ }
+ if (fdsnum != 2) {
+ av_log(s, AV_LOG_ERROR,
+ "Number of fds %d not supported\n", fdsnum);
+ return AVERROR_INVALIDDATA;
+ }
+ for (fdsidx = 0; fdsidx < fdsnum; fdsidx++) {
+ p[max_p].fd = fds[fdsidx];
+ p[max_p++].events = POLLIN;
+ }
+ av_free(fds);
}
}
n = poll(p, max_p, POLL_TIMEOUT_MS);
diff --git a/libavformat/swf.c b/libavformat/swf.c
index d0095077e5..1aa434a0ea 100644
--- a/libavformat/swf.c
+++ b/libavformat/swf.c
@@ -23,7 +23,7 @@
#include "internal.h"
const AVCodecTag ff_swf_codec_tags[] = {
- { CODEC_ID_FLV1, 0x02 },
- { CODEC_ID_VP6F, 0x04 },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_FLV1, 0x02 },
+ { AV_CODEC_ID_VP6F, 0x04 },
+ { AV_CODEC_ID_NONE, 0 },
};
diff --git a/libavformat/swfdec.c b/libavformat/swfdec.c
index 069457f9fd..86ea6dec9e 100644
--- a/libavformat/swfdec.c
+++ b/libavformat/swfdec.c
@@ -24,12 +24,12 @@
#include "swf.h"
static const AVCodecTag swf_audio_codec_tags[] = {
- { CODEC_ID_PCM_S16LE, 0x00 },
- { CODEC_ID_ADPCM_SWF, 0x01 },
- { CODEC_ID_MP3, 0x02 },
- { CODEC_ID_PCM_S16LE, 0x03 },
-// { CODEC_ID_NELLYMOSER, 0x06 },
- { CODEC_ID_NONE, 0 },
+ { AV_CODEC_ID_PCM_S16LE, 0x00 },
+ { AV_CODEC_ID_ADPCM_SWF, 0x01 },
+ { AV_CODEC_ID_MP3, 0x02 },
+ { AV_CODEC_ID_PCM_S16LE, 0x03 },
+// { AV_CODEC_ID_NELLYMOSER, 0x06 },
+ { AV_CODEC_ID_NONE, 0 },
};
static int get_swf_tag(AVIOContext *pb, int *len_ptr)
diff --git a/libavformat/url.h b/libavformat/url.h
index 82f42e8c59..d88ab52705 100644
--- a/libavformat/url.h
+++ b/libavformat/url.h
@@ -81,6 +81,8 @@ typedef struct URLProtocol {
int64_t (*url_read_seek)(URLContext *h, int stream_index,
int64_t timestamp, int flags);
int (*url_get_file_handle)(URLContext *h);
+ int (*url_get_multi_file_handle)(URLContext *h, int **handles,
+ int *numhandles);
int (*url_shutdown)(URLContext *h, int flags);
int priv_data_size;
const AVClass *priv_data_class;
@@ -203,6 +205,13 @@ int64_t ffurl_size(URLContext *h);
int ffurl_get_file_handle(URLContext *h);
/**
+ * Return the file descriptors associated with this URL.
+ *
+ * @return 0 on success or <0 on error.
+ */
+int ffurl_get_multi_file_handle(URLContext *h, int **handles, int *numhandles);
+
+/**
* Signal the URLContext that we are done reading or writing the stream.
*
* @param h pointer to the resource