summaryrefslogtreecommitdiffstats
path: root/libmpdemux/demuxer.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-08-03 12:24:55 +0200
committerwm4 <wm4@nowhere>2012-08-03 13:25:41 +0200
commit9c02ae7e9510897826334ddf79fa3a0cf65a78a2 (patch)
tree813c9a2b757b2531d3fd29cf483ac1ba89093f7f /libmpdemux/demuxer.h
parentd722f8fe61296e5b277ed94be055bb9ef1c99e19 (diff)
downloadmpv-9c02ae7e9510897826334ddf79fa3a0cf65a78a2.tar.bz2
mpv-9c02ae7e9510897826334ddf79fa3a0cf65a78a2.tar.xz
demuxer: introduce a general stream struct
There are different C types for each stream type: sh_video for video, sh_audio for audio, sh_sub for sub. There is no type that handles all stream types in a generic way. Instead, there's a macro SH_COMMON, that is used to define common fields for all 3 stream structs. Accessing the common fields is hard if you want to be independent from the stream type. Introduce an actual generic stream struct (struct sh_stream), which is supposed to unify all 3 stream types one day. Once all fields defined by SH_COMMON have been moved into sh_stream, the transition is complete. Move some fields into sh_stream, and rewrite osd_show_tracks to use them.
Diffstat (limited to 'libmpdemux/demuxer.h')
-rw-r--r--libmpdemux/demuxer.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/libmpdemux/demuxer.h b/libmpdemux/demuxer.h
index 285ac3a7af..9b63eb63ac 100644
--- a/libmpdemux/demuxer.h
+++ b/libmpdemux/demuxer.h
@@ -147,9 +147,10 @@ typedef struct demuxer_info {
char *copyright;
} demuxer_info_t;
-#define MAX_A_STREAMS 256
-#define MAX_V_STREAMS 256
-#define MAX_S_STREAMS 256
+#define MAX_SH_STREAMS 256
+#define MAX_A_STREAMS MAX_SH_STREAMS
+#define MAX_V_STREAMS MAX_SH_STREAMS
+#define MAX_S_STREAMS MAX_SH_STREAMS
struct demuxer;
@@ -244,9 +245,12 @@ typedef struct demuxer {
struct demux_stream *sub; // dvd subtitle buffer/demuxer
// stream headers:
- struct sh_audio *a_streams[MAX_A_STREAMS];
- struct sh_video *v_streams[MAX_V_STREAMS];
- struct sh_sub *s_streams[MAX_S_STREAMS];
+ struct sh_audio *a_streams[MAX_SH_STREAMS];
+ struct sh_video *v_streams[MAX_SH_STREAMS];
+ struct sh_sub *s_streams[MAX_SH_STREAMS];
+
+ struct sh_stream **streams;
+ int num_streams;
int num_titles;
@@ -415,7 +419,6 @@ int demuxer_angles_count(struct demuxer *demuxer);
int demuxer_audio_track_by_lang_and_default(struct demuxer *d, char **langt);
int demuxer_sub_track_by_lang_and_default(struct demuxer *d, char **langt);
-char *demuxer_audio_lang(demuxer_t *d, int id);
-char *demuxer_sub_lang(demuxer_t *d, int id);
+char *demuxer_stream_lang(demuxer_t *d, struct sh_stream *s);
#endif /* MPLAYER_DEMUXER_H */