[FFmpeg-devel] [PATCH] mxf : allow using codecs RAWVIDEO and V210
Tomas Härdin
tjoppen at acc.umu.se
Wed Aug 4 18:45:00 EEST 2021
> -static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID key)
> +static int64_t mxf_write_generic_desc(AVFormatContext *s, AVStream *st, const UID key)
> {
> MXFStreamContext *sc = st->priv_data;
> AVIOContext *pb = s->pb;
> @@ -1115,7 +1133,7 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID
> const MXFCodecUL *color_primaries_ul;
> const MXFCodecUL *color_trc_ul;
> const MXFCodecUL *color_space_ul;
> - int64_t pos = mxf_write_generic_desc(s, st, key);
> + int64_t pos = mxf_write_file_desc(s, st, key);
> uint8_t *side_data;
>
> color_primaries_ul = mxf_get_codec_ul_by_id(ff_mxf_color_primaries_uls, st->codecpar->color_primaries);
> @@ -1131,6 +1149,8 @@ static int64_t mxf_write_cdci_common(AVFormatContext *s, AVStream *st, const UID
> if (!stored_width)
> stored_width = (st->codecpar->width+15)/16*16;
>
> + // TODO: V210 ==> Stored Width shall be a multiple of 48.
This needs to be fixed before this can be pushed. I don't want
incorrect code in master.
> mxf_write_local_tag(s, 4, 0x3203);
> avio_wb32(pb, stored_width);
> @@ -1432,7 +1486,7 @@ static int64_t mxf_write_generic_sound_common(AVFormatContext *s, AVStream *st,
> AVIOContext *pb = s->pb;
> MXFContext *mxf = s->priv_data;
> int show_warnings = !mxf->footer_partition_offset;
> - int64_t pos = mxf_write_generic_desc(s, st, key);
> + int64_t pos = mxf_write_file_desc(s, st, key);
>
> if (s->oformat == &ff_mxf_opatom_muxer) {
> mxf_write_local_tag(s, 8, 0x3002);
> @@ -2348,6 +2402,42 @@ static int mxf_parse_h264_frame(AVFormatContext *s, AVStream *st,
> return 1;
> }
>
> +static int mxf_parse_raw_frame(AVFormatContext *s, AVStream *st,
> + AVPacket *pkt, MXFIndexEntry *e)
> +{
> + MXFContext *mxf = s->priv_data;
> + MXFStreamContext *sc = st->priv_data;
> + const MXFCodecUL* uls = ff_mxf_pixel_format_uls;
> + const char* pixelLayoutData = NULL;
> + int format;
> +
> + if (mxf->header_written)
> + return 1;
> +
> + format = st->codecpar->format;
> +
> + if(ff_mxf_find_pixel_layout(&pixelLayoutData, format) < 0)
> + {
> + while (uls->uid[0]) {
> + if (format == uls->id) {
> + sc->codec_ul = &uls->uid;
> + break;
> + }
> + uls++;
> + }
Don't we have a function for these kinds of lookups?
/Tomas
More information about the ffmpeg-devel
mailing list