codec_flush_buffers,
};
+#if 0
static AVCodecParserContext *maru_brill_codec_parser_init(AVCodecContext *avctx);
+#endif
static void maru_brill_codec_push_readqueue(MaruBrillCodecState *s, CodecParam *ioparam);
static void maru_brill_codec_push_writequeue(MaruBrillCodecState *s, void* opaque,
{
uint8_t *parser_outbuf = NULL;
int parser_outbuf_size = 0;
- uint8_t *parser_buf = packet->data;
- int parser_buf_size = packet->size;
+ uint8_t *parser_inbuf = packet->data;
+ int parser_inbuf_size = packet->size;
int ret = 0, len = -1;
int64_t pts = 0, dts = 0, pos = 0;
do {
if (pctx) {
+ TRACE("before parsing parser_inbuf_size %d pts %lld\n", parser_inbuf_size, pctx->pts);
+
ret = av_parser_parse2(pctx, avctx, &parser_outbuf,
- &parser_outbuf_size, parser_buf, parser_buf_size,
+ &parser_outbuf_size, parser_inbuf, parser_inbuf_size,
pts, dts, pos);
- if (ret) {
- parser_buf_size -= ret;
- parser_buf += ret;
+ if (ret > 0) {
+ parser_inbuf_size -= ret;
+ parser_inbuf += ret;
}
- TRACE("after parsing ret: %d parser_outbuf_size %d parser_buf_size %d pts %lld\n",
- ret, parser_outbuf_size, parser_buf_size, pctx->pts);
+ TRACE("after parsing ret: %d parser_outbuf_size %d parser_inbuf_size %d pts %lld\n",
+ ret, parser_outbuf_size, parser_inbuf_size, pctx->pts);
/* if there is no output, we must break and wait for more data.
* also the timestamp in the context is not updated.
*/
if (parser_outbuf_size == 0) {
- if (parser_buf_size > 0) {
+ if (parser_inbuf_size > 0) {
TRACE("parsing data have been left\n");
continue;
} else {
TRACE("not using parser %s\n", avctx->codec->name);
}
+ TRACE("before decode_video inbuf %p inbuf_size %d\n", packet->data, packet->size);
len = avcodec_decode_video2(avctx, picture, got_picture, packet);
+
TRACE("decode_video. len %d, got_picture %d\n", len, *got_picture);
if (!pctx) {
if (len == 0 && (*got_picture) == 0) {
- INFO("decoding video 1! didn't return any data! ctx_id %d len %d\n", ctx_id, len);
+ INFO("decoding video w/o parser didn't return any data! ctx_id %d len %d\n", ctx_id, len);
break;
} else if (len < 0) {
- ERR("decoding video error! ctx_id %d len %d\n", ctx_id, len);
+ ERR("decoding video w/o parser. ctx_id %d len %d\n", ctx_id, len);
break;
}
- parser_buf_size -= len;
- parser_buf += len;
+ parser_inbuf_size -= len;
+ parser_inbuf += len;
} else {
if (len == 0) {
- INFO("decoding video 2! didn't return any data! ctx_id %d len %d\n", ctx_id, len);
+ INFO("decoding video w/ parser didn't return any data! ctx_id %d len %d\n", ctx_id, len);
*got_picture = 0;
break;
} else if (len < 0) {
- ERR("decoding video error! trying next ctx_id %d len %d\n", ctx_id, len);
+ ERR("decoding video w/ parser. ctx_id %d len %d\n", ctx_id, len);
break;
}
}
- TRACE("decoding video. parser_buf_size %d\n", parser_buf_size);
- } while (parser_buf_size > 0);
+ TRACE("decoding video. parser_buf_size %d\n", parser_inbuf_size);
+ } while (parser_inbuf_size > 0);
return len;
}
+ sizeof(avctx->extradata_size) + avctx->extradata_size) + sizeof(int);
CONTEXT(s, ctx_id).opened_context = true;
- CONTEXT(s, ctx_id).parser_ctx = maru_brill_codec_parser_init(avctx);
+ // CONTEXT(s, ctx_id).parser_ctx = maru_brill_codec_parser_init(avctx);
} else {
ERR("failed to find codec. ctx_id: %d\n", ctx_id);
ret = -1;
ret = false;
} else {
TRACE("flush %d context of buffers.\n", ctx_id);
+
AVCodecParserContext *pctx = NULL;
uint8_t *poutbuf = NULL;
int poutbuf_size = 0;
if (pctx) {
res = av_parser_parse2(pctx, avctx, &poutbuf, &poutbuf_size,
p_inbuf, p_inbuf_size, -1, -1, -1);
- TRACE("before flush buffers, using parser. res: %d\n", res);
+ TRACE("after flush buffers, using parser. res: %d\n", res);
}
avcodec_flush_buffers(avctx);
return true;
}
+#if 0
static AVCodecParserContext *maru_brill_codec_parser_init(AVCodecContext *avctx)
{
AVCodecParserContext *parser = NULL;
return parser;
}
+#endif