Commit a7db2d82 authored by conrad's avatar conrad

Move writing Xiph-style sizes to its own function


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@10338 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 7687b6eb
...@@ -178,6 +178,14 @@ static void end_ebml_master(ByteIOContext *pb, offset_t start) ...@@ -178,6 +178,14 @@ static void end_ebml_master(ByteIOContext *pb, offset_t start)
url_fseek(pb, pos, SEEK_SET); url_fseek(pb, pos, SEEK_SET);
} }
static void put_xiph_size(ByteIOContext *pb, int size)
{
int i;
for (i = 0; i < size / 255; i++)
put_byte(pb, 255);
put_byte(pb, size % 255);
}
// initializes a mkv_seekhead element to be ready to index level 1 matroska elements // initializes a mkv_seekhead element to be ready to index level 1 matroska elements
// if numelements is greater than 0, it reserves enough space for that many elements // if numelements is greater than 0, it reserves enough space for that many elements
// at the current file position and writes the seekhead there, otherwise the seekhead // at the current file position and writes the seekhead there, otherwise the seekhead
...@@ -331,7 +339,7 @@ static int put_xiph_codecpriv(ByteIOContext *pb, AVCodecContext *codec) ...@@ -331,7 +339,7 @@ static int put_xiph_codecpriv(ByteIOContext *pb, AVCodecContext *codec)
uint8_t *header_start[3]; uint8_t *header_start[3];
int header_len[3]; int header_len[3];
int first_header_size; int first_header_size;
int j, k; int j;
if (codec->codec_id == CODEC_ID_VORBIS) if (codec->codec_id == CODEC_ID_VORBIS)
first_header_size = 30; first_header_size = 30;
...@@ -347,9 +355,7 @@ static int put_xiph_codecpriv(ByteIOContext *pb, AVCodecContext *codec) ...@@ -347,9 +355,7 @@ static int put_xiph_codecpriv(ByteIOContext *pb, AVCodecContext *codec)
codecprivate = start_ebml_master(pb, MATROSKA_ID_CODECPRIVATE); codecprivate = start_ebml_master(pb, MATROSKA_ID_CODECPRIVATE);
put_byte(pb, 2); // number packets - 1 put_byte(pb, 2); // number packets - 1
for (j = 0; j < 2; j++) { for (j = 0; j < 2; j++) {
for (k = 0; k < header_len[j] / 255; k++) put_xiph_size(pb, header_len[j]);
put_byte(pb, 255);
put_byte(pb, header_len[j] % 255);
} }
for (j = 0; j < 3; j++) for (j = 0; j < 3; j++)
put_buffer(pb, header_start[j], header_len[j]); put_buffer(pb, header_start[j], header_len[j]);
......
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