summaryrefslogtreecommitdiffstats
path: root/demux/stheader.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-01-12 23:48:19 +0100
committerwm4 <wm4@nowhere>2016-01-12 23:48:19 +0100
commit671df54e4dcf0675c335483d26f7f6ff9baaf76a (patch)
tree6a206ddf489474150fffa2eac651b5e8915b969c /demux/stheader.h
parent81f3b3aafe72e5ca9ac79d29246e70dce76ebca9 (diff)
downloadmpv-671df54e4dcf0675c335483d26f7f6ff9baaf76a.tar.bz2
mpv-671df54e4dcf0675c335483d26f7f6ff9baaf76a.tar.xz
demux: merge sh_video/sh_audio/sh_sub
This is mainly a refactor. I'm hoping it will make some things easier in the future due to cleanly separating codec metadata and stream metadata. Also, declare that the "codec" field can not be NULL anymore. demux.c will set it to "" if it's NULL when added. This gets rid of a corner case everything had to handle, but which rarely happened.
Diffstat (limited to 'demux/stheader.h')
-rw-r--r--demux/stheader.h51
1 files changed, 25 insertions, 26 deletions
diff --git a/demux/stheader.h b/demux/stheader.h
index c243eb921e..35be20885a 100644
--- a/demux/stheader.h
+++ b/demux/stheader.h
@@ -37,23 +37,8 @@ struct sh_stream {
int demuxer_id;
// FFmpeg stream index (AVFormatContext.streams[index]), or equivalent.
int ff_index;
- // One of these is non-NULL, the others are NULL, depending on the stream
- // type.
- struct sh_audio *audio;
- struct sh_video *video;
- struct sh_sub *sub;
- // E.g. "h264" (usually corresponds to AVCodecDescriptor.name)
- const char *codec;
-
- // Usually a FourCC, exact meaning depends on codec.
- unsigned int codec_tag;
-
- unsigned char *extradata; // codec specific per-stream header
- int extradata_size;
-
- // Codec specific header data (set by demux_lavf.c only)
- struct AVCodecContext *lav_headers;
+ struct mp_codec_params *codec;
char *title;
char *lang; // language code
@@ -70,29 +55,43 @@ struct sh_stream {
struct demux_stream *ds;
};
-typedef struct sh_audio {
+struct mp_codec_params {
+ enum stream_type type;
+
+ // E.g. "h264" (usually corresponds to AVCodecDescriptor.name)
+ const char *codec;
+
+ // Usually a FourCC, exact meaning depends on codec.
+ unsigned int codec_tag;
+
+ unsigned char *extradata; // codec specific per-stream header
+ int extradata_size;
+
+ // Codec specific header data (set by demux_lavf.c only)
+ struct AVCodecContext *lav_headers;
+
+ // STREAM_AUDIO
int samplerate;
struct mp_chmap channels;
bool force_channels;
int bitrate; // compressed bits/sec
int block_align;
- int bits_per_coded_sample;
struct replaygain_data *replaygain_data;
-} sh_audio_t;
-typedef struct sh_video {
+ // STREAM_VIDEO
bool avi_dts; // use DTS timing; first frame and DTS is 0
float fps; // frames per second (set only if constant fps)
int par_w, par_h; // pixel aspect ratio (0 if unknown/square)
- int bits_per_coded_sample;
int disp_w, disp_h; // display size
int rotate; // intended display rotation, in degrees, [0, 359]
int stereo_mode; // mp_stereo3d_mode (0 if none/unknown)
-} sh_video_t;
-typedef struct sh_sub {
- double frame_based; // timestamps are frame-based (and this is the
- // fallback framerate used for timestamps)
-} sh_sub_t;
+ // STREAM_VIDEO + STREAM_AUDIO
+ int bits_per_coded_sample;
+
+ // STREAM_SUB
+ double frame_based; // timestamps are frame-based (and this is the
+ // fallback framerate used for timestamps)
+};
#endif /* MPLAYER_STHEADER_H */