[SCM] libgroove/upstream: ability to get the pts from a buffer
andrewrk-guest at users.alioth.debian.org
andrewrk-guest at users.alioth.debian.org
Tue May 13 03:19:10 UTC 2014
The following commit has been merged in the upstream branch:
commit b36d3473bbf949c69a17392de25f0b67f71334e9
Author: Andrew Kelley <superjoe30 at gmail.com>
Date: Fri May 9 13:00:07 2014 -0700
ability to get the pts from a buffer
diff --git a/groove/buffer.c b/groove/buffer.c
index 8fbda63..95fce45 100644
--- a/groove/buffer.c
+++ b/groove/buffer.c
@@ -38,3 +38,8 @@ void groove_buffer_unref(struct GrooveBuffer *buffer) {
av_free(b);
}
}
+
+uint64_t groove_buffer_pts(struct GrooveBuffer *buffer) {
+ struct GrooveBufferPrivate *b = (struct GrooveBufferPrivate *) buffer;
+ return b->pts;
+}
diff --git a/groove/buffer.h b/groove/buffer.h
index 41c19f1..4d06674 100644
--- a/groove/buffer.h
+++ b/groove/buffer.h
@@ -24,6 +24,8 @@ struct GrooveBufferPrivate {
// used for when is_packet is true
// GrooveBuffer::data[0] will point to this
uint8_t *data;
+
+ uint64_t pts;
};
#endif /* GROOVE_BUFFER_H_INCLUDED */
diff --git a/groove/encoder.c b/groove/encoder.c
index b99a582..663f2f6 100644
--- a/groove/encoder.c
+++ b/groove/encoder.c
@@ -41,6 +41,7 @@ struct GrooveEncoderPrivate {
char drain_cond_inited;
struct GroovePlaylistItem *encode_head;
double encode_pos;
+ uint64_t encode_pts;
struct GrooveAudioFormat encode_format;
@@ -73,6 +74,7 @@ static int encode_buffer(struct GrooveEncoder *encoder, struct GrooveBuffer *buf
struct GrooveBufferPrivate *b = (struct GrooveBufferPrivate *) buffer;
frame = b->frame;
frame->pts = e->next_pts;
+ e->encode_pts = e->next_pts;
e->next_pts += buffer->frame_count + 1;
}
@@ -252,6 +254,7 @@ static int encoder_write_packet(void *opaque, uint8_t *buf, int buf_size) {
buffer->item = e->encode_head;
buffer->pos = e->encode_pos;
+ b->pts = e->encode_pts;
buffer->format = e->encode_format;
b->is_packet = 1;
@@ -615,6 +618,7 @@ int groove_encoder_detach(struct GrooveEncoder *encoder) {
e->encode_head = NULL;
e->encode_pos = -1.0;
+ e->encode_pts = 0;
e->sent_header = 0;
e->abort_request = 0;
e->next_pts = 0;
diff --git a/groove/groove.h b/groove/groove.h
index 68a23f0..aaa06d5 100644
--- a/groove/groove.h
+++ b/groove/groove.h
@@ -259,6 +259,9 @@ struct GrooveBuffer {
void groove_buffer_ref(struct GrooveBuffer *buffer);
void groove_buffer_unref(struct GrooveBuffer *buffer);
+/* return the presentation time stamp of the buffer. */
+uint64_t groove_buffer_pts(struct GrooveBuffer *buffer);
+
/************** GrooveSink ****************/
/* use this to get access to a realtime raw audio buffer
diff --git a/groove/playlist.c b/groove/playlist.c
index a8c3080..52ae7af 100644
--- a/groove/playlist.c
+++ b/groove/playlist.c
@@ -134,6 +134,7 @@ static struct GrooveBuffer * frame_to_groove_buffer(struct GroovePlaylist *playl
buffer->size = frame_size(frame);
b->frame = frame;
+ b->pts = frame->pts;
return buffer;
}
--
libgroove packaging
More information about the pkg-multimedia-commits
mailing list