[FFmpeg-devel] [PATCH 04/10] spdifenc: improve error return values
Anssi Hannula
anssi.hannula
Wed Dec 29 06:06:37 CET 2010
---
libavformat/spdifenc.c | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libavformat/spdifenc.c b/libavformat/spdifenc.c
index 8b94459..c5bc72b 100644
--- a/libavformat/spdifenc.c
+++ b/libavformat/spdifenc.c
@@ -140,7 +140,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
break;
default:
av_log(s, AV_LOG_ERROR, "bad DTS syncword 0x%x\n", syncword_dts);
- return -1;
+ return AVERROR_INVALIDDATA;
}
blocks++;
switch (blocks) {
@@ -150,7 +150,7 @@ static int spdif_header_dts(AVFormatContext *s, AVPacket *pkt)
default:
av_log(s, AV_LOG_ERROR, "%i samples in DTS frame not supported\n",
blocks << 5);
- return -1;
+ return AVERROR(ENOSYS);
}
ctx->pkt_offset = blocks << 7;
@@ -179,7 +179,7 @@ static int spdif_header_mpeg(AVFormatContext *s, AVPacket *pkt)
if (layer == 3 || version == 1) {
av_log(s, AV_LOG_ERROR, "Wrong MPEG file format\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
av_log(s, AV_LOG_DEBUG, "version: %i layer: %i extension: %i\n", version, layer, extension);
if (version == 2 && extension) {
@@ -204,7 +204,7 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
ret = ff_aac_parse_header(&gbc, &hdr);
if (ret < 0) {
av_log(s, AV_LOG_ERROR, "Wrong AAC file format\n");
- return -1;
+ return AVERROR_INVALIDDATA;
}
ctx->pkt_offset = hdr.samples << 2;
@@ -221,7 +221,7 @@ static int spdif_header_aac(AVFormatContext *s, AVPacket *pkt)
default:
av_log(s, AV_LOG_ERROR, "%i samples in AAC frame not supported\n",
hdr.samples);
- return -1;
+ return AVERROR(EINVAL);
}
//TODO Data type dependent info (LC profile/SBR)
return 0;
@@ -264,7 +264,7 @@ static int spdif_header_truehd(AVFormatContext *s, AVPacket *pkt)
* distribute the TrueHD frames in the MAT frame */
av_log(s, AV_LOG_ERROR, "TrueHD frame too big, %d bytes\n", pkt->size);
av_log_ask_for_sample(s, NULL);
- return -1;
+ return AVERROR_INVALIDDATA;
}
memcpy(&ctx->hd_buf[ctx->hd_buf_count * TRUEHD_FRAME_OFFSET - BURST_HEADER_SIZE + mat_code_length],
@@ -317,7 +317,7 @@ static int spdif_write_header(AVFormatContext *s)
break;
default:
av_log(s, AV_LOG_ERROR, "codec not supported\n");
- return -1;
+ return AVERROR_PATCHWELCOME;
}
return 0;
}
@@ -343,14 +343,14 @@ static int spdif_write_packet(struct AVFormatContext *s, AVPacket *pkt)
ret = ctx->header_info(s, pkt);
if (ret < 0)
- return -1;
+ return ret;
if (!ctx->pkt_offset)
return 0;
padding = (ctx->pkt_offset - ctx->use_preamble * BURST_HEADER_SIZE - ctx->out_bytes) >> 1;
if (padding < 0) {
av_log(s, AV_LOG_ERROR, "bitrate is too high\n");
- return -1;
+ return AVERROR(EINVAL);
}
if (ctx->use_preamble) {
--
1.7.3
More information about the ffmpeg-devel
mailing list