MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / stream_open

Function stream_open

fftools/ffplay.c:3227–3294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3225}
3226
3227static VideoState *stream_open(const char *filename,
3228 const AVInputFormat *iformat)
3229{
3230 VideoState *is;
3231
3232 is = av_mallocz(sizeof(VideoState));
3233 if (!is)
3234 return NULL;
3235 is->last_video_stream = is->video_stream = -1;
3236 is->last_audio_stream = is->audio_stream = -1;
3237 is->last_subtitle_stream = is->subtitle_stream = -1;
3238 is->filename = av_strdup(filename);
3239 if (!is->filename)
3240 goto fail;
3241 is->iformat = iformat;
3242 is->ytop = 0;
3243 is->xleft = 0;
3244
3245 /* start video display */
3246 if (frame_queue_init(&is->pictq, &is->videoq, VIDEO_PICTURE_QUEUE_SIZE, 1) < 0)
3247 goto fail;
3248 if (frame_queue_init(&is->subpq, &is->subtitleq, SUBPICTURE_QUEUE_SIZE, 0) < 0)
3249 goto fail;
3250 if (frame_queue_init(&is->sampq, &is->audioq, SAMPLE_QUEUE_SIZE, 1) < 0)
3251 goto fail;
3252
3253 if (packet_queue_init(&is->videoq) < 0 ||
3254 packet_queue_init(&is->audioq) < 0 ||
3255 packet_queue_init(&is->subtitleq) < 0)
3256 goto fail;
3257
3258 if (!(is->continue_read_thread = SDL_CreateCond())) {
3259 av_log(NULL, AV_LOG_FATAL, "SDL_CreateCond(): %s\n", SDL_GetError());
3260 goto fail;
3261 }
3262
3263 init_clock(&is->vidclk, &is->videoq.serial);
3264 init_clock(&is->audclk, &is->audioq.serial);
3265 init_clock(&is->extclk, &is->extclk.serial);
3266 is->audio_clock_serial = -1;
3267 if (startup_volume < 0)
3268 av_log(NULL, AV_LOG_WARNING, "-volume=%d < 0, setting to 0\n", startup_volume);
3269 if (startup_volume > 100)
3270 av_log(NULL, AV_LOG_WARNING, "-volume=%d > 100, setting to 100\n", startup_volume);
3271 if (video_background) {
3272 if (!strcmp(video_background, "none")) {
3273 is->render_params.video_background_type = VIDEO_BACKGROUND_NONE;
3274 } else if (strcmp(video_background, "tiles")) {
3275 if (av_parse_color(is->render_params.video_background_color, video_background, -1, NULL) >= 0)
3276 is->render_params.video_background_type = VIDEO_BACKGROUND_COLOR;
3277 else
3278 goto fail;
3279 }
3280 }
3281 startup_volume = av_clip(startup_volume, 0, 100);
3282 startup_volume = av_clip(SDL_MIX_MAXVOLUME * startup_volume / 100, 0, SDL_MIX_MAXVOLUME);
3283 is->audio_volume = startup_volume;
3284 is->muted = 0;

Callers 1

mainFunction · 0.85

Calls 8

av_strdupFunction · 0.85
frame_queue_initFunction · 0.85
packet_queue_initFunction · 0.85
av_logFunction · 0.85
init_clockFunction · 0.85
av_parse_colorFunction · 0.85
stream_closeFunction · 0.85
av_malloczFunction · 0.50

Tested by

no test coverage detected