Browse Source

added mp* - uploaded2-3-hevc-base-PPA

master
mango 2 years ago
parent
commit
5a4e4e0651
100 changed files with 171907 additions and 0 deletions
  1. +1
    -0
      m/mplayer-1.3.0/.pc/.quilt_patches
  2. +1
    -0
      m/mplayer-1.3.0/.pc/.quilt_series
  3. +1
    -0
      m/mplayer-1.3.0/.pc/.version
  4. +1
    -0
      m/mplayer-1.3.0/.pc/0001_version.patch/VERSION
  5. +4172
    -0
      m/mplayer-1.3.0/.pc/0002_mplayer_debug_printf.patch/mplayer.c
  6. +360
    -0
      m/mplayer-1.3.0/.pc/0100_svn37857_CVE-2016-4352.patch/libmpdemux/demux_gif.c
  7. +318
    -0
      m/mplayer-1.3.0/.pc/0101_svn37875_fix-crash-with-screenshot-filter.patch/libmpcodecs/vf_screenshot.c
  8. +442
    -0
      m/mplayer-1.3.0/.pc/0200_fix_spelling_error_in_binary.patch/stream/dvb_tune.c
  9. +881
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/gui/dialog/fileselect.c
  10. +474
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/libao2/ao_esd.c
  11. +506
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/libmenu/menu_filesel.c
  12. +320
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/libmpcodecs/vf_screenshot.c
  13. +169
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/libmpdemux/mf.c
  14. +4175
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/mplayer.c
  15. +72
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/osdep/osdep.h
  16. +533
    -0
      m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/stream/stream_bd.c
  17. +7
    -0
      m/mplayer-1.3.0/.pc/applied-patches
  18. +1117
    -0
      m/mplayer-1.3.0/.pc/fix_ffmpeg3_flags.patch/Makefile
  19. +1129
    -0
      m/mplayer-1.3.0/AUTHORS
  20. +3328
    -0
      m/mplayer-1.3.0/Changelog
  21. +138
    -0
      m/mplayer-1.3.0/Copyright
  22. +29
    -0
      m/mplayer-1.3.0/DOCS/README
  23. +5
    -0
      m/mplayer-1.3.0/DOCS/default.css
  24. +10573
    -0
      m/mplayer-1.3.0/DOCS/man/cs/mplayer.1
  25. +12011
    -0
      m/mplayer-1.3.0/DOCS/man/de/mplayer.1
  26. +12434
    -0
      m/mplayer-1.3.0/DOCS/man/en/mplayer.1
  27. +7823
    -0
      m/mplayer-1.3.0/DOCS/man/es/mplayer.1
  28. +11948
    -0
      m/mplayer-1.3.0/DOCS/man/fr/mplayer.1
  29. +11812
    -0
      m/mplayer-1.3.0/DOCS/man/hu/mplayer.1
  30. +12568
    -0
      m/mplayer-1.3.0/DOCS/man/it/mplayer.1
  31. +9130
    -0
      m/mplayer-1.3.0/DOCS/man/pl/mplayer.1
  32. +11549
    -0
      m/mplayer-1.3.0/DOCS/man/ru/mplayer.1
  33. +12434
    -0
      m/mplayer-1.3.0/DOCS/man/zh_CN/mplayer.1
  34. +2322
    -0
      m/mplayer-1.3.0/DOCS/tech/Doxyfile
  35. +222
    -0
      m/mplayer-1.3.0/DOCS/tech/MAINTAINERS
  36. +87
    -0
      m/mplayer-1.3.0/DOCS/tech/TODO
  37. +218
    -0
      m/mplayer-1.3.0/DOCS/tech/binary-packaging.txt
  38. +132
    -0
      m/mplayer-1.3.0/DOCS/tech/code-documentation.txt
  39. +207
    -0
      m/mplayer-1.3.0/DOCS/tech/codec-devel.txt
  40. +181
    -0
      m/mplayer-1.3.0/DOCS/tech/codecs-in.html
  41. +214
    -0
      m/mplayer-1.3.0/DOCS/tech/codecs.conf.txt
  42. +158
    -0
      m/mplayer-1.3.0/DOCS/tech/colorspaces.txt
  43. +48
    -0
      m/mplayer-1.3.0/DOCS/tech/crosscompile.txt
  44. +129
    -0
      m/mplayer-1.3.0/DOCS/tech/dr-methods.txt
  45. +138
    -0
      m/mplayer-1.3.0/DOCS/tech/encoding-guide.txt
  46. +725
    -0
      m/mplayer-1.3.0/DOCS/tech/encoding-tips.txt
  47. +160
    -0
      m/mplayer-1.3.0/DOCS/tech/formats.txt
  48. +228
    -0
      m/mplayer-1.3.0/DOCS/tech/general.txt
  49. +145
    -0
      m/mplayer-1.3.0/DOCS/tech/hwac3.txt
  50. +56
    -0
      m/mplayer-1.3.0/DOCS/tech/libao2.txt
  51. +384
    -0
      m/mplayer-1.3.0/DOCS/tech/libmpcodecs.txt
  52. +173
    -0
      m/mplayer-1.3.0/DOCS/tech/libvo.txt
  53. +283
    -0
      m/mplayer-1.3.0/DOCS/tech/manpage.txt
  54. +230
    -0
      m/mplayer-1.3.0/DOCS/tech/mirrors/mirror_howto.txt
  55. +37
    -0
      m/mplayer-1.3.0/DOCS/tech/mirrors/update_mplayer_rsync
  56. +28
    -0
      m/mplayer-1.3.0/DOCS/tech/mpdsf.txt
  57. +100
    -0
      m/mplayer-1.3.0/DOCS/tech/mpsub.sub
  58. +86
    -0
      m/mplayer-1.3.0/DOCS/tech/osd.txt
  59. +119
    -0
      m/mplayer-1.3.0/DOCS/tech/patches.txt
  60. +123
    -0
      m/mplayer-1.3.0/DOCS/tech/playtree
  61. +22
    -0
      m/mplayer-1.3.0/DOCS/tech/realcodecs/TODO
  62. +155
    -0
      m/mplayer-1.3.0/DOCS/tech/realcodecs/audio-codecs.txt
  63. +58
    -0
      m/mplayer-1.3.0/DOCS/tech/realcodecs/streaming.txt
  64. +185
    -0
      m/mplayer-1.3.0/DOCS/tech/realcodecs/video-codecs.txt
  65. +53
    -0
      m/mplayer-1.3.0/DOCS/tech/release-howto.txt
  66. +43
    -0
      m/mplayer-1.3.0/DOCS/tech/release.sh
  67. +611
    -0
      m/mplayer-1.3.0/DOCS/tech/slave.txt
  68. +89
    -0
      m/mplayer-1.3.0/DOCS/tech/snow.txt
  69. +42
    -0
      m/mplayer-1.3.0/DOCS/tech/subcp.txt
  70. +406
    -0
      m/mplayer-1.3.0/DOCS/tech/svn-howto.txt
  71. +19
    -0
      m/mplayer-1.3.0/DOCS/tech/swscaler_filters.txt
  72. +68
    -0
      m/mplayer-1.3.0/DOCS/tech/swscaler_methods.txt
  73. +145
    -0
      m/mplayer-1.3.0/DOCS/tech/translations.txt
  74. +153
    -0
      m/mplayer-1.3.0/DOCS/tech/vidix.txt
  75. +118
    -0
      m/mplayer-1.3.0/DOCS/tech/win32-codec-howto.txt
  76. +175
    -0
      m/mplayer-1.3.0/DOCS/tech/wishlist
  77. +63
    -0
      m/mplayer-1.3.0/DOCS/xml/README
  78. +496
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/bugreports.xml
  79. +178
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/documentation.xml
  80. +5403
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/encoding-guide.xml
  81. +1295
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/faq.xml
  82. +502
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/install.xml
  83. +776
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/mencoder.xml
  84. +887
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/ports.xml
  85. +1196
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/skin.xml
  86. +1695
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/usage.xml
  87. +2602
    -0
      m/mplayer-1.3.0/DOCS/xml/cs/video.xml
  88. +450
    -0
      m/mplayer-1.3.0/DOCS/xml/de/bugreports.xml
  89. +222
    -0
      m/mplayer-1.3.0/DOCS/xml/de/documentation.xml
  90. +5758
    -0
      m/mplayer-1.3.0/DOCS/xml/de/encoding-guide.xml
  91. +1599
    -0
      m/mplayer-1.3.0/DOCS/xml/de/faq.xml
  92. +565
    -0
      m/mplayer-1.3.0/DOCS/xml/de/install.xml
  93. +752
    -0
      m/mplayer-1.3.0/DOCS/xml/de/mencoder.xml
  94. +859
    -0
      m/mplayer-1.3.0/DOCS/xml/de/ports.xml
  95. +1513
    -0
      m/mplayer-1.3.0/DOCS/xml/de/skin.xml
  96. +1862
    -0
      m/mplayer-1.3.0/DOCS/xml/de/usage.xml
  97. +2744
    -0
      m/mplayer-1.3.0/DOCS/xml/de/video.xml
  98. +83
    -0
      m/mplayer-1.3.0/DOCS/xml/default.css
  99. +502
    -0
      m/mplayer-1.3.0/DOCS/xml/en/bugreports.xml
  100. +169
    -0
      m/mplayer-1.3.0/DOCS/xml/en/documentation.xml

+ 1
- 0
m/mplayer-1.3.0/.pc/.quilt_patches View File

@@ -0,0 +1 @@
debian/patches

+ 1
- 0
m/mplayer-1.3.0/.pc/.quilt_series View File

@@ -0,0 +1 @@
series

+ 1
- 0
m/mplayer-1.3.0/.pc/.version View File

@@ -0,0 +1 @@
2

+ 1
- 0
m/mplayer-1.3.0/.pc/0001_version.patch/VERSION View File

@@ -0,0 +1 @@
1.3.0

+ 4172
- 0
m/mplayer-1.3.0/.pc/0002_mplayer_debug_printf.patch/mplayer.c
File diff suppressed because it is too large
View File


+ 360
- 0
m/mplayer-1.3.0/.pc/0100_svn37857_CVE-2016-4352.patch/libmpdemux/demux_gif.c View File

