~ubuntu-branches/ubuntu/lucid/ffmpeg/lucid-security

« back to all changes in this revision

Viewing changes to libavformat/ipmovie.c

  • Committer: Bazaar Package Importer
  • Author(s): Reinhard Tartler
  • Date: 2009-03-13 09:18:28 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20090313091828-n4ktby5eca487uhv
Tags: 3:0.svn20090303-1ubuntu1+unstripped1
merge from ubuntu.jaunty branch

Show diffs side-by-side

added added

removed removed

Lines of Context:
40
40
#define DEBUG_IPMOVIE 0
41
41
 
42
42
#if DEBUG_IPMOVIE
 
43
#undef printf
43
44
#define debug_ipmovie printf
44
45
#else
45
46
static inline void debug_ipmovie(const char *format, ...) { }
92
93
    unsigned char *buf;
93
94
    int buf_size;
94
95
 
95
 
    float fps;
96
 
    int frame_pts_inc;
 
96
    uint64_t frame_pts_inc;
97
97
 
98
98
    unsigned int video_width;
99
99
    unsigned int video_height;
125
125
    AVPacket *pkt) {
126
126
 
127
127
    int chunk_type;
128
 
    int64_t audio_pts = 0;
129
128
 
130
129
    if (s->audio_chunk_offset) {
131
130
 
138
137
        url_fseek(pb, s->audio_chunk_offset, SEEK_SET);
139
138
        s->audio_chunk_offset = 0;
140
139
 
141
 
        /* figure out the audio pts */
142
 
        audio_pts = 90000;
143
 
        audio_pts *= s->audio_frame_count;
144
 
        audio_pts /= s->audio_sample_rate;
145
 
 
146
140
        if (s->audio_chunk_size != av_get_packet(pb, pkt, s->audio_chunk_size))
147
141
            return CHUNK_EOF;
148
142
 
149
143
        pkt->stream_index = s->audio_stream_index;
150
 
        pkt->pts = audio_pts;
 
144
        pkt->pts = s->audio_frame_count;
151
145
 
152
146
        /* audio frame maintenance */
153
147
        if (s->audio_type != CODEC_ID_INTERPLAY_DPCM)
158
152
                (s->audio_chunk_size - 6) / s->audio_channels;
159
153
 
160
154
        debug_ipmovie("sending audio frame with pts %"PRId64" (%d audio frames)\n",
161
 
            audio_pts, s->audio_frame_count);
 
155
            pkt->pts, s->audio_frame_count);
162
156
 
163
157
        chunk_type = CHUNK_VIDEO;
164
158
 
326
320
                chunk_type = CHUNK_BAD;
327
321
                break;
328
322
            }
329
 
            s->fps = 1000000.0 / (AV_RL32(&scratch[0]) * AV_RL16(&scratch[4]));
330
 
            s->frame_pts_inc = 90000 / s->fps;
 
323
            s->frame_pts_inc = ((uint64_t)AV_RL32(&scratch[0])) * AV_RL16(&scratch[4]);
331
324
            debug_ipmovie("  %.2f frames/second (timer div = %d, subdiv = %d)\n",
332
 
                s->fps, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
 
325
                1000000.0/s->frame_pts_inc, AV_RL32(&scratch[0]), AV_RL16(&scratch[4]));
333
326
            break;
334
327
 
335
328
        case OPCODE_INIT_AUDIO_BUFFERS:
553
546
    st = av_new_stream(s, 0);
554
547
    if (!st)
555
548
        return AVERROR(ENOMEM);
556
 
    av_set_pts_info(st, 33, 1, 90000);
 
549
    av_set_pts_info(st, 63, 1, 1000000);
557
550
    ipmovie->video_stream_index = st->index;
558
551
    st->codec->codec_type = CODEC_TYPE_VIDEO;
559
552
    st->codec->codec_id = CODEC_ID_INTERPLAY_VIDEO;
568
561
        st = av_new_stream(s, 0);
569
562
        if (!st)
570
563
            return AVERROR(ENOMEM);
571
 
        av_set_pts_info(st, 33, 1, 90000);
 
564
        av_set_pts_info(st, 32, 1, ipmovie->audio_sample_rate);
572
565
        ipmovie->audio_stream_index = st->index;
573
566
        st->codec->codec_type = CODEC_TYPE_AUDIO;
574
567
        st->codec->codec_id = ipmovie->audio_type;