On Mon, Feb 24, 2014 at 12:39 PM, Diego Biurrun <[email protected]> wrote:
> From: Luca Barbato <[email protected]>
>
> Signed-off-by: Diego Biurrun <[email protected]>
> ---
> libavcodec/parser.c | 216
> ++++++++++++++++++++++++++-------------------------
> 1 file changed, 111 insertions(+), 105 deletions(-)
>
> - if (s->fetch_timestamp){
> - s->fetch_timestamp=0;
> - s->last_pts = s->pts;
> - s->last_dts = s->dts;
> - s->last_pos = s->pos;
> + if (s->fetch_timestamp) {
> + s->fetch_timestamp = 0;
> + s->last_pts = s->pts;
> + s->last_dts = s->dts;
> + s->last_pos = s->pos;
> ff_fetch_timestamp(s, 0, 0);
> }
> -
you could leave the space here
> /* WARNING: the returned index can be negative */
> - index = s->parser->parser_parse(s, avctx, (const uint8_t **)poutbuf,
> poutbuf_size, buf, buf_size);
> + index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf,
imho no space between ) and poutbuf
> + poutbuf_size, buf, buf_size);
> /* update the file pointer */
> if (*poutbuf_size) {
> /* fill the data for the current frame */
> @@ -160,7 +164,7 @@ int av_parser_parse2(AVCodecParserContext *s,
>
> /* offset of the next frame */
> s->next_frame_offset = s->cur_offset + index;
> - s->fetch_timestamp=1;
> + s->fetch_timestamp = 1;
> }
> if (index < 0)
> index = 0;
> @@ -168,32 +172,35 @@ int av_parser_parse2(AVCodecParserContext *s,
> return index;
> }
>
> -int av_parser_change(AVCodecParserContext *s,
> - AVCodecContext *avctx,
> +int av_parser_change(AVCodecParserContext *s, AVCodecContext *avctx,
> uint8_t **poutbuf, int *poutbuf_size,
> - const uint8_t *buf, int buf_size, int keyframe){
> -
> - if(s && s->parser->split){
> - if((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) || (avctx->flags2 &
> CODEC_FLAG2_LOCAL_HEADER)){
> - int i= s->parser->split(avctx, buf, buf_size);
> - buf += i;
> + const uint8_t *buf, int buf_size, int keyframe)
> +{
> + if (s && s->parser->split) {
> + if ((avctx->flags & CODEC_FLAG_GLOBAL_HEADER) ||
> + (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER)) {
> + int i = s->parser->split(avctx, buf, buf_size);
> + buf += i;
> buf_size -= i;
> }
> }
>
> /* cast to avoid warning about discarding qualifiers */
> - *poutbuf= (uint8_t *) buf;
> - *poutbuf_size= buf_size;
> - if(avctx->extradata){
> - if( (keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
> - /*||(s->pict_type != AV_PICTURE_TYPE_I && (s->flags &
> PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY))*/
> - /*||(? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN)*/){
> - int size= buf_size + avctx->extradata_size;
> - *poutbuf_size= size;
> - *poutbuf= av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
> + *poutbuf = (uint8_t *) buf;
> + *poutbuf_size = buf_size;
> + if (avctx->extradata) {
> + if ((keyframe && (avctx->flags2 & CODEC_FLAG2_LOCAL_HEADER))
> + /* || (s->pict_type != AV_PICTURE_TYPE_I && (s->flags &
> PARSER_FLAG_DUMP_EXTRADATA_AT_NOKEY)) */
> + /* || (? && (s->flags & PARSER_FLAG_DUMP_EXTRADATA_AT_BEGIN) */)
> {
> + int size = buf_size + avctx->extradata_size;
> +
> + *poutbuf_size = size;
> + *poutbuf = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
>
> memcpy(*poutbuf, avctx->extradata, avctx->extradata_size);
> - memcpy((*poutbuf) + avctx->extradata_size, buf, buf_size +
> FF_INPUT_BUFFER_PADDING_SIZE);
> + memcpy((*poutbuf) + avctx->extradata_size,
> + buf,
> + buf_size + FF_INPUT_BUFFER_PADDING_SIZE);
> return 1;
> }
> }
> @@ -203,7 +210,7 @@ int av_parser_change(AVCodecParserContext *s,
>
> void av_parser_close(AVCodecParserContext *s)
> {
> - if(s){
> + if (s) {
> if (s->parser->parser_close)
> s->parser->parser_close(s);
> av_free(s->priv_data);
> @@ -211,33 +218,33 @@ void av_parser_close(AVCodecParserContext *s)
> }
> }
>
> -/*****************************************************/
> -
I'd move this in the other patch.
> -int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int
> *buf_size)
> +int ff_combine_frame(ParseContext *pc, int next,
> + const uint8_t **buf, int *buf_size)
> {
> - if(pc->overread){
> + if (pc->overread) {
> av_dlog(NULL, "overread %d, state:%X next:%d index:%d o_index:%d\n",
> pc->overread, pc->state, next, pc->index,
> pc->overread_index);
> - av_dlog(NULL, "%X %X %X %X\n", (*buf)[0], (*buf)[1], (*buf)[2],
> (*buf)[3]);
> + av_dlog(NULL, "%X %X %X %X\n",
> + (*buf)[0], (*buf)[1], (*buf)[2], (*buf)[3]);
> }
[...]
>
> return 0;
> @@ -285,18 +294,15 @@ void ff_parse_close(AVCodecParserContext *s)
> av_freep(&pc->buffer);
> }
>
> -/*************************/
> -
I'd move this in the other patch.
Ok for the rest.
Vittorio
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel