All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Miartus, Adam (Arion Recruitment; ADITG/ESM)" <amiartus@de.adit-jv.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: [ALSA patch] FW: [PATCH - alsa-lib 1/4] pcm_file: add support for infile reading in non interleaved mode
Date: Tue, 21 May 2019 13:59:39 +0200	[thread overview]
Message-ID: <s5htvdo3tn8.wl-tiwai@suse.de> (raw)
In-Reply-To: <B174E9FCEE9A8C46B11E4DF2E329936277F460@HI2EXCH01.adit-jv.com>

On Tue, 21 May 2019 13:48:46 +0200,
Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
> 
> > On Mon, 20 May 2019 18:49:34 +0200,
> > Miartus, Adam (Arion Recruitment; ADITG/ESM) wrote:
> > >
> > > From: Adam Miartus <amiartus@de.adit-jv.com>
> > >
> > > add helper function to copy input file data to buffer mapped by areas, in
> > case of an error, do not fill the areas, allowing device read buffer to be
> > provided to api caller
> > >
> > > previously unused rbuf variable is reused for this purpose
> > >
> > > Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
> > > Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
> > >
> > > diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index
> > 3a19cef..7998b64 100644
> > > --- a/src/pcm/pcm_file.c
> > > +++ b/src/pcm/pcm_file.c
> > > @@ -77,6 +77,7 @@ typedef struct {
> > >  	snd_pcm_uframes_t appl_ptr;
> > >  	snd_pcm_uframes_t file_ptr_bytes;
> > >  	snd_pcm_uframes_t wbuf_size;
> > > +	snd_pcm_uframes_t rbuf_size;
> > >  	size_t wbuf_size_bytes;
> > >  	size_t wbuf_used_bytes;
> > >  	char *wbuf;
> > > @@ -266,6 +267,37 @@ static int
> > snd_pcm_file_open_output_file(snd_pcm_file_t *file)
> > >  	return 0;
> > >  }
> > >
> > > +/* fill areas with data from input file, return bytes red */ static int
> > > +snd_pcm_file_areas_read_infile(snd_pcm_t *pcm, const
> > snd_pcm_channel_area_t *areas,
> > > +	snd_pcm_uframes_t offset, snd_pcm_uframes_t frames) {
> > 
> > Please follow the standard coding style.
> > 
> > > +	snd_pcm_file_t *file = pcm->private_data;
> > > +	snd_pcm_channel_area_t areas_if[pcm->channels];
> > > +	ssize_t bytes;
> > > +
> > > +	if (file->ifd < 0)
> > > +		return -EBADF;
> > > +
> > > +	if (file->rbuf == NULL)
> > > +		return -ENOMEM;
> > > +
> > > +	if (file->rbuf_size < frames) {
> > > +		SYSERR("requested more frames than pcm buffer");
> > > +		return -ENOMEM;
> > > +	}
> > > +
> > > +	bytes = read(file->ifd, file->rbuf, snd_pcm_frames_to_bytes(pcm,
> > frames));
> > > +	if (bytes < 0) {
> > > +		SYSERR("read from file failed, error: %d", bytes);
> > > +		return bytes;
> > > +	}
> > > +
> > > +	snd_pcm_areas_from_buf(pcm, areas_if, file->rbuf);
> > > +	snd_pcm_areas_copy(areas, offset, areas_if, 0, pcm->channels,
> > > +snd_pcm_bytes_to_frames(pcm, bytes), pcm->format);
> > 
> > Wrong indentation.
> > 
> > 
> > thanks,
> > 
> > Takashi
> 
> Sorry, my email client messed up the whitespace. I re-sent the patch using git send-mail.

Could you resubmit the whole patch set, at best with a cover letter?


thanks,

Takashi

      reply	other threads:[~2019-05-21 11:59 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1558370831-15960-1-git-send-email-adam.miartus@gmail.com>
     [not found] ` <1558370831-15960-4-git-send-email-adam.miartus@gmail.com>
     [not found]   ` <B174E9FCEE9A8C46B11E4DF2E329936277F234@HI2EXCH01.adit-jv.com>
2019-05-21  8:23     ` [ALSA patch] [PATCH - alsa-lib 4/4] pcm_file: add infile read support for mmap mode Takashi Iwai
2019-05-21  8:37       ` Miartus, Adam (Arion Recruitment; ADITG/ESM)
2019-05-21  8:51         ` Takashi Iwai
2019-05-21  9:19           ` Takashi Sakamoto
2019-05-21 10:36           ` Miartus, Adam (Arion Recruitment; ADITG/ESM)
     [not found] ` <B174E9FCEE9A8C46B11E4DF2E329936277F1EC@HI2EXCH01.adit-jv.com>
2019-05-21  8:27   ` [ALSA patch] FW: [PATCH - alsa-lib 1/4] pcm_file: add support for infile reading in non interleaved mode Takashi Iwai
2019-05-21 11:48     ` Miartus, Adam (Arion Recruitment; ADITG/ESM)
2019-05-21 11:59       ` Takashi Iwai [this message]

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=s5htvdo3tn8.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=amiartus@de.adit-jv.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.