Advertisement
Guest User

Patch for mplayer 2012-05-05 for st2205u

a guest
May 5th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 5.56 KB | None | 0 0
  1. diff -Nuar mplayer-export-2012-05-05//configure mplayer-clean-st2205u//configure
  2. --- mplayer-export-2012-05-05//configure    2012-04-29 23:54:20.000000000 +0800
  3. +++ mplayer-clean-st2205u//configure    2012-05-05 22:10:51.225913032 +0800
  4. @@ -873,6 +873,7 @@
  5.  def_priority="#undef CONFIG_PRIORITY"
  6.  def_pthread_cache="#undef PTHREAD_CACHE"
  7.  shmem=no
  8. +_st2205u=auto
  9.  for ac_option do
  10.    case "$ac_option" in
  11.    --help|-help|-h)
  12. @@ -4341,6 +4342,28 @@
  13.  fi
  14.  echores "$_xv"
  15.  
  16. +echocheck "st2205u"
  17. +if test "$_st2205u" = auto ; then
  18. +  cat > $TMPC <<EOF
  19. +#include <st2205.h>
  20. +int main(void) {
  21. +  (void) st2205_open("");
  22. +  return 0; }
  23. +EOF
  24. +  _st2205u=no
  25. +  cc_check -lst2205 && _st2205u=yes
  26. +fi
  27. +
  28. +if test "$_st2205u" = yes ; then
  29. +  def_xv='#define CONFIG_ST2205U 1'
  30. +  libs_mplayer="$libs_mplayer -lst2205"
  31. +  vomodules="st2205u $vomodules"
  32. +else
  33. +  def_xv='#undef CONFIG_ST2205U'
  34. +  novomodules="st2205u $_novomodules"
  35. +fi
  36. +echores "$_st2205u"
  37. +
  38.  
  39.  echocheck "XvMC"
  40.  if test "$_xvmc" != no  && test "$_xv" = yes ; then
  41. @@ -8123,6 +8146,7 @@
  42.  S3FB = $_s3fb
  43.  SDL = $_sdl
  44.  SPEEX = $_speex
  45. +ST2205U = $_st2205u
  46.  STREAM_CACHE = $_stream_cache
  47.  SGIAUDIO = $_sgiaudio
  48.  SUNAUDIO = $_sunaudio
  49. diff -Nuar mplayer-export-2012-05-05//libvo/vo_st2205u.c mplayer-clean-st2205u//libvo/vo_st2205u.c
  50. --- mplayer-export-2012-05-05//libvo/vo_st2205u.c   1970-01-01 07:30:00.000000000 +0730
  51. +++ mplayer-clean-st2205u//libvo/vo_st2205u.c   2012-05-05 22:11:14.545322227 +0800
  52. @@ -0,0 +1,158 @@
  53. +/*
  54. + * Video driver for ST2205U
  55. + * Copyright 2008 Sprite_tm <picframe@spritesmods.com>
  56. + * For more info, please visit http://spritesmods.com/?art=picframe
  57. + */
  58. +
  59. +#include <stdio.h>
  60. +#include <stdlib.h>
  61. +#include <string.h>
  62. +#include <unistd.h>
  63. +#include <errno.h>
  64. +
  65. +#include <sys/mman.h>
  66. +#include <sys/ioctl.h>
  67. +#include <linux/fb.h>
  68. +
  69. +#include "config.h"
  70. +#include "video_out.h"
  71. +#include "video_out_internal.h"
  72. +#include "fastmemcpy.h"
  73. +#include "sub/sub.h"
  74. +#include "mp_msg.h"
  75. +
  76. +#include <st2205.h>
  77. +
  78. +
  79. +static vo_info_t info = {
  80. +   "st2205u device",
  81. +   "st2205u",
  82. +   "Jeroen Domburg <picframe@spritesmods.com>",
  83. +   ""
  84. +};
  85. +
  86. +LIBVO_EXTERN(st2205u)
  87. +
  88. +static char *st_dev_name = NULL; // such as /dev/sda
  89. +static st2205_handle *st_h; // handle for st_dev_name
  90. +static char *st_imagebuff;
  91. +
  92. +static int st_preinit(int reset)
  93. +{
  94. +   static int st_preinit_done = 0;
  95. +   static int st_err = -1;
  96. +
  97. +   if (reset) {
  98. +       st_preinit_done = 0;
  99. +       return 0;
  100. +   }
  101. +  
  102. +   if (st_preinit_done)
  103. +       return st_err;
  104. +      
  105. +   st_preinit_done = 1;
  106. +   printf("st2205: preinit\n");
  107. +   if (!st_dev_name)
  108. +       st_dev_name = strdup("/dev/sda");
  109. +
  110. +   mp_msg(MSGT_VO, MSGL_V, "[st2205u] Using device %s\n", st_dev_name);
  111. +
  112. +   st_h=st2205_open(st_dev_name);
  113. +   if (st_h==NULL) {
  114. +       mp_msg(MSGT_VO, MSGL_ERR, "[st2205u] Can't open %s: %s\n", st_dev_name, strerror(errno));
  115. +       goto err_out;
  116. +   }
  117. +   st_imagebuff=malloc(st_h->height*st_h->width*3);
  118. +   st_err = 0;
  119. +   printf("[st2205u] %s opened successfully.\n", st_dev_name);
  120. +   return 0;
  121. +err_out:
  122. +   st_err = -1;
  123. +   return -1;
  124. +}
  125. +
  126. +static int preinit(const char *subdevice)
  127. +{
  128. +   if (subdevice)
  129. +   {
  130. +       if (st_dev_name) free(st_dev_name);
  131. +       st_dev_name = strdup(subdevice);
  132. +   }
  133. +   return st_preinit(0);
  134. +}
  135. +
  136. +static void draw_osd(void) {
  137. +    return;    
  138. +}
  139. +
  140. +static int config(uint32_t width, uint32_t height, uint32_t d_width,
  141. +       uint32_t d_height, uint32_t flags, char *title,
  142. +       uint32_t format)
  143. +{
  144. +   return 0;
  145. +}
  146. +
  147. +static int query_format(uint32_t format)
  148. +{
  149. +   if (st_preinit(0)) return 0;
  150. +   if ((format & IMGFMT_RGB_MASK) == IMGFMT_RGB) {
  151. +       if ((format & 0xff)==24) return VFCAP_CSP_SUPPORTED|VFCAP_CSP_SUPPORTED_BY_HW|VFCAP_ACCEPT_STRIDE;
  152. +   }
  153. +   return 0;
  154. +}
  155. +
  156. +
  157. +// all csp support stride
  158. +static int draw_frame(uint8_t *src[]) { return 1; }
  159. +
  160. +static int draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y)
  161. +{
  162. +   char *imagebuff;
  163. +   uint8_t *in = src[0];
  164. +   uint8_t *dest = st_imagebuff + (st_h->width * y + x) * 3;
  165. +   int next = st_h->width * 3;
  166. +   int i,j;
  167. +
  168. +   //make sure we won't cross the boundaries of dest
  169. +   if (x>127) return 0;
  170. +   if (y>127) return 0;
  171. +   if (w+x>st_h->width) w=st_h->width-x;
  172. +   if (h+x>st_h->height) h=st_h->height-x;
  173. +
  174. +   for (i = 0; i < h; i++) {
  175. +       //manually do a memcpy because the bytes
  176. +       //should be flipped first :X
  177. +       for (j=0; j<w; j++) {
  178. +           dest[j*3]=in[j*3];
  179. +           dest[j*3+1]=in[j*3+1];
  180. +           dest[j*3+2]=in[j*3+2];
  181. +       }
  182. +       dest += next;
  183. +       in += stride[0];
  184. +   }
  185. +   return 0;
  186. +}
  187. +
  188. +static void check_events(void)
  189. +{
  190. +}
  191. +
  192. +static void flip_page(void)
  193. +{
  194. +    //write dest to device
  195. +    st2205_send_data(st_h,st_imagebuff);
  196. +}
  197. +
  198. +static void uninit(void)
  199. +{
  200. +   st_preinit(1); // so that later calls to preinit don't fail
  201. +}
  202. +
  203. +static int control(uint32_t request, void *data)
  204. +{
  205. +  switch (request) {
  206. +  case VOCTRL_QUERY_FORMAT:
  207. +    return query_format(*((uint32_t*)data));
  208. +  }
  209. +  return VO_NOTIMPL;
  210. +}
  211. diff -Nuar mplayer-export-2012-05-05//Makefile mplayer-clean-st2205u//Makefile
  212. --- mplayer-export-2012-05-05//Makefile 2012-04-01 05:03:45.000000000 +0800
  213. +++ mplayer-clean-st2205u//Makefile 2012-05-05 22:10:54.977818110 +0800
  214. @@ -592,6 +592,7 @@
  215.  SRCS_MPLAYER-$(S3FB)          += libvo/vo_s3fb.c
  216.  SRCS_MPLAYER-$(SDL)           += libao2/ao_sdl.c libvo/vo_sdl.c libvo/sdl_common.c
  217.  SRCS_MPLAYER-$(SGIAUDIO)      += libao2/ao_sgi.c
  218. +SRCS_MPLAYER-$(ST2205U)       += libvo/vo_st2205u.c
  219.  SRCS_MPLAYER-$(SUNAUDIO)      += libao2/ao_sun.c
  220.  SRCS_MPLAYER-$(SVGA)          += libvo/vo_svga.c
  221.  SRCS_MPLAYER-$(TDFXFB)        += libvo/vo_tdfxfb.c
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement