~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavformat/rawdec.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:
21
21
 */
22
22
 
23
23
#include "avformat.h"
 
24
#include "internal.h"
24
25
#include "avio_internal.h"
25
26
#include "rawdec.h"
26
27
#include "libavutil/opt.h"
33
34
    AVStream *st;
34
35
    enum CodecID id;
35
36
 
36
 
    st = av_new_stream(s, 0);
 
37
    st = avformat_new_stream(s, NULL);
37
38
    if (!st)
38
39
        return AVERROR(ENOMEM);
39
40
 
49
50
        case AVMEDIA_TYPE_AUDIO: {
50
51
            RawAudioDemuxerContext *s1 = s->priv_data;
51
52
 
52
 
#if FF_API_FORMAT_PARAMETERS
53
 
            if (ap->sample_rate)
54
 
                st->codec->sample_rate = ap->sample_rate;
55
 
            if (ap->channels)
56
 
                st->codec->channels    = ap->channels;
57
 
            else st->codec->channels   = 1;
58
 
#endif
59
 
 
60
 
            if (s1->sample_rate)
 
53
            st->codec->channels = 1;
 
54
 
 
55
            if (id == CODEC_ID_ADPCM_G722)
 
56
                st->codec->sample_rate = 16000;
 
57
 
 
58
            if (s1 && s1->sample_rate)
61
59
                st->codec->sample_rate = s1->sample_rate;
62
 
            if (s1->channels)
 
60
            if (s1 && s1->channels)
63
61
                st->codec->channels    = s1->channels;
64
62
 
65
63
            st->codec->bits_per_coded_sample = av_get_bits_per_sample(st->codec->codec_id);
66
64
            assert(st->codec->bits_per_coded_sample > 0);
67
65
            st->codec->block_align = st->codec->bits_per_coded_sample*st->codec->channels/8;
68
 
            av_set_pts_info(st, 64, 1, st->codec->sample_rate);
 
66
            avpriv_set_pts_info(st, 64, 1, st->codec->sample_rate);
69
67
            break;
70
68
            }
71
69
        case AVMEDIA_TYPE_VIDEO: {
87
85
                av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
88
86
                goto fail;
89
87
            }
90
 
#if FF_API_FORMAT_PARAMETERS
91
 
            if (ap->width > 0)
92
 
                width = ap->width;
93
 
            if (ap->height > 0)
94
 
                height = ap->height;
95
 
            if (ap->pix_fmt)
96
 
                pix_fmt = ap->pix_fmt;
97
 
            if (ap->time_base.num)
98
 
                framerate = (AVRational){ap->time_base.den, ap->time_base.num};
99
 
#endif
100
 
            av_set_pts_info(st, 64, framerate.den, framerate.num);
 
88
            avpriv_set_pts_info(st, 64, framerate.den, framerate.num);
101
89
            st->codec->width  = width;
102
90
            st->codec->height = height;
103
91
            st->codec->pix_fmt = pix_fmt;
135
123
int ff_raw_audio_read_header(AVFormatContext *s,
136
124
                             AVFormatParameters *ap)
