diff options
author | Solomon Peachy <pizza@shaftnet.org> | 2022-10-13 11:04:12 -0400 |
---|---|---|
committer | Solomon Peachy <pizza@shaftnet.org> | 2022-10-13 11:08:11 -0400 |
commit | 9d3d925295112a0080bc1d70fad170db9e1af2a9 (patch) | |
tree | f6fb6244519a9430aa97b303e417fba53799b2f0 /apps/plugins/mpegplayer/parser.h | |
parent | 418169aff8faf2cf90124cd95dba0af821cea73d (diff) | |
download | rockbox-9d3d925295112a0080bc1d70fad170db9e1af2a9.tar.gz rockbox-9d3d925295112a0080bc1d70fad170db9e1af2a9.zip |
Revert "RFC: Get rid of mpegplayer plugin"
This reverts commit d25d24812e8120c0eb133a412287ac030eb185c9.
Change-Id: I1563223e343fb1e2eda72a45823b38350025ff93
Diffstat (limited to 'apps/plugins/mpegplayer/parser.h')
-rw-r--r-- | apps/plugins/mpegplayer/parser.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/apps/plugins/mpegplayer/parser.h b/apps/plugins/mpegplayer/parser.h new file mode 100644 index 0000000000..ba2181e98b --- /dev/null +++ b/apps/plugins/mpegplayer/parser.h | |||
@@ -0,0 +1,103 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * AV parser inteface declarations | ||
11 | * | ||
12 | * Copyright (c) 2007 Michael Sevakis | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #ifndef PARSER_H | ||
24 | #define PARSER_H | ||
25 | |||
26 | enum stream_formats | ||
27 | { | ||
28 | STREAM_FMT_UNKNOWN = -1, | ||
29 | STREAM_FMT_MPEG_TS, /* MPEG transport stream */ | ||
30 | STREAM_FMT_MPEG_PS, /* MPEG program stream */ | ||
31 | STREAM_FMT_MPV, /* MPEG Video only (1 or 2) */ | ||
32 | STREAM_FMT_MPA, /* MPEG Audio only */ | ||
33 | }; | ||
34 | |||
35 | /* Structure used by a thread that handles a single demuxed data stream and | ||
36 | * receives commands from the stream manager */ | ||
37 | enum stream_parse_states | ||
38 | { | ||
39 | /* Stream is... */ | ||
40 | SSTATE_SYNC, /* synchronizing by trying to find a start code */ | ||
41 | SSTATE_PARSE, /* parsing the stream looking for packets */ | ||
42 | SSTATE_END, /* at the end of data */ | ||
43 | }; | ||
44 | |||
45 | enum stream_parse_mode | ||
46 | { | ||
47 | STREAM_PM_STREAMING = 0, /* Next packet when streaming */ | ||
48 | STREAM_PM_RANDOM_ACCESS, /* Random-access parsing */ | ||
49 | }; | ||
50 | |||
51 | enum stream_parser_flags | ||
52 | { | ||
53 | STREAMF_CAN_SEEK = 0x1, /* Seeking possible for this stream */ | ||
54 | }; | ||
55 | |||
56 | struct stream_parser | ||
57 | { | ||
58 | /* Common generic parser data */ | ||
59 | enum stream_formats format; /* Stream format */ | ||
60 | uint32_t start_pts; /* The movie start time as represented by | ||
61 | the first audio PTS tag in the | ||
62 | stream converted to half minutes */ | ||
63 | uint32_t end_pts; /* The movie end time as represented by | ||
64 | the maximum audio PTS tag in the | ||
65 | stream converted to half minutes */ | ||
66 | uint32_t duration; /* Duration in PTS units */ | ||
67 | unsigned flags; /* Various attributes set at init */ | ||
68 | struct vo_ext dims; /* Movie dimensions in pixels */ | ||
69 | uint32_t last_seek_time; | ||
70 | int (*next_data)(struct stream *str, enum stream_parse_mode type); | ||
71 | union /* A place for reusable no-cache parameters */ | ||
72 | { | ||
73 | struct str_sync_data sd; | ||
74 | } parms; | ||
75 | }; | ||
76 | |||
77 | extern struct stream_parser str_parser; | ||
78 | |||
79 | /* MPEG parsing */ | ||
80 | uint8_t * mpeg_parser_scan_start_code(struct stream_scan *sk, uint32_t code); | ||
81 | unsigned mpeg_parser_scan_pes(struct stream_scan *sk); | ||
82 | uint32_t mpeg_parser_scan_scr(struct stream_scan *sk); | ||
83 | uint32_t mpeg_parser_scan_pts(struct stream_scan *sk, unsigned id); | ||
84 | off_t mpeg_stream_stream_seek_PTS(uint32_t time, int id); | ||
85 | |||
86 | /* General parsing */ | ||
87 | bool parser_init(void); | ||
88 | void str_initialize(struct stream *str, off_t pos); | ||
89 | bool parser_prepare_image(uint32_t time); | ||
90 | bool parser_get_video_size(struct vo_ext *sz); | ||
91 | int parser_init_stream(void); | ||
92 | void parser_close_stream(void); | ||
93 | static inline bool parser_can_seek(void) | ||
94 | { return str_parser.flags & STREAMF_CAN_SEEK; } | ||
95 | uint32_t parser_seek_time(uint32_t time); | ||
96 | void parser_prepare_streaming(void); | ||
97 | void str_end_of_stream(struct stream *str); | ||
98 | |||
99 | static inline int parser_get_next_data(struct stream *str, | ||
100 | enum stream_parse_mode type) | ||
101 | { return str_parser.next_data(str, type); } | ||
102 | |||
103 | #endif /* PARSER_H */ | ||