summaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-03-29 02:46:11 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-03-29 02:46:11 +0200
commit59bf303d6806e1ab0fa415f5313131c9ca7aedb7 (patch)
tree10a2e9e17a6d4a0e499e8236da4acf49d95445aa /libavformat
parent7dfd58ef495f2724cca40cd4a59b1d0c4d81aa28 (diff)
parentc4549bd66a94bec1284dcca0da19e5038a82cbe3 (diff)
downloadffmpeg-streaming-59bf303d6806e1ab0fa415f5313131c9ca7aedb7.zip
ffmpeg-streaming-59bf303d6806e1ab0fa415f5313131c9ca7aedb7.tar.gz
Merge remote-tracking branch 'newdev/master'
* newdev/master: ac3enc: avoid memcpy() of exponents and baps in EXP_REUSE case by using exponent reference blocks. Chronomaster DFA decoder DUPLICATE: framebuffer device demuxer NOT MERGED: cosmetics: fix dashed line length after 070c5d0 http: header field names are case insensitive Conflicts: LICENSE README doc/indevs.texi libavdevice/fbdev.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/Makefile1
-rw-r--r--libavformat/allformats.c1
-rw-r--r--libavformat/dfa.c119
-rw-r--r--libavformat/http.c14
-rw-r--r--libavformat/version.h2
5 files changed, 129 insertions, 8 deletions
diff --git a/libavformat/Makefile b/libavformat/Makefile
index c521cd3..719783c 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -55,6 +55,7 @@ OBJS-$(CONFIG_CDG_DEMUXER) += cdg.o
OBJS-$(CONFIG_CRC_MUXER) += crcenc.o
OBJS-$(CONFIG_DAUD_DEMUXER) += daud.o
OBJS-$(CONFIG_DAUD_MUXER) += daud.o
+OBJS-$(CONFIG_DFA_DEMUXER) += dfa.o
OBJS-$(CONFIG_DIRAC_DEMUXER) += diracdec.o rawdec.o
OBJS-$(CONFIG_DIRAC_MUXER) += rawenc.o
OBJS-$(CONFIG_DNXHD_DEMUXER) += dnxhddec.o rawdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index bca968a..3acaed9 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -75,6 +75,7 @@ void av_register_all(void)
REGISTER_DEMUXER (CDG, cdg);
REGISTER_MUXER (CRC, crc);
REGISTER_MUXDEMUX (DAUD, daud);
+ REGISTER_DEMUXER (DFA, dfa);
REGISTER_MUXDEMUX (DIRAC, dirac);
REGISTER_MUXDEMUX (DNXHD, dnxhd);
REGISTER_DEMUXER (DSICIN, dsicin);
diff --git a/libavformat/dfa.c b/libavformat/dfa.c
new file mode 100644
index 0000000..c1ee55c
--- /dev/null
+++ b/libavformat/dfa.c
@@ -0,0 +1,119 @@
+/*
+ * Chronomaster DFA Format Demuxer
+ * Copyright (c) 2011 Konstantin Shishkov
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavutil/intreadwrite.h"
+#include "avformat.h"
+
+static int dfa_probe(AVProbeData *p)
+{
+ if (p->buf_size < 4 || AV_RL32(p->buf) != MKTAG('D', 'F', 'I', 'A'))
+ return 0;
+
+ return AVPROBE_SCORE_MAX;
+}
+
+static int dfa_read_header(AVFormatContext *s,
+ AVFormatParameters *ap)
+{
+ AVIOContext *pb = s->pb;
+ AVStream *st;
+ int frames;
+ uint32_t mspf;
+
+ if (avio_rl32(pb) != MKTAG('D', 'F', 'I', 'A')) {
+ av_log(s, AV_LOG_ERROR, "Invalid magic for DFA\n");
+ return AVERROR_INVALIDDATA;
+ }
+ avio_skip(pb, 2); // unused
+ frames = avio_rl16(pb);
+
+ st = av_new_stream(s, 0);
+ if (!st)
+ return AVERROR(ENOMEM);
+
+ st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+ st->codec->codec_id = CODEC_ID_DFA;
+ st->codec->width = avio_rl16(pb);
+ st->codec->height = avio_rl16(pb);
+ mspf = avio_rl32(pb);
+ if (!mspf) {
+ av_log(s, AV_LOG_WARNING, "Zero FPS reported, defaulting to 10\n");
+ mspf = 100;
+ }
+ av_set_pts_info(st, 24, mspf, 1000);
+ avio_skip(pb, 128 - 16); // padding
+ st->duration = frames;
+
+ return 0;
+}
+
+static int dfa_read_packet(AVFormatContext *s, AVPacket *pkt)
+{
+ AVIOContext *pb = s->pb;
+ uint32_t frame_size;
+ int ret, first = 1;
+
+ if (pb->eof_reached)
+ return AVERROR_EOF;
+
+ if (av_get_packet(pb, pkt, 12) != 12)
+ return AVERROR(EIO);
+ while (!pb->eof_reached) {
+ if (!first) {
+ ret = av_append_packet(pb, pkt, 12);
+ if (ret < 0) {
+ av_free_packet(pkt);
+ return ret;
+ }
+ } else
+ first = 0;
+ frame_size = AV_RL32(pkt->data + pkt->size - 8);
+ if (frame_size > INT_MAX - 4) {
+ av_log(s, AV_LOG_ERROR, "Too large chunk size: %d\n", frame_size);
+ return AVERROR(EIO);
+ }
+ if (AV_RL32(pkt->data + pkt->size - 12) == MKTAG('E', 'O', 'F', 'R')) {
+ if (frame_size) {
+ av_log(s, AV_LOG_WARNING, "skipping %d bytes of end-of-frame marker chunk\n",
+ frame_size);
+ avio_skip(pb, frame_size);
+ }
+ return 0;
+ }
+ ret = av_append_packet(pb, pkt, frame_size);
+ if (ret < 0) {
+ av_free_packet(pkt);
+ return ret;
+ }
+ }
+
+ return 0;
+}
+
+AVInputFormat ff_dfa_demuxer = {
+ "dfa",
+ NULL_IF_CONFIG_SMALL("Chronomaster DFA"),
+ 0,
+ dfa_probe,
+ dfa_read_header,
+ dfa_read_packet,
+ .flags = AVFMT_GENERIC_INDEX,
+};
diff --git a/libavformat/http.c b/libavformat/http.c
index b3499d1..8c5b943 100644
--- a/libavformat/http.c
+++ b/libavformat/http.c
@@ -246,12 +246,12 @@ static int process_line(URLContext *h, char *line, int line_count,
p++;
while (isspace(*p))
p++;
- if (!strcmp(tag, "Location")) {
+ if (!strcasecmp(tag, "Location")) {
strcpy(s->location, p);
*new_location = 1;
- } else if (!strcmp (tag, "Content-Length") && s->filesize == -1) {
+ } else if (!strcasecmp (tag, "Content-Length") && s->filesize == -1) {
s->filesize = atoll(p);
- } else if (!strcmp (tag, "Content-Range")) {
+ } else if (!strcasecmp (tag, "Content-Range")) {
/* "bytes $from-$to/$document_size" */
const char *slash;
if (!strncmp (p, "bytes ", 6)) {
@@ -261,14 +261,14 @@ static int process_line(URLContext *h, char *line, int line_count,
s->filesize = atoll(slash+1);
}
h->is_streamed = 0; /* we _can_ in fact seek */
- } else if (!strcmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
+ } else if (!strcasecmp (tag, "Transfer-Encoding") && !strncasecmp(p, "chunked", 7)) {
s->filesize = -1;
s->chunksize = 0;
- } else if (!strcmp (tag, "WWW-Authenticate")) {
+ } else if (!strcasecmp (tag, "WWW-Authenticate")) {
ff_http_auth_handle_header(&s->auth_state, tag, p);
- } else if (!strcmp (tag, "Authentication-Info")) {
+ } else if (!strcasecmp (tag, "Authentication-Info")) {
ff_http_auth_handle_header(&s->auth_state, tag, p);
- } else if (!strcmp (tag, "Connection")) {
+ } else if (!strcasecmp (tag, "Connection")) {
if (!strcmp(p, "close"))
s->willclose = 1;
}
diff --git a/libavformat/version.h b/libavformat/version.h
index d03fe12..497779d 100644
--- a/libavformat/version.h
+++ b/libavformat/version.h
@@ -24,7 +24,7 @@
#include "libavutil/avutil.h"
#define LIBAVFORMAT_VERSION_MAJOR 52
-#define LIBAVFORMAT_VERSION_MINOR 103
+#define LIBAVFORMAT_VERSION_MINOR 104
#define LIBAVFORMAT_VERSION_MICRO 0
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
OpenPOWER on IntegriCloud