Lines Matching refs:nsv

218     NSVContext *nsv = s->priv_data;  in nsv_resync()  local
226 nsv->state = NSV_UNSYNC; in nsv_resync()
237 nsv->state = NSV_FOUND_BEEF; in nsv_resync()
243 nsv->state = NSV_FOUND_NSVF; in nsv_resync()
248 nsv->state = NSV_FOUND_NSVS; in nsv_resync()
259 NSVContext *nsv = s->priv_data; in nsv_parse_NSVf_header() local
268 nsv->state = NSV_UNSYNC; /* in case we fail */ in nsv_parse_NSVf_header()
270 if (nsv->nsvf) { in nsv_parse_NSVf_header()
274 nsv->nsvf = 1; in nsv_parse_NSVf_header()
279 nsv->NSVf_end = size; in nsv_parse_NSVf_header()
285 nsv->duration = duration = avio_rl32(pb); /* in ms */ in nsv_parse_NSVf_header()
338 nsv->index_entries = table_entries_used; in nsv_parse_NSVf_header()
341 nsv->nsvs_file_offset = av_malloc_array((unsigned)table_entries_used, sizeof(uint32_t)); in nsv_parse_NSVf_header()
342 if (!nsv->nsvs_file_offset) in nsv_parse_NSVf_header()
348 nsv->nsvs_file_offset[i] = avio_rl32(pb) + size; in nsv_parse_NSVf_header()
353 nsv->nsvs_timestamps = av_malloc_array((unsigned)table_entries_used, sizeof(uint32_t)); in nsv_parse_NSVf_header()
354 if (!nsv->nsvs_timestamps) in nsv_parse_NSVf_header()
357 nsv->nsvs_timestamps[i] = avio_rl32(pb); in nsv_parse_NSVf_header()
364 …avio_seek(pb, nsv->base_offset + size, SEEK_SET); /* required for dumbdriving-271.nsv (2 extra byt… in nsv_parse_NSVf_header()
368 nsv->state = NSV_HAS_READ_NSVF; in nsv_parse_NSVf_header()
374 NSVContext *nsv = s->priv_data; in nsv_parse_NSVs_header() local
407 nsv->avsync = avio_rl16(pb); in nsv_parse_NSVs_header()
408 nsv->framerate = framerate; in nsv_parse_NSVs_header()
414 nsv->vtag = vtag; in nsv_parse_NSVs_header()
415 nsv->atag = atag; in nsv_parse_NSVs_header()
416 nsv->vwidth = vwidth; in nsv_parse_NSVs_header()
417 nsv->vheight = vwidth; in nsv_parse_NSVs_header()
438 st->duration = av_rescale(nsv->duration, framerate.num, 1000*framerate.den); in nsv_parse_NSVs_header()
440 for(i=0;i<nsv->index_entries;i++) { in nsv_parse_NSVs_header()
441 if(nsv->nsvs_timestamps) { in nsv_parse_NSVs_header()
442 av_add_index_entry(st, nsv->nsvs_file_offset[i], nsv->nsvs_timestamps[i], in nsv_parse_NSVs_header()
445 … int64_t ts = av_rescale(i*nsv->duration/nsv->index_entries, framerate.num, 1000*framerate.den); in nsv_parse_NSVs_header()
446 av_add_index_entry(st, nsv->nsvs_file_offset[i], ts, 0, 0, AVINDEX_KEYFRAME); in nsv_parse_NSVs_header()
469 st->duration = (int64_t)nsv->duration * framerate.num; in nsv_parse_NSVs_header()
472 … if (nsv->vtag != vtag || nsv->atag != atag || nsv->vwidth != vwidth || nsv->vheight != vwidth) { in nsv_parse_NSVs_header()
478 nsv->state = NSV_HAS_READ_NSVS; in nsv_parse_NSVs_header()
482 nsv->state = NSV_UNSYNC; in nsv_parse_NSVs_header()
488 NSVContext *nsv = s->priv_data; in nsv_read_header() local
491 nsv->state = NSV_UNSYNC; in nsv_read_header()
492 nsv->ahead[0].data = nsv->ahead[1].data = NULL; in nsv_read_header()
497 if (nsv->state == NSV_FOUND_NSVF) { in nsv_read_header()
503 if (nsv->state == NSV_FOUND_NSVS) { in nsv_read_header()
521 NSVContext *nsv = s->priv_data; in nsv_read_chunk() local
533 if (nsv->ahead[0].data || nsv->ahead[1].data) in nsv_read_chunk()
540 for (i = 0; i < NSV_MAX_RESYNC_TRIES && nsv->state < NSV_FOUND_NSVS && !err; i++) in nsv_read_chunk()
544 if (nsv->state == NSV_FOUND_NSVS) in nsv_read_chunk()
548 if (nsv->state != NSV_HAS_READ_NSVS && nsv->state != NSV_FOUND_BEEF) in nsv_read_chunk()
569 nsv->state = NSV_UNSYNC; in nsv_read_chunk()
581 pkt = &nsv->ahead[NSV_ST_VIDEO]; in nsv_read_chunk()
586 …pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a … in nsv_read_chunk()
595 pkt = &nsv->ahead[NSV_ST_AUDIO]; in nsv_read_chunk()
627 …pkt->flags |= nsv->state == NSV_HAS_READ_NSVS ? AV_PKT_FLAG_KEY : 0; /* keyframe only likely on a … in nsv_read_chunk()
628 if( nsv->state == NSV_HAS_READ_NSVS && st[NSV_ST_VIDEO] ) { in nsv_read_chunk()
631 pkt->dts *= (int64_t)1000 * nsv->framerate.den; in nsv_read_chunk()
632 pkt->dts += (int64_t)nsv->avsync * nsv->framerate.num; in nsv_read_chunk()
633 av_log(s, AV_LOG_TRACE, "NSV AUDIO: sync:%d, dts:%"PRId64, nsv->avsync, pkt->dts); in nsv_read_chunk()
638 nsv->state = NSV_UNSYNC; in nsv_read_chunk()
645 NSVContext *nsv = s->priv_data; in nsv_read_packet() local
649 if (!nsv->ahead[0].data && !nsv->ahead[1].data) in nsv_read_packet()
656 if (nsv->ahead[i].data) { in nsv_read_packet()
658 memcpy(pkt, &nsv->ahead[i], sizeof(AVPacket)); in nsv_read_packet()
659 nsv->ahead[i].data = NULL; /* we ate that one */ in nsv_read_packet()
670 NSVContext *nsv = s->priv_data; in nsv_read_seek() local
683 nsv->state = NSV_UNSYNC; in nsv_read_seek()
689 NSVContext *nsv = s->priv_data; in nsv_read_close() local
691 av_freep(&nsv->nsvs_file_offset); in nsv_read_close()
692 av_freep(&nsv->nsvs_timestamps); in nsv_read_close()
693 if (nsv->ahead[0].data) in nsv_read_close()
694 av_packet_unref(&nsv->ahead[0]); in nsv_read_close()
695 if (nsv->ahead[1].data) in nsv_read_close()
696 av_packet_unref(&nsv->ahead[1]); in nsv_read_close()