74 if (!duration || atof(duration->
value) < 0)
continue;
75 if (atof(duration->
value) > max) max = atof(duration->
value);
82 double min_buffer_time = 1.0;
83 avio_printf(s->
pb,
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
85 avio_printf(s->
pb,
" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n");
86 avio_printf(s->
pb,
" xmlns=\"urn:mpeg:DASH:schema:MPD:2011\"\n");
87 avio_printf(s->
pb,
" xsi:schemaLocation=\"urn:mpeg:DASH:schema:MPD:2011\"\n");
93 avio_printf(s->
pb,
" profiles=\"urn:webm:dash:profile:webm-on-demand:2012\"");
110 if (!ts || strncmp(gold->
value, ts->
value, strlen(gold->
value)))
return 0;
120 if (!gold_track_num)
return 0;
126 strncmp(gold_track_num->
value, track_num->
value, strlen(gold_track_num->
value)) ||
141 int output_width,
int output_height,
142 int output_sample_rate) {
148 if (!irange || cues_start ==
NULL || cues_end ==
NULL || filename ==
NULL ||
201 int first_sample_rate, i;
220 static const char boolean[2][6] = {
"false",
"true" };
221 int subsegmentStartsWithSAP = 1;
226 int width_in_as = 1, height_in_as = 1, sample_rate_in_as = 1;
257 if (!kf || !strncmp(kf->
value,
"0", 1)) subsegmentStartsWithSAP = 0;
259 avio_printf(s->
pb,
" subsegmentStartsWithSAP=\"%d\"", subsegmentStartsWithSAP);
264 !width_in_as, !height_in_as, !sample_rate_in_as);
286 enum { new_set, parsed_id, parsing_streams }
state;
292 else if (
state == new_set && !strncmp(p,
"id=", 3)) {
294 if (w->
as ==
NULL)
return -1;
299 while (*p !=
',') *q++ = *p++;
303 }
else if (
state == parsed_id && !strncmp(p,
"streams=", 8)) {
305 state = parsing_streams;
306 }
else if (
state == parsing_streams) {
309 while (*q !=
'\0' && *q !=
',' && *q !=
' ') q++;
314 if (*q ==
'\0')
break;
315 if (*q ==
' ')
state = new_set;
336 for (i = 0; i < w->
nb_as; i++) {
354 for (i = 0; i < w->
nb_as; i++) {
361 #define OFFSET(x) offsetof(WebMDashMuxContext, x)
363 {
"adaptation_sets",
"Adaptation sets. Syntax: id=0,streams=0,1,2 id=1,streams=3,4 and so on",
OFFSET(adaptation_sets),
AV_OPT_TYPE_STRING, { 0 }, 0, 0,
AV_OPT_FLAG_ENCODING_PARAM },
367 #if CONFIG_WEBM_DASH_MANIFEST_MUXER
368 static const AVClass webm_dash_class = {
376 .
name =
"webm_dash_manifest",
378 .mime_type =
"application/xml",
384 .priv_class = &webm_dash_class,
#define LIBAVUTIL_VERSION_INT
#define INITIALIZATION_RANGE
static int subsegment_alignment(AVFormatContext *s, AdaptationSet *as)
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream ** streams
A list of all streams in the file.
AVDictionaryEntry * av_dict_get(const AVDictionary *m, const char *key, const AVDictionaryEntry *prev, int flags)
Get a dictionary entry with matching key.
#define AVERROR_EOF
End of file.
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
static const AVOption options[]
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
static int webm_dash_manifest_write_packet(AVFormatContext *s, AVPacket *pkt)
size_t av_strlcpy(char *dst, const char *src, size_t size)
Copy the string src to dst, but no more than size - 1 bytes, and null-terminate dst.
static int check_matching_sample_rate(AVFormatContext *s, AdaptationSet *as)
static int webm_dash_manifest_write_header(AVFormatContext *s)
AVCodecContext * codec
Codec context associated with this stream.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
static int webm_dash_manifest_write_trailer(AVFormatContext *s)
static void write_footer(AVFormatContext *s)
int width
picture width / height.
static int write_trailer(AVFormatContext *s1)
static double get_duration(AVFormatContext *s)
static const char * get_codec_name(int codec_id)
static int to_integer(char *p, int len)
static int write_representation(AVFormatContext *s, AVStream *stream, int id, int output_width, int output_height, int output_sample_rate)
enum AVMediaType codec_type
int sample_rate
samples per second
AVIOContext * pb
I/O context.
main external API structure.
Describe the class of an AVClass context structure.
static int check_matching_height(AVFormatContext *s, AdaptationSet *as)
static void write_header(AVFormatContext *s)
void * av_realloc(void *ptr, size_t size)
Allocate or reallocate a block of memory.
void * priv_data
Format private data.
static int write_adaptation_set(AVFormatContext *s, int as_index)
static int bitstream_switching(AVFormatContext *s, AdaptationSet *as)
static int parse_adaptation_sets(AVFormatContext *s)
static int check_matching_width(AVFormatContext *s, AdaptationSet *as)
This structure stores compressed data.
static int write_packet(AVFormatContext *s1, AVPacket *pkt)
int avio_printf(AVIOContext *s, const char *fmt,...) av_printf_format(2