Skip to content

Instantly share code, notes, and snippets.

@syndicut
Created September 21, 2012 22:46
Show Gist options
  • Save syndicut/3764351 to your computer and use it in GitHub Desktop.
Save syndicut/3764351 to your computer and use it in GitHub Desktop.
Description: Adds a firstseg option to livehttp streaming module
It is needed to allow segment start from different number then 1,
it can be usefull if vlc is restarted and clients expect segments numbers
to be more then the last they've received
.
vlc (2.0.3-0ubuntu0.12.04.1yandex1) precise; urgency=low
.
* Added firstseg option for livehttp streaming module
Author: Rashit Azizbaev <syndicut@yandex-team.ru>
--- vlc-2.0.3.orig/modules/access_output/livehttp.c
+++ vlc-2.0.3/modules/access_output/livehttp.c
@@ -70,6 +70,9 @@ static void Close( vlc_object_t * );
#define NUMSEGS_TEXT N_("Number of segments")
#define NUMSEGS_LONGTEXT N_("Number of segments to include in index")
+#define FIRSTSEG_TEXT N_("First segment number")
+#define FIRSTSEG_LONGTEXT N_("First segment number to start from")
+
#define INDEX_TEXT N_("Index file")
#define INDEX_LONGTEXT N_("Path to the index file to create")
@@ -91,6 +94,7 @@ vlc_module_begin ()
set_subcategory( SUBCAT_SOUT_ACO )
add_integer( SOUT_CFG_PREFIX "seglen", 10, SEGLEN_TEXT, SEGLEN_LONGTEXT, true )
add_integer( SOUT_CFG_PREFIX "numsegs", 0, NUMSEGS_TEXT, NUMSEGS_LONGTEXT, true )
+ add_integer( SOUT_CFG_PREFIX "firstseg", 1, FIRSTSEG_TEXT, FIRSTSEG_LONGTEXT, true )
add_bool( SOUT_CFG_PREFIX "splitanywhere", false,
SPLITANYWHERE_TEXT, SPLITANYWHERE_LONGTEXT, true )
add_bool( SOUT_CFG_PREFIX "delsegs", true,
@@ -112,6 +116,7 @@ static const char *const ppsz_sout_optio
"seglen",
"splitanywhere",
"numsegs",
+ "firstseg",
"delsegs",
"index",
"index-url",
@@ -134,6 +139,7 @@ struct sout_access_out_sys_t
size_t i_seglen;
int i_handle;
unsigned i_numsegs;
+ unsigned i_firstseg;
bool b_delsegs;
bool b_ratecontrol;
bool b_splitanywhere;
@@ -163,6 +169,7 @@ static int Open( vlc_object_t *p_this )
p_sys->i_seglenm = CLOCK_FREQ * p_sys->i_seglen;
p_sys->i_numsegs = var_GetInteger( p_access, SOUT_CFG_PREFIX "numsegs" );
+ p_sys->i_firstseg = var_GetInteger( p_access, SOUT_CFG_PREFIX "firstseg" );
p_sys->b_splitanywhere = var_GetBool( p_access, SOUT_CFG_PREFIX "splitanywhere" );
p_sys->b_delsegs = var_GetBool( p_access, SOUT_CFG_PREFIX "delsegs" );
p_sys->b_ratecontrol = var_GetBool( p_access, SOUT_CFG_PREFIX "ratecontrol") ;
@@ -239,7 +246,7 @@ static int updateIndexAndDel( sout_acces
uint32_t i_firstseg;
if ( p_sys->i_numsegs == 0 || p_sys->i_segment < p_sys->i_numsegs )
- i_firstseg = 1;
+ i_firstseg = p_sys->i_firstseg;
else
i_firstseg = ( p_sys->i_segment - p_sys->i_numsegs ) + 1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment