-
- if (context->type != GST_MATROSKA_TRACK_TYPE_SUBTITLE || !context->pos)
- continue;
-
- again:
- /* write subtitle type and possible private data */
- gst_ebml_write_seek (ebml, context->pos);
- /* complex way to write ascii to account for extra filling */
- codec_id = g_malloc0 (strlen (context->codec_id) + 1 + fill);
- strcpy (codec_id, context->codec_id);
- gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECID,
- codec_id, strlen (context->codec_id) + 1 + fill);
- g_free (codec_id);
- if (context->codec_priv)
- gst_ebml_write_binary (ebml, GST_MATROSKA_ID_CODECPRIVATE,
- context->codec_priv, context->codec_priv_size);
- voidleft = SUBTITLE_DUMMY_SIZE - (ebml->pos - context->pos);
- /* void'ify; sigh, variable sized length field */
- if (voidleft == 1) {
- fill = 1;
- goto again;
- } else if (voidleft && voidleft <= 128)
- gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, voidleft - 2);
- else if (voidleft >= 130)
- gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, voidleft - 3);
- else if (voidleft == 129) {
- gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 64);
- gst_ebml_write_buffer_header (ebml, GST_EBML_ID_VOID, 63);
- }