summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-05-13 04:40:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-05-13 04:40:40 +0200
commit72153419b52c96b1ed4a1bfb7e7793ddde7d71b2 (patch)
tree2e5b40aecf44ad40dd0d6bf122fd8918a889805e /libavformat
parent410ca3bc2d5e95078f3d6698a2f9e53c2fd24f95 (diff)
parent552a99957f7c6f6ed13795caee7ab7b9deb5d76e (diff)
Merge remote branch 'qatar/master'
* qatar/master: (33 commits) rtpdec_qdm2: Don't try to parse data packet if no configuration is received ac3enc: put the counting of stereo rematrixing bits in the same place to make the code easier to understand. ac3enc: clean up count_frame_bits() and count_frame_bits_fixed() mpegvideo: make FF_DEBUG_DCT_COEFF output coeffs via av_log() instead of just via AVFrame. srtdec: make sure we don't write past the end of buffer wmaenc: improve channel count and bitrate error handling in encode_init() matroskaenc: make sure we don't produce invalid file with no codec ID matroskadec: check that pointers were initialized before accessing them lavf: fix function name in compute_pkt_fields2 av_dlog message lavf: fix av_find_best_stream when providing a wanted stream. lavf: fix av_find_best_stream when decoder_ret is given and using a related stream. ffmpeg: factorize quality calculation tiff: add support for SamplesPerPixel tag in tiff_decode_tag() tiff: Prefer enum TiffCompr over int for TiffContext.compr. mov: Support edit list atom version 1. configure: Enable libpostproc automatically if GPL code is enabled. Cosmetics: fix prototypes in oggdec oggdec: fix memleak with continuous streams. matroskaenc: add missing new line in av_log() call dnxhdenc: add AVClass in private context. ... swscale changes largely rewritten by me or replaced by baptsites due to lots of bugs in ronalds code. Above code is also just in case its not obvios to a large extended duplicates that where cherry picked from ffmpeg. Conflicts: configure ffmpeg.c libavformat/matroskaenc.c libavutil/pixfmt.h libswscale/ppc/swscale_template.c libswscale/swscale.c libswscale/swscale_template.c libswscale/utils.c libswscale/x86/swscale_template.c tests/fate/h264.mak tests/ref/lavfi/pixdesc_le tests/ref/lavfi/pixfmts_copy_le tests/ref/lavfi/pixfmts_null_le tests/ref/lavfi/pixfmts_scale_le tests/ref/lavfi/pixfmts_vflip_le Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/applehttp.c1
-rw-r--r--libavformat/applehttpproto.c1
-rw-r--r--libavformat/avio.c3
-rw-r--r--libavformat/isom.h2
-rw-r--r--libavformat/matroskaenc.c2
-rw-r--r--libavformat/mov.c16
-rw-r--r--libavformat/oggdec.c94
-rw-r--r--libavformat/os_support.c1
-rw-r--r--libavformat/rtpdec.c3
-rw-r--r--libavformat/rtpdec_qdm2.c2
-rw-r--r--libavformat/udp.c2
11 files changed, 57 insertions, 70 deletions
diff --git a/libavformat/applehttp.c b/libavformat/applehttp.c
index 4429ad0199..34123d730d 100644
--- a/libavformat/applehttp.c
+++ b/libavformat/applehttp.c
@@ -25,7 +25,6 @@
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
-#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
diff --git a/libavformat/applehttpproto.c b/libavformat/applehttpproto.c
index 3a4d4b8100..bb5029d82f 100644
--- a/libavformat/applehttpproto.c
+++ b/libavformat/applehttpproto.c
@@ -25,7 +25,6 @@
* http://tools.ietf.org/html/draft-pantos-http-live-streaming
*/
-#define _XOPEN_SOURCE 600
#include "libavutil/avstring.h"
#include "avformat.h"
#include "internal.h"
diff --git a/libavformat/avio.c b/libavformat/avio.c
index 8655c13957..972c5334f3 100644
--- a/libavformat/avio.c
+++ b/libavformat/avio.c
@@ -19,9 +19,8 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* needed for usleep() */
-#define _XOPEN_SOURCE 600
#include <unistd.h>
+
#include "libavutil/avstring.h"
#include "libavutil/opt.h"
#include "os_support.h"
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 081d2279ba..99de0c860a 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -109,7 +109,7 @@ typedef struct MOVStreamContext {
unsigned int keyframe_count;
int *keyframes;
int time_scale;
- int time_offset; ///< time offset of the first edit list entry
+ int64_t time_offset; ///< time offset of the first edit list entry
int current_sample;
unsigned int bytes_per_frame;
unsigned int samples_per_frame;
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 72631c7686..387cead8cd 100644
--- a/libavformat/matroskaenc.c
+++ b/libavformat/matroskaenc.c
@@ -616,7 +616,7 @@ static int mkv_write_tracks(AVFormatContext *s)
put_ebml_uint(pb, MATROSKA_ID_TRACKTYPE, MATROSKA_TRACK_TYPE_SUBTITLE);
if (!native_id) {
av_log(s, AV_LOG_ERROR, "Subtitle codec %d is not supported.\n", codec->codec_id);
- return AVERROR(EINVAL);
+ return AVERROR(ENOSYS);
}
break;
default:
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 6e29ceaa00..745768f3b9 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2166,13 +2166,13 @@ free_and_return:
static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
MOVStreamContext *sc;
- int i, edit_count;
+ int i, edit_count, version;
if (c->fc->nb_streams < 1)
return 0;
sc = c->fc->streams[c->fc->nb_streams-1]->priv_data;
- avio_r8(pb); /* version */
+ version = avio_r8(pb); /* version */
avio_rb24(pb); /* flags */
edit_count = avio_rb32(pb); /* entries */
@@ -2180,9 +2180,15 @@ static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom)
return -1;
for(i=0; i<edit_count; i++){
- int time;
- int duration = avio_rb32(pb); /* Track duration */
- time = avio_rb32(pb); /* Media time */
+ int64_t time;
+ int64_t duration;
+ if (version == 1) {
+ duration = avio_rb64(pb);
+ time = avio_rb64(pb);
+ } else {
+ duration = avio_rb32(pb); /* segment duration */
+ time = avio_rb32(pb); /* media time */
+ }
avio_rb32(pb); /* Media rate */
if (i == 0 && time >= -1) {
sc->time_offset = time != -1 ? time : -duration;
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index b9ac3d9f0e..c799ce5205 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -56,8 +56,7 @@ static const struct ogg_codec * const ogg_codecs[] = {
};
//FIXME We could avoid some structure duplication
-static int
-ogg_save (AVFormatContext * s)
+static int ogg_save(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
struct ogg_state *ost =
@@ -81,8 +80,7 @@ ogg_save (AVFormatContext * s)
return 0;
}
-static int
-ogg_restore (AVFormatContext * s, int discard)
+static int ogg_restore(AVFormatContext *s, int discard)
{
struct ogg *ogg = s->priv_data;
AVIOContext *bc = s->pb;
@@ -110,8 +108,7 @@ ogg_restore (AVFormatContext * s, int discard)
return 0;
}
-static int
-ogg_reset (struct ogg * ogg)
+static int ogg_reset(struct ogg *ogg)
{
int i;
@@ -135,8 +132,7 @@ ogg_reset (struct ogg * ogg)
return 0;
}
-static const struct ogg_codec *
-ogg_find_codec (uint8_t * buf, int size)
+static const struct ogg_codec *ogg_find_codec(uint8_t *buf, int size)
{
int i;
@@ -148,8 +144,7 @@ ogg_find_codec (uint8_t * buf, int size)
return NULL;
}
-static int
-ogg_new_stream (AVFormatContext * s, uint32_t serial)
+static int ogg_new_stream(AVFormatContext *s, uint32_t serial, int new_avstream)
{
struct ogg *ogg = s->priv_data;
@@ -166,17 +161,18 @@ ogg_new_stream (AVFormatContext * s, uint32_t serial)
os->buf = av_malloc(os->bufsize);
os->header = -1;
- st = av_new_stream (s, idx);
- if (!st)
- return AVERROR(ENOMEM);
+ if (new_avstream) {
+ st = av_new_stream(s, idx);
+ if (!st)
+ return AVERROR(ENOMEM);
- av_set_pts_info(st, 64, 1, 1000000);
+ av_set_pts_info(st, 64, 1, 1000000);
+ }
return idx;
}
-static int
-ogg_new_buf(struct ogg *ogg, int idx)
+static int ogg_new_buf(struct ogg *ogg, int idx)
{
struct ogg_stream *os = ogg->streams + idx;
uint8_t *nb = av_malloc(os->bufsize);
@@ -192,8 +188,7 @@ ogg_new_buf(struct ogg *ogg, int idx)
return 0;
}
-static int
-ogg_read_page (AVFormatContext * s, int *str)
+static int ogg_read_page(AVFormatContext *s, int *str)
{
AVIOContext *bc = s->pb;
struct ogg *ogg = s->priv_data;
@@ -251,8 +246,10 @@ ogg_read_page (AVFormatContext * s, int *str)
}
ogg->curidx = -1;
ogg->nstreams = 0;
+ idx = ogg_new_stream(s, serial, 0);
+ } else {
+ idx = ogg_new_stream(s, serial, 1);
}
- idx = ogg_new_stream (s, serial);
if (idx < 0)
return -1;
}
@@ -308,8 +305,8 @@ ogg_read_page (AVFormatContext * s, int *str)
return 0;
}
-static int
-ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpos)
+static int ogg_packet(AVFormatContext *s, int *str, int *dstart, int *dsize,
+ int64_t *fpos)
{
struct ogg *ogg = s->priv_data;
int idx, i;
@@ -439,8 +436,7 @@ ogg_packet (AVFormatContext * s, int *str, int *dstart, int *dsize, int64_t *fpo
return 0;
}
-static int
-ogg_get_headers (AVFormatContext * s)
+static int ogg_get_headers(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
@@ -456,8 +452,7 @@ ogg_get_headers (AVFormatContext * s)
return 0;
}
-static int
-ogg_get_length (AVFormatContext * s)
+static int ogg_get_length(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
int i;
@@ -505,9 +500,7 @@ ogg_get_length (AVFormatContext * s)
return 0;
}
-
-static int
-ogg_read_header (AVFormatContext * s, AVFormatParameters * ap)
+static int ogg_read_header(AVFormatContext *s, AVFormatParameters *ap)
{
struct ogg *ogg = s->priv_data;
int i;
@@ -558,8 +551,7 @@ static int64_t ogg_calc_pts(AVFormatContext *s, int idx, int64_t *dts)
return pts;
}
-static int
-ogg_read_packet (AVFormatContext * s, AVPacket * pkt)
+static int ogg_read_packet(AVFormatContext *s, AVPacket *pkt)
{
struct ogg *ogg;
struct ogg_stream *os;
@@ -599,9 +591,7 @@ retry:
return psize;
}
-
-static int
-ogg_read_close (AVFormatContext * s)
+static int ogg_read_close(AVFormatContext *s)
{
struct ogg *ogg = s->priv_data;
int i;
@@ -614,10 +604,8 @@ ogg_read_close (AVFormatContext * s)
return 0;
}
-
-static int64_t
-ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
- int64_t pos_limit)
+static int64_t ogg_read_timestamp(AVFormatContext *s, int stream_index,
+ int64_t *pos_arg, int64_t pos_limit)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + stream_index;
@@ -640,7 +628,8 @@ ogg_read_timestamp (AVFormatContext * s, int stream_index, int64_t * pos_arg,
return pts;
}
-static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags)
+static int ogg_read_seek(AVFormatContext *s, int stream_index,
+ int64_t timestamp, int flags)
{
struct ogg *ogg = s->priv_data;
struct ogg_stream *os = ogg->streams + stream_index;
@@ -660,24 +649,21 @@ static int ogg_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp
static int ogg_probe(AVProbeData *p)
{
- if (p->buf[0] == 'O' && p->buf[1] == 'g' &&
- p->buf[2] == 'g' && p->buf[3] == 'S' &&
- p->buf[4] == 0x0 && p->buf[5] <= 0x7 )
+ if (!memcmp("OggS", p->buf, 5) && p->buf[5] <= 0x7)
return AVPROBE_SCORE_MAX;
- else
- return 0;
+ return 0;
}
AVInputFormat ff_ogg_demuxer = {
- "ogg",
- NULL_IF_CONFIG_SMALL("Ogg"),
- sizeof (struct ogg),
- ogg_probe,
- ogg_read_header,
- ogg_read_packet,
- ogg_read_close,
- ogg_read_seek,
- ogg_read_timestamp,
- .extensions = "ogg",
- .flags = AVFMT_GENERIC_INDEX,
+ .name = "ogg",
+ .long_name = NULL_IF_CONFIG_SMALL("Ogg"),
+ .priv_data_size = sizeof(struct ogg),
+ .read_probe = ogg_probe,
+ .read_header = ogg_read_header,
+ .read_packet = ogg_read_packet,
+ .read_close = ogg_read_close,
+ .read_seek = ogg_read_seek,
+ .read_timestamp = ogg_read_timestamp,
+ .extensions = "ogg",
+ .flags = AVFMT_GENERIC_INDEX,
};
diff --git a/libavformat/os_support.c b/libavformat/os_support.c
index 8afa628515..ac9086c3c3 100644
--- a/libavformat/os_support.c
+++ b/libavformat/os_support.c
@@ -22,7 +22,6 @@
/* needed by inet_aton() */
#define _SVID_SOURCE
-#define _DARWIN_C_SOURCE
#include "config.h"
#include "avformat.h"
diff --git a/libavformat/rtpdec.c b/libavformat/rtpdec.c
index db728ad2cb..0a9a8bc8d6 100644
--- a/libavformat/rtpdec.c
+++ b/libavformat/rtpdec.c
@@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-/* needed for gethostname() */
-#define _XOPEN_SOURCE 600
-
#include "libavcodec/get_bits.h"
#include "avformat.h"
#include "mpegts.h"
diff --git a/libavformat/rtpdec_qdm2.c b/libavformat/rtpdec_qdm2.c
index 1c1d3219be..c4314ec2c4 100644
--- a/libavformat/rtpdec_qdm2.c
+++ b/libavformat/rtpdec_qdm2.c
@@ -266,6 +266,8 @@ static int qdm2_parse_packet(AVFormatContext *s, PayloadContext *qdm,
* to the decoder that it is OK to initialize. */
st->codec->codec_id = CODEC_ID_QDM2;
}
+ if (st->codec->codec_id == CODEC_ID_NONE)
+ return AVERROR(EAGAIN);
/* subpackets */
while (end - p >= 4) {
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 4491c4b049..35c1774635 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -25,7 +25,7 @@
*/
#define _BSD_SOURCE /* Needed for using struct ip_mreq with recent glibc */
-#define _DARWIN_C_SOURCE /* Needed for using IP_MULTICAST_TTL on OS X */
+
#include "avformat.h"
#include "avio_internal.h"
#include "libavutil/parseutils.h"