static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)

{

    char mime[1024];

    char description[1024];

    unsigned int filesize;

    AVStream *st;

    int64_t pos = avio_tell(pb);



    avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));

    if (strcmp(mime, "image/jpeg"))

        goto done;



    avio_r8(pb);

    avio_get_str16le(pb, INT_MAX, description, sizeof(description));

    filesize = avio_rl32(pb);

    if (!filesize)

        goto done;



    st = avformat_new_stream(s, NULL);

    if (!st)

        goto done;

    av_dict_set(&st->metadata, "title", description, 0);

    st->codec->codec_id   = AV_CODEC_ID_MJPEG;

    st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;

    st->codec->extradata  = av_mallocz(filesize);


    if (!st->codec->extradata)

        goto done;

    st->codec->extradata_size = filesize;

    avio_read(pb, st->codec->extradata, filesize);

done:

    avio_seek(pb, pos + length, SEEK_SET);

}
static void get_attachment(AVFormatContext *s, AVIOContext *pb, int length)

{

    char mime[1024];

    char description[1024];

    unsigned int filesize;

    AVStream *st;

    int64_t pos = avio_tell(pb);



    avio_get_str16le(pb, INT_MAX, mime, sizeof(mime));

    if (strcmp(mime, "image/jpeg"))

        goto done;



    avio_r8(pb);

    avio_get_str16le(pb, INT_MAX, description, sizeof(description));

    filesize = avio_rl32(pb);

    if (!filesize)

        goto done;



    st = avformat_new_stream(s, NULL);

    if (!st)

        goto done;

    av_dict_set(&st->metadata, "title", description, 0);

    st->codec->codec_id   = AV_CODEC_ID_MJPEG;

    st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;

    st->codec->extradata  = av_mallocz(filesize);


    if (!st->codec->extradata)

        goto done;

    st->codec->extradata_size = filesize;

    avio_read(pb, st->codec->extradata, filesize);

done:

    avio_seek(pb, pos + length, SEEK_SET);

}
static void FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, int VAR_2)

{

    char VAR_3[1024];

    char VAR_4[1024];

    unsigned int VAR_5;

    AVStream *st;

    int64_t pos = avio_tell(VAR_1);



    avio_get_str16le(VAR_1, INT_MAX, VAR_3, sizeof(VAR_3));

    if (strcmp(VAR_3, "image/jpeg"))

        goto done;



    avio_r8(VAR_1);

    avio_get_str16le(VAR_1, INT_MAX, VAR_4, sizeof(VAR_4));

    VAR_5 = avio_rl32(VAR_1);

    if (!VAR_5)

        goto done;



    st = avformat_new_stream(VAR_0, NULL);

    if (!st)

        goto done;

    av_dict_set(&st->metadata, "title", VAR_4, 0);

    st->codec->codec_id   = AV_CODEC_ID_MJPEG;

    st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT;

    st->codec->extradata  = av_mallocz(VAR_5);


    if (!st->codec->extradata)

        goto done;

    st->codec->extradata_size = VAR_5;

    avio_read(VAR_1, st->codec->extradata, VAR_5);

done:

    avio_seek(VAR_1, pos + VAR_2, SEEK_SET);

}
static void FUNC_0(AVFormatContext *VAR_0, AVIOContext *VAR_1, int VAR_2)
{ char VAR_3[1024]; char VAR_4[1024]; unsigned int VAR_5; AVStream *st; int64_t pos = avio_tell(VAR_1); avio_get_str16le(VAR_1, INT_MAX, VAR_3, sizeof(VAR_3)); if (strcmp(VAR_3, "image/jpeg"))
goto done; avio_r8(VAR_1); avio_get_str16le(VAR_1, INT_MAX, VAR_4, sizeof(VAR_4)); VAR_5 = avio_rl32(VAR_1); if (!VAR_5)
goto done; st = avformat_new_stream(VAR_0, NULL); if (!st)
goto done; av_dict_set(&st->metadata, "title", VAR_4, 0); st->codec->codec_id   = AV_CODEC_ID_MJPEG; st->codec->codec_type = AVMEDIA_TYPE_ATTACHMENT; st->codec->extradata  = av_mallocz(VAR_5); if (!st->codec->extradata)
goto done; st->codec->extradata_size = VAR_5; avio_read(VAR_1, st->codec->extradata, VAR_5); done:
avio_seek(VAR_1, pos + VAR_2, SEEK_SET); }