~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/segafilm.c

  • Committer: Gauvain Pocentek
  • Date: 2012-03-06 11:59:12 UTC
  • mfrom: (66.1.15 precise)
  • Revision ID: gauvain@pocentek.net-20120306115912-h9d6kt9j0l532oo5
* Merge from Ubuntu:
  - put back faac support
  - recommends apport-hooks-medibuntu
  - change Maintainer, Uploaders & Vcs-* fields.
* New upstream snapshot
* upload to unstable
* Build against external libmpeg2
* drop 51_FTBFS_arm.patch again
* no longer build depend on libcdparanoia-dev on the Hurd
* Fix FTBFS on the hurd.
  Thanks to Samuel Thibault <sthibault@debian.org> (Closes: #654974)
* Fix FTBFS on arm
* New upstream snapshot, Closes: #650339, #643621, #481807
* Imported Upstream version 1.0~rc4+svn34492
* Bump standards version
* Bump dependency on libav >= 4:0.8~, Closes: #653887
* Fix build-indep
* Build mplayer-gui again, Closes: #568514
* Drop debian/all-lang-config-mak.sh, no longer needed
* include .dfsg1 in version number
* remove get-orig-source target
* no longer prune compiler flags from the environment
* No longer advertise nor build 3fdx, mga and dxr3 backends,
  Closes: #496106, #442181, #533546
* beautify mplayer version identification string
* Brown paperbag upload.
* Next try to fix build failure on sparce after recent binutils change.
* Brown paperbag upload.
* Really fix build failure on sparc after recent binutils change.
* Properly set Replaces/Conflicts on mplayer2{,-dbg} to avoid
  file overwrite errors.
* Adjust versioning of mplayer listed in the mplayer-dbg's Depends field.
* Fix build failure on sparc after recent binutils change.
* Urgency medium bumped because of RC-level bugfix
  and speeding up x264 transition.
* Update to my @debian.org email.
* Upload to unstable
* Enable joystick support on Linux only, Closes: #638408
* Rebuild fixes toolchain issue on arm, Closes: #637077
* New upstream snapshot
* following the discussion started by Diego Biurrun <diego@biurrun.de>
  in debian-devel, I have prepared a new packaging of 'mplayer'
  (with code that comes from CVS)
* the upstream tar.bz cannot be distributed by Debian, since it contains
   CSS code; so I am repackaging it 
* I have tried my best to address all known issues:
  - the package contains the detailed Copyright made by Diego Biurrun 
  - the package does not contain CSS code, or  AFAIK other code on which 
     there is active patent enforcement
  - there is a script  debian/cvs-changelog.sh  that shows all changes
     done to files included in this source.
    This should comply with GPLv2 sec 2.a  (in spirit if not in letter)
    For this reason, the source code contains CVS directories.
* needs   make (>= 3.80) for 'html-chunked-$(1)' in DOCS/xml/Makefile

* some corrections, as suggested Diego Biurrun
  - binary codecs should go into /usr/lib/codecs (upstream default)
  - better template 'mplayer/install_codecs'
  - an empty 'font=' in mplayer.conf breaks mplayer: postinst corrected
* correction in 'mplayer/cfgnote'
* better mplayer.postinst and mplayer.config

* New upstream release
* better debian/copyright file
* do not ship a skin
* New upstream release
* changed DEB_BUILD_OPTIONS to DEB_BUILD_CONFIGURE ,
  DEB_BUILD_OPTIONS is used as in debian policy
* use gcc-3.4
* changed xlibs-dev to a long list of dependencies, for Debian/etch
* try to adhere to  http://www.mplayerhq.hu/DOCS/tech/binary-packaging.txt
  (see README.Debian for details)
* removed dependency on xlibmesa-dev, disabled opengl
* New upstream release
* Simon McVittie <hacks@pseudorandom.co.uk> wonderful work:
- Work around Debian bug #267442 (glibc's sys/uio.h and gcc's altivec.h have
  conflicting uses for __vector) by re-ordering #includes
- Fix potential symlink attack in ./configure
- Disable support for binary codecs on platforms for which those codecs
  aren't available; also disable the corresponding Debconf note when it's
  inappropriate
- Changed Build-Depends: so it works in pbuilder
- Explicitly build-depend on libjpeg62-dev, libfontconfig1-dev,
  libungif4-dev 
