2005-09-22 18:47:04 +00:00
|
|
|
/*
|
|
|
|
* ALAC (Apple Lossless Audio Codec) decoder
|
|
|
|
* Copyright (c) 2005 David Hammerton
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This is the quicktime container demuxer.
|
|
|
|
*
|
|
|
|
* http://crazney.net/programs/itunes/alac.html
|
|
|
|
*
|
|
|
|
* Permission is hereby granted, free of charge, to any person
|
|
|
|
* obtaining a copy of this software and associated documentation
|
|
|
|
* files (the "Software"), to deal in the Software without
|
|
|
|
* restriction, including without limitation the rights to use,
|
|
|
|
* copy, modify, merge, publish, distribute, sublicense, and/or
|
|
|
|
* sell copies of the Software, and to permit persons to whom the
|
|
|
|
* Software is furnished to do so, subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice shall be
|
|
|
|
* included in all copies or substantial portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
|
|
|
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
|
|
|
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
|
|
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
|
|
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
|
|
|
* OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <string.h>
|
2005-09-22 20:46:58 +00:00
|
|
|
#include <inttypes.h>
|
2005-09-22 18:47:04 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
#include "codeclib.h"
|
2005-09-22 20:46:58 +00:00
|
|
|
|
2005-10-29 17:12:52 +00:00
|
|
|
#include "m4a.h"
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2008-11-20 11:27:31 +00:00
|
|
|
#undef DEBUGF
|
2010-06-21 16:53:00 +00:00
|
|
|
#if defined(DEBUG)
|
2005-10-31 20:50:32 +00:00
|
|
|
#define DEBUGF qtmovie->stream->ci->debugf
|
|
|
|
#else
|
|
|
|
#define DEBUGF(...)
|
|
|
|
#endif
|
|
|
|
|
2005-09-22 18:47:04 +00:00
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
stream_t *stream;
|
|
|
|
demux_res_t *res;
|
|
|
|
} qtmovie_t;
|
|
|
|
|
|
|
|
|
|
|
|
/* chunk handlers */
|
|
|
|
static void read_chunk_ftyp(qtmovie_t *qtmovie, size_t chunk_len)
|
|
|
|
{
|
|
|
|
fourcc_t type;
|
|
|
|
uint32_t minor_ver;
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
type = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining-=4;
|
2005-11-02 14:01:27 +00:00
|
|
|
if ((type != MAKEFOURCC('M','4','A',' ')) &&
|
2006-12-07 09:24:31 +00:00
|
|
|
(type != MAKEFOURCC('M','4','B',' ')) &&
|
2006-10-11 17:02:23 +00:00
|
|
|
(type != MAKEFOURCC('m','p','4','2')) &&
|
|
|
|
(type != MAKEFOURCC('3','g','p','6')) &&
|
2009-11-22 16:37:36 +00:00
|
|
|
(type != MAKEFOURCC('q','t',' ',' ')) &&
|
|
|
|
(type != MAKEFOURCC('i','s','o','m')))
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("not M4A file\n");
|
2005-09-22 18:47:04 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
minor_ver = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining-=4;
|
|
|
|
|
|
|
|
/* compatible brands */
|
|
|
|
while (size_remaining)
|
|
|
|
{
|
|
|
|
/* unused */
|
|
|
|
/*fourcc_t cbrand =*/ stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining-=4;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-12-29 19:49:48 +00:00
|
|
|
static uint32_t mp4ff_read_mp4_descr_length(stream_t* stream)
|
2005-10-31 20:50:32 +00:00
|
|
|
{
|
|
|
|
uint8_t b;
|
|
|
|
uint8_t numBytes = 0;
|
|
|
|
uint32_t length = 0;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
|
|
|
b = stream_read_uint8(stream);
|
|
|
|
numBytes++;
|
|
|
|
length = (length << 7) | (b & 0x7F);
|
|
|
|
} while ((b & 0x80) && numBytes < 4);
|
|
|
|
|
|
|
|
return length;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The following function is based on mp4ff */
|
|
|
|
static bool read_chunk_esds(qtmovie_t *qtmovie, size_t chunk_len)
|
|
|
|
{
|
|
|
|
uint8_t tag;
|
|
|
|
uint32_t temp;
|
|
|
|
int audioType;
|
|
|
|
int32_t maxBitrate;
|
|
|
|
int32_t avgBitrate;
|
|
|
|
|
2005-10-31 21:46:50 +00:00
|
|
|
(void)chunk_len;
|
2005-10-31 20:50:32 +00:00
|
|
|
/* version and flags */
|
|
|
|
temp=stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
/* get and verify ES_DescrTag */
|
|
|
|
tag = stream_read_uint8(qtmovie->stream);
|
|
|
|
if (tag == 0x03)
|
|
|
|
{
|
|
|
|
/* read length */
|
|
|
|
if (mp4ff_read_mp4_descr_length(qtmovie->stream) < 5 + 15)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
/* skip 3 bytes */
|
|
|
|
stream_skip(qtmovie->stream,3);
|
|
|
|
} else {
|
|
|
|
/* skip 2 bytes */
|
|
|
|
stream_skip(qtmovie->stream,2);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* get and verify DecoderConfigDescrTab */
|
|
|
|
if (stream_read_uint8(qtmovie->stream) != 0x04)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read length */
|
|
|
|
temp = mp4ff_read_mp4_descr_length(qtmovie->stream);
|
|
|
|
if (temp < 13) return false;
|
|
|
|
|
|
|
|
audioType = stream_read_uint8(qtmovie->stream);
|
|
|
|
temp=stream_read_int32(qtmovie->stream);//0x15000414 ????
|
|
|
|
maxBitrate = stream_read_int32(qtmovie->stream);
|
|
|
|
avgBitrate = stream_read_int32(qtmovie->stream);
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("audioType=%d, maxBitrate=%ld, avgBitrate=%ld\n",audioType,
|
|
|
|
(long)maxBitrate,(long)avgBitrate);
|
2005-10-31 20:50:32 +00:00
|
|
|
|
|
|
|
/* get and verify DecSpecificInfoTag */
|
|
|
|
if (stream_read_uint8(qtmovie->stream) != 0x05)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* read length */
|
|
|
|
qtmovie->res->codecdata_len = mp4ff_read_mp4_descr_length(qtmovie->stream);
|
2007-12-01 01:01:35 +00:00
|
|
|
if (qtmovie->res->codecdata_len > MAX_CODECDATA_SIZE)
|
2005-10-31 20:50:32 +00:00
|
|
|
{
|
2007-12-01 01:01:35 +00:00
|
|
|
DEBUGF("codecdata too large (%d) in esds\n",
|
|
|
|
(int)qtmovie->res->codecdata_len);
|
|
|
|
return false;
|
2005-10-31 20:50:32 +00:00
|
|
|
}
|
|
|
|
|
2007-12-01 01:01:35 +00:00
|
|
|
stream_read(qtmovie->stream, qtmovie->res->codecdata_len, qtmovie->res->codecdata);
|
|
|
|
|
2005-10-31 20:50:32 +00:00
|
|
|
/* will skip the remainder of the atom */
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2005-09-24 11:56:36 +00:00
|
|
|
static bool read_chunk_stsd(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
2005-10-31 20:50:32 +00:00
|
|
|
int j;
|
2005-09-22 18:47:04 +00:00
|
|
|
uint32_t numentries;
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
/* version */
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
size_remaining -= 1;
|
|
|
|
/* flags */
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
size_remaining -= 3;
|
|
|
|
|
|
|
|
numentries = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
if (numentries != 1)
|
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("only expecting one entry in sample description atom!\n");
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < numentries; i++)
|
|
|
|
{
|
|
|
|
uint32_t entry_size;
|
|
|
|
|
|
|
|
uint32_t entry_remaining;
|
|
|
|
|
|
|
|
entry_size = stream_read_uint32(qtmovie->stream);
|
|
|
|
qtmovie->res->format = stream_read_uint32(qtmovie->stream);
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("format: %c%c%c%c\n",SPLITFOURCC(qtmovie->res->format));
|
2005-09-22 18:47:04 +00:00
|
|
|
entry_remaining = entry_size;
|
|
|
|
entry_remaining -= 8;
|
|
|
|
|
|
|
|
/* sound info: */
|
|
|
|
|
2006-10-11 17:02:23 +00:00
|
|
|
/* reserved + data reference index + sound version + reserved */
|
|
|
|
stream_skip(qtmovie->stream, 6 + 2 + 2 + 6);
|
|
|
|
entry_remaining -= 6 + 2 + 2 + 6;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
qtmovie->res->num_channels = stream_read_uint16(qtmovie->stream);
|
2006-10-11 17:02:23 +00:00
|
|
|
qtmovie->res->sound_sample_size = stream_read_uint16(qtmovie->stream);
|
2005-09-22 18:47:04 +00:00
|
|
|
entry_remaining -= 4;
|
|
|
|
|
|
|
|
/* packet size */
|
|
|
|
stream_skip(qtmovie->stream, 2);
|
2006-10-11 17:02:23 +00:00
|
|
|
qtmovie->res->sound_sample_rate = stream_read_uint32(qtmovie->stream);
|
|
|
|
/* reserved size */
|
|
|
|
stream_skip(qtmovie->stream, 2);
|
|
|
|
entry_remaining -= 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2005-10-31 20:50:32 +00:00
|
|
|
/* remaining is codec data */
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2005-10-31 20:50:32 +00:00
|
|
|
if ((qtmovie->res->format==MAKEFOURCC('a','l','a','c'))) {
|
2009-07-27 12:13:22 +00:00
|
|
|
if (qtmovie->stream->ci->id3->codectype!=AFMT_MP4_ALAC) {
|
2005-10-31 20:50:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 12 = audio format atom, 8 = padding */
|
|
|
|
qtmovie->res->codecdata_len = entry_remaining + 12 + 8;
|
2007-12-01 01:01:35 +00:00
|
|
|
if (qtmovie->res->codecdata_len > MAX_CODECDATA_SIZE)
|
2006-11-08 19:54:08 +00:00
|
|
|
{
|
2009-11-19 17:12:58 +00:00
|
|
|
DEBUGF("codecdata too large (%d) in stsd\n",
|
|
|
|
(int)qtmovie->res->codecdata_len);
|
|
|
|
return false;
|
2006-11-08 19:54:08 +00:00
|
|
|
}
|
|
|
|
|
2005-10-31 20:50:32 +00:00
|
|
|
memset(qtmovie->res->codecdata, 0, qtmovie->res->codecdata_len);
|
|
|
|
/* audio format atom */
|
2007-12-01 01:01:35 +00:00
|
|
|
#if 0
|
|
|
|
/* The ALAC decoder skips these bytes, so there is no need to store them,
|
|
|
|
and this code isn't endian/alignment safe */
|
2005-10-31 20:50:32 +00:00
|
|
|
((unsigned int*)qtmovie->res->codecdata)[0] = 0x0c000000;
|
|
|
|
((unsigned int*)qtmovie->res->codecdata)[1] = MAKEFOURCC('a','m','r','f');
|
|
|
|
((unsigned int*)qtmovie->res->codecdata)[2] = MAKEFOURCC('c','a','l','a');
|
2007-12-01 01:01:35 +00:00
|
|
|
#endif
|
2005-10-31 20:50:32 +00:00
|
|
|
|
|
|
|
stream_read(qtmovie->stream,
|
|
|
|
entry_remaining,
|
|
|
|
((char*)qtmovie->res->codecdata) + 12);
|
|
|
|
entry_remaining -= entry_remaining;
|
|
|
|
|
|
|
|
if (entry_remaining)
|
|
|
|
stream_skip(qtmovie->stream, entry_remaining);
|
|
|
|
|
|
|
|
} else if (qtmovie->res->format==MAKEFOURCC('m','p','4','a')) {
|
2009-07-27 12:13:22 +00:00
|
|
|
if (qtmovie->stream->ci->id3->codectype!=AFMT_MP4_AAC) {
|
2005-10-31 20:50:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
size_t sub_chunk_len;
|
|
|
|
fourcc_t sub_chunk_id;
|
|
|
|
|
|
|
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
|
|
|
if (sub_chunk_len <= 1 || sub_chunk_len > entry_remaining)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("strange size (%lu) for chunk inside mp4a\n",
|
|
|
|
(unsigned long)sub_chunk_len);
|
2005-10-31 20:50:32 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
if (sub_chunk_id != MAKEFOURCC('e','s','d','s'))
|
|
|
|
{
|
|
|
|
DEBUGF("Expected esds chunk inside mp4a, found %c%c%c%c\n",SPLITFOURCC(sub_chunk_id));
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
j=qtmovie->stream->ci->curpos+sub_chunk_len-8;
|
|
|
|
if (read_chunk_esds(qtmovie,sub_chunk_len)) {
|
|
|
|
if (j!=qtmovie->stream->ci->curpos) {
|
2007-03-17 09:54:28 +00:00
|
|
|
DEBUGF("curpos=%ld, j=%d - Skipping %ld bytes\n",qtmovie->stream->ci->curpos,j,j-qtmovie->stream->ci->curpos);
|
2005-10-31 20:50:32 +00:00
|
|
|
stream_skip(qtmovie->stream,j-qtmovie->stream->ci->curpos);
|
|
|
|
}
|
|
|
|
entry_remaining-=sub_chunk_len;
|
|
|
|
} else {
|
|
|
|
DEBUGF("Error reading esds\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("entry_remaining=%ld\n",(long)entry_remaining);
|
2005-10-31 20:50:32 +00:00
|
|
|
stream_skip(qtmovie->stream,entry_remaining);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
DEBUGF("expecting 'alac' or 'mp4a' data format, got %c%c%c%c\n",
|
|
|
|
SPLITFOURCC(qtmovie->res->format));
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
static bool read_chunk_stts(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
uint32_t numentries;
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
/* version */
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
size_remaining -= 1;
|
|
|
|
/* flags */
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
size_remaining -= 3;
|
|
|
|
|
|
|
|
numentries = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
qtmovie->res->num_time_to_samples = numentries;
|
|
|
|
qtmovie->res->time_to_sample = malloc(numentries * sizeof(*qtmovie->res->time_to_sample));
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!qtmovie->res->time_to_sample)
|
|
|
|
{
|
|
|
|
DEBUGF("stts too large\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-09-22 18:47:04 +00:00
|
|
|
for (i = 0; i < numentries; i++)
|
|
|
|
{
|
|
|
|
qtmovie->res->time_to_sample[i].sample_count = stream_read_uint32(qtmovie->stream);
|
|
|
|
qtmovie->res->time_to_sample[i].sample_duration = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 8;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size_remaining)
|
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("ehm, size remianing?\n");
|
2005-09-22 18:47:04 +00:00
|
|
|
stream_skip(qtmovie->stream, size_remaining);
|
|
|
|
}
|
2006-11-08 19:54:08 +00:00
|
|
|
|
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
static bool read_chunk_stsz(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
uint32_t numentries;
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
/* version */
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
size_remaining -= 1;
|
|
|
|
/* flags */
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
stream_read_uint8(qtmovie->stream);
|
|
|
|
size_remaining -= 3;
|
|
|
|
|
|
|
|
/* default sample size */
|
|
|
|
if (stream_read_uint32(qtmovie->stream) != 0)
|
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("i was expecting variable samples sizes\n");
|
2005-09-22 18:47:04 +00:00
|
|
|
stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
2006-11-08 19:54:08 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
numentries = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
qtmovie->res->num_sample_byte_sizes = numentries;
|
|
|
|
qtmovie->res->sample_byte_size = malloc(numentries * sizeof(*qtmovie->res->sample_byte_size));
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!qtmovie->res->sample_byte_size)
|
|
|
|
{
|
|
|
|
DEBUGF("stsz too large\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2005-09-22 18:47:04 +00:00
|
|
|
for (i = 0; i < numentries; i++)
|
|
|
|
{
|
2006-11-08 19:54:08 +00:00
|
|
|
uint32_t v = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
if (v > 0x0000ffff)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("stsz[%d] > 65 kB (%ld)\n", i, (long)v);
|
2006-11-08 19:54:08 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
qtmovie->res->sample_byte_size[i] = v;
|
2005-09-22 18:47:04 +00:00
|
|
|
size_remaining -= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size_remaining)
|
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("ehm, size remianing?\n");
|
2005-09-22 18:47:04 +00:00
|
|
|
stream_skip(qtmovie->stream, size_remaining);
|
|
|
|
}
|
2006-11-08 19:54:08 +00:00
|
|
|
|
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
static bool read_chunk_stsc(qtmovie_t *qtmovie, size_t chunk_len)
|
2006-10-11 17:02:23 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
uint32_t numentries;
|
|
|
|
size_t size_remaining = chunk_len - 8;
|
|
|
|
|
|
|
|
/* version + flags */
|
|
|
|
stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
numentries = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
qtmovie->res->num_sample_to_chunks = numentries;
|
|
|
|
qtmovie->res->sample_to_chunk = malloc(numentries *
|
|
|
|
sizeof(*qtmovie->res->sample_to_chunk));
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!qtmovie->res->sample_to_chunk)
|
|
|
|
{
|
|
|
|
DEBUGF("stsc too large\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-10-11 17:02:23 +00:00
|
|
|
for (i = 0; i < numentries; i++)
|
|
|
|
{
|
|
|
|
qtmovie->res->sample_to_chunk[i].first_chunk =
|
|
|
|
stream_read_uint32(qtmovie->stream);
|
|
|
|
qtmovie->res->sample_to_chunk[i].num_samples =
|
|
|
|
stream_read_uint32(qtmovie->stream);
|
|
|
|
stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 12;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size_remaining)
|
|
|
|
{
|
|
|
|
DEBUGF("ehm, size remianing?\n");
|
|
|
|
stream_skip(qtmovie->stream, size_remaining);
|
|
|
|
}
|
2006-11-08 19:54:08 +00:00
|
|
|
|
|
|
|
return true;
|
2006-10-11 17:02:23 +00:00
|
|
|
}
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
|
2006-10-11 17:02:23 +00:00
|
|
|
{
|
|
|
|
unsigned int i;
|
|
|
|
uint32_t numentries;
|
|
|
|
size_t size_remaining = chunk_len - 8;
|
|
|
|
|
|
|
|
/* version + flags */
|
|
|
|
stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
numentries = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
|
|
|
|
qtmovie->res->num_chunk_offsets = numentries;
|
|
|
|
qtmovie->res->chunk_offset = malloc(numentries *
|
|
|
|
sizeof(*qtmovie->res->chunk_offset));
|
|
|
|
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!qtmovie->res->chunk_offset)
|
|
|
|
{
|
|
|
|
DEBUGF("stco too large\n");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2006-10-11 17:02:23 +00:00
|
|
|
for (i = 0; i < numentries; i++)
|
|
|
|
{
|
|
|
|
qtmovie->res->chunk_offset[i] = stream_read_uint32(qtmovie->stream);
|
|
|
|
size_remaining -= 4;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size_remaining)
|
|
|
|
{
|
|
|
|
DEBUGF("ehm, size remianing?\n");
|
|
|
|
stream_skip(qtmovie->stream, size_remaining);
|
|
|
|
}
|
2006-11-08 19:54:08 +00:00
|
|
|
|
|
|
|
return true;
|
2006-10-11 17:02:23 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 11:56:36 +00:00
|
|
|
static bool read_chunk_stbl(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
while (size_remaining)
|
|
|
|
{
|
|
|
|
size_t sub_chunk_len;
|
|
|
|
fourcc_t sub_chunk_id;
|
|
|
|
|
|
|
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
|
|
|
if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("strange size (%lu) for chunk inside stbl\n",
|
|
|
|
(unsigned long)sub_chunk_len);
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
switch (sub_chunk_id)
|
|
|
|
{
|
|
|
|
case MAKEFOURCC('s','t','s','d'):
|
2005-09-24 11:56:36 +00:00
|
|
|
if (!read_chunk_stsd(qtmovie, sub_chunk_len)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
case MAKEFOURCC('s','t','t','s'):
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!read_chunk_stts(qtmovie, sub_chunk_len))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
case MAKEFOURCC('s','t','s','z'):
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!read_chunk_stsz(qtmovie, sub_chunk_len))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
case MAKEFOURCC('s','t','s','c'):
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!read_chunk_stsc(qtmovie, sub_chunk_len))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2006-10-11 17:02:23 +00:00
|
|
|
break;
|
2005-09-22 18:47:04 +00:00
|
|
|
case MAKEFOURCC('s','t','c','o'):
|
2006-11-08 19:54:08 +00:00
|
|
|
if (!read_chunk_stco(qtmovie, sub_chunk_len))
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-12-06 21:37:36 +00:00
|
|
|
/*DEBUGF("(stbl) unknown chunk id: %c%c%c%c\n",
|
|
|
|
SPLITFOURCC(sub_chunk_id));*/
|
2006-10-11 17:02:23 +00:00
|
|
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_remaining -= sub_chunk_len;
|
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 11:56:36 +00:00
|
|
|
static bool read_chunk_minf(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-11-02 14:01:27 +00:00
|
|
|
uint32_t i;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2006-12-06 21:37:36 +00:00
|
|
|
/* Check for smhd, only kind of minf we care about */
|
|
|
|
|
|
|
|
if ((i = stream_read_uint32(qtmovie->stream)) != 16)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("unexpected size in media info: %ld\n", (long)i);
|
2005-11-02 14:01:27 +00:00
|
|
|
stream_skip(qtmovie->stream, size_remaining-4);
|
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
2006-12-06 21:37:36 +00:00
|
|
|
|
2005-09-22 18:47:04 +00:00
|
|
|
if (stream_read_uint32(qtmovie->stream) != MAKEFOURCC('s','m','h','d'))
|
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
DEBUGF("not a sound header! can't handle this.\n");
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
2006-12-06 21:37:36 +00:00
|
|
|
|
|
|
|
/* now skip the rest of the atom */
|
2005-09-22 18:47:04 +00:00
|
|
|
stream_skip(qtmovie->stream, 16 - 8);
|
|
|
|
size_remaining -= 16;
|
|
|
|
|
2006-12-06 21:37:36 +00:00
|
|
|
while (size_remaining)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2006-12-06 21:37:36 +00:00
|
|
|
size_t sub_chunk_len;
|
|
|
|
fourcc_t sub_chunk_id;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2006-12-06 21:37:36 +00:00
|
|
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2006-12-06 21:37:36 +00:00
|
|
|
if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("strange size (%lu) for chunk inside minf\n",
|
|
|
|
(unsigned long)sub_chunk_len);
|
2006-12-06 21:37:36 +00:00
|
|
|
return false;
|
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
|
2006-12-06 21:37:36 +00:00
|
|
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
switch (sub_chunk_id)
|
|
|
|
{
|
|
|
|
case MAKEFOURCC('s','t','b','l'):
|
|
|
|
if (!read_chunk_stbl(qtmovie, sub_chunk_len)) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/*DEBUGF("(minf) unknown chunk id: %c%c%c%c\n",
|
|
|
|
SPLITFOURCC(sub_chunk_id));*/
|
|
|
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
|
|
|
break;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2006-12-06 21:37:36 +00:00
|
|
|
size_remaining -= sub_chunk_len;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
2005-09-24 11:56:36 +00:00
|
|
|
static bool read_chunk_mdia(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
while (size_remaining)
|
|
|
|
{
|
|
|
|
size_t sub_chunk_len;
|
|
|
|
fourcc_t sub_chunk_id;
|
|
|
|
|
|
|
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
|
|
|
if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("strange size (%lu) for chunk inside mdia\n",
|
|
|
|
(unsigned long)sub_chunk_len);
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
switch (sub_chunk_id)
|
|
|
|
{
|
|
|
|
case MAKEFOURCC('m','i','n','f'):
|
2005-09-24 11:56:36 +00:00
|
|
|
if (!read_chunk_minf(qtmovie, sub_chunk_len)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-11-08 19:54:08 +00:00
|
|
|
/*DEBUGF("(mdia) unknown chunk id: %c%c%c%c\n",
|
|
|
|
SPLITFOURCC(sub_chunk_id));*/
|
2005-11-02 14:01:27 +00:00
|
|
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
2006-11-08 19:54:08 +00:00
|
|
|
break;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_remaining -= sub_chunk_len;
|
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 'trak' - a movie track - contains other atoms */
|
2005-09-24 11:56:36 +00:00
|
|
|
static bool read_chunk_trak(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
while (size_remaining)
|
|
|
|
{
|
|
|
|
size_t sub_chunk_len;
|
|
|
|
fourcc_t sub_chunk_id;
|
|
|
|
|
|
|
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
|
|
|
if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("strange size (%lu) for chunk inside trak\n",
|
|
|
|
(unsigned long)sub_chunk_len);
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
switch (sub_chunk_id)
|
|
|
|
{
|
|
|
|
case MAKEFOURCC('m','d','i','a'):
|
2005-09-24 11:56:36 +00:00
|
|
|
if (!read_chunk_mdia(qtmovie, sub_chunk_len)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-11-08 19:54:08 +00:00
|
|
|
/*DEBUGF("(trak) unknown chunk id: %c%c%c%c\n",
|
|
|
|
SPLITFOURCC(sub_chunk_id));*/
|
2005-09-24 02:12:42 +00:00
|
|
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
|
|
|
break;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_remaining -= sub_chunk_len;
|
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 'moov' movie atom - contains other atoms */
|
2005-09-24 11:56:36 +00:00
|
|
|
static bool read_chunk_moov(qtmovie_t *qtmovie, size_t chunk_len)
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
while (size_remaining)
|
|
|
|
{
|
|
|
|
size_t sub_chunk_len;
|
|
|
|
fourcc_t sub_chunk_id;
|
|
|
|
|
|
|
|
sub_chunk_len = stream_read_uint32(qtmovie->stream);
|
|
|
|
if (sub_chunk_len <= 1 || sub_chunk_len > size_remaining)
|
|
|
|
{
|
2007-03-17 10:50:58 +00:00
|
|
|
DEBUGF("strange size (%lu) for chunk inside moov\n",
|
|
|
|
(unsigned long)sub_chunk_len);
|
2005-09-24 11:56:36 +00:00
|
|
|
return false;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
sub_chunk_id = stream_read_uint32(qtmovie->stream);
|
|
|
|
|
|
|
|
switch (sub_chunk_id)
|
|
|
|
{
|
|
|
|
case MAKEFOURCC('t','r','a','k'):
|
2005-09-24 11:56:36 +00:00
|
|
|
if (!read_chunk_trak(qtmovie, sub_chunk_len)) {
|
|
|
|
return false;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2006-11-08 19:54:08 +00:00
|
|
|
/*DEBUGF("(moov) unknown chunk id: %c%c%c%c\n",
|
|
|
|
SPLITFOURCC(sub_chunk_id));*/
|
2006-10-11 17:02:23 +00:00
|
|
|
stream_skip(qtmovie->stream, sub_chunk_len - 8);
|
2006-11-08 19:54:08 +00:00
|
|
|
break;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
size_remaining -= sub_chunk_len;
|
|
|
|
}
|
2005-09-24 11:56:36 +00:00
|
|
|
return true;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void read_chunk_mdat(qtmovie_t *qtmovie, size_t chunk_len)
|
|
|
|
{
|
2006-10-11 17:02:23 +00:00
|
|
|
size_t size_remaining = chunk_len - 8;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
qtmovie->res->mdat_len = size_remaining;
|
|
|
|
}
|
|
|
|
|
|
|
|
int qtmovie_read(stream_t *file, demux_res_t *demux_res)
|
|
|
|
{
|
2005-09-22 20:46:58 +00:00
|
|
|
qtmovie_t qtmovie;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
/* construct the stream */
|
2005-09-22 20:46:58 +00:00
|
|
|
qtmovie.stream = file;
|
|
|
|
qtmovie.res = demux_res;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
/* read the chunks */
|
|
|
|
while (1)
|
|
|
|
{
|
|
|
|
size_t chunk_len;
|
|
|
|
fourcc_t chunk_id;
|
|
|
|
|
2005-09-22 20:46:58 +00:00
|
|
|
chunk_len = stream_read_uint32(qtmovie.stream);
|
|
|
|
if (stream_eof(qtmovie.stream))
|
2005-09-22 18:47:04 +00:00
|
|
|
{
|
2010-01-02 20:54:55 +00:00
|
|
|
if(qtmovie.res->mdat_offset == 0 || qtmovie.res->format == 0)
|
|
|
|
return 0;
|
|
|
|
stream_seek(qtmovie.stream, qtmovie.res->mdat_offset);
|
|
|
|
return 1;
|
2005-09-22 18:47:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (chunk_len == 1)
|
|
|
|
{
|
2005-10-31 20:50:32 +00:00
|
|
|
//DEBUGF("need 64bit support\n");
|
2005-09-22 18:47:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2005-09-22 20:46:58 +00:00
|
|
|
chunk_id = stream_read_uint32(qtmovie.stream);
|
2005-09-22 18:47:04 +00:00
|
|
|
|
2005-10-31 20:50:32 +00:00
|
|
|
//DEBUGF("Found a chunk %c%c%c%c, length=%d\n",SPLITFOURCC(chunk_id),chunk_len);
|
2005-09-22 18:47:04 +00:00
|
|
|
switch (chunk_id)
|
|
|
|
{
|
|
|
|
case MAKEFOURCC('f','t','y','p'):
|
2005-09-22 20:46:58 +00:00
|
|
|
read_chunk_ftyp(&qtmovie, chunk_len);
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
case MAKEFOURCC('m','o','o','v'):
|
2005-09-24 11:56:36 +00:00
|
|
|
if (!read_chunk_moov(&qtmovie, chunk_len)) {
|
|
|
|
return 0;
|
|
|
|
}
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
case MAKEFOURCC('m','d','a','t'):
|
2007-01-30 21:42:36 +00:00
|
|
|
/* There can be empty mdats before the real one. If so, skip them */
|
2010-01-02 21:02:13 +00:00
|
|
|
if (chunk_len == 8)
|
2010-01-02 20:54:55 +00:00
|
|
|
break;
|
2010-01-02 21:02:13 +00:00
|
|
|
read_chunk_mdat(&qtmovie, chunk_len);
|
|
|
|
qtmovie.res->mdat_offset=stream_tell(qtmovie.stream);
|
2010-01-02 20:54:55 +00:00
|
|
|
/* If we've already seen the format, assume there's nothing
|
|
|
|
interesting after the mdat chunk (the file is "streamable").
|
|
|
|
This avoids having to seek, which might cause rebuffering. */
|
|
|
|
if(qtmovie.res->format > 0)
|
2007-01-30 21:42:36 +00:00
|
|
|
return 1;
|
2010-01-02 20:54:55 +00:00
|
|
|
stream_skip(qtmovie.stream, chunk_len - 8);
|
2007-01-30 21:42:36 +00:00
|
|
|
break;
|
2005-09-22 18:47:04 +00:00
|
|
|
|
|
|
|
/* these following atoms can be skipped !!!! */
|
|
|
|
case MAKEFOURCC('f','r','e','e'):
|
2006-10-11 17:02:23 +00:00
|
|
|
stream_skip(qtmovie.stream, chunk_len - 8);
|
2005-09-22 18:47:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-10-31 20:50:32 +00:00
|
|
|
//DEBUGF("(top) unknown chunk id: %c%c%c%c\n",SPLITFOURCC(chunk_id));
|
2005-09-22 18:47:04 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
|