Commit a2254288 authored by hpi1's avatar hpi1

Added decoding of Window Definition Segment (WDS)

parent a0a5b199
......@@ -99,4 +99,11 @@ typedef struct {
} BD_PG_COMPOSITION;
typedef struct {
int64_t pts;
unsigned num_windows;
BD_PG_WINDOW *window;
} BD_PG_WINDOWS;
#endif // _BD_PG_H_
......@@ -218,6 +218,20 @@ int pg_decode_composition(BITBUFFER *bb, BD_PG_COMPOSITION *p)
return 1;
}
int pg_decode_windows(BITBUFFER *bb, BD_PG_WINDOWS *p)
{
unsigned ii;
p->num_windows = bb_read(bb, 8);
p->window = calloc(p->num_windows, sizeof(BD_PG_WINDOW));
for (ii = 0; ii < p->num_windows; ii++) {
pg_decode_window(bb, &p->window[ii]);
}
return 1;
}
/*
* cleanup
*/
......@@ -236,10 +250,10 @@ void pg_clean_composition(BD_PG_COMPOSITION *p)
}
}
void pg_free_window(BD_PG_WINDOW **p)
void pg_clean_windows(BD_PG_WINDOWS *p)
{
if (p && *p) {
X_FREE(*p);
if (p) {
X_FREE(p->window);
}
}
......@@ -265,3 +279,11 @@ void pg_free_composition(BD_PG_COMPOSITION **p)
X_FREE(*p);
}
}
void pg_free_windows(BD_PG_WINDOWS **p)
{
if (p && *p) {
pg_clean_windows(*p);
X_FREE(*p);
}
}
......@@ -43,6 +43,7 @@ BD_PRIVATE int pg_decode_palette_update(BITBUFFER *bb, BD_PG_PALETTE *p);
BD_PRIVATE int pg_decode_palette(BITBUFFER *bb, BD_PG_PALETTE *p);
BD_PRIVATE int pg_decode_object(BITBUFFER *bb, BD_PG_OBJECT *p);
BD_PRIVATE int pg_decode_composition(BITBUFFER *bb, BD_PG_COMPOSITION *p);
BD_PRIVATE int pg_decode_windows(BITBUFFER *bb, BD_PG_WINDOWS *p);
/*
* cleanup
......@@ -50,10 +51,11 @@ BD_PRIVATE int pg_decode_composition(BITBUFFER *bb, BD_PG_COMPOSITION *p);
BD_PRIVATE void pg_clean_object(BD_PG_OBJECT *p);
BD_PRIVATE void pg_clean_composition(BD_PG_COMPOSITION *p);
BD_PRIVATE void pg_clean_windows(BD_PG_WINDOWS *p);
BD_PRIVATE void pg_free_window(BD_PG_WINDOW **p);
BD_PRIVATE void pg_free_palette(BD_PG_PALETTE **p);
BD_PRIVATE void pg_free_object(BD_PG_OBJECT **p);
BD_PRIVATE void pg_free_composition(BD_PG_COMPOSITION **p);
BD_PRIVATE void pg_free_windows(BD_PG_WINDOWS **p);
#endif // _PG_DECODE_H_
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