summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2002-11-24 11:49:17 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2002-11-24 11:49:17 +0000
commit6a240593927f1d9bc02401859f18152a21751664 (patch)
tree0288f7e41c96d20626884de5b91d18a6414d27bf
parent0281125c9846869d8f058c0f7c1b62c468134096 (diff)
downloadrockbox-6a240593927f1d9bc02401859f18152a21751664.tar.gz
rockbox-6a240593927f1d9bc02401859f18152a21751664.zip
Recording buffer saving mechanism was braindead
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@2881 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/mpeg.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/firmware/mpeg.c b/firmware/mpeg.c
index f0b4eb85c8..346c115d18 100644
--- a/firmware/mpeg.c
+++ b/firmware/mpeg.c
@@ -471,8 +471,10 @@ static int lowest_watermark_level; /* Debug value to observe the buffer
471 usage */ 471 usage */
472#ifdef HAVE_MAS3587F 472#ifdef HAVE_MAS3587F
473static bool is_recording; /* We are recording */ 473static bool is_recording; /* We are recording */
474bool stop_pending; 474static bool stop_pending;
475unsigned long record_start_frame; /* Frame number where recording started */ 475static unsigned long record_start_frame; /* Frame number where
476 recording started */
477static bool saving; /* We are saving the buffer to disk */
476#endif 478#endif
477 479
478static int mpeg_file; 480static int mpeg_file;
@@ -725,7 +727,7 @@ static void dma_tick(void)
725 if(num_bytes < 0) 727 if(num_bytes < 0)
726 num_bytes += mp3buflen; 728 num_bytes += mp3buflen;
727 729
728 if(mp3buflen - num_bytes < MPEG_LOW_WATER) 730 if(mp3buflen - num_bytes < MPEG_LOW_WATER && !saving)
729 queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); 731 queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
730 } 732 }
731 } 733 }
@@ -1653,6 +1655,7 @@ static void mpeg_thread(void)
1653 1655
1654 case MPEG_STOP: 1656 case MPEG_STOP:
1655 DEBUGF("MPEG_STOP\n"); 1657 DEBUGF("MPEG_STOP\n");
1658 demand_irq_enable(false);
1656 is_recording = false; 1659 is_recording = false;
1657 1660
1658 /* Save the remaining data in the buffer */ 1661 /* Save the remaining data in the buffer */
@@ -1663,12 +1666,11 @@ static void mpeg_thread(void)
1663 case MPEG_STOP_DONE: 1666 case MPEG_STOP_DONE:
1664 DEBUGF("MPEG_STOP_DONE\n"); 1667 DEBUGF("MPEG_STOP_DONE\n");
1665 1668
1666 demand_irq_enable(false);
1667 if(mpeg_file >= 0) 1669 if(mpeg_file >= 0)
1668 close(mpeg_file); 1670 close(mpeg_file);
1669 mpeg_file = -1; 1671 mpeg_file = -1;
1670 1672
1671#ifdef DEBUG 1673#ifdef DEBUG1
1672 { 1674 {
1673 int i; 1675 int i;
1674 for(i = 0;i < 512;i++) 1676 for(i = 0;i < 512;i++)
@@ -1703,6 +1705,8 @@ static void mpeg_thread(void)
1703 stop_pending) 1705 stop_pending)
1704 { 1706 {
1705 int rc; 1707 int rc;
1708
1709 saving = true;
1706 1710
1707 /* Only save up to the end of the buffer */ 1711 /* Only save up to the end of the buffer */
1708 writelen = MIN(amount_to_save, 1712 writelen = MIN(amount_to_save,
@@ -1719,6 +1723,10 @@ static void mpeg_thread(void)
1719 1723
1720 queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0); 1724 queue_post(&mpeg_queue, MPEG_SAVE_DATA, 0);
1721 } 1725 }
1726 else
1727 {
1728 saving = false;
1729 }
1722 } 1730 }
1723 else 1731 else
1724 { 1732 {