summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-09 23:22:15 +0100
committerwm4 <wm4@nowhere>2013-11-09 23:32:58 +0100
commit53d38278431987cc7c266e9fe84d481762bea47a (patch)
tree675d6f2ebce175a7442724842d55f68fbe1aaf1b /stream
parent0ff863c1797c734dde8c1f99593a01cf5e1c15bc (diff)
downloadmpv-53d38278431987cc7c266e9fe84d481762bea47a.tar.bz2
mpv-53d38278431987cc7c266e9fe84d481762bea47a.tar.xz
Remove sh_audio->samplesize
This member was redundant. sh_audio->sample_format indicates the sample size already. The TV code is a bit strange: the redundant sample size was part of the internal TV interface. Assume it's really redundant and not something else. The PCM decoder ignores the sample size anyway.
Diffstat (limited to 'stream')
-rw-r--r--stream/tv.c11
-rw-r--r--stream/tv.h1
-rw-r--r--stream/tvi_v4l2.c7
3 files changed, 5 insertions, 14 deletions
diff --git a/stream/tv.c b/stream/tv.c
index 0e5fe8c22d..08bb11c6ce 100644
--- a/stream/tv.c
+++ b/stream/tv.c
@@ -794,8 +794,6 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLERATE,
&sh_audio->samplerate);
- funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_SAMPLESIZE,
- &sh_audio->samplesize);
int nchannels = sh_audio->channels.num;
funcs->control(tvh->priv, TVI_CONTROL_AUD_GET_CHANNELS,
&nchannels);
@@ -804,17 +802,18 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check)
sh_audio->gsh->codec = "mp-pcm";
sh_audio->format = audio_format;
+ int samplesize = af_fmt2bits(audio_format) / 8;
+
sh_audio->i_bps =
- sh_audio->samplerate * sh_audio->samplesize *
- sh_audio->channels.num;
+ sh_audio->samplerate * samplesize * sh_audio->channels.num;
// emulate WF for win32 codecs:
sh_audio->wf = malloc(sizeof(*sh_audio->wf));
sh_audio->wf->wFormatTag = sh_audio->format;
sh_audio->wf->nChannels = sh_audio->channels.num;
- sh_audio->wf->wBitsPerSample = sh_audio->samplesize * 8;
+ sh_audio->wf->wBitsPerSample = samplesize * 8;
sh_audio->wf->nSamplesPerSec = sh_audio->samplerate;
- sh_audio->wf->nBlockAlign = sh_audio->samplesize * sh_audio->channels.num;
+ sh_audio->wf->nBlockAlign = samplesize * sh_audio->channels.num;
sh_audio->wf->nAvgBytesPerSec = sh_audio->i_bps;
mp_tmsg(MSGT_DECVIDEO, MSGL_V, " TV audio: %d channels, %d bits, %d Hz\n",
diff --git a/stream/tv.h b/stream/tv.h
index ded9ace6c8..9cbc7ef652 100644
--- a/stream/tv.h
+++ b/stream/tv.h
@@ -188,7 +188,6 @@ typedef struct {
/* AUDIO controls */
#define TVI_CONTROL_AUD_GET_FORMAT 0x301
#define TVI_CONTROL_AUD_GET_SAMPLERATE 0x302
-#define TVI_CONTROL_AUD_GET_SAMPLESIZE 0x303
#define TVI_CONTROL_AUD_GET_CHANNELS 0x304
#define TVI_CONTROL_AUD_SET_SAMPLERATE 0x305
diff --git a/stream/tvi_v4l2.c b/stream/tvi_v4l2.c
index 5891ac4556..d99370d8dd 100644
--- a/stream/tvi_v4l2.c
+++ b/stream/tvi_v4l2.c
@@ -974,13 +974,6 @@ static int do_control(priv_t *priv, int cmd, void *arg)
mp_msg(MSGT_TV, MSGL_V, "%s: get audio samplerate: %d\n",
info.short_name, *(int *)arg);
return TVI_CONTROL_TRUE;
- case TVI_CONTROL_AUD_GET_SAMPLESIZE:
- init_audio(priv);
- if (!priv->audio_initialized) return TVI_CONTROL_FALSE;
- *(int *)arg = priv->audio_in.bytes_per_sample;
- mp_msg(MSGT_TV, MSGL_V, "%s: get audio samplesize: %d\n",
- info.short_name, *(int *)arg);
- return TVI_CONTROL_TRUE;
case TVI_CONTROL_AUD_GET_CHANNELS:
init_audio(priv);
if (!priv->audio_initialized) return TVI_CONTROL_FALSE;