@@ -0,0 +1,360 @@
/*
* GIF file parser
* Copyright (C) 2003 Joey Parrish
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

#include "config.h"

#include "mp_msg.h"
#include "help_mp.h"

#include "stream/stream.h"
#include "demuxer.h"
#include "stheader.h"

#include <gif_lib.h>
#include "libvo/fastmemcpy.h"
typedef struct {
int current_pts;
unsigned char *palette;
GifFileType *gif;
int w, h;
int useref;
uint8_t *refimg;
} gif_priv_t;

#define GIF_SIGNATURE (('G' << 24) | ('I' << 16) | ('F' << 8) | '8')

#if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 5
#define DGifOpen(a, b) DGifOpen(a, b, NULL)
#define DGifOpenFileHandle(a) DGifOpenFileHandle(a, NULL)
#define GifError() (gif ? gif->Error : 0)
#define GifErrorString() GifErrorString(err)
#if defined GIFLIB_MINOR && GIFLIB_MINOR >= 1
#define DGifCloseFile(a) DGifCloseFile(a, NULL)
#endif
#endif

/* >= 4.2 prior GIFLIB did not have MAJOR/MINOR defines */
#if defined GIFLIB_MAJOR && GIFLIB_MAJOR >= 4
static void print_gif_error(GifFileType *gif)
{
int err = GifError();
const char *err_str = GifErrorString();

if (err_str)
mp_msg(MSGT_DEMUX, MSGL_ERR, "\n[gif] GIF-LIB error: %s.\n", err_str);
else
mp_msg(MSGT_DEMUX, MSGL_ERR, "\n[gif] GIF-LIB undefined error %d.\n", err);
}
#else
static void print_gif_error(GifFileType *gif)
{
PrintGifError();
}
#endif

#ifndef CONFIG_GIF_TVT_HACK
// not supported by certain versions of the library
static int my_read_gif(GifFileType *gif, uint8_t *buf, int len)
{
return stream_read(gif->UserData, buf, len);
}
#endif

static int gif_check_file(demuxer_t *demuxer)
{
if (stream_read_dword(demuxer->stream) == GIF_SIGNATURE) {
int sig = stream_read_word(demuxer->stream);
if ((((sig & 0xff00) == 0x3700) || ((sig & 0xff00) == 0x3900)) && (sig & 0xff) == 'a')
return DEMUXER_TYPE_GIF;
}
return 0;
}

static void memcpy_transp_pic(uint8_t *dst, uint8_t *src, int w, int h,
int dstride, int sstride, int transp, uint8_t trans_col) {
if (transp) {
dstride -= w;
sstride -= w;
while (h-- > 0) {
int wleft = w;
while (wleft-- > 0) {
if (*src != trans_col)
*dst = *src;
dst++; src++;
}
dst += dstride;
src += sstride;
}
} else
memcpy_pic(dst, src, w, h, dstride, sstride);
}

static int demux_gif_fill_buffer(demuxer_t *demuxer, demux_stream_t *ds)
{
gif_priv_t *priv = demuxer->priv;
GifFileType *gif = priv->gif;
GifRecordType type = UNDEFINED_RECORD_TYPE;
int len = 0;
demux_packet_t *dp = NULL;
ColorMapObject *effective_map = NULL;
uint8_t *buf = NULL;
int refmode = 0;
int transparency = 0;
uint8_t transparent_col;

while (type != IMAGE_DESC_RECORD_TYPE) {
if (DGifGetRecordType(gif, &type) == GIF_ERROR) {
print_gif_error(priv->gif);
return 0; // oops
}
if (type == TERMINATE_RECORD_TYPE)
return 0; // eof
if (type == SCREEN_DESC_RECORD_TYPE) {
if (DGifGetScreenDesc(gif) == GIF_ERROR) {
print_gif_error(priv->gif);
return 0; // oops
}
}
if (type == EXTENSION_RECORD_TYPE) {
int code;
unsigned char *p = NULL;
if (DGifGetExtension(gif, &code, &p) == GIF_ERROR) {
print_gif_error(priv->gif);
return 0; // oops
}
if (code == 0xF9) {
int frametime = 0;
if (p && p[0] == 4) // is the length correct?
{
transparency = p[1] & 1;
refmode = (p[1] >> 2) & 3;
// HACK: specification says
// > 0 - No disposal specified. The decoder is not required to take any action.
// but browsers treat it the same way as
// > 1 - Do not dispose. The graphic is to be left in place.
// Some broken files rely on this, e.g.
// http://samples.mplayerhq.hu/GIF/broken-gif/CLAIRE.GIF
if (refmode == 0) refmode = 1;
frametime = (p[3] << 8) | p[2]; // set the time, centiseconds
transparent_col = p[4];
}
priv->current_pts += frametime;
} else if ((code == 0xFE) && (verbose)) { // comment extension
// print iff verbose
printf("GIF comment: ");
while (p != NULL) {
int length = p[0];
char *comments = p + 1;
comments[length] = 0;
printf("%s", comments);
if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
print_gif_error(priv->gif);
return 0; // oops
}
}
printf("\n");
}
while (p != NULL) {
if (DGifGetExtensionNext(gif, &p) == GIF_ERROR) {
print_gif_error(priv->gif);
return 0; // oops
}
}
}
}

if (DGifGetImageDesc(gif) == GIF_ERROR) {
print_gif_error(priv->gif);
return 0; // oops
}

len = gif->Image.Width * gif->Image.Height;
dp = new_demux_packet(priv->w * priv->h);
buf = calloc(gif->Image.Width, gif->Image.Height);
if (priv->useref)
fast_memcpy(dp->buffer, priv->refimg, priv->w * priv->h);
else
memset(dp->buffer, gif->SBackGroundColor, priv->w * priv->h);

if (DGifGetLine(gif, buf, len) == GIF_ERROR) {
print_gif_error(priv->gif);
free(buf);
free_demux_packet(dp);
return 0; // oops
}

effective_map = gif->Image.ColorMap;
if (effective_map == NULL) effective_map = gif->SColorMap;
if (effective_map == NULL) {
mp_msg(MSGT_DEMUX, MSGL_ERR, "[demux_gif] No local nor global colormap.\n");
free(buf);
free_demux_packet(dp);
return 0;
}

{
int y;
int cnt = FFMIN(effective_map->ColorCount, 256);
int l = av_clip(gif->Image.Left, 0, priv->w);
int t = av_clip(gif->Image.Top, 0, priv->h);
int w = av_clip(gif->Image.Width, 0, priv->w - l);
int h = av_clip(gif->Image.Height, 0, priv->h - t);
unsigned char *dest = dp->buffer + priv->w * t + l;

// copy the palette
for (y = 0; y < cnt; y++) {
priv->palette[(y * 4) + 0] = effective_map->Colors[y].Blue;
priv->palette[(y * 4) + 1] = effective_map->Colors[y].Green;
priv->palette[(y * 4) + 2] = effective_map->Colors[y].Red;
priv->palette[(y * 4) + 3] = 0;
}

if (gif->Image.Interlace) {
uint8_t *s = buf;
int ih = (h - 0 + 7) >> 3;
memcpy_transp_pic(dest, s, w, ih,
priv->w << 3, gif->Image.Width,
transparency, transparent_col);
s += ih * w;
ih = (h - 4 + 7) >> 3;
memcpy_transp_pic(dest + (priv->w << 2), s, w, ih,
priv->w << 3, gif->Image.Width,
transparency, transparent_col);
s += ih * w;
ih = (h - 2 + 3) >> 2;
memcpy_transp_pic(dest + (priv->w << 1), s, w, ih,
priv->w << 2, gif->Image.Width,
transparency, transparent_col);
s += ih * w;
ih = (h - 1 + 1) >> 1;
memcpy_transp_pic(dest + priv->w, s, w, ih,
priv->w << 1, gif->Image.Width,
transparency, transparent_col);
} else
memcpy_transp_pic(dest, buf, w, h, priv->w, gif->Image.Width,
transparency, transparent_col);

if (refmode == 1) fast_memcpy(priv->refimg, dp->buffer, priv->w * priv->h);
if (refmode == 2 && priv->useref) {
dest = priv->refimg + priv->w * t + l;
memset(buf, gif->SBackGroundColor, len);
memcpy_pic(dest, buf, w, h, priv->w, gif->Image.Width);
}
if (!(refmode & 2)) priv->useref = refmode & 1;
}

free(buf);

demuxer->video->dpos++;
dp->pts = ((float)priv->current_pts) / 100;
dp->pos = stream_tell(demuxer->stream);
ds_add_packet(demuxer->video, dp);

return 1;
}

static demuxer_t* demux_open_gif(demuxer_t* demuxer)
{
gif_priv_t *priv = calloc(1, sizeof(gif_priv_t));
sh_video_t *sh_video = NULL;
GifFileType *gif = NULL;

priv->current_pts = 0;
demuxer->seekable = 0; // FIXME

// go back to the beginning
stream_seek(demuxer->stream,demuxer->stream->start_pos);

#ifdef CONFIG_GIF_TVT_HACK
// without the TVT functionality of libungif, a hard seek must be
// done to the beginning of the file. this is because libgif is
// unable to use mplayer's cache, and without this lseek libgif will
// not read from the beginning of the file and the command will fail.
// with this hack enabled, you will lose the ability to stream a GIF.
lseek(demuxer->stream->fd, 0, SEEK_SET);
gif = DGifOpenFileHandle(demuxer->stream->fd);
#else
gif = DGifOpen(demuxer->stream, my_read_gif);
#endif
if (!gif) {
print_gif_error(NULL);
free(priv);
return NULL;
}

// create a new video stream header
sh_video = new_sh_video(demuxer, 0);

// make sure the demuxer knows about the new video stream header
// (even though new_sh_video() ought to take care of it)
demuxer->video->id = 0;
demuxer->video->sh = sh_video;

sh_video->format = mmioFOURCC(8, 'R', 'G', 'B');

sh_video->fps = 5.0f;
sh_video->frametime = 1.0f / sh_video->fps;

sh_video->bih = malloc(sizeof(*sh_video->bih) + (256 * 4));
sh_video->bih->biCompression = sh_video->format;
sh_video->bih->biWidth = priv->w = (uint16_t)gif->SWidth;
sh_video->bih->biHeight = priv->h = (uint16_t)gif->SHeight;
sh_video->bih->biBitCount = 8;
sh_video->bih->biPlanes = 2;
priv->palette = (unsigned char *)(sh_video->bih + 1);
priv->refimg = malloc(priv->w * priv->h);

priv->gif = gif;
demuxer->priv = priv;

return demuxer;
}