- Tweak debian/rules to avoid certain errors being ignored
- Use --language=all
* provide a target  'debian/rules get-orig-source' 
  that recreates the orig.tar.gz ; then use the above orig.tar.gz
* rewrote some parts of debian/rules
* don't clean and recompile docs if upstream ships them
* mplayer-doc was shipping too much stuff
* translated man pages where not installed properly
* compile with libdv4-dev
* correct README.Debian
* Forgot build-dep on libtheora
* Must not depend on libxvidcore
* New upstream release
* new release.
* rc1 to become 0.90
* new pre-release
* new pre-release
* gtk bug fixed.
* new release.
* version bumped
* 0.60 pre2 release
* 0.60 pre-release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
 
30
30
#include "libavutil/intreadwrite.h"
31
31
#include "avformat.h"
 
32
#include "internal.h"
32
33
 
33
34
#define FILM_TAG MKBETAG('F', 'I', 'L', 'M')
34
35
#define FDSC_TAG MKBETAG('F', 'D', 'S', 'C')
35
36
#define STAB_TAG MKBETAG('S', 'T', 'A', 'B')
36
37
#define CVID_TAG MKBETAG('c', 'v', 'i', 'd')
 
38
#define RAW_TAG  MKBETAG('r', 'a', 'w', ' ')
37
39
 
38
40
typedef struct {
39
41
  int stream;
111
113
        film->audio_samplerate = AV_RB16(&scratch[24]);
112
114
        film->audio_channels = scratch[21];
113
115
        film->audio_bits = scratch[22];
114
 
        if (film->audio_bits == 8)
115
 
            film->audio_type = CODEC_ID_PCM_S8;
116
 
        else if (film->audio_bits == 16)
117
 
            film->audio_type = CODEC_ID_PCM_S16BE;
118
 
        else
 
116
        if (scratch[23] == 2)
 
117
            film->audio_type = CODEC_ID_ADPCM_ADX;
 
118
        else if (film->audio_channels > 0) {
 
119
            if (film->audio_bits == 8)
 
120
                film->audio_type = CODEC_ID_PCM_S8;
 
121
            else if (film->audio_bits == 16)
 
122
                film->audio_type = CODEC_ID_PCM_S16BE;
 
123
            else
 
124
                film->audio_type = CODEC_ID_NONE;
 
125
        } else
119
126
            film->audio_type = CODEC_ID_NONE;
120
127
    }
121
128
 
124
131
 
125
132
    if (AV_RB32(&scratch[8]) == CVID_TAG) {
126
133
        film->video_type = CODEC_ID_CINEPAK;
127
 
    } else
 
134
    } else if (AV_RB32(&scratch[8]) == RAW_TAG) {
 
135
        film->video_type = CODEC_ID_RAWVIDEO;
 
136
    } else {
128
137
        film->video_type = CODEC_ID_NONE;
 
138
    }
129
139
 
130
140
    /* initialize the decoder streams */
131
141
    if (film->video_type) {
132
 
        st = av_new_stream(s, 0);
 
142
        st = avformat_new_stream(s, NULL);
133
143
        if (!st)
134
144
            return AVERROR(ENOMEM);
135
145
        film->video_stream_index = st->index;
138
148
        st->codec->codec_tag = 0;  /* no fourcc */
139
149
        st->codec->width = AV_RB32(&scratch[16]);
140
150
        st->codec->height = AV_RB32(&scratch[12]);
 
151
 
 
152
        if (film->video_type == CODEC_ID_RAWVIDEO) {
 
153
            if (scratch[20] == 24) {
 
154
                st->codec->pix_fmt = PIX_FMT_RGB24;
 
155
            } else {
 
156
                av_log(s, AV_LOG_ERROR, "raw video is using unhandled %dbpp\n", scratch[20]);
 
157
                return -1;
 
158
            }
 
159
        }
141
160
    }
142
161
 
