From 2b64eee8d5ed4ab781dcbf98654f028a6d7cef11 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 21 Jun 2015 16:56:35 +0200 Subject: demux: rename sh_stream.format to sh_stream.codec_tag Why not. "format" sounds too misleading for the actual importance and meaning of this field. --- audio/decode/ad_lavc.c | 2 +- demux/codec_tags.c | 4 ++-- demux/demux_disc.c | 2 +- demux/demux_lavf.c | 4 +--- demux/demux_mkv.c | 8 ++++---- demux/demux_raw.c | 2 +- demux/demux_tv.c | 2 +- demux/stheader.h | 2 +- video/decode/vd_lavc.c | 8 ++++---- 9 files changed, 16 insertions(+), 18 deletions(-) diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 5a2392e05a..71824fbfc6 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -116,7 +116,7 @@ static int init(struct dec_audio *da, const char *decoder) mp_set_avopts(da->log, lavc_context, opts->avopts); - lavc_context->codec_tag = sh->format; + lavc_context->codec_tag = sh->codec_tag; lavc_context->sample_rate = sh_audio->samplerate; lavc_context->bit_rate = sh_audio->bitrate; lavc_context->block_align = sh_audio->block_align; diff --git a/demux/codec_tags.c b/demux/codec_tags.c index 9a0e9976c7..0b014276a5 100644 --- a/demux/codec_tags.c +++ b/demux/codec_tags.c @@ -72,11 +72,11 @@ static const char *map_audio_pcm_tag(uint32_t tag, int bits) void mp_set_codec_from_tag(struct sh_stream *sh) { - sh->codec = lookup_tag(sh->type, sh->format); + sh->codec = lookup_tag(sh->type, sh->codec_tag); if (sh->audio && sh->audio->bits_per_coded_sample) { const char *codec = - map_audio_pcm_tag(sh->format, sh->audio->bits_per_coded_sample); + map_audio_pcm_tag(sh->codec_tag, sh->audio->bits_per_coded_sample); if (codec) sh->codec = codec; } diff --git a/demux/demux_disc.c b/demux/demux_disc.c index 3cbd01a9b8..6a9220189c 100644 --- a/demux/demux_disc.c +++ b/demux/demux_disc.c @@ -141,7 +141,7 @@ static void add_streams(demuxer_t *demuxer) MP_TARRAY_APPEND(p, p->streams, p->num_streams, sh); // Copy all stream fields that might be relevant sh->codec = talloc_strdup(sh, src->codec); - sh->format = src->format; + sh->codec_tag = src->codec_tag; sh->lav_headers = src->lav_headers; sh->demuxer_id = src->demuxer_id; if (src->video) { diff --git a/demux/demux_lavf.c b/demux/demux_lavf.c index 943fb1d8af..608bf0e03c 100644 --- a/demux/demux_lavf.c +++ b/demux/demux_lavf.c @@ -521,8 +521,6 @@ static void handle_stream(demuxer_t *demuxer, int i) break; sh_audio_t *sh_audio = sh->audio; - sh->format = codec->codec_tag; - // probably unneeded mp_chmap_set_unknown(&sh_audio->channels, codec->channels); if (codec->channel_layout) @@ -550,7 +548,6 @@ static void handle_stream(demuxer_t *demuxer, int i) } } - sh->format = codec->codec_tag; sh_video->disp_w = codec->width; sh_video->disp_h = codec->height; /* Try to make up some frame rate value, even if it's not reliable. @@ -636,6 +633,7 @@ static void handle_stream(demuxer_t *demuxer, int i) if (sh) { sh->ff_index = st->index; sh->codec = mp_codec_from_av_codec_id(codec->codec_id); + sh->codec_tag = codec->codec_tag; sh->lav_headers = codec; if (st->disposition & AV_DISPOSITION_DEFAULT) diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c index bd76702238..b6474c970f 100644 --- a/demux/demux_mkv.c +++ b/demux/demux_mkv.c @@ -1238,7 +1238,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track) if (track->v_height == 0) track->v_height = AV_RL32(h + 8); // biHeight sh_v->bits_per_coded_sample = AV_RL16(h + 14); // biBitCount - sh->format = AV_RL32(h + 16); // biCompression + sh->codec_tag = AV_RL32(h + 16); // biCompression extradata = track->private_data + 40; extradata_size = track->private_size - 40; @@ -1270,7 +1270,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track) track->parse_timebase = 1e3; } else if (strcmp(track->codec_id, "V_UNCOMPRESSED") == 0) { // raw video, "like AVI" - this is a FourCC - sh->format = track->colorspace; + sh->codec_tag = track->colorspace; sh->codec = "rawvideo"; } else if (strcmp(track->codec_id, "V_QUICKTIME") == 0) { uint32_t fourcc1 = 0, fourcc2 = 0; @@ -1302,7 +1302,7 @@ static int demux_mkv_open_video(demuxer_t *demuxer, mkv_track_t *track) track->parse = true; track->parse_timebase = 1e9; } else if (!strcmp(codec, "mjpeg")) { - sh->format = MP_FOURCC('m', 'j', 'p', 'g'); + sh->codec_tag = MP_FOURCC('m', 'j', 'p', 'g'); } if (extradata_size > 0x1000000) { @@ -1391,7 +1391,7 @@ static int demux_mkv_open_audio(demuxer_t *demuxer, mkv_track_t *track) goto error; MP_VERBOSE(demuxer, "track with MS compat audio.\n"); unsigned char *h = track->private_data; - sh->format = AV_RL16(h + 0); // wFormatTag + sh->codec_tag = AV_RL16(h + 0); // wFormatTag if (track->a_channels == 0) track->a_channels = AV_RL16(h + 2); // nChannels if (sh_a->samplerate == 0) diff --git a/demux/demux_raw.c b/demux/demux_raw.c index 65d6b754be..a67287792b 100644 --- a/demux/demux_raw.c +++ b/demux/demux_raw.c @@ -222,7 +222,7 @@ static int demux_rawvideo_open(demuxer_t *demuxer, enum demux_check check) sh = new_sh_stream(demuxer, STREAM_VIDEO); sh_video = sh->video; sh->codec = decoder; - sh->format = imgfmt; + sh->codec_tag = imgfmt; sh_video->fps = opts->fps; sh_video->disp_w = width; sh_video->disp_h = height; diff --git a/demux/demux_tv.c b/demux/demux_tv.c index 198ca922e5..ab584874cb 100644 --- a/demux/demux_tv.c +++ b/demux/demux_tv.c @@ -60,7 +60,7 @@ static int demux_open_tv(demuxer_t *demuxer, enum demux_check check) sh_v->codec = "mjpeg"; } else { sh_v->codec = "rawvideo"; - sh_v->format = fourcc; + sh_v->codec_tag = fourcc; } /* set FPS and FRAMETIME */ diff --git a/demux/stheader.h b/demux/stheader.h index 444f2f3e34..ae346ee8d0 100644 --- a/demux/stheader.h +++ b/demux/stheader.h @@ -47,7 +47,7 @@ struct sh_stream { const char *codec; // Usually a FourCC, exact meaning depends on codec. - unsigned int format; + unsigned int codec_tag; // Codec specific header data (set by demux_lavf.c only) struct AVCodecContext *lav_headers; diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c index 7c5c4ec8dc..5a106acebc 100644 --- a/video/decode/vd_lavc.c +++ b/video/decode/vd_lavc.c @@ -399,7 +399,7 @@ static void init_avctx(struct dec_video *vd, const char *decoder, // Do this after the above avopt handling in case it changes values ctx->skip_frame = avctx->skip_frame; - avctx->codec_tag = sh->format; + avctx->codec_tag = sh->codec_tag; avctx->coded_width = sh->video->disp_w; avctx->coded_height = sh->video->disp_h; avctx->bits_per_coded_sample = sh->video->bits_per_coded_sample; @@ -407,11 +407,11 @@ static void init_avctx(struct dec_video *vd, const char *decoder, mp_lavc_set_extradata(avctx, sh->video->extradata, sh->video->extradata_len); if (mp_rawvideo) { - avctx->pix_fmt = imgfmt2pixfmt(sh->format); + avctx->pix_fmt = imgfmt2pixfmt(sh->codec_tag); avctx->codec_tag = 0; - if (avctx->pix_fmt == AV_PIX_FMT_NONE && sh->format) + if (avctx->pix_fmt == AV_PIX_FMT_NONE && sh->codec_tag) MP_ERR(vd, "Image format %s not supported by lavc.\n", - mp_imgfmt_to_name(sh->format)); + mp_imgfmt_to_name(sh->codec_tag)); } if (sh->lav_headers) -- cgit v1.2.3