static void demux_close_gif(demuxer_t* demuxer)
{
gif_priv_t *priv = demuxer->priv;
if (!priv) return;
if (priv->gif && DGifCloseFile(priv->gif) == GIF_ERROR)
print_gif_error(NULL);
free(priv->refimg);
free(priv);
}


const demuxer_desc_t demuxer_desc_gif = {
"GIF demuxer",
"gif",
"GIF",
"Joey Parrish",
"",
DEMUXER_TYPE_GIF,
0, // unsafe autodetect
gif_check_file,
demux_gif_fill_buffer,
demux_open_gif,
demux_close_gif,
NULL,
NULL
};

+ 318
- 0
m/mplayer-1.3.0/.pc/0101_svn37875_fix-crash-with-screenshot-filter.patch/libmpcodecs/vf_screenshot.c View File

@@ -0,0 +1,318 @@
/*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include "config.h"

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>

#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>

#include "mp_msg.h"

#include "img_format.h"
#include "mp_image.h"
#include "vf.h"
#include "vf_scale.h"

#include "libavutil/mem.h"
#include "libswscale/swscale.h"
#include "libavcodec/avcodec.h"

struct vf_priv_s {
int frameno;
char fname[PATH_MAX];
char *prefix;
/// shot stores current screenshot mode:
/// 0: don't take screenshots
/// 1: take single screenshot, reset to 0 afterwards
/// 2: take screenshots of each frame
int shot, store_slices;
int dw, dh;
AVFrame *pic;
struct SwsContext *ctx;
AVCodecContext *avctx;
uint8_t *outbuffer;
int outbuffer_size;
};

//===========================================================================//

static void draw_slice(struct vf_instance *vf, unsigned char** src,
int* stride, int w,int h, int x, int y)
{
if (vf->priv->store_slices) {
sws_scale(vf->priv->ctx, src, stride, y, h, vf->priv->pic->data, vf->priv->pic->linesize);
}
vf_next_draw_slice(vf,src,stride,w,h,x,y);
}

static int config(struct vf_instance *vf,
int width, int height, int d_width, int d_height,
unsigned int flags, unsigned int outfmt)
{
int res;
if (vf->priv->ctx) sws_freeContext(vf->priv->ctx);
vf->priv->ctx=sws_getContextFromCmdLine(width, height, outfmt,
d_width, d_height, IMGFMT_RGB24);

av_fast_malloc(&vf->priv->outbuffer, &vf->priv->outbuffer_size, d_width * d_height * 3 * 2);
if (!vf->priv->avctx) {
vf->priv->avctx = avcodec_alloc_context3(NULL);
vf->priv->avctx->pix_fmt = AV_PIX_FMT_RGB24;
vf->priv->avctx->width = d_width;
vf->priv->avctx->height = d_height;
vf->priv->avctx->compression_level = 0;
if (avcodec_open2(vf->priv->avctx, avcodec_find_encoder(AV_CODEC_ID_PNG), NULL)) {
mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not open libavcodec PNG encoder\n");
return 0;
}
}
vf->priv->dw = d_width;
vf->priv->dh = d_height;
vf->priv->pic->linesize[0] = (3*vf->priv->dw+15)&~15;

av_freep(&vf->priv->pic->data[0]); // probably reconfigured

res = vf_next_config(vf,width,height,d_width,d_height,flags,outfmt);
// Our draw_slice only works properly if the
// following filter can do slices.
vf->draw_slice=vf->next->draw_slice ? draw_slice : NULL;
return res;
}

static void write_png(struct vf_priv_s *priv)
{
char *fname = priv->fname;
FILE * fp;
AVPacket pkt;
int res, got_pkt;

av_init_packet(&pkt);
pkt.data = priv->outbuffer;
pkt.size = priv->outbuffer_size;
priv->pic->width = priv->avctx->width;
priv->pic->height = priv->avctx->height;
priv->pic->format = priv->avctx->pix_fmt;
res = avcodec_encode_video2(priv->avctx, &pkt, priv->pic, &got_pkt);
if (res < 0 || !got_pkt || pkt.size <= 0) {
mp_msg(MSGT_VFILTER,MSGL_ERR,"\nFailed to encode screenshot %s!\n", fname);
return;
}

fp = fopen (fname, "wb");
if (fp == NULL) {
mp_msg(MSGT_VFILTER,MSGL_ERR,"\nPNG Error opening %s for writing!\n", fname);
return;
}

fwrite(priv->outbuffer, pkt.size, 1, fp);

fclose (fp);
mp_msg(MSGT_VFILTER,MSGL_INFO,"*** screenshot '%s' ***\n",priv->fname);
}

static int fexists(char *fname)
{
struct stat dummy;
return stat(fname, &dummy) == 0;
}

static void gen_fname(struct vf_priv_s* priv)
{
do {
snprintf(priv->fname, sizeof(priv->fname), "%s%04d.png", priv->prefix, ++priv->frameno);
} while (fexists(priv->fname) && priv->frameno < 100000);
if (fexists(priv->fname)) {
priv->fname[0] = '\0';
return;
}
}

static void scale_image(struct vf_priv_s* priv, mp_image_t *mpi)
{
if (!priv->pic->data[0])
priv->pic->data[0] = av_malloc(priv->pic->linesize[0]*priv->dh);

sws_scale(priv->ctx, mpi->planes, mpi->stride, 0, mpi->height, priv->pic->data, priv->pic->linesize);
}

static void start_slice(struct vf_instance *vf, mp_image_t *mpi)
{
mpi->priv=
vf->dmpi=vf_get_image(vf->next,mpi->imgfmt,
mpi->type, mpi->flags, mpi->width, mpi->height);
if (vf->priv->shot) {
vf->priv->store_slices = 1;
if (!vf->priv->pic->data[0])
vf->priv->pic->data[0] = av_malloc(vf->priv->pic->linesize[0]*vf->priv->dh);
}

}

static void get_image(struct vf_instance *vf, mp_image_t *mpi)
{
// FIXME: should vf.c really call get_image when using slices??
if (mpi->flags & MP_IMGFLAG_DRAW_CALLBACK)
return;
vf->dmpi= vf_get_image(vf->next, mpi->imgfmt,
mpi->type, mpi->flags/* | MP_IMGFLAG_READABLE*/, mpi->width, mpi->height);

mpi->planes[0]=vf->dmpi->planes[0];
mpi->stride[0]=vf->dmpi->stride[0];
if(mpi->flags&MP_IMGFLAG_PLANAR){
mpi->planes[1]=vf->dmpi->planes[1];
mpi->planes[2]=vf->dmpi->planes[2];
mpi->stride[1]=vf->dmpi->stride[1];
mpi->stride[2]=vf->dmpi->stride[2];
}
mpi->width=vf->dmpi->width;

mpi->flags|=MP_IMGFLAG_DIRECT;

mpi->priv=vf->dmpi;
}

static int put_image(struct vf_instance *vf, mp_image_t *mpi, double pts)
{
mp_image_t *dmpi = (mp_image_t *)mpi->priv;

if(!(mpi->flags&(MP_IMGFLAG_DIRECT|MP_IMGFLAG_DRAW_CALLBACK))){
dmpi=vf_get_image(vf->next,mpi->imgfmt,
MP_IMGTYPE_EXPORT, 0,
mpi->width, mpi->height);
vf_clone_mpi_attributes(dmpi, mpi);
dmpi->planes[0]=mpi->planes[0];
dmpi->planes[1]=mpi->planes[1];
dmpi->planes[2]=mpi->planes[2];
dmpi->stride[0]=mpi->stride[0];
dmpi->stride[1]=mpi->stride[1];
dmpi->stride[2]=mpi->stride[2];
dmpi->width=mpi->width;
dmpi->height=mpi->height;
}

if(vf->priv->shot) {
vf->priv->shot &= ~1;
gen_fname(vf->priv);
if (vf->priv->fname[0]) {
if (!vf->priv->store_slices)
scale_image(vf->priv, dmpi);
write_png(vf->priv);
}
vf->priv->store_slices = 0;
}

return vf_next_put_image(vf, dmpi, pts);
}

static int control (vf_instance_t *vf, int request, void *data)
{
/** data contains an integer argument
* 0: take screenshot with the next frame
* 1: take screenshots with each frame until the same command is given once again
**/
if(request==VFCTRL_SCREENSHOT) {
if (data && *(int*)data) { // repeated screenshot mode
vf->priv->shot ^= 2;
} else { // single screenshot
vf->priv->shot |= 1;
}
return CONTROL_TRUE;
}
return vf_next_control (vf, request, data);
}


//===========================================================================//

static int query_format(struct vf_instance *vf, unsigned int fmt)
{
switch(fmt){
case IMGFMT_YV12:
case IMGFMT_I420:
case IMGFMT_IYUV:
case IMGFMT_UYVY:
case IMGFMT_YUY2:
case IMGFMT_BGR32:
case IMGFMT_BGR24:
case IMGFMT_BGR16:
case IMGFMT_BGR15:
case IMGFMT_BGR12:
case IMGFMT_RGB32:
case IMGFMT_RGB24:
case IMGFMT_Y800:
case IMGFMT_Y8:
case IMGFMT_YVU9:
case IMGFMT_IF09:
case IMGFMT_444P:
case IMGFMT_422P:
case IMGFMT_411P:
return vf_next_query_format(vf, fmt);
}
return 0;
}

static void uninit(vf_instance_t *vf)
{
avcodec_close(vf->priv->avctx);
av_freep(&vf->priv->avctx);
if(vf->priv->ctx) sws_freeContext(vf->priv->ctx);
av_freep(&vf->priv->pic->data[0]);
av_frame_free(&vf->priv->pic);
av_freep(&vf->priv->outbuffer);
free(vf->priv->prefix);
free(vf->priv);
}

