On Tue, 5 May 2020, Andreas Rheinhardt wrote:

Marton Balint:
Signed-off-by: Marton Balint <c...@passwd.hu>
---
 Changelog                      |   1 +
 doc/bitstream_filters.texi     |  30 ++++++
 libavcodec/Makefile            |   1 +
 libavcodec/bitstream_filters.c |   1 +
 libavcodec/pcm_rechunk_bsf.c   | 220 +++++++++++++++++++++++++++++++++++++++++
 libavcodec/version.h           |   2 +-
 6 files changed, 254 insertions(+), 1 deletion(-)
 create mode 100644 libavcodec/pcm_rechunk_bsf.c


[...]

+++ b/doc/bitstream_filters.texi
@@ -548,6 +548,36 @@ ffmpeg -i INPUT -c copy -bsf noise[=1] output.mkv
 @section null
 This bitstream filter passes the packets through unchanged.

+@section pcm_rechunk
+
+Repacketize PCM audio to a fixed number of samples per packet or a fixed packet
+rate per second. This is similar to the @ref{asetnsamples,,asetnsamples audio
+filter,ffmpeg-filters} but works on audio packets instead of audio frames.
+
+@table @option
+@item nb_out_samples, n
+Set the number of samples per each output audio packet. The number is intended
+as the number of samples @emph{per each channel}. Default value is 1024.
+
+@item pad, p
+If set to 1, the filter will pad the last audio packet with silence, so that it
+will contain the same number of samples (or roughly the same number of samples,
+see @option{frame_rate}) as the previous ones. Default value is 1.
+
+@item frame_rate, r
+This option makes the filter output a fixed numer of packets per second instead

numer

Fixed locally.

[...]

+            } else if (s->in_pkt->size > data_size) {
+                ret = av_packet_ref(pkt, s->in_pkt);
+                if (ret < 0)
+                    return ret;
+                pkt->size = data_size;

I just wonder: Have you tried av_shrink_packet() and found out that it
simply zeroes the data after the end of the packet without any regard to
whether it is writable or not or did you simply just do it the way you
do it here?

I always did it this way.

[...]

--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -28,7 +28,7 @@
 #include "libavutil/version.h"

 #define LIBAVCODEC_VERSION_MAJOR  58
-#define LIBAVCODEC_VERSION_MINOR  82
+#define LIBAVCODEC_VERSION_MINOR  83
 #define LIBAVCODEC_VERSION_MICRO 100

 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \

LGTM apart from that.

Thanks,

Marton
_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Reply via email to