annotate movenchint.c @ 6179:736165b749f8 libavformat

RTSP, rtpdec: Move RTPPayloadData into rtpdec_mpeg4 and remove all references to rtp_payload_data in rtpdec and rtsp Patch by Josh Allmann, joshua dot allmann at gmail
author mstorsjo
date Fri, 25 Jun 2010 08:02:50 +0000
parents fd7fc7d79630
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
1 /*
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
2 * MOV, 3GP, MP4 muxer RTP hinting
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
3 * Copyright (c) 2010 Martin Storsjo
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
4 *
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
5 * This file is part of FFmpeg.
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
6 *
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
7 * FFmpeg is free software; you can redistribute it and/or
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
8 * modify it under the terms of the GNU Lesser General Public
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
9 * License as published by the Free Software Foundation; either
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
10 * version 2.1 of the License, or (at your option) any later version.
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
11 *
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
12 * FFmpeg is distributed in the hope that it will be useful,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
15 * Lesser General Public License for more details.
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
16 *
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
17 * You should have received a copy of the GNU Lesser General Public
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
18 * License along with FFmpeg; if not, write to the Free Software
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
20 */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
21
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
22 #include "movenc.h"
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
23 #include "libavutil/intreadwrite.h"
6025
fd7fc7d79630 Take ff_write_chained in use in the mov rtp hinter and in the rtsp muxer
mstorsjo
parents: 6014
diff changeset
24 #include "internal.h"
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
25
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
26 int ff_mov_init_hinting(AVFormatContext *s, int index, int src_index)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
27 {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
28 MOVMuxContext *mov = s->priv_data;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
29 MOVTrack *track = &mov->tracks[index];
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
30 MOVTrack *src_track = &mov->tracks[src_index];
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
31 AVStream *src_st = s->streams[src_index];
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
32 int ret = AVERROR(ENOMEM);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
33 AVOutputFormat *rtp_format = av_guess_format("rtp", NULL, NULL);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
34
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
35 track->tag = MKTAG('r','t','p',' ');
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
36 track->src_track = src_index;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
37
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
38 if (!rtp_format) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
39 ret = AVERROR(ENOENT);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
40 goto fail;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
41 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
42
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
43 track->enc = avcodec_alloc_context();
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
44 if (!track->enc)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
45 goto fail;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
46 track->enc->codec_type = AVMEDIA_TYPE_DATA;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
47 track->enc->codec_tag = track->tag;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
48
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
49 track->rtp_ctx = avformat_alloc_context();
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
50 if (!track->rtp_ctx)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
51 goto fail;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
52 track->rtp_ctx->oformat = rtp_format;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
53 if (!av_new_stream(track->rtp_ctx, 0))
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
54 goto fail;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
55
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
56 /* Copy stream parameters */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
57 track->rtp_ctx->streams[0]->sample_aspect_ratio =
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
58 src_st->sample_aspect_ratio;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
59
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
60 /* Remove the allocated codec context, link to the original one
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
61 * instead, to give the rtp muxer access to codec parameters. */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
62 av_free(track->rtp_ctx->streams[0]->codec);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
63 track->rtp_ctx->streams[0]->codec = src_st->codec;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
64
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
65 if ((ret = url_open_dyn_packet_buf(&track->rtp_ctx->pb,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
66 RTP_MAX_PACKET_SIZE)) < 0)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
67 goto fail;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
68 ret = av_write_header(track->rtp_ctx);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
69 if (ret)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
70 goto fail;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
71
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
72 /* Copy the RTP AVStream timebase back to the hint AVStream */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
73 track->timescale = track->rtp_ctx->streams[0]->time_base.den;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
74
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
75 /* Mark the hinted track that packets written to it should be
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
76 * sent to this track for hinting. */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
77 src_track->hint_track = index;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
78 return 0;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
79 fail:
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
80 av_log(s, AV_LOG_WARNING,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
81 "Unable to initialize hinting of stream %d\n", src_index);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
82 if (track->rtp_ctx && track->rtp_ctx->pb) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
83 uint8_t *buf;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
84 url_close_dyn_buf(track->rtp_ctx->pb, &buf);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
85 av_free(buf);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
86 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
87 if (track->rtp_ctx && track->rtp_ctx->streams[0]) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
88 av_metadata_free(&track->rtp_ctx->streams[0]->metadata);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
89 av_free(track->rtp_ctx->streams[0]);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
90 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
91 if (track->rtp_ctx) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
92 av_metadata_free(&track->rtp_ctx->metadata);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
93 av_free(track->rtp_ctx->priv_data);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
94 av_freep(&track->rtp_ctx);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
95 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
96 av_freep(&track->enc);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
97 /* Set a default timescale, to avoid crashes in dump_format */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
98 track->timescale = 90000;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
99 return ret;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
100 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
101
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
102 /**
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
103 * Remove the first sample from the sample queue.
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
104 */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
105 static void sample_queue_pop(HintSampleQueue *queue)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
106 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
107 if (queue->len <= 0)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
108 return;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
109 if (queue->samples[0].own_data)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
110 av_free(queue->samples[0].data);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
111 queue->len--;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
112 memmove(queue->samples, queue->samples + 1, sizeof(HintSample)*queue->len);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
113 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
114
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
115 /**
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
116 * Empty the sample queue, releasing all memory.
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
117 */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
118 static void sample_queue_free(HintSampleQueue *queue)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
119 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
120 int i;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
121 for (i = 0; i < queue->len; i++)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
122 if (queue->samples[i].own_data)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
123 av_free(queue->samples[i].data);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
124 av_freep(&queue->samples);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
125 queue->len = 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
126 queue->size = 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
127 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
128
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
129 /**
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
130 * Add a reference to the sample data to the sample queue. The data is
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
131 * not copied. sample_queue_retain should be called before pkt->data
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
132 * is reused/freed.
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
133 */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
134 static void sample_queue_push(HintSampleQueue *queue, AVPacket *pkt, int sample)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
135 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
136 /* No need to keep track of smaller samples, since describing them
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
137 * with immediates is more efficient. */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
138 if (pkt->size <= 14)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
139 return;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
140 if (!queue->samples || queue->len >= queue->size) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
141 HintSample* samples;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
142 queue->size += 10;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
143 samples = av_realloc(queue->samples, sizeof(HintSample)*queue->size);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
144 if (!samples)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
145 return;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
146 queue->samples = samples;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
147 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
148 queue->samples[queue->len].data = pkt->data;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
149 queue->samples[queue->len].size = pkt->size;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
150 queue->samples[queue->len].sample_number = sample;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
151 queue->samples[queue->len].offset = 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
152 queue->samples[queue->len].own_data = 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
153 queue->len++;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
154 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
155
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
156 /**
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
157 * Make local copies of all referenced sample data in the queue.
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
158 */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
159 static void sample_queue_retain(HintSampleQueue *queue)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
160 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
161 int i;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
162 for (i = 0; i < queue->len; ) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
163 HintSample *sample = &queue->samples[i];
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
164 if (!sample->own_data) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
165 uint8_t* ptr = av_malloc(sample->size);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
166 if (!ptr) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
167 /* Unable to allocate memory for this one, remove it */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
168 memmove(queue->samples + i, queue->samples + i + 1,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
169 sizeof(HintSample)*(queue->len - i - 1));
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
170 queue->len--;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
171 continue;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
172 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
173 memcpy(ptr, sample->data, sample->size);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
174 sample->data = ptr;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
175 sample->own_data = 1;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
176 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
177 i++;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
178 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
179 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
180
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
181 /**
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
182 * Find matches of needle[n_pos ->] within haystack. If a sufficiently
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
183 * large match is found, matching bytes before n_pos are included
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
184 * in the match, too (within the limits of the arrays).
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
185 *
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
186 * @param haystack buffer that may contain parts of needle
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
187 * @param h_len length of the haystack buffer
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
188 * @param needle buffer containing source data that have been used to
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
189 * construct haystack
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
190 * @param n_pos start position in needle used for looking for matches
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
191 * @param n_len length of the needle buffer
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
192 * @param match_h_offset_ptr offset of the first matching byte within haystack
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
193 * @param match_n_offset_ptr offset of the first matching byte within needle
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
194 * @param match_len_ptr length of the matched segment
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
195 * @return 0 if a match was found, < 0 if no match was found
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
196 */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
197 static int match_segments(const uint8_t *haystack, int h_len,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
198 const uint8_t *needle, int n_pos, int n_len,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
199 int *match_h_offset_ptr, int *match_n_offset_ptr,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
200 int *match_len_ptr)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
201 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
202 int h_pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
203 for (h_pos = 0; h_pos < h_len; h_pos++) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
204 int match_len = 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
205 int match_h_pos, match_n_pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
206
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
207 /* Check how many bytes match at needle[n_pos] and haystack[h_pos] */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
208 while (h_pos + match_len < h_len && n_pos + match_len < n_len &&
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
209 needle[n_pos + match_len] == haystack[h_pos + match_len])
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
210 match_len++;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
211 if (match_len <= 8)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
212 continue;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
213
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
214 /* If a sufficiently large match was found, try to expand
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
215 * the matched segment backwards. */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
216 match_h_pos = h_pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
217 match_n_pos = n_pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
218 while (match_n_pos > 0 && match_h_pos > 0 &&
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
219 needle[match_n_pos - 1] == haystack[match_h_pos - 1]) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
220 match_n_pos--;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
221 match_h_pos--;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
222 match_len++;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
223 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
224 if (match_len <= 14)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
225 continue;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
226 *match_h_offset_ptr = match_h_pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
227 *match_n_offset_ptr = match_n_pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
228 *match_len_ptr = match_len;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
229 return 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
230 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
231 return -1;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
232 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
233
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
234 /**
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
235 * Look for segments in samples in the sample queue matching the data
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
236 * in ptr. Samples not matching are removed from the queue. If a match
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
237 * is found, the next time it will look for matches starting from the
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
238 * end of the previous matched segment.
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
239 *
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
240 * @param data data to find matches for in the sample queue
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
241 * @param len length of the data buffer
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
242 * @param queue samples used for looking for matching segments
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
243 * @param pos the offset in data of the matched segment
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
244 * @param match_sample the number of the sample that contained the match
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
245 * @param match_offset the offset of the matched segment within the sample
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
246 * @param match_len the length of the matched segment
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
247 * @return 0 if a match was found, < 0 if no match was found
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
248 */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
249 static int find_sample_match(const uint8_t *data, int len,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
250 HintSampleQueue *queue, int *pos,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
251 int *match_sample, int *match_offset,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
252 int *match_len)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
253 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
254 while (queue->len > 0) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
255 HintSample *sample = &queue->samples[0];
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
256 /* If looking for matches in a new sample, skip the first 5 bytes,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
257 * since they often may be modified/removed in the output packet. */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
258 if (sample->offset == 0 && sample->size > 5)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
259 sample->offset = 5;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
260
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
261 if (match_segments(data, len, sample->data, sample->offset,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
262 sample->size, pos, match_offset, match_len) == 0) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
263 *match_sample = sample->sample_number;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
264 /* Next time, look for matches at this offset, with a little
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
265 * margin to this match. */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
266 sample->offset = *match_offset + *match_len + 5;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
267 if (sample->offset + 10 >= sample->size)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
268 sample_queue_pop(queue); /* Not enough useful data left */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
269 return 0;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
270 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
271
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
272 if (sample->offset < 10 && sample->size > 20) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
273 /* No match found from the start of the sample,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
274 * try from the middle of the sample instead. */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
275 sample->offset = sample->size/2;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
276 } else {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
277 /* No match for this sample, remove it */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
278 sample_queue_pop(queue);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
279 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
280 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
281 return -1;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
282 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
283
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
284 static void output_immediate(const uint8_t *data, int size,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
285 ByteIOContext *out, int *entries)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
286 {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
287 while (size > 0) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
288 int len = size;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
289 if (len > 14)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
290 len = 14;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
291 put_byte(out, 1); /* immediate constructor */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
292 put_byte(out, len); /* amount of valid data */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
293 put_buffer(out, data, len);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
294 data += len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
295 size -= len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
296
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
297 for (; len < 14; len++)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
298 put_byte(out, 0);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
299
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
300 (*entries)++;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
301 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
302 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
303
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
304 static void output_match(ByteIOContext *out, int match_sample,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
305 int match_offset, int match_len, int *entries)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
306 {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
307 put_byte(out, 2); /* sample constructor */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
308 put_byte(out, 0); /* track reference */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
309 put_be16(out, match_len);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
310 put_be32(out, match_sample);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
311 put_be32(out, match_offset);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
312 put_be16(out, 1); /* bytes per block */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
313 put_be16(out, 1); /* samples per block */
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
314 (*entries)++;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
315 }
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
316
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
317 static void describe_payload(const uint8_t *data, int size,
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
318 ByteIOContext *out, int *entries,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
319 HintSampleQueue *queue)
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
320 {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
321 /* Describe the payload using different constructors */
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
322 while (size > 0) {
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
323 int match_sample, match_offset, match_len, pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
324 if (find_sample_match(data, size, queue, &pos, &match_sample,
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
325 &match_offset, &match_len) < 0)
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
326 break;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
327 output_immediate(data, pos, out, entries);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
328 data += pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
329 size -= pos;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
330 output_match(out, match_sample, match_offset, match_len, entries);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
331 data += match_len;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
332 size -= match_len;
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
333 }
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
334 output_immediate(data, size, out, entries);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
335 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
336
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
337 /**
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
338 * Write an RTP hint (that may contain one or more RTP packets)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
339 * for the packets in data. data contains one or more packets with a
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
340 * BE32 size header.
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
341 *
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
342 * @param out buffer where the hints are written
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
343 * @param data buffer containing RTP packets
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
344 * @param size the size of the data buffer
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
345 * @param trk the MOVTrack for the hint track
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
346 * @param pts pointer where the timestamp for the written RTP hint is stored
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
347 * @return the number of RTP packets in the written hint
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
348 */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
349 static int write_hint_packets(ByteIOContext *out, const uint8_t *data,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
350 int size, MOVTrack *trk, int64_t *pts)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
351 {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
352 int64_t curpos;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
353 int64_t count_pos, entries_pos;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
354 int count = 0, entries;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
355
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
356 count_pos = url_ftell(out);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
357 /* RTPsample header */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
358 put_be16(out, 0); /* packet count */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
359 put_be16(out, 0); /* reserved */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
360
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
361 while (size > 4) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
362 uint32_t packet_len = AV_RB32(data);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
363 uint16_t seq;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
364 uint32_t ts;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
365
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
366 data += 4;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
367 size -= 4;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
368 if (packet_len > size || packet_len <= 12)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
369 break;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
370 if (data[1] >= 200 && data[1] <= 204) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
371 /* RTCP packet, just skip */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
372 data += packet_len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
373 size -= packet_len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
374 continue;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
375 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
376
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
377 if (packet_len > trk->max_packet_size)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
378 trk->max_packet_size = packet_len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
379
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
380 seq = AV_RB16(&data[2]);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
381 ts = AV_RB32(&data[4]);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
382
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
383 if (trk->prev_rtp_ts == 0)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
384 trk->prev_rtp_ts = ts;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
385 /* Unwrap the 32-bit RTP timestamp that wraps around often
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
386 * into a not (as often) wrapping 64-bit timestamp. */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
387 trk->cur_rtp_ts_unwrapped += (int32_t) (ts - trk->prev_rtp_ts);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
388 trk->prev_rtp_ts = ts;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
389 if (*pts == AV_NOPTS_VALUE)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
390 *pts = trk->cur_rtp_ts_unwrapped;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
391
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
392 count++;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
393 /* RTPpacket header */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
394 put_be32(out, 0); /* relative_time */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
395 put_buffer(out, data, 2); /* RTP header */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
396 put_be16(out, seq); /* RTPsequenceseed */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
397 put_be16(out, 0); /* reserved + flags */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
398 entries_pos = url_ftell(out);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
399 put_be16(out, 0); /* entry count */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
400
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
401 data += 12;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
402 size -= 12;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
403 packet_len -= 12;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
404
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
405 entries = 0;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
406 /* Write one or more constructors describing the payload data */
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
407 describe_payload(data, packet_len, out, &entries, &trk->sample_queue);
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
408 data += packet_len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
409 size -= packet_len;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
410
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
411 curpos = url_ftell(out);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
412 url_fseek(out, entries_pos, SEEK_SET);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
413 put_be16(out, entries);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
414 url_fseek(out, curpos, SEEK_SET);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
415 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
416
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
417 curpos = url_ftell(out);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
418 url_fseek(out, count_pos, SEEK_SET);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
419 put_be16(out, count);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
420 url_fseek(out, curpos, SEEK_SET);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
421 return count;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
422 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
423
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
424 int ff_mov_add_hinted_packet(AVFormatContext *s, AVPacket *pkt,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
425 int track_index, int sample)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
426 {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
427 MOVMuxContext *mov = s->priv_data;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
428 MOVTrack *trk = &mov->tracks[track_index];
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
429 AVFormatContext *rtp_ctx = trk->rtp_ctx;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
430 uint8_t *buf = NULL;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
431 int size;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
432 ByteIOContext *hintbuf = NULL;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
433 AVPacket hint_pkt;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
434 int ret = 0, count;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
435
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
436 if (!rtp_ctx)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
437 return AVERROR(ENOENT);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
438 if (!rtp_ctx->pb)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
439 return AVERROR(ENOMEM);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
440
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
441 sample_queue_push(&trk->sample_queue, pkt, sample);
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
442
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
443 /* Feed the packet to the RTP muxer */
6025
fd7fc7d79630 Take ff_write_chained in use in the mov rtp hinter and in the rtsp muxer
mstorsjo
parents: 6014
diff changeset
444 ff_write_chained(rtp_ctx, 0, pkt, s);
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
445
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
446 /* Fetch the output from the RTP muxer, open a new output buffer
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
447 * for next time. */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
448 size = url_close_dyn_buf(rtp_ctx->pb, &buf);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
449 if ((ret = url_open_dyn_packet_buf(&rtp_ctx->pb,
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
450 RTP_MAX_PACKET_SIZE)) < 0)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
451 goto done;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
452
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
453 if (size <= 0)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
454 goto done;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
455
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
456 /* Open a buffer for writing the hint */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
457 if ((ret = url_open_dyn_buf(&hintbuf)) < 0)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
458 goto done;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
459 av_init_packet(&hint_pkt);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
460 count = write_hint_packets(hintbuf, buf, size, trk, &hint_pkt.dts);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
461 av_freep(&buf);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
462
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
463 /* Write the hint data into the hint track */
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
464 hint_pkt.size = size = url_close_dyn_buf(hintbuf, &buf);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
465 hint_pkt.data = buf;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
466 hint_pkt.pts = hint_pkt.dts;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
467 hint_pkt.stream_index = track_index;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
468 if (pkt->flags & AV_PKT_FLAG_KEY)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
469 hint_pkt.flags |= AV_PKT_FLAG_KEY;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
470 if (count > 0)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
471 ff_mov_write_packet(s, &hint_pkt);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
472 done:
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
473 av_free(buf);
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
474 sample_queue_retain(&trk->sample_queue);
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
475 return ret;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
476 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
477
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
478 void ff_mov_close_hinting(MOVTrack *track) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
479 AVFormatContext* rtp_ctx = track->rtp_ctx;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
480 uint8_t *ptr;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
481
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
482 av_freep(&track->enc);
6014
b66058698117 Use a heuristic for describing the RTP packets using sample data
mstorsjo
parents: 6013
diff changeset
483 sample_queue_free(&track->sample_queue);
6013
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
484 if (!rtp_ctx)
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
485 return;
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
486 if (rtp_ctx->pb) {
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
487 av_write_trailer(rtp_ctx);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
488 url_close_dyn_buf(rtp_ctx->pb, &ptr);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
489 av_free(ptr);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
490 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
491 av_metadata_free(&rtp_ctx->streams[0]->metadata);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
492 av_metadata_free(&rtp_ctx->metadata);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
493 av_free(rtp_ctx->streams[0]);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
494 av_freep(&rtp_ctx);
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
495 }
332ad5f30c0e Add initial support for RTP hinting in the mov muxer
mstorsjo
parents:
diff changeset
496