static int vf_open(vf_instance_t *vf, char *args)
{
vf->config=config;
vf->control=control;
vf->put_image=put_image;
vf->query_format=query_format;
vf->start_slice=start_slice;
vf->draw_slice=draw_slice;
vf->get_image=get_image;
vf->uninit=uninit;
vf->priv = calloc(1, sizeof(struct vf_priv_s));
vf->priv->pic = av_frame_alloc();
vf->priv->prefix = strdup(args ? args : "shot");
avcodec_register_all();
if (!avcodec_find_encoder(AV_CODEC_ID_PNG)) {
mp_msg(MSGT_VFILTER, MSGL_FATAL, "Could not find libavcodec PNG encoder\n");
return 0;
}
return 1;
}


const vf_info_t vf_info_screenshot = {
"screenshot to file",
"screenshot",
"A'rpi, Jindrich Makovicka",
"",
vf_open,
NULL
};

//===========================================================================//

+ 442
- 0
m/mplayer-1.3.0/.pc/0200_fix_spelling_error_in_binary.patch/stream/dvb_tune.c View File

@@ -0,0 +1,442 @@
/* dvbtune - tune.c

Copyright (C) Dave Chapman 2001,2002

Modified for use with MPlayer, for details see the changelog at
http://svn.mplayerhq.hu/mplayer/trunk/
$Id: dvb_tune.c 30818 2010-03-02 19:57:17Z diego $

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
Or, point your browser to http://www.gnu.org/copyleft/gpl.html

*/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <sys/ioctl.h>
#include <poll.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <errno.h>
#include <linux/dvb/dmx.h>
#include <linux/dvb/frontend.h>
#include "config.h"
#include "dvbin.h"
#include "dvb_tune.h"
#include "mp_msg.h"



int dvb_get_tuner_type(int fe_fd)
{
struct dvb_frontend_info fe_info;

int res;

res = ioctl(fe_fd, FE_GET_INFO, &fe_info);
if(res < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "FE_GET_INFO error: %d, FD: %d\n\n", errno, fe_fd);
return 0;
}

switch(fe_info.type)
{
case FE_OFDM:
mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-T\n");
return TUNER_TER;

case FE_QPSK:
mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-S\n");
return TUNER_SAT;

case FE_QAM:
mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-C\n");
return TUNER_CBL;

#ifdef DVB_ATSC
case FE_ATSC:
mp_msg(MSGT_DEMUX, MSGL_V, "TUNER TYPE SEEMS TO BE DVB-ATSC\n");
return TUNER_ATSC;
#endif
default:
mp_msg(MSGT_DEMUX, MSGL_ERR, "UNKNOWN TUNER TYPE\n");
return 0;
}

}

int dvb_open_devices(dvb_priv_t *priv, int n, int demux_cnt)
{
int i;
char frontend_dev[32], dvr_dev[32], demux_dev[32];

sprintf(frontend_dev, "/dev/dvb/adapter%d/frontend0", n);
sprintf(dvr_dev, "/dev/dvb/adapter%d/dvr0", n);
sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", n);
priv->fe_fd = open(frontend_dev, O_RDWR | O_NONBLOCK);
if(priv->fe_fd < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING FRONTEND DEVICE %s: ERRNO %d\n", frontend_dev, errno);
return 0;
}
priv->demux_fds_cnt = 0;
mp_msg(MSGT_DEMUX, MSGL_V, "DVB_OPEN_DEVICES(%d)\n", demux_cnt);
for(i = 0; i < demux_cnt; i++)
{
priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK);
if(priv->demux_fds[i] < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno);
return 0;
}
else
{
mp_msg(MSGT_DEMUX, MSGL_V, "OPEN(%d), file %s: FD=%d, CNT=%d\n", i, demux_dev, priv->demux_fds[i], priv->demux_fds_cnt);
priv->demux_fds_cnt++;
}
}


priv->dvr_fd = open(dvr_dev, O_RDONLY| O_NONBLOCK);
if(priv->dvr_fd < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DVR DEVICE %s: %d\n", dvr_dev, errno);
return 0;
}

return 1;
}


int dvb_fix_demuxes(dvb_priv_t *priv, int cnt)
{
int i;
char demux_dev[32];

sprintf(demux_dev, "/dev/dvb/adapter%d/demux0", priv->card);
mp_msg(MSGT_DEMUX, MSGL_V, "FIX %d -> %d\n", priv->demux_fds_cnt, cnt);
if(priv->demux_fds_cnt >= cnt)
{
for(i = priv->demux_fds_cnt-1; i >= cnt; i--)
{
mp_msg(MSGT_DEMUX, MSGL_V, "FIX, CLOSE fd(%d): %d\n", i, priv->demux_fds[i]);
close(priv->demux_fds[i]);
}
priv->demux_fds_cnt = cnt;
}
else if(priv->demux_fds_cnt < cnt)
{
for(i = priv->demux_fds_cnt; i < cnt; i++)
{
priv->demux_fds[i] = open(demux_dev, O_RDWR | O_NONBLOCK);
mp_msg(MSGT_DEMUX, MSGL_V, "FIX, OPEN fd(%d): %d\n", i, priv->demux_fds[i]);
if(priv->demux_fds[i] < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR OPENING DEMUX 0: %d\n", errno);
return 0;
}
else
priv->demux_fds_cnt++;
}
}

return 1;
}

int dvb_set_ts_filt(int fd, uint16_t pid, dmx_pes_type_t pestype)
{
int i;
struct dmx_pes_filter_params pesFilterParams;

pesFilterParams.pid = pid;
pesFilterParams.input = DMX_IN_FRONTEND;
pesFilterParams.output = DMX_OUT_TS_TAP;
pesFilterParams.pes_type = pestype;
pesFilterParams.flags = DMX_IMMEDIATE_START;

errno = 0;
if ((i = ioctl(fd, DMX_SET_PES_FILTER, &pesFilterParams)) < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN SETTING DMX_FILTER %i for fd %d: ERRNO: %d", pid, fd, errno);
return 0;
}

mp_msg(MSGT_DEMUX, MSGL_V, "SET PES FILTER ON PID %d to fd %d, RESULT: %d, ERRNO: %d\n", pid, fd, i, errno);
return 1;
}


int dvb_demux_stop(int fd)
{
int i;
i = ioctl(fd, DMX_STOP);

mp_msg(MSGT_DEMUX, MSGL_DBG2, "STOPPING FD: %d, RESULT: %d\n", fd, i);

return i == 0;
}


int dvb_demux_start(int fd)
{
int i;
i = ioctl(fd, DMX_START);

mp_msg(MSGT_DEMUX, MSGL_DBG2, "STARTING FD: %d, RESULT: %d\n", fd, i);

return i == 0;
}


static void print_status(fe_status_t festatus)
{
mp_msg(MSGT_DEMUX, MSGL_V, "FE_STATUS:");
if (festatus & FE_HAS_SIGNAL) mp_msg(MSGT_DEMUX, MSGL_V," FE_HAS_SIGNAL");
if (festatus & FE_TIMEDOUT) mp_msg(MSGT_DEMUX, MSGL_V, " FE_TIMEDOUT");
if (festatus & FE_HAS_LOCK) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_LOCK");
if (festatus & FE_HAS_CARRIER) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_CARRIER");
if (festatus & FE_HAS_VITERBI) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_VITERBI");
if (festatus & FE_HAS_SYNC) mp_msg(MSGT_DEMUX, MSGL_V, " FE_HAS_SYNC");
mp_msg(MSGT_DEMUX, MSGL_V, "\n");
}


static int check_status(int fd_frontend, int tmout)
{
int32_t strength;
fe_status_t festatus;
struct pollfd pfd[1];
int ok=0, locks=0;
time_t tm1, tm2;

pfd[0].fd = fd_frontend;
pfd[0].events = POLLPRI;

mp_msg(MSGT_DEMUX, MSGL_V, "Getting frontend status\n");
tm1 = tm2 = time((time_t*) NULL);
while(!ok)
{
festatus = 0;
if(poll(pfd,1,tmout*1000) > 0)
{
if (pfd[0].revents & POLLPRI)
{
if(ioctl(fd_frontend, FE_READ_STATUS, &festatus) >= 0)
if(festatus & FE_HAS_LOCK)
locks++;
}
}
usleep(10000);
tm2 = time((time_t*) NULL);
if((festatus & FE_TIMEDOUT) || (locks >= 2) || (tm2 - tm1 >= tmout))
ok = 1;
}

if(festatus & FE_HAS_LOCK)
{
strength=0;
if(ioctl(fd_frontend,FE_READ_BER,&strength) >= 0)
mp_msg(MSGT_DEMUX, MSGL_V, "Bit error rate: %d\n",strength);

strength=0;
if(ioctl(fd_frontend,FE_READ_SIGNAL_STRENGTH,&strength) >= 0)
mp_msg(MSGT_DEMUX, MSGL_V, "Signal strength: %d\n",strength);

strength=0;
if(ioctl(fd_frontend,FE_READ_SNR,&strength) >= 0)
mp_msg(MSGT_DEMUX, MSGL_V, "SNR: %d\n",strength);

strength=0;
if(ioctl(fd_frontend,FE_READ_UNCORRECTED_BLOCKS,&strength) >= 0)
mp_msg(MSGT_DEMUX, MSGL_V, "UNC: %d\n",strength);

print_status(festatus);
}
else
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "Not able to lock to the signal on the given frequency, timeout: %d\n", tmout);
return -1;
}
return 0;
}


struct diseqc_cmd {
struct dvb_diseqc_master_cmd cmd;
uint32_t wait;
};

static int diseqc_send_msg(int fd, fe_sec_voltage_t v, struct diseqc_cmd *cmd,
fe_sec_tone_mode_t t, fe_sec_mini_cmd_t b)
{
if(ioctl(fd, FE_SET_TONE, SEC_TONE_OFF) == -1)
return -1;
if(ioctl(fd, FE_SET_VOLTAGE, v) == -1)
return -1;
usleep(15 * 1000);
if(ioctl(fd, FE_DISEQC_SEND_MASTER_CMD, &cmd->cmd) == -1)
return -1;
usleep(cmd->wait * 1000);
usleep(15 * 1000);
if(ioctl(fd, FE_DISEQC_SEND_BURST, b) == -1)
return -1;
usleep(15 * 1000);
if(ioctl(fd, FE_SET_TONE, t) == -1)
return -1;

return 0;
}

