home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / ccd0605.iso / LINUX / gopchop-1.1.7.tar.tar / gopchop-1.1.7.tar / gopchop-1.1.7 / libvo / video_out_null.c < prev    next >
C/C++ Source or Header  |  2005-04-29  |  4KB  |  155 lines

  1. /*
  2.  * video_out_null.c
  3.  * Copyright (C) 2000-2003 Michel Lespinasse <walken@zoy.org>
  4.  * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
  5.  *
  6.  * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
  7.  * See http://libmpeg2.sourceforge.net/ for updates.
  8.  *
  9.  * mpeg2dec is free software; you can redistribute it and/or modify
  10.  * it under the terms of the GNU General Public License as published by
  11.  * the Free Software Foundation; either version 2 of the License, or
  12.  * (at your option) any later version.
  13.  *
  14.  * mpeg2dec is distributed in the hope that it will be useful,
  15.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  17.  * GNU General Public License for more details.
  18.  *
  19.  * You should have received a copy of the GNU General Public License
  20.  * along with this program; if not, write to the Free Software
  21.  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  22.  */
  23.  
  24. #include "config.h"
  25.  
  26. #include <stdlib.h>
  27. #include <inttypes.h>
  28.  
  29. #include <mpeg2dec/mpeg2.h>
  30. #include "video_out.h"
  31. #include <mpeg2dec/mpeg2convert.h>
  32.  
  33. static void null_draw_frame (vo_instance_t * instance,
  34.                  uint8_t * const * buf, void * id)
  35. {
  36. }
  37.  
  38. static vo_instance_t * internal_open (int setup (vo_instance_t *, unsigned int,
  39.                          unsigned int, unsigned int,
  40.                          unsigned int, unsigned int,
  41.                          unsigned int,
  42.                          vo_setup_result_t *),
  43.                       void draw (vo_instance_t *,
  44.                          uint8_t * const *, void *))
  45. {
  46.     vo_instance_t * instance;
  47.  
  48.     instance = (vo_instance_t *) calloc (1, sizeof (vo_instance_t));
  49.     if (instance == NULL)
  50.     return NULL;
  51.  
  52.     instance->setup = setup;
  53.     instance->draw = draw;
  54.     instance->close = (void (*) (vo_instance_t *)) free;
  55.  
  56.     return instance;
  57. }
  58.  
  59. static int null_setup (vo_instance_t * instance,
  60.                unsigned int width, unsigned int height,
  61.                unsigned int display_width, unsigned int display_height,
  62.                unsigned int chroma_width,
  63.                unsigned int chroma_height, vo_setup_result_t * result)
  64. {
  65.     result->convert = NULL;
  66.     return 0;
  67. }
  68.  
  69. vo_instance_t * vo_null_open (void)
  70. {
  71.     return internal_open (null_setup, null_draw_frame);
  72. }
  73.  
  74. vo_instance_t * vo_nullskip_open (void)
  75. {
  76.     return internal_open (null_setup, NULL);
  77. }
  78.  
  79. static void nullslice_start (void * id, const mpeg2_fbuf_t * fbuf,
  80.                  const mpeg2_picture_t * picture,
  81.                  const mpeg2_gop_t * gop)
  82. {
  83. }
  84.  
  85. static void nullslice_copy (void * id, uint8_t * const * src,
  86.                 unsigned int v_offset)
  87. {
  88. }
  89.  
  90. static int nullslice_convert (int stage, void * id,
  91.                   const mpeg2_sequence_t * seq,
  92.                   int stride, uint32_t accel, void * arg,
  93.                   mpeg2_convert_init_t * result)
  94. {
  95.     result->id_size = 0;
  96.     result->buf_size[0] = result->buf_size[1] = result->buf_size[2] = 0;
  97.     result->start = nullslice_start;
  98.     result->copy = nullslice_copy;
  99.     return 0;
  100. }
  101.  
  102. static int nullslice_setup (vo_instance_t * instance,
  103.                     unsigned int width,
  104.                 unsigned int height,
  105.                     unsigned int display_width,
  106.                 unsigned int display_height,
  107.                 unsigned int chroma_width,
  108.                 unsigned int chroma_height,
  109.                 vo_setup_result_t * result)
  110. {
  111.     result->convert = nullslice_convert;
  112.     return 0;
  113. }
  114.  
  115. vo_instance_t * vo_nullslice_open (void)
  116. {
  117.     return internal_open (nullslice_setup, null_draw_frame);
  118. }
  119.  
  120. static int nullrgb16_setup (vo_instance_t * instance,
  121.                     unsigned int width,
  122.                 unsigned int height,
  123.                     unsigned int display_width,
  124.                 unsigned int display_height,
  125.                 unsigned int chroma_width,
  126.                 unsigned int chroma_height,
  127.                 vo_setup_result_t * result)
  128. {
  129.     result->convert = mpeg2convert_rgb16;
  130.     return 0;
  131. }
  132.  
  133. static int nullrgb32_setup (vo_instance_t * instance,
  134.                     unsigned int width,
  135.                 unsigned int height,
  136.                     unsigned int display_width,
  137.                 unsigned int display_height,
  138.                 unsigned int chroma_width,
  139.                 unsigned int chroma_height,
  140.                 vo_setup_result_t * result)
  141. {
  142.     result->convert = mpeg2convert_rgb32;
  143.     return 0;
  144. }
  145.  
  146. vo_instance_t * vo_nullrgb16_open (void)
  147. {
  148.     return internal_open (nullrgb16_setup, null_draw_frame);
  149. }
  150.  
  151. vo_instance_t * vo_nullrgb32_open (void)
  152. {
  153.     return internal_open (nullrgb32_setup, null_draw_frame);
  154. }
  155.