static int read_packet(AVFormatContext *s, AVPacket *pkt)

{

    ASSContext *ass = s->priv_data;

    uint8_t *p, *end;



    if (ass->event_index >= ass->event_count)

        return AVERROR(EIO);



    p = ass->event[ass->event_index];



    end = strchr(p, '\n');

    av_new_packet(pkt, end ? end - p + 1 : strlen(p));

    pkt->flags |= AV_PKT_FLAG_KEY;

    pkt->pos    = p - ass->event_buffer + s->streams[0]->codec->extradata_size;

    pkt->pts    = pkt->dts = get_pts(p);

    memcpy(pkt->data, p, pkt->size);



    ass->event_index++;



    return 0;

}

static int read_packet(AVFormatContext *s, AVPacket *pkt)

{

    ASSContext *ass = s->priv_data;

    uint8_t *p, *end;



    if (ass->event_index >= ass->event_count)

        return AVERROR(EIO);



    p = ass->event[ass->event_index];



    end = strchr(p, '\n');

    av_new_packet(pkt, end ? end - p + 1 : strlen(p));

    pkt->flags |= AV_PKT_FLAG_KEY;

    pkt->pos    = p - ass->event_buffer + s->streams[0]->codec->extradata_size;

    pkt->pts    = pkt->dts = get_pts(p);

    memcpy(pkt->data, p, pkt->size);



    ass->event_index++;



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)

{

    ASSContext *ass = VAR_0->priv_data;

    uint8_t *p, *end;



    if (ass->event_index >= ass->event_count)

        return AVERROR(EIO);



    p = ass->event[ass->event_index];



    end = strchr(p, '\n');

    av_new_packet(VAR_1, end ? end - p + 1 : strlen(p));

    VAR_1->flags |= AV_PKT_FLAG_KEY;

    VAR_1->pos    = p - ass->event_buffer + VAR_0->streams[0]->codec->extradata_size;

    VAR_1->pts    = VAR_1->dts = get_pts(p);

    memcpy(VAR_1->data, p, VAR_1->size);



    ass->event_index++;



    return 0;

}

static int FUNC_0(AVFormatContext *VAR_0, AVPacket *VAR_1)
{ ASSContext *ass = VAR_0->priv_data; uint8_t *p, *end; if (ass->event_index >= ass->event_count)
return AVERROR(EIO); p = ass->event[ass->event_index]; end = strchr(p, '\n'); av_new_packet(VAR_1, end ? end - p + 1 : strlen(p)); VAR_1->flags |= AV_PKT_FLAG_KEY; VAR_1->pos    = p - ass->event_buffer + VAR_0->streams[0]->codec->extradata_size; VAR_1->pts    = VAR_1->dts = get_pts(p); memcpy(VAR_1->data, p, VAR_1->size); ass->event_index++; return 0; }