summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-10-06 13:23:05 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-10-06 13:45:08 +0200
commit55c49afc42abae64e5ab25e04bc3c09b17c5b6d5 (patch)
tree3e56007e0d3039ee6aa91e0e87b9abc14a49bf94 /libavformat
parent886c3662d308e97316a606732574f0e87b1cbe3a (diff)
parentd3a72becc6371563185a509b94f5daf32ddbb485 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: yuv4mpeg: return proper error codes. Give all anonymously typedeffed structs in headers a name fate: Add parseutils test parseutils-test: Drop random colors from parsing test vf_pad/scale: use double precision for aspect ratios. build: error on variable-length arrays ppc: swscale: rework yuv2planeX_altivec() ppc: fmtconvert: kill VLA in float_to_int16_interleave_altivec() x86: dsputil: kill VLA in gmc_mmx() libspeexenc: Updated commentary to reflect recent changes libspeexenc: Add an option for enabling DTX doc/APIchanges: fill in missing dates and hashes. lavr: bump major to 1 and declare it stable. lavr: change the type of the data buffers to uint8_t**. lavc: deprecate the audio resampling API. Conflicts: cmdutils.h configure doc/APIchanges ffplay.c libavcodec/dwt.h libavcodec/libspeexenc.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavformat/asf.h tests/fate/libavutil.mak tests/ref/fate/parseutils Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/asf.h6
-rw-r--r--libavformat/audiointerleave.h2
-rw-r--r--libavformat/httpauth.h4
-rw-r--r--libavformat/isom.h14
-rw-r--r--libavformat/mms.h4
-rw-r--r--libavformat/movenc.h4
-rw-r--r--libavformat/mpegts.h4
-rw-r--r--libavformat/mxf.h4
-rw-r--r--libavformat/nut.h12
-rw-r--r--libavformat/rtpdec.h2
-rw-r--r--libavformat/swf.h2
-rw-r--r--libavformat/yuv4mpeg.c22
12 files changed, 44 insertions, 36 deletions
diff --git a/libavformat/asf.h b/libavformat/asf.h
index 5562865f68..822cd6bbea 100644
--- a/libavformat/asf.h
+++ b/libavformat/asf.h
@@ -28,7 +28,7 @@
#define PACKET_SIZE 3200
-typedef struct {
+typedef struct ASFStream {
int num;
unsigned char seq;
/* use for reading */
@@ -49,7 +49,7 @@ typedef struct {
uint32_t palette[256];
} ASFStream;
-typedef struct {
+typedef struct ASFMainHeader {
ff_asf_guid guid; ///< generated by client computer
uint64_t file_size; /**< in bytes
* invalid if broadcasting */
@@ -75,7 +75,7 @@ typedef struct {
} ASFMainHeader;
-typedef struct {
+typedef struct ASFIndex {
uint32_t packet_number;
uint16_t packet_count;
} ASFIndex;
diff --git a/libavformat/audiointerleave.h b/libavformat/audiointerleave.h
index b37c8aefbd..4d77832fa1 100644
--- a/libavformat/audiointerleave.h
+++ b/libavformat/audiointerleave.h
@@ -26,7 +26,7 @@
#include "libavutil/fifo.h"
#include "avformat.h"
-typedef struct {
+typedef struct AudioInterleaveContext {
AVFifoBuffer *fifo;
unsigned fifo_size; ///< size of currently allocated FIFO
uint64_t dts; ///< current dts
diff --git a/libavformat/httpauth.h b/libavformat/httpauth.h
index 62dd25e637..fc17c94859 100644
--- a/libavformat/httpauth.h
+++ b/libavformat/httpauth.h
@@ -32,7 +32,7 @@ typedef enum HTTPAuthType {
HTTP_AUTH_DIGEST, /**< HTTP 1.1 Digest auth from RFC 2617 */
} HTTPAuthType;
-typedef struct {
+typedef struct DigestParams {
char nonce[300]; /**< Server specified nonce */
char algorithm[10]; /**< Server specified digest algorithm */
char qop[30]; /**< Quality of protection, containing the one
@@ -52,7 +52,7 @@ typedef struct {
* HTTP Authentication state structure. Must be zero-initialized
* before used with the functions below.
*/
-typedef struct {
+typedef struct HTTPAuthState {
/**
* The currently chosen auth type.
*/
diff --git a/libavformat/isom.h b/libavformat/isom.h
index 370ba43a25..f6eba56220 100644
--- a/libavformat/isom.h
+++ b/libavformat/isom.h
@@ -42,18 +42,18 @@ int ff_mov_lang_to_iso639(unsigned code, char to[4]);
* Here we just use what is needed to read the chunks
*/
-typedef struct {
+typedef struct MOVStts {
int count;
int duration;
} MOVStts;
-typedef struct {
+typedef struct MOVStsc {
int first;
int count;
int id;
} MOVStsc;
-typedef struct {
+typedef struct MOVDref {
uint32_t type;
char *path;
char *dir;
@@ -62,14 +62,14 @@ typedef struct {
int16_t nlvl_to, nlvl_from;
} MOVDref;
-typedef struct {
+typedef struct MOVAtom {
uint32_t type;
int64_t size; /* total size (excluding the size and type fields) */
} MOVAtom;
struct MOVParseTableEntry;
-typedef struct {
+typedef struct MOVFragment {
unsigned track_id;
uint64_t base_data_offset;
uint64_t moof_offset;
@@ -79,7 +79,7 @@ typedef struct {
unsigned flags;
} MOVFragment;
-typedef struct {
+typedef struct MOVTrackExt {
unsigned track_id;
unsigned stsd_id;
unsigned duration;
@@ -87,7 +87,7 @@ typedef struct {
unsigned flags;
} MOVTrackExt;
-typedef struct {
+typedef struct MOVSbgp {
unsigned int count;
unsigned int index;
} MOVSbgp;
diff --git a/libavformat/mms.h b/libavformat/mms.h
index cbfa79a838..57e3d7e18a 100644
--- a/libavformat/mms.h
+++ b/libavformat/mms.h
@@ -23,11 +23,11 @@
#include "url.h"
-typedef struct {
+typedef struct MMSStream {
int id;
}MMSStream;
-typedef struct {
+typedef struct MMSContext {
URLContext *mms_hd; ///< TCP connection handle
MMSStream *streams;
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index da6f19bbe0..7c87f6b14d 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -62,13 +62,13 @@ typedef struct HintSample {
int own_data;
} HintSample;
-typedef struct {
+typedef struct HintSampleQueue {
int size;
int len;
HintSample *samples;
} HintSampleQueue;
-typedef struct {
+typedef struct MOVFragmentInfo {
int64_t offset;
int64_t time;
int64_t duration;
diff --git a/libavformat/mpegts.h b/libavformat/mpegts.h
index eae9d46ad4..98c4b93736 100644
--- a/libavformat/mpegts.h
+++ b/libavformat/mpegts.h
@@ -65,7 +65,7 @@ int ff_mpegts_parse_packet(MpegTSContext *ts, AVPacket *pkt,
const uint8_t *buf, int len);
void ff_mpegts_parse_close(MpegTSContext *ts);
-typedef struct {
+typedef struct SLConfigDescr {
int use_au_start;
int use_au_end;
int use_rand_acc_pt;
@@ -82,7 +82,7 @@ typedef struct {
int packet_seq_num_len;
} SLConfigDescr;
-typedef struct {
+typedef struct Mp4Descr {
int es_id;
int dec_config_descr_len;
uint8_t *dec_config_descr;
diff --git a/libavformat/mxf.h b/libavformat/mxf.h
index ed3225b769..a91d53fdb2 100644
--- a/libavformat/mxf.h
+++ b/libavformat/mxf.h
@@ -55,13 +55,13 @@ enum MXFFrameLayout {
SegmentedFrame,
};
-typedef struct {
+typedef struct KLVPacket {
UID key;
int64_t offset;
uint64_t length;
} KLVPacket;
-typedef struct {
+typedef struct MXFCodecUL {
UID uid;
unsigned matching_len;
int id;
diff --git a/libavformat/nut.h b/libavformat/nut.h
index 39743db1b3..53b5ebc4db 100644
--- a/libavformat/nut.h
+++ b/libavformat/nut.h
@@ -53,14 +53,14 @@ typedef enum{
FLAG_INVALID =8192, ///<if set, frame_code is invalid
} Flag;
-typedef struct {
+typedef struct Syncpoint {
uint64_t pos;
uint64_t back_ptr;
// uint64_t global_key_pts;
int64_t ts;
} Syncpoint;
-typedef struct {
+typedef struct FrameCode {
uint16_t flags;
uint8_t stream_id;
uint16_t size_mul;
@@ -70,7 +70,7 @@ typedef struct {
uint8_t header_idx;
} FrameCode;
-typedef struct {
+typedef struct StreamContext {
int last_flags;
int skip_until_key_frame;
int64_t last_pts;
@@ -82,11 +82,11 @@ typedef struct {
int64_t *keyframe_pts;
} StreamContext;
-typedef struct {
+typedef struct ChapterContext {
AVRational *time_base;
} ChapterContext;
-typedef struct {
+typedef struct NUTContext {
AVFormatContext *avf;
// int written_packet_size;
// int64_t packet_start;
@@ -110,7 +110,7 @@ typedef struct {
extern const AVCodecTag ff_nut_subtitle_tags[];
extern const AVCodecTag ff_nut_video_tags[];
-typedef struct {
+typedef struct Dispositions {
char str[9];
int flag;
} Dispositions;
diff --git a/libavformat/rtpdec.h b/libavformat/rtpdec.h
index 521b2f5be4..3d7019024a 100644
--- a/libavformat/rtpdec.h
+++ b/libavformat/rtpdec.h
@@ -72,7 +72,7 @@ void ff_rtp_send_punch_packets(URLContext* rtp_handle);
int ff_rtp_check_and_send_back_rr(RTPDemuxContext *s, int count);
// these statistics are used for rtcp receiver reports...
-typedef struct {
+typedef struct RTPStatistics {
uint16_t max_seq; ///< highest sequence number seen
uint32_t cycles; ///< shifted count of sequence number cycles
uint32_t base_seq; ///< base sequence number
diff --git a/libavformat/swf.h b/libavformat/swf.h
index 3c0c6076f2..5f0d486233 100644
--- a/libavformat/swf.h
+++ b/libavformat/swf.h
@@ -70,7 +70,7 @@
#undef NDEBUG
#include <assert.h>
-typedef struct {
+typedef struct SWFContext {
int64_t duration_pos;
int64_t tag_pos;
int64_t vframes_pos;
diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c
index a53d30fb37..b67209423c 100644
--- a/libavformat/yuv4mpeg.c
+++ b/libavformat/yuv4mpeg.c
@@ -497,7 +497,7 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
{
int i;
char header[MAX_FRAME_HEADER+1];
- int packet_size, width, height;
+ int packet_size, width, height, ret;
AVStream *st = s->streams[0];
struct frame_attributes *s1 = s->priv_data;
@@ -508,20 +508,28 @@ static int yuv4_read_packet(AVFormatContext *s, AVPacket *pkt)
break;
}
}
- if (i == MAX_FRAME_HEADER)
- return -1;
+ if (s->pb->error)
+ return s->pb->error;
+ else if (s->pb->eof_reached)
+ return AVERROR_EOF;
+ else if (i == MAX_FRAME_HEADER)
+ return AVERROR_INVALIDDATA;
+
if (strncmp(header, Y4M_FRAME_MAGIC, strlen(Y4M_FRAME_MAGIC)))
- return -1;
+ return AVERROR_INVALIDDATA;
width = st->codec->width;
height = st->codec->height;
packet_size = avpicture_get_size(st->codec->pix_fmt, width, height);
if (packet_size < 0)
- return -1;
+ return packet_size;
- if (av_get_packet(s->pb, pkt, packet_size) != packet_size)
- return AVERROR(EIO);
+ ret = av_get_packet(s->pb, pkt, packet_size);
+ if (ret < 0)
+ return ret;
+ else if (ret != packet_size)
+ return s->pb->eof_reached ? AVERROR_EOF : AVERROR(EIO);
if (st->codec->coded_frame) {
st->codec->coded_frame->interlaced_frame = s1->interlaced_frame;