/***************************************************************************** * Close: frees unused data *****************************************************************************/ 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; if( p_sys->p_current_block ) block_Release( p_sys->p_current_block ); for( int i = 0; i < p_sys->i_seekpoint; i++ ) free(p_sys->seekpoint[i]); TAB_CLEAN( p_sys->i_seekpoint, p_sys->seekpoint ); 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); for( int i = 0; i < p_sys->i_title_seekpoints; i++ ) vlc_seekpoint_Delete( p_sys->pp_title_seekpoints[i] ); TAB_CLEAN( p_sys->i_title_seekpoints, p_sys->pp_title_seekpoints ); /* Delete the decoder */ if( p_sys->p_packetizer ) demux_PacketizerDestroy( p_sys->p_packetizer ); if( p_sys->p_meta ) vlc_meta_Delete( p_sys->p_meta ); free( p_sys ); }
/***************************************************************************** * Close: frees unused data *****************************************************************************/ 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; demux_PacketizerDestroy( p_sys->p_packetizer ); free( p_sys ); }
/***************************************************************************** * Close: frees unused data *****************************************************************************/ 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; demux_PacketizerDestroy( p_sys->p_packetizer ); if( p_sys->i_pts_offset_lowtide < INT64_MAX && p_sys->i_pts_offset_lowtide > 0 ) { msg_Warn( p_demux, "For all packets seen, pts-dts (%"PRId64") could be reduced to 0", p_sys->i_pts_offset_lowtide ); } free( p_sys ); }
/***************************************************************************** * Close: frees unused data *****************************************************************************/ 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; TAB_CLEAN( p_sys->i_seekpoint, p_sys->seekpoint ); int i; for( i = 0; i < p_sys->i_attachments; i++ ) free( p_sys->attachments[i] ); TAB_CLEAN( p_sys->i_attachments, p_sys->attachments); /* Delete the decoder */ demux_PacketizerDestroy( p_sys->p_packetizer ); if( p_sys->p_meta ) vlc_meta_Delete( p_sys->p_meta ); free( p_sys ); }
/***************************************************************************** * Open: initializes demux structures *****************************************************************************/ static int Open( vlc_object_t * p_this ) { demux_t *p_demux = (demux_t*)p_this; demux_sys_t *p_sys; const uint8_t *p_peek; es_format_t fmt; if( stream_Peek( p_demux->s, &p_peek, 5 ) < 5 ) return VLC_EGENERIC; if( p_peek[0] != 0x00 || p_peek[1] != 0x00 || p_peek[2] != 0x00 || p_peek[3] != 0x01 || (p_peek[4]&0xFE) != 0x40 ) /* VPS & forbidden zero bit*/ { if( !p_demux->b_force ) { msg_Warn( p_demux, "hevc module discarded (no startcode)" ); return VLC_EGENERIC; } msg_Err( p_demux, "this doesn't look like a HEVC ES stream, " "continuing anyway" ); } p_demux->p_sys = p_sys = malloc( sizeof( demux_sys_t ) ); if( !p_demux->p_sys ) return VLC_ENOMEM; p_sys->p_es = NULL; p_sys->i_dts = VLC_TS_0; p_sys->f_force_fps = var_CreateGetFloat( p_demux, "hevc-force-fps" ); if( p_sys->f_force_fps != 0.0f ) { p_sys->f_fps = ( p_sys->f_force_fps < 0.001f )? 0.001f: p_sys->f_force_fps; msg_Dbg( p_demux, "using %.2f fps", (double) p_sys->f_fps ); } else p_sys->f_fps = 0.0f; /* Load the hevc packetizer */ es_format_Init( &fmt, VIDEO_ES, VLC_CODEC_HEVC ); p_sys->p_packetizer = demux_PacketizerNew( p_demux, &fmt, "hevc" ); if( !p_sys->p_packetizer ) { free( p_sys ); return VLC_EGENERIC; } p_sys->p_packetizer->fmt_out.b_packetized = true; p_sys->p_es = es_out_Add( p_demux->out, &p_sys->p_packetizer->fmt_out); if( !p_sys->p_es ) { demux_PacketizerDestroy( p_sys->p_packetizer ); free( p_sys ); return VLC_ENOMEM; } p_demux->pf_demux = Demux; p_demux->pf_control= Control; return VLC_SUCCESS; }