changeset 20938:2f29235bcc69

update to libnut API, non-negative errors
author ods15
date Thu, 16 Nov 2006 07:07:22 +0000
parents 51a2f19c6cbf
children da93e0635a90
files libmpdemux/demux_nut.c
diffstat 1 files changed, 12 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_nut.c	Thu Nov 16 06:58:48 2006 +0000
+++ b/libmpdemux/demux_nut.c	Thu Nov 16 07:07:22 2006 +0000
@@ -79,8 +79,7 @@
 	int i;
 
 	if ((ret = nut_read_headers(nut, &s, NULL))) {
-		if (ret < 0) mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n",
-		                                           nut_error(-ret));
+		mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n", nut_error(ret));
 		nut_demuxer_uninit(nut);
 		free(priv);
 		return NULL;
@@ -183,11 +182,12 @@
 	if (stream_eof(demuxer->stream)) return 0;
 
 	ret = nut_read_next_packet(nut, &pd);
-	if (ret < 0) {
-		mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n",
-		                               nut_error(-ret));
+	if (ret) {
+		if (ret != NUT_ERR_EOF)
+			mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n",
+			                               nut_error(ret));
+		return 0; // fatal error
 	}
-	if (ret) return 0; // fatal error
 
 	pts = (double)pd.pts * priv->s[pd.stream].time_base.nom /
 	                       priv->s[pd.stream].time_base.den;
@@ -204,11 +204,11 @@
 	else {
 		uint8_t buf[pd.len];
 		ret = nut_read_frame(nut, &pd.len, buf);
-		if (ret < 0) {
+		if (ret) {
 			mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n",
-			                               nut_error(-ret));
+			                               nut_error(ret));
+			return 0; // fatal error
 		}
-		if (ret) return 0; // fatal error
 		return 1;
 	}
 
@@ -222,11 +222,11 @@
 	dp->flags= (pd.flags & NUT_FLAG_KEY) ? 0x10 : 0;
 
 	ret = nut_read_frame(nut, &pd.len, dp->buffer);
-	if (ret < 0) {
+	if (ret) {
 		mp_msg(MSGT_HEADER, MSGL_ERR, "NUT error: %s\n",
-		                               nut_error(-ret));
+		                               nut_error(ret));
+		return 0; // fatal error
 	}
-	if (ret) return 0; // fatal error
 
 	ds_add_packet(ds, dp); // append packet to DS stream
 	return 1;