Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: MythTV: Dev

Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru

 

 

MythTV dev RSS feed   Index | Next | Previous | View Threaded


lists at ebourne

Apr 1, 2006, 4:46 AM

Post #1 of 9 (2626 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru

On Sat, 01 Apr 2006 00:29:20 +0000, MythTV wrote:
> #1608: Proper Handling of Alsa AC3-PassThru
> -------------------------------+--------------------------------------------
> Reporter: msc [at] antzsystem | Owner: rkulagow
> Type: patch | Status: new
> Priority: minor | Milestone:
> Component: mythtv | Version: head
> Severity: medium |
> -------------------------------+--------------------------------------------
> Fixed ac3 pass thru code with help from mplayer code.
>
> Now the samples will be passed thru, only if passthru is enabled, to
> iec958 alsa plugin. This way all normal mpg stereo output can go to
> alsa:default (mostly pcm0 or dmix plugin or similar) and ac3 will be
> passed thru iec958 plugin.

No, that's not right. Your code forces the output on soundcard 0 whereas
my passtrhu output is on soundcard 1 for instance. My soundcard
(Soundblaster Live 24-bit External) doesn't need any special options set
for passthru, and I don't think even supports the iec958 plugin (I can
check and confirm that for certain if it helps).

Cheers,

Martin.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


msc at antzsystem

Apr 1, 2006, 6:17 AM

Post #2 of 9 (2540 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

Am Samstag, 1. April 2006 14:46 schrieb Martin Ebourne:
> On Sat, 01 Apr 2006 00:29:20 +0000, MythTV wrote:
> > #1608: Proper Handling of Alsa AC3-PassThru
> > -------------------------------+-----------------------------------
> >--------- Reporter: msc [at] antzsystem | Owner: rkulagow
> > Type: patch | Status: new
> > Priority: minor | Milestone:
> > Component: mythtv | Version: head
> > Severity: medium |
> > -------------------------------+-----------------------------------
> >--------- Fixed ac3 pass thru code with help from mplayer code.
> >
> > Now the samples will be passed thru, only if passthru is enabled,
> > to iec958 alsa plugin. This way all normal mpg stereo output can go
> > to alsa:default (mostly pcm0 or dmix plugin or similar) and ac3
> > will be passed thru iec958 plugin.
>
> No, that's not right. Your code forces the output on soundcard 0
> whereas my passtrhu output is on soundcard 1 for instance. My
> soundcard (Soundblaster Live 24-bit External) doesn't need any
> special options set for passthru, and I don't think even supports the
> iec958 plugin (I can check and confirm that for certain if it helps).

What have you configured as alsa output? ALSA:spdif? or similar alias?
IIrc the iec958 is used all the time if you pass thru, cause iec958 is
the sample format for sp/dif output. Check "aplay -L" for all
pcm-output device strings.

The problem is, that we should be sure to send normal uncompressed pcm
data to another pcm output then compressed ac3 streams. Best way will
be an additional input field (next to passthru checkbox) where you can
enter the alsa-pcm-device string for ac3 streams differently to
uncompressed pcm data.

Current SVN Code only appends the iec958 specific options ( ":{ AES0
0x02 }" ) to the device string you have been given. When this is
ALSA:default and default is pcm0 Out, this option is totally wrong and
results in errors.

--
Markus Schulz
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


lists at ebourne

Apr 1, 2006, 4:31 PM

Post #3 of 9 (2532 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

On Sat, 01 Apr 2006 16:17:05 +0200, Markus Schulz wrote:
> What have you configured as alsa output? ALSA:spdif? or similar alias?

No, I have AudioOutputDevice configured as 'ALSA:hw:1' which is direct to
the hardware.

> IIrc the iec958 is used all the time if you pass thru, cause iec958 is
> the sample format for sp/dif output. Check "aplay -L" for all pcm-output
> device strings.

No, my soundcard does not need iec958, it always sends all PCM sent to it
out through the s/pdif. Even in alsamixer there's only one control -
analogue output volume. I suspect this is more a limitation of the
snd_usb_audio driver than the sound card, but it works fine for PCM over
s/pdif and AC3/DTS passthru.

> The problem is, that we should be sure to send normal uncompressed pcm
> data to another pcm output then compressed ac3 streams.

This depends on hardware configuration and the user's preferences.

