Statistics
| Branch: | Revision:

grapes / src / Chunkiser / output-stream-raw.c @ 91e9c5d5

History | View | Annotate | Download (643 Bytes)

1
/*
2
 *  Copyright (c) 2010 Luca Abeni
3
 *
4
 *  This is free software; see gpl-3.0.txt
5
 */
6

    
7
#include <unistd.h>
8
#include <stdint.h>
9
#include <stdlib.h>
10
#include <stdio.h>
11

    
12
#include "dechunkiser_iface.h"
13

    
14
struct output_stream {
15
  int fd;
16
};
17

    
18
static struct output_stream *raw_open(const char *config)
19
{
20
  struct output_stream *res;
21

    
22
  res = malloc(sizeof(struct output_stream));
23
  if (res == NULL) {
24
    return NULL;
25
  }
26
  res->fd = 1;
27

    
28
  return res;
29
}
30

    
31
static void raw_write(struct output_stream *o, int id, uint8_t *data, int size)
32
{
33
  write(o->fd, data, size);
34
}
35

    
36
struct dechunkiser_iface out_raw = {
37
  .open = raw_open,
38
  .write = raw_write,
39
};