/* digital satellite equipment control,
* specification is available from http://www.eutelsat.com/
*/
static int do_diseqc(int secfd, int sat_no, int polv, int hi_lo)
{
struct diseqc_cmd cmd = { {{0xe0, 0x10, 0x38, 0xf0, 0x00, 0x00}, 4}, 0 };

/* param: high nibble: reset bits, low nibble set bits,
* bits are: option, position, polarizaion, band
*/
cmd.cmd.msg[3] =
0xf0 | (((sat_no * 4) & 0x0f) | (hi_lo ? 1 : 0) | (polv ? 0 : 2));

return diseqc_send_msg(secfd, polv ? SEC_VOLTAGE_13 : SEC_VOLTAGE_18,
&cmd, hi_lo ? SEC_TONE_ON : SEC_TONE_OFF,
(sat_no / 4) % 2 ? SEC_MINI_B : SEC_MINI_A);
}

static int tune_it(int fd_frontend, int fd_sec, unsigned int freq, unsigned int srate, char pol, int tone,
fe_spectral_inversion_t specInv, unsigned int diseqc, fe_modulation_t modulation, fe_code_rate_t HP_CodeRate,
fe_transmit_mode_t TransmissionMode, fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth,
fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
{
int res, hi_lo, dfd;
struct dvb_frontend_parameters feparams;
struct dvb_frontend_info fe_info;

mp_msg(MSGT_DEMUX, MSGL_V, "TUNE_IT, fd_frontend %d, fd_sec %d\nfreq %lu, srate %lu, pol %c, tone %i, specInv, diseqc %u, fe_modulation_t modulation,fe_code_rate_t HP_CodeRate, fe_transmit_mode_t TransmissionMode,fe_guard_interval_t guardInterval, fe_bandwidth_t bandwidth\n",
fd_frontend, fd_sec, (long unsigned int)freq, (long unsigned int)srate, pol, tone, diseqc);


memset(&feparams, 0, sizeof(feparams));
if ( (res = ioctl(fd_frontend,FE_GET_INFO, &fe_info) < 0))
{
mp_msg(MSGT_DEMUX, MSGL_FATAL, "FE_GET_INFO FAILED\n");
return -1;
}

mp_msg(MSGT_DEMUX, MSGL_V, "Using DVB card \"%s\"\n", fe_info.name);

switch(fe_info.type)
{
case FE_OFDM:
if (freq < 1000000) freq*=1000UL;
feparams.frequency=freq;
feparams.inversion=specInv;
feparams.u.ofdm.bandwidth=bandwidth;
feparams.u.ofdm.code_rate_HP=HP_CodeRate;
feparams.u.ofdm.code_rate_LP=LP_CodeRate;
feparams.u.ofdm.constellation=modulation;
feparams.u.ofdm.transmission_mode=TransmissionMode;
feparams.u.ofdm.guard_interval=guardInterval;
feparams.u.ofdm.hierarchy_information=hier;
mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-T to %d Hz, bandwidth: %d\n",freq, bandwidth);
break;
case FE_QPSK:
if (freq > 2200000)
{
// this must be an absolute frequency
if (freq < SLOF)
{
freq = feparams.frequency=(freq-LOF1);
hi_lo = 0;
}
else
{
freq = feparams.frequency=(freq-LOF2);
hi_lo = 1;
}
}
else
{
// this is an L-Band frequency
feparams.frequency=freq;
}

feparams.inversion=specInv;
feparams.u.qpsk.symbol_rate=srate;
feparams.u.qpsk.fec_inner=HP_CodeRate;
dfd = fd_frontend;

mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-S to Freq: %u, Pol: %c Srate: %d, 22kHz: %s, LNB: %d\n",freq,pol,srate,hi_lo ? "on" : "off", diseqc);

if(do_diseqc(dfd, diseqc, (pol == 'V' ? 1 : 0), hi_lo) == 0)
mp_msg(MSGT_DEMUX, MSGL_V, "DISEQC SETTING SUCCEDED\n");
else
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "DISEQC SETTING FAILED\n");
return -1;
}
break;
case FE_QAM:
mp_msg(MSGT_DEMUX, MSGL_V, "tuning DVB-C to %d, srate=%d\n",freq,srate);
feparams.frequency=freq;
feparams.inversion=specInv;
feparams.u.qam.symbol_rate = srate;
feparams.u.qam.fec_inner = HP_CodeRate;
feparams.u.qam.modulation = modulation;
break;
#ifdef DVB_ATSC
case FE_ATSC:
mp_msg(MSGT_DEMUX, MSGL_V, "tuning ATSC to %d, modulation=%d\n",freq,modulation);
feparams.frequency=freq;
feparams.u.vsb.modulation = modulation;
break;
#endif
default:
mp_msg(MSGT_DEMUX, MSGL_V, "Unknown FE type. Aborting\n");
return 0;
}
usleep(100000);

if(ioctl(fd_frontend,FE_SET_FRONTEND,&feparams) < 0)
{
mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR tuning channel\n");
return -1;
}

return check_status(fd_frontend, timeout);
}


int dvb_tune(dvb_priv_t *priv, int freq, char pol, int srate, int diseqc, int tone,
fe_spectral_inversion_t specInv, fe_modulation_t modulation, fe_guard_interval_t guardInterval,
fe_transmit_mode_t TransmissionMode, fe_bandwidth_t bandWidth, fe_code_rate_t HP_CodeRate,
fe_code_rate_t LP_CodeRate, fe_hierarchy_t hier, int timeout)
{
int ris;

mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune Freq: %lu\n", (long unsigned int) freq);

ris = tune_it(priv->fe_fd, priv->sec_fd, freq, srate, pol, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth, LP_CodeRate, hier, timeout);

if(ris != 0)
mp_msg(MSGT_DEMUX, MSGL_INFO, "dvb_tune, TUNING FAILED\n");

return ris == 0;
}

+ 881
- 0
m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/gui/dialog/fileselect.c View File

