summaryrefslogtreecommitdiff
path: root/apps/plugins/mpegplayer/mpegplayer.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r--apps/plugins/mpegplayer/mpegplayer.c55
1 files changed, 23 insertions, 32 deletions
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c
index 8028913c94..f86a6e55fd 100644
--- a/apps/plugins/mpegplayer/mpegplayer.c
+++ b/apps/plugins/mpegplayer/mpegplayer.c
@@ -23,9 +23,9 @@
23 23
24/**************************************************************************** 24/****************************************************************************
25 * NOTES: 25 * NOTES:
26 * 26 *
27 * mpegplayer is structured as follows: 27 * mpegplayer is structured as follows:
28 * 28 *
29 * +-->Video Thread-->Video Output-->LCD 29 * +-->Video Thread-->Video Output-->LCD
30 * | 30 * |
31 * UI-->Stream Manager-->+-->Audio Thread-->PCM buffer--Audio Device 31 * UI-->Stream Manager-->+-->Audio Thread-->PCM buffer--Audio Device
@@ -36,53 +36,53 @@
36 * | Disk I/O 36 * | Disk I/O
37 * Stream services 37 * Stream services
38 * (timing, etc.) 38 * (timing, etc.)
39 * 39 *
40 * Thread list: 40 * Thread list:
41 * 1) The main thread - Handles user input, settings, basic playback control 41 * 1) The main thread - Handles user input, settings, basic playback control
42 * and USB connect. 42 * and USB connect.
43 * 43 *
44 * 2) Stream Manager thread - Handles playback state, events from streams 44 * 2) Stream Manager thread - Handles playback state, events from streams
45 * such as when a stream is finished, stream commands, PCM state. The 45 * such as when a stream is finished, stream commands, PCM state. The
46 * layer in which this thread run also handles arbitration of data 46 * layer in which this thread run also handles arbitration of data
47 * requests between the streams and the disk buffer. The actual specific 47 * requests between the streams and the disk buffer. The actual specific
48 * transport layer code may get moved out to support multiple container 48 * transport layer code may get moved out to support multiple container
49 * formats. 49 * formats.
50 * 50 *
51 * 3) Buffer thread - Buffers data in the background, generates notifications 51 * 3) Buffer thread - Buffers data in the background, generates notifications
52 * to streams when their data has been buffered, and watches streams' 52 * to streams when their data has been buffered, and watches streams'
53 * progress to keep data available during playback. Handles synchronous 53 * progress to keep data available during playback. Handles synchronous
54 * random access requests when the file cache is missed. 54 * random access requests when the file cache is missed.
55 * 55 *
56 * 4) Video thread (running on the COP for PortalPlayer targets) - Decodes 56 * 4) Video thread (running on the COP for PortalPlayer targets) - Decodes
57 * the video stream and renders video frames to the LCD. Handles 57 * the video stream and renders video frames to the LCD. Handles
58 * miscellaneous video tasks like frame and thumbnail printing. 58 * miscellaneous video tasks like frame and thumbnail printing.
59 * 59 *
60 * 5) Audio thread (running on the main CPU to maintain consistency with the 60 * 5) Audio thread (running on the main CPU to maintain consistency with the
61 * audio FIQ hander on PP) - Decodes audio frames and places them into 61 * audio FIQ hander on PP) - Decodes audio frames and places them into
62 * the PCM buffer for rendering by the audio device. 62 * the PCM buffer for rendering by the audio device.
63 * 63 *
64 * Streams are neither aware of one another nor care about one another. All 64 * Streams are neither aware of one another nor care about one another. All
65 * streams shall have their own thread (unless it is _really_ efficient to 65 * streams shall have their own thread (unless it is _really_ efficient to
66 * have a single thread handle a couple minor streams). All coordination of 66 * have a single thread handle a couple minor streams). All coordination of
67 * the streams is done through the stream manager. The clocking is controlled 67 * the streams is done through the stream manager. The clocking is controlled
68 * by and exposed by the stream manager to other streams and implemented at 68 * by and exposed by the stream manager to other streams and implemented at
69 * the PCM level. 69 * the PCM level.
70 * 70 *
71 * Notes about MPEG files: 71 * Notes about MPEG files:
72 * 72 *
73 * MPEG System Clock is 27MHz - i.e. 27000000 ticks/second. 73 * MPEG System Clock is 27MHz - i.e. 27000000 ticks/second.
74 * 74 *
75 * FPS is represented in terms of a frame period - this is always an 75 * FPS is represented in terms of a frame period - this is always an
76 * integer number of 27MHz ticks. 76 * integer number of 27MHz ticks.
77 * 77 *
78 * e.g. 29.97fps (30000/1001) NTSC video has an exact frame period of 78 * e.g. 29.97fps (30000/1001) NTSC video has an exact frame period of
79 * 900900 27MHz ticks. 79 * 900900 27MHz ticks.
80 * 80 *
81 * In libmpeg2, info->sequence->frame_period contains the frame_period. 81 * In libmpeg2, info->sequence->frame_period contains the frame_period.
82 * 82 *
83 * Working with Rockbox's 100Hz tick, the common frame rates would need 83 * Working with Rockbox's 100Hz tick, the common frame rates would need
84 * to be as follows (1): 84 * to be as follows (1):
85 * 85 *
86 * FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz 86 * FPS | 27Mhz | 100Hz | 44.1KHz | 48KHz
87 * --------|----------------------------------------------------------- 87 * --------|-----------------------------------------------------------
88 * 10* | 2700000 | 10 | 4410 | 4800 88 * 10* | 2700000 | 10 | 4410 | 4800
@@ -93,9 +93,9 @@
93 * 25 | 1080000 | 4 | 1764 | 1920 93 * 25 | 1080000 | 4 | 1764 | 1920
94 * 29.9700 | 900900 | 3.336667 | 1471,47 | 1601.6 94 * 29.9700 | 900900 | 3.336667 | 1471,47 | 1601.6
95 * 30 | 900000 | 3.333333 | 1470 | 1600 95 * 30 | 900000 | 3.333333 | 1470 | 1600
96 * 96 *
97 * *Unofficial framerates 97 * *Unofficial framerates
98 * 98 *
99 * (1) But we don't really care since the audio clock is used anyway and has 99 * (1) But we don't really care since the audio clock is used anyway and has
100 * very fine resolution ;-) 100 * very fine resolution ;-)
101 *****************************************************************************/ 101 *****************************************************************************/
@@ -450,16 +450,7 @@ CONFIG_KEYPAD == SANSA_M200_PAD
450#define MPEG_RW BUTTON_PREV 450#define MPEG_RW BUTTON_PREV
451#define MPEG_FF BUTTON_NEXT 451#define MPEG_FF BUTTON_NEXT
452 452
453#elif CONFIG_KEYPAD == XDUOO_X3II_PAD 453#elif CONFIG_KEYPAD == XDUOO_X3II_PAD || CONFIG_KEYPAD == XDUOO_X20_PAD
454#define MPEG_MENU BUTTON_PLAY
455#define MPEG_STOP BUTTON_POWER
456#define MPEG_PAUSE BUTTON_HOME
457#define MPEG_VOLDOWN BUTTON_VOL_DOWN
458#define MPEG_VOLUP BUTTON_VOL_UP
459#define MPEG_RW BUTTON_PREV
460#define MPEG_FF BUTTON_NEXT
461
462#elif CONFIG_KEYPAD == XDUOO_X20_PAD
463#define MPEG_MENU BUTTON_PLAY 454#define MPEG_MENU BUTTON_PLAY
464#define MPEG_STOP BUTTON_POWER 455#define MPEG_STOP BUTTON_POWER
465#define MPEG_PAUSE BUTTON_HOME 456#define MPEG_PAUSE BUTTON_HOME
@@ -477,7 +468,7 @@ CONFIG_KEYPAD == SANSA_M200_PAD
477#define MPEG_RW BUTTON_PREV 468#define MPEG_RW BUTTON_PREV
478#define MPEG_FF BUTTON_NEXT 469#define MPEG_FF BUTTON_NEXT
479 470
480#elif CONFIG_KEYPAD == IHIFI_770_PAD 471#elif CONFIG_KEYPAD == IHIFI_770_PAD || CONFIG_KEYPAD == IHIFI_800_PAD
481#define MPEG_MENU BUTTON_PLAY 472#define MPEG_MENU BUTTON_PLAY
482#define MPEG_STOP BUTTON_POWER 473#define MPEG_STOP BUTTON_POWER
483#define MPEG_PAUSE BUTTON_HOME 474#define MPEG_PAUSE BUTTON_HOME
@@ -486,10 +477,10 @@ CONFIG_KEYPAD == SANSA_M200_PAD
486#define MPEG_RW BUTTON_PREV 477#define MPEG_RW BUTTON_PREV
487#define MPEG_FF BUTTON_NEXT 478#define MPEG_FF BUTTON_NEXT
488 479
489#elif CONFIG_KEYPAD == IHIFI_800_PAD 480#elif CONFIG_KEYPAD == EROSQ_PAD
490#define MPEG_MENU BUTTON_PLAY 481#define MPEG_MENU BUTTON_MENU
491#define MPEG_STOP BUTTON_POWER 482#define MPEG_STOP BUTTON_POWER
492#define MPEG_PAUSE BUTTON_HOME 483#define MPEG_PAUSE BUTTON_PLAY
493#define MPEG_VOLDOWN BUTTON_VOL_DOWN 484#define MPEG_VOLDOWN BUTTON_VOL_DOWN
494#define MPEG_VOLUP BUTTON_VOL_UP 485#define MPEG_VOLUP BUTTON_VOL_UP
495#define MPEG_RW BUTTON_PREV 486#define MPEG_RW BUTTON_PREV
@@ -2508,7 +2499,7 @@ enum plugin_status plugin_start(const void* parameter)
2508 /* Enter button loop and process UI */ 2499 /* Enter button loop and process UI */
2509 next_action = button_loop(); 2500 next_action = button_loop();
2510 manual_skip = next_action & VIDEO_ACTION_MANUAL; 2501 manual_skip = next_action & VIDEO_ACTION_MANUAL;
2511 next_action &= ~VIDEO_ACTION_MANUAL; 2502 next_action &= ~VIDEO_ACTION_MANUAL;
2512 } 2503 }
2513 2504
2514 stream_close(); 2505 stream_close();