summaryrefslogtreecommitdiff
path: root/libavformat/utils.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c108
1 files changed, 54 insertions, 54 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 5b26c59bc6..435ffc1c68 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -208,7 +208,7 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
#if CONFIG_IMAGE2_MUXER
if (!short_name && filename &&
av_filename_number_test(filename) &&
- ff_guess_image2_codec(filename) != CODEC_ID_NONE) {
+ ff_guess_image2_codec(filename) != AV_CODEC_ID_NONE) {
return av_guess_format("image2", NULL, NULL);
}
#endif
@@ -233,17 +233,17 @@ AVOutputFormat *av_guess_format(const char *short_name, const char *filename,
return fmt_found;
}
-enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
+enum AVCodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
const char *filename, const char *mime_type, enum AVMediaType type){
if(type == AVMEDIA_TYPE_VIDEO){
- enum CodecID codec_id= CODEC_ID_NONE;
+ enum AVCodecID codec_id= AV_CODEC_ID_NONE;
#if CONFIG_IMAGE2_MUXER
if(!strcmp(fmt->name, "image2") || !strcmp(fmt->name, "image2pipe")){
codec_id= ff_guess_image2_codec(filename);
}
#endif
- if(codec_id == CODEC_ID_NONE)
+ if(codec_id == AV_CODEC_ID_NONE)
codec_id= fmt->video_codec;
return codec_id;
}else if(type == AVMEDIA_TYPE_AUDIO)
@@ -251,7 +251,7 @@ enum CodecID av_guess_codec(AVOutputFormat *fmt, const char *short_name,
else if (type == AVMEDIA_TYPE_SUBTITLE)
return fmt->subtitle_codec;
else
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
AVInputFormat *av_find_input_format(const char *short_name)
@@ -367,16 +367,16 @@ AVInputFormat *av_probe_input_format(AVProbeData *pd, int is_opened){
static int set_codec_from_probe_data(AVFormatContext *s, AVStream *st, AVProbeData *pd, int score)
{
static const struct {
- const char *name; enum CodecID id; enum AVMediaType type;
+ const char *name; enum AVCodecID id; enum AVMediaType type;
} fmt_id_type[] = {
- { "aac" , CODEC_ID_AAC , AVMEDIA_TYPE_AUDIO },
- { "ac3" , CODEC_ID_AC3 , AVMEDIA_TYPE_AUDIO },
- { "dts" , CODEC_ID_DTS , AVMEDIA_TYPE_AUDIO },
- { "eac3" , CODEC_ID_EAC3 , AVMEDIA_TYPE_AUDIO },
- { "h264" , CODEC_ID_H264 , AVMEDIA_TYPE_VIDEO },
- { "m4v" , CODEC_ID_MPEG4 , AVMEDIA_TYPE_VIDEO },
- { "mp3" , CODEC_ID_MP3 , AVMEDIA_TYPE_AUDIO },
- { "mpegvideo", CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
+ { "aac" , AV_CODEC_ID_AAC , AVMEDIA_TYPE_AUDIO },
+ { "ac3" , AV_CODEC_ID_AC3 , AVMEDIA_TYPE_AUDIO },
+ { "dts" , AV_CODEC_ID_DTS , AVMEDIA_TYPE_AUDIO },
+ { "eac3" , AV_CODEC_ID_EAC3 , AVMEDIA_TYPE_AUDIO },
+ { "h264" , AV_CODEC_ID_H264 , AVMEDIA_TYPE_VIDEO },
+ { "m4v" , AV_CODEC_ID_MPEG4 , AVMEDIA_TYPE_VIDEO },
+ { "mp3" , AV_CODEC_ID_MP3 , AVMEDIA_TYPE_AUDIO },
+ { "mpegvideo", AV_CODEC_ID_MPEG2VIDEO, AVMEDIA_TYPE_VIDEO },
{ 0 }
};
AVInputFormat *fmt = av_probe_input_format2(pd, 1, &score);
@@ -613,7 +613,7 @@ fail:
static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
{
- if(st->codec->codec_id == CODEC_ID_PROBE){
+ if(st->codec->codec_id == AV_CODEC_ID_PROBE){
AVProbeData *pd = &st->probe_data;
av_log(s, AV_LOG_DEBUG, "probing stream %d\n", st->index);
--st->probe_packets;
@@ -630,7 +630,7 @@ static void probe_codec(AVFormatContext *s, AVStream *st, const AVPacket *pkt)
if (!st->probe_packets ||
av_log2(pd->buf_size) != av_log2(pd->buf_size - pkt->size)) {
set_codec_from_probe_data(s, st, pd, st->probe_packets > 0 ? AVPROBE_SCORE_MAX/4 : 0);
- if(st->codec->codec_id != CODEC_ID_PROBE){
+ if(st->codec->codec_id != AV_CODEC_ID_PROBE){
pd->buf_size=0;
av_freep(&pd->buf);
av_log(s, AV_LOG_DEBUG, "probed stream %d\n", st->index);
@@ -650,7 +650,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
if (pktl) {
*pkt = pktl->pkt;
st = s->streams[pkt->stream_index];
- if (st->codec->codec_id != CODEC_ID_PROBE || !st->probe_packets ||
+ if (st->codec->codec_id != AV_CODEC_ID_PROBE || !st->probe_packets ||
s->raw_packet_buffer_remaining_size < pkt->size) {
AVProbeData *pd;
if (st->probe_packets) {
@@ -703,7 +703,7 @@ int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
break;
}
- if(!pktl && (st->codec->codec_id != CODEC_ID_PROBE ||
+ if(!pktl && (st->codec->codec_id != AV_CODEC_ID_PROBE ||
!st->probe_packets))
return ret;
@@ -794,20 +794,20 @@ static int is_intra_only(AVCodecContext *enc){
return 1;
}else if(enc->codec_type == AVMEDIA_TYPE_VIDEO){
switch(enc->codec_id){
- case CODEC_ID_MJPEG:
- case CODEC_ID_MJPEGB:
- case CODEC_ID_LJPEG:
- case CODEC_ID_PRORES:
- case CODEC_ID_RAWVIDEO:
- case CODEC_ID_DVVIDEO:
- case CODEC_ID_HUFFYUV:
- case CODEC_ID_FFVHUFF:
- case CODEC_ID_ASV1:
- case CODEC_ID_ASV2:
- case CODEC_ID_VCR1:
- case CODEC_ID_DNXHD:
- case CODEC_ID_JPEG2000:
- case CODEC_ID_MDEC:
+ case AV_CODEC_ID_MJPEG:
+ case AV_CODEC_ID_MJPEGB:
+ case AV_CODEC_ID_LJPEG:
+ case AV_CODEC_ID_PRORES:
+ case AV_CODEC_ID_RAWVIDEO:
+ case AV_CODEC_ID_DVVIDEO:
+ case AV_CODEC_ID_HUFFYUV:
+ case AV_CODEC_ID_FFVHUFF:
+ case AV_CODEC_ID_ASV1:
+ case AV_CODEC_ID_ASV2:
+ case AV_CODEC_ID_VCR1:
+ case AV_CODEC_ID_DNXHD:
+ case AV_CODEC_ID_JPEG2000:
+ case AV_CODEC_ID_MDEC:
return 1;
default: break;
}
@@ -964,7 +964,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
// av_log(NULL, AV_LOG_DEBUG, "IN delayed:%d pts:%"PRId64", dts:%"PRId64" cur_dts:%"PRId64" st:%d pc:%p\n", presentation_delayed, pkt->pts, pkt->dts, st->cur_dts, pkt->stream_index, pc);
/* interpolate PTS and DTS if they are not present */
//We skip H264 currently because delay and has_b_frames are not reliably set
- if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != CODEC_ID_H264){
+ if((delay==0 || (delay==1 && pc)) && st->codec->codec_id != AV_CODEC_ID_H264){
if (presentation_delayed) {
/* DTS = decompression timestamp */
/* PTS = presentation timestamp */
@@ -1024,7 +1024,7 @@ static void compute_pkt_fields(AVFormatContext *s, AVStream *st,
FFSWAP(int64_t, st->pts_buffer[i], st->pts_buffer[i+1]);
if(pkt->dts == AV_NOPTS_VALUE)
pkt->dts= st->pts_buffer[0];
- if(st->codec->codec_id == CODEC_ID_H264){ // we skipped it above so we try here
+ if(st->codec->codec_id == AV_CODEC_ID_H264){ // we skipped it above so we try here
update_initial_timestamps(s, pkt->stream_index, pkt->dts, pkt->pts); // this should happen on the first packet
}
if(pkt->dts > st->cur_dts)
@@ -2079,12 +2079,12 @@ static int has_codec_parameters(AVStream *st)
val = 1;
break;
}
- return avctx->codec_id != CODEC_ID_NONE && val != 0;
+ return avctx->codec_id != AV_CODEC_ID_NONE && val != 0;
}
static int has_decode_delay_been_guessed(AVStream *st)
{
- return st->codec->codec_id != CODEC_ID_H264 ||
+ return st->codec->codec_id != AV_CODEC_ID_H264 ||
st->info->nb_decoded_frames >= 6;
}
@@ -2153,9 +2153,9 @@ static int try_decode_frame(AVStream *st, AVPacket *avpkt, AVDictionary **option
return ret;
}
-unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum CodecID id)
+unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum AVCodecID id)
{
- while (tags->id != CODEC_ID_NONE) {
+ while (tags->id != AV_CODEC_ID_NONE) {
if (tags->id == id)
return tags->tag;
tags++;
@@ -2163,21 +2163,21 @@ unsigned int ff_codec_get_tag(const AVCodecTag *tags, enum CodecID id)
return 0;
}
-enum CodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
+enum AVCodecID ff_codec_get_id(const AVCodecTag *tags, unsigned int tag)
{
int i;
- for(i=0; tags[i].id != CODEC_ID_NONE;i++) {
+ for(i=0; tags[i].id != AV_CODEC_ID_NONE;i++) {
if(tag == tags[i].tag)
return tags[i].id;
}
- for(i=0; tags[i].id != CODEC_ID_NONE; i++) {
+ for(i=0; tags[i].id != AV_CODEC_ID_NONE; i++) {
if (avpriv_toupper4(tag) == avpriv_toupper4(tags[i].tag))
return tags[i].id;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
-unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum CodecID id)
+unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum AVCodecID id)
{
int i;
for(i=0; tags && tags[i]; i++){
@@ -2187,14 +2187,14 @@ unsigned int av_codec_get_tag(const AVCodecTag * const *tags, enum CodecID id)
return 0;
}
-enum CodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
+enum AVCodecID av_codec_get_id(const AVCodecTag * const *tags, unsigned int tag)
{
int i;
for(i=0; tags && tags[i]; i++){
- enum CodecID id= ff_codec_get_id(tags[i], tag);
- if(id!=CODEC_ID_NONE) return id;
+ enum AVCodecID id= ff_codec_get_id(tags[i], tag);
+ if(id!=AV_CODEC_ID_NONE) return id;
}
- return CODEC_ID_NONE;
+ return AV_CODEC_ID_NONE;
}
static void compute_chapters_end(AVFormatContext *s)
@@ -2236,8 +2236,8 @@ static int tb_unreliable(AVCodecContext *c){
|| c->time_base.den < 5L*c->time_base.num
/* || c->codec_tag == AV_RL32("DIVX")
|| c->codec_tag == AV_RL32("XVID")*/
- || c->codec_id == CODEC_ID_MPEG2VIDEO
- || c->codec_id == CODEC_ID_H264
+ || c->codec_id == AV_CODEC_ID_MPEG2VIDEO
+ || c->codec_id == AV_CODEC_ID_H264
)
return 1;
return 0;
@@ -2820,7 +2820,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st)
{
const AVCodecTag *avctag;
int n;
- enum CodecID id = CODEC_ID_NONE;
+ enum AVCodecID id = AV_CODEC_ID_NONE;
unsigned int tag = 0;
/**
@@ -2831,7 +2831,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st)
*/
for (n = 0; s->oformat->codec_tag[n]; n++) {
avctag = s->oformat->codec_tag[n];
- while (avctag->id != CODEC_ID_NONE) {
+ while (avctag->id != AV_CODEC_ID_NONE) {
if (avpriv_toupper4(avctag->tag) == avpriv_toupper4(st->codec->codec_tag)) {
id = avctag->id;
if (id == st->codec->codec_id)
@@ -2842,7 +2842,7 @@ static int validate_codec_tag(AVFormatContext *s, AVStream *st)
avctag++;
}
}
- if (id != CODEC_ID_NONE)
+ if (id != AV_CODEC_ID_NONE)
return 0;
if (tag && (st->codec->strict_std_compliance >= FF_COMPLIANCE_NORMAL))
return 0;
@@ -2905,7 +2905,7 @@ int avformat_write_header(AVFormatContext *s, AVDictionary **options)
}
if(s->oformat->codec_tag){
- if(st->codec->codec_tag && st->codec->codec_id == CODEC_ID_RAWVIDEO && av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id) == 0 && !validate_codec_tag(s, st)){
+ if(st->codec->codec_tag && st->codec->codec_id == AV_CODEC_ID_RAWVIDEO && av_codec_get_tag(s->oformat->codec_tag, st->codec->codec_id) == 0 && !validate_codec_tag(s, st)){
//the current rawvideo encoding system ends up setting the wrong codec_tag for avi, we override it here
st->codec->codec_tag= 0;
}
@@ -3927,7 +3927,7 @@ int64_t ff_iso8601_to_unix_time(const char *datestr)
#endif
}
-int avformat_query_codec(AVOutputFormat *ofmt, enum CodecID codec_id, int std_compliance)
+int avformat_query_codec(AVOutputFormat *ofmt, enum AVCodecID codec_id, int std_compliance)
{
if (ofmt) {
if (ofmt->query_codec)