/***************************************************************************** * Close *****************************************************************************/ void avformat_CloseDemux( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys = p_demux->p_sys; free( p_sys->tracks ); if( p_sys->ic ) { if( p_sys->ic->pb ) { av_free( p_sys->ic->pb->buffer ); av_free( p_sys->ic->pb ); } avformat_close_input( &p_sys->ic ); } for( int i = 0; i < p_sys->i_attachments; i++ ) vlc_input_attachment_Delete( p_sys->attachments[i] ); TAB_CLEAN( p_sys->i_attachments, p_sys->attachments); if( p_sys->p_title ) vlc_input_title_Delete( p_sys->p_title ); free( p_sys ); }
/***************************************************************************** * Close: *****************************************************************************/ static void Close( vlc_object_t *p_this ) { demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys = p_demux->p_sys; int i; for( i = 0; i < PS_TK_COUNT; i++ ) { ps_track_t *tk = &p_sys->tk[i]; if( tk->b_seen ) { es_format_Clean( &tk->fmt ); if( tk->es ) es_out_Del( p_demux->out, tk->es ); } } /* Free the array of titles */ for( int i = 0; i < p_sys->i_titles; i++ ) vlc_input_title_Delete( p_sys->titles[i] ); TAB_CLEAN( p_sys->i_titles, p_sys->titles ); /* Close libdvdread */ if( p_sys->p_title ) DVDCloseFile( p_sys->p_title ); if( p_sys->p_vts_file ) ifoClose( p_sys->p_vts_file ); if( p_sys->p_vmg_file ) ifoClose( p_sys->p_vmg_file ); DVDClose( p_sys->p_dvdread ); free( p_sys ); }
static void Close (vlc_object_t *obj) { demux_t *demux = (demux_t *)obj; demux_sys_t *sys = demux->p_sys; for (unsigned i = 0, n = sys->titlec; i < n; i++) vlc_input_title_Delete (sys->titlev[i]); free (sys->titlev); gme_delete (sys->emu); free (sys); }
/***************************************************************************** * Close files and free resources *****************************************************************************/ static void Close( vlc_object_t * p_this ) { access_t *p_access = (access_t*)p_this; access_sys_t *p_sys = p_access->p_sys; if( p_sys->fd != -1 ) close( p_sys->fd ); ARRAY_RESET( p_sys->file_sizes ); if( p_sys->p_meta ) vlc_meta_Delete( p_sys->p_meta ); vlc_input_title_Delete( p_sys->p_marks ); free( p_sys ); }
/***************************************************************************** * Close files and free resources *****************************************************************************/ static void Close( vlc_object_t * p_this ) { access_t *p_access = (access_t*)p_this; access_sys_t *p_sys = p_access->p_sys; if( p_sys->fd != -1 ) vlc_close( p_sys->fd ); ARRAY_RESET( p_sys->file_sizes ); if( p_sys->p_meta ) vlc_meta_Delete( p_sys->p_meta ); size_t count = p_sys->p_marks->i_seekpoint; TAB_CLEAN( count, p_sys->offsets ); vlc_input_title_Delete( p_sys->p_marks ); }
void InputManager::UpdateNavigation() { /* Update navigation status */ vlc_value_t val; val.i_int = 0; vlc_value_t val2; val2.i_int = 0; var_Change( p_input, "title", VLC_VAR_CHOICESCOUNT, &val, NULL ); if( val.i_int > 0 ) { bool b_menu = false; if( val.i_int > 1 ) { input_title_t **pp_title = NULL; int i_title = 0; if( input_Control( p_input, INPUT_GET_FULL_TITLE_INFO, &pp_title, &i_title ) == VLC_SUCCESS ) { for( int i = 0; i < i_title; i++ ) { if( pp_title[i]->i_flags & INPUT_TITLE_MENU ) b_menu = true; vlc_input_title_Delete(pp_title[i]); } free( pp_title ); } } /* p_input != NULL since val.i_int != 0 */ var_Change( p_input, "chapter", VLC_VAR_CHOICESCOUNT, &val2, NULL ); emit titleChanged( b_menu ); emit chapterChanged( val2.i_int > 1 ); } else emit chapterChanged( false ); if( hasInput() ) emit inputCanSeek( var_GetBool( p_input, "can-seek" ) ); else emit inputCanSeek( false ); }
/***************************************************************************** * Import cut marks and convert them to seekpoints (chapters). *****************************************************************************/ static void ImportMarks( access_t *p_access ) { access_sys_t *p_sys = p_access->p_sys; FILE *marksfile = OpenRelativeFile( p_access, "marks" ); if( !marksfile ) return; FILE *indexfile = OpenRelativeFile( p_access, "index" ); if( !indexfile ) { fclose( marksfile ); return; } /* get the length of this recording (index stores 8 bytes per frame) */ struct stat st; if( fstat( fileno( indexfile ), &st ) ) { fclose( marksfile ); fclose( indexfile ); return; } int64_t i_frame_count = st.st_size / 8; /* Put all cut marks in a "dummy" title */ input_title_t *p_marks = vlc_input_title_New(); if( !p_marks ) { fclose( marksfile ); fclose( indexfile ); return; } p_marks->psz_name = strdup( _("VDR Cut Marks") ); p_marks->i_length = i_frame_count * (int64_t)( CLOCK_FREQ / p_sys->fps ); uint64_t *offsetv = NULL; size_t offsetc = 0; /* offset for chapter positions */ int i_chapter_offset = p_sys->fps / 1000 * var_InheritInteger( p_access, "vdr-chapter-offset" ); /* minimum chapter size in frames */ int i_min_chapter_size = p_sys->fps * MIN_CHAPTER_SIZE; /* the last chapter started at this frame (init to 0 so * we skip useless chapters near the beginning as well) */ int64_t i_prev_chapter = 0; /* parse lines of the form "0:00:00.00 foobar" */ char *line = NULL; size_t line_len; while( ReadLine( &line, &line_len, marksfile ) ) { int64_t i_frame = ParseFrameNumber( line, p_sys->fps ); /* skip chapters which are near the end or too close to each other */ if( i_frame - i_prev_chapter < i_min_chapter_size || i_frame >= i_frame_count - i_min_chapter_size ) continue; i_prev_chapter = i_frame; /* move chapters (simple workaround for inaccurate cut marks) */ if( i_frame > -i_chapter_offset ) i_frame += i_chapter_offset; else i_frame = 0; uint64_t i_offset; uint16_t i_file_number; if( !ReadIndexRecord( indexfile, p_sys->b_ts_format, i_frame, &i_offset, &i_file_number ) ) continue; if( i_file_number < 1 || i_file_number > FILE_COUNT ) continue; /* add file sizes to get the "global" offset */ seekpoint_t *sp = vlc_seekpoint_New(); if( !sp ) continue; sp->i_time_offset = i_frame * (int64_t)( CLOCK_FREQ / p_sys->fps ); sp->psz_name = strdup( line ); TAB_APPEND( p_marks->i_seekpoint, p_marks->seekpoint, sp ); TAB_APPEND( offsetc, offsetv, i_offset ); for( int i = 0; i + 1 < i_file_number; ++i ) offsetv[offsetc - 1] += FILE_SIZE( i ); } /* add a chapter at the beginning if missing */ if( p_marks->i_seekpoint > 0 && offsetv[0] > 0 ) { seekpoint_t *sp = vlc_seekpoint_New(); if( sp ) { sp->i_time_offset = 0; sp->psz_name = strdup( _("Start") ); TAB_INSERT( p_marks->i_seekpoint, p_marks->seekpoint, sp, 0 ); TAB_INSERT( offsetc, offsetv, UINT64_C(0), 0 ); } } if( p_marks->i_seekpoint > 0 ) { p_sys->p_marks = p_marks; p_sys->offsets = offsetv; } else { vlc_input_title_Delete( p_marks ); TAB_CLEAN( offsetc, offsetv ); } fclose( marksfile ); fclose( indexfile ); }