137
125
{
138
 
    AVStream *st = av_new_stream(s, 0);
 
126
    AVStream *st = avformat_new_stream(s, NULL);
139
127
    if (!st)
140
128
        return AVERROR(ENOMEM);
141
129
    st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
142
130
    st->codec->codec_id = s->iformat->value;
143
131
    st->need_parsing = AVSTREAM_PARSE_FULL;
 
132
    st->start_time = 0;
144
133
    /* the parameters will be extracted from the compressed bitstream */
145
134
 
146
135
    return 0;
156
145
    int ret = 0;
157
146
 
158
147
 
159
 
    st = av_new_stream(s, 0);
 
148
    st = avformat_new_stream(s, NULL);
160
149
    if (!st) {
161
150
        ret = AVERROR(ENOMEM);
162
151
        goto fail;
170
159
        av_log(s, AV_LOG_ERROR, "Could not parse framerate: %s.\n", s1->framerate);
171
160
        goto fail;
172
161
    }
173
 
#if FF_API_FORMAT_PARAMETERS
174
 
    if (ap->time_base.num)
175
 
        framerate = (AVRational){ap->time_base.den, ap->time_base.num};
176
 
#endif
177
162
 
178
 
    st->codec->time_base = (AVRational){framerate.den, framerate.num};
179
 
    av_set_pts_info(st, 64, 1, 1200000);
 
163
    st->r_frame_rate = st->avg_frame_rate = framerate;
 
164
    avpriv_set_pts_info(st, 64, 1, 1200000);
180
165
 
181
166
fail:
182
167
    return ret;
184
169
 
185
170
/* Note: Do not forget to add new entries to the Makefile as well. */
186
171
 
187
 
static const AVOption audio_options[] = {
188
 
    { "sample_rate", "", offsetof(RawAudioDemuxerContext, sample_rate), FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
189
 
    { "channels",    "", offsetof(RawAudioDemuxerContext, channels),    FF_OPT_TYPE_INT, {.dbl = 0}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM },
190
 
    { NULL },
191
 
};
192
 
 
193
 
const AVClass ff_rawaudio_demuxer_class = {
194
 
    .class_name     = "rawaudio demuxer",
195
 
    .item_name      = av_default_item_name,
196
 
    .option         = audio_options,
197
 
    .version        = LIBAVUTIL_VERSION_INT,
198
 
};
199
 
 
200
172
#define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x)
201
173
#define DEC AV_OPT_FLAG_DECODING_PARAM
202
 
static const AVOption video_options[] = {
203
 
    { "video_size", "A string describing frame size, such as 640x480 or hd720.", OFFSET(video_size), FF_OPT_TYPE_STRING, {.str = NULL}, 0, 0, DEC },
204
 
    { "pixel_format", "", OFFSET(pixel_format), FF_OPT_TYPE_STRING, {.str = "yuv420p"}, 0, 0, DEC },
205
 
    { "framerate", "", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
 
174
const AVOption ff_rawvideo_options[] = {
 
175
    { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC},
206
176
    { NULL },
207
177
};
208
 
#undef OFFSET
209
 
#undef DEC
210
 
 
211
 
const AVClass ff_rawvideo_demuxer_class = {
212
 
    .class_name     = "rawvideo demuxer",
213
 
    .item_name      = av_default_item_name,
214
 
    .option         = video_options,
215
 
    .version        = LIBAVUTIL_VERSION_INT,
216
 
};
217
178
 
218
179
#if CONFIG_G722_DEMUXER
219
180
AVInputFormat ff_g722_demuxer = {
220
 
    "g722",
221
 
    NULL_IF_CONFIG_SMALL("raw G.722"),
222
 
    sizeof(RawAudioDemuxerContext),
223
 
    NULL,
224
 
    ff_raw_read_header,
225
 
    ff_raw_read_partial_packet,
 
181
    .name           = "g722",
 
182
    .long_name      = NULL_IF_CONFIG_SMALL("raw G.722"),
 
183
    .read_header    = ff_raw_read_header,
 
184
    .read_packet    = ff_raw_read_partial_packet,
226
185
    .flags= AVFMT_GENERIC_INDEX,
227
186
    .extensions = "g722,722",
228
187
    .value = CODEC_ID_ADPCM_G722,
229
 
    .priv_class = &ff_rawaudio_demuxer_class,
230
188
};
231
189
#endif
232
190
 
233
 
#if CONFIG_GSM_DEMUXER
234
 
AVInputFormat ff_gsm_demuxer = {
235
 
    "gsm",
236
 
    NULL_IF_CONFIG_SMALL("raw GSM"),
237
 
    0,
238
 
    NULL,
239
 
    ff_raw_audio_read_header,
240
 
    ff_raw_read_partial_packet,
 
191
#if CONFIG_LATM_DEMUXER
 
192
AVInputFormat ff_latm_demuxer = {
 
193
    .name           = "latm",
 
194
    .long_name      = NULL_IF_CONFIG_SMALL("raw LOAS/LATM"),
 
195
    .read_header    = ff_raw_audio_read_header,
 
196
    .read_packet    = ff_raw_read_partial_packet,
241
197
    .flags= AVFMT_GENERIC_INDEX,
242
 
    .extensions = "gsm",
243
 
    .value = CODEC_ID_GSM,
 
198
    .extensions = "latm",
 
199
    .value = CODEC_ID_AAC_LATM,
244
200
};
245
201
#endif
246
202
 
250
206
 
251
207
#if CONFIG_MLP_DEMUXER
252
208
AVInputFormat ff_mlp_demuxer = {
253
 
    "mlp",
254
 
    NULL_IF_CONFIG_SMALL("raw MLP"),
255
 
    0,
256
 
    NULL,
257
 
    ff_raw_audio_read_header,
258
 
    ff_raw_read_partial_packet,
 
209
    .name           = "mlp",
 
210
    .long_name      = NULL_IF_CONFIG_SMALL("raw MLP"),
 
211
    .read_header    = ff_raw_audio_read_header,
 
212
    .read_packet    = ff_raw_read_partial_packet,
259
213
    .flags= AVFMT_GENERIC_INDEX,
260
214
    .extensions = "mlp",
261
215
    .value = CODEC_ID_MLP,
264
218
 
265
219
#if CONFIG_TRUEHD_DEMUXER
266
220
AVInputFormat ff_truehd_demuxer = {
267
 
    "truehd",
268
 
    NULL_IF_CONFIG_SMALL("raw TrueHD"),
269
 
    0,
270
 
    NULL,
271
 
    ff_raw_audio_read_header,
272
 
    ff_raw_read_partial_packet,
 
221
    .name           = "truehd",
 
222
    .long_name      = NULL_IF_CONFIG_SMALL("raw TrueHD"),
 
223
    .read_header    = ff_raw_audio_read_header,
 
224
    .read_packet    = ff_raw_read_partial_packet,
273
225
    .flags= AVFMT_GENERIC_INDEX,
274
226
    .extensions = "thd",
275
227
    .value = CODEC_ID_TRUEHD,
278
230
 
279
231
#if CONFIG_SHORTEN_DEMUXER
280
232
AVInputFormat ff_shorten_demuxer = {
281
 
    "shn",
282
 
    NULL_IF_CONFIG_SMALL("raw Shorten"),
283
 
    0,
284
 
    NULL,
285
 
    ff_raw_audio_read_header,
286
 
    ff_raw_read_partial_packet,
287
 
    .flags= AVFMT_GENERIC_INDEX,
 
233
    .name           = "shn",
 
234
    .long_name      = NULL_IF_CONFIG_SMALL("raw Shorten"),
 
235
    .read_header    = ff_raw_audio_read_header,
 
236
    .read_packet    = ff_raw_read_partial_packet,
 
237
    .flags          = AVFMT_NOBINSEARCH | AVFMT_NOGENSEARCH | AVFMT_NO_BYTE_SEEK,
288
238
    .extensions = "shn",
289
239
    .value = CODEC_ID_SHORTEN,
290
240
};