> Best way will be
> an additional input field (next to passthru checkbox) where you can
> enter the alsa-pcm-device string for ac3 streams differently to
> uncompressed pcm data.

I think this is the best solution. There appear to be several different
ways that s/pdif and passthru are implemented in ALSA, and a good many
more variations in people's setups, so I'm rapidly coming to the
conclusion that the only way to satisfy everyone is to make both
configurable independently.

> Current SVN Code only appends the iec958 specific options ( ":{ AES0
> 0x02
> }" ) to the device string you have been given. When this is ALSA:default
> and default is pcm0 Out, this option is totally wrong and results in
> errors.

Yes, I know. I submitted a patch a few days ago to workaround this fairly
recent change:
http://svn.mythtv.org/trac/ticket/1598

Although this makes the old cases work, and allows these other new cases
to work, I can now see there's other possibilities too which this does not
solve, hence the need for full control as you suggest.

Cheers,

Martin.

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


msc at antzsystem

Apr 1, 2006, 4:42 PM

Post #4 of 9 (2537 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

Am Sonntag, 2. April 2006 02:31 schrieb Martin Ebourne:
> On Sat, 01 Apr 2006 16:17:05 +0200, Markus Schulz wrote:
> > What have you configured as alsa output? ALSA:spdif? or similar
> > alias?
>
> No, I have AudioOutputDevice configured as 'ALSA:hw:1' which is
> direct to the hardware.

This means only that you are using soundcard 1. nothing more. All other
is controled from alsa (incl. asoundrc)

> > IIrc the iec958 is used all the time if you pass thru, cause iec958
> > is the sample format for sp/dif output. Check "aplay -L" for all
> > pcm-output device strings.
>
> No, my soundcard does not need iec958, it always sends all PCM sent
> to it out through the s/pdif. Even in alsamixer there's only one

can i please see a "aplay -l" and "aplay -L" from your card?
I can't imagine how a soundcard can pass thru uncompressed and
compressed data to sp/dif without setting the the correct channel
status bit (for the compressed IEC61937 datastream).
Cause, the receiver on the other side must detect if he can play the
data directly (uncompressed pcm) or must decode it. (AES0 0x02 means
exatly this).

> > Best way will be
> > an additional input field (next to passthru checkbox) where you can
> > enter the alsa-pcm-device string for ac3 streams differently to
> > uncompressed pcm data.
>
> I think this is the best solution. There appear to be several
> different ways that s/pdif and passthru are implemented in ALSA, and
> a good many more variations in people's setups, so I'm rapidly coming
> to the conclusion that the only way to satisfy everyone is to make
> both configurable independently.

ok,
but can you please test my patch with your hardware if you change the
iec958 Options String to: "iec958:{CARD 1 ..."


--
Markus Schulz

A: Because it breaks the logical sequence of discussion
Q: Why is top posting bad?

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


lists at ebourne

Apr 2, 2006, 3:33 PM

Post #5 of 9 (2522 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

On Sun, 02 Apr 2006 03:42:02 +0200, Markus Schulz wrote:
> can i please see a "aplay -l" and "aplay -L" from your card? I can't
> imagine how a soundcard can pass thru uncompressed and compressed data to
> sp/dif without setting the the correct channel status bit (for the
> compressed IEC61937 datastream). Cause, the receiver on the other side
> must detect if he can play the data directly (uncompressed pcm) or must
> decode it. (AES0 0x02 means exatly this).

See output below.

From what I've seen from experiments (when I implemented the DTS passthru
support in myth), my surround processor detects non-PCM mode from the
header at the start of every AC3/DTS packet sent over the PCM interface.
The data is compressed and still fits in a 48kHz/16 bit/2 channel
interface so the sound card is set the same, nothing special needs to be
done.

I guess the processor is safe to detect the header in a normal PCM stream
because such a sequence of values could never occur in normal sound
(excluding white noise).

> ok,
> but can you please test my patch with your hardware if you change the
> iec958 Options String to: "iec958:{CARD 1 ..."

Doesn't work. From log:

ALSA lib pcm.c:2099:(snd_pcm_open_noupdate) Unknown PCM iec958:{CARD 1 AES0 0x02
AES1 0x82 AES2 0x00 AES3 0x02}

Cheers,

Martin.

# aplay -l

