changeset 35290:17a449bc5106

Minor simplifications.
author reimar
date Sat, 10 Nov 2012 12:27:26 +0000
parents 3ae6e6d9186f
children ef57345fe3e8
files libmpdemux/demux_y4m.c
diffstat 1 files changed, 10 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/demux_y4m.c	Sat Nov 10 12:20:36 2012 +0000
+++ b/libmpdemux/demux_y4m.c	Sat Nov 10 12:27:26 2012 +0000
@@ -87,7 +87,7 @@
   y4m_priv_t *priv=demux->priv;
   y4m_frame_info_t fi;
   unsigned char *buf[3];
-  int err, size;
+  int size;
   int nextc;
 
   nextc = stream_read_char(demux->stream);
@@ -112,9 +112,7 @@
 
   if (priv->is_older)
   {
-    int c;
-
-    c = stream_read_char(demux->stream); /* F */
+    int c = stream_read_char(demux->stream); /* F */
     if (c == -256)
 	return 0; /* EOF */
     if (c != 'F')
@@ -129,7 +127,8 @@
   }
   else
   {
-    if ((err=y4m_read_frame(demux->stream, priv->si, &fi, buf)) != Y4M_OK) {
+    int err = y4m_read_frame(demux->stream, priv->si, &fi, buf);
+    if (err != Y4M_OK) {
       mp_msg(MSGT_DEMUX, MSGL_ERR, "error reading frame %s\n", y4m_strerr(err));
       return 0;
     }
@@ -159,15 +158,15 @@
 
 	stream_skip(demuxer->stream, 8); /* YUV4MPEG */
 	stream_skip(demuxer->stream, 1); /* space */
-	stream_read(demuxer->stream, (char *)&buf[0], 3);
+	stream_read(demuxer->stream, buf, 3);
 	buf[3] = 0;
 	sh->disp_w = atoi(buf);
 	stream_skip(demuxer->stream, 1); /* space */
-	stream_read(demuxer->stream, (char *)&buf[0], 3);
+	stream_read(demuxer->stream, buf, 3);
 	buf[3] = 0;
 	sh->disp_h = atoi(buf);
 	stream_skip(demuxer->stream, 1); /* space */
-	stream_read(demuxer->stream, (char *)&buf[0], 1);
+	stream_read(demuxer->stream, buf, 1);
 	buf[1] = 0;
 	frame_rate_code = atoi(buf);
 	stream_skip(demuxer->stream, 1); /* new-line */
@@ -300,9 +299,9 @@
     if(!priv)
       return;
     if (!priv->is_older)
-	y4m_fini_stream_info(((y4m_priv_t*)demuxer->priv)->si);
-    free(((y4m_priv_t*)demuxer->priv)->si);
-    free(demuxer->priv);
+	y4m_fini_stream_info(priv->si);
+    free(priv->si);
+    free(priv);
     return;
 }