dummy.c 3.77 KB
Newer Older
1 2 3
/*****************************************************************************
 * dummy.c
 *****************************************************************************
4
 * Copyright (C) 2001, 2002 the VideoLAN team
5
 * $Id$
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
 *
 * Authors: Laurent Aimar <fenrir@via.ecp.fr>
 *          Eric Petit <titer@videolan.org>
 *
 * 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
Antoine Cellerier's avatar
Antoine Cellerier committed
22
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
23 24 25 26 27 28
 *****************************************************************************/

/*****************************************************************************
 * Preamble
 *****************************************************************************/

29 30 31 32
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif

33
#include <vlc/vlc.h>
34
#include <vlc_plugin.h>
Clément Stenac's avatar
Clément Stenac committed
35 36
#include <vlc_sout.h>
#include <vlc_block.h>
37 38 39 40

/*****************************************************************************
 * Module descriptor
 *****************************************************************************/
41 42 43
static int  Open ( vlc_object_t * );
static void Close( vlc_object_t * );

44
vlc_module_begin();
45 46
    set_description( N_("Dummy stream output") );
    set_shortname( N_( "Dummy" ));
47
    set_capability( "sout access", 0 );
Clément Stenac's avatar
Clément Stenac committed
48 49
    set_category( CAT_SOUT );
    set_subcategory( SUBCAT_SOUT_ACO );
50 51 52 53 54
    add_shortcut( "dummy" );
    set_callbacks( Open, Close );
vlc_module_end();


55 56 57 58 59 60
/*****************************************************************************
 * Exported prototypes
 *****************************************************************************/
static int     Write( sout_access_out_t *, block_t * );
static int     Seek ( sout_access_out_t *, off_t  );

61 62 63 64 65
/*****************************************************************************
 * Open: open the file
 *****************************************************************************/
static int Open( vlc_object_t *p_this )
{
66
    sout_access_out_t   *p_access = (sout_access_out_t*)p_this;
67

68 69 70
    p_access->p_sys    = NULL;
    p_access->pf_write = Write;
    p_access->pf_seek  = Seek;
71

72
    msg_Dbg( p_access, "dummy stream output access opened" );
73 74 75 76 77 78 79 80
    return VLC_SUCCESS;
}

/*****************************************************************************
 * Close: close the target
 *****************************************************************************/
static void Close( vlc_object_t * p_this )
{
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 87
}

/*****************************************************************************
 * Read: standard read on a file descriptor.
 *****************************************************************************/
88
static int Write( sout_access_out_t *p_access, block_t *p_buffer )
89
{
90 91
    int64_t i_write = 0;
    block_t *b = p_buffer;
92

93
    while( b )
94
    {
95 96 97 98
        i_write += b->i_buffer;

        b = b->p_next;
    }
99

100
    block_ChainRelease( p_buffer );
101

102
    return i_write;
103 104 105 106 107
}

/*****************************************************************************
 * Seek: seek to a specific location in a file
 *****************************************************************************/
108
static int Seek( sout_access_out_t *p_access, off_t i_pos )
109
{
110
    return 0;
111 112 113
}