FFmpeg: libavformat/segment.c Source File
Go to the documentation of this file. 1 /*
2 * Copyright (c) 2011, Luca Barbato
3 *
4 * This file is part of FFmpeg.
5 *
6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * FFmpeg is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with FFmpeg; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21 /**
22 * @file generic segmenter
23 * M3U8 specification can be find here:
24 * @url{http://tools.ietf.org/id/draft-pantos-http-live-streaming}
25 */
26
27 #include "config_components.h"
28
30
34
46
56
66
67 #define SEGMENT_LIST_FLAG_CACHE 1
68 #define SEGMENT_LIST_FLAG_LIVE 2
69
71 const AVClass *
class;
/**< Class for private options. */
72 int segment_idx;
///< index of the segment file to write, starting from 0
78 char *
format;
///< format to use for output segment files
80 char *
list;
///< filename for the segment list file
82 int list_size;
///< number of entries for the segment list file
83
91
99
100 char *
times_str;
///< segment times specification string
102 int nb_times;
///< number of elments in the times array
103
104 char *
frames_str;
///< segment frame numbers specification string
105 int *
frames;
///< list of frame number specification
106 int nb_frames;
///< number of elments in the frames array
109
114
122
125
130
132 {
133 int needs_quoting = !!str[strcspn(str, "\",\n\r")];
134
135 if (needs_quoting)
137
138 for (; *str; str++) {
139 if (*str == '"')
142 }
143 if (needs_quoting)
145 }
146
148 {
153
158
166
167 for (
i = 0;
i <
s->nb_streams;
i++) {
170
172 if (!st)
179 } else {
180 opar->codec_tag = 0;
181 }
182 }
183
184 return 0;
185 }
186
188 {
193 char buf[1024];
194 char *new_name;
195
199 time_t now0;
200 struct tm *tm, tmpbuf;
201 time(&now0);
203 if (!strftime(buf,
sizeof(buf),
s->url, tm)) {
206 }
211 }
213 if (!new_name)
216
217 /* copy modified name in list entry */
221
227
228 return 0;
229 }
230
232 {
235 int err = 0;
236
241 return err;
243 }
244
248
250 return err;
251
254 return err;
255 }
258
261
268 if (err < 0)
269 return err;
270 }
271
273 return 0;
274 }
275
277 {
280
286 }
287
290 double max_duration = 0;
291
297
300
302 max_duration =
FFMAX(max_duration,
entry->end_time -
entry->start_time);
306 }
307
309 }
310
314 void *log_ctx)
315 {
316 switch (list_type) {
319 break;
324 break;
328 break;
330 {
331 char *buf;
334 "Error writing list entry '%s' in list file\n", list_entry->
filename);
335 return;
336 }
339 break;
340 }
341 default:
343 }
344 }
345
347 {
356 int err;
357
360
364
368
374 goto end;
375 }
376
377 /* append new element */
382 else
385
386 /* drop first item */
392 }
393
395 goto end;
403 } else {
406 }
407 }
408
412
415 if (tcr) {
416 /* search the first video stream */
417 for (
i = 0;
i <
s->nb_streams;
i++) {
419 rate =
s->streams[
i]->avg_frame_rate;
/* Get fps from the video stream */
421 if (err < 0) {
422 av_log(
s,
AV_LOG_WARNING,
"Could not increment global timecode, error occurred during timecode creation.\n");
423 break;
424 }
428 break;
429 }
430 }
431 } else {
432 av_log(
s,
AV_LOG_WARNING,
"Could not increment global timecode, no global timecode metadata found.\n");
433 }
434 for (
i = 0;
i <
s->nb_streams;
i++) {
440 if (st_tcr) {
442 av_log(
s,
AV_LOG_WARNING,
"Could not increment stream %d timecode, error occurred during timecode creation.\n",
i);
443 continue;
444 }
447 }
448 }
449 }
450 }
451
452 end:
454
456 }
457
459 const char *times_str)
460 {
461 char *p;
464 char *saveptr =
NULL;
465
466 if (!times_str1)
468
469 #define FAIL(err) ret = err; goto end
470
471 *nb_times = 1;
472 for (p = times_str1; *p; p++)
473 if (*p == ',')
474 (*nb_times)++;
475
477 if (!*times) {
480 }
481
482 p = times_str1;
483 for (
i = 0;
i < *nb_times;
i++) {
485 char *tstr =
av_strtok(p,
",", &saveptr);
487
488 if (!tstr || !tstr[0]) {
490 times_str);
492 }
493
497 "Invalid time duration specification '%s' in times list %s\n", tstr, times_str);
499 }
501
502 /* check on monotonicity */
503 if (
i && (*times)[
i-1] > (*times)[
i]) {
505 "Specified time %f is smaller than the last time %f\n",
506 (
float)((*times)[
i])/1000000, (
float)((*times)[
i-1])/1000000);
508 }
509 }
510
511 end:
514 }
515
517 const char *frames_str)
518 {
519 const char *p;
521
522 *nb_frames = 1;
523 for (p = frames_str; *p; p++)
524 if (*p == ',')
525 (*nb_frames)++;
526
531 }
532
533 p = frames_str;
534 for (
i = 0;
i < *nb_frames;
i++) {
536 char *tailptr;
537
538 if (*p == '0円' || *p == ',') {
540 frames_str);
542 }
543 f = strtol(p, &tailptr, 10);
544 if (*tailptr != '0円' && *tailptr != ',' || f <= 0 || f >= INT_MAX) {
546 "Invalid argument '%s', must be a positive integer < INT_MAX\n",
547 p);
549 }
550 if (*tailptr == ',')
551 tailptr++;
552 p = tailptr;
554
555 /* check on monotonicity */
558 "Specified frame %d is smaller than the last frame %d\n",
561 }
562 }
563
564 return 0;
565 }
566
568 {
569 int buf_size = 32768;
571 if (!buf)
577 }
578 return 0;
579 }
580
582 {
585 }
586
588 {
591
594 /* select first index of type with highest priority */
596 static const enum AVMediaType type_priority_list[] = {
602 };
604
606 type_index_map[
i] = -1;
607
608 /* select first index for each type */
609 for (
i = 0;
i <
s->nb_streams;
i++) {
610 type =
s->streams[
i]->codecpar->codec_type;
612 /* ignore attached pictures/cover art streams */
614 type_index_map[
type] =
i;
615 }
616
618 type = type_priority_list[
i];
620 break;
621 }
622 } else {
623 for (
i = 0;
i <
s->nb_streams;
i++) {
630 break;
631 }
632 }
633 }
634
639 }
640
641 return 0;
642 }
643
645 {
648
653 else
657 }
661
663 while (cur) {
667 cur = next;
668 }
669 }
670
672 {
678
682
686 }
687
690 "you can use output_ts_offset instead of it\n");
691 }
692
695 "segment_time, segment_times, and segment_frames options "
696 "are mutually exclusive, select just one of them\n");
698 }
699
702
709 } else {
711 if (seg->
time <= 0) {
712 av_log(
s,
AV_LOG_ERROR,
"Invalid negative segment_time with segment_atclocktime option set\n");
714 }
716 }
720 }
721 }
722
730 }
734 } else {
736 seg->
use_rename = proto && !strcmp(proto,
"file");
737 }
738 }
739
742
748
750
752
759 }
760
763
767
769 if ((
ret =
s->io_open(
s, &oc->
pb,
774 }
777 } else {
781 }
782
788 "Some of the provided format options are not recognized\n");
791 }
793
796 }
798
805 }
806
807 for (
i = 0;
i <
s->nb_streams;
i++) {
811 }
812
814 s->avoid_negative_ts = 1;
815
817 }
818
820 {
824
829 }
830
835 } else {
838 }
843 }
844
845 return 0;
846 }
847
849 {
853 int start_frame = INT_MAX;
855 struct tm ti;
858
861
863 size_t pkt_extradata_size;
865 if (pkt_extradata && pkt_extradata_size > 0) {
869 goto calc_times;
870 }
872 }
873 }
874
875 calc_times:
882 } else {
885 time_t sec = avgt / 1000000;
887 usecs = (
int64_t)(ti.tm_hour * 3600 + ti.tm_min * 60 + ti.tm_sec) * 1000000 + (avgt % 1000000);
889 if (wrapped_val < seg->last_val && wrapped_val < seg->clocktime_wrap_duration)
892 } else {
894 }
895 }
896
897 ff_dlog(
s,
"packet stream:%d pts:%s pts_time:%s duration_time:%s is_key:%d frame:%d\n",
902
907 }
908
912 INT64_MAX - end_pts;
913 }
914
917
926 /* sanitize end time in case last packet didn't have a defined duration */
929
932
935
941
943 goto calc_times;
944 }
945
951 }
952
957 }
958
959 av_log(
s,
AV_LOG_DEBUG,
"stream:%d start_pts_time:%s pts:%s pts_time:%s dts:%s dts_time:%s",
964
965 /* compute new timestamps */
972
976
980
982 /* Use st->index here as the packet returned from ff_write_chained()
983 * is blank if interleaving has been used. */
987 }
988
990 }
991
993 {
997
998 if (!oc)
999 return 0;
1000
1008 } else {
1010 }
1012 }
1013
1016 {
1027 }
1029 }
1030 return 1;
1031 }
1032
1033 #define OFFSET(x) offsetof(SegmentContext, x)
1034 #define E AV_OPT_FLAG_ENCODING_PARAM
1036 {
"reference_stream",
"set reference stream",
OFFSET(reference_stream_specifier),
AV_OPT_TYPE_STRING, {.str =
"auto"}, 0, 0,
E },
1038 {
"segment_format_options",
"set list of options for the container format used for the segments",
OFFSET(format_options),
AV_OPT_TYPE_DICT, {.str =
NULL}, 0, 0,
E },
1040 {
"segment_header_filename",
"write a single file containing the header",
OFFSET(header_filename),
AV_OPT_TYPE_STRING, {.str =
NULL}, 0, 0,
E },
1041
1045
1046 {
"segment_list_size",
"set the maximum number of playlist entries",
OFFSET(list_size),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
E },
1047
1055
1056 {
"segment_atclocktime",
"set segment to be cut at clocktime",
OFFSET(use_clocktime),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
E},
1057 {
"segment_clocktime_offset",
"set segment clocktime offset",
OFFSET(clocktime_offset),
AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, 86400000000LL,
E},
1058 {
"segment_clocktime_wrap_duration",
"set segment clocktime wrapping duration",
OFFSET(clocktime_wrap_duration),
AV_OPT_TYPE_DURATION, {.i64 = INT64_MAX}, 0, INT64_MAX,
E},
1060 {
"segment_time_delta",
"set approximation value used for the segment times",
OFFSET(time_delta),
AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX,
E },
1061 {
"min_seg_duration",
"set minimum segment duration",
OFFSET(min_seg_duration),
AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX,
E },
1064 {
"segment_wrap",
"set number after which the index wraps",
OFFSET(segment_idx_wrap),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
E },
1066 {
"segment_start_number",
"set the sequence number of the first segment",
OFFSET(segment_idx),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
E },
1067 {
"segment_wrap_number",
"set the number of wrap before the first segment",
OFFSET(segment_idx_wrap_nb),
AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX,
E },
1068 {
"strftime",
"set filename expansion with strftime at segment creation",
OFFSET(use_strftime),
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
E },
1069 {
"increment_tc",
"increment timecode between each segment",
OFFSET(increment_tc),
AV_OPT_TYPE_BOOL, {.i64 = 0 }, 0, 1,
E },
1070 {
"break_non_keyframes",
"allow breaking segments on non-keyframes",
OFFSET(break_non_keyframes),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
E },
1071
1072 {
"individual_header_trailer",
"write header/trailer to each segment",
OFFSET(individual_header_trailer),
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1,
E },
1073 {
"write_header_trailer",
"write a header to the first segment and a trailer to the last one",
OFFSET(write_header_trailer),
AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1,
E },
1074 {
"reset_timestamps",
"reset timestamps at the beginning of each segment",
OFFSET(reset_timestamps),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
E },
1075 {
"initial_offset",
"set initial timestamp offset",
OFFSET(initial_offset),
AV_OPT_TYPE_DURATION, {.i64 = 0}, -INT64_MAX, INT64_MAX,
E },
1076 {
"write_empty_segments",
"allow writing empty 'filler' segments",
OFFSET(write_empty),
AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1,
E },
1078 };
1079
1085 };
1086
1087 #if CONFIG_SEGMENT_MUXER
1089 .
p.
name =
"segment",
1100 };
1101 #endif
1102
1103 #if CONFIG_STREAM_SEGMENT_MUXER
1105 .
p.
name =
"stream_segment,ssegment",
1116 };
1117 #endif
#define SEGMENT_LIST_FLAG_LIVE
int write_header_trailer
Set by a private option.
enum AVCodecID av_codec_get_id(const struct AVCodecTag *const *tags, unsigned int tag)
Get the AVCodecID for the given codec tag tag.
#define AV_LOG_WARNING
Something somehow does not look correct.
#define AV_TIMECODE_STR_SIZE
int64_t clocktime_wrap_duration
uint8_t * extradata
Extra binary data needed for initializing the decoder, codec-dependent.
int64_t min_seg_duration
minimum segment duration
#define AVSTREAM_INIT_IN_WRITE_HEADER
stream parameters initialized in avformat_write_header
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
AVIOContext * list_pb
list file put-byte context
int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b)
Compare two timestamps each in its own time base.
struct AVBSFContext * bsfc
bitstream filter to run on stream
This struct describes the properties of an encoded stream.
static int segment_start(AVFormatContext *s, int write_header)
@ AV_PKT_DATA_NEW_EXTRADATA
The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format that the extradata buffer was...
int av_dict_count(const AVDictionary *m)
Get number of entries in dictionary.
int use_clocktime
flag to cut segments at regular clock time
void avio_context_free(AVIOContext **s)
Free the supplied IO context and everything associated with it.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
int list_type
set the list type
int nb_frames
number of elments in the frames array
int segment_idx_wrap
number after which the index wraps
AVStream ** streams
A list of all streams in the file.
static void deinit(AVFormatContext *s)
static int segment_mux_init(AVFormatContext *s)
AVIOContext * avio_alloc_context(unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Allocate and initialize an AVIOContext for buffered I/O.
int segment_count
number of segment files already written
char * times_str
segment times specification string
char * frames_str
segment frame numbers specification string
#define AV_LOG_VERBOSE
Detailed information.
int64_t duration
Duration of this packet in AVStream->time_base units, 0 if unknown.
uint32_t codec_tag
Additional information about the codec (corresponds to the AVI FOURCC).
av_warn_unused_result int avformat_init_output(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and initialize the codec, but do not write the header.
SegmentListEntry cur_entry
char * list
filename for the segment list file
int av_get_frame_filename(char *buf, int buf_size, const char *path, int number)
struct SegmentListEntry * next
#define AV_PKT_FLAG_KEY
The packet contains a keyframe.
const char * av_basename(const char *path)
Thread safe basename.
int64_t time
segment duration
char temp_list_filename[1024]
int is_nullctx
whether avf->pb is a nullctx
static int segment_end(AVFormatContext *s, int write_trailer, int is_last)
AVIOInterruptCB interrupt_callback
Custom interrupt callbacks for the I/O layer.
int nb_times
number of elments in the times array
static int parse_frames(void *log_ctx, int **frames, int *nb_frames, const char *frames_str)
static int seg_write_header(AVFormatContext *s)
int av_escape(char **dst, const char *src, const char *special_chars, enum AVEscapeMode mode, int flags)
Escape string in src, and put the escaped string in an allocated string in *dst, which must be freed ...
if it could not because there are no more frames
int reference_stream_index
int start
timecode frame start (first base frame number)
const AVOutputFormat * oformat
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
static void close_null_ctxp(AVIOContext **pb)
#define AV_ESCAPE_FLAG_WHITESPACE
Consider spaces special and escape them even in the middle of the string.
int ff_rename(const char *url_src, const char *url_dst, void *logctx)
Wrap ffurl_move() and log if error happens.
static int select_reference_stream(AVFormatContext *s)
static int seg_check_bitstream(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
int use_strftime
flag to expand filename with strftime
int reset_timestamps
reset timestamps at the beginning of each segment
static __device__ float ceil(float a)
int frame_count
total number of reference frames
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
#define FF_ARRAY_ELEMS(a)
char * format
format to use for output segment files
static int seg_write_trailer(struct AVFormatContext *s)
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
int flags
Flags modifying the (de)muxer behaviour.
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample format(the sample packing is implied by the sample format) and sample rate. The lists are not just lists
static double av_q2d(AVRational a)
Convert an AVRational to a double.
char * av_strtok(char *s, const char *delim, char **saveptr)
Split the string into several tokens which can be accessed by successive calls to av_strtok().
int av_match_ext(const char *filename, const char *extensions)
Return a positive value if the given filename has one of the given extensions, 0 otherwise.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
#define AVIO_FLAG_WRITE
write-only
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
static const FFOutputFormat * ffofmt(const AVOutputFormat *fmt)
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
@ AVMEDIA_TYPE_DATA
Opaque data information usually continuous.
av_warn_unused_result int avformat_write_header(AVFormatContext *s, AVDictionary **options)
Allocate the stream private data and write the stream header to an output media file.
static int seg_init(AVFormatContext *s)
void avio_flush(AVIOContext *s)
Force flushing of buffered data.
AVDictionary * format_options
AVCodecParameters * codecpar
Codec parameters associated with this stream.
#define LIBAVUTIL_VERSION_INT
Describe the class of an AVClass context structure.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static int write_trailer(AVFormatContext *s1)
Rational number (pair of numerator and denominator).
@ LIST_TYPE_EXT
deprecated
int * frames
list of frame number specification
const char * av_default_item_name(void *ptr)
Return the context name.
AVIOContext * pb
I/O context.
Filter the word "frame" indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining list
int av_parse_time(int64_t *timeval, const char *timestr, int duration)
Parse timestr and return in *time a corresponding number of microseconds.
void avio_w8(AVIOContext *s, int b)
int64_t reference_stream_first_pts
initial timestamp, expressed in microseconds
static int set_segment_filename(AVFormatContext *s)
int av_write_frame(AVFormatContext *s, AVPacket *pkt)
Write a packet to an output media file.
@ AV_ESCAPE_MODE_AUTO
Use auto-selected escaping mode.
static int seg_write_packet(AVFormatContext *s, AVPacket *pkt)
static int segment_list_open(AVFormatContext *s)
int extradata_size
Size of the extradata content in bytes.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
char * entry_prefix
prefix to add to list entry filenames
int increment_tc
flag to increment timecode if found
static void print_csv_escaped_str(AVIOContext *ctx, const char *str)
SegmentListEntry * segment_list_entries_end
int(* init)(AVBSFContext *ctx)
#define av_ts2timestr(ts, tb)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int avformat_match_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
Check if the stream st contained in s is matched by the stream specifier spec.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
unsigned int av_codec_get_tag(const struct AVCodecTag *const *tags, enum AVCodecID id)
Get the codec tag for the given codec id id.
int seekable
A combination of AVIO_SEEKABLE_ flags or 0 when the stream is not seekable.
char * url
input or output URL.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
#define AV_NOPTS_VALUE
Undefined timestamp value.
static void seg_free(AVFormatContext *s)
int header_written
whether we've already called avformat_write_header
int64_t dts
Decompression timestamp in AVStream->time_base units; the time at which the packet is decompressed.
int segment_frame_count
number of reference frames in the segment
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf offset
int flags
A combination of AV_PKT_FLAG values.
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int segment_idx_wrap_nb
number of time the index has wraped
int64_t last_val
remember last time for wrap around detection
int av_write_trailer(AVFormatContext *s)
Write the stream trailer to an output media file and free the file private data.
int segment_idx
index of the segment file to write, starting from 0
char * reference_stream_specifier
reference stream specifier
#define i(width, name, range_min, range_max)
int64_t pts
Presentation timestamp in AVStream->time_base units; the time at which the decompressed packet will b...
uint8_t * av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, size_t *size)
Get side information from packet.
#define AVERROR_MUXER_NOT_FOUND
Muxer not found.
#define av_malloc_array(a, b)
int avoid_negative_ts
Avoid negative timestamps during muxing.
@ AVMEDIA_TYPE_ATTACHMENT
Opaque data information usually sparse.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int list_size
number of entries for the segment list file
static int write_packet(Muxer *mux, OutputStream *ost, AVPacket *pkt)
SegmentListEntry * segment_list_entries
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
const struct AVOutputFormat * oformat
The output container format.
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2
Writes a formatted string to the context.
const char * av_get_media_type_string(enum AVMediaType media_type)
Return a string describing the media_type enum, NULL if media_type is unknown.
int index
stream index in AVFormatContext
static const AVOption options[]
static void segment_list_print_entry(AVIOContext *list_ioctx, ListType list_type, const SegmentListEntry *list_entry, void *log_ctx)
void avformat_free_context(AVFormatContext *s)
Free an AVFormatContext and all its streams.
char * header_filename
filename to write the output header to
int(* io_open)(struct AVFormatContext *s, AVIOContext **pb, const char *url, int flags, AVDictionary **options)
A callback for opening new IO streams.
int individual_header_trailer
Set by a private option.
int list_flags
flags affecting list generation
static const AVClass seg_class
int64_t * times
list of segment interval specification
int64_t av_gettime(void)
Get the current time in microseconds.
char * av_strdup(const char *s)
Duplicate a string.
const AVOutputFormat * av_guess_format(const char *short_name, const char *filename, const char *mime_type)
Return the output format in the list of registered output formats which best matches the provided par...
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
#define SEGMENT_LIST_FLAG_CACHE
int(* io_close2)(struct AVFormatContext *s, AVIOContext *pb)
A callback for closing the streams opened with AVFormatContext.io_open().
static int parse_times(void *log_ctx, int64_t **times, int *nb_times, const char *times_str)
const char * avio_find_protocol_name(const char *url)
Return the name of the protocol that will handle the passed URL.
int64_t initial_offset
initial timestamps offset, expressed in microseconds
#define av_ts2str(ts)
Convenience macro, the return value should be used only directly in function arguments but never stan...
int av_timecode_init_from_string(AVTimecode *tc, AVRational rate, const char *str, void *log_ctx)
Parse timecode representation (hh:mm:ss[:;.
static void write_header(FFV1Context *f)
int pts_wrap_bits
Number of bits in timestamps.
void * priv_data
Format private data.
static int open_null_ctx(AVIOContext **ctx)
char * av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg)
Load timecode string in buf.
Generated on Thu Sep 26 2024 23:15:52 for FFmpeg by
doxygen
1.8.17