summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaintdev <[email protected]>2007-08-16 20:56:04 +0000
committersaintdev <[email protected]>2007-08-16 20:56:04 +0000
commitadb8eaf12c6253a8f080cf41e08ec5f356afa64c (patch)
treef7b8b5dbe039db80a9976c65113fe7b87755e6d2
parent332f66902d4d5ff350b1925ab8e2f501d361022b (diff)
Switch to mk_laceXiph().
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@822 b64f7644-9d1e-0410-96f1-a4d463321fa5
-rw-r--r--libhb/muxmkv.c29
1 files changed, 9 insertions, 20 deletions
diff --git a/libhb/muxmkv.c b/libhb/muxmkv.c
index 9fbbf35ea..0a78ac69f 100644
--- a/libhb/muxmkv.c
+++ b/libhb/muxmkv.c
@@ -144,35 +144,24 @@ static int MKVInit( hb_mux_object_t * m )
break;
case HB_ACODEC_VORBIS:
{
- int i, j;
- int64_t offset = 0;
- int64_t cp_size = 0;
- char *cp;
+ int i;
+ uint64_t cp_size = 0;
track->codecID = MK_ACODEC_VORBIS;
- cp_size = sizeof( char );
+ uint64_t header_sizes[3];
for (i = 0; i < 3; ++i)
{
ogg_headers[i] = (ogg_packet *)audio->config.vorbis.headers[i];
ogg_headers[i]->packet = (unsigned char *)&audio->config.vorbis.headers[i] + sizeof( ogg_packet );
- cp_size += (sizeof( char ) * ((ogg_headers[i]->bytes / 255) + 1)) + ogg_headers[i]->bytes;
- /* This will be too big, but it doesn't matter, as we only need it to be big enough. */
- }
- cp = track->codecPrivate = calloc(1, cp_size);
- cp[offset++] = 0x02;
- for (i = 0; i < 2; ++i)
- {
- for (j = ogg_headers[i]->bytes; j >= 255; j -= 255)
- {
- cp[offset++] = 255;
- }
- cp[offset++] = j;
+ header_sizes[i] = ogg_headers[i]->bytes;
}
+ track->codecPrivate = mk_laceXiph(header_sizes, 2, &cp_size);
+ track->codecPrivate = realloc(track->codecPrivate, cp_size + ogg_headers[0]->bytes + ogg_headers[1]->bytes + ogg_headers[2]->bytes);
for(i = 0; i < 3; ++i)
{
- memcpy(cp + offset, ogg_headers[i]->packet, ogg_headers[i]->bytes);
- offset += ogg_headers[i]->bytes;
+ memcpy(track->codecPrivate + cp_size, ogg_headers[i]->packet, ogg_headers[i]->bytes);
+ cp_size += ogg_headers[i]->bytes;
}
- track->codecPrivateSize = offset;
+ track->codecPrivateSize = cp_size;
}
break;
case HB_ACODEC_FAAC: