[xiph-cvs] cvs commit: writ/src encode.c
Arc
arc at xiph.org
Mon Dec 8 23:11:30 PST 2003
arc 03/12/09 02:11:30
Modified: include/writ writ.h
src encode.c
Log:
More stuff, still no autotools
Revision Changes Path
1.7 +6 -5 writ/include/writ/writ.h
Index: writ.h
===================================================================
RCS file: /usr/local/cvsroot/writ/include/writ/writ.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- writ.h 9 Dec 2003 06:38:43 -0000 1.6
+++ writ.h 9 Dec 2003 07:11:30 -0000 1.7
@@ -11,7 +11,7 @@
********************************************************************
function: toplevel libwrit include
- last mod: $Id: writ.h,v 1.6 2003/12/09 06:38:43 arc Exp $
+ last mod: $Id: writ.h,v 1.7 2003/12/09 07:11:30 arc Exp $
********************************************************************/
@@ -25,10 +25,11 @@
char *string;
} writ_text;
+
typedef struct writ_language {
writ_text language_name;
writ_text language_desc;
-} writ_langdef;
+} writ_language;
typedef struct writ_window {
@@ -92,18 +93,18 @@
int width, int height,
int align_x, int align_y);
extern int writ_encode_get_header(writ_state *ws, int packets,
- **ogg_packet);
+ ogg_packet *op);
/* A different call for each subversion, the best way? */
extern int writ_encode_phrase0(writ_state *ws, ogg_packet *ogg_packet,
ogg_int64_t start, ogg_uint32_t duration,
- *text);
+ char *text);
extern int writ_encode_phrase1(writ_state *ws, ogg_packet *ogg_packet,
ogg_int64_t start, ogg_uint32_t duration,
- **text);
+ char **text);
extern int writ_encode_phrase2(writ_state *ws, ogg_packet *ogg_packet,
ogg_int64_t start, ogg_uint32_t duration,
- **text, int window_id);
+ char **text, int window_id);
extern int ilog(unsigned int v); /* src/format.c */
<p><p>1.2 +34 -1 writ/src/encode.c
Index: encode.c
===================================================================
RCS file: /usr/local/cvsroot/writ/src/encode.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- encode.c 9 Dec 2003 06:38:44 -0000 1.1
+++ encode.c 9 Dec 2003 07:11:30 -0000 1.2
@@ -11,10 +11,12 @@
********************************************************************
encode.c: Writ stream encoding
- last mod: $Id: encode.c,v 1.1 2003/12/09 06:38:44 arc Exp $
+ last mod: $Id: encode.c,v 1.2 2003/12/09 07:11:30 arc Exp $
********************************************************************/
+#include <stdlib.h>
+#include <string.h>
#include <writ/writ.h>
int writ_encode_init(writ_state *ws, ogg_uint32_t granule_num,
@@ -52,6 +54,7 @@
if (ws->wi->num_languages == 15)
ws->wi->languages = realloc(ws->wi->languages,
sizeof(writ_language)*256);
+ if (ws->wi->num_languages == 255) return -1;
ws->wi->num_languages++;
}
new_lang = ws->wi->languages + ws->wi->num_languages;
@@ -65,3 +68,33 @@
return ws->wi->num_languages;
}
+
+int writ_encode_wind_init(writ_state *ws, int scale_x, int scale_y) {
+ if (ws->wi->subversion == 0) return -1; /* Lang must come first */
+ if (ws->wi->subversion >= 2) return -1; /* Windows already init */
+
+ ws->wi->location_scale_x = scale_x;
+ ws->wi->location_scale_y = scale_y;
+ ws->wi->num_windows = 0;
+ ws->wi->windows = malloc(sizeof(writ_window)*16);
+
+ return OGG_SUCCESS;
+}
+
+int writ_encode_wind_add(writ_state *ws, int left, int top, int width,
+ int height, int align_x, int align_y) {
+ if (ws->wi->num_windows == 15)
+ ws->wi->windows = realloc(ws->wi->windows,
+ sizeof(writ_window)*256);
+ if (ws->wi->num_windows == 255) return -1;
+
+ ws->wi->windows[ws->wi->num_windows].location_x = left;
+ ws->wi->windows[ws->wi->num_windows].location_y = top;
+ ws->wi->windows[ws->wi->num_windows].location_width = width;
+ ws->wi->windows[ws->wi->num_windows].location_height = height;
+ ws->wi->windows[ws->wi->num_windows].alignment_x = align_x;
+ ws->wi->windows[ws->wi->num_windows].alignment_y = align_y;
+ ws->wi->num_windows++;
+
+ return OGG_SUCCESS;
+}
<p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the commits
mailing list