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

Function hb_stream_title_scan

libhb/stream.c:1061–1145  ·  view source on GitHub ↗

* hb_ps_stream_title_scan *********************************************************************** * **********************************************************************/

Source from the content-addressed store, hash-verified

1059 *
1060 **********************************************************************/
1061hb_title_t * hb_stream_title_scan(hb_stream_t *stream, hb_title_t * title)
1062{
1063 if ( stream->hb_stream_type == ffmpeg )
1064 return ffmpeg_title_scan( stream, title );
1065
1066 // 'Barebones Title'
1067 title->type = HB_STREAM_TYPE;
1068
1069 // Copy part of the stream path to the title name
1070 char * name = stream->path;
1071 char * sep = hb_strr_dir_sep(stream->path);
1072 if (sep)
1073 name = sep + 1;
1074 title->name = strdup(name);
1075 char *dot_term = strrchr(title->name, '.');
1076 if (dot_term)
1077 *dot_term = '\0';
1078
1079 // Figure out how many audio streams we really have:
1080 // - For transport streams, for each PID listed in the PMT (whether
1081 // or not it was an audio stream type) read the bitstream until we
1082 // find an packet from that PID containing a PES header and see if
1083 // the elementary stream is an audio type.
1084 // - For program streams read the first 4MB and take every unique
1085 // audio stream we find.
1086 hb_init_audio_list(stream, title);
1087 hb_init_subtitle_list(stream, title);
1088
1089 // set the video id, codec & muxer
1090 int idx = pes_index_of_video( stream );
1091 if ( idx < 0 )
1092 {
1093 hb_title_close( &title );
1094 return NULL;
1095 }
1096
1097 title->video_id = get_id( &stream->pes.list[idx] );
1098 title->video_codec = stream->pes.list[idx].codec;
1099 title->video_codec_param = stream->pes.list[idx].codec_param;
1100 title->video_timebase.num = 1;
1101 title->video_timebase.den = 90000;
1102
1103 if (stream->hb_stream_type == transport)
1104 {
1105 title->demuxer = HB_TS_DEMUXER;
1106
1107 // make sure we're grabbing the PCR PID
1108 update_ts_streams( stream, stream->pmt_info.PCR_PID, 0, -1, P, NULL );
1109 }
1110 else
1111 {
1112 title->demuxer = HB_PS_DEMUXER;
1113 }
1114
1115 // IDRs will be search for in hb_stream_duration
1116 stream->has_IDRs = 0;
1117 hb_stream_duration(stream, title);
1118

Callers 3

hb_batch_title_scanFunction · 0.85
ScanFuncFunction · 0.85

Calls 12

ffmpeg_title_scanFunction · 0.85
hb_strr_dir_sepFunction · 0.85
hb_init_audio_listFunction · 0.85
hb_init_subtitle_listFunction · 0.85
pes_index_of_videoFunction · 0.85
hb_title_closeFunction · 0.85
get_idFunction · 0.85
update_ts_streamsFunction · 0.85
hb_stream_durationFunction · 0.85
hb_chapter_set_titleFunction · 0.85
hb_list_addFunction · 0.85
hb_logFunction · 0.85

Tested by

no test coverage detected