summaryrefslogtreecommitdiffstats
path: root/demux/demux_raw.c
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/demux_raw.c
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/demux_raw.c')
-rw-r--r--demux/demux_raw.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/demux/demux_raw.c b/demux/demux_raw.c
index 5e492334ae..7fd9fdefa2 100644
--- a/demux/demux_raw.c
+++ b/demux/demux_raw.c
@@ -131,14 +131,14 @@ static int demux_rawaudio_open(demuxer_t *demuxer, enum demux_check check)
return -1;
struct sh_stream *sh = demux_alloc_sh_stream(STREAM_AUDIO);
- struct sh_audio *sh_audio = sh->audio;
- sh_audio->channels = opts->channels;
- sh_audio->force_channels = true;
- sh_audio->samplerate = opts->samplerate;
+ struct mp_codec_params *c = sh->codec;
+ c->channels = opts->channels;
+ c->force_channels = true;
+ c->samplerate = opts->samplerate;
int f = opts->aformat;
- // See PCM(): sign float bits endian
- mp_set_pcm_codec(sh, f & 1, f & 2, f >> 3, f & 4);
+ // See PCM(): sign float bits endian
+ mp_set_pcm_codec(sh->codec, f & 1, f & 2, f >> 3, f & 4);
int samplesize = ((f >> 3) + 7) / 8;
demux_add_sh_stream(demuxer, sh);
@@ -147,9 +147,9 @@ static int demux_rawaudio_open(demuxer_t *demuxer, enum demux_check check)
demuxer->priv = p;
*p = (struct priv) {
.sh = sh,
- .frame_size = samplesize * sh_audio->channels.num,
- .frame_rate = sh_audio->samplerate,
- .read_frames = sh_audio->samplerate / 8,
+ .frame_size = samplesize * c->channels.num,
+ .frame_rate = c->samplerate,
+ .read_frames = c->samplerate / 8,
};
return 0;
@@ -220,12 +220,12 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check)
}
struct sh_stream *sh = demux_alloc_sh_stream(STREAM_VIDEO);
- struct sh_video *sh_video = sh->video;
- sh->codec = decoder;
- sh->codec_tag = imgfmt;
- sh_video->fps = opts->fps;
- sh_video->disp_w = width;
- sh_video->disp_h = height;
+ struct mp_codec_params *c = sh->codec;
+ c->codec = decoder;
+ c->codec_tag = imgfmt;
+ c->fps = opts->fps;
+ c->disp_w = width;
+ c->disp_h = height;
demux_add_sh_stream(demuxer, sh);
struct priv *p = talloc_ptrtype(demuxer, p);
@@ -233,7 +233,7 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check)
*p = (struct priv) {
.sh = sh,
.frame_size = imgsize,
- .frame_rate = sh_video->fps,
+ .frame_rate = c->fps,
.read_frames = 1,
};