@@ -0,0 +1,881 @@
/*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

#include <glob.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>
#include <unistd.h>
#include <sys/stat.h>

#include "fileselect.h"
#include "dialog.h"
#include "preferences.h"
#include "tools.h"
#include "pixmaps/dir.xpm"
#include "pixmaps/file.xpm"
#include "pixmaps/up.xpm"
#include "gui/interface.h"
#include "gui/app/app.h"
#include "gui/app/cfg.h"
#include "gui/app/gui.h"
#include "gui/ui/actions.h"
#include "gui/util/list.h"
#include "gui/util/mem.h"
#include "gui/util/string.h"

#define CFG_OLD_FILESELECT
#include "gui/app/cfg-old.c"

#include "config.h"
#include "help_mp.h"
#include "mpcommon.h"
#include "libavutil/common.h"
#include "stream/stream.h"

#ifdef __linux__
char *get_current_dir_name(void);
#else
#include <limits.h>
#define get_current_dir_name() getcwd(NULL, PATH_MAX)
#endif

const char *fsSelectedFile;
const char *fsThisDir = ".";
const gchar *fsFilter = "*";

int fsType;

static gint fsCurrFNameListSelected, fsLastFNameListSelected;

char * const fsVideoAudioFilterNames[][2] = {
{ MSGTR_GUI_FilterVideoAvi, "*.avi" },
{ MSGTR_GUI_FilterVideoDivX, "*.divx" },
{ MSGTR_GUI_FilterVideoFlash, "*.flv" },
{ MSGTR_GUI_FilterFileMP3, "*.mp3" },
{ MSGTR_GUI_FilterFileMP4, "*.aac,*.f4a,*.f4b,*.f4v,*.m4a,*.m4b,*.m4v,*.mp4" },
{ MSGTR_GUI_FilterFileMPEG, "*.m1v,*.m2v,*.mp2,*.mpe,*.mpeg,*.mpg,*.mpga,*.vdr,*.vob" },
{ MSGTR_GUI_FilterFileMP2TS, "*.bdm,*.bdmv,*.clpi,*.cpi,*.m2t,*.m2ts,*.mpl,*.mpls,*.mts,*.rec,*.trp,*.ts,*.ty" },
{ MSGTR_GUI_FilterMediumMatroska, "*.mka,*.mkv" },
{ MSGTR_GUI_FilterMediumOgg, "*.oga,*.ogg,*.ogm,*.ogv,*.ogx,*.spx" },
{ MSGTR_GUI_FilterMediumQuickTime, "*.moov,*.mov,*.qt,*.qtvr" },
{ MSGTR_GUI_FilterMediumRealNetworks, "*.ra,*.rm,*.rmvb,*.rv" },
{ MSGTR_GUI_FilterImageCue, "*.cue" },
{ MSGTR_GUI_FilterFileWav, "*.wav" },
{ MSGTR_GUI_FilterMediumWindows, "*.asf,*.wma,*.wmv" },
{ MSGTR_GUI_FilterFilePlaylist, "*.asx,*.m3u,*.m3u8,*.m4u,*.mxu,*.nsc,*.pls,*.ram,*.smi,*.smil,*.sml,*.vlc,*.wax,*.wmx,*.wvx" },
{ MSGTR_GUI_FilterAudioAll, "*.aac,*.ac3,*.aif,*.aifc,*.aiff,*.amr,*.ape,*.au,*.awb,*.cdg,*.f4a,*.f4b,*.flac,*.m4a,*.m4b,*.mka,*.mp+,*.mp2,*.mp3,*.mpc,*.mpga,*.mpp,*.nsa,*.oga,*.ogg,*.pcm,*.qcp,*.ra,*.snd,*.spx,*.tak,*.voc,*.vqf,*.w64,*.wav,*.wma,*.wv,*.wvp" },
{ MSGTR_GUI_FilterVideoAll, "*.264,*.3g2,*.3ga,*.3gp,*.3gp2,*.3gpp,*.3gpp2,*.apng,*.asf,*.avi,*.bdm,*.bdmv,*.clpi,*.cpi,*.cpk,*.divx,*.dv,*.f4v,*.flc,*.fli,*.flv,*.m1v,*.m2t,*.m2ts,*.m2v,*.m4v,*.mjpg,*.mkv,*.moov,*.mov,*.mp2,*.mp4,*.mpe,*.mpeg,*.mpg,*.mpl,*.mpls,*.mts,*.mxf,*.nsv,*.nuv,*.ogg,*.ogm,*.ogv,*.ogx,*.pva,*.qt,*.qtvr,*.rec,*.rm,*.rmvb,*.roq,*.rv,*.spl,*.str,*.swf,*.trp,*.ts,*.ty,*.vdr,*.viv,*.vivo,*.vob,*.webm,*.wmv,*.y4m" },
{ MSGTR_GUI_FilterFileAll, "*" },
{ NULL, NULL }
};
int fsLastVideoAudioFilterSelected = -1;

char * const fsSubtitleFilterNames[][2] = {
{ "AQTitle (*.aqt)", "*.aqt" },
{ "Advanced SubStation Alpha (*.ass)", "*.ass" },
{ "JACOSub (*.jss) ", "*.jss" },
{ "RealText (*.rt) ", "*.rt" },
{ "SAMI (*.smi)", "*.smi" },
{ "SubRip (*.srt)", "*.srt" },
{ "SubStation Alpha (*.ssa)", "*.ssa" },
{ "MicroDVD (*.sub)", "*.sub" },
{ "Text (*.txt)", "*.txt" },
{ MSGTR_GUI_FilterSubtitleUTF8, "*.utf,*.utf-8,*.utf8" },
{ MSGTR_GUI_FilterSubtitleAll, "*.aqt,*.ass,*.jss,*.rt,*.smi,*.srt,*.ssa,*.sub,*.txt,*.utf" },
{ MSGTR_GUI_FilterFileAll, "*" },
{ NULL, NULL }
};
int fsLastSubtitleFilterSelected = -1;

char * const fsAudioFileNames[][2] = {
{ MSGTR_GUI_FilterAudioDolbyPCM, "*.ac3,*.pcm" },
{ MSGTR_GUI_FilterAudioMPEG, "*.aac,*.f4a,*.m4a,*.mp2,*.mp3,*.mpga" },
{ MSGTR_GUI_FilterAudioMatroska, "*.mka" },
{ MSGTR_GUI_FilterAudioOgg, "*.oga,*.ogg,*.spx" },
{ MSGTR_GUI_FilterAudioWav, "*.wav" },
{ MSGTR_GUI_FilterAudioWma, "*.wma" },
{ MSGTR_GUI_FilterAudioAll, "*.aac,*.ac3,*.f4a,*.m4a,*.mka,*.mp2,*.mp3,*.mpga,*.oga,*.ogg,*.pcm,*.spx,*.wav,*.wma" },
{ MSGTR_GUI_FilterFileAll, "*" },
{ NULL, NULL }
};
int fsLastAudioFilterSelected = -1;

char * const fsFontFileNames[][2] = {
#ifdef CONFIG_FREETYPE
{ MSGTR_GUI_FilterFontTTF, "*.ttf" },
{ MSGTR_GUI_FilterFontType1, "*.pfb" },
{ MSGTR_GUI_FilterFontAll, "*.pfb,*.ttf" },
#else
{ MSGTR_GUI_FilterFontBitmap, "*.desc" },
#endif
{ MSGTR_GUI_FilterFileAll, "*" },
{ NULL, NULL }
};
int fsLastFontFilterSelected = -1;

char * const fsImageFilterNames[][2] = {
#ifdef CONFIG_LIBCDIO
{ MSGTR_GUI_FilterImageCD, "*.cue" },
{ MSGTR_GUI_FilterImageVCD, "*.cue" },
#endif
#ifdef CONFIG_DVDREAD
{ MSGTR_GUI_FilterImageDVD, "*.ifo,*.iso" },
#endif
{ NULL, NULL }
};
int fsLastImageFilterSelected = -1;

GtkWidget *fsFileNamesList;
GtkWidget *fsFNameList;
GtkWidget *FileSelector;
GdkColormap *fsColorMap;
GtkWidget *fsOk;
GtkWidget *fsUp;
GtkWidget *fsCancel;
GtkWidget *fsCombo4;
GtkWidget *fsPathCombo;
GList *fsList_items;
GList *fsTopList_items;
GHashTable *fsPathTable;
GtkWidget *List;
GtkWidget *fsFilterCombo;

GtkStyle *style;
GdkPixmap *dpixmap;
GdkPixmap *fpixmap;
GdkBitmap *dmask;
GdkBitmap *fmask;

static void fs_PersistantHistory(char *subject)
{
unsigned int i;
char *entry;

if (!subject)
return;

for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
if (gstrcmp(fsHistory[i], subject) == 0) {
entry = fsHistory[i];
break;
}

if (i == FF_ARRAY_ELEMS(fsHistory)) {
entry = strdup(subject);
free(fsHistory[--i]);
}

for (; i; i--)
fsHistory[i] = fsHistory[i - 1];

fsHistory[0] = entry;
}

static gchar *get_current_dir_name_utf8(void)
{
char *dir;
gchar *utf8dir;

dir = get_current_dir_name();
utf8dir = g_filename_display_name(dir);
free(dir);

return utf8dir;
}

static GList *fs_AddPath(GList *list, gpointer data, GtkPositionType pos)
{
if (!g_list_find_custom(list, data, (GCompareFunc)strcmp)) {
if (pos == GTK_POS_TOP)
list = g_list_prepend(list, data);
else
list = g_list_append(list, data);
}

return list;
}

static void fs_AddPathUtf8(const char *name, GtkPositionType pos)
{
gchar *utf8name;

utf8name = g_filename_display_name(name);
fsTopList_items = fs_AddPath(fsTopList_items, utf8name, pos);
g_hash_table_insert(fsPathTable, strdup(utf8name), strdup(name));
}

static void clist_append_fname(GtkWidget *list, char *fname,
GdkPixmap *pixmap, GdkPixmap *mask)
{
gint pos;
gchar *str[2];

str[0] = NULL;
str[1] = g_filename_display_name(fname);
pos = gtk_clist_append(GTK_CLIST(list), str);
gtk_clist_set_row_data_full(GTK_CLIST(list), pos, strdup(fname), free);
gtk_clist_set_pixmap(GTK_CLIST(list), pos, 0, pixmap, mask);
g_free(str[1]);
}

static void CheckDir(GtkWidget *list)
{
struct stat fs;
unsigned int i, j, fn;
glob_t gg;
gchar *filter, **fext;

if (!fsFilter[0])
return;

gtk_widget_hide(list);
gtk_clist_clear(GTK_CLIST(list));

clist_append_fname(list, ".", dpixmap, dmask);
clist_append_fname(list, "..", dpixmap, dmask);

glob("*", 0, NULL, &gg);

for (i = 0; i < gg.gl_pathc; i++) {
if ((stat(gg.gl_pathv[i], &fs) != 0) || !S_ISDIR(fs.st_mode))
continue;

clist_append_fname(list, gg.gl_pathv[i], dpixmap, dmask);
}

for (fn = 1, i = 0; fsFilter[i]; i++)
if (fsFilter[i] == ',')
fn++;

filter = g_strdup(fsFilter);
fext = calloc(fn, sizeof(gchar *));

if (filter && fext) {
for (j = 0, i = 0; filter[i]; i++) {
if (filter[i] == '.')
fext[j] = filter + i;

if (filter[i] == ',') {
filter[i] = 0;
j++;
}
}

for (i = 0; i < gg.gl_pathc; i++) {
char *ext;

if ((stat(gg.gl_pathv[i], &fs) != 0) || S_ISDIR(fs.st_mode))
continue;

ext = strrchr(gg.gl_pathv[i], '.');

if (ext || !fext[0]) {
for (j = 0; j < fn; j++) {
if (fext[j] == NULL || strcasecmp(fext[j], ext) == 0) {
clist_append_fname(list, gg.gl_pathv[i], fpixmap, fmask);
break;
}
}
}
}
}

free(fext);
g_free(filter);
globfree(&gg);

gtk_clist_set_column_width(GTK_CLIST(list), 0, 17);
gtk_widget_show(list);
}

/* ----------------------------------------------- */

static void fs_fsFilterCombo_changed(GtkEditable *editable,
gpointer user_data)
{
const char *str;
int i;

(void)editable;

str = gtk_entry_get_text(GTK_ENTRY(user_data));

switch (fsType) {
case FILESELECT_VIDEO_AUDIO:

for (i = 0; fsVideoAudioFilterNames[i][0]; i++)
if (!strcmp(str, fsVideoAudioFilterNames[i][0])) {
fsFilter = fsVideoAudioFilterNames[i][1];
fsLastVideoAudioFilterSelected = i;
break;
}

break;

case FILESELECT_SUBTITLE:

for (i = 0; fsSubtitleFilterNames[i][0]; i++)
if (!strcmp(str, fsSubtitleFilterNames[i][0])) {
fsFilter = fsSubtitleFilterNames[i][1];
fsLastSubtitleFilterSelected = i;
break;
}

break;

case FILESELECT_AUDIO:

for (i = 0; fsAudioFileNames[i][0]; i++)
if (!strcmp(str, fsAudioFileNames[i][0])) {
fsFilter = fsAudioFileNames[i][1];
fsLastAudioFilterSelected = i;
break;
}

break;

case FILESELECT_FONT:

for (i = 0; fsFontFileNames[i][0]; i++)
if (!strcmp(str, fsFontFileNames[i][0])) {
fsFilter = fsFontFileNames[i][1];
fsLastFontFilterSelected = i;
break;
}

break;

case FILESELECT_IMAGE:

for (i = 0; fsImageFilterNames[i][0]; i++)
if (!strcmp(str, fsImageFilterNames[i][0])) {
fsFilter = fsImageFilterNames[i][1];
fsLastImageFilterSelected = i;
break;
}

break;

default:

return;
}

CheckDir(fsFNameList);
}

