From 53d38278431987cc7c266e9fe84d481762bea47a Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 9 Nov 2013 23:22:15 +0100 Subject: 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. --- stream/tv.c | 11 +++++------ stream/tv.h | 1 - stream/tvi_v4l2.c | 7 ------- 3 files changed, 5 insertions(+), 14 deletions(-) (limited to 'stream') 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; -- cgit v1.2.3