MCPcopy Create free account
hub / github.com/HandBrake/HandBrake / hb_ts_stream_init

Function hb_ts_stream_init

libhb/stream.c:2284–2395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2282 **********************************************************************/
2283
2284static int hb_ts_stream_init(hb_stream_t *stream)
2285{
2286 int i;
2287
2288 if ( stream->ts.list )
2289 {
2290 for (i=0; i < stream->ts.alloc; i++)
2291 {
2292 stream->ts.list[i].continuity = -1;
2293 stream->ts.list[i].pid = -1;
2294 stream->ts.list[i].pes_list = -1;
2295 }
2296 }
2297 stream->ts.count = 0;
2298
2299 if ( stream->pes.list )
2300 {
2301 for (i=0; i < stream->pes.alloc; i++)
2302 {
2303 stream->pes.list[i].stream_id = -1;
2304 stream->pes.list[i].next = -1;
2305 }
2306 }
2307 stream->pes.count = 0;
2308
2309 stream->ts.packet = malloc( stream->packetsize );
2310
2311 // Find the audio and video pids in the stream
2312 if (hb_ts_stream_find_pids(stream) < 0)
2313 {
2314 return -1;
2315 }
2316
2317 // hb_ts_resolve_pid_types reads some data, so the TS buffers
2318 // are needed here.
2319 for (i = 0; i < stream->ts.count; i++)
2320 {
2321 // demuxing buffer for TS to PS conversion
2322 stream->ts.list[i].buf = hb_buffer_init(stream->packetsize);
2323 stream->ts.list[i].buf->size = 0;
2324 }
2325 hb_ts_resolve_pid_types(stream);
2326
2327 if( stream->scan )
2328 {
2329 hb_log("Found the following PIDS");
2330 hb_log(" Video PIDS : ");
2331 for (i=0; i < stream->ts.count; i++)
2332 {
2333 if ( ts_stream_kind( stream, i ) == V )
2334 {
2335 hb_log( " 0x%x type %s (0x%x)%s",
2336 stream->ts.list[i].pid,
2337 stream_type_name2(stream,
2338 &stream->pes.list[stream->ts.list[i].pes_list]),
2339 ts_stream_type( stream, i ),
2340 stream->ts.list[i].is_pcr ? " (PCR)" : "");
2341 }

Callers 1

hb_stream_get_typeFunction · 0.85

Calls 8

hb_ts_stream_find_pidsFunction · 0.85
hb_buffer_initFunction · 0.85
hb_ts_resolve_pid_typesFunction · 0.85
hb_logFunction · 0.85
ts_stream_kindFunction · 0.85
stream_type_name2Function · 0.85
ts_stream_typeFunction · 0.85

Tested by

no test coverage detected