**** List of PLAYBACK Hardware Devices ****
card 0: V8237 [VIA 8237], device 0: VIA 8237 [VIA 8237]
Subdevices: 4/4
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
card 0: V8237 [VIA 8237], device 1: VIA 8237 [VIA 8237]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: External [SB Live! 24-bit External], device 0: USB Audio [USB Audio]
Subdevices: 0/1
Subdevice #0: subdevice #0


# aplay -L
PCM list:
hw {
@args.0 CARD
@args.1 DEV
@args.2 SUBDEV
@args.CARD {
type string
default {
@func getenv
vars {
0 ALSA_PCM_CARD
1 ALSA_CARD
}
default {
@func refer
name 'defaults.pcm.card'
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars {
0 ALSA_PCM_DEVICE
}
default {
@func refer
name 'defaults.pcm.device'
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name 'defaults.pcm.subdevice'
}
}
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
plughw {
@args.0 CARD
@args.1 DEV
@args.2 SUBDEV
@args.CARD {
type string
default {
@func getenv
vars {
0 ALSA_PCM_CARD
1 ALSA_CARD
}
default {
@func refer
name 'defaults.pcm.card'
}
}
}
@args.DEV {
type integer
default {
@func igetenv
vars {
0 ALSA_PCM_DEVICE
}
default {
@func refer
name 'defaults.pcm.device'
}
}
}
@args.SUBDEV {
type integer
default {
@func refer
name 'defaults.pcm.subdevice'
}
}
type plug
slave.pcm {
type hw
card $CARD
device $DEV
subdevice $SUBDEV
}
}
plug {
@args.0 SLAVE
@args.SLAVE {
type string
}
type plug
slave.pcm $SLAVE
}
shm {
@args.0 SOCKET
@args.1 PCM
@args.SOCKET {
type string
}
@args.PCM {
type string
}
type shm
server $SOCKET
pcm $PCM
}
tee {
@args.0 SLAVE
@args.1 FILE
@args.2 FORMAT
@args.SLAVE {
type string
}
@args.FILE {
type string
}
@args.FORMAT {
type string
default raw
}
type file
slave.pcm $SLAVE
file $FILE
format $FORMAT
}
file {
@args.0 FILE
@args.1 FORMAT
@args.FILE {
type string
}
@args.FORMAT {
type string
default raw
}
type file
slave.pcm null
file $FILE
format $FORMAT
}
null {
type null
}
cards 'cards.pcm'
front 'cards.pcm.front'
rear 'cards.pcm.rear'
center_lfe 'cards.pcm.center_lfe'
side 'cards.pcm.side'
surround40 'cards.pcm.surround40'
surround41 'cards.pcm.surround41'
surround50 'cards.pcm.surround50'
surround51 'cards.pcm.surround51'
surround71 'cards.pcm.surround71'
iec958 'cards.pcm.iec958'
spdif 'cards.pcm.iec958'
modem 'cards.pcm.modem'
phoneline 'cards.pcm.phoneline'
dmix 'cards.pcm.dmix'
dsnoop 'cards.pcm.dsnoop'
default {
type hw
card 0
}

_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


maillists at whattf

Apr 4, 2006, 3:21 AM

Post #6 of 9 (2499 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

On Saturday 01 April 2006 15:17, Markus Schulz wrote:
> [...]
> Best way will
> be an additional input field (next to passthru checkbox) where you can
> enter the alsa-pcm-device string for ac3 streams differently to
> uncompressed pcm data.
>
This could very well form the basis of what I'd like from my MythTv system,
and in that sense properly implment pass-through on my system; the ability to
choice audio output device on the fly (or have two outputs active at a single
time).

I'm very close to replacing our main DVD player with a MythTv system, but the
audio is a problem:

- Most of the time (normally when my wife and kids watch DVDs; or when the
kids are in bed) having non-passtrough and the stereo output from the TV is
just fine.

- However, at other times, I like to use our 5.1 system to get the best
experience.

So what I'd like is an easy way to switch between the two (or have normal
stereo output even when using pass-through), rather than needing to enter the
setup screens and changes device names and options. An option in the playback
menu would be ideal.

I've mucked around with all kinds of ALSA config, and can't get what I'd like.
I'm almost convinced my onboard soundcard (ALC850 based I believe; machine is
off and at home) can't successful provide stereo output whilst doing
pass-through (or the ALSA drivers don't support it or has missing/buggy
controls).

I've also tried experimenting with things in NuppelVideoPlayer.cpp,
tv_play.cpp and audiooutputalsa.cpp and can't quite force enough of a context
change to reinitialise the audio properly on device change to successfully
switch between two working device configurations. (I was hooking into
NuppelVideoPlayer::Pause() to attempt the toggle).

If you'd be willing to implement this, then great, otherwise any hints you
could give to allow me to implement/hack it locally would be glady welcomed.

Cheers,

Simon.,
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


mtdean at thirdcontact

Apr 4, 2006, 3:26 PM

Post #7 of 9 (2476 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

On 04/04/2006 06:21 AM, Simon Levitt wrote:

>So what I'd like is an easy way to switch between the two (or have normal
>stereo output even when using pass-through), rather than needing to enter the
>setup screens and changes device names and options. An option in the playback
>menu would be ideal.
>
>

