[vlc-devel] [PATCH 1/2] Virtual segment rewrite to handle ordered chapters and

Jean-Baptiste Kempf jb at videolan.org
Thu Sep 8 01:21:13 CEST 2011


On Thu, Sep 08, 2011 at 01:07:59AM +0200, Denis Charmet wrote :
> -                int16 i_curr_title = p_chapter->GetTitleNumber( );
> +                int16 i_curr_title = (p_chapter->p_chapter)?p_chapter->p_chapter->GetTitleNumber( ):0;

Ugly style.


> +    if(p_segment_uid)
> +        delete p_segment_uid;
> +    if(p_segment_edition_uid)
> +        delete p_segment_edition_uid;

Not matching style for "if"

> +    /*TODO*/
> +    bool                        b_hidden;
A small comment here?

>          if( simpleblock )
> -            sys.i_pts = (sys.i_chapter_time + simpleblock->GlobalTimecode()) / (mtime_t) 1000;
> +            sys.i_pts = sys.i_chapter_time + simpleblock->GlobalTimecode() / (mtime_t) 1000;
>          else
> -            sys.i_pts = (sys.i_chapter_time + block->GlobalTimecode()) / (mtime_t) 1000;
> +            sys.i_pts = sys.i_chapter_time + block->GlobalTimecode() / (mtime_t) 1000;

Why?

>          p_tk->p_es = es_out_Add( sys.demuxer.out, &p_tk->fmt );
> -
>          /* Turn on a subtitles track if it has been flagged as default -
Why this removal?

>                              bool          file_ok = false;
> +#ifdef WIN32
> +                            std::string   s_url = "file:///" + s_filename;
> +#else
> +                            std::string   s_url = "file://" + s_filename;
> +#endif

My fault, but you should use mkae_URI, or something

> +        for(int i = 0 ; i < p_edition->sub_chapters.size() ; i++)
Code style.

> +            virtual_chapter_c * p_vchap = virtual_chapter_c::CreateVirtualChapter( p_edition->sub_chapters[i], p_main_segment, opened_segments, &usertime_offset, b_ordered);
Split line?

> +        for(int limit = 0; limit < 5 && p_cur->p_prev_segment_uid ; limit++)


> +            msg_Dbg( &demux, "NEW CHAPTER %lld", sys.i_pts);
Bad debug message.

> +                    if ( p_current_chapter == NULL || (p_current_chapter->p_chapter->i_end_time != p_cur_chapter->p_chapter->i_start_time) || (p_current_chapter && p_current_chapter->p_segment != p_cur_chapter->p_segment))
Split!

> +    virtual_chapter_c * BrowseCodecPrivate( unsigned int codec_id, bool (*match)(const chapter_codec_cmds_c &data, const void *p_cookie, size_t i_cookie_size ), const void *p_cookie, size_t i_cookie_size );

Hmmmm... long...

Are you sure some of your loops counters should not be size_t and not
int ?

Best 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