root/modules/access_output/dummy.c
| Revision 14984575cafad7a9c913e2105a0b065a87da4832, 3.8 kB (checked in by Rémi Denis-Courmont <rdenis@simphalempin.com>, 2 months ago) | |
|---|---|
| |
| Line | |
|---|---|
| 1 | /***************************************************************************** |
| 2 | * dummy.c |
| 3 | ***************************************************************************** |
| 4 | * Copyright (C) 2001, 2002 the VideoLAN team |
| 5 | * $Id$ |
| 6 | * |
| 7 | * Authors: Laurent Aimar <fenrir@via.ecp.fr> |
| 8 | * Eric Petit <titer@videolan.org> |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License as published by |
| 12 | * the Free Software Foundation; either version 2 of the License, or |
| 13 | * (at your option) any later version. |
| 14 | * |
| 15 | * This program is distributed in the hope that it will be useful, |
| 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | * GNU General Public License for more details. |
| 19 | * |
| 20 | * You should have received a copy of the GNU General Public License |
| 21 | * along with this program; if not, write to the Free Software |
| 22 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. |
| 23 | *****************************************************************************/ |
| 24 | |
| 25 | /***************************************************************************** |
| 26 | * Preamble |
| 27 | *****************************************************************************/ |
| 28 | |
| 29 | #ifdef HAVE_CONFIG_H |
| 30 | # include "config.h" |
| 31 | #endif |
| 32 | |
| 33 | #include <vlc_common.h> |
| 34 | #include <vlc_plugin.h> |
| 35 | #include <vlc_sout.h> |
| 36 | #include <vlc_block.h> |
| 37 | |
| 38 | /***************************************************************************** |
| 39 | * Module descriptor |
| 40 | *****************************************************************************/ |
| 41 | static int Open ( vlc_object_t * ); |
| 42 | static void Close( vlc_object_t * ); |
| 43 | |
| 44 | vlc_module_begin(); |
| 45 | set_description( N_("Dummy stream output") ); |
| 46 | set_shortname( N_( "Dummy" )); |
| 47 | set_capability( "sout access", 0 ); |
| 48 | set_category( CAT_SOUT ); |
| 49 | set_subcategory( SUBCAT_SOUT_ACO ); |
| 50 | add_shortcut( "dummy" ); |
| 51 | set_callbacks( Open, Close ); |
| 52 | vlc_module_end(); |
| 53 | |
| 54 | |
| 55 | /***************************************************************************** |
| 56 | * Exported prototypes |
| 57 | *****************************************************************************/ |
| 58 | static ssize_t Write( sout_access_out_t *, block_t * ); |
| 59 | static int Seek ( sout_access_out_t *, off_t ); |
| 60 | |
| 61 | /***************************************************************************** |
| 62 | * Open: open the file |
| 63 | *****************************************************************************/ |
| 64 | static int Open( vlc_object_t *p_this ) |
| 65 | { |
| 66 | sout_access_out_t *p_access = (sout_access_out_t*)p_this; |
| 67 | |
| 68 | p_access->p_sys = NULL; |
| 69 | p_access->pf_write = Write; |
| 70 | p_access->pf_seek = Seek; |
| 71 | |
| 72 | msg_Dbg( p_access, "dummy stream output access opened" ); |
| 73 | return VLC_SUCCESS; |
| 74 | } |
| 75 | |
| 76 | /***************************************************************************** |
| 77 | * Close: close the target |
| 78 | *****************************************************************************/ |
| 79 | static void Close( vlc_object_t * p_this ) |
| 80 | { |
| 81 | sout_access_out_t *p_access = (sout_access_out_t*)p_this; |
| 82 | msg_Dbg( p_access, "dummy stream output access closed" ); |
| 83 | } |
| 84 | |
| 85 | /***************************************************************************** |
| 86 | * Read: standard read on a file descriptor. |
| 87 | *****************************************************************************/ |
| 88 | static ssize_t Write( sout_access_out_t *p_access, block_t *p_buffer ) |
| 89 | { |
| 90 | size_t i_write = 0; |
| 91 | block_t *b = p_buffer; |
| 92 | |
| 93 | while( b ) |
| 94 | { |
| 95 | i_write += b->i_buffer; |
| 96 | |
| 97 | b = b->p_next; |
| 98 | } |
| 99 | |
| 100 | block_ChainRelease( p_buffer ); |
| 101 | |
| 102 | (void)p_access; |
| 103 | return i_write; |
| 104 | } |
| 105 | |
| 106 | /***************************************************************************** |
| 107 | * Seek: seek to a specific location in a file |
| 108 | *****************************************************************************/ |
| 109 | static int Seek( sout_access_out_t *p_access, off_t i_pos ) |
| 110 | { |
| 111 | (void)p_access; (void)i_pos; |
| 112 | return 0; |
| 113 | } |
| 114 | |
| 115 |
Note: See TracBrowser for help on using the browser.
