alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Richard Fitzgerald <rf@opensource.wolfsonmicro.com>
Cc: Vinod Koul <vinod.koul@intel.com>,
	jeeja.kp@intel.com, alsa-devel@alsa-project.org,
	broonie@opensource.wolfsonmicro.com, liam.r.girdwood@intel.com
Subject: Re: [RFC] compress: add support for gapless playback
Date: Thu, 07 Feb 2013 12:49:49 +0100	[thread overview]
Message-ID: <s5ha9rg738i.wl%tiwai@suse.de> (raw)
In-Reply-To: <20130207113738.GA15824@opensource.wolfsonmicro.com>

At Thu, 7 Feb 2013 11:37:38 +0000,
Richard Fitzgerald wrote:
> 
> > > 1) Send SNDRV_COMPRESS_NEXT_TRACK
> > > 2) Send SNDRV_COMPRESS_DRAIN
> > The problem would be in that case the defination of SNDRV_COMPRESS_DRAIN which
> > expects the decoder to completely drain its buffers and come to complete halt.
> > This would also mean the framework will treat a drained stream as stopped and
> > needs a new start. Certainly we dont want that in this case. So we can't use
> > SNDRV_COMPRESS_DRAIN to indicate. Yes we can put conditional check but IMO that
> > would overtly complicate this. If we are not doing proper drian lets not
> > call it that.
> 
> Ok, so let's keep the partial drain but split out the NEXT_TRACK hint so we keep
> the two operations separate. It's clearer to understand. NEXT_TRACK tells DSP to
> prepare for data for new track, PARTIAL_DRAIN asks DSP when it has played all
> data of current track. I don't think that application _must_ drain when doing
> gapless, only if it cares to know when DSP reaches the join between tracks.
> Possible problem - application calls NEXT_TRACK and PARTIAL_DRAIN when DSP has
> already reached end of current track, so what does PARTIAL_DRAIN mean in this
> case? Which track is it draining? Maybe define that it always refers to the
> track _before_ the most recent NEXT_TRACK call?
> 
> Also can we make metadata a key-pair list as Takashi suggested, with unlimited
> length. Something like
> 
> struct snd_compr_metadata_pair {
> 	enum snd_compr_metadata_key key;
> 	u32 value;
> };
> 
> struct snd_compr_metadata {
> 	int count; /* number of actual entries in following array */
> 	struct snd_compr_metadata_pair *pairs;
> };
> 
> Should we union the u32 value with a u8* buf to allow for any case where the
> value needs to be a buffer of binary data?

Oh no, don't do it.  Never.

In general,
 - Never put types that depending on the architecture in struct passed
   to ioctls (e.g. long, pointer)
 - Never use bit fields for ABI
 - If 64bit value is used, think of alignment; safer to add packed
   attribute

So, in general, use only u32, s16, or whatever, the types with
explicit size.


Takashi

  parent reply	other threads:[~2013-02-07 11:49 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-05 14:21 [RFC] compress: add support for gapless playback Vinod Koul
2013-02-06  2:44 ` Pierre-Louis Bossart
2013-02-06  7:54   ` Vinod Koul
2013-02-06 13:32     ` Mark Brown
2013-02-06 13:56       ` Vinod Koul
2013-02-06 13:59       ` Pierre-Louis Bossart
2013-02-06 14:00         ` Vinod Koul
2013-02-06 14:14   ` Takashi Iwai
2013-02-06 14:02     ` Vinod Koul
2013-02-06 14:33       ` Takashi Iwai
2013-02-06 14:11 ` Takashi Iwai
2013-02-06 14:09   ` Vinod Koul
2013-02-06 14:48     ` Takashi Iwai
2013-02-06 14:31       ` Vinod Koul
     [not found] ` <37A133201056E44A80888420ECA881BF1093DC5F68@EXCMB2.wolfsonmicro.main>
     [not found]   ` <20130207011518.GA30348@opensource.wolfsonmicro.com>
2013-02-07  2:18     ` Vinod Koul
2013-02-07  8:49       ` Takashi Iwai
2013-02-07 16:34         ` Vinod Koul
     [not found]         ` <20130207113738.GA15824@opensource.wolfsonmicro.com>
2013-02-07 11:49           ` Takashi Iwai [this message]
2013-02-07 16:51           ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5ha9rg738i.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=jeeja.kp@intel.com \
    --cc=liam.r.girdwood@intel.com \
    --cc=rf@opensource.wolfsonmicro.com \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).