static void fs_fsPathCombo_changed(GtkEditable *editable,
gpointer user_data)
{
const unsigned char *str;
gchar *dirname;

(void)editable;

str = gtk_entry_get_text(GTK_ENTRY(user_data));
dirname = g_hash_table_lookup(fsPathTable, str);

if (chdir(dirname ? (const unsigned char *)dirname : str) != -1)
CheckDir(fsFNameList);
}

static gboolean fs_fsFNameList_event(GtkWidget *widget,
GdkEvent *event,
gpointer user_data)
{
GdkEventButton *bevent;
gint row, col;

(void)user_data;

bevent = (GdkEventButton *)event;

if (event->type == GDK_BUTTON_RELEASE && bevent->button == 2) {
if (gtk_clist_get_selection_info(GTK_CLIST(widget), bevent->x, bevent->y, &row, &col)) {
fsSelectedFile = gtk_clist_get_row_data(GTK_CLIST(widget), row);
gtk_button_released(GTK_BUTTON(fsOk));

return TRUE;
}
}

return FALSE;
}

static void fs_fsFNameList_select_row(GtkCList *clist, gint row, gint column,
GdkEvent *event, gpointer user_data)
{
(void)column;
(void)user_data;

fsCurrFNameListSelected = row;
fsSelectedFile = gtk_clist_get_row_data(clist, row);

if (event && event->type == GDK_BUTTON_PRESS)
gtk_button_released(GTK_BUTTON(fsOk));
}

static void fs_Up_released(GtkButton *button, gpointer user_data)
{
gchar *utf8dir;

(void)button;
(void)user_data;

chdir("..");
CheckDir(fsFNameList);
utf8dir = get_current_dir_name_utf8();
gtk_entry_set_text(GTK_ENTRY(fsPathCombo), utf8dir);
g_free(utf8dir);
fsSelectedFile = fsThisDir;

return;
}

static void fs_Cancel_released(GtkButton *button, gpointer user_data)
{
(void)button;
(void)user_data;

gtk_widget_destroy(FileSelector);
fsLastFNameListSelected = fsCurrFNameListSelected;
}

static void fs_Ok_released(GtkButton *button, gpointer user_data)
{
char *fsSelectedDirectory;
int type = STREAMTYPE_FILE, ev = evPlay;
gchar *selected;

(void)button;
(void)user_data;

if (chdir(fsSelectedFile) == 0) {
gchar *utf8dir;

CheckDir(fsFNameList);
utf8dir = get_current_dir_name_utf8();
gtk_entry_set_text(GTK_ENTRY(fsPathCombo), utf8dir);
g_free(utf8dir);
gtk_widget_grab_focus(fsFNameList);
fsSelectedFile = fsThisDir;

return;
}

fsSelectedDirectory = get_current_dir_name();

switch (fsType) {
case FILESELECT_VIDEO_AUDIO:

if (strcmp(fsVideoAudioFilterNames[fsLastVideoAudioFilterSelected][0], MSGTR_GUI_FilterFilePlaylist) == 0)
type = STREAMTYPE_PLAYLIST;

uiSetFile(fsSelectedDirectory, fsSelectedFile, type);
selected = g_strconcat(fsSelectedDirectory, "/", fsSelectedFile, NULL);

if (selected) {
listMgr(PLAYLIST_DELETE, 0);
add_to_gui_playlist(selected, PLAYLIST_ITEM_APPEND);
g_free(selected);
}

guiInfo.MediumChanged = GUI_MEDIUM_NEW;
sub_fps = 0;
fs_PersistantHistory(fsSelectedDirectory);
break;

case FILESELECT_SUBTITLE:
setddup(&guiInfo.SubtitleFilename, fsSelectedDirectory, fsSelectedFile);
mplayerLoadSubtitle(guiInfo.SubtitleFilename);
break;

case FILESELECT_AUDIO:
setddup(&guiInfo.AudioFilename, fsSelectedDirectory, fsSelectedFile);
break;

case FILESELECT_FONT:
setddup(&font_name, fsSelectedDirectory, fsSelectedFile);
mplayer(MPLAYER_LOAD_FONT, 0, 0);

if (Preferences)
gtk_entry_set_text(GTK_ENTRY(prEFontName), font_name);

break;

case FILESELECT_IMAGE:

if (strcmp(fsImageFilterNames[fsLastImageFilterSelected][0], MSGTR_GUI_FilterImageCD) == 0)
ev = evPlayCD;
else if (strcmp(fsImageFilterNames[fsLastImageFilterSelected][0], MSGTR_GUI_FilterImageVCD) == 0)
ev = evPlayVCD;
else if (strcmp(fsImageFilterNames[fsLastImageFilterSelected][0], MSGTR_GUI_FilterImageDVD) == 0)
ev = evPlayDVD;

if (ev == evPlayDVD && gstrcmp(strrchr(fsSelectedFile, '.'), ".ifo") == 0)
fsSelectedFile = "";

uiUnsetFile();
setddup(&guiInfo.ImageFilename, fsSelectedDirectory, fsSelectedFile);
fs_PersistantHistory(fsSelectedDirectory);
uiLoadPlay = True;
break;
}

free(fsSelectedDirectory);

fs_Cancel_released(NULL, NULL);

if (fsType == FILESELECT_FONT)
return;

if (uiLoadPlay) {
uiLoadPlay = False;
uiEvent(ev, 0);
} else
gui(GUI_SET_STATE, (void *)GUI_STOP);
}

/**
* @brief Handle the escape, return and backspace key depending on the
* @a widget it has been pressed on.
*
* @param widget object which received the signal
* @param event GdkEventKey which triggered the signal
* @param user_data user data set when the signal handler was connected
*
* @return TRUE to stop other handlers from being invoked for the event or
* FALSE to propagate the event further
*/
static gboolean fs_key_release_event(GtkWidget *widget, GdkEvent *event, gpointer user_data)
{
(void)user_data;

switch (event->key.keyval) {
case GDK_Escape:

if (GTK_IS_SCROLLED_WINDOW(widget))
gtk_button_released(GTK_BUTTON(fsCancel));

break;

case GDK_Return:

if (GTK_IS_SCROLLED_WINDOW(widget))
gtk_button_released(GTK_BUTTON(fsOk));
else if (GTK_IS_BUTTON(widget))
gtk_button_released(GTK_BUTTON(widget));
else if (GTK_IS_ENTRY(widget))
gtk_widget_grab_focus(fsFNameList);

break;

case GDK_BackSpace:

if (GTK_IS_SCROLLED_WINDOW(widget)) {
gtk_button_released(GTK_BUTTON(fsUp));
gtk_widget_grab_focus(fsFNameList);
}

break;
}

return FALSE;
}

static void fs_Destroy(void)
{
gtk_widget_destroyed(FileSelector, &FileSelector);

g_hash_table_destroy(fsPathTable);

g_list_foreach(fsTopList_items, (GFunc)g_free, NULL);
g_list_free(fsTopList_items);
fsTopList_items = NULL;
}

static GtkWidget *CreateFileSelect(void)
{
GtkWidget *vbox4;
GtkWidget *hbox4;
GtkWidget *vseparator1;
GtkWidget *hbox6;
GtkWidget *fsFNameListWindow;
GtkWidget *hbuttonbox3;

GtkWidget *uppixmapwid;
GdkPixmap *uppixmap;
GdkBitmap *upmask;
GtkStyle *upstyle;

FileSelector = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(FileSelector, 512, 300);
gtk_widget_set_events(FileSelector, GDK_EXPOSURE_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_FOCUS_CHANGE_MASK | GDK_STRUCTURE_MASK | GDK_PROPERTY_CHANGE_MASK | GDK_VISIBILITY_NOTIFY_MASK);
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectFile);
gtk_window_set_position(GTK_WINDOW(FileSelector), GTK_WIN_POS_CENTER);
gtk_window_set_wmclass(GTK_WINDOW(FileSelector), "FileSelector", MPlayer);
fsColorMap = gdk_colormap_get_system();

gtk_widget_realize(FileSelector);
gtkAddIcon(FileSelector);

style = gtk_widget_get_style(FileSelector);
dpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &dmask, &style->bg[GTK_STATE_NORMAL], (gchar **)dir_xpm);
fpixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &fmask, &style->bg[GTK_STATE_NORMAL], (gchar **)file_xpm);

vbox4 = gtkAddVBox(gtkAddDialogFrame(FileSelector), 0);
hbox4 = gtkAddHBox(vbox4, 1);

fsCombo4 = gtk_combo_new();
gtk_widget_show(fsCombo4);
gtk_box_pack_start(GTK_BOX(hbox4), fsCombo4, TRUE, TRUE, 0);
gtk_widget_set_usize(fsCombo4, -2, 20);

fsPathCombo = GTK_COMBO(fsCombo4)->entry;
gtk_widget_show(fsPathCombo);
gtk_widget_set_usize(fsPathCombo, -2, 20);

vseparator1 = gtk_vseparator_new();
gtk_widget_show(vseparator1);
gtk_box_pack_start(GTK_BOX(hbox4), vseparator1, FALSE, TRUE, 0);
gtk_widget_set_usize(vseparator1, 7, 20);

upstyle = gtk_widget_get_style(FileSelector);
uppixmap = gdk_pixmap_colormap_create_from_xpm_d(FileSelector->window, fsColorMap, &upmask, &upstyle->bg[GTK_STATE_NORMAL], (gchar **)up_xpm);
uppixmapwid = gtk_pixmap_new(uppixmap, upmask);
gtk_widget_show(uppixmapwid);

fsUp = gtk_button_new();
gtk_container_add(GTK_CONTAINER(fsUp), uppixmapwid);
gtk_widget_show(fsUp);
gtk_box_pack_start(GTK_BOX(hbox4), fsUp, FALSE, FALSE, 0);
gtk_widget_set_usize(fsUp, 65, 15);

gtkAddHSeparator(vbox4);

hbox6 = gtkAddHBox(NULL, 0);
gtk_box_pack_start(GTK_BOX(vbox4), hbox6, TRUE, TRUE, 0);

fsFNameListWindow = gtk_scrolled_window_new(NULL, NULL);
gtk_widget_show(fsFNameListWindow);
gtk_box_pack_start(GTK_BOX(hbox6), fsFNameListWindow, TRUE, TRUE, 0);
gtk_widget_set_usize(fsFNameListWindow, -2, 145);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(fsFNameListWindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);

