replex_fill_buffers does something a little strange when checking save_read.
From: Erik Hovland <erik@hovland.org>
I am reworking it so it is readable.
---
programs/mythtranscode/replex/replex.c | 13 ++++---------
1 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/programs/mythtranscode/replex/replex.c b/programs/mythtranscode/replex/replex.c
index dfea4e6..38f1789 100644
a
|
b
|
int replex_fill_buffers(struct replex *rx, uint8_t *mbuf) |
1569 | 1569 | |
1570 | 1570 | #define MAX_TRIES 5 |
1571 | 1571 | while (count < rsize && tries < MAX_TRIES){ |
1572 | | if ((re = save_read(rx,buf+i,rsize-i)+i)<0) |
| 1572 | if ((re = save_read(rx,buf+i,rsize-i))<0) |
1573 | 1573 | perror("reading"); |
1574 | 1574 | else |
1575 | | count += re; |
| 1575 | count += (re+i); |
1576 | 1576 | tries++; |
1577 | 1577 | |
1578 | 1578 | if (!rx->vpid || !(rx->apidn || rx->ac3n)){ |
… |
… |
void init_replex(struct replex *rx) |
1835 | 1835 | avi_context *ac; |
1836 | 1836 | uint8_t buf[AVI_S]; |
1837 | 1837 | int re=0; |
1838 | | ssize_t read_count = 0; |
1839 | 1838 | |
1840 | 1839 | lseek(rx->fd_in, 0, SEEK_SET); |
1841 | 1840 | ac = &rx->ac; |
1842 | 1841 | memset(ac, 0, sizeof(avi_context)); |
1843 | | if ((read_count = save_read(rx, buf, 12)) != 12) { |
1844 | | fprintf(stderr, |
1845 | | "Error reading in 12 bytes from replex. Read %d bytes\n", |
1846 | | read_count); |
1847 | | exit(1); |
1848 | | } |
| 1842 | if (save_read(rx, buf, 12)<0) |
| 1843 | perror("reading"); |
1849 | 1844 | |
1850 | 1845 | if (check_riff(ac, buf, 12) < 0){ |
1851 | 1846 | fprintf(stderr, "Wrong RIFF header\n"); |