~medibuntu-maintainers/mplayer/medibuntu.precise

« back to all changes in this revision

Viewing changes to ffmpeg/libavdevice/fbdev.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:
24
24
 * @file
25
25
 * Linux framebuffer input device,
26
26
 * inspired by code from fbgrab.c by Gunnar Monell.
27
 
 * See also http://linux-fbdev.sourceforge.net/.
 
27
 * @see http://linux-fbdev.sourceforge.net/
28
28
 */
29
29
 
30
30
/* #define DEBUG */
43
43
#include "libavutil/parseutils.h"
44
44
#include "libavutil/pixdesc.h"
45
45
#include "libavformat/avformat.h"
 
46
#include "libavformat/internal.h"
46
47
 
47
48
struct rgb_pixfmt_map_entry {
48
49
    int bits_per_pixel;
79
80
typedef struct {
80
81
    AVClass *class;          ///< class for private options
81
82
    int frame_size;          ///< size in bytes of a grabbed frame
82
 
    AVRational fps;          ///< framerate
 
83
    AVRational framerate_q;  ///< framerate
83
84
    char *framerate;         ///< framerate string set by a private option
84
85
    int64_t time_frame;      ///< time for the next frame to output (in 1/1000000 units)
85
86
 
86
87
    int fd;                  ///< framebuffer device file descriptor
87
 
    int width, heigth;       ///< assumed frame resolution
 
88
    int width, height;       ///< assumed frame resolution
88
89
    int frame_linesize;      ///< linesize of the output frame, it is assumed to be constant
89
90
    int bytes_per_pixel;
90
91
 
102
103
    enum PixelFormat pix_fmt;
103
104
    int ret, flags = O_RDONLY;
104
105
 
105
 
    ret = av_parse_video_rate(&fbdev->fps, fbdev->framerate);
 
106
    ret = av_parse_video_rate(&fbdev->framerate_q, fbdev->framerate);
106
107
    if (ret < 0) {
107
 
        av_log(avctx, AV_LOG_ERROR, "Couldn't parse framerate.\n");
 
108
        av_log(avctx, AV_LOG_ERROR, "Could not parse framerate '%s'.\n", fbdev->framerate);
108
109
        return ret;
109
110
    }
110
 
#if FF_API_FORMAT_PARAMETERS
111
 
    if (ap->time_base.num)
112
 
        fbdev->fps = (AVRational){ap->time_base.den, ap->time_base.num};
113
 
#endif
114
111
 
115
 
    if (!(st = av_new_stream(avctx, 0)))
 
112
    if (!(st = avformat_new_stream(avctx, NULL)))
116
113
        return AVERROR(ENOMEM);
117
 
    av_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
 
114
    avpriv_set_pts_info(st, 64, 1, 1000000); /* 64 bits pts in microseconds */
118
115
 
119
116
    /* NONBLOCK is ignored by the fbdev driver, only set for consistency */
120
117
    if (avctx->flags & AVFMT_FLAG_NONBLOCK)
151
148
    }
152
149
 
153
150
    fbdev->width           = fbdev->varinfo.xres;
154
 
    fbdev->heigth          = fbdev->varinfo.yres;
 
151
    fbdev->height          = fbdev->varinfo.yres;
155
152
    fbdev->bytes_per_pixel = (fbdev->varinfo.bits_per_pixel + 7) >> 3;
156
153
    fbdev->frame_linesize  = fbdev->width * fbdev->bytes_per_pixel;
157
 
    fbdev->frame_size      = fbdev->frame_linesize * fbdev->heigth;
 
154
    fbdev->frame_size      = fbdev->frame_linesize * fbdev->height;
158
155
    fbdev->time_frame      = AV_NOPTS_VALUE;
159
156
    fbdev->data = mmap(NULL, fbdev->fixinfo.smem_len, PROT_READ, MAP_SHARED, fbdev->fd, 0);
160
157
    if (fbdev->data == MAP_FAILED) {
166
163
    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
167
164
    st->codec->codec_id   = CODEC_ID_RAWVIDEO;
168
165
    st->codec->width      = fbdev->width;
169
 
    st->codec->height     = fbdev->heigth;
 
166
    st->codec->height     = fbdev->height;
170
167
    st->codec->pix_fmt    = pix_fmt;
171
 
    st->codec->time_base  = (AVRational){fbdev->fps.den, fbdev->fps.num};
 
168
    st->codec->time_base  = (AVRational){fbdev->framerate_q.den, fbdev->framerate_q.num};
172
169
    st->codec->bit_rate   =
173
 
        fbdev->width * fbdev->heigth * fbdev->bytes_per_pixel * av_q2d(fbdev->fps) * 8;
 
170
        fbdev->width * fbdev->height * fbdev->bytes_per_pixel * av_q2d(fbdev->framerate_q) * 8;
174
171
 
175
172
    av_log(avctx, AV_LOG_INFO,
176
173
           "w:%d h:%d bpp:%d pixfmt:%s fps:%d/%d bit_rate:%d\n",
177
 
           fbdev->width, fbdev->heigth, fbdev->varinfo.bits_per_pixel,
 
174
           fbdev->width, fbdev->height, fbdev->varinfo.bits_per_pixel,
178
175
           av_pix_fmt_descriptors[pix_fmt].name,
179
 
           fbdev->fps.num, fbdev->fps.den,
 
176
           fbdev->framerate_q.num, fbdev->framerate_q.den,
180
177
           st->codec->bit_rate);
181
178
    return 0;
182
179
 
210
207
        while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
211
208
    }
212
209
    /* compute the time of the next frame */
213
 
    fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->fps);
 
210
    fbdev->time_frame += INT64_C(1000000) / av_q2d(fbdev->framerate_q);
214
211
 
215
212
    if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0)
216
213
        return ret;
228
225
    pout = pkt->data;
229
226
 
230
227
    // TODO it'd be nice if the lines were aligned
231
 
    for (i = 0; i < fbdev->heigth; i++) {
 
228
    for (i = 0; i < fbdev->height; i++) {
232
229
        memcpy(pout, pin, fbdev->frame_linesize);
233
230
        pin  += fbdev->fixinfo.line_length;
234
231
        pout += fbdev->frame_linesize;
250
247
#define OFFSET(x) offsetof(FBDevContext, x)
251
248
#define DEC AV_OPT_FLAG_DECODING_PARAM
252
249
static const AVOption options[] = {
253
 
    { "framerate","", OFFSET(framerate), FF_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
 
250
    { "framerate","", OFFSET(framerate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0, DEC },
254
251
    { NULL },
255
252
};
256
253