From e4cbf7529ba4bcfff47c44b0d026ecb356004c8c Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Thu, 27 Sep 2012 10:19:53 +0200 Subject: Give all anonymously typedeffed structs in headers a name Anonymous structs cannot be forward declared and have no benefit. --- libavformat/asf.h | 6 +++--- libavformat/audiointerleave.h | 2 +- libavformat/httpauth.h | 4 ++-- libavformat/isom.h | 14 +++++++------- libavformat/mms.h | 4 ++-- libavformat/movenc.h | 4 ++-- libavformat/mpegts.h | 4 ++-- libavformat/mxf.h | 4 ++-- libavformat/nut.h | 12 ++++++------ libavformat/rtpdec.h | 2 +- libavformat/swf.h | 2 +- 11 files changed, 29 insertions(+), 29 deletions(-) (limited to 'libavformat') diff --git a/libavformat/asf.h b/libavformat/asf.h index b72445def9..1d94a2c924 100644 --- a/libavformat/asf.h +++ b/libavformat/asf.h @@ -27,7 +27,7 @@ #define PACKET_SIZE 3200 -typedef struct { +typedef struct ASFStream { int num; unsigned char seq; /* use for reading */ @@ -50,7 +50,7 @@ typedef struct { typedef uint8_t ff_asf_guid[16]; -typedef struct { +typedef struct ASFMainHeader { ff_asf_guid guid; ///< generated by client computer uint64_t file_size; /**< in bytes * invalid if broadcasting */ @@ -76,7 +76,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 af29629b8a..9c7b548c1d 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 bd0644906a..99bf43ffdc 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 b191699711..932b1d0a68 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 5235581645..e89da41bb6 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 3be43e0fc9..e20ef1475b 100644 --- a/libavformat/movenc.h +++ b/libavformat/movenc.h @@ -60,13 +60,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 9f2ba3f8f3..89544f06f8 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 f39a013f7b..88322d1591 100644 --- a/libavformat/mxf.h +++ b/libavformat/mxf.h @@ -54,13 +54,13 @@ enum MXFFrameLayout { SeparateFields }; -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 419b123bee..3f09689bd1 100644 --- a/libavformat/nut.h +++ b/libavformat/nut.h @@ -53,14 +53,14 @@ typedef enum{ FLAG_INVALID =8192, /// -typedef struct { +typedef struct SWFContext { int64_t duration_pos; int64_t tag_pos; int64_t vframes_pos; -- cgit v1.2.3 From d3a72becc6371563185a509b94f5daf32ddbb485 Mon Sep 17 00:00:00 2001 From: Anton Khirnov Date: Fri, 5 Oct 2012 15:53:32 +0200 Subject: yuv4mpeg: return proper error codes. Fixes Bug 373. CC:libav-stable@libav.org --- libavformat/yuv4mpeg.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) (limited to 'libavformat') diff --git a/libavformat/yuv4mpeg.c b/libavformat/yuv4mpeg.c index c17d7e5246..23fb129971 100644 --- a/libavformat/yuv4mpeg.c +++ b/libavformat/yuv4mpeg.c @@ -367,7 +367,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; @@ -378,20 +378,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; -- cgit v1.2.3