Changeset ac3afe50d884bdc2ff8d8776381b5de088d69847
- Timestamp:
- 24/09/06 15:13:40
(2 years ago)
- Author:
- Clément Stenac <zorglub@videolan.org>
- git-committer:
- Clément Stenac <zorglub@videolan.org> 1159103620 +0000
- git-parent:
[bf7394d35e13c81a0435b992a4fe436e7b16d764]
- git-author:
- Clément Stenac <zorglub@videolan.org> 1159103620 +0000
- Message:
Don't notify playlist several times while preparsing
-
Files:
-
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
| r857b51f |
rac3afe5 |
|
| 388 | 388 | vlc_bool_t b_can_pace_control; |
|---|
| 389 | 389 | vlc_bool_t b_can_pause; |
|---|
| | 390 | vlc_bool_t b_preparsing; |
|---|
| 390 | 391 | |
|---|
| 391 | 392 | /* Global state */ |
|---|
| r857b51f |
rac3afe5 |
|
| 196 | 196 | vlc_mutex_unlock( &p_input->input.p_item->lock ); |
|---|
| 197 | 197 | |
|---|
| 198 | | NotifyPlaylist( p_input ); |
|---|
| | 198 | if( !p_input->b_preparsing ) |
|---|
| | 199 | NotifyPlaylist( p_input ); |
|---|
| 199 | 200 | } |
|---|
| 200 | 201 | return VLC_SUCCESS; |
|---|
| … | … | |
| 241 | 242 | return VLC_EGENERIC; |
|---|
| 242 | 243 | |
|---|
| 243 | | NotifyPlaylist( p_input ); |
|---|
| | 244 | if( !p_input->b_preparsing ) |
|---|
| | 245 | NotifyPlaylist( p_input ); |
|---|
| 244 | 246 | } |
|---|
| 245 | 247 | return VLC_SUCCESS; |
|---|
| … | … | |
| 271 | 273 | vlc_mutex_unlock( &p_input->input.p_item->lock ); |
|---|
| 272 | 274 | |
|---|
| 273 | | NotifyPlaylist( p_input ); |
|---|
| | 275 | if( !p_input->b_preparsing ) |
|---|
| | 276 | NotifyPlaylist( p_input ); |
|---|
| 274 | 277 | |
|---|
| 275 | 278 | return VLC_SUCCESS; |
|---|
| rb50966f |
rac3afe5 |
|
| 56 | 56 | static input_thread_t * Create ( vlc_object_t *, input_item_t *, char *, |
|---|
| 57 | 57 | vlc_bool_t ); |
|---|
| 58 | | static int Init ( input_thread_t *p_input, vlc_bool_t b_quick ); |
|---|
| | 58 | static int Init ( input_thread_t *p_input ); |
|---|
| 59 | 59 | static void Error ( input_thread_t *p_input ); |
|---|
| 60 | 60 | static void End ( input_thread_t *p_input ); |
|---|
| … | … | |
| 67 | 67 | static int UpdateFromAccess( input_thread_t * ); |
|---|
| 68 | 68 | static int UpdateFromDemux( input_thread_t * ); |
|---|
| 69 | | static int UpdateMeta( input_thread_t *, vlc_bool_t ); |
|---|
| 70 | | |
|---|
| 71 | | static void UpdateItemLength( input_thread_t *, int64_t i_length, vlc_bool_t ); |
|---|
| | 69 | static int UpdateMeta( input_thread_t * ); |
|---|
| | 70 | |
|---|
| | 71 | static void UpdateItemLength( input_thread_t *, int64_t i_length ); |
|---|
| 72 | 72 | |
|---|
| 73 | 73 | static void DecodeUrl( char * ); |
|---|
| … | … | |
| 76 | 76 | static input_source_t *InputSourceNew( input_thread_t *); |
|---|
| 77 | 77 | static int InputSourceInit( input_thread_t *, input_source_t *, |
|---|
| 78 | | char *, char *psz_forced_demux, |
|---|
| 79 | | vlc_bool_t b_quick ); |
|---|
| | 78 | char *, char *psz_forced_demux ); |
|---|
| 80 | 79 | static void InputSourceClean( input_thread_t *, input_source_t * ); |
|---|
| 81 | 80 | |
|---|
| … | … | |
| 125 | 124 | return NULL; |
|---|
| 126 | 125 | } |
|---|
| | 126 | p_input->b_preparsing = b_quick; |
|---|
| 127 | 127 | p_input->psz_header = psz_header ? strdup( psz_header ) : NULL; |
|---|
| 128 | 128 | |
|---|
| … | … | |
| 186 | 186 | p_input->input.i_cr_average = var_GetInteger( p_input, "cr-average" ); |
|---|
| 187 | 187 | |
|---|
| 188 | | if( !b_quick ) |
|---|
| | 188 | if( !p_input->b_preparsing ) |
|---|
| 189 | 189 | { |
|---|
| 190 | 190 | var_Get( p_input, "bookmarks", &val ); |
|---|
| … | … | |
| 338 | 338 | vlc_object_attach( p_input, p_parent ); |
|---|
| 339 | 339 | |
|---|
| 340 | | Init( p_input, VLC_TRUE ); |
|---|
| | 340 | Init( p_input ); |
|---|
| 341 | 341 | |
|---|
| 342 | 342 | /* Clean up master */ |
|---|
| … | … | |
| 463 | 463 | vlc_thread_ready( p_input ); |
|---|
| 464 | 464 | |
|---|
| 465 | | if( Init( p_input, VLC_FALSE ) ) |
|---|
| | 465 | if( Init( p_input ) ) |
|---|
| 466 | 466 | { |
|---|
| 467 | 467 | /* If we failed, wait before we are killed, and exit */ |
|---|
| … | … | |
| 517 | 517 | vlc_thread_ready( p_input ); |
|---|
| 518 | 518 | |
|---|
| 519 | | if( Init( p_input, VLC_FALSE ) ) |
|---|
| | 519 | if( Init( p_input ) ) |
|---|
| 520 | 520 | { |
|---|
| 521 | 521 | /* If we failed, just exit */ |
|---|
| … | … | |
| 699 | 699 | if( old_val.i_time != val.i_time ) |
|---|
| 700 | 700 | { |
|---|
| 701 | | UpdateItemLength( p_input, i_length, VLC_TRUE ); |
|---|
| | 701 | UpdateItemLength( p_input, i_length ); |
|---|
| 702 | 702 | } |
|---|
| 703 | 703 | } |
|---|
| … | … | |
| 710 | 710 | |
|---|
| 711 | 711 | |
|---|
| 712 | | static int Init( input_thread_t * p_input, vlc_bool_t b_quick ) |
|---|
| | 712 | static int Init( input_thread_t * p_input ) |
|---|
| 713 | 713 | { |
|---|
| 714 | 714 | char *psz; |
|---|
| … | … | |
| 728 | 728 | */ |
|---|
| 729 | 729 | memset( &p_input->counters, 0, sizeof( p_input->counters ) ); |
|---|
| 730 | | if( !b_quick ) |
|---|
| | 730 | if( !p_input->b_preparsing ) |
|---|
| 731 | 731 | { |
|---|
| 732 | 732 | /* Prepare statistics */ |
|---|
| … | … | |
| 791 | 791 | |
|---|
| 792 | 792 | if( InputSourceInit( p_input, &p_input->input, |
|---|
| 793 | | p_input->input.p_item->psz_uri, NULL, b_quick ) ) |
|---|
| | 793 | p_input->input.p_item->psz_uri, NULL ) ) |
|---|
| 794 | 794 | { |
|---|
| 795 | 795 | goto error; |
|---|
| … | … | |
| 797 | 797 | |
|---|
| 798 | 798 | /* Create global title (from master) */ |
|---|
| 799 | | if( !b_quick ) |
|---|
| | 799 | if( !p_input->b_preparsing ) |
|---|
| 800 | 800 | { |
|---|
| 801 | 801 | p_input->i_title = p_input->input.i_title; |
|---|
| … | … | |
| 835 | 835 | { |
|---|
| 836 | 836 | var_Change( p_input, "length", VLC_VAR_SETVALUE, &val, NULL ); |
|---|
| 837 | | UpdateItemLength( p_input, val.i_time, b_quick ); |
|---|
| | 837 | UpdateItemLength( p_input, val.i_time ); |
|---|
| 838 | 838 | p_input->input.p_item->i_duration = val.i_time; |
|---|
| 839 | 839 | } |
|---|
| 840 | 840 | |
|---|
| 841 | 841 | /* Start title/chapter */ |
|---|
| 842 | | if( !b_quick ) |
|---|
| | 842 | if( !p_input->b_preparsing ) |
|---|
| 843 | 843 | { |
|---|
| 844 | 844 | val.i_int = p_input->input.i_title_start - |
|---|
| … | … | |
| 941 | 941 | { |
|---|
| 942 | 942 | sub = InputSourceNew( p_input ); |
|---|
| 943 | | if( !InputSourceInit( p_input, sub, subs[i], "subtitle", |
|---|
| 944 | | VLC_FALSE ) ) |
|---|
| | 943 | if( !InputSourceInit( p_input, sub, subs[i], "subtitle" ) ) |
|---|
| 945 | 944 | { |
|---|
| 946 | 945 | TAB_APPEND( p_input->i_slave, p_input->slave, sub ); |
|---|
| … | … | |
| 977 | 976 | msg_Dbg( p_input, "adding slave input '%s'", psz ); |
|---|
| 978 | 977 | slave = InputSourceNew( p_input ); |
|---|
| 979 | | if( !InputSourceInit( p_input, slave, psz, NULL, VLC_FALSE ) ) |
|---|
| | 978 | if( !InputSourceInit( p_input, slave, psz, NULL ) ) |
|---|
| 980 | 979 | { |
|---|
| 981 | 980 | TAB_APPEND( p_input->i_slave, p_input->slave, slave ); |
|---|
| … | … | |
| 993 | 992 | |
|---|
| 994 | 993 | /* Set up es_out */ |
|---|
| 995 | | if( !b_quick ) |
|---|
| | 994 | if( !p_input->b_preparsing ) |
|---|
| 996 | 995 | { |
|---|
| 997 | 996 | es_out_Control( p_input->p_es_out, ES_OUT_SET_ACTIVE, VLC_TRUE ); |
|---|
| … | … | |
| 1067 | 1066 | |
|---|
| 1068 | 1067 | /* Access_file does not give any meta, and there are no slave */ |
|---|
| 1069 | | if( !b_quick ) |
|---|
| | 1068 | if( !p_input->b_preparsing ) |
|---|
| 1070 | 1069 | { |
|---|
| 1071 | 1070 | if( p_input->input.p_access ) |
|---|
| … | … | |
| 1086 | 1085 | } |
|---|
| 1087 | 1086 | |
|---|
| 1088 | | UpdateMeta( p_input, b_quick ); |
|---|
| 1089 | | |
|---|
| 1090 | | if( !b_quick ) |
|---|
| | 1087 | UpdateMeta( p_input ); |
|---|
| | 1088 | |
|---|
| | 1089 | if( !p_input->b_preparsing ) |
|---|
| 1091 | 1090 | { |
|---|
| 1092 | 1091 | msg_Dbg( p_input, "`%s' successfully opened", |
|---|
| … | … | |
| 1673 | 1672 | input_source_t *slave = InputSourceNew( p_input ); |
|---|
| 1674 | 1673 | |
|---|
| 1675 | | if( !InputSourceInit( p_input, slave, val.psz_string, NULL, |
|---|
| 1676 | | VLC_FALSE ) ) |
|---|
| | 1674 | if( !InputSourceInit( p_input, slave, val.psz_string, NULL ) ) |
|---|
| 1677 | 1675 | { |
|---|
| 1678 | 1676 | vlc_meta_t *p_meta = p_input->input.p_item->p_meta; |
|---|
| … | … | |
| 1705 | 1703 | p_meta ); |
|---|
| 1706 | 1704 | demux2_Control( slave->p_demux, DEMUX_GET_META, p_meta ); |
|---|
| 1707 | | UpdateMeta( p_input, VLC_FALSE ); |
|---|
| | 1705 | UpdateMeta( p_input ); |
|---|
| 1708 | 1706 | |
|---|
| 1709 | 1707 | TAB_APPEND( p_input->i_slave, p_input->slave, slave ); |
|---|
| … | … | |
| 1811 | 1809 | vlc_meta_t *p_meta = p_input->input.p_item->p_meta; |
|---|
| 1812 | 1810 | access2_Control( p_input->input.p_access,ACCESS_GET_META, p_meta ); |
|---|
| 1813 | | UpdateMeta( p_input, VLC_FALSE ); |
|---|
| | 1811 | UpdateMeta( p_input ); |
|---|
| 1814 | 1812 | var_SetBool( p_input, "item-change", p_input->input.p_item->i_id ); |
|---|
| 1815 | 1813 | p_access->info.i_update &= ~INPUT_UPDATE_META; |
|---|
| … | … | |
| 1848 | 1846 | * UpdateMeta: |
|---|
| 1849 | 1847 | *****************************************************************************/ |
|---|
| 1850 | | static int UpdateMeta( input_thread_t *p_input, vlc_bool_t b_quick ) |
|---|
| | 1848 | static int UpdateMeta( input_thread_t *p_input ) |
|---|
| 1851 | 1849 | { |
|---|
| 1852 | 1850 | vlc_meta_t *p_meta = p_input->input.p_item->p_meta; |
|---|
| … | … | |
| 1865 | 1863 | * UpdateItemLength: |
|---|
| 1866 | 1864 | *****************************************************************************/ |
|---|
| 1867 | | static void UpdateItemLength( input_thread_t *p_input, int64_t i_length, |
|---|
| 1868 | | vlc_bool_t b_quick ) |
|---|
| 1869 | | { |
|---|
| 1870 | | char psz_buffer[MSTRTIME_MAX_SIZE]; |
|---|
| 1871 | | |
|---|
| | 1865 | static void UpdateItemLength( input_thread_t *p_input, int64_t i_length ) |
|---|
| | 1866 | { |
|---|
| 1872 | 1867 | vlc_mutex_lock( &p_input->input.p_item->lock ); |
|---|
| 1873 | 1868 | p_input->input.p_item->i_duration = i_length; |
|---|
| 1874 | 1869 | vlc_mutex_unlock( &p_input->input.p_item->lock ); |
|---|
| 1875 | 1870 | |
|---|
| 1876 | | pl_Yield( p_input ); |
|---|
| 1877 | | var_SetInteger( pl_Get( p_input ), "item-change", |
|---|
| 1878 | | p_input->input.p_item->i_id ); |
|---|
| 1879 | | pl_Release( p_input ) |
|---|
| 1880 | | |
|---|
| 1881 | | input_Control( p_input, INPUT_ADD_INFO, _("General"), _("Duration"), |
|---|
| 1882 | | msecstotimestr( psz_buffer, i_length / 1000 ) ); |
|---|
| | 1871 | if( !p_input->b_preparsing ) |
|---|
| | 1872 | { |
|---|
| | 1873 | pl_Yield( p_input ); |
|---|
| | 1874 | var_SetInteger( pl_Get( p_input ), "item-change", |
|---|
| | 1875 | p_input->input.p_item->i_id ); |
|---|
| | 1876 | pl_Release( p_input ) |
|---|
| | 1877 | } |
|---|
| 1883 | 1878 | } |
|---|
| 1884 | 1879 | |
|---|
| … | … | |
| 1915 | 1910 | static int InputSourceInit( input_thread_t *p_input, |
|---|
| 1916 | 1911 | input_source_t *in, char *psz_mrl, |
|---|
| 1917 | | char *psz_forced_demux, vlc_bool_t b_quick ) |
|---|
| | 1912 | char *psz_forced_demux ) |
|---|
| 1918 | 1913 | { |
|---|
| 1919 | 1914 | char *psz_dup = strdup( psz_mrl ); |
|---|
| … | … | |
| 1928 | 1923 | |
|---|
| 1929 | 1924 | /* Split uri */ |
|---|
| 1930 | | if( !b_quick ) |
|---|
| | 1925 | if( !p_input->b_preparsing ) |
|---|
| 1931 | 1926 | { |
|---|
| 1932 | 1927 | MRLSplit( VLC_OBJECT(p_input), psz_dup, |
|---|
| … | … | |
| 2019 | 2014 | /* Now try a real access */ |
|---|
| 2020 | 2015 | in->p_access = access2_New( p_input, psz_access, psz_demux, psz_path, |
|---|
| 2021 | | b_quick ); |
|---|
| | 2016 | p_input->b_preparsing ); |
|---|
| 2022 | 2017 | |
|---|
| 2023 | 2018 | /* Access failed, URL encoded ? */ |
|---|
| … | … | |
| 2031 | 2026 | in->p_access = access2_New( p_input, |
|---|
| 2032 | 2027 | psz_access, psz_demux, psz_path, |
|---|
| 2033 | | b_quick ); |
|---|
| | 2028 | p_input->b_preparsing ); |
|---|
| 2034 | 2029 | } |
|---|
| 2035 | 2030 | #ifndef WIN32 /* Remove this gross hack from the win32 build as colons |
|---|
| … | … | |
| 2052 | 2047 | in->p_access = access2_New( p_input, |
|---|
| 2053 | 2048 | psz_access, psz_demux, psz_path, |
|---|
| 2054 | | b_quick ); |
|---|
| | 2049 | p_input->b_preparsing ); |
|---|
| 2055 | 2050 | } |
|---|
| 2056 | 2051 | #endif |
|---|
| … | … | |
| 2089 | 2084 | |
|---|
| 2090 | 2085 | /* Get infos from access */ |
|---|
| 2091 | | if( !b_quick ) |
|---|
| | 2086 | if( !p_input->b_preparsing ) |
|---|
| 2092 | 2087 | { |
|---|
| 2093 | 2088 | access2_Control( in->p_access, |
|---|
| … | … | |
| 2116 | 2111 | |
|---|
| 2117 | 2112 | /* Create the stream_t */ |
|---|
| 2118 | | in->p_stream = stream_AccessNew( in->p_access, b_quick ); |
|---|
| | 2113 | in->p_stream = stream_AccessNew( in->p_access, p_input->b_preparsing ); |
|---|
| 2119 | 2114 | if( in->p_stream == NULL ) |
|---|
| 2120 | 2115 | { |
|---|
| … | … | |
| 2129 | 2124 | } |
|---|
| 2130 | 2125 | in->p_demux = demux2_New( p_input, psz_access, psz_demux, psz_path, |
|---|
| 2131 | | in->p_stream, p_input->p_es_out, b_quick ); |
|---|
| | 2126 | in->p_stream, p_input->p_es_out, |
|---|
| | 2127 | p_input->b_preparsing ); |
|---|
| 2132 | 2128 | if( in->p_demux == NULL ) |
|---|
| 2133 | 2129 | { |
|---|
| … | … | |
| 2142 | 2138 | |
|---|
| 2143 | 2139 | /* TODO get title from demux */ |
|---|
| 2144 | | if( !b_quick && in->i_title <= 0 ) |
|---|
| | 2140 | if( !p_input->b_preparsing && in->i_title <= 0 ) |
|---|
| 2145 | 2141 | { |
|---|
| 2146 | 2142 | if( demux2_Control( in->p_demux, DEMUX_GET_TITLE_INFO, |
|---|
| … | … | |
| 2513 | 2509 | |
|---|
| 2514 | 2510 | sub = InputSourceNew( p_input ); |
|---|
| 2515 | | if( !InputSourceInit( p_input, sub, psz_subtitle, "subtitle", VLC_FALSE ) ) |
|---|
| | 2511 | if( !InputSourceInit( p_input, sub, psz_subtitle, "subtitle" ) ) |
|---|
| 2516 | 2512 | { |
|---|
| 2517 | 2513 | TAB_APPEND( p_input->i_slave, p_input->slave, sub ); |
|---|