Commit dc66630c authored by John Koleszar's avatar John Koleszar

ivfenc: webm output support

This patch adds the --webm option, to allow the creation of WebM streams
without having to remux ivf into webm.

Change-Id: Ief93c114a6913c55a04cf51bce38f594372d0ad0
parent f9d98240
......@@ -30,6 +30,9 @@ UTILS-$(CONFIG_ENCODERS) += ivfenc.c
ivfenc.SRCS += args.c args.h y4minput.c y4minput.h
ivfenc.SRCS += vpx_ports/config.h vpx_ports/mem_ops.h
ivfenc.SRCS += vpx_ports/mem_ops_aligned.h
ivfenc.SRCS += libmkv/EbmlIDs.h
ivfenc.SRCS += libmkv/EbmlWriter.c
ivfenc.SRCS += libmkv/EbmlWriter.h
ivfenc.GUID = 548DEC74-7A15-4B2B-AFC3-AA102E7C25C1
ivfenc.DESCRIPTION = Full featured encoder
......
This diff is collapsed.
......@@ -11,13 +11,17 @@
#include <stdlib.h>
#include <wchar.h>
#include <string.h>
#if defined(_MSC_VER)
#define LITERALU64(n) n
#else
#define LITERALU64(n) n##LLU
#endif
void Ebml_WriteLen(EbmlGlobal *glob, long long val)
{
//TODO check and make sure we are not > than 0x0100000000000000LLU
unsigned char size = 8; //size in bytes to output
unsigned long long minVal = 0x00000000000000ffLLU; //mask to compare for byte size
unsigned long long minVal = LITERALU64(0x00000000000000ff); //mask to compare for byte size
for (size = 1; size < 8; size ++)
{
......@@ -27,7 +31,7 @@ void Ebml_WriteLen(EbmlGlobal *glob, long long val)
minVal = (minVal << 7);
}
val |= (0x000000000000080LLU << ((size - 1) * 7));
val |= (LITERALU64(0x000000000000080) << ((size - 1) * 7));
Ebml_Serialize(glob, (void *) &val, size);
}
......@@ -65,7 +69,7 @@ void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id)
else
Ebml_Serialize(glob, (void *)&class_id, 1);
}
void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, UInt64 ui)
void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui)
{
unsigned char sizeSerialized = 8 | 0x80;
Ebml_WriteID(glob, class_id);
......@@ -77,8 +81,9 @@ void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned l
{
unsigned char size = 8; //size in bytes to output
unsigned char sizeSerialized = 0;
Ebml_WriteID(glob, class_id);
unsigned long minVal;
Ebml_WriteID(glob, class_id);
minVal = 0x7fLU; //mask to compare for byte size
for (size = 1; size < 4; size ++)
......@@ -93,7 +98,6 @@ void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned l
sizeSerialized = 0x80 | size;
Ebml_Serialize(glob, &sizeSerialized, 1);
unsigned int _s = size;
Ebml_Serialize(glob, &ui, size);
}
//TODO: perhaps this is a poor name for this id serializer helper function
......@@ -112,8 +116,9 @@ void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned lon
void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d)
{
Ebml_WriteID(glob, class_id);
unsigned char len = 0x88;
Ebml_WriteID(glob, class_id);
Ebml_Serialize(glob, &len, 1);
Ebml_Serialize(glob, &d, 8);
}
......@@ -146,9 +151,10 @@ void Ebml_SerializeData(EbmlGlobal *glob, unsigned long class_id, unsigned char
void Ebml_WriteVoid(EbmlGlobal *glob, unsigned long vSize)
{
Ebml_WriteID(glob, 0xEC);
unsigned char tmp = 0;
unsigned long i = 0;
Ebml_WriteID(glob, 0xEC);
Ebml_WriteLen(glob, vSize);
for (i = 0; i < vSize; i++)
......
......@@ -9,12 +9,12 @@
// in the file PATENTS. All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
//If you wish a different writer simply replace this
//note: you must define write and serialize functions as well as your own EBML_GLOBAL
#include <stddef.h>
#include "EbmlBufferWriter.h"
//These functions MUST be implemented
#include <stddef.h>
#include "vpx/vpx_integer.h"
typedef struct EbmlGlobal EbmlGlobal;
void Ebml_Serialize(EbmlGlobal *glob, const void *, unsigned long);
void Ebml_Write(EbmlGlobal *glob, const void *, unsigned long);
/////
......@@ -24,7 +24,7 @@ void Ebml_WriteLen(EbmlGlobal *glob, long long val);
void Ebml_WriteString(EbmlGlobal *glob, const char *str);
void Ebml_WriteUTF8(EbmlGlobal *glob, const wchar_t *wstr);
void Ebml_WriteID(EbmlGlobal *glob, unsigned long class_id);
void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, UInt64 ui);
void Ebml_SerializeUnsigned64(EbmlGlobal *glob, unsigned long class_id, uint64_t ui);
void Ebml_SerializeUnsigned(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
void Ebml_SerializeBinary(EbmlGlobal *glob, unsigned long class_id, unsigned long ui);
void Ebml_SerializeFloat(EbmlGlobal *glob, unsigned long class_id, double d);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment