Re: [PATCH] aplay: Fix header for raw format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 3, 2017 at 1:14 PM, Takashi Iwai <tiwai@xxxxxxx> wrote:
> On Mon, 03 Jul 2017 11:41:44 +0200,
> Daniel Baluta wrote:
>>
>> On Fri, Jun 30, 2017 at 5:20 PM, Takashi Iwai <tiwai@xxxxxxx> wrote:
>> > On Fri, 30 Jun 2017 15:11:38 +0200,
>> > Daniel Baluta wrote:
>> >>
>> >> Hi Takashi,
>> >>
>> >> Thanks a lot for your feedback.
>> >>
>> >> On Fri, Jun 30, 2017 at 9:54 AM, Takashi Iwai <tiwai@xxxxxxx> wrote:
>> >> > On Thu, 29 Jun 2017 13:17:16 +0200,
>> >> > Ion-Horia Petrisor wrote:
>> >> >>
>> >> >> Raw format has no header, so use 0 when calling playback_go.
>> >> >
>> >> > It's the value passed for the length that has been already loaded.
>> >> > The program has read dta bytes for parsing the header, and it's raw
>> >> > data without header.  Thus you need to pass dta there.
>> >> >
>> >> With the current code we assume that the raw files have at least 26 bytes.
>> >> (sizeof (VocHeader).
>> >>
>> >> I think it doesn't matter here that dta bytes has already been loaded. These
>> >> bytes useful to figure out the file header type.
>> >>
>> >> To keep things simple we can assume that in the case of raw files there is no
>> >> header, so second parameter of playback_go (named loaded) can be set to 0.
>> >
>> > The loaded parameter of playback_go() doesn't mean that.  It's the
>> > size that has been already read onto the audio buffer.  If you pass 0
>> > there, it means that you discard the first 26 bytes samples you have
>> > already read without playing.
>>
>> Agree. Passing 0 discards the first 26 bytes that have already been read
>> but these bytes will be re-read inside playback_go so they will be played.
>>
>> playback_go( .. loaded = 0)
>> ..
>>
>> r = safe_read(fd, audio_buf + loaded, c). [aplay.c: 2757]
>
> No no, safe_read won't *re*-read.  It just reads the data after the
> point you've already read without seeking back.  So the first 26 bytes
> will be lost by your patch.

Oh, got it! Thanks for your patience.
_______________________________________________
Alsa-devel mailing list
Alsa-devel@xxxxxxxxxxxxxxxx
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel



[Index of Archives]     [ALSA User]     [Linux Audio Users]     [Kernel Archive]     [Asterisk PBX]     [Photo Sharing]     [Linux Sound]     [Video 4 Linux]     [Gimp]     [Yosemite News]

  Powered by Linux