Being able to choose the device (instead of using one device for
everything) would be nice--i.e. like xine provides a means of specifying
different devices for mono (alsa_default_device), stereo
(alsa_front_device), passthrough (alsa_passthrough_device), 4-channel
(alsa_surround40_device), and 5.1 (alsa_surround51_device). However, I
think they should be placed in playback groups. You could then create a
group for HDTV playback (with 5.1), one for NTSC playback (with stereo),
etc.

Mike
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


richard at interlink

Apr 4, 2006, 7:14 PM

Post #8 of 9 (2458 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

What would be nice as a future feature is allow transcoding of say an AC3
2.0 Dolby Prologic (Surround) encoded audio stream into an AC3 5.1 Dolby
Digital stream/DTS 5.1stream.

Why:
In Australia, most of the DVB-T is broadcast as AC3 2.0 - a complete waste
of my 5.1 system when the stream includes rear effect speaker, and requires
lots of extra button pushing to workaround.

When I watch a normal TV recording, I have to change my Amplifier to a Dolby
Prologic mode.
When I watch a normal TV music-related recording, I have to change my
Amplifier to Stereo (or Automatic mode)
When I listen to music I have to set my Amplifier to Stereo (or Automatic
mode)
When I watch a DVD I have to my Amplifier to Stereo (or Automatic mode)
When I watch a Video (Mythvideo) I have to change my Amplifier to a Dolby
Prologic mode.

What would be nice:
Sound is automatically transcoded (hopefully real-time) to the way I want to
listen to it.

A closed-source resource in this area is:
http://hypercube.is.dreaming.org/

Cheers,
Richard.


_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev


adeffs.mythtv at gmail

Apr 4, 2006, 7:21 PM

Post #9 of 9 (2473 views)
Permalink
Re: [mythtv-commits] Ticket #1608: Proper Handling of Alsa AC3-PassThru [In reply to]

On 4/4/06, Richard Dale <richard [at] interlink> wrote:
> What would be nice as a future feature is allow transcoding of say an AC3
> 2.0 Dolby Prologic (Surround) encoded audio stream into an AC3 5.1 Dolby
> Digital stream/DTS 5.1stream.
>
> Why:
> In Australia, most of the DVB-T is broadcast as AC3 2.0 - a complete waste
> of my 5.1 system when the stream includes rear effect speaker, and requires
> lots of extra button pushing to workaround.
>
> When I watch a normal TV recording, I have to change my Amplifier to a Dolby
> Prologic mode.
> When I watch a normal TV music-related recording, I have to change my
> Amplifier to Stereo (or Automatic mode)
> When I listen to music I have to set my Amplifier to Stereo (or Automatic
> mode)
> When I watch a DVD I have to my Amplifier to Stereo (or Automatic mode)
> When I watch a Video (Mythvideo) I have to change my Amplifier to a Dolby
> Prologic mode.
>
> What would be nice:
> Sound is automatically transcoded (hopefully real-time) to the way I want to
> listen to it.
>
> A closed-source resource in this area is:
> http://hypercube.is.dreaming.org/
>
> Cheers,
> Richard.

the fellow that wrote the code that allows timstretch to work with AC3
said that doing this should not be an issue with the code he wrote,
its just a matter of putting it all together for this. It just takes a
dev to put a patch together.

--
Steve
_______________________________________________
mythtv-dev mailing list
mythtv-dev [at] mythtv
http://mythtv.org/cgi-bin/mailman/listinfo/mythtv-dev

MythTV dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.