Revision 0c461e28

View differences:

include/chunkiser.h
79 79
 * @param data pointer to the chunk's payload.
80 80
 * @param size chunk size.
81 81
 */
82
void chunk_write(struct output_stream *out, int id, const uint8_t *data, int size);
82
void chunk_write(struct output_stream *out, const struct chunk *c);
83 83
#endif	/* CHUNKISER_H */
src/Chunkiser/dechunkiser_iface.h
1 1
struct dechunkiser_iface {
2 2
  struct output_stream *(*open)(const char *config);
3
  void (*write)(struct output_stream *o, int id, const uint8_t *data, int size);
3
  void (*write)(struct output_stream *o, int id, uint8_t *data, int size);
4 4
};
5 5

  
src/Chunkiser/output-stream-avf.c
105 105
  return &out;
106 106
}
107 107

  
108
static void avf_write(struct output_stream *o, int id, const uint8_t *data, int size)
108
static void avf_write(struct output_stream *o, int id, uint8_t *data, int size)
109 109
{
110 110
  const int header_size = VIDEO_PAYLOAD_HEADER_SIZE; 
111 111
  int frames, i;
112
  const uint8_t *p;
112
  uint8_t *p;
113 113

  
114 114
  if (data[0] > 127) {
115 115
    fprintf(stderr, "Error! Non video chunk: %x!!!\n", data[0]);
......
155 155
    dts += (dts < o->prev_dts - ((1LL << 31) - 1)) ? ((o->prev_dts >> 32) + 1) << 32 : (o->prev_dts >> 32) << 32;
156 156
    o->prev_dts = dts;
157 157
    pkt.dts = av_rescale_q(dts, o->outctx->streams[0]->codec->time_base, o->outctx->streams[0]->time_base);
158
    pkt.data = (uint8_t *)p;
158
    pkt.data = p;
159 159
    p += frame_size;
160 160
    pkt.size = frame_size;
161 161
    av_interleaved_write_frame(o->outctx, &pkt);
src/Chunkiser/output-stream.c
19 19
  return out->open(config);
20 20
}
21 21

  
22
void chunk_write(struct output_stream *o, int id, const uint8_t *data, int size)
22
void chunk_write(struct output_stream *o, const struct chunk *c)
23 23
{
24
  out->write(o, id, data, size);
24
  out->write(o, c->id, c->data, c->size);
25 25
}
src/Tests/chunkiser_test.c
47 47
    res = chunkise(input, &c);
48 48
    if (res > 0) {
49 49
      fprintf(stderr,"chunk %d: %d %llu\n", id++, c.size, c.timestamp);
50
      chunk_write(output, c.id, c.data, c.size);
50
      chunk_write(output, &c);
51 51
    } else if (res < 0) {
52 52
      done = 1;
53 53
    }

Also available in: Unified diff