[vlc-devel] [PATCH] Support for Http Dynamic Streaming

Jean-Baptiste Kempf jb at videolan.org
Wed Jun 4 15:18:03 CEST 2014


On 29 May, Jonathan Thambidurai wrote :
> + * HDS: Http Dynamic Streaming - based on public specs from Adobe (f4m, f4v, etc.)

Poor wording.

> + * hds: HTTP Dynamic Streaming, per Adobe's specs

Idem

> + * Heavily inspired by HDS module of Frédéric Yhuel <fyhuel _AT_ viotech _DOT_ net>

by SS module, you mean.

> +#ifdef HAVE_CONFIG_H
> +# include "config.h"
> +#endif
> +
> +#include <inttypes.h>

Useless

> +vlc_module_begin()
> +    set_category( CAT_INPUT )
> +    set_subcategory( SUBCAT_INPUT_STREAM_FILTER )
> +    set_description( N_("HTTP Dynamic Streaming") )
> +    set_shortname( "Dynamic Streaming")

shortname should be HDS or HTTP Dynamic Streaming

> +static int   Read( stream_t *, void *, unsigned );
> +static int   Peek( stream_t *, const uint8_t **, unsigned );
> +static int   Control( stream_t *, int , va_list );
> +
> +static bool isFQUrl( char* url )
  inline?

> +{
> +    return ( NULL != vlc_strcasestr( url, "https://") ||
> +             NULL != vlc_strcasestr( url, "http://" ) );
> +}
> +


After that, the code warns way too much:

  CC       stream_filter/hds/libhds_plugin_la-hds.lo
../../modules/stream_filter/hds/hds.c: In function ‘isHDS’:
../../modules/stream_filter/hds/hds.c:81:13: attention : assignment discards ‘const’ qualifier from pointer target type
         str = peek;
             ^
../../modules/stream_filter/hds/hds.c: In function ‘parse_asrt’:
../../modules/stream_filter/hds/hds.c:116:9: attention : format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long int’ [-Wformat=]
         msg_Err( p_this, "Not enough asrt data (%u, %u)", asrt_len, data_end - data );
         ^
../../modules/stream_filter/hds/hds.c: In function ‘parse_afrt’:
../../modules/stream_filter/hds/hds.c:220:9: attention : format ‘%u’ expects argument of type ‘unsigned int’, but argument 6 has type ‘long int’ [-Wformat=]
         msg_Err( p_this, "Not enough afrt data %u, %u", afrt_len, data_end - data );
         ^
../../modules/stream_filter/hds/hds.c: In function ‘parse_BootstrapData’:
../../modules/stream_filter/hds/hds.c:399:22: attention : passing argument 3 of ‘memchr’ makes integer from pointer without a cast
             data_p = memchr( data_p, '\0', data_end );
                      ^
In file included from ../../include/vlc_common.h:46:0,
                 from ../../modules/stream_filter/hds/hds.c:27:
/usr/include/string.h:96:14: note: expected ‘size_t’ but argument is of type ‘char *’
 extern void *memchr (const void *__s, int __c, size_t __n)
              ^
../../modules/stream_filter/hds/hds.c:403:17: attention : ‘return’ with a value, in function returning void
                 return NULL;
                 ^
../../modules/stream_filter/hds/hds.c:451:9: attention : ‘return’ with a value, in function returning void
         return NULL;
         ^
../../modules/stream_filter/hds/hds.c:465:9: attention : ‘return’ with a value, in function returning void
         return NULL;
         ^
../../modules/stream_filter/hds/hds.c: In function ‘find_chunk_mdat’:
../../modules/stream_filter/hds/hds.c:543:17: attention : pointer targets in assignment differ in signedness [-Wpointer-sign]
         boxname = chunkdata;
                 ^
../../modules/stream_filter/hds/hds.c:559:21: attention : pointer targets in assignment differ in signedness [-Wpointer-sign]
             boxdata = chunkdata;
                     ^
../../modules/stream_filter/hds/hds.c:564:21: attention : pointer targets in assignment differ in signedness [-Wpointer-sign]
             boxdata = chunkdata;
                     ^
../../modules/stream_filter/hds/hds.c:569:14: attention : pointer targets in assignment differ in signedness [-Wpointer-sign]
     *mdatptr = boxdata;
              ^
