1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
From 1fdd9ba35575f9d5001509111166e98c9d359984 Mon Sep 17 00:00:00 2001
From: Nishanth Peethambaran <nishanth.peethambaran@amd.com>
Date: Tue, 22 Mar 2016 19:21:20 -0400
Subject: [PATCH 3/3] gstomxvideoenc: Update GstBuffer fields on FRC
Update the ts, duration and offset fields of the encoder output
GstBuffer to ensure the bitstream/container has the right header
information.
Signed-off-by: Nishanth Peethambaran <nishanth.peethambaran@amd.com>
---
omx/gstomxvideoenc.c | 13 +++++++++++++
omx/gstomxvideoenc.h | 1 +
2 files changed, 14 insertions(+)
diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c
index 54c8f2c..e3a1b19 100644
--- a/omx/gstomxvideoenc.c
+++ b/omx/gstomxvideoenc.c
@@ -285,6 +285,7 @@ gst_omx_video_enc_init (GstOMXVideoEnc * self)
self->framerate_num = GST_OMX_VIDEO_ENC_FRAMERATE_DEFAULT;
self->framerate_den = GST_OMX_VIDEO_ENC_FRAMERATE_DEFAULT;
self->xEncodeFramerate = 0;
+ self->out_frame_count = 0;
g_mutex_init (&self->drain_lock);
g_cond_init (&self->drain_cond);
@@ -977,10 +978,22 @@ gst_omx_video_enc_handle_output_frame (GstOMXVideoEnc * self, GstOMXPort * port,
}
if (frame) {
+ if (self->xEncodeFramerate) {
+ outbuf->offset = self->out_frame_count++;
+ outbuf->offset_end = self->out_frame_count;
+ frame->pts = outbuf->pts;
+ frame->dts = outbuf->pts;
+ frame->duration = outbuf->duration;
+ }
frame->output_buffer = outbuf;
flow_ret =
gst_video_encoder_finish_frame (GST_VIDEO_ENCODER (self), frame);
} else {
+ if (self->xEncodeFramerate) {
+ outbuf->offset = self->out_frame_count++;
+ outbuf->offset_end = self->out_frame_count;
+ outbuf->dts = outbuf->pts;
+ }
GST_ERROR_OBJECT (self, "No corresponding frame found");
flow_ret = gst_pad_push (GST_VIDEO_ENCODER_SRC_PAD (self), outbuf);
}
diff --git a/omx/gstomxvideoenc.h b/omx/gstomxvideoenc.h
index f09a23b..653d78c 100644
--- a/omx/gstomxvideoenc.h
+++ b/omx/gstomxvideoenc.h
@@ -96,6 +96,7 @@ struct _GstOMXVideoEnc
guint32 framerate_num;
guint32 framerate_den;
OMX_U32 xEncodeFramerate; /* Q16 format */
+ guint32 out_frame_count;
};
struct _GstOMXVideoEncClass
--
2.1.4
|