[MPlayer-cvslog] r20954 - trunk/libmpdemux/demux_nut.c

ods15 subversion at mplayerhq.hu
Thu Nov 16 08:07:22 CET 2006


Author: ods15
Date: Thu Nov 16 08:07:22 2006
New Revision: 20954

Modified:
   trunk/libmpdemux/demux_nut.c

Log:
update to libnut API, non-negative errors


Modified: trunk/libmpdemux/demux_nut.c
==============================================================================
--- trunk/libmpdemux/demux_nut.c	(original)
+++ trunk/libmpdemux/demux_nut.c	Thu Nov 16 08:07:22 2006
@@ -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;



More information about the MPlayer-cvslog mailing list