diff options
Diffstat (limited to 'libmpdemux')
-rw-r--r-- | libmpdemux/demux_lavf.c | 12 | ||||
-rw-r--r-- | libmpdemux/demuxer.c | 30 | ||||
-rw-r--r-- | libmpdemux/stheader.h | 2 |
3 files changed, 17 insertions, 27 deletions
diff --git a/libmpdemux/demux_lavf.c b/libmpdemux/demux_lavf.c index 62cb0bad1b..68dd218ad7 100644 --- a/libmpdemux/demux_lavf.c +++ b/libmpdemux/demux_lavf.c @@ -310,6 +310,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) break; stream_type = "audio"; priv->astreams[priv->audio_streams] = i; + sh_audio->libav_codec_id = codec->codec_id; wf = calloc(sizeof(*wf) + codec->extradata_size, 1); // mp4a tag is used for all mp4 files no matter what they actually contain if (codec->codec_tag == MKTAG('m', 'p', '4', 'a')) @@ -387,6 +388,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) break; stream_type = "video"; priv->vstreams[priv->video_streams] = i; + sh_video->libav_codec_id = codec->codec_id; bih = calloc(sizeof(*bih) + codec->extradata_size, 1); if (codec->codec_id == CODEC_ID_RAWVIDEO) { @@ -398,9 +400,14 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) } if (!codec->codec_tag) codec->codec_tag = avcodec_pix_fmt_to_codec_tag(codec->pix_fmt); - } - if (!codec->codec_tag) + } else if (!codec->codec_tag) { codec->codec_tag = mp_taglist_video(codec->codec_id); + /* 0 might mean either unset or rawvideo; if codec_id + * was not RAWVIDEO assume it's unset + */ + if (!codec->codec_tag) + codec->codec_tag = -1; + } bih->biSize = sizeof(*bih) + codec->extradata_size; bih->biWidth = codec->width; bih->biHeight = codec->height; @@ -492,6 +499,7 @@ static void handle_stream(demuxer_t *demuxer, AVFormatContext *avfc, int i) break; stream_type = "subtitle"; priv->sstreams[priv->sub_streams] = i; + sh_sub->libav_codec_id = codec->codec_id; sh_sub->type = type; if (codec->extradata_size) { sh_sub->extradata = malloc(codec->extradata_size); diff --git a/libmpdemux/demuxer.c b/libmpdemux/demuxer.c index 0ff734b074..8691880fe1 100644 --- a/libmpdemux/demuxer.c +++ b/libmpdemux/demuxer.c @@ -998,11 +998,8 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, if (!desc) // should only happen with obsolete -demuxer 99 numeric format return NULL; - demuxer = open_given_type(opts, desc, stream, force, audio_id, - video_id, sub_id, filename, params); - if (demuxer) - goto dmx_open; - return NULL; + return open_given_type(opts, desc, stream, force, audio_id, + video_id, sub_id, filename, params); } // Test demuxers with safe file checks @@ -1011,7 +1008,7 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, demuxer = open_given_type(opts, desc, stream, false, audio_id, video_id, sub_id, filename, params); if (demuxer) - goto dmx_open; + return demuxer; } } @@ -1024,7 +1021,7 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, demuxer = open_given_type(opts, desc, stream, false, audio_id, video_id, sub_id, filename, params); if (demuxer) - goto dmx_open; + return demuxer; } // Finally try detection for demuxers with unsafe checks @@ -1033,28 +1030,11 @@ static struct demuxer *demux_open_stream(struct MPOpts *opts, demuxer = open_given_type(opts, desc, stream, false, audio_id, video_id, sub_id, filename, params); if (demuxer) - goto dmx_open; + return demuxer; } } return NULL; - - dmx_open: - - if (demuxer->type == DEMUXER_TYPE_PLAYLIST) - return demuxer; - - struct sh_video *sh_video = demuxer->video->sh; - if (sh_video && sh_video->bih) { - int biComp = le2me_32(sh_video->bih->biCompression); - mp_msg(MSGT_DEMUX, MSGL_INFO, - "VIDEO: [%.4s] %dx%d %dbpp %5.3f fps %5.1f kbps (%4.1f kbyte/s)\n", - (char *) &biComp, sh_video->bih->biWidth, - sh_video->bih->biHeight, sh_video->bih->biBitCount, - sh_video->fps, sh_video->i_bps * 0.008f, - sh_video->i_bps / 1024.0f); - } - return demuxer; } struct demuxer *demux_open(struct MPOpts *opts, stream_t *vs, int file_format, diff --git a/libmpdemux/stheader.h b/libmpdemux/stheader.h index 06f52324e5..58390650b2 100644 --- a/libmpdemux/stheader.h +++ b/libmpdemux/stheader.h @@ -33,6 +33,7 @@ struct demuxer; struct demux_stream *ds; \ struct codecs *codec; \ unsigned int format; \ + int libav_codec_id; \ int initialized; \ /* number of seconds stream should be delayed \ * (according to dwStart or similar) */ \ @@ -46,6 +47,7 @@ struct demuxer; double pts; \ /* decoder context */ \ void *context; \ + const char *codecname; \ char *lang; /* track language */ \ char *title; /* track title */ \ bool default_track; \ |