1 /*****************************************************************************
2 * profiles.c: Test streaming profiles
3 *****************************************************************************
4 * Copyright (C) 2006 The VideoLAN project
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
20 *****************************************************************************/
22 #include "../pyunit.h"
28 #include <vlc_streaming.h>
30 #define STDCHAIN1 "#std{access=udp,url=12.42.12.42,mux=ts}"
32 static void BuildStdChain1( sout_chain_t
*p_chain
)
34 streaming_ChainAddStd( p_chain
, "udp", "ts", "12.42.12.42" );
37 #define TRACHAIN1 "#transcode{vcodec=mpgv,vb=1024,scale=1.0,acodec=mp3,ab=128,channels=2}:std{mux=mp4,access=file,url=/dev/null}"
38 static void BuildTranscodeChain1( sout_chain_t
*p_chain
)
40 streaming_ChainAddTranscode( p_chain
, "mpgv", "mp3", NULL
, 1024, 1.0,
42 streaming_ChainAddStd( p_chain
, "file", "mp4", "/dev/null" );
45 static void BuildInvalid1( sout_chain_t
*p_chain
)
47 streaming_ChainAddStd( p_chain
, "file", "mp4", "/dev/null" );
48 streaming_ChainAddStd( p_chain
, "file", "mp4", "/dev/null" );
51 PyObject
*chains_test( PyObject
*self
, PyObject
*args
)
53 sout_chain_t
*p_chain
= streaming_ChainNew();
54 sout_duplicate_t
*p_dup
;
55 ASSERT( p_chain
->i_modules
== 0, "unclean chain" );
56 ASSERT( p_chain
->i_options
== 0, "unclean chain" );
57 ASSERT( p_chain
->pp_modules
== NULL
, "unclean chain" );
58 ASSERT( p_chain
->ppsz_options
== NULL
, "unclean chain" );
61 p_dup
= streaming_ChainAddDup( p_chain
);
62 ASSERT( p_chain
->i_modules
== 1, "not 1 module" );
63 ASSERT( p_dup
->i_children
== 0, "dup has children" );
64 streaming_DupAddChild( p_dup
);
65 ASSERT( p_dup
->i_children
== 1, "not 1 child" );
66 ASSERT( p_dup
->pp_children
[0]->i_modules
== 0, "unclean child chain");
67 streaming_DupAddChild( p_dup
);
68 ASSERT( p_dup
->i_children
== 2, "not 2 children" );
74 PyObject
*gui_chains_test( PyObject
*self
, PyObject
*args
)
80 PyObject
*psz_chains_test( PyObject
*self
, PyObject
*args
)
82 sout_chain_t
*p_chain
= streaming_ChainNew();
83 sout_module_t
*p_module
;
87 BuildStdChain1( p_chain
);
88 psz_output
= streaming_ChainToPsz( p_chain
);
89 printf( "STD1: %s\n", psz_output
);
90 ASSERT( !strcmp( psz_output
, STDCHAIN1
), "wrong output for STD1" )
91 ASSERT( p_chain
->i_modules
== 1, "wrong number of modules" );
92 p_module
= p_chain
->pp_modules
[0];
93 ASSERT( p_module
->i_type
== SOUT_MOD_STD
, "wrong type of module" );