fsFNameList = gtk_clist_new(2);
gtk_container_add(GTK_CONTAINER(fsFNameListWindow), fsFNameList);
gtk_clist_set_column_width(GTK_CLIST(fsFNameList), 0, 80);
gtk_clist_set_selection_mode(GTK_CLIST(fsFNameList), GTK_SELECTION_BROWSE);
gtk_clist_column_titles_hide(GTK_CLIST(fsFNameList));
gtk_clist_set_shadow_type(GTK_CLIST(fsFNameList), GTK_SHADOW_ETCHED_OUT);

gtkAddHSeparator(vbox4);

List = gtk_combo_new();
gtk_widget_ref(List);
gtk_object_set_data_full(GTK_OBJECT(FileSelector), "List", List, (GtkDestroyNotify)gtk_widget_unref);
gtk_widget_show(List);
gtk_box_pack_start(GTK_BOX(vbox4), List, FALSE, FALSE, 0);
gtk_widget_set_usize(List, -2, 20);

fsFilterCombo = GTK_COMBO(List)->entry;
gtk_widget_show(fsFilterCombo);
gtk_entry_set_editable(GTK_ENTRY(fsFilterCombo), FALSE);
gtk_widget_set_usize(fsFilterCombo, -2, 20);

gtkAddHSeparator(vbox4);

hbuttonbox3 = gtkAddHButtonBox(vbox4);
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbuttonbox3), GTK_BUTTONBOX_END);
gtk_button_box_set_spacing(GTK_BUTTON_BOX(hbuttonbox3), 10);

fsOk = gtkAddButton(MSGTR_GUI_Ok, hbuttonbox3);
fsCancel = gtkAddButton(MSGTR_GUI_Cancel, hbuttonbox3);

gtk_signal_connect(GTK_OBJECT(FileSelector), "destroy", GTK_SIGNAL_FUNC(fs_Destroy), NULL);
gtk_signal_connect(GTK_OBJECT(fsFNameListWindow), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);

gtk_signal_connect(GTK_OBJECT(fsFilterCombo), "changed", GTK_SIGNAL_FUNC(fs_fsFilterCombo_changed), fsFilterCombo);
gtk_signal_connect(GTK_OBJECT(fsFilterCombo), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);
gtk_signal_connect(GTK_OBJECT(fsPathCombo), "changed", GTK_SIGNAL_FUNC(fs_fsPathCombo_changed), fsPathCombo);
gtk_signal_connect(GTK_OBJECT(fsPathCombo), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);
gtk_signal_connect(GTK_OBJECT(fsUp), "released", GTK_SIGNAL_FUNC(fs_Up_released), fsFNameList);
gtk_signal_connect(GTK_OBJECT(fsUp), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);
gtk_signal_connect(GTK_OBJECT(fsOk), "released", GTK_SIGNAL_FUNC(fs_Ok_released), fsCombo4);
gtk_signal_connect(GTK_OBJECT(fsOk), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);
gtk_signal_connect(GTK_OBJECT(fsCancel), "released", GTK_SIGNAL_FUNC(fs_Cancel_released), NULL);
gtk_signal_connect(GTK_OBJECT(fsCancel), "key-release-event", GTK_SIGNAL_FUNC(fs_key_release_event), NULL);
gtk_signal_connect(GTK_OBJECT(fsFNameList), "select-row", (GtkSignalFunc)fs_fsFNameList_select_row, NULL);
gtk_signal_connect(GTK_OBJECT(fsFNameList), "event", (GtkSignalFunc)fs_fsFNameList_event, NULL);

return FileSelector;
}

void ShowFileSelector(int type)
{
int i, k, fsMedium;
char *tmp = NULL, *dir = NULL;
const gchar *fname;
struct stat f;

if (FileSelector)
gtkRaise(FileSelector);
else
FileSelector = CreateFileSelect();

fsType = type;

switch (type) {
case FILESELECT_VIDEO_AUDIO:
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectFile);
fsList_items = NULL;

for (i = 0; fsVideoAudioFilterNames[i][0]; i++)
fsList_items = g_list_append(fsList_items, fsVideoAudioFilterNames[i][0]);

k = fsLastVideoAudioFilterSelected;
gtk_combo_set_popdown_strings(GTK_COMBO(List), fsList_items);
g_list_free(fsList_items);
gtk_entry_set_text(GTK_ENTRY(fsFilterCombo), fsVideoAudioFilterNames[k >= 0 ? k : i - 2][0]);
//tmp=guiInfo.Filename;
break;

case FILESELECT_SUBTITLE:
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectSubtitle);
fsList_items = NULL;

for (i = 0; fsSubtitleFilterNames[i][0]; i++)
fsList_items = g_list_append(fsList_items, fsSubtitleFilterNames[i][0]);

k = fsLastSubtitleFilterSelected;
gtk_combo_set_popdown_strings(GTK_COMBO(List), fsList_items);
g_list_free(fsList_items);
gtk_entry_set_text(GTK_ENTRY(fsFilterCombo), fsSubtitleFilterNames[k >= 0 ? k : i - 2][0]);
tmp = guiInfo.SubtitleFilename;
break;

case FILESELECT_AUDIO:
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectAudioFile);
fsList_items = NULL;

for (i = 0; fsAudioFileNames[i][0]; i++)
fsList_items = g_list_append(fsList_items, fsAudioFileNames[i][0]);

k = fsLastAudioFilterSelected;
gtk_combo_set_popdown_strings(GTK_COMBO(List), fsList_items);
g_list_free(fsList_items);
gtk_entry_set_text(GTK_ENTRY(fsFilterCombo), fsAudioFileNames[k >= 0 ? k : i - 2][0]);
tmp = guiInfo.AudioFilename;
break;

case FILESELECT_FONT:
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectFont);
fsList_items = NULL;

for (i = 0; fsFontFileNames[i][0]; i++)
fsList_items = g_list_append(fsList_items, fsFontFileNames[i][0]);

k = fsLastFontFilterSelected;
gtk_combo_set_popdown_strings(GTK_COMBO(List), fsList_items);
g_list_free(fsList_items);
gtk_entry_set_text(GTK_ENTRY(fsFilterCombo), fsFontFileNames[k >= 0 ? k : i - 2][0]);
tmp = font_name;
break;

case FILESELECT_IMAGE:
gtk_window_set_title(GTK_WINDOW(FileSelector), MSGTR_GUI_SelectImage);
fsList_items = NULL;

for (i = 0; fsImageFilterNames[i][0]; i++)
fsList_items = g_list_append(fsList_items, fsImageFilterNames[i][0]);

k = fsLastImageFilterSelected;
gtk_combo_set_popdown_strings(GTK_COMBO(List), fsList_items);
g_list_free(fsList_items);
gtk_entry_set_text(GTK_ENTRY(fsFilterCombo), fsImageFilterNames[k >= 0 ? k : 0][0]);
tmp = guiInfo.ImageFilename;
break;
}

fsMedium = (fsType == FILESELECT_VIDEO_AUDIO || fsType == FILESELECT_SUBTITLE || fsType == FILESELECT_AUDIO || fsType == FILESELECT_IMAGE);

if (tmp && tmp[0] && !strstr(tmp, "://")) {
dir = strdup(tmp);

do {
char *c = strrchr(dir, '/');

if ((stat(dir, &f) == 0) && S_ISDIR(f.st_mode))
break;

if (c)
*c = 0;
} while (strrchr(dir, '/'));

if (!dir[0])
nfree(dir);
}

fsPathTable = g_hash_table_new_full(g_str_hash, g_str_equal, free, free);

{
unsigned int i, c = 1;

if (fsMedium) {
for (i = 0; i < FF_ARRAY_ELEMS(fsHistory); i++)
if (fsHistory[i]) {
fname = cfg_old_filename_from_utf8(fsHistory[i]);
fs_AddPathUtf8(fname, GTK_POS_BOTTOM);

if (c)
c = gstrcmp(dir, fname);
}
}

if (c && dir)
fs_AddPathUtf8(dir, GTK_POS_TOP);
}
free(dir);
fname = getenv("HOME");

if (fname)
fs_AddPathUtf8(fname, GTK_POS_BOTTOM);
else
fsTopList_items = fs_AddPath(fsTopList_items, g_strdup("/home"), GTK_POS_BOTTOM);

if (stat("/media", &f) == 0)
fsTopList_items = fs_AddPath(fsTopList_items, g_strdup("/media"), GTK_POS_BOTTOM);

if (stat("/mnt", &f) == 0)
fsTopList_items = fs_AddPath(fsTopList_items, g_strdup("/mnt"), GTK_POS_BOTTOM);

fsTopList_items = fs_AddPath(fsTopList_items, g_strdup("/"), GTK_POS_BOTTOM);
gtk_combo_set_popdown_strings(GTK_COMBO(fsCombo4), fsTopList_items);

gtk_widget_grab_focus(fsFNameList);

if (fsLastFNameListSelected + 1 > ((GtkCList *)fsFNameList)->rows)
fsLastFNameListSelected = 0;

((GtkCList *)fsFNameList)->focus_row = fsLastFNameListSelected;
gtk_clist_select_row(GTK_CLIST(fsFNameList), fsLastFNameListSelected, 1);
fsLastFNameListSelected = 0;

gtk_widget_show(FileSelector);
}

+ 474
- 0
m/mplayer-1.3.0/.pc/0201_PATH_MAX_HURD.patch/libao2/ao_esd.c View File

@@ -0,0 +1,474 @@
/*
* EsounD audio output driver for MPlayer
*
* copyright (c) 2002 Juergen Keil <jk@tools.de>
*
* This file is part of MPlayer.
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* MPlayer is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with MPlayer; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

/*
* TODO / known problems:
* - does not work well when the esd daemon has autostandby disabled
* (workaround: run esd with option "-as 2" - fortunatelly this is
* the default)
* - plays noise on a linux 2.4.4 kernel with a SB16PCI card, when using
* a local tcp connection to the esd daemon; there is no noise when using
* a unix domain socket connection.
* (there are EIO errors reported by the sound card driver, so this is
* most likely a linux sound card driver problem)
*/

#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>