On Tue, Jun 26, 2012 at 10:07 AM, Anton Khirnov <[email protected]> wrote:
> ---
>  libavformat/mov.c |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 49 insertions(+)
>

Is this documented anywhere. I don't see it in the QTFF spec.

> diff --git a/libavformat/mov.c b/libavformat/mov.c
> index 6325401..8434da0 100644
> --- a/libavformat/mov.c
> +++ b/libavformat/mov.c
> @@ -166,6 +166,47 @@ static int mov_read_mac_string(MOVContext *c, 
> AVIOContext *pb, int len,
>     return p - dst;
>  }
>
> +static int mov_read_covr(MOVContext *c, AVIOContext *pb, int type, int len)
> +{
> +    AVPacket pkt;
> +    AVStream *st;
> +    MOVStreamContext *sc;
> +    enum CodecID id;
> +    int ret;
> +
> +    switch (type) {
> +    case 0xd: id = CODEC_ID_MJPEG; break;
> +    case 0xe: id = CODEC_ID_PNG;   break;
> +    default:
> +        av_log(c->fc, AV_LOG_WARNING, "Unknown cover type: 0x%x.\n", type);
> +        avio_skip(pb, len);
> +        return 0;
> +    }
> +

slightly surprised that there is no TIFF option

> +    st = avformat_new_stream(c->fc, NULL);
> +    if (!st)
> +        return AVERROR(ENOMEM);
> +    sc = av_mallocz(sizeof(*sc));
> +    if (!sc)
> +        return AVERROR(ENOMEM);
> +    st->priv_data = sc;
> +
> +    ret = av_get_packet(pb, &pkt, len);
> +    if (ret < 0)
> +        return ret;
> +
> +    st->disposition              |= AV_DISPOSITION_ATTACHED_PIC;
> +
> +    st->attached_pic              = pkt;
> +    st->attached_pic.stream_index = st->index;
> +    st->attached_pic.flags       |= AV_PKT_FLAG_KEY;
> +
> +    st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
> +    st->codec->codec_id   = id;
> +
> +    return 0;
> +}
> +
>  static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
>  {
>  #ifdef MOV_EXPORT_ALL_METADATA
> @@ -224,6 +265,14 @@ static int mov_read_udta_string(MOVContext *c, 
> AVIOContext *pb, MOVAtom atom)
>             avio_rb32(pb); // unknown
>             str_size = data_size - 16;
>             atom.size -= 16;
> +
> +            if (atom.type == MKTAG('c', 'o', 'v', 'r')) {
> +                int ret = mov_read_covr(c, pb, data_type, str_size);
> +                if (ret < 0) {
> +                    av_log(c->fc, AV_LOG_ERROR, "Error parsing cover 
> art.\n");
> +                    return ret;
> +                }
> +            }
>         } else return 0;
>     } else if (atom.size > 4 && key && !c->itunes_metadata) {
>         str_size = avio_rb16(pb); // string length
> --
> 1.7.10
>
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to