143
162
    if (film->audio_type) {
144
 
        st = av_new_stream(s, 0);
 
163
        st = avformat_new_stream(s, NULL);
145
164
        if (!st)
146
165
            return AVERROR(ENOMEM);
147
166
        film->audio_stream_index = st->index;
149
168
        st->codec->codec_id = film->audio_type;
150
169
        st->codec->codec_tag = 1;
151
170
        st->codec->channels = film->audio_channels;
152
 
        st->codec->bits_per_coded_sample = film->audio_bits;
153
171
        st->codec->sample_rate = film->audio_samplerate;
 
172
 
 
173
        if (film->audio_type == CODEC_ID_ADPCM_ADX) {
 
174
            st->codec->bits_per_coded_sample = 18 * 8 / 32;
 
175
            st->codec->block_align = st->codec->channels * 18;
 
176
            st->need_parsing = AVSTREAM_PARSE_FULL;
 
177
        } else {
 
178
            st->codec->bits_per_coded_sample = film->audio_bits;
 
179
            st->codec->block_align = st->codec->channels *
 
180
                st->codec->bits_per_coded_sample / 8;
 
181
        }
 
182
 
154
183
        st->codec->bit_rate = st->codec->channels * st->codec->sample_rate *
155
184
            st->codec->bits_per_coded_sample;
156
 
        st->codec->block_align = st->codec->channels *
157
 
            st->codec->bits_per_coded_sample / 8;
158
185
    }
159
186
 
160
187
    /* load the sample table */
167
194
    if(film->sample_count >= UINT_MAX / sizeof(film_sample))
168
195
        return -1;
169
196
    film->sample_table = av_malloc(film->sample_count * sizeof(film_sample));
 
197
    if (!film->sample_table)
 
198
        return AVERROR(ENOMEM);
170
199
 
171
200
    for(i=0; i<s->nb_streams; i++)
172
 
        av_set_pts_info(s->streams[i], 33, 1, film->base_clock);
 
201
        avpriv_set_pts_info(s->streams[i], 33, 1, film->base_clock);
173
202
 
174
203
    audio_frame_counter = 0;
175
204
    for (i = 0; i < film->sample_count; i++) {
187
216
            film->sample_table[i].pts *= film->base_clock;
188
217
            film->sample_table[i].pts /= film->audio_samplerate;
189
218
 
190
 
            audio_frame_counter += (film->sample_table[i].sample_size /
191
 
                (film->audio_channels * film->audio_bits / 8));
 
219
            if (film->audio_type == CODEC_ID_ADPCM_ADX)
 
220
                audio_frame_counter += (film->sample_table[i].sample_size * 32 /
 
221
                    (18 * film->audio_channels));
 
222
            else if (film->audio_type != CODEC_ID_NONE)
 
223
                audio_frame_counter += (film->sample_table[i].sample_size /
 
224
                    (film->audio_channels * film->audio_bits / 8));
192
225
        } else {
193
226
            film->sample_table[i].stream = film->video_stream_index;
194
227
            film->sample_table[i].pts = AV_RB32(&scratch[8]) & 0x7FFFFFFF;
227
260
            return AVERROR(ENOMEM);
228
261
        avio_read(pb, pkt->data, sample->sample_size);
229
262
    } else if ((sample->stream == film->audio_stream_index) &&
230
 
        (film->audio_channels == 2)) {
 
263
        (film->audio_channels == 2) &&
 
264
        (film->audio_type != CODEC_ID_ADPCM_ADX)) {
231
265
        /* stereo PCM needs to be interleaved */
232
266
 
233
267
        if (av_new_packet(pkt, sample->sample_size))
238
272
            av_free(film->stereo_buffer);
239
273
            film->stereo_buffer_size = sample->sample_size;
240
274
            film->stereo_buffer = av_malloc(film->stereo_buffer_size);
 
275
            if (!film->stereo_buffer) {
 
276
                film->stereo_buffer_size = 0;
 
277
                return AVERROR(ENOMEM);
 
278
            }
241
279
        }
242
280
 
243
281
        pkt->pos= avio_tell(pb);
283
321
}
284
322
 
285
323
AVInputFormat ff_segafilm_demuxer = {
286
 
    "film_cpk",
287
 
    NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),
288
 
    sizeof(FilmDemuxContext),
289
 
    film_probe,
290
 
    film_read_header,
291
 
    film_read_packet,
292
 
    film_read_close,
 
324
    .name           = "film_cpk",
 
325
    .long_name      = NULL_IF_CONFIG_SMALL("Sega FILM/CPK format"),
 
326
    .priv_data_size = sizeof(FilmDemuxContext),
 
327
    .read_probe     = film_probe,
 
328
    .read_header    = film_read_header,
 
329
    .read_packet    = film_read_packet,
 
330
    .read_close     = film_read_close,
293
331
};