../../modules/stream_filter/hds/hds.c: In function ‘download_chunk’:
../../modules/stream_filter/hds/hds.c:638:9: attention : format ‘%li’ expects a matching ‘long int’ argument [-Wformat=]
         msg_Err(s, "Strangely-large chunk of %"PRIi64" Bytes" );
         ^
../../modules/stream_filter/hds/hds.c:594:10: attention : unused variable ‘free_movie_id’ [-Wunused-variable]
     bool free_movie_id = false;
          ^
../../modules/stream_filter/hds/hds.c: In function ‘generate_new_chunk’:
../../modules/stream_filter/hds/hds.c:756:25: attention : unused variable ‘latest_frun’ [-Wunused-variable]
         fragment_run_t* latest_frun = hds_stream->fragment_runs + ( hds_stream->fragment_run_count - 1 );
                         ^
../../modules/stream_filter/hds/hds.c:768:5: attention : statement with no effect [-Wunused-value]
     for( frun_entry; frun_entry < hds_stream->fragment_run_count;
     ^
../../modules/stream_filter/hds/hds.c:768:33: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
     for( frun_entry; frun_entry < hds_stream->fragment_run_count;
                                 ^
../../modules/stream_filter/hds/hds.c:774:28: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
             if( frun_entry == hds_stream->fragment_run_count - 1 )
                            ^
../../modules/stream_filter/hds/hds.c:790:28: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
             if( frun_entry == hds_stream->fragment_run_count - 1 ||
                            ^
../../modules/stream_filter/hds/hds.c:791:36: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
                 ( chunk->timestamp >= hds_stream->fragment_runs[frun_entry].fragment_timestamp &&
                                    ^
../../modules/stream_filter/hds/hds.c:792:36: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
                   chunk->timestamp < hds_stream->fragment_runs[frun_entry+1].fragment_timestamp )
                                    ^
../../modules/stream_filter/hds/hds.c:803:73: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
         if( hds_stream->fragment_runs[frun_entry].fragment_number_start <=
                                                                         ^
../../modules/stream_filter/hds/hds.c:805:25: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
             (frun_entry == hds_stream->fragment_run_count - 1 ||
                         ^
../../modules/stream_filter/hds/hds.c:806:76: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
              hds_stream->fragment_runs[frun_entry+1].fragment_number_start > chunk->frag_num ) )
                                                                            ^
../../modules/stream_filter/hds/hds.c:815:20: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
     if( frun_entry == hds_stream->fragment_run_count )
                    ^
../../modules/stream_filter/hds/hds.c:831:66: attention : comparaison entre des expressions entières signée et non signée [-Wsign-compare]
             hds_stream->segment_runs[srun_entry+1].first_segment > segment )
                                                                  ^
../../modules/stream_filter/hds/hds.c: In function ‘maintain_live_chunks’:
../../modules/stream_filter/hds/hds.c:895:18: attention : unused variable ‘next_chunk’ [-Wunused-variable]
         chunk_t* next_chunk = chunk->next;
                  ^
../../modules/stream_filter/hds/hds.c:904:1: attention : « return » manquant dans une fonction devant retourner une valeur [-Wreturn-type]
 }
 ^
../../modules/stream_filter/hds/hds.c: In function ‘live_thread’:
../../modules/stream_filter/hds/hds.c:958:17: attention : pointer targets in passing argument 3 of ‘parse_BootstrapData’ differ in signedness [-Wpointer-sign]
                 parse_BootstrapData( p_this, hds_stream,
                 ^
../../modules/stream_filter/hds/hds.c:331:13: note: expected ‘char *’ but argument is of type ‘uint8_t *’
 static void parse_BootstrapData( vlc_object_t* p_this,
             ^
../../modules/stream_filter/hds/hds.c:958:17: attention : pointer targets in passing argument 4 of ‘parse_BootstrapData’ differ in signedness [-Wpointer-sign]
                 parse_BootstrapData( p_this, hds_stream,
                 ^
../../modules/stream_filter/hds/hds.c:331:13: note: expected ‘char *’ but argument is of type ‘uint8_t *’
 static void parse_BootstrapData( vlc_object_t* p_this,
             ^
In file included from ../../include/vlc_common.h:417:0,
                 from ../../modules/stream_filter/hds/hds.c:27:
../../include/vlc_threads.h:311:55: attention : signed and unsigned type in conditional expression [-Wsign-compare]
     (__builtin_constant_p(d) ? impossible_deadline(d) : d)
                                                       ^
../../include/vlc_threads.h:318:24: note: in expansion of macro ‘check_deadline’
 #define mwait(d) mwait(check_deadline(d))
                        ^
../../modules/stream_filter/hds/hds.c:969:9: note: in expansion of macro ‘mwait’
         mwait( last_dl_start_time + ( ((uint64_t)hds_stream->fragment_runs[hds_stream->fragment_run_count-1].fragment_duration) * 1000000ULL) / ((uint64_t)hds_stream->afrt_timescale) );
         ^
../../modules/stream_filter/hds/hds.c: In function ‘parse_Manifest’:
../../modules/stream_filter/hds/hds.c:1032:20: attention : passing argument 2 of ‘xml_ReaderNextNode’ from incompatible pointer type
     while( (type = xml_ReaderNextNode( vlc_reader, &node )) > 0 )
                    ^
In file included from ../../modules/stream_filter/hds/hds.c:30:0:
../../include/vlc_xml.h:85:19: note: expected ‘const char **’ but argument is of type ‘char **’
 static inline int xml_ReaderNextNode( xml_reader_t *reader, const char **pval )
                   ^
../../modules/stream_filter/hds/hds.c:1071:13: attention : parenthèses suggérées autour de l'affectation utilisée comme valeur de vérité [-Wparentheses]
             while( attr_name = xml_ReaderNextAttr( vlc_reader, &attr_value ) )
             ^
../../modules/stream_filter/hds/hds.c:1092:13: attention : parenthèses suggérées autour de l'affectation utilisée comme valeur de vérité [-Wparentheses]
             while( attr_name = xml_ReaderNextAttr( vlc_reader, &attr_value ) )
             ^
../../modules/stream_filter/hds/hds.c:1127:41: attention : cast from function call of type ‘double’ to non-matching type ‘int’ [-Wbad-function-cast]
                 sys->duration_seconds = (int)atof( node );
                                         ^
../../modules/stream_filter/hds/hds.c:1181:47: attention : passing argument 1 of ‘generate_new_chunk’ from incompatible pointer type
                     new_stream->chunks_head = generate_new_chunk( s, 0, new_stream );
                                               ^
../../modules/stream_filter/hds/hds.c:733:17: note: expected ‘struct vlc_object_t *’ but argument is of type ‘struct stream_t *’
 static chunk_t* generate_new_chunk(
                 ^
../../modules/stream_filter/hds/hds.c:1186:39: attention : passing argument 1 of ‘generate_new_chunk’ from incompatible pointer type
                         chunk->next = generate_new_chunk( s, chunk, new_stream );
                                       ^
../../modules/stream_filter/hds/hds.c:733:17: note: expected ‘struct vlc_object_t *’ but argument is of type ‘struct stream_t *’
 static chunk_t* generate_new_chunk(
                 ^
../../modules/stream_filter/hds/hds.c: In function ‘Read’:
../../modules/stream_filter/hds/hds.c:1489:26: attention : passing argument 1 of ‘read_chunk_data’ from incompatible pointer type
         int tmp_length = read_chunk_data( s, buffer_uint8, i_read, stream, &eof );
                          ^
../../modules/stream_filter/hds/hds.c:1383:17: note: expected ‘struct vlc_object_t *’ but argument is of type ‘struct stream_t *’
 static unsigned read_chunk_data(
                 ^
../../modules/stream_filter/hds/hds.c: In function ‘Control’:
../../modules/stream_filter/hds/hds.c:1532:19: attention : unused variable ‘p_sys’ [-Wunused-variable]
     stream_sys_t *p_sys = s->p_sys;
                   ^
../../modules/stream_filter/hds/hds.c: In function ‘live_thread’:
../../modules/stream_filter/hds/hds.c:928:9: attention : ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
         asprintf( &abst_url, "%s/%s",
         ^
../../modules/stream_filter/hds/hds.c: In function ‘download_chunk’:
../../modules/stream_filter/hds/hds.c:608:5: attention : ignoring return value of ‘asprintf’, declared with attribute warn_unused_result [-Wunused-result]
     asprintf( &fragment_url, "%s/%s%sSeg%u-Frag%u",
     ^
  CCLD     libhds_plugin.la



Moreover, why do you need a hds.h ?

With my kindest regards,

-- 
Jean-Baptiste Kempf
http://www.jbkempf.com/ - +33 672 704 734
Sent from my Electronic Device



More information about the vlc-devel mailing list