~ubuntu-branches/ubuntu/jaunty/xvidcap/jaunty-proposed

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/libnut.c

  • Committer: Bazaar Package Importer
  • Author(s): Lionel Le Folgoc, Andrew Starr-Bochicchio, Lionel Le Folgoc
  • Date: 2008-12-26 00:10:06 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20081226001006-2040ls9680bd1blt
Tags: 1.1.7-0.2ubuntu1
[ Andrew Starr-Bochicchio ]
* Merge from debian-multimedia (LP: #298547), Ubuntu Changes:
 - For ffmpeg-related build-deps, fix versionized dependencies
   as the ubuntu versioning is different than debian-multimedia's.

[ Lionel Le Folgoc ]
* LP: #311412 is fixed since the 1.1.7~rc1-0.1 revision.
* debian/patches/03_ffmpeg.diff: updated to fix FTBFS due to libswscale API
  change (cherry-pick from Gentoo #234383).

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
20
 */
21
21
 
 
22
/**
 
23
 * @file libnut.c
 
24
 * NUT demuxing and muxing via libnut.
 
25
 * @author Oded Shimon <ods15@ods15.dyndns.org>
 
26
 */
 
27
 
22
28
#include "avformat.h"
23
29
#include "riff.h"
24
30
#include <libnut.h>
48
54
 
49
55
static int nut_write_header(AVFormatContext * avf) {
50
56
    NUTContext * priv = avf->priv_data;
51
 
    ByteIOContext * bc = &avf->pb;
 
57
    ByteIOContext * bc = avf->pb;
52
58
    nut_muxer_opts_t mopts = {
53
59
        .output = {
54
60
            .priv = bc,
77
83
        else fourcc = codec_get_tag(nut_tags, codec->codec_id);
78
84
 
79
85
        if (!fourcc) {
80
 
            if (codec->codec_type == CODEC_TYPE_VIDEO) fourcc = codec_get_bmp_tag(codec->codec_id);
81
 
            if (codec->codec_type == CODEC_TYPE_AUDIO) fourcc = codec_get_wav_tag(codec->codec_id);
 
86
            if (codec->codec_type == CODEC_TYPE_VIDEO) fourcc = codec_get_tag(codec_bmp_tags, codec->codec_id);
 
87
            if (codec->codec_type == CODEC_TYPE_AUDIO) fourcc = codec_get_tag(codec_wav_tags, codec->codec_id);
82
88
        }
83
89
 
84
90
        s[i].fourcc_len = 4;
131
137
}
132
138
 
133
139
static int nut_write_trailer(AVFormatContext * avf) {
134
 
    ByteIOContext * bc = &avf->pb;
 
140
    ByteIOContext * bc = avf->pb;
135
141
    NUTContext * priv = avf->priv_data;
136
142
    int i;
137
143
 
145
151
}
146
152
 
147
153
AVOutputFormat libnut_muxer = {
148
 
    "nut",
 
154
    "libnut",
149
155
    "nut format",
150
156
    "video/x-nut",
151
157
    "nut",
160
166
#endif //CONFIG_MUXERS
161
167
 
162
168
static int nut_probe(AVProbeData *p) {
163
 
    if (p->buf_size >= ID_LENGTH && !memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
 
169
    if (!memcmp(p->buf, ID_STRING, ID_LENGTH)) return AVPROBE_SCORE_MAX;
164
170
 
165
171
    return 0;
166
172
}
181
187
 
182
188
static int nut_read_header(AVFormatContext * avf, AVFormatParameters * ap) {
183
189
    NUTContext * priv = avf->priv_data;
184
 
    ByteIOContext * bc = &avf->pb;
 
190
    ByteIOContext * bc = avf->pb;
185
191
    nut_demuxer_opts_t dopts = {
186
192
        .input = {
187
193
            .priv = bc,
229
235
        switch(s[i].type) {
230
236
        case NUT_AUDIO_CLASS:
231
237
            st->codec->codec_type = CODEC_TYPE_AUDIO;
232
 
            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_wav_id(st->codec->codec_tag);
 
238
            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_id(codec_wav_tags, st->codec->codec_tag);
233
239
 
234
240
            st->codec->channels = s[i].channel_count;
235
241
            st->codec->sample_rate = s[i].samplerate_num / s[i].samplerate_denom;
236
242
            break;
237
243
        case NUT_VIDEO_CLASS:
238
244
            st->codec->codec_type = CODEC_TYPE_VIDEO;
239
 
            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_bmp_id(st->codec->codec_tag);
 
245
            if (st->codec->codec_id == CODEC_ID_NONE) st->codec->codec_id = codec_get_id(codec_bmp_tags, st->codec->codec_tag);
240
246
 
241
247
            st->codec->width = s[i].width;
242
248
            st->codec->height = s[i].height;
266
272
    if (pd.flags & NUT_FLAG_KEY) pkt->flags |= PKT_FLAG_KEY;
267
273
    pkt->pts = pd.pts;
268
274
    pkt->stream_index = pd.stream;
269
 
    pkt->pos = url_ftell(&avf->pb);
 
275
    pkt->pos = url_ftell(avf->pb);
270
276
 
271
277
    ret = nut_read_frame(priv->nut, &pd.len, pkt->data);
272
278
 
292
298
}
293
299
 
294
300
AVInputFormat libnut_demuxer = {
295
 
    "nut",
 
301
    "libnut",
296
302
    "nut format",
297
303
    sizeof(NUTContext),
298
304
    nut_probe,